index.es.js 1.1 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669
  1. import './index.css';
  2. var __defProp = Object.defineProperty;
  3. var __defProps = Object.defineProperties;
  4. var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
  5. var __getOwnPropSymbols = Object.getOwnPropertySymbols;
  6. var __hasOwnProp = Object.prototype.hasOwnProperty;
  7. var __propIsEnum = Object.prototype.propertyIsEnumerable;
  8. var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
  9. var __spreadValues = (a2, b2) => {
  10. for (var prop in b2 || (b2 = {}))
  11. if (__hasOwnProp.call(b2, prop))
  12. __defNormalProp(a2, prop, b2[prop]);
  13. if (__getOwnPropSymbols)
  14. for (var prop of __getOwnPropSymbols(b2)) {
  15. if (__propIsEnum.call(b2, prop))
  16. __defNormalProp(a2, prop, b2[prop]);
  17. }
  18. return a2;
  19. };
  20. var __spreadProps = (a2, b2) => __defProps(a2, __getOwnPropDescs(b2));
  21. var __objRest = (source, exclude) => {
  22. var target = {};
  23. for (var prop in source)
  24. if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
  25. target[prop] = source[prop];
  26. if (source != null && __getOwnPropSymbols)
  27. for (var prop of __getOwnPropSymbols(source)) {
  28. if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
  29. target[prop] = source[prop];
  30. }
  31. return target;
  32. };
  33. import { ref, watch, getCurrentScope, onScopeDispose, unref, defineComponent, openBlock, createElementBlock, createElementVNode, warn, isVNode, Fragment, Comment, getCurrentInstance, computed, inject, provide, onMounted, watchEffect, onBeforeUnmount, isRef, onBeforeMount, mergeProps, renderSlot, useAttrs as useAttrs$1, useSlots, shallowRef, nextTick, onUpdated, toRef, withDirectives, normalizeClass, normalizeStyle, createCommentVNode, createBlock, withCtx, resolveDynamicComponent, withModifiers, createVNode, toDisplayString, vShow, Transition, resolveComponent, reactive, cloneVNode, Text, Teleport, createTextVNode, readonly, resolveDirective, renderList, h as h$1, vModelCheckbox, toRefs, withKeys, vModelRadio, onBeforeUpdate, vModelText, createSlots, markRaw, effectScope, toRaw, triggerRef, normalizeProps, guardReactiveProps, onUnmounted, TransitionGroup, pushScopeId, popScopeId, createPropsRestProxy } from "vue";
  34. import { ElMessage } from "element-plus";
  35. import Draggable from "vuedraggable";
  36. var elMessage = "";
  37. const rules$1 = {
  38. trigger: "blur",
  39. enum: "",
  40. len: void 0,
  41. max: void 0,
  42. message: "",
  43. min: void 0,
  44. pattern: "",
  45. required: false,
  46. type: "any"
  47. };
  48. const getWidgetForm = () => ({
  49. list: [],
  50. config: {
  51. size: "default",
  52. hideRequiredAsterisk: false,
  53. labelWidth: 100,
  54. labelPosition: "right"
  55. }
  56. });
  57. const basicComponents = [
  58. {
  59. label: "\u5355\u884C\u6587\u672C",
  60. type: "input",
  61. options: {
  62. width: "100%",
  63. defaultValue: "",
  64. placeholder: "",
  65. maxlength: null,
  66. prefix: "",
  67. suffix: "",
  68. prepend: "",
  69. append: "",
  70. disabled: false,
  71. clearable: false,
  72. readonly: false,
  73. rules: rules$1
  74. }
  75. },
  76. {
  77. label: "\u5BC6\u7801\u6846",
  78. type: "password",
  79. options: {
  80. width: "100%",
  81. defaultValue: "",
  82. placeholder: "",
  83. maxlength: null,
  84. prefix: "",
  85. suffix: "",
  86. prepend: "",
  87. append: "",
  88. showPassword: true,
  89. disabled: false,
  90. clearable: false,
  91. readonly: false,
  92. rules: rules$1
  93. }
  94. },
  95. {
  96. label: "\u591A\u884C\u6587\u672C",
  97. type: "textarea",
  98. options: {
  99. width: "100%",
  100. defaultValue: "",
  101. placeholder: "",
  102. maxlength: null,
  103. rows: 4,
  104. autosize: false,
  105. showWordLimit: false,
  106. disabled: false,
  107. clearable: false,
  108. readonly: false,
  109. rules: rules$1
  110. }
  111. },
  112. {
  113. label: "\u8BA1\u6570\u5668",
  114. type: "number",
  115. options: {
  116. width: "",
  117. defaultValue: 0,
  118. min: 0,
  119. max: 100,
  120. step: 1,
  121. disabled: false,
  122. rules: rules$1
  123. }
  124. },
  125. {
  126. label: "\u5355\u9009\u6846\u7EC4",
  127. type: "radio",
  128. options: {
  129. defaultValue: "",
  130. width: "",
  131. inline: true,
  132. remote: false,
  133. showLabel: true,
  134. remoteFunc: "https://raw.githubusercontent.com/fuchengwei/vue-form-create/master/mock/mock.json",
  135. options: [
  136. {
  137. value: "Option 1",
  138. label: "Option 1"
  139. },
  140. {
  141. value: "Option 2",
  142. label: "Option 2"
  143. },
  144. {
  145. value: "Option 3",
  146. label: "Option 3"
  147. }
  148. ],
  149. remoteOptions: [],
  150. props: {
  151. value: "value",
  152. label: "label"
  153. },
  154. disabled: false,
  155. rules: rules$1
  156. }
  157. },
  158. {
  159. label: "\u591A\u9009\u6846\u7EC4",
  160. type: "checkbox",
  161. options: {
  162. defaultValue: [],
  163. width: "",
  164. inline: true,
  165. remote: false,
  166. showLabel: true,
  167. remoteFunc: "https://raw.githubusercontent.com/fuchengwei/vue-form-create/master/mock/mock.json",
  168. options: [
  169. {
  170. label: "Option 1",
  171. value: "Option 1"
  172. },
  173. {
  174. label: "Option 2",
  175. value: "Option 2"
  176. },
  177. {
  178. label: "Option 3",
  179. value: "Option 3"
  180. }
  181. ],
  182. remoteOptions: [],
  183. props: {
  184. value: "value",
  185. label: "label"
  186. },
  187. disabled: false,
  188. rules: rules$1
  189. }
  190. },
  191. {
  192. label: "\u65F6\u95F4\u9009\u62E9\u5668",
  193. type: "time",
  194. options: {
  195. defaultValue: "",
  196. width: "",
  197. placeholder: "\u8BF7\u9009\u62E9\u65F6\u95F4",
  198. format: "HH:mm:ss",
  199. valueFormat: "HH:mm:ss",
  200. readonly: false,
  201. editable: true,
  202. clearable: true,
  203. disabled: false,
  204. rules: rules$1
  205. }
  206. },
  207. {
  208. label: "\u65E5\u671F\u9009\u62E9\u5668",
  209. type: "date",
  210. options: {
  211. defaultValue: "",
  212. width: "",
  213. placeholder: "\u8BF7\u9009\u62E9\u65F6\u95F4",
  214. format: "YYYY-MM-DD",
  215. readonly: false,
  216. editable: true,
  217. clearable: true,
  218. disabled: false,
  219. rules: rules$1
  220. }
  221. },
  222. {
  223. label: "\u8BC4\u5206",
  224. type: "rate",
  225. options: {
  226. defaultValue: 0,
  227. max: 5,
  228. allowHalf: false,
  229. disabled: false,
  230. rules: rules$1
  231. }
  232. },
  233. {
  234. label: "\u4E0B\u62C9\u9009\u62E9\u6846",
  235. type: "select",
  236. options: {
  237. defaultValue: "",
  238. width: "200px",
  239. multiple: false,
  240. placeholder: "",
  241. remote: false,
  242. showLabel: true,
  243. filterable: false,
  244. clearable: false,
  245. disabled: false,
  246. props: {
  247. label: "label",
  248. value: "value"
  249. },
  250. options: [
  251. {
  252. label: "Option 1",
  253. value: "Option 1"
  254. },
  255. {
  256. label: "Option 2",
  257. value: "Option 2"
  258. },
  259. {
  260. label: "Option 3",
  261. value: "Option 3"
  262. }
  263. ],
  264. remoteOptions: [],
  265. remoteFunc: "https://raw.githubusercontent.com/fuchengwei/vue-form-create/master/mock/mock.json",
  266. rules: rules$1
  267. }
  268. },
  269. {
  270. label: "\u5F00\u5173",
  271. type: "switch",
  272. options: {
  273. defaultValue: false,
  274. disabled: false,
  275. activeText: "",
  276. inactiveText: "",
  277. rules: rules$1
  278. }
  279. },
  280. {
  281. label: "\u6ED1\u5757",
  282. type: "slider",
  283. options: {
  284. defaultValue: 0,
  285. width: "",
  286. min: 0,
  287. max: 100,
  288. step: 1,
  289. disabled: false,
  290. range: false,
  291. rules: rules$1
  292. }
  293. },
  294. {
  295. label: "\u6587\u5B57",
  296. type: "text",
  297. options: {
  298. defaultValue: "This is a text"
  299. }
  300. }
  301. ];
  302. const basicFields = basicComponents.map((i) => i.type);
  303. const advanceComponents = [
  304. {
  305. label: "\u56FE\u7247",
  306. type: "img-upload",
  307. options: {
  308. defaultValue: [],
  309. name: "file",
  310. action: "http://example.com/upload",
  311. method: "post",
  312. listType: "text",
  313. accept: "image/*",
  314. limit: 1,
  315. multiple: false,
  316. disabled: true,
  317. rules: rules$1
  318. }
  319. },
  320. {
  321. label: "\u4E0B\u8F7D",
  322. type: "download",
  323. labelWidth: "auto",
  324. options: {
  325. defaultValue: "",
  326. name: "file"
  327. }
  328. },
  329. {
  330. label: "\u7EA7\u8054\u9009\u62E9\u5668",
  331. type: "cascader",
  332. options: {
  333. defaultValue: [],
  334. width: "200px",
  335. placeholder: "",
  336. disabled: false,
  337. clearable: false,
  338. filterable: false,
  339. remote: true,
  340. remoteOptions: [],
  341. props: {
  342. label: "label",
  343. value: "value",
  344. children: "children"
  345. },
  346. remoteFunc: "https://raw.githubusercontent.com/fuchengwei/vue-form-create/master/mock/mock.json",
  347. rules: rules$1
  348. }
  349. }
  350. ];
  351. const advanceFields = advanceComponents.map((i) => i.type);
  352. const layoutComponents = [
  353. {
  354. label: "\u6805\u683C\u5E03\u5C40",
  355. type: "grid",
  356. columns: [
  357. {
  358. span: 12,
  359. list: []
  360. },
  361. {
  362. span: 12,
  363. list: []
  364. }
  365. ],
  366. options: {
  367. gutter: 0,
  368. align: "initial"
  369. }
  370. },
  371. {
  372. label: "\u6570\u636E\u8868\u683C",
  373. type: "table",
  374. columns: [
  375. { label: "\u540D\u79F0", prop: "name" },
  376. { label: "\u521B\u5EFA\u65F6\u95F4", prop: "createTime" }
  377. ],
  378. options: {
  379. defaultValue: [],
  380. disabled: false,
  381. size: "",
  382. align: "center"
  383. }
  384. },
  385. {
  386. label: "\u5206\u5272\u7EBF",
  387. type: "divider",
  388. options: {}
  389. }
  390. ];
  391. const layoutFields = layoutComponents.map((i) => i.type);
  392. var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
  393. var freeGlobal$1 = freeGlobal;
  394. var freeSelf = typeof self == "object" && self && self.Object === Object && self;
  395. var root = freeGlobal$1 || freeSelf || Function("return this")();
  396. var root$1 = root;
  397. var Symbol$1 = root$1.Symbol;
  398. var Symbol$2 = Symbol$1;
  399. var objectProto$e = Object.prototype;
  400. var hasOwnProperty$c = objectProto$e.hasOwnProperty;
  401. var nativeObjectToString$1 = objectProto$e.toString;
  402. var symToStringTag$1 = Symbol$2 ? Symbol$2.toStringTag : void 0;
  403. function getRawTag(value) {
  404. var isOwn = hasOwnProperty$c.call(value, symToStringTag$1), tag = value[symToStringTag$1];
  405. try {
  406. value[symToStringTag$1] = void 0;
  407. var unmasked = true;
  408. } catch (e) {
  409. }
  410. var result = nativeObjectToString$1.call(value);
  411. if (unmasked) {
  412. if (isOwn) {
  413. value[symToStringTag$1] = tag;
  414. } else {
  415. delete value[symToStringTag$1];
  416. }
  417. }
  418. return result;
  419. }
  420. var objectProto$d = Object.prototype;
  421. var nativeObjectToString = objectProto$d.toString;
  422. function objectToString$1(value) {
  423. return nativeObjectToString.call(value);
  424. }
  425. var nullTag = "[object Null]", undefinedTag = "[object Undefined]";
  426. var symToStringTag = Symbol$2 ? Symbol$2.toStringTag : void 0;
  427. function baseGetTag(value) {
  428. if (value == null) {
  429. return value === void 0 ? undefinedTag : nullTag;
  430. }
  431. return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString$1(value);
  432. }
  433. function isObjectLike(value) {
  434. return value != null && typeof value == "object";
  435. }
  436. var symbolTag$3 = "[object Symbol]";
  437. function isSymbol(value) {
  438. return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag$3;
  439. }
  440. function arrayMap(array4, iteratee) {
  441. var index = -1, length = array4 == null ? 0 : array4.length, result = Array(length);
  442. while (++index < length) {
  443. result[index] = iteratee(array4[index], index, array4);
  444. }
  445. return result;
  446. }
  447. var isArray$1 = Array.isArray;
  448. var isArray$2 = isArray$1;
  449. var INFINITY$3 = 1 / 0;
  450. var symbolProto$2 = Symbol$2 ? Symbol$2.prototype : void 0, symbolToString = symbolProto$2 ? symbolProto$2.toString : void 0;
  451. function baseToString(value) {
  452. if (typeof value == "string") {
  453. return value;
  454. }
  455. if (isArray$2(value)) {
  456. return arrayMap(value, baseToString) + "";
  457. }
  458. if (isSymbol(value)) {
  459. return symbolToString ? symbolToString.call(value) : "";
  460. }
  461. var result = value + "";
  462. return result == "0" && 1 / value == -INFINITY$3 ? "-0" : result;
  463. }
  464. var reWhitespace = /\s/;
  465. function trimmedEndIndex(string3) {
  466. var index = string3.length;
  467. while (index-- && reWhitespace.test(string3.charAt(index))) {
  468. }
  469. return index;
  470. }
  471. var reTrimStart = /^\s+/;
  472. function baseTrim(string3) {
  473. return string3 ? string3.slice(0, trimmedEndIndex(string3) + 1).replace(reTrimStart, "") : string3;
  474. }
  475. function isObject$2(value) {
  476. var type4 = typeof value;
  477. return value != null && (type4 == "object" || type4 == "function");
  478. }
  479. var NAN = 0 / 0;
  480. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  481. var reIsBinary = /^0b[01]+$/i;
  482. var reIsOctal = /^0o[0-7]+$/i;
  483. var freeParseInt = parseInt;
  484. function toNumber(value) {
  485. if (typeof value == "number") {
  486. return value;
  487. }
  488. if (isSymbol(value)) {
  489. return NAN;
  490. }
  491. if (isObject$2(value)) {
  492. var other = typeof value.valueOf == "function" ? value.valueOf() : value;
  493. value = isObject$2(other) ? other + "" : other;
  494. }
  495. if (typeof value != "string") {
  496. return value === 0 ? value : +value;
  497. }
  498. value = baseTrim(value);
  499. var isBinary = reIsBinary.test(value);
  500. return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
  501. }
  502. function identity(value) {
  503. return value;
  504. }
  505. var asyncTag = "[object AsyncFunction]", funcTag$2 = "[object Function]", genTag$1 = "[object GeneratorFunction]", proxyTag = "[object Proxy]";
  506. function isFunction$1(value) {
  507. if (!isObject$2(value)) {
  508. return false;
  509. }
  510. var tag = baseGetTag(value);
  511. return tag == funcTag$2 || tag == genTag$1 || tag == asyncTag || tag == proxyTag;
  512. }
  513. var coreJsData = root$1["__core-js_shared__"];
  514. var coreJsData$1 = coreJsData;
  515. var maskSrcKey = function() {
  516. var uid2 = /[^.]+$/.exec(coreJsData$1 && coreJsData$1.keys && coreJsData$1.keys.IE_PROTO || "");
  517. return uid2 ? "Symbol(src)_1." + uid2 : "";
  518. }();
  519. function isMasked(func) {
  520. return !!maskSrcKey && maskSrcKey in func;
  521. }
  522. var funcProto$1 = Function.prototype;
  523. var funcToString$1 = funcProto$1.toString;
  524. function toSource(func) {
  525. if (func != null) {
  526. try {
  527. return funcToString$1.call(func);
  528. } catch (e) {
  529. }
  530. try {
  531. return func + "";
  532. } catch (e) {
  533. }
  534. }
  535. return "";
  536. }
  537. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
  538. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  539. var funcProto = Function.prototype, objectProto$c = Object.prototype;
  540. var funcToString = funcProto.toString;
  541. var hasOwnProperty$b = objectProto$c.hasOwnProperty;
  542. var reIsNative = RegExp("^" + funcToString.call(hasOwnProperty$b).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$");
  543. function baseIsNative(value) {
  544. if (!isObject$2(value) || isMasked(value)) {
  545. return false;
  546. }
  547. var pattern4 = isFunction$1(value) ? reIsNative : reIsHostCtor;
  548. return pattern4.test(toSource(value));
  549. }
  550. function getValue$1(object4, key) {
  551. return object4 == null ? void 0 : object4[key];
  552. }
  553. function getNative(object4, key) {
  554. var value = getValue$1(object4, key);
  555. return baseIsNative(value) ? value : void 0;
  556. }
  557. var WeakMap = getNative(root$1, "WeakMap");
  558. var WeakMap$1 = WeakMap;
  559. var objectCreate = Object.create;
  560. var baseCreate = function() {
  561. function object4() {
  562. }
  563. return function(proto) {
  564. if (!isObject$2(proto)) {
  565. return {};
  566. }
  567. if (objectCreate) {
  568. return objectCreate(proto);
  569. }
  570. object4.prototype = proto;
  571. var result = new object4();
  572. object4.prototype = void 0;
  573. return result;
  574. };
  575. }();
  576. var baseCreate$1 = baseCreate;
  577. function apply(func, thisArg, args) {
  578. switch (args.length) {
  579. case 0:
  580. return func.call(thisArg);
  581. case 1:
  582. return func.call(thisArg, args[0]);
  583. case 2:
  584. return func.call(thisArg, args[0], args[1]);
  585. case 3:
  586. return func.call(thisArg, args[0], args[1], args[2]);
  587. }
  588. return func.apply(thisArg, args);
  589. }
  590. function noop$1() {
  591. }
  592. function copyArray(source, array4) {
  593. var index = -1, length = source.length;
  594. array4 || (array4 = Array(length));
  595. while (++index < length) {
  596. array4[index] = source[index];
  597. }
  598. return array4;
  599. }
  600. var HOT_COUNT = 800, HOT_SPAN = 16;
  601. var nativeNow = Date.now;
  602. function shortOut(func) {
  603. var count = 0, lastCalled = 0;
  604. return function() {
  605. var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled);
  606. lastCalled = stamp;
  607. if (remaining > 0) {
  608. if (++count >= HOT_COUNT) {
  609. return arguments[0];
  610. }
  611. } else {
  612. count = 0;
  613. }
  614. return func.apply(void 0, arguments);
  615. };
  616. }
  617. function constant(value) {
  618. return function() {
  619. return value;
  620. };
  621. }
  622. var defineProperty = function() {
  623. try {
  624. var func = getNative(Object, "defineProperty");
  625. func({}, "", {});
  626. return func;
  627. } catch (e) {
  628. }
  629. }();
  630. var defineProperty$1 = defineProperty;
  631. var baseSetToString = !defineProperty$1 ? identity : function(func, string3) {
  632. return defineProperty$1(func, "toString", {
  633. "configurable": true,
  634. "enumerable": false,
  635. "value": constant(string3),
  636. "writable": true
  637. });
  638. };
  639. var baseSetToString$1 = baseSetToString;
  640. var setToString = shortOut(baseSetToString$1);
  641. var setToString$1 = setToString;
  642. function arrayEach(array4, iteratee) {
  643. var index = -1, length = array4 == null ? 0 : array4.length;
  644. while (++index < length) {
  645. if (iteratee(array4[index], index, array4) === false) {
  646. break;
  647. }
  648. }
  649. return array4;
  650. }
  651. function baseFindIndex(array4, predicate, fromIndex, fromRight) {
  652. var length = array4.length, index = fromIndex + (fromRight ? 1 : -1);
  653. while (fromRight ? index-- : ++index < length) {
  654. if (predicate(array4[index], index, array4)) {
  655. return index;
  656. }
  657. }
  658. return -1;
  659. }
  660. function baseIsNaN(value) {
  661. return value !== value;
  662. }
  663. function strictIndexOf(array4, value, fromIndex) {
  664. var index = fromIndex - 1, length = array4.length;
  665. while (++index < length) {
  666. if (array4[index] === value) {
  667. return index;
  668. }
  669. }
  670. return -1;
  671. }
  672. function baseIndexOf(array4, value, fromIndex) {
  673. return value === value ? strictIndexOf(array4, value, fromIndex) : baseFindIndex(array4, baseIsNaN, fromIndex);
  674. }
  675. function arrayIncludes(array4, value) {
  676. var length = array4 == null ? 0 : array4.length;
  677. return !!length && baseIndexOf(array4, value, 0) > -1;
  678. }
  679. var MAX_SAFE_INTEGER$1 = 9007199254740991;
  680. var reIsUint = /^(?:0|[1-9]\d*)$/;
  681. function isIndex(value, length) {
  682. var type4 = typeof value;
  683. length = length == null ? MAX_SAFE_INTEGER$1 : length;
  684. return !!length && (type4 == "number" || type4 != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
  685. }
  686. function baseAssignValue(object4, key, value) {
  687. if (key == "__proto__" && defineProperty$1) {
  688. defineProperty$1(object4, key, {
  689. "configurable": true,
  690. "enumerable": true,
  691. "value": value,
  692. "writable": true
  693. });
  694. } else {
  695. object4[key] = value;
  696. }
  697. }
  698. function eq(value, other) {
  699. return value === other || value !== value && other !== other;
  700. }
  701. var objectProto$b = Object.prototype;
  702. var hasOwnProperty$a = objectProto$b.hasOwnProperty;
  703. function assignValue(object4, key, value) {
  704. var objValue = object4[key];
  705. if (!(hasOwnProperty$a.call(object4, key) && eq(objValue, value)) || value === void 0 && !(key in object4)) {
  706. baseAssignValue(object4, key, value);
  707. }
  708. }
  709. function copyObject(source, props, object4, customizer) {
  710. var isNew = !object4;
  711. object4 || (object4 = {});
  712. var index = -1, length = props.length;
  713. while (++index < length) {
  714. var key = props[index];
  715. var newValue = customizer ? customizer(object4[key], source[key], key, object4, source) : void 0;
  716. if (newValue === void 0) {
  717. newValue = source[key];
  718. }
  719. if (isNew) {
  720. baseAssignValue(object4, key, newValue);
  721. } else {
  722. assignValue(object4, key, newValue);
  723. }
  724. }
  725. return object4;
  726. }
  727. var nativeMax$1 = Math.max;
  728. function overRest(func, start2, transform) {
  729. start2 = nativeMax$1(start2 === void 0 ? func.length - 1 : start2, 0);
  730. return function() {
  731. var args = arguments, index = -1, length = nativeMax$1(args.length - start2, 0), array4 = Array(length);
  732. while (++index < length) {
  733. array4[index] = args[start2 + index];
  734. }
  735. index = -1;
  736. var otherArgs = Array(start2 + 1);
  737. while (++index < start2) {
  738. otherArgs[index] = args[index];
  739. }
  740. otherArgs[start2] = transform(array4);
  741. return apply(func, this, otherArgs);
  742. };
  743. }
  744. function baseRest(func, start2) {
  745. return setToString$1(overRest(func, start2, identity), func + "");
  746. }
  747. var MAX_SAFE_INTEGER = 9007199254740991;
  748. function isLength(value) {
  749. return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  750. }
  751. function isArrayLike(value) {
  752. return value != null && isLength(value.length) && !isFunction$1(value);
  753. }
  754. var objectProto$a = Object.prototype;
  755. function isPrototype(value) {
  756. var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto$a;
  757. return value === proto;
  758. }
  759. function baseTimes(n, iteratee) {
  760. var index = -1, result = Array(n);
  761. while (++index < n) {
  762. result[index] = iteratee(index);
  763. }
  764. return result;
  765. }
  766. var argsTag$3 = "[object Arguments]";
  767. function baseIsArguments(value) {
  768. return isObjectLike(value) && baseGetTag(value) == argsTag$3;
  769. }
  770. var objectProto$9 = Object.prototype;
  771. var hasOwnProperty$9 = objectProto$9.hasOwnProperty;
  772. var propertyIsEnumerable$1 = objectProto$9.propertyIsEnumerable;
  773. var isArguments = baseIsArguments(function() {
  774. return arguments;
  775. }()) ? baseIsArguments : function(value) {
  776. return isObjectLike(value) && hasOwnProperty$9.call(value, "callee") && !propertyIsEnumerable$1.call(value, "callee");
  777. };
  778. var isArguments$1 = isArguments;
  779. function stubFalse() {
  780. return false;
  781. }
  782. var freeExports$2 = typeof exports == "object" && exports && !exports.nodeType && exports;
  783. var freeModule$2 = freeExports$2 && typeof module == "object" && module && !module.nodeType && module;
  784. var moduleExports$2 = freeModule$2 && freeModule$2.exports === freeExports$2;
  785. var Buffer$1 = moduleExports$2 ? root$1.Buffer : void 0;
  786. var nativeIsBuffer = Buffer$1 ? Buffer$1.isBuffer : void 0;
  787. var isBuffer = nativeIsBuffer || stubFalse;
  788. var isBuffer$1 = isBuffer;
  789. var argsTag$2 = "[object Arguments]", arrayTag$2 = "[object Array]", boolTag$3 = "[object Boolean]", dateTag$3 = "[object Date]", errorTag$2 = "[object Error]", funcTag$1 = "[object Function]", mapTag$5 = "[object Map]", numberTag$3 = "[object Number]", objectTag$3 = "[object Object]", regexpTag$3 = "[object RegExp]", setTag$5 = "[object Set]", stringTag$3 = "[object String]", weakMapTag$2 = "[object WeakMap]";
  790. var arrayBufferTag$3 = "[object ArrayBuffer]", dataViewTag$4 = "[object DataView]", float32Tag$2 = "[object Float32Array]", float64Tag$2 = "[object Float64Array]", int8Tag$2 = "[object Int8Array]", int16Tag$2 = "[object Int16Array]", int32Tag$2 = "[object Int32Array]", uint8Tag$2 = "[object Uint8Array]", uint8ClampedTag$2 = "[object Uint8ClampedArray]", uint16Tag$2 = "[object Uint16Array]", uint32Tag$2 = "[object Uint32Array]";
  791. var typedArrayTags = {};
  792. typedArrayTags[float32Tag$2] = typedArrayTags[float64Tag$2] = typedArrayTags[int8Tag$2] = typedArrayTags[int16Tag$2] = typedArrayTags[int32Tag$2] = typedArrayTags[uint8Tag$2] = typedArrayTags[uint8ClampedTag$2] = typedArrayTags[uint16Tag$2] = typedArrayTags[uint32Tag$2] = true;
  793. typedArrayTags[argsTag$2] = typedArrayTags[arrayTag$2] = typedArrayTags[arrayBufferTag$3] = typedArrayTags[boolTag$3] = typedArrayTags[dataViewTag$4] = typedArrayTags[dateTag$3] = typedArrayTags[errorTag$2] = typedArrayTags[funcTag$1] = typedArrayTags[mapTag$5] = typedArrayTags[numberTag$3] = typedArrayTags[objectTag$3] = typedArrayTags[regexpTag$3] = typedArrayTags[setTag$5] = typedArrayTags[stringTag$3] = typedArrayTags[weakMapTag$2] = false;
  794. function baseIsTypedArray(value) {
  795. return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  796. }
  797. function baseUnary(func) {
  798. return function(value) {
  799. return func(value);
  800. };
  801. }
  802. var freeExports$1 = typeof exports == "object" && exports && !exports.nodeType && exports;
  803. var freeModule$1 = freeExports$1 && typeof module == "object" && module && !module.nodeType && module;
  804. var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1;
  805. var freeProcess = moduleExports$1 && freeGlobal$1.process;
  806. var nodeUtil = function() {
  807. try {
  808. var types2 = freeModule$1 && freeModule$1.require && freeModule$1.require("util").types;
  809. if (types2) {
  810. return types2;
  811. }
  812. return freeProcess && freeProcess.binding && freeProcess.binding("util");
  813. } catch (e) {
  814. }
  815. }();
  816. var nodeUtil$1 = nodeUtil;
  817. var nodeIsTypedArray = nodeUtil$1 && nodeUtil$1.isTypedArray;
  818. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  819. var isTypedArray$1 = isTypedArray;
  820. var objectProto$8 = Object.prototype;
  821. var hasOwnProperty$8 = objectProto$8.hasOwnProperty;
  822. function arrayLikeKeys(value, inherited) {
  823. var isArr = isArray$2(value), isArg = !isArr && isArguments$1(value), isBuff = !isArr && !isArg && isBuffer$1(value), isType = !isArr && !isArg && !isBuff && isTypedArray$1(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes(value.length, String) : [], length = result.length;
  824. for (var key in value) {
  825. if ((inherited || hasOwnProperty$8.call(value, key)) && !(skipIndexes && (key == "length" || isBuff && (key == "offset" || key == "parent") || isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || isIndex(key, length)))) {
  826. result.push(key);
  827. }
  828. }
  829. return result;
  830. }
  831. function overArg(func, transform) {
  832. return function(arg) {
  833. return func(transform(arg));
  834. };
  835. }
  836. var nativeKeys = overArg(Object.keys, Object);
  837. var nativeKeys$1 = nativeKeys;
  838. var objectProto$7 = Object.prototype;
  839. var hasOwnProperty$7 = objectProto$7.hasOwnProperty;
  840. function baseKeys(object4) {
  841. if (!isPrototype(object4)) {
  842. return nativeKeys$1(object4);
  843. }
  844. var result = [];
  845. for (var key in Object(object4)) {
  846. if (hasOwnProperty$7.call(object4, key) && key != "constructor") {
  847. result.push(key);
  848. }
  849. }
  850. return result;
  851. }
  852. function keys(object4) {
  853. return isArrayLike(object4) ? arrayLikeKeys(object4) : baseKeys(object4);
  854. }
  855. function nativeKeysIn(object4) {
  856. var result = [];
  857. if (object4 != null) {
  858. for (var key in Object(object4)) {
  859. result.push(key);
  860. }
  861. }
  862. return result;
  863. }
  864. var objectProto$6 = Object.prototype;
  865. var hasOwnProperty$6 = objectProto$6.hasOwnProperty;
  866. function baseKeysIn(object4) {
  867. if (!isObject$2(object4)) {
  868. return nativeKeysIn(object4);
  869. }
  870. var isProto = isPrototype(object4), result = [];
  871. for (var key in object4) {
  872. if (!(key == "constructor" && (isProto || !hasOwnProperty$6.call(object4, key)))) {
  873. result.push(key);
  874. }
  875. }
  876. return result;
  877. }
  878. function keysIn(object4) {
  879. return isArrayLike(object4) ? arrayLikeKeys(object4, true) : baseKeysIn(object4);
  880. }
  881. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/;
  882. function isKey(value, object4) {
  883. if (isArray$2(value)) {
  884. return false;
  885. }
  886. var type4 = typeof value;
  887. if (type4 == "number" || type4 == "symbol" || type4 == "boolean" || value == null || isSymbol(value)) {
  888. return true;
  889. }
  890. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object4 != null && value in Object(object4);
  891. }
  892. var nativeCreate = getNative(Object, "create");
  893. var nativeCreate$1 = nativeCreate;
  894. function hashClear() {
  895. this.__data__ = nativeCreate$1 ? nativeCreate$1(null) : {};
  896. this.size = 0;
  897. }
  898. function hashDelete(key) {
  899. var result = this.has(key) && delete this.__data__[key];
  900. this.size -= result ? 1 : 0;
  901. return result;
  902. }
  903. var HASH_UNDEFINED$2 = "__lodash_hash_undefined__";
  904. var objectProto$5 = Object.prototype;
  905. var hasOwnProperty$5 = objectProto$5.hasOwnProperty;
  906. function hashGet(key) {
  907. var data2 = this.__data__;
  908. if (nativeCreate$1) {
  909. var result = data2[key];
  910. return result === HASH_UNDEFINED$2 ? void 0 : result;
  911. }
  912. return hasOwnProperty$5.call(data2, key) ? data2[key] : void 0;
  913. }
  914. var objectProto$4 = Object.prototype;
  915. var hasOwnProperty$4 = objectProto$4.hasOwnProperty;
  916. function hashHas(key) {
  917. var data2 = this.__data__;
  918. return nativeCreate$1 ? data2[key] !== void 0 : hasOwnProperty$4.call(data2, key);
  919. }
  920. var HASH_UNDEFINED$1 = "__lodash_hash_undefined__";
  921. function hashSet(key, value) {
  922. var data2 = this.__data__;
  923. this.size += this.has(key) ? 0 : 1;
  924. data2[key] = nativeCreate$1 && value === void 0 ? HASH_UNDEFINED$1 : value;
  925. return this;
  926. }
  927. function Hash(entries) {
  928. var index = -1, length = entries == null ? 0 : entries.length;
  929. this.clear();
  930. while (++index < length) {
  931. var entry = entries[index];
  932. this.set(entry[0], entry[1]);
  933. }
  934. }
  935. Hash.prototype.clear = hashClear;
  936. Hash.prototype["delete"] = hashDelete;
  937. Hash.prototype.get = hashGet;
  938. Hash.prototype.has = hashHas;
  939. Hash.prototype.set = hashSet;
  940. function listCacheClear() {
  941. this.__data__ = [];
  942. this.size = 0;
  943. }
  944. function assocIndexOf(array4, key) {
  945. var length = array4.length;
  946. while (length--) {
  947. if (eq(array4[length][0], key)) {
  948. return length;
  949. }
  950. }
  951. return -1;
  952. }
  953. var arrayProto = Array.prototype;
  954. var splice = arrayProto.splice;
  955. function listCacheDelete(key) {
  956. var data2 = this.__data__, index = assocIndexOf(data2, key);
  957. if (index < 0) {
  958. return false;
  959. }
  960. var lastIndex = data2.length - 1;
  961. if (index == lastIndex) {
  962. data2.pop();
  963. } else {
  964. splice.call(data2, index, 1);
  965. }
  966. --this.size;
  967. return true;
  968. }
  969. function listCacheGet(key) {
  970. var data2 = this.__data__, index = assocIndexOf(data2, key);
  971. return index < 0 ? void 0 : data2[index][1];
  972. }
  973. function listCacheHas(key) {
  974. return assocIndexOf(this.__data__, key) > -1;
  975. }
  976. function listCacheSet(key, value) {
  977. var data2 = this.__data__, index = assocIndexOf(data2, key);
  978. if (index < 0) {
  979. ++this.size;
  980. data2.push([key, value]);
  981. } else {
  982. data2[index][1] = value;
  983. }
  984. return this;
  985. }
  986. function ListCache(entries) {
  987. var index = -1, length = entries == null ? 0 : entries.length;
  988. this.clear();
  989. while (++index < length) {
  990. var entry = entries[index];
  991. this.set(entry[0], entry[1]);
  992. }
  993. }
  994. ListCache.prototype.clear = listCacheClear;
  995. ListCache.prototype["delete"] = listCacheDelete;
  996. ListCache.prototype.get = listCacheGet;
  997. ListCache.prototype.has = listCacheHas;
  998. ListCache.prototype.set = listCacheSet;
  999. var Map$1 = getNative(root$1, "Map");
  1000. var Map$2 = Map$1;
  1001. function mapCacheClear() {
  1002. this.size = 0;
  1003. this.__data__ = {
  1004. "hash": new Hash(),
  1005. "map": new (Map$2 || ListCache)(),
  1006. "string": new Hash()
  1007. };
  1008. }
  1009. function isKeyable(value) {
  1010. var type4 = typeof value;
  1011. return type4 == "string" || type4 == "number" || type4 == "symbol" || type4 == "boolean" ? value !== "__proto__" : value === null;
  1012. }
  1013. function getMapData(map, key) {
  1014. var data2 = map.__data__;
  1015. return isKeyable(key) ? data2[typeof key == "string" ? "string" : "hash"] : data2.map;
  1016. }
  1017. function mapCacheDelete(key) {
  1018. var result = getMapData(this, key)["delete"](key);
  1019. this.size -= result ? 1 : 0;
  1020. return result;
  1021. }
  1022. function mapCacheGet(key) {
  1023. return getMapData(this, key).get(key);
  1024. }
  1025. function mapCacheHas(key) {
  1026. return getMapData(this, key).has(key);
  1027. }
  1028. function mapCacheSet(key, value) {
  1029. var data2 = getMapData(this, key), size = data2.size;
  1030. data2.set(key, value);
  1031. this.size += data2.size == size ? 0 : 1;
  1032. return this;
  1033. }
  1034. function MapCache(entries) {
  1035. var index = -1, length = entries == null ? 0 : entries.length;
  1036. this.clear();
  1037. while (++index < length) {
  1038. var entry = entries[index];
  1039. this.set(entry[0], entry[1]);
  1040. }
  1041. }
  1042. MapCache.prototype.clear = mapCacheClear;
  1043. MapCache.prototype["delete"] = mapCacheDelete;
  1044. MapCache.prototype.get = mapCacheGet;
  1045. MapCache.prototype.has = mapCacheHas;
  1046. MapCache.prototype.set = mapCacheSet;
  1047. var FUNC_ERROR_TEXT$2 = "Expected a function";
  1048. function memoize(func, resolver) {
  1049. if (typeof func != "function" || resolver != null && typeof resolver != "function") {
  1050. throw new TypeError(FUNC_ERROR_TEXT$2);
  1051. }
  1052. var memoized = function() {
  1053. var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
  1054. if (cache.has(key)) {
  1055. return cache.get(key);
  1056. }
  1057. var result = func.apply(this, args);
  1058. memoized.cache = cache.set(key, result) || cache;
  1059. return result;
  1060. };
  1061. memoized.cache = new (memoize.Cache || MapCache)();
  1062. return memoized;
  1063. }
  1064. memoize.Cache = MapCache;
  1065. var MAX_MEMOIZE_SIZE = 500;
  1066. function memoizeCapped(func) {
  1067. var result = memoize(func, function(key) {
  1068. if (cache.size === MAX_MEMOIZE_SIZE) {
  1069. cache.clear();
  1070. }
  1071. return key;
  1072. });
  1073. var cache = result.cache;
  1074. return result;
  1075. }
  1076. var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  1077. var reEscapeChar = /\\(\\)?/g;
  1078. var stringToPath = memoizeCapped(function(string3) {
  1079. var result = [];
  1080. if (string3.charCodeAt(0) === 46) {
  1081. result.push("");
  1082. }
  1083. string3.replace(rePropName, function(match, number4, quote, subString) {
  1084. result.push(quote ? subString.replace(reEscapeChar, "$1") : number4 || match);
  1085. });
  1086. return result;
  1087. });
  1088. var stringToPath$1 = stringToPath;
  1089. function toString(value) {
  1090. return value == null ? "" : baseToString(value);
  1091. }
  1092. function castPath(value, object4) {
  1093. if (isArray$2(value)) {
  1094. return value;
  1095. }
  1096. return isKey(value, object4) ? [value] : stringToPath$1(toString(value));
  1097. }
  1098. var INFINITY$2 = 1 / 0;
  1099. function toKey(value) {
  1100. if (typeof value == "string" || isSymbol(value)) {
  1101. return value;
  1102. }
  1103. var result = value + "";
  1104. return result == "0" && 1 / value == -INFINITY$2 ? "-0" : result;
  1105. }
  1106. function baseGet(object4, path) {
  1107. path = castPath(path, object4);
  1108. var index = 0, length = path.length;
  1109. while (object4 != null && index < length) {
  1110. object4 = object4[toKey(path[index++])];
  1111. }
  1112. return index && index == length ? object4 : void 0;
  1113. }
  1114. function get(object4, path, defaultValue) {
  1115. var result = object4 == null ? void 0 : baseGet(object4, path);
  1116. return result === void 0 ? defaultValue : result;
  1117. }
  1118. function arrayPush(array4, values) {
  1119. var index = -1, length = values.length, offset2 = array4.length;
  1120. while (++index < length) {
  1121. array4[offset2 + index] = values[index];
  1122. }
  1123. return array4;
  1124. }
  1125. var spreadableSymbol = Symbol$2 ? Symbol$2.isConcatSpreadable : void 0;
  1126. function isFlattenable(value) {
  1127. return isArray$2(value) || isArguments$1(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
  1128. }
  1129. function baseFlatten(array4, depth, predicate, isStrict, result) {
  1130. var index = -1, length = array4.length;
  1131. predicate || (predicate = isFlattenable);
  1132. result || (result = []);
  1133. while (++index < length) {
  1134. var value = array4[index];
  1135. if (depth > 0 && predicate(value)) {
  1136. if (depth > 1) {
  1137. baseFlatten(value, depth - 1, predicate, isStrict, result);
  1138. } else {
  1139. arrayPush(result, value);
  1140. }
  1141. } else if (!isStrict) {
  1142. result[result.length] = value;
  1143. }
  1144. }
  1145. return result;
  1146. }
  1147. var getPrototype = overArg(Object.getPrototypeOf, Object);
  1148. var getPrototype$1 = getPrototype;
  1149. function castArray$1() {
  1150. if (!arguments.length) {
  1151. return [];
  1152. }
  1153. var value = arguments[0];
  1154. return isArray$2(value) ? value : [value];
  1155. }
  1156. function stackClear() {
  1157. this.__data__ = new ListCache();
  1158. this.size = 0;
  1159. }
  1160. function stackDelete(key) {
  1161. var data2 = this.__data__, result = data2["delete"](key);
  1162. this.size = data2.size;
  1163. return result;
  1164. }
  1165. function stackGet(key) {
  1166. return this.__data__.get(key);
  1167. }
  1168. function stackHas(key) {
  1169. return this.__data__.has(key);
  1170. }
  1171. var LARGE_ARRAY_SIZE$1 = 200;
  1172. function stackSet(key, value) {
  1173. var data2 = this.__data__;
  1174. if (data2 instanceof ListCache) {
  1175. var pairs = data2.__data__;
  1176. if (!Map$2 || pairs.length < LARGE_ARRAY_SIZE$1 - 1) {
  1177. pairs.push([key, value]);
  1178. this.size = ++data2.size;
  1179. return this;
  1180. }
  1181. data2 = this.__data__ = new MapCache(pairs);
  1182. }
  1183. data2.set(key, value);
  1184. this.size = data2.size;
  1185. return this;
  1186. }
  1187. function Stack(entries) {
  1188. var data2 = this.__data__ = new ListCache(entries);
  1189. this.size = data2.size;
  1190. }
  1191. Stack.prototype.clear = stackClear;
  1192. Stack.prototype["delete"] = stackDelete;
  1193. Stack.prototype.get = stackGet;
  1194. Stack.prototype.has = stackHas;
  1195. Stack.prototype.set = stackSet;
  1196. function baseAssign(object4, source) {
  1197. return object4 && copyObject(source, keys(source), object4);
  1198. }
  1199. function baseAssignIn(object4, source) {
  1200. return object4 && copyObject(source, keysIn(source), object4);
  1201. }
  1202. var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
  1203. var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
  1204. var moduleExports = freeModule && freeModule.exports === freeExports;
  1205. var Buffer2 = moduleExports ? root$1.Buffer : void 0, allocUnsafe = Buffer2 ? Buffer2.allocUnsafe : void 0;
  1206. function cloneBuffer(buffer, isDeep) {
  1207. if (isDeep) {
  1208. return buffer.slice();
  1209. }
  1210. var length = buffer.length, result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  1211. buffer.copy(result);
  1212. return result;
  1213. }
  1214. function arrayFilter(array4, predicate) {
  1215. var index = -1, length = array4 == null ? 0 : array4.length, resIndex = 0, result = [];
  1216. while (++index < length) {
  1217. var value = array4[index];
  1218. if (predicate(value, index, array4)) {
  1219. result[resIndex++] = value;
  1220. }
  1221. }
  1222. return result;
  1223. }
  1224. function stubArray() {
  1225. return [];
  1226. }
  1227. var objectProto$3 = Object.prototype;
  1228. var propertyIsEnumerable = objectProto$3.propertyIsEnumerable;
  1229. var nativeGetSymbols$1 = Object.getOwnPropertySymbols;
  1230. var getSymbols = !nativeGetSymbols$1 ? stubArray : function(object4) {
  1231. if (object4 == null) {
  1232. return [];
  1233. }
  1234. object4 = Object(object4);
  1235. return arrayFilter(nativeGetSymbols$1(object4), function(symbol) {
  1236. return propertyIsEnumerable.call(object4, symbol);
  1237. });
  1238. };
  1239. var getSymbols$1 = getSymbols;
  1240. function copySymbols(source, object4) {
  1241. return copyObject(source, getSymbols$1(source), object4);
  1242. }
  1243. var nativeGetSymbols = Object.getOwnPropertySymbols;
  1244. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object4) {
  1245. var result = [];
  1246. while (object4) {
  1247. arrayPush(result, getSymbols$1(object4));
  1248. object4 = getPrototype$1(object4);
  1249. }
  1250. return result;
  1251. };
  1252. var getSymbolsIn$1 = getSymbolsIn;
  1253. function copySymbolsIn(source, object4) {
  1254. return copyObject(source, getSymbolsIn$1(source), object4);
  1255. }
  1256. function baseGetAllKeys(object4, keysFunc, symbolsFunc) {
  1257. var result = keysFunc(object4);
  1258. return isArray$2(object4) ? result : arrayPush(result, symbolsFunc(object4));
  1259. }
  1260. function getAllKeys(object4) {
  1261. return baseGetAllKeys(object4, keys, getSymbols$1);
  1262. }
  1263. function getAllKeysIn(object4) {
  1264. return baseGetAllKeys(object4, keysIn, getSymbolsIn$1);
  1265. }
  1266. var DataView = getNative(root$1, "DataView");
  1267. var DataView$1 = DataView;
  1268. var Promise$1 = getNative(root$1, "Promise");
  1269. var Promise$2 = Promise$1;
  1270. var Set$1 = getNative(root$1, "Set");
  1271. var Set$2 = Set$1;
  1272. var mapTag$4 = "[object Map]", objectTag$2 = "[object Object]", promiseTag = "[object Promise]", setTag$4 = "[object Set]", weakMapTag$1 = "[object WeakMap]";
  1273. var dataViewTag$3 = "[object DataView]";
  1274. var dataViewCtorString = toSource(DataView$1), mapCtorString = toSource(Map$2), promiseCtorString = toSource(Promise$2), setCtorString = toSource(Set$2), weakMapCtorString = toSource(WeakMap$1);
  1275. var getTag = baseGetTag;
  1276. if (DataView$1 && getTag(new DataView$1(new ArrayBuffer(1))) != dataViewTag$3 || Map$2 && getTag(new Map$2()) != mapTag$4 || Promise$2 && getTag(Promise$2.resolve()) != promiseTag || Set$2 && getTag(new Set$2()) != setTag$4 || WeakMap$1 && getTag(new WeakMap$1()) != weakMapTag$1) {
  1277. getTag = function(value) {
  1278. var result = baseGetTag(value), Ctor = result == objectTag$2 ? value.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : "";
  1279. if (ctorString) {
  1280. switch (ctorString) {
  1281. case dataViewCtorString:
  1282. return dataViewTag$3;
  1283. case mapCtorString:
  1284. return mapTag$4;
  1285. case promiseCtorString:
  1286. return promiseTag;
  1287. case setCtorString:
  1288. return setTag$4;
  1289. case weakMapCtorString:
  1290. return weakMapTag$1;
  1291. }
  1292. }
  1293. return result;
  1294. };
  1295. }
  1296. var getTag$1 = getTag;
  1297. var objectProto$2 = Object.prototype;
  1298. var hasOwnProperty$3 = objectProto$2.hasOwnProperty;
  1299. function initCloneArray(array4) {
  1300. var length = array4.length, result = new array4.constructor(length);
  1301. if (length && typeof array4[0] == "string" && hasOwnProperty$3.call(array4, "index")) {
  1302. result.index = array4.index;
  1303. result.input = array4.input;
  1304. }
  1305. return result;
  1306. }
  1307. var Uint8Array2 = root$1.Uint8Array;
  1308. var Uint8Array$1 = Uint8Array2;
  1309. function cloneArrayBuffer(arrayBuffer) {
  1310. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  1311. new Uint8Array$1(result).set(new Uint8Array$1(arrayBuffer));
  1312. return result;
  1313. }
  1314. function cloneDataView(dataView, isDeep) {
  1315. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  1316. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  1317. }
  1318. var reFlags = /\w*$/;
  1319. function cloneRegExp(regexp4) {
  1320. var result = new regexp4.constructor(regexp4.source, reFlags.exec(regexp4));
  1321. result.lastIndex = regexp4.lastIndex;
  1322. return result;
  1323. }
  1324. var symbolProto$1 = Symbol$2 ? Symbol$2.prototype : void 0, symbolValueOf$1 = symbolProto$1 ? symbolProto$1.valueOf : void 0;
  1325. function cloneSymbol(symbol) {
  1326. return symbolValueOf$1 ? Object(symbolValueOf$1.call(symbol)) : {};
  1327. }
  1328. function cloneTypedArray(typedArray, isDeep) {
  1329. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  1330. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  1331. }
  1332. var boolTag$2 = "[object Boolean]", dateTag$2 = "[object Date]", mapTag$3 = "[object Map]", numberTag$2 = "[object Number]", regexpTag$2 = "[object RegExp]", setTag$3 = "[object Set]", stringTag$2 = "[object String]", symbolTag$2 = "[object Symbol]";
  1333. var arrayBufferTag$2 = "[object ArrayBuffer]", dataViewTag$2 = "[object DataView]", float32Tag$1 = "[object Float32Array]", float64Tag$1 = "[object Float64Array]", int8Tag$1 = "[object Int8Array]", int16Tag$1 = "[object Int16Array]", int32Tag$1 = "[object Int32Array]", uint8Tag$1 = "[object Uint8Array]", uint8ClampedTag$1 = "[object Uint8ClampedArray]", uint16Tag$1 = "[object Uint16Array]", uint32Tag$1 = "[object Uint32Array]";
  1334. function initCloneByTag(object4, tag, isDeep) {
  1335. var Ctor = object4.constructor;
  1336. switch (tag) {
  1337. case arrayBufferTag$2:
  1338. return cloneArrayBuffer(object4);
  1339. case boolTag$2:
  1340. case dateTag$2:
  1341. return new Ctor(+object4);
  1342. case dataViewTag$2:
  1343. return cloneDataView(object4, isDeep);
  1344. case float32Tag$1:
  1345. case float64Tag$1:
  1346. case int8Tag$1:
  1347. case int16Tag$1:
  1348. case int32Tag$1:
  1349. case uint8Tag$1:
  1350. case uint8ClampedTag$1:
  1351. case uint16Tag$1:
  1352. case uint32Tag$1:
  1353. return cloneTypedArray(object4, isDeep);
  1354. case mapTag$3:
  1355. return new Ctor();
  1356. case numberTag$2:
  1357. case stringTag$2:
  1358. return new Ctor(object4);
  1359. case regexpTag$2:
  1360. return cloneRegExp(object4);
  1361. case setTag$3:
  1362. return new Ctor();
  1363. case symbolTag$2:
  1364. return cloneSymbol(object4);
  1365. }
  1366. }
  1367. function initCloneObject(object4) {
  1368. return typeof object4.constructor == "function" && !isPrototype(object4) ? baseCreate$1(getPrototype$1(object4)) : {};
  1369. }
  1370. var mapTag$2 = "[object Map]";
  1371. function baseIsMap(value) {
  1372. return isObjectLike(value) && getTag$1(value) == mapTag$2;
  1373. }
  1374. var nodeIsMap = nodeUtil$1 && nodeUtil$1.isMap;
  1375. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  1376. var isMap$1 = isMap;
  1377. var setTag$2 = "[object Set]";
  1378. function baseIsSet(value) {
  1379. return isObjectLike(value) && getTag$1(value) == setTag$2;
  1380. }
  1381. var nodeIsSet = nodeUtil$1 && nodeUtil$1.isSet;
  1382. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  1383. var isSet$1 = isSet;
  1384. var CLONE_DEEP_FLAG$1 = 1, CLONE_FLAT_FLAG = 2, CLONE_SYMBOLS_FLAG$2 = 4;
  1385. var argsTag$1 = "[object Arguments]", arrayTag$1 = "[object Array]", boolTag$1 = "[object Boolean]", dateTag$1 = "[object Date]", errorTag$1 = "[object Error]", funcTag = "[object Function]", genTag = "[object GeneratorFunction]", mapTag$1 = "[object Map]", numberTag$1 = "[object Number]", objectTag$1 = "[object Object]", regexpTag$1 = "[object RegExp]", setTag$1 = "[object Set]", stringTag$1 = "[object String]", symbolTag$1 = "[object Symbol]", weakMapTag = "[object WeakMap]";
  1386. var arrayBufferTag$1 = "[object ArrayBuffer]", dataViewTag$1 = "[object DataView]", float32Tag = "[object Float32Array]", float64Tag = "[object Float64Array]", int8Tag = "[object Int8Array]", int16Tag = "[object Int16Array]", int32Tag = "[object Int32Array]", uint8Tag = "[object Uint8Array]", uint8ClampedTag = "[object Uint8ClampedArray]", uint16Tag = "[object Uint16Array]", uint32Tag = "[object Uint32Array]";
  1387. var cloneableTags = {};
  1388. cloneableTags[argsTag$1] = cloneableTags[arrayTag$1] = cloneableTags[arrayBufferTag$1] = cloneableTags[dataViewTag$1] = cloneableTags[boolTag$1] = cloneableTags[dateTag$1] = cloneableTags[float32Tag] = cloneableTags[float64Tag] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[mapTag$1] = cloneableTags[numberTag$1] = cloneableTags[objectTag$1] = cloneableTags[regexpTag$1] = cloneableTags[setTag$1] = cloneableTags[stringTag$1] = cloneableTags[symbolTag$1] = cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  1389. cloneableTags[errorTag$1] = cloneableTags[funcTag] = cloneableTags[weakMapTag] = false;
  1390. function baseClone(value, bitmask, customizer, key, object4, stack) {
  1391. var result, isDeep = bitmask & CLONE_DEEP_FLAG$1, isFlat = bitmask & CLONE_FLAT_FLAG, isFull = bitmask & CLONE_SYMBOLS_FLAG$2;
  1392. if (customizer) {
  1393. result = object4 ? customizer(value, key, object4, stack) : customizer(value);
  1394. }
  1395. if (result !== void 0) {
  1396. return result;
  1397. }
  1398. if (!isObject$2(value)) {
  1399. return value;
  1400. }
  1401. var isArr = isArray$2(value);
  1402. if (isArr) {
  1403. result = initCloneArray(value);
  1404. if (!isDeep) {
  1405. return copyArray(value, result);
  1406. }
  1407. } else {
  1408. var tag = getTag$1(value), isFunc = tag == funcTag || tag == genTag;
  1409. if (isBuffer$1(value)) {
  1410. return cloneBuffer(value, isDeep);
  1411. }
  1412. if (tag == objectTag$1 || tag == argsTag$1 || isFunc && !object4) {
  1413. result = isFlat || isFunc ? {} : initCloneObject(value);
  1414. if (!isDeep) {
  1415. return isFlat ? copySymbolsIn(value, baseAssignIn(result, value)) : copySymbols(value, baseAssign(result, value));
  1416. }
  1417. } else {
  1418. if (!cloneableTags[tag]) {
  1419. return object4 ? value : {};
  1420. }
  1421. result = initCloneByTag(value, tag, isDeep);
  1422. }
  1423. }
  1424. stack || (stack = new Stack());
  1425. var stacked = stack.get(value);
  1426. if (stacked) {
  1427. return stacked;
  1428. }
  1429. stack.set(value, result);
  1430. if (isSet$1(value)) {
  1431. value.forEach(function(subValue) {
  1432. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  1433. });
  1434. } else if (isMap$1(value)) {
  1435. value.forEach(function(subValue, key2) {
  1436. result.set(key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
  1437. });
  1438. }
  1439. var keysFunc = isFull ? isFlat ? getAllKeysIn : getAllKeys : isFlat ? keysIn : keys;
  1440. var props = isArr ? void 0 : keysFunc(value);
  1441. arrayEach(props || value, function(subValue, key2) {
  1442. if (props) {
  1443. key2 = subValue;
  1444. subValue = value[key2];
  1445. }
  1446. assignValue(result, key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
  1447. });
  1448. return result;
  1449. }
  1450. var CLONE_SYMBOLS_FLAG$1 = 4;
  1451. function clone(value) {
  1452. return baseClone(value, CLONE_SYMBOLS_FLAG$1);
  1453. }
  1454. var CLONE_DEEP_FLAG = 1, CLONE_SYMBOLS_FLAG = 4;
  1455. function cloneDeep(value) {
  1456. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
  1457. }
  1458. var HASH_UNDEFINED = "__lodash_hash_undefined__";
  1459. function setCacheAdd(value) {
  1460. this.__data__.set(value, HASH_UNDEFINED);
  1461. return this;
  1462. }
  1463. function setCacheHas(value) {
  1464. return this.__data__.has(value);
  1465. }
  1466. function SetCache(values) {
  1467. var index = -1, length = values == null ? 0 : values.length;
  1468. this.__data__ = new MapCache();
  1469. while (++index < length) {
  1470. this.add(values[index]);
  1471. }
  1472. }
  1473. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  1474. SetCache.prototype.has = setCacheHas;
  1475. function arraySome(array4, predicate) {
  1476. var index = -1, length = array4 == null ? 0 : array4.length;
  1477. while (++index < length) {
  1478. if (predicate(array4[index], index, array4)) {
  1479. return true;
  1480. }
  1481. }
  1482. return false;
  1483. }
  1484. function cacheHas(cache, key) {
  1485. return cache.has(key);
  1486. }
  1487. var COMPARE_PARTIAL_FLAG$3 = 1, COMPARE_UNORDERED_FLAG$1 = 2;
  1488. function equalArrays(array4, other, bitmask, customizer, equalFunc, stack) {
  1489. var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3, arrLength = array4.length, othLength = other.length;
  1490. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  1491. return false;
  1492. }
  1493. var arrStacked = stack.get(array4);
  1494. var othStacked = stack.get(other);
  1495. if (arrStacked && othStacked) {
  1496. return arrStacked == other && othStacked == array4;
  1497. }
  1498. var index = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG$1 ? new SetCache() : void 0;
  1499. stack.set(array4, other);
  1500. stack.set(other, array4);
  1501. while (++index < arrLength) {
  1502. var arrValue = array4[index], othValue = other[index];
  1503. if (customizer) {
  1504. var compared = isPartial ? customizer(othValue, arrValue, index, other, array4, stack) : customizer(arrValue, othValue, index, array4, other, stack);
  1505. }
  1506. if (compared !== void 0) {
  1507. if (compared) {
  1508. continue;
  1509. }
  1510. result = false;
  1511. break;
  1512. }
  1513. if (seen) {
  1514. if (!arraySome(other, function(othValue2, othIndex) {
  1515. if (!cacheHas(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
  1516. return seen.push(othIndex);
  1517. }
  1518. })) {
  1519. result = false;
  1520. break;
  1521. }
  1522. } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  1523. result = false;
  1524. break;
  1525. }
  1526. }
  1527. stack["delete"](array4);
  1528. stack["delete"](other);
  1529. return result;
  1530. }
  1531. function mapToArray(map) {
  1532. var index = -1, result = Array(map.size);
  1533. map.forEach(function(value, key) {
  1534. result[++index] = [key, value];
  1535. });
  1536. return result;
  1537. }
  1538. function setToArray(set2) {
  1539. var index = -1, result = Array(set2.size);
  1540. set2.forEach(function(value) {
  1541. result[++index] = value;
  1542. });
  1543. return result;
  1544. }
  1545. var COMPARE_PARTIAL_FLAG$2 = 1, COMPARE_UNORDERED_FLAG = 2;
  1546. var boolTag = "[object Boolean]", dateTag = "[object Date]", errorTag = "[object Error]", mapTag = "[object Map]", numberTag = "[object Number]", regexpTag = "[object RegExp]", setTag = "[object Set]", stringTag = "[object String]", symbolTag = "[object Symbol]";
  1547. var arrayBufferTag = "[object ArrayBuffer]", dataViewTag = "[object DataView]";
  1548. var symbolProto = Symbol$2 ? Symbol$2.prototype : void 0, symbolValueOf = symbolProto ? symbolProto.valueOf : void 0;
  1549. function equalByTag(object4, other, tag, bitmask, customizer, equalFunc, stack) {
  1550. switch (tag) {
  1551. case dataViewTag:
  1552. if (object4.byteLength != other.byteLength || object4.byteOffset != other.byteOffset) {
  1553. return false;
  1554. }
  1555. object4 = object4.buffer;
  1556. other = other.buffer;
  1557. case arrayBufferTag:
  1558. if (object4.byteLength != other.byteLength || !equalFunc(new Uint8Array$1(object4), new Uint8Array$1(other))) {
  1559. return false;
  1560. }
  1561. return true;
  1562. case boolTag:
  1563. case dateTag:
  1564. case numberTag:
  1565. return eq(+object4, +other);
  1566. case errorTag:
  1567. return object4.name == other.name && object4.message == other.message;
  1568. case regexpTag:
  1569. case stringTag:
  1570. return object4 == other + "";
  1571. case mapTag:
  1572. var convert = mapToArray;
  1573. case setTag:
  1574. var isPartial = bitmask & COMPARE_PARTIAL_FLAG$2;
  1575. convert || (convert = setToArray);
  1576. if (object4.size != other.size && !isPartial) {
  1577. return false;
  1578. }
  1579. var stacked = stack.get(object4);
  1580. if (stacked) {
  1581. return stacked == other;
  1582. }
  1583. bitmask |= COMPARE_UNORDERED_FLAG;
  1584. stack.set(object4, other);
  1585. var result = equalArrays(convert(object4), convert(other), bitmask, customizer, equalFunc, stack);
  1586. stack["delete"](object4);
  1587. return result;
  1588. case symbolTag:
  1589. if (symbolValueOf) {
  1590. return symbolValueOf.call(object4) == symbolValueOf.call(other);
  1591. }
  1592. }
  1593. return false;
  1594. }
  1595. var COMPARE_PARTIAL_FLAG$1 = 1;
  1596. var objectProto$1 = Object.prototype;
  1597. var hasOwnProperty$2 = objectProto$1.hasOwnProperty;
  1598. function equalObjects(object4, other, bitmask, customizer, equalFunc, stack) {
  1599. var isPartial = bitmask & COMPARE_PARTIAL_FLAG$1, objProps = getAllKeys(object4), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length;
  1600. if (objLength != othLength && !isPartial) {
  1601. return false;
  1602. }
  1603. var index = objLength;
  1604. while (index--) {
  1605. var key = objProps[index];
  1606. if (!(isPartial ? key in other : hasOwnProperty$2.call(other, key))) {
  1607. return false;
  1608. }
  1609. }
  1610. var objStacked = stack.get(object4);
  1611. var othStacked = stack.get(other);
  1612. if (objStacked && othStacked) {
  1613. return objStacked == other && othStacked == object4;
  1614. }
  1615. var result = true;
  1616. stack.set(object4, other);
  1617. stack.set(other, object4);
  1618. var skipCtor = isPartial;
  1619. while (++index < objLength) {
  1620. key = objProps[index];
  1621. var objValue = object4[key], othValue = other[key];
  1622. if (customizer) {
  1623. var compared = isPartial ? customizer(othValue, objValue, key, other, object4, stack) : customizer(objValue, othValue, key, object4, other, stack);
  1624. }
  1625. if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
  1626. result = false;
  1627. break;
  1628. }
  1629. skipCtor || (skipCtor = key == "constructor");
  1630. }
  1631. if (result && !skipCtor) {
  1632. var objCtor = object4.constructor, othCtor = other.constructor;
  1633. if (objCtor != othCtor && ("constructor" in object4 && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
  1634. result = false;
  1635. }
  1636. }
  1637. stack["delete"](object4);
  1638. stack["delete"](other);
  1639. return result;
  1640. }
  1641. var COMPARE_PARTIAL_FLAG = 1;
  1642. var argsTag = "[object Arguments]", arrayTag = "[object Array]", objectTag = "[object Object]";
  1643. var objectProto = Object.prototype;
  1644. var hasOwnProperty$1 = objectProto.hasOwnProperty;
  1645. function baseIsEqualDeep(object4, other, bitmask, customizer, equalFunc, stack) {
  1646. var objIsArr = isArray$2(object4), othIsArr = isArray$2(other), objTag = objIsArr ? arrayTag : getTag$1(object4), othTag = othIsArr ? arrayTag : getTag$1(other);
  1647. objTag = objTag == argsTag ? objectTag : objTag;
  1648. othTag = othTag == argsTag ? objectTag : othTag;
  1649. var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag;
  1650. if (isSameTag && isBuffer$1(object4)) {
  1651. if (!isBuffer$1(other)) {
  1652. return false;
  1653. }
  1654. objIsArr = true;
  1655. objIsObj = false;
  1656. }
  1657. if (isSameTag && !objIsObj) {
  1658. stack || (stack = new Stack());
  1659. return objIsArr || isTypedArray$1(object4) ? equalArrays(object4, other, bitmask, customizer, equalFunc, stack) : equalByTag(object4, other, objTag, bitmask, customizer, equalFunc, stack);
  1660. }
  1661. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  1662. var objIsWrapped = objIsObj && hasOwnProperty$1.call(object4, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty$1.call(other, "__wrapped__");
  1663. if (objIsWrapped || othIsWrapped) {
  1664. var objUnwrapped = objIsWrapped ? object4.value() : object4, othUnwrapped = othIsWrapped ? other.value() : other;
  1665. stack || (stack = new Stack());
  1666. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  1667. }
  1668. }
  1669. if (!isSameTag) {
  1670. return false;
  1671. }
  1672. stack || (stack = new Stack());
  1673. return equalObjects(object4, other, bitmask, customizer, equalFunc, stack);
  1674. }
  1675. function baseIsEqual(value, other, bitmask, customizer, stack) {
  1676. if (value === other) {
  1677. return true;
  1678. }
  1679. if (value == null || other == null || !isObjectLike(value) && !isObjectLike(other)) {
  1680. return value !== value && other !== other;
  1681. }
  1682. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  1683. }
  1684. var now = function() {
  1685. return root$1.Date.now();
  1686. };
  1687. var now$1 = now;
  1688. var FUNC_ERROR_TEXT$1 = "Expected a function";
  1689. var nativeMax = Math.max, nativeMin = Math.min;
  1690. function debounce$1(func, wait, options) {
  1691. var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
  1692. if (typeof func != "function") {
  1693. throw new TypeError(FUNC_ERROR_TEXT$1);
  1694. }
  1695. wait = toNumber(wait) || 0;
  1696. if (isObject$2(options)) {
  1697. leading = !!options.leading;
  1698. maxing = "maxWait" in options;
  1699. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  1700. trailing = "trailing" in options ? !!options.trailing : trailing;
  1701. }
  1702. function invokeFunc(time) {
  1703. var args = lastArgs, thisArg = lastThis;
  1704. lastArgs = lastThis = void 0;
  1705. lastInvokeTime = time;
  1706. result = func.apply(thisArg, args);
  1707. return result;
  1708. }
  1709. function leadingEdge(time) {
  1710. lastInvokeTime = time;
  1711. timerId = setTimeout(timerExpired, wait);
  1712. return leading ? invokeFunc(time) : result;
  1713. }
  1714. function remainingWait(time) {
  1715. var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
  1716. return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
  1717. }
  1718. function shouldInvoke(time) {
  1719. var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
  1720. return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
  1721. }
  1722. function timerExpired() {
  1723. var time = now$1();
  1724. if (shouldInvoke(time)) {
  1725. return trailingEdge(time);
  1726. }
  1727. timerId = setTimeout(timerExpired, remainingWait(time));
  1728. }
  1729. function trailingEdge(time) {
  1730. timerId = void 0;
  1731. if (trailing && lastArgs) {
  1732. return invokeFunc(time);
  1733. }
  1734. lastArgs = lastThis = void 0;
  1735. return result;
  1736. }
  1737. function cancel() {
  1738. if (timerId !== void 0) {
  1739. clearTimeout(timerId);
  1740. }
  1741. lastInvokeTime = 0;
  1742. lastArgs = lastCallTime = lastThis = timerId = void 0;
  1743. }
  1744. function flush() {
  1745. return timerId === void 0 ? result : trailingEdge(now$1());
  1746. }
  1747. function debounced() {
  1748. var time = now$1(), isInvoking = shouldInvoke(time);
  1749. lastArgs = arguments;
  1750. lastThis = this;
  1751. lastCallTime = time;
  1752. if (isInvoking) {
  1753. if (timerId === void 0) {
  1754. return leadingEdge(lastCallTime);
  1755. }
  1756. if (maxing) {
  1757. clearTimeout(timerId);
  1758. timerId = setTimeout(timerExpired, wait);
  1759. return invokeFunc(lastCallTime);
  1760. }
  1761. }
  1762. if (timerId === void 0) {
  1763. timerId = setTimeout(timerExpired, wait);
  1764. }
  1765. return result;
  1766. }
  1767. debounced.cancel = cancel;
  1768. debounced.flush = flush;
  1769. return debounced;
  1770. }
  1771. function isArrayLikeObject(value) {
  1772. return isObjectLike(value) && isArrayLike(value);
  1773. }
  1774. function arrayIncludesWith(array4, value, comparator) {
  1775. var index = -1, length = array4 == null ? 0 : array4.length;
  1776. while (++index < length) {
  1777. if (comparator(value, array4[index])) {
  1778. return true;
  1779. }
  1780. }
  1781. return false;
  1782. }
  1783. var INFINITY$1 = 1 / 0;
  1784. function flattenDeep(array4) {
  1785. var length = array4 == null ? 0 : array4.length;
  1786. return length ? baseFlatten(array4, INFINITY$1) : [];
  1787. }
  1788. function fromPairs(pairs) {
  1789. var index = -1, length = pairs == null ? 0 : pairs.length, result = {};
  1790. while (++index < length) {
  1791. var pair = pairs[index];
  1792. result[pair[0]] = pair[1];
  1793. }
  1794. return result;
  1795. }
  1796. function isEqual(value, other) {
  1797. return baseIsEqual(value, other);
  1798. }
  1799. function isNil(value) {
  1800. return value == null;
  1801. }
  1802. function baseSet(object4, path, value, customizer) {
  1803. if (!isObject$2(object4)) {
  1804. return object4;
  1805. }
  1806. path = castPath(path, object4);
  1807. var index = -1, length = path.length, lastIndex = length - 1, nested = object4;
  1808. while (nested != null && ++index < length) {
  1809. var key = toKey(path[index]), newValue = value;
  1810. if (key === "__proto__" || key === "constructor" || key === "prototype") {
  1811. return object4;
  1812. }
  1813. if (index != lastIndex) {
  1814. var objValue = nested[key];
  1815. newValue = customizer ? customizer(objValue, key, nested) : void 0;
  1816. if (newValue === void 0) {
  1817. newValue = isObject$2(objValue) ? objValue : isIndex(path[index + 1]) ? [] : {};
  1818. }
  1819. }
  1820. assignValue(nested, key, newValue);
  1821. nested = nested[key];
  1822. }
  1823. return object4;
  1824. }
  1825. function set(object4, path, value) {
  1826. return object4 == null ? object4 : baseSet(object4, path, value);
  1827. }
  1828. var FUNC_ERROR_TEXT = "Expected a function";
  1829. function throttle(func, wait, options) {
  1830. var leading = true, trailing = true;
  1831. if (typeof func != "function") {
  1832. throw new TypeError(FUNC_ERROR_TEXT);
  1833. }
  1834. if (isObject$2(options)) {
  1835. leading = "leading" in options ? !!options.leading : leading;
  1836. trailing = "trailing" in options ? !!options.trailing : trailing;
  1837. }
  1838. return debounce$1(func, wait, {
  1839. "leading": leading,
  1840. "maxWait": wait,
  1841. "trailing": trailing
  1842. });
  1843. }
  1844. var INFINITY = 1 / 0;
  1845. var createSet = !(Set$2 && 1 / setToArray(new Set$2([, -0]))[1] == INFINITY) ? noop$1 : function(values) {
  1846. return new Set$2(values);
  1847. };
  1848. var createSet$1 = createSet;
  1849. var LARGE_ARRAY_SIZE = 200;
  1850. function baseUniq(array4, iteratee, comparator) {
  1851. var index = -1, includes = arrayIncludes, length = array4.length, isCommon = true, result = [], seen = result;
  1852. if (comparator) {
  1853. isCommon = false;
  1854. includes = arrayIncludesWith;
  1855. } else if (length >= LARGE_ARRAY_SIZE) {
  1856. var set2 = iteratee ? null : createSet$1(array4);
  1857. if (set2) {
  1858. return setToArray(set2);
  1859. }
  1860. isCommon = false;
  1861. includes = cacheHas;
  1862. seen = new SetCache();
  1863. } else {
  1864. seen = iteratee ? [] : result;
  1865. }
  1866. outer:
  1867. while (++index < length) {
  1868. var value = array4[index], computed2 = iteratee ? iteratee(value) : value;
  1869. value = comparator || value !== 0 ? value : 0;
  1870. if (isCommon && computed2 === computed2) {
  1871. var seenIndex = seen.length;
  1872. while (seenIndex--) {
  1873. if (seen[seenIndex] === computed2) {
  1874. continue outer;
  1875. }
  1876. }
  1877. if (iteratee) {
  1878. seen.push(computed2);
  1879. }
  1880. result.push(value);
  1881. } else if (!includes(seen, computed2, comparator)) {
  1882. if (seen !== result) {
  1883. seen.push(computed2);
  1884. }
  1885. result.push(value);
  1886. }
  1887. }
  1888. return result;
  1889. }
  1890. var union = baseRest(function(arrays) {
  1891. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  1892. });
  1893. var union$1 = union;
  1894. const isLeaf = (el) => !el.getAttribute("aria-owns");
  1895. const getSibling = (el, distance, elClass) => {
  1896. const { parentNode } = el;
  1897. if (!parentNode)
  1898. return null;
  1899. const siblings = parentNode.querySelectorAll(elClass);
  1900. const index = Array.prototype.indexOf.call(siblings, el);
  1901. return siblings[index + distance] || null;
  1902. };
  1903. const focusNode = (el) => {
  1904. if (!el)
  1905. return;
  1906. el.focus();
  1907. !isLeaf(el) && el.click();
  1908. };
  1909. const on = (element, event, handler3, useCapture = false) => {
  1910. if (element && event && handler3) {
  1911. element == null ? void 0 : element.addEventListener(event, handler3, useCapture);
  1912. }
  1913. };
  1914. const off = (element, event, handler3, useCapture = false) => {
  1915. if (element && event && handler3) {
  1916. element == null ? void 0 : element.removeEventListener(event, handler3, useCapture);
  1917. }
  1918. };
  1919. const once = (el, event, fn2) => {
  1920. const listener = function(...args) {
  1921. if (fn2) {
  1922. fn2.apply(this, args);
  1923. }
  1924. off(el, event, listener);
  1925. };
  1926. on(el, event, listener);
  1927. };
  1928. const composeEventHandlers = (theirsHandler, oursHandler, { checkForDefaultPrevented = true } = {}) => {
  1929. const handleEvent = (event) => {
  1930. const shouldPrevent = theirsHandler == null ? void 0 : theirsHandler(event);
  1931. if (checkForDefaultPrevented === false || !shouldPrevent) {
  1932. return oursHandler == null ? void 0 : oursHandler(event);
  1933. }
  1934. };
  1935. return handleEvent;
  1936. };
  1937. function tryOnScopeDispose(fn2) {
  1938. if (getCurrentScope()) {
  1939. onScopeDispose(fn2);
  1940. return true;
  1941. }
  1942. return false;
  1943. }
  1944. const isClient$1 = typeof window !== "undefined";
  1945. const isBoolean = (val) => typeof val === "boolean";
  1946. const isNumber = (val) => typeof val === "number";
  1947. const isString$1 = (val) => typeof val === "string";
  1948. const noop = () => {
  1949. };
  1950. function createFilterWrapper(filter, fn2) {
  1951. function wrapper(...args) {
  1952. filter(() => fn2.apply(this, args), { fn: fn2, thisArg: this, args });
  1953. }
  1954. return wrapper;
  1955. }
  1956. function debounceFilter(ms, options = {}) {
  1957. let timer;
  1958. let maxTimer;
  1959. const filter = (invoke) => {
  1960. const duration = unref(ms);
  1961. const maxDuration = unref(options.maxWait);
  1962. if (timer)
  1963. clearTimeout(timer);
  1964. if (duration <= 0 || maxDuration !== void 0 && maxDuration <= 0) {
  1965. if (maxTimer) {
  1966. clearTimeout(maxTimer);
  1967. maxTimer = null;
  1968. }
  1969. return invoke();
  1970. }
  1971. if (maxDuration && !maxTimer) {
  1972. maxTimer = setTimeout(() => {
  1973. if (timer)
  1974. clearTimeout(timer);
  1975. maxTimer = null;
  1976. invoke();
  1977. }, maxDuration);
  1978. }
  1979. timer = setTimeout(() => {
  1980. if (maxTimer)
  1981. clearTimeout(maxTimer);
  1982. maxTimer = null;
  1983. invoke();
  1984. }, duration);
  1985. };
  1986. return filter;
  1987. }
  1988. function throttleFilter(ms, trailing = true, leading = true) {
  1989. let lastExec = 0;
  1990. let timer;
  1991. let preventLeading = !leading;
  1992. const clear = () => {
  1993. if (timer) {
  1994. clearTimeout(timer);
  1995. timer = void 0;
  1996. }
  1997. };
  1998. const filter = (invoke) => {
  1999. const duration = unref(ms);
  2000. const elapsed = Date.now() - lastExec;
  2001. clear();
  2002. if (duration <= 0) {
  2003. lastExec = Date.now();
  2004. return invoke();
  2005. }
  2006. if (elapsed > duration) {
  2007. lastExec = Date.now();
  2008. if (preventLeading)
  2009. preventLeading = false;
  2010. else
  2011. invoke();
  2012. }
  2013. if (trailing) {
  2014. timer = setTimeout(() => {
  2015. lastExec = Date.now();
  2016. if (!leading)
  2017. preventLeading = true;
  2018. clear();
  2019. invoke();
  2020. }, duration);
  2021. }
  2022. if (!leading && !timer)
  2023. timer = setTimeout(() => preventLeading = true, duration);
  2024. };
  2025. return filter;
  2026. }
  2027. function useDebounceFn(fn2, ms = 200, options = {}) {
  2028. return createFilterWrapper(debounceFilter(ms, options), fn2);
  2029. }
  2030. function refDebounced(value, ms = 200, options = {}) {
  2031. if (ms <= 0)
  2032. return value;
  2033. const debounced = ref(value.value);
  2034. const updater = useDebounceFn(() => {
  2035. debounced.value = value.value;
  2036. }, ms, options);
  2037. watch(value, () => updater());
  2038. return debounced;
  2039. }
  2040. function useThrottleFn(fn2, ms = 200, trailing = true, leading = true) {
  2041. return createFilterWrapper(throttleFilter(ms, trailing, leading), fn2);
  2042. }
  2043. function useTimeoutFn(cb, interval, options = {}) {
  2044. const {
  2045. immediate = true
  2046. } = options;
  2047. const isPending = ref(false);
  2048. let timer = null;
  2049. function clear() {
  2050. if (timer) {
  2051. clearTimeout(timer);
  2052. timer = null;
  2053. }
  2054. }
  2055. function stop() {
  2056. isPending.value = false;
  2057. clear();
  2058. }
  2059. function start2(...args) {
  2060. clear();
  2061. isPending.value = true;
  2062. timer = setTimeout(() => {
  2063. isPending.value = false;
  2064. timer = null;
  2065. cb(...args);
  2066. }, unref(interval));
  2067. }
  2068. if (immediate) {
  2069. isPending.value = true;
  2070. if (isClient$1)
  2071. start2();
  2072. }
  2073. tryOnScopeDispose(stop);
  2074. return {
  2075. isPending,
  2076. start: start2,
  2077. stop
  2078. };
  2079. }
  2080. function unrefElement(elRef) {
  2081. var _a2;
  2082. const plain = unref(elRef);
  2083. return (_a2 = plain == null ? void 0 : plain.$el) != null ? _a2 : plain;
  2084. }
  2085. const defaultWindow = isClient$1 ? window : void 0;
  2086. function useEventListener(...args) {
  2087. let target;
  2088. let event;
  2089. let listener;
  2090. let options;
  2091. if (isString$1(args[0])) {
  2092. [event, listener, options] = args;
  2093. target = defaultWindow;
  2094. } else {
  2095. [target, event, listener, options] = args;
  2096. }
  2097. if (!target)
  2098. return noop;
  2099. let cleanup = noop;
  2100. const stopWatch = watch(() => unrefElement(target), (el) => {
  2101. cleanup();
  2102. if (!el)
  2103. return;
  2104. el.addEventListener(event, listener, options);
  2105. cleanup = () => {
  2106. el.removeEventListener(event, listener, options);
  2107. cleanup = noop;
  2108. };
  2109. }, { immediate: true, flush: "post" });
  2110. const stop = () => {
  2111. stopWatch();
  2112. cleanup();
  2113. };
  2114. tryOnScopeDispose(stop);
  2115. return stop;
  2116. }
  2117. function onClickOutside(target, handler3, options = {}) {
  2118. const { window: window2 = defaultWindow, ignore, capture = true } = options;
  2119. if (!window2)
  2120. return;
  2121. const shouldListen = ref(true);
  2122. const listener = (event) => {
  2123. const el = unrefElement(target);
  2124. const composedPath = event.composedPath();
  2125. if (!el || el === event.target || composedPath.includes(el) || !shouldListen.value)
  2126. return;
  2127. if (ignore && ignore.length > 0) {
  2128. if (ignore.some((target2) => {
  2129. const el2 = unrefElement(target2);
  2130. return el2 && (event.target === el2 || composedPath.includes(el2));
  2131. }))
  2132. return;
  2133. }
  2134. handler3(event);
  2135. };
  2136. const cleanup = [
  2137. useEventListener(window2, "click", listener, { passive: true, capture }),
  2138. useEventListener(window2, "pointerdown", (e) => {
  2139. const el = unrefElement(target);
  2140. shouldListen.value = !!el && !e.composedPath().includes(el);
  2141. }, { passive: true })
  2142. ];
  2143. const stop = () => cleanup.forEach((fn2) => fn2());
  2144. return stop;
  2145. }
  2146. const _global$1 = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
  2147. const globalKey$1 = "__vueuse_ssr_handlers__";
  2148. _global$1[globalKey$1] = _global$1[globalKey$1] || {};
  2149. _global$1[globalKey$1];
  2150. var __getOwnPropSymbols$c = Object.getOwnPropertySymbols;
  2151. var __hasOwnProp$c = Object.prototype.hasOwnProperty;
  2152. var __propIsEnum$c = Object.prototype.propertyIsEnumerable;
  2153. var __objRest$2 = (source, exclude) => {
  2154. var target = {};
  2155. for (var prop in source)
  2156. if (__hasOwnProp$c.call(source, prop) && exclude.indexOf(prop) < 0)
  2157. target[prop] = source[prop];
  2158. if (source != null && __getOwnPropSymbols$c)
  2159. for (var prop of __getOwnPropSymbols$c(source)) {
  2160. if (exclude.indexOf(prop) < 0 && __propIsEnum$c.call(source, prop))
  2161. target[prop] = source[prop];
  2162. }
  2163. return target;
  2164. };
  2165. function useResizeObserver(target, callback, options = {}) {
  2166. const _a2 = options, { window: window2 = defaultWindow } = _a2, observerOptions = __objRest$2(_a2, ["window"]);
  2167. let observer;
  2168. const isSupported = window2 && "ResizeObserver" in window2;
  2169. const cleanup = () => {
  2170. if (observer) {
  2171. observer.disconnect();
  2172. observer = void 0;
  2173. }
  2174. };
  2175. const stopWatch = watch(() => unrefElement(target), (el) => {
  2176. cleanup();
  2177. if (isSupported && window2 && el) {
  2178. observer = new ResizeObserver(callback);
  2179. observer.observe(el, observerOptions);
  2180. }
  2181. }, { immediate: true, flush: "post" });
  2182. const stop = () => {
  2183. cleanup();
  2184. stopWatch();
  2185. };
  2186. tryOnScopeDispose(stop);
  2187. return {
  2188. isSupported,
  2189. stop
  2190. };
  2191. }
  2192. var _a$1, _b$1;
  2193. isClient$1 && (window == null ? void 0 : window.navigator) && ((_a$1 = window == null ? void 0 : window.navigator) == null ? void 0 : _a$1.platform) && /iP(ad|hone|od)/.test((_b$1 = window == null ? void 0 : window.navigator) == null ? void 0 : _b$1.platform);
  2194. const isInContainer = (el, container) => {
  2195. if (!isClient$1 || !el || !container)
  2196. return false;
  2197. const elRect = el.getBoundingClientRect();
  2198. let containerRect;
  2199. if (container instanceof Element) {
  2200. containerRect = container.getBoundingClientRect();
  2201. } else {
  2202. containerRect = {
  2203. top: 0,
  2204. right: window.innerWidth,
  2205. bottom: window.innerHeight,
  2206. left: 0
  2207. };
  2208. }
  2209. return elRect.top < containerRect.bottom && elRect.bottom > containerRect.top && elRect.right > containerRect.left && elRect.left < containerRect.right;
  2210. };
  2211. const resizeHandler = function(entries) {
  2212. for (const entry of entries) {
  2213. const listeners = entry.target.__resizeListeners__ || [];
  2214. if (listeners.length) {
  2215. listeners.forEach((fn2) => {
  2216. fn2();
  2217. });
  2218. }
  2219. }
  2220. };
  2221. const addResizeListener = function(element, fn2) {
  2222. if (!isClient$1 || !element)
  2223. return;
  2224. if (!element.__resizeListeners__) {
  2225. element.__resizeListeners__ = [];
  2226. element.__ro__ = new ResizeObserver(resizeHandler);
  2227. element.__ro__.observe(element);
  2228. }
  2229. element.__resizeListeners__.push(fn2);
  2230. };
  2231. const removeResizeListener = function(element, fn2) {
  2232. var _a2;
  2233. if (!element || !element.__resizeListeners__)
  2234. return;
  2235. element.__resizeListeners__.splice(element.__resizeListeners__.indexOf(fn2), 1);
  2236. if (!element.__resizeListeners__.length) {
  2237. (_a2 = element.__ro__) == null ? void 0 : _a2.disconnect();
  2238. }
  2239. };
  2240. const NOOP = () => {
  2241. };
  2242. const hasOwnProperty = Object.prototype.hasOwnProperty;
  2243. const hasOwn = (val, key) => hasOwnProperty.call(val, key);
  2244. const isArray = Array.isArray;
  2245. const isFunction = (val) => typeof val === "function";
  2246. const isString = (val) => typeof val === "string";
  2247. const isObject$1 = (val) => val !== null && typeof val === "object";
  2248. const isPromise = (val) => {
  2249. return isObject$1(val) && isFunction(val.then) && isFunction(val.catch);
  2250. };
  2251. const objectToString = Object.prototype.toString;
  2252. const toTypeString = (value) => objectToString.call(value);
  2253. const toRawType = (value) => {
  2254. return toTypeString(value).slice(8, -1);
  2255. };
  2256. const cacheStringFunction = (fn2) => {
  2257. const cache = /* @__PURE__ */ Object.create(null);
  2258. return (str) => {
  2259. const hit = cache[str];
  2260. return hit || (cache[str] = fn2(str));
  2261. };
  2262. };
  2263. const camelizeRE = /-(\w)/g;
  2264. const camelize = cacheStringFunction((str) => {
  2265. return str.replace(camelizeRE, (_2, c) => c ? c.toUpperCase() : "");
  2266. });
  2267. const capitalize = cacheStringFunction((str) => str.charAt(0).toUpperCase() + str.slice(1));
  2268. const isUndefined = (val) => val === void 0;
  2269. const isEmpty = (val) => !val && val !== 0 || isArray(val) && val.length === 0 || isObject$1(val) && !Object.keys(val).length;
  2270. const isElement$1 = (e) => {
  2271. if (typeof Element === "undefined")
  2272. return false;
  2273. return e instanceof Element;
  2274. };
  2275. const escapeStringRegexp = (string3 = "") => string3.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
  2276. const keysOf = (arr) => Object.keys(arr);
  2277. const entriesOf = (arr) => Object.entries(arr);
  2278. const getProp = (obj, path, defaultValue) => {
  2279. return {
  2280. get value() {
  2281. return get(obj, path, defaultValue);
  2282. },
  2283. set value(val) {
  2284. set(obj, path, val);
  2285. }
  2286. };
  2287. };
  2288. const classNameToArray = (cls = "") => cls.split(" ").filter((item) => !!item.trim());
  2289. const hasClass = (el, cls) => {
  2290. if (!el || !cls)
  2291. return false;
  2292. if (cls.includes(" "))
  2293. throw new Error("className should not contain space.");
  2294. return el.classList.contains(cls);
  2295. };
  2296. const addClass = (el, cls) => {
  2297. if (!el || !cls.trim())
  2298. return;
  2299. el.classList.add(...classNameToArray(cls));
  2300. };
  2301. const removeClass = (el, cls) => {
  2302. if (!el || !cls.trim())
  2303. return;
  2304. el.classList.remove(...classNameToArray(cls));
  2305. };
  2306. const getStyle = (element, styleName) => {
  2307. var _a2;
  2308. if (!isClient$1 || !element || !styleName)
  2309. return "";
  2310. camelize(styleName);
  2311. try {
  2312. const style = element.style[styleName];
  2313. if (style)
  2314. return style;
  2315. const computed2 = (_a2 = document.defaultView) == null ? void 0 : _a2.getComputedStyle(element, "");
  2316. return computed2 ? computed2[styleName] : "";
  2317. } catch (e) {
  2318. return element.style[styleName];
  2319. }
  2320. };
  2321. const isScroll = (el, isVertical) => {
  2322. if (!isClient$1)
  2323. return false;
  2324. const key = {
  2325. undefined: "overflow",
  2326. true: "overflow-y",
  2327. false: "overflow-x"
  2328. }[String(isVertical)];
  2329. const overflow = getStyle(el, key);
  2330. return ["scroll", "auto", "overlay"].some((s2) => overflow.includes(s2));
  2331. };
  2332. const getScrollContainer = (el, isVertical) => {
  2333. if (!isClient$1)
  2334. return;
  2335. let parent = el;
  2336. while (parent) {
  2337. if ([window, document, document.documentElement].includes(parent))
  2338. return window;
  2339. if (isScroll(parent, isVertical))
  2340. return parent;
  2341. parent = parent.parentNode;
  2342. }
  2343. return parent;
  2344. };
  2345. let scrollBarWidth;
  2346. const getScrollBarWidth = () => {
  2347. var _a2;
  2348. if (!isClient$1)
  2349. return 0;
  2350. if (scrollBarWidth !== void 0)
  2351. return scrollBarWidth;
  2352. const outer = document.createElement("div");
  2353. outer.className = "el-scrollbar__wrap";
  2354. outer.style.visibility = "hidden";
  2355. outer.style.width = "100px";
  2356. outer.style.position = "absolute";
  2357. outer.style.top = "-9999px";
  2358. document.body.appendChild(outer);
  2359. const widthNoScroll = outer.offsetWidth;
  2360. outer.style.overflow = "scroll";
  2361. const inner = document.createElement("div");
  2362. inner.style.width = "100%";
  2363. outer.appendChild(inner);
  2364. const widthWithScroll = inner.offsetWidth;
  2365. (_a2 = outer.parentNode) == null ? void 0 : _a2.removeChild(outer);
  2366. scrollBarWidth = widthNoScroll - widthWithScroll;
  2367. return scrollBarWidth;
  2368. };
  2369. function scrollIntoView(container, selected) {
  2370. if (!isClient$1)
  2371. return;
  2372. if (!selected) {
  2373. container.scrollTop = 0;
  2374. return;
  2375. }
  2376. const offsetParents = [];
  2377. let pointer = selected.offsetParent;
  2378. while (pointer !== null && container !== pointer && container.contains(pointer)) {
  2379. offsetParents.push(pointer);
  2380. pointer = pointer.offsetParent;
  2381. }
  2382. const top2 = selected.offsetTop + offsetParents.reduce((prev, curr) => prev + curr.offsetTop, 0);
  2383. const bottom2 = top2 + selected.offsetHeight;
  2384. const viewRectTop = container.scrollTop;
  2385. const viewRectBottom = viewRectTop + container.clientHeight;
  2386. if (top2 < viewRectTop) {
  2387. container.scrollTop = top2;
  2388. } else if (bottom2 > viewRectBottom) {
  2389. container.scrollTop = bottom2 - container.clientHeight;
  2390. }
  2391. }
  2392. var _export_sfc$2 = (sfc, props) => {
  2393. const target = sfc.__vccOpts || sfc;
  2394. for (const [key, val] of props) {
  2395. target[key] = val;
  2396. }
  2397. return target;
  2398. };
  2399. const _sfc_main$1x = defineComponent({
  2400. name: "ArrowDown"
  2401. });
  2402. const _hoisted_1$12 = {
  2403. viewBox: "0 0 1024 1024",
  2404. xmlns: "http://www.w3.org/2000/svg"
  2405. };
  2406. const _hoisted_2$V = /* @__PURE__ */ createElementVNode("path", {
  2407. fill: "currentColor",
  2408. d: "M831.872 340.864 512 652.672 192.128 340.864a30.592 30.592 0 0 0-42.752 0 29.12 29.12 0 0 0 0 41.6L489.664 714.24a32 32 0 0 0 44.672 0l340.288-331.712a29.12 29.12 0 0 0 0-41.728 30.592 30.592 0 0 0-42.752 0z"
  2409. }, null, -1);
  2410. const _hoisted_3$I = [
  2411. _hoisted_2$V
  2412. ];
  2413. function _sfc_render$13(_ctx, _cache, $props, $setup, $data, $options) {
  2414. return openBlock(), createElementBlock("svg", _hoisted_1$12, _hoisted_3$I);
  2415. }
  2416. var arrowDown = /* @__PURE__ */ _export_sfc$2(_sfc_main$1x, [["render", _sfc_render$13]]);
  2417. const _sfc_main$1w = defineComponent({
  2418. name: "ArrowLeft"
  2419. });
  2420. const _hoisted_1$11 = {
  2421. viewBox: "0 0 1024 1024",
  2422. xmlns: "http://www.w3.org/2000/svg"
  2423. };
  2424. const _hoisted_2$U = /* @__PURE__ */ createElementVNode("path", {
  2425. fill: "currentColor",
  2426. d: "M609.408 149.376 277.76 489.6a32 32 0 0 0 0 44.672l331.648 340.352a29.12 29.12 0 0 0 41.728 0 30.592 30.592 0 0 0 0-42.752L339.264 511.936l311.872-319.872a30.592 30.592 0 0 0 0-42.688 29.12 29.12 0 0 0-41.728 0z"
  2427. }, null, -1);
  2428. const _hoisted_3$H = [
  2429. _hoisted_2$U
  2430. ];
  2431. function _sfc_render$12(_ctx, _cache, $props, $setup, $data, $options) {
  2432. return openBlock(), createElementBlock("svg", _hoisted_1$11, _hoisted_3$H);
  2433. }
  2434. var arrowLeft = /* @__PURE__ */ _export_sfc$2(_sfc_main$1w, [["render", _sfc_render$12]]);
  2435. const _sfc_main$1v = defineComponent({
  2436. name: "ArrowRight"
  2437. });
  2438. const _hoisted_1$10 = {
  2439. viewBox: "0 0 1024 1024",
  2440. xmlns: "http://www.w3.org/2000/svg"
  2441. };
  2442. const _hoisted_2$T = /* @__PURE__ */ createElementVNode("path", {
  2443. fill: "currentColor",
  2444. d: "M340.864 149.312a30.592 30.592 0 0 0 0 42.752L652.736 512 340.864 831.872a30.592 30.592 0 0 0 0 42.752 29.12 29.12 0 0 0 41.728 0L714.24 534.336a32 32 0 0 0 0-44.672L382.592 149.376a29.12 29.12 0 0 0-41.728 0z"
  2445. }, null, -1);
  2446. const _hoisted_3$G = [
  2447. _hoisted_2$T
  2448. ];
  2449. function _sfc_render$11(_ctx, _cache, $props, $setup, $data, $options) {
  2450. return openBlock(), createElementBlock("svg", _hoisted_1$10, _hoisted_3$G);
  2451. }
  2452. var arrowRight = /* @__PURE__ */ _export_sfc$2(_sfc_main$1v, [["render", _sfc_render$11]]);
  2453. const _sfc_main$1u = defineComponent({
  2454. name: "ArrowUp"
  2455. });
  2456. const _hoisted_1$$ = {
  2457. viewBox: "0 0 1024 1024",
  2458. xmlns: "http://www.w3.org/2000/svg"
  2459. };
  2460. const _hoisted_2$S = /* @__PURE__ */ createElementVNode("path", {
  2461. fill: "currentColor",
  2462. d: "m488.832 344.32-339.84 356.672a32 32 0 0 0 0 44.16l.384.384a29.44 29.44 0 0 0 42.688 0l320-335.872 319.872 335.872a29.44 29.44 0 0 0 42.688 0l.384-.384a32 32 0 0 0 0-44.16L535.168 344.32a32 32 0 0 0-46.336 0z"
  2463. }, null, -1);
  2464. const _hoisted_3$F = [
  2465. _hoisted_2$S
  2466. ];
  2467. function _sfc_render$10(_ctx, _cache, $props, $setup, $data, $options) {
  2468. return openBlock(), createElementBlock("svg", _hoisted_1$$, _hoisted_3$F);
  2469. }
  2470. var arrowUp = /* @__PURE__ */ _export_sfc$2(_sfc_main$1u, [["render", _sfc_render$10]]);
  2471. const _sfc_main$1t = defineComponent({
  2472. name: "Calendar"
  2473. });
  2474. const _hoisted_1$_ = {
  2475. viewBox: "0 0 1024 1024",
  2476. xmlns: "http://www.w3.org/2000/svg"
  2477. };
  2478. const _hoisted_2$R = /* @__PURE__ */ createElementVNode("path", {
  2479. fill: "currentColor",
  2480. d: "M128 384v512h768V192H768v32a32 32 0 1 1-64 0v-32H320v32a32 32 0 0 1-64 0v-32H128v128h768v64H128zm192-256h384V96a32 32 0 1 1 64 0v32h160a32 32 0 0 1 32 32v768a32 32 0 0 1-32 32H96a32 32 0 0 1-32-32V160a32 32 0 0 1 32-32h160V96a32 32 0 0 1 64 0v32zm-32 384h64a32 32 0 0 1 0 64h-64a32 32 0 0 1 0-64zm0 192h64a32 32 0 1 1 0 64h-64a32 32 0 1 1 0-64zm192-192h64a32 32 0 0 1 0 64h-64a32 32 0 0 1 0-64zm0 192h64a32 32 0 1 1 0 64h-64a32 32 0 1 1 0-64zm192-192h64a32 32 0 1 1 0 64h-64a32 32 0 1 1 0-64zm0 192h64a32 32 0 1 1 0 64h-64a32 32 0 1 1 0-64z"
  2481. }, null, -1);
  2482. const _hoisted_3$E = [
  2483. _hoisted_2$R
  2484. ];
  2485. function _sfc_render$$(_ctx, _cache, $props, $setup, $data, $options) {
  2486. return openBlock(), createElementBlock("svg", _hoisted_1$_, _hoisted_3$E);
  2487. }
  2488. var calendar = /* @__PURE__ */ _export_sfc$2(_sfc_main$1t, [["render", _sfc_render$$]]);
  2489. const _sfc_main$1s = defineComponent({
  2490. name: "Check"
  2491. });
  2492. const _hoisted_1$Z = {
  2493. viewBox: "0 0 1024 1024",
  2494. xmlns: "http://www.w3.org/2000/svg"
  2495. };
  2496. const _hoisted_2$Q = /* @__PURE__ */ createElementVNode("path", {
  2497. fill: "currentColor",
  2498. d: "M406.656 706.944 195.84 496.256a32 32 0 1 0-45.248 45.248l256 256 512-512a32 32 0 0 0-45.248-45.248L406.592 706.944z"
  2499. }, null, -1);
  2500. const _hoisted_3$D = [
  2501. _hoisted_2$Q
  2502. ];
  2503. function _sfc_render$_(_ctx, _cache, $props, $setup, $data, $options) {
  2504. return openBlock(), createElementBlock("svg", _hoisted_1$Z, _hoisted_3$D);
  2505. }
  2506. var check = /* @__PURE__ */ _export_sfc$2(_sfc_main$1s, [["render", _sfc_render$_]]);
  2507. const _sfc_main$1r = defineComponent({
  2508. name: "CircleCheck"
  2509. });
  2510. const _hoisted_1$Y = {
  2511. viewBox: "0 0 1024 1024",
  2512. xmlns: "http://www.w3.org/2000/svg"
  2513. };
  2514. const _hoisted_2$P = /* @__PURE__ */ createElementVNode("path", {
  2515. fill: "currentColor",
  2516. d: "M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768zm0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896z"
  2517. }, null, -1);
  2518. const _hoisted_3$C = /* @__PURE__ */ createElementVNode("path", {
  2519. fill: "currentColor",
  2520. d: "M745.344 361.344a32 32 0 0 1 45.312 45.312l-288 288a32 32 0 0 1-45.312 0l-160-160a32 32 0 1 1 45.312-45.312L480 626.752l265.344-265.408z"
  2521. }, null, -1);
  2522. const _hoisted_4$h = [
  2523. _hoisted_2$P,
  2524. _hoisted_3$C
  2525. ];
  2526. function _sfc_render$Z(_ctx, _cache, $props, $setup, $data, $options) {
  2527. return openBlock(), createElementBlock("svg", _hoisted_1$Y, _hoisted_4$h);
  2528. }
  2529. var circleCheck = /* @__PURE__ */ _export_sfc$2(_sfc_main$1r, [["render", _sfc_render$Z]]);
  2530. const _sfc_main$1q = defineComponent({
  2531. name: "CircleClose"
  2532. });
  2533. const _hoisted_1$X = {
  2534. viewBox: "0 0 1024 1024",
  2535. xmlns: "http://www.w3.org/2000/svg"
  2536. };
  2537. const _hoisted_2$O = /* @__PURE__ */ createElementVNode("path", {
  2538. fill: "currentColor",
  2539. d: "m466.752 512-90.496-90.496a32 32 0 0 1 45.248-45.248L512 466.752l90.496-90.496a32 32 0 1 1 45.248 45.248L557.248 512l90.496 90.496a32 32 0 1 1-45.248 45.248L512 557.248l-90.496 90.496a32 32 0 0 1-45.248-45.248L466.752 512z"
  2540. }, null, -1);
  2541. const _hoisted_3$B = /* @__PURE__ */ createElementVNode("path", {
  2542. fill: "currentColor",
  2543. d: "M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768zm0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896z"
  2544. }, null, -1);
  2545. const _hoisted_4$g = [
  2546. _hoisted_2$O,
  2547. _hoisted_3$B
  2548. ];
  2549. function _sfc_render$Y(_ctx, _cache, $props, $setup, $data, $options) {
  2550. return openBlock(), createElementBlock("svg", _hoisted_1$X, _hoisted_4$g);
  2551. }
  2552. var circleClose = /* @__PURE__ */ _export_sfc$2(_sfc_main$1q, [["render", _sfc_render$Y]]);
  2553. const _sfc_main$1p = defineComponent({
  2554. name: "Clock"
  2555. });
  2556. const _hoisted_1$W = {
  2557. viewBox: "0 0 1024 1024",
  2558. xmlns: "http://www.w3.org/2000/svg"
  2559. };
  2560. const _hoisted_2$N = /* @__PURE__ */ createElementVNode("path", {
  2561. fill: "currentColor",
  2562. d: "M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768zm0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896z"
  2563. }, null, -1);
  2564. const _hoisted_3$A = /* @__PURE__ */ createElementVNode("path", {
  2565. fill: "currentColor",
  2566. d: "M480 256a32 32 0 0 1 32 32v256a32 32 0 0 1-64 0V288a32 32 0 0 1 32-32z"
  2567. }, null, -1);
  2568. const _hoisted_4$f = /* @__PURE__ */ createElementVNode("path", {
  2569. fill: "currentColor",
  2570. d: "M480 512h256q32 0 32 32t-32 32H480q-32 0-32-32t32-32z"
  2571. }, null, -1);
  2572. const _hoisted_5$c = [
  2573. _hoisted_2$N,
  2574. _hoisted_3$A,
  2575. _hoisted_4$f
  2576. ];
  2577. function _sfc_render$X(_ctx, _cache, $props, $setup, $data, $options) {
  2578. return openBlock(), createElementBlock("svg", _hoisted_1$W, _hoisted_5$c);
  2579. }
  2580. var clock = /* @__PURE__ */ _export_sfc$2(_sfc_main$1p, [["render", _sfc_render$X]]);
  2581. const _sfc_main$1o = defineComponent({
  2582. name: "Close"
  2583. });
  2584. const _hoisted_1$V = {
  2585. viewBox: "0 0 1024 1024",
  2586. xmlns: "http://www.w3.org/2000/svg"
  2587. };
  2588. const _hoisted_2$M = /* @__PURE__ */ createElementVNode("path", {
  2589. fill: "currentColor",
  2590. d: "M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"
  2591. }, null, -1);
  2592. const _hoisted_3$z = [
  2593. _hoisted_2$M
  2594. ];
  2595. function _sfc_render$W(_ctx, _cache, $props, $setup, $data, $options) {
  2596. return openBlock(), createElementBlock("svg", _hoisted_1$V, _hoisted_3$z);
  2597. }
  2598. var close = /* @__PURE__ */ _export_sfc$2(_sfc_main$1o, [["render", _sfc_render$W]]);
  2599. const _sfc_main$1n = defineComponent({
  2600. name: "DArrowLeft"
  2601. });
  2602. const _hoisted_1$U = {
  2603. viewBox: "0 0 1024 1024",
  2604. xmlns: "http://www.w3.org/2000/svg"
  2605. };
  2606. const _hoisted_2$L = /* @__PURE__ */ createElementVNode("path", {
  2607. fill: "currentColor",
  2608. d: "M529.408 149.376a29.12 29.12 0 0 1 41.728 0 30.592 30.592 0 0 1 0 42.688L259.264 511.936l311.872 319.936a30.592 30.592 0 0 1-.512 43.264 29.12 29.12 0 0 1-41.216-.512L197.76 534.272a32 32 0 0 1 0-44.672l331.648-340.224zm256 0a29.12 29.12 0 0 1 41.728 0 30.592 30.592 0 0 1 0 42.688L515.264 511.936l311.872 319.936a30.592 30.592 0 0 1-.512 43.264 29.12 29.12 0 0 1-41.216-.512L453.76 534.272a32 32 0 0 1 0-44.672l331.648-340.224z"
  2609. }, null, -1);
  2610. const _hoisted_3$y = [
  2611. _hoisted_2$L
  2612. ];
  2613. function _sfc_render$V(_ctx, _cache, $props, $setup, $data, $options) {
  2614. return openBlock(), createElementBlock("svg", _hoisted_1$U, _hoisted_3$y);
  2615. }
  2616. var dArrowLeft = /* @__PURE__ */ _export_sfc$2(_sfc_main$1n, [["render", _sfc_render$V]]);
  2617. const _sfc_main$1m = defineComponent({
  2618. name: "DArrowRight"
  2619. });
  2620. const _hoisted_1$T = {
  2621. viewBox: "0 0 1024 1024",
  2622. xmlns: "http://www.w3.org/2000/svg"
  2623. };
  2624. const _hoisted_2$K = /* @__PURE__ */ createElementVNode("path", {
  2625. fill: "currentColor",
  2626. d: "M452.864 149.312a29.12 29.12 0 0 1 41.728.064L826.24 489.664a32 32 0 0 1 0 44.672L494.592 874.624a29.12 29.12 0 0 1-41.728 0 30.592 30.592 0 0 1 0-42.752L764.736 512 452.864 192a30.592 30.592 0 0 1 0-42.688zm-256 0a29.12 29.12 0 0 1 41.728.064L570.24 489.664a32 32 0 0 1 0 44.672L238.592 874.624a29.12 29.12 0 0 1-41.728 0 30.592 30.592 0 0 1 0-42.752L508.736 512 196.864 192a30.592 30.592 0 0 1 0-42.688z"
  2627. }, null, -1);
  2628. const _hoisted_3$x = [
  2629. _hoisted_2$K
  2630. ];
  2631. function _sfc_render$U(_ctx, _cache, $props, $setup, $data, $options) {
  2632. return openBlock(), createElementBlock("svg", _hoisted_1$T, _hoisted_3$x);
  2633. }
  2634. var dArrowRight = /* @__PURE__ */ _export_sfc$2(_sfc_main$1m, [["render", _sfc_render$U]]);
  2635. const _sfc_main$1l = defineComponent({
  2636. name: "Delete"
  2637. });
  2638. const _hoisted_1$S = {
  2639. viewBox: "0 0 1024 1024",
  2640. xmlns: "http://www.w3.org/2000/svg"
  2641. };
  2642. const _hoisted_2$J = /* @__PURE__ */ createElementVNode("path", {
  2643. fill: "currentColor",
  2644. d: "M160 256H96a32 32 0 0 1 0-64h256V95.936a32 32 0 0 1 32-32h256a32 32 0 0 1 32 32V192h256a32 32 0 1 1 0 64h-64v672a32 32 0 0 1-32 32H192a32 32 0 0 1-32-32V256zm448-64v-64H416v64h192zM224 896h576V256H224v640zm192-128a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32zm192 0a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32z"
  2645. }, null, -1);
  2646. const _hoisted_3$w = [
  2647. _hoisted_2$J
  2648. ];
  2649. function _sfc_render$T(_ctx, _cache, $props, $setup, $data, $options) {
  2650. return openBlock(), createElementBlock("svg", _hoisted_1$S, _hoisted_3$w);
  2651. }
  2652. var _delete = /* @__PURE__ */ _export_sfc$2(_sfc_main$1l, [["render", _sfc_render$T]]);
  2653. const _sfc_main$1k = defineComponent({
  2654. name: "Document"
  2655. });
  2656. const _hoisted_1$R = {
  2657. viewBox: "0 0 1024 1024",
  2658. xmlns: "http://www.w3.org/2000/svg"
  2659. };
  2660. const _hoisted_2$I = /* @__PURE__ */ createElementVNode("path", {
  2661. fill: "currentColor",
  2662. d: "M832 384H576V128H192v768h640V384zm-26.496-64L640 154.496V320h165.504zM160 64h480l256 256v608a32 32 0 0 1-32 32H160a32 32 0 0 1-32-32V96a32 32 0 0 1 32-32zm160 448h384v64H320v-64zm0-192h160v64H320v-64zm0 384h384v64H320v-64z"
  2663. }, null, -1);
  2664. const _hoisted_3$v = [
  2665. _hoisted_2$I
  2666. ];
  2667. function _sfc_render$S(_ctx, _cache, $props, $setup, $data, $options) {
  2668. return openBlock(), createElementBlock("svg", _hoisted_1$R, _hoisted_3$v);
  2669. }
  2670. var document$1 = /* @__PURE__ */ _export_sfc$2(_sfc_main$1k, [["render", _sfc_render$S]]);
  2671. const _sfc_main$1j = defineComponent({
  2672. name: "FullScreen"
  2673. });
  2674. const _hoisted_1$Q = {
  2675. viewBox: "0 0 1024 1024",
  2676. xmlns: "http://www.w3.org/2000/svg"
  2677. };
  2678. const _hoisted_2$H = /* @__PURE__ */ createElementVNode("path", {
  2679. fill: "currentColor",
  2680. d: "m160 96.064 192 .192a32 32 0 0 1 0 64l-192-.192V352a32 32 0 0 1-64 0V96h64v.064zm0 831.872V928H96V672a32 32 0 1 1 64 0v191.936l192-.192a32 32 0 1 1 0 64l-192 .192zM864 96.064V96h64v256a32 32 0 1 1-64 0V160.064l-192 .192a32 32 0 1 1 0-64l192-.192zm0 831.872-192-.192a32 32 0 0 1 0-64l192 .192V672a32 32 0 1 1 64 0v256h-64v-.064z"
  2681. }, null, -1);
  2682. const _hoisted_3$u = [
  2683. _hoisted_2$H
  2684. ];
  2685. function _sfc_render$R(_ctx, _cache, $props, $setup, $data, $options) {
  2686. return openBlock(), createElementBlock("svg", _hoisted_1$Q, _hoisted_3$u);
  2687. }
  2688. var fullScreen = /* @__PURE__ */ _export_sfc$2(_sfc_main$1j, [["render", _sfc_render$R]]);
  2689. const _sfc_main$1i = defineComponent({
  2690. name: "Hide"
  2691. });
  2692. const _hoisted_1$P = {
  2693. viewBox: "0 0 1024 1024",
  2694. xmlns: "http://www.w3.org/2000/svg"
  2695. };
  2696. const _hoisted_2$G = /* @__PURE__ */ createElementVNode("path", {
  2697. d: "M876.8 156.8c0-9.6-3.2-16-9.6-22.4-6.4-6.4-12.8-9.6-22.4-9.6-9.6 0-16 3.2-22.4 9.6L736 220.8c-64-32-137.6-51.2-224-60.8-160 16-288 73.6-377.6 176C44.8 438.4 0 496 0 512s48 73.6 134.4 176c22.4 25.6 44.8 48 73.6 67.2l-86.4 89.6c-6.4 6.4-9.6 12.8-9.6 22.4 0 9.6 3.2 16 9.6 22.4 6.4 6.4 12.8 9.6 22.4 9.6 9.6 0 16-3.2 22.4-9.6l704-710.4c3.2-6.4 6.4-12.8 6.4-22.4Zm-646.4 528c-76.8-70.4-128-128-153.6-172.8 28.8-48 80-105.6 153.6-172.8C304 272 400 230.4 512 224c64 3.2 124.8 19.2 176 44.8l-54.4 54.4C598.4 300.8 560 288 512 288c-64 0-115.2 22.4-160 64s-64 96-64 160c0 48 12.8 89.6 35.2 124.8L256 707.2c-9.6-6.4-19.2-16-25.6-22.4Zm140.8-96c-12.8-22.4-19.2-48-19.2-76.8 0-44.8 16-83.2 48-112 32-28.8 67.2-48 112-48 28.8 0 54.4 6.4 73.6 19.2L371.2 588.8ZM889.599 336c-12.8-16-28.8-28.8-41.6-41.6l-48 48c73.6 67.2 124.8 124.8 150.4 169.6-28.8 48-80 105.6-153.6 172.8-73.6 67.2-172.8 108.8-284.8 115.2-51.2-3.2-99.2-12.8-140.8-28.8l-48 48c57.6 22.4 118.4 38.4 188.8 44.8 160-16 288-73.6 377.6-176C979.199 585.6 1024 528 1024 512s-48.001-73.6-134.401-176Z",
  2698. fill: "currentColor"
  2699. }, null, -1);
  2700. const _hoisted_3$t = /* @__PURE__ */ createElementVNode("path", {
  2701. d: "M511.998 672c-12.8 0-25.6-3.2-38.4-6.4l-51.2 51.2c28.8 12.8 57.6 19.2 89.6 19.2 64 0 115.2-22.4 160-64 41.6-41.6 64-96 64-160 0-32-6.4-64-19.2-89.6l-51.2 51.2c3.2 12.8 6.4 25.6 6.4 38.4 0 44.8-16 83.2-48 112-32 28.8-67.2 48-112 48Z",
  2702. fill: "currentColor"
  2703. }, null, -1);
  2704. const _hoisted_4$e = [
  2705. _hoisted_2$G,
  2706. _hoisted_3$t
  2707. ];
  2708. function _sfc_render$Q(_ctx, _cache, $props, $setup, $data, $options) {
  2709. return openBlock(), createElementBlock("svg", _hoisted_1$P, _hoisted_4$e);
  2710. }
  2711. var hide$2 = /* @__PURE__ */ _export_sfc$2(_sfc_main$1i, [["render", _sfc_render$Q]]);
  2712. const _sfc_main$1h = defineComponent({
  2713. name: "Loading"
  2714. });
  2715. const _hoisted_1$O = {
  2716. viewBox: "0 0 1024 1024",
  2717. xmlns: "http://www.w3.org/2000/svg"
  2718. };
  2719. const _hoisted_2$F = /* @__PURE__ */ createElementVNode("path", {
  2720. fill: "currentColor",
  2721. d: "M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32zm0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32zm448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32zm-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32zM195.2 195.2a32 32 0 0 1 45.248 0L376.32 331.008a32 32 0 0 1-45.248 45.248L195.2 240.448a32 32 0 0 1 0-45.248zm452.544 452.544a32 32 0 0 1 45.248 0L828.8 783.552a32 32 0 0 1-45.248 45.248L647.744 692.992a32 32 0 0 1 0-45.248zM828.8 195.264a32 32 0 0 1 0 45.184L692.992 376.32a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0zm-452.544 452.48a32 32 0 0 1 0 45.248L240.448 828.8a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0z"
  2722. }, null, -1);
  2723. const _hoisted_3$s = [
  2724. _hoisted_2$F
  2725. ];
  2726. function _sfc_render$P(_ctx, _cache, $props, $setup, $data, $options) {
  2727. return openBlock(), createElementBlock("svg", _hoisted_1$O, _hoisted_3$s);
  2728. }
  2729. var loading = /* @__PURE__ */ _export_sfc$2(_sfc_main$1h, [["render", _sfc_render$P]]);
  2730. const _sfc_main$1g = defineComponent({
  2731. name: "Minus"
  2732. });
  2733. const _hoisted_1$N = {
  2734. viewBox: "0 0 1024 1024",
  2735. xmlns: "http://www.w3.org/2000/svg"
  2736. };
  2737. const _hoisted_2$E = /* @__PURE__ */ createElementVNode("path", {
  2738. fill: "currentColor",
  2739. d: "M128 544h768a32 32 0 1 0 0-64H128a32 32 0 0 0 0 64z"
  2740. }, null, -1);
  2741. const _hoisted_3$r = [
  2742. _hoisted_2$E
  2743. ];
  2744. function _sfc_render$O(_ctx, _cache, $props, $setup, $data, $options) {
  2745. return openBlock(), createElementBlock("svg", _hoisted_1$N, _hoisted_3$r);
  2746. }
  2747. var minus = /* @__PURE__ */ _export_sfc$2(_sfc_main$1g, [["render", _sfc_render$O]]);
  2748. const _sfc_main$1f = defineComponent({
  2749. name: "Plus"
  2750. });
  2751. const _hoisted_1$M = {
  2752. viewBox: "0 0 1024 1024",
  2753. xmlns: "http://www.w3.org/2000/svg"
  2754. };
  2755. const _hoisted_2$D = /* @__PURE__ */ createElementVNode("path", {
  2756. fill: "currentColor",
  2757. d: "M480 480V128a32 32 0 0 1 64 0v352h352a32 32 0 1 1 0 64H544v352a32 32 0 1 1-64 0V544H128a32 32 0 0 1 0-64h352z"
  2758. }, null, -1);
  2759. const _hoisted_3$q = [
  2760. _hoisted_2$D
  2761. ];
  2762. function _sfc_render$N(_ctx, _cache, $props, $setup, $data, $options) {
  2763. return openBlock(), createElementBlock("svg", _hoisted_1$M, _hoisted_3$q);
  2764. }
  2765. var plus = /* @__PURE__ */ _export_sfc$2(_sfc_main$1f, [["render", _sfc_render$N]]);
  2766. const _sfc_main$1e = defineComponent({
  2767. name: "RefreshLeft"
  2768. });
  2769. const _hoisted_1$L = {
  2770. viewBox: "0 0 1024 1024",
  2771. xmlns: "http://www.w3.org/2000/svg"
  2772. };
  2773. const _hoisted_2$C = /* @__PURE__ */ createElementVNode("path", {
  2774. fill: "currentColor",
  2775. d: "M289.088 296.704h92.992a32 32 0 0 1 0 64H232.96a32 32 0 0 1-32-32V179.712a32 32 0 0 1 64 0v50.56a384 384 0 0 1 643.84 282.88 384 384 0 0 1-383.936 384 384 384 0 0 1-384-384h64a320 320 0 1 0 640 0 320 320 0 0 0-555.712-216.448z"
  2776. }, null, -1);
  2777. const _hoisted_3$p = [
  2778. _hoisted_2$C
  2779. ];
  2780. function _sfc_render$M(_ctx, _cache, $props, $setup, $data, $options) {
  2781. return openBlock(), createElementBlock("svg", _hoisted_1$L, _hoisted_3$p);
  2782. }
  2783. var refreshLeft = /* @__PURE__ */ _export_sfc$2(_sfc_main$1e, [["render", _sfc_render$M]]);
  2784. const _sfc_main$1d = defineComponent({
  2785. name: "RefreshRight"
  2786. });
  2787. const _hoisted_1$K = {
  2788. viewBox: "0 0 1024 1024",
  2789. xmlns: "http://www.w3.org/2000/svg"
  2790. };
  2791. const _hoisted_2$B = /* @__PURE__ */ createElementVNode("path", {
  2792. fill: "currentColor",
  2793. d: "M784.512 230.272v-50.56a32 32 0 1 1 64 0v149.056a32 32 0 0 1-32 32H667.52a32 32 0 1 1 0-64h92.992A320 320 0 1 0 524.8 833.152a320 320 0 0 0 320-320h64a384 384 0 0 1-384 384 384 384 0 0 1-384-384 384 384 0 0 1 643.712-282.88z"
  2794. }, null, -1);
  2795. const _hoisted_3$o = [
  2796. _hoisted_2$B
  2797. ];
  2798. function _sfc_render$L(_ctx, _cache, $props, $setup, $data, $options) {
  2799. return openBlock(), createElementBlock("svg", _hoisted_1$K, _hoisted_3$o);
  2800. }
  2801. var refreshRight = /* @__PURE__ */ _export_sfc$2(_sfc_main$1d, [["render", _sfc_render$L]]);
  2802. const _sfc_main$1c = defineComponent({
  2803. name: "ScaleToOriginal"
  2804. });
  2805. const _hoisted_1$J = {
  2806. viewBox: "0 0 1024 1024",
  2807. xmlns: "http://www.w3.org/2000/svg"
  2808. };
  2809. const _hoisted_2$A = /* @__PURE__ */ createElementVNode("path", {
  2810. fill: "currentColor",
  2811. d: "M813.176 180.706a60.235 60.235 0 0 1 60.236 60.235v481.883a60.235 60.235 0 0 1-60.236 60.235H210.824a60.235 60.235 0 0 1-60.236-60.235V240.94a60.235 60.235 0 0 1 60.236-60.235h602.352zm0-60.235H210.824A120.47 120.47 0 0 0 90.353 240.94v481.883a120.47 120.47 0 0 0 120.47 120.47h602.353a120.47 120.47 0 0 0 120.471-120.47V240.94a120.47 120.47 0 0 0-120.47-120.47zm-120.47 180.705a30.118 30.118 0 0 0-30.118 30.118v301.177a30.118 30.118 0 0 0 60.236 0V331.294a30.118 30.118 0 0 0-30.118-30.118zm-361.412 0a30.118 30.118 0 0 0-30.118 30.118v301.177a30.118 30.118 0 1 0 60.236 0V331.294a30.118 30.118 0 0 0-30.118-30.118zM512 361.412a30.118 30.118 0 0 0-30.118 30.117v30.118a30.118 30.118 0 0 0 60.236 0V391.53A30.118 30.118 0 0 0 512 361.412zM512 512a30.118 30.118 0 0 0-30.118 30.118v30.117a30.118 30.118 0 0 0 60.236 0v-30.117A30.118 30.118 0 0 0 512 512z"
  2812. }, null, -1);
  2813. const _hoisted_3$n = [
  2814. _hoisted_2$A
  2815. ];
  2816. function _sfc_render$K(_ctx, _cache, $props, $setup, $data, $options) {
  2817. return openBlock(), createElementBlock("svg", _hoisted_1$J, _hoisted_3$n);
  2818. }
  2819. var scaleToOriginal = /* @__PURE__ */ _export_sfc$2(_sfc_main$1c, [["render", _sfc_render$K]]);
  2820. const _sfc_main$1b = defineComponent({
  2821. name: "StarFilled"
  2822. });
  2823. const _hoisted_1$I = {
  2824. viewBox: "0 0 1024 1024",
  2825. xmlns: "http://www.w3.org/2000/svg"
  2826. };
  2827. const _hoisted_2$z = /* @__PURE__ */ createElementVNode("path", {
  2828. fill: "currentColor",
  2829. d: "M283.84 867.84 512 747.776l228.16 119.936a6.4 6.4 0 0 0 9.28-6.72l-43.52-254.08 184.512-179.904a6.4 6.4 0 0 0-3.52-10.88l-255.104-37.12L517.76 147.904a6.4 6.4 0 0 0-11.52 0L392.192 379.072l-255.104 37.12a6.4 6.4 0 0 0-3.52 10.88L318.08 606.976l-43.584 254.08a6.4 6.4 0 0 0 9.28 6.72z"
  2830. }, null, -1);
  2831. const _hoisted_3$m = [
  2832. _hoisted_2$z
  2833. ];
  2834. function _sfc_render$J(_ctx, _cache, $props, $setup, $data, $options) {
  2835. return openBlock(), createElementBlock("svg", _hoisted_1$I, _hoisted_3$m);
  2836. }
  2837. var starFilled = /* @__PURE__ */ _export_sfc$2(_sfc_main$1b, [["render", _sfc_render$J]]);
  2838. const _sfc_main$1a = defineComponent({
  2839. name: "Star"
  2840. });
  2841. const _hoisted_1$H = {
  2842. viewBox: "0 0 1024 1024",
  2843. xmlns: "http://www.w3.org/2000/svg"
  2844. };
  2845. const _hoisted_2$y = /* @__PURE__ */ createElementVNode("path", {
  2846. fill: "currentColor",
  2847. d: "m512 747.84 228.16 119.936a6.4 6.4 0 0 0 9.28-6.72l-43.52-254.08 184.512-179.904a6.4 6.4 0 0 0-3.52-10.88l-255.104-37.12L517.76 147.904a6.4 6.4 0 0 0-11.52 0L392.192 379.072l-255.104 37.12a6.4 6.4 0 0 0-3.52 10.88L318.08 606.976l-43.584 254.08a6.4 6.4 0 0 0 9.28 6.72L512 747.84zM313.6 924.48a70.4 70.4 0 0 1-102.144-74.24l37.888-220.928L88.96 472.96A70.4 70.4 0 0 1 128 352.896l221.76-32.256 99.2-200.96a70.4 70.4 0 0 1 126.208 0l99.2 200.96 221.824 32.256a70.4 70.4 0 0 1 39.04 120.064L774.72 629.376l37.888 220.928a70.4 70.4 0 0 1-102.144 74.24L512 820.096l-198.4 104.32z"
  2848. }, null, -1);
  2849. const _hoisted_3$l = [
  2850. _hoisted_2$y
  2851. ];
  2852. function _sfc_render$I(_ctx, _cache, $props, $setup, $data, $options) {
  2853. return openBlock(), createElementBlock("svg", _hoisted_1$H, _hoisted_3$l);
  2854. }
  2855. var star = /* @__PURE__ */ _export_sfc$2(_sfc_main$1a, [["render", _sfc_render$I]]);
  2856. const _sfc_main$19 = defineComponent({
  2857. name: "View"
  2858. });
  2859. const _hoisted_1$G = {
  2860. viewBox: "0 0 1024 1024",
  2861. xmlns: "http://www.w3.org/2000/svg"
  2862. };
  2863. const _hoisted_2$x = /* @__PURE__ */ createElementVNode("path", {
  2864. fill: "currentColor",
  2865. d: "M512 160c320 0 512 352 512 352S832 864 512 864 0 512 0 512s192-352 512-352zm0 64c-225.28 0-384.128 208.064-436.8 288 52.608 79.872 211.456 288 436.8 288 225.28 0 384.128-208.064 436.8-288-52.608-79.872-211.456-288-436.8-288zm0 64a224 224 0 1 1 0 448 224 224 0 0 1 0-448zm0 64a160.192 160.192 0 0 0-160 160c0 88.192 71.744 160 160 160s160-71.808 160-160-71.744-160-160-160z"
  2866. }, null, -1);
  2867. const _hoisted_3$k = [
  2868. _hoisted_2$x
  2869. ];
  2870. function _sfc_render$H(_ctx, _cache, $props, $setup, $data, $options) {
  2871. return openBlock(), createElementBlock("svg", _hoisted_1$G, _hoisted_3$k);
  2872. }
  2873. var view = /* @__PURE__ */ _export_sfc$2(_sfc_main$19, [["render", _sfc_render$H]]);
  2874. const _sfc_main$18 = defineComponent({
  2875. name: "WarningFilled"
  2876. });
  2877. const _hoisted_1$F = {
  2878. viewBox: "0 0 1024 1024",
  2879. xmlns: "http://www.w3.org/2000/svg"
  2880. };
  2881. const _hoisted_2$w = /* @__PURE__ */ createElementVNode("path", {
  2882. fill: "currentColor",
  2883. d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896zm0 192a58.432 58.432 0 0 0-58.24 63.744l23.36 256.384a35.072 35.072 0 0 0 69.76 0l23.296-256.384A58.432 58.432 0 0 0 512 256zm0 512a51.2 51.2 0 1 0 0-102.4 51.2 51.2 0 0 0 0 102.4z"
  2884. }, null, -1);
  2885. const _hoisted_3$j = [
  2886. _hoisted_2$w
  2887. ];
  2888. function _sfc_render$G(_ctx, _cache, $props, $setup, $data, $options) {
  2889. return openBlock(), createElementBlock("svg", _hoisted_1$F, _hoisted_3$j);
  2890. }
  2891. var warningFilled = /* @__PURE__ */ _export_sfc$2(_sfc_main$18, [["render", _sfc_render$G]]);
  2892. const _sfc_main$17 = defineComponent({
  2893. name: "ZoomIn"
  2894. });
  2895. const _hoisted_1$E = {
  2896. viewBox: "0 0 1024 1024",
  2897. xmlns: "http://www.w3.org/2000/svg"
  2898. };
  2899. const _hoisted_2$v = /* @__PURE__ */ createElementVNode("path", {
  2900. fill: "currentColor",
  2901. d: "m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704zm-32-384v-96a32 32 0 0 1 64 0v96h96a32 32 0 0 1 0 64h-96v96a32 32 0 0 1-64 0v-96h-96a32 32 0 0 1 0-64h96z"
  2902. }, null, -1);
  2903. const _hoisted_3$i = [
  2904. _hoisted_2$v
  2905. ];
  2906. function _sfc_render$F(_ctx, _cache, $props, $setup, $data, $options) {
  2907. return openBlock(), createElementBlock("svg", _hoisted_1$E, _hoisted_3$i);
  2908. }
  2909. var zoomIn = /* @__PURE__ */ _export_sfc$2(_sfc_main$17, [["render", _sfc_render$F]]);
  2910. const _sfc_main$16 = defineComponent({
  2911. name: "ZoomOut"
  2912. });
  2913. const _hoisted_1$D = {
  2914. viewBox: "0 0 1024 1024",
  2915. xmlns: "http://www.w3.org/2000/svg"
  2916. };
  2917. const _hoisted_2$u = /* @__PURE__ */ createElementVNode("path", {
  2918. fill: "currentColor",
  2919. d: "m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704zM352 448h256a32 32 0 0 1 0 64H352a32 32 0 0 1 0-64z"
  2920. }, null, -1);
  2921. const _hoisted_3$h = [
  2922. _hoisted_2$u
  2923. ];
  2924. function _sfc_render$E(_ctx, _cache, $props, $setup, $data, $options) {
  2925. return openBlock(), createElementBlock("svg", _hoisted_1$D, _hoisted_3$h);
  2926. }
  2927. var zoomOut = /* @__PURE__ */ _export_sfc$2(_sfc_main$16, [["render", _sfc_render$E]]);
  2928. const wrapperKey = Symbol();
  2929. const propKey = "__elPropsReservedKey";
  2930. function buildProp(option, key) {
  2931. if (!isObject$1(option) || !!option[propKey])
  2932. return option;
  2933. const { values, required: required4, default: defaultValue, type: type4, validator } = option;
  2934. const _validator = values || validator ? (val) => {
  2935. let valid = false;
  2936. let allowedValues = [];
  2937. if (values) {
  2938. allowedValues = Array.from(values);
  2939. if (hasOwn(option, "default")) {
  2940. allowedValues.push(defaultValue);
  2941. }
  2942. valid || (valid = allowedValues.includes(val));
  2943. }
  2944. if (validator)
  2945. valid || (valid = validator(val));
  2946. if (!valid && allowedValues.length > 0) {
  2947. const allowValuesText = [...new Set(allowedValues)].map((value) => JSON.stringify(value)).join(", ");
  2948. warn(`Invalid prop: validation failed${key ? ` for prop "${key}"` : ""}. Expected one of [${allowValuesText}], got value ${JSON.stringify(val)}.`);
  2949. }
  2950. return valid;
  2951. } : void 0;
  2952. const prop = {
  2953. type: isObject$1(type4) && Object.getOwnPropertySymbols(type4).includes(wrapperKey) ? type4[wrapperKey] : type4,
  2954. required: !!required4,
  2955. validator: _validator,
  2956. [propKey]: true
  2957. };
  2958. if (hasOwn(option, "default"))
  2959. prop.default = defaultValue;
  2960. return prop;
  2961. }
  2962. const buildProps = (props) => fromPairs(Object.entries(props).map(([key, option]) => [
  2963. key,
  2964. buildProp(option, key)
  2965. ]));
  2966. const definePropType = (val) => ({ [wrapperKey]: val });
  2967. const iconPropType = definePropType([
  2968. String,
  2969. Object,
  2970. Function
  2971. ]);
  2972. const CloseComponents = {
  2973. Close: close
  2974. };
  2975. const ValidateComponentsMap = {
  2976. validating: loading,
  2977. success: circleCheck,
  2978. error: circleClose
  2979. };
  2980. const withInstall = (main2, extra) => {
  2981. main2.install = (app) => {
  2982. for (const comp of [main2, ...Object.values(extra != null ? extra : {})]) {
  2983. app.component(comp.name, comp);
  2984. }
  2985. };
  2986. if (extra) {
  2987. for (const [key, comp] of Object.entries(extra)) {
  2988. main2[key] = comp;
  2989. }
  2990. }
  2991. return main2;
  2992. };
  2993. const withNoopInstall = (component) => {
  2994. component.install = NOOP;
  2995. return component;
  2996. };
  2997. class ElementPlusError extends Error {
  2998. constructor(m2) {
  2999. super(m2);
  3000. this.name = "ElementPlusError";
  3001. }
  3002. }
  3003. function throwError(scope, m2) {
  3004. throw new ElementPlusError(`[${scope}] ${m2}`);
  3005. }
  3006. function debugWarn(scope, message) {
  3007. }
  3008. function addUnit(value, defaultUnit = "px") {
  3009. if (!value)
  3010. return "";
  3011. if (isString(value)) {
  3012. return value;
  3013. } else if (isNumber(value)) {
  3014. return `${value}${defaultUnit}`;
  3015. }
  3016. }
  3017. const EVENT_CODE = {
  3018. tab: "Tab",
  3019. enter: "Enter",
  3020. space: "Space",
  3021. left: "ArrowLeft",
  3022. up: "ArrowUp",
  3023. right: "ArrowRight",
  3024. down: "ArrowDown",
  3025. esc: "Escape",
  3026. delete: "Delete",
  3027. backspace: "Backspace",
  3028. numpadEnter: "NumpadEnter",
  3029. pageUp: "PageUp",
  3030. pageDown: "PageDown",
  3031. home: "Home",
  3032. end: "End"
  3033. };
  3034. const datePickTypes = [
  3035. "year",
  3036. "month",
  3037. "date",
  3038. "dates",
  3039. "week",
  3040. "datetime",
  3041. "datetimerange",
  3042. "daterange",
  3043. "monthrange"
  3044. ];
  3045. const UPDATE_MODEL_EVENT = "update:modelValue";
  3046. const CHANGE_EVENT = "change";
  3047. const INPUT_EVENT = "input";
  3048. const componentSizes = ["", "default", "small", "large"];
  3049. const componentSizeMap = {
  3050. large: 40,
  3051. default: 32,
  3052. small: 24
  3053. };
  3054. const getComponentSize = (size = "default") => {
  3055. return componentSizeMap[size || "default"];
  3056. };
  3057. const isValidComponentSize = (val) => ["", ...componentSizes].includes(val);
  3058. const isValidDatePickType = (val) => [...datePickTypes].includes(val);
  3059. var PatchFlags = /* @__PURE__ */ ((PatchFlags2) => {
  3060. PatchFlags2[PatchFlags2["TEXT"] = 1] = "TEXT";
  3061. PatchFlags2[PatchFlags2["CLASS"] = 2] = "CLASS";
  3062. PatchFlags2[PatchFlags2["STYLE"] = 4] = "STYLE";
  3063. PatchFlags2[PatchFlags2["PROPS"] = 8] = "PROPS";
  3064. PatchFlags2[PatchFlags2["FULL_PROPS"] = 16] = "FULL_PROPS";
  3065. PatchFlags2[PatchFlags2["HYDRATE_EVENTS"] = 32] = "HYDRATE_EVENTS";
  3066. PatchFlags2[PatchFlags2["STABLE_FRAGMENT"] = 64] = "STABLE_FRAGMENT";
  3067. PatchFlags2[PatchFlags2["KEYED_FRAGMENT"] = 128] = "KEYED_FRAGMENT";
  3068. PatchFlags2[PatchFlags2["UNKEYED_FRAGMENT"] = 256] = "UNKEYED_FRAGMENT";
  3069. PatchFlags2[PatchFlags2["NEED_PATCH"] = 512] = "NEED_PATCH";
  3070. PatchFlags2[PatchFlags2["DYNAMIC_SLOTS"] = 1024] = "DYNAMIC_SLOTS";
  3071. PatchFlags2[PatchFlags2["HOISTED"] = -1] = "HOISTED";
  3072. PatchFlags2[PatchFlags2["BAIL"] = -2] = "BAIL";
  3073. return PatchFlags2;
  3074. })(PatchFlags || {});
  3075. function isFragment(node) {
  3076. return isVNode(node) && node.type === Fragment;
  3077. }
  3078. function isComment(node) {
  3079. return isVNode(node) && node.type === Comment;
  3080. }
  3081. function isValidElementNode(node) {
  3082. return isVNode(node) && !isFragment(node) && !isComment(node);
  3083. }
  3084. const unique = (arr) => [...new Set(arr)];
  3085. const castArray = (arr) => {
  3086. if (!arr && arr !== 0)
  3087. return [];
  3088. return Array.isArray(arr) ? arr : [arr];
  3089. };
  3090. const isFirefox = () => isClient$1 && /firefox/i.test(window.navigator.userAgent);
  3091. const isKorean = (text) => /([(\uAC00-\uD7AF)|(\u3130-\u318F)])+/gi.test(text);
  3092. const generateId = () => Math.floor(Math.random() * 1e4);
  3093. const mutable = (val) => val;
  3094. const DEFAULT_EXCLUDE_KEYS = ["class", "style"];
  3095. const LISTENER_PREFIX = /^on[A-Z]/;
  3096. const useAttrs = (params = {}) => {
  3097. const { excludeListeners = false, excludeKeys = [] } = params;
  3098. const allExcludeKeys = excludeKeys.concat(DEFAULT_EXCLUDE_KEYS);
  3099. const instance = getCurrentInstance();
  3100. if (!instance) {
  3101. return computed(() => ({}));
  3102. }
  3103. return computed(() => {
  3104. var _a2;
  3105. return fromPairs(Object.entries((_a2 = instance.proxy) == null ? void 0 : _a2.$attrs).filter(([key]) => !allExcludeKeys.includes(key) && !(excludeListeners && LISTENER_PREFIX.test(key))));
  3106. });
  3107. };
  3108. const buttonGroupContextKey = Symbol("buttonGroupContextKey");
  3109. const configProviderContextKey = Symbol();
  3110. const dialogInjectionKey = Symbol("dialogInjectionKey");
  3111. const formContextKey = Symbol("formContextKey");
  3112. const formItemContextKey = Symbol("formItemContextKey");
  3113. const radioGroupKey = Symbol("radioGroupKey");
  3114. const scrollbarContextKey = Symbol("scrollbarContextKey");
  3115. const uploadContextKey = Symbol("uploadContextKey");
  3116. const POPPER_INJECTION_KEY = Symbol("popper");
  3117. const POPPER_CONTENT_INJECTION_KEY = Symbol("popperContent");
  3118. const useProp = (name) => {
  3119. const vm = getCurrentInstance();
  3120. return computed(() => {
  3121. var _a2, _b2;
  3122. return (_b2 = (_a2 = vm.proxy) == null ? void 0 : _a2.$props[name]) != null ? _b2 : void 0;
  3123. });
  3124. };
  3125. const globalConfig = ref();
  3126. function useGlobalConfig(key, defaultValue = void 0) {
  3127. const config = getCurrentInstance() ? inject(configProviderContextKey, globalConfig) : globalConfig;
  3128. if (key) {
  3129. return computed(() => {
  3130. var _a2, _b2;
  3131. return (_b2 = (_a2 = config.value) == null ? void 0 : _a2[key]) != null ? _b2 : defaultValue;
  3132. });
  3133. } else {
  3134. return config;
  3135. }
  3136. }
  3137. const provideGlobalConfig = (config, app, global2 = false) => {
  3138. var _a2;
  3139. const inSetup = !!getCurrentInstance();
  3140. const oldConfig = inSetup ? useGlobalConfig() : void 0;
  3141. const provideFn = (_a2 = app == null ? void 0 : app.provide) != null ? _a2 : inSetup ? provide : void 0;
  3142. if (!provideFn) {
  3143. return;
  3144. }
  3145. const context = computed(() => {
  3146. const cfg = unref(config);
  3147. if (!(oldConfig == null ? void 0 : oldConfig.value))
  3148. return cfg;
  3149. return mergeConfig(oldConfig.value, cfg);
  3150. });
  3151. provideFn(configProviderContextKey, context);
  3152. if (global2 || !globalConfig.value) {
  3153. globalConfig.value = context.value;
  3154. }
  3155. return context;
  3156. };
  3157. const mergeConfig = (a2, b2) => {
  3158. var _a2;
  3159. const keys2 = [.../* @__PURE__ */ new Set([...keysOf(a2), ...keysOf(b2)])];
  3160. const obj = {};
  3161. for (const key of keys2) {
  3162. obj[key] = (_a2 = b2[key]) != null ? _a2 : a2[key];
  3163. }
  3164. return obj;
  3165. };
  3166. const useSizeProp = buildProp({
  3167. type: String,
  3168. values: componentSizes,
  3169. required: false
  3170. });
  3171. const useSize = (fallback, ignore = {}) => {
  3172. const emptyRef = ref(void 0);
  3173. const size = ignore.prop ? emptyRef : useProp("size");
  3174. const globalConfig2 = ignore.global ? emptyRef : useGlobalConfig("size");
  3175. const form = ignore.form ? { size: void 0 } : inject(formContextKey, void 0);
  3176. const formItem = ignore.formItem ? { size: void 0 } : inject(formItemContextKey, void 0);
  3177. return computed(() => size.value || unref(fallback) || (formItem == null ? void 0 : formItem.size) || (form == null ? void 0 : form.size) || globalConfig2.value || "");
  3178. };
  3179. const useDisabled$1 = (fallback) => {
  3180. const disabled = useProp("disabled");
  3181. const form = inject(formContextKey, void 0);
  3182. return computed(() => disabled.value || unref(fallback) || (form == null ? void 0 : form.disabled) || false);
  3183. };
  3184. const useDeprecated = ({ from, replacement, scope, version, ref: ref2, type: type4 = "API" }, condition) => {
  3185. watch(() => unref(condition), (val) => {
  3186. }, {
  3187. immediate: true
  3188. });
  3189. };
  3190. const useDraggable = (targetRef, dragRef, draggable) => {
  3191. let transform = {
  3192. offsetX: 0,
  3193. offsetY: 0
  3194. };
  3195. const onMousedown = (e) => {
  3196. const downX = e.clientX;
  3197. const downY = e.clientY;
  3198. const { offsetX, offsetY } = transform;
  3199. const targetRect = targetRef.value.getBoundingClientRect();
  3200. const targetLeft = targetRect.left;
  3201. const targetTop = targetRect.top;
  3202. const targetWidth = targetRect.width;
  3203. const targetHeight = targetRect.height;
  3204. const clientWidth = document.documentElement.clientWidth;
  3205. const clientHeight = document.documentElement.clientHeight;
  3206. const minLeft = -targetLeft + offsetX;
  3207. const minTop = -targetTop + offsetY;
  3208. const maxLeft = clientWidth - targetLeft - targetWidth + offsetX;
  3209. const maxTop = clientHeight - targetTop - targetHeight + offsetY;
  3210. const onMousemove = (e2) => {
  3211. const moveX = Math.min(Math.max(offsetX + e2.clientX - downX, minLeft), maxLeft);
  3212. const moveY = Math.min(Math.max(offsetY + e2.clientY - downY, minTop), maxTop);
  3213. transform = {
  3214. offsetX: moveX,
  3215. offsetY: moveY
  3216. };
  3217. targetRef.value.style.transform = `translate(${addUnit(moveX)}, ${addUnit(moveY)})`;
  3218. };
  3219. const onMouseup = () => {
  3220. document.removeEventListener("mousemove", onMousemove);
  3221. document.removeEventListener("mouseup", onMouseup);
  3222. };
  3223. document.addEventListener("mousemove", onMousemove);
  3224. document.addEventListener("mouseup", onMouseup);
  3225. };
  3226. const onDraggable = () => {
  3227. if (dragRef.value && targetRef.value) {
  3228. dragRef.value.addEventListener("mousedown", onMousedown);
  3229. }
  3230. };
  3231. const offDraggable = () => {
  3232. if (dragRef.value && targetRef.value) {
  3233. dragRef.value.removeEventListener("mousedown", onMousedown);
  3234. }
  3235. };
  3236. onMounted(() => {
  3237. watchEffect(() => {
  3238. if (draggable.value) {
  3239. onDraggable();
  3240. } else {
  3241. offDraggable();
  3242. }
  3243. });
  3244. });
  3245. onBeforeUnmount(() => {
  3246. offDraggable();
  3247. });
  3248. };
  3249. const useFocus = (el) => {
  3250. return {
  3251. focus: () => {
  3252. var _a2, _b2;
  3253. (_b2 = (_a2 = el.value) == null ? void 0 : _a2.focus) == null ? void 0 : _b2.call(_a2);
  3254. }
  3255. };
  3256. };
  3257. const useFormItem = () => {
  3258. const form = inject(formContextKey, void 0);
  3259. const formItem = inject(formItemContextKey, void 0);
  3260. return {
  3261. form,
  3262. formItem
  3263. };
  3264. };
  3265. var English = {
  3266. name: "en",
  3267. el: {
  3268. colorpicker: {
  3269. confirm: "OK",
  3270. clear: "Clear"
  3271. },
  3272. datepicker: {
  3273. now: "Now",
  3274. today: "Today",
  3275. cancel: "Cancel",
  3276. clear: "Clear",
  3277. confirm: "OK",
  3278. selectDate: "Select date",
  3279. selectTime: "Select time",
  3280. startDate: "Start Date",
  3281. startTime: "Start Time",
  3282. endDate: "End Date",
  3283. endTime: "End Time",
  3284. prevYear: "Previous Year",
  3285. nextYear: "Next Year",
  3286. prevMonth: "Previous Month",
  3287. nextMonth: "Next Month",
  3288. year: "",
  3289. month1: "January",
  3290. month2: "February",
  3291. month3: "March",
  3292. month4: "April",
  3293. month5: "May",
  3294. month6: "June",
  3295. month7: "July",
  3296. month8: "August",
  3297. month9: "September",
  3298. month10: "October",
  3299. month11: "November",
  3300. month12: "December",
  3301. week: "week",
  3302. weeks: {
  3303. sun: "Sun",
  3304. mon: "Mon",
  3305. tue: "Tue",
  3306. wed: "Wed",
  3307. thu: "Thu",
  3308. fri: "Fri",
  3309. sat: "Sat"
  3310. },
  3311. months: {
  3312. jan: "Jan",
  3313. feb: "Feb",
  3314. mar: "Mar",
  3315. apr: "Apr",
  3316. may: "May",
  3317. jun: "Jun",
  3318. jul: "Jul",
  3319. aug: "Aug",
  3320. sep: "Sep",
  3321. oct: "Oct",
  3322. nov: "Nov",
  3323. dec: "Dec"
  3324. }
  3325. },
  3326. select: {
  3327. loading: "Loading",
  3328. noMatch: "No matching data",
  3329. noData: "No data",
  3330. placeholder: "Select"
  3331. },
  3332. cascader: {
  3333. noMatch: "No matching data",
  3334. loading: "Loading",
  3335. placeholder: "Select",
  3336. noData: "No data"
  3337. },
  3338. pagination: {
  3339. goto: "Go to",
  3340. pagesize: "/page",
  3341. total: "Total {total}",
  3342. pageClassifier: "",
  3343. deprecationWarning: "Deprecated usages detected, please refer to the el-pagination documentation for more details"
  3344. },
  3345. messagebox: {
  3346. title: "Message",
  3347. confirm: "OK",
  3348. cancel: "Cancel",
  3349. error: "Illegal input"
  3350. },
  3351. upload: {
  3352. deleteTip: "press delete to remove",
  3353. delete: "Delete",
  3354. preview: "Preview",
  3355. continue: "Continue"
  3356. },
  3357. table: {
  3358. emptyText: "No Data",
  3359. confirmFilter: "Confirm",
  3360. resetFilter: "Reset",
  3361. clearFilter: "All",
  3362. sumText: "Sum"
  3363. },
  3364. tree: {
  3365. emptyText: "No Data"
  3366. },
  3367. transfer: {
  3368. noMatch: "No matching data",
  3369. noData: "No data",
  3370. titles: ["List 1", "List 2"],
  3371. filterPlaceholder: "Enter keyword",
  3372. noCheckedFormat: "{total} items",
  3373. hasCheckedFormat: "{checked}/{total} checked"
  3374. },
  3375. image: {
  3376. error: "FAILED"
  3377. },
  3378. pageHeader: {
  3379. title: "Back"
  3380. },
  3381. popconfirm: {
  3382. confirmButtonText: "Yes",
  3383. cancelButtonText: "No"
  3384. }
  3385. }
  3386. };
  3387. const buildTranslator = (locale) => (path, option) => translate(path, option, unref(locale));
  3388. const translate = (path, option, locale) => get(locale, path, path).replace(/\{(\w+)\}/g, (_2, key) => {
  3389. var _a2;
  3390. return `${(_a2 = option == null ? void 0 : option[key]) != null ? _a2 : `{${key}}`}`;
  3391. });
  3392. const buildLocaleContext = (locale) => {
  3393. const lang = computed(() => unref(locale).name);
  3394. const localeRef = isRef(locale) ? locale : ref(locale);
  3395. return {
  3396. lang,
  3397. locale: localeRef,
  3398. t: buildTranslator(locale)
  3399. };
  3400. };
  3401. const useLocale = () => {
  3402. const locale = useGlobalConfig("locale");
  3403. return buildLocaleContext(computed(() => locale.value || English));
  3404. };
  3405. const useLockscreen = (trigger) => {
  3406. if (!isRef(trigger)) {
  3407. throwError("[useLockscreen]", "You need to pass a ref param to this function");
  3408. }
  3409. if (!isClient$1 || hasClass(document.body, "el-popup-parent--hidden")) {
  3410. return;
  3411. }
  3412. let scrollBarWidth2 = 0;
  3413. let withoutHiddenClass = false;
  3414. let bodyPaddingRight = "0";
  3415. let computedBodyPaddingRight = 0;
  3416. const cleanup = () => {
  3417. removeClass(document.body, "el-popup-parent--hidden");
  3418. if (withoutHiddenClass) {
  3419. document.body.style.paddingRight = bodyPaddingRight;
  3420. }
  3421. };
  3422. watch(trigger, (val) => {
  3423. if (!val) {
  3424. cleanup();
  3425. return;
  3426. }
  3427. withoutHiddenClass = !hasClass(document.body, "el-popup-parent--hidden");
  3428. if (withoutHiddenClass) {
  3429. bodyPaddingRight = document.body.style.paddingRight;
  3430. computedBodyPaddingRight = Number.parseInt(getStyle(document.body, "paddingRight"), 10);
  3431. }
  3432. scrollBarWidth2 = getScrollBarWidth();
  3433. const bodyHasOverflow = document.documentElement.clientHeight < document.body.scrollHeight;
  3434. const bodyOverflowY = getStyle(document.body, "overflowY");
  3435. if (scrollBarWidth2 > 0 && (bodyHasOverflow || bodyOverflowY === "scroll") && withoutHiddenClass) {
  3436. document.body.style.paddingRight = `${computedBodyPaddingRight + scrollBarWidth2}px`;
  3437. }
  3438. addClass(document.body, "el-popup-parent--hidden");
  3439. });
  3440. onScopeDispose(() => cleanup());
  3441. };
  3442. const modalStack = [];
  3443. const closeModal = (e) => {
  3444. if (modalStack.length === 0)
  3445. return;
  3446. if (e.code === EVENT_CODE.esc) {
  3447. e.stopPropagation();
  3448. const topModal = modalStack[modalStack.length - 1];
  3449. topModal.handleClose();
  3450. }
  3451. };
  3452. const useModal = (instance, visibleRef) => {
  3453. watch(visibleRef, (val) => {
  3454. if (val) {
  3455. modalStack.push(instance);
  3456. } else {
  3457. modalStack.splice(modalStack.indexOf(instance), 1);
  3458. }
  3459. });
  3460. };
  3461. if (isClient$1)
  3462. useEventListener(document, "keydown", closeModal);
  3463. const _prop = buildProp({
  3464. type: definePropType(Boolean),
  3465. default: null
  3466. });
  3467. const _event = buildProp({
  3468. type: definePropType(Function)
  3469. });
  3470. const createModelToggleComposable = (name) => {
  3471. const useModelToggleProps2 = {
  3472. [name]: _prop,
  3473. [`onUpdate:${name}`]: _event
  3474. };
  3475. const useModelToggleEmits2 = [`update:${name}`];
  3476. const useModelToggle2 = ({
  3477. indicator,
  3478. shouldHideWhenRouteChanges,
  3479. shouldProceed,
  3480. onShow,
  3481. onHide
  3482. }) => {
  3483. const instance = getCurrentInstance();
  3484. const props = instance.props;
  3485. const { emit } = instance;
  3486. const updateEventKey = `update:${name}`;
  3487. const hasUpdateHandler = computed(() => isFunction(props[`onUpdate:${name}`]));
  3488. const isModelBindingAbsent = computed(() => props[name] === null);
  3489. const doShow = () => {
  3490. if (indicator.value === true) {
  3491. return;
  3492. }
  3493. indicator.value = true;
  3494. if (isFunction(onShow)) {
  3495. onShow();
  3496. }
  3497. };
  3498. const doHide = () => {
  3499. if (indicator.value === false) {
  3500. return;
  3501. }
  3502. indicator.value = false;
  3503. if (isFunction(onHide)) {
  3504. onHide();
  3505. }
  3506. };
  3507. const show = () => {
  3508. if (props.disabled === true || isFunction(shouldProceed) && !shouldProceed())
  3509. return;
  3510. const shouldEmit = hasUpdateHandler.value && isClient$1;
  3511. if (shouldEmit) {
  3512. emit(updateEventKey, true);
  3513. }
  3514. if (isModelBindingAbsent.value || !shouldEmit) {
  3515. doShow();
  3516. }
  3517. };
  3518. const hide2 = () => {
  3519. if (props.disabled === true || !isClient$1)
  3520. return;
  3521. const shouldEmit = hasUpdateHandler.value && isClient$1;
  3522. if (shouldEmit) {
  3523. emit(updateEventKey, false);
  3524. }
  3525. if (isModelBindingAbsent.value || !shouldEmit) {
  3526. doHide();
  3527. }
  3528. };
  3529. const onChange = (val) => {
  3530. if (!isBoolean(val))
  3531. return;
  3532. if (props.disabled && val) {
  3533. if (hasUpdateHandler.value) {
  3534. emit(updateEventKey, false);
  3535. }
  3536. } else if (indicator.value !== val) {
  3537. if (val) {
  3538. doShow();
  3539. } else {
  3540. doHide();
  3541. }
  3542. }
  3543. };
  3544. const toggle = () => {
  3545. if (indicator.value) {
  3546. hide2();
  3547. } else {
  3548. show();
  3549. }
  3550. };
  3551. watch(() => props[name], onChange);
  3552. if (shouldHideWhenRouteChanges && instance.appContext.config.globalProperties.$route !== void 0) {
  3553. watch(() => __spreadValues({}, instance.proxy.$route), () => {
  3554. if (shouldHideWhenRouteChanges.value && indicator.value) {
  3555. hide2();
  3556. }
  3557. });
  3558. }
  3559. onMounted(() => {
  3560. onChange(props[name]);
  3561. });
  3562. return {
  3563. hide: hide2,
  3564. show,
  3565. toggle
  3566. };
  3567. };
  3568. return {
  3569. useModelToggle: useModelToggle2,
  3570. useModelToggleProps: useModelToggleProps2,
  3571. useModelToggleEmits: useModelToggleEmits2
  3572. };
  3573. };
  3574. const useRestoreActive = (toggle, initialFocus) => {
  3575. let previousActive;
  3576. watch(() => toggle.value, (val) => {
  3577. var _a2, _b2;
  3578. if (val) {
  3579. previousActive = document.activeElement;
  3580. if (isRef(initialFocus)) {
  3581. (_b2 = (_a2 = initialFocus.value).focus) == null ? void 0 : _b2.call(_a2);
  3582. }
  3583. } else {
  3584. {
  3585. previousActive.focus();
  3586. }
  3587. }
  3588. });
  3589. };
  3590. const useSameTarget = (handleClick) => {
  3591. if (!handleClick) {
  3592. return { onClick: NOOP, onMousedown: NOOP, onMouseup: NOOP };
  3593. }
  3594. let mousedownTarget = false;
  3595. let mouseupTarget = false;
  3596. const onClick = (e) => {
  3597. if (mousedownTarget && mouseupTarget) {
  3598. handleClick(e);
  3599. }
  3600. mousedownTarget = mouseupTarget = false;
  3601. };
  3602. const onMousedown = (e) => {
  3603. mousedownTarget = e.target === e.currentTarget;
  3604. };
  3605. const onMouseup = (e) => {
  3606. mouseupTarget = e.target === e.currentTarget;
  3607. };
  3608. return { onClick, onMousedown, onMouseup };
  3609. };
  3610. function useTimeout() {
  3611. let timeoutHandle;
  3612. const registerTimeout = (fn2, delay) => {
  3613. cancelTimeout();
  3614. timeoutHandle = window.setTimeout(fn2, delay);
  3615. };
  3616. const cancelTimeout = () => window.clearTimeout(timeoutHandle);
  3617. tryOnScopeDispose(() => cancelTimeout());
  3618. return {
  3619. registerTimeout,
  3620. cancelTimeout
  3621. };
  3622. }
  3623. const defaultIdInjection = {
  3624. prefix: Math.floor(Math.random() * 1e4),
  3625. current: 0
  3626. };
  3627. const ID_INJECTION_KEY = Symbol("elIdInjection");
  3628. const useId = (deterministicId) => {
  3629. const idInjection = inject(ID_INJECTION_KEY, defaultIdInjection);
  3630. const idRef = computed(() => unref(deterministicId) || `el-id-${idInjection.prefix}-${idInjection.current++}`);
  3631. return idRef;
  3632. };
  3633. const useEscapeKeydown = (handler3) => {
  3634. const cachedHandler = (e) => {
  3635. const event = e;
  3636. if (event.key === EVENT_CODE.esc) {
  3637. handler3 == null ? void 0 : handler3(event);
  3638. }
  3639. };
  3640. onMounted(() => {
  3641. on(document, "keydown", cachedHandler);
  3642. });
  3643. onBeforeUnmount(() => {
  3644. off(document, "keydown", cachedHandler);
  3645. });
  3646. };
  3647. let cachedContainer;
  3648. const POPPER_CONTAINER_ID = `el-popper-container-${generateId()}`;
  3649. const POPPER_CONTAINER_SELECTOR = `#${POPPER_CONTAINER_ID}`;
  3650. const createContainer = () => {
  3651. const container = document.createElement("div");
  3652. container.id = POPPER_CONTAINER_ID;
  3653. document.body.appendChild(container);
  3654. return container;
  3655. };
  3656. const usePopperContainer = () => {
  3657. onBeforeMount(() => {
  3658. if (!isClient$1)
  3659. return;
  3660. if (!cachedContainer || !document.body.querySelector(POPPER_CONTAINER_SELECTOR)) {
  3661. cachedContainer = createContainer();
  3662. }
  3663. });
  3664. };
  3665. const useDelayedToggleProps = buildProps({
  3666. showAfter: {
  3667. type: Number,
  3668. default: 0
  3669. },
  3670. hideAfter: {
  3671. type: Number,
  3672. default: 200
  3673. }
  3674. });
  3675. const useDelayedToggle = ({
  3676. showAfter,
  3677. hideAfter,
  3678. open,
  3679. close: close2
  3680. }) => {
  3681. const { registerTimeout } = useTimeout();
  3682. const onOpen = () => {
  3683. registerTimeout(() => {
  3684. open();
  3685. }, unref(showAfter));
  3686. };
  3687. const onClose = () => {
  3688. registerTimeout(() => {
  3689. close2();
  3690. }, unref(hideAfter));
  3691. };
  3692. return {
  3693. onOpen,
  3694. onClose
  3695. };
  3696. };
  3697. const FORWARD_REF_INJECTION_KEY = Symbol("elForwardRef");
  3698. const useForwardRef = (forwardRef) => {
  3699. const setForwardRef = (el) => {
  3700. forwardRef.value = el;
  3701. };
  3702. provide(FORWARD_REF_INJECTION_KEY, {
  3703. setForwardRef
  3704. });
  3705. };
  3706. const useForwardRefDirective = (setForwardRef) => {
  3707. return {
  3708. mounted(el) {
  3709. setForwardRef(el);
  3710. },
  3711. updated(el) {
  3712. setForwardRef(el);
  3713. },
  3714. unmounted() {
  3715. setForwardRef(null);
  3716. }
  3717. };
  3718. };
  3719. const defaultNamespace = "el";
  3720. const statePrefix = "is-";
  3721. const _bem = (namespace, block, blockSuffix, element, modifier) => {
  3722. let cls = `${namespace}-${block}`;
  3723. if (blockSuffix) {
  3724. cls += `-${blockSuffix}`;
  3725. }
  3726. if (element) {
  3727. cls += `__${element}`;
  3728. }
  3729. if (modifier) {
  3730. cls += `--${modifier}`;
  3731. }
  3732. return cls;
  3733. };
  3734. const useNamespace = (block) => {
  3735. const globalConfig2 = useGlobalConfig("namespace");
  3736. const namespace = computed(() => globalConfig2.value || defaultNamespace);
  3737. const b2 = (blockSuffix = "") => _bem(unref(namespace), block, blockSuffix, "", "");
  3738. const e = (element) => element ? _bem(unref(namespace), block, "", element, "") : "";
  3739. const m2 = (modifier) => modifier ? _bem(unref(namespace), block, "", "", modifier) : "";
  3740. const be = (blockSuffix, element) => blockSuffix && element ? _bem(unref(namespace), block, blockSuffix, element, "") : "";
  3741. const em = (element, modifier) => element && modifier ? _bem(unref(namespace), block, "", element, modifier) : "";
  3742. const bm = (blockSuffix, modifier) => blockSuffix && modifier ? _bem(unref(namespace), block, blockSuffix, "", modifier) : "";
  3743. const bem = (blockSuffix, element, modifier) => blockSuffix && element && modifier ? _bem(unref(namespace), block, blockSuffix, element, modifier) : "";
  3744. const is = (name, ...args) => {
  3745. const state = args.length >= 1 ? args[0] : true;
  3746. return name && state ? `${statePrefix}${name}` : "";
  3747. };
  3748. return {
  3749. namespace,
  3750. b: b2,
  3751. e,
  3752. m: m2,
  3753. be,
  3754. em,
  3755. bm,
  3756. bem,
  3757. is
  3758. };
  3759. };
  3760. const zIndex = ref(0);
  3761. const useZIndex = () => {
  3762. const initialZIndex = useGlobalConfig("zIndex", 2e3);
  3763. const currentZIndex = computed(() => initialZIndex.value + zIndex.value);
  3764. const nextZIndex = () => {
  3765. zIndex.value++;
  3766. return currentZIndex.value;
  3767. };
  3768. return {
  3769. initialZIndex,
  3770. currentZIndex,
  3771. nextZIndex
  3772. };
  3773. };
  3774. var _export_sfc$1 = (sfc, props) => {
  3775. const target = sfc.__vccOpts || sfc;
  3776. for (const [key, val] of props) {
  3777. target[key] = val;
  3778. }
  3779. return target;
  3780. };
  3781. const iconProps = buildProps({
  3782. size: {
  3783. type: definePropType([Number, String])
  3784. },
  3785. color: {
  3786. type: String
  3787. }
  3788. });
  3789. const __default__$l = {
  3790. name: "ElIcon",
  3791. inheritAttrs: false
  3792. };
  3793. const _sfc_main$15 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$l), {
  3794. props: iconProps,
  3795. setup(__props) {
  3796. const props = __props;
  3797. const ns = useNamespace("icon");
  3798. const style = computed(() => {
  3799. if (!props.size && !props.color)
  3800. return {};
  3801. return {
  3802. fontSize: isUndefined(props.size) ? void 0 : addUnit(props.size),
  3803. "--color": props.color
  3804. };
  3805. });
  3806. return (_ctx, _cache) => {
  3807. return openBlock(), createElementBlock("i", mergeProps({
  3808. class: unref(ns).b(),
  3809. style: unref(style)
  3810. }, _ctx.$attrs), [
  3811. renderSlot(_ctx.$slots, "default")
  3812. ], 16);
  3813. };
  3814. }
  3815. }));
  3816. var Icon = /* @__PURE__ */ _export_sfc$1(_sfc_main$15, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/icon/src/icon.vue"]]);
  3817. const ElIcon = withInstall(Icon);
  3818. let hiddenTextarea = void 0;
  3819. const HIDDEN_STYLE = `
  3820. height:0 !important;
  3821. visibility:hidden !important;
  3822. overflow:hidden !important;
  3823. position:absolute !important;
  3824. z-index:-1000 !important;
  3825. top:0 !important;
  3826. right:0 !important;
  3827. `;
  3828. const CONTEXT_STYLE = [
  3829. "letter-spacing",
  3830. "line-height",
  3831. "padding-top",
  3832. "padding-bottom",
  3833. "font-family",
  3834. "font-weight",
  3835. "font-size",
  3836. "text-rendering",
  3837. "text-transform",
  3838. "width",
  3839. "text-indent",
  3840. "padding-left",
  3841. "padding-right",
  3842. "border-width",
  3843. "box-sizing"
  3844. ];
  3845. function calculateNodeStyling(targetElement) {
  3846. const style = window.getComputedStyle(targetElement);
  3847. const boxSizing = style.getPropertyValue("box-sizing");
  3848. const paddingSize = Number.parseFloat(style.getPropertyValue("padding-bottom")) + Number.parseFloat(style.getPropertyValue("padding-top"));
  3849. const borderSize = Number.parseFloat(style.getPropertyValue("border-bottom-width")) + Number.parseFloat(style.getPropertyValue("border-top-width"));
  3850. const contextStyle = CONTEXT_STYLE.map((name) => `${name}:${style.getPropertyValue(name)}`).join(";");
  3851. return { contextStyle, paddingSize, borderSize, boxSizing };
  3852. }
  3853. function calcTextareaHeight(targetElement, minRows = 1, maxRows) {
  3854. var _a2;
  3855. if (!hiddenTextarea) {
  3856. hiddenTextarea = document.createElement("textarea");
  3857. document.body.appendChild(hiddenTextarea);
  3858. }
  3859. const { paddingSize, borderSize, boxSizing, contextStyle } = calculateNodeStyling(targetElement);
  3860. hiddenTextarea.setAttribute("style", `${contextStyle};${HIDDEN_STYLE}`);
  3861. hiddenTextarea.value = targetElement.value || targetElement.placeholder || "";
  3862. let height = hiddenTextarea.scrollHeight;
  3863. const result = {};
  3864. if (boxSizing === "border-box") {
  3865. height = height + borderSize;
  3866. } else if (boxSizing === "content-box") {
  3867. height = height - paddingSize;
  3868. }
  3869. hiddenTextarea.value = "";
  3870. const singleRowHeight = hiddenTextarea.scrollHeight - paddingSize;
  3871. if (isNumber(minRows)) {
  3872. let minHeight = singleRowHeight * minRows;
  3873. if (boxSizing === "border-box") {
  3874. minHeight = minHeight + paddingSize + borderSize;
  3875. }
  3876. height = Math.max(minHeight, height);
  3877. result.minHeight = `${minHeight}px`;
  3878. }
  3879. if (isNumber(maxRows)) {
  3880. let maxHeight = singleRowHeight * maxRows;
  3881. if (boxSizing === "border-box") {
  3882. maxHeight = maxHeight + paddingSize + borderSize;
  3883. }
  3884. height = Math.min(maxHeight, height);
  3885. }
  3886. result.height = `${height}px`;
  3887. (_a2 = hiddenTextarea.parentNode) == null ? void 0 : _a2.removeChild(hiddenTextarea);
  3888. hiddenTextarea = void 0;
  3889. return result;
  3890. }
  3891. const inputProps = buildProps({
  3892. size: useSizeProp,
  3893. disabled: Boolean,
  3894. modelValue: {
  3895. type: definePropType([
  3896. String,
  3897. Number,
  3898. Object
  3899. ]),
  3900. default: ""
  3901. },
  3902. type: {
  3903. type: String,
  3904. default: "text"
  3905. },
  3906. resize: {
  3907. type: String,
  3908. values: ["none", "both", "horizontal", "vertical"]
  3909. },
  3910. autosize: {
  3911. type: definePropType([Boolean, Object]),
  3912. default: false
  3913. },
  3914. autocomplete: {
  3915. type: String,
  3916. default: "off"
  3917. },
  3918. placeholder: {
  3919. type: String
  3920. },
  3921. form: {
  3922. type: String,
  3923. default: ""
  3924. },
  3925. readonly: {
  3926. type: Boolean,
  3927. default: false
  3928. },
  3929. clearable: {
  3930. type: Boolean,
  3931. default: false
  3932. },
  3933. showPassword: {
  3934. type: Boolean,
  3935. default: false
  3936. },
  3937. showWordLimit: {
  3938. type: Boolean,
  3939. default: false
  3940. },
  3941. suffixIcon: {
  3942. type: iconPropType,
  3943. default: ""
  3944. },
  3945. prefixIcon: {
  3946. type: iconPropType,
  3947. default: ""
  3948. },
  3949. label: {
  3950. type: String
  3951. },
  3952. tabindex: {
  3953. type: [Number, String]
  3954. },
  3955. validateEvent: {
  3956. type: Boolean,
  3957. default: true
  3958. },
  3959. inputStyle: {
  3960. type: definePropType([Object, Array, String]),
  3961. default: () => mutable({})
  3962. }
  3963. });
  3964. const inputEmits = {
  3965. [UPDATE_MODEL_EVENT]: (value) => isString(value),
  3966. input: (value) => isString(value),
  3967. change: (value) => isString(value),
  3968. focus: (evt) => evt instanceof FocusEvent,
  3969. blur: (evt) => evt instanceof FocusEvent,
  3970. clear: () => true,
  3971. mouseleave: (evt) => evt instanceof MouseEvent,
  3972. mouseenter: (evt) => evt instanceof MouseEvent,
  3973. keydown: (evt) => evt instanceof Event,
  3974. compositionstart: (evt) => evt instanceof CompositionEvent,
  3975. compositionupdate: (evt) => evt instanceof CompositionEvent,
  3976. compositionend: (evt) => evt instanceof CompositionEvent
  3977. };
  3978. const _hoisted_1$C = ["type", "disabled", "readonly", "autocomplete", "tabindex", "aria-label", "placeholder"];
  3979. const _hoisted_2$t = ["tabindex", "disabled", "readonly", "autocomplete", "aria-label", "placeholder"];
  3980. const __default__$k = {
  3981. name: "ElInput",
  3982. inheritAttrs: false
  3983. };
  3984. const _sfc_main$14 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$k), {
  3985. props: inputProps,
  3986. emits: inputEmits,
  3987. setup(__props, { expose, emit }) {
  3988. const props = __props;
  3989. const PENDANT_MAP = {
  3990. suffix: "append",
  3991. prefix: "prepend"
  3992. };
  3993. const instance = getCurrentInstance();
  3994. const rawAttrs = useAttrs$1();
  3995. const slots = useSlots();
  3996. const attrs = useAttrs();
  3997. const { form, formItem } = useFormItem();
  3998. const inputSize = useSize();
  3999. const inputDisabled = useDisabled$1();
  4000. const nsInput = useNamespace("input");
  4001. const nsTextarea = useNamespace("textarea");
  4002. const input = shallowRef();
  4003. const textarea = shallowRef();
  4004. const focused = ref(false);
  4005. const hovering = ref(false);
  4006. const isComposing = ref(false);
  4007. const passwordVisible = ref(false);
  4008. const textareaCalcStyle = shallowRef(props.inputStyle);
  4009. const _ref = computed(() => input.value || textarea.value);
  4010. const needStatusIcon = computed(() => {
  4011. var _a2;
  4012. return (_a2 = form == null ? void 0 : form.statusIcon) != null ? _a2 : false;
  4013. });
  4014. const validateState = computed(() => (formItem == null ? void 0 : formItem.validateState) || "");
  4015. const validateIcon = computed(() => ValidateComponentsMap[validateState.value]);
  4016. const passwordIcon = computed(() => passwordVisible.value ? view : hide$2);
  4017. const containerStyle = computed(() => [
  4018. rawAttrs.style,
  4019. props.inputStyle
  4020. ]);
  4021. const textareaStyle = computed(() => [
  4022. props.inputStyle,
  4023. textareaCalcStyle.value,
  4024. { resize: props.resize }
  4025. ]);
  4026. const nativeInputValue = computed(() => isNil(props.modelValue) ? "" : String(props.modelValue));
  4027. const showClear = computed(() => props.clearable && !inputDisabled.value && !props.readonly && !!nativeInputValue.value && (focused.value || hovering.value));
  4028. const showPwdVisible = computed(() => props.showPassword && !inputDisabled.value && !props.readonly && (!!nativeInputValue.value || focused.value));
  4029. const isWordLimitVisible = computed(() => props.showWordLimit && !!attrs.value.maxlength && (props.type === "text" || props.type === "textarea") && !inputDisabled.value && !props.readonly && !props.showPassword);
  4030. const textLength = computed(() => Array.from(nativeInputValue.value).length);
  4031. const inputExceed = computed(() => !!isWordLimitVisible.value && textLength.value > Number(attrs.value.maxlength));
  4032. const suffixVisible = computed(() => !!slots.suffix || !!props.suffixIcon || showClear.value || props.showPassword || isWordLimitVisible.value || !!validateState.value && needStatusIcon.value);
  4033. const resizeTextarea = () => {
  4034. const { type: type4, autosize } = props;
  4035. if (!isClient$1 || type4 !== "textarea")
  4036. return;
  4037. if (autosize) {
  4038. const minRows = isObject$1(autosize) ? autosize.minRows : void 0;
  4039. const maxRows = isObject$1(autosize) ? autosize.maxRows : void 0;
  4040. textareaCalcStyle.value = __spreadValues({}, calcTextareaHeight(textarea.value, minRows, maxRows));
  4041. } else {
  4042. textareaCalcStyle.value = {
  4043. minHeight: calcTextareaHeight(textarea.value).minHeight
  4044. };
  4045. }
  4046. };
  4047. const setNativeInputValue = () => {
  4048. const input2 = _ref.value;
  4049. if (!input2 || input2.value === nativeInputValue.value)
  4050. return;
  4051. input2.value = nativeInputValue.value;
  4052. };
  4053. const calcIconOffset = (place) => {
  4054. const { el } = instance.vnode;
  4055. if (!el)
  4056. return;
  4057. const elList = Array.from(el.querySelectorAll(`.${nsInput.e(place)}`));
  4058. const target = elList.find((item) => item.parentNode === el);
  4059. if (!target)
  4060. return;
  4061. const pendant = PENDANT_MAP[place];
  4062. if (slots[pendant]) {
  4063. target.style.transform = `translateX(${place === "suffix" ? "-" : ""}${el.querySelector(`.${nsInput.be("group", pendant)}`).offsetWidth}px)`;
  4064. } else {
  4065. target.removeAttribute("style");
  4066. }
  4067. };
  4068. const updateIconOffset = () => {
  4069. calcIconOffset("prefix");
  4070. calcIconOffset("suffix");
  4071. };
  4072. const handleInput = async (event) => {
  4073. const { value } = event.target;
  4074. if (isComposing.value)
  4075. return;
  4076. if (value === nativeInputValue.value)
  4077. return;
  4078. emit(UPDATE_MODEL_EVENT, value);
  4079. emit("input", value);
  4080. await nextTick();
  4081. setNativeInputValue();
  4082. };
  4083. const handleChange2 = (event) => {
  4084. emit("change", event.target.value);
  4085. };
  4086. const handleCompositionStart = (event) => {
  4087. emit("compositionstart", event);
  4088. isComposing.value = true;
  4089. };
  4090. const handleCompositionUpdate = (event) => {
  4091. var _a2;
  4092. emit("compositionupdate", event);
  4093. const text = (_a2 = event.target) == null ? void 0 : _a2.value;
  4094. const lastCharacter = text[text.length - 1] || "";
  4095. isComposing.value = !isKorean(lastCharacter);
  4096. };
  4097. const handleCompositionEnd = (event) => {
  4098. emit("compositionend", event);
  4099. if (isComposing.value) {
  4100. isComposing.value = false;
  4101. handleInput(event);
  4102. }
  4103. };
  4104. const handlePasswordVisible = () => {
  4105. passwordVisible.value = !passwordVisible.value;
  4106. focus();
  4107. };
  4108. const focus = async () => {
  4109. var _a2;
  4110. await nextTick();
  4111. (_a2 = _ref.value) == null ? void 0 : _a2.focus();
  4112. };
  4113. const blur = () => {
  4114. var _a2;
  4115. return (_a2 = _ref.value) == null ? void 0 : _a2.blur();
  4116. };
  4117. const handleFocus = (event) => {
  4118. focused.value = true;
  4119. emit("focus", event);
  4120. };
  4121. const handleBlur = (event) => {
  4122. var _a2;
  4123. focused.value = false;
  4124. emit("blur", event);
  4125. if (props.validateEvent) {
  4126. (_a2 = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a2.call(formItem, "blur").catch((err) => debugWarn());
  4127. }
  4128. };
  4129. const handleMouseLeave = (evt) => {
  4130. hovering.value = false;
  4131. emit("mouseleave", evt);
  4132. };
  4133. const handleMouseEnter = (evt) => {
  4134. hovering.value = true;
  4135. emit("mouseenter", evt);
  4136. };
  4137. const handleKeydown = (evt) => {
  4138. emit("keydown", evt);
  4139. };
  4140. const select = () => {
  4141. var _a2;
  4142. (_a2 = _ref.value) == null ? void 0 : _a2.select();
  4143. };
  4144. const clear = () => {
  4145. emit(UPDATE_MODEL_EVENT, "");
  4146. emit("change", "");
  4147. emit("clear");
  4148. emit("input", "");
  4149. };
  4150. watch(() => props.modelValue, () => {
  4151. var _a2;
  4152. nextTick(() => resizeTextarea());
  4153. if (props.validateEvent) {
  4154. (_a2 = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a2.call(formItem, "change").catch((err) => debugWarn());
  4155. }
  4156. });
  4157. watch(nativeInputValue, () => setNativeInputValue());
  4158. watch(() => props.type, async () => {
  4159. await nextTick();
  4160. setNativeInputValue();
  4161. resizeTextarea();
  4162. updateIconOffset();
  4163. });
  4164. onMounted(async () => {
  4165. setNativeInputValue();
  4166. updateIconOffset();
  4167. await nextTick();
  4168. resizeTextarea();
  4169. });
  4170. onUpdated(async () => {
  4171. await nextTick();
  4172. updateIconOffset();
  4173. });
  4174. expose({
  4175. input,
  4176. textarea,
  4177. ref: _ref,
  4178. textareaStyle,
  4179. autosize: toRef(props, "autosize"),
  4180. focus,
  4181. blur,
  4182. select,
  4183. clear,
  4184. resizeTextarea
  4185. });
  4186. return (_ctx, _cache) => {
  4187. return withDirectives((openBlock(), createElementBlock("div", {
  4188. class: normalizeClass([
  4189. _ctx.type === "textarea" ? unref(nsTextarea).b() : unref(nsInput).b(),
  4190. unref(nsInput).m(unref(inputSize)),
  4191. unref(nsInput).is("disabled", unref(inputDisabled)),
  4192. unref(nsInput).is("exceed", unref(inputExceed)),
  4193. {
  4194. [unref(nsInput).b("group")]: _ctx.$slots.prepend || _ctx.$slots.append,
  4195. [unref(nsInput).bm("group", "append")]: _ctx.$slots.append,
  4196. [unref(nsInput).bm("group", "prepend")]: _ctx.$slots.prepend,
  4197. [unref(nsInput).m("prefix")]: _ctx.$slots.prefix || _ctx.prefixIcon,
  4198. [unref(nsInput).m("suffix")]: _ctx.$slots.suffix || _ctx.suffixIcon || _ctx.clearable || _ctx.showPassword,
  4199. [unref(nsInput).bm("suffix", "password-clear")]: unref(showClear) && unref(showPwdVisible)
  4200. },
  4201. _ctx.$attrs.class
  4202. ]),
  4203. style: normalizeStyle(unref(containerStyle)),
  4204. onMouseenter: handleMouseEnter,
  4205. onMouseleave: handleMouseLeave
  4206. }, [
  4207. createCommentVNode(" input "),
  4208. _ctx.type !== "textarea" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  4209. createCommentVNode(" prepend slot "),
  4210. _ctx.$slots.prepend ? (openBlock(), createElementBlock("div", {
  4211. key: 0,
  4212. class: normalizeClass(unref(nsInput).be("group", "prepend"))
  4213. }, [
  4214. renderSlot(_ctx.$slots, "prepend")
  4215. ], 2)) : createCommentVNode("v-if", true),
  4216. createElementVNode("div", {
  4217. class: normalizeClass([unref(nsInput).e("wrapper"), unref(nsInput).is("focus", focused.value)])
  4218. }, [
  4219. createCommentVNode(" prefix slot "),
  4220. _ctx.$slots.prefix || _ctx.prefixIcon ? (openBlock(), createElementBlock("span", {
  4221. key: 0,
  4222. class: normalizeClass(unref(nsInput).e("prefix"))
  4223. }, [
  4224. createElementVNode("span", {
  4225. class: normalizeClass(unref(nsInput).e("prefix-inner"))
  4226. }, [
  4227. renderSlot(_ctx.$slots, "prefix"),
  4228. _ctx.prefixIcon ? (openBlock(), createBlock(unref(ElIcon), {
  4229. key: 0,
  4230. class: normalizeClass(unref(nsInput).e("icon"))
  4231. }, {
  4232. default: withCtx(() => [
  4233. (openBlock(), createBlock(resolveDynamicComponent(_ctx.prefixIcon)))
  4234. ]),
  4235. _: 1
  4236. }, 8, ["class"])) : createCommentVNode("v-if", true)
  4237. ], 2)
  4238. ], 2)) : createCommentVNode("v-if", true),
  4239. createElementVNode("input", mergeProps({
  4240. ref_key: "input",
  4241. ref: input,
  4242. class: unref(nsInput).e("inner")
  4243. }, unref(attrs), {
  4244. type: _ctx.showPassword ? passwordVisible.value ? "text" : "password" : _ctx.type,
  4245. disabled: unref(inputDisabled),
  4246. readonly: _ctx.readonly,
  4247. autocomplete: _ctx.autocomplete,
  4248. tabindex: _ctx.tabindex,
  4249. "aria-label": _ctx.label,
  4250. placeholder: _ctx.placeholder,
  4251. style: _ctx.inputStyle,
  4252. onCompositionstart: handleCompositionStart,
  4253. onCompositionupdate: handleCompositionUpdate,
  4254. onCompositionend: handleCompositionEnd,
  4255. onInput: handleInput,
  4256. onFocus: handleFocus,
  4257. onBlur: handleBlur,
  4258. onChange: handleChange2,
  4259. onKeydown: handleKeydown
  4260. }), null, 16, _hoisted_1$C),
  4261. createCommentVNode(" suffix slot "),
  4262. unref(suffixVisible) ? (openBlock(), createElementBlock("span", {
  4263. key: 1,
  4264. class: normalizeClass(unref(nsInput).e("suffix"))
  4265. }, [
  4266. createElementVNode("span", {
  4267. class: normalizeClass(unref(nsInput).e("suffix-inner"))
  4268. }, [
  4269. !unref(showClear) || !unref(showPwdVisible) || !unref(isWordLimitVisible) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  4270. renderSlot(_ctx.$slots, "suffix"),
  4271. _ctx.suffixIcon ? (openBlock(), createBlock(unref(ElIcon), {
  4272. key: 0,
  4273. class: normalizeClass(unref(nsInput).e("icon"))
  4274. }, {
  4275. default: withCtx(() => [
  4276. (openBlock(), createBlock(resolveDynamicComponent(_ctx.suffixIcon)))
  4277. ]),
  4278. _: 1
  4279. }, 8, ["class"])) : createCommentVNode("v-if", true)
  4280. ], 64)) : createCommentVNode("v-if", true),
  4281. unref(showClear) ? (openBlock(), createBlock(unref(ElIcon), {
  4282. key: 1,
  4283. class: normalizeClass([unref(nsInput).e("icon"), unref(nsInput).e("clear")]),
  4284. onMousedown: _cache[0] || (_cache[0] = withModifiers(() => {
  4285. }, ["prevent"])),
  4286. onClick: clear
  4287. }, {
  4288. default: withCtx(() => [
  4289. createVNode(unref(circleClose))
  4290. ]),
  4291. _: 1
  4292. }, 8, ["class"])) : createCommentVNode("v-if", true),
  4293. unref(showPwdVisible) ? (openBlock(), createBlock(unref(ElIcon), {
  4294. key: 2,
  4295. class: normalizeClass([unref(nsInput).e("icon"), unref(nsInput).e("password")]),
  4296. onClick: handlePasswordVisible
  4297. }, {
  4298. default: withCtx(() => [
  4299. (openBlock(), createBlock(resolveDynamicComponent(unref(passwordIcon))))
  4300. ]),
  4301. _: 1
  4302. }, 8, ["class"])) : createCommentVNode("v-if", true),
  4303. unref(isWordLimitVisible) ? (openBlock(), createElementBlock("span", {
  4304. key: 3,
  4305. class: normalizeClass(unref(nsInput).e("count"))
  4306. }, [
  4307. createElementVNode("span", {
  4308. class: normalizeClass(unref(nsInput).e("count-inner"))
  4309. }, toDisplayString(unref(textLength)) + " / " + toDisplayString(unref(attrs).maxlength), 3)
  4310. ], 2)) : createCommentVNode("v-if", true)
  4311. ], 2),
  4312. unref(validateState) && unref(validateIcon) && unref(needStatusIcon) ? (openBlock(), createBlock(unref(ElIcon), {
  4313. key: 0,
  4314. class: normalizeClass([
  4315. unref(nsInput).e("icon"),
  4316. unref(nsInput).e("validateIcon"),
  4317. unref(nsInput).is("loading", unref(validateState) === "validating")
  4318. ])
  4319. }, {
  4320. default: withCtx(() => [
  4321. (openBlock(), createBlock(resolveDynamicComponent(unref(validateIcon))))
  4322. ]),
  4323. _: 1
  4324. }, 8, ["class"])) : createCommentVNode("v-if", true)
  4325. ], 2)) : createCommentVNode("v-if", true)
  4326. ], 2),
  4327. createCommentVNode(" append slot "),
  4328. _ctx.$slots.append ? (openBlock(), createElementBlock("div", {
  4329. key: 1,
  4330. class: normalizeClass(unref(nsInput).be("group", "append"))
  4331. }, [
  4332. renderSlot(_ctx.$slots, "append")
  4333. ], 2)) : createCommentVNode("v-if", true)
  4334. ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  4335. createCommentVNode(" textarea "),
  4336. createElementVNode("textarea", mergeProps({
  4337. ref_key: "textarea",
  4338. ref: textarea,
  4339. class: unref(nsTextarea).e("inner")
  4340. }, unref(attrs), {
  4341. tabindex: _ctx.tabindex,
  4342. disabled: unref(inputDisabled),
  4343. readonly: _ctx.readonly,
  4344. autocomplete: _ctx.autocomplete,
  4345. style: unref(textareaStyle),
  4346. "aria-label": _ctx.label,
  4347. placeholder: _ctx.placeholder,
  4348. onCompositionstart: handleCompositionStart,
  4349. onCompositionupdate: handleCompositionUpdate,
  4350. onCompositionend: handleCompositionEnd,
  4351. onInput: handleInput,
  4352. onFocus: handleFocus,
  4353. onBlur: handleBlur,
  4354. onChange: handleChange2,
  4355. onKeydown: handleKeydown
  4356. }), null, 16, _hoisted_2$t),
  4357. unref(isWordLimitVisible) ? (openBlock(), createElementBlock("span", {
  4358. key: 0,
  4359. class: normalizeClass(unref(nsInput).e("count"))
  4360. }, toDisplayString(unref(textLength)) + " / " + toDisplayString(unref(attrs).maxlength), 3)) : createCommentVNode("v-if", true)
  4361. ], 64))
  4362. ], 38)), [
  4363. [vShow, _ctx.type !== "hidden"]
  4364. ]);
  4365. };
  4366. }
  4367. }));
  4368. var Input = /* @__PURE__ */ _export_sfc$1(_sfc_main$14, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/input/src/input.vue"]]);
  4369. const ElInput = withInstall(Input);
  4370. const BAR_MAP = {
  4371. vertical: {
  4372. offset: "offsetHeight",
  4373. scroll: "scrollTop",
  4374. scrollSize: "scrollHeight",
  4375. size: "height",
  4376. key: "vertical",
  4377. axis: "Y",
  4378. client: "clientY",
  4379. direction: "top"
  4380. },
  4381. horizontal: {
  4382. offset: "offsetWidth",
  4383. scroll: "scrollLeft",
  4384. scrollSize: "scrollWidth",
  4385. size: "width",
  4386. key: "horizontal",
  4387. axis: "X",
  4388. client: "clientX",
  4389. direction: "left"
  4390. }
  4391. };
  4392. const renderThumbStyle = ({ move, size, bar }) => ({
  4393. [bar.size]: size,
  4394. transform: `translate${bar.axis}(${move}%)`
  4395. });
  4396. const thumbProps = buildProps({
  4397. vertical: Boolean,
  4398. size: String,
  4399. move: Number,
  4400. ratio: {
  4401. type: Number,
  4402. required: true
  4403. },
  4404. always: Boolean
  4405. });
  4406. const COMPONENT_NAME$4 = "Thumb";
  4407. const _sfc_main$13 = defineComponent({
  4408. name: COMPONENT_NAME$4,
  4409. props: thumbProps,
  4410. setup(props) {
  4411. const scrollbar = inject(scrollbarContextKey);
  4412. const ns = useNamespace("scrollbar");
  4413. if (!scrollbar)
  4414. throwError(COMPONENT_NAME$4, "can not inject scrollbar context");
  4415. const instance = ref();
  4416. const thumb = ref();
  4417. const thumbState = ref({});
  4418. const visible = ref(false);
  4419. let cursorDown = false;
  4420. let cursorLeave = false;
  4421. let originalOnSelectStart = isClient$1 ? document.onselectstart : null;
  4422. const bar = computed(() => BAR_MAP[props.vertical ? "vertical" : "horizontal"]);
  4423. const thumbStyle = computed(() => renderThumbStyle({
  4424. size: props.size,
  4425. move: props.move,
  4426. bar: bar.value
  4427. }));
  4428. const offsetRatio = computed(() => instance.value[bar.value.offset] ** 2 / scrollbar.wrapElement[bar.value.scrollSize] / props.ratio / thumb.value[bar.value.offset]);
  4429. const clickThumbHandler = (e) => {
  4430. var _a2;
  4431. e.stopPropagation();
  4432. if (e.ctrlKey || [1, 2].includes(e.button))
  4433. return;
  4434. (_a2 = window.getSelection()) == null ? void 0 : _a2.removeAllRanges();
  4435. startDrag(e);
  4436. const el = e.currentTarget;
  4437. if (!el)
  4438. return;
  4439. thumbState.value[bar.value.axis] = el[bar.value.offset] - (e[bar.value.client] - el.getBoundingClientRect()[bar.value.direction]);
  4440. };
  4441. const clickTrackHandler = (e) => {
  4442. if (!thumb.value || !instance.value || !scrollbar.wrapElement)
  4443. return;
  4444. const offset2 = Math.abs(e.target.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]);
  4445. const thumbHalf = thumb.value[bar.value.offset] / 2;
  4446. const thumbPositionPercentage = (offset2 - thumbHalf) * 100 * offsetRatio.value / instance.value[bar.value.offset];
  4447. scrollbar.wrapElement[bar.value.scroll] = thumbPositionPercentage * scrollbar.wrapElement[bar.value.scrollSize] / 100;
  4448. };
  4449. const startDrag = (e) => {
  4450. e.stopImmediatePropagation();
  4451. cursorDown = true;
  4452. document.addEventListener("mousemove", mouseMoveDocumentHandler);
  4453. document.addEventListener("mouseup", mouseUpDocumentHandler);
  4454. originalOnSelectStart = document.onselectstart;
  4455. document.onselectstart = () => false;
  4456. };
  4457. const mouseMoveDocumentHandler = (e) => {
  4458. if (!instance.value || !thumb.value)
  4459. return;
  4460. if (cursorDown === false)
  4461. return;
  4462. const prevPage = thumbState.value[bar.value.axis];
  4463. if (!prevPage)
  4464. return;
  4465. const offset2 = (instance.value.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]) * -1;
  4466. const thumbClickPosition = thumb.value[bar.value.offset] - prevPage;
  4467. const thumbPositionPercentage = (offset2 - thumbClickPosition) * 100 * offsetRatio.value / instance.value[bar.value.offset];
  4468. scrollbar.wrapElement[bar.value.scroll] = thumbPositionPercentage * scrollbar.wrapElement[bar.value.scrollSize] / 100;
  4469. };
  4470. const mouseUpDocumentHandler = () => {
  4471. cursorDown = false;
  4472. thumbState.value[bar.value.axis] = 0;
  4473. document.removeEventListener("mousemove", mouseMoveDocumentHandler);
  4474. document.removeEventListener("mouseup", mouseUpDocumentHandler);
  4475. restoreOnselectstart();
  4476. if (cursorLeave)
  4477. visible.value = false;
  4478. };
  4479. const mouseMoveScrollbarHandler = () => {
  4480. cursorLeave = false;
  4481. visible.value = !!props.size;
  4482. };
  4483. const mouseLeaveScrollbarHandler = () => {
  4484. cursorLeave = true;
  4485. visible.value = cursorDown;
  4486. };
  4487. onBeforeUnmount(() => {
  4488. restoreOnselectstart();
  4489. document.removeEventListener("mouseup", mouseUpDocumentHandler);
  4490. });
  4491. const restoreOnselectstart = () => {
  4492. if (document.onselectstart !== originalOnSelectStart)
  4493. document.onselectstart = originalOnSelectStart;
  4494. };
  4495. useEventListener(toRef(scrollbar, "scrollbarElement"), "mousemove", mouseMoveScrollbarHandler);
  4496. useEventListener(toRef(scrollbar, "scrollbarElement"), "mouseleave", mouseLeaveScrollbarHandler);
  4497. return {
  4498. ns,
  4499. instance,
  4500. thumb,
  4501. bar,
  4502. thumbStyle,
  4503. visible,
  4504. clickTrackHandler,
  4505. clickThumbHandler
  4506. };
  4507. }
  4508. });
  4509. function _sfc_render$D(_ctx, _cache, $props, $setup, $data, $options) {
  4510. return openBlock(), createBlock(Transition, {
  4511. name: _ctx.ns.b("fade")
  4512. }, {
  4513. default: withCtx(() => [
  4514. withDirectives(createElementVNode("div", {
  4515. ref: "instance",
  4516. class: normalizeClass([_ctx.ns.e("bar"), _ctx.ns.is(_ctx.bar.key)]),
  4517. onMousedown: _cache[1] || (_cache[1] = (...args) => _ctx.clickTrackHandler && _ctx.clickTrackHandler(...args))
  4518. }, [
  4519. createElementVNode("div", {
  4520. ref: "thumb",
  4521. class: normalizeClass(_ctx.ns.e("thumb")),
  4522. style: normalizeStyle(_ctx.thumbStyle),
  4523. onMousedown: _cache[0] || (_cache[0] = (...args) => _ctx.clickThumbHandler && _ctx.clickThumbHandler(...args))
  4524. }, null, 38)
  4525. ], 34), [
  4526. [vShow, _ctx.always || _ctx.visible]
  4527. ])
  4528. ]),
  4529. _: 1
  4530. }, 8, ["name"]);
  4531. }
  4532. var Thumb = /* @__PURE__ */ _export_sfc$1(_sfc_main$13, [["render", _sfc_render$D], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/scrollbar/src/thumb.vue"]]);
  4533. const barProps = buildProps({
  4534. always: {
  4535. type: Boolean,
  4536. default: true
  4537. },
  4538. width: {
  4539. type: String,
  4540. default: ""
  4541. },
  4542. height: {
  4543. type: String,
  4544. default: ""
  4545. },
  4546. ratioX: {
  4547. type: Number,
  4548. default: 1
  4549. },
  4550. ratioY: {
  4551. type: Number,
  4552. default: 1
  4553. }
  4554. });
  4555. const _sfc_main$12 = defineComponent({
  4556. components: {
  4557. Thumb
  4558. },
  4559. props: barProps,
  4560. setup(props) {
  4561. const moveX = ref(0);
  4562. const moveY = ref(0);
  4563. const GAP = 4;
  4564. const handleScroll = (wrap) => {
  4565. if (wrap) {
  4566. const offsetHeight = wrap.offsetHeight - GAP;
  4567. const offsetWidth = wrap.offsetWidth - GAP;
  4568. moveY.value = wrap.scrollTop * 100 / offsetHeight * props.ratioY;
  4569. moveX.value = wrap.scrollLeft * 100 / offsetWidth * props.ratioX;
  4570. }
  4571. };
  4572. return {
  4573. handleScroll,
  4574. moveX,
  4575. moveY
  4576. };
  4577. }
  4578. });
  4579. function _sfc_render$C(_ctx, _cache, $props, $setup, $data, $options) {
  4580. const _component_thumb = resolveComponent("thumb");
  4581. return openBlock(), createElementBlock(Fragment, null, [
  4582. createVNode(_component_thumb, {
  4583. move: _ctx.moveX,
  4584. ratio: _ctx.ratioX,
  4585. size: _ctx.width,
  4586. always: _ctx.always
  4587. }, null, 8, ["move", "ratio", "size", "always"]),
  4588. createVNode(_component_thumb, {
  4589. move: _ctx.moveY,
  4590. ratio: _ctx.ratioY,
  4591. size: _ctx.height,
  4592. vertical: "",
  4593. always: _ctx.always
  4594. }, null, 8, ["move", "ratio", "size", "always"])
  4595. ], 64);
  4596. }
  4597. var Bar = /* @__PURE__ */ _export_sfc$1(_sfc_main$12, [["render", _sfc_render$C], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/scrollbar/src/bar.vue"]]);
  4598. const scrollbarProps = buildProps({
  4599. height: {
  4600. type: [String, Number],
  4601. default: ""
  4602. },
  4603. maxHeight: {
  4604. type: [String, Number],
  4605. default: ""
  4606. },
  4607. native: {
  4608. type: Boolean,
  4609. default: false
  4610. },
  4611. wrapStyle: {
  4612. type: definePropType([String, Object, Array]),
  4613. default: ""
  4614. },
  4615. wrapClass: {
  4616. type: [String, Array],
  4617. default: ""
  4618. },
  4619. viewClass: {
  4620. type: [String, Array],
  4621. default: ""
  4622. },
  4623. viewStyle: {
  4624. type: [String, Array, Object],
  4625. default: ""
  4626. },
  4627. noresize: Boolean,
  4628. tag: {
  4629. type: String,
  4630. default: "div"
  4631. },
  4632. always: {
  4633. type: Boolean,
  4634. default: false
  4635. },
  4636. minSize: {
  4637. type: Number,
  4638. default: 20
  4639. }
  4640. });
  4641. const scrollbarEmits = {
  4642. scroll: ({
  4643. scrollTop,
  4644. scrollLeft
  4645. }) => isNumber(scrollTop) && isNumber(scrollLeft)
  4646. };
  4647. const _sfc_main$11 = defineComponent({
  4648. name: "ElScrollbar",
  4649. components: {
  4650. Bar
  4651. },
  4652. props: scrollbarProps,
  4653. emits: scrollbarEmits,
  4654. setup(props, { emit }) {
  4655. const ns = useNamespace("scrollbar");
  4656. let stopResizeObserver = void 0;
  4657. let stopResizeListener = void 0;
  4658. const scrollbar$ = ref();
  4659. const wrap$ = ref();
  4660. const resize$ = ref();
  4661. const sizeWidth = ref("0");
  4662. const sizeHeight = ref("0");
  4663. const barRef = ref();
  4664. const moveX = ref(0);
  4665. const moveY = ref(0);
  4666. const ratioY = ref(1);
  4667. const ratioX = ref(1);
  4668. const GAP = 4;
  4669. const style = computed(() => {
  4670. const style2 = {};
  4671. if (props.height)
  4672. style2.height = addUnit(props.height);
  4673. if (props.maxHeight)
  4674. style2.maxHeight = addUnit(props.maxHeight);
  4675. return [props.wrapStyle, style2];
  4676. });
  4677. const handleScroll = () => {
  4678. var _a2;
  4679. if (wrap$.value) {
  4680. (_a2 = barRef.value) == null ? void 0 : _a2.handleScroll(wrap$.value);
  4681. emit("scroll", {
  4682. scrollTop: wrap$.value.scrollTop,
  4683. scrollLeft: wrap$.value.scrollLeft
  4684. });
  4685. }
  4686. };
  4687. function scrollTo(arg1, arg2) {
  4688. if (isObject$1(arg1)) {
  4689. wrap$.value.scrollTo(arg1);
  4690. } else if (isNumber(arg1) && isNumber(arg2)) {
  4691. wrap$.value.scrollTo(arg1, arg2);
  4692. }
  4693. }
  4694. const setScrollTop = (value) => {
  4695. if (!isNumber(value)) {
  4696. return;
  4697. }
  4698. wrap$.value.scrollTop = value;
  4699. };
  4700. const setScrollLeft = (value) => {
  4701. if (!isNumber(value)) {
  4702. return;
  4703. }
  4704. wrap$.value.scrollLeft = value;
  4705. };
  4706. const update = () => {
  4707. if (!wrap$.value)
  4708. return;
  4709. const offsetHeight = wrap$.value.offsetHeight - GAP;
  4710. const offsetWidth = wrap$.value.offsetWidth - GAP;
  4711. const originalHeight = offsetHeight ** 2 / wrap$.value.scrollHeight;
  4712. const originalWidth = offsetWidth ** 2 / wrap$.value.scrollWidth;
  4713. const height = Math.max(originalHeight, props.minSize);
  4714. const width = Math.max(originalWidth, props.minSize);
  4715. ratioY.value = originalHeight / (offsetHeight - originalHeight) / (height / (offsetHeight - height));
  4716. ratioX.value = originalWidth / (offsetWidth - originalWidth) / (width / (offsetWidth - width));
  4717. sizeHeight.value = height + GAP < offsetHeight ? `${height}px` : "";
  4718. sizeWidth.value = width + GAP < offsetWidth ? `${width}px` : "";
  4719. };
  4720. watch(() => props.noresize, (noresize) => {
  4721. if (noresize) {
  4722. stopResizeObserver == null ? void 0 : stopResizeObserver();
  4723. stopResizeListener == null ? void 0 : stopResizeListener();
  4724. } else {
  4725. ({ stop: stopResizeObserver } = useResizeObserver(resize$, update));
  4726. stopResizeListener = useEventListener("resize", update);
  4727. }
  4728. }, { immediate: true });
  4729. watch(() => [props.maxHeight, props.height], () => {
  4730. if (!props.native)
  4731. nextTick(() => {
  4732. var _a2;
  4733. update();
  4734. if (wrap$.value) {
  4735. (_a2 = barRef.value) == null ? void 0 : _a2.handleScroll(wrap$.value);
  4736. }
  4737. });
  4738. });
  4739. provide(scrollbarContextKey, reactive({
  4740. scrollbarElement: scrollbar$,
  4741. wrapElement: wrap$
  4742. }));
  4743. onMounted(() => {
  4744. if (!props.native)
  4745. nextTick(() => update());
  4746. });
  4747. onUpdated(() => update());
  4748. return {
  4749. ns,
  4750. scrollbar$,
  4751. wrap$,
  4752. resize$,
  4753. barRef,
  4754. moveX,
  4755. moveY,
  4756. ratioX,
  4757. ratioY,
  4758. sizeWidth,
  4759. sizeHeight,
  4760. style,
  4761. update,
  4762. handleScroll,
  4763. scrollTo,
  4764. setScrollTop,
  4765. setScrollLeft
  4766. };
  4767. }
  4768. });
  4769. function _sfc_render$B(_ctx, _cache, $props, $setup, $data, $options) {
  4770. const _component_bar = resolveComponent("bar");
  4771. return openBlock(), createElementBlock("div", {
  4772. ref: "scrollbar$",
  4773. class: normalizeClass(_ctx.ns.b())
  4774. }, [
  4775. createElementVNode("div", {
  4776. ref: "wrap$",
  4777. class: normalizeClass([
  4778. _ctx.wrapClass,
  4779. _ctx.ns.e("wrap"),
  4780. { [_ctx.ns.em("wrap", "hidden-default")]: !_ctx.native }
  4781. ]),
  4782. style: normalizeStyle(_ctx.style),
  4783. onScroll: _cache[0] || (_cache[0] = (...args) => _ctx.handleScroll && _ctx.handleScroll(...args))
  4784. }, [
  4785. (openBlock(), createBlock(resolveDynamicComponent(_ctx.tag), {
  4786. ref: "resize$",
  4787. class: normalizeClass([_ctx.ns.e("view"), _ctx.viewClass]),
  4788. style: normalizeStyle(_ctx.viewStyle)
  4789. }, {
  4790. default: withCtx(() => [
  4791. renderSlot(_ctx.$slots, "default")
  4792. ]),
  4793. _: 3
  4794. }, 8, ["class", "style"]))
  4795. ], 38),
  4796. !_ctx.native ? (openBlock(), createBlock(_component_bar, {
  4797. key: 0,
  4798. ref: "barRef",
  4799. height: _ctx.sizeHeight,
  4800. width: _ctx.sizeWidth,
  4801. always: _ctx.always,
  4802. "ratio-x": _ctx.ratioX,
  4803. "ratio-y": _ctx.ratioY
  4804. }, null, 8, ["height", "width", "always", "ratio-x", "ratio-y"])) : createCommentVNode("v-if", true)
  4805. ], 2);
  4806. }
  4807. var Scrollbar = /* @__PURE__ */ _export_sfc$1(_sfc_main$11, [["render", _sfc_render$B], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/scrollbar/src/scrollbar.vue"]]);
  4808. const ElScrollbar = withInstall(Scrollbar);
  4809. const __default__$j = {
  4810. name: "ElPopperRoot",
  4811. inheritAttrs: false
  4812. };
  4813. const _sfc_main$10 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$j), {
  4814. setup(__props, { expose }) {
  4815. const triggerRef2 = ref();
  4816. const popperInstanceRef = ref();
  4817. const contentRef = ref();
  4818. const referenceRef = ref();
  4819. const popperProvides = {
  4820. triggerRef: triggerRef2,
  4821. popperInstanceRef,
  4822. contentRef,
  4823. referenceRef
  4824. };
  4825. expose(popperProvides);
  4826. provide(POPPER_INJECTION_KEY, popperProvides);
  4827. return (_ctx, _cache) => {
  4828. return renderSlot(_ctx.$slots, "default");
  4829. };
  4830. }
  4831. }));
  4832. var Popper = /* @__PURE__ */ _export_sfc$1(_sfc_main$10, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/popper/src/popper.vue"]]);
  4833. const usePopperArrowProps = buildProps({
  4834. arrowOffset: {
  4835. type: Number,
  4836. default: 5
  4837. }
  4838. });
  4839. const __default__$i = {
  4840. name: "ElPopperArrow",
  4841. inheritAttrs: false
  4842. };
  4843. const _sfc_main$$ = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$i), {
  4844. props: usePopperArrowProps,
  4845. setup(__props, { expose }) {
  4846. const props = __props;
  4847. const ns = useNamespace("popper");
  4848. const { arrowOffset, arrowRef } = inject(POPPER_CONTENT_INJECTION_KEY, void 0);
  4849. watch(() => props.arrowOffset, (val) => {
  4850. arrowOffset.value = val;
  4851. });
  4852. onBeforeUnmount(() => {
  4853. arrowRef.value = void 0;
  4854. });
  4855. expose({
  4856. arrowRef
  4857. });
  4858. return (_ctx, _cache) => {
  4859. return openBlock(), createElementBlock("span", {
  4860. ref_key: "arrowRef",
  4861. ref: arrowRef,
  4862. class: normalizeClass(unref(ns).e("arrow")),
  4863. "data-popper-arrow": ""
  4864. }, null, 2);
  4865. };
  4866. }
  4867. }));
  4868. var ElPopperArrow = /* @__PURE__ */ _export_sfc$1(_sfc_main$$, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/popper/src/arrow.vue"]]);
  4869. const NAME = "ElOnlyChild";
  4870. const OnlyChild = defineComponent({
  4871. name: NAME,
  4872. setup(_2, {
  4873. slots,
  4874. attrs
  4875. }) {
  4876. var _a2;
  4877. const forwardRefInjection = inject(FORWARD_REF_INJECTION_KEY);
  4878. const forwardRefDirective = useForwardRefDirective((_a2 = forwardRefInjection == null ? void 0 : forwardRefInjection.setForwardRef) != null ? _a2 : NOOP);
  4879. return () => {
  4880. var _a22;
  4881. const defaultSlot = (_a22 = slots.default) == null ? void 0 : _a22.call(slots, attrs);
  4882. if (!defaultSlot)
  4883. return null;
  4884. if (defaultSlot.length > 1) {
  4885. return null;
  4886. }
  4887. const firstLegitNode = findFirstLegitChild(defaultSlot);
  4888. if (!firstLegitNode) {
  4889. return null;
  4890. }
  4891. return withDirectives(cloneVNode(firstLegitNode, attrs), [[forwardRefDirective]]);
  4892. };
  4893. }
  4894. });
  4895. function findFirstLegitChild(node) {
  4896. if (!node)
  4897. return null;
  4898. const children = node;
  4899. for (const child of children) {
  4900. if (isObject$1(child)) {
  4901. switch (child.type) {
  4902. case Comment:
  4903. continue;
  4904. case Text:
  4905. return wrapTextContent(child);
  4906. case "svg":
  4907. return wrapTextContent(child);
  4908. case Fragment:
  4909. return findFirstLegitChild(child.children);
  4910. default:
  4911. return child;
  4912. }
  4913. }
  4914. return wrapTextContent(child);
  4915. }
  4916. return null;
  4917. }
  4918. function wrapTextContent(s2) {
  4919. return createVNode("span", {
  4920. "class": "el-only-child__content"
  4921. }, [s2]);
  4922. }
  4923. const usePopperTriggerProps = buildProps({
  4924. virtualRef: {
  4925. type: definePropType(Object)
  4926. },
  4927. virtualTriggering: Boolean,
  4928. onMouseenter: Function,
  4929. onMouseleave: Function,
  4930. onClick: Function,
  4931. onKeydown: Function,
  4932. onFocus: Function,
  4933. onBlur: Function,
  4934. onContextmenu: Function,
  4935. id: String,
  4936. open: Boolean
  4937. });
  4938. const __default__$h = {
  4939. name: "ElPopperTrigger",
  4940. inheritAttrs: false
  4941. };
  4942. const _sfc_main$_ = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$h), {
  4943. props: usePopperTriggerProps,
  4944. setup(__props, { expose }) {
  4945. const props = __props;
  4946. const { triggerRef: triggerRef2 } = inject(POPPER_INJECTION_KEY, void 0);
  4947. useForwardRef(triggerRef2);
  4948. onMounted(() => {
  4949. watch(() => props.virtualRef, (virtualEl) => {
  4950. if (virtualEl) {
  4951. triggerRef2.value = unrefElement(virtualEl);
  4952. }
  4953. }, {
  4954. immediate: true
  4955. });
  4956. watch(() => triggerRef2.value, (el, prevEl) => {
  4957. if (isElement$1(el)) {
  4958. [
  4959. "onMouseenter",
  4960. "onMouseleave",
  4961. "onClick",
  4962. "onKeydown",
  4963. "onFocus",
  4964. "onBlur",
  4965. "onContextmenu"
  4966. ].forEach((eventName) => {
  4967. var _a2;
  4968. const handler3 = props[eventName];
  4969. if (handler3) {
  4970. el.addEventListener(eventName.slice(2).toLowerCase(), handler3);
  4971. (_a2 = prevEl == null ? void 0 : prevEl.removeEventListener) == null ? void 0 : _a2.call(prevEl, eventName.slice(2).toLowerCase(), handler3);
  4972. }
  4973. });
  4974. }
  4975. }, {
  4976. immediate: true
  4977. });
  4978. });
  4979. expose({
  4980. triggerRef: triggerRef2
  4981. });
  4982. return (_ctx, _cache) => {
  4983. return !_ctx.virtualTriggering ? (openBlock(), createBlock(unref(OnlyChild), mergeProps({ key: 0 }, _ctx.$attrs, {
  4984. "aria-describedby": _ctx.open ? _ctx.id : void 0
  4985. }), {
  4986. default: withCtx(() => [
  4987. renderSlot(_ctx.$slots, "default")
  4988. ]),
  4989. _: 3
  4990. }, 16, ["aria-describedby"])) : createCommentVNode("v-if", true);
  4991. };
  4992. }
  4993. }));
  4994. var ElPopperTrigger = /* @__PURE__ */ _export_sfc$1(_sfc_main$_, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/popper/src/trigger.vue"]]);
  4995. var top = "top";
  4996. var bottom = "bottom";
  4997. var right = "right";
  4998. var left = "left";
  4999. var auto = "auto";
  5000. var basePlacements = [top, bottom, right, left];
  5001. var start = "start";
  5002. var end = "end";
  5003. var clippingParents = "clippingParents";
  5004. var viewport = "viewport";
  5005. var popper = "popper";
  5006. var reference = "reference";
  5007. var variationPlacements = /* @__PURE__ */ basePlacements.reduce(function(acc, placement) {
  5008. return acc.concat([placement + "-" + start, placement + "-" + end]);
  5009. }, []);
  5010. var placements = /* @__PURE__ */ [].concat(basePlacements, [auto]).reduce(function(acc, placement) {
  5011. return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
  5012. }, []);
  5013. var beforeRead = "beforeRead";
  5014. var read = "read";
  5015. var afterRead = "afterRead";
  5016. var beforeMain = "beforeMain";
  5017. var main = "main";
  5018. var afterMain = "afterMain";
  5019. var beforeWrite = "beforeWrite";
  5020. var write = "write";
  5021. var afterWrite = "afterWrite";
  5022. var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
  5023. function getNodeName(element) {
  5024. return element ? (element.nodeName || "").toLowerCase() : null;
  5025. }
  5026. function getWindow(node) {
  5027. if (node == null) {
  5028. return window;
  5029. }
  5030. if (node.toString() !== "[object Window]") {
  5031. var ownerDocument = node.ownerDocument;
  5032. return ownerDocument ? ownerDocument.defaultView || window : window;
  5033. }
  5034. return node;
  5035. }
  5036. function isElement(node) {
  5037. var OwnElement = getWindow(node).Element;
  5038. return node instanceof OwnElement || node instanceof Element;
  5039. }
  5040. function isHTMLElement(node) {
  5041. var OwnElement = getWindow(node).HTMLElement;
  5042. return node instanceof OwnElement || node instanceof HTMLElement;
  5043. }
  5044. function isShadowRoot(node) {
  5045. if (typeof ShadowRoot === "undefined") {
  5046. return false;
  5047. }
  5048. var OwnElement = getWindow(node).ShadowRoot;
  5049. return node instanceof OwnElement || node instanceof ShadowRoot;
  5050. }
  5051. function applyStyles(_ref) {
  5052. var state = _ref.state;
  5053. Object.keys(state.elements).forEach(function(name) {
  5054. var style = state.styles[name] || {};
  5055. var attributes = state.attributes[name] || {};
  5056. var element = state.elements[name];
  5057. if (!isHTMLElement(element) || !getNodeName(element)) {
  5058. return;
  5059. }
  5060. Object.assign(element.style, style);
  5061. Object.keys(attributes).forEach(function(name2) {
  5062. var value = attributes[name2];
  5063. if (value === false) {
  5064. element.removeAttribute(name2);
  5065. } else {
  5066. element.setAttribute(name2, value === true ? "" : value);
  5067. }
  5068. });
  5069. });
  5070. }
  5071. function effect$2(_ref2) {
  5072. var state = _ref2.state;
  5073. var initialStyles = {
  5074. popper: {
  5075. position: state.options.strategy,
  5076. left: "0",
  5077. top: "0",
  5078. margin: "0"
  5079. },
  5080. arrow: {
  5081. position: "absolute"
  5082. },
  5083. reference: {}
  5084. };
  5085. Object.assign(state.elements.popper.style, initialStyles.popper);
  5086. state.styles = initialStyles;
  5087. if (state.elements.arrow) {
  5088. Object.assign(state.elements.arrow.style, initialStyles.arrow);
  5089. }
  5090. return function() {
  5091. Object.keys(state.elements).forEach(function(name) {
  5092. var element = state.elements[name];
  5093. var attributes = state.attributes[name] || {};
  5094. var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]);
  5095. var style = styleProperties.reduce(function(style2, property) {
  5096. style2[property] = "";
  5097. return style2;
  5098. }, {});
  5099. if (!isHTMLElement(element) || !getNodeName(element)) {
  5100. return;
  5101. }
  5102. Object.assign(element.style, style);
  5103. Object.keys(attributes).forEach(function(attribute) {
  5104. element.removeAttribute(attribute);
  5105. });
  5106. });
  5107. };
  5108. }
  5109. var applyStyles$1 = {
  5110. name: "applyStyles",
  5111. enabled: true,
  5112. phase: "write",
  5113. fn: applyStyles,
  5114. effect: effect$2,
  5115. requires: ["computeStyles"]
  5116. };
  5117. function getBasePlacement(placement) {
  5118. return placement.split("-")[0];
  5119. }
  5120. var max = Math.max;
  5121. var min = Math.min;
  5122. var round = Math.round;
  5123. function getBoundingClientRect(element, includeScale) {
  5124. if (includeScale === void 0) {
  5125. includeScale = false;
  5126. }
  5127. var rect = element.getBoundingClientRect();
  5128. var scaleX = 1;
  5129. var scaleY = 1;
  5130. if (isHTMLElement(element) && includeScale) {
  5131. var offsetHeight = element.offsetHeight;
  5132. var offsetWidth = element.offsetWidth;
  5133. if (offsetWidth > 0) {
  5134. scaleX = round(rect.width) / offsetWidth || 1;
  5135. }
  5136. if (offsetHeight > 0) {
  5137. scaleY = round(rect.height) / offsetHeight || 1;
  5138. }
  5139. }
  5140. return {
  5141. width: rect.width / scaleX,
  5142. height: rect.height / scaleY,
  5143. top: rect.top / scaleY,
  5144. right: rect.right / scaleX,
  5145. bottom: rect.bottom / scaleY,
  5146. left: rect.left / scaleX,
  5147. x: rect.left / scaleX,
  5148. y: rect.top / scaleY
  5149. };
  5150. }
  5151. function getLayoutRect(element) {
  5152. var clientRect = getBoundingClientRect(element);
  5153. var width = element.offsetWidth;
  5154. var height = element.offsetHeight;
  5155. if (Math.abs(clientRect.width - width) <= 1) {
  5156. width = clientRect.width;
  5157. }
  5158. if (Math.abs(clientRect.height - height) <= 1) {
  5159. height = clientRect.height;
  5160. }
  5161. return {
  5162. x: element.offsetLeft,
  5163. y: element.offsetTop,
  5164. width,
  5165. height
  5166. };
  5167. }
  5168. function contains(parent, child) {
  5169. var rootNode = child.getRootNode && child.getRootNode();
  5170. if (parent.contains(child)) {
  5171. return true;
  5172. } else if (rootNode && isShadowRoot(rootNode)) {
  5173. var next = child;
  5174. do {
  5175. if (next && parent.isSameNode(next)) {
  5176. return true;
  5177. }
  5178. next = next.parentNode || next.host;
  5179. } while (next);
  5180. }
  5181. return false;
  5182. }
  5183. function getComputedStyle$1(element) {
  5184. return getWindow(element).getComputedStyle(element);
  5185. }
  5186. function isTableElement(element) {
  5187. return ["table", "td", "th"].indexOf(getNodeName(element)) >= 0;
  5188. }
  5189. function getDocumentElement(element) {
  5190. return ((isElement(element) ? element.ownerDocument : element.document) || window.document).documentElement;
  5191. }
  5192. function getParentNode(element) {
  5193. if (getNodeName(element) === "html") {
  5194. return element;
  5195. }
  5196. return element.assignedSlot || element.parentNode || (isShadowRoot(element) ? element.host : null) || getDocumentElement(element);
  5197. }
  5198. function getTrueOffsetParent(element) {
  5199. if (!isHTMLElement(element) || getComputedStyle$1(element).position === "fixed") {
  5200. return null;
  5201. }
  5202. return element.offsetParent;
  5203. }
  5204. function getContainingBlock(element) {
  5205. var isFirefox2 = navigator.userAgent.toLowerCase().indexOf("firefox") !== -1;
  5206. var isIE = navigator.userAgent.indexOf("Trident") !== -1;
  5207. if (isIE && isHTMLElement(element)) {
  5208. var elementCss = getComputedStyle$1(element);
  5209. if (elementCss.position === "fixed") {
  5210. return null;
  5211. }
  5212. }
  5213. var currentNode = getParentNode(element);
  5214. if (isShadowRoot(currentNode)) {
  5215. currentNode = currentNode.host;
  5216. }
  5217. while (isHTMLElement(currentNode) && ["html", "body"].indexOf(getNodeName(currentNode)) < 0) {
  5218. var css = getComputedStyle$1(currentNode);
  5219. if (css.transform !== "none" || css.perspective !== "none" || css.contain === "paint" || ["transform", "perspective"].indexOf(css.willChange) !== -1 || isFirefox2 && css.willChange === "filter" || isFirefox2 && css.filter && css.filter !== "none") {
  5220. return currentNode;
  5221. } else {
  5222. currentNode = currentNode.parentNode;
  5223. }
  5224. }
  5225. return null;
  5226. }
  5227. function getOffsetParent(element) {
  5228. var window2 = getWindow(element);
  5229. var offsetParent = getTrueOffsetParent(element);
  5230. while (offsetParent && isTableElement(offsetParent) && getComputedStyle$1(offsetParent).position === "static") {
  5231. offsetParent = getTrueOffsetParent(offsetParent);
  5232. }
  5233. if (offsetParent && (getNodeName(offsetParent) === "html" || getNodeName(offsetParent) === "body" && getComputedStyle$1(offsetParent).position === "static")) {
  5234. return window2;
  5235. }
  5236. return offsetParent || getContainingBlock(element) || window2;
  5237. }
  5238. function getMainAxisFromPlacement(placement) {
  5239. return ["top", "bottom"].indexOf(placement) >= 0 ? "x" : "y";
  5240. }
  5241. function within(min$1, value, max$1) {
  5242. return max(min$1, min(value, max$1));
  5243. }
  5244. function withinMaxClamp(min2, value, max2) {
  5245. var v2 = within(min2, value, max2);
  5246. return v2 > max2 ? max2 : v2;
  5247. }
  5248. function getFreshSideObject() {
  5249. return {
  5250. top: 0,
  5251. right: 0,
  5252. bottom: 0,
  5253. left: 0
  5254. };
  5255. }
  5256. function mergePaddingObject(paddingObject) {
  5257. return Object.assign({}, getFreshSideObject(), paddingObject);
  5258. }
  5259. function expandToHashMap(value, keys2) {
  5260. return keys2.reduce(function(hashMap, key) {
  5261. hashMap[key] = value;
  5262. return hashMap;
  5263. }, {});
  5264. }
  5265. var toPaddingObject = function toPaddingObject2(padding, state) {
  5266. padding = typeof padding === "function" ? padding(Object.assign({}, state.rects, {
  5267. placement: state.placement
  5268. })) : padding;
  5269. return mergePaddingObject(typeof padding !== "number" ? padding : expandToHashMap(padding, basePlacements));
  5270. };
  5271. function arrow(_ref) {
  5272. var _state$modifiersData$;
  5273. var state = _ref.state, name = _ref.name, options = _ref.options;
  5274. var arrowElement = state.elements.arrow;
  5275. var popperOffsets2 = state.modifiersData.popperOffsets;
  5276. var basePlacement = getBasePlacement(state.placement);
  5277. var axis = getMainAxisFromPlacement(basePlacement);
  5278. var isVertical = [left, right].indexOf(basePlacement) >= 0;
  5279. var len = isVertical ? "height" : "width";
  5280. if (!arrowElement || !popperOffsets2) {
  5281. return;
  5282. }
  5283. var paddingObject = toPaddingObject(options.padding, state);
  5284. var arrowRect = getLayoutRect(arrowElement);
  5285. var minProp = axis === "y" ? top : left;
  5286. var maxProp = axis === "y" ? bottom : right;
  5287. var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets2[axis] - state.rects.popper[len];
  5288. var startDiff = popperOffsets2[axis] - state.rects.reference[axis];
  5289. var arrowOffsetParent = getOffsetParent(arrowElement);
  5290. var clientSize = arrowOffsetParent ? axis === "y" ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
  5291. var centerToReference = endDiff / 2 - startDiff / 2;
  5292. var min2 = paddingObject[minProp];
  5293. var max2 = clientSize - arrowRect[len] - paddingObject[maxProp];
  5294. var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;
  5295. var offset2 = within(min2, center, max2);
  5296. var axisProp = axis;
  5297. state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset2, _state$modifiersData$.centerOffset = offset2 - center, _state$modifiersData$);
  5298. }
  5299. function effect$1(_ref2) {
  5300. var state = _ref2.state, options = _ref2.options;
  5301. var _options$element = options.element, arrowElement = _options$element === void 0 ? "[data-popper-arrow]" : _options$element;
  5302. if (arrowElement == null) {
  5303. return;
  5304. }
  5305. if (typeof arrowElement === "string") {
  5306. arrowElement = state.elements.popper.querySelector(arrowElement);
  5307. if (!arrowElement) {
  5308. return;
  5309. }
  5310. }
  5311. if (!contains(state.elements.popper, arrowElement)) {
  5312. return;
  5313. }
  5314. state.elements.arrow = arrowElement;
  5315. }
  5316. var arrow$1 = {
  5317. name: "arrow",
  5318. enabled: true,
  5319. phase: "main",
  5320. fn: arrow,
  5321. effect: effect$1,
  5322. requires: ["popperOffsets"],
  5323. requiresIfExists: ["preventOverflow"]
  5324. };
  5325. function getVariation(placement) {
  5326. return placement.split("-")[1];
  5327. }
  5328. var unsetSides = {
  5329. top: "auto",
  5330. right: "auto",
  5331. bottom: "auto",
  5332. left: "auto"
  5333. };
  5334. function roundOffsetsByDPR(_ref) {
  5335. var x2 = _ref.x, y = _ref.y;
  5336. var win = window;
  5337. var dpr = win.devicePixelRatio || 1;
  5338. return {
  5339. x: round(x2 * dpr) / dpr || 0,
  5340. y: round(y * dpr) / dpr || 0
  5341. };
  5342. }
  5343. function mapToStyles(_ref2) {
  5344. var _Object$assign2;
  5345. var popper2 = _ref2.popper, popperRect = _ref2.popperRect, placement = _ref2.placement, variation = _ref2.variation, offsets = _ref2.offsets, position = _ref2.position, gpuAcceleration = _ref2.gpuAcceleration, adaptive = _ref2.adaptive, roundOffsets = _ref2.roundOffsets, isFixed = _ref2.isFixed;
  5346. var _offsets$x = offsets.x, x2 = _offsets$x === void 0 ? 0 : _offsets$x, _offsets$y = offsets.y, y = _offsets$y === void 0 ? 0 : _offsets$y;
  5347. var _ref3 = typeof roundOffsets === "function" ? roundOffsets({
  5348. x: x2,
  5349. y
  5350. }) : {
  5351. x: x2,
  5352. y
  5353. };
  5354. x2 = _ref3.x;
  5355. y = _ref3.y;
  5356. var hasX = offsets.hasOwnProperty("x");
  5357. var hasY = offsets.hasOwnProperty("y");
  5358. var sideX = left;
  5359. var sideY = top;
  5360. var win = window;
  5361. if (adaptive) {
  5362. var offsetParent = getOffsetParent(popper2);
  5363. var heightProp = "clientHeight";
  5364. var widthProp = "clientWidth";
  5365. if (offsetParent === getWindow(popper2)) {
  5366. offsetParent = getDocumentElement(popper2);
  5367. if (getComputedStyle$1(offsetParent).position !== "static" && position === "absolute") {
  5368. heightProp = "scrollHeight";
  5369. widthProp = "scrollWidth";
  5370. }
  5371. }
  5372. offsetParent = offsetParent;
  5373. if (placement === top || (placement === left || placement === right) && variation === end) {
  5374. sideY = bottom;
  5375. var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : offsetParent[heightProp];
  5376. y -= offsetY - popperRect.height;
  5377. y *= gpuAcceleration ? 1 : -1;
  5378. }
  5379. if (placement === left || (placement === top || placement === bottom) && variation === end) {
  5380. sideX = right;
  5381. var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : offsetParent[widthProp];
  5382. x2 -= offsetX - popperRect.width;
  5383. x2 *= gpuAcceleration ? 1 : -1;
  5384. }
  5385. }
  5386. var commonStyles = Object.assign({
  5387. position
  5388. }, adaptive && unsetSides);
  5389. var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
  5390. x: x2,
  5391. y
  5392. }) : {
  5393. x: x2,
  5394. y
  5395. };
  5396. x2 = _ref4.x;
  5397. y = _ref4.y;
  5398. if (gpuAcceleration) {
  5399. var _Object$assign;
  5400. return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? "0" : "", _Object$assign[sideX] = hasX ? "0" : "", _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? "translate(" + x2 + "px, " + y + "px)" : "translate3d(" + x2 + "px, " + y + "px, 0)", _Object$assign));
  5401. }
  5402. return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : "", _Object$assign2[sideX] = hasX ? x2 + "px" : "", _Object$assign2.transform = "", _Object$assign2));
  5403. }
  5404. function computeStyles(_ref5) {
  5405. var state = _ref5.state, options = _ref5.options;
  5406. var _options$gpuAccelerat = options.gpuAcceleration, gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat, _options$adaptive = options.adaptive, adaptive = _options$adaptive === void 0 ? true : _options$adaptive, _options$roundOffsets = options.roundOffsets, roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
  5407. var commonStyles = {
  5408. placement: getBasePlacement(state.placement),
  5409. variation: getVariation(state.placement),
  5410. popper: state.elements.popper,
  5411. popperRect: state.rects.popper,
  5412. gpuAcceleration,
  5413. isFixed: state.options.strategy === "fixed"
  5414. };
  5415. if (state.modifiersData.popperOffsets != null) {
  5416. state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
  5417. offsets: state.modifiersData.popperOffsets,
  5418. position: state.options.strategy,
  5419. adaptive,
  5420. roundOffsets
  5421. })));
  5422. }
  5423. if (state.modifiersData.arrow != null) {
  5424. state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
  5425. offsets: state.modifiersData.arrow,
  5426. position: "absolute",
  5427. adaptive: false,
  5428. roundOffsets
  5429. })));
  5430. }
  5431. state.attributes.popper = Object.assign({}, state.attributes.popper, {
  5432. "data-popper-placement": state.placement
  5433. });
  5434. }
  5435. var computeStyles$1 = {
  5436. name: "computeStyles",
  5437. enabled: true,
  5438. phase: "beforeWrite",
  5439. fn: computeStyles,
  5440. data: {}
  5441. };
  5442. var passive = {
  5443. passive: true
  5444. };
  5445. function effect(_ref) {
  5446. var state = _ref.state, instance = _ref.instance, options = _ref.options;
  5447. var _options$scroll = options.scroll, scroll = _options$scroll === void 0 ? true : _options$scroll, _options$resize = options.resize, resize = _options$resize === void 0 ? true : _options$resize;
  5448. var window2 = getWindow(state.elements.popper);
  5449. var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
  5450. if (scroll) {
  5451. scrollParents.forEach(function(scrollParent) {
  5452. scrollParent.addEventListener("scroll", instance.update, passive);
  5453. });
  5454. }
  5455. if (resize) {
  5456. window2.addEventListener("resize", instance.update, passive);
  5457. }
  5458. return function() {
  5459. if (scroll) {
  5460. scrollParents.forEach(function(scrollParent) {
  5461. scrollParent.removeEventListener("scroll", instance.update, passive);
  5462. });
  5463. }
  5464. if (resize) {
  5465. window2.removeEventListener("resize", instance.update, passive);
  5466. }
  5467. };
  5468. }
  5469. var eventListeners = {
  5470. name: "eventListeners",
  5471. enabled: true,
  5472. phase: "write",
  5473. fn: function fn() {
  5474. },
  5475. effect,
  5476. data: {}
  5477. };
  5478. var hash$1 = {
  5479. left: "right",
  5480. right: "left",
  5481. bottom: "top",
  5482. top: "bottom"
  5483. };
  5484. function getOppositePlacement(placement) {
  5485. return placement.replace(/left|right|bottom|top/g, function(matched) {
  5486. return hash$1[matched];
  5487. });
  5488. }
  5489. var hash = {
  5490. start: "end",
  5491. end: "start"
  5492. };
  5493. function getOppositeVariationPlacement(placement) {
  5494. return placement.replace(/start|end/g, function(matched) {
  5495. return hash[matched];
  5496. });
  5497. }
  5498. function getWindowScroll(node) {
  5499. var win = getWindow(node);
  5500. var scrollLeft = win.pageXOffset;
  5501. var scrollTop = win.pageYOffset;
  5502. return {
  5503. scrollLeft,
  5504. scrollTop
  5505. };
  5506. }
  5507. function getWindowScrollBarX(element) {
  5508. return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
  5509. }
  5510. function getViewportRect(element) {
  5511. var win = getWindow(element);
  5512. var html = getDocumentElement(element);
  5513. var visualViewport = win.visualViewport;
  5514. var width = html.clientWidth;
  5515. var height = html.clientHeight;
  5516. var x2 = 0;
  5517. var y = 0;
  5518. if (visualViewport) {
  5519. width = visualViewport.width;
  5520. height = visualViewport.height;
  5521. if (!/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {
  5522. x2 = visualViewport.offsetLeft;
  5523. y = visualViewport.offsetTop;
  5524. }
  5525. }
  5526. return {
  5527. width,
  5528. height,
  5529. x: x2 + getWindowScrollBarX(element),
  5530. y
  5531. };
  5532. }
  5533. function getDocumentRect(element) {
  5534. var _element$ownerDocumen;
  5535. var html = getDocumentElement(element);
  5536. var winScroll = getWindowScroll(element);
  5537. var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
  5538. var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
  5539. var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
  5540. var x2 = -winScroll.scrollLeft + getWindowScrollBarX(element);
  5541. var y = -winScroll.scrollTop;
  5542. if (getComputedStyle$1(body || html).direction === "rtl") {
  5543. x2 += max(html.clientWidth, body ? body.clientWidth : 0) - width;
  5544. }
  5545. return {
  5546. width,
  5547. height,
  5548. x: x2,
  5549. y
  5550. };
  5551. }
  5552. function isScrollParent(element) {
  5553. var _getComputedStyle = getComputedStyle$1(element), overflow = _getComputedStyle.overflow, overflowX = _getComputedStyle.overflowX, overflowY = _getComputedStyle.overflowY;
  5554. return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
  5555. }
  5556. function getScrollParent(node) {
  5557. if (["html", "body", "#document"].indexOf(getNodeName(node)) >= 0) {
  5558. return node.ownerDocument.body;
  5559. }
  5560. if (isHTMLElement(node) && isScrollParent(node)) {
  5561. return node;
  5562. }
  5563. return getScrollParent(getParentNode(node));
  5564. }
  5565. function listScrollParents(element, list) {
  5566. var _element$ownerDocumen;
  5567. if (list === void 0) {
  5568. list = [];
  5569. }
  5570. var scrollParent = getScrollParent(element);
  5571. var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
  5572. var win = getWindow(scrollParent);
  5573. var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
  5574. var updatedList = list.concat(target);
  5575. return isBody ? updatedList : updatedList.concat(listScrollParents(getParentNode(target)));
  5576. }
  5577. function rectToClientRect(rect) {
  5578. return Object.assign({}, rect, {
  5579. left: rect.x,
  5580. top: rect.y,
  5581. right: rect.x + rect.width,
  5582. bottom: rect.y + rect.height
  5583. });
  5584. }
  5585. function getInnerBoundingClientRect(element) {
  5586. var rect = getBoundingClientRect(element);
  5587. rect.top = rect.top + element.clientTop;
  5588. rect.left = rect.left + element.clientLeft;
  5589. rect.bottom = rect.top + element.clientHeight;
  5590. rect.right = rect.left + element.clientWidth;
  5591. rect.width = element.clientWidth;
  5592. rect.height = element.clientHeight;
  5593. rect.x = rect.left;
  5594. rect.y = rect.top;
  5595. return rect;
  5596. }
  5597. function getClientRectFromMixedType(element, clippingParent) {
  5598. return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
  5599. }
  5600. function getClippingParents(element) {
  5601. var clippingParents2 = listScrollParents(getParentNode(element));
  5602. var canEscapeClipping = ["absolute", "fixed"].indexOf(getComputedStyle$1(element).position) >= 0;
  5603. var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
  5604. if (!isElement(clipperElement)) {
  5605. return [];
  5606. }
  5607. return clippingParents2.filter(function(clippingParent) {
  5608. return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== "body";
  5609. });
  5610. }
  5611. function getClippingRect(element, boundary, rootBoundary) {
  5612. var mainClippingParents = boundary === "clippingParents" ? getClippingParents(element) : [].concat(boundary);
  5613. var clippingParents2 = [].concat(mainClippingParents, [rootBoundary]);
  5614. var firstClippingParent = clippingParents2[0];
  5615. var clippingRect = clippingParents2.reduce(function(accRect, clippingParent) {
  5616. var rect = getClientRectFromMixedType(element, clippingParent);
  5617. accRect.top = max(rect.top, accRect.top);
  5618. accRect.right = min(rect.right, accRect.right);
  5619. accRect.bottom = min(rect.bottom, accRect.bottom);
  5620. accRect.left = max(rect.left, accRect.left);
  5621. return accRect;
  5622. }, getClientRectFromMixedType(element, firstClippingParent));
  5623. clippingRect.width = clippingRect.right - clippingRect.left;
  5624. clippingRect.height = clippingRect.bottom - clippingRect.top;
  5625. clippingRect.x = clippingRect.left;
  5626. clippingRect.y = clippingRect.top;
  5627. return clippingRect;
  5628. }
  5629. function computeOffsets(_ref) {
  5630. var reference2 = _ref.reference, element = _ref.element, placement = _ref.placement;
  5631. var basePlacement = placement ? getBasePlacement(placement) : null;
  5632. var variation = placement ? getVariation(placement) : null;
  5633. var commonX = reference2.x + reference2.width / 2 - element.width / 2;
  5634. var commonY = reference2.y + reference2.height / 2 - element.height / 2;
  5635. var offsets;
  5636. switch (basePlacement) {
  5637. case top:
  5638. offsets = {
  5639. x: commonX,
  5640. y: reference2.y - element.height
  5641. };
  5642. break;
  5643. case bottom:
  5644. offsets = {
  5645. x: commonX,
  5646. y: reference2.y + reference2.height
  5647. };
  5648. break;
  5649. case right:
  5650. offsets = {
  5651. x: reference2.x + reference2.width,
  5652. y: commonY
  5653. };
  5654. break;
  5655. case left:
  5656. offsets = {
  5657. x: reference2.x - element.width,
  5658. y: commonY
  5659. };
  5660. break;
  5661. default:
  5662. offsets = {
  5663. x: reference2.x,
  5664. y: reference2.y
  5665. };
  5666. }
  5667. var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
  5668. if (mainAxis != null) {
  5669. var len = mainAxis === "y" ? "height" : "width";
  5670. switch (variation) {
  5671. case start:
  5672. offsets[mainAxis] = offsets[mainAxis] - (reference2[len] / 2 - element[len] / 2);
  5673. break;
  5674. case end:
  5675. offsets[mainAxis] = offsets[mainAxis] + (reference2[len] / 2 - element[len] / 2);
  5676. break;
  5677. }
  5678. }
  5679. return offsets;
  5680. }
  5681. function detectOverflow(state, options) {
  5682. if (options === void 0) {
  5683. options = {};
  5684. }
  5685. var _options = options, _options$placement = _options.placement, placement = _options$placement === void 0 ? state.placement : _options$placement, _options$boundary = _options.boundary, boundary = _options$boundary === void 0 ? clippingParents : _options$boundary, _options$rootBoundary = _options.rootBoundary, rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary, _options$elementConte = _options.elementContext, elementContext = _options$elementConte === void 0 ? popper : _options$elementConte, _options$altBoundary = _options.altBoundary, altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary, _options$padding = _options.padding, padding = _options$padding === void 0 ? 0 : _options$padding;
  5686. var paddingObject = mergePaddingObject(typeof padding !== "number" ? padding : expandToHashMap(padding, basePlacements));
  5687. var altContext = elementContext === popper ? reference : popper;
  5688. var popperRect = state.rects.popper;
  5689. var element = state.elements[altBoundary ? altContext : elementContext];
  5690. var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary);
  5691. var referenceClientRect = getBoundingClientRect(state.elements.reference);
  5692. var popperOffsets2 = computeOffsets({
  5693. reference: referenceClientRect,
  5694. element: popperRect,
  5695. strategy: "absolute",
  5696. placement
  5697. });
  5698. var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets2));
  5699. var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect;
  5700. var overflowOffsets = {
  5701. top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
  5702. bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
  5703. left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
  5704. right: elementClientRect.right - clippingClientRect.right + paddingObject.right
  5705. };
  5706. var offsetData = state.modifiersData.offset;
  5707. if (elementContext === popper && offsetData) {
  5708. var offset2 = offsetData[placement];
  5709. Object.keys(overflowOffsets).forEach(function(key) {
  5710. var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;
  5711. var axis = [top, bottom].indexOf(key) >= 0 ? "y" : "x";
  5712. overflowOffsets[key] += offset2[axis] * multiply;
  5713. });
  5714. }
  5715. return overflowOffsets;
  5716. }
  5717. function computeAutoPlacement(state, options) {
  5718. if (options === void 0) {
  5719. options = {};
  5720. }
  5721. var _options = options, placement = _options.placement, boundary = _options.boundary, rootBoundary = _options.rootBoundary, padding = _options.padding, flipVariations = _options.flipVariations, _options$allowedAutoP = _options.allowedAutoPlacements, allowedAutoPlacements = _options$allowedAutoP === void 0 ? placements : _options$allowedAutoP;
  5722. var variation = getVariation(placement);
  5723. var placements$1 = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function(placement2) {
  5724. return getVariation(placement2) === variation;
  5725. }) : basePlacements;
  5726. var allowedPlacements = placements$1.filter(function(placement2) {
  5727. return allowedAutoPlacements.indexOf(placement2) >= 0;
  5728. });
  5729. if (allowedPlacements.length === 0) {
  5730. allowedPlacements = placements$1;
  5731. }
  5732. var overflows = allowedPlacements.reduce(function(acc, placement2) {
  5733. acc[placement2] = detectOverflow(state, {
  5734. placement: placement2,
  5735. boundary,
  5736. rootBoundary,
  5737. padding
  5738. })[getBasePlacement(placement2)];
  5739. return acc;
  5740. }, {});
  5741. return Object.keys(overflows).sort(function(a2, b2) {
  5742. return overflows[a2] - overflows[b2];
  5743. });
  5744. }
  5745. function getExpandedFallbackPlacements(placement) {
  5746. if (getBasePlacement(placement) === auto) {
  5747. return [];
  5748. }
  5749. var oppositePlacement = getOppositePlacement(placement);
  5750. return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];
  5751. }
  5752. function flip(_ref) {
  5753. var state = _ref.state, options = _ref.options, name = _ref.name;
  5754. if (state.modifiersData[name]._skip) {
  5755. return;
  5756. }
  5757. var _options$mainAxis = options.mainAxis, checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis, _options$altAxis = options.altAxis, checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis, specifiedFallbackPlacements = options.fallbackPlacements, padding = options.padding, boundary = options.boundary, rootBoundary = options.rootBoundary, altBoundary = options.altBoundary, _options$flipVariatio = options.flipVariations, flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio, allowedAutoPlacements = options.allowedAutoPlacements;
  5758. var preferredPlacement = state.options.placement;
  5759. var basePlacement = getBasePlacement(preferredPlacement);
  5760. var isBasePlacement = basePlacement === preferredPlacement;
  5761. var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));
  5762. var placements2 = [preferredPlacement].concat(fallbackPlacements).reduce(function(acc, placement2) {
  5763. return acc.concat(getBasePlacement(placement2) === auto ? computeAutoPlacement(state, {
  5764. placement: placement2,
  5765. boundary,
  5766. rootBoundary,
  5767. padding,
  5768. flipVariations,
  5769. allowedAutoPlacements
  5770. }) : placement2);
  5771. }, []);
  5772. var referenceRect = state.rects.reference;
  5773. var popperRect = state.rects.popper;
  5774. var checksMap = /* @__PURE__ */ new Map();
  5775. var makeFallbackChecks = true;
  5776. var firstFittingPlacement = placements2[0];
  5777. for (var i = 0; i < placements2.length; i++) {
  5778. var placement = placements2[i];
  5779. var _basePlacement = getBasePlacement(placement);
  5780. var isStartVariation = getVariation(placement) === start;
  5781. var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;
  5782. var len = isVertical ? "width" : "height";
  5783. var overflow = detectOverflow(state, {
  5784. placement,
  5785. boundary,
  5786. rootBoundary,
  5787. altBoundary,
  5788. padding
  5789. });
  5790. var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top;
  5791. if (referenceRect[len] > popperRect[len]) {
  5792. mainVariationSide = getOppositePlacement(mainVariationSide);
  5793. }
  5794. var altVariationSide = getOppositePlacement(mainVariationSide);
  5795. var checks = [];
  5796. if (checkMainAxis) {
  5797. checks.push(overflow[_basePlacement] <= 0);
  5798. }
  5799. if (checkAltAxis) {
  5800. checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);
  5801. }
  5802. if (checks.every(function(check2) {
  5803. return check2;
  5804. })) {
  5805. firstFittingPlacement = placement;
  5806. makeFallbackChecks = false;
  5807. break;
  5808. }
  5809. checksMap.set(placement, checks);
  5810. }
  5811. if (makeFallbackChecks) {
  5812. var numberOfChecks = flipVariations ? 3 : 1;
  5813. var _loop = function _loop2(_i2) {
  5814. var fittingPlacement = placements2.find(function(placement2) {
  5815. var checks2 = checksMap.get(placement2);
  5816. if (checks2) {
  5817. return checks2.slice(0, _i2).every(function(check2) {
  5818. return check2;
  5819. });
  5820. }
  5821. });
  5822. if (fittingPlacement) {
  5823. firstFittingPlacement = fittingPlacement;
  5824. return "break";
  5825. }
  5826. };
  5827. for (var _i = numberOfChecks; _i > 0; _i--) {
  5828. var _ret = _loop(_i);
  5829. if (_ret === "break")
  5830. break;
  5831. }
  5832. }
  5833. if (state.placement !== firstFittingPlacement) {
  5834. state.modifiersData[name]._skip = true;
  5835. state.placement = firstFittingPlacement;
  5836. state.reset = true;
  5837. }
  5838. }
  5839. var flip$1 = {
  5840. name: "flip",
  5841. enabled: true,
  5842. phase: "main",
  5843. fn: flip,
  5844. requiresIfExists: ["offset"],
  5845. data: {
  5846. _skip: false
  5847. }
  5848. };
  5849. function getSideOffsets(overflow, rect, preventedOffsets) {
  5850. if (preventedOffsets === void 0) {
  5851. preventedOffsets = {
  5852. x: 0,
  5853. y: 0
  5854. };
  5855. }
  5856. return {
  5857. top: overflow.top - rect.height - preventedOffsets.y,
  5858. right: overflow.right - rect.width + preventedOffsets.x,
  5859. bottom: overflow.bottom - rect.height + preventedOffsets.y,
  5860. left: overflow.left - rect.width - preventedOffsets.x
  5861. };
  5862. }
  5863. function isAnySideFullyClipped(overflow) {
  5864. return [top, right, bottom, left].some(function(side) {
  5865. return overflow[side] >= 0;
  5866. });
  5867. }
  5868. function hide(_ref) {
  5869. var state = _ref.state, name = _ref.name;
  5870. var referenceRect = state.rects.reference;
  5871. var popperRect = state.rects.popper;
  5872. var preventedOffsets = state.modifiersData.preventOverflow;
  5873. var referenceOverflow = detectOverflow(state, {
  5874. elementContext: "reference"
  5875. });
  5876. var popperAltOverflow = detectOverflow(state, {
  5877. altBoundary: true
  5878. });
  5879. var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);
  5880. var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);
  5881. var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);
  5882. var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);
  5883. state.modifiersData[name] = {
  5884. referenceClippingOffsets,
  5885. popperEscapeOffsets,
  5886. isReferenceHidden,
  5887. hasPopperEscaped
  5888. };
  5889. state.attributes.popper = Object.assign({}, state.attributes.popper, {
  5890. "data-popper-reference-hidden": isReferenceHidden,
  5891. "data-popper-escaped": hasPopperEscaped
  5892. });
  5893. }
  5894. var hide$1 = {
  5895. name: "hide",
  5896. enabled: true,
  5897. phase: "main",
  5898. requiresIfExists: ["preventOverflow"],
  5899. fn: hide
  5900. };
  5901. function distanceAndSkiddingToXY(placement, rects, offset2) {
  5902. var basePlacement = getBasePlacement(placement);
  5903. var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;
  5904. var _ref = typeof offset2 === "function" ? offset2(Object.assign({}, rects, {
  5905. placement
  5906. })) : offset2, skidding = _ref[0], distance = _ref[1];
  5907. skidding = skidding || 0;
  5908. distance = (distance || 0) * invertDistance;
  5909. return [left, right].indexOf(basePlacement) >= 0 ? {
  5910. x: distance,
  5911. y: skidding
  5912. } : {
  5913. x: skidding,
  5914. y: distance
  5915. };
  5916. }
  5917. function offset(_ref2) {
  5918. var state = _ref2.state, options = _ref2.options, name = _ref2.name;
  5919. var _options$offset = options.offset, offset2 = _options$offset === void 0 ? [0, 0] : _options$offset;
  5920. var data2 = placements.reduce(function(acc, placement) {
  5921. acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset2);
  5922. return acc;
  5923. }, {});
  5924. var _data$state$placement = data2[state.placement], x2 = _data$state$placement.x, y = _data$state$placement.y;
  5925. if (state.modifiersData.popperOffsets != null) {
  5926. state.modifiersData.popperOffsets.x += x2;
  5927. state.modifiersData.popperOffsets.y += y;
  5928. }
  5929. state.modifiersData[name] = data2;
  5930. }
  5931. var offset$1 = {
  5932. name: "offset",
  5933. enabled: true,
  5934. phase: "main",
  5935. requires: ["popperOffsets"],
  5936. fn: offset
  5937. };
  5938. function popperOffsets(_ref) {
  5939. var state = _ref.state, name = _ref.name;
  5940. state.modifiersData[name] = computeOffsets({
  5941. reference: state.rects.reference,
  5942. element: state.rects.popper,
  5943. strategy: "absolute",
  5944. placement: state.placement
  5945. });
  5946. }
  5947. var popperOffsets$1 = {
  5948. name: "popperOffsets",
  5949. enabled: true,
  5950. phase: "read",
  5951. fn: popperOffsets,
  5952. data: {}
  5953. };
  5954. function getAltAxis(axis) {
  5955. return axis === "x" ? "y" : "x";
  5956. }
  5957. function preventOverflow(_ref) {
  5958. var state = _ref.state, options = _ref.options, name = _ref.name;
  5959. var _options$mainAxis = options.mainAxis, checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis, _options$altAxis = options.altAxis, checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis, boundary = options.boundary, rootBoundary = options.rootBoundary, altBoundary = options.altBoundary, padding = options.padding, _options$tether = options.tether, tether = _options$tether === void 0 ? true : _options$tether, _options$tetherOffset = options.tetherOffset, tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset;
  5960. var overflow = detectOverflow(state, {
  5961. boundary,
  5962. rootBoundary,
  5963. padding,
  5964. altBoundary
  5965. });
  5966. var basePlacement = getBasePlacement(state.placement);
  5967. var variation = getVariation(state.placement);
  5968. var isBasePlacement = !variation;
  5969. var mainAxis = getMainAxisFromPlacement(basePlacement);
  5970. var altAxis = getAltAxis(mainAxis);
  5971. var popperOffsets2 = state.modifiersData.popperOffsets;
  5972. var referenceRect = state.rects.reference;
  5973. var popperRect = state.rects.popper;
  5974. var tetherOffsetValue = typeof tetherOffset === "function" ? tetherOffset(Object.assign({}, state.rects, {
  5975. placement: state.placement
  5976. })) : tetherOffset;
  5977. var normalizedTetherOffsetValue = typeof tetherOffsetValue === "number" ? {
  5978. mainAxis: tetherOffsetValue,
  5979. altAxis: tetherOffsetValue
  5980. } : Object.assign({
  5981. mainAxis: 0,
  5982. altAxis: 0
  5983. }, tetherOffsetValue);
  5984. var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;
  5985. var data2 = {
  5986. x: 0,
  5987. y: 0
  5988. };
  5989. if (!popperOffsets2) {
  5990. return;
  5991. }
  5992. if (checkMainAxis) {
  5993. var _offsetModifierState$;
  5994. var mainSide = mainAxis === "y" ? top : left;
  5995. var altSide = mainAxis === "y" ? bottom : right;
  5996. var len = mainAxis === "y" ? "height" : "width";
  5997. var offset2 = popperOffsets2[mainAxis];
  5998. var min$1 = offset2 + overflow[mainSide];
  5999. var max$1 = offset2 - overflow[altSide];
  6000. var additive = tether ? -popperRect[len] / 2 : 0;
  6001. var minLen = variation === start ? referenceRect[len] : popperRect[len];
  6002. var maxLen = variation === start ? -popperRect[len] : -referenceRect[len];
  6003. var arrowElement = state.elements.arrow;
  6004. var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {
  6005. width: 0,
  6006. height: 0
  6007. };
  6008. var arrowPaddingObject = state.modifiersData["arrow#persistent"] ? state.modifiersData["arrow#persistent"].padding : getFreshSideObject();
  6009. var arrowPaddingMin = arrowPaddingObject[mainSide];
  6010. var arrowPaddingMax = arrowPaddingObject[altSide];
  6011. var arrowLen = within(0, referenceRect[len], arrowRect[len]);
  6012. var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;
  6013. var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;
  6014. var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
  6015. var clientOffset = arrowOffsetParent ? mainAxis === "y" ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
  6016. var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;
  6017. var tetherMin = offset2 + minOffset - offsetModifierValue - clientOffset;
  6018. var tetherMax = offset2 + maxOffset - offsetModifierValue;
  6019. var preventedOffset = within(tether ? min(min$1, tetherMin) : min$1, offset2, tether ? max(max$1, tetherMax) : max$1);
  6020. popperOffsets2[mainAxis] = preventedOffset;
  6021. data2[mainAxis] = preventedOffset - offset2;
  6022. }
  6023. if (checkAltAxis) {
  6024. var _offsetModifierState$2;
  6025. var _mainSide = mainAxis === "x" ? top : left;
  6026. var _altSide = mainAxis === "x" ? bottom : right;
  6027. var _offset = popperOffsets2[altAxis];
  6028. var _len = altAxis === "y" ? "height" : "width";
  6029. var _min = _offset + overflow[_mainSide];
  6030. var _max = _offset - overflow[_altSide];
  6031. var isOriginSide = [top, left].indexOf(basePlacement) !== -1;
  6032. var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;
  6033. var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;
  6034. var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;
  6035. var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);
  6036. popperOffsets2[altAxis] = _preventedOffset;
  6037. data2[altAxis] = _preventedOffset - _offset;
  6038. }
  6039. state.modifiersData[name] = data2;
  6040. }
  6041. var preventOverflow$1 = {
  6042. name: "preventOverflow",
  6043. enabled: true,
  6044. phase: "main",
  6045. fn: preventOverflow,
  6046. requiresIfExists: ["offset"]
  6047. };
  6048. function getHTMLElementScroll(element) {
  6049. return {
  6050. scrollLeft: element.scrollLeft,
  6051. scrollTop: element.scrollTop
  6052. };
  6053. }
  6054. function getNodeScroll(node) {
  6055. if (node === getWindow(node) || !isHTMLElement(node)) {
  6056. return getWindowScroll(node);
  6057. } else {
  6058. return getHTMLElementScroll(node);
  6059. }
  6060. }
  6061. function isElementScaled(element) {
  6062. var rect = element.getBoundingClientRect();
  6063. var scaleX = round(rect.width) / element.offsetWidth || 1;
  6064. var scaleY = round(rect.height) / element.offsetHeight || 1;
  6065. return scaleX !== 1 || scaleY !== 1;
  6066. }
  6067. function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
  6068. if (isFixed === void 0) {
  6069. isFixed = false;
  6070. }
  6071. var isOffsetParentAnElement = isHTMLElement(offsetParent);
  6072. var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
  6073. var documentElement = getDocumentElement(offsetParent);
  6074. var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled);
  6075. var scroll = {
  6076. scrollLeft: 0,
  6077. scrollTop: 0
  6078. };
  6079. var offsets = {
  6080. x: 0,
  6081. y: 0
  6082. };
  6083. if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
  6084. if (getNodeName(offsetParent) !== "body" || isScrollParent(documentElement)) {
  6085. scroll = getNodeScroll(offsetParent);
  6086. }
  6087. if (isHTMLElement(offsetParent)) {
  6088. offsets = getBoundingClientRect(offsetParent, true);
  6089. offsets.x += offsetParent.clientLeft;
  6090. offsets.y += offsetParent.clientTop;
  6091. } else if (documentElement) {
  6092. offsets.x = getWindowScrollBarX(documentElement);
  6093. }
  6094. }
  6095. return {
  6096. x: rect.left + scroll.scrollLeft - offsets.x,
  6097. y: rect.top + scroll.scrollTop - offsets.y,
  6098. width: rect.width,
  6099. height: rect.height
  6100. };
  6101. }
  6102. function order(modifiers) {
  6103. var map = /* @__PURE__ */ new Map();
  6104. var visited = /* @__PURE__ */ new Set();
  6105. var result = [];
  6106. modifiers.forEach(function(modifier) {
  6107. map.set(modifier.name, modifier);
  6108. });
  6109. function sort(modifier) {
  6110. visited.add(modifier.name);
  6111. var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);
  6112. requires.forEach(function(dep) {
  6113. if (!visited.has(dep)) {
  6114. var depModifier = map.get(dep);
  6115. if (depModifier) {
  6116. sort(depModifier);
  6117. }
  6118. }
  6119. });
  6120. result.push(modifier);
  6121. }
  6122. modifiers.forEach(function(modifier) {
  6123. if (!visited.has(modifier.name)) {
  6124. sort(modifier);
  6125. }
  6126. });
  6127. return result;
  6128. }
  6129. function orderModifiers(modifiers) {
  6130. var orderedModifiers = order(modifiers);
  6131. return modifierPhases.reduce(function(acc, phase) {
  6132. return acc.concat(orderedModifiers.filter(function(modifier) {
  6133. return modifier.phase === phase;
  6134. }));
  6135. }, []);
  6136. }
  6137. function debounce(fn2) {
  6138. var pending;
  6139. return function() {
  6140. if (!pending) {
  6141. pending = new Promise(function(resolve) {
  6142. Promise.resolve().then(function() {
  6143. pending = void 0;
  6144. resolve(fn2());
  6145. });
  6146. });
  6147. }
  6148. return pending;
  6149. };
  6150. }
  6151. function mergeByName(modifiers) {
  6152. var merged = modifiers.reduce(function(merged2, current) {
  6153. var existing = merged2[current.name];
  6154. merged2[current.name] = existing ? Object.assign({}, existing, current, {
  6155. options: Object.assign({}, existing.options, current.options),
  6156. data: Object.assign({}, existing.data, current.data)
  6157. }) : current;
  6158. return merged2;
  6159. }, {});
  6160. return Object.keys(merged).map(function(key) {
  6161. return merged[key];
  6162. });
  6163. }
  6164. var DEFAULT_OPTIONS = {
  6165. placement: "bottom",
  6166. modifiers: [],
  6167. strategy: "absolute"
  6168. };
  6169. function areValidElements() {
  6170. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  6171. args[_key] = arguments[_key];
  6172. }
  6173. return !args.some(function(element) {
  6174. return !(element && typeof element.getBoundingClientRect === "function");
  6175. });
  6176. }
  6177. function popperGenerator(generatorOptions) {
  6178. if (generatorOptions === void 0) {
  6179. generatorOptions = {};
  6180. }
  6181. var _generatorOptions = generatorOptions, _generatorOptions$def = _generatorOptions.defaultModifiers, defaultModifiers2 = _generatorOptions$def === void 0 ? [] : _generatorOptions$def, _generatorOptions$def2 = _generatorOptions.defaultOptions, defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;
  6182. return function createPopper2(reference2, popper2, options) {
  6183. if (options === void 0) {
  6184. options = defaultOptions;
  6185. }
  6186. var state = {
  6187. placement: "bottom",
  6188. orderedModifiers: [],
  6189. options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
  6190. modifiersData: {},
  6191. elements: {
  6192. reference: reference2,
  6193. popper: popper2
  6194. },
  6195. attributes: {},
  6196. styles: {}
  6197. };
  6198. var effectCleanupFns = [];
  6199. var isDestroyed = false;
  6200. var instance = {
  6201. state,
  6202. setOptions: function setOptions(setOptionsAction) {
  6203. var options2 = typeof setOptionsAction === "function" ? setOptionsAction(state.options) : setOptionsAction;
  6204. cleanupModifierEffects();
  6205. state.options = Object.assign({}, defaultOptions, state.options, options2);
  6206. state.scrollParents = {
  6207. reference: isElement(reference2) ? listScrollParents(reference2) : reference2.contextElement ? listScrollParents(reference2.contextElement) : [],
  6208. popper: listScrollParents(popper2)
  6209. };
  6210. var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers2, state.options.modifiers)));
  6211. state.orderedModifiers = orderedModifiers.filter(function(m2) {
  6212. return m2.enabled;
  6213. });
  6214. runModifierEffects();
  6215. return instance.update();
  6216. },
  6217. forceUpdate: function forceUpdate() {
  6218. if (isDestroyed) {
  6219. return;
  6220. }
  6221. var _state$elements = state.elements, reference3 = _state$elements.reference, popper3 = _state$elements.popper;
  6222. if (!areValidElements(reference3, popper3)) {
  6223. return;
  6224. }
  6225. state.rects = {
  6226. reference: getCompositeRect(reference3, getOffsetParent(popper3), state.options.strategy === "fixed"),
  6227. popper: getLayoutRect(popper3)
  6228. };
  6229. state.reset = false;
  6230. state.placement = state.options.placement;
  6231. state.orderedModifiers.forEach(function(modifier) {
  6232. return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
  6233. });
  6234. for (var index = 0; index < state.orderedModifiers.length; index++) {
  6235. if (state.reset === true) {
  6236. state.reset = false;
  6237. index = -1;
  6238. continue;
  6239. }
  6240. var _state$orderedModifie = state.orderedModifiers[index], fn2 = _state$orderedModifie.fn, _state$orderedModifie2 = _state$orderedModifie.options, _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2, name = _state$orderedModifie.name;
  6241. if (typeof fn2 === "function") {
  6242. state = fn2({
  6243. state,
  6244. options: _options,
  6245. name,
  6246. instance
  6247. }) || state;
  6248. }
  6249. }
  6250. },
  6251. update: debounce(function() {
  6252. return new Promise(function(resolve) {
  6253. instance.forceUpdate();
  6254. resolve(state);
  6255. });
  6256. }),
  6257. destroy: function destroy() {
  6258. cleanupModifierEffects();
  6259. isDestroyed = true;
  6260. }
  6261. };
  6262. if (!areValidElements(reference2, popper2)) {
  6263. return instance;
  6264. }
  6265. instance.setOptions(options).then(function(state2) {
  6266. if (!isDestroyed && options.onFirstUpdate) {
  6267. options.onFirstUpdate(state2);
  6268. }
  6269. });
  6270. function runModifierEffects() {
  6271. state.orderedModifiers.forEach(function(_ref3) {
  6272. var name = _ref3.name, _ref3$options = _ref3.options, options2 = _ref3$options === void 0 ? {} : _ref3$options, effect2 = _ref3.effect;
  6273. if (typeof effect2 === "function") {
  6274. var cleanupFn = effect2({
  6275. state,
  6276. name,
  6277. instance,
  6278. options: options2
  6279. });
  6280. var noopFn = function noopFn2() {
  6281. };
  6282. effectCleanupFns.push(cleanupFn || noopFn);
  6283. }
  6284. });
  6285. }
  6286. function cleanupModifierEffects() {
  6287. effectCleanupFns.forEach(function(fn2) {
  6288. return fn2();
  6289. });
  6290. effectCleanupFns = [];
  6291. }
  6292. return instance;
  6293. };
  6294. }
  6295. var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$1];
  6296. var createPopper = /* @__PURE__ */ popperGenerator({
  6297. defaultModifiers
  6298. });
  6299. const POSITIONING_STRATEGIES = ["fixed", "absolute"];
  6300. const usePopperCoreConfigProps = buildProps({
  6301. boundariesPadding: {
  6302. type: Number,
  6303. default: 0
  6304. },
  6305. fallbackPlacements: {
  6306. type: definePropType(Array),
  6307. default: () => []
  6308. },
  6309. gpuAcceleration: {
  6310. type: Boolean,
  6311. default: true
  6312. },
  6313. offset: {
  6314. type: Number,
  6315. default: 12
  6316. },
  6317. placement: {
  6318. type: String,
  6319. values: placements,
  6320. default: "bottom"
  6321. },
  6322. popperOptions: {
  6323. type: definePropType(Object),
  6324. default: () => ({})
  6325. },
  6326. strategy: {
  6327. type: String,
  6328. values: POSITIONING_STRATEGIES,
  6329. default: "absolute"
  6330. }
  6331. });
  6332. const usePopperContentProps = buildProps(__spreadProps(__spreadValues({}, usePopperCoreConfigProps), {
  6333. style: { type: definePropType([String, Array, Object]) },
  6334. className: { type: definePropType([String, Array, Object]) },
  6335. effect: {
  6336. type: String,
  6337. default: "dark"
  6338. },
  6339. visible: Boolean,
  6340. enterable: {
  6341. type: Boolean,
  6342. default: true
  6343. },
  6344. pure: Boolean,
  6345. popperClass: {
  6346. type: definePropType([String, Array, Object])
  6347. },
  6348. popperStyle: {
  6349. type: definePropType([String, Array, Object])
  6350. },
  6351. referenceEl: {
  6352. type: definePropType(Object)
  6353. },
  6354. stopPopperMouseEvent: {
  6355. type: Boolean,
  6356. default: true
  6357. },
  6358. zIndex: Number
  6359. }));
  6360. const buildPopperOptions = (props, arrowProps) => {
  6361. const { placement, strategy, popperOptions: popperOptions2 } = props;
  6362. const options = __spreadProps(__spreadValues({
  6363. placement,
  6364. strategy
  6365. }, popperOptions2), {
  6366. modifiers: genModifiers(props)
  6367. });
  6368. attachArrow(options, arrowProps);
  6369. deriveExtraModifiers(options, popperOptions2 == null ? void 0 : popperOptions2.modifiers);
  6370. return options;
  6371. };
  6372. const unwrapMeasurableEl = ($el) => {
  6373. if (!isClient$1)
  6374. return;
  6375. return unrefElement($el);
  6376. };
  6377. function genModifiers(options) {
  6378. const { offset: offset2, gpuAcceleration, fallbackPlacements } = options;
  6379. return [
  6380. {
  6381. name: "offset",
  6382. options: {
  6383. offset: [0, offset2 != null ? offset2 : 12]
  6384. }
  6385. },
  6386. {
  6387. name: "preventOverflow",
  6388. options: {
  6389. padding: {
  6390. top: 2,
  6391. bottom: 2,
  6392. left: 5,
  6393. right: 5
  6394. }
  6395. }
  6396. },
  6397. {
  6398. name: "flip",
  6399. options: {
  6400. padding: 5,
  6401. fallbackPlacements: fallbackPlacements != null ? fallbackPlacements : []
  6402. }
  6403. },
  6404. {
  6405. name: "computeStyles",
  6406. options: {
  6407. gpuAcceleration,
  6408. adaptive: gpuAcceleration
  6409. }
  6410. }
  6411. ];
  6412. }
  6413. function attachArrow(options, { arrowEl, arrowOffset }) {
  6414. options.modifiers.push({
  6415. name: "arrow",
  6416. options: {
  6417. element: arrowEl,
  6418. padding: arrowOffset != null ? arrowOffset : 5
  6419. }
  6420. });
  6421. }
  6422. function deriveExtraModifiers(options, modifiers) {
  6423. if (modifiers) {
  6424. options.modifiers = [...options.modifiers, ...modifiers != null ? modifiers : []];
  6425. }
  6426. }
  6427. const __default__$g = {
  6428. name: "ElPopperContent"
  6429. };
  6430. const _sfc_main$Z = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$g), {
  6431. props: usePopperContentProps,
  6432. emits: ["mouseenter", "mouseleave"],
  6433. setup(__props, { expose }) {
  6434. const props = __props;
  6435. const { popperInstanceRef, contentRef, triggerRef: triggerRef2 } = inject(POPPER_INJECTION_KEY, void 0);
  6436. const { nextZIndex } = useZIndex();
  6437. const ns = useNamespace("popper");
  6438. const popperContentRef = ref();
  6439. const arrowRef = ref();
  6440. const arrowOffset = ref();
  6441. provide(POPPER_CONTENT_INJECTION_KEY, {
  6442. arrowRef,
  6443. arrowOffset
  6444. });
  6445. const contentZIndex = ref(props.zIndex || nextZIndex());
  6446. const computedReference = computed(() => unwrapMeasurableEl(props.referenceEl) || unref(triggerRef2));
  6447. const contentStyle = computed(() => [{ zIndex: unref(contentZIndex) }, props.popperStyle]);
  6448. const contentClass = computed(() => [
  6449. ns.b(),
  6450. ns.is("pure", props.pure),
  6451. ns.is(props.effect),
  6452. props.popperClass
  6453. ]);
  6454. const createPopperInstance = ({ referenceEl, popperContentEl, arrowEl }) => {
  6455. const options = buildPopperOptions(props, {
  6456. arrowEl,
  6457. arrowOffset: unref(arrowOffset)
  6458. });
  6459. return createPopper(referenceEl, popperContentEl, options);
  6460. };
  6461. const updatePopper = (shouldUpdateZIndex = true) => {
  6462. var _a2;
  6463. (_a2 = unref(popperInstanceRef)) == null ? void 0 : _a2.update();
  6464. shouldUpdateZIndex && (contentZIndex.value = props.zIndex || nextZIndex());
  6465. };
  6466. const togglePopperAlive = () => {
  6467. var _a2, _b2;
  6468. const monitorable = { name: "eventListeners", enabled: props.visible };
  6469. (_b2 = (_a2 = unref(popperInstanceRef)) == null ? void 0 : _a2.setOptions) == null ? void 0 : _b2.call(_a2, (options) => __spreadProps(__spreadValues({}, options), {
  6470. modifiers: [...options.modifiers || [], monitorable]
  6471. }));
  6472. updatePopper(false);
  6473. };
  6474. onMounted(() => {
  6475. let updateHandle;
  6476. watch(computedReference, (referenceEl) => {
  6477. var _a2;
  6478. updateHandle == null ? void 0 : updateHandle();
  6479. const popperInstance = unref(popperInstanceRef);
  6480. (_a2 = popperInstance == null ? void 0 : popperInstance.destroy) == null ? void 0 : _a2.call(popperInstance);
  6481. if (referenceEl) {
  6482. const popperContentEl = unref(popperContentRef);
  6483. contentRef.value = popperContentEl;
  6484. popperInstanceRef.value = createPopperInstance({
  6485. referenceEl,
  6486. popperContentEl,
  6487. arrowEl: unref(arrowRef)
  6488. });
  6489. updateHandle = watch(() => referenceEl.getBoundingClientRect(), () => updatePopper(), {
  6490. immediate: true
  6491. });
  6492. } else {
  6493. popperInstanceRef.value = void 0;
  6494. }
  6495. }, {
  6496. immediate: true
  6497. });
  6498. watch(() => props.visible, togglePopperAlive, { immediate: true });
  6499. watch(() => buildPopperOptions(props, {
  6500. arrowEl: unref(arrowRef),
  6501. arrowOffset: unref(arrowOffset)
  6502. }), (option) => {
  6503. var _a2;
  6504. return (_a2 = popperInstanceRef.value) == null ? void 0 : _a2.setOptions(option);
  6505. });
  6506. });
  6507. expose({
  6508. popperContentRef,
  6509. popperInstanceRef,
  6510. updatePopper,
  6511. contentStyle
  6512. });
  6513. return (_ctx, _cache) => {
  6514. return openBlock(), createElementBlock("div", {
  6515. ref_key: "popperContentRef",
  6516. ref: popperContentRef,
  6517. style: normalizeStyle(unref(contentStyle)),
  6518. class: normalizeClass(unref(contentClass)),
  6519. role: "tooltip",
  6520. onMouseenter: _cache[0] || (_cache[0] = (e) => _ctx.$emit("mouseenter", e)),
  6521. onMouseleave: _cache[1] || (_cache[1] = (e) => _ctx.$emit("mouseleave", e))
  6522. }, [
  6523. renderSlot(_ctx.$slots, "default")
  6524. ], 38);
  6525. };
  6526. }
  6527. }));
  6528. var ElPopperContent = /* @__PURE__ */ _export_sfc$1(_sfc_main$Z, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/popper/src/content.vue"]]);
  6529. function useDeprecateAppendToBody(scope, from) {
  6530. const vm = getCurrentInstance();
  6531. const compatTeleported = computed(() => {
  6532. return isBoolean(vm.props[from]) ? vm.props[from] : vm.props.teleported;
  6533. });
  6534. useDeprecated({
  6535. scope,
  6536. from,
  6537. replacement: "teleported",
  6538. version: "2.1.0",
  6539. ref: "https://element-plus.org/en-US/component/tooltip.html#attributes"
  6540. }, computed(() => isBoolean(vm.props[from])));
  6541. return {
  6542. compatTeleported
  6543. };
  6544. }
  6545. const ElPopper = withInstall(Popper);
  6546. const _sfc_main$Y = defineComponent({
  6547. name: "ElVisuallyHidden",
  6548. props: {
  6549. style: {
  6550. type: [String, Object, Array]
  6551. }
  6552. },
  6553. setup(props) {
  6554. return {
  6555. computedStyle: computed(() => {
  6556. return [
  6557. props.style,
  6558. {
  6559. position: "absolute",
  6560. border: 0,
  6561. width: 1,
  6562. height: 1,
  6563. padding: 0,
  6564. margin: -1,
  6565. overflow: "hidden",
  6566. clip: "rect(0, 0, 0, 0)",
  6567. whiteSpace: "nowrap",
  6568. wordWrap: "normal"
  6569. }
  6570. ];
  6571. })
  6572. };
  6573. }
  6574. });
  6575. function _sfc_render$A(_ctx, _cache, $props, $setup, $data, $options) {
  6576. return openBlock(), createElementBlock("span", mergeProps(_ctx.$attrs, { style: _ctx.computedStyle }), [
  6577. renderSlot(_ctx.$slots, "default")
  6578. ], 16);
  6579. }
  6580. var ElVisuallyHidden = /* @__PURE__ */ _export_sfc$1(_sfc_main$Y, [["render", _sfc_render$A], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/visual-hidden/src/visual-hidden.vue"]]);
  6581. const useTooltipContentProps = buildProps(__spreadProps(__spreadValues(__spreadValues({}, useDelayedToggleProps), usePopperContentProps), {
  6582. appendTo: {
  6583. type: definePropType([String, Object]),
  6584. default: POPPER_CONTAINER_SELECTOR
  6585. },
  6586. content: {
  6587. type: String,
  6588. default: ""
  6589. },
  6590. rawContent: {
  6591. type: Boolean,
  6592. default: false
  6593. },
  6594. persistent: Boolean,
  6595. ariaLabel: String,
  6596. visible: {
  6597. type: definePropType(Boolean),
  6598. default: null
  6599. },
  6600. transition: {
  6601. type: String,
  6602. default: "el-fade-in-linear"
  6603. },
  6604. teleported: {
  6605. type: Boolean,
  6606. default: true
  6607. },
  6608. disabled: {
  6609. type: Boolean
  6610. }
  6611. }));
  6612. const useTooltipTriggerProps = buildProps(__spreadProps(__spreadValues({}, usePopperTriggerProps), {
  6613. disabled: Boolean,
  6614. trigger: {
  6615. type: definePropType([String, Array]),
  6616. default: "hover"
  6617. }
  6618. }));
  6619. const useTooltipProps = buildProps({
  6620. openDelay: {
  6621. type: Number
  6622. },
  6623. visibleArrow: {
  6624. type: Boolean,
  6625. default: void 0
  6626. },
  6627. hideAfter: {
  6628. type: Number,
  6629. default: 200
  6630. },
  6631. showArrow: {
  6632. type: Boolean,
  6633. default: true
  6634. }
  6635. });
  6636. const TOOLTIP_INJECTION_KEY = Symbol("elTooltip");
  6637. const _sfc_main$X = defineComponent({
  6638. name: "ElTooltipContent",
  6639. components: {
  6640. ElPopperContent,
  6641. ElVisuallyHidden
  6642. },
  6643. inheritAttrs: false,
  6644. props: useTooltipContentProps,
  6645. setup(props) {
  6646. const contentRef = ref(null);
  6647. const intermediateOpen = ref(false);
  6648. const entering = ref(false);
  6649. const leaving = ref(false);
  6650. const destroyed = ref(false);
  6651. const {
  6652. controlled,
  6653. id,
  6654. open,
  6655. trigger,
  6656. onClose,
  6657. onOpen,
  6658. onShow,
  6659. onHide,
  6660. onBeforeShow,
  6661. onBeforeHide
  6662. } = inject(TOOLTIP_INJECTION_KEY, void 0);
  6663. const persistentRef = computed(() => {
  6664. return props.persistent;
  6665. });
  6666. onBeforeUnmount(() => {
  6667. destroyed.value = true;
  6668. });
  6669. const shouldRender = computed(() => {
  6670. return unref(persistentRef) ? true : unref(open);
  6671. });
  6672. const shouldShow = computed(() => {
  6673. return props.disabled ? false : unref(open);
  6674. });
  6675. const contentStyle = computed(() => {
  6676. var _a2;
  6677. return (_a2 = props.style) != null ? _a2 : {};
  6678. });
  6679. const ariaHidden = computed(() => !unref(open));
  6680. useEscapeKeydown(onClose);
  6681. const onTransitionLeave = () => {
  6682. onHide();
  6683. };
  6684. const stopWhenControlled = () => {
  6685. if (unref(controlled))
  6686. return true;
  6687. };
  6688. const onContentEnter = composeEventHandlers(stopWhenControlled, () => {
  6689. if (props.enterable && unref(trigger) === "hover") {
  6690. onOpen();
  6691. }
  6692. });
  6693. const onContentLeave = composeEventHandlers(stopWhenControlled, () => {
  6694. if (unref(trigger) === "hover") {
  6695. onClose();
  6696. }
  6697. });
  6698. const onBeforeEnter = () => {
  6699. var _a2, _b2;
  6700. (_b2 = (_a2 = contentRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b2.call(_a2);
  6701. onBeforeShow == null ? void 0 : onBeforeShow();
  6702. };
  6703. const onBeforeLeave = () => {
  6704. onBeforeHide == null ? void 0 : onBeforeHide();
  6705. };
  6706. const onAfterShow = () => {
  6707. onShow();
  6708. };
  6709. let stopHandle;
  6710. watch(() => unref(open), (val) => {
  6711. if (val) {
  6712. stopHandle = onClickOutside(computed(() => {
  6713. var _a2;
  6714. return (_a2 = contentRef.value) == null ? void 0 : _a2.popperContentRef;
  6715. }), () => {
  6716. if (unref(controlled))
  6717. return;
  6718. const $trigger = unref(trigger);
  6719. if ($trigger !== "hover") {
  6720. onClose();
  6721. }
  6722. });
  6723. } else {
  6724. stopHandle == null ? void 0 : stopHandle();
  6725. }
  6726. }, {
  6727. flush: "post"
  6728. });
  6729. return {
  6730. ariaHidden,
  6731. entering,
  6732. leaving,
  6733. id,
  6734. intermediateOpen,
  6735. contentStyle,
  6736. contentRef,
  6737. destroyed,
  6738. shouldRender,
  6739. shouldShow,
  6740. open,
  6741. onAfterShow,
  6742. onBeforeEnter,
  6743. onBeforeLeave,
  6744. onContentEnter,
  6745. onContentLeave,
  6746. onTransitionLeave
  6747. };
  6748. }
  6749. });
  6750. function _sfc_render$z(_ctx, _cache, $props, $setup, $data, $options) {
  6751. const _component_el_visually_hidden = resolveComponent("el-visually-hidden");
  6752. const _component_el_popper_content = resolveComponent("el-popper-content");
  6753. return openBlock(), createBlock(Teleport, {
  6754. disabled: !_ctx.teleported,
  6755. to: _ctx.appendTo
  6756. }, [
  6757. createVNode(Transition, {
  6758. name: _ctx.transition,
  6759. onAfterLeave: _ctx.onTransitionLeave,
  6760. onBeforeEnter: _ctx.onBeforeEnter,
  6761. onAfterEnter: _ctx.onAfterShow,
  6762. onBeforeLeave: _ctx.onBeforeLeave
  6763. }, {
  6764. default: withCtx(() => [
  6765. _ctx.shouldRender ? withDirectives((openBlock(), createBlock(_component_el_popper_content, mergeProps({
  6766. key: 0,
  6767. ref: "contentRef"
  6768. }, _ctx.$attrs, {
  6769. "aria-hidden": _ctx.ariaHidden,
  6770. "boundaries-padding": _ctx.boundariesPadding,
  6771. "fallback-placements": _ctx.fallbackPlacements,
  6772. "gpu-acceleration": _ctx.gpuAcceleration,
  6773. offset: _ctx.offset,
  6774. placement: _ctx.placement,
  6775. "popper-options": _ctx.popperOptions,
  6776. strategy: _ctx.strategy,
  6777. effect: _ctx.effect,
  6778. enterable: _ctx.enterable,
  6779. pure: _ctx.pure,
  6780. "popper-class": _ctx.popperClass,
  6781. "popper-style": [_ctx.popperStyle, _ctx.contentStyle],
  6782. "reference-el": _ctx.referenceEl,
  6783. visible: _ctx.shouldShow,
  6784. "z-index": _ctx.zIndex,
  6785. onMouseenter: _ctx.onContentEnter,
  6786. onMouseleave: _ctx.onContentLeave
  6787. }), {
  6788. default: withCtx(() => [
  6789. createCommentVNode(" Workaround bug #6378 "),
  6790. !_ctx.destroyed ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  6791. renderSlot(_ctx.$slots, "default"),
  6792. createVNode(_component_el_visually_hidden, {
  6793. id: _ctx.id,
  6794. role: "tooltip"
  6795. }, {
  6796. default: withCtx(() => [
  6797. createTextVNode(toDisplayString(_ctx.ariaLabel), 1)
  6798. ]),
  6799. _: 1
  6800. }, 8, ["id"])
  6801. ], 64)) : createCommentVNode("v-if", true)
  6802. ]),
  6803. _: 3
  6804. }, 16, ["aria-hidden", "boundaries-padding", "fallback-placements", "gpu-acceleration", "offset", "placement", "popper-options", "strategy", "effect", "enterable", "pure", "popper-class", "popper-style", "reference-el", "visible", "z-index", "onMouseenter", "onMouseleave"])), [
  6805. [vShow, _ctx.shouldShow]
  6806. ]) : createCommentVNode("v-if", true)
  6807. ]),
  6808. _: 3
  6809. }, 8, ["name", "onAfterLeave", "onBeforeEnter", "onAfterEnter", "onBeforeLeave"])
  6810. ], 8, ["disabled", "to"]);
  6811. }
  6812. var ElTooltipContent = /* @__PURE__ */ _export_sfc$1(_sfc_main$X, [["render", _sfc_render$z], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/tooltip/src/content.vue"]]);
  6813. const isTriggerType = (trigger, type4) => {
  6814. if (isArray(trigger)) {
  6815. return trigger.includes(type4);
  6816. }
  6817. return trigger === type4;
  6818. };
  6819. const whenTrigger = (trigger, type4, handler3) => {
  6820. return (e) => {
  6821. isTriggerType(unref(trigger), type4) && handler3(e);
  6822. };
  6823. };
  6824. const _sfc_main$W = defineComponent({
  6825. name: "ElTooltipTrigger",
  6826. components: {
  6827. ElPopperTrigger
  6828. },
  6829. props: useTooltipTriggerProps,
  6830. setup(props) {
  6831. const ns = useNamespace("tooltip");
  6832. const { controlled, id, open, onOpen, onClose, onToggle } = inject(TOOLTIP_INJECTION_KEY, void 0);
  6833. const triggerRef2 = ref(null);
  6834. const stopWhenControlledOrDisabled = () => {
  6835. if (unref(controlled) || props.disabled) {
  6836. return true;
  6837. }
  6838. };
  6839. const trigger = toRef(props, "trigger");
  6840. const onMouseenter = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "hover", onOpen));
  6841. const onMouseleave = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "hover", onClose));
  6842. const onClick = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "click", (e) => {
  6843. if (e.button === 0) {
  6844. onToggle(e);
  6845. }
  6846. }));
  6847. const onFocus = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "focus", onOpen));
  6848. const onBlur = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "focus", onClose));
  6849. const onContextMenu = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "contextmenu", (e) => {
  6850. e.preventDefault();
  6851. onToggle(e);
  6852. }));
  6853. const onKeydown = composeEventHandlers(stopWhenControlledOrDisabled, (e) => {
  6854. const { code } = e;
  6855. if (code === EVENT_CODE.enter || code === EVENT_CODE.space) {
  6856. onToggle(e);
  6857. }
  6858. });
  6859. return {
  6860. onBlur,
  6861. onContextMenu,
  6862. onFocus,
  6863. onMouseenter,
  6864. onMouseleave,
  6865. onClick,
  6866. onKeydown,
  6867. open,
  6868. id,
  6869. triggerRef: triggerRef2,
  6870. ns
  6871. };
  6872. }
  6873. });
  6874. function _sfc_render$y(_ctx, _cache, $props, $setup, $data, $options) {
  6875. const _component_el_popper_trigger = resolveComponent("el-popper-trigger");
  6876. return openBlock(), createBlock(_component_el_popper_trigger, {
  6877. id: _ctx.id,
  6878. "virtual-ref": _ctx.virtualRef,
  6879. open: _ctx.open,
  6880. "virtual-triggering": _ctx.virtualTriggering,
  6881. class: normalizeClass(_ctx.ns.e("trigger")),
  6882. onBlur: _ctx.onBlur,
  6883. onClick: _ctx.onClick,
  6884. onContextmenu: _ctx.onContextMenu,
  6885. onFocus: _ctx.onFocus,
  6886. onMouseenter: _ctx.onMouseenter,
  6887. onMouseleave: _ctx.onMouseleave,
  6888. onKeydown: _ctx.onKeydown
  6889. }, {
  6890. default: withCtx(() => [
  6891. renderSlot(_ctx.$slots, "default")
  6892. ]),
  6893. _: 3
  6894. }, 8, ["id", "virtual-ref", "open", "virtual-triggering", "class", "onBlur", "onClick", "onContextmenu", "onFocus", "onMouseenter", "onMouseleave", "onKeydown"]);
  6895. }
  6896. var ElTooltipTrigger = /* @__PURE__ */ _export_sfc$1(_sfc_main$W, [["render", _sfc_render$y], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/tooltip/src/trigger.vue"]]);
  6897. const { useModelToggleProps, useModelToggle, useModelToggleEmits } = createModelToggleComposable("visible");
  6898. const _sfc_main$V = defineComponent({
  6899. name: "ElTooltip",
  6900. components: {
  6901. ElPopper,
  6902. ElPopperArrow,
  6903. ElTooltipContent,
  6904. ElTooltipTrigger
  6905. },
  6906. props: __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, useModelToggleProps), useTooltipContentProps), useTooltipTriggerProps), usePopperArrowProps), useTooltipProps),
  6907. emits: [...useModelToggleEmits, "before-show", "before-hide", "show", "hide"],
  6908. setup(props, { emit }) {
  6909. usePopperContainer();
  6910. const compatShowAfter = computed(() => {
  6911. if (!isUndefined(props.openDelay))
  6912. ;
  6913. return props.openDelay || props.showAfter;
  6914. });
  6915. const compatShowArrow = computed(() => {
  6916. if (!isUndefined(props.visibleArrow))
  6917. ;
  6918. return isBoolean(props.visibleArrow) ? props.visibleArrow : props.showArrow;
  6919. });
  6920. const id = useId();
  6921. const popperRef = ref(null);
  6922. const updatePopper = () => {
  6923. var _a2;
  6924. const popperComponent = unref(popperRef);
  6925. if (popperComponent) {
  6926. (_a2 = popperComponent.popperInstanceRef) == null ? void 0 : _a2.update();
  6927. }
  6928. };
  6929. const open = ref(false);
  6930. const { show, hide: hide2 } = useModelToggle({
  6931. indicator: open
  6932. });
  6933. const { onOpen, onClose } = useDelayedToggle({
  6934. showAfter: compatShowAfter,
  6935. hideAfter: toRef(props, "hideAfter"),
  6936. open: show,
  6937. close: hide2
  6938. });
  6939. const controlled = computed(() => isBoolean(props.visible));
  6940. provide(TOOLTIP_INJECTION_KEY, {
  6941. controlled,
  6942. id,
  6943. open: readonly(open),
  6944. trigger: toRef(props, "trigger"),
  6945. onOpen,
  6946. onClose,
  6947. onToggle: () => {
  6948. if (unref(open)) {
  6949. onClose();
  6950. } else {
  6951. onOpen();
  6952. }
  6953. },
  6954. onShow: () => {
  6955. emit("show");
  6956. },
  6957. onHide: () => {
  6958. emit("hide");
  6959. },
  6960. onBeforeShow: () => {
  6961. emit("before-show");
  6962. },
  6963. onBeforeHide: () => {
  6964. emit("before-hide");
  6965. },
  6966. updatePopper
  6967. });
  6968. watch(() => props.disabled, (disabled) => {
  6969. if (disabled && open.value) {
  6970. open.value = false;
  6971. }
  6972. });
  6973. return {
  6974. compatShowAfter,
  6975. compatShowArrow,
  6976. popperRef,
  6977. open,
  6978. hide: hide2,
  6979. updatePopper,
  6980. onOpen,
  6981. onClose
  6982. };
  6983. }
  6984. });
  6985. const _hoisted_1$B = ["innerHTML"];
  6986. const _hoisted_2$s = { key: 1 };
  6987. function _sfc_render$x(_ctx, _cache, $props, $setup, $data, $options) {
  6988. const _component_el_tooltip_trigger = resolveComponent("el-tooltip-trigger");
  6989. const _component_el_popper_arrow = resolveComponent("el-popper-arrow");
  6990. const _component_el_tooltip_content = resolveComponent("el-tooltip-content");
  6991. const _component_el_popper = resolveComponent("el-popper");
  6992. return openBlock(), createBlock(_component_el_popper, { ref: "popperRef" }, {
  6993. default: withCtx(() => [
  6994. createVNode(_component_el_tooltip_trigger, {
  6995. disabled: _ctx.disabled,
  6996. trigger: _ctx.trigger,
  6997. "virtual-ref": _ctx.virtualRef,
  6998. "virtual-triggering": _ctx.virtualTriggering
  6999. }, {
  7000. default: withCtx(() => [
  7001. _ctx.$slots.default ? renderSlot(_ctx.$slots, "default", { key: 0 }) : createCommentVNode("v-if", true)
  7002. ]),
  7003. _: 3
  7004. }, 8, ["disabled", "trigger", "virtual-ref", "virtual-triggering"]),
  7005. createVNode(_component_el_tooltip_content, {
  7006. "aria-label": _ctx.ariaLabel,
  7007. "boundaries-padding": _ctx.boundariesPadding,
  7008. content: _ctx.content,
  7009. disabled: _ctx.disabled,
  7010. effect: _ctx.effect,
  7011. enterable: _ctx.enterable,
  7012. "fallback-placements": _ctx.fallbackPlacements,
  7013. "hide-after": _ctx.hideAfter,
  7014. "gpu-acceleration": _ctx.gpuAcceleration,
  7015. offset: _ctx.offset,
  7016. persistent: _ctx.persistent,
  7017. "popper-class": _ctx.popperClass,
  7018. "popper-style": _ctx.popperStyle,
  7019. placement: _ctx.placement,
  7020. "popper-options": _ctx.popperOptions,
  7021. pure: _ctx.pure,
  7022. "raw-content": _ctx.rawContent,
  7023. "reference-el": _ctx.referenceEl,
  7024. "show-after": _ctx.compatShowAfter,
  7025. strategy: _ctx.strategy,
  7026. teleported: _ctx.teleported,
  7027. transition: _ctx.transition,
  7028. "z-index": _ctx.zIndex,
  7029. "append-to": _ctx.appendTo
  7030. }, {
  7031. default: withCtx(() => [
  7032. renderSlot(_ctx.$slots, "content", {}, () => [
  7033. _ctx.rawContent ? (openBlock(), createElementBlock("span", {
  7034. key: 0,
  7035. innerHTML: _ctx.content
  7036. }, null, 8, _hoisted_1$B)) : (openBlock(), createElementBlock("span", _hoisted_2$s, toDisplayString(_ctx.content), 1))
  7037. ]),
  7038. _ctx.compatShowArrow ? (openBlock(), createBlock(_component_el_popper_arrow, {
  7039. key: 0,
  7040. "arrow-offset": _ctx.arrowOffset
  7041. }, null, 8, ["arrow-offset"])) : createCommentVNode("v-if", true)
  7042. ]),
  7043. _: 3
  7044. }, 8, ["aria-label", "boundaries-padding", "content", "disabled", "effect", "enterable", "fallback-placements", "hide-after", "gpu-acceleration", "offset", "persistent", "popper-class", "popper-style", "placement", "popper-options", "pure", "raw-content", "reference-el", "show-after", "strategy", "teleported", "transition", "z-index", "append-to"])
  7045. ]),
  7046. _: 3
  7047. }, 512);
  7048. }
  7049. var Tooltip = /* @__PURE__ */ _export_sfc$1(_sfc_main$V, [["render", _sfc_render$x], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/tooltip/src/tooltip.vue"]]);
  7050. const ElTooltip = withInstall(Tooltip);
  7051. const buttonTypes = [
  7052. "default",
  7053. "primary",
  7054. "success",
  7055. "warning",
  7056. "info",
  7057. "danger",
  7058. "text",
  7059. ""
  7060. ];
  7061. const buttonNativeTypes = ["button", "submit", "reset"];
  7062. const buttonProps = buildProps({
  7063. size: useSizeProp,
  7064. disabled: Boolean,
  7065. type: {
  7066. type: String,
  7067. values: buttonTypes,
  7068. default: ""
  7069. },
  7070. icon: {
  7071. type: iconPropType,
  7072. default: ""
  7073. },
  7074. nativeType: {
  7075. type: String,
  7076. values: buttonNativeTypes,
  7077. default: "button"
  7078. },
  7079. loading: Boolean,
  7080. loadingIcon: {
  7081. type: iconPropType,
  7082. default: () => loading
  7083. },
  7084. plain: Boolean,
  7085. autofocus: Boolean,
  7086. round: Boolean,
  7087. circle: Boolean,
  7088. color: String,
  7089. dark: Boolean,
  7090. autoInsertSpace: {
  7091. type: Boolean,
  7092. default: void 0
  7093. }
  7094. });
  7095. const buttonEmits = {
  7096. click: (evt) => evt instanceof MouseEvent
  7097. };
  7098. function bound01(n, max2) {
  7099. if (isOnePointZero(n)) {
  7100. n = "100%";
  7101. }
  7102. var isPercent = isPercentage(n);
  7103. n = max2 === 360 ? n : Math.min(max2, Math.max(0, parseFloat(n)));
  7104. if (isPercent) {
  7105. n = parseInt(String(n * max2), 10) / 100;
  7106. }
  7107. if (Math.abs(n - max2) < 1e-6) {
  7108. return 1;
  7109. }
  7110. if (max2 === 360) {
  7111. n = (n < 0 ? n % max2 + max2 : n % max2) / parseFloat(String(max2));
  7112. } else {
  7113. n = n % max2 / parseFloat(String(max2));
  7114. }
  7115. return n;
  7116. }
  7117. function clamp01(val) {
  7118. return Math.min(1, Math.max(0, val));
  7119. }
  7120. function isOnePointZero(n) {
  7121. return typeof n === "string" && n.indexOf(".") !== -1 && parseFloat(n) === 1;
  7122. }
  7123. function isPercentage(n) {
  7124. return typeof n === "string" && n.indexOf("%") !== -1;
  7125. }
  7126. function boundAlpha(a2) {
  7127. a2 = parseFloat(a2);
  7128. if (isNaN(a2) || a2 < 0 || a2 > 1) {
  7129. a2 = 1;
  7130. }
  7131. return a2;
  7132. }
  7133. function convertToPercentage(n) {
  7134. if (n <= 1) {
  7135. return "".concat(Number(n) * 100, "%");
  7136. }
  7137. return n;
  7138. }
  7139. function pad2(c) {
  7140. return c.length === 1 ? "0" + c : String(c);
  7141. }
  7142. function rgbToRgb(r, g, b2) {
  7143. return {
  7144. r: bound01(r, 255) * 255,
  7145. g: bound01(g, 255) * 255,
  7146. b: bound01(b2, 255) * 255
  7147. };
  7148. }
  7149. function rgbToHsl(r, g, b2) {
  7150. r = bound01(r, 255);
  7151. g = bound01(g, 255);
  7152. b2 = bound01(b2, 255);
  7153. var max2 = Math.max(r, g, b2);
  7154. var min2 = Math.min(r, g, b2);
  7155. var h2 = 0;
  7156. var s2 = 0;
  7157. var l2 = (max2 + min2) / 2;
  7158. if (max2 === min2) {
  7159. s2 = 0;
  7160. h2 = 0;
  7161. } else {
  7162. var d2 = max2 - min2;
  7163. s2 = l2 > 0.5 ? d2 / (2 - max2 - min2) : d2 / (max2 + min2);
  7164. switch (max2) {
  7165. case r:
  7166. h2 = (g - b2) / d2 + (g < b2 ? 6 : 0);
  7167. break;
  7168. case g:
  7169. h2 = (b2 - r) / d2 + 2;
  7170. break;
  7171. case b2:
  7172. h2 = (r - g) / d2 + 4;
  7173. break;
  7174. }
  7175. h2 /= 6;
  7176. }
  7177. return { h: h2, s: s2, l: l2 };
  7178. }
  7179. function hue2rgb(p2, q, t) {
  7180. if (t < 0) {
  7181. t += 1;
  7182. }
  7183. if (t > 1) {
  7184. t -= 1;
  7185. }
  7186. if (t < 1 / 6) {
  7187. return p2 + (q - p2) * (6 * t);
  7188. }
  7189. if (t < 1 / 2) {
  7190. return q;
  7191. }
  7192. if (t < 2 / 3) {
  7193. return p2 + (q - p2) * (2 / 3 - t) * 6;
  7194. }
  7195. return p2;
  7196. }
  7197. function hslToRgb(h2, s2, l2) {
  7198. var r;
  7199. var g;
  7200. var b2;
  7201. h2 = bound01(h2, 360);
  7202. s2 = bound01(s2, 100);
  7203. l2 = bound01(l2, 100);
  7204. if (s2 === 0) {
  7205. g = l2;
  7206. b2 = l2;
  7207. r = l2;
  7208. } else {
  7209. var q = l2 < 0.5 ? l2 * (1 + s2) : l2 + s2 - l2 * s2;
  7210. var p2 = 2 * l2 - q;
  7211. r = hue2rgb(p2, q, h2 + 1 / 3);
  7212. g = hue2rgb(p2, q, h2);
  7213. b2 = hue2rgb(p2, q, h2 - 1 / 3);
  7214. }
  7215. return { r: r * 255, g: g * 255, b: b2 * 255 };
  7216. }
  7217. function rgbToHsv(r, g, b2) {
  7218. r = bound01(r, 255);
  7219. g = bound01(g, 255);
  7220. b2 = bound01(b2, 255);
  7221. var max2 = Math.max(r, g, b2);
  7222. var min2 = Math.min(r, g, b2);
  7223. var h2 = 0;
  7224. var v2 = max2;
  7225. var d2 = max2 - min2;
  7226. var s2 = max2 === 0 ? 0 : d2 / max2;
  7227. if (max2 === min2) {
  7228. h2 = 0;
  7229. } else {
  7230. switch (max2) {
  7231. case r:
  7232. h2 = (g - b2) / d2 + (g < b2 ? 6 : 0);
  7233. break;
  7234. case g:
  7235. h2 = (b2 - r) / d2 + 2;
  7236. break;
  7237. case b2:
  7238. h2 = (r - g) / d2 + 4;
  7239. break;
  7240. }
  7241. h2 /= 6;
  7242. }
  7243. return { h: h2, s: s2, v: v2 };
  7244. }
  7245. function hsvToRgb(h2, s2, v2) {
  7246. h2 = bound01(h2, 360) * 6;
  7247. s2 = bound01(s2, 100);
  7248. v2 = bound01(v2, 100);
  7249. var i = Math.floor(h2);
  7250. var f = h2 - i;
  7251. var p2 = v2 * (1 - s2);
  7252. var q = v2 * (1 - f * s2);
  7253. var t = v2 * (1 - (1 - f) * s2);
  7254. var mod = i % 6;
  7255. var r = [v2, q, p2, p2, t, v2][mod];
  7256. var g = [t, v2, v2, q, p2, p2][mod];
  7257. var b2 = [p2, p2, t, v2, v2, q][mod];
  7258. return { r: r * 255, g: g * 255, b: b2 * 255 };
  7259. }
  7260. function rgbToHex(r, g, b2, allow3Char) {
  7261. var hex2 = [
  7262. pad2(Math.round(r).toString(16)),
  7263. pad2(Math.round(g).toString(16)),
  7264. pad2(Math.round(b2).toString(16))
  7265. ];
  7266. if (allow3Char && hex2[0].startsWith(hex2[0].charAt(1)) && hex2[1].startsWith(hex2[1].charAt(1)) && hex2[2].startsWith(hex2[2].charAt(1))) {
  7267. return hex2[0].charAt(0) + hex2[1].charAt(0) + hex2[2].charAt(0);
  7268. }
  7269. return hex2.join("");
  7270. }
  7271. function rgbaToHex(r, g, b2, a2, allow4Char) {
  7272. var hex2 = [
  7273. pad2(Math.round(r).toString(16)),
  7274. pad2(Math.round(g).toString(16)),
  7275. pad2(Math.round(b2).toString(16)),
  7276. pad2(convertDecimalToHex(a2))
  7277. ];
  7278. if (allow4Char && hex2[0].startsWith(hex2[0].charAt(1)) && hex2[1].startsWith(hex2[1].charAt(1)) && hex2[2].startsWith(hex2[2].charAt(1)) && hex2[3].startsWith(hex2[3].charAt(1))) {
  7279. return hex2[0].charAt(0) + hex2[1].charAt(0) + hex2[2].charAt(0) + hex2[3].charAt(0);
  7280. }
  7281. return hex2.join("");
  7282. }
  7283. function convertDecimalToHex(d2) {
  7284. return Math.round(parseFloat(d2) * 255).toString(16);
  7285. }
  7286. function convertHexToDecimal(h2) {
  7287. return parseIntFromHex(h2) / 255;
  7288. }
  7289. function parseIntFromHex(val) {
  7290. return parseInt(val, 16);
  7291. }
  7292. function numberInputToObject(color) {
  7293. return {
  7294. r: color >> 16,
  7295. g: (color & 65280) >> 8,
  7296. b: color & 255
  7297. };
  7298. }
  7299. var names = {
  7300. aliceblue: "#f0f8ff",
  7301. antiquewhite: "#faebd7",
  7302. aqua: "#00ffff",
  7303. aquamarine: "#7fffd4",
  7304. azure: "#f0ffff",
  7305. beige: "#f5f5dc",
  7306. bisque: "#ffe4c4",
  7307. black: "#000000",
  7308. blanchedalmond: "#ffebcd",
  7309. blue: "#0000ff",
  7310. blueviolet: "#8a2be2",
  7311. brown: "#a52a2a",
  7312. burlywood: "#deb887",
  7313. cadetblue: "#5f9ea0",
  7314. chartreuse: "#7fff00",
  7315. chocolate: "#d2691e",
  7316. coral: "#ff7f50",
  7317. cornflowerblue: "#6495ed",
  7318. cornsilk: "#fff8dc",
  7319. crimson: "#dc143c",
  7320. cyan: "#00ffff",
  7321. darkblue: "#00008b",
  7322. darkcyan: "#008b8b",
  7323. darkgoldenrod: "#b8860b",
  7324. darkgray: "#a9a9a9",
  7325. darkgreen: "#006400",
  7326. darkgrey: "#a9a9a9",
  7327. darkkhaki: "#bdb76b",
  7328. darkmagenta: "#8b008b",
  7329. darkolivegreen: "#556b2f",
  7330. darkorange: "#ff8c00",
  7331. darkorchid: "#9932cc",
  7332. darkred: "#8b0000",
  7333. darksalmon: "#e9967a",
  7334. darkseagreen: "#8fbc8f",
  7335. darkslateblue: "#483d8b",
  7336. darkslategray: "#2f4f4f",
  7337. darkslategrey: "#2f4f4f",
  7338. darkturquoise: "#00ced1",
  7339. darkviolet: "#9400d3",
  7340. deeppink: "#ff1493",
  7341. deepskyblue: "#00bfff",
  7342. dimgray: "#696969",
  7343. dimgrey: "#696969",
  7344. dodgerblue: "#1e90ff",
  7345. firebrick: "#b22222",
  7346. floralwhite: "#fffaf0",
  7347. forestgreen: "#228b22",
  7348. fuchsia: "#ff00ff",
  7349. gainsboro: "#dcdcdc",
  7350. ghostwhite: "#f8f8ff",
  7351. goldenrod: "#daa520",
  7352. gold: "#ffd700",
  7353. gray: "#808080",
  7354. green: "#008000",
  7355. greenyellow: "#adff2f",
  7356. grey: "#808080",
  7357. honeydew: "#f0fff0",
  7358. hotpink: "#ff69b4",
  7359. indianred: "#cd5c5c",
  7360. indigo: "#4b0082",
  7361. ivory: "#fffff0",
  7362. khaki: "#f0e68c",
  7363. lavenderblush: "#fff0f5",
  7364. lavender: "#e6e6fa",
  7365. lawngreen: "#7cfc00",
  7366. lemonchiffon: "#fffacd",
  7367. lightblue: "#add8e6",
  7368. lightcoral: "#f08080",
  7369. lightcyan: "#e0ffff",
  7370. lightgoldenrodyellow: "#fafad2",
  7371. lightgray: "#d3d3d3",
  7372. lightgreen: "#90ee90",
  7373. lightgrey: "#d3d3d3",
  7374. lightpink: "#ffb6c1",
  7375. lightsalmon: "#ffa07a",
  7376. lightseagreen: "#20b2aa",
  7377. lightskyblue: "#87cefa",
  7378. lightslategray: "#778899",
  7379. lightslategrey: "#778899",
  7380. lightsteelblue: "#b0c4de",
  7381. lightyellow: "#ffffe0",
  7382. lime: "#00ff00",
  7383. limegreen: "#32cd32",
  7384. linen: "#faf0e6",
  7385. magenta: "#ff00ff",
  7386. maroon: "#800000",
  7387. mediumaquamarine: "#66cdaa",
  7388. mediumblue: "#0000cd",
  7389. mediumorchid: "#ba55d3",
  7390. mediumpurple: "#9370db",
  7391. mediumseagreen: "#3cb371",
  7392. mediumslateblue: "#7b68ee",
  7393. mediumspringgreen: "#00fa9a",
  7394. mediumturquoise: "#48d1cc",
  7395. mediumvioletred: "#c71585",
  7396. midnightblue: "#191970",
  7397. mintcream: "#f5fffa",
  7398. mistyrose: "#ffe4e1",
  7399. moccasin: "#ffe4b5",
  7400. navajowhite: "#ffdead",
  7401. navy: "#000080",
  7402. oldlace: "#fdf5e6",
  7403. olive: "#808000",
  7404. olivedrab: "#6b8e23",
  7405. orange: "#ffa500",
  7406. orangered: "#ff4500",
  7407. orchid: "#da70d6",
  7408. palegoldenrod: "#eee8aa",
  7409. palegreen: "#98fb98",
  7410. paleturquoise: "#afeeee",
  7411. palevioletred: "#db7093",
  7412. papayawhip: "#ffefd5",
  7413. peachpuff: "#ffdab9",
  7414. peru: "#cd853f",
  7415. pink: "#ffc0cb",
  7416. plum: "#dda0dd",
  7417. powderblue: "#b0e0e6",
  7418. purple: "#800080",
  7419. rebeccapurple: "#663399",
  7420. red: "#ff0000",
  7421. rosybrown: "#bc8f8f",
  7422. royalblue: "#4169e1",
  7423. saddlebrown: "#8b4513",
  7424. salmon: "#fa8072",
  7425. sandybrown: "#f4a460",
  7426. seagreen: "#2e8b57",
  7427. seashell: "#fff5ee",
  7428. sienna: "#a0522d",
  7429. silver: "#c0c0c0",
  7430. skyblue: "#87ceeb",
  7431. slateblue: "#6a5acd",
  7432. slategray: "#708090",
  7433. slategrey: "#708090",
  7434. snow: "#fffafa",
  7435. springgreen: "#00ff7f",
  7436. steelblue: "#4682b4",
  7437. tan: "#d2b48c",
  7438. teal: "#008080",
  7439. thistle: "#d8bfd8",
  7440. tomato: "#ff6347",
  7441. turquoise: "#40e0d0",
  7442. violet: "#ee82ee",
  7443. wheat: "#f5deb3",
  7444. white: "#ffffff",
  7445. whitesmoke: "#f5f5f5",
  7446. yellow: "#ffff00",
  7447. yellowgreen: "#9acd32"
  7448. };
  7449. function inputToRGB(color) {
  7450. var rgb = { r: 0, g: 0, b: 0 };
  7451. var a2 = 1;
  7452. var s2 = null;
  7453. var v2 = null;
  7454. var l2 = null;
  7455. var ok = false;
  7456. var format2 = false;
  7457. if (typeof color === "string") {
  7458. color = stringInputToObject(color);
  7459. }
  7460. if (typeof color === "object") {
  7461. if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
  7462. rgb = rgbToRgb(color.r, color.g, color.b);
  7463. ok = true;
  7464. format2 = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
  7465. } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
  7466. s2 = convertToPercentage(color.s);
  7467. v2 = convertToPercentage(color.v);
  7468. rgb = hsvToRgb(color.h, s2, v2);
  7469. ok = true;
  7470. format2 = "hsv";
  7471. } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
  7472. s2 = convertToPercentage(color.s);
  7473. l2 = convertToPercentage(color.l);
  7474. rgb = hslToRgb(color.h, s2, l2);
  7475. ok = true;
  7476. format2 = "hsl";
  7477. }
  7478. if (Object.prototype.hasOwnProperty.call(color, "a")) {
  7479. a2 = color.a;
  7480. }
  7481. }
  7482. a2 = boundAlpha(a2);
  7483. return {
  7484. ok,
  7485. format: color.format || format2,
  7486. r: Math.min(255, Math.max(rgb.r, 0)),
  7487. g: Math.min(255, Math.max(rgb.g, 0)),
  7488. b: Math.min(255, Math.max(rgb.b, 0)),
  7489. a: a2
  7490. };
  7491. }
  7492. var CSS_INTEGER = "[-\\+]?\\d+%?";
  7493. var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";
  7494. var CSS_UNIT = "(?:".concat(CSS_NUMBER, ")|(?:").concat(CSS_INTEGER, ")");
  7495. var PERMISSIVE_MATCH3 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
  7496. var PERMISSIVE_MATCH4 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
  7497. var matchers = {
  7498. CSS_UNIT: new RegExp(CSS_UNIT),
  7499. rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
  7500. rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
  7501. hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
  7502. hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
  7503. hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
  7504. hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
  7505. hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
  7506. hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
  7507. hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
  7508. hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
  7509. };
  7510. function stringInputToObject(color) {
  7511. color = color.trim().toLowerCase();
  7512. if (color.length === 0) {
  7513. return false;
  7514. }
  7515. var named = false;
  7516. if (names[color]) {
  7517. color = names[color];
  7518. named = true;
  7519. } else if (color === "transparent") {
  7520. return { r: 0, g: 0, b: 0, a: 0, format: "name" };
  7521. }
  7522. var match = matchers.rgb.exec(color);
  7523. if (match) {
  7524. return { r: match[1], g: match[2], b: match[3] };
  7525. }
  7526. match = matchers.rgba.exec(color);
  7527. if (match) {
  7528. return { r: match[1], g: match[2], b: match[3], a: match[4] };
  7529. }
  7530. match = matchers.hsl.exec(color);
  7531. if (match) {
  7532. return { h: match[1], s: match[2], l: match[3] };
  7533. }
  7534. match = matchers.hsla.exec(color);
  7535. if (match) {
  7536. return { h: match[1], s: match[2], l: match[3], a: match[4] };
  7537. }
  7538. match = matchers.hsv.exec(color);
  7539. if (match) {
  7540. return { h: match[1], s: match[2], v: match[3] };
  7541. }
  7542. match = matchers.hsva.exec(color);
  7543. if (match) {
  7544. return { h: match[1], s: match[2], v: match[3], a: match[4] };
  7545. }
  7546. match = matchers.hex8.exec(color);
  7547. if (match) {
  7548. return {
  7549. r: parseIntFromHex(match[1]),
  7550. g: parseIntFromHex(match[2]),
  7551. b: parseIntFromHex(match[3]),
  7552. a: convertHexToDecimal(match[4]),
  7553. format: named ? "name" : "hex8"
  7554. };
  7555. }
  7556. match = matchers.hex6.exec(color);
  7557. if (match) {
  7558. return {
  7559. r: parseIntFromHex(match[1]),
  7560. g: parseIntFromHex(match[2]),
  7561. b: parseIntFromHex(match[3]),
  7562. format: named ? "name" : "hex"
  7563. };
  7564. }
  7565. match = matchers.hex4.exec(color);
  7566. if (match) {
  7567. return {
  7568. r: parseIntFromHex(match[1] + match[1]),
  7569. g: parseIntFromHex(match[2] + match[2]),
  7570. b: parseIntFromHex(match[3] + match[3]),
  7571. a: convertHexToDecimal(match[4] + match[4]),
  7572. format: named ? "name" : "hex8"
  7573. };
  7574. }
  7575. match = matchers.hex3.exec(color);
  7576. if (match) {
  7577. return {
  7578. r: parseIntFromHex(match[1] + match[1]),
  7579. g: parseIntFromHex(match[2] + match[2]),
  7580. b: parseIntFromHex(match[3] + match[3]),
  7581. format: named ? "name" : "hex"
  7582. };
  7583. }
  7584. return false;
  7585. }
  7586. function isValidCSSUnit(color) {
  7587. return Boolean(matchers.CSS_UNIT.exec(String(color)));
  7588. }
  7589. var TinyColor = function() {
  7590. function TinyColor2(color, opts) {
  7591. if (color === void 0) {
  7592. color = "";
  7593. }
  7594. if (opts === void 0) {
  7595. opts = {};
  7596. }
  7597. var _a2;
  7598. if (color instanceof TinyColor2) {
  7599. return color;
  7600. }
  7601. if (typeof color === "number") {
  7602. color = numberInputToObject(color);
  7603. }
  7604. this.originalInput = color;
  7605. var rgb = inputToRGB(color);
  7606. this.originalInput = color;
  7607. this.r = rgb.r;
  7608. this.g = rgb.g;
  7609. this.b = rgb.b;
  7610. this.a = rgb.a;
  7611. this.roundA = Math.round(100 * this.a) / 100;
  7612. this.format = (_a2 = opts.format) !== null && _a2 !== void 0 ? _a2 : rgb.format;
  7613. this.gradientType = opts.gradientType;
  7614. if (this.r < 1) {
  7615. this.r = Math.round(this.r);
  7616. }
  7617. if (this.g < 1) {
  7618. this.g = Math.round(this.g);
  7619. }
  7620. if (this.b < 1) {
  7621. this.b = Math.round(this.b);
  7622. }
  7623. this.isValid = rgb.ok;
  7624. }
  7625. TinyColor2.prototype.isDark = function() {
  7626. return this.getBrightness() < 128;
  7627. };
  7628. TinyColor2.prototype.isLight = function() {
  7629. return !this.isDark();
  7630. };
  7631. TinyColor2.prototype.getBrightness = function() {
  7632. var rgb = this.toRgb();
  7633. return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1e3;
  7634. };
  7635. TinyColor2.prototype.getLuminance = function() {
  7636. var rgb = this.toRgb();
  7637. var R;
  7638. var G;
  7639. var B;
  7640. var RsRGB = rgb.r / 255;
  7641. var GsRGB = rgb.g / 255;
  7642. var BsRGB = rgb.b / 255;
  7643. if (RsRGB <= 0.03928) {
  7644. R = RsRGB / 12.92;
  7645. } else {
  7646. R = Math.pow((RsRGB + 0.055) / 1.055, 2.4);
  7647. }
  7648. if (GsRGB <= 0.03928) {
  7649. G = GsRGB / 12.92;
  7650. } else {
  7651. G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
  7652. }
  7653. if (BsRGB <= 0.03928) {
  7654. B = BsRGB / 12.92;
  7655. } else {
  7656. B = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
  7657. }
  7658. return 0.2126 * R + 0.7152 * G + 0.0722 * B;
  7659. };
  7660. TinyColor2.prototype.getAlpha = function() {
  7661. return this.a;
  7662. };
  7663. TinyColor2.prototype.setAlpha = function(alpha) {
  7664. this.a = boundAlpha(alpha);
  7665. this.roundA = Math.round(100 * this.a) / 100;
  7666. return this;
  7667. };
  7668. TinyColor2.prototype.toHsv = function() {
  7669. var hsv = rgbToHsv(this.r, this.g, this.b);
  7670. return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this.a };
  7671. };
  7672. TinyColor2.prototype.toHsvString = function() {
  7673. var hsv = rgbToHsv(this.r, this.g, this.b);
  7674. var h2 = Math.round(hsv.h * 360);
  7675. var s2 = Math.round(hsv.s * 100);
  7676. var v2 = Math.round(hsv.v * 100);
  7677. return this.a === 1 ? "hsv(".concat(h2, ", ").concat(s2, "%, ").concat(v2, "%)") : "hsva(".concat(h2, ", ").concat(s2, "%, ").concat(v2, "%, ").concat(this.roundA, ")");
  7678. };
  7679. TinyColor2.prototype.toHsl = function() {
  7680. var hsl = rgbToHsl(this.r, this.g, this.b);
  7681. return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this.a };
  7682. };
  7683. TinyColor2.prototype.toHslString = function() {
  7684. var hsl = rgbToHsl(this.r, this.g, this.b);
  7685. var h2 = Math.round(hsl.h * 360);
  7686. var s2 = Math.round(hsl.s * 100);
  7687. var l2 = Math.round(hsl.l * 100);
  7688. return this.a === 1 ? "hsl(".concat(h2, ", ").concat(s2, "%, ").concat(l2, "%)") : "hsla(".concat(h2, ", ").concat(s2, "%, ").concat(l2, "%, ").concat(this.roundA, ")");
  7689. };
  7690. TinyColor2.prototype.toHex = function(allow3Char) {
  7691. if (allow3Char === void 0) {
  7692. allow3Char = false;
  7693. }
  7694. return rgbToHex(this.r, this.g, this.b, allow3Char);
  7695. };
  7696. TinyColor2.prototype.toHexString = function(allow3Char) {
  7697. if (allow3Char === void 0) {
  7698. allow3Char = false;
  7699. }
  7700. return "#" + this.toHex(allow3Char);
  7701. };
  7702. TinyColor2.prototype.toHex8 = function(allow4Char) {
  7703. if (allow4Char === void 0) {
  7704. allow4Char = false;
  7705. }
  7706. return rgbaToHex(this.r, this.g, this.b, this.a, allow4Char);
  7707. };
  7708. TinyColor2.prototype.toHex8String = function(allow4Char) {
  7709. if (allow4Char === void 0) {
  7710. allow4Char = false;
  7711. }
  7712. return "#" + this.toHex8(allow4Char);
  7713. };
  7714. TinyColor2.prototype.toRgb = function() {
  7715. return {
  7716. r: Math.round(this.r),
  7717. g: Math.round(this.g),
  7718. b: Math.round(this.b),
  7719. a: this.a
  7720. };
  7721. };
  7722. TinyColor2.prototype.toRgbString = function() {
  7723. var r = Math.round(this.r);
  7724. var g = Math.round(this.g);
  7725. var b2 = Math.round(this.b);
  7726. return this.a === 1 ? "rgb(".concat(r, ", ").concat(g, ", ").concat(b2, ")") : "rgba(".concat(r, ", ").concat(g, ", ").concat(b2, ", ").concat(this.roundA, ")");
  7727. };
  7728. TinyColor2.prototype.toPercentageRgb = function() {
  7729. var fmt = function(x2) {
  7730. return "".concat(Math.round(bound01(x2, 255) * 100), "%");
  7731. };
  7732. return {
  7733. r: fmt(this.r),
  7734. g: fmt(this.g),
  7735. b: fmt(this.b),
  7736. a: this.a
  7737. };
  7738. };
  7739. TinyColor2.prototype.toPercentageRgbString = function() {
  7740. var rnd = function(x2) {
  7741. return Math.round(bound01(x2, 255) * 100);
  7742. };
  7743. return this.a === 1 ? "rgb(".concat(rnd(this.r), "%, ").concat(rnd(this.g), "%, ").concat(rnd(this.b), "%)") : "rgba(".concat(rnd(this.r), "%, ").concat(rnd(this.g), "%, ").concat(rnd(this.b), "%, ").concat(this.roundA, ")");
  7744. };
  7745. TinyColor2.prototype.toName = function() {
  7746. if (this.a === 0) {
  7747. return "transparent";
  7748. }
  7749. if (this.a < 1) {
  7750. return false;
  7751. }
  7752. var hex2 = "#" + rgbToHex(this.r, this.g, this.b, false);
  7753. for (var _i = 0, _a2 = Object.entries(names); _i < _a2.length; _i++) {
  7754. var _b2 = _a2[_i], key = _b2[0], value = _b2[1];
  7755. if (hex2 === value) {
  7756. return key;
  7757. }
  7758. }
  7759. return false;
  7760. };
  7761. TinyColor2.prototype.toString = function(format2) {
  7762. var formatSet = Boolean(format2);
  7763. format2 = format2 !== null && format2 !== void 0 ? format2 : this.format;
  7764. var formattedString = false;
  7765. var hasAlpha = this.a < 1 && this.a >= 0;
  7766. var needsAlphaFormat = !formatSet && hasAlpha && (format2.startsWith("hex") || format2 === "name");
  7767. if (needsAlphaFormat) {
  7768. if (format2 === "name" && this.a === 0) {
  7769. return this.toName();
  7770. }
  7771. return this.toRgbString();
  7772. }
  7773. if (format2 === "rgb") {
  7774. formattedString = this.toRgbString();
  7775. }
  7776. if (format2 === "prgb") {
  7777. formattedString = this.toPercentageRgbString();
  7778. }
  7779. if (format2 === "hex" || format2 === "hex6") {
  7780. formattedString = this.toHexString();
  7781. }
  7782. if (format2 === "hex3") {
  7783. formattedString = this.toHexString(true);
  7784. }
  7785. if (format2 === "hex4") {
  7786. formattedString = this.toHex8String(true);
  7787. }
  7788. if (format2 === "hex8") {
  7789. formattedString = this.toHex8String();
  7790. }
  7791. if (format2 === "name") {
  7792. formattedString = this.toName();
  7793. }
  7794. if (format2 === "hsl") {
  7795. formattedString = this.toHslString();
  7796. }
  7797. if (format2 === "hsv") {
  7798. formattedString = this.toHsvString();
  7799. }
  7800. return formattedString || this.toHexString();
  7801. };
  7802. TinyColor2.prototype.toNumber = function() {
  7803. return (Math.round(this.r) << 16) + (Math.round(this.g) << 8) + Math.round(this.b);
  7804. };
  7805. TinyColor2.prototype.clone = function() {
  7806. return new TinyColor2(this.toString());
  7807. };
  7808. TinyColor2.prototype.lighten = function(amount) {
  7809. if (amount === void 0) {
  7810. amount = 10;
  7811. }
  7812. var hsl = this.toHsl();
  7813. hsl.l += amount / 100;
  7814. hsl.l = clamp01(hsl.l);
  7815. return new TinyColor2(hsl);
  7816. };
  7817. TinyColor2.prototype.brighten = function(amount) {
  7818. if (amount === void 0) {
  7819. amount = 10;
  7820. }
  7821. var rgb = this.toRgb();
  7822. rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100))));
  7823. rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100))));
  7824. rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100))));
  7825. return new TinyColor2(rgb);
  7826. };
  7827. TinyColor2.prototype.darken = function(amount) {
  7828. if (amount === void 0) {
  7829. amount = 10;
  7830. }
  7831. var hsl = this.toHsl();
  7832. hsl.l -= amount / 100;
  7833. hsl.l = clamp01(hsl.l);
  7834. return new TinyColor2(hsl);
  7835. };
  7836. TinyColor2.prototype.tint = function(amount) {
  7837. if (amount === void 0) {
  7838. amount = 10;
  7839. }
  7840. return this.mix("white", amount);
  7841. };
  7842. TinyColor2.prototype.shade = function(amount) {
  7843. if (amount === void 0) {
  7844. amount = 10;
  7845. }
  7846. return this.mix("black", amount);
  7847. };
  7848. TinyColor2.prototype.desaturate = function(amount) {
  7849. if (amount === void 0) {
  7850. amount = 10;
  7851. }
  7852. var hsl = this.toHsl();
  7853. hsl.s -= amount / 100;
  7854. hsl.s = clamp01(hsl.s);
  7855. return new TinyColor2(hsl);
  7856. };
  7857. TinyColor2.prototype.saturate = function(amount) {
  7858. if (amount === void 0) {
  7859. amount = 10;
  7860. }
  7861. var hsl = this.toHsl();
  7862. hsl.s += amount / 100;
  7863. hsl.s = clamp01(hsl.s);
  7864. return new TinyColor2(hsl);
  7865. };
  7866. TinyColor2.prototype.greyscale = function() {
  7867. return this.desaturate(100);
  7868. };
  7869. TinyColor2.prototype.spin = function(amount) {
  7870. var hsl = this.toHsl();
  7871. var hue = (hsl.h + amount) % 360;
  7872. hsl.h = hue < 0 ? 360 + hue : hue;
  7873. return new TinyColor2(hsl);
  7874. };
  7875. TinyColor2.prototype.mix = function(color, amount) {
  7876. if (amount === void 0) {
  7877. amount = 50;
  7878. }
  7879. var rgb1 = this.toRgb();
  7880. var rgb2 = new TinyColor2(color).toRgb();
  7881. var p2 = amount / 100;
  7882. var rgba = {
  7883. r: (rgb2.r - rgb1.r) * p2 + rgb1.r,
  7884. g: (rgb2.g - rgb1.g) * p2 + rgb1.g,
  7885. b: (rgb2.b - rgb1.b) * p2 + rgb1.b,
  7886. a: (rgb2.a - rgb1.a) * p2 + rgb1.a
  7887. };
  7888. return new TinyColor2(rgba);
  7889. };
  7890. TinyColor2.prototype.analogous = function(results, slices) {
  7891. if (results === void 0) {
  7892. results = 6;
  7893. }
  7894. if (slices === void 0) {
  7895. slices = 30;
  7896. }
  7897. var hsl = this.toHsl();
  7898. var part = 360 / slices;
  7899. var ret = [this];
  7900. for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results; ) {
  7901. hsl.h = (hsl.h + part) % 360;
  7902. ret.push(new TinyColor2(hsl));
  7903. }
  7904. return ret;
  7905. };
  7906. TinyColor2.prototype.complement = function() {
  7907. var hsl = this.toHsl();
  7908. hsl.h = (hsl.h + 180) % 360;
  7909. return new TinyColor2(hsl);
  7910. };
  7911. TinyColor2.prototype.monochromatic = function(results) {
  7912. if (results === void 0) {
  7913. results = 6;
  7914. }
  7915. var hsv = this.toHsv();
  7916. var h2 = hsv.h;
  7917. var s2 = hsv.s;
  7918. var v2 = hsv.v;
  7919. var res = [];
  7920. var modification = 1 / results;
  7921. while (results--) {
  7922. res.push(new TinyColor2({ h: h2, s: s2, v: v2 }));
  7923. v2 = (v2 + modification) % 1;
  7924. }
  7925. return res;
  7926. };
  7927. TinyColor2.prototype.splitcomplement = function() {
  7928. var hsl = this.toHsl();
  7929. var h2 = hsl.h;
  7930. return [
  7931. this,
  7932. new TinyColor2({ h: (h2 + 72) % 360, s: hsl.s, l: hsl.l }),
  7933. new TinyColor2({ h: (h2 + 216) % 360, s: hsl.s, l: hsl.l })
  7934. ];
  7935. };
  7936. TinyColor2.prototype.onBackground = function(background) {
  7937. var fg = this.toRgb();
  7938. var bg = new TinyColor2(background).toRgb();
  7939. return new TinyColor2({
  7940. r: bg.r + (fg.r - bg.r) * fg.a,
  7941. g: bg.g + (fg.g - bg.g) * fg.a,
  7942. b: bg.b + (fg.b - bg.b) * fg.a
  7943. });
  7944. };
  7945. TinyColor2.prototype.triad = function() {
  7946. return this.polyad(3);
  7947. };
  7948. TinyColor2.prototype.tetrad = function() {
  7949. return this.polyad(4);
  7950. };
  7951. TinyColor2.prototype.polyad = function(n) {
  7952. var hsl = this.toHsl();
  7953. var h2 = hsl.h;
  7954. var result = [this];
  7955. var increment = 360 / n;
  7956. for (var i = 1; i < n; i++) {
  7957. result.push(new TinyColor2({ h: (h2 + i * increment) % 360, s: hsl.s, l: hsl.l }));
  7958. }
  7959. return result;
  7960. };
  7961. TinyColor2.prototype.equals = function(color) {
  7962. return this.toRgbString() === new TinyColor2(color).toRgbString();
  7963. };
  7964. return TinyColor2;
  7965. }();
  7966. function darken(color, amount = 20) {
  7967. return color.mix("#141414", amount).toString();
  7968. }
  7969. function useButtonCustomStyle(props) {
  7970. const _disabled = useDisabled$1();
  7971. return computed(() => {
  7972. let styles = {};
  7973. const buttonColor = props.color;
  7974. if (buttonColor) {
  7975. const color = new TinyColor(buttonColor);
  7976. const activeBgColor = props.dark ? color.tint(20).toString() : darken(color, 20);
  7977. if (props.plain) {
  7978. styles = {
  7979. "--el-button-bg-color": props.dark ? darken(color, 90) : color.tint(90).toString(),
  7980. "--el-button-text-color": buttonColor,
  7981. "--el-button-border-color": props.dark ? darken(color, 50) : color.tint(50).toString(),
  7982. "--el-button-hover-text-color": "var(--el-color-white)",
  7983. "--el-button-hover-bg-color": buttonColor,
  7984. "--el-button-hover-border-color": buttonColor,
  7985. "--el-button-active-bg-color": activeBgColor,
  7986. "--el-button-active-text-color": "var(--el-color-white)",
  7987. "--el-button-active-border-color": activeBgColor
  7988. };
  7989. if (_disabled.value) {
  7990. styles["--el-button-disabled-bg-color"] = props.dark ? darken(color, 90) : color.tint(90).toString();
  7991. styles["--el-button-disabled-text-color"] = props.dark ? darken(color, 50) : color.tint(50).toString();
  7992. styles["--el-button-disabled-border-color"] = props.dark ? darken(color, 80) : color.tint(80).toString();
  7993. }
  7994. } else {
  7995. const hoverBgColor = props.dark ? darken(color, 30) : color.tint(30).toString();
  7996. const textColor = color.isDark() ? "var(--el-color-white)" : "var(--el-color-black)";
  7997. styles = {
  7998. "--el-button-bg-color": buttonColor,
  7999. "--el-button-text-color": textColor,
  8000. "--el-button-border-color": buttonColor,
  8001. "--el-button-hover-bg-color": hoverBgColor,
  8002. "--el-button-hover-text-color": textColor,
  8003. "--el-button-hover-border-color": hoverBgColor,
  8004. "--el-button-active-bg-color": activeBgColor,
  8005. "--el-button-active-border-color": activeBgColor
  8006. };
  8007. if (_disabled.value) {
  8008. const disabledButtonColor = props.dark ? darken(color, 50) : color.tint(50).toString();
  8009. styles["--el-button-disabled-bg-color"] = disabledButtonColor;
  8010. styles["--el-button-disabled-text-color"] = props.dark ? "rgba(255, 255, 255, 0.5)" : "var(--el-color-white)";
  8011. styles["--el-button-disabled-border-color"] = disabledButtonColor;
  8012. }
  8013. }
  8014. }
  8015. return styles;
  8016. });
  8017. }
  8018. const _hoisted_1$A = ["disabled", "autofocus", "type"];
  8019. const __default__$f = {
  8020. name: "ElButton"
  8021. };
  8022. const _sfc_main$U = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$f), {
  8023. props: buttonProps,
  8024. emits: buttonEmits,
  8025. setup(__props, { expose, emit }) {
  8026. const props = __props;
  8027. const slots = useSlots();
  8028. const buttonGroupContext = inject(buttonGroupContextKey, void 0);
  8029. const globalConfig2 = useGlobalConfig("button");
  8030. const ns = useNamespace("button");
  8031. const { form } = useFormItem();
  8032. const _size = useSize(computed(() => buttonGroupContext == null ? void 0 : buttonGroupContext.size));
  8033. const _disabled = useDisabled$1();
  8034. const _ref = ref();
  8035. const _type = computed(() => props.type || (buttonGroupContext == null ? void 0 : buttonGroupContext.type) || "");
  8036. const autoInsertSpace = computed(() => {
  8037. var _a2, _b2, _c;
  8038. return (_c = (_b2 = props.autoInsertSpace) != null ? _b2 : (_a2 = globalConfig2.value) == null ? void 0 : _a2.autoInsertSpace) != null ? _c : false;
  8039. });
  8040. const shouldAddSpace = computed(() => {
  8041. var _a2;
  8042. const defaultSlot = (_a2 = slots.default) == null ? void 0 : _a2.call(slots);
  8043. if (autoInsertSpace.value && (defaultSlot == null ? void 0 : defaultSlot.length) === 1) {
  8044. const slot = defaultSlot[0];
  8045. if ((slot == null ? void 0 : slot.type) === Text) {
  8046. const text = slot.children;
  8047. return /^\p{Unified_Ideograph}{2}$/u.test(text.trim());
  8048. }
  8049. }
  8050. return false;
  8051. });
  8052. const buttonStyle = useButtonCustomStyle(props);
  8053. const handleClick = (evt) => {
  8054. if (props.nativeType === "reset") {
  8055. form == null ? void 0 : form.resetFields();
  8056. }
  8057. emit("click", evt);
  8058. };
  8059. expose({
  8060. ref: _ref,
  8061. size: _size,
  8062. type: _type,
  8063. disabled: _disabled,
  8064. shouldAddSpace
  8065. });
  8066. return (_ctx, _cache) => {
  8067. return openBlock(), createElementBlock("button", {
  8068. ref_key: "_ref",
  8069. ref: _ref,
  8070. class: normalizeClass([
  8071. unref(ns).b(),
  8072. unref(ns).m(unref(_type)),
  8073. unref(ns).m(unref(_size)),
  8074. unref(ns).is("disabled", unref(_disabled)),
  8075. unref(ns).is("loading", _ctx.loading),
  8076. unref(ns).is("plain", _ctx.plain),
  8077. unref(ns).is("round", _ctx.round),
  8078. unref(ns).is("circle", _ctx.circle)
  8079. ]),
  8080. disabled: unref(_disabled) || _ctx.loading,
  8081. autofocus: _ctx.autofocus,
  8082. type: _ctx.nativeType,
  8083. style: normalizeStyle(unref(buttonStyle)),
  8084. onClick: handleClick
  8085. }, [
  8086. _ctx.loading ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  8087. _ctx.$slots.loading ? renderSlot(_ctx.$slots, "loading", { key: 0 }) : (openBlock(), createBlock(unref(ElIcon), {
  8088. key: 1,
  8089. class: normalizeClass(unref(ns).is("loading"))
  8090. }, {
  8091. default: withCtx(() => [
  8092. (openBlock(), createBlock(resolveDynamicComponent(_ctx.loadingIcon)))
  8093. ]),
  8094. _: 1
  8095. }, 8, ["class"]))
  8096. ], 2112)) : _ctx.icon || _ctx.$slots.icon ? (openBlock(), createBlock(unref(ElIcon), { key: 1 }, {
  8097. default: withCtx(() => [
  8098. _ctx.icon ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon), { key: 0 })) : renderSlot(_ctx.$slots, "icon", { key: 1 })
  8099. ]),
  8100. _: 3
  8101. })) : createCommentVNode("v-if", true),
  8102. _ctx.$slots.default ? (openBlock(), createElementBlock("span", {
  8103. key: 2,
  8104. class: normalizeClass({ [unref(ns).em("text", "expand")]: unref(shouldAddSpace) })
  8105. }, [
  8106. renderSlot(_ctx.$slots, "default")
  8107. ], 2)) : createCommentVNode("v-if", true)
  8108. ], 14, _hoisted_1$A);
  8109. };
  8110. }
  8111. }));
  8112. var Button = /* @__PURE__ */ _export_sfc$1(_sfc_main$U, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/button/src/button.vue"]]);
  8113. const buttonGroupProps = {
  8114. size: buttonProps.size,
  8115. type: buttonProps.type
  8116. };
  8117. const __default__$e = {
  8118. name: "ElButtonGroup"
  8119. };
  8120. const _sfc_main$T = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$e), {
  8121. props: buttonGroupProps,
  8122. setup(__props) {
  8123. const props = __props;
  8124. provide(buttonGroupContextKey, reactive({
  8125. size: toRef(props, "size"),
  8126. type: toRef(props, "type")
  8127. }));
  8128. const ns = useNamespace("button");
  8129. return (_ctx, _cache) => {
  8130. return openBlock(), createElementBlock("div", {
  8131. class: normalizeClass(`${unref(ns).b("group")}`)
  8132. }, [
  8133. renderSlot(_ctx.$slots, "default")
  8134. ], 2);
  8135. };
  8136. }
  8137. }));
  8138. var ButtonGroup = /* @__PURE__ */ _export_sfc$1(_sfc_main$T, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/button/src/button-group.vue"]]);
  8139. const ElButton = withInstall(Button, {
  8140. ButtonGroup
  8141. });
  8142. withNoopInstall(ButtonGroup);
  8143. var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
  8144. var dayjs_min = { exports: {} };
  8145. (function(module2, exports2) {
  8146. !function(t, e) {
  8147. module2.exports = e();
  8148. }(commonjsGlobal, function() {
  8149. var t = 1e3, e = 6e4, n = 36e5, r = "millisecond", i = "second", s2 = "minute", u2 = "hour", a2 = "day", o2 = "week", f = "month", h2 = "quarter", c = "year", d2 = "date", $ = "Invalid Date", l2 = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, M2 = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_") }, m2 = function(t2, e2, n2) {
  8150. var r2 = String(t2);
  8151. return !r2 || r2.length >= e2 ? t2 : "" + Array(e2 + 1 - r2.length).join(n2) + t2;
  8152. }, g = { s: m2, z: function(t2) {
  8153. var e2 = -t2.utcOffset(), n2 = Math.abs(e2), r2 = Math.floor(n2 / 60), i2 = n2 % 60;
  8154. return (e2 <= 0 ? "+" : "-") + m2(r2, 2, "0") + ":" + m2(i2, 2, "0");
  8155. }, m: function t2(e2, n2) {
  8156. if (e2.date() < n2.date())
  8157. return -t2(n2, e2);
  8158. var r2 = 12 * (n2.year() - e2.year()) + (n2.month() - e2.month()), i2 = e2.clone().add(r2, f), s3 = n2 - i2 < 0, u3 = e2.clone().add(r2 + (s3 ? -1 : 1), f);
  8159. return +(-(r2 + (n2 - i2) / (s3 ? i2 - u3 : u3 - i2)) || 0);
  8160. }, a: function(t2) {
  8161. return t2 < 0 ? Math.ceil(t2) || 0 : Math.floor(t2);
  8162. }, p: function(t2) {
  8163. return { M: f, y: c, w: o2, d: a2, D: d2, h: u2, m: s2, s: i, ms: r, Q: h2 }[t2] || String(t2 || "").toLowerCase().replace(/s$/, "");
  8164. }, u: function(t2) {
  8165. return t2 === void 0;
  8166. } }, v2 = "en", D2 = {};
  8167. D2[v2] = M2;
  8168. var p2 = function(t2) {
  8169. return t2 instanceof _2;
  8170. }, S2 = function t2(e2, n2, r2) {
  8171. var i2;
  8172. if (!e2)
  8173. return v2;
  8174. if (typeof e2 == "string") {
  8175. var s3 = e2.toLowerCase();
  8176. D2[s3] && (i2 = s3), n2 && (D2[s3] = n2, i2 = s3);
  8177. var u3 = e2.split("-");
  8178. if (!i2 && u3.length > 1)
  8179. return t2(u3[0]);
  8180. } else {
  8181. var a3 = e2.name;
  8182. D2[a3] = e2, i2 = a3;
  8183. }
  8184. return !r2 && i2 && (v2 = i2), i2 || !r2 && v2;
  8185. }, w2 = function(t2, e2) {
  8186. if (p2(t2))
  8187. return t2.clone();
  8188. var n2 = typeof e2 == "object" ? e2 : {};
  8189. return n2.date = t2, n2.args = arguments, new _2(n2);
  8190. }, O2 = g;
  8191. O2.l = S2, O2.i = p2, O2.w = function(t2, e2) {
  8192. return w2(t2, { locale: e2.$L, utc: e2.$u, x: e2.$x, $offset: e2.$offset });
  8193. };
  8194. var _2 = function() {
  8195. function M3(t2) {
  8196. this.$L = S2(t2.locale, null, true), this.parse(t2);
  8197. }
  8198. var m3 = M3.prototype;
  8199. return m3.parse = function(t2) {
  8200. this.$d = function(t3) {
  8201. var e2 = t3.date, n2 = t3.utc;
  8202. if (e2 === null)
  8203. return new Date(NaN);
  8204. if (O2.u(e2))
  8205. return new Date();
  8206. if (e2 instanceof Date)
  8207. return new Date(e2);
  8208. if (typeof e2 == "string" && !/Z$/i.test(e2)) {
  8209. var r2 = e2.match(l2);
  8210. if (r2) {
  8211. var i2 = r2[2] - 1 || 0, s3 = (r2[7] || "0").substring(0, 3);
  8212. return n2 ? new Date(Date.UTC(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s3)) : new Date(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s3);
  8213. }
  8214. }
  8215. return new Date(e2);
  8216. }(t2), this.$x = t2.x || {}, this.init();
  8217. }, m3.init = function() {
  8218. var t2 = this.$d;
  8219. this.$y = t2.getFullYear(), this.$M = t2.getMonth(), this.$D = t2.getDate(), this.$W = t2.getDay(), this.$H = t2.getHours(), this.$m = t2.getMinutes(), this.$s = t2.getSeconds(), this.$ms = t2.getMilliseconds();
  8220. }, m3.$utils = function() {
  8221. return O2;
  8222. }, m3.isValid = function() {
  8223. return !(this.$d.toString() === $);
  8224. }, m3.isSame = function(t2, e2) {
  8225. var n2 = w2(t2);
  8226. return this.startOf(e2) <= n2 && n2 <= this.endOf(e2);
  8227. }, m3.isAfter = function(t2, e2) {
  8228. return w2(t2) < this.startOf(e2);
  8229. }, m3.isBefore = function(t2, e2) {
  8230. return this.endOf(e2) < w2(t2);
  8231. }, m3.$g = function(t2, e2, n2) {
  8232. return O2.u(t2) ? this[e2] : this.set(n2, t2);
  8233. }, m3.unix = function() {
  8234. return Math.floor(this.valueOf() / 1e3);
  8235. }, m3.valueOf = function() {
  8236. return this.$d.getTime();
  8237. }, m3.startOf = function(t2, e2) {
  8238. var n2 = this, r2 = !!O2.u(e2) || e2, h3 = O2.p(t2), $2 = function(t3, e3) {
  8239. var i2 = O2.w(n2.$u ? Date.UTC(n2.$y, e3, t3) : new Date(n2.$y, e3, t3), n2);
  8240. return r2 ? i2 : i2.endOf(a2);
  8241. }, l3 = function(t3, e3) {
  8242. return O2.w(n2.toDate()[t3].apply(n2.toDate("s"), (r2 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e3)), n2);
  8243. }, y2 = this.$W, M4 = this.$M, m4 = this.$D, g2 = "set" + (this.$u ? "UTC" : "");
  8244. switch (h3) {
  8245. case c:
  8246. return r2 ? $2(1, 0) : $2(31, 11);
  8247. case f:
  8248. return r2 ? $2(1, M4) : $2(0, M4 + 1);
  8249. case o2:
  8250. var v3 = this.$locale().weekStart || 0, D3 = (y2 < v3 ? y2 + 7 : y2) - v3;
  8251. return $2(r2 ? m4 - D3 : m4 + (6 - D3), M4);
  8252. case a2:
  8253. case d2:
  8254. return l3(g2 + "Hours", 0);
  8255. case u2:
  8256. return l3(g2 + "Minutes", 1);
  8257. case s2:
  8258. return l3(g2 + "Seconds", 2);
  8259. case i:
  8260. return l3(g2 + "Milliseconds", 3);
  8261. default:
  8262. return this.clone();
  8263. }
  8264. }, m3.endOf = function(t2) {
  8265. return this.startOf(t2, false);
  8266. }, m3.$set = function(t2, e2) {
  8267. var n2, o3 = O2.p(t2), h3 = "set" + (this.$u ? "UTC" : ""), $2 = (n2 = {}, n2[a2] = h3 + "Date", n2[d2] = h3 + "Date", n2[f] = h3 + "Month", n2[c] = h3 + "FullYear", n2[u2] = h3 + "Hours", n2[s2] = h3 + "Minutes", n2[i] = h3 + "Seconds", n2[r] = h3 + "Milliseconds", n2)[o3], l3 = o3 === a2 ? this.$D + (e2 - this.$W) : e2;
  8268. if (o3 === f || o3 === c) {
  8269. var y2 = this.clone().set(d2, 1);
  8270. y2.$d[$2](l3), y2.init(), this.$d = y2.set(d2, Math.min(this.$D, y2.daysInMonth())).$d;
  8271. } else
  8272. $2 && this.$d[$2](l3);
  8273. return this.init(), this;
  8274. }, m3.set = function(t2, e2) {
  8275. return this.clone().$set(t2, e2);
  8276. }, m3.get = function(t2) {
  8277. return this[O2.p(t2)]();
  8278. }, m3.add = function(r2, h3) {
  8279. var d3, $2 = this;
  8280. r2 = Number(r2);
  8281. var l3 = O2.p(h3), y2 = function(t2) {
  8282. var e2 = w2($2);
  8283. return O2.w(e2.date(e2.date() + Math.round(t2 * r2)), $2);
  8284. };
  8285. if (l3 === f)
  8286. return this.set(f, this.$M + r2);
  8287. if (l3 === c)
  8288. return this.set(c, this.$y + r2);
  8289. if (l3 === a2)
  8290. return y2(1);
  8291. if (l3 === o2)
  8292. return y2(7);
  8293. var M4 = (d3 = {}, d3[s2] = e, d3[u2] = n, d3[i] = t, d3)[l3] || 1, m4 = this.$d.getTime() + r2 * M4;
  8294. return O2.w(m4, this);
  8295. }, m3.subtract = function(t2, e2) {
  8296. return this.add(-1 * t2, e2);
  8297. }, m3.format = function(t2) {
  8298. var e2 = this, n2 = this.$locale();
  8299. if (!this.isValid())
  8300. return n2.invalidDate || $;
  8301. var r2 = t2 || "YYYY-MM-DDTHH:mm:ssZ", i2 = O2.z(this), s3 = this.$H, u3 = this.$m, a3 = this.$M, o3 = n2.weekdays, f2 = n2.months, h3 = function(t3, n3, i3, s4) {
  8302. return t3 && (t3[n3] || t3(e2, r2)) || i3[n3].slice(0, s4);
  8303. }, c2 = function(t3) {
  8304. return O2.s(s3 % 12 || 12, t3, "0");
  8305. }, d3 = n2.meridiem || function(t3, e3, n3) {
  8306. var r3 = t3 < 12 ? "AM" : "PM";
  8307. return n3 ? r3.toLowerCase() : r3;
  8308. }, l3 = { YY: String(this.$y).slice(-2), YYYY: this.$y, M: a3 + 1, MM: O2.s(a3 + 1, 2, "0"), MMM: h3(n2.monthsShort, a3, f2, 3), MMMM: h3(f2, a3), D: this.$D, DD: O2.s(this.$D, 2, "0"), d: String(this.$W), dd: h3(n2.weekdaysMin, this.$W, o3, 2), ddd: h3(n2.weekdaysShort, this.$W, o3, 3), dddd: o3[this.$W], H: String(s3), HH: O2.s(s3, 2, "0"), h: c2(1), hh: c2(2), a: d3(s3, u3, true), A: d3(s3, u3, false), m: String(u3), mm: O2.s(u3, 2, "0"), s: String(this.$s), ss: O2.s(this.$s, 2, "0"), SSS: O2.s(this.$ms, 3, "0"), Z: i2 };
  8309. return r2.replace(y, function(t3, e3) {
  8310. return e3 || l3[t3] || i2.replace(":", "");
  8311. });
  8312. }, m3.utcOffset = function() {
  8313. return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
  8314. }, m3.diff = function(r2, d3, $2) {
  8315. var l3, y2 = O2.p(d3), M4 = w2(r2), m4 = (M4.utcOffset() - this.utcOffset()) * e, g2 = this - M4, v3 = O2.m(this, M4);
  8316. return v3 = (l3 = {}, l3[c] = v3 / 12, l3[f] = v3, l3[h2] = v3 / 3, l3[o2] = (g2 - m4) / 6048e5, l3[a2] = (g2 - m4) / 864e5, l3[u2] = g2 / n, l3[s2] = g2 / e, l3[i] = g2 / t, l3)[y2] || g2, $2 ? v3 : O2.a(v3);
  8317. }, m3.daysInMonth = function() {
  8318. return this.endOf(f).$D;
  8319. }, m3.$locale = function() {
  8320. return D2[this.$L];
  8321. }, m3.locale = function(t2, e2) {
  8322. if (!t2)
  8323. return this.$L;
  8324. var n2 = this.clone(), r2 = S2(t2, e2, true);
  8325. return r2 && (n2.$L = r2), n2;
  8326. }, m3.clone = function() {
  8327. return O2.w(this.$d, this);
  8328. }, m3.toDate = function() {
  8329. return new Date(this.valueOf());
  8330. }, m3.toJSON = function() {
  8331. return this.isValid() ? this.toISOString() : null;
  8332. }, m3.toISOString = function() {
  8333. return this.$d.toISOString();
  8334. }, m3.toString = function() {
  8335. return this.$d.toUTCString();
  8336. }, M3;
  8337. }(), T2 = _2.prototype;
  8338. return w2.prototype = T2, [["$ms", r], ["$s", i], ["$m", s2], ["$H", u2], ["$W", a2], ["$M", f], ["$y", c], ["$D", d2]].forEach(function(t2) {
  8339. T2[t2[1]] = function(e2) {
  8340. return this.$g(e2, t2[0], t2[1]);
  8341. };
  8342. }), w2.extend = function(t2, e2) {
  8343. return t2.$i || (t2(e2, _2, w2), t2.$i = true), w2;
  8344. }, w2.locale = S2, w2.isDayjs = p2, w2.unix = function(t2) {
  8345. return w2(1e3 * t2);
  8346. }, w2.en = D2[v2], w2.Ls = D2, w2.p = {}, w2;
  8347. });
  8348. })(dayjs_min);
  8349. var dayjs = dayjs_min.exports;
  8350. var localeData$1 = { exports: {} };
  8351. (function(module2, exports2) {
  8352. !function(n, e) {
  8353. module2.exports = e();
  8354. }(commonjsGlobal, function() {
  8355. return function(n, e, t) {
  8356. var r = e.prototype, o2 = function(n2) {
  8357. return n2 && (n2.indexOf ? n2 : n2.s);
  8358. }, u2 = function(n2, e2, t2, r2, u3) {
  8359. var i2 = n2.name ? n2 : n2.$locale(), a3 = o2(i2[e2]), s3 = o2(i2[t2]), f = a3 || s3.map(function(n3) {
  8360. return n3.slice(0, r2);
  8361. });
  8362. if (!u3)
  8363. return f;
  8364. var d2 = i2.weekStart;
  8365. return f.map(function(n3, e3) {
  8366. return f[(e3 + (d2 || 0)) % 7];
  8367. });
  8368. }, i = function() {
  8369. return t.Ls[t.locale()];
  8370. }, a2 = function(n2, e2) {
  8371. return n2.formats[e2] || function(n3) {
  8372. return n3.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(n4, e3, t2) {
  8373. return e3 || t2.slice(1);
  8374. });
  8375. }(n2.formats[e2.toUpperCase()]);
  8376. }, s2 = function() {
  8377. var n2 = this;
  8378. return { months: function(e2) {
  8379. return e2 ? e2.format("MMMM") : u2(n2, "months");
  8380. }, monthsShort: function(e2) {
  8381. return e2 ? e2.format("MMM") : u2(n2, "monthsShort", "months", 3);
  8382. }, firstDayOfWeek: function() {
  8383. return n2.$locale().weekStart || 0;
  8384. }, weekdays: function(e2) {
  8385. return e2 ? e2.format("dddd") : u2(n2, "weekdays");
  8386. }, weekdaysMin: function(e2) {
  8387. return e2 ? e2.format("dd") : u2(n2, "weekdaysMin", "weekdays", 2);
  8388. }, weekdaysShort: function(e2) {
  8389. return e2 ? e2.format("ddd") : u2(n2, "weekdaysShort", "weekdays", 3);
  8390. }, longDateFormat: function(e2) {
  8391. return a2(n2.$locale(), e2);
  8392. }, meridiem: this.$locale().meridiem, ordinal: this.$locale().ordinal };
  8393. };
  8394. r.localeData = function() {
  8395. return s2.bind(this)();
  8396. }, t.localeData = function() {
  8397. var n2 = i();
  8398. return { firstDayOfWeek: function() {
  8399. return n2.weekStart || 0;
  8400. }, weekdays: function() {
  8401. return t.weekdays();
  8402. }, weekdaysShort: function() {
  8403. return t.weekdaysShort();
  8404. }, weekdaysMin: function() {
  8405. return t.weekdaysMin();
  8406. }, months: function() {
  8407. return t.months();
  8408. }, monthsShort: function() {
  8409. return t.monthsShort();
  8410. }, longDateFormat: function(e2) {
  8411. return a2(n2, e2);
  8412. }, meridiem: n2.meridiem, ordinal: n2.ordinal };
  8413. }, t.months = function() {
  8414. return u2(i(), "months");
  8415. }, t.monthsShort = function() {
  8416. return u2(i(), "monthsShort", "months", 3);
  8417. }, t.weekdays = function(n2) {
  8418. return u2(i(), "weekdays", null, null, n2);
  8419. }, t.weekdaysShort = function(n2) {
  8420. return u2(i(), "weekdaysShort", "weekdays", 3, n2);
  8421. }, t.weekdaysMin = function(n2) {
  8422. return u2(i(), "weekdaysMin", "weekdays", 2, n2);
  8423. };
  8424. };
  8425. });
  8426. })(localeData$1);
  8427. var localeData = localeData$1.exports;
  8428. var customParseFormat$1 = { exports: {} };
  8429. (function(module2, exports2) {
  8430. !function(e, t) {
  8431. module2.exports = t();
  8432. }(commonjsGlobal, function() {
  8433. var e = { LTS: "h:mm:ss A", LT: "h:mm A", L: "MM/DD/YYYY", LL: "MMMM D, YYYY", LLL: "MMMM D, YYYY h:mm A", LLLL: "dddd, MMMM D, YYYY h:mm A" }, t = /(\[[^[]*\])|([-:/.()\s]+)|(A|a|YYYY|YY?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g, n = /\d\d/, r = /\d\d?/, i = /\d*[^\s\d-_:/()]+/, o2 = {}, s2 = function(e2) {
  8434. return (e2 = +e2) + (e2 > 68 ? 1900 : 2e3);
  8435. };
  8436. var a2 = function(e2) {
  8437. return function(t2) {
  8438. this[e2] = +t2;
  8439. };
  8440. }, f = [/[+-]\d\d:?(\d\d)?|Z/, function(e2) {
  8441. (this.zone || (this.zone = {})).offset = function(e3) {
  8442. if (!e3)
  8443. return 0;
  8444. if (e3 === "Z")
  8445. return 0;
  8446. var t2 = e3.match(/([+-]|\d\d)/g), n2 = 60 * t2[1] + (+t2[2] || 0);
  8447. return n2 === 0 ? 0 : t2[0] === "+" ? -n2 : n2;
  8448. }(e2);
  8449. }], h2 = function(e2) {
  8450. var t2 = o2[e2];
  8451. return t2 && (t2.indexOf ? t2 : t2.s.concat(t2.f));
  8452. }, u2 = function(e2, t2) {
  8453. var n2, r2 = o2.meridiem;
  8454. if (r2) {
  8455. for (var i2 = 1; i2 <= 24; i2 += 1)
  8456. if (e2.indexOf(r2(i2, 0, t2)) > -1) {
  8457. n2 = i2 > 12;
  8458. break;
  8459. }
  8460. } else
  8461. n2 = e2 === (t2 ? "pm" : "PM");
  8462. return n2;
  8463. }, d2 = { A: [i, function(e2) {
  8464. this.afternoon = u2(e2, false);
  8465. }], a: [i, function(e2) {
  8466. this.afternoon = u2(e2, true);
  8467. }], S: [/\d/, function(e2) {
  8468. this.milliseconds = 100 * +e2;
  8469. }], SS: [n, function(e2) {
  8470. this.milliseconds = 10 * +e2;
  8471. }], SSS: [/\d{3}/, function(e2) {
  8472. this.milliseconds = +e2;
  8473. }], s: [r, a2("seconds")], ss: [r, a2("seconds")], m: [r, a2("minutes")], mm: [r, a2("minutes")], H: [r, a2("hours")], h: [r, a2("hours")], HH: [r, a2("hours")], hh: [r, a2("hours")], D: [r, a2("day")], DD: [n, a2("day")], Do: [i, function(e2) {
  8474. var t2 = o2.ordinal, n2 = e2.match(/\d+/);
  8475. if (this.day = n2[0], t2)
  8476. for (var r2 = 1; r2 <= 31; r2 += 1)
  8477. t2(r2).replace(/\[|\]/g, "") === e2 && (this.day = r2);
  8478. }], M: [r, a2("month")], MM: [n, a2("month")], MMM: [i, function(e2) {
  8479. var t2 = h2("months"), n2 = (h2("monthsShort") || t2.map(function(e3) {
  8480. return e3.slice(0, 3);
  8481. })).indexOf(e2) + 1;
  8482. if (n2 < 1)
  8483. throw new Error();
  8484. this.month = n2 % 12 || n2;
  8485. }], MMMM: [i, function(e2) {
  8486. var t2 = h2("months").indexOf(e2) + 1;
  8487. if (t2 < 1)
  8488. throw new Error();
  8489. this.month = t2 % 12 || t2;
  8490. }], Y: [/[+-]?\d+/, a2("year")], YY: [n, function(e2) {
  8491. this.year = s2(e2);
  8492. }], YYYY: [/\d{4}/, a2("year")], Z: f, ZZ: f };
  8493. function c(n2) {
  8494. var r2, i2;
  8495. r2 = n2, i2 = o2 && o2.formats;
  8496. for (var s3 = (n2 = r2.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, function(t2, n3, r3) {
  8497. var o3 = r3 && r3.toUpperCase();
  8498. return n3 || i2[r3] || e[r3] || i2[o3].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(e2, t3, n4) {
  8499. return t3 || n4.slice(1);
  8500. });
  8501. })).match(t), a3 = s3.length, f2 = 0; f2 < a3; f2 += 1) {
  8502. var h3 = s3[f2], u3 = d2[h3], c2 = u3 && u3[0], l2 = u3 && u3[1];
  8503. s3[f2] = l2 ? { regex: c2, parser: l2 } : h3.replace(/^\[|\]$/g, "");
  8504. }
  8505. return function(e2) {
  8506. for (var t2 = {}, n3 = 0, r3 = 0; n3 < a3; n3 += 1) {
  8507. var i3 = s3[n3];
  8508. if (typeof i3 == "string")
  8509. r3 += i3.length;
  8510. else {
  8511. var o3 = i3.regex, f3 = i3.parser, h4 = e2.slice(r3), u4 = o3.exec(h4)[0];
  8512. f3.call(t2, u4), e2 = e2.replace(u4, "");
  8513. }
  8514. }
  8515. return function(e3) {
  8516. var t3 = e3.afternoon;
  8517. if (t3 !== void 0) {
  8518. var n4 = e3.hours;
  8519. t3 ? n4 < 12 && (e3.hours += 12) : n4 === 12 && (e3.hours = 0), delete e3.afternoon;
  8520. }
  8521. }(t2), t2;
  8522. };
  8523. }
  8524. return function(e2, t2, n2) {
  8525. n2.p.customParseFormat = true, e2 && e2.parseTwoDigitYear && (s2 = e2.parseTwoDigitYear);
  8526. var r2 = t2.prototype, i2 = r2.parse;
  8527. r2.parse = function(e3) {
  8528. var t3 = e3.date, r3 = e3.utc, s3 = e3.args;
  8529. this.$u = r3;
  8530. var a3 = s3[1];
  8531. if (typeof a3 == "string") {
  8532. var f2 = s3[2] === true, h3 = s3[3] === true, u3 = f2 || h3, d3 = s3[2];
  8533. h3 && (d3 = s3[2]), o2 = this.$locale(), !f2 && d3 && (o2 = n2.Ls[d3]), this.$d = function(e4, t4, n3) {
  8534. try {
  8535. if (["x", "X"].indexOf(t4) > -1)
  8536. return new Date((t4 === "X" ? 1e3 : 1) * e4);
  8537. var r4 = c(t4)(e4), i3 = r4.year, o3 = r4.month, s4 = r4.day, a4 = r4.hours, f3 = r4.minutes, h4 = r4.seconds, u4 = r4.milliseconds, d4 = r4.zone, l3 = new Date(), m3 = s4 || (i3 || o3 ? 1 : l3.getDate()), M3 = i3 || l3.getFullYear(), Y2 = 0;
  8538. i3 && !o3 || (Y2 = o3 > 0 ? o3 - 1 : l3.getMonth());
  8539. var p2 = a4 || 0, v2 = f3 || 0, D2 = h4 || 0, g = u4 || 0;
  8540. return d4 ? new Date(Date.UTC(M3, Y2, m3, p2, v2, D2, g + 60 * d4.offset * 1e3)) : n3 ? new Date(Date.UTC(M3, Y2, m3, p2, v2, D2, g)) : new Date(M3, Y2, m3, p2, v2, D2, g);
  8541. } catch (e5) {
  8542. return new Date("");
  8543. }
  8544. }(t3, a3, r3), this.init(), d3 && d3 !== true && (this.$L = this.locale(d3).$L), u3 && t3 != this.format(a3) && (this.$d = new Date("")), o2 = {};
  8545. } else if (a3 instanceof Array)
  8546. for (var l2 = a3.length, m2 = 1; m2 <= l2; m2 += 1) {
  8547. s3[1] = a3[m2 - 1];
  8548. var M2 = n2.apply(this, s3);
  8549. if (M2.isValid()) {
  8550. this.$d = M2.$d, this.$L = M2.$L, this.init();
  8551. break;
  8552. }
  8553. m2 === l2 && (this.$d = new Date(""));
  8554. }
  8555. else
  8556. i2.call(this, e3);
  8557. };
  8558. };
  8559. });
  8560. })(customParseFormat$1);
  8561. var customParseFormat = customParseFormat$1.exports;
  8562. const DEFAULT_FORMATS_TIME = "HH:mm:ss";
  8563. const DEFAULT_FORMATS_DATE = "YYYY-MM-DD";
  8564. const DEFAULT_FORMATS_DATEPICKER = {
  8565. date: DEFAULT_FORMATS_DATE,
  8566. week: "gggg[w]ww",
  8567. year: "YYYY",
  8568. month: "YYYY-MM",
  8569. datetime: `${DEFAULT_FORMATS_DATE} ${DEFAULT_FORMATS_TIME}`,
  8570. monthrange: "YYYY-MM",
  8571. daterange: DEFAULT_FORMATS_DATE,
  8572. datetimerange: `${DEFAULT_FORMATS_DATE} ${DEFAULT_FORMATS_TIME}`
  8573. };
  8574. const timePickerDefaultProps = {
  8575. id: {
  8576. type: [Array, String]
  8577. },
  8578. name: {
  8579. type: [Array, String],
  8580. default: ""
  8581. },
  8582. popperClass: {
  8583. type: String,
  8584. default: ""
  8585. },
  8586. format: {
  8587. type: String
  8588. },
  8589. valueFormat: {
  8590. type: String
  8591. },
  8592. type: {
  8593. type: String,
  8594. default: ""
  8595. },
  8596. clearable: {
  8597. type: Boolean,
  8598. default: true
  8599. },
  8600. clearIcon: {
  8601. type: [String, Object],
  8602. default: circleClose
  8603. },
  8604. editable: {
  8605. type: Boolean,
  8606. default: true
  8607. },
  8608. prefixIcon: {
  8609. type: [String, Object],
  8610. default: ""
  8611. },
  8612. size: {
  8613. type: String,
  8614. validator: isValidComponentSize
  8615. },
  8616. readonly: {
  8617. type: Boolean,
  8618. default: false
  8619. },
  8620. disabled: {
  8621. type: Boolean,
  8622. default: false
  8623. },
  8624. placeholder: {
  8625. type: String,
  8626. default: ""
  8627. },
  8628. popperOptions: {
  8629. type: Object,
  8630. default: () => ({})
  8631. },
  8632. modelValue: {
  8633. type: [Date, Array, String, Number],
  8634. default: ""
  8635. },
  8636. rangeSeparator: {
  8637. type: String,
  8638. default: "-"
  8639. },
  8640. startPlaceholder: String,
  8641. endPlaceholder: String,
  8642. defaultValue: {
  8643. type: [Date, Array]
  8644. },
  8645. defaultTime: {
  8646. type: [Date, Array]
  8647. },
  8648. isRange: {
  8649. type: Boolean,
  8650. default: false
  8651. },
  8652. disabledHours: {
  8653. type: Function
  8654. },
  8655. disabledMinutes: {
  8656. type: Function
  8657. },
  8658. disabledSeconds: {
  8659. type: Function
  8660. },
  8661. disabledDate: {
  8662. type: Function
  8663. },
  8664. cellClassName: {
  8665. type: Function
  8666. },
  8667. shortcuts: {
  8668. type: Array,
  8669. default: () => []
  8670. },
  8671. arrowControl: {
  8672. type: Boolean,
  8673. default: false
  8674. },
  8675. validateEvent: {
  8676. type: Boolean,
  8677. default: true
  8678. },
  8679. unlinkPanels: Boolean
  8680. };
  8681. const dateEquals = function(a2, b2) {
  8682. const aIsDate = a2 instanceof Date;
  8683. const bIsDate = b2 instanceof Date;
  8684. if (aIsDate && bIsDate) {
  8685. return a2.getTime() === b2.getTime();
  8686. }
  8687. if (!aIsDate && !bIsDate) {
  8688. return a2 === b2;
  8689. }
  8690. return false;
  8691. };
  8692. const valueEquals = function(a2, b2) {
  8693. const aIsArray = Array.isArray(a2);
  8694. const bIsArray = Array.isArray(b2);
  8695. if (aIsArray && bIsArray) {
  8696. if (a2.length !== b2.length) {
  8697. return false;
  8698. }
  8699. return a2.every((item, index) => dateEquals(item, b2[index]));
  8700. }
  8701. if (!aIsArray && !bIsArray) {
  8702. return dateEquals(a2, b2);
  8703. }
  8704. return false;
  8705. };
  8706. const parser = function(date4, format2, lang) {
  8707. const day = isEmpty(format2) || format2 === "x" ? dayjs(date4).locale(lang) : dayjs(date4, format2).locale(lang);
  8708. return day.isValid() ? day : void 0;
  8709. };
  8710. const formatter = function(date4, format2, lang) {
  8711. if (isEmpty(format2))
  8712. return date4;
  8713. if (format2 === "x")
  8714. return +date4;
  8715. return dayjs(date4).locale(lang).format(format2);
  8716. };
  8717. const _sfc_main$S = defineComponent({
  8718. name: "Picker",
  8719. components: {
  8720. ElInput,
  8721. ElTooltip,
  8722. ElIcon
  8723. },
  8724. props: timePickerDefaultProps,
  8725. emits: [
  8726. "update:modelValue",
  8727. "change",
  8728. "focus",
  8729. "blur",
  8730. "calendar-change",
  8731. "panel-change",
  8732. "visible-change"
  8733. ],
  8734. setup(props, ctx) {
  8735. const { lang } = useLocale();
  8736. const nsDate = useNamespace("date");
  8737. const nsInput = useNamespace("input");
  8738. const nsRange = useNamespace("range");
  8739. const elForm2 = inject(formContextKey, {});
  8740. const elFormItem2 = inject(formItemContextKey, {});
  8741. const elPopperOptions = inject("ElPopperOptions", {});
  8742. const refPopper = ref();
  8743. const inputRef = ref();
  8744. const pickerVisible = ref(false);
  8745. const pickerActualVisible = ref(false);
  8746. const valueOnOpen = ref(null);
  8747. watch(pickerVisible, (val) => {
  8748. var _a2;
  8749. if (!val) {
  8750. userInput.value = null;
  8751. nextTick(() => {
  8752. emitChange(props.modelValue);
  8753. });
  8754. ctx.emit("blur");
  8755. blurInput();
  8756. props.validateEvent && ((_a2 = elFormItem2.validate) == null ? void 0 : _a2.call(elFormItem2, "blur").catch((err) => debugWarn()));
  8757. } else {
  8758. valueOnOpen.value = props.modelValue;
  8759. }
  8760. });
  8761. const emitChange = (val, isClear) => {
  8762. var _a2;
  8763. if (isClear || !valueEquals(val, valueOnOpen.value)) {
  8764. ctx.emit("change", val);
  8765. props.validateEvent && ((_a2 = elFormItem2.validate) == null ? void 0 : _a2.call(elFormItem2, "change").catch((err) => debugWarn()));
  8766. }
  8767. };
  8768. const emitInput = (val) => {
  8769. if (!valueEquals(props.modelValue, val)) {
  8770. let formatValue;
  8771. if (Array.isArray(val)) {
  8772. formatValue = val.map((_2) => formatter(_2, props.valueFormat, lang.value));
  8773. } else if (val) {
  8774. formatValue = formatter(val, props.valueFormat, lang.value);
  8775. }
  8776. ctx.emit("update:modelValue", val ? formatValue : val, lang.value);
  8777. }
  8778. };
  8779. const refInput = computed(() => {
  8780. if (inputRef.value) {
  8781. const _r = isRangeInput.value ? inputRef.value : inputRef.value.$el;
  8782. return Array.from(_r.querySelectorAll("input"));
  8783. }
  8784. return [];
  8785. });
  8786. const refStartInput = computed(() => {
  8787. return refInput == null ? void 0 : refInput.value[0];
  8788. });
  8789. const refEndInput = computed(() => {
  8790. return refInput == null ? void 0 : refInput.value[1];
  8791. });
  8792. const setSelectionRange = (start2, end2, pos) => {
  8793. const _inputs = refInput.value;
  8794. if (!_inputs.length)
  8795. return;
  8796. if (!pos || pos === "min") {
  8797. _inputs[0].setSelectionRange(start2, end2);
  8798. _inputs[0].focus();
  8799. } else if (pos === "max") {
  8800. _inputs[1].setSelectionRange(start2, end2);
  8801. _inputs[1].focus();
  8802. }
  8803. };
  8804. const onPick = (date4 = "", visible = false) => {
  8805. pickerVisible.value = visible;
  8806. let result;
  8807. if (Array.isArray(date4)) {
  8808. result = date4.map((_2) => _2.toDate());
  8809. } else {
  8810. result = date4 ? date4.toDate() : date4;
  8811. }
  8812. userInput.value = null;
  8813. emitInput(result);
  8814. };
  8815. const onBeforeShow = () => {
  8816. pickerActualVisible.value = true;
  8817. };
  8818. const onShow = () => {
  8819. ctx.emit("visible-change", true);
  8820. };
  8821. const onHide = () => {
  8822. pickerActualVisible.value = false;
  8823. ctx.emit("visible-change", false);
  8824. };
  8825. const focus = (focusStartInput = true) => {
  8826. let input = refStartInput.value;
  8827. if (!focusStartInput && isRangeInput.value) {
  8828. input = refEndInput.value;
  8829. }
  8830. if (input) {
  8831. input.focus();
  8832. }
  8833. };
  8834. const handleFocus = (e) => {
  8835. if (props.readonly || pickerDisabled.value || pickerVisible.value)
  8836. return;
  8837. pickerVisible.value = true;
  8838. ctx.emit("focus", e);
  8839. };
  8840. const handleBlur = () => {
  8841. var _a2;
  8842. (_a2 = refPopper.value) == null ? void 0 : _a2.onClose();
  8843. blurInput();
  8844. };
  8845. const pickerDisabled = computed(() => {
  8846. return props.disabled || elForm2.disabled;
  8847. });
  8848. const parsedValue = computed(() => {
  8849. let result;
  8850. if (valueIsEmpty.value) {
  8851. if (pickerOptions.value.getDefaultValue) {
  8852. result = pickerOptions.value.getDefaultValue();
  8853. }
  8854. } else {
  8855. if (Array.isArray(props.modelValue)) {
  8856. result = props.modelValue.map((_2) => parser(_2, props.valueFormat, lang.value));
  8857. } else {
  8858. result = parser(props.modelValue, props.valueFormat, lang.value);
  8859. }
  8860. }
  8861. if (pickerOptions.value.getRangeAvailableTime) {
  8862. const availableResult = pickerOptions.value.getRangeAvailableTime(result);
  8863. if (!isEqual(availableResult, result)) {
  8864. result = availableResult;
  8865. emitInput(Array.isArray(result) ? result.map((_2) => _2.toDate()) : result.toDate());
  8866. }
  8867. }
  8868. if (Array.isArray(result) && result.some((_2) => !_2)) {
  8869. result = [];
  8870. }
  8871. return result;
  8872. });
  8873. const displayValue = computed(() => {
  8874. if (!pickerOptions.value.panelReady)
  8875. return;
  8876. const formattedValue = formatDayjsToString(parsedValue.value);
  8877. if (Array.isArray(userInput.value)) {
  8878. return [
  8879. userInput.value[0] || formattedValue && formattedValue[0] || "",
  8880. userInput.value[1] || formattedValue && formattedValue[1] || ""
  8881. ];
  8882. } else if (userInput.value !== null) {
  8883. return userInput.value;
  8884. }
  8885. if (!isTimePicker.value && valueIsEmpty.value)
  8886. return;
  8887. if (!pickerVisible.value && valueIsEmpty.value)
  8888. return;
  8889. if (formattedValue) {
  8890. return isDatesPicker.value ? formattedValue.join(", ") : formattedValue;
  8891. }
  8892. return "";
  8893. });
  8894. const isTimeLikePicker = computed(() => props.type.includes("time"));
  8895. const isTimePicker = computed(() => props.type.startsWith("time"));
  8896. const isDatesPicker = computed(() => props.type === "dates");
  8897. const triggerIcon = computed(() => props.prefixIcon || (isTimeLikePicker.value ? clock : calendar));
  8898. const showClose = ref(false);
  8899. const onClearIconClick = (event) => {
  8900. if (props.readonly || pickerDisabled.value)
  8901. return;
  8902. if (showClose.value) {
  8903. event.stopPropagation();
  8904. emitInput(null);
  8905. emitChange(null, true);
  8906. showClose.value = false;
  8907. pickerVisible.value = false;
  8908. pickerOptions.value.handleClear && pickerOptions.value.handleClear();
  8909. }
  8910. };
  8911. const valueIsEmpty = computed(() => {
  8912. return !props.modelValue || Array.isArray(props.modelValue) && !props.modelValue.length;
  8913. });
  8914. const onMouseEnter = () => {
  8915. if (props.readonly || pickerDisabled.value)
  8916. return;
  8917. if (!valueIsEmpty.value && props.clearable) {
  8918. showClose.value = true;
  8919. }
  8920. };
  8921. const onMouseLeave = () => {
  8922. showClose.value = false;
  8923. };
  8924. const isRangeInput = computed(() => {
  8925. return props.type.includes("range");
  8926. });
  8927. const pickerSize = useSize();
  8928. const popperPaneRef = computed(() => {
  8929. var _a2, _b2;
  8930. return (_b2 = (_a2 = refPopper.value) == null ? void 0 : _a2.popperRef) == null ? void 0 : _b2.contentRef;
  8931. });
  8932. const popperEl = computed(() => {
  8933. var _a2, _b2;
  8934. return (_b2 = (_a2 = unref(refPopper)) == null ? void 0 : _a2.popperRef) == null ? void 0 : _b2.contentRef;
  8935. });
  8936. const actualInputRef = computed(() => {
  8937. var _a2;
  8938. if (unref(isRangeInput)) {
  8939. return unref(inputRef);
  8940. }
  8941. return (_a2 = unref(inputRef)) == null ? void 0 : _a2.$el;
  8942. });
  8943. onClickOutside(actualInputRef, (e) => {
  8944. const unrefedPopperEl = unref(popperEl);
  8945. const inputEl = unref(actualInputRef);
  8946. if (unrefedPopperEl && (e.target === unrefedPopperEl || e.composedPath().includes(unrefedPopperEl)) || e.target === inputEl || e.composedPath().includes(inputEl))
  8947. return;
  8948. pickerVisible.value = false;
  8949. });
  8950. const userInput = ref(null);
  8951. const handleChange2 = () => {
  8952. if (userInput.value) {
  8953. const value = parseUserInputToDayjs(displayValue.value);
  8954. if (value) {
  8955. if (isValidValue(value)) {
  8956. emitInput(Array.isArray(value) ? value.map((_2) => _2.toDate()) : value.toDate());
  8957. userInput.value = null;
  8958. }
  8959. }
  8960. }
  8961. if (userInput.value === "") {
  8962. emitInput(null);
  8963. emitChange(null);
  8964. userInput.value = null;
  8965. }
  8966. };
  8967. const blurInput = () => {
  8968. refInput.value.forEach((input) => input.blur());
  8969. };
  8970. const parseUserInputToDayjs = (value) => {
  8971. if (!value)
  8972. return null;
  8973. return pickerOptions.value.parseUserInput(value);
  8974. };
  8975. const formatDayjsToString = (value) => {
  8976. if (!value)
  8977. return null;
  8978. return pickerOptions.value.formatToString(value);
  8979. };
  8980. const isValidValue = (value) => {
  8981. return pickerOptions.value.isValidValue(value);
  8982. };
  8983. const handleKeydown = (event) => {
  8984. const code = event.code;
  8985. if (code === EVENT_CODE.esc) {
  8986. pickerVisible.value = false;
  8987. event.stopPropagation();
  8988. return;
  8989. }
  8990. if (code === EVENT_CODE.tab) {
  8991. if (!isRangeInput.value) {
  8992. handleChange2();
  8993. pickerVisible.value = false;
  8994. event.stopPropagation();
  8995. } else {
  8996. setTimeout(() => {
  8997. if (!refInput.value.includes(document.activeElement)) {
  8998. pickerVisible.value = false;
  8999. blurInput();
  9000. }
  9001. }, 0);
  9002. }
  9003. return;
  9004. }
  9005. if (code === EVENT_CODE.enter || code === EVENT_CODE.numpadEnter) {
  9006. if (userInput.value === null || userInput.value === "" || isValidValue(parseUserInputToDayjs(displayValue.value))) {
  9007. handleChange2();
  9008. pickerVisible.value = false;
  9009. }
  9010. event.stopPropagation();
  9011. return;
  9012. }
  9013. if (userInput.value) {
  9014. event.stopPropagation();
  9015. return;
  9016. }
  9017. if (pickerOptions.value.handleKeydown) {
  9018. pickerOptions.value.handleKeydown(event);
  9019. }
  9020. };
  9021. const onUserInput = (e) => {
  9022. userInput.value = e;
  9023. };
  9024. const handleStartInput = (event) => {
  9025. if (userInput.value) {
  9026. userInput.value = [event.target.value, userInput.value[1]];
  9027. } else {
  9028. userInput.value = [event.target.value, null];
  9029. }
  9030. };
  9031. const handleEndInput = (event) => {
  9032. if (userInput.value) {
  9033. userInput.value = [userInput.value[0], event.target.value];
  9034. } else {
  9035. userInput.value = [null, event.target.value];
  9036. }
  9037. };
  9038. const handleStartChange = () => {
  9039. const value = parseUserInputToDayjs(userInput.value && userInput.value[0]);
  9040. if (value && value.isValid()) {
  9041. userInput.value = [formatDayjsToString(value), displayValue.value[1]];
  9042. const newValue = [value, parsedValue.value && parsedValue.value[1]];
  9043. if (isValidValue(newValue)) {
  9044. emitInput(newValue);
  9045. userInput.value = null;
  9046. }
  9047. }
  9048. };
  9049. const handleEndChange = () => {
  9050. const value = parseUserInputToDayjs(userInput.value && userInput.value[1]);
  9051. if (value && value.isValid()) {
  9052. userInput.value = [displayValue.value[0], formatDayjsToString(value)];
  9053. const newValue = [parsedValue.value && parsedValue.value[0], value];
  9054. if (isValidValue(newValue)) {
  9055. emitInput(newValue);
  9056. userInput.value = null;
  9057. }
  9058. }
  9059. };
  9060. const pickerOptions = ref({});
  9061. const onSetPickerOption = (e) => {
  9062. pickerOptions.value[e[0]] = e[1];
  9063. pickerOptions.value.panelReady = true;
  9064. };
  9065. const onCalendarChange = (e) => {
  9066. ctx.emit("calendar-change", e);
  9067. };
  9068. const onPanelChange = (value, mode, view2) => {
  9069. ctx.emit("panel-change", value, mode, view2);
  9070. };
  9071. provide("EP_PICKER_BASE", {
  9072. props
  9073. });
  9074. return {
  9075. nsDate,
  9076. nsInput,
  9077. nsRange,
  9078. elPopperOptions,
  9079. isDatesPicker,
  9080. handleEndChange,
  9081. handleStartChange,
  9082. handleStartInput,
  9083. handleEndInput,
  9084. onUserInput,
  9085. handleChange: handleChange2,
  9086. handleKeydown,
  9087. popperPaneRef,
  9088. onClickOutside,
  9089. pickerSize,
  9090. isRangeInput,
  9091. onMouseLeave,
  9092. onMouseEnter,
  9093. onClearIconClick,
  9094. showClose,
  9095. triggerIcon,
  9096. onPick,
  9097. handleFocus,
  9098. handleBlur,
  9099. pickerVisible,
  9100. pickerActualVisible,
  9101. displayValue,
  9102. parsedValue,
  9103. setSelectionRange,
  9104. refPopper,
  9105. inputRef,
  9106. pickerDisabled,
  9107. onSetPickerOption,
  9108. onCalendarChange,
  9109. onPanelChange,
  9110. focus,
  9111. onShow,
  9112. onBeforeShow,
  9113. onHide
  9114. };
  9115. }
  9116. });
  9117. const _hoisted_1$z = ["id", "name", "placeholder", "value", "disabled", "readonly"];
  9118. const _hoisted_2$r = ["id", "name", "placeholder", "value", "disabled", "readonly"];
  9119. function _sfc_render$w(_ctx, _cache, $props, $setup, $data, $options) {
  9120. const _component_el_icon = resolveComponent("el-icon");
  9121. const _component_el_input = resolveComponent("el-input");
  9122. const _component_el_tooltip = resolveComponent("el-tooltip");
  9123. return openBlock(), createBlock(_component_el_tooltip, mergeProps({
  9124. ref: "refPopper",
  9125. visible: _ctx.pickerVisible,
  9126. "onUpdate:visible": _cache[17] || (_cache[17] = ($event) => _ctx.pickerVisible = $event),
  9127. effect: "light",
  9128. pure: "",
  9129. trigger: "click"
  9130. }, _ctx.$attrs, {
  9131. "append-to-body": "",
  9132. transition: `${_ctx.nsDate.namespace.value}-zoom-in-top`,
  9133. "popper-class": [`${_ctx.nsDate.namespace.value}-picker__popper`, _ctx.popperClass],
  9134. "popper-options": _ctx.elPopperOptions,
  9135. "fallback-placements": ["bottom", "top", "right", "left"],
  9136. "gpu-acceleration": false,
  9137. "stop-popper-mouse-event": false,
  9138. "hide-after": 0,
  9139. persistent: "",
  9140. onBeforeShow: _ctx.onBeforeShow,
  9141. onShow: _ctx.onShow,
  9142. onHide: _ctx.onHide
  9143. }), {
  9144. default: withCtx(() => [
  9145. !_ctx.isRangeInput ? (openBlock(), createBlock(_component_el_input, {
  9146. key: 0,
  9147. id: _ctx.id,
  9148. ref: "inputRef",
  9149. "model-value": _ctx.displayValue,
  9150. name: _ctx.name,
  9151. size: _ctx.pickerSize,
  9152. disabled: _ctx.pickerDisabled,
  9153. placeholder: _ctx.placeholder,
  9154. class: normalizeClass([_ctx.nsDate.b("editor"), _ctx.nsDate.bm("editor", _ctx.type), _ctx.$attrs.class]),
  9155. style: normalizeStyle(_ctx.$attrs.style),
  9156. readonly: !_ctx.editable || _ctx.readonly || _ctx.isDatesPicker || _ctx.type === "week",
  9157. onInput: _ctx.onUserInput,
  9158. onFocus: _ctx.handleFocus,
  9159. onKeydown: _ctx.handleKeydown,
  9160. onChange: _ctx.handleChange,
  9161. onMouseenter: _ctx.onMouseEnter,
  9162. onMouseleave: _ctx.onMouseLeave,
  9163. onClick: _cache[0] || (_cache[0] = withModifiers(() => {
  9164. }, ["stop"]))
  9165. }, {
  9166. prefix: withCtx(() => [
  9167. _ctx.triggerIcon ? (openBlock(), createBlock(_component_el_icon, {
  9168. key: 0,
  9169. class: normalizeClass(_ctx.nsInput.e("icon")),
  9170. onClick: _ctx.handleFocus
  9171. }, {
  9172. default: withCtx(() => [
  9173. (openBlock(), createBlock(resolveDynamicComponent(_ctx.triggerIcon)))
  9174. ]),
  9175. _: 1
  9176. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true)
  9177. ]),
  9178. suffix: withCtx(() => [
  9179. _ctx.showClose && _ctx.clearIcon ? (openBlock(), createBlock(_component_el_icon, {
  9180. key: 0,
  9181. class: normalizeClass(`${_ctx.nsInput.e("icon")} clear-icon`),
  9182. onClick: _ctx.onClearIconClick
  9183. }, {
  9184. default: withCtx(() => [
  9185. (openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon)))
  9186. ]),
  9187. _: 1
  9188. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true)
  9189. ]),
  9190. _: 1
  9191. }, 8, ["id", "model-value", "name", "size", "disabled", "placeholder", "class", "style", "readonly", "onInput", "onFocus", "onKeydown", "onChange", "onMouseenter", "onMouseleave"])) : (openBlock(), createElementBlock("div", {
  9192. key: 1,
  9193. ref: "inputRef",
  9194. class: normalizeClass([
  9195. _ctx.nsDate.b("editor"),
  9196. _ctx.nsDate.bm("editor", _ctx.type),
  9197. _ctx.nsInput.e("inner"),
  9198. _ctx.nsDate.is("disabled", _ctx.pickerDisabled),
  9199. _ctx.nsDate.is("active", _ctx.pickerVisible),
  9200. _ctx.nsRange.b("editor"),
  9201. _ctx.pickerSize ? _ctx.nsRange.bm("editor", _ctx.pickerSize) : "",
  9202. _ctx.$attrs.class
  9203. ]),
  9204. style: normalizeStyle(_ctx.$attrs.style),
  9205. onClick: _cache[7] || (_cache[7] = (...args) => _ctx.handleFocus && _ctx.handleFocus(...args)),
  9206. onMouseenter: _cache[8] || (_cache[8] = (...args) => _ctx.onMouseEnter && _ctx.onMouseEnter(...args)),
  9207. onMouseleave: _cache[9] || (_cache[9] = (...args) => _ctx.onMouseLeave && _ctx.onMouseLeave(...args)),
  9208. onKeydown: _cache[10] || (_cache[10] = (...args) => _ctx.handleKeydown && _ctx.handleKeydown(...args))
  9209. }, [
  9210. _ctx.triggerIcon ? (openBlock(), createBlock(_component_el_icon, {
  9211. key: 0,
  9212. class: normalizeClass([_ctx.nsInput.e("icon"), _ctx.nsRange.e("icon")]),
  9213. onClick: _ctx.handleFocus
  9214. }, {
  9215. default: withCtx(() => [
  9216. (openBlock(), createBlock(resolveDynamicComponent(_ctx.triggerIcon)))
  9217. ]),
  9218. _: 1
  9219. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true),
  9220. createElementVNode("input", {
  9221. id: _ctx.id && _ctx.id[0],
  9222. autocomplete: "off",
  9223. name: _ctx.name && _ctx.name[0],
  9224. placeholder: _ctx.startPlaceholder,
  9225. value: _ctx.displayValue && _ctx.displayValue[0],
  9226. disabled: _ctx.pickerDisabled,
  9227. readonly: !_ctx.editable || _ctx.readonly,
  9228. class: normalizeClass(_ctx.nsRange.b("input")),
  9229. onInput: _cache[1] || (_cache[1] = (...args) => _ctx.handleStartInput && _ctx.handleStartInput(...args)),
  9230. onChange: _cache[2] || (_cache[2] = (...args) => _ctx.handleStartChange && _ctx.handleStartChange(...args)),
  9231. onFocus: _cache[3] || (_cache[3] = (...args) => _ctx.handleFocus && _ctx.handleFocus(...args))
  9232. }, null, 42, _hoisted_1$z),
  9233. renderSlot(_ctx.$slots, "range-separator", {}, () => [
  9234. createElementVNode("span", {
  9235. class: normalizeClass(_ctx.nsRange.b("separator"))
  9236. }, toDisplayString(_ctx.rangeSeparator), 3)
  9237. ]),
  9238. createElementVNode("input", {
  9239. id: _ctx.id && _ctx.id[1],
  9240. autocomplete: "off",
  9241. name: _ctx.name && _ctx.name[1],
  9242. placeholder: _ctx.endPlaceholder,
  9243. value: _ctx.displayValue && _ctx.displayValue[1],
  9244. disabled: _ctx.pickerDisabled,
  9245. readonly: !_ctx.editable || _ctx.readonly,
  9246. class: normalizeClass(_ctx.nsRange.b("input")),
  9247. onFocus: _cache[4] || (_cache[4] = (...args) => _ctx.handleFocus && _ctx.handleFocus(...args)),
  9248. onInput: _cache[5] || (_cache[5] = (...args) => _ctx.handleEndInput && _ctx.handleEndInput(...args)),
  9249. onChange: _cache[6] || (_cache[6] = (...args) => _ctx.handleEndChange && _ctx.handleEndChange(...args))
  9250. }, null, 42, _hoisted_2$r),
  9251. _ctx.clearIcon ? (openBlock(), createBlock(_component_el_icon, {
  9252. key: 1,
  9253. class: normalizeClass([
  9254. _ctx.nsInput.e("icon"),
  9255. _ctx.nsRange.e("close-icon"),
  9256. {
  9257. [_ctx.nsRange.e("close-icon--hidden")]: !_ctx.showClose
  9258. }
  9259. ]),
  9260. onClick: _ctx.onClearIconClick
  9261. }, {
  9262. default: withCtx(() => [
  9263. (openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon)))
  9264. ]),
  9265. _: 1
  9266. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true)
  9267. ], 38))
  9268. ]),
  9269. content: withCtx(() => [
  9270. renderSlot(_ctx.$slots, "default", {
  9271. visible: _ctx.pickerVisible,
  9272. actualVisible: _ctx.pickerActualVisible,
  9273. parsedValue: _ctx.parsedValue,
  9274. format: _ctx.format,
  9275. unlinkPanels: _ctx.unlinkPanels,
  9276. type: _ctx.type,
  9277. defaultValue: _ctx.defaultValue,
  9278. onPick: _cache[11] || (_cache[11] = (...args) => _ctx.onPick && _ctx.onPick(...args)),
  9279. onSelectRange: _cache[12] || (_cache[12] = (...args) => _ctx.setSelectionRange && _ctx.setSelectionRange(...args)),
  9280. onSetPickerOption: _cache[13] || (_cache[13] = (...args) => _ctx.onSetPickerOption && _ctx.onSetPickerOption(...args)),
  9281. onCalendarChange: _cache[14] || (_cache[14] = (...args) => _ctx.onCalendarChange && _ctx.onCalendarChange(...args)),
  9282. onPanelChange: _cache[15] || (_cache[15] = (...args) => _ctx.onPanelChange && _ctx.onPanelChange(...args)),
  9283. onMousedown: _cache[16] || (_cache[16] = withModifiers(() => {
  9284. }, ["stop"]))
  9285. })
  9286. ]),
  9287. _: 3
  9288. }, 16, ["visible", "transition", "popper-class", "popper-options", "onBeforeShow", "onShow", "onHide"]);
  9289. }
  9290. var CommonPicker = /* @__PURE__ */ _export_sfc$1(_sfc_main$S, [["render", _sfc_render$w], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/time-picker/src/common/picker.vue"]]);
  9291. const nodeList = /* @__PURE__ */ new Map();
  9292. let startClick;
  9293. if (isClient$1) {
  9294. document.addEventListener("mousedown", (e) => startClick = e);
  9295. document.addEventListener("mouseup", (e) => {
  9296. for (const handlers of nodeList.values()) {
  9297. for (const { documentHandler } of handlers) {
  9298. documentHandler(e, startClick);
  9299. }
  9300. }
  9301. });
  9302. }
  9303. function createDocumentHandler(el, binding) {
  9304. let excludes = [];
  9305. if (Array.isArray(binding.arg)) {
  9306. excludes = binding.arg;
  9307. } else if (isElement$1(binding.arg)) {
  9308. excludes.push(binding.arg);
  9309. }
  9310. return function(mouseup, mousedown) {
  9311. const popperRef = binding.instance.popperRef;
  9312. const mouseUpTarget = mouseup.target;
  9313. const mouseDownTarget = mousedown == null ? void 0 : mousedown.target;
  9314. const isBound = !binding || !binding.instance;
  9315. const isTargetExists = !mouseUpTarget || !mouseDownTarget;
  9316. const isContainedByEl = el.contains(mouseUpTarget) || el.contains(mouseDownTarget);
  9317. const isSelf = el === mouseUpTarget;
  9318. const isTargetExcluded = excludes.length && excludes.some((item) => item == null ? void 0 : item.contains(mouseUpTarget)) || excludes.length && excludes.includes(mouseDownTarget);
  9319. const isContainedByPopper = popperRef && (popperRef.contains(mouseUpTarget) || popperRef.contains(mouseDownTarget));
  9320. if (isBound || isTargetExists || isContainedByEl || isSelf || isTargetExcluded || isContainedByPopper) {
  9321. return;
  9322. }
  9323. binding.value(mouseup, mousedown);
  9324. };
  9325. }
  9326. const ClickOutside = {
  9327. beforeMount(el, binding) {
  9328. if (!nodeList.has(el)) {
  9329. nodeList.set(el, []);
  9330. }
  9331. nodeList.get(el).push({
  9332. documentHandler: createDocumentHandler(el, binding),
  9333. bindingFn: binding.value
  9334. });
  9335. },
  9336. updated(el, binding) {
  9337. if (!nodeList.has(el)) {
  9338. nodeList.set(el, []);
  9339. }
  9340. const handlers = nodeList.get(el);
  9341. const oldHandlerIndex = handlers.findIndex((item) => item.bindingFn === binding.oldValue);
  9342. const newHandler = {
  9343. documentHandler: createDocumentHandler(el, binding),
  9344. bindingFn: binding.value
  9345. };
  9346. if (oldHandlerIndex >= 0) {
  9347. handlers.splice(oldHandlerIndex, 1, newHandler);
  9348. } else {
  9349. handlers.push(newHandler);
  9350. }
  9351. },
  9352. unmounted(el) {
  9353. nodeList.delete(el);
  9354. }
  9355. };
  9356. var RepeatClick = {
  9357. beforeMount(el, binding) {
  9358. let interval = null;
  9359. let startTime;
  9360. const handler3 = () => binding.value && binding.value();
  9361. const clear = () => {
  9362. if (Date.now() - startTime < 100) {
  9363. handler3();
  9364. }
  9365. clearInterval(interval);
  9366. interval = null;
  9367. };
  9368. on(el, "mousedown", (e) => {
  9369. if (e.button !== 0)
  9370. return;
  9371. startTime = Date.now();
  9372. once(document, "mouseup", clear);
  9373. clearInterval(interval);
  9374. interval = setInterval(handler3, 100);
  9375. });
  9376. }
  9377. };
  9378. var D = false, o, p, m, u, d, M, l, w, x, E, F, _, h, A, X;
  9379. function a() {
  9380. if (!D) {
  9381. D = true;
  9382. var e = navigator.userAgent, n = /(?:MSIE.(\d+\.\d+))|(?:(?:Firefox|GranParadiso|Iceweasel).(\d+\.\d+))|(?:Opera(?:.+Version.|.)(\d+\.\d+))|(?:AppleWebKit.(\d+(?:\.\d+)?))|(?:Trident\/\d+\.\d+.*rv:(\d+\.\d+))/.exec(e), i = /(Mac OS X)|(Windows)|(Linux)/.exec(e);
  9383. if (_ = /\b(iPhone|iP[ao]d)/.exec(e), h = /\b(iP[ao]d)/.exec(e), E = /Android/i.exec(e), A = /FBAN\/\w+;/i.exec(e), X = /Mobile/i.exec(e), F = !!/Win64/.exec(e), n) {
  9384. o = n[1] ? parseFloat(n[1]) : n[5] ? parseFloat(n[5]) : NaN, o && document && document.documentMode && (o = document.documentMode);
  9385. var r = /(?:Trident\/(\d+.\d+))/.exec(e);
  9386. M = r ? parseFloat(r[1]) + 4 : o, p = n[2] ? parseFloat(n[2]) : NaN, m = n[3] ? parseFloat(n[3]) : NaN, u = n[4] ? parseFloat(n[4]) : NaN, u ? (n = /(?:Chrome\/(\d+\.\d+))/.exec(e), d = n && n[1] ? parseFloat(n[1]) : NaN) : d = NaN;
  9387. } else
  9388. o = p = m = d = u = NaN;
  9389. if (i) {
  9390. if (i[1]) {
  9391. var t = /(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(e);
  9392. l = t ? parseFloat(t[1].replace("_", ".")) : true;
  9393. } else
  9394. l = false;
  9395. w = !!i[2], x = !!i[3];
  9396. } else
  9397. l = w = x = false;
  9398. }
  9399. }
  9400. var v = { ie: function() {
  9401. return a() || o;
  9402. }, ieCompatibilityMode: function() {
  9403. return a() || M > o;
  9404. }, ie64: function() {
  9405. return v.ie() && F;
  9406. }, firefox: function() {
  9407. return a() || p;
  9408. }, opera: function() {
  9409. return a() || m;
  9410. }, webkit: function() {
  9411. return a() || u;
  9412. }, safari: function() {
  9413. return v.webkit();
  9414. }, chrome: function() {
  9415. return a() || d;
  9416. }, windows: function() {
  9417. return a() || w;
  9418. }, osx: function() {
  9419. return a() || l;
  9420. }, linux: function() {
  9421. return a() || x;
  9422. }, iphone: function() {
  9423. return a() || _;
  9424. }, mobile: function() {
  9425. return a() || _ || h || E || X;
  9426. }, nativeApp: function() {
  9427. return a() || A;
  9428. }, android: function() {
  9429. return a() || E;
  9430. }, ipad: function() {
  9431. return a() || h;
  9432. } }, b = v;
  9433. var s = !!(typeof window < "u" && window.document && window.document.createElement), Y = { canUseDOM: s, canUseWorkers: typeof Worker < "u", canUseEventListeners: s && !!(window.addEventListener || window.attachEvent), canUseViewport: s && !!window.screen, isInWorker: !s }, N = Y;
  9434. var O;
  9435. N.canUseDOM && (O = document.implementation && document.implementation.hasFeature && document.implementation.hasFeature("", "") !== true);
  9436. function L(e, n) {
  9437. if (!N.canUseDOM || n && !("addEventListener" in document))
  9438. return false;
  9439. var i = "on" + e, r = i in document;
  9440. if (!r) {
  9441. var t = document.createElement("div");
  9442. t.setAttribute(i, "return;"), r = typeof t[i] == "function";
  9443. }
  9444. return !r && O && e === "wheel" && (r = document.implementation.hasFeature("Events.wheel", "3.0")), r;
  9445. }
  9446. var I = L;
  9447. var P = 10, T = 40, U = 800;
  9448. function S(e) {
  9449. var n = 0, i = 0, r = 0, t = 0;
  9450. return "detail" in e && (i = e.detail), "wheelDelta" in e && (i = -e.wheelDelta / 120), "wheelDeltaY" in e && (i = -e.wheelDeltaY / 120), "wheelDeltaX" in e && (n = -e.wheelDeltaX / 120), "axis" in e && e.axis === e.HORIZONTAL_AXIS && (n = i, i = 0), r = n * P, t = i * P, "deltaY" in e && (t = e.deltaY), "deltaX" in e && (r = e.deltaX), (r || t) && e.deltaMode && (e.deltaMode == 1 ? (r *= T, t *= T) : (r *= U, t *= U)), r && !n && (n = r < 1 ? -1 : 1), t && !i && (i = t < 1 ? -1 : 1), { spinX: n, spinY: i, pixelX: r, pixelY: t };
  9451. }
  9452. S.getEventType = function() {
  9453. return b.firefox() ? "DOMMouseScroll" : I("wheel") ? "wheel" : "mousewheel";
  9454. };
  9455. var W = S;
  9456. /**
  9457. * Checks if an event is supported in the current execution environment.
  9458. *
  9459. * NOTE: This will not work correctly for non-generic events such as `change`,
  9460. * `reset`, `load`, `error`, and `select`.
  9461. *
  9462. * Borrows from Modernizr.
  9463. *
  9464. * @param {string} eventNameSuffix Event name, e.g. "click".
  9465. * @param {?boolean} capture Check if the capture phase is supported.
  9466. * @return {boolean} True if the event is supported.
  9467. * @internal
  9468. * @license Modernizr 3.0.0pre (Custom Build) | MIT
  9469. */
  9470. const mousewheel = function(element, callback) {
  9471. if (element && element.addEventListener) {
  9472. const fn2 = function(event) {
  9473. const normalized = W(event);
  9474. callback && Reflect.apply(callback, this, [event, normalized]);
  9475. };
  9476. if (isFirefox()) {
  9477. element.addEventListener("DOMMouseScroll", fn2);
  9478. } else {
  9479. element.onmousewheel = fn2;
  9480. }
  9481. }
  9482. };
  9483. const Mousewheel = {
  9484. beforeMount(el, binding) {
  9485. mousewheel(el, binding.value);
  9486. }
  9487. };
  9488. const makeList = (total, method4, methodFunc) => {
  9489. const arr = [];
  9490. const disabledArr = method4 && methodFunc();
  9491. for (let i = 0; i < total; i++) {
  9492. arr[i] = disabledArr ? disabledArr.includes(i) : false;
  9493. }
  9494. return arr;
  9495. };
  9496. const makeAvailableArr = (list) => {
  9497. return list.map((_2, index) => !_2 ? index : _2).filter((_2) => _2 !== true);
  9498. };
  9499. const getTimeLists = (disabledHours, disabledMinutes, disabledSeconds) => {
  9500. const getHoursList = (role, compare) => {
  9501. return makeList(24, disabledHours, () => disabledHours(role, compare));
  9502. };
  9503. const getMinutesList = (hour, role, compare) => {
  9504. return makeList(60, disabledMinutes, () => disabledMinutes(hour, role, compare));
  9505. };
  9506. const getSecondsList = (hour, minute, role, compare) => {
  9507. return makeList(60, disabledSeconds, () => disabledSeconds(hour, minute, role, compare));
  9508. };
  9509. return {
  9510. getHoursList,
  9511. getMinutesList,
  9512. getSecondsList
  9513. };
  9514. };
  9515. const getAvailableArrs = (disabledHours, disabledMinutes, disabledSeconds) => {
  9516. const { getHoursList, getMinutesList, getSecondsList } = getTimeLists(disabledHours, disabledMinutes, disabledSeconds);
  9517. const getAvailableHours = (role, compare) => {
  9518. return makeAvailableArr(getHoursList(role, compare));
  9519. };
  9520. const getAvailableMinutes = (hour, role, compare) => {
  9521. return makeAvailableArr(getMinutesList(hour, role, compare));
  9522. };
  9523. const getAvailableSeconds = (hour, minute, role, compare) => {
  9524. return makeAvailableArr(getSecondsList(hour, minute, role, compare));
  9525. };
  9526. return {
  9527. getAvailableHours,
  9528. getAvailableMinutes,
  9529. getAvailableSeconds
  9530. };
  9531. };
  9532. const useOldValue = (props) => {
  9533. const oldValue = ref(props.parsedValue);
  9534. watch(() => props.visible, (val) => {
  9535. if (!val) {
  9536. oldValue.value = props.parsedValue;
  9537. }
  9538. });
  9539. return oldValue;
  9540. };
  9541. const _sfc_main$R = defineComponent({
  9542. directives: {
  9543. repeatClick: RepeatClick
  9544. },
  9545. components: {
  9546. ElScrollbar,
  9547. ElIcon,
  9548. ArrowUp: arrowUp,
  9549. ArrowDown: arrowDown
  9550. },
  9551. props: {
  9552. role: {
  9553. type: String,
  9554. required: true
  9555. },
  9556. spinnerDate: {
  9557. type: Object,
  9558. required: true
  9559. },
  9560. showSeconds: {
  9561. type: Boolean,
  9562. default: true
  9563. },
  9564. arrowControl: Boolean,
  9565. amPmMode: {
  9566. type: String,
  9567. default: ""
  9568. },
  9569. disabledHours: {
  9570. type: Function
  9571. },
  9572. disabledMinutes: {
  9573. type: Function
  9574. },
  9575. disabledSeconds: {
  9576. type: Function
  9577. }
  9578. },
  9579. emits: ["change", "select-range", "set-option"],
  9580. setup(props, ctx) {
  9581. const ns = useNamespace("time");
  9582. let isScrolling = false;
  9583. const debouncedResetScroll = debounce$1((type4) => {
  9584. isScrolling = false;
  9585. adjustCurrentSpinner(type4);
  9586. }, 200);
  9587. const currentScrollbar = ref(null);
  9588. const listHoursRef = ref(null);
  9589. const listMinutesRef = ref(null);
  9590. const listSecondsRef = ref(null);
  9591. const listRefsMap = {
  9592. hours: listHoursRef,
  9593. minutes: listMinutesRef,
  9594. seconds: listSecondsRef
  9595. };
  9596. const spinnerItems = computed(() => {
  9597. const arr = ["hours", "minutes", "seconds"];
  9598. return props.showSeconds ? arr : arr.slice(0, 2);
  9599. });
  9600. const hours = computed(() => {
  9601. return props.spinnerDate.hour();
  9602. });
  9603. const minutes = computed(() => {
  9604. return props.spinnerDate.minute();
  9605. });
  9606. const seconds = computed(() => {
  9607. return props.spinnerDate.second();
  9608. });
  9609. const timePartsMap = computed(() => ({
  9610. hours,
  9611. minutes,
  9612. seconds
  9613. }));
  9614. const hoursList = computed(() => {
  9615. return getHoursList(props.role);
  9616. });
  9617. const minutesList = computed(() => {
  9618. return getMinutesList(hours.value, props.role);
  9619. });
  9620. const secondsList = computed(() => {
  9621. return getSecondsList(hours.value, minutes.value, props.role);
  9622. });
  9623. const listMap = computed(() => ({
  9624. hours: hoursList,
  9625. minutes: minutesList,
  9626. seconds: secondsList
  9627. }));
  9628. const arrowHourList = computed(() => {
  9629. const hour = hours.value;
  9630. return [
  9631. hour > 0 ? hour - 1 : void 0,
  9632. hour,
  9633. hour < 23 ? hour + 1 : void 0
  9634. ];
  9635. });
  9636. const arrowMinuteList = computed(() => {
  9637. const minute = minutes.value;
  9638. return [
  9639. minute > 0 ? minute - 1 : void 0,
  9640. minute,
  9641. minute < 59 ? minute + 1 : void 0
  9642. ];
  9643. });
  9644. const arrowSecondList = computed(() => {
  9645. const second = seconds.value;
  9646. return [
  9647. second > 0 ? second - 1 : void 0,
  9648. second,
  9649. second < 59 ? second + 1 : void 0
  9650. ];
  9651. });
  9652. const arrowListMap = computed(() => ({
  9653. hours: arrowHourList,
  9654. minutes: arrowMinuteList,
  9655. seconds: arrowSecondList
  9656. }));
  9657. const getAmPmFlag = (hour) => {
  9658. const shouldShowAmPm = !!props.amPmMode;
  9659. if (!shouldShowAmPm)
  9660. return "";
  9661. const isCapital = props.amPmMode === "A";
  9662. let content2 = hour < 12 ? " am" : " pm";
  9663. if (isCapital)
  9664. content2 = content2.toUpperCase();
  9665. return content2;
  9666. };
  9667. const emitSelectRange = (type4) => {
  9668. if (type4 === "hours") {
  9669. ctx.emit("select-range", 0, 2);
  9670. } else if (type4 === "minutes") {
  9671. ctx.emit("select-range", 3, 5);
  9672. } else if (type4 === "seconds") {
  9673. ctx.emit("select-range", 6, 8);
  9674. }
  9675. currentScrollbar.value = type4;
  9676. };
  9677. const adjustCurrentSpinner = (type4) => {
  9678. adjustSpinner(type4, timePartsMap.value[type4].value);
  9679. };
  9680. const adjustSpinners = () => {
  9681. adjustCurrentSpinner("hours");
  9682. adjustCurrentSpinner("minutes");
  9683. adjustCurrentSpinner("seconds");
  9684. };
  9685. const getScrollbarElement = (el) => el.querySelector(`.${ns.namespace.value}-scrollbar__wrap`);
  9686. const adjustSpinner = (type4, value) => {
  9687. if (props.arrowControl)
  9688. return;
  9689. const el = listRefsMap[type4];
  9690. if (el && el.$el) {
  9691. getScrollbarElement(el.$el).scrollTop = Math.max(0, value * typeItemHeight(type4));
  9692. }
  9693. };
  9694. const typeItemHeight = (type4) => {
  9695. const el = listRefsMap[type4];
  9696. return el.$el.querySelector("li").offsetHeight;
  9697. };
  9698. const onIncreaseClick = () => {
  9699. scrollDown(1);
  9700. };
  9701. const onDecreaseClick = () => {
  9702. scrollDown(-1);
  9703. };
  9704. const scrollDown = (step) => {
  9705. if (!currentScrollbar.value) {
  9706. emitSelectRange("hours");
  9707. }
  9708. const label = currentScrollbar.value;
  9709. let now2 = timePartsMap.value[label].value;
  9710. const total = currentScrollbar.value === "hours" ? 24 : 60;
  9711. now2 = (now2 + step + total) % total;
  9712. modifyDateField(label, now2);
  9713. adjustSpinner(label, now2);
  9714. nextTick(() => emitSelectRange(currentScrollbar.value));
  9715. };
  9716. const modifyDateField = (type4, value) => {
  9717. const list = listMap.value[type4].value;
  9718. const isDisabled = list[value];
  9719. if (isDisabled)
  9720. return;
  9721. switch (type4) {
  9722. case "hours":
  9723. ctx.emit("change", props.spinnerDate.hour(value).minute(minutes.value).second(seconds.value));
  9724. break;
  9725. case "minutes":
  9726. ctx.emit("change", props.spinnerDate.hour(hours.value).minute(value).second(seconds.value));
  9727. break;
  9728. case "seconds":
  9729. ctx.emit("change", props.spinnerDate.hour(hours.value).minute(minutes.value).second(value));
  9730. break;
  9731. }
  9732. };
  9733. const handleClick = (type4, { value, disabled }) => {
  9734. if (!disabled) {
  9735. modifyDateField(type4, value);
  9736. emitSelectRange(type4);
  9737. adjustSpinner(type4, value);
  9738. }
  9739. };
  9740. const handleScroll = (type4) => {
  9741. isScrolling = true;
  9742. debouncedResetScroll(type4);
  9743. const value = Math.min(Math.round((getScrollbarElement(listRefsMap[type4].$el).scrollTop - (scrollBarHeight(type4) * 0.5 - 10) / typeItemHeight(type4) + 3) / typeItemHeight(type4)), type4 === "hours" ? 23 : 59);
  9744. modifyDateField(type4, value);
  9745. };
  9746. const scrollBarHeight = (type4) => {
  9747. return listRefsMap[type4].$el.offsetHeight;
  9748. };
  9749. const bindScrollEvent = () => {
  9750. const bindFunction = (type4) => {
  9751. if (listRefsMap[type4] && listRefsMap[type4].$el) {
  9752. getScrollbarElement(listRefsMap[type4].$el).onscroll = () => {
  9753. handleScroll(type4);
  9754. };
  9755. }
  9756. };
  9757. bindFunction("hours");
  9758. bindFunction("minutes");
  9759. bindFunction("seconds");
  9760. };
  9761. onMounted(() => {
  9762. nextTick(() => {
  9763. !props.arrowControl && bindScrollEvent();
  9764. adjustSpinners();
  9765. if (props.role === "start")
  9766. emitSelectRange("hours");
  9767. });
  9768. });
  9769. const setRef = (scrollbar, type4) => {
  9770. listRefsMap[type4] = scrollbar;
  9771. };
  9772. ctx.emit("set-option", [`${props.role}_scrollDown`, scrollDown]);
  9773. ctx.emit("set-option", [`${props.role}_emitSelectRange`, emitSelectRange]);
  9774. const { getHoursList, getMinutesList, getSecondsList } = getTimeLists(props.disabledHours, props.disabledMinutes, props.disabledSeconds);
  9775. watch(() => props.spinnerDate, () => {
  9776. if (isScrolling)
  9777. return;
  9778. adjustSpinners();
  9779. });
  9780. return {
  9781. ns,
  9782. setRef,
  9783. spinnerItems,
  9784. currentScrollbar,
  9785. hours,
  9786. minutes,
  9787. seconds,
  9788. hoursList,
  9789. minutesList,
  9790. arrowHourList,
  9791. arrowMinuteList,
  9792. arrowSecondList,
  9793. getAmPmFlag,
  9794. emitSelectRange,
  9795. adjustCurrentSpinner,
  9796. typeItemHeight,
  9797. listHoursRef,
  9798. listMinutesRef,
  9799. listSecondsRef,
  9800. onIncreaseClick,
  9801. onDecreaseClick,
  9802. handleClick,
  9803. secondsList,
  9804. timePartsMap,
  9805. arrowListMap,
  9806. listMap
  9807. };
  9808. }
  9809. });
  9810. const _hoisted_1$y = ["onClick"];
  9811. const _hoisted_2$q = ["onMouseenter"];
  9812. function _sfc_render$v(_ctx, _cache, $props, $setup, $data, $options) {
  9813. const _component_el_scrollbar = resolveComponent("el-scrollbar");
  9814. const _component_arrow_up = resolveComponent("arrow-up");
  9815. const _component_el_icon = resolveComponent("el-icon");
  9816. const _component_arrow_down = resolveComponent("arrow-down");
  9817. const _directive_repeat_click = resolveDirective("repeat-click");
  9818. return openBlock(), createElementBlock("div", {
  9819. class: normalizeClass([_ctx.ns.b("spinner"), { "has-seconds": _ctx.showSeconds }])
  9820. }, [
  9821. !_ctx.arrowControl ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(_ctx.spinnerItems, (item) => {
  9822. return openBlock(), createBlock(_component_el_scrollbar, {
  9823. key: item,
  9824. ref_for: true,
  9825. ref: (scollbar) => _ctx.setRef(scollbar, item),
  9826. class: normalizeClass(_ctx.ns.be("spinner", "wrapper")),
  9827. "wrap-style": "max-height: inherit;",
  9828. "view-class": _ctx.ns.be("spinner", "list"),
  9829. noresize: "",
  9830. tag: "ul",
  9831. onMouseenter: ($event) => _ctx.emitSelectRange(item),
  9832. onMousemove: ($event) => _ctx.adjustCurrentSpinner(item)
  9833. }, {
  9834. default: withCtx(() => [
  9835. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.listMap[item].value, (disabled, key) => {
  9836. return openBlock(), createElementBlock("li", {
  9837. key,
  9838. class: normalizeClass([
  9839. _ctx.ns.be("spinner", "item"),
  9840. _ctx.ns.is("active", key === _ctx.timePartsMap[item].value),
  9841. _ctx.ns.is("disabled", disabled)
  9842. ]),
  9843. onClick: ($event) => _ctx.handleClick(item, { value: key, disabled })
  9844. }, [
  9845. item === "hours" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  9846. createTextVNode(toDisplayString(("0" + (_ctx.amPmMode ? key % 12 || 12 : key)).slice(-2)) + toDisplayString(_ctx.getAmPmFlag(key)), 1)
  9847. ], 2112)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  9848. createTextVNode(toDisplayString(("0" + key).slice(-2)), 1)
  9849. ], 2112))
  9850. ], 10, _hoisted_1$y);
  9851. }), 128))
  9852. ]),
  9853. _: 2
  9854. }, 1032, ["class", "view-class", "onMouseenter", "onMousemove"]);
  9855. }), 128)) : createCommentVNode("v-if", true),
  9856. _ctx.arrowControl ? (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(_ctx.spinnerItems, (item) => {
  9857. return openBlock(), createElementBlock("div", {
  9858. key: item,
  9859. class: normalizeClass([_ctx.ns.be("spinner", "wrapper"), _ctx.ns.is("arrow")]),
  9860. onMouseenter: ($event) => _ctx.emitSelectRange(item)
  9861. }, [
  9862. withDirectives((openBlock(), createBlock(_component_el_icon, {
  9863. class: normalizeClass(["arrow-up", _ctx.ns.be("spinner", "arrow")])
  9864. }, {
  9865. default: withCtx(() => [
  9866. createVNode(_component_arrow_up)
  9867. ]),
  9868. _: 1
  9869. }, 8, ["class"])), [
  9870. [_directive_repeat_click, _ctx.onDecreaseClick]
  9871. ]),
  9872. withDirectives((openBlock(), createBlock(_component_el_icon, {
  9873. class: normalizeClass(["arrow-down", _ctx.ns.be("spinner", "arrow")])
  9874. }, {
  9875. default: withCtx(() => [
  9876. createVNode(_component_arrow_down)
  9877. ]),
  9878. _: 1
  9879. }, 8, ["class"])), [
  9880. [_directive_repeat_click, _ctx.onIncreaseClick]
  9881. ]),
  9882. createElementVNode("ul", {
  9883. class: normalizeClass(_ctx.ns.be("spinner", "list"))
  9884. }, [
  9885. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.arrowListMap[item].value, (time, key) => {
  9886. return openBlock(), createElementBlock("li", {
  9887. key,
  9888. class: normalizeClass([
  9889. _ctx.ns.be("spinner", "item"),
  9890. _ctx.ns.is("active", time === _ctx.timePartsMap[item].value),
  9891. _ctx.ns.is("disabled", _ctx.listMap[item].value[time])
  9892. ])
  9893. }, [
  9894. typeof time === "number" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  9895. item === "hours" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  9896. createTextVNode(toDisplayString(("0" + (_ctx.amPmMode ? time % 12 || 12 : time)).slice(-2)) + toDisplayString(_ctx.getAmPmFlag(time)), 1)
  9897. ], 2112)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  9898. createTextVNode(toDisplayString(("0" + time).slice(-2)), 1)
  9899. ], 2112))
  9900. ], 2112)) : createCommentVNode("v-if", true)
  9901. ], 2);
  9902. }), 128))
  9903. ], 2)
  9904. ], 42, _hoisted_2$q);
  9905. }), 128)) : createCommentVNode("v-if", true)
  9906. ], 2);
  9907. }
  9908. var TimeSpinner = /* @__PURE__ */ _export_sfc$1(_sfc_main$R, [["render", _sfc_render$v], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/time-picker/src/time-picker-com/basic-time-spinner.vue"]]);
  9909. const _sfc_main$Q = defineComponent({
  9910. components: {
  9911. TimeSpinner
  9912. },
  9913. props: {
  9914. visible: Boolean,
  9915. actualVisible: {
  9916. type: Boolean,
  9917. default: void 0
  9918. },
  9919. datetimeRole: {
  9920. type: String
  9921. },
  9922. parsedValue: {
  9923. type: [Object, String]
  9924. },
  9925. format: {
  9926. type: String,
  9927. default: ""
  9928. }
  9929. },
  9930. emits: ["pick", "select-range", "set-picker-option"],
  9931. setup(props, ctx) {
  9932. const ns = useNamespace("time");
  9933. const { t, lang } = useLocale();
  9934. const selectionRange = ref([0, 2]);
  9935. const oldValue = useOldValue(props);
  9936. const transitionName = computed(() => {
  9937. return isUndefined(props.actualVisible) ? `${ns.namespace.value}-zoom-in-top` : "";
  9938. });
  9939. const showSeconds = computed(() => {
  9940. return props.format.includes("ss");
  9941. });
  9942. const amPmMode = computed(() => {
  9943. if (props.format.includes("A"))
  9944. return "A";
  9945. if (props.format.includes("a"))
  9946. return "a";
  9947. return "";
  9948. });
  9949. const isValidValue = (_date) => {
  9950. const parsedDate = dayjs(_date).locale(lang.value);
  9951. const result = getRangeAvailableTime(parsedDate);
  9952. return parsedDate.isSame(result);
  9953. };
  9954. const handleCancel = () => {
  9955. ctx.emit("pick", oldValue.value, false);
  9956. };
  9957. const handleConfirm = (visible = false, first = false) => {
  9958. if (first)
  9959. return;
  9960. ctx.emit("pick", props.parsedValue, visible);
  9961. };
  9962. const handleChange2 = (_date) => {
  9963. if (!props.visible) {
  9964. return;
  9965. }
  9966. const result = getRangeAvailableTime(_date).millisecond(0);
  9967. ctx.emit("pick", result, true);
  9968. };
  9969. const setSelectionRange = (start2, end2) => {
  9970. ctx.emit("select-range", start2, end2);
  9971. selectionRange.value = [start2, end2];
  9972. };
  9973. const changeSelectionRange = (step) => {
  9974. const list = [0, 3].concat(showSeconds.value ? [6] : []);
  9975. const mapping = ["hours", "minutes"].concat(showSeconds.value ? ["seconds"] : []);
  9976. const index = list.indexOf(selectionRange.value[0]);
  9977. const next = (index + step + list.length) % list.length;
  9978. timePickerOptions["start_emitSelectRange"](mapping[next]);
  9979. };
  9980. const handleKeydown = (event) => {
  9981. const code = event.code;
  9982. if (code === EVENT_CODE.left || code === EVENT_CODE.right) {
  9983. const step = code === EVENT_CODE.left ? -1 : 1;
  9984. changeSelectionRange(step);
  9985. event.preventDefault();
  9986. return;
  9987. }
  9988. if (code === EVENT_CODE.up || code === EVENT_CODE.down) {
  9989. const step = code === EVENT_CODE.up ? -1 : 1;
  9990. timePickerOptions["start_scrollDown"](step);
  9991. event.preventDefault();
  9992. return;
  9993. }
  9994. };
  9995. const getRangeAvailableTime = (date4) => {
  9996. const availableMap = {
  9997. hour: getAvailableHours,
  9998. minute: getAvailableMinutes,
  9999. second: getAvailableSeconds
  10000. };
  10001. let result = date4;
  10002. ["hour", "minute", "second"].forEach((_2) => {
  10003. if (availableMap[_2]) {
  10004. let availableArr;
  10005. const method4 = availableMap[_2];
  10006. if (_2 === "minute") {
  10007. availableArr = method4(result.hour(), props.datetimeRole);
  10008. } else if (_2 === "second") {
  10009. availableArr = method4(result.hour(), result.minute(), props.datetimeRole);
  10010. } else {
  10011. availableArr = method4(props.datetimeRole);
  10012. }
  10013. if (availableArr && availableArr.length && !availableArr.includes(result[_2]())) {
  10014. result = result[_2](availableArr[0]);
  10015. }
  10016. }
  10017. });
  10018. return result;
  10019. };
  10020. const parseUserInput = (value) => {
  10021. if (!value)
  10022. return null;
  10023. return dayjs(value, props.format).locale(lang.value);
  10024. };
  10025. const formatToString = (value) => {
  10026. if (!value)
  10027. return null;
  10028. return value.format(props.format);
  10029. };
  10030. const getDefaultValue = () => {
  10031. return dayjs(defaultValue).locale(lang.value);
  10032. };
  10033. ctx.emit("set-picker-option", ["isValidValue", isValidValue]);
  10034. ctx.emit("set-picker-option", ["formatToString", formatToString]);
  10035. ctx.emit("set-picker-option", ["parseUserInput", parseUserInput]);
  10036. ctx.emit("set-picker-option", ["handleKeydown", handleKeydown]);
  10037. ctx.emit("set-picker-option", [
  10038. "getRangeAvailableTime",
  10039. getRangeAvailableTime
  10040. ]);
  10041. ctx.emit("set-picker-option", ["getDefaultValue", getDefaultValue]);
  10042. const timePickerOptions = {};
  10043. const onSetOption = (e) => {
  10044. timePickerOptions[e[0]] = e[1];
  10045. };
  10046. const pickerBase = inject("EP_PICKER_BASE");
  10047. const {
  10048. arrowControl,
  10049. disabledHours,
  10050. disabledMinutes,
  10051. disabledSeconds,
  10052. defaultValue
  10053. } = pickerBase.props;
  10054. const { getAvailableHours, getAvailableMinutes, getAvailableSeconds } = getAvailableArrs(disabledHours, disabledMinutes, disabledSeconds);
  10055. return {
  10056. ns,
  10057. transitionName,
  10058. arrowControl,
  10059. onSetOption,
  10060. t,
  10061. handleConfirm,
  10062. handleChange: handleChange2,
  10063. setSelectionRange,
  10064. amPmMode,
  10065. showSeconds,
  10066. handleCancel,
  10067. disabledHours,
  10068. disabledMinutes,
  10069. disabledSeconds
  10070. };
  10071. }
  10072. });
  10073. function _sfc_render$u(_ctx, _cache, $props, $setup, $data, $options) {
  10074. const _component_time_spinner = resolveComponent("time-spinner");
  10075. return openBlock(), createBlock(Transition, { name: _ctx.transitionName }, {
  10076. default: withCtx(() => [
  10077. _ctx.actualVisible || _ctx.visible ? (openBlock(), createElementBlock("div", {
  10078. key: 0,
  10079. class: normalizeClass(_ctx.ns.b("panel"))
  10080. }, [
  10081. createElementVNode("div", {
  10082. class: normalizeClass([_ctx.ns.be("panel", "content"), { "has-seconds": _ctx.showSeconds }])
  10083. }, [
  10084. createVNode(_component_time_spinner, {
  10085. ref: "spinner",
  10086. role: _ctx.datetimeRole || "start",
  10087. "arrow-control": _ctx.arrowControl,
  10088. "show-seconds": _ctx.showSeconds,
  10089. "am-pm-mode": _ctx.amPmMode,
  10090. "spinner-date": _ctx.parsedValue,
  10091. "disabled-hours": _ctx.disabledHours,
  10092. "disabled-minutes": _ctx.disabledMinutes,
  10093. "disabled-seconds": _ctx.disabledSeconds,
  10094. onChange: _ctx.handleChange,
  10095. onSetOption: _ctx.onSetOption,
  10096. onSelectRange: _ctx.setSelectionRange
  10097. }, null, 8, ["role", "arrow-control", "show-seconds", "am-pm-mode", "spinner-date", "disabled-hours", "disabled-minutes", "disabled-seconds", "onChange", "onSetOption", "onSelectRange"])
  10098. ], 2),
  10099. createElementVNode("div", {
  10100. class: normalizeClass(_ctx.ns.be("panel", "footer"))
  10101. }, [
  10102. createElementVNode("button", {
  10103. type: "button",
  10104. class: normalizeClass([_ctx.ns.be("panel", "btn"), "cancel"]),
  10105. onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleCancel && _ctx.handleCancel(...args))
  10106. }, toDisplayString(_ctx.t("el.datepicker.cancel")), 3),
  10107. createElementVNode("button", {
  10108. type: "button",
  10109. class: normalizeClass([_ctx.ns.be("panel", "btn"), "confirm"]),
  10110. onClick: _cache[1] || (_cache[1] = ($event) => _ctx.handleConfirm())
  10111. }, toDisplayString(_ctx.t("el.datepicker.confirm")), 3)
  10112. ], 2)
  10113. ], 2)) : createCommentVNode("v-if", true)
  10114. ]),
  10115. _: 1
  10116. }, 8, ["name"]);
  10117. }
  10118. var TimePickPanel = /* @__PURE__ */ _export_sfc$1(_sfc_main$Q, [["render", _sfc_render$u], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/time-picker/src/time-picker-com/panel-time-pick.vue"]]);
  10119. const makeSelectRange = (start2, end2) => {
  10120. const result = [];
  10121. for (let i = start2; i <= end2; i++) {
  10122. result.push(i);
  10123. }
  10124. return result;
  10125. };
  10126. const _sfc_main$P = defineComponent({
  10127. components: { TimeSpinner },
  10128. props: {
  10129. visible: Boolean,
  10130. actualVisible: Boolean,
  10131. parsedValue: {
  10132. type: [Array]
  10133. },
  10134. format: {
  10135. type: String,
  10136. default: ""
  10137. }
  10138. },
  10139. emits: ["pick", "select-range", "set-picker-option"],
  10140. setup(props, ctx) {
  10141. const { t, lang } = useLocale();
  10142. const nsTime = useNamespace("time");
  10143. const nsPicker = useNamespace("picker");
  10144. const minDate = computed(() => props.parsedValue[0]);
  10145. const maxDate = computed(() => props.parsedValue[1]);
  10146. const oldValue = useOldValue(props);
  10147. const handleCancel = () => {
  10148. ctx.emit("pick", oldValue.value, false);
  10149. };
  10150. const showSeconds = computed(() => {
  10151. return props.format.includes("ss");
  10152. });
  10153. const amPmMode = computed(() => {
  10154. if (props.format.includes("A"))
  10155. return "A";
  10156. if (props.format.includes("a"))
  10157. return "a";
  10158. return "";
  10159. });
  10160. const minSelectableRange = ref([]);
  10161. const maxSelectableRange = ref([]);
  10162. const handleConfirm = (visible = false) => {
  10163. ctx.emit("pick", [minDate.value, maxDate.value], visible);
  10164. };
  10165. const handleMinChange = (date4) => {
  10166. handleChange2(date4.millisecond(0), maxDate.value);
  10167. };
  10168. const handleMaxChange = (date4) => {
  10169. handleChange2(minDate.value, date4.millisecond(0));
  10170. };
  10171. const isValidValue = (_date) => {
  10172. const parsedDate = _date.map((_2) => dayjs(_2).locale(lang.value));
  10173. const result = getRangeAvailableTime(parsedDate);
  10174. return parsedDate[0].isSame(result[0]) && parsedDate[1].isSame(result[1]);
  10175. };
  10176. const handleChange2 = (_minDate, _maxDate) => {
  10177. ctx.emit("pick", [_minDate, _maxDate], true);
  10178. };
  10179. const btnConfirmDisabled = computed(() => {
  10180. return minDate.value > maxDate.value;
  10181. });
  10182. const selectionRange = ref([0, 2]);
  10183. const setMinSelectionRange = (start2, end2) => {
  10184. ctx.emit("select-range", start2, end2, "min");
  10185. selectionRange.value = [start2, end2];
  10186. };
  10187. const offset2 = computed(() => showSeconds.value ? 11 : 8);
  10188. const setMaxSelectionRange = (start2, end2) => {
  10189. ctx.emit("select-range", start2, end2, "max");
  10190. selectionRange.value = [start2 + offset2.value, end2 + offset2.value];
  10191. };
  10192. const changeSelectionRange = (step) => {
  10193. const list = showSeconds.value ? [0, 3, 6, 11, 14, 17] : [0, 3, 8, 11];
  10194. const mapping = ["hours", "minutes"].concat(showSeconds.value ? ["seconds"] : []);
  10195. const index = list.indexOf(selectionRange.value[0]);
  10196. const next = (index + step + list.length) % list.length;
  10197. const half = list.length / 2;
  10198. if (next < half) {
  10199. timePickerOptions["start_emitSelectRange"](mapping[next]);
  10200. } else {
  10201. timePickerOptions["end_emitSelectRange"](mapping[next - half]);
  10202. }
  10203. };
  10204. const handleKeydown = (event) => {
  10205. const code = event.code;
  10206. if (code === EVENT_CODE.left || code === EVENT_CODE.right) {
  10207. const step = code === EVENT_CODE.left ? -1 : 1;
  10208. changeSelectionRange(step);
  10209. event.preventDefault();
  10210. return;
  10211. }
  10212. if (code === EVENT_CODE.up || code === EVENT_CODE.down) {
  10213. const step = code === EVENT_CODE.up ? -1 : 1;
  10214. const role = selectionRange.value[0] < offset2.value ? "start" : "end";
  10215. timePickerOptions[`${role}_scrollDown`](step);
  10216. event.preventDefault();
  10217. return;
  10218. }
  10219. };
  10220. const disabledHours_ = (role, compare) => {
  10221. const defaultDisable = disabledHours ? disabledHours(role) : [];
  10222. const isStart = role === "start";
  10223. const compareDate = compare || (isStart ? maxDate.value : minDate.value);
  10224. const compareHour = compareDate.hour();
  10225. const nextDisable = isStart ? makeSelectRange(compareHour + 1, 23) : makeSelectRange(0, compareHour - 1);
  10226. return union$1(defaultDisable, nextDisable);
  10227. };
  10228. const disabledMinutes_ = (hour, role, compare) => {
  10229. const defaultDisable = disabledMinutes ? disabledMinutes(hour, role) : [];
  10230. const isStart = role === "start";
  10231. const compareDate = compare || (isStart ? maxDate.value : minDate.value);
  10232. const compareHour = compareDate.hour();
  10233. if (hour !== compareHour) {
  10234. return defaultDisable;
  10235. }
  10236. const compareMinute = compareDate.minute();
  10237. const nextDisable = isStart ? makeSelectRange(compareMinute + 1, 59) : makeSelectRange(0, compareMinute - 1);
  10238. return union$1(defaultDisable, nextDisable);
  10239. };
  10240. const disabledSeconds_ = (hour, minute, role, compare) => {
  10241. const defaultDisable = disabledSeconds ? disabledSeconds(hour, minute, role) : [];
  10242. const isStart = role === "start";
  10243. const compareDate = compare || (isStart ? maxDate.value : minDate.value);
  10244. const compareHour = compareDate.hour();
  10245. const compareMinute = compareDate.minute();
  10246. if (hour !== compareHour || minute !== compareMinute) {
  10247. return defaultDisable;
  10248. }
  10249. const compareSecond = compareDate.second();
  10250. const nextDisable = isStart ? makeSelectRange(compareSecond + 1, 59) : makeSelectRange(0, compareSecond - 1);
  10251. return union$1(defaultDisable, nextDisable);
  10252. };
  10253. const getRangeAvailableTime = (dates) => {
  10254. return dates.map((_2, index) => getRangeAvailableTimeEach(dates[0], dates[1], index === 0 ? "start" : "end"));
  10255. };
  10256. const { getAvailableHours, getAvailableMinutes, getAvailableSeconds } = getAvailableArrs(disabledHours_, disabledMinutes_, disabledSeconds_);
  10257. const getRangeAvailableTimeEach = (startDate, endDate, role) => {
  10258. const availableMap = {
  10259. hour: getAvailableHours,
  10260. minute: getAvailableMinutes,
  10261. second: getAvailableSeconds
  10262. };
  10263. const isStart = role === "start";
  10264. let result = isStart ? startDate : endDate;
  10265. const compareDate = isStart ? endDate : startDate;
  10266. ["hour", "minute", "second"].forEach((_2) => {
  10267. if (availableMap[_2]) {
  10268. let availableArr;
  10269. const method4 = availableMap[_2];
  10270. if (_2 === "minute") {
  10271. availableArr = method4(result.hour(), role, compareDate);
  10272. } else if (_2 === "second") {
  10273. availableArr = method4(result.hour(), result.minute(), role, compareDate);
  10274. } else {
  10275. availableArr = method4(role, compareDate);
  10276. }
  10277. if (availableArr && availableArr.length && !availableArr.includes(result[_2]())) {
  10278. const pos = isStart ? 0 : availableArr.length - 1;
  10279. result = result[_2](availableArr[pos]);
  10280. }
  10281. }
  10282. });
  10283. return result;
  10284. };
  10285. const parseUserInput = (value) => {
  10286. if (!value)
  10287. return null;
  10288. if (Array.isArray(value)) {
  10289. return value.map((_2) => dayjs(_2, props.format).locale(lang.value));
  10290. }
  10291. return dayjs(value, props.format).locale(lang.value);
  10292. };
  10293. const formatToString = (value) => {
  10294. if (!value)
  10295. return null;
  10296. if (Array.isArray(value)) {
  10297. return value.map((_2) => _2.format(props.format));
  10298. }
  10299. return value.format(props.format);
  10300. };
  10301. const getDefaultValue = () => {
  10302. if (Array.isArray(defaultValue)) {
  10303. return defaultValue.map((_2) => dayjs(_2).locale(lang.value));
  10304. }
  10305. const defaultDay = dayjs(defaultValue).locale(lang.value);
  10306. return [defaultDay, defaultDay.add(60, "m")];
  10307. };
  10308. ctx.emit("set-picker-option", ["formatToString", formatToString]);
  10309. ctx.emit("set-picker-option", ["parseUserInput", parseUserInput]);
  10310. ctx.emit("set-picker-option", ["isValidValue", isValidValue]);
  10311. ctx.emit("set-picker-option", ["handleKeydown", handleKeydown]);
  10312. ctx.emit("set-picker-option", ["getDefaultValue", getDefaultValue]);
  10313. ctx.emit("set-picker-option", [
  10314. "getRangeAvailableTime",
  10315. getRangeAvailableTime
  10316. ]);
  10317. const timePickerOptions = {};
  10318. const onSetOption = (e) => {
  10319. timePickerOptions[e[0]] = e[1];
  10320. };
  10321. const pickerBase = inject("EP_PICKER_BASE");
  10322. const {
  10323. arrowControl,
  10324. disabledHours,
  10325. disabledMinutes,
  10326. disabledSeconds,
  10327. defaultValue
  10328. } = pickerBase.props;
  10329. return {
  10330. nsTime,
  10331. nsPicker,
  10332. arrowControl,
  10333. onSetOption,
  10334. setMaxSelectionRange,
  10335. setMinSelectionRange,
  10336. btnConfirmDisabled,
  10337. handleCancel,
  10338. handleConfirm,
  10339. t,
  10340. showSeconds,
  10341. minDate,
  10342. maxDate,
  10343. amPmMode,
  10344. handleMinChange,
  10345. handleMaxChange,
  10346. minSelectableRange,
  10347. maxSelectableRange,
  10348. disabledHours_,
  10349. disabledMinutes_,
  10350. disabledSeconds_
  10351. };
  10352. }
  10353. });
  10354. const _hoisted_1$x = ["disabled"];
  10355. function _sfc_render$t(_ctx, _cache, $props, $setup, $data, $options) {
  10356. const _component_time_spinner = resolveComponent("time-spinner");
  10357. return _ctx.actualVisible ? (openBlock(), createElementBlock("div", {
  10358. key: 0,
  10359. class: normalizeClass([_ctx.nsTime.b("range-picker"), _ctx.nsPicker.b("panel")])
  10360. }, [
  10361. createElementVNode("div", {
  10362. class: normalizeClass(_ctx.nsTime.be("range-picker", "content"))
  10363. }, [
  10364. createElementVNode("div", {
  10365. class: normalizeClass(_ctx.nsTime.be("range-picker", "cell"))
  10366. }, [
  10367. createElementVNode("div", {
  10368. class: normalizeClass(_ctx.nsTime.be("range-picker", "header"))
  10369. }, toDisplayString(_ctx.t("el.datepicker.startTime")), 3),
  10370. createElementVNode("div", {
  10371. class: normalizeClass([
  10372. _ctx.nsTime.be("range-picker", "body"),
  10373. _ctx.nsTime.be("panel", "content"),
  10374. _ctx.nsTime.is("arrow", _ctx.arrowControl),
  10375. { "has-seconds": _ctx.showSeconds }
  10376. ])
  10377. }, [
  10378. createVNode(_component_time_spinner, {
  10379. ref: "minSpinner",
  10380. role: "start",
  10381. "show-seconds": _ctx.showSeconds,
  10382. "am-pm-mode": _ctx.amPmMode,
  10383. "arrow-control": _ctx.arrowControl,
  10384. "spinner-date": _ctx.minDate,
  10385. "disabled-hours": _ctx.disabledHours_,
  10386. "disabled-minutes": _ctx.disabledMinutes_,
  10387. "disabled-seconds": _ctx.disabledSeconds_,
  10388. onChange: _ctx.handleMinChange,
  10389. onSetOption: _ctx.onSetOption,
  10390. onSelectRange: _ctx.setMinSelectionRange
  10391. }, null, 8, ["show-seconds", "am-pm-mode", "arrow-control", "spinner-date", "disabled-hours", "disabled-minutes", "disabled-seconds", "onChange", "onSetOption", "onSelectRange"])
  10392. ], 2)
  10393. ], 2),
  10394. createElementVNode("div", {
  10395. class: normalizeClass(_ctx.nsTime.be("range-picker", "cell"))
  10396. }, [
  10397. createElementVNode("div", {
  10398. class: normalizeClass(_ctx.nsTime.be("range-picker", "header"))
  10399. }, toDisplayString(_ctx.t("el.datepicker.endTime")), 3),
  10400. createElementVNode("div", {
  10401. class: normalizeClass([
  10402. _ctx.nsTime.be("range-picker", "body"),
  10403. _ctx.nsTime.be("panel", "content"),
  10404. _ctx.nsTime.is("arrow", _ctx.arrowControl),
  10405. { "has-seconds": _ctx.showSeconds }
  10406. ])
  10407. }, [
  10408. createVNode(_component_time_spinner, {
  10409. ref: "maxSpinner",
  10410. role: "end",
  10411. "show-seconds": _ctx.showSeconds,
  10412. "am-pm-mode": _ctx.amPmMode,
  10413. "arrow-control": _ctx.arrowControl,
  10414. "spinner-date": _ctx.maxDate,
  10415. "disabled-hours": _ctx.disabledHours_,
  10416. "disabled-minutes": _ctx.disabledMinutes_,
  10417. "disabled-seconds": _ctx.disabledSeconds_,
  10418. onChange: _ctx.handleMaxChange,
  10419. onSetOption: _ctx.onSetOption,
  10420. onSelectRange: _ctx.setMaxSelectionRange
  10421. }, null, 8, ["show-seconds", "am-pm-mode", "arrow-control", "spinner-date", "disabled-hours", "disabled-minutes", "disabled-seconds", "onChange", "onSetOption", "onSelectRange"])
  10422. ], 2)
  10423. ], 2)
  10424. ], 2),
  10425. createElementVNode("div", {
  10426. class: normalizeClass(_ctx.nsTime.be("panel", "footer"))
  10427. }, [
  10428. createElementVNode("button", {
  10429. type: "button",
  10430. class: normalizeClass([_ctx.nsTime.be("panel", "btn"), "cancel"]),
  10431. onClick: _cache[0] || (_cache[0] = ($event) => _ctx.handleCancel())
  10432. }, toDisplayString(_ctx.t("el.datepicker.cancel")), 3),
  10433. createElementVNode("button", {
  10434. type: "button",
  10435. class: normalizeClass([_ctx.nsTime.be("panel", "btn"), "confirm"]),
  10436. disabled: _ctx.btnConfirmDisabled,
  10437. onClick: _cache[1] || (_cache[1] = ($event) => _ctx.handleConfirm())
  10438. }, toDisplayString(_ctx.t("el.datepicker.confirm")), 11, _hoisted_1$x)
  10439. ], 2)
  10440. ], 2)) : createCommentVNode("v-if", true);
  10441. }
  10442. var TimeRangePanel = /* @__PURE__ */ _export_sfc$1(_sfc_main$P, [["render", _sfc_render$t], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/time-picker/src/time-picker-com/panel-time-range.vue"]]);
  10443. dayjs.extend(customParseFormat);
  10444. var TimePicker = defineComponent({
  10445. name: "ElTimePicker",
  10446. install: null,
  10447. props: __spreadProps(__spreadValues({}, timePickerDefaultProps), {
  10448. isRange: {
  10449. type: Boolean,
  10450. default: false
  10451. }
  10452. }),
  10453. emits: ["update:modelValue"],
  10454. setup(props, ctx) {
  10455. const commonPicker = ref(null);
  10456. const type4 = props.isRange ? "timerange" : "time";
  10457. const panel = props.isRange ? TimeRangePanel : TimePickPanel;
  10458. const refProps = __spreadProps(__spreadValues({}, props), {
  10459. focus: () => {
  10460. var _a2;
  10461. (_a2 = commonPicker.value) == null ? void 0 : _a2.handleFocus();
  10462. },
  10463. blur: () => {
  10464. var _a2;
  10465. (_a2 = commonPicker.value) == null ? void 0 : _a2.handleBlur();
  10466. }
  10467. });
  10468. provide("ElPopperOptions", props.popperOptions);
  10469. ctx.expose(refProps);
  10470. return () => {
  10471. var _a2;
  10472. const format2 = (_a2 = props.format) != null ? _a2 : DEFAULT_FORMATS_TIME;
  10473. return h$1(CommonPicker, __spreadProps(__spreadValues({}, props), {
  10474. format: format2,
  10475. type: type4,
  10476. ref: commonPicker,
  10477. "onUpdate:modelValue": (value) => ctx.emit("update:modelValue", value)
  10478. }), {
  10479. default: (scopedProps) => h$1(panel, scopedProps)
  10480. });
  10481. };
  10482. }
  10483. });
  10484. const rangeArr = (n) => Array.from(Array.from({ length: n }).keys());
  10485. const extractDateFormat = (format2) => {
  10486. return format2.replace(/\W?m{1,2}|\W?ZZ/g, "").replace(/\W?h{1,2}|\W?s{1,3}|\W?a/gi, "").trim();
  10487. };
  10488. const extractTimeFormat = (format2) => {
  10489. return format2.replace(/\W?D{1,2}|\W?Do|\W?d{1,4}|\W?M{1,4}|\W?Y{2,4}/g, "").trim();
  10490. };
  10491. const _TimePicker = TimePicker;
  10492. _TimePicker.install = (app) => {
  10493. app.component(_TimePicker.name, _TimePicker);
  10494. };
  10495. const ElTimePicker = _TimePicker;
  10496. const useCheckboxProps = {
  10497. modelValue: {
  10498. type: [Boolean, Number, String],
  10499. default: () => void 0
  10500. },
  10501. label: {
  10502. type: [String, Boolean, Number, Object]
  10503. },
  10504. indeterminate: Boolean,
  10505. disabled: Boolean,
  10506. checked: Boolean,
  10507. name: {
  10508. type: String,
  10509. default: void 0
  10510. },
  10511. trueLabel: {
  10512. type: [String, Number],
  10513. default: void 0
  10514. },
  10515. falseLabel: {
  10516. type: [String, Number],
  10517. default: void 0
  10518. },
  10519. tabindex: [String, Number],
  10520. size: String
  10521. };
  10522. const useCheckboxGroup = () => {
  10523. const elForm2 = inject(formContextKey, {});
  10524. const elFormItem2 = inject(formItemContextKey, {});
  10525. const checkboxGroup = inject("CheckboxGroup", {});
  10526. const isGroup = computed(() => checkboxGroup && (checkboxGroup == null ? void 0 : checkboxGroup.name) === "ElCheckboxGroup");
  10527. const elFormItemSize = computed(() => {
  10528. return elFormItem2.size;
  10529. });
  10530. return {
  10531. isGroup,
  10532. checkboxGroup,
  10533. elForm: elForm2,
  10534. elFormItemSize,
  10535. elFormItem: elFormItem2
  10536. };
  10537. };
  10538. const useModel = (props) => {
  10539. const selfModel = ref(false);
  10540. const { emit } = getCurrentInstance();
  10541. const { isGroup, checkboxGroup } = useCheckboxGroup();
  10542. const isLimitExceeded = ref(false);
  10543. const model = computed({
  10544. get() {
  10545. var _a2, _b2;
  10546. return isGroup.value ? (_a2 = checkboxGroup.modelValue) == null ? void 0 : _a2.value : (_b2 = props.modelValue) != null ? _b2 : selfModel.value;
  10547. },
  10548. set(val) {
  10549. var _a2;
  10550. if (isGroup.value && Array.isArray(val)) {
  10551. isLimitExceeded.value = checkboxGroup.max !== void 0 && val.length > checkboxGroup.max.value;
  10552. isLimitExceeded.value === false && ((_a2 = checkboxGroup == null ? void 0 : checkboxGroup.changeEvent) == null ? void 0 : _a2.call(checkboxGroup, val));
  10553. } else {
  10554. emit(UPDATE_MODEL_EVENT, val);
  10555. selfModel.value = val;
  10556. }
  10557. }
  10558. });
  10559. return {
  10560. model,
  10561. isLimitExceeded
  10562. };
  10563. };
  10564. const useCheckboxStatus = (props, { model }) => {
  10565. const { isGroup, checkboxGroup } = useCheckboxGroup();
  10566. const focus = ref(false);
  10567. const size = useSize(checkboxGroup == null ? void 0 : checkboxGroup.checkboxGroupSize, { prop: true });
  10568. const isChecked = computed(() => {
  10569. const value = model.value;
  10570. if (toTypeString(value) === "[object Boolean]") {
  10571. return value;
  10572. } else if (Array.isArray(value)) {
  10573. return value.includes(props.label);
  10574. } else if (value !== null && value !== void 0) {
  10575. return value === props.trueLabel;
  10576. } else {
  10577. return !!value;
  10578. }
  10579. });
  10580. const checkboxSize = useSize(computed(() => {
  10581. var _a2;
  10582. return isGroup.value ? (_a2 = checkboxGroup == null ? void 0 : checkboxGroup.checkboxGroupSize) == null ? void 0 : _a2.value : void 0;
  10583. }));
  10584. return {
  10585. isChecked,
  10586. focus,
  10587. size,
  10588. checkboxSize
  10589. };
  10590. };
  10591. const useDisabled = (props, {
  10592. model,
  10593. isChecked
  10594. }) => {
  10595. const { elForm: elForm2, isGroup, checkboxGroup } = useCheckboxGroup();
  10596. const isLimitDisabled = computed(() => {
  10597. var _a2, _b2;
  10598. const max2 = (_a2 = checkboxGroup.max) == null ? void 0 : _a2.value;
  10599. const min2 = (_b2 = checkboxGroup.min) == null ? void 0 : _b2.value;
  10600. return !!(max2 || min2) && model.value.length >= max2 && !isChecked.value || model.value.length <= min2 && isChecked.value;
  10601. });
  10602. const isDisabled = computed(() => {
  10603. var _a2, _b2;
  10604. const disabled = props.disabled || elForm2.disabled;
  10605. return (_b2 = isGroup.value ? ((_a2 = checkboxGroup.disabled) == null ? void 0 : _a2.value) || disabled || isLimitDisabled.value : props.disabled || elForm2.disabled) != null ? _b2 : false;
  10606. });
  10607. return {
  10608. isDisabled,
  10609. isLimitDisabled
  10610. };
  10611. };
  10612. const setStoreValue = (props, { model }) => {
  10613. function addToStore() {
  10614. if (Array.isArray(model.value) && !model.value.includes(props.label)) {
  10615. model.value.push(props.label);
  10616. } else {
  10617. model.value = props.trueLabel || true;
  10618. }
  10619. }
  10620. props.checked && addToStore();
  10621. };
  10622. const useEvent$1 = (props, { isLimitExceeded }) => {
  10623. const { elFormItem: elFormItem2 } = useCheckboxGroup();
  10624. const { emit } = getCurrentInstance();
  10625. function handleChange2(e) {
  10626. var _a2, _b2;
  10627. if (isLimitExceeded.value)
  10628. return;
  10629. const target = e.target;
  10630. const value = target.checked ? (_a2 = props.trueLabel) != null ? _a2 : true : (_b2 = props.falseLabel) != null ? _b2 : false;
  10631. emit("change", value, e);
  10632. }
  10633. watch(() => props.modelValue, () => {
  10634. var _a2;
  10635. (_a2 = elFormItem2.validate) == null ? void 0 : _a2.call(elFormItem2, "change").catch((err) => debugWarn());
  10636. });
  10637. return {
  10638. handleChange: handleChange2
  10639. };
  10640. };
  10641. const useCheckbox = (props) => {
  10642. const { model, isLimitExceeded } = useModel(props);
  10643. const { focus, size, isChecked, checkboxSize } = useCheckboxStatus(props, {
  10644. model
  10645. });
  10646. const { isDisabled } = useDisabled(props, { model, isChecked });
  10647. const { handleChange: handleChange2 } = useEvent$1(props, { isLimitExceeded });
  10648. setStoreValue(props, { model });
  10649. return {
  10650. isChecked,
  10651. isDisabled,
  10652. checkboxSize,
  10653. model,
  10654. handleChange: handleChange2,
  10655. focus,
  10656. size
  10657. };
  10658. };
  10659. const _sfc_main$O = defineComponent({
  10660. name: "ElCheckbox",
  10661. props: {
  10662. modelValue: {
  10663. type: [Number, String, Boolean],
  10664. default: () => void 0
  10665. },
  10666. label: {
  10667. type: [String, Boolean, Number, Object]
  10668. },
  10669. indeterminate: Boolean,
  10670. disabled: Boolean,
  10671. checked: Boolean,
  10672. name: {
  10673. type: String,
  10674. default: void 0
  10675. },
  10676. trueLabel: {
  10677. type: [String, Number],
  10678. default: void 0
  10679. },
  10680. falseLabel: {
  10681. type: [String, Number],
  10682. default: void 0
  10683. },
  10684. id: {
  10685. type: String,
  10686. default: void 0
  10687. },
  10688. controls: {
  10689. type: String,
  10690. default: void 0
  10691. },
  10692. border: Boolean,
  10693. size: {
  10694. type: String,
  10695. validator: isValidComponentSize
  10696. },
  10697. tabindex: [String, Number]
  10698. },
  10699. emits: [UPDATE_MODEL_EVENT, "change"],
  10700. setup(props) {
  10701. const ns = useNamespace("checkbox");
  10702. return __spreadValues({
  10703. ns
  10704. }, useCheckbox(props));
  10705. }
  10706. });
  10707. const _hoisted_1$w = ["id", "aria-controls"];
  10708. const _hoisted_2$p = ["tabindex", "role", "aria-checked"];
  10709. const _hoisted_3$g = ["aria-hidden", "name", "tabindex", "disabled", "true-value", "false-value"];
  10710. const _hoisted_4$d = ["aria-hidden", "disabled", "value", "name", "tabindex"];
  10711. function _sfc_render$s(_ctx, _cache, $props, $setup, $data, $options) {
  10712. return openBlock(), createElementBlock("label", {
  10713. id: _ctx.id,
  10714. class: normalizeClass([
  10715. _ctx.ns.b(),
  10716. _ctx.ns.m(_ctx.checkboxSize),
  10717. _ctx.ns.is("disabled", _ctx.isDisabled),
  10718. _ctx.ns.is("bordered", _ctx.border),
  10719. _ctx.ns.is("checked", _ctx.isChecked)
  10720. ]),
  10721. "aria-controls": _ctx.indeterminate ? _ctx.controls : null
  10722. }, [
  10723. createElementVNode("span", {
  10724. class: normalizeClass([
  10725. _ctx.ns.e("input"),
  10726. _ctx.ns.is("disabled", _ctx.isDisabled),
  10727. _ctx.ns.is("checked", _ctx.isChecked),
  10728. _ctx.ns.is("indeterminate", _ctx.indeterminate),
  10729. _ctx.ns.is("focus", _ctx.focus)
  10730. ]),
  10731. tabindex: _ctx.indeterminate ? 0 : void 0,
  10732. role: _ctx.indeterminate ? "checkbox" : void 0,
  10733. "aria-checked": _ctx.indeterminate ? "mixed" : false
  10734. }, [
  10735. createElementVNode("span", {
  10736. class: normalizeClass(_ctx.ns.e("inner"))
  10737. }, null, 2),
  10738. _ctx.trueLabel || _ctx.falseLabel ? withDirectives((openBlock(), createElementBlock("input", {
  10739. key: 0,
  10740. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model = $event),
  10741. class: normalizeClass(_ctx.ns.e("original")),
  10742. type: "checkbox",
  10743. "aria-hidden": _ctx.indeterminate ? "true" : "false",
  10744. name: _ctx.name,
  10745. tabindex: _ctx.tabindex,
  10746. disabled: _ctx.isDisabled,
  10747. "true-value": _ctx.trueLabel,
  10748. "false-value": _ctx.falseLabel,
  10749. onChange: _cache[1] || (_cache[1] = (...args) => _ctx.handleChange && _ctx.handleChange(...args)),
  10750. onFocus: _cache[2] || (_cache[2] = ($event) => _ctx.focus = true),
  10751. onBlur: _cache[3] || (_cache[3] = ($event) => _ctx.focus = false)
  10752. }, null, 42, _hoisted_3$g)), [
  10753. [vModelCheckbox, _ctx.model]
  10754. ]) : withDirectives((openBlock(), createElementBlock("input", {
  10755. key: 1,
  10756. "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => _ctx.model = $event),
  10757. class: normalizeClass(_ctx.ns.e("original")),
  10758. type: "checkbox",
  10759. "aria-hidden": _ctx.indeterminate ? "true" : "false",
  10760. disabled: _ctx.isDisabled,
  10761. value: _ctx.label,
  10762. name: _ctx.name,
  10763. tabindex: _ctx.tabindex,
  10764. onChange: _cache[5] || (_cache[5] = (...args) => _ctx.handleChange && _ctx.handleChange(...args)),
  10765. onFocus: _cache[6] || (_cache[6] = ($event) => _ctx.focus = true),
  10766. onBlur: _cache[7] || (_cache[7] = ($event) => _ctx.focus = false)
  10767. }, null, 42, _hoisted_4$d)), [
  10768. [vModelCheckbox, _ctx.model]
  10769. ])
  10770. ], 10, _hoisted_2$p),
  10771. _ctx.$slots.default || _ctx.label ? (openBlock(), createElementBlock("span", {
  10772. key: 0,
  10773. class: normalizeClass(_ctx.ns.e("label"))
  10774. }, [
  10775. renderSlot(_ctx.$slots, "default"),
  10776. !_ctx.$slots.default ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  10777. createTextVNode(toDisplayString(_ctx.label), 1)
  10778. ], 2112)) : createCommentVNode("v-if", true)
  10779. ], 2)) : createCommentVNode("v-if", true)
  10780. ], 10, _hoisted_1$w);
  10781. }
  10782. var Checkbox = /* @__PURE__ */ _export_sfc$1(_sfc_main$O, [["render", _sfc_render$s], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/checkbox/src/checkbox.vue"]]);
  10783. const _sfc_main$N = defineComponent({
  10784. name: "ElCheckboxButton",
  10785. props: useCheckboxProps,
  10786. emits: [UPDATE_MODEL_EVENT, "change"],
  10787. setup(props) {
  10788. const { focus, isChecked, isDisabled, size, model, handleChange: handleChange2 } = useCheckbox(props);
  10789. const { checkboxGroup } = useCheckboxGroup();
  10790. const ns = useNamespace("checkbox");
  10791. const activeStyle = computed(() => {
  10792. var _a2, _b2, _c, _d;
  10793. const fillValue = (_b2 = (_a2 = checkboxGroup == null ? void 0 : checkboxGroup.fill) == null ? void 0 : _a2.value) != null ? _b2 : "";
  10794. return {
  10795. backgroundColor: fillValue,
  10796. borderColor: fillValue,
  10797. color: (_d = (_c = checkboxGroup == null ? void 0 : checkboxGroup.textColor) == null ? void 0 : _c.value) != null ? _d : "",
  10798. boxShadow: fillValue ? `-1px 0 0 0 ${fillValue}` : null
  10799. };
  10800. });
  10801. return {
  10802. focus,
  10803. isChecked,
  10804. isDisabled,
  10805. model,
  10806. handleChange: handleChange2,
  10807. activeStyle,
  10808. size,
  10809. ns
  10810. };
  10811. }
  10812. });
  10813. const _hoisted_1$v = ["aria-checked", "aria-disabled"];
  10814. const _hoisted_2$o = ["name", "tabindex", "disabled", "true-value", "false-value"];
  10815. const _hoisted_3$f = ["name", "tabindex", "disabled", "value"];
  10816. function _sfc_render$r(_ctx, _cache, $props, $setup, $data, $options) {
  10817. return openBlock(), createElementBlock("label", {
  10818. class: normalizeClass([
  10819. _ctx.ns.b("button"),
  10820. _ctx.ns.bm("button", _ctx.size),
  10821. _ctx.ns.is("disabled", _ctx.isDisabled),
  10822. _ctx.ns.is("checked", _ctx.isChecked),
  10823. _ctx.ns.is("focus", _ctx.focus)
  10824. ]),
  10825. role: "checkbox",
  10826. "aria-checked": _ctx.isChecked,
  10827. "aria-disabled": _ctx.isDisabled
  10828. }, [
  10829. _ctx.trueLabel || _ctx.falseLabel ? withDirectives((openBlock(), createElementBlock("input", {
  10830. key: 0,
  10831. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model = $event),
  10832. class: normalizeClass(_ctx.ns.be("button", "original")),
  10833. type: "checkbox",
  10834. name: _ctx.name,
  10835. tabindex: _ctx.tabindex,
  10836. disabled: _ctx.isDisabled,
  10837. "true-value": _ctx.trueLabel,
  10838. "false-value": _ctx.falseLabel,
  10839. onChange: _cache[1] || (_cache[1] = (...args) => _ctx.handleChange && _ctx.handleChange(...args)),
  10840. onFocus: _cache[2] || (_cache[2] = ($event) => _ctx.focus = true),
  10841. onBlur: _cache[3] || (_cache[3] = ($event) => _ctx.focus = false)
  10842. }, null, 42, _hoisted_2$o)), [
  10843. [vModelCheckbox, _ctx.model]
  10844. ]) : withDirectives((openBlock(), createElementBlock("input", {
  10845. key: 1,
  10846. "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => _ctx.model = $event),
  10847. class: normalizeClass(_ctx.ns.be("button", "original")),
  10848. type: "checkbox",
  10849. name: _ctx.name,
  10850. tabindex: _ctx.tabindex,
  10851. disabled: _ctx.isDisabled,
  10852. value: _ctx.label,
  10853. onChange: _cache[5] || (_cache[5] = (...args) => _ctx.handleChange && _ctx.handleChange(...args)),
  10854. onFocus: _cache[6] || (_cache[6] = ($event) => _ctx.focus = true),
  10855. onBlur: _cache[7] || (_cache[7] = ($event) => _ctx.focus = false)
  10856. }, null, 42, _hoisted_3$f)), [
  10857. [vModelCheckbox, _ctx.model]
  10858. ]),
  10859. _ctx.$slots.default || _ctx.label ? (openBlock(), createElementBlock("span", {
  10860. key: 2,
  10861. class: normalizeClass(_ctx.ns.be("button", "inner")),
  10862. style: normalizeStyle(_ctx.isChecked ? _ctx.activeStyle : null)
  10863. }, [
  10864. renderSlot(_ctx.$slots, "default", {}, () => [
  10865. createTextVNode(toDisplayString(_ctx.label), 1)
  10866. ])
  10867. ], 6)) : createCommentVNode("v-if", true)
  10868. ], 10, _hoisted_1$v);
  10869. }
  10870. var CheckboxButton = /* @__PURE__ */ _export_sfc$1(_sfc_main$N, [["render", _sfc_render$r], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/checkbox/src/checkbox-button.vue"]]);
  10871. const _sfc_main$M = defineComponent({
  10872. name: "ElCheckboxGroup",
  10873. props: {
  10874. modelValue: {
  10875. type: Array,
  10876. default: () => []
  10877. },
  10878. disabled: Boolean,
  10879. min: {
  10880. type: Number,
  10881. default: void 0
  10882. },
  10883. max: {
  10884. type: Number,
  10885. default: void 0
  10886. },
  10887. size: {
  10888. type: String,
  10889. validator: isValidComponentSize
  10890. },
  10891. fill: {
  10892. type: String,
  10893. default: void 0
  10894. },
  10895. textColor: {
  10896. type: String,
  10897. default: void 0
  10898. },
  10899. tag: {
  10900. type: String,
  10901. default: "div"
  10902. }
  10903. },
  10904. emits: [UPDATE_MODEL_EVENT, "change"],
  10905. setup(props, { emit, slots }) {
  10906. const { elFormItem: elFormItem2 } = useCheckboxGroup();
  10907. const checkboxGroupSize = useSize();
  10908. const ns = useNamespace("checkbox");
  10909. const changeEvent = (value) => {
  10910. emit(UPDATE_MODEL_EVENT, value);
  10911. nextTick(() => {
  10912. emit("change", value);
  10913. });
  10914. };
  10915. const modelValue = computed({
  10916. get() {
  10917. return props.modelValue;
  10918. },
  10919. set(val) {
  10920. changeEvent(val);
  10921. }
  10922. });
  10923. provide("CheckboxGroup", __spreadProps(__spreadValues({
  10924. name: "ElCheckboxGroup",
  10925. modelValue
  10926. }, toRefs(props)), {
  10927. checkboxGroupSize,
  10928. changeEvent
  10929. }));
  10930. watch(() => props.modelValue, () => {
  10931. var _a2;
  10932. (_a2 = elFormItem2.validate) == null ? void 0 : _a2.call(elFormItem2, "change").catch((err) => debugWarn());
  10933. });
  10934. return () => {
  10935. return h$1(props.tag, {
  10936. class: ns.b("group"),
  10937. role: "group",
  10938. "aria-label": "checkbox-group"
  10939. }, [renderSlot(slots, "default")]);
  10940. };
  10941. }
  10942. });
  10943. var CheckboxGroup = /* @__PURE__ */ _export_sfc$1(_sfc_main$M, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/checkbox/src/checkbox-group.vue"]]);
  10944. const ElCheckbox = withInstall(Checkbox, {
  10945. CheckboxButton,
  10946. CheckboxGroup
  10947. });
  10948. withNoopInstall(CheckboxButton);
  10949. const ElCheckboxGroup$1 = withNoopInstall(CheckboxGroup);
  10950. const radioPropsBase = buildProps({
  10951. size: useSizeProp,
  10952. disabled: Boolean,
  10953. label: {
  10954. type: [String, Number, Boolean],
  10955. default: ""
  10956. }
  10957. });
  10958. const radioProps = buildProps(__spreadProps(__spreadValues({}, radioPropsBase), {
  10959. modelValue: {
  10960. type: [String, Number, Boolean],
  10961. default: ""
  10962. },
  10963. name: {
  10964. type: String,
  10965. default: ""
  10966. },
  10967. border: Boolean
  10968. }));
  10969. const radioEmits = {
  10970. [UPDATE_MODEL_EVENT]: (val) => isString(val) || isNumber(val) || isBoolean(val),
  10971. change: (val) => isString(val) || isNumber(val) || isBoolean(val)
  10972. };
  10973. const useRadio = (props, emit) => {
  10974. const radioRef = ref();
  10975. const radioGroup = inject(radioGroupKey, void 0);
  10976. const isGroup = computed(() => !!radioGroup);
  10977. const modelValue = computed({
  10978. get() {
  10979. return isGroup.value ? radioGroup.modelValue : props.modelValue;
  10980. },
  10981. set(val) {
  10982. if (isGroup.value) {
  10983. radioGroup.changeEvent(val);
  10984. } else {
  10985. emit(UPDATE_MODEL_EVENT, val);
  10986. }
  10987. radioRef.value.checked = props.modelValue === props.label;
  10988. }
  10989. });
  10990. const size = useSize(computed(() => radioGroup == null ? void 0 : radioGroup.size));
  10991. const disabled = useDisabled$1(computed(() => radioGroup == null ? void 0 : radioGroup.disabled));
  10992. const focus = ref(false);
  10993. const tabIndex = computed(() => {
  10994. return disabled.value || isGroup.value && modelValue.value !== props.label ? -1 : 0;
  10995. });
  10996. return {
  10997. radioRef,
  10998. isGroup,
  10999. radioGroup,
  11000. focus,
  11001. size,
  11002. disabled,
  11003. tabIndex,
  11004. modelValue
  11005. };
  11006. };
  11007. const _sfc_main$L = defineComponent({
  11008. name: "ElRadio",
  11009. props: radioProps,
  11010. emits: radioEmits,
  11011. setup(props, { emit }) {
  11012. const ns = useNamespace("radio");
  11013. const { radioRef, isGroup, focus, size, disabled, tabIndex, modelValue } = useRadio(props, emit);
  11014. function handleChange2() {
  11015. nextTick(() => emit("change", modelValue.value));
  11016. }
  11017. return {
  11018. ns,
  11019. focus,
  11020. isGroup,
  11021. modelValue,
  11022. tabIndex,
  11023. size,
  11024. disabled,
  11025. radioRef,
  11026. handleChange: handleChange2
  11027. };
  11028. }
  11029. });
  11030. const _hoisted_1$u = ["aria-checked", "aria-disabled", "tabindex"];
  11031. const _hoisted_2$n = ["value", "name", "disabled"];
  11032. function _sfc_render$q(_ctx, _cache, $props, $setup, $data, $options) {
  11033. return openBlock(), createElementBlock("label", {
  11034. class: normalizeClass([
  11035. _ctx.ns.b(),
  11036. _ctx.ns.is("disabled", _ctx.disabled),
  11037. _ctx.ns.is("focus", _ctx.focus),
  11038. _ctx.ns.is("bordered", _ctx.border),
  11039. _ctx.ns.is("checked", _ctx.modelValue === _ctx.label),
  11040. _ctx.ns.m(_ctx.size)
  11041. ]),
  11042. role: "radio",
  11043. "aria-checked": _ctx.modelValue === _ctx.label,
  11044. "aria-disabled": _ctx.disabled,
  11045. tabindex: _ctx.tabIndex,
  11046. onKeydown: _cache[5] || (_cache[5] = withKeys(withModifiers(($event) => _ctx.modelValue = _ctx.disabled ? _ctx.modelValue : _ctx.label, ["stop", "prevent"]), ["space"]))
  11047. }, [
  11048. createElementVNode("span", {
  11049. class: normalizeClass([
  11050. _ctx.ns.e("input"),
  11051. _ctx.ns.is("disabled", _ctx.disabled),
  11052. _ctx.ns.is("checked", _ctx.modelValue === _ctx.label)
  11053. ])
  11054. }, [
  11055. createElementVNode("span", {
  11056. class: normalizeClass(_ctx.ns.e("inner"))
  11057. }, null, 2),
  11058. withDirectives(createElementVNode("input", {
  11059. ref: "radioRef",
  11060. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.modelValue = $event),
  11061. class: normalizeClass(_ctx.ns.e("original")),
  11062. value: _ctx.label,
  11063. type: "radio",
  11064. "aria-hidden": "true",
  11065. name: _ctx.name,
  11066. disabled: _ctx.disabled,
  11067. tabindex: "-1",
  11068. onFocus: _cache[1] || (_cache[1] = ($event) => _ctx.focus = true),
  11069. onBlur: _cache[2] || (_cache[2] = ($event) => _ctx.focus = false),
  11070. onChange: _cache[3] || (_cache[3] = (...args) => _ctx.handleChange && _ctx.handleChange(...args))
  11071. }, null, 42, _hoisted_2$n), [
  11072. [vModelRadio, _ctx.modelValue]
  11073. ])
  11074. ], 2),
  11075. createElementVNode("span", {
  11076. class: normalizeClass(_ctx.ns.e("label")),
  11077. onKeydown: _cache[4] || (_cache[4] = withModifiers(() => {
  11078. }, ["stop"]))
  11079. }, [
  11080. renderSlot(_ctx.$slots, "default", {}, () => [
  11081. createTextVNode(toDisplayString(_ctx.label), 1)
  11082. ])
  11083. ], 34)
  11084. ], 42, _hoisted_1$u);
  11085. }
  11086. var Radio = /* @__PURE__ */ _export_sfc$1(_sfc_main$L, [["render", _sfc_render$q], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/radio/src/radio.vue"]]);
  11087. const radioButtonProps = buildProps(__spreadProps(__spreadValues({}, radioPropsBase), {
  11088. name: {
  11089. type: String,
  11090. default: ""
  11091. }
  11092. }));
  11093. const _sfc_main$K = defineComponent({
  11094. name: "ElRadioButton",
  11095. props: radioButtonProps,
  11096. setup(props, { emit }) {
  11097. const ns = useNamespace("radio");
  11098. const {
  11099. radioRef,
  11100. isGroup,
  11101. focus,
  11102. size,
  11103. disabled,
  11104. tabIndex,
  11105. modelValue,
  11106. radioGroup
  11107. } = useRadio(props, emit);
  11108. const activeStyle = computed(() => {
  11109. return {
  11110. backgroundColor: (radioGroup == null ? void 0 : radioGroup.fill) || "",
  11111. borderColor: (radioGroup == null ? void 0 : radioGroup.fill) || "",
  11112. boxShadow: (radioGroup == null ? void 0 : radioGroup.fill) ? `-1px 0 0 0 ${radioGroup.fill}` : "",
  11113. color: (radioGroup == null ? void 0 : radioGroup.textColor) || ""
  11114. };
  11115. });
  11116. return {
  11117. ns,
  11118. isGroup,
  11119. size,
  11120. disabled,
  11121. tabIndex,
  11122. modelValue,
  11123. focus,
  11124. activeStyle,
  11125. radioRef
  11126. };
  11127. }
  11128. });
  11129. const _hoisted_1$t = ["aria-checked", "aria-disabled", "tabindex"];
  11130. const _hoisted_2$m = ["value", "name", "disabled"];
  11131. function _sfc_render$p(_ctx, _cache, $props, $setup, $data, $options) {
  11132. return openBlock(), createElementBlock("label", {
  11133. class: normalizeClass([
  11134. _ctx.ns.b("button"),
  11135. _ctx.ns.is("active", _ctx.modelValue === _ctx.label),
  11136. _ctx.ns.is("disabled", _ctx.disabled),
  11137. _ctx.ns.is("focus", _ctx.focus),
  11138. _ctx.ns.bm("button", _ctx.size)
  11139. ]),
  11140. role: "radio",
  11141. "aria-checked": _ctx.modelValue === _ctx.label,
  11142. "aria-disabled": _ctx.disabled,
  11143. tabindex: _ctx.tabIndex,
  11144. onKeydown: _cache[4] || (_cache[4] = withKeys(withModifiers(($event) => _ctx.modelValue = _ctx.disabled ? _ctx.modelValue : _ctx.label, ["stop", "prevent"]), ["space"]))
  11145. }, [
  11146. withDirectives(createElementVNode("input", {
  11147. ref: "radioRef",
  11148. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.modelValue = $event),
  11149. class: normalizeClass(_ctx.ns.be("button", "original-radio")),
  11150. value: _ctx.label,
  11151. type: "radio",
  11152. name: _ctx.name,
  11153. disabled: _ctx.disabled,
  11154. tabindex: "-1",
  11155. onFocus: _cache[1] || (_cache[1] = ($event) => _ctx.focus = true),
  11156. onBlur: _cache[2] || (_cache[2] = ($event) => _ctx.focus = false)
  11157. }, null, 42, _hoisted_2$m), [
  11158. [vModelRadio, _ctx.modelValue]
  11159. ]),
  11160. createElementVNode("span", {
  11161. class: normalizeClass(_ctx.ns.be("button", "inner")),
  11162. style: normalizeStyle(_ctx.modelValue === _ctx.label ? _ctx.activeStyle : {}),
  11163. onKeydown: _cache[3] || (_cache[3] = withModifiers(() => {
  11164. }, ["stop"]))
  11165. }, [
  11166. renderSlot(_ctx.$slots, "default", {}, () => [
  11167. createTextVNode(toDisplayString(_ctx.label), 1)
  11168. ])
  11169. ], 38)
  11170. ], 42, _hoisted_1$t);
  11171. }
  11172. var RadioButton = /* @__PURE__ */ _export_sfc$1(_sfc_main$K, [["render", _sfc_render$p], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/radio/src/radio-button.vue"]]);
  11173. const radioGroupProps = buildProps({
  11174. size: useSizeProp,
  11175. disabled: Boolean,
  11176. modelValue: {
  11177. type: [String, Number, Boolean],
  11178. default: ""
  11179. },
  11180. fill: {
  11181. type: String,
  11182. default: ""
  11183. },
  11184. textColor: {
  11185. type: String,
  11186. default: ""
  11187. }
  11188. });
  11189. const radioGroupEmits = radioEmits;
  11190. const _sfc_main$J = defineComponent({
  11191. name: "ElRadioGroup",
  11192. props: radioGroupProps,
  11193. emits: radioGroupEmits,
  11194. setup(props, ctx) {
  11195. const ns = useNamespace("radio");
  11196. const radioGroupRef = ref();
  11197. const { formItem } = useFormItem();
  11198. const changeEvent = (value) => {
  11199. ctx.emit(UPDATE_MODEL_EVENT, value);
  11200. nextTick(() => ctx.emit("change", value));
  11201. };
  11202. const handleKeydown = (e) => {
  11203. if (!radioGroupRef.value)
  11204. return;
  11205. const target = e.target;
  11206. const className = target.nodeName === "INPUT" ? "[type=radio]" : "[role=radio]";
  11207. const radios = radioGroupRef.value.querySelectorAll(className);
  11208. const length = radios.length;
  11209. const index = Array.from(radios).indexOf(target);
  11210. const roleRadios = radioGroupRef.value.querySelectorAll("[role=radio]");
  11211. let nextIndex = null;
  11212. switch (e.code) {
  11213. case EVENT_CODE.left:
  11214. case EVENT_CODE.up:
  11215. e.stopPropagation();
  11216. e.preventDefault();
  11217. nextIndex = index === 0 ? length - 1 : index - 1;
  11218. break;
  11219. case EVENT_CODE.right:
  11220. case EVENT_CODE.down:
  11221. e.stopPropagation();
  11222. e.preventDefault();
  11223. nextIndex = index === length - 1 ? 0 : index + 1;
  11224. break;
  11225. }
  11226. if (nextIndex === null)
  11227. return;
  11228. roleRadios[nextIndex].click();
  11229. roleRadios[nextIndex].focus();
  11230. };
  11231. onMounted(() => {
  11232. const radios = radioGroupRef.value.querySelectorAll("[type=radio]");
  11233. const firstLabel = radios[0];
  11234. if (!Array.from(radios).some((radio) => radio.checked) && firstLabel) {
  11235. firstLabel.tabIndex = 0;
  11236. }
  11237. });
  11238. provide(radioGroupKey, reactive(__spreadProps(__spreadValues({}, toRefs(props)), {
  11239. changeEvent
  11240. })));
  11241. watch(() => props.modelValue, () => formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn()));
  11242. return {
  11243. ns,
  11244. radioGroupRef,
  11245. handleKeydown
  11246. };
  11247. }
  11248. });
  11249. function _sfc_render$o(_ctx, _cache, $props, $setup, $data, $options) {
  11250. return openBlock(), createElementBlock("div", {
  11251. ref: "radioGroupRef",
  11252. class: normalizeClass(_ctx.ns.b("group")),
  11253. role: "radiogroup",
  11254. onKeydown: _cache[0] || (_cache[0] = (...args) => _ctx.handleKeydown && _ctx.handleKeydown(...args))
  11255. }, [
  11256. renderSlot(_ctx.$slots, "default")
  11257. ], 34);
  11258. }
  11259. var RadioGroup = /* @__PURE__ */ _export_sfc$1(_sfc_main$J, [["render", _sfc_render$o], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/radio/src/radio-group.vue"]]);
  11260. const ElRadio = withInstall(Radio, {
  11261. RadioButton,
  11262. RadioGroup
  11263. });
  11264. const ElRadioGroup = withNoopInstall(RadioGroup);
  11265. const ElRadioButton = withNoopInstall(RadioButton);
  11266. var NodeContent = defineComponent({
  11267. name: "NodeContent",
  11268. setup() {
  11269. const ns = useNamespace("cascader-node");
  11270. return {
  11271. ns
  11272. };
  11273. },
  11274. render() {
  11275. const { ns } = this;
  11276. const { node, panel } = this.$parent;
  11277. const { data: data2, label } = node;
  11278. const { renderLabelFn } = panel;
  11279. return h$1("span", { class: ns.e("label") }, renderLabelFn ? renderLabelFn({ node, data: data2 }) : label);
  11280. }
  11281. });
  11282. const CASCADER_PANEL_INJECTION_KEY = Symbol();
  11283. const _sfc_main$I = defineComponent({
  11284. name: "ElCascaderNode",
  11285. components: {
  11286. ElCheckbox,
  11287. ElRadio,
  11288. NodeContent,
  11289. ElIcon,
  11290. Check: check,
  11291. Loading: loading,
  11292. ArrowRight: arrowRight
  11293. },
  11294. props: {
  11295. node: {
  11296. type: Object,
  11297. required: true
  11298. },
  11299. menuId: String
  11300. },
  11301. emits: ["expand"],
  11302. setup(props, { emit }) {
  11303. const panel = inject(CASCADER_PANEL_INJECTION_KEY);
  11304. const ns = useNamespace("cascader-node");
  11305. const isHoverMenu = computed(() => panel.isHoverMenu);
  11306. const multiple = computed(() => panel.config.multiple);
  11307. const checkStrictly = computed(() => panel.config.checkStrictly);
  11308. const checkedNodeId = computed(() => {
  11309. var _a2;
  11310. return (_a2 = panel.checkedNodes[0]) == null ? void 0 : _a2.uid;
  11311. });
  11312. const isDisabled = computed(() => props.node.isDisabled);
  11313. const isLeaf2 = computed(() => props.node.isLeaf);
  11314. const expandable = computed(() => checkStrictly.value && !isLeaf2.value || !isDisabled.value);
  11315. const inExpandingPath = computed(() => isInPath(panel.expandingNode));
  11316. const inCheckedPath = computed(() => checkStrictly.value && panel.checkedNodes.some(isInPath));
  11317. const isInPath = (node) => {
  11318. var _a2;
  11319. const { level, uid: uid2 } = props.node;
  11320. return ((_a2 = node == null ? void 0 : node.pathNodes[level - 1]) == null ? void 0 : _a2.uid) === uid2;
  11321. };
  11322. const doExpand = () => {
  11323. if (inExpandingPath.value)
  11324. return;
  11325. panel.expandNode(props.node);
  11326. };
  11327. const doCheck = (checked) => {
  11328. const { node } = props;
  11329. if (checked === node.checked)
  11330. return;
  11331. panel.handleCheckChange(node, checked);
  11332. };
  11333. const doLoad = () => {
  11334. panel.lazyLoad(props.node, () => {
  11335. if (!isLeaf2.value)
  11336. doExpand();
  11337. });
  11338. };
  11339. const handleHoverExpand = (e) => {
  11340. if (!isHoverMenu.value)
  11341. return;
  11342. handleExpand();
  11343. !isLeaf2.value && emit("expand", e);
  11344. };
  11345. const handleExpand = () => {
  11346. const { node } = props;
  11347. if (!expandable.value || node.loading)
  11348. return;
  11349. node.loaded ? doExpand() : doLoad();
  11350. };
  11351. const handleClick = () => {
  11352. if (isHoverMenu.value && !isLeaf2.value)
  11353. return;
  11354. if (isLeaf2.value && !isDisabled.value && !checkStrictly.value && !multiple.value) {
  11355. handleCheck(true);
  11356. } else {
  11357. handleExpand();
  11358. }
  11359. };
  11360. const handleSelectCheck = (checked) => {
  11361. if (checkStrictly.value) {
  11362. doCheck(checked);
  11363. if (props.node.loaded) {
  11364. doExpand();
  11365. }
  11366. } else {
  11367. handleCheck(checked);
  11368. }
  11369. };
  11370. const handleCheck = (checked) => {
  11371. if (!props.node.loaded) {
  11372. doLoad();
  11373. } else {
  11374. doCheck(checked);
  11375. !checkStrictly.value && doExpand();
  11376. }
  11377. };
  11378. return {
  11379. panel,
  11380. isHoverMenu,
  11381. multiple,
  11382. checkStrictly,
  11383. checkedNodeId,
  11384. isDisabled,
  11385. isLeaf: isLeaf2,
  11386. expandable,
  11387. inExpandingPath,
  11388. inCheckedPath,
  11389. ns,
  11390. handleHoverExpand,
  11391. handleExpand,
  11392. handleClick,
  11393. handleCheck,
  11394. handleSelectCheck
  11395. };
  11396. }
  11397. });
  11398. const _hoisted_1$s = ["id", "aria-haspopup", "aria-owns", "aria-expanded", "tabindex"];
  11399. const _hoisted_2$l = /* @__PURE__ */ createElementVNode("span", null, null, -1);
  11400. function _sfc_render$n(_ctx, _cache, $props, $setup, $data, $options) {
  11401. const _component_el_checkbox = resolveComponent("el-checkbox");
  11402. const _component_el_radio = resolveComponent("el-radio");
  11403. const _component_check = resolveComponent("check");
  11404. const _component_el_icon = resolveComponent("el-icon");
  11405. const _component_node_content = resolveComponent("node-content");
  11406. const _component_loading = resolveComponent("loading");
  11407. const _component_arrow_right = resolveComponent("arrow-right");
  11408. return openBlock(), createElementBlock("li", {
  11409. id: `${_ctx.menuId}-${_ctx.node.uid}`,
  11410. role: "menuitem",
  11411. "aria-haspopup": !_ctx.isLeaf,
  11412. "aria-owns": _ctx.isLeaf ? null : _ctx.menuId,
  11413. "aria-expanded": _ctx.inExpandingPath,
  11414. tabindex: _ctx.expandable ? -1 : void 0,
  11415. class: normalizeClass([
  11416. _ctx.ns.b(),
  11417. _ctx.ns.is("selectable", _ctx.checkStrictly),
  11418. _ctx.ns.is("active", _ctx.node.checked),
  11419. _ctx.ns.is("disabled", !_ctx.expandable),
  11420. _ctx.inExpandingPath && "in-active-path",
  11421. _ctx.inCheckedPath && "in-checked-path"
  11422. ]),
  11423. onMouseenter: _cache[2] || (_cache[2] = (...args) => _ctx.handleHoverExpand && _ctx.handleHoverExpand(...args)),
  11424. onFocus: _cache[3] || (_cache[3] = (...args) => _ctx.handleHoverExpand && _ctx.handleHoverExpand(...args)),
  11425. onClick: _cache[4] || (_cache[4] = (...args) => _ctx.handleClick && _ctx.handleClick(...args))
  11426. }, [
  11427. createCommentVNode(" prefix "),
  11428. _ctx.multiple ? (openBlock(), createBlock(_component_el_checkbox, {
  11429. key: 0,
  11430. "model-value": _ctx.node.checked,
  11431. indeterminate: _ctx.node.indeterminate,
  11432. disabled: _ctx.isDisabled,
  11433. onClick: _cache[0] || (_cache[0] = withModifiers(() => {
  11434. }, ["stop"])),
  11435. "onUpdate:modelValue": _ctx.handleSelectCheck
  11436. }, null, 8, ["model-value", "indeterminate", "disabled", "onUpdate:modelValue"])) : _ctx.checkStrictly ? (openBlock(), createBlock(_component_el_radio, {
  11437. key: 1,
  11438. "model-value": _ctx.checkedNodeId,
  11439. label: _ctx.node.uid,
  11440. disabled: _ctx.isDisabled,
  11441. "onUpdate:modelValue": _ctx.handleSelectCheck,
  11442. onClick: _cache[1] || (_cache[1] = withModifiers(() => {
  11443. }, ["stop"]))
  11444. }, {
  11445. default: withCtx(() => [
  11446. createCommentVNode("\n Add an empty element to avoid render label,\n do not use empty fragment here for https://github.com/vuejs/vue-next/pull/2485\n "),
  11447. _hoisted_2$l
  11448. ]),
  11449. _: 1
  11450. }, 8, ["model-value", "label", "disabled", "onUpdate:modelValue"])) : _ctx.isLeaf && _ctx.node.checked ? (openBlock(), createBlock(_component_el_icon, {
  11451. key: 2,
  11452. class: normalizeClass(_ctx.ns.e("prefix"))
  11453. }, {
  11454. default: withCtx(() => [
  11455. createVNode(_component_check)
  11456. ]),
  11457. _: 1
  11458. }, 8, ["class"])) : createCommentVNode("v-if", true),
  11459. createCommentVNode(" content "),
  11460. createVNode(_component_node_content),
  11461. createCommentVNode(" postfix "),
  11462. !_ctx.isLeaf ? (openBlock(), createElementBlock(Fragment, { key: 3 }, [
  11463. _ctx.node.loading ? (openBlock(), createBlock(_component_el_icon, {
  11464. key: 0,
  11465. class: normalizeClass([_ctx.ns.is("loading"), _ctx.ns.e("postfix")])
  11466. }, {
  11467. default: withCtx(() => [
  11468. createVNode(_component_loading)
  11469. ]),
  11470. _: 1
  11471. }, 8, ["class"])) : (openBlock(), createBlock(_component_el_icon, {
  11472. key: 1,
  11473. class: normalizeClass(["arrow-right", _ctx.ns.e("postfix")])
  11474. }, {
  11475. default: withCtx(() => [
  11476. createVNode(_component_arrow_right)
  11477. ]),
  11478. _: 1
  11479. }, 8, ["class"]))
  11480. ], 2112)) : createCommentVNode("v-if", true)
  11481. ], 42, _hoisted_1$s);
  11482. }
  11483. var ElCascaderNode = /* @__PURE__ */ _export_sfc$1(_sfc_main$I, [["render", _sfc_render$n], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/cascader-panel/src/node.vue"]]);
  11484. const _sfc_main$H = defineComponent({
  11485. name: "ElCascaderMenu",
  11486. components: {
  11487. Loading: loading,
  11488. ElIcon,
  11489. ElScrollbar,
  11490. ElCascaderNode
  11491. },
  11492. props: {
  11493. nodes: {
  11494. type: Array,
  11495. required: true
  11496. },
  11497. index: {
  11498. type: Number,
  11499. required: true
  11500. }
  11501. },
  11502. setup(props) {
  11503. const instance = getCurrentInstance();
  11504. const ns = useNamespace("cascader-menu");
  11505. const { t } = useLocale();
  11506. const id = generateId();
  11507. let activeNode = null;
  11508. let hoverTimer = null;
  11509. const panel = inject(CASCADER_PANEL_INJECTION_KEY);
  11510. const hoverZone = ref(null);
  11511. const isEmpty3 = computed(() => !props.nodes.length);
  11512. const isLoading = computed(() => !panel.initialLoaded);
  11513. const menuId = computed(() => `cascader-menu-${id}-${props.index}`);
  11514. const handleExpand = (e) => {
  11515. activeNode = e.target;
  11516. };
  11517. const handleMouseMove = (e) => {
  11518. if (!panel.isHoverMenu || !activeNode || !hoverZone.value)
  11519. return;
  11520. if (activeNode.contains(e.target)) {
  11521. clearHoverTimer();
  11522. const el = instance.vnode.el;
  11523. const { left: left2 } = el.getBoundingClientRect();
  11524. const { offsetWidth, offsetHeight } = el;
  11525. const startX = e.clientX - left2;
  11526. const top2 = activeNode.offsetTop;
  11527. const bottom2 = top2 + activeNode.offsetHeight;
  11528. hoverZone.value.innerHTML = `
  11529. <path style="pointer-events: auto;" fill="transparent" d="M${startX} ${top2} L${offsetWidth} 0 V${top2} Z" />
  11530. <path style="pointer-events: auto;" fill="transparent" d="M${startX} ${bottom2} L${offsetWidth} ${offsetHeight} V${bottom2} Z" />
  11531. `;
  11532. } else if (!hoverTimer) {
  11533. hoverTimer = window.setTimeout(clearHoverZone, panel.config.hoverThreshold);
  11534. }
  11535. };
  11536. const clearHoverTimer = () => {
  11537. if (!hoverTimer)
  11538. return;
  11539. clearTimeout(hoverTimer);
  11540. hoverTimer = null;
  11541. };
  11542. const clearHoverZone = () => {
  11543. if (!hoverZone.value)
  11544. return;
  11545. hoverZone.value.innerHTML = "";
  11546. clearHoverTimer();
  11547. };
  11548. return {
  11549. ns,
  11550. panel,
  11551. hoverZone,
  11552. isEmpty: isEmpty3,
  11553. isLoading,
  11554. menuId,
  11555. t,
  11556. handleExpand,
  11557. handleMouseMove,
  11558. clearHoverZone
  11559. };
  11560. }
  11561. });
  11562. function _sfc_render$m(_ctx, _cache, $props, $setup, $data, $options) {
  11563. const _component_el_cascader_node = resolveComponent("el-cascader-node");
  11564. const _component_loading = resolveComponent("loading");
  11565. const _component_el_icon = resolveComponent("el-icon");
  11566. const _component_el_scrollbar = resolveComponent("el-scrollbar");
  11567. return openBlock(), createBlock(_component_el_scrollbar, {
  11568. key: _ctx.menuId,
  11569. tag: "ul",
  11570. role: "menu",
  11571. class: normalizeClass(_ctx.ns.b()),
  11572. "wrap-class": _ctx.ns.e("wrap"),
  11573. "view-class": [_ctx.ns.e("list"), _ctx.ns.is("empty", _ctx.isEmpty)],
  11574. onMousemove: _ctx.handleMouseMove,
  11575. onMouseleave: _ctx.clearHoverZone
  11576. }, {
  11577. default: withCtx(() => {
  11578. var _a2;
  11579. return [
  11580. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.nodes, (node) => {
  11581. return openBlock(), createBlock(_component_el_cascader_node, {
  11582. key: node.uid,
  11583. node,
  11584. "menu-id": _ctx.menuId,
  11585. onExpand: _ctx.handleExpand
  11586. }, null, 8, ["node", "menu-id", "onExpand"]);
  11587. }), 128)),
  11588. _ctx.isLoading ? (openBlock(), createElementBlock("div", {
  11589. key: 0,
  11590. class: normalizeClass(_ctx.ns.e("empty-text"))
  11591. }, [
  11592. createVNode(_component_el_icon, {
  11593. size: "14",
  11594. class: normalizeClass(_ctx.ns.is("loading"))
  11595. }, {
  11596. default: withCtx(() => [
  11597. createVNode(_component_loading)
  11598. ]),
  11599. _: 1
  11600. }, 8, ["class"]),
  11601. createTextVNode(" " + toDisplayString(_ctx.t("el.cascader.loading")), 1)
  11602. ], 2)) : _ctx.isEmpty ? (openBlock(), createElementBlock("div", {
  11603. key: 1,
  11604. class: normalizeClass(_ctx.ns.e("empty-text"))
  11605. }, toDisplayString(_ctx.t("el.cascader.noData")), 3)) : ((_a2 = _ctx.panel) == null ? void 0 : _a2.isHoverMenu) ? (openBlock(), createElementBlock("svg", {
  11606. key: 2,
  11607. ref: "hoverZone",
  11608. class: normalizeClass(_ctx.ns.e("hover-zone"))
  11609. }, null, 2)) : createCommentVNode("v-if", true)
  11610. ];
  11611. }),
  11612. _: 1
  11613. }, 8, ["class", "wrap-class", "view-class", "onMousemove", "onMouseleave"]);
  11614. }
  11615. var ElCascaderMenu = /* @__PURE__ */ _export_sfc$1(_sfc_main$H, [["render", _sfc_render$m], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/cascader-panel/src/menu.vue"]]);
  11616. var ExpandTrigger = /* @__PURE__ */ ((ExpandTrigger2) => {
  11617. ExpandTrigger2["CLICK"] = "click";
  11618. ExpandTrigger2["HOVER"] = "hover";
  11619. return ExpandTrigger2;
  11620. })(ExpandTrigger || {});
  11621. let uid = 0;
  11622. const calculatePathNodes = (node) => {
  11623. const nodes = [node];
  11624. let { parent } = node;
  11625. while (parent) {
  11626. nodes.unshift(parent);
  11627. parent = parent.parent;
  11628. }
  11629. return nodes;
  11630. };
  11631. class Node {
  11632. constructor(data2, config, parent, root2 = false) {
  11633. this.data = data2;
  11634. this.config = config;
  11635. this.parent = parent;
  11636. this.root = root2;
  11637. this.uid = uid++;
  11638. this.checked = false;
  11639. this.indeterminate = false;
  11640. this.loading = false;
  11641. const { value: valueKey, label: labelKey, children: childrenKey } = config;
  11642. const childrenData = data2[childrenKey];
  11643. const pathNodes = calculatePathNodes(this);
  11644. this.level = root2 ? 0 : parent ? parent.level + 1 : 1;
  11645. this.value = data2[valueKey];
  11646. this.label = data2[labelKey];
  11647. this.pathNodes = pathNodes;
  11648. this.pathValues = pathNodes.map((node) => node.value);
  11649. this.pathLabels = pathNodes.map((node) => node.label);
  11650. this.childrenData = childrenData;
  11651. this.children = (childrenData || []).map((child) => new Node(child, config, this));
  11652. this.loaded = !config.lazy || this.isLeaf || !isEmpty(childrenData);
  11653. }
  11654. get isDisabled() {
  11655. const { data: data2, parent, config } = this;
  11656. const { disabled, checkStrictly } = config;
  11657. const isDisabled = isFunction(disabled) ? disabled(data2, this) : !!data2[disabled];
  11658. return isDisabled || !checkStrictly && (parent == null ? void 0 : parent.isDisabled);
  11659. }
  11660. get isLeaf() {
  11661. const { data: data2, config, childrenData, loaded } = this;
  11662. const { lazy, leaf } = config;
  11663. const isLeaf2 = isFunction(leaf) ? leaf(data2, this) : data2[leaf];
  11664. return isUndefined(isLeaf2) ? lazy && !loaded ? false : !(Array.isArray(childrenData) && childrenData.length) : !!isLeaf2;
  11665. }
  11666. get valueByOption() {
  11667. return this.config.emitPath ? this.pathValues : this.value;
  11668. }
  11669. appendChild(childData) {
  11670. const { childrenData, children } = this;
  11671. const node = new Node(childData, this.config, this);
  11672. if (Array.isArray(childrenData)) {
  11673. childrenData.push(childData);
  11674. } else {
  11675. this.childrenData = [childData];
  11676. }
  11677. children.push(node);
  11678. return node;
  11679. }
  11680. calcText(allLevels, separator) {
  11681. const text = allLevels ? this.pathLabels.join(separator) : this.label;
  11682. this.text = text;
  11683. return text;
  11684. }
  11685. broadcast(event, ...args) {
  11686. const handlerName = `onParent${capitalize(event)}`;
  11687. this.children.forEach((child) => {
  11688. if (child) {
  11689. child.broadcast(event, ...args);
  11690. child[handlerName] && child[handlerName](...args);
  11691. }
  11692. });
  11693. }
  11694. emit(event, ...args) {
  11695. const { parent } = this;
  11696. const handlerName = `onChild${capitalize(event)}`;
  11697. if (parent) {
  11698. parent[handlerName] && parent[handlerName](...args);
  11699. parent.emit(event, ...args);
  11700. }
  11701. }
  11702. onParentCheck(checked) {
  11703. if (!this.isDisabled) {
  11704. this.setCheckState(checked);
  11705. }
  11706. }
  11707. onChildCheck() {
  11708. const { children } = this;
  11709. const validChildren = children.filter((child) => !child.isDisabled);
  11710. const checked = validChildren.length ? validChildren.every((child) => child.checked) : false;
  11711. this.setCheckState(checked);
  11712. }
  11713. setCheckState(checked) {
  11714. const totalNum = this.children.length;
  11715. const checkedNum = this.children.reduce((c, p2) => {
  11716. const num = p2.checked ? 1 : p2.indeterminate ? 0.5 : 0;
  11717. return c + num;
  11718. }, 0);
  11719. this.checked = this.loaded && this.children.every((child) => child.loaded && child.checked) && checked;
  11720. this.indeterminate = this.loaded && checkedNum !== totalNum && checkedNum > 0;
  11721. }
  11722. doCheck(checked) {
  11723. if (this.checked === checked)
  11724. return;
  11725. const { checkStrictly, multiple } = this.config;
  11726. if (checkStrictly || !multiple) {
  11727. this.checked = checked;
  11728. } else {
  11729. this.broadcast("check", checked);
  11730. this.setCheckState(checked);
  11731. this.emit("check");
  11732. }
  11733. }
  11734. }
  11735. const flatNodes = (nodes, leafOnly) => {
  11736. return nodes.reduce((res, node) => {
  11737. if (node.isLeaf) {
  11738. res.push(node);
  11739. } else {
  11740. !leafOnly && res.push(node);
  11741. res = res.concat(flatNodes(node.children, leafOnly));
  11742. }
  11743. return res;
  11744. }, []);
  11745. };
  11746. class Store {
  11747. constructor(data2, config) {
  11748. this.config = config;
  11749. const nodes = (data2 || []).map((nodeData) => new Node(nodeData, this.config));
  11750. this.nodes = nodes;
  11751. this.allNodes = flatNodes(nodes, false);
  11752. this.leafNodes = flatNodes(nodes, true);
  11753. }
  11754. getNodes() {
  11755. return this.nodes;
  11756. }
  11757. getFlattedNodes(leafOnly) {
  11758. return leafOnly ? this.leafNodes : this.allNodes;
  11759. }
  11760. appendNode(nodeData, parentNode) {
  11761. const node = parentNode ? parentNode.appendChild(nodeData) : new Node(nodeData, this.config);
  11762. if (!parentNode)
  11763. this.nodes.push(node);
  11764. this.allNodes.push(node);
  11765. node.isLeaf && this.leafNodes.push(node);
  11766. }
  11767. appendNodes(nodeDataList, parentNode) {
  11768. nodeDataList.forEach((nodeData) => this.appendNode(nodeData, parentNode));
  11769. }
  11770. getNodeByValue(value, leafOnly = false) {
  11771. if (!value && value !== 0)
  11772. return null;
  11773. const node = this.getFlattedNodes(leafOnly).find((node2) => isEqual(node2.value, value) || isEqual(node2.pathValues, value));
  11774. return node || null;
  11775. }
  11776. getSameNode(node) {
  11777. if (!node)
  11778. return null;
  11779. const node_ = this.getFlattedNodes(false).find(({ value, level }) => isEqual(node.value, value) && node.level === level);
  11780. return node_ || null;
  11781. }
  11782. }
  11783. const CommonProps = {
  11784. modelValue: [Number, String, Array],
  11785. options: {
  11786. type: Array,
  11787. default: () => []
  11788. },
  11789. props: {
  11790. type: Object,
  11791. default: () => ({})
  11792. }
  11793. };
  11794. const DefaultProps = {
  11795. expandTrigger: ExpandTrigger.CLICK,
  11796. multiple: false,
  11797. checkStrictly: false,
  11798. emitPath: true,
  11799. lazy: false,
  11800. lazyLoad: NOOP,
  11801. value: "value",
  11802. label: "label",
  11803. children: "children",
  11804. leaf: "leaf",
  11805. disabled: "disabled",
  11806. hoverThreshold: 500
  11807. };
  11808. const useCascaderConfig = (props) => {
  11809. return computed(() => __spreadValues(__spreadValues({}, DefaultProps), props.props));
  11810. };
  11811. const getMenuIndex = (el) => {
  11812. if (!el)
  11813. return 0;
  11814. const pieces = el.id.split("-");
  11815. return Number(pieces[pieces.length - 2]);
  11816. };
  11817. const checkNode = (el) => {
  11818. if (!el)
  11819. return;
  11820. const input = el.querySelector("input");
  11821. if (input) {
  11822. input.click();
  11823. } else if (isLeaf(el)) {
  11824. el.click();
  11825. }
  11826. };
  11827. const sortByOriginalOrder = (oldNodes, newNodes) => {
  11828. const newNodesCopy = newNodes.slice(0);
  11829. const newIds = newNodesCopy.map((node) => node.uid);
  11830. const res = oldNodes.reduce((acc, item) => {
  11831. const index = newIds.indexOf(item.uid);
  11832. if (index > -1) {
  11833. acc.push(item);
  11834. newNodesCopy.splice(index, 1);
  11835. newIds.splice(index, 1);
  11836. }
  11837. return acc;
  11838. }, []);
  11839. res.push(...newNodesCopy);
  11840. return res;
  11841. };
  11842. const _sfc_main$G = defineComponent({
  11843. name: "ElCascaderPanel",
  11844. components: {
  11845. ElCascaderMenu
  11846. },
  11847. props: __spreadProps(__spreadValues({}, CommonProps), {
  11848. border: {
  11849. type: Boolean,
  11850. default: true
  11851. },
  11852. renderLabel: Function
  11853. }),
  11854. emits: [UPDATE_MODEL_EVENT, CHANGE_EVENT, "close", "expand-change"],
  11855. setup(props, { emit, slots }) {
  11856. let manualChecked = false;
  11857. const ns = useNamespace("cascader");
  11858. const config = useCascaderConfig(props);
  11859. let store = null;
  11860. const initialLoaded = ref(true);
  11861. const menuList = ref([]);
  11862. const checkedValue = ref(null);
  11863. const menus = ref([]);
  11864. const expandingNode = ref(null);
  11865. const checkedNodes = ref([]);
  11866. const isHoverMenu = computed(() => config.value.expandTrigger === ExpandTrigger.HOVER);
  11867. const renderLabelFn = computed(() => props.renderLabel || slots.default);
  11868. const initStore = () => {
  11869. const { options } = props;
  11870. const cfg = config.value;
  11871. manualChecked = false;
  11872. store = new Store(options, cfg);
  11873. menus.value = [store.getNodes()];
  11874. if (cfg.lazy && isEmpty(props.options)) {
  11875. initialLoaded.value = false;
  11876. lazyLoad(void 0, (list) => {
  11877. if (list) {
  11878. store = new Store(list, cfg);
  11879. menus.value = [store.getNodes()];
  11880. }
  11881. initialLoaded.value = true;
  11882. syncCheckedValue(false, true);
  11883. });
  11884. } else {
  11885. syncCheckedValue(false, true);
  11886. }
  11887. };
  11888. const lazyLoad = (node, cb) => {
  11889. const cfg = config.value;
  11890. node = node || new Node({}, cfg, void 0, true);
  11891. node.loading = true;
  11892. const resolve = (dataList) => {
  11893. const _node = node;
  11894. const parent = _node.root ? null : _node;
  11895. dataList && (store == null ? void 0 : store.appendNodes(dataList, parent));
  11896. _node.loading = false;
  11897. _node.loaded = true;
  11898. _node.childrenData = _node.childrenData || [];
  11899. cb && cb(dataList);
  11900. };
  11901. cfg.lazyLoad(node, resolve);
  11902. };
  11903. const expandNode = (node, silent) => {
  11904. var _a2;
  11905. const { level } = node;
  11906. const newMenus = menus.value.slice(0, level);
  11907. let newExpandingNode;
  11908. if (node.isLeaf) {
  11909. newExpandingNode = node.pathNodes[level - 2];
  11910. } else {
  11911. newExpandingNode = node;
  11912. newMenus.push(node.children);
  11913. }
  11914. if (((_a2 = expandingNode.value) == null ? void 0 : _a2.uid) !== (newExpandingNode == null ? void 0 : newExpandingNode.uid)) {
  11915. expandingNode.value = node;
  11916. menus.value = newMenus;
  11917. !silent && emit("expand-change", (node == null ? void 0 : node.pathValues) || []);
  11918. }
  11919. };
  11920. const handleCheckChange = (node, checked, emitClose = true) => {
  11921. const { checkStrictly, multiple } = config.value;
  11922. const oldNode = checkedNodes.value[0];
  11923. manualChecked = true;
  11924. !multiple && (oldNode == null ? void 0 : oldNode.doCheck(false));
  11925. node.doCheck(checked);
  11926. calculateCheckedValue();
  11927. emitClose && !multiple && !checkStrictly && emit("close");
  11928. !emitClose && !multiple && !checkStrictly && expandParentNode(node);
  11929. };
  11930. const expandParentNode = (node) => {
  11931. if (!node)
  11932. return;
  11933. node = node.parent;
  11934. expandParentNode(node);
  11935. node && expandNode(node);
  11936. };
  11937. const getFlattedNodes = (leafOnly) => {
  11938. return store == null ? void 0 : store.getFlattedNodes(leafOnly);
  11939. };
  11940. const getCheckedNodes = (leafOnly) => {
  11941. var _a2;
  11942. return (_a2 = getFlattedNodes(leafOnly)) == null ? void 0 : _a2.filter((node) => node.checked !== false);
  11943. };
  11944. const clearCheckedNodes = () => {
  11945. checkedNodes.value.forEach((node) => node.doCheck(false));
  11946. calculateCheckedValue();
  11947. };
  11948. const calculateCheckedValue = () => {
  11949. var _a2;
  11950. const { checkStrictly, multiple } = config.value;
  11951. const oldNodes = checkedNodes.value;
  11952. const newNodes = getCheckedNodes(!checkStrictly);
  11953. const nodes = sortByOriginalOrder(oldNodes, newNodes);
  11954. const values = nodes.map((node) => node.valueByOption);
  11955. checkedNodes.value = nodes;
  11956. checkedValue.value = multiple ? values : (_a2 = values[0]) != null ? _a2 : null;
  11957. };
  11958. const syncCheckedValue = (loaded = false, forced = false) => {
  11959. const { modelValue } = props;
  11960. const { lazy, multiple, checkStrictly } = config.value;
  11961. const leafOnly = !checkStrictly;
  11962. if (!initialLoaded.value || manualChecked || !forced && isEqual(modelValue, checkedValue.value))
  11963. return;
  11964. if (lazy && !loaded) {
  11965. const values = unique(flattenDeep(castArray(modelValue)));
  11966. const nodes = values.map((val) => store == null ? void 0 : store.getNodeByValue(val)).filter((node) => !!node && !node.loaded && !node.loading);
  11967. if (nodes.length) {
  11968. nodes.forEach((node) => {
  11969. lazyLoad(node, () => syncCheckedValue(false, forced));
  11970. });
  11971. } else {
  11972. syncCheckedValue(true, forced);
  11973. }
  11974. } else {
  11975. const values = multiple ? castArray(modelValue) : [modelValue];
  11976. const nodes = unique(values.map((val) => store == null ? void 0 : store.getNodeByValue(val, leafOnly)));
  11977. syncMenuState(nodes, false);
  11978. checkedValue.value = modelValue;
  11979. }
  11980. };
  11981. const syncMenuState = (newCheckedNodes, reserveExpandingState = true) => {
  11982. const { checkStrictly } = config.value;
  11983. const oldNodes = checkedNodes.value;
  11984. const newNodes = newCheckedNodes.filter((node) => !!node && (checkStrictly || node.isLeaf));
  11985. const oldExpandingNode = store == null ? void 0 : store.getSameNode(expandingNode.value);
  11986. const newExpandingNode = reserveExpandingState && oldExpandingNode || newNodes[0];
  11987. if (newExpandingNode) {
  11988. newExpandingNode.pathNodes.forEach((node) => expandNode(node, true));
  11989. } else {
  11990. expandingNode.value = null;
  11991. }
  11992. oldNodes.forEach((node) => node.doCheck(false));
  11993. newNodes.forEach((node) => node.doCheck(true));
  11994. checkedNodes.value = newNodes;
  11995. nextTick(scrollToExpandingNode);
  11996. };
  11997. const scrollToExpandingNode = () => {
  11998. if (!isClient$1)
  11999. return;
  12000. menuList.value.forEach((menu) => {
  12001. const menuElement = menu == null ? void 0 : menu.$el;
  12002. if (menuElement) {
  12003. const container = menuElement.querySelector(`.${ns.namespace.value}-scrollbar__wrap`);
  12004. const activeNode = menuElement.querySelector(`.${ns.b("node")}.${ns.is("active")}`) || menuElement.querySelector(`.${ns.b("node")}.in-active-path`);
  12005. scrollIntoView(container, activeNode);
  12006. }
  12007. });
  12008. };
  12009. const handleKeyDown2 = (e) => {
  12010. const target = e.target;
  12011. const { code } = e;
  12012. switch (code) {
  12013. case EVENT_CODE.up:
  12014. case EVENT_CODE.down: {
  12015. e.preventDefault();
  12016. const distance = code === EVENT_CODE.up ? -1 : 1;
  12017. focusNode(getSibling(target, distance, `.${ns.b("node")}[tabindex="-1"]`));
  12018. break;
  12019. }
  12020. case EVENT_CODE.left: {
  12021. e.preventDefault();
  12022. const preMenu = menuList.value[getMenuIndex(target) - 1];
  12023. const expandedNode = preMenu == null ? void 0 : preMenu.$el.querySelector(`.${ns.b("node")}[aria-expanded="true"]`);
  12024. focusNode(expandedNode);
  12025. break;
  12026. }
  12027. case EVENT_CODE.right: {
  12028. e.preventDefault();
  12029. const nextMenu = menuList.value[getMenuIndex(target) + 1];
  12030. const firstNode = nextMenu == null ? void 0 : nextMenu.$el.querySelector(`.${ns.b("node")}[tabindex="-1"]`);
  12031. focusNode(firstNode);
  12032. break;
  12033. }
  12034. case EVENT_CODE.enter:
  12035. checkNode(target);
  12036. break;
  12037. case EVENT_CODE.esc:
  12038. case EVENT_CODE.tab:
  12039. emit("close");
  12040. break;
  12041. }
  12042. };
  12043. provide(CASCADER_PANEL_INJECTION_KEY, reactive({
  12044. config,
  12045. expandingNode,
  12046. checkedNodes,
  12047. isHoverMenu,
  12048. initialLoaded,
  12049. renderLabelFn,
  12050. lazyLoad,
  12051. expandNode,
  12052. handleCheckChange
  12053. }));
  12054. watch([config, () => props.options], initStore, {
  12055. deep: true,
  12056. immediate: true
  12057. });
  12058. watch(() => props.modelValue, () => {
  12059. manualChecked = false;
  12060. syncCheckedValue();
  12061. });
  12062. watch(checkedValue, (val) => {
  12063. if (!isEqual(val, props.modelValue)) {
  12064. emit(UPDATE_MODEL_EVENT, val);
  12065. emit(CHANGE_EVENT, val);
  12066. }
  12067. });
  12068. onBeforeUpdate(() => menuList.value = []);
  12069. onMounted(() => !isEmpty(props.modelValue) && syncCheckedValue());
  12070. return {
  12071. ns,
  12072. menuList,
  12073. menus,
  12074. checkedNodes,
  12075. handleKeyDown: handleKeyDown2,
  12076. handleCheckChange,
  12077. getFlattedNodes,
  12078. getCheckedNodes,
  12079. clearCheckedNodes,
  12080. calculateCheckedValue,
  12081. scrollToExpandingNode
  12082. };
  12083. }
  12084. });
  12085. function _sfc_render$l(_ctx, _cache, $props, $setup, $data, $options) {
  12086. const _component_el_cascader_menu = resolveComponent("el-cascader-menu");
  12087. return openBlock(), createElementBlock("div", {
  12088. class: normalizeClass([_ctx.ns.b("panel"), _ctx.ns.is("bordered", _ctx.border)]),
  12089. onKeydown: _cache[0] || (_cache[0] = (...args) => _ctx.handleKeyDown && _ctx.handleKeyDown(...args))
  12090. }, [
  12091. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.menus, (menu, index) => {
  12092. return openBlock(), createBlock(_component_el_cascader_menu, {
  12093. key: index,
  12094. ref_for: true,
  12095. ref: (item) => _ctx.menuList[index] = item,
  12096. index,
  12097. nodes: [...menu]
  12098. }, null, 8, ["index", "nodes"]);
  12099. }), 128))
  12100. ], 34);
  12101. }
  12102. var CascaderPanel = /* @__PURE__ */ _export_sfc$1(_sfc_main$G, [["render", _sfc_render$l], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/cascader-panel/src/index.vue"]]);
  12103. CascaderPanel.install = (app) => {
  12104. app.component(CascaderPanel.name, CascaderPanel);
  12105. };
  12106. const _CascaderPanel = CascaderPanel;
  12107. const tagProps = buildProps({
  12108. closable: Boolean,
  12109. type: {
  12110. type: String,
  12111. values: ["success", "info", "warning", "danger", ""],
  12112. default: ""
  12113. },
  12114. hit: Boolean,
  12115. disableTransitions: Boolean,
  12116. color: {
  12117. type: String,
  12118. default: ""
  12119. },
  12120. size: {
  12121. type: String,
  12122. values: componentSizes,
  12123. default: ""
  12124. },
  12125. effect: {
  12126. type: String,
  12127. values: ["dark", "light", "plain"],
  12128. default: "light"
  12129. },
  12130. round: Boolean
  12131. });
  12132. const tagEmits = {
  12133. close: (evt) => evt instanceof MouseEvent,
  12134. click: (evt) => evt instanceof MouseEvent
  12135. };
  12136. const __default__$d = {
  12137. name: "ElTag"
  12138. };
  12139. const _sfc_main$F = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$d), {
  12140. props: tagProps,
  12141. emits: tagEmits,
  12142. setup(__props, { emit }) {
  12143. const props = __props;
  12144. const tagSize = useSize();
  12145. const ns = useNamespace("tag");
  12146. const classes = computed(() => {
  12147. const { type: type4, hit, effect: effect2, closable, round: round2 } = props;
  12148. return [
  12149. ns.b(),
  12150. ns.is("closable", closable),
  12151. ns.m(type4),
  12152. ns.m(tagSize.value),
  12153. ns.m(effect2),
  12154. ns.is("hit", hit),
  12155. ns.is("round", round2)
  12156. ];
  12157. });
  12158. const handleClose = (event) => {
  12159. event.stopPropagation();
  12160. emit("close", event);
  12161. };
  12162. const handleClick = (event) => {
  12163. emit("click", event);
  12164. };
  12165. return (_ctx, _cache) => {
  12166. return !_ctx.disableTransitions ? (openBlock(), createElementBlock("span", {
  12167. key: 0,
  12168. class: normalizeClass(unref(classes)),
  12169. style: normalizeStyle({ backgroundColor: _ctx.color }),
  12170. onClick: handleClick
  12171. }, [
  12172. createElementVNode("span", {
  12173. class: normalizeClass(unref(ns).e("content"))
  12174. }, [
  12175. renderSlot(_ctx.$slots, "default")
  12176. ], 2),
  12177. _ctx.closable ? (openBlock(), createBlock(unref(ElIcon), {
  12178. key: 0,
  12179. class: normalizeClass(unref(ns).e("close")),
  12180. onClick: handleClose
  12181. }, {
  12182. default: withCtx(() => [
  12183. createVNode(unref(close))
  12184. ]),
  12185. _: 1
  12186. }, 8, ["class"])) : createCommentVNode("v-if", true)
  12187. ], 6)) : (openBlock(), createBlock(Transition, {
  12188. key: 1,
  12189. name: `${unref(ns).namespace.value}-zoom-in-center`
  12190. }, {
  12191. default: withCtx(() => [
  12192. createElementVNode("span", {
  12193. class: normalizeClass(unref(classes)),
  12194. style: normalizeStyle({ backgroundColor: _ctx.color }),
  12195. onClick: handleClick
  12196. }, [
  12197. createElementVNode("span", {
  12198. class: normalizeClass(unref(ns).e("content"))
  12199. }, [
  12200. renderSlot(_ctx.$slots, "default")
  12201. ], 2),
  12202. _ctx.closable ? (openBlock(), createBlock(unref(ElIcon), {
  12203. key: 0,
  12204. class: normalizeClass(unref(ns).e("close")),
  12205. onClick: handleClose
  12206. }, {
  12207. default: withCtx(() => [
  12208. createVNode(unref(close))
  12209. ]),
  12210. _: 1
  12211. }, 8, ["class"])) : createCommentVNode("v-if", true)
  12212. ], 6)
  12213. ]),
  12214. _: 3
  12215. }, 8, ["name"]));
  12216. };
  12217. }
  12218. }));
  12219. var Tag = /* @__PURE__ */ _export_sfc$1(_sfc_main$F, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/tag/src/tag.vue"]]);
  12220. const ElTag = withInstall(Tag);
  12221. const DEFAULT_INPUT_HEIGHT = 40;
  12222. const INPUT_HEIGHT_MAP = {
  12223. large: 36,
  12224. default: 32,
  12225. small: 28
  12226. };
  12227. const popperOptions = {
  12228. modifiers: [
  12229. {
  12230. name: "arrowPosition",
  12231. enabled: true,
  12232. phase: "main",
  12233. fn: ({ state }) => {
  12234. const { modifiersData, placement } = state;
  12235. if (["right", "left", "bottom", "top"].includes(placement))
  12236. return;
  12237. modifiersData.arrow.x = 35;
  12238. },
  12239. requires: ["arrow"]
  12240. }
  12241. ]
  12242. };
  12243. const COMPONENT_NAME$3 = "ElCascader";
  12244. const _sfc_main$E = defineComponent({
  12245. name: COMPONENT_NAME$3,
  12246. components: {
  12247. ElCascaderPanel: _CascaderPanel,
  12248. ElInput,
  12249. ElTooltip,
  12250. ElScrollbar,
  12251. ElTag,
  12252. ElIcon,
  12253. CircleClose: circleClose,
  12254. Check: check,
  12255. ArrowDown: arrowDown
  12256. },
  12257. directives: {
  12258. Clickoutside: ClickOutside
  12259. },
  12260. props: __spreadProps(__spreadValues({}, CommonProps), {
  12261. size: {
  12262. type: String,
  12263. validator: isValidComponentSize
  12264. },
  12265. placeholder: {
  12266. type: String
  12267. },
  12268. disabled: Boolean,
  12269. clearable: Boolean,
  12270. filterable: Boolean,
  12271. filterMethod: {
  12272. type: Function,
  12273. default: (node, keyword) => node.text.includes(keyword)
  12274. },
  12275. separator: {
  12276. type: String,
  12277. default: " / "
  12278. },
  12279. showAllLevels: {
  12280. type: Boolean,
  12281. default: true
  12282. },
  12283. collapseTags: Boolean,
  12284. collapseTagsTooltip: {
  12285. type: Boolean,
  12286. default: false
  12287. },
  12288. debounce: {
  12289. type: Number,
  12290. default: 300
  12291. },
  12292. beforeFilter: {
  12293. type: Function,
  12294. default: () => true
  12295. },
  12296. popperClass: {
  12297. type: String,
  12298. default: ""
  12299. },
  12300. popperAppendToBody: {
  12301. type: Boolean,
  12302. default: void 0
  12303. },
  12304. teleported: useTooltipContentProps.teleported,
  12305. tagType: __spreadProps(__spreadValues({}, tagProps.type), { default: "info" })
  12306. }),
  12307. emits: [
  12308. UPDATE_MODEL_EVENT,
  12309. CHANGE_EVENT,
  12310. "focus",
  12311. "blur",
  12312. "visible-change",
  12313. "expand-change",
  12314. "remove-tag"
  12315. ],
  12316. setup(props, { emit }) {
  12317. let inputInitialHeight = 0;
  12318. let pressDeleteCount = 0;
  12319. const { compatTeleported } = useDeprecateAppendToBody(COMPONENT_NAME$3, "popperAppendToBody");
  12320. const nsCascader = useNamespace("cascader");
  12321. const nsInput = useNamespace("input");
  12322. const { t } = useLocale();
  12323. const elForm2 = inject(formContextKey, {});
  12324. const elFormItem2 = inject(formItemContextKey, {});
  12325. const tooltipRef = ref(null);
  12326. const input = ref(null);
  12327. const tagWrapper = ref(null);
  12328. const panel = ref(null);
  12329. const suggestionPanel = ref(null);
  12330. const popperVisible = ref(false);
  12331. const inputHover = ref(false);
  12332. const filtering = ref(false);
  12333. const inputValue = ref("");
  12334. const searchInputValue = ref("");
  12335. const presentTags = ref([]);
  12336. const allPresentTags = ref([]);
  12337. const suggestions = ref([]);
  12338. const isOnComposition = ref(false);
  12339. const isDisabled = computed(() => props.disabled || elForm2.disabled);
  12340. const inputPlaceholder = computed(() => props.placeholder || t("el.cascader.placeholder"));
  12341. const realSize = useSize();
  12342. const tagSize = computed(() => ["small"].includes(realSize.value) ? "small" : "default");
  12343. const multiple = computed(() => !!props.props.multiple);
  12344. const readonly2 = computed(() => !props.filterable || multiple.value);
  12345. const searchKeyword = computed(() => multiple.value ? searchInputValue.value : inputValue.value);
  12346. const checkedNodes = computed(() => {
  12347. var _a2;
  12348. return ((_a2 = panel.value) == null ? void 0 : _a2.checkedNodes) || [];
  12349. });
  12350. const clearBtnVisible = computed(() => {
  12351. if (!props.clearable || isDisabled.value || filtering.value || !inputHover.value)
  12352. return false;
  12353. return !!checkedNodes.value.length;
  12354. });
  12355. const presentText = computed(() => {
  12356. const { showAllLevels, separator } = props;
  12357. const nodes = checkedNodes.value;
  12358. return nodes.length ? multiple.value ? " " : nodes[0].calcText(showAllLevels, separator) : "";
  12359. });
  12360. const checkedValue = computed({
  12361. get() {
  12362. return props.modelValue;
  12363. },
  12364. set(val) {
  12365. var _a2;
  12366. emit(UPDATE_MODEL_EVENT, val);
  12367. emit(CHANGE_EVENT, val);
  12368. (_a2 = elFormItem2.validate) == null ? void 0 : _a2.call(elFormItem2, "change").catch((err) => debugWarn());
  12369. }
  12370. });
  12371. const popperPaneRef = computed(() => {
  12372. var _a2, _b2;
  12373. return (_b2 = (_a2 = tooltipRef.value) == null ? void 0 : _a2.popperRef) == null ? void 0 : _b2.contentRef;
  12374. });
  12375. const togglePopperVisible = (visible) => {
  12376. var _a2, _b2, _c;
  12377. if (isDisabled.value)
  12378. return;
  12379. visible = visible != null ? visible : !popperVisible.value;
  12380. if (visible !== popperVisible.value) {
  12381. popperVisible.value = visible;
  12382. (_b2 = (_a2 = input.value) == null ? void 0 : _a2.input) == null ? void 0 : _b2.setAttribute("aria-expanded", `${visible}`);
  12383. if (visible) {
  12384. updatePopperPosition();
  12385. nextTick((_c = panel.value) == null ? void 0 : _c.scrollToExpandingNode);
  12386. } else if (props.filterable) {
  12387. const { value } = presentText;
  12388. inputValue.value = value;
  12389. searchInputValue.value = value;
  12390. }
  12391. emit("visible-change", visible);
  12392. }
  12393. };
  12394. const updatePopperPosition = () => {
  12395. nextTick(() => {
  12396. var _a2;
  12397. (_a2 = tooltipRef.value) == null ? void 0 : _a2.updatePopper();
  12398. });
  12399. };
  12400. const hideSuggestionPanel = () => {
  12401. filtering.value = false;
  12402. };
  12403. const genTag2 = (node) => {
  12404. const { showAllLevels, separator } = props;
  12405. return {
  12406. node,
  12407. key: node.uid,
  12408. text: node.calcText(showAllLevels, separator),
  12409. hitState: false,
  12410. closable: !isDisabled.value && !node.isDisabled,
  12411. isCollapseTag: false
  12412. };
  12413. };
  12414. const deleteTag = (tag) => {
  12415. var _a2;
  12416. const node = tag.node;
  12417. node.doCheck(false);
  12418. (_a2 = panel.value) == null ? void 0 : _a2.calculateCheckedValue();
  12419. emit("remove-tag", node.valueByOption);
  12420. };
  12421. const calculatePresentTags = () => {
  12422. if (!multiple.value)
  12423. return;
  12424. const nodes = checkedNodes.value;
  12425. const tags = [];
  12426. const allTags = [];
  12427. nodes.forEach((node) => allTags.push(genTag2(node)));
  12428. allPresentTags.value = allTags;
  12429. if (nodes.length) {
  12430. const [first, ...rest] = nodes;
  12431. const restCount = rest.length;
  12432. tags.push(genTag2(first));
  12433. if (restCount) {
  12434. if (props.collapseTags) {
  12435. tags.push({
  12436. key: -1,
  12437. text: `+ ${restCount}`,
  12438. closable: false,
  12439. isCollapseTag: true
  12440. });
  12441. } else {
  12442. rest.forEach((node) => tags.push(genTag2(node)));
  12443. }
  12444. }
  12445. }
  12446. presentTags.value = tags;
  12447. };
  12448. const calculateSuggestions = () => {
  12449. var _a2, _b2;
  12450. const { filterMethod, showAllLevels, separator } = props;
  12451. const res = (_b2 = (_a2 = panel.value) == null ? void 0 : _a2.getFlattedNodes(!props.props.checkStrictly)) == null ? void 0 : _b2.filter((node) => {
  12452. if (node.isDisabled)
  12453. return false;
  12454. node.calcText(showAllLevels, separator);
  12455. return filterMethod(node, searchKeyword.value);
  12456. });
  12457. if (multiple.value) {
  12458. presentTags.value.forEach((tag) => {
  12459. tag.hitState = false;
  12460. });
  12461. allPresentTags.value.forEach((tag) => {
  12462. tag.hitState = false;
  12463. });
  12464. }
  12465. filtering.value = true;
  12466. suggestions.value = res;
  12467. updatePopperPosition();
  12468. };
  12469. const focusFirstNode = () => {
  12470. var _a2;
  12471. let firstNode;
  12472. if (filtering.value && suggestionPanel.value) {
  12473. firstNode = suggestionPanel.value.$el.querySelector(`.${nsCascader.e("suggestion-item")}`);
  12474. } else {
  12475. firstNode = (_a2 = panel.value) == null ? void 0 : _a2.$el.querySelector(`.${nsCascader.b("node")}[tabindex="-1"]`);
  12476. }
  12477. if (firstNode) {
  12478. firstNode.focus();
  12479. !filtering.value && firstNode.click();
  12480. }
  12481. };
  12482. const updateStyle = () => {
  12483. var _a2, _b2;
  12484. const inputInner = (_a2 = input.value) == null ? void 0 : _a2.input;
  12485. const tagWrapperEl = tagWrapper.value;
  12486. const suggestionPanelEl = (_b2 = suggestionPanel.value) == null ? void 0 : _b2.$el;
  12487. if (!isClient$1 || !inputInner)
  12488. return;
  12489. if (suggestionPanelEl) {
  12490. const suggestionList = suggestionPanelEl.querySelector(`.${nsCascader.e("suggestion-list")}`);
  12491. suggestionList.style.minWidth = `${inputInner.offsetWidth}px`;
  12492. }
  12493. if (tagWrapperEl) {
  12494. const { offsetHeight } = tagWrapperEl;
  12495. const height = presentTags.value.length > 0 ? `${Math.max(offsetHeight + 6, inputInitialHeight)}px` : `${inputInitialHeight}px`;
  12496. inputInner.style.height = height;
  12497. updatePopperPosition();
  12498. }
  12499. };
  12500. const getCheckedNodes = (leafOnly) => {
  12501. var _a2;
  12502. return (_a2 = panel.value) == null ? void 0 : _a2.getCheckedNodes(leafOnly);
  12503. };
  12504. const handleExpandChange = (value) => {
  12505. updatePopperPosition();
  12506. emit("expand-change", value);
  12507. };
  12508. const handleComposition = (event) => {
  12509. var _a2;
  12510. const text = (_a2 = event.target) == null ? void 0 : _a2.value;
  12511. if (event.type === "compositionend") {
  12512. isOnComposition.value = false;
  12513. nextTick(() => handleInput(text));
  12514. } else {
  12515. const lastCharacter = text[text.length - 1] || "";
  12516. isOnComposition.value = !isKorean(lastCharacter);
  12517. }
  12518. };
  12519. const handleKeyDown2 = (e) => {
  12520. if (isOnComposition.value)
  12521. return;
  12522. switch (e.code) {
  12523. case EVENT_CODE.enter:
  12524. togglePopperVisible();
  12525. break;
  12526. case EVENT_CODE.down:
  12527. togglePopperVisible(true);
  12528. nextTick(focusFirstNode);
  12529. e.preventDefault();
  12530. break;
  12531. case EVENT_CODE.esc:
  12532. case EVENT_CODE.tab:
  12533. togglePopperVisible(false);
  12534. break;
  12535. }
  12536. };
  12537. const handleClear = () => {
  12538. var _a2;
  12539. (_a2 = panel.value) == null ? void 0 : _a2.clearCheckedNodes();
  12540. togglePopperVisible(false);
  12541. };
  12542. const handleSuggestionClick = (node) => {
  12543. var _a2, _b2;
  12544. const { checked } = node;
  12545. if (multiple.value) {
  12546. (_a2 = panel.value) == null ? void 0 : _a2.handleCheckChange(node, !checked, false);
  12547. } else {
  12548. !checked && ((_b2 = panel.value) == null ? void 0 : _b2.handleCheckChange(node, true, false));
  12549. togglePopperVisible(false);
  12550. }
  12551. };
  12552. const handleSuggestionKeyDown = (e) => {
  12553. const target = e.target;
  12554. const { code } = e;
  12555. switch (code) {
  12556. case EVENT_CODE.up:
  12557. case EVENT_CODE.down: {
  12558. const distance = code === EVENT_CODE.up ? -1 : 1;
  12559. focusNode(getSibling(target, distance, `.${nsCascader.e("suggestion-item")}[tabindex="-1"]`));
  12560. break;
  12561. }
  12562. case EVENT_CODE.enter:
  12563. target.click();
  12564. break;
  12565. case EVENT_CODE.esc:
  12566. case EVENT_CODE.tab:
  12567. togglePopperVisible(false);
  12568. break;
  12569. }
  12570. };
  12571. const handleDelete = () => {
  12572. const tags = presentTags.value;
  12573. const lastTag = tags[tags.length - 1];
  12574. pressDeleteCount = searchInputValue.value ? 0 : pressDeleteCount + 1;
  12575. if (!lastTag || !pressDeleteCount)
  12576. return;
  12577. if (lastTag.hitState) {
  12578. deleteTag(lastTag);
  12579. } else {
  12580. lastTag.hitState = true;
  12581. }
  12582. };
  12583. const handleFilter = debounce$1(() => {
  12584. const { value } = searchKeyword;
  12585. if (!value)
  12586. return;
  12587. const passed = props.beforeFilter(value);
  12588. if (isPromise(passed)) {
  12589. passed.then(calculateSuggestions).catch(() => {
  12590. });
  12591. } else if (passed !== false) {
  12592. calculateSuggestions();
  12593. } else {
  12594. hideSuggestionPanel();
  12595. }
  12596. }, props.debounce);
  12597. const handleInput = (val, e) => {
  12598. !popperVisible.value && togglePopperVisible(true);
  12599. if (e == null ? void 0 : e.isComposing)
  12600. return;
  12601. val ? handleFilter() : hideSuggestionPanel();
  12602. };
  12603. watch(filtering, updatePopperPosition);
  12604. watch([checkedNodes, isDisabled], calculatePresentTags);
  12605. watch(presentTags, () => {
  12606. nextTick(() => updateStyle());
  12607. });
  12608. watch(presentText, (val) => inputValue.value = val, { immediate: true });
  12609. onMounted(() => {
  12610. var _a2;
  12611. const inputEl = (_a2 = input.value) == null ? void 0 : _a2.$el;
  12612. inputInitialHeight = (inputEl == null ? void 0 : inputEl.offsetHeight) || INPUT_HEIGHT_MAP[realSize.value] || DEFAULT_INPUT_HEIGHT;
  12613. addResizeListener(inputEl, updateStyle);
  12614. });
  12615. onBeforeUnmount(() => {
  12616. var _a2;
  12617. removeResizeListener((_a2 = input.value) == null ? void 0 : _a2.$el, updateStyle);
  12618. });
  12619. return {
  12620. popperOptions,
  12621. tooltipRef,
  12622. popperPaneRef,
  12623. input,
  12624. tagWrapper,
  12625. panel,
  12626. suggestionPanel,
  12627. popperVisible,
  12628. inputHover,
  12629. inputPlaceholder,
  12630. filtering,
  12631. presentText,
  12632. checkedValue,
  12633. inputValue,
  12634. searchInputValue,
  12635. presentTags,
  12636. allPresentTags,
  12637. suggestions,
  12638. isDisabled,
  12639. isOnComposition,
  12640. realSize,
  12641. tagSize,
  12642. multiple,
  12643. readonly: readonly2,
  12644. clearBtnVisible,
  12645. compatTeleported,
  12646. nsCascader,
  12647. nsInput,
  12648. t,
  12649. togglePopperVisible,
  12650. hideSuggestionPanel,
  12651. deleteTag,
  12652. focusFirstNode,
  12653. getCheckedNodes,
  12654. handleExpandChange,
  12655. handleKeyDown: handleKeyDown2,
  12656. handleComposition,
  12657. handleClear,
  12658. handleSuggestionClick,
  12659. handleSuggestionKeyDown,
  12660. handleDelete,
  12661. handleInput
  12662. };
  12663. }
  12664. });
  12665. const _hoisted_1$r = { key: 0 };
  12666. const _hoisted_2$k = { class: "el-cascader__collapse-tags" };
  12667. const _hoisted_3$e = ["placeholder"];
  12668. const _hoisted_4$c = ["onClick"];
  12669. function _sfc_render$k(_ctx, _cache, $props, $setup, $data, $options) {
  12670. const _component_circle_close = resolveComponent("circle-close");
  12671. const _component_el_icon = resolveComponent("el-icon");
  12672. const _component_arrow_down = resolveComponent("arrow-down");
  12673. const _component_el_input = resolveComponent("el-input");
  12674. const _component_el_tag = resolveComponent("el-tag");
  12675. const _component_el_tooltip = resolveComponent("el-tooltip");
  12676. const _component_el_cascader_panel = resolveComponent("el-cascader-panel");
  12677. const _component_check = resolveComponent("check");
  12678. const _component_el_scrollbar = resolveComponent("el-scrollbar");
  12679. const _directive_clickoutside = resolveDirective("clickoutside");
  12680. return openBlock(), createBlock(_component_el_tooltip, {
  12681. ref: "tooltipRef",
  12682. visible: _ctx.popperVisible,
  12683. "onUpdate:visible": _cache[17] || (_cache[17] = ($event) => _ctx.popperVisible = $event),
  12684. teleported: _ctx.compatTeleported,
  12685. "popper-class": [_ctx.nsCascader.e("dropdown"), _ctx.popperClass],
  12686. "popper-options": _ctx.popperOptions,
  12687. "fallback-placements": [
  12688. "bottom-start",
  12689. "bottom",
  12690. "top-start",
  12691. "top",
  12692. "right",
  12693. "left"
  12694. ],
  12695. "stop-popper-mouse-event": false,
  12696. "gpu-acceleration": false,
  12697. placement: "bottom-start",
  12698. transition: `${_ctx.nsCascader.namespace.value}-zoom-in-top`,
  12699. effect: "light",
  12700. pure: "",
  12701. persistent: "",
  12702. onHide: _ctx.hideSuggestionPanel
  12703. }, {
  12704. default: withCtx(() => [
  12705. withDirectives((openBlock(), createElementBlock("div", {
  12706. class: normalizeClass([
  12707. _ctx.nsCascader.b(),
  12708. _ctx.nsCascader.m(_ctx.realSize),
  12709. _ctx.nsCascader.is("disabled", _ctx.isDisabled),
  12710. _ctx.$attrs.class
  12711. ]),
  12712. style: normalizeStyle(_ctx.$attrs.style),
  12713. onClick: _cache[11] || (_cache[11] = () => _ctx.togglePopperVisible(_ctx.readonly ? void 0 : true)),
  12714. onKeydown: _cache[12] || (_cache[12] = (...args) => _ctx.handleKeyDown && _ctx.handleKeyDown(...args)),
  12715. onMouseenter: _cache[13] || (_cache[13] = ($event) => _ctx.inputHover = true),
  12716. onMouseleave: _cache[14] || (_cache[14] = ($event) => _ctx.inputHover = false)
  12717. }, [
  12718. createVNode(_component_el_input, {
  12719. ref: "input",
  12720. modelValue: _ctx.inputValue,
  12721. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.inputValue = $event),
  12722. placeholder: _ctx.inputPlaceholder,
  12723. readonly: _ctx.readonly,
  12724. disabled: _ctx.isDisabled,
  12725. "validate-event": false,
  12726. size: _ctx.realSize,
  12727. class: normalizeClass(_ctx.nsCascader.is("focus", _ctx.popperVisible)),
  12728. onCompositionstart: _ctx.handleComposition,
  12729. onCompositionupdate: _ctx.handleComposition,
  12730. onCompositionend: _ctx.handleComposition,
  12731. onFocus: _cache[2] || (_cache[2] = (e) => _ctx.$emit("focus", e)),
  12732. onBlur: _cache[3] || (_cache[3] = (e) => _ctx.$emit("blur", e)),
  12733. onInput: _ctx.handleInput
  12734. }, {
  12735. suffix: withCtx(() => [
  12736. _ctx.clearBtnVisible ? (openBlock(), createBlock(_component_el_icon, {
  12737. key: "clear",
  12738. class: normalizeClass([_ctx.nsInput.e("icon"), "icon-circle-close"]),
  12739. onClick: withModifiers(_ctx.handleClear, ["stop"])
  12740. }, {
  12741. default: withCtx(() => [
  12742. createVNode(_component_circle_close)
  12743. ]),
  12744. _: 1
  12745. }, 8, ["class", "onClick"])) : (openBlock(), createBlock(_component_el_icon, {
  12746. key: "arrow-down",
  12747. class: normalizeClass([
  12748. _ctx.nsInput.e("icon"),
  12749. "icon-arrow-down",
  12750. _ctx.nsCascader.is("reverse", _ctx.popperVisible)
  12751. ]),
  12752. onClick: _cache[0] || (_cache[0] = withModifiers(($event) => _ctx.togglePopperVisible(), ["stop"]))
  12753. }, {
  12754. default: withCtx(() => [
  12755. createVNode(_component_arrow_down)
  12756. ]),
  12757. _: 1
  12758. }, 8, ["class"]))
  12759. ]),
  12760. _: 1
  12761. }, 8, ["modelValue", "placeholder", "readonly", "disabled", "size", "class", "onCompositionstart", "onCompositionupdate", "onCompositionend", "onInput"]),
  12762. _ctx.multiple ? (openBlock(), createElementBlock("div", {
  12763. key: 0,
  12764. ref: "tagWrapper",
  12765. class: normalizeClass(_ctx.nsCascader.e("tags"))
  12766. }, [
  12767. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.presentTags, (tag) => {
  12768. return openBlock(), createBlock(_component_el_tag, {
  12769. key: tag.key,
  12770. type: _ctx.tagType,
  12771. size: _ctx.tagSize,
  12772. hit: tag.hitState,
  12773. closable: tag.closable,
  12774. "disable-transitions": "",
  12775. onClose: ($event) => _ctx.deleteTag(tag)
  12776. }, {
  12777. default: withCtx(() => [
  12778. tag.isCollapseTag === false ? (openBlock(), createElementBlock("span", _hoisted_1$r, toDisplayString(tag.text), 1)) : (openBlock(), createBlock(_component_el_tooltip, {
  12779. key: 1,
  12780. teleported: false,
  12781. disabled: _ctx.popperVisible || !_ctx.collapseTagsTooltip,
  12782. "fallback-placements": ["bottom", "top", "right", "left"],
  12783. placement: "bottom",
  12784. effect: "light"
  12785. }, {
  12786. default: withCtx(() => [
  12787. createElementVNode("span", null, toDisplayString(tag.text), 1)
  12788. ]),
  12789. content: withCtx(() => [
  12790. createElementVNode("div", _hoisted_2$k, [
  12791. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.allPresentTags, (tag2, idx) => {
  12792. return openBlock(), createElementBlock("div", {
  12793. key: idx,
  12794. class: "el-cascader__collapse-tag"
  12795. }, [
  12796. (openBlock(), createBlock(_component_el_tag, {
  12797. key: tag2.key,
  12798. class: "in-tooltip",
  12799. type: _ctx.tagType,
  12800. size: _ctx.tagSize,
  12801. hit: tag2.hitState,
  12802. closable: tag2.closable,
  12803. "disable-transitions": "",
  12804. onClose: ($event) => _ctx.deleteTag(tag2)
  12805. }, {
  12806. default: withCtx(() => [
  12807. createElementVNode("span", null, toDisplayString(tag2.text), 1)
  12808. ]),
  12809. _: 2
  12810. }, 1032, ["type", "size", "hit", "closable", "onClose"]))
  12811. ]);
  12812. }), 128))
  12813. ])
  12814. ]),
  12815. _: 2
  12816. }, 1032, ["disabled"]))
  12817. ]),
  12818. _: 2
  12819. }, 1032, ["type", "size", "hit", "closable", "onClose"]);
  12820. }), 128)),
  12821. _ctx.filterable && !_ctx.isDisabled ? withDirectives((openBlock(), createElementBlock("input", {
  12822. key: 0,
  12823. "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => _ctx.searchInputValue = $event),
  12824. type: "text",
  12825. class: normalizeClass(_ctx.nsCascader.e("search-input")),
  12826. placeholder: _ctx.presentText ? "" : _ctx.inputPlaceholder,
  12827. onInput: _cache[5] || (_cache[5] = (e) => _ctx.handleInput(_ctx.searchInputValue, e)),
  12828. onClick: _cache[6] || (_cache[6] = withModifiers(($event) => _ctx.togglePopperVisible(true), ["stop"])),
  12829. onKeydown: _cache[7] || (_cache[7] = withKeys((...args) => _ctx.handleDelete && _ctx.handleDelete(...args), ["delete"])),
  12830. onCompositionstart: _cache[8] || (_cache[8] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args)),
  12831. onCompositionupdate: _cache[9] || (_cache[9] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args)),
  12832. onCompositionend: _cache[10] || (_cache[10] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args))
  12833. }, null, 42, _hoisted_3$e)), [
  12834. [vModelText, _ctx.searchInputValue]
  12835. ]) : createCommentVNode("v-if", true)
  12836. ], 2)) : createCommentVNode("v-if", true)
  12837. ], 38)), [
  12838. [_directive_clickoutside, () => _ctx.togglePopperVisible(false), _ctx.popperPaneRef]
  12839. ])
  12840. ]),
  12841. content: withCtx(() => [
  12842. withDirectives(createVNode(_component_el_cascader_panel, {
  12843. ref: "panel",
  12844. modelValue: _ctx.checkedValue,
  12845. "onUpdate:modelValue": _cache[15] || (_cache[15] = ($event) => _ctx.checkedValue = $event),
  12846. options: _ctx.options,
  12847. props: _ctx.props,
  12848. border: false,
  12849. "render-label": _ctx.$slots.default,
  12850. onExpandChange: _ctx.handleExpandChange,
  12851. onClose: _cache[16] || (_cache[16] = ($event) => _ctx.$nextTick(() => _ctx.togglePopperVisible(false)))
  12852. }, null, 8, ["modelValue", "options", "props", "render-label", "onExpandChange"]), [
  12853. [vShow, !_ctx.filtering]
  12854. ]),
  12855. _ctx.filterable ? withDirectives((openBlock(), createBlock(_component_el_scrollbar, {
  12856. key: 0,
  12857. ref: "suggestionPanel",
  12858. tag: "ul",
  12859. class: normalizeClass(_ctx.nsCascader.e("suggestion-panel")),
  12860. "view-class": _ctx.nsCascader.e("suggestion-list"),
  12861. onKeydown: _ctx.handleSuggestionKeyDown
  12862. }, {
  12863. default: withCtx(() => [
  12864. _ctx.suggestions.length ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(_ctx.suggestions, (item) => {
  12865. return openBlock(), createElementBlock("li", {
  12866. key: item.uid,
  12867. class: normalizeClass([
  12868. _ctx.nsCascader.e("suggestion-item"),
  12869. _ctx.nsCascader.is("checked", item.checked)
  12870. ]),
  12871. tabindex: -1,
  12872. onClick: ($event) => _ctx.handleSuggestionClick(item)
  12873. }, [
  12874. createElementVNode("span", null, toDisplayString(item.text), 1),
  12875. item.checked ? (openBlock(), createBlock(_component_el_icon, { key: 0 }, {
  12876. default: withCtx(() => [
  12877. createVNode(_component_check)
  12878. ]),
  12879. _: 1
  12880. })) : createCommentVNode("v-if", true)
  12881. ], 10, _hoisted_4$c);
  12882. }), 128)) : renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [
  12883. createElementVNode("li", {
  12884. class: normalizeClass(_ctx.nsCascader.e("empty-text"))
  12885. }, toDisplayString(_ctx.t("el.cascader.noMatch")), 3)
  12886. ])
  12887. ]),
  12888. _: 3
  12889. }, 8, ["class", "view-class", "onKeydown"])), [
  12890. [vShow, _ctx.filtering]
  12891. ]) : createCommentVNode("v-if", true)
  12892. ]),
  12893. _: 3
  12894. }, 8, ["visible", "teleported", "popper-class", "popper-options", "transition", "onHide"]);
  12895. }
  12896. var Cascader = /* @__PURE__ */ _export_sfc$1(_sfc_main$E, [["render", _sfc_render$k], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/cascader/src/index.vue"]]);
  12897. Cascader.install = (app) => {
  12898. app.component(Cascader.name, Cascader);
  12899. };
  12900. const _Cascader = Cascader;
  12901. const ElCascader = _Cascader;
  12902. const messageConfig = {};
  12903. const configProviderProps = buildProps({
  12904. a11y: {
  12905. type: Boolean,
  12906. default: true
  12907. },
  12908. locale: {
  12909. type: definePropType(Object)
  12910. },
  12911. size: {
  12912. type: String,
  12913. values: componentSizes,
  12914. default: ""
  12915. },
  12916. button: {
  12917. type: definePropType(Object)
  12918. },
  12919. experimentalFeatures: {
  12920. type: definePropType(Object)
  12921. },
  12922. keyboardNavigation: {
  12923. type: Boolean,
  12924. default: true
  12925. },
  12926. message: {
  12927. type: definePropType(Object)
  12928. },
  12929. zIndex: {
  12930. type: Number
  12931. },
  12932. namespace: {
  12933. type: String,
  12934. default: "el"
  12935. }
  12936. });
  12937. var ConfigProvider = defineComponent({
  12938. name: "ElConfigProvider",
  12939. props: configProviderProps,
  12940. setup(props, { slots }) {
  12941. watch(() => props.message, (val) => {
  12942. Object.assign(messageConfig, val != null ? val : {});
  12943. }, { immediate: true, deep: true });
  12944. const config = provideGlobalConfig(props);
  12945. return () => renderSlot(slots, "default", { config: config == null ? void 0 : config.value });
  12946. }
  12947. });
  12948. const ElConfigProvider = withInstall(ConfigProvider);
  12949. var advancedFormat$1 = { exports: {} };
  12950. (function(module2, exports2) {
  12951. !function(e, t) {
  12952. module2.exports = t();
  12953. }(commonjsGlobal, function() {
  12954. return function(e, t, r) {
  12955. var n = t.prototype, s2 = n.format;
  12956. r.en.ordinal = function(e2) {
  12957. var t2 = ["th", "st", "nd", "rd"], r2 = e2 % 100;
  12958. return "[" + e2 + (t2[(r2 - 20) % 10] || t2[r2] || t2[0]) + "]";
  12959. }, n.format = function(e2) {
  12960. var t2 = this, r2 = this.$locale();
  12961. if (!this.isValid())
  12962. return s2.bind(this)(e2);
  12963. var n2 = this.$utils(), a2 = (e2 || "YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g, function(e3) {
  12964. switch (e3) {
  12965. case "Q":
  12966. return Math.ceil((t2.$M + 1) / 3);
  12967. case "Do":
  12968. return r2.ordinal(t2.$D);
  12969. case "gggg":
  12970. return t2.weekYear();
  12971. case "GGGG":
  12972. return t2.isoWeekYear();
  12973. case "wo":
  12974. return r2.ordinal(t2.week(), "W");
  12975. case "w":
  12976. case "ww":
  12977. return n2.s(t2.week(), e3 === "w" ? 1 : 2, "0");
  12978. case "W":
  12979. case "WW":
  12980. return n2.s(t2.isoWeek(), e3 === "W" ? 1 : 2, "0");
  12981. case "k":
  12982. case "kk":
  12983. return n2.s(String(t2.$H === 0 ? 24 : t2.$H), e3 === "k" ? 1 : 2, "0");
  12984. case "X":
  12985. return Math.floor(t2.$d.getTime() / 1e3);
  12986. case "x":
  12987. return t2.$d.getTime();
  12988. case "z":
  12989. return "[" + t2.offsetName() + "]";
  12990. case "zzz":
  12991. return "[" + t2.offsetName("long") + "]";
  12992. default:
  12993. return e3;
  12994. }
  12995. });
  12996. return s2.bind(this)(a2);
  12997. };
  12998. };
  12999. });
  13000. })(advancedFormat$1);
  13001. var advancedFormat = advancedFormat$1.exports;
  13002. var weekOfYear$1 = { exports: {} };
  13003. (function(module2, exports2) {
  13004. !function(e, t) {
  13005. module2.exports = t();
  13006. }(commonjsGlobal, function() {
  13007. var e = "week", t = "year";
  13008. return function(i, n, r) {
  13009. var f = n.prototype;
  13010. f.week = function(i2) {
  13011. if (i2 === void 0 && (i2 = null), i2 !== null)
  13012. return this.add(7 * (i2 - this.week()), "day");
  13013. var n2 = this.$locale().yearStart || 1;
  13014. if (this.month() === 11 && this.date() > 25) {
  13015. var f2 = r(this).startOf(t).add(1, t).date(n2), s2 = r(this).endOf(e);
  13016. if (f2.isBefore(s2))
  13017. return 1;
  13018. }
  13019. var a2 = r(this).startOf(t).date(n2).startOf(e).subtract(1, "millisecond"), o2 = this.diff(a2, e, true);
  13020. return o2 < 0 ? r(this).startOf("week").week() : Math.ceil(o2);
  13021. }, f.weeks = function(e2) {
  13022. return e2 === void 0 && (e2 = null), this.week(e2);
  13023. };
  13024. };
  13025. });
  13026. })(weekOfYear$1);
  13027. var weekOfYear = weekOfYear$1.exports;
  13028. var weekYear$1 = { exports: {} };
  13029. (function(module2, exports2) {
  13030. !function(e, t) {
  13031. module2.exports = t();
  13032. }(commonjsGlobal, function() {
  13033. return function(e, t) {
  13034. t.prototype.weekYear = function() {
  13035. var e2 = this.month(), t2 = this.week(), n = this.year();
  13036. return t2 === 1 && e2 === 11 ? n + 1 : e2 === 0 && t2 >= 52 ? n - 1 : n;
  13037. };
  13038. };
  13039. });
  13040. })(weekYear$1);
  13041. var weekYear = weekYear$1.exports;
  13042. var dayOfYear$1 = { exports: {} };
  13043. (function(module2, exports2) {
  13044. !function(e, t) {
  13045. module2.exports = t();
  13046. }(commonjsGlobal, function() {
  13047. return function(e, t, n) {
  13048. t.prototype.dayOfYear = function(e2) {
  13049. var t2 = Math.round((n(this).startOf("day") - n(this).startOf("year")) / 864e5) + 1;
  13050. return e2 == null ? t2 : this.add(e2 - t2, "day");
  13051. };
  13052. };
  13053. });
  13054. })(dayOfYear$1);
  13055. var dayOfYear = dayOfYear$1.exports;
  13056. var isSameOrAfter$1 = { exports: {} };
  13057. (function(module2, exports2) {
  13058. !function(e, t) {
  13059. module2.exports = t();
  13060. }(commonjsGlobal, function() {
  13061. return function(e, t) {
  13062. t.prototype.isSameOrAfter = function(e2, t2) {
  13063. return this.isSame(e2, t2) || this.isAfter(e2, t2);
  13064. };
  13065. };
  13066. });
  13067. })(isSameOrAfter$1);
  13068. var isSameOrAfter = isSameOrAfter$1.exports;
  13069. var isSameOrBefore$1 = { exports: {} };
  13070. (function(module2, exports2) {
  13071. !function(e, i) {
  13072. module2.exports = i();
  13073. }(commonjsGlobal, function() {
  13074. return function(e, i) {
  13075. i.prototype.isSameOrBefore = function(e2, i2) {
  13076. return this.isSame(e2, i2) || this.isBefore(e2, i2);
  13077. };
  13078. };
  13079. });
  13080. })(isSameOrBefore$1);
  13081. var isSameOrBefore = isSameOrBefore$1.exports;
  13082. const ROOT_PICKER_INJECTION_KEY = Symbol();
  13083. var ElDatePickerCell = defineComponent({
  13084. name: "ElDatePickerCell",
  13085. props: buildProps({
  13086. cell: {
  13087. type: definePropType(Object)
  13088. }
  13089. }),
  13090. setup(props) {
  13091. const picker = inject(ROOT_PICKER_INJECTION_KEY);
  13092. return () => {
  13093. const cell = props.cell;
  13094. if (picker == null ? void 0 : picker.ctx.slots.default) {
  13095. const list = picker.ctx.slots.default(cell).filter((item) => {
  13096. return item.patchFlag !== -2 && item.type.toString() !== "Symbol(Comment)";
  13097. });
  13098. if (list.length) {
  13099. return list;
  13100. }
  13101. }
  13102. return h$1("div", {
  13103. class: "el-date-table-cell"
  13104. }, [
  13105. h$1("span", {
  13106. class: "el-date-table-cell__text"
  13107. }, [cell == null ? void 0 : cell.text])
  13108. ]);
  13109. };
  13110. }
  13111. });
  13112. const _sfc_main$D = defineComponent({
  13113. components: {
  13114. ElDatePickerCell
  13115. },
  13116. props: {
  13117. date: {
  13118. type: Object
  13119. },
  13120. minDate: {
  13121. type: Object
  13122. },
  13123. maxDate: {
  13124. type: Object
  13125. },
  13126. parsedValue: {
  13127. type: [Object, Array]
  13128. },
  13129. selectionMode: {
  13130. type: String,
  13131. default: "day"
  13132. },
  13133. showWeekNumber: {
  13134. type: Boolean,
  13135. default: false
  13136. },
  13137. disabledDate: {
  13138. type: Function
  13139. },
  13140. cellClassName: {
  13141. type: Function
  13142. },
  13143. rangeState: {
  13144. type: Object,
  13145. default: () => ({
  13146. endDate: null,
  13147. selecting: false
  13148. })
  13149. }
  13150. },
  13151. emits: ["changerange", "pick", "select"],
  13152. setup(props, ctx) {
  13153. const { t, lang } = useLocale();
  13154. const lastRow = ref(null);
  13155. const lastColumn = ref(null);
  13156. const tableRows = ref([[], [], [], [], [], []]);
  13157. const firstDayOfWeek = props.date.$locale().weekStart || 7;
  13158. const WEEKS_CONSTANT = props.date.locale("en").localeData().weekdaysShort().map((_2) => _2.toLowerCase());
  13159. const offsetDay = computed(() => {
  13160. return firstDayOfWeek > 3 ? 7 - firstDayOfWeek : -firstDayOfWeek;
  13161. });
  13162. const startDate = computed(() => {
  13163. const startDayOfMonth = props.date.startOf("month");
  13164. return startDayOfMonth.subtract(startDayOfMonth.day() || 7, "day");
  13165. });
  13166. const WEEKS = computed(() => {
  13167. return WEEKS_CONSTANT.concat(WEEKS_CONSTANT).slice(firstDayOfWeek, firstDayOfWeek + 7);
  13168. });
  13169. const rows = computed(() => {
  13170. var _a2;
  13171. const startOfMonth = props.date.startOf("month");
  13172. const startOfMonthDay = startOfMonth.day() || 7;
  13173. const dateCountOfMonth = startOfMonth.daysInMonth();
  13174. const dateCountOfLastMonth = startOfMonth.subtract(1, "month").daysInMonth();
  13175. const offset2 = offsetDay.value;
  13176. const rows_ = tableRows.value;
  13177. let count = 1;
  13178. const selectedDate = props.selectionMode === "dates" ? castArray(props.parsedValue) : [];
  13179. const calNow = dayjs().locale(lang.value).startOf("day");
  13180. for (let i = 0; i < 6; i++) {
  13181. const row = rows_[i];
  13182. if (props.showWeekNumber) {
  13183. if (!row[0]) {
  13184. row[0] = {
  13185. type: "week",
  13186. text: startDate.value.add(i * 7 + 1, "day").week()
  13187. };
  13188. }
  13189. }
  13190. for (let j = 0; j < 7; j++) {
  13191. let cell = row[props.showWeekNumber ? j + 1 : j];
  13192. if (!cell) {
  13193. cell = {
  13194. row: i,
  13195. column: j,
  13196. type: "normal",
  13197. inRange: false,
  13198. start: false,
  13199. end: false
  13200. };
  13201. }
  13202. const index = i * 7 + j;
  13203. const calTime = startDate.value.add(index - offset2, "day");
  13204. cell.dayjs = calTime;
  13205. cell.date = calTime.toDate();
  13206. cell.timestamp = calTime.valueOf();
  13207. cell.type = "normal";
  13208. const calEndDate = props.rangeState.endDate || props.maxDate || props.rangeState.selecting && props.minDate;
  13209. cell.inRange = props.minDate && calTime.isSameOrAfter(props.minDate, "day") && calEndDate && calTime.isSameOrBefore(calEndDate, "day") || props.minDate && calTime.isSameOrBefore(props.minDate, "day") && calEndDate && calTime.isSameOrAfter(calEndDate, "day");
  13210. if ((_a2 = props.minDate) == null ? void 0 : _a2.isSameOrAfter(calEndDate)) {
  13211. cell.start = calEndDate && calTime.isSame(calEndDate, "day");
  13212. cell.end = props.minDate && calTime.isSame(props.minDate, "day");
  13213. } else {
  13214. cell.start = props.minDate && calTime.isSame(props.minDate, "day");
  13215. cell.end = calEndDate && calTime.isSame(calEndDate, "day");
  13216. }
  13217. const isToday = calTime.isSame(calNow, "day");
  13218. if (isToday) {
  13219. cell.type = "today";
  13220. }
  13221. if (i >= 0 && i <= 1) {
  13222. const numberOfDaysFromPreviousMonth = startOfMonthDay + offset2 < 0 ? 7 + startOfMonthDay + offset2 : startOfMonthDay + offset2;
  13223. if (j + i * 7 >= numberOfDaysFromPreviousMonth) {
  13224. cell.text = count++;
  13225. } else {
  13226. cell.text = dateCountOfLastMonth - (numberOfDaysFromPreviousMonth - j % 7) + 1 + i * 7;
  13227. cell.type = "prev-month";
  13228. }
  13229. } else {
  13230. if (count <= dateCountOfMonth) {
  13231. cell.text = count++;
  13232. } else {
  13233. cell.text = count++ - dateCountOfMonth;
  13234. cell.type = "next-month";
  13235. }
  13236. }
  13237. const cellDate = calTime.toDate();
  13238. cell.selected = selectedDate.find((_2) => _2.valueOf() === calTime.valueOf());
  13239. cell.isSelected = !!cell.selected;
  13240. cell.isCurrent = isCurrent(cell);
  13241. cell.disabled = props.disabledDate && props.disabledDate(cellDate);
  13242. cell.customClass = props.cellClassName && props.cellClassName(cellDate);
  13243. row[props.showWeekNumber ? j + 1 : j] = cell;
  13244. }
  13245. if (props.selectionMode === "week") {
  13246. const start2 = props.showWeekNumber ? 1 : 0;
  13247. const end2 = props.showWeekNumber ? 7 : 6;
  13248. const isActive = isWeekActive(row[start2 + 1]);
  13249. row[start2].inRange = isActive;
  13250. row[start2].start = isActive;
  13251. row[end2].inRange = isActive;
  13252. row[end2].end = isActive;
  13253. }
  13254. }
  13255. return rows_;
  13256. });
  13257. const isCurrent = (cell) => {
  13258. return props.selectionMode === "day" && (cell.type === "normal" || cell.type === "today") && cellMatchesDate(cell, props.parsedValue);
  13259. };
  13260. const cellMatchesDate = (cell, date4) => {
  13261. if (!date4)
  13262. return false;
  13263. return dayjs(date4).locale(lang.value).isSame(props.date.date(Number(cell.text)), "day");
  13264. };
  13265. const getCellClasses = (cell) => {
  13266. const classes = [];
  13267. if ((cell.type === "normal" || cell.type === "today") && !cell.disabled) {
  13268. classes.push("available");
  13269. if (cell.type === "today") {
  13270. classes.push("today");
  13271. }
  13272. } else {
  13273. classes.push(cell.type);
  13274. }
  13275. if (isCurrent(cell)) {
  13276. classes.push("current");
  13277. }
  13278. if (cell.inRange && (cell.type === "normal" || cell.type === "today" || props.selectionMode === "week")) {
  13279. classes.push("in-range");
  13280. if (cell.start) {
  13281. classes.push("start-date");
  13282. }
  13283. if (cell.end) {
  13284. classes.push("end-date");
  13285. }
  13286. }
  13287. if (cell.disabled) {
  13288. classes.push("disabled");
  13289. }
  13290. if (cell.selected) {
  13291. classes.push("selected");
  13292. }
  13293. if (cell.customClass) {
  13294. classes.push(cell.customClass);
  13295. }
  13296. return classes.join(" ");
  13297. };
  13298. const getDateOfCell = (row, column) => {
  13299. const offsetFromStart = row * 7 + (column - (props.showWeekNumber ? 1 : 0)) - offsetDay.value;
  13300. return startDate.value.add(offsetFromStart, "day");
  13301. };
  13302. const handleMouseMove = (event) => {
  13303. if (!props.rangeState.selecting)
  13304. return;
  13305. let target = event.target;
  13306. if (target.tagName === "SPAN") {
  13307. target = target.parentNode.parentNode;
  13308. }
  13309. if (target.tagName === "DIV") {
  13310. target = target.parentNode;
  13311. }
  13312. if (target.tagName !== "TD")
  13313. return;
  13314. const row = target.parentNode.rowIndex - 1;
  13315. const column = target.cellIndex;
  13316. if (rows.value[row][column].disabled)
  13317. return;
  13318. if (row !== lastRow.value || column !== lastColumn.value) {
  13319. lastRow.value = row;
  13320. lastColumn.value = column;
  13321. ctx.emit("changerange", {
  13322. selecting: true,
  13323. endDate: getDateOfCell(row, column)
  13324. });
  13325. }
  13326. };
  13327. const handleClick = (event) => {
  13328. let target = event.target;
  13329. while (target) {
  13330. if (target.tagName === "TD") {
  13331. break;
  13332. }
  13333. target = target.parentNode;
  13334. }
  13335. if (!target || target.tagName !== "TD")
  13336. return;
  13337. const row = target.parentNode.rowIndex - 1;
  13338. const column = target.cellIndex;
  13339. const cell = rows.value[row][column];
  13340. if (cell.disabled || cell.type === "week")
  13341. return;
  13342. const newDate = getDateOfCell(row, column);
  13343. if (props.selectionMode === "range") {
  13344. if (!props.rangeState.selecting) {
  13345. ctx.emit("pick", { minDate: newDate, maxDate: null });
  13346. ctx.emit("select", true);
  13347. } else {
  13348. if (newDate >= props.minDate) {
  13349. ctx.emit("pick", { minDate: props.minDate, maxDate: newDate });
  13350. } else {
  13351. ctx.emit("pick", { minDate: newDate, maxDate: props.minDate });
  13352. }
  13353. ctx.emit("select", false);
  13354. }
  13355. } else if (props.selectionMode === "day") {
  13356. ctx.emit("pick", newDate);
  13357. } else if (props.selectionMode === "week") {
  13358. const weekNumber = newDate.week();
  13359. const value = `${newDate.year()}w${weekNumber}`;
  13360. ctx.emit("pick", {
  13361. year: newDate.year(),
  13362. week: weekNumber,
  13363. value,
  13364. date: newDate.startOf("week")
  13365. });
  13366. } else if (props.selectionMode === "dates") {
  13367. const newValue = cell.selected ? castArray(props.parsedValue).filter((_2) => _2.valueOf() !== newDate.valueOf()) : castArray(props.parsedValue).concat([newDate]);
  13368. ctx.emit("pick", newValue);
  13369. }
  13370. };
  13371. const isWeekActive = (cell) => {
  13372. if (props.selectionMode !== "week")
  13373. return false;
  13374. let newDate = props.date.startOf("day");
  13375. if (cell.type === "prev-month") {
  13376. newDate = newDate.subtract(1, "month");
  13377. }
  13378. if (cell.type === "next-month") {
  13379. newDate = newDate.add(1, "month");
  13380. }
  13381. newDate = newDate.date(Number.parseInt(cell.text, 10));
  13382. if (props.parsedValue && !Array.isArray(props.parsedValue)) {
  13383. const dayOffset = (props.parsedValue.day() - firstDayOfWeek + 7) % 7 - 1;
  13384. const weekDate = props.parsedValue.subtract(dayOffset, "day");
  13385. return weekDate.isSame(newDate, "day");
  13386. }
  13387. return false;
  13388. };
  13389. return {
  13390. handleMouseMove,
  13391. t,
  13392. rows,
  13393. isWeekActive,
  13394. getCellClasses,
  13395. WEEKS,
  13396. handleClick
  13397. };
  13398. }
  13399. });
  13400. const _hoisted_1$q = { key: 0 };
  13401. function _sfc_render$j(_ctx, _cache, $props, $setup, $data, $options) {
  13402. const _component_el_date_picker_cell = resolveComponent("el-date-picker-cell");
  13403. return openBlock(), createElementBlock("table", {
  13404. cellspacing: "0",
  13405. cellpadding: "0",
  13406. class: normalizeClass(["el-date-table", { "is-week-mode": _ctx.selectionMode === "week" }]),
  13407. onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleClick && _ctx.handleClick(...args)),
  13408. onMousemove: _cache[1] || (_cache[1] = (...args) => _ctx.handleMouseMove && _ctx.handleMouseMove(...args))
  13409. }, [
  13410. createElementVNode("tbody", null, [
  13411. createElementVNode("tr", null, [
  13412. _ctx.showWeekNumber ? (openBlock(), createElementBlock("th", _hoisted_1$q, toDisplayString(_ctx.t("el.datepicker.week")), 1)) : createCommentVNode("v-if", true),
  13413. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.WEEKS, (week, key) => {
  13414. return openBlock(), createElementBlock("th", { key }, toDisplayString(_ctx.t("el.datepicker.weeks." + week)), 1);
  13415. }), 128))
  13416. ]),
  13417. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.rows, (row, key) => {
  13418. return openBlock(), createElementBlock("tr", {
  13419. key,
  13420. class: normalizeClass(["el-date-table__row", { current: _ctx.isWeekActive(row[1]) }])
  13421. }, [
  13422. (openBlock(true), createElementBlock(Fragment, null, renderList(row, (cell, key_) => {
  13423. return openBlock(), createElementBlock("td", {
  13424. key: key_,
  13425. class: normalizeClass(_ctx.getCellClasses(cell))
  13426. }, [
  13427. createVNode(_component_el_date_picker_cell, { cell }, null, 8, ["cell"])
  13428. ], 2);
  13429. }), 128))
  13430. ], 2);
  13431. }), 128))
  13432. ])
  13433. ], 34);
  13434. }
  13435. var DateTable = /* @__PURE__ */ _export_sfc$1(_sfc_main$D, [["render", _sfc_render$j], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/date-picker/src/date-picker-com/basic-date-table.vue"]]);
  13436. const datesInMonth = (year, month, lang) => {
  13437. const firstDay = dayjs().locale(lang).startOf("month").month(month).year(year);
  13438. const numOfDays = firstDay.daysInMonth();
  13439. return rangeArr(numOfDays).map((n) => firstDay.add(n, "day").toDate());
  13440. };
  13441. const _sfc_main$C = defineComponent({
  13442. props: {
  13443. disabledDate: {
  13444. type: Function
  13445. },
  13446. selectionMode: {
  13447. type: String,
  13448. default: "month"
  13449. },
  13450. minDate: {
  13451. type: Object
  13452. },
  13453. maxDate: {
  13454. type: Object
  13455. },
  13456. date: {
  13457. type: Object
  13458. },
  13459. parsedValue: {
  13460. type: Object
  13461. },
  13462. rangeState: {
  13463. type: Object,
  13464. default: () => ({
  13465. endDate: null,
  13466. selecting: false
  13467. })
  13468. }
  13469. },
  13470. emits: ["changerange", "pick", "select"],
  13471. setup(props, ctx) {
  13472. const { t, lang } = useLocale();
  13473. const months = ref(props.date.locale("en").localeData().monthsShort().map((_2) => _2.toLowerCase()));
  13474. const tableRows = ref([[], [], []]);
  13475. const lastRow = ref(null);
  13476. const lastColumn = ref(null);
  13477. const rows = computed(() => {
  13478. var _a2;
  13479. const rows2 = tableRows.value;
  13480. const now2 = dayjs().locale(lang.value).startOf("month");
  13481. for (let i = 0; i < 3; i++) {
  13482. const row = rows2[i];
  13483. for (let j = 0; j < 4; j++) {
  13484. let cell = row[j];
  13485. if (!cell) {
  13486. cell = {
  13487. row: i,
  13488. column: j,
  13489. type: "normal",
  13490. inRange: false,
  13491. start: false,
  13492. end: false
  13493. };
  13494. }
  13495. cell.type = "normal";
  13496. const index = i * 4 + j;
  13497. const calTime = props.date.startOf("year").month(index);
  13498. const calEndDate = props.rangeState.endDate || props.maxDate || props.rangeState.selecting && props.minDate;
  13499. cell.inRange = props.minDate && calTime.isSameOrAfter(props.minDate, "month") && calEndDate && calTime.isSameOrBefore(calEndDate, "month") || props.minDate && calTime.isSameOrBefore(props.minDate, "month") && calEndDate && calTime.isSameOrAfter(calEndDate, "month");
  13500. if ((_a2 = props.minDate) == null ? void 0 : _a2.isSameOrAfter(calEndDate)) {
  13501. cell.start = calEndDate && calTime.isSame(calEndDate, "month");
  13502. cell.end = props.minDate && calTime.isSame(props.minDate, "month");
  13503. } else {
  13504. cell.start = props.minDate && calTime.isSame(props.minDate, "month");
  13505. cell.end = calEndDate && calTime.isSame(calEndDate, "month");
  13506. }
  13507. const isToday = now2.isSame(calTime);
  13508. if (isToday) {
  13509. cell.type = "today";
  13510. }
  13511. cell.text = index;
  13512. const cellDate = calTime.toDate();
  13513. cell.disabled = props.disabledDate && props.disabledDate(cellDate);
  13514. row[j] = cell;
  13515. }
  13516. }
  13517. return rows2;
  13518. });
  13519. const getCellStyle = (cell) => {
  13520. const style = {};
  13521. const year = props.date.year();
  13522. const today = new Date();
  13523. const month = cell.text;
  13524. style.disabled = props.disabledDate ? datesInMonth(year, month, lang.value).every(props.disabledDate) : false;
  13525. style.current = castArray(props.parsedValue).findIndex((date4) => date4.year() === year && date4.month() === month) >= 0;
  13526. style.today = today.getFullYear() === year && today.getMonth() === month;
  13527. if (cell.inRange) {
  13528. style["in-range"] = true;
  13529. if (cell.start) {
  13530. style["start-date"] = true;
  13531. }
  13532. if (cell.end) {
  13533. style["end-date"] = true;
  13534. }
  13535. }
  13536. return style;
  13537. };
  13538. const handleMouseMove = (event) => {
  13539. if (!props.rangeState.selecting)
  13540. return;
  13541. let target = event.target;
  13542. if (target.tagName === "A") {
  13543. target = target.parentNode.parentNode;
  13544. }
  13545. if (target.tagName === "DIV") {
  13546. target = target.parentNode;
  13547. }
  13548. if (target.tagName !== "TD")
  13549. return;
  13550. const row = target.parentNode.rowIndex;
  13551. const column = target.cellIndex;
  13552. if (rows.value[row][column].disabled)
  13553. return;
  13554. if (row !== lastRow.value || column !== lastColumn.value) {
  13555. lastRow.value = row;
  13556. lastColumn.value = column;
  13557. ctx.emit("changerange", {
  13558. selecting: true,
  13559. endDate: props.date.startOf("year").month(row * 4 + column)
  13560. });
  13561. }
  13562. };
  13563. const handleMonthTableClick = (event) => {
  13564. let target = event.target;
  13565. if (target.tagName === "A") {
  13566. target = target.parentNode.parentNode;
  13567. }
  13568. if (target.tagName === "DIV") {
  13569. target = target.parentNode;
  13570. }
  13571. if (target.tagName !== "TD")
  13572. return;
  13573. if (hasClass(target, "disabled"))
  13574. return;
  13575. const column = target.cellIndex;
  13576. const row = target.parentNode.rowIndex;
  13577. const month = row * 4 + column;
  13578. const newDate = props.date.startOf("year").month(month);
  13579. if (props.selectionMode === "range") {
  13580. if (!props.rangeState.selecting) {
  13581. ctx.emit("pick", { minDate: newDate, maxDate: null });
  13582. ctx.emit("select", true);
  13583. } else {
  13584. if (newDate >= props.minDate) {
  13585. ctx.emit("pick", { minDate: props.minDate, maxDate: newDate });
  13586. } else {
  13587. ctx.emit("pick", { minDate: newDate, maxDate: props.minDate });
  13588. }
  13589. ctx.emit("select", false);
  13590. }
  13591. } else {
  13592. ctx.emit("pick", month);
  13593. }
  13594. };
  13595. return {
  13596. handleMouseMove,
  13597. handleMonthTableClick,
  13598. rows,
  13599. getCellStyle,
  13600. t,
  13601. months
  13602. };
  13603. }
  13604. });
  13605. const _hoisted_1$p = { class: "cell" };
  13606. function _sfc_render$i(_ctx, _cache, $props, $setup, $data, $options) {
  13607. return openBlock(), createElementBlock("table", {
  13608. class: "el-month-table",
  13609. onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleMonthTableClick && _ctx.handleMonthTableClick(...args)),
  13610. onMousemove: _cache[1] || (_cache[1] = (...args) => _ctx.handleMouseMove && _ctx.handleMouseMove(...args))
  13611. }, [
  13612. createElementVNode("tbody", null, [
  13613. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.rows, (row, key) => {
  13614. return openBlock(), createElementBlock("tr", { key }, [
  13615. (openBlock(true), createElementBlock(Fragment, null, renderList(row, (cell, key_) => {
  13616. return openBlock(), createElementBlock("td", {
  13617. key: key_,
  13618. class: normalizeClass(_ctx.getCellStyle(cell))
  13619. }, [
  13620. createElementVNode("div", null, [
  13621. createElementVNode("a", _hoisted_1$p, toDisplayString(_ctx.t("el.datepicker.months." + _ctx.months[cell.text])), 1)
  13622. ])
  13623. ], 2);
  13624. }), 128))
  13625. ]);
  13626. }), 128))
  13627. ])
  13628. ], 32);
  13629. }
  13630. var MonthTable = /* @__PURE__ */ _export_sfc$1(_sfc_main$C, [["render", _sfc_render$i], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/date-picker/src/date-picker-com/basic-month-table.vue"]]);
  13631. const datesInYear = (year, lang) => {
  13632. const firstDay = dayjs(String(year)).locale(lang).startOf("year");
  13633. const lastDay = firstDay.endOf("year");
  13634. const numOfDays = lastDay.dayOfYear();
  13635. return rangeArr(numOfDays).map((n) => firstDay.add(n, "day").toDate());
  13636. };
  13637. const _sfc_main$B = defineComponent({
  13638. props: {
  13639. disabledDate: {
  13640. type: Function
  13641. },
  13642. parsedValue: {
  13643. type: Object
  13644. },
  13645. date: {
  13646. type: Object
  13647. }
  13648. },
  13649. emits: ["pick"],
  13650. setup(props, ctx) {
  13651. const { lang } = useLocale();
  13652. const startYear = computed(() => {
  13653. return Math.floor(props.date.year() / 10) * 10;
  13654. });
  13655. const getCellStyle = (year) => {
  13656. const style = {};
  13657. const today = dayjs().locale(lang.value);
  13658. style.disabled = props.disabledDate ? datesInYear(year, lang.value).every(props.disabledDate) : false;
  13659. style.current = castArray(props.parsedValue).findIndex((_2) => _2.year() === year) >= 0;
  13660. style.today = today.year() === year;
  13661. return style;
  13662. };
  13663. const handleYearTableClick = (event) => {
  13664. const target = event.target;
  13665. if (target.tagName === "A") {
  13666. if (hasClass(target.parentNode, "disabled"))
  13667. return;
  13668. const year = target.textContent || target.innerText;
  13669. ctx.emit("pick", Number(year));
  13670. }
  13671. };
  13672. return {
  13673. startYear,
  13674. getCellStyle,
  13675. handleYearTableClick
  13676. };
  13677. }
  13678. });
  13679. const _hoisted_1$o = { class: "cell" };
  13680. const _hoisted_2$j = { class: "cell" };
  13681. const _hoisted_3$d = { class: "cell" };
  13682. const _hoisted_4$b = { class: "cell" };
  13683. const _hoisted_5$b = { class: "cell" };
  13684. const _hoisted_6$9 = { class: "cell" };
  13685. const _hoisted_7$6 = { class: "cell" };
  13686. const _hoisted_8$5 = { class: "cell" };
  13687. const _hoisted_9$5 = { class: "cell" };
  13688. const _hoisted_10$5 = { class: "cell" };
  13689. const _hoisted_11$4 = /* @__PURE__ */ createElementVNode("td", null, null, -1);
  13690. const _hoisted_12$4 = /* @__PURE__ */ createElementVNode("td", null, null, -1);
  13691. function _sfc_render$h(_ctx, _cache, $props, $setup, $data, $options) {
  13692. return openBlock(), createElementBlock("table", {
  13693. class: "el-year-table",
  13694. onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleYearTableClick && _ctx.handleYearTableClick(...args))
  13695. }, [
  13696. createElementVNode("tbody", null, [
  13697. createElementVNode("tr", null, [
  13698. createElementVNode("td", {
  13699. class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 0)])
  13700. }, [
  13701. createElementVNode("a", _hoisted_1$o, toDisplayString(_ctx.startYear), 1)
  13702. ], 2),
  13703. createElementVNode("td", {
  13704. class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 1)])
  13705. }, [
  13706. createElementVNode("a", _hoisted_2$j, toDisplayString(_ctx.startYear + 1), 1)
  13707. ], 2),
  13708. createElementVNode("td", {
  13709. class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 2)])
  13710. }, [
  13711. createElementVNode("a", _hoisted_3$d, toDisplayString(_ctx.startYear + 2), 1)
  13712. ], 2),
  13713. createElementVNode("td", {
  13714. class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 3)])
  13715. }, [
  13716. createElementVNode("a", _hoisted_4$b, toDisplayString(_ctx.startYear + 3), 1)
  13717. ], 2)
  13718. ]),
  13719. createElementVNode("tr", null, [
  13720. createElementVNode("td", {
  13721. class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 4)])
  13722. }, [
  13723. createElementVNode("a", _hoisted_5$b, toDisplayString(_ctx.startYear + 4), 1)
  13724. ], 2),
  13725. createElementVNode("td", {
  13726. class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 5)])
  13727. }, [
  13728. createElementVNode("a", _hoisted_6$9, toDisplayString(_ctx.startYear + 5), 1)
  13729. ], 2),
  13730. createElementVNode("td", {
  13731. class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 6)])
  13732. }, [
  13733. createElementVNode("a", _hoisted_7$6, toDisplayString(_ctx.startYear + 6), 1)
  13734. ], 2),
  13735. createElementVNode("td", {
  13736. class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 7)])
  13737. }, [
  13738. createElementVNode("a", _hoisted_8$5, toDisplayString(_ctx.startYear + 7), 1)
  13739. ], 2)
  13740. ]),
  13741. createElementVNode("tr", null, [
  13742. createElementVNode("td", {
  13743. class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 8)])
  13744. }, [
  13745. createElementVNode("a", _hoisted_9$5, toDisplayString(_ctx.startYear + 8), 1)
  13746. ], 2),
  13747. createElementVNode("td", {
  13748. class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 9)])
  13749. }, [
  13750. createElementVNode("a", _hoisted_10$5, toDisplayString(_ctx.startYear + 9), 1)
  13751. ], 2),
  13752. _hoisted_11$4,
  13753. _hoisted_12$4
  13754. ])
  13755. ])
  13756. ]);
  13757. }
  13758. var YearTable = /* @__PURE__ */ _export_sfc$1(_sfc_main$B, [["render", _sfc_render$h], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/date-picker/src/date-picker-com/basic-year-table.vue"]]);
  13759. const timeWithinRange = (_2, __, ___) => true;
  13760. const _sfc_main$A = defineComponent({
  13761. components: {
  13762. DateTable,
  13763. ElInput,
  13764. ElButton,
  13765. ElIcon,
  13766. TimePickPanel,
  13767. MonthTable,
  13768. YearTable,
  13769. DArrowLeft: dArrowLeft,
  13770. ArrowLeft: arrowLeft,
  13771. DArrowRight: dArrowRight,
  13772. ArrowRight: arrowRight
  13773. },
  13774. directives: { clickoutside: ClickOutside },
  13775. props: {
  13776. visible: {
  13777. type: Boolean,
  13778. default: false
  13779. },
  13780. parsedValue: {
  13781. type: [Object, Array]
  13782. },
  13783. format: {
  13784. type: String,
  13785. default: ""
  13786. },
  13787. type: {
  13788. type: String,
  13789. required: true,
  13790. validator: isValidDatePickType
  13791. }
  13792. },
  13793. emits: ["pick", "set-picker-option", "panel-change"],
  13794. setup(props, ctx) {
  13795. const { t, lang } = useLocale();
  13796. const pickerBase = inject("EP_PICKER_BASE");
  13797. const popper2 = inject(TOOLTIP_INJECTION_KEY);
  13798. const {
  13799. shortcuts,
  13800. disabledDate,
  13801. cellClassName,
  13802. defaultTime,
  13803. arrowControl
  13804. } = pickerBase.props;
  13805. const defaultValue = toRef(pickerBase.props, "defaultValue");
  13806. const innerDate = ref(dayjs().locale(lang.value));
  13807. const defaultTimeD = computed(() => {
  13808. return dayjs(defaultTime).locale(lang.value);
  13809. });
  13810. const month = computed(() => {
  13811. return innerDate.value.month();
  13812. });
  13813. const year = computed(() => {
  13814. return innerDate.value.year();
  13815. });
  13816. const selectableRange = ref([]);
  13817. const userInputDate = ref(null);
  13818. const userInputTime = ref(null);
  13819. const checkDateWithinRange = (date4) => {
  13820. return selectableRange.value.length > 0 ? timeWithinRange(date4, selectableRange.value, props.format || "HH:mm:ss") : true;
  13821. };
  13822. const formatEmit = (emitDayjs) => {
  13823. if (defaultTime && !visibleTime.value) {
  13824. return defaultTimeD.value.year(emitDayjs.year()).month(emitDayjs.month()).date(emitDayjs.date());
  13825. }
  13826. if (showTime.value)
  13827. return emitDayjs.millisecond(0);
  13828. return emitDayjs.startOf("day");
  13829. };
  13830. const emit = (value, ...args) => {
  13831. if (!value) {
  13832. ctx.emit("pick", value, ...args);
  13833. } else if (Array.isArray(value)) {
  13834. const dates = value.map(formatEmit);
  13835. ctx.emit("pick", dates, ...args);
  13836. } else {
  13837. ctx.emit("pick", formatEmit(value), ...args);
  13838. }
  13839. userInputDate.value = null;
  13840. userInputTime.value = null;
  13841. };
  13842. const handleDatePick = (value) => {
  13843. if (selectionMode.value === "day") {
  13844. let newDate = props.parsedValue ? props.parsedValue.year(value.year()).month(value.month()).date(value.date()) : value;
  13845. if (!checkDateWithinRange(newDate)) {
  13846. newDate = selectableRange.value[0][0].year(value.year()).month(value.month()).date(value.date());
  13847. }
  13848. innerDate.value = newDate;
  13849. emit(newDate, showTime.value);
  13850. } else if (selectionMode.value === "week") {
  13851. emit(value.date);
  13852. } else if (selectionMode.value === "dates") {
  13853. emit(value, true);
  13854. }
  13855. };
  13856. const prevMonth_ = () => {
  13857. innerDate.value = innerDate.value.subtract(1, "month");
  13858. handlePanelChange("month");
  13859. };
  13860. const nextMonth_ = () => {
  13861. innerDate.value = innerDate.value.add(1, "month");
  13862. handlePanelChange("month");
  13863. };
  13864. const prevYear_ = () => {
  13865. if (currentView.value === "year") {
  13866. innerDate.value = innerDate.value.subtract(10, "year");
  13867. } else {
  13868. innerDate.value = innerDate.value.subtract(1, "year");
  13869. }
  13870. handlePanelChange("year");
  13871. };
  13872. const nextYear_ = () => {
  13873. if (currentView.value === "year") {
  13874. innerDate.value = innerDate.value.add(10, "year");
  13875. } else {
  13876. innerDate.value = innerDate.value.add(1, "year");
  13877. }
  13878. handlePanelChange("year");
  13879. };
  13880. const currentView = ref("date");
  13881. const yearLabel = computed(() => {
  13882. const yearTranslation = t("el.datepicker.year");
  13883. if (currentView.value === "year") {
  13884. const startYear = Math.floor(year.value / 10) * 10;
  13885. if (yearTranslation) {
  13886. return `${startYear} ${yearTranslation} - ${startYear + 9} ${yearTranslation}`;
  13887. }
  13888. return `${startYear} - ${startYear + 9}`;
  13889. }
  13890. return `${year.value} ${yearTranslation}`;
  13891. });
  13892. const handleShortcutClick = (shortcut) => {
  13893. const shortcutValue = typeof shortcut.value === "function" ? shortcut.value() : shortcut.value;
  13894. if (shortcutValue) {
  13895. emit(dayjs(shortcutValue).locale(lang.value));
  13896. return;
  13897. }
  13898. if (shortcut.onClick) {
  13899. shortcut.onClick(ctx);
  13900. }
  13901. };
  13902. const selectionMode = computed(() => {
  13903. if (["week", "month", "year", "dates"].includes(props.type)) {
  13904. return props.type;
  13905. }
  13906. return "day";
  13907. });
  13908. watch(() => selectionMode.value, (val) => {
  13909. if (["month", "year"].includes(val)) {
  13910. currentView.value = val;
  13911. return;
  13912. }
  13913. currentView.value = "date";
  13914. }, { immediate: true });
  13915. watch(() => currentView.value, () => {
  13916. popper2 == null ? void 0 : popper2.updatePopper();
  13917. });
  13918. const hasShortcuts = computed(() => !!shortcuts.length);
  13919. const handleMonthPick = (month2) => {
  13920. innerDate.value = innerDate.value.startOf("month").month(month2);
  13921. if (selectionMode.value === "month") {
  13922. emit(innerDate.value);
  13923. } else {
  13924. currentView.value = "date";
  13925. }
  13926. handlePanelChange("month");
  13927. };
  13928. const handleYearPick = (year2) => {
  13929. if (selectionMode.value === "year") {
  13930. innerDate.value = innerDate.value.startOf("year").year(year2);
  13931. emit(innerDate.value);
  13932. } else {
  13933. innerDate.value = innerDate.value.year(year2);
  13934. currentView.value = "month";
  13935. }
  13936. handlePanelChange("year");
  13937. };
  13938. const showMonthPicker = () => {
  13939. currentView.value = "month";
  13940. };
  13941. const showYearPicker = () => {
  13942. currentView.value = "year";
  13943. };
  13944. const showTime = computed(() => props.type === "datetime" || props.type === "datetimerange");
  13945. const footerVisible = computed(() => {
  13946. return showTime.value || selectionMode.value === "dates";
  13947. });
  13948. const onConfirm = () => {
  13949. if (selectionMode.value === "dates") {
  13950. emit(props.parsedValue);
  13951. } else {
  13952. let result = props.parsedValue;
  13953. if (!result) {
  13954. const defaultTimeD2 = dayjs(defaultTime).locale(lang.value);
  13955. const defaultValueD = getDefaultValue();
  13956. result = defaultTimeD2.year(defaultValueD.year()).month(defaultValueD.month()).date(defaultValueD.date());
  13957. }
  13958. innerDate.value = result;
  13959. emit(result);
  13960. }
  13961. };
  13962. const changeToNow = () => {
  13963. const now2 = dayjs().locale(lang.value);
  13964. const nowDate = now2.toDate();
  13965. if ((!disabledDate || !disabledDate(nowDate)) && checkDateWithinRange(nowDate)) {
  13966. innerDate.value = dayjs().locale(lang.value);
  13967. emit(innerDate.value);
  13968. }
  13969. };
  13970. const timeFormat = computed(() => {
  13971. return extractTimeFormat(props.format);
  13972. });
  13973. const dateFormat = computed(() => {
  13974. return extractDateFormat(props.format);
  13975. });
  13976. const visibleTime = computed(() => {
  13977. if (userInputTime.value)
  13978. return userInputTime.value;
  13979. if (!props.parsedValue && !defaultValue.value)
  13980. return;
  13981. return (props.parsedValue || innerDate.value).format(timeFormat.value);
  13982. });
  13983. const visibleDate = computed(() => {
  13984. if (userInputDate.value)
  13985. return userInputDate.value;
  13986. if (!props.parsedValue && !defaultValue.value)
  13987. return;
  13988. return (props.parsedValue || innerDate.value).format(dateFormat.value);
  13989. });
  13990. const timePickerVisible = ref(false);
  13991. const onTimePickerInputFocus = () => {
  13992. timePickerVisible.value = true;
  13993. };
  13994. const handleTimePickClose = () => {
  13995. timePickerVisible.value = false;
  13996. };
  13997. const handleTimePick = (value, visible, first) => {
  13998. const newDate = props.parsedValue ? props.parsedValue.hour(value.hour()).minute(value.minute()).second(value.second()) : value;
  13999. innerDate.value = newDate;
  14000. emit(innerDate.value, true);
  14001. if (!first) {
  14002. timePickerVisible.value = visible;
  14003. }
  14004. };
  14005. const handleVisibleTimeChange = (value) => {
  14006. const newDate = dayjs(value, timeFormat.value).locale(lang.value);
  14007. if (newDate.isValid() && checkDateWithinRange(newDate)) {
  14008. innerDate.value = newDate.year(innerDate.value.year()).month(innerDate.value.month()).date(innerDate.value.date());
  14009. userInputTime.value = null;
  14010. timePickerVisible.value = false;
  14011. emit(innerDate.value, true);
  14012. }
  14013. };
  14014. const handleVisibleDateChange = (value) => {
  14015. const newDate = dayjs(value, dateFormat.value).locale(lang.value);
  14016. if (newDate.isValid()) {
  14017. if (disabledDate && disabledDate(newDate.toDate())) {
  14018. return;
  14019. }
  14020. innerDate.value = newDate.hour(innerDate.value.hour()).minute(innerDate.value.minute()).second(innerDate.value.second());
  14021. userInputDate.value = null;
  14022. emit(innerDate.value, true);
  14023. }
  14024. };
  14025. const isValidValue = (date4) => {
  14026. return dayjs.isDayjs(date4) && date4.isValid() && (disabledDate ? !disabledDate(date4.toDate()) : true);
  14027. };
  14028. const formatToString = (value) => {
  14029. if (selectionMode.value === "dates") {
  14030. return value.map((_2) => _2.format(props.format));
  14031. }
  14032. return value.format(props.format);
  14033. };
  14034. const parseUserInput = (value) => {
  14035. return dayjs(value, props.format).locale(lang.value);
  14036. };
  14037. const getDefaultValue = () => {
  14038. const parseDate = dayjs(defaultValue.value).locale(lang.value);
  14039. if (!defaultValue.value) {
  14040. const defaultTimeDValue = defaultTimeD.value;
  14041. return dayjs().hour(defaultTimeDValue.hour()).minute(defaultTimeDValue.minute()).second(defaultTimeDValue.second()).locale(lang.value);
  14042. }
  14043. return parseDate;
  14044. };
  14045. const handleKeydown = (event) => {
  14046. const { code, keyCode } = event;
  14047. const list = [
  14048. EVENT_CODE.up,
  14049. EVENT_CODE.down,
  14050. EVENT_CODE.left,
  14051. EVENT_CODE.right
  14052. ];
  14053. if (props.visible && !timePickerVisible.value) {
  14054. if (list.includes(code)) {
  14055. handleKeyControl(keyCode);
  14056. event.stopPropagation();
  14057. event.preventDefault();
  14058. }
  14059. if (code === EVENT_CODE.enter && userInputDate.value === null && userInputTime.value === null) {
  14060. emit(innerDate, false);
  14061. }
  14062. }
  14063. };
  14064. const handleKeyControl = (keyCode) => {
  14065. const mapping = {
  14066. year: {
  14067. 38: -4,
  14068. 40: 4,
  14069. 37: -1,
  14070. 39: 1,
  14071. offset: (date4, step) => date4.setFullYear(date4.getFullYear() + step)
  14072. },
  14073. month: {
  14074. 38: -4,
  14075. 40: 4,
  14076. 37: -1,
  14077. 39: 1,
  14078. offset: (date4, step) => date4.setMonth(date4.getMonth() + step)
  14079. },
  14080. week: {
  14081. 38: -1,
  14082. 40: 1,
  14083. 37: -1,
  14084. 39: 1,
  14085. offset: (date4, step) => date4.setDate(date4.getDate() + step * 7)
  14086. },
  14087. day: {
  14088. 38: -7,
  14089. 40: 7,
  14090. 37: -1,
  14091. 39: 1,
  14092. offset: (date4, step) => date4.setDate(date4.getDate() + step)
  14093. }
  14094. };
  14095. const newDate = innerDate.value.toDate();
  14096. while (Math.abs(innerDate.value.diff(newDate, "year", true)) < 1) {
  14097. const map = mapping[selectionMode.value];
  14098. map.offset(newDate, map[keyCode]);
  14099. if (disabledDate && disabledDate(newDate)) {
  14100. continue;
  14101. }
  14102. const result = dayjs(newDate).locale(lang.value);
  14103. innerDate.value = result;
  14104. ctx.emit("pick", result, true);
  14105. break;
  14106. }
  14107. };
  14108. const handlePanelChange = (mode) => {
  14109. ctx.emit("panel-change", innerDate.value.toDate(), mode, currentView.value);
  14110. };
  14111. ctx.emit("set-picker-option", ["isValidValue", isValidValue]);
  14112. ctx.emit("set-picker-option", ["formatToString", formatToString]);
  14113. ctx.emit("set-picker-option", ["parseUserInput", parseUserInput]);
  14114. ctx.emit("set-picker-option", ["handleKeydown", handleKeydown]);
  14115. watch(() => defaultValue.value, (val) => {
  14116. if (val) {
  14117. innerDate.value = getDefaultValue();
  14118. }
  14119. }, { immediate: true });
  14120. watch(() => props.parsedValue, (val) => {
  14121. if (val) {
  14122. if (selectionMode.value === "dates")
  14123. return;
  14124. if (Array.isArray(val))
  14125. return;
  14126. innerDate.value = val;
  14127. } else {
  14128. innerDate.value = getDefaultValue();
  14129. }
  14130. }, { immediate: true });
  14131. return {
  14132. handleTimePick,
  14133. handleTimePickClose,
  14134. onTimePickerInputFocus,
  14135. timePickerVisible,
  14136. visibleTime,
  14137. visibleDate,
  14138. showTime,
  14139. changeToNow,
  14140. onConfirm,
  14141. footerVisible,
  14142. handleYearPick,
  14143. showMonthPicker,
  14144. showYearPicker,
  14145. handleMonthPick,
  14146. hasShortcuts,
  14147. shortcuts,
  14148. arrowControl,
  14149. disabledDate,
  14150. cellClassName,
  14151. selectionMode,
  14152. handleShortcutClick,
  14153. prevYear_,
  14154. nextYear_,
  14155. prevMonth_,
  14156. nextMonth_,
  14157. innerDate,
  14158. t,
  14159. yearLabel,
  14160. currentView,
  14161. month,
  14162. handleDatePick,
  14163. handleVisibleTimeChange,
  14164. handleVisibleDateChange,
  14165. timeFormat,
  14166. userInputTime,
  14167. userInputDate
  14168. };
  14169. }
  14170. });
  14171. const _hoisted_1$n = { class: "el-picker-panel__body-wrapper" };
  14172. const _hoisted_2$i = {
  14173. key: 0,
  14174. class: "el-picker-panel__sidebar"
  14175. };
  14176. const _hoisted_3$c = ["onClick"];
  14177. const _hoisted_4$a = { class: "el-picker-panel__body" };
  14178. const _hoisted_5$a = {
  14179. key: 0,
  14180. class: "el-date-picker__time-header"
  14181. };
  14182. const _hoisted_6$8 = { class: "el-date-picker__editor-wrap" };
  14183. const _hoisted_7$5 = { class: "el-date-picker__editor-wrap" };
  14184. const _hoisted_8$4 = ["aria-label"];
  14185. const _hoisted_9$4 = ["aria-label"];
  14186. const _hoisted_10$4 = ["aria-label"];
  14187. const _hoisted_11$3 = ["aria-label"];
  14188. const _hoisted_12$3 = { class: "el-picker-panel__content" };
  14189. const _hoisted_13$3 = { class: "el-picker-panel__footer" };
  14190. function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) {
  14191. const _component_el_input = resolveComponent("el-input");
  14192. const _component_time_pick_panel = resolveComponent("time-pick-panel");
  14193. const _component_d_arrow_left = resolveComponent("d-arrow-left");
  14194. const _component_el_icon = resolveComponent("el-icon");
  14195. const _component_arrow_left = resolveComponent("arrow-left");
  14196. const _component_d_arrow_right = resolveComponent("d-arrow-right");
  14197. const _component_arrow_right = resolveComponent("arrow-right");
  14198. const _component_date_table = resolveComponent("date-table");
  14199. const _component_year_table = resolveComponent("year-table");
  14200. const _component_month_table = resolveComponent("month-table");
  14201. const _component_el_button = resolveComponent("el-button");
  14202. const _directive_clickoutside = resolveDirective("clickoutside");
  14203. return openBlock(), createElementBlock("div", {
  14204. class: normalizeClass(["el-picker-panel el-date-picker", [
  14205. {
  14206. "has-sidebar": _ctx.$slots.sidebar || _ctx.hasShortcuts,
  14207. "has-time": _ctx.showTime
  14208. }
  14209. ]])
  14210. }, [
  14211. createElementVNode("div", _hoisted_1$n, [
  14212. renderSlot(_ctx.$slots, "sidebar", { class: "el-picker-panel__sidebar" }),
  14213. _ctx.hasShortcuts ? (openBlock(), createElementBlock("div", _hoisted_2$i, [
  14214. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.shortcuts, (shortcut, key) => {
  14215. return openBlock(), createElementBlock("button", {
  14216. key,
  14217. type: "button",
  14218. class: "el-picker-panel__shortcut",
  14219. onClick: ($event) => _ctx.handleShortcutClick(shortcut)
  14220. }, toDisplayString(shortcut.text), 9, _hoisted_3$c);
  14221. }), 128))
  14222. ])) : createCommentVNode("v-if", true),
  14223. createElementVNode("div", _hoisted_4$a, [
  14224. _ctx.showTime ? (openBlock(), createElementBlock("div", _hoisted_5$a, [
  14225. createElementVNode("span", _hoisted_6$8, [
  14226. createVNode(_component_el_input, {
  14227. placeholder: _ctx.t("el.datepicker.selectDate"),
  14228. "model-value": _ctx.visibleDate,
  14229. size: "small",
  14230. onInput: _cache[0] || (_cache[0] = (val) => _ctx.userInputDate = val),
  14231. onChange: _ctx.handleVisibleDateChange
  14232. }, null, 8, ["placeholder", "model-value", "onChange"])
  14233. ]),
  14234. withDirectives((openBlock(), createElementBlock("span", _hoisted_7$5, [
  14235. createVNode(_component_el_input, {
  14236. placeholder: _ctx.t("el.datepicker.selectTime"),
  14237. "model-value": _ctx.visibleTime,
  14238. size: "small",
  14239. onFocus: _ctx.onTimePickerInputFocus,
  14240. onInput: _cache[1] || (_cache[1] = (val) => _ctx.userInputTime = val),
  14241. onChange: _ctx.handleVisibleTimeChange
  14242. }, null, 8, ["placeholder", "model-value", "onFocus", "onChange"]),
  14243. createVNode(_component_time_pick_panel, {
  14244. visible: _ctx.timePickerVisible,
  14245. format: _ctx.timeFormat,
  14246. "time-arrow-control": _ctx.arrowControl,
  14247. "parsed-value": _ctx.innerDate,
  14248. onPick: _ctx.handleTimePick
  14249. }, null, 8, ["visible", "format", "time-arrow-control", "parsed-value", "onPick"])
  14250. ])), [
  14251. [_directive_clickoutside, _ctx.handleTimePickClose]
  14252. ])
  14253. ])) : createCommentVNode("v-if", true),
  14254. withDirectives(createElementVNode("div", {
  14255. class: normalizeClass(["el-date-picker__header", {
  14256. "el-date-picker__header--bordered": _ctx.currentView === "year" || _ctx.currentView === "month"
  14257. }])
  14258. }, [
  14259. createElementVNode("button", {
  14260. type: "button",
  14261. "aria-label": _ctx.t(`el.datepicker.prevYear`),
  14262. class: "el-picker-panel__icon-btn el-date-picker__prev-btn d-arrow-left",
  14263. onClick: _cache[2] || (_cache[2] = (...args) => _ctx.prevYear_ && _ctx.prevYear_(...args))
  14264. }, [
  14265. createVNode(_component_el_icon, null, {
  14266. default: withCtx(() => [
  14267. createVNode(_component_d_arrow_left)
  14268. ]),
  14269. _: 1
  14270. })
  14271. ], 8, _hoisted_8$4),
  14272. withDirectives(createElementVNode("button", {
  14273. type: "button",
  14274. "aria-label": _ctx.t(`el.datepicker.prevMonth`),
  14275. class: "el-picker-panel__icon-btn el-date-picker__prev-btn arrow-left",
  14276. onClick: _cache[3] || (_cache[3] = (...args) => _ctx.prevMonth_ && _ctx.prevMonth_(...args))
  14277. }, [
  14278. createVNode(_component_el_icon, null, {
  14279. default: withCtx(() => [
  14280. createVNode(_component_arrow_left)
  14281. ]),
  14282. _: 1
  14283. })
  14284. ], 8, _hoisted_9$4), [
  14285. [vShow, _ctx.currentView === "date"]
  14286. ]),
  14287. createElementVNode("span", {
  14288. role: "button",
  14289. class: "el-date-picker__header-label",
  14290. onClick: _cache[4] || (_cache[4] = (...args) => _ctx.showYearPicker && _ctx.showYearPicker(...args))
  14291. }, toDisplayString(_ctx.yearLabel), 1),
  14292. withDirectives(createElementVNode("span", {
  14293. role: "button",
  14294. class: normalizeClass(["el-date-picker__header-label", { active: _ctx.currentView === "month" }]),
  14295. onClick: _cache[5] || (_cache[5] = (...args) => _ctx.showMonthPicker && _ctx.showMonthPicker(...args))
  14296. }, toDisplayString(_ctx.t(`el.datepicker.month${_ctx.month + 1}`)), 3), [
  14297. [vShow, _ctx.currentView === "date"]
  14298. ]),
  14299. createElementVNode("button", {
  14300. type: "button",
  14301. "aria-label": _ctx.t(`el.datepicker.nextYear`),
  14302. class: "el-picker-panel__icon-btn el-date-picker__next-btn d-arrow-right",
  14303. onClick: _cache[6] || (_cache[6] = (...args) => _ctx.nextYear_ && _ctx.nextYear_(...args))
  14304. }, [
  14305. createVNode(_component_el_icon, null, {
  14306. default: withCtx(() => [
  14307. createVNode(_component_d_arrow_right)
  14308. ]),
  14309. _: 1
  14310. })
  14311. ], 8, _hoisted_10$4),
  14312. withDirectives(createElementVNode("button", {
  14313. type: "button",
  14314. "aria-label": _ctx.t(`el.datepicker.nextMonth`),
  14315. class: "el-picker-panel__icon-btn el-date-picker__next-btn arrow-right",
  14316. onClick: _cache[7] || (_cache[7] = (...args) => _ctx.nextMonth_ && _ctx.nextMonth_(...args))
  14317. }, [
  14318. createVNode(_component_el_icon, null, {
  14319. default: withCtx(() => [
  14320. createVNode(_component_arrow_right)
  14321. ]),
  14322. _: 1
  14323. })
  14324. ], 8, _hoisted_11$3), [
  14325. [vShow, _ctx.currentView === "date"]
  14326. ])
  14327. ], 2), [
  14328. [vShow, _ctx.currentView !== "time"]
  14329. ]),
  14330. createElementVNode("div", _hoisted_12$3, [
  14331. _ctx.currentView === "date" ? (openBlock(), createBlock(_component_date_table, {
  14332. key: 0,
  14333. "selection-mode": _ctx.selectionMode,
  14334. date: _ctx.innerDate,
  14335. "parsed-value": _ctx.parsedValue,
  14336. "disabled-date": _ctx.disabledDate,
  14337. "cell-class-name": _ctx.cellClassName,
  14338. onPick: _ctx.handleDatePick
  14339. }, null, 8, ["selection-mode", "date", "parsed-value", "disabled-date", "cell-class-name", "onPick"])) : createCommentVNode("v-if", true),
  14340. _ctx.currentView === "year" ? (openBlock(), createBlock(_component_year_table, {
  14341. key: 1,
  14342. date: _ctx.innerDate,
  14343. "disabled-date": _ctx.disabledDate,
  14344. "parsed-value": _ctx.parsedValue,
  14345. onPick: _ctx.handleYearPick
  14346. }, null, 8, ["date", "disabled-date", "parsed-value", "onPick"])) : createCommentVNode("v-if", true),
  14347. _ctx.currentView === "month" ? (openBlock(), createBlock(_component_month_table, {
  14348. key: 2,
  14349. date: _ctx.innerDate,
  14350. "parsed-value": _ctx.parsedValue,
  14351. "disabled-date": _ctx.disabledDate,
  14352. onPick: _ctx.handleMonthPick
  14353. }, null, 8, ["date", "parsed-value", "disabled-date", "onPick"])) : createCommentVNode("v-if", true)
  14354. ])
  14355. ])
  14356. ]),
  14357. withDirectives(createElementVNode("div", _hoisted_13$3, [
  14358. withDirectives(createVNode(_component_el_button, {
  14359. size: "small",
  14360. type: "text",
  14361. class: "el-picker-panel__link-btn",
  14362. onClick: _ctx.changeToNow
  14363. }, {
  14364. default: withCtx(() => [
  14365. createTextVNode(toDisplayString(_ctx.t("el.datepicker.now")), 1)
  14366. ]),
  14367. _: 1
  14368. }, 8, ["onClick"]), [
  14369. [vShow, _ctx.selectionMode !== "dates"]
  14370. ]),
  14371. createVNode(_component_el_button, {
  14372. plain: "",
  14373. size: "small",
  14374. class: "el-picker-panel__link-btn",
  14375. onClick: _ctx.onConfirm
  14376. }, {
  14377. default: withCtx(() => [
  14378. createTextVNode(toDisplayString(_ctx.t("el.datepicker.confirm")), 1)
  14379. ]),
  14380. _: 1
  14381. }, 8, ["onClick"])
  14382. ], 512), [
  14383. [vShow, _ctx.footerVisible && _ctx.currentView === "date"]
  14384. ])
  14385. ], 2);
  14386. }
  14387. var DatePickPanel = /* @__PURE__ */ _export_sfc$1(_sfc_main$A, [["render", _sfc_render$g], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/date-picker/src/date-picker-com/panel-date-pick.vue"]]);
  14388. const _sfc_main$z = defineComponent({
  14389. directives: { clickoutside: ClickOutside },
  14390. components: {
  14391. TimePickPanel,
  14392. DateTable,
  14393. ElInput,
  14394. ElButton,
  14395. ElIcon,
  14396. DArrowLeft: dArrowLeft,
  14397. ArrowLeft: arrowLeft,
  14398. DArrowRight: dArrowRight,
  14399. ArrowRight: arrowRight
  14400. },
  14401. props: {
  14402. unlinkPanels: Boolean,
  14403. parsedValue: {
  14404. type: Array
  14405. },
  14406. type: {
  14407. type: String,
  14408. required: true,
  14409. validator: isValidDatePickType
  14410. }
  14411. },
  14412. emits: ["pick", "set-picker-option", "calendar-change", "panel-change"],
  14413. setup(props, ctx) {
  14414. const { t, lang } = useLocale();
  14415. const leftDate = ref(dayjs().locale(lang.value));
  14416. const rightDate = ref(dayjs().locale(lang.value).add(1, "month"));
  14417. const minDate = ref(null);
  14418. const maxDate = ref(null);
  14419. const dateUserInput = ref({
  14420. min: null,
  14421. max: null
  14422. });
  14423. const timeUserInput = ref({
  14424. min: null,
  14425. max: null
  14426. });
  14427. const leftLabel = computed(() => {
  14428. return `${leftDate.value.year()} ${t("el.datepicker.year")} ${t(`el.datepicker.month${leftDate.value.month() + 1}`)}`;
  14429. });
  14430. const rightLabel = computed(() => {
  14431. return `${rightDate.value.year()} ${t("el.datepicker.year")} ${t(`el.datepicker.month${rightDate.value.month() + 1}`)}`;
  14432. });
  14433. const leftYear = computed(() => {
  14434. return leftDate.value.year();
  14435. });
  14436. const leftMonth = computed(() => {
  14437. return leftDate.value.month();
  14438. });
  14439. const rightYear = computed(() => {
  14440. return rightDate.value.year();
  14441. });
  14442. const rightMonth = computed(() => {
  14443. return rightDate.value.month();
  14444. });
  14445. const hasShortcuts = computed(() => !!shortcuts.length);
  14446. const minVisibleDate = computed(() => {
  14447. if (dateUserInput.value.min !== null)
  14448. return dateUserInput.value.min;
  14449. if (minDate.value)
  14450. return minDate.value.format(dateFormat.value);
  14451. return "";
  14452. });
  14453. const maxVisibleDate = computed(() => {
  14454. if (dateUserInput.value.max !== null)
  14455. return dateUserInput.value.max;
  14456. if (maxDate.value || minDate.value)
  14457. return (maxDate.value || minDate.value).format(dateFormat.value);
  14458. return "";
  14459. });
  14460. const minVisibleTime = computed(() => {
  14461. if (timeUserInput.value.min !== null)
  14462. return timeUserInput.value.min;
  14463. if (minDate.value)
  14464. return minDate.value.format(timeFormat.value);
  14465. return "";
  14466. });
  14467. const maxVisibleTime = computed(() => {
  14468. if (timeUserInput.value.max !== null)
  14469. return timeUserInput.value.max;
  14470. if (maxDate.value || minDate.value)
  14471. return (maxDate.value || minDate.value).format(timeFormat.value);
  14472. return "";
  14473. });
  14474. const timeFormat = computed(() => {
  14475. return extractTimeFormat(format2);
  14476. });
  14477. const dateFormat = computed(() => {
  14478. return extractDateFormat(format2);
  14479. });
  14480. const leftPrevYear = () => {
  14481. leftDate.value = leftDate.value.subtract(1, "year");
  14482. if (!props.unlinkPanels) {
  14483. rightDate.value = leftDate.value.add(1, "month");
  14484. }
  14485. handlePanelChange("year");
  14486. };
  14487. const leftPrevMonth = () => {
  14488. leftDate.value = leftDate.value.subtract(1, "month");
  14489. if (!props.unlinkPanels) {
  14490. rightDate.value = leftDate.value.add(1, "month");
  14491. }
  14492. handlePanelChange("month");
  14493. };
  14494. const rightNextYear = () => {
  14495. if (!props.unlinkPanels) {
  14496. leftDate.value = leftDate.value.add(1, "year");
  14497. rightDate.value = leftDate.value.add(1, "month");
  14498. } else {
  14499. rightDate.value = rightDate.value.add(1, "year");
  14500. }
  14501. handlePanelChange("year");
  14502. };
  14503. const rightNextMonth = () => {
  14504. if (!props.unlinkPanels) {
  14505. leftDate.value = leftDate.value.add(1, "month");
  14506. rightDate.value = leftDate.value.add(1, "month");
  14507. } else {
  14508. rightDate.value = rightDate.value.add(1, "month");
  14509. }
  14510. handlePanelChange("month");
  14511. };
  14512. const leftNextYear = () => {
  14513. leftDate.value = leftDate.value.add(1, "year");
  14514. handlePanelChange("year");
  14515. };
  14516. const leftNextMonth = () => {
  14517. leftDate.value = leftDate.value.add(1, "month");
  14518. handlePanelChange("month");
  14519. };
  14520. const rightPrevYear = () => {
  14521. rightDate.value = rightDate.value.subtract(1, "year");
  14522. handlePanelChange("year");
  14523. };
  14524. const rightPrevMonth = () => {
  14525. rightDate.value = rightDate.value.subtract(1, "month");
  14526. handlePanelChange("month");
  14527. };
  14528. const handlePanelChange = (mode) => {
  14529. ctx.emit("panel-change", [leftDate.value.toDate(), rightDate.value.toDate()], mode);
  14530. };
  14531. const enableMonthArrow = computed(() => {
  14532. const nextMonth = (leftMonth.value + 1) % 12;
  14533. const yearOffset = leftMonth.value + 1 >= 12 ? 1 : 0;
  14534. return props.unlinkPanels && new Date(leftYear.value + yearOffset, nextMonth) < new Date(rightYear.value, rightMonth.value);
  14535. });
  14536. const enableYearArrow = computed(() => {
  14537. return props.unlinkPanels && rightYear.value * 12 + rightMonth.value - (leftYear.value * 12 + leftMonth.value + 1) >= 12;
  14538. });
  14539. const isValidValue = (value) => {
  14540. return Array.isArray(value) && value[0] && value[1] && value[0].valueOf() <= value[1].valueOf();
  14541. };
  14542. const rangeState = ref({
  14543. endDate: null,
  14544. selecting: false
  14545. });
  14546. const btnDisabled = computed(() => {
  14547. return !(minDate.value && maxDate.value && !rangeState.value.selecting && isValidValue([minDate.value, maxDate.value]));
  14548. });
  14549. const handleChangeRange = (val) => {
  14550. rangeState.value = val;
  14551. };
  14552. const onSelect = (selecting) => {
  14553. rangeState.value.selecting = selecting;
  14554. if (!selecting) {
  14555. rangeState.value.endDate = null;
  14556. }
  14557. };
  14558. const showTime = computed(() => props.type === "datetime" || props.type === "datetimerange");
  14559. const handleConfirm = (visible = false) => {
  14560. if (isValidValue([minDate.value, maxDate.value])) {
  14561. ctx.emit("pick", [minDate.value, maxDate.value], visible);
  14562. }
  14563. };
  14564. const formatEmit = (emitDayjs, index) => {
  14565. if (!emitDayjs)
  14566. return;
  14567. if (defaultTime) {
  14568. const defaultTimeD = dayjs(defaultTime[index] || defaultTime).locale(lang.value);
  14569. return defaultTimeD.year(emitDayjs.year()).month(emitDayjs.month()).date(emitDayjs.date());
  14570. }
  14571. return emitDayjs;
  14572. };
  14573. const handleRangePick = (val, close2 = true) => {
  14574. const min_ = val.minDate;
  14575. const max_ = val.maxDate;
  14576. const minDate_ = formatEmit(min_, 0);
  14577. const maxDate_ = formatEmit(max_, 1);
  14578. if (maxDate.value === maxDate_ && minDate.value === minDate_) {
  14579. return;
  14580. }
  14581. ctx.emit("calendar-change", [min_.toDate(), max_ && max_.toDate()]);
  14582. maxDate.value = maxDate_;
  14583. minDate.value = minDate_;
  14584. if (!close2 || showTime.value)
  14585. return;
  14586. handleConfirm();
  14587. };
  14588. const handleShortcutClick = (shortcut) => {
  14589. const shortcutValues = typeof shortcut.value === "function" ? shortcut.value() : shortcut.value;
  14590. if (shortcutValues) {
  14591. ctx.emit("pick", [
  14592. dayjs(shortcutValues[0]).locale(lang.value),
  14593. dayjs(shortcutValues[1]).locale(lang.value)
  14594. ]);
  14595. return;
  14596. }
  14597. if (shortcut.onClick) {
  14598. shortcut.onClick(ctx);
  14599. }
  14600. };
  14601. const minTimePickerVisible = ref(false);
  14602. const maxTimePickerVisible = ref(false);
  14603. const handleMinTimeClose = () => {
  14604. minTimePickerVisible.value = false;
  14605. };
  14606. const handleMaxTimeClose = () => {
  14607. maxTimePickerVisible.value = false;
  14608. };
  14609. const handleDateInput = (value, type4) => {
  14610. dateUserInput.value[type4] = value;
  14611. const parsedValueD = dayjs(value, dateFormat.value).locale(lang.value);
  14612. if (parsedValueD.isValid()) {
  14613. if (disabledDate && disabledDate(parsedValueD.toDate())) {
  14614. return;
  14615. }
  14616. if (type4 === "min") {
  14617. leftDate.value = parsedValueD;
  14618. minDate.value = (minDate.value || leftDate.value).year(parsedValueD.year()).month(parsedValueD.month()).date(parsedValueD.date());
  14619. if (!props.unlinkPanels) {
  14620. rightDate.value = parsedValueD.add(1, "month");
  14621. maxDate.value = minDate.value.add(1, "month");
  14622. }
  14623. } else {
  14624. rightDate.value = parsedValueD;
  14625. maxDate.value = (maxDate.value || rightDate.value).year(parsedValueD.year()).month(parsedValueD.month()).date(parsedValueD.date());
  14626. if (!props.unlinkPanels) {
  14627. leftDate.value = parsedValueD.subtract(1, "month");
  14628. minDate.value = maxDate.value.subtract(1, "month");
  14629. }
  14630. }
  14631. }
  14632. };
  14633. const handleDateChange = (_2, type4) => {
  14634. dateUserInput.value[type4] = null;
  14635. };
  14636. const handleTimeInput = (value, type4) => {
  14637. timeUserInput.value[type4] = value;
  14638. const parsedValueD = dayjs(value, timeFormat.value).locale(lang.value);
  14639. if (parsedValueD.isValid()) {
  14640. if (type4 === "min") {
  14641. minTimePickerVisible.value = true;
  14642. minDate.value = (minDate.value || leftDate.value).hour(parsedValueD.hour()).minute(parsedValueD.minute()).second(parsedValueD.second());
  14643. if (!maxDate.value || maxDate.value.isBefore(minDate.value)) {
  14644. maxDate.value = minDate.value;
  14645. }
  14646. } else {
  14647. maxTimePickerVisible.value = true;
  14648. maxDate.value = (maxDate.value || rightDate.value).hour(parsedValueD.hour()).minute(parsedValueD.minute()).second(parsedValueD.second());
  14649. rightDate.value = maxDate.value;
  14650. if (maxDate.value && maxDate.value.isBefore(minDate.value)) {
  14651. minDate.value = maxDate.value;
  14652. }
  14653. }
  14654. }
  14655. };
  14656. const handleTimeChange = (value, type4) => {
  14657. timeUserInput.value[type4] = null;
  14658. if (type4 === "min") {
  14659. leftDate.value = minDate.value;
  14660. minTimePickerVisible.value = false;
  14661. } else {
  14662. rightDate.value = maxDate.value;
  14663. maxTimePickerVisible.value = false;
  14664. }
  14665. };
  14666. const handleMinTimePick = (value, visible, first) => {
  14667. if (timeUserInput.value.min)
  14668. return;
  14669. if (value) {
  14670. leftDate.value = value;
  14671. minDate.value = (minDate.value || leftDate.value).hour(value.hour()).minute(value.minute()).second(value.second());
  14672. }
  14673. if (!first) {
  14674. minTimePickerVisible.value = visible;
  14675. }
  14676. if (!maxDate.value || maxDate.value.isBefore(minDate.value)) {
  14677. maxDate.value = minDate.value;
  14678. rightDate.value = value;
  14679. }
  14680. };
  14681. const handleMaxTimePick = (value, visible, first) => {
  14682. if (timeUserInput.value.max)
  14683. return;
  14684. if (value) {
  14685. rightDate.value = value;
  14686. maxDate.value = (maxDate.value || rightDate.value).hour(value.hour()).minute(value.minute()).second(value.second());
  14687. }
  14688. if (!first) {
  14689. maxTimePickerVisible.value = visible;
  14690. }
  14691. if (maxDate.value && maxDate.value.isBefore(minDate.value)) {
  14692. minDate.value = maxDate.value;
  14693. }
  14694. };
  14695. const handleClear = () => {
  14696. leftDate.value = getDefaultValue()[0];
  14697. rightDate.value = leftDate.value.add(1, "month");
  14698. ctx.emit("pick", null);
  14699. };
  14700. const formatToString = (value) => {
  14701. return Array.isArray(value) ? value.map((_2) => _2.format(format2)) : value.format(format2);
  14702. };
  14703. const parseUserInput = (value) => {
  14704. return Array.isArray(value) ? value.map((_2) => dayjs(_2, format2).locale(lang.value)) : dayjs(value, format2).locale(lang.value);
  14705. };
  14706. const getDefaultValue = () => {
  14707. let start2;
  14708. if (Array.isArray(defaultValue.value)) {
  14709. const left2 = dayjs(defaultValue.value[0]);
  14710. let right2 = dayjs(defaultValue.value[1]);
  14711. if (!props.unlinkPanels) {
  14712. right2 = left2.add(1, "month");
  14713. }
  14714. return [left2, right2];
  14715. } else if (defaultValue.value) {
  14716. start2 = dayjs(defaultValue.value);
  14717. } else {
  14718. start2 = dayjs();
  14719. }
  14720. start2 = start2.locale(lang.value);
  14721. return [start2, start2.add(1, "month")];
  14722. };
  14723. ctx.emit("set-picker-option", ["isValidValue", isValidValue]);
  14724. ctx.emit("set-picker-option", ["parseUserInput", parseUserInput]);
  14725. ctx.emit("set-picker-option", ["formatToString", formatToString]);
  14726. ctx.emit("set-picker-option", ["handleClear", handleClear]);
  14727. const pickerBase = inject("EP_PICKER_BASE");
  14728. const {
  14729. shortcuts,
  14730. disabledDate,
  14731. cellClassName,
  14732. format: format2,
  14733. defaultTime,
  14734. arrowControl,
  14735. clearable
  14736. } = pickerBase.props;
  14737. const defaultValue = toRef(pickerBase.props, "defaultValue");
  14738. watch(() => defaultValue.value, (val) => {
  14739. if (val) {
  14740. const defaultArr = getDefaultValue();
  14741. minDate.value = null;
  14742. maxDate.value = null;
  14743. leftDate.value = defaultArr[0];
  14744. rightDate.value = defaultArr[1];
  14745. }
  14746. }, { immediate: true });
  14747. watch(() => props.parsedValue, (newVal) => {
  14748. if (newVal && newVal.length === 2) {
  14749. minDate.value = newVal[0];
  14750. maxDate.value = newVal[1];
  14751. leftDate.value = minDate.value;
  14752. if (props.unlinkPanels && maxDate.value) {
  14753. const minDateYear = minDate.value.year();
  14754. const minDateMonth = minDate.value.month();
  14755. const maxDateYear = maxDate.value.year();
  14756. const maxDateMonth = maxDate.value.month();
  14757. rightDate.value = minDateYear === maxDateYear && minDateMonth === maxDateMonth ? maxDate.value.add(1, "month") : maxDate.value;
  14758. } else {
  14759. rightDate.value = leftDate.value.add(1, "month");
  14760. if (maxDate.value) {
  14761. rightDate.value = rightDate.value.hour(maxDate.value.hour()).minute(maxDate.value.minute()).second(maxDate.value.second());
  14762. }
  14763. }
  14764. } else {
  14765. const defaultArr = getDefaultValue();
  14766. minDate.value = null;
  14767. maxDate.value = null;
  14768. leftDate.value = defaultArr[0];
  14769. rightDate.value = defaultArr[1];
  14770. }
  14771. }, { immediate: true });
  14772. return {
  14773. shortcuts,
  14774. disabledDate,
  14775. cellClassName,
  14776. minTimePickerVisible,
  14777. maxTimePickerVisible,
  14778. handleMinTimeClose,
  14779. handleMaxTimeClose,
  14780. handleShortcutClick,
  14781. rangeState,
  14782. minDate,
  14783. maxDate,
  14784. handleRangePick,
  14785. onSelect,
  14786. handleChangeRange,
  14787. btnDisabled,
  14788. enableYearArrow,
  14789. enableMonthArrow,
  14790. rightPrevMonth,
  14791. rightPrevYear,
  14792. rightNextMonth,
  14793. rightNextYear,
  14794. leftPrevMonth,
  14795. leftPrevYear,
  14796. leftNextMonth,
  14797. leftNextYear,
  14798. hasShortcuts,
  14799. leftLabel,
  14800. rightLabel,
  14801. leftDate,
  14802. rightDate,
  14803. showTime,
  14804. t,
  14805. minVisibleDate,
  14806. maxVisibleDate,
  14807. minVisibleTime,
  14808. maxVisibleTime,
  14809. arrowControl,
  14810. handleDateInput,
  14811. handleDateChange,
  14812. handleTimeInput,
  14813. handleTimeChange,
  14814. handleMinTimePick,
  14815. handleMaxTimePick,
  14816. handleClear,
  14817. handleConfirm,
  14818. timeFormat,
  14819. clearable
  14820. };
  14821. }
  14822. });
  14823. const _hoisted_1$m = { class: "el-picker-panel__body-wrapper" };
  14824. const _hoisted_2$h = {
  14825. key: 0,
  14826. class: "el-picker-panel__sidebar"
  14827. };
  14828. const _hoisted_3$b = ["onClick"];
  14829. const _hoisted_4$9 = { class: "el-picker-panel__body" };
  14830. const _hoisted_5$9 = {
  14831. key: 0,
  14832. class: "el-date-range-picker__time-header"
  14833. };
  14834. const _hoisted_6$7 = { class: "el-date-range-picker__editors-wrap" };
  14835. const _hoisted_7$4 = { class: "el-date-range-picker__time-picker-wrap" };
  14836. const _hoisted_8$3 = { class: "el-date-range-picker__time-picker-wrap" };
  14837. const _hoisted_9$3 = { class: "el-date-range-picker__editors-wrap is-right" };
  14838. const _hoisted_10$3 = { class: "el-date-range-picker__time-picker-wrap" };
  14839. const _hoisted_11$2 = { class: "el-date-range-picker__time-picker-wrap" };
  14840. const _hoisted_12$2 = { class: "el-picker-panel__content el-date-range-picker__content is-left" };
  14841. const _hoisted_13$2 = { class: "el-date-range-picker__header" };
  14842. const _hoisted_14$2 = ["disabled"];
  14843. const _hoisted_15$1 = ["disabled"];
  14844. const _hoisted_16$1 = { class: "el-picker-panel__content el-date-range-picker__content is-right" };
  14845. const _hoisted_17$1 = { class: "el-date-range-picker__header" };
  14846. const _hoisted_18$1 = ["disabled"];
  14847. const _hoisted_19$1 = ["disabled"];
  14848. const _hoisted_20$1 = {
  14849. key: 0,
  14850. class: "el-picker-panel__footer"
  14851. };
  14852. function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
  14853. const _component_el_input = resolveComponent("el-input");
  14854. const _component_time_pick_panel = resolveComponent("time-pick-panel");
  14855. const _component_arrow_right = resolveComponent("arrow-right");
  14856. const _component_el_icon = resolveComponent("el-icon");
  14857. const _component_d_arrow_left = resolveComponent("d-arrow-left");
  14858. const _component_arrow_left = resolveComponent("arrow-left");
  14859. const _component_d_arrow_right = resolveComponent("d-arrow-right");
  14860. const _component_date_table = resolveComponent("date-table");
  14861. const _component_el_button = resolveComponent("el-button");
  14862. const _directive_clickoutside = resolveDirective("clickoutside");
  14863. return openBlock(), createElementBlock("div", {
  14864. class: normalizeClass(["el-picker-panel el-date-range-picker", [
  14865. {
  14866. "has-sidebar": _ctx.$slots.sidebar || _ctx.hasShortcuts,
  14867. "has-time": _ctx.showTime
  14868. }
  14869. ]])
  14870. }, [
  14871. createElementVNode("div", _hoisted_1$m, [
  14872. renderSlot(_ctx.$slots, "sidebar", { class: "el-picker-panel__sidebar" }),
  14873. _ctx.hasShortcuts ? (openBlock(), createElementBlock("div", _hoisted_2$h, [
  14874. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.shortcuts, (shortcut, key) => {
  14875. return openBlock(), createElementBlock("button", {
  14876. key,
  14877. type: "button",
  14878. class: "el-picker-panel__shortcut",
  14879. onClick: ($event) => _ctx.handleShortcutClick(shortcut)
  14880. }, toDisplayString(shortcut.text), 9, _hoisted_3$b);
  14881. }), 128))
  14882. ])) : createCommentVNode("v-if", true),
  14883. createElementVNode("div", _hoisted_4$9, [
  14884. _ctx.showTime ? (openBlock(), createElementBlock("div", _hoisted_5$9, [
  14885. createElementVNode("span", _hoisted_6$7, [
  14886. createElementVNode("span", _hoisted_7$4, [
  14887. createVNode(_component_el_input, {
  14888. size: "small",
  14889. disabled: _ctx.rangeState.selecting,
  14890. placeholder: _ctx.t("el.datepicker.startDate"),
  14891. class: "el-date-range-picker__editor",
  14892. "model-value": _ctx.minVisibleDate,
  14893. onInput: _cache[0] || (_cache[0] = (val) => _ctx.handleDateInput(val, "min")),
  14894. onChange: _cache[1] || (_cache[1] = (val) => _ctx.handleDateChange(val, "min"))
  14895. }, null, 8, ["disabled", "placeholder", "model-value"])
  14896. ]),
  14897. withDirectives((openBlock(), createElementBlock("span", _hoisted_8$3, [
  14898. createVNode(_component_el_input, {
  14899. size: "small",
  14900. class: "el-date-range-picker__editor",
  14901. disabled: _ctx.rangeState.selecting,
  14902. placeholder: _ctx.t("el.datepicker.startTime"),
  14903. "model-value": _ctx.minVisibleTime,
  14904. onFocus: _cache[2] || (_cache[2] = ($event) => _ctx.minTimePickerVisible = true),
  14905. onInput: _cache[3] || (_cache[3] = (val) => _ctx.handleTimeInput(val, "min")),
  14906. onChange: _cache[4] || (_cache[4] = (val) => _ctx.handleTimeChange(val, "min"))
  14907. }, null, 8, ["disabled", "placeholder", "model-value"]),
  14908. createVNode(_component_time_pick_panel, {
  14909. visible: _ctx.minTimePickerVisible,
  14910. format: _ctx.timeFormat,
  14911. "datetime-role": "start",
  14912. "time-arrow-control": _ctx.arrowControl,
  14913. "parsed-value": _ctx.leftDate,
  14914. onPick: _ctx.handleMinTimePick
  14915. }, null, 8, ["visible", "format", "time-arrow-control", "parsed-value", "onPick"])
  14916. ])), [
  14917. [_directive_clickoutside, _ctx.handleMinTimeClose]
  14918. ])
  14919. ]),
  14920. createElementVNode("span", null, [
  14921. createVNode(_component_el_icon, null, {
  14922. default: withCtx(() => [
  14923. createVNode(_component_arrow_right)
  14924. ]),
  14925. _: 1
  14926. })
  14927. ]),
  14928. createElementVNode("span", _hoisted_9$3, [
  14929. createElementVNode("span", _hoisted_10$3, [
  14930. createVNode(_component_el_input, {
  14931. size: "small",
  14932. class: "el-date-range-picker__editor",
  14933. disabled: _ctx.rangeState.selecting,
  14934. placeholder: _ctx.t("el.datepicker.endDate"),
  14935. "model-value": _ctx.maxVisibleDate,
  14936. readonly: !_ctx.minDate,
  14937. onInput: _cache[5] || (_cache[5] = (val) => _ctx.handleDateInput(val, "max")),
  14938. onChange: _cache[6] || (_cache[6] = (val) => _ctx.handleDateChange(val, "max"))
  14939. }, null, 8, ["disabled", "placeholder", "model-value", "readonly"])
  14940. ]),
  14941. withDirectives((openBlock(), createElementBlock("span", _hoisted_11$2, [
  14942. createVNode(_component_el_input, {
  14943. size: "small",
  14944. class: "el-date-range-picker__editor",
  14945. disabled: _ctx.rangeState.selecting,
  14946. placeholder: _ctx.t("el.datepicker.endTime"),
  14947. "model-value": _ctx.maxVisibleTime,
  14948. readonly: !_ctx.minDate,
  14949. onFocus: _cache[7] || (_cache[7] = ($event) => _ctx.minDate && (_ctx.maxTimePickerVisible = true)),
  14950. onInput: _cache[8] || (_cache[8] = (val) => _ctx.handleTimeInput(val, "max")),
  14951. onChange: _cache[9] || (_cache[9] = (val) => _ctx.handleTimeChange(val, "max"))
  14952. }, null, 8, ["disabled", "placeholder", "model-value", "readonly"]),
  14953. createVNode(_component_time_pick_panel, {
  14954. "datetime-role": "end",
  14955. visible: _ctx.maxTimePickerVisible,
  14956. format: _ctx.timeFormat,
  14957. "time-arrow-control": _ctx.arrowControl,
  14958. "parsed-value": _ctx.rightDate,
  14959. onPick: _ctx.handleMaxTimePick
  14960. }, null, 8, ["visible", "format", "time-arrow-control", "parsed-value", "onPick"])
  14961. ])), [
  14962. [_directive_clickoutside, _ctx.handleMaxTimeClose]
  14963. ])
  14964. ])
  14965. ])) : createCommentVNode("v-if", true),
  14966. createElementVNode("div", _hoisted_12$2, [
  14967. createElementVNode("div", _hoisted_13$2, [
  14968. createElementVNode("button", {
  14969. type: "button",
  14970. class: "el-picker-panel__icon-btn d-arrow-left",
  14971. onClick: _cache[10] || (_cache[10] = (...args) => _ctx.leftPrevYear && _ctx.leftPrevYear(...args))
  14972. }, [
  14973. createVNode(_component_el_icon, null, {
  14974. default: withCtx(() => [
  14975. createVNode(_component_d_arrow_left)
  14976. ]),
  14977. _: 1
  14978. })
  14979. ]),
  14980. createElementVNode("button", {
  14981. type: "button",
  14982. class: "el-picker-panel__icon-btn arrow-left",
  14983. onClick: _cache[11] || (_cache[11] = (...args) => _ctx.leftPrevMonth && _ctx.leftPrevMonth(...args))
  14984. }, [
  14985. createVNode(_component_el_icon, null, {
  14986. default: withCtx(() => [
  14987. createVNode(_component_arrow_left)
  14988. ]),
  14989. _: 1
  14990. })
  14991. ]),
  14992. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  14993. key: 0,
  14994. type: "button",
  14995. disabled: !_ctx.enableYearArrow,
  14996. class: normalizeClass([{ "is-disabled": !_ctx.enableYearArrow }, "el-picker-panel__icon-btn d-arrow-right"]),
  14997. onClick: _cache[12] || (_cache[12] = (...args) => _ctx.leftNextYear && _ctx.leftNextYear(...args))
  14998. }, [
  14999. createVNode(_component_el_icon, null, {
  15000. default: withCtx(() => [
  15001. createVNode(_component_d_arrow_right)
  15002. ]),
  15003. _: 1
  15004. })
  15005. ], 10, _hoisted_14$2)) : createCommentVNode("v-if", true),
  15006. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  15007. key: 1,
  15008. type: "button",
  15009. disabled: !_ctx.enableMonthArrow,
  15010. class: normalizeClass([{ "is-disabled": !_ctx.enableMonthArrow }, "el-picker-panel__icon-btn arrow-right"]),
  15011. onClick: _cache[13] || (_cache[13] = (...args) => _ctx.leftNextMonth && _ctx.leftNextMonth(...args))
  15012. }, [
  15013. createVNode(_component_el_icon, null, {
  15014. default: withCtx(() => [
  15015. createVNode(_component_arrow_right)
  15016. ]),
  15017. _: 1
  15018. })
  15019. ], 10, _hoisted_15$1)) : createCommentVNode("v-if", true),
  15020. createElementVNode("div", null, toDisplayString(_ctx.leftLabel), 1)
  15021. ]),
  15022. createVNode(_component_date_table, {
  15023. "selection-mode": "range",
  15024. date: _ctx.leftDate,
  15025. "min-date": _ctx.minDate,
  15026. "max-date": _ctx.maxDate,
  15027. "range-state": _ctx.rangeState,
  15028. "disabled-date": _ctx.disabledDate,
  15029. "cell-class-name": _ctx.cellClassName,
  15030. onChangerange: _ctx.handleChangeRange,
  15031. onPick: _ctx.handleRangePick,
  15032. onSelect: _ctx.onSelect
  15033. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "cell-class-name", "onChangerange", "onPick", "onSelect"])
  15034. ]),
  15035. createElementVNode("div", _hoisted_16$1, [
  15036. createElementVNode("div", _hoisted_17$1, [
  15037. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  15038. key: 0,
  15039. type: "button",
  15040. disabled: !_ctx.enableYearArrow,
  15041. class: normalizeClass([{ "is-disabled": !_ctx.enableYearArrow }, "el-picker-panel__icon-btn d-arrow-left"]),
  15042. onClick: _cache[14] || (_cache[14] = (...args) => _ctx.rightPrevYear && _ctx.rightPrevYear(...args))
  15043. }, [
  15044. createVNode(_component_el_icon, null, {
  15045. default: withCtx(() => [
  15046. createVNode(_component_d_arrow_left)
  15047. ]),
  15048. _: 1
  15049. })
  15050. ], 10, _hoisted_18$1)) : createCommentVNode("v-if", true),
  15051. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  15052. key: 1,
  15053. type: "button",
  15054. disabled: !_ctx.enableMonthArrow,
  15055. class: normalizeClass([{ "is-disabled": !_ctx.enableMonthArrow }, "el-picker-panel__icon-btn arrow-left"]),
  15056. onClick: _cache[15] || (_cache[15] = (...args) => _ctx.rightPrevMonth && _ctx.rightPrevMonth(...args))
  15057. }, [
  15058. createVNode(_component_el_icon, null, {
  15059. default: withCtx(() => [
  15060. createVNode(_component_arrow_left)
  15061. ]),
  15062. _: 1
  15063. })
  15064. ], 10, _hoisted_19$1)) : createCommentVNode("v-if", true),
  15065. createElementVNode("button", {
  15066. type: "button",
  15067. class: "el-picker-panel__icon-btn d-arrow-right",
  15068. onClick: _cache[16] || (_cache[16] = (...args) => _ctx.rightNextYear && _ctx.rightNextYear(...args))
  15069. }, [
  15070. createVNode(_component_el_icon, null, {
  15071. default: withCtx(() => [
  15072. createVNode(_component_d_arrow_right)
  15073. ]),
  15074. _: 1
  15075. })
  15076. ]),
  15077. createElementVNode("button", {
  15078. type: "button",
  15079. class: "el-picker-panel__icon-btn arrow-right",
  15080. onClick: _cache[17] || (_cache[17] = (...args) => _ctx.rightNextMonth && _ctx.rightNextMonth(...args))
  15081. }, [
  15082. createVNode(_component_el_icon, null, {
  15083. default: withCtx(() => [
  15084. createVNode(_component_arrow_right)
  15085. ]),
  15086. _: 1
  15087. })
  15088. ]),
  15089. createElementVNode("div", null, toDisplayString(_ctx.rightLabel), 1)
  15090. ]),
  15091. createVNode(_component_date_table, {
  15092. "selection-mode": "range",
  15093. date: _ctx.rightDate,
  15094. "min-date": _ctx.minDate,
  15095. "max-date": _ctx.maxDate,
  15096. "range-state": _ctx.rangeState,
  15097. "disabled-date": _ctx.disabledDate,
  15098. "cell-class-name": _ctx.cellClassName,
  15099. onChangerange: _ctx.handleChangeRange,
  15100. onPick: _ctx.handleRangePick,
  15101. onSelect: _ctx.onSelect
  15102. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "cell-class-name", "onChangerange", "onPick", "onSelect"])
  15103. ])
  15104. ])
  15105. ]),
  15106. _ctx.showTime ? (openBlock(), createElementBlock("div", _hoisted_20$1, [
  15107. _ctx.clearable ? (openBlock(), createBlock(_component_el_button, {
  15108. key: 0,
  15109. size: "small",
  15110. type: "text",
  15111. class: "el-picker-panel__link-btn",
  15112. onClick: _ctx.handleClear
  15113. }, {
  15114. default: withCtx(() => [
  15115. createTextVNode(toDisplayString(_ctx.t("el.datepicker.clear")), 1)
  15116. ]),
  15117. _: 1
  15118. }, 8, ["onClick"])) : createCommentVNode("v-if", true),
  15119. createVNode(_component_el_button, {
  15120. plain: "",
  15121. size: "small",
  15122. class: "el-picker-panel__link-btn",
  15123. disabled: _ctx.btnDisabled,
  15124. onClick: _cache[18] || (_cache[18] = ($event) => _ctx.handleConfirm(false))
  15125. }, {
  15126. default: withCtx(() => [
  15127. createTextVNode(toDisplayString(_ctx.t("el.datepicker.confirm")), 1)
  15128. ]),
  15129. _: 1
  15130. }, 8, ["disabled"])
  15131. ])) : createCommentVNode("v-if", true)
  15132. ], 2);
  15133. }
  15134. var DateRangePickPanel = /* @__PURE__ */ _export_sfc$1(_sfc_main$z, [["render", _sfc_render$f], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/date-picker/src/date-picker-com/panel-date-range.vue"]]);
  15135. const _sfc_main$y = defineComponent({
  15136. components: { MonthTable, ElIcon, DArrowLeft: dArrowLeft, DArrowRight: dArrowRight },
  15137. props: {
  15138. unlinkPanels: Boolean,
  15139. parsedValue: {
  15140. type: Array
  15141. }
  15142. },
  15143. emits: ["pick", "set-picker-option"],
  15144. setup(props, ctx) {
  15145. const { t, lang } = useLocale();
  15146. const leftDate = ref(dayjs().locale(lang.value));
  15147. const rightDate = ref(dayjs().locale(lang.value).add(1, "year"));
  15148. const hasShortcuts = computed(() => !!shortcuts.length);
  15149. const handleShortcutClick = (shortcut) => {
  15150. const shortcutValues = typeof shortcut.value === "function" ? shortcut.value() : shortcut.value;
  15151. if (shortcutValues) {
  15152. ctx.emit("pick", [
  15153. dayjs(shortcutValues[0]).locale(lang.value),
  15154. dayjs(shortcutValues[1]).locale(lang.value)
  15155. ]);
  15156. return;
  15157. }
  15158. if (shortcut.onClick) {
  15159. shortcut.onClick(ctx);
  15160. }
  15161. };
  15162. const leftPrevYear = () => {
  15163. leftDate.value = leftDate.value.subtract(1, "year");
  15164. if (!props.unlinkPanels) {
  15165. rightDate.value = rightDate.value.subtract(1, "year");
  15166. }
  15167. };
  15168. const rightNextYear = () => {
  15169. if (!props.unlinkPanels) {
  15170. leftDate.value = leftDate.value.add(1, "year");
  15171. }
  15172. rightDate.value = rightDate.value.add(1, "year");
  15173. };
  15174. const leftNextYear = () => {
  15175. leftDate.value = leftDate.value.add(1, "year");
  15176. };
  15177. const rightPrevYear = () => {
  15178. rightDate.value = rightDate.value.subtract(1, "year");
  15179. };
  15180. const leftLabel = computed(() => {
  15181. return `${leftDate.value.year()} ${t("el.datepicker.year")}`;
  15182. });
  15183. const rightLabel = computed(() => {
  15184. return `${rightDate.value.year()} ${t("el.datepicker.year")}`;
  15185. });
  15186. const leftYear = computed(() => {
  15187. return leftDate.value.year();
  15188. });
  15189. const rightYear = computed(() => {
  15190. return rightDate.value.year() === leftDate.value.year() ? leftDate.value.year() + 1 : rightDate.value.year();
  15191. });
  15192. const enableYearArrow = computed(() => {
  15193. return props.unlinkPanels && rightYear.value > leftYear.value + 1;
  15194. });
  15195. const minDate = ref(null);
  15196. const maxDate = ref(null);
  15197. const rangeState = ref({
  15198. endDate: null,
  15199. selecting: false
  15200. });
  15201. const handleChangeRange = (val) => {
  15202. rangeState.value = val;
  15203. };
  15204. const handleRangePick = (val, close2 = true) => {
  15205. const minDate_ = val.minDate;
  15206. const maxDate_ = val.maxDate;
  15207. if (maxDate.value === maxDate_ && minDate.value === minDate_) {
  15208. return;
  15209. }
  15210. maxDate.value = maxDate_;
  15211. minDate.value = minDate_;
  15212. if (!close2)
  15213. return;
  15214. handleConfirm();
  15215. };
  15216. const isValidValue = (value) => {
  15217. return Array.isArray(value) && value && value[0] && value[1] && value[0].valueOf() <= value[1].valueOf();
  15218. };
  15219. const handleConfirm = (visible = false) => {
  15220. if (isValidValue([minDate.value, maxDate.value])) {
  15221. ctx.emit("pick", [minDate.value, maxDate.value], visible);
  15222. }
  15223. };
  15224. const onSelect = (selecting) => {
  15225. rangeState.value.selecting = selecting;
  15226. if (!selecting) {
  15227. rangeState.value.endDate = null;
  15228. }
  15229. };
  15230. const formatToString = (value) => {
  15231. return value.map((_2) => _2.format(format2));
  15232. };
  15233. const getDefaultValue = () => {
  15234. let start2;
  15235. if (Array.isArray(defaultValue.value)) {
  15236. const left2 = dayjs(defaultValue.value[0]);
  15237. let right2 = dayjs(defaultValue.value[1]);
  15238. if (!props.unlinkPanels) {
  15239. right2 = left2.add(1, "year");
  15240. }
  15241. return [left2, right2];
  15242. } else if (defaultValue.value) {
  15243. start2 = dayjs(defaultValue.value);
  15244. } else {
  15245. start2 = dayjs();
  15246. }
  15247. start2 = start2.locale(lang.value);
  15248. return [start2, start2.add(1, "year")];
  15249. };
  15250. ctx.emit("set-picker-option", ["formatToString", formatToString]);
  15251. const pickerBase = inject("EP_PICKER_BASE");
  15252. const { shortcuts, disabledDate, format: format2 } = pickerBase.props;
  15253. const defaultValue = toRef(pickerBase.props, "defaultValue");
  15254. watch(() => defaultValue.value, (val) => {
  15255. if (val) {
  15256. const defaultArr = getDefaultValue();
  15257. leftDate.value = defaultArr[0];
  15258. rightDate.value = defaultArr[1];
  15259. }
  15260. }, { immediate: true });
  15261. watch(() => props.parsedValue, (newVal) => {
  15262. if (newVal && newVal.length === 2) {
  15263. minDate.value = newVal[0];
  15264. maxDate.value = newVal[1];
  15265. leftDate.value = minDate.value;
  15266. if (props.unlinkPanels && maxDate.value) {
  15267. const minDateYear = minDate.value.year();
  15268. const maxDateYear = maxDate.value.year();
  15269. rightDate.value = minDateYear === maxDateYear ? maxDate.value.add(1, "year") : maxDate.value;
  15270. } else {
  15271. rightDate.value = leftDate.value.add(1, "year");
  15272. }
  15273. } else {
  15274. const defaultArr = getDefaultValue();
  15275. minDate.value = null;
  15276. maxDate.value = null;
  15277. leftDate.value = defaultArr[0];
  15278. rightDate.value = defaultArr[1];
  15279. }
  15280. }, { immediate: true });
  15281. return {
  15282. shortcuts,
  15283. disabledDate,
  15284. onSelect,
  15285. handleRangePick,
  15286. rangeState,
  15287. handleChangeRange,
  15288. minDate,
  15289. maxDate,
  15290. enableYearArrow,
  15291. leftLabel,
  15292. rightLabel,
  15293. leftNextYear,
  15294. leftPrevYear,
  15295. rightNextYear,
  15296. rightPrevYear,
  15297. t,
  15298. leftDate,
  15299. rightDate,
  15300. hasShortcuts,
  15301. handleShortcutClick
  15302. };
  15303. }
  15304. });
  15305. const _hoisted_1$l = { class: "el-picker-panel__body-wrapper" };
  15306. const _hoisted_2$g = {
  15307. key: 0,
  15308. class: "el-picker-panel__sidebar"
  15309. };
  15310. const _hoisted_3$a = ["onClick"];
  15311. const _hoisted_4$8 = { class: "el-picker-panel__body" };
  15312. const _hoisted_5$8 = { class: "el-picker-panel__content el-date-range-picker__content is-left" };
  15313. const _hoisted_6$6 = { class: "el-date-range-picker__header" };
  15314. const _hoisted_7$3 = ["disabled"];
  15315. const _hoisted_8$2 = { class: "el-picker-panel__content el-date-range-picker__content is-right" };
  15316. const _hoisted_9$2 = { class: "el-date-range-picker__header" };
  15317. const _hoisted_10$2 = ["disabled"];
  15318. function _sfc_render$e(_ctx, _cache, $props, $setup, $data, $options) {
  15319. const _component_d_arrow_left = resolveComponent("d-arrow-left");
  15320. const _component_el_icon = resolveComponent("el-icon");
  15321. const _component_d_arrow_right = resolveComponent("d-arrow-right");
  15322. const _component_month_table = resolveComponent("month-table");
  15323. return openBlock(), createElementBlock("div", {
  15324. class: normalizeClass(["el-picker-panel el-date-range-picker", [
  15325. {
  15326. "has-sidebar": _ctx.$slots.sidebar || _ctx.hasShortcuts
  15327. }
  15328. ]])
  15329. }, [
  15330. createElementVNode("div", _hoisted_1$l, [
  15331. renderSlot(_ctx.$slots, "sidebar", { class: "el-picker-panel__sidebar" }),
  15332. _ctx.hasShortcuts ? (openBlock(), createElementBlock("div", _hoisted_2$g, [
  15333. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.shortcuts, (shortcut, key) => {
  15334. return openBlock(), createElementBlock("button", {
  15335. key,
  15336. type: "button",
  15337. class: "el-picker-panel__shortcut",
  15338. onClick: ($event) => _ctx.handleShortcutClick(shortcut)
  15339. }, toDisplayString(shortcut.text), 9, _hoisted_3$a);
  15340. }), 128))
  15341. ])) : createCommentVNode("v-if", true),
  15342. createElementVNode("div", _hoisted_4$8, [
  15343. createElementVNode("div", _hoisted_5$8, [
  15344. createElementVNode("div", _hoisted_6$6, [
  15345. createElementVNode("button", {
  15346. type: "button",
  15347. class: "el-picker-panel__icon-btn d-arrow-left",
  15348. onClick: _cache[0] || (_cache[0] = (...args) => _ctx.leftPrevYear && _ctx.leftPrevYear(...args))
  15349. }, [
  15350. createVNode(_component_el_icon, null, {
  15351. default: withCtx(() => [
  15352. createVNode(_component_d_arrow_left)
  15353. ]),
  15354. _: 1
  15355. })
  15356. ]),
  15357. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  15358. key: 0,
  15359. type: "button",
  15360. disabled: !_ctx.enableYearArrow,
  15361. class: normalizeClass([{ "is-disabled": !_ctx.enableYearArrow }, "el-picker-panel__icon-btn d-arrow-right"]),
  15362. onClick: _cache[1] || (_cache[1] = (...args) => _ctx.leftNextYear && _ctx.leftNextYear(...args))
  15363. }, [
  15364. createVNode(_component_el_icon, null, {
  15365. default: withCtx(() => [
  15366. createVNode(_component_d_arrow_right)
  15367. ]),
  15368. _: 1
  15369. })
  15370. ], 10, _hoisted_7$3)) : createCommentVNode("v-if", true),
  15371. createElementVNode("div", null, toDisplayString(_ctx.leftLabel), 1)
  15372. ]),
  15373. createVNode(_component_month_table, {
  15374. "selection-mode": "range",
  15375. date: _ctx.leftDate,
  15376. "min-date": _ctx.minDate,
  15377. "max-date": _ctx.maxDate,
  15378. "range-state": _ctx.rangeState,
  15379. "disabled-date": _ctx.disabledDate,
  15380. onChangerange: _ctx.handleChangeRange,
  15381. onPick: _ctx.handleRangePick,
  15382. onSelect: _ctx.onSelect
  15383. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "onChangerange", "onPick", "onSelect"])
  15384. ]),
  15385. createElementVNode("div", _hoisted_8$2, [
  15386. createElementVNode("div", _hoisted_9$2, [
  15387. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  15388. key: 0,
  15389. type: "button",
  15390. disabled: !_ctx.enableYearArrow,
  15391. class: normalizeClass([{ "is-disabled": !_ctx.enableYearArrow }, "el-picker-panel__icon-btn d-arrow-left"]),
  15392. onClick: _cache[2] || (_cache[2] = (...args) => _ctx.rightPrevYear && _ctx.rightPrevYear(...args))
  15393. }, [
  15394. createVNode(_component_el_icon, null, {
  15395. default: withCtx(() => [
  15396. createVNode(_component_d_arrow_left)
  15397. ]),
  15398. _: 1
  15399. })
  15400. ], 10, _hoisted_10$2)) : createCommentVNode("v-if", true),
  15401. createElementVNode("button", {
  15402. type: "button",
  15403. class: "el-picker-panel__icon-btn d-arrow-right",
  15404. onClick: _cache[3] || (_cache[3] = (...args) => _ctx.rightNextYear && _ctx.rightNextYear(...args))
  15405. }, [
  15406. createVNode(_component_el_icon, null, {
  15407. default: withCtx(() => [
  15408. createVNode(_component_d_arrow_right)
  15409. ]),
  15410. _: 1
  15411. })
  15412. ]),
  15413. createElementVNode("div", null, toDisplayString(_ctx.rightLabel), 1)
  15414. ]),
  15415. createVNode(_component_month_table, {
  15416. "selection-mode": "range",
  15417. date: _ctx.rightDate,
  15418. "min-date": _ctx.minDate,
  15419. "max-date": _ctx.maxDate,
  15420. "range-state": _ctx.rangeState,
  15421. "disabled-date": _ctx.disabledDate,
  15422. onChangerange: _ctx.handleChangeRange,
  15423. onPick: _ctx.handleRangePick,
  15424. onSelect: _ctx.onSelect
  15425. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "onChangerange", "onPick", "onSelect"])
  15426. ])
  15427. ])
  15428. ])
  15429. ], 2);
  15430. }
  15431. var MonthRangePickPanel = /* @__PURE__ */ _export_sfc$1(_sfc_main$y, [["render", _sfc_render$e], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/date-picker/src/date-picker-com/panel-month-range.vue"]]);
  15432. dayjs.extend(localeData);
  15433. dayjs.extend(advancedFormat);
  15434. dayjs.extend(customParseFormat);
  15435. dayjs.extend(weekOfYear);
  15436. dayjs.extend(weekYear);
  15437. dayjs.extend(dayOfYear);
  15438. dayjs.extend(isSameOrAfter);
  15439. dayjs.extend(isSameOrBefore);
  15440. const getPanel = function(type4) {
  15441. if (type4 === "daterange" || type4 === "datetimerange") {
  15442. return DateRangePickPanel;
  15443. } else if (type4 === "monthrange") {
  15444. return MonthRangePickPanel;
  15445. }
  15446. return DatePickPanel;
  15447. };
  15448. var DatePicker = defineComponent({
  15449. name: "ElDatePicker",
  15450. install: null,
  15451. props: __spreadProps(__spreadValues({}, timePickerDefaultProps), {
  15452. type: {
  15453. type: String,
  15454. default: "date"
  15455. }
  15456. }),
  15457. emits: ["update:modelValue"],
  15458. setup(props, ctx) {
  15459. provide("ElPopperOptions", props.popperOptions);
  15460. provide(ROOT_PICKER_INJECTION_KEY, {
  15461. ctx
  15462. });
  15463. const commonPicker = ref(null);
  15464. const refProps = __spreadProps(__spreadValues({}, props), {
  15465. focus: (focusStartInput = true) => {
  15466. var _a2;
  15467. (_a2 = commonPicker.value) == null ? void 0 : _a2.focus(focusStartInput);
  15468. }
  15469. });
  15470. ctx.expose(refProps);
  15471. return () => {
  15472. var _a2;
  15473. const format2 = (_a2 = props.format) != null ? _a2 : DEFAULT_FORMATS_DATEPICKER[props.type] || DEFAULT_FORMATS_DATE;
  15474. return h$1(CommonPicker, __spreadProps(__spreadValues({}, props), {
  15475. format: format2,
  15476. type: props.type,
  15477. ref: commonPicker,
  15478. "onUpdate:modelValue": (value) => ctx.emit("update:modelValue", value)
  15479. }), {
  15480. default: (scopedProps) => h$1(getPanel(props.type), scopedProps),
  15481. "range-separator": () => renderSlot(ctx.slots, "range-separator")
  15482. });
  15483. };
  15484. }
  15485. });
  15486. const _DatePicker = DatePicker;
  15487. _DatePicker.install = (app) => {
  15488. app.component(_DatePicker.name, _DatePicker);
  15489. };
  15490. const ElDatePicker = _DatePicker;
  15491. const overlayProps = buildProps({
  15492. mask: {
  15493. type: Boolean,
  15494. default: true
  15495. },
  15496. customMaskEvent: {
  15497. type: Boolean,
  15498. default: false
  15499. },
  15500. overlayClass: {
  15501. type: definePropType([
  15502. String,
  15503. Array,
  15504. Object
  15505. ])
  15506. },
  15507. zIndex: {
  15508. type: definePropType([String, Number])
  15509. }
  15510. });
  15511. const overlayEmits = {
  15512. click: (evt) => evt instanceof MouseEvent
  15513. };
  15514. var Overlay = defineComponent({
  15515. name: "ElOverlay",
  15516. props: overlayProps,
  15517. emits: overlayEmits,
  15518. setup(props, { slots, emit }) {
  15519. const ns = useNamespace("overlay");
  15520. const onMaskClick = (e) => {
  15521. emit("click", e);
  15522. };
  15523. const { onClick, onMousedown, onMouseup } = useSameTarget(props.customMaskEvent ? void 0 : onMaskClick);
  15524. return () => {
  15525. return props.mask ? createVNode("div", {
  15526. class: [ns.b(), props.overlayClass],
  15527. style: {
  15528. zIndex: props.zIndex
  15529. },
  15530. onClick,
  15531. onMousedown,
  15532. onMouseup
  15533. }, [renderSlot(slots, "default")], PatchFlags.STYLE | PatchFlags.CLASS | PatchFlags.PROPS, ["onClick", "onMouseup", "onMousedown"]) : h$1("div", {
  15534. class: props.overlayClass,
  15535. style: {
  15536. zIndex: props.zIndex,
  15537. position: "fixed",
  15538. top: "0px",
  15539. right: "0px",
  15540. bottom: "0px",
  15541. left: "0px"
  15542. }
  15543. }, [renderSlot(slots, "default")]);
  15544. };
  15545. }
  15546. });
  15547. const ElOverlay = Overlay;
  15548. const dialogContentProps = buildProps({
  15549. center: {
  15550. type: Boolean,
  15551. default: false
  15552. },
  15553. closeIcon: {
  15554. type: iconPropType,
  15555. default: ""
  15556. },
  15557. customClass: {
  15558. type: String,
  15559. default: ""
  15560. },
  15561. draggable: {
  15562. type: Boolean,
  15563. default: false
  15564. },
  15565. fullscreen: {
  15566. type: Boolean,
  15567. default: false
  15568. },
  15569. showClose: {
  15570. type: Boolean,
  15571. default: true
  15572. },
  15573. title: {
  15574. type: String,
  15575. default: ""
  15576. }
  15577. });
  15578. const dialogContentEmits = {
  15579. close: () => true
  15580. };
  15581. const _hoisted_1$k = ["aria-label"];
  15582. const __default__$c = { name: "ElDialogContent" };
  15583. const _sfc_main$x = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$c), {
  15584. props: dialogContentProps,
  15585. emits: dialogContentEmits,
  15586. setup(__props) {
  15587. const { Close } = CloseComponents;
  15588. const { dialogRef, headerRef, ns, style } = inject(dialogInjectionKey);
  15589. return (_ctx, _cache) => {
  15590. return openBlock(), createElementBlock("div", {
  15591. ref_key: "dialogRef",
  15592. ref: dialogRef,
  15593. class: normalizeClass([
  15594. unref(ns).b(),
  15595. unref(ns).is("fullscreen", _ctx.fullscreen),
  15596. unref(ns).is("draggable", _ctx.draggable),
  15597. { [unref(ns).m("center")]: _ctx.center },
  15598. _ctx.customClass
  15599. ]),
  15600. "aria-modal": "true",
  15601. role: "dialog",
  15602. "aria-label": _ctx.title || "dialog",
  15603. style: normalizeStyle(unref(style)),
  15604. onClick: _cache[1] || (_cache[1] = withModifiers(() => {
  15605. }, ["stop"]))
  15606. }, [
  15607. createElementVNode("div", {
  15608. ref_key: "headerRef",
  15609. ref: headerRef,
  15610. class: normalizeClass(unref(ns).e("header"))
  15611. }, [
  15612. renderSlot(_ctx.$slots, "title", {}, () => [
  15613. createElementVNode("span", {
  15614. class: normalizeClass(unref(ns).e("title"))
  15615. }, toDisplayString(_ctx.title), 3)
  15616. ])
  15617. ], 2),
  15618. createElementVNode("div", {
  15619. class: normalizeClass(unref(ns).e("body"))
  15620. }, [
  15621. renderSlot(_ctx.$slots, "default")
  15622. ], 2),
  15623. _ctx.$slots.footer ? (openBlock(), createElementBlock("div", {
  15624. key: 0,
  15625. class: normalizeClass(unref(ns).e("footer"))
  15626. }, [
  15627. renderSlot(_ctx.$slots, "footer")
  15628. ], 2)) : createCommentVNode("v-if", true),
  15629. _ctx.showClose ? (openBlock(), createElementBlock("button", {
  15630. key: 1,
  15631. "aria-label": "close",
  15632. class: normalizeClass(unref(ns).e("headerbtn")),
  15633. type: "button",
  15634. onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("close"))
  15635. }, [
  15636. createVNode(unref(ElIcon), {
  15637. class: normalizeClass(unref(ns).e("close"))
  15638. }, {
  15639. default: withCtx(() => [
  15640. (openBlock(), createBlock(resolveDynamicComponent(_ctx.closeIcon || unref(Close))))
  15641. ]),
  15642. _: 1
  15643. }, 8, ["class"])
  15644. ], 2)) : createCommentVNode("v-if", true)
  15645. ], 14, _hoisted_1$k);
  15646. };
  15647. }
  15648. }));
  15649. var ElDialogContent = /* @__PURE__ */ _export_sfc$1(_sfc_main$x, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/dialog/src/dialog-content.vue"]]);
  15650. const dialogProps = buildProps(__spreadProps(__spreadValues({}, dialogContentProps), {
  15651. appendToBody: {
  15652. type: Boolean,
  15653. default: false
  15654. },
  15655. beforeClose: {
  15656. type: definePropType(Function)
  15657. },
  15658. destroyOnClose: {
  15659. type: Boolean,
  15660. default: false
  15661. },
  15662. closeOnClickModal: {
  15663. type: Boolean,
  15664. default: true
  15665. },
  15666. closeOnPressEscape: {
  15667. type: Boolean,
  15668. default: true
  15669. },
  15670. lockScroll: {
  15671. type: Boolean,
  15672. default: true
  15673. },
  15674. modal: {
  15675. type: Boolean,
  15676. default: true
  15677. },
  15678. openDelay: {
  15679. type: Number,
  15680. default: 0
  15681. },
  15682. closeDelay: {
  15683. type: Number,
  15684. default: 0
  15685. },
  15686. top: {
  15687. type: String
  15688. },
  15689. modelValue: {
  15690. type: Boolean,
  15691. required: true
  15692. },
  15693. modalClass: String,
  15694. width: {
  15695. type: [String, Number]
  15696. },
  15697. zIndex: {
  15698. type: Number
  15699. },
  15700. trapFocus: {
  15701. type: Boolean,
  15702. default: false
  15703. }
  15704. }));
  15705. const dialogEmits = {
  15706. open: () => true,
  15707. opened: () => true,
  15708. close: () => true,
  15709. closed: () => true,
  15710. [UPDATE_MODEL_EVENT]: (value) => isBoolean(value),
  15711. openAutoFocus: () => true,
  15712. closeAutoFocus: () => true
  15713. };
  15714. const useDialog = (props, targetRef) => {
  15715. const instance = getCurrentInstance();
  15716. const emit = instance.emit;
  15717. const { nextZIndex } = useZIndex();
  15718. let lastPosition = "";
  15719. const visible = ref(false);
  15720. const closed = ref(false);
  15721. const rendered = ref(false);
  15722. const zIndex2 = ref(props.zIndex || nextZIndex());
  15723. let openTimer = void 0;
  15724. let closeTimer = void 0;
  15725. const normalizeWidth = computed(() => isNumber(props.width) ? `${props.width}px` : props.width);
  15726. const style = computed(() => {
  15727. const style2 = {};
  15728. const varPrefix = `--el-dialog`;
  15729. if (!props.fullscreen) {
  15730. if (props.top) {
  15731. style2[`${varPrefix}-margin-top`] = props.top;
  15732. }
  15733. if (props.width) {
  15734. style2[`${varPrefix}-width`] = normalizeWidth.value;
  15735. }
  15736. }
  15737. return style2;
  15738. });
  15739. function afterEnter() {
  15740. emit("opened");
  15741. }
  15742. function afterLeave() {
  15743. emit("closed");
  15744. emit(UPDATE_MODEL_EVENT, false);
  15745. if (props.destroyOnClose) {
  15746. rendered.value = false;
  15747. }
  15748. }
  15749. function beforeLeave() {
  15750. emit("close");
  15751. }
  15752. function open() {
  15753. closeTimer == null ? void 0 : closeTimer();
  15754. openTimer == null ? void 0 : openTimer();
  15755. if (props.openDelay && props.openDelay > 0) {
  15756. ({ stop: openTimer } = useTimeoutFn(() => doOpen(), props.openDelay));
  15757. } else {
  15758. doOpen();
  15759. }
  15760. }
  15761. function close2() {
  15762. openTimer == null ? void 0 : openTimer();
  15763. closeTimer == null ? void 0 : closeTimer();
  15764. if (props.closeDelay && props.closeDelay > 0) {
  15765. ({ stop: closeTimer } = useTimeoutFn(() => doClose(), props.closeDelay));
  15766. } else {
  15767. doClose();
  15768. }
  15769. }
  15770. function handleClose() {
  15771. function hide2(shouldCancel) {
  15772. if (shouldCancel)
  15773. return;
  15774. closed.value = true;
  15775. visible.value = false;
  15776. }
  15777. if (props.beforeClose) {
  15778. props.beforeClose(hide2);
  15779. } else {
  15780. close2();
  15781. }
  15782. }
  15783. function onModalClick() {
  15784. if (props.closeOnClickModal) {
  15785. handleClose();
  15786. }
  15787. }
  15788. function doOpen() {
  15789. if (!isClient$1)
  15790. return;
  15791. visible.value = true;
  15792. }
  15793. function doClose() {
  15794. visible.value = false;
  15795. }
  15796. if (props.lockScroll) {
  15797. useLockscreen(visible);
  15798. }
  15799. if (props.closeOnPressEscape) {
  15800. useModal({
  15801. handleClose
  15802. }, visible);
  15803. }
  15804. useRestoreActive(visible);
  15805. watch(() => props.modelValue, (val) => {
  15806. if (val) {
  15807. closed.value = false;
  15808. open();
  15809. rendered.value = true;
  15810. emit("open");
  15811. zIndex2.value = props.zIndex ? zIndex2.value++ : nextZIndex();
  15812. nextTick(() => {
  15813. if (targetRef.value) {
  15814. targetRef.value.scrollTop = 0;
  15815. }
  15816. });
  15817. } else {
  15818. if (visible.value) {
  15819. close2();
  15820. }
  15821. }
  15822. });
  15823. watch(() => props.fullscreen, (val) => {
  15824. if (!targetRef.value)
  15825. return;
  15826. if (val) {
  15827. lastPosition = targetRef.value.style.transform;
  15828. targetRef.value.style.transform = "";
  15829. } else {
  15830. targetRef.value.style.transform = lastPosition;
  15831. }
  15832. });
  15833. onMounted(() => {
  15834. if (props.modelValue) {
  15835. visible.value = true;
  15836. rendered.value = true;
  15837. open();
  15838. }
  15839. });
  15840. return {
  15841. afterEnter,
  15842. afterLeave,
  15843. beforeLeave,
  15844. handleClose,
  15845. onModalClick,
  15846. close: close2,
  15847. doClose,
  15848. closed,
  15849. style,
  15850. rendered,
  15851. visible,
  15852. zIndex: zIndex2
  15853. };
  15854. };
  15855. const __default__$b = {
  15856. name: "ElDialog"
  15857. };
  15858. const _sfc_main$w = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$b), {
  15859. props: dialogProps,
  15860. emits: dialogEmits,
  15861. setup(__props, { expose }) {
  15862. const props = __props;
  15863. const ns = useNamespace("dialog");
  15864. const dialogRef = ref();
  15865. const headerRef = ref();
  15866. const {
  15867. visible,
  15868. style,
  15869. rendered,
  15870. zIndex: zIndex2,
  15871. afterEnter,
  15872. afterLeave,
  15873. beforeLeave,
  15874. handleClose,
  15875. onModalClick
  15876. } = useDialog(props, dialogRef);
  15877. provide(dialogInjectionKey, {
  15878. dialogRef,
  15879. headerRef,
  15880. ns,
  15881. rendered,
  15882. style
  15883. });
  15884. const overlayEvent = useSameTarget(onModalClick);
  15885. const draggable = computed(() => props.draggable && !props.fullscreen);
  15886. useDraggable(dialogRef, headerRef, draggable);
  15887. expose({
  15888. visible
  15889. });
  15890. return (_ctx, _cache) => {
  15891. return openBlock(), createBlock(Teleport, {
  15892. to: "body",
  15893. disabled: !_ctx.appendToBody
  15894. }, [
  15895. createVNode(Transition, {
  15896. name: "dialog-fade",
  15897. onAfterEnter: unref(afterEnter),
  15898. onAfterLeave: unref(afterLeave),
  15899. onBeforeLeave: unref(beforeLeave)
  15900. }, {
  15901. default: withCtx(() => [
  15902. withDirectives(createVNode(unref(ElOverlay), {
  15903. "custom-mask-event": "",
  15904. mask: _ctx.modal,
  15905. "overlay-class": _ctx.modalClass,
  15906. "z-index": unref(zIndex2)
  15907. }, {
  15908. default: withCtx(() => [
  15909. createElementVNode("div", {
  15910. class: normalizeClass(`${unref(ns).namespace.value}-overlay-dialog`),
  15911. onClick: _cache[0] || (_cache[0] = (...args) => unref(overlayEvent).onClick && unref(overlayEvent).onClick(...args)),
  15912. onMousedown: _cache[1] || (_cache[1] = (...args) => unref(overlayEvent).onMousedown && unref(overlayEvent).onMousedown(...args)),
  15913. onMouseup: _cache[2] || (_cache[2] = (...args) => unref(overlayEvent).onMouseup && unref(overlayEvent).onMouseup(...args))
  15914. }, [
  15915. unref(rendered) ? (openBlock(), createBlock(ElDialogContent, {
  15916. key: 0,
  15917. "custom-class": _ctx.customClass,
  15918. center: _ctx.center,
  15919. "close-icon": _ctx.closeIcon,
  15920. draggable: unref(draggable),
  15921. fullscreen: _ctx.fullscreen,
  15922. "show-close": _ctx.showClose,
  15923. style: normalizeStyle(unref(style)),
  15924. title: _ctx.title,
  15925. onClose: unref(handleClose)
  15926. }, createSlots({
  15927. title: withCtx(() => [
  15928. renderSlot(_ctx.$slots, "title")
  15929. ]),
  15930. default: withCtx(() => [
  15931. renderSlot(_ctx.$slots, "default")
  15932. ]),
  15933. _: 2
  15934. }, [
  15935. _ctx.$slots.footer ? {
  15936. name: "footer",
  15937. fn: withCtx(() => [
  15938. renderSlot(_ctx.$slots, "footer")
  15939. ])
  15940. } : void 0
  15941. ]), 1032, ["custom-class", "center", "close-icon", "draggable", "fullscreen", "show-close", "style", "title", "onClose"])) : createCommentVNode("v-if", true)
  15942. ], 34)
  15943. ]),
  15944. _: 3
  15945. }, 8, ["mask", "overlay-class", "z-index"]), [
  15946. [vShow, unref(visible)]
  15947. ])
  15948. ]),
  15949. _: 3
  15950. }, 8, ["onAfterEnter", "onAfterLeave", "onBeforeLeave"])
  15951. ], 8, ["disabled"]);
  15952. };
  15953. }
  15954. }));
  15955. var Dialog = /* @__PURE__ */ _export_sfc$1(_sfc_main$w, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/dialog/src/dialog.vue"]]);
  15956. const ElDialog = withInstall(Dialog);
  15957. const dividerProps = buildProps({
  15958. direction: {
  15959. type: String,
  15960. values: ["horizontal", "vertical"],
  15961. default: "horizontal"
  15962. },
  15963. contentPosition: {
  15964. type: String,
  15965. values: ["left", "center", "right"],
  15966. default: "center"
  15967. },
  15968. borderStyle: {
  15969. type: definePropType(String),
  15970. default: "solid"
  15971. }
  15972. });
  15973. const __default__$a = {
  15974. name: "ElDivider"
  15975. };
  15976. const _sfc_main$v = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$a), {
  15977. props: dividerProps,
  15978. setup(__props) {
  15979. const props = __props;
  15980. const ns = useNamespace("divider");
  15981. const dividerStyle = computed(() => {
  15982. return {
  15983. "--el-border-style": props.borderStyle
  15984. };
  15985. });
  15986. return (_ctx, _cache) => {
  15987. return openBlock(), createElementBlock("div", {
  15988. class: normalizeClass([unref(ns).b(), unref(ns).m(_ctx.direction)]),
  15989. style: normalizeStyle(unref(dividerStyle))
  15990. }, [
  15991. _ctx.$slots.default && _ctx.direction !== "vertical" ? (openBlock(), createElementBlock("div", {
  15992. key: 0,
  15993. class: normalizeClass([unref(ns).e("text"), unref(ns).is(_ctx.contentPosition)])
  15994. }, [
  15995. renderSlot(_ctx.$slots, "default")
  15996. ], 2)) : createCommentVNode("v-if", true)
  15997. ], 6);
  15998. };
  15999. }
  16000. }));
  16001. var Divider = /* @__PURE__ */ _export_sfc$1(_sfc_main$v, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/divider/src/divider.vue"]]);
  16002. const ElDivider = withInstall(Divider);
  16003. const formProps = buildProps({
  16004. model: Object,
  16005. rules: {
  16006. type: definePropType(Object)
  16007. },
  16008. labelPosition: String,
  16009. labelWidth: {
  16010. type: [String, Number],
  16011. default: ""
  16012. },
  16013. labelSuffix: {
  16014. type: String,
  16015. default: ""
  16016. },
  16017. inline: Boolean,
  16018. inlineMessage: Boolean,
  16019. statusIcon: Boolean,
  16020. showMessage: {
  16021. type: Boolean,
  16022. default: true
  16023. },
  16024. size: {
  16025. type: String,
  16026. values: componentSizes
  16027. },
  16028. disabled: Boolean,
  16029. validateOnRuleChange: {
  16030. type: Boolean,
  16031. default: true
  16032. },
  16033. hideRequiredAsterisk: {
  16034. type: Boolean,
  16035. default: false
  16036. },
  16037. scrollToError: Boolean
  16038. });
  16039. const formEmits = {
  16040. validate: (prop, isValid, message) => (isArray(prop) || isString(prop)) && isBoolean(isValid) && isString(message)
  16041. };
  16042. function useFormLabelWidth() {
  16043. const potentialLabelWidthArr = ref([]);
  16044. const autoLabelWidth = computed(() => {
  16045. if (!potentialLabelWidthArr.value.length)
  16046. return "0";
  16047. const max2 = Math.max(...potentialLabelWidthArr.value);
  16048. return max2 ? `${max2}px` : "";
  16049. });
  16050. function getLabelWidthIndex(width) {
  16051. const index = potentialLabelWidthArr.value.indexOf(width);
  16052. return index;
  16053. }
  16054. function registerLabelWidth(val, oldVal) {
  16055. if (val && oldVal) {
  16056. const index = getLabelWidthIndex(oldVal);
  16057. potentialLabelWidthArr.value.splice(index, 1, val);
  16058. } else if (val) {
  16059. potentialLabelWidthArr.value.push(val);
  16060. }
  16061. }
  16062. function deregisterLabelWidth(val) {
  16063. const index = getLabelWidthIndex(val);
  16064. if (index > -1) {
  16065. potentialLabelWidthArr.value.splice(index, 1);
  16066. }
  16067. }
  16068. return {
  16069. autoLabelWidth,
  16070. registerLabelWidth,
  16071. deregisterLabelWidth
  16072. };
  16073. }
  16074. const filterFields = (fields, props) => {
  16075. const normalized = castArray$1(props);
  16076. return normalized.length > 0 ? fields.filter((field) => field.prop && normalized.includes(field.prop)) : fields;
  16077. };
  16078. const __default__$9 = {
  16079. name: "ElForm"
  16080. };
  16081. const _sfc_main$u = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$9), {
  16082. props: formProps,
  16083. emits: formEmits,
  16084. setup(__props, { expose, emit }) {
  16085. const props = __props;
  16086. const fields = [];
  16087. const formSize = useSize();
  16088. const ns = useNamespace("form");
  16089. const formClasses = computed(() => {
  16090. const { labelPosition, inline } = props;
  16091. return [
  16092. ns.b(),
  16093. ns.m(formSize.value || "default"),
  16094. {
  16095. [ns.m(`label-${labelPosition}`)]: labelPosition,
  16096. [ns.m("inline")]: inline
  16097. }
  16098. ];
  16099. });
  16100. const addField = (field) => {
  16101. fields.push(field);
  16102. };
  16103. const removeField = (field) => {
  16104. if (field.prop) {
  16105. fields.splice(fields.indexOf(field), 1);
  16106. }
  16107. };
  16108. const resetFields = (properties = []) => {
  16109. if (!props.model) {
  16110. return;
  16111. }
  16112. filterFields(fields, properties).forEach((field) => field.resetField());
  16113. };
  16114. const clearValidate = (props2 = []) => {
  16115. filterFields(fields, props2).forEach((field) => field.clearValidate());
  16116. };
  16117. const isValidatable = computed(() => {
  16118. const hasModel = !!props.model;
  16119. return hasModel;
  16120. });
  16121. const obtainValidateFields = (props2) => {
  16122. if (fields.length === 0)
  16123. return [];
  16124. const filteredFields = filterFields(fields, props2);
  16125. if (!filteredFields.length) {
  16126. return [];
  16127. }
  16128. return filteredFields;
  16129. };
  16130. const validate = async (callback) => validateField(void 0, callback);
  16131. const doValidateField = async (props2 = []) => {
  16132. if (!isValidatable.value)
  16133. return false;
  16134. const fields2 = obtainValidateFields(props2);
  16135. if (fields2.length === 0)
  16136. return true;
  16137. let validationErrors = {};
  16138. for (const field of fields2) {
  16139. try {
  16140. await field.validate("");
  16141. } catch (fields3) {
  16142. validationErrors = __spreadValues(__spreadValues({}, validationErrors), fields3);
  16143. }
  16144. }
  16145. if (Object.keys(validationErrors).length === 0)
  16146. return true;
  16147. return Promise.reject(validationErrors);
  16148. };
  16149. const validateField = async (modelProps = [], callback) => {
  16150. const shouldThrow = !isFunction(callback);
  16151. try {
  16152. const result = await doValidateField(modelProps);
  16153. if (result === true) {
  16154. callback == null ? void 0 : callback(result);
  16155. }
  16156. return result;
  16157. } catch (e) {
  16158. const invalidFields = e;
  16159. if (props.scrollToError) {
  16160. scrollToField(Object.keys(invalidFields)[0]);
  16161. }
  16162. callback == null ? void 0 : callback(false, invalidFields);
  16163. return shouldThrow && Promise.reject(invalidFields);
  16164. }
  16165. };
  16166. const scrollToField = (prop) => {
  16167. var _a2;
  16168. const field = filterFields(fields, prop)[0];
  16169. if (field) {
  16170. (_a2 = field.$el) == null ? void 0 : _a2.scrollIntoView();
  16171. }
  16172. };
  16173. watch(() => props.rules, () => {
  16174. if (props.validateOnRuleChange)
  16175. validate();
  16176. }, { deep: true });
  16177. provide(formContextKey, reactive(__spreadValues(__spreadProps(__spreadValues({}, toRefs(props)), {
  16178. emit,
  16179. resetFields,
  16180. clearValidate,
  16181. validateField,
  16182. addField,
  16183. removeField
  16184. }), useFormLabelWidth())));
  16185. expose({
  16186. validate,
  16187. validateField,
  16188. resetFields,
  16189. clearValidate,
  16190. scrollToField
  16191. });
  16192. return (_ctx, _cache) => {
  16193. return openBlock(), createElementBlock("form", {
  16194. class: normalizeClass(unref(formClasses))
  16195. }, [
  16196. renderSlot(_ctx.$slots, "default")
  16197. ], 2);
  16198. };
  16199. }
  16200. }));
  16201. var Form = /* @__PURE__ */ _export_sfc$1(_sfc_main$u, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/form/src/form.vue"]]);
  16202. function _extends$1() {
  16203. _extends$1 = Object.assign || function(target) {
  16204. for (var i = 1; i < arguments.length; i++) {
  16205. var source = arguments[i];
  16206. for (var key in source) {
  16207. if (Object.prototype.hasOwnProperty.call(source, key)) {
  16208. target[key] = source[key];
  16209. }
  16210. }
  16211. }
  16212. return target;
  16213. };
  16214. return _extends$1.apply(this, arguments);
  16215. }
  16216. function _inheritsLoose(subClass, superClass) {
  16217. subClass.prototype = Object.create(superClass.prototype);
  16218. subClass.prototype.constructor = subClass;
  16219. _setPrototypeOf(subClass, superClass);
  16220. }
  16221. function _getPrototypeOf(o2) {
  16222. _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf2(o3) {
  16223. return o3.__proto__ || Object.getPrototypeOf(o3);
  16224. };
  16225. return _getPrototypeOf(o2);
  16226. }
  16227. function _setPrototypeOf(o2, p2) {
  16228. _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf2(o3, p3) {
  16229. o3.__proto__ = p3;
  16230. return o3;
  16231. };
  16232. return _setPrototypeOf(o2, p2);
  16233. }
  16234. function _isNativeReflectConstruct() {
  16235. if (typeof Reflect === "undefined" || !Reflect.construct)
  16236. return false;
  16237. if (Reflect.construct.sham)
  16238. return false;
  16239. if (typeof Proxy === "function")
  16240. return true;
  16241. try {
  16242. Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
  16243. }));
  16244. return true;
  16245. } catch (e) {
  16246. return false;
  16247. }
  16248. }
  16249. function _construct(Parent, args, Class) {
  16250. if (_isNativeReflectConstruct()) {
  16251. _construct = Reflect.construct;
  16252. } else {
  16253. _construct = function _construct2(Parent2, args2, Class2) {
  16254. var a2 = [null];
  16255. a2.push.apply(a2, args2);
  16256. var Constructor = Function.bind.apply(Parent2, a2);
  16257. var instance = new Constructor();
  16258. if (Class2)
  16259. _setPrototypeOf(instance, Class2.prototype);
  16260. return instance;
  16261. };
  16262. }
  16263. return _construct.apply(null, arguments);
  16264. }
  16265. function _isNativeFunction(fn2) {
  16266. return Function.toString.call(fn2).indexOf("[native code]") !== -1;
  16267. }
  16268. function _wrapNativeSuper(Class) {
  16269. var _cache = typeof Map === "function" ? /* @__PURE__ */ new Map() : void 0;
  16270. _wrapNativeSuper = function _wrapNativeSuper2(Class2) {
  16271. if (Class2 === null || !_isNativeFunction(Class2))
  16272. return Class2;
  16273. if (typeof Class2 !== "function") {
  16274. throw new TypeError("Super expression must either be null or a function");
  16275. }
  16276. if (typeof _cache !== "undefined") {
  16277. if (_cache.has(Class2))
  16278. return _cache.get(Class2);
  16279. _cache.set(Class2, Wrapper);
  16280. }
  16281. function Wrapper() {
  16282. return _construct(Class2, arguments, _getPrototypeOf(this).constructor);
  16283. }
  16284. Wrapper.prototype = Object.create(Class2.prototype, {
  16285. constructor: {
  16286. value: Wrapper,
  16287. enumerable: false,
  16288. writable: true,
  16289. configurable: true
  16290. }
  16291. });
  16292. return _setPrototypeOf(Wrapper, Class2);
  16293. };
  16294. return _wrapNativeSuper(Class);
  16295. }
  16296. var formatRegExp = /%[sdj%]/g;
  16297. var warning = function warning2() {
  16298. };
  16299. if (typeof process !== "undefined" && process.env && false) {
  16300. warning = function warning3(type4, errors) {
  16301. if (typeof console !== "undefined" && console.warn && typeof ASYNC_VALIDATOR_NO_WARNING === "undefined") {
  16302. if (errors.every(function(e) {
  16303. return typeof e === "string";
  16304. })) {
  16305. console.warn(type4, errors);
  16306. }
  16307. }
  16308. };
  16309. }
  16310. function convertFieldsError(errors) {
  16311. if (!errors || !errors.length)
  16312. return null;
  16313. var fields = {};
  16314. errors.forEach(function(error) {
  16315. var field = error.field;
  16316. fields[field] = fields[field] || [];
  16317. fields[field].push(error);
  16318. });
  16319. return fields;
  16320. }
  16321. function format(template) {
  16322. for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  16323. args[_key - 1] = arguments[_key];
  16324. }
  16325. var i = 0;
  16326. var len = args.length;
  16327. if (typeof template === "function") {
  16328. return template.apply(null, args);
  16329. }
  16330. if (typeof template === "string") {
  16331. var str = template.replace(formatRegExp, function(x2) {
  16332. if (x2 === "%%") {
  16333. return "%";
  16334. }
  16335. if (i >= len) {
  16336. return x2;
  16337. }
  16338. switch (x2) {
  16339. case "%s":
  16340. return String(args[i++]);
  16341. case "%d":
  16342. return Number(args[i++]);
  16343. case "%j":
  16344. try {
  16345. return JSON.stringify(args[i++]);
  16346. } catch (_2) {
  16347. return "[Circular]";
  16348. }
  16349. break;
  16350. default:
  16351. return x2;
  16352. }
  16353. });
  16354. return str;
  16355. }
  16356. return template;
  16357. }
  16358. function isNativeStringType(type4) {
  16359. return type4 === "string" || type4 === "url" || type4 === "hex" || type4 === "email" || type4 === "date" || type4 === "pattern";
  16360. }
  16361. function isEmptyValue(value, type4) {
  16362. if (value === void 0 || value === null) {
  16363. return true;
  16364. }
  16365. if (type4 === "array" && Array.isArray(value) && !value.length) {
  16366. return true;
  16367. }
  16368. if (isNativeStringType(type4) && typeof value === "string" && !value) {
  16369. return true;
  16370. }
  16371. return false;
  16372. }
  16373. function asyncParallelArray(arr, func, callback) {
  16374. var results = [];
  16375. var total = 0;
  16376. var arrLength = arr.length;
  16377. function count(errors) {
  16378. results.push.apply(results, errors || []);
  16379. total++;
  16380. if (total === arrLength) {
  16381. callback(results);
  16382. }
  16383. }
  16384. arr.forEach(function(a2) {
  16385. func(a2, count);
  16386. });
  16387. }
  16388. function asyncSerialArray(arr, func, callback) {
  16389. var index = 0;
  16390. var arrLength = arr.length;
  16391. function next(errors) {
  16392. if (errors && errors.length) {
  16393. callback(errors);
  16394. return;
  16395. }
  16396. var original = index;
  16397. index = index + 1;
  16398. if (original < arrLength) {
  16399. func(arr[original], next);
  16400. } else {
  16401. callback([]);
  16402. }
  16403. }
  16404. next([]);
  16405. }
  16406. function flattenObjArr(objArr) {
  16407. var ret = [];
  16408. Object.keys(objArr).forEach(function(k) {
  16409. ret.push.apply(ret, objArr[k] || []);
  16410. });
  16411. return ret;
  16412. }
  16413. var AsyncValidationError = /* @__PURE__ */ function(_Error) {
  16414. _inheritsLoose(AsyncValidationError2, _Error);
  16415. function AsyncValidationError2(errors, fields) {
  16416. var _this;
  16417. _this = _Error.call(this, "Async Validation Error") || this;
  16418. _this.errors = errors;
  16419. _this.fields = fields;
  16420. return _this;
  16421. }
  16422. return AsyncValidationError2;
  16423. }(/* @__PURE__ */ _wrapNativeSuper(Error));
  16424. function asyncMap(objArr, option, func, callback, source) {
  16425. if (option.first) {
  16426. var _pending = new Promise(function(resolve, reject) {
  16427. var next = function next2(errors) {
  16428. callback(errors);
  16429. return errors.length ? reject(new AsyncValidationError(errors, convertFieldsError(errors))) : resolve(source);
  16430. };
  16431. var flattenArr = flattenObjArr(objArr);
  16432. asyncSerialArray(flattenArr, func, next);
  16433. });
  16434. _pending["catch"](function(e) {
  16435. return e;
  16436. });
  16437. return _pending;
  16438. }
  16439. var firstFields = option.firstFields === true ? Object.keys(objArr) : option.firstFields || [];
  16440. var objArrKeys = Object.keys(objArr);
  16441. var objArrLength = objArrKeys.length;
  16442. var total = 0;
  16443. var results = [];
  16444. var pending = new Promise(function(resolve, reject) {
  16445. var next = function next2(errors) {
  16446. results.push.apply(results, errors);
  16447. total++;
  16448. if (total === objArrLength) {
  16449. callback(results);
  16450. return results.length ? reject(new AsyncValidationError(results, convertFieldsError(results))) : resolve(source);
  16451. }
  16452. };
  16453. if (!objArrKeys.length) {
  16454. callback(results);
  16455. resolve(source);
  16456. }
  16457. objArrKeys.forEach(function(key) {
  16458. var arr = objArr[key];
  16459. if (firstFields.indexOf(key) !== -1) {
  16460. asyncSerialArray(arr, func, next);
  16461. } else {
  16462. asyncParallelArray(arr, func, next);
  16463. }
  16464. });
  16465. });
  16466. pending["catch"](function(e) {
  16467. return e;
  16468. });
  16469. return pending;
  16470. }
  16471. function isErrorObj(obj) {
  16472. return !!(obj && obj.message !== void 0);
  16473. }
  16474. function getValue(value, path) {
  16475. var v2 = value;
  16476. for (var i = 0; i < path.length; i++) {
  16477. if (v2 == void 0) {
  16478. return v2;
  16479. }
  16480. v2 = v2[path[i]];
  16481. }
  16482. return v2;
  16483. }
  16484. function complementError(rule, source) {
  16485. return function(oe) {
  16486. var fieldValue;
  16487. if (rule.fullFields) {
  16488. fieldValue = getValue(source, rule.fullFields);
  16489. } else {
  16490. fieldValue = source[oe.field || rule.fullField];
  16491. }
  16492. if (isErrorObj(oe)) {
  16493. oe.field = oe.field || rule.fullField;
  16494. oe.fieldValue = fieldValue;
  16495. return oe;
  16496. }
  16497. return {
  16498. message: typeof oe === "function" ? oe() : oe,
  16499. fieldValue,
  16500. field: oe.field || rule.fullField
  16501. };
  16502. };
  16503. }
  16504. function deepMerge(target, source) {
  16505. if (source) {
  16506. for (var s2 in source) {
  16507. if (source.hasOwnProperty(s2)) {
  16508. var value = source[s2];
  16509. if (typeof value === "object" && typeof target[s2] === "object") {
  16510. target[s2] = _extends$1({}, target[s2], value);
  16511. } else {
  16512. target[s2] = value;
  16513. }
  16514. }
  16515. }
  16516. }
  16517. return target;
  16518. }
  16519. var required$1 = function required(rule, value, source, errors, options, type4) {
  16520. if (rule.required && (!source.hasOwnProperty(rule.field) || isEmptyValue(value, type4 || rule.type))) {
  16521. errors.push(format(options.messages.required, rule.fullField));
  16522. }
  16523. };
  16524. var whitespace = function whitespace2(rule, value, source, errors, options) {
  16525. if (/^\s+$/.test(value) || value === "") {
  16526. errors.push(format(options.messages.whitespace, rule.fullField));
  16527. }
  16528. };
  16529. var pattern$2 = {
  16530. email: /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+\.)+[a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}))$/,
  16531. url: new RegExp("^(?!mailto:)(?:(?:http|https|ftp)://|//)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))|localhost)(?::\\d{2,5})?(?:(/|\\?|#)[^\\s]*)?$", "i"),
  16532. hex: /^#?([a-f0-9]{6}|[a-f0-9]{3})$/i
  16533. };
  16534. var types = {
  16535. integer: function integer(value) {
  16536. return types.number(value) && parseInt(value, 10) === value;
  16537. },
  16538. "float": function float(value) {
  16539. return types.number(value) && !types.integer(value);
  16540. },
  16541. array: function array(value) {
  16542. return Array.isArray(value);
  16543. },
  16544. regexp: function regexp(value) {
  16545. if (value instanceof RegExp) {
  16546. return true;
  16547. }
  16548. try {
  16549. return !!new RegExp(value);
  16550. } catch (e) {
  16551. return false;
  16552. }
  16553. },
  16554. date: function date(value) {
  16555. return typeof value.getTime === "function" && typeof value.getMonth === "function" && typeof value.getYear === "function" && !isNaN(value.getTime());
  16556. },
  16557. number: function number(value) {
  16558. if (isNaN(value)) {
  16559. return false;
  16560. }
  16561. return typeof value === "number";
  16562. },
  16563. object: function object(value) {
  16564. return typeof value === "object" && !types.array(value);
  16565. },
  16566. method: function method(value) {
  16567. return typeof value === "function";
  16568. },
  16569. email: function email(value) {
  16570. return typeof value === "string" && value.length <= 320 && !!value.match(pattern$2.email);
  16571. },
  16572. url: function url(value) {
  16573. return typeof value === "string" && value.length <= 2048 && !!value.match(pattern$2.url);
  16574. },
  16575. hex: function hex(value) {
  16576. return typeof value === "string" && !!value.match(pattern$2.hex);
  16577. }
  16578. };
  16579. var type$1 = function type(rule, value, source, errors, options) {
  16580. if (rule.required && value === void 0) {
  16581. required$1(rule, value, source, errors, options);
  16582. return;
  16583. }
  16584. var custom = ["integer", "float", "array", "regexp", "object", "method", "email", "number", "date", "url", "hex"];
  16585. var ruleType = rule.type;
  16586. if (custom.indexOf(ruleType) > -1) {
  16587. if (!types[ruleType](value)) {
  16588. errors.push(format(options.messages.types[ruleType], rule.fullField, rule.type));
  16589. }
  16590. } else if (ruleType && typeof value !== rule.type) {
  16591. errors.push(format(options.messages.types[ruleType], rule.fullField, rule.type));
  16592. }
  16593. };
  16594. var range = function range2(rule, value, source, errors, options) {
  16595. var len = typeof rule.len === "number";
  16596. var min2 = typeof rule.min === "number";
  16597. var max2 = typeof rule.max === "number";
  16598. var spRegexp = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
  16599. var val = value;
  16600. var key = null;
  16601. var num = typeof value === "number";
  16602. var str = typeof value === "string";
  16603. var arr = Array.isArray(value);
  16604. if (num) {
  16605. key = "number";
  16606. } else if (str) {
  16607. key = "string";
  16608. } else if (arr) {
  16609. key = "array";
  16610. }
  16611. if (!key) {
  16612. return false;
  16613. }
  16614. if (arr) {
  16615. val = value.length;
  16616. }
  16617. if (str) {
  16618. val = value.replace(spRegexp, "_").length;
  16619. }
  16620. if (len) {
  16621. if (val !== rule.len) {
  16622. errors.push(format(options.messages[key].len, rule.fullField, rule.len));
  16623. }
  16624. } else if (min2 && !max2 && val < rule.min) {
  16625. errors.push(format(options.messages[key].min, rule.fullField, rule.min));
  16626. } else if (max2 && !min2 && val > rule.max) {
  16627. errors.push(format(options.messages[key].max, rule.fullField, rule.max));
  16628. } else if (min2 && max2 && (val < rule.min || val > rule.max)) {
  16629. errors.push(format(options.messages[key].range, rule.fullField, rule.min, rule.max));
  16630. }
  16631. };
  16632. var ENUM$1 = "enum";
  16633. var enumerable$1 = function enumerable(rule, value, source, errors, options) {
  16634. rule[ENUM$1] = Array.isArray(rule[ENUM$1]) ? rule[ENUM$1] : [];
  16635. if (rule[ENUM$1].indexOf(value) === -1) {
  16636. errors.push(format(options.messages[ENUM$1], rule.fullField, rule[ENUM$1].join(", ")));
  16637. }
  16638. };
  16639. var pattern$1 = function pattern(rule, value, source, errors, options) {
  16640. if (rule.pattern) {
  16641. if (rule.pattern instanceof RegExp) {
  16642. rule.pattern.lastIndex = 0;
  16643. if (!rule.pattern.test(value)) {
  16644. errors.push(format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern));
  16645. }
  16646. } else if (typeof rule.pattern === "string") {
  16647. var _pattern = new RegExp(rule.pattern);
  16648. if (!_pattern.test(value)) {
  16649. errors.push(format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern));
  16650. }
  16651. }
  16652. }
  16653. };
  16654. var rules = {
  16655. required: required$1,
  16656. whitespace,
  16657. type: type$1,
  16658. range,
  16659. "enum": enumerable$1,
  16660. pattern: pattern$1
  16661. };
  16662. var string = function string2(rule, value, callback, source, options) {
  16663. var errors = [];
  16664. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16665. if (validate) {
  16666. if (isEmptyValue(value, "string") && !rule.required) {
  16667. return callback();
  16668. }
  16669. rules.required(rule, value, source, errors, options, "string");
  16670. if (!isEmptyValue(value, "string")) {
  16671. rules.type(rule, value, source, errors, options);
  16672. rules.range(rule, value, source, errors, options);
  16673. rules.pattern(rule, value, source, errors, options);
  16674. if (rule.whitespace === true) {
  16675. rules.whitespace(rule, value, source, errors, options);
  16676. }
  16677. }
  16678. }
  16679. callback(errors);
  16680. };
  16681. var method2 = function method3(rule, value, callback, source, options) {
  16682. var errors = [];
  16683. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16684. if (validate) {
  16685. if (isEmptyValue(value) && !rule.required) {
  16686. return callback();
  16687. }
  16688. rules.required(rule, value, source, errors, options);
  16689. if (value !== void 0) {
  16690. rules.type(rule, value, source, errors, options);
  16691. }
  16692. }
  16693. callback(errors);
  16694. };
  16695. var number2 = function number3(rule, value, callback, source, options) {
  16696. var errors = [];
  16697. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16698. if (validate) {
  16699. if (value === "") {
  16700. value = void 0;
  16701. }
  16702. if (isEmptyValue(value) && !rule.required) {
  16703. return callback();
  16704. }
  16705. rules.required(rule, value, source, errors, options);
  16706. if (value !== void 0) {
  16707. rules.type(rule, value, source, errors, options);
  16708. rules.range(rule, value, source, errors, options);
  16709. }
  16710. }
  16711. callback(errors);
  16712. };
  16713. var _boolean = function _boolean2(rule, value, callback, source, options) {
  16714. var errors = [];
  16715. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16716. if (validate) {
  16717. if (isEmptyValue(value) && !rule.required) {
  16718. return callback();
  16719. }
  16720. rules.required(rule, value, source, errors, options);
  16721. if (value !== void 0) {
  16722. rules.type(rule, value, source, errors, options);
  16723. }
  16724. }
  16725. callback(errors);
  16726. };
  16727. var regexp2 = function regexp3(rule, value, callback, source, options) {
  16728. var errors = [];
  16729. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16730. if (validate) {
  16731. if (isEmptyValue(value) && !rule.required) {
  16732. return callback();
  16733. }
  16734. rules.required(rule, value, source, errors, options);
  16735. if (!isEmptyValue(value)) {
  16736. rules.type(rule, value, source, errors, options);
  16737. }
  16738. }
  16739. callback(errors);
  16740. };
  16741. var integer2 = function integer3(rule, value, callback, source, options) {
  16742. var errors = [];
  16743. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16744. if (validate) {
  16745. if (isEmptyValue(value) && !rule.required) {
  16746. return callback();
  16747. }
  16748. rules.required(rule, value, source, errors, options);
  16749. if (value !== void 0) {
  16750. rules.type(rule, value, source, errors, options);
  16751. rules.range(rule, value, source, errors, options);
  16752. }
  16753. }
  16754. callback(errors);
  16755. };
  16756. var floatFn = function floatFn2(rule, value, callback, source, options) {
  16757. var errors = [];
  16758. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16759. if (validate) {
  16760. if (isEmptyValue(value) && !rule.required) {
  16761. return callback();
  16762. }
  16763. rules.required(rule, value, source, errors, options);
  16764. if (value !== void 0) {
  16765. rules.type(rule, value, source, errors, options);
  16766. rules.range(rule, value, source, errors, options);
  16767. }
  16768. }
  16769. callback(errors);
  16770. };
  16771. var array2 = function array3(rule, value, callback, source, options) {
  16772. var errors = [];
  16773. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16774. if (validate) {
  16775. if ((value === void 0 || value === null) && !rule.required) {
  16776. return callback();
  16777. }
  16778. rules.required(rule, value, source, errors, options, "array");
  16779. if (value !== void 0 && value !== null) {
  16780. rules.type(rule, value, source, errors, options);
  16781. rules.range(rule, value, source, errors, options);
  16782. }
  16783. }
  16784. callback(errors);
  16785. };
  16786. var object2 = function object3(rule, value, callback, source, options) {
  16787. var errors = [];
  16788. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16789. if (validate) {
  16790. if (isEmptyValue(value) && !rule.required) {
  16791. return callback();
  16792. }
  16793. rules.required(rule, value, source, errors, options);
  16794. if (value !== void 0) {
  16795. rules.type(rule, value, source, errors, options);
  16796. }
  16797. }
  16798. callback(errors);
  16799. };
  16800. var ENUM = "enum";
  16801. var enumerable2 = function enumerable3(rule, value, callback, source, options) {
  16802. var errors = [];
  16803. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16804. if (validate) {
  16805. if (isEmptyValue(value) && !rule.required) {
  16806. return callback();
  16807. }
  16808. rules.required(rule, value, source, errors, options);
  16809. if (value !== void 0) {
  16810. rules[ENUM](rule, value, source, errors, options);
  16811. }
  16812. }
  16813. callback(errors);
  16814. };
  16815. var pattern2 = function pattern3(rule, value, callback, source, options) {
  16816. var errors = [];
  16817. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16818. if (validate) {
  16819. if (isEmptyValue(value, "string") && !rule.required) {
  16820. return callback();
  16821. }
  16822. rules.required(rule, value, source, errors, options);
  16823. if (!isEmptyValue(value, "string")) {
  16824. rules.pattern(rule, value, source, errors, options);
  16825. }
  16826. }
  16827. callback(errors);
  16828. };
  16829. var date2 = function date3(rule, value, callback, source, options) {
  16830. var errors = [];
  16831. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16832. if (validate) {
  16833. if (isEmptyValue(value, "date") && !rule.required) {
  16834. return callback();
  16835. }
  16836. rules.required(rule, value, source, errors, options);
  16837. if (!isEmptyValue(value, "date")) {
  16838. var dateObject;
  16839. if (value instanceof Date) {
  16840. dateObject = value;
  16841. } else {
  16842. dateObject = new Date(value);
  16843. }
  16844. rules.type(rule, dateObject, source, errors, options);
  16845. if (dateObject) {
  16846. rules.range(rule, dateObject.getTime(), source, errors, options);
  16847. }
  16848. }
  16849. }
  16850. callback(errors);
  16851. };
  16852. var required2 = function required3(rule, value, callback, source, options) {
  16853. var errors = [];
  16854. var type4 = Array.isArray(value) ? "array" : typeof value;
  16855. rules.required(rule, value, source, errors, options, type4);
  16856. callback(errors);
  16857. };
  16858. var type2 = function type3(rule, value, callback, source, options) {
  16859. var ruleType = rule.type;
  16860. var errors = [];
  16861. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16862. if (validate) {
  16863. if (isEmptyValue(value, ruleType) && !rule.required) {
  16864. return callback();
  16865. }
  16866. rules.required(rule, value, source, errors, options, ruleType);
  16867. if (!isEmptyValue(value, ruleType)) {
  16868. rules.type(rule, value, source, errors, options);
  16869. }
  16870. }
  16871. callback(errors);
  16872. };
  16873. var any = function any2(rule, value, callback, source, options) {
  16874. var errors = [];
  16875. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16876. if (validate) {
  16877. if (isEmptyValue(value) && !rule.required) {
  16878. return callback();
  16879. }
  16880. rules.required(rule, value, source, errors, options);
  16881. }
  16882. callback(errors);
  16883. };
  16884. var validators = {
  16885. string,
  16886. method: method2,
  16887. number: number2,
  16888. "boolean": _boolean,
  16889. regexp: regexp2,
  16890. integer: integer2,
  16891. "float": floatFn,
  16892. array: array2,
  16893. object: object2,
  16894. "enum": enumerable2,
  16895. pattern: pattern2,
  16896. date: date2,
  16897. url: type2,
  16898. hex: type2,
  16899. email: type2,
  16900. required: required2,
  16901. any
  16902. };
  16903. function newMessages() {
  16904. return {
  16905. "default": "Validation error on field %s",
  16906. required: "%s is required",
  16907. "enum": "%s must be one of %s",
  16908. whitespace: "%s cannot be empty",
  16909. date: {
  16910. format: "%s date %s is invalid for format %s",
  16911. parse: "%s date could not be parsed, %s is invalid ",
  16912. invalid: "%s date %s is invalid"
  16913. },
  16914. types: {
  16915. string: "%s is not a %s",
  16916. method: "%s is not a %s (function)",
  16917. array: "%s is not an %s",
  16918. object: "%s is not an %s",
  16919. number: "%s is not a %s",
  16920. date: "%s is not a %s",
  16921. "boolean": "%s is not a %s",
  16922. integer: "%s is not an %s",
  16923. "float": "%s is not a %s",
  16924. regexp: "%s is not a valid %s",
  16925. email: "%s is not a valid %s",
  16926. url: "%s is not a valid %s",
  16927. hex: "%s is not a valid %s"
  16928. },
  16929. string: {
  16930. len: "%s must be exactly %s characters",
  16931. min: "%s must be at least %s characters",
  16932. max: "%s cannot be longer than %s characters",
  16933. range: "%s must be between %s and %s characters"
  16934. },
  16935. number: {
  16936. len: "%s must equal %s",
  16937. min: "%s cannot be less than %s",
  16938. max: "%s cannot be greater than %s",
  16939. range: "%s must be between %s and %s"
  16940. },
  16941. array: {
  16942. len: "%s must be exactly %s in length",
  16943. min: "%s cannot be less than %s in length",
  16944. max: "%s cannot be greater than %s in length",
  16945. range: "%s must be between %s and %s in length"
  16946. },
  16947. pattern: {
  16948. mismatch: "%s value %s does not match pattern %s"
  16949. },
  16950. clone: function clone2() {
  16951. var cloned = JSON.parse(JSON.stringify(this));
  16952. cloned.clone = this.clone;
  16953. return cloned;
  16954. }
  16955. };
  16956. }
  16957. var messages = newMessages();
  16958. var Schema = /* @__PURE__ */ function() {
  16959. function Schema2(descriptor) {
  16960. this.rules = null;
  16961. this._messages = messages;
  16962. this.define(descriptor);
  16963. }
  16964. var _proto = Schema2.prototype;
  16965. _proto.define = function define(rules2) {
  16966. var _this = this;
  16967. if (!rules2) {
  16968. throw new Error("Cannot configure a schema with no rules");
  16969. }
  16970. if (typeof rules2 !== "object" || Array.isArray(rules2)) {
  16971. throw new Error("Rules must be an object");
  16972. }
  16973. this.rules = {};
  16974. Object.keys(rules2).forEach(function(name) {
  16975. var item = rules2[name];
  16976. _this.rules[name] = Array.isArray(item) ? item : [item];
  16977. });
  16978. };
  16979. _proto.messages = function messages2(_messages) {
  16980. if (_messages) {
  16981. this._messages = deepMerge(newMessages(), _messages);
  16982. }
  16983. return this._messages;
  16984. };
  16985. _proto.validate = function validate(source_, o2, oc) {
  16986. var _this2 = this;
  16987. if (o2 === void 0) {
  16988. o2 = {};
  16989. }
  16990. if (oc === void 0) {
  16991. oc = function oc2() {
  16992. };
  16993. }
  16994. var source = source_;
  16995. var options = o2;
  16996. var callback = oc;
  16997. if (typeof options === "function") {
  16998. callback = options;
  16999. options = {};
  17000. }
  17001. if (!this.rules || Object.keys(this.rules).length === 0) {
  17002. if (callback) {
  17003. callback(null, source);
  17004. }
  17005. return Promise.resolve(source);
  17006. }
  17007. function complete(results) {
  17008. var errors = [];
  17009. var fields = {};
  17010. function add(e) {
  17011. if (Array.isArray(e)) {
  17012. var _errors;
  17013. errors = (_errors = errors).concat.apply(_errors, e);
  17014. } else {
  17015. errors.push(e);
  17016. }
  17017. }
  17018. for (var i = 0; i < results.length; i++) {
  17019. add(results[i]);
  17020. }
  17021. if (!errors.length) {
  17022. callback(null, source);
  17023. } else {
  17024. fields = convertFieldsError(errors);
  17025. callback(errors, fields);
  17026. }
  17027. }
  17028. if (options.messages) {
  17029. var messages$1 = this.messages();
  17030. if (messages$1 === messages) {
  17031. messages$1 = newMessages();
  17032. }
  17033. deepMerge(messages$1, options.messages);
  17034. options.messages = messages$1;
  17035. } else {
  17036. options.messages = this.messages();
  17037. }
  17038. var series = {};
  17039. var keys2 = options.keys || Object.keys(this.rules);
  17040. keys2.forEach(function(z) {
  17041. var arr = _this2.rules[z];
  17042. var value = source[z];
  17043. arr.forEach(function(r) {
  17044. var rule = r;
  17045. if (typeof rule.transform === "function") {
  17046. if (source === source_) {
  17047. source = _extends$1({}, source);
  17048. }
  17049. value = source[z] = rule.transform(value);
  17050. }
  17051. if (typeof rule === "function") {
  17052. rule = {
  17053. validator: rule
  17054. };
  17055. } else {
  17056. rule = _extends$1({}, rule);
  17057. }
  17058. rule.validator = _this2.getValidationMethod(rule);
  17059. if (!rule.validator) {
  17060. return;
  17061. }
  17062. rule.field = z;
  17063. rule.fullField = rule.fullField || z;
  17064. rule.type = _this2.getType(rule);
  17065. series[z] = series[z] || [];
  17066. series[z].push({
  17067. rule,
  17068. value,
  17069. source,
  17070. field: z
  17071. });
  17072. });
  17073. });
  17074. var errorFields = {};
  17075. return asyncMap(series, options, function(data2, doIt) {
  17076. var rule = data2.rule;
  17077. var deep = (rule.type === "object" || rule.type === "array") && (typeof rule.fields === "object" || typeof rule.defaultField === "object");
  17078. deep = deep && (rule.required || !rule.required && data2.value);
  17079. rule.field = data2.field;
  17080. function addFullField(key, schema) {
  17081. return _extends$1({}, schema, {
  17082. fullField: rule.fullField + "." + key,
  17083. fullFields: rule.fullFields ? [].concat(rule.fullFields, [key]) : [key]
  17084. });
  17085. }
  17086. function cb(e) {
  17087. if (e === void 0) {
  17088. e = [];
  17089. }
  17090. var errorList = Array.isArray(e) ? e : [e];
  17091. if (!options.suppressWarning && errorList.length) {
  17092. Schema2.warning("async-validator:", errorList);
  17093. }
  17094. if (errorList.length && rule.message !== void 0) {
  17095. errorList = [].concat(rule.message);
  17096. }
  17097. var filledErrors = errorList.map(complementError(rule, source));
  17098. if (options.first && filledErrors.length) {
  17099. errorFields[rule.field] = 1;
  17100. return doIt(filledErrors);
  17101. }
  17102. if (!deep) {
  17103. doIt(filledErrors);
  17104. } else {
  17105. if (rule.required && !data2.value) {
  17106. if (rule.message !== void 0) {
  17107. filledErrors = [].concat(rule.message).map(complementError(rule, source));
  17108. } else if (options.error) {
  17109. filledErrors = [options.error(rule, format(options.messages.required, rule.field))];
  17110. }
  17111. return doIt(filledErrors);
  17112. }
  17113. var fieldsSchema = {};
  17114. if (rule.defaultField) {
  17115. Object.keys(data2.value).map(function(key) {
  17116. fieldsSchema[key] = rule.defaultField;
  17117. });
  17118. }
  17119. fieldsSchema = _extends$1({}, fieldsSchema, data2.rule.fields);
  17120. var paredFieldsSchema = {};
  17121. Object.keys(fieldsSchema).forEach(function(field) {
  17122. var fieldSchema = fieldsSchema[field];
  17123. var fieldSchemaList = Array.isArray(fieldSchema) ? fieldSchema : [fieldSchema];
  17124. paredFieldsSchema[field] = fieldSchemaList.map(addFullField.bind(null, field));
  17125. });
  17126. var schema = new Schema2(paredFieldsSchema);
  17127. schema.messages(options.messages);
  17128. if (data2.rule.options) {
  17129. data2.rule.options.messages = options.messages;
  17130. data2.rule.options.error = options.error;
  17131. }
  17132. schema.validate(data2.value, data2.rule.options || options, function(errs) {
  17133. var finalErrors = [];
  17134. if (filledErrors && filledErrors.length) {
  17135. finalErrors.push.apply(finalErrors, filledErrors);
  17136. }
  17137. if (errs && errs.length) {
  17138. finalErrors.push.apply(finalErrors, errs);
  17139. }
  17140. doIt(finalErrors.length ? finalErrors : null);
  17141. });
  17142. }
  17143. }
  17144. var res;
  17145. if (rule.asyncValidator) {
  17146. res = rule.asyncValidator(rule, data2.value, cb, data2.source, options);
  17147. } else if (rule.validator) {
  17148. res = rule.validator(rule, data2.value, cb, data2.source, options);
  17149. if (res === true) {
  17150. cb();
  17151. } else if (res === false) {
  17152. cb(typeof rule.message === "function" ? rule.message(rule.fullField || rule.field) : rule.message || (rule.fullField || rule.field) + " fails");
  17153. } else if (res instanceof Array) {
  17154. cb(res);
  17155. } else if (res instanceof Error) {
  17156. cb(res.message);
  17157. }
  17158. }
  17159. if (res && res.then) {
  17160. res.then(function() {
  17161. return cb();
  17162. }, function(e) {
  17163. return cb(e);
  17164. });
  17165. }
  17166. }, function(results) {
  17167. complete(results);
  17168. }, source);
  17169. };
  17170. _proto.getType = function getType(rule) {
  17171. if (rule.type === void 0 && rule.pattern instanceof RegExp) {
  17172. rule.type = "pattern";
  17173. }
  17174. if (typeof rule.validator !== "function" && rule.type && !validators.hasOwnProperty(rule.type)) {
  17175. throw new Error(format("Unknown rule type %s", rule.type));
  17176. }
  17177. return rule.type || "string";
  17178. };
  17179. _proto.getValidationMethod = function getValidationMethod(rule) {
  17180. if (typeof rule.validator === "function") {
  17181. return rule.validator;
  17182. }
  17183. var keys2 = Object.keys(rule);
  17184. var messageIndex = keys2.indexOf("message");
  17185. if (messageIndex !== -1) {
  17186. keys2.splice(messageIndex, 1);
  17187. }
  17188. if (keys2.length === 1 && keys2[0] === "required") {
  17189. return validators.required;
  17190. }
  17191. return validators[this.getType(rule)] || void 0;
  17192. };
  17193. return Schema2;
  17194. }();
  17195. Schema.register = function register(type4, validator) {
  17196. if (typeof validator !== "function") {
  17197. throw new Error("Cannot register a validator by type, validator is not a function");
  17198. }
  17199. validators[type4] = validator;
  17200. };
  17201. Schema.warning = warning;
  17202. Schema.messages = messages;
  17203. Schema.validators = validators;
  17204. const formItemValidateStates = [
  17205. "",
  17206. "error",
  17207. "validating",
  17208. "success"
  17209. ];
  17210. const formItemProps = buildProps({
  17211. label: String,
  17212. labelWidth: {
  17213. type: [String, Number],
  17214. default: ""
  17215. },
  17216. prop: {
  17217. type: definePropType([String, Array])
  17218. },
  17219. required: {
  17220. type: Boolean,
  17221. default: void 0
  17222. },
  17223. rules: {
  17224. type: definePropType([Object, Array])
  17225. },
  17226. error: String,
  17227. validateStatus: {
  17228. type: String,
  17229. values: formItemValidateStates
  17230. },
  17231. for: String,
  17232. inlineMessage: {
  17233. type: [String, Boolean],
  17234. default: ""
  17235. },
  17236. showMessage: {
  17237. type: Boolean,
  17238. default: true
  17239. },
  17240. size: {
  17241. type: String,
  17242. values: componentSizes
  17243. }
  17244. });
  17245. const COMPONENT_NAME$2 = "ElLabelWrap";
  17246. var FormLabelWrap = defineComponent({
  17247. name: COMPONENT_NAME$2,
  17248. props: {
  17249. isAutoWidth: Boolean,
  17250. updateAll: Boolean
  17251. },
  17252. setup(props, {
  17253. slots
  17254. }) {
  17255. const formContext = inject(formContextKey, void 0);
  17256. const formItemContext = inject(formItemContextKey);
  17257. if (!formItemContext)
  17258. throwError(COMPONENT_NAME$2, "usage: <el-form-item><label-wrap /></el-form-item>");
  17259. const ns = useNamespace("form");
  17260. const el = ref();
  17261. const computedWidth = ref(0);
  17262. const getLabelWidth = () => {
  17263. var _a2;
  17264. if ((_a2 = el.value) == null ? void 0 : _a2.firstElementChild) {
  17265. const width = window.getComputedStyle(el.value.firstElementChild).width;
  17266. return Math.ceil(Number.parseFloat(width));
  17267. } else {
  17268. return 0;
  17269. }
  17270. };
  17271. const updateLabelWidth = (action = "update") => {
  17272. nextTick(() => {
  17273. if (slots.default && props.isAutoWidth) {
  17274. if (action === "update") {
  17275. computedWidth.value = getLabelWidth();
  17276. } else if (action === "remove") {
  17277. formContext == null ? void 0 : formContext.deregisterLabelWidth(computedWidth.value);
  17278. }
  17279. }
  17280. });
  17281. };
  17282. const updateLabelWidthFn = () => updateLabelWidth("update");
  17283. onMounted(() => {
  17284. updateLabelWidthFn();
  17285. });
  17286. onBeforeUnmount(() => {
  17287. updateLabelWidth("remove");
  17288. });
  17289. onUpdated(() => updateLabelWidthFn());
  17290. watch(computedWidth, (val, oldVal) => {
  17291. if (props.updateAll) {
  17292. formContext == null ? void 0 : formContext.registerLabelWidth(val, oldVal);
  17293. }
  17294. });
  17295. useResizeObserver(computed(() => {
  17296. var _a2, _b2;
  17297. return (_b2 = (_a2 = el.value) == null ? void 0 : _a2.firstElementChild) != null ? _b2 : null;
  17298. }), updateLabelWidthFn);
  17299. return () => {
  17300. var _a2, _b2;
  17301. if (!slots)
  17302. return null;
  17303. const {
  17304. isAutoWidth
  17305. } = props;
  17306. if (isAutoWidth) {
  17307. const autoLabelWidth = formContext == null ? void 0 : formContext.autoLabelWidth;
  17308. const style = {};
  17309. if (autoLabelWidth && autoLabelWidth !== "auto") {
  17310. const marginWidth = Math.max(0, Number.parseInt(autoLabelWidth, 10) - computedWidth.value);
  17311. const marginPosition = formContext.labelPosition === "left" ? "marginRight" : "marginLeft";
  17312. if (marginWidth) {
  17313. style[marginPosition] = `${marginWidth}px`;
  17314. }
  17315. }
  17316. return createVNode("div", {
  17317. "ref": el,
  17318. "class": [ns.be("item", "label-wrap")],
  17319. "style": style
  17320. }, [(_a2 = slots.default) == null ? void 0 : _a2.call(slots)]);
  17321. } else {
  17322. return createVNode(Fragment, {
  17323. "ref": el
  17324. }, [(_b2 = slots.default) == null ? void 0 : _b2.call(slots)]);
  17325. }
  17326. };
  17327. }
  17328. });
  17329. const _hoisted_1$j = ["for"];
  17330. const __default__$8 = {
  17331. name: "ElFormItem"
  17332. };
  17333. const _sfc_main$t = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$8), {
  17334. props: formItemProps,
  17335. setup(__props, { expose }) {
  17336. const props = __props;
  17337. const slots = useSlots();
  17338. const formContext = inject(formContextKey, void 0);
  17339. const parentFormItemContext = inject(formItemContextKey, void 0);
  17340. const _size = useSize(void 0, { formItem: false });
  17341. const ns = useNamespace("form-item");
  17342. const validateState = ref("");
  17343. const validateStateDebounced = refDebounced(validateState, 100);
  17344. const validateMessage = ref("");
  17345. const formItemRef = ref();
  17346. let initialValue = void 0;
  17347. let isResettingField = false;
  17348. const labelStyle = computed(() => {
  17349. if ((formContext == null ? void 0 : formContext.labelPosition) === "top") {
  17350. return {};
  17351. }
  17352. const labelWidth = addUnit(props.labelWidth || (formContext == null ? void 0 : formContext.labelWidth) || "");
  17353. if (labelWidth)
  17354. return { width: labelWidth };
  17355. return {};
  17356. });
  17357. const contentStyle = computed(() => {
  17358. if ((formContext == null ? void 0 : formContext.labelPosition) === "top" || (formContext == null ? void 0 : formContext.inline)) {
  17359. return {};
  17360. }
  17361. if (!props.label && !props.labelWidth && isNested) {
  17362. return {};
  17363. }
  17364. const labelWidth = addUnit(props.labelWidth || (formContext == null ? void 0 : formContext.labelWidth) || "");
  17365. if (!props.label && !slots.label) {
  17366. return { marginLeft: labelWidth };
  17367. }
  17368. return {};
  17369. });
  17370. const formItemClasses = computed(() => [
  17371. ns.b(),
  17372. ns.m(_size.value),
  17373. ns.is("error", validateState.value === "error"),
  17374. ns.is("validating", validateState.value === "validating"),
  17375. ns.is("success", validateState.value === "success"),
  17376. ns.is("required", isRequired.value || props.required),
  17377. ns.is("no-asterisk", formContext == null ? void 0 : formContext.hideRequiredAsterisk),
  17378. { [ns.m("feedback")]: formContext == null ? void 0 : formContext.statusIcon }
  17379. ]);
  17380. const _inlineMessage = computed(() => isBoolean(props.inlineMessage) ? props.inlineMessage : (formContext == null ? void 0 : formContext.inlineMessage) || false);
  17381. const validateClasses = computed(() => [
  17382. ns.e("error"),
  17383. { [ns.em("error", "inline")]: _inlineMessage.value }
  17384. ]);
  17385. const propString = computed(() => {
  17386. if (!props.prop)
  17387. return "";
  17388. return isString(props.prop) ? props.prop : props.prop.join(".");
  17389. });
  17390. const labelFor = computed(() => props.for || propString.value);
  17391. const isNested = !!parentFormItemContext;
  17392. const fieldValue = computed(() => {
  17393. const model = formContext == null ? void 0 : formContext.model;
  17394. if (!model || !props.prop) {
  17395. return;
  17396. }
  17397. return getProp(model, props.prop).value;
  17398. });
  17399. const _rules = computed(() => {
  17400. const rules2 = props.rules ? castArray$1(props.rules) : [];
  17401. const formRules = formContext == null ? void 0 : formContext.rules;
  17402. if (formRules && props.prop) {
  17403. const _rules2 = getProp(formRules, props.prop).value;
  17404. if (_rules2) {
  17405. rules2.push(...castArray$1(_rules2));
  17406. }
  17407. }
  17408. if (props.required !== void 0) {
  17409. rules2.push({ required: !!props.required });
  17410. }
  17411. return rules2;
  17412. });
  17413. const validateEnabled = computed(() => _rules.value.length > 0);
  17414. const getFilteredRule = (trigger) => {
  17415. const rules2 = _rules.value;
  17416. return rules2.filter((rule) => {
  17417. if (!rule.trigger || !trigger)
  17418. return true;
  17419. if (Array.isArray(rule.trigger)) {
  17420. return rule.trigger.includes(trigger);
  17421. } else {
  17422. return rule.trigger === trigger;
  17423. }
  17424. }).map((_a2) => {
  17425. var _b2 = _a2, { trigger: trigger2 } = _b2, rule = __objRest(_b2, ["trigger"]);
  17426. return rule;
  17427. });
  17428. };
  17429. const isRequired = computed(() => _rules.value.some((rule) => rule.required === true));
  17430. const shouldShowError = computed(() => {
  17431. var _a2;
  17432. return validateStateDebounced.value === "error" && props.showMessage && ((_a2 = formContext == null ? void 0 : formContext.showMessage) != null ? _a2 : true);
  17433. });
  17434. const currentLabel = computed(() => `${props.label || ""}${(formContext == null ? void 0 : formContext.labelSuffix) || ""}`);
  17435. const setValidationState = (state) => {
  17436. validateState.value = state;
  17437. };
  17438. const onValidationFailed = (error) => {
  17439. var _a2, _b2;
  17440. const { errors, fields } = error;
  17441. if (!errors || !fields) {
  17442. console.error(error);
  17443. }
  17444. setValidationState("error");
  17445. validateMessage.value = errors ? (_b2 = (_a2 = errors == null ? void 0 : errors[0]) == null ? void 0 : _a2.message) != null ? _b2 : `${props.prop} is required` : "";
  17446. formContext == null ? void 0 : formContext.emit("validate", props.prop, false, validateMessage.value);
  17447. };
  17448. const onValidationSucceeded = () => {
  17449. setValidationState("success");
  17450. formContext == null ? void 0 : formContext.emit("validate", props.prop, true, "");
  17451. };
  17452. const doValidate = async (rules2) => {
  17453. const modelName = propString.value;
  17454. const validator = new Schema({
  17455. [modelName]: rules2
  17456. });
  17457. return validator.validate({ [modelName]: fieldValue.value }, { firstFields: true }).then(() => {
  17458. onValidationSucceeded();
  17459. return true;
  17460. }).catch((err) => {
  17461. onValidationFailed(err);
  17462. return Promise.reject(err);
  17463. });
  17464. };
  17465. const validate = async (trigger, callback) => {
  17466. if (isResettingField) {
  17467. isResettingField = false;
  17468. return false;
  17469. }
  17470. const hasCallback = isFunction(callback);
  17471. if (!validateEnabled.value) {
  17472. callback == null ? void 0 : callback(false);
  17473. return false;
  17474. }
  17475. const rules2 = getFilteredRule(trigger);
  17476. if (rules2.length === 0) {
  17477. callback == null ? void 0 : callback(true);
  17478. return true;
  17479. }
  17480. setValidationState("validating");
  17481. return doValidate(rules2).then(() => {
  17482. callback == null ? void 0 : callback(true);
  17483. return true;
  17484. }).catch((err) => {
  17485. const { fields } = err;
  17486. callback == null ? void 0 : callback(false, fields);
  17487. return hasCallback ? false : Promise.reject(fields);
  17488. });
  17489. };
  17490. const clearValidate = () => {
  17491. setValidationState("");
  17492. validateMessage.value = "";
  17493. };
  17494. const resetField = async () => {
  17495. const model = formContext == null ? void 0 : formContext.model;
  17496. if (!model || !props.prop)
  17497. return;
  17498. const computedValue = getProp(model, props.prop);
  17499. if (!isEqual(computedValue.value, initialValue)) {
  17500. isResettingField = true;
  17501. }
  17502. computedValue.value = initialValue;
  17503. await nextTick();
  17504. clearValidate();
  17505. };
  17506. watch(() => props.error, (val) => {
  17507. validateMessage.value = val || "";
  17508. setValidationState(val ? "error" : "");
  17509. }, { immediate: true });
  17510. watch(() => props.validateStatus, (val) => setValidationState(val || ""));
  17511. const context = reactive(__spreadProps(__spreadValues({}, toRefs(props)), {
  17512. $el: formItemRef,
  17513. size: _size,
  17514. validateState,
  17515. resetField,
  17516. clearValidate,
  17517. validate
  17518. }));
  17519. provide(formItemContextKey, context);
  17520. onMounted(() => {
  17521. if (props.prop) {
  17522. formContext == null ? void 0 : formContext.addField(context);
  17523. initialValue = clone(fieldValue.value);
  17524. }
  17525. });
  17526. onBeforeUnmount(() => {
  17527. formContext == null ? void 0 : formContext.removeField(context);
  17528. });
  17529. expose({
  17530. size: _size,
  17531. validateMessage,
  17532. validateState,
  17533. validate,
  17534. clearValidate,
  17535. resetField
  17536. });
  17537. return (_ctx, _cache) => {
  17538. var _a2;
  17539. return openBlock(), createElementBlock("div", {
  17540. ref_key: "formItemRef",
  17541. ref: formItemRef,
  17542. class: normalizeClass(unref(formItemClasses))
  17543. }, [
  17544. createVNode(unref(FormLabelWrap), {
  17545. "is-auto-width": unref(labelStyle).width === "auto",
  17546. "update-all": ((_a2 = unref(formContext)) == null ? void 0 : _a2.labelWidth) === "auto"
  17547. }, {
  17548. default: withCtx(() => [
  17549. _ctx.label || _ctx.$slots.label ? (openBlock(), createElementBlock("label", {
  17550. key: 0,
  17551. for: unref(labelFor),
  17552. class: normalizeClass(unref(ns).e("label")),
  17553. style: normalizeStyle(unref(labelStyle))
  17554. }, [
  17555. renderSlot(_ctx.$slots, "label", { label: unref(currentLabel) }, () => [
  17556. createTextVNode(toDisplayString(unref(currentLabel)), 1)
  17557. ])
  17558. ], 14, _hoisted_1$j)) : createCommentVNode("v-if", true)
  17559. ]),
  17560. _: 3
  17561. }, 8, ["is-auto-width", "update-all"]),
  17562. createElementVNode("div", {
  17563. class: normalizeClass(unref(ns).e("content")),
  17564. style: normalizeStyle(unref(contentStyle))
  17565. }, [
  17566. renderSlot(_ctx.$slots, "default"),
  17567. createVNode(Transition, {
  17568. name: `${unref(ns).namespace.value}-zoom-in-top`
  17569. }, {
  17570. default: withCtx(() => [
  17571. unref(shouldShowError) ? renderSlot(_ctx.$slots, "error", {
  17572. key: 0,
  17573. error: validateMessage.value
  17574. }, () => [
  17575. createElementVNode("div", {
  17576. class: normalizeClass(unref(validateClasses))
  17577. }, toDisplayString(validateMessage.value), 3)
  17578. ]) : createCommentVNode("v-if", true)
  17579. ]),
  17580. _: 3
  17581. }, 8, ["name"])
  17582. ], 6)
  17583. ], 2);
  17584. };
  17585. }
  17586. }));
  17587. var FormItem = /* @__PURE__ */ _export_sfc$1(_sfc_main$t, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/form/src/form-item.vue"]]);
  17588. const ElForm = withInstall(Form, {
  17589. FormItem
  17590. });
  17591. const ElFormItem = withNoopInstall(FormItem);
  17592. const imageViewerProps = buildProps({
  17593. urlList: {
  17594. type: definePropType(Array),
  17595. default: () => mutable([])
  17596. },
  17597. zIndex: {
  17598. type: Number
  17599. },
  17600. initialIndex: {
  17601. type: Number,
  17602. default: 0
  17603. },
  17604. infinite: {
  17605. type: Boolean,
  17606. default: true
  17607. },
  17608. hideOnClickModal: {
  17609. type: Boolean,
  17610. default: false
  17611. },
  17612. teleported: {
  17613. type: Boolean,
  17614. default: false
  17615. }
  17616. });
  17617. const imageViewerEmits = {
  17618. close: () => true,
  17619. switch: (index) => typeof index === "number"
  17620. };
  17621. const _hoisted_1$i = ["src"];
  17622. const __default__$7 = {
  17623. name: "ElImageViewer"
  17624. };
  17625. const _sfc_main$s = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$7), {
  17626. props: imageViewerProps,
  17627. emits: imageViewerEmits,
  17628. setup(__props, { emit }) {
  17629. const props = __props;
  17630. const Mode = {
  17631. CONTAIN: {
  17632. name: "contain",
  17633. icon: markRaw(fullScreen)
  17634. },
  17635. ORIGINAL: {
  17636. name: "original",
  17637. icon: markRaw(scaleToOriginal)
  17638. }
  17639. };
  17640. const mousewheelEventName = isFirefox() ? "DOMMouseScroll" : "mousewheel";
  17641. const { t } = useLocale();
  17642. const ns = useNamespace("image-viewer");
  17643. const { nextZIndex } = useZIndex();
  17644. const wrapper = ref();
  17645. const imgRefs = ref([]);
  17646. const scopeEventListener = effectScope();
  17647. const loading2 = ref(true);
  17648. const index = ref(props.initialIndex);
  17649. const mode = ref(Mode.CONTAIN);
  17650. const transform = ref({
  17651. scale: 1,
  17652. deg: 0,
  17653. offsetX: 0,
  17654. offsetY: 0,
  17655. enableTransition: false
  17656. });
  17657. const isSingle = computed(() => {
  17658. const { urlList } = props;
  17659. return urlList.length <= 1;
  17660. });
  17661. const isFirst = computed(() => {
  17662. return index.value === 0;
  17663. });
  17664. const isLast = computed(() => {
  17665. return index.value === props.urlList.length - 1;
  17666. });
  17667. const currentImg = computed(() => {
  17668. return props.urlList[index.value];
  17669. });
  17670. const imgStyle = computed(() => {
  17671. const { scale, deg, offsetX, offsetY, enableTransition } = transform.value;
  17672. let translateX = offsetX / scale;
  17673. let translateY = offsetY / scale;
  17674. switch (deg % 360) {
  17675. case 90:
  17676. case -270:
  17677. [translateX, translateY] = [translateY, -translateX];
  17678. break;
  17679. case 180:
  17680. case -180:
  17681. [translateX, translateY] = [-translateX, -translateY];
  17682. break;
  17683. case 270:
  17684. case -90:
  17685. [translateX, translateY] = [-translateY, translateX];
  17686. break;
  17687. }
  17688. const style = {
  17689. transform: `scale(${scale}) rotate(${deg}deg) translate(${translateX}px, ${translateY}px)`,
  17690. transition: enableTransition ? "transform .3s" : ""
  17691. };
  17692. if (mode.value.name === Mode.CONTAIN.name) {
  17693. style.maxWidth = style.maxHeight = "100%";
  17694. }
  17695. return style;
  17696. });
  17697. const computedZIndex = computed(() => {
  17698. return isNumber(props.zIndex) ? props.zIndex : nextZIndex();
  17699. });
  17700. function hide2() {
  17701. unregisterEventListener();
  17702. emit("close");
  17703. }
  17704. function registerEventListener() {
  17705. const keydownHandler = throttle((e) => {
  17706. switch (e.code) {
  17707. case EVENT_CODE.esc:
  17708. hide2();
  17709. break;
  17710. case EVENT_CODE.space:
  17711. toggleMode();
  17712. break;
  17713. case EVENT_CODE.left:
  17714. prev();
  17715. break;
  17716. case EVENT_CODE.up:
  17717. handleActions("zoomIn");
  17718. break;
  17719. case EVENT_CODE.right:
  17720. next();
  17721. break;
  17722. case EVENT_CODE.down:
  17723. handleActions("zoomOut");
  17724. break;
  17725. }
  17726. });
  17727. const mousewheelHandler = throttle((e) => {
  17728. const delta = e.wheelDelta ? e.wheelDelta : -e.detail;
  17729. if (delta > 0) {
  17730. handleActions("zoomIn", {
  17731. zoomRate: 1.2,
  17732. enableTransition: false
  17733. });
  17734. } else {
  17735. handleActions("zoomOut", {
  17736. zoomRate: 1.2,
  17737. enableTransition: false
  17738. });
  17739. }
  17740. });
  17741. scopeEventListener.run(() => {
  17742. useEventListener(document, "keydown", keydownHandler);
  17743. useEventListener(document, mousewheelEventName, mousewheelHandler);
  17744. });
  17745. }
  17746. function unregisterEventListener() {
  17747. scopeEventListener.stop();
  17748. }
  17749. function handleImgLoad() {
  17750. loading2.value = false;
  17751. }
  17752. function handleImgError(e) {
  17753. loading2.value = false;
  17754. e.target.alt = t("el.image.error");
  17755. }
  17756. function handleMouseDown(e) {
  17757. if (loading2.value || e.button !== 0 || !wrapper.value)
  17758. return;
  17759. transform.value.enableTransition = false;
  17760. const { offsetX, offsetY } = transform.value;
  17761. const startX = e.pageX;
  17762. const startY = e.pageY;
  17763. const dragHandler = throttle((ev) => {
  17764. transform.value = __spreadProps(__spreadValues({}, transform.value), {
  17765. offsetX: offsetX + ev.pageX - startX,
  17766. offsetY: offsetY + ev.pageY - startY
  17767. });
  17768. });
  17769. const removeMousemove = useEventListener(document, "mousemove", dragHandler);
  17770. useEventListener(document, "mouseup", () => {
  17771. removeMousemove();
  17772. });
  17773. e.preventDefault();
  17774. }
  17775. function reset() {
  17776. transform.value = {
  17777. scale: 1,
  17778. deg: 0,
  17779. offsetX: 0,
  17780. offsetY: 0,
  17781. enableTransition: false
  17782. };
  17783. }
  17784. function toggleMode() {
  17785. if (loading2.value)
  17786. return;
  17787. const modeNames = Object.keys(Mode);
  17788. const modeValues = Object.values(Mode);
  17789. const currentMode = mode.value.name;
  17790. const index2 = modeValues.findIndex((i) => i.name === currentMode);
  17791. const nextIndex = (index2 + 1) % modeNames.length;
  17792. mode.value = Mode[modeNames[nextIndex]];
  17793. reset();
  17794. }
  17795. function prev() {
  17796. if (isFirst.value && !props.infinite)
  17797. return;
  17798. const len = props.urlList.length;
  17799. index.value = (index.value - 1 + len) % len;
  17800. }
  17801. function next() {
  17802. if (isLast.value && !props.infinite)
  17803. return;
  17804. const len = props.urlList.length;
  17805. index.value = (index.value + 1) % len;
  17806. }
  17807. function handleActions(action, options = {}) {
  17808. if (loading2.value)
  17809. return;
  17810. const { zoomRate, rotateDeg, enableTransition } = __spreadValues({
  17811. zoomRate: 1.4,
  17812. rotateDeg: 90,
  17813. enableTransition: true
  17814. }, options);
  17815. switch (action) {
  17816. case "zoomOut":
  17817. if (transform.value.scale > 0.2) {
  17818. transform.value.scale = Number.parseFloat((transform.value.scale / zoomRate).toFixed(3));
  17819. }
  17820. break;
  17821. case "zoomIn":
  17822. if (transform.value.scale < 7) {
  17823. transform.value.scale = Number.parseFloat((transform.value.scale * zoomRate).toFixed(3));
  17824. }
  17825. break;
  17826. case "clockwise":
  17827. transform.value.deg += rotateDeg;
  17828. break;
  17829. case "anticlockwise":
  17830. transform.value.deg -= rotateDeg;
  17831. break;
  17832. }
  17833. transform.value.enableTransition = enableTransition;
  17834. }
  17835. watch(currentImg, () => {
  17836. nextTick(() => {
  17837. const $img = imgRefs.value[0];
  17838. if (!($img == null ? void 0 : $img.complete)) {
  17839. loading2.value = true;
  17840. }
  17841. });
  17842. });
  17843. watch(index, (val) => {
  17844. reset();
  17845. emit("switch", val);
  17846. });
  17847. onMounted(() => {
  17848. var _a2, _b2;
  17849. registerEventListener();
  17850. (_b2 = (_a2 = wrapper.value) == null ? void 0 : _a2.focus) == null ? void 0 : _b2.call(_a2);
  17851. });
  17852. return (_ctx, _cache) => {
  17853. return openBlock(), createBlock(Teleport, {
  17854. to: "body",
  17855. disabled: !_ctx.teleported
  17856. }, [
  17857. createVNode(Transition, {
  17858. name: "viewer-fade",
  17859. appear: ""
  17860. }, {
  17861. default: withCtx(() => [
  17862. createElementVNode("div", {
  17863. ref_key: "wrapper",
  17864. ref: wrapper,
  17865. tabindex: -1,
  17866. class: normalizeClass(unref(ns).e("wrapper")),
  17867. style: normalizeStyle({ zIndex: unref(computedZIndex) })
  17868. }, [
  17869. createElementVNode("div", {
  17870. class: normalizeClass(unref(ns).e("mask")),
  17871. onClick: _cache[0] || (_cache[0] = withModifiers(($event) => _ctx.hideOnClickModal && hide2(), ["self"]))
  17872. }, null, 2),
  17873. createCommentVNode(" CLOSE "),
  17874. createElementVNode("span", {
  17875. class: normalizeClass([unref(ns).e("btn"), unref(ns).e("close")]),
  17876. onClick: hide2
  17877. }, [
  17878. createVNode(unref(ElIcon), null, {
  17879. default: withCtx(() => [
  17880. createVNode(unref(close))
  17881. ]),
  17882. _: 1
  17883. })
  17884. ], 2),
  17885. createCommentVNode(" ARROW "),
  17886. !unref(isSingle) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  17887. createElementVNode("span", {
  17888. class: normalizeClass([
  17889. unref(ns).e("btn"),
  17890. unref(ns).e("prev"),
  17891. unref(ns).is("disabled", !_ctx.infinite && unref(isFirst))
  17892. ]),
  17893. onClick: prev
  17894. }, [
  17895. createVNode(unref(ElIcon), null, {
  17896. default: withCtx(() => [
  17897. createVNode(unref(arrowLeft))
  17898. ]),
  17899. _: 1
  17900. })
  17901. ], 2),
  17902. createElementVNode("span", {
  17903. class: normalizeClass([
  17904. unref(ns).e("btn"),
  17905. unref(ns).e("next"),
  17906. unref(ns).is("disabled", !_ctx.infinite && unref(isLast))
  17907. ]),
  17908. onClick: next
  17909. }, [
  17910. createVNode(unref(ElIcon), null, {
  17911. default: withCtx(() => [
  17912. createVNode(unref(arrowRight))
  17913. ]),
  17914. _: 1
  17915. })
  17916. ], 2)
  17917. ], 64)) : createCommentVNode("v-if", true),
  17918. createCommentVNode(" ACTIONS "),
  17919. createElementVNode("div", {
  17920. class: normalizeClass([unref(ns).e("btn"), unref(ns).e("actions")])
  17921. }, [
  17922. createElementVNode("div", {
  17923. class: normalizeClass(unref(ns).e("actions__inner"))
  17924. }, [
  17925. createVNode(unref(ElIcon), {
  17926. onClick: _cache[1] || (_cache[1] = ($event) => handleActions("zoomOut"))
  17927. }, {
  17928. default: withCtx(() => [
  17929. createVNode(unref(zoomOut))
  17930. ]),
  17931. _: 1
  17932. }),
  17933. createVNode(unref(ElIcon), {
  17934. onClick: _cache[2] || (_cache[2] = ($event) => handleActions("zoomIn"))
  17935. }, {
  17936. default: withCtx(() => [
  17937. createVNode(unref(zoomIn))
  17938. ]),
  17939. _: 1
  17940. }),
  17941. createElementVNode("i", {
  17942. class: normalizeClass(unref(ns).e("actions__divider"))
  17943. }, null, 2),
  17944. createVNode(unref(ElIcon), { onClick: toggleMode }, {
  17945. default: withCtx(() => [
  17946. (openBlock(), createBlock(resolveDynamicComponent(mode.value.icon)))
  17947. ]),
  17948. _: 1
  17949. }),
  17950. createElementVNode("i", {
  17951. class: normalizeClass(unref(ns).e("actions__divider"))
  17952. }, null, 2),
  17953. createVNode(unref(ElIcon), {
  17954. onClick: _cache[3] || (_cache[3] = ($event) => handleActions("anticlockwise"))
  17955. }, {
  17956. default: withCtx(() => [
  17957. createVNode(unref(refreshLeft))
  17958. ]),
  17959. _: 1
  17960. }),
  17961. createVNode(unref(ElIcon), {
  17962. onClick: _cache[4] || (_cache[4] = ($event) => handleActions("clockwise"))
  17963. }, {
  17964. default: withCtx(() => [
  17965. createVNode(unref(refreshRight))
  17966. ]),
  17967. _: 1
  17968. })
  17969. ], 2)
  17970. ], 2),
  17971. createCommentVNode(" CANVAS "),
  17972. createElementVNode("div", {
  17973. class: normalizeClass(unref(ns).e("canvas"))
  17974. }, [
  17975. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.urlList, (url2, i) => {
  17976. return withDirectives((openBlock(), createElementBlock("img", {
  17977. ref_for: true,
  17978. ref: (el) => imgRefs.value[i] = el,
  17979. key: url2,
  17980. src: url2,
  17981. style: normalizeStyle(unref(imgStyle)),
  17982. class: normalizeClass(unref(ns).e("img")),
  17983. onLoad: handleImgLoad,
  17984. onError: handleImgError,
  17985. onMousedown: handleMouseDown
  17986. }, null, 46, _hoisted_1$i)), [
  17987. [vShow, i === index.value]
  17988. ]);
  17989. }), 128))
  17990. ], 2),
  17991. renderSlot(_ctx.$slots, "default")
  17992. ], 6)
  17993. ]),
  17994. _: 3
  17995. })
  17996. ], 8, ["disabled"]);
  17997. };
  17998. }
  17999. }));
  18000. var ImageViewer = /* @__PURE__ */ _export_sfc$1(_sfc_main$s, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/image-viewer/src/image-viewer.vue"]]);
  18001. const ElImageViewer = withInstall(ImageViewer);
  18002. const imageProps = buildProps({
  18003. appendToBody: {
  18004. type: Boolean,
  18005. default: void 0
  18006. },
  18007. hideOnClickModal: {
  18008. type: Boolean,
  18009. default: false
  18010. },
  18011. src: {
  18012. type: String,
  18013. default: ""
  18014. },
  18015. fit: {
  18016. type: String,
  18017. values: ["", "contain", "cover", "fill", "none", "scale-down"],
  18018. default: ""
  18019. },
  18020. lazy: {
  18021. type: Boolean,
  18022. default: false
  18023. },
  18024. scrollContainer: {
  18025. type: definePropType([String, Object])
  18026. },
  18027. previewSrcList: {
  18028. type: definePropType(Array),
  18029. default: () => mutable([])
  18030. },
  18031. previewTeleported: {
  18032. type: Boolean,
  18033. default: false
  18034. },
  18035. zIndex: {
  18036. type: Number
  18037. },
  18038. initialIndex: {
  18039. type: Number,
  18040. default: 0
  18041. },
  18042. infinite: {
  18043. type: Boolean,
  18044. default: true
  18045. }
  18046. });
  18047. const imageEmits = {
  18048. error: (evt) => evt instanceof Event,
  18049. switch: (val) => isNumber(val),
  18050. close: () => true
  18051. };
  18052. const _hoisted_1$h = ["src"];
  18053. const _hoisted_2$f = { key: 0 };
  18054. const __default__$6 = {
  18055. name: "ElImage"
  18056. };
  18057. const _sfc_main$r = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$6), {
  18058. props: imageProps,
  18059. emits: imageEmits,
  18060. setup(__props, { emit }) {
  18061. const props = __props;
  18062. let prevOverflow = "";
  18063. useDeprecated({
  18064. scope: "el-image",
  18065. from: "append-to-body",
  18066. replacement: "preview-teleported",
  18067. version: "2.2.0",
  18068. ref: "https://element-plus.org/en-US/component/image.html#image-attributess"
  18069. }, computed(() => isBoolean(props.appendToBody)));
  18070. const { t } = useLocale();
  18071. const ns = useNamespace("image");
  18072. const attrs = useAttrs();
  18073. const hasLoadError = ref(false);
  18074. const loading2 = ref(true);
  18075. const imgWidth = ref(0);
  18076. const imgHeight = ref(0);
  18077. const showViewer = ref(false);
  18078. const container = ref();
  18079. const _scrollContainer = ref();
  18080. let stopScrollListener;
  18081. let stopWheelListener;
  18082. const containerStyle = computed(() => attrs.value.style);
  18083. const imageStyle = computed(() => {
  18084. const { fit } = props;
  18085. if (isClient$1 && fit) {
  18086. return { objectFit: fit };
  18087. }
  18088. return {};
  18089. });
  18090. const preview = computed(() => {
  18091. const { previewSrcList } = props;
  18092. return Array.isArray(previewSrcList) && previewSrcList.length > 0;
  18093. });
  18094. const teleported = computed(() => {
  18095. return props.appendToBody || props.previewTeleported;
  18096. });
  18097. const imageIndex = computed(() => {
  18098. const { previewSrcList, initialIndex } = props;
  18099. let previewIndex = initialIndex;
  18100. if (initialIndex > previewSrcList.length - 1) {
  18101. previewIndex = 0;
  18102. }
  18103. return previewIndex;
  18104. });
  18105. const loadImage = () => {
  18106. if (!isClient$1)
  18107. return;
  18108. loading2.value = true;
  18109. hasLoadError.value = false;
  18110. const img = new Image();
  18111. const currentImageSrc = props.src;
  18112. img.addEventListener("load", (e) => {
  18113. if (currentImageSrc !== props.src) {
  18114. return;
  18115. }
  18116. handleLoad(e, img);
  18117. });
  18118. img.addEventListener("error", (e) => {
  18119. if (currentImageSrc !== props.src) {
  18120. return;
  18121. }
  18122. handleError(e);
  18123. });
  18124. Object.entries(attrs.value).forEach(([key, value]) => {
  18125. if (key.toLowerCase() === "onload")
  18126. return;
  18127. img.setAttribute(key, value);
  18128. });
  18129. img.src = currentImageSrc;
  18130. };
  18131. function handleLoad(e, img) {
  18132. imgWidth.value = img.width;
  18133. imgHeight.value = img.height;
  18134. loading2.value = false;
  18135. hasLoadError.value = false;
  18136. }
  18137. function handleError(event) {
  18138. loading2.value = false;
  18139. hasLoadError.value = true;
  18140. emit("error", event);
  18141. }
  18142. function handleLazyLoad() {
  18143. if (isInContainer(container.value, _scrollContainer.value)) {
  18144. loadImage();
  18145. removeLazyLoadListener();
  18146. }
  18147. }
  18148. const lazyLoadHandler = useThrottleFn(handleLazyLoad, 200);
  18149. async function addLazyLoadListener() {
  18150. var _a2;
  18151. if (!isClient$1)
  18152. return;
  18153. await nextTick();
  18154. const { scrollContainer } = props;
  18155. if (isElement$1(scrollContainer)) {
  18156. _scrollContainer.value = scrollContainer;
  18157. } else if (isString(scrollContainer) && scrollContainer !== "") {
  18158. _scrollContainer.value = (_a2 = document.querySelector(scrollContainer)) != null ? _a2 : void 0;
  18159. } else if (container.value) {
  18160. _scrollContainer.value = getScrollContainer(container.value);
  18161. }
  18162. if (_scrollContainer.value) {
  18163. stopScrollListener = useEventListener(_scrollContainer, "scroll", lazyLoadHandler);
  18164. setTimeout(() => handleLazyLoad(), 100);
  18165. }
  18166. }
  18167. function removeLazyLoadListener() {
  18168. if (!isClient$1 || !_scrollContainer.value || !lazyLoadHandler)
  18169. return;
  18170. stopScrollListener();
  18171. _scrollContainer.value = void 0;
  18172. }
  18173. function wheelHandler(e) {
  18174. if (!e.ctrlKey)
  18175. return;
  18176. if (e.deltaY < 0) {
  18177. e.preventDefault();
  18178. return false;
  18179. } else if (e.deltaY > 0) {
  18180. e.preventDefault();
  18181. return false;
  18182. }
  18183. }
  18184. function clickHandler() {
  18185. if (!preview.value)
  18186. return;
  18187. stopWheelListener = useEventListener("wheel", wheelHandler, {
  18188. passive: false
  18189. });
  18190. prevOverflow = document.body.style.overflow;
  18191. document.body.style.overflow = "hidden";
  18192. showViewer.value = true;
  18193. }
  18194. function closeViewer() {
  18195. stopWheelListener == null ? void 0 : stopWheelListener();
  18196. document.body.style.overflow = prevOverflow;
  18197. showViewer.value = false;
  18198. emit("close");
  18199. }
  18200. function switchViewer(val) {
  18201. emit("switch", val);
  18202. }
  18203. watch(() => props.src, () => {
  18204. if (props.lazy) {
  18205. loading2.value = true;
  18206. hasLoadError.value = false;
  18207. removeLazyLoadListener();
  18208. addLazyLoadListener();
  18209. } else {
  18210. loadImage();
  18211. }
  18212. });
  18213. onMounted(() => {
  18214. if (props.lazy) {
  18215. addLazyLoadListener();
  18216. } else {
  18217. loadImage();
  18218. }
  18219. });
  18220. return (_ctx, _cache) => {
  18221. return openBlock(), createElementBlock("div", {
  18222. ref_key: "container",
  18223. ref: container,
  18224. class: normalizeClass([unref(ns).b(), _ctx.$attrs.class]),
  18225. style: normalizeStyle(unref(containerStyle))
  18226. }, [
  18227. loading2.value ? renderSlot(_ctx.$slots, "placeholder", { key: 0 }, () => [
  18228. createElementVNode("div", {
  18229. class: normalizeClass(unref(ns).e("placeholder"))
  18230. }, null, 2)
  18231. ]) : hasLoadError.value ? renderSlot(_ctx.$slots, "error", { key: 1 }, () => [
  18232. createElementVNode("div", {
  18233. class: normalizeClass(unref(ns).e("error"))
  18234. }, toDisplayString(unref(t)("el.image.error")), 3)
  18235. ]) : (openBlock(), createElementBlock("img", mergeProps({ key: 2 }, unref(attrs), {
  18236. src: _ctx.src,
  18237. style: unref(imageStyle),
  18238. class: [unref(ns).e("inner"), unref(preview) ? unref(ns).e("preview") : ""],
  18239. onClick: clickHandler
  18240. }), null, 16, _hoisted_1$h)),
  18241. unref(preview) ? (openBlock(), createElementBlock(Fragment, { key: 3 }, [
  18242. showViewer.value ? (openBlock(), createBlock(unref(ElImageViewer), {
  18243. key: 0,
  18244. "z-index": _ctx.zIndex,
  18245. "initial-index": unref(imageIndex),
  18246. infinite: _ctx.infinite,
  18247. "url-list": _ctx.previewSrcList,
  18248. "hide-on-click-modal": _ctx.hideOnClickModal,
  18249. teleported: unref(teleported),
  18250. onClose: closeViewer,
  18251. onSwitch: switchViewer
  18252. }, {
  18253. default: withCtx(() => [
  18254. _ctx.$slots.viewer ? (openBlock(), createElementBlock("div", _hoisted_2$f, [
  18255. renderSlot(_ctx.$slots, "viewer")
  18256. ])) : createCommentVNode("v-if", true)
  18257. ]),
  18258. _: 3
  18259. }, 8, ["z-index", "initial-index", "infinite", "url-list", "hide-on-click-modal", "teleported"])) : createCommentVNode("v-if", true)
  18260. ], 2112)) : createCommentVNode("v-if", true)
  18261. ], 6);
  18262. };
  18263. }
  18264. }));
  18265. var Image$1 = /* @__PURE__ */ _export_sfc$1(_sfc_main$r, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/image/src/image.vue"]]);
  18266. const ElImage = withInstall(Image$1);
  18267. const inputNumberProps = buildProps({
  18268. step: {
  18269. type: Number,
  18270. default: 1
  18271. },
  18272. stepStrictly: {
  18273. type: Boolean,
  18274. default: false
  18275. },
  18276. max: {
  18277. type: Number,
  18278. default: Number.POSITIVE_INFINITY
  18279. },
  18280. min: {
  18281. type: Number,
  18282. default: Number.NEGATIVE_INFINITY
  18283. },
  18284. modelValue: {
  18285. type: Number
  18286. },
  18287. disabled: {
  18288. type: Boolean,
  18289. default: false
  18290. },
  18291. size: {
  18292. type: String,
  18293. values: componentSizes
  18294. },
  18295. controls: {
  18296. type: Boolean,
  18297. default: true
  18298. },
  18299. controlsPosition: {
  18300. type: String,
  18301. default: "",
  18302. values: ["", "right"]
  18303. },
  18304. name: String,
  18305. label: String,
  18306. placeholder: String,
  18307. precision: {
  18308. type: Number,
  18309. validator: (val) => val >= 0 && val === Number.parseInt(`${val}`, 10)
  18310. }
  18311. });
  18312. const inputNumberEmits = {
  18313. change: (prev, cur) => prev !== cur,
  18314. blur: (e) => e instanceof FocusEvent,
  18315. focus: (e) => e instanceof FocusEvent,
  18316. input: (val) => isNumber(val),
  18317. "update:modelValue": (val) => isNumber(val) || val === void 0
  18318. };
  18319. const _sfc_main$q = defineComponent({
  18320. name: "ElInputNumber",
  18321. components: {
  18322. ElInput,
  18323. ElIcon,
  18324. ArrowUp: arrowUp,
  18325. ArrowDown: arrowDown,
  18326. Plus: plus,
  18327. Minus: minus
  18328. },
  18329. directives: {
  18330. RepeatClick
  18331. },
  18332. props: inputNumberProps,
  18333. emits: inputNumberEmits,
  18334. setup(props, { emit }) {
  18335. const input = ref();
  18336. const data2 = reactive({
  18337. currentValue: props.modelValue,
  18338. userInput: null
  18339. });
  18340. const { formItem } = useFormItem();
  18341. const ns = useNamespace("input-number");
  18342. const minDisabled = computed(() => ensurePrecision(props.modelValue, -1) < props.min);
  18343. const maxDisabled = computed(() => ensurePrecision(props.modelValue) > props.max);
  18344. const numPrecision = computed(() => {
  18345. const stepPrecision = getPrecision(props.step);
  18346. if (!isUndefined(props.precision)) {
  18347. if (stepPrecision > props.precision)
  18348. ;
  18349. return props.precision;
  18350. } else {
  18351. return Math.max(getPrecision(props.modelValue), stepPrecision);
  18352. }
  18353. });
  18354. const controlsAtRight = computed(() => {
  18355. return props.controls && props.controlsPosition === "right";
  18356. });
  18357. const inputNumberSize = useSize();
  18358. const inputNumberDisabled = useDisabled$1();
  18359. const displayValue = computed(() => {
  18360. if (data2.userInput !== null) {
  18361. return data2.userInput;
  18362. }
  18363. let currentValue = data2.currentValue;
  18364. if (isNumber(currentValue)) {
  18365. if (Number.isNaN(currentValue))
  18366. return "";
  18367. if (!isUndefined(props.precision)) {
  18368. currentValue = currentValue.toFixed(props.precision);
  18369. }
  18370. }
  18371. return currentValue;
  18372. });
  18373. const toPrecision = (num, pre) => {
  18374. if (isUndefined(pre))
  18375. pre = numPrecision.value;
  18376. return Number.parseFloat(`${Math.round(num * 10 ** pre) / 10 ** pre}`);
  18377. };
  18378. const getPrecision = (value) => {
  18379. if (isUndefined(value))
  18380. return 0;
  18381. const valueString = value.toString();
  18382. const dotPosition = valueString.indexOf(".");
  18383. let precision = 0;
  18384. if (dotPosition !== -1) {
  18385. precision = valueString.length - dotPosition - 1;
  18386. }
  18387. return precision;
  18388. };
  18389. const ensurePrecision = (val, coefficient = 1) => {
  18390. if (!isNumber(val))
  18391. return data2.currentValue;
  18392. val = isNumber(val) ? val : Number.NaN;
  18393. return toPrecision(val + props.step * coefficient);
  18394. };
  18395. const increase = () => {
  18396. if (inputNumberDisabled.value || maxDisabled.value)
  18397. return;
  18398. const value = props.modelValue || 0;
  18399. const newVal = ensurePrecision(value);
  18400. setCurrentValue(newVal);
  18401. };
  18402. const decrease = () => {
  18403. if (inputNumberDisabled.value || minDisabled.value)
  18404. return;
  18405. const value = props.modelValue || 0;
  18406. const newVal = ensurePrecision(value, -1);
  18407. setCurrentValue(newVal);
  18408. };
  18409. const verifyValue = (value, update) => {
  18410. const { max: max2, min: min2, step, precision, stepStrictly } = props;
  18411. let newVal = Number(value);
  18412. if (value === null) {
  18413. newVal = Number.NaN;
  18414. }
  18415. if (!Number.isNaN(newVal)) {
  18416. if (stepStrictly) {
  18417. newVal = Math.round(newVal / step) * step;
  18418. }
  18419. if (!isUndefined(precision)) {
  18420. newVal = toPrecision(newVal, precision);
  18421. }
  18422. if (newVal > max2 || newVal < min2) {
  18423. newVal = newVal > max2 ? max2 : min2;
  18424. update && emit("update:modelValue", newVal);
  18425. }
  18426. }
  18427. return newVal;
  18428. };
  18429. const setCurrentValue = (value) => {
  18430. var _a2;
  18431. const oldVal = data2.currentValue;
  18432. let newVal = verifyValue(value);
  18433. if (oldVal === newVal)
  18434. return;
  18435. if (Number.isNaN(newVal)) {
  18436. newVal = void 0;
  18437. }
  18438. data2.userInput = null;
  18439. emit("update:modelValue", newVal);
  18440. emit("input", newVal);
  18441. emit("change", newVal, oldVal);
  18442. (_a2 = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a2.call(formItem, "change").catch((err) => debugWarn());
  18443. data2.currentValue = newVal;
  18444. };
  18445. const handleInput = (value) => {
  18446. return data2.userInput = value;
  18447. };
  18448. const handleInputChange = (value) => {
  18449. const newVal = value !== "" ? Number(value) : "";
  18450. if (isNumber(newVal) && !Number.isNaN(newVal) || value === "") {
  18451. setCurrentValue(newVal);
  18452. }
  18453. data2.userInput = null;
  18454. };
  18455. const focus = () => {
  18456. var _a2, _b2;
  18457. (_b2 = (_a2 = input.value) == null ? void 0 : _a2.focus) == null ? void 0 : _b2.call(_a2);
  18458. };
  18459. const blur = () => {
  18460. var _a2, _b2;
  18461. (_b2 = (_a2 = input.value) == null ? void 0 : _a2.blur) == null ? void 0 : _b2.call(_a2);
  18462. };
  18463. const handleFocus = (event) => {
  18464. emit("focus", event);
  18465. };
  18466. const handleBlur = (event) => {
  18467. var _a2;
  18468. emit("blur", event);
  18469. (_a2 = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a2.call(formItem, "blur").catch((err) => debugWarn());
  18470. };
  18471. watch(() => props.modelValue, (value) => {
  18472. const newVal = verifyValue(value, true);
  18473. data2.currentValue = newVal;
  18474. data2.userInput = null;
  18475. }, { immediate: true });
  18476. onMounted(() => {
  18477. var _a2;
  18478. const innerInput = (_a2 = input.value) == null ? void 0 : _a2.input;
  18479. innerInput.setAttribute("role", "spinbutton");
  18480. innerInput.setAttribute("aria-valuemax", String(props.max));
  18481. innerInput.setAttribute("aria-valuemin", String(props.min));
  18482. innerInput.setAttribute("aria-valuenow", String(data2.currentValue));
  18483. innerInput.setAttribute("aria-disabled", String(inputNumberDisabled.value));
  18484. if (!isNumber(props.modelValue)) {
  18485. let val = Number(props.modelValue);
  18486. if (Number.isNaN(val)) {
  18487. val = void 0;
  18488. }
  18489. emit("update:modelValue", val);
  18490. }
  18491. });
  18492. onUpdated(() => {
  18493. var _a2;
  18494. const innerInput = (_a2 = input.value) == null ? void 0 : _a2.input;
  18495. innerInput == null ? void 0 : innerInput.setAttribute("aria-valuenow", data2.currentValue);
  18496. });
  18497. return {
  18498. input,
  18499. displayValue,
  18500. handleInput,
  18501. handleInputChange,
  18502. controlsAtRight,
  18503. decrease,
  18504. increase,
  18505. inputNumberSize,
  18506. inputNumberDisabled,
  18507. maxDisabled,
  18508. minDisabled,
  18509. focus,
  18510. blur,
  18511. handleFocus,
  18512. handleBlur,
  18513. ns
  18514. };
  18515. }
  18516. });
  18517. function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
  18518. const _component_arrow_down = resolveComponent("arrow-down");
  18519. const _component_minus = resolveComponent("minus");
  18520. const _component_el_icon = resolveComponent("el-icon");
  18521. const _component_arrow_up = resolveComponent("arrow-up");
  18522. const _component_plus = resolveComponent("plus");
  18523. const _component_el_input = resolveComponent("el-input");
  18524. const _directive_repeat_click = resolveDirective("repeat-click");
  18525. return openBlock(), createElementBlock("div", {
  18526. class: normalizeClass([
  18527. _ctx.ns.b(),
  18528. _ctx.ns.m(_ctx.inputNumberSize),
  18529. _ctx.ns.is("disabled", _ctx.inputNumberDisabled),
  18530. _ctx.ns.is("without-controls", !_ctx.controls),
  18531. _ctx.ns.is("controls-right", _ctx.controlsAtRight)
  18532. ]),
  18533. onDragstart: _cache[2] || (_cache[2] = withModifiers(() => {
  18534. }, ["prevent"]))
  18535. }, [
  18536. _ctx.controls ? withDirectives((openBlock(), createElementBlock("span", {
  18537. key: 0,
  18538. role: "button",
  18539. class: normalizeClass([_ctx.ns.e("decrease"), _ctx.ns.is("disabled", _ctx.minDisabled)]),
  18540. onKeydown: _cache[0] || (_cache[0] = withKeys((...args) => _ctx.decrease && _ctx.decrease(...args), ["enter"]))
  18541. }, [
  18542. createVNode(_component_el_icon, null, {
  18543. default: withCtx(() => [
  18544. _ctx.controlsAtRight ? (openBlock(), createBlock(_component_arrow_down, { key: 0 })) : (openBlock(), createBlock(_component_minus, { key: 1 }))
  18545. ]),
  18546. _: 1
  18547. })
  18548. ], 34)), [
  18549. [_directive_repeat_click, _ctx.decrease]
  18550. ]) : createCommentVNode("v-if", true),
  18551. _ctx.controls ? withDirectives((openBlock(), createElementBlock("span", {
  18552. key: 1,
  18553. role: "button",
  18554. class: normalizeClass([_ctx.ns.e("increase"), _ctx.ns.is("disabled", _ctx.maxDisabled)]),
  18555. onKeydown: _cache[1] || (_cache[1] = withKeys((...args) => _ctx.increase && _ctx.increase(...args), ["enter"]))
  18556. }, [
  18557. createVNode(_component_el_icon, null, {
  18558. default: withCtx(() => [
  18559. _ctx.controlsAtRight ? (openBlock(), createBlock(_component_arrow_up, { key: 0 })) : (openBlock(), createBlock(_component_plus, { key: 1 }))
  18560. ]),
  18561. _: 1
  18562. })
  18563. ], 34)), [
  18564. [_directive_repeat_click, _ctx.increase]
  18565. ]) : createCommentVNode("v-if", true),
  18566. createVNode(_component_el_input, {
  18567. ref: "input",
  18568. type: "number",
  18569. step: _ctx.step,
  18570. "model-value": _ctx.displayValue,
  18571. placeholder: _ctx.placeholder,
  18572. disabled: _ctx.inputNumberDisabled,
  18573. size: _ctx.inputNumberSize,
  18574. max: _ctx.max,
  18575. min: _ctx.min,
  18576. name: _ctx.name,
  18577. label: _ctx.label,
  18578. "validate-event": false,
  18579. onKeydown: [
  18580. withKeys(withModifiers(_ctx.increase, ["prevent"]), ["up"]),
  18581. withKeys(withModifiers(_ctx.decrease, ["prevent"]), ["down"])
  18582. ],
  18583. onBlur: _ctx.handleBlur,
  18584. onFocus: _ctx.handleFocus,
  18585. onInput: _ctx.handleInput,
  18586. onChange: _ctx.handleInputChange
  18587. }, null, 8, ["step", "model-value", "placeholder", "disabled", "size", "max", "min", "name", "label", "onKeydown", "onBlur", "onFocus", "onInput", "onChange"])
  18588. ], 34);
  18589. }
  18590. var InputNumber = /* @__PURE__ */ _export_sfc$1(_sfc_main$q, [["render", _sfc_render$d], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/input-number/src/input-number.vue"]]);
  18591. const ElInputNumber = withInstall(InputNumber);
  18592. const selectGroupKey = "ElSelectGroup";
  18593. const selectKey = "ElSelect";
  18594. function useOption(props, states) {
  18595. const select = inject(selectKey);
  18596. const selectGroup = inject(selectGroupKey, { disabled: false });
  18597. const isObject2 = computed(() => {
  18598. return Object.prototype.toString.call(props.value).toLowerCase() === "[object object]";
  18599. });
  18600. const itemSelected = computed(() => {
  18601. if (!select.props.multiple) {
  18602. return isEqual2(props.value, select.props.modelValue);
  18603. } else {
  18604. return contains2(select.props.modelValue, props.value);
  18605. }
  18606. });
  18607. const limitReached = computed(() => {
  18608. if (select.props.multiple) {
  18609. const modelValue = select.props.modelValue || [];
  18610. return !itemSelected.value && modelValue.length >= select.props.multipleLimit && select.props.multipleLimit > 0;
  18611. } else {
  18612. return false;
  18613. }
  18614. });
  18615. const currentLabel = computed(() => {
  18616. return props.label || (isObject2.value ? "" : props.value);
  18617. });
  18618. const currentValue = computed(() => {
  18619. return props.value || props.label || "";
  18620. });
  18621. const isDisabled = computed(() => {
  18622. return props.disabled || states.groupDisabled || limitReached.value;
  18623. });
  18624. const instance = getCurrentInstance();
  18625. const contains2 = (arr = [], target) => {
  18626. if (!isObject2.value) {
  18627. return arr && arr.includes(target);
  18628. } else {
  18629. const valueKey = select.props.valueKey;
  18630. return arr && arr.some((item) => {
  18631. return get(item, valueKey) === get(target, valueKey);
  18632. });
  18633. }
  18634. };
  18635. const isEqual2 = (a2, b2) => {
  18636. if (!isObject2.value) {
  18637. return a2 === b2;
  18638. } else {
  18639. const { valueKey } = select.props;
  18640. return get(a2, valueKey) === get(b2, valueKey);
  18641. }
  18642. };
  18643. const hoverItem = () => {
  18644. if (!props.disabled && !selectGroup.disabled) {
  18645. select.hoverIndex = select.optionsArray.indexOf(instance.proxy);
  18646. }
  18647. };
  18648. watch(() => currentLabel.value, () => {
  18649. if (!props.created && !select.props.remote)
  18650. select.setSelected();
  18651. });
  18652. watch(() => props.value, (val, oldVal) => {
  18653. const { remote, valueKey } = select.props;
  18654. if (!props.created && !remote) {
  18655. if (valueKey && typeof val === "object" && typeof oldVal === "object" && val[valueKey] === oldVal[valueKey]) {
  18656. return;
  18657. }
  18658. select.setSelected();
  18659. }
  18660. });
  18661. watch(() => selectGroup.disabled, () => {
  18662. states.groupDisabled = selectGroup.disabled;
  18663. }, { immediate: true });
  18664. const { queryChange } = toRaw(select);
  18665. watch(queryChange, (changes) => {
  18666. const { query } = unref(changes);
  18667. const regexp4 = new RegExp(escapeStringRegexp(query), "i");
  18668. states.visible = regexp4.test(currentLabel.value) || props.created;
  18669. if (!states.visible) {
  18670. select.filteredOptionsCount--;
  18671. }
  18672. });
  18673. return {
  18674. select,
  18675. currentLabel,
  18676. currentValue,
  18677. itemSelected,
  18678. isDisabled,
  18679. hoverItem
  18680. };
  18681. }
  18682. const _sfc_main$p = defineComponent({
  18683. name: "ElOption",
  18684. componentName: "ElOption",
  18685. props: {
  18686. value: {
  18687. required: true,
  18688. type: [String, Number, Boolean, Object]
  18689. },
  18690. label: [String, Number],
  18691. created: Boolean,
  18692. disabled: {
  18693. type: Boolean,
  18694. default: false
  18695. }
  18696. },
  18697. setup(props) {
  18698. const ns = useNamespace("select");
  18699. const states = reactive({
  18700. index: -1,
  18701. groupDisabled: false,
  18702. visible: true,
  18703. hitState: false,
  18704. hover: false
  18705. });
  18706. const { currentLabel, itemSelected, isDisabled, select, hoverItem } = useOption(props, states);
  18707. const { visible, hover } = toRefs(states);
  18708. const vm = getCurrentInstance().proxy;
  18709. const key = vm.value;
  18710. select.onOptionCreate(vm);
  18711. onBeforeUnmount(() => {
  18712. const { selected } = select;
  18713. const selectedOptions = select.props.multiple ? selected : [selected];
  18714. const doesSelected = selectedOptions.some((item) => {
  18715. return item.value === vm.value;
  18716. });
  18717. if (select.cachedOptions.get(key) === vm && !doesSelected) {
  18718. nextTick(() => {
  18719. select.cachedOptions.delete(key);
  18720. });
  18721. }
  18722. select.onOptionDestroy(key, vm);
  18723. });
  18724. function selectOptionClick() {
  18725. if (props.disabled !== true && states.groupDisabled !== true) {
  18726. select.handleOptionSelect(vm, true);
  18727. }
  18728. }
  18729. return {
  18730. ns,
  18731. currentLabel,
  18732. itemSelected,
  18733. isDisabled,
  18734. select,
  18735. hoverItem,
  18736. visible,
  18737. hover,
  18738. selectOptionClick,
  18739. states
  18740. };
  18741. }
  18742. });
  18743. function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
  18744. return withDirectives((openBlock(), createElementBlock("li", {
  18745. class: normalizeClass([
  18746. _ctx.ns.be("dropdown", "item"),
  18747. _ctx.ns.is("disabled", _ctx.isDisabled),
  18748. {
  18749. selected: _ctx.itemSelected,
  18750. hover: _ctx.hover
  18751. }
  18752. ]),
  18753. onMouseenter: _cache[0] || (_cache[0] = (...args) => _ctx.hoverItem && _ctx.hoverItem(...args)),
  18754. onClick: _cache[1] || (_cache[1] = withModifiers((...args) => _ctx.selectOptionClick && _ctx.selectOptionClick(...args), ["stop"]))
  18755. }, [
  18756. renderSlot(_ctx.$slots, "default", {}, () => [
  18757. createElementVNode("span", null, toDisplayString(_ctx.currentLabel), 1)
  18758. ])
  18759. ], 34)), [
  18760. [vShow, _ctx.visible]
  18761. ]);
  18762. }
  18763. var Option = /* @__PURE__ */ _export_sfc$1(_sfc_main$p, [["render", _sfc_render$c], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/select/src/option.vue"]]);
  18764. const _sfc_main$o = defineComponent({
  18765. name: "ElSelectDropdown",
  18766. componentName: "ElSelectDropdown",
  18767. setup() {
  18768. const select = inject(selectKey);
  18769. const ns = useNamespace("select");
  18770. const popperClass = computed(() => select.props.popperClass);
  18771. const isMultiple = computed(() => select.props.multiple);
  18772. const isFitInputWidth = computed(() => select.props.fitInputWidth);
  18773. const minWidth = ref("");
  18774. function updateMinWidth() {
  18775. var _a2;
  18776. minWidth.value = `${(_a2 = select.selectWrapper) == null ? void 0 : _a2.getBoundingClientRect().width}px`;
  18777. }
  18778. onMounted(() => {
  18779. updateMinWidth();
  18780. addResizeListener(select.selectWrapper, updateMinWidth);
  18781. });
  18782. onBeforeUnmount(() => {
  18783. removeResizeListener(select.selectWrapper, updateMinWidth);
  18784. });
  18785. return {
  18786. ns,
  18787. minWidth,
  18788. popperClass,
  18789. isMultiple,
  18790. isFitInputWidth
  18791. };
  18792. }
  18793. });
  18794. function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
  18795. return openBlock(), createElementBlock("div", {
  18796. class: normalizeClass([_ctx.ns.b("dropdown"), _ctx.ns.is("multiple", _ctx.isMultiple), _ctx.popperClass]),
  18797. style: normalizeStyle({ [_ctx.isFitInputWidth ? "width" : "minWidth"]: _ctx.minWidth })
  18798. }, [
  18799. renderSlot(_ctx.$slots, "default")
  18800. ], 6);
  18801. }
  18802. var ElSelectMenu = /* @__PURE__ */ _export_sfc$1(_sfc_main$o, [["render", _sfc_render$b], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/select/src/select-dropdown.vue"]]);
  18803. function useSelectStates(props) {
  18804. const { t } = useLocale();
  18805. return reactive({
  18806. options: /* @__PURE__ */ new Map(),
  18807. cachedOptions: /* @__PURE__ */ new Map(),
  18808. createdLabel: null,
  18809. createdSelected: false,
  18810. selected: props.multiple ? [] : {},
  18811. inputLength: 20,
  18812. inputWidth: 0,
  18813. initialInputHeight: 0,
  18814. optionsCount: 0,
  18815. filteredOptionsCount: 0,
  18816. visible: false,
  18817. softFocus: false,
  18818. selectedLabel: "",
  18819. hoverIndex: -1,
  18820. query: "",
  18821. previousQuery: null,
  18822. inputHovering: false,
  18823. cachedPlaceHolder: "",
  18824. currentPlaceholder: t("el.select.placeholder"),
  18825. menuVisibleOnFocus: false,
  18826. isOnComposition: false,
  18827. isSilentBlur: false,
  18828. prefixWidth: 11,
  18829. tagInMultiLine: false
  18830. });
  18831. }
  18832. const useSelect = (props, states, ctx) => {
  18833. const { t } = useLocale();
  18834. const ns = useNamespace("select");
  18835. const reference2 = ref(null);
  18836. const input = ref(null);
  18837. const tooltipRef = ref(null);
  18838. const tags = ref(null);
  18839. const selectWrapper = ref(null);
  18840. const scrollbar = ref(null);
  18841. const hoverOption = ref(-1);
  18842. const queryChange = shallowRef({ query: "" });
  18843. const groupQueryChange = shallowRef("");
  18844. const elForm2 = inject(formContextKey, {});
  18845. const elFormItem2 = inject(formItemContextKey, {});
  18846. const readonly2 = computed(() => !props.filterable || props.multiple || !states.visible);
  18847. const selectDisabled = computed(() => props.disabled || elForm2.disabled);
  18848. const showClose = computed(() => {
  18849. const hasValue = props.multiple ? Array.isArray(props.modelValue) && props.modelValue.length > 0 : props.modelValue !== void 0 && props.modelValue !== null && props.modelValue !== "";
  18850. const criteria = props.clearable && !selectDisabled.value && states.inputHovering && hasValue;
  18851. return criteria;
  18852. });
  18853. const iconComponent = computed(() => props.remote && props.filterable ? "" : props.suffixIcon);
  18854. const iconReverse = computed(() => ns.is("reverse", iconComponent.value && states.visible));
  18855. const debounce$1$1 = computed(() => props.remote ? 300 : 0);
  18856. const emptyText = computed(() => {
  18857. if (props.loading) {
  18858. return props.loadingText || t("el.select.loading");
  18859. } else {
  18860. if (props.remote && states.query === "" && states.options.size === 0)
  18861. return false;
  18862. if (props.filterable && states.query && states.options.size > 0 && states.filteredOptionsCount === 0) {
  18863. return props.noMatchText || t("el.select.noMatch");
  18864. }
  18865. if (states.options.size === 0) {
  18866. return props.noDataText || t("el.select.noData");
  18867. }
  18868. }
  18869. return null;
  18870. });
  18871. const optionsArray = computed(() => Array.from(states.options.values()));
  18872. const cachedOptionsArray = computed(() => Array.from(states.cachedOptions.values()));
  18873. const showNewOption = computed(() => {
  18874. const hasExistingOption = optionsArray.value.filter((option) => {
  18875. return !option.created;
  18876. }).some((option) => {
  18877. return option.currentLabel === states.query;
  18878. });
  18879. return props.filterable && props.allowCreate && states.query !== "" && !hasExistingOption;
  18880. });
  18881. const selectSize = useSize();
  18882. const collapseTagSize = computed(() => ["small"].includes(selectSize.value) ? "small" : "default");
  18883. const dropMenuVisible = computed({
  18884. get() {
  18885. return states.visible && emptyText.value !== false;
  18886. },
  18887. set(val) {
  18888. states.visible = val;
  18889. }
  18890. });
  18891. watch(() => selectDisabled.value, () => {
  18892. nextTick(() => {
  18893. resetInputHeight();
  18894. });
  18895. });
  18896. watch(() => props.placeholder, (val) => {
  18897. states.cachedPlaceHolder = states.currentPlaceholder = val;
  18898. });
  18899. watch(() => props.modelValue, (val, oldVal) => {
  18900. var _a2;
  18901. if (props.multiple) {
  18902. resetInputHeight();
  18903. if (val && val.length > 0 || input.value && states.query !== "") {
  18904. states.currentPlaceholder = "";
  18905. } else {
  18906. states.currentPlaceholder = states.cachedPlaceHolder;
  18907. }
  18908. if (props.filterable && !props.reserveKeyword) {
  18909. states.query = "";
  18910. handleQueryChange(states.query);
  18911. }
  18912. }
  18913. setSelected();
  18914. if (props.filterable && !props.multiple) {
  18915. states.inputLength = 20;
  18916. }
  18917. if (!isEqual(val, oldVal)) {
  18918. (_a2 = elFormItem2.validate) == null ? void 0 : _a2.call(elFormItem2, "change").catch((err) => debugWarn());
  18919. }
  18920. }, {
  18921. flush: "post",
  18922. deep: true
  18923. });
  18924. watch(() => states.visible, (val) => {
  18925. var _a2, _b2, _c;
  18926. if (!val) {
  18927. input.value && input.value.blur();
  18928. states.query = "";
  18929. states.previousQuery = null;
  18930. states.selectedLabel = "";
  18931. states.inputLength = 20;
  18932. states.menuVisibleOnFocus = false;
  18933. resetHoverIndex();
  18934. nextTick(() => {
  18935. if (input.value && input.value.value === "" && states.selected.length === 0) {
  18936. states.currentPlaceholder = states.cachedPlaceHolder;
  18937. }
  18938. });
  18939. if (!props.multiple) {
  18940. if (states.selected) {
  18941. if (props.filterable && props.allowCreate && states.createdSelected && states.createdLabel) {
  18942. states.selectedLabel = states.createdLabel;
  18943. } else {
  18944. states.selectedLabel = states.selected.currentLabel;
  18945. }
  18946. if (props.filterable)
  18947. states.query = states.selectedLabel;
  18948. }
  18949. if (props.filterable) {
  18950. states.currentPlaceholder = states.cachedPlaceHolder;
  18951. }
  18952. }
  18953. } else {
  18954. (_b2 = (_a2 = tooltipRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b2.call(_a2);
  18955. if (props.filterable) {
  18956. states.filteredOptionsCount = states.optionsCount;
  18957. states.query = props.remote ? "" : states.selectedLabel;
  18958. if (props.multiple) {
  18959. (_c = input.value) == null ? void 0 : _c.focus();
  18960. } else {
  18961. if (states.selectedLabel) {
  18962. states.currentPlaceholder = `${states.selectedLabel}`;
  18963. states.selectedLabel = "";
  18964. }
  18965. }
  18966. handleQueryChange(states.query);
  18967. if (!props.multiple && !props.remote) {
  18968. queryChange.value.query = "";
  18969. triggerRef(queryChange);
  18970. triggerRef(groupQueryChange);
  18971. }
  18972. }
  18973. }
  18974. ctx.emit("visible-change", val);
  18975. });
  18976. watch(() => states.options.entries(), () => {
  18977. var _a2, _b2, _c;
  18978. if (!isClient$1)
  18979. return;
  18980. (_b2 = (_a2 = tooltipRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b2.call(_a2);
  18981. if (props.multiple) {
  18982. resetInputHeight();
  18983. }
  18984. const inputs = ((_c = selectWrapper.value) == null ? void 0 : _c.querySelectorAll("input")) || [];
  18985. if (!Array.from(inputs).includes(document.activeElement)) {
  18986. setSelected();
  18987. }
  18988. if (props.defaultFirstOption && (props.filterable || props.remote) && states.filteredOptionsCount) {
  18989. checkDefaultFirstOption();
  18990. }
  18991. }, {
  18992. flush: "post"
  18993. });
  18994. watch(() => states.hoverIndex, (val) => {
  18995. if (typeof val === "number" && val > -1) {
  18996. hoverOption.value = optionsArray.value[val] || {};
  18997. }
  18998. optionsArray.value.forEach((option) => {
  18999. option.hover = hoverOption.value === option;
  19000. });
  19001. });
  19002. const resetInputHeight = () => {
  19003. if (props.collapseTags && !props.filterable)
  19004. return;
  19005. nextTick(() => {
  19006. var _a2, _b2;
  19007. if (!reference2.value)
  19008. return;
  19009. const input2 = reference2.value.$el.querySelector("input");
  19010. const _tags = tags.value;
  19011. const sizeInMap = states.initialInputHeight || getComponentSize(selectSize.value || elForm2.size);
  19012. input2.style.height = states.selected.length === 0 ? `${sizeInMap}px` : `${Math.max(_tags ? _tags.clientHeight + (_tags.clientHeight > sizeInMap ? 6 : 0) : 0, sizeInMap)}px`;
  19013. states.tagInMultiLine = Number.parseFloat(input2.style.height) >= sizeInMap;
  19014. if (states.visible && emptyText.value !== false) {
  19015. (_b2 = (_a2 = tooltipRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b2.call(_a2);
  19016. }
  19017. });
  19018. };
  19019. const handleQueryChange = (val) => {
  19020. if (states.previousQuery === val || states.isOnComposition)
  19021. return;
  19022. if (states.previousQuery === null && (typeof props.filterMethod === "function" || typeof props.remoteMethod === "function")) {
  19023. states.previousQuery = val;
  19024. return;
  19025. }
  19026. states.previousQuery = val;
  19027. nextTick(() => {
  19028. var _a2, _b2;
  19029. if (states.visible)
  19030. (_b2 = (_a2 = tooltipRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b2.call(_a2);
  19031. });
  19032. states.hoverIndex = -1;
  19033. if (props.multiple && props.filterable) {
  19034. nextTick(() => {
  19035. const length = input.value.value.length * 15 + 20;
  19036. states.inputLength = props.collapseTags ? Math.min(50, length) : length;
  19037. managePlaceholder();
  19038. resetInputHeight();
  19039. });
  19040. }
  19041. if (props.remote && typeof props.remoteMethod === "function") {
  19042. states.hoverIndex = -1;
  19043. props.remoteMethod(val);
  19044. } else if (typeof props.filterMethod === "function") {
  19045. props.filterMethod(val);
  19046. triggerRef(groupQueryChange);
  19047. } else {
  19048. states.filteredOptionsCount = states.optionsCount;
  19049. queryChange.value.query = val;
  19050. triggerRef(queryChange);
  19051. triggerRef(groupQueryChange);
  19052. }
  19053. if (props.defaultFirstOption && (props.filterable || props.remote) && states.filteredOptionsCount) {
  19054. checkDefaultFirstOption();
  19055. }
  19056. };
  19057. const managePlaceholder = () => {
  19058. if (states.currentPlaceholder !== "") {
  19059. states.currentPlaceholder = input.value.value ? "" : states.cachedPlaceHolder;
  19060. }
  19061. };
  19062. const checkDefaultFirstOption = () => {
  19063. const optionsInDropdown = optionsArray.value.filter((n) => n.visible && !n.disabled && !n.states.groupDisabled);
  19064. const userCreatedOption = optionsInDropdown.find((n) => n.created);
  19065. const firstOriginOption = optionsInDropdown[0];
  19066. states.hoverIndex = getValueIndex(optionsArray.value, userCreatedOption || firstOriginOption);
  19067. };
  19068. const setSelected = () => {
  19069. var _a2;
  19070. if (!props.multiple) {
  19071. const option = getOption(props.modelValue);
  19072. if ((_a2 = option.props) == null ? void 0 : _a2.created) {
  19073. states.createdLabel = option.props.value;
  19074. states.createdSelected = true;
  19075. } else {
  19076. states.createdSelected = false;
  19077. }
  19078. states.selectedLabel = option.currentLabel;
  19079. states.selected = option;
  19080. if (props.filterable)
  19081. states.query = states.selectedLabel;
  19082. return;
  19083. } else {
  19084. states.selectedLabel = "";
  19085. }
  19086. const result = [];
  19087. if (Array.isArray(props.modelValue)) {
  19088. props.modelValue.forEach((value) => {
  19089. result.push(getOption(value));
  19090. });
  19091. }
  19092. states.selected = result;
  19093. nextTick(() => {
  19094. resetInputHeight();
  19095. });
  19096. };
  19097. const getOption = (value) => {
  19098. let option;
  19099. const isObjectValue = toRawType(value).toLowerCase() === "object";
  19100. const isNull = toRawType(value).toLowerCase() === "null";
  19101. const isUndefined2 = toRawType(value).toLowerCase() === "undefined";
  19102. for (let i = states.cachedOptions.size - 1; i >= 0; i--) {
  19103. const cachedOption = cachedOptionsArray.value[i];
  19104. const isEqualValue = isObjectValue ? get(cachedOption, props.valueKey) === get(value, props.valueKey) : cachedOption.value === value;
  19105. if (isEqualValue) {
  19106. option = {
  19107. value,
  19108. currentLabel: cachedOption.currentLabel,
  19109. isDisabled: cachedOption.isDisabled
  19110. };
  19111. break;
  19112. }
  19113. }
  19114. if (option)
  19115. return option;
  19116. const label = isObjectValue ? value.label : !isNull && !isUndefined2 ? value : "";
  19117. const newOption = {
  19118. value,
  19119. currentLabel: label
  19120. };
  19121. if (props.multiple) {
  19122. newOption.hitState = false;
  19123. }
  19124. return newOption;
  19125. };
  19126. const resetHoverIndex = () => {
  19127. setTimeout(() => {
  19128. const valueKey = props.valueKey;
  19129. if (!props.multiple) {
  19130. states.hoverIndex = optionsArray.value.findIndex((item) => {
  19131. return getValueKey(item) === getValueKey(states.selected);
  19132. });
  19133. } else {
  19134. if (states.selected.length > 0) {
  19135. states.hoverIndex = Math.min.apply(null, states.selected.map((selected) => {
  19136. return optionsArray.value.findIndex((item) => {
  19137. return get(item, valueKey) === get(selected, valueKey);
  19138. });
  19139. }));
  19140. } else {
  19141. states.hoverIndex = -1;
  19142. }
  19143. }
  19144. }, 300);
  19145. };
  19146. const handleResize = () => {
  19147. var _a2, _b2;
  19148. resetInputWidth();
  19149. (_b2 = (_a2 = tooltipRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b2.call(_a2);
  19150. if (props.multiple && !props.filterable)
  19151. resetInputHeight();
  19152. };
  19153. const resetInputWidth = () => {
  19154. var _a2;
  19155. states.inputWidth = (_a2 = reference2.value) == null ? void 0 : _a2.$el.getBoundingClientRect().width;
  19156. };
  19157. const onInputChange = () => {
  19158. if (props.filterable && states.query !== states.selectedLabel) {
  19159. states.query = states.selectedLabel;
  19160. handleQueryChange(states.query);
  19161. }
  19162. };
  19163. const debouncedOnInputChange = debounce$1(() => {
  19164. onInputChange();
  19165. }, debounce$1$1.value);
  19166. const debouncedQueryChange = debounce$1((e) => {
  19167. handleQueryChange(e.target.value);
  19168. }, debounce$1$1.value);
  19169. const emitChange = (val) => {
  19170. if (!isEqual(props.modelValue, val)) {
  19171. ctx.emit(CHANGE_EVENT, val);
  19172. }
  19173. };
  19174. const deletePrevTag = (e) => {
  19175. if (e.target.value.length <= 0 && !toggleLastOptionHitState()) {
  19176. const value = props.modelValue.slice();
  19177. value.pop();
  19178. ctx.emit(UPDATE_MODEL_EVENT, value);
  19179. emitChange(value);
  19180. }
  19181. if (e.target.value.length === 1 && props.modelValue.length === 0) {
  19182. states.currentPlaceholder = states.cachedPlaceHolder;
  19183. }
  19184. };
  19185. const deleteTag = (event, tag) => {
  19186. const index = states.selected.indexOf(tag);
  19187. if (index > -1 && !selectDisabled.value) {
  19188. const value = props.modelValue.slice();
  19189. value.splice(index, 1);
  19190. ctx.emit(UPDATE_MODEL_EVENT, value);
  19191. emitChange(value);
  19192. ctx.emit("remove-tag", tag.value);
  19193. }
  19194. event.stopPropagation();
  19195. };
  19196. const deleteSelected = (event) => {
  19197. event.stopPropagation();
  19198. const value = props.multiple ? [] : "";
  19199. if (typeof value !== "string") {
  19200. for (const item of states.selected) {
  19201. if (item.isDisabled)
  19202. value.push(item.value);
  19203. }
  19204. }
  19205. ctx.emit(UPDATE_MODEL_EVENT, value);
  19206. emitChange(value);
  19207. states.visible = false;
  19208. ctx.emit("clear");
  19209. };
  19210. const handleOptionSelect = (option, byClick) => {
  19211. var _a2;
  19212. if (props.multiple) {
  19213. const value = (props.modelValue || []).slice();
  19214. const optionIndex = getValueIndex(value, option.value);
  19215. if (optionIndex > -1) {
  19216. value.splice(optionIndex, 1);
  19217. } else if (props.multipleLimit <= 0 || value.length < props.multipleLimit) {
  19218. value.push(option.value);
  19219. }
  19220. ctx.emit(UPDATE_MODEL_EVENT, value);
  19221. emitChange(value);
  19222. if (option.created) {
  19223. states.query = "";
  19224. handleQueryChange("");
  19225. states.inputLength = 20;
  19226. }
  19227. if (props.filterable)
  19228. (_a2 = input.value) == null ? void 0 : _a2.focus();
  19229. } else {
  19230. ctx.emit(UPDATE_MODEL_EVENT, option.value);
  19231. emitChange(option.value);
  19232. states.visible = false;
  19233. }
  19234. states.isSilentBlur = byClick;
  19235. setSoftFocus();
  19236. if (states.visible)
  19237. return;
  19238. nextTick(() => {
  19239. scrollToOption(option);
  19240. });
  19241. };
  19242. const getValueIndex = (arr = [], value) => {
  19243. if (!isObject$1(value))
  19244. return arr.indexOf(value);
  19245. const valueKey = props.valueKey;
  19246. let index = -1;
  19247. arr.some((item, i) => {
  19248. if (get(item, valueKey) === get(value, valueKey)) {
  19249. index = i;
  19250. return true;
  19251. }
  19252. return false;
  19253. });
  19254. return index;
  19255. };
  19256. const setSoftFocus = () => {
  19257. states.softFocus = true;
  19258. const _input = input.value || reference2.value;
  19259. if (_input) {
  19260. _input == null ? void 0 : _input.focus();
  19261. }
  19262. };
  19263. const scrollToOption = (option) => {
  19264. var _a2, _b2, _c, _d, _e;
  19265. const targetOption = Array.isArray(option) ? option[0] : option;
  19266. let target = null;
  19267. if (targetOption == null ? void 0 : targetOption.value) {
  19268. const options = optionsArray.value.filter((item) => item.value === targetOption.value);
  19269. if (options.length > 0) {
  19270. target = options[0].$el;
  19271. }
  19272. }
  19273. if (tooltipRef.value && target) {
  19274. const menu = (_d = (_c = (_b2 = (_a2 = tooltipRef.value) == null ? void 0 : _a2.popperRef) == null ? void 0 : _b2.contentRef) == null ? void 0 : _c.querySelector) == null ? void 0 : _d.call(_c, `.${ns.be("dropdown", "wrap")}`);
  19275. if (menu) {
  19276. scrollIntoView(menu, target);
  19277. }
  19278. }
  19279. (_e = scrollbar.value) == null ? void 0 : _e.handleScroll();
  19280. };
  19281. const onOptionCreate = (vm) => {
  19282. states.optionsCount++;
  19283. states.filteredOptionsCount++;
  19284. states.options.set(vm.value, vm);
  19285. states.cachedOptions.set(vm.value, vm);
  19286. };
  19287. const onOptionDestroy = (key, vm) => {
  19288. if (states.options.get(key) === vm) {
  19289. states.optionsCount--;
  19290. states.filteredOptionsCount--;
  19291. states.options.delete(key);
  19292. }
  19293. };
  19294. const resetInputState = (e) => {
  19295. if (e.code !== EVENT_CODE.backspace)
  19296. toggleLastOptionHitState(false);
  19297. states.inputLength = input.value.value.length * 15 + 20;
  19298. resetInputHeight();
  19299. };
  19300. const toggleLastOptionHitState = (hit) => {
  19301. if (!Array.isArray(states.selected))
  19302. return;
  19303. const option = states.selected[states.selected.length - 1];
  19304. if (!option)
  19305. return;
  19306. if (hit === true || hit === false) {
  19307. option.hitState = hit;
  19308. return hit;
  19309. }
  19310. option.hitState = !option.hitState;
  19311. return option.hitState;
  19312. };
  19313. const handleComposition = (event) => {
  19314. const text = event.target.value;
  19315. if (event.type === "compositionend") {
  19316. states.isOnComposition = false;
  19317. nextTick(() => handleQueryChange(text));
  19318. } else {
  19319. const lastCharacter = text[text.length - 1] || "";
  19320. states.isOnComposition = !isKorean(lastCharacter);
  19321. }
  19322. };
  19323. const handleMenuEnter = () => {
  19324. nextTick(() => scrollToOption(states.selected));
  19325. };
  19326. const handleFocus = (event) => {
  19327. if (!states.softFocus) {
  19328. if (props.automaticDropdown || props.filterable) {
  19329. if (props.filterable && !states.visible) {
  19330. states.menuVisibleOnFocus = true;
  19331. }
  19332. states.visible = true;
  19333. }
  19334. ctx.emit("focus", event);
  19335. } else {
  19336. states.softFocus = false;
  19337. }
  19338. };
  19339. const blur = () => {
  19340. var _a2;
  19341. states.visible = false;
  19342. (_a2 = reference2.value) == null ? void 0 : _a2.blur();
  19343. };
  19344. const handleBlur = (event) => {
  19345. nextTick(() => {
  19346. if (states.isSilentBlur) {
  19347. states.isSilentBlur = false;
  19348. } else {
  19349. ctx.emit("blur", event);
  19350. }
  19351. });
  19352. states.softFocus = false;
  19353. };
  19354. const handleClearClick = (event) => {
  19355. deleteSelected(event);
  19356. };
  19357. const handleClose = () => {
  19358. states.visible = false;
  19359. };
  19360. const toggleMenu = () => {
  19361. var _a2;
  19362. if (props.automaticDropdown)
  19363. return;
  19364. if (!selectDisabled.value) {
  19365. if (states.menuVisibleOnFocus) {
  19366. states.menuVisibleOnFocus = false;
  19367. } else {
  19368. states.visible = !states.visible;
  19369. }
  19370. if (states.visible) {
  19371. (_a2 = input.value || reference2.value) == null ? void 0 : _a2.focus();
  19372. }
  19373. }
  19374. };
  19375. const selectOption = () => {
  19376. if (!states.visible) {
  19377. toggleMenu();
  19378. } else {
  19379. if (optionsArray.value[states.hoverIndex]) {
  19380. handleOptionSelect(optionsArray.value[states.hoverIndex], void 0);
  19381. }
  19382. }
  19383. };
  19384. const getValueKey = (item) => {
  19385. return isObject$1(item.value) ? get(item.value, props.valueKey) : item.value;
  19386. };
  19387. const optionsAllDisabled = computed(() => optionsArray.value.filter((option) => option.visible).every((option) => option.disabled));
  19388. const navigateOptions = (direction) => {
  19389. if (!states.visible) {
  19390. states.visible = true;
  19391. return;
  19392. }
  19393. if (states.options.size === 0 || states.filteredOptionsCount === 0)
  19394. return;
  19395. if (states.isOnComposition)
  19396. return;
  19397. if (!optionsAllDisabled.value) {
  19398. if (direction === "next") {
  19399. states.hoverIndex++;
  19400. if (states.hoverIndex === states.options.size) {
  19401. states.hoverIndex = 0;
  19402. }
  19403. } else if (direction === "prev") {
  19404. states.hoverIndex--;
  19405. if (states.hoverIndex < 0) {
  19406. states.hoverIndex = states.options.size - 1;
  19407. }
  19408. }
  19409. const option = optionsArray.value[states.hoverIndex];
  19410. if (option.disabled === true || option.states.groupDisabled === true || !option.visible) {
  19411. navigateOptions(direction);
  19412. }
  19413. nextTick(() => scrollToOption(hoverOption.value));
  19414. }
  19415. };
  19416. return {
  19417. optionsArray,
  19418. selectSize,
  19419. handleResize,
  19420. debouncedOnInputChange,
  19421. debouncedQueryChange,
  19422. deletePrevTag,
  19423. deleteTag,
  19424. deleteSelected,
  19425. handleOptionSelect,
  19426. scrollToOption,
  19427. readonly: readonly2,
  19428. resetInputHeight,
  19429. showClose,
  19430. iconComponent,
  19431. iconReverse,
  19432. showNewOption,
  19433. collapseTagSize,
  19434. setSelected,
  19435. managePlaceholder,
  19436. selectDisabled,
  19437. emptyText,
  19438. toggleLastOptionHitState,
  19439. resetInputState,
  19440. handleComposition,
  19441. onOptionCreate,
  19442. onOptionDestroy,
  19443. handleMenuEnter,
  19444. handleFocus,
  19445. blur,
  19446. handleBlur,
  19447. handleClearClick,
  19448. handleClose,
  19449. toggleMenu,
  19450. selectOption,
  19451. getValueKey,
  19452. navigateOptions,
  19453. dropMenuVisible,
  19454. queryChange,
  19455. groupQueryChange,
  19456. reference: reference2,
  19457. input,
  19458. tooltipRef,
  19459. tags,
  19460. selectWrapper,
  19461. scrollbar
  19462. };
  19463. };
  19464. const COMPONENT_NAME$1 = "ElSelect";
  19465. const _sfc_main$n = defineComponent({
  19466. name: COMPONENT_NAME$1,
  19467. componentName: COMPONENT_NAME$1,
  19468. components: {
  19469. ElInput,
  19470. ElSelectMenu,
  19471. ElOption: Option,
  19472. ElTag,
  19473. ElScrollbar,
  19474. ElTooltip,
  19475. ElIcon
  19476. },
  19477. directives: { ClickOutside },
  19478. props: {
  19479. name: String,
  19480. id: String,
  19481. modelValue: {
  19482. type: [Array, String, Number, Boolean, Object],
  19483. default: void 0
  19484. },
  19485. autocomplete: {
  19486. type: String,
  19487. default: "off"
  19488. },
  19489. automaticDropdown: Boolean,
  19490. size: {
  19491. type: String,
  19492. validator: isValidComponentSize
  19493. },
  19494. effect: {
  19495. type: String,
  19496. default: "light"
  19497. },
  19498. disabled: Boolean,
  19499. clearable: Boolean,
  19500. filterable: Boolean,
  19501. allowCreate: Boolean,
  19502. loading: Boolean,
  19503. popperClass: {
  19504. type: String,
  19505. default: ""
  19506. },
  19507. remote: Boolean,
  19508. loadingText: String,
  19509. noMatchText: String,
  19510. noDataText: String,
  19511. remoteMethod: Function,
  19512. filterMethod: Function,
  19513. multiple: Boolean,
  19514. multipleLimit: {
  19515. type: Number,
  19516. default: 0
  19517. },
  19518. placeholder: {
  19519. type: String
  19520. },
  19521. defaultFirstOption: Boolean,
  19522. reserveKeyword: {
  19523. type: Boolean,
  19524. default: true
  19525. },
  19526. valueKey: {
  19527. type: String,
  19528. default: "value"
  19529. },
  19530. collapseTags: Boolean,
  19531. collapseTagsTooltip: {
  19532. type: Boolean,
  19533. default: false
  19534. },
  19535. popperAppendToBody: {
  19536. type: Boolean,
  19537. default: void 0
  19538. },
  19539. teleported: useTooltipContentProps.teleported,
  19540. persistent: {
  19541. type: Boolean,
  19542. default: true
  19543. },
  19544. clearIcon: {
  19545. type: [String, Object],
  19546. default: circleClose
  19547. },
  19548. fitInputWidth: {
  19549. type: Boolean,
  19550. default: false
  19551. },
  19552. suffixIcon: {
  19553. type: [String, Object],
  19554. default: arrowUp
  19555. },
  19556. tagType: __spreadProps(__spreadValues({}, tagProps.type), { default: "info" })
  19557. },
  19558. emits: [
  19559. UPDATE_MODEL_EVENT,
  19560. CHANGE_EVENT,
  19561. "remove-tag",
  19562. "clear",
  19563. "visible-change",
  19564. "focus",
  19565. "blur"
  19566. ],
  19567. setup(props, ctx) {
  19568. const nsSelect = useNamespace("select");
  19569. const nsInput = useNamespace("input");
  19570. const { t } = useLocale();
  19571. const states = useSelectStates(props);
  19572. const {
  19573. optionsArray,
  19574. selectSize,
  19575. readonly: readonly2,
  19576. handleResize,
  19577. collapseTagSize,
  19578. debouncedOnInputChange,
  19579. debouncedQueryChange,
  19580. deletePrevTag,
  19581. deleteTag,
  19582. deleteSelected,
  19583. handleOptionSelect,
  19584. scrollToOption,
  19585. setSelected,
  19586. resetInputHeight,
  19587. managePlaceholder,
  19588. showClose,
  19589. selectDisabled,
  19590. iconComponent,
  19591. iconReverse,
  19592. showNewOption,
  19593. emptyText,
  19594. toggleLastOptionHitState,
  19595. resetInputState,
  19596. handleComposition,
  19597. onOptionCreate,
  19598. onOptionDestroy,
  19599. handleMenuEnter,
  19600. handleFocus,
  19601. blur,
  19602. handleBlur,
  19603. handleClearClick,
  19604. handleClose,
  19605. toggleMenu,
  19606. selectOption,
  19607. getValueKey,
  19608. navigateOptions,
  19609. dropMenuVisible,
  19610. reference: reference2,
  19611. input,
  19612. tooltipRef,
  19613. tags,
  19614. selectWrapper,
  19615. scrollbar,
  19616. queryChange,
  19617. groupQueryChange
  19618. } = useSelect(props, states, ctx);
  19619. const { focus } = useFocus(reference2);
  19620. const {
  19621. inputWidth,
  19622. selected,
  19623. inputLength,
  19624. filteredOptionsCount,
  19625. visible,
  19626. softFocus,
  19627. selectedLabel,
  19628. hoverIndex,
  19629. query,
  19630. inputHovering,
  19631. currentPlaceholder,
  19632. menuVisibleOnFocus,
  19633. isOnComposition,
  19634. isSilentBlur,
  19635. options,
  19636. cachedOptions,
  19637. optionsCount,
  19638. prefixWidth,
  19639. tagInMultiLine
  19640. } = toRefs(states);
  19641. const wrapperKls = computed(() => {
  19642. const classList = [nsSelect.b()];
  19643. const _selectSize = unref(selectSize);
  19644. if (_selectSize) {
  19645. classList.push(nsSelect.m(_selectSize));
  19646. }
  19647. if (props.disabled) {
  19648. classList.push(nsSelect.m("disabled"));
  19649. }
  19650. return classList;
  19651. });
  19652. const selectTagsStyle = computed(() => ({
  19653. maxWidth: `${unref(inputWidth) - 32}px`,
  19654. width: "100%"
  19655. }));
  19656. provide(selectKey, reactive({
  19657. props,
  19658. options,
  19659. optionsArray,
  19660. cachedOptions,
  19661. optionsCount,
  19662. filteredOptionsCount,
  19663. hoverIndex,
  19664. handleOptionSelect,
  19665. onOptionCreate,
  19666. onOptionDestroy,
  19667. selectWrapper,
  19668. selected,
  19669. setSelected,
  19670. queryChange,
  19671. groupQueryChange
  19672. }));
  19673. onMounted(() => {
  19674. states.cachedPlaceHolder = currentPlaceholder.value = props.placeholder || t("el.select.placeholder");
  19675. if (props.multiple && Array.isArray(props.modelValue) && props.modelValue.length > 0) {
  19676. currentPlaceholder.value = "";
  19677. }
  19678. addResizeListener(selectWrapper.value, handleResize);
  19679. if (reference2.value && reference2.value.$el) {
  19680. const input2 = reference2.value.input;
  19681. states.initialInputHeight = input2.getBoundingClientRect().height || getComponentSize(selectSize.value);
  19682. }
  19683. if (props.remote && props.multiple) {
  19684. resetInputHeight();
  19685. }
  19686. nextTick(() => {
  19687. if (!reference2.value)
  19688. return;
  19689. if (reference2.value.$el) {
  19690. inputWidth.value = reference2.value.$el.getBoundingClientRect().width;
  19691. }
  19692. if (ctx.slots.prefix) {
  19693. const inputChildNodes = reference2.value.$el.childNodes;
  19694. const input2 = Array.from(inputChildNodes).find((item) => item.tagName === "INPUT");
  19695. const prefix = reference2.value.$el.querySelector(`.${nsInput.e("prefix")}`);
  19696. prefixWidth.value = Math.max(prefix.getBoundingClientRect().width + 5, 30);
  19697. if (states.prefixWidth) {
  19698. input2.style.paddingLeft = `${Math.max(states.prefixWidth, 30)}px`;
  19699. }
  19700. }
  19701. });
  19702. setSelected();
  19703. });
  19704. onBeforeUnmount(() => {
  19705. removeResizeListener(selectWrapper.value, handleResize);
  19706. });
  19707. if (props.multiple && !Array.isArray(props.modelValue)) {
  19708. ctx.emit(UPDATE_MODEL_EVENT, []);
  19709. }
  19710. if (!props.multiple && Array.isArray(props.modelValue)) {
  19711. ctx.emit(UPDATE_MODEL_EVENT, "");
  19712. }
  19713. const popperPaneRef = computed(() => {
  19714. var _a2, _b2;
  19715. return (_b2 = (_a2 = tooltipRef.value) == null ? void 0 : _a2.popperRef) == null ? void 0 : _b2.contentRef;
  19716. });
  19717. const { compatTeleported } = useDeprecateAppendToBody(COMPONENT_NAME$1, "popperAppendToBody");
  19718. return {
  19719. tagInMultiLine,
  19720. prefixWidth,
  19721. selectSize,
  19722. readonly: readonly2,
  19723. handleResize,
  19724. collapseTagSize,
  19725. debouncedOnInputChange,
  19726. debouncedQueryChange,
  19727. deletePrevTag,
  19728. deleteTag,
  19729. deleteSelected,
  19730. handleOptionSelect,
  19731. scrollToOption,
  19732. inputWidth,
  19733. selected,
  19734. inputLength,
  19735. filteredOptionsCount,
  19736. visible,
  19737. softFocus,
  19738. selectedLabel,
  19739. hoverIndex,
  19740. query,
  19741. inputHovering,
  19742. currentPlaceholder,
  19743. menuVisibleOnFocus,
  19744. isOnComposition,
  19745. isSilentBlur,
  19746. options,
  19747. resetInputHeight,
  19748. managePlaceholder,
  19749. showClose,
  19750. selectDisabled,
  19751. iconComponent,
  19752. iconReverse,
  19753. showNewOption,
  19754. emptyText,
  19755. toggleLastOptionHitState,
  19756. resetInputState,
  19757. handleComposition,
  19758. handleMenuEnter,
  19759. handleFocus,
  19760. blur,
  19761. handleBlur,
  19762. handleClearClick,
  19763. handleClose,
  19764. toggleMenu,
  19765. selectOption,
  19766. getValueKey,
  19767. navigateOptions,
  19768. dropMenuVisible,
  19769. focus,
  19770. reference: reference2,
  19771. input,
  19772. tooltipRef,
  19773. popperPaneRef,
  19774. tags,
  19775. selectWrapper,
  19776. scrollbar,
  19777. wrapperKls,
  19778. selectTagsStyle,
  19779. compatTeleported,
  19780. nsSelect
  19781. };
  19782. }
  19783. });
  19784. const _hoisted_1$g = { class: "select-trigger" };
  19785. const _hoisted_2$e = ["disabled", "autocomplete"];
  19786. const _hoisted_3$9 = { style: { "height": "100%", "display": "flex", "justify-content": "center", "align-items": "center" } };
  19787. function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
  19788. const _component_el_tag = resolveComponent("el-tag");
  19789. const _component_el_tooltip = resolveComponent("el-tooltip");
  19790. const _component_el_icon = resolveComponent("el-icon");
  19791. const _component_el_input = resolveComponent("el-input");
  19792. const _component_el_option = resolveComponent("el-option");
  19793. const _component_el_scrollbar = resolveComponent("el-scrollbar");
  19794. const _component_el_select_menu = resolveComponent("el-select-menu");
  19795. const _directive_click_outside = resolveDirective("click-outside");
  19796. return withDirectives((openBlock(), createElementBlock("div", {
  19797. ref: "selectWrapper",
  19798. class: normalizeClass(_ctx.wrapperKls),
  19799. onClick: _cache[24] || (_cache[24] = withModifiers((...args) => _ctx.toggleMenu && _ctx.toggleMenu(...args), ["stop"]))
  19800. }, [
  19801. createVNode(_component_el_tooltip, {
  19802. ref: "tooltipRef",
  19803. visible: _ctx.dropMenuVisible,
  19804. "onUpdate:visible": _cache[23] || (_cache[23] = ($event) => _ctx.dropMenuVisible = $event),
  19805. placement: "bottom-start",
  19806. teleported: _ctx.compatTeleported,
  19807. "popper-class": [_ctx.nsSelect.e("popper"), _ctx.popperClass],
  19808. "fallback-placements": ["bottom-start", "top-start", "right", "left"],
  19809. effect: _ctx.effect,
  19810. pure: "",
  19811. trigger: "click",
  19812. transition: `${_ctx.nsSelect.namespace.value}-zoom-in-top`,
  19813. "stop-popper-mouse-event": false,
  19814. "gpu-acceleration": false,
  19815. persistent: _ctx.persistent,
  19816. onShow: _ctx.handleMenuEnter
  19817. }, {
  19818. default: withCtx(() => [
  19819. createElementVNode("div", _hoisted_1$g, [
  19820. _ctx.multiple ? (openBlock(), createElementBlock("div", {
  19821. key: 0,
  19822. ref: "tags",
  19823. class: normalizeClass(_ctx.nsSelect.e("tags")),
  19824. style: normalizeStyle(_ctx.selectTagsStyle)
  19825. }, [
  19826. _ctx.collapseTags && _ctx.selected.length ? (openBlock(), createElementBlock("span", {
  19827. key: 0,
  19828. class: normalizeClass([
  19829. _ctx.nsSelect.b("tags-wrapper"),
  19830. { "has-prefix": _ctx.prefixWidth && _ctx.selected.length }
  19831. ])
  19832. }, [
  19833. createVNode(_component_el_tag, {
  19834. closable: !_ctx.selectDisabled && !_ctx.selected[0].isDisabled,
  19835. size: _ctx.collapseTagSize,
  19836. hit: _ctx.selected[0].hitState,
  19837. type: _ctx.tagType,
  19838. "disable-transitions": "",
  19839. onClose: _cache[0] || (_cache[0] = ($event) => _ctx.deleteTag($event, _ctx.selected[0]))
  19840. }, {
  19841. default: withCtx(() => [
  19842. createElementVNode("span", {
  19843. class: normalizeClass(_ctx.nsSelect.e("tags-text")),
  19844. style: normalizeStyle({ maxWidth: _ctx.inputWidth - 123 + "px" })
  19845. }, toDisplayString(_ctx.selected[0].currentLabel), 7)
  19846. ]),
  19847. _: 1
  19848. }, 8, ["closable", "size", "hit", "type"]),
  19849. _ctx.selected.length > 1 ? (openBlock(), createBlock(_component_el_tag, {
  19850. key: 0,
  19851. closable: false,
  19852. size: _ctx.collapseTagSize,
  19853. type: _ctx.tagType,
  19854. "disable-transitions": ""
  19855. }, {
  19856. default: withCtx(() => [
  19857. _ctx.collapseTagsTooltip ? (openBlock(), createBlock(_component_el_tooltip, {
  19858. key: 0,
  19859. disabled: _ctx.dropMenuVisible,
  19860. "fallback-placements": ["bottom", "top", "right", "left"],
  19861. effect: _ctx.effect,
  19862. placement: "bottom",
  19863. teleported: false
  19864. }, {
  19865. default: withCtx(() => [
  19866. createElementVNode("span", {
  19867. class: normalizeClass(_ctx.nsSelect.e("tags-text"))
  19868. }, "+ " + toDisplayString(_ctx.selected.length - 1), 3)
  19869. ]),
  19870. content: withCtx(() => [
  19871. createElementVNode("div", {
  19872. class: normalizeClass(_ctx.nsSelect.e("collapse-tags"))
  19873. }, [
  19874. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.selected, (item, idx) => {
  19875. return openBlock(), createElementBlock("div", {
  19876. key: idx,
  19877. class: normalizeClass(_ctx.nsSelect.e("collapse-tag"))
  19878. }, [
  19879. (openBlock(), createBlock(_component_el_tag, {
  19880. key: _ctx.getValueKey(item),
  19881. class: "in-tooltip",
  19882. closable: !_ctx.selectDisabled && !item.isDisabled,
  19883. size: _ctx.collapseTagSize,
  19884. hit: item.hitState,
  19885. type: _ctx.tagType,
  19886. "disable-transitions": "",
  19887. style: { margin: "2px" },
  19888. onClose: ($event) => _ctx.deleteTag($event, item)
  19889. }, {
  19890. default: withCtx(() => [
  19891. createElementVNode("span", {
  19892. class: normalizeClass(_ctx.nsSelect.e("tags-text")),
  19893. style: normalizeStyle({
  19894. maxWidth: _ctx.inputWidth - 75 + "px"
  19895. })
  19896. }, toDisplayString(item.currentLabel), 7)
  19897. ]),
  19898. _: 2
  19899. }, 1032, ["closable", "size", "hit", "type", "onClose"]))
  19900. ], 2);
  19901. }), 128))
  19902. ], 2)
  19903. ]),
  19904. _: 1
  19905. }, 8, ["disabled", "effect"])) : (openBlock(), createElementBlock("span", {
  19906. key: 1,
  19907. class: normalizeClass(_ctx.nsSelect.e("tags-text"))
  19908. }, "+ " + toDisplayString(_ctx.selected.length - 1), 3))
  19909. ]),
  19910. _: 1
  19911. }, 8, ["size", "type"])) : createCommentVNode("v-if", true)
  19912. ], 2)) : createCommentVNode("v-if", true),
  19913. createCommentVNode(" <div> "),
  19914. !_ctx.collapseTags ? (openBlock(), createBlock(Transition, {
  19915. key: 1,
  19916. onAfterLeave: _ctx.resetInputHeight
  19917. }, {
  19918. default: withCtx(() => [
  19919. createElementVNode("span", {
  19920. class: normalizeClass([
  19921. _ctx.nsSelect.b("tags-wrapper"),
  19922. { "has-prefix": _ctx.prefixWidth && _ctx.selected.length }
  19923. ])
  19924. }, [
  19925. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.selected, (item) => {
  19926. return openBlock(), createBlock(_component_el_tag, {
  19927. key: _ctx.getValueKey(item),
  19928. closable: !_ctx.selectDisabled && !item.isDisabled,
  19929. size: _ctx.collapseTagSize,
  19930. hit: item.hitState,
  19931. type: _ctx.tagType,
  19932. "disable-transitions": "",
  19933. onClose: ($event) => _ctx.deleteTag($event, item)
  19934. }, {
  19935. default: withCtx(() => [
  19936. createElementVNode("span", {
  19937. class: normalizeClass(_ctx.nsSelect.e("tags-text")),
  19938. style: normalizeStyle({ maxWidth: _ctx.inputWidth - 75 + "px" })
  19939. }, toDisplayString(item.currentLabel), 7)
  19940. ]),
  19941. _: 2
  19942. }, 1032, ["closable", "size", "hit", "type", "onClose"]);
  19943. }), 128))
  19944. ], 2)
  19945. ]),
  19946. _: 1
  19947. }, 8, ["onAfterLeave"])) : createCommentVNode("v-if", true),
  19948. createCommentVNode(" </div> "),
  19949. _ctx.filterable ? withDirectives((openBlock(), createElementBlock("input", {
  19950. key: 2,
  19951. ref: "input",
  19952. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.query = $event),
  19953. type: "text",
  19954. class: normalizeClass([_ctx.nsSelect.e("input"), _ctx.nsSelect.is(_ctx.selectSize)]),
  19955. disabled: _ctx.selectDisabled,
  19956. autocomplete: _ctx.autocomplete,
  19957. style: normalizeStyle({
  19958. marginLeft: _ctx.prefixWidth && !_ctx.selected.length || _ctx.tagInMultiLine ? `${_ctx.prefixWidth}px` : "",
  19959. flexGrow: 1,
  19960. width: `${_ctx.inputLength / (_ctx.inputWidth - 32)}%`,
  19961. maxWidth: `${_ctx.inputWidth - 42}px`
  19962. }),
  19963. onFocus: _cache[2] || (_cache[2] = (...args) => _ctx.handleFocus && _ctx.handleFocus(...args)),
  19964. onBlur: _cache[3] || (_cache[3] = (...args) => _ctx.handleBlur && _ctx.handleBlur(...args)),
  19965. onKeyup: _cache[4] || (_cache[4] = (...args) => _ctx.managePlaceholder && _ctx.managePlaceholder(...args)),
  19966. onKeydown: [
  19967. _cache[5] || (_cache[5] = (...args) => _ctx.resetInputState && _ctx.resetInputState(...args)),
  19968. _cache[6] || (_cache[6] = withKeys(withModifiers(($event) => _ctx.navigateOptions("next"), ["prevent"]), ["down"])),
  19969. _cache[7] || (_cache[7] = withKeys(withModifiers(($event) => _ctx.navigateOptions("prev"), ["prevent"]), ["up"])),
  19970. _cache[8] || (_cache[8] = withKeys(withModifiers(($event) => _ctx.visible = false, ["stop", "prevent"]), ["esc"])),
  19971. _cache[9] || (_cache[9] = withKeys(withModifiers((...args) => _ctx.selectOption && _ctx.selectOption(...args), ["stop", "prevent"]), ["enter"])),
  19972. _cache[10] || (_cache[10] = withKeys((...args) => _ctx.deletePrevTag && _ctx.deletePrevTag(...args), ["delete"])),
  19973. _cache[11] || (_cache[11] = withKeys(($event) => _ctx.visible = false, ["tab"]))
  19974. ],
  19975. onCompositionstart: _cache[12] || (_cache[12] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args)),
  19976. onCompositionupdate: _cache[13] || (_cache[13] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args)),
  19977. onCompositionend: _cache[14] || (_cache[14] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args)),
  19978. onInput: _cache[15] || (_cache[15] = (...args) => _ctx.debouncedQueryChange && _ctx.debouncedQueryChange(...args))
  19979. }, null, 46, _hoisted_2$e)), [
  19980. [vModelText, _ctx.query]
  19981. ]) : createCommentVNode("v-if", true)
  19982. ], 6)) : createCommentVNode("v-if", true),
  19983. createVNode(_component_el_input, {
  19984. id: _ctx.id,
  19985. ref: "reference",
  19986. modelValue: _ctx.selectedLabel,
  19987. "onUpdate:modelValue": _cache[16] || (_cache[16] = ($event) => _ctx.selectedLabel = $event),
  19988. type: "text",
  19989. placeholder: _ctx.currentPlaceholder,
  19990. name: _ctx.name,
  19991. autocomplete: _ctx.autocomplete,
  19992. size: _ctx.selectSize,
  19993. disabled: _ctx.selectDisabled,
  19994. readonly: _ctx.readonly,
  19995. "validate-event": false,
  19996. class: normalizeClass([_ctx.nsSelect.is("focus", _ctx.visible)]),
  19997. tabindex: _ctx.multiple && _ctx.filterable ? -1 : void 0,
  19998. onFocus: _ctx.handleFocus,
  19999. onBlur: _ctx.handleBlur,
  20000. onInput: _ctx.debouncedOnInputChange,
  20001. onPaste: _ctx.debouncedOnInputChange,
  20002. onCompositionstart: _ctx.handleComposition,
  20003. onCompositionupdate: _ctx.handleComposition,
  20004. onCompositionend: _ctx.handleComposition,
  20005. onKeydown: [
  20006. _cache[17] || (_cache[17] = withKeys(withModifiers(($event) => _ctx.navigateOptions("next"), ["stop", "prevent"]), ["down"])),
  20007. _cache[18] || (_cache[18] = withKeys(withModifiers(($event) => _ctx.navigateOptions("prev"), ["stop", "prevent"]), ["up"])),
  20008. withKeys(withModifiers(_ctx.selectOption, ["stop", "prevent"]), ["enter"]),
  20009. _cache[19] || (_cache[19] = withKeys(withModifiers(($event) => _ctx.visible = false, ["stop", "prevent"]), ["esc"])),
  20010. _cache[20] || (_cache[20] = withKeys(($event) => _ctx.visible = false, ["tab"]))
  20011. ],
  20012. onMouseenter: _cache[21] || (_cache[21] = ($event) => _ctx.inputHovering = true),
  20013. onMouseleave: _cache[22] || (_cache[22] = ($event) => _ctx.inputHovering = false)
  20014. }, createSlots({
  20015. suffix: withCtx(() => [
  20016. _ctx.iconComponent && !_ctx.showClose ? (openBlock(), createBlock(_component_el_icon, {
  20017. key: 0,
  20018. class: normalizeClass([_ctx.nsSelect.e("caret"), _ctx.nsSelect.e("icon"), _ctx.iconReverse])
  20019. }, {
  20020. default: withCtx(() => [
  20021. (openBlock(), createBlock(resolveDynamicComponent(_ctx.iconComponent)))
  20022. ]),
  20023. _: 1
  20024. }, 8, ["class"])) : createCommentVNode("v-if", true),
  20025. _ctx.showClose && _ctx.clearIcon ? (openBlock(), createBlock(_component_el_icon, {
  20026. key: 1,
  20027. class: normalizeClass([_ctx.nsSelect.e("caret"), _ctx.nsSelect.e("icon")]),
  20028. onClick: _ctx.handleClearClick
  20029. }, {
  20030. default: withCtx(() => [
  20031. (openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon)))
  20032. ]),
  20033. _: 1
  20034. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true)
  20035. ]),
  20036. _: 2
  20037. }, [
  20038. _ctx.$slots.prefix ? {
  20039. name: "prefix",
  20040. fn: withCtx(() => [
  20041. createElementVNode("div", _hoisted_3$9, [
  20042. renderSlot(_ctx.$slots, "prefix")
  20043. ])
  20044. ])
  20045. } : void 0
  20046. ]), 1032, ["id", "modelValue", "placeholder", "name", "autocomplete", "size", "disabled", "readonly", "class", "tabindex", "onFocus", "onBlur", "onInput", "onPaste", "onCompositionstart", "onCompositionupdate", "onCompositionend", "onKeydown"])
  20047. ])
  20048. ]),
  20049. content: withCtx(() => [
  20050. createVNode(_component_el_select_menu, null, {
  20051. default: withCtx(() => [
  20052. withDirectives(createVNode(_component_el_scrollbar, {
  20053. ref: "scrollbar",
  20054. tag: "ul",
  20055. "wrap-class": _ctx.nsSelect.be("dropdown", "wrap"),
  20056. "view-class": _ctx.nsSelect.be("dropdown", "list"),
  20057. class: normalizeClass([
  20058. _ctx.nsSelect.is("empty", !_ctx.allowCreate && Boolean(_ctx.query) && _ctx.filteredOptionsCount === 0)
  20059. ])
  20060. }, {
  20061. default: withCtx(() => [
  20062. _ctx.showNewOption ? (openBlock(), createBlock(_component_el_option, {
  20063. key: 0,
  20064. value: _ctx.query,
  20065. created: true
  20066. }, null, 8, ["value"])) : createCommentVNode("v-if", true),
  20067. renderSlot(_ctx.$slots, "default")
  20068. ]),
  20069. _: 3
  20070. }, 8, ["wrap-class", "view-class", "class"]), [
  20071. [vShow, _ctx.options.size > 0 && !_ctx.loading]
  20072. ]),
  20073. _ctx.emptyText && (!_ctx.allowCreate || _ctx.loading || _ctx.allowCreate && _ctx.options.size === 0) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  20074. _ctx.$slots.empty ? renderSlot(_ctx.$slots, "empty", { key: 0 }) : (openBlock(), createElementBlock("p", {
  20075. key: 1,
  20076. class: normalizeClass(_ctx.nsSelect.be("dropdown", "empty"))
  20077. }, toDisplayString(_ctx.emptyText), 3))
  20078. ], 2112)) : createCommentVNode("v-if", true)
  20079. ]),
  20080. _: 3
  20081. })
  20082. ]),
  20083. _: 3
  20084. }, 8, ["visible", "teleported", "popper-class", "effect", "transition", "persistent", "onShow"])
  20085. ], 2)), [
  20086. [_directive_click_outside, _ctx.handleClose, _ctx.popperPaneRef]
  20087. ]);
  20088. }
  20089. var Select = /* @__PURE__ */ _export_sfc$1(_sfc_main$n, [["render", _sfc_render$a], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/select/src/select.vue"]]);
  20090. const _sfc_main$m = defineComponent({
  20091. name: "ElOptionGroup",
  20092. componentName: "ElOptionGroup",
  20093. props: {
  20094. label: String,
  20095. disabled: {
  20096. type: Boolean,
  20097. default: false
  20098. }
  20099. },
  20100. setup(props) {
  20101. const ns = useNamespace("select");
  20102. const visible = ref(true);
  20103. const instance = getCurrentInstance();
  20104. const children = ref([]);
  20105. provide(selectGroupKey, reactive(__spreadValues({}, toRefs(props))));
  20106. const select = inject(selectKey);
  20107. onMounted(() => {
  20108. children.value = flattedChildren(instance.subTree);
  20109. });
  20110. const flattedChildren = (node) => {
  20111. const children2 = [];
  20112. if (Array.isArray(node.children)) {
  20113. node.children.forEach((child) => {
  20114. var _a2;
  20115. if (child.type && child.type.name === "ElOption" && child.component && child.component.proxy) {
  20116. children2.push(child.component.proxy);
  20117. } else if ((_a2 = child.children) == null ? void 0 : _a2.length) {
  20118. children2.push(...flattedChildren(child));
  20119. }
  20120. });
  20121. }
  20122. return children2;
  20123. };
  20124. const { groupQueryChange } = toRaw(select);
  20125. watch(groupQueryChange, () => {
  20126. visible.value = children.value.some((option) => option.visible === true);
  20127. });
  20128. return {
  20129. visible,
  20130. ns
  20131. };
  20132. }
  20133. });
  20134. function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
  20135. return withDirectives((openBlock(), createElementBlock("ul", {
  20136. class: normalizeClass(_ctx.ns.be("group", "wrap"))
  20137. }, [
  20138. createElementVNode("li", {
  20139. class: normalizeClass(_ctx.ns.be("group", "title"))
  20140. }, toDisplayString(_ctx.label), 3),
  20141. createElementVNode("li", null, [
  20142. createElementVNode("ul", {
  20143. class: normalizeClass(_ctx.ns.b("group"))
  20144. }, [
  20145. renderSlot(_ctx.$slots, "default")
  20146. ], 2)
  20147. ])
  20148. ], 2)), [
  20149. [vShow, _ctx.visible]
  20150. ]);
  20151. }
  20152. var OptionGroup = /* @__PURE__ */ _export_sfc$1(_sfc_main$m, [["render", _sfc_render$9], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/select/src/option-group.vue"]]);
  20153. const ElSelect = withInstall(Select, {
  20154. Option,
  20155. OptionGroup
  20156. });
  20157. const ElOption = withNoopInstall(Option);
  20158. withNoopInstall(OptionGroup);
  20159. const progressProps = buildProps({
  20160. type: {
  20161. type: String,
  20162. default: "line",
  20163. values: ["line", "circle", "dashboard"]
  20164. },
  20165. percentage: {
  20166. type: Number,
  20167. default: 0,
  20168. validator: (val) => val >= 0 && val <= 100
  20169. },
  20170. status: {
  20171. type: String,
  20172. default: "",
  20173. values: ["", "success", "exception", "warning"]
  20174. },
  20175. indeterminate: {
  20176. type: Boolean,
  20177. default: false
  20178. },
  20179. duration: {
  20180. type: Number,
  20181. default: 3
  20182. },
  20183. strokeWidth: {
  20184. type: Number,
  20185. default: 6
  20186. },
  20187. strokeLinecap: {
  20188. type: definePropType(String),
  20189. default: "round"
  20190. },
  20191. textInside: {
  20192. type: Boolean,
  20193. default: false
  20194. },
  20195. width: {
  20196. type: Number,
  20197. default: 126
  20198. },
  20199. showText: {
  20200. type: Boolean,
  20201. default: true
  20202. },
  20203. color: {
  20204. type: definePropType([
  20205. String,
  20206. Array,
  20207. Function
  20208. ]),
  20209. default: ""
  20210. },
  20211. format: {
  20212. type: definePropType(Function),
  20213. default: (percentage) => `${percentage}%`
  20214. }
  20215. });
  20216. const _sfc_main$l = defineComponent({
  20217. name: "ElProgress",
  20218. components: {
  20219. ElIcon,
  20220. CircleCheck: circleCheck,
  20221. CircleClose: circleClose,
  20222. Check: check,
  20223. Close: close,
  20224. WarningFilled: warningFilled
  20225. },
  20226. props: progressProps,
  20227. setup(props) {
  20228. const ns = useNamespace("progress");
  20229. const barStyle = computed(() => ({
  20230. width: `${props.percentage}%`,
  20231. animationDuration: `${props.duration}s`,
  20232. backgroundColor: getCurrentColor(props.percentage)
  20233. }));
  20234. const relativeStrokeWidth = computed(() => (props.strokeWidth / props.width * 100).toFixed(1));
  20235. const radius = computed(() => {
  20236. if (props.type === "circle" || props.type === "dashboard") {
  20237. return Number.parseInt(`${50 - Number.parseFloat(relativeStrokeWidth.value) / 2}`, 10);
  20238. } else {
  20239. return 0;
  20240. }
  20241. });
  20242. const trackPath = computed(() => {
  20243. const r = radius.value;
  20244. const isDashboard = props.type === "dashboard";
  20245. return `
  20246. M 50 50
  20247. m 0 ${isDashboard ? "" : "-"}${r}
  20248. a ${r} ${r} 0 1 1 0 ${isDashboard ? "-" : ""}${r * 2}
  20249. a ${r} ${r} 0 1 1 0 ${isDashboard ? "" : "-"}${r * 2}
  20250. `;
  20251. });
  20252. const perimeter = computed(() => 2 * Math.PI * radius.value);
  20253. const rate = computed(() => props.type === "dashboard" ? 0.75 : 1);
  20254. const strokeDashoffset = computed(() => {
  20255. const offset2 = -1 * perimeter.value * (1 - rate.value) / 2;
  20256. return `${offset2}px`;
  20257. });
  20258. const trailPathStyle = computed(() => ({
  20259. strokeDasharray: `${perimeter.value * rate.value}px, ${perimeter.value}px`,
  20260. strokeDashoffset: strokeDashoffset.value
  20261. }));
  20262. const circlePathStyle = computed(() => ({
  20263. strokeDasharray: `${perimeter.value * rate.value * (props.percentage / 100)}px, ${perimeter.value}px`,
  20264. strokeDashoffset: strokeDashoffset.value,
  20265. transition: "stroke-dasharray 0.6s ease 0s, stroke 0.6s ease"
  20266. }));
  20267. const stroke = computed(() => {
  20268. let ret;
  20269. if (props.color) {
  20270. ret = getCurrentColor(props.percentage);
  20271. } else {
  20272. switch (props.status) {
  20273. case "success":
  20274. ret = "#13ce66";
  20275. break;
  20276. case "exception":
  20277. ret = "#ff4949";
  20278. break;
  20279. case "warning":
  20280. ret = "#e6a23c";
  20281. break;
  20282. default:
  20283. ret = "#20a0ff";
  20284. }
  20285. }
  20286. return ret;
  20287. });
  20288. const statusIcon = computed(() => {
  20289. if (props.status === "warning") {
  20290. return warningFilled;
  20291. }
  20292. if (props.type === "line") {
  20293. return props.status === "success" ? circleCheck : circleClose;
  20294. } else {
  20295. return props.status === "success" ? check : close;
  20296. }
  20297. });
  20298. const progressTextSize = computed(() => {
  20299. return props.type === "line" ? 12 + props.strokeWidth * 0.4 : props.width * 0.111111 + 2;
  20300. });
  20301. const content2 = computed(() => props.format(props.percentage));
  20302. const getCurrentColor = (percentage) => {
  20303. var _a2;
  20304. const { color } = props;
  20305. if (typeof color === "function") {
  20306. return color(percentage);
  20307. } else if (typeof color === "string") {
  20308. return color;
  20309. } else {
  20310. const span = 100 / color.length;
  20311. const seriesColors = color.map((seriesColor, index) => {
  20312. if (typeof seriesColor === "string") {
  20313. return {
  20314. color: seriesColor,
  20315. percentage: (index + 1) * span
  20316. };
  20317. }
  20318. return seriesColor;
  20319. });
  20320. const colors = seriesColors.sort((a2, b2) => a2.percentage - b2.percentage);
  20321. for (const color2 of colors) {
  20322. if (color2.percentage > percentage)
  20323. return color2.color;
  20324. }
  20325. return (_a2 = colors[colors.length - 1]) == null ? void 0 : _a2.color;
  20326. }
  20327. };
  20328. const slotData = computed(() => {
  20329. return {
  20330. percentage: props.percentage
  20331. };
  20332. });
  20333. return {
  20334. ns,
  20335. barStyle,
  20336. relativeStrokeWidth,
  20337. radius,
  20338. trackPath,
  20339. perimeter,
  20340. rate,
  20341. strokeDashoffset,
  20342. trailPathStyle,
  20343. circlePathStyle,
  20344. stroke,
  20345. statusIcon,
  20346. progressTextSize,
  20347. content: content2,
  20348. slotData
  20349. };
  20350. }
  20351. });
  20352. const _hoisted_1$f = ["aria-valuenow"];
  20353. const _hoisted_2$d = { viewBox: "0 0 100 100" };
  20354. const _hoisted_3$8 = ["d", "stroke-width"];
  20355. const _hoisted_4$7 = ["d", "stroke", "stroke-linecap", "stroke-width"];
  20356. const _hoisted_5$7 = { key: 0 };
  20357. function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
  20358. const _component_el_icon = resolveComponent("el-icon");
  20359. return openBlock(), createElementBlock("div", {
  20360. class: normalizeClass([
  20361. _ctx.ns.b(),
  20362. _ctx.ns.m(_ctx.type),
  20363. _ctx.ns.is(_ctx.status),
  20364. {
  20365. [_ctx.ns.m("without-text")]: !_ctx.showText,
  20366. [_ctx.ns.m("text-inside")]: _ctx.textInside
  20367. }
  20368. ]),
  20369. role: "progressbar",
  20370. "aria-valuenow": _ctx.percentage,
  20371. "aria-valuemin": "0",
  20372. "aria-valuemax": "100"
  20373. }, [
  20374. _ctx.type === "line" ? (openBlock(), createElementBlock("div", {
  20375. key: 0,
  20376. class: normalizeClass(_ctx.ns.b("bar"))
  20377. }, [
  20378. createElementVNode("div", {
  20379. class: normalizeClass(_ctx.ns.be("bar", "outer")),
  20380. style: normalizeStyle({ height: `${_ctx.strokeWidth}px` })
  20381. }, [
  20382. createElementVNode("div", {
  20383. class: normalizeClass([
  20384. _ctx.ns.be("bar", "inner"),
  20385. { [_ctx.ns.bem("bar", "inner", "indeterminate")]: _ctx.indeterminate }
  20386. ]),
  20387. style: normalizeStyle(_ctx.barStyle)
  20388. }, [
  20389. (_ctx.showText || _ctx.$slots.default) && _ctx.textInside ? (openBlock(), createElementBlock("div", {
  20390. key: 0,
  20391. class: normalizeClass(_ctx.ns.be("bar", "innerText"))
  20392. }, [
  20393. renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(_ctx.slotData)), () => [
  20394. createElementVNode("span", null, toDisplayString(_ctx.content), 1)
  20395. ])
  20396. ], 2)) : createCommentVNode("v-if", true)
  20397. ], 6)
  20398. ], 6)
  20399. ], 2)) : (openBlock(), createElementBlock("div", {
  20400. key: 1,
  20401. class: normalizeClass(_ctx.ns.b("circle")),
  20402. style: normalizeStyle({ height: `${_ctx.width}px`, width: `${_ctx.width}px` })
  20403. }, [
  20404. (openBlock(), createElementBlock("svg", _hoisted_2$d, [
  20405. createElementVNode("path", {
  20406. class: normalizeClass(_ctx.ns.be("circle", "track")),
  20407. d: _ctx.trackPath,
  20408. stroke: "var(--el-fill-color-light, #e5e9f2)",
  20409. "stroke-width": _ctx.relativeStrokeWidth,
  20410. fill: "none",
  20411. style: normalizeStyle(_ctx.trailPathStyle)
  20412. }, null, 14, _hoisted_3$8),
  20413. createElementVNode("path", {
  20414. class: normalizeClass(_ctx.ns.be("circle", "path")),
  20415. d: _ctx.trackPath,
  20416. stroke: _ctx.stroke,
  20417. fill: "none",
  20418. "stroke-linecap": _ctx.strokeLinecap,
  20419. "stroke-width": _ctx.percentage ? _ctx.relativeStrokeWidth : 0,
  20420. style: normalizeStyle(_ctx.circlePathStyle)
  20421. }, null, 14, _hoisted_4$7)
  20422. ]))
  20423. ], 6)),
  20424. (_ctx.showText || _ctx.$slots.default) && !_ctx.textInside ? (openBlock(), createElementBlock("div", {
  20425. key: 2,
  20426. class: normalizeClass(_ctx.ns.e("text")),
  20427. style: normalizeStyle({ fontSize: `${_ctx.progressTextSize}px` })
  20428. }, [
  20429. renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(_ctx.slotData)), () => [
  20430. !_ctx.status ? (openBlock(), createElementBlock("span", _hoisted_5$7, toDisplayString(_ctx.content), 1)) : (openBlock(), createBlock(_component_el_icon, { key: 1 }, {
  20431. default: withCtx(() => [
  20432. (openBlock(), createBlock(resolveDynamicComponent(_ctx.statusIcon)))
  20433. ]),
  20434. _: 1
  20435. }))
  20436. ])
  20437. ], 6)) : createCommentVNode("v-if", true)
  20438. ], 10, _hoisted_1$f);
  20439. }
  20440. var Progress = /* @__PURE__ */ _export_sfc$1(_sfc_main$l, [["render", _sfc_render$8], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/progress/src/progress.vue"]]);
  20441. const ElProgress = withInstall(Progress);
  20442. const rateProps = buildProps({
  20443. modelValue: {
  20444. type: Number,
  20445. default: 0
  20446. },
  20447. lowThreshold: {
  20448. type: Number,
  20449. default: 2
  20450. },
  20451. highThreshold: {
  20452. type: Number,
  20453. default: 4
  20454. },
  20455. max: {
  20456. type: Number,
  20457. default: 5
  20458. },
  20459. colors: {
  20460. type: definePropType([Array, Object]),
  20461. default: () => mutable(["", "", ""])
  20462. },
  20463. voidColor: {
  20464. type: String,
  20465. default: ""
  20466. },
  20467. disabledVoidColor: {
  20468. type: String,
  20469. default: ""
  20470. },
  20471. icons: {
  20472. type: definePropType([Array, Object]),
  20473. default: () => [starFilled, starFilled, starFilled]
  20474. },
  20475. voidIcon: {
  20476. type: iconPropType,
  20477. default: () => star
  20478. },
  20479. disabledVoidIcon: {
  20480. type: iconPropType,
  20481. default: () => starFilled
  20482. },
  20483. disabled: {
  20484. type: Boolean,
  20485. default: false
  20486. },
  20487. allowHalf: {
  20488. type: Boolean,
  20489. default: false
  20490. },
  20491. showText: {
  20492. type: Boolean,
  20493. default: false
  20494. },
  20495. showScore: {
  20496. type: Boolean,
  20497. default: false
  20498. },
  20499. textColor: {
  20500. type: String,
  20501. default: ""
  20502. },
  20503. texts: {
  20504. type: definePropType(Array),
  20505. default: () => mutable([
  20506. "Extremely bad",
  20507. "Disappointed",
  20508. "Fair",
  20509. "Satisfied",
  20510. "Surprise"
  20511. ])
  20512. },
  20513. scoreTemplate: {
  20514. type: String,
  20515. default: "{value}"
  20516. },
  20517. size: {
  20518. type: String,
  20519. validator: isValidComponentSize
  20520. }
  20521. });
  20522. const rateEmits = {
  20523. change: (value) => typeof value === "number",
  20524. [UPDATE_MODEL_EVENT]: (value) => typeof value === "number"
  20525. };
  20526. const _hoisted_1$e = ["aria-valuenow", "aria-valuetext", "aria-valuemax"];
  20527. const _hoisted_2$c = ["onMousemove", "onClick"];
  20528. const __default__$5 = {
  20529. name: "ElRate"
  20530. };
  20531. const _sfc_main$k = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$5), {
  20532. props: rateProps,
  20533. emits: rateEmits,
  20534. setup(__props, { expose, emit }) {
  20535. const props = __props;
  20536. function getValueFromMap(value, map) {
  20537. const isExcludedObject = (val) => isObject$1(val);
  20538. const matchedKeys = Object.keys(map).map((key) => +key).filter((key) => {
  20539. const val = map[key];
  20540. const excluded = isExcludedObject(val) ? val.excluded : false;
  20541. return excluded ? value < key : value <= key;
  20542. }).sort((a2, b2) => a2 - b2);
  20543. const matchedValue = map[matchedKeys[0]];
  20544. return isExcludedObject(matchedValue) && matchedValue.value || matchedValue;
  20545. }
  20546. const formContext = inject(formContextKey, void 0);
  20547. const rateSize = useSize();
  20548. const ns = useNamespace("rate");
  20549. const currentValue = ref(props.modelValue);
  20550. const hoverIndex = ref(-1);
  20551. const pointerAtLeftHalf = ref(true);
  20552. const rateClasses = computed(() => [ns.b(), ns.m(rateSize.value)]);
  20553. const rateDisabled = computed(() => props.disabled || (formContext == null ? void 0 : formContext.disabled));
  20554. const rateStyles = computed(() => {
  20555. return {
  20556. "--el-rate-void-color": props.voidColor,
  20557. "--el-rate-disabled-void-color": props.disabledVoidColor,
  20558. "--el-rate-fill-color": activeColor.value
  20559. };
  20560. });
  20561. const text = computed(() => {
  20562. let result = "";
  20563. if (props.showScore) {
  20564. result = props.scoreTemplate.replace(/\{\s*value\s*\}/, rateDisabled.value ? `${props.modelValue}` : `${currentValue.value}`);
  20565. } else if (props.showText) {
  20566. result = props.texts[Math.ceil(currentValue.value) - 1];
  20567. }
  20568. return result;
  20569. });
  20570. const valueDecimal = computed(() => props.modelValue * 100 - Math.floor(props.modelValue) * 100);
  20571. const colorMap = computed(() => isArray(props.colors) ? {
  20572. [props.lowThreshold]: props.colors[0],
  20573. [props.highThreshold]: { value: props.colors[1], excluded: true },
  20574. [props.max]: props.colors[2]
  20575. } : props.colors);
  20576. const activeColor = computed(() => {
  20577. const color = getValueFromMap(currentValue.value, colorMap.value);
  20578. return isObject$1(color) ? "" : color;
  20579. });
  20580. const decimalStyle = computed(() => {
  20581. let width = "";
  20582. if (rateDisabled.value) {
  20583. width = `${valueDecimal.value}%`;
  20584. } else if (props.allowHalf) {
  20585. width = "50%";
  20586. }
  20587. return {
  20588. color: activeColor.value,
  20589. width
  20590. };
  20591. });
  20592. const componentMap = computed(() => isArray(props.icons) ? {
  20593. [props.lowThreshold]: props.icons[0],
  20594. [props.highThreshold]: {
  20595. value: props.icons[1],
  20596. excluded: true
  20597. },
  20598. [props.max]: props.icons[2]
  20599. } : props.icons);
  20600. const decimalIconComponent = computed(() => getValueFromMap(props.modelValue, componentMap.value));
  20601. const voidComponent = computed(() => rateDisabled.value ? props.disabledVoidIcon : props.voidIcon);
  20602. const activeComponent = computed(() => getValueFromMap(currentValue.value, componentMap.value));
  20603. const iconComponents = computed(() => {
  20604. const result = Array.from({ length: props.max });
  20605. const threshold = currentValue.value;
  20606. result.fill(activeComponent.value, 0, threshold);
  20607. result.fill(voidComponent.value, threshold, props.max);
  20608. return result;
  20609. });
  20610. function showDecimalIcon(item) {
  20611. const showWhenDisabled = rateDisabled.value && valueDecimal.value > 0 && item - 1 < props.modelValue && item > props.modelValue;
  20612. const showWhenAllowHalf = props.allowHalf && pointerAtLeftHalf.value && item - 0.5 <= currentValue.value && item > currentValue.value;
  20613. return showWhenDisabled || showWhenAllowHalf;
  20614. }
  20615. function selectValue(value) {
  20616. if (rateDisabled.value) {
  20617. return;
  20618. }
  20619. if (props.allowHalf && pointerAtLeftHalf.value) {
  20620. emit(UPDATE_MODEL_EVENT, currentValue.value);
  20621. if (props.modelValue !== currentValue.value) {
  20622. emit("change", currentValue.value);
  20623. }
  20624. } else {
  20625. emit(UPDATE_MODEL_EVENT, value);
  20626. if (props.modelValue !== value) {
  20627. emit("change", value);
  20628. }
  20629. }
  20630. }
  20631. function handleKey(e) {
  20632. if (rateDisabled.value) {
  20633. return;
  20634. }
  20635. let _currentValue = currentValue.value;
  20636. const code = e.code;
  20637. if (code === EVENT_CODE.up || code === EVENT_CODE.right) {
  20638. if (props.allowHalf) {
  20639. _currentValue += 0.5;
  20640. } else {
  20641. _currentValue += 1;
  20642. }
  20643. e.stopPropagation();
  20644. e.preventDefault();
  20645. } else if (code === EVENT_CODE.left || code === EVENT_CODE.down) {
  20646. if (props.allowHalf) {
  20647. _currentValue -= 0.5;
  20648. } else {
  20649. _currentValue -= 1;
  20650. }
  20651. e.stopPropagation();
  20652. e.preventDefault();
  20653. }
  20654. _currentValue = _currentValue < 0 ? 0 : _currentValue;
  20655. _currentValue = _currentValue > props.max ? props.max : _currentValue;
  20656. emit(UPDATE_MODEL_EVENT, _currentValue);
  20657. emit("change", _currentValue);
  20658. return _currentValue;
  20659. }
  20660. function setCurrentValue(value, event) {
  20661. if (rateDisabled.value) {
  20662. return;
  20663. }
  20664. if (props.allowHalf) {
  20665. let target = event.target;
  20666. if (hasClass(target, ns.e("item"))) {
  20667. target = target.querySelector(`.${ns.e("icon")}`);
  20668. }
  20669. if (target.clientWidth === 0 || hasClass(target, ns.e("decimal"))) {
  20670. target = target.parentNode;
  20671. }
  20672. pointerAtLeftHalf.value = event.offsetX * 2 <= target.clientWidth;
  20673. currentValue.value = pointerAtLeftHalf.value ? value - 0.5 : value;
  20674. } else {
  20675. currentValue.value = value;
  20676. }
  20677. hoverIndex.value = value;
  20678. }
  20679. function resetCurrentValue() {
  20680. if (rateDisabled.value) {
  20681. return;
  20682. }
  20683. if (props.allowHalf) {
  20684. pointerAtLeftHalf.value = props.modelValue !== Math.floor(props.modelValue);
  20685. }
  20686. currentValue.value = props.modelValue;
  20687. hoverIndex.value = -1;
  20688. }
  20689. watch(() => props.modelValue, (val) => {
  20690. currentValue.value = val;
  20691. pointerAtLeftHalf.value = props.modelValue !== Math.floor(props.modelValue);
  20692. });
  20693. if (!props.modelValue) {
  20694. emit(UPDATE_MODEL_EVENT, 0);
  20695. }
  20696. expose({
  20697. setCurrentValue,
  20698. resetCurrentValue
  20699. });
  20700. return (_ctx, _cache) => {
  20701. return openBlock(), createElementBlock("div", {
  20702. class: normalizeClass([unref(rateClasses), unref(ns).is("disabled", unref(rateDisabled))]),
  20703. role: "slider",
  20704. "aria-valuenow": currentValue.value,
  20705. "aria-valuetext": unref(text),
  20706. "aria-valuemin": "0",
  20707. "aria-valuemax": _ctx.max,
  20708. tabindex: "0",
  20709. style: normalizeStyle(unref(rateStyles)),
  20710. onKeydown: handleKey
  20711. }, [
  20712. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.max, (item, key) => {
  20713. return openBlock(), createElementBlock("span", {
  20714. key,
  20715. class: normalizeClass(unref(ns).e("item")),
  20716. onMousemove: ($event) => setCurrentValue(item, $event),
  20717. onMouseleave: resetCurrentValue,
  20718. onClick: ($event) => selectValue(item)
  20719. }, [
  20720. createVNode(unref(ElIcon), {
  20721. class: normalizeClass([
  20722. unref(ns).e("icon"),
  20723. { hover: hoverIndex.value === item },
  20724. unref(ns).is("active", item <= currentValue.value)
  20725. ])
  20726. }, {
  20727. default: withCtx(() => [
  20728. !showDecimalIcon(item) ? (openBlock(), createBlock(resolveDynamicComponent(unref(iconComponents)[item - 1]), { key: 0 })) : createCommentVNode("v-if", true),
  20729. showDecimalIcon(item) ? (openBlock(), createBlock(unref(ElIcon), {
  20730. key: 1,
  20731. style: normalizeStyle(unref(decimalStyle)),
  20732. class: normalizeClass([unref(ns).e("icon"), unref(ns).e("decimal")])
  20733. }, {
  20734. default: withCtx(() => [
  20735. (openBlock(), createBlock(resolveDynamicComponent(unref(decimalIconComponent))))
  20736. ]),
  20737. _: 1
  20738. }, 8, ["style", "class"])) : createCommentVNode("v-if", true)
  20739. ]),
  20740. _: 2
  20741. }, 1032, ["class"])
  20742. ], 42, _hoisted_2$c);
  20743. }), 128)),
  20744. _ctx.showText || _ctx.showScore ? (openBlock(), createElementBlock("span", {
  20745. key: 0,
  20746. class: normalizeClass(unref(ns).e("text"))
  20747. }, toDisplayString(unref(text)), 3)) : createCommentVNode("v-if", true)
  20748. ], 46, _hoisted_1$e);
  20749. };
  20750. }
  20751. }));
  20752. var Rate = /* @__PURE__ */ _export_sfc$1(_sfc_main$k, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/rate/src/rate.vue"]]);
  20753. const ElRate = withInstall(Rate);
  20754. const useTooltip = (props, formatTooltip, showTooltip) => {
  20755. const tooltip = ref(null);
  20756. const tooltipVisible = ref(false);
  20757. const enableFormat = computed(() => {
  20758. return formatTooltip.value instanceof Function;
  20759. });
  20760. const formatValue = computed(() => {
  20761. return enableFormat.value && formatTooltip.value(props.modelValue) || props.modelValue;
  20762. });
  20763. const displayTooltip = debounce$1(() => {
  20764. showTooltip.value && (tooltipVisible.value = true);
  20765. }, 50);
  20766. const hideTooltip = debounce$1(() => {
  20767. showTooltip.value && (tooltipVisible.value = false);
  20768. }, 50);
  20769. return {
  20770. tooltip,
  20771. tooltipVisible,
  20772. formatValue,
  20773. displayTooltip,
  20774. hideTooltip
  20775. };
  20776. };
  20777. const useSliderButton = (props, initData, emit) => {
  20778. const {
  20779. disabled,
  20780. min: min2,
  20781. max: max2,
  20782. step,
  20783. showTooltip,
  20784. precision,
  20785. sliderSize,
  20786. formatTooltip,
  20787. emitChange,
  20788. resetSize,
  20789. updateDragging
  20790. } = inject("SliderProvider");
  20791. const { tooltip, tooltipVisible, formatValue, displayTooltip, hideTooltip } = useTooltip(props, formatTooltip, showTooltip);
  20792. const currentPosition = computed(() => {
  20793. return `${(props.modelValue - min2.value) / (max2.value - min2.value) * 100}%`;
  20794. });
  20795. const wrapperStyle = computed(() => {
  20796. return props.vertical ? { bottom: currentPosition.value } : { left: currentPosition.value };
  20797. });
  20798. const handleMouseEnter = () => {
  20799. initData.hovering = true;
  20800. displayTooltip();
  20801. };
  20802. const handleMouseLeave = () => {
  20803. initData.hovering = false;
  20804. if (!initData.dragging) {
  20805. hideTooltip();
  20806. }
  20807. };
  20808. const onButtonDown = (event) => {
  20809. if (disabled.value)
  20810. return;
  20811. event.preventDefault();
  20812. onDragStart(event);
  20813. on(window, "mousemove", onDragging);
  20814. on(window, "touchmove", onDragging);
  20815. on(window, "mouseup", onDragEnd);
  20816. on(window, "touchend", onDragEnd);
  20817. on(window, "contextmenu", onDragEnd);
  20818. };
  20819. const onLeftKeyDown = () => {
  20820. if (disabled.value)
  20821. return;
  20822. initData.newPosition = Number.parseFloat(currentPosition.value) - step.value / (max2.value - min2.value) * 100;
  20823. setPosition(initData.newPosition);
  20824. emitChange();
  20825. };
  20826. const onRightKeyDown = () => {
  20827. if (disabled.value)
  20828. return;
  20829. initData.newPosition = Number.parseFloat(currentPosition.value) + step.value / (max2.value - min2.value) * 100;
  20830. setPosition(initData.newPosition);
  20831. emitChange();
  20832. };
  20833. const getClientXY = (event) => {
  20834. let clientX;
  20835. let clientY;
  20836. if (event.type.startsWith("touch")) {
  20837. clientY = event.touches[0].clientY;
  20838. clientX = event.touches[0].clientX;
  20839. } else {
  20840. clientY = event.clientY;
  20841. clientX = event.clientX;
  20842. }
  20843. return {
  20844. clientX,
  20845. clientY
  20846. };
  20847. };
  20848. const onDragStart = (event) => {
  20849. initData.dragging = true;
  20850. initData.isClick = true;
  20851. const { clientX, clientY } = getClientXY(event);
  20852. if (props.vertical) {
  20853. initData.startY = clientY;
  20854. } else {
  20855. initData.startX = clientX;
  20856. }
  20857. initData.startPosition = Number.parseFloat(currentPosition.value);
  20858. initData.newPosition = initData.startPosition;
  20859. };
  20860. const onDragging = (event) => {
  20861. if (initData.dragging) {
  20862. initData.isClick = false;
  20863. displayTooltip();
  20864. resetSize();
  20865. let diff;
  20866. const { clientX, clientY } = getClientXY(event);
  20867. if (props.vertical) {
  20868. initData.currentY = clientY;
  20869. diff = (initData.startY - initData.currentY) / sliderSize.value * 100;
  20870. } else {
  20871. initData.currentX = clientX;
  20872. diff = (initData.currentX - initData.startX) / sliderSize.value * 100;
  20873. }
  20874. initData.newPosition = initData.startPosition + diff;
  20875. setPosition(initData.newPosition);
  20876. }
  20877. };
  20878. const onDragEnd = () => {
  20879. if (initData.dragging) {
  20880. setTimeout(() => {
  20881. initData.dragging = false;
  20882. if (!initData.hovering) {
  20883. hideTooltip();
  20884. }
  20885. if (!initData.isClick) {
  20886. setPosition(initData.newPosition);
  20887. emitChange();
  20888. }
  20889. }, 0);
  20890. off(window, "mousemove", onDragging);
  20891. off(window, "touchmove", onDragging);
  20892. off(window, "mouseup", onDragEnd);
  20893. off(window, "touchend", onDragEnd);
  20894. off(window, "contextmenu", onDragEnd);
  20895. }
  20896. };
  20897. const setPosition = async (newPosition) => {
  20898. if (newPosition === null || Number.isNaN(+newPosition))
  20899. return;
  20900. if (newPosition < 0) {
  20901. newPosition = 0;
  20902. } else if (newPosition > 100) {
  20903. newPosition = 100;
  20904. }
  20905. const lengthPerStep = 100 / ((max2.value - min2.value) / step.value);
  20906. const steps = Math.round(newPosition / lengthPerStep);
  20907. let value = steps * lengthPerStep * (max2.value - min2.value) * 0.01 + min2.value;
  20908. value = Number.parseFloat(value.toFixed(precision.value));
  20909. emit(UPDATE_MODEL_EVENT, value);
  20910. if (!initData.dragging && props.modelValue !== initData.oldValue) {
  20911. initData.oldValue = props.modelValue;
  20912. }
  20913. await nextTick();
  20914. initData.dragging && displayTooltip();
  20915. tooltip.value.updatePopper();
  20916. };
  20917. watch(() => initData.dragging, (val) => {
  20918. updateDragging(val);
  20919. });
  20920. return {
  20921. tooltip,
  20922. tooltipVisible,
  20923. showTooltip,
  20924. wrapperStyle,
  20925. formatValue,
  20926. handleMouseEnter,
  20927. handleMouseLeave,
  20928. onButtonDown,
  20929. onLeftKeyDown,
  20930. onRightKeyDown,
  20931. setPosition
  20932. };
  20933. };
  20934. const _sfc_main$j = defineComponent({
  20935. name: "ElSliderButton",
  20936. components: {
  20937. ElTooltip
  20938. },
  20939. props: {
  20940. modelValue: {
  20941. type: Number,
  20942. default: 0
  20943. },
  20944. vertical: {
  20945. type: Boolean,
  20946. default: false
  20947. },
  20948. tooltipClass: {
  20949. type: String,
  20950. default: ""
  20951. }
  20952. },
  20953. emits: [UPDATE_MODEL_EVENT],
  20954. setup(props, { emit }) {
  20955. const ns = useNamespace("slider");
  20956. const initData = reactive({
  20957. hovering: false,
  20958. dragging: false,
  20959. isClick: false,
  20960. startX: 0,
  20961. currentX: 0,
  20962. startY: 0,
  20963. currentY: 0,
  20964. startPosition: 0,
  20965. newPosition: 0,
  20966. oldValue: props.modelValue
  20967. });
  20968. const {
  20969. tooltip,
  20970. showTooltip,
  20971. tooltipVisible,
  20972. wrapperStyle,
  20973. formatValue,
  20974. handleMouseEnter,
  20975. handleMouseLeave,
  20976. onButtonDown,
  20977. onLeftKeyDown,
  20978. onRightKeyDown,
  20979. setPosition
  20980. } = useSliderButton(props, initData, emit);
  20981. const { hovering, dragging } = toRefs(initData);
  20982. return {
  20983. ns,
  20984. tooltip,
  20985. tooltipVisible,
  20986. showTooltip,
  20987. wrapperStyle,
  20988. formatValue,
  20989. handleMouseEnter,
  20990. handleMouseLeave,
  20991. onButtonDown,
  20992. onLeftKeyDown,
  20993. onRightKeyDown,
  20994. setPosition,
  20995. hovering,
  20996. dragging
  20997. };
  20998. }
  20999. });
  21000. function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
  21001. const _component_el_tooltip = resolveComponent("el-tooltip");
  21002. return openBlock(), createElementBlock("div", {
  21003. ref: "button",
  21004. class: normalizeClass([_ctx.ns.e("button-wrapper"), { hover: _ctx.hovering, dragging: _ctx.dragging }]),
  21005. style: normalizeStyle(_ctx.wrapperStyle),
  21006. tabindex: "0",
  21007. onMouseenter: _cache[1] || (_cache[1] = (...args) => _ctx.handleMouseEnter && _ctx.handleMouseEnter(...args)),
  21008. onMouseleave: _cache[2] || (_cache[2] = (...args) => _ctx.handleMouseLeave && _ctx.handleMouseLeave(...args)),
  21009. onMousedown: _cache[3] || (_cache[3] = (...args) => _ctx.onButtonDown && _ctx.onButtonDown(...args)),
  21010. onTouchstart: _cache[4] || (_cache[4] = (...args) => _ctx.onButtonDown && _ctx.onButtonDown(...args)),
  21011. onFocus: _cache[5] || (_cache[5] = (...args) => _ctx.handleMouseEnter && _ctx.handleMouseEnter(...args)),
  21012. onBlur: _cache[6] || (_cache[6] = (...args) => _ctx.handleMouseLeave && _ctx.handleMouseLeave(...args)),
  21013. onKeydown: [
  21014. _cache[7] || (_cache[7] = withKeys((...args) => _ctx.onLeftKeyDown && _ctx.onLeftKeyDown(...args), ["left"])),
  21015. _cache[8] || (_cache[8] = withKeys((...args) => _ctx.onRightKeyDown && _ctx.onRightKeyDown(...args), ["right"])),
  21016. _cache[9] || (_cache[9] = withKeys(withModifiers((...args) => _ctx.onLeftKeyDown && _ctx.onLeftKeyDown(...args), ["prevent"]), ["down"])),
  21017. _cache[10] || (_cache[10] = withKeys(withModifiers((...args) => _ctx.onRightKeyDown && _ctx.onRightKeyDown(...args), ["prevent"]), ["up"]))
  21018. ]
  21019. }, [
  21020. createVNode(_component_el_tooltip, {
  21021. ref: "tooltip",
  21022. visible: _ctx.tooltipVisible,
  21023. "onUpdate:visible": _cache[0] || (_cache[0] = ($event) => _ctx.tooltipVisible = $event),
  21024. placement: "top",
  21025. "stop-popper-mouse-event": false,
  21026. "popper-class": _ctx.tooltipClass,
  21027. disabled: !_ctx.showTooltip,
  21028. persistent: ""
  21029. }, {
  21030. content: withCtx(() => [
  21031. createElementVNode("span", null, toDisplayString(_ctx.formatValue), 1)
  21032. ]),
  21033. default: withCtx(() => [
  21034. createElementVNode("div", {
  21035. class: normalizeClass([_ctx.ns.e("button"), { hover: _ctx.hovering, dragging: _ctx.dragging }])
  21036. }, null, 2)
  21037. ]),
  21038. _: 1
  21039. }, 8, ["visible", "popper-class", "disabled"])
  21040. ], 38);
  21041. }
  21042. var SliderButton = /* @__PURE__ */ _export_sfc$1(_sfc_main$j, [["render", _sfc_render$7], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/slider/src/button.vue"]]);
  21043. const _sfc_main$i = defineComponent({
  21044. name: "ElMarker",
  21045. props: {
  21046. mark: {
  21047. type: [String, Object],
  21048. default: () => void 0
  21049. }
  21050. },
  21051. setup(props) {
  21052. const ns = useNamespace("slider");
  21053. const label = computed(() => {
  21054. return typeof props.mark === "string" ? props.mark : props.mark.label;
  21055. });
  21056. return {
  21057. ns,
  21058. label
  21059. };
  21060. },
  21061. render() {
  21062. var _a2;
  21063. return h$1("div", {
  21064. class: this.ns.e("marks-text"),
  21065. style: (_a2 = this.mark) == null ? void 0 : _a2.style
  21066. }, this.label);
  21067. }
  21068. });
  21069. var SliderMarker = /* @__PURE__ */ _export_sfc$1(_sfc_main$i, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/slider/src/marker.vue"]]);
  21070. const useMarks = (props) => {
  21071. return computed(() => {
  21072. if (!props.marks) {
  21073. return [];
  21074. }
  21075. const marksKeys = Object.keys(props.marks);
  21076. return marksKeys.map(parseFloat).sort((a2, b2) => a2 - b2).filter((point) => point <= props.max && point >= props.min).map((point) => ({
  21077. point,
  21078. position: (point - props.min) * 100 / (props.max - props.min),
  21079. mark: props.marks[point]
  21080. }));
  21081. });
  21082. };
  21083. const useSlide = (props, initData, emit) => {
  21084. const elForm2 = inject(formContextKey, {});
  21085. const elFormItem2 = inject(formItemContextKey, {});
  21086. const slider = shallowRef(null);
  21087. const firstButton = ref(null);
  21088. const secondButton = ref(null);
  21089. const buttonRefs = {
  21090. firstButton,
  21091. secondButton
  21092. };
  21093. const sliderDisabled = computed(() => {
  21094. return props.disabled || elForm2.disabled || false;
  21095. });
  21096. const minValue = computed(() => {
  21097. return Math.min(initData.firstValue, initData.secondValue);
  21098. });
  21099. const maxValue = computed(() => {
  21100. return Math.max(initData.firstValue, initData.secondValue);
  21101. });
  21102. const barSize = computed(() => {
  21103. return props.range ? `${100 * (maxValue.value - minValue.value) / (props.max - props.min)}%` : `${100 * (initData.firstValue - props.min) / (props.max - props.min)}%`;
  21104. });
  21105. const barStart = computed(() => {
  21106. return props.range ? `${100 * (minValue.value - props.min) / (props.max - props.min)}%` : "0%";
  21107. });
  21108. const runwayStyle = computed(() => {
  21109. return props.vertical ? { height: props.height } : {};
  21110. });
  21111. const barStyle = computed(() => {
  21112. return props.vertical ? {
  21113. height: barSize.value,
  21114. bottom: barStart.value
  21115. } : {
  21116. width: barSize.value,
  21117. left: barStart.value
  21118. };
  21119. });
  21120. const resetSize = () => {
  21121. if (slider.value) {
  21122. initData.sliderSize = slider.value[`client${props.vertical ? "Height" : "Width"}`];
  21123. }
  21124. };
  21125. const setPosition = (percent) => {
  21126. const targetValue = props.min + percent * (props.max - props.min) / 100;
  21127. if (!props.range) {
  21128. firstButton.value.setPosition(percent);
  21129. return;
  21130. }
  21131. let buttonRefName;
  21132. if (Math.abs(minValue.value - targetValue) < Math.abs(maxValue.value - targetValue)) {
  21133. buttonRefName = initData.firstValue < initData.secondValue ? "firstButton" : "secondButton";
  21134. } else {
  21135. buttonRefName = initData.firstValue > initData.secondValue ? "firstButton" : "secondButton";
  21136. }
  21137. buttonRefs[buttonRefName].value.setPosition(percent);
  21138. };
  21139. const setFirstValue = (firstValue) => {
  21140. initData.firstValue = firstValue;
  21141. _emit(props.range ? [minValue.value, maxValue.value] : firstValue);
  21142. };
  21143. const setSecondValue = (secondValue) => {
  21144. initData.secondValue = secondValue;
  21145. if (props.range) {
  21146. _emit([minValue.value, maxValue.value]);
  21147. }
  21148. };
  21149. const _emit = (val) => {
  21150. emit(UPDATE_MODEL_EVENT, val);
  21151. emit(INPUT_EVENT, val);
  21152. };
  21153. const emitChange = async () => {
  21154. await nextTick();
  21155. emit(CHANGE_EVENT, props.range ? [minValue.value, maxValue.value] : props.modelValue);
  21156. };
  21157. const onSliderClick = (event) => {
  21158. if (sliderDisabled.value || initData.dragging)
  21159. return;
  21160. resetSize();
  21161. if (props.vertical) {
  21162. const sliderOffsetBottom = slider.value.getBoundingClientRect().bottom;
  21163. setPosition((sliderOffsetBottom - event.clientY) / initData.sliderSize * 100);
  21164. } else {
  21165. const sliderOffsetLeft = slider.value.getBoundingClientRect().left;
  21166. setPosition((event.clientX - sliderOffsetLeft) / initData.sliderSize * 100);
  21167. }
  21168. emitChange();
  21169. };
  21170. return {
  21171. elFormItem: elFormItem2,
  21172. slider,
  21173. firstButton,
  21174. secondButton,
  21175. sliderDisabled,
  21176. minValue,
  21177. maxValue,
  21178. runwayStyle,
  21179. barStyle,
  21180. resetSize,
  21181. setPosition,
  21182. emitChange,
  21183. onSliderClick,
  21184. setFirstValue,
  21185. setSecondValue
  21186. };
  21187. };
  21188. const useStops = (props, initData, minValue, maxValue) => {
  21189. const stops = computed(() => {
  21190. if (!props.showStops || props.min > props.max)
  21191. return [];
  21192. if (props.step === 0) {
  21193. return [];
  21194. }
  21195. const stopCount = (props.max - props.min) / props.step;
  21196. const stepWidth = 100 * props.step / (props.max - props.min);
  21197. const result = Array.from({ length: stopCount - 1 }).map((_2, index) => (index + 1) * stepWidth);
  21198. if (props.range) {
  21199. return result.filter((step) => {
  21200. return step < 100 * (minValue.value - props.min) / (props.max - props.min) || step > 100 * (maxValue.value - props.min) / (props.max - props.min);
  21201. });
  21202. } else {
  21203. return result.filter((step) => step > 100 * (initData.firstValue - props.min) / (props.max - props.min));
  21204. }
  21205. });
  21206. const getStopStyle = (position) => {
  21207. return props.vertical ? { bottom: `${position}%` } : { left: `${position}%` };
  21208. };
  21209. return {
  21210. stops,
  21211. getStopStyle
  21212. };
  21213. };
  21214. const _sfc_main$h = defineComponent({
  21215. name: "ElSlider",
  21216. components: {
  21217. ElInputNumber,
  21218. SliderButton,
  21219. SliderMarker
  21220. },
  21221. props: {
  21222. modelValue: {
  21223. type: [Number, Array],
  21224. default: 0
  21225. },
  21226. min: {
  21227. type: Number,
  21228. default: 0
  21229. },
  21230. max: {
  21231. type: Number,
  21232. default: 100
  21233. },
  21234. step: {
  21235. type: Number,
  21236. default: 1
  21237. },
  21238. showInput: {
  21239. type: Boolean,
  21240. default: false
  21241. },
  21242. showInputControls: {
  21243. type: Boolean,
  21244. default: true
  21245. },
  21246. size: {
  21247. type: String,
  21248. validator: isValidComponentSize
  21249. },
  21250. inputSize: {
  21251. type: String,
  21252. validator: isValidComponentSize
  21253. },
  21254. showStops: {
  21255. type: Boolean,
  21256. default: false
  21257. },
  21258. showTooltip: {
  21259. type: Boolean,
  21260. default: true
  21261. },
  21262. formatTooltip: {
  21263. type: Function,
  21264. default: void 0
  21265. },
  21266. disabled: {
  21267. type: Boolean,
  21268. default: false
  21269. },
  21270. range: {
  21271. type: Boolean,
  21272. default: false
  21273. },
  21274. vertical: {
  21275. type: Boolean,
  21276. default: false
  21277. },
  21278. height: {
  21279. type: String,
  21280. default: ""
  21281. },
  21282. debounce: {
  21283. type: Number,
  21284. default: 300
  21285. },
  21286. label: {
  21287. type: String,
  21288. default: void 0
  21289. },
  21290. tooltipClass: {
  21291. type: String,
  21292. default: void 0
  21293. },
  21294. marks: Object
  21295. },
  21296. emits: [UPDATE_MODEL_EVENT, CHANGE_EVENT, INPUT_EVENT],
  21297. setup(props, { emit }) {
  21298. const ns = useNamespace("slider");
  21299. const initData = reactive({
  21300. firstValue: 0,
  21301. secondValue: 0,
  21302. oldValue: 0,
  21303. dragging: false,
  21304. sliderSize: 1
  21305. });
  21306. const {
  21307. elFormItem: elFormItem2,
  21308. slider,
  21309. firstButton,
  21310. secondButton,
  21311. sliderDisabled,
  21312. minValue,
  21313. maxValue,
  21314. runwayStyle,
  21315. barStyle,
  21316. resetSize,
  21317. emitChange,
  21318. onSliderClick,
  21319. setFirstValue,
  21320. setSecondValue
  21321. } = useSlide(props, initData, emit);
  21322. const { stops, getStopStyle } = useStops(props, initData, minValue, maxValue);
  21323. const sliderWrapperSize = useSize();
  21324. const sliderInputSize = computed(() => props.inputSize || sliderWrapperSize.value);
  21325. const sliderKls = computed(() => [
  21326. ns.b(),
  21327. ns.m(sliderWrapperSize.value),
  21328. ns.is("vertical", props.vertical),
  21329. { [ns.m("with-input")]: props.showInput }
  21330. ]);
  21331. const markList = useMarks(props);
  21332. useWatch(props, initData, minValue, maxValue, emit, elFormItem2);
  21333. const precision = computed(() => {
  21334. const precisions = [props.min, props.max, props.step].map((item) => {
  21335. const decimal = `${item}`.split(".")[1];
  21336. return decimal ? decimal.length : 0;
  21337. });
  21338. return Math.max.apply(null, precisions);
  21339. });
  21340. const { sliderWrapper } = useLifecycle(props, initData, resetSize);
  21341. const { firstValue, secondValue, oldValue, dragging, sliderSize } = toRefs(initData);
  21342. const updateDragging = (val) => {
  21343. initData.dragging = val;
  21344. };
  21345. provide("SliderProvider", __spreadProps(__spreadValues({}, toRefs(props)), {
  21346. sliderSize,
  21347. disabled: sliderDisabled,
  21348. precision,
  21349. emitChange,
  21350. resetSize,
  21351. updateDragging
  21352. }));
  21353. return {
  21354. ns,
  21355. firstValue,
  21356. secondValue,
  21357. oldValue,
  21358. dragging,
  21359. sliderSize,
  21360. slider,
  21361. firstButton,
  21362. secondButton,
  21363. sliderDisabled,
  21364. runwayStyle,
  21365. barStyle,
  21366. emitChange,
  21367. onSliderClick,
  21368. getStopStyle,
  21369. setFirstValue,
  21370. setSecondValue,
  21371. stops,
  21372. markList,
  21373. sliderWrapper,
  21374. sliderWrapperSize,
  21375. sliderInputSize,
  21376. sliderKls
  21377. };
  21378. }
  21379. });
  21380. const useWatch = (props, initData, minValue, maxValue, emit, elFormItem2) => {
  21381. const _emit = (val) => {
  21382. emit(UPDATE_MODEL_EVENT, val);
  21383. emit(INPUT_EVENT, val);
  21384. };
  21385. const valueChanged = () => {
  21386. if (props.range) {
  21387. return ![minValue.value, maxValue.value].every((item, index) => item === initData.oldValue[index]);
  21388. } else {
  21389. return props.modelValue !== initData.oldValue;
  21390. }
  21391. };
  21392. const setValues = () => {
  21393. var _a2, _b2;
  21394. if (props.min > props.max) {
  21395. throwError("Slider", "min should not be greater than max.");
  21396. return;
  21397. }
  21398. const val = props.modelValue;
  21399. if (props.range && Array.isArray(val)) {
  21400. if (val[1] < props.min) {
  21401. _emit([props.min, props.min]);
  21402. } else if (val[0] > props.max) {
  21403. _emit([props.max, props.max]);
  21404. } else if (val[0] < props.min) {
  21405. _emit([props.min, val[1]]);
  21406. } else if (val[1] > props.max) {
  21407. _emit([val[0], props.max]);
  21408. } else {
  21409. initData.firstValue = val[0];
  21410. initData.secondValue = val[1];
  21411. if (valueChanged()) {
  21412. (_a2 = elFormItem2.validate) == null ? void 0 : _a2.call(elFormItem2, "change").catch((err) => debugWarn());
  21413. initData.oldValue = val.slice();
  21414. }
  21415. }
  21416. } else if (!props.range && typeof val === "number" && !Number.isNaN(val)) {
  21417. if (val < props.min) {
  21418. _emit(props.min);
  21419. } else if (val > props.max) {
  21420. _emit(props.max);
  21421. } else {
  21422. initData.firstValue = val;
  21423. if (valueChanged()) {
  21424. (_b2 = elFormItem2.validate) == null ? void 0 : _b2.call(elFormItem2, "change").catch((err) => debugWarn());
  21425. initData.oldValue = val;
  21426. }
  21427. }
  21428. }
  21429. };
  21430. setValues();
  21431. watch(() => initData.dragging, (val) => {
  21432. if (!val) {
  21433. setValues();
  21434. }
  21435. });
  21436. watch(() => props.modelValue, (val, oldVal) => {
  21437. if (initData.dragging || Array.isArray(val) && Array.isArray(oldVal) && val.every((item, index) => item === oldVal[index]) && initData.firstValue === val[0] && initData.secondValue === val[1]) {
  21438. return;
  21439. }
  21440. setValues();
  21441. }, {
  21442. deep: true
  21443. });
  21444. watch(() => [props.min, props.max], () => {
  21445. setValues();
  21446. });
  21447. };
  21448. const useLifecycle = (props, initData, resetSize) => {
  21449. const sliderWrapper = ref(null);
  21450. onMounted(async () => {
  21451. let valuetext;
  21452. if (props.range) {
  21453. if (Array.isArray(props.modelValue)) {
  21454. initData.firstValue = Math.max(props.min, props.modelValue[0]);
  21455. initData.secondValue = Math.min(props.max, props.modelValue[1]);
  21456. } else {
  21457. initData.firstValue = props.min;
  21458. initData.secondValue = props.max;
  21459. }
  21460. initData.oldValue = [initData.firstValue, initData.secondValue];
  21461. valuetext = `${initData.firstValue}-${initData.secondValue}`;
  21462. } else {
  21463. if (typeof props.modelValue !== "number" || Number.isNaN(props.modelValue)) {
  21464. initData.firstValue = props.min;
  21465. } else {
  21466. initData.firstValue = Math.min(props.max, Math.max(props.min, props.modelValue));
  21467. }
  21468. initData.oldValue = initData.firstValue;
  21469. valuetext = initData.firstValue;
  21470. }
  21471. sliderWrapper.value.setAttribute("aria-valuetext", valuetext);
  21472. sliderWrapper.value.setAttribute("aria-label", props.label ? props.label : `slider between ${props.min} and ${props.max}`);
  21473. on(window, "resize", resetSize);
  21474. await nextTick();
  21475. resetSize();
  21476. });
  21477. onBeforeUnmount(() => {
  21478. off(window, "resize", resetSize);
  21479. });
  21480. return {
  21481. sliderWrapper
  21482. };
  21483. };
  21484. const _hoisted_1$d = ["aria-valuemin", "aria-valuemax", "aria-orientation", "aria-disabled"];
  21485. const _hoisted_2$b = { key: 1 };
  21486. function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
  21487. const _component_slider_button = resolveComponent("slider-button");
  21488. const _component_slider_marker = resolveComponent("slider-marker");
  21489. const _component_el_input_number = resolveComponent("el-input-number");
  21490. return openBlock(), createElementBlock("div", {
  21491. ref: "sliderWrapper",
  21492. class: normalizeClass(_ctx.sliderKls),
  21493. role: "slider",
  21494. "aria-valuemin": _ctx.min,
  21495. "aria-valuemax": _ctx.max,
  21496. "aria-orientation": _ctx.vertical ? "vertical" : "horizontal",
  21497. "aria-disabled": _ctx.sliderDisabled
  21498. }, [
  21499. createElementVNode("div", {
  21500. ref: "slider",
  21501. class: normalizeClass([
  21502. _ctx.ns.e("runway"),
  21503. { "show-input": _ctx.showInput && !_ctx.range },
  21504. _ctx.ns.is("disabled", _ctx.sliderDisabled)
  21505. ]),
  21506. style: normalizeStyle(_ctx.runwayStyle),
  21507. onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onSliderClick && _ctx.onSliderClick(...args))
  21508. }, [
  21509. createElementVNode("div", {
  21510. class: normalizeClass(_ctx.ns.e("bar")),
  21511. style: normalizeStyle(_ctx.barStyle)
  21512. }, null, 6),
  21513. createVNode(_component_slider_button, {
  21514. ref: "firstButton",
  21515. "model-value": _ctx.firstValue,
  21516. vertical: _ctx.vertical,
  21517. "tooltip-class": _ctx.tooltipClass,
  21518. "onUpdate:modelValue": _ctx.setFirstValue
  21519. }, null, 8, ["model-value", "vertical", "tooltip-class", "onUpdate:modelValue"]),
  21520. _ctx.range ? (openBlock(), createBlock(_component_slider_button, {
  21521. key: 0,
  21522. ref: "secondButton",
  21523. "model-value": _ctx.secondValue,
  21524. vertical: _ctx.vertical,
  21525. "tooltip-class": _ctx.tooltipClass,
  21526. "onUpdate:modelValue": _ctx.setSecondValue
  21527. }, null, 8, ["model-value", "vertical", "tooltip-class", "onUpdate:modelValue"])) : createCommentVNode("v-if", true),
  21528. _ctx.showStops ? (openBlock(), createElementBlock("div", _hoisted_2$b, [
  21529. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.stops, (item, key) => {
  21530. return openBlock(), createElementBlock("div", {
  21531. key,
  21532. class: normalizeClass(_ctx.ns.e("stop")),
  21533. style: normalizeStyle(_ctx.getStopStyle(item))
  21534. }, null, 6);
  21535. }), 128))
  21536. ])) : createCommentVNode("v-if", true),
  21537. _ctx.markList.length > 0 ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
  21538. createElementVNode("div", null, [
  21539. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.markList, (item, key) => {
  21540. return openBlock(), createElementBlock("div", {
  21541. key,
  21542. style: normalizeStyle(_ctx.getStopStyle(item.position)),
  21543. class: normalizeClass([_ctx.ns.e("stop"), _ctx.ns.e("marks-stop")])
  21544. }, null, 6);
  21545. }), 128))
  21546. ]),
  21547. createElementVNode("div", {
  21548. class: normalizeClass(_ctx.ns.e("marks"))
  21549. }, [
  21550. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.markList, (item, key) => {
  21551. return openBlock(), createBlock(_component_slider_marker, {
  21552. key,
  21553. mark: item.mark,
  21554. style: normalizeStyle(_ctx.getStopStyle(item.position))
  21555. }, null, 8, ["mark", "style"]);
  21556. }), 128))
  21557. ], 2)
  21558. ], 64)) : createCommentVNode("v-if", true)
  21559. ], 6),
  21560. _ctx.showInput && !_ctx.range ? (openBlock(), createBlock(_component_el_input_number, {
  21561. key: 0,
  21562. ref: "input",
  21563. "model-value": _ctx.firstValue,
  21564. class: normalizeClass(_ctx.ns.e("input")),
  21565. step: _ctx.step,
  21566. disabled: _ctx.sliderDisabled,
  21567. controls: _ctx.showInputControls,
  21568. min: _ctx.min,
  21569. max: _ctx.max,
  21570. debounce: _ctx.debounce,
  21571. size: _ctx.sliderInputSize,
  21572. "onUpdate:modelValue": _ctx.setFirstValue,
  21573. onChange: _ctx.emitChange
  21574. }, null, 8, ["model-value", "class", "step", "disabled", "controls", "min", "max", "debounce", "size", "onUpdate:modelValue", "onChange"])) : createCommentVNode("v-if", true)
  21575. ], 10, _hoisted_1$d);
  21576. }
  21577. var Slider = /* @__PURE__ */ _export_sfc$1(_sfc_main$h, [["render", _sfc_render$6], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/slider/src/index.vue"]]);
  21578. Slider.install = (app) => {
  21579. app.component(Slider.name, Slider);
  21580. };
  21581. const _Slider = Slider;
  21582. const ElSlider = _Slider;
  21583. const spaceItem = buildProps({
  21584. prefixCls: {
  21585. type: String,
  21586. default: ""
  21587. }
  21588. });
  21589. const _sfc_main$g = defineComponent({
  21590. props: spaceItem,
  21591. setup(props) {
  21592. const ns = useNamespace("space");
  21593. const classes = computed(() => `${props.prefixCls || ns.b()}__item`);
  21594. return {
  21595. classes
  21596. };
  21597. }
  21598. });
  21599. function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
  21600. return openBlock(), createElementBlock("div", {
  21601. class: normalizeClass(_ctx.classes)
  21602. }, [
  21603. renderSlot(_ctx.$slots, "default")
  21604. ], 2);
  21605. }
  21606. var Item = /* @__PURE__ */ _export_sfc$1(_sfc_main$g, [["render", _sfc_render$5], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/space/src/item.vue"]]);
  21607. const SIZE_MAP = {
  21608. small: 8,
  21609. default: 12,
  21610. large: 16
  21611. };
  21612. function useSpace(props) {
  21613. const ns = useNamespace("space");
  21614. const classes = computed(() => [ns.b(), ns.m(props.direction), props.class]);
  21615. const horizontalSize = ref(0);
  21616. const verticalSize = ref(0);
  21617. const containerStyle = computed(() => {
  21618. const wrapKls = props.wrap || props.fill ? { flexWrap: "wrap", marginBottom: `-${verticalSize.value}px` } : {};
  21619. const alignment = {
  21620. alignItems: props.alignment
  21621. };
  21622. return [wrapKls, alignment, props.style];
  21623. });
  21624. const itemStyle = computed(() => {
  21625. const itemBaseStyle = {
  21626. paddingBottom: `${verticalSize.value}px`,
  21627. marginRight: `${horizontalSize.value}px`
  21628. };
  21629. const fillStyle = props.fill ? { flexGrow: 1, minWidth: `${props.fillRatio}%` } : {};
  21630. return [itemBaseStyle, fillStyle];
  21631. });
  21632. watchEffect(() => {
  21633. const { size = "small", wrap, direction: dir, fill } = props;
  21634. if (Array.isArray(size)) {
  21635. const [h2 = 0, v2 = 0] = size;
  21636. horizontalSize.value = h2;
  21637. verticalSize.value = v2;
  21638. } else {
  21639. let val;
  21640. if (isNumber(size)) {
  21641. val = size;
  21642. } else {
  21643. val = SIZE_MAP[size] || SIZE_MAP.small;
  21644. }
  21645. if ((wrap || fill) && dir === "horizontal") {
  21646. horizontalSize.value = verticalSize.value = val;
  21647. } else {
  21648. if (dir === "horizontal") {
  21649. horizontalSize.value = val;
  21650. verticalSize.value = 0;
  21651. } else {
  21652. verticalSize.value = val;
  21653. horizontalSize.value = 0;
  21654. }
  21655. }
  21656. }
  21657. });
  21658. return {
  21659. classes,
  21660. containerStyle,
  21661. itemStyle
  21662. };
  21663. }
  21664. const spaceProps = buildProps({
  21665. direction: {
  21666. type: String,
  21667. values: ["horizontal", "vertical"],
  21668. default: "horizontal"
  21669. },
  21670. class: {
  21671. type: definePropType([
  21672. String,
  21673. Object,
  21674. Array
  21675. ]),
  21676. default: ""
  21677. },
  21678. style: {
  21679. type: definePropType([String, Array, Object]),
  21680. default: ""
  21681. },
  21682. alignment: {
  21683. type: definePropType(String),
  21684. default: "center"
  21685. },
  21686. prefixCls: {
  21687. type: String
  21688. },
  21689. spacer: {
  21690. type: definePropType([Object, String, Number, Array]),
  21691. default: null,
  21692. validator: (val) => isVNode(val) || isNumber(val) || isString(val)
  21693. },
  21694. wrap: {
  21695. type: Boolean,
  21696. default: false
  21697. },
  21698. fill: {
  21699. type: Boolean,
  21700. default: false
  21701. },
  21702. fillRatio: {
  21703. type: Number,
  21704. default: 100
  21705. },
  21706. size: {
  21707. type: [String, Array, Number],
  21708. values: componentSizes,
  21709. validator: (val) => {
  21710. return isNumber(val) || isArray(val) && val.length === 2 && val.every((i) => isNumber(i));
  21711. }
  21712. }
  21713. });
  21714. var Space = defineComponent({
  21715. name: "ElSpace",
  21716. props: spaceProps,
  21717. setup(props, { slots }) {
  21718. const { classes, containerStyle, itemStyle } = useSpace(props);
  21719. return () => {
  21720. var _a2;
  21721. const { spacer, prefixCls, direction } = props;
  21722. const children = renderSlot(slots, "default", { key: 0 }, () => []);
  21723. if (((_a2 = children.children) != null ? _a2 : []).length === 0)
  21724. return null;
  21725. if (isArray(children.children)) {
  21726. let extractedChildren = [];
  21727. children.children.forEach((child, loopKey) => {
  21728. if (isFragment(child)) {
  21729. if (isArray(child.children)) {
  21730. child.children.forEach((nested, key) => {
  21731. extractedChildren.push(createVNode(Item, {
  21732. style: itemStyle.value,
  21733. prefixCls,
  21734. key: `nested-${key}`
  21735. }, {
  21736. default: () => [nested]
  21737. }, PatchFlags.PROPS | PatchFlags.STYLE, ["style", "prefixCls"]));
  21738. });
  21739. }
  21740. } else if (isValidElementNode(child)) {
  21741. extractedChildren.push(createVNode(Item, {
  21742. style: itemStyle.value,
  21743. prefixCls,
  21744. key: `LoopKey${loopKey}`
  21745. }, {
  21746. default: () => [child]
  21747. }, PatchFlags.PROPS | PatchFlags.STYLE, ["style", "prefixCls"]));
  21748. }
  21749. });
  21750. if (spacer) {
  21751. const len = extractedChildren.length - 1;
  21752. extractedChildren = extractedChildren.reduce((acc, child, idx) => {
  21753. const children2 = [...acc, child];
  21754. if (idx !== len) {
  21755. children2.push(createVNode("span", {
  21756. style: [
  21757. itemStyle.value,
  21758. direction === "vertical" ? "width: 100%" : null
  21759. ],
  21760. key: idx
  21761. }, [
  21762. isVNode(spacer) ? spacer : createTextVNode(spacer, PatchFlags.TEXT)
  21763. ], PatchFlags.STYLE));
  21764. }
  21765. return children2;
  21766. }, []);
  21767. }
  21768. return createVNode("div", {
  21769. class: classes.value,
  21770. style: containerStyle.value
  21771. }, extractedChildren, PatchFlags.STYLE | PatchFlags.CLASS);
  21772. }
  21773. return children.children;
  21774. };
  21775. }
  21776. });
  21777. const ElSpace = withInstall(Space);
  21778. const switchProps = buildProps({
  21779. modelValue: {
  21780. type: [Boolean, String, Number],
  21781. default: false
  21782. },
  21783. value: {
  21784. type: [Boolean, String, Number],
  21785. default: false
  21786. },
  21787. disabled: {
  21788. type: Boolean,
  21789. default: false
  21790. },
  21791. width: {
  21792. type: Number,
  21793. default: 40
  21794. },
  21795. inlinePrompt: {
  21796. type: Boolean,
  21797. default: false
  21798. },
  21799. activeIcon: {
  21800. type: iconPropType,
  21801. default: ""
  21802. },
  21803. inactiveIcon: {
  21804. type: iconPropType,
  21805. default: ""
  21806. },
  21807. activeText: {
  21808. type: String,
  21809. default: ""
  21810. },
  21811. inactiveText: {
  21812. type: String,
  21813. default: ""
  21814. },
  21815. activeColor: {
  21816. type: String,
  21817. default: ""
  21818. },
  21819. inactiveColor: {
  21820. type: String,
  21821. default: ""
  21822. },
  21823. borderColor: {
  21824. type: String,
  21825. default: ""
  21826. },
  21827. activeValue: {
  21828. type: [Boolean, String, Number],
  21829. default: true
  21830. },
  21831. inactiveValue: {
  21832. type: [Boolean, String, Number],
  21833. default: false
  21834. },
  21835. name: {
  21836. type: String,
  21837. default: ""
  21838. },
  21839. validateEvent: {
  21840. type: Boolean,
  21841. default: true
  21842. },
  21843. id: String,
  21844. loading: {
  21845. type: Boolean,
  21846. default: false
  21847. },
  21848. beforeChange: {
  21849. type: definePropType(Function)
  21850. },
  21851. size: {
  21852. type: String,
  21853. validator: isValidComponentSize
  21854. }
  21855. });
  21856. const switchEmits = {
  21857. [UPDATE_MODEL_EVENT]: (val) => isBoolean(val) || isString(val) || isNumber(val),
  21858. [CHANGE_EVENT]: (val) => isBoolean(val) || isString(val) || isNumber(val),
  21859. [INPUT_EVENT]: (val) => isBoolean(val) || isString(val) || isNumber(val)
  21860. };
  21861. const COMPONENT_NAME = "ElSwitch";
  21862. const _sfc_main$f = defineComponent({
  21863. name: COMPONENT_NAME,
  21864. components: { ElIcon, Loading: loading },
  21865. props: switchProps,
  21866. emits: switchEmits,
  21867. setup(props, { emit }) {
  21868. const { formItem } = useFormItem();
  21869. const switchDisabled = useDisabled$1(computed(() => props.loading));
  21870. const ns = useNamespace("switch");
  21871. const switchSize = useSize();
  21872. const isModelValue = ref(props.modelValue !== false);
  21873. const input = ref();
  21874. const core = ref();
  21875. const switchKls = computed(() => [
  21876. ns.b(),
  21877. ns.m(switchSize.value),
  21878. ns.is("disabled", switchDisabled.value),
  21879. ns.is("checked", checked.value)
  21880. ]);
  21881. watch(() => props.modelValue, () => {
  21882. isModelValue.value = true;
  21883. });
  21884. watch(() => props.value, () => {
  21885. isModelValue.value = false;
  21886. });
  21887. const actualValue = computed(() => {
  21888. return isModelValue.value ? props.modelValue : props.value;
  21889. });
  21890. const checked = computed(() => actualValue.value === props.activeValue);
  21891. if (![props.activeValue, props.inactiveValue].includes(actualValue.value)) {
  21892. emit(UPDATE_MODEL_EVENT, props.inactiveValue);
  21893. emit(CHANGE_EVENT, props.inactiveValue);
  21894. emit(INPUT_EVENT, props.inactiveValue);
  21895. }
  21896. watch(checked, () => {
  21897. var _a2;
  21898. input.value.checked = checked.value;
  21899. if (props.activeColor || props.inactiveColor) {
  21900. setBackgroundColor();
  21901. }
  21902. if (props.validateEvent) {
  21903. (_a2 = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a2.call(formItem, "change").catch((err) => debugWarn());
  21904. }
  21905. });
  21906. const handleChange2 = () => {
  21907. const val = checked.value ? props.inactiveValue : props.activeValue;
  21908. emit(UPDATE_MODEL_EVENT, val);
  21909. emit(CHANGE_EVENT, val);
  21910. emit(INPUT_EVENT, val);
  21911. nextTick(() => {
  21912. input.value.checked = checked.value;
  21913. });
  21914. };
  21915. const switchValue = () => {
  21916. if (switchDisabled.value)
  21917. return;
  21918. const { beforeChange } = props;
  21919. if (!beforeChange) {
  21920. handleChange2();
  21921. return;
  21922. }
  21923. const shouldChange = beforeChange();
  21924. const isExpectType = [
  21925. isPromise(shouldChange),
  21926. isBoolean(shouldChange)
  21927. ].some((i) => i);
  21928. if (!isExpectType) {
  21929. throwError(COMPONENT_NAME, "beforeChange must return type `Promise<boolean>` or `boolean`");
  21930. }
  21931. if (isPromise(shouldChange)) {
  21932. shouldChange.then((result) => {
  21933. if (result) {
  21934. handleChange2();
  21935. }
  21936. }).catch((e) => {
  21937. });
  21938. } else if (shouldChange) {
  21939. handleChange2();
  21940. }
  21941. };
  21942. const setBackgroundColor = () => {
  21943. const newColor = checked.value ? props.activeColor : props.inactiveColor;
  21944. const coreEl = core.value;
  21945. if (props.borderColor)
  21946. coreEl.style.borderColor = props.borderColor;
  21947. else if (!props.borderColor)
  21948. coreEl.style.borderColor = newColor;
  21949. coreEl.style.backgroundColor = newColor;
  21950. coreEl.children[0].style.color = newColor;
  21951. };
  21952. const focus = () => {
  21953. var _a2, _b2;
  21954. (_b2 = (_a2 = input.value) == null ? void 0 : _a2.focus) == null ? void 0 : _b2.call(_a2);
  21955. };
  21956. onMounted(() => {
  21957. if (props.activeColor || props.inactiveColor || props.borderColor) {
  21958. setBackgroundColor();
  21959. }
  21960. input.value.checked = checked.value;
  21961. });
  21962. return {
  21963. ns,
  21964. input,
  21965. core,
  21966. switchDisabled,
  21967. checked,
  21968. switchKls,
  21969. handleChange: handleChange2,
  21970. switchValue,
  21971. focus
  21972. };
  21973. }
  21974. });
  21975. const _hoisted_1$c = ["aria-checked", "aria-disabled"];
  21976. const _hoisted_2$a = ["id", "name", "true-value", "false-value", "disabled"];
  21977. const _hoisted_3$7 = ["aria-hidden"];
  21978. const _hoisted_4$6 = ["aria-hidden"];
  21979. const _hoisted_5$6 = ["aria-hidden"];
  21980. const _hoisted_6$5 = ["aria-hidden"];
  21981. function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
  21982. const _component_el_icon = resolveComponent("el-icon");
  21983. const _component_loading = resolveComponent("loading");
  21984. return openBlock(), createElementBlock("div", {
  21985. class: normalizeClass(_ctx.switchKls),
  21986. role: "switch",
  21987. "aria-checked": _ctx.checked,
  21988. "aria-disabled": _ctx.switchDisabled,
  21989. onClick: _cache[2] || (_cache[2] = withModifiers((...args) => _ctx.switchValue && _ctx.switchValue(...args), ["prevent"]))
  21990. }, [
  21991. createElementVNode("input", {
  21992. id: _ctx.id,
  21993. ref: "input",
  21994. class: normalizeClass(_ctx.ns.e("input")),
  21995. type: "checkbox",
  21996. name: _ctx.name,
  21997. "true-value": _ctx.activeValue,
  21998. "false-value": _ctx.inactiveValue,
  21999. disabled: _ctx.switchDisabled,
  22000. onChange: _cache[0] || (_cache[0] = (...args) => _ctx.handleChange && _ctx.handleChange(...args)),
  22001. onKeydown: _cache[1] || (_cache[1] = withKeys((...args) => _ctx.switchValue && _ctx.switchValue(...args), ["enter"]))
  22002. }, null, 42, _hoisted_2$a),
  22003. !_ctx.inlinePrompt && (_ctx.inactiveIcon || _ctx.inactiveText) ? (openBlock(), createElementBlock("span", {
  22004. key: 0,
  22005. class: normalizeClass([
  22006. _ctx.ns.e("label"),
  22007. _ctx.ns.em("label", "left"),
  22008. _ctx.ns.is("active", !_ctx.checked)
  22009. ])
  22010. }, [
  22011. _ctx.inactiveIcon ? (openBlock(), createBlock(_component_el_icon, { key: 0 }, {
  22012. default: withCtx(() => [
  22013. (openBlock(), createBlock(resolveDynamicComponent(_ctx.inactiveIcon)))
  22014. ]),
  22015. _: 1
  22016. })) : createCommentVNode("v-if", true),
  22017. !_ctx.inactiveIcon && _ctx.inactiveText ? (openBlock(), createElementBlock("span", {
  22018. key: 1,
  22019. "aria-hidden": _ctx.checked
  22020. }, toDisplayString(_ctx.inactiveText), 9, _hoisted_3$7)) : createCommentVNode("v-if", true)
  22021. ], 2)) : createCommentVNode("v-if", true),
  22022. createElementVNode("span", {
  22023. ref: "core",
  22024. class: normalizeClass(_ctx.ns.e("core")),
  22025. style: normalizeStyle({ width: (_ctx.width || 40) + "px" })
  22026. }, [
  22027. _ctx.inlinePrompt ? (openBlock(), createElementBlock("div", {
  22028. key: 0,
  22029. class: normalizeClass(_ctx.ns.e("inner"))
  22030. }, [
  22031. _ctx.activeIcon || _ctx.inactiveIcon ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  22032. _ctx.activeIcon ? (openBlock(), createBlock(_component_el_icon, {
  22033. key: 0,
  22034. class: normalizeClass([_ctx.ns.is("icon"), _ctx.checked ? _ctx.ns.is("show") : _ctx.ns.is("hide")])
  22035. }, {
  22036. default: withCtx(() => [
  22037. (openBlock(), createBlock(resolveDynamicComponent(_ctx.activeIcon)))
  22038. ]),
  22039. _: 1
  22040. }, 8, ["class"])) : createCommentVNode("v-if", true),
  22041. _ctx.inactiveIcon ? (openBlock(), createBlock(_component_el_icon, {
  22042. key: 1,
  22043. class: normalizeClass([_ctx.ns.is("icon"), !_ctx.checked ? _ctx.ns.is("show") : _ctx.ns.is("hide")])
  22044. }, {
  22045. default: withCtx(() => [
  22046. (openBlock(), createBlock(resolveDynamicComponent(_ctx.inactiveIcon)))
  22047. ]),
  22048. _: 1
  22049. }, 8, ["class"])) : createCommentVNode("v-if", true)
  22050. ], 64)) : _ctx.activeText || _ctx.inactiveIcon ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  22051. _ctx.activeText ? (openBlock(), createElementBlock("span", {
  22052. key: 0,
  22053. class: normalizeClass([_ctx.ns.is("text"), _ctx.checked ? _ctx.ns.is("show") : _ctx.ns.is("hide")]),
  22054. "aria-hidden": !_ctx.checked
  22055. }, toDisplayString(_ctx.activeText.substring(0, 3)), 11, _hoisted_4$6)) : createCommentVNode("v-if", true),
  22056. _ctx.inactiveText ? (openBlock(), createElementBlock("span", {
  22057. key: 1,
  22058. class: normalizeClass([_ctx.ns.is("text"), !_ctx.checked ? _ctx.ns.is("show") : _ctx.ns.is("hide")]),
  22059. "aria-hidden": _ctx.checked
  22060. }, toDisplayString(_ctx.inactiveText.substring(0, 3)), 11, _hoisted_5$6)) : createCommentVNode("v-if", true)
  22061. ], 64)) : createCommentVNode("v-if", true)
  22062. ], 2)) : createCommentVNode("v-if", true),
  22063. createElementVNode("div", {
  22064. class: normalizeClass(_ctx.ns.e("action"))
  22065. }, [
  22066. _ctx.loading ? (openBlock(), createBlock(_component_el_icon, {
  22067. key: 0,
  22068. class: normalizeClass(_ctx.ns.is("loading"))
  22069. }, {
  22070. default: withCtx(() => [
  22071. createVNode(_component_loading)
  22072. ]),
  22073. _: 1
  22074. }, 8, ["class"])) : createCommentVNode("v-if", true)
  22075. ], 2)
  22076. ], 6),
  22077. !_ctx.inlinePrompt && (_ctx.activeIcon || _ctx.activeText) ? (openBlock(), createElementBlock("span", {
  22078. key: 1,
  22079. class: normalizeClass([
  22080. _ctx.ns.e("label"),
  22081. _ctx.ns.em("label", "right"),
  22082. _ctx.ns.is("active", _ctx.checked)
  22083. ])
  22084. }, [
  22085. _ctx.activeIcon ? (openBlock(), createBlock(_component_el_icon, { key: 0 }, {
  22086. default: withCtx(() => [
  22087. (openBlock(), createBlock(resolveDynamicComponent(_ctx.activeIcon)))
  22088. ]),
  22089. _: 1
  22090. })) : createCommentVNode("v-if", true),
  22091. !_ctx.activeIcon && _ctx.activeText ? (openBlock(), createElementBlock("span", {
  22092. key: 1,
  22093. "aria-hidden": !_ctx.checked
  22094. }, toDisplayString(_ctx.activeText), 9, _hoisted_6$5)) : createCommentVNode("v-if", true)
  22095. ], 2)) : createCommentVNode("v-if", true)
  22096. ], 10, _hoisted_1$c);
  22097. }
  22098. var Switch = /* @__PURE__ */ _export_sfc$1(_sfc_main$f, [["render", _sfc_render$4], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/switch/src/switch.vue"]]);
  22099. const ElSwitch = withInstall(Switch);
  22100. /*!
  22101. * escape-html
  22102. * Copyright(c) 2012-2013 TJ Holowaychuk
  22103. * Copyright(c) 2015 Andreas Lubbe
  22104. * Copyright(c) 2015 Tiancheng "Timothy" Gu
  22105. * MIT Licensed
  22106. */
  22107. var matchHtmlRegExp = /["'&<>]/;
  22108. var escapeHtml_1 = escapeHtml;
  22109. function escapeHtml(string3) {
  22110. var str = "" + string3;
  22111. var match = matchHtmlRegExp.exec(str);
  22112. if (!match) {
  22113. return str;
  22114. }
  22115. var escape;
  22116. var html = "";
  22117. var index = 0;
  22118. var lastIndex = 0;
  22119. for (index = match.index; index < str.length; index++) {
  22120. switch (str.charCodeAt(index)) {
  22121. case 34:
  22122. escape = "&quot;";
  22123. break;
  22124. case 38:
  22125. escape = "&amp;";
  22126. break;
  22127. case 39:
  22128. escape = "&#39;";
  22129. break;
  22130. case 60:
  22131. escape = "&lt;";
  22132. break;
  22133. case 62:
  22134. escape = "&gt;";
  22135. break;
  22136. default:
  22137. continue;
  22138. }
  22139. if (lastIndex !== index) {
  22140. html += str.substring(lastIndex, index);
  22141. }
  22142. lastIndex = index + 1;
  22143. html += escape;
  22144. }
  22145. return lastIndex !== index ? html + str.substring(lastIndex, index) : html;
  22146. }
  22147. const getCell = function(event) {
  22148. let cell = event.target;
  22149. while (cell && cell.tagName.toUpperCase() !== "HTML") {
  22150. if (cell.tagName.toUpperCase() === "TD") {
  22151. return cell;
  22152. }
  22153. cell = cell.parentNode;
  22154. }
  22155. return null;
  22156. };
  22157. const isObject = function(obj) {
  22158. return obj !== null && typeof obj === "object";
  22159. };
  22160. const orderBy = function(array4, sortKey, reverse, sortMethod, sortBy) {
  22161. if (!sortKey && !sortMethod && (!sortBy || Array.isArray(sortBy) && !sortBy.length)) {
  22162. return array4;
  22163. }
  22164. if (typeof reverse === "string") {
  22165. reverse = reverse === "descending" ? -1 : 1;
  22166. } else {
  22167. reverse = reverse && reverse < 0 ? -1 : 1;
  22168. }
  22169. const getKey = sortMethod ? null : function(value, index) {
  22170. if (sortBy) {
  22171. if (!Array.isArray(sortBy)) {
  22172. sortBy = [sortBy];
  22173. }
  22174. return sortBy.map((by) => {
  22175. if (typeof by === "string") {
  22176. return get(value, by);
  22177. } else {
  22178. return by(value, index, array4);
  22179. }
  22180. });
  22181. }
  22182. if (sortKey !== "$key") {
  22183. if (isObject(value) && "$value" in value)
  22184. value = value.$value;
  22185. }
  22186. return [isObject(value) ? get(value, sortKey) : value];
  22187. };
  22188. const compare = function(a2, b2) {
  22189. if (sortMethod) {
  22190. return sortMethod(a2.value, b2.value);
  22191. }
  22192. for (let i = 0, len = a2.key.length; i < len; i++) {
  22193. if (a2.key[i] < b2.key[i]) {
  22194. return -1;
  22195. }
  22196. if (a2.key[i] > b2.key[i]) {
  22197. return 1;
  22198. }
  22199. }
  22200. return 0;
  22201. };
  22202. return array4.map((value, index) => {
  22203. return {
  22204. value,
  22205. index,
  22206. key: getKey ? getKey(value, index) : null
  22207. };
  22208. }).sort((a2, b2) => {
  22209. let order2 = compare(a2, b2);
  22210. if (!order2) {
  22211. order2 = a2.index - b2.index;
  22212. }
  22213. return order2 * +reverse;
  22214. }).map((item) => item.value);
  22215. };
  22216. const getColumnById = function(table, columnId) {
  22217. let column = null;
  22218. table.columns.forEach((item) => {
  22219. if (item.id === columnId) {
  22220. column = item;
  22221. }
  22222. });
  22223. return column;
  22224. };
  22225. const getColumnByKey = function(table, columnKey) {
  22226. let column = null;
  22227. for (let i = 0; i < table.columns.length; i++) {
  22228. const item = table.columns[i];
  22229. if (item.columnKey === columnKey) {
  22230. column = item;
  22231. break;
  22232. }
  22233. }
  22234. return column;
  22235. };
  22236. const getColumnByCell = function(table, cell, namespace) {
  22237. const matches = (cell.className || "").match(new RegExp(`${namespace}-table_[^\\s]+`, "gm"));
  22238. if (matches) {
  22239. return getColumnById(table, matches[0]);
  22240. }
  22241. return null;
  22242. };
  22243. const getRowIdentity = (row, rowKey) => {
  22244. if (!row)
  22245. throw new Error("Row is required when get row identity");
  22246. if (typeof rowKey === "string") {
  22247. if (!rowKey.includes(".")) {
  22248. return `${row[rowKey]}`;
  22249. }
  22250. const key = rowKey.split(".");
  22251. let current = row;
  22252. for (const element of key) {
  22253. current = current[element];
  22254. }
  22255. return `${current}`;
  22256. } else if (typeof rowKey === "function") {
  22257. return rowKey.call(null, row);
  22258. }
  22259. };
  22260. const getKeysMap = function(array4, rowKey) {
  22261. const arrayMap2 = {};
  22262. (array4 || []).forEach((row, index) => {
  22263. arrayMap2[getRowIdentity(row, rowKey)] = { row, index };
  22264. });
  22265. return arrayMap2;
  22266. };
  22267. function mergeOptions(defaults, config) {
  22268. const options = {};
  22269. let key;
  22270. for (key in defaults) {
  22271. options[key] = defaults[key];
  22272. }
  22273. for (key in config) {
  22274. if (hasOwn(config, key)) {
  22275. const value = config[key];
  22276. if (typeof value !== "undefined") {
  22277. options[key] = value;
  22278. }
  22279. }
  22280. }
  22281. return options;
  22282. }
  22283. function parseWidth(width) {
  22284. if (width === "")
  22285. return width;
  22286. if (width !== void 0) {
  22287. width = Number.parseInt(width, 10);
  22288. if (Number.isNaN(width)) {
  22289. width = "";
  22290. }
  22291. }
  22292. return width;
  22293. }
  22294. function parseMinWidth(minWidth) {
  22295. if (minWidth === "")
  22296. return minWidth;
  22297. if (minWidth !== void 0) {
  22298. minWidth = parseWidth(minWidth);
  22299. if (Number.isNaN(minWidth)) {
  22300. minWidth = 80;
  22301. }
  22302. }
  22303. return minWidth;
  22304. }
  22305. function parseHeight(height) {
  22306. if (typeof height === "number") {
  22307. return height;
  22308. }
  22309. if (typeof height === "string") {
  22310. if (/^\d+(?:px)?$/.test(height)) {
  22311. return Number.parseInt(height, 10);
  22312. } else {
  22313. return height;
  22314. }
  22315. }
  22316. return null;
  22317. }
  22318. function compose(...funcs) {
  22319. if (funcs.length === 0) {
  22320. return (arg) => arg;
  22321. }
  22322. if (funcs.length === 1) {
  22323. return funcs[0];
  22324. }
  22325. return funcs.reduce((a2, b2) => (...args) => a2(b2(...args)));
  22326. }
  22327. function toggleRowStatus(statusArr, row, newVal) {
  22328. let changed = false;
  22329. const index = statusArr.indexOf(row);
  22330. const included = index !== -1;
  22331. const addRow = () => {
  22332. statusArr.push(row);
  22333. changed = true;
  22334. };
  22335. const removeRow = () => {
  22336. statusArr.splice(index, 1);
  22337. changed = true;
  22338. };
  22339. if (typeof newVal === "boolean") {
  22340. if (newVal && !included) {
  22341. addRow();
  22342. } else if (!newVal && included) {
  22343. removeRow();
  22344. }
  22345. } else {
  22346. if (included) {
  22347. removeRow();
  22348. } else {
  22349. addRow();
  22350. }
  22351. }
  22352. return changed;
  22353. }
  22354. function walkTreeNode(root2, cb, childrenKey = "children", lazyKey = "hasChildren") {
  22355. const isNil2 = (array4) => !(Array.isArray(array4) && array4.length);
  22356. function _walker(parent, children, level) {
  22357. cb(parent, children, level);
  22358. children.forEach((item) => {
  22359. if (item[lazyKey]) {
  22360. cb(item, null, level + 1);
  22361. return;
  22362. }
  22363. const children2 = item[childrenKey];
  22364. if (!isNil2(children2)) {
  22365. _walker(item, children2, level + 1);
  22366. }
  22367. });
  22368. }
  22369. root2.forEach((item) => {
  22370. if (item[lazyKey]) {
  22371. cb(item, null, 0);
  22372. return;
  22373. }
  22374. const children = item[childrenKey];
  22375. if (!isNil2(children)) {
  22376. _walker(item, children, 0);
  22377. }
  22378. });
  22379. }
  22380. let removePopper;
  22381. function createTablePopper(trigger, popperContent, popperOptions2, tooltipEffect) {
  22382. const { nextZIndex } = useZIndex();
  22383. function renderContent() {
  22384. const isLight = tooltipEffect === "light";
  22385. const content22 = document.createElement("div");
  22386. content22.className = `el-popper ${isLight ? "is-light" : "is-dark"}`;
  22387. popperContent = escapeHtml_1(popperContent);
  22388. content22.innerHTML = popperContent;
  22389. content22.style.zIndex = String(nextZIndex());
  22390. document.body.appendChild(content22);
  22391. return content22;
  22392. }
  22393. function renderArrow() {
  22394. const arrow22 = document.createElement("div");
  22395. arrow22.className = "el-popper__arrow";
  22396. return arrow22;
  22397. }
  22398. function showPopper() {
  22399. popperInstance && popperInstance.update();
  22400. }
  22401. removePopper = function removePopper2() {
  22402. try {
  22403. popperInstance && popperInstance.destroy();
  22404. content2 && document.body.removeChild(content2);
  22405. off(trigger, "mouseenter", showPopper);
  22406. off(trigger, "mouseleave", removePopper2);
  22407. } catch (e) {
  22408. }
  22409. };
  22410. let popperInstance = null;
  22411. const content2 = renderContent();
  22412. const arrow2 = renderArrow();
  22413. content2.appendChild(arrow2);
  22414. popperInstance = createPopper(trigger, content2, __spreadValues({
  22415. modifiers: [
  22416. {
  22417. name: "offset",
  22418. options: {
  22419. offset: [0, 8]
  22420. }
  22421. },
  22422. {
  22423. name: "arrow",
  22424. options: {
  22425. element: arrow2,
  22426. padding: 10
  22427. }
  22428. }
  22429. ]
  22430. }, popperOptions2));
  22431. on(trigger, "mouseenter", showPopper);
  22432. on(trigger, "mouseleave", removePopper);
  22433. return popperInstance;
  22434. }
  22435. const isFixedColumn = (index, fixed, store, realColumns) => {
  22436. let start2 = 0;
  22437. let after = index;
  22438. if (realColumns) {
  22439. if (realColumns[index].colSpan > 1) {
  22440. return {};
  22441. }
  22442. for (let i = 0; i < index; i++) {
  22443. start2 += realColumns[i].colSpan;
  22444. }
  22445. after = start2 + realColumns[index].colSpan - 1;
  22446. } else {
  22447. start2 = index;
  22448. }
  22449. let fixedLayout;
  22450. const columns = store.states.columns;
  22451. switch (fixed) {
  22452. case "left":
  22453. if (after < store.states.fixedLeafColumnsLength.value) {
  22454. fixedLayout = "left";
  22455. }
  22456. break;
  22457. case "right":
  22458. if (start2 >= columns.value.length - store.states.rightFixedLeafColumnsLength.value) {
  22459. fixedLayout = "right";
  22460. }
  22461. break;
  22462. default:
  22463. if (after < store.states.fixedLeafColumnsLength.value) {
  22464. fixedLayout = "left";
  22465. } else if (start2 >= columns.value.length - store.states.rightFixedLeafColumnsLength.value) {
  22466. fixedLayout = "right";
  22467. }
  22468. }
  22469. return fixedLayout ? {
  22470. direction: fixedLayout,
  22471. start: start2,
  22472. after
  22473. } : {};
  22474. };
  22475. const getFixedColumnsClass = (namespace, index, fixed, store, realColumns) => {
  22476. const classes = [];
  22477. const { direction, start: start2 } = isFixedColumn(index, fixed, store, realColumns);
  22478. if (direction) {
  22479. const isLeft = direction === "left";
  22480. classes.push(`${namespace}-fixed-column--${direction}`);
  22481. if (isLeft && start2 === store.states.fixedLeafColumnsLength.value - 1) {
  22482. classes.push("is-last-column");
  22483. } else if (!isLeft && start2 === store.states.columns.value.length - store.states.rightFixedLeafColumnsLength.value) {
  22484. classes.push("is-first-column");
  22485. }
  22486. }
  22487. return classes;
  22488. };
  22489. function getOffset(offset2, column) {
  22490. return offset2 + (column.realWidth === null || Number.isNaN(column.realWidth) ? Number(column.width) : column.realWidth);
  22491. }
  22492. const getFixedColumnOffset = (index, fixed, store, realColumns) => {
  22493. const { direction, start: start2 = 0 } = isFixedColumn(index, fixed, store, realColumns);
  22494. if (!direction) {
  22495. return;
  22496. }
  22497. const styles = {};
  22498. const isLeft = direction === "left";
  22499. const columns = store.states.columns.value;
  22500. if (isLeft) {
  22501. styles.left = columns.slice(0, index).reduce(getOffset, 0);
  22502. } else {
  22503. styles.right = columns.slice(start2 + 1).reverse().reduce(getOffset, 0);
  22504. }
  22505. return styles;
  22506. };
  22507. const ensurePosition = (style, key) => {
  22508. if (!style)
  22509. return;
  22510. if (!Number.isNaN(style[key])) {
  22511. style[key] = `${style[key]}px`;
  22512. }
  22513. };
  22514. function useExpand(watcherData) {
  22515. const instance = getCurrentInstance();
  22516. const defaultExpandAll = ref(false);
  22517. const expandRows = ref([]);
  22518. const updateExpandRows = () => {
  22519. const data2 = watcherData.data.value || [];
  22520. const rowKey = watcherData.rowKey.value;
  22521. if (defaultExpandAll.value) {
  22522. expandRows.value = data2.slice();
  22523. } else if (rowKey) {
  22524. const expandRowsMap = getKeysMap(expandRows.value, rowKey);
  22525. expandRows.value = data2.reduce((prev, row) => {
  22526. const rowId = getRowIdentity(row, rowKey);
  22527. const rowInfo = expandRowsMap[rowId];
  22528. if (rowInfo) {
  22529. prev.push(row);
  22530. }
  22531. return prev;
  22532. }, []);
  22533. } else {
  22534. expandRows.value = [];
  22535. }
  22536. };
  22537. const toggleRowExpansion = (row, expanded) => {
  22538. const changed = toggleRowStatus(expandRows.value, row, expanded);
  22539. if (changed) {
  22540. instance.emit("expand-change", row, expandRows.value.slice());
  22541. }
  22542. };
  22543. const setExpandRowKeys = (rowKeys) => {
  22544. instance.store.assertRowKey();
  22545. const data2 = watcherData.data.value || [];
  22546. const rowKey = watcherData.rowKey.value;
  22547. const keysMap = getKeysMap(data2, rowKey);
  22548. expandRows.value = rowKeys.reduce((prev, cur) => {
  22549. const info = keysMap[cur];
  22550. if (info) {
  22551. prev.push(info.row);
  22552. }
  22553. return prev;
  22554. }, []);
  22555. };
  22556. const isRowExpanded = (row) => {
  22557. const rowKey = watcherData.rowKey.value;
  22558. if (rowKey) {
  22559. const expandMap = getKeysMap(expandRows.value, rowKey);
  22560. return !!expandMap[getRowIdentity(row, rowKey)];
  22561. }
  22562. return expandRows.value.includes(row);
  22563. };
  22564. return {
  22565. updateExpandRows,
  22566. toggleRowExpansion,
  22567. setExpandRowKeys,
  22568. isRowExpanded,
  22569. states: {
  22570. expandRows,
  22571. defaultExpandAll
  22572. }
  22573. };
  22574. }
  22575. function useCurrent(watcherData) {
  22576. const instance = getCurrentInstance();
  22577. const _currentRowKey = ref(null);
  22578. const currentRow = ref(null);
  22579. const setCurrentRowKey = (key) => {
  22580. instance.store.assertRowKey();
  22581. _currentRowKey.value = key;
  22582. setCurrentRowByKey(key);
  22583. };
  22584. const restoreCurrentRowKey = () => {
  22585. _currentRowKey.value = null;
  22586. };
  22587. const setCurrentRowByKey = (key) => {
  22588. const { data: data2, rowKey } = watcherData;
  22589. let _currentRow = null;
  22590. if (rowKey.value) {
  22591. _currentRow = (unref(data2) || []).find((item) => getRowIdentity(item, rowKey.value) === key);
  22592. }
  22593. currentRow.value = _currentRow;
  22594. instance.emit("current-change", currentRow.value, null);
  22595. };
  22596. const updateCurrentRow = (_currentRow) => {
  22597. const oldCurrentRow = currentRow.value;
  22598. if (_currentRow && _currentRow !== oldCurrentRow) {
  22599. currentRow.value = _currentRow;
  22600. instance.emit("current-change", currentRow.value, oldCurrentRow);
  22601. return;
  22602. }
  22603. if (!_currentRow && oldCurrentRow) {
  22604. currentRow.value = null;
  22605. instance.emit("current-change", null, oldCurrentRow);
  22606. }
  22607. };
  22608. const updateCurrentRowData = () => {
  22609. const rowKey = watcherData.rowKey.value;
  22610. const data2 = watcherData.data.value || [];
  22611. const oldCurrentRow = currentRow.value;
  22612. if (!data2.includes(oldCurrentRow) && oldCurrentRow) {
  22613. if (rowKey) {
  22614. const currentRowKey = getRowIdentity(oldCurrentRow, rowKey);
  22615. setCurrentRowByKey(currentRowKey);
  22616. } else {
  22617. currentRow.value = null;
  22618. }
  22619. if (currentRow.value === null) {
  22620. instance.emit("current-change", null, oldCurrentRow);
  22621. }
  22622. } else if (_currentRowKey.value) {
  22623. setCurrentRowByKey(_currentRowKey.value);
  22624. restoreCurrentRowKey();
  22625. }
  22626. };
  22627. return {
  22628. setCurrentRowKey,
  22629. restoreCurrentRowKey,
  22630. setCurrentRowByKey,
  22631. updateCurrentRow,
  22632. updateCurrentRowData,
  22633. states: {
  22634. _currentRowKey,
  22635. currentRow
  22636. }
  22637. };
  22638. }
  22639. function useTree(watcherData) {
  22640. const expandRowKeys = ref([]);
  22641. const treeData = ref({});
  22642. const indent = ref(16);
  22643. const lazy = ref(false);
  22644. const lazyTreeNodeMap = ref({});
  22645. const lazyColumnIdentifier = ref("hasChildren");
  22646. const childrenColumnName = ref("children");
  22647. const instance = getCurrentInstance();
  22648. const normalizedData = computed(() => {
  22649. if (!watcherData.rowKey.value)
  22650. return {};
  22651. const data2 = watcherData.data.value || [];
  22652. return normalize(data2);
  22653. });
  22654. const normalizedLazyNode = computed(() => {
  22655. const rowKey = watcherData.rowKey.value;
  22656. const keys2 = Object.keys(lazyTreeNodeMap.value);
  22657. const res = {};
  22658. if (!keys2.length)
  22659. return res;
  22660. keys2.forEach((key) => {
  22661. if (lazyTreeNodeMap.value[key].length) {
  22662. const item = { children: [] };
  22663. lazyTreeNodeMap.value[key].forEach((row) => {
  22664. const currentRowKey = getRowIdentity(row, rowKey);
  22665. item.children.push(currentRowKey);
  22666. if (row[lazyColumnIdentifier.value] && !res[currentRowKey]) {
  22667. res[currentRowKey] = { children: [] };
  22668. }
  22669. });
  22670. res[key] = item;
  22671. }
  22672. });
  22673. return res;
  22674. });
  22675. const normalize = (data2) => {
  22676. const rowKey = watcherData.rowKey.value;
  22677. const res = {};
  22678. walkTreeNode(data2, (parent, children, level) => {
  22679. const parentId = getRowIdentity(parent, rowKey);
  22680. if (Array.isArray(children)) {
  22681. res[parentId] = {
  22682. children: children.map((row) => getRowIdentity(row, rowKey)),
  22683. level
  22684. };
  22685. } else if (lazy.value) {
  22686. res[parentId] = {
  22687. children: [],
  22688. lazy: true,
  22689. level
  22690. };
  22691. }
  22692. }, childrenColumnName.value, lazyColumnIdentifier.value);
  22693. return res;
  22694. };
  22695. const updateTreeData = (ifChangeExpandRowKeys = false, ifExpandAll = ((_a2) => (_a2 = instance.store) == null ? void 0 : _a2.states.defaultExpandAll.value)()) => {
  22696. var _a2;
  22697. const nested = normalizedData.value;
  22698. const normalizedLazyNode_ = normalizedLazyNode.value;
  22699. const keys2 = Object.keys(nested);
  22700. const newTreeData = {};
  22701. if (keys2.length) {
  22702. const oldTreeData = unref(treeData);
  22703. const rootLazyRowKeys = [];
  22704. const getExpanded = (oldValue, key) => {
  22705. if (ifChangeExpandRowKeys) {
  22706. if (expandRowKeys.value) {
  22707. return ifExpandAll || expandRowKeys.value.includes(key);
  22708. } else {
  22709. return !!(ifExpandAll || (oldValue == null ? void 0 : oldValue.expanded));
  22710. }
  22711. } else {
  22712. const included = ifExpandAll || expandRowKeys.value && expandRowKeys.value.includes(key);
  22713. return !!((oldValue == null ? void 0 : oldValue.expanded) || included);
  22714. }
  22715. };
  22716. keys2.forEach((key) => {
  22717. const oldValue = oldTreeData[key];
  22718. const newValue = __spreadValues({}, nested[key]);
  22719. newValue.expanded = getExpanded(oldValue, key);
  22720. if (newValue.lazy) {
  22721. const { loaded = false, loading: loading2 = false } = oldValue || {};
  22722. newValue.loaded = !!loaded;
  22723. newValue.loading = !!loading2;
  22724. rootLazyRowKeys.push(key);
  22725. }
  22726. newTreeData[key] = newValue;
  22727. });
  22728. const lazyKeys = Object.keys(normalizedLazyNode_);
  22729. if (lazy.value && lazyKeys.length && rootLazyRowKeys.length) {
  22730. lazyKeys.forEach((key) => {
  22731. const oldValue = oldTreeData[key];
  22732. const lazyNodeChildren = normalizedLazyNode_[key].children;
  22733. if (rootLazyRowKeys.includes(key)) {
  22734. if (newTreeData[key].children.length !== 0) {
  22735. throw new Error("[ElTable]children must be an empty array.");
  22736. }
  22737. newTreeData[key].children = lazyNodeChildren;
  22738. } else {
  22739. const { loaded = false, loading: loading2 = false } = oldValue || {};
  22740. newTreeData[key] = {
  22741. lazy: true,
  22742. loaded: !!loaded,
  22743. loading: !!loading2,
  22744. expanded: getExpanded(oldValue, key),
  22745. children: lazyNodeChildren,
  22746. level: ""
  22747. };
  22748. }
  22749. });
  22750. }
  22751. }
  22752. treeData.value = newTreeData;
  22753. (_a2 = instance.store) == null ? void 0 : _a2.updateTableScrollY();
  22754. };
  22755. watch(() => expandRowKeys.value, () => {
  22756. updateTreeData(true);
  22757. });
  22758. watch(() => normalizedData.value, () => {
  22759. updateTreeData();
  22760. });
  22761. watch(() => normalizedLazyNode.value, () => {
  22762. updateTreeData();
  22763. });
  22764. const updateTreeExpandKeys = (value) => {
  22765. expandRowKeys.value = value;
  22766. updateTreeData();
  22767. };
  22768. const toggleTreeExpansion = (row, expanded) => {
  22769. instance.store.assertRowKey();
  22770. const rowKey = watcherData.rowKey.value;
  22771. const id = getRowIdentity(row, rowKey);
  22772. const data2 = id && treeData.value[id];
  22773. if (id && data2 && "expanded" in data2) {
  22774. const oldExpanded = data2.expanded;
  22775. expanded = typeof expanded === "undefined" ? !data2.expanded : expanded;
  22776. treeData.value[id].expanded = expanded;
  22777. if (oldExpanded !== expanded) {
  22778. instance.emit("expand-change", row, expanded);
  22779. }
  22780. instance.store.updateTableScrollY();
  22781. }
  22782. };
  22783. const loadOrToggle = (row) => {
  22784. instance.store.assertRowKey();
  22785. const rowKey = watcherData.rowKey.value;
  22786. const id = getRowIdentity(row, rowKey);
  22787. const data2 = treeData.value[id];
  22788. if (lazy.value && data2 && "loaded" in data2 && !data2.loaded) {
  22789. loadData(row, id, data2);
  22790. } else {
  22791. toggleTreeExpansion(row, void 0);
  22792. }
  22793. };
  22794. const loadData = (row, key, treeNode) => {
  22795. const { load } = instance.props;
  22796. if (load && !treeData.value[key].loaded) {
  22797. treeData.value[key].loading = true;
  22798. load(row, treeNode, (data2) => {
  22799. if (!Array.isArray(data2)) {
  22800. throw new TypeError("[ElTable] data must be an array");
  22801. }
  22802. treeData.value[key].loading = false;
  22803. treeData.value[key].loaded = true;
  22804. treeData.value[key].expanded = true;
  22805. if (data2.length) {
  22806. lazyTreeNodeMap.value[key] = data2;
  22807. }
  22808. instance.emit("expand-change", row, true);
  22809. });
  22810. }
  22811. };
  22812. return {
  22813. loadData,
  22814. loadOrToggle,
  22815. toggleTreeExpansion,
  22816. updateTreeExpandKeys,
  22817. updateTreeData,
  22818. normalize,
  22819. states: {
  22820. expandRowKeys,
  22821. treeData,
  22822. indent,
  22823. lazy,
  22824. lazyTreeNodeMap,
  22825. lazyColumnIdentifier,
  22826. childrenColumnName
  22827. }
  22828. };
  22829. }
  22830. const sortData = (data2, states) => {
  22831. const sortingColumn = states.sortingColumn;
  22832. if (!sortingColumn || typeof sortingColumn.sortable === "string") {
  22833. return data2;
  22834. }
  22835. return orderBy(data2, states.sortProp, states.sortOrder, sortingColumn.sortMethod, sortingColumn.sortBy);
  22836. };
  22837. const doFlattenColumns = (columns) => {
  22838. const result = [];
  22839. columns.forEach((column) => {
  22840. if (column.children) {
  22841. result.push.apply(result, doFlattenColumns(column.children));
  22842. } else {
  22843. result.push(column);
  22844. }
  22845. });
  22846. return result;
  22847. };
  22848. function useWatcher$1() {
  22849. var _a2;
  22850. const instance = getCurrentInstance();
  22851. const { size: tableSize } = toRefs((_a2 = instance.proxy) == null ? void 0 : _a2.$props);
  22852. const rowKey = ref(null);
  22853. const data2 = ref([]);
  22854. const _data = ref([]);
  22855. const isComplex = ref(false);
  22856. const _columns = ref([]);
  22857. const originColumns = ref([]);
  22858. const columns = ref([]);
  22859. const fixedColumns = ref([]);
  22860. const rightFixedColumns = ref([]);
  22861. const leafColumns = ref([]);
  22862. const fixedLeafColumns = ref([]);
  22863. const rightFixedLeafColumns = ref([]);
  22864. const leafColumnsLength = ref(0);
  22865. const fixedLeafColumnsLength = ref(0);
  22866. const rightFixedLeafColumnsLength = ref(0);
  22867. const isAllSelected = ref(false);
  22868. const selection = ref([]);
  22869. const reserveSelection = ref(false);
  22870. const selectOnIndeterminate = ref(false);
  22871. const selectable = ref(null);
  22872. const filters = ref({});
  22873. const filteredData = ref(null);
  22874. const sortingColumn = ref(null);
  22875. const sortProp = ref(null);
  22876. const sortOrder = ref(null);
  22877. const hoverRow = ref(null);
  22878. watch(data2, () => instance.state && scheduleLayout(false), {
  22879. deep: true
  22880. });
  22881. const assertRowKey = () => {
  22882. if (!rowKey.value)
  22883. throw new Error("[ElTable] prop row-key is required");
  22884. };
  22885. const updateColumns = () => {
  22886. fixedColumns.value = _columns.value.filter((column) => column.fixed === true || column.fixed === "left");
  22887. rightFixedColumns.value = _columns.value.filter((column) => column.fixed === "right");
  22888. if (fixedColumns.value.length > 0 && _columns.value[0] && _columns.value[0].type === "selection" && !_columns.value[0].fixed) {
  22889. _columns.value[0].fixed = true;
  22890. fixedColumns.value.unshift(_columns.value[0]);
  22891. }
  22892. const notFixedColumns = _columns.value.filter((column) => !column.fixed);
  22893. originColumns.value = [].concat(fixedColumns.value).concat(notFixedColumns).concat(rightFixedColumns.value);
  22894. const leafColumns2 = doFlattenColumns(notFixedColumns);
  22895. const fixedLeafColumns2 = doFlattenColumns(fixedColumns.value);
  22896. const rightFixedLeafColumns2 = doFlattenColumns(rightFixedColumns.value);
  22897. leafColumnsLength.value = leafColumns2.length;
  22898. fixedLeafColumnsLength.value = fixedLeafColumns2.length;
  22899. rightFixedLeafColumnsLength.value = rightFixedLeafColumns2.length;
  22900. columns.value = [].concat(fixedLeafColumns2).concat(leafColumns2).concat(rightFixedLeafColumns2);
  22901. isComplex.value = fixedColumns.value.length > 0 || rightFixedColumns.value.length > 0;
  22902. };
  22903. const scheduleLayout = (needUpdateColumns, immediate = false) => {
  22904. if (needUpdateColumns) {
  22905. updateColumns();
  22906. }
  22907. if (immediate) {
  22908. instance.state.doLayout();
  22909. } else {
  22910. instance.state.debouncedUpdateLayout();
  22911. }
  22912. };
  22913. const isSelected = (row) => {
  22914. return selection.value.includes(row);
  22915. };
  22916. const clearSelection = () => {
  22917. isAllSelected.value = false;
  22918. const oldSelection = selection.value;
  22919. if (oldSelection.length) {
  22920. selection.value = [];
  22921. instance.emit("selection-change", []);
  22922. }
  22923. };
  22924. const cleanSelection = () => {
  22925. let deleted;
  22926. if (rowKey.value) {
  22927. deleted = [];
  22928. const selectedMap = getKeysMap(selection.value, rowKey.value);
  22929. const dataMap = getKeysMap(data2.value, rowKey.value);
  22930. for (const key in selectedMap) {
  22931. if (hasOwn(selectedMap, key) && !dataMap[key]) {
  22932. deleted.push(selectedMap[key].row);
  22933. }
  22934. }
  22935. } else {
  22936. deleted = selection.value.filter((item) => !data2.value.includes(item));
  22937. }
  22938. if (deleted.length) {
  22939. const newSelection = selection.value.filter((item) => !deleted.includes(item));
  22940. selection.value = newSelection;
  22941. instance.emit("selection-change", newSelection.slice());
  22942. }
  22943. };
  22944. const getSelectionRows = () => {
  22945. return (selection.value || []).slice();
  22946. };
  22947. const toggleRowSelection = (row, selected = void 0, emitChange = true) => {
  22948. const changed = toggleRowStatus(selection.value, row, selected);
  22949. if (changed) {
  22950. const newSelection = (selection.value || []).slice();
  22951. if (emitChange) {
  22952. instance.emit("select", newSelection, row);
  22953. }
  22954. instance.emit("selection-change", newSelection);
  22955. }
  22956. };
  22957. const _toggleAllSelection = () => {
  22958. var _a22, _b2;
  22959. const value = selectOnIndeterminate.value ? !isAllSelected.value : !(isAllSelected.value || selection.value.length);
  22960. isAllSelected.value = value;
  22961. let selectionChanged = false;
  22962. let childrenCount = 0;
  22963. const rowKey2 = (_b2 = (_a22 = instance == null ? void 0 : instance.store) == null ? void 0 : _a22.states) == null ? void 0 : _b2.rowKey.value;
  22964. data2.value.forEach((row, index) => {
  22965. const rowIndex = index + childrenCount;
  22966. if (selectable.value) {
  22967. if (selectable.value.call(null, row, rowIndex) && toggleRowStatus(selection.value, row, value)) {
  22968. selectionChanged = true;
  22969. }
  22970. } else {
  22971. if (toggleRowStatus(selection.value, row, value)) {
  22972. selectionChanged = true;
  22973. }
  22974. }
  22975. childrenCount += getChildrenCount(getRowIdentity(row, rowKey2));
  22976. });
  22977. if (selectionChanged) {
  22978. instance.emit("selection-change", selection.value ? selection.value.slice() : []);
  22979. }
  22980. instance.emit("select-all", selection.value);
  22981. };
  22982. const updateSelectionByRowKey = () => {
  22983. const selectedMap = getKeysMap(selection.value, rowKey.value);
  22984. data2.value.forEach((row) => {
  22985. const rowId = getRowIdentity(row, rowKey.value);
  22986. const rowInfo = selectedMap[rowId];
  22987. if (rowInfo) {
  22988. selection.value[rowInfo.index] = row;
  22989. }
  22990. });
  22991. };
  22992. const updateAllSelected = () => {
  22993. var _a22, _b2, _c;
  22994. if (((_a22 = data2.value) == null ? void 0 : _a22.length) === 0) {
  22995. isAllSelected.value = false;
  22996. return;
  22997. }
  22998. let selectedMap;
  22999. if (rowKey.value) {
  23000. selectedMap = getKeysMap(selection.value, rowKey.value);
  23001. }
  23002. const isSelected2 = function(row) {
  23003. if (selectedMap) {
  23004. return !!selectedMap[getRowIdentity(row, rowKey.value)];
  23005. } else {
  23006. return selection.value.includes(row);
  23007. }
  23008. };
  23009. let isAllSelected_ = true;
  23010. let selectedCount = 0;
  23011. let childrenCount = 0;
  23012. for (let i = 0, j = (data2.value || []).length; i < j; i++) {
  23013. const keyProp = (_c = (_b2 = instance == null ? void 0 : instance.store) == null ? void 0 : _b2.states) == null ? void 0 : _c.rowKey.value;
  23014. const rowIndex = i + childrenCount;
  23015. const item = data2.value[i];
  23016. const isRowSelectable = selectable.value && selectable.value.call(null, item, rowIndex);
  23017. if (!isSelected2(item)) {
  23018. if (!selectable.value || isRowSelectable) {
  23019. isAllSelected_ = false;
  23020. break;
  23021. }
  23022. } else {
  23023. selectedCount++;
  23024. }
  23025. childrenCount += getChildrenCount(getRowIdentity(item, keyProp));
  23026. }
  23027. if (selectedCount === 0)
  23028. isAllSelected_ = false;
  23029. isAllSelected.value = isAllSelected_;
  23030. };
  23031. const getChildrenCount = (rowKey2) => {
  23032. var _a22;
  23033. if (!instance || !instance.store)
  23034. return 0;
  23035. const { treeData } = instance.store.states;
  23036. let count = 0;
  23037. const children = (_a22 = treeData.value[rowKey2]) == null ? void 0 : _a22.children;
  23038. if (children) {
  23039. count += children.length;
  23040. children.forEach((childKey) => {
  23041. count += getChildrenCount(childKey);
  23042. });
  23043. }
  23044. return count;
  23045. };
  23046. const updateFilters = (columns2, values) => {
  23047. if (!Array.isArray(columns2)) {
  23048. columns2 = [columns2];
  23049. }
  23050. const filters_ = {};
  23051. columns2.forEach((col) => {
  23052. filters.value[col.id] = values;
  23053. filters_[col.columnKey || col.id] = values;
  23054. });
  23055. return filters_;
  23056. };
  23057. const updateSort = (column, prop, order2) => {
  23058. if (sortingColumn.value && sortingColumn.value !== column) {
  23059. sortingColumn.value.order = null;
  23060. }
  23061. sortingColumn.value = column;
  23062. sortProp.value = prop;
  23063. sortOrder.value = order2;
  23064. };
  23065. const execFilter = () => {
  23066. let sourceData = unref(_data);
  23067. Object.keys(filters.value).forEach((columnId) => {
  23068. const values = filters.value[columnId];
  23069. if (!values || values.length === 0)
  23070. return;
  23071. const column = getColumnById({
  23072. columns: columns.value
  23073. }, columnId);
  23074. if (column && column.filterMethod) {
  23075. sourceData = sourceData.filter((row) => {
  23076. return values.some((value) => column.filterMethod.call(null, value, row, column));
  23077. });
  23078. }
  23079. });
  23080. filteredData.value = sourceData;
  23081. };
  23082. const execSort = () => {
  23083. data2.value = sortData(filteredData.value, {
  23084. sortingColumn: sortingColumn.value,
  23085. sortProp: sortProp.value,
  23086. sortOrder: sortOrder.value
  23087. });
  23088. };
  23089. const execQuery = (ignore = void 0) => {
  23090. if (!(ignore && ignore.filter)) {
  23091. execFilter();
  23092. }
  23093. execSort();
  23094. };
  23095. const clearFilter = (columnKeys) => {
  23096. const { tableHeaderRef } = instance.refs;
  23097. if (!tableHeaderRef)
  23098. return;
  23099. const panels = Object.assign({}, tableHeaderRef.filterPanels);
  23100. const keys2 = Object.keys(panels);
  23101. if (!keys2.length)
  23102. return;
  23103. if (typeof columnKeys === "string") {
  23104. columnKeys = [columnKeys];
  23105. }
  23106. if (Array.isArray(columnKeys)) {
  23107. const columns_ = columnKeys.map((key) => getColumnByKey({
  23108. columns: columns.value
  23109. }, key));
  23110. keys2.forEach((key) => {
  23111. const column = columns_.find((col) => col.id === key);
  23112. if (column) {
  23113. column.filteredValue = [];
  23114. }
  23115. });
  23116. instance.store.commit("filterChange", {
  23117. column: columns_,
  23118. values: [],
  23119. silent: true,
  23120. multi: true
  23121. });
  23122. } else {
  23123. keys2.forEach((key) => {
  23124. const column = columns.value.find((col) => col.id === key);
  23125. if (column) {
  23126. column.filteredValue = [];
  23127. }
  23128. });
  23129. filters.value = {};
  23130. instance.store.commit("filterChange", {
  23131. column: {},
  23132. values: [],
  23133. silent: true
  23134. });
  23135. }
  23136. };
  23137. const clearSort = () => {
  23138. if (!sortingColumn.value)
  23139. return;
  23140. updateSort(null, null, null);
  23141. instance.store.commit("changeSortCondition", {
  23142. silent: true
  23143. });
  23144. };
  23145. const {
  23146. setExpandRowKeys,
  23147. toggleRowExpansion,
  23148. updateExpandRows,
  23149. states: expandStates,
  23150. isRowExpanded
  23151. } = useExpand({
  23152. data: data2,
  23153. rowKey
  23154. });
  23155. const {
  23156. updateTreeExpandKeys,
  23157. toggleTreeExpansion,
  23158. updateTreeData,
  23159. loadOrToggle,
  23160. states: treeStates
  23161. } = useTree({
  23162. data: data2,
  23163. rowKey
  23164. });
  23165. const {
  23166. updateCurrentRowData,
  23167. updateCurrentRow,
  23168. setCurrentRowKey,
  23169. states: currentData
  23170. } = useCurrent({
  23171. data: data2,
  23172. rowKey
  23173. });
  23174. const setExpandRowKeysAdapter = (val) => {
  23175. setExpandRowKeys(val);
  23176. updateTreeExpandKeys(val);
  23177. };
  23178. const toggleRowExpansionAdapter = (row, expanded) => {
  23179. const hasExpandColumn = columns.value.some(({ type: type4 }) => type4 === "expand");
  23180. if (hasExpandColumn) {
  23181. toggleRowExpansion(row, expanded);
  23182. } else {
  23183. toggleTreeExpansion(row, expanded);
  23184. }
  23185. };
  23186. return {
  23187. assertRowKey,
  23188. updateColumns,
  23189. scheduleLayout,
  23190. isSelected,
  23191. clearSelection,
  23192. cleanSelection,
  23193. getSelectionRows,
  23194. toggleRowSelection,
  23195. _toggleAllSelection,
  23196. toggleAllSelection: null,
  23197. updateSelectionByRowKey,
  23198. updateAllSelected,
  23199. updateFilters,
  23200. updateCurrentRow,
  23201. updateSort,
  23202. execFilter,
  23203. execSort,
  23204. execQuery,
  23205. clearFilter,
  23206. clearSort,
  23207. toggleRowExpansion,
  23208. setExpandRowKeysAdapter,
  23209. setCurrentRowKey,
  23210. toggleRowExpansionAdapter,
  23211. isRowExpanded,
  23212. updateExpandRows,
  23213. updateCurrentRowData,
  23214. loadOrToggle,
  23215. updateTreeData,
  23216. states: __spreadValues(__spreadValues(__spreadValues({
  23217. tableSize,
  23218. rowKey,
  23219. data: data2,
  23220. _data,
  23221. isComplex,
  23222. _columns,
  23223. originColumns,
  23224. columns,
  23225. fixedColumns,
  23226. rightFixedColumns,
  23227. leafColumns,
  23228. fixedLeafColumns,
  23229. rightFixedLeafColumns,
  23230. leafColumnsLength,
  23231. fixedLeafColumnsLength,
  23232. rightFixedLeafColumnsLength,
  23233. isAllSelected,
  23234. selection,
  23235. reserveSelection,
  23236. selectOnIndeterminate,
  23237. selectable,
  23238. filters,
  23239. filteredData,
  23240. sortingColumn,
  23241. sortProp,
  23242. sortOrder,
  23243. hoverRow
  23244. }, expandStates), treeStates), currentData)
  23245. };
  23246. }
  23247. function replaceColumn(array4, column) {
  23248. return array4.map((item) => {
  23249. var _a2;
  23250. if (item.id === column.id) {
  23251. return column;
  23252. } else if ((_a2 = item.children) == null ? void 0 : _a2.length) {
  23253. item.children = replaceColumn(item.children, column);
  23254. }
  23255. return item;
  23256. });
  23257. }
  23258. function sortColumn(array4) {
  23259. array4.forEach((item) => {
  23260. var _a2, _b2;
  23261. item.no = (_a2 = item.getColumnIndex) == null ? void 0 : _a2.call(item);
  23262. if ((_b2 = item.children) == null ? void 0 : _b2.length) {
  23263. sortColumn(item.children);
  23264. }
  23265. });
  23266. array4.sort((cur, pre) => cur.no - pre.no);
  23267. }
  23268. function useStore() {
  23269. const instance = getCurrentInstance();
  23270. const watcher = useWatcher$1();
  23271. const ns = useNamespace("table");
  23272. const mutations = {
  23273. setData(states, data2) {
  23274. const dataInstanceChanged = unref(states._data) !== data2;
  23275. states.data.value = data2;
  23276. states._data.value = data2;
  23277. instance.store.execQuery();
  23278. instance.store.updateCurrentRowData();
  23279. instance.store.updateExpandRows();
  23280. instance.store.updateTreeData(instance.store.states.defaultExpandAll.value);
  23281. if (unref(states.reserveSelection)) {
  23282. instance.store.assertRowKey();
  23283. instance.store.updateSelectionByRowKey();
  23284. } else {
  23285. if (dataInstanceChanged) {
  23286. instance.store.clearSelection();
  23287. } else {
  23288. instance.store.cleanSelection();
  23289. }
  23290. }
  23291. instance.store.updateAllSelected();
  23292. if (instance.$ready) {
  23293. instance.store.scheduleLayout();
  23294. }
  23295. },
  23296. insertColumn(states, column, parent) {
  23297. const array4 = unref(states._columns);
  23298. let newColumns = [];
  23299. if (!parent) {
  23300. array4.push(column);
  23301. newColumns = array4;
  23302. } else {
  23303. if (parent && !parent.children) {
  23304. parent.children = [];
  23305. }
  23306. parent.children.push(column);
  23307. newColumns = replaceColumn(array4, parent);
  23308. }
  23309. sortColumn(newColumns);
  23310. states._columns.value = newColumns;
  23311. if (column.type === "selection") {
  23312. states.selectable.value = column.selectable;
  23313. states.reserveSelection.value = column.reserveSelection;
  23314. }
  23315. if (instance.$ready) {
  23316. instance.store.updateColumns();
  23317. instance.store.scheduleLayout();
  23318. }
  23319. },
  23320. removeColumn(states, column, parent) {
  23321. const array4 = unref(states._columns) || [];
  23322. if (parent) {
  23323. parent.children.splice(parent.children.findIndex((item) => item.id === column.id), 1);
  23324. if (parent.children.length === 0) {
  23325. delete parent.children;
  23326. }
  23327. states._columns.value = replaceColumn(array4, parent);
  23328. } else {
  23329. const index = array4.indexOf(column);
  23330. if (index > -1) {
  23331. array4.splice(index, 1);
  23332. states._columns.value = array4;
  23333. }
  23334. }
  23335. if (instance.$ready) {
  23336. instance.store.updateColumns();
  23337. instance.store.scheduleLayout();
  23338. }
  23339. },
  23340. sort(states, options) {
  23341. const { prop, order: order2, init } = options;
  23342. if (prop) {
  23343. const column = unref(states.columns).find((column2) => column2.property === prop);
  23344. if (column) {
  23345. column.order = order2;
  23346. instance.store.updateSort(column, prop, order2);
  23347. instance.store.commit("changeSortCondition", { init });
  23348. }
  23349. }
  23350. },
  23351. changeSortCondition(states, options) {
  23352. const { sortingColumn: column, sortProp: prop, sortOrder: order2 } = states;
  23353. if (unref(order2) === null) {
  23354. states.sortingColumn.value = null;
  23355. states.sortProp.value = null;
  23356. }
  23357. const ingore = { filter: true };
  23358. instance.store.execQuery(ingore);
  23359. if (!options || !(options.silent || options.init)) {
  23360. instance.emit("sort-change", {
  23361. column: unref(column),
  23362. prop: unref(prop),
  23363. order: unref(order2)
  23364. });
  23365. }
  23366. instance.store.updateTableScrollY();
  23367. },
  23368. filterChange(_states, options) {
  23369. const { column, values, silent } = options;
  23370. const newFilters = instance.store.updateFilters(column, values);
  23371. instance.store.execQuery();
  23372. if (!silent) {
  23373. instance.emit("filter-change", newFilters);
  23374. }
  23375. instance.store.updateTableScrollY();
  23376. },
  23377. toggleAllSelection() {
  23378. instance.store.toggleAllSelection();
  23379. },
  23380. rowSelectedChanged(_states, row) {
  23381. instance.store.toggleRowSelection(row);
  23382. instance.store.updateAllSelected();
  23383. },
  23384. setHoverRow(states, row) {
  23385. states.hoverRow.value = row;
  23386. },
  23387. setCurrentRow(_states, row) {
  23388. instance.store.updateCurrentRow(row);
  23389. }
  23390. };
  23391. const commit = function(name, ...args) {
  23392. const mutations2 = instance.store.mutations;
  23393. if (mutations2[name]) {
  23394. mutations2[name].apply(instance, [instance.store.states].concat(args));
  23395. } else {
  23396. throw new Error(`Action not found: ${name}`);
  23397. }
  23398. };
  23399. const updateTableScrollY = function() {
  23400. nextTick(() => instance.layout.updateScrollY.apply(instance.layout));
  23401. };
  23402. return __spreadProps(__spreadValues({
  23403. ns
  23404. }, watcher), {
  23405. mutations,
  23406. commit,
  23407. updateTableScrollY
  23408. });
  23409. }
  23410. const InitialStateMap = {
  23411. rowKey: "rowKey",
  23412. defaultExpandAll: "defaultExpandAll",
  23413. selectOnIndeterminate: "selectOnIndeterminate",
  23414. indent: "indent",
  23415. lazy: "lazy",
  23416. data: "data",
  23417. ["treeProps.hasChildren"]: {
  23418. key: "lazyColumnIdentifier",
  23419. default: "hasChildren"
  23420. },
  23421. ["treeProps.children"]: {
  23422. key: "childrenColumnName",
  23423. default: "children"
  23424. }
  23425. };
  23426. function createStore(table, props) {
  23427. if (!table) {
  23428. throw new Error("Table is required.");
  23429. }
  23430. const store = useStore();
  23431. store.toggleAllSelection = debounce$1(store._toggleAllSelection, 10);
  23432. Object.keys(InitialStateMap).forEach((key) => {
  23433. handleValue(getArrKeysValue(props, key), key, store);
  23434. });
  23435. proxyTableProps(store, props);
  23436. return store;
  23437. }
  23438. function proxyTableProps(store, props) {
  23439. Object.keys(InitialStateMap).forEach((key) => {
  23440. watch(() => getArrKeysValue(props, key), (value) => {
  23441. handleValue(value, key, store);
  23442. });
  23443. });
  23444. }
  23445. function handleValue(value, propsKey, store) {
  23446. let newVal = value;
  23447. let storeKey = InitialStateMap[propsKey];
  23448. if (typeof InitialStateMap[propsKey] === "object") {
  23449. storeKey = storeKey.key;
  23450. newVal = newVal || InitialStateMap[propsKey].default;
  23451. }
  23452. store.states[storeKey].value = newVal;
  23453. }
  23454. function getArrKeysValue(props, keys2) {
  23455. if (keys2.includes(".")) {
  23456. const keyList = keys2.split(".");
  23457. let value = props;
  23458. keyList.forEach((key) => {
  23459. value = value[key];
  23460. });
  23461. return value;
  23462. } else {
  23463. return props[keys2];
  23464. }
  23465. }
  23466. class TableLayout {
  23467. constructor(options) {
  23468. this.observers = [];
  23469. this.table = null;
  23470. this.store = null;
  23471. this.columns = [];
  23472. this.fit = true;
  23473. this.showHeader = true;
  23474. this.height = ref(null);
  23475. this.scrollX = ref(false);
  23476. this.scrollY = ref(false);
  23477. this.bodyWidth = ref(null);
  23478. this.fixedWidth = ref(null);
  23479. this.rightFixedWidth = ref(null);
  23480. this.tableHeight = ref(null);
  23481. this.headerHeight = ref(44);
  23482. this.appendHeight = ref(0);
  23483. this.footerHeight = ref(44);
  23484. this.viewportHeight = ref(null);
  23485. this.bodyHeight = ref(null);
  23486. this.bodyScrollHeight = ref(0);
  23487. this.fixedBodyHeight = ref(null);
  23488. this.gutterWidth = 0;
  23489. for (const name in options) {
  23490. if (hasOwn(options, name)) {
  23491. if (isRef(this[name])) {
  23492. this[name].value = options[name];
  23493. } else {
  23494. this[name] = options[name];
  23495. }
  23496. }
  23497. }
  23498. if (!this.table) {
  23499. throw new Error("Table is required for Table Layout");
  23500. }
  23501. if (!this.store) {
  23502. throw new Error("Store is required for Table Layout");
  23503. }
  23504. }
  23505. updateScrollY() {
  23506. const height = this.height.value;
  23507. if (height === null)
  23508. return false;
  23509. const bodyWrapper = this.table.refs.bodyWrapper;
  23510. if (this.table.vnode.el && bodyWrapper) {
  23511. let scrollY = true;
  23512. const prevScrollY = this.scrollY.value;
  23513. if (this.bodyHeight.value === null) {
  23514. scrollY = false;
  23515. } else {
  23516. scrollY = bodyWrapper.scrollHeight > this.bodyHeight.value;
  23517. }
  23518. this.scrollY.value = scrollY;
  23519. return prevScrollY !== scrollY;
  23520. }
  23521. return false;
  23522. }
  23523. setHeight(value, prop = "height") {
  23524. if (!isClient$1)
  23525. return;
  23526. const el = this.table.vnode.el;
  23527. value = parseHeight(value);
  23528. this.height.value = Number(value);
  23529. if (!el && (value || value === 0))
  23530. return nextTick(() => this.setHeight(value, prop));
  23531. if (typeof value === "number") {
  23532. el.style[prop] = `${value}px`;
  23533. this.updateElsHeight();
  23534. } else if (typeof value === "string") {
  23535. el.style[prop] = value;
  23536. this.updateElsHeight();
  23537. }
  23538. }
  23539. setMaxHeight(value) {
  23540. this.setHeight(value, "max-height");
  23541. }
  23542. getFlattenColumns() {
  23543. const flattenColumns = [];
  23544. const columns = this.table.store.states.columns.value;
  23545. columns.forEach((column) => {
  23546. if (column.isColumnGroup) {
  23547. flattenColumns.push.apply(flattenColumns, column.columns);
  23548. } else {
  23549. flattenColumns.push(column);
  23550. }
  23551. });
  23552. return flattenColumns;
  23553. }
  23554. updateElsHeight() {
  23555. var _a2, _b2;
  23556. if (!this.table.$ready)
  23557. return nextTick(() => this.updateElsHeight());
  23558. const {
  23559. tableWrapper,
  23560. headerWrapper,
  23561. appendWrapper,
  23562. footerWrapper,
  23563. tableHeader,
  23564. tableBody
  23565. } = this.table.refs;
  23566. if (tableWrapper && tableWrapper.style.display === "none") {
  23567. return;
  23568. }
  23569. const { tableLayout } = this.table.props;
  23570. this.appendHeight.value = appendWrapper ? appendWrapper.offsetHeight : 0;
  23571. if (this.showHeader && !headerWrapper && tableLayout === "fixed") {
  23572. return;
  23573. }
  23574. const headerTrElm = tableHeader ? tableHeader : null;
  23575. const noneHeader = this.headerDisplayNone(headerTrElm);
  23576. const headerWrapperOffsetHeight = (headerWrapper == null ? void 0 : headerWrapper.offsetHeight) || 0;
  23577. const headerHeight = this.headerHeight.value = !this.showHeader ? 0 : headerWrapperOffsetHeight;
  23578. if (this.showHeader && !noneHeader && headerWrapperOffsetHeight > 0 && (this.table.store.states.columns.value || []).length > 0 && headerHeight < 2) {
  23579. return nextTick(() => this.updateElsHeight());
  23580. }
  23581. const tableHeight = this.tableHeight.value = (_b2 = (_a2 = this.table) == null ? void 0 : _a2.vnode.el) == null ? void 0 : _b2.clientHeight;
  23582. const footerHeight = this.footerHeight.value = footerWrapper ? footerWrapper.offsetHeight : 0;
  23583. if (this.height.value !== null) {
  23584. if (this.bodyHeight.value === null) {
  23585. requestAnimationFrame(() => this.updateElsHeight());
  23586. }
  23587. this.bodyHeight.value = tableHeight - headerHeight - footerHeight + (footerWrapper ? 1 : 0);
  23588. this.bodyScrollHeight.value = tableBody == null ? void 0 : tableBody.scrollHeight;
  23589. }
  23590. this.fixedBodyHeight.value = this.scrollX.value ? this.bodyHeight.value - this.gutterWidth : this.bodyHeight.value;
  23591. this.viewportHeight.value = this.scrollX.value ? tableHeight - this.gutterWidth : tableHeight;
  23592. this.updateScrollY();
  23593. this.notifyObservers("scrollable");
  23594. }
  23595. headerDisplayNone(elm) {
  23596. if (!elm)
  23597. return true;
  23598. let headerChild = elm;
  23599. while (headerChild.tagName !== "DIV") {
  23600. if (getComputedStyle(headerChild).display === "none") {
  23601. return true;
  23602. }
  23603. headerChild = headerChild.parentElement;
  23604. }
  23605. return false;
  23606. }
  23607. updateColumnsWidth() {
  23608. if (!isClient$1)
  23609. return;
  23610. const fit = this.fit;
  23611. const bodyWidth = this.table.vnode.el.clientWidth;
  23612. let bodyMinWidth = 0;
  23613. const flattenColumns = this.getFlattenColumns();
  23614. const flexColumns = flattenColumns.filter((column) => typeof column.width !== "number");
  23615. flattenColumns.forEach((column) => {
  23616. if (typeof column.width === "number" && column.realWidth)
  23617. column.realWidth = null;
  23618. });
  23619. if (flexColumns.length > 0 && fit) {
  23620. flattenColumns.forEach((column) => {
  23621. bodyMinWidth += Number(column.width || column.minWidth || 80);
  23622. });
  23623. if (bodyMinWidth <= bodyWidth) {
  23624. this.scrollX.value = false;
  23625. const totalFlexWidth = bodyWidth - bodyMinWidth;
  23626. if (flexColumns.length === 1) {
  23627. flexColumns[0].realWidth = Number(flexColumns[0].minWidth || 80) + totalFlexWidth;
  23628. } else {
  23629. const allColumnsWidth = flexColumns.reduce((prev, column) => prev + Number(column.minWidth || 80), 0);
  23630. const flexWidthPerPixel = totalFlexWidth / allColumnsWidth;
  23631. let noneFirstWidth = 0;
  23632. flexColumns.forEach((column, index) => {
  23633. if (index === 0)
  23634. return;
  23635. const flexWidth = Math.floor(Number(column.minWidth || 80) * flexWidthPerPixel);
  23636. noneFirstWidth += flexWidth;
  23637. column.realWidth = Number(column.minWidth || 80) + flexWidth;
  23638. });
  23639. flexColumns[0].realWidth = Number(flexColumns[0].minWidth || 80) + totalFlexWidth - noneFirstWidth;
  23640. }
  23641. } else {
  23642. this.scrollX.value = true;
  23643. flexColumns.forEach((column) => {
  23644. column.realWidth = Number(column.minWidth);
  23645. });
  23646. }
  23647. this.bodyWidth.value = Math.max(bodyMinWidth, bodyWidth);
  23648. this.table.state.resizeState.value.width = this.bodyWidth.value;
  23649. } else {
  23650. flattenColumns.forEach((column) => {
  23651. if (!column.width && !column.minWidth) {
  23652. column.realWidth = 80;
  23653. } else {
  23654. column.realWidth = Number(column.width || column.minWidth);
  23655. }
  23656. bodyMinWidth += column.realWidth;
  23657. });
  23658. this.scrollX.value = bodyMinWidth > bodyWidth;
  23659. this.bodyWidth.value = bodyMinWidth;
  23660. }
  23661. const fixedColumns = this.store.states.fixedColumns.value;
  23662. if (fixedColumns.length > 0) {
  23663. let fixedWidth = 0;
  23664. fixedColumns.forEach((column) => {
  23665. fixedWidth += Number(column.realWidth || column.width);
  23666. });
  23667. this.fixedWidth.value = fixedWidth;
  23668. }
  23669. const rightFixedColumns = this.store.states.rightFixedColumns.value;
  23670. if (rightFixedColumns.length > 0) {
  23671. let rightFixedWidth = 0;
  23672. rightFixedColumns.forEach((column) => {
  23673. rightFixedWidth += Number(column.realWidth || column.width);
  23674. });
  23675. this.rightFixedWidth.value = rightFixedWidth;
  23676. }
  23677. this.notifyObservers("columns");
  23678. }
  23679. addObserver(observer) {
  23680. this.observers.push(observer);
  23681. }
  23682. removeObserver(observer) {
  23683. const index = this.observers.indexOf(observer);
  23684. if (index !== -1) {
  23685. this.observers.splice(index, 1);
  23686. }
  23687. }
  23688. notifyObservers(event) {
  23689. const observers = this.observers;
  23690. observers.forEach((observer) => {
  23691. var _a2, _b2;
  23692. switch (event) {
  23693. case "columns":
  23694. (_a2 = observer.state) == null ? void 0 : _a2.onColumnsChange(this);
  23695. break;
  23696. case "scrollable":
  23697. (_b2 = observer.state) == null ? void 0 : _b2.onScrollableChange(this);
  23698. break;
  23699. default:
  23700. throw new Error(`Table Layout don't have event ${event}.`);
  23701. }
  23702. });
  23703. }
  23704. }
  23705. const { CheckboxGroup: ElCheckboxGroup } = ElCheckbox;
  23706. const _sfc_main$e = defineComponent({
  23707. name: "ElTableFilterPanel",
  23708. components: {
  23709. ElCheckbox,
  23710. ElCheckboxGroup,
  23711. ElScrollbar,
  23712. ElTooltip,
  23713. ElIcon,
  23714. ArrowDown: arrowDown,
  23715. ArrowUp: arrowUp
  23716. },
  23717. directives: { ClickOutside },
  23718. props: {
  23719. placement: {
  23720. type: String,
  23721. default: "bottom-start"
  23722. },
  23723. store: {
  23724. type: Object
  23725. },
  23726. column: {
  23727. type: Object
  23728. },
  23729. upDataColumn: {
  23730. type: Function
  23731. }
  23732. },
  23733. setup(props) {
  23734. const instance = getCurrentInstance();
  23735. const { t } = useLocale();
  23736. const ns = useNamespace("table-filter");
  23737. const parent = instance == null ? void 0 : instance.parent;
  23738. if (!parent.filterPanels.value[props.column.id]) {
  23739. parent.filterPanels.value[props.column.id] = instance;
  23740. }
  23741. const tooltipVisible = ref(false);
  23742. const tooltip = ref(null);
  23743. const filters = computed(() => {
  23744. return props.column && props.column.filters;
  23745. });
  23746. const filterValue = computed({
  23747. get: () => {
  23748. var _a2;
  23749. return (((_a2 = props.column) == null ? void 0 : _a2.filteredValue) || [])[0];
  23750. },
  23751. set: (value) => {
  23752. if (filteredValue.value) {
  23753. if (typeof value !== "undefined" && value !== null) {
  23754. filteredValue.value.splice(0, 1, value);
  23755. } else {
  23756. filteredValue.value.splice(0, 1);
  23757. }
  23758. }
  23759. }
  23760. });
  23761. const filteredValue = computed({
  23762. get() {
  23763. if (props.column) {
  23764. return props.column.filteredValue || [];
  23765. }
  23766. return [];
  23767. },
  23768. set(value) {
  23769. if (props.column) {
  23770. props.upDataColumn("filteredValue", value);
  23771. }
  23772. }
  23773. });
  23774. const multiple = computed(() => {
  23775. if (props.column) {
  23776. return props.column.filterMultiple;
  23777. }
  23778. return true;
  23779. });
  23780. const isActive = (filter) => {
  23781. return filter.value === filterValue.value;
  23782. };
  23783. const hidden = () => {
  23784. tooltipVisible.value = false;
  23785. };
  23786. const showFilterPanel = (e) => {
  23787. e.stopPropagation();
  23788. tooltipVisible.value = !tooltipVisible.value;
  23789. };
  23790. const hideFilterPanel = () => {
  23791. tooltipVisible.value = false;
  23792. };
  23793. const handleConfirm = () => {
  23794. confirmFilter(filteredValue.value);
  23795. hidden();
  23796. };
  23797. const handleReset = () => {
  23798. filteredValue.value = [];
  23799. confirmFilter(filteredValue.value);
  23800. hidden();
  23801. };
  23802. const handleSelect = (_filterValue) => {
  23803. filterValue.value = _filterValue;
  23804. if (typeof _filterValue !== "undefined" && _filterValue !== null) {
  23805. confirmFilter(filteredValue.value);
  23806. } else {
  23807. confirmFilter([]);
  23808. }
  23809. hidden();
  23810. };
  23811. const confirmFilter = (filteredValue2) => {
  23812. props.store.commit("filterChange", {
  23813. column: props.column,
  23814. values: filteredValue2
  23815. });
  23816. props.store.updateAllSelected();
  23817. };
  23818. watch(tooltipVisible, (value) => {
  23819. if (props.column) {
  23820. props.upDataColumn("filterOpened", value);
  23821. }
  23822. }, {
  23823. immediate: true
  23824. });
  23825. const popperPaneRef = computed(() => {
  23826. var _a2, _b2;
  23827. return (_b2 = (_a2 = tooltip.value) == null ? void 0 : _a2.popperRef) == null ? void 0 : _b2.contentRef;
  23828. });
  23829. return {
  23830. tooltipVisible,
  23831. multiple,
  23832. filteredValue,
  23833. filterValue,
  23834. filters,
  23835. handleConfirm,
  23836. handleReset,
  23837. handleSelect,
  23838. isActive,
  23839. t,
  23840. ns,
  23841. showFilterPanel,
  23842. hideFilterPanel,
  23843. popperPaneRef,
  23844. tooltip
  23845. };
  23846. }
  23847. });
  23848. const _hoisted_1$b = { key: 0 };
  23849. const _hoisted_2$9 = ["disabled"];
  23850. const _hoisted_3$6 = ["label", "onClick"];
  23851. function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
  23852. const _component_el_checkbox = resolveComponent("el-checkbox");
  23853. const _component_el_checkbox_group = resolveComponent("el-checkbox-group");
  23854. const _component_el_scrollbar = resolveComponent("el-scrollbar");
  23855. const _component_arrow_up = resolveComponent("arrow-up");
  23856. const _component_arrow_down = resolveComponent("arrow-down");
  23857. const _component_el_icon = resolveComponent("el-icon");
  23858. const _component_el_tooltip = resolveComponent("el-tooltip");
  23859. const _directive_click_outside = resolveDirective("click-outside");
  23860. return openBlock(), createBlock(_component_el_tooltip, {
  23861. ref: "tooltip",
  23862. visible: _ctx.tooltipVisible,
  23863. "onUpdate:visible": _cache[5] || (_cache[5] = ($event) => _ctx.tooltipVisible = $event),
  23864. offset: 0,
  23865. placement: _ctx.placement,
  23866. "show-arrow": false,
  23867. "stop-popper-mouse-event": false,
  23868. "append-to-body": "",
  23869. effect: "light",
  23870. pure: "",
  23871. "popper-class": _ctx.ns.b(),
  23872. persistent: ""
  23873. }, {
  23874. content: withCtx(() => [
  23875. _ctx.multiple ? (openBlock(), createElementBlock("div", _hoisted_1$b, [
  23876. createElementVNode("div", {
  23877. class: normalizeClass(_ctx.ns.e("content"))
  23878. }, [
  23879. createVNode(_component_el_scrollbar, {
  23880. "wrap-class": _ctx.ns.e("wrap")
  23881. }, {
  23882. default: withCtx(() => [
  23883. createVNode(_component_el_checkbox_group, {
  23884. modelValue: _ctx.filteredValue,
  23885. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.filteredValue = $event),
  23886. class: normalizeClass(_ctx.ns.e("checkbox-group"))
  23887. }, {
  23888. default: withCtx(() => [
  23889. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.filters, (filter) => {
  23890. return openBlock(), createBlock(_component_el_checkbox, {
  23891. key: filter.value,
  23892. label: filter.value
  23893. }, {
  23894. default: withCtx(() => [
  23895. createTextVNode(toDisplayString(filter.text), 1)
  23896. ]),
  23897. _: 2
  23898. }, 1032, ["label"]);
  23899. }), 128))
  23900. ]),
  23901. _: 1
  23902. }, 8, ["modelValue", "class"])
  23903. ]),
  23904. _: 1
  23905. }, 8, ["wrap-class"])
  23906. ], 2),
  23907. createElementVNode("div", {
  23908. class: normalizeClass(_ctx.ns.e("bottom"))
  23909. }, [
  23910. createElementVNode("button", {
  23911. class: normalizeClass({ [_ctx.ns.is("disabled")]: _ctx.filteredValue.length === 0 }),
  23912. disabled: _ctx.filteredValue.length === 0,
  23913. type: "button",
  23914. onClick: _cache[1] || (_cache[1] = (...args) => _ctx.handleConfirm && _ctx.handleConfirm(...args))
  23915. }, toDisplayString(_ctx.t("el.table.confirmFilter")), 11, _hoisted_2$9),
  23916. createElementVNode("button", {
  23917. type: "button",
  23918. onClick: _cache[2] || (_cache[2] = (...args) => _ctx.handleReset && _ctx.handleReset(...args))
  23919. }, toDisplayString(_ctx.t("el.table.resetFilter")), 1)
  23920. ], 2)
  23921. ])) : (openBlock(), createElementBlock("ul", {
  23922. key: 1,
  23923. class: normalizeClass(_ctx.ns.e("list"))
  23924. }, [
  23925. createElementVNode("li", {
  23926. class: normalizeClass([
  23927. _ctx.ns.e("list-item"),
  23928. {
  23929. [_ctx.ns.is("active")]: _ctx.filterValue === void 0 || _ctx.filterValue === null
  23930. }
  23931. ]),
  23932. onClick: _cache[3] || (_cache[3] = ($event) => _ctx.handleSelect(null))
  23933. }, toDisplayString(_ctx.t("el.table.clearFilter")), 3),
  23934. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.filters, (filter) => {
  23935. return openBlock(), createElementBlock("li", {
  23936. key: filter.value,
  23937. class: normalizeClass([_ctx.ns.e("list-item"), _ctx.ns.is("active", _ctx.isActive(filter))]),
  23938. label: filter.value,
  23939. onClick: ($event) => _ctx.handleSelect(filter.value)
  23940. }, toDisplayString(filter.text), 11, _hoisted_3$6);
  23941. }), 128))
  23942. ], 2))
  23943. ]),
  23944. default: withCtx(() => [
  23945. withDirectives((openBlock(), createElementBlock("span", {
  23946. class: normalizeClass([
  23947. `${_ctx.ns.namespace.value}-table__column-filter-trigger`,
  23948. `${_ctx.ns.namespace.value}-none-outline`
  23949. ]),
  23950. onClick: _cache[4] || (_cache[4] = (...args) => _ctx.showFilterPanel && _ctx.showFilterPanel(...args))
  23951. }, [
  23952. createVNode(_component_el_icon, null, {
  23953. default: withCtx(() => [
  23954. _ctx.column.filterOpened ? (openBlock(), createBlock(_component_arrow_up, { key: 0 })) : (openBlock(), createBlock(_component_arrow_down, { key: 1 }))
  23955. ]),
  23956. _: 1
  23957. })
  23958. ], 2)), [
  23959. [_directive_click_outside, _ctx.hideFilterPanel, _ctx.popperPaneRef]
  23960. ])
  23961. ]),
  23962. _: 1
  23963. }, 8, ["visible", "placement", "popper-class"]);
  23964. }
  23965. var FilterPanel = /* @__PURE__ */ _export_sfc$1(_sfc_main$e, [["render", _sfc_render$3], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/table/src/filter-panel.vue"]]);
  23966. function useLayoutObserver(root2) {
  23967. const instance = getCurrentInstance();
  23968. onBeforeMount(() => {
  23969. tableLayout.value.addObserver(instance);
  23970. });
  23971. onMounted(() => {
  23972. onColumnsChange(tableLayout.value);
  23973. onScrollableChange(tableLayout.value);
  23974. });
  23975. onUpdated(() => {
  23976. onColumnsChange(tableLayout.value);
  23977. onScrollableChange(tableLayout.value);
  23978. });
  23979. onUnmounted(() => {
  23980. tableLayout.value.removeObserver(instance);
  23981. });
  23982. const tableLayout = computed(() => {
  23983. const layout = root2.layout;
  23984. if (!layout) {
  23985. throw new Error("Can not find table layout.");
  23986. }
  23987. return layout;
  23988. });
  23989. const onColumnsChange = (layout) => {
  23990. var _a2;
  23991. const cols = ((_a2 = root2.vnode.el) == null ? void 0 : _a2.querySelectorAll("colgroup > col")) || [];
  23992. if (!cols.length)
  23993. return;
  23994. const flattenColumns = layout.getFlattenColumns();
  23995. const columnsMap = {};
  23996. flattenColumns.forEach((column) => {
  23997. columnsMap[column.id] = column;
  23998. });
  23999. for (let i = 0, j = cols.length; i < j; i++) {
  24000. const col = cols[i];
  24001. const name = col.getAttribute("name");
  24002. const column = columnsMap[name];
  24003. if (column) {
  24004. col.setAttribute("width", column.realWidth || column.width);
  24005. }
  24006. }
  24007. };
  24008. const onScrollableChange = (layout) => {
  24009. var _a2, _b2;
  24010. const cols = ((_a2 = root2.vnode.el) == null ? void 0 : _a2.querySelectorAll("colgroup > col[name=gutter]")) || [];
  24011. for (let i = 0, j = cols.length; i < j; i++) {
  24012. const col = cols[i];
  24013. col.setAttribute("width", layout.scrollY.value ? layout.gutterWidth : "0");
  24014. }
  24015. const ths = ((_b2 = root2.vnode.el) == null ? void 0 : _b2.querySelectorAll("th.gutter")) || [];
  24016. for (let i = 0, j = ths.length; i < j; i++) {
  24017. const th = ths[i];
  24018. th.style.width = layout.scrollY.value ? `${layout.gutterWidth}px` : "0";
  24019. th.style.display = layout.scrollY.value ? "" : "none";
  24020. }
  24021. };
  24022. return {
  24023. tableLayout: tableLayout.value,
  24024. onColumnsChange,
  24025. onScrollableChange
  24026. };
  24027. }
  24028. const TABLE_INJECTION_KEY = Symbol("ElTable");
  24029. function useEvent(props, emit) {
  24030. const instance = getCurrentInstance();
  24031. const parent = inject(TABLE_INJECTION_KEY);
  24032. const handleFilterClick = (event) => {
  24033. event.stopPropagation();
  24034. return;
  24035. };
  24036. const handleHeaderClick = (event, column) => {
  24037. if (!column.filters && column.sortable) {
  24038. handleSortClick(event, column, false);
  24039. } else if (column.filterable && !column.sortable) {
  24040. handleFilterClick(event);
  24041. }
  24042. parent == null ? void 0 : parent.emit("header-click", column, event);
  24043. };
  24044. const handleHeaderContextMenu = (event, column) => {
  24045. parent == null ? void 0 : parent.emit("header-contextmenu", column, event);
  24046. };
  24047. const draggingColumn = ref(null);
  24048. const dragging = ref(false);
  24049. const dragState = ref({});
  24050. const handleMouseDown = (event, column) => {
  24051. if (!isClient$1)
  24052. return;
  24053. if (column.children && column.children.length > 0)
  24054. return;
  24055. if (draggingColumn.value && props.border) {
  24056. dragging.value = true;
  24057. const table = parent;
  24058. emit("set-drag-visible", true);
  24059. const tableEl = table == null ? void 0 : table.vnode.el;
  24060. const tableLeft = tableEl.getBoundingClientRect().left;
  24061. const columnEl = instance.vnode.el.querySelector(`th.${column.id}`);
  24062. const columnRect = columnEl.getBoundingClientRect();
  24063. const minLeft = columnRect.left - tableLeft + 30;
  24064. addClass(columnEl, "noclick");
  24065. dragState.value = {
  24066. startMouseLeft: event.clientX,
  24067. startLeft: columnRect.right - tableLeft,
  24068. startColumnLeft: columnRect.left - tableLeft,
  24069. tableLeft
  24070. };
  24071. const resizeProxy = table == null ? void 0 : table.refs.resizeProxy;
  24072. resizeProxy.style.left = `${dragState.value.startLeft}px`;
  24073. document.onselectstart = function() {
  24074. return false;
  24075. };
  24076. document.ondragstart = function() {
  24077. return false;
  24078. };
  24079. const handleMouseMove2 = (event2) => {
  24080. const deltaLeft = event2.clientX - dragState.value.startMouseLeft;
  24081. const proxyLeft = dragState.value.startLeft + deltaLeft;
  24082. resizeProxy.style.left = `${Math.max(minLeft, proxyLeft)}px`;
  24083. };
  24084. const handleMouseUp = () => {
  24085. if (dragging.value) {
  24086. const { startColumnLeft, startLeft } = dragState.value;
  24087. const finalLeft = Number.parseInt(resizeProxy.style.left, 10);
  24088. const columnWidth = finalLeft - startColumnLeft;
  24089. column.width = column.realWidth = columnWidth;
  24090. table == null ? void 0 : table.emit("header-dragend", column.width, startLeft - startColumnLeft, column, event);
  24091. requestAnimationFrame(() => {
  24092. props.store.scheduleLayout(false, true);
  24093. });
  24094. document.body.style.cursor = "";
  24095. dragging.value = false;
  24096. draggingColumn.value = null;
  24097. dragState.value = {};
  24098. emit("set-drag-visible", false);
  24099. }
  24100. document.removeEventListener("mousemove", handleMouseMove2);
  24101. document.removeEventListener("mouseup", handleMouseUp);
  24102. document.onselectstart = null;
  24103. document.ondragstart = null;
  24104. setTimeout(() => {
  24105. removeClass(columnEl, "noclick");
  24106. }, 0);
  24107. };
  24108. document.addEventListener("mousemove", handleMouseMove2);
  24109. document.addEventListener("mouseup", handleMouseUp);
  24110. }
  24111. };
  24112. const handleMouseMove = (event, column) => {
  24113. if (column.children && column.children.length > 0)
  24114. return;
  24115. let target = event.target;
  24116. while (target && target.tagName !== "TH") {
  24117. target = target.parentNode;
  24118. }
  24119. if (!column || !column.resizable)
  24120. return;
  24121. if (!dragging.value && props.border) {
  24122. const rect = target.getBoundingClientRect();
  24123. const bodyStyle = document.body.style;
  24124. if (rect.width > 12 && rect.right - event.pageX < 8) {
  24125. bodyStyle.cursor = "col-resize";
  24126. if (hasClass(target, "is-sortable")) {
  24127. target.style.cursor = "col-resize";
  24128. }
  24129. draggingColumn.value = column;
  24130. } else if (!dragging.value) {
  24131. bodyStyle.cursor = "";
  24132. if (hasClass(target, "is-sortable")) {
  24133. target.style.cursor = "pointer";
  24134. }
  24135. draggingColumn.value = null;
  24136. }
  24137. }
  24138. };
  24139. const handleMouseOut = () => {
  24140. if (!isClient$1)
  24141. return;
  24142. document.body.style.cursor = "";
  24143. };
  24144. const toggleOrder = ({ order: order2, sortOrders }) => {
  24145. if (order2 === "")
  24146. return sortOrders[0];
  24147. const index = sortOrders.indexOf(order2 || null);
  24148. return sortOrders[index > sortOrders.length - 2 ? 0 : index + 1];
  24149. };
  24150. const handleSortClick = (event, column, givenOrder) => {
  24151. event.stopPropagation();
  24152. const order2 = column.order === givenOrder ? null : givenOrder || toggleOrder(column);
  24153. let target = event.target;
  24154. while (target && target.tagName !== "TH") {
  24155. target = target.parentNode;
  24156. }
  24157. if (target && target.tagName === "TH") {
  24158. if (hasClass(target, "noclick")) {
  24159. removeClass(target, "noclick");
  24160. return;
  24161. }
  24162. }
  24163. if (!column.sortable)
  24164. return;
  24165. const states = props.store.states;
  24166. let sortProp = states.sortProp.value;
  24167. let sortOrder;
  24168. const sortingColumn = states.sortingColumn.value;
  24169. if (sortingColumn !== column || sortingColumn === column && sortingColumn.order === null) {
  24170. if (sortingColumn) {
  24171. sortingColumn.order = null;
  24172. }
  24173. states.sortingColumn.value = column;
  24174. sortProp = column.property;
  24175. }
  24176. if (!order2) {
  24177. sortOrder = column.order = null;
  24178. } else {
  24179. sortOrder = column.order = order2;
  24180. }
  24181. states.sortProp.value = sortProp;
  24182. states.sortOrder.value = sortOrder;
  24183. parent == null ? void 0 : parent.store.commit("changeSortCondition");
  24184. };
  24185. return {
  24186. handleHeaderClick,
  24187. handleHeaderContextMenu,
  24188. handleMouseDown,
  24189. handleMouseMove,
  24190. handleMouseOut,
  24191. handleSortClick,
  24192. handleFilterClick
  24193. };
  24194. }
  24195. function useStyle$2(props) {
  24196. const parent = inject(TABLE_INJECTION_KEY);
  24197. const ns = useNamespace("table");
  24198. const getHeaderRowStyle = (rowIndex) => {
  24199. const headerRowStyle = parent == null ? void 0 : parent.props.headerRowStyle;
  24200. if (typeof headerRowStyle === "function") {
  24201. return headerRowStyle.call(null, { rowIndex });
  24202. }
  24203. return headerRowStyle;
  24204. };
  24205. const getHeaderRowClass = (rowIndex) => {
  24206. const classes = [];
  24207. const headerRowClassName = parent == null ? void 0 : parent.props.headerRowClassName;
  24208. if (typeof headerRowClassName === "string") {
  24209. classes.push(headerRowClassName);
  24210. } else if (typeof headerRowClassName === "function") {
  24211. classes.push(headerRowClassName.call(null, { rowIndex }));
  24212. }
  24213. return classes.join(" ");
  24214. };
  24215. const getHeaderCellStyle = (rowIndex, columnIndex, row, column) => {
  24216. var _a2;
  24217. let headerCellStyles = (_a2 = parent == null ? void 0 : parent.props.headerCellStyle) != null ? _a2 : {};
  24218. if (typeof headerCellStyles === "function") {
  24219. headerCellStyles = headerCellStyles.call(null, {
  24220. rowIndex,
  24221. columnIndex,
  24222. row,
  24223. column
  24224. });
  24225. }
  24226. const fixedStyle = column.isSubColumn ? null : getFixedColumnOffset(columnIndex, column.fixed, props.store, row);
  24227. ensurePosition(fixedStyle, "left");
  24228. ensurePosition(fixedStyle, "right");
  24229. return Object.assign({}, headerCellStyles, fixedStyle);
  24230. };
  24231. const getHeaderCellClass = (rowIndex, columnIndex, row, column) => {
  24232. const fixedClasses = column.isSubColumn ? [] : getFixedColumnsClass(ns.b(), columnIndex, column.fixed, props.store, row);
  24233. const classes = [
  24234. column.id,
  24235. column.order,
  24236. column.headerAlign,
  24237. column.className,
  24238. column.labelClassName,
  24239. ...fixedClasses
  24240. ];
  24241. if (!column.children) {
  24242. classes.push("is-leaf");
  24243. }
  24244. if (column.sortable) {
  24245. classes.push("is-sortable");
  24246. }
  24247. const headerCellClassName = parent == null ? void 0 : parent.props.headerCellClassName;
  24248. if (typeof headerCellClassName === "string") {
  24249. classes.push(headerCellClassName);
  24250. } else if (typeof headerCellClassName === "function") {
  24251. classes.push(headerCellClassName.call(null, {
  24252. rowIndex,
  24253. columnIndex,
  24254. row,
  24255. column
  24256. }));
  24257. }
  24258. classes.push(ns.e("cell"));
  24259. return classes.filter((className) => Boolean(className)).join(" ");
  24260. };
  24261. return {
  24262. getHeaderRowStyle,
  24263. getHeaderRowClass,
  24264. getHeaderCellStyle,
  24265. getHeaderCellClass
  24266. };
  24267. }
  24268. const getAllColumns = (columns) => {
  24269. const result = [];
  24270. columns.forEach((column) => {
  24271. if (column.children) {
  24272. result.push(column);
  24273. result.push.apply(result, getAllColumns(column.children));
  24274. } else {
  24275. result.push(column);
  24276. }
  24277. });
  24278. return result;
  24279. };
  24280. const convertToRows = (originColumns) => {
  24281. let maxLevel = 1;
  24282. const traverse = (column, parent) => {
  24283. if (parent) {
  24284. column.level = parent.level + 1;
  24285. if (maxLevel < column.level) {
  24286. maxLevel = column.level;
  24287. }
  24288. }
  24289. if (column.children) {
  24290. let colSpan = 0;
  24291. column.children.forEach((subColumn) => {
  24292. traverse(subColumn, column);
  24293. colSpan += subColumn.colSpan;
  24294. });
  24295. column.colSpan = colSpan;
  24296. } else {
  24297. column.colSpan = 1;
  24298. }
  24299. };
  24300. originColumns.forEach((column) => {
  24301. column.level = 1;
  24302. traverse(column, void 0);
  24303. });
  24304. const rows = [];
  24305. for (let i = 0; i < maxLevel; i++) {
  24306. rows.push([]);
  24307. }
  24308. const allColumns = getAllColumns(originColumns);
  24309. allColumns.forEach((column) => {
  24310. if (!column.children) {
  24311. column.rowSpan = maxLevel - column.level + 1;
  24312. } else {
  24313. column.rowSpan = 1;
  24314. column.children.forEach((col) => col.isSubColumn = true);
  24315. }
  24316. rows[column.level - 1].push(column);
  24317. });
  24318. return rows;
  24319. };
  24320. function useUtils$1(props) {
  24321. const parent = inject(TABLE_INJECTION_KEY);
  24322. const columnRows = computed(() => {
  24323. return convertToRows(props.store.states.originColumns.value);
  24324. });
  24325. const isGroup = computed(() => {
  24326. const result = columnRows.value.length > 1;
  24327. if (result && parent) {
  24328. parent.state.isGroup.value = true;
  24329. }
  24330. return result;
  24331. });
  24332. const toggleAllSelection = (event) => {
  24333. event.stopPropagation();
  24334. parent == null ? void 0 : parent.store.commit("toggleAllSelection");
  24335. };
  24336. return {
  24337. isGroup,
  24338. toggleAllSelection,
  24339. columnRows
  24340. };
  24341. }
  24342. var TableHeader = defineComponent({
  24343. name: "ElTableHeader",
  24344. components: {
  24345. ElCheckbox
  24346. },
  24347. props: {
  24348. fixed: {
  24349. type: String,
  24350. default: ""
  24351. },
  24352. store: {
  24353. required: true,
  24354. type: Object
  24355. },
  24356. border: Boolean,
  24357. defaultSort: {
  24358. type: Object,
  24359. default: () => {
  24360. return {
  24361. prop: "",
  24362. order: ""
  24363. };
  24364. }
  24365. }
  24366. },
  24367. setup(props, { emit }) {
  24368. const instance = getCurrentInstance();
  24369. const parent = inject(TABLE_INJECTION_KEY);
  24370. const ns = useNamespace("table");
  24371. const filterPanels = ref({});
  24372. const { onColumnsChange, onScrollableChange } = useLayoutObserver(parent);
  24373. onMounted(async () => {
  24374. await nextTick();
  24375. await nextTick();
  24376. const { prop, order: order2 } = props.defaultSort;
  24377. parent == null ? void 0 : parent.store.commit("sort", { prop, order: order2, init: true });
  24378. });
  24379. const {
  24380. handleHeaderClick,
  24381. handleHeaderContextMenu,
  24382. handleMouseDown,
  24383. handleMouseMove,
  24384. handleMouseOut,
  24385. handleSortClick,
  24386. handleFilterClick
  24387. } = useEvent(props, emit);
  24388. const {
  24389. getHeaderRowStyle,
  24390. getHeaderRowClass,
  24391. getHeaderCellStyle,
  24392. getHeaderCellClass
  24393. } = useStyle$2(props);
  24394. const { isGroup, toggleAllSelection, columnRows } = useUtils$1(props);
  24395. instance.state = {
  24396. onColumnsChange,
  24397. onScrollableChange
  24398. };
  24399. instance.filterPanels = filterPanels;
  24400. return {
  24401. ns,
  24402. filterPanels,
  24403. onColumnsChange,
  24404. onScrollableChange,
  24405. columnRows,
  24406. getHeaderRowClass,
  24407. getHeaderRowStyle,
  24408. getHeaderCellClass,
  24409. getHeaderCellStyle,
  24410. handleHeaderClick,
  24411. handleHeaderContextMenu,
  24412. handleMouseDown,
  24413. handleMouseMove,
  24414. handleMouseOut,
  24415. handleSortClick,
  24416. handleFilterClick,
  24417. isGroup,
  24418. toggleAllSelection
  24419. };
  24420. },
  24421. render() {
  24422. const {
  24423. ns,
  24424. isGroup,
  24425. columnRows,
  24426. getHeaderCellStyle,
  24427. getHeaderCellClass,
  24428. getHeaderRowClass,
  24429. getHeaderRowStyle,
  24430. handleHeaderClick,
  24431. handleHeaderContextMenu,
  24432. handleMouseDown,
  24433. handleMouseMove,
  24434. handleSortClick,
  24435. handleMouseOut,
  24436. store,
  24437. $parent
  24438. } = this;
  24439. let rowSpan = 1;
  24440. return h$1("thead", {
  24441. class: { [ns.is("group")]: isGroup }
  24442. }, columnRows.map((subColumns, rowIndex) => h$1("tr", {
  24443. class: getHeaderRowClass(rowIndex),
  24444. key: rowIndex,
  24445. style: getHeaderRowStyle(rowIndex)
  24446. }, subColumns.map((column, cellIndex) => {
  24447. if (column.rowSpan > rowSpan) {
  24448. rowSpan = column.rowSpan;
  24449. }
  24450. return h$1("th", {
  24451. class: getHeaderCellClass(rowIndex, cellIndex, subColumns, column),
  24452. colspan: column.colSpan,
  24453. key: `${column.id}-thead`,
  24454. rowspan: column.rowSpan,
  24455. style: getHeaderCellStyle(rowIndex, cellIndex, subColumns, column),
  24456. onClick: ($event) => handleHeaderClick($event, column),
  24457. onContextmenu: ($event) => handleHeaderContextMenu($event, column),
  24458. onMousedown: ($event) => handleMouseDown($event, column),
  24459. onMousemove: ($event) => handleMouseMove($event, column),
  24460. onMouseout: handleMouseOut
  24461. }, [
  24462. h$1("div", {
  24463. class: [
  24464. "cell",
  24465. column.filteredValue && column.filteredValue.length > 0 ? "highlight" : "",
  24466. column.labelClassName
  24467. ]
  24468. }, [
  24469. column.renderHeader ? column.renderHeader({
  24470. column,
  24471. $index: cellIndex,
  24472. store,
  24473. _self: $parent
  24474. }) : column.label,
  24475. column.sortable && h$1("span", {
  24476. onClick: ($event) => handleSortClick($event, column),
  24477. class: "caret-wrapper"
  24478. }, [
  24479. h$1("i", {
  24480. onClick: ($event) => handleSortClick($event, column, "ascending"),
  24481. class: "sort-caret ascending"
  24482. }),
  24483. h$1("i", {
  24484. onClick: ($event) => handleSortClick($event, column, "descending"),
  24485. class: "sort-caret descending"
  24486. })
  24487. ]),
  24488. column.filterable && h$1(FilterPanel, {
  24489. store,
  24490. placement: column.filterPlacement || "bottom-start",
  24491. column,
  24492. upDataColumn: (key, value) => {
  24493. column[key] = value;
  24494. }
  24495. })
  24496. ])
  24497. ]);
  24498. }))));
  24499. }
  24500. });
  24501. function useEvents(props) {
  24502. const parent = inject(TABLE_INJECTION_KEY);
  24503. const tooltipContent = ref("");
  24504. const tooltipTrigger = ref(h$1("div"));
  24505. const handleEvent = (event, row, name) => {
  24506. var _a2;
  24507. const table = parent;
  24508. const cell = getCell(event);
  24509. let column;
  24510. const namespace = (_a2 = table == null ? void 0 : table.vnode.el) == null ? void 0 : _a2.dataset.prefix;
  24511. if (cell) {
  24512. column = getColumnByCell({
  24513. columns: props.store.states.columns.value
  24514. }, cell, namespace);
  24515. if (column) {
  24516. table == null ? void 0 : table.emit(`cell-${name}`, row, column, cell, event);
  24517. }
  24518. }
  24519. table == null ? void 0 : table.emit(`row-${name}`, row, column, event);
  24520. };
  24521. const handleDoubleClick = (event, row) => {
  24522. handleEvent(event, row, "dblclick");
  24523. };
  24524. const handleClick = (event, row) => {
  24525. props.store.commit("setCurrentRow", row);
  24526. handleEvent(event, row, "click");
  24527. };
  24528. const handleContextMenu = (event, row) => {
  24529. handleEvent(event, row, "contextmenu");
  24530. };
  24531. const handleMouseEnter = debounce$1((index) => {
  24532. props.store.commit("setHoverRow", index);
  24533. }, 30);
  24534. const handleMouseLeave = debounce$1(() => {
  24535. props.store.commit("setHoverRow", null);
  24536. }, 30);
  24537. const handleCellMouseEnter = (event, row) => {
  24538. var _a2;
  24539. const table = parent;
  24540. const cell = getCell(event);
  24541. const namespace = (_a2 = table == null ? void 0 : table.vnode.el) == null ? void 0 : _a2.dataset.prefix;
  24542. if (cell) {
  24543. const column = getColumnByCell({
  24544. columns: props.store.states.columns.value
  24545. }, cell, namespace);
  24546. const hoverState = table.hoverState = { cell, column, row };
  24547. table == null ? void 0 : table.emit("cell-mouse-enter", hoverState.row, hoverState.column, hoverState.cell, event);
  24548. }
  24549. const cellChild = event.target.querySelector(".cell");
  24550. if (!(hasClass(cellChild, `${namespace}-tooltip`) && cellChild.childNodes.length)) {
  24551. return;
  24552. }
  24553. const range3 = document.createRange();
  24554. range3.setStart(cellChild, 0);
  24555. range3.setEnd(cellChild, cellChild.childNodes.length);
  24556. const rangeWidth = range3.getBoundingClientRect().width;
  24557. const padding = (Number.parseInt(getStyle(cellChild, "paddingLeft"), 10) || 0) + (Number.parseInt(getStyle(cellChild, "paddingRight"), 10) || 0);
  24558. if (rangeWidth + padding > cellChild.offsetWidth || cellChild.scrollWidth > cellChild.offsetWidth) {
  24559. createTablePopper(cell, cell.innerText || cell.textContent, {
  24560. placement: "top",
  24561. strategy: "fixed"
  24562. }, row.tooltipEffect);
  24563. }
  24564. };
  24565. const handleCellMouseLeave = (event) => {
  24566. const cell = getCell(event);
  24567. if (!cell)
  24568. return;
  24569. const oldHoverState = parent == null ? void 0 : parent.hoverState;
  24570. parent == null ? void 0 : parent.emit("cell-mouse-leave", oldHoverState == null ? void 0 : oldHoverState.row, oldHoverState == null ? void 0 : oldHoverState.column, oldHoverState == null ? void 0 : oldHoverState.cell, event);
  24571. };
  24572. return {
  24573. handleDoubleClick,
  24574. handleClick,
  24575. handleContextMenu,
  24576. handleMouseEnter,
  24577. handleMouseLeave,
  24578. handleCellMouseEnter,
  24579. handleCellMouseLeave,
  24580. tooltipContent,
  24581. tooltipTrigger
  24582. };
  24583. }
  24584. function useStyles(props) {
  24585. const parent = inject(TABLE_INJECTION_KEY);
  24586. const ns = useNamespace("table");
  24587. const getRowStyle = (row, rowIndex) => {
  24588. const rowStyle = parent == null ? void 0 : parent.props.rowStyle;
  24589. if (typeof rowStyle === "function") {
  24590. return rowStyle.call(null, {
  24591. row,
  24592. rowIndex
  24593. });
  24594. }
  24595. return rowStyle || null;
  24596. };
  24597. const getRowClass = (row, rowIndex) => {
  24598. const classes = [ns.e("row")];
  24599. if ((parent == null ? void 0 : parent.props.highlightCurrentRow) && row === props.store.states.currentRow.value) {
  24600. classes.push("current-row");
  24601. }
  24602. if (props.stripe && rowIndex % 2 === 1) {
  24603. classes.push(ns.em("row", "striped"));
  24604. }
  24605. const rowClassName = parent == null ? void 0 : parent.props.rowClassName;
  24606. if (typeof rowClassName === "string") {
  24607. classes.push(rowClassName);
  24608. } else if (typeof rowClassName === "function") {
  24609. classes.push(rowClassName.call(null, {
  24610. row,
  24611. rowIndex
  24612. }));
  24613. }
  24614. return classes;
  24615. };
  24616. const getCellStyle = (rowIndex, columnIndex, row, column) => {
  24617. const cellStyle = parent == null ? void 0 : parent.props.cellStyle;
  24618. let cellStyles = cellStyle != null ? cellStyle : {};
  24619. if (typeof cellStyle === "function") {
  24620. cellStyles = cellStyle.call(null, {
  24621. rowIndex,
  24622. columnIndex,
  24623. row,
  24624. column
  24625. });
  24626. }
  24627. const fixedStyle = column.isSubColumn ? null : getFixedColumnOffset(columnIndex, props == null ? void 0 : props.fixed, props.store);
  24628. ensurePosition(fixedStyle, "left");
  24629. ensurePosition(fixedStyle, "right");
  24630. return Object.assign({}, cellStyles, fixedStyle);
  24631. };
  24632. const getCellClass = (rowIndex, columnIndex, row, column) => {
  24633. const fixedClasses = column.isSubColumn ? [] : getFixedColumnsClass(ns.b(), columnIndex, props == null ? void 0 : props.fixed, props.store);
  24634. const classes = [column.id, column.align, column.className, ...fixedClasses];
  24635. const cellClassName = parent == null ? void 0 : parent.props.cellClassName;
  24636. if (typeof cellClassName === "string") {
  24637. classes.push(cellClassName);
  24638. } else if (typeof cellClassName === "function") {
  24639. classes.push(cellClassName.call(null, {
  24640. rowIndex,
  24641. columnIndex,
  24642. row,
  24643. column
  24644. }));
  24645. }
  24646. classes.push(ns.e("cell"));
  24647. return classes.filter((className) => Boolean(className)).join(" ");
  24648. };
  24649. const getSpan = (row, column, rowIndex, columnIndex) => {
  24650. let rowspan = 1;
  24651. let colspan = 1;
  24652. const fn2 = parent == null ? void 0 : parent.props.spanMethod;
  24653. if (typeof fn2 === "function") {
  24654. const result = fn2({
  24655. row,
  24656. column,
  24657. rowIndex,
  24658. columnIndex
  24659. });
  24660. if (Array.isArray(result)) {
  24661. rowspan = result[0];
  24662. colspan = result[1];
  24663. } else if (typeof result === "object") {
  24664. rowspan = result.rowspan;
  24665. colspan = result.colspan;
  24666. }
  24667. }
  24668. return { rowspan, colspan };
  24669. };
  24670. const getColspanRealWidth = (columns, colspan, index) => {
  24671. if (colspan < 1) {
  24672. return columns[index].realWidth;
  24673. }
  24674. const widthArr = columns.map(({ realWidth, width }) => realWidth || width).slice(index, index + colspan);
  24675. return Number(widthArr.reduce((acc, width) => Number(acc) + Number(width), -1));
  24676. };
  24677. return {
  24678. getRowStyle,
  24679. getRowClass,
  24680. getCellStyle,
  24681. getCellClass,
  24682. getSpan,
  24683. getColspanRealWidth
  24684. };
  24685. }
  24686. function useRender$1(props) {
  24687. const parent = inject(TABLE_INJECTION_KEY);
  24688. const {
  24689. handleDoubleClick,
  24690. handleClick,
  24691. handleContextMenu,
  24692. handleMouseEnter,
  24693. handleMouseLeave,
  24694. handleCellMouseEnter,
  24695. handleCellMouseLeave,
  24696. tooltipContent,
  24697. tooltipTrigger
  24698. } = useEvents(props);
  24699. const {
  24700. getRowStyle,
  24701. getRowClass,
  24702. getCellStyle,
  24703. getCellClass,
  24704. getSpan,
  24705. getColspanRealWidth
  24706. } = useStyles(props);
  24707. const firstDefaultColumnIndex = computed(() => {
  24708. return props.store.states.columns.value.findIndex(({ type: type4 }) => type4 === "default");
  24709. });
  24710. const getKeyOfRow = (row, index) => {
  24711. const rowKey = parent.props.rowKey;
  24712. if (rowKey) {
  24713. return getRowIdentity(row, rowKey);
  24714. }
  24715. return index;
  24716. };
  24717. const rowRender = (row, $index, treeRowData, expanded = false) => {
  24718. const { tooltipEffect, store } = props;
  24719. const { indent, columns } = store.states;
  24720. const rowClasses = getRowClass(row, $index);
  24721. let display = true;
  24722. if (treeRowData) {
  24723. rowClasses.push(`el-table__row--level-${treeRowData.level}`);
  24724. display = treeRowData.display;
  24725. }
  24726. const displayStyle = display ? null : {
  24727. display: "none"
  24728. };
  24729. return h$1("tr", {
  24730. style: [displayStyle, getRowStyle(row, $index)],
  24731. class: rowClasses,
  24732. key: getKeyOfRow(row, $index),
  24733. onDblclick: ($event) => handleDoubleClick($event, row),
  24734. onClick: ($event) => handleClick($event, row),
  24735. onContextmenu: ($event) => handleContextMenu($event, row),
  24736. onMouseenter: () => handleMouseEnter($index),
  24737. onMouseleave: handleMouseLeave
  24738. }, columns.value.map((column, cellIndex) => {
  24739. const { rowspan, colspan } = getSpan(row, column, $index, cellIndex);
  24740. if (!rowspan || !colspan) {
  24741. return null;
  24742. }
  24743. const columnData = __spreadValues({}, column);
  24744. columnData.realWidth = getColspanRealWidth(columns.value, colspan, cellIndex);
  24745. const data2 = {
  24746. store: props.store,
  24747. _self: props.context || parent,
  24748. column: columnData,
  24749. row,
  24750. $index,
  24751. cellIndex,
  24752. expanded
  24753. };
  24754. if (cellIndex === firstDefaultColumnIndex.value && treeRowData) {
  24755. data2.treeNode = {
  24756. indent: treeRowData.level * indent.value,
  24757. level: treeRowData.level
  24758. };
  24759. if (typeof treeRowData.expanded === "boolean") {
  24760. data2.treeNode.expanded = treeRowData.expanded;
  24761. if ("loading" in treeRowData) {
  24762. data2.treeNode.loading = treeRowData.loading;
  24763. }
  24764. if ("noLazyChildren" in treeRowData) {
  24765. data2.treeNode.noLazyChildren = treeRowData.noLazyChildren;
  24766. }
  24767. }
  24768. }
  24769. const baseKey = `${$index},${cellIndex}`;
  24770. const patchKey = columnData.columnKey || columnData.rawColumnKey || "";
  24771. const tdChildren = cellChildren(cellIndex, column, data2);
  24772. return h$1("td", {
  24773. style: getCellStyle($index, cellIndex, row, column),
  24774. class: getCellClass($index, cellIndex, row, column),
  24775. key: `${patchKey}${baseKey}`,
  24776. rowspan,
  24777. colspan,
  24778. onMouseenter: ($event) => handleCellMouseEnter($event, __spreadProps(__spreadValues({}, row), { tooltipEffect })),
  24779. onMouseleave: handleCellMouseLeave
  24780. }, [tdChildren]);
  24781. }));
  24782. };
  24783. const cellChildren = (cellIndex, column, data2) => {
  24784. return column.renderCell(data2);
  24785. };
  24786. const wrappedRowRender = (row, $index) => {
  24787. const store = props.store;
  24788. const { isRowExpanded, assertRowKey } = store;
  24789. const { treeData, lazyTreeNodeMap, childrenColumnName, rowKey } = store.states;
  24790. const columns = store.states.columns.value;
  24791. const hasExpandColumn = columns.some(({ type: type4 }) => type4 === "expand");
  24792. if (hasExpandColumn) {
  24793. const expanded = isRowExpanded(row);
  24794. const tr = rowRender(row, $index, void 0, expanded);
  24795. const renderExpanded = parent.renderExpanded;
  24796. if (expanded) {
  24797. if (!renderExpanded) {
  24798. console.error("[Element Error]renderExpanded is required.");
  24799. return tr;
  24800. }
  24801. return [
  24802. [
  24803. tr,
  24804. h$1("tr", {
  24805. key: `expanded-row__${tr.key}`
  24806. }, [
  24807. h$1("td", {
  24808. colspan: columns.length,
  24809. class: "el-table__cell el-table__expanded-cell"
  24810. }, [renderExpanded({ row, $index, store, expanded })])
  24811. ])
  24812. ]
  24813. ];
  24814. } else {
  24815. return [[tr]];
  24816. }
  24817. } else if (Object.keys(treeData.value).length) {
  24818. assertRowKey();
  24819. const key = getRowIdentity(row, rowKey.value);
  24820. let cur = treeData.value[key];
  24821. let treeRowData = null;
  24822. if (cur) {
  24823. treeRowData = {
  24824. expanded: cur.expanded,
  24825. level: cur.level,
  24826. display: true
  24827. };
  24828. if (typeof cur.lazy === "boolean") {
  24829. if (typeof cur.loaded === "boolean" && cur.loaded) {
  24830. treeRowData.noLazyChildren = !(cur.children && cur.children.length);
  24831. }
  24832. treeRowData.loading = cur.loading;
  24833. }
  24834. }
  24835. const tmp = [rowRender(row, $index, treeRowData)];
  24836. if (cur) {
  24837. let i = 0;
  24838. const traverse = (children, parent2) => {
  24839. if (!(children && children.length && parent2))
  24840. return;
  24841. children.forEach((node) => {
  24842. const innerTreeRowData = {
  24843. display: parent2.display && parent2.expanded,
  24844. level: parent2.level + 1,
  24845. expanded: false,
  24846. noLazyChildren: false,
  24847. loading: false
  24848. };
  24849. const childKey = getRowIdentity(node, rowKey.value);
  24850. if (childKey === void 0 || childKey === null) {
  24851. throw new Error("For nested data item, row-key is required.");
  24852. }
  24853. cur = __spreadValues({}, treeData.value[childKey]);
  24854. if (cur) {
  24855. innerTreeRowData.expanded = cur.expanded;
  24856. cur.level = cur.level || innerTreeRowData.level;
  24857. cur.display = !!(cur.expanded && innerTreeRowData.display);
  24858. if (typeof cur.lazy === "boolean") {
  24859. if (typeof cur.loaded === "boolean" && cur.loaded) {
  24860. innerTreeRowData.noLazyChildren = !(cur.children && cur.children.length);
  24861. }
  24862. innerTreeRowData.loading = cur.loading;
  24863. }
  24864. }
  24865. i++;
  24866. tmp.push(rowRender(node, $index + i, innerTreeRowData));
  24867. if (cur) {
  24868. const nodes2 = lazyTreeNodeMap.value[childKey] || node[childrenColumnName.value];
  24869. traverse(nodes2, cur);
  24870. }
  24871. });
  24872. };
  24873. cur.display = true;
  24874. const nodes = lazyTreeNodeMap.value[key] || row[childrenColumnName.value];
  24875. traverse(nodes, cur);
  24876. }
  24877. return tmp;
  24878. } else {
  24879. return rowRender(row, $index, void 0);
  24880. }
  24881. };
  24882. return {
  24883. wrappedRowRender,
  24884. tooltipContent,
  24885. tooltipTrigger
  24886. };
  24887. }
  24888. const defaultProps$2 = {
  24889. store: {
  24890. required: true,
  24891. type: Object
  24892. },
  24893. stripe: Boolean,
  24894. tooltipEffect: String,
  24895. context: {
  24896. default: () => ({}),
  24897. type: Object
  24898. },
  24899. rowClassName: [String, Function],
  24900. rowStyle: [Object, Function],
  24901. fixed: {
  24902. type: String,
  24903. default: ""
  24904. },
  24905. highlight: Boolean
  24906. };
  24907. var TableBody = defineComponent({
  24908. name: "ElTableBody",
  24909. props: defaultProps$2,
  24910. setup(props) {
  24911. const instance = getCurrentInstance();
  24912. const parent = inject(TABLE_INJECTION_KEY);
  24913. const ns = useNamespace("table");
  24914. const { wrappedRowRender, tooltipContent, tooltipTrigger } = useRender$1(props);
  24915. const { onColumnsChange, onScrollableChange } = useLayoutObserver(parent);
  24916. watch(props.store.states.hoverRow, (newVal, oldVal) => {
  24917. if (!props.store.states.isComplex.value || !isClient$1)
  24918. return;
  24919. let raf = window.requestAnimationFrame;
  24920. if (!raf) {
  24921. raf = (fn2) => window.setTimeout(fn2, 16);
  24922. }
  24923. raf(() => {
  24924. var _a2;
  24925. const rows = (_a2 = instance == null ? void 0 : instance.vnode.el) == null ? void 0 : _a2.querySelectorAll(`.${ns.e("row")}`);
  24926. const oldRow = rows[oldVal];
  24927. const newRow = rows[newVal];
  24928. if (oldRow) {
  24929. removeClass(oldRow, "hover-row");
  24930. }
  24931. if (newRow) {
  24932. addClass(newRow, "hover-row");
  24933. }
  24934. });
  24935. });
  24936. onUnmounted(() => {
  24937. var _a2;
  24938. (_a2 = removePopper) == null ? void 0 : _a2();
  24939. });
  24940. onUpdated(() => {
  24941. var _a2;
  24942. (_a2 = removePopper) == null ? void 0 : _a2();
  24943. });
  24944. return {
  24945. ns,
  24946. onColumnsChange,
  24947. onScrollableChange,
  24948. wrappedRowRender,
  24949. tooltipContent,
  24950. tooltipTrigger
  24951. };
  24952. },
  24953. render() {
  24954. const { wrappedRowRender, store } = this;
  24955. const data2 = store.states.data.value || [];
  24956. return h$1("tbody", {}, [
  24957. data2.reduce((acc, row) => {
  24958. return acc.concat(wrappedRowRender(row, acc.length));
  24959. }, [])
  24960. ]);
  24961. }
  24962. });
  24963. function hColgroup(props) {
  24964. const isAuto = props.tableLayout === "auto";
  24965. let columns = props.columns || [];
  24966. if (isAuto) {
  24967. if (columns.every((column) => column.width === void 0)) {
  24968. columns = [];
  24969. }
  24970. }
  24971. const getPropsData = (column) => {
  24972. const propsData = {
  24973. key: `${props.tableLayout}_${column.id}`,
  24974. style: {},
  24975. name: void 0
  24976. };
  24977. if (isAuto) {
  24978. propsData.style = {
  24979. width: `${column.width}px`
  24980. };
  24981. } else {
  24982. propsData.name = column.id;
  24983. }
  24984. return propsData;
  24985. };
  24986. return h$1("colgroup", {}, columns.map((column) => h$1("col", getPropsData(column))));
  24987. }
  24988. hColgroup.props = ["columns", "tableLayout"];
  24989. function useMapState() {
  24990. const table = inject(TABLE_INJECTION_KEY);
  24991. const store = table == null ? void 0 : table.store;
  24992. const leftFixedLeafCount = computed(() => {
  24993. return store.states.fixedLeafColumnsLength.value;
  24994. });
  24995. const rightFixedLeafCount = computed(() => {
  24996. return store.states.rightFixedColumns.value.length;
  24997. });
  24998. const columnsCount = computed(() => {
  24999. return store.states.columns.value.length;
  25000. });
  25001. const leftFixedCount = computed(() => {
  25002. return store.states.fixedColumns.value.length;
  25003. });
  25004. const rightFixedCount = computed(() => {
  25005. return store.states.rightFixedColumns.value.length;
  25006. });
  25007. return {
  25008. leftFixedLeafCount,
  25009. rightFixedLeafCount,
  25010. columnsCount,
  25011. leftFixedCount,
  25012. rightFixedCount,
  25013. columns: store.states.columns
  25014. };
  25015. }
  25016. function useStyle$1(props) {
  25017. const { columns } = useMapState();
  25018. const ns = useNamespace("table");
  25019. const getCellClasses = (columns2, cellIndex) => {
  25020. const column = columns2[cellIndex];
  25021. const classes = [
  25022. ns.e("cell"),
  25023. column.id,
  25024. column.align,
  25025. column.labelClassName,
  25026. ...getFixedColumnsClass(ns.b(), cellIndex, column.fixed, props.store)
  25027. ];
  25028. if (column.className) {
  25029. classes.push(column.className);
  25030. }
  25031. if (!column.children) {
  25032. classes.push(ns.is("leaf"));
  25033. }
  25034. return classes;
  25035. };
  25036. const getCellStyles = (column, cellIndex) => {
  25037. const fixedStyle = getFixedColumnOffset(cellIndex, column.fixed, props.store);
  25038. ensurePosition(fixedStyle, "left");
  25039. ensurePosition(fixedStyle, "right");
  25040. return fixedStyle;
  25041. };
  25042. return {
  25043. getCellClasses,
  25044. getCellStyles,
  25045. columns
  25046. };
  25047. }
  25048. var TableFooter = defineComponent({
  25049. name: "ElTableFooter",
  25050. props: {
  25051. fixed: {
  25052. type: String,
  25053. default: ""
  25054. },
  25055. store: {
  25056. required: true,
  25057. type: Object
  25058. },
  25059. summaryMethod: Function,
  25060. sumText: String,
  25061. border: Boolean,
  25062. defaultSort: {
  25063. type: Object,
  25064. default: () => {
  25065. return {
  25066. prop: "",
  25067. order: ""
  25068. };
  25069. }
  25070. }
  25071. },
  25072. setup(props) {
  25073. const { getCellClasses, getCellStyles, columns } = useStyle$1(props);
  25074. const ns = useNamespace("table");
  25075. return {
  25076. ns,
  25077. getCellClasses,
  25078. getCellStyles,
  25079. columns
  25080. };
  25081. },
  25082. render() {
  25083. const {
  25084. columns,
  25085. getCellStyles,
  25086. getCellClasses,
  25087. summaryMethod,
  25088. sumText,
  25089. ns
  25090. } = this;
  25091. const data2 = this.store.states.data.value;
  25092. let sums = [];
  25093. if (summaryMethod) {
  25094. sums = summaryMethod({
  25095. columns,
  25096. data: data2
  25097. });
  25098. } else {
  25099. columns.forEach((column, index) => {
  25100. if (index === 0) {
  25101. sums[index] = sumText;
  25102. return;
  25103. }
  25104. const values = data2.map((item) => Number(item[column.property]));
  25105. const precisions = [];
  25106. let notNumber = true;
  25107. values.forEach((value) => {
  25108. if (!Number.isNaN(+value)) {
  25109. notNumber = false;
  25110. const decimal = `${value}`.split(".")[1];
  25111. precisions.push(decimal ? decimal.length : 0);
  25112. }
  25113. });
  25114. const precision = Math.max.apply(null, precisions);
  25115. if (!notNumber) {
  25116. sums[index] = values.reduce((prev, curr) => {
  25117. const value = Number(curr);
  25118. if (!Number.isNaN(+value)) {
  25119. return Number.parseFloat((prev + curr).toFixed(Math.min(precision, 20)));
  25120. } else {
  25121. return prev;
  25122. }
  25123. }, 0);
  25124. } else {
  25125. sums[index] = "";
  25126. }
  25127. });
  25128. }
  25129. return h$1("table", {
  25130. class: ns.e("footer"),
  25131. cellspacing: "0",
  25132. cellpadding: "0",
  25133. border: "0"
  25134. }, [
  25135. hColgroup({
  25136. columns
  25137. }),
  25138. h$1("tbody", [
  25139. h$1("tr", {}, [
  25140. ...columns.map((column, cellIndex) => h$1("td", {
  25141. key: cellIndex,
  25142. colspan: column.colSpan,
  25143. rowspan: column.rowSpan,
  25144. class: getCellClasses(columns, cellIndex),
  25145. style: getCellStyles(column, cellIndex)
  25146. }, [
  25147. h$1("div", {
  25148. class: ["cell", column.labelClassName]
  25149. }, [sums[cellIndex]])
  25150. ]))
  25151. ])
  25152. ])
  25153. ]);
  25154. }
  25155. });
  25156. function useUtils(store) {
  25157. const setCurrentRow = (row) => {
  25158. store.commit("setCurrentRow", row);
  25159. };
  25160. const getSelectionRows = () => {
  25161. return store.getSelectionRows();
  25162. };
  25163. const toggleRowSelection = (row, selected) => {
  25164. store.toggleRowSelection(row, selected, false);
  25165. store.updateAllSelected();
  25166. };
  25167. const clearSelection = () => {
  25168. store.clearSelection();
  25169. };
  25170. const clearFilter = (columnKeys) => {
  25171. store.clearFilter(columnKeys);
  25172. };
  25173. const toggleAllSelection = () => {
  25174. store.commit("toggleAllSelection");
  25175. };
  25176. const toggleRowExpansion = (row, expanded) => {
  25177. store.toggleRowExpansionAdapter(row, expanded);
  25178. };
  25179. const clearSort = () => {
  25180. store.clearSort();
  25181. };
  25182. const sort = (prop, order2) => {
  25183. store.commit("sort", { prop, order: order2 });
  25184. };
  25185. return {
  25186. setCurrentRow,
  25187. getSelectionRows,
  25188. toggleRowSelection,
  25189. clearSelection,
  25190. clearFilter,
  25191. toggleAllSelection,
  25192. toggleRowExpansion,
  25193. clearSort,
  25194. sort
  25195. };
  25196. }
  25197. function useStyle(props, layout, store, table) {
  25198. const isHidden = ref(false);
  25199. const renderExpanded = ref(null);
  25200. const resizeProxyVisible = ref(false);
  25201. const setDragVisible = (visible) => {
  25202. resizeProxyVisible.value = visible;
  25203. };
  25204. const resizeState = ref({
  25205. width: null,
  25206. height: null
  25207. });
  25208. const isGroup = ref(false);
  25209. const scrollbarViewStyle = {
  25210. display: "inline-block",
  25211. verticalAlign: "middle"
  25212. };
  25213. const tableWidth = ref();
  25214. watchEffect(() => {
  25215. layout.setHeight(props.height);
  25216. });
  25217. watchEffect(() => {
  25218. layout.setMaxHeight(props.maxHeight);
  25219. });
  25220. watch(() => [props.currentRowKey, store.states.rowKey], ([currentRowKey, rowKey]) => {
  25221. if (!unref(rowKey))
  25222. return;
  25223. store.setCurrentRowKey(`${currentRowKey}`);
  25224. }, {
  25225. immediate: true
  25226. });
  25227. watch(() => props.data, (data2) => {
  25228. table.store.commit("setData", data2);
  25229. }, {
  25230. immediate: true,
  25231. deep: true
  25232. });
  25233. watchEffect(() => {
  25234. if (props.expandRowKeys) {
  25235. store.setExpandRowKeysAdapter(props.expandRowKeys);
  25236. }
  25237. });
  25238. const handleMouseLeave = () => {
  25239. table.store.commit("setHoverRow", null);
  25240. if (table.hoverState)
  25241. table.hoverState = null;
  25242. };
  25243. const handleHeaderFooterMousewheel = (event, data2) => {
  25244. const { pixelX, pixelY } = data2;
  25245. if (Math.abs(pixelX) >= Math.abs(pixelY)) {
  25246. table.refs.bodyWrapper.scrollLeft += data2.pixelX / 5;
  25247. }
  25248. };
  25249. const shouldUpdateHeight = computed(() => {
  25250. return props.height || props.maxHeight || store.states.fixedColumns.value.length > 0 || store.states.rightFixedColumns.value.length > 0;
  25251. });
  25252. const tableBodyStyles = computed(() => {
  25253. return {
  25254. width: layout.bodyWidth.value ? `${layout.bodyWidth.value}px` : ""
  25255. };
  25256. });
  25257. const doLayout = () => {
  25258. if (shouldUpdateHeight.value) {
  25259. layout.updateElsHeight();
  25260. }
  25261. layout.updateColumnsWidth();
  25262. requestAnimationFrame(syncPostion);
  25263. };
  25264. onMounted(async () => {
  25265. await nextTick();
  25266. store.updateColumns();
  25267. bindEvents();
  25268. requestAnimationFrame(doLayout);
  25269. resizeState.value = {
  25270. width: tableWidth.value = table.vnode.el.offsetWidth,
  25271. height: table.vnode.el.offsetHeight
  25272. };
  25273. store.states.columns.value.forEach((column) => {
  25274. if (column.filteredValue && column.filteredValue.length) {
  25275. table.store.commit("filterChange", {
  25276. column,
  25277. values: column.filteredValue,
  25278. silent: true
  25279. });
  25280. }
  25281. });
  25282. table.$ready = true;
  25283. });
  25284. const setScrollClassByEl = (el, className) => {
  25285. if (!el)
  25286. return;
  25287. const classList = Array.from(el.classList).filter((item) => !item.startsWith("is-scrolling-"));
  25288. classList.push(layout.scrollX.value ? className : "is-scrolling-none");
  25289. el.className = classList.join(" ");
  25290. };
  25291. const setScrollClass = (className) => {
  25292. const { tableWrapper } = table.refs;
  25293. setScrollClassByEl(tableWrapper, className);
  25294. };
  25295. const hasScrollClass = (className) => {
  25296. const { tableWrapper } = table.refs;
  25297. if (tableWrapper && tableWrapper.classList.contains(className)) {
  25298. return true;
  25299. }
  25300. return false;
  25301. };
  25302. const syncPostion = function() {
  25303. if (!table.refs.scrollBarRef)
  25304. return;
  25305. if (!layout.scrollX.value) {
  25306. const scrollingNoneClass = "is-scrolling-none";
  25307. if (!hasScrollClass(scrollingNoneClass)) {
  25308. setScrollClass(scrollingNoneClass);
  25309. }
  25310. return;
  25311. }
  25312. const scrollContainer = table.refs.scrollBarRef.wrap$;
  25313. if (!scrollContainer)
  25314. return;
  25315. const { scrollLeft, offsetWidth, scrollWidth } = scrollContainer;
  25316. const { headerWrapper, footerWrapper } = table.refs;
  25317. if (headerWrapper)
  25318. headerWrapper.scrollLeft = scrollLeft;
  25319. if (footerWrapper)
  25320. footerWrapper.scrollLeft = scrollLeft;
  25321. const maxScrollLeftPosition = scrollWidth - offsetWidth - 1;
  25322. if (scrollLeft >= maxScrollLeftPosition) {
  25323. setScrollClass("is-scrolling-right");
  25324. } else if (scrollLeft === 0) {
  25325. setScrollClass("is-scrolling-left");
  25326. } else {
  25327. setScrollClass("is-scrolling-middle");
  25328. }
  25329. };
  25330. const bindEvents = () => {
  25331. var _a2;
  25332. if (!table.refs.scrollBarRef)
  25333. return;
  25334. (_a2 = table.refs.scrollBarRef.wrap$) == null ? void 0 : _a2.addEventListener("scroll", syncPostion, {
  25335. passive: true
  25336. });
  25337. if (props.fit) {
  25338. addResizeListener(table.vnode.el, resizeListener);
  25339. } else {
  25340. on(window, "resize", doLayout);
  25341. }
  25342. };
  25343. onBeforeUnmount(() => {
  25344. unbindEvents();
  25345. });
  25346. const unbindEvents = () => {
  25347. var _a2;
  25348. (_a2 = table.refs.scrollBarRef.wrap$) == null ? void 0 : _a2.removeEventListener("scroll", syncPostion, true);
  25349. if (props.fit) {
  25350. removeResizeListener(table.vnode.el, resizeListener);
  25351. } else {
  25352. off(window, "resize", doLayout);
  25353. }
  25354. };
  25355. const resizeListener = () => {
  25356. if (!table.$ready)
  25357. return;
  25358. let shouldUpdateLayout = false;
  25359. const el = table.vnode.el;
  25360. const { width: oldWidth, height: oldHeight } = resizeState.value;
  25361. const width = tableWidth.value = el.offsetWidth;
  25362. if (oldWidth !== width) {
  25363. shouldUpdateLayout = true;
  25364. }
  25365. const height2 = el.offsetHeight;
  25366. if ((props.height || shouldUpdateHeight.value) && oldHeight !== height2) {
  25367. shouldUpdateLayout = true;
  25368. }
  25369. if (shouldUpdateLayout) {
  25370. resizeState.value = {
  25371. width,
  25372. height: height2
  25373. };
  25374. doLayout();
  25375. }
  25376. };
  25377. const tableSize = useSize();
  25378. const bodyWidth = computed(() => {
  25379. const { bodyWidth: bodyWidth_, scrollY, gutterWidth } = layout;
  25380. return bodyWidth_.value ? `${bodyWidth_.value - (scrollY.value ? gutterWidth : 0)}px` : "";
  25381. });
  25382. const tableLayout = computed(() => {
  25383. if (props.maxHeight)
  25384. return "fixed";
  25385. return props.tableLayout;
  25386. });
  25387. function calcMaxHeight(maxHeight, footerHeight, headerHeight) {
  25388. const parsedMaxHeight = parseHeight(maxHeight);
  25389. const tableHeaderHeight = props.showHeader ? headerHeight : 0;
  25390. if (parsedMaxHeight === null)
  25391. return;
  25392. if (isString(parsedMaxHeight)) {
  25393. return `calc(${parsedMaxHeight} - ${footerHeight}px - ${tableHeaderHeight}px)`;
  25394. }
  25395. return parsedMaxHeight - footerHeight - tableHeaderHeight;
  25396. }
  25397. const height = computed(() => {
  25398. const headerHeight = layout.headerHeight.value || 0;
  25399. const bodyHeight2 = layout.bodyHeight.value;
  25400. const footerHeight = layout.footerHeight.value || 0;
  25401. if (props.height) {
  25402. return bodyHeight2 ? bodyHeight2 : void 0;
  25403. } else if (props.maxHeight) {
  25404. return calcMaxHeight(props.maxHeight, footerHeight, headerHeight);
  25405. }
  25406. return void 0;
  25407. });
  25408. const bodyHeight = computed(() => {
  25409. const headerHeight = layout.headerHeight.value || 0;
  25410. const bodyHeight2 = layout.bodyHeight.value;
  25411. const footerHeight = layout.footerHeight.value || 0;
  25412. if (props.height) {
  25413. return {
  25414. height: bodyHeight2 ? `${bodyHeight2}px` : ""
  25415. };
  25416. } else if (props.maxHeight) {
  25417. const maxHeight = calcMaxHeight(props.maxHeight, footerHeight, headerHeight);
  25418. if (maxHeight !== null) {
  25419. return {
  25420. "max-height": `${maxHeight}${isNumber(maxHeight) ? "px" : ""}`
  25421. };
  25422. }
  25423. }
  25424. return {};
  25425. });
  25426. const emptyBlockStyle = computed(() => {
  25427. if (props.data && props.data.length)
  25428. return null;
  25429. let height2 = "100%";
  25430. if (layout.appendHeight.value) {
  25431. height2 = `calc(100% - ${layout.appendHeight.value}px)`;
  25432. }
  25433. return {
  25434. width: tableWidth.value ? `${tableWidth.value}px` : "",
  25435. height: height2
  25436. };
  25437. });
  25438. const handleFixedMousewheel = (event, data2) => {
  25439. const bodyWrapper = table.refs.bodyWrapper;
  25440. if (Math.abs(data2.spinY) > 0) {
  25441. const currentScrollTop = bodyWrapper.scrollTop;
  25442. if (data2.pixelY < 0 && currentScrollTop !== 0) {
  25443. event.preventDefault();
  25444. }
  25445. if (data2.pixelY > 0 && bodyWrapper.scrollHeight - bodyWrapper.clientHeight > currentScrollTop) {
  25446. event.preventDefault();
  25447. }
  25448. bodyWrapper.scrollTop += Math.ceil(data2.pixelY / 5);
  25449. } else {
  25450. bodyWrapper.scrollLeft += Math.ceil(data2.pixelX / 5);
  25451. }
  25452. };
  25453. const fixedHeight = computed(() => {
  25454. if (props.maxHeight) {
  25455. if (props.showSummary) {
  25456. return {
  25457. bottom: 0
  25458. };
  25459. }
  25460. return {
  25461. bottom: layout.scrollX.value && props.data.length ? `${layout.gutterWidth}px` : ""
  25462. };
  25463. } else {
  25464. if (props.showSummary) {
  25465. return {
  25466. height: layout.tableHeight.value ? `${layout.tableHeight.value}px` : ""
  25467. };
  25468. }
  25469. return {
  25470. height: layout.viewportHeight.value ? `${layout.viewportHeight.value}px` : ""
  25471. };
  25472. }
  25473. });
  25474. const fixedBodyHeight = computed(() => {
  25475. if (props.height) {
  25476. return {
  25477. height: layout.fixedBodyHeight.value ? `${layout.fixedBodyHeight.value}px` : ""
  25478. };
  25479. } else if (props.maxHeight) {
  25480. let maxHeight = parseHeight(props.maxHeight);
  25481. if (typeof maxHeight === "number") {
  25482. maxHeight = layout.scrollX.value ? maxHeight - layout.gutterWidth : maxHeight;
  25483. if (props.showHeader) {
  25484. maxHeight -= layout.headerHeight.value;
  25485. }
  25486. maxHeight -= layout.footerHeight.value;
  25487. return {
  25488. "max-height": `${maxHeight}px`
  25489. };
  25490. }
  25491. }
  25492. return {};
  25493. });
  25494. return {
  25495. isHidden,
  25496. renderExpanded,
  25497. setDragVisible,
  25498. isGroup,
  25499. handleMouseLeave,
  25500. handleHeaderFooterMousewheel,
  25501. tableSize,
  25502. bodyHeight,
  25503. height,
  25504. emptyBlockStyle,
  25505. handleFixedMousewheel,
  25506. fixedHeight,
  25507. fixedBodyHeight,
  25508. resizeProxyVisible,
  25509. bodyWidth,
  25510. resizeState,
  25511. doLayout,
  25512. tableBodyStyles,
  25513. tableLayout,
  25514. scrollbarViewStyle
  25515. };
  25516. }
  25517. var defaultProps$1 = {
  25518. data: {
  25519. type: Array,
  25520. default: () => {
  25521. return [];
  25522. }
  25523. },
  25524. size: String,
  25525. width: [String, Number],
  25526. height: [String, Number],
  25527. maxHeight: [String, Number],
  25528. fit: {
  25529. type: Boolean,
  25530. default: true
  25531. },
  25532. stripe: Boolean,
  25533. border: Boolean,
  25534. rowKey: [String, Function],
  25535. showHeader: {
  25536. type: Boolean,
  25537. default: true
  25538. },
  25539. showSummary: Boolean,
  25540. sumText: String,
  25541. summaryMethod: Function,
  25542. rowClassName: [String, Function],
  25543. rowStyle: [Object, Function],
  25544. cellClassName: [String, Function],
  25545. cellStyle: [Object, Function],
  25546. headerRowClassName: [String, Function],
  25547. headerRowStyle: [Object, Function],
  25548. headerCellClassName: [String, Function],
  25549. headerCellStyle: [Object, Function],
  25550. highlightCurrentRow: Boolean,
  25551. currentRowKey: [String, Number],
  25552. emptyText: String,
  25553. expandRowKeys: Array,
  25554. defaultExpandAll: Boolean,
  25555. defaultSort: Object,
  25556. tooltipEffect: String,
  25557. spanMethod: Function,
  25558. selectOnIndeterminate: {
  25559. type: Boolean,
  25560. default: true
  25561. },
  25562. indent: {
  25563. type: Number,
  25564. default: 16
  25565. },
  25566. treeProps: {
  25567. type: Object,
  25568. default: () => {
  25569. return {
  25570. hasChildren: "hasChildren",
  25571. children: "children"
  25572. };
  25573. }
  25574. },
  25575. lazy: Boolean,
  25576. load: Function,
  25577. style: {
  25578. type: Object,
  25579. default: () => ({})
  25580. },
  25581. className: {
  25582. type: String,
  25583. default: ""
  25584. },
  25585. tableLayout: {
  25586. type: String,
  25587. default: "fixed"
  25588. },
  25589. scrollbarAlwaysOn: {
  25590. type: Boolean,
  25591. default: false
  25592. }
  25593. };
  25594. const useScrollbar = () => {
  25595. const scrollBarRef = ref();
  25596. const scrollTo = (options, yCoord) => {
  25597. const scrollbar = scrollBarRef.value;
  25598. if (scrollbar) {
  25599. scrollbar.scrollTo(options, yCoord);
  25600. }
  25601. };
  25602. const setScrollPosition = (position, offset2) => {
  25603. const scrollbar = scrollBarRef.value;
  25604. if (scrollbar && isNumber(offset2) && ["Top", "Left"].includes(position)) {
  25605. scrollbar[`setScroll${position}`](offset2);
  25606. }
  25607. };
  25608. const setScrollTop = (top2) => setScrollPosition("Top", top2);
  25609. const setScrollLeft = (left2) => setScrollPosition("Left", left2);
  25610. return {
  25611. scrollBarRef,
  25612. scrollTo,
  25613. setScrollTop,
  25614. setScrollLeft
  25615. };
  25616. };
  25617. let tableIdSeed = 1;
  25618. const _sfc_main$d = defineComponent({
  25619. name: "ElTable",
  25620. directives: {
  25621. Mousewheel
  25622. },
  25623. components: {
  25624. TableHeader,
  25625. TableBody,
  25626. TableFooter,
  25627. ElScrollbar,
  25628. hColgroup
  25629. },
  25630. props: defaultProps$1,
  25631. emits: [
  25632. "select",
  25633. "select-all",
  25634. "selection-change",
  25635. "cell-mouse-enter",
  25636. "cell-mouse-leave",
  25637. "cell-contextmenu",
  25638. "cell-click",
  25639. "cell-dblclick",
  25640. "row-click",
  25641. "row-contextmenu",
  25642. "row-dblclick",
  25643. "header-click",
  25644. "header-contextmenu",
  25645. "sort-change",
  25646. "filter-change",
  25647. "current-change",
  25648. "header-dragend",
  25649. "expand-change"
  25650. ],
  25651. setup(props) {
  25652. const { t } = useLocale();
  25653. const ns = useNamespace("table");
  25654. const table = getCurrentInstance();
  25655. provide(TABLE_INJECTION_KEY, table);
  25656. const store = createStore(table, props);
  25657. table.store = store;
  25658. const layout = new TableLayout({
  25659. store: table.store,
  25660. table,
  25661. fit: props.fit,
  25662. showHeader: props.showHeader
  25663. });
  25664. table.layout = layout;
  25665. const isEmpty3 = computed(() => (store.states.data.value || []).length === 0);
  25666. const {
  25667. setCurrentRow,
  25668. getSelectionRows,
  25669. toggleRowSelection,
  25670. clearSelection,
  25671. clearFilter,
  25672. toggleAllSelection,
  25673. toggleRowExpansion,
  25674. clearSort,
  25675. sort
  25676. } = useUtils(store);
  25677. const {
  25678. isHidden,
  25679. renderExpanded,
  25680. setDragVisible,
  25681. isGroup,
  25682. handleMouseLeave,
  25683. handleHeaderFooterMousewheel,
  25684. tableSize,
  25685. bodyHeight,
  25686. height,
  25687. emptyBlockStyle,
  25688. handleFixedMousewheel,
  25689. fixedHeight,
  25690. fixedBodyHeight,
  25691. resizeProxyVisible,
  25692. bodyWidth,
  25693. resizeState,
  25694. doLayout,
  25695. tableBodyStyles,
  25696. tableLayout,
  25697. scrollbarViewStyle
  25698. } = useStyle(props, layout, store, table);
  25699. const { scrollBarRef, scrollTo, setScrollLeft, setScrollTop } = useScrollbar();
  25700. const debouncedUpdateLayout = debounce$1(doLayout, 50);
  25701. const tableId = `el-table_${tableIdSeed++}`;
  25702. table.tableId = tableId;
  25703. table.state = {
  25704. isGroup,
  25705. resizeState,
  25706. doLayout,
  25707. debouncedUpdateLayout
  25708. };
  25709. const computedSumText = computed(() => props.sumText || t("el.table.sumText"));
  25710. const computedEmptyText = computed(() => {
  25711. return props.emptyText || t("el.table.emptyText");
  25712. });
  25713. return {
  25714. ns,
  25715. layout,
  25716. store,
  25717. handleHeaderFooterMousewheel,
  25718. handleMouseLeave,
  25719. tableId,
  25720. tableSize,
  25721. isHidden,
  25722. isEmpty: isEmpty3,
  25723. renderExpanded,
  25724. resizeProxyVisible,
  25725. resizeState,
  25726. isGroup,
  25727. bodyWidth,
  25728. bodyHeight,
  25729. height,
  25730. tableBodyStyles,
  25731. emptyBlockStyle,
  25732. debouncedUpdateLayout,
  25733. handleFixedMousewheel,
  25734. fixedHeight,
  25735. fixedBodyHeight,
  25736. setCurrentRow,
  25737. getSelectionRows,
  25738. toggleRowSelection,
  25739. clearSelection,
  25740. clearFilter,
  25741. toggleAllSelection,
  25742. toggleRowExpansion,
  25743. clearSort,
  25744. doLayout,
  25745. sort,
  25746. t,
  25747. setDragVisible,
  25748. context: table,
  25749. computedSumText,
  25750. computedEmptyText,
  25751. tableLayout,
  25752. scrollbarViewStyle,
  25753. scrollBarRef,
  25754. scrollTo,
  25755. setScrollLeft,
  25756. setScrollTop
  25757. };
  25758. }
  25759. });
  25760. const _hoisted_1$a = ["data-prefix"];
  25761. const _hoisted_2$8 = {
  25762. ref: "hiddenColumns",
  25763. class: "hidden-columns"
  25764. };
  25765. function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
  25766. const _component_hColgroup = resolveComponent("hColgroup");
  25767. const _component_table_header = resolveComponent("table-header");
  25768. const _component_table_body = resolveComponent("table-body");
  25769. const _component_el_scrollbar = resolveComponent("el-scrollbar");
  25770. const _component_table_footer = resolveComponent("table-footer");
  25771. const _directive_mousewheel = resolveDirective("mousewheel");
  25772. return openBlock(), createElementBlock("div", {
  25773. ref: "tableWrapper",
  25774. class: normalizeClass([
  25775. {
  25776. [_ctx.ns.m("fit")]: _ctx.fit,
  25777. [_ctx.ns.m("striped")]: _ctx.stripe,
  25778. [_ctx.ns.m("border")]: _ctx.border || _ctx.isGroup,
  25779. [_ctx.ns.m("hidden")]: _ctx.isHidden,
  25780. [_ctx.ns.m("group")]: _ctx.isGroup,
  25781. [_ctx.ns.m("fluid-height")]: _ctx.maxHeight,
  25782. [_ctx.ns.m("scrollable-x")]: _ctx.layout.scrollX.value,
  25783. [_ctx.ns.m("scrollable-y")]: _ctx.layout.scrollY.value,
  25784. [_ctx.ns.m("enable-row-hover")]: !_ctx.store.states.isComplex.value,
  25785. [_ctx.ns.m("enable-row-transition")]: (_ctx.store.states.data.value || []).length !== 0 && (_ctx.store.states.data.value || []).length < 100,
  25786. "has-footer": _ctx.showSummary
  25787. },
  25788. _ctx.ns.m(_ctx.tableSize),
  25789. _ctx.className,
  25790. _ctx.ns.b(),
  25791. _ctx.ns.m(`layout-${_ctx.tableLayout}`)
  25792. ]),
  25793. style: normalizeStyle(_ctx.style),
  25794. "data-prefix": _ctx.ns.namespace.value,
  25795. onMouseleave: _cache[0] || (_cache[0] = ($event) => _ctx.handleMouseLeave())
  25796. }, [
  25797. createElementVNode("div", {
  25798. class: normalizeClass(_ctx.ns.e("inner-wrapper"))
  25799. }, [
  25800. createElementVNode("div", _hoisted_2$8, [
  25801. renderSlot(_ctx.$slots, "default")
  25802. ], 512),
  25803. _ctx.showHeader && _ctx.tableLayout === "fixed" ? withDirectives((openBlock(), createElementBlock("div", {
  25804. key: 0,
  25805. ref: "headerWrapper",
  25806. class: normalizeClass(_ctx.ns.e("header-wrapper"))
  25807. }, [
  25808. createElementVNode("table", {
  25809. ref: "tableHeader",
  25810. class: normalizeClass(_ctx.ns.e("header")),
  25811. style: normalizeStyle(_ctx.tableBodyStyles),
  25812. border: "0",
  25813. cellpadding: "0",
  25814. cellspacing: "0"
  25815. }, [
  25816. createVNode(_component_hColgroup, {
  25817. columns: _ctx.store.states.columns.value,
  25818. "table-layout": _ctx.tableLayout
  25819. }, null, 8, ["columns", "table-layout"]),
  25820. createVNode(_component_table_header, {
  25821. ref: "tableHeaderRef",
  25822. border: _ctx.border,
  25823. "default-sort": _ctx.defaultSort,
  25824. store: _ctx.store,
  25825. onSetDragVisible: _ctx.setDragVisible
  25826. }, null, 8, ["border", "default-sort", "store", "onSetDragVisible"])
  25827. ], 6)
  25828. ], 2)), [
  25829. [_directive_mousewheel, _ctx.handleHeaderFooterMousewheel]
  25830. ]) : createCommentVNode("v-if", true),
  25831. createElementVNode("div", {
  25832. ref: "bodyWrapper",
  25833. style: normalizeStyle(_ctx.bodyHeight),
  25834. class: normalizeClass(_ctx.ns.e("body-wrapper"))
  25835. }, [
  25836. createVNode(_component_el_scrollbar, {
  25837. ref: "scrollBarRef",
  25838. height: _ctx.maxHeight ? void 0 : _ctx.height,
  25839. "max-height": _ctx.maxHeight ? _ctx.height : void 0,
  25840. "view-style": _ctx.scrollbarViewStyle,
  25841. always: _ctx.scrollbarAlwaysOn
  25842. }, {
  25843. default: withCtx(() => [
  25844. createElementVNode("table", {
  25845. ref: "tableBody",
  25846. class: normalizeClass(_ctx.ns.e("body")),
  25847. cellspacing: "0",
  25848. cellpadding: "0",
  25849. border: "0",
  25850. style: normalizeStyle({
  25851. width: _ctx.bodyWidth,
  25852. tableLayout: _ctx.tableLayout
  25853. })
  25854. }, [
  25855. createVNode(_component_hColgroup, {
  25856. columns: _ctx.store.states.columns.value,
  25857. "table-layout": _ctx.tableLayout
  25858. }, null, 8, ["columns", "table-layout"]),
  25859. _ctx.showHeader && _ctx.tableLayout === "auto" ? (openBlock(), createBlock(_component_table_header, {
  25860. key: 0,
  25861. border: _ctx.border,
  25862. "default-sort": _ctx.defaultSort,
  25863. store: _ctx.store,
  25864. onSetDragVisible: _ctx.setDragVisible
  25865. }, null, 8, ["border", "default-sort", "store", "onSetDragVisible"])) : createCommentVNode("v-if", true),
  25866. createVNode(_component_table_body, {
  25867. context: _ctx.context,
  25868. highlight: _ctx.highlightCurrentRow,
  25869. "row-class-name": _ctx.rowClassName,
  25870. "tooltip-effect": _ctx.tooltipEffect,
  25871. "row-style": _ctx.rowStyle,
  25872. store: _ctx.store,
  25873. stripe: _ctx.stripe
  25874. }, null, 8, ["context", "highlight", "row-class-name", "tooltip-effect", "row-style", "store", "stripe"])
  25875. ], 6),
  25876. _ctx.isEmpty ? (openBlock(), createElementBlock("div", {
  25877. key: 0,
  25878. ref: "emptyBlock",
  25879. style: normalizeStyle(_ctx.emptyBlockStyle),
  25880. class: normalizeClass(_ctx.ns.e("empty-block"))
  25881. }, [
  25882. createElementVNode("span", {
  25883. class: normalizeClass(_ctx.ns.e("empty-text"))
  25884. }, [
  25885. renderSlot(_ctx.$slots, "empty", {}, () => [
  25886. createTextVNode(toDisplayString(_ctx.computedEmptyText), 1)
  25887. ])
  25888. ], 2)
  25889. ], 6)) : createCommentVNode("v-if", true),
  25890. _ctx.$slots.append ? (openBlock(), createElementBlock("div", {
  25891. key: 1,
  25892. ref: "appendWrapper",
  25893. class: normalizeClass(_ctx.ns.e("append-wrapper"))
  25894. }, [
  25895. renderSlot(_ctx.$slots, "append")
  25896. ], 2)) : createCommentVNode("v-if", true)
  25897. ]),
  25898. _: 3
  25899. }, 8, ["height", "max-height", "view-style", "always"])
  25900. ], 6),
  25901. _ctx.border || _ctx.isGroup ? (openBlock(), createElementBlock("div", {
  25902. key: 1,
  25903. class: normalizeClass(_ctx.ns.e("border-left-patch"))
  25904. }, null, 2)) : createCommentVNode("v-if", true)
  25905. ], 2),
  25906. _ctx.showSummary ? withDirectives((openBlock(), createElementBlock("div", {
  25907. key: 0,
  25908. ref: "footerWrapper",
  25909. class: normalizeClass(_ctx.ns.e("footer-wrapper"))
  25910. }, [
  25911. createVNode(_component_table_footer, {
  25912. border: _ctx.border,
  25913. "default-sort": _ctx.defaultSort,
  25914. store: _ctx.store,
  25915. style: normalizeStyle(_ctx.tableBodyStyles),
  25916. "sum-text": _ctx.computedSumText,
  25917. "summary-method": _ctx.summaryMethod
  25918. }, null, 8, ["border", "default-sort", "store", "style", "sum-text", "summary-method"])
  25919. ], 2)), [
  25920. [vShow, !_ctx.isEmpty],
  25921. [_directive_mousewheel, _ctx.handleHeaderFooterMousewheel]
  25922. ]) : createCommentVNode("v-if", true),
  25923. withDirectives(createElementVNode("div", {
  25924. ref: "resizeProxy",
  25925. class: normalizeClass(_ctx.ns.e("column-resize-proxy"))
  25926. }, null, 2), [
  25927. [vShow, _ctx.resizeProxyVisible]
  25928. ])
  25929. ], 46, _hoisted_1$a);
  25930. }
  25931. var Table = /* @__PURE__ */ _export_sfc$1(_sfc_main$d, [["render", _sfc_render$2], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/table/src/table.vue"]]);
  25932. const defaultClassNames = {
  25933. selection: "table-column--selection",
  25934. expand: "table__expand-column"
  25935. };
  25936. const cellStarts = {
  25937. default: {
  25938. order: ""
  25939. },
  25940. selection: {
  25941. width: 48,
  25942. minWidth: 48,
  25943. realWidth: 48,
  25944. order: ""
  25945. },
  25946. expand: {
  25947. width: 48,
  25948. minWidth: 48,
  25949. realWidth: 48,
  25950. order: ""
  25951. },
  25952. index: {
  25953. width: 48,
  25954. minWidth: 48,
  25955. realWidth: 48,
  25956. order: ""
  25957. }
  25958. };
  25959. const getDefaultClassName = (type4) => {
  25960. return defaultClassNames[type4] || "";
  25961. };
  25962. const cellForced = {
  25963. selection: {
  25964. renderHeader({ store }) {
  25965. function isDisabled() {
  25966. return store.states.data.value && store.states.data.value.length === 0;
  25967. }
  25968. return h$1(ElCheckbox, {
  25969. disabled: isDisabled(),
  25970. size: store.states.tableSize.value,
  25971. indeterminate: store.states.selection.value.length > 0 && !store.states.isAllSelected.value,
  25972. "onUpdate:modelValue": store.toggleAllSelection,
  25973. modelValue: store.states.isAllSelected.value
  25974. });
  25975. },
  25976. renderCell({
  25977. row,
  25978. column,
  25979. store,
  25980. $index
  25981. }) {
  25982. return h$1(ElCheckbox, {
  25983. disabled: column.selectable ? !column.selectable.call(null, row, $index) : false,
  25984. size: store.states.tableSize.value,
  25985. onChange: () => {
  25986. store.commit("rowSelectedChanged", row);
  25987. },
  25988. onClick: (event) => event.stopPropagation(),
  25989. modelValue: store.isSelected(row)
  25990. });
  25991. },
  25992. sortable: false,
  25993. resizable: false
  25994. },
  25995. index: {
  25996. renderHeader({ column }) {
  25997. return column.label || "#";
  25998. },
  25999. renderCell({
  26000. column,
  26001. $index
  26002. }) {
  26003. let i = $index + 1;
  26004. const index = column.index;
  26005. if (typeof index === "number") {
  26006. i = $index + index;
  26007. } else if (typeof index === "function") {
  26008. i = index($index);
  26009. }
  26010. return h$1("div", {}, [i]);
  26011. },
  26012. sortable: false
  26013. },
  26014. expand: {
  26015. renderHeader({ column }) {
  26016. return column.label || "";
  26017. },
  26018. renderCell({
  26019. row,
  26020. store,
  26021. expanded
  26022. }) {
  26023. const { ns } = store;
  26024. const classes = [ns.e("expand-icon")];
  26025. if (expanded) {
  26026. classes.push(ns.em("expand-icon", "expanded"));
  26027. }
  26028. const callback = function(e) {
  26029. e.stopPropagation();
  26030. store.toggleRowExpansion(row);
  26031. };
  26032. return h$1("div", {
  26033. class: classes,
  26034. onClick: callback
  26035. }, {
  26036. default: () => {
  26037. return [
  26038. h$1(ElIcon, null, {
  26039. default: () => {
  26040. return [h$1(arrowRight)];
  26041. }
  26042. })
  26043. ];
  26044. }
  26045. });
  26046. },
  26047. sortable: false,
  26048. resizable: false
  26049. }
  26050. };
  26051. function defaultRenderCell({
  26052. row,
  26053. column,
  26054. $index
  26055. }) {
  26056. var _a2;
  26057. const property = column.property;
  26058. const value = property && getProp(row, property).value;
  26059. if (column && column.formatter) {
  26060. return column.formatter(row, column, value, $index);
  26061. }
  26062. return ((_a2 = value == null ? void 0 : value.toString) == null ? void 0 : _a2.call(value)) || "";
  26063. }
  26064. function treeCellPrefix({
  26065. row,
  26066. treeNode,
  26067. store
  26068. }, createPlacehoder = false) {
  26069. const { ns } = store;
  26070. if (!treeNode) {
  26071. if (createPlacehoder) {
  26072. return [
  26073. h$1("span", {
  26074. class: ns.e("placeholder")
  26075. })
  26076. ];
  26077. }
  26078. return null;
  26079. }
  26080. const ele = [];
  26081. const callback = function(e) {
  26082. e.stopPropagation();
  26083. store.loadOrToggle(row);
  26084. };
  26085. if (treeNode.indent) {
  26086. ele.push(h$1("span", {
  26087. class: ns.e("indent"),
  26088. style: { "padding-left": `${treeNode.indent}px` }
  26089. }));
  26090. }
  26091. if (typeof treeNode.expanded === "boolean" && !treeNode.noLazyChildren) {
  26092. const expandClasses = [
  26093. ns.e("expand-icon"),
  26094. treeNode.expanded ? ns.em("expand-icon", "expanded") : ""
  26095. ];
  26096. let icon = arrowRight;
  26097. if (treeNode.loading) {
  26098. icon = loading;
  26099. }
  26100. ele.push(h$1("div", {
  26101. class: expandClasses,
  26102. onClick: callback
  26103. }, {
  26104. default: () => {
  26105. return [
  26106. h$1(ElIcon, { class: { [ns.is("loading")]: treeNode.loading } }, {
  26107. default: () => [h$1(icon)]
  26108. })
  26109. ];
  26110. }
  26111. }));
  26112. } else {
  26113. ele.push(h$1("span", {
  26114. class: ns.e("placeholder")
  26115. }));
  26116. }
  26117. return ele;
  26118. }
  26119. function getAllAliases(props, aliases) {
  26120. return props.reduce((prev, cur) => {
  26121. prev[cur] = cur;
  26122. return prev;
  26123. }, aliases);
  26124. }
  26125. function useWatcher(owner, props_) {
  26126. const instance = getCurrentInstance();
  26127. const registerComplexWatchers = () => {
  26128. const props = ["fixed"];
  26129. const aliases = {
  26130. realWidth: "width",
  26131. realMinWidth: "minWidth"
  26132. };
  26133. const allAliases = getAllAliases(props, aliases);
  26134. Object.keys(allAliases).forEach((key) => {
  26135. const columnKey = aliases[key];
  26136. if (hasOwn(props_, columnKey)) {
  26137. watch(() => props_[columnKey], (newVal) => {
  26138. let value = newVal;
  26139. if (columnKey === "width" && key === "realWidth") {
  26140. value = parseWidth(newVal);
  26141. }
  26142. if (columnKey === "minWidth" && key === "realMinWidth") {
  26143. value = parseMinWidth(newVal);
  26144. }
  26145. instance.columnConfig.value[columnKey] = value;
  26146. instance.columnConfig.value[key] = value;
  26147. const updateColumns = columnKey === "fixed";
  26148. owner.value.store.scheduleLayout(updateColumns);
  26149. });
  26150. }
  26151. });
  26152. };
  26153. const registerNormalWatchers = () => {
  26154. const props = [
  26155. "label",
  26156. "filters",
  26157. "filterMultiple",
  26158. "sortable",
  26159. "index",
  26160. "formatter",
  26161. "className",
  26162. "labelClassName",
  26163. "showOverflowTooltip"
  26164. ];
  26165. const aliases = {
  26166. property: "prop",
  26167. align: "realAlign",
  26168. headerAlign: "realHeaderAlign"
  26169. };
  26170. const allAliases = getAllAliases(props, aliases);
  26171. Object.keys(allAliases).forEach((key) => {
  26172. const columnKey = aliases[key];
  26173. if (hasOwn(props_, columnKey)) {
  26174. watch(() => props_[columnKey], (newVal) => {
  26175. instance.columnConfig.value[key] = newVal;
  26176. });
  26177. }
  26178. });
  26179. };
  26180. return {
  26181. registerComplexWatchers,
  26182. registerNormalWatchers
  26183. };
  26184. }
  26185. function useRender(props, slots, owner) {
  26186. const instance = getCurrentInstance();
  26187. const columnId = ref("");
  26188. const isSubColumn = ref(false);
  26189. const realAlign = ref();
  26190. const realHeaderAlign = ref();
  26191. const ns = useNamespace("table");
  26192. watchEffect(() => {
  26193. realAlign.value = props.align ? `is-${props.align}` : null;
  26194. realAlign.value;
  26195. });
  26196. watchEffect(() => {
  26197. realHeaderAlign.value = props.headerAlign ? `is-${props.headerAlign}` : realAlign.value;
  26198. realHeaderAlign.value;
  26199. });
  26200. const columnOrTableParent = computed(() => {
  26201. let parent = instance.vnode.vParent || instance.parent;
  26202. while (parent && !parent.tableId && !parent.columnId) {
  26203. parent = parent.vnode.vParent || parent.parent;
  26204. }
  26205. return parent;
  26206. });
  26207. const hasTreeColumn = computed(() => {
  26208. const { store } = instance.parent;
  26209. if (!store)
  26210. return false;
  26211. const { treeData } = store.states;
  26212. const treeDataValue = treeData.value;
  26213. return treeDataValue && Object.keys(treeDataValue).length > 0;
  26214. });
  26215. const realWidth = ref(parseWidth(props.width));
  26216. const realMinWidth = ref(parseMinWidth(props.minWidth));
  26217. const setColumnWidth = (column) => {
  26218. if (realWidth.value)
  26219. column.width = realWidth.value;
  26220. if (realMinWidth.value) {
  26221. column.minWidth = realMinWidth.value;
  26222. }
  26223. if (!column.minWidth) {
  26224. column.minWidth = 80;
  26225. }
  26226. column.realWidth = Number(column.width === void 0 ? column.minWidth : column.width);
  26227. return column;
  26228. };
  26229. const setColumnForcedProps = (column) => {
  26230. const type4 = column.type;
  26231. const source = cellForced[type4] || {};
  26232. Object.keys(source).forEach((prop) => {
  26233. const value = source[prop];
  26234. if (prop !== "className" && value !== void 0) {
  26235. column[prop] = value;
  26236. }
  26237. });
  26238. const className = getDefaultClassName(type4);
  26239. if (className) {
  26240. const forceClass = `${unref(ns.namespace)}-${className}`;
  26241. column.className = column.className ? `${column.className} ${forceClass}` : forceClass;
  26242. }
  26243. return column;
  26244. };
  26245. const checkSubColumn = (children) => {
  26246. if (Array.isArray(children)) {
  26247. children.forEach((child) => check2(child));
  26248. } else {
  26249. check2(children);
  26250. }
  26251. function check2(item) {
  26252. var _a2;
  26253. if (((_a2 = item == null ? void 0 : item.type) == null ? void 0 : _a2.name) === "ElTableColumn") {
  26254. item.vParent = instance;
  26255. }
  26256. }
  26257. };
  26258. const setColumnRenders = (column) => {
  26259. if (props.renderHeader)
  26260. ;
  26261. else if (column.type !== "selection") {
  26262. column.renderHeader = (scope) => {
  26263. instance.columnConfig.value["label"];
  26264. const renderHeader = slots.header;
  26265. return renderHeader ? renderHeader(scope) : column.label;
  26266. };
  26267. }
  26268. let originRenderCell = column.renderCell;
  26269. const hasTreeColumnValue = hasTreeColumn.value;
  26270. if (column.type === "expand") {
  26271. column.renderCell = (data2) => h$1("div", {
  26272. class: "cell"
  26273. }, [originRenderCell(data2)]);
  26274. owner.value.renderExpanded = (data2) => {
  26275. return slots.default ? slots.default(data2) : slots.default;
  26276. };
  26277. } else {
  26278. originRenderCell = originRenderCell || defaultRenderCell;
  26279. column.renderCell = (data2) => {
  26280. let children = null;
  26281. if (slots.default) {
  26282. const vnodes = slots.default(data2);
  26283. children = vnodes.some((v2) => v2.type !== Comment) ? vnodes : originRenderCell(data2);
  26284. } else {
  26285. children = originRenderCell(data2);
  26286. }
  26287. const shouldCreatePlaceholder = hasTreeColumnValue && data2.cellIndex === 0;
  26288. const prefix = treeCellPrefix(data2, shouldCreatePlaceholder);
  26289. const props2 = {
  26290. class: "cell",
  26291. style: {}
  26292. };
  26293. if (column.showOverflowTooltip) {
  26294. props2.class = `${props2.class} ${unref(ns.namespace)}-tooltip`;
  26295. props2.style = {
  26296. width: `${(data2.column.realWidth || Number(data2.column.width)) - 1}px`
  26297. };
  26298. }
  26299. checkSubColumn(children);
  26300. return h$1("div", props2, [prefix, children]);
  26301. };
  26302. }
  26303. return column;
  26304. };
  26305. const getPropsData = (...propsKey) => {
  26306. return propsKey.reduce((prev, cur) => {
  26307. if (Array.isArray(cur)) {
  26308. cur.forEach((key) => {
  26309. prev[key] = props[key];
  26310. });
  26311. }
  26312. return prev;
  26313. }, {});
  26314. };
  26315. const getColumnElIndex = (children, child) => {
  26316. return Array.prototype.indexOf.call(children, child);
  26317. };
  26318. return {
  26319. columnId,
  26320. realAlign,
  26321. isSubColumn,
  26322. realHeaderAlign,
  26323. columnOrTableParent,
  26324. setColumnWidth,
  26325. setColumnForcedProps,
  26326. setColumnRenders,
  26327. getPropsData,
  26328. getColumnElIndex
  26329. };
  26330. }
  26331. var defaultProps = {
  26332. type: {
  26333. type: String,
  26334. default: "default"
  26335. },
  26336. label: String,
  26337. className: String,
  26338. labelClassName: String,
  26339. property: String,
  26340. prop: String,
  26341. width: {
  26342. type: [String, Number],
  26343. default: ""
  26344. },
  26345. minWidth: {
  26346. type: [String, Number],
  26347. default: ""
  26348. },
  26349. renderHeader: Function,
  26350. sortable: {
  26351. type: [Boolean, String],
  26352. default: false
  26353. },
  26354. sortMethod: Function,
  26355. sortBy: [String, Function, Array],
  26356. resizable: {
  26357. type: Boolean,
  26358. default: true
  26359. },
  26360. columnKey: String,
  26361. align: String,
  26362. headerAlign: String,
  26363. showTooltipWhenOverflow: Boolean,
  26364. showOverflowTooltip: Boolean,
  26365. fixed: [Boolean, String],
  26366. formatter: Function,
  26367. selectable: Function,
  26368. reserveSelection: Boolean,
  26369. filterMethod: Function,
  26370. filteredValue: Array,
  26371. filters: Array,
  26372. filterPlacement: String,
  26373. filterMultiple: {
  26374. type: Boolean,
  26375. default: true
  26376. },
  26377. index: [Number, Function],
  26378. sortOrders: {
  26379. type: Array,
  26380. default: () => {
  26381. return ["ascending", "descending", null];
  26382. },
  26383. validator: (val) => {
  26384. return val.every((order2) => ["ascending", "descending", null].includes(order2));
  26385. }
  26386. }
  26387. };
  26388. let columnIdSeed = 1;
  26389. var ElTableColumn$1 = defineComponent({
  26390. name: "ElTableColumn",
  26391. components: {
  26392. ElCheckbox
  26393. },
  26394. props: defaultProps,
  26395. setup(props, { slots }) {
  26396. const instance = getCurrentInstance();
  26397. const columnConfig = ref({});
  26398. const owner = computed(() => {
  26399. let parent2 = instance.parent;
  26400. while (parent2 && !parent2.tableId) {
  26401. parent2 = parent2.parent;
  26402. }
  26403. return parent2;
  26404. });
  26405. const { registerNormalWatchers, registerComplexWatchers } = useWatcher(owner, props);
  26406. const {
  26407. columnId,
  26408. isSubColumn,
  26409. realHeaderAlign,
  26410. columnOrTableParent,
  26411. setColumnWidth,
  26412. setColumnForcedProps,
  26413. setColumnRenders,
  26414. getPropsData,
  26415. getColumnElIndex,
  26416. realAlign
  26417. } = useRender(props, slots, owner);
  26418. const parent = columnOrTableParent.value;
  26419. columnId.value = `${parent.tableId || parent.columnId}_column_${columnIdSeed++}`;
  26420. onBeforeMount(() => {
  26421. isSubColumn.value = owner.value !== parent;
  26422. const type4 = props.type || "default";
  26423. const sortable = props.sortable === "" ? true : props.sortable;
  26424. const defaults = __spreadProps(__spreadValues({}, cellStarts[type4]), {
  26425. id: columnId.value,
  26426. type: type4,
  26427. property: props.prop || props.property,
  26428. align: realAlign,
  26429. headerAlign: realHeaderAlign,
  26430. showOverflowTooltip: props.showOverflowTooltip || props.showTooltipWhenOverflow,
  26431. filterable: props.filters || props.filterMethod,
  26432. filteredValue: [],
  26433. filterPlacement: "",
  26434. isColumnGroup: false,
  26435. isSubColumn: false,
  26436. filterOpened: false,
  26437. sortable,
  26438. index: props.index,
  26439. rawColumnKey: instance.vnode.key
  26440. });
  26441. const basicProps = [
  26442. "columnKey",
  26443. "label",
  26444. "className",
  26445. "labelClassName",
  26446. "type",
  26447. "renderHeader",
  26448. "formatter",
  26449. "fixed",
  26450. "resizable"
  26451. ];
  26452. const sortProps = ["sortMethod", "sortBy", "sortOrders"];
  26453. const selectProps = ["selectable", "reserveSelection"];
  26454. const filterProps = [
  26455. "filterMethod",
  26456. "filters",
  26457. "filterMultiple",
  26458. "filterOpened",
  26459. "filteredValue",
  26460. "filterPlacement"
  26461. ];
  26462. let column = getPropsData(basicProps, sortProps, selectProps, filterProps);
  26463. column = mergeOptions(defaults, column);
  26464. const chains = compose(setColumnRenders, setColumnWidth, setColumnForcedProps);
  26465. column = chains(column);
  26466. columnConfig.value = column;
  26467. registerNormalWatchers();
  26468. registerComplexWatchers();
  26469. });
  26470. onMounted(() => {
  26471. var _a2;
  26472. const parent2 = columnOrTableParent.value;
  26473. const children = isSubColumn.value ? parent2.vnode.el.children : (_a2 = parent2.refs.hiddenColumns) == null ? void 0 : _a2.children;
  26474. const getColumnIndex = () => getColumnElIndex(children || [], instance.vnode.el);
  26475. columnConfig.value.getColumnIndex = getColumnIndex;
  26476. const columnIndex = getColumnIndex();
  26477. columnIndex > -1 && owner.value.store.commit("insertColumn", columnConfig.value, isSubColumn.value ? parent2.columnConfig.value : null);
  26478. });
  26479. onBeforeUnmount(() => {
  26480. owner.value.store.commit("removeColumn", columnConfig.value, isSubColumn.value ? parent.columnConfig.value : null);
  26481. });
  26482. instance.columnId = columnId.value;
  26483. instance.columnConfig = columnConfig;
  26484. return;
  26485. },
  26486. render() {
  26487. var _a2, _b2, _c;
  26488. try {
  26489. const renderDefault = (_b2 = (_a2 = this.$slots).default) == null ? void 0 : _b2.call(_a2, {
  26490. row: {},
  26491. column: {},
  26492. $index: -1
  26493. });
  26494. const children = [];
  26495. if (Array.isArray(renderDefault)) {
  26496. for (const childNode of renderDefault) {
  26497. if (((_c = childNode.type) == null ? void 0 : _c.name) === "ElTableColumn" || childNode.shapeFlag & 2) {
  26498. children.push(childNode);
  26499. } else if (childNode.type === Fragment && Array.isArray(childNode.children)) {
  26500. childNode.children.forEach((vnode2) => {
  26501. if ((vnode2 == null ? void 0 : vnode2.patchFlag) !== 1024 && !isString(vnode2 == null ? void 0 : vnode2.children)) {
  26502. children.push(vnode2);
  26503. }
  26504. });
  26505. }
  26506. }
  26507. }
  26508. const vnode = h$1("div", children);
  26509. return vnode;
  26510. } catch (e) {
  26511. return h$1("div", []);
  26512. }
  26513. }
  26514. });
  26515. const ElTable = withInstall(Table, {
  26516. TableColumn: ElTableColumn$1
  26517. });
  26518. const ElTableColumn = withNoopInstall(ElTableColumn$1);
  26519. const SCOPE$1 = "ElUpload";
  26520. class UploadAjaxError extends Error {
  26521. constructor(message, status, method4, url2) {
  26522. super(message);
  26523. this.name = "UploadAjaxError";
  26524. this.status = status;
  26525. this.method = method4;
  26526. this.url = url2;
  26527. }
  26528. }
  26529. function getError(action, option, xhr) {
  26530. let msg;
  26531. if (xhr.response) {
  26532. msg = `${xhr.response.error || xhr.response}`;
  26533. } else if (xhr.responseText) {
  26534. msg = `${xhr.responseText}`;
  26535. } else {
  26536. msg = `fail to ${option.method} ${action} ${xhr.status}`;
  26537. }
  26538. return new UploadAjaxError(msg, xhr.status, option.method, action);
  26539. }
  26540. function getBody(xhr) {
  26541. const text = xhr.responseText || xhr.response;
  26542. if (!text) {
  26543. return text;
  26544. }
  26545. try {
  26546. return JSON.parse(text);
  26547. } catch (e) {
  26548. return text;
  26549. }
  26550. }
  26551. const ajaxUpload = (option) => {
  26552. if (typeof XMLHttpRequest === "undefined")
  26553. throwError(SCOPE$1, "XMLHttpRequest is undefined");
  26554. const xhr = new XMLHttpRequest();
  26555. const action = option.action;
  26556. if (xhr.upload) {
  26557. xhr.upload.addEventListener("progress", (evt) => {
  26558. const progressEvt = evt;
  26559. progressEvt.percent = evt.total > 0 ? evt.loaded / evt.total * 100 : 0;
  26560. option.onProgress(progressEvt);
  26561. });
  26562. }
  26563. const formData = new FormData();
  26564. if (option.data) {
  26565. for (const [key, value] of Object.entries(option.data)) {
  26566. if (Array.isArray(value))
  26567. formData.append(key, ...value);
  26568. else
  26569. formData.append(key, value);
  26570. }
  26571. }
  26572. formData.append(option.filename, option.file, option.file.name);
  26573. xhr.addEventListener("error", () => {
  26574. option.onError(getError(action, option, xhr));
  26575. });
  26576. xhr.addEventListener("load", () => {
  26577. if (xhr.status < 200 || xhr.status >= 300) {
  26578. return option.onError(getError(action, option, xhr));
  26579. }
  26580. option.onSuccess(getBody(xhr));
  26581. });
  26582. xhr.open(option.method, action, true);
  26583. if (option.withCredentials && "withCredentials" in xhr) {
  26584. xhr.withCredentials = true;
  26585. }
  26586. const headers = option.headers || {};
  26587. if (headers instanceof Headers) {
  26588. headers.forEach((value, key) => xhr.setRequestHeader(key, value));
  26589. } else {
  26590. for (const [key, value] of Object.entries(headers)) {
  26591. if (isNil(value))
  26592. continue;
  26593. xhr.setRequestHeader(key, String(value));
  26594. }
  26595. }
  26596. xhr.send(formData);
  26597. return xhr;
  26598. };
  26599. const uploadListTypes = ["text", "picture", "picture-card"];
  26600. let fileId = 1;
  26601. const genFileId = () => Date.now() + fileId++;
  26602. const uploadBaseProps = buildProps({
  26603. action: {
  26604. type: String,
  26605. required: true
  26606. },
  26607. headers: {
  26608. type: definePropType(Object)
  26609. },
  26610. method: {
  26611. type: String,
  26612. default: "post"
  26613. },
  26614. data: {
  26615. type: Object,
  26616. default: () => mutable({})
  26617. },
  26618. multiple: {
  26619. type: Boolean,
  26620. default: false
  26621. },
  26622. name: {
  26623. type: String,
  26624. default: "file"
  26625. },
  26626. drag: {
  26627. type: Boolean,
  26628. default: false
  26629. },
  26630. withCredentials: Boolean,
  26631. showFileList: {
  26632. type: Boolean,
  26633. default: true
  26634. },
  26635. accept: {
  26636. type: String,
  26637. default: ""
  26638. },
  26639. type: {
  26640. type: String,
  26641. default: "select"
  26642. },
  26643. fileList: {
  26644. type: definePropType(Array),
  26645. default: () => mutable([])
  26646. },
  26647. autoUpload: {
  26648. type: Boolean,
  26649. default: true
  26650. },
  26651. listType: {
  26652. type: String,
  26653. values: uploadListTypes,
  26654. default: "text"
  26655. },
  26656. httpRequest: {
  26657. type: definePropType(Function),
  26658. default: ajaxUpload
  26659. },
  26660. disabled: Boolean,
  26661. limit: Number
  26662. });
  26663. const uploadProps = buildProps(__spreadProps(__spreadValues({}, uploadBaseProps), {
  26664. beforeUpload: {
  26665. type: definePropType(Function),
  26666. default: NOOP
  26667. },
  26668. beforeRemove: {
  26669. type: definePropType(Function)
  26670. },
  26671. onRemove: {
  26672. type: definePropType(Function),
  26673. default: NOOP
  26674. },
  26675. onChange: {
  26676. type: definePropType(Function),
  26677. default: NOOP
  26678. },
  26679. onPreview: {
  26680. type: definePropType(Function),
  26681. default: NOOP
  26682. },
  26683. onSuccess: {
  26684. type: definePropType(Function),
  26685. default: NOOP
  26686. },
  26687. onProgress: {
  26688. type: definePropType(Function),
  26689. default: NOOP
  26690. },
  26691. onError: {
  26692. type: definePropType(Function),
  26693. default: NOOP
  26694. },
  26695. onExceed: {
  26696. type: definePropType(Function),
  26697. default: NOOP
  26698. }
  26699. }));
  26700. const uploadListProps = buildProps({
  26701. files: {
  26702. type: definePropType(Array),
  26703. default: () => mutable([])
  26704. },
  26705. disabled: {
  26706. type: Boolean,
  26707. default: false
  26708. },
  26709. handlePreview: {
  26710. type: definePropType(Function),
  26711. default: NOOP
  26712. },
  26713. listType: {
  26714. type: String,
  26715. values: uploadListTypes,
  26716. default: "text"
  26717. }
  26718. });
  26719. const uploadListEmits = {
  26720. remove: (file) => !!file
  26721. };
  26722. const _hoisted_1$9 = ["onKeydown"];
  26723. const _hoisted_2$7 = ["src"];
  26724. const _hoisted_3$5 = ["onClick"];
  26725. const _hoisted_4$5 = ["onClick"];
  26726. const _hoisted_5$5 = ["onClick"];
  26727. const __default__$4 = {
  26728. name: "ElUploadList"
  26729. };
  26730. const _sfc_main$c = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$4), {
  26731. props: uploadListProps,
  26732. emits: uploadListEmits,
  26733. setup(__props, { emit }) {
  26734. const props = __props;
  26735. const { t } = useLocale();
  26736. const nsUpload = useNamespace("upload");
  26737. const nsIcon = useNamespace("icon");
  26738. const nsList = useNamespace("list");
  26739. const focusing = ref(false);
  26740. const handleClick = (file) => {
  26741. props.handlePreview(file);
  26742. };
  26743. const onFileClicked = (e) => {
  26744. e.target.focus();
  26745. };
  26746. const handleRemove = (file) => {
  26747. emit("remove", file);
  26748. };
  26749. return (_ctx, _cache) => {
  26750. return openBlock(), createBlock(TransitionGroup, {
  26751. tag: "ul",
  26752. class: normalizeClass([
  26753. unref(nsUpload).b("list"),
  26754. unref(nsUpload).bm("list", _ctx.listType),
  26755. unref(nsUpload).is("disabled", _ctx.disabled)
  26756. ]),
  26757. name: unref(nsList).b()
  26758. }, {
  26759. default: withCtx(() => [
  26760. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.files, (file) => {
  26761. return openBlock(), createElementBlock("li", {
  26762. key: file.uid || file.name,
  26763. class: normalizeClass([
  26764. unref(nsUpload).be("list", "item"),
  26765. unref(nsUpload).is(file.status),
  26766. { focusing: focusing.value }
  26767. ]),
  26768. tabindex: "0",
  26769. onKeydown: withKeys(($event) => !_ctx.disabled && handleRemove(file), ["delete"]),
  26770. onFocus: _cache[0] || (_cache[0] = ($event) => focusing.value = true),
  26771. onBlur: _cache[1] || (_cache[1] = ($event) => focusing.value = false),
  26772. onClick: onFileClicked
  26773. }, [
  26774. renderSlot(_ctx.$slots, "default", { file }, () => [
  26775. _ctx.listType === "picture" || file.status !== "uploading" && _ctx.listType === "picture-card" ? (openBlock(), createElementBlock("img", {
  26776. key: 0,
  26777. class: normalizeClass(unref(nsUpload).be("list", "item-thumbnail")),
  26778. src: file.url,
  26779. alt: ""
  26780. }, null, 10, _hoisted_2$7)) : createCommentVNode("v-if", true),
  26781. _ctx.listType !== "picture" && (file.status === "uploading" || _ctx.listType !== "picture-card") ? (openBlock(), createElementBlock("div", {
  26782. key: 1,
  26783. class: normalizeClass(unref(nsUpload).be("list", "item-info"))
  26784. }, [
  26785. createElementVNode("a", {
  26786. class: normalizeClass(unref(nsUpload).be("list", "item-name")),
  26787. onClick: ($event) => handleClick(file)
  26788. }, [
  26789. createVNode(unref(ElIcon), {
  26790. class: normalizeClass(unref(nsIcon).m("document"))
  26791. }, {
  26792. default: withCtx(() => [
  26793. createVNode(unref(document$1))
  26794. ]),
  26795. _: 1
  26796. }, 8, ["class"]),
  26797. createTextVNode(" " + toDisplayString(file.name), 1)
  26798. ], 10, _hoisted_3$5),
  26799. file.status === "uploading" ? (openBlock(), createBlock(unref(ElProgress), {
  26800. key: 0,
  26801. type: _ctx.listType === "picture-card" ? "circle" : "line",
  26802. "stroke-width": _ctx.listType === "picture-card" ? 6 : 2,
  26803. percentage: Number(file.percentage),
  26804. style: normalizeStyle(_ctx.listType === "picture-card" ? "" : "margin-top: 0.5rem")
  26805. }, null, 8, ["type", "stroke-width", "percentage", "style"])) : createCommentVNode("v-if", true)
  26806. ], 2)) : createCommentVNode("v-if", true),
  26807. createElementVNode("label", {
  26808. class: normalizeClass(unref(nsUpload).be("list", "item-status-label"))
  26809. }, [
  26810. _ctx.listType === "text" ? (openBlock(), createBlock(unref(ElIcon), {
  26811. key: 0,
  26812. class: normalizeClass([unref(nsIcon).m("upload-success"), unref(nsIcon).m("circle-check")])
  26813. }, {
  26814. default: withCtx(() => [
  26815. createVNode(unref(circleCheck))
  26816. ]),
  26817. _: 1
  26818. }, 8, ["class"])) : ["picture-card", "picture"].includes(_ctx.listType) ? (openBlock(), createBlock(unref(ElIcon), {
  26819. key: 1,
  26820. class: normalizeClass([unref(nsIcon).m("upload-success"), unref(nsIcon).m("check")])
  26821. }, {
  26822. default: withCtx(() => [
  26823. createVNode(unref(check))
  26824. ]),
  26825. _: 1
  26826. }, 8, ["class"])) : createCommentVNode("v-if", true)
  26827. ], 2),
  26828. !_ctx.disabled ? (openBlock(), createBlock(unref(ElIcon), {
  26829. key: 2,
  26830. class: normalizeClass(unref(nsIcon).m("close")),
  26831. onClick: ($event) => handleRemove(file)
  26832. }, {
  26833. default: withCtx(() => [
  26834. createVNode(unref(close))
  26835. ]),
  26836. _: 2
  26837. }, 1032, ["class", "onClick"])) : createCommentVNode("v-if", true),
  26838. createCommentVNode(" Due to close btn only appears when li gets focused disappears after li gets blurred, thus keyboard navigation can never reach close btn"),
  26839. createCommentVNode(" This is a bug which needs to be fixed "),
  26840. createCommentVNode(" TODO: Fix the incorrect navigation interaction "),
  26841. !_ctx.disabled ? (openBlock(), createElementBlock("i", {
  26842. key: 3,
  26843. class: normalizeClass(unref(nsIcon).m("close-tip"))
  26844. }, toDisplayString(unref(t)("el.upload.deleteTip")), 3)) : createCommentVNode("v-if", true),
  26845. _ctx.listType === "picture-card" ? (openBlock(), createElementBlock("span", {
  26846. key: 4,
  26847. class: normalizeClass(unref(nsUpload).be("list", "item-actions"))
  26848. }, [
  26849. createElementVNode("span", {
  26850. class: normalizeClass(unref(nsUpload).be("list", "item-preview")),
  26851. onClick: ($event) => _ctx.handlePreview(file)
  26852. }, [
  26853. createVNode(unref(ElIcon), {
  26854. class: normalizeClass(unref(nsIcon).m("zoom-in"))
  26855. }, {
  26856. default: withCtx(() => [
  26857. createVNode(unref(zoomIn))
  26858. ]),
  26859. _: 1
  26860. }, 8, ["class"])
  26861. ], 10, _hoisted_4$5),
  26862. !_ctx.disabled ? (openBlock(), createElementBlock("span", {
  26863. key: 0,
  26864. class: normalizeClass(unref(nsUpload).be("list", "item-delete")),
  26865. onClick: ($event) => handleRemove(file)
  26866. }, [
  26867. createVNode(unref(ElIcon), {
  26868. class: normalizeClass(unref(nsIcon).m("delete"))
  26869. }, {
  26870. default: withCtx(() => [
  26871. createVNode(unref(_delete))
  26872. ]),
  26873. _: 1
  26874. }, 8, ["class"])
  26875. ], 10, _hoisted_5$5)) : createCommentVNode("v-if", true)
  26876. ], 2)) : createCommentVNode("v-if", true)
  26877. ])
  26878. ], 42, _hoisted_1$9);
  26879. }), 128)),
  26880. renderSlot(_ctx.$slots, "append")
  26881. ]),
  26882. _: 3
  26883. }, 8, ["class", "name"]);
  26884. };
  26885. }
  26886. }));
  26887. var UploadList = /* @__PURE__ */ _export_sfc$1(_sfc_main$c, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/upload/src/upload-list.vue"]]);
  26888. const uploadDraggerProps = buildProps({
  26889. disabled: {
  26890. type: Boolean,
  26891. default: false
  26892. }
  26893. });
  26894. const uploadDraggerEmits = {
  26895. file: (file) => isArray(file)
  26896. };
  26897. const _hoisted_1$8 = ["onDrop", "onDragover"];
  26898. const __default__$3 = {
  26899. name: "ElUploadDrag"
  26900. };
  26901. const _sfc_main$b = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$3), {
  26902. props: uploadDraggerProps,
  26903. emits: uploadDraggerEmits,
  26904. setup(__props, { emit }) {
  26905. const props = __props;
  26906. const COMPONENT_NAME2 = "ElUploadDrag";
  26907. const uploaderContext = inject(uploadContextKey);
  26908. if (!uploaderContext) {
  26909. throwError(COMPONENT_NAME2, "usage: <el-upload><el-upload-dragger /></el-upload>");
  26910. }
  26911. const ns = useNamespace("upload");
  26912. const dragover = ref(false);
  26913. const onDrop = (e) => {
  26914. if (props.disabled)
  26915. return;
  26916. dragover.value = false;
  26917. const files = Array.from(e.dataTransfer.files);
  26918. const accept = uploaderContext.accept.value;
  26919. if (!accept) {
  26920. emit("file", files);
  26921. return;
  26922. }
  26923. const filesFiltered = files.filter((file) => {
  26924. const { type: type4, name } = file;
  26925. const extension = name.includes(".") ? `.${name.split(".").pop()}` : "";
  26926. const baseType = type4.replace(/\/.*$/, "");
  26927. return accept.split(",").map((type22) => type22.trim()).filter((type22) => type22).some((acceptedType) => {
  26928. if (acceptedType.startsWith(".")) {
  26929. return extension === acceptedType;
  26930. }
  26931. if (/\/\*$/.test(acceptedType)) {
  26932. return baseType === acceptedType.replace(/\/\*$/, "");
  26933. }
  26934. if (/^[^/]+\/[^/]+$/.test(acceptedType)) {
  26935. return type4 === acceptedType;
  26936. }
  26937. return false;
  26938. });
  26939. });
  26940. emit("file", filesFiltered);
  26941. };
  26942. const onDragover = () => {
  26943. if (!props.disabled)
  26944. dragover.value = true;
  26945. };
  26946. return (_ctx, _cache) => {
  26947. return openBlock(), createElementBlock("div", {
  26948. class: normalizeClass([unref(ns).b("dragger"), unref(ns).is("dragover", dragover.value)]),
  26949. onDrop: withModifiers(onDrop, ["prevent"]),
  26950. onDragover: withModifiers(onDragover, ["prevent"]),
  26951. onDragleave: _cache[0] || (_cache[0] = withModifiers(($event) => dragover.value = false, ["prevent"]))
  26952. }, [
  26953. renderSlot(_ctx.$slots, "default")
  26954. ], 42, _hoisted_1$8);
  26955. };
  26956. }
  26957. }));
  26958. var UploadDragger = /* @__PURE__ */ _export_sfc$1(_sfc_main$b, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/upload/src/upload-dragger.vue"]]);
  26959. const uploadContentProps = buildProps(__spreadProps(__spreadValues({}, uploadBaseProps), {
  26960. fileList: {
  26961. type: definePropType(Array),
  26962. default: () => mutable([])
  26963. },
  26964. beforeUpload: {
  26965. type: definePropType(Function),
  26966. default: NOOP
  26967. },
  26968. onRemove: {
  26969. type: definePropType(Function),
  26970. default: NOOP
  26971. },
  26972. onStart: {
  26973. type: definePropType(Function),
  26974. default: NOOP
  26975. },
  26976. onSuccess: {
  26977. type: definePropType(Function),
  26978. default: NOOP
  26979. },
  26980. onProgress: {
  26981. type: definePropType(Function),
  26982. default: NOOP
  26983. },
  26984. onError: {
  26985. type: definePropType(Function),
  26986. default: NOOP
  26987. },
  26988. onExceed: {
  26989. type: definePropType(Function),
  26990. default: NOOP
  26991. }
  26992. }));
  26993. const _hoisted_1$7 = ["onKeydown"];
  26994. const _hoisted_2$6 = ["name", "multiple", "accept"];
  26995. const __default__$2 = {
  26996. name: "ElUploadContent",
  26997. inheritAttrs: false
  26998. };
  26999. const _sfc_main$a = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$2), {
  27000. props: uploadContentProps,
  27001. setup(__props, { expose }) {
  27002. const props = __props;
  27003. const ns = useNamespace("upload");
  27004. const requests = shallowRef({});
  27005. const inputRef = shallowRef();
  27006. const uploadFiles = (files) => {
  27007. if (files.length === 0)
  27008. return;
  27009. const { autoUpload, limit, fileList, multiple, onStart, onExceed } = props;
  27010. if (limit && fileList.length + files.length > limit) {
  27011. onExceed(files, fileList);
  27012. return;
  27013. }
  27014. if (!multiple) {
  27015. files = files.slice(0, 1);
  27016. }
  27017. for (const file of files) {
  27018. const rawFile = file;
  27019. rawFile.uid = genFileId();
  27020. onStart(rawFile);
  27021. if (autoUpload)
  27022. upload(rawFile);
  27023. }
  27024. };
  27025. const upload = async (rawFile) => {
  27026. inputRef.value.value = "";
  27027. if (!props.beforeUpload) {
  27028. return doUpload(rawFile);
  27029. }
  27030. let hookResult;
  27031. try {
  27032. hookResult = await props.beforeUpload(rawFile);
  27033. } catch (e) {
  27034. hookResult = false;
  27035. }
  27036. if (hookResult === false) {
  27037. props.onRemove(rawFile);
  27038. return;
  27039. }
  27040. let file = rawFile;
  27041. if (hookResult instanceof Blob) {
  27042. if (hookResult instanceof File) {
  27043. file = hookResult;
  27044. } else {
  27045. file = new File([hookResult], rawFile.name, {
  27046. type: rawFile.type
  27047. });
  27048. }
  27049. for (const key of Object.keys(rawFile)) {
  27050. file[key] = rawFile[key];
  27051. }
  27052. }
  27053. doUpload(rawFile);
  27054. };
  27055. const doUpload = (rawFile) => {
  27056. const {
  27057. headers,
  27058. data: data2,
  27059. method: method4,
  27060. withCredentials,
  27061. name: filename,
  27062. action,
  27063. onProgress,
  27064. onSuccess,
  27065. onError,
  27066. httpRequest
  27067. } = props;
  27068. const { uid: uid2 } = rawFile;
  27069. const options = {
  27070. headers: headers || {},
  27071. withCredentials,
  27072. file: rawFile,
  27073. data: data2,
  27074. method: method4,
  27075. filename,
  27076. action,
  27077. onProgress: (evt) => {
  27078. onProgress(evt, rawFile);
  27079. },
  27080. onSuccess: (res) => {
  27081. onSuccess(res, rawFile);
  27082. delete requests.value[uid2];
  27083. },
  27084. onError: (err) => {
  27085. onError(err, rawFile);
  27086. delete requests.value[uid2];
  27087. }
  27088. };
  27089. const request = httpRequest(options);
  27090. requests.value[uid2] = request;
  27091. if (request instanceof Promise) {
  27092. request.then(options.onSuccess, options.onError);
  27093. }
  27094. };
  27095. const handleChange2 = (e) => {
  27096. const files = e.target.files;
  27097. if (!files)
  27098. return;
  27099. uploadFiles(Array.from(files));
  27100. };
  27101. const handleClick = () => {
  27102. if (!props.disabled) {
  27103. inputRef.value.value = "";
  27104. inputRef.value.click();
  27105. }
  27106. };
  27107. const handleKeydown = () => {
  27108. handleClick();
  27109. };
  27110. const abort = (file) => {
  27111. const _reqs = entriesOf(requests.value).filter(file ? ([uid2]) => String(file.uid) === uid2 : () => true);
  27112. _reqs.forEach(([uid2, req]) => {
  27113. if (req instanceof XMLHttpRequest)
  27114. req.abort();
  27115. delete requests.value[uid2];
  27116. });
  27117. };
  27118. expose({
  27119. abort,
  27120. upload
  27121. });
  27122. return (_ctx, _cache) => {
  27123. return openBlock(), createElementBlock("div", {
  27124. class: normalizeClass([unref(ns).b(), unref(ns).m(_ctx.listType)]),
  27125. tabindex: "0",
  27126. onClick: handleClick,
  27127. onKeydown: withKeys(withModifiers(handleKeydown, ["self"]), ["enter", "space"])
  27128. }, [
  27129. _ctx.drag ? (openBlock(), createBlock(UploadDragger, {
  27130. key: 0,
  27131. disabled: _ctx.disabled,
  27132. onFile: uploadFiles
  27133. }, {
  27134. default: withCtx(() => [
  27135. renderSlot(_ctx.$slots, "default")
  27136. ]),
  27137. _: 3
  27138. }, 8, ["disabled"])) : renderSlot(_ctx.$slots, "default", { key: 1 }),
  27139. createElementVNode("input", {
  27140. ref_key: "inputRef",
  27141. ref: inputRef,
  27142. class: normalizeClass(unref(ns).e("input")),
  27143. name: _ctx.name,
  27144. multiple: _ctx.multiple,
  27145. accept: _ctx.accept,
  27146. type: "file",
  27147. onChange: handleChange2
  27148. }, null, 42, _hoisted_2$6)
  27149. ], 42, _hoisted_1$7);
  27150. };
  27151. }
  27152. }));
  27153. var UploadContent = /* @__PURE__ */ _export_sfc$1(_sfc_main$a, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/upload/src/upload-content.vue"]]);
  27154. const SCOPE = "ElUpload";
  27155. const revokeObjectURL = (file) => {
  27156. var _a2;
  27157. if ((_a2 = file.url) == null ? void 0 : _a2.startsWith("blob:")) {
  27158. URL.revokeObjectURL(file.url);
  27159. }
  27160. };
  27161. const useHandlers = (props, uploadRef) => {
  27162. const uploadFiles = ref([]);
  27163. const getFile = (rawFile) => uploadFiles.value.find((file) => file.uid === rawFile.uid);
  27164. function abort(file) {
  27165. var _a2;
  27166. (_a2 = uploadRef.value) == null ? void 0 : _a2.abort(file);
  27167. }
  27168. function clearFiles(states = ["ready", "uploading", "success", "fail"]) {
  27169. uploadFiles.value = uploadFiles.value.filter((row) => !states.includes(row.status));
  27170. }
  27171. const handleError = (err, rawFile) => {
  27172. const file = getFile(rawFile);
  27173. if (!file)
  27174. return;
  27175. file.status = "fail";
  27176. uploadFiles.value.splice(uploadFiles.value.indexOf(file), 1);
  27177. props.onError(err, file, uploadFiles.value);
  27178. props.onChange(file, uploadFiles.value);
  27179. };
  27180. const handleProgress = (evt, rawFile) => {
  27181. const file = getFile(rawFile);
  27182. if (!file)
  27183. return;
  27184. props.onProgress(evt, file, uploadFiles.value);
  27185. file.status = "uploading";
  27186. file.percentage = Math.round(evt.percent);
  27187. };
  27188. const handleSuccess = (response, rawFile) => {
  27189. const file = getFile(rawFile);
  27190. if (!file)
  27191. return;
  27192. file.status = "success";
  27193. file.response = response;
  27194. props.onSuccess(response, file, uploadFiles.value);
  27195. props.onChange(file, uploadFiles.value);
  27196. };
  27197. const handleStart = (file) => {
  27198. const uploadFile = {
  27199. name: file.name,
  27200. percentage: 0,
  27201. status: "ready",
  27202. size: file.size,
  27203. raw: file,
  27204. uid: file.uid
  27205. };
  27206. if (props.listType === "picture-card" || props.listType === "picture") {
  27207. try {
  27208. uploadFile.url = URL.createObjectURL(file);
  27209. } catch (err) {
  27210. debugWarn(SCOPE, err.message);
  27211. props.onError(err, uploadFile, uploadFiles.value);
  27212. }
  27213. }
  27214. uploadFiles.value.push(uploadFile);
  27215. props.onChange(uploadFile, uploadFiles.value);
  27216. };
  27217. const handleRemove = async (file, rawFile) => {
  27218. if (rawFile) {
  27219. useDeprecated({
  27220. scope: SCOPE,
  27221. from: "handleRemove second argument",
  27222. version: "2.2",
  27223. replacement: "first argument `file`",
  27224. ref: "https://element-plus.org/en-US/component/upload.html#methods"
  27225. }, true);
  27226. }
  27227. const _file = rawFile || file;
  27228. const uploadFile = _file instanceof File ? getFile(_file) : _file;
  27229. if (!uploadFile)
  27230. throwError(SCOPE, "file to be removed not found");
  27231. const doRemove = (file2) => {
  27232. abort(file2);
  27233. const fileList = uploadFiles.value;
  27234. fileList.splice(fileList.indexOf(file2), 1);
  27235. props.onRemove(file2, fileList);
  27236. revokeObjectURL(file2);
  27237. };
  27238. if (props.beforeRemove) {
  27239. const before = await props.beforeRemove(uploadFile, uploadFiles.value);
  27240. if (before !== false)
  27241. doRemove(uploadFile);
  27242. } else {
  27243. doRemove(uploadFile);
  27244. }
  27245. };
  27246. function submit() {
  27247. uploadFiles.value.filter(({ status }) => status === "ready").forEach(({ raw }) => {
  27248. var _a2;
  27249. return raw && ((_a2 = uploadRef.value) == null ? void 0 : _a2.upload(raw));
  27250. });
  27251. }
  27252. watch(() => props.listType, (val) => {
  27253. if (val !== "picture-card" && val !== "picture") {
  27254. return;
  27255. }
  27256. uploadFiles.value = uploadFiles.value.map((file) => {
  27257. const { raw, url: url2 } = file;
  27258. if (!url2 && raw) {
  27259. try {
  27260. file.url = URL.createObjectURL(raw);
  27261. } catch (err) {
  27262. props.onError(err, file, uploadFiles.value);
  27263. }
  27264. }
  27265. return file;
  27266. });
  27267. });
  27268. watch(() => props.fileList, (fileList) => {
  27269. for (const file of fileList) {
  27270. file.uid || (file.uid = genFileId());
  27271. file.status || (file.status = "success");
  27272. }
  27273. uploadFiles.value = fileList;
  27274. }, { immediate: true, deep: true });
  27275. return {
  27276. abort,
  27277. clearFiles,
  27278. handleError,
  27279. handleProgress,
  27280. handleStart,
  27281. handleSuccess,
  27282. handleRemove,
  27283. submit,
  27284. uploadFiles
  27285. };
  27286. };
  27287. const __default__$1 = {
  27288. name: "ElUpload"
  27289. };
  27290. const _sfc_main$9 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$1), {
  27291. props: uploadProps,
  27292. setup(__props, { expose }) {
  27293. const props = __props;
  27294. const slots = useSlots();
  27295. const disabled = useDisabled$1();
  27296. const uploadRef = shallowRef();
  27297. const {
  27298. abort,
  27299. submit,
  27300. clearFiles,
  27301. uploadFiles,
  27302. handleStart,
  27303. handleError,
  27304. handleRemove,
  27305. handleSuccess,
  27306. handleProgress
  27307. } = useHandlers(props, uploadRef);
  27308. const isPictureCard = computed(() => props.listType === "picture-card");
  27309. const uploadContentProps2 = computed(() => __spreadProps(__spreadValues({}, props), {
  27310. onStart: handleStart,
  27311. onProgress: handleProgress,
  27312. onSuccess: handleSuccess,
  27313. onError: handleError,
  27314. onRemove: handleRemove
  27315. }));
  27316. onBeforeUnmount(() => {
  27317. uploadFiles.value.forEach(({ url: url2 }) => {
  27318. if (url2 == null ? void 0 : url2.startsWith("blob:"))
  27319. URL.revokeObjectURL(url2);
  27320. });
  27321. });
  27322. provide(uploadContextKey, {
  27323. accept: toRef(props, "accept")
  27324. });
  27325. expose({
  27326. abort,
  27327. submit,
  27328. clearFiles,
  27329. handleStart,
  27330. handleRemove
  27331. });
  27332. return (_ctx, _cache) => {
  27333. return openBlock(), createElementBlock("div", null, [
  27334. unref(isPictureCard) && _ctx.showFileList ? (openBlock(), createBlock(UploadList, {
  27335. key: 0,
  27336. disabled: unref(disabled),
  27337. "list-type": _ctx.listType,
  27338. files: unref(uploadFiles),
  27339. "handle-preview": _ctx.onPreview,
  27340. onRemove: unref(handleRemove)
  27341. }, createSlots({
  27342. append: withCtx(() => [
  27343. _ctx.listType === "picture-card" ? (openBlock(), createBlock(UploadContent, mergeProps({
  27344. key: 0,
  27345. ref_key: "uploadRef",
  27346. ref: uploadRef
  27347. }, unref(uploadContentProps2)), {
  27348. default: withCtx(() => [
  27349. unref(slots).trigger ? renderSlot(_ctx.$slots, "trigger", { key: 0 }) : createCommentVNode("v-if", true),
  27350. !unref(slots).trigger && unref(slots).default ? renderSlot(_ctx.$slots, "default", { key: 1 }) : createCommentVNode("v-if", true)
  27351. ]),
  27352. _: 3
  27353. }, 16)) : createCommentVNode("v-if", true)
  27354. ]),
  27355. _: 2
  27356. }, [
  27357. _ctx.$slots.file ? {
  27358. name: "default",
  27359. fn: withCtx(({ file }) => [
  27360. renderSlot(_ctx.$slots, "file", { file })
  27361. ])
  27362. } : void 0
  27363. ]), 1032, ["disabled", "list-type", "files", "handle-preview", "onRemove"])) : createCommentVNode("v-if", true),
  27364. _ctx.listType !== "picture-card" ? (openBlock(), createBlock(UploadContent, mergeProps({
  27365. key: 1,
  27366. ref_key: "uploadRef",
  27367. ref: uploadRef
  27368. }, unref(uploadContentProps2)), {
  27369. default: withCtx(() => [
  27370. unref(slots).trigger ? renderSlot(_ctx.$slots, "trigger", { key: 0 }) : createCommentVNode("v-if", true),
  27371. !unref(slots).trigger && unref(slots).default ? renderSlot(_ctx.$slots, "default", { key: 1 }) : createCommentVNode("v-if", true)
  27372. ]),
  27373. _: 3
  27374. }, 16)) : createCommentVNode("v-if", true),
  27375. _ctx.$slots.trigger ? renderSlot(_ctx.$slots, "default", { key: 2 }) : createCommentVNode("v-if", true),
  27376. renderSlot(_ctx.$slots, "tip"),
  27377. !unref(isPictureCard) && _ctx.showFileList ? (openBlock(), createBlock(UploadList, {
  27378. key: 3,
  27379. disabled: unref(disabled),
  27380. "list-type": _ctx.listType,
  27381. files: unref(uploadFiles),
  27382. "handle-preview": _ctx.onPreview,
  27383. onRemove: unref(handleRemove)
  27384. }, createSlots({ _: 2 }, [
  27385. _ctx.$slots.file ? {
  27386. name: "default",
  27387. fn: withCtx(({ file }) => [
  27388. renderSlot(_ctx.$slots, "file", { file })
  27389. ])
  27390. } : void 0
  27391. ]), 1032, ["disabled", "list-type", "files", "handle-preview", "onRemove"])) : createCommentVNode("v-if", true)
  27392. ]);
  27393. };
  27394. }
  27395. }));
  27396. var Upload = /* @__PURE__ */ _export_sfc$1(_sfc_main$9, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/upload/src/upload.vue"]]);
  27397. const ElUpload = withInstall(Upload);
  27398. var base = "";
  27399. var elDialog = "";
  27400. var elOverlay = "";
  27401. var elButton = "";
  27402. var elForm = "";
  27403. var elFormItem = "";
  27404. var elCascader = "";
  27405. var elInput = "";
  27406. var elPopper = "";
  27407. var elTag = "";
  27408. var elCascaderPanel = "";
  27409. var elCheckbox = "";
  27410. var elRadio = "";
  27411. var elScrollbar = "";
  27412. var elUpload = "";
  27413. var elProgress = "";
  27414. var elImage = "";
  27415. var elImageViewer = "";
  27416. var elSlider = "";
  27417. var elInputNumber = "";
  27418. var elTooltip = "";
  27419. var elSwitch = "";
  27420. var elOption = "";
  27421. var elOptionGroup = "";
  27422. var elSelect = "";
  27423. var elRate = "";
  27424. var elDatePicker = "";
  27425. var elConfigProvider = "";
  27426. var elTimePicker = "";
  27427. var elCheckboxGroup = "";
  27428. var elRadioGroup = "";
  27429. var elDivider = "";
  27430. var elTable = "";
  27431. var elTableColumn = "";
  27432. var zhCn = {
  27433. name: "zh-cn",
  27434. el: {
  27435. colorpicker: {
  27436. confirm: "\u786E\u5B9A",
  27437. clear: "\u6E05\u7A7A"
  27438. },
  27439. datepicker: {
  27440. now: "\u6B64\u523B",
  27441. today: "\u4ECA\u5929",
  27442. cancel: "\u53D6\u6D88",
  27443. clear: "\u6E05\u7A7A",
  27444. confirm: "\u786E\u5B9A",
  27445. selectDate: "\u9009\u62E9\u65E5\u671F",
  27446. selectTime: "\u9009\u62E9\u65F6\u95F4",
  27447. startDate: "\u5F00\u59CB\u65E5\u671F",
  27448. startTime: "\u5F00\u59CB\u65F6\u95F4",
  27449. endDate: "\u7ED3\u675F\u65E5\u671F",
  27450. endTime: "\u7ED3\u675F\u65F6\u95F4",
  27451. prevYear: "\u524D\u4E00\u5E74",
  27452. nextYear: "\u540E\u4E00\u5E74",
  27453. prevMonth: "\u4E0A\u4E2A\u6708",
  27454. nextMonth: "\u4E0B\u4E2A\u6708",
  27455. year: "\u5E74",
  27456. month1: "1 \u6708",
  27457. month2: "2 \u6708",
  27458. month3: "3 \u6708",
  27459. month4: "4 \u6708",
  27460. month5: "5 \u6708",
  27461. month6: "6 \u6708",
  27462. month7: "7 \u6708",
  27463. month8: "8 \u6708",
  27464. month9: "9 \u6708",
  27465. month10: "10 \u6708",
  27466. month11: "11 \u6708",
  27467. month12: "12 \u6708",
  27468. weeks: {
  27469. sun: "\u65E5",
  27470. mon: "\u4E00",
  27471. tue: "\u4E8C",
  27472. wed: "\u4E09",
  27473. thu: "\u56DB",
  27474. fri: "\u4E94",
  27475. sat: "\u516D"
  27476. },
  27477. months: {
  27478. jan: "\u4E00\u6708",
  27479. feb: "\u4E8C\u6708",
  27480. mar: "\u4E09\u6708",
  27481. apr: "\u56DB\u6708",
  27482. may: "\u4E94\u6708",
  27483. jun: "\u516D\u6708",
  27484. jul: "\u4E03\u6708",
  27485. aug: "\u516B\u6708",
  27486. sep: "\u4E5D\u6708",
  27487. oct: "\u5341\u6708",
  27488. nov: "\u5341\u4E00\u6708",
  27489. dec: "\u5341\u4E8C\u6708"
  27490. }
  27491. },
  27492. select: {
  27493. loading: "\u52A0\u8F7D\u4E2D",
  27494. noMatch: "\u65E0\u5339\u914D\u6570\u636E",
  27495. noData: "\u65E0\u6570\u636E",
  27496. placeholder: "\u8BF7\u9009\u62E9"
  27497. },
  27498. cascader: {
  27499. noMatch: "\u65E0\u5339\u914D\u6570\u636E",
  27500. loading: "\u52A0\u8F7D\u4E2D",
  27501. placeholder: "\u8BF7\u9009\u62E9",
  27502. noData: "\u6682\u65E0\u6570\u636E"
  27503. },
  27504. pagination: {
  27505. goto: "\u524D\u5F80",
  27506. pagesize: "\u6761/\u9875",
  27507. total: "\u5171 {total} \u6761",
  27508. pageClassifier: "\u9875",
  27509. deprecationWarning: "\u4F60\u4F7F\u7528\u4E86\u4E00\u4E9B\u5DF2\u88AB\u5E9F\u5F03\u7684\u7528\u6CD5\uFF0C\u8BF7\u53C2\u8003 el-pagination \u7684\u5B98\u65B9\u6587\u6863"
  27510. },
  27511. messagebox: {
  27512. title: "\u63D0\u793A",
  27513. confirm: "\u786E\u5B9A",
  27514. cancel: "\u53D6\u6D88",
  27515. error: "\u8F93\u5165\u7684\u6570\u636E\u4E0D\u5408\u6CD5!"
  27516. },
  27517. upload: {
  27518. deleteTip: "\u6309 delete \u952E\u53EF\u5220\u9664",
  27519. delete: "\u5220\u9664",
  27520. preview: "\u67E5\u770B\u56FE\u7247",
  27521. continue: "\u7EE7\u7EED\u4E0A\u4F20"
  27522. },
  27523. table: {
  27524. emptyText: "\u6682\u65E0\u6570\u636E",
  27525. confirmFilter: "\u7B5B\u9009",
  27526. resetFilter: "\u91CD\u7F6E",
  27527. clearFilter: "\u5168\u90E8",
  27528. sumText: "\u5408\u8BA1"
  27529. },
  27530. tree: {
  27531. emptyText: "\u6682\u65E0\u6570\u636E"
  27532. },
  27533. transfer: {
  27534. noMatch: "\u65E0\u5339\u914D\u6570\u636E",
  27535. noData: "\u65E0\u6570\u636E",
  27536. titles: ["\u5217\u8868 1", "\u5217\u8868 2"],
  27537. filterPlaceholder: "\u8BF7\u8F93\u5165\u641C\u7D22\u5185\u5BB9",
  27538. noCheckedFormat: "\u5171 {total} \u9879",
  27539. hasCheckedFormat: "\u5DF2\u9009 {checked}/{total} \u9879"
  27540. },
  27541. image: {
  27542. error: "\u52A0\u8F7D\u5931\u8D25"
  27543. },
  27544. pageHeader: {
  27545. title: "\u8FD4\u56DE"
  27546. },
  27547. popconfirm: {
  27548. confirmButtonText: "\u786E\u5B9A",
  27549. cancelButtonText: "\u53D6\u6D88"
  27550. }
  27551. }
  27552. };
  27553. var GenerateFormItem_vue_vue_type_style_index_0_scoped_true_lang = "";
  27554. var _export_sfc = (sfc, props) => {
  27555. const target = sfc.__vccOpts || sfc;
  27556. for (const [key, val] of props) {
  27557. target[key] = val;
  27558. }
  27559. return target;
  27560. };
  27561. const _withScopeId = (n) => (pushScopeId("data-v-fd931432"), n = n(), popScopeId(), n);
  27562. const _hoisted_1$6 = { key: 12 };
  27563. const _hoisted_2$5 = {
  27564. key: 1,
  27565. class: "custom:insert"
  27566. };
  27567. const _hoisted_3$4 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("i", { class: "custom:img-upload mr-2" }, null, -1));
  27568. const _hoisted_4$4 = /* @__PURE__ */ createTextVNode("\u70B9\u51FB\u4E0A\u4F20 ");
  27569. const _hoisted_5$4 = ["href"];
  27570. const _hoisted_6$4 = /* @__PURE__ */ createTextVNode(" \u4E0B\u8F7D ");
  27571. const _sfc_main$8 = /* @__PURE__ */ defineComponent({
  27572. props: {
  27573. config: null,
  27574. element: null,
  27575. model: null,
  27576. updatedModel: null,
  27577. disabled: { type: Boolean },
  27578. request: null,
  27579. widgetFormData: null
  27580. },
  27581. emits: ["updateWidgetForm"],
  27582. setup(__props, { emit: emits }) {
  27583. const props = __props;
  27584. const originData = props.model[props.element.model];
  27585. const data2 = computed({
  27586. get: () => props.model[props.element.model],
  27587. set: (val) => {
  27588. props.model[props.element.model] = val;
  27589. if (JSON.stringify(originData) === JSON.stringify(val)) {
  27590. Reflect.deleteProperty(props.updatedModel, props.element.model);
  27591. } else {
  27592. props.updatedModel[props.element.model] = val;
  27593. }
  27594. }
  27595. });
  27596. const handleUploadSuccess = (_res, _file, fileList) => {
  27597. data2.value = fileList;
  27598. };
  27599. async function download(defaultValue, label) {
  27600. const a2 = document.createElement("a");
  27601. if (!props.request)
  27602. return;
  27603. a2.href = await props.request({
  27604. url: `/sys/common/static/${defaultValue}`,
  27605. responseType: "blob"
  27606. }).then((i) => {
  27607. if (i.size === 0)
  27608. return "";
  27609. return URL.createObjectURL(i);
  27610. });
  27611. a2.download = `${label}.${defaultValue.split(".")[1]}`;
  27612. a2.click();
  27613. }
  27614. const specializedHandleSelect = (val, element) => {
  27615. const field = element.model;
  27616. if (field == "customerId") {
  27617. let list = JSON.parse(JSON.stringify(props.widgetFormData));
  27618. for (var i in list) {
  27619. if (list[i].list[0].model == "contactsId") {
  27620. let item = list[i].list[0];
  27621. const token = sessionStorage.getItem("token");
  27622. fetch(`${item.options.remoteFunc}?customerId=${val}`, {
  27623. headers: {
  27624. "Content-type": " application/x-www-form-urlencoded; charset=UTF-8",
  27625. "Token": token
  27626. }
  27627. }).then((resp) => resp.json()).then((json) => {
  27628. const res = json.data;
  27629. if (res instanceof Array) {
  27630. item.options.remoteOptions = res.map((data22) => ({
  27631. label: data22[item.options.props.label],
  27632. value: data22[item.options.props.value],
  27633. children: data22[item.options.props.children]
  27634. }));
  27635. }
  27636. list[i].list[0].options = __spreadProps(__spreadValues({}, list[i].list[0].options), { disabled: false, defaultValue: "" });
  27637. });
  27638. }
  27639. }
  27640. setTimeout(() => {
  27641. console.log("\u5F00\u59CB\u6267\u884C");
  27642. updateWidgetForm(list);
  27643. }, 100);
  27644. }
  27645. };
  27646. const updateWidgetForm = (list) => {
  27647. emits("updateWidgetForm", list);
  27648. };
  27649. return (_ctx, _cache) => {
  27650. const _component_GenerateFormItem = resolveComponent("GenerateFormItem", true);
  27651. const _component_el_table_column = ElTableColumn;
  27652. const _component_el_table = ElTable;
  27653. const _component_el_divider = ElDivider;
  27654. const _component_el_input = ElInput;
  27655. const _component_el_input_number = ElInputNumber;
  27656. const _component_el_radio = ElRadio;
  27657. const _component_el_radio_group = ElRadioGroup;
  27658. const _component_el_checkbox = ElCheckbox;
  27659. const _component_el_checkbox_group = ElCheckboxGroup$1;
  27660. const _component_el_time_picker = ElTimePicker;
  27661. const _component_el_config_provider = ElConfigProvider;
  27662. const _component_el_date_picker = ElDatePicker;
  27663. const _component_el_rate = ElRate;
  27664. const _component_el_option = ElOption;
  27665. const _component_el_select = ElSelect;
  27666. const _component_el_switch = ElSwitch;
  27667. const _component_el_slider = ElSlider;
  27668. const _component_el_image = ElImage;
  27669. const _component_el_button = ElButton;
  27670. const _component_el_upload = ElUpload;
  27671. const _component_el_cascader = ElCascader;
  27672. const _component_el_form_item = ElFormItem;
  27673. return __props.element.type === "grid" ? (openBlock(), createElementBlock("div", {
  27674. key: 0,
  27675. grid: "~ cols-24",
  27676. style: normalizeStyle(`gap: ${__props.element.options.gutter}px; align-items: ${__props.element.options.align};`)
  27677. }, [
  27678. (openBlock(true), createElementBlock(Fragment, null, renderList(__props.element.columns, (col, colIndex) => {
  27679. return openBlock(), createElementBlock("div", {
  27680. key: colIndex,
  27681. style: normalizeStyle(`grid-column: span ${col.span}`)
  27682. }, [
  27683. (openBlock(true), createElementBlock(Fragment, null, renderList(col.list, (colItem) => {
  27684. return openBlock(), createBlock(_component_GenerateFormItem, {
  27685. key: colItem.key,
  27686. request: __props.request,
  27687. model: __props.model,
  27688. "updated-model": __props.updatedModel,
  27689. element: colItem,
  27690. config: __props.config,
  27691. disabled: __props.disabled,
  27692. widgetFormData: __props.element.columns,
  27693. onUpdateWidgetForm: updateWidgetForm
  27694. }, null, 8, ["request", "model", "updated-model", "element", "config", "disabled", "widgetFormData"]);
  27695. }), 128))
  27696. ], 4);
  27697. }), 128))
  27698. ], 4)) : __props.element.type === "table" ? (openBlock(), createBlock(_component_el_table, {
  27699. key: 1,
  27700. border: "",
  27701. class: "mb-4.5",
  27702. data: __props.element.options.defaultValue
  27703. }, {
  27704. default: withCtx(() => [
  27705. (openBlock(true), createElementBlock(Fragment, null, renderList(__props.element.columns, (i) => {
  27706. return openBlock(), createBlock(_component_el_table_column, mergeProps({
  27707. key: i.prop,
  27708. align: __props.element.options.align
  27709. }, i), null, 16, ["align"]);
  27710. }), 128))
  27711. ]),
  27712. _: 1
  27713. }, 8, ["data"])) : __props.element.type === "divider" ? (openBlock(), createBlock(_component_el_divider, {
  27714. key: 2,
  27715. data: __props.element.options.defaultValue,
  27716. "content-position": "left"
  27717. }, {
  27718. default: withCtx(() => [
  27719. createTextVNode(toDisplayString(__props.element.label), 1)
  27720. ]),
  27721. _: 1
  27722. }, 8, ["data"])) : __props.element ? (openBlock(), createBlock(_component_el_form_item, {
  27723. key: __props.element.key,
  27724. label: __props.element.label,
  27725. prop: __props.element.model,
  27726. style: normalizeStyle(__props.element.type === "download" ? "display:inline-flex;margin-right:40px" : ""),
  27727. "label-width": __props.element.labelWidth
  27728. }, createSlots({
  27729. default: withCtx(() => [
  27730. __props.element.type === "input" ? (openBlock(), createBlock(_component_el_input, {
  27731. key: 0,
  27732. modelValue: unref(data2),
  27733. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(data2) ? data2.value = $event : null),
  27734. modelModifiers: { trim: true },
  27735. style: normalizeStyle({ width: __props.element.options.width }),
  27736. placeholder: __props.element.options.placeholder,
  27737. maxlength: parseInt(__props.element.options.maxlength),
  27738. clearable: __props.element.options.clearable,
  27739. readonly: __props.element.options.readonly,
  27740. disabled: __props.disabled || __props.element.options.disabled
  27741. }, createSlots({ _: 2 }, [
  27742. __props.element.options.prefix ? {
  27743. name: "prefix",
  27744. fn: withCtx(() => [
  27745. createTextVNode(toDisplayString(__props.element.options.prefix), 1)
  27746. ])
  27747. } : void 0,
  27748. __props.element.options.suffix ? {
  27749. name: "suffix",
  27750. fn: withCtx(() => [
  27751. createTextVNode(toDisplayString(__props.element.options.suffix), 1)
  27752. ])
  27753. } : void 0,
  27754. __props.element.options.prepend ? {
  27755. name: "prepend",
  27756. fn: withCtx(() => [
  27757. createTextVNode(toDisplayString(__props.element.options.prepend), 1)
  27758. ])
  27759. } : void 0,
  27760. __props.element.options.append ? {
  27761. name: "append",
  27762. fn: withCtx(() => [
  27763. createTextVNode(toDisplayString(__props.element.options.append), 1)
  27764. ])
  27765. } : void 0
  27766. ]), 1032, ["modelValue", "style", "placeholder", "maxlength", "clearable", "readonly", "disabled"])) : createCommentVNode("", true),
  27767. __props.element.type === "password" ? (openBlock(), createBlock(_component_el_input, {
  27768. key: 1,
  27769. modelValue: unref(data2),
  27770. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => isRef(data2) ? data2.value = $event : null),
  27771. modelModifiers: { trim: true },
  27772. style: normalizeStyle({ width: __props.element.options.width }),
  27773. placeholder: __props.element.options.placeholder,
  27774. maxlength: parseInt(__props.element.options.maxlength),
  27775. clearable: __props.element.options.clearable,
  27776. disabled: __props.disabled || __props.element.options.disabled,
  27777. readonly: __props.element.options.readonly,
  27778. "show-password": __props.element.options.showPassword
  27779. }, createSlots({ _: 2 }, [
  27780. __props.element.options.prefix ? {
  27781. name: "prefix",
  27782. fn: withCtx(() => [
  27783. createTextVNode(toDisplayString(__props.element.options.prefix), 1)
  27784. ])
  27785. } : void 0,
  27786. __props.element.options.suffix ? {
  27787. name: "suffix",
  27788. fn: withCtx(() => [
  27789. createTextVNode(toDisplayString(__props.element.options.suffix), 1)
  27790. ])
  27791. } : void 0,
  27792. __props.element.options.prepend ? {
  27793. name: "prepend",
  27794. fn: withCtx(() => [
  27795. createTextVNode(toDisplayString(__props.element.options.prepend), 1)
  27796. ])
  27797. } : void 0,
  27798. __props.element.options.append ? {
  27799. name: "append",
  27800. fn: withCtx(() => [
  27801. createTextVNode(toDisplayString(__props.element.options.append), 1)
  27802. ])
  27803. } : void 0
  27804. ]), 1032, ["modelValue", "style", "placeholder", "maxlength", "clearable", "disabled", "readonly", "show-password"])) : createCommentVNode("", true),
  27805. __props.element.type === "textarea" ? (openBlock(), createBlock(_component_el_input, {
  27806. key: 2,
  27807. modelValue: unref(data2),
  27808. "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => isRef(data2) ? data2.value = $event : null),
  27809. modelModifiers: { trim: true },
  27810. type: "textarea",
  27811. resize: "none",
  27812. rows: __props.element.options.rows,
  27813. style: normalizeStyle({ width: __props.element.options.width }),
  27814. placeholder: __props.element.options.placeholder,
  27815. maxlength: parseInt(__props.element.options.maxlength),
  27816. "show-word-limit": __props.element.options.showWordLimit,
  27817. autosize: __props.element.options.autosize,
  27818. clearable: __props.element.options.clearable,
  27819. readonly: __props.element.options.readonly,
  27820. disabled: __props.disabled || __props.element.options.disabled
  27821. }, null, 8, ["modelValue", "rows", "style", "placeholder", "maxlength", "show-word-limit", "autosize", "clearable", "readonly", "disabled"])) : createCommentVNode("", true),
  27822. __props.element.type === "number" ? (openBlock(), createBlock(_component_el_input_number, {
  27823. key: 3,
  27824. modelValue: unref(data2),
  27825. "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => isRef(data2) ? data2.value = $event : null),
  27826. style: normalizeStyle({ width: __props.element.options.width }),
  27827. max: __props.element.options.max,
  27828. min: __props.element.options.min,
  27829. disabled: __props.disabled || __props.element.options.disabled,
  27830. "controls-position": "right"
  27831. }, null, 8, ["modelValue", "style", "max", "min", "disabled"])) : createCommentVNode("", true),
  27832. __props.element.type === "radio" ? (openBlock(), createBlock(_component_el_radio_group, {
  27833. key: 4,
  27834. modelValue: unref(data2),
  27835. "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => isRef(data2) ? data2.value = $event : null),
  27836. style: normalizeStyle({ width: __props.element.options.width }),
  27837. disabled: __props.disabled || __props.element.options.disabled
  27838. }, {
  27839. default: withCtx(() => [
  27840. (openBlock(true), createElementBlock(Fragment, null, renderList(__props.element.options.remote ? __props.element.options.remoteOptions : __props.element.options.options, (item) => {
  27841. return openBlock(), createBlock(_component_el_radio, {
  27842. key: item.value,
  27843. label: item.value,
  27844. style: normalizeStyle({
  27845. display: __props.element.options.inline ? "inline-block" : "block"
  27846. })
  27847. }, {
  27848. default: withCtx(() => [
  27849. createTextVNode(toDisplayString(__props.element.options.showLabel ? item.label : item.value), 1)
  27850. ]),
  27851. _: 2
  27852. }, 1032, ["label", "style"]);
  27853. }), 128))
  27854. ]),
  27855. _: 1
  27856. }, 8, ["modelValue", "style", "disabled"])) : createCommentVNode("", true),
  27857. __props.element.type === "checkbox" ? (openBlock(), createBlock(_component_el_checkbox_group, {
  27858. key: 5,
  27859. modelValue: unref(data2),
  27860. "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => isRef(data2) ? data2.value = $event : null),
  27861. style: normalizeStyle({ width: __props.element.options.width }),
  27862. disabled: __props.disabled || __props.element.options.disabled
  27863. }, {
  27864. default: withCtx(() => [
  27865. (openBlock(true), createElementBlock(Fragment, null, renderList(__props.element.options.remote ? __props.element.options.remoteOptions : __props.element.options.options, (item) => {
  27866. return openBlock(), createBlock(_component_el_checkbox, {
  27867. key: item.value,
  27868. label: item.value,
  27869. style: normalizeStyle({
  27870. display: __props.element.options.inline ? "inline-block" : "block"
  27871. })
  27872. }, {
  27873. default: withCtx(() => [
  27874. createTextVNode(toDisplayString(__props.element.options.showLabel ? item.label : item.value), 1)
  27875. ]),
  27876. _: 2
  27877. }, 1032, ["label", "style"]);
  27878. }), 128))
  27879. ]),
  27880. _: 1
  27881. }, 8, ["modelValue", "style", "disabled"])) : createCommentVNode("", true),
  27882. __props.element.type === "time" ? (openBlock(), createBlock(_component_el_config_provider, {
  27883. key: 6,
  27884. locale: unref(zhCn)
  27885. }, {
  27886. default: withCtx(() => [
  27887. createVNode(_component_el_time_picker, {
  27888. modelValue: unref(data2),
  27889. "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => isRef(data2) ? data2.value = $event : null),
  27890. placeholder: __props.element.options.placeholder,
  27891. readonly: __props.element.options.readonly,
  27892. editable: __props.element.options.editable,
  27893. clearable: __props.element.options.clearable,
  27894. format: __props.element.options.format,
  27895. disabled: __props.disabled || __props.element.options.disabled,
  27896. style: normalizeStyle({ width: __props.element.options.width })
  27897. }, null, 8, ["modelValue", "placeholder", "readonly", "editable", "clearable", "format", "disabled", "style"])
  27898. ]),
  27899. _: 1
  27900. }, 8, ["locale"])) : createCommentVNode("", true),
  27901. __props.element.type === "date" ? (openBlock(), createBlock(_component_el_config_provider, {
  27902. key: 7,
  27903. locale: unref(zhCn)
  27904. }, {
  27905. default: withCtx(() => [
  27906. createVNode(_component_el_date_picker, {
  27907. modelValue: unref(data2),
  27908. "onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => isRef(data2) ? data2.value = $event : null),
  27909. placeholder: __props.element.options.placeholder,
  27910. readonly: __props.element.options.readonly,
  27911. editable: __props.element.options.editable,
  27912. clearable: __props.element.options.clearable,
  27913. format: __props.element.options.format,
  27914. disabled: __props.disabled || __props.element.options.disabled,
  27915. style: normalizeStyle({ width: __props.element.options.width })
  27916. }, null, 8, ["modelValue", "placeholder", "readonly", "editable", "clearable", "format", "disabled", "style"])
  27917. ]),
  27918. _: 1
  27919. }, 8, ["locale"])) : createCommentVNode("", true),
  27920. __props.element.type === "rate" ? (openBlock(), createBlock(_component_el_rate, {
  27921. key: 8,
  27922. modelValue: unref(data2),
  27923. "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => isRef(data2) ? data2.value = $event : null),
  27924. max: __props.element.options.max,
  27925. "allow-half": __props.element.options.allowHalf,
  27926. disabled: __props.disabled || __props.element.options.disabled
  27927. }, null, 8, ["modelValue", "max", "allow-half", "disabled"])) : createCommentVNode("", true),
  27928. __props.element.type === "select" ? (openBlock(), createBlock(_component_el_select, {
  27929. key: 9,
  27930. modelValue: unref(data2),
  27931. "onUpdate:modelValue": _cache[9] || (_cache[9] = ($event) => isRef(data2) ? data2.value = $event : null),
  27932. multiple: __props.element.options.multiple,
  27933. placeholder: __props.element.options.placeholder,
  27934. clearable: __props.element.options.clearable,
  27935. filterable: __props.element.options.filterable,
  27936. disabled: __props.disabled || __props.element.options.disabled,
  27937. style: normalizeStyle({ width: __props.element.options.width }),
  27938. onChange: _cache[10] || (_cache[10] = (value) => specializedHandleSelect(value, __props.element))
  27939. }, {
  27940. default: withCtx(() => [
  27941. (openBlock(true), createElementBlock(Fragment, null, renderList(__props.element.options.remote ? __props.element.options.remoteOptions : __props.element.options.options, (item) => {
  27942. return openBlock(), createBlock(_component_el_option, {
  27943. key: item.value,
  27944. value: item.value,
  27945. label: __props.element.options.showLabel ? item.label : item.value
  27946. }, null, 8, ["value", "label"]);
  27947. }), 128))
  27948. ]),
  27949. _: 1
  27950. }, 8, ["modelValue", "multiple", "placeholder", "clearable", "filterable", "disabled", "style"])) : createCommentVNode("", true),
  27951. __props.element.type === "switch" ? (openBlock(), createBlock(_component_el_switch, {
  27952. key: 10,
  27953. modelValue: unref(data2),
  27954. "onUpdate:modelValue": _cache[11] || (_cache[11] = ($event) => isRef(data2) ? data2.value = $event : null),
  27955. "active-text": __props.element.options.activeText,
  27956. "inactive-text": __props.element.options.inactiveText,
  27957. disabled: __props.disabled || __props.element.options.disabled
  27958. }, null, 8, ["modelValue", "active-text", "inactive-text", "disabled"])) : createCommentVNode("", true),
  27959. __props.element.type === "slider" ? (openBlock(), createBlock(_component_el_slider, {
  27960. key: 11,
  27961. modelValue: unref(data2),
  27962. "onUpdate:modelValue": _cache[12] || (_cache[12] = ($event) => isRef(data2) ? data2.value = $event : null),
  27963. min: __props.element.options.min,
  27964. max: __props.element.options.max,
  27965. step: __props.element.options.step,
  27966. range: __props.element.options.range,
  27967. disabled: __props.disabled || __props.element.options.disabled,
  27968. style: normalizeStyle({ width: __props.element.options.width })
  27969. }, null, 8, ["modelValue", "min", "max", "step", "range", "disabled", "style"])) : createCommentVNode("", true),
  27970. __props.element.type == "text" ? (openBlock(), createElementBlock("span", _hoisted_1$6, toDisplayString(__props.element.options.defaultValue), 1)) : createCommentVNode("", true),
  27971. __props.element.type === "img-upload" ? (openBlock(), createBlock(_component_el_upload, {
  27972. key: 13,
  27973. name: __props.element.options.file,
  27974. action: __props.element.options.action,
  27975. accept: __props.element.options.accept,
  27976. "list-type": __props.element.options.listType,
  27977. multiple: __props.element.options.multiple,
  27978. limit: __props.element.options.limit,
  27979. disabled: __props.disabled || __props.element.options.disabled,
  27980. "on-success": handleUploadSuccess
  27981. }, {
  27982. default: withCtx(() => {
  27983. var _a2;
  27984. return [
  27985. __props.element.options.listType === "picture-card" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  27986. ((_a2 = __props.element.options.defaultValue) == null ? void 0 : _a2.length) ? (openBlock(), createBlock(_component_el_image, {
  27987. key: 0,
  27988. style: { "width": "100%", "height": "100%" },
  27989. "preview-src-list": [
  27990. "/api/sys/common/static/" + __props.element.options.defaultValue
  27991. ],
  27992. src: "/api/sys/common/static/" + __props.element.options.defaultValue
  27993. }, null, 8, ["preview-src-list", "src"])) : (openBlock(), createElementBlock("i", _hoisted_2$5))
  27994. ], 64)) : (openBlock(), createBlock(_component_el_button, { key: 1 }, {
  27995. default: withCtx(() => [
  27996. _hoisted_3$4,
  27997. _hoisted_4$4
  27998. ]),
  27999. _: 1
  28000. }))
  28001. ];
  28002. }),
  28003. _: 1
  28004. }, 8, ["name", "action", "accept", "list-type", "multiple", "limit", "disabled"])) : createCommentVNode("", true),
  28005. __props.element.type === "download" ? (openBlock(), createBlock(_component_el_button, {
  28006. key: 14,
  28007. style: { "margin-top": "-4px" },
  28008. type: "text",
  28009. onClick: _cache[13] || (_cache[13] = ($event) => download(__props.element.options.defaultValue, __props.element.label))
  28010. }, {
  28011. default: withCtx(() => [
  28012. _hoisted_6$4
  28013. ]),
  28014. _: 1
  28015. })) : createCommentVNode("", true),
  28016. __props.element.type === "cascader" ? (openBlock(), createBlock(_component_el_cascader, {
  28017. key: 15,
  28018. modelValue: unref(data2),
  28019. "onUpdate:modelValue": _cache[14] || (_cache[14] = ($event) => isRef(data2) ? data2.value = $event : null),
  28020. options: __props.element.options.remoteOptions,
  28021. placeholder: __props.element.options.placeholder,
  28022. filterable: __props.element.options.filterable,
  28023. clearable: __props.element.options.clearable,
  28024. disabled: __props.disabled || __props.element.options.disabled,
  28025. style: normalizeStyle({ width: __props.element.options.width })
  28026. }, null, 8, ["modelValue", "options", "placeholder", "filterable", "clearable", "disabled", "style"])) : createCommentVNode("", true)
  28027. ]),
  28028. _: 2
  28029. }, [
  28030. __props.element.type === "download" ? {
  28031. name: "label",
  28032. fn: withCtx(({ label }) => [
  28033. createElementVNode("a", {
  28034. href: `/api/sys/common/static/${__props.element.options.defaultValue}?inline=1`,
  28035. style: { "color": "#606266" },
  28036. target: "_blank"
  28037. }, toDisplayString(label), 9, _hoisted_5$4)
  28038. ])
  28039. } : void 0
  28040. ]), 1032, ["label", "prop", "style", "label-width"])) : createCommentVNode("", true);
  28041. };
  28042. }
  28043. });
  28044. var GenerateFormItem = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-fd931432"]]);
  28045. const _sfc_main$7 = defineComponent({
  28046. name: "FormGenerate",
  28047. components: {
  28048. GenerateFormItem
  28049. },
  28050. props: {
  28051. data: {
  28052. type: Object,
  28053. default: getWidgetForm()
  28054. },
  28055. value: {
  28056. type: Object
  28057. },
  28058. disabled: {
  28059. type: Boolean,
  28060. default: false
  28061. },
  28062. request: {
  28063. type: Function
  28064. }
  28065. },
  28066. setup(props) {
  28067. var _a2;
  28068. const state = reactive({
  28069. generateForm: null,
  28070. model: {},
  28071. updatedModel: {},
  28072. rules: {},
  28073. widgetForm: (_a2 = props.data && JSON.parse(JSON.stringify(props.data))) != null ? _a2 : getWidgetForm()
  28074. });
  28075. const generateModel = (list) => {
  28076. for (let index = 0; index < list.length; index++) {
  28077. const model = list[index].model;
  28078. if (!model)
  28079. return;
  28080. if (list[index].type === "grid") {
  28081. list[index].columns.forEach((col) => generateModel(col.list));
  28082. } else {
  28083. if (props.value && Object.keys(props.value).includes(model))
  28084. state.model[model] = props.value[model];
  28085. else
  28086. state.model[model] = list[index].options.defaultValue;
  28087. state.rules[model] = list[index].options.rules;
  28088. }
  28089. }
  28090. };
  28091. const generateOptions = (list) => {
  28092. list.forEach(async (item) => {
  28093. if (item.type === "grid") {
  28094. item.columns.forEach((col) => generateOptions(col.list));
  28095. } else {
  28096. if (item.options.remote && item.options.remoteFunc) {
  28097. if (props.request) {
  28098. const { data: data2 } = await props.request({
  28099. url: item.options.remoteFunc
  28100. });
  28101. item.options.remoteOptions = data2.map((i) => ({
  28102. label: i[item.options.props.label],
  28103. value: i[item.options.props.value],
  28104. children: i[item.options.props.children]
  28105. }));
  28106. return;
  28107. }
  28108. const token = sessionStorage.getItem("token");
  28109. fetch(item.options.remoteFunc, {
  28110. headers: {
  28111. "Content-type": " application/x-www-form-urlencoded; charset=UTF-8",
  28112. "Token": token
  28113. }
  28114. }).then((resp) => resp.json()).then((json) => {
  28115. const res = json.data;
  28116. if (res instanceof Array) {
  28117. item.options.remoteOptions = res.map((data2) => ({
  28118. label: data2[item.options.props.label],
  28119. value: data2[item.options.props.value],
  28120. children: data2[item.options.props.children]
  28121. }));
  28122. }
  28123. });
  28124. }
  28125. }
  28126. });
  28127. };
  28128. const updateWidgetForm = (list) => {
  28129. const listIndex2 = state.widgetForm.list.findIndex((item) => item.type === "grid");
  28130. state.widgetForm.list[listIndex2].columns = list;
  28131. state.model = __spreadProps(__spreadValues({}, state.model), { contactsId: "" });
  28132. };
  28133. watch(() => props.data, (val) => {
  28134. var _a3;
  28135. state.widgetForm = (_a3 = val && JSON.parse(JSON.stringify(val))) != null ? _a3 : getWidgetForm();
  28136. state.model = {};
  28137. state.rules = {};
  28138. generateModel(state.widgetForm.list);
  28139. generateOptions(state.widgetForm.list);
  28140. }, { deep: true, immediate: true });
  28141. const getData = () => {
  28142. return new Promise((resolve, reject) => {
  28143. state.generateForm.validate().then((validate) => {
  28144. if (validate)
  28145. resolve(state.updatedModel);
  28146. else
  28147. ElMessage.error("\u9A8C\u8BC1\u5931\u8D25");
  28148. }).catch((error) => {
  28149. reject(error);
  28150. });
  28151. });
  28152. };
  28153. const reset = () => {
  28154. state.generateForm.resetFields();
  28155. };
  28156. return __spreadProps(__spreadValues({}, toRefs(state)), {
  28157. getData,
  28158. reset,
  28159. updateWidgetForm
  28160. });
  28161. }
  28162. });
  28163. function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
  28164. const _component_GenerateFormItem = resolveComponent("GenerateFormItem");
  28165. const _component_el_form = ElForm;
  28166. return openBlock(), createBlock(_component_el_form, {
  28167. ref: "generateForm",
  28168. "label-suffix": ":",
  28169. model: _ctx.model,
  28170. rules: _ctx.rules,
  28171. size: _ctx.widgetForm.config.size,
  28172. "label-position": _ctx.widgetForm.config.labelPosition,
  28173. "label-width": `${_ctx.widgetForm.config.labelWidth}px`,
  28174. "hide-required-asterisk": _ctx.widgetForm.config.hideRequiredAsterisk
  28175. }, {
  28176. default: withCtx(() => [
  28177. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.widgetForm.list, (element, index) => {
  28178. return openBlock(), createBlock(_component_GenerateFormItem, {
  28179. key: element.key,
  28180. model: _ctx.model,
  28181. "updated-model": _ctx.updatedModel,
  28182. element: _ctx.widgetForm.list[index],
  28183. config: _ctx.data.config,
  28184. disabled: _ctx.disabled,
  28185. request: _ctx.request,
  28186. widgetFormData: _ctx.widgetForm.list,
  28187. onUpdateWidgetForm: _ctx.updateWidgetForm
  28188. }, null, 8, ["model", "updated-model", "element", "config", "disabled", "request", "widgetFormData", "onUpdateWidgetForm"]);
  28189. }), 128))
  28190. ]),
  28191. _: 1
  28192. }, 8, ["model", "rules", "size", "label-position", "label-width", "hide-required-asterisk"]);
  28193. }
  28194. var GenerateForm = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["render", _sfc_render$1]]);
  28195. const isClient = typeof window !== "undefined";
  28196. isClient ? window : void 0;
  28197. isClient ? window.document : void 0;
  28198. isClient ? window.navigator : void 0;
  28199. isClient ? window.location : void 0;
  28200. const _global = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
  28201. const globalKey = "__vueuse_ssr_handlers__";
  28202. _global[globalKey] = _global[globalKey] || {};
  28203. _global[globalKey];
  28204. var _a, _b;
  28205. 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);
  28206. function useVModel(props, key, emit, options = {}) {
  28207. var _a2;
  28208. const {
  28209. passive: passive2 = false,
  28210. eventName,
  28211. deep = false
  28212. } = options;
  28213. const vm = getCurrentInstance();
  28214. const _emit = emit || (vm == null ? void 0 : vm.emit) || ((_a2 = vm == null ? void 0 : vm.$emit) == null ? void 0 : _a2.bind(vm));
  28215. let event = eventName;
  28216. if (!key) {
  28217. {
  28218. key = "modelValue";
  28219. }
  28220. }
  28221. event = eventName || event || `update:${key}`;
  28222. if (passive2) {
  28223. const proxy = ref(props[key]);
  28224. watch(() => props[key], (v2) => proxy.value = v2);
  28225. watch(proxy, (v2) => {
  28226. if (v2 !== props[key] || deep)
  28227. _emit(event, v2);
  28228. }, {
  28229. deep
  28230. });
  28231. return proxy;
  28232. } else {
  28233. return computed({
  28234. get() {
  28235. return props[key];
  28236. },
  28237. set(value) {
  28238. _emit(event, value);
  28239. }
  28240. });
  28241. }
  28242. }
  28243. const _hoisted_1$5 = { class: "px-3 py-2 text-sm text-gray-700" };
  28244. const _hoisted_2$4 = {
  28245. key: 0,
  28246. 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"
  28247. };
  28248. let listIndex = 1;
  28249. function setListIndex(list) {
  28250. if (list.list.length > 0) {
  28251. const array4 = list.list.map((item) => item.model);
  28252. const plateNumbers = array4.filter((item) => item.includes("plate")).map((item) => {
  28253. const match = item.match(/plate(\d+)/);
  28254. return match ? match[1] : null;
  28255. });
  28256. listIndex = findMissingPositive(plateNumbers);
  28257. }
  28258. }
  28259. function cloneWidget(params) {
  28260. const key = Math.random().toString(36).substring(2, 9);
  28261. params = cloneDeep(__spreadProps(__spreadValues({}, params), {
  28262. key,
  28263. model: `plate${listIndex}`
  28264. }));
  28265. if (params.type === "grid") {
  28266. params.columns.forEach((i) => {
  28267. i.list = i.list.map(cloneWidget);
  28268. });
  28269. }
  28270. return params;
  28271. }
  28272. function findMissingPositive(nums) {
  28273. let numbers = nums.map(Number);
  28274. numbers.sort((a2, b2) => a2 - b2);
  28275. let missing = 1;
  28276. for (let i = 0; i < numbers.length; i++) {
  28277. if (numbers[i] === missing) {
  28278. missing++;
  28279. }
  28280. }
  28281. return missing;
  28282. }
  28283. const _sfc_main$6 = /* @__PURE__ */ defineComponent({
  28284. props: {
  28285. fields: null,
  28286. title: null,
  28287. list: null,
  28288. allList: null
  28289. },
  28290. setup(__props) {
  28291. const props = __props;
  28292. let moveFlag = ref(false);
  28293. const moveStart = () => {
  28294. const array4 = props.allList.list.map((item) => item.model);
  28295. const plateNumbers = array4.filter((item) => item.includes("plate")).map((item) => {
  28296. const match = item.match(/plate(\d+)/);
  28297. return match ? match[1] : null;
  28298. });
  28299. const flag = plateNumbers.length < 5;
  28300. if (!flag && !moveFlag.value) {
  28301. moveFlag.value = true;
  28302. ElMessage.warning("\u6700\u591A\u6DFB\u52A0\u4E94\u4E2A");
  28303. return false;
  28304. }
  28305. return flag;
  28306. };
  28307. const stopMove = () => {
  28308. moveFlag.value = false;
  28309. };
  28310. return (_ctx, _cache) => {
  28311. return openBlock(), createElementBlock(Fragment, null, [
  28312. createElementVNode("div", _hoisted_1$5, toDisplayString(__props.title), 1),
  28313. createVNode(unref(Draggable), {
  28314. tag: "ul",
  28315. class: "m-0 p-3 pt-0 grid grid-cols-2 gap-1",
  28316. "item-key": "type",
  28317. group: { name: "form-design", pull: "clone", put: false },
  28318. clone: cloneWidget,
  28319. sort: false,
  28320. list: __props.list,
  28321. allList: __props.allList,
  28322. move: moveStart,
  28323. choose: setListIndex(__props.allList),
  28324. onAdd: _cache[0] || (_cache[0] = ($event) => stopMove())
  28325. }, {
  28326. item: withCtx(({ element }) => [
  28327. __props.fields.includes(element.type) ? (openBlock(), createElementBlock("li", _hoisted_2$4, [
  28328. createElementVNode("i", {
  28329. class: normalizeClass(["custom:" + element.type, "ml-2 mr-1"])
  28330. }, null, 2),
  28331. createElementVNode("span", null, toDisplayString(element.label), 1)
  28332. ])) : createCommentVNode("", true)
  28333. ]),
  28334. _: 1
  28335. }, 8, ["list", "allList", "choose"])
  28336. ], 64);
  28337. };
  28338. }
  28339. });
  28340. const _hoisted_1$4 = { key: 12 };
  28341. const _hoisted_2$3 = {
  28342. key: 1,
  28343. class: "custom:insert"
  28344. };
  28345. const _hoisted_3$3 = /* @__PURE__ */ createElementVNode("i", {
  28346. "icon-class": "custom:img-upload",
  28347. style: { "margin-right": "10px" }
  28348. }, null, -1);
  28349. const _hoisted_4$3 = /* @__PURE__ */ createTextVNode(" \u70B9\u51FB\u4E0A\u4F20 ");
  28350. const _hoisted_5$3 = /* @__PURE__ */ createTextVNode(" \u4E0B\u8F7D ");
  28351. const _hoisted_6$3 = /* @__PURE__ */ createElementVNode("i", {
  28352. class: "eva:move-outline",
  28353. "text-lg": ""
  28354. }, null, -1);
  28355. const _hoisted_7$2 = [
  28356. _hoisted_6$3
  28357. ];
  28358. const _sfc_main$5 = /* @__PURE__ */ defineComponent({
  28359. props: {
  28360. list: null,
  28361. element: null,
  28362. index: null,
  28363. selectWidget: null
  28364. },
  28365. emits: ["itemClick", "delete", "update:selectWidget"],
  28366. setup(__props) {
  28367. const props = createPropsRestProxy(__props, ["element", "index", "list"]);
  28368. let selectWidget = useVModel(props, "selectWidget");
  28369. const handleDeleteClick = () => {
  28370. __props.list.splice(__props.index, 1);
  28371. selectWidget.value = __props.list[__props.list.length === __props.index ? __props.index - 1 : __props.index];
  28372. };
  28373. return (_ctx, _cache) => {
  28374. var _a2, _b2;
  28375. const _component_WidgetFormItem = resolveComponent("WidgetFormItem", true);
  28376. const _component_el_table_column = ElTableColumn;
  28377. const _component_el_table = ElTable;
  28378. const _component_el_divider = ElDivider;
  28379. const _component_el_input = ElInput;
  28380. const _component_el_input_number = ElInputNumber;
  28381. const _component_el_radio = ElRadio;
  28382. const _component_el_radio_group = ElRadioGroup;
  28383. const _component_el_checkbox = ElCheckbox;
  28384. const _component_el_checkbox_group = ElCheckboxGroup$1;
  28385. const _component_el_time_picker = ElTimePicker;
  28386. const _component_el_date_picker = ElDatePicker;
  28387. const _component_el_rate = ElRate;
  28388. const _component_el_option = ElOption;
  28389. const _component_el_select = ElSelect;
  28390. const _component_el_switch = ElSwitch;
  28391. const _component_el_slider = ElSlider;
  28392. const _component_el_image = ElImage;
  28393. const _component_el_button = ElButton;
  28394. const _component_el_upload = ElUpload;
  28395. const _component_el_cascader = ElCascader;
  28396. const _component_el_form_item = ElFormItem;
  28397. return openBlock(), createElementBlock("div", {
  28398. class: normalizeClass(["widget-view", { active: ((_a2 = selectWidget.value) == null ? void 0 : _a2.key) === __props.element.key, col: __props.element.type === "grid" }]),
  28399. style: normalizeStyle(__props.element.type === "grid" ? `gap: ${__props.element.options.gutter}px; align-items: ${__props.element.options.align};` : ""),
  28400. onClick: _cache[3] || (_cache[3] = withModifiers(($event) => selectWidget.value = __props.element, ["stop"]))
  28401. }, [
  28402. __props.element.type === "grid" ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(__props.element.columns, (col, key) => {
  28403. return openBlock(), createBlock(unref(Draggable), {
  28404. key,
  28405. class: "bg-white min-h-12 border border-dashed border-gray-300",
  28406. style: normalizeStyle(`grid-column: span ${col.span}`),
  28407. "item-key": "key",
  28408. handle: "[cursor-move]",
  28409. animation: 200,
  28410. group: "form-design",
  28411. "no-transition-on-drag": true,
  28412. list: col.list,
  28413. onAdd: ($event) => selectWidget.value = col.list[$event.newIndex]
  28414. }, {
  28415. item: withCtx(({ element: colElement, index: colIndex }) => [
  28416. createVNode(_component_WidgetFormItem, {
  28417. selectWidget: selectWidget.value,
  28418. "onUpdate:selectWidget": _cache[0] || (_cache[0] = ($event) => selectWidget.value = $event),
  28419. element: colElement,
  28420. list: col.list,
  28421. index: colIndex
  28422. }, null, 8, ["selectWidget", "element", "list", "index"])
  28423. ]),
  28424. _: 2
  28425. }, 1032, ["style", "list", "onAdd"]);
  28426. }), 128)) : __props.element.type === "table" ? (openBlock(), createBlock(_component_el_table, {
  28427. key: 1,
  28428. class: "w-0 flex-1",
  28429. border: "",
  28430. data: __props.element.options.defaultValue
  28431. }, {
  28432. default: withCtx(() => [
  28433. (openBlock(true), createElementBlock(Fragment, null, renderList(__props.element.columns, (i) => {
  28434. return openBlock(), createBlock(_component_el_table_column, mergeProps({
  28435. key: i.prop,
  28436. "header-align": __props.element.options.align,
  28437. align: __props.element.options.align
  28438. }, i), null, 16, ["header-align", "align"]);
  28439. }), 128))
  28440. ]),
  28441. _: 1
  28442. }, 8, ["data"])) : __props.element.type === "divider" ? (openBlock(), createBlock(_component_el_divider, {
  28443. key: 2,
  28444. class: "pb-0",
  28445. data: __props.element.options.defaultValue,
  28446. "content-position": "left"
  28447. }, {
  28448. default: withCtx(() => [
  28449. createTextVNode(toDisplayString(__props.element.label), 1)
  28450. ]),
  28451. _: 1
  28452. }, 8, ["data"])) : __props.element ? (openBlock(), createBlock(_component_el_form_item, {
  28453. key: __props.element.key,
  28454. label: __props.element.label,
  28455. "label-width": __props.element.labelWidth,
  28456. rules: __props.element.options.rules
  28457. }, {
  28458. default: withCtx(() => [
  28459. __props.element.type === "input" ? (openBlock(), createBlock(_component_el_input, {
  28460. key: 0,
  28461. readonly: "",
  28462. "model-value": __props.element.options.defaultValue,
  28463. style: normalizeStyle({ width: __props.element.options.width }),
  28464. placeholder: __props.element.options.placeholder,
  28465. maxlength: parseInt(__props.element.options.maxlength),
  28466. clearable: __props.element.options.clearable,
  28467. disabled: __props.element.options.disabled
  28468. }, createSlots({ _: 2 }, [
  28469. __props.element.options.prefix ? {
  28470. name: "prefix",
  28471. fn: withCtx(() => [
  28472. createTextVNode(toDisplayString(__props.element.options.prefix), 1)
  28473. ])
  28474. } : void 0,
  28475. __props.element.options.suffix ? {
  28476. name: "suffix",
  28477. fn: withCtx(() => [
  28478. createTextVNode(toDisplayString(__props.element.options.suffix), 1)
  28479. ])
  28480. } : void 0,
  28481. __props.element.options.prepend ? {
  28482. name: "prepend",
  28483. fn: withCtx(() => [
  28484. createTextVNode(toDisplayString(__props.element.options.prepend), 1)
  28485. ])
  28486. } : void 0,
  28487. __props.element.options.append ? {
  28488. name: "append",
  28489. fn: withCtx(() => [
  28490. createTextVNode(toDisplayString(__props.element.options.append), 1)
  28491. ])
  28492. } : void 0
  28493. ]), 1032, ["model-value", "style", "placeholder", "maxlength", "clearable", "disabled"])) : createCommentVNode("", true),
  28494. __props.element.type === "password" ? (openBlock(), createBlock(_component_el_input, {
  28495. key: 1,
  28496. readonly: "",
  28497. "model-value": __props.element.options.defaultValue,
  28498. style: normalizeStyle({ width: __props.element.options.width }),
  28499. placeholder: __props.element.options.placeholder,
  28500. maxlength: parseInt(__props.element.options.maxlength),
  28501. clearable: __props.element.options.clearable,
  28502. disabled: __props.element.options.disabled,
  28503. "show-password": __props.element.options.showPassword
  28504. }, createSlots({ _: 2 }, [
  28505. __props.element.options.prefix ? {
  28506. name: "prefix",
  28507. fn: withCtx(() => [
  28508. createTextVNode(toDisplayString(__props.element.options.prefix), 1)
  28509. ])
  28510. } : void 0,
  28511. __props.element.options.suffix ? {
  28512. name: "suffix",
  28513. fn: withCtx(() => [
  28514. createTextVNode(toDisplayString(__props.element.options.suffix), 1)
  28515. ])
  28516. } : void 0,
  28517. __props.element.options.prepend ? {
  28518. name: "prepend",
  28519. fn: withCtx(() => [
  28520. createTextVNode(toDisplayString(__props.element.options.prepend), 1)
  28521. ])
  28522. } : void 0,
  28523. __props.element.options.append ? {
  28524. name: "append",
  28525. fn: withCtx(() => [
  28526. createTextVNode(toDisplayString(__props.element.options.append), 1)
  28527. ])
  28528. } : void 0
  28529. ]), 1032, ["model-value", "style", "placeholder", "maxlength", "clearable", "disabled", "show-password"])) : createCommentVNode("", true),
  28530. __props.element.type === "textarea" ? (openBlock(), createBlock(_component_el_input, {
  28531. key: 2,
  28532. type: "textarea",
  28533. resize: "none",
  28534. readonly: "",
  28535. rows: __props.element.options.rows,
  28536. "model-value": __props.element.options.defaultValue,
  28537. style: normalizeStyle({ width: __props.element.options.width }),
  28538. placeholder: __props.element.options.placeholder,
  28539. maxlength: parseInt(__props.element.options.maxlength),
  28540. "show-word-limit": __props.element.options.showWordLimit,
  28541. autosize: __props.element.options.autosize,
  28542. clearable: __props.element.options.clearable,
  28543. disabled: __props.element.options.disabled
  28544. }, null, 8, ["rows", "model-value", "style", "placeholder", "maxlength", "show-word-limit", "autosize", "clearable", "disabled"])) : createCommentVNode("", true),
  28545. __props.element.type === "number" ? (openBlock(), createBlock(_component_el_input_number, {
  28546. key: 3,
  28547. "model-value": __props.element.options.defaultValue,
  28548. style: normalizeStyle({ width: __props.element.options.width }),
  28549. max: __props.element.options.max,
  28550. min: __props.element.options.min,
  28551. disabled: __props.element.options.disabled,
  28552. "controls-position": "right"
  28553. }, null, 8, ["model-value", "style", "max", "min", "disabled"])) : createCommentVNode("", true),
  28554. __props.element.type === "radio" ? (openBlock(), createBlock(_component_el_radio_group, {
  28555. key: 4,
  28556. "model-value": __props.element.options.defaultValue,
  28557. style: normalizeStyle({ width: __props.element.options.width }),
  28558. disabled: __props.element.options.disabled
  28559. }, {
  28560. default: withCtx(() => [
  28561. (openBlock(true), createElementBlock(Fragment, null, renderList(__props.element.options.options, (item) => {
  28562. return openBlock(), createBlock(_component_el_radio, {
  28563. key: item.value,
  28564. label: item.value,
  28565. style: normalizeStyle({
  28566. display: __props.element.options.inline ? "inline-block" : "block"
  28567. })
  28568. }, {
  28569. default: withCtx(() => [
  28570. createTextVNode(toDisplayString(__props.element.options.showLabel ? item.label : item.value), 1)
  28571. ]),
  28572. _: 2
  28573. }, 1032, ["label", "style"]);
  28574. }), 128))
  28575. ]),
  28576. _: 1
  28577. }, 8, ["model-value", "style", "disabled"])) : createCommentVNode("", true),
  28578. __props.element.type === "checkbox" ? (openBlock(), createBlock(_component_el_checkbox_group, {
  28579. key: 5,
  28580. "model-value": __props.element.options.defaultValue,
  28581. style: normalizeStyle({ width: __props.element.options.width }),
  28582. disabled: __props.element.options.disabled
  28583. }, {
  28584. default: withCtx(() => [
  28585. (openBlock(true), createElementBlock(Fragment, null, renderList(__props.element.options.options, (item) => {
  28586. return openBlock(), createBlock(_component_el_checkbox, {
  28587. key: item.value,
  28588. label: item.value,
  28589. style: normalizeStyle({
  28590. display: __props.element.options.inline ? "inline-block" : "block"
  28591. })
  28592. }, {
  28593. default: withCtx(() => [
  28594. createTextVNode(toDisplayString(__props.element.options.showLabel ? item.label : item.value), 1)
  28595. ]),
  28596. _: 2
  28597. }, 1032, ["label", "style"]);
  28598. }), 128))
  28599. ]),
  28600. _: 1
  28601. }, 8, ["model-value", "style", "disabled"])) : createCommentVNode("", true),
  28602. __props.element.type === "time" ? (openBlock(), createBlock(_component_el_time_picker, {
  28603. key: 6,
  28604. "model-value": __props.element.options.defaultValue,
  28605. placeholder: __props.element.options.placeholder,
  28606. readonly: __props.element.options.readonly,
  28607. editable: __props.element.options.editable,
  28608. clearable: __props.element.options.clearable,
  28609. format: __props.element.options.format,
  28610. disabled: __props.element.options.disabled,
  28611. style: normalizeStyle({ width: __props.element.options.width })
  28612. }, null, 8, ["model-value", "placeholder", "readonly", "editable", "clearable", "format", "disabled", "style"])) : createCommentVNode("", true),
  28613. __props.element.type === "date" ? (openBlock(), createBlock(_component_el_date_picker, {
  28614. key: 7,
  28615. "model-value": __props.element.options.defaultValue,
  28616. placeholder: __props.element.options.placeholder,
  28617. readonly: __props.element.options.readonly,
  28618. editable: __props.element.options.editable,
  28619. clearable: __props.element.options.clearable,
  28620. format: __props.element.options.format,
  28621. disabled: __props.element.options.disabled,
  28622. style: normalizeStyle({ width: __props.element.options.width })
  28623. }, null, 8, ["model-value", "placeholder", "readonly", "editable", "clearable", "format", "disabled", "style"])) : createCommentVNode("", true),
  28624. __props.element.type === "rate" ? (openBlock(), createBlock(_component_el_rate, {
  28625. key: 8,
  28626. "model-value": __props.element.options.defaultValue,
  28627. max: __props.element.options.max,
  28628. "allow-half": __props.element.options.allowHalf,
  28629. disabled: __props.element.options.disabled
  28630. }, null, 8, ["model-value", "max", "allow-half", "disabled"])) : createCommentVNode("", true),
  28631. __props.element.type === "select" ? (openBlock(), createBlock(_component_el_select, {
  28632. key: 9,
  28633. "model-value": __props.element.options.defaultValue,
  28634. multiple: __props.element.options.multiple,
  28635. placeholder: __props.element.options.placeholder,
  28636. clearable: __props.element.options.clearable,
  28637. filterable: __props.element.options.filterable,
  28638. disabled: __props.element.options.disabled,
  28639. style: normalizeStyle({ width: __props.element.options.width })
  28640. }, {
  28641. default: withCtx(() => [
  28642. (openBlock(true), createElementBlock(Fragment, null, renderList(__props.element.options.options, (item) => {
  28643. return openBlock(), createBlock(_component_el_option, {
  28644. key: item.value,
  28645. value: item.value,
  28646. label: __props.element.options.showLabel ? item.label : item.value
  28647. }, null, 8, ["value", "label"]);
  28648. }), 128))
  28649. ]),
  28650. _: 1
  28651. }, 8, ["model-value", "multiple", "placeholder", "clearable", "filterable", "disabled", "style"])) : createCommentVNode("", true),
  28652. __props.element.type === "switch" ? (openBlock(), createBlock(_component_el_switch, {
  28653. key: 10,
  28654. "model-value": __props.element.options.defaultValue,
  28655. "active-text": __props.element.options.activeText,
  28656. "inactive-text": __props.element.options.inactiveText,
  28657. disabled: __props.element.options.disabled
  28658. }, null, 8, ["model-value", "active-text", "inactive-text", "disabled"])) : createCommentVNode("", true),
  28659. __props.element.type === "slider" ? (openBlock(), createBlock(_component_el_slider, {
  28660. key: 11,
  28661. "model-value": __props.element.options.defaultValue,
  28662. min: __props.element.options.min,
  28663. max: __props.element.options.max,
  28664. step: __props.element.options.step,
  28665. range: __props.element.options.range,
  28666. disabled: __props.element.options.disabled,
  28667. style: normalizeStyle({ width: __props.element.options.width })
  28668. }, null, 8, ["model-value", "min", "max", "step", "range", "disabled", "style"])) : createCommentVNode("", true),
  28669. __props.element.type == "text" ? (openBlock(), createElementBlock("span", _hoisted_1$4, toDisplayString(__props.element.options.defaultValue), 1)) : createCommentVNode("", true),
  28670. __props.element.type === "img-upload" ? (openBlock(), createBlock(_component_el_upload, {
  28671. key: 13,
  28672. name: __props.element.options.file,
  28673. action: __props.element.options.action,
  28674. accept: __props.element.options.accept,
  28675. "list-type": __props.element.options.listType,
  28676. multiple: __props.element.options.multiple,
  28677. limit: __props.element.options.limit,
  28678. disabled: __props.element.options.disabled
  28679. }, {
  28680. default: withCtx(() => {
  28681. var _a3;
  28682. return [
  28683. __props.element.options.listType === "picture-card" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  28684. ((_a3 = __props.element.options.defaultValue) == null ? void 0 : _a3.length) ? (openBlock(), createBlock(_component_el_image, {
  28685. key: 0,
  28686. style: { "width": "100%", "height": "100%" },
  28687. "preview-src-list": [
  28688. "/api/sys/common/static/" + __props.element.options.defaultValue
  28689. ],
  28690. src: "/api/sys/common/static/" + __props.element.options.defaultValue
  28691. }, null, 8, ["preview-src-list", "src"])) : (openBlock(), createElementBlock("i", _hoisted_2$3))
  28692. ], 64)) : (openBlock(), createBlock(_component_el_button, { key: 1 }, {
  28693. default: withCtx(() => [
  28694. _hoisted_3$3,
  28695. _hoisted_4$3
  28696. ]),
  28697. _: 1
  28698. }))
  28699. ];
  28700. }),
  28701. _: 1
  28702. }, 8, ["name", "action", "accept", "list-type", "multiple", "limit", "disabled"])) : createCommentVNode("", true),
  28703. __props.element.type === "download" ? (openBlock(), createBlock(_component_el_button, {
  28704. key: 14,
  28705. type: "text",
  28706. style: { "margin-top": "-4px" }
  28707. }, {
  28708. default: withCtx(() => [
  28709. _hoisted_5$3
  28710. ]),
  28711. _: 1
  28712. })) : createCommentVNode("", true),
  28713. __props.element.type === "cascader" ? (openBlock(), createBlock(_component_el_cascader, {
  28714. key: 15,
  28715. "model-value": __props.element.options.defaultValue,
  28716. options: __props.element.options.remoteOptions,
  28717. placeholder: __props.element.options.placeholder,
  28718. filterable: __props.element.options.filterable,
  28719. clearable: __props.element.options.clearable,
  28720. disabled: __props.element.options.disabled,
  28721. style: normalizeStyle({ width: __props.element.options.width })
  28722. }, null, 8, ["model-value", "options", "placeholder", "filterable", "clearable", "disabled", "style"])) : createCommentVNode("", true)
  28723. ]),
  28724. _: 1
  28725. }, 8, ["label", "label-width", "rules"])) : createCommentVNode("", true),
  28726. ((_b2 = selectWidget.value) == null ? void 0 : _b2.key) === __props.element.key ? (openBlock(), createElementBlock(Fragment, { key: 4 }, [
  28727. createElementVNode("div", {
  28728. absolute: "",
  28729. "z-10": "",
  28730. "left-0": "",
  28731. top: "-.5",
  28732. "bg-blue-500": "",
  28733. "text-white": "",
  28734. p: ".5 l-0 t-0",
  28735. "cursor-move": "",
  28736. class: normalizeClass({ "bg-yellow-500": __props.element.type === "grid" })
  28737. }, _hoisted_7$2, 2),
  28738. createElementVNode("div", {
  28739. absolute: "",
  28740. "z-10": "",
  28741. "right-0": "",
  28742. bottom: "-0.5",
  28743. "bg-blue-500": "",
  28744. flex: "",
  28745. "gap-1": "",
  28746. p: "1 r-.5",
  28747. "text-white": "",
  28748. "cursor-pointer": "",
  28749. class: normalizeClass({ "bg-yellow-500": __props.element.type === "grid" })
  28750. }, [
  28751. createCommentVNode("", true),
  28752. !__props.element.allDisable ? (openBlock(), createElementBlock("i", {
  28753. key: 1,
  28754. class: "fa6-regular:trash-can",
  28755. onClick: _cache[2] || (_cache[2] = withModifiers(($event) => handleDeleteClick(), ["stop"]))
  28756. })) : createCommentVNode("", true)
  28757. ], 2)
  28758. ], 64)) : createCommentVNode("", true)
  28759. ], 6);
  28760. };
  28761. }
  28762. });
  28763. var WidgetForm_vue_vue_type_style_index_0_lang = "";
  28764. const _hoisted_1$3 = {
  28765. key: 0,
  28766. text: "gray-400 lg",
  28767. absolute: "",
  28768. "top-50": "",
  28769. left: "1/2",
  28770. "translate-x": "-1/2"
  28771. };
  28772. const _sfc_main$4 = /* @__PURE__ */ defineComponent({
  28773. props: {
  28774. list: null,
  28775. config: null,
  28776. selectWidget: null
  28777. },
  28778. emits: ["update:selectWidget"],
  28779. setup(__props) {
  28780. const props = __props;
  28781. const selectWidget = useVModel(props, "selectWidget");
  28782. return (_ctx, _cache) => {
  28783. const _component_el_form = ElForm;
  28784. return openBlock(), createBlock(_component_el_form, mergeProps({
  28785. "label-suffix": ":",
  28786. "bg-gray-50": "",
  28787. relative: "",
  28788. flex: "~ 1"
  28789. }, __props.config, { class: "layoutForm" }), {
  28790. default: withCtx(() => {
  28791. var _a2;
  28792. return [
  28793. !((_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),
  28794. createVNode(unref(Draggable), {
  28795. class: "flex-1 m-2 bg-white shadow p-1",
  28796. "item-key": "key",
  28797. handle: "[cursor-move]",
  28798. animation: 200,
  28799. group: "form-design",
  28800. list: __props.list,
  28801. onAdd: _cache[1] || (_cache[1] = ($event) => selectWidget.value = __props.list[$event.newIndex])
  28802. }, {
  28803. item: withCtx(({ element, index }) => [
  28804. createVNode(_sfc_main$5, {
  28805. selectWidget: unref(selectWidget),
  28806. "onUpdate:selectWidget": _cache[0] || (_cache[0] = ($event) => isRef(selectWidget) ? selectWidget.value = $event : null),
  28807. element,
  28808. index,
  28809. list: __props.list
  28810. }, null, 8, ["selectWidget", "element", "index", "list"])
  28811. ]),
  28812. _: 1
  28813. }, 8, ["list"])
  28814. ];
  28815. }),
  28816. _: 1
  28817. }, 16);
  28818. };
  28819. }
  28820. });
  28821. var elSpace = "";
  28822. var elRadioButton = "";
  28823. var WidgetConfig_vue_vue_type_style_index_0_lang = "";
  28824. const _sfc_main$3 = defineComponent({
  28825. name: "ElWidgetConfig",
  28826. components: {
  28827. Draggable
  28828. },
  28829. props: {
  28830. select: {
  28831. type: Object
  28832. }
  28833. },
  28834. emits: ["update:select"],
  28835. setup(props, context) {
  28836. const data2 = ref(props.select);
  28837. watch(() => props.select, (val) => data2.value = val);
  28838. watch(data2, (val) => context.emit("update:select", val), { deep: true });
  28839. const hasKey = (key) => Object.keys(data2.value.options).includes(key);
  28840. const handleInsertColumn = () => {
  28841. data2.value.columns.push({
  28842. span: 0,
  28843. list: []
  28844. });
  28845. };
  28846. const handleInsertOption = () => {
  28847. const index = data2.value.options.options.length + 1;
  28848. data2.value.options.options.push({
  28849. label: `Option ${index}`,
  28850. value: `Option ${index}`
  28851. });
  28852. };
  28853. const handleOptionsRemove = (index) => {
  28854. if (data2.value.type === "grid")
  28855. data2.value.columns.splice(index, 1);
  28856. else
  28857. data2.value.options.options.splice(index, 1);
  28858. };
  28859. const handleSliderModeChange = (checked) => {
  28860. checked ? data2.value.options.defaultValue = [10, 90] : data2.value.options.defaultValue = 0;
  28861. };
  28862. const handleSelectModeChange = (val) => {
  28863. if (data2.value.type === "img-upload")
  28864. return;
  28865. if (val) {
  28866. if (data2.value.options.defaultValue) {
  28867. if (!(data2.value.options.defaultValue instanceof Array))
  28868. data2.value.options.defaultValue = [data2.value.options.defaultValue];
  28869. } else {
  28870. data2.value.options.defaultValue = [];
  28871. }
  28872. } else {
  28873. data2.value.options.defaultValue.length ? data2.value.options.defaultValue = data2.value.options.defaultValue[0] : data2.value.options.defaultValue = null;
  28874. }
  28875. };
  28876. return {
  28877. data: data2,
  28878. hasKey,
  28879. handleInsertColumn,
  28880. handleInsertOption,
  28881. handleOptionsRemove,
  28882. handleSliderModeChange,
  28883. handleSelectModeChange
  28884. };
  28885. }
  28886. });
  28887. const _hoisted_1$2 = /* @__PURE__ */ createTextVNode(" \u884C\u5185 ");
  28888. const _hoisted_2$2 = /* @__PURE__ */ createTextVNode(" \u5757\u7EA7 ");
  28889. const _hoisted_3$2 = /* @__PURE__ */ createTextVNode(" \u9759\u6001\u6570\u636E ");
  28890. const _hoisted_4$2 = /* @__PURE__ */ createTextVNode(" \u8FDC\u7AEF\u6570\u636E ");
  28891. const _hoisted_5$2 = /* @__PURE__ */ createTextVNode(" \u8FDC\u7AEF\u65B9\u6CD5 ");
  28892. const _hoisted_6$2 = /* @__PURE__ */ createTextVNode(" \u6807\u7B7E ");
  28893. const _hoisted_7$1 = /* @__PURE__ */ createTextVNode(" \u503C ");
  28894. const _hoisted_8$1 = { class: "flex items-center" };
  28895. const _hoisted_9$1 = /* @__PURE__ */ createElementVNode("i", {
  28896. style: { "margin": "0 5px", "cursor": "move" },
  28897. class: "drag-item custom:item"
  28898. }, null, -1);
  28899. const _hoisted_10$1 = /* @__PURE__ */ createElementVNode("i", { class: "fa6-regular:trash-can" }, null, -1);
  28900. const _hoisted_11$1 = { class: "flex items-center justify-center gap-2 mb-2" };
  28901. const _hoisted_12$1 = /* @__PURE__ */ createTextVNode(/* @__PURE__ */ toDisplayString(""));
  28902. const _hoisted_13$1 = /* @__PURE__ */ createElementVNode("i", { class: "cursor-move text-sm custom:item" }, null, -1);
  28903. const _hoisted_14$1 = /* @__PURE__ */ createElementVNode("i", { class: "fa6-regular:trash-can" }, null, -1);
  28904. const _hoisted_15 = { style: { "margin-top": "5px" } };
  28905. const _hoisted_16 = /* @__PURE__ */ createTextVNode(" \u6DFB\u52A0\u9009\u9879 ");
  28906. const _hoisted_17 = /* @__PURE__ */ createTextVNode(" text ");
  28907. const _hoisted_18 = /* @__PURE__ */ createTextVNode(" picture ");
  28908. const _hoisted_19 = /* @__PURE__ */ createTextVNode(" picture-card ");
  28909. const _hoisted_20 = /* @__PURE__ */ createTextVNode(" POST ");
  28910. const _hoisted_21 = /* @__PURE__ */ createTextVNode(" PUT ");
  28911. const _hoisted_22 = /* @__PURE__ */ createTextVNode(" GET ");
  28912. const _hoisted_23 = /* @__PURE__ */ createTextVNode(" DELETE ");
  28913. const _hoisted_24 = /* @__PURE__ */ createTextVNode(" \u8FDC\u7AEF\u65B9\u6CD5 ");
  28914. const _hoisted_25 = /* @__PURE__ */ createTextVNode(" \u6807\u7B7E ");
  28915. const _hoisted_26 = /* @__PURE__ */ createTextVNode(" \u503C ");
  28916. const _hoisted_27 = /* @__PURE__ */ createTextVNode(" \u5B50\u9009\u9879 ");
  28917. const _hoisted_28 = { style: { "display": "flex", "gap": "5px", "margin-bottom": "5px" } };
  28918. const _hoisted_29 = /* @__PURE__ */ createElementVNode("i", { class: "drag-item custom:item" }, null, -1);
  28919. const _hoisted_30 = /* @__PURE__ */ createElementVNode("i", { class: "fa6-regular:trash-can" }, null, -1);
  28920. const _hoisted_31 = /* @__PURE__ */ createTextVNode(" \u6DFB\u52A0\u5217 ");
  28921. const _hoisted_32 = /* @__PURE__ */ createTextVNode(" \u5C45\u5DE6\u5BF9\u9F50 ");
  28922. const _hoisted_33 = /* @__PURE__ */ createTextVNode(" \u5C45\u4E2D\u5BF9\u9F50 ");
  28923. const _hoisted_34 = /* @__PURE__ */ createTextVNode(" \u5DE8\u53F3\u5BF9\u9F50 ");
  28924. const _hoisted_35 = { style: { "margin-bottom": "5px" } };
  28925. const _hoisted_36 = /* @__PURE__ */ createElementVNode("i", { class: "drag-item custom:item" }, null, -1);
  28926. const _hoisted_37 = /* @__PURE__ */ createElementVNode("i", { class: "fa6-regular:trash-can" }, null, -1);
  28927. const _hoisted_38 = /* @__PURE__ */ createTextVNode(" \u6DFB\u52A0\u5217 ");
  28928. const _hoisted_39 = /* @__PURE__ */ createTextVNode(" \u9876\u90E8\u5BF9\u9F50 ");
  28929. const _hoisted_40 = /* @__PURE__ */ createTextVNode(" \u5C45\u4E2D\u5BF9\u9F50 ");
  28930. const _hoisted_41 = /* @__PURE__ */ createTextVNode(" \u5E95\u90E8\u5BF9\u9F50 ");
  28931. const _hoisted_42 = /* @__PURE__ */ createTextVNode(" \u5FC5\u586B ");
  28932. const _hoisted_43 = /* @__PURE__ */ createTextVNode(" \u53EA\u8BFB ");
  28933. const _hoisted_44 = /* @__PURE__ */ createTextVNode(" \u7981\u7528 ");
  28934. const _hoisted_45 = /* @__PURE__ */ createTextVNode(" \u6E05\u9664 ");
  28935. 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);
  28936. const _hoisted_47 = /* @__PURE__ */ createTextVNode(" Blur ");
  28937. const _hoisted_48 = /* @__PURE__ */ createTextVNode(" Change ");
  28938. const _hoisted_49 = /* @__PURE__ */ createTextVNode(" \u5B57\u7B26\u4E32 ");
  28939. const _hoisted_50 = /* @__PURE__ */ createTextVNode(" \u6570\u5B57 ");
  28940. const _hoisted_51 = /* @__PURE__ */ createTextVNode(" \u5E03\u5C14\u503C ");
  28941. const _hoisted_52 = /* @__PURE__ */ createTextVNode(" \u65B9\u6CD5 ");
  28942. const _hoisted_53 = /* @__PURE__ */ createTextVNode(" \u6B63\u5219\u8868\u8FBE\u5F0F ");
  28943. const _hoisted_54 = /* @__PURE__ */ createTextVNode(" \u6574\u6570 ");
  28944. const _hoisted_55 = /* @__PURE__ */ createTextVNode(" \u6D6E\u70B9\u6570 ");
  28945. const _hoisted_56 = /* @__PURE__ */ createTextVNode(" \u6570\u7EC4 ");
  28946. const _hoisted_57 = /* @__PURE__ */ createTextVNode(" \u5BF9\u8C61 ");
  28947. const _hoisted_58 = /* @__PURE__ */ createTextVNode(" \u679A\u4E3E ");
  28948. const _hoisted_59 = /* @__PURE__ */ createTextVNode(" \u65E5\u671F ");
  28949. const _hoisted_60 = /* @__PURE__ */ createTextVNode(" URL\u5730\u5740 ");
  28950. const _hoisted_61 = /* @__PURE__ */ createTextVNode(" \u5341\u516D\u8FDB\u5236 ");
  28951. const _hoisted_62 = /* @__PURE__ */ createTextVNode(" \u90AE\u7BB1\u5730\u5740 ");
  28952. const _hoisted_63 = /* @__PURE__ */ createTextVNode(" \u4EFB\u610F\u7C7B\u578B ");
  28953. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  28954. const _component_el_input = ElInput;
  28955. const _component_el_form_item = ElFormItem;
  28956. const _component_el_rate = ElRate;
  28957. const _component_el_switch = ElSwitch;
  28958. const _component_el_input_number = ElInputNumber;
  28959. const _component_el_radio_button = ElRadioButton;
  28960. const _component_el_radio_group = ElRadioGroup;
  28961. const _component_el_space = ElSpace;
  28962. const _component_el_radio = ElRadio;
  28963. const _component_el_button = ElButton;
  28964. const _component_Draggable = resolveComponent("Draggable");
  28965. const _component_el_checkbox = ElCheckbox;
  28966. const _component_el_checkbox_group = ElCheckboxGroup$1;
  28967. const _component_el_time_picker = ElTimePicker;
  28968. const _component_el_date_picker = ElDatePicker;
  28969. const _component_el_option = ElOption;
  28970. const _component_el_select = ElSelect;
  28971. const _component_el_form = ElForm;
  28972. return _ctx.data ? (openBlock(), createBlock(_component_el_form, {
  28973. key: _ctx.data.key,
  28974. "label-position": "top",
  28975. "p-2": "",
  28976. "flex-1": "",
  28977. "overflow-auto": ""
  28978. }, {
  28979. default: withCtx(() => [
  28980. !["grid"].includes(_ctx.data.type) ? (openBlock(), createBlock(_component_el_form_item, {
  28981. key: 0,
  28982. label: "\u5B57\u6BB5\u6807\u8BC6"
  28983. }, {
  28984. default: withCtx(() => [
  28985. createVNode(_component_el_input, {
  28986. modelValue: _ctx.data.model,
  28987. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.data.model = $event),
  28988. disabled: true
  28989. }, null, 8, ["modelValue"])
  28990. ]),
  28991. _: 1
  28992. })) : createCommentVNode("", true),
  28993. !["grid", "table"].includes(_ctx.data.type) ? (openBlock(), createBlock(_component_el_form_item, {
  28994. key: 1,
  28995. label: "\u6807\u9898"
  28996. }, {
  28997. default: withCtx(() => [
  28998. createVNode(_component_el_input, {
  28999. modelValue: _ctx.data.label,
  29000. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.data.label = $event),
  29001. disabled: _ctx.data.allDisable
  29002. }, null, 8, ["modelValue", "disabled"])
  29003. ]),
  29004. _: 1
  29005. })) : createCommentVNode("", true),
  29006. _ctx.hasKey("width") ? (openBlock(), createBlock(_component_el_form_item, {
  29007. key: 2,
  29008. label: "\u5BBD\u5EA6"
  29009. }, {
  29010. default: withCtx(() => [
  29011. createVNode(_component_el_input, {
  29012. modelValue: _ctx.data.options.width,
  29013. "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => _ctx.data.options.width = $event)
  29014. }, null, 8, ["modelValue"])
  29015. ]),
  29016. _: 1
  29017. })) : createCommentVNode("", true),
  29018. _ctx.hasKey("placeholder") ? (openBlock(), createBlock(_component_el_form_item, {
  29019. key: 3,
  29020. label: "\u5360\u4F4D\u5185\u5BB9"
  29021. }, {
  29022. default: withCtx(() => [
  29023. createVNode(_component_el_input, {
  29024. modelValue: _ctx.data.options.placeholder,
  29025. "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => _ctx.data.options.placeholder = $event),
  29026. disabled: _ctx.data.allDisable
  29027. }, null, 8, ["modelValue", "disabled"])
  29028. ]),
  29029. _: 1
  29030. })) : createCommentVNode("", true),
  29031. _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, {
  29032. key: 4,
  29033. label: "\u9ED8\u8BA4\u5185\u5BB9"
  29034. }, {
  29035. default: withCtx(() => [
  29036. _ctx.data.type === "input" || _ctx.data.type === "password" || _ctx.data.type === "text" ? (openBlock(), createBlock(_component_el_input, {
  29037. key: 0,
  29038. modelValue: _ctx.data.options.defaultValue,
  29039. "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => _ctx.data.options.defaultValue = $event)
  29040. }, null, 8, ["modelValue"])) : createCommentVNode("", true),
  29041. _ctx.data.type === "textarea" ? (openBlock(), createBlock(_component_el_input, {
  29042. key: 1,
  29043. modelValue: _ctx.data.options.defaultValue,
  29044. "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => _ctx.data.options.defaultValue = $event),
  29045. type: "textarea"
  29046. }, null, 8, ["modelValue"])) : createCommentVNode("", true),
  29047. _ctx.data.type === "rate" ? (openBlock(), createBlock(_component_el_rate, {
  29048. key: 2,
  29049. modelValue: _ctx.data.options.defaultValue,
  29050. "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => _ctx.data.options.defaultValue = $event),
  29051. max: _ctx.data.options.max,
  29052. "allow-half": _ctx.data.options.allowHalf
  29053. }, null, 8, ["modelValue", "max", "allow-half"])) : createCommentVNode("", true),
  29054. _ctx.data.type === "switch" ? (openBlock(), createBlock(_component_el_switch, {
  29055. key: 3,
  29056. modelValue: _ctx.data.options.defaultValue,
  29057. "onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => _ctx.data.options.defaultValue = $event)
  29058. }, null, 8, ["modelValue"])) : createCommentVNode("", true),
  29059. _ctx.data.type === "slider" ? (openBlock(), createElementBlock(Fragment, { key: 4 }, [
  29060. !_ctx.data.options.range ? (openBlock(), createBlock(_component_el_input_number, {
  29061. key: 0,
  29062. modelValue: _ctx.data.options.defaultValue,
  29063. "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => _ctx.data.options.defaultValue = $event),
  29064. modelModifiers: { number: true }
  29065. }, null, 8, ["modelValue"])) : createCommentVNode("", true),
  29066. _ctx.data.options.range ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  29067. createVNode(_component_el_input_number, {
  29068. modelValue: _ctx.data.options.defaultValue[0],
  29069. "onUpdate:modelValue": _cache[9] || (_cache[9] = ($event) => _ctx.data.options.defaultValue[0] = $event),
  29070. modelModifiers: { number: true },
  29071. max: _ctx.data.options.max
  29072. }, null, 8, ["modelValue", "max"]),
  29073. createVNode(_component_el_input_number, {
  29074. modelValue: _ctx.data.options.defaultValue[1],
  29075. "onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => _ctx.data.options.defaultValue[1] = $event),
  29076. modelModifiers: { number: true },
  29077. max: _ctx.data.options.max
  29078. }, null, 8, ["modelValue", "max"])
  29079. ], 64)) : createCommentVNode("", true)
  29080. ], 64)) : createCommentVNode("", true)
  29081. ]),
  29082. _: 1
  29083. })) : createCommentVNode("", true),
  29084. _ctx.hasKey("maxlength") ? (openBlock(), createBlock(_component_el_form_item, {
  29085. key: 5,
  29086. label: "\u6700\u5927\u957F\u5EA6"
  29087. }, {
  29088. default: withCtx(() => [
  29089. createVNode(_component_el_input, {
  29090. modelValue: _ctx.data.options.maxlength,
  29091. "onUpdate:modelValue": _cache[11] || (_cache[11] = ($event) => _ctx.data.options.maxlength = $event),
  29092. modelModifiers: { number: true },
  29093. disabled: _ctx.data.allDisable
  29094. }, null, 8, ["modelValue", "disabled"])
  29095. ]),
  29096. _: 1
  29097. })) : createCommentVNode("", true),
  29098. _ctx.hasKey("max") ? (openBlock(), createBlock(_component_el_form_item, {
  29099. key: 6,
  29100. label: "\u6700\u5927\u503C"
  29101. }, {
  29102. default: withCtx(() => [
  29103. createVNode(_component_el_input_number, {
  29104. modelValue: _ctx.data.options.max,
  29105. "onUpdate:modelValue": _cache[12] || (_cache[12] = ($event) => _ctx.data.options.max = $event),
  29106. modelModifiers: { number: true },
  29107. disabled: _ctx.data.allDisable
  29108. }, null, 8, ["modelValue", "disabled"])
  29109. ]),
  29110. _: 1
  29111. })) : createCommentVNode("", true),
  29112. _ctx.hasKey("min") ? (openBlock(), createBlock(_component_el_form_item, {
  29113. key: 7,
  29114. label: "\u6700\u5C0F\u503C"
  29115. }, {
  29116. default: withCtx(() => [
  29117. createVNode(_component_el_input_number, {
  29118. modelValue: _ctx.data.options.min,
  29119. "onUpdate:modelValue": _cache[13] || (_cache[13] = ($event) => _ctx.data.options.min = $event),
  29120. modelModifiers: { number: true },
  29121. disabled: _ctx.data.allDisable
  29122. }, null, 8, ["modelValue", "disabled"])
  29123. ]),
  29124. _: 1
  29125. })) : createCommentVNode("", true),
  29126. _ctx.hasKey("step") ? (openBlock(), createBlock(_component_el_form_item, {
  29127. key: 8,
  29128. label: "\u6B65\u957F"
  29129. }, {
  29130. default: withCtx(() => [
  29131. createVNode(_component_el_input_number, {
  29132. modelValue: _ctx.data.options.step,
  29133. "onUpdate:modelValue": _cache[14] || (_cache[14] = ($event) => _ctx.data.options.step = $event),
  29134. modelModifiers: { number: true },
  29135. min: 0,
  29136. disabled: _ctx.data.allDisable
  29137. }, null, 8, ["modelValue", "disabled"])
  29138. ]),
  29139. _: 1
  29140. })) : createCommentVNode("", true),
  29141. _ctx.hasKey("prefix") ? (openBlock(), createBlock(_component_el_form_item, {
  29142. key: 9,
  29143. label: "\u524D\u7F00"
  29144. }, {
  29145. default: withCtx(() => [
  29146. createVNode(_component_el_input, {
  29147. modelValue: _ctx.data.options.prefix,
  29148. "onUpdate:modelValue": _cache[15] || (_cache[15] = ($event) => _ctx.data.options.prefix = $event),
  29149. disabled: _ctx.data.allDisable
  29150. }, null, 8, ["modelValue", "disabled"])
  29151. ]),
  29152. _: 1
  29153. })) : createCommentVNode("", true),
  29154. _ctx.hasKey("suffix") ? (openBlock(), createBlock(_component_el_form_item, {
  29155. key: 10,
  29156. label: "\u540E\u7F00"
  29157. }, {
  29158. default: withCtx(() => [
  29159. createVNode(_component_el_input, {
  29160. modelValue: _ctx.data.options.suffix,
  29161. "onUpdate:modelValue": _cache[16] || (_cache[16] = ($event) => _ctx.data.options.suffix = $event),
  29162. disabled: _ctx.data.allDisable
  29163. }, null, 8, ["modelValue", "disabled"])
  29164. ]),
  29165. _: 1
  29166. })) : createCommentVNode("", true),
  29167. _ctx.hasKey("prepend") ? (openBlock(), createBlock(_component_el_form_item, {
  29168. key: 11,
  29169. label: "\u524D\u7F6E\u6807\u7B7E"
  29170. }, {
  29171. default: withCtx(() => [
  29172. createVNode(_component_el_input, {
  29173. modelValue: _ctx.data.options.prepend,
  29174. "onUpdate:modelValue": _cache[17] || (_cache[17] = ($event) => _ctx.data.options.prepend = $event),
  29175. disabled: _ctx.data.allDisable
  29176. }, null, 8, ["modelValue", "disabled"])
  29177. ]),
  29178. _: 1
  29179. })) : createCommentVNode("", true),
  29180. _ctx.hasKey("append") ? (openBlock(), createBlock(_component_el_form_item, {
  29181. key: 12,
  29182. label: "\u540E\u7F6E\u6807\u7B7E"
  29183. }, {
  29184. default: withCtx(() => [
  29185. createVNode(_component_el_input, {
  29186. modelValue: _ctx.data.options.append,
  29187. "onUpdate:modelValue": _cache[18] || (_cache[18] = ($event) => _ctx.data.options.append = $event),
  29188. disabled: _ctx.data.allDisable
  29189. }, null, 8, ["modelValue", "disabled"])
  29190. ]),
  29191. _: 1
  29192. })) : createCommentVNode("", true),
  29193. _ctx.hasKey("activeText") ? (openBlock(), createBlock(_component_el_form_item, {
  29194. key: 13,
  29195. label: "\u9009\u4E2D\u65F6\u7684\u5185\u5BB9"
  29196. }, {
  29197. default: withCtx(() => [
  29198. createVNode(_component_el_input, {
  29199. modelValue: _ctx.data.options.activeText,
  29200. "onUpdate:modelValue": _cache[19] || (_cache[19] = ($event) => _ctx.data.options.activeText = $event)
  29201. }, null, 8, ["modelValue"])
  29202. ]),
  29203. _: 1
  29204. })) : createCommentVNode("", true),
  29205. _ctx.hasKey("inactiveText") ? (openBlock(), createBlock(_component_el_form_item, {
  29206. key: 14,
  29207. label: "\u975E\u9009\u4E2D\u65F6\u7684\u5185\u5BB9"
  29208. }, {
  29209. default: withCtx(() => [
  29210. createVNode(_component_el_input, {
  29211. modelValue: _ctx.data.options.inactiveText,
  29212. "onUpdate:modelValue": _cache[20] || (_cache[20] = ($event) => _ctx.data.options.inactiveText = $event)
  29213. }, null, 8, ["modelValue"])
  29214. ]),
  29215. _: 1
  29216. })) : createCommentVNode("", true),
  29217. _ctx.hasKey("editable") ? (openBlock(), createBlock(_component_el_form_item, {
  29218. key: 15,
  29219. label: "\u6587\u672C\u6846\u53EF\u8F93\u5165"
  29220. }, {
  29221. default: withCtx(() => [
  29222. createVNode(_component_el_switch, {
  29223. modelValue: _ctx.data.options.editable,
  29224. "onUpdate:modelValue": _cache[21] || (_cache[21] = ($event) => _ctx.data.options.editable = $event)
  29225. }, null, 8, ["modelValue"])
  29226. ]),
  29227. _: 1
  29228. })) : createCommentVNode("", true),
  29229. _ctx.hasKey("range") ? (openBlock(), createBlock(_component_el_form_item, {
  29230. key: 16,
  29231. label: "\u8303\u56F4\u9009\u62E9"
  29232. }, {
  29233. default: withCtx(() => [
  29234. createVNode(_component_el_switch, {
  29235. modelValue: _ctx.data.options.range,
  29236. "onUpdate:modelValue": _cache[22] || (_cache[22] = ($event) => _ctx.data.options.range = $event),
  29237. onChange: _ctx.handleSliderModeChange
  29238. }, null, 8, ["modelValue", "onChange"])
  29239. ]),
  29240. _: 1
  29241. })) : createCommentVNode("", true),
  29242. _ctx.hasKey("showPassword") ? (openBlock(), createBlock(_component_el_form_item, {
  29243. key: 17,
  29244. label: "\u662F\u5426\u663E\u793A\u5207\u6362\u6309\u94AE"
  29245. }, {
  29246. default: withCtx(() => [
  29247. createVNode(_component_el_switch, {
  29248. modelValue: _ctx.data.options.showPassword,
  29249. "onUpdate:modelValue": _cache[23] || (_cache[23] = ($event) => _ctx.data.options.showPassword = $event)
  29250. }, null, 8, ["modelValue"])
  29251. ]),
  29252. _: 1
  29253. })) : createCommentVNode("", true),
  29254. _ctx.hasKey("showWordLimit") ? (openBlock(), createBlock(_component_el_form_item, {
  29255. key: 18,
  29256. label: "\u662F\u5426\u663E\u793A\u5B57\u6570"
  29257. }, {
  29258. default: withCtx(() => [
  29259. createVNode(_component_el_switch, {
  29260. modelValue: _ctx.data.options.showWordLimit,
  29261. "onUpdate:modelValue": _cache[24] || (_cache[24] = ($event) => _ctx.data.options.showWordLimit = $event)
  29262. }, null, 8, ["modelValue"])
  29263. ]),
  29264. _: 1
  29265. })) : createCommentVNode("", true),
  29266. _ctx.hasKey("autosize") ? (openBlock(), createBlock(_component_el_form_item, {
  29267. key: 19,
  29268. label: "\u662F\u5426\u81EA\u9002\u5E94\u5185\u5BB9\u9AD8\u5EA6"
  29269. }, {
  29270. default: withCtx(() => [
  29271. createVNode(_component_el_switch, {
  29272. modelValue: _ctx.data.options.autosize,
  29273. "onUpdate:modelValue": _cache[25] || (_cache[25] = ($event) => _ctx.data.options.autosize = $event)
  29274. }, null, 8, ["modelValue"])
  29275. ]),
  29276. _: 1
  29277. })) : createCommentVNode("", true),
  29278. _ctx.hasKey("rows") && !_ctx.data.options.autosize ? (openBlock(), createBlock(_component_el_form_item, {
  29279. key: 20,
  29280. label: "\u884C\u6570"
  29281. }, {
  29282. default: withCtx(() => [
  29283. createVNode(_component_el_input_number, {
  29284. modelValue: _ctx.data.options.rows,
  29285. "onUpdate:modelValue": _cache[26] || (_cache[26] = ($event) => _ctx.data.options.rows = $event),
  29286. min: 0
  29287. }, null, 8, ["modelValue"])
  29288. ]),
  29289. _: 1
  29290. })) : createCommentVNode("", true),
  29291. _ctx.hasKey("allowHalf") ? (openBlock(), createBlock(_component_el_form_item, {
  29292. key: 21,
  29293. label: "\u662F\u5426\u5141\u8BB8\u534A\u9009"
  29294. }, {
  29295. default: withCtx(() => [
  29296. createVNode(_component_el_switch, {
  29297. modelValue: _ctx.data.options.allowHalf,
  29298. "onUpdate:modelValue": _cache[27] || (_cache[27] = ($event) => _ctx.data.options.allowHalf = $event)
  29299. }, null, 8, ["modelValue"])
  29300. ]),
  29301. _: 1
  29302. })) : createCommentVNode("", true),
  29303. _ctx.hasKey("inline") ? (openBlock(), createBlock(_component_el_form_item, {
  29304. key: 22,
  29305. label: "\u5E03\u5C40\u65B9\u5F0F"
  29306. }, {
  29307. default: withCtx(() => [
  29308. createVNode(_component_el_radio_group, {
  29309. modelValue: _ctx.data.options.inline,
  29310. "onUpdate:modelValue": _cache[28] || (_cache[28] = ($event) => _ctx.data.options.inline = $event)
  29311. }, {
  29312. default: withCtx(() => [
  29313. createVNode(_component_el_radio_button, { label: true }, {
  29314. default: withCtx(() => [
  29315. _hoisted_1$2
  29316. ]),
  29317. _: 1
  29318. }),
  29319. createVNode(_component_el_radio_button, { label: false }, {
  29320. default: withCtx(() => [
  29321. _hoisted_2$2
  29322. ]),
  29323. _: 1
  29324. })
  29325. ]),
  29326. _: 1
  29327. }, 8, ["modelValue"])
  29328. ]),
  29329. _: 1
  29330. })) : createCommentVNode("", true),
  29331. _ctx.hasKey("multiple") ? (openBlock(), createBlock(_component_el_form_item, {
  29332. key: 23,
  29333. label: "\u662F\u5426\u591A\u9009"
  29334. }, {
  29335. default: withCtx(() => [
  29336. createVNode(_component_el_switch, {
  29337. modelValue: _ctx.data.options.multiple,
  29338. "onUpdate:modelValue": _cache[29] || (_cache[29] = ($event) => _ctx.data.options.multiple = $event),
  29339. onChange: _ctx.handleSelectModeChange,
  29340. disabled: _ctx.data.allDisable
  29341. }, null, 8, ["modelValue", "onChange", "disabled"])
  29342. ]),
  29343. _: 1
  29344. })) : createCommentVNode("", true),
  29345. _ctx.hasKey("filterable") ? (openBlock(), createBlock(_component_el_form_item, {
  29346. key: 24,
  29347. label: "\u662F\u5426\u53EF\u641C\u7D22"
  29348. }, {
  29349. default: withCtx(() => [
  29350. createVNode(_component_el_switch, {
  29351. modelValue: _ctx.data.options.filterable,
  29352. "onUpdate:modelValue": _cache[30] || (_cache[30] = ($event) => _ctx.data.options.filterable = $event),
  29353. disabled: _ctx.data.allDisable
  29354. }, null, 8, ["modelValue", "disabled"])
  29355. ]),
  29356. _: 1
  29357. })) : createCommentVNode("", true),
  29358. _ctx.hasKey("showLabel") ? (openBlock(), createBlock(_component_el_form_item, {
  29359. key: 25,
  29360. label: "\u662F\u5426\u663E\u793A\u6807\u7B7E"
  29361. }, {
  29362. default: withCtx(() => [
  29363. createVNode(_component_el_switch, {
  29364. modelValue: _ctx.data.options.showLabel,
  29365. "onUpdate:modelValue": _cache[31] || (_cache[31] = ($event) => _ctx.data.options.showLabel = $event)
  29366. }, null, 8, ["modelValue"])
  29367. ]),
  29368. _: 1
  29369. })) : createCommentVNode("", true),
  29370. _ctx.hasKey("options") ? (openBlock(), createBlock(_component_el_form_item, {
  29371. key: 26,
  29372. label: "\u9009\u9879"
  29373. }, {
  29374. default: withCtx(() => [
  29375. createVNode(_component_el_radio_group, {
  29376. modelValue: _ctx.data.options.remote,
  29377. "onUpdate:modelValue": _cache[32] || (_cache[32] = ($event) => _ctx.data.options.remote = $event)
  29378. }, {
  29379. default: withCtx(() => [
  29380. createVNode(_component_el_radio_button, { label: false }, {
  29381. default: withCtx(() => [
  29382. _hoisted_3$2
  29383. ]),
  29384. _: 1
  29385. }),
  29386. createVNode(_component_el_radio_button, { label: true }, {
  29387. default: withCtx(() => [
  29388. _hoisted_4$2
  29389. ]),
  29390. _: 1
  29391. })
  29392. ]),
  29393. _: 1
  29394. }, 8, ["modelValue"]),
  29395. _ctx.data.options.remote ? (openBlock(), createBlock(_component_el_space, {
  29396. key: 0,
  29397. alignment: "start",
  29398. direction: "vertical",
  29399. style: { "margin-top": "10px" }
  29400. }, {
  29401. default: withCtx(() => [
  29402. createVNode(_component_el_input, {
  29403. modelValue: _ctx.data.options.remoteFunc,
  29404. "onUpdate:modelValue": _cache[33] || (_cache[33] = ($event) => _ctx.data.options.remoteFunc = $event)
  29405. }, {
  29406. prepend: withCtx(() => [
  29407. _hoisted_5$2
  29408. ]),
  29409. _: 1
  29410. }, 8, ["modelValue"]),
  29411. createVNode(_component_el_input, {
  29412. modelValue: _ctx.data.options.props.label,
  29413. "onUpdate:modelValue": _cache[34] || (_cache[34] = ($event) => _ctx.data.options.props.label = $event)
  29414. }, {
  29415. prepend: withCtx(() => [
  29416. _hoisted_6$2
  29417. ]),
  29418. _: 1
  29419. }, 8, ["modelValue"]),
  29420. createVNode(_component_el_input, {
  29421. modelValue: _ctx.data.options.props.value,
  29422. "onUpdate:modelValue": _cache[35] || (_cache[35] = ($event) => _ctx.data.options.props.value = $event)
  29423. }, {
  29424. prepend: withCtx(() => [
  29425. _hoisted_7$1
  29426. ]),
  29427. _: 1
  29428. }, 8, ["modelValue"])
  29429. ]),
  29430. _: 1
  29431. })) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  29432. _ctx.data.type === "radio" || _ctx.data.type === "select" && !_ctx.data.options.multiple ? (openBlock(), createBlock(_component_el_radio_group, {
  29433. key: 0,
  29434. modelValue: _ctx.data.options.defaultValue,
  29435. "onUpdate:modelValue": _cache[36] || (_cache[36] = ($event) => _ctx.data.options.defaultValue = $event),
  29436. style: { "margin-top": "8px" }
  29437. }, {
  29438. default: withCtx(() => [
  29439. createVNode(_component_Draggable, {
  29440. "item-key": "index",
  29441. "ghost-class": "ghost",
  29442. handle: ".drag-item",
  29443. group: { name: "options" },
  29444. list: _ctx.data.options.options
  29445. }, {
  29446. item: withCtx(({ element, index }) => [
  29447. createElementVNode("div", _hoisted_8$1, [
  29448. createVNode(_component_el_radio, {
  29449. label: element.value,
  29450. style: { "margin-right": "0", "margin-bottom": "0" }
  29451. }, {
  29452. default: withCtx(() => [
  29453. createVNode(_component_el_input, {
  29454. modelValue: element.value,
  29455. "onUpdate:modelValue": ($event) => element.value = $event,
  29456. style: normalizeStyle({
  29457. width: _ctx.data.options.showLabel ? "90px" : "180px"
  29458. })
  29459. }, null, 8, ["modelValue", "onUpdate:modelValue", "style"]),
  29460. _ctx.data.options.showLabel ? (openBlock(), createBlock(_component_el_input, {
  29461. key: 0,
  29462. modelValue: element.label,
  29463. "onUpdate:modelValue": ($event) => element.label = $event,
  29464. class: "ml-1",
  29465. style: {
  29466. width: "90px"
  29467. }
  29468. }, null, 8, ["modelValue", "onUpdate:modelValue"])) : createCommentVNode("", true)
  29469. ]),
  29470. _: 2
  29471. }, 1032, ["label"]),
  29472. _hoisted_9$1,
  29473. createVNode(_component_el_button, {
  29474. type: "primary",
  29475. circle: "",
  29476. onClick: ($event) => _ctx.handleOptionsRemove(index)
  29477. }, {
  29478. default: withCtx(() => [
  29479. _hoisted_10$1
  29480. ]),
  29481. _: 2
  29482. }, 1032, ["onClick"])
  29483. ])
  29484. ]),
  29485. _: 1
  29486. }, 8, ["list"])
  29487. ]),
  29488. _: 1
  29489. }, 8, ["modelValue"])) : createCommentVNode("", true),
  29490. _ctx.data.type === "checkbox" || _ctx.data.type === "select" && _ctx.data.options.multiple ? (openBlock(), createBlock(_component_el_checkbox_group, {
  29491. key: 1,
  29492. modelValue: _ctx.data.options.defaultValue,
  29493. "onUpdate:modelValue": _cache[37] || (_cache[37] = ($event) => _ctx.data.options.defaultValue = $event),
  29494. style: { "margin-top": "8px" }
  29495. }, {
  29496. default: withCtx(() => [
  29497. createVNode(_component_Draggable, {
  29498. "item-key": "index",
  29499. "ghost-class": "ghost",
  29500. handle: "[cursor-move]",
  29501. group: { name: "options" },
  29502. list: _ctx.data.options.options
  29503. }, {
  29504. item: withCtx(({ element, index }) => [
  29505. createElementVNode("div", _hoisted_11$1, [
  29506. createVNode(_component_el_checkbox, {
  29507. label: element.value
  29508. }, {
  29509. default: withCtx(() => [
  29510. _hoisted_12$1
  29511. ]),
  29512. _: 2
  29513. }, 1032, ["label"]),
  29514. createVNode(_component_el_input, {
  29515. modelValue: element.value,
  29516. "onUpdate:modelValue": ($event) => element.value = $event,
  29517. style: normalizeStyle({
  29518. width: _ctx.data.options.showLabel ? "90px" : "180px"
  29519. })
  29520. }, null, 8, ["modelValue", "onUpdate:modelValue", "style"]),
  29521. _ctx.data.options.showLabel ? (openBlock(), createBlock(_component_el_input, {
  29522. key: 0,
  29523. modelValue: element.label,
  29524. "onUpdate:modelValue": ($event) => element.label = $event,
  29525. style: { width: "90px" }
  29526. }, null, 8, ["modelValue", "onUpdate:modelValue"])) : createCommentVNode("", true),
  29527. _hoisted_13$1,
  29528. createVNode(_component_el_button, {
  29529. type: "primary",
  29530. circle: "",
  29531. onClick: ($event) => _ctx.handleOptionsRemove(index)
  29532. }, {
  29533. default: withCtx(() => [
  29534. _hoisted_14$1
  29535. ]),
  29536. _: 2
  29537. }, 1032, ["onClick"])
  29538. ])
  29539. ]),
  29540. _: 1
  29541. }, 8, ["list"])
  29542. ]),
  29543. _: 1
  29544. }, 8, ["modelValue"])) : createCommentVNode("", true),
  29545. createElementVNode("div", _hoisted_15, [
  29546. createVNode(_component_el_button, {
  29547. type: "text",
  29548. onClick: _ctx.handleInsertOption
  29549. }, {
  29550. default: withCtx(() => [
  29551. _hoisted_16
  29552. ]),
  29553. _: 1
  29554. }, 8, ["onClick"])
  29555. ])
  29556. ], 64))
  29557. ]),
  29558. _: 1
  29559. })) : createCommentVNode("", true),
  29560. _ctx.data.type === "time" ? (openBlock(), createBlock(_component_el_form_item, {
  29561. key: 27,
  29562. label: "\u9ED8\u8BA4\u503C"
  29563. }, {
  29564. default: withCtx(() => [
  29565. createVNode(_component_el_time_picker, {
  29566. modelValue: _ctx.data.options.defaultValue,
  29567. "onUpdate:modelValue": _cache[38] || (_cache[38] = ($event) => _ctx.data.options.defaultValue = $event),
  29568. style: { "width": "100%" },
  29569. format: _ctx.data.options.format,
  29570. placeholder: _ctx.data.options.placeholder
  29571. }, null, 8, ["modelValue", "format", "placeholder"])
  29572. ]),
  29573. _: 1
  29574. })) : createCommentVNode("", true),
  29575. _ctx.data.type === "date" ? (openBlock(), createBlock(_component_el_form_item, {
  29576. key: 28,
  29577. label: "\u9ED8\u8BA4\u503C"
  29578. }, {
  29579. default: withCtx(() => [
  29580. createVNode(_component_el_date_picker, {
  29581. modelValue: _ctx.data.options.defaultValue,
  29582. "onUpdate:modelValue": _cache[39] || (_cache[39] = ($event) => _ctx.data.options.defaultValue = $event),
  29583. style: { "width": "100%" },
  29584. format: _ctx.data.options.format,
  29585. placeholder: _ctx.data.options.placeholder
  29586. }, null, 8, ["modelValue", "format", "placeholder"])
  29587. ]),
  29588. _: 1
  29589. })) : createCommentVNode("", true),
  29590. _ctx.data.type === "time" || _ctx.data.type === "date" ? (openBlock(), createBlock(_component_el_form_item, {
  29591. key: 29,
  29592. label: "\u683C\u5F0F"
  29593. }, {
  29594. default: withCtx(() => [
  29595. createVNode(_component_el_input, {
  29596. modelValue: _ctx.data.options.format,
  29597. "onUpdate:modelValue": _cache[40] || (_cache[40] = ($event) => _ctx.data.options.format = $event)
  29598. }, null, 8, ["modelValue"])
  29599. ]),
  29600. _: 1
  29601. })) : createCommentVNode("", true),
  29602. _ctx.data.type === "download" ? (openBlock(), createBlock(_component_el_form_item, {
  29603. key: 30,
  29604. label: "\u5730\u5740"
  29605. }, {
  29606. default: withCtx(() => [
  29607. createVNode(_component_el_input, {
  29608. modelValue: _ctx.data.options.defaultValue,
  29609. "onUpdate:modelValue": _cache[41] || (_cache[41] = ($event) => _ctx.data.options.defaultValue = $event)
  29610. }, null, 8, ["modelValue"])
  29611. ]),
  29612. _: 1
  29613. })) : createCommentVNode("", true),
  29614. _ctx.data.type === "img-upload" ? (openBlock(), createElementBlock(Fragment, { key: 31 }, [
  29615. createVNode(_component_el_form_item, { label: "\u6A21\u5F0F" }, {
  29616. default: withCtx(() => [
  29617. createVNode(_component_el_radio_group, {
  29618. modelValue: _ctx.data.options.listType,
  29619. "onUpdate:modelValue": _cache[42] || (_cache[42] = ($event) => _ctx.data.options.listType = $event)
  29620. }, {
  29621. default: withCtx(() => [
  29622. createVNode(_component_el_radio_button, { label: "text" }, {
  29623. default: withCtx(() => [
  29624. _hoisted_17
  29625. ]),
  29626. _: 1
  29627. }),
  29628. createVNode(_component_el_radio_button, { label: "picture" }, {
  29629. default: withCtx(() => [
  29630. _hoisted_18
  29631. ]),
  29632. _: 1
  29633. }),
  29634. createVNode(_component_el_radio_button, { label: "picture-card" }, {
  29635. default: withCtx(() => [
  29636. _hoisted_19
  29637. ]),
  29638. _: 1
  29639. })
  29640. ]),
  29641. _: 1
  29642. }, 8, ["modelValue"])
  29643. ]),
  29644. _: 1
  29645. }),
  29646. createVNode(_component_el_form_item, { label: "\u6587\u4EF6\u53C2\u6570\u540D" }, {
  29647. default: withCtx(() => [
  29648. createVNode(_component_el_input, {
  29649. modelValue: _ctx.data.options.name,
  29650. "onUpdate:modelValue": _cache[43] || (_cache[43] = ($event) => _ctx.data.options.name = $event)
  29651. }, null, 8, ["modelValue"])
  29652. ]),
  29653. _: 1
  29654. }),
  29655. createVNode(_component_el_form_item, { label: "\u4E0A\u4F20\u5730\u5740" }, {
  29656. default: withCtx(() => [
  29657. createVNode(_component_el_input, {
  29658. modelValue: _ctx.data.options.action,
  29659. "onUpdate:modelValue": _cache[44] || (_cache[44] = ($event) => _ctx.data.options.action = $event)
  29660. }, null, 8, ["modelValue"])
  29661. ]),
  29662. _: 1
  29663. }),
  29664. createVNode(_component_el_form_item, { label: "\u63A5\u53D7\u4E0A\u4F20\u7684\u6587\u4EF6\u7C7B\u578B(\u591A\u4E2A\u4F7F\u7528 , \u9694\u5F00)" }, {
  29665. default: withCtx(() => [
  29666. createVNode(_component_el_input, {
  29667. modelValue: _ctx.data.options.accept,
  29668. "onUpdate:modelValue": _cache[45] || (_cache[45] = ($event) => _ctx.data.options.accept = $event)
  29669. }, null, 8, ["modelValue"])
  29670. ]),
  29671. _: 1
  29672. }),
  29673. createVNode(_component_el_form_item, { label: "\u6700\u5927\u4E0A\u4F20\u6570\u91CF" }, {
  29674. default: withCtx(() => [
  29675. createVNode(_component_el_input_number, {
  29676. modelValue: _ctx.data.options.limit,
  29677. "onUpdate:modelValue": _cache[46] || (_cache[46] = ($event) => _ctx.data.options.limit = $event),
  29678. modelModifiers: { number: true },
  29679. min: 1
  29680. }, null, 8, ["modelValue"])
  29681. ]),
  29682. _: 1
  29683. }),
  29684. createVNode(_component_el_form_item, { label: "\u4E0A\u4F20\u8BF7\u6C42\u65B9\u6CD5" }, {
  29685. default: withCtx(() => [
  29686. createVNode(_component_el_radio_group, {
  29687. modelValue: _ctx.data.options.method,
  29688. "onUpdate:modelValue": _cache[47] || (_cache[47] = ($event) => _ctx.data.options.method = $event)
  29689. }, {
  29690. default: withCtx(() => [
  29691. createVNode(_component_el_radio_button, { label: "post" }, {
  29692. default: withCtx(() => [
  29693. _hoisted_20
  29694. ]),
  29695. _: 1
  29696. }),
  29697. createVNode(_component_el_radio_button, { label: "put" }, {
  29698. default: withCtx(() => [
  29699. _hoisted_21
  29700. ]),
  29701. _: 1
  29702. }),
  29703. createVNode(_component_el_radio_button, { label: "get" }, {
  29704. default: withCtx(() => [
  29705. _hoisted_22
  29706. ]),
  29707. _: 1
  29708. }),
  29709. createVNode(_component_el_radio_button, { label: "delete" }, {
  29710. default: withCtx(() => [
  29711. _hoisted_23
  29712. ]),
  29713. _: 1
  29714. })
  29715. ]),
  29716. _: 1
  29717. }, 8, ["modelValue"])
  29718. ]),
  29719. _: 1
  29720. })
  29721. ], 64)) : createCommentVNode("", true),
  29722. _ctx.data.type === "cascader" ? (openBlock(), createBlock(_component_el_form_item, {
  29723. key: 32,
  29724. label: "\u8FDC\u7AEF\u6570\u636E"
  29725. }, {
  29726. default: withCtx(() => [
  29727. createVNode(_component_el_space, {
  29728. direction: "vertical",
  29729. alignment: "start"
  29730. }, {
  29731. default: withCtx(() => [
  29732. createVNode(_component_el_input, {
  29733. modelValue: _ctx.data.options.remoteFunc,
  29734. "onUpdate:modelValue": _cache[48] || (_cache[48] = ($event) => _ctx.data.options.remoteFunc = $event)
  29735. }, {
  29736. prepend: withCtx(() => [
  29737. _hoisted_24
  29738. ]),
  29739. _: 1
  29740. }, 8, ["modelValue"]),
  29741. createVNode(_component_el_input, {
  29742. modelValue: _ctx.data.options.props.label,
  29743. "onUpdate:modelValue": _cache[49] || (_cache[49] = ($event) => _ctx.data.options.props.label = $event)
  29744. }, {
  29745. prepend: withCtx(() => [
  29746. _hoisted_25
  29747. ]),
  29748. _: 1
  29749. }, 8, ["modelValue"]),
  29750. createVNode(_component_el_input, {
  29751. modelValue: _ctx.data.options.props.value,
  29752. "onUpdate:modelValue": _cache[50] || (_cache[50] = ($event) => _ctx.data.options.props.value = $event)
  29753. }, {
  29754. prepend: withCtx(() => [
  29755. _hoisted_26
  29756. ]),
  29757. _: 1
  29758. }, 8, ["modelValue"]),
  29759. createVNode(_component_el_input, {
  29760. modelValue: _ctx.data.options.props.children,
  29761. "onUpdate:modelValue": _cache[51] || (_cache[51] = ($event) => _ctx.data.options.props.children = $event)
  29762. }, {
  29763. prepend: withCtx(() => [
  29764. _hoisted_27
  29765. ]),
  29766. _: 1
  29767. }, 8, ["modelValue"])
  29768. ]),
  29769. _: 1
  29770. })
  29771. ]),
  29772. _: 1
  29773. })) : createCommentVNode("", true),
  29774. _ctx.data.type === "table" ? (openBlock(), createElementBlock(Fragment, { key: 33 }, [
  29775. createVNode(_component_el_form_item, { label: "\u5217\u914D\u7F6E\u9879" }, {
  29776. default: withCtx(() => [
  29777. createVNode(_component_Draggable, {
  29778. tag: "ul",
  29779. "item-key": "index",
  29780. "ghost-class": "ghost",
  29781. handle: ".drag-item",
  29782. group: { name: "options" },
  29783. list: _ctx.data.columns
  29784. }, {
  29785. item: withCtx(({ element, index }) => [
  29786. createElementVNode("li", _hoisted_28, [
  29787. _hoisted_29,
  29788. createVNode(_component_el_input, {
  29789. modelValue: element.label,
  29790. "onUpdate:modelValue": ($event) => element.label = $event,
  29791. placeholder: "\u663E\u793A\u540D\u79F0"
  29792. }, null, 8, ["modelValue", "onUpdate:modelValue"]),
  29793. createVNode(_component_el_input, {
  29794. modelValue: element.prop,
  29795. "onUpdate:modelValue": ($event) => element.prop = $event,
  29796. placeholder: "\u5B57\u6BB5\u5B57\u6BB5"
  29797. }, null, 8, ["modelValue", "onUpdate:modelValue"]),
  29798. createVNode(_component_el_button, {
  29799. type: "primary",
  29800. circle: "",
  29801. style: { "margin-left": "5px" },
  29802. onClick: ($event) => _ctx.data.columns.splice(index, 1)
  29803. }, {
  29804. default: withCtx(() => [
  29805. _hoisted_30
  29806. ]),
  29807. _: 2
  29808. }, 1032, ["onClick"])
  29809. ])
  29810. ]),
  29811. _: 1
  29812. }, 8, ["list"]),
  29813. createElementVNode("div", null, [
  29814. createVNode(_component_el_button, {
  29815. type: "text",
  29816. onClick: _cache[52] || (_cache[52] = ($event) => _ctx.data.columns.push({}))
  29817. }, {
  29818. default: withCtx(() => [
  29819. _hoisted_31
  29820. ]),
  29821. _: 1
  29822. })
  29823. ])
  29824. ]),
  29825. _: 1
  29826. }),
  29827. createVNode(_component_el_form_item, { label: "\u5BF9\u9F50\u65B9\u5F0F" }, {
  29828. default: withCtx(() => [
  29829. createVNode(_component_el_radio_group, {
  29830. modelValue: _ctx.data.options.align,
  29831. "onUpdate:modelValue": _cache[53] || (_cache[53] = ($event) => _ctx.data.options.align = $event)
  29832. }, {
  29833. default: withCtx(() => [
  29834. createVNode(_component_el_radio_button, { label: "left" }, {
  29835. default: withCtx(() => [
  29836. _hoisted_32
  29837. ]),
  29838. _: 1
  29839. }),
  29840. createVNode(_component_el_radio_button, { label: "center" }, {
  29841. default: withCtx(() => [
  29842. _hoisted_33
  29843. ]),
  29844. _: 1
  29845. }),
  29846. createVNode(_component_el_radio_button, { label: "right" }, {
  29847. default: withCtx(() => [
  29848. _hoisted_34
  29849. ]),
  29850. _: 1
  29851. })
  29852. ]),
  29853. _: 1
  29854. }, 8, ["modelValue"])
  29855. ]),
  29856. _: 1
  29857. })
  29858. ], 64)) : createCommentVNode("", true),
  29859. _ctx.data.type === "grid" ? (openBlock(), createElementBlock(Fragment, { key: 34 }, [
  29860. createVNode(_component_el_form_item, { label: "\u6805\u683C\u95F4\u9694" }, {
  29861. default: withCtx(() => [
  29862. createVNode(_component_el_input_number, {
  29863. modelValue: _ctx.data.options.gutter,
  29864. "onUpdate:modelValue": _cache[54] || (_cache[54] = ($event) => _ctx.data.options.gutter = $event),
  29865. modelModifiers: { number: true },
  29866. min: 0
  29867. }, null, 8, ["modelValue"])
  29868. ]),
  29869. _: 1
  29870. }),
  29871. createVNode(_component_el_form_item, { label: "\u5217\u914D\u7F6E\u9879" }, {
  29872. default: withCtx(() => [
  29873. createVNode(_component_Draggable, {
  29874. tag: "ul",
  29875. "item-key": "index",
  29876. "ghost-class": "ghost",
  29877. handle: ".drag-item",
  29878. group: { name: "options" },
  29879. list: _ctx.data.columns
  29880. }, {
  29881. item: withCtx(({ element, index }) => [
  29882. createElementVNode("li", _hoisted_35, [
  29883. _hoisted_36,
  29884. createVNode(_component_el_input_number, {
  29885. modelValue: element.span,
  29886. "onUpdate:modelValue": ($event) => element.span = $event,
  29887. modelModifiers: { number: true },
  29888. placeholder: "\u6805\u683C\u503C",
  29889. min: 0,
  29890. max: 24
  29891. }, null, 8, ["modelValue", "onUpdate:modelValue"]),
  29892. createVNode(_component_el_button, {
  29893. type: "primary",
  29894. circle: "",
  29895. style: { "margin-left": "5px" },
  29896. onClick: ($event) => _ctx.handleOptionsRemove(index)
  29897. }, {
  29898. default: withCtx(() => [
  29899. _hoisted_37
  29900. ]),
  29901. _: 2
  29902. }, 1032, ["onClick"])
  29903. ])
  29904. ]),
  29905. _: 1
  29906. }, 8, ["list"]),
  29907. createElementVNode("div", null, [
  29908. createVNode(_component_el_button, {
  29909. type: "text",
  29910. onClick: _ctx.handleInsertColumn
  29911. }, {
  29912. default: withCtx(() => [
  29913. _hoisted_38
  29914. ]),
  29915. _: 1
  29916. }, 8, ["onClick"])
  29917. ])
  29918. ]),
  29919. _: 1
  29920. }),
  29921. createVNode(_component_el_form_item, { label: "\u5782\u76F4\u5BF9\u9F50\u65B9\u5F0F" }, {
  29922. default: withCtx(() => [
  29923. createVNode(_component_el_radio_group, {
  29924. modelValue: _ctx.data.options.align,
  29925. "onUpdate:modelValue": _cache[55] || (_cache[55] = ($event) => _ctx.data.options.align = $event)
  29926. }, {
  29927. default: withCtx(() => [
  29928. createVNode(_component_el_radio_button, { label: "initial" }, {
  29929. default: withCtx(() => [
  29930. _hoisted_39
  29931. ]),
  29932. _: 1
  29933. }),
  29934. createVNode(_component_el_radio_button, { label: "center" }, {
  29935. default: withCtx(() => [
  29936. _hoisted_40
  29937. ]),
  29938. _: 1
  29939. }),
  29940. createVNode(_component_el_radio_button, { label: "flex-end" }, {
  29941. default: withCtx(() => [
  29942. _hoisted_41
  29943. ]),
  29944. _: 1
  29945. })
  29946. ]),
  29947. _: 1
  29948. }, 8, ["modelValue"])
  29949. ]),
  29950. _: 1
  29951. })
  29952. ], 64)) : createCommentVNode("", true),
  29953. _ctx.data.type !== "grid" ? (openBlock(), createElementBlock(Fragment, { key: 35 }, [
  29954. _ctx.hasKey("rules") || _ctx.hasKey("readonly") || _ctx.hasKey("disabled") || _ctx.hasKey("allowClear") ? (openBlock(), createBlock(_component_el_form_item, {
  29955. key: 0,
  29956. label: "\u64CD\u4F5C\u5C5E\u6027"
  29957. }, {
  29958. default: withCtx(() => [
  29959. _ctx.hasKey("rules") ? (openBlock(), createBlock(_component_el_checkbox, {
  29960. key: 0,
  29961. modelValue: _ctx.data.options.rules.required,
  29962. "onUpdate:modelValue": _cache[56] || (_cache[56] = ($event) => _ctx.data.options.rules.required = $event),
  29963. disabled: _ctx.data.allDisable
  29964. }, {
  29965. default: withCtx(() => [
  29966. _hoisted_42
  29967. ]),
  29968. _: 1
  29969. }, 8, ["modelValue", "disabled"])) : createCommentVNode("", true),
  29970. _ctx.hasKey("readonly") ? (openBlock(), createBlock(_component_el_checkbox, {
  29971. key: 1,
  29972. modelValue: _ctx.data.options.readonly,
  29973. "onUpdate:modelValue": _cache[57] || (_cache[57] = ($event) => _ctx.data.options.readonly = $event),
  29974. disabled: _ctx.data.allDisable
  29975. }, {
  29976. default: withCtx(() => [
  29977. _hoisted_43
  29978. ]),
  29979. _: 1
  29980. }, 8, ["modelValue", "disabled"])) : createCommentVNode("", true),
  29981. _ctx.hasKey("disabled") ? (openBlock(), createBlock(_component_el_checkbox, {
  29982. key: 2,
  29983. modelValue: _ctx.data.options.disabled,
  29984. "onUpdate:modelValue": _cache[58] || (_cache[58] = ($event) => _ctx.data.options.disabled = $event),
  29985. disabled: _ctx.data.allDisable
  29986. }, {
  29987. default: withCtx(() => [
  29988. _hoisted_44
  29989. ]),
  29990. _: 1
  29991. }, 8, ["modelValue", "disabled"])) : createCommentVNode("", true),
  29992. _ctx.hasKey("clearable") ? (openBlock(), createBlock(_component_el_checkbox, {
  29993. key: 3,
  29994. modelValue: _ctx.data.options.clearable,
  29995. "onUpdate:modelValue": _cache[59] || (_cache[59] = ($event) => _ctx.data.options.clearable = $event),
  29996. disabled: _ctx.data.allDisable
  29997. }, {
  29998. default: withCtx(() => [
  29999. _hoisted_45
  30000. ]),
  30001. _: 1
  30002. }, 8, ["modelValue", "disabled"])) : createCommentVNode("", true)
  30003. ]),
  30004. _: 1
  30005. })) : createCommentVNode("", true),
  30006. _ctx.hasKey("rules") ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  30007. _hoisted_46,
  30008. createVNode(_component_el_form_item, { label: "\u89E6\u53D1\u65F6\u673A" }, {
  30009. default: withCtx(() => [
  30010. createVNode(_component_el_radio_group, {
  30011. modelValue: _ctx.data.options.rules.trigger,
  30012. "onUpdate:modelValue": _cache[60] || (_cache[60] = ($event) => _ctx.data.options.rules.trigger = $event)
  30013. }, {
  30014. default: withCtx(() => [
  30015. createVNode(_component_el_radio_button, { label: "blur" }, {
  30016. default: withCtx(() => [
  30017. _hoisted_47
  30018. ]),
  30019. _: 1
  30020. }),
  30021. createVNode(_component_el_radio_button, { label: "change" }, {
  30022. default: withCtx(() => [
  30023. _hoisted_48
  30024. ]),
  30025. _: 1
  30026. })
  30027. ]),
  30028. _: 1
  30029. }, 8, ["modelValue"])
  30030. ]),
  30031. _: 1
  30032. }),
  30033. createVNode(_component_el_form_item, { label: "\u679A\u4E3E\u7C7B\u578B" }, {
  30034. default: withCtx(() => [
  30035. createVNode(_component_el_input, {
  30036. value: _ctx.data.options.rules.enum,
  30037. "onUpdate:value": _cache[61] || (_cache[61] = ($event) => _ctx.data.options.rules.enum = $event)
  30038. }, null, 8, ["value"])
  30039. ]),
  30040. _: 1
  30041. }),
  30042. createVNode(_component_el_form_item, { label: "\u5B57\u6BB5\u957F\u5EA6" }, {
  30043. default: withCtx(() => [
  30044. createVNode(_component_el_input, {
  30045. modelValue: _ctx.data.options.rules.len,
  30046. "onUpdate:modelValue": _cache[62] || (_cache[62] = ($event) => _ctx.data.options.rules.len = $event),
  30047. modelModifiers: { number: true }
  30048. }, null, 8, ["modelValue"])
  30049. ]),
  30050. _: 1
  30051. }),
  30052. createVNode(_component_el_form_item, { label: "\u6700\u5927\u957F\u5EA6" }, {
  30053. default: withCtx(() => [
  30054. createVNode(_component_el_input, {
  30055. modelValue: _ctx.data.options.rules.max,
  30056. "onUpdate:modelValue": _cache[63] || (_cache[63] = ($event) => _ctx.data.options.rules.max = $event),
  30057. modelModifiers: { number: true }
  30058. }, null, 8, ["modelValue"])
  30059. ]),
  30060. _: 1
  30061. }),
  30062. createVNode(_component_el_form_item, { label: "\u6700\u5C0F\u957F\u5EA6" }, {
  30063. default: withCtx(() => [
  30064. createVNode(_component_el_input, {
  30065. modelValue: _ctx.data.options.rules.min,
  30066. "onUpdate:modelValue": _cache[64] || (_cache[64] = ($event) => _ctx.data.options.rules.min = $event),
  30067. modelModifiers: { number: true }
  30068. }, null, 8, ["modelValue"])
  30069. ]),
  30070. _: 1
  30071. }),
  30072. createVNode(_component_el_form_item, { label: "\u6821\u9A8C\u6587\u6848" }, {
  30073. default: withCtx(() => [
  30074. createVNode(_component_el_input, {
  30075. modelValue: _ctx.data.options.rules.message,
  30076. "onUpdate:modelValue": _cache[65] || (_cache[65] = ($event) => _ctx.data.options.rules.message = $event)
  30077. }, null, 8, ["modelValue"])
  30078. ]),
  30079. _: 1
  30080. }),
  30081. createVNode(_component_el_form_item, { label: "\u6B63\u5219\u8868\u8FBE\u5F0F" }, {
  30082. default: withCtx(() => [
  30083. createVNode(_component_el_input, {
  30084. modelValue: _ctx.data.options.rules.pattern,
  30085. "onUpdate:modelValue": _cache[66] || (_cache[66] = ($event) => _ctx.data.options.rules.pattern = $event)
  30086. }, null, 8, ["modelValue"])
  30087. ]),
  30088. _: 1
  30089. }),
  30090. createVNode(_component_el_form_item, { label: "\u6821\u9A8C\u7C7B\u578B" }, {
  30091. default: withCtx(() => [
  30092. createVNode(_component_el_select, {
  30093. modelValue: _ctx.data.options.rules.type,
  30094. "onUpdate:modelValue": _cache[67] || (_cache[67] = ($event) => _ctx.data.options.rules.type = $event)
  30095. }, {
  30096. default: withCtx(() => [
  30097. createVNode(_component_el_option, { value: "string" }, {
  30098. default: withCtx(() => [
  30099. _hoisted_49
  30100. ]),
  30101. _: 1
  30102. }),
  30103. createVNode(_component_el_option, { value: "number" }, {
  30104. default: withCtx(() => [
  30105. _hoisted_50
  30106. ]),
  30107. _: 1
  30108. }),
  30109. createVNode(_component_el_option, { value: "boolean" }, {
  30110. default: withCtx(() => [
  30111. _hoisted_51
  30112. ]),
  30113. _: 1
  30114. }),
  30115. createVNode(_component_el_option, { value: "method" }, {
  30116. default: withCtx(() => [
  30117. _hoisted_52
  30118. ]),
  30119. _: 1
  30120. }),
  30121. createVNode(_component_el_option, { value: "regexp" }, {
  30122. default: withCtx(() => [
  30123. _hoisted_53
  30124. ]),
  30125. _: 1
  30126. }),
  30127. createVNode(_component_el_option, { value: "integer" }, {
  30128. default: withCtx(() => [
  30129. _hoisted_54
  30130. ]),
  30131. _: 1
  30132. }),
  30133. createVNode(_component_el_option, { value: "float" }, {
  30134. default: withCtx(() => [
  30135. _hoisted_55
  30136. ]),
  30137. _: 1
  30138. }),
  30139. createVNode(_component_el_option, { value: "array" }, {
  30140. default: withCtx(() => [
  30141. _hoisted_56
  30142. ]),
  30143. _: 1
  30144. }),
  30145. createVNode(_component_el_option, { value: "object" }, {
  30146. default: withCtx(() => [
  30147. _hoisted_57
  30148. ]),
  30149. _: 1
  30150. }),
  30151. createVNode(_component_el_option, { value: "enum" }, {
  30152. default: withCtx(() => [
  30153. _hoisted_58
  30154. ]),
  30155. _: 1
  30156. }),
  30157. createVNode(_component_el_option, { value: "date" }, {
  30158. default: withCtx(() => [
  30159. _hoisted_59
  30160. ]),
  30161. _: 1
  30162. }),
  30163. createVNode(_component_el_option, { value: "url" }, {
  30164. default: withCtx(() => [
  30165. _hoisted_60
  30166. ]),
  30167. _: 1
  30168. }),
  30169. createVNode(_component_el_option, { value: "hex" }, {
  30170. default: withCtx(() => [
  30171. _hoisted_61
  30172. ]),
  30173. _: 1
  30174. }),
  30175. createVNode(_component_el_option, { value: "email" }, {
  30176. default: withCtx(() => [
  30177. _hoisted_62
  30178. ]),
  30179. _: 1
  30180. }),
  30181. createVNode(_component_el_option, { value: "any" }, {
  30182. default: withCtx(() => [
  30183. _hoisted_63
  30184. ]),
  30185. _: 1
  30186. })
  30187. ]),
  30188. _: 1
  30189. }, 8, ["modelValue"])
  30190. ]),
  30191. _: 1
  30192. })
  30193. ], 64)) : createCommentVNode("", true)
  30194. ], 64)) : createCommentVNode("", true)
  30195. ]),
  30196. _: 1
  30197. })) : createCommentVNode("", true);
  30198. }
  30199. var WidgetConfig = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render]]);
  30200. const _hoisted_1$1 = /* @__PURE__ */ createTextVNode(" \u5DE6\u5BF9\u9F50 ");
  30201. const _hoisted_2$1 = /* @__PURE__ */ createTextVNode(" \u53F3\u5BF9\u9F50 ");
  30202. const _hoisted_3$1 = /* @__PURE__ */ createTextVNode(" \u9876\u90E8\u5BF9\u9F50 ");
  30203. const _hoisted_4$1 = /* @__PURE__ */ createTextVNode(" \u5927 ");
  30204. const _hoisted_5$1 = /* @__PURE__ */ createTextVNode(" \u9ED8\u8BA4 ");
  30205. const _hoisted_6$1 = /* @__PURE__ */ createTextVNode(" \u5C0F ");
  30206. const _sfc_main$2 = /* @__PURE__ */ defineComponent({
  30207. props: {
  30208. config: null
  30209. },
  30210. setup(__props) {
  30211. return (_ctx, _cache) => {
  30212. const _component_el_radio_button = ElRadioButton;
  30213. const _component_el_radio_group = ElRadioGroup;
  30214. const _component_el_form_item = ElFormItem;
  30215. const _component_el_input_number = ElInputNumber;
  30216. const _component_el_switch = ElSwitch;
  30217. const _component_el_form = ElForm;
  30218. return openBlock(), createBlock(_component_el_form, {
  30219. "p-2": "",
  30220. "label-position": "top",
  30221. onSubmit: _cache[4] || (_cache[4] = withModifiers(() => {
  30222. }, ["prevent"]))
  30223. }, {
  30224. default: withCtx(() => [
  30225. createVNode(_component_el_form_item, { label: "\u6807\u7B7E\u5BF9\u9F50\u65B9\u5F0F" }, {
  30226. default: withCtx(() => [
  30227. createVNode(_component_el_radio_group, {
  30228. modelValue: __props.config.labelPosition,
  30229. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => __props.config.labelPosition = $event)
  30230. }, {
  30231. default: withCtx(() => [
  30232. createVNode(_component_el_radio_button, { label: "left" }, {
  30233. default: withCtx(() => [
  30234. _hoisted_1$1
  30235. ]),
  30236. _: 1
  30237. }),
  30238. createVNode(_component_el_radio_button, { label: "right" }, {
  30239. default: withCtx(() => [
  30240. _hoisted_2$1
  30241. ]),
  30242. _: 1
  30243. }),
  30244. createVNode(_component_el_radio_button, { label: "top" }, {
  30245. default: withCtx(() => [
  30246. _hoisted_3$1
  30247. ]),
  30248. _: 1
  30249. })
  30250. ]),
  30251. _: 1
  30252. }, 8, ["modelValue"])
  30253. ]),
  30254. _: 1
  30255. }),
  30256. createVNode(_component_el_form_item, { label: "\u6807\u7B7E\u5BBD\u5EA6" }, {
  30257. default: withCtx(() => [
  30258. createVNode(_component_el_input_number, {
  30259. modelValue: __props.config.labelWidth,
  30260. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => __props.config.labelWidth = $event),
  30261. modelModifiers: { number: true },
  30262. min: 0
  30263. }, null, 8, ["modelValue"])
  30264. ]),
  30265. _: 1
  30266. }),
  30267. createVNode(_component_el_form_item, { label: "\u7EC4\u4EF6\u5C3A\u5BF8" }, {
  30268. default: withCtx(() => [
  30269. createVNode(_component_el_radio_group, {
  30270. modelValue: __props.config.size,
  30271. "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => __props.config.size = $event)
  30272. }, {
  30273. default: withCtx(() => [
  30274. createVNode(_component_el_radio_button, { label: "large" }, {
  30275. default: withCtx(() => [
  30276. _hoisted_4$1
  30277. ]),
  30278. _: 1
  30279. }),
  30280. createVNode(_component_el_radio_button, { label: "default" }, {
  30281. default: withCtx(() => [
  30282. _hoisted_5$1
  30283. ]),
  30284. _: 1
  30285. }),
  30286. createVNode(_component_el_radio_button, { label: "small" }, {
  30287. default: withCtx(() => [
  30288. _hoisted_6$1
  30289. ]),
  30290. _: 1
  30291. })
  30292. ]),
  30293. _: 1
  30294. }, 8, ["modelValue"])
  30295. ]),
  30296. _: 1
  30297. }),
  30298. createVNode(_component_el_form_item, { label: "\u9690\u85CF\u5FC5\u9009\u6807\u8BB0" }, {
  30299. default: withCtx(() => [
  30300. createVNode(_component_el_switch, {
  30301. modelValue: __props.config.hideRequiredAsterisk,
  30302. "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => __props.config.hideRequiredAsterisk = $event)
  30303. }, null, 8, ["modelValue"])
  30304. ]),
  30305. _: 1
  30306. })
  30307. ]),
  30308. _: 1
  30309. });
  30310. };
  30311. }
  30312. });
  30313. function _extends() {
  30314. _extends = Object.assign || function(target) {
  30315. for (var i = 1; i < arguments.length; i++) {
  30316. var source = arguments[i];
  30317. for (var key in source) {
  30318. if (Object.prototype.hasOwnProperty.call(source, key)) {
  30319. target[key] = source[key];
  30320. }
  30321. }
  30322. }
  30323. return target;
  30324. };
  30325. return _extends.apply(this, arguments);
  30326. }
  30327. var KEYCODE_ENTER = 13;
  30328. var KEYCODE_TAB = 9;
  30329. var KEYCODE_BACKSPACE = 8;
  30330. var KEYCODE_Y = 89;
  30331. var KEYCODE_Z = 90;
  30332. var KEYCODE_M = 77;
  30333. var KEYCODE_PARENS = 57;
  30334. var KEYCODE_BRACKETS = 219;
  30335. var KEYCODE_QUOTE = 222;
  30336. var KEYCODE_BACK_QUOTE = 192;
  30337. var KEYCODE_ESCAPE = 27;
  30338. var HISTORY_LIMIT = 100;
  30339. var HISTORY_TIME_GAP = 3e3;
  30340. var isWindows = typeof window !== "undefined" && navigator && /* @__PURE__ */ /Win/i.test(navigator.platform);
  30341. var isMacLike = typeof window !== "undefined" && navigator && /* @__PURE__ */ /(Mac|iPhone|iPod|iPad)/i.test(navigator.platform);
  30342. var PrismEditor = /* @__PURE__ */ defineComponent({
  30343. props: {
  30344. lineNumbers: {
  30345. type: Boolean,
  30346. "default": false
  30347. },
  30348. autoStyleLineNumbers: {
  30349. type: Boolean,
  30350. "default": true
  30351. },
  30352. readonly: {
  30353. type: Boolean,
  30354. "default": false
  30355. },
  30356. modelValue: {
  30357. type: String,
  30358. "default": ""
  30359. },
  30360. highlight: {
  30361. type: Function,
  30362. required: true
  30363. },
  30364. tabSize: {
  30365. type: Number,
  30366. "default": 2
  30367. },
  30368. insertSpaces: {
  30369. type: Boolean,
  30370. "default": true
  30371. },
  30372. ignoreTabKey: {
  30373. type: Boolean,
  30374. "default": false
  30375. },
  30376. placeholder: {
  30377. type: String,
  30378. "default": ""
  30379. }
  30380. },
  30381. data: function data() {
  30382. return {
  30383. capture: true,
  30384. history: {
  30385. stack: [],
  30386. offset: -1
  30387. },
  30388. lineNumbersHeight: "20px",
  30389. codeData: ""
  30390. };
  30391. },
  30392. watch: {
  30393. modelValue: {
  30394. immediate: true,
  30395. handler: function handler(newVal) {
  30396. if (!newVal) {
  30397. this.codeData = "";
  30398. } else {
  30399. this.codeData = newVal;
  30400. }
  30401. }
  30402. },
  30403. content: {
  30404. immediate: true,
  30405. handler: function handler2() {
  30406. var _this = this;
  30407. if (this.lineNumbers) {
  30408. this.$nextTick(function() {
  30409. _this.setLineNumbersHeight();
  30410. });
  30411. }
  30412. }
  30413. },
  30414. lineNumbers: function lineNumbers() {
  30415. var _this2 = this;
  30416. this.$nextTick(function() {
  30417. _this2.styleLineNumbers();
  30418. _this2.setLineNumbersHeight();
  30419. });
  30420. }
  30421. },
  30422. computed: {
  30423. isEmpty: function isEmpty2() {
  30424. return this.codeData.length === 0;
  30425. },
  30426. content: function content() {
  30427. var result = this.highlight(this.codeData) + "<br />";
  30428. return result;
  30429. },
  30430. lineNumbersCount: function lineNumbersCount() {
  30431. var totalLines = this.codeData.split(/\r\n|\n/).length;
  30432. return totalLines;
  30433. }
  30434. },
  30435. mounted: function mounted() {
  30436. this._recordCurrentState();
  30437. this.styleLineNumbers();
  30438. },
  30439. methods: {
  30440. setLineNumbersHeight: function setLineNumbersHeight() {
  30441. this.lineNumbersHeight = getComputedStyle(this.$refs.pre).height;
  30442. },
  30443. styleLineNumbers: function styleLineNumbers() {
  30444. if (!this.lineNumbers || !this.autoStyleLineNumbers)
  30445. return;
  30446. var $editor = this.$refs.pre;
  30447. var $lineNumbers = this.$el.querySelector(".prism-editor__line-numbers");
  30448. var editorStyles = window.getComputedStyle($editor);
  30449. this.$nextTick(function() {
  30450. var btlr = "border-top-left-radius";
  30451. var bblr = "border-bottom-left-radius";
  30452. if (!$lineNumbers)
  30453. return;
  30454. $lineNumbers.style[btlr] = editorStyles[btlr];
  30455. $lineNumbers.style[bblr] = editorStyles[bblr];
  30456. $editor.style[btlr] = "0";
  30457. $editor.style[bblr] = "0";
  30458. var stylesList = ["background-color", "margin-top", "padding-top", "font-family", "font-size", "line-height"];
  30459. stylesList.forEach(function(style) {
  30460. $lineNumbers.style[style] = editorStyles[style];
  30461. });
  30462. $lineNumbers.style["margin-bottom"] = "-" + editorStyles["padding-top"];
  30463. });
  30464. },
  30465. _recordCurrentState: function _recordCurrentState() {
  30466. var input = this.$refs.textarea;
  30467. if (!input)
  30468. return;
  30469. var value = input.value, selectionStart = input.selectionStart, selectionEnd = input.selectionEnd;
  30470. this._recordChange({
  30471. value,
  30472. selectionStart,
  30473. selectionEnd
  30474. });
  30475. },
  30476. _getLines: function _getLines(text, position) {
  30477. return text.substring(0, position).split("\n");
  30478. },
  30479. _applyEdits: function _applyEdits(record) {
  30480. var input = this.$refs.textarea;
  30481. var last = this.history.stack[this.history.offset];
  30482. if (last && input) {
  30483. this.history.stack[this.history.offset] = _extends({}, last, {
  30484. selectionStart: input.selectionStart,
  30485. selectionEnd: input.selectionEnd
  30486. });
  30487. }
  30488. this._recordChange(record);
  30489. this._updateInput(record);
  30490. },
  30491. _recordChange: function _recordChange(record, overwrite) {
  30492. if (overwrite === void 0) {
  30493. overwrite = false;
  30494. }
  30495. var _this$history = this.history, stack = _this$history.stack, offset2 = _this$history.offset;
  30496. if (stack.length && offset2 > -1) {
  30497. this.history.stack = stack.slice(0, offset2 + 1);
  30498. var count = this.history.stack.length;
  30499. if (count > HISTORY_LIMIT) {
  30500. var extras = count - HISTORY_LIMIT;
  30501. this.history.stack = stack.slice(extras, count);
  30502. this.history.offset = Math.max(this.history.offset - extras, 0);
  30503. }
  30504. }
  30505. var timestamp = Date.now();
  30506. if (overwrite) {
  30507. var last = this.history.stack[this.history.offset];
  30508. if (last && timestamp - last.timestamp < HISTORY_TIME_GAP) {
  30509. var _this$_getLines$pop, _this$_getLines$pop2;
  30510. var re = /[^a-z0-9]([a-z0-9]+)$/i;
  30511. 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);
  30512. 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);
  30513. if (previous && current && current[1].startsWith(previous[1])) {
  30514. this.history.stack[this.history.offset] = _extends({}, record, {
  30515. timestamp
  30516. });
  30517. return;
  30518. }
  30519. }
  30520. }
  30521. this.history.stack.push(_extends({}, record, {
  30522. timestamp
  30523. }));
  30524. this.history.offset++;
  30525. },
  30526. _updateInput: function _updateInput(record) {
  30527. var input = this.$refs.textarea;
  30528. if (!input)
  30529. return;
  30530. input.value = record.value;
  30531. input.selectionStart = record.selectionStart;
  30532. input.selectionEnd = record.selectionEnd;
  30533. this.$emit("update:modelValue", record.value);
  30534. },
  30535. handleChange: function handleChange(e) {
  30536. var _e$target = e.target, value = _e$target.value, selectionStart = _e$target.selectionStart, selectionEnd = _e$target.selectionEnd;
  30537. this._recordChange({
  30538. value,
  30539. selectionStart,
  30540. selectionEnd
  30541. }, true);
  30542. this.$emit("update:modelValue", value);
  30543. },
  30544. _undoEdit: function _undoEdit() {
  30545. var _this$history2 = this.history, stack = _this$history2.stack, offset2 = _this$history2.offset;
  30546. var record = stack[offset2 - 1];
  30547. if (record) {
  30548. this._updateInput(record);
  30549. this.history.offset = Math.max(offset2 - 1, 0);
  30550. }
  30551. },
  30552. _redoEdit: function _redoEdit() {
  30553. var _this$history3 = this.history, stack = _this$history3.stack, offset2 = _this$history3.offset;
  30554. var record = stack[offset2 + 1];
  30555. if (record) {
  30556. this._updateInput(record);
  30557. this.history.offset = Math.min(offset2 + 1, stack.length - 1);
  30558. }
  30559. },
  30560. handleKeyDown: function handleKeyDown(e) {
  30561. var tabSize = this.tabSize, insertSpaces = this.insertSpaces, ignoreTabKey = this.ignoreTabKey;
  30562. this.$emit("keydown", e);
  30563. if (e.defaultPrevented) {
  30564. return;
  30565. }
  30566. if (e.keyCode === KEYCODE_ESCAPE) {
  30567. e.target.blur();
  30568. this.$emit("blur", e);
  30569. }
  30570. var _e$target2 = e.target, value = _e$target2.value, selectionStart = _e$target2.selectionStart, selectionEnd = _e$target2.selectionEnd;
  30571. var tabCharacter = (insertSpaces ? " " : " ").repeat(tabSize);
  30572. if (e.keyCode === KEYCODE_TAB && !ignoreTabKey && this.capture) {
  30573. e.preventDefault();
  30574. if (e.shiftKey) {
  30575. var linesBeforeCaret = this._getLines(value, selectionStart);
  30576. var startLine = linesBeforeCaret.length - 1;
  30577. var endLine = this._getLines(value, selectionEnd).length - 1;
  30578. var nextValue = value.split("\n").map(function(line2, i) {
  30579. if (i >= startLine && i <= endLine && line2.startsWith(tabCharacter)) {
  30580. return line2.substring(tabCharacter.length);
  30581. }
  30582. return line2;
  30583. }).join("\n");
  30584. if (value !== nextValue) {
  30585. var startLineText = linesBeforeCaret[startLine];
  30586. this._applyEdits({
  30587. value: nextValue,
  30588. selectionStart: startLineText.startsWith(tabCharacter) ? selectionStart - tabCharacter.length : selectionStart,
  30589. selectionEnd: selectionEnd - (value.length - nextValue.length)
  30590. });
  30591. }
  30592. } else if (selectionStart !== selectionEnd) {
  30593. var _linesBeforeCaret = this._getLines(value, selectionStart);
  30594. var _startLine = _linesBeforeCaret.length - 1;
  30595. var _endLine = this._getLines(value, selectionEnd).length - 1;
  30596. var _startLineText = _linesBeforeCaret[_startLine];
  30597. this._applyEdits({
  30598. value: value.split("\n").map(function(line2, i) {
  30599. if (i >= _startLine && i <= _endLine) {
  30600. return tabCharacter + line2;
  30601. }
  30602. return line2;
  30603. }).join("\n"),
  30604. selectionStart: /\S/.test(_startLineText) ? selectionStart + tabCharacter.length : selectionStart,
  30605. selectionEnd: selectionEnd + tabCharacter.length * (_endLine - _startLine + 1)
  30606. });
  30607. } else {
  30608. var updatedSelection = selectionStart + tabCharacter.length;
  30609. this._applyEdits({
  30610. value: value.substring(0, selectionStart) + tabCharacter + value.substring(selectionEnd),
  30611. selectionStart: updatedSelection,
  30612. selectionEnd: updatedSelection
  30613. });
  30614. }
  30615. } else if (e.keyCode === KEYCODE_BACKSPACE) {
  30616. var hasSelection = selectionStart !== selectionEnd;
  30617. var textBeforeCaret = value.substring(0, selectionStart);
  30618. if (textBeforeCaret.endsWith(tabCharacter) && !hasSelection) {
  30619. e.preventDefault();
  30620. var _updatedSelection = selectionStart - tabCharacter.length;
  30621. this._applyEdits({
  30622. value: value.substring(0, selectionStart - tabCharacter.length) + value.substring(selectionEnd),
  30623. selectionStart: _updatedSelection,
  30624. selectionEnd: _updatedSelection
  30625. });
  30626. }
  30627. } else if (e.keyCode === KEYCODE_ENTER) {
  30628. if (selectionStart === selectionEnd) {
  30629. var line = this._getLines(value, selectionStart).pop();
  30630. var matches = line === null || line === void 0 ? void 0 : line.match(/^\s+/);
  30631. if (matches && matches[0]) {
  30632. e.preventDefault();
  30633. var indent = "\n" + matches[0];
  30634. var _updatedSelection2 = selectionStart + indent.length;
  30635. this._applyEdits({
  30636. value: value.substring(0, selectionStart) + indent + value.substring(selectionEnd),
  30637. selectionStart: _updatedSelection2,
  30638. selectionEnd: _updatedSelection2
  30639. });
  30640. }
  30641. }
  30642. } else if (e.keyCode === KEYCODE_PARENS || e.keyCode === KEYCODE_BRACKETS || e.keyCode === KEYCODE_QUOTE || e.keyCode === KEYCODE_BACK_QUOTE) {
  30643. var chars;
  30644. if (e.keyCode === KEYCODE_PARENS && e.shiftKey) {
  30645. chars = ["(", ")"];
  30646. } else if (e.keyCode === KEYCODE_BRACKETS) {
  30647. if (e.shiftKey) {
  30648. chars = ["{", "}"];
  30649. } else {
  30650. chars = ["[", "]"];
  30651. }
  30652. } else if (e.keyCode === KEYCODE_QUOTE) {
  30653. if (e.shiftKey) {
  30654. chars = ['"', '"'];
  30655. } else {
  30656. chars = ["'", "'"];
  30657. }
  30658. } else if (e.keyCode === KEYCODE_BACK_QUOTE && !e.shiftKey) {
  30659. chars = ["`", "`"];
  30660. }
  30661. if (selectionStart !== selectionEnd && chars) {
  30662. e.preventDefault();
  30663. this._applyEdits({
  30664. value: value.substring(0, selectionStart) + chars[0] + value.substring(selectionStart, selectionEnd) + chars[1] + value.substring(selectionEnd),
  30665. selectionStart,
  30666. selectionEnd: selectionEnd + 2
  30667. });
  30668. }
  30669. } else if ((isMacLike ? e.metaKey && e.keyCode === KEYCODE_Z : e.ctrlKey && e.keyCode === KEYCODE_Z) && !e.shiftKey && !e.altKey) {
  30670. e.preventDefault();
  30671. this._undoEdit();
  30672. } 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) {
  30673. e.preventDefault();
  30674. this._redoEdit();
  30675. } else if (e.keyCode === KEYCODE_M && e.ctrlKey && (isMacLike ? e.shiftKey : true)) {
  30676. e.preventDefault();
  30677. this.capture = !this.capture;
  30678. }
  30679. }
  30680. },
  30681. render: function render() {
  30682. var _this3 = this;
  30683. var lineNumberWidthCalculator = h$1("div", {
  30684. "class": "prism-editor__line-width-calc",
  30685. style: "height: 0px; visibility: hidden; pointer-events: none;"
  30686. }, "999");
  30687. var lineNumbers2 = h$1("div", {
  30688. "class": "prism-editor__line-numbers",
  30689. style: {
  30690. "min-height": this.lineNumbersHeight
  30691. },
  30692. "aria-hidden": "true"
  30693. }, [lineNumberWidthCalculator, Array.from(Array(this.lineNumbersCount).keys()).map(function(_2, index) {
  30694. return h$1("div", {
  30695. "class": "prism-editor__line-number token comment"
  30696. }, "" + ++index);
  30697. })]);
  30698. var textarea = h$1("textarea", {
  30699. ref: "textarea",
  30700. onInput: this.handleChange,
  30701. onKeydown: this.handleKeyDown,
  30702. onClick: function onClick($event) {
  30703. _this3.$emit("click", $event);
  30704. },
  30705. onKeyup: function onKeyup($event) {
  30706. _this3.$emit("keyup", $event);
  30707. },
  30708. onFocus: function onFocus($event) {
  30709. _this3.$emit("focus", $event);
  30710. },
  30711. onBlur: function onBlur($event) {
  30712. _this3.$emit("blur", $event);
  30713. },
  30714. "class": {
  30715. "prism-editor__textarea": true,
  30716. "prism-editor__textarea--empty": this.isEmpty
  30717. },
  30718. spellCheck: "false",
  30719. autocapitalize: "off",
  30720. autocomplete: "off",
  30721. autocorrect: "off",
  30722. "data-gramm": "false",
  30723. placeholder: this.placeholder,
  30724. "data-testid": "textarea",
  30725. readonly: this.readonly,
  30726. value: this.codeData
  30727. });
  30728. var preview = h$1("pre", {
  30729. ref: "pre",
  30730. "class": "prism-editor__editor",
  30731. "data-testid": "preview",
  30732. innerHTML: this.content
  30733. });
  30734. var editorContainer = h$1("div", {
  30735. "class": "prism-editor__container"
  30736. }, [textarea, preview]);
  30737. return h$1("div", {
  30738. "class": "prism-editor-wrapper"
  30739. }, [this.lineNumbers && lineNumbers2, editorContainer]);
  30740. }
  30741. });
  30742. var prismeditor_min = "";
  30743. var prismCore = { exports: {} };
  30744. (function(module2) {
  30745. var _self = typeof window !== "undefined" ? window : typeof WorkerGlobalScope !== "undefined" && self instanceof WorkerGlobalScope ? self : {};
  30746. /**
  30747. * Prism: Lightweight, robust, elegant syntax highlighting
  30748. *
  30749. * @license MIT <https://opensource.org/licenses/MIT>
  30750. * @author Lea Verou <https://lea.verou.me>
  30751. * @namespace
  30752. * @public
  30753. */
  30754. var Prism2 = function(_self2) {
  30755. var lang = /(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i;
  30756. var uniqueId = 0;
  30757. var plainTextGrammar = {};
  30758. var _2 = {
  30759. manual: _self2.Prism && _self2.Prism.manual,
  30760. disableWorkerMessageHandler: _self2.Prism && _self2.Prism.disableWorkerMessageHandler,
  30761. util: {
  30762. encode: function encode(tokens) {
  30763. if (tokens instanceof Token) {
  30764. return new Token(tokens.type, encode(tokens.content), tokens.alias);
  30765. } else if (Array.isArray(tokens)) {
  30766. return tokens.map(encode);
  30767. } else {
  30768. return tokens.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/\u00a0/g, " ");
  30769. }
  30770. },
  30771. type: function(o2) {
  30772. return Object.prototype.toString.call(o2).slice(8, -1);
  30773. },
  30774. objId: function(obj) {
  30775. if (!obj["__id"]) {
  30776. Object.defineProperty(obj, "__id", { value: ++uniqueId });
  30777. }
  30778. return obj["__id"];
  30779. },
  30780. clone: function deepClone(o2, visited) {
  30781. visited = visited || {};
  30782. var clone2;
  30783. var id;
  30784. switch (_2.util.type(o2)) {
  30785. case "Object":
  30786. id = _2.util.objId(o2);
  30787. if (visited[id]) {
  30788. return visited[id];
  30789. }
  30790. clone2 = {};
  30791. visited[id] = clone2;
  30792. for (var key in o2) {
  30793. if (o2.hasOwnProperty(key)) {
  30794. clone2[key] = deepClone(o2[key], visited);
  30795. }
  30796. }
  30797. return clone2;
  30798. case "Array":
  30799. id = _2.util.objId(o2);
  30800. if (visited[id]) {
  30801. return visited[id];
  30802. }
  30803. clone2 = [];
  30804. visited[id] = clone2;
  30805. o2.forEach(function(v2, i) {
  30806. clone2[i] = deepClone(v2, visited);
  30807. });
  30808. return clone2;
  30809. default:
  30810. return o2;
  30811. }
  30812. },
  30813. getLanguage: function(element) {
  30814. while (element) {
  30815. var m2 = lang.exec(element.className);
  30816. if (m2) {
  30817. return m2[1].toLowerCase();
  30818. }
  30819. element = element.parentElement;
  30820. }
  30821. return "none";
  30822. },
  30823. setLanguage: function(element, language) {
  30824. element.className = element.className.replace(RegExp(lang, "gi"), "");
  30825. element.classList.add("language-" + language);
  30826. },
  30827. currentScript: function() {
  30828. if (typeof document === "undefined") {
  30829. return null;
  30830. }
  30831. if ("currentScript" in document && 1 < 2) {
  30832. return document.currentScript;
  30833. }
  30834. try {
  30835. throw new Error();
  30836. } catch (err) {
  30837. var src = (/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(err.stack) || [])[1];
  30838. if (src) {
  30839. var scripts = document.getElementsByTagName("script");
  30840. for (var i in scripts) {
  30841. if (scripts[i].src == src) {
  30842. return scripts[i];
  30843. }
  30844. }
  30845. }
  30846. return null;
  30847. }
  30848. },
  30849. isActive: function(element, className, defaultActivation) {
  30850. var no = "no-" + className;
  30851. while (element) {
  30852. var classList = element.classList;
  30853. if (classList.contains(className)) {
  30854. return true;
  30855. }
  30856. if (classList.contains(no)) {
  30857. return false;
  30858. }
  30859. element = element.parentElement;
  30860. }
  30861. return !!defaultActivation;
  30862. }
  30863. },
  30864. languages: {
  30865. plain: plainTextGrammar,
  30866. plaintext: plainTextGrammar,
  30867. text: plainTextGrammar,
  30868. txt: plainTextGrammar,
  30869. extend: function(id, redef) {
  30870. var lang2 = _2.util.clone(_2.languages[id]);
  30871. for (var key in redef) {
  30872. lang2[key] = redef[key];
  30873. }
  30874. return lang2;
  30875. },
  30876. insertBefore: function(inside, before, insert, root2) {
  30877. root2 = root2 || _2.languages;
  30878. var grammar = root2[inside];
  30879. var ret = {};
  30880. for (var token in grammar) {
  30881. if (grammar.hasOwnProperty(token)) {
  30882. if (token == before) {
  30883. for (var newToken in insert) {
  30884. if (insert.hasOwnProperty(newToken)) {
  30885. ret[newToken] = insert[newToken];
  30886. }
  30887. }
  30888. }
  30889. if (!insert.hasOwnProperty(token)) {
  30890. ret[token] = grammar[token];
  30891. }
  30892. }
  30893. }
  30894. var old = root2[inside];
  30895. root2[inside] = ret;
  30896. _2.languages.DFS(_2.languages, function(key, value) {
  30897. if (value === old && key != inside) {
  30898. this[key] = ret;
  30899. }
  30900. });
  30901. return ret;
  30902. },
  30903. DFS: function DFS(o2, callback, type4, visited) {
  30904. visited = visited || {};
  30905. var objId = _2.util.objId;
  30906. for (var i in o2) {
  30907. if (o2.hasOwnProperty(i)) {
  30908. callback.call(o2, i, o2[i], type4 || i);
  30909. var property = o2[i];
  30910. var propertyType = _2.util.type(property);
  30911. if (propertyType === "Object" && !visited[objId(property)]) {
  30912. visited[objId(property)] = true;
  30913. DFS(property, callback, null, visited);
  30914. } else if (propertyType === "Array" && !visited[objId(property)]) {
  30915. visited[objId(property)] = true;
  30916. DFS(property, callback, i, visited);
  30917. }
  30918. }
  30919. }
  30920. }
  30921. },
  30922. plugins: {},
  30923. highlightAll: function(async, callback) {
  30924. _2.highlightAllUnder(document, async, callback);
  30925. },
  30926. highlightAllUnder: function(container, async, callback) {
  30927. var env = {
  30928. callback,
  30929. container,
  30930. selector: 'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'
  30931. };
  30932. _2.hooks.run("before-highlightall", env);
  30933. env.elements = Array.prototype.slice.apply(env.container.querySelectorAll(env.selector));
  30934. _2.hooks.run("before-all-elements-highlight", env);
  30935. for (var i = 0, element; element = env.elements[i++]; ) {
  30936. _2.highlightElement(element, async === true, env.callback);
  30937. }
  30938. },
  30939. highlightElement: function(element, async, callback) {
  30940. var language = _2.util.getLanguage(element);
  30941. var grammar = _2.languages[language];
  30942. _2.util.setLanguage(element, language);
  30943. var parent = element.parentElement;
  30944. if (parent && parent.nodeName.toLowerCase() === "pre") {
  30945. _2.util.setLanguage(parent, language);
  30946. }
  30947. var code = element.textContent;
  30948. var env = {
  30949. element,
  30950. language,
  30951. grammar,
  30952. code
  30953. };
  30954. function insertHighlightedCode(highlightedCode) {
  30955. env.highlightedCode = highlightedCode;
  30956. _2.hooks.run("before-insert", env);
  30957. env.element.innerHTML = env.highlightedCode;
  30958. _2.hooks.run("after-highlight", env);
  30959. _2.hooks.run("complete", env);
  30960. callback && callback.call(env.element);
  30961. }
  30962. _2.hooks.run("before-sanity-check", env);
  30963. parent = env.element.parentElement;
  30964. if (parent && parent.nodeName.toLowerCase() === "pre" && !parent.hasAttribute("tabindex")) {
  30965. parent.setAttribute("tabindex", "0");
  30966. }
  30967. if (!env.code) {
  30968. _2.hooks.run("complete", env);
  30969. callback && callback.call(env.element);
  30970. return;
  30971. }
  30972. _2.hooks.run("before-highlight", env);
  30973. if (!env.grammar) {
  30974. insertHighlightedCode(_2.util.encode(env.code));
  30975. return;
  30976. }
  30977. if (async && _self2.Worker) {
  30978. var worker = new Worker(_2.filename);
  30979. worker.onmessage = function(evt) {
  30980. insertHighlightedCode(evt.data);
  30981. };
  30982. worker.postMessage(JSON.stringify({
  30983. language: env.language,
  30984. code: env.code,
  30985. immediateClose: true
  30986. }));
  30987. } else {
  30988. insertHighlightedCode(_2.highlight(env.code, env.grammar, env.language));
  30989. }
  30990. },
  30991. highlight: function(text, grammar, language) {
  30992. var env = {
  30993. code: text,
  30994. grammar,
  30995. language
  30996. };
  30997. _2.hooks.run("before-tokenize", env);
  30998. if (!env.grammar) {
  30999. throw new Error('The language "' + env.language + '" has no grammar.');
  31000. }
  31001. env.tokens = _2.tokenize(env.code, env.grammar);
  31002. _2.hooks.run("after-tokenize", env);
  31003. return Token.stringify(_2.util.encode(env.tokens), env.language);
  31004. },
  31005. tokenize: function(text, grammar) {
  31006. var rest = grammar.rest;
  31007. if (rest) {
  31008. for (var token in rest) {
  31009. grammar[token] = rest[token];
  31010. }
  31011. delete grammar.rest;
  31012. }
  31013. var tokenList = new LinkedList();
  31014. addAfter(tokenList, tokenList.head, text);
  31015. matchGrammar(text, tokenList, grammar, tokenList.head, 0);
  31016. return toArray(tokenList);
  31017. },
  31018. hooks: {
  31019. all: {},
  31020. add: function(name, callback) {
  31021. var hooks = _2.hooks.all;
  31022. hooks[name] = hooks[name] || [];
  31023. hooks[name].push(callback);
  31024. },
  31025. run: function(name, env) {
  31026. var callbacks = _2.hooks.all[name];
  31027. if (!callbacks || !callbacks.length) {
  31028. return;
  31029. }
  31030. for (var i = 0, callback; callback = callbacks[i++]; ) {
  31031. callback(env);
  31032. }
  31033. }
  31034. },
  31035. Token
  31036. };
  31037. _self2.Prism = _2;
  31038. function Token(type4, content2, alias, matchedStr) {
  31039. this.type = type4;
  31040. this.content = content2;
  31041. this.alias = alias;
  31042. this.length = (matchedStr || "").length | 0;
  31043. }
  31044. Token.stringify = function stringify(o2, language) {
  31045. if (typeof o2 == "string") {
  31046. return o2;
  31047. }
  31048. if (Array.isArray(o2)) {
  31049. var s2 = "";
  31050. o2.forEach(function(e) {
  31051. s2 += stringify(e, language);
  31052. });
  31053. return s2;
  31054. }
  31055. var env = {
  31056. type: o2.type,
  31057. content: stringify(o2.content, language),
  31058. tag: "span",
  31059. classes: ["token", o2.type],
  31060. attributes: {},
  31061. language
  31062. };
  31063. var aliases = o2.alias;
  31064. if (aliases) {
  31065. if (Array.isArray(aliases)) {
  31066. Array.prototype.push.apply(env.classes, aliases);
  31067. } else {
  31068. env.classes.push(aliases);
  31069. }
  31070. }
  31071. _2.hooks.run("wrap", env);
  31072. var attributes = "";
  31073. for (var name in env.attributes) {
  31074. attributes += " " + name + '="' + (env.attributes[name] || "").replace(/"/g, "&quot;") + '"';
  31075. }
  31076. return "<" + env.tag + ' class="' + env.classes.join(" ") + '"' + attributes + ">" + env.content + "</" + env.tag + ">";
  31077. };
  31078. function matchPattern(pattern4, pos, text, lookbehind) {
  31079. pattern4.lastIndex = pos;
  31080. var match = pattern4.exec(text);
  31081. if (match && lookbehind && match[1]) {
  31082. var lookbehindLength = match[1].length;
  31083. match.index += lookbehindLength;
  31084. match[0] = match[0].slice(lookbehindLength);
  31085. }
  31086. return match;
  31087. }
  31088. function matchGrammar(text, tokenList, grammar, startNode, startPos, rematch) {
  31089. for (var token in grammar) {
  31090. if (!grammar.hasOwnProperty(token) || !grammar[token]) {
  31091. continue;
  31092. }
  31093. var patterns = grammar[token];
  31094. patterns = Array.isArray(patterns) ? patterns : [patterns];
  31095. for (var j = 0; j < patterns.length; ++j) {
  31096. if (rematch && rematch.cause == token + "," + j) {
  31097. return;
  31098. }
  31099. var patternObj = patterns[j];
  31100. var inside = patternObj.inside;
  31101. var lookbehind = !!patternObj.lookbehind;
  31102. var greedy = !!patternObj.greedy;
  31103. var alias = patternObj.alias;
  31104. if (greedy && !patternObj.pattern.global) {
  31105. var flags = patternObj.pattern.toString().match(/[imsuy]*$/)[0];
  31106. patternObj.pattern = RegExp(patternObj.pattern.source, flags + "g");
  31107. }
  31108. var pattern4 = patternObj.pattern || patternObj;
  31109. for (var currentNode = startNode.next, pos = startPos; currentNode !== tokenList.tail; pos += currentNode.value.length, currentNode = currentNode.next) {
  31110. if (rematch && pos >= rematch.reach) {
  31111. break;
  31112. }
  31113. var str = currentNode.value;
  31114. if (tokenList.length > text.length) {
  31115. return;
  31116. }
  31117. if (str instanceof Token) {
  31118. continue;
  31119. }
  31120. var removeCount = 1;
  31121. var match;
  31122. if (greedy) {
  31123. match = matchPattern(pattern4, pos, text, lookbehind);
  31124. if (!match || match.index >= text.length) {
  31125. break;
  31126. }
  31127. var from = match.index;
  31128. var to = match.index + match[0].length;
  31129. var p2 = pos;
  31130. p2 += currentNode.value.length;
  31131. while (from >= p2) {
  31132. currentNode = currentNode.next;
  31133. p2 += currentNode.value.length;
  31134. }
  31135. p2 -= currentNode.value.length;
  31136. pos = p2;
  31137. if (currentNode.value instanceof Token) {
  31138. continue;
  31139. }
  31140. for (var k = currentNode; k !== tokenList.tail && (p2 < to || typeof k.value === "string"); k = k.next) {
  31141. removeCount++;
  31142. p2 += k.value.length;
  31143. }
  31144. removeCount--;
  31145. str = text.slice(pos, p2);
  31146. match.index -= pos;
  31147. } else {
  31148. match = matchPattern(pattern4, 0, str, lookbehind);
  31149. if (!match) {
  31150. continue;
  31151. }
  31152. }
  31153. var from = match.index;
  31154. var matchStr = match[0];
  31155. var before = str.slice(0, from);
  31156. var after = str.slice(from + matchStr.length);
  31157. var reach = pos + str.length;
  31158. if (rematch && reach > rematch.reach) {
  31159. rematch.reach = reach;
  31160. }
  31161. var removeFrom = currentNode.prev;
  31162. if (before) {
  31163. removeFrom = addAfter(tokenList, removeFrom, before);
  31164. pos += before.length;
  31165. }
  31166. removeRange(tokenList, removeFrom, removeCount);
  31167. var wrapped = new Token(token, inside ? _2.tokenize(matchStr, inside) : matchStr, alias, matchStr);
  31168. currentNode = addAfter(tokenList, removeFrom, wrapped);
  31169. if (after) {
  31170. addAfter(tokenList, currentNode, after);
  31171. }
  31172. if (removeCount > 1) {
  31173. var nestedRematch = {
  31174. cause: token + "," + j,
  31175. reach
  31176. };
  31177. matchGrammar(text, tokenList, grammar, currentNode.prev, pos, nestedRematch);
  31178. if (rematch && nestedRematch.reach > rematch.reach) {
  31179. rematch.reach = nestedRematch.reach;
  31180. }
  31181. }
  31182. }
  31183. }
  31184. }
  31185. }
  31186. function LinkedList() {
  31187. var head = { value: null, prev: null, next: null };
  31188. var tail = { value: null, prev: head, next: null };
  31189. head.next = tail;
  31190. this.head = head;
  31191. this.tail = tail;
  31192. this.length = 0;
  31193. }
  31194. function addAfter(list, node, value) {
  31195. var next = node.next;
  31196. var newNode = { value, prev: node, next };
  31197. node.next = newNode;
  31198. next.prev = newNode;
  31199. list.length++;
  31200. return newNode;
  31201. }
  31202. function removeRange(list, node, count) {
  31203. var next = node.next;
  31204. for (var i = 0; i < count && next !== list.tail; i++) {
  31205. next = next.next;
  31206. }
  31207. node.next = next;
  31208. next.prev = node;
  31209. list.length -= i;
  31210. }
  31211. function toArray(list) {
  31212. var array4 = [];
  31213. var node = list.head.next;
  31214. while (node !== list.tail) {
  31215. array4.push(node.value);
  31216. node = node.next;
  31217. }
  31218. return array4;
  31219. }
  31220. if (!_self2.document) {
  31221. if (!_self2.addEventListener) {
  31222. return _2;
  31223. }
  31224. if (!_2.disableWorkerMessageHandler) {
  31225. _self2.addEventListener("message", function(evt) {
  31226. var message = JSON.parse(evt.data);
  31227. var lang2 = message.language;
  31228. var code = message.code;
  31229. var immediateClose = message.immediateClose;
  31230. _self2.postMessage(_2.highlight(code, _2.languages[lang2], lang2));
  31231. if (immediateClose) {
  31232. _self2.close();
  31233. }
  31234. }, false);
  31235. }
  31236. return _2;
  31237. }
  31238. var script = _2.util.currentScript();
  31239. if (script) {
  31240. _2.filename = script.src;
  31241. if (script.hasAttribute("data-manual")) {
  31242. _2.manual = true;
  31243. }
  31244. }
  31245. function highlightAutomaticallyCallback() {
  31246. if (!_2.manual) {
  31247. _2.highlightAll();
  31248. }
  31249. }
  31250. if (!_2.manual) {
  31251. var readyState = document.readyState;
  31252. if (readyState === "loading" || readyState === "interactive" && script && script.defer) {
  31253. document.addEventListener("DOMContentLoaded", highlightAutomaticallyCallback);
  31254. } else {
  31255. if (window.requestAnimationFrame) {
  31256. window.requestAnimationFrame(highlightAutomaticallyCallback);
  31257. } else {
  31258. window.setTimeout(highlightAutomaticallyCallback, 16);
  31259. }
  31260. }
  31261. }
  31262. return _2;
  31263. }(_self);
  31264. if (module2.exports) {
  31265. module2.exports = Prism2;
  31266. }
  31267. if (typeof commonjsGlobal !== "undefined") {
  31268. commonjsGlobal.Prism = Prism2;
  31269. }
  31270. })(prismCore);
  31271. Prism.languages.clike = {
  31272. "comment": [
  31273. {
  31274. pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
  31275. lookbehind: true,
  31276. greedy: true
  31277. },
  31278. {
  31279. pattern: /(^|[^\\:])\/\/.*/,
  31280. lookbehind: true,
  31281. greedy: true
  31282. }
  31283. ],
  31284. "string": {
  31285. pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
  31286. greedy: true
  31287. },
  31288. "class-name": {
  31289. pattern: /(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,
  31290. lookbehind: true,
  31291. inside: {
  31292. "punctuation": /[.\\]/
  31293. }
  31294. },
  31295. "keyword": /\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,
  31296. "boolean": /\b(?:false|true)\b/,
  31297. "function": /\b\w+(?=\()/,
  31298. "number": /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
  31299. "operator": /[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,
  31300. "punctuation": /[{}[\];(),.:]/
  31301. };
  31302. Prism.languages.json = {
  31303. "property": {
  31304. pattern: /(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,
  31305. lookbehind: true,
  31306. greedy: true
  31307. },
  31308. "string": {
  31309. pattern: /(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,
  31310. lookbehind: true,
  31311. greedy: true
  31312. },
  31313. "comment": {
  31314. pattern: /\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,
  31315. greedy: true
  31316. },
  31317. "number": /-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,
  31318. "punctuation": /[{}[\],]/,
  31319. "operator": /:/,
  31320. "boolean": /\b(?:false|true)\b/,
  31321. "null": {
  31322. pattern: /\bnull\b/,
  31323. alias: "keyword"
  31324. }
  31325. };
  31326. Prism.languages.webmanifest = Prism.languages.json;
  31327. var prismTomorrow = "";
  31328. var CodeEditor_vue_vue_type_style_index_0_lang = "";
  31329. const _sfc_main$1 = /* @__PURE__ */ defineComponent({
  31330. props: {
  31331. modelValue: { default: "" },
  31332. language: { default: "json" },
  31333. readonly: { type: Boolean, default: false }
  31334. },
  31335. emits: ["update:modelValue"],
  31336. setup(__props, { emit }) {
  31337. const code = computed({
  31338. get() {
  31339. return __props.modelValue;
  31340. },
  31341. set(val) {
  31342. emit("update:modelValue", val);
  31343. }
  31344. });
  31345. return (_ctx, _cache) => {
  31346. return openBlock(), createBlock(unref(PrismEditor), {
  31347. modelValue: code.value,
  31348. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => code.value = $event),
  31349. "max-h-xl": "",
  31350. class: "form-design-editor",
  31351. highlight: (code2) => {
  31352. return unref(prismCore.exports.highlight)(code2, unref(prismCore.exports.languages)[__props.language]);
  31353. },
  31354. readonly: __props.readonly,
  31355. "line-numbers": ""
  31356. }, null, 8, ["modelValue", "highlight", "readonly"]);
  31357. };
  31358. }
  31359. });
  31360. var DesignForm_vue_vue_type_style_index_0_lang = "";
  31361. const _hoisted_1 = {
  31362. "h-full": "",
  31363. "bg-white": "",
  31364. flex: ""
  31365. };
  31366. const _hoisted_2 = {
  31367. "pt-2": "",
  31368. "w-62": ""
  31369. };
  31370. const _hoisted_3 = {
  31371. border: "0 x solid gray-200",
  31372. flex: "~ 1 col nowrap"
  31373. };
  31374. const _hoisted_4 = {
  31375. border: "0 b solid gray-200",
  31376. flex: "",
  31377. "gap-2": "",
  31378. "items-center": "",
  31379. "justify-end": "",
  31380. "h-11": "",
  31381. "py-0": "",
  31382. "px-2": ""
  31383. };
  31384. const _hoisted_5 = /* @__PURE__ */ createElementVNode("i", { class: "ep:edit" }, null, -1);
  31385. const _hoisted_6 = /* @__PURE__ */ createTextVNode("\u4FEE\u6539 ");
  31386. const _hoisted_7 = /* @__PURE__ */ createElementVNode("i", { class: "custom:clearable" }, null, -1);
  31387. const _hoisted_8 = /* @__PURE__ */ createTextVNode("\u6E05\u7A7A ");
  31388. const _hoisted_9 = /* @__PURE__ */ createElementVNode("i", { class: "custom:preview" }, null, -1);
  31389. const _hoisted_10 = /* @__PURE__ */ createTextVNode("\u9884\u89C8 ");
  31390. const _hoisted_11 = {
  31391. relative: "",
  31392. "w-75": "",
  31393. flex: "~ col"
  31394. };
  31395. const _hoisted_12 = {
  31396. border: "0 b-1 gray-200",
  31397. grid: "~ cols-2",
  31398. "min-h-11": "",
  31399. "px-2": ""
  31400. };
  31401. const _hoisted_13 = /* @__PURE__ */ createTextVNode(" \u590D\u5236 ");
  31402. const _hoisted_14 = /* @__PURE__ */ createTextVNode(" \u786E\u8BA4\u4FEE\u6539 ");
  31403. const __default__ = { name: "DesignForm" };
  31404. const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__), {
  31405. props: {
  31406. preview: {
  31407. type: Boolean,
  31408. default: true
  31409. },
  31410. generateJson: {
  31411. type: Boolean,
  31412. default: true
  31413. },
  31414. clearable: {
  31415. type: Boolean,
  31416. default: true
  31417. },
  31418. basicFieldsList: {
  31419. type: Array,
  31420. default: () => basicFields
  31421. },
  31422. advanceFieldsList: {
  31423. type: Array,
  31424. default: () => advanceFields
  31425. },
  31426. layoutFieldsList: {
  31427. type: Array,
  31428. default: () => layoutFields
  31429. },
  31430. request: {
  31431. type: Function
  31432. }
  31433. },
  31434. setup(__props, { expose }) {
  31435. let tab = ref(0);
  31436. let selectWidget = ref();
  31437. watch(() => selectWidget.value, (val) => {
  31438. tab.value = val ? 0 : 1;
  31439. });
  31440. let widgetForm = ref(getWidgetForm());
  31441. let generateJsonVisible = ref(false);
  31442. let generateJsonTemplate = ref(JSON.stringify(getWidgetForm(), null, 2));
  31443. const handleUploadJson = () => {
  31444. var _a2;
  31445. try {
  31446. widgetForm.value = JSON.parse(generateJsonTemplate.value);
  31447. selectWidget.value = (_a2 = widgetForm.value.list) == null ? void 0 : _a2[0];
  31448. generateJsonVisible.value = false;
  31449. ElMessage.success("\u4FEE\u6539\u6210\u529F");
  31450. } catch (error) {
  31451. ElMessage.error("\u4FEE\u6539\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5JSON\u683C\u5F0F\u662F\u5426\u6B63\u786E\u3002");
  31452. }
  31453. };
  31454. const handleGenerateJson = () => (generateJsonTemplate.value = JSON.stringify(widgetForm.value, null, 2)) && (generateJsonVisible.value = true);
  31455. const handleClearable = () => {
  31456. widgetForm.value = getWidgetForm();
  31457. selectWidget.value = void 0;
  31458. };
  31459. let dataVisible = ref(false);
  31460. const generateFormRef = ref(null);
  31461. const handleGetData = async () => {
  31462. var _a2;
  31463. dataVisible.value = !dataVisible.value;
  31464. if (!dataVisible.value)
  31465. return;
  31466. const res = await ((_a2 = generateFormRef.value) == null ? void 0 : _a2.getData());
  31467. generateJsonTemplate.value = JSON.stringify(res, null, 2);
  31468. };
  31469. const handleReset = () => {
  31470. var _a2;
  31471. return (_a2 = generateFormRef.value) == null ? void 0 : _a2.reset();
  31472. };
  31473. const handleCopyClick = (text) => {
  31474. navigator.clipboard.writeText(text);
  31475. ElMessage.success({ message: "Copy\u6210\u529F" });
  31476. };
  31477. const previewVisible = ref(false);
  31478. expose({
  31479. getJson: () => widgetForm.value,
  31480. setJson: (json) => {
  31481. var _a2;
  31482. widgetForm.value = json;
  31483. selectWidget.value = (_a2 = json.list) == null ? void 0 : _a2[0];
  31484. },
  31485. clear: handleClearable
  31486. });
  31487. return (_ctx, _cache) => {
  31488. const _component_el_button = ElButton;
  31489. const _component_el_dialog = ElDialog;
  31490. return openBlock(), createElementBlock("section", _hoisted_1, [
  31491. createElementVNode("aside", _hoisted_2, [
  31492. createVNode(_sfc_main$6, {
  31493. title: "\u57FA\u7840\u5B57\u6BB5",
  31494. fields: __props.basicFieldsList,
  31495. list: unref(basicComponents),
  31496. allList: widgetForm.value
  31497. }, null, 8, ["fields", "list", "allList"]),
  31498. createVNode(_sfc_main$6, {
  31499. title: "\u9AD8\u7EA7\u5B57\u6BB5",
  31500. fields: __props.advanceFieldsList,
  31501. list: unref(advanceComponents),
  31502. allList: widgetForm.value
  31503. }, null, 8, ["fields", "list", "allList"]),
  31504. createVNode(_sfc_main$6, {
  31505. title: "\u5E03\u5C40\u5B57\u6BB5",
  31506. fields: __props.layoutFieldsList,
  31507. list: unref(layoutComponents),
  31508. allList: widgetForm.value
  31509. }, null, 8, ["fields", "list", "allList"])
  31510. ]),
  31511. createElementVNode("main", _hoisted_3, [
  31512. createElementVNode("header", _hoisted_4, [
  31513. renderSlot(_ctx.$slots, "default"),
  31514. __props.generateJson ? (openBlock(), createBlock(_component_el_button, {
  31515. key: 0,
  31516. type: "text",
  31517. onClick: handleGenerateJson
  31518. }, {
  31519. icon: withCtx(() => [
  31520. _hoisted_5
  31521. ]),
  31522. default: withCtx(() => [
  31523. _hoisted_6
  31524. ]),
  31525. _: 1
  31526. })) : createCommentVNode("", true),
  31527. __props.clearable ? (openBlock(), createBlock(_component_el_button, {
  31528. key: 1,
  31529. type: "text",
  31530. onClick: handleClearable
  31531. }, {
  31532. icon: withCtx(() => [
  31533. _hoisted_7
  31534. ]),
  31535. default: withCtx(() => [
  31536. _hoisted_8
  31537. ]),
  31538. _: 1
  31539. })) : createCommentVNode("", true),
  31540. __props.preview ? (openBlock(), createBlock(_component_el_button, {
  31541. key: 2,
  31542. type: "text",
  31543. onClick: _cache[0] || (_cache[0] = ($event) => previewVisible.value = true)
  31544. }, {
  31545. icon: withCtx(() => [
  31546. _hoisted_9
  31547. ]),
  31548. default: withCtx(() => [
  31549. _hoisted_10
  31550. ]),
  31551. _: 1
  31552. })) : createCommentVNode("", true)
  31553. ]),
  31554. createVNode(_sfc_main$4, mergeProps({ ref: "widgetFormRef" }, widgetForm.value, {
  31555. selectWidget: selectWidget.value,
  31556. "onUpdate:selectWidget": _cache[1] || (_cache[1] = ($event) => selectWidget.value = $event)
  31557. }), null, 16, ["selectWidget"])
  31558. ]),
  31559. createElementVNode("aside", _hoisted_11, [
  31560. createElementVNode("header", _hoisted_12, [
  31561. createElementVNode("div", {
  31562. class: normalizeClass([{ active: !tab.value }, "config-tab"]),
  31563. onClick: _cache[2] || (_cache[2] = ($event) => tab.value = 0)
  31564. }, " \u5B57\u6BB5\u5C5E\u6027 ", 2),
  31565. createElementVNode("div", {
  31566. class: normalizeClass([{ active: tab.value }, "config-tab"]),
  31567. onClick: _cache[3] || (_cache[3] = ($event) => tab.value = 1)
  31568. }, " \u8868\u5355\u5C5E\u6027 ", 2)
  31569. ]),
  31570. withDirectives(createVNode(WidgetConfig, {
  31571. select: selectWidget.value,
  31572. "onUpdate:select": _cache[4] || (_cache[4] = ($event) => selectWidget.value = $event)
  31573. }, null, 8, ["select"]), [
  31574. [vShow, !tab.value]
  31575. ]),
  31576. withDirectives(createVNode(_sfc_main$2, {
  31577. config: widgetForm.value.config,
  31578. "onUpdate:config": _cache[5] || (_cache[5] = ($event) => widgetForm.value.config = $event)
  31579. }, null, 8, ["config"]), [
  31580. [vShow, tab.value]
  31581. ])
  31582. ]),
  31583. createVNode(_component_el_dialog, {
  31584. modelValue: previewVisible.value,
  31585. "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => previewVisible.value = $event),
  31586. "destroy-on-close": "",
  31587. title: "\u9884\u89C8",
  31588. "z-index": 2e3,
  31589. width: 800,
  31590. onClose: _cache[9] || (_cache[9] = ($event) => dataVisible.value = false)
  31591. }, {
  31592. footer: withCtx(() => [
  31593. createVNode(_component_el_button, {
  31594. onClick: _cache[7] || (_cache[7] = ($event) => dataVisible.value ? handleCopyClick(generateJsonTemplate.value) : handleReset())
  31595. }, {
  31596. default: withCtx(() => [
  31597. createTextVNode(toDisplayString(dataVisible.value ? "\u590D\u5236" : "\u91CD\u7F6E"), 1)
  31598. ]),
  31599. _: 1
  31600. }),
  31601. createVNode(_component_el_button, {
  31602. type: "primary",
  31603. onClick: handleGetData
  31604. }, {
  31605. default: withCtx(() => [
  31606. createTextVNode(toDisplayString(dataVisible.value ? "\u8FD4\u56DE\u9884\u89C8" : "\u83B7\u53D6\u6570\u636E"), 1)
  31607. ]),
  31608. _: 1
  31609. })
  31610. ]),
  31611. default: withCtx(() => [
  31612. withDirectives(createVNode(_sfc_main$1, {
  31613. modelValue: generateJsonTemplate.value,
  31614. "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => generateJsonTemplate.value = $event)
  31615. }, null, 8, ["modelValue"]), [
  31616. [vShow, dataVisible.value]
  31617. ]),
  31618. withDirectives(createVNode(GenerateForm, {
  31619. ref_key: "generateFormRef",
  31620. ref: generateFormRef,
  31621. request: __props.request,
  31622. data: widgetForm.value
  31623. }, null, 8, ["request", "data"]), [
  31624. [vShow, !dataVisible.value]
  31625. ])
  31626. ]),
  31627. _: 1
  31628. }, 8, ["modelValue"]),
  31629. createVNode(_component_el_dialog, {
  31630. modelValue: generateJsonVisible.value,
  31631. "onUpdate:modelValue": _cache[12] || (_cache[12] = ($event) => generateJsonVisible.value = $event),
  31632. "append-to-body": "",
  31633. title: "\u4FEE\u6539JSON",
  31634. "z-index": 2e4,
  31635. width: 800
  31636. }, {
  31637. footer: withCtx(() => [
  31638. createVNode(_component_el_button, {
  31639. onClick: _cache[11] || (_cache[11] = ($event) => handleCopyClick(generateJsonTemplate.value))
  31640. }, {
  31641. default: withCtx(() => [
  31642. _hoisted_13
  31643. ]),
  31644. _: 1
  31645. }),
  31646. createVNode(_component_el_button, {
  31647. type: "primary",
  31648. onClick: handleUploadJson
  31649. }, {
  31650. default: withCtx(() => [
  31651. _hoisted_14
  31652. ]),
  31653. _: 1
  31654. })
  31655. ]),
  31656. default: withCtx(() => [
  31657. createVNode(_sfc_main$1, {
  31658. modelValue: generateJsonTemplate.value,
  31659. "onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => generateJsonTemplate.value = $event)
  31660. }, null, 8, ["modelValue"])
  31661. ]),
  31662. _: 1
  31663. }, 8, ["modelValue"])
  31664. ]);
  31665. };
  31666. }
  31667. }));
  31668. export { _sfc_main as DesignForm, GenerateForm, advanceFields, basicFields, layoutFields };
  31669. //# sourceMappingURL=index.es.js.map