index.es.js 1.1 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108
  1. import './index.css';
  2. var __defProp = Object.defineProperty;
  3. var __defProps = Object.defineProperties;
  4. var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
  5. var __getOwnPropSymbols = Object.getOwnPropertySymbols;
  6. var __hasOwnProp = Object.prototype.hasOwnProperty;
  7. var __propIsEnum = Object.prototype.propertyIsEnumerable;
  8. var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
  9. var __spreadValues = (a2, b2) => {
  10. for (var prop in b2 || (b2 = {}))
  11. if (__hasOwnProp.call(b2, prop))
  12. __defNormalProp(a2, prop, b2[prop]);
  13. if (__getOwnPropSymbols)
  14. for (var prop of __getOwnPropSymbols(b2)) {
  15. if (__propIsEnum.call(b2, prop))
  16. __defNormalProp(a2, prop, b2[prop]);
  17. }
  18. return a2;
  19. };
  20. var __spreadProps = (a2, b2) => __defProps(a2, __getOwnPropDescs(b2));
  21. var __objRest = (source, exclude) => {
  22. var target = {};
  23. for (var prop in source)
  24. if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
  25. target[prop] = source[prop];
  26. if (source != null && __getOwnPropSymbols)
  27. for (var prop of __getOwnPropSymbols(source)) {
  28. if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
  29. target[prop] = source[prop];
  30. }
  31. return target;
  32. };
  33. import { ref, watch, getCurrentScope, onScopeDispose, unref, getCurrentInstance, computed, defineComponent, openBlock, createElementBlock, createElementVNode, warn, isVNode, Fragment, Comment, inject, provide, onMounted, watchEffect, onBeforeUnmount, isRef, onBeforeMount, mergeProps, renderSlot, useAttrs as useAttrs$1, useSlots, shallowRef, nextTick, onUpdated, toRef, withDirectives, normalizeClass, normalizeStyle, createCommentVNode, createBlock, withCtx, resolveDynamicComponent, withModifiers, createVNode, toDisplayString, vShow, Transition, resolveComponent, reactive, cloneVNode, Text, Teleport, createTextVNode, readonly, resolveDirective, renderList, h as h$1, vModelCheckbox, toRefs, withKeys, vModelRadio, onBeforeUpdate, vModelText, createSlots, markRaw, effectScope, toRaw, triggerRef, normalizeProps, guardReactiveProps, onUnmounted, TransitionGroup, pushScopeId, popScopeId, createPropsRestProxy } from "vue";
  34. import { ElMessage } from "element-plus";
  35. import Draggable from "vuedraggable";
  36. var elMessage = "";
  37. const rules$1 = {
  38. trigger: "blur",
  39. enum: "",
  40. len: void 0,
  41. max: void 0,
  42. message: "",
  43. min: void 0,
  44. pattern: "",
  45. required: false,
  46. type: "any"
  47. };
  48. const getWidgetForm = () => ({
  49. list: [],
  50. config: {
  51. size: "default",
  52. hideRequiredAsterisk: false,
  53. labelWidth: 100,
  54. labelPosition: "right"
  55. }
  56. });
  57. const basicComponents = [
  58. {
  59. label: "\u5355\u884C\u6587\u672C",
  60. type: "input",
  61. options: {
  62. width: "100%",
  63. defaultValue: "",
  64. placeholder: "",
  65. maxlength: null,
  66. prefix: "",
  67. suffix: "",
  68. prepend: "",
  69. append: "",
  70. disabled: false,
  71. clearable: false,
  72. readonly: false,
  73. rules: rules$1
  74. }
  75. },
  76. {
  77. label: "\u5BC6\u7801\u6846",
  78. type: "password",
  79. options: {
  80. width: "100%",
  81. defaultValue: "",
  82. placeholder: "",
  83. maxlength: null,
  84. prefix: "",
  85. suffix: "",
  86. prepend: "",
  87. append: "",
  88. showPassword: true,
  89. disabled: false,
  90. clearable: false,
  91. readonly: false,
  92. rules: rules$1
  93. }
  94. },
  95. {
  96. label: "\u591A\u884C\u6587\u672C",
  97. type: "textarea",
  98. options: {
  99. width: "100%",
  100. defaultValue: "",
  101. placeholder: "",
  102. maxlength: null,
  103. rows: 4,
  104. autosize: false,
  105. showWordLimit: false,
  106. disabled: false,
  107. clearable: false,
  108. readonly: false,
  109. rules: rules$1
  110. }
  111. },
  112. {
  113. label: "\u8BA1\u6570\u5668",
  114. type: "number",
  115. options: {
  116. width: "",
  117. defaultValue: 0,
  118. min: 0,
  119. max: 100,
  120. step: 1,
  121. disabled: false,
  122. rules: rules$1
  123. }
  124. },
  125. {
  126. label: "\u5355\u9009\u6846\u7EC4",
  127. type: "radio",
  128. options: {
  129. defaultValue: "",
  130. width: "",
  131. inline: true,
  132. remote: false,
  133. showLabel: true,
  134. remoteFunc: "https://raw.githubusercontent.com/fuchengwei/vue-form-create/master/mock/mock.json",
  135. options: [
  136. {
  137. value: "Option 1",
  138. label: "Option 1"
  139. },
  140. {
  141. value: "Option 2",
  142. label: "Option 2"
  143. },
  144. {
  145. value: "Option 3",
  146. label: "Option 3"
  147. }
  148. ],
  149. remoteOptions: [],
  150. props: {
  151. value: "value",
  152. label: "label"
  153. },
  154. disabled: false,
  155. rules: rules$1
  156. }
  157. },
  158. {
  159. label: "\u591A\u9009\u6846\u7EC4",
  160. type: "checkbox",
  161. options: {
  162. defaultValue: [],
  163. width: "",
  164. inline: true,
  165. remote: false,
  166. showLabel: true,
  167. remoteFunc: "https://raw.githubusercontent.com/fuchengwei/vue-form-create/master/mock/mock.json",
  168. options: [
  169. {
  170. label: "Option 1",
  171. value: "Option 1"
  172. },
  173. {
  174. label: "Option 2",
  175. value: "Option 2"
  176. },
  177. {
  178. label: "Option 3",
  179. value: "Option 3"
  180. }
  181. ],
  182. remoteOptions: [],
  183. props: {
  184. value: "value",
  185. label: "label"
  186. },
  187. disabled: false,
  188. rules: rules$1
  189. }
  190. },
  191. {
  192. label: "\u65F6\u95F4\u9009\u62E9\u5668",
  193. type: "time",
  194. options: {
  195. defaultValue: "",
  196. width: "",
  197. placeholder: "\u8BF7\u9009\u62E9\u65F6\u95F4",
  198. format: "HH:mm:ss",
  199. valueFormat: "HH:mm:ss",
  200. readonly: false,
  201. editable: true,
  202. clearable: true,
  203. disabled: false,
  204. rules: rules$1
  205. }
  206. },
  207. {
  208. label: "\u65E5\u671F\u9009\u62E9\u5668",
  209. type: "date",
  210. options: {
  211. defaultValue: "",
  212. width: "",
  213. placeholder: "\u8BF7\u9009\u62E9\u65F6\u95F4",
  214. format: "YYYY-MM-DD",
  215. readonly: false,
  216. editable: true,
  217. clearable: true,
  218. disabled: false,
  219. rules: rules$1
  220. }
  221. },
  222. {
  223. label: "\u8BC4\u5206",
  224. type: "rate",
  225. options: {
  226. defaultValue: 0,
  227. max: 5,
  228. allowHalf: false,
  229. disabled: false,
  230. rules: rules$1
  231. }
  232. },
  233. {
  234. label: "\u4E0B\u62C9\u9009\u62E9\u6846",
  235. type: "select",
  236. options: {
  237. defaultValue: "",
  238. width: "200px",
  239. multiple: false,
  240. placeholder: "",
  241. remote: false,
  242. showLabel: true,
  243. filterable: false,
  244. clearable: false,
  245. disabled: false,
  246. props: {
  247. label: "label",
  248. value: "value"
  249. },
  250. options: [
  251. {
  252. label: "Option 1",
  253. value: "Option 1"
  254. },
  255. {
  256. label: "Option 2",
  257. value: "Option 2"
  258. },
  259. {
  260. label: "Option 3",
  261. value: "Option 3"
  262. }
  263. ],
  264. remoteOptions: [],
  265. remoteFunc: "https://raw.githubusercontent.com/fuchengwei/vue-form-create/master/mock/mock.json",
  266. rules: rules$1
  267. }
  268. },
  269. {
  270. label: "\u5F00\u5173",
  271. type: "switch",
  272. options: {
  273. defaultValue: false,
  274. disabled: false,
  275. activeText: "",
  276. inactiveText: "",
  277. rules: rules$1
  278. }
  279. },
  280. {
  281. label: "\u6ED1\u5757",
  282. type: "slider",
  283. options: {
  284. defaultValue: 0,
  285. width: "",
  286. min: 0,
  287. max: 100,
  288. step: 1,
  289. disabled: false,
  290. range: false,
  291. rules: rules$1
  292. }
  293. },
  294. {
  295. label: "\u6587\u5B57",
  296. type: "text",
  297. options: {
  298. defaultValue: "This is a text"
  299. }
  300. }
  301. ];
  302. const basicFields = basicComponents.map((i) => i.type);
  303. const advanceComponents = [
  304. {
  305. label: "\u56FE\u7247",
  306. type: "img-upload",
  307. options: {
  308. defaultValue: [],
  309. name: "file",
  310. action: "http://example.com/upload",
  311. method: "post",
  312. listType: "text",
  313. accept: "image/*",
  314. limit: 1,
  315. multiple: false,
  316. disabled: true,
  317. rules: rules$1
  318. }
  319. },
  320. {
  321. label: "\u4E0B\u8F7D",
  322. type: "download",
  323. labelWidth: "auto",
  324. options: {
  325. defaultValue: "",
  326. name: "file"
  327. }
  328. },
  329. {
  330. label: "\u7EA7\u8054\u9009\u62E9\u5668",
  331. type: "cascader",
  332. options: {
  333. defaultValue: [],
  334. width: "200px",
  335. placeholder: "",
  336. disabled: false,
  337. clearable: false,
  338. filterable: false,
  339. remote: true,
  340. remoteOptions: [],
  341. props: {
  342. label: "label",
  343. value: "value",
  344. children: "children"
  345. },
  346. remoteFunc: "https://raw.githubusercontent.com/fuchengwei/vue-form-create/master/mock/mock.json",
  347. rules: rules$1
  348. }
  349. }
  350. ];
  351. const advanceFields = advanceComponents.map((i) => i.type);
  352. const layoutComponents = [
  353. {
  354. label: "\u6805\u683C\u5E03\u5C40",
  355. type: "grid",
  356. columns: [
  357. {
  358. span: 12,
  359. list: []
  360. },
  361. {
  362. span: 12,
  363. list: []
  364. }
  365. ],
  366. options: {
  367. gutter: 0,
  368. align: "initial"
  369. }
  370. },
  371. {
  372. label: "\u6570\u636E\u8868\u683C",
  373. type: "table",
  374. columns: [
  375. { label: "\u540D\u79F0", prop: "name" },
  376. { label: "\u521B\u5EFA\u65F6\u95F4", prop: "createTime" }
  377. ],
  378. options: {
  379. defaultValue: [],
  380. disabled: false,
  381. size: "",
  382. align: "center"
  383. }
  384. },
  385. {
  386. label: "\u5206\u5272\u7EBF",
  387. type: "divider",
  388. options: {}
  389. }
  390. ];
  391. const layoutFields = layoutComponents.map((i) => i.type);
  392. var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
  393. var freeGlobal$1 = freeGlobal;
  394. var freeSelf = typeof self == "object" && self && self.Object === Object && self;
  395. var root = freeGlobal$1 || freeSelf || Function("return this")();
  396. var root$1 = root;
  397. var Symbol$1 = root$1.Symbol;
  398. var Symbol$2 = Symbol$1;
  399. var objectProto$e = Object.prototype;
  400. var hasOwnProperty$c = objectProto$e.hasOwnProperty;
  401. var nativeObjectToString$1 = objectProto$e.toString;
  402. var symToStringTag$1 = Symbol$2 ? Symbol$2.toStringTag : void 0;
  403. function getRawTag(value) {
  404. var isOwn = hasOwnProperty$c.call(value, symToStringTag$1), tag = value[symToStringTag$1];
  405. try {
  406. value[symToStringTag$1] = void 0;
  407. var unmasked = true;
  408. } catch (e) {
  409. }
  410. var result = nativeObjectToString$1.call(value);
  411. if (unmasked) {
  412. if (isOwn) {
  413. value[symToStringTag$1] = tag;
  414. } else {
  415. delete value[symToStringTag$1];
  416. }
  417. }
  418. return result;
  419. }
  420. var objectProto$d = Object.prototype;
  421. var nativeObjectToString = objectProto$d.toString;
  422. function objectToString$1(value) {
  423. return nativeObjectToString.call(value);
  424. }
  425. var nullTag = "[object Null]", undefinedTag = "[object Undefined]";
  426. var symToStringTag = Symbol$2 ? Symbol$2.toStringTag : void 0;
  427. function baseGetTag(value) {
  428. if (value == null) {
  429. return value === void 0 ? undefinedTag : nullTag;
  430. }
  431. return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString$1(value);
  432. }
  433. function isObjectLike(value) {
  434. return value != null && typeof value == "object";
  435. }
  436. var symbolTag$3 = "[object Symbol]";
  437. function isSymbol(value) {
  438. return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag$3;
  439. }
  440. function arrayMap(array4, iteratee) {
  441. var index = -1, length = array4 == null ? 0 : array4.length, result = Array(length);
  442. while (++index < length) {
  443. result[index] = iteratee(array4[index], index, array4);
  444. }
  445. return result;
  446. }
  447. var isArray$1 = Array.isArray;
  448. var isArray$2 = isArray$1;
  449. var INFINITY$3 = 1 / 0;
  450. var symbolProto$2 = Symbol$2 ? Symbol$2.prototype : void 0, symbolToString = symbolProto$2 ? symbolProto$2.toString : void 0;
  451. function baseToString(value) {
  452. if (typeof value == "string") {
  453. return value;
  454. }
  455. if (isArray$2(value)) {
  456. return arrayMap(value, baseToString) + "";
  457. }
  458. if (isSymbol(value)) {
  459. return symbolToString ? symbolToString.call(value) : "";
  460. }
  461. var result = value + "";
  462. return result == "0" && 1 / value == -INFINITY$3 ? "-0" : result;
  463. }
  464. var reWhitespace = /\s/;
  465. function trimmedEndIndex(string3) {
  466. var index = string3.length;
  467. while (index-- && reWhitespace.test(string3.charAt(index))) {
  468. }
  469. return index;
  470. }
  471. var reTrimStart = /^\s+/;
  472. function baseTrim(string3) {
  473. return string3 ? string3.slice(0, trimmedEndIndex(string3) + 1).replace(reTrimStart, "") : string3;
  474. }
  475. function isObject$2(value) {
  476. var type4 = typeof value;
  477. return value != null && (type4 == "object" || type4 == "function");
  478. }
  479. var NAN = 0 / 0;
  480. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  481. var reIsBinary = /^0b[01]+$/i;
  482. var reIsOctal = /^0o[0-7]+$/i;
  483. var freeParseInt = parseInt;
  484. function toNumber(value) {
  485. if (typeof value == "number") {
  486. return value;
  487. }
  488. if (isSymbol(value)) {
  489. return NAN;
  490. }
  491. if (isObject$2(value)) {
  492. var other = typeof value.valueOf == "function" ? value.valueOf() : value;
  493. value = isObject$2(other) ? other + "" : other;
  494. }
  495. if (typeof value != "string") {
  496. return value === 0 ? value : +value;
  497. }
  498. value = baseTrim(value);
  499. var isBinary = reIsBinary.test(value);
  500. return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
  501. }
  502. function identity(value) {
  503. return value;
  504. }
  505. var asyncTag = "[object AsyncFunction]", funcTag$2 = "[object Function]", genTag$1 = "[object GeneratorFunction]", proxyTag = "[object Proxy]";
  506. function isFunction$1(value) {
  507. if (!isObject$2(value)) {
  508. return false;
  509. }
  510. var tag = baseGetTag(value);
  511. return tag == funcTag$2 || tag == genTag$1 || tag == asyncTag || tag == proxyTag;
  512. }
  513. var coreJsData = root$1["__core-js_shared__"];
  514. var coreJsData$1 = coreJsData;
  515. var maskSrcKey = function() {
  516. var uid2 = /[^.]+$/.exec(coreJsData$1 && coreJsData$1.keys && coreJsData$1.keys.IE_PROTO || "");
  517. return uid2 ? "Symbol(src)_1." + uid2 : "";
  518. }();
  519. function isMasked(func) {
  520. return !!maskSrcKey && maskSrcKey in func;
  521. }
  522. var funcProto$1 = Function.prototype;
  523. var funcToString$1 = funcProto$1.toString;
  524. function toSource(func) {
  525. if (func != null) {
  526. try {
  527. return funcToString$1.call(func);
  528. } catch (e) {
  529. }
  530. try {
  531. return func + "";
  532. } catch (e) {
  533. }
  534. }
  535. return "";
  536. }
  537. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
  538. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  539. var funcProto = Function.prototype, objectProto$c = Object.prototype;
  540. var funcToString = funcProto.toString;
  541. var hasOwnProperty$b = objectProto$c.hasOwnProperty;
  542. var reIsNative = RegExp("^" + funcToString.call(hasOwnProperty$b).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$");
  543. function baseIsNative(value) {
  544. if (!isObject$2(value) || isMasked(value)) {
  545. return false;
  546. }
  547. var pattern4 = isFunction$1(value) ? reIsNative : reIsHostCtor;
  548. return pattern4.test(toSource(value));
  549. }
  550. function getValue$1(object4, key) {
  551. return object4 == null ? void 0 : object4[key];
  552. }
  553. function getNative(object4, key) {
  554. var value = getValue$1(object4, key);
  555. return baseIsNative(value) ? value : void 0;
  556. }
  557. var WeakMap = getNative(root$1, "WeakMap");
  558. var WeakMap$1 = WeakMap;
  559. var objectCreate = Object.create;
  560. var baseCreate = function() {
  561. function object4() {
  562. }
  563. return function(proto) {
  564. if (!isObject$2(proto)) {
  565. return {};
  566. }
  567. if (objectCreate) {
  568. return objectCreate(proto);
  569. }
  570. object4.prototype = proto;
  571. var result = new object4();
  572. object4.prototype = void 0;
  573. return result;
  574. };
  575. }();
  576. var baseCreate$1 = baseCreate;
  577. function apply(func, thisArg, args) {
  578. switch (args.length) {
  579. case 0:
  580. return func.call(thisArg);
  581. case 1:
  582. return func.call(thisArg, args[0]);
  583. case 2:
  584. return func.call(thisArg, args[0], args[1]);
  585. case 3:
  586. return func.call(thisArg, args[0], args[1], args[2]);
  587. }
  588. return func.apply(thisArg, args);
  589. }
  590. function noop$1() {
  591. }
  592. function copyArray(source, array4) {
  593. var index = -1, length = source.length;
  594. array4 || (array4 = Array(length));
  595. while (++index < length) {
  596. array4[index] = source[index];
  597. }
  598. return array4;
  599. }
  600. var HOT_COUNT = 800, HOT_SPAN = 16;
  601. var nativeNow = Date.now;
  602. function shortOut(func) {
  603. var count = 0, lastCalled = 0;
  604. return function() {
  605. var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled);
  606. lastCalled = stamp;
  607. if (remaining > 0) {
  608. if (++count >= HOT_COUNT) {
  609. return arguments[0];
  610. }
  611. } else {
  612. count = 0;
  613. }
  614. return func.apply(void 0, arguments);
  615. };
  616. }
  617. function constant(value) {
  618. return function() {
  619. return value;
  620. };
  621. }
  622. var defineProperty = function() {
  623. try {
  624. var func = getNative(Object, "defineProperty");
  625. func({}, "", {});
  626. return func;
  627. } catch (e) {
  628. }
  629. }();
  630. var defineProperty$1 = defineProperty;
  631. var baseSetToString = !defineProperty$1 ? identity : function(func, string3) {
  632. return defineProperty$1(func, "toString", {
  633. "configurable": true,
  634. "enumerable": false,
  635. "value": constant(string3),
  636. "writable": true
  637. });
  638. };
  639. var baseSetToString$1 = baseSetToString;
  640. var setToString = shortOut(baseSetToString$1);
  641. var setToString$1 = setToString;
  642. function arrayEach(array4, iteratee) {
  643. var index = -1, length = array4 == null ? 0 : array4.length;
  644. while (++index < length) {
  645. if (iteratee(array4[index], index, array4) === false) {
  646. break;
  647. }
  648. }
  649. return array4;
  650. }
  651. function baseFindIndex(array4, predicate, fromIndex, fromRight) {
  652. var length = array4.length, index = fromIndex + (fromRight ? 1 : -1);
  653. while (fromRight ? index-- : ++index < length) {
  654. if (predicate(array4[index], index, array4)) {
  655. return index;
  656. }
  657. }
  658. return -1;
  659. }
  660. function baseIsNaN(value) {
  661. return value !== value;
  662. }
  663. function strictIndexOf(array4, value, fromIndex) {
  664. var index = fromIndex - 1, length = array4.length;
  665. while (++index < length) {
  666. if (array4[index] === value) {
  667. return index;
  668. }
  669. }
  670. return -1;
  671. }
  672. function baseIndexOf(array4, value, fromIndex) {
  673. return value === value ? strictIndexOf(array4, value, fromIndex) : baseFindIndex(array4, baseIsNaN, fromIndex);
  674. }
  675. function arrayIncludes(array4, value) {
  676. var length = array4 == null ? 0 : array4.length;
  677. return !!length && baseIndexOf(array4, value, 0) > -1;
  678. }
  679. var MAX_SAFE_INTEGER$1 = 9007199254740991;
  680. var reIsUint = /^(?:0|[1-9]\d*)$/;
  681. function isIndex(value, length) {
  682. var type4 = typeof value;
  683. length = length == null ? MAX_SAFE_INTEGER$1 : length;
  684. return !!length && (type4 == "number" || type4 != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
  685. }
  686. function baseAssignValue(object4, key, value) {
  687. if (key == "__proto__" && defineProperty$1) {
  688. defineProperty$1(object4, key, {
  689. "configurable": true,
  690. "enumerable": true,
  691. "value": value,
  692. "writable": true
  693. });
  694. } else {
  695. object4[key] = value;
  696. }
  697. }
  698. function eq(value, other) {
  699. return value === other || value !== value && other !== other;
  700. }
  701. var objectProto$b = Object.prototype;
  702. var hasOwnProperty$a = objectProto$b.hasOwnProperty;
  703. function assignValue(object4, key, value) {
  704. var objValue = object4[key];
  705. if (!(hasOwnProperty$a.call(object4, key) && eq(objValue, value)) || value === void 0 && !(key in object4)) {
  706. baseAssignValue(object4, key, value);
  707. }
  708. }
  709. function copyObject(source, props, object4, customizer) {
  710. var isNew = !object4;
  711. object4 || (object4 = {});
  712. var index = -1, length = props.length;
  713. while (++index < length) {
  714. var key = props[index];
  715. var newValue = customizer ? customizer(object4[key], source[key], key, object4, source) : void 0;
  716. if (newValue === void 0) {
  717. newValue = source[key];
  718. }
  719. if (isNew) {
  720. baseAssignValue(object4, key, newValue);
  721. } else {
  722. assignValue(object4, key, newValue);
  723. }
  724. }
  725. return object4;
  726. }
  727. var nativeMax$1 = Math.max;
  728. function overRest(func, start2, transform) {
  729. start2 = nativeMax$1(start2 === void 0 ? func.length - 1 : start2, 0);
  730. return function() {
  731. var args = arguments, index = -1, length = nativeMax$1(args.length - start2, 0), array4 = Array(length);
  732. while (++index < length) {
  733. array4[index] = args[start2 + index];
  734. }
  735. index = -1;
  736. var otherArgs = Array(start2 + 1);
  737. while (++index < start2) {
  738. otherArgs[index] = args[index];
  739. }
  740. otherArgs[start2] = transform(array4);
  741. return apply(func, this, otherArgs);
  742. };
  743. }
  744. function baseRest(func, start2) {
  745. return setToString$1(overRest(func, start2, identity), func + "");
  746. }
  747. var MAX_SAFE_INTEGER = 9007199254740991;
  748. function isLength(value) {
  749. return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  750. }
  751. function isArrayLike(value) {
  752. return value != null && isLength(value.length) && !isFunction$1(value);
  753. }
  754. var objectProto$a = Object.prototype;
  755. function isPrototype(value) {
  756. var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto$a;
  757. return value === proto;
  758. }
  759. function baseTimes(n, iteratee) {
  760. var index = -1, result = Array(n);
  761. while (++index < n) {
  762. result[index] = iteratee(index);
  763. }
  764. return result;
  765. }
  766. var argsTag$3 = "[object Arguments]";
  767. function baseIsArguments(value) {
  768. return isObjectLike(value) && baseGetTag(value) == argsTag$3;
  769. }
  770. var objectProto$9 = Object.prototype;
  771. var hasOwnProperty$9 = objectProto$9.hasOwnProperty;
  772. var propertyIsEnumerable$1 = objectProto$9.propertyIsEnumerable;
  773. var isArguments = baseIsArguments(function() {
  774. return arguments;
  775. }()) ? baseIsArguments : function(value) {
  776. return isObjectLike(value) && hasOwnProperty$9.call(value, "callee") && !propertyIsEnumerable$1.call(value, "callee");
  777. };
  778. var isArguments$1 = isArguments;
  779. function stubFalse() {
  780. return false;
  781. }
  782. var freeExports$2 = typeof exports == "object" && exports && !exports.nodeType && exports;
  783. var freeModule$2 = freeExports$2 && typeof module == "object" && module && !module.nodeType && module;
  784. var moduleExports$2 = freeModule$2 && freeModule$2.exports === freeExports$2;
  785. var Buffer$1 = moduleExports$2 ? root$1.Buffer : void 0;
  786. var nativeIsBuffer = Buffer$1 ? Buffer$1.isBuffer : void 0;
  787. var isBuffer = nativeIsBuffer || stubFalse;
  788. var isBuffer$1 = isBuffer;
  789. var argsTag$2 = "[object Arguments]", arrayTag$2 = "[object Array]", boolTag$3 = "[object Boolean]", dateTag$3 = "[object Date]", errorTag$2 = "[object Error]", funcTag$1 = "[object Function]", mapTag$5 = "[object Map]", numberTag$3 = "[object Number]", objectTag$3 = "[object Object]", regexpTag$3 = "[object RegExp]", setTag$5 = "[object Set]", stringTag$3 = "[object String]", weakMapTag$2 = "[object WeakMap]";
  790. var arrayBufferTag$3 = "[object ArrayBuffer]", dataViewTag$4 = "[object DataView]", float32Tag$2 = "[object Float32Array]", float64Tag$2 = "[object Float64Array]", int8Tag$2 = "[object Int8Array]", int16Tag$2 = "[object Int16Array]", int32Tag$2 = "[object Int32Array]", uint8Tag$2 = "[object Uint8Array]", uint8ClampedTag$2 = "[object Uint8ClampedArray]", uint16Tag$2 = "[object Uint16Array]", uint32Tag$2 = "[object Uint32Array]";
  791. var typedArrayTags = {};
  792. typedArrayTags[float32Tag$2] = typedArrayTags[float64Tag$2] = typedArrayTags[int8Tag$2] = typedArrayTags[int16Tag$2] = typedArrayTags[int32Tag$2] = typedArrayTags[uint8Tag$2] = typedArrayTags[uint8ClampedTag$2] = typedArrayTags[uint16Tag$2] = typedArrayTags[uint32Tag$2] = true;
  793. typedArrayTags[argsTag$2] = typedArrayTags[arrayTag$2] = typedArrayTags[arrayBufferTag$3] = typedArrayTags[boolTag$3] = typedArrayTags[dataViewTag$4] = typedArrayTags[dateTag$3] = typedArrayTags[errorTag$2] = typedArrayTags[funcTag$1] = typedArrayTags[mapTag$5] = typedArrayTags[numberTag$3] = typedArrayTags[objectTag$3] = typedArrayTags[regexpTag$3] = typedArrayTags[setTag$5] = typedArrayTags[stringTag$3] = typedArrayTags[weakMapTag$2] = false;
  794. function baseIsTypedArray(value) {
  795. return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  796. }
  797. function baseUnary(func) {
  798. return function(value) {
  799. return func(value);
  800. };
  801. }
  802. var freeExports$1 = typeof exports == "object" && exports && !exports.nodeType && exports;
  803. var freeModule$1 = freeExports$1 && typeof module == "object" && module && !module.nodeType && module;
  804. var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1;
  805. var freeProcess = moduleExports$1 && freeGlobal$1.process;
  806. var nodeUtil = function() {
  807. try {
  808. var types2 = freeModule$1 && freeModule$1.require && freeModule$1.require("util").types;
  809. if (types2) {
  810. return types2;
  811. }
  812. return freeProcess && freeProcess.binding && freeProcess.binding("util");
  813. } catch (e) {
  814. }
  815. }();
  816. var nodeUtil$1 = nodeUtil;
  817. var nodeIsTypedArray = nodeUtil$1 && nodeUtil$1.isTypedArray;
  818. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  819. var isTypedArray$1 = isTypedArray;
  820. var objectProto$8 = Object.prototype;
  821. var hasOwnProperty$8 = objectProto$8.hasOwnProperty;
  822. function arrayLikeKeys(value, inherited) {
  823. var isArr = isArray$2(value), isArg = !isArr && isArguments$1(value), isBuff = !isArr && !isArg && isBuffer$1(value), isType = !isArr && !isArg && !isBuff && isTypedArray$1(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes(value.length, String) : [], length = result.length;
  824. for (var key in value) {
  825. if ((inherited || hasOwnProperty$8.call(value, key)) && !(skipIndexes && (key == "length" || isBuff && (key == "offset" || key == "parent") || isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || isIndex(key, length)))) {
  826. result.push(key);
  827. }
  828. }
  829. return result;
  830. }
  831. function overArg(func, transform) {
  832. return function(arg) {
  833. return func(transform(arg));
  834. };
  835. }
  836. var nativeKeys = overArg(Object.keys, Object);
  837. var nativeKeys$1 = nativeKeys;
  838. var objectProto$7 = Object.prototype;
  839. var hasOwnProperty$7 = objectProto$7.hasOwnProperty;
  840. function baseKeys(object4) {
  841. if (!isPrototype(object4)) {
  842. return nativeKeys$1(object4);
  843. }
  844. var result = [];
  845. for (var key in Object(object4)) {
  846. if (hasOwnProperty$7.call(object4, key) && key != "constructor") {
  847. result.push(key);
  848. }
  849. }
  850. return result;
  851. }
  852. function keys(object4) {
  853. return isArrayLike(object4) ? arrayLikeKeys(object4) : baseKeys(object4);
  854. }
  855. function nativeKeysIn(object4) {
  856. var result = [];
  857. if (object4 != null) {
  858. for (var key in Object(object4)) {
  859. result.push(key);
  860. }
  861. }
  862. return result;
  863. }
  864. var objectProto$6 = Object.prototype;
  865. var hasOwnProperty$6 = objectProto$6.hasOwnProperty;
  866. function baseKeysIn(object4) {
  867. if (!isObject$2(object4)) {
  868. return nativeKeysIn(object4);
  869. }
  870. var isProto = isPrototype(object4), result = [];
  871. for (var key in object4) {
  872. if (!(key == "constructor" && (isProto || !hasOwnProperty$6.call(object4, key)))) {
  873. result.push(key);
  874. }
  875. }
  876. return result;
  877. }
  878. function keysIn(object4) {
  879. return isArrayLike(object4) ? arrayLikeKeys(object4, true) : baseKeysIn(object4);
  880. }
  881. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/;
  882. function isKey(value, object4) {
  883. if (isArray$2(value)) {
  884. return false;
  885. }
  886. var type4 = typeof value;
  887. if (type4 == "number" || type4 == "symbol" || type4 == "boolean" || value == null || isSymbol(value)) {
  888. return true;
  889. }
  890. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object4 != null && value in Object(object4);
  891. }
  892. var nativeCreate = getNative(Object, "create");
  893. var nativeCreate$1 = nativeCreate;
  894. function hashClear() {
  895. this.__data__ = nativeCreate$1 ? nativeCreate$1(null) : {};
  896. this.size = 0;
  897. }
  898. function hashDelete(key) {
  899. var result = this.has(key) && delete this.__data__[key];
  900. this.size -= result ? 1 : 0;
  901. return result;
  902. }
  903. var HASH_UNDEFINED$2 = "__lodash_hash_undefined__";
  904. var objectProto$5 = Object.prototype;
  905. var hasOwnProperty$5 = objectProto$5.hasOwnProperty;
  906. function hashGet(key) {
  907. var data2 = this.__data__;
  908. if (nativeCreate$1) {
  909. var result = data2[key];
  910. return result === HASH_UNDEFINED$2 ? void 0 : result;
  911. }
  912. return hasOwnProperty$5.call(data2, key) ? data2[key] : void 0;
  913. }
  914. var objectProto$4 = Object.prototype;
  915. var hasOwnProperty$4 = objectProto$4.hasOwnProperty;
  916. function hashHas(key) {
  917. var data2 = this.__data__;
  918. return nativeCreate$1 ? data2[key] !== void 0 : hasOwnProperty$4.call(data2, key);
  919. }
  920. var HASH_UNDEFINED$1 = "__lodash_hash_undefined__";
  921. function hashSet(key, value) {
  922. var data2 = this.__data__;
  923. this.size += this.has(key) ? 0 : 1;
  924. data2[key] = nativeCreate$1 && value === void 0 ? HASH_UNDEFINED$1 : value;
  925. return this;
  926. }
  927. function Hash(entries) {
  928. var index = -1, length = entries == null ? 0 : entries.length;
  929. this.clear();
  930. while (++index < length) {
  931. var entry = entries[index];
  932. this.set(entry[0], entry[1]);
  933. }
  934. }
  935. Hash.prototype.clear = hashClear;
  936. Hash.prototype["delete"] = hashDelete;
  937. Hash.prototype.get = hashGet;
  938. Hash.prototype.has = hashHas;
  939. Hash.prototype.set = hashSet;
  940. function listCacheClear() {
  941. this.__data__ = [];
  942. this.size = 0;
  943. }
  944. function assocIndexOf(array4, key) {
  945. var length = array4.length;
  946. while (length--) {
  947. if (eq(array4[length][0], key)) {
  948. return length;
  949. }
  950. }
  951. return -1;
  952. }
  953. var arrayProto = Array.prototype;
  954. var splice = arrayProto.splice;
  955. function listCacheDelete(key) {
  956. var data2 = this.__data__, index = assocIndexOf(data2, key);
  957. if (index < 0) {
  958. return false;
  959. }
  960. var lastIndex = data2.length - 1;
  961. if (index == lastIndex) {
  962. data2.pop();
  963. } else {
  964. splice.call(data2, index, 1);
  965. }
  966. --this.size;
  967. return true;
  968. }
  969. function listCacheGet(key) {
  970. var data2 = this.__data__, index = assocIndexOf(data2, key);
  971. return index < 0 ? void 0 : data2[index][1];
  972. }
  973. function listCacheHas(key) {
  974. return assocIndexOf(this.__data__, key) > -1;
  975. }
  976. function listCacheSet(key, value) {
  977. var data2 = this.__data__, index = assocIndexOf(data2, key);
  978. if (index < 0) {
  979. ++this.size;
  980. data2.push([key, value]);
  981. } else {
  982. data2[index][1] = value;
  983. }
  984. return this;
  985. }
  986. function ListCache(entries) {
  987. var index = -1, length = entries == null ? 0 : entries.length;
  988. this.clear();
  989. while (++index < length) {
  990. var entry = entries[index];
  991. this.set(entry[0], entry[1]);
  992. }
  993. }
  994. ListCache.prototype.clear = listCacheClear;
  995. ListCache.prototype["delete"] = listCacheDelete;
  996. ListCache.prototype.get = listCacheGet;
  997. ListCache.prototype.has = listCacheHas;
  998. ListCache.prototype.set = listCacheSet;
  999. var Map$1 = getNative(root$1, "Map");
  1000. var Map$2 = Map$1;
  1001. function mapCacheClear() {
  1002. this.size = 0;
  1003. this.__data__ = {
  1004. "hash": new Hash(),
  1005. "map": new (Map$2 || ListCache)(),
  1006. "string": new Hash()
  1007. };
  1008. }
  1009. function isKeyable(value) {
  1010. var type4 = typeof value;
  1011. return type4 == "string" || type4 == "number" || type4 == "symbol" || type4 == "boolean" ? value !== "__proto__" : value === null;
  1012. }
  1013. function getMapData(map, key) {
  1014. var data2 = map.__data__;
  1015. return isKeyable(key) ? data2[typeof key == "string" ? "string" : "hash"] : data2.map;
  1016. }
  1017. function mapCacheDelete(key) {
  1018. var result = getMapData(this, key)["delete"](key);
  1019. this.size -= result ? 1 : 0;
  1020. return result;
  1021. }
  1022. function mapCacheGet(key) {
  1023. return getMapData(this, key).get(key);
  1024. }
  1025. function mapCacheHas(key) {
  1026. return getMapData(this, key).has(key);
  1027. }
  1028. function mapCacheSet(key, value) {
  1029. var data2 = getMapData(this, key), size = data2.size;
  1030. data2.set(key, value);
  1031. this.size += data2.size == size ? 0 : 1;
  1032. return this;
  1033. }
  1034. function MapCache(entries) {
  1035. var index = -1, length = entries == null ? 0 : entries.length;
  1036. this.clear();
  1037. while (++index < length) {
  1038. var entry = entries[index];
  1039. this.set(entry[0], entry[1]);
  1040. }
  1041. }
  1042. MapCache.prototype.clear = mapCacheClear;
  1043. MapCache.prototype["delete"] = mapCacheDelete;
  1044. MapCache.prototype.get = mapCacheGet;
  1045. MapCache.prototype.has = mapCacheHas;
  1046. MapCache.prototype.set = mapCacheSet;
  1047. var FUNC_ERROR_TEXT$2 = "Expected a function";
  1048. function memoize(func, resolver) {
  1049. if (typeof func != "function" || resolver != null && typeof resolver != "function") {
  1050. throw new TypeError(FUNC_ERROR_TEXT$2);
  1051. }
  1052. var memoized = function() {
  1053. var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
  1054. if (cache.has(key)) {
  1055. return cache.get(key);
  1056. }
  1057. var result = func.apply(this, args);
  1058. memoized.cache = cache.set(key, result) || cache;
  1059. return result;
  1060. };
  1061. memoized.cache = new (memoize.Cache || MapCache)();
  1062. return memoized;
  1063. }
  1064. memoize.Cache = MapCache;
  1065. var MAX_MEMOIZE_SIZE = 500;
  1066. function memoizeCapped(func) {
  1067. var result = memoize(func, function(key) {
  1068. if (cache.size === MAX_MEMOIZE_SIZE) {
  1069. cache.clear();
  1070. }
  1071. return key;
  1072. });
  1073. var cache = result.cache;
  1074. return result;
  1075. }
  1076. var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  1077. var reEscapeChar = /\\(\\)?/g;
  1078. var stringToPath = memoizeCapped(function(string3) {
  1079. var result = [];
  1080. if (string3.charCodeAt(0) === 46) {
  1081. result.push("");
  1082. }
  1083. string3.replace(rePropName, function(match, number4, quote, subString) {
  1084. result.push(quote ? subString.replace(reEscapeChar, "$1") : number4 || match);
  1085. });
  1086. return result;
  1087. });
  1088. var stringToPath$1 = stringToPath;
  1089. function toString(value) {
  1090. return value == null ? "" : baseToString(value);
  1091. }
  1092. function castPath(value, object4) {
  1093. if (isArray$2(value)) {
  1094. return value;
  1095. }
  1096. return isKey(value, object4) ? [value] : stringToPath$1(toString(value));
  1097. }
  1098. var INFINITY$2 = 1 / 0;
  1099. function toKey(value) {
  1100. if (typeof value == "string" || isSymbol(value)) {
  1101. return value;
  1102. }
  1103. var result = value + "";
  1104. return result == "0" && 1 / value == -INFINITY$2 ? "-0" : result;
  1105. }
  1106. function baseGet(object4, path) {
  1107. path = castPath(path, object4);
  1108. var index = 0, length = path.length;
  1109. while (object4 != null && index < length) {
  1110. object4 = object4[toKey(path[index++])];
  1111. }
  1112. return index && index == length ? object4 : void 0;
  1113. }
  1114. function get(object4, path, defaultValue) {
  1115. var result = object4 == null ? void 0 : baseGet(object4, path);
  1116. return result === void 0 ? defaultValue : result;
  1117. }
  1118. function arrayPush(array4, values) {
  1119. var index = -1, length = values.length, offset2 = array4.length;
  1120. while (++index < length) {
  1121. array4[offset2 + index] = values[index];
  1122. }
  1123. return array4;
  1124. }
  1125. var spreadableSymbol = Symbol$2 ? Symbol$2.isConcatSpreadable : void 0;
  1126. function isFlattenable(value) {
  1127. return isArray$2(value) || isArguments$1(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
  1128. }
  1129. function baseFlatten(array4, depth, predicate, isStrict, result) {
  1130. var index = -1, length = array4.length;
  1131. predicate || (predicate = isFlattenable);
  1132. result || (result = []);
  1133. while (++index < length) {
  1134. var value = array4[index];
  1135. if (depth > 0 && predicate(value)) {
  1136. if (depth > 1) {
  1137. baseFlatten(value, depth - 1, predicate, isStrict, result);
  1138. } else {
  1139. arrayPush(result, value);
  1140. }
  1141. } else if (!isStrict) {
  1142. result[result.length] = value;
  1143. }
  1144. }
  1145. return result;
  1146. }
  1147. var getPrototype = overArg(Object.getPrototypeOf, Object);
  1148. var getPrototype$1 = getPrototype;
  1149. function castArray$1() {
  1150. if (!arguments.length) {
  1151. return [];
  1152. }
  1153. var value = arguments[0];
  1154. return isArray$2(value) ? value : [value];
  1155. }
  1156. function stackClear() {
  1157. this.__data__ = new ListCache();
  1158. this.size = 0;
  1159. }
  1160. function stackDelete(key) {
  1161. var data2 = this.__data__, result = data2["delete"](key);
  1162. this.size = data2.size;
  1163. return result;
  1164. }
  1165. function stackGet(key) {
  1166. return this.__data__.get(key);
  1167. }
  1168. function stackHas(key) {
  1169. return this.__data__.has(key);
  1170. }
  1171. var LARGE_ARRAY_SIZE$1 = 200;
  1172. function stackSet(key, value) {
  1173. var data2 = this.__data__;
  1174. if (data2 instanceof ListCache) {
  1175. var pairs = data2.__data__;
  1176. if (!Map$2 || pairs.length < LARGE_ARRAY_SIZE$1 - 1) {
  1177. pairs.push([key, value]);
  1178. this.size = ++data2.size;
  1179. return this;
  1180. }
  1181. data2 = this.__data__ = new MapCache(pairs);
  1182. }
  1183. data2.set(key, value);
  1184. this.size = data2.size;
  1185. return this;
  1186. }
  1187. function Stack(entries) {
  1188. var data2 = this.__data__ = new ListCache(entries);
  1189. this.size = data2.size;
  1190. }
  1191. Stack.prototype.clear = stackClear;
  1192. Stack.prototype["delete"] = stackDelete;
  1193. Stack.prototype.get = stackGet;
  1194. Stack.prototype.has = stackHas;
  1195. Stack.prototype.set = stackSet;
  1196. function baseAssign(object4, source) {
  1197. return object4 && copyObject(source, keys(source), object4);
  1198. }
  1199. function baseAssignIn(object4, source) {
  1200. return object4 && copyObject(source, keysIn(source), object4);
  1201. }
  1202. var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
  1203. var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
  1204. var moduleExports = freeModule && freeModule.exports === freeExports;
  1205. var Buffer2 = moduleExports ? root$1.Buffer : void 0, allocUnsafe = Buffer2 ? Buffer2.allocUnsafe : void 0;
  1206. function cloneBuffer(buffer, isDeep) {
  1207. if (isDeep) {
  1208. return buffer.slice();
  1209. }
  1210. var length = buffer.length, result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  1211. buffer.copy(result);
  1212. return result;
  1213. }
  1214. function arrayFilter(array4, predicate) {
  1215. var index = -1, length = array4 == null ? 0 : array4.length, resIndex = 0, result = [];
  1216. while (++index < length) {
  1217. var value = array4[index];
  1218. if (predicate(value, index, array4)) {
  1219. result[resIndex++] = value;
  1220. }
  1221. }
  1222. return result;
  1223. }
  1224. function stubArray() {
  1225. return [];
  1226. }
  1227. var objectProto$3 = Object.prototype;
  1228. var propertyIsEnumerable = objectProto$3.propertyIsEnumerable;
  1229. var nativeGetSymbols$1 = Object.getOwnPropertySymbols;
  1230. var getSymbols = !nativeGetSymbols$1 ? stubArray : function(object4) {
  1231. if (object4 == null) {
  1232. return [];
  1233. }
  1234. object4 = Object(object4);
  1235. return arrayFilter(nativeGetSymbols$1(object4), function(symbol) {
  1236. return propertyIsEnumerable.call(object4, symbol);
  1237. });
  1238. };
  1239. var getSymbols$1 = getSymbols;
  1240. function copySymbols(source, object4) {
  1241. return copyObject(source, getSymbols$1(source), object4);
  1242. }
  1243. var nativeGetSymbols = Object.getOwnPropertySymbols;
  1244. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object4) {
  1245. var result = [];
  1246. while (object4) {
  1247. arrayPush(result, getSymbols$1(object4));
  1248. object4 = getPrototype$1(object4);
  1249. }
  1250. return result;
  1251. };
  1252. var getSymbolsIn$1 = getSymbolsIn;
  1253. function copySymbolsIn(source, object4) {
  1254. return copyObject(source, getSymbolsIn$1(source), object4);
  1255. }
  1256. function baseGetAllKeys(object4, keysFunc, symbolsFunc) {
  1257. var result = keysFunc(object4);
  1258. return isArray$2(object4) ? result : arrayPush(result, symbolsFunc(object4));
  1259. }
  1260. function getAllKeys(object4) {
  1261. return baseGetAllKeys(object4, keys, getSymbols$1);
  1262. }
  1263. function getAllKeysIn(object4) {
  1264. return baseGetAllKeys(object4, keysIn, getSymbolsIn$1);
  1265. }
  1266. var DataView = getNative(root$1, "DataView");
  1267. var DataView$1 = DataView;
  1268. var Promise$1 = getNative(root$1, "Promise");
  1269. var Promise$2 = Promise$1;
  1270. var Set$1 = getNative(root$1, "Set");
  1271. var Set$2 = Set$1;
  1272. var mapTag$4 = "[object Map]", objectTag$2 = "[object Object]", promiseTag = "[object Promise]", setTag$4 = "[object Set]", weakMapTag$1 = "[object WeakMap]";
  1273. var dataViewTag$3 = "[object DataView]";
  1274. var dataViewCtorString = toSource(DataView$1), mapCtorString = toSource(Map$2), promiseCtorString = toSource(Promise$2), setCtorString = toSource(Set$2), weakMapCtorString = toSource(WeakMap$1);
  1275. var getTag = baseGetTag;
  1276. if (DataView$1 && getTag(new DataView$1(new ArrayBuffer(1))) != dataViewTag$3 || Map$2 && getTag(new Map$2()) != mapTag$4 || Promise$2 && getTag(Promise$2.resolve()) != promiseTag || Set$2 && getTag(new Set$2()) != setTag$4 || WeakMap$1 && getTag(new WeakMap$1()) != weakMapTag$1) {
  1277. getTag = function(value) {
  1278. var result = baseGetTag(value), Ctor = result == objectTag$2 ? value.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : "";
  1279. if (ctorString) {
  1280. switch (ctorString) {
  1281. case dataViewCtorString:
  1282. return dataViewTag$3;
  1283. case mapCtorString:
  1284. return mapTag$4;
  1285. case promiseCtorString:
  1286. return promiseTag;
  1287. case setCtorString:
  1288. return setTag$4;
  1289. case weakMapCtorString:
  1290. return weakMapTag$1;
  1291. }
  1292. }
  1293. return result;
  1294. };
  1295. }
  1296. var getTag$1 = getTag;
  1297. var objectProto$2 = Object.prototype;
  1298. var hasOwnProperty$3 = objectProto$2.hasOwnProperty;
  1299. function initCloneArray(array4) {
  1300. var length = array4.length, result = new array4.constructor(length);
  1301. if (length && typeof array4[0] == "string" && hasOwnProperty$3.call(array4, "index")) {
  1302. result.index = array4.index;
  1303. result.input = array4.input;
  1304. }
  1305. return result;
  1306. }
  1307. var Uint8Array2 = root$1.Uint8Array;
  1308. var Uint8Array$1 = Uint8Array2;
  1309. function cloneArrayBuffer(arrayBuffer) {
  1310. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  1311. new Uint8Array$1(result).set(new Uint8Array$1(arrayBuffer));
  1312. return result;
  1313. }
  1314. function cloneDataView(dataView, isDeep) {
  1315. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  1316. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  1317. }
  1318. var reFlags = /\w*$/;
  1319. function cloneRegExp(regexp4) {
  1320. var result = new regexp4.constructor(regexp4.source, reFlags.exec(regexp4));
  1321. result.lastIndex = regexp4.lastIndex;
  1322. return result;
  1323. }
  1324. var symbolProto$1 = Symbol$2 ? Symbol$2.prototype : void 0, symbolValueOf$1 = symbolProto$1 ? symbolProto$1.valueOf : void 0;
  1325. function cloneSymbol(symbol) {
  1326. return symbolValueOf$1 ? Object(symbolValueOf$1.call(symbol)) : {};
  1327. }
  1328. function cloneTypedArray(typedArray, isDeep) {
  1329. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  1330. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  1331. }
  1332. var boolTag$2 = "[object Boolean]", dateTag$2 = "[object Date]", mapTag$3 = "[object Map]", numberTag$2 = "[object Number]", regexpTag$2 = "[object RegExp]", setTag$3 = "[object Set]", stringTag$2 = "[object String]", symbolTag$2 = "[object Symbol]";
  1333. var arrayBufferTag$2 = "[object ArrayBuffer]", dataViewTag$2 = "[object DataView]", float32Tag$1 = "[object Float32Array]", float64Tag$1 = "[object Float64Array]", int8Tag$1 = "[object Int8Array]", int16Tag$1 = "[object Int16Array]", int32Tag$1 = "[object Int32Array]", uint8Tag$1 = "[object Uint8Array]", uint8ClampedTag$1 = "[object Uint8ClampedArray]", uint16Tag$1 = "[object Uint16Array]", uint32Tag$1 = "[object Uint32Array]";
  1334. function initCloneByTag(object4, tag, isDeep) {
  1335. var Ctor = object4.constructor;
  1336. switch (tag) {
  1337. case arrayBufferTag$2:
  1338. return cloneArrayBuffer(object4);
  1339. case boolTag$2:
  1340. case dateTag$2:
  1341. return new Ctor(+object4);
  1342. case dataViewTag$2:
  1343. return cloneDataView(object4, isDeep);
  1344. case float32Tag$1:
  1345. case float64Tag$1:
  1346. case int8Tag$1:
  1347. case int16Tag$1:
  1348. case int32Tag$1:
  1349. case uint8Tag$1:
  1350. case uint8ClampedTag$1:
  1351. case uint16Tag$1:
  1352. case uint32Tag$1:
  1353. return cloneTypedArray(object4, isDeep);
  1354. case mapTag$3:
  1355. return new Ctor();
  1356. case numberTag$2:
  1357. case stringTag$2:
  1358. return new Ctor(object4);
  1359. case regexpTag$2:
  1360. return cloneRegExp(object4);
  1361. case setTag$3:
  1362. return new Ctor();
  1363. case symbolTag$2:
  1364. return cloneSymbol(object4);
  1365. }
  1366. }
  1367. function initCloneObject(object4) {
  1368. return typeof object4.constructor == "function" && !isPrototype(object4) ? baseCreate$1(getPrototype$1(object4)) : {};
  1369. }
  1370. var mapTag$2 = "[object Map]";
  1371. function baseIsMap(value) {
  1372. return isObjectLike(value) && getTag$1(value) == mapTag$2;
  1373. }
  1374. var nodeIsMap = nodeUtil$1 && nodeUtil$1.isMap;
  1375. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  1376. var isMap$1 = isMap;
  1377. var setTag$2 = "[object Set]";
  1378. function baseIsSet(value) {
  1379. return isObjectLike(value) && getTag$1(value) == setTag$2;
  1380. }
  1381. var nodeIsSet = nodeUtil$1 && nodeUtil$1.isSet;
  1382. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  1383. var isSet$1 = isSet;
  1384. var CLONE_DEEP_FLAG$1 = 1, CLONE_FLAT_FLAG = 2, CLONE_SYMBOLS_FLAG$2 = 4;
  1385. var argsTag$1 = "[object Arguments]", arrayTag$1 = "[object Array]", boolTag$1 = "[object Boolean]", dateTag$1 = "[object Date]", errorTag$1 = "[object Error]", funcTag = "[object Function]", genTag = "[object GeneratorFunction]", mapTag$1 = "[object Map]", numberTag$1 = "[object Number]", objectTag$1 = "[object Object]", regexpTag$1 = "[object RegExp]", setTag$1 = "[object Set]", stringTag$1 = "[object String]", symbolTag$1 = "[object Symbol]", weakMapTag = "[object WeakMap]";
  1386. var arrayBufferTag$1 = "[object ArrayBuffer]", dataViewTag$1 = "[object DataView]", float32Tag = "[object Float32Array]", float64Tag = "[object Float64Array]", int8Tag = "[object Int8Array]", int16Tag = "[object Int16Array]", int32Tag = "[object Int32Array]", uint8Tag = "[object Uint8Array]", uint8ClampedTag = "[object Uint8ClampedArray]", uint16Tag = "[object Uint16Array]", uint32Tag = "[object Uint32Array]";
  1387. var cloneableTags = {};
  1388. cloneableTags[argsTag$1] = cloneableTags[arrayTag$1] = cloneableTags[arrayBufferTag$1] = cloneableTags[dataViewTag$1] = cloneableTags[boolTag$1] = cloneableTags[dateTag$1] = cloneableTags[float32Tag] = cloneableTags[float64Tag] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[mapTag$1] = cloneableTags[numberTag$1] = cloneableTags[objectTag$1] = cloneableTags[regexpTag$1] = cloneableTags[setTag$1] = cloneableTags[stringTag$1] = cloneableTags[symbolTag$1] = cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  1389. cloneableTags[errorTag$1] = cloneableTags[funcTag] = cloneableTags[weakMapTag] = false;
  1390. function baseClone(value, bitmask, customizer, key, object4, stack) {
  1391. var result, isDeep = bitmask & CLONE_DEEP_FLAG$1, isFlat = bitmask & CLONE_FLAT_FLAG, isFull = bitmask & CLONE_SYMBOLS_FLAG$2;
  1392. if (customizer) {
  1393. result = object4 ? customizer(value, key, object4, stack) : customizer(value);
  1394. }
  1395. if (result !== void 0) {
  1396. return result;
  1397. }
  1398. if (!isObject$2(value)) {
  1399. return value;
  1400. }
  1401. var isArr = isArray$2(value);
  1402. if (isArr) {
  1403. result = initCloneArray(value);
  1404. if (!isDeep) {
  1405. return copyArray(value, result);
  1406. }
  1407. } else {
  1408. var tag = getTag$1(value), isFunc = tag == funcTag || tag == genTag;
  1409. if (isBuffer$1(value)) {
  1410. return cloneBuffer(value, isDeep);
  1411. }
  1412. if (tag == objectTag$1 || tag == argsTag$1 || isFunc && !object4) {
  1413. result = isFlat || isFunc ? {} : initCloneObject(value);
  1414. if (!isDeep) {
  1415. return isFlat ? copySymbolsIn(value, baseAssignIn(result, value)) : copySymbols(value, baseAssign(result, value));
  1416. }
  1417. } else {
  1418. if (!cloneableTags[tag]) {
  1419. return object4 ? value : {};
  1420. }
  1421. result = initCloneByTag(value, tag, isDeep);
  1422. }
  1423. }
  1424. stack || (stack = new Stack());
  1425. var stacked = stack.get(value);
  1426. if (stacked) {
  1427. return stacked;
  1428. }
  1429. stack.set(value, result);
  1430. if (isSet$1(value)) {
  1431. value.forEach(function(subValue) {
  1432. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  1433. });
  1434. } else if (isMap$1(value)) {
  1435. value.forEach(function(subValue, key2) {
  1436. result.set(key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
  1437. });
  1438. }
  1439. var keysFunc = isFull ? isFlat ? getAllKeysIn : getAllKeys : isFlat ? keysIn : keys;
  1440. var props = isArr ? void 0 : keysFunc(value);
  1441. arrayEach(props || value, function(subValue, key2) {
  1442. if (props) {
  1443. key2 = subValue;
  1444. subValue = value[key2];
  1445. }
  1446. assignValue(result, key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
  1447. });
  1448. return result;
  1449. }
  1450. var CLONE_SYMBOLS_FLAG$1 = 4;
  1451. function clone(value) {
  1452. return baseClone(value, CLONE_SYMBOLS_FLAG$1);
  1453. }
  1454. var CLONE_DEEP_FLAG = 1, CLONE_SYMBOLS_FLAG = 4;
  1455. function cloneDeep(value) {
  1456. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
  1457. }
  1458. var HASH_UNDEFINED = "__lodash_hash_undefined__";
  1459. function setCacheAdd(value) {
  1460. this.__data__.set(value, HASH_UNDEFINED);
  1461. return this;
  1462. }
  1463. function setCacheHas(value) {
  1464. return this.__data__.has(value);
  1465. }
  1466. function SetCache(values) {
  1467. var index = -1, length = values == null ? 0 : values.length;
  1468. this.__data__ = new MapCache();
  1469. while (++index < length) {
  1470. this.add(values[index]);
  1471. }
  1472. }
  1473. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  1474. SetCache.prototype.has = setCacheHas;
  1475. function arraySome(array4, predicate) {
  1476. var index = -1, length = array4 == null ? 0 : array4.length;
  1477. while (++index < length) {
  1478. if (predicate(array4[index], index, array4)) {
  1479. return true;
  1480. }
  1481. }
  1482. return false;
  1483. }
  1484. function cacheHas(cache, key) {
  1485. return cache.has(key);
  1486. }
  1487. var COMPARE_PARTIAL_FLAG$3 = 1, COMPARE_UNORDERED_FLAG$1 = 2;
  1488. function equalArrays(array4, other, bitmask, customizer, equalFunc, stack) {
  1489. var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3, arrLength = array4.length, othLength = other.length;
  1490. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  1491. return false;
  1492. }
  1493. var arrStacked = stack.get(array4);
  1494. var othStacked = stack.get(other);
  1495. if (arrStacked && othStacked) {
  1496. return arrStacked == other && othStacked == array4;
  1497. }
  1498. var index = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG$1 ? new SetCache() : void 0;
  1499. stack.set(array4, other);
  1500. stack.set(other, array4);
  1501. while (++index < arrLength) {
  1502. var arrValue = array4[index], othValue = other[index];
  1503. if (customizer) {
  1504. var compared = isPartial ? customizer(othValue, arrValue, index, other, array4, stack) : customizer(arrValue, othValue, index, array4, other, stack);
  1505. }
  1506. if (compared !== void 0) {
  1507. if (compared) {
  1508. continue;
  1509. }
  1510. result = false;
  1511. break;
  1512. }
  1513. if (seen) {
  1514. if (!arraySome(other, function(othValue2, othIndex) {
  1515. if (!cacheHas(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
  1516. return seen.push(othIndex);
  1517. }
  1518. })) {
  1519. result = false;
  1520. break;
  1521. }
  1522. } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  1523. result = false;
  1524. break;
  1525. }
  1526. }
  1527. stack["delete"](array4);
  1528. stack["delete"](other);
  1529. return result;
  1530. }
  1531. function mapToArray(map) {
  1532. var index = -1, result = Array(map.size);
  1533. map.forEach(function(value, key) {
  1534. result[++index] = [key, value];
  1535. });
  1536. return result;
  1537. }
  1538. function setToArray(set2) {
  1539. var index = -1, result = Array(set2.size);
  1540. set2.forEach(function(value) {
  1541. result[++index] = value;
  1542. });
  1543. return result;
  1544. }
  1545. var COMPARE_PARTIAL_FLAG$2 = 1, COMPARE_UNORDERED_FLAG = 2;
  1546. var boolTag = "[object Boolean]", dateTag = "[object Date]", errorTag = "[object Error]", mapTag = "[object Map]", numberTag = "[object Number]", regexpTag = "[object RegExp]", setTag = "[object Set]", stringTag = "[object String]", symbolTag = "[object Symbol]";
  1547. var arrayBufferTag = "[object ArrayBuffer]", dataViewTag = "[object DataView]";
  1548. var symbolProto = Symbol$2 ? Symbol$2.prototype : void 0, symbolValueOf = symbolProto ? symbolProto.valueOf : void 0;
  1549. function equalByTag(object4, other, tag, bitmask, customizer, equalFunc, stack) {
  1550. switch (tag) {
  1551. case dataViewTag:
  1552. if (object4.byteLength != other.byteLength || object4.byteOffset != other.byteOffset) {
  1553. return false;
  1554. }
  1555. object4 = object4.buffer;
  1556. other = other.buffer;
  1557. case arrayBufferTag:
  1558. if (object4.byteLength != other.byteLength || !equalFunc(new Uint8Array$1(object4), new Uint8Array$1(other))) {
  1559. return false;
  1560. }
  1561. return true;
  1562. case boolTag:
  1563. case dateTag:
  1564. case numberTag:
  1565. return eq(+object4, +other);
  1566. case errorTag:
  1567. return object4.name == other.name && object4.message == other.message;
  1568. case regexpTag:
  1569. case stringTag:
  1570. return object4 == other + "";
  1571. case mapTag:
  1572. var convert = mapToArray;
  1573. case setTag:
  1574. var isPartial = bitmask & COMPARE_PARTIAL_FLAG$2;
  1575. convert || (convert = setToArray);
  1576. if (object4.size != other.size && !isPartial) {
  1577. return false;
  1578. }
  1579. var stacked = stack.get(object4);
  1580. if (stacked) {
  1581. return stacked == other;
  1582. }
  1583. bitmask |= COMPARE_UNORDERED_FLAG;
  1584. stack.set(object4, other);
  1585. var result = equalArrays(convert(object4), convert(other), bitmask, customizer, equalFunc, stack);
  1586. stack["delete"](object4);
  1587. return result;
  1588. case symbolTag:
  1589. if (symbolValueOf) {
  1590. return symbolValueOf.call(object4) == symbolValueOf.call(other);
  1591. }
  1592. }
  1593. return false;
  1594. }
  1595. var COMPARE_PARTIAL_FLAG$1 = 1;
  1596. var objectProto$1 = Object.prototype;
  1597. var hasOwnProperty$2 = objectProto$1.hasOwnProperty;
  1598. function equalObjects(object4, other, bitmask, customizer, equalFunc, stack) {
  1599. var isPartial = bitmask & COMPARE_PARTIAL_FLAG$1, objProps = getAllKeys(object4), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length;
  1600. if (objLength != othLength && !isPartial) {
  1601. return false;
  1602. }
  1603. var index = objLength;
  1604. while (index--) {
  1605. var key = objProps[index];
  1606. if (!(isPartial ? key in other : hasOwnProperty$2.call(other, key))) {
  1607. return false;
  1608. }
  1609. }
  1610. var objStacked = stack.get(object4);
  1611. var othStacked = stack.get(other);
  1612. if (objStacked && othStacked) {
  1613. return objStacked == other && othStacked == object4;
  1614. }
  1615. var result = true;
  1616. stack.set(object4, other);
  1617. stack.set(other, object4);
  1618. var skipCtor = isPartial;
  1619. while (++index < objLength) {
  1620. key = objProps[index];
  1621. var objValue = object4[key], othValue = other[key];
  1622. if (customizer) {
  1623. var compared = isPartial ? customizer(othValue, objValue, key, other, object4, stack) : customizer(objValue, othValue, key, object4, other, stack);
  1624. }
  1625. if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
  1626. result = false;
  1627. break;
  1628. }
  1629. skipCtor || (skipCtor = key == "constructor");
  1630. }
  1631. if (result && !skipCtor) {
  1632. var objCtor = object4.constructor, othCtor = other.constructor;
  1633. if (objCtor != othCtor && ("constructor" in object4 && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
  1634. result = false;
  1635. }
  1636. }
  1637. stack["delete"](object4);
  1638. stack["delete"](other);
  1639. return result;
  1640. }
  1641. var COMPARE_PARTIAL_FLAG = 1;
  1642. var argsTag = "[object Arguments]", arrayTag = "[object Array]", objectTag = "[object Object]";
  1643. var objectProto = Object.prototype;
  1644. var hasOwnProperty$1 = objectProto.hasOwnProperty;
  1645. function baseIsEqualDeep(object4, other, bitmask, customizer, equalFunc, stack) {
  1646. var objIsArr = isArray$2(object4), othIsArr = isArray$2(other), objTag = objIsArr ? arrayTag : getTag$1(object4), othTag = othIsArr ? arrayTag : getTag$1(other);
  1647. objTag = objTag == argsTag ? objectTag : objTag;
  1648. othTag = othTag == argsTag ? objectTag : othTag;
  1649. var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag;
  1650. if (isSameTag && isBuffer$1(object4)) {
  1651. if (!isBuffer$1(other)) {
  1652. return false;
  1653. }
  1654. objIsArr = true;
  1655. objIsObj = false;
  1656. }
  1657. if (isSameTag && !objIsObj) {
  1658. stack || (stack = new Stack());
  1659. return objIsArr || isTypedArray$1(object4) ? equalArrays(object4, other, bitmask, customizer, equalFunc, stack) : equalByTag(object4, other, objTag, bitmask, customizer, equalFunc, stack);
  1660. }
  1661. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  1662. var objIsWrapped = objIsObj && hasOwnProperty$1.call(object4, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty$1.call(other, "__wrapped__");
  1663. if (objIsWrapped || othIsWrapped) {
  1664. var objUnwrapped = objIsWrapped ? object4.value() : object4, othUnwrapped = othIsWrapped ? other.value() : other;
  1665. stack || (stack = new Stack());
  1666. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  1667. }
  1668. }
  1669. if (!isSameTag) {
  1670. return false;
  1671. }
  1672. stack || (stack = new Stack());
  1673. return equalObjects(object4, other, bitmask, customizer, equalFunc, stack);
  1674. }
  1675. function baseIsEqual(value, other, bitmask, customizer, stack) {
  1676. if (value === other) {
  1677. return true;
  1678. }
  1679. if (value == null || other == null || !isObjectLike(value) && !isObjectLike(other)) {
  1680. return value !== value && other !== other;
  1681. }
  1682. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  1683. }
  1684. var now = function() {
  1685. return root$1.Date.now();
  1686. };
  1687. var now$1 = now;
  1688. var FUNC_ERROR_TEXT$1 = "Expected a function";
  1689. var nativeMax = Math.max, nativeMin = Math.min;
  1690. function debounce$1(func, wait, options) {
  1691. var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
  1692. if (typeof func != "function") {
  1693. throw new TypeError(FUNC_ERROR_TEXT$1);
  1694. }
  1695. wait = toNumber(wait) || 0;
  1696. if (isObject$2(options)) {
  1697. leading = !!options.leading;
  1698. maxing = "maxWait" in options;
  1699. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  1700. trailing = "trailing" in options ? !!options.trailing : trailing;
  1701. }
  1702. function invokeFunc(time) {
  1703. var args = lastArgs, thisArg = lastThis;
  1704. lastArgs = lastThis = void 0;
  1705. lastInvokeTime = time;
  1706. result = func.apply(thisArg, args);
  1707. return result;
  1708. }
  1709. function leadingEdge(time) {
  1710. lastInvokeTime = time;
  1711. timerId = setTimeout(timerExpired, wait);
  1712. return leading ? invokeFunc(time) : result;
  1713. }
  1714. function remainingWait(time) {
  1715. var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
  1716. return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
  1717. }
  1718. function shouldInvoke(time) {
  1719. var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
  1720. return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
  1721. }
  1722. function timerExpired() {
  1723. var time = now$1();
  1724. if (shouldInvoke(time)) {
  1725. return trailingEdge(time);
  1726. }
  1727. timerId = setTimeout(timerExpired, remainingWait(time));
  1728. }
  1729. function trailingEdge(time) {
  1730. timerId = void 0;
  1731. if (trailing && lastArgs) {
  1732. return invokeFunc(time);
  1733. }
  1734. lastArgs = lastThis = void 0;
  1735. return result;
  1736. }
  1737. function cancel() {
  1738. if (timerId !== void 0) {
  1739. clearTimeout(timerId);
  1740. }
  1741. lastInvokeTime = 0;
  1742. lastArgs = lastCallTime = lastThis = timerId = void 0;
  1743. }
  1744. function flush() {
  1745. return timerId === void 0 ? result : trailingEdge(now$1());
  1746. }
  1747. function debounced() {
  1748. var time = now$1(), isInvoking = shouldInvoke(time);
  1749. lastArgs = arguments;
  1750. lastThis = this;
  1751. lastCallTime = time;
  1752. if (isInvoking) {
  1753. if (timerId === void 0) {
  1754. return leadingEdge(lastCallTime);
  1755. }
  1756. if (maxing) {
  1757. clearTimeout(timerId);
  1758. timerId = setTimeout(timerExpired, wait);
  1759. return invokeFunc(lastCallTime);
  1760. }
  1761. }
  1762. if (timerId === void 0) {
  1763. timerId = setTimeout(timerExpired, wait);
  1764. }
  1765. return result;
  1766. }
  1767. debounced.cancel = cancel;
  1768. debounced.flush = flush;
  1769. return debounced;
  1770. }
  1771. function isArrayLikeObject(value) {
  1772. return isObjectLike(value) && isArrayLike(value);
  1773. }
  1774. function arrayIncludesWith(array4, value, comparator) {
  1775. var index = -1, length = array4 == null ? 0 : array4.length;
  1776. while (++index < length) {
  1777. if (comparator(value, array4[index])) {
  1778. return true;
  1779. }
  1780. }
  1781. return false;
  1782. }
  1783. var INFINITY$1 = 1 / 0;
  1784. function flattenDeep(array4) {
  1785. var length = array4 == null ? 0 : array4.length;
  1786. return length ? baseFlatten(array4, INFINITY$1) : [];
  1787. }
  1788. function fromPairs(pairs) {
  1789. var index = -1, length = pairs == null ? 0 : pairs.length, result = {};
  1790. while (++index < length) {
  1791. var pair = pairs[index];
  1792. result[pair[0]] = pair[1];
  1793. }
  1794. return result;
  1795. }
  1796. function isEqual(value, other) {
  1797. return baseIsEqual(value, other);
  1798. }
  1799. function isNil(value) {
  1800. return value == null;
  1801. }
  1802. function baseSet(object4, path, value, customizer) {
  1803. if (!isObject$2(object4)) {
  1804. return object4;
  1805. }
  1806. path = castPath(path, object4);
  1807. var index = -1, length = path.length, lastIndex = length - 1, nested = object4;
  1808. while (nested != null && ++index < length) {
  1809. var key = toKey(path[index]), newValue = value;
  1810. if (key === "__proto__" || key === "constructor" || key === "prototype") {
  1811. return object4;
  1812. }
  1813. if (index != lastIndex) {
  1814. var objValue = nested[key];
  1815. newValue = customizer ? customizer(objValue, key, nested) : void 0;
  1816. if (newValue === void 0) {
  1817. newValue = isObject$2(objValue) ? objValue : isIndex(path[index + 1]) ? [] : {};
  1818. }
  1819. }
  1820. assignValue(nested, key, newValue);
  1821. nested = nested[key];
  1822. }
  1823. return object4;
  1824. }
  1825. function set(object4, path, value) {
  1826. return object4 == null ? object4 : baseSet(object4, path, value);
  1827. }
  1828. var FUNC_ERROR_TEXT = "Expected a function";
  1829. function throttle(func, wait, options) {
  1830. var leading = true, trailing = true;
  1831. if (typeof func != "function") {
  1832. throw new TypeError(FUNC_ERROR_TEXT);
  1833. }
  1834. if (isObject$2(options)) {
  1835. leading = "leading" in options ? !!options.leading : leading;
  1836. trailing = "trailing" in options ? !!options.trailing : trailing;
  1837. }
  1838. return debounce$1(func, wait, {
  1839. "leading": leading,
  1840. "maxWait": wait,
  1841. "trailing": trailing
  1842. });
  1843. }
  1844. var INFINITY = 1 / 0;
  1845. var createSet = !(Set$2 && 1 / setToArray(new Set$2([, -0]))[1] == INFINITY) ? noop$1 : function(values) {
  1846. return new Set$2(values);
  1847. };
  1848. var createSet$1 = createSet;
  1849. var LARGE_ARRAY_SIZE = 200;
  1850. function baseUniq(array4, iteratee, comparator) {
  1851. var index = -1, includes = arrayIncludes, length = array4.length, isCommon = true, result = [], seen = result;
  1852. if (comparator) {
  1853. isCommon = false;
  1854. includes = arrayIncludesWith;
  1855. } else if (length >= LARGE_ARRAY_SIZE) {
  1856. var set2 = iteratee ? null : createSet$1(array4);
  1857. if (set2) {
  1858. return setToArray(set2);
  1859. }
  1860. isCommon = false;
  1861. includes = cacheHas;
  1862. seen = new SetCache();
  1863. } else {
  1864. seen = iteratee ? [] : result;
  1865. }
  1866. outer:
  1867. while (++index < length) {
  1868. var value = array4[index], computed2 = iteratee ? iteratee(value) : value;
  1869. value = comparator || value !== 0 ? value : 0;
  1870. if (isCommon && computed2 === computed2) {
  1871. var seenIndex = seen.length;
  1872. while (seenIndex--) {
  1873. if (seen[seenIndex] === computed2) {
  1874. continue outer;
  1875. }
  1876. }
  1877. if (iteratee) {
  1878. seen.push(computed2);
  1879. }
  1880. result.push(value);
  1881. } else if (!includes(seen, computed2, comparator)) {
  1882. if (seen !== result) {
  1883. seen.push(computed2);
  1884. }
  1885. result.push(value);
  1886. }
  1887. }
  1888. return result;
  1889. }
  1890. var union = baseRest(function(arrays) {
  1891. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  1892. });
  1893. var union$1 = union;
  1894. const isLeaf = (el) => !el.getAttribute("aria-owns");
  1895. const getSibling = (el, distance, elClass) => {
  1896. const { parentNode } = el;
  1897. if (!parentNode)
  1898. return null;
  1899. const siblings = parentNode.querySelectorAll(elClass);
  1900. const index = Array.prototype.indexOf.call(siblings, el);
  1901. return siblings[index + distance] || null;
  1902. };
  1903. const focusNode = (el) => {
  1904. if (!el)
  1905. return;
  1906. el.focus();
  1907. !isLeaf(el) && el.click();
  1908. };
  1909. const on = (element, event, handler3, useCapture = false) => {
  1910. if (element && event && handler3) {
  1911. element == null ? void 0 : element.addEventListener(event, handler3, useCapture);
  1912. }
  1913. };
  1914. const off = (element, event, handler3, useCapture = false) => {
  1915. if (element && event && handler3) {
  1916. element == null ? void 0 : element.removeEventListener(event, handler3, useCapture);
  1917. }
  1918. };
  1919. const once = (el, event, fn2) => {
  1920. const listener = function(...args) {
  1921. if (fn2) {
  1922. fn2.apply(this, args);
  1923. }
  1924. off(el, event, listener);
  1925. };
  1926. on(el, event, listener);
  1927. };
  1928. const composeEventHandlers = (theirsHandler, oursHandler, { checkForDefaultPrevented = true } = {}) => {
  1929. const handleEvent = (event) => {
  1930. const shouldPrevent = theirsHandler == null ? void 0 : theirsHandler(event);
  1931. if (checkForDefaultPrevented === false || !shouldPrevent) {
  1932. return oursHandler == null ? void 0 : oursHandler(event);
  1933. }
  1934. };
  1935. return handleEvent;
  1936. };
  1937. function tryOnScopeDispose(fn2) {
  1938. if (getCurrentScope()) {
  1939. onScopeDispose(fn2);
  1940. return true;
  1941. }
  1942. return false;
  1943. }
  1944. const isClient = typeof window !== "undefined";
  1945. const isBoolean = (val) => typeof val === "boolean";
  1946. const isNumber = (val) => typeof val === "number";
  1947. const isString$1 = (val) => typeof val === "string";
  1948. const noop = () => {
  1949. };
  1950. function createFilterWrapper(filter, fn2) {
  1951. function wrapper(...args) {
  1952. filter(() => fn2.apply(this, args), { fn: fn2, thisArg: this, args });
  1953. }
  1954. return wrapper;
  1955. }
  1956. function debounceFilter(ms, options = {}) {
  1957. let timer;
  1958. let maxTimer;
  1959. const filter = (invoke) => {
  1960. const duration = unref(ms);
  1961. const maxDuration = unref(options.maxWait);
  1962. if (timer)
  1963. clearTimeout(timer);
  1964. if (duration <= 0 || maxDuration !== void 0 && maxDuration <= 0) {
  1965. if (maxTimer) {
  1966. clearTimeout(maxTimer);
  1967. maxTimer = null;
  1968. }
  1969. return invoke();
  1970. }
  1971. if (maxDuration && !maxTimer) {
  1972. maxTimer = setTimeout(() => {
  1973. if (timer)
  1974. clearTimeout(timer);
  1975. maxTimer = null;
  1976. invoke();
  1977. }, maxDuration);
  1978. }
  1979. timer = setTimeout(() => {
  1980. if (maxTimer)
  1981. clearTimeout(maxTimer);
  1982. maxTimer = null;
  1983. invoke();
  1984. }, duration);
  1985. };
  1986. return filter;
  1987. }
  1988. function throttleFilter(ms, trailing = true, leading = true) {
  1989. let lastExec = 0;
  1990. let timer;
  1991. let preventLeading = !leading;
  1992. const clear = () => {
  1993. if (timer) {
  1994. clearTimeout(timer);
  1995. timer = void 0;
  1996. }
  1997. };
  1998. const filter = (invoke) => {
  1999. const duration = unref(ms);
  2000. const elapsed = Date.now() - lastExec;
  2001. clear();
  2002. if (duration <= 0) {
  2003. lastExec = Date.now();
  2004. return invoke();
  2005. }
  2006. if (elapsed > duration) {
  2007. lastExec = Date.now();
  2008. if (preventLeading)
  2009. preventLeading = false;
  2010. else
  2011. invoke();
  2012. }
  2013. if (trailing) {
  2014. timer = setTimeout(() => {
  2015. lastExec = Date.now();
  2016. if (!leading)
  2017. preventLeading = true;
  2018. clear();
  2019. invoke();
  2020. }, duration);
  2021. }
  2022. if (!leading && !timer)
  2023. timer = setTimeout(() => preventLeading = true, duration);
  2024. };
  2025. return filter;
  2026. }
  2027. function useDebounceFn(fn2, ms = 200, options = {}) {
  2028. return createFilterWrapper(debounceFilter(ms, options), fn2);
  2029. }
  2030. function refDebounced(value, ms = 200, options = {}) {
  2031. if (ms <= 0)
  2032. return value;
  2033. const debounced = ref(value.value);
  2034. const updater = useDebounceFn(() => {
  2035. debounced.value = value.value;
  2036. }, ms, options);
  2037. watch(value, () => updater());
  2038. return debounced;
  2039. }
  2040. function useThrottleFn(fn2, ms = 200, trailing = true, leading = true) {
  2041. return createFilterWrapper(throttleFilter(ms, trailing, leading), fn2);
  2042. }
  2043. function useTimeoutFn(cb, interval, options = {}) {
  2044. const {
  2045. immediate = true
  2046. } = options;
  2047. const isPending = ref(false);
  2048. let timer = null;
  2049. function clear() {
  2050. if (timer) {
  2051. clearTimeout(timer);
  2052. timer = null;
  2053. }
  2054. }
  2055. function stop() {
  2056. isPending.value = false;
  2057. clear();
  2058. }
  2059. function start2(...args) {
  2060. clear();
  2061. isPending.value = true;
  2062. timer = setTimeout(() => {
  2063. isPending.value = false;
  2064. timer = null;
  2065. cb(...args);
  2066. }, unref(interval));
  2067. }
  2068. if (immediate) {
  2069. isPending.value = true;
  2070. if (isClient)
  2071. start2();
  2072. }
  2073. tryOnScopeDispose(stop);
  2074. return {
  2075. isPending,
  2076. start: start2,
  2077. stop
  2078. };
  2079. }
  2080. function unrefElement(elRef) {
  2081. var _a2;
  2082. const plain = unref(elRef);
  2083. return (_a2 = plain == null ? void 0 : plain.$el) != null ? _a2 : plain;
  2084. }
  2085. const defaultWindow = isClient ? window : void 0;
  2086. isClient ? window.document : void 0;
  2087. isClient ? window.navigator : void 0;
  2088. isClient ? window.location : void 0;
  2089. function useEventListener(...args) {
  2090. let target;
  2091. let event;
  2092. let listener;
  2093. let options;
  2094. if (isString$1(args[0])) {
  2095. [event, listener, options] = args;
  2096. target = defaultWindow;
  2097. } else {
  2098. [target, event, listener, options] = args;
  2099. }
  2100. if (!target)
  2101. return noop;
  2102. let cleanup = noop;
  2103. const stopWatch = watch(() => unrefElement(target), (el) => {
  2104. cleanup();
  2105. if (!el)
  2106. return;
  2107. el.addEventListener(event, listener, options);
  2108. cleanup = () => {
  2109. el.removeEventListener(event, listener, options);
  2110. cleanup = noop;
  2111. };
  2112. }, { immediate: true, flush: "post" });
  2113. const stop = () => {
  2114. stopWatch();
  2115. cleanup();
  2116. };
  2117. tryOnScopeDispose(stop);
  2118. return stop;
  2119. }
  2120. function onClickOutside(target, handler3, options = {}) {
  2121. const { window: window2 = defaultWindow, ignore, capture = true } = options;
  2122. if (!window2)
  2123. return;
  2124. const shouldListen = ref(true);
  2125. const listener = (event) => {
  2126. const el = unrefElement(target);
  2127. const composedPath = event.composedPath();
  2128. if (!el || el === event.target || composedPath.includes(el) || !shouldListen.value)
  2129. return;
  2130. if (ignore && ignore.length > 0) {
  2131. if (ignore.some((target2) => {
  2132. const el2 = unrefElement(target2);
  2133. return el2 && (event.target === el2 || composedPath.includes(el2));
  2134. }))
  2135. return;
  2136. }
  2137. handler3(event);
  2138. };
  2139. const cleanup = [
  2140. useEventListener(window2, "click", listener, { passive: true, capture }),
  2141. useEventListener(window2, "pointerdown", (e) => {
  2142. const el = unrefElement(target);
  2143. shouldListen.value = !!el && !e.composedPath().includes(el);
  2144. }, { passive: true })
  2145. ];
  2146. const stop = () => cleanup.forEach((fn2) => fn2());
  2147. return stop;
  2148. }
  2149. const _global = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
  2150. const globalKey = "__vueuse_ssr_handlers__";
  2151. _global[globalKey] = _global[globalKey] || {};
  2152. _global[globalKey];
  2153. var __getOwnPropSymbols$c = Object.getOwnPropertySymbols;
  2154. var __hasOwnProp$c = Object.prototype.hasOwnProperty;
  2155. var __propIsEnum$c = Object.prototype.propertyIsEnumerable;
  2156. var __objRest$2 = (source, exclude) => {
  2157. var target = {};
  2158. for (var prop in source)
  2159. if (__hasOwnProp$c.call(source, prop) && exclude.indexOf(prop) < 0)
  2160. target[prop] = source[prop];
  2161. if (source != null && __getOwnPropSymbols$c)
  2162. for (var prop of __getOwnPropSymbols$c(source)) {
  2163. if (exclude.indexOf(prop) < 0 && __propIsEnum$c.call(source, prop))
  2164. target[prop] = source[prop];
  2165. }
  2166. return target;
  2167. };
  2168. function useResizeObserver(target, callback, options = {}) {
  2169. const _a2 = options, { window: window2 = defaultWindow } = _a2, observerOptions = __objRest$2(_a2, ["window"]);
  2170. let observer;
  2171. const isSupported = window2 && "ResizeObserver" in window2;
  2172. const cleanup = () => {
  2173. if (observer) {
  2174. observer.disconnect();
  2175. observer = void 0;
  2176. }
  2177. };
  2178. const stopWatch = watch(() => unrefElement(target), (el) => {
  2179. cleanup();
  2180. if (isSupported && window2 && el) {
  2181. observer = new ResizeObserver(callback);
  2182. observer.observe(el, observerOptions);
  2183. }
  2184. }, { immediate: true, flush: "post" });
  2185. const stop = () => {
  2186. cleanup();
  2187. stopWatch();
  2188. };
  2189. tryOnScopeDispose(stop);
  2190. return {
  2191. isSupported,
  2192. stop
  2193. };
  2194. }
  2195. var _a, _b;
  2196. isClient && (window == null ? void 0 : window.navigator) && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.platform) && /iP(ad|hone|od)/.test((_b = window == null ? void 0 : window.navigator) == null ? void 0 : _b.platform);
  2197. function useVModel(props, key, emit, options = {}) {
  2198. var _a2;
  2199. const {
  2200. passive: passive2 = false,
  2201. eventName,
  2202. deep = false
  2203. } = options;
  2204. const vm = getCurrentInstance();
  2205. const _emit = emit || (vm == null ? void 0 : vm.emit) || ((_a2 = vm == null ? void 0 : vm.$emit) == null ? void 0 : _a2.bind(vm));
  2206. let event = eventName;
  2207. if (!key) {
  2208. {
  2209. key = "modelValue";
  2210. }
  2211. }
  2212. event = eventName || event || `update:${key}`;
  2213. if (passive2) {
  2214. const proxy = ref(props[key]);
  2215. watch(() => props[key], (v2) => proxy.value = v2);
  2216. watch(proxy, (v2) => {
  2217. if (v2 !== props[key] || deep)
  2218. _emit(event, v2);
  2219. }, {
  2220. deep
  2221. });
  2222. return proxy;
  2223. } else {
  2224. return computed({
  2225. get() {
  2226. return props[key];
  2227. },
  2228. set(value) {
  2229. _emit(event, value);
  2230. }
  2231. });
  2232. }
  2233. }
  2234. const isInContainer = (el, container) => {
  2235. if (!isClient || !el || !container)
  2236. return false;
  2237. const elRect = el.getBoundingClientRect();
  2238. let containerRect;
  2239. if (container instanceof Element) {
  2240. containerRect = container.getBoundingClientRect();
  2241. } else {
  2242. containerRect = {
  2243. top: 0,
  2244. right: window.innerWidth,
  2245. bottom: window.innerHeight,
  2246. left: 0
  2247. };
  2248. }
  2249. return elRect.top < containerRect.bottom && elRect.bottom > containerRect.top && elRect.right > containerRect.left && elRect.left < containerRect.right;
  2250. };
  2251. const resizeHandler = function(entries) {
  2252. for (const entry of entries) {
  2253. const listeners = entry.target.__resizeListeners__ || [];
  2254. if (listeners.length) {
  2255. listeners.forEach((fn2) => {
  2256. fn2();
  2257. });
  2258. }
  2259. }
  2260. };
  2261. const addResizeListener = function(element, fn2) {
  2262. if (!isClient || !element)
  2263. return;
  2264. if (!element.__resizeListeners__) {
  2265. element.__resizeListeners__ = [];
  2266. element.__ro__ = new ResizeObserver(resizeHandler);
  2267. element.__ro__.observe(element);
  2268. }
  2269. element.__resizeListeners__.push(fn2);
  2270. };
  2271. const removeResizeListener = function(element, fn2) {
  2272. var _a2;
  2273. if (!element || !element.__resizeListeners__)
  2274. return;
  2275. element.__resizeListeners__.splice(element.__resizeListeners__.indexOf(fn2), 1);
  2276. if (!element.__resizeListeners__.length) {
  2277. (_a2 = element.__ro__) == null ? void 0 : _a2.disconnect();
  2278. }
  2279. };
  2280. const NOOP = () => {
  2281. };
  2282. const hasOwnProperty = Object.prototype.hasOwnProperty;
  2283. const hasOwn = (val, key) => hasOwnProperty.call(val, key);
  2284. const isArray = Array.isArray;
  2285. const isFunction = (val) => typeof val === "function";
  2286. const isString = (val) => typeof val === "string";
  2287. const isObject$1 = (val) => val !== null && typeof val === "object";
  2288. const isPromise = (val) => {
  2289. return isObject$1(val) && isFunction(val.then) && isFunction(val.catch);
  2290. };
  2291. const objectToString = Object.prototype.toString;
  2292. const toTypeString = (value) => objectToString.call(value);
  2293. const toRawType = (value) => {
  2294. return toTypeString(value).slice(8, -1);
  2295. };
  2296. const cacheStringFunction = (fn2) => {
  2297. const cache = /* @__PURE__ */ Object.create(null);
  2298. return (str) => {
  2299. const hit = cache[str];
  2300. return hit || (cache[str] = fn2(str));
  2301. };
  2302. };
  2303. const camelizeRE = /-(\w)/g;
  2304. const camelize = cacheStringFunction((str) => {
  2305. return str.replace(camelizeRE, (_2, c2) => c2 ? c2.toUpperCase() : "");
  2306. });
  2307. const capitalize = cacheStringFunction((str) => str.charAt(0).toUpperCase() + str.slice(1));
  2308. const isUndefined = (val) => val === void 0;
  2309. const isEmpty = (val) => !val && val !== 0 || isArray(val) && val.length === 0 || isObject$1(val) && !Object.keys(val).length;
  2310. const isElement$1 = (e) => {
  2311. if (typeof Element === "undefined")
  2312. return false;
  2313. return e instanceof Element;
  2314. };
  2315. const escapeStringRegexp = (string3 = "") => string3.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
  2316. const keysOf = (arr) => Object.keys(arr);
  2317. const entriesOf = (arr) => Object.entries(arr);
  2318. const getProp = (obj, path, defaultValue) => {
  2319. return {
  2320. get value() {
  2321. return get(obj, path, defaultValue);
  2322. },
  2323. set value(val) {
  2324. set(obj, path, val);
  2325. }
  2326. };
  2327. };
  2328. const classNameToArray = (cls = "") => cls.split(" ").filter((item) => !!item.trim());
  2329. const hasClass = (el, cls) => {
  2330. if (!el || !cls)
  2331. return false;
  2332. if (cls.includes(" "))
  2333. throw new Error("className should not contain space.");
  2334. return el.classList.contains(cls);
  2335. };
  2336. const addClass = (el, cls) => {
  2337. if (!el || !cls.trim())
  2338. return;
  2339. el.classList.add(...classNameToArray(cls));
  2340. };
  2341. const removeClass = (el, cls) => {
  2342. if (!el || !cls.trim())
  2343. return;
  2344. el.classList.remove(...classNameToArray(cls));
  2345. };
  2346. const getStyle = (element, styleName) => {
  2347. var _a2;
  2348. if (!isClient || !element || !styleName)
  2349. return "";
  2350. camelize(styleName);
  2351. try {
  2352. const style = element.style[styleName];
  2353. if (style)
  2354. return style;
  2355. const computed2 = (_a2 = document.defaultView) == null ? void 0 : _a2.getComputedStyle(element, "");
  2356. return computed2 ? computed2[styleName] : "";
  2357. } catch (e) {
  2358. return element.style[styleName];
  2359. }
  2360. };
  2361. const isScroll = (el, isVertical) => {
  2362. if (!isClient)
  2363. return false;
  2364. const key = {
  2365. undefined: "overflow",
  2366. true: "overflow-y",
  2367. false: "overflow-x"
  2368. }[String(isVertical)];
  2369. const overflow = getStyle(el, key);
  2370. return ["scroll", "auto", "overlay"].some((s2) => overflow.includes(s2));
  2371. };
  2372. const getScrollContainer = (el, isVertical) => {
  2373. if (!isClient)
  2374. return;
  2375. let parent = el;
  2376. while (parent) {
  2377. if ([window, document, document.documentElement].includes(parent))
  2378. return window;
  2379. if (isScroll(parent, isVertical))
  2380. return parent;
  2381. parent = parent.parentNode;
  2382. }
  2383. return parent;
  2384. };
  2385. let scrollBarWidth;
  2386. const getScrollBarWidth = () => {
  2387. var _a2;
  2388. if (!isClient)
  2389. return 0;
  2390. if (scrollBarWidth !== void 0)
  2391. return scrollBarWidth;
  2392. const outer = document.createElement("div");
  2393. outer.className = "el-scrollbar__wrap";
  2394. outer.style.visibility = "hidden";
  2395. outer.style.width = "100px";
  2396. outer.style.position = "absolute";
  2397. outer.style.top = "-9999px";
  2398. document.body.appendChild(outer);
  2399. const widthNoScroll = outer.offsetWidth;
  2400. outer.style.overflow = "scroll";
  2401. const inner = document.createElement("div");
  2402. inner.style.width = "100%";
  2403. outer.appendChild(inner);
  2404. const widthWithScroll = inner.offsetWidth;
  2405. (_a2 = outer.parentNode) == null ? void 0 : _a2.removeChild(outer);
  2406. scrollBarWidth = widthNoScroll - widthWithScroll;
  2407. return scrollBarWidth;
  2408. };
  2409. function scrollIntoView(container, selected) {
  2410. if (!isClient)
  2411. return;
  2412. if (!selected) {
  2413. container.scrollTop = 0;
  2414. return;
  2415. }
  2416. const offsetParents = [];
  2417. let pointer = selected.offsetParent;
  2418. while (pointer !== null && container !== pointer && container.contains(pointer)) {
  2419. offsetParents.push(pointer);
  2420. pointer = pointer.offsetParent;
  2421. }
  2422. const top2 = selected.offsetTop + offsetParents.reduce((prev, curr) => prev + curr.offsetTop, 0);
  2423. const bottom2 = top2 + selected.offsetHeight;
  2424. const viewRectTop = container.scrollTop;
  2425. const viewRectBottom = viewRectTop + container.clientHeight;
  2426. if (top2 < viewRectTop) {
  2427. container.scrollTop = top2;
  2428. } else if (bottom2 > viewRectBottom) {
  2429. container.scrollTop = bottom2 - container.clientHeight;
  2430. }
  2431. }
  2432. var _export_sfc$2 = (sfc, props) => {
  2433. const target = sfc.__vccOpts || sfc;
  2434. for (const [key, val] of props) {
  2435. target[key] = val;
  2436. }
  2437. return target;
  2438. };
  2439. const _sfc_main$1y = defineComponent({
  2440. name: "ArrowDown"
  2441. });
  2442. const _hoisted_1$13 = {
  2443. viewBox: "0 0 1024 1024",
  2444. xmlns: "http://www.w3.org/2000/svg"
  2445. };
  2446. const _hoisted_2$W = /* @__PURE__ */ createElementVNode("path", {
  2447. fill: "currentColor",
  2448. d: "M831.872 340.864 512 652.672 192.128 340.864a30.592 30.592 0 0 0-42.752 0 29.12 29.12 0 0 0 0 41.6L489.664 714.24a32 32 0 0 0 44.672 0l340.288-331.712a29.12 29.12 0 0 0 0-41.728 30.592 30.592 0 0 0-42.752 0z"
  2449. }, null, -1);
  2450. const _hoisted_3$J = [
  2451. _hoisted_2$W
  2452. ];
  2453. function _sfc_render$13(_ctx, _cache, $props, $setup, $data, $options) {
  2454. return openBlock(), createElementBlock("svg", _hoisted_1$13, _hoisted_3$J);
  2455. }
  2456. var arrowDown = /* @__PURE__ */ _export_sfc$2(_sfc_main$1y, [["render", _sfc_render$13]]);
  2457. const _sfc_main$1x = defineComponent({
  2458. name: "ArrowLeft"
  2459. });
  2460. const _hoisted_1$12 = {
  2461. viewBox: "0 0 1024 1024",
  2462. xmlns: "http://www.w3.org/2000/svg"
  2463. };
  2464. const _hoisted_2$V = /* @__PURE__ */ createElementVNode("path", {
  2465. fill: "currentColor",
  2466. d: "M609.408 149.376 277.76 489.6a32 32 0 0 0 0 44.672l331.648 340.352a29.12 29.12 0 0 0 41.728 0 30.592 30.592 0 0 0 0-42.752L339.264 511.936l311.872-319.872a30.592 30.592 0 0 0 0-42.688 29.12 29.12 0 0 0-41.728 0z"
  2467. }, null, -1);
  2468. const _hoisted_3$I = [
  2469. _hoisted_2$V
  2470. ];
  2471. function _sfc_render$12(_ctx, _cache, $props, $setup, $data, $options) {
  2472. return openBlock(), createElementBlock("svg", _hoisted_1$12, _hoisted_3$I);
  2473. }
  2474. var arrowLeft = /* @__PURE__ */ _export_sfc$2(_sfc_main$1x, [["render", _sfc_render$12]]);
  2475. const _sfc_main$1w = defineComponent({
  2476. name: "ArrowRight"
  2477. });
  2478. const _hoisted_1$11 = {
  2479. viewBox: "0 0 1024 1024",
  2480. xmlns: "http://www.w3.org/2000/svg"
  2481. };
  2482. const _hoisted_2$U = /* @__PURE__ */ createElementVNode("path", {
  2483. fill: "currentColor",
  2484. d: "M340.864 149.312a30.592 30.592 0 0 0 0 42.752L652.736 512 340.864 831.872a30.592 30.592 0 0 0 0 42.752 29.12 29.12 0 0 0 41.728 0L714.24 534.336a32 32 0 0 0 0-44.672L382.592 149.376a29.12 29.12 0 0 0-41.728 0z"
  2485. }, null, -1);
  2486. const _hoisted_3$H = [
  2487. _hoisted_2$U
  2488. ];
  2489. function _sfc_render$11(_ctx, _cache, $props, $setup, $data, $options) {
  2490. return openBlock(), createElementBlock("svg", _hoisted_1$11, _hoisted_3$H);
  2491. }
  2492. var arrowRight = /* @__PURE__ */ _export_sfc$2(_sfc_main$1w, [["render", _sfc_render$11]]);
  2493. const _sfc_main$1v = defineComponent({
  2494. name: "ArrowUp"
  2495. });
  2496. const _hoisted_1$10 = {
  2497. viewBox: "0 0 1024 1024",
  2498. xmlns: "http://www.w3.org/2000/svg"
  2499. };
  2500. const _hoisted_2$T = /* @__PURE__ */ createElementVNode("path", {
  2501. fill: "currentColor",
  2502. d: "m488.832 344.32-339.84 356.672a32 32 0 0 0 0 44.16l.384.384a29.44 29.44 0 0 0 42.688 0l320-335.872 319.872 335.872a29.44 29.44 0 0 0 42.688 0l.384-.384a32 32 0 0 0 0-44.16L535.168 344.32a32 32 0 0 0-46.336 0z"
  2503. }, null, -1);
  2504. const _hoisted_3$G = [
  2505. _hoisted_2$T
  2506. ];
  2507. function _sfc_render$10(_ctx, _cache, $props, $setup, $data, $options) {
  2508. return openBlock(), createElementBlock("svg", _hoisted_1$10, _hoisted_3$G);
  2509. }
  2510. var arrowUp = /* @__PURE__ */ _export_sfc$2(_sfc_main$1v, [["render", _sfc_render$10]]);
  2511. const _sfc_main$1u = defineComponent({
  2512. name: "Calendar"
  2513. });
  2514. const _hoisted_1$$ = {
  2515. viewBox: "0 0 1024 1024",
  2516. xmlns: "http://www.w3.org/2000/svg"
  2517. };
  2518. const _hoisted_2$S = /* @__PURE__ */ createElementVNode("path", {
  2519. fill: "currentColor",
  2520. d: "M128 384v512h768V192H768v32a32 32 0 1 1-64 0v-32H320v32a32 32 0 0 1-64 0v-32H128v128h768v64H128zm192-256h384V96a32 32 0 1 1 64 0v32h160a32 32 0 0 1 32 32v768a32 32 0 0 1-32 32H96a32 32 0 0 1-32-32V160a32 32 0 0 1 32-32h160V96a32 32 0 0 1 64 0v32zm-32 384h64a32 32 0 0 1 0 64h-64a32 32 0 0 1 0-64zm0 192h64a32 32 0 1 1 0 64h-64a32 32 0 1 1 0-64zm192-192h64a32 32 0 0 1 0 64h-64a32 32 0 0 1 0-64zm0 192h64a32 32 0 1 1 0 64h-64a32 32 0 1 1 0-64zm192-192h64a32 32 0 1 1 0 64h-64a32 32 0 1 1 0-64zm0 192h64a32 32 0 1 1 0 64h-64a32 32 0 1 1 0-64z"
  2521. }, null, -1);
  2522. const _hoisted_3$F = [
  2523. _hoisted_2$S
  2524. ];
  2525. function _sfc_render$$(_ctx, _cache, $props, $setup, $data, $options) {
  2526. return openBlock(), createElementBlock("svg", _hoisted_1$$, _hoisted_3$F);
  2527. }
  2528. var calendar = /* @__PURE__ */ _export_sfc$2(_sfc_main$1u, [["render", _sfc_render$$]]);
  2529. const _sfc_main$1t = defineComponent({
  2530. name: "Check"
  2531. });
  2532. const _hoisted_1$_ = {
  2533. viewBox: "0 0 1024 1024",
  2534. xmlns: "http://www.w3.org/2000/svg"
  2535. };
  2536. const _hoisted_2$R = /* @__PURE__ */ createElementVNode("path", {
  2537. fill: "currentColor",
  2538. d: "M406.656 706.944 195.84 496.256a32 32 0 1 0-45.248 45.248l256 256 512-512a32 32 0 0 0-45.248-45.248L406.592 706.944z"
  2539. }, null, -1);
  2540. const _hoisted_3$E = [
  2541. _hoisted_2$R
  2542. ];
  2543. function _sfc_render$_(_ctx, _cache, $props, $setup, $data, $options) {
  2544. return openBlock(), createElementBlock("svg", _hoisted_1$_, _hoisted_3$E);
  2545. }
  2546. var check = /* @__PURE__ */ _export_sfc$2(_sfc_main$1t, [["render", _sfc_render$_]]);
  2547. const _sfc_main$1s = defineComponent({
  2548. name: "CircleCheck"
  2549. });
  2550. const _hoisted_1$Z = {
  2551. viewBox: "0 0 1024 1024",
  2552. xmlns: "http://www.w3.org/2000/svg"
  2553. };
  2554. const _hoisted_2$Q = /* @__PURE__ */ createElementVNode("path", {
  2555. fill: "currentColor",
  2556. d: "M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768zm0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896z"
  2557. }, null, -1);
  2558. const _hoisted_3$D = /* @__PURE__ */ createElementVNode("path", {
  2559. fill: "currentColor",
  2560. d: "M745.344 361.344a32 32 0 0 1 45.312 45.312l-288 288a32 32 0 0 1-45.312 0l-160-160a32 32 0 1 1 45.312-45.312L480 626.752l265.344-265.408z"
  2561. }, null, -1);
  2562. const _hoisted_4$i = [
  2563. _hoisted_2$Q,
  2564. _hoisted_3$D
  2565. ];
  2566. function _sfc_render$Z(_ctx, _cache, $props, $setup, $data, $options) {
  2567. return openBlock(), createElementBlock("svg", _hoisted_1$Z, _hoisted_4$i);
  2568. }
  2569. var circleCheck = /* @__PURE__ */ _export_sfc$2(_sfc_main$1s, [["render", _sfc_render$Z]]);
  2570. const _sfc_main$1r = defineComponent({
  2571. name: "CircleClose"
  2572. });
  2573. const _hoisted_1$Y = {
  2574. viewBox: "0 0 1024 1024",
  2575. xmlns: "http://www.w3.org/2000/svg"
  2576. };
  2577. const _hoisted_2$P = /* @__PURE__ */ createElementVNode("path", {
  2578. fill: "currentColor",
  2579. d: "m466.752 512-90.496-90.496a32 32 0 0 1 45.248-45.248L512 466.752l90.496-90.496a32 32 0 1 1 45.248 45.248L557.248 512l90.496 90.496a32 32 0 1 1-45.248 45.248L512 557.248l-90.496 90.496a32 32 0 0 1-45.248-45.248L466.752 512z"
  2580. }, null, -1);
  2581. const _hoisted_3$C = /* @__PURE__ */ createElementVNode("path", {
  2582. fill: "currentColor",
  2583. d: "M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768zm0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896z"
  2584. }, null, -1);
  2585. const _hoisted_4$h = [
  2586. _hoisted_2$P,
  2587. _hoisted_3$C
  2588. ];
  2589. function _sfc_render$Y(_ctx, _cache, $props, $setup, $data, $options) {
  2590. return openBlock(), createElementBlock("svg", _hoisted_1$Y, _hoisted_4$h);
  2591. }
  2592. var circleClose = /* @__PURE__ */ _export_sfc$2(_sfc_main$1r, [["render", _sfc_render$Y]]);
  2593. const _sfc_main$1q = defineComponent({
  2594. name: "Clock"
  2595. });
  2596. const _hoisted_1$X = {
  2597. viewBox: "0 0 1024 1024",
  2598. xmlns: "http://www.w3.org/2000/svg"
  2599. };
  2600. const _hoisted_2$O = /* @__PURE__ */ createElementVNode("path", {
  2601. fill: "currentColor",
  2602. d: "M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768zm0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896z"
  2603. }, null, -1);
  2604. const _hoisted_3$B = /* @__PURE__ */ createElementVNode("path", {
  2605. fill: "currentColor",
  2606. d: "M480 256a32 32 0 0 1 32 32v256a32 32 0 0 1-64 0V288a32 32 0 0 1 32-32z"
  2607. }, null, -1);
  2608. const _hoisted_4$g = /* @__PURE__ */ createElementVNode("path", {
  2609. fill: "currentColor",
  2610. d: "M480 512h256q32 0 32 32t-32 32H480q-32 0-32-32t32-32z"
  2611. }, null, -1);
  2612. const _hoisted_5$d = [
  2613. _hoisted_2$O,
  2614. _hoisted_3$B,
  2615. _hoisted_4$g
  2616. ];
  2617. function _sfc_render$X(_ctx, _cache, $props, $setup, $data, $options) {
  2618. return openBlock(), createElementBlock("svg", _hoisted_1$X, _hoisted_5$d);
  2619. }
  2620. var clock = /* @__PURE__ */ _export_sfc$2(_sfc_main$1q, [["render", _sfc_render$X]]);
  2621. const _sfc_main$1p = defineComponent({
  2622. name: "Close"
  2623. });
  2624. const _hoisted_1$W = {
  2625. viewBox: "0 0 1024 1024",
  2626. xmlns: "http://www.w3.org/2000/svg"
  2627. };
  2628. const _hoisted_2$N = /* @__PURE__ */ createElementVNode("path", {
  2629. fill: "currentColor",
  2630. d: "M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"
  2631. }, null, -1);
  2632. const _hoisted_3$A = [
  2633. _hoisted_2$N
  2634. ];
  2635. function _sfc_render$W(_ctx, _cache, $props, $setup, $data, $options) {
  2636. return openBlock(), createElementBlock("svg", _hoisted_1$W, _hoisted_3$A);
  2637. }
  2638. var close = /* @__PURE__ */ _export_sfc$2(_sfc_main$1p, [["render", _sfc_render$W]]);
  2639. const _sfc_main$1o = defineComponent({
  2640. name: "DArrowLeft"
  2641. });
  2642. const _hoisted_1$V = {
  2643. viewBox: "0 0 1024 1024",
  2644. xmlns: "http://www.w3.org/2000/svg"
  2645. };
  2646. const _hoisted_2$M = /* @__PURE__ */ createElementVNode("path", {
  2647. fill: "currentColor",
  2648. d: "M529.408 149.376a29.12 29.12 0 0 1 41.728 0 30.592 30.592 0 0 1 0 42.688L259.264 511.936l311.872 319.936a30.592 30.592 0 0 1-.512 43.264 29.12 29.12 0 0 1-41.216-.512L197.76 534.272a32 32 0 0 1 0-44.672l331.648-340.224zm256 0a29.12 29.12 0 0 1 41.728 0 30.592 30.592 0 0 1 0 42.688L515.264 511.936l311.872 319.936a30.592 30.592 0 0 1-.512 43.264 29.12 29.12 0 0 1-41.216-.512L453.76 534.272a32 32 0 0 1 0-44.672l331.648-340.224z"
  2649. }, null, -1);
  2650. const _hoisted_3$z = [
  2651. _hoisted_2$M
  2652. ];
  2653. function _sfc_render$V(_ctx, _cache, $props, $setup, $data, $options) {
  2654. return openBlock(), createElementBlock("svg", _hoisted_1$V, _hoisted_3$z);
  2655. }
  2656. var dArrowLeft = /* @__PURE__ */ _export_sfc$2(_sfc_main$1o, [["render", _sfc_render$V]]);
  2657. const _sfc_main$1n = defineComponent({
  2658. name: "DArrowRight"
  2659. });
  2660. const _hoisted_1$U = {
  2661. viewBox: "0 0 1024 1024",
  2662. xmlns: "http://www.w3.org/2000/svg"
  2663. };
  2664. const _hoisted_2$L = /* @__PURE__ */ createElementVNode("path", {
  2665. fill: "currentColor",
  2666. d: "M452.864 149.312a29.12 29.12 0 0 1 41.728.064L826.24 489.664a32 32 0 0 1 0 44.672L494.592 874.624a29.12 29.12 0 0 1-41.728 0 30.592 30.592 0 0 1 0-42.752L764.736 512 452.864 192a30.592 30.592 0 0 1 0-42.688zm-256 0a29.12 29.12 0 0 1 41.728.064L570.24 489.664a32 32 0 0 1 0 44.672L238.592 874.624a29.12 29.12 0 0 1-41.728 0 30.592 30.592 0 0 1 0-42.752L508.736 512 196.864 192a30.592 30.592 0 0 1 0-42.688z"
  2667. }, null, -1);
  2668. const _hoisted_3$y = [
  2669. _hoisted_2$L
  2670. ];
  2671. function _sfc_render$U(_ctx, _cache, $props, $setup, $data, $options) {
  2672. return openBlock(), createElementBlock("svg", _hoisted_1$U, _hoisted_3$y);
  2673. }
  2674. var dArrowRight = /* @__PURE__ */ _export_sfc$2(_sfc_main$1n, [["render", _sfc_render$U]]);
  2675. const _sfc_main$1m = defineComponent({
  2676. name: "Delete"
  2677. });
  2678. const _hoisted_1$T = {
  2679. viewBox: "0 0 1024 1024",
  2680. xmlns: "http://www.w3.org/2000/svg"
  2681. };
  2682. const _hoisted_2$K = /* @__PURE__ */ createElementVNode("path", {
  2683. fill: "currentColor",
  2684. d: "M160 256H96a32 32 0 0 1 0-64h256V95.936a32 32 0 0 1 32-32h256a32 32 0 0 1 32 32V192h256a32 32 0 1 1 0 64h-64v672a32 32 0 0 1-32 32H192a32 32 0 0 1-32-32V256zm448-64v-64H416v64h192zM224 896h576V256H224v640zm192-128a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32zm192 0a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32z"
  2685. }, null, -1);
  2686. const _hoisted_3$x = [
  2687. _hoisted_2$K
  2688. ];
  2689. function _sfc_render$T(_ctx, _cache, $props, $setup, $data, $options) {
  2690. return openBlock(), createElementBlock("svg", _hoisted_1$T, _hoisted_3$x);
  2691. }
  2692. var _delete = /* @__PURE__ */ _export_sfc$2(_sfc_main$1m, [["render", _sfc_render$T]]);
  2693. const _sfc_main$1l = defineComponent({
  2694. name: "Document"
  2695. });
  2696. const _hoisted_1$S = {
  2697. viewBox: "0 0 1024 1024",
  2698. xmlns: "http://www.w3.org/2000/svg"
  2699. };
  2700. const _hoisted_2$J = /* @__PURE__ */ createElementVNode("path", {
  2701. fill: "currentColor",
  2702. d: "M832 384H576V128H192v768h640V384zm-26.496-64L640 154.496V320h165.504zM160 64h480l256 256v608a32 32 0 0 1-32 32H160a32 32 0 0 1-32-32V96a32 32 0 0 1 32-32zm160 448h384v64H320v-64zm0-192h160v64H320v-64zm0 384h384v64H320v-64z"
  2703. }, null, -1);
  2704. const _hoisted_3$w = [
  2705. _hoisted_2$J
  2706. ];
  2707. function _sfc_render$S(_ctx, _cache, $props, $setup, $data, $options) {
  2708. return openBlock(), createElementBlock("svg", _hoisted_1$S, _hoisted_3$w);
  2709. }
  2710. var document$1 = /* @__PURE__ */ _export_sfc$2(_sfc_main$1l, [["render", _sfc_render$S]]);
  2711. const _sfc_main$1k = defineComponent({
  2712. name: "FullScreen"
  2713. });
  2714. const _hoisted_1$R = {
  2715. viewBox: "0 0 1024 1024",
  2716. xmlns: "http://www.w3.org/2000/svg"
  2717. };
  2718. const _hoisted_2$I = /* @__PURE__ */ createElementVNode("path", {
  2719. fill: "currentColor",
  2720. d: "m160 96.064 192 .192a32 32 0 0 1 0 64l-192-.192V352a32 32 0 0 1-64 0V96h64v.064zm0 831.872V928H96V672a32 32 0 1 1 64 0v191.936l192-.192a32 32 0 1 1 0 64l-192 .192zM864 96.064V96h64v256a32 32 0 1 1-64 0V160.064l-192 .192a32 32 0 1 1 0-64l192-.192zm0 831.872-192-.192a32 32 0 0 1 0-64l192 .192V672a32 32 0 1 1 64 0v256h-64v-.064z"
  2721. }, null, -1);
  2722. const _hoisted_3$v = [
  2723. _hoisted_2$I
  2724. ];
  2725. function _sfc_render$R(_ctx, _cache, $props, $setup, $data, $options) {
  2726. return openBlock(), createElementBlock("svg", _hoisted_1$R, _hoisted_3$v);
  2727. }
  2728. var fullScreen = /* @__PURE__ */ _export_sfc$2(_sfc_main$1k, [["render", _sfc_render$R]]);
  2729. const _sfc_main$1j = defineComponent({
  2730. name: "Hide"
  2731. });
  2732. const _hoisted_1$Q = {
  2733. viewBox: "0 0 1024 1024",
  2734. xmlns: "http://www.w3.org/2000/svg"
  2735. };
  2736. const _hoisted_2$H = /* @__PURE__ */ createElementVNode("path", {
  2737. d: "M876.8 156.8c0-9.6-3.2-16-9.6-22.4-6.4-6.4-12.8-9.6-22.4-9.6-9.6 0-16 3.2-22.4 9.6L736 220.8c-64-32-137.6-51.2-224-60.8-160 16-288 73.6-377.6 176C44.8 438.4 0 496 0 512s48 73.6 134.4 176c22.4 25.6 44.8 48 73.6 67.2l-86.4 89.6c-6.4 6.4-9.6 12.8-9.6 22.4 0 9.6 3.2 16 9.6 22.4 6.4 6.4 12.8 9.6 22.4 9.6 9.6 0 16-3.2 22.4-9.6l704-710.4c3.2-6.4 6.4-12.8 6.4-22.4Zm-646.4 528c-76.8-70.4-128-128-153.6-172.8 28.8-48 80-105.6 153.6-172.8C304 272 400 230.4 512 224c64 3.2 124.8 19.2 176 44.8l-54.4 54.4C598.4 300.8 560 288 512 288c-64 0-115.2 22.4-160 64s-64 96-64 160c0 48 12.8 89.6 35.2 124.8L256 707.2c-9.6-6.4-19.2-16-25.6-22.4Zm140.8-96c-12.8-22.4-19.2-48-19.2-76.8 0-44.8 16-83.2 48-112 32-28.8 67.2-48 112-48 28.8 0 54.4 6.4 73.6 19.2L371.2 588.8ZM889.599 336c-12.8-16-28.8-28.8-41.6-41.6l-48 48c73.6 67.2 124.8 124.8 150.4 169.6-28.8 48-80 105.6-153.6 172.8-73.6 67.2-172.8 108.8-284.8 115.2-51.2-3.2-99.2-12.8-140.8-28.8l-48 48c57.6 22.4 118.4 38.4 188.8 44.8 160-16 288-73.6 377.6-176C979.199 585.6 1024 528 1024 512s-48.001-73.6-134.401-176Z",
  2738. fill: "currentColor"
  2739. }, null, -1);
  2740. const _hoisted_3$u = /* @__PURE__ */ createElementVNode("path", {
  2741. d: "M511.998 672c-12.8 0-25.6-3.2-38.4-6.4l-51.2 51.2c28.8 12.8 57.6 19.2 89.6 19.2 64 0 115.2-22.4 160-64 41.6-41.6 64-96 64-160 0-32-6.4-64-19.2-89.6l-51.2 51.2c3.2 12.8 6.4 25.6 6.4 38.4 0 44.8-16 83.2-48 112-32 28.8-67.2 48-112 48Z",
  2742. fill: "currentColor"
  2743. }, null, -1);
  2744. const _hoisted_4$f = [
  2745. _hoisted_2$H,
  2746. _hoisted_3$u
  2747. ];
  2748. function _sfc_render$Q(_ctx, _cache, $props, $setup, $data, $options) {
  2749. return openBlock(), createElementBlock("svg", _hoisted_1$Q, _hoisted_4$f);
  2750. }
  2751. var hide$2 = /* @__PURE__ */ _export_sfc$2(_sfc_main$1j, [["render", _sfc_render$Q]]);
  2752. const _sfc_main$1i = defineComponent({
  2753. name: "Loading"
  2754. });
  2755. const _hoisted_1$P = {
  2756. viewBox: "0 0 1024 1024",
  2757. xmlns: "http://www.w3.org/2000/svg"
  2758. };
  2759. const _hoisted_2$G = /* @__PURE__ */ createElementVNode("path", {
  2760. fill: "currentColor",
  2761. d: "M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32zm0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32zm448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32zm-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32zM195.2 195.2a32 32 0 0 1 45.248 0L376.32 331.008a32 32 0 0 1-45.248 45.248L195.2 240.448a32 32 0 0 1 0-45.248zm452.544 452.544a32 32 0 0 1 45.248 0L828.8 783.552a32 32 0 0 1-45.248 45.248L647.744 692.992a32 32 0 0 1 0-45.248zM828.8 195.264a32 32 0 0 1 0 45.184L692.992 376.32a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0zm-452.544 452.48a32 32 0 0 1 0 45.248L240.448 828.8a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0z"
  2762. }, null, -1);
  2763. const _hoisted_3$t = [
  2764. _hoisted_2$G
  2765. ];
  2766. function _sfc_render$P(_ctx, _cache, $props, $setup, $data, $options) {
  2767. return openBlock(), createElementBlock("svg", _hoisted_1$P, _hoisted_3$t);
  2768. }
  2769. var loading = /* @__PURE__ */ _export_sfc$2(_sfc_main$1i, [["render", _sfc_render$P]]);
  2770. const _sfc_main$1h = defineComponent({
  2771. name: "Minus"
  2772. });
  2773. const _hoisted_1$O = {
  2774. viewBox: "0 0 1024 1024",
  2775. xmlns: "http://www.w3.org/2000/svg"
  2776. };
  2777. const _hoisted_2$F = /* @__PURE__ */ createElementVNode("path", {
  2778. fill: "currentColor",
  2779. d: "M128 544h768a32 32 0 1 0 0-64H128a32 32 0 0 0 0 64z"
  2780. }, null, -1);
  2781. const _hoisted_3$s = [
  2782. _hoisted_2$F
  2783. ];
  2784. function _sfc_render$O(_ctx, _cache, $props, $setup, $data, $options) {
  2785. return openBlock(), createElementBlock("svg", _hoisted_1$O, _hoisted_3$s);
  2786. }
  2787. var minus = /* @__PURE__ */ _export_sfc$2(_sfc_main$1h, [["render", _sfc_render$O]]);
  2788. const _sfc_main$1g = defineComponent({
  2789. name: "Plus"
  2790. });
  2791. const _hoisted_1$N = {
  2792. viewBox: "0 0 1024 1024",
  2793. xmlns: "http://www.w3.org/2000/svg"
  2794. };
  2795. const _hoisted_2$E = /* @__PURE__ */ createElementVNode("path", {
  2796. fill: "currentColor",
  2797. d: "M480 480V128a32 32 0 0 1 64 0v352h352a32 32 0 1 1 0 64H544v352a32 32 0 1 1-64 0V544H128a32 32 0 0 1 0-64h352z"
  2798. }, null, -1);
  2799. const _hoisted_3$r = [
  2800. _hoisted_2$E
  2801. ];
  2802. function _sfc_render$N(_ctx, _cache, $props, $setup, $data, $options) {
  2803. return openBlock(), createElementBlock("svg", _hoisted_1$N, _hoisted_3$r);
  2804. }
  2805. var plus = /* @__PURE__ */ _export_sfc$2(_sfc_main$1g, [["render", _sfc_render$N]]);
  2806. const _sfc_main$1f = defineComponent({
  2807. name: "RefreshLeft"
  2808. });
  2809. const _hoisted_1$M = {
  2810. viewBox: "0 0 1024 1024",
  2811. xmlns: "http://www.w3.org/2000/svg"
  2812. };
  2813. const _hoisted_2$D = /* @__PURE__ */ createElementVNode("path", {
  2814. fill: "currentColor",
  2815. d: "M289.088 296.704h92.992a32 32 0 0 1 0 64H232.96a32 32 0 0 1-32-32V179.712a32 32 0 0 1 64 0v50.56a384 384 0 0 1 643.84 282.88 384 384 0 0 1-383.936 384 384 384 0 0 1-384-384h64a320 320 0 1 0 640 0 320 320 0 0 0-555.712-216.448z"
  2816. }, null, -1);
  2817. const _hoisted_3$q = [
  2818. _hoisted_2$D
  2819. ];
  2820. function _sfc_render$M(_ctx, _cache, $props, $setup, $data, $options) {
  2821. return openBlock(), createElementBlock("svg", _hoisted_1$M, _hoisted_3$q);
  2822. }
  2823. var refreshLeft = /* @__PURE__ */ _export_sfc$2(_sfc_main$1f, [["render", _sfc_render$M]]);
  2824. const _sfc_main$1e = defineComponent({
  2825. name: "RefreshRight"
  2826. });
  2827. const _hoisted_1$L = {
  2828. viewBox: "0 0 1024 1024",
  2829. xmlns: "http://www.w3.org/2000/svg"
  2830. };
  2831. const _hoisted_2$C = /* @__PURE__ */ createElementVNode("path", {
  2832. fill: "currentColor",
  2833. d: "M784.512 230.272v-50.56a32 32 0 1 1 64 0v149.056a32 32 0 0 1-32 32H667.52a32 32 0 1 1 0-64h92.992A320 320 0 1 0 524.8 833.152a320 320 0 0 0 320-320h64a384 384 0 0 1-384 384 384 384 0 0 1-384-384 384 384 0 0 1 643.712-282.88z"
  2834. }, null, -1);
  2835. const _hoisted_3$p = [
  2836. _hoisted_2$C
  2837. ];
  2838. function _sfc_render$L(_ctx, _cache, $props, $setup, $data, $options) {
  2839. return openBlock(), createElementBlock("svg", _hoisted_1$L, _hoisted_3$p);
  2840. }
  2841. var refreshRight = /* @__PURE__ */ _export_sfc$2(_sfc_main$1e, [["render", _sfc_render$L]]);
  2842. const _sfc_main$1d = defineComponent({
  2843. name: "ScaleToOriginal"
  2844. });
  2845. const _hoisted_1$K = {
  2846. viewBox: "0 0 1024 1024",
  2847. xmlns: "http://www.w3.org/2000/svg"
  2848. };
  2849. const _hoisted_2$B = /* @__PURE__ */ createElementVNode("path", {
  2850. fill: "currentColor",
  2851. d: "M813.176 180.706a60.235 60.235 0 0 1 60.236 60.235v481.883a60.235 60.235 0 0 1-60.236 60.235H210.824a60.235 60.235 0 0 1-60.236-60.235V240.94a60.235 60.235 0 0 1 60.236-60.235h602.352zm0-60.235H210.824A120.47 120.47 0 0 0 90.353 240.94v481.883a120.47 120.47 0 0 0 120.47 120.47h602.353a120.47 120.47 0 0 0 120.471-120.47V240.94a120.47 120.47 0 0 0-120.47-120.47zm-120.47 180.705a30.118 30.118 0 0 0-30.118 30.118v301.177a30.118 30.118 0 0 0 60.236 0V331.294a30.118 30.118 0 0 0-30.118-30.118zm-361.412 0a30.118 30.118 0 0 0-30.118 30.118v301.177a30.118 30.118 0 1 0 60.236 0V331.294a30.118 30.118 0 0 0-30.118-30.118zM512 361.412a30.118 30.118 0 0 0-30.118 30.117v30.118a30.118 30.118 0 0 0 60.236 0V391.53A30.118 30.118 0 0 0 512 361.412zM512 512a30.118 30.118 0 0 0-30.118 30.118v30.117a30.118 30.118 0 0 0 60.236 0v-30.117A30.118 30.118 0 0 0 512 512z"
  2852. }, null, -1);
  2853. const _hoisted_3$o = [
  2854. _hoisted_2$B
  2855. ];
  2856. function _sfc_render$K(_ctx, _cache, $props, $setup, $data, $options) {
  2857. return openBlock(), createElementBlock("svg", _hoisted_1$K, _hoisted_3$o);
  2858. }
  2859. var scaleToOriginal = /* @__PURE__ */ _export_sfc$2(_sfc_main$1d, [["render", _sfc_render$K]]);
  2860. const _sfc_main$1c = defineComponent({
  2861. name: "StarFilled"
  2862. });
  2863. const _hoisted_1$J = {
  2864. viewBox: "0 0 1024 1024",
  2865. xmlns: "http://www.w3.org/2000/svg"
  2866. };
  2867. const _hoisted_2$A = /* @__PURE__ */ createElementVNode("path", {
  2868. fill: "currentColor",
  2869. d: "M283.84 867.84 512 747.776l228.16 119.936a6.4 6.4 0 0 0 9.28-6.72l-43.52-254.08 184.512-179.904a6.4 6.4 0 0 0-3.52-10.88l-255.104-37.12L517.76 147.904a6.4 6.4 0 0 0-11.52 0L392.192 379.072l-255.104 37.12a6.4 6.4 0 0 0-3.52 10.88L318.08 606.976l-43.584 254.08a6.4 6.4 0 0 0 9.28 6.72z"
  2870. }, null, -1);
  2871. const _hoisted_3$n = [
  2872. _hoisted_2$A
  2873. ];
  2874. function _sfc_render$J(_ctx, _cache, $props, $setup, $data, $options) {
  2875. return openBlock(), createElementBlock("svg", _hoisted_1$J, _hoisted_3$n);
  2876. }
  2877. var starFilled = /* @__PURE__ */ _export_sfc$2(_sfc_main$1c, [["render", _sfc_render$J]]);
  2878. const _sfc_main$1b = defineComponent({
  2879. name: "Star"
  2880. });
  2881. const _hoisted_1$I = {
  2882. viewBox: "0 0 1024 1024",
  2883. xmlns: "http://www.w3.org/2000/svg"
  2884. };
  2885. const _hoisted_2$z = /* @__PURE__ */ createElementVNode("path", {
  2886. fill: "currentColor",
  2887. d: "m512 747.84 228.16 119.936a6.4 6.4 0 0 0 9.28-6.72l-43.52-254.08 184.512-179.904a6.4 6.4 0 0 0-3.52-10.88l-255.104-37.12L517.76 147.904a6.4 6.4 0 0 0-11.52 0L392.192 379.072l-255.104 37.12a6.4 6.4 0 0 0-3.52 10.88L318.08 606.976l-43.584 254.08a6.4 6.4 0 0 0 9.28 6.72L512 747.84zM313.6 924.48a70.4 70.4 0 0 1-102.144-74.24l37.888-220.928L88.96 472.96A70.4 70.4 0 0 1 128 352.896l221.76-32.256 99.2-200.96a70.4 70.4 0 0 1 126.208 0l99.2 200.96 221.824 32.256a70.4 70.4 0 0 1 39.04 120.064L774.72 629.376l37.888 220.928a70.4 70.4 0 0 1-102.144 74.24L512 820.096l-198.4 104.32z"
  2888. }, null, -1);
  2889. const _hoisted_3$m = [
  2890. _hoisted_2$z
  2891. ];
  2892. function _sfc_render$I(_ctx, _cache, $props, $setup, $data, $options) {
  2893. return openBlock(), createElementBlock("svg", _hoisted_1$I, _hoisted_3$m);
  2894. }
  2895. var star = /* @__PURE__ */ _export_sfc$2(_sfc_main$1b, [["render", _sfc_render$I]]);
  2896. const _sfc_main$1a = defineComponent({
  2897. name: "View"
  2898. });
  2899. const _hoisted_1$H = {
  2900. viewBox: "0 0 1024 1024",
  2901. xmlns: "http://www.w3.org/2000/svg"
  2902. };
  2903. const _hoisted_2$y = /* @__PURE__ */ createElementVNode("path", {
  2904. fill: "currentColor",
  2905. d: "M512 160c320 0 512 352 512 352S832 864 512 864 0 512 0 512s192-352 512-352zm0 64c-225.28 0-384.128 208.064-436.8 288 52.608 79.872 211.456 288 436.8 288 225.28 0 384.128-208.064 436.8-288-52.608-79.872-211.456-288-436.8-288zm0 64a224 224 0 1 1 0 448 224 224 0 0 1 0-448zm0 64a160.192 160.192 0 0 0-160 160c0 88.192 71.744 160 160 160s160-71.808 160-160-71.744-160-160-160z"
  2906. }, null, -1);
  2907. const _hoisted_3$l = [
  2908. _hoisted_2$y
  2909. ];
  2910. function _sfc_render$H(_ctx, _cache, $props, $setup, $data, $options) {
  2911. return openBlock(), createElementBlock("svg", _hoisted_1$H, _hoisted_3$l);
  2912. }
  2913. var view = /* @__PURE__ */ _export_sfc$2(_sfc_main$1a, [["render", _sfc_render$H]]);
  2914. const _sfc_main$19 = defineComponent({
  2915. name: "WarningFilled"
  2916. });
  2917. const _hoisted_1$G = {
  2918. viewBox: "0 0 1024 1024",
  2919. xmlns: "http://www.w3.org/2000/svg"
  2920. };
  2921. const _hoisted_2$x = /* @__PURE__ */ createElementVNode("path", {
  2922. fill: "currentColor",
  2923. d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896zm0 192a58.432 58.432 0 0 0-58.24 63.744l23.36 256.384a35.072 35.072 0 0 0 69.76 0l23.296-256.384A58.432 58.432 0 0 0 512 256zm0 512a51.2 51.2 0 1 0 0-102.4 51.2 51.2 0 0 0 0 102.4z"
  2924. }, null, -1);
  2925. const _hoisted_3$k = [
  2926. _hoisted_2$x
  2927. ];
  2928. function _sfc_render$G(_ctx, _cache, $props, $setup, $data, $options) {
  2929. return openBlock(), createElementBlock("svg", _hoisted_1$G, _hoisted_3$k);
  2930. }
  2931. var warningFilled = /* @__PURE__ */ _export_sfc$2(_sfc_main$19, [["render", _sfc_render$G]]);
  2932. const _sfc_main$18 = defineComponent({
  2933. name: "ZoomIn"
  2934. });
  2935. const _hoisted_1$F = {
  2936. viewBox: "0 0 1024 1024",
  2937. xmlns: "http://www.w3.org/2000/svg"
  2938. };
  2939. const _hoisted_2$w = /* @__PURE__ */ createElementVNode("path", {
  2940. fill: "currentColor",
  2941. d: "m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704zm-32-384v-96a32 32 0 0 1 64 0v96h96a32 32 0 0 1 0 64h-96v96a32 32 0 0 1-64 0v-96h-96a32 32 0 0 1 0-64h96z"
  2942. }, null, -1);
  2943. const _hoisted_3$j = [
  2944. _hoisted_2$w
  2945. ];
  2946. function _sfc_render$F(_ctx, _cache, $props, $setup, $data, $options) {
  2947. return openBlock(), createElementBlock("svg", _hoisted_1$F, _hoisted_3$j);
  2948. }
  2949. var zoomIn = /* @__PURE__ */ _export_sfc$2(_sfc_main$18, [["render", _sfc_render$F]]);
  2950. const _sfc_main$17 = defineComponent({
  2951. name: "ZoomOut"
  2952. });
  2953. const _hoisted_1$E = {
  2954. viewBox: "0 0 1024 1024",
  2955. xmlns: "http://www.w3.org/2000/svg"
  2956. };
  2957. const _hoisted_2$v = /* @__PURE__ */ createElementVNode("path", {
  2958. fill: "currentColor",
  2959. d: "m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704zM352 448h256a32 32 0 0 1 0 64H352a32 32 0 0 1 0-64z"
  2960. }, null, -1);
  2961. const _hoisted_3$i = [
  2962. _hoisted_2$v
  2963. ];
  2964. function _sfc_render$E(_ctx, _cache, $props, $setup, $data, $options) {
  2965. return openBlock(), createElementBlock("svg", _hoisted_1$E, _hoisted_3$i);
  2966. }
  2967. var zoomOut = /* @__PURE__ */ _export_sfc$2(_sfc_main$17, [["render", _sfc_render$E]]);
  2968. const wrapperKey = Symbol();
  2969. const propKey = "__elPropsReservedKey";
  2970. function buildProp(option, key) {
  2971. if (!isObject$1(option) || !!option[propKey])
  2972. return option;
  2973. const { values, required: required4, default: defaultValue, type: type4, validator } = option;
  2974. const _validator = values || validator ? (val) => {
  2975. let valid = false;
  2976. let allowedValues = [];
  2977. if (values) {
  2978. allowedValues = Array.from(values);
  2979. if (hasOwn(option, "default")) {
  2980. allowedValues.push(defaultValue);
  2981. }
  2982. valid || (valid = allowedValues.includes(val));
  2983. }
  2984. if (validator)
  2985. valid || (valid = validator(val));
  2986. if (!valid && allowedValues.length > 0) {
  2987. const allowValuesText = [...new Set(allowedValues)].map((value) => JSON.stringify(value)).join(", ");
  2988. warn(`Invalid prop: validation failed${key ? ` for prop "${key}"` : ""}. Expected one of [${allowValuesText}], got value ${JSON.stringify(val)}.`);
  2989. }
  2990. return valid;
  2991. } : void 0;
  2992. const prop = {
  2993. type: isObject$1(type4) && Object.getOwnPropertySymbols(type4).includes(wrapperKey) ? type4[wrapperKey] : type4,
  2994. required: !!required4,
  2995. validator: _validator,
  2996. [propKey]: true
  2997. };
  2998. if (hasOwn(option, "default"))
  2999. prop.default = defaultValue;
  3000. return prop;
  3001. }
  3002. const buildProps = (props) => fromPairs(Object.entries(props).map(([key, option]) => [
  3003. key,
  3004. buildProp(option, key)
  3005. ]));
  3006. const definePropType = (val) => ({ [wrapperKey]: val });
  3007. const iconPropType = definePropType([
  3008. String,
  3009. Object,
  3010. Function
  3011. ]);
  3012. const CloseComponents = {
  3013. Close: close
  3014. };
  3015. const ValidateComponentsMap = {
  3016. validating: loading,
  3017. success: circleCheck,
  3018. error: circleClose
  3019. };
  3020. const withInstall = (main2, extra) => {
  3021. main2.install = (app) => {
  3022. for (const comp of [main2, ...Object.values(extra != null ? extra : {})]) {
  3023. app.component(comp.name, comp);
  3024. }
  3025. };
  3026. if (extra) {
  3027. for (const [key, comp] of Object.entries(extra)) {
  3028. main2[key] = comp;
  3029. }
  3030. }
  3031. return main2;
  3032. };
  3033. const withNoopInstall = (component) => {
  3034. component.install = NOOP;
  3035. return component;
  3036. };
  3037. class ElementPlusError extends Error {
  3038. constructor(m2) {
  3039. super(m2);
  3040. this.name = "ElementPlusError";
  3041. }
  3042. }
  3043. function throwError(scope, m2) {
  3044. throw new ElementPlusError(`[${scope}] ${m2}`);
  3045. }
  3046. function debugWarn(scope, message) {
  3047. }
  3048. function addUnit(value, defaultUnit = "px") {
  3049. if (!value)
  3050. return "";
  3051. if (isString(value)) {
  3052. return value;
  3053. } else if (isNumber(value)) {
  3054. return `${value}${defaultUnit}`;
  3055. }
  3056. }
  3057. const EVENT_CODE = {
  3058. tab: "Tab",
  3059. enter: "Enter",
  3060. space: "Space",
  3061. left: "ArrowLeft",
  3062. up: "ArrowUp",
  3063. right: "ArrowRight",
  3064. down: "ArrowDown",
  3065. esc: "Escape",
  3066. delete: "Delete",
  3067. backspace: "Backspace",
  3068. numpadEnter: "NumpadEnter",
  3069. pageUp: "PageUp",
  3070. pageDown: "PageDown",
  3071. home: "Home",
  3072. end: "End"
  3073. };
  3074. const datePickTypes = [
  3075. "year",
  3076. "month",
  3077. "date",
  3078. "dates",
  3079. "week",
  3080. "datetime",
  3081. "datetimerange",
  3082. "daterange",
  3083. "monthrange"
  3084. ];
  3085. const UPDATE_MODEL_EVENT = "update:modelValue";
  3086. const CHANGE_EVENT = "change";
  3087. const INPUT_EVENT = "input";
  3088. const componentSizes = ["", "default", "small", "large"];
  3089. const componentSizeMap = {
  3090. large: 40,
  3091. default: 32,
  3092. small: 24
  3093. };
  3094. const getComponentSize = (size = "default") => {
  3095. return componentSizeMap[size || "default"];
  3096. };
  3097. const isValidComponentSize = (val) => ["", ...componentSizes].includes(val);
  3098. const isValidDatePickType = (val) => [...datePickTypes].includes(val);
  3099. var PatchFlags = /* @__PURE__ */ ((PatchFlags2) => {
  3100. PatchFlags2[PatchFlags2["TEXT"] = 1] = "TEXT";
  3101. PatchFlags2[PatchFlags2["CLASS"] = 2] = "CLASS";
  3102. PatchFlags2[PatchFlags2["STYLE"] = 4] = "STYLE";
  3103. PatchFlags2[PatchFlags2["PROPS"] = 8] = "PROPS";
  3104. PatchFlags2[PatchFlags2["FULL_PROPS"] = 16] = "FULL_PROPS";
  3105. PatchFlags2[PatchFlags2["HYDRATE_EVENTS"] = 32] = "HYDRATE_EVENTS";
  3106. PatchFlags2[PatchFlags2["STABLE_FRAGMENT"] = 64] = "STABLE_FRAGMENT";
  3107. PatchFlags2[PatchFlags2["KEYED_FRAGMENT"] = 128] = "KEYED_FRAGMENT";
  3108. PatchFlags2[PatchFlags2["UNKEYED_FRAGMENT"] = 256] = "UNKEYED_FRAGMENT";
  3109. PatchFlags2[PatchFlags2["NEED_PATCH"] = 512] = "NEED_PATCH";
  3110. PatchFlags2[PatchFlags2["DYNAMIC_SLOTS"] = 1024] = "DYNAMIC_SLOTS";
  3111. PatchFlags2[PatchFlags2["HOISTED"] = -1] = "HOISTED";
  3112. PatchFlags2[PatchFlags2["BAIL"] = -2] = "BAIL";
  3113. return PatchFlags2;
  3114. })(PatchFlags || {});
  3115. function isFragment(node) {
  3116. return isVNode(node) && node.type === Fragment;
  3117. }
  3118. function isComment(node) {
  3119. return isVNode(node) && node.type === Comment;
  3120. }
  3121. function isValidElementNode(node) {
  3122. return isVNode(node) && !isFragment(node) && !isComment(node);
  3123. }
  3124. const unique = (arr) => [...new Set(arr)];
  3125. const castArray = (arr) => {
  3126. if (!arr && arr !== 0)
  3127. return [];
  3128. return Array.isArray(arr) ? arr : [arr];
  3129. };
  3130. const isFirefox = () => isClient && /firefox/i.test(window.navigator.userAgent);
  3131. const isKorean = (text) => /([(\uAC00-\uD7AF)|(\u3130-\u318F)])+/gi.test(text);
  3132. const generateId = () => Math.floor(Math.random() * 1e4);
  3133. const mutable = (val) => val;
  3134. const DEFAULT_EXCLUDE_KEYS = ["class", "style"];
  3135. const LISTENER_PREFIX = /^on[A-Z]/;
  3136. const useAttrs = (params = {}) => {
  3137. const { excludeListeners = false, excludeKeys = [] } = params;
  3138. const allExcludeKeys = excludeKeys.concat(DEFAULT_EXCLUDE_KEYS);
  3139. const instance = getCurrentInstance();
  3140. if (!instance) {
  3141. return computed(() => ({}));
  3142. }
  3143. return computed(() => {
  3144. var _a2;
  3145. return fromPairs(Object.entries((_a2 = instance.proxy) == null ? void 0 : _a2.$attrs).filter(([key]) => !allExcludeKeys.includes(key) && !(excludeListeners && LISTENER_PREFIX.test(key))));
  3146. });
  3147. };
  3148. const buttonGroupContextKey = Symbol("buttonGroupContextKey");
  3149. const configProviderContextKey = Symbol();
  3150. const dialogInjectionKey = Symbol("dialogInjectionKey");
  3151. const formContextKey = Symbol("formContextKey");
  3152. const formItemContextKey = Symbol("formItemContextKey");
  3153. const radioGroupKey = Symbol("radioGroupKey");
  3154. const scrollbarContextKey = Symbol("scrollbarContextKey");
  3155. const uploadContextKey = Symbol("uploadContextKey");
  3156. const POPPER_INJECTION_KEY = Symbol("popper");
  3157. const POPPER_CONTENT_INJECTION_KEY = Symbol("popperContent");
  3158. const useProp = (name) => {
  3159. const vm = getCurrentInstance();
  3160. return computed(() => {
  3161. var _a2, _b2;
  3162. return (_b2 = (_a2 = vm.proxy) == null ? void 0 : _a2.$props[name]) != null ? _b2 : void 0;
  3163. });
  3164. };
  3165. const globalConfig = ref();
  3166. function useGlobalConfig(key, defaultValue = void 0) {
  3167. const config = getCurrentInstance() ? inject(configProviderContextKey, globalConfig) : globalConfig;
  3168. if (key) {
  3169. return computed(() => {
  3170. var _a2, _b2;
  3171. return (_b2 = (_a2 = config.value) == null ? void 0 : _a2[key]) != null ? _b2 : defaultValue;
  3172. });
  3173. } else {
  3174. return config;
  3175. }
  3176. }
  3177. const provideGlobalConfig = (config, app, global2 = false) => {
  3178. var _a2;
  3179. const inSetup = !!getCurrentInstance();
  3180. const oldConfig = inSetup ? useGlobalConfig() : void 0;
  3181. const provideFn = (_a2 = app == null ? void 0 : app.provide) != null ? _a2 : inSetup ? provide : void 0;
  3182. if (!provideFn) {
  3183. return;
  3184. }
  3185. const context = computed(() => {
  3186. const cfg = unref(config);
  3187. if (!(oldConfig == null ? void 0 : oldConfig.value))
  3188. return cfg;
  3189. return mergeConfig(oldConfig.value, cfg);
  3190. });
  3191. provideFn(configProviderContextKey, context);
  3192. if (global2 || !globalConfig.value) {
  3193. globalConfig.value = context.value;
  3194. }
  3195. return context;
  3196. };
  3197. const mergeConfig = (a2, b2) => {
  3198. var _a2;
  3199. const keys2 = [.../* @__PURE__ */ new Set([...keysOf(a2), ...keysOf(b2)])];
  3200. const obj = {};
  3201. for (const key of keys2) {
  3202. obj[key] = (_a2 = b2[key]) != null ? _a2 : a2[key];
  3203. }
  3204. return obj;
  3205. };
  3206. const useSizeProp = buildProp({
  3207. type: String,
  3208. values: componentSizes,
  3209. required: false
  3210. });
  3211. const useSize = (fallback, ignore = {}) => {
  3212. const emptyRef = ref(void 0);
  3213. const size = ignore.prop ? emptyRef : useProp("size");
  3214. const globalConfig2 = ignore.global ? emptyRef : useGlobalConfig("size");
  3215. const form = ignore.form ? { size: void 0 } : inject(formContextKey, void 0);
  3216. const formItem = ignore.formItem ? { size: void 0 } : inject(formItemContextKey, void 0);
  3217. return computed(() => size.value || unref(fallback) || (formItem == null ? void 0 : formItem.size) || (form == null ? void 0 : form.size) || globalConfig2.value || "");
  3218. };
  3219. const useDisabled$1 = (fallback) => {
  3220. const disabled = useProp("disabled");
  3221. const form = inject(formContextKey, void 0);
  3222. return computed(() => disabled.value || unref(fallback) || (form == null ? void 0 : form.disabled) || false);
  3223. };
  3224. const useDeprecated = ({ from, replacement, scope, version, ref: ref2, type: type4 = "API" }, condition) => {
  3225. watch(() => unref(condition), (val) => {
  3226. }, {
  3227. immediate: true
  3228. });
  3229. };
  3230. const useDraggable = (targetRef, dragRef, draggable) => {
  3231. let transform = {
  3232. offsetX: 0,
  3233. offsetY: 0
  3234. };
  3235. const onMousedown = (e) => {
  3236. const downX = e.clientX;
  3237. const downY = e.clientY;
  3238. const { offsetX, offsetY } = transform;
  3239. const targetRect = targetRef.value.getBoundingClientRect();
  3240. const targetLeft = targetRect.left;
  3241. const targetTop = targetRect.top;
  3242. const targetWidth = targetRect.width;
  3243. const targetHeight = targetRect.height;
  3244. const clientWidth = document.documentElement.clientWidth;
  3245. const clientHeight = document.documentElement.clientHeight;
  3246. const minLeft = -targetLeft + offsetX;
  3247. const minTop = -targetTop + offsetY;
  3248. const maxLeft = clientWidth - targetLeft - targetWidth + offsetX;
  3249. const maxTop = clientHeight - targetTop - targetHeight + offsetY;
  3250. const onMousemove = (e2) => {
  3251. const moveX = Math.min(Math.max(offsetX + e2.clientX - downX, minLeft), maxLeft);
  3252. const moveY = Math.min(Math.max(offsetY + e2.clientY - downY, minTop), maxTop);
  3253. transform = {
  3254. offsetX: moveX,
  3255. offsetY: moveY
  3256. };
  3257. targetRef.value.style.transform = `translate(${addUnit(moveX)}, ${addUnit(moveY)})`;
  3258. };
  3259. const onMouseup = () => {
  3260. document.removeEventListener("mousemove", onMousemove);
  3261. document.removeEventListener("mouseup", onMouseup);
  3262. };
  3263. document.addEventListener("mousemove", onMousemove);
  3264. document.addEventListener("mouseup", onMouseup);
  3265. };
  3266. const onDraggable = () => {
  3267. if (dragRef.value && targetRef.value) {
  3268. dragRef.value.addEventListener("mousedown", onMousedown);
  3269. }
  3270. };
  3271. const offDraggable = () => {
  3272. if (dragRef.value && targetRef.value) {
  3273. dragRef.value.removeEventListener("mousedown", onMousedown);
  3274. }
  3275. };
  3276. onMounted(() => {
  3277. watchEffect(() => {
  3278. if (draggable.value) {
  3279. onDraggable();
  3280. } else {
  3281. offDraggable();
  3282. }
  3283. });
  3284. });
  3285. onBeforeUnmount(() => {
  3286. offDraggable();
  3287. });
  3288. };
  3289. const useFocus = (el) => {
  3290. return {
  3291. focus: () => {
  3292. var _a2, _b2;
  3293. (_b2 = (_a2 = el.value) == null ? void 0 : _a2.focus) == null ? void 0 : _b2.call(_a2);
  3294. }
  3295. };
  3296. };
  3297. const useFormItem = () => {
  3298. const form = inject(formContextKey, void 0);
  3299. const formItem = inject(formItemContextKey, void 0);
  3300. return {
  3301. form,
  3302. formItem
  3303. };
  3304. };
  3305. var English = {
  3306. name: "en",
  3307. el: {
  3308. colorpicker: {
  3309. confirm: "OK",
  3310. clear: "Clear"
  3311. },
  3312. datepicker: {
  3313. now: "Now",
  3314. today: "Today",
  3315. cancel: "Cancel",
  3316. clear: "Clear",
  3317. confirm: "OK",
  3318. selectDate: "Select date",
  3319. selectTime: "Select time",
  3320. startDate: "Start Date",
  3321. startTime: "Start Time",
  3322. endDate: "End Date",
  3323. endTime: "End Time",
  3324. prevYear: "Previous Year",
  3325. nextYear: "Next Year",
  3326. prevMonth: "Previous Month",
  3327. nextMonth: "Next Month",
  3328. year: "",
  3329. month1: "January",
  3330. month2: "February",
  3331. month3: "March",
  3332. month4: "April",
  3333. month5: "May",
  3334. month6: "June",
  3335. month7: "July",
  3336. month8: "August",
  3337. month9: "September",
  3338. month10: "October",
  3339. month11: "November",
  3340. month12: "December",
  3341. week: "week",
  3342. weeks: {
  3343. sun: "Sun",
  3344. mon: "Mon",
  3345. tue: "Tue",
  3346. wed: "Wed",
  3347. thu: "Thu",
  3348. fri: "Fri",
  3349. sat: "Sat"
  3350. },
  3351. months: {
  3352. jan: "Jan",
  3353. feb: "Feb",
  3354. mar: "Mar",
  3355. apr: "Apr",
  3356. may: "May",
  3357. jun: "Jun",
  3358. jul: "Jul",
  3359. aug: "Aug",
  3360. sep: "Sep",
  3361. oct: "Oct",
  3362. nov: "Nov",
  3363. dec: "Dec"
  3364. }
  3365. },
  3366. select: {
  3367. loading: "Loading",
  3368. noMatch: "No matching data",
  3369. noData: "No data",
  3370. placeholder: "Select"
  3371. },
  3372. cascader: {
  3373. noMatch: "No matching data",
  3374. loading: "Loading",
  3375. placeholder: "Select",
  3376. noData: "No data"
  3377. },
  3378. pagination: {
  3379. goto: "Go to",
  3380. pagesize: "/page",
  3381. total: "Total {total}",
  3382. pageClassifier: "",
  3383. deprecationWarning: "Deprecated usages detected, please refer to the el-pagination documentation for more details"
  3384. },
  3385. messagebox: {
  3386. title: "Message",
  3387. confirm: "OK",
  3388. cancel: "Cancel",
  3389. error: "Illegal input"
  3390. },
  3391. upload: {
  3392. deleteTip: "press delete to remove",
  3393. delete: "Delete",
  3394. preview: "Preview",
  3395. continue: "Continue"
  3396. },
  3397. table: {
  3398. emptyText: "No Data",
  3399. confirmFilter: "Confirm",
  3400. resetFilter: "Reset",
  3401. clearFilter: "All",
  3402. sumText: "Sum"
  3403. },
  3404. tree: {
  3405. emptyText: "No Data"
  3406. },
  3407. transfer: {
  3408. noMatch: "No matching data",
  3409. noData: "No data",
  3410. titles: ["List 1", "List 2"],
  3411. filterPlaceholder: "Enter keyword",
  3412. noCheckedFormat: "{total} items",
  3413. hasCheckedFormat: "{checked}/{total} checked"
  3414. },
  3415. image: {
  3416. error: "FAILED"
  3417. },
  3418. pageHeader: {
  3419. title: "Back"
  3420. },
  3421. popconfirm: {
  3422. confirmButtonText: "Yes",
  3423. cancelButtonText: "No"
  3424. }
  3425. }
  3426. };
  3427. const buildTranslator = (locale) => (path, option) => translate(path, option, unref(locale));
  3428. const translate = (path, option, locale) => get(locale, path, path).replace(/\{(\w+)\}/g, (_2, key) => {
  3429. var _a2;
  3430. return `${(_a2 = option == null ? void 0 : option[key]) != null ? _a2 : `{${key}}`}`;
  3431. });
  3432. const buildLocaleContext = (locale) => {
  3433. const lang = computed(() => unref(locale).name);
  3434. const localeRef = isRef(locale) ? locale : ref(locale);
  3435. return {
  3436. lang,
  3437. locale: localeRef,
  3438. t: buildTranslator(locale)
  3439. };
  3440. };
  3441. const useLocale = () => {
  3442. const locale = useGlobalConfig("locale");
  3443. return buildLocaleContext(computed(() => locale.value || English));
  3444. };
  3445. const useLockscreen = (trigger) => {
  3446. if (!isRef(trigger)) {
  3447. throwError("[useLockscreen]", "You need to pass a ref param to this function");
  3448. }
  3449. if (!isClient || hasClass(document.body, "el-popup-parent--hidden")) {
  3450. return;
  3451. }
  3452. let scrollBarWidth2 = 0;
  3453. let withoutHiddenClass = false;
  3454. let bodyPaddingRight = "0";
  3455. let computedBodyPaddingRight = 0;
  3456. const cleanup = () => {
  3457. removeClass(document.body, "el-popup-parent--hidden");
  3458. if (withoutHiddenClass) {
  3459. document.body.style.paddingRight = bodyPaddingRight;
  3460. }
  3461. };
  3462. watch(trigger, (val) => {
  3463. if (!val) {
  3464. cleanup();
  3465. return;
  3466. }
  3467. withoutHiddenClass = !hasClass(document.body, "el-popup-parent--hidden");
  3468. if (withoutHiddenClass) {
  3469. bodyPaddingRight = document.body.style.paddingRight;
  3470. computedBodyPaddingRight = Number.parseInt(getStyle(document.body, "paddingRight"), 10);
  3471. }
  3472. scrollBarWidth2 = getScrollBarWidth();
  3473. const bodyHasOverflow = document.documentElement.clientHeight < document.body.scrollHeight;
  3474. const bodyOverflowY = getStyle(document.body, "overflowY");
  3475. if (scrollBarWidth2 > 0 && (bodyHasOverflow || bodyOverflowY === "scroll") && withoutHiddenClass) {
  3476. document.body.style.paddingRight = `${computedBodyPaddingRight + scrollBarWidth2}px`;
  3477. }
  3478. addClass(document.body, "el-popup-parent--hidden");
  3479. });
  3480. onScopeDispose(() => cleanup());
  3481. };
  3482. const modalStack = [];
  3483. const closeModal = (e) => {
  3484. if (modalStack.length === 0)
  3485. return;
  3486. if (e.code === EVENT_CODE.esc) {
  3487. e.stopPropagation();
  3488. const topModal = modalStack[modalStack.length - 1];
  3489. topModal.handleClose();
  3490. }
  3491. };
  3492. const useModal = (instance, visibleRef) => {
  3493. watch(visibleRef, (val) => {
  3494. if (val) {
  3495. modalStack.push(instance);
  3496. } else {
  3497. modalStack.splice(modalStack.indexOf(instance), 1);
  3498. }
  3499. });
  3500. };
  3501. if (isClient)
  3502. useEventListener(document, "keydown", closeModal);
  3503. const _prop = buildProp({
  3504. type: definePropType(Boolean),
  3505. default: null
  3506. });
  3507. const _event = buildProp({
  3508. type: definePropType(Function)
  3509. });
  3510. const createModelToggleComposable = (name) => {
  3511. const useModelToggleProps2 = {
  3512. [name]: _prop,
  3513. [`onUpdate:${name}`]: _event
  3514. };
  3515. const useModelToggleEmits2 = [`update:${name}`];
  3516. const useModelToggle2 = ({
  3517. indicator,
  3518. shouldHideWhenRouteChanges,
  3519. shouldProceed,
  3520. onShow,
  3521. onHide
  3522. }) => {
  3523. const instance = getCurrentInstance();
  3524. const props = instance.props;
  3525. const { emit } = instance;
  3526. const updateEventKey = `update:${name}`;
  3527. const hasUpdateHandler = computed(() => isFunction(props[`onUpdate:${name}`]));
  3528. const isModelBindingAbsent = computed(() => props[name] === null);
  3529. const doShow = () => {
  3530. if (indicator.value === true) {
  3531. return;
  3532. }
  3533. indicator.value = true;
  3534. if (isFunction(onShow)) {
  3535. onShow();
  3536. }
  3537. };
  3538. const doHide = () => {
  3539. if (indicator.value === false) {
  3540. return;
  3541. }
  3542. indicator.value = false;
  3543. if (isFunction(onHide)) {
  3544. onHide();
  3545. }
  3546. };
  3547. const show = () => {
  3548. if (props.disabled === true || isFunction(shouldProceed) && !shouldProceed())
  3549. return;
  3550. const shouldEmit = hasUpdateHandler.value && isClient;
  3551. if (shouldEmit) {
  3552. emit(updateEventKey, true);
  3553. }
  3554. if (isModelBindingAbsent.value || !shouldEmit) {
  3555. doShow();
  3556. }
  3557. };
  3558. const hide2 = () => {
  3559. if (props.disabled === true || !isClient)
  3560. return;
  3561. const shouldEmit = hasUpdateHandler.value && isClient;
  3562. if (shouldEmit) {
  3563. emit(updateEventKey, false);
  3564. }
  3565. if (isModelBindingAbsent.value || !shouldEmit) {
  3566. doHide();
  3567. }
  3568. };
  3569. const onChange = (val) => {
  3570. if (!isBoolean(val))
  3571. return;
  3572. if (props.disabled && val) {
  3573. if (hasUpdateHandler.value) {
  3574. emit(updateEventKey, false);
  3575. }
  3576. } else if (indicator.value !== val) {
  3577. if (val) {
  3578. doShow();
  3579. } else {
  3580. doHide();
  3581. }
  3582. }
  3583. };
  3584. const toggle = () => {
  3585. if (indicator.value) {
  3586. hide2();
  3587. } else {
  3588. show();
  3589. }
  3590. };
  3591. watch(() => props[name], onChange);
  3592. if (shouldHideWhenRouteChanges && instance.appContext.config.globalProperties.$route !== void 0) {
  3593. watch(() => __spreadValues({}, instance.proxy.$route), () => {
  3594. if (shouldHideWhenRouteChanges.value && indicator.value) {
  3595. hide2();
  3596. }
  3597. });
  3598. }
  3599. onMounted(() => {
  3600. onChange(props[name]);
  3601. });
  3602. return {
  3603. hide: hide2,
  3604. show,
  3605. toggle
  3606. };
  3607. };
  3608. return {
  3609. useModelToggle: useModelToggle2,
  3610. useModelToggleProps: useModelToggleProps2,
  3611. useModelToggleEmits: useModelToggleEmits2
  3612. };
  3613. };
  3614. const useRestoreActive = (toggle, initialFocus) => {
  3615. let previousActive;
  3616. watch(() => toggle.value, (val) => {
  3617. var _a2, _b2;
  3618. if (val) {
  3619. previousActive = document.activeElement;
  3620. if (isRef(initialFocus)) {
  3621. (_b2 = (_a2 = initialFocus.value).focus) == null ? void 0 : _b2.call(_a2);
  3622. }
  3623. } else {
  3624. {
  3625. previousActive.focus();
  3626. }
  3627. }
  3628. });
  3629. };
  3630. const useSameTarget = (handleClick) => {
  3631. if (!handleClick) {
  3632. return { onClick: NOOP, onMousedown: NOOP, onMouseup: NOOP };
  3633. }
  3634. let mousedownTarget = false;
  3635. let mouseupTarget = false;
  3636. const onClick = (e) => {
  3637. if (mousedownTarget && mouseupTarget) {
  3638. handleClick(e);
  3639. }
  3640. mousedownTarget = mouseupTarget = false;
  3641. };
  3642. const onMousedown = (e) => {
  3643. mousedownTarget = e.target === e.currentTarget;
  3644. };
  3645. const onMouseup = (e) => {
  3646. mouseupTarget = e.target === e.currentTarget;
  3647. };
  3648. return { onClick, onMousedown, onMouseup };
  3649. };
  3650. function useTimeout() {
  3651. let timeoutHandle;
  3652. const registerTimeout = (fn2, delay) => {
  3653. cancelTimeout();
  3654. timeoutHandle = window.setTimeout(fn2, delay);
  3655. };
  3656. const cancelTimeout = () => window.clearTimeout(timeoutHandle);
  3657. tryOnScopeDispose(() => cancelTimeout());
  3658. return {
  3659. registerTimeout,
  3660. cancelTimeout
  3661. };
  3662. }
  3663. const defaultIdInjection = {
  3664. prefix: Math.floor(Math.random() * 1e4),
  3665. current: 0
  3666. };
  3667. const ID_INJECTION_KEY = Symbol("elIdInjection");
  3668. const useId = (deterministicId) => {
  3669. const idInjection = inject(ID_INJECTION_KEY, defaultIdInjection);
  3670. const idRef = computed(() => unref(deterministicId) || `el-id-${idInjection.prefix}-${idInjection.current++}`);
  3671. return idRef;
  3672. };
  3673. const useEscapeKeydown = (handler3) => {
  3674. const cachedHandler = (e) => {
  3675. const event = e;
  3676. if (event.key === EVENT_CODE.esc) {
  3677. handler3 == null ? void 0 : handler3(event);
  3678. }
  3679. };
  3680. onMounted(() => {
  3681. on(document, "keydown", cachedHandler);
  3682. });
  3683. onBeforeUnmount(() => {
  3684. off(document, "keydown", cachedHandler);
  3685. });
  3686. };
  3687. let cachedContainer;
  3688. const POPPER_CONTAINER_ID = `el-popper-container-${generateId()}`;
  3689. const POPPER_CONTAINER_SELECTOR = `#${POPPER_CONTAINER_ID}`;
  3690. const createContainer = () => {
  3691. const container = document.createElement("div");
  3692. container.id = POPPER_CONTAINER_ID;
  3693. document.body.appendChild(container);
  3694. return container;
  3695. };
  3696. const usePopperContainer = () => {
  3697. onBeforeMount(() => {
  3698. if (!isClient)
  3699. return;
  3700. if (!cachedContainer || !document.body.querySelector(POPPER_CONTAINER_SELECTOR)) {
  3701. cachedContainer = createContainer();
  3702. }
  3703. });
  3704. };
  3705. const useDelayedToggleProps = buildProps({
  3706. showAfter: {
  3707. type: Number,
  3708. default: 0
  3709. },
  3710. hideAfter: {
  3711. type: Number,
  3712. default: 200
  3713. }
  3714. });
  3715. const useDelayedToggle = ({
  3716. showAfter,
  3717. hideAfter,
  3718. open,
  3719. close: close2
  3720. }) => {
  3721. const { registerTimeout } = useTimeout();
  3722. const onOpen = () => {
  3723. registerTimeout(() => {
  3724. open();
  3725. }, unref(showAfter));
  3726. };
  3727. const onClose = () => {
  3728. registerTimeout(() => {
  3729. close2();
  3730. }, unref(hideAfter));
  3731. };
  3732. return {
  3733. onOpen,
  3734. onClose
  3735. };
  3736. };
  3737. const FORWARD_REF_INJECTION_KEY = Symbol("elForwardRef");
  3738. const useForwardRef = (forwardRef) => {
  3739. const setForwardRef = (el) => {
  3740. forwardRef.value = el;
  3741. };
  3742. provide(FORWARD_REF_INJECTION_KEY, {
  3743. setForwardRef
  3744. });
  3745. };
  3746. const useForwardRefDirective = (setForwardRef) => {
  3747. return {
  3748. mounted(el) {
  3749. setForwardRef(el);
  3750. },
  3751. updated(el) {
  3752. setForwardRef(el);
  3753. },
  3754. unmounted() {
  3755. setForwardRef(null);
  3756. }
  3757. };
  3758. };
  3759. const defaultNamespace = "el";
  3760. const statePrefix = "is-";
  3761. const _bem = (namespace, block, blockSuffix, element, modifier) => {
  3762. let cls = `${namespace}-${block}`;
  3763. if (blockSuffix) {
  3764. cls += `-${blockSuffix}`;
  3765. }
  3766. if (element) {
  3767. cls += `__${element}`;
  3768. }
  3769. if (modifier) {
  3770. cls += `--${modifier}`;
  3771. }
  3772. return cls;
  3773. };
  3774. const useNamespace = (block) => {
  3775. const globalConfig2 = useGlobalConfig("namespace");
  3776. const namespace = computed(() => globalConfig2.value || defaultNamespace);
  3777. const b2 = (blockSuffix = "") => _bem(unref(namespace), block, blockSuffix, "", "");
  3778. const e = (element) => element ? _bem(unref(namespace), block, "", element, "") : "";
  3779. const m2 = (modifier) => modifier ? _bem(unref(namespace), block, "", "", modifier) : "";
  3780. const be = (blockSuffix, element) => blockSuffix && element ? _bem(unref(namespace), block, blockSuffix, element, "") : "";
  3781. const em = (element, modifier) => element && modifier ? _bem(unref(namespace), block, "", element, modifier) : "";
  3782. const bm = (blockSuffix, modifier) => blockSuffix && modifier ? _bem(unref(namespace), block, blockSuffix, "", modifier) : "";
  3783. const bem = (blockSuffix, element, modifier) => blockSuffix && element && modifier ? _bem(unref(namespace), block, blockSuffix, element, modifier) : "";
  3784. const is = (name, ...args) => {
  3785. const state = args.length >= 1 ? args[0] : true;
  3786. return name && state ? `${statePrefix}${name}` : "";
  3787. };
  3788. return {
  3789. namespace,
  3790. b: b2,
  3791. e,
  3792. m: m2,
  3793. be,
  3794. em,
  3795. bm,
  3796. bem,
  3797. is
  3798. };
  3799. };
  3800. const zIndex = ref(0);
  3801. const useZIndex = () => {
  3802. const initialZIndex = useGlobalConfig("zIndex", 2e3);
  3803. const currentZIndex = computed(() => initialZIndex.value + zIndex.value);
  3804. const nextZIndex = () => {
  3805. zIndex.value++;
  3806. return currentZIndex.value;
  3807. };
  3808. return {
  3809. initialZIndex,
  3810. currentZIndex,
  3811. nextZIndex
  3812. };
  3813. };
  3814. var _export_sfc$1 = (sfc, props) => {
  3815. const target = sfc.__vccOpts || sfc;
  3816. for (const [key, val] of props) {
  3817. target[key] = val;
  3818. }
  3819. return target;
  3820. };
  3821. const iconProps = buildProps({
  3822. size: {
  3823. type: definePropType([Number, String])
  3824. },
  3825. color: {
  3826. type: String
  3827. }
  3828. });
  3829. const __default__$l = {
  3830. name: "ElIcon",
  3831. inheritAttrs: false
  3832. };
  3833. const _sfc_main$16 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$l), {
  3834. props: iconProps,
  3835. setup(__props) {
  3836. const props = __props;
  3837. const ns = useNamespace("icon");
  3838. const style = computed(() => {
  3839. if (!props.size && !props.color)
  3840. return {};
  3841. return {
  3842. fontSize: isUndefined(props.size) ? void 0 : addUnit(props.size),
  3843. "--color": props.color
  3844. };
  3845. });
  3846. return (_ctx, _cache) => {
  3847. return openBlock(), createElementBlock("i", mergeProps({
  3848. class: unref(ns).b(),
  3849. style: unref(style)
  3850. }, _ctx.$attrs), [
  3851. renderSlot(_ctx.$slots, "default")
  3852. ], 16);
  3853. };
  3854. }
  3855. }));
  3856. var Icon = /* @__PURE__ */ _export_sfc$1(_sfc_main$16, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/icon/src/icon.vue"]]);
  3857. const ElIcon = withInstall(Icon);
  3858. let hiddenTextarea = void 0;
  3859. const HIDDEN_STYLE = `
  3860. height:0 !important;
  3861. visibility:hidden !important;
  3862. overflow:hidden !important;
  3863. position:absolute !important;
  3864. z-index:-1000 !important;
  3865. top:0 !important;
  3866. right:0 !important;
  3867. `;
  3868. const CONTEXT_STYLE = [
  3869. "letter-spacing",
  3870. "line-height",
  3871. "padding-top",
  3872. "padding-bottom",
  3873. "font-family",
  3874. "font-weight",
  3875. "font-size",
  3876. "text-rendering",
  3877. "text-transform",
  3878. "width",
  3879. "text-indent",
  3880. "padding-left",
  3881. "padding-right",
  3882. "border-width",
  3883. "box-sizing"
  3884. ];
  3885. function calculateNodeStyling(targetElement) {
  3886. const style = window.getComputedStyle(targetElement);
  3887. const boxSizing = style.getPropertyValue("box-sizing");
  3888. const paddingSize = Number.parseFloat(style.getPropertyValue("padding-bottom")) + Number.parseFloat(style.getPropertyValue("padding-top"));
  3889. const borderSize = Number.parseFloat(style.getPropertyValue("border-bottom-width")) + Number.parseFloat(style.getPropertyValue("border-top-width"));
  3890. const contextStyle = CONTEXT_STYLE.map((name) => `${name}:${style.getPropertyValue(name)}`).join(";");
  3891. return { contextStyle, paddingSize, borderSize, boxSizing };
  3892. }
  3893. function calcTextareaHeight(targetElement, minRows = 1, maxRows) {
  3894. var _a2;
  3895. if (!hiddenTextarea) {
  3896. hiddenTextarea = document.createElement("textarea");
  3897. document.body.appendChild(hiddenTextarea);
  3898. }
  3899. const { paddingSize, borderSize, boxSizing, contextStyle } = calculateNodeStyling(targetElement);
  3900. hiddenTextarea.setAttribute("style", `${contextStyle};${HIDDEN_STYLE}`);
  3901. hiddenTextarea.value = targetElement.value || targetElement.placeholder || "";
  3902. let height = hiddenTextarea.scrollHeight;
  3903. const result = {};
  3904. if (boxSizing === "border-box") {
  3905. height = height + borderSize;
  3906. } else if (boxSizing === "content-box") {
  3907. height = height - paddingSize;
  3908. }
  3909. hiddenTextarea.value = "";
  3910. const singleRowHeight = hiddenTextarea.scrollHeight - paddingSize;
  3911. if (isNumber(minRows)) {
  3912. let minHeight = singleRowHeight * minRows;
  3913. if (boxSizing === "border-box") {
  3914. minHeight = minHeight + paddingSize + borderSize;
  3915. }
  3916. height = Math.max(minHeight, height);
  3917. result.minHeight = `${minHeight}px`;
  3918. }
  3919. if (isNumber(maxRows)) {
  3920. let maxHeight = singleRowHeight * maxRows;
  3921. if (boxSizing === "border-box") {
  3922. maxHeight = maxHeight + paddingSize + borderSize;
  3923. }
  3924. height = Math.min(maxHeight, height);
  3925. }
  3926. result.height = `${height}px`;
  3927. (_a2 = hiddenTextarea.parentNode) == null ? void 0 : _a2.removeChild(hiddenTextarea);
  3928. hiddenTextarea = void 0;
  3929. return result;
  3930. }
  3931. const inputProps = buildProps({
  3932. size: useSizeProp,
  3933. disabled: Boolean,
  3934. modelValue: {
  3935. type: definePropType([
  3936. String,
  3937. Number,
  3938. Object
  3939. ]),
  3940. default: ""
  3941. },
  3942. type: {
  3943. type: String,
  3944. default: "text"
  3945. },
  3946. resize: {
  3947. type: String,
  3948. values: ["none", "both", "horizontal", "vertical"]
  3949. },
  3950. autosize: {
  3951. type: definePropType([Boolean, Object]),
  3952. default: false
  3953. },
  3954. autocomplete: {
  3955. type: String,
  3956. default: "off"
  3957. },
  3958. placeholder: {
  3959. type: String
  3960. },
  3961. form: {
  3962. type: String,
  3963. default: ""
  3964. },
  3965. readonly: {
  3966. type: Boolean,
  3967. default: false
  3968. },
  3969. clearable: {
  3970. type: Boolean,
  3971. default: false
  3972. },
  3973. showPassword: {
  3974. type: Boolean,
  3975. default: false
  3976. },
  3977. showWordLimit: {
  3978. type: Boolean,
  3979. default: false
  3980. },
  3981. suffixIcon: {
  3982. type: iconPropType,
  3983. default: ""
  3984. },
  3985. prefixIcon: {
  3986. type: iconPropType,
  3987. default: ""
  3988. },
  3989. label: {
  3990. type: String
  3991. },
  3992. tabindex: {
  3993. type: [Number, String]
  3994. },
  3995. validateEvent: {
  3996. type: Boolean,
  3997. default: true
  3998. },
  3999. inputStyle: {
  4000. type: definePropType([Object, Array, String]),
  4001. default: () => mutable({})
  4002. }
  4003. });
  4004. const inputEmits = {
  4005. [UPDATE_MODEL_EVENT]: (value) => isString(value),
  4006. input: (value) => isString(value),
  4007. change: (value) => isString(value),
  4008. focus: (evt) => evt instanceof FocusEvent,
  4009. blur: (evt) => evt instanceof FocusEvent,
  4010. clear: () => true,
  4011. mouseleave: (evt) => evt instanceof MouseEvent,
  4012. mouseenter: (evt) => evt instanceof MouseEvent,
  4013. keydown: (evt) => evt instanceof Event,
  4014. compositionstart: (evt) => evt instanceof CompositionEvent,
  4015. compositionupdate: (evt) => evt instanceof CompositionEvent,
  4016. compositionend: (evt) => evt instanceof CompositionEvent
  4017. };
  4018. const _hoisted_1$D = ["type", "disabled", "readonly", "autocomplete", "tabindex", "aria-label", "placeholder"];
  4019. const _hoisted_2$u = ["tabindex", "disabled", "readonly", "autocomplete", "aria-label", "placeholder"];
  4020. const __default__$k = {
  4021. name: "ElInput",
  4022. inheritAttrs: false
  4023. };
  4024. const _sfc_main$15 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$k), {
  4025. props: inputProps,
  4026. emits: inputEmits,
  4027. setup(__props, { expose, emit }) {
  4028. const props = __props;
  4029. const PENDANT_MAP = {
  4030. suffix: "append",
  4031. prefix: "prepend"
  4032. };
  4033. const instance = getCurrentInstance();
  4034. const rawAttrs = useAttrs$1();
  4035. const slots = useSlots();
  4036. const attrs = useAttrs();
  4037. const { form, formItem } = useFormItem();
  4038. const inputSize = useSize();
  4039. const inputDisabled = useDisabled$1();
  4040. const nsInput = useNamespace("input");
  4041. const nsTextarea = useNamespace("textarea");
  4042. const input = shallowRef();
  4043. const textarea = shallowRef();
  4044. const focused = ref(false);
  4045. const hovering = ref(false);
  4046. const isComposing = ref(false);
  4047. const passwordVisible = ref(false);
  4048. const textareaCalcStyle = shallowRef(props.inputStyle);
  4049. const _ref = computed(() => input.value || textarea.value);
  4050. const needStatusIcon = computed(() => {
  4051. var _a2;
  4052. return (_a2 = form == null ? void 0 : form.statusIcon) != null ? _a2 : false;
  4053. });
  4054. const validateState = computed(() => (formItem == null ? void 0 : formItem.validateState) || "");
  4055. const validateIcon = computed(() => ValidateComponentsMap[validateState.value]);
  4056. const passwordIcon = computed(() => passwordVisible.value ? view : hide$2);
  4057. const containerStyle = computed(() => [
  4058. rawAttrs.style,
  4059. props.inputStyle
  4060. ]);
  4061. const textareaStyle = computed(() => [
  4062. props.inputStyle,
  4063. textareaCalcStyle.value,
  4064. { resize: props.resize }
  4065. ]);
  4066. const nativeInputValue = computed(() => isNil(props.modelValue) ? "" : String(props.modelValue));
  4067. const showClear = computed(() => props.clearable && !inputDisabled.value && !props.readonly && !!nativeInputValue.value && (focused.value || hovering.value));
  4068. const showPwdVisible = computed(() => props.showPassword && !inputDisabled.value && !props.readonly && (!!nativeInputValue.value || focused.value));
  4069. const isWordLimitVisible = computed(() => props.showWordLimit && !!attrs.value.maxlength && (props.type === "text" || props.type === "textarea") && !inputDisabled.value && !props.readonly && !props.showPassword);
  4070. const textLength = computed(() => Array.from(nativeInputValue.value).length);
  4071. const inputExceed = computed(() => !!isWordLimitVisible.value && textLength.value > Number(attrs.value.maxlength));
  4072. const suffixVisible = computed(() => !!slots.suffix || !!props.suffixIcon || showClear.value || props.showPassword || isWordLimitVisible.value || !!validateState.value && needStatusIcon.value);
  4073. const resizeTextarea = () => {
  4074. const { type: type4, autosize } = props;
  4075. if (!isClient || type4 !== "textarea")
  4076. return;
  4077. if (autosize) {
  4078. const minRows = isObject$1(autosize) ? autosize.minRows : void 0;
  4079. const maxRows = isObject$1(autosize) ? autosize.maxRows : void 0;
  4080. textareaCalcStyle.value = __spreadValues({}, calcTextareaHeight(textarea.value, minRows, maxRows));
  4081. } else {
  4082. textareaCalcStyle.value = {
  4083. minHeight: calcTextareaHeight(textarea.value).minHeight
  4084. };
  4085. }
  4086. };
  4087. const setNativeInputValue = () => {
  4088. const input2 = _ref.value;
  4089. if (!input2 || input2.value === nativeInputValue.value)
  4090. return;
  4091. input2.value = nativeInputValue.value;
  4092. };
  4093. const calcIconOffset = (place) => {
  4094. const { el } = instance.vnode;
  4095. if (!el)
  4096. return;
  4097. const elList = Array.from(el.querySelectorAll(`.${nsInput.e(place)}`));
  4098. const target = elList.find((item) => item.parentNode === el);
  4099. if (!target)
  4100. return;
  4101. const pendant = PENDANT_MAP[place];
  4102. if (slots[pendant]) {
  4103. target.style.transform = `translateX(${place === "suffix" ? "-" : ""}${el.querySelector(`.${nsInput.be("group", pendant)}`).offsetWidth}px)`;
  4104. } else {
  4105. target.removeAttribute("style");
  4106. }
  4107. };
  4108. const updateIconOffset = () => {
  4109. calcIconOffset("prefix");
  4110. calcIconOffset("suffix");
  4111. };
  4112. const handleInput = async (event) => {
  4113. const { value } = event.target;
  4114. if (isComposing.value)
  4115. return;
  4116. if (value === nativeInputValue.value)
  4117. return;
  4118. emit(UPDATE_MODEL_EVENT, value);
  4119. emit("input", value);
  4120. await nextTick();
  4121. setNativeInputValue();
  4122. };
  4123. const handleChange2 = (event) => {
  4124. emit("change", event.target.value);
  4125. };
  4126. const handleCompositionStart = (event) => {
  4127. emit("compositionstart", event);
  4128. isComposing.value = true;
  4129. };
  4130. const handleCompositionUpdate = (event) => {
  4131. var _a2;
  4132. emit("compositionupdate", event);
  4133. const text = (_a2 = event.target) == null ? void 0 : _a2.value;
  4134. const lastCharacter = text[text.length - 1] || "";
  4135. isComposing.value = !isKorean(lastCharacter);
  4136. };
  4137. const handleCompositionEnd = (event) => {
  4138. emit("compositionend", event);
  4139. if (isComposing.value) {
  4140. isComposing.value = false;
  4141. handleInput(event);
  4142. }
  4143. };
  4144. const handlePasswordVisible = () => {
  4145. passwordVisible.value = !passwordVisible.value;
  4146. focus();
  4147. };
  4148. const focus = async () => {
  4149. var _a2;
  4150. await nextTick();
  4151. (_a2 = _ref.value) == null ? void 0 : _a2.focus();
  4152. };
  4153. const blur = () => {
  4154. var _a2;
  4155. return (_a2 = _ref.value) == null ? void 0 : _a2.blur();
  4156. };
  4157. const handleFocus = (event) => {
  4158. focused.value = true;
  4159. emit("focus", event);
  4160. };
  4161. const handleBlur = (event) => {
  4162. var _a2;
  4163. focused.value = false;
  4164. emit("blur", event);
  4165. if (props.validateEvent) {
  4166. (_a2 = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a2.call(formItem, "blur").catch((err) => debugWarn());
  4167. }
  4168. };
  4169. const handleMouseLeave = (evt) => {
  4170. hovering.value = false;
  4171. emit("mouseleave", evt);
  4172. };
  4173. const handleMouseEnter = (evt) => {
  4174. hovering.value = true;
  4175. emit("mouseenter", evt);
  4176. };
  4177. const handleKeydown = (evt) => {
  4178. emit("keydown", evt);
  4179. };
  4180. const select = () => {
  4181. var _a2;
  4182. (_a2 = _ref.value) == null ? void 0 : _a2.select();
  4183. };
  4184. const clear = () => {
  4185. emit(UPDATE_MODEL_EVENT, "");
  4186. emit("change", "");
  4187. emit("clear");
  4188. emit("input", "");
  4189. };
  4190. watch(() => props.modelValue, () => {
  4191. var _a2;
  4192. nextTick(() => resizeTextarea());
  4193. if (props.validateEvent) {
  4194. (_a2 = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a2.call(formItem, "change").catch((err) => debugWarn());
  4195. }
  4196. });
  4197. watch(nativeInputValue, () => setNativeInputValue());
  4198. watch(() => props.type, async () => {
  4199. await nextTick();
  4200. setNativeInputValue();
  4201. resizeTextarea();
  4202. updateIconOffset();
  4203. });
  4204. onMounted(async () => {
  4205. setNativeInputValue();
  4206. updateIconOffset();
  4207. await nextTick();
  4208. resizeTextarea();
  4209. });
  4210. onUpdated(async () => {
  4211. await nextTick();
  4212. updateIconOffset();
  4213. });
  4214. expose({
  4215. input,
  4216. textarea,
  4217. ref: _ref,
  4218. textareaStyle,
  4219. autosize: toRef(props, "autosize"),
  4220. focus,
  4221. blur,
  4222. select,
  4223. clear,
  4224. resizeTextarea
  4225. });
  4226. return (_ctx, _cache) => {
  4227. return withDirectives((openBlock(), createElementBlock("div", {
  4228. class: normalizeClass([
  4229. _ctx.type === "textarea" ? unref(nsTextarea).b() : unref(nsInput).b(),
  4230. unref(nsInput).m(unref(inputSize)),
  4231. unref(nsInput).is("disabled", unref(inputDisabled)),
  4232. unref(nsInput).is("exceed", unref(inputExceed)),
  4233. {
  4234. [unref(nsInput).b("group")]: _ctx.$slots.prepend || _ctx.$slots.append,
  4235. [unref(nsInput).bm("group", "append")]: _ctx.$slots.append,
  4236. [unref(nsInput).bm("group", "prepend")]: _ctx.$slots.prepend,
  4237. [unref(nsInput).m("prefix")]: _ctx.$slots.prefix || _ctx.prefixIcon,
  4238. [unref(nsInput).m("suffix")]: _ctx.$slots.suffix || _ctx.suffixIcon || _ctx.clearable || _ctx.showPassword,
  4239. [unref(nsInput).bm("suffix", "password-clear")]: unref(showClear) && unref(showPwdVisible)
  4240. },
  4241. _ctx.$attrs.class
  4242. ]),
  4243. style: normalizeStyle(unref(containerStyle)),
  4244. onMouseenter: handleMouseEnter,
  4245. onMouseleave: handleMouseLeave
  4246. }, [
  4247. createCommentVNode(" input "),
  4248. _ctx.type !== "textarea" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  4249. createCommentVNode(" prepend slot "),
  4250. _ctx.$slots.prepend ? (openBlock(), createElementBlock("div", {
  4251. key: 0,
  4252. class: normalizeClass(unref(nsInput).be("group", "prepend"))
  4253. }, [
  4254. renderSlot(_ctx.$slots, "prepend")
  4255. ], 2)) : createCommentVNode("v-if", true),
  4256. createElementVNode("div", {
  4257. class: normalizeClass([unref(nsInput).e("wrapper"), unref(nsInput).is("focus", focused.value)])
  4258. }, [
  4259. createCommentVNode(" prefix slot "),
  4260. _ctx.$slots.prefix || _ctx.prefixIcon ? (openBlock(), createElementBlock("span", {
  4261. key: 0,
  4262. class: normalizeClass(unref(nsInput).e("prefix"))
  4263. }, [
  4264. createElementVNode("span", {
  4265. class: normalizeClass(unref(nsInput).e("prefix-inner"))
  4266. }, [
  4267. renderSlot(_ctx.$slots, "prefix"),
  4268. _ctx.prefixIcon ? (openBlock(), createBlock(unref(ElIcon), {
  4269. key: 0,
  4270. class: normalizeClass(unref(nsInput).e("icon"))
  4271. }, {
  4272. default: withCtx(() => [
  4273. (openBlock(), createBlock(resolveDynamicComponent(_ctx.prefixIcon)))
  4274. ]),
  4275. _: 1
  4276. }, 8, ["class"])) : createCommentVNode("v-if", true)
  4277. ], 2)
  4278. ], 2)) : createCommentVNode("v-if", true),
  4279. createElementVNode("input", mergeProps({
  4280. ref_key: "input",
  4281. ref: input,
  4282. class: unref(nsInput).e("inner")
  4283. }, unref(attrs), {
  4284. type: _ctx.showPassword ? passwordVisible.value ? "text" : "password" : _ctx.type,
  4285. disabled: unref(inputDisabled),
  4286. readonly: _ctx.readonly,
  4287. autocomplete: _ctx.autocomplete,
  4288. tabindex: _ctx.tabindex,
  4289. "aria-label": _ctx.label,
  4290. placeholder: _ctx.placeholder,
  4291. style: _ctx.inputStyle,
  4292. onCompositionstart: handleCompositionStart,
  4293. onCompositionupdate: handleCompositionUpdate,
  4294. onCompositionend: handleCompositionEnd,
  4295. onInput: handleInput,
  4296. onFocus: handleFocus,
  4297. onBlur: handleBlur,
  4298. onChange: handleChange2,
  4299. onKeydown: handleKeydown
  4300. }), null, 16, _hoisted_1$D),
  4301. createCommentVNode(" suffix slot "),
  4302. unref(suffixVisible) ? (openBlock(), createElementBlock("span", {
  4303. key: 1,
  4304. class: normalizeClass(unref(nsInput).e("suffix"))
  4305. }, [
  4306. createElementVNode("span", {
  4307. class: normalizeClass(unref(nsInput).e("suffix-inner"))
  4308. }, [
  4309. !unref(showClear) || !unref(showPwdVisible) || !unref(isWordLimitVisible) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  4310. renderSlot(_ctx.$slots, "suffix"),
  4311. _ctx.suffixIcon ? (openBlock(), createBlock(unref(ElIcon), {
  4312. key: 0,
  4313. class: normalizeClass(unref(nsInput).e("icon"))
  4314. }, {
  4315. default: withCtx(() => [
  4316. (openBlock(), createBlock(resolveDynamicComponent(_ctx.suffixIcon)))
  4317. ]),
  4318. _: 1
  4319. }, 8, ["class"])) : createCommentVNode("v-if", true)
  4320. ], 64)) : createCommentVNode("v-if", true),
  4321. unref(showClear) ? (openBlock(), createBlock(unref(ElIcon), {
  4322. key: 1,
  4323. class: normalizeClass([unref(nsInput).e("icon"), unref(nsInput).e("clear")]),
  4324. onMousedown: _cache[0] || (_cache[0] = withModifiers(() => {
  4325. }, ["prevent"])),
  4326. onClick: clear
  4327. }, {
  4328. default: withCtx(() => [
  4329. createVNode(unref(circleClose))
  4330. ]),
  4331. _: 1
  4332. }, 8, ["class"])) : createCommentVNode("v-if", true),
  4333. unref(showPwdVisible) ? (openBlock(), createBlock(unref(ElIcon), {
  4334. key: 2,
  4335. class: normalizeClass([unref(nsInput).e("icon"), unref(nsInput).e("password")]),
  4336. onClick: handlePasswordVisible
  4337. }, {
  4338. default: withCtx(() => [
  4339. (openBlock(), createBlock(resolveDynamicComponent(unref(passwordIcon))))
  4340. ]),
  4341. _: 1
  4342. }, 8, ["class"])) : createCommentVNode("v-if", true),
  4343. unref(isWordLimitVisible) ? (openBlock(), createElementBlock("span", {
  4344. key: 3,
  4345. class: normalizeClass(unref(nsInput).e("count"))
  4346. }, [
  4347. createElementVNode("span", {
  4348. class: normalizeClass(unref(nsInput).e("count-inner"))
  4349. }, toDisplayString(unref(textLength)) + " / " + toDisplayString(unref(attrs).maxlength), 3)
  4350. ], 2)) : createCommentVNode("v-if", true)
  4351. ], 2),
  4352. unref(validateState) && unref(validateIcon) && unref(needStatusIcon) ? (openBlock(), createBlock(unref(ElIcon), {
  4353. key: 0,
  4354. class: normalizeClass([
  4355. unref(nsInput).e("icon"),
  4356. unref(nsInput).e("validateIcon"),
  4357. unref(nsInput).is("loading", unref(validateState) === "validating")
  4358. ])
  4359. }, {
  4360. default: withCtx(() => [
  4361. (openBlock(), createBlock(resolveDynamicComponent(unref(validateIcon))))
  4362. ]),
  4363. _: 1
  4364. }, 8, ["class"])) : createCommentVNode("v-if", true)
  4365. ], 2)) : createCommentVNode("v-if", true)
  4366. ], 2),
  4367. createCommentVNode(" append slot "),
  4368. _ctx.$slots.append ? (openBlock(), createElementBlock("div", {
  4369. key: 1,
  4370. class: normalizeClass(unref(nsInput).be("group", "append"))
  4371. }, [
  4372. renderSlot(_ctx.$slots, "append")
  4373. ], 2)) : createCommentVNode("v-if", true)
  4374. ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  4375. createCommentVNode(" textarea "),
  4376. createElementVNode("textarea", mergeProps({
  4377. ref_key: "textarea",
  4378. ref: textarea,
  4379. class: unref(nsTextarea).e("inner")
  4380. }, unref(attrs), {
  4381. tabindex: _ctx.tabindex,
  4382. disabled: unref(inputDisabled),
  4383. readonly: _ctx.readonly,
  4384. autocomplete: _ctx.autocomplete,
  4385. style: unref(textareaStyle),
  4386. "aria-label": _ctx.label,
  4387. placeholder: _ctx.placeholder,
  4388. onCompositionstart: handleCompositionStart,
  4389. onCompositionupdate: handleCompositionUpdate,
  4390. onCompositionend: handleCompositionEnd,
  4391. onInput: handleInput,
  4392. onFocus: handleFocus,
  4393. onBlur: handleBlur,
  4394. onChange: handleChange2,
  4395. onKeydown: handleKeydown
  4396. }), null, 16, _hoisted_2$u),
  4397. unref(isWordLimitVisible) ? (openBlock(), createElementBlock("span", {
  4398. key: 0,
  4399. class: normalizeClass(unref(nsInput).e("count"))
  4400. }, toDisplayString(unref(textLength)) + " / " + toDisplayString(unref(attrs).maxlength), 3)) : createCommentVNode("v-if", true)
  4401. ], 64))
  4402. ], 38)), [
  4403. [vShow, _ctx.type !== "hidden"]
  4404. ]);
  4405. };
  4406. }
  4407. }));
  4408. var Input = /* @__PURE__ */ _export_sfc$1(_sfc_main$15, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/input/src/input.vue"]]);
  4409. const ElInput = withInstall(Input);
  4410. const BAR_MAP = {
  4411. vertical: {
  4412. offset: "offsetHeight",
  4413. scroll: "scrollTop",
  4414. scrollSize: "scrollHeight",
  4415. size: "height",
  4416. key: "vertical",
  4417. axis: "Y",
  4418. client: "clientY",
  4419. direction: "top"
  4420. },
  4421. horizontal: {
  4422. offset: "offsetWidth",
  4423. scroll: "scrollLeft",
  4424. scrollSize: "scrollWidth",
  4425. size: "width",
  4426. key: "horizontal",
  4427. axis: "X",
  4428. client: "clientX",
  4429. direction: "left"
  4430. }
  4431. };
  4432. const renderThumbStyle = ({ move, size, bar }) => ({
  4433. [bar.size]: size,
  4434. transform: `translate${bar.axis}(${move}%)`
  4435. });
  4436. const thumbProps = buildProps({
  4437. vertical: Boolean,
  4438. size: String,
  4439. move: Number,
  4440. ratio: {
  4441. type: Number,
  4442. required: true
  4443. },
  4444. always: Boolean
  4445. });
  4446. const COMPONENT_NAME$4 = "Thumb";
  4447. const _sfc_main$14 = defineComponent({
  4448. name: COMPONENT_NAME$4,
  4449. props: thumbProps,
  4450. setup(props) {
  4451. const scrollbar = inject(scrollbarContextKey);
  4452. const ns = useNamespace("scrollbar");
  4453. if (!scrollbar)
  4454. throwError(COMPONENT_NAME$4, "can not inject scrollbar context");
  4455. const instance = ref();
  4456. const thumb = ref();
  4457. const thumbState = ref({});
  4458. const visible = ref(false);
  4459. let cursorDown = false;
  4460. let cursorLeave = false;
  4461. let originalOnSelectStart = isClient ? document.onselectstart : null;
  4462. const bar = computed(() => BAR_MAP[props.vertical ? "vertical" : "horizontal"]);
  4463. const thumbStyle = computed(() => renderThumbStyle({
  4464. size: props.size,
  4465. move: props.move,
  4466. bar: bar.value
  4467. }));
  4468. const offsetRatio = computed(() => instance.value[bar.value.offset] ** 2 / scrollbar.wrapElement[bar.value.scrollSize] / props.ratio / thumb.value[bar.value.offset]);
  4469. const clickThumbHandler = (e) => {
  4470. var _a2;
  4471. e.stopPropagation();
  4472. if (e.ctrlKey || [1, 2].includes(e.button))
  4473. return;
  4474. (_a2 = window.getSelection()) == null ? void 0 : _a2.removeAllRanges();
  4475. startDrag(e);
  4476. const el = e.currentTarget;
  4477. if (!el)
  4478. return;
  4479. thumbState.value[bar.value.axis] = el[bar.value.offset] - (e[bar.value.client] - el.getBoundingClientRect()[bar.value.direction]);
  4480. };
  4481. const clickTrackHandler = (e) => {
  4482. if (!thumb.value || !instance.value || !scrollbar.wrapElement)
  4483. return;
  4484. const offset2 = Math.abs(e.target.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]);
  4485. const thumbHalf = thumb.value[bar.value.offset] / 2;
  4486. const thumbPositionPercentage = (offset2 - thumbHalf) * 100 * offsetRatio.value / instance.value[bar.value.offset];
  4487. scrollbar.wrapElement[bar.value.scroll] = thumbPositionPercentage * scrollbar.wrapElement[bar.value.scrollSize] / 100;
  4488. };
  4489. const startDrag = (e) => {
  4490. e.stopImmediatePropagation();
  4491. cursorDown = true;
  4492. document.addEventListener("mousemove", mouseMoveDocumentHandler);
  4493. document.addEventListener("mouseup", mouseUpDocumentHandler);
  4494. originalOnSelectStart = document.onselectstart;
  4495. document.onselectstart = () => false;
  4496. };
  4497. const mouseMoveDocumentHandler = (e) => {
  4498. if (!instance.value || !thumb.value)
  4499. return;
  4500. if (cursorDown === false)
  4501. return;
  4502. const prevPage = thumbState.value[bar.value.axis];
  4503. if (!prevPage)
  4504. return;
  4505. const offset2 = (instance.value.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]) * -1;
  4506. const thumbClickPosition = thumb.value[bar.value.offset] - prevPage;
  4507. const thumbPositionPercentage = (offset2 - thumbClickPosition) * 100 * offsetRatio.value / instance.value[bar.value.offset];
  4508. scrollbar.wrapElement[bar.value.scroll] = thumbPositionPercentage * scrollbar.wrapElement[bar.value.scrollSize] / 100;
  4509. };
  4510. const mouseUpDocumentHandler = () => {
  4511. cursorDown = false;
  4512. thumbState.value[bar.value.axis] = 0;
  4513. document.removeEventListener("mousemove", mouseMoveDocumentHandler);
  4514. document.removeEventListener("mouseup", mouseUpDocumentHandler);
  4515. restoreOnselectstart();
  4516. if (cursorLeave)
  4517. visible.value = false;
  4518. };
  4519. const mouseMoveScrollbarHandler = () => {
  4520. cursorLeave = false;
  4521. visible.value = !!props.size;
  4522. };
  4523. const mouseLeaveScrollbarHandler = () => {
  4524. cursorLeave = true;
  4525. visible.value = cursorDown;
  4526. };
  4527. onBeforeUnmount(() => {
  4528. restoreOnselectstart();
  4529. document.removeEventListener("mouseup", mouseUpDocumentHandler);
  4530. });
  4531. const restoreOnselectstart = () => {
  4532. if (document.onselectstart !== originalOnSelectStart)
  4533. document.onselectstart = originalOnSelectStart;
  4534. };
  4535. useEventListener(toRef(scrollbar, "scrollbarElement"), "mousemove", mouseMoveScrollbarHandler);
  4536. useEventListener(toRef(scrollbar, "scrollbarElement"), "mouseleave", mouseLeaveScrollbarHandler);
  4537. return {
  4538. ns,
  4539. instance,
  4540. thumb,
  4541. bar,
  4542. thumbStyle,
  4543. visible,
  4544. clickTrackHandler,
  4545. clickThumbHandler
  4546. };
  4547. }
  4548. });
  4549. function _sfc_render$D(_ctx, _cache, $props, $setup, $data, $options) {
  4550. return openBlock(), createBlock(Transition, {
  4551. name: _ctx.ns.b("fade")
  4552. }, {
  4553. default: withCtx(() => [
  4554. withDirectives(createElementVNode("div", {
  4555. ref: "instance",
  4556. class: normalizeClass([_ctx.ns.e("bar"), _ctx.ns.is(_ctx.bar.key)]),
  4557. onMousedown: _cache[1] || (_cache[1] = (...args) => _ctx.clickTrackHandler && _ctx.clickTrackHandler(...args))
  4558. }, [
  4559. createElementVNode("div", {
  4560. ref: "thumb",
  4561. class: normalizeClass(_ctx.ns.e("thumb")),
  4562. style: normalizeStyle(_ctx.thumbStyle),
  4563. onMousedown: _cache[0] || (_cache[0] = (...args) => _ctx.clickThumbHandler && _ctx.clickThumbHandler(...args))
  4564. }, null, 38)
  4565. ], 34), [
  4566. [vShow, _ctx.always || _ctx.visible]
  4567. ])
  4568. ]),
  4569. _: 1
  4570. }, 8, ["name"]);
  4571. }
  4572. var Thumb = /* @__PURE__ */ _export_sfc$1(_sfc_main$14, [["render", _sfc_render$D], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/scrollbar/src/thumb.vue"]]);
  4573. const barProps = buildProps({
  4574. always: {
  4575. type: Boolean,
  4576. default: true
  4577. },
  4578. width: {
  4579. type: String,
  4580. default: ""
  4581. },
  4582. height: {
  4583. type: String,
  4584. default: ""
  4585. },
  4586. ratioX: {
  4587. type: Number,
  4588. default: 1
  4589. },
  4590. ratioY: {
  4591. type: Number,
  4592. default: 1
  4593. }
  4594. });
  4595. const _sfc_main$13 = defineComponent({
  4596. components: {
  4597. Thumb
  4598. },
  4599. props: barProps,
  4600. setup(props) {
  4601. const moveX = ref(0);
  4602. const moveY = ref(0);
  4603. const GAP = 4;
  4604. const handleScroll = (wrap) => {
  4605. if (wrap) {
  4606. const offsetHeight = wrap.offsetHeight - GAP;
  4607. const offsetWidth = wrap.offsetWidth - GAP;
  4608. moveY.value = wrap.scrollTop * 100 / offsetHeight * props.ratioY;
  4609. moveX.value = wrap.scrollLeft * 100 / offsetWidth * props.ratioX;
  4610. }
  4611. };
  4612. return {
  4613. handleScroll,
  4614. moveX,
  4615. moveY
  4616. };
  4617. }
  4618. });
  4619. function _sfc_render$C(_ctx, _cache, $props, $setup, $data, $options) {
  4620. const _component_thumb = resolveComponent("thumb");
  4621. return openBlock(), createElementBlock(Fragment, null, [
  4622. createVNode(_component_thumb, {
  4623. move: _ctx.moveX,
  4624. ratio: _ctx.ratioX,
  4625. size: _ctx.width,
  4626. always: _ctx.always
  4627. }, null, 8, ["move", "ratio", "size", "always"]),
  4628. createVNode(_component_thumb, {
  4629. move: _ctx.moveY,
  4630. ratio: _ctx.ratioY,
  4631. size: _ctx.height,
  4632. vertical: "",
  4633. always: _ctx.always
  4634. }, null, 8, ["move", "ratio", "size", "always"])
  4635. ], 64);
  4636. }
  4637. var Bar = /* @__PURE__ */ _export_sfc$1(_sfc_main$13, [["render", _sfc_render$C], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/scrollbar/src/bar.vue"]]);
  4638. const scrollbarProps = buildProps({
  4639. height: {
  4640. type: [String, Number],
  4641. default: ""
  4642. },
  4643. maxHeight: {
  4644. type: [String, Number],
  4645. default: ""
  4646. },
  4647. native: {
  4648. type: Boolean,
  4649. default: false
  4650. },
  4651. wrapStyle: {
  4652. type: definePropType([String, Object, Array]),
  4653. default: ""
  4654. },
  4655. wrapClass: {
  4656. type: [String, Array],
  4657. default: ""
  4658. },
  4659. viewClass: {
  4660. type: [String, Array],
  4661. default: ""
  4662. },
  4663. viewStyle: {
  4664. type: [String, Array, Object],
  4665. default: ""
  4666. },
  4667. noresize: Boolean,
  4668. tag: {
  4669. type: String,
  4670. default: "div"
  4671. },
  4672. always: {
  4673. type: Boolean,
  4674. default: false
  4675. },
  4676. minSize: {
  4677. type: Number,
  4678. default: 20
  4679. }
  4680. });
  4681. const scrollbarEmits = {
  4682. scroll: ({
  4683. scrollTop,
  4684. scrollLeft
  4685. }) => isNumber(scrollTop) && isNumber(scrollLeft)
  4686. };
  4687. const _sfc_main$12 = defineComponent({
  4688. name: "ElScrollbar",
  4689. components: {
  4690. Bar
  4691. },
  4692. props: scrollbarProps,
  4693. emits: scrollbarEmits,
  4694. setup(props, { emit }) {
  4695. const ns = useNamespace("scrollbar");
  4696. let stopResizeObserver = void 0;
  4697. let stopResizeListener = void 0;
  4698. const scrollbar$ = ref();
  4699. const wrap$ = ref();
  4700. const resize$ = ref();
  4701. const sizeWidth = ref("0");
  4702. const sizeHeight = ref("0");
  4703. const barRef = ref();
  4704. const moveX = ref(0);
  4705. const moveY = ref(0);
  4706. const ratioY = ref(1);
  4707. const ratioX = ref(1);
  4708. const GAP = 4;
  4709. const style = computed(() => {
  4710. const style2 = {};
  4711. if (props.height)
  4712. style2.height = addUnit(props.height);
  4713. if (props.maxHeight)
  4714. style2.maxHeight = addUnit(props.maxHeight);
  4715. return [props.wrapStyle, style2];
  4716. });
  4717. const handleScroll = () => {
  4718. var _a2;
  4719. if (wrap$.value) {
  4720. (_a2 = barRef.value) == null ? void 0 : _a2.handleScroll(wrap$.value);
  4721. emit("scroll", {
  4722. scrollTop: wrap$.value.scrollTop,
  4723. scrollLeft: wrap$.value.scrollLeft
  4724. });
  4725. }
  4726. };
  4727. function scrollTo(arg1, arg2) {
  4728. if (isObject$1(arg1)) {
  4729. wrap$.value.scrollTo(arg1);
  4730. } else if (isNumber(arg1) && isNumber(arg2)) {
  4731. wrap$.value.scrollTo(arg1, arg2);
  4732. }
  4733. }
  4734. const setScrollTop = (value) => {
  4735. if (!isNumber(value)) {
  4736. return;
  4737. }
  4738. wrap$.value.scrollTop = value;
  4739. };
  4740. const setScrollLeft = (value) => {
  4741. if (!isNumber(value)) {
  4742. return;
  4743. }
  4744. wrap$.value.scrollLeft = value;
  4745. };
  4746. const update = () => {
  4747. if (!wrap$.value)
  4748. return;
  4749. const offsetHeight = wrap$.value.offsetHeight - GAP;
  4750. const offsetWidth = wrap$.value.offsetWidth - GAP;
  4751. const originalHeight = offsetHeight ** 2 / wrap$.value.scrollHeight;
  4752. const originalWidth = offsetWidth ** 2 / wrap$.value.scrollWidth;
  4753. const height = Math.max(originalHeight, props.minSize);
  4754. const width = Math.max(originalWidth, props.minSize);
  4755. ratioY.value = originalHeight / (offsetHeight - originalHeight) / (height / (offsetHeight - height));
  4756. ratioX.value = originalWidth / (offsetWidth - originalWidth) / (width / (offsetWidth - width));
  4757. sizeHeight.value = height + GAP < offsetHeight ? `${height}px` : "";
  4758. sizeWidth.value = width + GAP < offsetWidth ? `${width}px` : "";
  4759. };
  4760. watch(() => props.noresize, (noresize) => {
  4761. if (noresize) {
  4762. stopResizeObserver == null ? void 0 : stopResizeObserver();
  4763. stopResizeListener == null ? void 0 : stopResizeListener();
  4764. } else {
  4765. ({ stop: stopResizeObserver } = useResizeObserver(resize$, update));
  4766. stopResizeListener = useEventListener("resize", update);
  4767. }
  4768. }, { immediate: true });
  4769. watch(() => [props.maxHeight, props.height], () => {
  4770. if (!props.native)
  4771. nextTick(() => {
  4772. var _a2;
  4773. update();
  4774. if (wrap$.value) {
  4775. (_a2 = barRef.value) == null ? void 0 : _a2.handleScroll(wrap$.value);
  4776. }
  4777. });
  4778. });
  4779. provide(scrollbarContextKey, reactive({
  4780. scrollbarElement: scrollbar$,
  4781. wrapElement: wrap$
  4782. }));
  4783. onMounted(() => {
  4784. if (!props.native)
  4785. nextTick(() => update());
  4786. });
  4787. onUpdated(() => update());
  4788. return {
  4789. ns,
  4790. scrollbar$,
  4791. wrap$,
  4792. resize$,
  4793. barRef,
  4794. moveX,
  4795. moveY,
  4796. ratioX,
  4797. ratioY,
  4798. sizeWidth,
  4799. sizeHeight,
  4800. style,
  4801. update,
  4802. handleScroll,
  4803. scrollTo,
  4804. setScrollTop,
  4805. setScrollLeft
  4806. };
  4807. }
  4808. });
  4809. function _sfc_render$B(_ctx, _cache, $props, $setup, $data, $options) {
  4810. const _component_bar = resolveComponent("bar");
  4811. return openBlock(), createElementBlock("div", {
  4812. ref: "scrollbar$",
  4813. class: normalizeClass(_ctx.ns.b())
  4814. }, [
  4815. createElementVNode("div", {
  4816. ref: "wrap$",
  4817. class: normalizeClass([
  4818. _ctx.wrapClass,
  4819. _ctx.ns.e("wrap"),
  4820. { [_ctx.ns.em("wrap", "hidden-default")]: !_ctx.native }
  4821. ]),
  4822. style: normalizeStyle(_ctx.style),
  4823. onScroll: _cache[0] || (_cache[0] = (...args) => _ctx.handleScroll && _ctx.handleScroll(...args))
  4824. }, [
  4825. (openBlock(), createBlock(resolveDynamicComponent(_ctx.tag), {
  4826. ref: "resize$",
  4827. class: normalizeClass([_ctx.ns.e("view"), _ctx.viewClass]),
  4828. style: normalizeStyle(_ctx.viewStyle)
  4829. }, {
  4830. default: withCtx(() => [
  4831. renderSlot(_ctx.$slots, "default")
  4832. ]),
  4833. _: 3
  4834. }, 8, ["class", "style"]))
  4835. ], 38),
  4836. !_ctx.native ? (openBlock(), createBlock(_component_bar, {
  4837. key: 0,
  4838. ref: "barRef",
  4839. height: _ctx.sizeHeight,
  4840. width: _ctx.sizeWidth,
  4841. always: _ctx.always,
  4842. "ratio-x": _ctx.ratioX,
  4843. "ratio-y": _ctx.ratioY
  4844. }, null, 8, ["height", "width", "always", "ratio-x", "ratio-y"])) : createCommentVNode("v-if", true)
  4845. ], 2);
  4846. }
  4847. var Scrollbar = /* @__PURE__ */ _export_sfc$1(_sfc_main$12, [["render", _sfc_render$B], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/scrollbar/src/scrollbar.vue"]]);
  4848. const ElScrollbar = withInstall(Scrollbar);
  4849. const __default__$j = {
  4850. name: "ElPopperRoot",
  4851. inheritAttrs: false
  4852. };
  4853. const _sfc_main$11 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$j), {
  4854. setup(__props, { expose }) {
  4855. const triggerRef2 = ref();
  4856. const popperInstanceRef = ref();
  4857. const contentRef = ref();
  4858. const referenceRef = ref();
  4859. const popperProvides = {
  4860. triggerRef: triggerRef2,
  4861. popperInstanceRef,
  4862. contentRef,
  4863. referenceRef
  4864. };
  4865. expose(popperProvides);
  4866. provide(POPPER_INJECTION_KEY, popperProvides);
  4867. return (_ctx, _cache) => {
  4868. return renderSlot(_ctx.$slots, "default");
  4869. };
  4870. }
  4871. }));
  4872. var Popper = /* @__PURE__ */ _export_sfc$1(_sfc_main$11, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/popper/src/popper.vue"]]);
  4873. const usePopperArrowProps = buildProps({
  4874. arrowOffset: {
  4875. type: Number,
  4876. default: 5
  4877. }
  4878. });
  4879. const __default__$i = {
  4880. name: "ElPopperArrow",
  4881. inheritAttrs: false
  4882. };
  4883. const _sfc_main$10 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$i), {
  4884. props: usePopperArrowProps,
  4885. setup(__props, { expose }) {
  4886. const props = __props;
  4887. const ns = useNamespace("popper");
  4888. const { arrowOffset, arrowRef } = inject(POPPER_CONTENT_INJECTION_KEY, void 0);
  4889. watch(() => props.arrowOffset, (val) => {
  4890. arrowOffset.value = val;
  4891. });
  4892. onBeforeUnmount(() => {
  4893. arrowRef.value = void 0;
  4894. });
  4895. expose({
  4896. arrowRef
  4897. });
  4898. return (_ctx, _cache) => {
  4899. return openBlock(), createElementBlock("span", {
  4900. ref_key: "arrowRef",
  4901. ref: arrowRef,
  4902. class: normalizeClass(unref(ns).e("arrow")),
  4903. "data-popper-arrow": ""
  4904. }, null, 2);
  4905. };
  4906. }
  4907. }));
  4908. var ElPopperArrow = /* @__PURE__ */ _export_sfc$1(_sfc_main$10, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/popper/src/arrow.vue"]]);
  4909. const NAME = "ElOnlyChild";
  4910. const OnlyChild = defineComponent({
  4911. name: NAME,
  4912. setup(_2, {
  4913. slots,
  4914. attrs
  4915. }) {
  4916. var _a2;
  4917. const forwardRefInjection = inject(FORWARD_REF_INJECTION_KEY);
  4918. const forwardRefDirective = useForwardRefDirective((_a2 = forwardRefInjection == null ? void 0 : forwardRefInjection.setForwardRef) != null ? _a2 : NOOP);
  4919. return () => {
  4920. var _a22;
  4921. const defaultSlot = (_a22 = slots.default) == null ? void 0 : _a22.call(slots, attrs);
  4922. if (!defaultSlot)
  4923. return null;
  4924. if (defaultSlot.length > 1) {
  4925. return null;
  4926. }
  4927. const firstLegitNode = findFirstLegitChild(defaultSlot);
  4928. if (!firstLegitNode) {
  4929. return null;
  4930. }
  4931. return withDirectives(cloneVNode(firstLegitNode, attrs), [[forwardRefDirective]]);
  4932. };
  4933. }
  4934. });
  4935. function findFirstLegitChild(node) {
  4936. if (!node)
  4937. return null;
  4938. const children = node;
  4939. for (const child of children) {
  4940. if (isObject$1(child)) {
  4941. switch (child.type) {
  4942. case Comment:
  4943. continue;
  4944. case Text:
  4945. return wrapTextContent(child);
  4946. case "svg":
  4947. return wrapTextContent(child);
  4948. case Fragment:
  4949. return findFirstLegitChild(child.children);
  4950. default:
  4951. return child;
  4952. }
  4953. }
  4954. return wrapTextContent(child);
  4955. }
  4956. return null;
  4957. }
  4958. function wrapTextContent(s2) {
  4959. return createVNode("span", {
  4960. "class": "el-only-child__content"
  4961. }, [s2]);
  4962. }
  4963. const usePopperTriggerProps = buildProps({
  4964. virtualRef: {
  4965. type: definePropType(Object)
  4966. },
  4967. virtualTriggering: Boolean,
  4968. onMouseenter: Function,
  4969. onMouseleave: Function,
  4970. onClick: Function,
  4971. onKeydown: Function,
  4972. onFocus: Function,
  4973. onBlur: Function,
  4974. onContextmenu: Function,
  4975. id: String,
  4976. open: Boolean
  4977. });
  4978. const __default__$h = {
  4979. name: "ElPopperTrigger",
  4980. inheritAttrs: false
  4981. };
  4982. const _sfc_main$$ = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$h), {
  4983. props: usePopperTriggerProps,
  4984. setup(__props, { expose }) {
  4985. const props = __props;
  4986. const { triggerRef: triggerRef2 } = inject(POPPER_INJECTION_KEY, void 0);
  4987. useForwardRef(triggerRef2);
  4988. onMounted(() => {
  4989. watch(() => props.virtualRef, (virtualEl) => {
  4990. if (virtualEl) {
  4991. triggerRef2.value = unrefElement(virtualEl);
  4992. }
  4993. }, {
  4994. immediate: true
  4995. });
  4996. watch(() => triggerRef2.value, (el, prevEl) => {
  4997. if (isElement$1(el)) {
  4998. [
  4999. "onMouseenter",
  5000. "onMouseleave",
  5001. "onClick",
  5002. "onKeydown",
  5003. "onFocus",
  5004. "onBlur",
  5005. "onContextmenu"
  5006. ].forEach((eventName) => {
  5007. var _a2;
  5008. const handler3 = props[eventName];
  5009. if (handler3) {
  5010. el.addEventListener(eventName.slice(2).toLowerCase(), handler3);
  5011. (_a2 = prevEl == null ? void 0 : prevEl.removeEventListener) == null ? void 0 : _a2.call(prevEl, eventName.slice(2).toLowerCase(), handler3);
  5012. }
  5013. });
  5014. }
  5015. }, {
  5016. immediate: true
  5017. });
  5018. });
  5019. expose({
  5020. triggerRef: triggerRef2
  5021. });
  5022. return (_ctx, _cache) => {
  5023. return !_ctx.virtualTriggering ? (openBlock(), createBlock(unref(OnlyChild), mergeProps({ key: 0 }, _ctx.$attrs, {
  5024. "aria-describedby": _ctx.open ? _ctx.id : void 0
  5025. }), {
  5026. default: withCtx(() => [
  5027. renderSlot(_ctx.$slots, "default")
  5028. ]),
  5029. _: 3
  5030. }, 16, ["aria-describedby"])) : createCommentVNode("v-if", true);
  5031. };
  5032. }
  5033. }));
  5034. var ElPopperTrigger = /* @__PURE__ */ _export_sfc$1(_sfc_main$$, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/popper/src/trigger.vue"]]);
  5035. var top = "top";
  5036. var bottom = "bottom";
  5037. var right = "right";
  5038. var left = "left";
  5039. var auto = "auto";
  5040. var basePlacements = [top, bottom, right, left];
  5041. var start = "start";
  5042. var end = "end";
  5043. var clippingParents = "clippingParents";
  5044. var viewport = "viewport";
  5045. var popper = "popper";
  5046. var reference = "reference";
  5047. var variationPlacements = /* @__PURE__ */ basePlacements.reduce(function(acc, placement) {
  5048. return acc.concat([placement + "-" + start, placement + "-" + end]);
  5049. }, []);
  5050. var placements = /* @__PURE__ */ [].concat(basePlacements, [auto]).reduce(function(acc, placement) {
  5051. return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
  5052. }, []);
  5053. var beforeRead = "beforeRead";
  5054. var read = "read";
  5055. var afterRead = "afterRead";
  5056. var beforeMain = "beforeMain";
  5057. var main = "main";
  5058. var afterMain = "afterMain";
  5059. var beforeWrite = "beforeWrite";
  5060. var write = "write";
  5061. var afterWrite = "afterWrite";
  5062. var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
  5063. function getNodeName(element) {
  5064. return element ? (element.nodeName || "").toLowerCase() : null;
  5065. }
  5066. function getWindow(node) {
  5067. if (node == null) {
  5068. return window;
  5069. }
  5070. if (node.toString() !== "[object Window]") {
  5071. var ownerDocument = node.ownerDocument;
  5072. return ownerDocument ? ownerDocument.defaultView || window : window;
  5073. }
  5074. return node;
  5075. }
  5076. function isElement(node) {
  5077. var OwnElement = getWindow(node).Element;
  5078. return node instanceof OwnElement || node instanceof Element;
  5079. }
  5080. function isHTMLElement(node) {
  5081. var OwnElement = getWindow(node).HTMLElement;
  5082. return node instanceof OwnElement || node instanceof HTMLElement;
  5083. }
  5084. function isShadowRoot(node) {
  5085. if (typeof ShadowRoot === "undefined") {
  5086. return false;
  5087. }
  5088. var OwnElement = getWindow(node).ShadowRoot;
  5089. return node instanceof OwnElement || node instanceof ShadowRoot;
  5090. }
  5091. function applyStyles(_ref) {
  5092. var state = _ref.state;
  5093. Object.keys(state.elements).forEach(function(name) {
  5094. var style = state.styles[name] || {};
  5095. var attributes = state.attributes[name] || {};
  5096. var element = state.elements[name];
  5097. if (!isHTMLElement(element) || !getNodeName(element)) {
  5098. return;
  5099. }
  5100. Object.assign(element.style, style);
  5101. Object.keys(attributes).forEach(function(name2) {
  5102. var value = attributes[name2];
  5103. if (value === false) {
  5104. element.removeAttribute(name2);
  5105. } else {
  5106. element.setAttribute(name2, value === true ? "" : value);
  5107. }
  5108. });
  5109. });
  5110. }
  5111. function effect$2(_ref2) {
  5112. var state = _ref2.state;
  5113. var initialStyles = {
  5114. popper: {
  5115. position: state.options.strategy,
  5116. left: "0",
  5117. top: "0",
  5118. margin: "0"
  5119. },
  5120. arrow: {
  5121. position: "absolute"
  5122. },
  5123. reference: {}
  5124. };
  5125. Object.assign(state.elements.popper.style, initialStyles.popper);
  5126. state.styles = initialStyles;
  5127. if (state.elements.arrow) {
  5128. Object.assign(state.elements.arrow.style, initialStyles.arrow);
  5129. }
  5130. return function() {
  5131. Object.keys(state.elements).forEach(function(name) {
  5132. var element = state.elements[name];
  5133. var attributes = state.attributes[name] || {};
  5134. var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]);
  5135. var style = styleProperties.reduce(function(style2, property) {
  5136. style2[property] = "";
  5137. return style2;
  5138. }, {});
  5139. if (!isHTMLElement(element) || !getNodeName(element)) {
  5140. return;
  5141. }
  5142. Object.assign(element.style, style);
  5143. Object.keys(attributes).forEach(function(attribute) {
  5144. element.removeAttribute(attribute);
  5145. });
  5146. });
  5147. };
  5148. }
  5149. var applyStyles$1 = {
  5150. name: "applyStyles",
  5151. enabled: true,
  5152. phase: "write",
  5153. fn: applyStyles,
  5154. effect: effect$2,
  5155. requires: ["computeStyles"]
  5156. };
  5157. function getBasePlacement(placement) {
  5158. return placement.split("-")[0];
  5159. }
  5160. var max = Math.max;
  5161. var min = Math.min;
  5162. var round = Math.round;
  5163. function getUAString() {
  5164. var uaData = navigator.userAgentData;
  5165. if (uaData != null && uaData.brands && Array.isArray(uaData.brands)) {
  5166. return uaData.brands.map(function(item) {
  5167. return item.brand + "/" + item.version;
  5168. }).join(" ");
  5169. }
  5170. return navigator.userAgent;
  5171. }
  5172. function isLayoutViewport() {
  5173. return !/^((?!chrome|android).)*safari/i.test(getUAString());
  5174. }
  5175. function getBoundingClientRect(element, includeScale, isFixedStrategy) {
  5176. if (includeScale === void 0) {
  5177. includeScale = false;
  5178. }
  5179. if (isFixedStrategy === void 0) {
  5180. isFixedStrategy = false;
  5181. }
  5182. var clientRect = element.getBoundingClientRect();
  5183. var scaleX = 1;
  5184. var scaleY = 1;
  5185. if (includeScale && isHTMLElement(element)) {
  5186. scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
  5187. scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
  5188. }
  5189. var _ref = isElement(element) ? getWindow(element) : window, visualViewport = _ref.visualViewport;
  5190. var addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
  5191. var x2 = (clientRect.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX;
  5192. var y = (clientRect.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY;
  5193. var width = clientRect.width / scaleX;
  5194. var height = clientRect.height / scaleY;
  5195. return {
  5196. width,
  5197. height,
  5198. top: y,
  5199. right: x2 + width,
  5200. bottom: y + height,
  5201. left: x2,
  5202. x: x2,
  5203. y
  5204. };
  5205. }
  5206. function getLayoutRect(element) {
  5207. var clientRect = getBoundingClientRect(element);
  5208. var width = element.offsetWidth;
  5209. var height = element.offsetHeight;
  5210. if (Math.abs(clientRect.width - width) <= 1) {
  5211. width = clientRect.width;
  5212. }
  5213. if (Math.abs(clientRect.height - height) <= 1) {
  5214. height = clientRect.height;
  5215. }
  5216. return {
  5217. x: element.offsetLeft,
  5218. y: element.offsetTop,
  5219. width,
  5220. height
  5221. };
  5222. }
  5223. function contains(parent, child) {
  5224. var rootNode = child.getRootNode && child.getRootNode();
  5225. if (parent.contains(child)) {
  5226. return true;
  5227. } else if (rootNode && isShadowRoot(rootNode)) {
  5228. var next = child;
  5229. do {
  5230. if (next && parent.isSameNode(next)) {
  5231. return true;
  5232. }
  5233. next = next.parentNode || next.host;
  5234. } while (next);
  5235. }
  5236. return false;
  5237. }
  5238. function getComputedStyle$1(element) {
  5239. return getWindow(element).getComputedStyle(element);
  5240. }
  5241. function isTableElement(element) {
  5242. return ["table", "td", "th"].indexOf(getNodeName(element)) >= 0;
  5243. }
  5244. function getDocumentElement(element) {
  5245. return ((isElement(element) ? element.ownerDocument : element.document) || window.document).documentElement;
  5246. }
  5247. function getParentNode(element) {
  5248. if (getNodeName(element) === "html") {
  5249. return element;
  5250. }
  5251. return element.assignedSlot || element.parentNode || (isShadowRoot(element) ? element.host : null) || getDocumentElement(element);
  5252. }
  5253. function getTrueOffsetParent(element) {
  5254. if (!isHTMLElement(element) || getComputedStyle$1(element).position === "fixed") {
  5255. return null;
  5256. }
  5257. return element.offsetParent;
  5258. }
  5259. function getContainingBlock(element) {
  5260. var isFirefox2 = /firefox/i.test(getUAString());
  5261. var isIE = /Trident/i.test(getUAString());
  5262. if (isIE && isHTMLElement(element)) {
  5263. var elementCss = getComputedStyle$1(element);
  5264. if (elementCss.position === "fixed") {
  5265. return null;
  5266. }
  5267. }
  5268. var currentNode = getParentNode(element);
  5269. if (isShadowRoot(currentNode)) {
  5270. currentNode = currentNode.host;
  5271. }
  5272. while (isHTMLElement(currentNode) && ["html", "body"].indexOf(getNodeName(currentNode)) < 0) {
  5273. var css = getComputedStyle$1(currentNode);
  5274. if (css.transform !== "none" || css.perspective !== "none" || css.contain === "paint" || ["transform", "perspective"].indexOf(css.willChange) !== -1 || isFirefox2 && css.willChange === "filter" || isFirefox2 && css.filter && css.filter !== "none") {
  5275. return currentNode;
  5276. } else {
  5277. currentNode = currentNode.parentNode;
  5278. }
  5279. }
  5280. return null;
  5281. }
  5282. function getOffsetParent(element) {
  5283. var window2 = getWindow(element);
  5284. var offsetParent = getTrueOffsetParent(element);
  5285. while (offsetParent && isTableElement(offsetParent) && getComputedStyle$1(offsetParent).position === "static") {
  5286. offsetParent = getTrueOffsetParent(offsetParent);
  5287. }
  5288. if (offsetParent && (getNodeName(offsetParent) === "html" || getNodeName(offsetParent) === "body" && getComputedStyle$1(offsetParent).position === "static")) {
  5289. return window2;
  5290. }
  5291. return offsetParent || getContainingBlock(element) || window2;
  5292. }
  5293. function getMainAxisFromPlacement(placement) {
  5294. return ["top", "bottom"].indexOf(placement) >= 0 ? "x" : "y";
  5295. }
  5296. function within(min$1, value, max$1) {
  5297. return max(min$1, min(value, max$1));
  5298. }
  5299. function withinMaxClamp(min2, value, max2) {
  5300. var v2 = within(min2, value, max2);
  5301. return v2 > max2 ? max2 : v2;
  5302. }
  5303. function getFreshSideObject() {
  5304. return {
  5305. top: 0,
  5306. right: 0,
  5307. bottom: 0,
  5308. left: 0
  5309. };
  5310. }
  5311. function mergePaddingObject(paddingObject) {
  5312. return Object.assign({}, getFreshSideObject(), paddingObject);
  5313. }
  5314. function expandToHashMap(value, keys2) {
  5315. return keys2.reduce(function(hashMap, key) {
  5316. hashMap[key] = value;
  5317. return hashMap;
  5318. }, {});
  5319. }
  5320. var toPaddingObject = function toPaddingObject2(padding, state) {
  5321. padding = typeof padding === "function" ? padding(Object.assign({}, state.rects, {
  5322. placement: state.placement
  5323. })) : padding;
  5324. return mergePaddingObject(typeof padding !== "number" ? padding : expandToHashMap(padding, basePlacements));
  5325. };
  5326. function arrow(_ref) {
  5327. var _state$modifiersData$;
  5328. var state = _ref.state, name = _ref.name, options = _ref.options;
  5329. var arrowElement = state.elements.arrow;
  5330. var popperOffsets2 = state.modifiersData.popperOffsets;
  5331. var basePlacement = getBasePlacement(state.placement);
  5332. var axis = getMainAxisFromPlacement(basePlacement);
  5333. var isVertical = [left, right].indexOf(basePlacement) >= 0;
  5334. var len = isVertical ? "height" : "width";
  5335. if (!arrowElement || !popperOffsets2) {
  5336. return;
  5337. }
  5338. var paddingObject = toPaddingObject(options.padding, state);
  5339. var arrowRect = getLayoutRect(arrowElement);
  5340. var minProp = axis === "y" ? top : left;
  5341. var maxProp = axis === "y" ? bottom : right;
  5342. var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets2[axis] - state.rects.popper[len];
  5343. var startDiff = popperOffsets2[axis] - state.rects.reference[axis];
  5344. var arrowOffsetParent = getOffsetParent(arrowElement);
  5345. var clientSize = arrowOffsetParent ? axis === "y" ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
  5346. var centerToReference = endDiff / 2 - startDiff / 2;
  5347. var min2 = paddingObject[minProp];
  5348. var max2 = clientSize - arrowRect[len] - paddingObject[maxProp];
  5349. var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;
  5350. var offset2 = within(min2, center, max2);
  5351. var axisProp = axis;
  5352. state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset2, _state$modifiersData$.centerOffset = offset2 - center, _state$modifiersData$);
  5353. }
  5354. function effect$1(_ref2) {
  5355. var state = _ref2.state, options = _ref2.options;
  5356. var _options$element = options.element, arrowElement = _options$element === void 0 ? "[data-popper-arrow]" : _options$element;
  5357. if (arrowElement == null) {
  5358. return;
  5359. }
  5360. if (typeof arrowElement === "string") {
  5361. arrowElement = state.elements.popper.querySelector(arrowElement);
  5362. if (!arrowElement) {
  5363. return;
  5364. }
  5365. }
  5366. if (!contains(state.elements.popper, arrowElement)) {
  5367. return;
  5368. }
  5369. state.elements.arrow = arrowElement;
  5370. }
  5371. var arrow$1 = {
  5372. name: "arrow",
  5373. enabled: true,
  5374. phase: "main",
  5375. fn: arrow,
  5376. effect: effect$1,
  5377. requires: ["popperOffsets"],
  5378. requiresIfExists: ["preventOverflow"]
  5379. };
  5380. function getVariation(placement) {
  5381. return placement.split("-")[1];
  5382. }
  5383. var unsetSides = {
  5384. top: "auto",
  5385. right: "auto",
  5386. bottom: "auto",
  5387. left: "auto"
  5388. };
  5389. function roundOffsetsByDPR(_ref, win) {
  5390. var x2 = _ref.x, y = _ref.y;
  5391. var dpr = win.devicePixelRatio || 1;
  5392. return {
  5393. x: round(x2 * dpr) / dpr || 0,
  5394. y: round(y * dpr) / dpr || 0
  5395. };
  5396. }
  5397. function mapToStyles(_ref2) {
  5398. var _Object$assign2;
  5399. var popper2 = _ref2.popper, popperRect = _ref2.popperRect, placement = _ref2.placement, variation = _ref2.variation, offsets = _ref2.offsets, position = _ref2.position, gpuAcceleration = _ref2.gpuAcceleration, adaptive = _ref2.adaptive, roundOffsets = _ref2.roundOffsets, isFixed = _ref2.isFixed;
  5400. var _offsets$x = offsets.x, x2 = _offsets$x === void 0 ? 0 : _offsets$x, _offsets$y = offsets.y, y = _offsets$y === void 0 ? 0 : _offsets$y;
  5401. var _ref3 = typeof roundOffsets === "function" ? roundOffsets({
  5402. x: x2,
  5403. y
  5404. }) : {
  5405. x: x2,
  5406. y
  5407. };
  5408. x2 = _ref3.x;
  5409. y = _ref3.y;
  5410. var hasX = offsets.hasOwnProperty("x");
  5411. var hasY = offsets.hasOwnProperty("y");
  5412. var sideX = left;
  5413. var sideY = top;
  5414. var win = window;
  5415. if (adaptive) {
  5416. var offsetParent = getOffsetParent(popper2);
  5417. var heightProp = "clientHeight";
  5418. var widthProp = "clientWidth";
  5419. if (offsetParent === getWindow(popper2)) {
  5420. offsetParent = getDocumentElement(popper2);
  5421. if (getComputedStyle$1(offsetParent).position !== "static" && position === "absolute") {
  5422. heightProp = "scrollHeight";
  5423. widthProp = "scrollWidth";
  5424. }
  5425. }
  5426. offsetParent = offsetParent;
  5427. if (placement === top || (placement === left || placement === right) && variation === end) {
  5428. sideY = bottom;
  5429. var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : offsetParent[heightProp];
  5430. y -= offsetY - popperRect.height;
  5431. y *= gpuAcceleration ? 1 : -1;
  5432. }
  5433. if (placement === left || (placement === top || placement === bottom) && variation === end) {
  5434. sideX = right;
  5435. var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : offsetParent[widthProp];
  5436. x2 -= offsetX - popperRect.width;
  5437. x2 *= gpuAcceleration ? 1 : -1;
  5438. }
  5439. }
  5440. var commonStyles = Object.assign({
  5441. position
  5442. }, adaptive && unsetSides);
  5443. var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
  5444. x: x2,
  5445. y
  5446. }, getWindow(popper2)) : {
  5447. x: x2,
  5448. y
  5449. };
  5450. x2 = _ref4.x;
  5451. y = _ref4.y;
  5452. if (gpuAcceleration) {
  5453. var _Object$assign;
  5454. return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? "0" : "", _Object$assign[sideX] = hasX ? "0" : "", _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? "translate(" + x2 + "px, " + y + "px)" : "translate3d(" + x2 + "px, " + y + "px, 0)", _Object$assign));
  5455. }
  5456. return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : "", _Object$assign2[sideX] = hasX ? x2 + "px" : "", _Object$assign2.transform = "", _Object$assign2));
  5457. }
  5458. function computeStyles(_ref5) {
  5459. var state = _ref5.state, options = _ref5.options;
  5460. var _options$gpuAccelerat = options.gpuAcceleration, gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat, _options$adaptive = options.adaptive, adaptive = _options$adaptive === void 0 ? true : _options$adaptive, _options$roundOffsets = options.roundOffsets, roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
  5461. var commonStyles = {
  5462. placement: getBasePlacement(state.placement),
  5463. variation: getVariation(state.placement),
  5464. popper: state.elements.popper,
  5465. popperRect: state.rects.popper,
  5466. gpuAcceleration,
  5467. isFixed: state.options.strategy === "fixed"
  5468. };
  5469. if (state.modifiersData.popperOffsets != null) {
  5470. state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
  5471. offsets: state.modifiersData.popperOffsets,
  5472. position: state.options.strategy,
  5473. adaptive,
  5474. roundOffsets
  5475. })));
  5476. }
  5477. if (state.modifiersData.arrow != null) {
  5478. state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
  5479. offsets: state.modifiersData.arrow,
  5480. position: "absolute",
  5481. adaptive: false,
  5482. roundOffsets
  5483. })));
  5484. }
  5485. state.attributes.popper = Object.assign({}, state.attributes.popper, {
  5486. "data-popper-placement": state.placement
  5487. });
  5488. }
  5489. var computeStyles$1 = {
  5490. name: "computeStyles",
  5491. enabled: true,
  5492. phase: "beforeWrite",
  5493. fn: computeStyles,
  5494. data: {}
  5495. };
  5496. var passive = {
  5497. passive: true
  5498. };
  5499. function effect(_ref) {
  5500. var state = _ref.state, instance = _ref.instance, options = _ref.options;
  5501. var _options$scroll = options.scroll, scroll = _options$scroll === void 0 ? true : _options$scroll, _options$resize = options.resize, resize = _options$resize === void 0 ? true : _options$resize;
  5502. var window2 = getWindow(state.elements.popper);
  5503. var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
  5504. if (scroll) {
  5505. scrollParents.forEach(function(scrollParent) {
  5506. scrollParent.addEventListener("scroll", instance.update, passive);
  5507. });
  5508. }
  5509. if (resize) {
  5510. window2.addEventListener("resize", instance.update, passive);
  5511. }
  5512. return function() {
  5513. if (scroll) {
  5514. scrollParents.forEach(function(scrollParent) {
  5515. scrollParent.removeEventListener("scroll", instance.update, passive);
  5516. });
  5517. }
  5518. if (resize) {
  5519. window2.removeEventListener("resize", instance.update, passive);
  5520. }
  5521. };
  5522. }
  5523. var eventListeners = {
  5524. name: "eventListeners",
  5525. enabled: true,
  5526. phase: "write",
  5527. fn: function fn() {
  5528. },
  5529. effect,
  5530. data: {}
  5531. };
  5532. var hash$1 = {
  5533. left: "right",
  5534. right: "left",
  5535. bottom: "top",
  5536. top: "bottom"
  5537. };
  5538. function getOppositePlacement(placement) {
  5539. return placement.replace(/left|right|bottom|top/g, function(matched) {
  5540. return hash$1[matched];
  5541. });
  5542. }
  5543. var hash = {
  5544. start: "end",
  5545. end: "start"
  5546. };
  5547. function getOppositeVariationPlacement(placement) {
  5548. return placement.replace(/start|end/g, function(matched) {
  5549. return hash[matched];
  5550. });
  5551. }
  5552. function getWindowScroll(node) {
  5553. var win = getWindow(node);
  5554. var scrollLeft = win.pageXOffset;
  5555. var scrollTop = win.pageYOffset;
  5556. return {
  5557. scrollLeft,
  5558. scrollTop
  5559. };
  5560. }
  5561. function getWindowScrollBarX(element) {
  5562. return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
  5563. }
  5564. function getViewportRect(element, strategy) {
  5565. var win = getWindow(element);
  5566. var html = getDocumentElement(element);
  5567. var visualViewport = win.visualViewport;
  5568. var width = html.clientWidth;
  5569. var height = html.clientHeight;
  5570. var x2 = 0;
  5571. var y = 0;
  5572. if (visualViewport) {
  5573. width = visualViewport.width;
  5574. height = visualViewport.height;
  5575. var layoutViewport = isLayoutViewport();
  5576. if (layoutViewport || !layoutViewport && strategy === "fixed") {
  5577. x2 = visualViewport.offsetLeft;
  5578. y = visualViewport.offsetTop;
  5579. }
  5580. }
  5581. return {
  5582. width,
  5583. height,
  5584. x: x2 + getWindowScrollBarX(element),
  5585. y
  5586. };
  5587. }
  5588. function getDocumentRect(element) {
  5589. var _element$ownerDocumen;
  5590. var html = getDocumentElement(element);
  5591. var winScroll = getWindowScroll(element);
  5592. var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
  5593. var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
  5594. var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
  5595. var x2 = -winScroll.scrollLeft + getWindowScrollBarX(element);
  5596. var y = -winScroll.scrollTop;
  5597. if (getComputedStyle$1(body || html).direction === "rtl") {
  5598. x2 += max(html.clientWidth, body ? body.clientWidth : 0) - width;
  5599. }
  5600. return {
  5601. width,
  5602. height,
  5603. x: x2,
  5604. y
  5605. };
  5606. }
  5607. function isScrollParent(element) {
  5608. var _getComputedStyle = getComputedStyle$1(element), overflow = _getComputedStyle.overflow, overflowX = _getComputedStyle.overflowX, overflowY = _getComputedStyle.overflowY;
  5609. return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
  5610. }
  5611. function getScrollParent(node) {
  5612. if (["html", "body", "#document"].indexOf(getNodeName(node)) >= 0) {
  5613. return node.ownerDocument.body;
  5614. }
  5615. if (isHTMLElement(node) && isScrollParent(node)) {
  5616. return node;
  5617. }
  5618. return getScrollParent(getParentNode(node));
  5619. }
  5620. function listScrollParents(element, list) {
  5621. var _element$ownerDocumen;
  5622. if (list === void 0) {
  5623. list = [];
  5624. }
  5625. var scrollParent = getScrollParent(element);
  5626. var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
  5627. var win = getWindow(scrollParent);
  5628. var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
  5629. var updatedList = list.concat(target);
  5630. return isBody ? updatedList : updatedList.concat(listScrollParents(getParentNode(target)));
  5631. }
  5632. function rectToClientRect(rect) {
  5633. return Object.assign({}, rect, {
  5634. left: rect.x,
  5635. top: rect.y,
  5636. right: rect.x + rect.width,
  5637. bottom: rect.y + rect.height
  5638. });
  5639. }
  5640. function getInnerBoundingClientRect(element, strategy) {
  5641. var rect = getBoundingClientRect(element, false, strategy === "fixed");
  5642. rect.top = rect.top + element.clientTop;
  5643. rect.left = rect.left + element.clientLeft;
  5644. rect.bottom = rect.top + element.clientHeight;
  5645. rect.right = rect.left + element.clientWidth;
  5646. rect.width = element.clientWidth;
  5647. rect.height = element.clientHeight;
  5648. rect.x = rect.left;
  5649. rect.y = rect.top;
  5650. return rect;
  5651. }
  5652. function getClientRectFromMixedType(element, clippingParent, strategy) {
  5653. return clippingParent === viewport ? rectToClientRect(getViewportRect(element, strategy)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent, strategy) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
  5654. }
  5655. function getClippingParents(element) {
  5656. var clippingParents2 = listScrollParents(getParentNode(element));
  5657. var canEscapeClipping = ["absolute", "fixed"].indexOf(getComputedStyle$1(element).position) >= 0;
  5658. var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
  5659. if (!isElement(clipperElement)) {
  5660. return [];
  5661. }
  5662. return clippingParents2.filter(function(clippingParent) {
  5663. return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== "body";
  5664. });
  5665. }
  5666. function getClippingRect(element, boundary, rootBoundary, strategy) {
  5667. var mainClippingParents = boundary === "clippingParents" ? getClippingParents(element) : [].concat(boundary);
  5668. var clippingParents2 = [].concat(mainClippingParents, [rootBoundary]);
  5669. var firstClippingParent = clippingParents2[0];
  5670. var clippingRect = clippingParents2.reduce(function(accRect, clippingParent) {
  5671. var rect = getClientRectFromMixedType(element, clippingParent, strategy);
  5672. accRect.top = max(rect.top, accRect.top);
  5673. accRect.right = min(rect.right, accRect.right);
  5674. accRect.bottom = min(rect.bottom, accRect.bottom);
  5675. accRect.left = max(rect.left, accRect.left);
  5676. return accRect;
  5677. }, getClientRectFromMixedType(element, firstClippingParent, strategy));
  5678. clippingRect.width = clippingRect.right - clippingRect.left;
  5679. clippingRect.height = clippingRect.bottom - clippingRect.top;
  5680. clippingRect.x = clippingRect.left;
  5681. clippingRect.y = clippingRect.top;
  5682. return clippingRect;
  5683. }
  5684. function computeOffsets(_ref) {
  5685. var reference2 = _ref.reference, element = _ref.element, placement = _ref.placement;
  5686. var basePlacement = placement ? getBasePlacement(placement) : null;
  5687. var variation = placement ? getVariation(placement) : null;
  5688. var commonX = reference2.x + reference2.width / 2 - element.width / 2;
  5689. var commonY = reference2.y + reference2.height / 2 - element.height / 2;
  5690. var offsets;
  5691. switch (basePlacement) {
  5692. case top:
  5693. offsets = {
  5694. x: commonX,
  5695. y: reference2.y - element.height
  5696. };
  5697. break;
  5698. case bottom:
  5699. offsets = {
  5700. x: commonX,
  5701. y: reference2.y + reference2.height
  5702. };
  5703. break;
  5704. case right:
  5705. offsets = {
  5706. x: reference2.x + reference2.width,
  5707. y: commonY
  5708. };
  5709. break;
  5710. case left:
  5711. offsets = {
  5712. x: reference2.x - element.width,
  5713. y: commonY
  5714. };
  5715. break;
  5716. default:
  5717. offsets = {
  5718. x: reference2.x,
  5719. y: reference2.y
  5720. };
  5721. }
  5722. var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
  5723. if (mainAxis != null) {
  5724. var len = mainAxis === "y" ? "height" : "width";
  5725. switch (variation) {
  5726. case start:
  5727. offsets[mainAxis] = offsets[mainAxis] - (reference2[len] / 2 - element[len] / 2);
  5728. break;
  5729. case end:
  5730. offsets[mainAxis] = offsets[mainAxis] + (reference2[len] / 2 - element[len] / 2);
  5731. break;
  5732. }
  5733. }
  5734. return offsets;
  5735. }
  5736. function detectOverflow(state, options) {
  5737. if (options === void 0) {
  5738. options = {};
  5739. }
  5740. var _options = options, _options$placement = _options.placement, placement = _options$placement === void 0 ? state.placement : _options$placement, _options$strategy = _options.strategy, strategy = _options$strategy === void 0 ? state.strategy : _options$strategy, _options$boundary = _options.boundary, boundary = _options$boundary === void 0 ? clippingParents : _options$boundary, _options$rootBoundary = _options.rootBoundary, rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary, _options$elementConte = _options.elementContext, elementContext = _options$elementConte === void 0 ? popper : _options$elementConte, _options$altBoundary = _options.altBoundary, altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary, _options$padding = _options.padding, padding = _options$padding === void 0 ? 0 : _options$padding;
  5741. var paddingObject = mergePaddingObject(typeof padding !== "number" ? padding : expandToHashMap(padding, basePlacements));
  5742. var altContext = elementContext === popper ? reference : popper;
  5743. var popperRect = state.rects.popper;
  5744. var element = state.elements[altBoundary ? altContext : elementContext];
  5745. var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary, strategy);
  5746. var referenceClientRect = getBoundingClientRect(state.elements.reference);
  5747. var popperOffsets2 = computeOffsets({
  5748. reference: referenceClientRect,
  5749. element: popperRect,
  5750. strategy: "absolute",
  5751. placement
  5752. });
  5753. var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets2));
  5754. var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect;
  5755. var overflowOffsets = {
  5756. top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
  5757. bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
  5758. left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
  5759. right: elementClientRect.right - clippingClientRect.right + paddingObject.right
  5760. };
  5761. var offsetData = state.modifiersData.offset;
  5762. if (elementContext === popper && offsetData) {
  5763. var offset2 = offsetData[placement];
  5764. Object.keys(overflowOffsets).forEach(function(key) {
  5765. var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;
  5766. var axis = [top, bottom].indexOf(key) >= 0 ? "y" : "x";
  5767. overflowOffsets[key] += offset2[axis] * multiply;
  5768. });
  5769. }
  5770. return overflowOffsets;
  5771. }
  5772. function computeAutoPlacement(state, options) {
  5773. if (options === void 0) {
  5774. options = {};
  5775. }
  5776. var _options = options, placement = _options.placement, boundary = _options.boundary, rootBoundary = _options.rootBoundary, padding = _options.padding, flipVariations = _options.flipVariations, _options$allowedAutoP = _options.allowedAutoPlacements, allowedAutoPlacements = _options$allowedAutoP === void 0 ? placements : _options$allowedAutoP;
  5777. var variation = getVariation(placement);
  5778. var placements$1 = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function(placement2) {
  5779. return getVariation(placement2) === variation;
  5780. }) : basePlacements;
  5781. var allowedPlacements = placements$1.filter(function(placement2) {
  5782. return allowedAutoPlacements.indexOf(placement2) >= 0;
  5783. });
  5784. if (allowedPlacements.length === 0) {
  5785. allowedPlacements = placements$1;
  5786. }
  5787. var overflows = allowedPlacements.reduce(function(acc, placement2) {
  5788. acc[placement2] = detectOverflow(state, {
  5789. placement: placement2,
  5790. boundary,
  5791. rootBoundary,
  5792. padding
  5793. })[getBasePlacement(placement2)];
  5794. return acc;
  5795. }, {});
  5796. return Object.keys(overflows).sort(function(a2, b2) {
  5797. return overflows[a2] - overflows[b2];
  5798. });
  5799. }
  5800. function getExpandedFallbackPlacements(placement) {
  5801. if (getBasePlacement(placement) === auto) {
  5802. return [];
  5803. }
  5804. var oppositePlacement = getOppositePlacement(placement);
  5805. return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];
  5806. }
  5807. function flip(_ref) {
  5808. var state = _ref.state, options = _ref.options, name = _ref.name;
  5809. if (state.modifiersData[name]._skip) {
  5810. return;
  5811. }
  5812. var _options$mainAxis = options.mainAxis, checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis, _options$altAxis = options.altAxis, checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis, specifiedFallbackPlacements = options.fallbackPlacements, padding = options.padding, boundary = options.boundary, rootBoundary = options.rootBoundary, altBoundary = options.altBoundary, _options$flipVariatio = options.flipVariations, flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio, allowedAutoPlacements = options.allowedAutoPlacements;
  5813. var preferredPlacement = state.options.placement;
  5814. var basePlacement = getBasePlacement(preferredPlacement);
  5815. var isBasePlacement = basePlacement === preferredPlacement;
  5816. var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));
  5817. var placements2 = [preferredPlacement].concat(fallbackPlacements).reduce(function(acc, placement2) {
  5818. return acc.concat(getBasePlacement(placement2) === auto ? computeAutoPlacement(state, {
  5819. placement: placement2,
  5820. boundary,
  5821. rootBoundary,
  5822. padding,
  5823. flipVariations,
  5824. allowedAutoPlacements
  5825. }) : placement2);
  5826. }, []);
  5827. var referenceRect = state.rects.reference;
  5828. var popperRect = state.rects.popper;
  5829. var checksMap = /* @__PURE__ */ new Map();
  5830. var makeFallbackChecks = true;
  5831. var firstFittingPlacement = placements2[0];
  5832. for (var i = 0; i < placements2.length; i++) {
  5833. var placement = placements2[i];
  5834. var _basePlacement = getBasePlacement(placement);
  5835. var isStartVariation = getVariation(placement) === start;
  5836. var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;
  5837. var len = isVertical ? "width" : "height";
  5838. var overflow = detectOverflow(state, {
  5839. placement,
  5840. boundary,
  5841. rootBoundary,
  5842. altBoundary,
  5843. padding
  5844. });
  5845. var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top;
  5846. if (referenceRect[len] > popperRect[len]) {
  5847. mainVariationSide = getOppositePlacement(mainVariationSide);
  5848. }
  5849. var altVariationSide = getOppositePlacement(mainVariationSide);
  5850. var checks = [];
  5851. if (checkMainAxis) {
  5852. checks.push(overflow[_basePlacement] <= 0);
  5853. }
  5854. if (checkAltAxis) {
  5855. checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);
  5856. }
  5857. if (checks.every(function(check2) {
  5858. return check2;
  5859. })) {
  5860. firstFittingPlacement = placement;
  5861. makeFallbackChecks = false;
  5862. break;
  5863. }
  5864. checksMap.set(placement, checks);
  5865. }
  5866. if (makeFallbackChecks) {
  5867. var numberOfChecks = flipVariations ? 3 : 1;
  5868. var _loop = function _loop2(_i2) {
  5869. var fittingPlacement = placements2.find(function(placement2) {
  5870. var checks2 = checksMap.get(placement2);
  5871. if (checks2) {
  5872. return checks2.slice(0, _i2).every(function(check2) {
  5873. return check2;
  5874. });
  5875. }
  5876. });
  5877. if (fittingPlacement) {
  5878. firstFittingPlacement = fittingPlacement;
  5879. return "break";
  5880. }
  5881. };
  5882. for (var _i = numberOfChecks; _i > 0; _i--) {
  5883. var _ret = _loop(_i);
  5884. if (_ret === "break")
  5885. break;
  5886. }
  5887. }
  5888. if (state.placement !== firstFittingPlacement) {
  5889. state.modifiersData[name]._skip = true;
  5890. state.placement = firstFittingPlacement;
  5891. state.reset = true;
  5892. }
  5893. }
  5894. var flip$1 = {
  5895. name: "flip",
  5896. enabled: true,
  5897. phase: "main",
  5898. fn: flip,
  5899. requiresIfExists: ["offset"],
  5900. data: {
  5901. _skip: false
  5902. }
  5903. };
  5904. function getSideOffsets(overflow, rect, preventedOffsets) {
  5905. if (preventedOffsets === void 0) {
  5906. preventedOffsets = {
  5907. x: 0,
  5908. y: 0
  5909. };
  5910. }
  5911. return {
  5912. top: overflow.top - rect.height - preventedOffsets.y,
  5913. right: overflow.right - rect.width + preventedOffsets.x,
  5914. bottom: overflow.bottom - rect.height + preventedOffsets.y,
  5915. left: overflow.left - rect.width - preventedOffsets.x
  5916. };
  5917. }
  5918. function isAnySideFullyClipped(overflow) {
  5919. return [top, right, bottom, left].some(function(side) {
  5920. return overflow[side] >= 0;
  5921. });
  5922. }
  5923. function hide(_ref) {
  5924. var state = _ref.state, name = _ref.name;
  5925. var referenceRect = state.rects.reference;
  5926. var popperRect = state.rects.popper;
  5927. var preventedOffsets = state.modifiersData.preventOverflow;
  5928. var referenceOverflow = detectOverflow(state, {
  5929. elementContext: "reference"
  5930. });
  5931. var popperAltOverflow = detectOverflow(state, {
  5932. altBoundary: true
  5933. });
  5934. var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);
  5935. var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);
  5936. var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);
  5937. var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);
  5938. state.modifiersData[name] = {
  5939. referenceClippingOffsets,
  5940. popperEscapeOffsets,
  5941. isReferenceHidden,
  5942. hasPopperEscaped
  5943. };
  5944. state.attributes.popper = Object.assign({}, state.attributes.popper, {
  5945. "data-popper-reference-hidden": isReferenceHidden,
  5946. "data-popper-escaped": hasPopperEscaped
  5947. });
  5948. }
  5949. var hide$1 = {
  5950. name: "hide",
  5951. enabled: true,
  5952. phase: "main",
  5953. requiresIfExists: ["preventOverflow"],
  5954. fn: hide
  5955. };
  5956. function distanceAndSkiddingToXY(placement, rects, offset2) {
  5957. var basePlacement = getBasePlacement(placement);
  5958. var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;
  5959. var _ref = typeof offset2 === "function" ? offset2(Object.assign({}, rects, {
  5960. placement
  5961. })) : offset2, skidding = _ref[0], distance = _ref[1];
  5962. skidding = skidding || 0;
  5963. distance = (distance || 0) * invertDistance;
  5964. return [left, right].indexOf(basePlacement) >= 0 ? {
  5965. x: distance,
  5966. y: skidding
  5967. } : {
  5968. x: skidding,
  5969. y: distance
  5970. };
  5971. }
  5972. function offset(_ref2) {
  5973. var state = _ref2.state, options = _ref2.options, name = _ref2.name;
  5974. var _options$offset = options.offset, offset2 = _options$offset === void 0 ? [0, 0] : _options$offset;
  5975. var data2 = placements.reduce(function(acc, placement) {
  5976. acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset2);
  5977. return acc;
  5978. }, {});
  5979. var _data$state$placement = data2[state.placement], x2 = _data$state$placement.x, y = _data$state$placement.y;
  5980. if (state.modifiersData.popperOffsets != null) {
  5981. state.modifiersData.popperOffsets.x += x2;
  5982. state.modifiersData.popperOffsets.y += y;
  5983. }
  5984. state.modifiersData[name] = data2;
  5985. }
  5986. var offset$1 = {
  5987. name: "offset",
  5988. enabled: true,
  5989. phase: "main",
  5990. requires: ["popperOffsets"],
  5991. fn: offset
  5992. };
  5993. function popperOffsets(_ref) {
  5994. var state = _ref.state, name = _ref.name;
  5995. state.modifiersData[name] = computeOffsets({
  5996. reference: state.rects.reference,
  5997. element: state.rects.popper,
  5998. strategy: "absolute",
  5999. placement: state.placement
  6000. });
  6001. }
  6002. var popperOffsets$1 = {
  6003. name: "popperOffsets",
  6004. enabled: true,
  6005. phase: "read",
  6006. fn: popperOffsets,
  6007. data: {}
  6008. };
  6009. function getAltAxis(axis) {
  6010. return axis === "x" ? "y" : "x";
  6011. }
  6012. function preventOverflow(_ref) {
  6013. var state = _ref.state, options = _ref.options, name = _ref.name;
  6014. var _options$mainAxis = options.mainAxis, checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis, _options$altAxis = options.altAxis, checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis, boundary = options.boundary, rootBoundary = options.rootBoundary, altBoundary = options.altBoundary, padding = options.padding, _options$tether = options.tether, tether = _options$tether === void 0 ? true : _options$tether, _options$tetherOffset = options.tetherOffset, tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset;
  6015. var overflow = detectOverflow(state, {
  6016. boundary,
  6017. rootBoundary,
  6018. padding,
  6019. altBoundary
  6020. });
  6021. var basePlacement = getBasePlacement(state.placement);
  6022. var variation = getVariation(state.placement);
  6023. var isBasePlacement = !variation;
  6024. var mainAxis = getMainAxisFromPlacement(basePlacement);
  6025. var altAxis = getAltAxis(mainAxis);
  6026. var popperOffsets2 = state.modifiersData.popperOffsets;
  6027. var referenceRect = state.rects.reference;
  6028. var popperRect = state.rects.popper;
  6029. var tetherOffsetValue = typeof tetherOffset === "function" ? tetherOffset(Object.assign({}, state.rects, {
  6030. placement: state.placement
  6031. })) : tetherOffset;
  6032. var normalizedTetherOffsetValue = typeof tetherOffsetValue === "number" ? {
  6033. mainAxis: tetherOffsetValue,
  6034. altAxis: tetherOffsetValue
  6035. } : Object.assign({
  6036. mainAxis: 0,
  6037. altAxis: 0
  6038. }, tetherOffsetValue);
  6039. var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;
  6040. var data2 = {
  6041. x: 0,
  6042. y: 0
  6043. };
  6044. if (!popperOffsets2) {
  6045. return;
  6046. }
  6047. if (checkMainAxis) {
  6048. var _offsetModifierState$;
  6049. var mainSide = mainAxis === "y" ? top : left;
  6050. var altSide = mainAxis === "y" ? bottom : right;
  6051. var len = mainAxis === "y" ? "height" : "width";
  6052. var offset2 = popperOffsets2[mainAxis];
  6053. var min$1 = offset2 + overflow[mainSide];
  6054. var max$1 = offset2 - overflow[altSide];
  6055. var additive = tether ? -popperRect[len] / 2 : 0;
  6056. var minLen = variation === start ? referenceRect[len] : popperRect[len];
  6057. var maxLen = variation === start ? -popperRect[len] : -referenceRect[len];
  6058. var arrowElement = state.elements.arrow;
  6059. var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {
  6060. width: 0,
  6061. height: 0
  6062. };
  6063. var arrowPaddingObject = state.modifiersData["arrow#persistent"] ? state.modifiersData["arrow#persistent"].padding : getFreshSideObject();
  6064. var arrowPaddingMin = arrowPaddingObject[mainSide];
  6065. var arrowPaddingMax = arrowPaddingObject[altSide];
  6066. var arrowLen = within(0, referenceRect[len], arrowRect[len]);
  6067. var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;
  6068. var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;
  6069. var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
  6070. var clientOffset = arrowOffsetParent ? mainAxis === "y" ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
  6071. var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;
  6072. var tetherMin = offset2 + minOffset - offsetModifierValue - clientOffset;
  6073. var tetherMax = offset2 + maxOffset - offsetModifierValue;
  6074. var preventedOffset = within(tether ? min(min$1, tetherMin) : min$1, offset2, tether ? max(max$1, tetherMax) : max$1);
  6075. popperOffsets2[mainAxis] = preventedOffset;
  6076. data2[mainAxis] = preventedOffset - offset2;
  6077. }
  6078. if (checkAltAxis) {
  6079. var _offsetModifierState$2;
  6080. var _mainSide = mainAxis === "x" ? top : left;
  6081. var _altSide = mainAxis === "x" ? bottom : right;
  6082. var _offset = popperOffsets2[altAxis];
  6083. var _len = altAxis === "y" ? "height" : "width";
  6084. var _min = _offset + overflow[_mainSide];
  6085. var _max = _offset - overflow[_altSide];
  6086. var isOriginSide = [top, left].indexOf(basePlacement) !== -1;
  6087. var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;
  6088. var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;
  6089. var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;
  6090. var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);
  6091. popperOffsets2[altAxis] = _preventedOffset;
  6092. data2[altAxis] = _preventedOffset - _offset;
  6093. }
  6094. state.modifiersData[name] = data2;
  6095. }
  6096. var preventOverflow$1 = {
  6097. name: "preventOverflow",
  6098. enabled: true,
  6099. phase: "main",
  6100. fn: preventOverflow,
  6101. requiresIfExists: ["offset"]
  6102. };
  6103. function getHTMLElementScroll(element) {
  6104. return {
  6105. scrollLeft: element.scrollLeft,
  6106. scrollTop: element.scrollTop
  6107. };
  6108. }
  6109. function getNodeScroll(node) {
  6110. if (node === getWindow(node) || !isHTMLElement(node)) {
  6111. return getWindowScroll(node);
  6112. } else {
  6113. return getHTMLElementScroll(node);
  6114. }
  6115. }
  6116. function isElementScaled(element) {
  6117. var rect = element.getBoundingClientRect();
  6118. var scaleX = round(rect.width) / element.offsetWidth || 1;
  6119. var scaleY = round(rect.height) / element.offsetHeight || 1;
  6120. return scaleX !== 1 || scaleY !== 1;
  6121. }
  6122. function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
  6123. if (isFixed === void 0) {
  6124. isFixed = false;
  6125. }
  6126. var isOffsetParentAnElement = isHTMLElement(offsetParent);
  6127. var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
  6128. var documentElement = getDocumentElement(offsetParent);
  6129. var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled, isFixed);
  6130. var scroll = {
  6131. scrollLeft: 0,
  6132. scrollTop: 0
  6133. };
  6134. var offsets = {
  6135. x: 0,
  6136. y: 0
  6137. };
  6138. if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
  6139. if (getNodeName(offsetParent) !== "body" || isScrollParent(documentElement)) {
  6140. scroll = getNodeScroll(offsetParent);
  6141. }
  6142. if (isHTMLElement(offsetParent)) {
  6143. offsets = getBoundingClientRect(offsetParent, true);
  6144. offsets.x += offsetParent.clientLeft;
  6145. offsets.y += offsetParent.clientTop;
  6146. } else if (documentElement) {
  6147. offsets.x = getWindowScrollBarX(documentElement);
  6148. }
  6149. }
  6150. return {
  6151. x: rect.left + scroll.scrollLeft - offsets.x,
  6152. y: rect.top + scroll.scrollTop - offsets.y,
  6153. width: rect.width,
  6154. height: rect.height
  6155. };
  6156. }
  6157. function order(modifiers) {
  6158. var map = /* @__PURE__ */ new Map();
  6159. var visited = /* @__PURE__ */ new Set();
  6160. var result = [];
  6161. modifiers.forEach(function(modifier) {
  6162. map.set(modifier.name, modifier);
  6163. });
  6164. function sort(modifier) {
  6165. visited.add(modifier.name);
  6166. var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);
  6167. requires.forEach(function(dep) {
  6168. if (!visited.has(dep)) {
  6169. var depModifier = map.get(dep);
  6170. if (depModifier) {
  6171. sort(depModifier);
  6172. }
  6173. }
  6174. });
  6175. result.push(modifier);
  6176. }
  6177. modifiers.forEach(function(modifier) {
  6178. if (!visited.has(modifier.name)) {
  6179. sort(modifier);
  6180. }
  6181. });
  6182. return result;
  6183. }
  6184. function orderModifiers(modifiers) {
  6185. var orderedModifiers = order(modifiers);
  6186. return modifierPhases.reduce(function(acc, phase) {
  6187. return acc.concat(orderedModifiers.filter(function(modifier) {
  6188. return modifier.phase === phase;
  6189. }));
  6190. }, []);
  6191. }
  6192. function debounce(fn2) {
  6193. var pending;
  6194. return function() {
  6195. if (!pending) {
  6196. pending = new Promise(function(resolve) {
  6197. Promise.resolve().then(function() {
  6198. pending = void 0;
  6199. resolve(fn2());
  6200. });
  6201. });
  6202. }
  6203. return pending;
  6204. };
  6205. }
  6206. function mergeByName(modifiers) {
  6207. var merged = modifiers.reduce(function(merged2, current) {
  6208. var existing = merged2[current.name];
  6209. merged2[current.name] = existing ? Object.assign({}, existing, current, {
  6210. options: Object.assign({}, existing.options, current.options),
  6211. data: Object.assign({}, existing.data, current.data)
  6212. }) : current;
  6213. return merged2;
  6214. }, {});
  6215. return Object.keys(merged).map(function(key) {
  6216. return merged[key];
  6217. });
  6218. }
  6219. var DEFAULT_OPTIONS = {
  6220. placement: "bottom",
  6221. modifiers: [],
  6222. strategy: "absolute"
  6223. };
  6224. function areValidElements() {
  6225. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  6226. args[_key] = arguments[_key];
  6227. }
  6228. return !args.some(function(element) {
  6229. return !(element && typeof element.getBoundingClientRect === "function");
  6230. });
  6231. }
  6232. function popperGenerator(generatorOptions) {
  6233. if (generatorOptions === void 0) {
  6234. generatorOptions = {};
  6235. }
  6236. var _generatorOptions = generatorOptions, _generatorOptions$def = _generatorOptions.defaultModifiers, defaultModifiers2 = _generatorOptions$def === void 0 ? [] : _generatorOptions$def, _generatorOptions$def2 = _generatorOptions.defaultOptions, defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;
  6237. return function createPopper2(reference2, popper2, options) {
  6238. if (options === void 0) {
  6239. options = defaultOptions;
  6240. }
  6241. var state = {
  6242. placement: "bottom",
  6243. orderedModifiers: [],
  6244. options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
  6245. modifiersData: {},
  6246. elements: {
  6247. reference: reference2,
  6248. popper: popper2
  6249. },
  6250. attributes: {},
  6251. styles: {}
  6252. };
  6253. var effectCleanupFns = [];
  6254. var isDestroyed = false;
  6255. var instance = {
  6256. state,
  6257. setOptions: function setOptions(setOptionsAction) {
  6258. var options2 = typeof setOptionsAction === "function" ? setOptionsAction(state.options) : setOptionsAction;
  6259. cleanupModifierEffects();
  6260. state.options = Object.assign({}, defaultOptions, state.options, options2);
  6261. state.scrollParents = {
  6262. reference: isElement(reference2) ? listScrollParents(reference2) : reference2.contextElement ? listScrollParents(reference2.contextElement) : [],
  6263. popper: listScrollParents(popper2)
  6264. };
  6265. var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers2, state.options.modifiers)));
  6266. state.orderedModifiers = orderedModifiers.filter(function(m2) {
  6267. return m2.enabled;
  6268. });
  6269. runModifierEffects();
  6270. return instance.update();
  6271. },
  6272. forceUpdate: function forceUpdate() {
  6273. if (isDestroyed) {
  6274. return;
  6275. }
  6276. var _state$elements = state.elements, reference3 = _state$elements.reference, popper3 = _state$elements.popper;
  6277. if (!areValidElements(reference3, popper3)) {
  6278. return;
  6279. }
  6280. state.rects = {
  6281. reference: getCompositeRect(reference3, getOffsetParent(popper3), state.options.strategy === "fixed"),
  6282. popper: getLayoutRect(popper3)
  6283. };
  6284. state.reset = false;
  6285. state.placement = state.options.placement;
  6286. state.orderedModifiers.forEach(function(modifier) {
  6287. return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
  6288. });
  6289. for (var index = 0; index < state.orderedModifiers.length; index++) {
  6290. if (state.reset === true) {
  6291. state.reset = false;
  6292. index = -1;
  6293. continue;
  6294. }
  6295. var _state$orderedModifie = state.orderedModifiers[index], fn2 = _state$orderedModifie.fn, _state$orderedModifie2 = _state$orderedModifie.options, _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2, name = _state$orderedModifie.name;
  6296. if (typeof fn2 === "function") {
  6297. state = fn2({
  6298. state,
  6299. options: _options,
  6300. name,
  6301. instance
  6302. }) || state;
  6303. }
  6304. }
  6305. },
  6306. update: debounce(function() {
  6307. return new Promise(function(resolve) {
  6308. instance.forceUpdate();
  6309. resolve(state);
  6310. });
  6311. }),
  6312. destroy: function destroy() {
  6313. cleanupModifierEffects();
  6314. isDestroyed = true;
  6315. }
  6316. };
  6317. if (!areValidElements(reference2, popper2)) {
  6318. return instance;
  6319. }
  6320. instance.setOptions(options).then(function(state2) {
  6321. if (!isDestroyed && options.onFirstUpdate) {
  6322. options.onFirstUpdate(state2);
  6323. }
  6324. });
  6325. function runModifierEffects() {
  6326. state.orderedModifiers.forEach(function(_ref) {
  6327. var name = _ref.name, _ref$options = _ref.options, options2 = _ref$options === void 0 ? {} : _ref$options, effect2 = _ref.effect;
  6328. if (typeof effect2 === "function") {
  6329. var cleanupFn = effect2({
  6330. state,
  6331. name,
  6332. instance,
  6333. options: options2
  6334. });
  6335. var noopFn = function noopFn2() {
  6336. };
  6337. effectCleanupFns.push(cleanupFn || noopFn);
  6338. }
  6339. });
  6340. }
  6341. function cleanupModifierEffects() {
  6342. effectCleanupFns.forEach(function(fn2) {
  6343. return fn2();
  6344. });
  6345. effectCleanupFns = [];
  6346. }
  6347. return instance;
  6348. };
  6349. }
  6350. var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$1];
  6351. var createPopper = /* @__PURE__ */ popperGenerator({
  6352. defaultModifiers
  6353. });
  6354. const POSITIONING_STRATEGIES = ["fixed", "absolute"];
  6355. const usePopperCoreConfigProps = buildProps({
  6356. boundariesPadding: {
  6357. type: Number,
  6358. default: 0
  6359. },
  6360. fallbackPlacements: {
  6361. type: definePropType(Array),
  6362. default: () => []
  6363. },
  6364. gpuAcceleration: {
  6365. type: Boolean,
  6366. default: true
  6367. },
  6368. offset: {
  6369. type: Number,
  6370. default: 12
  6371. },
  6372. placement: {
  6373. type: String,
  6374. values: placements,
  6375. default: "bottom"
  6376. },
  6377. popperOptions: {
  6378. type: definePropType(Object),
  6379. default: () => ({})
  6380. },
  6381. strategy: {
  6382. type: String,
  6383. values: POSITIONING_STRATEGIES,
  6384. default: "absolute"
  6385. }
  6386. });
  6387. const usePopperContentProps = buildProps(__spreadProps(__spreadValues({}, usePopperCoreConfigProps), {
  6388. style: { type: definePropType([String, Array, Object]) },
  6389. className: { type: definePropType([String, Array, Object]) },
  6390. effect: {
  6391. type: String,
  6392. default: "dark"
  6393. },
  6394. visible: Boolean,
  6395. enterable: {
  6396. type: Boolean,
  6397. default: true
  6398. },
  6399. pure: Boolean,
  6400. popperClass: {
  6401. type: definePropType([String, Array, Object])
  6402. },
  6403. popperStyle: {
  6404. type: definePropType([String, Array, Object])
  6405. },
  6406. referenceEl: {
  6407. type: definePropType(Object)
  6408. },
  6409. stopPopperMouseEvent: {
  6410. type: Boolean,
  6411. default: true
  6412. },
  6413. zIndex: Number
  6414. }));
  6415. const buildPopperOptions = (props, arrowProps) => {
  6416. const { placement, strategy, popperOptions: popperOptions2 } = props;
  6417. const options = __spreadProps(__spreadValues({
  6418. placement,
  6419. strategy
  6420. }, popperOptions2), {
  6421. modifiers: genModifiers(props)
  6422. });
  6423. attachArrow(options, arrowProps);
  6424. deriveExtraModifiers(options, popperOptions2 == null ? void 0 : popperOptions2.modifiers);
  6425. return options;
  6426. };
  6427. const unwrapMeasurableEl = ($el) => {
  6428. if (!isClient)
  6429. return;
  6430. return unrefElement($el);
  6431. };
  6432. function genModifiers(options) {
  6433. const { offset: offset2, gpuAcceleration, fallbackPlacements } = options;
  6434. return [
  6435. {
  6436. name: "offset",
  6437. options: {
  6438. offset: [0, offset2 != null ? offset2 : 12]
  6439. }
  6440. },
  6441. {
  6442. name: "preventOverflow",
  6443. options: {
  6444. padding: {
  6445. top: 2,
  6446. bottom: 2,
  6447. left: 5,
  6448. right: 5
  6449. }
  6450. }
  6451. },
  6452. {
  6453. name: "flip",
  6454. options: {
  6455. padding: 5,
  6456. fallbackPlacements: fallbackPlacements != null ? fallbackPlacements : []
  6457. }
  6458. },
  6459. {
  6460. name: "computeStyles",
  6461. options: {
  6462. gpuAcceleration,
  6463. adaptive: gpuAcceleration
  6464. }
  6465. }
  6466. ];
  6467. }
  6468. function attachArrow(options, { arrowEl, arrowOffset }) {
  6469. options.modifiers.push({
  6470. name: "arrow",
  6471. options: {
  6472. element: arrowEl,
  6473. padding: arrowOffset != null ? arrowOffset : 5
  6474. }
  6475. });
  6476. }
  6477. function deriveExtraModifiers(options, modifiers) {
  6478. if (modifiers) {
  6479. options.modifiers = [...options.modifiers, ...modifiers != null ? modifiers : []];
  6480. }
  6481. }
  6482. const __default__$g = {
  6483. name: "ElPopperContent"
  6484. };
  6485. const _sfc_main$_ = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$g), {
  6486. props: usePopperContentProps,
  6487. emits: ["mouseenter", "mouseleave"],
  6488. setup(__props, { expose }) {
  6489. const props = __props;
  6490. const { popperInstanceRef, contentRef, triggerRef: triggerRef2 } = inject(POPPER_INJECTION_KEY, void 0);
  6491. const { nextZIndex } = useZIndex();
  6492. const ns = useNamespace("popper");
  6493. const popperContentRef = ref();
  6494. const arrowRef = ref();
  6495. const arrowOffset = ref();
  6496. provide(POPPER_CONTENT_INJECTION_KEY, {
  6497. arrowRef,
  6498. arrowOffset
  6499. });
  6500. const contentZIndex = ref(props.zIndex || nextZIndex());
  6501. const computedReference = computed(() => unwrapMeasurableEl(props.referenceEl) || unref(triggerRef2));
  6502. const contentStyle = computed(() => [{ zIndex: unref(contentZIndex) }, props.popperStyle]);
  6503. const contentClass = computed(() => [
  6504. ns.b(),
  6505. ns.is("pure", props.pure),
  6506. ns.is(props.effect),
  6507. props.popperClass
  6508. ]);
  6509. const createPopperInstance = ({ referenceEl, popperContentEl, arrowEl }) => {
  6510. const options = buildPopperOptions(props, {
  6511. arrowEl,
  6512. arrowOffset: unref(arrowOffset)
  6513. });
  6514. return createPopper(referenceEl, popperContentEl, options);
  6515. };
  6516. const updatePopper = (shouldUpdateZIndex = true) => {
  6517. var _a2;
  6518. (_a2 = unref(popperInstanceRef)) == null ? void 0 : _a2.update();
  6519. shouldUpdateZIndex && (contentZIndex.value = props.zIndex || nextZIndex());
  6520. };
  6521. const togglePopperAlive = () => {
  6522. var _a2, _b2;
  6523. const monitorable = { name: "eventListeners", enabled: props.visible };
  6524. (_b2 = (_a2 = unref(popperInstanceRef)) == null ? void 0 : _a2.setOptions) == null ? void 0 : _b2.call(_a2, (options) => __spreadProps(__spreadValues({}, options), {
  6525. modifiers: [...options.modifiers || [], monitorable]
  6526. }));
  6527. updatePopper(false);
  6528. };
  6529. onMounted(() => {
  6530. let updateHandle;
  6531. watch(computedReference, (referenceEl) => {
  6532. var _a2;
  6533. updateHandle == null ? void 0 : updateHandle();
  6534. const popperInstance = unref(popperInstanceRef);
  6535. (_a2 = popperInstance == null ? void 0 : popperInstance.destroy) == null ? void 0 : _a2.call(popperInstance);
  6536. if (referenceEl) {
  6537. const popperContentEl = unref(popperContentRef);
  6538. contentRef.value = popperContentEl;
  6539. popperInstanceRef.value = createPopperInstance({
  6540. referenceEl,
  6541. popperContentEl,
  6542. arrowEl: unref(arrowRef)
  6543. });
  6544. updateHandle = watch(() => referenceEl.getBoundingClientRect(), () => updatePopper(), {
  6545. immediate: true
  6546. });
  6547. } else {
  6548. popperInstanceRef.value = void 0;
  6549. }
  6550. }, {
  6551. immediate: true
  6552. });
  6553. watch(() => props.visible, togglePopperAlive, { immediate: true });
  6554. watch(() => buildPopperOptions(props, {
  6555. arrowEl: unref(arrowRef),
  6556. arrowOffset: unref(arrowOffset)
  6557. }), (option) => {
  6558. var _a2;
  6559. return (_a2 = popperInstanceRef.value) == null ? void 0 : _a2.setOptions(option);
  6560. });
  6561. });
  6562. expose({
  6563. popperContentRef,
  6564. popperInstanceRef,
  6565. updatePopper,
  6566. contentStyle
  6567. });
  6568. return (_ctx, _cache) => {
  6569. return openBlock(), createElementBlock("div", {
  6570. ref_key: "popperContentRef",
  6571. ref: popperContentRef,
  6572. style: normalizeStyle(unref(contentStyle)),
  6573. class: normalizeClass(unref(contentClass)),
  6574. role: "tooltip",
  6575. onMouseenter: _cache[0] || (_cache[0] = (e) => _ctx.$emit("mouseenter", e)),
  6576. onMouseleave: _cache[1] || (_cache[1] = (e) => _ctx.$emit("mouseleave", e))
  6577. }, [
  6578. renderSlot(_ctx.$slots, "default")
  6579. ], 38);
  6580. };
  6581. }
  6582. }));
  6583. var ElPopperContent = /* @__PURE__ */ _export_sfc$1(_sfc_main$_, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/popper/src/content.vue"]]);
  6584. function useDeprecateAppendToBody(scope, from) {
  6585. const vm = getCurrentInstance();
  6586. const compatTeleported = computed(() => {
  6587. return isBoolean(vm.props[from]) ? vm.props[from] : vm.props.teleported;
  6588. });
  6589. useDeprecated({
  6590. scope,
  6591. from,
  6592. replacement: "teleported",
  6593. version: "2.1.0",
  6594. ref: "https://element-plus.org/en-US/component/tooltip.html#attributes"
  6595. }, computed(() => isBoolean(vm.props[from])));
  6596. return {
  6597. compatTeleported
  6598. };
  6599. }
  6600. const ElPopper = withInstall(Popper);
  6601. const _sfc_main$Z = defineComponent({
  6602. name: "ElVisuallyHidden",
  6603. props: {
  6604. style: {
  6605. type: [String, Object, Array]
  6606. }
  6607. },
  6608. setup(props) {
  6609. return {
  6610. computedStyle: computed(() => {
  6611. return [
  6612. props.style,
  6613. {
  6614. position: "absolute",
  6615. border: 0,
  6616. width: 1,
  6617. height: 1,
  6618. padding: 0,
  6619. margin: -1,
  6620. overflow: "hidden",
  6621. clip: "rect(0, 0, 0, 0)",
  6622. whiteSpace: "nowrap",
  6623. wordWrap: "normal"
  6624. }
  6625. ];
  6626. })
  6627. };
  6628. }
  6629. });
  6630. function _sfc_render$A(_ctx, _cache, $props, $setup, $data, $options) {
  6631. return openBlock(), createElementBlock("span", mergeProps(_ctx.$attrs, { style: _ctx.computedStyle }), [
  6632. renderSlot(_ctx.$slots, "default")
  6633. ], 16);
  6634. }
  6635. var ElVisuallyHidden = /* @__PURE__ */ _export_sfc$1(_sfc_main$Z, [["render", _sfc_render$A], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/visual-hidden/src/visual-hidden.vue"]]);
  6636. const useTooltipContentProps = buildProps(__spreadProps(__spreadValues(__spreadValues({}, useDelayedToggleProps), usePopperContentProps), {
  6637. appendTo: {
  6638. type: definePropType([String, Object]),
  6639. default: POPPER_CONTAINER_SELECTOR
  6640. },
  6641. content: {
  6642. type: String,
  6643. default: ""
  6644. },
  6645. rawContent: {
  6646. type: Boolean,
  6647. default: false
  6648. },
  6649. persistent: Boolean,
  6650. ariaLabel: String,
  6651. visible: {
  6652. type: definePropType(Boolean),
  6653. default: null
  6654. },
  6655. transition: {
  6656. type: String,
  6657. default: "el-fade-in-linear"
  6658. },
  6659. teleported: {
  6660. type: Boolean,
  6661. default: true
  6662. },
  6663. disabled: {
  6664. type: Boolean
  6665. }
  6666. }));
  6667. const useTooltipTriggerProps = buildProps(__spreadProps(__spreadValues({}, usePopperTriggerProps), {
  6668. disabled: Boolean,
  6669. trigger: {
  6670. type: definePropType([String, Array]),
  6671. default: "hover"
  6672. }
  6673. }));
  6674. const useTooltipProps = buildProps({
  6675. openDelay: {
  6676. type: Number
  6677. },
  6678. visibleArrow: {
  6679. type: Boolean,
  6680. default: void 0
  6681. },
  6682. hideAfter: {
  6683. type: Number,
  6684. default: 200
  6685. },
  6686. showArrow: {
  6687. type: Boolean,
  6688. default: true
  6689. }
  6690. });
  6691. const TOOLTIP_INJECTION_KEY = Symbol("elTooltip");
  6692. const _sfc_main$Y = defineComponent({
  6693. name: "ElTooltipContent",
  6694. components: {
  6695. ElPopperContent,
  6696. ElVisuallyHidden
  6697. },
  6698. inheritAttrs: false,
  6699. props: useTooltipContentProps,
  6700. setup(props) {
  6701. const contentRef = ref(null);
  6702. const intermediateOpen = ref(false);
  6703. const entering = ref(false);
  6704. const leaving = ref(false);
  6705. const destroyed = ref(false);
  6706. const {
  6707. controlled,
  6708. id,
  6709. open,
  6710. trigger,
  6711. onClose,
  6712. onOpen,
  6713. onShow,
  6714. onHide,
  6715. onBeforeShow,
  6716. onBeforeHide
  6717. } = inject(TOOLTIP_INJECTION_KEY, void 0);
  6718. const persistentRef = computed(() => {
  6719. return props.persistent;
  6720. });
  6721. onBeforeUnmount(() => {
  6722. destroyed.value = true;
  6723. });
  6724. const shouldRender = computed(() => {
  6725. return unref(persistentRef) ? true : unref(open);
  6726. });
  6727. const shouldShow = computed(() => {
  6728. return props.disabled ? false : unref(open);
  6729. });
  6730. const contentStyle = computed(() => {
  6731. var _a2;
  6732. return (_a2 = props.style) != null ? _a2 : {};
  6733. });
  6734. const ariaHidden = computed(() => !unref(open));
  6735. useEscapeKeydown(onClose);
  6736. const onTransitionLeave = () => {
  6737. onHide();
  6738. };
  6739. const stopWhenControlled = () => {
  6740. if (unref(controlled))
  6741. return true;
  6742. };
  6743. const onContentEnter = composeEventHandlers(stopWhenControlled, () => {
  6744. if (props.enterable && unref(trigger) === "hover") {
  6745. onOpen();
  6746. }
  6747. });
  6748. const onContentLeave = composeEventHandlers(stopWhenControlled, () => {
  6749. if (unref(trigger) === "hover") {
  6750. onClose();
  6751. }
  6752. });
  6753. const onBeforeEnter = () => {
  6754. var _a2, _b2;
  6755. (_b2 = (_a2 = contentRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b2.call(_a2);
  6756. onBeforeShow == null ? void 0 : onBeforeShow();
  6757. };
  6758. const onBeforeLeave = () => {
  6759. onBeforeHide == null ? void 0 : onBeforeHide();
  6760. };
  6761. const onAfterShow = () => {
  6762. onShow();
  6763. };
  6764. let stopHandle;
  6765. watch(() => unref(open), (val) => {
  6766. if (val) {
  6767. stopHandle = onClickOutside(computed(() => {
  6768. var _a2;
  6769. return (_a2 = contentRef.value) == null ? void 0 : _a2.popperContentRef;
  6770. }), () => {
  6771. if (unref(controlled))
  6772. return;
  6773. const $trigger = unref(trigger);
  6774. if ($trigger !== "hover") {
  6775. onClose();
  6776. }
  6777. });
  6778. } else {
  6779. stopHandle == null ? void 0 : stopHandle();
  6780. }
  6781. }, {
  6782. flush: "post"
  6783. });
  6784. return {
  6785. ariaHidden,
  6786. entering,
  6787. leaving,
  6788. id,
  6789. intermediateOpen,
  6790. contentStyle,
  6791. contentRef,
  6792. destroyed,
  6793. shouldRender,
  6794. shouldShow,
  6795. open,
  6796. onAfterShow,
  6797. onBeforeEnter,
  6798. onBeforeLeave,
  6799. onContentEnter,
  6800. onContentLeave,
  6801. onTransitionLeave
  6802. };
  6803. }
  6804. });
  6805. function _sfc_render$z(_ctx, _cache, $props, $setup, $data, $options) {
  6806. const _component_el_visually_hidden = resolveComponent("el-visually-hidden");
  6807. const _component_el_popper_content = resolveComponent("el-popper-content");
  6808. return openBlock(), createBlock(Teleport, {
  6809. disabled: !_ctx.teleported,
  6810. to: _ctx.appendTo
  6811. }, [
  6812. createVNode(Transition, {
  6813. name: _ctx.transition,
  6814. onAfterLeave: _ctx.onTransitionLeave,
  6815. onBeforeEnter: _ctx.onBeforeEnter,
  6816. onAfterEnter: _ctx.onAfterShow,
  6817. onBeforeLeave: _ctx.onBeforeLeave
  6818. }, {
  6819. default: withCtx(() => [
  6820. _ctx.shouldRender ? withDirectives((openBlock(), createBlock(_component_el_popper_content, mergeProps({
  6821. key: 0,
  6822. ref: "contentRef"
  6823. }, _ctx.$attrs, {
  6824. "aria-hidden": _ctx.ariaHidden,
  6825. "boundaries-padding": _ctx.boundariesPadding,
  6826. "fallback-placements": _ctx.fallbackPlacements,
  6827. "gpu-acceleration": _ctx.gpuAcceleration,
  6828. offset: _ctx.offset,
  6829. placement: _ctx.placement,
  6830. "popper-options": _ctx.popperOptions,
  6831. strategy: _ctx.strategy,
  6832. effect: _ctx.effect,
  6833. enterable: _ctx.enterable,
  6834. pure: _ctx.pure,
  6835. "popper-class": _ctx.popperClass,
  6836. "popper-style": [_ctx.popperStyle, _ctx.contentStyle],
  6837. "reference-el": _ctx.referenceEl,
  6838. visible: _ctx.shouldShow,
  6839. "z-index": _ctx.zIndex,
  6840. onMouseenter: _ctx.onContentEnter,
  6841. onMouseleave: _ctx.onContentLeave
  6842. }), {
  6843. default: withCtx(() => [
  6844. createCommentVNode(" Workaround bug #6378 "),
  6845. !_ctx.destroyed ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  6846. renderSlot(_ctx.$slots, "default"),
  6847. createVNode(_component_el_visually_hidden, {
  6848. id: _ctx.id,
  6849. role: "tooltip"
  6850. }, {
  6851. default: withCtx(() => [
  6852. createTextVNode(toDisplayString(_ctx.ariaLabel), 1)
  6853. ]),
  6854. _: 1
  6855. }, 8, ["id"])
  6856. ], 64)) : createCommentVNode("v-if", true)
  6857. ]),
  6858. _: 3
  6859. }, 16, ["aria-hidden", "boundaries-padding", "fallback-placements", "gpu-acceleration", "offset", "placement", "popper-options", "strategy", "effect", "enterable", "pure", "popper-class", "popper-style", "reference-el", "visible", "z-index", "onMouseenter", "onMouseleave"])), [
  6860. [vShow, _ctx.shouldShow]
  6861. ]) : createCommentVNode("v-if", true)
  6862. ]),
  6863. _: 3
  6864. }, 8, ["name", "onAfterLeave", "onBeforeEnter", "onAfterEnter", "onBeforeLeave"])
  6865. ], 8, ["disabled", "to"]);
  6866. }
  6867. var ElTooltipContent = /* @__PURE__ */ _export_sfc$1(_sfc_main$Y, [["render", _sfc_render$z], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/tooltip/src/content.vue"]]);
  6868. const isTriggerType = (trigger, type4) => {
  6869. if (isArray(trigger)) {
  6870. return trigger.includes(type4);
  6871. }
  6872. return trigger === type4;
  6873. };
  6874. const whenTrigger = (trigger, type4, handler3) => {
  6875. return (e) => {
  6876. isTriggerType(unref(trigger), type4) && handler3(e);
  6877. };
  6878. };
  6879. const _sfc_main$X = defineComponent({
  6880. name: "ElTooltipTrigger",
  6881. components: {
  6882. ElPopperTrigger
  6883. },
  6884. props: useTooltipTriggerProps,
  6885. setup(props) {
  6886. const ns = useNamespace("tooltip");
  6887. const { controlled, id, open, onOpen, onClose, onToggle } = inject(TOOLTIP_INJECTION_KEY, void 0);
  6888. const triggerRef2 = ref(null);
  6889. const stopWhenControlledOrDisabled = () => {
  6890. if (unref(controlled) || props.disabled) {
  6891. return true;
  6892. }
  6893. };
  6894. const trigger = toRef(props, "trigger");
  6895. const onMouseenter = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "hover", onOpen));
  6896. const onMouseleave = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "hover", onClose));
  6897. const onClick = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "click", (e) => {
  6898. if (e.button === 0) {
  6899. onToggle(e);
  6900. }
  6901. }));
  6902. const onFocus = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "focus", onOpen));
  6903. const onBlur = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "focus", onClose));
  6904. const onContextMenu = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "contextmenu", (e) => {
  6905. e.preventDefault();
  6906. onToggle(e);
  6907. }));
  6908. const onKeydown = composeEventHandlers(stopWhenControlledOrDisabled, (e) => {
  6909. const { code } = e;
  6910. if (code === EVENT_CODE.enter || code === EVENT_CODE.space) {
  6911. onToggle(e);
  6912. }
  6913. });
  6914. return {
  6915. onBlur,
  6916. onContextMenu,
  6917. onFocus,
  6918. onMouseenter,
  6919. onMouseleave,
  6920. onClick,
  6921. onKeydown,
  6922. open,
  6923. id,
  6924. triggerRef: triggerRef2,
  6925. ns
  6926. };
  6927. }
  6928. });
  6929. function _sfc_render$y(_ctx, _cache, $props, $setup, $data, $options) {
  6930. const _component_el_popper_trigger = resolveComponent("el-popper-trigger");
  6931. return openBlock(), createBlock(_component_el_popper_trigger, {
  6932. id: _ctx.id,
  6933. "virtual-ref": _ctx.virtualRef,
  6934. open: _ctx.open,
  6935. "virtual-triggering": _ctx.virtualTriggering,
  6936. class: normalizeClass(_ctx.ns.e("trigger")),
  6937. onBlur: _ctx.onBlur,
  6938. onClick: _ctx.onClick,
  6939. onContextmenu: _ctx.onContextMenu,
  6940. onFocus: _ctx.onFocus,
  6941. onMouseenter: _ctx.onMouseenter,
  6942. onMouseleave: _ctx.onMouseleave,
  6943. onKeydown: _ctx.onKeydown
  6944. }, {
  6945. default: withCtx(() => [
  6946. renderSlot(_ctx.$slots, "default")
  6947. ]),
  6948. _: 3
  6949. }, 8, ["id", "virtual-ref", "open", "virtual-triggering", "class", "onBlur", "onClick", "onContextmenu", "onFocus", "onMouseenter", "onMouseleave", "onKeydown"]);
  6950. }
  6951. var ElTooltipTrigger = /* @__PURE__ */ _export_sfc$1(_sfc_main$X, [["render", _sfc_render$y], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/tooltip/src/trigger.vue"]]);
  6952. const { useModelToggleProps, useModelToggle, useModelToggleEmits } = createModelToggleComposable("visible");
  6953. const _sfc_main$W = defineComponent({
  6954. name: "ElTooltip",
  6955. components: {
  6956. ElPopper,
  6957. ElPopperArrow,
  6958. ElTooltipContent,
  6959. ElTooltipTrigger
  6960. },
  6961. props: __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, useModelToggleProps), useTooltipContentProps), useTooltipTriggerProps), usePopperArrowProps), useTooltipProps),
  6962. emits: [...useModelToggleEmits, "before-show", "before-hide", "show", "hide"],
  6963. setup(props, { emit }) {
  6964. usePopperContainer();
  6965. const compatShowAfter = computed(() => {
  6966. if (!isUndefined(props.openDelay))
  6967. ;
  6968. return props.openDelay || props.showAfter;
  6969. });
  6970. const compatShowArrow = computed(() => {
  6971. if (!isUndefined(props.visibleArrow))
  6972. ;
  6973. return isBoolean(props.visibleArrow) ? props.visibleArrow : props.showArrow;
  6974. });
  6975. const id = useId();
  6976. const popperRef = ref(null);
  6977. const updatePopper = () => {
  6978. var _a2;
  6979. const popperComponent = unref(popperRef);
  6980. if (popperComponent) {
  6981. (_a2 = popperComponent.popperInstanceRef) == null ? void 0 : _a2.update();
  6982. }
  6983. };
  6984. const open = ref(false);
  6985. const { show, hide: hide2 } = useModelToggle({
  6986. indicator: open
  6987. });
  6988. const { onOpen, onClose } = useDelayedToggle({
  6989. showAfter: compatShowAfter,
  6990. hideAfter: toRef(props, "hideAfter"),
  6991. open: show,
  6992. close: hide2
  6993. });
  6994. const controlled = computed(() => isBoolean(props.visible));
  6995. provide(TOOLTIP_INJECTION_KEY, {
  6996. controlled,
  6997. id,
  6998. open: readonly(open),
  6999. trigger: toRef(props, "trigger"),
  7000. onOpen,
  7001. onClose,
  7002. onToggle: () => {
  7003. if (unref(open)) {
  7004. onClose();
  7005. } else {
  7006. onOpen();
  7007. }
  7008. },
  7009. onShow: () => {
  7010. emit("show");
  7011. },
  7012. onHide: () => {
  7013. emit("hide");
  7014. },
  7015. onBeforeShow: () => {
  7016. emit("before-show");
  7017. },
  7018. onBeforeHide: () => {
  7019. emit("before-hide");
  7020. },
  7021. updatePopper
  7022. });
  7023. watch(() => props.disabled, (disabled) => {
  7024. if (disabled && open.value) {
  7025. open.value = false;
  7026. }
  7027. });
  7028. return {
  7029. compatShowAfter,
  7030. compatShowArrow,
  7031. popperRef,
  7032. open,
  7033. hide: hide2,
  7034. updatePopper,
  7035. onOpen,
  7036. onClose
  7037. };
  7038. }
  7039. });
  7040. const _hoisted_1$C = ["innerHTML"];
  7041. const _hoisted_2$t = { key: 1 };
  7042. function _sfc_render$x(_ctx, _cache, $props, $setup, $data, $options) {
  7043. const _component_el_tooltip_trigger = resolveComponent("el-tooltip-trigger");
  7044. const _component_el_popper_arrow = resolveComponent("el-popper-arrow");
  7045. const _component_el_tooltip_content = resolveComponent("el-tooltip-content");
  7046. const _component_el_popper = resolveComponent("el-popper");
  7047. return openBlock(), createBlock(_component_el_popper, { ref: "popperRef" }, {
  7048. default: withCtx(() => [
  7049. createVNode(_component_el_tooltip_trigger, {
  7050. disabled: _ctx.disabled,
  7051. trigger: _ctx.trigger,
  7052. "virtual-ref": _ctx.virtualRef,
  7053. "virtual-triggering": _ctx.virtualTriggering
  7054. }, {
  7055. default: withCtx(() => [
  7056. _ctx.$slots.default ? renderSlot(_ctx.$slots, "default", { key: 0 }) : createCommentVNode("v-if", true)
  7057. ]),
  7058. _: 3
  7059. }, 8, ["disabled", "trigger", "virtual-ref", "virtual-triggering"]),
  7060. createVNode(_component_el_tooltip_content, {
  7061. "aria-label": _ctx.ariaLabel,
  7062. "boundaries-padding": _ctx.boundariesPadding,
  7063. content: _ctx.content,
  7064. disabled: _ctx.disabled,
  7065. effect: _ctx.effect,
  7066. enterable: _ctx.enterable,
  7067. "fallback-placements": _ctx.fallbackPlacements,
  7068. "hide-after": _ctx.hideAfter,
  7069. "gpu-acceleration": _ctx.gpuAcceleration,
  7070. offset: _ctx.offset,
  7071. persistent: _ctx.persistent,
  7072. "popper-class": _ctx.popperClass,
  7073. "popper-style": _ctx.popperStyle,
  7074. placement: _ctx.placement,
  7075. "popper-options": _ctx.popperOptions,
  7076. pure: _ctx.pure,
  7077. "raw-content": _ctx.rawContent,
  7078. "reference-el": _ctx.referenceEl,
  7079. "show-after": _ctx.compatShowAfter,
  7080. strategy: _ctx.strategy,
  7081. teleported: _ctx.teleported,
  7082. transition: _ctx.transition,
  7083. "z-index": _ctx.zIndex,
  7084. "append-to": _ctx.appendTo
  7085. }, {
  7086. default: withCtx(() => [
  7087. renderSlot(_ctx.$slots, "content", {}, () => [
  7088. _ctx.rawContent ? (openBlock(), createElementBlock("span", {
  7089. key: 0,
  7090. innerHTML: _ctx.content
  7091. }, null, 8, _hoisted_1$C)) : (openBlock(), createElementBlock("span", _hoisted_2$t, toDisplayString(_ctx.content), 1))
  7092. ]),
  7093. _ctx.compatShowArrow ? (openBlock(), createBlock(_component_el_popper_arrow, {
  7094. key: 0,
  7095. "arrow-offset": _ctx.arrowOffset
  7096. }, null, 8, ["arrow-offset"])) : createCommentVNode("v-if", true)
  7097. ]),
  7098. _: 3
  7099. }, 8, ["aria-label", "boundaries-padding", "content", "disabled", "effect", "enterable", "fallback-placements", "hide-after", "gpu-acceleration", "offset", "persistent", "popper-class", "popper-style", "placement", "popper-options", "pure", "raw-content", "reference-el", "show-after", "strategy", "teleported", "transition", "z-index", "append-to"])
  7100. ]),
  7101. _: 3
  7102. }, 512);
  7103. }
  7104. var Tooltip = /* @__PURE__ */ _export_sfc$1(_sfc_main$W, [["render", _sfc_render$x], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/tooltip/src/tooltip.vue"]]);
  7105. const ElTooltip = withInstall(Tooltip);
  7106. const buttonTypes = [
  7107. "default",
  7108. "primary",
  7109. "success",
  7110. "warning",
  7111. "info",
  7112. "danger",
  7113. "text",
  7114. ""
  7115. ];
  7116. const buttonNativeTypes = ["button", "submit", "reset"];
  7117. const buttonProps = buildProps({
  7118. size: useSizeProp,
  7119. disabled: Boolean,
  7120. type: {
  7121. type: String,
  7122. values: buttonTypes,
  7123. default: ""
  7124. },
  7125. icon: {
  7126. type: iconPropType,
  7127. default: ""
  7128. },
  7129. nativeType: {
  7130. type: String,
  7131. values: buttonNativeTypes,
  7132. default: "button"
  7133. },
  7134. loading: Boolean,
  7135. loadingIcon: {
  7136. type: iconPropType,
  7137. default: () => loading
  7138. },
  7139. plain: Boolean,
  7140. autofocus: Boolean,
  7141. round: Boolean,
  7142. circle: Boolean,
  7143. color: String,
  7144. dark: Boolean,
  7145. autoInsertSpace: {
  7146. type: Boolean,
  7147. default: void 0
  7148. }
  7149. });
  7150. const buttonEmits = {
  7151. click: (evt) => evt instanceof MouseEvent
  7152. };
  7153. function bound01(n, max2) {
  7154. if (isOnePointZero(n)) {
  7155. n = "100%";
  7156. }
  7157. var isPercent = isPercentage(n);
  7158. n = max2 === 360 ? n : Math.min(max2, Math.max(0, parseFloat(n)));
  7159. if (isPercent) {
  7160. n = parseInt(String(n * max2), 10) / 100;
  7161. }
  7162. if (Math.abs(n - max2) < 1e-6) {
  7163. return 1;
  7164. }
  7165. if (max2 === 360) {
  7166. n = (n < 0 ? n % max2 + max2 : n % max2) / parseFloat(String(max2));
  7167. } else {
  7168. n = n % max2 / parseFloat(String(max2));
  7169. }
  7170. return n;
  7171. }
  7172. function clamp01(val) {
  7173. return Math.min(1, Math.max(0, val));
  7174. }
  7175. function isOnePointZero(n) {
  7176. return typeof n === "string" && n.indexOf(".") !== -1 && parseFloat(n) === 1;
  7177. }
  7178. function isPercentage(n) {
  7179. return typeof n === "string" && n.indexOf("%") !== -1;
  7180. }
  7181. function boundAlpha(a2) {
  7182. a2 = parseFloat(a2);
  7183. if (isNaN(a2) || a2 < 0 || a2 > 1) {
  7184. a2 = 1;
  7185. }
  7186. return a2;
  7187. }
  7188. function convertToPercentage(n) {
  7189. if (n <= 1) {
  7190. return "".concat(Number(n) * 100, "%");
  7191. }
  7192. return n;
  7193. }
  7194. function pad2(c2) {
  7195. return c2.length === 1 ? "0" + c2 : String(c2);
  7196. }
  7197. function rgbToRgb(r, g, b2) {
  7198. return {
  7199. r: bound01(r, 255) * 255,
  7200. g: bound01(g, 255) * 255,
  7201. b: bound01(b2, 255) * 255
  7202. };
  7203. }
  7204. function rgbToHsl(r, g, b2) {
  7205. r = bound01(r, 255);
  7206. g = bound01(g, 255);
  7207. b2 = bound01(b2, 255);
  7208. var max2 = Math.max(r, g, b2);
  7209. var min2 = Math.min(r, g, b2);
  7210. var h2 = 0;
  7211. var s2 = 0;
  7212. var l2 = (max2 + min2) / 2;
  7213. if (max2 === min2) {
  7214. s2 = 0;
  7215. h2 = 0;
  7216. } else {
  7217. var d2 = max2 - min2;
  7218. s2 = l2 > 0.5 ? d2 / (2 - max2 - min2) : d2 / (max2 + min2);
  7219. switch (max2) {
  7220. case r:
  7221. h2 = (g - b2) / d2 + (g < b2 ? 6 : 0);
  7222. break;
  7223. case g:
  7224. h2 = (b2 - r) / d2 + 2;
  7225. break;
  7226. case b2:
  7227. h2 = (r - g) / d2 + 4;
  7228. break;
  7229. }
  7230. h2 /= 6;
  7231. }
  7232. return { h: h2, s: s2, l: l2 };
  7233. }
  7234. function hue2rgb(p2, q, t) {
  7235. if (t < 0) {
  7236. t += 1;
  7237. }
  7238. if (t > 1) {
  7239. t -= 1;
  7240. }
  7241. if (t < 1 / 6) {
  7242. return p2 + (q - p2) * (6 * t);
  7243. }
  7244. if (t < 1 / 2) {
  7245. return q;
  7246. }
  7247. if (t < 2 / 3) {
  7248. return p2 + (q - p2) * (2 / 3 - t) * 6;
  7249. }
  7250. return p2;
  7251. }
  7252. function hslToRgb(h2, s2, l2) {
  7253. var r;
  7254. var g;
  7255. var b2;
  7256. h2 = bound01(h2, 360);
  7257. s2 = bound01(s2, 100);
  7258. l2 = bound01(l2, 100);
  7259. if (s2 === 0) {
  7260. g = l2;
  7261. b2 = l2;
  7262. r = l2;
  7263. } else {
  7264. var q = l2 < 0.5 ? l2 * (1 + s2) : l2 + s2 - l2 * s2;
  7265. var p2 = 2 * l2 - q;
  7266. r = hue2rgb(p2, q, h2 + 1 / 3);
  7267. g = hue2rgb(p2, q, h2);
  7268. b2 = hue2rgb(p2, q, h2 - 1 / 3);
  7269. }
  7270. return { r: r * 255, g: g * 255, b: b2 * 255 };
  7271. }
  7272. function rgbToHsv(r, g, b2) {
  7273. r = bound01(r, 255);
  7274. g = bound01(g, 255);
  7275. b2 = bound01(b2, 255);
  7276. var max2 = Math.max(r, g, b2);
  7277. var min2 = Math.min(r, g, b2);
  7278. var h2 = 0;
  7279. var v2 = max2;
  7280. var d2 = max2 - min2;
  7281. var s2 = max2 === 0 ? 0 : d2 / max2;
  7282. if (max2 === min2) {
  7283. h2 = 0;
  7284. } else {
  7285. switch (max2) {
  7286. case r:
  7287. h2 = (g - b2) / d2 + (g < b2 ? 6 : 0);
  7288. break;
  7289. case g:
  7290. h2 = (b2 - r) / d2 + 2;
  7291. break;
  7292. case b2:
  7293. h2 = (r - g) / d2 + 4;
  7294. break;
  7295. }
  7296. h2 /= 6;
  7297. }
  7298. return { h: h2, s: s2, v: v2 };
  7299. }
  7300. function hsvToRgb(h2, s2, v2) {
  7301. h2 = bound01(h2, 360) * 6;
  7302. s2 = bound01(s2, 100);
  7303. v2 = bound01(v2, 100);
  7304. var i = Math.floor(h2);
  7305. var f2 = h2 - i;
  7306. var p2 = v2 * (1 - s2);
  7307. var q = v2 * (1 - f2 * s2);
  7308. var t = v2 * (1 - (1 - f2) * s2);
  7309. var mod = i % 6;
  7310. var r = [v2, q, p2, p2, t, v2][mod];
  7311. var g = [t, v2, v2, q, p2, p2][mod];
  7312. var b2 = [p2, p2, t, v2, v2, q][mod];
  7313. return { r: r * 255, g: g * 255, b: b2 * 255 };
  7314. }
  7315. function rgbToHex(r, g, b2, allow3Char) {
  7316. var hex2 = [
  7317. pad2(Math.round(r).toString(16)),
  7318. pad2(Math.round(g).toString(16)),
  7319. pad2(Math.round(b2).toString(16))
  7320. ];
  7321. if (allow3Char && hex2[0].startsWith(hex2[0].charAt(1)) && hex2[1].startsWith(hex2[1].charAt(1)) && hex2[2].startsWith(hex2[2].charAt(1))) {
  7322. return hex2[0].charAt(0) + hex2[1].charAt(0) + hex2[2].charAt(0);
  7323. }
  7324. return hex2.join("");
  7325. }
  7326. function rgbaToHex(r, g, b2, a2, allow4Char) {
  7327. var hex2 = [
  7328. pad2(Math.round(r).toString(16)),
  7329. pad2(Math.round(g).toString(16)),
  7330. pad2(Math.round(b2).toString(16)),
  7331. pad2(convertDecimalToHex(a2))
  7332. ];
  7333. if (allow4Char && hex2[0].startsWith(hex2[0].charAt(1)) && hex2[1].startsWith(hex2[1].charAt(1)) && hex2[2].startsWith(hex2[2].charAt(1)) && hex2[3].startsWith(hex2[3].charAt(1))) {
  7334. return hex2[0].charAt(0) + hex2[1].charAt(0) + hex2[2].charAt(0) + hex2[3].charAt(0);
  7335. }
  7336. return hex2.join("");
  7337. }
  7338. function convertDecimalToHex(d2) {
  7339. return Math.round(parseFloat(d2) * 255).toString(16);
  7340. }
  7341. function convertHexToDecimal(h2) {
  7342. return parseIntFromHex(h2) / 255;
  7343. }
  7344. function parseIntFromHex(val) {
  7345. return parseInt(val, 16);
  7346. }
  7347. function numberInputToObject(color) {
  7348. return {
  7349. r: color >> 16,
  7350. g: (color & 65280) >> 8,
  7351. b: color & 255
  7352. };
  7353. }
  7354. var names = {
  7355. aliceblue: "#f0f8ff",
  7356. antiquewhite: "#faebd7",
  7357. aqua: "#00ffff",
  7358. aquamarine: "#7fffd4",
  7359. azure: "#f0ffff",
  7360. beige: "#f5f5dc",
  7361. bisque: "#ffe4c4",
  7362. black: "#000000",
  7363. blanchedalmond: "#ffebcd",
  7364. blue: "#0000ff",
  7365. blueviolet: "#8a2be2",
  7366. brown: "#a52a2a",
  7367. burlywood: "#deb887",
  7368. cadetblue: "#5f9ea0",
  7369. chartreuse: "#7fff00",
  7370. chocolate: "#d2691e",
  7371. coral: "#ff7f50",
  7372. cornflowerblue: "#6495ed",
  7373. cornsilk: "#fff8dc",
  7374. crimson: "#dc143c",
  7375. cyan: "#00ffff",
  7376. darkblue: "#00008b",
  7377. darkcyan: "#008b8b",
  7378. darkgoldenrod: "#b8860b",
  7379. darkgray: "#a9a9a9",
  7380. darkgreen: "#006400",
  7381. darkgrey: "#a9a9a9",
  7382. darkkhaki: "#bdb76b",
  7383. darkmagenta: "#8b008b",
  7384. darkolivegreen: "#556b2f",
  7385. darkorange: "#ff8c00",
  7386. darkorchid: "#9932cc",
  7387. darkred: "#8b0000",
  7388. darksalmon: "#e9967a",
  7389. darkseagreen: "#8fbc8f",
  7390. darkslateblue: "#483d8b",
  7391. darkslategray: "#2f4f4f",
  7392. darkslategrey: "#2f4f4f",
  7393. darkturquoise: "#00ced1",
  7394. darkviolet: "#9400d3",
  7395. deeppink: "#ff1493",
  7396. deepskyblue: "#00bfff",
  7397. dimgray: "#696969",
  7398. dimgrey: "#696969",
  7399. dodgerblue: "#1e90ff",
  7400. firebrick: "#b22222",
  7401. floralwhite: "#fffaf0",
  7402. forestgreen: "#228b22",
  7403. fuchsia: "#ff00ff",
  7404. gainsboro: "#dcdcdc",
  7405. ghostwhite: "#f8f8ff",
  7406. goldenrod: "#daa520",
  7407. gold: "#ffd700",
  7408. gray: "#808080",
  7409. green: "#008000",
  7410. greenyellow: "#adff2f",
  7411. grey: "#808080",
  7412. honeydew: "#f0fff0",
  7413. hotpink: "#ff69b4",
  7414. indianred: "#cd5c5c",
  7415. indigo: "#4b0082",
  7416. ivory: "#fffff0",
  7417. khaki: "#f0e68c",
  7418. lavenderblush: "#fff0f5",
  7419. lavender: "#e6e6fa",
  7420. lawngreen: "#7cfc00",
  7421. lemonchiffon: "#fffacd",
  7422. lightblue: "#add8e6",
  7423. lightcoral: "#f08080",
  7424. lightcyan: "#e0ffff",
  7425. lightgoldenrodyellow: "#fafad2",
  7426. lightgray: "#d3d3d3",
  7427. lightgreen: "#90ee90",
  7428. lightgrey: "#d3d3d3",
  7429. lightpink: "#ffb6c1",
  7430. lightsalmon: "#ffa07a",
  7431. lightseagreen: "#20b2aa",
  7432. lightskyblue: "#87cefa",
  7433. lightslategray: "#778899",
  7434. lightslategrey: "#778899",
  7435. lightsteelblue: "#b0c4de",
  7436. lightyellow: "#ffffe0",
  7437. lime: "#00ff00",
  7438. limegreen: "#32cd32",
  7439. linen: "#faf0e6",
  7440. magenta: "#ff00ff",
  7441. maroon: "#800000",
  7442. mediumaquamarine: "#66cdaa",
  7443. mediumblue: "#0000cd",
  7444. mediumorchid: "#ba55d3",
  7445. mediumpurple: "#9370db",
  7446. mediumseagreen: "#3cb371",
  7447. mediumslateblue: "#7b68ee",
  7448. mediumspringgreen: "#00fa9a",
  7449. mediumturquoise: "#48d1cc",
  7450. mediumvioletred: "#c71585",
  7451. midnightblue: "#191970",
  7452. mintcream: "#f5fffa",
  7453. mistyrose: "#ffe4e1",
  7454. moccasin: "#ffe4b5",
  7455. navajowhite: "#ffdead",
  7456. navy: "#000080",
  7457. oldlace: "#fdf5e6",
  7458. olive: "#808000",
  7459. olivedrab: "#6b8e23",
  7460. orange: "#ffa500",
  7461. orangered: "#ff4500",
  7462. orchid: "#da70d6",
  7463. palegoldenrod: "#eee8aa",
  7464. palegreen: "#98fb98",
  7465. paleturquoise: "#afeeee",
  7466. palevioletred: "#db7093",
  7467. papayawhip: "#ffefd5",
  7468. peachpuff: "#ffdab9",
  7469. peru: "#cd853f",
  7470. pink: "#ffc0cb",
  7471. plum: "#dda0dd",
  7472. powderblue: "#b0e0e6",
  7473. purple: "#800080",
  7474. rebeccapurple: "#663399",
  7475. red: "#ff0000",
  7476. rosybrown: "#bc8f8f",
  7477. royalblue: "#4169e1",
  7478. saddlebrown: "#8b4513",
  7479. salmon: "#fa8072",
  7480. sandybrown: "#f4a460",
  7481. seagreen: "#2e8b57",
  7482. seashell: "#fff5ee",
  7483. sienna: "#a0522d",
  7484. silver: "#c0c0c0",
  7485. skyblue: "#87ceeb",
  7486. slateblue: "#6a5acd",
  7487. slategray: "#708090",
  7488. slategrey: "#708090",
  7489. snow: "#fffafa",
  7490. springgreen: "#00ff7f",
  7491. steelblue: "#4682b4",
  7492. tan: "#d2b48c",
  7493. teal: "#008080",
  7494. thistle: "#d8bfd8",
  7495. tomato: "#ff6347",
  7496. turquoise: "#40e0d0",
  7497. violet: "#ee82ee",
  7498. wheat: "#f5deb3",
  7499. white: "#ffffff",
  7500. whitesmoke: "#f5f5f5",
  7501. yellow: "#ffff00",
  7502. yellowgreen: "#9acd32"
  7503. };
  7504. function inputToRGB(color) {
  7505. var rgb = { r: 0, g: 0, b: 0 };
  7506. var a2 = 1;
  7507. var s2 = null;
  7508. var v2 = null;
  7509. var l2 = null;
  7510. var ok = false;
  7511. var format2 = false;
  7512. if (typeof color === "string") {
  7513. color = stringInputToObject(color);
  7514. }
  7515. if (typeof color === "object") {
  7516. if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
  7517. rgb = rgbToRgb(color.r, color.g, color.b);
  7518. ok = true;
  7519. format2 = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
  7520. } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
  7521. s2 = convertToPercentage(color.s);
  7522. v2 = convertToPercentage(color.v);
  7523. rgb = hsvToRgb(color.h, s2, v2);
  7524. ok = true;
  7525. format2 = "hsv";
  7526. } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
  7527. s2 = convertToPercentage(color.s);
  7528. l2 = convertToPercentage(color.l);
  7529. rgb = hslToRgb(color.h, s2, l2);
  7530. ok = true;
  7531. format2 = "hsl";
  7532. }
  7533. if (Object.prototype.hasOwnProperty.call(color, "a")) {
  7534. a2 = color.a;
  7535. }
  7536. }
  7537. a2 = boundAlpha(a2);
  7538. return {
  7539. ok,
  7540. format: color.format || format2,
  7541. r: Math.min(255, Math.max(rgb.r, 0)),
  7542. g: Math.min(255, Math.max(rgb.g, 0)),
  7543. b: Math.min(255, Math.max(rgb.b, 0)),
  7544. a: a2
  7545. };
  7546. }
  7547. var CSS_INTEGER = "[-\\+]?\\d+%?";
  7548. var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";
  7549. var CSS_UNIT = "(?:".concat(CSS_NUMBER, ")|(?:").concat(CSS_INTEGER, ")");
  7550. var PERMISSIVE_MATCH3 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
  7551. var PERMISSIVE_MATCH4 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
  7552. var matchers = {
  7553. CSS_UNIT: new RegExp(CSS_UNIT),
  7554. rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
  7555. rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
  7556. hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
  7557. hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
  7558. hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
  7559. hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
  7560. hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
  7561. hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
  7562. hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
  7563. hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
  7564. };
  7565. function stringInputToObject(color) {
  7566. color = color.trim().toLowerCase();
  7567. if (color.length === 0) {
  7568. return false;
  7569. }
  7570. var named = false;
  7571. if (names[color]) {
  7572. color = names[color];
  7573. named = true;
  7574. } else if (color === "transparent") {
  7575. return { r: 0, g: 0, b: 0, a: 0, format: "name" };
  7576. }
  7577. var match = matchers.rgb.exec(color);
  7578. if (match) {
  7579. return { r: match[1], g: match[2], b: match[3] };
  7580. }
  7581. match = matchers.rgba.exec(color);
  7582. if (match) {
  7583. return { r: match[1], g: match[2], b: match[3], a: match[4] };
  7584. }
  7585. match = matchers.hsl.exec(color);
  7586. if (match) {
  7587. return { h: match[1], s: match[2], l: match[3] };
  7588. }
  7589. match = matchers.hsla.exec(color);
  7590. if (match) {
  7591. return { h: match[1], s: match[2], l: match[3], a: match[4] };
  7592. }
  7593. match = matchers.hsv.exec(color);
  7594. if (match) {
  7595. return { h: match[1], s: match[2], v: match[3] };
  7596. }
  7597. match = matchers.hsva.exec(color);
  7598. if (match) {
  7599. return { h: match[1], s: match[2], v: match[3], a: match[4] };
  7600. }
  7601. match = matchers.hex8.exec(color);
  7602. if (match) {
  7603. return {
  7604. r: parseIntFromHex(match[1]),
  7605. g: parseIntFromHex(match[2]),
  7606. b: parseIntFromHex(match[3]),
  7607. a: convertHexToDecimal(match[4]),
  7608. format: named ? "name" : "hex8"
  7609. };
  7610. }
  7611. match = matchers.hex6.exec(color);
  7612. if (match) {
  7613. return {
  7614. r: parseIntFromHex(match[1]),
  7615. g: parseIntFromHex(match[2]),
  7616. b: parseIntFromHex(match[3]),
  7617. format: named ? "name" : "hex"
  7618. };
  7619. }
  7620. match = matchers.hex4.exec(color);
  7621. if (match) {
  7622. return {
  7623. r: parseIntFromHex(match[1] + match[1]),
  7624. g: parseIntFromHex(match[2] + match[2]),
  7625. b: parseIntFromHex(match[3] + match[3]),
  7626. a: convertHexToDecimal(match[4] + match[4]),
  7627. format: named ? "name" : "hex8"
  7628. };
  7629. }
  7630. match = matchers.hex3.exec(color);
  7631. if (match) {
  7632. return {
  7633. r: parseIntFromHex(match[1] + match[1]),
  7634. g: parseIntFromHex(match[2] + match[2]),
  7635. b: parseIntFromHex(match[3] + match[3]),
  7636. format: named ? "name" : "hex"
  7637. };
  7638. }
  7639. return false;
  7640. }
  7641. function isValidCSSUnit(color) {
  7642. return Boolean(matchers.CSS_UNIT.exec(String(color)));
  7643. }
  7644. var TinyColor = function() {
  7645. function TinyColor2(color, opts) {
  7646. if (color === void 0) {
  7647. color = "";
  7648. }
  7649. if (opts === void 0) {
  7650. opts = {};
  7651. }
  7652. var _a2;
  7653. if (color instanceof TinyColor2) {
  7654. return color;
  7655. }
  7656. if (typeof color === "number") {
  7657. color = numberInputToObject(color);
  7658. }
  7659. this.originalInput = color;
  7660. var rgb = inputToRGB(color);
  7661. this.originalInput = color;
  7662. this.r = rgb.r;
  7663. this.g = rgb.g;
  7664. this.b = rgb.b;
  7665. this.a = rgb.a;
  7666. this.roundA = Math.round(100 * this.a) / 100;
  7667. this.format = (_a2 = opts.format) !== null && _a2 !== void 0 ? _a2 : rgb.format;
  7668. this.gradientType = opts.gradientType;
  7669. if (this.r < 1) {
  7670. this.r = Math.round(this.r);
  7671. }
  7672. if (this.g < 1) {
  7673. this.g = Math.round(this.g);
  7674. }
  7675. if (this.b < 1) {
  7676. this.b = Math.round(this.b);
  7677. }
  7678. this.isValid = rgb.ok;
  7679. }
  7680. TinyColor2.prototype.isDark = function() {
  7681. return this.getBrightness() < 128;
  7682. };
  7683. TinyColor2.prototype.isLight = function() {
  7684. return !this.isDark();
  7685. };
  7686. TinyColor2.prototype.getBrightness = function() {
  7687. var rgb = this.toRgb();
  7688. return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1e3;
  7689. };
  7690. TinyColor2.prototype.getLuminance = function() {
  7691. var rgb = this.toRgb();
  7692. var R;
  7693. var G;
  7694. var B;
  7695. var RsRGB = rgb.r / 255;
  7696. var GsRGB = rgb.g / 255;
  7697. var BsRGB = rgb.b / 255;
  7698. if (RsRGB <= 0.03928) {
  7699. R = RsRGB / 12.92;
  7700. } else {
  7701. R = Math.pow((RsRGB + 0.055) / 1.055, 2.4);
  7702. }
  7703. if (GsRGB <= 0.03928) {
  7704. G = GsRGB / 12.92;
  7705. } else {
  7706. G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
  7707. }
  7708. if (BsRGB <= 0.03928) {
  7709. B = BsRGB / 12.92;
  7710. } else {
  7711. B = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
  7712. }
  7713. return 0.2126 * R + 0.7152 * G + 0.0722 * B;
  7714. };
  7715. TinyColor2.prototype.getAlpha = function() {
  7716. return this.a;
  7717. };
  7718. TinyColor2.prototype.setAlpha = function(alpha) {
  7719. this.a = boundAlpha(alpha);
  7720. this.roundA = Math.round(100 * this.a) / 100;
  7721. return this;
  7722. };
  7723. TinyColor2.prototype.toHsv = function() {
  7724. var hsv = rgbToHsv(this.r, this.g, this.b);
  7725. return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this.a };
  7726. };
  7727. TinyColor2.prototype.toHsvString = function() {
  7728. var hsv = rgbToHsv(this.r, this.g, this.b);
  7729. var h2 = Math.round(hsv.h * 360);
  7730. var s2 = Math.round(hsv.s * 100);
  7731. var v2 = Math.round(hsv.v * 100);
  7732. return this.a === 1 ? "hsv(".concat(h2, ", ").concat(s2, "%, ").concat(v2, "%)") : "hsva(".concat(h2, ", ").concat(s2, "%, ").concat(v2, "%, ").concat(this.roundA, ")");
  7733. };
  7734. TinyColor2.prototype.toHsl = function() {
  7735. var hsl = rgbToHsl(this.r, this.g, this.b);
  7736. return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this.a };
  7737. };
  7738. TinyColor2.prototype.toHslString = function() {
  7739. var hsl = rgbToHsl(this.r, this.g, this.b);
  7740. var h2 = Math.round(hsl.h * 360);
  7741. var s2 = Math.round(hsl.s * 100);
  7742. var l2 = Math.round(hsl.l * 100);
  7743. return this.a === 1 ? "hsl(".concat(h2, ", ").concat(s2, "%, ").concat(l2, "%)") : "hsla(".concat(h2, ", ").concat(s2, "%, ").concat(l2, "%, ").concat(this.roundA, ")");
  7744. };
  7745. TinyColor2.prototype.toHex = function(allow3Char) {
  7746. if (allow3Char === void 0) {
  7747. allow3Char = false;
  7748. }
  7749. return rgbToHex(this.r, this.g, this.b, allow3Char);
  7750. };
  7751. TinyColor2.prototype.toHexString = function(allow3Char) {
  7752. if (allow3Char === void 0) {
  7753. allow3Char = false;
  7754. }
  7755. return "#" + this.toHex(allow3Char);
  7756. };
  7757. TinyColor2.prototype.toHex8 = function(allow4Char) {
  7758. if (allow4Char === void 0) {
  7759. allow4Char = false;
  7760. }
  7761. return rgbaToHex(this.r, this.g, this.b, this.a, allow4Char);
  7762. };
  7763. TinyColor2.prototype.toHex8String = function(allow4Char) {
  7764. if (allow4Char === void 0) {
  7765. allow4Char = false;
  7766. }
  7767. return "#" + this.toHex8(allow4Char);
  7768. };
  7769. TinyColor2.prototype.toRgb = function() {
  7770. return {
  7771. r: Math.round(this.r),
  7772. g: Math.round(this.g),
  7773. b: Math.round(this.b),
  7774. a: this.a
  7775. };
  7776. };
  7777. TinyColor2.prototype.toRgbString = function() {
  7778. var r = Math.round(this.r);
  7779. var g = Math.round(this.g);
  7780. var b2 = Math.round(this.b);
  7781. return this.a === 1 ? "rgb(".concat(r, ", ").concat(g, ", ").concat(b2, ")") : "rgba(".concat(r, ", ").concat(g, ", ").concat(b2, ", ").concat(this.roundA, ")");
  7782. };
  7783. TinyColor2.prototype.toPercentageRgb = function() {
  7784. var fmt = function(x2) {
  7785. return "".concat(Math.round(bound01(x2, 255) * 100), "%");
  7786. };
  7787. return {
  7788. r: fmt(this.r),
  7789. g: fmt(this.g),
  7790. b: fmt(this.b),
  7791. a: this.a
  7792. };
  7793. };
  7794. TinyColor2.prototype.toPercentageRgbString = function() {
  7795. var rnd = function(x2) {
  7796. return Math.round(bound01(x2, 255) * 100);
  7797. };
  7798. return this.a === 1 ? "rgb(".concat(rnd(this.r), "%, ").concat(rnd(this.g), "%, ").concat(rnd(this.b), "%)") : "rgba(".concat(rnd(this.r), "%, ").concat(rnd(this.g), "%, ").concat(rnd(this.b), "%, ").concat(this.roundA, ")");
  7799. };
  7800. TinyColor2.prototype.toName = function() {
  7801. if (this.a === 0) {
  7802. return "transparent";
  7803. }
  7804. if (this.a < 1) {
  7805. return false;
  7806. }
  7807. var hex2 = "#" + rgbToHex(this.r, this.g, this.b, false);
  7808. for (var _i = 0, _a2 = Object.entries(names); _i < _a2.length; _i++) {
  7809. var _b2 = _a2[_i], key = _b2[0], value = _b2[1];
  7810. if (hex2 === value) {
  7811. return key;
  7812. }
  7813. }
  7814. return false;
  7815. };
  7816. TinyColor2.prototype.toString = function(format2) {
  7817. var formatSet = Boolean(format2);
  7818. format2 = format2 !== null && format2 !== void 0 ? format2 : this.format;
  7819. var formattedString = false;
  7820. var hasAlpha = this.a < 1 && this.a >= 0;
  7821. var needsAlphaFormat = !formatSet && hasAlpha && (format2.startsWith("hex") || format2 === "name");
  7822. if (needsAlphaFormat) {
  7823. if (format2 === "name" && this.a === 0) {
  7824. return this.toName();
  7825. }
  7826. return this.toRgbString();
  7827. }
  7828. if (format2 === "rgb") {
  7829. formattedString = this.toRgbString();
  7830. }
  7831. if (format2 === "prgb") {
  7832. formattedString = this.toPercentageRgbString();
  7833. }
  7834. if (format2 === "hex" || format2 === "hex6") {
  7835. formattedString = this.toHexString();
  7836. }
  7837. if (format2 === "hex3") {
  7838. formattedString = this.toHexString(true);
  7839. }
  7840. if (format2 === "hex4") {
  7841. formattedString = this.toHex8String(true);
  7842. }
  7843. if (format2 === "hex8") {
  7844. formattedString = this.toHex8String();
  7845. }
  7846. if (format2 === "name") {
  7847. formattedString = this.toName();
  7848. }
  7849. if (format2 === "hsl") {
  7850. formattedString = this.toHslString();
  7851. }
  7852. if (format2 === "hsv") {
  7853. formattedString = this.toHsvString();
  7854. }
  7855. return formattedString || this.toHexString();
  7856. };
  7857. TinyColor2.prototype.toNumber = function() {
  7858. return (Math.round(this.r) << 16) + (Math.round(this.g) << 8) + Math.round(this.b);
  7859. };
  7860. TinyColor2.prototype.clone = function() {
  7861. return new TinyColor2(this.toString());
  7862. };
  7863. TinyColor2.prototype.lighten = function(amount) {
  7864. if (amount === void 0) {
  7865. amount = 10;
  7866. }
  7867. var hsl = this.toHsl();
  7868. hsl.l += amount / 100;
  7869. hsl.l = clamp01(hsl.l);
  7870. return new TinyColor2(hsl);
  7871. };
  7872. TinyColor2.prototype.brighten = function(amount) {
  7873. if (amount === void 0) {
  7874. amount = 10;
  7875. }
  7876. var rgb = this.toRgb();
  7877. rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100))));
  7878. rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100))));
  7879. rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100))));
  7880. return new TinyColor2(rgb);
  7881. };
  7882. TinyColor2.prototype.darken = function(amount) {
  7883. if (amount === void 0) {
  7884. amount = 10;
  7885. }
  7886. var hsl = this.toHsl();
  7887. hsl.l -= amount / 100;
  7888. hsl.l = clamp01(hsl.l);
  7889. return new TinyColor2(hsl);
  7890. };
  7891. TinyColor2.prototype.tint = function(amount) {
  7892. if (amount === void 0) {
  7893. amount = 10;
  7894. }
  7895. return this.mix("white", amount);
  7896. };
  7897. TinyColor2.prototype.shade = function(amount) {
  7898. if (amount === void 0) {
  7899. amount = 10;
  7900. }
  7901. return this.mix("black", amount);
  7902. };
  7903. TinyColor2.prototype.desaturate = function(amount) {
  7904. if (amount === void 0) {
  7905. amount = 10;
  7906. }
  7907. var hsl = this.toHsl();
  7908. hsl.s -= amount / 100;
  7909. hsl.s = clamp01(hsl.s);
  7910. return new TinyColor2(hsl);
  7911. };
  7912. TinyColor2.prototype.saturate = function(amount) {
  7913. if (amount === void 0) {
  7914. amount = 10;
  7915. }
  7916. var hsl = this.toHsl();
  7917. hsl.s += amount / 100;
  7918. hsl.s = clamp01(hsl.s);
  7919. return new TinyColor2(hsl);
  7920. };
  7921. TinyColor2.prototype.greyscale = function() {
  7922. return this.desaturate(100);
  7923. };
  7924. TinyColor2.prototype.spin = function(amount) {
  7925. var hsl = this.toHsl();
  7926. var hue = (hsl.h + amount) % 360;
  7927. hsl.h = hue < 0 ? 360 + hue : hue;
  7928. return new TinyColor2(hsl);
  7929. };
  7930. TinyColor2.prototype.mix = function(color, amount) {
  7931. if (amount === void 0) {
  7932. amount = 50;
  7933. }
  7934. var rgb1 = this.toRgb();
  7935. var rgb2 = new TinyColor2(color).toRgb();
  7936. var p2 = amount / 100;
  7937. var rgba = {
  7938. r: (rgb2.r - rgb1.r) * p2 + rgb1.r,
  7939. g: (rgb2.g - rgb1.g) * p2 + rgb1.g,
  7940. b: (rgb2.b - rgb1.b) * p2 + rgb1.b,
  7941. a: (rgb2.a - rgb1.a) * p2 + rgb1.a
  7942. };
  7943. return new TinyColor2(rgba);
  7944. };
  7945. TinyColor2.prototype.analogous = function(results, slices) {
  7946. if (results === void 0) {
  7947. results = 6;
  7948. }
  7949. if (slices === void 0) {
  7950. slices = 30;
  7951. }
  7952. var hsl = this.toHsl();
  7953. var part = 360 / slices;
  7954. var ret = [this];
  7955. for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results; ) {
  7956. hsl.h = (hsl.h + part) % 360;
  7957. ret.push(new TinyColor2(hsl));
  7958. }
  7959. return ret;
  7960. };
  7961. TinyColor2.prototype.complement = function() {
  7962. var hsl = this.toHsl();
  7963. hsl.h = (hsl.h + 180) % 360;
  7964. return new TinyColor2(hsl);
  7965. };
  7966. TinyColor2.prototype.monochromatic = function(results) {
  7967. if (results === void 0) {
  7968. results = 6;
  7969. }
  7970. var hsv = this.toHsv();
  7971. var h2 = hsv.h;
  7972. var s2 = hsv.s;
  7973. var v2 = hsv.v;
  7974. var res = [];
  7975. var modification = 1 / results;
  7976. while (results--) {
  7977. res.push(new TinyColor2({ h: h2, s: s2, v: v2 }));
  7978. v2 = (v2 + modification) % 1;
  7979. }
  7980. return res;
  7981. };
  7982. TinyColor2.prototype.splitcomplement = function() {
  7983. var hsl = this.toHsl();
  7984. var h2 = hsl.h;
  7985. return [
  7986. this,
  7987. new TinyColor2({ h: (h2 + 72) % 360, s: hsl.s, l: hsl.l }),
  7988. new TinyColor2({ h: (h2 + 216) % 360, s: hsl.s, l: hsl.l })
  7989. ];
  7990. };
  7991. TinyColor2.prototype.onBackground = function(background) {
  7992. var fg = this.toRgb();
  7993. var bg = new TinyColor2(background).toRgb();
  7994. return new TinyColor2({
  7995. r: bg.r + (fg.r - bg.r) * fg.a,
  7996. g: bg.g + (fg.g - bg.g) * fg.a,
  7997. b: bg.b + (fg.b - bg.b) * fg.a
  7998. });
  7999. };
  8000. TinyColor2.prototype.triad = function() {
  8001. return this.polyad(3);
  8002. };
  8003. TinyColor2.prototype.tetrad = function() {
  8004. return this.polyad(4);
  8005. };
  8006. TinyColor2.prototype.polyad = function(n) {
  8007. var hsl = this.toHsl();
  8008. var h2 = hsl.h;
  8009. var result = [this];
  8010. var increment = 360 / n;
  8011. for (var i = 1; i < n; i++) {
  8012. result.push(new TinyColor2({ h: (h2 + i * increment) % 360, s: hsl.s, l: hsl.l }));
  8013. }
  8014. return result;
  8015. };
  8016. TinyColor2.prototype.equals = function(color) {
  8017. return this.toRgbString() === new TinyColor2(color).toRgbString();
  8018. };
  8019. return TinyColor2;
  8020. }();
  8021. function darken(color, amount = 20) {
  8022. return color.mix("#141414", amount).toString();
  8023. }
  8024. function useButtonCustomStyle(props) {
  8025. const _disabled = useDisabled$1();
  8026. return computed(() => {
  8027. let styles = {};
  8028. const buttonColor = props.color;
  8029. if (buttonColor) {
  8030. const color = new TinyColor(buttonColor);
  8031. const activeBgColor = props.dark ? color.tint(20).toString() : darken(color, 20);
  8032. if (props.plain) {
  8033. styles = {
  8034. "--el-button-bg-color": props.dark ? darken(color, 90) : color.tint(90).toString(),
  8035. "--el-button-text-color": buttonColor,
  8036. "--el-button-border-color": props.dark ? darken(color, 50) : color.tint(50).toString(),
  8037. "--el-button-hover-text-color": "var(--el-color-white)",
  8038. "--el-button-hover-bg-color": buttonColor,
  8039. "--el-button-hover-border-color": buttonColor,
  8040. "--el-button-active-bg-color": activeBgColor,
  8041. "--el-button-active-text-color": "var(--el-color-white)",
  8042. "--el-button-active-border-color": activeBgColor
  8043. };
  8044. if (_disabled.value) {
  8045. styles["--el-button-disabled-bg-color"] = props.dark ? darken(color, 90) : color.tint(90).toString();
  8046. styles["--el-button-disabled-text-color"] = props.dark ? darken(color, 50) : color.tint(50).toString();
  8047. styles["--el-button-disabled-border-color"] = props.dark ? darken(color, 80) : color.tint(80).toString();
  8048. }
  8049. } else {
  8050. const hoverBgColor = props.dark ? darken(color, 30) : color.tint(30).toString();
  8051. const textColor = color.isDark() ? "var(--el-color-white)" : "var(--el-color-black)";
  8052. styles = {
  8053. "--el-button-bg-color": buttonColor,
  8054. "--el-button-text-color": textColor,
  8055. "--el-button-border-color": buttonColor,
  8056. "--el-button-hover-bg-color": hoverBgColor,
  8057. "--el-button-hover-text-color": textColor,
  8058. "--el-button-hover-border-color": hoverBgColor,
  8059. "--el-button-active-bg-color": activeBgColor,
  8060. "--el-button-active-border-color": activeBgColor
  8061. };
  8062. if (_disabled.value) {
  8063. const disabledButtonColor = props.dark ? darken(color, 50) : color.tint(50).toString();
  8064. styles["--el-button-disabled-bg-color"] = disabledButtonColor;
  8065. styles["--el-button-disabled-text-color"] = props.dark ? "rgba(255, 255, 255, 0.5)" : "var(--el-color-white)";
  8066. styles["--el-button-disabled-border-color"] = disabledButtonColor;
  8067. }
  8068. }
  8069. }
  8070. return styles;
  8071. });
  8072. }
  8073. const _hoisted_1$B = ["disabled", "autofocus", "type"];
  8074. const __default__$f = {
  8075. name: "ElButton"
  8076. };
  8077. const _sfc_main$V = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$f), {
  8078. props: buttonProps,
  8079. emits: buttonEmits,
  8080. setup(__props, { expose, emit }) {
  8081. const props = __props;
  8082. const slots = useSlots();
  8083. const buttonGroupContext = inject(buttonGroupContextKey, void 0);
  8084. const globalConfig2 = useGlobalConfig("button");
  8085. const ns = useNamespace("button");
  8086. const { form } = useFormItem();
  8087. const _size = useSize(computed(() => buttonGroupContext == null ? void 0 : buttonGroupContext.size));
  8088. const _disabled = useDisabled$1();
  8089. const _ref = ref();
  8090. const _type = computed(() => props.type || (buttonGroupContext == null ? void 0 : buttonGroupContext.type) || "");
  8091. const autoInsertSpace = computed(() => {
  8092. var _a2, _b2, _c;
  8093. return (_c = (_b2 = props.autoInsertSpace) != null ? _b2 : (_a2 = globalConfig2.value) == null ? void 0 : _a2.autoInsertSpace) != null ? _c : false;
  8094. });
  8095. const shouldAddSpace = computed(() => {
  8096. var _a2;
  8097. const defaultSlot = (_a2 = slots.default) == null ? void 0 : _a2.call(slots);
  8098. if (autoInsertSpace.value && (defaultSlot == null ? void 0 : defaultSlot.length) === 1) {
  8099. const slot = defaultSlot[0];
  8100. if ((slot == null ? void 0 : slot.type) === Text) {
  8101. const text = slot.children;
  8102. return /^\p{Unified_Ideograph}{2}$/u.test(text.trim());
  8103. }
  8104. }
  8105. return false;
  8106. });
  8107. const buttonStyle = useButtonCustomStyle(props);
  8108. const handleClick = (evt) => {
  8109. if (props.nativeType === "reset") {
  8110. form == null ? void 0 : form.resetFields();
  8111. }
  8112. emit("click", evt);
  8113. };
  8114. expose({
  8115. ref: _ref,
  8116. size: _size,
  8117. type: _type,
  8118. disabled: _disabled,
  8119. shouldAddSpace
  8120. });
  8121. return (_ctx, _cache) => {
  8122. return openBlock(), createElementBlock("button", {
  8123. ref_key: "_ref",
  8124. ref: _ref,
  8125. class: normalizeClass([
  8126. unref(ns).b(),
  8127. unref(ns).m(unref(_type)),
  8128. unref(ns).m(unref(_size)),
  8129. unref(ns).is("disabled", unref(_disabled)),
  8130. unref(ns).is("loading", _ctx.loading),
  8131. unref(ns).is("plain", _ctx.plain),
  8132. unref(ns).is("round", _ctx.round),
  8133. unref(ns).is("circle", _ctx.circle)
  8134. ]),
  8135. disabled: unref(_disabled) || _ctx.loading,
  8136. autofocus: _ctx.autofocus,
  8137. type: _ctx.nativeType,
  8138. style: normalizeStyle(unref(buttonStyle)),
  8139. onClick: handleClick
  8140. }, [
  8141. _ctx.loading ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  8142. _ctx.$slots.loading ? renderSlot(_ctx.$slots, "loading", { key: 0 }) : (openBlock(), createBlock(unref(ElIcon), {
  8143. key: 1,
  8144. class: normalizeClass(unref(ns).is("loading"))
  8145. }, {
  8146. default: withCtx(() => [
  8147. (openBlock(), createBlock(resolveDynamicComponent(_ctx.loadingIcon)))
  8148. ]),
  8149. _: 1
  8150. }, 8, ["class"]))
  8151. ], 2112)) : _ctx.icon || _ctx.$slots.icon ? (openBlock(), createBlock(unref(ElIcon), { key: 1 }, {
  8152. default: withCtx(() => [
  8153. _ctx.icon ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon), { key: 0 })) : renderSlot(_ctx.$slots, "icon", { key: 1 })
  8154. ]),
  8155. _: 3
  8156. })) : createCommentVNode("v-if", true),
  8157. _ctx.$slots.default ? (openBlock(), createElementBlock("span", {
  8158. key: 2,
  8159. class: normalizeClass({ [unref(ns).em("text", "expand")]: unref(shouldAddSpace) })
  8160. }, [
  8161. renderSlot(_ctx.$slots, "default")
  8162. ], 2)) : createCommentVNode("v-if", true)
  8163. ], 14, _hoisted_1$B);
  8164. };
  8165. }
  8166. }));
  8167. var Button = /* @__PURE__ */ _export_sfc$1(_sfc_main$V, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/button/src/button.vue"]]);
  8168. const buttonGroupProps = {
  8169. size: buttonProps.size,
  8170. type: buttonProps.type
  8171. };
  8172. const __default__$e = {
  8173. name: "ElButtonGroup"
  8174. };
  8175. const _sfc_main$U = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$e), {
  8176. props: buttonGroupProps,
  8177. setup(__props) {
  8178. const props = __props;
  8179. provide(buttonGroupContextKey, reactive({
  8180. size: toRef(props, "size"),
  8181. type: toRef(props, "type")
  8182. }));
  8183. const ns = useNamespace("button");
  8184. return (_ctx, _cache) => {
  8185. return openBlock(), createElementBlock("div", {
  8186. class: normalizeClass(`${unref(ns).b("group")}`)
  8187. }, [
  8188. renderSlot(_ctx.$slots, "default")
  8189. ], 2);
  8190. };
  8191. }
  8192. }));
  8193. var ButtonGroup = /* @__PURE__ */ _export_sfc$1(_sfc_main$U, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/button/src/button-group.vue"]]);
  8194. const ElButton = withInstall(Button, {
  8195. ButtonGroup
  8196. });
  8197. withNoopInstall(ButtonGroup);
  8198. var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
  8199. var dayjs_min = { exports: {} };
  8200. (function(module2, exports2) {
  8201. !function(t, e) {
  8202. module2.exports = e();
  8203. }(commonjsGlobal, function() {
  8204. var t = 1e3, e = 6e4, n = 36e5, r = "millisecond", i = "second", s2 = "minute", u2 = "hour", a2 = "day", o2 = "week", c2 = "month", f2 = "quarter", h2 = "year", d2 = "date", l2 = "Invalid Date", $ = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, M2 = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(t2) {
  8205. var e2 = ["th", "st", "nd", "rd"], n2 = t2 % 100;
  8206. return "[" + t2 + (e2[(n2 - 20) % 10] || e2[n2] || e2[0]) + "]";
  8207. } }, m2 = function(t2, e2, n2) {
  8208. var r2 = String(t2);
  8209. return !r2 || r2.length >= e2 ? t2 : "" + Array(e2 + 1 - r2.length).join(n2) + t2;
  8210. }, v2 = { s: m2, z: function(t2) {
  8211. var e2 = -t2.utcOffset(), n2 = Math.abs(e2), r2 = Math.floor(n2 / 60), i2 = n2 % 60;
  8212. return (e2 <= 0 ? "+" : "-") + m2(r2, 2, "0") + ":" + m2(i2, 2, "0");
  8213. }, m: function t2(e2, n2) {
  8214. if (e2.date() < n2.date())
  8215. return -t2(n2, e2);
  8216. var r2 = 12 * (n2.year() - e2.year()) + (n2.month() - e2.month()), i2 = e2.clone().add(r2, c2), s3 = n2 - i2 < 0, u3 = e2.clone().add(r2 + (s3 ? -1 : 1), c2);
  8217. return +(-(r2 + (n2 - i2) / (s3 ? i2 - u3 : u3 - i2)) || 0);
  8218. }, a: function(t2) {
  8219. return t2 < 0 ? Math.ceil(t2) || 0 : Math.floor(t2);
  8220. }, p: function(t2) {
  8221. return { M: c2, y: h2, w: o2, d: a2, D: d2, h: u2, m: s2, s: i, ms: r, Q: f2 }[t2] || String(t2 || "").toLowerCase().replace(/s$/, "");
  8222. }, u: function(t2) {
  8223. return t2 === void 0;
  8224. } }, g = "en", D2 = {};
  8225. D2[g] = M2;
  8226. var p2 = "$isDayjsObject", S2 = function(t2) {
  8227. return t2 instanceof _2 || !(!t2 || !t2[p2]);
  8228. }, w2 = function t2(e2, n2, r2) {
  8229. var i2;
  8230. if (!e2)
  8231. return g;
  8232. if (typeof e2 == "string") {
  8233. var s3 = e2.toLowerCase();
  8234. D2[s3] && (i2 = s3), n2 && (D2[s3] = n2, i2 = s3);
  8235. var u3 = e2.split("-");
  8236. if (!i2 && u3.length > 1)
  8237. return t2(u3[0]);
  8238. } else {
  8239. var a3 = e2.name;
  8240. D2[a3] = e2, i2 = a3;
  8241. }
  8242. return !r2 && i2 && (g = i2), i2 || !r2 && g;
  8243. }, O2 = function(t2, e2) {
  8244. if (S2(t2))
  8245. return t2.clone();
  8246. var n2 = typeof e2 == "object" ? e2 : {};
  8247. return n2.date = t2, n2.args = arguments, new _2(n2);
  8248. }, b2 = v2;
  8249. b2.l = w2, b2.i = S2, b2.w = function(t2, e2) {
  8250. return O2(t2, { locale: e2.$L, utc: e2.$u, x: e2.$x, $offset: e2.$offset });
  8251. };
  8252. var _2 = function() {
  8253. function M3(t2) {
  8254. this.$L = w2(t2.locale, null, true), this.parse(t2), this.$x = this.$x || t2.x || {}, this[p2] = true;
  8255. }
  8256. var m3 = M3.prototype;
  8257. return m3.parse = function(t2) {
  8258. this.$d = function(t3) {
  8259. var e2 = t3.date, n2 = t3.utc;
  8260. if (e2 === null)
  8261. return new Date(NaN);
  8262. if (b2.u(e2))
  8263. return new Date();
  8264. if (e2 instanceof Date)
  8265. return new Date(e2);
  8266. if (typeof e2 == "string" && !/Z$/i.test(e2)) {
  8267. var r2 = e2.match($);
  8268. if (r2) {
  8269. var i2 = r2[2] - 1 || 0, s3 = (r2[7] || "0").substring(0, 3);
  8270. return n2 ? new Date(Date.UTC(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s3)) : new Date(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s3);
  8271. }
  8272. }
  8273. return new Date(e2);
  8274. }(t2), this.init();
  8275. }, m3.init = function() {
  8276. var t2 = this.$d;
  8277. this.$y = t2.getFullYear(), this.$M = t2.getMonth(), this.$D = t2.getDate(), this.$W = t2.getDay(), this.$H = t2.getHours(), this.$m = t2.getMinutes(), this.$s = t2.getSeconds(), this.$ms = t2.getMilliseconds();
  8278. }, m3.$utils = function() {
  8279. return b2;
  8280. }, m3.isValid = function() {
  8281. return !(this.$d.toString() === l2);
  8282. }, m3.isSame = function(t2, e2) {
  8283. var n2 = O2(t2);
  8284. return this.startOf(e2) <= n2 && n2 <= this.endOf(e2);
  8285. }, m3.isAfter = function(t2, e2) {
  8286. return O2(t2) < this.startOf(e2);
  8287. }, m3.isBefore = function(t2, e2) {
  8288. return this.endOf(e2) < O2(t2);
  8289. }, m3.$g = function(t2, e2, n2) {
  8290. return b2.u(t2) ? this[e2] : this.set(n2, t2);
  8291. }, m3.unix = function() {
  8292. return Math.floor(this.valueOf() / 1e3);
  8293. }, m3.valueOf = function() {
  8294. return this.$d.getTime();
  8295. }, m3.startOf = function(t2, e2) {
  8296. var n2 = this, r2 = !!b2.u(e2) || e2, f3 = b2.p(t2), l3 = function(t3, e3) {
  8297. var i2 = b2.w(n2.$u ? Date.UTC(n2.$y, e3, t3) : new Date(n2.$y, e3, t3), n2);
  8298. return r2 ? i2 : i2.endOf(a2);
  8299. }, $2 = function(t3, e3) {
  8300. return b2.w(n2.toDate()[t3].apply(n2.toDate("s"), (r2 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e3)), n2);
  8301. }, y2 = this.$W, M4 = this.$M, m4 = this.$D, v3 = "set" + (this.$u ? "UTC" : "");
  8302. switch (f3) {
  8303. case h2:
  8304. return r2 ? l3(1, 0) : l3(31, 11);
  8305. case c2:
  8306. return r2 ? l3(1, M4) : l3(0, M4 + 1);
  8307. case o2:
  8308. var g2 = this.$locale().weekStart || 0, D3 = (y2 < g2 ? y2 + 7 : y2) - g2;
  8309. return l3(r2 ? m4 - D3 : m4 + (6 - D3), M4);
  8310. case a2:
  8311. case d2:
  8312. return $2(v3 + "Hours", 0);
  8313. case u2:
  8314. return $2(v3 + "Minutes", 1);
  8315. case s2:
  8316. return $2(v3 + "Seconds", 2);
  8317. case i:
  8318. return $2(v3 + "Milliseconds", 3);
  8319. default:
  8320. return this.clone();
  8321. }
  8322. }, m3.endOf = function(t2) {
  8323. return this.startOf(t2, false);
  8324. }, m3.$set = function(t2, e2) {
  8325. var n2, o3 = b2.p(t2), f3 = "set" + (this.$u ? "UTC" : ""), l3 = (n2 = {}, n2[a2] = f3 + "Date", n2[d2] = f3 + "Date", n2[c2] = f3 + "Month", n2[h2] = f3 + "FullYear", n2[u2] = f3 + "Hours", n2[s2] = f3 + "Minutes", n2[i] = f3 + "Seconds", n2[r] = f3 + "Milliseconds", n2)[o3], $2 = o3 === a2 ? this.$D + (e2 - this.$W) : e2;
  8326. if (o3 === c2 || o3 === h2) {
  8327. var y2 = this.clone().set(d2, 1);
  8328. y2.$d[l3]($2), y2.init(), this.$d = y2.set(d2, Math.min(this.$D, y2.daysInMonth())).$d;
  8329. } else
  8330. l3 && this.$d[l3]($2);
  8331. return this.init(), this;
  8332. }, m3.set = function(t2, e2) {
  8333. return this.clone().$set(t2, e2);
  8334. }, m3.get = function(t2) {
  8335. return this[b2.p(t2)]();
  8336. }, m3.add = function(r2, f3) {
  8337. var d3, l3 = this;
  8338. r2 = Number(r2);
  8339. var $2 = b2.p(f3), y2 = function(t2) {
  8340. var e2 = O2(l3);
  8341. return b2.w(e2.date(e2.date() + Math.round(t2 * r2)), l3);
  8342. };
  8343. if ($2 === c2)
  8344. return this.set(c2, this.$M + r2);
  8345. if ($2 === h2)
  8346. return this.set(h2, this.$y + r2);
  8347. if ($2 === a2)
  8348. return y2(1);
  8349. if ($2 === o2)
  8350. return y2(7);
  8351. var M4 = (d3 = {}, d3[s2] = e, d3[u2] = n, d3[i] = t, d3)[$2] || 1, m4 = this.$d.getTime() + r2 * M4;
  8352. return b2.w(m4, this);
  8353. }, m3.subtract = function(t2, e2) {
  8354. return this.add(-1 * t2, e2);
  8355. }, m3.format = function(t2) {
  8356. var e2 = this, n2 = this.$locale();
  8357. if (!this.isValid())
  8358. return n2.invalidDate || l2;
  8359. var r2 = t2 || "YYYY-MM-DDTHH:mm:ssZ", i2 = b2.z(this), s3 = this.$H, u3 = this.$m, a3 = this.$M, o3 = n2.weekdays, c3 = n2.months, f3 = n2.meridiem, h3 = function(t3, n3, i3, s4) {
  8360. return t3 && (t3[n3] || t3(e2, r2)) || i3[n3].slice(0, s4);
  8361. }, d3 = function(t3) {
  8362. return b2.s(s3 % 12 || 12, t3, "0");
  8363. }, $2 = f3 || function(t3, e3, n3) {
  8364. var r3 = t3 < 12 ? "AM" : "PM";
  8365. return n3 ? r3.toLowerCase() : r3;
  8366. };
  8367. return r2.replace(y, function(t3, r3) {
  8368. return r3 || function(t4) {
  8369. switch (t4) {
  8370. case "YY":
  8371. return String(e2.$y).slice(-2);
  8372. case "YYYY":
  8373. return b2.s(e2.$y, 4, "0");
  8374. case "M":
  8375. return a3 + 1;
  8376. case "MM":
  8377. return b2.s(a3 + 1, 2, "0");
  8378. case "MMM":
  8379. return h3(n2.monthsShort, a3, c3, 3);
  8380. case "MMMM":
  8381. return h3(c3, a3);
  8382. case "D":
  8383. return e2.$D;
  8384. case "DD":
  8385. return b2.s(e2.$D, 2, "0");
  8386. case "d":
  8387. return String(e2.$W);
  8388. case "dd":
  8389. return h3(n2.weekdaysMin, e2.$W, o3, 2);
  8390. case "ddd":
  8391. return h3(n2.weekdaysShort, e2.$W, o3, 3);
  8392. case "dddd":
  8393. return o3[e2.$W];
  8394. case "H":
  8395. return String(s3);
  8396. case "HH":
  8397. return b2.s(s3, 2, "0");
  8398. case "h":
  8399. return d3(1);
  8400. case "hh":
  8401. return d3(2);
  8402. case "a":
  8403. return $2(s3, u3, true);
  8404. case "A":
  8405. return $2(s3, u3, false);
  8406. case "m":
  8407. return String(u3);
  8408. case "mm":
  8409. return b2.s(u3, 2, "0");
  8410. case "s":
  8411. return String(e2.$s);
  8412. case "ss":
  8413. return b2.s(e2.$s, 2, "0");
  8414. case "SSS":
  8415. return b2.s(e2.$ms, 3, "0");
  8416. case "Z":
  8417. return i2;
  8418. }
  8419. return null;
  8420. }(t3) || i2.replace(":", "");
  8421. });
  8422. }, m3.utcOffset = function() {
  8423. return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
  8424. }, m3.diff = function(r2, d3, l3) {
  8425. var $2, y2 = this, M4 = b2.p(d3), m4 = O2(r2), v3 = (m4.utcOffset() - this.utcOffset()) * e, g2 = this - m4, D3 = function() {
  8426. return b2.m(y2, m4);
  8427. };
  8428. switch (M4) {
  8429. case h2:
  8430. $2 = D3() / 12;
  8431. break;
  8432. case c2:
  8433. $2 = D3();
  8434. break;
  8435. case f2:
  8436. $2 = D3() / 3;
  8437. break;
  8438. case o2:
  8439. $2 = (g2 - v3) / 6048e5;
  8440. break;
  8441. case a2:
  8442. $2 = (g2 - v3) / 864e5;
  8443. break;
  8444. case u2:
  8445. $2 = g2 / n;
  8446. break;
  8447. case s2:
  8448. $2 = g2 / e;
  8449. break;
  8450. case i:
  8451. $2 = g2 / t;
  8452. break;
  8453. default:
  8454. $2 = g2;
  8455. }
  8456. return l3 ? $2 : b2.a($2);
  8457. }, m3.daysInMonth = function() {
  8458. return this.endOf(c2).$D;
  8459. }, m3.$locale = function() {
  8460. return D2[this.$L];
  8461. }, m3.locale = function(t2, e2) {
  8462. if (!t2)
  8463. return this.$L;
  8464. var n2 = this.clone(), r2 = w2(t2, e2, true);
  8465. return r2 && (n2.$L = r2), n2;
  8466. }, m3.clone = function() {
  8467. return b2.w(this.$d, this);
  8468. }, m3.toDate = function() {
  8469. return new Date(this.valueOf());
  8470. }, m3.toJSON = function() {
  8471. return this.isValid() ? this.toISOString() : null;
  8472. }, m3.toISOString = function() {
  8473. return this.$d.toISOString();
  8474. }, m3.toString = function() {
  8475. return this.$d.toUTCString();
  8476. }, M3;
  8477. }(), k = _2.prototype;
  8478. return O2.prototype = k, [["$ms", r], ["$s", i], ["$m", s2], ["$H", u2], ["$W", a2], ["$M", c2], ["$y", h2], ["$D", d2]].forEach(function(t2) {
  8479. k[t2[1]] = function(e2) {
  8480. return this.$g(e2, t2[0], t2[1]);
  8481. };
  8482. }), O2.extend = function(t2, e2) {
  8483. return t2.$i || (t2(e2, _2, O2), t2.$i = true), O2;
  8484. }, O2.locale = w2, O2.isDayjs = S2, O2.unix = function(t2) {
  8485. return O2(1e3 * t2);
  8486. }, O2.en = D2[g], O2.Ls = D2, O2.p = {}, O2;
  8487. });
  8488. })(dayjs_min);
  8489. var dayjs = dayjs_min.exports;
  8490. var localeData$1 = { exports: {} };
  8491. (function(module2, exports2) {
  8492. !function(n, e) {
  8493. module2.exports = e();
  8494. }(commonjsGlobal, function() {
  8495. return function(n, e, t) {
  8496. var r = e.prototype, o2 = function(n2) {
  8497. return n2 && (n2.indexOf ? n2 : n2.s);
  8498. }, u2 = function(n2, e2, t2, r2, u3) {
  8499. var i2 = n2.name ? n2 : n2.$locale(), a3 = o2(i2[e2]), s3 = o2(i2[t2]), f2 = a3 || s3.map(function(n3) {
  8500. return n3.slice(0, r2);
  8501. });
  8502. if (!u3)
  8503. return f2;
  8504. var d2 = i2.weekStart;
  8505. return f2.map(function(n3, e3) {
  8506. return f2[(e3 + (d2 || 0)) % 7];
  8507. });
  8508. }, i = function() {
  8509. return t.Ls[t.locale()];
  8510. }, a2 = function(n2, e2) {
  8511. return n2.formats[e2] || function(n3) {
  8512. return n3.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(n4, e3, t2) {
  8513. return e3 || t2.slice(1);
  8514. });
  8515. }(n2.formats[e2.toUpperCase()]);
  8516. }, s2 = function() {
  8517. var n2 = this;
  8518. return { months: function(e2) {
  8519. return e2 ? e2.format("MMMM") : u2(n2, "months");
  8520. }, monthsShort: function(e2) {
  8521. return e2 ? e2.format("MMM") : u2(n2, "monthsShort", "months", 3);
  8522. }, firstDayOfWeek: function() {
  8523. return n2.$locale().weekStart || 0;
  8524. }, weekdays: function(e2) {
  8525. return e2 ? e2.format("dddd") : u2(n2, "weekdays");
  8526. }, weekdaysMin: function(e2) {
  8527. return e2 ? e2.format("dd") : u2(n2, "weekdaysMin", "weekdays", 2);
  8528. }, weekdaysShort: function(e2) {
  8529. return e2 ? e2.format("ddd") : u2(n2, "weekdaysShort", "weekdays", 3);
  8530. }, longDateFormat: function(e2) {
  8531. return a2(n2.$locale(), e2);
  8532. }, meridiem: this.$locale().meridiem, ordinal: this.$locale().ordinal };
  8533. };
  8534. r.localeData = function() {
  8535. return s2.bind(this)();
  8536. }, t.localeData = function() {
  8537. var n2 = i();
  8538. return { firstDayOfWeek: function() {
  8539. return n2.weekStart || 0;
  8540. }, weekdays: function() {
  8541. return t.weekdays();
  8542. }, weekdaysShort: function() {
  8543. return t.weekdaysShort();
  8544. }, weekdaysMin: function() {
  8545. return t.weekdaysMin();
  8546. }, months: function() {
  8547. return t.months();
  8548. }, monthsShort: function() {
  8549. return t.monthsShort();
  8550. }, longDateFormat: function(e2) {
  8551. return a2(n2, e2);
  8552. }, meridiem: n2.meridiem, ordinal: n2.ordinal };
  8553. }, t.months = function() {
  8554. return u2(i(), "months");
  8555. }, t.monthsShort = function() {
  8556. return u2(i(), "monthsShort", "months", 3);
  8557. }, t.weekdays = function(n2) {
  8558. return u2(i(), "weekdays", null, null, n2);
  8559. }, t.weekdaysShort = function(n2) {
  8560. return u2(i(), "weekdaysShort", "weekdays", 3, n2);
  8561. }, t.weekdaysMin = function(n2) {
  8562. return u2(i(), "weekdaysMin", "weekdays", 2, n2);
  8563. };
  8564. };
  8565. });
  8566. })(localeData$1);
  8567. var localeData = localeData$1.exports;
  8568. var customParseFormat$1 = { exports: {} };
  8569. (function(module2, exports2) {
  8570. !function(e, t) {
  8571. module2.exports = t();
  8572. }(commonjsGlobal, function() {
  8573. var e = { LTS: "h:mm:ss A", LT: "h:mm A", L: "MM/DD/YYYY", LL: "MMMM D, YYYY", LLL: "MMMM D, YYYY h:mm A", LLLL: "dddd, MMMM D, YYYY h:mm A" }, t = /(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g, n = /\d/, r = /\d\d/, i = /\d\d?/, o2 = /\d*[^-_:/,()\s\d]+/, s2 = {}, a2 = function(e2) {
  8574. return (e2 = +e2) + (e2 > 68 ? 1900 : 2e3);
  8575. };
  8576. var f2 = function(e2) {
  8577. return function(t2) {
  8578. this[e2] = +t2;
  8579. };
  8580. }, h2 = [/[+-]\d\d:?(\d\d)?|Z/, function(e2) {
  8581. (this.zone || (this.zone = {})).offset = function(e3) {
  8582. if (!e3)
  8583. return 0;
  8584. if (e3 === "Z")
  8585. return 0;
  8586. var t2 = e3.match(/([+-]|\d\d)/g), n2 = 60 * t2[1] + (+t2[2] || 0);
  8587. return n2 === 0 ? 0 : t2[0] === "+" ? -n2 : n2;
  8588. }(e2);
  8589. }], u2 = function(e2) {
  8590. var t2 = s2[e2];
  8591. return t2 && (t2.indexOf ? t2 : t2.s.concat(t2.f));
  8592. }, d2 = function(e2, t2) {
  8593. var n2, r2 = s2.meridiem;
  8594. if (r2) {
  8595. for (var i2 = 1; i2 <= 24; i2 += 1)
  8596. if (e2.indexOf(r2(i2, 0, t2)) > -1) {
  8597. n2 = i2 > 12;
  8598. break;
  8599. }
  8600. } else
  8601. n2 = e2 === (t2 ? "pm" : "PM");
  8602. return n2;
  8603. }, c2 = { A: [o2, function(e2) {
  8604. this.afternoon = d2(e2, false);
  8605. }], a: [o2, function(e2) {
  8606. this.afternoon = d2(e2, true);
  8607. }], Q: [n, function(e2) {
  8608. this.month = 3 * (e2 - 1) + 1;
  8609. }], S: [n, function(e2) {
  8610. this.milliseconds = 100 * +e2;
  8611. }], SS: [r, function(e2) {
  8612. this.milliseconds = 10 * +e2;
  8613. }], SSS: [/\d{3}/, function(e2) {
  8614. this.milliseconds = +e2;
  8615. }], s: [i, f2("seconds")], ss: [i, f2("seconds")], m: [i, f2("minutes")], mm: [i, f2("minutes")], H: [i, f2("hours")], h: [i, f2("hours")], HH: [i, f2("hours")], hh: [i, f2("hours")], D: [i, f2("day")], DD: [r, f2("day")], Do: [o2, function(e2) {
  8616. var t2 = s2.ordinal, n2 = e2.match(/\d+/);
  8617. if (this.day = n2[0], t2)
  8618. for (var r2 = 1; r2 <= 31; r2 += 1)
  8619. t2(r2).replace(/\[|\]/g, "") === e2 && (this.day = r2);
  8620. }], w: [i, f2("week")], ww: [r, f2("week")], M: [i, f2("month")], MM: [r, f2("month")], MMM: [o2, function(e2) {
  8621. var t2 = u2("months"), n2 = (u2("monthsShort") || t2.map(function(e3) {
  8622. return e3.slice(0, 3);
  8623. })).indexOf(e2) + 1;
  8624. if (n2 < 1)
  8625. throw new Error();
  8626. this.month = n2 % 12 || n2;
  8627. }], MMMM: [o2, function(e2) {
  8628. var t2 = u2("months").indexOf(e2) + 1;
  8629. if (t2 < 1)
  8630. throw new Error();
  8631. this.month = t2 % 12 || t2;
  8632. }], Y: [/[+-]?\d+/, f2("year")], YY: [r, function(e2) {
  8633. this.year = a2(e2);
  8634. }], YYYY: [/\d{4}/, f2("year")], Z: h2, ZZ: h2 };
  8635. function l2(n2) {
  8636. var r2, i2;
  8637. r2 = n2, i2 = s2 && s2.formats;
  8638. for (var o3 = (n2 = r2.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, function(t2, n3, r3) {
  8639. var o4 = r3 && r3.toUpperCase();
  8640. return n3 || i2[r3] || e[r3] || i2[o4].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(e2, t3, n4) {
  8641. return t3 || n4.slice(1);
  8642. });
  8643. })).match(t), a3 = o3.length, f3 = 0; f3 < a3; f3 += 1) {
  8644. var h3 = o3[f3], u3 = c2[h3], d3 = u3 && u3[0], l3 = u3 && u3[1];
  8645. o3[f3] = l3 ? { regex: d3, parser: l3 } : h3.replace(/^\[|\]$/g, "");
  8646. }
  8647. return function(e2) {
  8648. for (var t2 = {}, n3 = 0, r3 = 0; n3 < a3; n3 += 1) {
  8649. var i3 = o3[n3];
  8650. if (typeof i3 == "string")
  8651. r3 += i3.length;
  8652. else {
  8653. var s3 = i3.regex, f4 = i3.parser, h4 = e2.slice(r3), u4 = s3.exec(h4)[0];
  8654. f4.call(t2, u4), e2 = e2.replace(u4, "");
  8655. }
  8656. }
  8657. return function(e3) {
  8658. var t3 = e3.afternoon;
  8659. if (t3 !== void 0) {
  8660. var n4 = e3.hours;
  8661. t3 ? n4 < 12 && (e3.hours += 12) : n4 === 12 && (e3.hours = 0), delete e3.afternoon;
  8662. }
  8663. }(t2), t2;
  8664. };
  8665. }
  8666. return function(e2, t2, n2) {
  8667. n2.p.customParseFormat = true, e2 && e2.parseTwoDigitYear && (a2 = e2.parseTwoDigitYear);
  8668. var r2 = t2.prototype, i2 = r2.parse;
  8669. r2.parse = function(e3) {
  8670. var t3 = e3.date, r3 = e3.utc, o3 = e3.args;
  8671. this.$u = r3;
  8672. var a3 = o3[1];
  8673. if (typeof a3 == "string") {
  8674. var f3 = o3[2] === true, h3 = o3[3] === true, u3 = f3 || h3, d3 = o3[2];
  8675. h3 && (d3 = o3[2]), s2 = this.$locale(), !f3 && d3 && (s2 = n2.Ls[d3]), this.$d = function(e4, t4, n3, r4) {
  8676. try {
  8677. if (["x", "X"].indexOf(t4) > -1)
  8678. return new Date((t4 === "X" ? 1e3 : 1) * e4);
  8679. var i3 = l2(t4)(e4), o4 = i3.year, s3 = i3.month, a4 = i3.day, f4 = i3.hours, h4 = i3.minutes, u4 = i3.seconds, d4 = i3.milliseconds, c4 = i3.zone, m3 = i3.week, M3 = new Date(), Y2 = a4 || (o4 || s3 ? 1 : M3.getDate()), p2 = o4 || M3.getFullYear(), v2 = 0;
  8680. o4 && !s3 || (v2 = s3 > 0 ? s3 - 1 : M3.getMonth());
  8681. var D2, w2 = f4 || 0, g = h4 || 0, y = u4 || 0, L = d4 || 0;
  8682. return c4 ? new Date(Date.UTC(p2, v2, Y2, w2, g, y, L + 60 * c4.offset * 1e3)) : n3 ? new Date(Date.UTC(p2, v2, Y2, w2, g, y, L)) : (D2 = new Date(p2, v2, Y2, w2, g, y, L), m3 && (D2 = r4(D2).week(m3).toDate()), D2);
  8683. } catch (e5) {
  8684. return new Date("");
  8685. }
  8686. }(t3, a3, r3, n2), this.init(), d3 && d3 !== true && (this.$L = this.locale(d3).$L), u3 && t3 != this.format(a3) && (this.$d = new Date("")), s2 = {};
  8687. } else if (a3 instanceof Array)
  8688. for (var c3 = a3.length, m2 = 1; m2 <= c3; m2 += 1) {
  8689. o3[1] = a3[m2 - 1];
  8690. var M2 = n2.apply(this, o3);
  8691. if (M2.isValid()) {
  8692. this.$d = M2.$d, this.$L = M2.$L, this.init();
  8693. break;
  8694. }
  8695. m2 === c3 && (this.$d = new Date(""));
  8696. }
  8697. else
  8698. i2.call(this, e3);
  8699. };
  8700. };
  8701. });
  8702. })(customParseFormat$1);
  8703. var customParseFormat = customParseFormat$1.exports;
  8704. const DEFAULT_FORMATS_TIME = "HH:mm:ss";
  8705. const DEFAULT_FORMATS_DATE = "YYYY-MM-DD";
  8706. const DEFAULT_FORMATS_DATEPICKER = {
  8707. date: DEFAULT_FORMATS_DATE,
  8708. week: "gggg[w]ww",
  8709. year: "YYYY",
  8710. month: "YYYY-MM",
  8711. datetime: `${DEFAULT_FORMATS_DATE} ${DEFAULT_FORMATS_TIME}`,
  8712. monthrange: "YYYY-MM",
  8713. daterange: DEFAULT_FORMATS_DATE,
  8714. datetimerange: `${DEFAULT_FORMATS_DATE} ${DEFAULT_FORMATS_TIME}`
  8715. };
  8716. const timePickerDefaultProps = {
  8717. id: {
  8718. type: [Array, String]
  8719. },
  8720. name: {
  8721. type: [Array, String],
  8722. default: ""
  8723. },
  8724. popperClass: {
  8725. type: String,
  8726. default: ""
  8727. },
  8728. format: {
  8729. type: String
  8730. },
  8731. valueFormat: {
  8732. type: String
  8733. },
  8734. type: {
  8735. type: String,
  8736. default: ""
  8737. },
  8738. clearable: {
  8739. type: Boolean,
  8740. default: true
  8741. },
  8742. clearIcon: {
  8743. type: [String, Object],
  8744. default: circleClose
  8745. },
  8746. editable: {
  8747. type: Boolean,
  8748. default: true
  8749. },
  8750. prefixIcon: {
  8751. type: [String, Object],
  8752. default: ""
  8753. },
  8754. size: {
  8755. type: String,
  8756. validator: isValidComponentSize
  8757. },
  8758. readonly: {
  8759. type: Boolean,
  8760. default: false
  8761. },
  8762. disabled: {
  8763. type: Boolean,
  8764. default: false
  8765. },
  8766. placeholder: {
  8767. type: String,
  8768. default: ""
  8769. },
  8770. popperOptions: {
  8771. type: Object,
  8772. default: () => ({})
  8773. },
  8774. modelValue: {
  8775. type: [Date, Array, String, Number],
  8776. default: ""
  8777. },
  8778. rangeSeparator: {
  8779. type: String,
  8780. default: "-"
  8781. },
  8782. startPlaceholder: String,
  8783. endPlaceholder: String,
  8784. defaultValue: {
  8785. type: [Date, Array]
  8786. },
  8787. defaultTime: {
  8788. type: [Date, Array]
  8789. },
  8790. isRange: {
  8791. type: Boolean,
  8792. default: false
  8793. },
  8794. disabledHours: {
  8795. type: Function
  8796. },
  8797. disabledMinutes: {
  8798. type: Function
  8799. },
  8800. disabledSeconds: {
  8801. type: Function
  8802. },
  8803. disabledDate: {
  8804. type: Function
  8805. },
  8806. cellClassName: {
  8807. type: Function
  8808. },
  8809. shortcuts: {
  8810. type: Array,
  8811. default: () => []
  8812. },
  8813. arrowControl: {
  8814. type: Boolean,
  8815. default: false
  8816. },
  8817. validateEvent: {
  8818. type: Boolean,
  8819. default: true
  8820. },
  8821. unlinkPanels: Boolean
  8822. };
  8823. const dateEquals = function(a2, b2) {
  8824. const aIsDate = a2 instanceof Date;
  8825. const bIsDate = b2 instanceof Date;
  8826. if (aIsDate && bIsDate) {
  8827. return a2.getTime() === b2.getTime();
  8828. }
  8829. if (!aIsDate && !bIsDate) {
  8830. return a2 === b2;
  8831. }
  8832. return false;
  8833. };
  8834. const valueEquals = function(a2, b2) {
  8835. const aIsArray = Array.isArray(a2);
  8836. const bIsArray = Array.isArray(b2);
  8837. if (aIsArray && bIsArray) {
  8838. if (a2.length !== b2.length) {
  8839. return false;
  8840. }
  8841. return a2.every((item, index) => dateEquals(item, b2[index]));
  8842. }
  8843. if (!aIsArray && !bIsArray) {
  8844. return dateEquals(a2, b2);
  8845. }
  8846. return false;
  8847. };
  8848. const parser = function(date4, format2, lang) {
  8849. const day = isEmpty(format2) || format2 === "x" ? dayjs(date4).locale(lang) : dayjs(date4, format2).locale(lang);
  8850. return day.isValid() ? day : void 0;
  8851. };
  8852. const formatter = function(date4, format2, lang) {
  8853. if (isEmpty(format2))
  8854. return date4;
  8855. if (format2 === "x")
  8856. return +date4;
  8857. return dayjs(date4).locale(lang).format(format2);
  8858. };
  8859. const _sfc_main$T = defineComponent({
  8860. name: "Picker",
  8861. components: {
  8862. ElInput,
  8863. ElTooltip,
  8864. ElIcon
  8865. },
  8866. props: timePickerDefaultProps,
  8867. emits: [
  8868. "update:modelValue",
  8869. "change",
  8870. "focus",
  8871. "blur",
  8872. "calendar-change",
  8873. "panel-change",
  8874. "visible-change"
  8875. ],
  8876. setup(props, ctx) {
  8877. const { lang } = useLocale();
  8878. const nsDate = useNamespace("date");
  8879. const nsInput = useNamespace("input");
  8880. const nsRange = useNamespace("range");
  8881. const elForm2 = inject(formContextKey, {});
  8882. const elFormItem2 = inject(formItemContextKey, {});
  8883. const elPopperOptions = inject("ElPopperOptions", {});
  8884. const refPopper = ref();
  8885. const inputRef = ref();
  8886. const pickerVisible = ref(false);
  8887. const pickerActualVisible = ref(false);
  8888. const valueOnOpen = ref(null);
  8889. watch(pickerVisible, (val) => {
  8890. var _a2;
  8891. if (!val) {
  8892. userInput.value = null;
  8893. nextTick(() => {
  8894. emitChange(props.modelValue);
  8895. });
  8896. ctx.emit("blur");
  8897. blurInput();
  8898. props.validateEvent && ((_a2 = elFormItem2.validate) == null ? void 0 : _a2.call(elFormItem2, "blur").catch((err) => debugWarn()));
  8899. } else {
  8900. valueOnOpen.value = props.modelValue;
  8901. }
  8902. });
  8903. const emitChange = (val, isClear) => {
  8904. var _a2;
  8905. if (isClear || !valueEquals(val, valueOnOpen.value)) {
  8906. ctx.emit("change", val);
  8907. props.validateEvent && ((_a2 = elFormItem2.validate) == null ? void 0 : _a2.call(elFormItem2, "change").catch((err) => debugWarn()));
  8908. }
  8909. };
  8910. const emitInput = (val) => {
  8911. if (!valueEquals(props.modelValue, val)) {
  8912. let formatValue;
  8913. if (Array.isArray(val)) {
  8914. formatValue = val.map((_2) => formatter(_2, props.valueFormat, lang.value));
  8915. } else if (val) {
  8916. formatValue = formatter(val, props.valueFormat, lang.value);
  8917. }
  8918. ctx.emit("update:modelValue", val ? formatValue : val, lang.value);
  8919. }
  8920. };
  8921. const refInput = computed(() => {
  8922. if (inputRef.value) {
  8923. const _r = isRangeInput.value ? inputRef.value : inputRef.value.$el;
  8924. return Array.from(_r.querySelectorAll("input"));
  8925. }
  8926. return [];
  8927. });
  8928. const refStartInput = computed(() => {
  8929. return refInput == null ? void 0 : refInput.value[0];
  8930. });
  8931. const refEndInput = computed(() => {
  8932. return refInput == null ? void 0 : refInput.value[1];
  8933. });
  8934. const setSelectionRange = (start2, end2, pos) => {
  8935. const _inputs = refInput.value;
  8936. if (!_inputs.length)
  8937. return;
  8938. if (!pos || pos === "min") {
  8939. _inputs[0].setSelectionRange(start2, end2);
  8940. _inputs[0].focus();
  8941. } else if (pos === "max") {
  8942. _inputs[1].setSelectionRange(start2, end2);
  8943. _inputs[1].focus();
  8944. }
  8945. };
  8946. const onPick = (date4 = "", visible = false) => {
  8947. pickerVisible.value = visible;
  8948. let result;
  8949. if (Array.isArray(date4)) {
  8950. result = date4.map((_2) => _2.toDate());
  8951. } else {
  8952. result = date4 ? date4.toDate() : date4;
  8953. }
  8954. userInput.value = null;
  8955. emitInput(result);
  8956. };
  8957. const onBeforeShow = () => {
  8958. pickerActualVisible.value = true;
  8959. };
  8960. const onShow = () => {
  8961. ctx.emit("visible-change", true);
  8962. };
  8963. const onHide = () => {
  8964. pickerActualVisible.value = false;
  8965. ctx.emit("visible-change", false);
  8966. };
  8967. const focus = (focusStartInput = true) => {
  8968. let input = refStartInput.value;
  8969. if (!focusStartInput && isRangeInput.value) {
  8970. input = refEndInput.value;
  8971. }
  8972. if (input) {
  8973. input.focus();
  8974. }
  8975. };
  8976. const handleFocus = (e) => {
  8977. if (props.readonly || pickerDisabled.value || pickerVisible.value)
  8978. return;
  8979. pickerVisible.value = true;
  8980. ctx.emit("focus", e);
  8981. };
  8982. const handleBlur = () => {
  8983. var _a2;
  8984. (_a2 = refPopper.value) == null ? void 0 : _a2.onClose();
  8985. blurInput();
  8986. };
  8987. const pickerDisabled = computed(() => {
  8988. return props.disabled || elForm2.disabled;
  8989. });
  8990. const parsedValue = computed(() => {
  8991. let result;
  8992. if (valueIsEmpty.value) {
  8993. if (pickerOptions.value.getDefaultValue) {
  8994. result = pickerOptions.value.getDefaultValue();
  8995. }
  8996. } else {
  8997. if (Array.isArray(props.modelValue)) {
  8998. result = props.modelValue.map((_2) => parser(_2, props.valueFormat, lang.value));
  8999. } else {
  9000. result = parser(props.modelValue, props.valueFormat, lang.value);
  9001. }
  9002. }
  9003. if (pickerOptions.value.getRangeAvailableTime) {
  9004. const availableResult = pickerOptions.value.getRangeAvailableTime(result);
  9005. if (!isEqual(availableResult, result)) {
  9006. result = availableResult;
  9007. emitInput(Array.isArray(result) ? result.map((_2) => _2.toDate()) : result.toDate());
  9008. }
  9009. }
  9010. if (Array.isArray(result) && result.some((_2) => !_2)) {
  9011. result = [];
  9012. }
  9013. return result;
  9014. });
  9015. const displayValue = computed(() => {
  9016. if (!pickerOptions.value.panelReady)
  9017. return;
  9018. const formattedValue = formatDayjsToString(parsedValue.value);
  9019. if (Array.isArray(userInput.value)) {
  9020. return [
  9021. userInput.value[0] || formattedValue && formattedValue[0] || "",
  9022. userInput.value[1] || formattedValue && formattedValue[1] || ""
  9023. ];
  9024. } else if (userInput.value !== null) {
  9025. return userInput.value;
  9026. }
  9027. if (!isTimePicker.value && valueIsEmpty.value)
  9028. return;
  9029. if (!pickerVisible.value && valueIsEmpty.value)
  9030. return;
  9031. if (formattedValue) {
  9032. return isDatesPicker.value ? formattedValue.join(", ") : formattedValue;
  9033. }
  9034. return "";
  9035. });
  9036. const isTimeLikePicker = computed(() => props.type.includes("time"));
  9037. const isTimePicker = computed(() => props.type.startsWith("time"));
  9038. const isDatesPicker = computed(() => props.type === "dates");
  9039. const triggerIcon = computed(() => props.prefixIcon || (isTimeLikePicker.value ? clock : calendar));
  9040. const showClose = ref(false);
  9041. const onClearIconClick = (event) => {
  9042. if (props.readonly || pickerDisabled.value)
  9043. return;
  9044. if (showClose.value) {
  9045. event.stopPropagation();
  9046. emitInput(null);
  9047. emitChange(null, true);
  9048. showClose.value = false;
  9049. pickerVisible.value = false;
  9050. pickerOptions.value.handleClear && pickerOptions.value.handleClear();
  9051. }
  9052. };
  9053. const valueIsEmpty = computed(() => {
  9054. return !props.modelValue || Array.isArray(props.modelValue) && !props.modelValue.length;
  9055. });
  9056. const onMouseEnter = () => {
  9057. if (props.readonly || pickerDisabled.value)
  9058. return;
  9059. if (!valueIsEmpty.value && props.clearable) {
  9060. showClose.value = true;
  9061. }
  9062. };
  9063. const onMouseLeave = () => {
  9064. showClose.value = false;
  9065. };
  9066. const isRangeInput = computed(() => {
  9067. return props.type.includes("range");
  9068. });
  9069. const pickerSize = useSize();
  9070. const popperPaneRef = computed(() => {
  9071. var _a2, _b2;
  9072. return (_b2 = (_a2 = refPopper.value) == null ? void 0 : _a2.popperRef) == null ? void 0 : _b2.contentRef;
  9073. });
  9074. const popperEl = computed(() => {
  9075. var _a2, _b2;
  9076. return (_b2 = (_a2 = unref(refPopper)) == null ? void 0 : _a2.popperRef) == null ? void 0 : _b2.contentRef;
  9077. });
  9078. const actualInputRef = computed(() => {
  9079. var _a2;
  9080. if (unref(isRangeInput)) {
  9081. return unref(inputRef);
  9082. }
  9083. return (_a2 = unref(inputRef)) == null ? void 0 : _a2.$el;
  9084. });
  9085. onClickOutside(actualInputRef, (e) => {
  9086. const unrefedPopperEl = unref(popperEl);
  9087. const inputEl = unref(actualInputRef);
  9088. if (unrefedPopperEl && (e.target === unrefedPopperEl || e.composedPath().includes(unrefedPopperEl)) || e.target === inputEl || e.composedPath().includes(inputEl))
  9089. return;
  9090. pickerVisible.value = false;
  9091. });
  9092. const userInput = ref(null);
  9093. const handleChange2 = () => {
  9094. if (userInput.value) {
  9095. const value = parseUserInputToDayjs(displayValue.value);
  9096. if (value) {
  9097. if (isValidValue(value)) {
  9098. emitInput(Array.isArray(value) ? value.map((_2) => _2.toDate()) : value.toDate());
  9099. userInput.value = null;
  9100. }
  9101. }
  9102. }
  9103. if (userInput.value === "") {
  9104. emitInput(null);
  9105. emitChange(null);
  9106. userInput.value = null;
  9107. }
  9108. };
  9109. const blurInput = () => {
  9110. refInput.value.forEach((input) => input.blur());
  9111. };
  9112. const parseUserInputToDayjs = (value) => {
  9113. if (!value)
  9114. return null;
  9115. return pickerOptions.value.parseUserInput(value);
  9116. };
  9117. const formatDayjsToString = (value) => {
  9118. if (!value)
  9119. return null;
  9120. return pickerOptions.value.formatToString(value);
  9121. };
  9122. const isValidValue = (value) => {
  9123. return pickerOptions.value.isValidValue(value);
  9124. };
  9125. const handleKeydown = (event) => {
  9126. const code = event.code;
  9127. if (code === EVENT_CODE.esc) {
  9128. pickerVisible.value = false;
  9129. event.stopPropagation();
  9130. return;
  9131. }
  9132. if (code === EVENT_CODE.tab) {
  9133. if (!isRangeInput.value) {
  9134. handleChange2();
  9135. pickerVisible.value = false;
  9136. event.stopPropagation();
  9137. } else {
  9138. setTimeout(() => {
  9139. if (!refInput.value.includes(document.activeElement)) {
  9140. pickerVisible.value = false;
  9141. blurInput();
  9142. }
  9143. }, 0);
  9144. }
  9145. return;
  9146. }
  9147. if (code === EVENT_CODE.enter || code === EVENT_CODE.numpadEnter) {
  9148. if (userInput.value === null || userInput.value === "" || isValidValue(parseUserInputToDayjs(displayValue.value))) {
  9149. handleChange2();
  9150. pickerVisible.value = false;
  9151. }
  9152. event.stopPropagation();
  9153. return;
  9154. }
  9155. if (userInput.value) {
  9156. event.stopPropagation();
  9157. return;
  9158. }
  9159. if (pickerOptions.value.handleKeydown) {
  9160. pickerOptions.value.handleKeydown(event);
  9161. }
  9162. };
  9163. const onUserInput = (e) => {
  9164. userInput.value = e;
  9165. };
  9166. const handleStartInput = (event) => {
  9167. if (userInput.value) {
  9168. userInput.value = [event.target.value, userInput.value[1]];
  9169. } else {
  9170. userInput.value = [event.target.value, null];
  9171. }
  9172. };
  9173. const handleEndInput = (event) => {
  9174. if (userInput.value) {
  9175. userInput.value = [userInput.value[0], event.target.value];
  9176. } else {
  9177. userInput.value = [null, event.target.value];
  9178. }
  9179. };
  9180. const handleStartChange = () => {
  9181. const value = parseUserInputToDayjs(userInput.value && userInput.value[0]);
  9182. if (value && value.isValid()) {
  9183. userInput.value = [formatDayjsToString(value), displayValue.value[1]];
  9184. const newValue = [value, parsedValue.value && parsedValue.value[1]];
  9185. if (isValidValue(newValue)) {
  9186. emitInput(newValue);
  9187. userInput.value = null;
  9188. }
  9189. }
  9190. };
  9191. const handleEndChange = () => {
  9192. const value = parseUserInputToDayjs(userInput.value && userInput.value[1]);
  9193. if (value && value.isValid()) {
  9194. userInput.value = [displayValue.value[0], formatDayjsToString(value)];
  9195. const newValue = [parsedValue.value && parsedValue.value[0], value];
  9196. if (isValidValue(newValue)) {
  9197. emitInput(newValue);
  9198. userInput.value = null;
  9199. }
  9200. }
  9201. };
  9202. const pickerOptions = ref({});
  9203. const onSetPickerOption = (e) => {
  9204. pickerOptions.value[e[0]] = e[1];
  9205. pickerOptions.value.panelReady = true;
  9206. };
  9207. const onCalendarChange = (e) => {
  9208. ctx.emit("calendar-change", e);
  9209. };
  9210. const onPanelChange = (value, mode, view2) => {
  9211. ctx.emit("panel-change", value, mode, view2);
  9212. };
  9213. provide("EP_PICKER_BASE", {
  9214. props
  9215. });
  9216. return {
  9217. nsDate,
  9218. nsInput,
  9219. nsRange,
  9220. elPopperOptions,
  9221. isDatesPicker,
  9222. handleEndChange,
  9223. handleStartChange,
  9224. handleStartInput,
  9225. handleEndInput,
  9226. onUserInput,
  9227. handleChange: handleChange2,
  9228. handleKeydown,
  9229. popperPaneRef,
  9230. onClickOutside,
  9231. pickerSize,
  9232. isRangeInput,
  9233. onMouseLeave,
  9234. onMouseEnter,
  9235. onClearIconClick,
  9236. showClose,
  9237. triggerIcon,
  9238. onPick,
  9239. handleFocus,
  9240. handleBlur,
  9241. pickerVisible,
  9242. pickerActualVisible,
  9243. displayValue,
  9244. parsedValue,
  9245. setSelectionRange,
  9246. refPopper,
  9247. inputRef,
  9248. pickerDisabled,
  9249. onSetPickerOption,
  9250. onCalendarChange,
  9251. onPanelChange,
  9252. focus,
  9253. onShow,
  9254. onBeforeShow,
  9255. onHide
  9256. };
  9257. }
  9258. });
  9259. const _hoisted_1$A = ["id", "name", "placeholder", "value", "disabled", "readonly"];
  9260. const _hoisted_2$s = ["id", "name", "placeholder", "value", "disabled", "readonly"];
  9261. function _sfc_render$w(_ctx, _cache, $props, $setup, $data, $options) {
  9262. const _component_el_icon = resolveComponent("el-icon");
  9263. const _component_el_input = resolveComponent("el-input");
  9264. const _component_el_tooltip = resolveComponent("el-tooltip");
  9265. return openBlock(), createBlock(_component_el_tooltip, mergeProps({
  9266. ref: "refPopper",
  9267. visible: _ctx.pickerVisible,
  9268. "onUpdate:visible": _cache[17] || (_cache[17] = ($event) => _ctx.pickerVisible = $event),
  9269. effect: "light",
  9270. pure: "",
  9271. trigger: "click"
  9272. }, _ctx.$attrs, {
  9273. "append-to-body": "",
  9274. transition: `${_ctx.nsDate.namespace.value}-zoom-in-top`,
  9275. "popper-class": [`${_ctx.nsDate.namespace.value}-picker__popper`, _ctx.popperClass],
  9276. "popper-options": _ctx.elPopperOptions,
  9277. "fallback-placements": ["bottom", "top", "right", "left"],
  9278. "gpu-acceleration": false,
  9279. "stop-popper-mouse-event": false,
  9280. "hide-after": 0,
  9281. persistent: "",
  9282. onBeforeShow: _ctx.onBeforeShow,
  9283. onShow: _ctx.onShow,
  9284. onHide: _ctx.onHide
  9285. }), {
  9286. default: withCtx(() => [
  9287. !_ctx.isRangeInput ? (openBlock(), createBlock(_component_el_input, {
  9288. key: 0,
  9289. id: _ctx.id,
  9290. ref: "inputRef",
  9291. "model-value": _ctx.displayValue,
  9292. name: _ctx.name,
  9293. size: _ctx.pickerSize,
  9294. disabled: _ctx.pickerDisabled,
  9295. placeholder: _ctx.placeholder,
  9296. class: normalizeClass([_ctx.nsDate.b("editor"), _ctx.nsDate.bm("editor", _ctx.type), _ctx.$attrs.class]),
  9297. style: normalizeStyle(_ctx.$attrs.style),
  9298. readonly: !_ctx.editable || _ctx.readonly || _ctx.isDatesPicker || _ctx.type === "week",
  9299. onInput: _ctx.onUserInput,
  9300. onFocus: _ctx.handleFocus,
  9301. onKeydown: _ctx.handleKeydown,
  9302. onChange: _ctx.handleChange,
  9303. onMouseenter: _ctx.onMouseEnter,
  9304. onMouseleave: _ctx.onMouseLeave,
  9305. onClick: _cache[0] || (_cache[0] = withModifiers(() => {
  9306. }, ["stop"]))
  9307. }, {
  9308. prefix: withCtx(() => [
  9309. _ctx.triggerIcon ? (openBlock(), createBlock(_component_el_icon, {
  9310. key: 0,
  9311. class: normalizeClass(_ctx.nsInput.e("icon")),
  9312. onClick: _ctx.handleFocus
  9313. }, {
  9314. default: withCtx(() => [
  9315. (openBlock(), createBlock(resolveDynamicComponent(_ctx.triggerIcon)))
  9316. ]),
  9317. _: 1
  9318. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true)
  9319. ]),
  9320. suffix: withCtx(() => [
  9321. _ctx.showClose && _ctx.clearIcon ? (openBlock(), createBlock(_component_el_icon, {
  9322. key: 0,
  9323. class: normalizeClass(`${_ctx.nsInput.e("icon")} clear-icon`),
  9324. onClick: _ctx.onClearIconClick
  9325. }, {
  9326. default: withCtx(() => [
  9327. (openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon)))
  9328. ]),
  9329. _: 1
  9330. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true)
  9331. ]),
  9332. _: 1
  9333. }, 8, ["id", "model-value", "name", "size", "disabled", "placeholder", "class", "style", "readonly", "onInput", "onFocus", "onKeydown", "onChange", "onMouseenter", "onMouseleave"])) : (openBlock(), createElementBlock("div", {
  9334. key: 1,
  9335. ref: "inputRef",
  9336. class: normalizeClass([
  9337. _ctx.nsDate.b("editor"),
  9338. _ctx.nsDate.bm("editor", _ctx.type),
  9339. _ctx.nsInput.e("inner"),
  9340. _ctx.nsDate.is("disabled", _ctx.pickerDisabled),
  9341. _ctx.nsDate.is("active", _ctx.pickerVisible),
  9342. _ctx.nsRange.b("editor"),
  9343. _ctx.pickerSize ? _ctx.nsRange.bm("editor", _ctx.pickerSize) : "",
  9344. _ctx.$attrs.class
  9345. ]),
  9346. style: normalizeStyle(_ctx.$attrs.style),
  9347. onClick: _cache[7] || (_cache[7] = (...args) => _ctx.handleFocus && _ctx.handleFocus(...args)),
  9348. onMouseenter: _cache[8] || (_cache[8] = (...args) => _ctx.onMouseEnter && _ctx.onMouseEnter(...args)),
  9349. onMouseleave: _cache[9] || (_cache[9] = (...args) => _ctx.onMouseLeave && _ctx.onMouseLeave(...args)),
  9350. onKeydown: _cache[10] || (_cache[10] = (...args) => _ctx.handleKeydown && _ctx.handleKeydown(...args))
  9351. }, [
  9352. _ctx.triggerIcon ? (openBlock(), createBlock(_component_el_icon, {
  9353. key: 0,
  9354. class: normalizeClass([_ctx.nsInput.e("icon"), _ctx.nsRange.e("icon")]),
  9355. onClick: _ctx.handleFocus
  9356. }, {
  9357. default: withCtx(() => [
  9358. (openBlock(), createBlock(resolveDynamicComponent(_ctx.triggerIcon)))
  9359. ]),
  9360. _: 1
  9361. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true),
  9362. createElementVNode("input", {
  9363. id: _ctx.id && _ctx.id[0],
  9364. autocomplete: "off",
  9365. name: _ctx.name && _ctx.name[0],
  9366. placeholder: _ctx.startPlaceholder,
  9367. value: _ctx.displayValue && _ctx.displayValue[0],
  9368. disabled: _ctx.pickerDisabled,
  9369. readonly: !_ctx.editable || _ctx.readonly,
  9370. class: normalizeClass(_ctx.nsRange.b("input")),
  9371. onInput: _cache[1] || (_cache[1] = (...args) => _ctx.handleStartInput && _ctx.handleStartInput(...args)),
  9372. onChange: _cache[2] || (_cache[2] = (...args) => _ctx.handleStartChange && _ctx.handleStartChange(...args)),
  9373. onFocus: _cache[3] || (_cache[3] = (...args) => _ctx.handleFocus && _ctx.handleFocus(...args))
  9374. }, null, 42, _hoisted_1$A),
  9375. renderSlot(_ctx.$slots, "range-separator", {}, () => [
  9376. createElementVNode("span", {
  9377. class: normalizeClass(_ctx.nsRange.b("separator"))
  9378. }, toDisplayString(_ctx.rangeSeparator), 3)
  9379. ]),
  9380. createElementVNode("input", {
  9381. id: _ctx.id && _ctx.id[1],
  9382. autocomplete: "off",
  9383. name: _ctx.name && _ctx.name[1],
  9384. placeholder: _ctx.endPlaceholder,
  9385. value: _ctx.displayValue && _ctx.displayValue[1],
  9386. disabled: _ctx.pickerDisabled,
  9387. readonly: !_ctx.editable || _ctx.readonly,
  9388. class: normalizeClass(_ctx.nsRange.b("input")),
  9389. onFocus: _cache[4] || (_cache[4] = (...args) => _ctx.handleFocus && _ctx.handleFocus(...args)),
  9390. onInput: _cache[5] || (_cache[5] = (...args) => _ctx.handleEndInput && _ctx.handleEndInput(...args)),
  9391. onChange: _cache[6] || (_cache[6] = (...args) => _ctx.handleEndChange && _ctx.handleEndChange(...args))
  9392. }, null, 42, _hoisted_2$s),
  9393. _ctx.clearIcon ? (openBlock(), createBlock(_component_el_icon, {
  9394. key: 1,
  9395. class: normalizeClass([
  9396. _ctx.nsInput.e("icon"),
  9397. _ctx.nsRange.e("close-icon"),
  9398. {
  9399. [_ctx.nsRange.e("close-icon--hidden")]: !_ctx.showClose
  9400. }
  9401. ]),
  9402. onClick: _ctx.onClearIconClick
  9403. }, {
  9404. default: withCtx(() => [
  9405. (openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon)))
  9406. ]),
  9407. _: 1
  9408. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true)
  9409. ], 38))
  9410. ]),
  9411. content: withCtx(() => [
  9412. renderSlot(_ctx.$slots, "default", {
  9413. visible: _ctx.pickerVisible,
  9414. actualVisible: _ctx.pickerActualVisible,
  9415. parsedValue: _ctx.parsedValue,
  9416. format: _ctx.format,
  9417. unlinkPanels: _ctx.unlinkPanels,
  9418. type: _ctx.type,
  9419. defaultValue: _ctx.defaultValue,
  9420. onPick: _cache[11] || (_cache[11] = (...args) => _ctx.onPick && _ctx.onPick(...args)),
  9421. onSelectRange: _cache[12] || (_cache[12] = (...args) => _ctx.setSelectionRange && _ctx.setSelectionRange(...args)),
  9422. onSetPickerOption: _cache[13] || (_cache[13] = (...args) => _ctx.onSetPickerOption && _ctx.onSetPickerOption(...args)),
  9423. onCalendarChange: _cache[14] || (_cache[14] = (...args) => _ctx.onCalendarChange && _ctx.onCalendarChange(...args)),
  9424. onPanelChange: _cache[15] || (_cache[15] = (...args) => _ctx.onPanelChange && _ctx.onPanelChange(...args)),
  9425. onMousedown: _cache[16] || (_cache[16] = withModifiers(() => {
  9426. }, ["stop"]))
  9427. })
  9428. ]),
  9429. _: 3
  9430. }, 16, ["visible", "transition", "popper-class", "popper-options", "onBeforeShow", "onShow", "onHide"]);
  9431. }
  9432. var CommonPicker = /* @__PURE__ */ _export_sfc$1(_sfc_main$T, [["render", _sfc_render$w], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/time-picker/src/common/picker.vue"]]);
  9433. const nodeList = /* @__PURE__ */ new Map();
  9434. let startClick;
  9435. if (isClient) {
  9436. document.addEventListener("mousedown", (e) => startClick = e);
  9437. document.addEventListener("mouseup", (e) => {
  9438. for (const handlers of nodeList.values()) {
  9439. for (const { documentHandler } of handlers) {
  9440. documentHandler(e, startClick);
  9441. }
  9442. }
  9443. });
  9444. }
  9445. function createDocumentHandler(el, binding) {
  9446. let excludes = [];
  9447. if (Array.isArray(binding.arg)) {
  9448. excludes = binding.arg;
  9449. } else if (isElement$1(binding.arg)) {
  9450. excludes.push(binding.arg);
  9451. }
  9452. return function(mouseup, mousedown) {
  9453. const popperRef = binding.instance.popperRef;
  9454. const mouseUpTarget = mouseup.target;
  9455. const mouseDownTarget = mousedown == null ? void 0 : mousedown.target;
  9456. const isBound = !binding || !binding.instance;
  9457. const isTargetExists = !mouseUpTarget || !mouseDownTarget;
  9458. const isContainedByEl = el.contains(mouseUpTarget) || el.contains(mouseDownTarget);
  9459. const isSelf = el === mouseUpTarget;
  9460. const isTargetExcluded = excludes.length && excludes.some((item) => item == null ? void 0 : item.contains(mouseUpTarget)) || excludes.length && excludes.includes(mouseDownTarget);
  9461. const isContainedByPopper = popperRef && (popperRef.contains(mouseUpTarget) || popperRef.contains(mouseDownTarget));
  9462. if (isBound || isTargetExists || isContainedByEl || isSelf || isTargetExcluded || isContainedByPopper) {
  9463. return;
  9464. }
  9465. binding.value(mouseup, mousedown);
  9466. };
  9467. }
  9468. const ClickOutside = {
  9469. beforeMount(el, binding) {
  9470. if (!nodeList.has(el)) {
  9471. nodeList.set(el, []);
  9472. }
  9473. nodeList.get(el).push({
  9474. documentHandler: createDocumentHandler(el, binding),
  9475. bindingFn: binding.value
  9476. });
  9477. },
  9478. updated(el, binding) {
  9479. if (!nodeList.has(el)) {
  9480. nodeList.set(el, []);
  9481. }
  9482. const handlers = nodeList.get(el);
  9483. const oldHandlerIndex = handlers.findIndex((item) => item.bindingFn === binding.oldValue);
  9484. const newHandler = {
  9485. documentHandler: createDocumentHandler(el, binding),
  9486. bindingFn: binding.value
  9487. };
  9488. if (oldHandlerIndex >= 0) {
  9489. handlers.splice(oldHandlerIndex, 1, newHandler);
  9490. } else {
  9491. handlers.push(newHandler);
  9492. }
  9493. },
  9494. unmounted(el) {
  9495. nodeList.delete(el);
  9496. }
  9497. };
  9498. var RepeatClick = {
  9499. beforeMount(el, binding) {
  9500. let interval = null;
  9501. let startTime;
  9502. const handler3 = () => binding.value && binding.value();
  9503. const clear = () => {
  9504. if (Date.now() - startTime < 100) {
  9505. handler3();
  9506. }
  9507. clearInterval(interval);
  9508. interval = null;
  9509. };
  9510. on(el, "mousedown", (e) => {
  9511. if (e.button !== 0)
  9512. return;
  9513. startTime = Date.now();
  9514. once(document, "mouseup", clear);
  9515. clearInterval(interval);
  9516. interval = setInterval(handler3, 100);
  9517. });
  9518. }
  9519. };
  9520. var v = false, o, f, s, u, d, N, l, p, m, w, D, x, E, M, F;
  9521. function a() {
  9522. if (!v) {
  9523. v = true;
  9524. var e = navigator.userAgent, n = /(?:MSIE.(\d+\.\d+))|(?:(?:Firefox|GranParadiso|Iceweasel).(\d+\.\d+))|(?:Opera(?:.+Version.|.)(\d+\.\d+))|(?:AppleWebKit.(\d+(?:\.\d+)?))|(?:Trident\/\d+\.\d+.*rv:(\d+\.\d+))/.exec(e), i = /(Mac OS X)|(Windows)|(Linux)/.exec(e);
  9525. if (x = /\b(iPhone|iP[ao]d)/.exec(e), E = /\b(iP[ao]d)/.exec(e), w = /Android/i.exec(e), M = /FBAN\/\w+;/i.exec(e), F = /Mobile/i.exec(e), D = !!/Win64/.exec(e), n) {
  9526. o = n[1] ? parseFloat(n[1]) : n[5] ? parseFloat(n[5]) : NaN, o && document && document.documentMode && (o = document.documentMode);
  9527. var r = /(?:Trident\/(\d+.\d+))/.exec(e);
  9528. N = r ? parseFloat(r[1]) + 4 : o, f = n[2] ? parseFloat(n[2]) : NaN, s = n[3] ? parseFloat(n[3]) : NaN, u = n[4] ? parseFloat(n[4]) : NaN, u ? (n = /(?:Chrome\/(\d+\.\d+))/.exec(e), d = n && n[1] ? parseFloat(n[1]) : NaN) : d = NaN;
  9529. } else
  9530. o = f = s = d = u = NaN;
  9531. if (i) {
  9532. if (i[1]) {
  9533. var t = /(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(e);
  9534. l = t ? parseFloat(t[1].replace("_", ".")) : true;
  9535. } else
  9536. l = false;
  9537. p = !!i[2], m = !!i[3];
  9538. } else
  9539. l = p = m = false;
  9540. }
  9541. }
  9542. var _ = { ie: function() {
  9543. return a() || o;
  9544. }, ieCompatibilityMode: function() {
  9545. return a() || N > o;
  9546. }, ie64: function() {
  9547. return _.ie() && D;
  9548. }, firefox: function() {
  9549. return a() || f;
  9550. }, opera: function() {
  9551. return a() || s;
  9552. }, webkit: function() {
  9553. return a() || u;
  9554. }, safari: function() {
  9555. return _.webkit();
  9556. }, chrome: function() {
  9557. return a() || d;
  9558. }, windows: function() {
  9559. return a() || p;
  9560. }, osx: function() {
  9561. return a() || l;
  9562. }, linux: function() {
  9563. return a() || m;
  9564. }, iphone: function() {
  9565. return a() || x;
  9566. }, mobile: function() {
  9567. return a() || x || E || w || F;
  9568. }, nativeApp: function() {
  9569. return a() || M;
  9570. }, android: function() {
  9571. return a() || w;
  9572. }, ipad: function() {
  9573. return a() || E;
  9574. } }, A = _;
  9575. var c = !!(typeof window < "u" && window.document && window.document.createElement), U = { canUseDOM: c, canUseWorkers: typeof Worker < "u", canUseEventListeners: c && !!(window.addEventListener || window.attachEvent), canUseViewport: c && !!window.screen, isInWorker: !c }, h = U;
  9576. var X;
  9577. h.canUseDOM && (X = document.implementation && document.implementation.hasFeature && document.implementation.hasFeature("", "") !== true);
  9578. function S(e, n) {
  9579. if (!h.canUseDOM || n && !("addEventListener" in document))
  9580. return false;
  9581. var i = "on" + e, r = i in document;
  9582. if (!r) {
  9583. var t = document.createElement("div");
  9584. t.setAttribute(i, "return;"), r = typeof t[i] == "function";
  9585. }
  9586. return !r && X && e === "wheel" && (r = document.implementation.hasFeature("Events.wheel", "3.0")), r;
  9587. }
  9588. var b = S;
  9589. var O = 10, I = 40, P = 800;
  9590. function T(e) {
  9591. var n = 0, i = 0, r = 0, t = 0;
  9592. return "detail" in e && (i = e.detail), "wheelDelta" in e && (i = -e.wheelDelta / 120), "wheelDeltaY" in e && (i = -e.wheelDeltaY / 120), "wheelDeltaX" in e && (n = -e.wheelDeltaX / 120), "axis" in e && e.axis === e.HORIZONTAL_AXIS && (n = i, i = 0), r = n * O, t = i * O, "deltaY" in e && (t = e.deltaY), "deltaX" in e && (r = e.deltaX), (r || t) && e.deltaMode && (e.deltaMode == 1 ? (r *= I, t *= I) : (r *= P, t *= P)), r && !n && (n = r < 1 ? -1 : 1), t && !i && (i = t < 1 ? -1 : 1), { spinX: n, spinY: i, pixelX: r, pixelY: t };
  9593. }
  9594. T.getEventType = function() {
  9595. return A.firefox() ? "DOMMouseScroll" : b("wheel") ? "wheel" : "mousewheel";
  9596. };
  9597. var Y = T;
  9598. /**
  9599. * Checks if an event is supported in the current execution environment.
  9600. *
  9601. * NOTE: This will not work correctly for non-generic events such as `change`,
  9602. * `reset`, `load`, `error`, and `select`.
  9603. *
  9604. * Borrows from Modernizr.
  9605. *
  9606. * @param {string} eventNameSuffix Event name, e.g. "click".
  9607. * @param {?boolean} capture Check if the capture phase is supported.
  9608. * @return {boolean} True if the event is supported.
  9609. * @internal
  9610. * @license Modernizr 3.0.0pre (Custom Build) | MIT
  9611. */
  9612. const mousewheel = function(element, callback) {
  9613. if (element && element.addEventListener) {
  9614. const fn2 = function(event) {
  9615. const normalized = Y(event);
  9616. callback && Reflect.apply(callback, this, [event, normalized]);
  9617. };
  9618. if (isFirefox()) {
  9619. element.addEventListener("DOMMouseScroll", fn2);
  9620. } else {
  9621. element.onmousewheel = fn2;
  9622. }
  9623. }
  9624. };
  9625. const Mousewheel = {
  9626. beforeMount(el, binding) {
  9627. mousewheel(el, binding.value);
  9628. }
  9629. };
  9630. const makeList = (total, method4, methodFunc) => {
  9631. const arr = [];
  9632. const disabledArr = method4 && methodFunc();
  9633. for (let i = 0; i < total; i++) {
  9634. arr[i] = disabledArr ? disabledArr.includes(i) : false;
  9635. }
  9636. return arr;
  9637. };
  9638. const makeAvailableArr = (list) => {
  9639. return list.map((_2, index) => !_2 ? index : _2).filter((_2) => _2 !== true);
  9640. };
  9641. const getTimeLists = (disabledHours, disabledMinutes, disabledSeconds) => {
  9642. const getHoursList = (role, compare) => {
  9643. return makeList(24, disabledHours, () => disabledHours(role, compare));
  9644. };
  9645. const getMinutesList = (hour, role, compare) => {
  9646. return makeList(60, disabledMinutes, () => disabledMinutes(hour, role, compare));
  9647. };
  9648. const getSecondsList = (hour, minute, role, compare) => {
  9649. return makeList(60, disabledSeconds, () => disabledSeconds(hour, minute, role, compare));
  9650. };
  9651. return {
  9652. getHoursList,
  9653. getMinutesList,
  9654. getSecondsList
  9655. };
  9656. };
  9657. const getAvailableArrs = (disabledHours, disabledMinutes, disabledSeconds) => {
  9658. const { getHoursList, getMinutesList, getSecondsList } = getTimeLists(disabledHours, disabledMinutes, disabledSeconds);
  9659. const getAvailableHours = (role, compare) => {
  9660. return makeAvailableArr(getHoursList(role, compare));
  9661. };
  9662. const getAvailableMinutes = (hour, role, compare) => {
  9663. return makeAvailableArr(getMinutesList(hour, role, compare));
  9664. };
  9665. const getAvailableSeconds = (hour, minute, role, compare) => {
  9666. return makeAvailableArr(getSecondsList(hour, minute, role, compare));
  9667. };
  9668. return {
  9669. getAvailableHours,
  9670. getAvailableMinutes,
  9671. getAvailableSeconds
  9672. };
  9673. };
  9674. const useOldValue = (props) => {
  9675. const oldValue = ref(props.parsedValue);
  9676. watch(() => props.visible, (val) => {
  9677. if (!val) {
  9678. oldValue.value = props.parsedValue;
  9679. }
  9680. });
  9681. return oldValue;
  9682. };
  9683. const _sfc_main$S = defineComponent({
  9684. directives: {
  9685. repeatClick: RepeatClick
  9686. },
  9687. components: {
  9688. ElScrollbar,
  9689. ElIcon,
  9690. ArrowUp: arrowUp,
  9691. ArrowDown: arrowDown
  9692. },
  9693. props: {
  9694. role: {
  9695. type: String,
  9696. required: true
  9697. },
  9698. spinnerDate: {
  9699. type: Object,
  9700. required: true
  9701. },
  9702. showSeconds: {
  9703. type: Boolean,
  9704. default: true
  9705. },
  9706. arrowControl: Boolean,
  9707. amPmMode: {
  9708. type: String,
  9709. default: ""
  9710. },
  9711. disabledHours: {
  9712. type: Function
  9713. },
  9714. disabledMinutes: {
  9715. type: Function
  9716. },
  9717. disabledSeconds: {
  9718. type: Function
  9719. }
  9720. },
  9721. emits: ["change", "select-range", "set-option"],
  9722. setup(props, ctx) {
  9723. const ns = useNamespace("time");
  9724. let isScrolling = false;
  9725. const debouncedResetScroll = debounce$1((type4) => {
  9726. isScrolling = false;
  9727. adjustCurrentSpinner(type4);
  9728. }, 200);
  9729. const currentScrollbar = ref(null);
  9730. const listHoursRef = ref(null);
  9731. const listMinutesRef = ref(null);
  9732. const listSecondsRef = ref(null);
  9733. const listRefsMap = {
  9734. hours: listHoursRef,
  9735. minutes: listMinutesRef,
  9736. seconds: listSecondsRef
  9737. };
  9738. const spinnerItems = computed(() => {
  9739. const arr = ["hours", "minutes", "seconds"];
  9740. return props.showSeconds ? arr : arr.slice(0, 2);
  9741. });
  9742. const hours = computed(() => {
  9743. return props.spinnerDate.hour();
  9744. });
  9745. const minutes = computed(() => {
  9746. return props.spinnerDate.minute();
  9747. });
  9748. const seconds = computed(() => {
  9749. return props.spinnerDate.second();
  9750. });
  9751. const timePartsMap = computed(() => ({
  9752. hours,
  9753. minutes,
  9754. seconds
  9755. }));
  9756. const hoursList = computed(() => {
  9757. return getHoursList(props.role);
  9758. });
  9759. const minutesList = computed(() => {
  9760. return getMinutesList(hours.value, props.role);
  9761. });
  9762. const secondsList = computed(() => {
  9763. return getSecondsList(hours.value, minutes.value, props.role);
  9764. });
  9765. const listMap = computed(() => ({
  9766. hours: hoursList,
  9767. minutes: minutesList,
  9768. seconds: secondsList
  9769. }));
  9770. const arrowHourList = computed(() => {
  9771. const hour = hours.value;
  9772. return [
  9773. hour > 0 ? hour - 1 : void 0,
  9774. hour,
  9775. hour < 23 ? hour + 1 : void 0
  9776. ];
  9777. });
  9778. const arrowMinuteList = computed(() => {
  9779. const minute = minutes.value;
  9780. return [
  9781. minute > 0 ? minute - 1 : void 0,
  9782. minute,
  9783. minute < 59 ? minute + 1 : void 0
  9784. ];
  9785. });
  9786. const arrowSecondList = computed(() => {
  9787. const second = seconds.value;
  9788. return [
  9789. second > 0 ? second - 1 : void 0,
  9790. second,
  9791. second < 59 ? second + 1 : void 0
  9792. ];
  9793. });
  9794. const arrowListMap = computed(() => ({
  9795. hours: arrowHourList,
  9796. minutes: arrowMinuteList,
  9797. seconds: arrowSecondList
  9798. }));
  9799. const getAmPmFlag = (hour) => {
  9800. const shouldShowAmPm = !!props.amPmMode;
  9801. if (!shouldShowAmPm)
  9802. return "";
  9803. const isCapital = props.amPmMode === "A";
  9804. let content2 = hour < 12 ? " am" : " pm";
  9805. if (isCapital)
  9806. content2 = content2.toUpperCase();
  9807. return content2;
  9808. };
  9809. const emitSelectRange = (type4) => {
  9810. if (type4 === "hours") {
  9811. ctx.emit("select-range", 0, 2);
  9812. } else if (type4 === "minutes") {
  9813. ctx.emit("select-range", 3, 5);
  9814. } else if (type4 === "seconds") {
  9815. ctx.emit("select-range", 6, 8);
  9816. }
  9817. currentScrollbar.value = type4;
  9818. };
  9819. const adjustCurrentSpinner = (type4) => {
  9820. adjustSpinner(type4, timePartsMap.value[type4].value);
  9821. };
  9822. const adjustSpinners = () => {
  9823. adjustCurrentSpinner("hours");
  9824. adjustCurrentSpinner("minutes");
  9825. adjustCurrentSpinner("seconds");
  9826. };
  9827. const getScrollbarElement = (el) => el.querySelector(`.${ns.namespace.value}-scrollbar__wrap`);
  9828. const adjustSpinner = (type4, value) => {
  9829. if (props.arrowControl)
  9830. return;
  9831. const el = listRefsMap[type4];
  9832. if (el && el.$el) {
  9833. getScrollbarElement(el.$el).scrollTop = Math.max(0, value * typeItemHeight(type4));
  9834. }
  9835. };
  9836. const typeItemHeight = (type4) => {
  9837. const el = listRefsMap[type4];
  9838. return el.$el.querySelector("li").offsetHeight;
  9839. };
  9840. const onIncreaseClick = () => {
  9841. scrollDown(1);
  9842. };
  9843. const onDecreaseClick = () => {
  9844. scrollDown(-1);
  9845. };
  9846. const scrollDown = (step) => {
  9847. if (!currentScrollbar.value) {
  9848. emitSelectRange("hours");
  9849. }
  9850. const label = currentScrollbar.value;
  9851. let now2 = timePartsMap.value[label].value;
  9852. const total = currentScrollbar.value === "hours" ? 24 : 60;
  9853. now2 = (now2 + step + total) % total;
  9854. modifyDateField(label, now2);
  9855. adjustSpinner(label, now2);
  9856. nextTick(() => emitSelectRange(currentScrollbar.value));
  9857. };
  9858. const modifyDateField = (type4, value) => {
  9859. const list = listMap.value[type4].value;
  9860. const isDisabled = list[value];
  9861. if (isDisabled)
  9862. return;
  9863. switch (type4) {
  9864. case "hours":
  9865. ctx.emit("change", props.spinnerDate.hour(value).minute(minutes.value).second(seconds.value));
  9866. break;
  9867. case "minutes":
  9868. ctx.emit("change", props.spinnerDate.hour(hours.value).minute(value).second(seconds.value));
  9869. break;
  9870. case "seconds":
  9871. ctx.emit("change", props.spinnerDate.hour(hours.value).minute(minutes.value).second(value));
  9872. break;
  9873. }
  9874. };
  9875. const handleClick = (type4, { value, disabled }) => {
  9876. if (!disabled) {
  9877. modifyDateField(type4, value);
  9878. emitSelectRange(type4);
  9879. adjustSpinner(type4, value);
  9880. }
  9881. };
  9882. const handleScroll = (type4) => {
  9883. isScrolling = true;
  9884. debouncedResetScroll(type4);
  9885. const value = Math.min(Math.round((getScrollbarElement(listRefsMap[type4].$el).scrollTop - (scrollBarHeight(type4) * 0.5 - 10) / typeItemHeight(type4) + 3) / typeItemHeight(type4)), type4 === "hours" ? 23 : 59);
  9886. modifyDateField(type4, value);
  9887. };
  9888. const scrollBarHeight = (type4) => {
  9889. return listRefsMap[type4].$el.offsetHeight;
  9890. };
  9891. const bindScrollEvent = () => {
  9892. const bindFunction = (type4) => {
  9893. if (listRefsMap[type4] && listRefsMap[type4].$el) {
  9894. getScrollbarElement(listRefsMap[type4].$el).onscroll = () => {
  9895. handleScroll(type4);
  9896. };
  9897. }
  9898. };
  9899. bindFunction("hours");
  9900. bindFunction("minutes");
  9901. bindFunction("seconds");
  9902. };
  9903. onMounted(() => {
  9904. nextTick(() => {
  9905. !props.arrowControl && bindScrollEvent();
  9906. adjustSpinners();
  9907. if (props.role === "start")
  9908. emitSelectRange("hours");
  9909. });
  9910. });
  9911. const setRef = (scrollbar, type4) => {
  9912. listRefsMap[type4] = scrollbar;
  9913. };
  9914. ctx.emit("set-option", [`${props.role}_scrollDown`, scrollDown]);
  9915. ctx.emit("set-option", [`${props.role}_emitSelectRange`, emitSelectRange]);
  9916. const { getHoursList, getMinutesList, getSecondsList } = getTimeLists(props.disabledHours, props.disabledMinutes, props.disabledSeconds);
  9917. watch(() => props.spinnerDate, () => {
  9918. if (isScrolling)
  9919. return;
  9920. adjustSpinners();
  9921. });
  9922. return {
  9923. ns,
  9924. setRef,
  9925. spinnerItems,
  9926. currentScrollbar,
  9927. hours,
  9928. minutes,
  9929. seconds,
  9930. hoursList,
  9931. minutesList,
  9932. arrowHourList,
  9933. arrowMinuteList,
  9934. arrowSecondList,
  9935. getAmPmFlag,
  9936. emitSelectRange,
  9937. adjustCurrentSpinner,
  9938. typeItemHeight,
  9939. listHoursRef,
  9940. listMinutesRef,
  9941. listSecondsRef,
  9942. onIncreaseClick,
  9943. onDecreaseClick,
  9944. handleClick,
  9945. secondsList,
  9946. timePartsMap,
  9947. arrowListMap,
  9948. listMap
  9949. };
  9950. }
  9951. });
  9952. const _hoisted_1$z = ["onClick"];
  9953. const _hoisted_2$r = ["onMouseenter"];
  9954. function _sfc_render$v(_ctx, _cache, $props, $setup, $data, $options) {
  9955. const _component_el_scrollbar = resolveComponent("el-scrollbar");
  9956. const _component_arrow_up = resolveComponent("arrow-up");
  9957. const _component_el_icon = resolveComponent("el-icon");
  9958. const _component_arrow_down = resolveComponent("arrow-down");
  9959. const _directive_repeat_click = resolveDirective("repeat-click");
  9960. return openBlock(), createElementBlock("div", {
  9961. class: normalizeClass([_ctx.ns.b("spinner"), { "has-seconds": _ctx.showSeconds }])
  9962. }, [
  9963. !_ctx.arrowControl ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(_ctx.spinnerItems, (item) => {
  9964. return openBlock(), createBlock(_component_el_scrollbar, {
  9965. key: item,
  9966. ref_for: true,
  9967. ref: (scollbar) => _ctx.setRef(scollbar, item),
  9968. class: normalizeClass(_ctx.ns.be("spinner", "wrapper")),
  9969. "wrap-style": "max-height: inherit;",
  9970. "view-class": _ctx.ns.be("spinner", "list"),
  9971. noresize: "",
  9972. tag: "ul",
  9973. onMouseenter: ($event) => _ctx.emitSelectRange(item),
  9974. onMousemove: ($event) => _ctx.adjustCurrentSpinner(item)
  9975. }, {
  9976. default: withCtx(() => [
  9977. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.listMap[item].value, (disabled, key) => {
  9978. return openBlock(), createElementBlock("li", {
  9979. key,
  9980. class: normalizeClass([
  9981. _ctx.ns.be("spinner", "item"),
  9982. _ctx.ns.is("active", key === _ctx.timePartsMap[item].value),
  9983. _ctx.ns.is("disabled", disabled)
  9984. ]),
  9985. onClick: ($event) => _ctx.handleClick(item, { value: key, disabled })
  9986. }, [
  9987. item === "hours" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  9988. createTextVNode(toDisplayString(("0" + (_ctx.amPmMode ? key % 12 || 12 : key)).slice(-2)) + toDisplayString(_ctx.getAmPmFlag(key)), 1)
  9989. ], 2112)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  9990. createTextVNode(toDisplayString(("0" + key).slice(-2)), 1)
  9991. ], 2112))
  9992. ], 10, _hoisted_1$z);
  9993. }), 128))
  9994. ]),
  9995. _: 2
  9996. }, 1032, ["class", "view-class", "onMouseenter", "onMousemove"]);
  9997. }), 128)) : createCommentVNode("v-if", true),
  9998. _ctx.arrowControl ? (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(_ctx.spinnerItems, (item) => {
  9999. return openBlock(), createElementBlock("div", {
  10000. key: item,
  10001. class: normalizeClass([_ctx.ns.be("spinner", "wrapper"), _ctx.ns.is("arrow")]),
  10002. onMouseenter: ($event) => _ctx.emitSelectRange(item)
  10003. }, [
  10004. withDirectives((openBlock(), createBlock(_component_el_icon, {
  10005. class: normalizeClass(["arrow-up", _ctx.ns.be("spinner", "arrow")])
  10006. }, {
  10007. default: withCtx(() => [
  10008. createVNode(_component_arrow_up)
  10009. ]),
  10010. _: 1
  10011. }, 8, ["class"])), [
  10012. [_directive_repeat_click, _ctx.onDecreaseClick]
  10013. ]),
  10014. withDirectives((openBlock(), createBlock(_component_el_icon, {
  10015. class: normalizeClass(["arrow-down", _ctx.ns.be("spinner", "arrow")])
  10016. }, {
  10017. default: withCtx(() => [
  10018. createVNode(_component_arrow_down)
  10019. ]),
  10020. _: 1
  10021. }, 8, ["class"])), [
  10022. [_directive_repeat_click, _ctx.onIncreaseClick]
  10023. ]),
  10024. createElementVNode("ul", {
  10025. class: normalizeClass(_ctx.ns.be("spinner", "list"))
  10026. }, [
  10027. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.arrowListMap[item].value, (time, key) => {
  10028. return openBlock(), createElementBlock("li", {
  10029. key,
  10030. class: normalizeClass([
  10031. _ctx.ns.be("spinner", "item"),
  10032. _ctx.ns.is("active", time === _ctx.timePartsMap[item].value),
  10033. _ctx.ns.is("disabled", _ctx.listMap[item].value[time])
  10034. ])
  10035. }, [
  10036. typeof time === "number" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  10037. item === "hours" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  10038. createTextVNode(toDisplayString(("0" + (_ctx.amPmMode ? time % 12 || 12 : time)).slice(-2)) + toDisplayString(_ctx.getAmPmFlag(time)), 1)
  10039. ], 2112)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  10040. createTextVNode(toDisplayString(("0" + time).slice(-2)), 1)
  10041. ], 2112))
  10042. ], 2112)) : createCommentVNode("v-if", true)
  10043. ], 2);
  10044. }), 128))
  10045. ], 2)
  10046. ], 42, _hoisted_2$r);
  10047. }), 128)) : createCommentVNode("v-if", true)
  10048. ], 2);
  10049. }
  10050. var TimeSpinner = /* @__PURE__ */ _export_sfc$1(_sfc_main$S, [["render", _sfc_render$v], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/time-picker/src/time-picker-com/basic-time-spinner.vue"]]);
  10051. const _sfc_main$R = defineComponent({
  10052. components: {
  10053. TimeSpinner
  10054. },
  10055. props: {
  10056. visible: Boolean,
  10057. actualVisible: {
  10058. type: Boolean,
  10059. default: void 0
  10060. },
  10061. datetimeRole: {
  10062. type: String
  10063. },
  10064. parsedValue: {
  10065. type: [Object, String]
  10066. },
  10067. format: {
  10068. type: String,
  10069. default: ""
  10070. }
  10071. },
  10072. emits: ["pick", "select-range", "set-picker-option"],
  10073. setup(props, ctx) {
  10074. const ns = useNamespace("time");
  10075. const { t, lang } = useLocale();
  10076. const selectionRange = ref([0, 2]);
  10077. const oldValue = useOldValue(props);
  10078. const transitionName = computed(() => {
  10079. return isUndefined(props.actualVisible) ? `${ns.namespace.value}-zoom-in-top` : "";
  10080. });
  10081. const showSeconds = computed(() => {
  10082. return props.format.includes("ss");
  10083. });
  10084. const amPmMode = computed(() => {
  10085. if (props.format.includes("A"))
  10086. return "A";
  10087. if (props.format.includes("a"))
  10088. return "a";
  10089. return "";
  10090. });
  10091. const isValidValue = (_date) => {
  10092. const parsedDate = dayjs(_date).locale(lang.value);
  10093. const result = getRangeAvailableTime(parsedDate);
  10094. return parsedDate.isSame(result);
  10095. };
  10096. const handleCancel = () => {
  10097. ctx.emit("pick", oldValue.value, false);
  10098. };
  10099. const handleConfirm = (visible = false, first = false) => {
  10100. if (first)
  10101. return;
  10102. ctx.emit("pick", props.parsedValue, visible);
  10103. };
  10104. const handleChange2 = (_date) => {
  10105. if (!props.visible) {
  10106. return;
  10107. }
  10108. const result = getRangeAvailableTime(_date).millisecond(0);
  10109. ctx.emit("pick", result, true);
  10110. };
  10111. const setSelectionRange = (start2, end2) => {
  10112. ctx.emit("select-range", start2, end2);
  10113. selectionRange.value = [start2, end2];
  10114. };
  10115. const changeSelectionRange = (step) => {
  10116. const list = [0, 3].concat(showSeconds.value ? [6] : []);
  10117. const mapping = ["hours", "minutes"].concat(showSeconds.value ? ["seconds"] : []);
  10118. const index = list.indexOf(selectionRange.value[0]);
  10119. const next = (index + step + list.length) % list.length;
  10120. timePickerOptions["start_emitSelectRange"](mapping[next]);
  10121. };
  10122. const handleKeydown = (event) => {
  10123. const code = event.code;
  10124. if (code === EVENT_CODE.left || code === EVENT_CODE.right) {
  10125. const step = code === EVENT_CODE.left ? -1 : 1;
  10126. changeSelectionRange(step);
  10127. event.preventDefault();
  10128. return;
  10129. }
  10130. if (code === EVENT_CODE.up || code === EVENT_CODE.down) {
  10131. const step = code === EVENT_CODE.up ? -1 : 1;
  10132. timePickerOptions["start_scrollDown"](step);
  10133. event.preventDefault();
  10134. return;
  10135. }
  10136. };
  10137. const getRangeAvailableTime = (date4) => {
  10138. const availableMap = {
  10139. hour: getAvailableHours,
  10140. minute: getAvailableMinutes,
  10141. second: getAvailableSeconds
  10142. };
  10143. let result = date4;
  10144. ["hour", "minute", "second"].forEach((_2) => {
  10145. if (availableMap[_2]) {
  10146. let availableArr;
  10147. const method4 = availableMap[_2];
  10148. if (_2 === "minute") {
  10149. availableArr = method4(result.hour(), props.datetimeRole);
  10150. } else if (_2 === "second") {
  10151. availableArr = method4(result.hour(), result.minute(), props.datetimeRole);
  10152. } else {
  10153. availableArr = method4(props.datetimeRole);
  10154. }
  10155. if (availableArr && availableArr.length && !availableArr.includes(result[_2]())) {
  10156. result = result[_2](availableArr[0]);
  10157. }
  10158. }
  10159. });
  10160. return result;
  10161. };
  10162. const parseUserInput = (value) => {
  10163. if (!value)
  10164. return null;
  10165. return dayjs(value, props.format).locale(lang.value);
  10166. };
  10167. const formatToString = (value) => {
  10168. if (!value)
  10169. return null;
  10170. return value.format(props.format);
  10171. };
  10172. const getDefaultValue = () => {
  10173. return dayjs(defaultValue).locale(lang.value);
  10174. };
  10175. ctx.emit("set-picker-option", ["isValidValue", isValidValue]);
  10176. ctx.emit("set-picker-option", ["formatToString", formatToString]);
  10177. ctx.emit("set-picker-option", ["parseUserInput", parseUserInput]);
  10178. ctx.emit("set-picker-option", ["handleKeydown", handleKeydown]);
  10179. ctx.emit("set-picker-option", [
  10180. "getRangeAvailableTime",
  10181. getRangeAvailableTime
  10182. ]);
  10183. ctx.emit("set-picker-option", ["getDefaultValue", getDefaultValue]);
  10184. const timePickerOptions = {};
  10185. const onSetOption = (e) => {
  10186. timePickerOptions[e[0]] = e[1];
  10187. };
  10188. const pickerBase = inject("EP_PICKER_BASE");
  10189. const {
  10190. arrowControl,
  10191. disabledHours,
  10192. disabledMinutes,
  10193. disabledSeconds,
  10194. defaultValue
  10195. } = pickerBase.props;
  10196. const { getAvailableHours, getAvailableMinutes, getAvailableSeconds } = getAvailableArrs(disabledHours, disabledMinutes, disabledSeconds);
  10197. return {
  10198. ns,
  10199. transitionName,
  10200. arrowControl,
  10201. onSetOption,
  10202. t,
  10203. handleConfirm,
  10204. handleChange: handleChange2,
  10205. setSelectionRange,
  10206. amPmMode,
  10207. showSeconds,
  10208. handleCancel,
  10209. disabledHours,
  10210. disabledMinutes,
  10211. disabledSeconds
  10212. };
  10213. }
  10214. });
  10215. function _sfc_render$u(_ctx, _cache, $props, $setup, $data, $options) {
  10216. const _component_time_spinner = resolveComponent("time-spinner");
  10217. return openBlock(), createBlock(Transition, { name: _ctx.transitionName }, {
  10218. default: withCtx(() => [
  10219. _ctx.actualVisible || _ctx.visible ? (openBlock(), createElementBlock("div", {
  10220. key: 0,
  10221. class: normalizeClass(_ctx.ns.b("panel"))
  10222. }, [
  10223. createElementVNode("div", {
  10224. class: normalizeClass([_ctx.ns.be("panel", "content"), { "has-seconds": _ctx.showSeconds }])
  10225. }, [
  10226. createVNode(_component_time_spinner, {
  10227. ref: "spinner",
  10228. role: _ctx.datetimeRole || "start",
  10229. "arrow-control": _ctx.arrowControl,
  10230. "show-seconds": _ctx.showSeconds,
  10231. "am-pm-mode": _ctx.amPmMode,
  10232. "spinner-date": _ctx.parsedValue,
  10233. "disabled-hours": _ctx.disabledHours,
  10234. "disabled-minutes": _ctx.disabledMinutes,
  10235. "disabled-seconds": _ctx.disabledSeconds,
  10236. onChange: _ctx.handleChange,
  10237. onSetOption: _ctx.onSetOption,
  10238. onSelectRange: _ctx.setSelectionRange
  10239. }, null, 8, ["role", "arrow-control", "show-seconds", "am-pm-mode", "spinner-date", "disabled-hours", "disabled-minutes", "disabled-seconds", "onChange", "onSetOption", "onSelectRange"])
  10240. ], 2),
  10241. createElementVNode("div", {
  10242. class: normalizeClass(_ctx.ns.be("panel", "footer"))
  10243. }, [
  10244. createElementVNode("button", {
  10245. type: "button",
  10246. class: normalizeClass([_ctx.ns.be("panel", "btn"), "cancel"]),
  10247. onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleCancel && _ctx.handleCancel(...args))
  10248. }, toDisplayString(_ctx.t("el.datepicker.cancel")), 3),
  10249. createElementVNode("button", {
  10250. type: "button",
  10251. class: normalizeClass([_ctx.ns.be("panel", "btn"), "confirm"]),
  10252. onClick: _cache[1] || (_cache[1] = ($event) => _ctx.handleConfirm())
  10253. }, toDisplayString(_ctx.t("el.datepicker.confirm")), 3)
  10254. ], 2)
  10255. ], 2)) : createCommentVNode("v-if", true)
  10256. ]),
  10257. _: 1
  10258. }, 8, ["name"]);
  10259. }
  10260. var TimePickPanel = /* @__PURE__ */ _export_sfc$1(_sfc_main$R, [["render", _sfc_render$u], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/time-picker/src/time-picker-com/panel-time-pick.vue"]]);
  10261. const makeSelectRange = (start2, end2) => {
  10262. const result = [];
  10263. for (let i = start2; i <= end2; i++) {
  10264. result.push(i);
  10265. }
  10266. return result;
  10267. };
  10268. const _sfc_main$Q = defineComponent({
  10269. components: { TimeSpinner },
  10270. props: {
  10271. visible: Boolean,
  10272. actualVisible: Boolean,
  10273. parsedValue: {
  10274. type: [Array]
  10275. },
  10276. format: {
  10277. type: String,
  10278. default: ""
  10279. }
  10280. },
  10281. emits: ["pick", "select-range", "set-picker-option"],
  10282. setup(props, ctx) {
  10283. const { t, lang } = useLocale();
  10284. const nsTime = useNamespace("time");
  10285. const nsPicker = useNamespace("picker");
  10286. const minDate = computed(() => props.parsedValue[0]);
  10287. const maxDate = computed(() => props.parsedValue[1]);
  10288. const oldValue = useOldValue(props);
  10289. const handleCancel = () => {
  10290. ctx.emit("pick", oldValue.value, false);
  10291. };
  10292. const showSeconds = computed(() => {
  10293. return props.format.includes("ss");
  10294. });
  10295. const amPmMode = computed(() => {
  10296. if (props.format.includes("A"))
  10297. return "A";
  10298. if (props.format.includes("a"))
  10299. return "a";
  10300. return "";
  10301. });
  10302. const minSelectableRange = ref([]);
  10303. const maxSelectableRange = ref([]);
  10304. const handleConfirm = (visible = false) => {
  10305. ctx.emit("pick", [minDate.value, maxDate.value], visible);
  10306. };
  10307. const handleMinChange = (date4) => {
  10308. handleChange2(date4.millisecond(0), maxDate.value);
  10309. };
  10310. const handleMaxChange = (date4) => {
  10311. handleChange2(minDate.value, date4.millisecond(0));
  10312. };
  10313. const isValidValue = (_date) => {
  10314. const parsedDate = _date.map((_2) => dayjs(_2).locale(lang.value));
  10315. const result = getRangeAvailableTime(parsedDate);
  10316. return parsedDate[0].isSame(result[0]) && parsedDate[1].isSame(result[1]);
  10317. };
  10318. const handleChange2 = (_minDate, _maxDate) => {
  10319. ctx.emit("pick", [_minDate, _maxDate], true);
  10320. };
  10321. const btnConfirmDisabled = computed(() => {
  10322. return minDate.value > maxDate.value;
  10323. });
  10324. const selectionRange = ref([0, 2]);
  10325. const setMinSelectionRange = (start2, end2) => {
  10326. ctx.emit("select-range", start2, end2, "min");
  10327. selectionRange.value = [start2, end2];
  10328. };
  10329. const offset2 = computed(() => showSeconds.value ? 11 : 8);
  10330. const setMaxSelectionRange = (start2, end2) => {
  10331. ctx.emit("select-range", start2, end2, "max");
  10332. selectionRange.value = [start2 + offset2.value, end2 + offset2.value];
  10333. };
  10334. const changeSelectionRange = (step) => {
  10335. const list = showSeconds.value ? [0, 3, 6, 11, 14, 17] : [0, 3, 8, 11];
  10336. const mapping = ["hours", "minutes"].concat(showSeconds.value ? ["seconds"] : []);
  10337. const index = list.indexOf(selectionRange.value[0]);
  10338. const next = (index + step + list.length) % list.length;
  10339. const half = list.length / 2;
  10340. if (next < half) {
  10341. timePickerOptions["start_emitSelectRange"](mapping[next]);
  10342. } else {
  10343. timePickerOptions["end_emitSelectRange"](mapping[next - half]);
  10344. }
  10345. };
  10346. const handleKeydown = (event) => {
  10347. const code = event.code;
  10348. if (code === EVENT_CODE.left || code === EVENT_CODE.right) {
  10349. const step = code === EVENT_CODE.left ? -1 : 1;
  10350. changeSelectionRange(step);
  10351. event.preventDefault();
  10352. return;
  10353. }
  10354. if (code === EVENT_CODE.up || code === EVENT_CODE.down) {
  10355. const step = code === EVENT_CODE.up ? -1 : 1;
  10356. const role = selectionRange.value[0] < offset2.value ? "start" : "end";
  10357. timePickerOptions[`${role}_scrollDown`](step);
  10358. event.preventDefault();
  10359. return;
  10360. }
  10361. };
  10362. const disabledHours_ = (role, compare) => {
  10363. const defaultDisable = disabledHours ? disabledHours(role) : [];
  10364. const isStart = role === "start";
  10365. const compareDate = compare || (isStart ? maxDate.value : minDate.value);
  10366. const compareHour = compareDate.hour();
  10367. const nextDisable = isStart ? makeSelectRange(compareHour + 1, 23) : makeSelectRange(0, compareHour - 1);
  10368. return union$1(defaultDisable, nextDisable);
  10369. };
  10370. const disabledMinutes_ = (hour, role, compare) => {
  10371. const defaultDisable = disabledMinutes ? disabledMinutes(hour, role) : [];
  10372. const isStart = role === "start";
  10373. const compareDate = compare || (isStart ? maxDate.value : minDate.value);
  10374. const compareHour = compareDate.hour();
  10375. if (hour !== compareHour) {
  10376. return defaultDisable;
  10377. }
  10378. const compareMinute = compareDate.minute();
  10379. const nextDisable = isStart ? makeSelectRange(compareMinute + 1, 59) : makeSelectRange(0, compareMinute - 1);
  10380. return union$1(defaultDisable, nextDisable);
  10381. };
  10382. const disabledSeconds_ = (hour, minute, role, compare) => {
  10383. const defaultDisable = disabledSeconds ? disabledSeconds(hour, minute, role) : [];
  10384. const isStart = role === "start";
  10385. const compareDate = compare || (isStart ? maxDate.value : minDate.value);
  10386. const compareHour = compareDate.hour();
  10387. const compareMinute = compareDate.minute();
  10388. if (hour !== compareHour || minute !== compareMinute) {
  10389. return defaultDisable;
  10390. }
  10391. const compareSecond = compareDate.second();
  10392. const nextDisable = isStart ? makeSelectRange(compareSecond + 1, 59) : makeSelectRange(0, compareSecond - 1);
  10393. return union$1(defaultDisable, nextDisable);
  10394. };
  10395. const getRangeAvailableTime = (dates) => {
  10396. return dates.map((_2, index) => getRangeAvailableTimeEach(dates[0], dates[1], index === 0 ? "start" : "end"));
  10397. };
  10398. const { getAvailableHours, getAvailableMinutes, getAvailableSeconds } = getAvailableArrs(disabledHours_, disabledMinutes_, disabledSeconds_);
  10399. const getRangeAvailableTimeEach = (startDate, endDate, role) => {
  10400. const availableMap = {
  10401. hour: getAvailableHours,
  10402. minute: getAvailableMinutes,
  10403. second: getAvailableSeconds
  10404. };
  10405. const isStart = role === "start";
  10406. let result = isStart ? startDate : endDate;
  10407. const compareDate = isStart ? endDate : startDate;
  10408. ["hour", "minute", "second"].forEach((_2) => {
  10409. if (availableMap[_2]) {
  10410. let availableArr;
  10411. const method4 = availableMap[_2];
  10412. if (_2 === "minute") {
  10413. availableArr = method4(result.hour(), role, compareDate);
  10414. } else if (_2 === "second") {
  10415. availableArr = method4(result.hour(), result.minute(), role, compareDate);
  10416. } else {
  10417. availableArr = method4(role, compareDate);
  10418. }
  10419. if (availableArr && availableArr.length && !availableArr.includes(result[_2]())) {
  10420. const pos = isStart ? 0 : availableArr.length - 1;
  10421. result = result[_2](availableArr[pos]);
  10422. }
  10423. }
  10424. });
  10425. return result;
  10426. };
  10427. const parseUserInput = (value) => {
  10428. if (!value)
  10429. return null;
  10430. if (Array.isArray(value)) {
  10431. return value.map((_2) => dayjs(_2, props.format).locale(lang.value));
  10432. }
  10433. return dayjs(value, props.format).locale(lang.value);
  10434. };
  10435. const formatToString = (value) => {
  10436. if (!value)
  10437. return null;
  10438. if (Array.isArray(value)) {
  10439. return value.map((_2) => _2.format(props.format));
  10440. }
  10441. return value.format(props.format);
  10442. };
  10443. const getDefaultValue = () => {
  10444. if (Array.isArray(defaultValue)) {
  10445. return defaultValue.map((_2) => dayjs(_2).locale(lang.value));
  10446. }
  10447. const defaultDay = dayjs(defaultValue).locale(lang.value);
  10448. return [defaultDay, defaultDay.add(60, "m")];
  10449. };
  10450. ctx.emit("set-picker-option", ["formatToString", formatToString]);
  10451. ctx.emit("set-picker-option", ["parseUserInput", parseUserInput]);
  10452. ctx.emit("set-picker-option", ["isValidValue", isValidValue]);
  10453. ctx.emit("set-picker-option", ["handleKeydown", handleKeydown]);
  10454. ctx.emit("set-picker-option", ["getDefaultValue", getDefaultValue]);
  10455. ctx.emit("set-picker-option", [
  10456. "getRangeAvailableTime",
  10457. getRangeAvailableTime
  10458. ]);
  10459. const timePickerOptions = {};
  10460. const onSetOption = (e) => {
  10461. timePickerOptions[e[0]] = e[1];
  10462. };
  10463. const pickerBase = inject("EP_PICKER_BASE");
  10464. const {
  10465. arrowControl,
  10466. disabledHours,
  10467. disabledMinutes,
  10468. disabledSeconds,
  10469. defaultValue
  10470. } = pickerBase.props;
  10471. return {
  10472. nsTime,
  10473. nsPicker,
  10474. arrowControl,
  10475. onSetOption,
  10476. setMaxSelectionRange,
  10477. setMinSelectionRange,
  10478. btnConfirmDisabled,
  10479. handleCancel,
  10480. handleConfirm,
  10481. t,
  10482. showSeconds,
  10483. minDate,
  10484. maxDate,
  10485. amPmMode,
  10486. handleMinChange,
  10487. handleMaxChange,
  10488. minSelectableRange,
  10489. maxSelectableRange,
  10490. disabledHours_,
  10491. disabledMinutes_,
  10492. disabledSeconds_
  10493. };
  10494. }
  10495. });
  10496. const _hoisted_1$y = ["disabled"];
  10497. function _sfc_render$t(_ctx, _cache, $props, $setup, $data, $options) {
  10498. const _component_time_spinner = resolveComponent("time-spinner");
  10499. return _ctx.actualVisible ? (openBlock(), createElementBlock("div", {
  10500. key: 0,
  10501. class: normalizeClass([_ctx.nsTime.b("range-picker"), _ctx.nsPicker.b("panel")])
  10502. }, [
  10503. createElementVNode("div", {
  10504. class: normalizeClass(_ctx.nsTime.be("range-picker", "content"))
  10505. }, [
  10506. createElementVNode("div", {
  10507. class: normalizeClass(_ctx.nsTime.be("range-picker", "cell"))
  10508. }, [
  10509. createElementVNode("div", {
  10510. class: normalizeClass(_ctx.nsTime.be("range-picker", "header"))
  10511. }, toDisplayString(_ctx.t("el.datepicker.startTime")), 3),
  10512. createElementVNode("div", {
  10513. class: normalizeClass([
  10514. _ctx.nsTime.be("range-picker", "body"),
  10515. _ctx.nsTime.be("panel", "content"),
  10516. _ctx.nsTime.is("arrow", _ctx.arrowControl),
  10517. { "has-seconds": _ctx.showSeconds }
  10518. ])
  10519. }, [
  10520. createVNode(_component_time_spinner, {
  10521. ref: "minSpinner",
  10522. role: "start",
  10523. "show-seconds": _ctx.showSeconds,
  10524. "am-pm-mode": _ctx.amPmMode,
  10525. "arrow-control": _ctx.arrowControl,
  10526. "spinner-date": _ctx.minDate,
  10527. "disabled-hours": _ctx.disabledHours_,
  10528. "disabled-minutes": _ctx.disabledMinutes_,
  10529. "disabled-seconds": _ctx.disabledSeconds_,
  10530. onChange: _ctx.handleMinChange,
  10531. onSetOption: _ctx.onSetOption,
  10532. onSelectRange: _ctx.setMinSelectionRange
  10533. }, null, 8, ["show-seconds", "am-pm-mode", "arrow-control", "spinner-date", "disabled-hours", "disabled-minutes", "disabled-seconds", "onChange", "onSetOption", "onSelectRange"])
  10534. ], 2)
  10535. ], 2),
  10536. createElementVNode("div", {
  10537. class: normalizeClass(_ctx.nsTime.be("range-picker", "cell"))
  10538. }, [
  10539. createElementVNode("div", {
  10540. class: normalizeClass(_ctx.nsTime.be("range-picker", "header"))
  10541. }, toDisplayString(_ctx.t("el.datepicker.endTime")), 3),
  10542. createElementVNode("div", {
  10543. class: normalizeClass([
  10544. _ctx.nsTime.be("range-picker", "body"),
  10545. _ctx.nsTime.be("panel", "content"),
  10546. _ctx.nsTime.is("arrow", _ctx.arrowControl),
  10547. { "has-seconds": _ctx.showSeconds }
  10548. ])
  10549. }, [
  10550. createVNode(_component_time_spinner, {
  10551. ref: "maxSpinner",
  10552. role: "end",
  10553. "show-seconds": _ctx.showSeconds,
  10554. "am-pm-mode": _ctx.amPmMode,
  10555. "arrow-control": _ctx.arrowControl,
  10556. "spinner-date": _ctx.maxDate,
  10557. "disabled-hours": _ctx.disabledHours_,
  10558. "disabled-minutes": _ctx.disabledMinutes_,
  10559. "disabled-seconds": _ctx.disabledSeconds_,
  10560. onChange: _ctx.handleMaxChange,
  10561. onSetOption: _ctx.onSetOption,
  10562. onSelectRange: _ctx.setMaxSelectionRange
  10563. }, null, 8, ["show-seconds", "am-pm-mode", "arrow-control", "spinner-date", "disabled-hours", "disabled-minutes", "disabled-seconds", "onChange", "onSetOption", "onSelectRange"])
  10564. ], 2)
  10565. ], 2)
  10566. ], 2),
  10567. createElementVNode("div", {
  10568. class: normalizeClass(_ctx.nsTime.be("panel", "footer"))
  10569. }, [
  10570. createElementVNode("button", {
  10571. type: "button",
  10572. class: normalizeClass([_ctx.nsTime.be("panel", "btn"), "cancel"]),
  10573. onClick: _cache[0] || (_cache[0] = ($event) => _ctx.handleCancel())
  10574. }, toDisplayString(_ctx.t("el.datepicker.cancel")), 3),
  10575. createElementVNode("button", {
  10576. type: "button",
  10577. class: normalizeClass([_ctx.nsTime.be("panel", "btn"), "confirm"]),
  10578. disabled: _ctx.btnConfirmDisabled,
  10579. onClick: _cache[1] || (_cache[1] = ($event) => _ctx.handleConfirm())
  10580. }, toDisplayString(_ctx.t("el.datepicker.confirm")), 11, _hoisted_1$y)
  10581. ], 2)
  10582. ], 2)) : createCommentVNode("v-if", true);
  10583. }
  10584. var TimeRangePanel = /* @__PURE__ */ _export_sfc$1(_sfc_main$Q, [["render", _sfc_render$t], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/time-picker/src/time-picker-com/panel-time-range.vue"]]);
  10585. dayjs.extend(customParseFormat);
  10586. var TimePicker = defineComponent({
  10587. name: "ElTimePicker",
  10588. install: null,
  10589. props: __spreadProps(__spreadValues({}, timePickerDefaultProps), {
  10590. isRange: {
  10591. type: Boolean,
  10592. default: false
  10593. }
  10594. }),
  10595. emits: ["update:modelValue"],
  10596. setup(props, ctx) {
  10597. const commonPicker = ref(null);
  10598. const type4 = props.isRange ? "timerange" : "time";
  10599. const panel = props.isRange ? TimeRangePanel : TimePickPanel;
  10600. const refProps = __spreadProps(__spreadValues({}, props), {
  10601. focus: () => {
  10602. var _a2;
  10603. (_a2 = commonPicker.value) == null ? void 0 : _a2.handleFocus();
  10604. },
  10605. blur: () => {
  10606. var _a2;
  10607. (_a2 = commonPicker.value) == null ? void 0 : _a2.handleBlur();
  10608. }
  10609. });
  10610. provide("ElPopperOptions", props.popperOptions);
  10611. ctx.expose(refProps);
  10612. return () => {
  10613. var _a2;
  10614. const format2 = (_a2 = props.format) != null ? _a2 : DEFAULT_FORMATS_TIME;
  10615. return h$1(CommonPicker, __spreadProps(__spreadValues({}, props), {
  10616. format: format2,
  10617. type: type4,
  10618. ref: commonPicker,
  10619. "onUpdate:modelValue": (value) => ctx.emit("update:modelValue", value)
  10620. }), {
  10621. default: (scopedProps) => h$1(panel, scopedProps)
  10622. });
  10623. };
  10624. }
  10625. });
  10626. const rangeArr = (n) => Array.from(Array.from({ length: n }).keys());
  10627. const extractDateFormat = (format2) => {
  10628. return format2.replace(/\W?m{1,2}|\W?ZZ/g, "").replace(/\W?h{1,2}|\W?s{1,3}|\W?a/gi, "").trim();
  10629. };
  10630. const extractTimeFormat = (format2) => {
  10631. return format2.replace(/\W?D{1,2}|\W?Do|\W?d{1,4}|\W?M{1,4}|\W?Y{2,4}/g, "").trim();
  10632. };
  10633. const _TimePicker = TimePicker;
  10634. _TimePicker.install = (app) => {
  10635. app.component(_TimePicker.name, _TimePicker);
  10636. };
  10637. const ElTimePicker = _TimePicker;
  10638. const useCheckboxProps = {
  10639. modelValue: {
  10640. type: [Boolean, Number, String],
  10641. default: () => void 0
  10642. },
  10643. label: {
  10644. type: [String, Boolean, Number, Object]
  10645. },
  10646. indeterminate: Boolean,
  10647. disabled: Boolean,
  10648. checked: Boolean,
  10649. name: {
  10650. type: String,
  10651. default: void 0
  10652. },
  10653. trueLabel: {
  10654. type: [String, Number],
  10655. default: void 0
  10656. },
  10657. falseLabel: {
  10658. type: [String, Number],
  10659. default: void 0
  10660. },
  10661. tabindex: [String, Number],
  10662. size: String
  10663. };
  10664. const useCheckboxGroup = () => {
  10665. const elForm2 = inject(formContextKey, {});
  10666. const elFormItem2 = inject(formItemContextKey, {});
  10667. const checkboxGroup = inject("CheckboxGroup", {});
  10668. const isGroup = computed(() => checkboxGroup && (checkboxGroup == null ? void 0 : checkboxGroup.name) === "ElCheckboxGroup");
  10669. const elFormItemSize = computed(() => {
  10670. return elFormItem2.size;
  10671. });
  10672. return {
  10673. isGroup,
  10674. checkboxGroup,
  10675. elForm: elForm2,
  10676. elFormItemSize,
  10677. elFormItem: elFormItem2
  10678. };
  10679. };
  10680. const useModel = (props) => {
  10681. const selfModel = ref(false);
  10682. const { emit } = getCurrentInstance();
  10683. const { isGroup, checkboxGroup } = useCheckboxGroup();
  10684. const isLimitExceeded = ref(false);
  10685. const model = computed({
  10686. get() {
  10687. var _a2, _b2;
  10688. return isGroup.value ? (_a2 = checkboxGroup.modelValue) == null ? void 0 : _a2.value : (_b2 = props.modelValue) != null ? _b2 : selfModel.value;
  10689. },
  10690. set(val) {
  10691. var _a2;
  10692. if (isGroup.value && Array.isArray(val)) {
  10693. isLimitExceeded.value = checkboxGroup.max !== void 0 && val.length > checkboxGroup.max.value;
  10694. isLimitExceeded.value === false && ((_a2 = checkboxGroup == null ? void 0 : checkboxGroup.changeEvent) == null ? void 0 : _a2.call(checkboxGroup, val));
  10695. } else {
  10696. emit(UPDATE_MODEL_EVENT, val);
  10697. selfModel.value = val;
  10698. }
  10699. }
  10700. });
  10701. return {
  10702. model,
  10703. isLimitExceeded
  10704. };
  10705. };
  10706. const useCheckboxStatus = (props, { model }) => {
  10707. const { isGroup, checkboxGroup } = useCheckboxGroup();
  10708. const focus = ref(false);
  10709. const size = useSize(checkboxGroup == null ? void 0 : checkboxGroup.checkboxGroupSize, { prop: true });
  10710. const isChecked = computed(() => {
  10711. const value = model.value;
  10712. if (toTypeString(value) === "[object Boolean]") {
  10713. return value;
  10714. } else if (Array.isArray(value)) {
  10715. return value.includes(props.label);
  10716. } else if (value !== null && value !== void 0) {
  10717. return value === props.trueLabel;
  10718. } else {
  10719. return !!value;
  10720. }
  10721. });
  10722. const checkboxSize = useSize(computed(() => {
  10723. var _a2;
  10724. return isGroup.value ? (_a2 = checkboxGroup == null ? void 0 : checkboxGroup.checkboxGroupSize) == null ? void 0 : _a2.value : void 0;
  10725. }));
  10726. return {
  10727. isChecked,
  10728. focus,
  10729. size,
  10730. checkboxSize
  10731. };
  10732. };
  10733. const useDisabled = (props, {
  10734. model,
  10735. isChecked
  10736. }) => {
  10737. const { elForm: elForm2, isGroup, checkboxGroup } = useCheckboxGroup();
  10738. const isLimitDisabled = computed(() => {
  10739. var _a2, _b2;
  10740. const max2 = (_a2 = checkboxGroup.max) == null ? void 0 : _a2.value;
  10741. const min2 = (_b2 = checkboxGroup.min) == null ? void 0 : _b2.value;
  10742. return !!(max2 || min2) && model.value.length >= max2 && !isChecked.value || model.value.length <= min2 && isChecked.value;
  10743. });
  10744. const isDisabled = computed(() => {
  10745. var _a2, _b2;
  10746. const disabled = props.disabled || elForm2.disabled;
  10747. return (_b2 = isGroup.value ? ((_a2 = checkboxGroup.disabled) == null ? void 0 : _a2.value) || disabled || isLimitDisabled.value : props.disabled || elForm2.disabled) != null ? _b2 : false;
  10748. });
  10749. return {
  10750. isDisabled,
  10751. isLimitDisabled
  10752. };
  10753. };
  10754. const setStoreValue = (props, { model }) => {
  10755. function addToStore() {
  10756. if (Array.isArray(model.value) && !model.value.includes(props.label)) {
  10757. model.value.push(props.label);
  10758. } else {
  10759. model.value = props.trueLabel || true;
  10760. }
  10761. }
  10762. props.checked && addToStore();
  10763. };
  10764. const useEvent$1 = (props, { isLimitExceeded }) => {
  10765. const { elFormItem: elFormItem2 } = useCheckboxGroup();
  10766. const { emit } = getCurrentInstance();
  10767. function handleChange2(e) {
  10768. var _a2, _b2;
  10769. if (isLimitExceeded.value)
  10770. return;
  10771. const target = e.target;
  10772. const value = target.checked ? (_a2 = props.trueLabel) != null ? _a2 : true : (_b2 = props.falseLabel) != null ? _b2 : false;
  10773. emit("change", value, e);
  10774. }
  10775. watch(() => props.modelValue, () => {
  10776. var _a2;
  10777. (_a2 = elFormItem2.validate) == null ? void 0 : _a2.call(elFormItem2, "change").catch((err) => debugWarn());
  10778. });
  10779. return {
  10780. handleChange: handleChange2
  10781. };
  10782. };
  10783. const useCheckbox = (props) => {
  10784. const { model, isLimitExceeded } = useModel(props);
  10785. const { focus, size, isChecked, checkboxSize } = useCheckboxStatus(props, {
  10786. model
  10787. });
  10788. const { isDisabled } = useDisabled(props, { model, isChecked });
  10789. const { handleChange: handleChange2 } = useEvent$1(props, { isLimitExceeded });
  10790. setStoreValue(props, { model });
  10791. return {
  10792. isChecked,
  10793. isDisabled,
  10794. checkboxSize,
  10795. model,
  10796. handleChange: handleChange2,
  10797. focus,
  10798. size
  10799. };
  10800. };
  10801. const _sfc_main$P = defineComponent({
  10802. name: "ElCheckbox",
  10803. props: {
  10804. modelValue: {
  10805. type: [Number, String, Boolean],
  10806. default: () => void 0
  10807. },
  10808. label: {
  10809. type: [String, Boolean, Number, Object]
  10810. },
  10811. indeterminate: Boolean,
  10812. disabled: Boolean,
  10813. checked: Boolean,
  10814. name: {
  10815. type: String,
  10816. default: void 0
  10817. },
  10818. trueLabel: {
  10819. type: [String, Number],
  10820. default: void 0
  10821. },
  10822. falseLabel: {
  10823. type: [String, Number],
  10824. default: void 0
  10825. },
  10826. id: {
  10827. type: String,
  10828. default: void 0
  10829. },
  10830. controls: {
  10831. type: String,
  10832. default: void 0
  10833. },
  10834. border: Boolean,
  10835. size: {
  10836. type: String,
  10837. validator: isValidComponentSize
  10838. },
  10839. tabindex: [String, Number]
  10840. },
  10841. emits: [UPDATE_MODEL_EVENT, "change"],
  10842. setup(props) {
  10843. const ns = useNamespace("checkbox");
  10844. return __spreadValues({
  10845. ns
  10846. }, useCheckbox(props));
  10847. }
  10848. });
  10849. const _hoisted_1$x = ["id", "aria-controls"];
  10850. const _hoisted_2$q = ["tabindex", "role", "aria-checked"];
  10851. const _hoisted_3$h = ["aria-hidden", "name", "tabindex", "disabled", "true-value", "false-value"];
  10852. const _hoisted_4$e = ["aria-hidden", "disabled", "value", "name", "tabindex"];
  10853. function _sfc_render$s(_ctx, _cache, $props, $setup, $data, $options) {
  10854. return openBlock(), createElementBlock("label", {
  10855. id: _ctx.id,
  10856. class: normalizeClass([
  10857. _ctx.ns.b(),
  10858. _ctx.ns.m(_ctx.checkboxSize),
  10859. _ctx.ns.is("disabled", _ctx.isDisabled),
  10860. _ctx.ns.is("bordered", _ctx.border),
  10861. _ctx.ns.is("checked", _ctx.isChecked)
  10862. ]),
  10863. "aria-controls": _ctx.indeterminate ? _ctx.controls : null
  10864. }, [
  10865. createElementVNode("span", {
  10866. class: normalizeClass([
  10867. _ctx.ns.e("input"),
  10868. _ctx.ns.is("disabled", _ctx.isDisabled),
  10869. _ctx.ns.is("checked", _ctx.isChecked),
  10870. _ctx.ns.is("indeterminate", _ctx.indeterminate),
  10871. _ctx.ns.is("focus", _ctx.focus)
  10872. ]),
  10873. tabindex: _ctx.indeterminate ? 0 : void 0,
  10874. role: _ctx.indeterminate ? "checkbox" : void 0,
  10875. "aria-checked": _ctx.indeterminate ? "mixed" : false
  10876. }, [
  10877. createElementVNode("span", {
  10878. class: normalizeClass(_ctx.ns.e("inner"))
  10879. }, null, 2),
  10880. _ctx.trueLabel || _ctx.falseLabel ? withDirectives((openBlock(), createElementBlock("input", {
  10881. key: 0,
  10882. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model = $event),
  10883. class: normalizeClass(_ctx.ns.e("original")),
  10884. type: "checkbox",
  10885. "aria-hidden": _ctx.indeterminate ? "true" : "false",
  10886. name: _ctx.name,
  10887. tabindex: _ctx.tabindex,
  10888. disabled: _ctx.isDisabled,
  10889. "true-value": _ctx.trueLabel,
  10890. "false-value": _ctx.falseLabel,
  10891. onChange: _cache[1] || (_cache[1] = (...args) => _ctx.handleChange && _ctx.handleChange(...args)),
  10892. onFocus: _cache[2] || (_cache[2] = ($event) => _ctx.focus = true),
  10893. onBlur: _cache[3] || (_cache[3] = ($event) => _ctx.focus = false)
  10894. }, null, 42, _hoisted_3$h)), [
  10895. [vModelCheckbox, _ctx.model]
  10896. ]) : withDirectives((openBlock(), createElementBlock("input", {
  10897. key: 1,
  10898. "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => _ctx.model = $event),
  10899. class: normalizeClass(_ctx.ns.e("original")),
  10900. type: "checkbox",
  10901. "aria-hidden": _ctx.indeterminate ? "true" : "false",
  10902. disabled: _ctx.isDisabled,
  10903. value: _ctx.label,
  10904. name: _ctx.name,
  10905. tabindex: _ctx.tabindex,
  10906. onChange: _cache[5] || (_cache[5] = (...args) => _ctx.handleChange && _ctx.handleChange(...args)),
  10907. onFocus: _cache[6] || (_cache[6] = ($event) => _ctx.focus = true),
  10908. onBlur: _cache[7] || (_cache[7] = ($event) => _ctx.focus = false)
  10909. }, null, 42, _hoisted_4$e)), [
  10910. [vModelCheckbox, _ctx.model]
  10911. ])
  10912. ], 10, _hoisted_2$q),
  10913. _ctx.$slots.default || _ctx.label ? (openBlock(), createElementBlock("span", {
  10914. key: 0,
  10915. class: normalizeClass(_ctx.ns.e("label"))
  10916. }, [
  10917. renderSlot(_ctx.$slots, "default"),
  10918. !_ctx.$slots.default ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  10919. createTextVNode(toDisplayString(_ctx.label), 1)
  10920. ], 2112)) : createCommentVNode("v-if", true)
  10921. ], 2)) : createCommentVNode("v-if", true)
  10922. ], 10, _hoisted_1$x);
  10923. }
  10924. var Checkbox = /* @__PURE__ */ _export_sfc$1(_sfc_main$P, [["render", _sfc_render$s], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/checkbox/src/checkbox.vue"]]);
  10925. const _sfc_main$O = defineComponent({
  10926. name: "ElCheckboxButton",
  10927. props: useCheckboxProps,
  10928. emits: [UPDATE_MODEL_EVENT, "change"],
  10929. setup(props) {
  10930. const { focus, isChecked, isDisabled, size, model, handleChange: handleChange2 } = useCheckbox(props);
  10931. const { checkboxGroup } = useCheckboxGroup();
  10932. const ns = useNamespace("checkbox");
  10933. const activeStyle = computed(() => {
  10934. var _a2, _b2, _c, _d;
  10935. const fillValue = (_b2 = (_a2 = checkboxGroup == null ? void 0 : checkboxGroup.fill) == null ? void 0 : _a2.value) != null ? _b2 : "";
  10936. return {
  10937. backgroundColor: fillValue,
  10938. borderColor: fillValue,
  10939. color: (_d = (_c = checkboxGroup == null ? void 0 : checkboxGroup.textColor) == null ? void 0 : _c.value) != null ? _d : "",
  10940. boxShadow: fillValue ? `-1px 0 0 0 ${fillValue}` : null
  10941. };
  10942. });
  10943. return {
  10944. focus,
  10945. isChecked,
  10946. isDisabled,
  10947. model,
  10948. handleChange: handleChange2,
  10949. activeStyle,
  10950. size,
  10951. ns
  10952. };
  10953. }
  10954. });
  10955. const _hoisted_1$w = ["aria-checked", "aria-disabled"];
  10956. const _hoisted_2$p = ["name", "tabindex", "disabled", "true-value", "false-value"];
  10957. const _hoisted_3$g = ["name", "tabindex", "disabled", "value"];
  10958. function _sfc_render$r(_ctx, _cache, $props, $setup, $data, $options) {
  10959. return openBlock(), createElementBlock("label", {
  10960. class: normalizeClass([
  10961. _ctx.ns.b("button"),
  10962. _ctx.ns.bm("button", _ctx.size),
  10963. _ctx.ns.is("disabled", _ctx.isDisabled),
  10964. _ctx.ns.is("checked", _ctx.isChecked),
  10965. _ctx.ns.is("focus", _ctx.focus)
  10966. ]),
  10967. role: "checkbox",
  10968. "aria-checked": _ctx.isChecked,
  10969. "aria-disabled": _ctx.isDisabled
  10970. }, [
  10971. _ctx.trueLabel || _ctx.falseLabel ? withDirectives((openBlock(), createElementBlock("input", {
  10972. key: 0,
  10973. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model = $event),
  10974. class: normalizeClass(_ctx.ns.be("button", "original")),
  10975. type: "checkbox",
  10976. name: _ctx.name,
  10977. tabindex: _ctx.tabindex,
  10978. disabled: _ctx.isDisabled,
  10979. "true-value": _ctx.trueLabel,
  10980. "false-value": _ctx.falseLabel,
  10981. onChange: _cache[1] || (_cache[1] = (...args) => _ctx.handleChange && _ctx.handleChange(...args)),
  10982. onFocus: _cache[2] || (_cache[2] = ($event) => _ctx.focus = true),
  10983. onBlur: _cache[3] || (_cache[3] = ($event) => _ctx.focus = false)
  10984. }, null, 42, _hoisted_2$p)), [
  10985. [vModelCheckbox, _ctx.model]
  10986. ]) : withDirectives((openBlock(), createElementBlock("input", {
  10987. key: 1,
  10988. "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => _ctx.model = $event),
  10989. class: normalizeClass(_ctx.ns.be("button", "original")),
  10990. type: "checkbox",
  10991. name: _ctx.name,
  10992. tabindex: _ctx.tabindex,
  10993. disabled: _ctx.isDisabled,
  10994. value: _ctx.label,
  10995. onChange: _cache[5] || (_cache[5] = (...args) => _ctx.handleChange && _ctx.handleChange(...args)),
  10996. onFocus: _cache[6] || (_cache[6] = ($event) => _ctx.focus = true),
  10997. onBlur: _cache[7] || (_cache[7] = ($event) => _ctx.focus = false)
  10998. }, null, 42, _hoisted_3$g)), [
  10999. [vModelCheckbox, _ctx.model]
  11000. ]),
  11001. _ctx.$slots.default || _ctx.label ? (openBlock(), createElementBlock("span", {
  11002. key: 2,
  11003. class: normalizeClass(_ctx.ns.be("button", "inner")),
  11004. style: normalizeStyle(_ctx.isChecked ? _ctx.activeStyle : null)
  11005. }, [
  11006. renderSlot(_ctx.$slots, "default", {}, () => [
  11007. createTextVNode(toDisplayString(_ctx.label), 1)
  11008. ])
  11009. ], 6)) : createCommentVNode("v-if", true)
  11010. ], 10, _hoisted_1$w);
  11011. }
  11012. var CheckboxButton = /* @__PURE__ */ _export_sfc$1(_sfc_main$O, [["render", _sfc_render$r], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/checkbox/src/checkbox-button.vue"]]);
  11013. const _sfc_main$N = defineComponent({
  11014. name: "ElCheckboxGroup",
  11015. props: {
  11016. modelValue: {
  11017. type: Array,
  11018. default: () => []
  11019. },
  11020. disabled: Boolean,
  11021. min: {
  11022. type: Number,
  11023. default: void 0
  11024. },
  11025. max: {
  11026. type: Number,
  11027. default: void 0
  11028. },
  11029. size: {
  11030. type: String,
  11031. validator: isValidComponentSize
  11032. },
  11033. fill: {
  11034. type: String,
  11035. default: void 0
  11036. },
  11037. textColor: {
  11038. type: String,
  11039. default: void 0
  11040. },
  11041. tag: {
  11042. type: String,
  11043. default: "div"
  11044. }
  11045. },
  11046. emits: [UPDATE_MODEL_EVENT, "change"],
  11047. setup(props, { emit, slots }) {
  11048. const { elFormItem: elFormItem2 } = useCheckboxGroup();
  11049. const checkboxGroupSize = useSize();
  11050. const ns = useNamespace("checkbox");
  11051. const changeEvent = (value) => {
  11052. emit(UPDATE_MODEL_EVENT, value);
  11053. nextTick(() => {
  11054. emit("change", value);
  11055. });
  11056. };
  11057. const modelValue = computed({
  11058. get() {
  11059. return props.modelValue;
  11060. },
  11061. set(val) {
  11062. changeEvent(val);
  11063. }
  11064. });
  11065. provide("CheckboxGroup", __spreadProps(__spreadValues({
  11066. name: "ElCheckboxGroup",
  11067. modelValue
  11068. }, toRefs(props)), {
  11069. checkboxGroupSize,
  11070. changeEvent
  11071. }));
  11072. watch(() => props.modelValue, () => {
  11073. var _a2;
  11074. (_a2 = elFormItem2.validate) == null ? void 0 : _a2.call(elFormItem2, "change").catch((err) => debugWarn());
  11075. });
  11076. return () => {
  11077. return h$1(props.tag, {
  11078. class: ns.b("group"),
  11079. role: "group",
  11080. "aria-label": "checkbox-group"
  11081. }, [renderSlot(slots, "default")]);
  11082. };
  11083. }
  11084. });
  11085. var CheckboxGroup = /* @__PURE__ */ _export_sfc$1(_sfc_main$N, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/checkbox/src/checkbox-group.vue"]]);
  11086. const ElCheckbox = withInstall(Checkbox, {
  11087. CheckboxButton,
  11088. CheckboxGroup
  11089. });
  11090. withNoopInstall(CheckboxButton);
  11091. const ElCheckboxGroup$1 = withNoopInstall(CheckboxGroup);
  11092. const radioPropsBase = buildProps({
  11093. size: useSizeProp,
  11094. disabled: Boolean,
  11095. label: {
  11096. type: [String, Number, Boolean],
  11097. default: ""
  11098. }
  11099. });
  11100. const radioProps = buildProps(__spreadProps(__spreadValues({}, radioPropsBase), {
  11101. modelValue: {
  11102. type: [String, Number, Boolean],
  11103. default: ""
  11104. },
  11105. name: {
  11106. type: String,
  11107. default: ""
  11108. },
  11109. border: Boolean
  11110. }));
  11111. const radioEmits = {
  11112. [UPDATE_MODEL_EVENT]: (val) => isString(val) || isNumber(val) || isBoolean(val),
  11113. change: (val) => isString(val) || isNumber(val) || isBoolean(val)
  11114. };
  11115. const useRadio = (props, emit) => {
  11116. const radioRef = ref();
  11117. const radioGroup = inject(radioGroupKey, void 0);
  11118. const isGroup = computed(() => !!radioGroup);
  11119. const modelValue = computed({
  11120. get() {
  11121. return isGroup.value ? radioGroup.modelValue : props.modelValue;
  11122. },
  11123. set(val) {
  11124. if (isGroup.value) {
  11125. radioGroup.changeEvent(val);
  11126. } else {
  11127. emit(UPDATE_MODEL_EVENT, val);
  11128. }
  11129. radioRef.value.checked = props.modelValue === props.label;
  11130. }
  11131. });
  11132. const size = useSize(computed(() => radioGroup == null ? void 0 : radioGroup.size));
  11133. const disabled = useDisabled$1(computed(() => radioGroup == null ? void 0 : radioGroup.disabled));
  11134. const focus = ref(false);
  11135. const tabIndex = computed(() => {
  11136. return disabled.value || isGroup.value && modelValue.value !== props.label ? -1 : 0;
  11137. });
  11138. return {
  11139. radioRef,
  11140. isGroup,
  11141. radioGroup,
  11142. focus,
  11143. size,
  11144. disabled,
  11145. tabIndex,
  11146. modelValue
  11147. };
  11148. };
  11149. const _sfc_main$M = defineComponent({
  11150. name: "ElRadio",
  11151. props: radioProps,
  11152. emits: radioEmits,
  11153. setup(props, { emit }) {
  11154. const ns = useNamespace("radio");
  11155. const { radioRef, isGroup, focus, size, disabled, tabIndex, modelValue } = useRadio(props, emit);
  11156. function handleChange2() {
  11157. nextTick(() => emit("change", modelValue.value));
  11158. }
  11159. return {
  11160. ns,
  11161. focus,
  11162. isGroup,
  11163. modelValue,
  11164. tabIndex,
  11165. size,
  11166. disabled,
  11167. radioRef,
  11168. handleChange: handleChange2
  11169. };
  11170. }
  11171. });
  11172. const _hoisted_1$v = ["aria-checked", "aria-disabled", "tabindex"];
  11173. const _hoisted_2$o = ["value", "name", "disabled"];
  11174. function _sfc_render$q(_ctx, _cache, $props, $setup, $data, $options) {
  11175. return openBlock(), createElementBlock("label", {
  11176. class: normalizeClass([
  11177. _ctx.ns.b(),
  11178. _ctx.ns.is("disabled", _ctx.disabled),
  11179. _ctx.ns.is("focus", _ctx.focus),
  11180. _ctx.ns.is("bordered", _ctx.border),
  11181. _ctx.ns.is("checked", _ctx.modelValue === _ctx.label),
  11182. _ctx.ns.m(_ctx.size)
  11183. ]),
  11184. role: "radio",
  11185. "aria-checked": _ctx.modelValue === _ctx.label,
  11186. "aria-disabled": _ctx.disabled,
  11187. tabindex: _ctx.tabIndex,
  11188. onKeydown: _cache[5] || (_cache[5] = withKeys(withModifiers(($event) => _ctx.modelValue = _ctx.disabled ? _ctx.modelValue : _ctx.label, ["stop", "prevent"]), ["space"]))
  11189. }, [
  11190. createElementVNode("span", {
  11191. class: normalizeClass([
  11192. _ctx.ns.e("input"),
  11193. _ctx.ns.is("disabled", _ctx.disabled),
  11194. _ctx.ns.is("checked", _ctx.modelValue === _ctx.label)
  11195. ])
  11196. }, [
  11197. createElementVNode("span", {
  11198. class: normalizeClass(_ctx.ns.e("inner"))
  11199. }, null, 2),
  11200. withDirectives(createElementVNode("input", {
  11201. ref: "radioRef",
  11202. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.modelValue = $event),
  11203. class: normalizeClass(_ctx.ns.e("original")),
  11204. value: _ctx.label,
  11205. type: "radio",
  11206. "aria-hidden": "true",
  11207. name: _ctx.name,
  11208. disabled: _ctx.disabled,
  11209. tabindex: "-1",
  11210. onFocus: _cache[1] || (_cache[1] = ($event) => _ctx.focus = true),
  11211. onBlur: _cache[2] || (_cache[2] = ($event) => _ctx.focus = false),
  11212. onChange: _cache[3] || (_cache[3] = (...args) => _ctx.handleChange && _ctx.handleChange(...args))
  11213. }, null, 42, _hoisted_2$o), [
  11214. [vModelRadio, _ctx.modelValue]
  11215. ])
  11216. ], 2),
  11217. createElementVNode("span", {
  11218. class: normalizeClass(_ctx.ns.e("label")),
  11219. onKeydown: _cache[4] || (_cache[4] = withModifiers(() => {
  11220. }, ["stop"]))
  11221. }, [
  11222. renderSlot(_ctx.$slots, "default", {}, () => [
  11223. createTextVNode(toDisplayString(_ctx.label), 1)
  11224. ])
  11225. ], 34)
  11226. ], 42, _hoisted_1$v);
  11227. }
  11228. var Radio = /* @__PURE__ */ _export_sfc$1(_sfc_main$M, [["render", _sfc_render$q], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/radio/src/radio.vue"]]);
  11229. const radioButtonProps = buildProps(__spreadProps(__spreadValues({}, radioPropsBase), {
  11230. name: {
  11231. type: String,
  11232. default: ""
  11233. }
  11234. }));
  11235. const _sfc_main$L = defineComponent({
  11236. name: "ElRadioButton",
  11237. props: radioButtonProps,
  11238. setup(props, { emit }) {
  11239. const ns = useNamespace("radio");
  11240. const {
  11241. radioRef,
  11242. isGroup,
  11243. focus,
  11244. size,
  11245. disabled,
  11246. tabIndex,
  11247. modelValue,
  11248. radioGroup
  11249. } = useRadio(props, emit);
  11250. const activeStyle = computed(() => {
  11251. return {
  11252. backgroundColor: (radioGroup == null ? void 0 : radioGroup.fill) || "",
  11253. borderColor: (radioGroup == null ? void 0 : radioGroup.fill) || "",
  11254. boxShadow: (radioGroup == null ? void 0 : radioGroup.fill) ? `-1px 0 0 0 ${radioGroup.fill}` : "",
  11255. color: (radioGroup == null ? void 0 : radioGroup.textColor) || ""
  11256. };
  11257. });
  11258. return {
  11259. ns,
  11260. isGroup,
  11261. size,
  11262. disabled,
  11263. tabIndex,
  11264. modelValue,
  11265. focus,
  11266. activeStyle,
  11267. radioRef
  11268. };
  11269. }
  11270. });
  11271. const _hoisted_1$u = ["aria-checked", "aria-disabled", "tabindex"];
  11272. const _hoisted_2$n = ["value", "name", "disabled"];
  11273. function _sfc_render$p(_ctx, _cache, $props, $setup, $data, $options) {
  11274. return openBlock(), createElementBlock("label", {
  11275. class: normalizeClass([
  11276. _ctx.ns.b("button"),
  11277. _ctx.ns.is("active", _ctx.modelValue === _ctx.label),
  11278. _ctx.ns.is("disabled", _ctx.disabled),
  11279. _ctx.ns.is("focus", _ctx.focus),
  11280. _ctx.ns.bm("button", _ctx.size)
  11281. ]),
  11282. role: "radio",
  11283. "aria-checked": _ctx.modelValue === _ctx.label,
  11284. "aria-disabled": _ctx.disabled,
  11285. tabindex: _ctx.tabIndex,
  11286. onKeydown: _cache[4] || (_cache[4] = withKeys(withModifiers(($event) => _ctx.modelValue = _ctx.disabled ? _ctx.modelValue : _ctx.label, ["stop", "prevent"]), ["space"]))
  11287. }, [
  11288. withDirectives(createElementVNode("input", {
  11289. ref: "radioRef",
  11290. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.modelValue = $event),
  11291. class: normalizeClass(_ctx.ns.be("button", "original-radio")),
  11292. value: _ctx.label,
  11293. type: "radio",
  11294. name: _ctx.name,
  11295. disabled: _ctx.disabled,
  11296. tabindex: "-1",
  11297. onFocus: _cache[1] || (_cache[1] = ($event) => _ctx.focus = true),
  11298. onBlur: _cache[2] || (_cache[2] = ($event) => _ctx.focus = false)
  11299. }, null, 42, _hoisted_2$n), [
  11300. [vModelRadio, _ctx.modelValue]
  11301. ]),
  11302. createElementVNode("span", {
  11303. class: normalizeClass(_ctx.ns.be("button", "inner")),
  11304. style: normalizeStyle(_ctx.modelValue === _ctx.label ? _ctx.activeStyle : {}),
  11305. onKeydown: _cache[3] || (_cache[3] = withModifiers(() => {
  11306. }, ["stop"]))
  11307. }, [
  11308. renderSlot(_ctx.$slots, "default", {}, () => [
  11309. createTextVNode(toDisplayString(_ctx.label), 1)
  11310. ])
  11311. ], 38)
  11312. ], 42, _hoisted_1$u);
  11313. }
  11314. var RadioButton = /* @__PURE__ */ _export_sfc$1(_sfc_main$L, [["render", _sfc_render$p], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/radio/src/radio-button.vue"]]);
  11315. const radioGroupProps = buildProps({
  11316. size: useSizeProp,
  11317. disabled: Boolean,
  11318. modelValue: {
  11319. type: [String, Number, Boolean],
  11320. default: ""
  11321. },
  11322. fill: {
  11323. type: String,
  11324. default: ""
  11325. },
  11326. textColor: {
  11327. type: String,
  11328. default: ""
  11329. }
  11330. });
  11331. const radioGroupEmits = radioEmits;
  11332. const _sfc_main$K = defineComponent({
  11333. name: "ElRadioGroup",
  11334. props: radioGroupProps,
  11335. emits: radioGroupEmits,
  11336. setup(props, ctx) {
  11337. const ns = useNamespace("radio");
  11338. const radioGroupRef = ref();
  11339. const { formItem } = useFormItem();
  11340. const changeEvent = (value) => {
  11341. ctx.emit(UPDATE_MODEL_EVENT, value);
  11342. nextTick(() => ctx.emit("change", value));
  11343. };
  11344. const handleKeydown = (e) => {
  11345. if (!radioGroupRef.value)
  11346. return;
  11347. const target = e.target;
  11348. const className = target.nodeName === "INPUT" ? "[type=radio]" : "[role=radio]";
  11349. const radios = radioGroupRef.value.querySelectorAll(className);
  11350. const length = radios.length;
  11351. const index = Array.from(radios).indexOf(target);
  11352. const roleRadios = radioGroupRef.value.querySelectorAll("[role=radio]");
  11353. let nextIndex = null;
  11354. switch (e.code) {
  11355. case EVENT_CODE.left:
  11356. case EVENT_CODE.up:
  11357. e.stopPropagation();
  11358. e.preventDefault();
  11359. nextIndex = index === 0 ? length - 1 : index - 1;
  11360. break;
  11361. case EVENT_CODE.right:
  11362. case EVENT_CODE.down:
  11363. e.stopPropagation();
  11364. e.preventDefault();
  11365. nextIndex = index === length - 1 ? 0 : index + 1;
  11366. break;
  11367. }
  11368. if (nextIndex === null)
  11369. return;
  11370. roleRadios[nextIndex].click();
  11371. roleRadios[nextIndex].focus();
  11372. };
  11373. onMounted(() => {
  11374. const radios = radioGroupRef.value.querySelectorAll("[type=radio]");
  11375. const firstLabel = radios[0];
  11376. if (!Array.from(radios).some((radio) => radio.checked) && firstLabel) {
  11377. firstLabel.tabIndex = 0;
  11378. }
  11379. });
  11380. provide(radioGroupKey, reactive(__spreadProps(__spreadValues({}, toRefs(props)), {
  11381. changeEvent
  11382. })));
  11383. watch(() => props.modelValue, () => formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn()));
  11384. return {
  11385. ns,
  11386. radioGroupRef,
  11387. handleKeydown
  11388. };
  11389. }
  11390. });
  11391. function _sfc_render$o(_ctx, _cache, $props, $setup, $data, $options) {
  11392. return openBlock(), createElementBlock("div", {
  11393. ref: "radioGroupRef",
  11394. class: normalizeClass(_ctx.ns.b("group")),
  11395. role: "radiogroup",
  11396. onKeydown: _cache[0] || (_cache[0] = (...args) => _ctx.handleKeydown && _ctx.handleKeydown(...args))
  11397. }, [
  11398. renderSlot(_ctx.$slots, "default")
  11399. ], 34);
  11400. }
  11401. var RadioGroup = /* @__PURE__ */ _export_sfc$1(_sfc_main$K, [["render", _sfc_render$o], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/radio/src/radio-group.vue"]]);
  11402. const ElRadio = withInstall(Radio, {
  11403. RadioButton,
  11404. RadioGroup
  11405. });
  11406. const ElRadioGroup = withNoopInstall(RadioGroup);
  11407. const ElRadioButton = withNoopInstall(RadioButton);
  11408. var NodeContent = defineComponent({
  11409. name: "NodeContent",
  11410. setup() {
  11411. const ns = useNamespace("cascader-node");
  11412. return {
  11413. ns
  11414. };
  11415. },
  11416. render() {
  11417. const { ns } = this;
  11418. const { node, panel } = this.$parent;
  11419. const { data: data2, label } = node;
  11420. const { renderLabelFn } = panel;
  11421. return h$1("span", { class: ns.e("label") }, renderLabelFn ? renderLabelFn({ node, data: data2 }) : label);
  11422. }
  11423. });
  11424. const CASCADER_PANEL_INJECTION_KEY = Symbol();
  11425. const _sfc_main$J = defineComponent({
  11426. name: "ElCascaderNode",
  11427. components: {
  11428. ElCheckbox,
  11429. ElRadio,
  11430. NodeContent,
  11431. ElIcon,
  11432. Check: check,
  11433. Loading: loading,
  11434. ArrowRight: arrowRight
  11435. },
  11436. props: {
  11437. node: {
  11438. type: Object,
  11439. required: true
  11440. },
  11441. menuId: String
  11442. },
  11443. emits: ["expand"],
  11444. setup(props, { emit }) {
  11445. const panel = inject(CASCADER_PANEL_INJECTION_KEY);
  11446. const ns = useNamespace("cascader-node");
  11447. const isHoverMenu = computed(() => panel.isHoverMenu);
  11448. const multiple = computed(() => panel.config.multiple);
  11449. const checkStrictly = computed(() => panel.config.checkStrictly);
  11450. const checkedNodeId = computed(() => {
  11451. var _a2;
  11452. return (_a2 = panel.checkedNodes[0]) == null ? void 0 : _a2.uid;
  11453. });
  11454. const isDisabled = computed(() => props.node.isDisabled);
  11455. const isLeaf2 = computed(() => props.node.isLeaf);
  11456. const expandable = computed(() => checkStrictly.value && !isLeaf2.value || !isDisabled.value);
  11457. const inExpandingPath = computed(() => isInPath(panel.expandingNode));
  11458. const inCheckedPath = computed(() => checkStrictly.value && panel.checkedNodes.some(isInPath));
  11459. const isInPath = (node) => {
  11460. var _a2;
  11461. const { level, uid: uid2 } = props.node;
  11462. return ((_a2 = node == null ? void 0 : node.pathNodes[level - 1]) == null ? void 0 : _a2.uid) === uid2;
  11463. };
  11464. const doExpand = () => {
  11465. if (inExpandingPath.value)
  11466. return;
  11467. panel.expandNode(props.node);
  11468. };
  11469. const doCheck = (checked) => {
  11470. const { node } = props;
  11471. if (checked === node.checked)
  11472. return;
  11473. panel.handleCheckChange(node, checked);
  11474. };
  11475. const doLoad = () => {
  11476. panel.lazyLoad(props.node, () => {
  11477. if (!isLeaf2.value)
  11478. doExpand();
  11479. });
  11480. };
  11481. const handleHoverExpand = (e) => {
  11482. if (!isHoverMenu.value)
  11483. return;
  11484. handleExpand();
  11485. !isLeaf2.value && emit("expand", e);
  11486. };
  11487. const handleExpand = () => {
  11488. const { node } = props;
  11489. if (!expandable.value || node.loading)
  11490. return;
  11491. node.loaded ? doExpand() : doLoad();
  11492. };
  11493. const handleClick = () => {
  11494. if (isHoverMenu.value && !isLeaf2.value)
  11495. return;
  11496. if (isLeaf2.value && !isDisabled.value && !checkStrictly.value && !multiple.value) {
  11497. handleCheck(true);
  11498. } else {
  11499. handleExpand();
  11500. }
  11501. };
  11502. const handleSelectCheck = (checked) => {
  11503. if (checkStrictly.value) {
  11504. doCheck(checked);
  11505. if (props.node.loaded) {
  11506. doExpand();
  11507. }
  11508. } else {
  11509. handleCheck(checked);
  11510. }
  11511. };
  11512. const handleCheck = (checked) => {
  11513. if (!props.node.loaded) {
  11514. doLoad();
  11515. } else {
  11516. doCheck(checked);
  11517. !checkStrictly.value && doExpand();
  11518. }
  11519. };
  11520. return {
  11521. panel,
  11522. isHoverMenu,
  11523. multiple,
  11524. checkStrictly,
  11525. checkedNodeId,
  11526. isDisabled,
  11527. isLeaf: isLeaf2,
  11528. expandable,
  11529. inExpandingPath,
  11530. inCheckedPath,
  11531. ns,
  11532. handleHoverExpand,
  11533. handleExpand,
  11534. handleClick,
  11535. handleCheck,
  11536. handleSelectCheck
  11537. };
  11538. }
  11539. });
  11540. const _hoisted_1$t = ["id", "aria-haspopup", "aria-owns", "aria-expanded", "tabindex"];
  11541. const _hoisted_2$m = /* @__PURE__ */ createElementVNode("span", null, null, -1);
  11542. function _sfc_render$n(_ctx, _cache, $props, $setup, $data, $options) {
  11543. const _component_el_checkbox = resolveComponent("el-checkbox");
  11544. const _component_el_radio = resolveComponent("el-radio");
  11545. const _component_check = resolveComponent("check");
  11546. const _component_el_icon = resolveComponent("el-icon");
  11547. const _component_node_content = resolveComponent("node-content");
  11548. const _component_loading = resolveComponent("loading");
  11549. const _component_arrow_right = resolveComponent("arrow-right");
  11550. return openBlock(), createElementBlock("li", {
  11551. id: `${_ctx.menuId}-${_ctx.node.uid}`,
  11552. role: "menuitem",
  11553. "aria-haspopup": !_ctx.isLeaf,
  11554. "aria-owns": _ctx.isLeaf ? null : _ctx.menuId,
  11555. "aria-expanded": _ctx.inExpandingPath,
  11556. tabindex: _ctx.expandable ? -1 : void 0,
  11557. class: normalizeClass([
  11558. _ctx.ns.b(),
  11559. _ctx.ns.is("selectable", _ctx.checkStrictly),
  11560. _ctx.ns.is("active", _ctx.node.checked),
  11561. _ctx.ns.is("disabled", !_ctx.expandable),
  11562. _ctx.inExpandingPath && "in-active-path",
  11563. _ctx.inCheckedPath && "in-checked-path"
  11564. ]),
  11565. onMouseenter: _cache[2] || (_cache[2] = (...args) => _ctx.handleHoverExpand && _ctx.handleHoverExpand(...args)),
  11566. onFocus: _cache[3] || (_cache[3] = (...args) => _ctx.handleHoverExpand && _ctx.handleHoverExpand(...args)),
  11567. onClick: _cache[4] || (_cache[4] = (...args) => _ctx.handleClick && _ctx.handleClick(...args))
  11568. }, [
  11569. createCommentVNode(" prefix "),
  11570. _ctx.multiple ? (openBlock(), createBlock(_component_el_checkbox, {
  11571. key: 0,
  11572. "model-value": _ctx.node.checked,
  11573. indeterminate: _ctx.node.indeterminate,
  11574. disabled: _ctx.isDisabled,
  11575. onClick: _cache[0] || (_cache[0] = withModifiers(() => {
  11576. }, ["stop"])),
  11577. "onUpdate:modelValue": _ctx.handleSelectCheck
  11578. }, null, 8, ["model-value", "indeterminate", "disabled", "onUpdate:modelValue"])) : _ctx.checkStrictly ? (openBlock(), createBlock(_component_el_radio, {
  11579. key: 1,
  11580. "model-value": _ctx.checkedNodeId,
  11581. label: _ctx.node.uid,
  11582. disabled: _ctx.isDisabled,
  11583. "onUpdate:modelValue": _ctx.handleSelectCheck,
  11584. onClick: _cache[1] || (_cache[1] = withModifiers(() => {
  11585. }, ["stop"]))
  11586. }, {
  11587. default: withCtx(() => [
  11588. createCommentVNode("\n Add an empty element to avoid render label,\n do not use empty fragment here for https://github.com/vuejs/vue-next/pull/2485\n "),
  11589. _hoisted_2$m
  11590. ]),
  11591. _: 1
  11592. }, 8, ["model-value", "label", "disabled", "onUpdate:modelValue"])) : _ctx.isLeaf && _ctx.node.checked ? (openBlock(), createBlock(_component_el_icon, {
  11593. key: 2,
  11594. class: normalizeClass(_ctx.ns.e("prefix"))
  11595. }, {
  11596. default: withCtx(() => [
  11597. createVNode(_component_check)
  11598. ]),
  11599. _: 1
  11600. }, 8, ["class"])) : createCommentVNode("v-if", true),
  11601. createCommentVNode(" content "),
  11602. createVNode(_component_node_content),
  11603. createCommentVNode(" postfix "),
  11604. !_ctx.isLeaf ? (openBlock(), createElementBlock(Fragment, { key: 3 }, [
  11605. _ctx.node.loading ? (openBlock(), createBlock(_component_el_icon, {
  11606. key: 0,
  11607. class: normalizeClass([_ctx.ns.is("loading"), _ctx.ns.e("postfix")])
  11608. }, {
  11609. default: withCtx(() => [
  11610. createVNode(_component_loading)
  11611. ]),
  11612. _: 1
  11613. }, 8, ["class"])) : (openBlock(), createBlock(_component_el_icon, {
  11614. key: 1,
  11615. class: normalizeClass(["arrow-right", _ctx.ns.e("postfix")])
  11616. }, {
  11617. default: withCtx(() => [
  11618. createVNode(_component_arrow_right)
  11619. ]),
  11620. _: 1
  11621. }, 8, ["class"]))
  11622. ], 2112)) : createCommentVNode("v-if", true)
  11623. ], 42, _hoisted_1$t);
  11624. }
  11625. var ElCascaderNode = /* @__PURE__ */ _export_sfc$1(_sfc_main$J, [["render", _sfc_render$n], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/cascader-panel/src/node.vue"]]);
  11626. const _sfc_main$I = defineComponent({
  11627. name: "ElCascaderMenu",
  11628. components: {
  11629. Loading: loading,
  11630. ElIcon,
  11631. ElScrollbar,
  11632. ElCascaderNode
  11633. },
  11634. props: {
  11635. nodes: {
  11636. type: Array,
  11637. required: true
  11638. },
  11639. index: {
  11640. type: Number,
  11641. required: true
  11642. }
  11643. },
  11644. setup(props) {
  11645. const instance = getCurrentInstance();
  11646. const ns = useNamespace("cascader-menu");
  11647. const { t } = useLocale();
  11648. const id = generateId();
  11649. let activeNode = null;
  11650. let hoverTimer = null;
  11651. const panel = inject(CASCADER_PANEL_INJECTION_KEY);
  11652. const hoverZone = ref(null);
  11653. const isEmpty3 = computed(() => !props.nodes.length);
  11654. const isLoading = computed(() => !panel.initialLoaded);
  11655. const menuId = computed(() => `cascader-menu-${id}-${props.index}`);
  11656. const handleExpand = (e) => {
  11657. activeNode = e.target;
  11658. };
  11659. const handleMouseMove = (e) => {
  11660. if (!panel.isHoverMenu || !activeNode || !hoverZone.value)
  11661. return;
  11662. if (activeNode.contains(e.target)) {
  11663. clearHoverTimer();
  11664. const el = instance.vnode.el;
  11665. const { left: left2 } = el.getBoundingClientRect();
  11666. const { offsetWidth, offsetHeight } = el;
  11667. const startX = e.clientX - left2;
  11668. const top2 = activeNode.offsetTop;
  11669. const bottom2 = top2 + activeNode.offsetHeight;
  11670. hoverZone.value.innerHTML = `
  11671. <path style="pointer-events: auto;" fill="transparent" d="M${startX} ${top2} L${offsetWidth} 0 V${top2} Z" />
  11672. <path style="pointer-events: auto;" fill="transparent" d="M${startX} ${bottom2} L${offsetWidth} ${offsetHeight} V${bottom2} Z" />
  11673. `;
  11674. } else if (!hoverTimer) {
  11675. hoverTimer = window.setTimeout(clearHoverZone, panel.config.hoverThreshold);
  11676. }
  11677. };
  11678. const clearHoverTimer = () => {
  11679. if (!hoverTimer)
  11680. return;
  11681. clearTimeout(hoverTimer);
  11682. hoverTimer = null;
  11683. };
  11684. const clearHoverZone = () => {
  11685. if (!hoverZone.value)
  11686. return;
  11687. hoverZone.value.innerHTML = "";
  11688. clearHoverTimer();
  11689. };
  11690. return {
  11691. ns,
  11692. panel,
  11693. hoverZone,
  11694. isEmpty: isEmpty3,
  11695. isLoading,
  11696. menuId,
  11697. t,
  11698. handleExpand,
  11699. handleMouseMove,
  11700. clearHoverZone
  11701. };
  11702. }
  11703. });
  11704. function _sfc_render$m(_ctx, _cache, $props, $setup, $data, $options) {
  11705. const _component_el_cascader_node = resolveComponent("el-cascader-node");
  11706. const _component_loading = resolveComponent("loading");
  11707. const _component_el_icon = resolveComponent("el-icon");
  11708. const _component_el_scrollbar = resolveComponent("el-scrollbar");
  11709. return openBlock(), createBlock(_component_el_scrollbar, {
  11710. key: _ctx.menuId,
  11711. tag: "ul",
  11712. role: "menu",
  11713. class: normalizeClass(_ctx.ns.b()),
  11714. "wrap-class": _ctx.ns.e("wrap"),
  11715. "view-class": [_ctx.ns.e("list"), _ctx.ns.is("empty", _ctx.isEmpty)],
  11716. onMousemove: _ctx.handleMouseMove,
  11717. onMouseleave: _ctx.clearHoverZone
  11718. }, {
  11719. default: withCtx(() => {
  11720. var _a2;
  11721. return [
  11722. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.nodes, (node) => {
  11723. return openBlock(), createBlock(_component_el_cascader_node, {
  11724. key: node.uid,
  11725. node,
  11726. "menu-id": _ctx.menuId,
  11727. onExpand: _ctx.handleExpand
  11728. }, null, 8, ["node", "menu-id", "onExpand"]);
  11729. }), 128)),
  11730. _ctx.isLoading ? (openBlock(), createElementBlock("div", {
  11731. key: 0,
  11732. class: normalizeClass(_ctx.ns.e("empty-text"))
  11733. }, [
  11734. createVNode(_component_el_icon, {
  11735. size: "14",
  11736. class: normalizeClass(_ctx.ns.is("loading"))
  11737. }, {
  11738. default: withCtx(() => [
  11739. createVNode(_component_loading)
  11740. ]),
  11741. _: 1
  11742. }, 8, ["class"]),
  11743. createTextVNode(" " + toDisplayString(_ctx.t("el.cascader.loading")), 1)
  11744. ], 2)) : _ctx.isEmpty ? (openBlock(), createElementBlock("div", {
  11745. key: 1,
  11746. class: normalizeClass(_ctx.ns.e("empty-text"))
  11747. }, toDisplayString(_ctx.t("el.cascader.noData")), 3)) : ((_a2 = _ctx.panel) == null ? void 0 : _a2.isHoverMenu) ? (openBlock(), createElementBlock("svg", {
  11748. key: 2,
  11749. ref: "hoverZone",
  11750. class: normalizeClass(_ctx.ns.e("hover-zone"))
  11751. }, null, 2)) : createCommentVNode("v-if", true)
  11752. ];
  11753. }),
  11754. _: 1
  11755. }, 8, ["class", "wrap-class", "view-class", "onMousemove", "onMouseleave"]);
  11756. }
  11757. var ElCascaderMenu = /* @__PURE__ */ _export_sfc$1(_sfc_main$I, [["render", _sfc_render$m], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/cascader-panel/src/menu.vue"]]);
  11758. var ExpandTrigger = /* @__PURE__ */ ((ExpandTrigger2) => {
  11759. ExpandTrigger2["CLICK"] = "click";
  11760. ExpandTrigger2["HOVER"] = "hover";
  11761. return ExpandTrigger2;
  11762. })(ExpandTrigger || {});
  11763. let uid = 0;
  11764. const calculatePathNodes = (node) => {
  11765. const nodes = [node];
  11766. let { parent } = node;
  11767. while (parent) {
  11768. nodes.unshift(parent);
  11769. parent = parent.parent;
  11770. }
  11771. return nodes;
  11772. };
  11773. class Node {
  11774. constructor(data2, config, parent, root2 = false) {
  11775. this.data = data2;
  11776. this.config = config;
  11777. this.parent = parent;
  11778. this.root = root2;
  11779. this.uid = uid++;
  11780. this.checked = false;
  11781. this.indeterminate = false;
  11782. this.loading = false;
  11783. const { value: valueKey, label: labelKey, children: childrenKey } = config;
  11784. const childrenData = data2[childrenKey];
  11785. const pathNodes = calculatePathNodes(this);
  11786. this.level = root2 ? 0 : parent ? parent.level + 1 : 1;
  11787. this.value = data2[valueKey];
  11788. this.label = data2[labelKey];
  11789. this.pathNodes = pathNodes;
  11790. this.pathValues = pathNodes.map((node) => node.value);
  11791. this.pathLabels = pathNodes.map((node) => node.label);
  11792. this.childrenData = childrenData;
  11793. this.children = (childrenData || []).map((child) => new Node(child, config, this));
  11794. this.loaded = !config.lazy || this.isLeaf || !isEmpty(childrenData);
  11795. }
  11796. get isDisabled() {
  11797. const { data: data2, parent, config } = this;
  11798. const { disabled, checkStrictly } = config;
  11799. const isDisabled = isFunction(disabled) ? disabled(data2, this) : !!data2[disabled];
  11800. return isDisabled || !checkStrictly && (parent == null ? void 0 : parent.isDisabled);
  11801. }
  11802. get isLeaf() {
  11803. const { data: data2, config, childrenData, loaded } = this;
  11804. const { lazy, leaf } = config;
  11805. const isLeaf2 = isFunction(leaf) ? leaf(data2, this) : data2[leaf];
  11806. return isUndefined(isLeaf2) ? lazy && !loaded ? false : !(Array.isArray(childrenData) && childrenData.length) : !!isLeaf2;
  11807. }
  11808. get valueByOption() {
  11809. return this.config.emitPath ? this.pathValues : this.value;
  11810. }
  11811. appendChild(childData) {
  11812. const { childrenData, children } = this;
  11813. const node = new Node(childData, this.config, this);
  11814. if (Array.isArray(childrenData)) {
  11815. childrenData.push(childData);
  11816. } else {
  11817. this.childrenData = [childData];
  11818. }
  11819. children.push(node);
  11820. return node;
  11821. }
  11822. calcText(allLevels, separator) {
  11823. const text = allLevels ? this.pathLabels.join(separator) : this.label;
  11824. this.text = text;
  11825. return text;
  11826. }
  11827. broadcast(event, ...args) {
  11828. const handlerName = `onParent${capitalize(event)}`;
  11829. this.children.forEach((child) => {
  11830. if (child) {
  11831. child.broadcast(event, ...args);
  11832. child[handlerName] && child[handlerName](...args);
  11833. }
  11834. });
  11835. }
  11836. emit(event, ...args) {
  11837. const { parent } = this;
  11838. const handlerName = `onChild${capitalize(event)}`;
  11839. if (parent) {
  11840. parent[handlerName] && parent[handlerName](...args);
  11841. parent.emit(event, ...args);
  11842. }
  11843. }
  11844. onParentCheck(checked) {
  11845. if (!this.isDisabled) {
  11846. this.setCheckState(checked);
  11847. }
  11848. }
  11849. onChildCheck() {
  11850. const { children } = this;
  11851. const validChildren = children.filter((child) => !child.isDisabled);
  11852. const checked = validChildren.length ? validChildren.every((child) => child.checked) : false;
  11853. this.setCheckState(checked);
  11854. }
  11855. setCheckState(checked) {
  11856. const totalNum = this.children.length;
  11857. const checkedNum = this.children.reduce((c2, p2) => {
  11858. const num = p2.checked ? 1 : p2.indeterminate ? 0.5 : 0;
  11859. return c2 + num;
  11860. }, 0);
  11861. this.checked = this.loaded && this.children.every((child) => child.loaded && child.checked) && checked;
  11862. this.indeterminate = this.loaded && checkedNum !== totalNum && checkedNum > 0;
  11863. }
  11864. doCheck(checked) {
  11865. if (this.checked === checked)
  11866. return;
  11867. const { checkStrictly, multiple } = this.config;
  11868. if (checkStrictly || !multiple) {
  11869. this.checked = checked;
  11870. } else {
  11871. this.broadcast("check", checked);
  11872. this.setCheckState(checked);
  11873. this.emit("check");
  11874. }
  11875. }
  11876. }
  11877. const flatNodes = (nodes, leafOnly) => {
  11878. return nodes.reduce((res, node) => {
  11879. if (node.isLeaf) {
  11880. res.push(node);
  11881. } else {
  11882. !leafOnly && res.push(node);
  11883. res = res.concat(flatNodes(node.children, leafOnly));
  11884. }
  11885. return res;
  11886. }, []);
  11887. };
  11888. class Store {
  11889. constructor(data2, config) {
  11890. this.config = config;
  11891. const nodes = (data2 || []).map((nodeData) => new Node(nodeData, this.config));
  11892. this.nodes = nodes;
  11893. this.allNodes = flatNodes(nodes, false);
  11894. this.leafNodes = flatNodes(nodes, true);
  11895. }
  11896. getNodes() {
  11897. return this.nodes;
  11898. }
  11899. getFlattedNodes(leafOnly) {
  11900. return leafOnly ? this.leafNodes : this.allNodes;
  11901. }
  11902. appendNode(nodeData, parentNode) {
  11903. const node = parentNode ? parentNode.appendChild(nodeData) : new Node(nodeData, this.config);
  11904. if (!parentNode)
  11905. this.nodes.push(node);
  11906. this.allNodes.push(node);
  11907. node.isLeaf && this.leafNodes.push(node);
  11908. }
  11909. appendNodes(nodeDataList, parentNode) {
  11910. nodeDataList.forEach((nodeData) => this.appendNode(nodeData, parentNode));
  11911. }
  11912. getNodeByValue(value, leafOnly = false) {
  11913. if (!value && value !== 0)
  11914. return null;
  11915. const node = this.getFlattedNodes(leafOnly).find((node2) => isEqual(node2.value, value) || isEqual(node2.pathValues, value));
  11916. return node || null;
  11917. }
  11918. getSameNode(node) {
  11919. if (!node)
  11920. return null;
  11921. const node_ = this.getFlattedNodes(false).find(({ value, level }) => isEqual(node.value, value) && node.level === level);
  11922. return node_ || null;
  11923. }
  11924. }
  11925. const CommonProps = {
  11926. modelValue: [Number, String, Array],
  11927. options: {
  11928. type: Array,
  11929. default: () => []
  11930. },
  11931. props: {
  11932. type: Object,
  11933. default: () => ({})
  11934. }
  11935. };
  11936. const DefaultProps = {
  11937. expandTrigger: ExpandTrigger.CLICK,
  11938. multiple: false,
  11939. checkStrictly: false,
  11940. emitPath: true,
  11941. lazy: false,
  11942. lazyLoad: NOOP,
  11943. value: "value",
  11944. label: "label",
  11945. children: "children",
  11946. leaf: "leaf",
  11947. disabled: "disabled",
  11948. hoverThreshold: 500
  11949. };
  11950. const useCascaderConfig = (props) => {
  11951. return computed(() => __spreadValues(__spreadValues({}, DefaultProps), props.props));
  11952. };
  11953. const getMenuIndex = (el) => {
  11954. if (!el)
  11955. return 0;
  11956. const pieces = el.id.split("-");
  11957. return Number(pieces[pieces.length - 2]);
  11958. };
  11959. const checkNode = (el) => {
  11960. if (!el)
  11961. return;
  11962. const input = el.querySelector("input");
  11963. if (input) {
  11964. input.click();
  11965. } else if (isLeaf(el)) {
  11966. el.click();
  11967. }
  11968. };
  11969. const sortByOriginalOrder = (oldNodes, newNodes) => {
  11970. const newNodesCopy = newNodes.slice(0);
  11971. const newIds = newNodesCopy.map((node) => node.uid);
  11972. const res = oldNodes.reduce((acc, item) => {
  11973. const index = newIds.indexOf(item.uid);
  11974. if (index > -1) {
  11975. acc.push(item);
  11976. newNodesCopy.splice(index, 1);
  11977. newIds.splice(index, 1);
  11978. }
  11979. return acc;
  11980. }, []);
  11981. res.push(...newNodesCopy);
  11982. return res;
  11983. };
  11984. const _sfc_main$H = defineComponent({
  11985. name: "ElCascaderPanel",
  11986. components: {
  11987. ElCascaderMenu
  11988. },
  11989. props: __spreadProps(__spreadValues({}, CommonProps), {
  11990. border: {
  11991. type: Boolean,
  11992. default: true
  11993. },
  11994. renderLabel: Function
  11995. }),
  11996. emits: [UPDATE_MODEL_EVENT, CHANGE_EVENT, "close", "expand-change"],
  11997. setup(props, { emit, slots }) {
  11998. let manualChecked = false;
  11999. const ns = useNamespace("cascader");
  12000. const config = useCascaderConfig(props);
  12001. let store = null;
  12002. const initialLoaded = ref(true);
  12003. const menuList = ref([]);
  12004. const checkedValue = ref(null);
  12005. const menus = ref([]);
  12006. const expandingNode = ref(null);
  12007. const checkedNodes = ref([]);
  12008. const isHoverMenu = computed(() => config.value.expandTrigger === ExpandTrigger.HOVER);
  12009. const renderLabelFn = computed(() => props.renderLabel || slots.default);
  12010. const initStore = () => {
  12011. const { options } = props;
  12012. const cfg = config.value;
  12013. manualChecked = false;
  12014. store = new Store(options, cfg);
  12015. menus.value = [store.getNodes()];
  12016. if (cfg.lazy && isEmpty(props.options)) {
  12017. initialLoaded.value = false;
  12018. lazyLoad(void 0, (list) => {
  12019. if (list) {
  12020. store = new Store(list, cfg);
  12021. menus.value = [store.getNodes()];
  12022. }
  12023. initialLoaded.value = true;
  12024. syncCheckedValue(false, true);
  12025. });
  12026. } else {
  12027. syncCheckedValue(false, true);
  12028. }
  12029. };
  12030. const lazyLoad = (node, cb) => {
  12031. const cfg = config.value;
  12032. node = node || new Node({}, cfg, void 0, true);
  12033. node.loading = true;
  12034. const resolve = (dataList) => {
  12035. const _node = node;
  12036. const parent = _node.root ? null : _node;
  12037. dataList && (store == null ? void 0 : store.appendNodes(dataList, parent));
  12038. _node.loading = false;
  12039. _node.loaded = true;
  12040. _node.childrenData = _node.childrenData || [];
  12041. cb && cb(dataList);
  12042. };
  12043. cfg.lazyLoad(node, resolve);
  12044. };
  12045. const expandNode = (node, silent) => {
  12046. var _a2;
  12047. const { level } = node;
  12048. const newMenus = menus.value.slice(0, level);
  12049. let newExpandingNode;
  12050. if (node.isLeaf) {
  12051. newExpandingNode = node.pathNodes[level - 2];
  12052. } else {
  12053. newExpandingNode = node;
  12054. newMenus.push(node.children);
  12055. }
  12056. if (((_a2 = expandingNode.value) == null ? void 0 : _a2.uid) !== (newExpandingNode == null ? void 0 : newExpandingNode.uid)) {
  12057. expandingNode.value = node;
  12058. menus.value = newMenus;
  12059. !silent && emit("expand-change", (node == null ? void 0 : node.pathValues) || []);
  12060. }
  12061. };
  12062. const handleCheckChange = (node, checked, emitClose = true) => {
  12063. const { checkStrictly, multiple } = config.value;
  12064. const oldNode = checkedNodes.value[0];
  12065. manualChecked = true;
  12066. !multiple && (oldNode == null ? void 0 : oldNode.doCheck(false));
  12067. node.doCheck(checked);
  12068. calculateCheckedValue();
  12069. emitClose && !multiple && !checkStrictly && emit("close");
  12070. !emitClose && !multiple && !checkStrictly && expandParentNode(node);
  12071. };
  12072. const expandParentNode = (node) => {
  12073. if (!node)
  12074. return;
  12075. node = node.parent;
  12076. expandParentNode(node);
  12077. node && expandNode(node);
  12078. };
  12079. const getFlattedNodes = (leafOnly) => {
  12080. return store == null ? void 0 : store.getFlattedNodes(leafOnly);
  12081. };
  12082. const getCheckedNodes = (leafOnly) => {
  12083. var _a2;
  12084. return (_a2 = getFlattedNodes(leafOnly)) == null ? void 0 : _a2.filter((node) => node.checked !== false);
  12085. };
  12086. const clearCheckedNodes = () => {
  12087. checkedNodes.value.forEach((node) => node.doCheck(false));
  12088. calculateCheckedValue();
  12089. };
  12090. const calculateCheckedValue = () => {
  12091. var _a2;
  12092. const { checkStrictly, multiple } = config.value;
  12093. const oldNodes = checkedNodes.value;
  12094. const newNodes = getCheckedNodes(!checkStrictly);
  12095. const nodes = sortByOriginalOrder(oldNodes, newNodes);
  12096. const values = nodes.map((node) => node.valueByOption);
  12097. checkedNodes.value = nodes;
  12098. checkedValue.value = multiple ? values : (_a2 = values[0]) != null ? _a2 : null;
  12099. };
  12100. const syncCheckedValue = (loaded = false, forced = false) => {
  12101. const { modelValue } = props;
  12102. const { lazy, multiple, checkStrictly } = config.value;
  12103. const leafOnly = !checkStrictly;
  12104. if (!initialLoaded.value || manualChecked || !forced && isEqual(modelValue, checkedValue.value))
  12105. return;
  12106. if (lazy && !loaded) {
  12107. const values = unique(flattenDeep(castArray(modelValue)));
  12108. const nodes = values.map((val) => store == null ? void 0 : store.getNodeByValue(val)).filter((node) => !!node && !node.loaded && !node.loading);
  12109. if (nodes.length) {
  12110. nodes.forEach((node) => {
  12111. lazyLoad(node, () => syncCheckedValue(false, forced));
  12112. });
  12113. } else {
  12114. syncCheckedValue(true, forced);
  12115. }
  12116. } else {
  12117. const values = multiple ? castArray(modelValue) : [modelValue];
  12118. const nodes = unique(values.map((val) => store == null ? void 0 : store.getNodeByValue(val, leafOnly)));
  12119. syncMenuState(nodes, false);
  12120. checkedValue.value = modelValue;
  12121. }
  12122. };
  12123. const syncMenuState = (newCheckedNodes, reserveExpandingState = true) => {
  12124. const { checkStrictly } = config.value;
  12125. const oldNodes = checkedNodes.value;
  12126. const newNodes = newCheckedNodes.filter((node) => !!node && (checkStrictly || node.isLeaf));
  12127. const oldExpandingNode = store == null ? void 0 : store.getSameNode(expandingNode.value);
  12128. const newExpandingNode = reserveExpandingState && oldExpandingNode || newNodes[0];
  12129. if (newExpandingNode) {
  12130. newExpandingNode.pathNodes.forEach((node) => expandNode(node, true));
  12131. } else {
  12132. expandingNode.value = null;
  12133. }
  12134. oldNodes.forEach((node) => node.doCheck(false));
  12135. newNodes.forEach((node) => node.doCheck(true));
  12136. checkedNodes.value = newNodes;
  12137. nextTick(scrollToExpandingNode);
  12138. };
  12139. const scrollToExpandingNode = () => {
  12140. if (!isClient)
  12141. return;
  12142. menuList.value.forEach((menu) => {
  12143. const menuElement = menu == null ? void 0 : menu.$el;
  12144. if (menuElement) {
  12145. const container = menuElement.querySelector(`.${ns.namespace.value}-scrollbar__wrap`);
  12146. const activeNode = menuElement.querySelector(`.${ns.b("node")}.${ns.is("active")}`) || menuElement.querySelector(`.${ns.b("node")}.in-active-path`);
  12147. scrollIntoView(container, activeNode);
  12148. }
  12149. });
  12150. };
  12151. const handleKeyDown2 = (e) => {
  12152. const target = e.target;
  12153. const { code } = e;
  12154. switch (code) {
  12155. case EVENT_CODE.up:
  12156. case EVENT_CODE.down: {
  12157. e.preventDefault();
  12158. const distance = code === EVENT_CODE.up ? -1 : 1;
  12159. focusNode(getSibling(target, distance, `.${ns.b("node")}[tabindex="-1"]`));
  12160. break;
  12161. }
  12162. case EVENT_CODE.left: {
  12163. e.preventDefault();
  12164. const preMenu = menuList.value[getMenuIndex(target) - 1];
  12165. const expandedNode = preMenu == null ? void 0 : preMenu.$el.querySelector(`.${ns.b("node")}[aria-expanded="true"]`);
  12166. focusNode(expandedNode);
  12167. break;
  12168. }
  12169. case EVENT_CODE.right: {
  12170. e.preventDefault();
  12171. const nextMenu = menuList.value[getMenuIndex(target) + 1];
  12172. const firstNode = nextMenu == null ? void 0 : nextMenu.$el.querySelector(`.${ns.b("node")}[tabindex="-1"]`);
  12173. focusNode(firstNode);
  12174. break;
  12175. }
  12176. case EVENT_CODE.enter:
  12177. checkNode(target);
  12178. break;
  12179. case EVENT_CODE.esc:
  12180. case EVENT_CODE.tab:
  12181. emit("close");
  12182. break;
  12183. }
  12184. };
  12185. provide(CASCADER_PANEL_INJECTION_KEY, reactive({
  12186. config,
  12187. expandingNode,
  12188. checkedNodes,
  12189. isHoverMenu,
  12190. initialLoaded,
  12191. renderLabelFn,
  12192. lazyLoad,
  12193. expandNode,
  12194. handleCheckChange
  12195. }));
  12196. watch([config, () => props.options], initStore, {
  12197. deep: true,
  12198. immediate: true
  12199. });
  12200. watch(() => props.modelValue, () => {
  12201. manualChecked = false;
  12202. syncCheckedValue();
  12203. });
  12204. watch(checkedValue, (val) => {
  12205. if (!isEqual(val, props.modelValue)) {
  12206. emit(UPDATE_MODEL_EVENT, val);
  12207. emit(CHANGE_EVENT, val);
  12208. }
  12209. });
  12210. onBeforeUpdate(() => menuList.value = []);
  12211. onMounted(() => !isEmpty(props.modelValue) && syncCheckedValue());
  12212. return {
  12213. ns,
  12214. menuList,
  12215. menus,
  12216. checkedNodes,
  12217. handleKeyDown: handleKeyDown2,
  12218. handleCheckChange,
  12219. getFlattedNodes,
  12220. getCheckedNodes,
  12221. clearCheckedNodes,
  12222. calculateCheckedValue,
  12223. scrollToExpandingNode
  12224. };
  12225. }
  12226. });
  12227. function _sfc_render$l(_ctx, _cache, $props, $setup, $data, $options) {
  12228. const _component_el_cascader_menu = resolveComponent("el-cascader-menu");
  12229. return openBlock(), createElementBlock("div", {
  12230. class: normalizeClass([_ctx.ns.b("panel"), _ctx.ns.is("bordered", _ctx.border)]),
  12231. onKeydown: _cache[0] || (_cache[0] = (...args) => _ctx.handleKeyDown && _ctx.handleKeyDown(...args))
  12232. }, [
  12233. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.menus, (menu, index) => {
  12234. return openBlock(), createBlock(_component_el_cascader_menu, {
  12235. key: index,
  12236. ref_for: true,
  12237. ref: (item) => _ctx.menuList[index] = item,
  12238. index,
  12239. nodes: [...menu]
  12240. }, null, 8, ["index", "nodes"]);
  12241. }), 128))
  12242. ], 34);
  12243. }
  12244. var CascaderPanel = /* @__PURE__ */ _export_sfc$1(_sfc_main$H, [["render", _sfc_render$l], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/cascader-panel/src/index.vue"]]);
  12245. CascaderPanel.install = (app) => {
  12246. app.component(CascaderPanel.name, CascaderPanel);
  12247. };
  12248. const _CascaderPanel = CascaderPanel;
  12249. const tagProps = buildProps({
  12250. closable: Boolean,
  12251. type: {
  12252. type: String,
  12253. values: ["success", "info", "warning", "danger", ""],
  12254. default: ""
  12255. },
  12256. hit: Boolean,
  12257. disableTransitions: Boolean,
  12258. color: {
  12259. type: String,
  12260. default: ""
  12261. },
  12262. size: {
  12263. type: String,
  12264. values: componentSizes,
  12265. default: ""
  12266. },
  12267. effect: {
  12268. type: String,
  12269. values: ["dark", "light", "plain"],
  12270. default: "light"
  12271. },
  12272. round: Boolean
  12273. });
  12274. const tagEmits = {
  12275. close: (evt) => evt instanceof MouseEvent,
  12276. click: (evt) => evt instanceof MouseEvent
  12277. };
  12278. const __default__$d = {
  12279. name: "ElTag"
  12280. };
  12281. const _sfc_main$G = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$d), {
  12282. props: tagProps,
  12283. emits: tagEmits,
  12284. setup(__props, { emit }) {
  12285. const props = __props;
  12286. const tagSize = useSize();
  12287. const ns = useNamespace("tag");
  12288. const classes = computed(() => {
  12289. const { type: type4, hit, effect: effect2, closable, round: round2 } = props;
  12290. return [
  12291. ns.b(),
  12292. ns.is("closable", closable),
  12293. ns.m(type4),
  12294. ns.m(tagSize.value),
  12295. ns.m(effect2),
  12296. ns.is("hit", hit),
  12297. ns.is("round", round2)
  12298. ];
  12299. });
  12300. const handleClose = (event) => {
  12301. event.stopPropagation();
  12302. emit("close", event);
  12303. };
  12304. const handleClick = (event) => {
  12305. emit("click", event);
  12306. };
  12307. return (_ctx, _cache) => {
  12308. return !_ctx.disableTransitions ? (openBlock(), createElementBlock("span", {
  12309. key: 0,
  12310. class: normalizeClass(unref(classes)),
  12311. style: normalizeStyle({ backgroundColor: _ctx.color }),
  12312. onClick: handleClick
  12313. }, [
  12314. createElementVNode("span", {
  12315. class: normalizeClass(unref(ns).e("content"))
  12316. }, [
  12317. renderSlot(_ctx.$slots, "default")
  12318. ], 2),
  12319. _ctx.closable ? (openBlock(), createBlock(unref(ElIcon), {
  12320. key: 0,
  12321. class: normalizeClass(unref(ns).e("close")),
  12322. onClick: handleClose
  12323. }, {
  12324. default: withCtx(() => [
  12325. createVNode(unref(close))
  12326. ]),
  12327. _: 1
  12328. }, 8, ["class"])) : createCommentVNode("v-if", true)
  12329. ], 6)) : (openBlock(), createBlock(Transition, {
  12330. key: 1,
  12331. name: `${unref(ns).namespace.value}-zoom-in-center`
  12332. }, {
  12333. default: withCtx(() => [
  12334. createElementVNode("span", {
  12335. class: normalizeClass(unref(classes)),
  12336. style: normalizeStyle({ backgroundColor: _ctx.color }),
  12337. onClick: handleClick
  12338. }, [
  12339. createElementVNode("span", {
  12340. class: normalizeClass(unref(ns).e("content"))
  12341. }, [
  12342. renderSlot(_ctx.$slots, "default")
  12343. ], 2),
  12344. _ctx.closable ? (openBlock(), createBlock(unref(ElIcon), {
  12345. key: 0,
  12346. class: normalizeClass(unref(ns).e("close")),
  12347. onClick: handleClose
  12348. }, {
  12349. default: withCtx(() => [
  12350. createVNode(unref(close))
  12351. ]),
  12352. _: 1
  12353. }, 8, ["class"])) : createCommentVNode("v-if", true)
  12354. ], 6)
  12355. ]),
  12356. _: 3
  12357. }, 8, ["name"]));
  12358. };
  12359. }
  12360. }));
  12361. var Tag = /* @__PURE__ */ _export_sfc$1(_sfc_main$G, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/tag/src/tag.vue"]]);
  12362. const ElTag = withInstall(Tag);
  12363. const DEFAULT_INPUT_HEIGHT = 40;
  12364. const INPUT_HEIGHT_MAP = {
  12365. large: 36,
  12366. default: 32,
  12367. small: 28
  12368. };
  12369. const popperOptions = {
  12370. modifiers: [
  12371. {
  12372. name: "arrowPosition",
  12373. enabled: true,
  12374. phase: "main",
  12375. fn: ({ state }) => {
  12376. const { modifiersData, placement } = state;
  12377. if (["right", "left", "bottom", "top"].includes(placement))
  12378. return;
  12379. modifiersData.arrow.x = 35;
  12380. },
  12381. requires: ["arrow"]
  12382. }
  12383. ]
  12384. };
  12385. const COMPONENT_NAME$3 = "ElCascader";
  12386. const _sfc_main$F = defineComponent({
  12387. name: COMPONENT_NAME$3,
  12388. components: {
  12389. ElCascaderPanel: _CascaderPanel,
  12390. ElInput,
  12391. ElTooltip,
  12392. ElScrollbar,
  12393. ElTag,
  12394. ElIcon,
  12395. CircleClose: circleClose,
  12396. Check: check,
  12397. ArrowDown: arrowDown
  12398. },
  12399. directives: {
  12400. Clickoutside: ClickOutside
  12401. },
  12402. props: __spreadProps(__spreadValues({}, CommonProps), {
  12403. size: {
  12404. type: String,
  12405. validator: isValidComponentSize
  12406. },
  12407. placeholder: {
  12408. type: String
  12409. },
  12410. disabled: Boolean,
  12411. clearable: Boolean,
  12412. filterable: Boolean,
  12413. filterMethod: {
  12414. type: Function,
  12415. default: (node, keyword) => node.text.includes(keyword)
  12416. },
  12417. separator: {
  12418. type: String,
  12419. default: " / "
  12420. },
  12421. showAllLevels: {
  12422. type: Boolean,
  12423. default: true
  12424. },
  12425. collapseTags: Boolean,
  12426. collapseTagsTooltip: {
  12427. type: Boolean,
  12428. default: false
  12429. },
  12430. debounce: {
  12431. type: Number,
  12432. default: 300
  12433. },
  12434. beforeFilter: {
  12435. type: Function,
  12436. default: () => true
  12437. },
  12438. popperClass: {
  12439. type: String,
  12440. default: ""
  12441. },
  12442. popperAppendToBody: {
  12443. type: Boolean,
  12444. default: void 0
  12445. },
  12446. teleported: useTooltipContentProps.teleported,
  12447. tagType: __spreadProps(__spreadValues({}, tagProps.type), { default: "info" })
  12448. }),
  12449. emits: [
  12450. UPDATE_MODEL_EVENT,
  12451. CHANGE_EVENT,
  12452. "focus",
  12453. "blur",
  12454. "visible-change",
  12455. "expand-change",
  12456. "remove-tag"
  12457. ],
  12458. setup(props, { emit }) {
  12459. let inputInitialHeight = 0;
  12460. let pressDeleteCount = 0;
  12461. const { compatTeleported } = useDeprecateAppendToBody(COMPONENT_NAME$3, "popperAppendToBody");
  12462. const nsCascader = useNamespace("cascader");
  12463. const nsInput = useNamespace("input");
  12464. const { t } = useLocale();
  12465. const elForm2 = inject(formContextKey, {});
  12466. const elFormItem2 = inject(formItemContextKey, {});
  12467. const tooltipRef = ref(null);
  12468. const input = ref(null);
  12469. const tagWrapper = ref(null);
  12470. const panel = ref(null);
  12471. const suggestionPanel = ref(null);
  12472. const popperVisible = ref(false);
  12473. const inputHover = ref(false);
  12474. const filtering = ref(false);
  12475. const inputValue = ref("");
  12476. const searchInputValue = ref("");
  12477. const presentTags = ref([]);
  12478. const allPresentTags = ref([]);
  12479. const suggestions = ref([]);
  12480. const isOnComposition = ref(false);
  12481. const isDisabled = computed(() => props.disabled || elForm2.disabled);
  12482. const inputPlaceholder = computed(() => props.placeholder || t("el.cascader.placeholder"));
  12483. const realSize = useSize();
  12484. const tagSize = computed(() => ["small"].includes(realSize.value) ? "small" : "default");
  12485. const multiple = computed(() => !!props.props.multiple);
  12486. const readonly2 = computed(() => !props.filterable || multiple.value);
  12487. const searchKeyword = computed(() => multiple.value ? searchInputValue.value : inputValue.value);
  12488. const checkedNodes = computed(() => {
  12489. var _a2;
  12490. return ((_a2 = panel.value) == null ? void 0 : _a2.checkedNodes) || [];
  12491. });
  12492. const clearBtnVisible = computed(() => {
  12493. if (!props.clearable || isDisabled.value || filtering.value || !inputHover.value)
  12494. return false;
  12495. return !!checkedNodes.value.length;
  12496. });
  12497. const presentText = computed(() => {
  12498. const { showAllLevels, separator } = props;
  12499. const nodes = checkedNodes.value;
  12500. return nodes.length ? multiple.value ? " " : nodes[0].calcText(showAllLevels, separator) : "";
  12501. });
  12502. const checkedValue = computed({
  12503. get() {
  12504. return props.modelValue;
  12505. },
  12506. set(val) {
  12507. var _a2;
  12508. emit(UPDATE_MODEL_EVENT, val);
  12509. emit(CHANGE_EVENT, val);
  12510. (_a2 = elFormItem2.validate) == null ? void 0 : _a2.call(elFormItem2, "change").catch((err) => debugWarn());
  12511. }
  12512. });
  12513. const popperPaneRef = computed(() => {
  12514. var _a2, _b2;
  12515. return (_b2 = (_a2 = tooltipRef.value) == null ? void 0 : _a2.popperRef) == null ? void 0 : _b2.contentRef;
  12516. });
  12517. const togglePopperVisible = (visible) => {
  12518. var _a2, _b2, _c;
  12519. if (isDisabled.value)
  12520. return;
  12521. visible = visible != null ? visible : !popperVisible.value;
  12522. if (visible !== popperVisible.value) {
  12523. popperVisible.value = visible;
  12524. (_b2 = (_a2 = input.value) == null ? void 0 : _a2.input) == null ? void 0 : _b2.setAttribute("aria-expanded", `${visible}`);
  12525. if (visible) {
  12526. updatePopperPosition();
  12527. nextTick((_c = panel.value) == null ? void 0 : _c.scrollToExpandingNode);
  12528. } else if (props.filterable) {
  12529. const { value } = presentText;
  12530. inputValue.value = value;
  12531. searchInputValue.value = value;
  12532. }
  12533. emit("visible-change", visible);
  12534. }
  12535. };
  12536. const updatePopperPosition = () => {
  12537. nextTick(() => {
  12538. var _a2;
  12539. (_a2 = tooltipRef.value) == null ? void 0 : _a2.updatePopper();
  12540. });
  12541. };
  12542. const hideSuggestionPanel = () => {
  12543. filtering.value = false;
  12544. };
  12545. const genTag2 = (node) => {
  12546. const { showAllLevels, separator } = props;
  12547. return {
  12548. node,
  12549. key: node.uid,
  12550. text: node.calcText(showAllLevels, separator),
  12551. hitState: false,
  12552. closable: !isDisabled.value && !node.isDisabled,
  12553. isCollapseTag: false
  12554. };
  12555. };
  12556. const deleteTag = (tag) => {
  12557. var _a2;
  12558. const node = tag.node;
  12559. node.doCheck(false);
  12560. (_a2 = panel.value) == null ? void 0 : _a2.calculateCheckedValue();
  12561. emit("remove-tag", node.valueByOption);
  12562. };
  12563. const calculatePresentTags = () => {
  12564. if (!multiple.value)
  12565. return;
  12566. const nodes = checkedNodes.value;
  12567. const tags = [];
  12568. const allTags = [];
  12569. nodes.forEach((node) => allTags.push(genTag2(node)));
  12570. allPresentTags.value = allTags;
  12571. if (nodes.length) {
  12572. const [first, ...rest] = nodes;
  12573. const restCount = rest.length;
  12574. tags.push(genTag2(first));
  12575. if (restCount) {
  12576. if (props.collapseTags) {
  12577. tags.push({
  12578. key: -1,
  12579. text: `+ ${restCount}`,
  12580. closable: false,
  12581. isCollapseTag: true
  12582. });
  12583. } else {
  12584. rest.forEach((node) => tags.push(genTag2(node)));
  12585. }
  12586. }
  12587. }
  12588. presentTags.value = tags;
  12589. };
  12590. const calculateSuggestions = () => {
  12591. var _a2, _b2;
  12592. const { filterMethod, showAllLevels, separator } = props;
  12593. const res = (_b2 = (_a2 = panel.value) == null ? void 0 : _a2.getFlattedNodes(!props.props.checkStrictly)) == null ? void 0 : _b2.filter((node) => {
  12594. if (node.isDisabled)
  12595. return false;
  12596. node.calcText(showAllLevels, separator);
  12597. return filterMethod(node, searchKeyword.value);
  12598. });
  12599. if (multiple.value) {
  12600. presentTags.value.forEach((tag) => {
  12601. tag.hitState = false;
  12602. });
  12603. allPresentTags.value.forEach((tag) => {
  12604. tag.hitState = false;
  12605. });
  12606. }
  12607. filtering.value = true;
  12608. suggestions.value = res;
  12609. updatePopperPosition();
  12610. };
  12611. const focusFirstNode = () => {
  12612. var _a2;
  12613. let firstNode;
  12614. if (filtering.value && suggestionPanel.value) {
  12615. firstNode = suggestionPanel.value.$el.querySelector(`.${nsCascader.e("suggestion-item")}`);
  12616. } else {
  12617. firstNode = (_a2 = panel.value) == null ? void 0 : _a2.$el.querySelector(`.${nsCascader.b("node")}[tabindex="-1"]`);
  12618. }
  12619. if (firstNode) {
  12620. firstNode.focus();
  12621. !filtering.value && firstNode.click();
  12622. }
  12623. };
  12624. const updateStyle = () => {
  12625. var _a2, _b2;
  12626. const inputInner = (_a2 = input.value) == null ? void 0 : _a2.input;
  12627. const tagWrapperEl = tagWrapper.value;
  12628. const suggestionPanelEl = (_b2 = suggestionPanel.value) == null ? void 0 : _b2.$el;
  12629. if (!isClient || !inputInner)
  12630. return;
  12631. if (suggestionPanelEl) {
  12632. const suggestionList = suggestionPanelEl.querySelector(`.${nsCascader.e("suggestion-list")}`);
  12633. suggestionList.style.minWidth = `${inputInner.offsetWidth}px`;
  12634. }
  12635. if (tagWrapperEl) {
  12636. const { offsetHeight } = tagWrapperEl;
  12637. const height = presentTags.value.length > 0 ? `${Math.max(offsetHeight + 6, inputInitialHeight)}px` : `${inputInitialHeight}px`;
  12638. inputInner.style.height = height;
  12639. updatePopperPosition();
  12640. }
  12641. };
  12642. const getCheckedNodes = (leafOnly) => {
  12643. var _a2;
  12644. return (_a2 = panel.value) == null ? void 0 : _a2.getCheckedNodes(leafOnly);
  12645. };
  12646. const handleExpandChange = (value) => {
  12647. updatePopperPosition();
  12648. emit("expand-change", value);
  12649. };
  12650. const handleComposition = (event) => {
  12651. var _a2;
  12652. const text = (_a2 = event.target) == null ? void 0 : _a2.value;
  12653. if (event.type === "compositionend") {
  12654. isOnComposition.value = false;
  12655. nextTick(() => handleInput(text));
  12656. } else {
  12657. const lastCharacter = text[text.length - 1] || "";
  12658. isOnComposition.value = !isKorean(lastCharacter);
  12659. }
  12660. };
  12661. const handleKeyDown2 = (e) => {
  12662. if (isOnComposition.value)
  12663. return;
  12664. switch (e.code) {
  12665. case EVENT_CODE.enter:
  12666. togglePopperVisible();
  12667. break;
  12668. case EVENT_CODE.down:
  12669. togglePopperVisible(true);
  12670. nextTick(focusFirstNode);
  12671. e.preventDefault();
  12672. break;
  12673. case EVENT_CODE.esc:
  12674. case EVENT_CODE.tab:
  12675. togglePopperVisible(false);
  12676. break;
  12677. }
  12678. };
  12679. const handleClear = () => {
  12680. var _a2;
  12681. (_a2 = panel.value) == null ? void 0 : _a2.clearCheckedNodes();
  12682. togglePopperVisible(false);
  12683. };
  12684. const handleSuggestionClick = (node) => {
  12685. var _a2, _b2;
  12686. const { checked } = node;
  12687. if (multiple.value) {
  12688. (_a2 = panel.value) == null ? void 0 : _a2.handleCheckChange(node, !checked, false);
  12689. } else {
  12690. !checked && ((_b2 = panel.value) == null ? void 0 : _b2.handleCheckChange(node, true, false));
  12691. togglePopperVisible(false);
  12692. }
  12693. };
  12694. const handleSuggestionKeyDown = (e) => {
  12695. const target = e.target;
  12696. const { code } = e;
  12697. switch (code) {
  12698. case EVENT_CODE.up:
  12699. case EVENT_CODE.down: {
  12700. const distance = code === EVENT_CODE.up ? -1 : 1;
  12701. focusNode(getSibling(target, distance, `.${nsCascader.e("suggestion-item")}[tabindex="-1"]`));
  12702. break;
  12703. }
  12704. case EVENT_CODE.enter:
  12705. target.click();
  12706. break;
  12707. case EVENT_CODE.esc:
  12708. case EVENT_CODE.tab:
  12709. togglePopperVisible(false);
  12710. break;
  12711. }
  12712. };
  12713. const handleDelete = () => {
  12714. const tags = presentTags.value;
  12715. const lastTag = tags[tags.length - 1];
  12716. pressDeleteCount = searchInputValue.value ? 0 : pressDeleteCount + 1;
  12717. if (!lastTag || !pressDeleteCount)
  12718. return;
  12719. if (lastTag.hitState) {
  12720. deleteTag(lastTag);
  12721. } else {
  12722. lastTag.hitState = true;
  12723. }
  12724. };
  12725. const handleFilter = debounce$1(() => {
  12726. const { value } = searchKeyword;
  12727. if (!value)
  12728. return;
  12729. const passed = props.beforeFilter(value);
  12730. if (isPromise(passed)) {
  12731. passed.then(calculateSuggestions).catch(() => {
  12732. });
  12733. } else if (passed !== false) {
  12734. calculateSuggestions();
  12735. } else {
  12736. hideSuggestionPanel();
  12737. }
  12738. }, props.debounce);
  12739. const handleInput = (val, e) => {
  12740. !popperVisible.value && togglePopperVisible(true);
  12741. if (e == null ? void 0 : e.isComposing)
  12742. return;
  12743. val ? handleFilter() : hideSuggestionPanel();
  12744. };
  12745. watch(filtering, updatePopperPosition);
  12746. watch([checkedNodes, isDisabled], calculatePresentTags);
  12747. watch(presentTags, () => {
  12748. nextTick(() => updateStyle());
  12749. });
  12750. watch(presentText, (val) => inputValue.value = val, { immediate: true });
  12751. onMounted(() => {
  12752. var _a2;
  12753. const inputEl = (_a2 = input.value) == null ? void 0 : _a2.$el;
  12754. inputInitialHeight = (inputEl == null ? void 0 : inputEl.offsetHeight) || INPUT_HEIGHT_MAP[realSize.value] || DEFAULT_INPUT_HEIGHT;
  12755. addResizeListener(inputEl, updateStyle);
  12756. });
  12757. onBeforeUnmount(() => {
  12758. var _a2;
  12759. removeResizeListener((_a2 = input.value) == null ? void 0 : _a2.$el, updateStyle);
  12760. });
  12761. return {
  12762. popperOptions,
  12763. tooltipRef,
  12764. popperPaneRef,
  12765. input,
  12766. tagWrapper,
  12767. panel,
  12768. suggestionPanel,
  12769. popperVisible,
  12770. inputHover,
  12771. inputPlaceholder,
  12772. filtering,
  12773. presentText,
  12774. checkedValue,
  12775. inputValue,
  12776. searchInputValue,
  12777. presentTags,
  12778. allPresentTags,
  12779. suggestions,
  12780. isDisabled,
  12781. isOnComposition,
  12782. realSize,
  12783. tagSize,
  12784. multiple,
  12785. readonly: readonly2,
  12786. clearBtnVisible,
  12787. compatTeleported,
  12788. nsCascader,
  12789. nsInput,
  12790. t,
  12791. togglePopperVisible,
  12792. hideSuggestionPanel,
  12793. deleteTag,
  12794. focusFirstNode,
  12795. getCheckedNodes,
  12796. handleExpandChange,
  12797. handleKeyDown: handleKeyDown2,
  12798. handleComposition,
  12799. handleClear,
  12800. handleSuggestionClick,
  12801. handleSuggestionKeyDown,
  12802. handleDelete,
  12803. handleInput
  12804. };
  12805. }
  12806. });
  12807. const _hoisted_1$s = { key: 0 };
  12808. const _hoisted_2$l = { class: "el-cascader__collapse-tags" };
  12809. const _hoisted_3$f = ["placeholder"];
  12810. const _hoisted_4$d = ["onClick"];
  12811. function _sfc_render$k(_ctx, _cache, $props, $setup, $data, $options) {
  12812. const _component_circle_close = resolveComponent("circle-close");
  12813. const _component_el_icon = resolveComponent("el-icon");
  12814. const _component_arrow_down = resolveComponent("arrow-down");
  12815. const _component_el_input = resolveComponent("el-input");
  12816. const _component_el_tag = resolveComponent("el-tag");
  12817. const _component_el_tooltip = resolveComponent("el-tooltip");
  12818. const _component_el_cascader_panel = resolveComponent("el-cascader-panel");
  12819. const _component_check = resolveComponent("check");
  12820. const _component_el_scrollbar = resolveComponent("el-scrollbar");
  12821. const _directive_clickoutside = resolveDirective("clickoutside");
  12822. return openBlock(), createBlock(_component_el_tooltip, {
  12823. ref: "tooltipRef",
  12824. visible: _ctx.popperVisible,
  12825. "onUpdate:visible": _cache[17] || (_cache[17] = ($event) => _ctx.popperVisible = $event),
  12826. teleported: _ctx.compatTeleported,
  12827. "popper-class": [_ctx.nsCascader.e("dropdown"), _ctx.popperClass],
  12828. "popper-options": _ctx.popperOptions,
  12829. "fallback-placements": [
  12830. "bottom-start",
  12831. "bottom",
  12832. "top-start",
  12833. "top",
  12834. "right",
  12835. "left"
  12836. ],
  12837. "stop-popper-mouse-event": false,
  12838. "gpu-acceleration": false,
  12839. placement: "bottom-start",
  12840. transition: `${_ctx.nsCascader.namespace.value}-zoom-in-top`,
  12841. effect: "light",
  12842. pure: "",
  12843. persistent: "",
  12844. onHide: _ctx.hideSuggestionPanel
  12845. }, {
  12846. default: withCtx(() => [
  12847. withDirectives((openBlock(), createElementBlock("div", {
  12848. class: normalizeClass([
  12849. _ctx.nsCascader.b(),
  12850. _ctx.nsCascader.m(_ctx.realSize),
  12851. _ctx.nsCascader.is("disabled", _ctx.isDisabled),
  12852. _ctx.$attrs.class
  12853. ]),
  12854. style: normalizeStyle(_ctx.$attrs.style),
  12855. onClick: _cache[11] || (_cache[11] = () => _ctx.togglePopperVisible(_ctx.readonly ? void 0 : true)),
  12856. onKeydown: _cache[12] || (_cache[12] = (...args) => _ctx.handleKeyDown && _ctx.handleKeyDown(...args)),
  12857. onMouseenter: _cache[13] || (_cache[13] = ($event) => _ctx.inputHover = true),
  12858. onMouseleave: _cache[14] || (_cache[14] = ($event) => _ctx.inputHover = false)
  12859. }, [
  12860. createVNode(_component_el_input, {
  12861. ref: "input",
  12862. modelValue: _ctx.inputValue,
  12863. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.inputValue = $event),
  12864. placeholder: _ctx.inputPlaceholder,
  12865. readonly: _ctx.readonly,
  12866. disabled: _ctx.isDisabled,
  12867. "validate-event": false,
  12868. size: _ctx.realSize,
  12869. class: normalizeClass(_ctx.nsCascader.is("focus", _ctx.popperVisible)),
  12870. onCompositionstart: _ctx.handleComposition,
  12871. onCompositionupdate: _ctx.handleComposition,
  12872. onCompositionend: _ctx.handleComposition,
  12873. onFocus: _cache[2] || (_cache[2] = (e) => _ctx.$emit("focus", e)),
  12874. onBlur: _cache[3] || (_cache[3] = (e) => _ctx.$emit("blur", e)),
  12875. onInput: _ctx.handleInput
  12876. }, {
  12877. suffix: withCtx(() => [
  12878. _ctx.clearBtnVisible ? (openBlock(), createBlock(_component_el_icon, {
  12879. key: "clear",
  12880. class: normalizeClass([_ctx.nsInput.e("icon"), "icon-circle-close"]),
  12881. onClick: withModifiers(_ctx.handleClear, ["stop"])
  12882. }, {
  12883. default: withCtx(() => [
  12884. createVNode(_component_circle_close)
  12885. ]),
  12886. _: 1
  12887. }, 8, ["class", "onClick"])) : (openBlock(), createBlock(_component_el_icon, {
  12888. key: "arrow-down",
  12889. class: normalizeClass([
  12890. _ctx.nsInput.e("icon"),
  12891. "icon-arrow-down",
  12892. _ctx.nsCascader.is("reverse", _ctx.popperVisible)
  12893. ]),
  12894. onClick: _cache[0] || (_cache[0] = withModifiers(($event) => _ctx.togglePopperVisible(), ["stop"]))
  12895. }, {
  12896. default: withCtx(() => [
  12897. createVNode(_component_arrow_down)
  12898. ]),
  12899. _: 1
  12900. }, 8, ["class"]))
  12901. ]),
  12902. _: 1
  12903. }, 8, ["modelValue", "placeholder", "readonly", "disabled", "size", "class", "onCompositionstart", "onCompositionupdate", "onCompositionend", "onInput"]),
  12904. _ctx.multiple ? (openBlock(), createElementBlock("div", {
  12905. key: 0,
  12906. ref: "tagWrapper",
  12907. class: normalizeClass(_ctx.nsCascader.e("tags"))
  12908. }, [
  12909. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.presentTags, (tag) => {
  12910. return openBlock(), createBlock(_component_el_tag, {
  12911. key: tag.key,
  12912. type: _ctx.tagType,
  12913. size: _ctx.tagSize,
  12914. hit: tag.hitState,
  12915. closable: tag.closable,
  12916. "disable-transitions": "",
  12917. onClose: ($event) => _ctx.deleteTag(tag)
  12918. }, {
  12919. default: withCtx(() => [
  12920. tag.isCollapseTag === false ? (openBlock(), createElementBlock("span", _hoisted_1$s, toDisplayString(tag.text), 1)) : (openBlock(), createBlock(_component_el_tooltip, {
  12921. key: 1,
  12922. teleported: false,
  12923. disabled: _ctx.popperVisible || !_ctx.collapseTagsTooltip,
  12924. "fallback-placements": ["bottom", "top", "right", "left"],
  12925. placement: "bottom",
  12926. effect: "light"
  12927. }, {
  12928. default: withCtx(() => [
  12929. createElementVNode("span", null, toDisplayString(tag.text), 1)
  12930. ]),
  12931. content: withCtx(() => [
  12932. createElementVNode("div", _hoisted_2$l, [
  12933. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.allPresentTags, (tag2, idx) => {
  12934. return openBlock(), createElementBlock("div", {
  12935. key: idx,
  12936. class: "el-cascader__collapse-tag"
  12937. }, [
  12938. (openBlock(), createBlock(_component_el_tag, {
  12939. key: tag2.key,
  12940. class: "in-tooltip",
  12941. type: _ctx.tagType,
  12942. size: _ctx.tagSize,
  12943. hit: tag2.hitState,
  12944. closable: tag2.closable,
  12945. "disable-transitions": "",
  12946. onClose: ($event) => _ctx.deleteTag(tag2)
  12947. }, {
  12948. default: withCtx(() => [
  12949. createElementVNode("span", null, toDisplayString(tag2.text), 1)
  12950. ]),
  12951. _: 2
  12952. }, 1032, ["type", "size", "hit", "closable", "onClose"]))
  12953. ]);
  12954. }), 128))
  12955. ])
  12956. ]),
  12957. _: 2
  12958. }, 1032, ["disabled"]))
  12959. ]),
  12960. _: 2
  12961. }, 1032, ["type", "size", "hit", "closable", "onClose"]);
  12962. }), 128)),
  12963. _ctx.filterable && !_ctx.isDisabled ? withDirectives((openBlock(), createElementBlock("input", {
  12964. key: 0,
  12965. "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => _ctx.searchInputValue = $event),
  12966. type: "text",
  12967. class: normalizeClass(_ctx.nsCascader.e("search-input")),
  12968. placeholder: _ctx.presentText ? "" : _ctx.inputPlaceholder,
  12969. onInput: _cache[5] || (_cache[5] = (e) => _ctx.handleInput(_ctx.searchInputValue, e)),
  12970. onClick: _cache[6] || (_cache[6] = withModifiers(($event) => _ctx.togglePopperVisible(true), ["stop"])),
  12971. onKeydown: _cache[7] || (_cache[7] = withKeys((...args) => _ctx.handleDelete && _ctx.handleDelete(...args), ["delete"])),
  12972. onCompositionstart: _cache[8] || (_cache[8] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args)),
  12973. onCompositionupdate: _cache[9] || (_cache[9] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args)),
  12974. onCompositionend: _cache[10] || (_cache[10] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args))
  12975. }, null, 42, _hoisted_3$f)), [
  12976. [vModelText, _ctx.searchInputValue]
  12977. ]) : createCommentVNode("v-if", true)
  12978. ], 2)) : createCommentVNode("v-if", true)
  12979. ], 38)), [
  12980. [_directive_clickoutside, () => _ctx.togglePopperVisible(false), _ctx.popperPaneRef]
  12981. ])
  12982. ]),
  12983. content: withCtx(() => [
  12984. withDirectives(createVNode(_component_el_cascader_panel, {
  12985. ref: "panel",
  12986. modelValue: _ctx.checkedValue,
  12987. "onUpdate:modelValue": _cache[15] || (_cache[15] = ($event) => _ctx.checkedValue = $event),
  12988. options: _ctx.options,
  12989. props: _ctx.props,
  12990. border: false,
  12991. "render-label": _ctx.$slots.default,
  12992. onExpandChange: _ctx.handleExpandChange,
  12993. onClose: _cache[16] || (_cache[16] = ($event) => _ctx.$nextTick(() => _ctx.togglePopperVisible(false)))
  12994. }, null, 8, ["modelValue", "options", "props", "render-label", "onExpandChange"]), [
  12995. [vShow, !_ctx.filtering]
  12996. ]),
  12997. _ctx.filterable ? withDirectives((openBlock(), createBlock(_component_el_scrollbar, {
  12998. key: 0,
  12999. ref: "suggestionPanel",
  13000. tag: "ul",
  13001. class: normalizeClass(_ctx.nsCascader.e("suggestion-panel")),
  13002. "view-class": _ctx.nsCascader.e("suggestion-list"),
  13003. onKeydown: _ctx.handleSuggestionKeyDown
  13004. }, {
  13005. default: withCtx(() => [
  13006. _ctx.suggestions.length ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(_ctx.suggestions, (item) => {
  13007. return openBlock(), createElementBlock("li", {
  13008. key: item.uid,
  13009. class: normalizeClass([
  13010. _ctx.nsCascader.e("suggestion-item"),
  13011. _ctx.nsCascader.is("checked", item.checked)
  13012. ]),
  13013. tabindex: -1,
  13014. onClick: ($event) => _ctx.handleSuggestionClick(item)
  13015. }, [
  13016. createElementVNode("span", null, toDisplayString(item.text), 1),
  13017. item.checked ? (openBlock(), createBlock(_component_el_icon, { key: 0 }, {
  13018. default: withCtx(() => [
  13019. createVNode(_component_check)
  13020. ]),
  13021. _: 1
  13022. })) : createCommentVNode("v-if", true)
  13023. ], 10, _hoisted_4$d);
  13024. }), 128)) : renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [
  13025. createElementVNode("li", {
  13026. class: normalizeClass(_ctx.nsCascader.e("empty-text"))
  13027. }, toDisplayString(_ctx.t("el.cascader.noMatch")), 3)
  13028. ])
  13029. ]),
  13030. _: 3
  13031. }, 8, ["class", "view-class", "onKeydown"])), [
  13032. [vShow, _ctx.filtering]
  13033. ]) : createCommentVNode("v-if", true)
  13034. ]),
  13035. _: 3
  13036. }, 8, ["visible", "teleported", "popper-class", "popper-options", "transition", "onHide"]);
  13037. }
  13038. var Cascader = /* @__PURE__ */ _export_sfc$1(_sfc_main$F, [["render", _sfc_render$k], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/cascader/src/index.vue"]]);
  13039. Cascader.install = (app) => {
  13040. app.component(Cascader.name, Cascader);
  13041. };
  13042. const _Cascader = Cascader;
  13043. const ElCascader = _Cascader;
  13044. const messageConfig = {};
  13045. const configProviderProps = buildProps({
  13046. a11y: {
  13047. type: Boolean,
  13048. default: true
  13049. },
  13050. locale: {
  13051. type: definePropType(Object)
  13052. },
  13053. size: {
  13054. type: String,
  13055. values: componentSizes,
  13056. default: ""
  13057. },
  13058. button: {
  13059. type: definePropType(Object)
  13060. },
  13061. experimentalFeatures: {
  13062. type: definePropType(Object)
  13063. },
  13064. keyboardNavigation: {
  13065. type: Boolean,
  13066. default: true
  13067. },
  13068. message: {
  13069. type: definePropType(Object)
  13070. },
  13071. zIndex: {
  13072. type: Number
  13073. },
  13074. namespace: {
  13075. type: String,
  13076. default: "el"
  13077. }
  13078. });
  13079. var ConfigProvider = defineComponent({
  13080. name: "ElConfigProvider",
  13081. props: configProviderProps,
  13082. setup(props, { slots }) {
  13083. watch(() => props.message, (val) => {
  13084. Object.assign(messageConfig, val != null ? val : {});
  13085. }, { immediate: true, deep: true });
  13086. const config = provideGlobalConfig(props);
  13087. return () => renderSlot(slots, "default", { config: config == null ? void 0 : config.value });
  13088. }
  13089. });
  13090. const ElConfigProvider = withInstall(ConfigProvider);
  13091. var advancedFormat$1 = { exports: {} };
  13092. (function(module2, exports2) {
  13093. !function(e, t) {
  13094. module2.exports = t();
  13095. }(commonjsGlobal, function() {
  13096. return function(e, t) {
  13097. var r = t.prototype, n = r.format;
  13098. r.format = function(e2) {
  13099. var t2 = this, r2 = this.$locale();
  13100. if (!this.isValid())
  13101. return n.bind(this)(e2);
  13102. var s2 = this.$utils(), a2 = (e2 || "YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g, function(e3) {
  13103. switch (e3) {
  13104. case "Q":
  13105. return Math.ceil((t2.$M + 1) / 3);
  13106. case "Do":
  13107. return r2.ordinal(t2.$D);
  13108. case "gggg":
  13109. return t2.weekYear();
  13110. case "GGGG":
  13111. return t2.isoWeekYear();
  13112. case "wo":
  13113. return r2.ordinal(t2.week(), "W");
  13114. case "w":
  13115. case "ww":
  13116. return s2.s(t2.week(), e3 === "w" ? 1 : 2, "0");
  13117. case "W":
  13118. case "WW":
  13119. return s2.s(t2.isoWeek(), e3 === "W" ? 1 : 2, "0");
  13120. case "k":
  13121. case "kk":
  13122. return s2.s(String(t2.$H === 0 ? 24 : t2.$H), e3 === "k" ? 1 : 2, "0");
  13123. case "X":
  13124. return Math.floor(t2.$d.getTime() / 1e3);
  13125. case "x":
  13126. return t2.$d.getTime();
  13127. case "z":
  13128. return "[" + t2.offsetName() + "]";
  13129. case "zzz":
  13130. return "[" + t2.offsetName("long") + "]";
  13131. default:
  13132. return e3;
  13133. }
  13134. });
  13135. return n.bind(this)(a2);
  13136. };
  13137. };
  13138. });
  13139. })(advancedFormat$1);
  13140. var advancedFormat = advancedFormat$1.exports;
  13141. var weekOfYear$1 = { exports: {} };
  13142. (function(module2, exports2) {
  13143. !function(e, t) {
  13144. module2.exports = t();
  13145. }(commonjsGlobal, function() {
  13146. var e = "week", t = "year";
  13147. return function(i, n, r) {
  13148. var f2 = n.prototype;
  13149. f2.week = function(i2) {
  13150. if (i2 === void 0 && (i2 = null), i2 !== null)
  13151. return this.add(7 * (i2 - this.week()), "day");
  13152. var n2 = this.$locale().yearStart || 1;
  13153. if (this.month() === 11 && this.date() > 25) {
  13154. var f3 = r(this).startOf(t).add(1, t).date(n2), s2 = r(this).endOf(e);
  13155. if (f3.isBefore(s2))
  13156. return 1;
  13157. }
  13158. var a2 = r(this).startOf(t).date(n2).startOf(e).subtract(1, "millisecond"), o2 = this.diff(a2, e, true);
  13159. return o2 < 0 ? r(this).startOf("week").week() : Math.ceil(o2);
  13160. }, f2.weeks = function(e2) {
  13161. return e2 === void 0 && (e2 = null), this.week(e2);
  13162. };
  13163. };
  13164. });
  13165. })(weekOfYear$1);
  13166. var weekOfYear = weekOfYear$1.exports;
  13167. var weekYear$1 = { exports: {} };
  13168. (function(module2, exports2) {
  13169. !function(e, t) {
  13170. module2.exports = t();
  13171. }(commonjsGlobal, function() {
  13172. return function(e, t) {
  13173. t.prototype.weekYear = function() {
  13174. var e2 = this.month(), t2 = this.week(), n = this.year();
  13175. return t2 === 1 && e2 === 11 ? n + 1 : e2 === 0 && t2 >= 52 ? n - 1 : n;
  13176. };
  13177. };
  13178. });
  13179. })(weekYear$1);
  13180. var weekYear = weekYear$1.exports;
  13181. var dayOfYear$1 = { exports: {} };
  13182. (function(module2, exports2) {
  13183. !function(e, t) {
  13184. module2.exports = t();
  13185. }(commonjsGlobal, function() {
  13186. return function(e, t, n) {
  13187. t.prototype.dayOfYear = function(e2) {
  13188. var t2 = Math.round((n(this).startOf("day") - n(this).startOf("year")) / 864e5) + 1;
  13189. return e2 == null ? t2 : this.add(e2 - t2, "day");
  13190. };
  13191. };
  13192. });
  13193. })(dayOfYear$1);
  13194. var dayOfYear = dayOfYear$1.exports;
  13195. var isSameOrAfter$1 = { exports: {} };
  13196. (function(module2, exports2) {
  13197. !function(e, t) {
  13198. module2.exports = t();
  13199. }(commonjsGlobal, function() {
  13200. return function(e, t) {
  13201. t.prototype.isSameOrAfter = function(e2, t2) {
  13202. return this.isSame(e2, t2) || this.isAfter(e2, t2);
  13203. };
  13204. };
  13205. });
  13206. })(isSameOrAfter$1);
  13207. var isSameOrAfter = isSameOrAfter$1.exports;
  13208. var isSameOrBefore$1 = { exports: {} };
  13209. (function(module2, exports2) {
  13210. !function(e, i) {
  13211. module2.exports = i();
  13212. }(commonjsGlobal, function() {
  13213. return function(e, i) {
  13214. i.prototype.isSameOrBefore = function(e2, i2) {
  13215. return this.isSame(e2, i2) || this.isBefore(e2, i2);
  13216. };
  13217. };
  13218. });
  13219. })(isSameOrBefore$1);
  13220. var isSameOrBefore = isSameOrBefore$1.exports;
  13221. const ROOT_PICKER_INJECTION_KEY = Symbol();
  13222. var ElDatePickerCell = defineComponent({
  13223. name: "ElDatePickerCell",
  13224. props: buildProps({
  13225. cell: {
  13226. type: definePropType(Object)
  13227. }
  13228. }),
  13229. setup(props) {
  13230. const picker = inject(ROOT_PICKER_INJECTION_KEY);
  13231. return () => {
  13232. const cell = props.cell;
  13233. if (picker == null ? void 0 : picker.ctx.slots.default) {
  13234. const list = picker.ctx.slots.default(cell).filter((item) => {
  13235. return item.patchFlag !== -2 && item.type.toString() !== "Symbol(Comment)";
  13236. });
  13237. if (list.length) {
  13238. return list;
  13239. }
  13240. }
  13241. return h$1("div", {
  13242. class: "el-date-table-cell"
  13243. }, [
  13244. h$1("span", {
  13245. class: "el-date-table-cell__text"
  13246. }, [cell == null ? void 0 : cell.text])
  13247. ]);
  13248. };
  13249. }
  13250. });
  13251. const _sfc_main$E = defineComponent({
  13252. components: {
  13253. ElDatePickerCell
  13254. },
  13255. props: {
  13256. date: {
  13257. type: Object
  13258. },
  13259. minDate: {
  13260. type: Object
  13261. },
  13262. maxDate: {
  13263. type: Object
  13264. },
  13265. parsedValue: {
  13266. type: [Object, Array]
  13267. },
  13268. selectionMode: {
  13269. type: String,
  13270. default: "day"
  13271. },
  13272. showWeekNumber: {
  13273. type: Boolean,
  13274. default: false
  13275. },
  13276. disabledDate: {
  13277. type: Function
  13278. },
  13279. cellClassName: {
  13280. type: Function
  13281. },
  13282. rangeState: {
  13283. type: Object,
  13284. default: () => ({
  13285. endDate: null,
  13286. selecting: false
  13287. })
  13288. }
  13289. },
  13290. emits: ["changerange", "pick", "select"],
  13291. setup(props, ctx) {
  13292. const { t, lang } = useLocale();
  13293. const lastRow = ref(null);
  13294. const lastColumn = ref(null);
  13295. const tableRows = ref([[], [], [], [], [], []]);
  13296. const firstDayOfWeek = props.date.$locale().weekStart || 7;
  13297. const WEEKS_CONSTANT = props.date.locale("en").localeData().weekdaysShort().map((_2) => _2.toLowerCase());
  13298. const offsetDay = computed(() => {
  13299. return firstDayOfWeek > 3 ? 7 - firstDayOfWeek : -firstDayOfWeek;
  13300. });
  13301. const startDate = computed(() => {
  13302. const startDayOfMonth = props.date.startOf("month");
  13303. return startDayOfMonth.subtract(startDayOfMonth.day() || 7, "day");
  13304. });
  13305. const WEEKS = computed(() => {
  13306. return WEEKS_CONSTANT.concat(WEEKS_CONSTANT).slice(firstDayOfWeek, firstDayOfWeek + 7);
  13307. });
  13308. const rows = computed(() => {
  13309. var _a2;
  13310. const startOfMonth = props.date.startOf("month");
  13311. const startOfMonthDay = startOfMonth.day() || 7;
  13312. const dateCountOfMonth = startOfMonth.daysInMonth();
  13313. const dateCountOfLastMonth = startOfMonth.subtract(1, "month").daysInMonth();
  13314. const offset2 = offsetDay.value;
  13315. const rows_ = tableRows.value;
  13316. let count = 1;
  13317. const selectedDate = props.selectionMode === "dates" ? castArray(props.parsedValue) : [];
  13318. const calNow = dayjs().locale(lang.value).startOf("day");
  13319. for (let i = 0; i < 6; i++) {
  13320. const row = rows_[i];
  13321. if (props.showWeekNumber) {
  13322. if (!row[0]) {
  13323. row[0] = {
  13324. type: "week",
  13325. text: startDate.value.add(i * 7 + 1, "day").week()
  13326. };
  13327. }
  13328. }
  13329. for (let j = 0; j < 7; j++) {
  13330. let cell = row[props.showWeekNumber ? j + 1 : j];
  13331. if (!cell) {
  13332. cell = {
  13333. row: i,
  13334. column: j,
  13335. type: "normal",
  13336. inRange: false,
  13337. start: false,
  13338. end: false
  13339. };
  13340. }
  13341. const index = i * 7 + j;
  13342. const calTime = startDate.value.add(index - offset2, "day");
  13343. cell.dayjs = calTime;
  13344. cell.date = calTime.toDate();
  13345. cell.timestamp = calTime.valueOf();
  13346. cell.type = "normal";
  13347. const calEndDate = props.rangeState.endDate || props.maxDate || props.rangeState.selecting && props.minDate;
  13348. cell.inRange = props.minDate && calTime.isSameOrAfter(props.minDate, "day") && calEndDate && calTime.isSameOrBefore(calEndDate, "day") || props.minDate && calTime.isSameOrBefore(props.minDate, "day") && calEndDate && calTime.isSameOrAfter(calEndDate, "day");
  13349. if ((_a2 = props.minDate) == null ? void 0 : _a2.isSameOrAfter(calEndDate)) {
  13350. cell.start = calEndDate && calTime.isSame(calEndDate, "day");
  13351. cell.end = props.minDate && calTime.isSame(props.minDate, "day");
  13352. } else {
  13353. cell.start = props.minDate && calTime.isSame(props.minDate, "day");
  13354. cell.end = calEndDate && calTime.isSame(calEndDate, "day");
  13355. }
  13356. const isToday = calTime.isSame(calNow, "day");
  13357. if (isToday) {
  13358. cell.type = "today";
  13359. }
  13360. if (i >= 0 && i <= 1) {
  13361. const numberOfDaysFromPreviousMonth = startOfMonthDay + offset2 < 0 ? 7 + startOfMonthDay + offset2 : startOfMonthDay + offset2;
  13362. if (j + i * 7 >= numberOfDaysFromPreviousMonth) {
  13363. cell.text = count++;
  13364. } else {
  13365. cell.text = dateCountOfLastMonth - (numberOfDaysFromPreviousMonth - j % 7) + 1 + i * 7;
  13366. cell.type = "prev-month";
  13367. }
  13368. } else {
  13369. if (count <= dateCountOfMonth) {
  13370. cell.text = count++;
  13371. } else {
  13372. cell.text = count++ - dateCountOfMonth;
  13373. cell.type = "next-month";
  13374. }
  13375. }
  13376. const cellDate = calTime.toDate();
  13377. cell.selected = selectedDate.find((_2) => _2.valueOf() === calTime.valueOf());
  13378. cell.isSelected = !!cell.selected;
  13379. cell.isCurrent = isCurrent(cell);
  13380. cell.disabled = props.disabledDate && props.disabledDate(cellDate);
  13381. cell.customClass = props.cellClassName && props.cellClassName(cellDate);
  13382. row[props.showWeekNumber ? j + 1 : j] = cell;
  13383. }
  13384. if (props.selectionMode === "week") {
  13385. const start2 = props.showWeekNumber ? 1 : 0;
  13386. const end2 = props.showWeekNumber ? 7 : 6;
  13387. const isActive = isWeekActive(row[start2 + 1]);
  13388. row[start2].inRange = isActive;
  13389. row[start2].start = isActive;
  13390. row[end2].inRange = isActive;
  13391. row[end2].end = isActive;
  13392. }
  13393. }
  13394. return rows_;
  13395. });
  13396. const isCurrent = (cell) => {
  13397. return props.selectionMode === "day" && (cell.type === "normal" || cell.type === "today") && cellMatchesDate(cell, props.parsedValue);
  13398. };
  13399. const cellMatchesDate = (cell, date4) => {
  13400. if (!date4)
  13401. return false;
  13402. return dayjs(date4).locale(lang.value).isSame(props.date.date(Number(cell.text)), "day");
  13403. };
  13404. const getCellClasses = (cell) => {
  13405. const classes = [];
  13406. if ((cell.type === "normal" || cell.type === "today") && !cell.disabled) {
  13407. classes.push("available");
  13408. if (cell.type === "today") {
  13409. classes.push("today");
  13410. }
  13411. } else {
  13412. classes.push(cell.type);
  13413. }
  13414. if (isCurrent(cell)) {
  13415. classes.push("current");
  13416. }
  13417. if (cell.inRange && (cell.type === "normal" || cell.type === "today" || props.selectionMode === "week")) {
  13418. classes.push("in-range");
  13419. if (cell.start) {
  13420. classes.push("start-date");
  13421. }
  13422. if (cell.end) {
  13423. classes.push("end-date");
  13424. }
  13425. }
  13426. if (cell.disabled) {
  13427. classes.push("disabled");
  13428. }
  13429. if (cell.selected) {
  13430. classes.push("selected");
  13431. }
  13432. if (cell.customClass) {
  13433. classes.push(cell.customClass);
  13434. }
  13435. return classes.join(" ");
  13436. };
  13437. const getDateOfCell = (row, column) => {
  13438. const offsetFromStart = row * 7 + (column - (props.showWeekNumber ? 1 : 0)) - offsetDay.value;
  13439. return startDate.value.add(offsetFromStart, "day");
  13440. };
  13441. const handleMouseMove = (event) => {
  13442. if (!props.rangeState.selecting)
  13443. return;
  13444. let target = event.target;
  13445. if (target.tagName === "SPAN") {
  13446. target = target.parentNode.parentNode;
  13447. }
  13448. if (target.tagName === "DIV") {
  13449. target = target.parentNode;
  13450. }
  13451. if (target.tagName !== "TD")
  13452. return;
  13453. const row = target.parentNode.rowIndex - 1;
  13454. const column = target.cellIndex;
  13455. if (rows.value[row][column].disabled)
  13456. return;
  13457. if (row !== lastRow.value || column !== lastColumn.value) {
  13458. lastRow.value = row;
  13459. lastColumn.value = column;
  13460. ctx.emit("changerange", {
  13461. selecting: true,
  13462. endDate: getDateOfCell(row, column)
  13463. });
  13464. }
  13465. };
  13466. const handleClick = (event) => {
  13467. let target = event.target;
  13468. while (target) {
  13469. if (target.tagName === "TD") {
  13470. break;
  13471. }
  13472. target = target.parentNode;
  13473. }
  13474. if (!target || target.tagName !== "TD")
  13475. return;
  13476. const row = target.parentNode.rowIndex - 1;
  13477. const column = target.cellIndex;
  13478. const cell = rows.value[row][column];
  13479. if (cell.disabled || cell.type === "week")
  13480. return;
  13481. const newDate = getDateOfCell(row, column);
  13482. if (props.selectionMode === "range") {
  13483. if (!props.rangeState.selecting) {
  13484. ctx.emit("pick", { minDate: newDate, maxDate: null });
  13485. ctx.emit("select", true);
  13486. } else {
  13487. if (newDate >= props.minDate) {
  13488. ctx.emit("pick", { minDate: props.minDate, maxDate: newDate });
  13489. } else {
  13490. ctx.emit("pick", { minDate: newDate, maxDate: props.minDate });
  13491. }
  13492. ctx.emit("select", false);
  13493. }
  13494. } else if (props.selectionMode === "day") {
  13495. ctx.emit("pick", newDate);
  13496. } else if (props.selectionMode === "week") {
  13497. const weekNumber = newDate.week();
  13498. const value = `${newDate.year()}w${weekNumber}`;
  13499. ctx.emit("pick", {
  13500. year: newDate.year(),
  13501. week: weekNumber,
  13502. value,
  13503. date: newDate.startOf("week")
  13504. });
  13505. } else if (props.selectionMode === "dates") {
  13506. const newValue = cell.selected ? castArray(props.parsedValue).filter((_2) => _2.valueOf() !== newDate.valueOf()) : castArray(props.parsedValue).concat([newDate]);
  13507. ctx.emit("pick", newValue);
  13508. }
  13509. };
  13510. const isWeekActive = (cell) => {
  13511. if (props.selectionMode !== "week")
  13512. return false;
  13513. let newDate = props.date.startOf("day");
  13514. if (cell.type === "prev-month") {
  13515. newDate = newDate.subtract(1, "month");
  13516. }
  13517. if (cell.type === "next-month") {
  13518. newDate = newDate.add(1, "month");
  13519. }
  13520. newDate = newDate.date(Number.parseInt(cell.text, 10));
  13521. if (props.parsedValue && !Array.isArray(props.parsedValue)) {
  13522. const dayOffset = (props.parsedValue.day() - firstDayOfWeek + 7) % 7 - 1;
  13523. const weekDate = props.parsedValue.subtract(dayOffset, "day");
  13524. return weekDate.isSame(newDate, "day");
  13525. }
  13526. return false;
  13527. };
  13528. return {
  13529. handleMouseMove,
  13530. t,
  13531. rows,
  13532. isWeekActive,
  13533. getCellClasses,
  13534. WEEKS,
  13535. handleClick
  13536. };
  13537. }
  13538. });
  13539. const _hoisted_1$r = { key: 0 };
  13540. function _sfc_render$j(_ctx, _cache, $props, $setup, $data, $options) {
  13541. const _component_el_date_picker_cell = resolveComponent("el-date-picker-cell");
  13542. return openBlock(), createElementBlock("table", {
  13543. cellspacing: "0",
  13544. cellpadding: "0",
  13545. class: normalizeClass(["el-date-table", { "is-week-mode": _ctx.selectionMode === "week" }]),
  13546. onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleClick && _ctx.handleClick(...args)),
  13547. onMousemove: _cache[1] || (_cache[1] = (...args) => _ctx.handleMouseMove && _ctx.handleMouseMove(...args))
  13548. }, [
  13549. createElementVNode("tbody", null, [
  13550. createElementVNode("tr", null, [
  13551. _ctx.showWeekNumber ? (openBlock(), createElementBlock("th", _hoisted_1$r, toDisplayString(_ctx.t("el.datepicker.week")), 1)) : createCommentVNode("v-if", true),
  13552. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.WEEKS, (week, key) => {
  13553. return openBlock(), createElementBlock("th", { key }, toDisplayString(_ctx.t("el.datepicker.weeks." + week)), 1);
  13554. }), 128))
  13555. ]),
  13556. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.rows, (row, key) => {
  13557. return openBlock(), createElementBlock("tr", {
  13558. key,
  13559. class: normalizeClass(["el-date-table__row", { current: _ctx.isWeekActive(row[1]) }])
  13560. }, [
  13561. (openBlock(true), createElementBlock(Fragment, null, renderList(row, (cell, key_) => {
  13562. return openBlock(), createElementBlock("td", {
  13563. key: key_,
  13564. class: normalizeClass(_ctx.getCellClasses(cell))
  13565. }, [
  13566. createVNode(_component_el_date_picker_cell, { cell }, null, 8, ["cell"])
  13567. ], 2);
  13568. }), 128))
  13569. ], 2);
  13570. }), 128))
  13571. ])
  13572. ], 34);
  13573. }
  13574. var DateTable = /* @__PURE__ */ _export_sfc$1(_sfc_main$E, [["render", _sfc_render$j], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/date-picker/src/date-picker-com/basic-date-table.vue"]]);
  13575. const datesInMonth = (year, month, lang) => {
  13576. const firstDay = dayjs().locale(lang).startOf("month").month(month).year(year);
  13577. const numOfDays = firstDay.daysInMonth();
  13578. return rangeArr(numOfDays).map((n) => firstDay.add(n, "day").toDate());
  13579. };
  13580. const _sfc_main$D = defineComponent({
  13581. props: {
  13582. disabledDate: {
  13583. type: Function
  13584. },
  13585. selectionMode: {
  13586. type: String,
  13587. default: "month"
  13588. },
  13589. minDate: {
  13590. type: Object
  13591. },
  13592. maxDate: {
  13593. type: Object
  13594. },
  13595. date: {
  13596. type: Object
  13597. },
  13598. parsedValue: {
  13599. type: Object
  13600. },
  13601. rangeState: {
  13602. type: Object,
  13603. default: () => ({
  13604. endDate: null,
  13605. selecting: false
  13606. })
  13607. }
  13608. },
  13609. emits: ["changerange", "pick", "select"],
  13610. setup(props, ctx) {
  13611. const { t, lang } = useLocale();
  13612. const months = ref(props.date.locale("en").localeData().monthsShort().map((_2) => _2.toLowerCase()));
  13613. const tableRows = ref([[], [], []]);
  13614. const lastRow = ref(null);
  13615. const lastColumn = ref(null);
  13616. const rows = computed(() => {
  13617. var _a2;
  13618. const rows2 = tableRows.value;
  13619. const now2 = dayjs().locale(lang.value).startOf("month");
  13620. for (let i = 0; i < 3; i++) {
  13621. const row = rows2[i];
  13622. for (let j = 0; j < 4; j++) {
  13623. let cell = row[j];
  13624. if (!cell) {
  13625. cell = {
  13626. row: i,
  13627. column: j,
  13628. type: "normal",
  13629. inRange: false,
  13630. start: false,
  13631. end: false
  13632. };
  13633. }
  13634. cell.type = "normal";
  13635. const index = i * 4 + j;
  13636. const calTime = props.date.startOf("year").month(index);
  13637. const calEndDate = props.rangeState.endDate || props.maxDate || props.rangeState.selecting && props.minDate;
  13638. cell.inRange = props.minDate && calTime.isSameOrAfter(props.minDate, "month") && calEndDate && calTime.isSameOrBefore(calEndDate, "month") || props.minDate && calTime.isSameOrBefore(props.minDate, "month") && calEndDate && calTime.isSameOrAfter(calEndDate, "month");
  13639. if ((_a2 = props.minDate) == null ? void 0 : _a2.isSameOrAfter(calEndDate)) {
  13640. cell.start = calEndDate && calTime.isSame(calEndDate, "month");
  13641. cell.end = props.minDate && calTime.isSame(props.minDate, "month");
  13642. } else {
  13643. cell.start = props.minDate && calTime.isSame(props.minDate, "month");
  13644. cell.end = calEndDate && calTime.isSame(calEndDate, "month");
  13645. }
  13646. const isToday = now2.isSame(calTime);
  13647. if (isToday) {
  13648. cell.type = "today";
  13649. }
  13650. cell.text = index;
  13651. const cellDate = calTime.toDate();
  13652. cell.disabled = props.disabledDate && props.disabledDate(cellDate);
  13653. row[j] = cell;
  13654. }
  13655. }
  13656. return rows2;
  13657. });
  13658. const getCellStyle = (cell) => {
  13659. const style = {};
  13660. const year = props.date.year();
  13661. const today = new Date();
  13662. const month = cell.text;
  13663. style.disabled = props.disabledDate ? datesInMonth(year, month, lang.value).every(props.disabledDate) : false;
  13664. style.current = castArray(props.parsedValue).findIndex((date4) => date4.year() === year && date4.month() === month) >= 0;
  13665. style.today = today.getFullYear() === year && today.getMonth() === month;
  13666. if (cell.inRange) {
  13667. style["in-range"] = true;
  13668. if (cell.start) {
  13669. style["start-date"] = true;
  13670. }
  13671. if (cell.end) {
  13672. style["end-date"] = true;
  13673. }
  13674. }
  13675. return style;
  13676. };
  13677. const handleMouseMove = (event) => {
  13678. if (!props.rangeState.selecting)
  13679. return;
  13680. let target = event.target;
  13681. if (target.tagName === "A") {
  13682. target = target.parentNode.parentNode;
  13683. }
  13684. if (target.tagName === "DIV") {
  13685. target = target.parentNode;
  13686. }
  13687. if (target.tagName !== "TD")
  13688. return;
  13689. const row = target.parentNode.rowIndex;
  13690. const column = target.cellIndex;
  13691. if (rows.value[row][column].disabled)
  13692. return;
  13693. if (row !== lastRow.value || column !== lastColumn.value) {
  13694. lastRow.value = row;
  13695. lastColumn.value = column;
  13696. ctx.emit("changerange", {
  13697. selecting: true,
  13698. endDate: props.date.startOf("year").month(row * 4 + column)
  13699. });
  13700. }
  13701. };
  13702. const handleMonthTableClick = (event) => {
  13703. let target = event.target;
  13704. if (target.tagName === "A") {
  13705. target = target.parentNode.parentNode;
  13706. }
  13707. if (target.tagName === "DIV") {
  13708. target = target.parentNode;
  13709. }
  13710. if (target.tagName !== "TD")
  13711. return;
  13712. if (hasClass(target, "disabled"))
  13713. return;
  13714. const column = target.cellIndex;
  13715. const row = target.parentNode.rowIndex;
  13716. const month = row * 4 + column;
  13717. const newDate = props.date.startOf("year").month(month);
  13718. if (props.selectionMode === "range") {
  13719. if (!props.rangeState.selecting) {
  13720. ctx.emit("pick", { minDate: newDate, maxDate: null });
  13721. ctx.emit("select", true);
  13722. } else {
  13723. if (newDate >= props.minDate) {
  13724. ctx.emit("pick", { minDate: props.minDate, maxDate: newDate });
  13725. } else {
  13726. ctx.emit("pick", { minDate: newDate, maxDate: props.minDate });
  13727. }
  13728. ctx.emit("select", false);
  13729. }
  13730. } else {
  13731. ctx.emit("pick", month);
  13732. }
  13733. };
  13734. return {
  13735. handleMouseMove,
  13736. handleMonthTableClick,
  13737. rows,
  13738. getCellStyle,
  13739. t,
  13740. months
  13741. };
  13742. }
  13743. });
  13744. const _hoisted_1$q = { class: "cell" };
  13745. function _sfc_render$i(_ctx, _cache, $props, $setup, $data, $options) {
  13746. return openBlock(), createElementBlock("table", {
  13747. class: "el-month-table",
  13748. onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleMonthTableClick && _ctx.handleMonthTableClick(...args)),
  13749. onMousemove: _cache[1] || (_cache[1] = (...args) => _ctx.handleMouseMove && _ctx.handleMouseMove(...args))
  13750. }, [
  13751. createElementVNode("tbody", null, [
  13752. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.rows, (row, key) => {
  13753. return openBlock(), createElementBlock("tr", { key }, [
  13754. (openBlock(true), createElementBlock(Fragment, null, renderList(row, (cell, key_) => {
  13755. return openBlock(), createElementBlock("td", {
  13756. key: key_,
  13757. class: normalizeClass(_ctx.getCellStyle(cell))
  13758. }, [
  13759. createElementVNode("div", null, [
  13760. createElementVNode("a", _hoisted_1$q, toDisplayString(_ctx.t("el.datepicker.months." + _ctx.months[cell.text])), 1)
  13761. ])
  13762. ], 2);
  13763. }), 128))
  13764. ]);
  13765. }), 128))
  13766. ])
  13767. ], 32);
  13768. }
  13769. var MonthTable = /* @__PURE__ */ _export_sfc$1(_sfc_main$D, [["render", _sfc_render$i], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/date-picker/src/date-picker-com/basic-month-table.vue"]]);
  13770. const datesInYear = (year, lang) => {
  13771. const firstDay = dayjs(String(year)).locale(lang).startOf("year");
  13772. const lastDay = firstDay.endOf("year");
  13773. const numOfDays = lastDay.dayOfYear();
  13774. return rangeArr(numOfDays).map((n) => firstDay.add(n, "day").toDate());
  13775. };
  13776. const _sfc_main$C = defineComponent({
  13777. props: {
  13778. disabledDate: {
  13779. type: Function
  13780. },
  13781. parsedValue: {
  13782. type: Object
  13783. },
  13784. date: {
  13785. type: Object
  13786. }
  13787. },
  13788. emits: ["pick"],
  13789. setup(props, ctx) {
  13790. const { lang } = useLocale();
  13791. const startYear = computed(() => {
  13792. return Math.floor(props.date.year() / 10) * 10;
  13793. });
  13794. const getCellStyle = (year) => {
  13795. const style = {};
  13796. const today = dayjs().locale(lang.value);
  13797. style.disabled = props.disabledDate ? datesInYear(year, lang.value).every(props.disabledDate) : false;
  13798. style.current = castArray(props.parsedValue).findIndex((_2) => _2.year() === year) >= 0;
  13799. style.today = today.year() === year;
  13800. return style;
  13801. };
  13802. const handleYearTableClick = (event) => {
  13803. const target = event.target;
  13804. if (target.tagName === "A") {
  13805. if (hasClass(target.parentNode, "disabled"))
  13806. return;
  13807. const year = target.textContent || target.innerText;
  13808. ctx.emit("pick", Number(year));
  13809. }
  13810. };
  13811. return {
  13812. startYear,
  13813. getCellStyle,
  13814. handleYearTableClick
  13815. };
  13816. }
  13817. });
  13818. const _hoisted_1$p = { class: "cell" };
  13819. const _hoisted_2$k = { class: "cell" };
  13820. const _hoisted_3$e = { class: "cell" };
  13821. const _hoisted_4$c = { class: "cell" };
  13822. const _hoisted_5$c = { class: "cell" };
  13823. const _hoisted_6$a = { class: "cell" };
  13824. const _hoisted_7$6 = { class: "cell" };
  13825. const _hoisted_8$5 = { class: "cell" };
  13826. const _hoisted_9$5 = { class: "cell" };
  13827. const _hoisted_10$5 = { class: "cell" };
  13828. const _hoisted_11$4 = /* @__PURE__ */ createElementVNode("td", null, null, -1);
  13829. const _hoisted_12$4 = /* @__PURE__ */ createElementVNode("td", null, null, -1);
  13830. function _sfc_render$h(_ctx, _cache, $props, $setup, $data, $options) {
  13831. return openBlock(), createElementBlock("table", {
  13832. class: "el-year-table",
  13833. onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleYearTableClick && _ctx.handleYearTableClick(...args))
  13834. }, [
  13835. createElementVNode("tbody", null, [
  13836. createElementVNode("tr", null, [
  13837. createElementVNode("td", {
  13838. class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 0)])
  13839. }, [
  13840. createElementVNode("a", _hoisted_1$p, toDisplayString(_ctx.startYear), 1)
  13841. ], 2),
  13842. createElementVNode("td", {
  13843. class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 1)])
  13844. }, [
  13845. createElementVNode("a", _hoisted_2$k, toDisplayString(_ctx.startYear + 1), 1)
  13846. ], 2),
  13847. createElementVNode("td", {
  13848. class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 2)])
  13849. }, [
  13850. createElementVNode("a", _hoisted_3$e, toDisplayString(_ctx.startYear + 2), 1)
  13851. ], 2),
  13852. createElementVNode("td", {
  13853. class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 3)])
  13854. }, [
  13855. createElementVNode("a", _hoisted_4$c, toDisplayString(_ctx.startYear + 3), 1)
  13856. ], 2)
  13857. ]),
  13858. createElementVNode("tr", null, [
  13859. createElementVNode("td", {
  13860. class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 4)])
  13861. }, [
  13862. createElementVNode("a", _hoisted_5$c, toDisplayString(_ctx.startYear + 4), 1)
  13863. ], 2),
  13864. createElementVNode("td", {
  13865. class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 5)])
  13866. }, [
  13867. createElementVNode("a", _hoisted_6$a, toDisplayString(_ctx.startYear + 5), 1)
  13868. ], 2),
  13869. createElementVNode("td", {
  13870. class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 6)])
  13871. }, [
  13872. createElementVNode("a", _hoisted_7$6, toDisplayString(_ctx.startYear + 6), 1)
  13873. ], 2),
  13874. createElementVNode("td", {
  13875. class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 7)])
  13876. }, [
  13877. createElementVNode("a", _hoisted_8$5, toDisplayString(_ctx.startYear + 7), 1)
  13878. ], 2)
  13879. ]),
  13880. createElementVNode("tr", null, [
  13881. createElementVNode("td", {
  13882. class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 8)])
  13883. }, [
  13884. createElementVNode("a", _hoisted_9$5, toDisplayString(_ctx.startYear + 8), 1)
  13885. ], 2),
  13886. createElementVNode("td", {
  13887. class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 9)])
  13888. }, [
  13889. createElementVNode("a", _hoisted_10$5, toDisplayString(_ctx.startYear + 9), 1)
  13890. ], 2),
  13891. _hoisted_11$4,
  13892. _hoisted_12$4
  13893. ])
  13894. ])
  13895. ]);
  13896. }
  13897. var YearTable = /* @__PURE__ */ _export_sfc$1(_sfc_main$C, [["render", _sfc_render$h], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/date-picker/src/date-picker-com/basic-year-table.vue"]]);
  13898. const timeWithinRange = (_2, __, ___) => true;
  13899. const _sfc_main$B = defineComponent({
  13900. components: {
  13901. DateTable,
  13902. ElInput,
  13903. ElButton,
  13904. ElIcon,
  13905. TimePickPanel,
  13906. MonthTable,
  13907. YearTable,
  13908. DArrowLeft: dArrowLeft,
  13909. ArrowLeft: arrowLeft,
  13910. DArrowRight: dArrowRight,
  13911. ArrowRight: arrowRight
  13912. },
  13913. directives: { clickoutside: ClickOutside },
  13914. props: {
  13915. visible: {
  13916. type: Boolean,
  13917. default: false
  13918. },
  13919. parsedValue: {
  13920. type: [Object, Array]
  13921. },
  13922. format: {
  13923. type: String,
  13924. default: ""
  13925. },
  13926. type: {
  13927. type: String,
  13928. required: true,
  13929. validator: isValidDatePickType
  13930. }
  13931. },
  13932. emits: ["pick", "set-picker-option", "panel-change"],
  13933. setup(props, ctx) {
  13934. const { t, lang } = useLocale();
  13935. const pickerBase = inject("EP_PICKER_BASE");
  13936. const popper2 = inject(TOOLTIP_INJECTION_KEY);
  13937. const {
  13938. shortcuts,
  13939. disabledDate,
  13940. cellClassName,
  13941. defaultTime,
  13942. arrowControl
  13943. } = pickerBase.props;
  13944. const defaultValue = toRef(pickerBase.props, "defaultValue");
  13945. const innerDate = ref(dayjs().locale(lang.value));
  13946. const defaultTimeD = computed(() => {
  13947. return dayjs(defaultTime).locale(lang.value);
  13948. });
  13949. const month = computed(() => {
  13950. return innerDate.value.month();
  13951. });
  13952. const year = computed(() => {
  13953. return innerDate.value.year();
  13954. });
  13955. const selectableRange = ref([]);
  13956. const userInputDate = ref(null);
  13957. const userInputTime = ref(null);
  13958. const checkDateWithinRange = (date4) => {
  13959. return selectableRange.value.length > 0 ? timeWithinRange(date4, selectableRange.value, props.format || "HH:mm:ss") : true;
  13960. };
  13961. const formatEmit = (emitDayjs) => {
  13962. if (defaultTime && !visibleTime.value) {
  13963. return defaultTimeD.value.year(emitDayjs.year()).month(emitDayjs.month()).date(emitDayjs.date());
  13964. }
  13965. if (showTime.value)
  13966. return emitDayjs.millisecond(0);
  13967. return emitDayjs.startOf("day");
  13968. };
  13969. const emit = (value, ...args) => {
  13970. if (!value) {
  13971. ctx.emit("pick", value, ...args);
  13972. } else if (Array.isArray(value)) {
  13973. const dates = value.map(formatEmit);
  13974. ctx.emit("pick", dates, ...args);
  13975. } else {
  13976. ctx.emit("pick", formatEmit(value), ...args);
  13977. }
  13978. userInputDate.value = null;
  13979. userInputTime.value = null;
  13980. };
  13981. const handleDatePick = (value) => {
  13982. if (selectionMode.value === "day") {
  13983. let newDate = props.parsedValue ? props.parsedValue.year(value.year()).month(value.month()).date(value.date()) : value;
  13984. if (!checkDateWithinRange(newDate)) {
  13985. newDate = selectableRange.value[0][0].year(value.year()).month(value.month()).date(value.date());
  13986. }
  13987. innerDate.value = newDate;
  13988. emit(newDate, showTime.value);
  13989. } else if (selectionMode.value === "week") {
  13990. emit(value.date);
  13991. } else if (selectionMode.value === "dates") {
  13992. emit(value, true);
  13993. }
  13994. };
  13995. const prevMonth_ = () => {
  13996. innerDate.value = innerDate.value.subtract(1, "month");
  13997. handlePanelChange("month");
  13998. };
  13999. const nextMonth_ = () => {
  14000. innerDate.value = innerDate.value.add(1, "month");
  14001. handlePanelChange("month");
  14002. };
  14003. const prevYear_ = () => {
  14004. if (currentView.value === "year") {
  14005. innerDate.value = innerDate.value.subtract(10, "year");
  14006. } else {
  14007. innerDate.value = innerDate.value.subtract(1, "year");
  14008. }
  14009. handlePanelChange("year");
  14010. };
  14011. const nextYear_ = () => {
  14012. if (currentView.value === "year") {
  14013. innerDate.value = innerDate.value.add(10, "year");
  14014. } else {
  14015. innerDate.value = innerDate.value.add(1, "year");
  14016. }
  14017. handlePanelChange("year");
  14018. };
  14019. const currentView = ref("date");
  14020. const yearLabel = computed(() => {
  14021. const yearTranslation = t("el.datepicker.year");
  14022. if (currentView.value === "year") {
  14023. const startYear = Math.floor(year.value / 10) * 10;
  14024. if (yearTranslation) {
  14025. return `${startYear} ${yearTranslation} - ${startYear + 9} ${yearTranslation}`;
  14026. }
  14027. return `${startYear} - ${startYear + 9}`;
  14028. }
  14029. return `${year.value} ${yearTranslation}`;
  14030. });
  14031. const handleShortcutClick = (shortcut) => {
  14032. const shortcutValue = typeof shortcut.value === "function" ? shortcut.value() : shortcut.value;
  14033. if (shortcutValue) {
  14034. emit(dayjs(shortcutValue).locale(lang.value));
  14035. return;
  14036. }
  14037. if (shortcut.onClick) {
  14038. shortcut.onClick(ctx);
  14039. }
  14040. };
  14041. const selectionMode = computed(() => {
  14042. if (["week", "month", "year", "dates"].includes(props.type)) {
  14043. return props.type;
  14044. }
  14045. return "day";
  14046. });
  14047. watch(() => selectionMode.value, (val) => {
  14048. if (["month", "year"].includes(val)) {
  14049. currentView.value = val;
  14050. return;
  14051. }
  14052. currentView.value = "date";
  14053. }, { immediate: true });
  14054. watch(() => currentView.value, () => {
  14055. popper2 == null ? void 0 : popper2.updatePopper();
  14056. });
  14057. const hasShortcuts = computed(() => !!shortcuts.length);
  14058. const handleMonthPick = (month2) => {
  14059. innerDate.value = innerDate.value.startOf("month").month(month2);
  14060. if (selectionMode.value === "month") {
  14061. emit(innerDate.value);
  14062. } else {
  14063. currentView.value = "date";
  14064. }
  14065. handlePanelChange("month");
  14066. };
  14067. const handleYearPick = (year2) => {
  14068. if (selectionMode.value === "year") {
  14069. innerDate.value = innerDate.value.startOf("year").year(year2);
  14070. emit(innerDate.value);
  14071. } else {
  14072. innerDate.value = innerDate.value.year(year2);
  14073. currentView.value = "month";
  14074. }
  14075. handlePanelChange("year");
  14076. };
  14077. const showMonthPicker = () => {
  14078. currentView.value = "month";
  14079. };
  14080. const showYearPicker = () => {
  14081. currentView.value = "year";
  14082. };
  14083. const showTime = computed(() => props.type === "datetime" || props.type === "datetimerange");
  14084. const footerVisible = computed(() => {
  14085. return showTime.value || selectionMode.value === "dates";
  14086. });
  14087. const onConfirm = () => {
  14088. if (selectionMode.value === "dates") {
  14089. emit(props.parsedValue);
  14090. } else {
  14091. let result = props.parsedValue;
  14092. if (!result) {
  14093. const defaultTimeD2 = dayjs(defaultTime).locale(lang.value);
  14094. const defaultValueD = getDefaultValue();
  14095. result = defaultTimeD2.year(defaultValueD.year()).month(defaultValueD.month()).date(defaultValueD.date());
  14096. }
  14097. innerDate.value = result;
  14098. emit(result);
  14099. }
  14100. };
  14101. const changeToNow = () => {
  14102. const now2 = dayjs().locale(lang.value);
  14103. const nowDate = now2.toDate();
  14104. if ((!disabledDate || !disabledDate(nowDate)) && checkDateWithinRange(nowDate)) {
  14105. innerDate.value = dayjs().locale(lang.value);
  14106. emit(innerDate.value);
  14107. }
  14108. };
  14109. const timeFormat = computed(() => {
  14110. return extractTimeFormat(props.format);
  14111. });
  14112. const dateFormat = computed(() => {
  14113. return extractDateFormat(props.format);
  14114. });
  14115. const visibleTime = computed(() => {
  14116. if (userInputTime.value)
  14117. return userInputTime.value;
  14118. if (!props.parsedValue && !defaultValue.value)
  14119. return;
  14120. return (props.parsedValue || innerDate.value).format(timeFormat.value);
  14121. });
  14122. const visibleDate = computed(() => {
  14123. if (userInputDate.value)
  14124. return userInputDate.value;
  14125. if (!props.parsedValue && !defaultValue.value)
  14126. return;
  14127. return (props.parsedValue || innerDate.value).format(dateFormat.value);
  14128. });
  14129. const timePickerVisible = ref(false);
  14130. const onTimePickerInputFocus = () => {
  14131. timePickerVisible.value = true;
  14132. };
  14133. const handleTimePickClose = () => {
  14134. timePickerVisible.value = false;
  14135. };
  14136. const handleTimePick = (value, visible, first) => {
  14137. const newDate = props.parsedValue ? props.parsedValue.hour(value.hour()).minute(value.minute()).second(value.second()) : value;
  14138. innerDate.value = newDate;
  14139. emit(innerDate.value, true);
  14140. if (!first) {
  14141. timePickerVisible.value = visible;
  14142. }
  14143. };
  14144. const handleVisibleTimeChange = (value) => {
  14145. const newDate = dayjs(value, timeFormat.value).locale(lang.value);
  14146. if (newDate.isValid() && checkDateWithinRange(newDate)) {
  14147. innerDate.value = newDate.year(innerDate.value.year()).month(innerDate.value.month()).date(innerDate.value.date());
  14148. userInputTime.value = null;
  14149. timePickerVisible.value = false;
  14150. emit(innerDate.value, true);
  14151. }
  14152. };
  14153. const handleVisibleDateChange = (value) => {
  14154. const newDate = dayjs(value, dateFormat.value).locale(lang.value);
  14155. if (newDate.isValid()) {
  14156. if (disabledDate && disabledDate(newDate.toDate())) {
  14157. return;
  14158. }
  14159. innerDate.value = newDate.hour(innerDate.value.hour()).minute(innerDate.value.minute()).second(innerDate.value.second());
  14160. userInputDate.value = null;
  14161. emit(innerDate.value, true);
  14162. }
  14163. };
  14164. const isValidValue = (date4) => {
  14165. return dayjs.isDayjs(date4) && date4.isValid() && (disabledDate ? !disabledDate(date4.toDate()) : true);
  14166. };
  14167. const formatToString = (value) => {
  14168. if (selectionMode.value === "dates") {
  14169. return value.map((_2) => _2.format(props.format));
  14170. }
  14171. return value.format(props.format);
  14172. };
  14173. const parseUserInput = (value) => {
  14174. return dayjs(value, props.format).locale(lang.value);
  14175. };
  14176. const getDefaultValue = () => {
  14177. const parseDate = dayjs(defaultValue.value).locale(lang.value);
  14178. if (!defaultValue.value) {
  14179. const defaultTimeDValue = defaultTimeD.value;
  14180. return dayjs().hour(defaultTimeDValue.hour()).minute(defaultTimeDValue.minute()).second(defaultTimeDValue.second()).locale(lang.value);
  14181. }
  14182. return parseDate;
  14183. };
  14184. const handleKeydown = (event) => {
  14185. const { code, keyCode } = event;
  14186. const list = [
  14187. EVENT_CODE.up,
  14188. EVENT_CODE.down,
  14189. EVENT_CODE.left,
  14190. EVENT_CODE.right
  14191. ];
  14192. if (props.visible && !timePickerVisible.value) {
  14193. if (list.includes(code)) {
  14194. handleKeyControl(keyCode);
  14195. event.stopPropagation();
  14196. event.preventDefault();
  14197. }
  14198. if (code === EVENT_CODE.enter && userInputDate.value === null && userInputTime.value === null) {
  14199. emit(innerDate, false);
  14200. }
  14201. }
  14202. };
  14203. const handleKeyControl = (keyCode) => {
  14204. const mapping = {
  14205. year: {
  14206. 38: -4,
  14207. 40: 4,
  14208. 37: -1,
  14209. 39: 1,
  14210. offset: (date4, step) => date4.setFullYear(date4.getFullYear() + step)
  14211. },
  14212. month: {
  14213. 38: -4,
  14214. 40: 4,
  14215. 37: -1,
  14216. 39: 1,
  14217. offset: (date4, step) => date4.setMonth(date4.getMonth() + step)
  14218. },
  14219. week: {
  14220. 38: -1,
  14221. 40: 1,
  14222. 37: -1,
  14223. 39: 1,
  14224. offset: (date4, step) => date4.setDate(date4.getDate() + step * 7)
  14225. },
  14226. day: {
  14227. 38: -7,
  14228. 40: 7,
  14229. 37: -1,
  14230. 39: 1,
  14231. offset: (date4, step) => date4.setDate(date4.getDate() + step)
  14232. }
  14233. };
  14234. const newDate = innerDate.value.toDate();
  14235. while (Math.abs(innerDate.value.diff(newDate, "year", true)) < 1) {
  14236. const map = mapping[selectionMode.value];
  14237. map.offset(newDate, map[keyCode]);
  14238. if (disabledDate && disabledDate(newDate)) {
  14239. continue;
  14240. }
  14241. const result = dayjs(newDate).locale(lang.value);
  14242. innerDate.value = result;
  14243. ctx.emit("pick", result, true);
  14244. break;
  14245. }
  14246. };
  14247. const handlePanelChange = (mode) => {
  14248. ctx.emit("panel-change", innerDate.value.toDate(), mode, currentView.value);
  14249. };
  14250. ctx.emit("set-picker-option", ["isValidValue", isValidValue]);
  14251. ctx.emit("set-picker-option", ["formatToString", formatToString]);
  14252. ctx.emit("set-picker-option", ["parseUserInput", parseUserInput]);
  14253. ctx.emit("set-picker-option", ["handleKeydown", handleKeydown]);
  14254. watch(() => defaultValue.value, (val) => {
  14255. if (val) {
  14256. innerDate.value = getDefaultValue();
  14257. }
  14258. }, { immediate: true });
  14259. watch(() => props.parsedValue, (val) => {
  14260. if (val) {
  14261. if (selectionMode.value === "dates")
  14262. return;
  14263. if (Array.isArray(val))
  14264. return;
  14265. innerDate.value = val;
  14266. } else {
  14267. innerDate.value = getDefaultValue();
  14268. }
  14269. }, { immediate: true });
  14270. return {
  14271. handleTimePick,
  14272. handleTimePickClose,
  14273. onTimePickerInputFocus,
  14274. timePickerVisible,
  14275. visibleTime,
  14276. visibleDate,
  14277. showTime,
  14278. changeToNow,
  14279. onConfirm,
  14280. footerVisible,
  14281. handleYearPick,
  14282. showMonthPicker,
  14283. showYearPicker,
  14284. handleMonthPick,
  14285. hasShortcuts,
  14286. shortcuts,
  14287. arrowControl,
  14288. disabledDate,
  14289. cellClassName,
  14290. selectionMode,
  14291. handleShortcutClick,
  14292. prevYear_,
  14293. nextYear_,
  14294. prevMonth_,
  14295. nextMonth_,
  14296. innerDate,
  14297. t,
  14298. yearLabel,
  14299. currentView,
  14300. month,
  14301. handleDatePick,
  14302. handleVisibleTimeChange,
  14303. handleVisibleDateChange,
  14304. timeFormat,
  14305. userInputTime,
  14306. userInputDate
  14307. };
  14308. }
  14309. });
  14310. const _hoisted_1$o = { class: "el-picker-panel__body-wrapper" };
  14311. const _hoisted_2$j = {
  14312. key: 0,
  14313. class: "el-picker-panel__sidebar"
  14314. };
  14315. const _hoisted_3$d = ["onClick"];
  14316. const _hoisted_4$b = { class: "el-picker-panel__body" };
  14317. const _hoisted_5$b = {
  14318. key: 0,
  14319. class: "el-date-picker__time-header"
  14320. };
  14321. const _hoisted_6$9 = { class: "el-date-picker__editor-wrap" };
  14322. const _hoisted_7$5 = { class: "el-date-picker__editor-wrap" };
  14323. const _hoisted_8$4 = ["aria-label"];
  14324. const _hoisted_9$4 = ["aria-label"];
  14325. const _hoisted_10$4 = ["aria-label"];
  14326. const _hoisted_11$3 = ["aria-label"];
  14327. const _hoisted_12$3 = { class: "el-picker-panel__content" };
  14328. const _hoisted_13$3 = { class: "el-picker-panel__footer" };
  14329. function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) {
  14330. const _component_el_input = resolveComponent("el-input");
  14331. const _component_time_pick_panel = resolveComponent("time-pick-panel");
  14332. const _component_d_arrow_left = resolveComponent("d-arrow-left");
  14333. const _component_el_icon = resolveComponent("el-icon");
  14334. const _component_arrow_left = resolveComponent("arrow-left");
  14335. const _component_d_arrow_right = resolveComponent("d-arrow-right");
  14336. const _component_arrow_right = resolveComponent("arrow-right");
  14337. const _component_date_table = resolveComponent("date-table");
  14338. const _component_year_table = resolveComponent("year-table");
  14339. const _component_month_table = resolveComponent("month-table");
  14340. const _component_el_button = resolveComponent("el-button");
  14341. const _directive_clickoutside = resolveDirective("clickoutside");
  14342. return openBlock(), createElementBlock("div", {
  14343. class: normalizeClass(["el-picker-panel el-date-picker", [
  14344. {
  14345. "has-sidebar": _ctx.$slots.sidebar || _ctx.hasShortcuts,
  14346. "has-time": _ctx.showTime
  14347. }
  14348. ]])
  14349. }, [
  14350. createElementVNode("div", _hoisted_1$o, [
  14351. renderSlot(_ctx.$slots, "sidebar", { class: "el-picker-panel__sidebar" }),
  14352. _ctx.hasShortcuts ? (openBlock(), createElementBlock("div", _hoisted_2$j, [
  14353. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.shortcuts, (shortcut, key) => {
  14354. return openBlock(), createElementBlock("button", {
  14355. key,
  14356. type: "button",
  14357. class: "el-picker-panel__shortcut",
  14358. onClick: ($event) => _ctx.handleShortcutClick(shortcut)
  14359. }, toDisplayString(shortcut.text), 9, _hoisted_3$d);
  14360. }), 128))
  14361. ])) : createCommentVNode("v-if", true),
  14362. createElementVNode("div", _hoisted_4$b, [
  14363. _ctx.showTime ? (openBlock(), createElementBlock("div", _hoisted_5$b, [
  14364. createElementVNode("span", _hoisted_6$9, [
  14365. createVNode(_component_el_input, {
  14366. placeholder: _ctx.t("el.datepicker.selectDate"),
  14367. "model-value": _ctx.visibleDate,
  14368. size: "small",
  14369. onInput: _cache[0] || (_cache[0] = (val) => _ctx.userInputDate = val),
  14370. onChange: _ctx.handleVisibleDateChange
  14371. }, null, 8, ["placeholder", "model-value", "onChange"])
  14372. ]),
  14373. withDirectives((openBlock(), createElementBlock("span", _hoisted_7$5, [
  14374. createVNode(_component_el_input, {
  14375. placeholder: _ctx.t("el.datepicker.selectTime"),
  14376. "model-value": _ctx.visibleTime,
  14377. size: "small",
  14378. onFocus: _ctx.onTimePickerInputFocus,
  14379. onInput: _cache[1] || (_cache[1] = (val) => _ctx.userInputTime = val),
  14380. onChange: _ctx.handleVisibleTimeChange
  14381. }, null, 8, ["placeholder", "model-value", "onFocus", "onChange"]),
  14382. createVNode(_component_time_pick_panel, {
  14383. visible: _ctx.timePickerVisible,
  14384. format: _ctx.timeFormat,
  14385. "time-arrow-control": _ctx.arrowControl,
  14386. "parsed-value": _ctx.innerDate,
  14387. onPick: _ctx.handleTimePick
  14388. }, null, 8, ["visible", "format", "time-arrow-control", "parsed-value", "onPick"])
  14389. ])), [
  14390. [_directive_clickoutside, _ctx.handleTimePickClose]
  14391. ])
  14392. ])) : createCommentVNode("v-if", true),
  14393. withDirectives(createElementVNode("div", {
  14394. class: normalizeClass(["el-date-picker__header", {
  14395. "el-date-picker__header--bordered": _ctx.currentView === "year" || _ctx.currentView === "month"
  14396. }])
  14397. }, [
  14398. createElementVNode("button", {
  14399. type: "button",
  14400. "aria-label": _ctx.t(`el.datepicker.prevYear`),
  14401. class: "el-picker-panel__icon-btn el-date-picker__prev-btn d-arrow-left",
  14402. onClick: _cache[2] || (_cache[2] = (...args) => _ctx.prevYear_ && _ctx.prevYear_(...args))
  14403. }, [
  14404. createVNode(_component_el_icon, null, {
  14405. default: withCtx(() => [
  14406. createVNode(_component_d_arrow_left)
  14407. ]),
  14408. _: 1
  14409. })
  14410. ], 8, _hoisted_8$4),
  14411. withDirectives(createElementVNode("button", {
  14412. type: "button",
  14413. "aria-label": _ctx.t(`el.datepicker.prevMonth`),
  14414. class: "el-picker-panel__icon-btn el-date-picker__prev-btn arrow-left",
  14415. onClick: _cache[3] || (_cache[3] = (...args) => _ctx.prevMonth_ && _ctx.prevMonth_(...args))
  14416. }, [
  14417. createVNode(_component_el_icon, null, {
  14418. default: withCtx(() => [
  14419. createVNode(_component_arrow_left)
  14420. ]),
  14421. _: 1
  14422. })
  14423. ], 8, _hoisted_9$4), [
  14424. [vShow, _ctx.currentView === "date"]
  14425. ]),
  14426. createElementVNode("span", {
  14427. role: "button",
  14428. class: "el-date-picker__header-label",
  14429. onClick: _cache[4] || (_cache[4] = (...args) => _ctx.showYearPicker && _ctx.showYearPicker(...args))
  14430. }, toDisplayString(_ctx.yearLabel), 1),
  14431. withDirectives(createElementVNode("span", {
  14432. role: "button",
  14433. class: normalizeClass(["el-date-picker__header-label", { active: _ctx.currentView === "month" }]),
  14434. onClick: _cache[5] || (_cache[5] = (...args) => _ctx.showMonthPicker && _ctx.showMonthPicker(...args))
  14435. }, toDisplayString(_ctx.t(`el.datepicker.month${_ctx.month + 1}`)), 3), [
  14436. [vShow, _ctx.currentView === "date"]
  14437. ]),
  14438. createElementVNode("button", {
  14439. type: "button",
  14440. "aria-label": _ctx.t(`el.datepicker.nextYear`),
  14441. class: "el-picker-panel__icon-btn el-date-picker__next-btn d-arrow-right",
  14442. onClick: _cache[6] || (_cache[6] = (...args) => _ctx.nextYear_ && _ctx.nextYear_(...args))
  14443. }, [
  14444. createVNode(_component_el_icon, null, {
  14445. default: withCtx(() => [
  14446. createVNode(_component_d_arrow_right)
  14447. ]),
  14448. _: 1
  14449. })
  14450. ], 8, _hoisted_10$4),
  14451. withDirectives(createElementVNode("button", {
  14452. type: "button",
  14453. "aria-label": _ctx.t(`el.datepicker.nextMonth`),
  14454. class: "el-picker-panel__icon-btn el-date-picker__next-btn arrow-right",
  14455. onClick: _cache[7] || (_cache[7] = (...args) => _ctx.nextMonth_ && _ctx.nextMonth_(...args))
  14456. }, [
  14457. createVNode(_component_el_icon, null, {
  14458. default: withCtx(() => [
  14459. createVNode(_component_arrow_right)
  14460. ]),
  14461. _: 1
  14462. })
  14463. ], 8, _hoisted_11$3), [
  14464. [vShow, _ctx.currentView === "date"]
  14465. ])
  14466. ], 2), [
  14467. [vShow, _ctx.currentView !== "time"]
  14468. ]),
  14469. createElementVNode("div", _hoisted_12$3, [
  14470. _ctx.currentView === "date" ? (openBlock(), createBlock(_component_date_table, {
  14471. key: 0,
  14472. "selection-mode": _ctx.selectionMode,
  14473. date: _ctx.innerDate,
  14474. "parsed-value": _ctx.parsedValue,
  14475. "disabled-date": _ctx.disabledDate,
  14476. "cell-class-name": _ctx.cellClassName,
  14477. onPick: _ctx.handleDatePick
  14478. }, null, 8, ["selection-mode", "date", "parsed-value", "disabled-date", "cell-class-name", "onPick"])) : createCommentVNode("v-if", true),
  14479. _ctx.currentView === "year" ? (openBlock(), createBlock(_component_year_table, {
  14480. key: 1,
  14481. date: _ctx.innerDate,
  14482. "disabled-date": _ctx.disabledDate,
  14483. "parsed-value": _ctx.parsedValue,
  14484. onPick: _ctx.handleYearPick
  14485. }, null, 8, ["date", "disabled-date", "parsed-value", "onPick"])) : createCommentVNode("v-if", true),
  14486. _ctx.currentView === "month" ? (openBlock(), createBlock(_component_month_table, {
  14487. key: 2,
  14488. date: _ctx.innerDate,
  14489. "parsed-value": _ctx.parsedValue,
  14490. "disabled-date": _ctx.disabledDate,
  14491. onPick: _ctx.handleMonthPick
  14492. }, null, 8, ["date", "parsed-value", "disabled-date", "onPick"])) : createCommentVNode("v-if", true)
  14493. ])
  14494. ])
  14495. ]),
  14496. withDirectives(createElementVNode("div", _hoisted_13$3, [
  14497. withDirectives(createVNode(_component_el_button, {
  14498. size: "small",
  14499. type: "text",
  14500. class: "el-picker-panel__link-btn",
  14501. onClick: _ctx.changeToNow
  14502. }, {
  14503. default: withCtx(() => [
  14504. createTextVNode(toDisplayString(_ctx.t("el.datepicker.now")), 1)
  14505. ]),
  14506. _: 1
  14507. }, 8, ["onClick"]), [
  14508. [vShow, _ctx.selectionMode !== "dates"]
  14509. ]),
  14510. createVNode(_component_el_button, {
  14511. plain: "",
  14512. size: "small",
  14513. class: "el-picker-panel__link-btn",
  14514. onClick: _ctx.onConfirm
  14515. }, {
  14516. default: withCtx(() => [
  14517. createTextVNode(toDisplayString(_ctx.t("el.datepicker.confirm")), 1)
  14518. ]),
  14519. _: 1
  14520. }, 8, ["onClick"])
  14521. ], 512), [
  14522. [vShow, _ctx.footerVisible && _ctx.currentView === "date"]
  14523. ])
  14524. ], 2);
  14525. }
  14526. var DatePickPanel = /* @__PURE__ */ _export_sfc$1(_sfc_main$B, [["render", _sfc_render$g], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/date-picker/src/date-picker-com/panel-date-pick.vue"]]);
  14527. const _sfc_main$A = defineComponent({
  14528. directives: { clickoutside: ClickOutside },
  14529. components: {
  14530. TimePickPanel,
  14531. DateTable,
  14532. ElInput,
  14533. ElButton,
  14534. ElIcon,
  14535. DArrowLeft: dArrowLeft,
  14536. ArrowLeft: arrowLeft,
  14537. DArrowRight: dArrowRight,
  14538. ArrowRight: arrowRight
  14539. },
  14540. props: {
  14541. unlinkPanels: Boolean,
  14542. parsedValue: {
  14543. type: Array
  14544. },
  14545. type: {
  14546. type: String,
  14547. required: true,
  14548. validator: isValidDatePickType
  14549. }
  14550. },
  14551. emits: ["pick", "set-picker-option", "calendar-change", "panel-change"],
  14552. setup(props, ctx) {
  14553. const { t, lang } = useLocale();
  14554. const leftDate = ref(dayjs().locale(lang.value));
  14555. const rightDate = ref(dayjs().locale(lang.value).add(1, "month"));
  14556. const minDate = ref(null);
  14557. const maxDate = ref(null);
  14558. const dateUserInput = ref({
  14559. min: null,
  14560. max: null
  14561. });
  14562. const timeUserInput = ref({
  14563. min: null,
  14564. max: null
  14565. });
  14566. const leftLabel = computed(() => {
  14567. return `${leftDate.value.year()} ${t("el.datepicker.year")} ${t(`el.datepicker.month${leftDate.value.month() + 1}`)}`;
  14568. });
  14569. const rightLabel = computed(() => {
  14570. return `${rightDate.value.year()} ${t("el.datepicker.year")} ${t(`el.datepicker.month${rightDate.value.month() + 1}`)}`;
  14571. });
  14572. const leftYear = computed(() => {
  14573. return leftDate.value.year();
  14574. });
  14575. const leftMonth = computed(() => {
  14576. return leftDate.value.month();
  14577. });
  14578. const rightYear = computed(() => {
  14579. return rightDate.value.year();
  14580. });
  14581. const rightMonth = computed(() => {
  14582. return rightDate.value.month();
  14583. });
  14584. const hasShortcuts = computed(() => !!shortcuts.length);
  14585. const minVisibleDate = computed(() => {
  14586. if (dateUserInput.value.min !== null)
  14587. return dateUserInput.value.min;
  14588. if (minDate.value)
  14589. return minDate.value.format(dateFormat.value);
  14590. return "";
  14591. });
  14592. const maxVisibleDate = computed(() => {
  14593. if (dateUserInput.value.max !== null)
  14594. return dateUserInput.value.max;
  14595. if (maxDate.value || minDate.value)
  14596. return (maxDate.value || minDate.value).format(dateFormat.value);
  14597. return "";
  14598. });
  14599. const minVisibleTime = computed(() => {
  14600. if (timeUserInput.value.min !== null)
  14601. return timeUserInput.value.min;
  14602. if (minDate.value)
  14603. return minDate.value.format(timeFormat.value);
  14604. return "";
  14605. });
  14606. const maxVisibleTime = computed(() => {
  14607. if (timeUserInput.value.max !== null)
  14608. return timeUserInput.value.max;
  14609. if (maxDate.value || minDate.value)
  14610. return (maxDate.value || minDate.value).format(timeFormat.value);
  14611. return "";
  14612. });
  14613. const timeFormat = computed(() => {
  14614. return extractTimeFormat(format2);
  14615. });
  14616. const dateFormat = computed(() => {
  14617. return extractDateFormat(format2);
  14618. });
  14619. const leftPrevYear = () => {
  14620. leftDate.value = leftDate.value.subtract(1, "year");
  14621. if (!props.unlinkPanels) {
  14622. rightDate.value = leftDate.value.add(1, "month");
  14623. }
  14624. handlePanelChange("year");
  14625. };
  14626. const leftPrevMonth = () => {
  14627. leftDate.value = leftDate.value.subtract(1, "month");
  14628. if (!props.unlinkPanels) {
  14629. rightDate.value = leftDate.value.add(1, "month");
  14630. }
  14631. handlePanelChange("month");
  14632. };
  14633. const rightNextYear = () => {
  14634. if (!props.unlinkPanels) {
  14635. leftDate.value = leftDate.value.add(1, "year");
  14636. rightDate.value = leftDate.value.add(1, "month");
  14637. } else {
  14638. rightDate.value = rightDate.value.add(1, "year");
  14639. }
  14640. handlePanelChange("year");
  14641. };
  14642. const rightNextMonth = () => {
  14643. if (!props.unlinkPanels) {
  14644. leftDate.value = leftDate.value.add(1, "month");
  14645. rightDate.value = leftDate.value.add(1, "month");
  14646. } else {
  14647. rightDate.value = rightDate.value.add(1, "month");
  14648. }
  14649. handlePanelChange("month");
  14650. };
  14651. const leftNextYear = () => {
  14652. leftDate.value = leftDate.value.add(1, "year");
  14653. handlePanelChange("year");
  14654. };
  14655. const leftNextMonth = () => {
  14656. leftDate.value = leftDate.value.add(1, "month");
  14657. handlePanelChange("month");
  14658. };
  14659. const rightPrevYear = () => {
  14660. rightDate.value = rightDate.value.subtract(1, "year");
  14661. handlePanelChange("year");
  14662. };
  14663. const rightPrevMonth = () => {
  14664. rightDate.value = rightDate.value.subtract(1, "month");
  14665. handlePanelChange("month");
  14666. };
  14667. const handlePanelChange = (mode) => {
  14668. ctx.emit("panel-change", [leftDate.value.toDate(), rightDate.value.toDate()], mode);
  14669. };
  14670. const enableMonthArrow = computed(() => {
  14671. const nextMonth = (leftMonth.value + 1) % 12;
  14672. const yearOffset = leftMonth.value + 1 >= 12 ? 1 : 0;
  14673. return props.unlinkPanels && new Date(leftYear.value + yearOffset, nextMonth) < new Date(rightYear.value, rightMonth.value);
  14674. });
  14675. const enableYearArrow = computed(() => {
  14676. return props.unlinkPanels && rightYear.value * 12 + rightMonth.value - (leftYear.value * 12 + leftMonth.value + 1) >= 12;
  14677. });
  14678. const isValidValue = (value) => {
  14679. return Array.isArray(value) && value[0] && value[1] && value[0].valueOf() <= value[1].valueOf();
  14680. };
  14681. const rangeState = ref({
  14682. endDate: null,
  14683. selecting: false
  14684. });
  14685. const btnDisabled = computed(() => {
  14686. return !(minDate.value && maxDate.value && !rangeState.value.selecting && isValidValue([minDate.value, maxDate.value]));
  14687. });
  14688. const handleChangeRange = (val) => {
  14689. rangeState.value = val;
  14690. };
  14691. const onSelect = (selecting) => {
  14692. rangeState.value.selecting = selecting;
  14693. if (!selecting) {
  14694. rangeState.value.endDate = null;
  14695. }
  14696. };
  14697. const showTime = computed(() => props.type === "datetime" || props.type === "datetimerange");
  14698. const handleConfirm = (visible = false) => {
  14699. if (isValidValue([minDate.value, maxDate.value])) {
  14700. ctx.emit("pick", [minDate.value, maxDate.value], visible);
  14701. }
  14702. };
  14703. const formatEmit = (emitDayjs, index) => {
  14704. if (!emitDayjs)
  14705. return;
  14706. if (defaultTime) {
  14707. const defaultTimeD = dayjs(defaultTime[index] || defaultTime).locale(lang.value);
  14708. return defaultTimeD.year(emitDayjs.year()).month(emitDayjs.month()).date(emitDayjs.date());
  14709. }
  14710. return emitDayjs;
  14711. };
  14712. const handleRangePick = (val, close2 = true) => {
  14713. const min_ = val.minDate;
  14714. const max_ = val.maxDate;
  14715. const minDate_ = formatEmit(min_, 0);
  14716. const maxDate_ = formatEmit(max_, 1);
  14717. if (maxDate.value === maxDate_ && minDate.value === minDate_) {
  14718. return;
  14719. }
  14720. ctx.emit("calendar-change", [min_.toDate(), max_ && max_.toDate()]);
  14721. maxDate.value = maxDate_;
  14722. minDate.value = minDate_;
  14723. if (!close2 || showTime.value)
  14724. return;
  14725. handleConfirm();
  14726. };
  14727. const handleShortcutClick = (shortcut) => {
  14728. const shortcutValues = typeof shortcut.value === "function" ? shortcut.value() : shortcut.value;
  14729. if (shortcutValues) {
  14730. ctx.emit("pick", [
  14731. dayjs(shortcutValues[0]).locale(lang.value),
  14732. dayjs(shortcutValues[1]).locale(lang.value)
  14733. ]);
  14734. return;
  14735. }
  14736. if (shortcut.onClick) {
  14737. shortcut.onClick(ctx);
  14738. }
  14739. };
  14740. const minTimePickerVisible = ref(false);
  14741. const maxTimePickerVisible = ref(false);
  14742. const handleMinTimeClose = () => {
  14743. minTimePickerVisible.value = false;
  14744. };
  14745. const handleMaxTimeClose = () => {
  14746. maxTimePickerVisible.value = false;
  14747. };
  14748. const handleDateInput = (value, type4) => {
  14749. dateUserInput.value[type4] = value;
  14750. const parsedValueD = dayjs(value, dateFormat.value).locale(lang.value);
  14751. if (parsedValueD.isValid()) {
  14752. if (disabledDate && disabledDate(parsedValueD.toDate())) {
  14753. return;
  14754. }
  14755. if (type4 === "min") {
  14756. leftDate.value = parsedValueD;
  14757. minDate.value = (minDate.value || leftDate.value).year(parsedValueD.year()).month(parsedValueD.month()).date(parsedValueD.date());
  14758. if (!props.unlinkPanels) {
  14759. rightDate.value = parsedValueD.add(1, "month");
  14760. maxDate.value = minDate.value.add(1, "month");
  14761. }
  14762. } else {
  14763. rightDate.value = parsedValueD;
  14764. maxDate.value = (maxDate.value || rightDate.value).year(parsedValueD.year()).month(parsedValueD.month()).date(parsedValueD.date());
  14765. if (!props.unlinkPanels) {
  14766. leftDate.value = parsedValueD.subtract(1, "month");
  14767. minDate.value = maxDate.value.subtract(1, "month");
  14768. }
  14769. }
  14770. }
  14771. };
  14772. const handleDateChange = (_2, type4) => {
  14773. dateUserInput.value[type4] = null;
  14774. };
  14775. const handleTimeInput = (value, type4) => {
  14776. timeUserInput.value[type4] = value;
  14777. const parsedValueD = dayjs(value, timeFormat.value).locale(lang.value);
  14778. if (parsedValueD.isValid()) {
  14779. if (type4 === "min") {
  14780. minTimePickerVisible.value = true;
  14781. minDate.value = (minDate.value || leftDate.value).hour(parsedValueD.hour()).minute(parsedValueD.minute()).second(parsedValueD.second());
  14782. if (!maxDate.value || maxDate.value.isBefore(minDate.value)) {
  14783. maxDate.value = minDate.value;
  14784. }
  14785. } else {
  14786. maxTimePickerVisible.value = true;
  14787. maxDate.value = (maxDate.value || rightDate.value).hour(parsedValueD.hour()).minute(parsedValueD.minute()).second(parsedValueD.second());
  14788. rightDate.value = maxDate.value;
  14789. if (maxDate.value && maxDate.value.isBefore(minDate.value)) {
  14790. minDate.value = maxDate.value;
  14791. }
  14792. }
  14793. }
  14794. };
  14795. const handleTimeChange = (value, type4) => {
  14796. timeUserInput.value[type4] = null;
  14797. if (type4 === "min") {
  14798. leftDate.value = minDate.value;
  14799. minTimePickerVisible.value = false;
  14800. } else {
  14801. rightDate.value = maxDate.value;
  14802. maxTimePickerVisible.value = false;
  14803. }
  14804. };
  14805. const handleMinTimePick = (value, visible, first) => {
  14806. if (timeUserInput.value.min)
  14807. return;
  14808. if (value) {
  14809. leftDate.value = value;
  14810. minDate.value = (minDate.value || leftDate.value).hour(value.hour()).minute(value.minute()).second(value.second());
  14811. }
  14812. if (!first) {
  14813. minTimePickerVisible.value = visible;
  14814. }
  14815. if (!maxDate.value || maxDate.value.isBefore(minDate.value)) {
  14816. maxDate.value = minDate.value;
  14817. rightDate.value = value;
  14818. }
  14819. };
  14820. const handleMaxTimePick = (value, visible, first) => {
  14821. if (timeUserInput.value.max)
  14822. return;
  14823. if (value) {
  14824. rightDate.value = value;
  14825. maxDate.value = (maxDate.value || rightDate.value).hour(value.hour()).minute(value.minute()).second(value.second());
  14826. }
  14827. if (!first) {
  14828. maxTimePickerVisible.value = visible;
  14829. }
  14830. if (maxDate.value && maxDate.value.isBefore(minDate.value)) {
  14831. minDate.value = maxDate.value;
  14832. }
  14833. };
  14834. const handleClear = () => {
  14835. leftDate.value = getDefaultValue()[0];
  14836. rightDate.value = leftDate.value.add(1, "month");
  14837. ctx.emit("pick", null);
  14838. };
  14839. const formatToString = (value) => {
  14840. return Array.isArray(value) ? value.map((_2) => _2.format(format2)) : value.format(format2);
  14841. };
  14842. const parseUserInput = (value) => {
  14843. return Array.isArray(value) ? value.map((_2) => dayjs(_2, format2).locale(lang.value)) : dayjs(value, format2).locale(lang.value);
  14844. };
  14845. const getDefaultValue = () => {
  14846. let start2;
  14847. if (Array.isArray(defaultValue.value)) {
  14848. const left2 = dayjs(defaultValue.value[0]);
  14849. let right2 = dayjs(defaultValue.value[1]);
  14850. if (!props.unlinkPanels) {
  14851. right2 = left2.add(1, "month");
  14852. }
  14853. return [left2, right2];
  14854. } else if (defaultValue.value) {
  14855. start2 = dayjs(defaultValue.value);
  14856. } else {
  14857. start2 = dayjs();
  14858. }
  14859. start2 = start2.locale(lang.value);
  14860. return [start2, start2.add(1, "month")];
  14861. };
  14862. ctx.emit("set-picker-option", ["isValidValue", isValidValue]);
  14863. ctx.emit("set-picker-option", ["parseUserInput", parseUserInput]);
  14864. ctx.emit("set-picker-option", ["formatToString", formatToString]);
  14865. ctx.emit("set-picker-option", ["handleClear", handleClear]);
  14866. const pickerBase = inject("EP_PICKER_BASE");
  14867. const {
  14868. shortcuts,
  14869. disabledDate,
  14870. cellClassName,
  14871. format: format2,
  14872. defaultTime,
  14873. arrowControl,
  14874. clearable
  14875. } = pickerBase.props;
  14876. const defaultValue = toRef(pickerBase.props, "defaultValue");
  14877. watch(() => defaultValue.value, (val) => {
  14878. if (val) {
  14879. const defaultArr = getDefaultValue();
  14880. minDate.value = null;
  14881. maxDate.value = null;
  14882. leftDate.value = defaultArr[0];
  14883. rightDate.value = defaultArr[1];
  14884. }
  14885. }, { immediate: true });
  14886. watch(() => props.parsedValue, (newVal) => {
  14887. if (newVal && newVal.length === 2) {
  14888. minDate.value = newVal[0];
  14889. maxDate.value = newVal[1];
  14890. leftDate.value = minDate.value;
  14891. if (props.unlinkPanels && maxDate.value) {
  14892. const minDateYear = minDate.value.year();
  14893. const minDateMonth = minDate.value.month();
  14894. const maxDateYear = maxDate.value.year();
  14895. const maxDateMonth = maxDate.value.month();
  14896. rightDate.value = minDateYear === maxDateYear && minDateMonth === maxDateMonth ? maxDate.value.add(1, "month") : maxDate.value;
  14897. } else {
  14898. rightDate.value = leftDate.value.add(1, "month");
  14899. if (maxDate.value) {
  14900. rightDate.value = rightDate.value.hour(maxDate.value.hour()).minute(maxDate.value.minute()).second(maxDate.value.second());
  14901. }
  14902. }
  14903. } else {
  14904. const defaultArr = getDefaultValue();
  14905. minDate.value = null;
  14906. maxDate.value = null;
  14907. leftDate.value = defaultArr[0];
  14908. rightDate.value = defaultArr[1];
  14909. }
  14910. }, { immediate: true });
  14911. return {
  14912. shortcuts,
  14913. disabledDate,
  14914. cellClassName,
  14915. minTimePickerVisible,
  14916. maxTimePickerVisible,
  14917. handleMinTimeClose,
  14918. handleMaxTimeClose,
  14919. handleShortcutClick,
  14920. rangeState,
  14921. minDate,
  14922. maxDate,
  14923. handleRangePick,
  14924. onSelect,
  14925. handleChangeRange,
  14926. btnDisabled,
  14927. enableYearArrow,
  14928. enableMonthArrow,
  14929. rightPrevMonth,
  14930. rightPrevYear,
  14931. rightNextMonth,
  14932. rightNextYear,
  14933. leftPrevMonth,
  14934. leftPrevYear,
  14935. leftNextMonth,
  14936. leftNextYear,
  14937. hasShortcuts,
  14938. leftLabel,
  14939. rightLabel,
  14940. leftDate,
  14941. rightDate,
  14942. showTime,
  14943. t,
  14944. minVisibleDate,
  14945. maxVisibleDate,
  14946. minVisibleTime,
  14947. maxVisibleTime,
  14948. arrowControl,
  14949. handleDateInput,
  14950. handleDateChange,
  14951. handleTimeInput,
  14952. handleTimeChange,
  14953. handleMinTimePick,
  14954. handleMaxTimePick,
  14955. handleClear,
  14956. handleConfirm,
  14957. timeFormat,
  14958. clearable
  14959. };
  14960. }
  14961. });
  14962. const _hoisted_1$n = { class: "el-picker-panel__body-wrapper" };
  14963. const _hoisted_2$i = {
  14964. key: 0,
  14965. class: "el-picker-panel__sidebar"
  14966. };
  14967. const _hoisted_3$c = ["onClick"];
  14968. const _hoisted_4$a = { class: "el-picker-panel__body" };
  14969. const _hoisted_5$a = {
  14970. key: 0,
  14971. class: "el-date-range-picker__time-header"
  14972. };
  14973. const _hoisted_6$8 = { class: "el-date-range-picker__editors-wrap" };
  14974. const _hoisted_7$4 = { class: "el-date-range-picker__time-picker-wrap" };
  14975. const _hoisted_8$3 = { class: "el-date-range-picker__time-picker-wrap" };
  14976. const _hoisted_9$3 = { class: "el-date-range-picker__editors-wrap is-right" };
  14977. const _hoisted_10$3 = { class: "el-date-range-picker__time-picker-wrap" };
  14978. const _hoisted_11$2 = { class: "el-date-range-picker__time-picker-wrap" };
  14979. const _hoisted_12$2 = { class: "el-picker-panel__content el-date-range-picker__content is-left" };
  14980. const _hoisted_13$2 = { class: "el-date-range-picker__header" };
  14981. const _hoisted_14$2 = ["disabled"];
  14982. const _hoisted_15$1 = ["disabled"];
  14983. const _hoisted_16$1 = { class: "el-picker-panel__content el-date-range-picker__content is-right" };
  14984. const _hoisted_17$1 = { class: "el-date-range-picker__header" };
  14985. const _hoisted_18$1 = ["disabled"];
  14986. const _hoisted_19$1 = ["disabled"];
  14987. const _hoisted_20$1 = {
  14988. key: 0,
  14989. class: "el-picker-panel__footer"
  14990. };
  14991. function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
  14992. const _component_el_input = resolveComponent("el-input");
  14993. const _component_time_pick_panel = resolveComponent("time-pick-panel");
  14994. const _component_arrow_right = resolveComponent("arrow-right");
  14995. const _component_el_icon = resolveComponent("el-icon");
  14996. const _component_d_arrow_left = resolveComponent("d-arrow-left");
  14997. const _component_arrow_left = resolveComponent("arrow-left");
  14998. const _component_d_arrow_right = resolveComponent("d-arrow-right");
  14999. const _component_date_table = resolveComponent("date-table");
  15000. const _component_el_button = resolveComponent("el-button");
  15001. const _directive_clickoutside = resolveDirective("clickoutside");
  15002. return openBlock(), createElementBlock("div", {
  15003. class: normalizeClass(["el-picker-panel el-date-range-picker", [
  15004. {
  15005. "has-sidebar": _ctx.$slots.sidebar || _ctx.hasShortcuts,
  15006. "has-time": _ctx.showTime
  15007. }
  15008. ]])
  15009. }, [
  15010. createElementVNode("div", _hoisted_1$n, [
  15011. renderSlot(_ctx.$slots, "sidebar", { class: "el-picker-panel__sidebar" }),
  15012. _ctx.hasShortcuts ? (openBlock(), createElementBlock("div", _hoisted_2$i, [
  15013. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.shortcuts, (shortcut, key) => {
  15014. return openBlock(), createElementBlock("button", {
  15015. key,
  15016. type: "button",
  15017. class: "el-picker-panel__shortcut",
  15018. onClick: ($event) => _ctx.handleShortcutClick(shortcut)
  15019. }, toDisplayString(shortcut.text), 9, _hoisted_3$c);
  15020. }), 128))
  15021. ])) : createCommentVNode("v-if", true),
  15022. createElementVNode("div", _hoisted_4$a, [
  15023. _ctx.showTime ? (openBlock(), createElementBlock("div", _hoisted_5$a, [
  15024. createElementVNode("span", _hoisted_6$8, [
  15025. createElementVNode("span", _hoisted_7$4, [
  15026. createVNode(_component_el_input, {
  15027. size: "small",
  15028. disabled: _ctx.rangeState.selecting,
  15029. placeholder: _ctx.t("el.datepicker.startDate"),
  15030. class: "el-date-range-picker__editor",
  15031. "model-value": _ctx.minVisibleDate,
  15032. onInput: _cache[0] || (_cache[0] = (val) => _ctx.handleDateInput(val, "min")),
  15033. onChange: _cache[1] || (_cache[1] = (val) => _ctx.handleDateChange(val, "min"))
  15034. }, null, 8, ["disabled", "placeholder", "model-value"])
  15035. ]),
  15036. withDirectives((openBlock(), createElementBlock("span", _hoisted_8$3, [
  15037. createVNode(_component_el_input, {
  15038. size: "small",
  15039. class: "el-date-range-picker__editor",
  15040. disabled: _ctx.rangeState.selecting,
  15041. placeholder: _ctx.t("el.datepicker.startTime"),
  15042. "model-value": _ctx.minVisibleTime,
  15043. onFocus: _cache[2] || (_cache[2] = ($event) => _ctx.minTimePickerVisible = true),
  15044. onInput: _cache[3] || (_cache[3] = (val) => _ctx.handleTimeInput(val, "min")),
  15045. onChange: _cache[4] || (_cache[4] = (val) => _ctx.handleTimeChange(val, "min"))
  15046. }, null, 8, ["disabled", "placeholder", "model-value"]),
  15047. createVNode(_component_time_pick_panel, {
  15048. visible: _ctx.minTimePickerVisible,
  15049. format: _ctx.timeFormat,
  15050. "datetime-role": "start",
  15051. "time-arrow-control": _ctx.arrowControl,
  15052. "parsed-value": _ctx.leftDate,
  15053. onPick: _ctx.handleMinTimePick
  15054. }, null, 8, ["visible", "format", "time-arrow-control", "parsed-value", "onPick"])
  15055. ])), [
  15056. [_directive_clickoutside, _ctx.handleMinTimeClose]
  15057. ])
  15058. ]),
  15059. createElementVNode("span", null, [
  15060. createVNode(_component_el_icon, null, {
  15061. default: withCtx(() => [
  15062. createVNode(_component_arrow_right)
  15063. ]),
  15064. _: 1
  15065. })
  15066. ]),
  15067. createElementVNode("span", _hoisted_9$3, [
  15068. createElementVNode("span", _hoisted_10$3, [
  15069. createVNode(_component_el_input, {
  15070. size: "small",
  15071. class: "el-date-range-picker__editor",
  15072. disabled: _ctx.rangeState.selecting,
  15073. placeholder: _ctx.t("el.datepicker.endDate"),
  15074. "model-value": _ctx.maxVisibleDate,
  15075. readonly: !_ctx.minDate,
  15076. onInput: _cache[5] || (_cache[5] = (val) => _ctx.handleDateInput(val, "max")),
  15077. onChange: _cache[6] || (_cache[6] = (val) => _ctx.handleDateChange(val, "max"))
  15078. }, null, 8, ["disabled", "placeholder", "model-value", "readonly"])
  15079. ]),
  15080. withDirectives((openBlock(), createElementBlock("span", _hoisted_11$2, [
  15081. createVNode(_component_el_input, {
  15082. size: "small",
  15083. class: "el-date-range-picker__editor",
  15084. disabled: _ctx.rangeState.selecting,
  15085. placeholder: _ctx.t("el.datepicker.endTime"),
  15086. "model-value": _ctx.maxVisibleTime,
  15087. readonly: !_ctx.minDate,
  15088. onFocus: _cache[7] || (_cache[7] = ($event) => _ctx.minDate && (_ctx.maxTimePickerVisible = true)),
  15089. onInput: _cache[8] || (_cache[8] = (val) => _ctx.handleTimeInput(val, "max")),
  15090. onChange: _cache[9] || (_cache[9] = (val) => _ctx.handleTimeChange(val, "max"))
  15091. }, null, 8, ["disabled", "placeholder", "model-value", "readonly"]),
  15092. createVNode(_component_time_pick_panel, {
  15093. "datetime-role": "end",
  15094. visible: _ctx.maxTimePickerVisible,
  15095. format: _ctx.timeFormat,
  15096. "time-arrow-control": _ctx.arrowControl,
  15097. "parsed-value": _ctx.rightDate,
  15098. onPick: _ctx.handleMaxTimePick
  15099. }, null, 8, ["visible", "format", "time-arrow-control", "parsed-value", "onPick"])
  15100. ])), [
  15101. [_directive_clickoutside, _ctx.handleMaxTimeClose]
  15102. ])
  15103. ])
  15104. ])) : createCommentVNode("v-if", true),
  15105. createElementVNode("div", _hoisted_12$2, [
  15106. createElementVNode("div", _hoisted_13$2, [
  15107. createElementVNode("button", {
  15108. type: "button",
  15109. class: "el-picker-panel__icon-btn d-arrow-left",
  15110. onClick: _cache[10] || (_cache[10] = (...args) => _ctx.leftPrevYear && _ctx.leftPrevYear(...args))
  15111. }, [
  15112. createVNode(_component_el_icon, null, {
  15113. default: withCtx(() => [
  15114. createVNode(_component_d_arrow_left)
  15115. ]),
  15116. _: 1
  15117. })
  15118. ]),
  15119. createElementVNode("button", {
  15120. type: "button",
  15121. class: "el-picker-panel__icon-btn arrow-left",
  15122. onClick: _cache[11] || (_cache[11] = (...args) => _ctx.leftPrevMonth && _ctx.leftPrevMonth(...args))
  15123. }, [
  15124. createVNode(_component_el_icon, null, {
  15125. default: withCtx(() => [
  15126. createVNode(_component_arrow_left)
  15127. ]),
  15128. _: 1
  15129. })
  15130. ]),
  15131. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  15132. key: 0,
  15133. type: "button",
  15134. disabled: !_ctx.enableYearArrow,
  15135. class: normalizeClass([{ "is-disabled": !_ctx.enableYearArrow }, "el-picker-panel__icon-btn d-arrow-right"]),
  15136. onClick: _cache[12] || (_cache[12] = (...args) => _ctx.leftNextYear && _ctx.leftNextYear(...args))
  15137. }, [
  15138. createVNode(_component_el_icon, null, {
  15139. default: withCtx(() => [
  15140. createVNode(_component_d_arrow_right)
  15141. ]),
  15142. _: 1
  15143. })
  15144. ], 10, _hoisted_14$2)) : createCommentVNode("v-if", true),
  15145. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  15146. key: 1,
  15147. type: "button",
  15148. disabled: !_ctx.enableMonthArrow,
  15149. class: normalizeClass([{ "is-disabled": !_ctx.enableMonthArrow }, "el-picker-panel__icon-btn arrow-right"]),
  15150. onClick: _cache[13] || (_cache[13] = (...args) => _ctx.leftNextMonth && _ctx.leftNextMonth(...args))
  15151. }, [
  15152. createVNode(_component_el_icon, null, {
  15153. default: withCtx(() => [
  15154. createVNode(_component_arrow_right)
  15155. ]),
  15156. _: 1
  15157. })
  15158. ], 10, _hoisted_15$1)) : createCommentVNode("v-if", true),
  15159. createElementVNode("div", null, toDisplayString(_ctx.leftLabel), 1)
  15160. ]),
  15161. createVNode(_component_date_table, {
  15162. "selection-mode": "range",
  15163. date: _ctx.leftDate,
  15164. "min-date": _ctx.minDate,
  15165. "max-date": _ctx.maxDate,
  15166. "range-state": _ctx.rangeState,
  15167. "disabled-date": _ctx.disabledDate,
  15168. "cell-class-name": _ctx.cellClassName,
  15169. onChangerange: _ctx.handleChangeRange,
  15170. onPick: _ctx.handleRangePick,
  15171. onSelect: _ctx.onSelect
  15172. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "cell-class-name", "onChangerange", "onPick", "onSelect"])
  15173. ]),
  15174. createElementVNode("div", _hoisted_16$1, [
  15175. createElementVNode("div", _hoisted_17$1, [
  15176. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  15177. key: 0,
  15178. type: "button",
  15179. disabled: !_ctx.enableYearArrow,
  15180. class: normalizeClass([{ "is-disabled": !_ctx.enableYearArrow }, "el-picker-panel__icon-btn d-arrow-left"]),
  15181. onClick: _cache[14] || (_cache[14] = (...args) => _ctx.rightPrevYear && _ctx.rightPrevYear(...args))
  15182. }, [
  15183. createVNode(_component_el_icon, null, {
  15184. default: withCtx(() => [
  15185. createVNode(_component_d_arrow_left)
  15186. ]),
  15187. _: 1
  15188. })
  15189. ], 10, _hoisted_18$1)) : createCommentVNode("v-if", true),
  15190. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  15191. key: 1,
  15192. type: "button",
  15193. disabled: !_ctx.enableMonthArrow,
  15194. class: normalizeClass([{ "is-disabled": !_ctx.enableMonthArrow }, "el-picker-panel__icon-btn arrow-left"]),
  15195. onClick: _cache[15] || (_cache[15] = (...args) => _ctx.rightPrevMonth && _ctx.rightPrevMonth(...args))
  15196. }, [
  15197. createVNode(_component_el_icon, null, {
  15198. default: withCtx(() => [
  15199. createVNode(_component_arrow_left)
  15200. ]),
  15201. _: 1
  15202. })
  15203. ], 10, _hoisted_19$1)) : createCommentVNode("v-if", true),
  15204. createElementVNode("button", {
  15205. type: "button",
  15206. class: "el-picker-panel__icon-btn d-arrow-right",
  15207. onClick: _cache[16] || (_cache[16] = (...args) => _ctx.rightNextYear && _ctx.rightNextYear(...args))
  15208. }, [
  15209. createVNode(_component_el_icon, null, {
  15210. default: withCtx(() => [
  15211. createVNode(_component_d_arrow_right)
  15212. ]),
  15213. _: 1
  15214. })
  15215. ]),
  15216. createElementVNode("button", {
  15217. type: "button",
  15218. class: "el-picker-panel__icon-btn arrow-right",
  15219. onClick: _cache[17] || (_cache[17] = (...args) => _ctx.rightNextMonth && _ctx.rightNextMonth(...args))
  15220. }, [
  15221. createVNode(_component_el_icon, null, {
  15222. default: withCtx(() => [
  15223. createVNode(_component_arrow_right)
  15224. ]),
  15225. _: 1
  15226. })
  15227. ]),
  15228. createElementVNode("div", null, toDisplayString(_ctx.rightLabel), 1)
  15229. ]),
  15230. createVNode(_component_date_table, {
  15231. "selection-mode": "range",
  15232. date: _ctx.rightDate,
  15233. "min-date": _ctx.minDate,
  15234. "max-date": _ctx.maxDate,
  15235. "range-state": _ctx.rangeState,
  15236. "disabled-date": _ctx.disabledDate,
  15237. "cell-class-name": _ctx.cellClassName,
  15238. onChangerange: _ctx.handleChangeRange,
  15239. onPick: _ctx.handleRangePick,
  15240. onSelect: _ctx.onSelect
  15241. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "cell-class-name", "onChangerange", "onPick", "onSelect"])
  15242. ])
  15243. ])
  15244. ]),
  15245. _ctx.showTime ? (openBlock(), createElementBlock("div", _hoisted_20$1, [
  15246. _ctx.clearable ? (openBlock(), createBlock(_component_el_button, {
  15247. key: 0,
  15248. size: "small",
  15249. type: "text",
  15250. class: "el-picker-panel__link-btn",
  15251. onClick: _ctx.handleClear
  15252. }, {
  15253. default: withCtx(() => [
  15254. createTextVNode(toDisplayString(_ctx.t("el.datepicker.clear")), 1)
  15255. ]),
  15256. _: 1
  15257. }, 8, ["onClick"])) : createCommentVNode("v-if", true),
  15258. createVNode(_component_el_button, {
  15259. plain: "",
  15260. size: "small",
  15261. class: "el-picker-panel__link-btn",
  15262. disabled: _ctx.btnDisabled,
  15263. onClick: _cache[18] || (_cache[18] = ($event) => _ctx.handleConfirm(false))
  15264. }, {
  15265. default: withCtx(() => [
  15266. createTextVNode(toDisplayString(_ctx.t("el.datepicker.confirm")), 1)
  15267. ]),
  15268. _: 1
  15269. }, 8, ["disabled"])
  15270. ])) : createCommentVNode("v-if", true)
  15271. ], 2);
  15272. }
  15273. var DateRangePickPanel = /* @__PURE__ */ _export_sfc$1(_sfc_main$A, [["render", _sfc_render$f], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/date-picker/src/date-picker-com/panel-date-range.vue"]]);
  15274. const _sfc_main$z = defineComponent({
  15275. components: { MonthTable, ElIcon, DArrowLeft: dArrowLeft, DArrowRight: dArrowRight },
  15276. props: {
  15277. unlinkPanels: Boolean,
  15278. parsedValue: {
  15279. type: Array
  15280. }
  15281. },
  15282. emits: ["pick", "set-picker-option"],
  15283. setup(props, ctx) {
  15284. const { t, lang } = useLocale();
  15285. const leftDate = ref(dayjs().locale(lang.value));
  15286. const rightDate = ref(dayjs().locale(lang.value).add(1, "year"));
  15287. const hasShortcuts = computed(() => !!shortcuts.length);
  15288. const handleShortcutClick = (shortcut) => {
  15289. const shortcutValues = typeof shortcut.value === "function" ? shortcut.value() : shortcut.value;
  15290. if (shortcutValues) {
  15291. ctx.emit("pick", [
  15292. dayjs(shortcutValues[0]).locale(lang.value),
  15293. dayjs(shortcutValues[1]).locale(lang.value)
  15294. ]);
  15295. return;
  15296. }
  15297. if (shortcut.onClick) {
  15298. shortcut.onClick(ctx);
  15299. }
  15300. };
  15301. const leftPrevYear = () => {
  15302. leftDate.value = leftDate.value.subtract(1, "year");
  15303. if (!props.unlinkPanels) {
  15304. rightDate.value = rightDate.value.subtract(1, "year");
  15305. }
  15306. };
  15307. const rightNextYear = () => {
  15308. if (!props.unlinkPanels) {
  15309. leftDate.value = leftDate.value.add(1, "year");
  15310. }
  15311. rightDate.value = rightDate.value.add(1, "year");
  15312. };
  15313. const leftNextYear = () => {
  15314. leftDate.value = leftDate.value.add(1, "year");
  15315. };
  15316. const rightPrevYear = () => {
  15317. rightDate.value = rightDate.value.subtract(1, "year");
  15318. };
  15319. const leftLabel = computed(() => {
  15320. return `${leftDate.value.year()} ${t("el.datepicker.year")}`;
  15321. });
  15322. const rightLabel = computed(() => {
  15323. return `${rightDate.value.year()} ${t("el.datepicker.year")}`;
  15324. });
  15325. const leftYear = computed(() => {
  15326. return leftDate.value.year();
  15327. });
  15328. const rightYear = computed(() => {
  15329. return rightDate.value.year() === leftDate.value.year() ? leftDate.value.year() + 1 : rightDate.value.year();
  15330. });
  15331. const enableYearArrow = computed(() => {
  15332. return props.unlinkPanels && rightYear.value > leftYear.value + 1;
  15333. });
  15334. const minDate = ref(null);
  15335. const maxDate = ref(null);
  15336. const rangeState = ref({
  15337. endDate: null,
  15338. selecting: false
  15339. });
  15340. const handleChangeRange = (val) => {
  15341. rangeState.value = val;
  15342. };
  15343. const handleRangePick = (val, close2 = true) => {
  15344. const minDate_ = val.minDate;
  15345. const maxDate_ = val.maxDate;
  15346. if (maxDate.value === maxDate_ && minDate.value === minDate_) {
  15347. return;
  15348. }
  15349. maxDate.value = maxDate_;
  15350. minDate.value = minDate_;
  15351. if (!close2)
  15352. return;
  15353. handleConfirm();
  15354. };
  15355. const isValidValue = (value) => {
  15356. return Array.isArray(value) && value && value[0] && value[1] && value[0].valueOf() <= value[1].valueOf();
  15357. };
  15358. const handleConfirm = (visible = false) => {
  15359. if (isValidValue([minDate.value, maxDate.value])) {
  15360. ctx.emit("pick", [minDate.value, maxDate.value], visible);
  15361. }
  15362. };
  15363. const onSelect = (selecting) => {
  15364. rangeState.value.selecting = selecting;
  15365. if (!selecting) {
  15366. rangeState.value.endDate = null;
  15367. }
  15368. };
  15369. const formatToString = (value) => {
  15370. return value.map((_2) => _2.format(format2));
  15371. };
  15372. const getDefaultValue = () => {
  15373. let start2;
  15374. if (Array.isArray(defaultValue.value)) {
  15375. const left2 = dayjs(defaultValue.value[0]);
  15376. let right2 = dayjs(defaultValue.value[1]);
  15377. if (!props.unlinkPanels) {
  15378. right2 = left2.add(1, "year");
  15379. }
  15380. return [left2, right2];
  15381. } else if (defaultValue.value) {
  15382. start2 = dayjs(defaultValue.value);
  15383. } else {
  15384. start2 = dayjs();
  15385. }
  15386. start2 = start2.locale(lang.value);
  15387. return [start2, start2.add(1, "year")];
  15388. };
  15389. ctx.emit("set-picker-option", ["formatToString", formatToString]);
  15390. const pickerBase = inject("EP_PICKER_BASE");
  15391. const { shortcuts, disabledDate, format: format2 } = pickerBase.props;
  15392. const defaultValue = toRef(pickerBase.props, "defaultValue");
  15393. watch(() => defaultValue.value, (val) => {
  15394. if (val) {
  15395. const defaultArr = getDefaultValue();
  15396. leftDate.value = defaultArr[0];
  15397. rightDate.value = defaultArr[1];
  15398. }
  15399. }, { immediate: true });
  15400. watch(() => props.parsedValue, (newVal) => {
  15401. if (newVal && newVal.length === 2) {
  15402. minDate.value = newVal[0];
  15403. maxDate.value = newVal[1];
  15404. leftDate.value = minDate.value;
  15405. if (props.unlinkPanels && maxDate.value) {
  15406. const minDateYear = minDate.value.year();
  15407. const maxDateYear = maxDate.value.year();
  15408. rightDate.value = minDateYear === maxDateYear ? maxDate.value.add(1, "year") : maxDate.value;
  15409. } else {
  15410. rightDate.value = leftDate.value.add(1, "year");
  15411. }
  15412. } else {
  15413. const defaultArr = getDefaultValue();
  15414. minDate.value = null;
  15415. maxDate.value = null;
  15416. leftDate.value = defaultArr[0];
  15417. rightDate.value = defaultArr[1];
  15418. }
  15419. }, { immediate: true });
  15420. return {
  15421. shortcuts,
  15422. disabledDate,
  15423. onSelect,
  15424. handleRangePick,
  15425. rangeState,
  15426. handleChangeRange,
  15427. minDate,
  15428. maxDate,
  15429. enableYearArrow,
  15430. leftLabel,
  15431. rightLabel,
  15432. leftNextYear,
  15433. leftPrevYear,
  15434. rightNextYear,
  15435. rightPrevYear,
  15436. t,
  15437. leftDate,
  15438. rightDate,
  15439. hasShortcuts,
  15440. handleShortcutClick
  15441. };
  15442. }
  15443. });
  15444. const _hoisted_1$m = { class: "el-picker-panel__body-wrapper" };
  15445. const _hoisted_2$h = {
  15446. key: 0,
  15447. class: "el-picker-panel__sidebar"
  15448. };
  15449. const _hoisted_3$b = ["onClick"];
  15450. const _hoisted_4$9 = { class: "el-picker-panel__body" };
  15451. const _hoisted_5$9 = { class: "el-picker-panel__content el-date-range-picker__content is-left" };
  15452. const _hoisted_6$7 = { class: "el-date-range-picker__header" };
  15453. const _hoisted_7$3 = ["disabled"];
  15454. const _hoisted_8$2 = { class: "el-picker-panel__content el-date-range-picker__content is-right" };
  15455. const _hoisted_9$2 = { class: "el-date-range-picker__header" };
  15456. const _hoisted_10$2 = ["disabled"];
  15457. function _sfc_render$e(_ctx, _cache, $props, $setup, $data, $options) {
  15458. const _component_d_arrow_left = resolveComponent("d-arrow-left");
  15459. const _component_el_icon = resolveComponent("el-icon");
  15460. const _component_d_arrow_right = resolveComponent("d-arrow-right");
  15461. const _component_month_table = resolveComponent("month-table");
  15462. return openBlock(), createElementBlock("div", {
  15463. class: normalizeClass(["el-picker-panel el-date-range-picker", [
  15464. {
  15465. "has-sidebar": _ctx.$slots.sidebar || _ctx.hasShortcuts
  15466. }
  15467. ]])
  15468. }, [
  15469. createElementVNode("div", _hoisted_1$m, [
  15470. renderSlot(_ctx.$slots, "sidebar", { class: "el-picker-panel__sidebar" }),
  15471. _ctx.hasShortcuts ? (openBlock(), createElementBlock("div", _hoisted_2$h, [
  15472. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.shortcuts, (shortcut, key) => {
  15473. return openBlock(), createElementBlock("button", {
  15474. key,
  15475. type: "button",
  15476. class: "el-picker-panel__shortcut",
  15477. onClick: ($event) => _ctx.handleShortcutClick(shortcut)
  15478. }, toDisplayString(shortcut.text), 9, _hoisted_3$b);
  15479. }), 128))
  15480. ])) : createCommentVNode("v-if", true),
  15481. createElementVNode("div", _hoisted_4$9, [
  15482. createElementVNode("div", _hoisted_5$9, [
  15483. createElementVNode("div", _hoisted_6$7, [
  15484. createElementVNode("button", {
  15485. type: "button",
  15486. class: "el-picker-panel__icon-btn d-arrow-left",
  15487. onClick: _cache[0] || (_cache[0] = (...args) => _ctx.leftPrevYear && _ctx.leftPrevYear(...args))
  15488. }, [
  15489. createVNode(_component_el_icon, null, {
  15490. default: withCtx(() => [
  15491. createVNode(_component_d_arrow_left)
  15492. ]),
  15493. _: 1
  15494. })
  15495. ]),
  15496. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  15497. key: 0,
  15498. type: "button",
  15499. disabled: !_ctx.enableYearArrow,
  15500. class: normalizeClass([{ "is-disabled": !_ctx.enableYearArrow }, "el-picker-panel__icon-btn d-arrow-right"]),
  15501. onClick: _cache[1] || (_cache[1] = (...args) => _ctx.leftNextYear && _ctx.leftNextYear(...args))
  15502. }, [
  15503. createVNode(_component_el_icon, null, {
  15504. default: withCtx(() => [
  15505. createVNode(_component_d_arrow_right)
  15506. ]),
  15507. _: 1
  15508. })
  15509. ], 10, _hoisted_7$3)) : createCommentVNode("v-if", true),
  15510. createElementVNode("div", null, toDisplayString(_ctx.leftLabel), 1)
  15511. ]),
  15512. createVNode(_component_month_table, {
  15513. "selection-mode": "range",
  15514. date: _ctx.leftDate,
  15515. "min-date": _ctx.minDate,
  15516. "max-date": _ctx.maxDate,
  15517. "range-state": _ctx.rangeState,
  15518. "disabled-date": _ctx.disabledDate,
  15519. onChangerange: _ctx.handleChangeRange,
  15520. onPick: _ctx.handleRangePick,
  15521. onSelect: _ctx.onSelect
  15522. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "onChangerange", "onPick", "onSelect"])
  15523. ]),
  15524. createElementVNode("div", _hoisted_8$2, [
  15525. createElementVNode("div", _hoisted_9$2, [
  15526. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  15527. key: 0,
  15528. type: "button",
  15529. disabled: !_ctx.enableYearArrow,
  15530. class: normalizeClass([{ "is-disabled": !_ctx.enableYearArrow }, "el-picker-panel__icon-btn d-arrow-left"]),
  15531. onClick: _cache[2] || (_cache[2] = (...args) => _ctx.rightPrevYear && _ctx.rightPrevYear(...args))
  15532. }, [
  15533. createVNode(_component_el_icon, null, {
  15534. default: withCtx(() => [
  15535. createVNode(_component_d_arrow_left)
  15536. ]),
  15537. _: 1
  15538. })
  15539. ], 10, _hoisted_10$2)) : createCommentVNode("v-if", true),
  15540. createElementVNode("button", {
  15541. type: "button",
  15542. class: "el-picker-panel__icon-btn d-arrow-right",
  15543. onClick: _cache[3] || (_cache[3] = (...args) => _ctx.rightNextYear && _ctx.rightNextYear(...args))
  15544. }, [
  15545. createVNode(_component_el_icon, null, {
  15546. default: withCtx(() => [
  15547. createVNode(_component_d_arrow_right)
  15548. ]),
  15549. _: 1
  15550. })
  15551. ]),
  15552. createElementVNode("div", null, toDisplayString(_ctx.rightLabel), 1)
  15553. ]),
  15554. createVNode(_component_month_table, {
  15555. "selection-mode": "range",
  15556. date: _ctx.rightDate,
  15557. "min-date": _ctx.minDate,
  15558. "max-date": _ctx.maxDate,
  15559. "range-state": _ctx.rangeState,
  15560. "disabled-date": _ctx.disabledDate,
  15561. onChangerange: _ctx.handleChangeRange,
  15562. onPick: _ctx.handleRangePick,
  15563. onSelect: _ctx.onSelect
  15564. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "onChangerange", "onPick", "onSelect"])
  15565. ])
  15566. ])
  15567. ])
  15568. ], 2);
  15569. }
  15570. var MonthRangePickPanel = /* @__PURE__ */ _export_sfc$1(_sfc_main$z, [["render", _sfc_render$e], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/date-picker/src/date-picker-com/panel-month-range.vue"]]);
  15571. dayjs.extend(localeData);
  15572. dayjs.extend(advancedFormat);
  15573. dayjs.extend(customParseFormat);
  15574. dayjs.extend(weekOfYear);
  15575. dayjs.extend(weekYear);
  15576. dayjs.extend(dayOfYear);
  15577. dayjs.extend(isSameOrAfter);
  15578. dayjs.extend(isSameOrBefore);
  15579. const getPanel = function(type4) {
  15580. if (type4 === "daterange" || type4 === "datetimerange") {
  15581. return DateRangePickPanel;
  15582. } else if (type4 === "monthrange") {
  15583. return MonthRangePickPanel;
  15584. }
  15585. return DatePickPanel;
  15586. };
  15587. var DatePicker = defineComponent({
  15588. name: "ElDatePicker",
  15589. install: null,
  15590. props: __spreadProps(__spreadValues({}, timePickerDefaultProps), {
  15591. type: {
  15592. type: String,
  15593. default: "date"
  15594. }
  15595. }),
  15596. emits: ["update:modelValue"],
  15597. setup(props, ctx) {
  15598. provide("ElPopperOptions", props.popperOptions);
  15599. provide(ROOT_PICKER_INJECTION_KEY, {
  15600. ctx
  15601. });
  15602. const commonPicker = ref(null);
  15603. const refProps = __spreadProps(__spreadValues({}, props), {
  15604. focus: (focusStartInput = true) => {
  15605. var _a2;
  15606. (_a2 = commonPicker.value) == null ? void 0 : _a2.focus(focusStartInput);
  15607. }
  15608. });
  15609. ctx.expose(refProps);
  15610. return () => {
  15611. var _a2;
  15612. const format2 = (_a2 = props.format) != null ? _a2 : DEFAULT_FORMATS_DATEPICKER[props.type] || DEFAULT_FORMATS_DATE;
  15613. return h$1(CommonPicker, __spreadProps(__spreadValues({}, props), {
  15614. format: format2,
  15615. type: props.type,
  15616. ref: commonPicker,
  15617. "onUpdate:modelValue": (value) => ctx.emit("update:modelValue", value)
  15618. }), {
  15619. default: (scopedProps) => h$1(getPanel(props.type), scopedProps),
  15620. "range-separator": () => renderSlot(ctx.slots, "range-separator")
  15621. });
  15622. };
  15623. }
  15624. });
  15625. const _DatePicker = DatePicker;
  15626. _DatePicker.install = (app) => {
  15627. app.component(_DatePicker.name, _DatePicker);
  15628. };
  15629. const ElDatePicker = _DatePicker;
  15630. const overlayProps = buildProps({
  15631. mask: {
  15632. type: Boolean,
  15633. default: true
  15634. },
  15635. customMaskEvent: {
  15636. type: Boolean,
  15637. default: false
  15638. },
  15639. overlayClass: {
  15640. type: definePropType([
  15641. String,
  15642. Array,
  15643. Object
  15644. ])
  15645. },
  15646. zIndex: {
  15647. type: definePropType([String, Number])
  15648. }
  15649. });
  15650. const overlayEmits = {
  15651. click: (evt) => evt instanceof MouseEvent
  15652. };
  15653. var Overlay = defineComponent({
  15654. name: "ElOverlay",
  15655. props: overlayProps,
  15656. emits: overlayEmits,
  15657. setup(props, { slots, emit }) {
  15658. const ns = useNamespace("overlay");
  15659. const onMaskClick = (e) => {
  15660. emit("click", e);
  15661. };
  15662. const { onClick, onMousedown, onMouseup } = useSameTarget(props.customMaskEvent ? void 0 : onMaskClick);
  15663. return () => {
  15664. return props.mask ? createVNode("div", {
  15665. class: [ns.b(), props.overlayClass],
  15666. style: {
  15667. zIndex: props.zIndex
  15668. },
  15669. onClick,
  15670. onMousedown,
  15671. onMouseup
  15672. }, [renderSlot(slots, "default")], PatchFlags.STYLE | PatchFlags.CLASS | PatchFlags.PROPS, ["onClick", "onMouseup", "onMousedown"]) : h$1("div", {
  15673. class: props.overlayClass,
  15674. style: {
  15675. zIndex: props.zIndex,
  15676. position: "fixed",
  15677. top: "0px",
  15678. right: "0px",
  15679. bottom: "0px",
  15680. left: "0px"
  15681. }
  15682. }, [renderSlot(slots, "default")]);
  15683. };
  15684. }
  15685. });
  15686. const ElOverlay = Overlay;
  15687. const dialogContentProps = buildProps({
  15688. center: {
  15689. type: Boolean,
  15690. default: false
  15691. },
  15692. closeIcon: {
  15693. type: iconPropType,
  15694. default: ""
  15695. },
  15696. customClass: {
  15697. type: String,
  15698. default: ""
  15699. },
  15700. draggable: {
  15701. type: Boolean,
  15702. default: false
  15703. },
  15704. fullscreen: {
  15705. type: Boolean,
  15706. default: false
  15707. },
  15708. showClose: {
  15709. type: Boolean,
  15710. default: true
  15711. },
  15712. title: {
  15713. type: String,
  15714. default: ""
  15715. }
  15716. });
  15717. const dialogContentEmits = {
  15718. close: () => true
  15719. };
  15720. const _hoisted_1$l = ["aria-label"];
  15721. const __default__$c = { name: "ElDialogContent" };
  15722. const _sfc_main$y = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$c), {
  15723. props: dialogContentProps,
  15724. emits: dialogContentEmits,
  15725. setup(__props) {
  15726. const { Close } = CloseComponents;
  15727. const { dialogRef, headerRef, ns, style } = inject(dialogInjectionKey);
  15728. return (_ctx, _cache) => {
  15729. return openBlock(), createElementBlock("div", {
  15730. ref_key: "dialogRef",
  15731. ref: dialogRef,
  15732. class: normalizeClass([
  15733. unref(ns).b(),
  15734. unref(ns).is("fullscreen", _ctx.fullscreen),
  15735. unref(ns).is("draggable", _ctx.draggable),
  15736. { [unref(ns).m("center")]: _ctx.center },
  15737. _ctx.customClass
  15738. ]),
  15739. "aria-modal": "true",
  15740. role: "dialog",
  15741. "aria-label": _ctx.title || "dialog",
  15742. style: normalizeStyle(unref(style)),
  15743. onClick: _cache[1] || (_cache[1] = withModifiers(() => {
  15744. }, ["stop"]))
  15745. }, [
  15746. createElementVNode("div", {
  15747. ref_key: "headerRef",
  15748. ref: headerRef,
  15749. class: normalizeClass(unref(ns).e("header"))
  15750. }, [
  15751. renderSlot(_ctx.$slots, "title", {}, () => [
  15752. createElementVNode("span", {
  15753. class: normalizeClass(unref(ns).e("title"))
  15754. }, toDisplayString(_ctx.title), 3)
  15755. ])
  15756. ], 2),
  15757. createElementVNode("div", {
  15758. class: normalizeClass(unref(ns).e("body"))
  15759. }, [
  15760. renderSlot(_ctx.$slots, "default")
  15761. ], 2),
  15762. _ctx.$slots.footer ? (openBlock(), createElementBlock("div", {
  15763. key: 0,
  15764. class: normalizeClass(unref(ns).e("footer"))
  15765. }, [
  15766. renderSlot(_ctx.$slots, "footer")
  15767. ], 2)) : createCommentVNode("v-if", true),
  15768. _ctx.showClose ? (openBlock(), createElementBlock("button", {
  15769. key: 1,
  15770. "aria-label": "close",
  15771. class: normalizeClass(unref(ns).e("headerbtn")),
  15772. type: "button",
  15773. onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("close"))
  15774. }, [
  15775. createVNode(unref(ElIcon), {
  15776. class: normalizeClass(unref(ns).e("close"))
  15777. }, {
  15778. default: withCtx(() => [
  15779. (openBlock(), createBlock(resolveDynamicComponent(_ctx.closeIcon || unref(Close))))
  15780. ]),
  15781. _: 1
  15782. }, 8, ["class"])
  15783. ], 2)) : createCommentVNode("v-if", true)
  15784. ], 14, _hoisted_1$l);
  15785. };
  15786. }
  15787. }));
  15788. var ElDialogContent = /* @__PURE__ */ _export_sfc$1(_sfc_main$y, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/dialog/src/dialog-content.vue"]]);
  15789. const dialogProps = buildProps(__spreadProps(__spreadValues({}, dialogContentProps), {
  15790. appendToBody: {
  15791. type: Boolean,
  15792. default: false
  15793. },
  15794. beforeClose: {
  15795. type: definePropType(Function)
  15796. },
  15797. destroyOnClose: {
  15798. type: Boolean,
  15799. default: false
  15800. },
  15801. closeOnClickModal: {
  15802. type: Boolean,
  15803. default: true
  15804. },
  15805. closeOnPressEscape: {
  15806. type: Boolean,
  15807. default: true
  15808. },
  15809. lockScroll: {
  15810. type: Boolean,
  15811. default: true
  15812. },
  15813. modal: {
  15814. type: Boolean,
  15815. default: true
  15816. },
  15817. openDelay: {
  15818. type: Number,
  15819. default: 0
  15820. },
  15821. closeDelay: {
  15822. type: Number,
  15823. default: 0
  15824. },
  15825. top: {
  15826. type: String
  15827. },
  15828. modelValue: {
  15829. type: Boolean,
  15830. required: true
  15831. },
  15832. modalClass: String,
  15833. width: {
  15834. type: [String, Number]
  15835. },
  15836. zIndex: {
  15837. type: Number
  15838. },
  15839. trapFocus: {
  15840. type: Boolean,
  15841. default: false
  15842. }
  15843. }));
  15844. const dialogEmits = {
  15845. open: () => true,
  15846. opened: () => true,
  15847. close: () => true,
  15848. closed: () => true,
  15849. [UPDATE_MODEL_EVENT]: (value) => isBoolean(value),
  15850. openAutoFocus: () => true,
  15851. closeAutoFocus: () => true
  15852. };
  15853. const useDialog = (props, targetRef) => {
  15854. const instance = getCurrentInstance();
  15855. const emit = instance.emit;
  15856. const { nextZIndex } = useZIndex();
  15857. let lastPosition = "";
  15858. const visible = ref(false);
  15859. const closed = ref(false);
  15860. const rendered = ref(false);
  15861. const zIndex2 = ref(props.zIndex || nextZIndex());
  15862. let openTimer = void 0;
  15863. let closeTimer = void 0;
  15864. const normalizeWidth = computed(() => isNumber(props.width) ? `${props.width}px` : props.width);
  15865. const style = computed(() => {
  15866. const style2 = {};
  15867. const varPrefix = `--el-dialog`;
  15868. if (!props.fullscreen) {
  15869. if (props.top) {
  15870. style2[`${varPrefix}-margin-top`] = props.top;
  15871. }
  15872. if (props.width) {
  15873. style2[`${varPrefix}-width`] = normalizeWidth.value;
  15874. }
  15875. }
  15876. return style2;
  15877. });
  15878. function afterEnter() {
  15879. emit("opened");
  15880. }
  15881. function afterLeave() {
  15882. emit("closed");
  15883. emit(UPDATE_MODEL_EVENT, false);
  15884. if (props.destroyOnClose) {
  15885. rendered.value = false;
  15886. }
  15887. }
  15888. function beforeLeave() {
  15889. emit("close");
  15890. }
  15891. function open() {
  15892. closeTimer == null ? void 0 : closeTimer();
  15893. openTimer == null ? void 0 : openTimer();
  15894. if (props.openDelay && props.openDelay > 0) {
  15895. ({ stop: openTimer } = useTimeoutFn(() => doOpen(), props.openDelay));
  15896. } else {
  15897. doOpen();
  15898. }
  15899. }
  15900. function close2() {
  15901. openTimer == null ? void 0 : openTimer();
  15902. closeTimer == null ? void 0 : closeTimer();
  15903. if (props.closeDelay && props.closeDelay > 0) {
  15904. ({ stop: closeTimer } = useTimeoutFn(() => doClose(), props.closeDelay));
  15905. } else {
  15906. doClose();
  15907. }
  15908. }
  15909. function handleClose() {
  15910. function hide2(shouldCancel) {
  15911. if (shouldCancel)
  15912. return;
  15913. closed.value = true;
  15914. visible.value = false;
  15915. }
  15916. if (props.beforeClose) {
  15917. props.beforeClose(hide2);
  15918. } else {
  15919. close2();
  15920. }
  15921. }
  15922. function onModalClick() {
  15923. if (props.closeOnClickModal) {
  15924. handleClose();
  15925. }
  15926. }
  15927. function doOpen() {
  15928. if (!isClient)
  15929. return;
  15930. visible.value = true;
  15931. }
  15932. function doClose() {
  15933. visible.value = false;
  15934. }
  15935. if (props.lockScroll) {
  15936. useLockscreen(visible);
  15937. }
  15938. if (props.closeOnPressEscape) {
  15939. useModal({
  15940. handleClose
  15941. }, visible);
  15942. }
  15943. useRestoreActive(visible);
  15944. watch(() => props.modelValue, (val) => {
  15945. if (val) {
  15946. closed.value = false;
  15947. open();
  15948. rendered.value = true;
  15949. emit("open");
  15950. zIndex2.value = props.zIndex ? zIndex2.value++ : nextZIndex();
  15951. nextTick(() => {
  15952. if (targetRef.value) {
  15953. targetRef.value.scrollTop = 0;
  15954. }
  15955. });
  15956. } else {
  15957. if (visible.value) {
  15958. close2();
  15959. }
  15960. }
  15961. });
  15962. watch(() => props.fullscreen, (val) => {
  15963. if (!targetRef.value)
  15964. return;
  15965. if (val) {
  15966. lastPosition = targetRef.value.style.transform;
  15967. targetRef.value.style.transform = "";
  15968. } else {
  15969. targetRef.value.style.transform = lastPosition;
  15970. }
  15971. });
  15972. onMounted(() => {
  15973. if (props.modelValue) {
  15974. visible.value = true;
  15975. rendered.value = true;
  15976. open();
  15977. }
  15978. });
  15979. return {
  15980. afterEnter,
  15981. afterLeave,
  15982. beforeLeave,
  15983. handleClose,
  15984. onModalClick,
  15985. close: close2,
  15986. doClose,
  15987. closed,
  15988. style,
  15989. rendered,
  15990. visible,
  15991. zIndex: zIndex2
  15992. };
  15993. };
  15994. const __default__$b = {
  15995. name: "ElDialog"
  15996. };
  15997. const _sfc_main$x = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$b), {
  15998. props: dialogProps,
  15999. emits: dialogEmits,
  16000. setup(__props, { expose }) {
  16001. const props = __props;
  16002. const ns = useNamespace("dialog");
  16003. const dialogRef = ref();
  16004. const headerRef = ref();
  16005. const {
  16006. visible,
  16007. style,
  16008. rendered,
  16009. zIndex: zIndex2,
  16010. afterEnter,
  16011. afterLeave,
  16012. beforeLeave,
  16013. handleClose,
  16014. onModalClick
  16015. } = useDialog(props, dialogRef);
  16016. provide(dialogInjectionKey, {
  16017. dialogRef,
  16018. headerRef,
  16019. ns,
  16020. rendered,
  16021. style
  16022. });
  16023. const overlayEvent = useSameTarget(onModalClick);
  16024. const draggable = computed(() => props.draggable && !props.fullscreen);
  16025. useDraggable(dialogRef, headerRef, draggable);
  16026. expose({
  16027. visible
  16028. });
  16029. return (_ctx, _cache) => {
  16030. return openBlock(), createBlock(Teleport, {
  16031. to: "body",
  16032. disabled: !_ctx.appendToBody
  16033. }, [
  16034. createVNode(Transition, {
  16035. name: "dialog-fade",
  16036. onAfterEnter: unref(afterEnter),
  16037. onAfterLeave: unref(afterLeave),
  16038. onBeforeLeave: unref(beforeLeave)
  16039. }, {
  16040. default: withCtx(() => [
  16041. withDirectives(createVNode(unref(ElOverlay), {
  16042. "custom-mask-event": "",
  16043. mask: _ctx.modal,
  16044. "overlay-class": _ctx.modalClass,
  16045. "z-index": unref(zIndex2)
  16046. }, {
  16047. default: withCtx(() => [
  16048. createElementVNode("div", {
  16049. class: normalizeClass(`${unref(ns).namespace.value}-overlay-dialog`),
  16050. onClick: _cache[0] || (_cache[0] = (...args) => unref(overlayEvent).onClick && unref(overlayEvent).onClick(...args)),
  16051. onMousedown: _cache[1] || (_cache[1] = (...args) => unref(overlayEvent).onMousedown && unref(overlayEvent).onMousedown(...args)),
  16052. onMouseup: _cache[2] || (_cache[2] = (...args) => unref(overlayEvent).onMouseup && unref(overlayEvent).onMouseup(...args))
  16053. }, [
  16054. unref(rendered) ? (openBlock(), createBlock(ElDialogContent, {
  16055. key: 0,
  16056. "custom-class": _ctx.customClass,
  16057. center: _ctx.center,
  16058. "close-icon": _ctx.closeIcon,
  16059. draggable: unref(draggable),
  16060. fullscreen: _ctx.fullscreen,
  16061. "show-close": _ctx.showClose,
  16062. style: normalizeStyle(unref(style)),
  16063. title: _ctx.title,
  16064. onClose: unref(handleClose)
  16065. }, createSlots({
  16066. title: withCtx(() => [
  16067. renderSlot(_ctx.$slots, "title")
  16068. ]),
  16069. default: withCtx(() => [
  16070. renderSlot(_ctx.$slots, "default")
  16071. ]),
  16072. _: 2
  16073. }, [
  16074. _ctx.$slots.footer ? {
  16075. name: "footer",
  16076. fn: withCtx(() => [
  16077. renderSlot(_ctx.$slots, "footer")
  16078. ])
  16079. } : void 0
  16080. ]), 1032, ["custom-class", "center", "close-icon", "draggable", "fullscreen", "show-close", "style", "title", "onClose"])) : createCommentVNode("v-if", true)
  16081. ], 34)
  16082. ]),
  16083. _: 3
  16084. }, 8, ["mask", "overlay-class", "z-index"]), [
  16085. [vShow, unref(visible)]
  16086. ])
  16087. ]),
  16088. _: 3
  16089. }, 8, ["onAfterEnter", "onAfterLeave", "onBeforeLeave"])
  16090. ], 8, ["disabled"]);
  16091. };
  16092. }
  16093. }));
  16094. var Dialog = /* @__PURE__ */ _export_sfc$1(_sfc_main$x, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/dialog/src/dialog.vue"]]);
  16095. const ElDialog = withInstall(Dialog);
  16096. const dividerProps = buildProps({
  16097. direction: {
  16098. type: String,
  16099. values: ["horizontal", "vertical"],
  16100. default: "horizontal"
  16101. },
  16102. contentPosition: {
  16103. type: String,
  16104. values: ["left", "center", "right"],
  16105. default: "center"
  16106. },
  16107. borderStyle: {
  16108. type: definePropType(String),
  16109. default: "solid"
  16110. }
  16111. });
  16112. const __default__$a = {
  16113. name: "ElDivider"
  16114. };
  16115. const _sfc_main$w = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$a), {
  16116. props: dividerProps,
  16117. setup(__props) {
  16118. const props = __props;
  16119. const ns = useNamespace("divider");
  16120. const dividerStyle = computed(() => {
  16121. return {
  16122. "--el-border-style": props.borderStyle
  16123. };
  16124. });
  16125. return (_ctx, _cache) => {
  16126. return openBlock(), createElementBlock("div", {
  16127. class: normalizeClass([unref(ns).b(), unref(ns).m(_ctx.direction)]),
  16128. style: normalizeStyle(unref(dividerStyle))
  16129. }, [
  16130. _ctx.$slots.default && _ctx.direction !== "vertical" ? (openBlock(), createElementBlock("div", {
  16131. key: 0,
  16132. class: normalizeClass([unref(ns).e("text"), unref(ns).is(_ctx.contentPosition)])
  16133. }, [
  16134. renderSlot(_ctx.$slots, "default")
  16135. ], 2)) : createCommentVNode("v-if", true)
  16136. ], 6);
  16137. };
  16138. }
  16139. }));
  16140. var Divider = /* @__PURE__ */ _export_sfc$1(_sfc_main$w, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/divider/src/divider.vue"]]);
  16141. const ElDivider = withInstall(Divider);
  16142. const formProps = buildProps({
  16143. model: Object,
  16144. rules: {
  16145. type: definePropType(Object)
  16146. },
  16147. labelPosition: String,
  16148. labelWidth: {
  16149. type: [String, Number],
  16150. default: ""
  16151. },
  16152. labelSuffix: {
  16153. type: String,
  16154. default: ""
  16155. },
  16156. inline: Boolean,
  16157. inlineMessage: Boolean,
  16158. statusIcon: Boolean,
  16159. showMessage: {
  16160. type: Boolean,
  16161. default: true
  16162. },
  16163. size: {
  16164. type: String,
  16165. values: componentSizes
  16166. },
  16167. disabled: Boolean,
  16168. validateOnRuleChange: {
  16169. type: Boolean,
  16170. default: true
  16171. },
  16172. hideRequiredAsterisk: {
  16173. type: Boolean,
  16174. default: false
  16175. },
  16176. scrollToError: Boolean
  16177. });
  16178. const formEmits = {
  16179. validate: (prop, isValid, message) => (isArray(prop) || isString(prop)) && isBoolean(isValid) && isString(message)
  16180. };
  16181. function useFormLabelWidth() {
  16182. const potentialLabelWidthArr = ref([]);
  16183. const autoLabelWidth = computed(() => {
  16184. if (!potentialLabelWidthArr.value.length)
  16185. return "0";
  16186. const max2 = Math.max(...potentialLabelWidthArr.value);
  16187. return max2 ? `${max2}px` : "";
  16188. });
  16189. function getLabelWidthIndex(width) {
  16190. const index = potentialLabelWidthArr.value.indexOf(width);
  16191. return index;
  16192. }
  16193. function registerLabelWidth(val, oldVal) {
  16194. if (val && oldVal) {
  16195. const index = getLabelWidthIndex(oldVal);
  16196. potentialLabelWidthArr.value.splice(index, 1, val);
  16197. } else if (val) {
  16198. potentialLabelWidthArr.value.push(val);
  16199. }
  16200. }
  16201. function deregisterLabelWidth(val) {
  16202. const index = getLabelWidthIndex(val);
  16203. if (index > -1) {
  16204. potentialLabelWidthArr.value.splice(index, 1);
  16205. }
  16206. }
  16207. return {
  16208. autoLabelWidth,
  16209. registerLabelWidth,
  16210. deregisterLabelWidth
  16211. };
  16212. }
  16213. const filterFields = (fields, props) => {
  16214. const normalized = castArray$1(props);
  16215. return normalized.length > 0 ? fields.filter((field) => field.prop && normalized.includes(field.prop)) : fields;
  16216. };
  16217. const __default__$9 = {
  16218. name: "ElForm"
  16219. };
  16220. const _sfc_main$v = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$9), {
  16221. props: formProps,
  16222. emits: formEmits,
  16223. setup(__props, { expose, emit }) {
  16224. const props = __props;
  16225. const fields = [];
  16226. const formSize = useSize();
  16227. const ns = useNamespace("form");
  16228. const formClasses = computed(() => {
  16229. const { labelPosition, inline } = props;
  16230. return [
  16231. ns.b(),
  16232. ns.m(formSize.value || "default"),
  16233. {
  16234. [ns.m(`label-${labelPosition}`)]: labelPosition,
  16235. [ns.m("inline")]: inline
  16236. }
  16237. ];
  16238. });
  16239. const addField = (field) => {
  16240. fields.push(field);
  16241. };
  16242. const removeField = (field) => {
  16243. if (field.prop) {
  16244. fields.splice(fields.indexOf(field), 1);
  16245. }
  16246. };
  16247. const resetFields = (properties = []) => {
  16248. if (!props.model) {
  16249. return;
  16250. }
  16251. filterFields(fields, properties).forEach((field) => field.resetField());
  16252. };
  16253. const clearValidate = (props2 = []) => {
  16254. filterFields(fields, props2).forEach((field) => field.clearValidate());
  16255. };
  16256. const isValidatable = computed(() => {
  16257. const hasModel = !!props.model;
  16258. return hasModel;
  16259. });
  16260. const obtainValidateFields = (props2) => {
  16261. if (fields.length === 0)
  16262. return [];
  16263. const filteredFields = filterFields(fields, props2);
  16264. if (!filteredFields.length) {
  16265. return [];
  16266. }
  16267. return filteredFields;
  16268. };
  16269. const validate = async (callback) => validateField(void 0, callback);
  16270. const doValidateField = async (props2 = []) => {
  16271. if (!isValidatable.value)
  16272. return false;
  16273. const fields2 = obtainValidateFields(props2);
  16274. if (fields2.length === 0)
  16275. return true;
  16276. let validationErrors = {};
  16277. for (const field of fields2) {
  16278. try {
  16279. await field.validate("");
  16280. } catch (fields3) {
  16281. validationErrors = __spreadValues(__spreadValues({}, validationErrors), fields3);
  16282. }
  16283. }
  16284. if (Object.keys(validationErrors).length === 0)
  16285. return true;
  16286. return Promise.reject(validationErrors);
  16287. };
  16288. const validateField = async (modelProps = [], callback) => {
  16289. const shouldThrow = !isFunction(callback);
  16290. try {
  16291. const result = await doValidateField(modelProps);
  16292. if (result === true) {
  16293. callback == null ? void 0 : callback(result);
  16294. }
  16295. return result;
  16296. } catch (e) {
  16297. const invalidFields = e;
  16298. if (props.scrollToError) {
  16299. scrollToField(Object.keys(invalidFields)[0]);
  16300. }
  16301. callback == null ? void 0 : callback(false, invalidFields);
  16302. return shouldThrow && Promise.reject(invalidFields);
  16303. }
  16304. };
  16305. const scrollToField = (prop) => {
  16306. var _a2;
  16307. const field = filterFields(fields, prop)[0];
  16308. if (field) {
  16309. (_a2 = field.$el) == null ? void 0 : _a2.scrollIntoView();
  16310. }
  16311. };
  16312. watch(() => props.rules, () => {
  16313. if (props.validateOnRuleChange)
  16314. validate();
  16315. }, { deep: true });
  16316. provide(formContextKey, reactive(__spreadValues(__spreadProps(__spreadValues({}, toRefs(props)), {
  16317. emit,
  16318. resetFields,
  16319. clearValidate,
  16320. validateField,
  16321. addField,
  16322. removeField
  16323. }), useFormLabelWidth())));
  16324. expose({
  16325. validate,
  16326. validateField,
  16327. resetFields,
  16328. clearValidate,
  16329. scrollToField
  16330. });
  16331. return (_ctx, _cache) => {
  16332. return openBlock(), createElementBlock("form", {
  16333. class: normalizeClass(unref(formClasses))
  16334. }, [
  16335. renderSlot(_ctx.$slots, "default")
  16336. ], 2);
  16337. };
  16338. }
  16339. }));
  16340. var Form = /* @__PURE__ */ _export_sfc$1(_sfc_main$v, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/form/src/form.vue"]]);
  16341. function _extends$1() {
  16342. _extends$1 = Object.assign ? Object.assign.bind() : function(target) {
  16343. for (var i = 1; i < arguments.length; i++) {
  16344. var source = arguments[i];
  16345. for (var key in source) {
  16346. if (Object.prototype.hasOwnProperty.call(source, key)) {
  16347. target[key] = source[key];
  16348. }
  16349. }
  16350. }
  16351. return target;
  16352. };
  16353. return _extends$1.apply(this, arguments);
  16354. }
  16355. function _inheritsLoose(subClass, superClass) {
  16356. subClass.prototype = Object.create(superClass.prototype);
  16357. subClass.prototype.constructor = subClass;
  16358. _setPrototypeOf(subClass, superClass);
  16359. }
  16360. function _getPrototypeOf(o2) {
  16361. _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf2(o3) {
  16362. return o3.__proto__ || Object.getPrototypeOf(o3);
  16363. };
  16364. return _getPrototypeOf(o2);
  16365. }
  16366. function _setPrototypeOf(o2, p2) {
  16367. _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o3, p3) {
  16368. o3.__proto__ = p3;
  16369. return o3;
  16370. };
  16371. return _setPrototypeOf(o2, p2);
  16372. }
  16373. function _isNativeReflectConstruct() {
  16374. if (typeof Reflect === "undefined" || !Reflect.construct)
  16375. return false;
  16376. if (Reflect.construct.sham)
  16377. return false;
  16378. if (typeof Proxy === "function")
  16379. return true;
  16380. try {
  16381. Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
  16382. }));
  16383. return true;
  16384. } catch (e) {
  16385. return false;
  16386. }
  16387. }
  16388. function _construct(Parent, args, Class) {
  16389. if (_isNativeReflectConstruct()) {
  16390. _construct = Reflect.construct.bind();
  16391. } else {
  16392. _construct = function _construct2(Parent2, args2, Class2) {
  16393. var a2 = [null];
  16394. a2.push.apply(a2, args2);
  16395. var Constructor = Function.bind.apply(Parent2, a2);
  16396. var instance = new Constructor();
  16397. if (Class2)
  16398. _setPrototypeOf(instance, Class2.prototype);
  16399. return instance;
  16400. };
  16401. }
  16402. return _construct.apply(null, arguments);
  16403. }
  16404. function _isNativeFunction(fn2) {
  16405. return Function.toString.call(fn2).indexOf("[native code]") !== -1;
  16406. }
  16407. function _wrapNativeSuper(Class) {
  16408. var _cache = typeof Map === "function" ? /* @__PURE__ */ new Map() : void 0;
  16409. _wrapNativeSuper = function _wrapNativeSuper2(Class2) {
  16410. if (Class2 === null || !_isNativeFunction(Class2))
  16411. return Class2;
  16412. if (typeof Class2 !== "function") {
  16413. throw new TypeError("Super expression must either be null or a function");
  16414. }
  16415. if (typeof _cache !== "undefined") {
  16416. if (_cache.has(Class2))
  16417. return _cache.get(Class2);
  16418. _cache.set(Class2, Wrapper);
  16419. }
  16420. function Wrapper() {
  16421. return _construct(Class2, arguments, _getPrototypeOf(this).constructor);
  16422. }
  16423. Wrapper.prototype = Object.create(Class2.prototype, {
  16424. constructor: {
  16425. value: Wrapper,
  16426. enumerable: false,
  16427. writable: true,
  16428. configurable: true
  16429. }
  16430. });
  16431. return _setPrototypeOf(Wrapper, Class2);
  16432. };
  16433. return _wrapNativeSuper(Class);
  16434. }
  16435. var formatRegExp = /%[sdj%]/g;
  16436. var warning = function warning2() {
  16437. };
  16438. if (typeof process !== "undefined" && process.env && false) {
  16439. warning = function warning3(type4, errors) {
  16440. if (typeof console !== "undefined" && console.warn && typeof ASYNC_VALIDATOR_NO_WARNING === "undefined") {
  16441. if (errors.every(function(e) {
  16442. return typeof e === "string";
  16443. })) {
  16444. console.warn(type4, errors);
  16445. }
  16446. }
  16447. };
  16448. }
  16449. function convertFieldsError(errors) {
  16450. if (!errors || !errors.length)
  16451. return null;
  16452. var fields = {};
  16453. errors.forEach(function(error) {
  16454. var field = error.field;
  16455. fields[field] = fields[field] || [];
  16456. fields[field].push(error);
  16457. });
  16458. return fields;
  16459. }
  16460. function format(template) {
  16461. for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  16462. args[_key - 1] = arguments[_key];
  16463. }
  16464. var i = 0;
  16465. var len = args.length;
  16466. if (typeof template === "function") {
  16467. return template.apply(null, args);
  16468. }
  16469. if (typeof template === "string") {
  16470. var str = template.replace(formatRegExp, function(x2) {
  16471. if (x2 === "%%") {
  16472. return "%";
  16473. }
  16474. if (i >= len) {
  16475. return x2;
  16476. }
  16477. switch (x2) {
  16478. case "%s":
  16479. return String(args[i++]);
  16480. case "%d":
  16481. return Number(args[i++]);
  16482. case "%j":
  16483. try {
  16484. return JSON.stringify(args[i++]);
  16485. } catch (_2) {
  16486. return "[Circular]";
  16487. }
  16488. break;
  16489. default:
  16490. return x2;
  16491. }
  16492. });
  16493. return str;
  16494. }
  16495. return template;
  16496. }
  16497. function isNativeStringType(type4) {
  16498. return type4 === "string" || type4 === "url" || type4 === "hex" || type4 === "email" || type4 === "date" || type4 === "pattern";
  16499. }
  16500. function isEmptyValue(value, type4) {
  16501. if (value === void 0 || value === null) {
  16502. return true;
  16503. }
  16504. if (type4 === "array" && Array.isArray(value) && !value.length) {
  16505. return true;
  16506. }
  16507. if (isNativeStringType(type4) && typeof value === "string" && !value) {
  16508. return true;
  16509. }
  16510. return false;
  16511. }
  16512. function asyncParallelArray(arr, func, callback) {
  16513. var results = [];
  16514. var total = 0;
  16515. var arrLength = arr.length;
  16516. function count(errors) {
  16517. results.push.apply(results, errors || []);
  16518. total++;
  16519. if (total === arrLength) {
  16520. callback(results);
  16521. }
  16522. }
  16523. arr.forEach(function(a2) {
  16524. func(a2, count);
  16525. });
  16526. }
  16527. function asyncSerialArray(arr, func, callback) {
  16528. var index = 0;
  16529. var arrLength = arr.length;
  16530. function next(errors) {
  16531. if (errors && errors.length) {
  16532. callback(errors);
  16533. return;
  16534. }
  16535. var original = index;
  16536. index = index + 1;
  16537. if (original < arrLength) {
  16538. func(arr[original], next);
  16539. } else {
  16540. callback([]);
  16541. }
  16542. }
  16543. next([]);
  16544. }
  16545. function flattenObjArr(objArr) {
  16546. var ret = [];
  16547. Object.keys(objArr).forEach(function(k) {
  16548. ret.push.apply(ret, objArr[k] || []);
  16549. });
  16550. return ret;
  16551. }
  16552. var AsyncValidationError = /* @__PURE__ */ function(_Error) {
  16553. _inheritsLoose(AsyncValidationError2, _Error);
  16554. function AsyncValidationError2(errors, fields) {
  16555. var _this;
  16556. _this = _Error.call(this, "Async Validation Error") || this;
  16557. _this.errors = errors;
  16558. _this.fields = fields;
  16559. return _this;
  16560. }
  16561. return AsyncValidationError2;
  16562. }(/* @__PURE__ */ _wrapNativeSuper(Error));
  16563. function asyncMap(objArr, option, func, callback, source) {
  16564. if (option.first) {
  16565. var _pending = new Promise(function(resolve, reject) {
  16566. var next = function next2(errors) {
  16567. callback(errors);
  16568. return errors.length ? reject(new AsyncValidationError(errors, convertFieldsError(errors))) : resolve(source);
  16569. };
  16570. var flattenArr = flattenObjArr(objArr);
  16571. asyncSerialArray(flattenArr, func, next);
  16572. });
  16573. _pending["catch"](function(e) {
  16574. return e;
  16575. });
  16576. return _pending;
  16577. }
  16578. var firstFields = option.firstFields === true ? Object.keys(objArr) : option.firstFields || [];
  16579. var objArrKeys = Object.keys(objArr);
  16580. var objArrLength = objArrKeys.length;
  16581. var total = 0;
  16582. var results = [];
  16583. var pending = new Promise(function(resolve, reject) {
  16584. var next = function next2(errors) {
  16585. results.push.apply(results, errors);
  16586. total++;
  16587. if (total === objArrLength) {
  16588. callback(results);
  16589. return results.length ? reject(new AsyncValidationError(results, convertFieldsError(results))) : resolve(source);
  16590. }
  16591. };
  16592. if (!objArrKeys.length) {
  16593. callback(results);
  16594. resolve(source);
  16595. }
  16596. objArrKeys.forEach(function(key) {
  16597. var arr = objArr[key];
  16598. if (firstFields.indexOf(key) !== -1) {
  16599. asyncSerialArray(arr, func, next);
  16600. } else {
  16601. asyncParallelArray(arr, func, next);
  16602. }
  16603. });
  16604. });
  16605. pending["catch"](function(e) {
  16606. return e;
  16607. });
  16608. return pending;
  16609. }
  16610. function isErrorObj(obj) {
  16611. return !!(obj && obj.message !== void 0);
  16612. }
  16613. function getValue(value, path) {
  16614. var v2 = value;
  16615. for (var i = 0; i < path.length; i++) {
  16616. if (v2 == void 0) {
  16617. return v2;
  16618. }
  16619. v2 = v2[path[i]];
  16620. }
  16621. return v2;
  16622. }
  16623. function complementError(rule, source) {
  16624. return function(oe) {
  16625. var fieldValue;
  16626. if (rule.fullFields) {
  16627. fieldValue = getValue(source, rule.fullFields);
  16628. } else {
  16629. fieldValue = source[oe.field || rule.fullField];
  16630. }
  16631. if (isErrorObj(oe)) {
  16632. oe.field = oe.field || rule.fullField;
  16633. oe.fieldValue = fieldValue;
  16634. return oe;
  16635. }
  16636. return {
  16637. message: typeof oe === "function" ? oe() : oe,
  16638. fieldValue,
  16639. field: oe.field || rule.fullField
  16640. };
  16641. };
  16642. }
  16643. function deepMerge(target, source) {
  16644. if (source) {
  16645. for (var s2 in source) {
  16646. if (source.hasOwnProperty(s2)) {
  16647. var value = source[s2];
  16648. if (typeof value === "object" && typeof target[s2] === "object") {
  16649. target[s2] = _extends$1({}, target[s2], value);
  16650. } else {
  16651. target[s2] = value;
  16652. }
  16653. }
  16654. }
  16655. }
  16656. return target;
  16657. }
  16658. var required$1 = function required(rule, value, source, errors, options, type4) {
  16659. if (rule.required && (!source.hasOwnProperty(rule.field) || isEmptyValue(value, type4 || rule.type))) {
  16660. errors.push(format(options.messages.required, rule.fullField));
  16661. }
  16662. };
  16663. var whitespace = function whitespace2(rule, value, source, errors, options) {
  16664. if (/^\s+$/.test(value) || value === "") {
  16665. errors.push(format(options.messages.whitespace, rule.fullField));
  16666. }
  16667. };
  16668. var urlReg;
  16669. var getUrlRegex = function() {
  16670. if (urlReg) {
  16671. return urlReg;
  16672. }
  16673. var word = "[a-fA-F\\d:]";
  16674. var b2 = function b3(options) {
  16675. return options && options.includeBoundaries ? "(?:(?<=\\s|^)(?=" + word + ")|(?<=" + word + ")(?=\\s|$))" : "";
  16676. };
  16677. var v4 = "(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}";
  16678. var v6seg = "[a-fA-F\\d]{1,4}";
  16679. var v6 = ("\n(?:\n(?:" + v6seg + ":){7}(?:" + v6seg + "|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8\n(?:" + v6seg + ":){6}(?:" + v4 + "|:" + v6seg + "|:)| // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::1.2.3.4\n(?:" + v6seg + ":){5}(?::" + v4 + "|(?::" + v6seg + "){1,2}|:)| // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::7:1.2.3.4\n(?:" + v6seg + ":){4}(?:(?::" + v6seg + "){0,1}:" + v4 + "|(?::" + v6seg + "){1,3}|:)| // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::6:7:1.2.3.4\n(?:" + v6seg + ":){3}(?:(?::" + v6seg + "){0,2}:" + v4 + "|(?::" + v6seg + "){1,4}|:)| // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::5:6:7:1.2.3.4\n(?:" + v6seg + ":){2}(?:(?::" + v6seg + "){0,3}:" + v4 + "|(?::" + v6seg + "){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4\n(?:" + v6seg + ":){1}(?:(?::" + v6seg + "){0,4}:" + v4 + "|(?::" + v6seg + "){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4\n(?::(?:(?::" + v6seg + "){0,5}:" + v4 + "|(?::" + v6seg + "){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4\n)(?:%[0-9a-zA-Z]{1,})? // %eth0 %1\n").replace(/\s*\/\/.*$/gm, "").replace(/\n/g, "").trim();
  16680. var v46Exact = new RegExp("(?:^" + v4 + "$)|(?:^" + v6 + "$)");
  16681. var v4exact = new RegExp("^" + v4 + "$");
  16682. var v6exact = new RegExp("^" + v6 + "$");
  16683. var ip = function ip2(options) {
  16684. return options && options.exact ? v46Exact : new RegExp("(?:" + b2(options) + v4 + b2(options) + ")|(?:" + b2(options) + v6 + b2(options) + ")", "g");
  16685. };
  16686. ip.v4 = function(options) {
  16687. return options && options.exact ? v4exact : new RegExp("" + b2(options) + v4 + b2(options), "g");
  16688. };
  16689. ip.v6 = function(options) {
  16690. return options && options.exact ? v6exact : new RegExp("" + b2(options) + v6 + b2(options), "g");
  16691. };
  16692. var protocol = "(?:(?:[a-z]+:)?//)";
  16693. var auth = "(?:\\S+(?::\\S*)?@)?";
  16694. var ipv4 = ip.v4().source;
  16695. var ipv6 = ip.v6().source;
  16696. var host = "(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)";
  16697. var domain = "(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*";
  16698. var tld = "(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))";
  16699. var port = "(?::\\d{2,5})?";
  16700. var path = '(?:[/?#][^\\s"]*)?';
  16701. var regex = "(?:" + protocol + "|www\\.)" + auth + "(?:localhost|" + ipv4 + "|" + ipv6 + "|" + host + domain + tld + ")" + port + path;
  16702. urlReg = new RegExp("(?:^" + regex + "$)", "i");
  16703. return urlReg;
  16704. };
  16705. var pattern$2 = {
  16706. email: /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+\.)+[a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}))$/,
  16707. hex: /^#?([a-f0-9]{6}|[a-f0-9]{3})$/i
  16708. };
  16709. var types = {
  16710. integer: function integer(value) {
  16711. return types.number(value) && parseInt(value, 10) === value;
  16712. },
  16713. "float": function float(value) {
  16714. return types.number(value) && !types.integer(value);
  16715. },
  16716. array: function array(value) {
  16717. return Array.isArray(value);
  16718. },
  16719. regexp: function regexp(value) {
  16720. if (value instanceof RegExp) {
  16721. return true;
  16722. }
  16723. try {
  16724. return !!new RegExp(value);
  16725. } catch (e) {
  16726. return false;
  16727. }
  16728. },
  16729. date: function date(value) {
  16730. return typeof value.getTime === "function" && typeof value.getMonth === "function" && typeof value.getYear === "function" && !isNaN(value.getTime());
  16731. },
  16732. number: function number(value) {
  16733. if (isNaN(value)) {
  16734. return false;
  16735. }
  16736. return typeof value === "number";
  16737. },
  16738. object: function object(value) {
  16739. return typeof value === "object" && !types.array(value);
  16740. },
  16741. method: function method(value) {
  16742. return typeof value === "function";
  16743. },
  16744. email: function email(value) {
  16745. return typeof value === "string" && value.length <= 320 && !!value.match(pattern$2.email);
  16746. },
  16747. url: function url(value) {
  16748. return typeof value === "string" && value.length <= 2048 && !!value.match(getUrlRegex());
  16749. },
  16750. hex: function hex(value) {
  16751. return typeof value === "string" && !!value.match(pattern$2.hex);
  16752. }
  16753. };
  16754. var type$1 = function type(rule, value, source, errors, options) {
  16755. if (rule.required && value === void 0) {
  16756. required$1(rule, value, source, errors, options);
  16757. return;
  16758. }
  16759. var custom = ["integer", "float", "array", "regexp", "object", "method", "email", "number", "date", "url", "hex"];
  16760. var ruleType = rule.type;
  16761. if (custom.indexOf(ruleType) > -1) {
  16762. if (!types[ruleType](value)) {
  16763. errors.push(format(options.messages.types[ruleType], rule.fullField, rule.type));
  16764. }
  16765. } else if (ruleType && typeof value !== rule.type) {
  16766. errors.push(format(options.messages.types[ruleType], rule.fullField, rule.type));
  16767. }
  16768. };
  16769. var range = function range2(rule, value, source, errors, options) {
  16770. var len = typeof rule.len === "number";
  16771. var min2 = typeof rule.min === "number";
  16772. var max2 = typeof rule.max === "number";
  16773. var spRegexp = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
  16774. var val = value;
  16775. var key = null;
  16776. var num = typeof value === "number";
  16777. var str = typeof value === "string";
  16778. var arr = Array.isArray(value);
  16779. if (num) {
  16780. key = "number";
  16781. } else if (str) {
  16782. key = "string";
  16783. } else if (arr) {
  16784. key = "array";
  16785. }
  16786. if (!key) {
  16787. return false;
  16788. }
  16789. if (arr) {
  16790. val = value.length;
  16791. }
  16792. if (str) {
  16793. val = value.replace(spRegexp, "_").length;
  16794. }
  16795. if (len) {
  16796. if (val !== rule.len) {
  16797. errors.push(format(options.messages[key].len, rule.fullField, rule.len));
  16798. }
  16799. } else if (min2 && !max2 && val < rule.min) {
  16800. errors.push(format(options.messages[key].min, rule.fullField, rule.min));
  16801. } else if (max2 && !min2 && val > rule.max) {
  16802. errors.push(format(options.messages[key].max, rule.fullField, rule.max));
  16803. } else if (min2 && max2 && (val < rule.min || val > rule.max)) {
  16804. errors.push(format(options.messages[key].range, rule.fullField, rule.min, rule.max));
  16805. }
  16806. };
  16807. var ENUM$1 = "enum";
  16808. var enumerable$1 = function enumerable(rule, value, source, errors, options) {
  16809. rule[ENUM$1] = Array.isArray(rule[ENUM$1]) ? rule[ENUM$1] : [];
  16810. if (rule[ENUM$1].indexOf(value) === -1) {
  16811. errors.push(format(options.messages[ENUM$1], rule.fullField, rule[ENUM$1].join(", ")));
  16812. }
  16813. };
  16814. var pattern$1 = function pattern(rule, value, source, errors, options) {
  16815. if (rule.pattern) {
  16816. if (rule.pattern instanceof RegExp) {
  16817. rule.pattern.lastIndex = 0;
  16818. if (!rule.pattern.test(value)) {
  16819. errors.push(format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern));
  16820. }
  16821. } else if (typeof rule.pattern === "string") {
  16822. var _pattern = new RegExp(rule.pattern);
  16823. if (!_pattern.test(value)) {
  16824. errors.push(format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern));
  16825. }
  16826. }
  16827. }
  16828. };
  16829. var rules = {
  16830. required: required$1,
  16831. whitespace,
  16832. type: type$1,
  16833. range,
  16834. "enum": enumerable$1,
  16835. pattern: pattern$1
  16836. };
  16837. var string = function string2(rule, value, callback, source, options) {
  16838. var errors = [];
  16839. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16840. if (validate) {
  16841. if (isEmptyValue(value, "string") && !rule.required) {
  16842. return callback();
  16843. }
  16844. rules.required(rule, value, source, errors, options, "string");
  16845. if (!isEmptyValue(value, "string")) {
  16846. rules.type(rule, value, source, errors, options);
  16847. rules.range(rule, value, source, errors, options);
  16848. rules.pattern(rule, value, source, errors, options);
  16849. if (rule.whitespace === true) {
  16850. rules.whitespace(rule, value, source, errors, options);
  16851. }
  16852. }
  16853. }
  16854. callback(errors);
  16855. };
  16856. var method2 = function method3(rule, value, callback, source, options) {
  16857. var errors = [];
  16858. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16859. if (validate) {
  16860. if (isEmptyValue(value) && !rule.required) {
  16861. return callback();
  16862. }
  16863. rules.required(rule, value, source, errors, options);
  16864. if (value !== void 0) {
  16865. rules.type(rule, value, source, errors, options);
  16866. }
  16867. }
  16868. callback(errors);
  16869. };
  16870. var number2 = function number3(rule, value, callback, source, options) {
  16871. var errors = [];
  16872. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16873. if (validate) {
  16874. if (value === "") {
  16875. value = void 0;
  16876. }
  16877. if (isEmptyValue(value) && !rule.required) {
  16878. return callback();
  16879. }
  16880. rules.required(rule, value, source, errors, options);
  16881. if (value !== void 0) {
  16882. rules.type(rule, value, source, errors, options);
  16883. rules.range(rule, value, source, errors, options);
  16884. }
  16885. }
  16886. callback(errors);
  16887. };
  16888. var _boolean = function _boolean2(rule, value, callback, source, options) {
  16889. var errors = [];
  16890. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16891. if (validate) {
  16892. if (isEmptyValue(value) && !rule.required) {
  16893. return callback();
  16894. }
  16895. rules.required(rule, value, source, errors, options);
  16896. if (value !== void 0) {
  16897. rules.type(rule, value, source, errors, options);
  16898. }
  16899. }
  16900. callback(errors);
  16901. };
  16902. var regexp2 = function regexp3(rule, value, callback, source, options) {
  16903. var errors = [];
  16904. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16905. if (validate) {
  16906. if (isEmptyValue(value) && !rule.required) {
  16907. return callback();
  16908. }
  16909. rules.required(rule, value, source, errors, options);
  16910. if (!isEmptyValue(value)) {
  16911. rules.type(rule, value, source, errors, options);
  16912. }
  16913. }
  16914. callback(errors);
  16915. };
  16916. var integer2 = function integer3(rule, value, callback, source, options) {
  16917. var errors = [];
  16918. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16919. if (validate) {
  16920. if (isEmptyValue(value) && !rule.required) {
  16921. return callback();
  16922. }
  16923. rules.required(rule, value, source, errors, options);
  16924. if (value !== void 0) {
  16925. rules.type(rule, value, source, errors, options);
  16926. rules.range(rule, value, source, errors, options);
  16927. }
  16928. }
  16929. callback(errors);
  16930. };
  16931. var floatFn = function floatFn2(rule, value, callback, source, options) {
  16932. var errors = [];
  16933. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16934. if (validate) {
  16935. if (isEmptyValue(value) && !rule.required) {
  16936. return callback();
  16937. }
  16938. rules.required(rule, value, source, errors, options);
  16939. if (value !== void 0) {
  16940. rules.type(rule, value, source, errors, options);
  16941. rules.range(rule, value, source, errors, options);
  16942. }
  16943. }
  16944. callback(errors);
  16945. };
  16946. var array2 = function array3(rule, value, callback, source, options) {
  16947. var errors = [];
  16948. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16949. if (validate) {
  16950. if ((value === void 0 || value === null) && !rule.required) {
  16951. return callback();
  16952. }
  16953. rules.required(rule, value, source, errors, options, "array");
  16954. if (value !== void 0 && value !== null) {
  16955. rules.type(rule, value, source, errors, options);
  16956. rules.range(rule, value, source, errors, options);
  16957. }
  16958. }
  16959. callback(errors);
  16960. };
  16961. var object2 = function object3(rule, value, callback, source, options) {
  16962. var errors = [];
  16963. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16964. if (validate) {
  16965. if (isEmptyValue(value) && !rule.required) {
  16966. return callback();
  16967. }
  16968. rules.required(rule, value, source, errors, options);
  16969. if (value !== void 0) {
  16970. rules.type(rule, value, source, errors, options);
  16971. }
  16972. }
  16973. callback(errors);
  16974. };
  16975. var ENUM = "enum";
  16976. var enumerable2 = function enumerable3(rule, value, callback, source, options) {
  16977. var errors = [];
  16978. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16979. if (validate) {
  16980. if (isEmptyValue(value) && !rule.required) {
  16981. return callback();
  16982. }
  16983. rules.required(rule, value, source, errors, options);
  16984. if (value !== void 0) {
  16985. rules[ENUM](rule, value, source, errors, options);
  16986. }
  16987. }
  16988. callback(errors);
  16989. };
  16990. var pattern2 = function pattern3(rule, value, callback, source, options) {
  16991. var errors = [];
  16992. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16993. if (validate) {
  16994. if (isEmptyValue(value, "string") && !rule.required) {
  16995. return callback();
  16996. }
  16997. rules.required(rule, value, source, errors, options);
  16998. if (!isEmptyValue(value, "string")) {
  16999. rules.pattern(rule, value, source, errors, options);
  17000. }
  17001. }
  17002. callback(errors);
  17003. };
  17004. var date2 = function date3(rule, value, callback, source, options) {
  17005. var errors = [];
  17006. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  17007. if (validate) {
  17008. if (isEmptyValue(value, "date") && !rule.required) {
  17009. return callback();
  17010. }
  17011. rules.required(rule, value, source, errors, options);
  17012. if (!isEmptyValue(value, "date")) {
  17013. var dateObject;
  17014. if (value instanceof Date) {
  17015. dateObject = value;
  17016. } else {
  17017. dateObject = new Date(value);
  17018. }
  17019. rules.type(rule, dateObject, source, errors, options);
  17020. if (dateObject) {
  17021. rules.range(rule, dateObject.getTime(), source, errors, options);
  17022. }
  17023. }
  17024. }
  17025. callback(errors);
  17026. };
  17027. var required2 = function required3(rule, value, callback, source, options) {
  17028. var errors = [];
  17029. var type4 = Array.isArray(value) ? "array" : typeof value;
  17030. rules.required(rule, value, source, errors, options, type4);
  17031. callback(errors);
  17032. };
  17033. var type2 = function type3(rule, value, callback, source, options) {
  17034. var ruleType = rule.type;
  17035. var errors = [];
  17036. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  17037. if (validate) {
  17038. if (isEmptyValue(value, ruleType) && !rule.required) {
  17039. return callback();
  17040. }
  17041. rules.required(rule, value, source, errors, options, ruleType);
  17042. if (!isEmptyValue(value, ruleType)) {
  17043. rules.type(rule, value, source, errors, options);
  17044. }
  17045. }
  17046. callback(errors);
  17047. };
  17048. var any = function any2(rule, value, callback, source, options) {
  17049. var errors = [];
  17050. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  17051. if (validate) {
  17052. if (isEmptyValue(value) && !rule.required) {
  17053. return callback();
  17054. }
  17055. rules.required(rule, value, source, errors, options);
  17056. }
  17057. callback(errors);
  17058. };
  17059. var validators = {
  17060. string,
  17061. method: method2,
  17062. number: number2,
  17063. "boolean": _boolean,
  17064. regexp: regexp2,
  17065. integer: integer2,
  17066. "float": floatFn,
  17067. array: array2,
  17068. object: object2,
  17069. "enum": enumerable2,
  17070. pattern: pattern2,
  17071. date: date2,
  17072. url: type2,
  17073. hex: type2,
  17074. email: type2,
  17075. required: required2,
  17076. any
  17077. };
  17078. function newMessages() {
  17079. return {
  17080. "default": "Validation error on field %s",
  17081. required: "%s is required",
  17082. "enum": "%s must be one of %s",
  17083. whitespace: "%s cannot be empty",
  17084. date: {
  17085. format: "%s date %s is invalid for format %s",
  17086. parse: "%s date could not be parsed, %s is invalid ",
  17087. invalid: "%s date %s is invalid"
  17088. },
  17089. types: {
  17090. string: "%s is not a %s",
  17091. method: "%s is not a %s (function)",
  17092. array: "%s is not an %s",
  17093. object: "%s is not an %s",
  17094. number: "%s is not a %s",
  17095. date: "%s is not a %s",
  17096. "boolean": "%s is not a %s",
  17097. integer: "%s is not an %s",
  17098. "float": "%s is not a %s",
  17099. regexp: "%s is not a valid %s",
  17100. email: "%s is not a valid %s",
  17101. url: "%s is not a valid %s",
  17102. hex: "%s is not a valid %s"
  17103. },
  17104. string: {
  17105. len: "%s must be exactly %s characters",
  17106. min: "%s must be at least %s characters",
  17107. max: "%s cannot be longer than %s characters",
  17108. range: "%s must be between %s and %s characters"
  17109. },
  17110. number: {
  17111. len: "%s must equal %s",
  17112. min: "%s cannot be less than %s",
  17113. max: "%s cannot be greater than %s",
  17114. range: "%s must be between %s and %s"
  17115. },
  17116. array: {
  17117. len: "%s must be exactly %s in length",
  17118. min: "%s cannot be less than %s in length",
  17119. max: "%s cannot be greater than %s in length",
  17120. range: "%s must be between %s and %s in length"
  17121. },
  17122. pattern: {
  17123. mismatch: "%s value %s does not match pattern %s"
  17124. },
  17125. clone: function clone2() {
  17126. var cloned = JSON.parse(JSON.stringify(this));
  17127. cloned.clone = this.clone;
  17128. return cloned;
  17129. }
  17130. };
  17131. }
  17132. var messages = newMessages();
  17133. var Schema = /* @__PURE__ */ function() {
  17134. function Schema2(descriptor) {
  17135. this.rules = null;
  17136. this._messages = messages;
  17137. this.define(descriptor);
  17138. }
  17139. var _proto = Schema2.prototype;
  17140. _proto.define = function define(rules2) {
  17141. var _this = this;
  17142. if (!rules2) {
  17143. throw new Error("Cannot configure a schema with no rules");
  17144. }
  17145. if (typeof rules2 !== "object" || Array.isArray(rules2)) {
  17146. throw new Error("Rules must be an object");
  17147. }
  17148. this.rules = {};
  17149. Object.keys(rules2).forEach(function(name) {
  17150. var item = rules2[name];
  17151. _this.rules[name] = Array.isArray(item) ? item : [item];
  17152. });
  17153. };
  17154. _proto.messages = function messages2(_messages) {
  17155. if (_messages) {
  17156. this._messages = deepMerge(newMessages(), _messages);
  17157. }
  17158. return this._messages;
  17159. };
  17160. _proto.validate = function validate(source_, o2, oc) {
  17161. var _this2 = this;
  17162. if (o2 === void 0) {
  17163. o2 = {};
  17164. }
  17165. if (oc === void 0) {
  17166. oc = function oc2() {
  17167. };
  17168. }
  17169. var source = source_;
  17170. var options = o2;
  17171. var callback = oc;
  17172. if (typeof options === "function") {
  17173. callback = options;
  17174. options = {};
  17175. }
  17176. if (!this.rules || Object.keys(this.rules).length === 0) {
  17177. if (callback) {
  17178. callback(null, source);
  17179. }
  17180. return Promise.resolve(source);
  17181. }
  17182. function complete(results) {
  17183. var errors = [];
  17184. var fields = {};
  17185. function add(e) {
  17186. if (Array.isArray(e)) {
  17187. var _errors;
  17188. errors = (_errors = errors).concat.apply(_errors, e);
  17189. } else {
  17190. errors.push(e);
  17191. }
  17192. }
  17193. for (var i = 0; i < results.length; i++) {
  17194. add(results[i]);
  17195. }
  17196. if (!errors.length) {
  17197. callback(null, source);
  17198. } else {
  17199. fields = convertFieldsError(errors);
  17200. callback(errors, fields);
  17201. }
  17202. }
  17203. if (options.messages) {
  17204. var messages$1 = this.messages();
  17205. if (messages$1 === messages) {
  17206. messages$1 = newMessages();
  17207. }
  17208. deepMerge(messages$1, options.messages);
  17209. options.messages = messages$1;
  17210. } else {
  17211. options.messages = this.messages();
  17212. }
  17213. var series = {};
  17214. var keys2 = options.keys || Object.keys(this.rules);
  17215. keys2.forEach(function(z) {
  17216. var arr = _this2.rules[z];
  17217. var value = source[z];
  17218. arr.forEach(function(r) {
  17219. var rule = r;
  17220. if (typeof rule.transform === "function") {
  17221. if (source === source_) {
  17222. source = _extends$1({}, source);
  17223. }
  17224. value = source[z] = rule.transform(value);
  17225. }
  17226. if (typeof rule === "function") {
  17227. rule = {
  17228. validator: rule
  17229. };
  17230. } else {
  17231. rule = _extends$1({}, rule);
  17232. }
  17233. rule.validator = _this2.getValidationMethod(rule);
  17234. if (!rule.validator) {
  17235. return;
  17236. }
  17237. rule.field = z;
  17238. rule.fullField = rule.fullField || z;
  17239. rule.type = _this2.getType(rule);
  17240. series[z] = series[z] || [];
  17241. series[z].push({
  17242. rule,
  17243. value,
  17244. source,
  17245. field: z
  17246. });
  17247. });
  17248. });
  17249. var errorFields = {};
  17250. return asyncMap(series, options, function(data2, doIt) {
  17251. var rule = data2.rule;
  17252. var deep = (rule.type === "object" || rule.type === "array") && (typeof rule.fields === "object" || typeof rule.defaultField === "object");
  17253. deep = deep && (rule.required || !rule.required && data2.value);
  17254. rule.field = data2.field;
  17255. function addFullField(key, schema) {
  17256. return _extends$1({}, schema, {
  17257. fullField: rule.fullField + "." + key,
  17258. fullFields: rule.fullFields ? [].concat(rule.fullFields, [key]) : [key]
  17259. });
  17260. }
  17261. function cb(e) {
  17262. if (e === void 0) {
  17263. e = [];
  17264. }
  17265. var errorList = Array.isArray(e) ? e : [e];
  17266. if (!options.suppressWarning && errorList.length) {
  17267. Schema2.warning("async-validator:", errorList);
  17268. }
  17269. if (errorList.length && rule.message !== void 0) {
  17270. errorList = [].concat(rule.message);
  17271. }
  17272. var filledErrors = errorList.map(complementError(rule, source));
  17273. if (options.first && filledErrors.length) {
  17274. errorFields[rule.field] = 1;
  17275. return doIt(filledErrors);
  17276. }
  17277. if (!deep) {
  17278. doIt(filledErrors);
  17279. } else {
  17280. if (rule.required && !data2.value) {
  17281. if (rule.message !== void 0) {
  17282. filledErrors = [].concat(rule.message).map(complementError(rule, source));
  17283. } else if (options.error) {
  17284. filledErrors = [options.error(rule, format(options.messages.required, rule.field))];
  17285. }
  17286. return doIt(filledErrors);
  17287. }
  17288. var fieldsSchema = {};
  17289. if (rule.defaultField) {
  17290. Object.keys(data2.value).map(function(key) {
  17291. fieldsSchema[key] = rule.defaultField;
  17292. });
  17293. }
  17294. fieldsSchema = _extends$1({}, fieldsSchema, data2.rule.fields);
  17295. var paredFieldsSchema = {};
  17296. Object.keys(fieldsSchema).forEach(function(field) {
  17297. var fieldSchema = fieldsSchema[field];
  17298. var fieldSchemaList = Array.isArray(fieldSchema) ? fieldSchema : [fieldSchema];
  17299. paredFieldsSchema[field] = fieldSchemaList.map(addFullField.bind(null, field));
  17300. });
  17301. var schema = new Schema2(paredFieldsSchema);
  17302. schema.messages(options.messages);
  17303. if (data2.rule.options) {
  17304. data2.rule.options.messages = options.messages;
  17305. data2.rule.options.error = options.error;
  17306. }
  17307. schema.validate(data2.value, data2.rule.options || options, function(errs) {
  17308. var finalErrors = [];
  17309. if (filledErrors && filledErrors.length) {
  17310. finalErrors.push.apply(finalErrors, filledErrors);
  17311. }
  17312. if (errs && errs.length) {
  17313. finalErrors.push.apply(finalErrors, errs);
  17314. }
  17315. doIt(finalErrors.length ? finalErrors : null);
  17316. });
  17317. }
  17318. }
  17319. var res;
  17320. if (rule.asyncValidator) {
  17321. res = rule.asyncValidator(rule, data2.value, cb, data2.source, options);
  17322. } else if (rule.validator) {
  17323. try {
  17324. res = rule.validator(rule, data2.value, cb, data2.source, options);
  17325. } catch (error) {
  17326. console.error == null ? void 0 : console.error(error);
  17327. if (!options.suppressValidatorError) {
  17328. setTimeout(function() {
  17329. throw error;
  17330. }, 0);
  17331. }
  17332. cb(error.message);
  17333. }
  17334. if (res === true) {
  17335. cb();
  17336. } else if (res === false) {
  17337. cb(typeof rule.message === "function" ? rule.message(rule.fullField || rule.field) : rule.message || (rule.fullField || rule.field) + " fails");
  17338. } else if (res instanceof Array) {
  17339. cb(res);
  17340. } else if (res instanceof Error) {
  17341. cb(res.message);
  17342. }
  17343. }
  17344. if (res && res.then) {
  17345. res.then(function() {
  17346. return cb();
  17347. }, function(e) {
  17348. return cb(e);
  17349. });
  17350. }
  17351. }, function(results) {
  17352. complete(results);
  17353. }, source);
  17354. };
  17355. _proto.getType = function getType(rule) {
  17356. if (rule.type === void 0 && rule.pattern instanceof RegExp) {
  17357. rule.type = "pattern";
  17358. }
  17359. if (typeof rule.validator !== "function" && rule.type && !validators.hasOwnProperty(rule.type)) {
  17360. throw new Error(format("Unknown rule type %s", rule.type));
  17361. }
  17362. return rule.type || "string";
  17363. };
  17364. _proto.getValidationMethod = function getValidationMethod(rule) {
  17365. if (typeof rule.validator === "function") {
  17366. return rule.validator;
  17367. }
  17368. var keys2 = Object.keys(rule);
  17369. var messageIndex = keys2.indexOf("message");
  17370. if (messageIndex !== -1) {
  17371. keys2.splice(messageIndex, 1);
  17372. }
  17373. if (keys2.length === 1 && keys2[0] === "required") {
  17374. return validators.required;
  17375. }
  17376. return validators[this.getType(rule)] || void 0;
  17377. };
  17378. return Schema2;
  17379. }();
  17380. Schema.register = function register(type4, validator) {
  17381. if (typeof validator !== "function") {
  17382. throw new Error("Cannot register a validator by type, validator is not a function");
  17383. }
  17384. validators[type4] = validator;
  17385. };
  17386. Schema.warning = warning;
  17387. Schema.messages = messages;
  17388. Schema.validators = validators;
  17389. const formItemValidateStates = [
  17390. "",
  17391. "error",
  17392. "validating",
  17393. "success"
  17394. ];
  17395. const formItemProps = buildProps({
  17396. label: String,
  17397. labelWidth: {
  17398. type: [String, Number],
  17399. default: ""
  17400. },
  17401. prop: {
  17402. type: definePropType([String, Array])
  17403. },
  17404. required: {
  17405. type: Boolean,
  17406. default: void 0
  17407. },
  17408. rules: {
  17409. type: definePropType([Object, Array])
  17410. },
  17411. error: String,
  17412. validateStatus: {
  17413. type: String,
  17414. values: formItemValidateStates
  17415. },
  17416. for: String,
  17417. inlineMessage: {
  17418. type: [String, Boolean],
  17419. default: ""
  17420. },
  17421. showMessage: {
  17422. type: Boolean,
  17423. default: true
  17424. },
  17425. size: {
  17426. type: String,
  17427. values: componentSizes
  17428. }
  17429. });
  17430. const COMPONENT_NAME$2 = "ElLabelWrap";
  17431. var FormLabelWrap = defineComponent({
  17432. name: COMPONENT_NAME$2,
  17433. props: {
  17434. isAutoWidth: Boolean,
  17435. updateAll: Boolean
  17436. },
  17437. setup(props, {
  17438. slots
  17439. }) {
  17440. const formContext = inject(formContextKey, void 0);
  17441. const formItemContext = inject(formItemContextKey);
  17442. if (!formItemContext)
  17443. throwError(COMPONENT_NAME$2, "usage: <el-form-item><label-wrap /></el-form-item>");
  17444. const ns = useNamespace("form");
  17445. const el = ref();
  17446. const computedWidth = ref(0);
  17447. const getLabelWidth = () => {
  17448. var _a2;
  17449. if ((_a2 = el.value) == null ? void 0 : _a2.firstElementChild) {
  17450. const width = window.getComputedStyle(el.value.firstElementChild).width;
  17451. return Math.ceil(Number.parseFloat(width));
  17452. } else {
  17453. return 0;
  17454. }
  17455. };
  17456. const updateLabelWidth = (action = "update") => {
  17457. nextTick(() => {
  17458. if (slots.default && props.isAutoWidth) {
  17459. if (action === "update") {
  17460. computedWidth.value = getLabelWidth();
  17461. } else if (action === "remove") {
  17462. formContext == null ? void 0 : formContext.deregisterLabelWidth(computedWidth.value);
  17463. }
  17464. }
  17465. });
  17466. };
  17467. const updateLabelWidthFn = () => updateLabelWidth("update");
  17468. onMounted(() => {
  17469. updateLabelWidthFn();
  17470. });
  17471. onBeforeUnmount(() => {
  17472. updateLabelWidth("remove");
  17473. });
  17474. onUpdated(() => updateLabelWidthFn());
  17475. watch(computedWidth, (val, oldVal) => {
  17476. if (props.updateAll) {
  17477. formContext == null ? void 0 : formContext.registerLabelWidth(val, oldVal);
  17478. }
  17479. });
  17480. useResizeObserver(computed(() => {
  17481. var _a2, _b2;
  17482. return (_b2 = (_a2 = el.value) == null ? void 0 : _a2.firstElementChild) != null ? _b2 : null;
  17483. }), updateLabelWidthFn);
  17484. return () => {
  17485. var _a2, _b2;
  17486. if (!slots)
  17487. return null;
  17488. const {
  17489. isAutoWidth
  17490. } = props;
  17491. if (isAutoWidth) {
  17492. const autoLabelWidth = formContext == null ? void 0 : formContext.autoLabelWidth;
  17493. const style = {};
  17494. if (autoLabelWidth && autoLabelWidth !== "auto") {
  17495. const marginWidth = Math.max(0, Number.parseInt(autoLabelWidth, 10) - computedWidth.value);
  17496. const marginPosition = formContext.labelPosition === "left" ? "marginRight" : "marginLeft";
  17497. if (marginWidth) {
  17498. style[marginPosition] = `${marginWidth}px`;
  17499. }
  17500. }
  17501. return createVNode("div", {
  17502. "ref": el,
  17503. "class": [ns.be("item", "label-wrap")],
  17504. "style": style
  17505. }, [(_a2 = slots.default) == null ? void 0 : _a2.call(slots)]);
  17506. } else {
  17507. return createVNode(Fragment, {
  17508. "ref": el
  17509. }, [(_b2 = slots.default) == null ? void 0 : _b2.call(slots)]);
  17510. }
  17511. };
  17512. }
  17513. });
  17514. const _hoisted_1$k = ["for"];
  17515. const __default__$8 = {
  17516. name: "ElFormItem"
  17517. };
  17518. const _sfc_main$u = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$8), {
  17519. props: formItemProps,
  17520. setup(__props, { expose }) {
  17521. const props = __props;
  17522. const slots = useSlots();
  17523. const formContext = inject(formContextKey, void 0);
  17524. const parentFormItemContext = inject(formItemContextKey, void 0);
  17525. const _size = useSize(void 0, { formItem: false });
  17526. const ns = useNamespace("form-item");
  17527. const validateState = ref("");
  17528. const validateStateDebounced = refDebounced(validateState, 100);
  17529. const validateMessage = ref("");
  17530. const formItemRef = ref();
  17531. let initialValue = void 0;
  17532. let isResettingField = false;
  17533. const labelStyle = computed(() => {
  17534. if ((formContext == null ? void 0 : formContext.labelPosition) === "top") {
  17535. return {};
  17536. }
  17537. const labelWidth = addUnit(props.labelWidth || (formContext == null ? void 0 : formContext.labelWidth) || "");
  17538. if (labelWidth)
  17539. return { width: labelWidth };
  17540. return {};
  17541. });
  17542. const contentStyle = computed(() => {
  17543. if ((formContext == null ? void 0 : formContext.labelPosition) === "top" || (formContext == null ? void 0 : formContext.inline)) {
  17544. return {};
  17545. }
  17546. if (!props.label && !props.labelWidth && isNested) {
  17547. return {};
  17548. }
  17549. const labelWidth = addUnit(props.labelWidth || (formContext == null ? void 0 : formContext.labelWidth) || "");
  17550. if (!props.label && !slots.label) {
  17551. return { marginLeft: labelWidth };
  17552. }
  17553. return {};
  17554. });
  17555. const formItemClasses = computed(() => [
  17556. ns.b(),
  17557. ns.m(_size.value),
  17558. ns.is("error", validateState.value === "error"),
  17559. ns.is("validating", validateState.value === "validating"),
  17560. ns.is("success", validateState.value === "success"),
  17561. ns.is("required", isRequired.value || props.required),
  17562. ns.is("no-asterisk", formContext == null ? void 0 : formContext.hideRequiredAsterisk),
  17563. { [ns.m("feedback")]: formContext == null ? void 0 : formContext.statusIcon }
  17564. ]);
  17565. const _inlineMessage = computed(() => isBoolean(props.inlineMessage) ? props.inlineMessage : (formContext == null ? void 0 : formContext.inlineMessage) || false);
  17566. const validateClasses = computed(() => [
  17567. ns.e("error"),
  17568. { [ns.em("error", "inline")]: _inlineMessage.value }
  17569. ]);
  17570. const propString = computed(() => {
  17571. if (!props.prop)
  17572. return "";
  17573. return isString(props.prop) ? props.prop : props.prop.join(".");
  17574. });
  17575. const labelFor = computed(() => props.for || propString.value);
  17576. const isNested = !!parentFormItemContext;
  17577. const fieldValue = computed(() => {
  17578. const model = formContext == null ? void 0 : formContext.model;
  17579. if (!model || !props.prop) {
  17580. return;
  17581. }
  17582. return getProp(model, props.prop).value;
  17583. });
  17584. const _rules = computed(() => {
  17585. const rules2 = props.rules ? castArray$1(props.rules) : [];
  17586. const formRules = formContext == null ? void 0 : formContext.rules;
  17587. if (formRules && props.prop) {
  17588. const _rules2 = getProp(formRules, props.prop).value;
  17589. if (_rules2) {
  17590. rules2.push(...castArray$1(_rules2));
  17591. }
  17592. }
  17593. if (props.required !== void 0) {
  17594. rules2.push({ required: !!props.required });
  17595. }
  17596. return rules2;
  17597. });
  17598. const validateEnabled = computed(() => _rules.value.length > 0);
  17599. const getFilteredRule = (trigger) => {
  17600. const rules2 = _rules.value;
  17601. return rules2.filter((rule) => {
  17602. if (!rule.trigger || !trigger)
  17603. return true;
  17604. if (Array.isArray(rule.trigger)) {
  17605. return rule.trigger.includes(trigger);
  17606. } else {
  17607. return rule.trigger === trigger;
  17608. }
  17609. }).map((_a2) => {
  17610. var _b2 = _a2, { trigger: trigger2 } = _b2, rule = __objRest(_b2, ["trigger"]);
  17611. return rule;
  17612. });
  17613. };
  17614. const isRequired = computed(() => _rules.value.some((rule) => rule.required === true));
  17615. const shouldShowError = computed(() => {
  17616. var _a2;
  17617. return validateStateDebounced.value === "error" && props.showMessage && ((_a2 = formContext == null ? void 0 : formContext.showMessage) != null ? _a2 : true);
  17618. });
  17619. const currentLabel = computed(() => `${props.label || ""}${(formContext == null ? void 0 : formContext.labelSuffix) || ""}`);
  17620. const setValidationState = (state) => {
  17621. validateState.value = state;
  17622. };
  17623. const onValidationFailed = (error) => {
  17624. var _a2, _b2;
  17625. const { errors, fields } = error;
  17626. if (!errors || !fields) {
  17627. console.error(error);
  17628. }
  17629. setValidationState("error");
  17630. validateMessage.value = errors ? (_b2 = (_a2 = errors == null ? void 0 : errors[0]) == null ? void 0 : _a2.message) != null ? _b2 : `${props.prop} is required` : "";
  17631. formContext == null ? void 0 : formContext.emit("validate", props.prop, false, validateMessage.value);
  17632. };
  17633. const onValidationSucceeded = () => {
  17634. setValidationState("success");
  17635. formContext == null ? void 0 : formContext.emit("validate", props.prop, true, "");
  17636. };
  17637. const doValidate = async (rules2) => {
  17638. const modelName = propString.value;
  17639. const validator = new Schema({
  17640. [modelName]: rules2
  17641. });
  17642. return validator.validate({ [modelName]: fieldValue.value }, { firstFields: true }).then(() => {
  17643. onValidationSucceeded();
  17644. return true;
  17645. }).catch((err) => {
  17646. onValidationFailed(err);
  17647. return Promise.reject(err);
  17648. });
  17649. };
  17650. const validate = async (trigger, callback) => {
  17651. if (isResettingField) {
  17652. isResettingField = false;
  17653. return false;
  17654. }
  17655. const hasCallback = isFunction(callback);
  17656. if (!validateEnabled.value) {
  17657. callback == null ? void 0 : callback(false);
  17658. return false;
  17659. }
  17660. const rules2 = getFilteredRule(trigger);
  17661. if (rules2.length === 0) {
  17662. callback == null ? void 0 : callback(true);
  17663. return true;
  17664. }
  17665. setValidationState("validating");
  17666. return doValidate(rules2).then(() => {
  17667. callback == null ? void 0 : callback(true);
  17668. return true;
  17669. }).catch((err) => {
  17670. const { fields } = err;
  17671. callback == null ? void 0 : callback(false, fields);
  17672. return hasCallback ? false : Promise.reject(fields);
  17673. });
  17674. };
  17675. const clearValidate = () => {
  17676. setValidationState("");
  17677. validateMessage.value = "";
  17678. };
  17679. const resetField = async () => {
  17680. const model = formContext == null ? void 0 : formContext.model;
  17681. if (!model || !props.prop)
  17682. return;
  17683. const computedValue = getProp(model, props.prop);
  17684. if (!isEqual(computedValue.value, initialValue)) {
  17685. isResettingField = true;
  17686. }
  17687. computedValue.value = initialValue;
  17688. await nextTick();
  17689. clearValidate();
  17690. };
  17691. watch(() => props.error, (val) => {
  17692. validateMessage.value = val || "";
  17693. setValidationState(val ? "error" : "");
  17694. }, { immediate: true });
  17695. watch(() => props.validateStatus, (val) => setValidationState(val || ""));
  17696. const context = reactive(__spreadProps(__spreadValues({}, toRefs(props)), {
  17697. $el: formItemRef,
  17698. size: _size,
  17699. validateState,
  17700. resetField,
  17701. clearValidate,
  17702. validate
  17703. }));
  17704. provide(formItemContextKey, context);
  17705. onMounted(() => {
  17706. if (props.prop) {
  17707. formContext == null ? void 0 : formContext.addField(context);
  17708. initialValue = clone(fieldValue.value);
  17709. }
  17710. });
  17711. onBeforeUnmount(() => {
  17712. formContext == null ? void 0 : formContext.removeField(context);
  17713. });
  17714. expose({
  17715. size: _size,
  17716. validateMessage,
  17717. validateState,
  17718. validate,
  17719. clearValidate,
  17720. resetField
  17721. });
  17722. return (_ctx, _cache) => {
  17723. var _a2;
  17724. return openBlock(), createElementBlock("div", {
  17725. ref_key: "formItemRef",
  17726. ref: formItemRef,
  17727. class: normalizeClass(unref(formItemClasses))
  17728. }, [
  17729. createVNode(unref(FormLabelWrap), {
  17730. "is-auto-width": unref(labelStyle).width === "auto",
  17731. "update-all": ((_a2 = unref(formContext)) == null ? void 0 : _a2.labelWidth) === "auto"
  17732. }, {
  17733. default: withCtx(() => [
  17734. _ctx.label || _ctx.$slots.label ? (openBlock(), createElementBlock("label", {
  17735. key: 0,
  17736. for: unref(labelFor),
  17737. class: normalizeClass(unref(ns).e("label")),
  17738. style: normalizeStyle(unref(labelStyle))
  17739. }, [
  17740. renderSlot(_ctx.$slots, "label", { label: unref(currentLabel) }, () => [
  17741. createTextVNode(toDisplayString(unref(currentLabel)), 1)
  17742. ])
  17743. ], 14, _hoisted_1$k)) : createCommentVNode("v-if", true)
  17744. ]),
  17745. _: 3
  17746. }, 8, ["is-auto-width", "update-all"]),
  17747. createElementVNode("div", {
  17748. class: normalizeClass(unref(ns).e("content")),
  17749. style: normalizeStyle(unref(contentStyle))
  17750. }, [
  17751. renderSlot(_ctx.$slots, "default"),
  17752. createVNode(Transition, {
  17753. name: `${unref(ns).namespace.value}-zoom-in-top`
  17754. }, {
  17755. default: withCtx(() => [
  17756. unref(shouldShowError) ? renderSlot(_ctx.$slots, "error", {
  17757. key: 0,
  17758. error: validateMessage.value
  17759. }, () => [
  17760. createElementVNode("div", {
  17761. class: normalizeClass(unref(validateClasses))
  17762. }, toDisplayString(validateMessage.value), 3)
  17763. ]) : createCommentVNode("v-if", true)
  17764. ]),
  17765. _: 3
  17766. }, 8, ["name"])
  17767. ], 6)
  17768. ], 2);
  17769. };
  17770. }
  17771. }));
  17772. var FormItem = /* @__PURE__ */ _export_sfc$1(_sfc_main$u, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/form/src/form-item.vue"]]);
  17773. const ElForm = withInstall(Form, {
  17774. FormItem
  17775. });
  17776. const ElFormItem = withNoopInstall(FormItem);
  17777. const imageViewerProps = buildProps({
  17778. urlList: {
  17779. type: definePropType(Array),
  17780. default: () => mutable([])
  17781. },
  17782. zIndex: {
  17783. type: Number
  17784. },
  17785. initialIndex: {
  17786. type: Number,
  17787. default: 0
  17788. },
  17789. infinite: {
  17790. type: Boolean,
  17791. default: true
  17792. },
  17793. hideOnClickModal: {
  17794. type: Boolean,
  17795. default: false
  17796. },
  17797. teleported: {
  17798. type: Boolean,
  17799. default: false
  17800. }
  17801. });
  17802. const imageViewerEmits = {
  17803. close: () => true,
  17804. switch: (index) => typeof index === "number"
  17805. };
  17806. const _hoisted_1$j = ["src"];
  17807. const __default__$7 = {
  17808. name: "ElImageViewer"
  17809. };
  17810. const _sfc_main$t = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$7), {
  17811. props: imageViewerProps,
  17812. emits: imageViewerEmits,
  17813. setup(__props, { emit }) {
  17814. const props = __props;
  17815. const Mode = {
  17816. CONTAIN: {
  17817. name: "contain",
  17818. icon: markRaw(fullScreen)
  17819. },
  17820. ORIGINAL: {
  17821. name: "original",
  17822. icon: markRaw(scaleToOriginal)
  17823. }
  17824. };
  17825. const mousewheelEventName = isFirefox() ? "DOMMouseScroll" : "mousewheel";
  17826. const { t } = useLocale();
  17827. const ns = useNamespace("image-viewer");
  17828. const { nextZIndex } = useZIndex();
  17829. const wrapper = ref();
  17830. const imgRefs = ref([]);
  17831. const scopeEventListener = effectScope();
  17832. const loading2 = ref(true);
  17833. const index = ref(props.initialIndex);
  17834. const mode = ref(Mode.CONTAIN);
  17835. const transform = ref({
  17836. scale: 1,
  17837. deg: 0,
  17838. offsetX: 0,
  17839. offsetY: 0,
  17840. enableTransition: false
  17841. });
  17842. const isSingle = computed(() => {
  17843. const { urlList } = props;
  17844. return urlList.length <= 1;
  17845. });
  17846. const isFirst = computed(() => {
  17847. return index.value === 0;
  17848. });
  17849. const isLast = computed(() => {
  17850. return index.value === props.urlList.length - 1;
  17851. });
  17852. const currentImg = computed(() => {
  17853. return props.urlList[index.value];
  17854. });
  17855. const imgStyle = computed(() => {
  17856. const { scale, deg, offsetX, offsetY, enableTransition } = transform.value;
  17857. let translateX = offsetX / scale;
  17858. let translateY = offsetY / scale;
  17859. switch (deg % 360) {
  17860. case 90:
  17861. case -270:
  17862. [translateX, translateY] = [translateY, -translateX];
  17863. break;
  17864. case 180:
  17865. case -180:
  17866. [translateX, translateY] = [-translateX, -translateY];
  17867. break;
  17868. case 270:
  17869. case -90:
  17870. [translateX, translateY] = [-translateY, translateX];
  17871. break;
  17872. }
  17873. const style = {
  17874. transform: `scale(${scale}) rotate(${deg}deg) translate(${translateX}px, ${translateY}px)`,
  17875. transition: enableTransition ? "transform .3s" : ""
  17876. };
  17877. if (mode.value.name === Mode.CONTAIN.name) {
  17878. style.maxWidth = style.maxHeight = "100%";
  17879. }
  17880. return style;
  17881. });
  17882. const computedZIndex = computed(() => {
  17883. return isNumber(props.zIndex) ? props.zIndex : nextZIndex();
  17884. });
  17885. function hide2() {
  17886. unregisterEventListener();
  17887. emit("close");
  17888. }
  17889. function registerEventListener() {
  17890. const keydownHandler = throttle((e) => {
  17891. switch (e.code) {
  17892. case EVENT_CODE.esc:
  17893. hide2();
  17894. break;
  17895. case EVENT_CODE.space:
  17896. toggleMode();
  17897. break;
  17898. case EVENT_CODE.left:
  17899. prev();
  17900. break;
  17901. case EVENT_CODE.up:
  17902. handleActions("zoomIn");
  17903. break;
  17904. case EVENT_CODE.right:
  17905. next();
  17906. break;
  17907. case EVENT_CODE.down:
  17908. handleActions("zoomOut");
  17909. break;
  17910. }
  17911. });
  17912. const mousewheelHandler = throttle((e) => {
  17913. const delta = e.wheelDelta ? e.wheelDelta : -e.detail;
  17914. if (delta > 0) {
  17915. handleActions("zoomIn", {
  17916. zoomRate: 1.2,
  17917. enableTransition: false
  17918. });
  17919. } else {
  17920. handleActions("zoomOut", {
  17921. zoomRate: 1.2,
  17922. enableTransition: false
  17923. });
  17924. }
  17925. });
  17926. scopeEventListener.run(() => {
  17927. useEventListener(document, "keydown", keydownHandler);
  17928. useEventListener(document, mousewheelEventName, mousewheelHandler);
  17929. });
  17930. }
  17931. function unregisterEventListener() {
  17932. scopeEventListener.stop();
  17933. }
  17934. function handleImgLoad() {
  17935. loading2.value = false;
  17936. }
  17937. function handleImgError(e) {
  17938. loading2.value = false;
  17939. e.target.alt = t("el.image.error");
  17940. }
  17941. function handleMouseDown(e) {
  17942. if (loading2.value || e.button !== 0 || !wrapper.value)
  17943. return;
  17944. transform.value.enableTransition = false;
  17945. const { offsetX, offsetY } = transform.value;
  17946. const startX = e.pageX;
  17947. const startY = e.pageY;
  17948. const dragHandler = throttle((ev) => {
  17949. transform.value = __spreadProps(__spreadValues({}, transform.value), {
  17950. offsetX: offsetX + ev.pageX - startX,
  17951. offsetY: offsetY + ev.pageY - startY
  17952. });
  17953. });
  17954. const removeMousemove = useEventListener(document, "mousemove", dragHandler);
  17955. useEventListener(document, "mouseup", () => {
  17956. removeMousemove();
  17957. });
  17958. e.preventDefault();
  17959. }
  17960. function reset() {
  17961. transform.value = {
  17962. scale: 1,
  17963. deg: 0,
  17964. offsetX: 0,
  17965. offsetY: 0,
  17966. enableTransition: false
  17967. };
  17968. }
  17969. function toggleMode() {
  17970. if (loading2.value)
  17971. return;
  17972. const modeNames = Object.keys(Mode);
  17973. const modeValues = Object.values(Mode);
  17974. const currentMode = mode.value.name;
  17975. const index2 = modeValues.findIndex((i) => i.name === currentMode);
  17976. const nextIndex = (index2 + 1) % modeNames.length;
  17977. mode.value = Mode[modeNames[nextIndex]];
  17978. reset();
  17979. }
  17980. function prev() {
  17981. if (isFirst.value && !props.infinite)
  17982. return;
  17983. const len = props.urlList.length;
  17984. index.value = (index.value - 1 + len) % len;
  17985. }
  17986. function next() {
  17987. if (isLast.value && !props.infinite)
  17988. return;
  17989. const len = props.urlList.length;
  17990. index.value = (index.value + 1) % len;
  17991. }
  17992. function handleActions(action, options = {}) {
  17993. if (loading2.value)
  17994. return;
  17995. const { zoomRate, rotateDeg, enableTransition } = __spreadValues({
  17996. zoomRate: 1.4,
  17997. rotateDeg: 90,
  17998. enableTransition: true
  17999. }, options);
  18000. switch (action) {
  18001. case "zoomOut":
  18002. if (transform.value.scale > 0.2) {
  18003. transform.value.scale = Number.parseFloat((transform.value.scale / zoomRate).toFixed(3));
  18004. }
  18005. break;
  18006. case "zoomIn":
  18007. if (transform.value.scale < 7) {
  18008. transform.value.scale = Number.parseFloat((transform.value.scale * zoomRate).toFixed(3));
  18009. }
  18010. break;
  18011. case "clockwise":
  18012. transform.value.deg += rotateDeg;
  18013. break;
  18014. case "anticlockwise":
  18015. transform.value.deg -= rotateDeg;
  18016. break;
  18017. }
  18018. transform.value.enableTransition = enableTransition;
  18019. }
  18020. watch(currentImg, () => {
  18021. nextTick(() => {
  18022. const $img = imgRefs.value[0];
  18023. if (!($img == null ? void 0 : $img.complete)) {
  18024. loading2.value = true;
  18025. }
  18026. });
  18027. });
  18028. watch(index, (val) => {
  18029. reset();
  18030. emit("switch", val);
  18031. });
  18032. onMounted(() => {
  18033. var _a2, _b2;
  18034. registerEventListener();
  18035. (_b2 = (_a2 = wrapper.value) == null ? void 0 : _a2.focus) == null ? void 0 : _b2.call(_a2);
  18036. });
  18037. return (_ctx, _cache) => {
  18038. return openBlock(), createBlock(Teleport, {
  18039. to: "body",
  18040. disabled: !_ctx.teleported
  18041. }, [
  18042. createVNode(Transition, {
  18043. name: "viewer-fade",
  18044. appear: ""
  18045. }, {
  18046. default: withCtx(() => [
  18047. createElementVNode("div", {
  18048. ref_key: "wrapper",
  18049. ref: wrapper,
  18050. tabindex: -1,
  18051. class: normalizeClass(unref(ns).e("wrapper")),
  18052. style: normalizeStyle({ zIndex: unref(computedZIndex) })
  18053. }, [
  18054. createElementVNode("div", {
  18055. class: normalizeClass(unref(ns).e("mask")),
  18056. onClick: _cache[0] || (_cache[0] = withModifiers(($event) => _ctx.hideOnClickModal && hide2(), ["self"]))
  18057. }, null, 2),
  18058. createCommentVNode(" CLOSE "),
  18059. createElementVNode("span", {
  18060. class: normalizeClass([unref(ns).e("btn"), unref(ns).e("close")]),
  18061. onClick: hide2
  18062. }, [
  18063. createVNode(unref(ElIcon), null, {
  18064. default: withCtx(() => [
  18065. createVNode(unref(close))
  18066. ]),
  18067. _: 1
  18068. })
  18069. ], 2),
  18070. createCommentVNode(" ARROW "),
  18071. !unref(isSingle) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  18072. createElementVNode("span", {
  18073. class: normalizeClass([
  18074. unref(ns).e("btn"),
  18075. unref(ns).e("prev"),
  18076. unref(ns).is("disabled", !_ctx.infinite && unref(isFirst))
  18077. ]),
  18078. onClick: prev
  18079. }, [
  18080. createVNode(unref(ElIcon), null, {
  18081. default: withCtx(() => [
  18082. createVNode(unref(arrowLeft))
  18083. ]),
  18084. _: 1
  18085. })
  18086. ], 2),
  18087. createElementVNode("span", {
  18088. class: normalizeClass([
  18089. unref(ns).e("btn"),
  18090. unref(ns).e("next"),
  18091. unref(ns).is("disabled", !_ctx.infinite && unref(isLast))
  18092. ]),
  18093. onClick: next
  18094. }, [
  18095. createVNode(unref(ElIcon), null, {
  18096. default: withCtx(() => [
  18097. createVNode(unref(arrowRight))
  18098. ]),
  18099. _: 1
  18100. })
  18101. ], 2)
  18102. ], 64)) : createCommentVNode("v-if", true),
  18103. createCommentVNode(" ACTIONS "),
  18104. createElementVNode("div", {
  18105. class: normalizeClass([unref(ns).e("btn"), unref(ns).e("actions")])
  18106. }, [
  18107. createElementVNode("div", {
  18108. class: normalizeClass(unref(ns).e("actions__inner"))
  18109. }, [
  18110. createVNode(unref(ElIcon), {
  18111. onClick: _cache[1] || (_cache[1] = ($event) => handleActions("zoomOut"))
  18112. }, {
  18113. default: withCtx(() => [
  18114. createVNode(unref(zoomOut))
  18115. ]),
  18116. _: 1
  18117. }),
  18118. createVNode(unref(ElIcon), {
  18119. onClick: _cache[2] || (_cache[2] = ($event) => handleActions("zoomIn"))
  18120. }, {
  18121. default: withCtx(() => [
  18122. createVNode(unref(zoomIn))
  18123. ]),
  18124. _: 1
  18125. }),
  18126. createElementVNode("i", {
  18127. class: normalizeClass(unref(ns).e("actions__divider"))
  18128. }, null, 2),
  18129. createVNode(unref(ElIcon), { onClick: toggleMode }, {
  18130. default: withCtx(() => [
  18131. (openBlock(), createBlock(resolveDynamicComponent(mode.value.icon)))
  18132. ]),
  18133. _: 1
  18134. }),
  18135. createElementVNode("i", {
  18136. class: normalizeClass(unref(ns).e("actions__divider"))
  18137. }, null, 2),
  18138. createVNode(unref(ElIcon), {
  18139. onClick: _cache[3] || (_cache[3] = ($event) => handleActions("anticlockwise"))
  18140. }, {
  18141. default: withCtx(() => [
  18142. createVNode(unref(refreshLeft))
  18143. ]),
  18144. _: 1
  18145. }),
  18146. createVNode(unref(ElIcon), {
  18147. onClick: _cache[4] || (_cache[4] = ($event) => handleActions("clockwise"))
  18148. }, {
  18149. default: withCtx(() => [
  18150. createVNode(unref(refreshRight))
  18151. ]),
  18152. _: 1
  18153. })
  18154. ], 2)
  18155. ], 2),
  18156. createCommentVNode(" CANVAS "),
  18157. createElementVNode("div", {
  18158. class: normalizeClass(unref(ns).e("canvas"))
  18159. }, [
  18160. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.urlList, (url2, i) => {
  18161. return withDirectives((openBlock(), createElementBlock("img", {
  18162. ref_for: true,
  18163. ref: (el) => imgRefs.value[i] = el,
  18164. key: url2,
  18165. src: url2,
  18166. style: normalizeStyle(unref(imgStyle)),
  18167. class: normalizeClass(unref(ns).e("img")),
  18168. onLoad: handleImgLoad,
  18169. onError: handleImgError,
  18170. onMousedown: handleMouseDown
  18171. }, null, 46, _hoisted_1$j)), [
  18172. [vShow, i === index.value]
  18173. ]);
  18174. }), 128))
  18175. ], 2),
  18176. renderSlot(_ctx.$slots, "default")
  18177. ], 6)
  18178. ]),
  18179. _: 3
  18180. })
  18181. ], 8, ["disabled"]);
  18182. };
  18183. }
  18184. }));
  18185. var ImageViewer = /* @__PURE__ */ _export_sfc$1(_sfc_main$t, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/image-viewer/src/image-viewer.vue"]]);
  18186. const ElImageViewer = withInstall(ImageViewer);
  18187. const imageProps = buildProps({
  18188. appendToBody: {
  18189. type: Boolean,
  18190. default: void 0
  18191. },
  18192. hideOnClickModal: {
  18193. type: Boolean,
  18194. default: false
  18195. },
  18196. src: {
  18197. type: String,
  18198. default: ""
  18199. },
  18200. fit: {
  18201. type: String,
  18202. values: ["", "contain", "cover", "fill", "none", "scale-down"],
  18203. default: ""
  18204. },
  18205. lazy: {
  18206. type: Boolean,
  18207. default: false
  18208. },
  18209. scrollContainer: {
  18210. type: definePropType([String, Object])
  18211. },
  18212. previewSrcList: {
  18213. type: definePropType(Array),
  18214. default: () => mutable([])
  18215. },
  18216. previewTeleported: {
  18217. type: Boolean,
  18218. default: false
  18219. },
  18220. zIndex: {
  18221. type: Number
  18222. },
  18223. initialIndex: {
  18224. type: Number,
  18225. default: 0
  18226. },
  18227. infinite: {
  18228. type: Boolean,
  18229. default: true
  18230. }
  18231. });
  18232. const imageEmits = {
  18233. error: (evt) => evt instanceof Event,
  18234. switch: (val) => isNumber(val),
  18235. close: () => true
  18236. };
  18237. const _hoisted_1$i = ["src"];
  18238. const _hoisted_2$g = { key: 0 };
  18239. const __default__$6 = {
  18240. name: "ElImage"
  18241. };
  18242. const _sfc_main$s = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$6), {
  18243. props: imageProps,
  18244. emits: imageEmits,
  18245. setup(__props, { emit }) {
  18246. const props = __props;
  18247. let prevOverflow = "";
  18248. useDeprecated({
  18249. scope: "el-image",
  18250. from: "append-to-body",
  18251. replacement: "preview-teleported",
  18252. version: "2.2.0",
  18253. ref: "https://element-plus.org/en-US/component/image.html#image-attributess"
  18254. }, computed(() => isBoolean(props.appendToBody)));
  18255. const { t } = useLocale();
  18256. const ns = useNamespace("image");
  18257. const attrs = useAttrs();
  18258. const hasLoadError = ref(false);
  18259. const loading2 = ref(true);
  18260. const imgWidth = ref(0);
  18261. const imgHeight = ref(0);
  18262. const showViewer = ref(false);
  18263. const container = ref();
  18264. const _scrollContainer = ref();
  18265. let stopScrollListener;
  18266. let stopWheelListener;
  18267. const containerStyle = computed(() => attrs.value.style);
  18268. const imageStyle = computed(() => {
  18269. const { fit } = props;
  18270. if (isClient && fit) {
  18271. return { objectFit: fit };
  18272. }
  18273. return {};
  18274. });
  18275. const preview = computed(() => {
  18276. const { previewSrcList } = props;
  18277. return Array.isArray(previewSrcList) && previewSrcList.length > 0;
  18278. });
  18279. const teleported = computed(() => {
  18280. return props.appendToBody || props.previewTeleported;
  18281. });
  18282. const imageIndex = computed(() => {
  18283. const { previewSrcList, initialIndex } = props;
  18284. let previewIndex = initialIndex;
  18285. if (initialIndex > previewSrcList.length - 1) {
  18286. previewIndex = 0;
  18287. }
  18288. return previewIndex;
  18289. });
  18290. const loadImage = () => {
  18291. if (!isClient)
  18292. return;
  18293. loading2.value = true;
  18294. hasLoadError.value = false;
  18295. const img = new Image();
  18296. const currentImageSrc = props.src;
  18297. img.addEventListener("load", (e) => {
  18298. if (currentImageSrc !== props.src) {
  18299. return;
  18300. }
  18301. handleLoad(e, img);
  18302. });
  18303. img.addEventListener("error", (e) => {
  18304. if (currentImageSrc !== props.src) {
  18305. return;
  18306. }
  18307. handleError(e);
  18308. });
  18309. Object.entries(attrs.value).forEach(([key, value]) => {
  18310. if (key.toLowerCase() === "onload")
  18311. return;
  18312. img.setAttribute(key, value);
  18313. });
  18314. img.src = currentImageSrc;
  18315. };
  18316. function handleLoad(e, img) {
  18317. imgWidth.value = img.width;
  18318. imgHeight.value = img.height;
  18319. loading2.value = false;
  18320. hasLoadError.value = false;
  18321. }
  18322. function handleError(event) {
  18323. loading2.value = false;
  18324. hasLoadError.value = true;
  18325. emit("error", event);
  18326. }
  18327. function handleLazyLoad() {
  18328. if (isInContainer(container.value, _scrollContainer.value)) {
  18329. loadImage();
  18330. removeLazyLoadListener();
  18331. }
  18332. }
  18333. const lazyLoadHandler = useThrottleFn(handleLazyLoad, 200);
  18334. async function addLazyLoadListener() {
  18335. var _a2;
  18336. if (!isClient)
  18337. return;
  18338. await nextTick();
  18339. const { scrollContainer } = props;
  18340. if (isElement$1(scrollContainer)) {
  18341. _scrollContainer.value = scrollContainer;
  18342. } else if (isString(scrollContainer) && scrollContainer !== "") {
  18343. _scrollContainer.value = (_a2 = document.querySelector(scrollContainer)) != null ? _a2 : void 0;
  18344. } else if (container.value) {
  18345. _scrollContainer.value = getScrollContainer(container.value);
  18346. }
  18347. if (_scrollContainer.value) {
  18348. stopScrollListener = useEventListener(_scrollContainer, "scroll", lazyLoadHandler);
  18349. setTimeout(() => handleLazyLoad(), 100);
  18350. }
  18351. }
  18352. function removeLazyLoadListener() {
  18353. if (!isClient || !_scrollContainer.value || !lazyLoadHandler)
  18354. return;
  18355. stopScrollListener();
  18356. _scrollContainer.value = void 0;
  18357. }
  18358. function wheelHandler(e) {
  18359. if (!e.ctrlKey)
  18360. return;
  18361. if (e.deltaY < 0) {
  18362. e.preventDefault();
  18363. return false;
  18364. } else if (e.deltaY > 0) {
  18365. e.preventDefault();
  18366. return false;
  18367. }
  18368. }
  18369. function clickHandler() {
  18370. if (!preview.value)
  18371. return;
  18372. stopWheelListener = useEventListener("wheel", wheelHandler, {
  18373. passive: false
  18374. });
  18375. prevOverflow = document.body.style.overflow;
  18376. document.body.style.overflow = "hidden";
  18377. showViewer.value = true;
  18378. }
  18379. function closeViewer() {
  18380. stopWheelListener == null ? void 0 : stopWheelListener();
  18381. document.body.style.overflow = prevOverflow;
  18382. showViewer.value = false;
  18383. emit("close");
  18384. }
  18385. function switchViewer(val) {
  18386. emit("switch", val);
  18387. }
  18388. watch(() => props.src, () => {
  18389. if (props.lazy) {
  18390. loading2.value = true;
  18391. hasLoadError.value = false;
  18392. removeLazyLoadListener();
  18393. addLazyLoadListener();
  18394. } else {
  18395. loadImage();
  18396. }
  18397. });
  18398. onMounted(() => {
  18399. if (props.lazy) {
  18400. addLazyLoadListener();
  18401. } else {
  18402. loadImage();
  18403. }
  18404. });
  18405. return (_ctx, _cache) => {
  18406. return openBlock(), createElementBlock("div", {
  18407. ref_key: "container",
  18408. ref: container,
  18409. class: normalizeClass([unref(ns).b(), _ctx.$attrs.class]),
  18410. style: normalizeStyle(unref(containerStyle))
  18411. }, [
  18412. loading2.value ? renderSlot(_ctx.$slots, "placeholder", { key: 0 }, () => [
  18413. createElementVNode("div", {
  18414. class: normalizeClass(unref(ns).e("placeholder"))
  18415. }, null, 2)
  18416. ]) : hasLoadError.value ? renderSlot(_ctx.$slots, "error", { key: 1 }, () => [
  18417. createElementVNode("div", {
  18418. class: normalizeClass(unref(ns).e("error"))
  18419. }, toDisplayString(unref(t)("el.image.error")), 3)
  18420. ]) : (openBlock(), createElementBlock("img", mergeProps({ key: 2 }, unref(attrs), {
  18421. src: _ctx.src,
  18422. style: unref(imageStyle),
  18423. class: [unref(ns).e("inner"), unref(preview) ? unref(ns).e("preview") : ""],
  18424. onClick: clickHandler
  18425. }), null, 16, _hoisted_1$i)),
  18426. unref(preview) ? (openBlock(), createElementBlock(Fragment, { key: 3 }, [
  18427. showViewer.value ? (openBlock(), createBlock(unref(ElImageViewer), {
  18428. key: 0,
  18429. "z-index": _ctx.zIndex,
  18430. "initial-index": unref(imageIndex),
  18431. infinite: _ctx.infinite,
  18432. "url-list": _ctx.previewSrcList,
  18433. "hide-on-click-modal": _ctx.hideOnClickModal,
  18434. teleported: unref(teleported),
  18435. onClose: closeViewer,
  18436. onSwitch: switchViewer
  18437. }, {
  18438. default: withCtx(() => [
  18439. _ctx.$slots.viewer ? (openBlock(), createElementBlock("div", _hoisted_2$g, [
  18440. renderSlot(_ctx.$slots, "viewer")
  18441. ])) : createCommentVNode("v-if", true)
  18442. ]),
  18443. _: 3
  18444. }, 8, ["z-index", "initial-index", "infinite", "url-list", "hide-on-click-modal", "teleported"])) : createCommentVNode("v-if", true)
  18445. ], 2112)) : createCommentVNode("v-if", true)
  18446. ], 6);
  18447. };
  18448. }
  18449. }));
  18450. var Image$1 = /* @__PURE__ */ _export_sfc$1(_sfc_main$s, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/image/src/image.vue"]]);
  18451. const ElImage = withInstall(Image$1);
  18452. const inputNumberProps = buildProps({
  18453. step: {
  18454. type: Number,
  18455. default: 1
  18456. },
  18457. stepStrictly: {
  18458. type: Boolean,
  18459. default: false
  18460. },
  18461. max: {
  18462. type: Number,
  18463. default: Number.POSITIVE_INFINITY
  18464. },
  18465. min: {
  18466. type: Number,
  18467. default: Number.NEGATIVE_INFINITY
  18468. },
  18469. modelValue: {
  18470. type: Number
  18471. },
  18472. disabled: {
  18473. type: Boolean,
  18474. default: false
  18475. },
  18476. size: {
  18477. type: String,
  18478. values: componentSizes
  18479. },
  18480. controls: {
  18481. type: Boolean,
  18482. default: true
  18483. },
  18484. controlsPosition: {
  18485. type: String,
  18486. default: "",
  18487. values: ["", "right"]
  18488. },
  18489. name: String,
  18490. label: String,
  18491. placeholder: String,
  18492. precision: {
  18493. type: Number,
  18494. validator: (val) => val >= 0 && val === Number.parseInt(`${val}`, 10)
  18495. }
  18496. });
  18497. const inputNumberEmits = {
  18498. change: (prev, cur) => prev !== cur,
  18499. blur: (e) => e instanceof FocusEvent,
  18500. focus: (e) => e instanceof FocusEvent,
  18501. input: (val) => isNumber(val),
  18502. "update:modelValue": (val) => isNumber(val) || val === void 0
  18503. };
  18504. const _sfc_main$r = defineComponent({
  18505. name: "ElInputNumber",
  18506. components: {
  18507. ElInput,
  18508. ElIcon,
  18509. ArrowUp: arrowUp,
  18510. ArrowDown: arrowDown,
  18511. Plus: plus,
  18512. Minus: minus
  18513. },
  18514. directives: {
  18515. RepeatClick
  18516. },
  18517. props: inputNumberProps,
  18518. emits: inputNumberEmits,
  18519. setup(props, { emit }) {
  18520. const input = ref();
  18521. const data2 = reactive({
  18522. currentValue: props.modelValue,
  18523. userInput: null
  18524. });
  18525. const { formItem } = useFormItem();
  18526. const ns = useNamespace("input-number");
  18527. const minDisabled = computed(() => ensurePrecision(props.modelValue, -1) < props.min);
  18528. const maxDisabled = computed(() => ensurePrecision(props.modelValue) > props.max);
  18529. const numPrecision = computed(() => {
  18530. const stepPrecision = getPrecision(props.step);
  18531. if (!isUndefined(props.precision)) {
  18532. if (stepPrecision > props.precision)
  18533. ;
  18534. return props.precision;
  18535. } else {
  18536. return Math.max(getPrecision(props.modelValue), stepPrecision);
  18537. }
  18538. });
  18539. const controlsAtRight = computed(() => {
  18540. return props.controls && props.controlsPosition === "right";
  18541. });
  18542. const inputNumberSize = useSize();
  18543. const inputNumberDisabled = useDisabled$1();
  18544. const displayValue = computed(() => {
  18545. if (data2.userInput !== null) {
  18546. return data2.userInput;
  18547. }
  18548. let currentValue = data2.currentValue;
  18549. if (isNumber(currentValue)) {
  18550. if (Number.isNaN(currentValue))
  18551. return "";
  18552. if (!isUndefined(props.precision)) {
  18553. currentValue = currentValue.toFixed(props.precision);
  18554. }
  18555. }
  18556. return currentValue;
  18557. });
  18558. const toPrecision = (num, pre) => {
  18559. if (isUndefined(pre))
  18560. pre = numPrecision.value;
  18561. return Number.parseFloat(`${Math.round(num * 10 ** pre) / 10 ** pre}`);
  18562. };
  18563. const getPrecision = (value) => {
  18564. if (isUndefined(value))
  18565. return 0;
  18566. const valueString = value.toString();
  18567. const dotPosition = valueString.indexOf(".");
  18568. let precision = 0;
  18569. if (dotPosition !== -1) {
  18570. precision = valueString.length - dotPosition - 1;
  18571. }
  18572. return precision;
  18573. };
  18574. const ensurePrecision = (val, coefficient = 1) => {
  18575. if (!isNumber(val))
  18576. return data2.currentValue;
  18577. val = isNumber(val) ? val : Number.NaN;
  18578. return toPrecision(val + props.step * coefficient);
  18579. };
  18580. const increase = () => {
  18581. if (inputNumberDisabled.value || maxDisabled.value)
  18582. return;
  18583. const value = props.modelValue || 0;
  18584. const newVal = ensurePrecision(value);
  18585. setCurrentValue(newVal);
  18586. };
  18587. const decrease = () => {
  18588. if (inputNumberDisabled.value || minDisabled.value)
  18589. return;
  18590. const value = props.modelValue || 0;
  18591. const newVal = ensurePrecision(value, -1);
  18592. setCurrentValue(newVal);
  18593. };
  18594. const verifyValue = (value, update) => {
  18595. const { max: max2, min: min2, step, precision, stepStrictly } = props;
  18596. let newVal = Number(value);
  18597. if (value === null) {
  18598. newVal = Number.NaN;
  18599. }
  18600. if (!Number.isNaN(newVal)) {
  18601. if (stepStrictly) {
  18602. newVal = Math.round(newVal / step) * step;
  18603. }
  18604. if (!isUndefined(precision)) {
  18605. newVal = toPrecision(newVal, precision);
  18606. }
  18607. if (newVal > max2 || newVal < min2) {
  18608. newVal = newVal > max2 ? max2 : min2;
  18609. update && emit("update:modelValue", newVal);
  18610. }
  18611. }
  18612. return newVal;
  18613. };
  18614. const setCurrentValue = (value) => {
  18615. var _a2;
  18616. const oldVal = data2.currentValue;
  18617. let newVal = verifyValue(value);
  18618. if (oldVal === newVal)
  18619. return;
  18620. if (Number.isNaN(newVal)) {
  18621. newVal = void 0;
  18622. }
  18623. data2.userInput = null;
  18624. emit("update:modelValue", newVal);
  18625. emit("input", newVal);
  18626. emit("change", newVal, oldVal);
  18627. (_a2 = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a2.call(formItem, "change").catch((err) => debugWarn());
  18628. data2.currentValue = newVal;
  18629. };
  18630. const handleInput = (value) => {
  18631. return data2.userInput = value;
  18632. };
  18633. const handleInputChange = (value) => {
  18634. const newVal = value !== "" ? Number(value) : "";
  18635. if (isNumber(newVal) && !Number.isNaN(newVal) || value === "") {
  18636. setCurrentValue(newVal);
  18637. }
  18638. data2.userInput = null;
  18639. };
  18640. const focus = () => {
  18641. var _a2, _b2;
  18642. (_b2 = (_a2 = input.value) == null ? void 0 : _a2.focus) == null ? void 0 : _b2.call(_a2);
  18643. };
  18644. const blur = () => {
  18645. var _a2, _b2;
  18646. (_b2 = (_a2 = input.value) == null ? void 0 : _a2.blur) == null ? void 0 : _b2.call(_a2);
  18647. };
  18648. const handleFocus = (event) => {
  18649. emit("focus", event);
  18650. };
  18651. const handleBlur = (event) => {
  18652. var _a2;
  18653. emit("blur", event);
  18654. (_a2 = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a2.call(formItem, "blur").catch((err) => debugWarn());
  18655. };
  18656. watch(() => props.modelValue, (value) => {
  18657. const newVal = verifyValue(value, true);
  18658. data2.currentValue = newVal;
  18659. data2.userInput = null;
  18660. }, { immediate: true });
  18661. onMounted(() => {
  18662. var _a2;
  18663. const innerInput = (_a2 = input.value) == null ? void 0 : _a2.input;
  18664. innerInput.setAttribute("role", "spinbutton");
  18665. innerInput.setAttribute("aria-valuemax", String(props.max));
  18666. innerInput.setAttribute("aria-valuemin", String(props.min));
  18667. innerInput.setAttribute("aria-valuenow", String(data2.currentValue));
  18668. innerInput.setAttribute("aria-disabled", String(inputNumberDisabled.value));
  18669. if (!isNumber(props.modelValue)) {
  18670. let val = Number(props.modelValue);
  18671. if (Number.isNaN(val)) {
  18672. val = void 0;
  18673. }
  18674. emit("update:modelValue", val);
  18675. }
  18676. });
  18677. onUpdated(() => {
  18678. var _a2;
  18679. const innerInput = (_a2 = input.value) == null ? void 0 : _a2.input;
  18680. innerInput == null ? void 0 : innerInput.setAttribute("aria-valuenow", data2.currentValue);
  18681. });
  18682. return {
  18683. input,
  18684. displayValue,
  18685. handleInput,
  18686. handleInputChange,
  18687. controlsAtRight,
  18688. decrease,
  18689. increase,
  18690. inputNumberSize,
  18691. inputNumberDisabled,
  18692. maxDisabled,
  18693. minDisabled,
  18694. focus,
  18695. blur,
  18696. handleFocus,
  18697. handleBlur,
  18698. ns
  18699. };
  18700. }
  18701. });
  18702. function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
  18703. const _component_arrow_down = resolveComponent("arrow-down");
  18704. const _component_minus = resolveComponent("minus");
  18705. const _component_el_icon = resolveComponent("el-icon");
  18706. const _component_arrow_up = resolveComponent("arrow-up");
  18707. const _component_plus = resolveComponent("plus");
  18708. const _component_el_input = resolveComponent("el-input");
  18709. const _directive_repeat_click = resolveDirective("repeat-click");
  18710. return openBlock(), createElementBlock("div", {
  18711. class: normalizeClass([
  18712. _ctx.ns.b(),
  18713. _ctx.ns.m(_ctx.inputNumberSize),
  18714. _ctx.ns.is("disabled", _ctx.inputNumberDisabled),
  18715. _ctx.ns.is("without-controls", !_ctx.controls),
  18716. _ctx.ns.is("controls-right", _ctx.controlsAtRight)
  18717. ]),
  18718. onDragstart: _cache[2] || (_cache[2] = withModifiers(() => {
  18719. }, ["prevent"]))
  18720. }, [
  18721. _ctx.controls ? withDirectives((openBlock(), createElementBlock("span", {
  18722. key: 0,
  18723. role: "button",
  18724. class: normalizeClass([_ctx.ns.e("decrease"), _ctx.ns.is("disabled", _ctx.minDisabled)]),
  18725. onKeydown: _cache[0] || (_cache[0] = withKeys((...args) => _ctx.decrease && _ctx.decrease(...args), ["enter"]))
  18726. }, [
  18727. createVNode(_component_el_icon, null, {
  18728. default: withCtx(() => [
  18729. _ctx.controlsAtRight ? (openBlock(), createBlock(_component_arrow_down, { key: 0 })) : (openBlock(), createBlock(_component_minus, { key: 1 }))
  18730. ]),
  18731. _: 1
  18732. })
  18733. ], 34)), [
  18734. [_directive_repeat_click, _ctx.decrease]
  18735. ]) : createCommentVNode("v-if", true),
  18736. _ctx.controls ? withDirectives((openBlock(), createElementBlock("span", {
  18737. key: 1,
  18738. role: "button",
  18739. class: normalizeClass([_ctx.ns.e("increase"), _ctx.ns.is("disabled", _ctx.maxDisabled)]),
  18740. onKeydown: _cache[1] || (_cache[1] = withKeys((...args) => _ctx.increase && _ctx.increase(...args), ["enter"]))
  18741. }, [
  18742. createVNode(_component_el_icon, null, {
  18743. default: withCtx(() => [
  18744. _ctx.controlsAtRight ? (openBlock(), createBlock(_component_arrow_up, { key: 0 })) : (openBlock(), createBlock(_component_plus, { key: 1 }))
  18745. ]),
  18746. _: 1
  18747. })
  18748. ], 34)), [
  18749. [_directive_repeat_click, _ctx.increase]
  18750. ]) : createCommentVNode("v-if", true),
  18751. createVNode(_component_el_input, {
  18752. ref: "input",
  18753. type: "number",
  18754. step: _ctx.step,
  18755. "model-value": _ctx.displayValue,
  18756. placeholder: _ctx.placeholder,
  18757. disabled: _ctx.inputNumberDisabled,
  18758. size: _ctx.inputNumberSize,
  18759. max: _ctx.max,
  18760. min: _ctx.min,
  18761. name: _ctx.name,
  18762. label: _ctx.label,
  18763. "validate-event": false,
  18764. onKeydown: [
  18765. withKeys(withModifiers(_ctx.increase, ["prevent"]), ["up"]),
  18766. withKeys(withModifiers(_ctx.decrease, ["prevent"]), ["down"])
  18767. ],
  18768. onBlur: _ctx.handleBlur,
  18769. onFocus: _ctx.handleFocus,
  18770. onInput: _ctx.handleInput,
  18771. onChange: _ctx.handleInputChange
  18772. }, null, 8, ["step", "model-value", "placeholder", "disabled", "size", "max", "min", "name", "label", "onKeydown", "onBlur", "onFocus", "onInput", "onChange"])
  18773. ], 34);
  18774. }
  18775. var InputNumber = /* @__PURE__ */ _export_sfc$1(_sfc_main$r, [["render", _sfc_render$d], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/input-number/src/input-number.vue"]]);
  18776. const ElInputNumber = withInstall(InputNumber);
  18777. const selectGroupKey = "ElSelectGroup";
  18778. const selectKey = "ElSelect";
  18779. function useOption(props, states) {
  18780. const select = inject(selectKey);
  18781. const selectGroup = inject(selectGroupKey, { disabled: false });
  18782. const isObject2 = computed(() => {
  18783. return Object.prototype.toString.call(props.value).toLowerCase() === "[object object]";
  18784. });
  18785. const itemSelected = computed(() => {
  18786. if (!select.props.multiple) {
  18787. return isEqual2(props.value, select.props.modelValue);
  18788. } else {
  18789. return contains2(select.props.modelValue, props.value);
  18790. }
  18791. });
  18792. const limitReached = computed(() => {
  18793. if (select.props.multiple) {
  18794. const modelValue = select.props.modelValue || [];
  18795. return !itemSelected.value && modelValue.length >= select.props.multipleLimit && select.props.multipleLimit > 0;
  18796. } else {
  18797. return false;
  18798. }
  18799. });
  18800. const currentLabel = computed(() => {
  18801. return props.label || (isObject2.value ? "" : props.value);
  18802. });
  18803. const currentValue = computed(() => {
  18804. return props.value || props.label || "";
  18805. });
  18806. const isDisabled = computed(() => {
  18807. return props.disabled || states.groupDisabled || limitReached.value;
  18808. });
  18809. const instance = getCurrentInstance();
  18810. const contains2 = (arr = [], target) => {
  18811. if (!isObject2.value) {
  18812. return arr && arr.includes(target);
  18813. } else {
  18814. const valueKey = select.props.valueKey;
  18815. return arr && arr.some((item) => {
  18816. return get(item, valueKey) === get(target, valueKey);
  18817. });
  18818. }
  18819. };
  18820. const isEqual2 = (a2, b2) => {
  18821. if (!isObject2.value) {
  18822. return a2 === b2;
  18823. } else {
  18824. const { valueKey } = select.props;
  18825. return get(a2, valueKey) === get(b2, valueKey);
  18826. }
  18827. };
  18828. const hoverItem = () => {
  18829. if (!props.disabled && !selectGroup.disabled) {
  18830. select.hoverIndex = select.optionsArray.indexOf(instance.proxy);
  18831. }
  18832. };
  18833. watch(() => currentLabel.value, () => {
  18834. if (!props.created && !select.props.remote)
  18835. select.setSelected();
  18836. });
  18837. watch(() => props.value, (val, oldVal) => {
  18838. const { remote, valueKey } = select.props;
  18839. if (!props.created && !remote) {
  18840. if (valueKey && typeof val === "object" && typeof oldVal === "object" && val[valueKey] === oldVal[valueKey]) {
  18841. return;
  18842. }
  18843. select.setSelected();
  18844. }
  18845. });
  18846. watch(() => selectGroup.disabled, () => {
  18847. states.groupDisabled = selectGroup.disabled;
  18848. }, { immediate: true });
  18849. const { queryChange } = toRaw(select);
  18850. watch(queryChange, (changes) => {
  18851. const { query } = unref(changes);
  18852. const regexp4 = new RegExp(escapeStringRegexp(query), "i");
  18853. states.visible = regexp4.test(currentLabel.value) || props.created;
  18854. if (!states.visible) {
  18855. select.filteredOptionsCount--;
  18856. }
  18857. });
  18858. return {
  18859. select,
  18860. currentLabel,
  18861. currentValue,
  18862. itemSelected,
  18863. isDisabled,
  18864. hoverItem
  18865. };
  18866. }
  18867. const _sfc_main$q = defineComponent({
  18868. name: "ElOption",
  18869. componentName: "ElOption",
  18870. props: {
  18871. value: {
  18872. required: true,
  18873. type: [String, Number, Boolean, Object]
  18874. },
  18875. label: [String, Number],
  18876. created: Boolean,
  18877. disabled: {
  18878. type: Boolean,
  18879. default: false
  18880. }
  18881. },
  18882. setup(props) {
  18883. const ns = useNamespace("select");
  18884. const states = reactive({
  18885. index: -1,
  18886. groupDisabled: false,
  18887. visible: true,
  18888. hitState: false,
  18889. hover: false
  18890. });
  18891. const { currentLabel, itemSelected, isDisabled, select, hoverItem } = useOption(props, states);
  18892. const { visible, hover } = toRefs(states);
  18893. const vm = getCurrentInstance().proxy;
  18894. const key = vm.value;
  18895. select.onOptionCreate(vm);
  18896. onBeforeUnmount(() => {
  18897. const { selected } = select;
  18898. const selectedOptions = select.props.multiple ? selected : [selected];
  18899. const doesSelected = selectedOptions.some((item) => {
  18900. return item.value === vm.value;
  18901. });
  18902. if (select.cachedOptions.get(key) === vm && !doesSelected) {
  18903. nextTick(() => {
  18904. select.cachedOptions.delete(key);
  18905. });
  18906. }
  18907. select.onOptionDestroy(key, vm);
  18908. });
  18909. function selectOptionClick() {
  18910. if (props.disabled !== true && states.groupDisabled !== true) {
  18911. select.handleOptionSelect(vm, true);
  18912. }
  18913. }
  18914. return {
  18915. ns,
  18916. currentLabel,
  18917. itemSelected,
  18918. isDisabled,
  18919. select,
  18920. hoverItem,
  18921. visible,
  18922. hover,
  18923. selectOptionClick,
  18924. states
  18925. };
  18926. }
  18927. });
  18928. function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
  18929. return withDirectives((openBlock(), createElementBlock("li", {
  18930. class: normalizeClass([
  18931. _ctx.ns.be("dropdown", "item"),
  18932. _ctx.ns.is("disabled", _ctx.isDisabled),
  18933. {
  18934. selected: _ctx.itemSelected,
  18935. hover: _ctx.hover
  18936. }
  18937. ]),
  18938. onMouseenter: _cache[0] || (_cache[0] = (...args) => _ctx.hoverItem && _ctx.hoverItem(...args)),
  18939. onClick: _cache[1] || (_cache[1] = withModifiers((...args) => _ctx.selectOptionClick && _ctx.selectOptionClick(...args), ["stop"]))
  18940. }, [
  18941. renderSlot(_ctx.$slots, "default", {}, () => [
  18942. createElementVNode("span", null, toDisplayString(_ctx.currentLabel), 1)
  18943. ])
  18944. ], 34)), [
  18945. [vShow, _ctx.visible]
  18946. ]);
  18947. }
  18948. var Option = /* @__PURE__ */ _export_sfc$1(_sfc_main$q, [["render", _sfc_render$c], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/select/src/option.vue"]]);
  18949. const _sfc_main$p = defineComponent({
  18950. name: "ElSelectDropdown",
  18951. componentName: "ElSelectDropdown",
  18952. setup() {
  18953. const select = inject(selectKey);
  18954. const ns = useNamespace("select");
  18955. const popperClass = computed(() => select.props.popperClass);
  18956. const isMultiple = computed(() => select.props.multiple);
  18957. const isFitInputWidth = computed(() => select.props.fitInputWidth);
  18958. const minWidth = ref("");
  18959. function updateMinWidth() {
  18960. var _a2;
  18961. minWidth.value = `${(_a2 = select.selectWrapper) == null ? void 0 : _a2.getBoundingClientRect().width}px`;
  18962. }
  18963. onMounted(() => {
  18964. updateMinWidth();
  18965. addResizeListener(select.selectWrapper, updateMinWidth);
  18966. });
  18967. onBeforeUnmount(() => {
  18968. removeResizeListener(select.selectWrapper, updateMinWidth);
  18969. });
  18970. return {
  18971. ns,
  18972. minWidth,
  18973. popperClass,
  18974. isMultiple,
  18975. isFitInputWidth
  18976. };
  18977. }
  18978. });
  18979. function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
  18980. return openBlock(), createElementBlock("div", {
  18981. class: normalizeClass([_ctx.ns.b("dropdown"), _ctx.ns.is("multiple", _ctx.isMultiple), _ctx.popperClass]),
  18982. style: normalizeStyle({ [_ctx.isFitInputWidth ? "width" : "minWidth"]: _ctx.minWidth })
  18983. }, [
  18984. renderSlot(_ctx.$slots, "default")
  18985. ], 6);
  18986. }
  18987. var ElSelectMenu = /* @__PURE__ */ _export_sfc$1(_sfc_main$p, [["render", _sfc_render$b], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/select/src/select-dropdown.vue"]]);
  18988. function useSelectStates(props) {
  18989. const { t } = useLocale();
  18990. return reactive({
  18991. options: /* @__PURE__ */ new Map(),
  18992. cachedOptions: /* @__PURE__ */ new Map(),
  18993. createdLabel: null,
  18994. createdSelected: false,
  18995. selected: props.multiple ? [] : {},
  18996. inputLength: 20,
  18997. inputWidth: 0,
  18998. initialInputHeight: 0,
  18999. optionsCount: 0,
  19000. filteredOptionsCount: 0,
  19001. visible: false,
  19002. softFocus: false,
  19003. selectedLabel: "",
  19004. hoverIndex: -1,
  19005. query: "",
  19006. previousQuery: null,
  19007. inputHovering: false,
  19008. cachedPlaceHolder: "",
  19009. currentPlaceholder: t("el.select.placeholder"),
  19010. menuVisibleOnFocus: false,
  19011. isOnComposition: false,
  19012. isSilentBlur: false,
  19013. prefixWidth: 11,
  19014. tagInMultiLine: false
  19015. });
  19016. }
  19017. const useSelect = (props, states, ctx) => {
  19018. const { t } = useLocale();
  19019. const ns = useNamespace("select");
  19020. const reference2 = ref(null);
  19021. const input = ref(null);
  19022. const tooltipRef = ref(null);
  19023. const tags = ref(null);
  19024. const selectWrapper = ref(null);
  19025. const scrollbar = ref(null);
  19026. const hoverOption = ref(-1);
  19027. const queryChange = shallowRef({ query: "" });
  19028. const groupQueryChange = shallowRef("");
  19029. const elForm2 = inject(formContextKey, {});
  19030. const elFormItem2 = inject(formItemContextKey, {});
  19031. const readonly2 = computed(() => !props.filterable || props.multiple || !states.visible);
  19032. const selectDisabled = computed(() => props.disabled || elForm2.disabled);
  19033. const showClose = computed(() => {
  19034. const hasValue = props.multiple ? Array.isArray(props.modelValue) && props.modelValue.length > 0 : props.modelValue !== void 0 && props.modelValue !== null && props.modelValue !== "";
  19035. const criteria = props.clearable && !selectDisabled.value && states.inputHovering && hasValue;
  19036. return criteria;
  19037. });
  19038. const iconComponent = computed(() => props.remote && props.filterable ? "" : props.suffixIcon);
  19039. const iconReverse = computed(() => ns.is("reverse", iconComponent.value && states.visible));
  19040. const debounce$1$1 = computed(() => props.remote ? 300 : 0);
  19041. const emptyText = computed(() => {
  19042. if (props.loading) {
  19043. return props.loadingText || t("el.select.loading");
  19044. } else {
  19045. if (props.remote && states.query === "" && states.options.size === 0)
  19046. return false;
  19047. if (props.filterable && states.query && states.options.size > 0 && states.filteredOptionsCount === 0) {
  19048. return props.noMatchText || t("el.select.noMatch");
  19049. }
  19050. if (states.options.size === 0) {
  19051. return props.noDataText || t("el.select.noData");
  19052. }
  19053. }
  19054. return null;
  19055. });
  19056. const optionsArray = computed(() => Array.from(states.options.values()));
  19057. const cachedOptionsArray = computed(() => Array.from(states.cachedOptions.values()));
  19058. const showNewOption = computed(() => {
  19059. const hasExistingOption = optionsArray.value.filter((option) => {
  19060. return !option.created;
  19061. }).some((option) => {
  19062. return option.currentLabel === states.query;
  19063. });
  19064. return props.filterable && props.allowCreate && states.query !== "" && !hasExistingOption;
  19065. });
  19066. const selectSize = useSize();
  19067. const collapseTagSize = computed(() => ["small"].includes(selectSize.value) ? "small" : "default");
  19068. const dropMenuVisible = computed({
  19069. get() {
  19070. return states.visible && emptyText.value !== false;
  19071. },
  19072. set(val) {
  19073. states.visible = val;
  19074. }
  19075. });
  19076. watch(() => selectDisabled.value, () => {
  19077. nextTick(() => {
  19078. resetInputHeight();
  19079. });
  19080. });
  19081. watch(() => props.placeholder, (val) => {
  19082. states.cachedPlaceHolder = states.currentPlaceholder = val;
  19083. });
  19084. watch(() => props.modelValue, (val, oldVal) => {
  19085. var _a2;
  19086. if (props.multiple) {
  19087. resetInputHeight();
  19088. if (val && val.length > 0 || input.value && states.query !== "") {
  19089. states.currentPlaceholder = "";
  19090. } else {
  19091. states.currentPlaceholder = states.cachedPlaceHolder;
  19092. }
  19093. if (props.filterable && !props.reserveKeyword) {
  19094. states.query = "";
  19095. handleQueryChange(states.query);
  19096. }
  19097. }
  19098. setSelected();
  19099. if (props.filterable && !props.multiple) {
  19100. states.inputLength = 20;
  19101. }
  19102. if (!isEqual(val, oldVal)) {
  19103. (_a2 = elFormItem2.validate) == null ? void 0 : _a2.call(elFormItem2, "change").catch((err) => debugWarn());
  19104. }
  19105. }, {
  19106. flush: "post",
  19107. deep: true
  19108. });
  19109. watch(() => states.visible, (val) => {
  19110. var _a2, _b2, _c;
  19111. if (!val) {
  19112. input.value && input.value.blur();
  19113. states.query = "";
  19114. states.previousQuery = null;
  19115. states.selectedLabel = "";
  19116. states.inputLength = 20;
  19117. states.menuVisibleOnFocus = false;
  19118. resetHoverIndex();
  19119. nextTick(() => {
  19120. if (input.value && input.value.value === "" && states.selected.length === 0) {
  19121. states.currentPlaceholder = states.cachedPlaceHolder;
  19122. }
  19123. });
  19124. if (!props.multiple) {
  19125. if (states.selected) {
  19126. if (props.filterable && props.allowCreate && states.createdSelected && states.createdLabel) {
  19127. states.selectedLabel = states.createdLabel;
  19128. } else {
  19129. states.selectedLabel = states.selected.currentLabel;
  19130. }
  19131. if (props.filterable)
  19132. states.query = states.selectedLabel;
  19133. }
  19134. if (props.filterable) {
  19135. states.currentPlaceholder = states.cachedPlaceHolder;
  19136. }
  19137. }
  19138. } else {
  19139. (_b2 = (_a2 = tooltipRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b2.call(_a2);
  19140. if (props.filterable) {
  19141. states.filteredOptionsCount = states.optionsCount;
  19142. states.query = props.remote ? "" : states.selectedLabel;
  19143. if (props.multiple) {
  19144. (_c = input.value) == null ? void 0 : _c.focus();
  19145. } else {
  19146. if (states.selectedLabel) {
  19147. states.currentPlaceholder = `${states.selectedLabel}`;
  19148. states.selectedLabel = "";
  19149. }
  19150. }
  19151. handleQueryChange(states.query);
  19152. if (!props.multiple && !props.remote) {
  19153. queryChange.value.query = "";
  19154. triggerRef(queryChange);
  19155. triggerRef(groupQueryChange);
  19156. }
  19157. }
  19158. }
  19159. ctx.emit("visible-change", val);
  19160. });
  19161. watch(() => states.options.entries(), () => {
  19162. var _a2, _b2, _c;
  19163. if (!isClient)
  19164. return;
  19165. (_b2 = (_a2 = tooltipRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b2.call(_a2);
  19166. if (props.multiple) {
  19167. resetInputHeight();
  19168. }
  19169. const inputs = ((_c = selectWrapper.value) == null ? void 0 : _c.querySelectorAll("input")) || [];
  19170. if (!Array.from(inputs).includes(document.activeElement)) {
  19171. setSelected();
  19172. }
  19173. if (props.defaultFirstOption && (props.filterable || props.remote) && states.filteredOptionsCount) {
  19174. checkDefaultFirstOption();
  19175. }
  19176. }, {
  19177. flush: "post"
  19178. });
  19179. watch(() => states.hoverIndex, (val) => {
  19180. if (typeof val === "number" && val > -1) {
  19181. hoverOption.value = optionsArray.value[val] || {};
  19182. }
  19183. optionsArray.value.forEach((option) => {
  19184. option.hover = hoverOption.value === option;
  19185. });
  19186. });
  19187. const resetInputHeight = () => {
  19188. if (props.collapseTags && !props.filterable)
  19189. return;
  19190. nextTick(() => {
  19191. var _a2, _b2;
  19192. if (!reference2.value)
  19193. return;
  19194. const input2 = reference2.value.$el.querySelector("input");
  19195. const _tags = tags.value;
  19196. const sizeInMap = states.initialInputHeight || getComponentSize(selectSize.value || elForm2.size);
  19197. input2.style.height = states.selected.length === 0 ? `${sizeInMap}px` : `${Math.max(_tags ? _tags.clientHeight + (_tags.clientHeight > sizeInMap ? 6 : 0) : 0, sizeInMap)}px`;
  19198. states.tagInMultiLine = Number.parseFloat(input2.style.height) >= sizeInMap;
  19199. if (states.visible && emptyText.value !== false) {
  19200. (_b2 = (_a2 = tooltipRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b2.call(_a2);
  19201. }
  19202. });
  19203. };
  19204. const handleQueryChange = (val) => {
  19205. if (states.previousQuery === val || states.isOnComposition)
  19206. return;
  19207. if (states.previousQuery === null && (typeof props.filterMethod === "function" || typeof props.remoteMethod === "function")) {
  19208. states.previousQuery = val;
  19209. return;
  19210. }
  19211. states.previousQuery = val;
  19212. nextTick(() => {
  19213. var _a2, _b2;
  19214. if (states.visible)
  19215. (_b2 = (_a2 = tooltipRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b2.call(_a2);
  19216. });
  19217. states.hoverIndex = -1;
  19218. if (props.multiple && props.filterable) {
  19219. nextTick(() => {
  19220. const length = input.value.value.length * 15 + 20;
  19221. states.inputLength = props.collapseTags ? Math.min(50, length) : length;
  19222. managePlaceholder();
  19223. resetInputHeight();
  19224. });
  19225. }
  19226. if (props.remote && typeof props.remoteMethod === "function") {
  19227. states.hoverIndex = -1;
  19228. props.remoteMethod(val);
  19229. } else if (typeof props.filterMethod === "function") {
  19230. props.filterMethod(val);
  19231. triggerRef(groupQueryChange);
  19232. } else {
  19233. states.filteredOptionsCount = states.optionsCount;
  19234. queryChange.value.query = val;
  19235. triggerRef(queryChange);
  19236. triggerRef(groupQueryChange);
  19237. }
  19238. if (props.defaultFirstOption && (props.filterable || props.remote) && states.filteredOptionsCount) {
  19239. checkDefaultFirstOption();
  19240. }
  19241. };
  19242. const managePlaceholder = () => {
  19243. if (states.currentPlaceholder !== "") {
  19244. states.currentPlaceholder = input.value.value ? "" : states.cachedPlaceHolder;
  19245. }
  19246. };
  19247. const checkDefaultFirstOption = () => {
  19248. const optionsInDropdown = optionsArray.value.filter((n) => n.visible && !n.disabled && !n.states.groupDisabled);
  19249. const userCreatedOption = optionsInDropdown.find((n) => n.created);
  19250. const firstOriginOption = optionsInDropdown[0];
  19251. states.hoverIndex = getValueIndex(optionsArray.value, userCreatedOption || firstOriginOption);
  19252. };
  19253. const setSelected = () => {
  19254. var _a2;
  19255. if (!props.multiple) {
  19256. const option = getOption(props.modelValue);
  19257. if ((_a2 = option.props) == null ? void 0 : _a2.created) {
  19258. states.createdLabel = option.props.value;
  19259. states.createdSelected = true;
  19260. } else {
  19261. states.createdSelected = false;
  19262. }
  19263. states.selectedLabel = option.currentLabel;
  19264. states.selected = option;
  19265. if (props.filterable)
  19266. states.query = states.selectedLabel;
  19267. return;
  19268. } else {
  19269. states.selectedLabel = "";
  19270. }
  19271. const result = [];
  19272. if (Array.isArray(props.modelValue)) {
  19273. props.modelValue.forEach((value) => {
  19274. result.push(getOption(value));
  19275. });
  19276. }
  19277. states.selected = result;
  19278. nextTick(() => {
  19279. resetInputHeight();
  19280. });
  19281. };
  19282. const getOption = (value) => {
  19283. let option;
  19284. const isObjectValue = toRawType(value).toLowerCase() === "object";
  19285. const isNull = toRawType(value).toLowerCase() === "null";
  19286. const isUndefined2 = toRawType(value).toLowerCase() === "undefined";
  19287. for (let i = states.cachedOptions.size - 1; i >= 0; i--) {
  19288. const cachedOption = cachedOptionsArray.value[i];
  19289. const isEqualValue = isObjectValue ? get(cachedOption, props.valueKey) === get(value, props.valueKey) : cachedOption.value === value;
  19290. if (isEqualValue) {
  19291. option = {
  19292. value,
  19293. currentLabel: cachedOption.currentLabel,
  19294. isDisabled: cachedOption.isDisabled
  19295. };
  19296. break;
  19297. }
  19298. }
  19299. if (option)
  19300. return option;
  19301. const label = isObjectValue ? value.label : !isNull && !isUndefined2 ? value : "";
  19302. const newOption = {
  19303. value,
  19304. currentLabel: label
  19305. };
  19306. if (props.multiple) {
  19307. newOption.hitState = false;
  19308. }
  19309. return newOption;
  19310. };
  19311. const resetHoverIndex = () => {
  19312. setTimeout(() => {
  19313. const valueKey = props.valueKey;
  19314. if (!props.multiple) {
  19315. states.hoverIndex = optionsArray.value.findIndex((item) => {
  19316. return getValueKey(item) === getValueKey(states.selected);
  19317. });
  19318. } else {
  19319. if (states.selected.length > 0) {
  19320. states.hoverIndex = Math.min.apply(null, states.selected.map((selected) => {
  19321. return optionsArray.value.findIndex((item) => {
  19322. return get(item, valueKey) === get(selected, valueKey);
  19323. });
  19324. }));
  19325. } else {
  19326. states.hoverIndex = -1;
  19327. }
  19328. }
  19329. }, 300);
  19330. };
  19331. const handleResize = () => {
  19332. var _a2, _b2;
  19333. resetInputWidth();
  19334. (_b2 = (_a2 = tooltipRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b2.call(_a2);
  19335. if (props.multiple && !props.filterable)
  19336. resetInputHeight();
  19337. };
  19338. const resetInputWidth = () => {
  19339. var _a2;
  19340. states.inputWidth = (_a2 = reference2.value) == null ? void 0 : _a2.$el.getBoundingClientRect().width;
  19341. };
  19342. const onInputChange = () => {
  19343. if (props.filterable && states.query !== states.selectedLabel) {
  19344. states.query = states.selectedLabel;
  19345. handleQueryChange(states.query);
  19346. }
  19347. };
  19348. const debouncedOnInputChange = debounce$1(() => {
  19349. onInputChange();
  19350. }, debounce$1$1.value);
  19351. const debouncedQueryChange = debounce$1((e) => {
  19352. handleQueryChange(e.target.value);
  19353. }, debounce$1$1.value);
  19354. const emitChange = (val) => {
  19355. if (!isEqual(props.modelValue, val)) {
  19356. ctx.emit(CHANGE_EVENT, val);
  19357. }
  19358. };
  19359. const deletePrevTag = (e) => {
  19360. if (e.target.value.length <= 0 && !toggleLastOptionHitState()) {
  19361. const value = props.modelValue.slice();
  19362. value.pop();
  19363. ctx.emit(UPDATE_MODEL_EVENT, value);
  19364. emitChange(value);
  19365. }
  19366. if (e.target.value.length === 1 && props.modelValue.length === 0) {
  19367. states.currentPlaceholder = states.cachedPlaceHolder;
  19368. }
  19369. };
  19370. const deleteTag = (event, tag) => {
  19371. const index = states.selected.indexOf(tag);
  19372. if (index > -1 && !selectDisabled.value) {
  19373. const value = props.modelValue.slice();
  19374. value.splice(index, 1);
  19375. ctx.emit(UPDATE_MODEL_EVENT, value);
  19376. emitChange(value);
  19377. ctx.emit("remove-tag", tag.value);
  19378. }
  19379. event.stopPropagation();
  19380. };
  19381. const deleteSelected = (event) => {
  19382. event.stopPropagation();
  19383. const value = props.multiple ? [] : "";
  19384. if (typeof value !== "string") {
  19385. for (const item of states.selected) {
  19386. if (item.isDisabled)
  19387. value.push(item.value);
  19388. }
  19389. }
  19390. ctx.emit(UPDATE_MODEL_EVENT, value);
  19391. emitChange(value);
  19392. states.visible = false;
  19393. ctx.emit("clear");
  19394. };
  19395. const handleOptionSelect = (option, byClick) => {
  19396. var _a2;
  19397. if (props.multiple) {
  19398. const value = (props.modelValue || []).slice();
  19399. const optionIndex = getValueIndex(value, option.value);
  19400. if (optionIndex > -1) {
  19401. value.splice(optionIndex, 1);
  19402. } else if (props.multipleLimit <= 0 || value.length < props.multipleLimit) {
  19403. value.push(option.value);
  19404. }
  19405. ctx.emit(UPDATE_MODEL_EVENT, value);
  19406. emitChange(value);
  19407. if (option.created) {
  19408. states.query = "";
  19409. handleQueryChange("");
  19410. states.inputLength = 20;
  19411. }
  19412. if (props.filterable)
  19413. (_a2 = input.value) == null ? void 0 : _a2.focus();
  19414. } else {
  19415. ctx.emit(UPDATE_MODEL_EVENT, option.value);
  19416. emitChange(option.value);
  19417. states.visible = false;
  19418. }
  19419. states.isSilentBlur = byClick;
  19420. setSoftFocus();
  19421. if (states.visible)
  19422. return;
  19423. nextTick(() => {
  19424. scrollToOption(option);
  19425. });
  19426. };
  19427. const getValueIndex = (arr = [], value) => {
  19428. if (!isObject$1(value))
  19429. return arr.indexOf(value);
  19430. const valueKey = props.valueKey;
  19431. let index = -1;
  19432. arr.some((item, i) => {
  19433. if (get(item, valueKey) === get(value, valueKey)) {
  19434. index = i;
  19435. return true;
  19436. }
  19437. return false;
  19438. });
  19439. return index;
  19440. };
  19441. const setSoftFocus = () => {
  19442. states.softFocus = true;
  19443. const _input = input.value || reference2.value;
  19444. if (_input) {
  19445. _input == null ? void 0 : _input.focus();
  19446. }
  19447. };
  19448. const scrollToOption = (option) => {
  19449. var _a2, _b2, _c, _d, _e;
  19450. const targetOption = Array.isArray(option) ? option[0] : option;
  19451. let target = null;
  19452. if (targetOption == null ? void 0 : targetOption.value) {
  19453. const options = optionsArray.value.filter((item) => item.value === targetOption.value);
  19454. if (options.length > 0) {
  19455. target = options[0].$el;
  19456. }
  19457. }
  19458. if (tooltipRef.value && target) {
  19459. const menu = (_d = (_c = (_b2 = (_a2 = tooltipRef.value) == null ? void 0 : _a2.popperRef) == null ? void 0 : _b2.contentRef) == null ? void 0 : _c.querySelector) == null ? void 0 : _d.call(_c, `.${ns.be("dropdown", "wrap")}`);
  19460. if (menu) {
  19461. scrollIntoView(menu, target);
  19462. }
  19463. }
  19464. (_e = scrollbar.value) == null ? void 0 : _e.handleScroll();
  19465. };
  19466. const onOptionCreate = (vm) => {
  19467. states.optionsCount++;
  19468. states.filteredOptionsCount++;
  19469. states.options.set(vm.value, vm);
  19470. states.cachedOptions.set(vm.value, vm);
  19471. };
  19472. const onOptionDestroy = (key, vm) => {
  19473. if (states.options.get(key) === vm) {
  19474. states.optionsCount--;
  19475. states.filteredOptionsCount--;
  19476. states.options.delete(key);
  19477. }
  19478. };
  19479. const resetInputState = (e) => {
  19480. if (e.code !== EVENT_CODE.backspace)
  19481. toggleLastOptionHitState(false);
  19482. states.inputLength = input.value.value.length * 15 + 20;
  19483. resetInputHeight();
  19484. };
  19485. const toggleLastOptionHitState = (hit) => {
  19486. if (!Array.isArray(states.selected))
  19487. return;
  19488. const option = states.selected[states.selected.length - 1];
  19489. if (!option)
  19490. return;
  19491. if (hit === true || hit === false) {
  19492. option.hitState = hit;
  19493. return hit;
  19494. }
  19495. option.hitState = !option.hitState;
  19496. return option.hitState;
  19497. };
  19498. const handleComposition = (event) => {
  19499. const text = event.target.value;
  19500. if (event.type === "compositionend") {
  19501. states.isOnComposition = false;
  19502. nextTick(() => handleQueryChange(text));
  19503. } else {
  19504. const lastCharacter = text[text.length - 1] || "";
  19505. states.isOnComposition = !isKorean(lastCharacter);
  19506. }
  19507. };
  19508. const handleMenuEnter = () => {
  19509. nextTick(() => scrollToOption(states.selected));
  19510. };
  19511. const handleFocus = (event) => {
  19512. if (!states.softFocus) {
  19513. if (props.automaticDropdown || props.filterable) {
  19514. if (props.filterable && !states.visible) {
  19515. states.menuVisibleOnFocus = true;
  19516. }
  19517. states.visible = true;
  19518. }
  19519. ctx.emit("focus", event);
  19520. } else {
  19521. states.softFocus = false;
  19522. }
  19523. };
  19524. const blur = () => {
  19525. var _a2;
  19526. states.visible = false;
  19527. (_a2 = reference2.value) == null ? void 0 : _a2.blur();
  19528. };
  19529. const handleBlur = (event) => {
  19530. nextTick(() => {
  19531. if (states.isSilentBlur) {
  19532. states.isSilentBlur = false;
  19533. } else {
  19534. ctx.emit("blur", event);
  19535. }
  19536. });
  19537. states.softFocus = false;
  19538. };
  19539. const handleClearClick = (event) => {
  19540. deleteSelected(event);
  19541. };
  19542. const handleClose = () => {
  19543. states.visible = false;
  19544. };
  19545. const toggleMenu = () => {
  19546. var _a2;
  19547. if (props.automaticDropdown)
  19548. return;
  19549. if (!selectDisabled.value) {
  19550. if (states.menuVisibleOnFocus) {
  19551. states.menuVisibleOnFocus = false;
  19552. } else {
  19553. states.visible = !states.visible;
  19554. }
  19555. if (states.visible) {
  19556. (_a2 = input.value || reference2.value) == null ? void 0 : _a2.focus();
  19557. }
  19558. }
  19559. };
  19560. const selectOption = () => {
  19561. if (!states.visible) {
  19562. toggleMenu();
  19563. } else {
  19564. if (optionsArray.value[states.hoverIndex]) {
  19565. handleOptionSelect(optionsArray.value[states.hoverIndex], void 0);
  19566. }
  19567. }
  19568. };
  19569. const getValueKey = (item) => {
  19570. return isObject$1(item.value) ? get(item.value, props.valueKey) : item.value;
  19571. };
  19572. const optionsAllDisabled = computed(() => optionsArray.value.filter((option) => option.visible).every((option) => option.disabled));
  19573. const navigateOptions = (direction) => {
  19574. if (!states.visible) {
  19575. states.visible = true;
  19576. return;
  19577. }
  19578. if (states.options.size === 0 || states.filteredOptionsCount === 0)
  19579. return;
  19580. if (states.isOnComposition)
  19581. return;
  19582. if (!optionsAllDisabled.value) {
  19583. if (direction === "next") {
  19584. states.hoverIndex++;
  19585. if (states.hoverIndex === states.options.size) {
  19586. states.hoverIndex = 0;
  19587. }
  19588. } else if (direction === "prev") {
  19589. states.hoverIndex--;
  19590. if (states.hoverIndex < 0) {
  19591. states.hoverIndex = states.options.size - 1;
  19592. }
  19593. }
  19594. const option = optionsArray.value[states.hoverIndex];
  19595. if (option.disabled === true || option.states.groupDisabled === true || !option.visible) {
  19596. navigateOptions(direction);
  19597. }
  19598. nextTick(() => scrollToOption(hoverOption.value));
  19599. }
  19600. };
  19601. return {
  19602. optionsArray,
  19603. selectSize,
  19604. handleResize,
  19605. debouncedOnInputChange,
  19606. debouncedQueryChange,
  19607. deletePrevTag,
  19608. deleteTag,
  19609. deleteSelected,
  19610. handleOptionSelect,
  19611. scrollToOption,
  19612. readonly: readonly2,
  19613. resetInputHeight,
  19614. showClose,
  19615. iconComponent,
  19616. iconReverse,
  19617. showNewOption,
  19618. collapseTagSize,
  19619. setSelected,
  19620. managePlaceholder,
  19621. selectDisabled,
  19622. emptyText,
  19623. toggleLastOptionHitState,
  19624. resetInputState,
  19625. handleComposition,
  19626. onOptionCreate,
  19627. onOptionDestroy,
  19628. handleMenuEnter,
  19629. handleFocus,
  19630. blur,
  19631. handleBlur,
  19632. handleClearClick,
  19633. handleClose,
  19634. toggleMenu,
  19635. selectOption,
  19636. getValueKey,
  19637. navigateOptions,
  19638. dropMenuVisible,
  19639. queryChange,
  19640. groupQueryChange,
  19641. reference: reference2,
  19642. input,
  19643. tooltipRef,
  19644. tags,
  19645. selectWrapper,
  19646. scrollbar
  19647. };
  19648. };
  19649. const COMPONENT_NAME$1 = "ElSelect";
  19650. const _sfc_main$o = defineComponent({
  19651. name: COMPONENT_NAME$1,
  19652. componentName: COMPONENT_NAME$1,
  19653. components: {
  19654. ElInput,
  19655. ElSelectMenu,
  19656. ElOption: Option,
  19657. ElTag,
  19658. ElScrollbar,
  19659. ElTooltip,
  19660. ElIcon
  19661. },
  19662. directives: { ClickOutside },
  19663. props: {
  19664. name: String,
  19665. id: String,
  19666. modelValue: {
  19667. type: [Array, String, Number, Boolean, Object],
  19668. default: void 0
  19669. },
  19670. autocomplete: {
  19671. type: String,
  19672. default: "off"
  19673. },
  19674. automaticDropdown: Boolean,
  19675. size: {
  19676. type: String,
  19677. validator: isValidComponentSize
  19678. },
  19679. effect: {
  19680. type: String,
  19681. default: "light"
  19682. },
  19683. disabled: Boolean,
  19684. clearable: Boolean,
  19685. filterable: Boolean,
  19686. allowCreate: Boolean,
  19687. loading: Boolean,
  19688. popperClass: {
  19689. type: String,
  19690. default: ""
  19691. },
  19692. remote: Boolean,
  19693. loadingText: String,
  19694. noMatchText: String,
  19695. noDataText: String,
  19696. remoteMethod: Function,
  19697. filterMethod: Function,
  19698. multiple: Boolean,
  19699. multipleLimit: {
  19700. type: Number,
  19701. default: 0
  19702. },
  19703. placeholder: {
  19704. type: String
  19705. },
  19706. defaultFirstOption: Boolean,
  19707. reserveKeyword: {
  19708. type: Boolean,
  19709. default: true
  19710. },
  19711. valueKey: {
  19712. type: String,
  19713. default: "value"
  19714. },
  19715. collapseTags: Boolean,
  19716. collapseTagsTooltip: {
  19717. type: Boolean,
  19718. default: false
  19719. },
  19720. popperAppendToBody: {
  19721. type: Boolean,
  19722. default: void 0
  19723. },
  19724. teleported: useTooltipContentProps.teleported,
  19725. persistent: {
  19726. type: Boolean,
  19727. default: true
  19728. },
  19729. clearIcon: {
  19730. type: [String, Object],
  19731. default: circleClose
  19732. },
  19733. fitInputWidth: {
  19734. type: Boolean,
  19735. default: false
  19736. },
  19737. suffixIcon: {
  19738. type: [String, Object],
  19739. default: arrowUp
  19740. },
  19741. tagType: __spreadProps(__spreadValues({}, tagProps.type), { default: "info" })
  19742. },
  19743. emits: [
  19744. UPDATE_MODEL_EVENT,
  19745. CHANGE_EVENT,
  19746. "remove-tag",
  19747. "clear",
  19748. "visible-change",
  19749. "focus",
  19750. "blur"
  19751. ],
  19752. setup(props, ctx) {
  19753. const nsSelect = useNamespace("select");
  19754. const nsInput = useNamespace("input");
  19755. const { t } = useLocale();
  19756. const states = useSelectStates(props);
  19757. const {
  19758. optionsArray,
  19759. selectSize,
  19760. readonly: readonly2,
  19761. handleResize,
  19762. collapseTagSize,
  19763. debouncedOnInputChange,
  19764. debouncedQueryChange,
  19765. deletePrevTag,
  19766. deleteTag,
  19767. deleteSelected,
  19768. handleOptionSelect,
  19769. scrollToOption,
  19770. setSelected,
  19771. resetInputHeight,
  19772. managePlaceholder,
  19773. showClose,
  19774. selectDisabled,
  19775. iconComponent,
  19776. iconReverse,
  19777. showNewOption,
  19778. emptyText,
  19779. toggleLastOptionHitState,
  19780. resetInputState,
  19781. handleComposition,
  19782. onOptionCreate,
  19783. onOptionDestroy,
  19784. handleMenuEnter,
  19785. handleFocus,
  19786. blur,
  19787. handleBlur,
  19788. handleClearClick,
  19789. handleClose,
  19790. toggleMenu,
  19791. selectOption,
  19792. getValueKey,
  19793. navigateOptions,
  19794. dropMenuVisible,
  19795. reference: reference2,
  19796. input,
  19797. tooltipRef,
  19798. tags,
  19799. selectWrapper,
  19800. scrollbar,
  19801. queryChange,
  19802. groupQueryChange
  19803. } = useSelect(props, states, ctx);
  19804. const { focus } = useFocus(reference2);
  19805. const {
  19806. inputWidth,
  19807. selected,
  19808. inputLength,
  19809. filteredOptionsCount,
  19810. visible,
  19811. softFocus,
  19812. selectedLabel,
  19813. hoverIndex,
  19814. query,
  19815. inputHovering,
  19816. currentPlaceholder,
  19817. menuVisibleOnFocus,
  19818. isOnComposition,
  19819. isSilentBlur,
  19820. options,
  19821. cachedOptions,
  19822. optionsCount,
  19823. prefixWidth,
  19824. tagInMultiLine
  19825. } = toRefs(states);
  19826. const wrapperKls = computed(() => {
  19827. const classList = [nsSelect.b()];
  19828. const _selectSize = unref(selectSize);
  19829. if (_selectSize) {
  19830. classList.push(nsSelect.m(_selectSize));
  19831. }
  19832. if (props.disabled) {
  19833. classList.push(nsSelect.m("disabled"));
  19834. }
  19835. return classList;
  19836. });
  19837. const selectTagsStyle = computed(() => ({
  19838. maxWidth: `${unref(inputWidth) - 32}px`,
  19839. width: "100%"
  19840. }));
  19841. provide(selectKey, reactive({
  19842. props,
  19843. options,
  19844. optionsArray,
  19845. cachedOptions,
  19846. optionsCount,
  19847. filteredOptionsCount,
  19848. hoverIndex,
  19849. handleOptionSelect,
  19850. onOptionCreate,
  19851. onOptionDestroy,
  19852. selectWrapper,
  19853. selected,
  19854. setSelected,
  19855. queryChange,
  19856. groupQueryChange
  19857. }));
  19858. onMounted(() => {
  19859. states.cachedPlaceHolder = currentPlaceholder.value = props.placeholder || t("el.select.placeholder");
  19860. if (props.multiple && Array.isArray(props.modelValue) && props.modelValue.length > 0) {
  19861. currentPlaceholder.value = "";
  19862. }
  19863. addResizeListener(selectWrapper.value, handleResize);
  19864. if (reference2.value && reference2.value.$el) {
  19865. const input2 = reference2.value.input;
  19866. states.initialInputHeight = input2.getBoundingClientRect().height || getComponentSize(selectSize.value);
  19867. }
  19868. if (props.remote && props.multiple) {
  19869. resetInputHeight();
  19870. }
  19871. nextTick(() => {
  19872. if (!reference2.value)
  19873. return;
  19874. if (reference2.value.$el) {
  19875. inputWidth.value = reference2.value.$el.getBoundingClientRect().width;
  19876. }
  19877. if (ctx.slots.prefix) {
  19878. const inputChildNodes = reference2.value.$el.childNodes;
  19879. const input2 = Array.from(inputChildNodes).find((item) => item.tagName === "INPUT");
  19880. const prefix = reference2.value.$el.querySelector(`.${nsInput.e("prefix")}`);
  19881. prefixWidth.value = Math.max(prefix.getBoundingClientRect().width + 5, 30);
  19882. if (states.prefixWidth) {
  19883. input2.style.paddingLeft = `${Math.max(states.prefixWidth, 30)}px`;
  19884. }
  19885. }
  19886. });
  19887. setSelected();
  19888. });
  19889. onBeforeUnmount(() => {
  19890. removeResizeListener(selectWrapper.value, handleResize);
  19891. });
  19892. if (props.multiple && !Array.isArray(props.modelValue)) {
  19893. ctx.emit(UPDATE_MODEL_EVENT, []);
  19894. }
  19895. if (!props.multiple && Array.isArray(props.modelValue)) {
  19896. ctx.emit(UPDATE_MODEL_EVENT, "");
  19897. }
  19898. const popperPaneRef = computed(() => {
  19899. var _a2, _b2;
  19900. return (_b2 = (_a2 = tooltipRef.value) == null ? void 0 : _a2.popperRef) == null ? void 0 : _b2.contentRef;
  19901. });
  19902. const { compatTeleported } = useDeprecateAppendToBody(COMPONENT_NAME$1, "popperAppendToBody");
  19903. return {
  19904. tagInMultiLine,
  19905. prefixWidth,
  19906. selectSize,
  19907. readonly: readonly2,
  19908. handleResize,
  19909. collapseTagSize,
  19910. debouncedOnInputChange,
  19911. debouncedQueryChange,
  19912. deletePrevTag,
  19913. deleteTag,
  19914. deleteSelected,
  19915. handleOptionSelect,
  19916. scrollToOption,
  19917. inputWidth,
  19918. selected,
  19919. inputLength,
  19920. filteredOptionsCount,
  19921. visible,
  19922. softFocus,
  19923. selectedLabel,
  19924. hoverIndex,
  19925. query,
  19926. inputHovering,
  19927. currentPlaceholder,
  19928. menuVisibleOnFocus,
  19929. isOnComposition,
  19930. isSilentBlur,
  19931. options,
  19932. resetInputHeight,
  19933. managePlaceholder,
  19934. showClose,
  19935. selectDisabled,
  19936. iconComponent,
  19937. iconReverse,
  19938. showNewOption,
  19939. emptyText,
  19940. toggleLastOptionHitState,
  19941. resetInputState,
  19942. handleComposition,
  19943. handleMenuEnter,
  19944. handleFocus,
  19945. blur,
  19946. handleBlur,
  19947. handleClearClick,
  19948. handleClose,
  19949. toggleMenu,
  19950. selectOption,
  19951. getValueKey,
  19952. navigateOptions,
  19953. dropMenuVisible,
  19954. focus,
  19955. reference: reference2,
  19956. input,
  19957. tooltipRef,
  19958. popperPaneRef,
  19959. tags,
  19960. selectWrapper,
  19961. scrollbar,
  19962. wrapperKls,
  19963. selectTagsStyle,
  19964. compatTeleported,
  19965. nsSelect
  19966. };
  19967. }
  19968. });
  19969. const _hoisted_1$h = { class: "select-trigger" };
  19970. const _hoisted_2$f = ["disabled", "autocomplete"];
  19971. const _hoisted_3$a = { style: { "height": "100%", "display": "flex", "justify-content": "center", "align-items": "center" } };
  19972. function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
  19973. const _component_el_tag = resolveComponent("el-tag");
  19974. const _component_el_tooltip = resolveComponent("el-tooltip");
  19975. const _component_el_icon = resolveComponent("el-icon");
  19976. const _component_el_input = resolveComponent("el-input");
  19977. const _component_el_option = resolveComponent("el-option");
  19978. const _component_el_scrollbar = resolveComponent("el-scrollbar");
  19979. const _component_el_select_menu = resolveComponent("el-select-menu");
  19980. const _directive_click_outside = resolveDirective("click-outside");
  19981. return withDirectives((openBlock(), createElementBlock("div", {
  19982. ref: "selectWrapper",
  19983. class: normalizeClass(_ctx.wrapperKls),
  19984. onClick: _cache[24] || (_cache[24] = withModifiers((...args) => _ctx.toggleMenu && _ctx.toggleMenu(...args), ["stop"]))
  19985. }, [
  19986. createVNode(_component_el_tooltip, {
  19987. ref: "tooltipRef",
  19988. visible: _ctx.dropMenuVisible,
  19989. "onUpdate:visible": _cache[23] || (_cache[23] = ($event) => _ctx.dropMenuVisible = $event),
  19990. placement: "bottom-start",
  19991. teleported: _ctx.compatTeleported,
  19992. "popper-class": [_ctx.nsSelect.e("popper"), _ctx.popperClass],
  19993. "fallback-placements": ["bottom-start", "top-start", "right", "left"],
  19994. effect: _ctx.effect,
  19995. pure: "",
  19996. trigger: "click",
  19997. transition: `${_ctx.nsSelect.namespace.value}-zoom-in-top`,
  19998. "stop-popper-mouse-event": false,
  19999. "gpu-acceleration": false,
  20000. persistent: _ctx.persistent,
  20001. onShow: _ctx.handleMenuEnter
  20002. }, {
  20003. default: withCtx(() => [
  20004. createElementVNode("div", _hoisted_1$h, [
  20005. _ctx.multiple ? (openBlock(), createElementBlock("div", {
  20006. key: 0,
  20007. ref: "tags",
  20008. class: normalizeClass(_ctx.nsSelect.e("tags")),
  20009. style: normalizeStyle(_ctx.selectTagsStyle)
  20010. }, [
  20011. _ctx.collapseTags && _ctx.selected.length ? (openBlock(), createElementBlock("span", {
  20012. key: 0,
  20013. class: normalizeClass([
  20014. _ctx.nsSelect.b("tags-wrapper"),
  20015. { "has-prefix": _ctx.prefixWidth && _ctx.selected.length }
  20016. ])
  20017. }, [
  20018. createVNode(_component_el_tag, {
  20019. closable: !_ctx.selectDisabled && !_ctx.selected[0].isDisabled,
  20020. size: _ctx.collapseTagSize,
  20021. hit: _ctx.selected[0].hitState,
  20022. type: _ctx.tagType,
  20023. "disable-transitions": "",
  20024. onClose: _cache[0] || (_cache[0] = ($event) => _ctx.deleteTag($event, _ctx.selected[0]))
  20025. }, {
  20026. default: withCtx(() => [
  20027. createElementVNode("span", {
  20028. class: normalizeClass(_ctx.nsSelect.e("tags-text")),
  20029. style: normalizeStyle({ maxWidth: _ctx.inputWidth - 123 + "px" })
  20030. }, toDisplayString(_ctx.selected[0].currentLabel), 7)
  20031. ]),
  20032. _: 1
  20033. }, 8, ["closable", "size", "hit", "type"]),
  20034. _ctx.selected.length > 1 ? (openBlock(), createBlock(_component_el_tag, {
  20035. key: 0,
  20036. closable: false,
  20037. size: _ctx.collapseTagSize,
  20038. type: _ctx.tagType,
  20039. "disable-transitions": ""
  20040. }, {
  20041. default: withCtx(() => [
  20042. _ctx.collapseTagsTooltip ? (openBlock(), createBlock(_component_el_tooltip, {
  20043. key: 0,
  20044. disabled: _ctx.dropMenuVisible,
  20045. "fallback-placements": ["bottom", "top", "right", "left"],
  20046. effect: _ctx.effect,
  20047. placement: "bottom",
  20048. teleported: false
  20049. }, {
  20050. default: withCtx(() => [
  20051. createElementVNode("span", {
  20052. class: normalizeClass(_ctx.nsSelect.e("tags-text"))
  20053. }, "+ " + toDisplayString(_ctx.selected.length - 1), 3)
  20054. ]),
  20055. content: withCtx(() => [
  20056. createElementVNode("div", {
  20057. class: normalizeClass(_ctx.nsSelect.e("collapse-tags"))
  20058. }, [
  20059. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.selected, (item, idx) => {
  20060. return openBlock(), createElementBlock("div", {
  20061. key: idx,
  20062. class: normalizeClass(_ctx.nsSelect.e("collapse-tag"))
  20063. }, [
  20064. (openBlock(), createBlock(_component_el_tag, {
  20065. key: _ctx.getValueKey(item),
  20066. class: "in-tooltip",
  20067. closable: !_ctx.selectDisabled && !item.isDisabled,
  20068. size: _ctx.collapseTagSize,
  20069. hit: item.hitState,
  20070. type: _ctx.tagType,
  20071. "disable-transitions": "",
  20072. style: { margin: "2px" },
  20073. onClose: ($event) => _ctx.deleteTag($event, item)
  20074. }, {
  20075. default: withCtx(() => [
  20076. createElementVNode("span", {
  20077. class: normalizeClass(_ctx.nsSelect.e("tags-text")),
  20078. style: normalizeStyle({
  20079. maxWidth: _ctx.inputWidth - 75 + "px"
  20080. })
  20081. }, toDisplayString(item.currentLabel), 7)
  20082. ]),
  20083. _: 2
  20084. }, 1032, ["closable", "size", "hit", "type", "onClose"]))
  20085. ], 2);
  20086. }), 128))
  20087. ], 2)
  20088. ]),
  20089. _: 1
  20090. }, 8, ["disabled", "effect"])) : (openBlock(), createElementBlock("span", {
  20091. key: 1,
  20092. class: normalizeClass(_ctx.nsSelect.e("tags-text"))
  20093. }, "+ " + toDisplayString(_ctx.selected.length - 1), 3))
  20094. ]),
  20095. _: 1
  20096. }, 8, ["size", "type"])) : createCommentVNode("v-if", true)
  20097. ], 2)) : createCommentVNode("v-if", true),
  20098. createCommentVNode(" <div> "),
  20099. !_ctx.collapseTags ? (openBlock(), createBlock(Transition, {
  20100. key: 1,
  20101. onAfterLeave: _ctx.resetInputHeight
  20102. }, {
  20103. default: withCtx(() => [
  20104. createElementVNode("span", {
  20105. class: normalizeClass([
  20106. _ctx.nsSelect.b("tags-wrapper"),
  20107. { "has-prefix": _ctx.prefixWidth && _ctx.selected.length }
  20108. ])
  20109. }, [
  20110. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.selected, (item) => {
  20111. return openBlock(), createBlock(_component_el_tag, {
  20112. key: _ctx.getValueKey(item),
  20113. closable: !_ctx.selectDisabled && !item.isDisabled,
  20114. size: _ctx.collapseTagSize,
  20115. hit: item.hitState,
  20116. type: _ctx.tagType,
  20117. "disable-transitions": "",
  20118. onClose: ($event) => _ctx.deleteTag($event, item)
  20119. }, {
  20120. default: withCtx(() => [
  20121. createElementVNode("span", {
  20122. class: normalizeClass(_ctx.nsSelect.e("tags-text")),
  20123. style: normalizeStyle({ maxWidth: _ctx.inputWidth - 75 + "px" })
  20124. }, toDisplayString(item.currentLabel), 7)
  20125. ]),
  20126. _: 2
  20127. }, 1032, ["closable", "size", "hit", "type", "onClose"]);
  20128. }), 128))
  20129. ], 2)
  20130. ]),
  20131. _: 1
  20132. }, 8, ["onAfterLeave"])) : createCommentVNode("v-if", true),
  20133. createCommentVNode(" </div> "),
  20134. _ctx.filterable ? withDirectives((openBlock(), createElementBlock("input", {
  20135. key: 2,
  20136. ref: "input",
  20137. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.query = $event),
  20138. type: "text",
  20139. class: normalizeClass([_ctx.nsSelect.e("input"), _ctx.nsSelect.is(_ctx.selectSize)]),
  20140. disabled: _ctx.selectDisabled,
  20141. autocomplete: _ctx.autocomplete,
  20142. style: normalizeStyle({
  20143. marginLeft: _ctx.prefixWidth && !_ctx.selected.length || _ctx.tagInMultiLine ? `${_ctx.prefixWidth}px` : "",
  20144. flexGrow: 1,
  20145. width: `${_ctx.inputLength / (_ctx.inputWidth - 32)}%`,
  20146. maxWidth: `${_ctx.inputWidth - 42}px`
  20147. }),
  20148. onFocus: _cache[2] || (_cache[2] = (...args) => _ctx.handleFocus && _ctx.handleFocus(...args)),
  20149. onBlur: _cache[3] || (_cache[3] = (...args) => _ctx.handleBlur && _ctx.handleBlur(...args)),
  20150. onKeyup: _cache[4] || (_cache[4] = (...args) => _ctx.managePlaceholder && _ctx.managePlaceholder(...args)),
  20151. onKeydown: [
  20152. _cache[5] || (_cache[5] = (...args) => _ctx.resetInputState && _ctx.resetInputState(...args)),
  20153. _cache[6] || (_cache[6] = withKeys(withModifiers(($event) => _ctx.navigateOptions("next"), ["prevent"]), ["down"])),
  20154. _cache[7] || (_cache[7] = withKeys(withModifiers(($event) => _ctx.navigateOptions("prev"), ["prevent"]), ["up"])),
  20155. _cache[8] || (_cache[8] = withKeys(withModifiers(($event) => _ctx.visible = false, ["stop", "prevent"]), ["esc"])),
  20156. _cache[9] || (_cache[9] = withKeys(withModifiers((...args) => _ctx.selectOption && _ctx.selectOption(...args), ["stop", "prevent"]), ["enter"])),
  20157. _cache[10] || (_cache[10] = withKeys((...args) => _ctx.deletePrevTag && _ctx.deletePrevTag(...args), ["delete"])),
  20158. _cache[11] || (_cache[11] = withKeys(($event) => _ctx.visible = false, ["tab"]))
  20159. ],
  20160. onCompositionstart: _cache[12] || (_cache[12] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args)),
  20161. onCompositionupdate: _cache[13] || (_cache[13] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args)),
  20162. onCompositionend: _cache[14] || (_cache[14] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args)),
  20163. onInput: _cache[15] || (_cache[15] = (...args) => _ctx.debouncedQueryChange && _ctx.debouncedQueryChange(...args))
  20164. }, null, 46, _hoisted_2$f)), [
  20165. [vModelText, _ctx.query]
  20166. ]) : createCommentVNode("v-if", true)
  20167. ], 6)) : createCommentVNode("v-if", true),
  20168. createVNode(_component_el_input, {
  20169. id: _ctx.id,
  20170. ref: "reference",
  20171. modelValue: _ctx.selectedLabel,
  20172. "onUpdate:modelValue": _cache[16] || (_cache[16] = ($event) => _ctx.selectedLabel = $event),
  20173. type: "text",
  20174. placeholder: _ctx.currentPlaceholder,
  20175. name: _ctx.name,
  20176. autocomplete: _ctx.autocomplete,
  20177. size: _ctx.selectSize,
  20178. disabled: _ctx.selectDisabled,
  20179. readonly: _ctx.readonly,
  20180. "validate-event": false,
  20181. class: normalizeClass([_ctx.nsSelect.is("focus", _ctx.visible)]),
  20182. tabindex: _ctx.multiple && _ctx.filterable ? -1 : void 0,
  20183. onFocus: _ctx.handleFocus,
  20184. onBlur: _ctx.handleBlur,
  20185. onInput: _ctx.debouncedOnInputChange,
  20186. onPaste: _ctx.debouncedOnInputChange,
  20187. onCompositionstart: _ctx.handleComposition,
  20188. onCompositionupdate: _ctx.handleComposition,
  20189. onCompositionend: _ctx.handleComposition,
  20190. onKeydown: [
  20191. _cache[17] || (_cache[17] = withKeys(withModifiers(($event) => _ctx.navigateOptions("next"), ["stop", "prevent"]), ["down"])),
  20192. _cache[18] || (_cache[18] = withKeys(withModifiers(($event) => _ctx.navigateOptions("prev"), ["stop", "prevent"]), ["up"])),
  20193. withKeys(withModifiers(_ctx.selectOption, ["stop", "prevent"]), ["enter"]),
  20194. _cache[19] || (_cache[19] = withKeys(withModifiers(($event) => _ctx.visible = false, ["stop", "prevent"]), ["esc"])),
  20195. _cache[20] || (_cache[20] = withKeys(($event) => _ctx.visible = false, ["tab"]))
  20196. ],
  20197. onMouseenter: _cache[21] || (_cache[21] = ($event) => _ctx.inputHovering = true),
  20198. onMouseleave: _cache[22] || (_cache[22] = ($event) => _ctx.inputHovering = false)
  20199. }, createSlots({
  20200. suffix: withCtx(() => [
  20201. _ctx.iconComponent && !_ctx.showClose ? (openBlock(), createBlock(_component_el_icon, {
  20202. key: 0,
  20203. class: normalizeClass([_ctx.nsSelect.e("caret"), _ctx.nsSelect.e("icon"), _ctx.iconReverse])
  20204. }, {
  20205. default: withCtx(() => [
  20206. (openBlock(), createBlock(resolveDynamicComponent(_ctx.iconComponent)))
  20207. ]),
  20208. _: 1
  20209. }, 8, ["class"])) : createCommentVNode("v-if", true),
  20210. _ctx.showClose && _ctx.clearIcon ? (openBlock(), createBlock(_component_el_icon, {
  20211. key: 1,
  20212. class: normalizeClass([_ctx.nsSelect.e("caret"), _ctx.nsSelect.e("icon")]),
  20213. onClick: _ctx.handleClearClick
  20214. }, {
  20215. default: withCtx(() => [
  20216. (openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon)))
  20217. ]),
  20218. _: 1
  20219. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true)
  20220. ]),
  20221. _: 2
  20222. }, [
  20223. _ctx.$slots.prefix ? {
  20224. name: "prefix",
  20225. fn: withCtx(() => [
  20226. createElementVNode("div", _hoisted_3$a, [
  20227. renderSlot(_ctx.$slots, "prefix")
  20228. ])
  20229. ])
  20230. } : void 0
  20231. ]), 1032, ["id", "modelValue", "placeholder", "name", "autocomplete", "size", "disabled", "readonly", "class", "tabindex", "onFocus", "onBlur", "onInput", "onPaste", "onCompositionstart", "onCompositionupdate", "onCompositionend", "onKeydown"])
  20232. ])
  20233. ]),
  20234. content: withCtx(() => [
  20235. createVNode(_component_el_select_menu, null, {
  20236. default: withCtx(() => [
  20237. withDirectives(createVNode(_component_el_scrollbar, {
  20238. ref: "scrollbar",
  20239. tag: "ul",
  20240. "wrap-class": _ctx.nsSelect.be("dropdown", "wrap"),
  20241. "view-class": _ctx.nsSelect.be("dropdown", "list"),
  20242. class: normalizeClass([
  20243. _ctx.nsSelect.is("empty", !_ctx.allowCreate && Boolean(_ctx.query) && _ctx.filteredOptionsCount === 0)
  20244. ])
  20245. }, {
  20246. default: withCtx(() => [
  20247. _ctx.showNewOption ? (openBlock(), createBlock(_component_el_option, {
  20248. key: 0,
  20249. value: _ctx.query,
  20250. created: true
  20251. }, null, 8, ["value"])) : createCommentVNode("v-if", true),
  20252. renderSlot(_ctx.$slots, "default")
  20253. ]),
  20254. _: 3
  20255. }, 8, ["wrap-class", "view-class", "class"]), [
  20256. [vShow, _ctx.options.size > 0 && !_ctx.loading]
  20257. ]),
  20258. _ctx.emptyText && (!_ctx.allowCreate || _ctx.loading || _ctx.allowCreate && _ctx.options.size === 0) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  20259. _ctx.$slots.empty ? renderSlot(_ctx.$slots, "empty", { key: 0 }) : (openBlock(), createElementBlock("p", {
  20260. key: 1,
  20261. class: normalizeClass(_ctx.nsSelect.be("dropdown", "empty"))
  20262. }, toDisplayString(_ctx.emptyText), 3))
  20263. ], 2112)) : createCommentVNode("v-if", true)
  20264. ]),
  20265. _: 3
  20266. })
  20267. ]),
  20268. _: 3
  20269. }, 8, ["visible", "teleported", "popper-class", "effect", "transition", "persistent", "onShow"])
  20270. ], 2)), [
  20271. [_directive_click_outside, _ctx.handleClose, _ctx.popperPaneRef]
  20272. ]);
  20273. }
  20274. var Select = /* @__PURE__ */ _export_sfc$1(_sfc_main$o, [["render", _sfc_render$a], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/select/src/select.vue"]]);
  20275. const _sfc_main$n = defineComponent({
  20276. name: "ElOptionGroup",
  20277. componentName: "ElOptionGroup",
  20278. props: {
  20279. label: String,
  20280. disabled: {
  20281. type: Boolean,
  20282. default: false
  20283. }
  20284. },
  20285. setup(props) {
  20286. const ns = useNamespace("select");
  20287. const visible = ref(true);
  20288. const instance = getCurrentInstance();
  20289. const children = ref([]);
  20290. provide(selectGroupKey, reactive(__spreadValues({}, toRefs(props))));
  20291. const select = inject(selectKey);
  20292. onMounted(() => {
  20293. children.value = flattedChildren(instance.subTree);
  20294. });
  20295. const flattedChildren = (node) => {
  20296. const children2 = [];
  20297. if (Array.isArray(node.children)) {
  20298. node.children.forEach((child) => {
  20299. var _a2;
  20300. if (child.type && child.type.name === "ElOption" && child.component && child.component.proxy) {
  20301. children2.push(child.component.proxy);
  20302. } else if ((_a2 = child.children) == null ? void 0 : _a2.length) {
  20303. children2.push(...flattedChildren(child));
  20304. }
  20305. });
  20306. }
  20307. return children2;
  20308. };
  20309. const { groupQueryChange } = toRaw(select);
  20310. watch(groupQueryChange, () => {
  20311. visible.value = children.value.some((option) => option.visible === true);
  20312. });
  20313. return {
  20314. visible,
  20315. ns
  20316. };
  20317. }
  20318. });
  20319. function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
  20320. return withDirectives((openBlock(), createElementBlock("ul", {
  20321. class: normalizeClass(_ctx.ns.be("group", "wrap"))
  20322. }, [
  20323. createElementVNode("li", {
  20324. class: normalizeClass(_ctx.ns.be("group", "title"))
  20325. }, toDisplayString(_ctx.label), 3),
  20326. createElementVNode("li", null, [
  20327. createElementVNode("ul", {
  20328. class: normalizeClass(_ctx.ns.b("group"))
  20329. }, [
  20330. renderSlot(_ctx.$slots, "default")
  20331. ], 2)
  20332. ])
  20333. ], 2)), [
  20334. [vShow, _ctx.visible]
  20335. ]);
  20336. }
  20337. var OptionGroup = /* @__PURE__ */ _export_sfc$1(_sfc_main$n, [["render", _sfc_render$9], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/select/src/option-group.vue"]]);
  20338. const ElSelect = withInstall(Select, {
  20339. Option,
  20340. OptionGroup
  20341. });
  20342. const ElOption = withNoopInstall(Option);
  20343. withNoopInstall(OptionGroup);
  20344. const progressProps = buildProps({
  20345. type: {
  20346. type: String,
  20347. default: "line",
  20348. values: ["line", "circle", "dashboard"]
  20349. },
  20350. percentage: {
  20351. type: Number,
  20352. default: 0,
  20353. validator: (val) => val >= 0 && val <= 100
  20354. },
  20355. status: {
  20356. type: String,
  20357. default: "",
  20358. values: ["", "success", "exception", "warning"]
  20359. },
  20360. indeterminate: {
  20361. type: Boolean,
  20362. default: false
  20363. },
  20364. duration: {
  20365. type: Number,
  20366. default: 3
  20367. },
  20368. strokeWidth: {
  20369. type: Number,
  20370. default: 6
  20371. },
  20372. strokeLinecap: {
  20373. type: definePropType(String),
  20374. default: "round"
  20375. },
  20376. textInside: {
  20377. type: Boolean,
  20378. default: false
  20379. },
  20380. width: {
  20381. type: Number,
  20382. default: 126
  20383. },
  20384. showText: {
  20385. type: Boolean,
  20386. default: true
  20387. },
  20388. color: {
  20389. type: definePropType([
  20390. String,
  20391. Array,
  20392. Function
  20393. ]),
  20394. default: ""
  20395. },
  20396. format: {
  20397. type: definePropType(Function),
  20398. default: (percentage) => `${percentage}%`
  20399. }
  20400. });
  20401. const _sfc_main$m = defineComponent({
  20402. name: "ElProgress",
  20403. components: {
  20404. ElIcon,
  20405. CircleCheck: circleCheck,
  20406. CircleClose: circleClose,
  20407. Check: check,
  20408. Close: close,
  20409. WarningFilled: warningFilled
  20410. },
  20411. props: progressProps,
  20412. setup(props) {
  20413. const ns = useNamespace("progress");
  20414. const barStyle = computed(() => ({
  20415. width: `${props.percentage}%`,
  20416. animationDuration: `${props.duration}s`,
  20417. backgroundColor: getCurrentColor(props.percentage)
  20418. }));
  20419. const relativeStrokeWidth = computed(() => (props.strokeWidth / props.width * 100).toFixed(1));
  20420. const radius = computed(() => {
  20421. if (props.type === "circle" || props.type === "dashboard") {
  20422. return Number.parseInt(`${50 - Number.parseFloat(relativeStrokeWidth.value) / 2}`, 10);
  20423. } else {
  20424. return 0;
  20425. }
  20426. });
  20427. const trackPath = computed(() => {
  20428. const r = radius.value;
  20429. const isDashboard = props.type === "dashboard";
  20430. return `
  20431. M 50 50
  20432. m 0 ${isDashboard ? "" : "-"}${r}
  20433. a ${r} ${r} 0 1 1 0 ${isDashboard ? "-" : ""}${r * 2}
  20434. a ${r} ${r} 0 1 1 0 ${isDashboard ? "" : "-"}${r * 2}
  20435. `;
  20436. });
  20437. const perimeter = computed(() => 2 * Math.PI * radius.value);
  20438. const rate = computed(() => props.type === "dashboard" ? 0.75 : 1);
  20439. const strokeDashoffset = computed(() => {
  20440. const offset2 = -1 * perimeter.value * (1 - rate.value) / 2;
  20441. return `${offset2}px`;
  20442. });
  20443. const trailPathStyle = computed(() => ({
  20444. strokeDasharray: `${perimeter.value * rate.value}px, ${perimeter.value}px`,
  20445. strokeDashoffset: strokeDashoffset.value
  20446. }));
  20447. const circlePathStyle = computed(() => ({
  20448. strokeDasharray: `${perimeter.value * rate.value * (props.percentage / 100)}px, ${perimeter.value}px`,
  20449. strokeDashoffset: strokeDashoffset.value,
  20450. transition: "stroke-dasharray 0.6s ease 0s, stroke 0.6s ease"
  20451. }));
  20452. const stroke = computed(() => {
  20453. let ret;
  20454. if (props.color) {
  20455. ret = getCurrentColor(props.percentage);
  20456. } else {
  20457. switch (props.status) {
  20458. case "success":
  20459. ret = "#13ce66";
  20460. break;
  20461. case "exception":
  20462. ret = "#ff4949";
  20463. break;
  20464. case "warning":
  20465. ret = "#e6a23c";
  20466. break;
  20467. default:
  20468. ret = "#20a0ff";
  20469. }
  20470. }
  20471. return ret;
  20472. });
  20473. const statusIcon = computed(() => {
  20474. if (props.status === "warning") {
  20475. return warningFilled;
  20476. }
  20477. if (props.type === "line") {
  20478. return props.status === "success" ? circleCheck : circleClose;
  20479. } else {
  20480. return props.status === "success" ? check : close;
  20481. }
  20482. });
  20483. const progressTextSize = computed(() => {
  20484. return props.type === "line" ? 12 + props.strokeWidth * 0.4 : props.width * 0.111111 + 2;
  20485. });
  20486. const content2 = computed(() => props.format(props.percentage));
  20487. const getCurrentColor = (percentage) => {
  20488. var _a2;
  20489. const { color } = props;
  20490. if (typeof color === "function") {
  20491. return color(percentage);
  20492. } else if (typeof color === "string") {
  20493. return color;
  20494. } else {
  20495. const span = 100 / color.length;
  20496. const seriesColors = color.map((seriesColor, index) => {
  20497. if (typeof seriesColor === "string") {
  20498. return {
  20499. color: seriesColor,
  20500. percentage: (index + 1) * span
  20501. };
  20502. }
  20503. return seriesColor;
  20504. });
  20505. const colors = seriesColors.sort((a2, b2) => a2.percentage - b2.percentage);
  20506. for (const color2 of colors) {
  20507. if (color2.percentage > percentage)
  20508. return color2.color;
  20509. }
  20510. return (_a2 = colors[colors.length - 1]) == null ? void 0 : _a2.color;
  20511. }
  20512. };
  20513. const slotData = computed(() => {
  20514. return {
  20515. percentage: props.percentage
  20516. };
  20517. });
  20518. return {
  20519. ns,
  20520. barStyle,
  20521. relativeStrokeWidth,
  20522. radius,
  20523. trackPath,
  20524. perimeter,
  20525. rate,
  20526. strokeDashoffset,
  20527. trailPathStyle,
  20528. circlePathStyle,
  20529. stroke,
  20530. statusIcon,
  20531. progressTextSize,
  20532. content: content2,
  20533. slotData
  20534. };
  20535. }
  20536. });
  20537. const _hoisted_1$g = ["aria-valuenow"];
  20538. const _hoisted_2$e = { viewBox: "0 0 100 100" };
  20539. const _hoisted_3$9 = ["d", "stroke-width"];
  20540. const _hoisted_4$8 = ["d", "stroke", "stroke-linecap", "stroke-width"];
  20541. const _hoisted_5$8 = { key: 0 };
  20542. function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
  20543. const _component_el_icon = resolveComponent("el-icon");
  20544. return openBlock(), createElementBlock("div", {
  20545. class: normalizeClass([
  20546. _ctx.ns.b(),
  20547. _ctx.ns.m(_ctx.type),
  20548. _ctx.ns.is(_ctx.status),
  20549. {
  20550. [_ctx.ns.m("without-text")]: !_ctx.showText,
  20551. [_ctx.ns.m("text-inside")]: _ctx.textInside
  20552. }
  20553. ]),
  20554. role: "progressbar",
  20555. "aria-valuenow": _ctx.percentage,
  20556. "aria-valuemin": "0",
  20557. "aria-valuemax": "100"
  20558. }, [
  20559. _ctx.type === "line" ? (openBlock(), createElementBlock("div", {
  20560. key: 0,
  20561. class: normalizeClass(_ctx.ns.b("bar"))
  20562. }, [
  20563. createElementVNode("div", {
  20564. class: normalizeClass(_ctx.ns.be("bar", "outer")),
  20565. style: normalizeStyle({ height: `${_ctx.strokeWidth}px` })
  20566. }, [
  20567. createElementVNode("div", {
  20568. class: normalizeClass([
  20569. _ctx.ns.be("bar", "inner"),
  20570. { [_ctx.ns.bem("bar", "inner", "indeterminate")]: _ctx.indeterminate }
  20571. ]),
  20572. style: normalizeStyle(_ctx.barStyle)
  20573. }, [
  20574. (_ctx.showText || _ctx.$slots.default) && _ctx.textInside ? (openBlock(), createElementBlock("div", {
  20575. key: 0,
  20576. class: normalizeClass(_ctx.ns.be("bar", "innerText"))
  20577. }, [
  20578. renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(_ctx.slotData)), () => [
  20579. createElementVNode("span", null, toDisplayString(_ctx.content), 1)
  20580. ])
  20581. ], 2)) : createCommentVNode("v-if", true)
  20582. ], 6)
  20583. ], 6)
  20584. ], 2)) : (openBlock(), createElementBlock("div", {
  20585. key: 1,
  20586. class: normalizeClass(_ctx.ns.b("circle")),
  20587. style: normalizeStyle({ height: `${_ctx.width}px`, width: `${_ctx.width}px` })
  20588. }, [
  20589. (openBlock(), createElementBlock("svg", _hoisted_2$e, [
  20590. createElementVNode("path", {
  20591. class: normalizeClass(_ctx.ns.be("circle", "track")),
  20592. d: _ctx.trackPath,
  20593. stroke: "var(--el-fill-color-light, #e5e9f2)",
  20594. "stroke-width": _ctx.relativeStrokeWidth,
  20595. fill: "none",
  20596. style: normalizeStyle(_ctx.trailPathStyle)
  20597. }, null, 14, _hoisted_3$9),
  20598. createElementVNode("path", {
  20599. class: normalizeClass(_ctx.ns.be("circle", "path")),
  20600. d: _ctx.trackPath,
  20601. stroke: _ctx.stroke,
  20602. fill: "none",
  20603. "stroke-linecap": _ctx.strokeLinecap,
  20604. "stroke-width": _ctx.percentage ? _ctx.relativeStrokeWidth : 0,
  20605. style: normalizeStyle(_ctx.circlePathStyle)
  20606. }, null, 14, _hoisted_4$8)
  20607. ]))
  20608. ], 6)),
  20609. (_ctx.showText || _ctx.$slots.default) && !_ctx.textInside ? (openBlock(), createElementBlock("div", {
  20610. key: 2,
  20611. class: normalizeClass(_ctx.ns.e("text")),
  20612. style: normalizeStyle({ fontSize: `${_ctx.progressTextSize}px` })
  20613. }, [
  20614. renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(_ctx.slotData)), () => [
  20615. !_ctx.status ? (openBlock(), createElementBlock("span", _hoisted_5$8, toDisplayString(_ctx.content), 1)) : (openBlock(), createBlock(_component_el_icon, { key: 1 }, {
  20616. default: withCtx(() => [
  20617. (openBlock(), createBlock(resolveDynamicComponent(_ctx.statusIcon)))
  20618. ]),
  20619. _: 1
  20620. }))
  20621. ])
  20622. ], 6)) : createCommentVNode("v-if", true)
  20623. ], 10, _hoisted_1$g);
  20624. }
  20625. var Progress = /* @__PURE__ */ _export_sfc$1(_sfc_main$m, [["render", _sfc_render$8], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/progress/src/progress.vue"]]);
  20626. const ElProgress = withInstall(Progress);
  20627. const rateProps = buildProps({
  20628. modelValue: {
  20629. type: Number,
  20630. default: 0
  20631. },
  20632. lowThreshold: {
  20633. type: Number,
  20634. default: 2
  20635. },
  20636. highThreshold: {
  20637. type: Number,
  20638. default: 4
  20639. },
  20640. max: {
  20641. type: Number,
  20642. default: 5
  20643. },
  20644. colors: {
  20645. type: definePropType([Array, Object]),
  20646. default: () => mutable(["", "", ""])
  20647. },
  20648. voidColor: {
  20649. type: String,
  20650. default: ""
  20651. },
  20652. disabledVoidColor: {
  20653. type: String,
  20654. default: ""
  20655. },
  20656. icons: {
  20657. type: definePropType([Array, Object]),
  20658. default: () => [starFilled, starFilled, starFilled]
  20659. },
  20660. voidIcon: {
  20661. type: iconPropType,
  20662. default: () => star
  20663. },
  20664. disabledVoidIcon: {
  20665. type: iconPropType,
  20666. default: () => starFilled
  20667. },
  20668. disabled: {
  20669. type: Boolean,
  20670. default: false
  20671. },
  20672. allowHalf: {
  20673. type: Boolean,
  20674. default: false
  20675. },
  20676. showText: {
  20677. type: Boolean,
  20678. default: false
  20679. },
  20680. showScore: {
  20681. type: Boolean,
  20682. default: false
  20683. },
  20684. textColor: {
  20685. type: String,
  20686. default: ""
  20687. },
  20688. texts: {
  20689. type: definePropType(Array),
  20690. default: () => mutable([
  20691. "Extremely bad",
  20692. "Disappointed",
  20693. "Fair",
  20694. "Satisfied",
  20695. "Surprise"
  20696. ])
  20697. },
  20698. scoreTemplate: {
  20699. type: String,
  20700. default: "{value}"
  20701. },
  20702. size: {
  20703. type: String,
  20704. validator: isValidComponentSize
  20705. }
  20706. });
  20707. const rateEmits = {
  20708. change: (value) => typeof value === "number",
  20709. [UPDATE_MODEL_EVENT]: (value) => typeof value === "number"
  20710. };
  20711. const _hoisted_1$f = ["aria-valuenow", "aria-valuetext", "aria-valuemax"];
  20712. const _hoisted_2$d = ["onMousemove", "onClick"];
  20713. const __default__$5 = {
  20714. name: "ElRate"
  20715. };
  20716. const _sfc_main$l = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$5), {
  20717. props: rateProps,
  20718. emits: rateEmits,
  20719. setup(__props, { expose, emit }) {
  20720. const props = __props;
  20721. function getValueFromMap(value, map) {
  20722. const isExcludedObject = (val) => isObject$1(val);
  20723. const matchedKeys = Object.keys(map).map((key) => +key).filter((key) => {
  20724. const val = map[key];
  20725. const excluded = isExcludedObject(val) ? val.excluded : false;
  20726. return excluded ? value < key : value <= key;
  20727. }).sort((a2, b2) => a2 - b2);
  20728. const matchedValue = map[matchedKeys[0]];
  20729. return isExcludedObject(matchedValue) && matchedValue.value || matchedValue;
  20730. }
  20731. const formContext = inject(formContextKey, void 0);
  20732. const rateSize = useSize();
  20733. const ns = useNamespace("rate");
  20734. const currentValue = ref(props.modelValue);
  20735. const hoverIndex = ref(-1);
  20736. const pointerAtLeftHalf = ref(true);
  20737. const rateClasses = computed(() => [ns.b(), ns.m(rateSize.value)]);
  20738. const rateDisabled = computed(() => props.disabled || (formContext == null ? void 0 : formContext.disabled));
  20739. const rateStyles = computed(() => {
  20740. return {
  20741. "--el-rate-void-color": props.voidColor,
  20742. "--el-rate-disabled-void-color": props.disabledVoidColor,
  20743. "--el-rate-fill-color": activeColor.value
  20744. };
  20745. });
  20746. const text = computed(() => {
  20747. let result = "";
  20748. if (props.showScore) {
  20749. result = props.scoreTemplate.replace(/\{\s*value\s*\}/, rateDisabled.value ? `${props.modelValue}` : `${currentValue.value}`);
  20750. } else if (props.showText) {
  20751. result = props.texts[Math.ceil(currentValue.value) - 1];
  20752. }
  20753. return result;
  20754. });
  20755. const valueDecimal = computed(() => props.modelValue * 100 - Math.floor(props.modelValue) * 100);
  20756. const colorMap = computed(() => isArray(props.colors) ? {
  20757. [props.lowThreshold]: props.colors[0],
  20758. [props.highThreshold]: { value: props.colors[1], excluded: true },
  20759. [props.max]: props.colors[2]
  20760. } : props.colors);
  20761. const activeColor = computed(() => {
  20762. const color = getValueFromMap(currentValue.value, colorMap.value);
  20763. return isObject$1(color) ? "" : color;
  20764. });
  20765. const decimalStyle = computed(() => {
  20766. let width = "";
  20767. if (rateDisabled.value) {
  20768. width = `${valueDecimal.value}%`;
  20769. } else if (props.allowHalf) {
  20770. width = "50%";
  20771. }
  20772. return {
  20773. color: activeColor.value,
  20774. width
  20775. };
  20776. });
  20777. const componentMap = computed(() => isArray(props.icons) ? {
  20778. [props.lowThreshold]: props.icons[0],
  20779. [props.highThreshold]: {
  20780. value: props.icons[1],
  20781. excluded: true
  20782. },
  20783. [props.max]: props.icons[2]
  20784. } : props.icons);
  20785. const decimalIconComponent = computed(() => getValueFromMap(props.modelValue, componentMap.value));
  20786. const voidComponent = computed(() => rateDisabled.value ? props.disabledVoidIcon : props.voidIcon);
  20787. const activeComponent = computed(() => getValueFromMap(currentValue.value, componentMap.value));
  20788. const iconComponents = computed(() => {
  20789. const result = Array.from({ length: props.max });
  20790. const threshold = currentValue.value;
  20791. result.fill(activeComponent.value, 0, threshold);
  20792. result.fill(voidComponent.value, threshold, props.max);
  20793. return result;
  20794. });
  20795. function showDecimalIcon(item) {
  20796. const showWhenDisabled = rateDisabled.value && valueDecimal.value > 0 && item - 1 < props.modelValue && item > props.modelValue;
  20797. const showWhenAllowHalf = props.allowHalf && pointerAtLeftHalf.value && item - 0.5 <= currentValue.value && item > currentValue.value;
  20798. return showWhenDisabled || showWhenAllowHalf;
  20799. }
  20800. function selectValue(value) {
  20801. if (rateDisabled.value) {
  20802. return;
  20803. }
  20804. if (props.allowHalf && pointerAtLeftHalf.value) {
  20805. emit(UPDATE_MODEL_EVENT, currentValue.value);
  20806. if (props.modelValue !== currentValue.value) {
  20807. emit("change", currentValue.value);
  20808. }
  20809. } else {
  20810. emit(UPDATE_MODEL_EVENT, value);
  20811. if (props.modelValue !== value) {
  20812. emit("change", value);
  20813. }
  20814. }
  20815. }
  20816. function handleKey(e) {
  20817. if (rateDisabled.value) {
  20818. return;
  20819. }
  20820. let _currentValue = currentValue.value;
  20821. const code = e.code;
  20822. if (code === EVENT_CODE.up || code === EVENT_CODE.right) {
  20823. if (props.allowHalf) {
  20824. _currentValue += 0.5;
  20825. } else {
  20826. _currentValue += 1;
  20827. }
  20828. e.stopPropagation();
  20829. e.preventDefault();
  20830. } else if (code === EVENT_CODE.left || code === EVENT_CODE.down) {
  20831. if (props.allowHalf) {
  20832. _currentValue -= 0.5;
  20833. } else {
  20834. _currentValue -= 1;
  20835. }
  20836. e.stopPropagation();
  20837. e.preventDefault();
  20838. }
  20839. _currentValue = _currentValue < 0 ? 0 : _currentValue;
  20840. _currentValue = _currentValue > props.max ? props.max : _currentValue;
  20841. emit(UPDATE_MODEL_EVENT, _currentValue);
  20842. emit("change", _currentValue);
  20843. return _currentValue;
  20844. }
  20845. function setCurrentValue(value, event) {
  20846. if (rateDisabled.value) {
  20847. return;
  20848. }
  20849. if (props.allowHalf) {
  20850. let target = event.target;
  20851. if (hasClass(target, ns.e("item"))) {
  20852. target = target.querySelector(`.${ns.e("icon")}`);
  20853. }
  20854. if (target.clientWidth === 0 || hasClass(target, ns.e("decimal"))) {
  20855. target = target.parentNode;
  20856. }
  20857. pointerAtLeftHalf.value = event.offsetX * 2 <= target.clientWidth;
  20858. currentValue.value = pointerAtLeftHalf.value ? value - 0.5 : value;
  20859. } else {
  20860. currentValue.value = value;
  20861. }
  20862. hoverIndex.value = value;
  20863. }
  20864. function resetCurrentValue() {
  20865. if (rateDisabled.value) {
  20866. return;
  20867. }
  20868. if (props.allowHalf) {
  20869. pointerAtLeftHalf.value = props.modelValue !== Math.floor(props.modelValue);
  20870. }
  20871. currentValue.value = props.modelValue;
  20872. hoverIndex.value = -1;
  20873. }
  20874. watch(() => props.modelValue, (val) => {
  20875. currentValue.value = val;
  20876. pointerAtLeftHalf.value = props.modelValue !== Math.floor(props.modelValue);
  20877. });
  20878. if (!props.modelValue) {
  20879. emit(UPDATE_MODEL_EVENT, 0);
  20880. }
  20881. expose({
  20882. setCurrentValue,
  20883. resetCurrentValue
  20884. });
  20885. return (_ctx, _cache) => {
  20886. return openBlock(), createElementBlock("div", {
  20887. class: normalizeClass([unref(rateClasses), unref(ns).is("disabled", unref(rateDisabled))]),
  20888. role: "slider",
  20889. "aria-valuenow": currentValue.value,
  20890. "aria-valuetext": unref(text),
  20891. "aria-valuemin": "0",
  20892. "aria-valuemax": _ctx.max,
  20893. tabindex: "0",
  20894. style: normalizeStyle(unref(rateStyles)),
  20895. onKeydown: handleKey
  20896. }, [
  20897. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.max, (item, key) => {
  20898. return openBlock(), createElementBlock("span", {
  20899. key,
  20900. class: normalizeClass(unref(ns).e("item")),
  20901. onMousemove: ($event) => setCurrentValue(item, $event),
  20902. onMouseleave: resetCurrentValue,
  20903. onClick: ($event) => selectValue(item)
  20904. }, [
  20905. createVNode(unref(ElIcon), {
  20906. class: normalizeClass([
  20907. unref(ns).e("icon"),
  20908. { hover: hoverIndex.value === item },
  20909. unref(ns).is("active", item <= currentValue.value)
  20910. ])
  20911. }, {
  20912. default: withCtx(() => [
  20913. !showDecimalIcon(item) ? (openBlock(), createBlock(resolveDynamicComponent(unref(iconComponents)[item - 1]), { key: 0 })) : createCommentVNode("v-if", true),
  20914. showDecimalIcon(item) ? (openBlock(), createBlock(unref(ElIcon), {
  20915. key: 1,
  20916. style: normalizeStyle(unref(decimalStyle)),
  20917. class: normalizeClass([unref(ns).e("icon"), unref(ns).e("decimal")])
  20918. }, {
  20919. default: withCtx(() => [
  20920. (openBlock(), createBlock(resolveDynamicComponent(unref(decimalIconComponent))))
  20921. ]),
  20922. _: 1
  20923. }, 8, ["style", "class"])) : createCommentVNode("v-if", true)
  20924. ]),
  20925. _: 2
  20926. }, 1032, ["class"])
  20927. ], 42, _hoisted_2$d);
  20928. }), 128)),
  20929. _ctx.showText || _ctx.showScore ? (openBlock(), createElementBlock("span", {
  20930. key: 0,
  20931. class: normalizeClass(unref(ns).e("text"))
  20932. }, toDisplayString(unref(text)), 3)) : createCommentVNode("v-if", true)
  20933. ], 46, _hoisted_1$f);
  20934. };
  20935. }
  20936. }));
  20937. var Rate = /* @__PURE__ */ _export_sfc$1(_sfc_main$l, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/rate/src/rate.vue"]]);
  20938. const ElRate = withInstall(Rate);
  20939. const useTooltip = (props, formatTooltip, showTooltip) => {
  20940. const tooltip = ref(null);
  20941. const tooltipVisible = ref(false);
  20942. const enableFormat = computed(() => {
  20943. return formatTooltip.value instanceof Function;
  20944. });
  20945. const formatValue = computed(() => {
  20946. return enableFormat.value && formatTooltip.value(props.modelValue) || props.modelValue;
  20947. });
  20948. const displayTooltip = debounce$1(() => {
  20949. showTooltip.value && (tooltipVisible.value = true);
  20950. }, 50);
  20951. const hideTooltip = debounce$1(() => {
  20952. showTooltip.value && (tooltipVisible.value = false);
  20953. }, 50);
  20954. return {
  20955. tooltip,
  20956. tooltipVisible,
  20957. formatValue,
  20958. displayTooltip,
  20959. hideTooltip
  20960. };
  20961. };
  20962. const useSliderButton = (props, initData, emit) => {
  20963. const {
  20964. disabled,
  20965. min: min2,
  20966. max: max2,
  20967. step,
  20968. showTooltip,
  20969. precision,
  20970. sliderSize,
  20971. formatTooltip,
  20972. emitChange,
  20973. resetSize,
  20974. updateDragging
  20975. } = inject("SliderProvider");
  20976. const { tooltip, tooltipVisible, formatValue, displayTooltip, hideTooltip } = useTooltip(props, formatTooltip, showTooltip);
  20977. const currentPosition = computed(() => {
  20978. return `${(props.modelValue - min2.value) / (max2.value - min2.value) * 100}%`;
  20979. });
  20980. const wrapperStyle = computed(() => {
  20981. return props.vertical ? { bottom: currentPosition.value } : { left: currentPosition.value };
  20982. });
  20983. const handleMouseEnter = () => {
  20984. initData.hovering = true;
  20985. displayTooltip();
  20986. };
  20987. const handleMouseLeave = () => {
  20988. initData.hovering = false;
  20989. if (!initData.dragging) {
  20990. hideTooltip();
  20991. }
  20992. };
  20993. const onButtonDown = (event) => {
  20994. if (disabled.value)
  20995. return;
  20996. event.preventDefault();
  20997. onDragStart(event);
  20998. on(window, "mousemove", onDragging);
  20999. on(window, "touchmove", onDragging);
  21000. on(window, "mouseup", onDragEnd);
  21001. on(window, "touchend", onDragEnd);
  21002. on(window, "contextmenu", onDragEnd);
  21003. };
  21004. const onLeftKeyDown = () => {
  21005. if (disabled.value)
  21006. return;
  21007. initData.newPosition = Number.parseFloat(currentPosition.value) - step.value / (max2.value - min2.value) * 100;
  21008. setPosition(initData.newPosition);
  21009. emitChange();
  21010. };
  21011. const onRightKeyDown = () => {
  21012. if (disabled.value)
  21013. return;
  21014. initData.newPosition = Number.parseFloat(currentPosition.value) + step.value / (max2.value - min2.value) * 100;
  21015. setPosition(initData.newPosition);
  21016. emitChange();
  21017. };
  21018. const getClientXY = (event) => {
  21019. let clientX;
  21020. let clientY;
  21021. if (event.type.startsWith("touch")) {
  21022. clientY = event.touches[0].clientY;
  21023. clientX = event.touches[0].clientX;
  21024. } else {
  21025. clientY = event.clientY;
  21026. clientX = event.clientX;
  21027. }
  21028. return {
  21029. clientX,
  21030. clientY
  21031. };
  21032. };
  21033. const onDragStart = (event) => {
  21034. initData.dragging = true;
  21035. initData.isClick = true;
  21036. const { clientX, clientY } = getClientXY(event);
  21037. if (props.vertical) {
  21038. initData.startY = clientY;
  21039. } else {
  21040. initData.startX = clientX;
  21041. }
  21042. initData.startPosition = Number.parseFloat(currentPosition.value);
  21043. initData.newPosition = initData.startPosition;
  21044. };
  21045. const onDragging = (event) => {
  21046. if (initData.dragging) {
  21047. initData.isClick = false;
  21048. displayTooltip();
  21049. resetSize();
  21050. let diff;
  21051. const { clientX, clientY } = getClientXY(event);
  21052. if (props.vertical) {
  21053. initData.currentY = clientY;
  21054. diff = (initData.startY - initData.currentY) / sliderSize.value * 100;
  21055. } else {
  21056. initData.currentX = clientX;
  21057. diff = (initData.currentX - initData.startX) / sliderSize.value * 100;
  21058. }
  21059. initData.newPosition = initData.startPosition + diff;
  21060. setPosition(initData.newPosition);
  21061. }
  21062. };
  21063. const onDragEnd = () => {
  21064. if (initData.dragging) {
  21065. setTimeout(() => {
  21066. initData.dragging = false;
  21067. if (!initData.hovering) {
  21068. hideTooltip();
  21069. }
  21070. if (!initData.isClick) {
  21071. setPosition(initData.newPosition);
  21072. emitChange();
  21073. }
  21074. }, 0);
  21075. off(window, "mousemove", onDragging);
  21076. off(window, "touchmove", onDragging);
  21077. off(window, "mouseup", onDragEnd);
  21078. off(window, "touchend", onDragEnd);
  21079. off(window, "contextmenu", onDragEnd);
  21080. }
  21081. };
  21082. const setPosition = async (newPosition) => {
  21083. if (newPosition === null || Number.isNaN(+newPosition))
  21084. return;
  21085. if (newPosition < 0) {
  21086. newPosition = 0;
  21087. } else if (newPosition > 100) {
  21088. newPosition = 100;
  21089. }
  21090. const lengthPerStep = 100 / ((max2.value - min2.value) / step.value);
  21091. const steps = Math.round(newPosition / lengthPerStep);
  21092. let value = steps * lengthPerStep * (max2.value - min2.value) * 0.01 + min2.value;
  21093. value = Number.parseFloat(value.toFixed(precision.value));
  21094. emit(UPDATE_MODEL_EVENT, value);
  21095. if (!initData.dragging && props.modelValue !== initData.oldValue) {
  21096. initData.oldValue = props.modelValue;
  21097. }
  21098. await nextTick();
  21099. initData.dragging && displayTooltip();
  21100. tooltip.value.updatePopper();
  21101. };
  21102. watch(() => initData.dragging, (val) => {
  21103. updateDragging(val);
  21104. });
  21105. return {
  21106. tooltip,
  21107. tooltipVisible,
  21108. showTooltip,
  21109. wrapperStyle,
  21110. formatValue,
  21111. handleMouseEnter,
  21112. handleMouseLeave,
  21113. onButtonDown,
  21114. onLeftKeyDown,
  21115. onRightKeyDown,
  21116. setPosition
  21117. };
  21118. };
  21119. const _sfc_main$k = defineComponent({
  21120. name: "ElSliderButton",
  21121. components: {
  21122. ElTooltip
  21123. },
  21124. props: {
  21125. modelValue: {
  21126. type: Number,
  21127. default: 0
  21128. },
  21129. vertical: {
  21130. type: Boolean,
  21131. default: false
  21132. },
  21133. tooltipClass: {
  21134. type: String,
  21135. default: ""
  21136. }
  21137. },
  21138. emits: [UPDATE_MODEL_EVENT],
  21139. setup(props, { emit }) {
  21140. const ns = useNamespace("slider");
  21141. const initData = reactive({
  21142. hovering: false,
  21143. dragging: false,
  21144. isClick: false,
  21145. startX: 0,
  21146. currentX: 0,
  21147. startY: 0,
  21148. currentY: 0,
  21149. startPosition: 0,
  21150. newPosition: 0,
  21151. oldValue: props.modelValue
  21152. });
  21153. const {
  21154. tooltip,
  21155. showTooltip,
  21156. tooltipVisible,
  21157. wrapperStyle,
  21158. formatValue,
  21159. handleMouseEnter,
  21160. handleMouseLeave,
  21161. onButtonDown,
  21162. onLeftKeyDown,
  21163. onRightKeyDown,
  21164. setPosition
  21165. } = useSliderButton(props, initData, emit);
  21166. const { hovering, dragging } = toRefs(initData);
  21167. return {
  21168. ns,
  21169. tooltip,
  21170. tooltipVisible,
  21171. showTooltip,
  21172. wrapperStyle,
  21173. formatValue,
  21174. handleMouseEnter,
  21175. handleMouseLeave,
  21176. onButtonDown,
  21177. onLeftKeyDown,
  21178. onRightKeyDown,
  21179. setPosition,
  21180. hovering,
  21181. dragging
  21182. };
  21183. }
  21184. });
  21185. function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
  21186. const _component_el_tooltip = resolveComponent("el-tooltip");
  21187. return openBlock(), createElementBlock("div", {
  21188. ref: "button",
  21189. class: normalizeClass([_ctx.ns.e("button-wrapper"), { hover: _ctx.hovering, dragging: _ctx.dragging }]),
  21190. style: normalizeStyle(_ctx.wrapperStyle),
  21191. tabindex: "0",
  21192. onMouseenter: _cache[1] || (_cache[1] = (...args) => _ctx.handleMouseEnter && _ctx.handleMouseEnter(...args)),
  21193. onMouseleave: _cache[2] || (_cache[2] = (...args) => _ctx.handleMouseLeave && _ctx.handleMouseLeave(...args)),
  21194. onMousedown: _cache[3] || (_cache[3] = (...args) => _ctx.onButtonDown && _ctx.onButtonDown(...args)),
  21195. onTouchstart: _cache[4] || (_cache[4] = (...args) => _ctx.onButtonDown && _ctx.onButtonDown(...args)),
  21196. onFocus: _cache[5] || (_cache[5] = (...args) => _ctx.handleMouseEnter && _ctx.handleMouseEnter(...args)),
  21197. onBlur: _cache[6] || (_cache[6] = (...args) => _ctx.handleMouseLeave && _ctx.handleMouseLeave(...args)),
  21198. onKeydown: [
  21199. _cache[7] || (_cache[7] = withKeys((...args) => _ctx.onLeftKeyDown && _ctx.onLeftKeyDown(...args), ["left"])),
  21200. _cache[8] || (_cache[8] = withKeys((...args) => _ctx.onRightKeyDown && _ctx.onRightKeyDown(...args), ["right"])),
  21201. _cache[9] || (_cache[9] = withKeys(withModifiers((...args) => _ctx.onLeftKeyDown && _ctx.onLeftKeyDown(...args), ["prevent"]), ["down"])),
  21202. _cache[10] || (_cache[10] = withKeys(withModifiers((...args) => _ctx.onRightKeyDown && _ctx.onRightKeyDown(...args), ["prevent"]), ["up"]))
  21203. ]
  21204. }, [
  21205. createVNode(_component_el_tooltip, {
  21206. ref: "tooltip",
  21207. visible: _ctx.tooltipVisible,
  21208. "onUpdate:visible": _cache[0] || (_cache[0] = ($event) => _ctx.tooltipVisible = $event),
  21209. placement: "top",
  21210. "stop-popper-mouse-event": false,
  21211. "popper-class": _ctx.tooltipClass,
  21212. disabled: !_ctx.showTooltip,
  21213. persistent: ""
  21214. }, {
  21215. content: withCtx(() => [
  21216. createElementVNode("span", null, toDisplayString(_ctx.formatValue), 1)
  21217. ]),
  21218. default: withCtx(() => [
  21219. createElementVNode("div", {
  21220. class: normalizeClass([_ctx.ns.e("button"), { hover: _ctx.hovering, dragging: _ctx.dragging }])
  21221. }, null, 2)
  21222. ]),
  21223. _: 1
  21224. }, 8, ["visible", "popper-class", "disabled"])
  21225. ], 38);
  21226. }
  21227. var SliderButton = /* @__PURE__ */ _export_sfc$1(_sfc_main$k, [["render", _sfc_render$7], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/slider/src/button.vue"]]);
  21228. const _sfc_main$j = defineComponent({
  21229. name: "ElMarker",
  21230. props: {
  21231. mark: {
  21232. type: [String, Object],
  21233. default: () => void 0
  21234. }
  21235. },
  21236. setup(props) {
  21237. const ns = useNamespace("slider");
  21238. const label = computed(() => {
  21239. return typeof props.mark === "string" ? props.mark : props.mark.label;
  21240. });
  21241. return {
  21242. ns,
  21243. label
  21244. };
  21245. },
  21246. render() {
  21247. var _a2;
  21248. return h$1("div", {
  21249. class: this.ns.e("marks-text"),
  21250. style: (_a2 = this.mark) == null ? void 0 : _a2.style
  21251. }, this.label);
  21252. }
  21253. });
  21254. var SliderMarker = /* @__PURE__ */ _export_sfc$1(_sfc_main$j, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/slider/src/marker.vue"]]);
  21255. const useMarks = (props) => {
  21256. return computed(() => {
  21257. if (!props.marks) {
  21258. return [];
  21259. }
  21260. const marksKeys = Object.keys(props.marks);
  21261. return marksKeys.map(parseFloat).sort((a2, b2) => a2 - b2).filter((point) => point <= props.max && point >= props.min).map((point) => ({
  21262. point,
  21263. position: (point - props.min) * 100 / (props.max - props.min),
  21264. mark: props.marks[point]
  21265. }));
  21266. });
  21267. };
  21268. const useSlide = (props, initData, emit) => {
  21269. const elForm2 = inject(formContextKey, {});
  21270. const elFormItem2 = inject(formItemContextKey, {});
  21271. const slider = shallowRef(null);
  21272. const firstButton = ref(null);
  21273. const secondButton = ref(null);
  21274. const buttonRefs = {
  21275. firstButton,
  21276. secondButton
  21277. };
  21278. const sliderDisabled = computed(() => {
  21279. return props.disabled || elForm2.disabled || false;
  21280. });
  21281. const minValue = computed(() => {
  21282. return Math.min(initData.firstValue, initData.secondValue);
  21283. });
  21284. const maxValue = computed(() => {
  21285. return Math.max(initData.firstValue, initData.secondValue);
  21286. });
  21287. const barSize = computed(() => {
  21288. return props.range ? `${100 * (maxValue.value - minValue.value) / (props.max - props.min)}%` : `${100 * (initData.firstValue - props.min) / (props.max - props.min)}%`;
  21289. });
  21290. const barStart = computed(() => {
  21291. return props.range ? `${100 * (minValue.value - props.min) / (props.max - props.min)}%` : "0%";
  21292. });
  21293. const runwayStyle = computed(() => {
  21294. return props.vertical ? { height: props.height } : {};
  21295. });
  21296. const barStyle = computed(() => {
  21297. return props.vertical ? {
  21298. height: barSize.value,
  21299. bottom: barStart.value
  21300. } : {
  21301. width: barSize.value,
  21302. left: barStart.value
  21303. };
  21304. });
  21305. const resetSize = () => {
  21306. if (slider.value) {
  21307. initData.sliderSize = slider.value[`client${props.vertical ? "Height" : "Width"}`];
  21308. }
  21309. };
  21310. const setPosition = (percent) => {
  21311. const targetValue = props.min + percent * (props.max - props.min) / 100;
  21312. if (!props.range) {
  21313. firstButton.value.setPosition(percent);
  21314. return;
  21315. }
  21316. let buttonRefName;
  21317. if (Math.abs(minValue.value - targetValue) < Math.abs(maxValue.value - targetValue)) {
  21318. buttonRefName = initData.firstValue < initData.secondValue ? "firstButton" : "secondButton";
  21319. } else {
  21320. buttonRefName = initData.firstValue > initData.secondValue ? "firstButton" : "secondButton";
  21321. }
  21322. buttonRefs[buttonRefName].value.setPosition(percent);
  21323. };
  21324. const setFirstValue = (firstValue) => {
  21325. initData.firstValue = firstValue;
  21326. _emit(props.range ? [minValue.value, maxValue.value] : firstValue);
  21327. };
  21328. const setSecondValue = (secondValue) => {
  21329. initData.secondValue = secondValue;
  21330. if (props.range) {
  21331. _emit([minValue.value, maxValue.value]);
  21332. }
  21333. };
  21334. const _emit = (val) => {
  21335. emit(UPDATE_MODEL_EVENT, val);
  21336. emit(INPUT_EVENT, val);
  21337. };
  21338. const emitChange = async () => {
  21339. await nextTick();
  21340. emit(CHANGE_EVENT, props.range ? [minValue.value, maxValue.value] : props.modelValue);
  21341. };
  21342. const onSliderClick = (event) => {
  21343. if (sliderDisabled.value || initData.dragging)
  21344. return;
  21345. resetSize();
  21346. if (props.vertical) {
  21347. const sliderOffsetBottom = slider.value.getBoundingClientRect().bottom;
  21348. setPosition((sliderOffsetBottom - event.clientY) / initData.sliderSize * 100);
  21349. } else {
  21350. const sliderOffsetLeft = slider.value.getBoundingClientRect().left;
  21351. setPosition((event.clientX - sliderOffsetLeft) / initData.sliderSize * 100);
  21352. }
  21353. emitChange();
  21354. };
  21355. return {
  21356. elFormItem: elFormItem2,
  21357. slider,
  21358. firstButton,
  21359. secondButton,
  21360. sliderDisabled,
  21361. minValue,
  21362. maxValue,
  21363. runwayStyle,
  21364. barStyle,
  21365. resetSize,
  21366. setPosition,
  21367. emitChange,
  21368. onSliderClick,
  21369. setFirstValue,
  21370. setSecondValue
  21371. };
  21372. };
  21373. const useStops = (props, initData, minValue, maxValue) => {
  21374. const stops = computed(() => {
  21375. if (!props.showStops || props.min > props.max)
  21376. return [];
  21377. if (props.step === 0) {
  21378. return [];
  21379. }
  21380. const stopCount = (props.max - props.min) / props.step;
  21381. const stepWidth = 100 * props.step / (props.max - props.min);
  21382. const result = Array.from({ length: stopCount - 1 }).map((_2, index) => (index + 1) * stepWidth);
  21383. if (props.range) {
  21384. return result.filter((step) => {
  21385. return step < 100 * (minValue.value - props.min) / (props.max - props.min) || step > 100 * (maxValue.value - props.min) / (props.max - props.min);
  21386. });
  21387. } else {
  21388. return result.filter((step) => step > 100 * (initData.firstValue - props.min) / (props.max - props.min));
  21389. }
  21390. });
  21391. const getStopStyle = (position) => {
  21392. return props.vertical ? { bottom: `${position}%` } : { left: `${position}%` };
  21393. };
  21394. return {
  21395. stops,
  21396. getStopStyle
  21397. };
  21398. };
  21399. const _sfc_main$i = defineComponent({
  21400. name: "ElSlider",
  21401. components: {
  21402. ElInputNumber,
  21403. SliderButton,
  21404. SliderMarker
  21405. },
  21406. props: {
  21407. modelValue: {
  21408. type: [Number, Array],
  21409. default: 0
  21410. },
  21411. min: {
  21412. type: Number,
  21413. default: 0
  21414. },
  21415. max: {
  21416. type: Number,
  21417. default: 100
  21418. },
  21419. step: {
  21420. type: Number,
  21421. default: 1
  21422. },
  21423. showInput: {
  21424. type: Boolean,
  21425. default: false
  21426. },
  21427. showInputControls: {
  21428. type: Boolean,
  21429. default: true
  21430. },
  21431. size: {
  21432. type: String,
  21433. validator: isValidComponentSize
  21434. },
  21435. inputSize: {
  21436. type: String,
  21437. validator: isValidComponentSize
  21438. },
  21439. showStops: {
  21440. type: Boolean,
  21441. default: false
  21442. },
  21443. showTooltip: {
  21444. type: Boolean,
  21445. default: true
  21446. },
  21447. formatTooltip: {
  21448. type: Function,
  21449. default: void 0
  21450. },
  21451. disabled: {
  21452. type: Boolean,
  21453. default: false
  21454. },
  21455. range: {
  21456. type: Boolean,
  21457. default: false
  21458. },
  21459. vertical: {
  21460. type: Boolean,
  21461. default: false
  21462. },
  21463. height: {
  21464. type: String,
  21465. default: ""
  21466. },
  21467. debounce: {
  21468. type: Number,
  21469. default: 300
  21470. },
  21471. label: {
  21472. type: String,
  21473. default: void 0
  21474. },
  21475. tooltipClass: {
  21476. type: String,
  21477. default: void 0
  21478. },
  21479. marks: Object
  21480. },
  21481. emits: [UPDATE_MODEL_EVENT, CHANGE_EVENT, INPUT_EVENT],
  21482. setup(props, { emit }) {
  21483. const ns = useNamespace("slider");
  21484. const initData = reactive({
  21485. firstValue: 0,
  21486. secondValue: 0,
  21487. oldValue: 0,
  21488. dragging: false,
  21489. sliderSize: 1
  21490. });
  21491. const {
  21492. elFormItem: elFormItem2,
  21493. slider,
  21494. firstButton,
  21495. secondButton,
  21496. sliderDisabled,
  21497. minValue,
  21498. maxValue,
  21499. runwayStyle,
  21500. barStyle,
  21501. resetSize,
  21502. emitChange,
  21503. onSliderClick,
  21504. setFirstValue,
  21505. setSecondValue
  21506. } = useSlide(props, initData, emit);
  21507. const { stops, getStopStyle } = useStops(props, initData, minValue, maxValue);
  21508. const sliderWrapperSize = useSize();
  21509. const sliderInputSize = computed(() => props.inputSize || sliderWrapperSize.value);
  21510. const sliderKls = computed(() => [
  21511. ns.b(),
  21512. ns.m(sliderWrapperSize.value),
  21513. ns.is("vertical", props.vertical),
  21514. { [ns.m("with-input")]: props.showInput }
  21515. ]);
  21516. const markList = useMarks(props);
  21517. useWatch(props, initData, minValue, maxValue, emit, elFormItem2);
  21518. const precision = computed(() => {
  21519. const precisions = [props.min, props.max, props.step].map((item) => {
  21520. const decimal = `${item}`.split(".")[1];
  21521. return decimal ? decimal.length : 0;
  21522. });
  21523. return Math.max.apply(null, precisions);
  21524. });
  21525. const { sliderWrapper } = useLifecycle(props, initData, resetSize);
  21526. const { firstValue, secondValue, oldValue, dragging, sliderSize } = toRefs(initData);
  21527. const updateDragging = (val) => {
  21528. initData.dragging = val;
  21529. };
  21530. provide("SliderProvider", __spreadProps(__spreadValues({}, toRefs(props)), {
  21531. sliderSize,
  21532. disabled: sliderDisabled,
  21533. precision,
  21534. emitChange,
  21535. resetSize,
  21536. updateDragging
  21537. }));
  21538. return {
  21539. ns,
  21540. firstValue,
  21541. secondValue,
  21542. oldValue,
  21543. dragging,
  21544. sliderSize,
  21545. slider,
  21546. firstButton,
  21547. secondButton,
  21548. sliderDisabled,
  21549. runwayStyle,
  21550. barStyle,
  21551. emitChange,
  21552. onSliderClick,
  21553. getStopStyle,
  21554. setFirstValue,
  21555. setSecondValue,
  21556. stops,
  21557. markList,
  21558. sliderWrapper,
  21559. sliderWrapperSize,
  21560. sliderInputSize,
  21561. sliderKls
  21562. };
  21563. }
  21564. });
  21565. const useWatch = (props, initData, minValue, maxValue, emit, elFormItem2) => {
  21566. const _emit = (val) => {
  21567. emit(UPDATE_MODEL_EVENT, val);
  21568. emit(INPUT_EVENT, val);
  21569. };
  21570. const valueChanged = () => {
  21571. if (props.range) {
  21572. return ![minValue.value, maxValue.value].every((item, index) => item === initData.oldValue[index]);
  21573. } else {
  21574. return props.modelValue !== initData.oldValue;
  21575. }
  21576. };
  21577. const setValues = () => {
  21578. var _a2, _b2;
  21579. if (props.min > props.max) {
  21580. throwError("Slider", "min should not be greater than max.");
  21581. return;
  21582. }
  21583. const val = props.modelValue;
  21584. if (props.range && Array.isArray(val)) {
  21585. if (val[1] < props.min) {
  21586. _emit([props.min, props.min]);
  21587. } else if (val[0] > props.max) {
  21588. _emit([props.max, props.max]);
  21589. } else if (val[0] < props.min) {
  21590. _emit([props.min, val[1]]);
  21591. } else if (val[1] > props.max) {
  21592. _emit([val[0], props.max]);
  21593. } else {
  21594. initData.firstValue = val[0];
  21595. initData.secondValue = val[1];
  21596. if (valueChanged()) {
  21597. (_a2 = elFormItem2.validate) == null ? void 0 : _a2.call(elFormItem2, "change").catch((err) => debugWarn());
  21598. initData.oldValue = val.slice();
  21599. }
  21600. }
  21601. } else if (!props.range && typeof val === "number" && !Number.isNaN(val)) {
  21602. if (val < props.min) {
  21603. _emit(props.min);
  21604. } else if (val > props.max) {
  21605. _emit(props.max);
  21606. } else {
  21607. initData.firstValue = val;
  21608. if (valueChanged()) {
  21609. (_b2 = elFormItem2.validate) == null ? void 0 : _b2.call(elFormItem2, "change").catch((err) => debugWarn());
  21610. initData.oldValue = val;
  21611. }
  21612. }
  21613. }
  21614. };
  21615. setValues();
  21616. watch(() => initData.dragging, (val) => {
  21617. if (!val) {
  21618. setValues();
  21619. }
  21620. });
  21621. watch(() => props.modelValue, (val, oldVal) => {
  21622. if (initData.dragging || Array.isArray(val) && Array.isArray(oldVal) && val.every((item, index) => item === oldVal[index]) && initData.firstValue === val[0] && initData.secondValue === val[1]) {
  21623. return;
  21624. }
  21625. setValues();
  21626. }, {
  21627. deep: true
  21628. });
  21629. watch(() => [props.min, props.max], () => {
  21630. setValues();
  21631. });
  21632. };
  21633. const useLifecycle = (props, initData, resetSize) => {
  21634. const sliderWrapper = ref(null);
  21635. onMounted(async () => {
  21636. let valuetext;
  21637. if (props.range) {
  21638. if (Array.isArray(props.modelValue)) {
  21639. initData.firstValue = Math.max(props.min, props.modelValue[0]);
  21640. initData.secondValue = Math.min(props.max, props.modelValue[1]);
  21641. } else {
  21642. initData.firstValue = props.min;
  21643. initData.secondValue = props.max;
  21644. }
  21645. initData.oldValue = [initData.firstValue, initData.secondValue];
  21646. valuetext = `${initData.firstValue}-${initData.secondValue}`;
  21647. } else {
  21648. if (typeof props.modelValue !== "number" || Number.isNaN(props.modelValue)) {
  21649. initData.firstValue = props.min;
  21650. } else {
  21651. initData.firstValue = Math.min(props.max, Math.max(props.min, props.modelValue));
  21652. }
  21653. initData.oldValue = initData.firstValue;
  21654. valuetext = initData.firstValue;
  21655. }
  21656. sliderWrapper.value.setAttribute("aria-valuetext", valuetext);
  21657. sliderWrapper.value.setAttribute("aria-label", props.label ? props.label : `slider between ${props.min} and ${props.max}`);
  21658. on(window, "resize", resetSize);
  21659. await nextTick();
  21660. resetSize();
  21661. });
  21662. onBeforeUnmount(() => {
  21663. off(window, "resize", resetSize);
  21664. });
  21665. return {
  21666. sliderWrapper
  21667. };
  21668. };
  21669. const _hoisted_1$e = ["aria-valuemin", "aria-valuemax", "aria-orientation", "aria-disabled"];
  21670. const _hoisted_2$c = { key: 1 };
  21671. function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
  21672. const _component_slider_button = resolveComponent("slider-button");
  21673. const _component_slider_marker = resolveComponent("slider-marker");
  21674. const _component_el_input_number = resolveComponent("el-input-number");
  21675. return openBlock(), createElementBlock("div", {
  21676. ref: "sliderWrapper",
  21677. class: normalizeClass(_ctx.sliderKls),
  21678. role: "slider",
  21679. "aria-valuemin": _ctx.min,
  21680. "aria-valuemax": _ctx.max,
  21681. "aria-orientation": _ctx.vertical ? "vertical" : "horizontal",
  21682. "aria-disabled": _ctx.sliderDisabled
  21683. }, [
  21684. createElementVNode("div", {
  21685. ref: "slider",
  21686. class: normalizeClass([
  21687. _ctx.ns.e("runway"),
  21688. { "show-input": _ctx.showInput && !_ctx.range },
  21689. _ctx.ns.is("disabled", _ctx.sliderDisabled)
  21690. ]),
  21691. style: normalizeStyle(_ctx.runwayStyle),
  21692. onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onSliderClick && _ctx.onSliderClick(...args))
  21693. }, [
  21694. createElementVNode("div", {
  21695. class: normalizeClass(_ctx.ns.e("bar")),
  21696. style: normalizeStyle(_ctx.barStyle)
  21697. }, null, 6),
  21698. createVNode(_component_slider_button, {
  21699. ref: "firstButton",
  21700. "model-value": _ctx.firstValue,
  21701. vertical: _ctx.vertical,
  21702. "tooltip-class": _ctx.tooltipClass,
  21703. "onUpdate:modelValue": _ctx.setFirstValue
  21704. }, null, 8, ["model-value", "vertical", "tooltip-class", "onUpdate:modelValue"]),
  21705. _ctx.range ? (openBlock(), createBlock(_component_slider_button, {
  21706. key: 0,
  21707. ref: "secondButton",
  21708. "model-value": _ctx.secondValue,
  21709. vertical: _ctx.vertical,
  21710. "tooltip-class": _ctx.tooltipClass,
  21711. "onUpdate:modelValue": _ctx.setSecondValue
  21712. }, null, 8, ["model-value", "vertical", "tooltip-class", "onUpdate:modelValue"])) : createCommentVNode("v-if", true),
  21713. _ctx.showStops ? (openBlock(), createElementBlock("div", _hoisted_2$c, [
  21714. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.stops, (item, key) => {
  21715. return openBlock(), createElementBlock("div", {
  21716. key,
  21717. class: normalizeClass(_ctx.ns.e("stop")),
  21718. style: normalizeStyle(_ctx.getStopStyle(item))
  21719. }, null, 6);
  21720. }), 128))
  21721. ])) : createCommentVNode("v-if", true),
  21722. _ctx.markList.length > 0 ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
  21723. createElementVNode("div", null, [
  21724. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.markList, (item, key) => {
  21725. return openBlock(), createElementBlock("div", {
  21726. key,
  21727. style: normalizeStyle(_ctx.getStopStyle(item.position)),
  21728. class: normalizeClass([_ctx.ns.e("stop"), _ctx.ns.e("marks-stop")])
  21729. }, null, 6);
  21730. }), 128))
  21731. ]),
  21732. createElementVNode("div", {
  21733. class: normalizeClass(_ctx.ns.e("marks"))
  21734. }, [
  21735. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.markList, (item, key) => {
  21736. return openBlock(), createBlock(_component_slider_marker, {
  21737. key,
  21738. mark: item.mark,
  21739. style: normalizeStyle(_ctx.getStopStyle(item.position))
  21740. }, null, 8, ["mark", "style"]);
  21741. }), 128))
  21742. ], 2)
  21743. ], 64)) : createCommentVNode("v-if", true)
  21744. ], 6),
  21745. _ctx.showInput && !_ctx.range ? (openBlock(), createBlock(_component_el_input_number, {
  21746. key: 0,
  21747. ref: "input",
  21748. "model-value": _ctx.firstValue,
  21749. class: normalizeClass(_ctx.ns.e("input")),
  21750. step: _ctx.step,
  21751. disabled: _ctx.sliderDisabled,
  21752. controls: _ctx.showInputControls,
  21753. min: _ctx.min,
  21754. max: _ctx.max,
  21755. debounce: _ctx.debounce,
  21756. size: _ctx.sliderInputSize,
  21757. "onUpdate:modelValue": _ctx.setFirstValue,
  21758. onChange: _ctx.emitChange
  21759. }, null, 8, ["model-value", "class", "step", "disabled", "controls", "min", "max", "debounce", "size", "onUpdate:modelValue", "onChange"])) : createCommentVNode("v-if", true)
  21760. ], 10, _hoisted_1$e);
  21761. }
  21762. var Slider = /* @__PURE__ */ _export_sfc$1(_sfc_main$i, [["render", _sfc_render$6], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/slider/src/index.vue"]]);
  21763. Slider.install = (app) => {
  21764. app.component(Slider.name, Slider);
  21765. };
  21766. const _Slider = Slider;
  21767. const ElSlider = _Slider;
  21768. const spaceItem = buildProps({
  21769. prefixCls: {
  21770. type: String,
  21771. default: ""
  21772. }
  21773. });
  21774. const _sfc_main$h = defineComponent({
  21775. props: spaceItem,
  21776. setup(props) {
  21777. const ns = useNamespace("space");
  21778. const classes = computed(() => `${props.prefixCls || ns.b()}__item`);
  21779. return {
  21780. classes
  21781. };
  21782. }
  21783. });
  21784. function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
  21785. return openBlock(), createElementBlock("div", {
  21786. class: normalizeClass(_ctx.classes)
  21787. }, [
  21788. renderSlot(_ctx.$slots, "default")
  21789. ], 2);
  21790. }
  21791. var Item = /* @__PURE__ */ _export_sfc$1(_sfc_main$h, [["render", _sfc_render$5], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/space/src/item.vue"]]);
  21792. const SIZE_MAP = {
  21793. small: 8,
  21794. default: 12,
  21795. large: 16
  21796. };
  21797. function useSpace(props) {
  21798. const ns = useNamespace("space");
  21799. const classes = computed(() => [ns.b(), ns.m(props.direction), props.class]);
  21800. const horizontalSize = ref(0);
  21801. const verticalSize = ref(0);
  21802. const containerStyle = computed(() => {
  21803. const wrapKls = props.wrap || props.fill ? { flexWrap: "wrap", marginBottom: `-${verticalSize.value}px` } : {};
  21804. const alignment = {
  21805. alignItems: props.alignment
  21806. };
  21807. return [wrapKls, alignment, props.style];
  21808. });
  21809. const itemStyle = computed(() => {
  21810. const itemBaseStyle = {
  21811. paddingBottom: `${verticalSize.value}px`,
  21812. marginRight: `${horizontalSize.value}px`
  21813. };
  21814. const fillStyle = props.fill ? { flexGrow: 1, minWidth: `${props.fillRatio}%` } : {};
  21815. return [itemBaseStyle, fillStyle];
  21816. });
  21817. watchEffect(() => {
  21818. const { size = "small", wrap, direction: dir, fill } = props;
  21819. if (Array.isArray(size)) {
  21820. const [h2 = 0, v2 = 0] = size;
  21821. horizontalSize.value = h2;
  21822. verticalSize.value = v2;
  21823. } else {
  21824. let val;
  21825. if (isNumber(size)) {
  21826. val = size;
  21827. } else {
  21828. val = SIZE_MAP[size] || SIZE_MAP.small;
  21829. }
  21830. if ((wrap || fill) && dir === "horizontal") {
  21831. horizontalSize.value = verticalSize.value = val;
  21832. } else {
  21833. if (dir === "horizontal") {
  21834. horizontalSize.value = val;
  21835. verticalSize.value = 0;
  21836. } else {
  21837. verticalSize.value = val;
  21838. horizontalSize.value = 0;
  21839. }
  21840. }
  21841. }
  21842. });
  21843. return {
  21844. classes,
  21845. containerStyle,
  21846. itemStyle
  21847. };
  21848. }
  21849. const spaceProps = buildProps({
  21850. direction: {
  21851. type: String,
  21852. values: ["horizontal", "vertical"],
  21853. default: "horizontal"
  21854. },
  21855. class: {
  21856. type: definePropType([
  21857. String,
  21858. Object,
  21859. Array
  21860. ]),
  21861. default: ""
  21862. },
  21863. style: {
  21864. type: definePropType([String, Array, Object]),
  21865. default: ""
  21866. },
  21867. alignment: {
  21868. type: definePropType(String),
  21869. default: "center"
  21870. },
  21871. prefixCls: {
  21872. type: String
  21873. },
  21874. spacer: {
  21875. type: definePropType([Object, String, Number, Array]),
  21876. default: null,
  21877. validator: (val) => isVNode(val) || isNumber(val) || isString(val)
  21878. },
  21879. wrap: {
  21880. type: Boolean,
  21881. default: false
  21882. },
  21883. fill: {
  21884. type: Boolean,
  21885. default: false
  21886. },
  21887. fillRatio: {
  21888. type: Number,
  21889. default: 100
  21890. },
  21891. size: {
  21892. type: [String, Array, Number],
  21893. values: componentSizes,
  21894. validator: (val) => {
  21895. return isNumber(val) || isArray(val) && val.length === 2 && val.every((i) => isNumber(i));
  21896. }
  21897. }
  21898. });
  21899. var Space = defineComponent({
  21900. name: "ElSpace",
  21901. props: spaceProps,
  21902. setup(props, { slots }) {
  21903. const { classes, containerStyle, itemStyle } = useSpace(props);
  21904. return () => {
  21905. var _a2;
  21906. const { spacer, prefixCls, direction } = props;
  21907. const children = renderSlot(slots, "default", { key: 0 }, () => []);
  21908. if (((_a2 = children.children) != null ? _a2 : []).length === 0)
  21909. return null;
  21910. if (isArray(children.children)) {
  21911. let extractedChildren = [];
  21912. children.children.forEach((child, loopKey) => {
  21913. if (isFragment(child)) {
  21914. if (isArray(child.children)) {
  21915. child.children.forEach((nested, key) => {
  21916. extractedChildren.push(createVNode(Item, {
  21917. style: itemStyle.value,
  21918. prefixCls,
  21919. key: `nested-${key}`
  21920. }, {
  21921. default: () => [nested]
  21922. }, PatchFlags.PROPS | PatchFlags.STYLE, ["style", "prefixCls"]));
  21923. });
  21924. }
  21925. } else if (isValidElementNode(child)) {
  21926. extractedChildren.push(createVNode(Item, {
  21927. style: itemStyle.value,
  21928. prefixCls,
  21929. key: `LoopKey${loopKey}`
  21930. }, {
  21931. default: () => [child]
  21932. }, PatchFlags.PROPS | PatchFlags.STYLE, ["style", "prefixCls"]));
  21933. }
  21934. });
  21935. if (spacer) {
  21936. const len = extractedChildren.length - 1;
  21937. extractedChildren = extractedChildren.reduce((acc, child, idx) => {
  21938. const children2 = [...acc, child];
  21939. if (idx !== len) {
  21940. children2.push(createVNode("span", {
  21941. style: [
  21942. itemStyle.value,
  21943. direction === "vertical" ? "width: 100%" : null
  21944. ],
  21945. key: idx
  21946. }, [
  21947. isVNode(spacer) ? spacer : createTextVNode(spacer, PatchFlags.TEXT)
  21948. ], PatchFlags.STYLE));
  21949. }
  21950. return children2;
  21951. }, []);
  21952. }
  21953. return createVNode("div", {
  21954. class: classes.value,
  21955. style: containerStyle.value
  21956. }, extractedChildren, PatchFlags.STYLE | PatchFlags.CLASS);
  21957. }
  21958. return children.children;
  21959. };
  21960. }
  21961. });
  21962. const ElSpace = withInstall(Space);
  21963. const switchProps = buildProps({
  21964. modelValue: {
  21965. type: [Boolean, String, Number],
  21966. default: false
  21967. },
  21968. value: {
  21969. type: [Boolean, String, Number],
  21970. default: false
  21971. },
  21972. disabled: {
  21973. type: Boolean,
  21974. default: false
  21975. },
  21976. width: {
  21977. type: Number,
  21978. default: 40
  21979. },
  21980. inlinePrompt: {
  21981. type: Boolean,
  21982. default: false
  21983. },
  21984. activeIcon: {
  21985. type: iconPropType,
  21986. default: ""
  21987. },
  21988. inactiveIcon: {
  21989. type: iconPropType,
  21990. default: ""
  21991. },
  21992. activeText: {
  21993. type: String,
  21994. default: ""
  21995. },
  21996. inactiveText: {
  21997. type: String,
  21998. default: ""
  21999. },
  22000. activeColor: {
  22001. type: String,
  22002. default: ""
  22003. },
  22004. inactiveColor: {
  22005. type: String,
  22006. default: ""
  22007. },
  22008. borderColor: {
  22009. type: String,
  22010. default: ""
  22011. },
  22012. activeValue: {
  22013. type: [Boolean, String, Number],
  22014. default: true
  22015. },
  22016. inactiveValue: {
  22017. type: [Boolean, String, Number],
  22018. default: false
  22019. },
  22020. name: {
  22021. type: String,
  22022. default: ""
  22023. },
  22024. validateEvent: {
  22025. type: Boolean,
  22026. default: true
  22027. },
  22028. id: String,
  22029. loading: {
  22030. type: Boolean,
  22031. default: false
  22032. },
  22033. beforeChange: {
  22034. type: definePropType(Function)
  22035. },
  22036. size: {
  22037. type: String,
  22038. validator: isValidComponentSize
  22039. }
  22040. });
  22041. const switchEmits = {
  22042. [UPDATE_MODEL_EVENT]: (val) => isBoolean(val) || isString(val) || isNumber(val),
  22043. [CHANGE_EVENT]: (val) => isBoolean(val) || isString(val) || isNumber(val),
  22044. [INPUT_EVENT]: (val) => isBoolean(val) || isString(val) || isNumber(val)
  22045. };
  22046. const COMPONENT_NAME = "ElSwitch";
  22047. const _sfc_main$g = defineComponent({
  22048. name: COMPONENT_NAME,
  22049. components: { ElIcon, Loading: loading },
  22050. props: switchProps,
  22051. emits: switchEmits,
  22052. setup(props, { emit }) {
  22053. const { formItem } = useFormItem();
  22054. const switchDisabled = useDisabled$1(computed(() => props.loading));
  22055. const ns = useNamespace("switch");
  22056. const switchSize = useSize();
  22057. const isModelValue = ref(props.modelValue !== false);
  22058. const input = ref();
  22059. const core = ref();
  22060. const switchKls = computed(() => [
  22061. ns.b(),
  22062. ns.m(switchSize.value),
  22063. ns.is("disabled", switchDisabled.value),
  22064. ns.is("checked", checked.value)
  22065. ]);
  22066. watch(() => props.modelValue, () => {
  22067. isModelValue.value = true;
  22068. });
  22069. watch(() => props.value, () => {
  22070. isModelValue.value = false;
  22071. });
  22072. const actualValue = computed(() => {
  22073. return isModelValue.value ? props.modelValue : props.value;
  22074. });
  22075. const checked = computed(() => actualValue.value === props.activeValue);
  22076. if (![props.activeValue, props.inactiveValue].includes(actualValue.value)) {
  22077. emit(UPDATE_MODEL_EVENT, props.inactiveValue);
  22078. emit(CHANGE_EVENT, props.inactiveValue);
  22079. emit(INPUT_EVENT, props.inactiveValue);
  22080. }
  22081. watch(checked, () => {
  22082. var _a2;
  22083. input.value.checked = checked.value;
  22084. if (props.activeColor || props.inactiveColor) {
  22085. setBackgroundColor();
  22086. }
  22087. if (props.validateEvent) {
  22088. (_a2 = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a2.call(formItem, "change").catch((err) => debugWarn());
  22089. }
  22090. });
  22091. const handleChange2 = () => {
  22092. const val = checked.value ? props.inactiveValue : props.activeValue;
  22093. emit(UPDATE_MODEL_EVENT, val);
  22094. emit(CHANGE_EVENT, val);
  22095. emit(INPUT_EVENT, val);
  22096. nextTick(() => {
  22097. input.value.checked = checked.value;
  22098. });
  22099. };
  22100. const switchValue = () => {
  22101. if (switchDisabled.value)
  22102. return;
  22103. const { beforeChange } = props;
  22104. if (!beforeChange) {
  22105. handleChange2();
  22106. return;
  22107. }
  22108. const shouldChange = beforeChange();
  22109. const isExpectType = [
  22110. isPromise(shouldChange),
  22111. isBoolean(shouldChange)
  22112. ].some((i) => i);
  22113. if (!isExpectType) {
  22114. throwError(COMPONENT_NAME, "beforeChange must return type `Promise<boolean>` or `boolean`");
  22115. }
  22116. if (isPromise(shouldChange)) {
  22117. shouldChange.then((result) => {
  22118. if (result) {
  22119. handleChange2();
  22120. }
  22121. }).catch((e) => {
  22122. });
  22123. } else if (shouldChange) {
  22124. handleChange2();
  22125. }
  22126. };
  22127. const setBackgroundColor = () => {
  22128. const newColor = checked.value ? props.activeColor : props.inactiveColor;
  22129. const coreEl = core.value;
  22130. if (props.borderColor)
  22131. coreEl.style.borderColor = props.borderColor;
  22132. else if (!props.borderColor)
  22133. coreEl.style.borderColor = newColor;
  22134. coreEl.style.backgroundColor = newColor;
  22135. coreEl.children[0].style.color = newColor;
  22136. };
  22137. const focus = () => {
  22138. var _a2, _b2;
  22139. (_b2 = (_a2 = input.value) == null ? void 0 : _a2.focus) == null ? void 0 : _b2.call(_a2);
  22140. };
  22141. onMounted(() => {
  22142. if (props.activeColor || props.inactiveColor || props.borderColor) {
  22143. setBackgroundColor();
  22144. }
  22145. input.value.checked = checked.value;
  22146. });
  22147. return {
  22148. ns,
  22149. input,
  22150. core,
  22151. switchDisabled,
  22152. checked,
  22153. switchKls,
  22154. handleChange: handleChange2,
  22155. switchValue,
  22156. focus
  22157. };
  22158. }
  22159. });
  22160. const _hoisted_1$d = ["aria-checked", "aria-disabled"];
  22161. const _hoisted_2$b = ["id", "name", "true-value", "false-value", "disabled"];
  22162. const _hoisted_3$8 = ["aria-hidden"];
  22163. const _hoisted_4$7 = ["aria-hidden"];
  22164. const _hoisted_5$7 = ["aria-hidden"];
  22165. const _hoisted_6$6 = ["aria-hidden"];
  22166. function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
  22167. const _component_el_icon = resolveComponent("el-icon");
  22168. const _component_loading = resolveComponent("loading");
  22169. return openBlock(), createElementBlock("div", {
  22170. class: normalizeClass(_ctx.switchKls),
  22171. role: "switch",
  22172. "aria-checked": _ctx.checked,
  22173. "aria-disabled": _ctx.switchDisabled,
  22174. onClick: _cache[2] || (_cache[2] = withModifiers((...args) => _ctx.switchValue && _ctx.switchValue(...args), ["prevent"]))
  22175. }, [
  22176. createElementVNode("input", {
  22177. id: _ctx.id,
  22178. ref: "input",
  22179. class: normalizeClass(_ctx.ns.e("input")),
  22180. type: "checkbox",
  22181. name: _ctx.name,
  22182. "true-value": _ctx.activeValue,
  22183. "false-value": _ctx.inactiveValue,
  22184. disabled: _ctx.switchDisabled,
  22185. onChange: _cache[0] || (_cache[0] = (...args) => _ctx.handleChange && _ctx.handleChange(...args)),
  22186. onKeydown: _cache[1] || (_cache[1] = withKeys((...args) => _ctx.switchValue && _ctx.switchValue(...args), ["enter"]))
  22187. }, null, 42, _hoisted_2$b),
  22188. !_ctx.inlinePrompt && (_ctx.inactiveIcon || _ctx.inactiveText) ? (openBlock(), createElementBlock("span", {
  22189. key: 0,
  22190. class: normalizeClass([
  22191. _ctx.ns.e("label"),
  22192. _ctx.ns.em("label", "left"),
  22193. _ctx.ns.is("active", !_ctx.checked)
  22194. ])
  22195. }, [
  22196. _ctx.inactiveIcon ? (openBlock(), createBlock(_component_el_icon, { key: 0 }, {
  22197. default: withCtx(() => [
  22198. (openBlock(), createBlock(resolveDynamicComponent(_ctx.inactiveIcon)))
  22199. ]),
  22200. _: 1
  22201. })) : createCommentVNode("v-if", true),
  22202. !_ctx.inactiveIcon && _ctx.inactiveText ? (openBlock(), createElementBlock("span", {
  22203. key: 1,
  22204. "aria-hidden": _ctx.checked
  22205. }, toDisplayString(_ctx.inactiveText), 9, _hoisted_3$8)) : createCommentVNode("v-if", true)
  22206. ], 2)) : createCommentVNode("v-if", true),
  22207. createElementVNode("span", {
  22208. ref: "core",
  22209. class: normalizeClass(_ctx.ns.e("core")),
  22210. style: normalizeStyle({ width: (_ctx.width || 40) + "px" })
  22211. }, [
  22212. _ctx.inlinePrompt ? (openBlock(), createElementBlock("div", {
  22213. key: 0,
  22214. class: normalizeClass(_ctx.ns.e("inner"))
  22215. }, [
  22216. _ctx.activeIcon || _ctx.inactiveIcon ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  22217. _ctx.activeIcon ? (openBlock(), createBlock(_component_el_icon, {
  22218. key: 0,
  22219. class: normalizeClass([_ctx.ns.is("icon"), _ctx.checked ? _ctx.ns.is("show") : _ctx.ns.is("hide")])
  22220. }, {
  22221. default: withCtx(() => [
  22222. (openBlock(), createBlock(resolveDynamicComponent(_ctx.activeIcon)))
  22223. ]),
  22224. _: 1
  22225. }, 8, ["class"])) : createCommentVNode("v-if", true),
  22226. _ctx.inactiveIcon ? (openBlock(), createBlock(_component_el_icon, {
  22227. key: 1,
  22228. class: normalizeClass([_ctx.ns.is("icon"), !_ctx.checked ? _ctx.ns.is("show") : _ctx.ns.is("hide")])
  22229. }, {
  22230. default: withCtx(() => [
  22231. (openBlock(), createBlock(resolveDynamicComponent(_ctx.inactiveIcon)))
  22232. ]),
  22233. _: 1
  22234. }, 8, ["class"])) : createCommentVNode("v-if", true)
  22235. ], 64)) : _ctx.activeText || _ctx.inactiveIcon ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  22236. _ctx.activeText ? (openBlock(), createElementBlock("span", {
  22237. key: 0,
  22238. class: normalizeClass([_ctx.ns.is("text"), _ctx.checked ? _ctx.ns.is("show") : _ctx.ns.is("hide")]),
  22239. "aria-hidden": !_ctx.checked
  22240. }, toDisplayString(_ctx.activeText.substring(0, 3)), 11, _hoisted_4$7)) : createCommentVNode("v-if", true),
  22241. _ctx.inactiveText ? (openBlock(), createElementBlock("span", {
  22242. key: 1,
  22243. class: normalizeClass([_ctx.ns.is("text"), !_ctx.checked ? _ctx.ns.is("show") : _ctx.ns.is("hide")]),
  22244. "aria-hidden": _ctx.checked
  22245. }, toDisplayString(_ctx.inactiveText.substring(0, 3)), 11, _hoisted_5$7)) : createCommentVNode("v-if", true)
  22246. ], 64)) : createCommentVNode("v-if", true)
  22247. ], 2)) : createCommentVNode("v-if", true),
  22248. createElementVNode("div", {
  22249. class: normalizeClass(_ctx.ns.e("action"))
  22250. }, [
  22251. _ctx.loading ? (openBlock(), createBlock(_component_el_icon, {
  22252. key: 0,
  22253. class: normalizeClass(_ctx.ns.is("loading"))
  22254. }, {
  22255. default: withCtx(() => [
  22256. createVNode(_component_loading)
  22257. ]),
  22258. _: 1
  22259. }, 8, ["class"])) : createCommentVNode("v-if", true)
  22260. ], 2)
  22261. ], 6),
  22262. !_ctx.inlinePrompt && (_ctx.activeIcon || _ctx.activeText) ? (openBlock(), createElementBlock("span", {
  22263. key: 1,
  22264. class: normalizeClass([
  22265. _ctx.ns.e("label"),
  22266. _ctx.ns.em("label", "right"),
  22267. _ctx.ns.is("active", _ctx.checked)
  22268. ])
  22269. }, [
  22270. _ctx.activeIcon ? (openBlock(), createBlock(_component_el_icon, { key: 0 }, {
  22271. default: withCtx(() => [
  22272. (openBlock(), createBlock(resolveDynamicComponent(_ctx.activeIcon)))
  22273. ]),
  22274. _: 1
  22275. })) : createCommentVNode("v-if", true),
  22276. !_ctx.activeIcon && _ctx.activeText ? (openBlock(), createElementBlock("span", {
  22277. key: 1,
  22278. "aria-hidden": !_ctx.checked
  22279. }, toDisplayString(_ctx.activeText), 9, _hoisted_6$6)) : createCommentVNode("v-if", true)
  22280. ], 2)) : createCommentVNode("v-if", true)
  22281. ], 10, _hoisted_1$d);
  22282. }
  22283. var Switch = /* @__PURE__ */ _export_sfc$1(_sfc_main$g, [["render", _sfc_render$4], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/switch/src/switch.vue"]]);
  22284. const ElSwitch = withInstall(Switch);
  22285. /*!
  22286. * escape-html
  22287. * Copyright(c) 2012-2013 TJ Holowaychuk
  22288. * Copyright(c) 2015 Andreas Lubbe
  22289. * Copyright(c) 2015 Tiancheng "Timothy" Gu
  22290. * MIT Licensed
  22291. */
  22292. var matchHtmlRegExp = /["'&<>]/;
  22293. var escapeHtml_1 = escapeHtml;
  22294. function escapeHtml(string3) {
  22295. var str = "" + string3;
  22296. var match = matchHtmlRegExp.exec(str);
  22297. if (!match) {
  22298. return str;
  22299. }
  22300. var escape;
  22301. var html = "";
  22302. var index = 0;
  22303. var lastIndex = 0;
  22304. for (index = match.index; index < str.length; index++) {
  22305. switch (str.charCodeAt(index)) {
  22306. case 34:
  22307. escape = "&quot;";
  22308. break;
  22309. case 38:
  22310. escape = "&amp;";
  22311. break;
  22312. case 39:
  22313. escape = "&#39;";
  22314. break;
  22315. case 60:
  22316. escape = "&lt;";
  22317. break;
  22318. case 62:
  22319. escape = "&gt;";
  22320. break;
  22321. default:
  22322. continue;
  22323. }
  22324. if (lastIndex !== index) {
  22325. html += str.substring(lastIndex, index);
  22326. }
  22327. lastIndex = index + 1;
  22328. html += escape;
  22329. }
  22330. return lastIndex !== index ? html + str.substring(lastIndex, index) : html;
  22331. }
  22332. const getCell = function(event) {
  22333. let cell = event.target;
  22334. while (cell && cell.tagName.toUpperCase() !== "HTML") {
  22335. if (cell.tagName.toUpperCase() === "TD") {
  22336. return cell;
  22337. }
  22338. cell = cell.parentNode;
  22339. }
  22340. return null;
  22341. };
  22342. const isObject = function(obj) {
  22343. return obj !== null && typeof obj === "object";
  22344. };
  22345. const orderBy = function(array4, sortKey, reverse, sortMethod, sortBy) {
  22346. if (!sortKey && !sortMethod && (!sortBy || Array.isArray(sortBy) && !sortBy.length)) {
  22347. return array4;
  22348. }
  22349. if (typeof reverse === "string") {
  22350. reverse = reverse === "descending" ? -1 : 1;
  22351. } else {
  22352. reverse = reverse && reverse < 0 ? -1 : 1;
  22353. }
  22354. const getKey = sortMethod ? null : function(value, index) {
  22355. if (sortBy) {
  22356. if (!Array.isArray(sortBy)) {
  22357. sortBy = [sortBy];
  22358. }
  22359. return sortBy.map((by) => {
  22360. if (typeof by === "string") {
  22361. return get(value, by);
  22362. } else {
  22363. return by(value, index, array4);
  22364. }
  22365. });
  22366. }
  22367. if (sortKey !== "$key") {
  22368. if (isObject(value) && "$value" in value)
  22369. value = value.$value;
  22370. }
  22371. return [isObject(value) ? get(value, sortKey) : value];
  22372. };
  22373. const compare = function(a2, b2) {
  22374. if (sortMethod) {
  22375. return sortMethod(a2.value, b2.value);
  22376. }
  22377. for (let i = 0, len = a2.key.length; i < len; i++) {
  22378. if (a2.key[i] < b2.key[i]) {
  22379. return -1;
  22380. }
  22381. if (a2.key[i] > b2.key[i]) {
  22382. return 1;
  22383. }
  22384. }
  22385. return 0;
  22386. };
  22387. return array4.map((value, index) => {
  22388. return {
  22389. value,
  22390. index,
  22391. key: getKey ? getKey(value, index) : null
  22392. };
  22393. }).sort((a2, b2) => {
  22394. let order2 = compare(a2, b2);
  22395. if (!order2) {
  22396. order2 = a2.index - b2.index;
  22397. }
  22398. return order2 * +reverse;
  22399. }).map((item) => item.value);
  22400. };
  22401. const getColumnById = function(table, columnId) {
  22402. let column = null;
  22403. table.columns.forEach((item) => {
  22404. if (item.id === columnId) {
  22405. column = item;
  22406. }
  22407. });
  22408. return column;
  22409. };
  22410. const getColumnByKey = function(table, columnKey) {
  22411. let column = null;
  22412. for (let i = 0; i < table.columns.length; i++) {
  22413. const item = table.columns[i];
  22414. if (item.columnKey === columnKey) {
  22415. column = item;
  22416. break;
  22417. }
  22418. }
  22419. return column;
  22420. };
  22421. const getColumnByCell = function(table, cell, namespace) {
  22422. const matches = (cell.className || "").match(new RegExp(`${namespace}-table_[^\\s]+`, "gm"));
  22423. if (matches) {
  22424. return getColumnById(table, matches[0]);
  22425. }
  22426. return null;
  22427. };
  22428. const getRowIdentity = (row, rowKey) => {
  22429. if (!row)
  22430. throw new Error("Row is required when get row identity");
  22431. if (typeof rowKey === "string") {
  22432. if (!rowKey.includes(".")) {
  22433. return `${row[rowKey]}`;
  22434. }
  22435. const key = rowKey.split(".");
  22436. let current = row;
  22437. for (const element of key) {
  22438. current = current[element];
  22439. }
  22440. return `${current}`;
  22441. } else if (typeof rowKey === "function") {
  22442. return rowKey.call(null, row);
  22443. }
  22444. };
  22445. const getKeysMap = function(array4, rowKey) {
  22446. const arrayMap2 = {};
  22447. (array4 || []).forEach((row, index) => {
  22448. arrayMap2[getRowIdentity(row, rowKey)] = { row, index };
  22449. });
  22450. return arrayMap2;
  22451. };
  22452. function mergeOptions(defaults, config) {
  22453. const options = {};
  22454. let key;
  22455. for (key in defaults) {
  22456. options[key] = defaults[key];
  22457. }
  22458. for (key in config) {
  22459. if (hasOwn(config, key)) {
  22460. const value = config[key];
  22461. if (typeof value !== "undefined") {
  22462. options[key] = value;
  22463. }
  22464. }
  22465. }
  22466. return options;
  22467. }
  22468. function parseWidth(width) {
  22469. if (width === "")
  22470. return width;
  22471. if (width !== void 0) {
  22472. width = Number.parseInt(width, 10);
  22473. if (Number.isNaN(width)) {
  22474. width = "";
  22475. }
  22476. }
  22477. return width;
  22478. }
  22479. function parseMinWidth(minWidth) {
  22480. if (minWidth === "")
  22481. return minWidth;
  22482. if (minWidth !== void 0) {
  22483. minWidth = parseWidth(minWidth);
  22484. if (Number.isNaN(minWidth)) {
  22485. minWidth = 80;
  22486. }
  22487. }
  22488. return minWidth;
  22489. }
  22490. function parseHeight(height) {
  22491. if (typeof height === "number") {
  22492. return height;
  22493. }
  22494. if (typeof height === "string") {
  22495. if (/^\d+(?:px)?$/.test(height)) {
  22496. return Number.parseInt(height, 10);
  22497. } else {
  22498. return height;
  22499. }
  22500. }
  22501. return null;
  22502. }
  22503. function compose(...funcs) {
  22504. if (funcs.length === 0) {
  22505. return (arg) => arg;
  22506. }
  22507. if (funcs.length === 1) {
  22508. return funcs[0];
  22509. }
  22510. return funcs.reduce((a2, b2) => (...args) => a2(b2(...args)));
  22511. }
  22512. function toggleRowStatus(statusArr, row, newVal) {
  22513. let changed = false;
  22514. const index = statusArr.indexOf(row);
  22515. const included = index !== -1;
  22516. const addRow = () => {
  22517. statusArr.push(row);
  22518. changed = true;
  22519. };
  22520. const removeRow = () => {
  22521. statusArr.splice(index, 1);
  22522. changed = true;
  22523. };
  22524. if (typeof newVal === "boolean") {
  22525. if (newVal && !included) {
  22526. addRow();
  22527. } else if (!newVal && included) {
  22528. removeRow();
  22529. }
  22530. } else {
  22531. if (included) {
  22532. removeRow();
  22533. } else {
  22534. addRow();
  22535. }
  22536. }
  22537. return changed;
  22538. }
  22539. function walkTreeNode(root2, cb, childrenKey = "children", lazyKey = "hasChildren") {
  22540. const isNil2 = (array4) => !(Array.isArray(array4) && array4.length);
  22541. function _walker(parent, children, level) {
  22542. cb(parent, children, level);
  22543. children.forEach((item) => {
  22544. if (item[lazyKey]) {
  22545. cb(item, null, level + 1);
  22546. return;
  22547. }
  22548. const children2 = item[childrenKey];
  22549. if (!isNil2(children2)) {
  22550. _walker(item, children2, level + 1);
  22551. }
  22552. });
  22553. }
  22554. root2.forEach((item) => {
  22555. if (item[lazyKey]) {
  22556. cb(item, null, 0);
  22557. return;
  22558. }
  22559. const children = item[childrenKey];
  22560. if (!isNil2(children)) {
  22561. _walker(item, children, 0);
  22562. }
  22563. });
  22564. }
  22565. let removePopper;
  22566. function createTablePopper(trigger, popperContent, popperOptions2, tooltipEffect) {
  22567. const { nextZIndex } = useZIndex();
  22568. function renderContent() {
  22569. const isLight = tooltipEffect === "light";
  22570. const content22 = document.createElement("div");
  22571. content22.className = `el-popper ${isLight ? "is-light" : "is-dark"}`;
  22572. popperContent = escapeHtml_1(popperContent);
  22573. content22.innerHTML = popperContent;
  22574. content22.style.zIndex = String(nextZIndex());
  22575. document.body.appendChild(content22);
  22576. return content22;
  22577. }
  22578. function renderArrow() {
  22579. const arrow22 = document.createElement("div");
  22580. arrow22.className = "el-popper__arrow";
  22581. return arrow22;
  22582. }
  22583. function showPopper() {
  22584. popperInstance && popperInstance.update();
  22585. }
  22586. removePopper = function removePopper2() {
  22587. try {
  22588. popperInstance && popperInstance.destroy();
  22589. content2 && document.body.removeChild(content2);
  22590. off(trigger, "mouseenter", showPopper);
  22591. off(trigger, "mouseleave", removePopper2);
  22592. } catch (e) {
  22593. }
  22594. };
  22595. let popperInstance = null;
  22596. const content2 = renderContent();
  22597. const arrow2 = renderArrow();
  22598. content2.appendChild(arrow2);
  22599. popperInstance = createPopper(trigger, content2, __spreadValues({
  22600. modifiers: [
  22601. {
  22602. name: "offset",
  22603. options: {
  22604. offset: [0, 8]
  22605. }
  22606. },
  22607. {
  22608. name: "arrow",
  22609. options: {
  22610. element: arrow2,
  22611. padding: 10
  22612. }
  22613. }
  22614. ]
  22615. }, popperOptions2));
  22616. on(trigger, "mouseenter", showPopper);
  22617. on(trigger, "mouseleave", removePopper);
  22618. return popperInstance;
  22619. }
  22620. const isFixedColumn = (index, fixed, store, realColumns) => {
  22621. let start2 = 0;
  22622. let after = index;
  22623. if (realColumns) {
  22624. if (realColumns[index].colSpan > 1) {
  22625. return {};
  22626. }
  22627. for (let i = 0; i < index; i++) {
  22628. start2 += realColumns[i].colSpan;
  22629. }
  22630. after = start2 + realColumns[index].colSpan - 1;
  22631. } else {
  22632. start2 = index;
  22633. }
  22634. let fixedLayout;
  22635. const columns = store.states.columns;
  22636. switch (fixed) {
  22637. case "left":
  22638. if (after < store.states.fixedLeafColumnsLength.value) {
  22639. fixedLayout = "left";
  22640. }
  22641. break;
  22642. case "right":
  22643. if (start2 >= columns.value.length - store.states.rightFixedLeafColumnsLength.value) {
  22644. fixedLayout = "right";
  22645. }
  22646. break;
  22647. default:
  22648. if (after < store.states.fixedLeafColumnsLength.value) {
  22649. fixedLayout = "left";
  22650. } else if (start2 >= columns.value.length - store.states.rightFixedLeafColumnsLength.value) {
  22651. fixedLayout = "right";
  22652. }
  22653. }
  22654. return fixedLayout ? {
  22655. direction: fixedLayout,
  22656. start: start2,
  22657. after
  22658. } : {};
  22659. };
  22660. const getFixedColumnsClass = (namespace, index, fixed, store, realColumns) => {
  22661. const classes = [];
  22662. const { direction, start: start2 } = isFixedColumn(index, fixed, store, realColumns);
  22663. if (direction) {
  22664. const isLeft = direction === "left";
  22665. classes.push(`${namespace}-fixed-column--${direction}`);
  22666. if (isLeft && start2 === store.states.fixedLeafColumnsLength.value - 1) {
  22667. classes.push("is-last-column");
  22668. } else if (!isLeft && start2 === store.states.columns.value.length - store.states.rightFixedLeafColumnsLength.value) {
  22669. classes.push("is-first-column");
  22670. }
  22671. }
  22672. return classes;
  22673. };
  22674. function getOffset(offset2, column) {
  22675. return offset2 + (column.realWidth === null || Number.isNaN(column.realWidth) ? Number(column.width) : column.realWidth);
  22676. }
  22677. const getFixedColumnOffset = (index, fixed, store, realColumns) => {
  22678. const { direction, start: start2 = 0 } = isFixedColumn(index, fixed, store, realColumns);
  22679. if (!direction) {
  22680. return;
  22681. }
  22682. const styles = {};
  22683. const isLeft = direction === "left";
  22684. const columns = store.states.columns.value;
  22685. if (isLeft) {
  22686. styles.left = columns.slice(0, index).reduce(getOffset, 0);
  22687. } else {
  22688. styles.right = columns.slice(start2 + 1).reverse().reduce(getOffset, 0);
  22689. }
  22690. return styles;
  22691. };
  22692. const ensurePosition = (style, key) => {
  22693. if (!style)
  22694. return;
  22695. if (!Number.isNaN(style[key])) {
  22696. style[key] = `${style[key]}px`;
  22697. }
  22698. };
  22699. function useExpand(watcherData) {
  22700. const instance = getCurrentInstance();
  22701. const defaultExpandAll = ref(false);
  22702. const expandRows = ref([]);
  22703. const updateExpandRows = () => {
  22704. const data2 = watcherData.data.value || [];
  22705. const rowKey = watcherData.rowKey.value;
  22706. if (defaultExpandAll.value) {
  22707. expandRows.value = data2.slice();
  22708. } else if (rowKey) {
  22709. const expandRowsMap = getKeysMap(expandRows.value, rowKey);
  22710. expandRows.value = data2.reduce((prev, row) => {
  22711. const rowId = getRowIdentity(row, rowKey);
  22712. const rowInfo = expandRowsMap[rowId];
  22713. if (rowInfo) {
  22714. prev.push(row);
  22715. }
  22716. return prev;
  22717. }, []);
  22718. } else {
  22719. expandRows.value = [];
  22720. }
  22721. };
  22722. const toggleRowExpansion = (row, expanded) => {
  22723. const changed = toggleRowStatus(expandRows.value, row, expanded);
  22724. if (changed) {
  22725. instance.emit("expand-change", row, expandRows.value.slice());
  22726. }
  22727. };
  22728. const setExpandRowKeys = (rowKeys) => {
  22729. instance.store.assertRowKey();
  22730. const data2 = watcherData.data.value || [];
  22731. const rowKey = watcherData.rowKey.value;
  22732. const keysMap = getKeysMap(data2, rowKey);
  22733. expandRows.value = rowKeys.reduce((prev, cur) => {
  22734. const info = keysMap[cur];
  22735. if (info) {
  22736. prev.push(info.row);
  22737. }
  22738. return prev;
  22739. }, []);
  22740. };
  22741. const isRowExpanded = (row) => {
  22742. const rowKey = watcherData.rowKey.value;
  22743. if (rowKey) {
  22744. const expandMap = getKeysMap(expandRows.value, rowKey);
  22745. return !!expandMap[getRowIdentity(row, rowKey)];
  22746. }
  22747. return expandRows.value.includes(row);
  22748. };
  22749. return {
  22750. updateExpandRows,
  22751. toggleRowExpansion,
  22752. setExpandRowKeys,
  22753. isRowExpanded,
  22754. states: {
  22755. expandRows,
  22756. defaultExpandAll
  22757. }
  22758. };
  22759. }
  22760. function useCurrent(watcherData) {
  22761. const instance = getCurrentInstance();
  22762. const _currentRowKey = ref(null);
  22763. const currentRow = ref(null);
  22764. const setCurrentRowKey = (key) => {
  22765. instance.store.assertRowKey();
  22766. _currentRowKey.value = key;
  22767. setCurrentRowByKey(key);
  22768. };
  22769. const restoreCurrentRowKey = () => {
  22770. _currentRowKey.value = null;
  22771. };
  22772. const setCurrentRowByKey = (key) => {
  22773. const { data: data2, rowKey } = watcherData;
  22774. let _currentRow = null;
  22775. if (rowKey.value) {
  22776. _currentRow = (unref(data2) || []).find((item) => getRowIdentity(item, rowKey.value) === key);
  22777. }
  22778. currentRow.value = _currentRow;
  22779. instance.emit("current-change", currentRow.value, null);
  22780. };
  22781. const updateCurrentRow = (_currentRow) => {
  22782. const oldCurrentRow = currentRow.value;
  22783. if (_currentRow && _currentRow !== oldCurrentRow) {
  22784. currentRow.value = _currentRow;
  22785. instance.emit("current-change", currentRow.value, oldCurrentRow);
  22786. return;
  22787. }
  22788. if (!_currentRow && oldCurrentRow) {
  22789. currentRow.value = null;
  22790. instance.emit("current-change", null, oldCurrentRow);
  22791. }
  22792. };
  22793. const updateCurrentRowData = () => {
  22794. const rowKey = watcherData.rowKey.value;
  22795. const data2 = watcherData.data.value || [];
  22796. const oldCurrentRow = currentRow.value;
  22797. if (!data2.includes(oldCurrentRow) && oldCurrentRow) {
  22798. if (rowKey) {
  22799. const currentRowKey = getRowIdentity(oldCurrentRow, rowKey);
  22800. setCurrentRowByKey(currentRowKey);
  22801. } else {
  22802. currentRow.value = null;
  22803. }
  22804. if (currentRow.value === null) {
  22805. instance.emit("current-change", null, oldCurrentRow);
  22806. }
  22807. } else if (_currentRowKey.value) {
  22808. setCurrentRowByKey(_currentRowKey.value);
  22809. restoreCurrentRowKey();
  22810. }
  22811. };
  22812. return {
  22813. setCurrentRowKey,
  22814. restoreCurrentRowKey,
  22815. setCurrentRowByKey,
  22816. updateCurrentRow,
  22817. updateCurrentRowData,
  22818. states: {
  22819. _currentRowKey,
  22820. currentRow
  22821. }
  22822. };
  22823. }
  22824. function useTree(watcherData) {
  22825. const expandRowKeys = ref([]);
  22826. const treeData = ref({});
  22827. const indent = ref(16);
  22828. const lazy = ref(false);
  22829. const lazyTreeNodeMap = ref({});
  22830. const lazyColumnIdentifier = ref("hasChildren");
  22831. const childrenColumnName = ref("children");
  22832. const instance = getCurrentInstance();
  22833. const normalizedData = computed(() => {
  22834. if (!watcherData.rowKey.value)
  22835. return {};
  22836. const data2 = watcherData.data.value || [];
  22837. return normalize(data2);
  22838. });
  22839. const normalizedLazyNode = computed(() => {
  22840. const rowKey = watcherData.rowKey.value;
  22841. const keys2 = Object.keys(lazyTreeNodeMap.value);
  22842. const res = {};
  22843. if (!keys2.length)
  22844. return res;
  22845. keys2.forEach((key) => {
  22846. if (lazyTreeNodeMap.value[key].length) {
  22847. const item = { children: [] };
  22848. lazyTreeNodeMap.value[key].forEach((row) => {
  22849. const currentRowKey = getRowIdentity(row, rowKey);
  22850. item.children.push(currentRowKey);
  22851. if (row[lazyColumnIdentifier.value] && !res[currentRowKey]) {
  22852. res[currentRowKey] = { children: [] };
  22853. }
  22854. });
  22855. res[key] = item;
  22856. }
  22857. });
  22858. return res;
  22859. });
  22860. const normalize = (data2) => {
  22861. const rowKey = watcherData.rowKey.value;
  22862. const res = {};
  22863. walkTreeNode(data2, (parent, children, level) => {
  22864. const parentId = getRowIdentity(parent, rowKey);
  22865. if (Array.isArray(children)) {
  22866. res[parentId] = {
  22867. children: children.map((row) => getRowIdentity(row, rowKey)),
  22868. level
  22869. };
  22870. } else if (lazy.value) {
  22871. res[parentId] = {
  22872. children: [],
  22873. lazy: true,
  22874. level
  22875. };
  22876. }
  22877. }, childrenColumnName.value, lazyColumnIdentifier.value);
  22878. return res;
  22879. };
  22880. const updateTreeData = (ifChangeExpandRowKeys = false, ifExpandAll = ((_a2) => (_a2 = instance.store) == null ? void 0 : _a2.states.defaultExpandAll.value)()) => {
  22881. var _a2;
  22882. const nested = normalizedData.value;
  22883. const normalizedLazyNode_ = normalizedLazyNode.value;
  22884. const keys2 = Object.keys(nested);
  22885. const newTreeData = {};
  22886. if (keys2.length) {
  22887. const oldTreeData = unref(treeData);
  22888. const rootLazyRowKeys = [];
  22889. const getExpanded = (oldValue, key) => {
  22890. if (ifChangeExpandRowKeys) {
  22891. if (expandRowKeys.value) {
  22892. return ifExpandAll || expandRowKeys.value.includes(key);
  22893. } else {
  22894. return !!(ifExpandAll || (oldValue == null ? void 0 : oldValue.expanded));
  22895. }
  22896. } else {
  22897. const included = ifExpandAll || expandRowKeys.value && expandRowKeys.value.includes(key);
  22898. return !!((oldValue == null ? void 0 : oldValue.expanded) || included);
  22899. }
  22900. };
  22901. keys2.forEach((key) => {
  22902. const oldValue = oldTreeData[key];
  22903. const newValue = __spreadValues({}, nested[key]);
  22904. newValue.expanded = getExpanded(oldValue, key);
  22905. if (newValue.lazy) {
  22906. const { loaded = false, loading: loading2 = false } = oldValue || {};
  22907. newValue.loaded = !!loaded;
  22908. newValue.loading = !!loading2;
  22909. rootLazyRowKeys.push(key);
  22910. }
  22911. newTreeData[key] = newValue;
  22912. });
  22913. const lazyKeys = Object.keys(normalizedLazyNode_);
  22914. if (lazy.value && lazyKeys.length && rootLazyRowKeys.length) {
  22915. lazyKeys.forEach((key) => {
  22916. const oldValue = oldTreeData[key];
  22917. const lazyNodeChildren = normalizedLazyNode_[key].children;
  22918. if (rootLazyRowKeys.includes(key)) {
  22919. if (newTreeData[key].children.length !== 0) {
  22920. throw new Error("[ElTable]children must be an empty array.");
  22921. }
  22922. newTreeData[key].children = lazyNodeChildren;
  22923. } else {
  22924. const { loaded = false, loading: loading2 = false } = oldValue || {};
  22925. newTreeData[key] = {
  22926. lazy: true,
  22927. loaded: !!loaded,
  22928. loading: !!loading2,
  22929. expanded: getExpanded(oldValue, key),
  22930. children: lazyNodeChildren,
  22931. level: ""
  22932. };
  22933. }
  22934. });
  22935. }
  22936. }
  22937. treeData.value = newTreeData;
  22938. (_a2 = instance.store) == null ? void 0 : _a2.updateTableScrollY();
  22939. };
  22940. watch(() => expandRowKeys.value, () => {
  22941. updateTreeData(true);
  22942. });
  22943. watch(() => normalizedData.value, () => {
  22944. updateTreeData();
  22945. });
  22946. watch(() => normalizedLazyNode.value, () => {
  22947. updateTreeData();
  22948. });
  22949. const updateTreeExpandKeys = (value) => {
  22950. expandRowKeys.value = value;
  22951. updateTreeData();
  22952. };
  22953. const toggleTreeExpansion = (row, expanded) => {
  22954. instance.store.assertRowKey();
  22955. const rowKey = watcherData.rowKey.value;
  22956. const id = getRowIdentity(row, rowKey);
  22957. const data2 = id && treeData.value[id];
  22958. if (id && data2 && "expanded" in data2) {
  22959. const oldExpanded = data2.expanded;
  22960. expanded = typeof expanded === "undefined" ? !data2.expanded : expanded;
  22961. treeData.value[id].expanded = expanded;
  22962. if (oldExpanded !== expanded) {
  22963. instance.emit("expand-change", row, expanded);
  22964. }
  22965. instance.store.updateTableScrollY();
  22966. }
  22967. };
  22968. const loadOrToggle = (row) => {
  22969. instance.store.assertRowKey();
  22970. const rowKey = watcherData.rowKey.value;
  22971. const id = getRowIdentity(row, rowKey);
  22972. const data2 = treeData.value[id];
  22973. if (lazy.value && data2 && "loaded" in data2 && !data2.loaded) {
  22974. loadData(row, id, data2);
  22975. } else {
  22976. toggleTreeExpansion(row, void 0);
  22977. }
  22978. };
  22979. const loadData = (row, key, treeNode) => {
  22980. const { load } = instance.props;
  22981. if (load && !treeData.value[key].loaded) {
  22982. treeData.value[key].loading = true;
  22983. load(row, treeNode, (data2) => {
  22984. if (!Array.isArray(data2)) {
  22985. throw new TypeError("[ElTable] data must be an array");
  22986. }
  22987. treeData.value[key].loading = false;
  22988. treeData.value[key].loaded = true;
  22989. treeData.value[key].expanded = true;
  22990. if (data2.length) {
  22991. lazyTreeNodeMap.value[key] = data2;
  22992. }
  22993. instance.emit("expand-change", row, true);
  22994. });
  22995. }
  22996. };
  22997. return {
  22998. loadData,
  22999. loadOrToggle,
  23000. toggleTreeExpansion,
  23001. updateTreeExpandKeys,
  23002. updateTreeData,
  23003. normalize,
  23004. states: {
  23005. expandRowKeys,
  23006. treeData,
  23007. indent,
  23008. lazy,
  23009. lazyTreeNodeMap,
  23010. lazyColumnIdentifier,
  23011. childrenColumnName
  23012. }
  23013. };
  23014. }
  23015. const sortData = (data2, states) => {
  23016. const sortingColumn = states.sortingColumn;
  23017. if (!sortingColumn || typeof sortingColumn.sortable === "string") {
  23018. return data2;
  23019. }
  23020. return orderBy(data2, states.sortProp, states.sortOrder, sortingColumn.sortMethod, sortingColumn.sortBy);
  23021. };
  23022. const doFlattenColumns = (columns) => {
  23023. const result = [];
  23024. columns.forEach((column) => {
  23025. if (column.children) {
  23026. result.push.apply(result, doFlattenColumns(column.children));
  23027. } else {
  23028. result.push(column);
  23029. }
  23030. });
  23031. return result;
  23032. };
  23033. function useWatcher$1() {
  23034. var _a2;
  23035. const instance = getCurrentInstance();
  23036. const { size: tableSize } = toRefs((_a2 = instance.proxy) == null ? void 0 : _a2.$props);
  23037. const rowKey = ref(null);
  23038. const data2 = ref([]);
  23039. const _data = ref([]);
  23040. const isComplex = ref(false);
  23041. const _columns = ref([]);
  23042. const originColumns = ref([]);
  23043. const columns = ref([]);
  23044. const fixedColumns = ref([]);
  23045. const rightFixedColumns = ref([]);
  23046. const leafColumns = ref([]);
  23047. const fixedLeafColumns = ref([]);
  23048. const rightFixedLeafColumns = ref([]);
  23049. const leafColumnsLength = ref(0);
  23050. const fixedLeafColumnsLength = ref(0);
  23051. const rightFixedLeafColumnsLength = ref(0);
  23052. const isAllSelected = ref(false);
  23053. const selection = ref([]);
  23054. const reserveSelection = ref(false);
  23055. const selectOnIndeterminate = ref(false);
  23056. const selectable = ref(null);
  23057. const filters = ref({});
  23058. const filteredData = ref(null);
  23059. const sortingColumn = ref(null);
  23060. const sortProp = ref(null);
  23061. const sortOrder = ref(null);
  23062. const hoverRow = ref(null);
  23063. watch(data2, () => instance.state && scheduleLayout(false), {
  23064. deep: true
  23065. });
  23066. const assertRowKey = () => {
  23067. if (!rowKey.value)
  23068. throw new Error("[ElTable] prop row-key is required");
  23069. };
  23070. const updateColumns = () => {
  23071. fixedColumns.value = _columns.value.filter((column) => column.fixed === true || column.fixed === "left");
  23072. rightFixedColumns.value = _columns.value.filter((column) => column.fixed === "right");
  23073. if (fixedColumns.value.length > 0 && _columns.value[0] && _columns.value[0].type === "selection" && !_columns.value[0].fixed) {
  23074. _columns.value[0].fixed = true;
  23075. fixedColumns.value.unshift(_columns.value[0]);
  23076. }
  23077. const notFixedColumns = _columns.value.filter((column) => !column.fixed);
  23078. originColumns.value = [].concat(fixedColumns.value).concat(notFixedColumns).concat(rightFixedColumns.value);
  23079. const leafColumns2 = doFlattenColumns(notFixedColumns);
  23080. const fixedLeafColumns2 = doFlattenColumns(fixedColumns.value);
  23081. const rightFixedLeafColumns2 = doFlattenColumns(rightFixedColumns.value);
  23082. leafColumnsLength.value = leafColumns2.length;
  23083. fixedLeafColumnsLength.value = fixedLeafColumns2.length;
  23084. rightFixedLeafColumnsLength.value = rightFixedLeafColumns2.length;
  23085. columns.value = [].concat(fixedLeafColumns2).concat(leafColumns2).concat(rightFixedLeafColumns2);
  23086. isComplex.value = fixedColumns.value.length > 0 || rightFixedColumns.value.length > 0;
  23087. };
  23088. const scheduleLayout = (needUpdateColumns, immediate = false) => {
  23089. if (needUpdateColumns) {
  23090. updateColumns();
  23091. }
  23092. if (immediate) {
  23093. instance.state.doLayout();
  23094. } else {
  23095. instance.state.debouncedUpdateLayout();
  23096. }
  23097. };
  23098. const isSelected = (row) => {
  23099. return selection.value.includes(row);
  23100. };
  23101. const clearSelection = () => {
  23102. isAllSelected.value = false;
  23103. const oldSelection = selection.value;
  23104. if (oldSelection.length) {
  23105. selection.value = [];
  23106. instance.emit("selection-change", []);
  23107. }
  23108. };
  23109. const cleanSelection = () => {
  23110. let deleted;
  23111. if (rowKey.value) {
  23112. deleted = [];
  23113. const selectedMap = getKeysMap(selection.value, rowKey.value);
  23114. const dataMap = getKeysMap(data2.value, rowKey.value);
  23115. for (const key in selectedMap) {
  23116. if (hasOwn(selectedMap, key) && !dataMap[key]) {
  23117. deleted.push(selectedMap[key].row);
  23118. }
  23119. }
  23120. } else {
  23121. deleted = selection.value.filter((item) => !data2.value.includes(item));
  23122. }
  23123. if (deleted.length) {
  23124. const newSelection = selection.value.filter((item) => !deleted.includes(item));
  23125. selection.value = newSelection;
  23126. instance.emit("selection-change", newSelection.slice());
  23127. }
  23128. };
  23129. const getSelectionRows = () => {
  23130. return (selection.value || []).slice();
  23131. };
  23132. const toggleRowSelection = (row, selected = void 0, emitChange = true) => {
  23133. const changed = toggleRowStatus(selection.value, row, selected);
  23134. if (changed) {
  23135. const newSelection = (selection.value || []).slice();
  23136. if (emitChange) {
  23137. instance.emit("select", newSelection, row);
  23138. }
  23139. instance.emit("selection-change", newSelection);
  23140. }
  23141. };
  23142. const _toggleAllSelection = () => {
  23143. var _a22, _b2;
  23144. const value = selectOnIndeterminate.value ? !isAllSelected.value : !(isAllSelected.value || selection.value.length);
  23145. isAllSelected.value = value;
  23146. let selectionChanged = false;
  23147. let childrenCount = 0;
  23148. const rowKey2 = (_b2 = (_a22 = instance == null ? void 0 : instance.store) == null ? void 0 : _a22.states) == null ? void 0 : _b2.rowKey.value;
  23149. data2.value.forEach((row, index) => {
  23150. const rowIndex = index + childrenCount;
  23151. if (selectable.value) {
  23152. if (selectable.value.call(null, row, rowIndex) && toggleRowStatus(selection.value, row, value)) {
  23153. selectionChanged = true;
  23154. }
  23155. } else {
  23156. if (toggleRowStatus(selection.value, row, value)) {
  23157. selectionChanged = true;
  23158. }
  23159. }
  23160. childrenCount += getChildrenCount(getRowIdentity(row, rowKey2));
  23161. });
  23162. if (selectionChanged) {
  23163. instance.emit("selection-change", selection.value ? selection.value.slice() : []);
  23164. }
  23165. instance.emit("select-all", selection.value);
  23166. };
  23167. const updateSelectionByRowKey = () => {
  23168. const selectedMap = getKeysMap(selection.value, rowKey.value);
  23169. data2.value.forEach((row) => {
  23170. const rowId = getRowIdentity(row, rowKey.value);
  23171. const rowInfo = selectedMap[rowId];
  23172. if (rowInfo) {
  23173. selection.value[rowInfo.index] = row;
  23174. }
  23175. });
  23176. };
  23177. const updateAllSelected = () => {
  23178. var _a22, _b2, _c;
  23179. if (((_a22 = data2.value) == null ? void 0 : _a22.length) === 0) {
  23180. isAllSelected.value = false;
  23181. return;
  23182. }
  23183. let selectedMap;
  23184. if (rowKey.value) {
  23185. selectedMap = getKeysMap(selection.value, rowKey.value);
  23186. }
  23187. const isSelected2 = function(row) {
  23188. if (selectedMap) {
  23189. return !!selectedMap[getRowIdentity(row, rowKey.value)];
  23190. } else {
  23191. return selection.value.includes(row);
  23192. }
  23193. };
  23194. let isAllSelected_ = true;
  23195. let selectedCount = 0;
  23196. let childrenCount = 0;
  23197. for (let i = 0, j = (data2.value || []).length; i < j; i++) {
  23198. const keyProp = (_c = (_b2 = instance == null ? void 0 : instance.store) == null ? void 0 : _b2.states) == null ? void 0 : _c.rowKey.value;
  23199. const rowIndex = i + childrenCount;
  23200. const item = data2.value[i];
  23201. const isRowSelectable = selectable.value && selectable.value.call(null, item, rowIndex);
  23202. if (!isSelected2(item)) {
  23203. if (!selectable.value || isRowSelectable) {
  23204. isAllSelected_ = false;
  23205. break;
  23206. }
  23207. } else {
  23208. selectedCount++;
  23209. }
  23210. childrenCount += getChildrenCount(getRowIdentity(item, keyProp));
  23211. }
  23212. if (selectedCount === 0)
  23213. isAllSelected_ = false;
  23214. isAllSelected.value = isAllSelected_;
  23215. };
  23216. const getChildrenCount = (rowKey2) => {
  23217. var _a22;
  23218. if (!instance || !instance.store)
  23219. return 0;
  23220. const { treeData } = instance.store.states;
  23221. let count = 0;
  23222. const children = (_a22 = treeData.value[rowKey2]) == null ? void 0 : _a22.children;
  23223. if (children) {
  23224. count += children.length;
  23225. children.forEach((childKey) => {
  23226. count += getChildrenCount(childKey);
  23227. });
  23228. }
  23229. return count;
  23230. };
  23231. const updateFilters = (columns2, values) => {
  23232. if (!Array.isArray(columns2)) {
  23233. columns2 = [columns2];
  23234. }
  23235. const filters_ = {};
  23236. columns2.forEach((col) => {
  23237. filters.value[col.id] = values;
  23238. filters_[col.columnKey || col.id] = values;
  23239. });
  23240. return filters_;
  23241. };
  23242. const updateSort = (column, prop, order2) => {
  23243. if (sortingColumn.value && sortingColumn.value !== column) {
  23244. sortingColumn.value.order = null;
  23245. }
  23246. sortingColumn.value = column;
  23247. sortProp.value = prop;
  23248. sortOrder.value = order2;
  23249. };
  23250. const execFilter = () => {
  23251. let sourceData = unref(_data);
  23252. Object.keys(filters.value).forEach((columnId) => {
  23253. const values = filters.value[columnId];
  23254. if (!values || values.length === 0)
  23255. return;
  23256. const column = getColumnById({
  23257. columns: columns.value
  23258. }, columnId);
  23259. if (column && column.filterMethod) {
  23260. sourceData = sourceData.filter((row) => {
  23261. return values.some((value) => column.filterMethod.call(null, value, row, column));
  23262. });
  23263. }
  23264. });
  23265. filteredData.value = sourceData;
  23266. };
  23267. const execSort = () => {
  23268. data2.value = sortData(filteredData.value, {
  23269. sortingColumn: sortingColumn.value,
  23270. sortProp: sortProp.value,
  23271. sortOrder: sortOrder.value
  23272. });
  23273. };
  23274. const execQuery = (ignore = void 0) => {
  23275. if (!(ignore && ignore.filter)) {
  23276. execFilter();
  23277. }
  23278. execSort();
  23279. };
  23280. const clearFilter = (columnKeys) => {
  23281. const { tableHeaderRef } = instance.refs;
  23282. if (!tableHeaderRef)
  23283. return;
  23284. const panels = Object.assign({}, tableHeaderRef.filterPanels);
  23285. const keys2 = Object.keys(panels);
  23286. if (!keys2.length)
  23287. return;
  23288. if (typeof columnKeys === "string") {
  23289. columnKeys = [columnKeys];
  23290. }
  23291. if (Array.isArray(columnKeys)) {
  23292. const columns_ = columnKeys.map((key) => getColumnByKey({
  23293. columns: columns.value
  23294. }, key));
  23295. keys2.forEach((key) => {
  23296. const column = columns_.find((col) => col.id === key);
  23297. if (column) {
  23298. column.filteredValue = [];
  23299. }
  23300. });
  23301. instance.store.commit("filterChange", {
  23302. column: columns_,
  23303. values: [],
  23304. silent: true,
  23305. multi: true
  23306. });
  23307. } else {
  23308. keys2.forEach((key) => {
  23309. const column = columns.value.find((col) => col.id === key);
  23310. if (column) {
  23311. column.filteredValue = [];
  23312. }
  23313. });
  23314. filters.value = {};
  23315. instance.store.commit("filterChange", {
  23316. column: {},
  23317. values: [],
  23318. silent: true
  23319. });
  23320. }
  23321. };
  23322. const clearSort = () => {
  23323. if (!sortingColumn.value)
  23324. return;
  23325. updateSort(null, null, null);
  23326. instance.store.commit("changeSortCondition", {
  23327. silent: true
  23328. });
  23329. };
  23330. const {
  23331. setExpandRowKeys,
  23332. toggleRowExpansion,
  23333. updateExpandRows,
  23334. states: expandStates,
  23335. isRowExpanded
  23336. } = useExpand({
  23337. data: data2,
  23338. rowKey
  23339. });
  23340. const {
  23341. updateTreeExpandKeys,
  23342. toggleTreeExpansion,
  23343. updateTreeData,
  23344. loadOrToggle,
  23345. states: treeStates
  23346. } = useTree({
  23347. data: data2,
  23348. rowKey
  23349. });
  23350. const {
  23351. updateCurrentRowData,
  23352. updateCurrentRow,
  23353. setCurrentRowKey,
  23354. states: currentData
  23355. } = useCurrent({
  23356. data: data2,
  23357. rowKey
  23358. });
  23359. const setExpandRowKeysAdapter = (val) => {
  23360. setExpandRowKeys(val);
  23361. updateTreeExpandKeys(val);
  23362. };
  23363. const toggleRowExpansionAdapter = (row, expanded) => {
  23364. const hasExpandColumn = columns.value.some(({ type: type4 }) => type4 === "expand");
  23365. if (hasExpandColumn) {
  23366. toggleRowExpansion(row, expanded);
  23367. } else {
  23368. toggleTreeExpansion(row, expanded);
  23369. }
  23370. };
  23371. return {
  23372. assertRowKey,
  23373. updateColumns,
  23374. scheduleLayout,
  23375. isSelected,
  23376. clearSelection,
  23377. cleanSelection,
  23378. getSelectionRows,
  23379. toggleRowSelection,
  23380. _toggleAllSelection,
  23381. toggleAllSelection: null,
  23382. updateSelectionByRowKey,
  23383. updateAllSelected,
  23384. updateFilters,
  23385. updateCurrentRow,
  23386. updateSort,
  23387. execFilter,
  23388. execSort,
  23389. execQuery,
  23390. clearFilter,
  23391. clearSort,
  23392. toggleRowExpansion,
  23393. setExpandRowKeysAdapter,
  23394. setCurrentRowKey,
  23395. toggleRowExpansionAdapter,
  23396. isRowExpanded,
  23397. updateExpandRows,
  23398. updateCurrentRowData,
  23399. loadOrToggle,
  23400. updateTreeData,
  23401. states: __spreadValues(__spreadValues(__spreadValues({
  23402. tableSize,
  23403. rowKey,
  23404. data: data2,
  23405. _data,
  23406. isComplex,
  23407. _columns,
  23408. originColumns,
  23409. columns,
  23410. fixedColumns,
  23411. rightFixedColumns,
  23412. leafColumns,
  23413. fixedLeafColumns,
  23414. rightFixedLeafColumns,
  23415. leafColumnsLength,
  23416. fixedLeafColumnsLength,
  23417. rightFixedLeafColumnsLength,
  23418. isAllSelected,
  23419. selection,
  23420. reserveSelection,
  23421. selectOnIndeterminate,
  23422. selectable,
  23423. filters,
  23424. filteredData,
  23425. sortingColumn,
  23426. sortProp,
  23427. sortOrder,
  23428. hoverRow
  23429. }, expandStates), treeStates), currentData)
  23430. };
  23431. }
  23432. function replaceColumn(array4, column) {
  23433. return array4.map((item) => {
  23434. var _a2;
  23435. if (item.id === column.id) {
  23436. return column;
  23437. } else if ((_a2 = item.children) == null ? void 0 : _a2.length) {
  23438. item.children = replaceColumn(item.children, column);
  23439. }
  23440. return item;
  23441. });
  23442. }
  23443. function sortColumn(array4) {
  23444. array4.forEach((item) => {
  23445. var _a2, _b2;
  23446. item.no = (_a2 = item.getColumnIndex) == null ? void 0 : _a2.call(item);
  23447. if ((_b2 = item.children) == null ? void 0 : _b2.length) {
  23448. sortColumn(item.children);
  23449. }
  23450. });
  23451. array4.sort((cur, pre) => cur.no - pre.no);
  23452. }
  23453. function useStore() {
  23454. const instance = getCurrentInstance();
  23455. const watcher = useWatcher$1();
  23456. const ns = useNamespace("table");
  23457. const mutations = {
  23458. setData(states, data2) {
  23459. const dataInstanceChanged = unref(states._data) !== data2;
  23460. states.data.value = data2;
  23461. states._data.value = data2;
  23462. instance.store.execQuery();
  23463. instance.store.updateCurrentRowData();
  23464. instance.store.updateExpandRows();
  23465. instance.store.updateTreeData(instance.store.states.defaultExpandAll.value);
  23466. if (unref(states.reserveSelection)) {
  23467. instance.store.assertRowKey();
  23468. instance.store.updateSelectionByRowKey();
  23469. } else {
  23470. if (dataInstanceChanged) {
  23471. instance.store.clearSelection();
  23472. } else {
  23473. instance.store.cleanSelection();
  23474. }
  23475. }
  23476. instance.store.updateAllSelected();
  23477. if (instance.$ready) {
  23478. instance.store.scheduleLayout();
  23479. }
  23480. },
  23481. insertColumn(states, column, parent) {
  23482. const array4 = unref(states._columns);
  23483. let newColumns = [];
  23484. if (!parent) {
  23485. array4.push(column);
  23486. newColumns = array4;
  23487. } else {
  23488. if (parent && !parent.children) {
  23489. parent.children = [];
  23490. }
  23491. parent.children.push(column);
  23492. newColumns = replaceColumn(array4, parent);
  23493. }
  23494. sortColumn(newColumns);
  23495. states._columns.value = newColumns;
  23496. if (column.type === "selection") {
  23497. states.selectable.value = column.selectable;
  23498. states.reserveSelection.value = column.reserveSelection;
  23499. }
  23500. if (instance.$ready) {
  23501. instance.store.updateColumns();
  23502. instance.store.scheduleLayout();
  23503. }
  23504. },
  23505. removeColumn(states, column, parent) {
  23506. const array4 = unref(states._columns) || [];
  23507. if (parent) {
  23508. parent.children.splice(parent.children.findIndex((item) => item.id === column.id), 1);
  23509. if (parent.children.length === 0) {
  23510. delete parent.children;
  23511. }
  23512. states._columns.value = replaceColumn(array4, parent);
  23513. } else {
  23514. const index = array4.indexOf(column);
  23515. if (index > -1) {
  23516. array4.splice(index, 1);
  23517. states._columns.value = array4;
  23518. }
  23519. }
  23520. if (instance.$ready) {
  23521. instance.store.updateColumns();
  23522. instance.store.scheduleLayout();
  23523. }
  23524. },
  23525. sort(states, options) {
  23526. const { prop, order: order2, init } = options;
  23527. if (prop) {
  23528. const column = unref(states.columns).find((column2) => column2.property === prop);
  23529. if (column) {
  23530. column.order = order2;
  23531. instance.store.updateSort(column, prop, order2);
  23532. instance.store.commit("changeSortCondition", { init });
  23533. }
  23534. }
  23535. },
  23536. changeSortCondition(states, options) {
  23537. const { sortingColumn: column, sortProp: prop, sortOrder: order2 } = states;
  23538. if (unref(order2) === null) {
  23539. states.sortingColumn.value = null;
  23540. states.sortProp.value = null;
  23541. }
  23542. const ingore = { filter: true };
  23543. instance.store.execQuery(ingore);
  23544. if (!options || !(options.silent || options.init)) {
  23545. instance.emit("sort-change", {
  23546. column: unref(column),
  23547. prop: unref(prop),
  23548. order: unref(order2)
  23549. });
  23550. }
  23551. instance.store.updateTableScrollY();
  23552. },
  23553. filterChange(_states, options) {
  23554. const { column, values, silent } = options;
  23555. const newFilters = instance.store.updateFilters(column, values);
  23556. instance.store.execQuery();
  23557. if (!silent) {
  23558. instance.emit("filter-change", newFilters);
  23559. }
  23560. instance.store.updateTableScrollY();
  23561. },
  23562. toggleAllSelection() {
  23563. instance.store.toggleAllSelection();
  23564. },
  23565. rowSelectedChanged(_states, row) {
  23566. instance.store.toggleRowSelection(row);
  23567. instance.store.updateAllSelected();
  23568. },
  23569. setHoverRow(states, row) {
  23570. states.hoverRow.value = row;
  23571. },
  23572. setCurrentRow(_states, row) {
  23573. instance.store.updateCurrentRow(row);
  23574. }
  23575. };
  23576. const commit = function(name, ...args) {
  23577. const mutations2 = instance.store.mutations;
  23578. if (mutations2[name]) {
  23579. mutations2[name].apply(instance, [instance.store.states].concat(args));
  23580. } else {
  23581. throw new Error(`Action not found: ${name}`);
  23582. }
  23583. };
  23584. const updateTableScrollY = function() {
  23585. nextTick(() => instance.layout.updateScrollY.apply(instance.layout));
  23586. };
  23587. return __spreadProps(__spreadValues({
  23588. ns
  23589. }, watcher), {
  23590. mutations,
  23591. commit,
  23592. updateTableScrollY
  23593. });
  23594. }
  23595. const InitialStateMap = {
  23596. rowKey: "rowKey",
  23597. defaultExpandAll: "defaultExpandAll",
  23598. selectOnIndeterminate: "selectOnIndeterminate",
  23599. indent: "indent",
  23600. lazy: "lazy",
  23601. data: "data",
  23602. ["treeProps.hasChildren"]: {
  23603. key: "lazyColumnIdentifier",
  23604. default: "hasChildren"
  23605. },
  23606. ["treeProps.children"]: {
  23607. key: "childrenColumnName",
  23608. default: "children"
  23609. }
  23610. };
  23611. function createStore(table, props) {
  23612. if (!table) {
  23613. throw new Error("Table is required.");
  23614. }
  23615. const store = useStore();
  23616. store.toggleAllSelection = debounce$1(store._toggleAllSelection, 10);
  23617. Object.keys(InitialStateMap).forEach((key) => {
  23618. handleValue(getArrKeysValue(props, key), key, store);
  23619. });
  23620. proxyTableProps(store, props);
  23621. return store;
  23622. }
  23623. function proxyTableProps(store, props) {
  23624. Object.keys(InitialStateMap).forEach((key) => {
  23625. watch(() => getArrKeysValue(props, key), (value) => {
  23626. handleValue(value, key, store);
  23627. });
  23628. });
  23629. }
  23630. function handleValue(value, propsKey, store) {
  23631. let newVal = value;
  23632. let storeKey = InitialStateMap[propsKey];
  23633. if (typeof InitialStateMap[propsKey] === "object") {
  23634. storeKey = storeKey.key;
  23635. newVal = newVal || InitialStateMap[propsKey].default;
  23636. }
  23637. store.states[storeKey].value = newVal;
  23638. }
  23639. function getArrKeysValue(props, keys2) {
  23640. if (keys2.includes(".")) {
  23641. const keyList = keys2.split(".");
  23642. let value = props;
  23643. keyList.forEach((key) => {
  23644. value = value[key];
  23645. });
  23646. return value;
  23647. } else {
  23648. return props[keys2];
  23649. }
  23650. }
  23651. class TableLayout {
  23652. constructor(options) {
  23653. this.observers = [];
  23654. this.table = null;
  23655. this.store = null;
  23656. this.columns = [];
  23657. this.fit = true;
  23658. this.showHeader = true;
  23659. this.height = ref(null);
  23660. this.scrollX = ref(false);
  23661. this.scrollY = ref(false);
  23662. this.bodyWidth = ref(null);
  23663. this.fixedWidth = ref(null);
  23664. this.rightFixedWidth = ref(null);
  23665. this.tableHeight = ref(null);
  23666. this.headerHeight = ref(44);
  23667. this.appendHeight = ref(0);
  23668. this.footerHeight = ref(44);
  23669. this.viewportHeight = ref(null);
  23670. this.bodyHeight = ref(null);
  23671. this.bodyScrollHeight = ref(0);
  23672. this.fixedBodyHeight = ref(null);
  23673. this.gutterWidth = 0;
  23674. for (const name in options) {
  23675. if (hasOwn(options, name)) {
  23676. if (isRef(this[name])) {
  23677. this[name].value = options[name];
  23678. } else {
  23679. this[name] = options[name];
  23680. }
  23681. }
  23682. }
  23683. if (!this.table) {
  23684. throw new Error("Table is required for Table Layout");
  23685. }
  23686. if (!this.store) {
  23687. throw new Error("Store is required for Table Layout");
  23688. }
  23689. }
  23690. updateScrollY() {
  23691. const height = this.height.value;
  23692. if (height === null)
  23693. return false;
  23694. const bodyWrapper = this.table.refs.bodyWrapper;
  23695. if (this.table.vnode.el && bodyWrapper) {
  23696. let scrollY = true;
  23697. const prevScrollY = this.scrollY.value;
  23698. if (this.bodyHeight.value === null) {
  23699. scrollY = false;
  23700. } else {
  23701. scrollY = bodyWrapper.scrollHeight > this.bodyHeight.value;
  23702. }
  23703. this.scrollY.value = scrollY;
  23704. return prevScrollY !== scrollY;
  23705. }
  23706. return false;
  23707. }
  23708. setHeight(value, prop = "height") {
  23709. if (!isClient)
  23710. return;
  23711. const el = this.table.vnode.el;
  23712. value = parseHeight(value);
  23713. this.height.value = Number(value);
  23714. if (!el && (value || value === 0))
  23715. return nextTick(() => this.setHeight(value, prop));
  23716. if (typeof value === "number") {
  23717. el.style[prop] = `${value}px`;
  23718. this.updateElsHeight();
  23719. } else if (typeof value === "string") {
  23720. el.style[prop] = value;
  23721. this.updateElsHeight();
  23722. }
  23723. }
  23724. setMaxHeight(value) {
  23725. this.setHeight(value, "max-height");
  23726. }
  23727. getFlattenColumns() {
  23728. const flattenColumns = [];
  23729. const columns = this.table.store.states.columns.value;
  23730. columns.forEach((column) => {
  23731. if (column.isColumnGroup) {
  23732. flattenColumns.push.apply(flattenColumns, column.columns);
  23733. } else {
  23734. flattenColumns.push(column);
  23735. }
  23736. });
  23737. return flattenColumns;
  23738. }
  23739. updateElsHeight() {
  23740. var _a2, _b2;
  23741. if (!this.table.$ready)
  23742. return nextTick(() => this.updateElsHeight());
  23743. const {
  23744. tableWrapper,
  23745. headerWrapper,
  23746. appendWrapper,
  23747. footerWrapper,
  23748. tableHeader,
  23749. tableBody
  23750. } = this.table.refs;
  23751. if (tableWrapper && tableWrapper.style.display === "none") {
  23752. return;
  23753. }
  23754. const { tableLayout } = this.table.props;
  23755. this.appendHeight.value = appendWrapper ? appendWrapper.offsetHeight : 0;
  23756. if (this.showHeader && !headerWrapper && tableLayout === "fixed") {
  23757. return;
  23758. }
  23759. const headerTrElm = tableHeader ? tableHeader : null;
  23760. const noneHeader = this.headerDisplayNone(headerTrElm);
  23761. const headerWrapperOffsetHeight = (headerWrapper == null ? void 0 : headerWrapper.offsetHeight) || 0;
  23762. const headerHeight = this.headerHeight.value = !this.showHeader ? 0 : headerWrapperOffsetHeight;
  23763. if (this.showHeader && !noneHeader && headerWrapperOffsetHeight > 0 && (this.table.store.states.columns.value || []).length > 0 && headerHeight < 2) {
  23764. return nextTick(() => this.updateElsHeight());
  23765. }
  23766. const tableHeight = this.tableHeight.value = (_b2 = (_a2 = this.table) == null ? void 0 : _a2.vnode.el) == null ? void 0 : _b2.clientHeight;
  23767. const footerHeight = this.footerHeight.value = footerWrapper ? footerWrapper.offsetHeight : 0;
  23768. if (this.height.value !== null) {
  23769. if (this.bodyHeight.value === null) {
  23770. requestAnimationFrame(() => this.updateElsHeight());
  23771. }
  23772. this.bodyHeight.value = tableHeight - headerHeight - footerHeight + (footerWrapper ? 1 : 0);
  23773. this.bodyScrollHeight.value = tableBody == null ? void 0 : tableBody.scrollHeight;
  23774. }
  23775. this.fixedBodyHeight.value = this.scrollX.value ? this.bodyHeight.value - this.gutterWidth : this.bodyHeight.value;
  23776. this.viewportHeight.value = this.scrollX.value ? tableHeight - this.gutterWidth : tableHeight;
  23777. this.updateScrollY();
  23778. this.notifyObservers("scrollable");
  23779. }
  23780. headerDisplayNone(elm) {
  23781. if (!elm)
  23782. return true;
  23783. let headerChild = elm;
  23784. while (headerChild.tagName !== "DIV") {
  23785. if (getComputedStyle(headerChild).display === "none") {
  23786. return true;
  23787. }
  23788. headerChild = headerChild.parentElement;
  23789. }
  23790. return false;
  23791. }
  23792. updateColumnsWidth() {
  23793. if (!isClient)
  23794. return;
  23795. const fit = this.fit;
  23796. const bodyWidth = this.table.vnode.el.clientWidth;
  23797. let bodyMinWidth = 0;
  23798. const flattenColumns = this.getFlattenColumns();
  23799. const flexColumns = flattenColumns.filter((column) => typeof column.width !== "number");
  23800. flattenColumns.forEach((column) => {
  23801. if (typeof column.width === "number" && column.realWidth)
  23802. column.realWidth = null;
  23803. });
  23804. if (flexColumns.length > 0 && fit) {
  23805. flattenColumns.forEach((column) => {
  23806. bodyMinWidth += Number(column.width || column.minWidth || 80);
  23807. });
  23808. if (bodyMinWidth <= bodyWidth) {
  23809. this.scrollX.value = false;
  23810. const totalFlexWidth = bodyWidth - bodyMinWidth;
  23811. if (flexColumns.length === 1) {
  23812. flexColumns[0].realWidth = Number(flexColumns[0].minWidth || 80) + totalFlexWidth;
  23813. } else {
  23814. const allColumnsWidth = flexColumns.reduce((prev, column) => prev + Number(column.minWidth || 80), 0);
  23815. const flexWidthPerPixel = totalFlexWidth / allColumnsWidth;
  23816. let noneFirstWidth = 0;
  23817. flexColumns.forEach((column, index) => {
  23818. if (index === 0)
  23819. return;
  23820. const flexWidth = Math.floor(Number(column.minWidth || 80) * flexWidthPerPixel);
  23821. noneFirstWidth += flexWidth;
  23822. column.realWidth = Number(column.minWidth || 80) + flexWidth;
  23823. });
  23824. flexColumns[0].realWidth = Number(flexColumns[0].minWidth || 80) + totalFlexWidth - noneFirstWidth;
  23825. }
  23826. } else {
  23827. this.scrollX.value = true;
  23828. flexColumns.forEach((column) => {
  23829. column.realWidth = Number(column.minWidth);
  23830. });
  23831. }
  23832. this.bodyWidth.value = Math.max(bodyMinWidth, bodyWidth);
  23833. this.table.state.resizeState.value.width = this.bodyWidth.value;
  23834. } else {
  23835. flattenColumns.forEach((column) => {
  23836. if (!column.width && !column.minWidth) {
  23837. column.realWidth = 80;
  23838. } else {
  23839. column.realWidth = Number(column.width || column.minWidth);
  23840. }
  23841. bodyMinWidth += column.realWidth;
  23842. });
  23843. this.scrollX.value = bodyMinWidth > bodyWidth;
  23844. this.bodyWidth.value = bodyMinWidth;
  23845. }
  23846. const fixedColumns = this.store.states.fixedColumns.value;
  23847. if (fixedColumns.length > 0) {
  23848. let fixedWidth = 0;
  23849. fixedColumns.forEach((column) => {
  23850. fixedWidth += Number(column.realWidth || column.width);
  23851. });
  23852. this.fixedWidth.value = fixedWidth;
  23853. }
  23854. const rightFixedColumns = this.store.states.rightFixedColumns.value;
  23855. if (rightFixedColumns.length > 0) {
  23856. let rightFixedWidth = 0;
  23857. rightFixedColumns.forEach((column) => {
  23858. rightFixedWidth += Number(column.realWidth || column.width);
  23859. });
  23860. this.rightFixedWidth.value = rightFixedWidth;
  23861. }
  23862. this.notifyObservers("columns");
  23863. }
  23864. addObserver(observer) {
  23865. this.observers.push(observer);
  23866. }
  23867. removeObserver(observer) {
  23868. const index = this.observers.indexOf(observer);
  23869. if (index !== -1) {
  23870. this.observers.splice(index, 1);
  23871. }
  23872. }
  23873. notifyObservers(event) {
  23874. const observers = this.observers;
  23875. observers.forEach((observer) => {
  23876. var _a2, _b2;
  23877. switch (event) {
  23878. case "columns":
  23879. (_a2 = observer.state) == null ? void 0 : _a2.onColumnsChange(this);
  23880. break;
  23881. case "scrollable":
  23882. (_b2 = observer.state) == null ? void 0 : _b2.onScrollableChange(this);
  23883. break;
  23884. default:
  23885. throw new Error(`Table Layout don't have event ${event}.`);
  23886. }
  23887. });
  23888. }
  23889. }
  23890. const { CheckboxGroup: ElCheckboxGroup } = ElCheckbox;
  23891. const _sfc_main$f = defineComponent({
  23892. name: "ElTableFilterPanel",
  23893. components: {
  23894. ElCheckbox,
  23895. ElCheckboxGroup,
  23896. ElScrollbar,
  23897. ElTooltip,
  23898. ElIcon,
  23899. ArrowDown: arrowDown,
  23900. ArrowUp: arrowUp
  23901. },
  23902. directives: { ClickOutside },
  23903. props: {
  23904. placement: {
  23905. type: String,
  23906. default: "bottom-start"
  23907. },
  23908. store: {
  23909. type: Object
  23910. },
  23911. column: {
  23912. type: Object
  23913. },
  23914. upDataColumn: {
  23915. type: Function
  23916. }
  23917. },
  23918. setup(props) {
  23919. const instance = getCurrentInstance();
  23920. const { t } = useLocale();
  23921. const ns = useNamespace("table-filter");
  23922. const parent = instance == null ? void 0 : instance.parent;
  23923. if (!parent.filterPanels.value[props.column.id]) {
  23924. parent.filterPanels.value[props.column.id] = instance;
  23925. }
  23926. const tooltipVisible = ref(false);
  23927. const tooltip = ref(null);
  23928. const filters = computed(() => {
  23929. return props.column && props.column.filters;
  23930. });
  23931. const filterValue = computed({
  23932. get: () => {
  23933. var _a2;
  23934. return (((_a2 = props.column) == null ? void 0 : _a2.filteredValue) || [])[0];
  23935. },
  23936. set: (value) => {
  23937. if (filteredValue.value) {
  23938. if (typeof value !== "undefined" && value !== null) {
  23939. filteredValue.value.splice(0, 1, value);
  23940. } else {
  23941. filteredValue.value.splice(0, 1);
  23942. }
  23943. }
  23944. }
  23945. });
  23946. const filteredValue = computed({
  23947. get() {
  23948. if (props.column) {
  23949. return props.column.filteredValue || [];
  23950. }
  23951. return [];
  23952. },
  23953. set(value) {
  23954. if (props.column) {
  23955. props.upDataColumn("filteredValue", value);
  23956. }
  23957. }
  23958. });
  23959. const multiple = computed(() => {
  23960. if (props.column) {
  23961. return props.column.filterMultiple;
  23962. }
  23963. return true;
  23964. });
  23965. const isActive = (filter) => {
  23966. return filter.value === filterValue.value;
  23967. };
  23968. const hidden = () => {
  23969. tooltipVisible.value = false;
  23970. };
  23971. const showFilterPanel = (e) => {
  23972. e.stopPropagation();
  23973. tooltipVisible.value = !tooltipVisible.value;
  23974. };
  23975. const hideFilterPanel = () => {
  23976. tooltipVisible.value = false;
  23977. };
  23978. const handleConfirm = () => {
  23979. confirmFilter(filteredValue.value);
  23980. hidden();
  23981. };
  23982. const handleReset = () => {
  23983. filteredValue.value = [];
  23984. confirmFilter(filteredValue.value);
  23985. hidden();
  23986. };
  23987. const handleSelect = (_filterValue) => {
  23988. filterValue.value = _filterValue;
  23989. if (typeof _filterValue !== "undefined" && _filterValue !== null) {
  23990. confirmFilter(filteredValue.value);
  23991. } else {
  23992. confirmFilter([]);
  23993. }
  23994. hidden();
  23995. };
  23996. const confirmFilter = (filteredValue2) => {
  23997. props.store.commit("filterChange", {
  23998. column: props.column,
  23999. values: filteredValue2
  24000. });
  24001. props.store.updateAllSelected();
  24002. };
  24003. watch(tooltipVisible, (value) => {
  24004. if (props.column) {
  24005. props.upDataColumn("filterOpened", value);
  24006. }
  24007. }, {
  24008. immediate: true
  24009. });
  24010. const popperPaneRef = computed(() => {
  24011. var _a2, _b2;
  24012. return (_b2 = (_a2 = tooltip.value) == null ? void 0 : _a2.popperRef) == null ? void 0 : _b2.contentRef;
  24013. });
  24014. return {
  24015. tooltipVisible,
  24016. multiple,
  24017. filteredValue,
  24018. filterValue,
  24019. filters,
  24020. handleConfirm,
  24021. handleReset,
  24022. handleSelect,
  24023. isActive,
  24024. t,
  24025. ns,
  24026. showFilterPanel,
  24027. hideFilterPanel,
  24028. popperPaneRef,
  24029. tooltip
  24030. };
  24031. }
  24032. });
  24033. const _hoisted_1$c = { key: 0 };
  24034. const _hoisted_2$a = ["disabled"];
  24035. const _hoisted_3$7 = ["label", "onClick"];
  24036. function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
  24037. const _component_el_checkbox = resolveComponent("el-checkbox");
  24038. const _component_el_checkbox_group = resolveComponent("el-checkbox-group");
  24039. const _component_el_scrollbar = resolveComponent("el-scrollbar");
  24040. const _component_arrow_up = resolveComponent("arrow-up");
  24041. const _component_arrow_down = resolveComponent("arrow-down");
  24042. const _component_el_icon = resolveComponent("el-icon");
  24043. const _component_el_tooltip = resolveComponent("el-tooltip");
  24044. const _directive_click_outside = resolveDirective("click-outside");
  24045. return openBlock(), createBlock(_component_el_tooltip, {
  24046. ref: "tooltip",
  24047. visible: _ctx.tooltipVisible,
  24048. "onUpdate:visible": _cache[5] || (_cache[5] = ($event) => _ctx.tooltipVisible = $event),
  24049. offset: 0,
  24050. placement: _ctx.placement,
  24051. "show-arrow": false,
  24052. "stop-popper-mouse-event": false,
  24053. "append-to-body": "",
  24054. effect: "light",
  24055. pure: "",
  24056. "popper-class": _ctx.ns.b(),
  24057. persistent: ""
  24058. }, {
  24059. content: withCtx(() => [
  24060. _ctx.multiple ? (openBlock(), createElementBlock("div", _hoisted_1$c, [
  24061. createElementVNode("div", {
  24062. class: normalizeClass(_ctx.ns.e("content"))
  24063. }, [
  24064. createVNode(_component_el_scrollbar, {
  24065. "wrap-class": _ctx.ns.e("wrap")
  24066. }, {
  24067. default: withCtx(() => [
  24068. createVNode(_component_el_checkbox_group, {
  24069. modelValue: _ctx.filteredValue,
  24070. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.filteredValue = $event),
  24071. class: normalizeClass(_ctx.ns.e("checkbox-group"))
  24072. }, {
  24073. default: withCtx(() => [
  24074. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.filters, (filter) => {
  24075. return openBlock(), createBlock(_component_el_checkbox, {
  24076. key: filter.value,
  24077. label: filter.value
  24078. }, {
  24079. default: withCtx(() => [
  24080. createTextVNode(toDisplayString(filter.text), 1)
  24081. ]),
  24082. _: 2
  24083. }, 1032, ["label"]);
  24084. }), 128))
  24085. ]),
  24086. _: 1
  24087. }, 8, ["modelValue", "class"])
  24088. ]),
  24089. _: 1
  24090. }, 8, ["wrap-class"])
  24091. ], 2),
  24092. createElementVNode("div", {
  24093. class: normalizeClass(_ctx.ns.e("bottom"))
  24094. }, [
  24095. createElementVNode("button", {
  24096. class: normalizeClass({ [_ctx.ns.is("disabled")]: _ctx.filteredValue.length === 0 }),
  24097. disabled: _ctx.filteredValue.length === 0,
  24098. type: "button",
  24099. onClick: _cache[1] || (_cache[1] = (...args) => _ctx.handleConfirm && _ctx.handleConfirm(...args))
  24100. }, toDisplayString(_ctx.t("el.table.confirmFilter")), 11, _hoisted_2$a),
  24101. createElementVNode("button", {
  24102. type: "button",
  24103. onClick: _cache[2] || (_cache[2] = (...args) => _ctx.handleReset && _ctx.handleReset(...args))
  24104. }, toDisplayString(_ctx.t("el.table.resetFilter")), 1)
  24105. ], 2)
  24106. ])) : (openBlock(), createElementBlock("ul", {
  24107. key: 1,
  24108. class: normalizeClass(_ctx.ns.e("list"))
  24109. }, [
  24110. createElementVNode("li", {
  24111. class: normalizeClass([
  24112. _ctx.ns.e("list-item"),
  24113. {
  24114. [_ctx.ns.is("active")]: _ctx.filterValue === void 0 || _ctx.filterValue === null
  24115. }
  24116. ]),
  24117. onClick: _cache[3] || (_cache[3] = ($event) => _ctx.handleSelect(null))
  24118. }, toDisplayString(_ctx.t("el.table.clearFilter")), 3),
  24119. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.filters, (filter) => {
  24120. return openBlock(), createElementBlock("li", {
  24121. key: filter.value,
  24122. class: normalizeClass([_ctx.ns.e("list-item"), _ctx.ns.is("active", _ctx.isActive(filter))]),
  24123. label: filter.value,
  24124. onClick: ($event) => _ctx.handleSelect(filter.value)
  24125. }, toDisplayString(filter.text), 11, _hoisted_3$7);
  24126. }), 128))
  24127. ], 2))
  24128. ]),
  24129. default: withCtx(() => [
  24130. withDirectives((openBlock(), createElementBlock("span", {
  24131. class: normalizeClass([
  24132. `${_ctx.ns.namespace.value}-table__column-filter-trigger`,
  24133. `${_ctx.ns.namespace.value}-none-outline`
  24134. ]),
  24135. onClick: _cache[4] || (_cache[4] = (...args) => _ctx.showFilterPanel && _ctx.showFilterPanel(...args))
  24136. }, [
  24137. createVNode(_component_el_icon, null, {
  24138. default: withCtx(() => [
  24139. _ctx.column.filterOpened ? (openBlock(), createBlock(_component_arrow_up, { key: 0 })) : (openBlock(), createBlock(_component_arrow_down, { key: 1 }))
  24140. ]),
  24141. _: 1
  24142. })
  24143. ], 2)), [
  24144. [_directive_click_outside, _ctx.hideFilterPanel, _ctx.popperPaneRef]
  24145. ])
  24146. ]),
  24147. _: 1
  24148. }, 8, ["visible", "placement", "popper-class"]);
  24149. }
  24150. var FilterPanel = /* @__PURE__ */ _export_sfc$1(_sfc_main$f, [["render", _sfc_render$3], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/table/src/filter-panel.vue"]]);
  24151. function useLayoutObserver(root2) {
  24152. const instance = getCurrentInstance();
  24153. onBeforeMount(() => {
  24154. tableLayout.value.addObserver(instance);
  24155. });
  24156. onMounted(() => {
  24157. onColumnsChange(tableLayout.value);
  24158. onScrollableChange(tableLayout.value);
  24159. });
  24160. onUpdated(() => {
  24161. onColumnsChange(tableLayout.value);
  24162. onScrollableChange(tableLayout.value);
  24163. });
  24164. onUnmounted(() => {
  24165. tableLayout.value.removeObserver(instance);
  24166. });
  24167. const tableLayout = computed(() => {
  24168. const layout = root2.layout;
  24169. if (!layout) {
  24170. throw new Error("Can not find table layout.");
  24171. }
  24172. return layout;
  24173. });
  24174. const onColumnsChange = (layout) => {
  24175. var _a2;
  24176. const cols = ((_a2 = root2.vnode.el) == null ? void 0 : _a2.querySelectorAll("colgroup > col")) || [];
  24177. if (!cols.length)
  24178. return;
  24179. const flattenColumns = layout.getFlattenColumns();
  24180. const columnsMap = {};
  24181. flattenColumns.forEach((column) => {
  24182. columnsMap[column.id] = column;
  24183. });
  24184. for (let i = 0, j = cols.length; i < j; i++) {
  24185. const col = cols[i];
  24186. const name = col.getAttribute("name");
  24187. const column = columnsMap[name];
  24188. if (column) {
  24189. col.setAttribute("width", column.realWidth || column.width);
  24190. }
  24191. }
  24192. };
  24193. const onScrollableChange = (layout) => {
  24194. var _a2, _b2;
  24195. const cols = ((_a2 = root2.vnode.el) == null ? void 0 : _a2.querySelectorAll("colgroup > col[name=gutter]")) || [];
  24196. for (let i = 0, j = cols.length; i < j; i++) {
  24197. const col = cols[i];
  24198. col.setAttribute("width", layout.scrollY.value ? layout.gutterWidth : "0");
  24199. }
  24200. const ths = ((_b2 = root2.vnode.el) == null ? void 0 : _b2.querySelectorAll("th.gutter")) || [];
  24201. for (let i = 0, j = ths.length; i < j; i++) {
  24202. const th = ths[i];
  24203. th.style.width = layout.scrollY.value ? `${layout.gutterWidth}px` : "0";
  24204. th.style.display = layout.scrollY.value ? "" : "none";
  24205. }
  24206. };
  24207. return {
  24208. tableLayout: tableLayout.value,
  24209. onColumnsChange,
  24210. onScrollableChange
  24211. };
  24212. }
  24213. const TABLE_INJECTION_KEY = Symbol("ElTable");
  24214. function useEvent(props, emit) {
  24215. const instance = getCurrentInstance();
  24216. const parent = inject(TABLE_INJECTION_KEY);
  24217. const handleFilterClick = (event) => {
  24218. event.stopPropagation();
  24219. return;
  24220. };
  24221. const handleHeaderClick = (event, column) => {
  24222. if (!column.filters && column.sortable) {
  24223. handleSortClick(event, column, false);
  24224. } else if (column.filterable && !column.sortable) {
  24225. handleFilterClick(event);
  24226. }
  24227. parent == null ? void 0 : parent.emit("header-click", column, event);
  24228. };
  24229. const handleHeaderContextMenu = (event, column) => {
  24230. parent == null ? void 0 : parent.emit("header-contextmenu", column, event);
  24231. };
  24232. const draggingColumn = ref(null);
  24233. const dragging = ref(false);
  24234. const dragState = ref({});
  24235. const handleMouseDown = (event, column) => {
  24236. if (!isClient)
  24237. return;
  24238. if (column.children && column.children.length > 0)
  24239. return;
  24240. if (draggingColumn.value && props.border) {
  24241. dragging.value = true;
  24242. const table = parent;
  24243. emit("set-drag-visible", true);
  24244. const tableEl = table == null ? void 0 : table.vnode.el;
  24245. const tableLeft = tableEl.getBoundingClientRect().left;
  24246. const columnEl = instance.vnode.el.querySelector(`th.${column.id}`);
  24247. const columnRect = columnEl.getBoundingClientRect();
  24248. const minLeft = columnRect.left - tableLeft + 30;
  24249. addClass(columnEl, "noclick");
  24250. dragState.value = {
  24251. startMouseLeft: event.clientX,
  24252. startLeft: columnRect.right - tableLeft,
  24253. startColumnLeft: columnRect.left - tableLeft,
  24254. tableLeft
  24255. };
  24256. const resizeProxy = table == null ? void 0 : table.refs.resizeProxy;
  24257. resizeProxy.style.left = `${dragState.value.startLeft}px`;
  24258. document.onselectstart = function() {
  24259. return false;
  24260. };
  24261. document.ondragstart = function() {
  24262. return false;
  24263. };
  24264. const handleMouseMove2 = (event2) => {
  24265. const deltaLeft = event2.clientX - dragState.value.startMouseLeft;
  24266. const proxyLeft = dragState.value.startLeft + deltaLeft;
  24267. resizeProxy.style.left = `${Math.max(minLeft, proxyLeft)}px`;
  24268. };
  24269. const handleMouseUp = () => {
  24270. if (dragging.value) {
  24271. const { startColumnLeft, startLeft } = dragState.value;
  24272. const finalLeft = Number.parseInt(resizeProxy.style.left, 10);
  24273. const columnWidth = finalLeft - startColumnLeft;
  24274. column.width = column.realWidth = columnWidth;
  24275. table == null ? void 0 : table.emit("header-dragend", column.width, startLeft - startColumnLeft, column, event);
  24276. requestAnimationFrame(() => {
  24277. props.store.scheduleLayout(false, true);
  24278. });
  24279. document.body.style.cursor = "";
  24280. dragging.value = false;
  24281. draggingColumn.value = null;
  24282. dragState.value = {};
  24283. emit("set-drag-visible", false);
  24284. }
  24285. document.removeEventListener("mousemove", handleMouseMove2);
  24286. document.removeEventListener("mouseup", handleMouseUp);
  24287. document.onselectstart = null;
  24288. document.ondragstart = null;
  24289. setTimeout(() => {
  24290. removeClass(columnEl, "noclick");
  24291. }, 0);
  24292. };
  24293. document.addEventListener("mousemove", handleMouseMove2);
  24294. document.addEventListener("mouseup", handleMouseUp);
  24295. }
  24296. };
  24297. const handleMouseMove = (event, column) => {
  24298. if (column.children && column.children.length > 0)
  24299. return;
  24300. let target = event.target;
  24301. while (target && target.tagName !== "TH") {
  24302. target = target.parentNode;
  24303. }
  24304. if (!column || !column.resizable)
  24305. return;
  24306. if (!dragging.value && props.border) {
  24307. const rect = target.getBoundingClientRect();
  24308. const bodyStyle = document.body.style;
  24309. if (rect.width > 12 && rect.right - event.pageX < 8) {
  24310. bodyStyle.cursor = "col-resize";
  24311. if (hasClass(target, "is-sortable")) {
  24312. target.style.cursor = "col-resize";
  24313. }
  24314. draggingColumn.value = column;
  24315. } else if (!dragging.value) {
  24316. bodyStyle.cursor = "";
  24317. if (hasClass(target, "is-sortable")) {
  24318. target.style.cursor = "pointer";
  24319. }
  24320. draggingColumn.value = null;
  24321. }
  24322. }
  24323. };
  24324. const handleMouseOut = () => {
  24325. if (!isClient)
  24326. return;
  24327. document.body.style.cursor = "";
  24328. };
  24329. const toggleOrder = ({ order: order2, sortOrders }) => {
  24330. if (order2 === "")
  24331. return sortOrders[0];
  24332. const index = sortOrders.indexOf(order2 || null);
  24333. return sortOrders[index > sortOrders.length - 2 ? 0 : index + 1];
  24334. };
  24335. const handleSortClick = (event, column, givenOrder) => {
  24336. event.stopPropagation();
  24337. const order2 = column.order === givenOrder ? null : givenOrder || toggleOrder(column);
  24338. let target = event.target;
  24339. while (target && target.tagName !== "TH") {
  24340. target = target.parentNode;
  24341. }
  24342. if (target && target.tagName === "TH") {
  24343. if (hasClass(target, "noclick")) {
  24344. removeClass(target, "noclick");
  24345. return;
  24346. }
  24347. }
  24348. if (!column.sortable)
  24349. return;
  24350. const states = props.store.states;
  24351. let sortProp = states.sortProp.value;
  24352. let sortOrder;
  24353. const sortingColumn = states.sortingColumn.value;
  24354. if (sortingColumn !== column || sortingColumn === column && sortingColumn.order === null) {
  24355. if (sortingColumn) {
  24356. sortingColumn.order = null;
  24357. }
  24358. states.sortingColumn.value = column;
  24359. sortProp = column.property;
  24360. }
  24361. if (!order2) {
  24362. sortOrder = column.order = null;
  24363. } else {
  24364. sortOrder = column.order = order2;
  24365. }
  24366. states.sortProp.value = sortProp;
  24367. states.sortOrder.value = sortOrder;
  24368. parent == null ? void 0 : parent.store.commit("changeSortCondition");
  24369. };
  24370. return {
  24371. handleHeaderClick,
  24372. handleHeaderContextMenu,
  24373. handleMouseDown,
  24374. handleMouseMove,
  24375. handleMouseOut,
  24376. handleSortClick,
  24377. handleFilterClick
  24378. };
  24379. }
  24380. function useStyle$2(props) {
  24381. const parent = inject(TABLE_INJECTION_KEY);
  24382. const ns = useNamespace("table");
  24383. const getHeaderRowStyle = (rowIndex) => {
  24384. const headerRowStyle = parent == null ? void 0 : parent.props.headerRowStyle;
  24385. if (typeof headerRowStyle === "function") {
  24386. return headerRowStyle.call(null, { rowIndex });
  24387. }
  24388. return headerRowStyle;
  24389. };
  24390. const getHeaderRowClass = (rowIndex) => {
  24391. const classes = [];
  24392. const headerRowClassName = parent == null ? void 0 : parent.props.headerRowClassName;
  24393. if (typeof headerRowClassName === "string") {
  24394. classes.push(headerRowClassName);
  24395. } else if (typeof headerRowClassName === "function") {
  24396. classes.push(headerRowClassName.call(null, { rowIndex }));
  24397. }
  24398. return classes.join(" ");
  24399. };
  24400. const getHeaderCellStyle = (rowIndex, columnIndex, row, column) => {
  24401. var _a2;
  24402. let headerCellStyles = (_a2 = parent == null ? void 0 : parent.props.headerCellStyle) != null ? _a2 : {};
  24403. if (typeof headerCellStyles === "function") {
  24404. headerCellStyles = headerCellStyles.call(null, {
  24405. rowIndex,
  24406. columnIndex,
  24407. row,
  24408. column
  24409. });
  24410. }
  24411. const fixedStyle = column.isSubColumn ? null : getFixedColumnOffset(columnIndex, column.fixed, props.store, row);
  24412. ensurePosition(fixedStyle, "left");
  24413. ensurePosition(fixedStyle, "right");
  24414. return Object.assign({}, headerCellStyles, fixedStyle);
  24415. };
  24416. const getHeaderCellClass = (rowIndex, columnIndex, row, column) => {
  24417. const fixedClasses = column.isSubColumn ? [] : getFixedColumnsClass(ns.b(), columnIndex, column.fixed, props.store, row);
  24418. const classes = [
  24419. column.id,
  24420. column.order,
  24421. column.headerAlign,
  24422. column.className,
  24423. column.labelClassName,
  24424. ...fixedClasses
  24425. ];
  24426. if (!column.children) {
  24427. classes.push("is-leaf");
  24428. }
  24429. if (column.sortable) {
  24430. classes.push("is-sortable");
  24431. }
  24432. const headerCellClassName = parent == null ? void 0 : parent.props.headerCellClassName;
  24433. if (typeof headerCellClassName === "string") {
  24434. classes.push(headerCellClassName);
  24435. } else if (typeof headerCellClassName === "function") {
  24436. classes.push(headerCellClassName.call(null, {
  24437. rowIndex,
  24438. columnIndex,
  24439. row,
  24440. column
  24441. }));
  24442. }
  24443. classes.push(ns.e("cell"));
  24444. return classes.filter((className) => Boolean(className)).join(" ");
  24445. };
  24446. return {
  24447. getHeaderRowStyle,
  24448. getHeaderRowClass,
  24449. getHeaderCellStyle,
  24450. getHeaderCellClass
  24451. };
  24452. }
  24453. const getAllColumns = (columns) => {
  24454. const result = [];
  24455. columns.forEach((column) => {
  24456. if (column.children) {
  24457. result.push(column);
  24458. result.push.apply(result, getAllColumns(column.children));
  24459. } else {
  24460. result.push(column);
  24461. }
  24462. });
  24463. return result;
  24464. };
  24465. const convertToRows = (originColumns) => {
  24466. let maxLevel = 1;
  24467. const traverse = (column, parent) => {
  24468. if (parent) {
  24469. column.level = parent.level + 1;
  24470. if (maxLevel < column.level) {
  24471. maxLevel = column.level;
  24472. }
  24473. }
  24474. if (column.children) {
  24475. let colSpan = 0;
  24476. column.children.forEach((subColumn) => {
  24477. traverse(subColumn, column);
  24478. colSpan += subColumn.colSpan;
  24479. });
  24480. column.colSpan = colSpan;
  24481. } else {
  24482. column.colSpan = 1;
  24483. }
  24484. };
  24485. originColumns.forEach((column) => {
  24486. column.level = 1;
  24487. traverse(column, void 0);
  24488. });
  24489. const rows = [];
  24490. for (let i = 0; i < maxLevel; i++) {
  24491. rows.push([]);
  24492. }
  24493. const allColumns = getAllColumns(originColumns);
  24494. allColumns.forEach((column) => {
  24495. if (!column.children) {
  24496. column.rowSpan = maxLevel - column.level + 1;
  24497. } else {
  24498. column.rowSpan = 1;
  24499. column.children.forEach((col) => col.isSubColumn = true);
  24500. }
  24501. rows[column.level - 1].push(column);
  24502. });
  24503. return rows;
  24504. };
  24505. function useUtils$1(props) {
  24506. const parent = inject(TABLE_INJECTION_KEY);
  24507. const columnRows = computed(() => {
  24508. return convertToRows(props.store.states.originColumns.value);
  24509. });
  24510. const isGroup = computed(() => {
  24511. const result = columnRows.value.length > 1;
  24512. if (result && parent) {
  24513. parent.state.isGroup.value = true;
  24514. }
  24515. return result;
  24516. });
  24517. const toggleAllSelection = (event) => {
  24518. event.stopPropagation();
  24519. parent == null ? void 0 : parent.store.commit("toggleAllSelection");
  24520. };
  24521. return {
  24522. isGroup,
  24523. toggleAllSelection,
  24524. columnRows
  24525. };
  24526. }
  24527. var TableHeader = defineComponent({
  24528. name: "ElTableHeader",
  24529. components: {
  24530. ElCheckbox
  24531. },
  24532. props: {
  24533. fixed: {
  24534. type: String,
  24535. default: ""
  24536. },
  24537. store: {
  24538. required: true,
  24539. type: Object
  24540. },
  24541. border: Boolean,
  24542. defaultSort: {
  24543. type: Object,
  24544. default: () => {
  24545. return {
  24546. prop: "",
  24547. order: ""
  24548. };
  24549. }
  24550. }
  24551. },
  24552. setup(props, { emit }) {
  24553. const instance = getCurrentInstance();
  24554. const parent = inject(TABLE_INJECTION_KEY);
  24555. const ns = useNamespace("table");
  24556. const filterPanels = ref({});
  24557. const { onColumnsChange, onScrollableChange } = useLayoutObserver(parent);
  24558. onMounted(async () => {
  24559. await nextTick();
  24560. await nextTick();
  24561. const { prop, order: order2 } = props.defaultSort;
  24562. parent == null ? void 0 : parent.store.commit("sort", { prop, order: order2, init: true });
  24563. });
  24564. const {
  24565. handleHeaderClick,
  24566. handleHeaderContextMenu,
  24567. handleMouseDown,
  24568. handleMouseMove,
  24569. handleMouseOut,
  24570. handleSortClick,
  24571. handleFilterClick
  24572. } = useEvent(props, emit);
  24573. const {
  24574. getHeaderRowStyle,
  24575. getHeaderRowClass,
  24576. getHeaderCellStyle,
  24577. getHeaderCellClass
  24578. } = useStyle$2(props);
  24579. const { isGroup, toggleAllSelection, columnRows } = useUtils$1(props);
  24580. instance.state = {
  24581. onColumnsChange,
  24582. onScrollableChange
  24583. };
  24584. instance.filterPanels = filterPanels;
  24585. return {
  24586. ns,
  24587. filterPanels,
  24588. onColumnsChange,
  24589. onScrollableChange,
  24590. columnRows,
  24591. getHeaderRowClass,
  24592. getHeaderRowStyle,
  24593. getHeaderCellClass,
  24594. getHeaderCellStyle,
  24595. handleHeaderClick,
  24596. handleHeaderContextMenu,
  24597. handleMouseDown,
  24598. handleMouseMove,
  24599. handleMouseOut,
  24600. handleSortClick,
  24601. handleFilterClick,
  24602. isGroup,
  24603. toggleAllSelection
  24604. };
  24605. },
  24606. render() {
  24607. const {
  24608. ns,
  24609. isGroup,
  24610. columnRows,
  24611. getHeaderCellStyle,
  24612. getHeaderCellClass,
  24613. getHeaderRowClass,
  24614. getHeaderRowStyle,
  24615. handleHeaderClick,
  24616. handleHeaderContextMenu,
  24617. handleMouseDown,
  24618. handleMouseMove,
  24619. handleSortClick,
  24620. handleMouseOut,
  24621. store,
  24622. $parent
  24623. } = this;
  24624. let rowSpan = 1;
  24625. return h$1("thead", {
  24626. class: { [ns.is("group")]: isGroup }
  24627. }, columnRows.map((subColumns, rowIndex) => h$1("tr", {
  24628. class: getHeaderRowClass(rowIndex),
  24629. key: rowIndex,
  24630. style: getHeaderRowStyle(rowIndex)
  24631. }, subColumns.map((column, cellIndex) => {
  24632. if (column.rowSpan > rowSpan) {
  24633. rowSpan = column.rowSpan;
  24634. }
  24635. return h$1("th", {
  24636. class: getHeaderCellClass(rowIndex, cellIndex, subColumns, column),
  24637. colspan: column.colSpan,
  24638. key: `${column.id}-thead`,
  24639. rowspan: column.rowSpan,
  24640. style: getHeaderCellStyle(rowIndex, cellIndex, subColumns, column),
  24641. onClick: ($event) => handleHeaderClick($event, column),
  24642. onContextmenu: ($event) => handleHeaderContextMenu($event, column),
  24643. onMousedown: ($event) => handleMouseDown($event, column),
  24644. onMousemove: ($event) => handleMouseMove($event, column),
  24645. onMouseout: handleMouseOut
  24646. }, [
  24647. h$1("div", {
  24648. class: [
  24649. "cell",
  24650. column.filteredValue && column.filteredValue.length > 0 ? "highlight" : "",
  24651. column.labelClassName
  24652. ]
  24653. }, [
  24654. column.renderHeader ? column.renderHeader({
  24655. column,
  24656. $index: cellIndex,
  24657. store,
  24658. _self: $parent
  24659. }) : column.label,
  24660. column.sortable && h$1("span", {
  24661. onClick: ($event) => handleSortClick($event, column),
  24662. class: "caret-wrapper"
  24663. }, [
  24664. h$1("i", {
  24665. onClick: ($event) => handleSortClick($event, column, "ascending"),
  24666. class: "sort-caret ascending"
  24667. }),
  24668. h$1("i", {
  24669. onClick: ($event) => handleSortClick($event, column, "descending"),
  24670. class: "sort-caret descending"
  24671. })
  24672. ]),
  24673. column.filterable && h$1(FilterPanel, {
  24674. store,
  24675. placement: column.filterPlacement || "bottom-start",
  24676. column,
  24677. upDataColumn: (key, value) => {
  24678. column[key] = value;
  24679. }
  24680. })
  24681. ])
  24682. ]);
  24683. }))));
  24684. }
  24685. });
  24686. function useEvents(props) {
  24687. const parent = inject(TABLE_INJECTION_KEY);
  24688. const tooltipContent = ref("");
  24689. const tooltipTrigger = ref(h$1("div"));
  24690. const handleEvent = (event, row, name) => {
  24691. var _a2;
  24692. const table = parent;
  24693. const cell = getCell(event);
  24694. let column;
  24695. const namespace = (_a2 = table == null ? void 0 : table.vnode.el) == null ? void 0 : _a2.dataset.prefix;
  24696. if (cell) {
  24697. column = getColumnByCell({
  24698. columns: props.store.states.columns.value
  24699. }, cell, namespace);
  24700. if (column) {
  24701. table == null ? void 0 : table.emit(`cell-${name}`, row, column, cell, event);
  24702. }
  24703. }
  24704. table == null ? void 0 : table.emit(`row-${name}`, row, column, event);
  24705. };
  24706. const handleDoubleClick = (event, row) => {
  24707. handleEvent(event, row, "dblclick");
  24708. };
  24709. const handleClick = (event, row) => {
  24710. props.store.commit("setCurrentRow", row);
  24711. handleEvent(event, row, "click");
  24712. };
  24713. const handleContextMenu = (event, row) => {
  24714. handleEvent(event, row, "contextmenu");
  24715. };
  24716. const handleMouseEnter = debounce$1((index) => {
  24717. props.store.commit("setHoverRow", index);
  24718. }, 30);
  24719. const handleMouseLeave = debounce$1(() => {
  24720. props.store.commit("setHoverRow", null);
  24721. }, 30);
  24722. const handleCellMouseEnter = (event, row) => {
  24723. var _a2;
  24724. const table = parent;
  24725. const cell = getCell(event);
  24726. const namespace = (_a2 = table == null ? void 0 : table.vnode.el) == null ? void 0 : _a2.dataset.prefix;
  24727. if (cell) {
  24728. const column = getColumnByCell({
  24729. columns: props.store.states.columns.value
  24730. }, cell, namespace);
  24731. const hoverState = table.hoverState = { cell, column, row };
  24732. table == null ? void 0 : table.emit("cell-mouse-enter", hoverState.row, hoverState.column, hoverState.cell, event);
  24733. }
  24734. const cellChild = event.target.querySelector(".cell");
  24735. if (!(hasClass(cellChild, `${namespace}-tooltip`) && cellChild.childNodes.length)) {
  24736. return;
  24737. }
  24738. const range3 = document.createRange();
  24739. range3.setStart(cellChild, 0);
  24740. range3.setEnd(cellChild, cellChild.childNodes.length);
  24741. const rangeWidth = range3.getBoundingClientRect().width;
  24742. const padding = (Number.parseInt(getStyle(cellChild, "paddingLeft"), 10) || 0) + (Number.parseInt(getStyle(cellChild, "paddingRight"), 10) || 0);
  24743. if (rangeWidth + padding > cellChild.offsetWidth || cellChild.scrollWidth > cellChild.offsetWidth) {
  24744. createTablePopper(cell, cell.innerText || cell.textContent, {
  24745. placement: "top",
  24746. strategy: "fixed"
  24747. }, row.tooltipEffect);
  24748. }
  24749. };
  24750. const handleCellMouseLeave = (event) => {
  24751. const cell = getCell(event);
  24752. if (!cell)
  24753. return;
  24754. const oldHoverState = parent == null ? void 0 : parent.hoverState;
  24755. parent == null ? void 0 : parent.emit("cell-mouse-leave", oldHoverState == null ? void 0 : oldHoverState.row, oldHoverState == null ? void 0 : oldHoverState.column, oldHoverState == null ? void 0 : oldHoverState.cell, event);
  24756. };
  24757. return {
  24758. handleDoubleClick,
  24759. handleClick,
  24760. handleContextMenu,
  24761. handleMouseEnter,
  24762. handleMouseLeave,
  24763. handleCellMouseEnter,
  24764. handleCellMouseLeave,
  24765. tooltipContent,
  24766. tooltipTrigger
  24767. };
  24768. }
  24769. function useStyles(props) {
  24770. const parent = inject(TABLE_INJECTION_KEY);
  24771. const ns = useNamespace("table");
  24772. const getRowStyle = (row, rowIndex) => {
  24773. const rowStyle = parent == null ? void 0 : parent.props.rowStyle;
  24774. if (typeof rowStyle === "function") {
  24775. return rowStyle.call(null, {
  24776. row,
  24777. rowIndex
  24778. });
  24779. }
  24780. return rowStyle || null;
  24781. };
  24782. const getRowClass = (row, rowIndex) => {
  24783. const classes = [ns.e("row")];
  24784. if ((parent == null ? void 0 : parent.props.highlightCurrentRow) && row === props.store.states.currentRow.value) {
  24785. classes.push("current-row");
  24786. }
  24787. if (props.stripe && rowIndex % 2 === 1) {
  24788. classes.push(ns.em("row", "striped"));
  24789. }
  24790. const rowClassName = parent == null ? void 0 : parent.props.rowClassName;
  24791. if (typeof rowClassName === "string") {
  24792. classes.push(rowClassName);
  24793. } else if (typeof rowClassName === "function") {
  24794. classes.push(rowClassName.call(null, {
  24795. row,
  24796. rowIndex
  24797. }));
  24798. }
  24799. return classes;
  24800. };
  24801. const getCellStyle = (rowIndex, columnIndex, row, column) => {
  24802. const cellStyle = parent == null ? void 0 : parent.props.cellStyle;
  24803. let cellStyles = cellStyle != null ? cellStyle : {};
  24804. if (typeof cellStyle === "function") {
  24805. cellStyles = cellStyle.call(null, {
  24806. rowIndex,
  24807. columnIndex,
  24808. row,
  24809. column
  24810. });
  24811. }
  24812. const fixedStyle = column.isSubColumn ? null : getFixedColumnOffset(columnIndex, props == null ? void 0 : props.fixed, props.store);
  24813. ensurePosition(fixedStyle, "left");
  24814. ensurePosition(fixedStyle, "right");
  24815. return Object.assign({}, cellStyles, fixedStyle);
  24816. };
  24817. const getCellClass = (rowIndex, columnIndex, row, column) => {
  24818. const fixedClasses = column.isSubColumn ? [] : getFixedColumnsClass(ns.b(), columnIndex, props == null ? void 0 : props.fixed, props.store);
  24819. const classes = [column.id, column.align, column.className, ...fixedClasses];
  24820. const cellClassName = parent == null ? void 0 : parent.props.cellClassName;
  24821. if (typeof cellClassName === "string") {
  24822. classes.push(cellClassName);
  24823. } else if (typeof cellClassName === "function") {
  24824. classes.push(cellClassName.call(null, {
  24825. rowIndex,
  24826. columnIndex,
  24827. row,
  24828. column
  24829. }));
  24830. }
  24831. classes.push(ns.e("cell"));
  24832. return classes.filter((className) => Boolean(className)).join(" ");
  24833. };
  24834. const getSpan = (row, column, rowIndex, columnIndex) => {
  24835. let rowspan = 1;
  24836. let colspan = 1;
  24837. const fn2 = parent == null ? void 0 : parent.props.spanMethod;
  24838. if (typeof fn2 === "function") {
  24839. const result = fn2({
  24840. row,
  24841. column,
  24842. rowIndex,
  24843. columnIndex
  24844. });
  24845. if (Array.isArray(result)) {
  24846. rowspan = result[0];
  24847. colspan = result[1];
  24848. } else if (typeof result === "object") {
  24849. rowspan = result.rowspan;
  24850. colspan = result.colspan;
  24851. }
  24852. }
  24853. return { rowspan, colspan };
  24854. };
  24855. const getColspanRealWidth = (columns, colspan, index) => {
  24856. if (colspan < 1) {
  24857. return columns[index].realWidth;
  24858. }
  24859. const widthArr = columns.map(({ realWidth, width }) => realWidth || width).slice(index, index + colspan);
  24860. return Number(widthArr.reduce((acc, width) => Number(acc) + Number(width), -1));
  24861. };
  24862. return {
  24863. getRowStyle,
  24864. getRowClass,
  24865. getCellStyle,
  24866. getCellClass,
  24867. getSpan,
  24868. getColspanRealWidth
  24869. };
  24870. }
  24871. function useRender$1(props) {
  24872. const parent = inject(TABLE_INJECTION_KEY);
  24873. const {
  24874. handleDoubleClick,
  24875. handleClick,
  24876. handleContextMenu,
  24877. handleMouseEnter,
  24878. handleMouseLeave,
  24879. handleCellMouseEnter,
  24880. handleCellMouseLeave,
  24881. tooltipContent,
  24882. tooltipTrigger
  24883. } = useEvents(props);
  24884. const {
  24885. getRowStyle,
  24886. getRowClass,
  24887. getCellStyle,
  24888. getCellClass,
  24889. getSpan,
  24890. getColspanRealWidth
  24891. } = useStyles(props);
  24892. const firstDefaultColumnIndex = computed(() => {
  24893. return props.store.states.columns.value.findIndex(({ type: type4 }) => type4 === "default");
  24894. });
  24895. const getKeyOfRow = (row, index) => {
  24896. const rowKey = parent.props.rowKey;
  24897. if (rowKey) {
  24898. return getRowIdentity(row, rowKey);
  24899. }
  24900. return index;
  24901. };
  24902. const rowRender = (row, $index, treeRowData, expanded = false) => {
  24903. const { tooltipEffect, store } = props;
  24904. const { indent, columns } = store.states;
  24905. const rowClasses = getRowClass(row, $index);
  24906. let display = true;
  24907. if (treeRowData) {
  24908. rowClasses.push(`el-table__row--level-${treeRowData.level}`);
  24909. display = treeRowData.display;
  24910. }
  24911. const displayStyle = display ? null : {
  24912. display: "none"
  24913. };
  24914. return h$1("tr", {
  24915. style: [displayStyle, getRowStyle(row, $index)],
  24916. class: rowClasses,
  24917. key: getKeyOfRow(row, $index),
  24918. onDblclick: ($event) => handleDoubleClick($event, row),
  24919. onClick: ($event) => handleClick($event, row),
  24920. onContextmenu: ($event) => handleContextMenu($event, row),
  24921. onMouseenter: () => handleMouseEnter($index),
  24922. onMouseleave: handleMouseLeave
  24923. }, columns.value.map((column, cellIndex) => {
  24924. const { rowspan, colspan } = getSpan(row, column, $index, cellIndex);
  24925. if (!rowspan || !colspan) {
  24926. return null;
  24927. }
  24928. const columnData = __spreadValues({}, column);
  24929. columnData.realWidth = getColspanRealWidth(columns.value, colspan, cellIndex);
  24930. const data2 = {
  24931. store: props.store,
  24932. _self: props.context || parent,
  24933. column: columnData,
  24934. row,
  24935. $index,
  24936. cellIndex,
  24937. expanded
  24938. };
  24939. if (cellIndex === firstDefaultColumnIndex.value && treeRowData) {
  24940. data2.treeNode = {
  24941. indent: treeRowData.level * indent.value,
  24942. level: treeRowData.level
  24943. };
  24944. if (typeof treeRowData.expanded === "boolean") {
  24945. data2.treeNode.expanded = treeRowData.expanded;
  24946. if ("loading" in treeRowData) {
  24947. data2.treeNode.loading = treeRowData.loading;
  24948. }
  24949. if ("noLazyChildren" in treeRowData) {
  24950. data2.treeNode.noLazyChildren = treeRowData.noLazyChildren;
  24951. }
  24952. }
  24953. }
  24954. const baseKey = `${$index},${cellIndex}`;
  24955. const patchKey = columnData.columnKey || columnData.rawColumnKey || "";
  24956. const tdChildren = cellChildren(cellIndex, column, data2);
  24957. return h$1("td", {
  24958. style: getCellStyle($index, cellIndex, row, column),
  24959. class: getCellClass($index, cellIndex, row, column),
  24960. key: `${patchKey}${baseKey}`,
  24961. rowspan,
  24962. colspan,
  24963. onMouseenter: ($event) => handleCellMouseEnter($event, __spreadProps(__spreadValues({}, row), { tooltipEffect })),
  24964. onMouseleave: handleCellMouseLeave
  24965. }, [tdChildren]);
  24966. }));
  24967. };
  24968. const cellChildren = (cellIndex, column, data2) => {
  24969. return column.renderCell(data2);
  24970. };
  24971. const wrappedRowRender = (row, $index) => {
  24972. const store = props.store;
  24973. const { isRowExpanded, assertRowKey } = store;
  24974. const { treeData, lazyTreeNodeMap, childrenColumnName, rowKey } = store.states;
  24975. const columns = store.states.columns.value;
  24976. const hasExpandColumn = columns.some(({ type: type4 }) => type4 === "expand");
  24977. if (hasExpandColumn) {
  24978. const expanded = isRowExpanded(row);
  24979. const tr = rowRender(row, $index, void 0, expanded);
  24980. const renderExpanded = parent.renderExpanded;
  24981. if (expanded) {
  24982. if (!renderExpanded) {
  24983. console.error("[Element Error]renderExpanded is required.");
  24984. return tr;
  24985. }
  24986. return [
  24987. [
  24988. tr,
  24989. h$1("tr", {
  24990. key: `expanded-row__${tr.key}`
  24991. }, [
  24992. h$1("td", {
  24993. colspan: columns.length,
  24994. class: "el-table__cell el-table__expanded-cell"
  24995. }, [renderExpanded({ row, $index, store, expanded })])
  24996. ])
  24997. ]
  24998. ];
  24999. } else {
  25000. return [[tr]];
  25001. }
  25002. } else if (Object.keys(treeData.value).length) {
  25003. assertRowKey();
  25004. const key = getRowIdentity(row, rowKey.value);
  25005. let cur = treeData.value[key];
  25006. let treeRowData = null;
  25007. if (cur) {
  25008. treeRowData = {
  25009. expanded: cur.expanded,
  25010. level: cur.level,
  25011. display: true
  25012. };
  25013. if (typeof cur.lazy === "boolean") {
  25014. if (typeof cur.loaded === "boolean" && cur.loaded) {
  25015. treeRowData.noLazyChildren = !(cur.children && cur.children.length);
  25016. }
  25017. treeRowData.loading = cur.loading;
  25018. }
  25019. }
  25020. const tmp = [rowRender(row, $index, treeRowData)];
  25021. if (cur) {
  25022. let i = 0;
  25023. const traverse = (children, parent2) => {
  25024. if (!(children && children.length && parent2))
  25025. return;
  25026. children.forEach((node) => {
  25027. const innerTreeRowData = {
  25028. display: parent2.display && parent2.expanded,
  25029. level: parent2.level + 1,
  25030. expanded: false,
  25031. noLazyChildren: false,
  25032. loading: false
  25033. };
  25034. const childKey = getRowIdentity(node, rowKey.value);
  25035. if (childKey === void 0 || childKey === null) {
  25036. throw new Error("For nested data item, row-key is required.");
  25037. }
  25038. cur = __spreadValues({}, treeData.value[childKey]);
  25039. if (cur) {
  25040. innerTreeRowData.expanded = cur.expanded;
  25041. cur.level = cur.level || innerTreeRowData.level;
  25042. cur.display = !!(cur.expanded && innerTreeRowData.display);
  25043. if (typeof cur.lazy === "boolean") {
  25044. if (typeof cur.loaded === "boolean" && cur.loaded) {
  25045. innerTreeRowData.noLazyChildren = !(cur.children && cur.children.length);
  25046. }
  25047. innerTreeRowData.loading = cur.loading;
  25048. }
  25049. }
  25050. i++;
  25051. tmp.push(rowRender(node, $index + i, innerTreeRowData));
  25052. if (cur) {
  25053. const nodes2 = lazyTreeNodeMap.value[childKey] || node[childrenColumnName.value];
  25054. traverse(nodes2, cur);
  25055. }
  25056. });
  25057. };
  25058. cur.display = true;
  25059. const nodes = lazyTreeNodeMap.value[key] || row[childrenColumnName.value];
  25060. traverse(nodes, cur);
  25061. }
  25062. return tmp;
  25063. } else {
  25064. return rowRender(row, $index, void 0);
  25065. }
  25066. };
  25067. return {
  25068. wrappedRowRender,
  25069. tooltipContent,
  25070. tooltipTrigger
  25071. };
  25072. }
  25073. const defaultProps$2 = {
  25074. store: {
  25075. required: true,
  25076. type: Object
  25077. },
  25078. stripe: Boolean,
  25079. tooltipEffect: String,
  25080. context: {
  25081. default: () => ({}),
  25082. type: Object
  25083. },
  25084. rowClassName: [String, Function],
  25085. rowStyle: [Object, Function],
  25086. fixed: {
  25087. type: String,
  25088. default: ""
  25089. },
  25090. highlight: Boolean
  25091. };
  25092. var TableBody = defineComponent({
  25093. name: "ElTableBody",
  25094. props: defaultProps$2,
  25095. setup(props) {
  25096. const instance = getCurrentInstance();
  25097. const parent = inject(TABLE_INJECTION_KEY);
  25098. const ns = useNamespace("table");
  25099. const { wrappedRowRender, tooltipContent, tooltipTrigger } = useRender$1(props);
  25100. const { onColumnsChange, onScrollableChange } = useLayoutObserver(parent);
  25101. watch(props.store.states.hoverRow, (newVal, oldVal) => {
  25102. if (!props.store.states.isComplex.value || !isClient)
  25103. return;
  25104. let raf = window.requestAnimationFrame;
  25105. if (!raf) {
  25106. raf = (fn2) => window.setTimeout(fn2, 16);
  25107. }
  25108. raf(() => {
  25109. var _a2;
  25110. const rows = (_a2 = instance == null ? void 0 : instance.vnode.el) == null ? void 0 : _a2.querySelectorAll(`.${ns.e("row")}`);
  25111. const oldRow = rows[oldVal];
  25112. const newRow = rows[newVal];
  25113. if (oldRow) {
  25114. removeClass(oldRow, "hover-row");
  25115. }
  25116. if (newRow) {
  25117. addClass(newRow, "hover-row");
  25118. }
  25119. });
  25120. });
  25121. onUnmounted(() => {
  25122. var _a2;
  25123. (_a2 = removePopper) == null ? void 0 : _a2();
  25124. });
  25125. onUpdated(() => {
  25126. var _a2;
  25127. (_a2 = removePopper) == null ? void 0 : _a2();
  25128. });
  25129. return {
  25130. ns,
  25131. onColumnsChange,
  25132. onScrollableChange,
  25133. wrappedRowRender,
  25134. tooltipContent,
  25135. tooltipTrigger
  25136. };
  25137. },
  25138. render() {
  25139. const { wrappedRowRender, store } = this;
  25140. const data2 = store.states.data.value || [];
  25141. return h$1("tbody", {}, [
  25142. data2.reduce((acc, row) => {
  25143. return acc.concat(wrappedRowRender(row, acc.length));
  25144. }, [])
  25145. ]);
  25146. }
  25147. });
  25148. function hColgroup(props) {
  25149. const isAuto = props.tableLayout === "auto";
  25150. let columns = props.columns || [];
  25151. if (isAuto) {
  25152. if (columns.every((column) => column.width === void 0)) {
  25153. columns = [];
  25154. }
  25155. }
  25156. const getPropsData = (column) => {
  25157. const propsData = {
  25158. key: `${props.tableLayout}_${column.id}`,
  25159. style: {},
  25160. name: void 0
  25161. };
  25162. if (isAuto) {
  25163. propsData.style = {
  25164. width: `${column.width}px`
  25165. };
  25166. } else {
  25167. propsData.name = column.id;
  25168. }
  25169. return propsData;
  25170. };
  25171. return h$1("colgroup", {}, columns.map((column) => h$1("col", getPropsData(column))));
  25172. }
  25173. hColgroup.props = ["columns", "tableLayout"];
  25174. function useMapState() {
  25175. const table = inject(TABLE_INJECTION_KEY);
  25176. const store = table == null ? void 0 : table.store;
  25177. const leftFixedLeafCount = computed(() => {
  25178. return store.states.fixedLeafColumnsLength.value;
  25179. });
  25180. const rightFixedLeafCount = computed(() => {
  25181. return store.states.rightFixedColumns.value.length;
  25182. });
  25183. const columnsCount = computed(() => {
  25184. return store.states.columns.value.length;
  25185. });
  25186. const leftFixedCount = computed(() => {
  25187. return store.states.fixedColumns.value.length;
  25188. });
  25189. const rightFixedCount = computed(() => {
  25190. return store.states.rightFixedColumns.value.length;
  25191. });
  25192. return {
  25193. leftFixedLeafCount,
  25194. rightFixedLeafCount,
  25195. columnsCount,
  25196. leftFixedCount,
  25197. rightFixedCount,
  25198. columns: store.states.columns
  25199. };
  25200. }
  25201. function useStyle$1(props) {
  25202. const { columns } = useMapState();
  25203. const ns = useNamespace("table");
  25204. const getCellClasses = (columns2, cellIndex) => {
  25205. const column = columns2[cellIndex];
  25206. const classes = [
  25207. ns.e("cell"),
  25208. column.id,
  25209. column.align,
  25210. column.labelClassName,
  25211. ...getFixedColumnsClass(ns.b(), cellIndex, column.fixed, props.store)
  25212. ];
  25213. if (column.className) {
  25214. classes.push(column.className);
  25215. }
  25216. if (!column.children) {
  25217. classes.push(ns.is("leaf"));
  25218. }
  25219. return classes;
  25220. };
  25221. const getCellStyles = (column, cellIndex) => {
  25222. const fixedStyle = getFixedColumnOffset(cellIndex, column.fixed, props.store);
  25223. ensurePosition(fixedStyle, "left");
  25224. ensurePosition(fixedStyle, "right");
  25225. return fixedStyle;
  25226. };
  25227. return {
  25228. getCellClasses,
  25229. getCellStyles,
  25230. columns
  25231. };
  25232. }
  25233. var TableFooter = defineComponent({
  25234. name: "ElTableFooter",
  25235. props: {
  25236. fixed: {
  25237. type: String,
  25238. default: ""
  25239. },
  25240. store: {
  25241. required: true,
  25242. type: Object
  25243. },
  25244. summaryMethod: Function,
  25245. sumText: String,
  25246. border: Boolean,
  25247. defaultSort: {
  25248. type: Object,
  25249. default: () => {
  25250. return {
  25251. prop: "",
  25252. order: ""
  25253. };
  25254. }
  25255. }
  25256. },
  25257. setup(props) {
  25258. const { getCellClasses, getCellStyles, columns } = useStyle$1(props);
  25259. const ns = useNamespace("table");
  25260. return {
  25261. ns,
  25262. getCellClasses,
  25263. getCellStyles,
  25264. columns
  25265. };
  25266. },
  25267. render() {
  25268. const {
  25269. columns,
  25270. getCellStyles,
  25271. getCellClasses,
  25272. summaryMethod,
  25273. sumText,
  25274. ns
  25275. } = this;
  25276. const data2 = this.store.states.data.value;
  25277. let sums = [];
  25278. if (summaryMethod) {
  25279. sums = summaryMethod({
  25280. columns,
  25281. data: data2
  25282. });
  25283. } else {
  25284. columns.forEach((column, index) => {
  25285. if (index === 0) {
  25286. sums[index] = sumText;
  25287. return;
  25288. }
  25289. const values = data2.map((item) => Number(item[column.property]));
  25290. const precisions = [];
  25291. let notNumber = true;
  25292. values.forEach((value) => {
  25293. if (!Number.isNaN(+value)) {
  25294. notNumber = false;
  25295. const decimal = `${value}`.split(".")[1];
  25296. precisions.push(decimal ? decimal.length : 0);
  25297. }
  25298. });
  25299. const precision = Math.max.apply(null, precisions);
  25300. if (!notNumber) {
  25301. sums[index] = values.reduce((prev, curr) => {
  25302. const value = Number(curr);
  25303. if (!Number.isNaN(+value)) {
  25304. return Number.parseFloat((prev + curr).toFixed(Math.min(precision, 20)));
  25305. } else {
  25306. return prev;
  25307. }
  25308. }, 0);
  25309. } else {
  25310. sums[index] = "";
  25311. }
  25312. });
  25313. }
  25314. return h$1("table", {
  25315. class: ns.e("footer"),
  25316. cellspacing: "0",
  25317. cellpadding: "0",
  25318. border: "0"
  25319. }, [
  25320. hColgroup({
  25321. columns
  25322. }),
  25323. h$1("tbody", [
  25324. h$1("tr", {}, [
  25325. ...columns.map((column, cellIndex) => h$1("td", {
  25326. key: cellIndex,
  25327. colspan: column.colSpan,
  25328. rowspan: column.rowSpan,
  25329. class: getCellClasses(columns, cellIndex),
  25330. style: getCellStyles(column, cellIndex)
  25331. }, [
  25332. h$1("div", {
  25333. class: ["cell", column.labelClassName]
  25334. }, [sums[cellIndex]])
  25335. ]))
  25336. ])
  25337. ])
  25338. ]);
  25339. }
  25340. });
  25341. function useUtils(store) {
  25342. const setCurrentRow = (row) => {
  25343. store.commit("setCurrentRow", row);
  25344. };
  25345. const getSelectionRows = () => {
  25346. return store.getSelectionRows();
  25347. };
  25348. const toggleRowSelection = (row, selected) => {
  25349. store.toggleRowSelection(row, selected, false);
  25350. store.updateAllSelected();
  25351. };
  25352. const clearSelection = () => {
  25353. store.clearSelection();
  25354. };
  25355. const clearFilter = (columnKeys) => {
  25356. store.clearFilter(columnKeys);
  25357. };
  25358. const toggleAllSelection = () => {
  25359. store.commit("toggleAllSelection");
  25360. };
  25361. const toggleRowExpansion = (row, expanded) => {
  25362. store.toggleRowExpansionAdapter(row, expanded);
  25363. };
  25364. const clearSort = () => {
  25365. store.clearSort();
  25366. };
  25367. const sort = (prop, order2) => {
  25368. store.commit("sort", { prop, order: order2 });
  25369. };
  25370. return {
  25371. setCurrentRow,
  25372. getSelectionRows,
  25373. toggleRowSelection,
  25374. clearSelection,
  25375. clearFilter,
  25376. toggleAllSelection,
  25377. toggleRowExpansion,
  25378. clearSort,
  25379. sort
  25380. };
  25381. }
  25382. function useStyle(props, layout, store, table) {
  25383. const isHidden = ref(false);
  25384. const renderExpanded = ref(null);
  25385. const resizeProxyVisible = ref(false);
  25386. const setDragVisible = (visible) => {
  25387. resizeProxyVisible.value = visible;
  25388. };
  25389. const resizeState = ref({
  25390. width: null,
  25391. height: null
  25392. });
  25393. const isGroup = ref(false);
  25394. const scrollbarViewStyle = {
  25395. display: "inline-block",
  25396. verticalAlign: "middle"
  25397. };
  25398. const tableWidth = ref();
  25399. watchEffect(() => {
  25400. layout.setHeight(props.height);
  25401. });
  25402. watchEffect(() => {
  25403. layout.setMaxHeight(props.maxHeight);
  25404. });
  25405. watch(() => [props.currentRowKey, store.states.rowKey], ([currentRowKey, rowKey]) => {
  25406. if (!unref(rowKey))
  25407. return;
  25408. store.setCurrentRowKey(`${currentRowKey}`);
  25409. }, {
  25410. immediate: true
  25411. });
  25412. watch(() => props.data, (data2) => {
  25413. table.store.commit("setData", data2);
  25414. }, {
  25415. immediate: true,
  25416. deep: true
  25417. });
  25418. watchEffect(() => {
  25419. if (props.expandRowKeys) {
  25420. store.setExpandRowKeysAdapter(props.expandRowKeys);
  25421. }
  25422. });
  25423. const handleMouseLeave = () => {
  25424. table.store.commit("setHoverRow", null);
  25425. if (table.hoverState)
  25426. table.hoverState = null;
  25427. };
  25428. const handleHeaderFooterMousewheel = (event, data2) => {
  25429. const { pixelX, pixelY } = data2;
  25430. if (Math.abs(pixelX) >= Math.abs(pixelY)) {
  25431. table.refs.bodyWrapper.scrollLeft += data2.pixelX / 5;
  25432. }
  25433. };
  25434. const shouldUpdateHeight = computed(() => {
  25435. return props.height || props.maxHeight || store.states.fixedColumns.value.length > 0 || store.states.rightFixedColumns.value.length > 0;
  25436. });
  25437. const tableBodyStyles = computed(() => {
  25438. return {
  25439. width: layout.bodyWidth.value ? `${layout.bodyWidth.value}px` : ""
  25440. };
  25441. });
  25442. const doLayout = () => {
  25443. if (shouldUpdateHeight.value) {
  25444. layout.updateElsHeight();
  25445. }
  25446. layout.updateColumnsWidth();
  25447. requestAnimationFrame(syncPostion);
  25448. };
  25449. onMounted(async () => {
  25450. await nextTick();
  25451. store.updateColumns();
  25452. bindEvents();
  25453. requestAnimationFrame(doLayout);
  25454. resizeState.value = {
  25455. width: tableWidth.value = table.vnode.el.offsetWidth,
  25456. height: table.vnode.el.offsetHeight
  25457. };
  25458. store.states.columns.value.forEach((column) => {
  25459. if (column.filteredValue && column.filteredValue.length) {
  25460. table.store.commit("filterChange", {
  25461. column,
  25462. values: column.filteredValue,
  25463. silent: true
  25464. });
  25465. }
  25466. });
  25467. table.$ready = true;
  25468. });
  25469. const setScrollClassByEl = (el, className) => {
  25470. if (!el)
  25471. return;
  25472. const classList = Array.from(el.classList).filter((item) => !item.startsWith("is-scrolling-"));
  25473. classList.push(layout.scrollX.value ? className : "is-scrolling-none");
  25474. el.className = classList.join(" ");
  25475. };
  25476. const setScrollClass = (className) => {
  25477. const { tableWrapper } = table.refs;
  25478. setScrollClassByEl(tableWrapper, className);
  25479. };
  25480. const hasScrollClass = (className) => {
  25481. const { tableWrapper } = table.refs;
  25482. if (tableWrapper && tableWrapper.classList.contains(className)) {
  25483. return true;
  25484. }
  25485. return false;
  25486. };
  25487. const syncPostion = function() {
  25488. if (!table.refs.scrollBarRef)
  25489. return;
  25490. if (!layout.scrollX.value) {
  25491. const scrollingNoneClass = "is-scrolling-none";
  25492. if (!hasScrollClass(scrollingNoneClass)) {
  25493. setScrollClass(scrollingNoneClass);
  25494. }
  25495. return;
  25496. }
  25497. const scrollContainer = table.refs.scrollBarRef.wrap$;
  25498. if (!scrollContainer)
  25499. return;
  25500. const { scrollLeft, offsetWidth, scrollWidth } = scrollContainer;
  25501. const { headerWrapper, footerWrapper } = table.refs;
  25502. if (headerWrapper)
  25503. headerWrapper.scrollLeft = scrollLeft;
  25504. if (footerWrapper)
  25505. footerWrapper.scrollLeft = scrollLeft;
  25506. const maxScrollLeftPosition = scrollWidth - offsetWidth - 1;
  25507. if (scrollLeft >= maxScrollLeftPosition) {
  25508. setScrollClass("is-scrolling-right");
  25509. } else if (scrollLeft === 0) {
  25510. setScrollClass("is-scrolling-left");
  25511. } else {
  25512. setScrollClass("is-scrolling-middle");
  25513. }
  25514. };
  25515. const bindEvents = () => {
  25516. var _a2;
  25517. if (!table.refs.scrollBarRef)
  25518. return;
  25519. (_a2 = table.refs.scrollBarRef.wrap$) == null ? void 0 : _a2.addEventListener("scroll", syncPostion, {
  25520. passive: true
  25521. });
  25522. if (props.fit) {
  25523. addResizeListener(table.vnode.el, resizeListener);
  25524. } else {
  25525. on(window, "resize", doLayout);
  25526. }
  25527. };
  25528. onBeforeUnmount(() => {
  25529. unbindEvents();
  25530. });
  25531. const unbindEvents = () => {
  25532. var _a2;
  25533. (_a2 = table.refs.scrollBarRef.wrap$) == null ? void 0 : _a2.removeEventListener("scroll", syncPostion, true);
  25534. if (props.fit) {
  25535. removeResizeListener(table.vnode.el, resizeListener);
  25536. } else {
  25537. off(window, "resize", doLayout);
  25538. }
  25539. };
  25540. const resizeListener = () => {
  25541. if (!table.$ready)
  25542. return;
  25543. let shouldUpdateLayout = false;
  25544. const el = table.vnode.el;
  25545. const { width: oldWidth, height: oldHeight } = resizeState.value;
  25546. const width = tableWidth.value = el.offsetWidth;
  25547. if (oldWidth !== width) {
  25548. shouldUpdateLayout = true;
  25549. }
  25550. const height2 = el.offsetHeight;
  25551. if ((props.height || shouldUpdateHeight.value) && oldHeight !== height2) {
  25552. shouldUpdateLayout = true;
  25553. }
  25554. if (shouldUpdateLayout) {
  25555. resizeState.value = {
  25556. width,
  25557. height: height2
  25558. };
  25559. doLayout();
  25560. }
  25561. };
  25562. const tableSize = useSize();
  25563. const bodyWidth = computed(() => {
  25564. const { bodyWidth: bodyWidth_, scrollY, gutterWidth } = layout;
  25565. return bodyWidth_.value ? `${bodyWidth_.value - (scrollY.value ? gutterWidth : 0)}px` : "";
  25566. });
  25567. const tableLayout = computed(() => {
  25568. if (props.maxHeight)
  25569. return "fixed";
  25570. return props.tableLayout;
  25571. });
  25572. function calcMaxHeight(maxHeight, footerHeight, headerHeight) {
  25573. const parsedMaxHeight = parseHeight(maxHeight);
  25574. const tableHeaderHeight = props.showHeader ? headerHeight : 0;
  25575. if (parsedMaxHeight === null)
  25576. return;
  25577. if (isString(parsedMaxHeight)) {
  25578. return `calc(${parsedMaxHeight} - ${footerHeight}px - ${tableHeaderHeight}px)`;
  25579. }
  25580. return parsedMaxHeight - footerHeight - tableHeaderHeight;
  25581. }
  25582. const height = computed(() => {
  25583. const headerHeight = layout.headerHeight.value || 0;
  25584. const bodyHeight2 = layout.bodyHeight.value;
  25585. const footerHeight = layout.footerHeight.value || 0;
  25586. if (props.height) {
  25587. return bodyHeight2 ? bodyHeight2 : void 0;
  25588. } else if (props.maxHeight) {
  25589. return calcMaxHeight(props.maxHeight, footerHeight, headerHeight);
  25590. }
  25591. return void 0;
  25592. });
  25593. const bodyHeight = computed(() => {
  25594. const headerHeight = layout.headerHeight.value || 0;
  25595. const bodyHeight2 = layout.bodyHeight.value;
  25596. const footerHeight = layout.footerHeight.value || 0;
  25597. if (props.height) {
  25598. return {
  25599. height: bodyHeight2 ? `${bodyHeight2}px` : ""
  25600. };
  25601. } else if (props.maxHeight) {
  25602. const maxHeight = calcMaxHeight(props.maxHeight, footerHeight, headerHeight);
  25603. if (maxHeight !== null) {
  25604. return {
  25605. "max-height": `${maxHeight}${isNumber(maxHeight) ? "px" : ""}`
  25606. };
  25607. }
  25608. }
  25609. return {};
  25610. });
  25611. const emptyBlockStyle = computed(() => {
  25612. if (props.data && props.data.length)
  25613. return null;
  25614. let height2 = "100%";
  25615. if (layout.appendHeight.value) {
  25616. height2 = `calc(100% - ${layout.appendHeight.value}px)`;
  25617. }
  25618. return {
  25619. width: tableWidth.value ? `${tableWidth.value}px` : "",
  25620. height: height2
  25621. };
  25622. });
  25623. const handleFixedMousewheel = (event, data2) => {
  25624. const bodyWrapper = table.refs.bodyWrapper;
  25625. if (Math.abs(data2.spinY) > 0) {
  25626. const currentScrollTop = bodyWrapper.scrollTop;
  25627. if (data2.pixelY < 0 && currentScrollTop !== 0) {
  25628. event.preventDefault();
  25629. }
  25630. if (data2.pixelY > 0 && bodyWrapper.scrollHeight - bodyWrapper.clientHeight > currentScrollTop) {
  25631. event.preventDefault();
  25632. }
  25633. bodyWrapper.scrollTop += Math.ceil(data2.pixelY / 5);
  25634. } else {
  25635. bodyWrapper.scrollLeft += Math.ceil(data2.pixelX / 5);
  25636. }
  25637. };
  25638. const fixedHeight = computed(() => {
  25639. if (props.maxHeight) {
  25640. if (props.showSummary) {
  25641. return {
  25642. bottom: 0
  25643. };
  25644. }
  25645. return {
  25646. bottom: layout.scrollX.value && props.data.length ? `${layout.gutterWidth}px` : ""
  25647. };
  25648. } else {
  25649. if (props.showSummary) {
  25650. return {
  25651. height: layout.tableHeight.value ? `${layout.tableHeight.value}px` : ""
  25652. };
  25653. }
  25654. return {
  25655. height: layout.viewportHeight.value ? `${layout.viewportHeight.value}px` : ""
  25656. };
  25657. }
  25658. });
  25659. const fixedBodyHeight = computed(() => {
  25660. if (props.height) {
  25661. return {
  25662. height: layout.fixedBodyHeight.value ? `${layout.fixedBodyHeight.value}px` : ""
  25663. };
  25664. } else if (props.maxHeight) {
  25665. let maxHeight = parseHeight(props.maxHeight);
  25666. if (typeof maxHeight === "number") {
  25667. maxHeight = layout.scrollX.value ? maxHeight - layout.gutterWidth : maxHeight;
  25668. if (props.showHeader) {
  25669. maxHeight -= layout.headerHeight.value;
  25670. }
  25671. maxHeight -= layout.footerHeight.value;
  25672. return {
  25673. "max-height": `${maxHeight}px`
  25674. };
  25675. }
  25676. }
  25677. return {};
  25678. });
  25679. return {
  25680. isHidden,
  25681. renderExpanded,
  25682. setDragVisible,
  25683. isGroup,
  25684. handleMouseLeave,
  25685. handleHeaderFooterMousewheel,
  25686. tableSize,
  25687. bodyHeight,
  25688. height,
  25689. emptyBlockStyle,
  25690. handleFixedMousewheel,
  25691. fixedHeight,
  25692. fixedBodyHeight,
  25693. resizeProxyVisible,
  25694. bodyWidth,
  25695. resizeState,
  25696. doLayout,
  25697. tableBodyStyles,
  25698. tableLayout,
  25699. scrollbarViewStyle
  25700. };
  25701. }
  25702. var defaultProps$1 = {
  25703. data: {
  25704. type: Array,
  25705. default: () => {
  25706. return [];
  25707. }
  25708. },
  25709. size: String,
  25710. width: [String, Number],
  25711. height: [String, Number],
  25712. maxHeight: [String, Number],
  25713. fit: {
  25714. type: Boolean,
  25715. default: true
  25716. },
  25717. stripe: Boolean,
  25718. border: Boolean,
  25719. rowKey: [String, Function],
  25720. showHeader: {
  25721. type: Boolean,
  25722. default: true
  25723. },
  25724. showSummary: Boolean,
  25725. sumText: String,
  25726. summaryMethod: Function,
  25727. rowClassName: [String, Function],
  25728. rowStyle: [Object, Function],
  25729. cellClassName: [String, Function],
  25730. cellStyle: [Object, Function],
  25731. headerRowClassName: [String, Function],
  25732. headerRowStyle: [Object, Function],
  25733. headerCellClassName: [String, Function],
  25734. headerCellStyle: [Object, Function],
  25735. highlightCurrentRow: Boolean,
  25736. currentRowKey: [String, Number],
  25737. emptyText: String,
  25738. expandRowKeys: Array,
  25739. defaultExpandAll: Boolean,
  25740. defaultSort: Object,
  25741. tooltipEffect: String,
  25742. spanMethod: Function,
  25743. selectOnIndeterminate: {
  25744. type: Boolean,
  25745. default: true
  25746. },
  25747. indent: {
  25748. type: Number,
  25749. default: 16
  25750. },
  25751. treeProps: {
  25752. type: Object,
  25753. default: () => {
  25754. return {
  25755. hasChildren: "hasChildren",
  25756. children: "children"
  25757. };
  25758. }
  25759. },
  25760. lazy: Boolean,
  25761. load: Function,
  25762. style: {
  25763. type: Object,
  25764. default: () => ({})
  25765. },
  25766. className: {
  25767. type: String,
  25768. default: ""
  25769. },
  25770. tableLayout: {
  25771. type: String,
  25772. default: "fixed"
  25773. },
  25774. scrollbarAlwaysOn: {
  25775. type: Boolean,
  25776. default: false
  25777. }
  25778. };
  25779. const useScrollbar = () => {
  25780. const scrollBarRef = ref();
  25781. const scrollTo = (options, yCoord) => {
  25782. const scrollbar = scrollBarRef.value;
  25783. if (scrollbar) {
  25784. scrollbar.scrollTo(options, yCoord);
  25785. }
  25786. };
  25787. const setScrollPosition = (position, offset2) => {
  25788. const scrollbar = scrollBarRef.value;
  25789. if (scrollbar && isNumber(offset2) && ["Top", "Left"].includes(position)) {
  25790. scrollbar[`setScroll${position}`](offset2);
  25791. }
  25792. };
  25793. const setScrollTop = (top2) => setScrollPosition("Top", top2);
  25794. const setScrollLeft = (left2) => setScrollPosition("Left", left2);
  25795. return {
  25796. scrollBarRef,
  25797. scrollTo,
  25798. setScrollTop,
  25799. setScrollLeft
  25800. };
  25801. };
  25802. let tableIdSeed = 1;
  25803. const _sfc_main$e = defineComponent({
  25804. name: "ElTable",
  25805. directives: {
  25806. Mousewheel
  25807. },
  25808. components: {
  25809. TableHeader,
  25810. TableBody,
  25811. TableFooter,
  25812. ElScrollbar,
  25813. hColgroup
  25814. },
  25815. props: defaultProps$1,
  25816. emits: [
  25817. "select",
  25818. "select-all",
  25819. "selection-change",
  25820. "cell-mouse-enter",
  25821. "cell-mouse-leave",
  25822. "cell-contextmenu",
  25823. "cell-click",
  25824. "cell-dblclick",
  25825. "row-click",
  25826. "row-contextmenu",
  25827. "row-dblclick",
  25828. "header-click",
  25829. "header-contextmenu",
  25830. "sort-change",
  25831. "filter-change",
  25832. "current-change",
  25833. "header-dragend",
  25834. "expand-change"
  25835. ],
  25836. setup(props) {
  25837. const { t } = useLocale();
  25838. const ns = useNamespace("table");
  25839. const table = getCurrentInstance();
  25840. provide(TABLE_INJECTION_KEY, table);
  25841. const store = createStore(table, props);
  25842. table.store = store;
  25843. const layout = new TableLayout({
  25844. store: table.store,
  25845. table,
  25846. fit: props.fit,
  25847. showHeader: props.showHeader
  25848. });
  25849. table.layout = layout;
  25850. const isEmpty3 = computed(() => (store.states.data.value || []).length === 0);
  25851. const {
  25852. setCurrentRow,
  25853. getSelectionRows,
  25854. toggleRowSelection,
  25855. clearSelection,
  25856. clearFilter,
  25857. toggleAllSelection,
  25858. toggleRowExpansion,
  25859. clearSort,
  25860. sort
  25861. } = useUtils(store);
  25862. const {
  25863. isHidden,
  25864. renderExpanded,
  25865. setDragVisible,
  25866. isGroup,
  25867. handleMouseLeave,
  25868. handleHeaderFooterMousewheel,
  25869. tableSize,
  25870. bodyHeight,
  25871. height,
  25872. emptyBlockStyle,
  25873. handleFixedMousewheel,
  25874. fixedHeight,
  25875. fixedBodyHeight,
  25876. resizeProxyVisible,
  25877. bodyWidth,
  25878. resizeState,
  25879. doLayout,
  25880. tableBodyStyles,
  25881. tableLayout,
  25882. scrollbarViewStyle
  25883. } = useStyle(props, layout, store, table);
  25884. const { scrollBarRef, scrollTo, setScrollLeft, setScrollTop } = useScrollbar();
  25885. const debouncedUpdateLayout = debounce$1(doLayout, 50);
  25886. const tableId = `el-table_${tableIdSeed++}`;
  25887. table.tableId = tableId;
  25888. table.state = {
  25889. isGroup,
  25890. resizeState,
  25891. doLayout,
  25892. debouncedUpdateLayout
  25893. };
  25894. const computedSumText = computed(() => props.sumText || t("el.table.sumText"));
  25895. const computedEmptyText = computed(() => {
  25896. return props.emptyText || t("el.table.emptyText");
  25897. });
  25898. return {
  25899. ns,
  25900. layout,
  25901. store,
  25902. handleHeaderFooterMousewheel,
  25903. handleMouseLeave,
  25904. tableId,
  25905. tableSize,
  25906. isHidden,
  25907. isEmpty: isEmpty3,
  25908. renderExpanded,
  25909. resizeProxyVisible,
  25910. resizeState,
  25911. isGroup,
  25912. bodyWidth,
  25913. bodyHeight,
  25914. height,
  25915. tableBodyStyles,
  25916. emptyBlockStyle,
  25917. debouncedUpdateLayout,
  25918. handleFixedMousewheel,
  25919. fixedHeight,
  25920. fixedBodyHeight,
  25921. setCurrentRow,
  25922. getSelectionRows,
  25923. toggleRowSelection,
  25924. clearSelection,
  25925. clearFilter,
  25926. toggleAllSelection,
  25927. toggleRowExpansion,
  25928. clearSort,
  25929. doLayout,
  25930. sort,
  25931. t,
  25932. setDragVisible,
  25933. context: table,
  25934. computedSumText,
  25935. computedEmptyText,
  25936. tableLayout,
  25937. scrollbarViewStyle,
  25938. scrollBarRef,
  25939. scrollTo,
  25940. setScrollLeft,
  25941. setScrollTop
  25942. };
  25943. }
  25944. });
  25945. const _hoisted_1$b = ["data-prefix"];
  25946. const _hoisted_2$9 = {
  25947. ref: "hiddenColumns",
  25948. class: "hidden-columns"
  25949. };
  25950. function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
  25951. const _component_hColgroup = resolveComponent("hColgroup");
  25952. const _component_table_header = resolveComponent("table-header");
  25953. const _component_table_body = resolveComponent("table-body");
  25954. const _component_el_scrollbar = resolveComponent("el-scrollbar");
  25955. const _component_table_footer = resolveComponent("table-footer");
  25956. const _directive_mousewheel = resolveDirective("mousewheel");
  25957. return openBlock(), createElementBlock("div", {
  25958. ref: "tableWrapper",
  25959. class: normalizeClass([
  25960. {
  25961. [_ctx.ns.m("fit")]: _ctx.fit,
  25962. [_ctx.ns.m("striped")]: _ctx.stripe,
  25963. [_ctx.ns.m("border")]: _ctx.border || _ctx.isGroup,
  25964. [_ctx.ns.m("hidden")]: _ctx.isHidden,
  25965. [_ctx.ns.m("group")]: _ctx.isGroup,
  25966. [_ctx.ns.m("fluid-height")]: _ctx.maxHeight,
  25967. [_ctx.ns.m("scrollable-x")]: _ctx.layout.scrollX.value,
  25968. [_ctx.ns.m("scrollable-y")]: _ctx.layout.scrollY.value,
  25969. [_ctx.ns.m("enable-row-hover")]: !_ctx.store.states.isComplex.value,
  25970. [_ctx.ns.m("enable-row-transition")]: (_ctx.store.states.data.value || []).length !== 0 && (_ctx.store.states.data.value || []).length < 100,
  25971. "has-footer": _ctx.showSummary
  25972. },
  25973. _ctx.ns.m(_ctx.tableSize),
  25974. _ctx.className,
  25975. _ctx.ns.b(),
  25976. _ctx.ns.m(`layout-${_ctx.tableLayout}`)
  25977. ]),
  25978. style: normalizeStyle(_ctx.style),
  25979. "data-prefix": _ctx.ns.namespace.value,
  25980. onMouseleave: _cache[0] || (_cache[0] = ($event) => _ctx.handleMouseLeave())
  25981. }, [
  25982. createElementVNode("div", {
  25983. class: normalizeClass(_ctx.ns.e("inner-wrapper"))
  25984. }, [
  25985. createElementVNode("div", _hoisted_2$9, [
  25986. renderSlot(_ctx.$slots, "default")
  25987. ], 512),
  25988. _ctx.showHeader && _ctx.tableLayout === "fixed" ? withDirectives((openBlock(), createElementBlock("div", {
  25989. key: 0,
  25990. ref: "headerWrapper",
  25991. class: normalizeClass(_ctx.ns.e("header-wrapper"))
  25992. }, [
  25993. createElementVNode("table", {
  25994. ref: "tableHeader",
  25995. class: normalizeClass(_ctx.ns.e("header")),
  25996. style: normalizeStyle(_ctx.tableBodyStyles),
  25997. border: "0",
  25998. cellpadding: "0",
  25999. cellspacing: "0"
  26000. }, [
  26001. createVNode(_component_hColgroup, {
  26002. columns: _ctx.store.states.columns.value,
  26003. "table-layout": _ctx.tableLayout
  26004. }, null, 8, ["columns", "table-layout"]),
  26005. createVNode(_component_table_header, {
  26006. ref: "tableHeaderRef",
  26007. border: _ctx.border,
  26008. "default-sort": _ctx.defaultSort,
  26009. store: _ctx.store,
  26010. onSetDragVisible: _ctx.setDragVisible
  26011. }, null, 8, ["border", "default-sort", "store", "onSetDragVisible"])
  26012. ], 6)
  26013. ], 2)), [
  26014. [_directive_mousewheel, _ctx.handleHeaderFooterMousewheel]
  26015. ]) : createCommentVNode("v-if", true),
  26016. createElementVNode("div", {
  26017. ref: "bodyWrapper",
  26018. style: normalizeStyle(_ctx.bodyHeight),
  26019. class: normalizeClass(_ctx.ns.e("body-wrapper"))
  26020. }, [
  26021. createVNode(_component_el_scrollbar, {
  26022. ref: "scrollBarRef",
  26023. height: _ctx.maxHeight ? void 0 : _ctx.height,
  26024. "max-height": _ctx.maxHeight ? _ctx.height : void 0,
  26025. "view-style": _ctx.scrollbarViewStyle,
  26026. always: _ctx.scrollbarAlwaysOn
  26027. }, {
  26028. default: withCtx(() => [
  26029. createElementVNode("table", {
  26030. ref: "tableBody",
  26031. class: normalizeClass(_ctx.ns.e("body")),
  26032. cellspacing: "0",
  26033. cellpadding: "0",
  26034. border: "0",
  26035. style: normalizeStyle({
  26036. width: _ctx.bodyWidth,
  26037. tableLayout: _ctx.tableLayout
  26038. })
  26039. }, [
  26040. createVNode(_component_hColgroup, {
  26041. columns: _ctx.store.states.columns.value,
  26042. "table-layout": _ctx.tableLayout
  26043. }, null, 8, ["columns", "table-layout"]),
  26044. _ctx.showHeader && _ctx.tableLayout === "auto" ? (openBlock(), createBlock(_component_table_header, {
  26045. key: 0,
  26046. border: _ctx.border,
  26047. "default-sort": _ctx.defaultSort,
  26048. store: _ctx.store,
  26049. onSetDragVisible: _ctx.setDragVisible
  26050. }, null, 8, ["border", "default-sort", "store", "onSetDragVisible"])) : createCommentVNode("v-if", true),
  26051. createVNode(_component_table_body, {
  26052. context: _ctx.context,
  26053. highlight: _ctx.highlightCurrentRow,
  26054. "row-class-name": _ctx.rowClassName,
  26055. "tooltip-effect": _ctx.tooltipEffect,
  26056. "row-style": _ctx.rowStyle,
  26057. store: _ctx.store,
  26058. stripe: _ctx.stripe
  26059. }, null, 8, ["context", "highlight", "row-class-name", "tooltip-effect", "row-style", "store", "stripe"])
  26060. ], 6),
  26061. _ctx.isEmpty ? (openBlock(), createElementBlock("div", {
  26062. key: 0,
  26063. ref: "emptyBlock",
  26064. style: normalizeStyle(_ctx.emptyBlockStyle),
  26065. class: normalizeClass(_ctx.ns.e("empty-block"))
  26066. }, [
  26067. createElementVNode("span", {
  26068. class: normalizeClass(_ctx.ns.e("empty-text"))
  26069. }, [
  26070. renderSlot(_ctx.$slots, "empty", {}, () => [
  26071. createTextVNode(toDisplayString(_ctx.computedEmptyText), 1)
  26072. ])
  26073. ], 2)
  26074. ], 6)) : createCommentVNode("v-if", true),
  26075. _ctx.$slots.append ? (openBlock(), createElementBlock("div", {
  26076. key: 1,
  26077. ref: "appendWrapper",
  26078. class: normalizeClass(_ctx.ns.e("append-wrapper"))
  26079. }, [
  26080. renderSlot(_ctx.$slots, "append")
  26081. ], 2)) : createCommentVNode("v-if", true)
  26082. ]),
  26083. _: 3
  26084. }, 8, ["height", "max-height", "view-style", "always"])
  26085. ], 6),
  26086. _ctx.border || _ctx.isGroup ? (openBlock(), createElementBlock("div", {
  26087. key: 1,
  26088. class: normalizeClass(_ctx.ns.e("border-left-patch"))
  26089. }, null, 2)) : createCommentVNode("v-if", true)
  26090. ], 2),
  26091. _ctx.showSummary ? withDirectives((openBlock(), createElementBlock("div", {
  26092. key: 0,
  26093. ref: "footerWrapper",
  26094. class: normalizeClass(_ctx.ns.e("footer-wrapper"))
  26095. }, [
  26096. createVNode(_component_table_footer, {
  26097. border: _ctx.border,
  26098. "default-sort": _ctx.defaultSort,
  26099. store: _ctx.store,
  26100. style: normalizeStyle(_ctx.tableBodyStyles),
  26101. "sum-text": _ctx.computedSumText,
  26102. "summary-method": _ctx.summaryMethod
  26103. }, null, 8, ["border", "default-sort", "store", "style", "sum-text", "summary-method"])
  26104. ], 2)), [
  26105. [vShow, !_ctx.isEmpty],
  26106. [_directive_mousewheel, _ctx.handleHeaderFooterMousewheel]
  26107. ]) : createCommentVNode("v-if", true),
  26108. withDirectives(createElementVNode("div", {
  26109. ref: "resizeProxy",
  26110. class: normalizeClass(_ctx.ns.e("column-resize-proxy"))
  26111. }, null, 2), [
  26112. [vShow, _ctx.resizeProxyVisible]
  26113. ])
  26114. ], 46, _hoisted_1$b);
  26115. }
  26116. var Table = /* @__PURE__ */ _export_sfc$1(_sfc_main$e, [["render", _sfc_render$2], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/table/src/table.vue"]]);
  26117. const defaultClassNames = {
  26118. selection: "table-column--selection",
  26119. expand: "table__expand-column"
  26120. };
  26121. const cellStarts = {
  26122. default: {
  26123. order: ""
  26124. },
  26125. selection: {
  26126. width: 48,
  26127. minWidth: 48,
  26128. realWidth: 48,
  26129. order: ""
  26130. },
  26131. expand: {
  26132. width: 48,
  26133. minWidth: 48,
  26134. realWidth: 48,
  26135. order: ""
  26136. },
  26137. index: {
  26138. width: 48,
  26139. minWidth: 48,
  26140. realWidth: 48,
  26141. order: ""
  26142. }
  26143. };
  26144. const getDefaultClassName = (type4) => {
  26145. return defaultClassNames[type4] || "";
  26146. };
  26147. const cellForced = {
  26148. selection: {
  26149. renderHeader({ store }) {
  26150. function isDisabled() {
  26151. return store.states.data.value && store.states.data.value.length === 0;
  26152. }
  26153. return h$1(ElCheckbox, {
  26154. disabled: isDisabled(),
  26155. size: store.states.tableSize.value,
  26156. indeterminate: store.states.selection.value.length > 0 && !store.states.isAllSelected.value,
  26157. "onUpdate:modelValue": store.toggleAllSelection,
  26158. modelValue: store.states.isAllSelected.value
  26159. });
  26160. },
  26161. renderCell({
  26162. row,
  26163. column,
  26164. store,
  26165. $index
  26166. }) {
  26167. return h$1(ElCheckbox, {
  26168. disabled: column.selectable ? !column.selectable.call(null, row, $index) : false,
  26169. size: store.states.tableSize.value,
  26170. onChange: () => {
  26171. store.commit("rowSelectedChanged", row);
  26172. },
  26173. onClick: (event) => event.stopPropagation(),
  26174. modelValue: store.isSelected(row)
  26175. });
  26176. },
  26177. sortable: false,
  26178. resizable: false
  26179. },
  26180. index: {
  26181. renderHeader({ column }) {
  26182. return column.label || "#";
  26183. },
  26184. renderCell({
  26185. column,
  26186. $index
  26187. }) {
  26188. let i = $index + 1;
  26189. const index = column.index;
  26190. if (typeof index === "number") {
  26191. i = $index + index;
  26192. } else if (typeof index === "function") {
  26193. i = index($index);
  26194. }
  26195. return h$1("div", {}, [i]);
  26196. },
  26197. sortable: false
  26198. },
  26199. expand: {
  26200. renderHeader({ column }) {
  26201. return column.label || "";
  26202. },
  26203. renderCell({
  26204. row,
  26205. store,
  26206. expanded
  26207. }) {
  26208. const { ns } = store;
  26209. const classes = [ns.e("expand-icon")];
  26210. if (expanded) {
  26211. classes.push(ns.em("expand-icon", "expanded"));
  26212. }
  26213. const callback = function(e) {
  26214. e.stopPropagation();
  26215. store.toggleRowExpansion(row);
  26216. };
  26217. return h$1("div", {
  26218. class: classes,
  26219. onClick: callback
  26220. }, {
  26221. default: () => {
  26222. return [
  26223. h$1(ElIcon, null, {
  26224. default: () => {
  26225. return [h$1(arrowRight)];
  26226. }
  26227. })
  26228. ];
  26229. }
  26230. });
  26231. },
  26232. sortable: false,
  26233. resizable: false
  26234. }
  26235. };
  26236. function defaultRenderCell({
  26237. row,
  26238. column,
  26239. $index
  26240. }) {
  26241. var _a2;
  26242. const property = column.property;
  26243. const value = property && getProp(row, property).value;
  26244. if (column && column.formatter) {
  26245. return column.formatter(row, column, value, $index);
  26246. }
  26247. return ((_a2 = value == null ? void 0 : value.toString) == null ? void 0 : _a2.call(value)) || "";
  26248. }
  26249. function treeCellPrefix({
  26250. row,
  26251. treeNode,
  26252. store
  26253. }, createPlacehoder = false) {
  26254. const { ns } = store;
  26255. if (!treeNode) {
  26256. if (createPlacehoder) {
  26257. return [
  26258. h$1("span", {
  26259. class: ns.e("placeholder")
  26260. })
  26261. ];
  26262. }
  26263. return null;
  26264. }
  26265. const ele = [];
  26266. const callback = function(e) {
  26267. e.stopPropagation();
  26268. store.loadOrToggle(row);
  26269. };
  26270. if (treeNode.indent) {
  26271. ele.push(h$1("span", {
  26272. class: ns.e("indent"),
  26273. style: { "padding-left": `${treeNode.indent}px` }
  26274. }));
  26275. }
  26276. if (typeof treeNode.expanded === "boolean" && !treeNode.noLazyChildren) {
  26277. const expandClasses = [
  26278. ns.e("expand-icon"),
  26279. treeNode.expanded ? ns.em("expand-icon", "expanded") : ""
  26280. ];
  26281. let icon = arrowRight;
  26282. if (treeNode.loading) {
  26283. icon = loading;
  26284. }
  26285. ele.push(h$1("div", {
  26286. class: expandClasses,
  26287. onClick: callback
  26288. }, {
  26289. default: () => {
  26290. return [
  26291. h$1(ElIcon, { class: { [ns.is("loading")]: treeNode.loading } }, {
  26292. default: () => [h$1(icon)]
  26293. })
  26294. ];
  26295. }
  26296. }));
  26297. } else {
  26298. ele.push(h$1("span", {
  26299. class: ns.e("placeholder")
  26300. }));
  26301. }
  26302. return ele;
  26303. }
  26304. function getAllAliases(props, aliases) {
  26305. return props.reduce((prev, cur) => {
  26306. prev[cur] = cur;
  26307. return prev;
  26308. }, aliases);
  26309. }
  26310. function useWatcher(owner, props_) {
  26311. const instance = getCurrentInstance();
  26312. const registerComplexWatchers = () => {
  26313. const props = ["fixed"];
  26314. const aliases = {
  26315. realWidth: "width",
  26316. realMinWidth: "minWidth"
  26317. };
  26318. const allAliases = getAllAliases(props, aliases);
  26319. Object.keys(allAliases).forEach((key) => {
  26320. const columnKey = aliases[key];
  26321. if (hasOwn(props_, columnKey)) {
  26322. watch(() => props_[columnKey], (newVal) => {
  26323. let value = newVal;
  26324. if (columnKey === "width" && key === "realWidth") {
  26325. value = parseWidth(newVal);
  26326. }
  26327. if (columnKey === "minWidth" && key === "realMinWidth") {
  26328. value = parseMinWidth(newVal);
  26329. }
  26330. instance.columnConfig.value[columnKey] = value;
  26331. instance.columnConfig.value[key] = value;
  26332. const updateColumns = columnKey === "fixed";
  26333. owner.value.store.scheduleLayout(updateColumns);
  26334. });
  26335. }
  26336. });
  26337. };
  26338. const registerNormalWatchers = () => {
  26339. const props = [
  26340. "label",
  26341. "filters",
  26342. "filterMultiple",
  26343. "sortable",
  26344. "index",
  26345. "formatter",
  26346. "className",
  26347. "labelClassName",
  26348. "showOverflowTooltip"
  26349. ];
  26350. const aliases = {
  26351. property: "prop",
  26352. align: "realAlign",
  26353. headerAlign: "realHeaderAlign"
  26354. };
  26355. const allAliases = getAllAliases(props, aliases);
  26356. Object.keys(allAliases).forEach((key) => {
  26357. const columnKey = aliases[key];
  26358. if (hasOwn(props_, columnKey)) {
  26359. watch(() => props_[columnKey], (newVal) => {
  26360. instance.columnConfig.value[key] = newVal;
  26361. });
  26362. }
  26363. });
  26364. };
  26365. return {
  26366. registerComplexWatchers,
  26367. registerNormalWatchers
  26368. };
  26369. }
  26370. function useRender(props, slots, owner) {
  26371. const instance = getCurrentInstance();
  26372. const columnId = ref("");
  26373. const isSubColumn = ref(false);
  26374. const realAlign = ref();
  26375. const realHeaderAlign = ref();
  26376. const ns = useNamespace("table");
  26377. watchEffect(() => {
  26378. realAlign.value = props.align ? `is-${props.align}` : null;
  26379. realAlign.value;
  26380. });
  26381. watchEffect(() => {
  26382. realHeaderAlign.value = props.headerAlign ? `is-${props.headerAlign}` : realAlign.value;
  26383. realHeaderAlign.value;
  26384. });
  26385. const columnOrTableParent = computed(() => {
  26386. let parent = instance.vnode.vParent || instance.parent;
  26387. while (parent && !parent.tableId && !parent.columnId) {
  26388. parent = parent.vnode.vParent || parent.parent;
  26389. }
  26390. return parent;
  26391. });
  26392. const hasTreeColumn = computed(() => {
  26393. const { store } = instance.parent;
  26394. if (!store)
  26395. return false;
  26396. const { treeData } = store.states;
  26397. const treeDataValue = treeData.value;
  26398. return treeDataValue && Object.keys(treeDataValue).length > 0;
  26399. });
  26400. const realWidth = ref(parseWidth(props.width));
  26401. const realMinWidth = ref(parseMinWidth(props.minWidth));
  26402. const setColumnWidth = (column) => {
  26403. if (realWidth.value)
  26404. column.width = realWidth.value;
  26405. if (realMinWidth.value) {
  26406. column.minWidth = realMinWidth.value;
  26407. }
  26408. if (!column.minWidth) {
  26409. column.minWidth = 80;
  26410. }
  26411. column.realWidth = Number(column.width === void 0 ? column.minWidth : column.width);
  26412. return column;
  26413. };
  26414. const setColumnForcedProps = (column) => {
  26415. const type4 = column.type;
  26416. const source = cellForced[type4] || {};
  26417. Object.keys(source).forEach((prop) => {
  26418. const value = source[prop];
  26419. if (prop !== "className" && value !== void 0) {
  26420. column[prop] = value;
  26421. }
  26422. });
  26423. const className = getDefaultClassName(type4);
  26424. if (className) {
  26425. const forceClass = `${unref(ns.namespace)}-${className}`;
  26426. column.className = column.className ? `${column.className} ${forceClass}` : forceClass;
  26427. }
  26428. return column;
  26429. };
  26430. const checkSubColumn = (children) => {
  26431. if (Array.isArray(children)) {
  26432. children.forEach((child) => check2(child));
  26433. } else {
  26434. check2(children);
  26435. }
  26436. function check2(item) {
  26437. var _a2;
  26438. if (((_a2 = item == null ? void 0 : item.type) == null ? void 0 : _a2.name) === "ElTableColumn") {
  26439. item.vParent = instance;
  26440. }
  26441. }
  26442. };
  26443. const setColumnRenders = (column) => {
  26444. if (props.renderHeader)
  26445. ;
  26446. else if (column.type !== "selection") {
  26447. column.renderHeader = (scope) => {
  26448. instance.columnConfig.value["label"];
  26449. const renderHeader = slots.header;
  26450. return renderHeader ? renderHeader(scope) : column.label;
  26451. };
  26452. }
  26453. let originRenderCell = column.renderCell;
  26454. const hasTreeColumnValue = hasTreeColumn.value;
  26455. if (column.type === "expand") {
  26456. column.renderCell = (data2) => h$1("div", {
  26457. class: "cell"
  26458. }, [originRenderCell(data2)]);
  26459. owner.value.renderExpanded = (data2) => {
  26460. return slots.default ? slots.default(data2) : slots.default;
  26461. };
  26462. } else {
  26463. originRenderCell = originRenderCell || defaultRenderCell;
  26464. column.renderCell = (data2) => {
  26465. let children = null;
  26466. if (slots.default) {
  26467. const vnodes = slots.default(data2);
  26468. children = vnodes.some((v2) => v2.type !== Comment) ? vnodes : originRenderCell(data2);
  26469. } else {
  26470. children = originRenderCell(data2);
  26471. }
  26472. const shouldCreatePlaceholder = hasTreeColumnValue && data2.cellIndex === 0;
  26473. const prefix = treeCellPrefix(data2, shouldCreatePlaceholder);
  26474. const props2 = {
  26475. class: "cell",
  26476. style: {}
  26477. };
  26478. if (column.showOverflowTooltip) {
  26479. props2.class = `${props2.class} ${unref(ns.namespace)}-tooltip`;
  26480. props2.style = {
  26481. width: `${(data2.column.realWidth || Number(data2.column.width)) - 1}px`
  26482. };
  26483. }
  26484. checkSubColumn(children);
  26485. return h$1("div", props2, [prefix, children]);
  26486. };
  26487. }
  26488. return column;
  26489. };
  26490. const getPropsData = (...propsKey) => {
  26491. return propsKey.reduce((prev, cur) => {
  26492. if (Array.isArray(cur)) {
  26493. cur.forEach((key) => {
  26494. prev[key] = props[key];
  26495. });
  26496. }
  26497. return prev;
  26498. }, {});
  26499. };
  26500. const getColumnElIndex = (children, child) => {
  26501. return Array.prototype.indexOf.call(children, child);
  26502. };
  26503. return {
  26504. columnId,
  26505. realAlign,
  26506. isSubColumn,
  26507. realHeaderAlign,
  26508. columnOrTableParent,
  26509. setColumnWidth,
  26510. setColumnForcedProps,
  26511. setColumnRenders,
  26512. getPropsData,
  26513. getColumnElIndex
  26514. };
  26515. }
  26516. var defaultProps = {
  26517. type: {
  26518. type: String,
  26519. default: "default"
  26520. },
  26521. label: String,
  26522. className: String,
  26523. labelClassName: String,
  26524. property: String,
  26525. prop: String,
  26526. width: {
  26527. type: [String, Number],
  26528. default: ""
  26529. },
  26530. minWidth: {
  26531. type: [String, Number],
  26532. default: ""
  26533. },
  26534. renderHeader: Function,
  26535. sortable: {
  26536. type: [Boolean, String],
  26537. default: false
  26538. },
  26539. sortMethod: Function,
  26540. sortBy: [String, Function, Array],
  26541. resizable: {
  26542. type: Boolean,
  26543. default: true
  26544. },
  26545. columnKey: String,
  26546. align: String,
  26547. headerAlign: String,
  26548. showTooltipWhenOverflow: Boolean,
  26549. showOverflowTooltip: Boolean,
  26550. fixed: [Boolean, String],
  26551. formatter: Function,
  26552. selectable: Function,
  26553. reserveSelection: Boolean,
  26554. filterMethod: Function,
  26555. filteredValue: Array,
  26556. filters: Array,
  26557. filterPlacement: String,
  26558. filterMultiple: {
  26559. type: Boolean,
  26560. default: true
  26561. },
  26562. index: [Number, Function],
  26563. sortOrders: {
  26564. type: Array,
  26565. default: () => {
  26566. return ["ascending", "descending", null];
  26567. },
  26568. validator: (val) => {
  26569. return val.every((order2) => ["ascending", "descending", null].includes(order2));
  26570. }
  26571. }
  26572. };
  26573. let columnIdSeed = 1;
  26574. var ElTableColumn$1 = defineComponent({
  26575. name: "ElTableColumn",
  26576. components: {
  26577. ElCheckbox
  26578. },
  26579. props: defaultProps,
  26580. setup(props, { slots }) {
  26581. const instance = getCurrentInstance();
  26582. const columnConfig = ref({});
  26583. const owner = computed(() => {
  26584. let parent2 = instance.parent;
  26585. while (parent2 && !parent2.tableId) {
  26586. parent2 = parent2.parent;
  26587. }
  26588. return parent2;
  26589. });
  26590. const { registerNormalWatchers, registerComplexWatchers } = useWatcher(owner, props);
  26591. const {
  26592. columnId,
  26593. isSubColumn,
  26594. realHeaderAlign,
  26595. columnOrTableParent,
  26596. setColumnWidth,
  26597. setColumnForcedProps,
  26598. setColumnRenders,
  26599. getPropsData,
  26600. getColumnElIndex,
  26601. realAlign
  26602. } = useRender(props, slots, owner);
  26603. const parent = columnOrTableParent.value;
  26604. columnId.value = `${parent.tableId || parent.columnId}_column_${columnIdSeed++}`;
  26605. onBeforeMount(() => {
  26606. isSubColumn.value = owner.value !== parent;
  26607. const type4 = props.type || "default";
  26608. const sortable = props.sortable === "" ? true : props.sortable;
  26609. const defaults = __spreadProps(__spreadValues({}, cellStarts[type4]), {
  26610. id: columnId.value,
  26611. type: type4,
  26612. property: props.prop || props.property,
  26613. align: realAlign,
  26614. headerAlign: realHeaderAlign,
  26615. showOverflowTooltip: props.showOverflowTooltip || props.showTooltipWhenOverflow,
  26616. filterable: props.filters || props.filterMethod,
  26617. filteredValue: [],
  26618. filterPlacement: "",
  26619. isColumnGroup: false,
  26620. isSubColumn: false,
  26621. filterOpened: false,
  26622. sortable,
  26623. index: props.index,
  26624. rawColumnKey: instance.vnode.key
  26625. });
  26626. const basicProps = [
  26627. "columnKey",
  26628. "label",
  26629. "className",
  26630. "labelClassName",
  26631. "type",
  26632. "renderHeader",
  26633. "formatter",
  26634. "fixed",
  26635. "resizable"
  26636. ];
  26637. const sortProps = ["sortMethod", "sortBy", "sortOrders"];
  26638. const selectProps = ["selectable", "reserveSelection"];
  26639. const filterProps = [
  26640. "filterMethod",
  26641. "filters",
  26642. "filterMultiple",
  26643. "filterOpened",
  26644. "filteredValue",
  26645. "filterPlacement"
  26646. ];
  26647. let column = getPropsData(basicProps, sortProps, selectProps, filterProps);
  26648. column = mergeOptions(defaults, column);
  26649. const chains = compose(setColumnRenders, setColumnWidth, setColumnForcedProps);
  26650. column = chains(column);
  26651. columnConfig.value = column;
  26652. registerNormalWatchers();
  26653. registerComplexWatchers();
  26654. });
  26655. onMounted(() => {
  26656. var _a2;
  26657. const parent2 = columnOrTableParent.value;
  26658. const children = isSubColumn.value ? parent2.vnode.el.children : (_a2 = parent2.refs.hiddenColumns) == null ? void 0 : _a2.children;
  26659. const getColumnIndex = () => getColumnElIndex(children || [], instance.vnode.el);
  26660. columnConfig.value.getColumnIndex = getColumnIndex;
  26661. const columnIndex = getColumnIndex();
  26662. columnIndex > -1 && owner.value.store.commit("insertColumn", columnConfig.value, isSubColumn.value ? parent2.columnConfig.value : null);
  26663. });
  26664. onBeforeUnmount(() => {
  26665. owner.value.store.commit("removeColumn", columnConfig.value, isSubColumn.value ? parent.columnConfig.value : null);
  26666. });
  26667. instance.columnId = columnId.value;
  26668. instance.columnConfig = columnConfig;
  26669. return;
  26670. },
  26671. render() {
  26672. var _a2, _b2, _c;
  26673. try {
  26674. const renderDefault = (_b2 = (_a2 = this.$slots).default) == null ? void 0 : _b2.call(_a2, {
  26675. row: {},
  26676. column: {},
  26677. $index: -1
  26678. });
  26679. const children = [];
  26680. if (Array.isArray(renderDefault)) {
  26681. for (const childNode of renderDefault) {
  26682. if (((_c = childNode.type) == null ? void 0 : _c.name) === "ElTableColumn" || childNode.shapeFlag & 2) {
  26683. children.push(childNode);
  26684. } else if (childNode.type === Fragment && Array.isArray(childNode.children)) {
  26685. childNode.children.forEach((vnode2) => {
  26686. if ((vnode2 == null ? void 0 : vnode2.patchFlag) !== 1024 && !isString(vnode2 == null ? void 0 : vnode2.children)) {
  26687. children.push(vnode2);
  26688. }
  26689. });
  26690. }
  26691. }
  26692. }
  26693. const vnode = h$1("div", children);
  26694. return vnode;
  26695. } catch (e) {
  26696. return h$1("div", []);
  26697. }
  26698. }
  26699. });
  26700. const ElTable = withInstall(Table, {
  26701. TableColumn: ElTableColumn$1
  26702. });
  26703. const ElTableColumn = withNoopInstall(ElTableColumn$1);
  26704. const SCOPE$1 = "ElUpload";
  26705. class UploadAjaxError extends Error {
  26706. constructor(message, status, method4, url2) {
  26707. super(message);
  26708. this.name = "UploadAjaxError";
  26709. this.status = status;
  26710. this.method = method4;
  26711. this.url = url2;
  26712. }
  26713. }
  26714. function getError(action, option, xhr) {
  26715. let msg;
  26716. if (xhr.response) {
  26717. msg = `${xhr.response.error || xhr.response}`;
  26718. } else if (xhr.responseText) {
  26719. msg = `${xhr.responseText}`;
  26720. } else {
  26721. msg = `fail to ${option.method} ${action} ${xhr.status}`;
  26722. }
  26723. return new UploadAjaxError(msg, xhr.status, option.method, action);
  26724. }
  26725. function getBody(xhr) {
  26726. const text = xhr.responseText || xhr.response;
  26727. if (!text) {
  26728. return text;
  26729. }
  26730. try {
  26731. return JSON.parse(text);
  26732. } catch (e) {
  26733. return text;
  26734. }
  26735. }
  26736. const ajaxUpload = (option) => {
  26737. if (typeof XMLHttpRequest === "undefined")
  26738. throwError(SCOPE$1, "XMLHttpRequest is undefined");
  26739. const xhr = new XMLHttpRequest();
  26740. const action = option.action;
  26741. if (xhr.upload) {
  26742. xhr.upload.addEventListener("progress", (evt) => {
  26743. const progressEvt = evt;
  26744. progressEvt.percent = evt.total > 0 ? evt.loaded / evt.total * 100 : 0;
  26745. option.onProgress(progressEvt);
  26746. });
  26747. }
  26748. const formData = new FormData();
  26749. if (option.data) {
  26750. for (const [key, value] of Object.entries(option.data)) {
  26751. if (Array.isArray(value))
  26752. formData.append(key, ...value);
  26753. else
  26754. formData.append(key, value);
  26755. }
  26756. }
  26757. formData.append(option.filename, option.file, option.file.name);
  26758. xhr.addEventListener("error", () => {
  26759. option.onError(getError(action, option, xhr));
  26760. });
  26761. xhr.addEventListener("load", () => {
  26762. if (xhr.status < 200 || xhr.status >= 300) {
  26763. return option.onError(getError(action, option, xhr));
  26764. }
  26765. option.onSuccess(getBody(xhr));
  26766. });
  26767. xhr.open(option.method, action, true);
  26768. if (option.withCredentials && "withCredentials" in xhr) {
  26769. xhr.withCredentials = true;
  26770. }
  26771. const headers = option.headers || {};
  26772. if (headers instanceof Headers) {
  26773. headers.forEach((value, key) => xhr.setRequestHeader(key, value));
  26774. } else {
  26775. for (const [key, value] of Object.entries(headers)) {
  26776. if (isNil(value))
  26777. continue;
  26778. xhr.setRequestHeader(key, String(value));
  26779. }
  26780. }
  26781. xhr.send(formData);
  26782. return xhr;
  26783. };
  26784. const uploadListTypes = ["text", "picture", "picture-card"];
  26785. let fileId = 1;
  26786. const genFileId = () => Date.now() + fileId++;
  26787. const uploadBaseProps = buildProps({
  26788. action: {
  26789. type: String,
  26790. required: true
  26791. },
  26792. headers: {
  26793. type: definePropType(Object)
  26794. },
  26795. method: {
  26796. type: String,
  26797. default: "post"
  26798. },
  26799. data: {
  26800. type: Object,
  26801. default: () => mutable({})
  26802. },
  26803. multiple: {
  26804. type: Boolean,
  26805. default: false
  26806. },
  26807. name: {
  26808. type: String,
  26809. default: "file"
  26810. },
  26811. drag: {
  26812. type: Boolean,
  26813. default: false
  26814. },
  26815. withCredentials: Boolean,
  26816. showFileList: {
  26817. type: Boolean,
  26818. default: true
  26819. },
  26820. accept: {
  26821. type: String,
  26822. default: ""
  26823. },
  26824. type: {
  26825. type: String,
  26826. default: "select"
  26827. },
  26828. fileList: {
  26829. type: definePropType(Array),
  26830. default: () => mutable([])
  26831. },
  26832. autoUpload: {
  26833. type: Boolean,
  26834. default: true
  26835. },
  26836. listType: {
  26837. type: String,
  26838. values: uploadListTypes,
  26839. default: "text"
  26840. },
  26841. httpRequest: {
  26842. type: definePropType(Function),
  26843. default: ajaxUpload
  26844. },
  26845. disabled: Boolean,
  26846. limit: Number
  26847. });
  26848. const uploadProps = buildProps(__spreadProps(__spreadValues({}, uploadBaseProps), {
  26849. beforeUpload: {
  26850. type: definePropType(Function),
  26851. default: NOOP
  26852. },
  26853. beforeRemove: {
  26854. type: definePropType(Function)
  26855. },
  26856. onRemove: {
  26857. type: definePropType(Function),
  26858. default: NOOP
  26859. },
  26860. onChange: {
  26861. type: definePropType(Function),
  26862. default: NOOP
  26863. },
  26864. onPreview: {
  26865. type: definePropType(Function),
  26866. default: NOOP
  26867. },
  26868. onSuccess: {
  26869. type: definePropType(Function),
  26870. default: NOOP
  26871. },
  26872. onProgress: {
  26873. type: definePropType(Function),
  26874. default: NOOP
  26875. },
  26876. onError: {
  26877. type: definePropType(Function),
  26878. default: NOOP
  26879. },
  26880. onExceed: {
  26881. type: definePropType(Function),
  26882. default: NOOP
  26883. }
  26884. }));
  26885. const uploadListProps = buildProps({
  26886. files: {
  26887. type: definePropType(Array),
  26888. default: () => mutable([])
  26889. },
  26890. disabled: {
  26891. type: Boolean,
  26892. default: false
  26893. },
  26894. handlePreview: {
  26895. type: definePropType(Function),
  26896. default: NOOP
  26897. },
  26898. listType: {
  26899. type: String,
  26900. values: uploadListTypes,
  26901. default: "text"
  26902. }
  26903. });
  26904. const uploadListEmits = {
  26905. remove: (file) => !!file
  26906. };
  26907. const _hoisted_1$a = ["onKeydown"];
  26908. const _hoisted_2$8 = ["src"];
  26909. const _hoisted_3$6 = ["onClick"];
  26910. const _hoisted_4$6 = ["onClick"];
  26911. const _hoisted_5$6 = ["onClick"];
  26912. const __default__$4 = {
  26913. name: "ElUploadList"
  26914. };
  26915. const _sfc_main$d = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$4), {
  26916. props: uploadListProps,
  26917. emits: uploadListEmits,
  26918. setup(__props, { emit }) {
  26919. const props = __props;
  26920. const { t } = useLocale();
  26921. const nsUpload = useNamespace("upload");
  26922. const nsIcon = useNamespace("icon");
  26923. const nsList = useNamespace("list");
  26924. const focusing = ref(false);
  26925. const handleClick = (file) => {
  26926. props.handlePreview(file);
  26927. };
  26928. const onFileClicked = (e) => {
  26929. e.target.focus();
  26930. };
  26931. const handleRemove = (file) => {
  26932. emit("remove", file);
  26933. };
  26934. return (_ctx, _cache) => {
  26935. return openBlock(), createBlock(TransitionGroup, {
  26936. tag: "ul",
  26937. class: normalizeClass([
  26938. unref(nsUpload).b("list"),
  26939. unref(nsUpload).bm("list", _ctx.listType),
  26940. unref(nsUpload).is("disabled", _ctx.disabled)
  26941. ]),
  26942. name: unref(nsList).b()
  26943. }, {
  26944. default: withCtx(() => [
  26945. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.files, (file) => {
  26946. return openBlock(), createElementBlock("li", {
  26947. key: file.uid || file.name,
  26948. class: normalizeClass([
  26949. unref(nsUpload).be("list", "item"),
  26950. unref(nsUpload).is(file.status),
  26951. { focusing: focusing.value }
  26952. ]),
  26953. tabindex: "0",
  26954. onKeydown: withKeys(($event) => !_ctx.disabled && handleRemove(file), ["delete"]),
  26955. onFocus: _cache[0] || (_cache[0] = ($event) => focusing.value = true),
  26956. onBlur: _cache[1] || (_cache[1] = ($event) => focusing.value = false),
  26957. onClick: onFileClicked
  26958. }, [
  26959. renderSlot(_ctx.$slots, "default", { file }, () => [
  26960. _ctx.listType === "picture" || file.status !== "uploading" && _ctx.listType === "picture-card" ? (openBlock(), createElementBlock("img", {
  26961. key: 0,
  26962. class: normalizeClass(unref(nsUpload).be("list", "item-thumbnail")),
  26963. src: file.url,
  26964. alt: ""
  26965. }, null, 10, _hoisted_2$8)) : createCommentVNode("v-if", true),
  26966. _ctx.listType !== "picture" && (file.status === "uploading" || _ctx.listType !== "picture-card") ? (openBlock(), createElementBlock("div", {
  26967. key: 1,
  26968. class: normalizeClass(unref(nsUpload).be("list", "item-info"))
  26969. }, [
  26970. createElementVNode("a", {
  26971. class: normalizeClass(unref(nsUpload).be("list", "item-name")),
  26972. onClick: ($event) => handleClick(file)
  26973. }, [
  26974. createVNode(unref(ElIcon), {
  26975. class: normalizeClass(unref(nsIcon).m("document"))
  26976. }, {
  26977. default: withCtx(() => [
  26978. createVNode(unref(document$1))
  26979. ]),
  26980. _: 1
  26981. }, 8, ["class"]),
  26982. createTextVNode(" " + toDisplayString(file.name), 1)
  26983. ], 10, _hoisted_3$6),
  26984. file.status === "uploading" ? (openBlock(), createBlock(unref(ElProgress), {
  26985. key: 0,
  26986. type: _ctx.listType === "picture-card" ? "circle" : "line",
  26987. "stroke-width": _ctx.listType === "picture-card" ? 6 : 2,
  26988. percentage: Number(file.percentage),
  26989. style: normalizeStyle(_ctx.listType === "picture-card" ? "" : "margin-top: 0.5rem")
  26990. }, null, 8, ["type", "stroke-width", "percentage", "style"])) : createCommentVNode("v-if", true)
  26991. ], 2)) : createCommentVNode("v-if", true),
  26992. createElementVNode("label", {
  26993. class: normalizeClass(unref(nsUpload).be("list", "item-status-label"))
  26994. }, [
  26995. _ctx.listType === "text" ? (openBlock(), createBlock(unref(ElIcon), {
  26996. key: 0,
  26997. class: normalizeClass([unref(nsIcon).m("upload-success"), unref(nsIcon).m("circle-check")])
  26998. }, {
  26999. default: withCtx(() => [
  27000. createVNode(unref(circleCheck))
  27001. ]),
  27002. _: 1
  27003. }, 8, ["class"])) : ["picture-card", "picture"].includes(_ctx.listType) ? (openBlock(), createBlock(unref(ElIcon), {
  27004. key: 1,
  27005. class: normalizeClass([unref(nsIcon).m("upload-success"), unref(nsIcon).m("check")])
  27006. }, {
  27007. default: withCtx(() => [
  27008. createVNode(unref(check))
  27009. ]),
  27010. _: 1
  27011. }, 8, ["class"])) : createCommentVNode("v-if", true)
  27012. ], 2),
  27013. !_ctx.disabled ? (openBlock(), createBlock(unref(ElIcon), {
  27014. key: 2,
  27015. class: normalizeClass(unref(nsIcon).m("close")),
  27016. onClick: ($event) => handleRemove(file)
  27017. }, {
  27018. default: withCtx(() => [
  27019. createVNode(unref(close))
  27020. ]),
  27021. _: 2
  27022. }, 1032, ["class", "onClick"])) : createCommentVNode("v-if", true),
  27023. createCommentVNode(" Due to close btn only appears when li gets focused disappears after li gets blurred, thus keyboard navigation can never reach close btn"),
  27024. createCommentVNode(" This is a bug which needs to be fixed "),
  27025. createCommentVNode(" TODO: Fix the incorrect navigation interaction "),
  27026. !_ctx.disabled ? (openBlock(), createElementBlock("i", {
  27027. key: 3,
  27028. class: normalizeClass(unref(nsIcon).m("close-tip"))
  27029. }, toDisplayString(unref(t)("el.upload.deleteTip")), 3)) : createCommentVNode("v-if", true),
  27030. _ctx.listType === "picture-card" ? (openBlock(), createElementBlock("span", {
  27031. key: 4,
  27032. class: normalizeClass(unref(nsUpload).be("list", "item-actions"))
  27033. }, [
  27034. createElementVNode("span", {
  27035. class: normalizeClass(unref(nsUpload).be("list", "item-preview")),
  27036. onClick: ($event) => _ctx.handlePreview(file)
  27037. }, [
  27038. createVNode(unref(ElIcon), {
  27039. class: normalizeClass(unref(nsIcon).m("zoom-in"))
  27040. }, {
  27041. default: withCtx(() => [
  27042. createVNode(unref(zoomIn))
  27043. ]),
  27044. _: 1
  27045. }, 8, ["class"])
  27046. ], 10, _hoisted_4$6),
  27047. !_ctx.disabled ? (openBlock(), createElementBlock("span", {
  27048. key: 0,
  27049. class: normalizeClass(unref(nsUpload).be("list", "item-delete")),
  27050. onClick: ($event) => handleRemove(file)
  27051. }, [
  27052. createVNode(unref(ElIcon), {
  27053. class: normalizeClass(unref(nsIcon).m("delete"))
  27054. }, {
  27055. default: withCtx(() => [
  27056. createVNode(unref(_delete))
  27057. ]),
  27058. _: 1
  27059. }, 8, ["class"])
  27060. ], 10, _hoisted_5$6)) : createCommentVNode("v-if", true)
  27061. ], 2)) : createCommentVNode("v-if", true)
  27062. ])
  27063. ], 42, _hoisted_1$a);
  27064. }), 128)),
  27065. renderSlot(_ctx.$slots, "append")
  27066. ]),
  27067. _: 3
  27068. }, 8, ["class", "name"]);
  27069. };
  27070. }
  27071. }));
  27072. var UploadList = /* @__PURE__ */ _export_sfc$1(_sfc_main$d, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/upload/src/upload-list.vue"]]);
  27073. const uploadDraggerProps = buildProps({
  27074. disabled: {
  27075. type: Boolean,
  27076. default: false
  27077. }
  27078. });
  27079. const uploadDraggerEmits = {
  27080. file: (file) => isArray(file)
  27081. };
  27082. const _hoisted_1$9 = ["onDrop", "onDragover"];
  27083. const __default__$3 = {
  27084. name: "ElUploadDrag"
  27085. };
  27086. const _sfc_main$c = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$3), {
  27087. props: uploadDraggerProps,
  27088. emits: uploadDraggerEmits,
  27089. setup(__props, { emit }) {
  27090. const props = __props;
  27091. const COMPONENT_NAME2 = "ElUploadDrag";
  27092. const uploaderContext = inject(uploadContextKey);
  27093. if (!uploaderContext) {
  27094. throwError(COMPONENT_NAME2, "usage: <el-upload><el-upload-dragger /></el-upload>");
  27095. }
  27096. const ns = useNamespace("upload");
  27097. const dragover = ref(false);
  27098. const onDrop = (e) => {
  27099. if (props.disabled)
  27100. return;
  27101. dragover.value = false;
  27102. const files = Array.from(e.dataTransfer.files);
  27103. const accept = uploaderContext.accept.value;
  27104. if (!accept) {
  27105. emit("file", files);
  27106. return;
  27107. }
  27108. const filesFiltered = files.filter((file) => {
  27109. const { type: type4, name } = file;
  27110. const extension = name.includes(".") ? `.${name.split(".").pop()}` : "";
  27111. const baseType = type4.replace(/\/.*$/, "");
  27112. return accept.split(",").map((type22) => type22.trim()).filter((type22) => type22).some((acceptedType) => {
  27113. if (acceptedType.startsWith(".")) {
  27114. return extension === acceptedType;
  27115. }
  27116. if (/\/\*$/.test(acceptedType)) {
  27117. return baseType === acceptedType.replace(/\/\*$/, "");
  27118. }
  27119. if (/^[^/]+\/[^/]+$/.test(acceptedType)) {
  27120. return type4 === acceptedType;
  27121. }
  27122. return false;
  27123. });
  27124. });
  27125. emit("file", filesFiltered);
  27126. };
  27127. const onDragover = () => {
  27128. if (!props.disabled)
  27129. dragover.value = true;
  27130. };
  27131. return (_ctx, _cache) => {
  27132. return openBlock(), createElementBlock("div", {
  27133. class: normalizeClass([unref(ns).b("dragger"), unref(ns).is("dragover", dragover.value)]),
  27134. onDrop: withModifiers(onDrop, ["prevent"]),
  27135. onDragover: withModifiers(onDragover, ["prevent"]),
  27136. onDragleave: _cache[0] || (_cache[0] = withModifiers(($event) => dragover.value = false, ["prevent"]))
  27137. }, [
  27138. renderSlot(_ctx.$slots, "default")
  27139. ], 42, _hoisted_1$9);
  27140. };
  27141. }
  27142. }));
  27143. var UploadDragger = /* @__PURE__ */ _export_sfc$1(_sfc_main$c, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/upload/src/upload-dragger.vue"]]);
  27144. const uploadContentProps = buildProps(__spreadProps(__spreadValues({}, uploadBaseProps), {
  27145. fileList: {
  27146. type: definePropType(Array),
  27147. default: () => mutable([])
  27148. },
  27149. beforeUpload: {
  27150. type: definePropType(Function),
  27151. default: NOOP
  27152. },
  27153. onRemove: {
  27154. type: definePropType(Function),
  27155. default: NOOP
  27156. },
  27157. onStart: {
  27158. type: definePropType(Function),
  27159. default: NOOP
  27160. },
  27161. onSuccess: {
  27162. type: definePropType(Function),
  27163. default: NOOP
  27164. },
  27165. onProgress: {
  27166. type: definePropType(Function),
  27167. default: NOOP
  27168. },
  27169. onError: {
  27170. type: definePropType(Function),
  27171. default: NOOP
  27172. },
  27173. onExceed: {
  27174. type: definePropType(Function),
  27175. default: NOOP
  27176. }
  27177. }));
  27178. const _hoisted_1$8 = ["onKeydown"];
  27179. const _hoisted_2$7 = ["name", "multiple", "accept"];
  27180. const __default__$2 = {
  27181. name: "ElUploadContent",
  27182. inheritAttrs: false
  27183. };
  27184. const _sfc_main$b = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$2), {
  27185. props: uploadContentProps,
  27186. setup(__props, { expose }) {
  27187. const props = __props;
  27188. const ns = useNamespace("upload");
  27189. const requests = shallowRef({});
  27190. const inputRef = shallowRef();
  27191. const uploadFiles = (files) => {
  27192. if (files.length === 0)
  27193. return;
  27194. const { autoUpload, limit, fileList, multiple, onStart, onExceed } = props;
  27195. if (limit && fileList.length + files.length > limit) {
  27196. onExceed(files, fileList);
  27197. return;
  27198. }
  27199. if (!multiple) {
  27200. files = files.slice(0, 1);
  27201. }
  27202. for (const file of files) {
  27203. const rawFile = file;
  27204. rawFile.uid = genFileId();
  27205. onStart(rawFile);
  27206. if (autoUpload)
  27207. upload(rawFile);
  27208. }
  27209. };
  27210. const upload = async (rawFile) => {
  27211. inputRef.value.value = "";
  27212. if (!props.beforeUpload) {
  27213. return doUpload(rawFile);
  27214. }
  27215. let hookResult;
  27216. try {
  27217. hookResult = await props.beforeUpload(rawFile);
  27218. } catch (e) {
  27219. hookResult = false;
  27220. }
  27221. if (hookResult === false) {
  27222. props.onRemove(rawFile);
  27223. return;
  27224. }
  27225. let file = rawFile;
  27226. if (hookResult instanceof Blob) {
  27227. if (hookResult instanceof File) {
  27228. file = hookResult;
  27229. } else {
  27230. file = new File([hookResult], rawFile.name, {
  27231. type: rawFile.type
  27232. });
  27233. }
  27234. for (const key of Object.keys(rawFile)) {
  27235. file[key] = rawFile[key];
  27236. }
  27237. }
  27238. doUpload(rawFile);
  27239. };
  27240. const doUpload = (rawFile) => {
  27241. const {
  27242. headers,
  27243. data: data2,
  27244. method: method4,
  27245. withCredentials,
  27246. name: filename,
  27247. action,
  27248. onProgress,
  27249. onSuccess,
  27250. onError,
  27251. httpRequest
  27252. } = props;
  27253. const { uid: uid2 } = rawFile;
  27254. const options = {
  27255. headers: headers || {},
  27256. withCredentials,
  27257. file: rawFile,
  27258. data: data2,
  27259. method: method4,
  27260. filename,
  27261. action,
  27262. onProgress: (evt) => {
  27263. onProgress(evt, rawFile);
  27264. },
  27265. onSuccess: (res) => {
  27266. onSuccess(res, rawFile);
  27267. delete requests.value[uid2];
  27268. },
  27269. onError: (err) => {
  27270. onError(err, rawFile);
  27271. delete requests.value[uid2];
  27272. }
  27273. };
  27274. const request = httpRequest(options);
  27275. requests.value[uid2] = request;
  27276. if (request instanceof Promise) {
  27277. request.then(options.onSuccess, options.onError);
  27278. }
  27279. };
  27280. const handleChange2 = (e) => {
  27281. const files = e.target.files;
  27282. if (!files)
  27283. return;
  27284. uploadFiles(Array.from(files));
  27285. };
  27286. const handleClick = () => {
  27287. if (!props.disabled) {
  27288. inputRef.value.value = "";
  27289. inputRef.value.click();
  27290. }
  27291. };
  27292. const handleKeydown = () => {
  27293. handleClick();
  27294. };
  27295. const abort = (file) => {
  27296. const _reqs = entriesOf(requests.value).filter(file ? ([uid2]) => String(file.uid) === uid2 : () => true);
  27297. _reqs.forEach(([uid2, req]) => {
  27298. if (req instanceof XMLHttpRequest)
  27299. req.abort();
  27300. delete requests.value[uid2];
  27301. });
  27302. };
  27303. expose({
  27304. abort,
  27305. upload
  27306. });
  27307. return (_ctx, _cache) => {
  27308. return openBlock(), createElementBlock("div", {
  27309. class: normalizeClass([unref(ns).b(), unref(ns).m(_ctx.listType)]),
  27310. tabindex: "0",
  27311. onClick: handleClick,
  27312. onKeydown: withKeys(withModifiers(handleKeydown, ["self"]), ["enter", "space"])
  27313. }, [
  27314. _ctx.drag ? (openBlock(), createBlock(UploadDragger, {
  27315. key: 0,
  27316. disabled: _ctx.disabled,
  27317. onFile: uploadFiles
  27318. }, {
  27319. default: withCtx(() => [
  27320. renderSlot(_ctx.$slots, "default")
  27321. ]),
  27322. _: 3
  27323. }, 8, ["disabled"])) : renderSlot(_ctx.$slots, "default", { key: 1 }),
  27324. createElementVNode("input", {
  27325. ref_key: "inputRef",
  27326. ref: inputRef,
  27327. class: normalizeClass(unref(ns).e("input")),
  27328. name: _ctx.name,
  27329. multiple: _ctx.multiple,
  27330. accept: _ctx.accept,
  27331. type: "file",
  27332. onChange: handleChange2
  27333. }, null, 42, _hoisted_2$7)
  27334. ], 42, _hoisted_1$8);
  27335. };
  27336. }
  27337. }));
  27338. var UploadContent = /* @__PURE__ */ _export_sfc$1(_sfc_main$b, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/upload/src/upload-content.vue"]]);
  27339. const SCOPE = "ElUpload";
  27340. const revokeObjectURL = (file) => {
  27341. var _a2;
  27342. if ((_a2 = file.url) == null ? void 0 : _a2.startsWith("blob:")) {
  27343. URL.revokeObjectURL(file.url);
  27344. }
  27345. };
  27346. const useHandlers = (props, uploadRef) => {
  27347. const uploadFiles = ref([]);
  27348. const getFile = (rawFile) => uploadFiles.value.find((file) => file.uid === rawFile.uid);
  27349. function abort(file) {
  27350. var _a2;
  27351. (_a2 = uploadRef.value) == null ? void 0 : _a2.abort(file);
  27352. }
  27353. function clearFiles(states = ["ready", "uploading", "success", "fail"]) {
  27354. uploadFiles.value = uploadFiles.value.filter((row) => !states.includes(row.status));
  27355. }
  27356. const handleError = (err, rawFile) => {
  27357. const file = getFile(rawFile);
  27358. if (!file)
  27359. return;
  27360. file.status = "fail";
  27361. uploadFiles.value.splice(uploadFiles.value.indexOf(file), 1);
  27362. props.onError(err, file, uploadFiles.value);
  27363. props.onChange(file, uploadFiles.value);
  27364. };
  27365. const handleProgress = (evt, rawFile) => {
  27366. const file = getFile(rawFile);
  27367. if (!file)
  27368. return;
  27369. props.onProgress(evt, file, uploadFiles.value);
  27370. file.status = "uploading";
  27371. file.percentage = Math.round(evt.percent);
  27372. };
  27373. const handleSuccess = (response, rawFile) => {
  27374. const file = getFile(rawFile);
  27375. if (!file)
  27376. return;
  27377. file.status = "success";
  27378. file.response = response;
  27379. props.onSuccess(response, file, uploadFiles.value);
  27380. props.onChange(file, uploadFiles.value);
  27381. };
  27382. const handleStart = (file) => {
  27383. const uploadFile = {
  27384. name: file.name,
  27385. percentage: 0,
  27386. status: "ready",
  27387. size: file.size,
  27388. raw: file,
  27389. uid: file.uid
  27390. };
  27391. if (props.listType === "picture-card" || props.listType === "picture") {
  27392. try {
  27393. uploadFile.url = URL.createObjectURL(file);
  27394. } catch (err) {
  27395. debugWarn(SCOPE, err.message);
  27396. props.onError(err, uploadFile, uploadFiles.value);
  27397. }
  27398. }
  27399. uploadFiles.value.push(uploadFile);
  27400. props.onChange(uploadFile, uploadFiles.value);
  27401. };
  27402. const handleRemove = async (file, rawFile) => {
  27403. if (rawFile) {
  27404. useDeprecated({
  27405. scope: SCOPE,
  27406. from: "handleRemove second argument",
  27407. version: "2.2",
  27408. replacement: "first argument `file`",
  27409. ref: "https://element-plus.org/en-US/component/upload.html#methods"
  27410. }, true);
  27411. }
  27412. const _file = rawFile || file;
  27413. const uploadFile = _file instanceof File ? getFile(_file) : _file;
  27414. if (!uploadFile)
  27415. throwError(SCOPE, "file to be removed not found");
  27416. const doRemove = (file2) => {
  27417. abort(file2);
  27418. const fileList = uploadFiles.value;
  27419. fileList.splice(fileList.indexOf(file2), 1);
  27420. props.onRemove(file2, fileList);
  27421. revokeObjectURL(file2);
  27422. };
  27423. if (props.beforeRemove) {
  27424. const before = await props.beforeRemove(uploadFile, uploadFiles.value);
  27425. if (before !== false)
  27426. doRemove(uploadFile);
  27427. } else {
  27428. doRemove(uploadFile);
  27429. }
  27430. };
  27431. function submit() {
  27432. uploadFiles.value.filter(({ status }) => status === "ready").forEach(({ raw }) => {
  27433. var _a2;
  27434. return raw && ((_a2 = uploadRef.value) == null ? void 0 : _a2.upload(raw));
  27435. });
  27436. }
  27437. watch(() => props.listType, (val) => {
  27438. if (val !== "picture-card" && val !== "picture") {
  27439. return;
  27440. }
  27441. uploadFiles.value = uploadFiles.value.map((file) => {
  27442. const { raw, url: url2 } = file;
  27443. if (!url2 && raw) {
  27444. try {
  27445. file.url = URL.createObjectURL(raw);
  27446. } catch (err) {
  27447. props.onError(err, file, uploadFiles.value);
  27448. }
  27449. }
  27450. return file;
  27451. });
  27452. });
  27453. watch(() => props.fileList, (fileList) => {
  27454. for (const file of fileList) {
  27455. file.uid || (file.uid = genFileId());
  27456. file.status || (file.status = "success");
  27457. }
  27458. uploadFiles.value = fileList;
  27459. }, { immediate: true, deep: true });
  27460. return {
  27461. abort,
  27462. clearFiles,
  27463. handleError,
  27464. handleProgress,
  27465. handleStart,
  27466. handleSuccess,
  27467. handleRemove,
  27468. submit,
  27469. uploadFiles
  27470. };
  27471. };
  27472. const __default__$1 = {
  27473. name: "ElUpload"
  27474. };
  27475. const _sfc_main$a = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$1), {
  27476. props: uploadProps,
  27477. setup(__props, { expose }) {
  27478. const props = __props;
  27479. const slots = useSlots();
  27480. const disabled = useDisabled$1();
  27481. const uploadRef = shallowRef();
  27482. const {
  27483. abort,
  27484. submit,
  27485. clearFiles,
  27486. uploadFiles,
  27487. handleStart,
  27488. handleError,
  27489. handleRemove,
  27490. handleSuccess,
  27491. handleProgress
  27492. } = useHandlers(props, uploadRef);
  27493. const isPictureCard = computed(() => props.listType === "picture-card");
  27494. const uploadContentProps2 = computed(() => __spreadProps(__spreadValues({}, props), {
  27495. onStart: handleStart,
  27496. onProgress: handleProgress,
  27497. onSuccess: handleSuccess,
  27498. onError: handleError,
  27499. onRemove: handleRemove
  27500. }));
  27501. onBeforeUnmount(() => {
  27502. uploadFiles.value.forEach(({ url: url2 }) => {
  27503. if (url2 == null ? void 0 : url2.startsWith("blob:"))
  27504. URL.revokeObjectURL(url2);
  27505. });
  27506. });
  27507. provide(uploadContextKey, {
  27508. accept: toRef(props, "accept")
  27509. });
  27510. expose({
  27511. abort,
  27512. submit,
  27513. clearFiles,
  27514. handleStart,
  27515. handleRemove
  27516. });
  27517. return (_ctx, _cache) => {
  27518. return openBlock(), createElementBlock("div", null, [
  27519. unref(isPictureCard) && _ctx.showFileList ? (openBlock(), createBlock(UploadList, {
  27520. key: 0,
  27521. disabled: unref(disabled),
  27522. "list-type": _ctx.listType,
  27523. files: unref(uploadFiles),
  27524. "handle-preview": _ctx.onPreview,
  27525. onRemove: unref(handleRemove)
  27526. }, createSlots({
  27527. append: withCtx(() => [
  27528. _ctx.listType === "picture-card" ? (openBlock(), createBlock(UploadContent, mergeProps({
  27529. key: 0,
  27530. ref_key: "uploadRef",
  27531. ref: uploadRef
  27532. }, unref(uploadContentProps2)), {
  27533. default: withCtx(() => [
  27534. unref(slots).trigger ? renderSlot(_ctx.$slots, "trigger", { key: 0 }) : createCommentVNode("v-if", true),
  27535. !unref(slots).trigger && unref(slots).default ? renderSlot(_ctx.$slots, "default", { key: 1 }) : createCommentVNode("v-if", true)
  27536. ]),
  27537. _: 3
  27538. }, 16)) : createCommentVNode("v-if", true)
  27539. ]),
  27540. _: 2
  27541. }, [
  27542. _ctx.$slots.file ? {
  27543. name: "default",
  27544. fn: withCtx(({ file }) => [
  27545. renderSlot(_ctx.$slots, "file", { file })
  27546. ])
  27547. } : void 0
  27548. ]), 1032, ["disabled", "list-type", "files", "handle-preview", "onRemove"])) : createCommentVNode("v-if", true),
  27549. _ctx.listType !== "picture-card" ? (openBlock(), createBlock(UploadContent, mergeProps({
  27550. key: 1,
  27551. ref_key: "uploadRef",
  27552. ref: uploadRef
  27553. }, unref(uploadContentProps2)), {
  27554. default: withCtx(() => [
  27555. unref(slots).trigger ? renderSlot(_ctx.$slots, "trigger", { key: 0 }) : createCommentVNode("v-if", true),
  27556. !unref(slots).trigger && unref(slots).default ? renderSlot(_ctx.$slots, "default", { key: 1 }) : createCommentVNode("v-if", true)
  27557. ]),
  27558. _: 3
  27559. }, 16)) : createCommentVNode("v-if", true),
  27560. _ctx.$slots.trigger ? renderSlot(_ctx.$slots, "default", { key: 2 }) : createCommentVNode("v-if", true),
  27561. renderSlot(_ctx.$slots, "tip"),
  27562. !unref(isPictureCard) && _ctx.showFileList ? (openBlock(), createBlock(UploadList, {
  27563. key: 3,
  27564. disabled: unref(disabled),
  27565. "list-type": _ctx.listType,
  27566. files: unref(uploadFiles),
  27567. "handle-preview": _ctx.onPreview,
  27568. onRemove: unref(handleRemove)
  27569. }, createSlots({ _: 2 }, [
  27570. _ctx.$slots.file ? {
  27571. name: "default",
  27572. fn: withCtx(({ file }) => [
  27573. renderSlot(_ctx.$slots, "file", { file })
  27574. ])
  27575. } : void 0
  27576. ]), 1032, ["disabled", "list-type", "files", "handle-preview", "onRemove"])) : createCommentVNode("v-if", true)
  27577. ]);
  27578. };
  27579. }
  27580. }));
  27581. var Upload = /* @__PURE__ */ _export_sfc$1(_sfc_main$a, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/upload/src/upload.vue"]]);
  27582. const ElUpload = withInstall(Upload);
  27583. var base = "";
  27584. var elDialog = "";
  27585. var elOverlay = "";
  27586. var elButton = "";
  27587. var elForm = "";
  27588. var elFormItem = "";
  27589. var elCascader = "";
  27590. var elInput = "";
  27591. var elPopper = "";
  27592. var elTag = "";
  27593. var elCascaderPanel = "";
  27594. var elCheckbox = "";
  27595. var elRadio = "";
  27596. var elScrollbar = "";
  27597. var elUpload = "";
  27598. var elProgress = "";
  27599. var elImage = "";
  27600. var elImageViewer = "";
  27601. var elSlider = "";
  27602. var elInputNumber = "";
  27603. var elTooltip = "";
  27604. var elSwitch = "";
  27605. var elOption = "";
  27606. var elOptionGroup = "";
  27607. var elSelect = "";
  27608. var elRate = "";
  27609. var elDatePicker = "";
  27610. var elConfigProvider = "";
  27611. var elTimePicker = "";
  27612. var elCheckboxGroup = "";
  27613. var elRadioGroup = "";
  27614. var elDivider = "";
  27615. var elTable = "";
  27616. var elTableColumn = "";
  27617. var zhCn = {
  27618. name: "zh-cn",
  27619. el: {
  27620. colorpicker: {
  27621. confirm: "\u786E\u5B9A",
  27622. clear: "\u6E05\u7A7A"
  27623. },
  27624. datepicker: {
  27625. now: "\u6B64\u523B",
  27626. today: "\u4ECA\u5929",
  27627. cancel: "\u53D6\u6D88",
  27628. clear: "\u6E05\u7A7A",
  27629. confirm: "\u786E\u5B9A",
  27630. selectDate: "\u9009\u62E9\u65E5\u671F",
  27631. selectTime: "\u9009\u62E9\u65F6\u95F4",
  27632. startDate: "\u5F00\u59CB\u65E5\u671F",
  27633. startTime: "\u5F00\u59CB\u65F6\u95F4",
  27634. endDate: "\u7ED3\u675F\u65E5\u671F",
  27635. endTime: "\u7ED3\u675F\u65F6\u95F4",
  27636. prevYear: "\u524D\u4E00\u5E74",
  27637. nextYear: "\u540E\u4E00\u5E74",
  27638. prevMonth: "\u4E0A\u4E2A\u6708",
  27639. nextMonth: "\u4E0B\u4E2A\u6708",
  27640. year: "\u5E74",
  27641. month1: "1 \u6708",
  27642. month2: "2 \u6708",
  27643. month3: "3 \u6708",
  27644. month4: "4 \u6708",
  27645. month5: "5 \u6708",
  27646. month6: "6 \u6708",
  27647. month7: "7 \u6708",
  27648. month8: "8 \u6708",
  27649. month9: "9 \u6708",
  27650. month10: "10 \u6708",
  27651. month11: "11 \u6708",
  27652. month12: "12 \u6708",
  27653. weeks: {
  27654. sun: "\u65E5",
  27655. mon: "\u4E00",
  27656. tue: "\u4E8C",
  27657. wed: "\u4E09",
  27658. thu: "\u56DB",
  27659. fri: "\u4E94",
  27660. sat: "\u516D"
  27661. },
  27662. months: {
  27663. jan: "\u4E00\u6708",
  27664. feb: "\u4E8C\u6708",
  27665. mar: "\u4E09\u6708",
  27666. apr: "\u56DB\u6708",
  27667. may: "\u4E94\u6708",
  27668. jun: "\u516D\u6708",
  27669. jul: "\u4E03\u6708",
  27670. aug: "\u516B\u6708",
  27671. sep: "\u4E5D\u6708",
  27672. oct: "\u5341\u6708",
  27673. nov: "\u5341\u4E00\u6708",
  27674. dec: "\u5341\u4E8C\u6708"
  27675. }
  27676. },
  27677. select: {
  27678. loading: "\u52A0\u8F7D\u4E2D",
  27679. noMatch: "\u65E0\u5339\u914D\u6570\u636E",
  27680. noData: "\u65E0\u6570\u636E",
  27681. placeholder: "\u8BF7\u9009\u62E9"
  27682. },
  27683. cascader: {
  27684. noMatch: "\u65E0\u5339\u914D\u6570\u636E",
  27685. loading: "\u52A0\u8F7D\u4E2D",
  27686. placeholder: "\u8BF7\u9009\u62E9",
  27687. noData: "\u6682\u65E0\u6570\u636E"
  27688. },
  27689. pagination: {
  27690. goto: "\u524D\u5F80",
  27691. pagesize: "\u6761/\u9875",
  27692. total: "\u5171 {total} \u6761",
  27693. pageClassifier: "\u9875",
  27694. deprecationWarning: "\u4F60\u4F7F\u7528\u4E86\u4E00\u4E9B\u5DF2\u88AB\u5E9F\u5F03\u7684\u7528\u6CD5\uFF0C\u8BF7\u53C2\u8003 el-pagination \u7684\u5B98\u65B9\u6587\u6863"
  27695. },
  27696. messagebox: {
  27697. title: "\u63D0\u793A",
  27698. confirm: "\u786E\u5B9A",
  27699. cancel: "\u53D6\u6D88",
  27700. error: "\u8F93\u5165\u7684\u6570\u636E\u4E0D\u5408\u6CD5!"
  27701. },
  27702. upload: {
  27703. deleteTip: "\u6309 delete \u952E\u53EF\u5220\u9664",
  27704. delete: "\u5220\u9664",
  27705. preview: "\u67E5\u770B\u56FE\u7247",
  27706. continue: "\u7EE7\u7EED\u4E0A\u4F20"
  27707. },
  27708. table: {
  27709. emptyText: "\u6682\u65E0\u6570\u636E",
  27710. confirmFilter: "\u7B5B\u9009",
  27711. resetFilter: "\u91CD\u7F6E",
  27712. clearFilter: "\u5168\u90E8",
  27713. sumText: "\u5408\u8BA1"
  27714. },
  27715. tree: {
  27716. emptyText: "\u6682\u65E0\u6570\u636E"
  27717. },
  27718. transfer: {
  27719. noMatch: "\u65E0\u5339\u914D\u6570\u636E",
  27720. noData: "\u65E0\u6570\u636E",
  27721. titles: ["\u5217\u8868 1", "\u5217\u8868 2"],
  27722. filterPlaceholder: "\u8BF7\u8F93\u5165\u641C\u7D22\u5185\u5BB9",
  27723. noCheckedFormat: "\u5171 {total} \u9879",
  27724. hasCheckedFormat: "\u5DF2\u9009 {checked}/{total} \u9879"
  27725. },
  27726. image: {
  27727. error: "\u52A0\u8F7D\u5931\u8D25"
  27728. },
  27729. pageHeader: {
  27730. title: "\u8FD4\u56DE"
  27731. },
  27732. popconfirm: {
  27733. confirmButtonText: "\u786E\u5B9A",
  27734. cancelButtonText: "\u53D6\u6D88"
  27735. }
  27736. }
  27737. };
  27738. var personnelSearch_vue_vue_type_style_index_0_lang = "";
  27739. const _hoisted_1$7 = { class: "selectV2SingleChoiceReset" };
  27740. const _hoisted_2$6 = {
  27741. key: 0,
  27742. style: { "color": "#A8ABB2" }
  27743. };
  27744. const _hoisted_3$5 = {
  27745. key: 1,
  27746. style: { "color": "#606266" }
  27747. };
  27748. const _hoisted_4$5 = { class: "selectV2SingleChoiceTwoReset" };
  27749. const _hoisted_5$5 = {
  27750. key: 0,
  27751. style: { "color": "#A8ABB2" }
  27752. };
  27753. const _hoisted_6$5 = { style: { "float": "left" } };
  27754. const _sfc_main$9 = /* @__PURE__ */ defineComponent({
  27755. props: {
  27756. modelValue: { type: null, required: true },
  27757. multiple: { type: Boolean, required: false, default: false },
  27758. size: { type: String, required: true, default: () => "" },
  27759. placeholder: { type: String, required: false, default: () => "\u8BF7\u9009\u62E9" },
  27760. disabled: { type: Boolean, required: false, default: false },
  27761. options: { type: Array, required: false, default: () => [] },
  27762. clearable: { type: Boolean, required: false, default: true },
  27763. width: { type: String, required: false, default: () => "100%" },
  27764. url: { type: String, required: false, default: () => "" }
  27765. },
  27766. emits: ["change", "update:modelValue"],
  27767. setup(__props, { emit }) {
  27768. const props = __props;
  27769. const personnelArray = ref([]);
  27770. const { userInfo = {}, personnelList = [] } = JSON.parse(sessionStorage.getItem("storeInfo") || "{}");
  27771. const textSize = ref({
  27772. "small": { height: "20px", fontSize: "12px" },
  27773. "default": { height: "28px", fontSize: "14px" },
  27774. "": { height: "28px", fontSize: "14px" },
  27775. "large": { height: "36px", fontSize: "14px" }
  27776. });
  27777. const selectLoading = ref(false);
  27778. const controlTranslation = reactive({
  27779. visibleFlag: false
  27780. });
  27781. const selectedValue = ref(props.modelValue);
  27782. watch(() => props.modelValue, (newValue, _oldValue) => {
  27783. if (newValue != selectedValue.value) {
  27784. selectedValue.value = newValue;
  27785. }
  27786. });
  27787. const getSelectedLabel = computed(() => {
  27788. if (!props.multiple) {
  27789. const item = getPersonnelListItems(selectedValue.value || props.modelValue);
  27790. return item ? item.label : props.placeholder;
  27791. }
  27792. if (props.multiple) {
  27793. if (Array.isArray(selectedValue.value)) {
  27794. if (selectedValue.value.length <= 0) {
  27795. return props.placeholder;
  27796. }
  27797. const item = getPersonnelListItems(selectedValue.value || props.modelValue);
  27798. return item ? item.label : props.placeholder;
  27799. } else {
  27800. return props.placeholder;
  27801. }
  27802. }
  27803. return props.placeholder;
  27804. });
  27805. function tagClose(_evt) {
  27806. if (Array.isArray(selectedValue.value)) {
  27807. selectedValue.value.shift();
  27808. updateValue(selectedValue.value);
  27809. }
  27810. }
  27811. function getPersonnelListItems(val) {
  27812. let value = val;
  27813. if (Array.isArray(val) && val.length > 0) {
  27814. value = val[0];
  27815. }
  27816. return personnelList.find((item) => item.value == value);
  27817. }
  27818. function getUserList(keyword = "") {
  27819. newPost(props.url, keyword).then((res) => {
  27820. personnelArray.value = res || [];
  27821. }).finally(() => {
  27822. selectLoading.value = false;
  27823. });
  27824. }
  27825. function newPost(url2, keyword) {
  27826. return new Promise((resolve, reject) => {
  27827. const token = sessionStorage.getItem("token");
  27828. if (!token) {
  27829. reject(new Error("Token is missing"));
  27830. return;
  27831. }
  27832. const body = new URLSearchParams();
  27833. body.append("keyword", keyword);
  27834. fetch(url2, {
  27835. method: "POST",
  27836. headers: {
  27837. "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
  27838. "Token": token
  27839. },
  27840. body: body.toString()
  27841. }).then((resp) => {
  27842. if (!resp.ok) {
  27843. reject(new Error(`Error: ${resp.statusText}`));
  27844. }
  27845. return resp.json();
  27846. }).then((json) => {
  27847. const res = json.data;
  27848. if (Array.isArray(res)) {
  27849. const personnelArray2 = res.map((data2) => ({
  27850. label: data2["label"],
  27851. value: data2["value"]
  27852. }));
  27853. resolve(personnelArray2);
  27854. } else {
  27855. reject(new Error("Invalid data format"));
  27856. }
  27857. }).catch((error) => {
  27858. reject(error);
  27859. });
  27860. });
  27861. }
  27862. function visibleChange(visible) {
  27863. if (visible) {
  27864. personnelArray.value = personnelList;
  27865. }
  27866. controlTranslation.visibleFlag = visible;
  27867. }
  27868. const filterMethod = debounce2(filterMethods, 500);
  27869. function filterMethods(val) {
  27870. if (val == "") {
  27871. personnelArray.value = personnelList;
  27872. selectLoading.value = false;
  27873. return personnelArray.value;
  27874. }
  27875. selectLoading.value = true;
  27876. getUserList(val);
  27877. }
  27878. function updateValue(val) {
  27879. emit("update:modelValue", selectedValue.value);
  27880. emit("change", val);
  27881. }
  27882. function debounce2(func, delay) {
  27883. let timer;
  27884. return (...args) => {
  27885. if (timer) {
  27886. clearTimeout(timer);
  27887. }
  27888. timer = setTimeout(() => {
  27889. func(...args);
  27890. }, delay);
  27891. };
  27892. }
  27893. onMounted(() => {
  27894. if (personnelList.length == 0) {
  27895. getUserList();
  27896. } else {
  27897. personnelArray.value = personnelList;
  27898. }
  27899. });
  27900. return (_ctx, _cache) => {
  27901. const _component_ww_open_data = resolveComponent("ww-open-data");
  27902. const _component_el_tag = ElTag;
  27903. const _component_el_option = ElOption;
  27904. const _component_el_select = ElSelect;
  27905. return openBlock(), createBlock(_component_el_select, {
  27906. modelValue: selectedValue.value,
  27907. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => selectedValue.value = $event),
  27908. multiple: __props.multiple,
  27909. size: __props.size,
  27910. loading: selectLoading.value,
  27911. placeholder: __props.placeholder,
  27912. disabled: __props.disabled,
  27913. clearable: __props.clearable,
  27914. filterable: "",
  27915. "collapse-tags": "",
  27916. style: normalizeStyle(`width: ${__props.width}`),
  27917. class: normalizeClass(`custom-select-v2-reset ${!unref(controlTranslation).visibleFlag ? "setUpInputReset" : ""}`),
  27918. onChange: updateValue,
  27919. onVisibleChange: visibleChange,
  27920. "filter-method": unref(filterMethod)
  27921. }, createSlots({
  27922. default: withCtx(() => [
  27923. (openBlock(true), createElementBlock(Fragment, null, renderList(personnelArray.value || [], (item) => {
  27924. return openBlock(), createBlock(_component_el_option, {
  27925. key: item.value,
  27926. label: item.label,
  27927. value: item.value
  27928. }, {
  27929. default: withCtx(() => [
  27930. createElementVNode("span", _hoisted_6$5, [
  27931. createVNode(_component_ww_open_data, {
  27932. type: "userName",
  27933. openid: item.label
  27934. }, null, 8, ["openid"])
  27935. ])
  27936. ]),
  27937. _: 2
  27938. }, 1032, ["label", "value"]);
  27939. }), 128))
  27940. ]),
  27941. _: 2
  27942. }, [
  27943. !__props.multiple ? {
  27944. name: "prefix",
  27945. fn: withCtx(() => [
  27946. createElementVNode("div", _hoisted_1$7, [
  27947. !unref(controlTranslation).visibleFlag ? (openBlock(), createElementBlock("div", {
  27948. key: 0,
  27949. class: "selectSingleChoice",
  27950. style: normalizeStyle(`line-height: ${textSize.value[__props.size].height};font-size:${textSize.value[__props.size].fontSize}`)
  27951. }, [
  27952. unref(getSelectedLabel) == __props.placeholder ? (openBlock(), createElementBlock("span", _hoisted_2$6, toDisplayString(__props.placeholder), 1)) : (openBlock(), createElementBlock("span", _hoisted_3$5, [
  27953. createVNode(_component_ww_open_data, {
  27954. type: "userName",
  27955. openid: unref(getSelectedLabel)
  27956. }, null, 8, ["openid"])
  27957. ]))
  27958. ], 4)) : createCommentVNode("", true)
  27959. ])
  27960. ])
  27961. } : void 0,
  27962. __props.multiple ? {
  27963. name: "prefix",
  27964. fn: withCtx(() => [
  27965. createElementVNode("div", _hoisted_4$5, [
  27966. createElementVNode("div", {
  27967. class: "selectSingleChoice",
  27968. style: normalizeStyle(`line-height: ${textSize.value[__props.size].height};font-size:${textSize.value[__props.size].fontSize}`)
  27969. }, [
  27970. unref(getSelectedLabel) == __props.placeholder ? (openBlock(), createElementBlock("span", _hoisted_5$5, toDisplayString(__props.placeholder), 1)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  27971. createVNode(_component_el_tag, {
  27972. type: "info",
  27973. size: __props.size,
  27974. closable: "",
  27975. onClose: tagClose,
  27976. style: { "margin-right": "5px" }
  27977. }, {
  27978. default: withCtx(() => [
  27979. createVNode(_component_ww_open_data, {
  27980. type: "userName",
  27981. openid: unref(getSelectedLabel)
  27982. }, null, 8, ["openid"])
  27983. ]),
  27984. _: 1
  27985. }, 8, ["size"]),
  27986. selectedValue.value.length > 1 ? (openBlock(), createBlock(_component_el_tag, {
  27987. key: 0,
  27988. type: "info",
  27989. size: __props.size
  27990. }, {
  27991. default: withCtx(() => [
  27992. createTextVNode("+" + toDisplayString(selectedValue.value.length), 1)
  27993. ]),
  27994. _: 1
  27995. }, 8, ["size"])) : createCommentVNode("", true)
  27996. ], 64))
  27997. ], 4)
  27998. ])
  27999. ])
  28000. } : void 0
  28001. ]), 1032, ["modelValue", "multiple", "size", "loading", "placeholder", "disabled", "clearable", "style", "class", "filter-method"]);
  28002. };
  28003. }
  28004. });
  28005. var GenerateFormItem_vue_vue_type_style_index_0_scoped_true_lang = "";
  28006. var _export_sfc = (sfc, props) => {
  28007. const target = sfc.__vccOpts || sfc;
  28008. for (const [key, val] of props) {
  28009. target[key] = val;
  28010. }
  28011. return target;
  28012. };
  28013. const _withScopeId = (n) => (pushScopeId("data-v-38ee7c8b"), n = n(), popScopeId(), n);
  28014. const _hoisted_1$6 = { key: 12 };
  28015. const _hoisted_2$5 = {
  28016. key: 1,
  28017. class: "custom:insert"
  28018. };
  28019. const _hoisted_3$4 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("i", { class: "custom:img-upload mr-2" }, null, -1));
  28020. const _hoisted_4$4 = /* @__PURE__ */ createTextVNode("\u70B9\u51FB\u4E0A\u4F20 ");
  28021. const _hoisted_5$4 = ["href"];
  28022. const _hoisted_6$4 = /* @__PURE__ */ createTextVNode(" \u4E0B\u8F7D ");
  28023. const _sfc_main$8 = /* @__PURE__ */ defineComponent({
  28024. props: {
  28025. config: null,
  28026. element: null,
  28027. model: null,
  28028. updatedModel: null,
  28029. disabled: { type: Boolean },
  28030. request: null,
  28031. widgetFormData: null
  28032. },
  28033. emits: ["updateWidgetForm"],
  28034. setup(__props, { emit: emits }) {
  28035. const props = __props;
  28036. const { userInfo = {} } = JSON.parse(sessionStorage.getItem("storeInfo") || "{}");
  28037. const originData = props.model[props.element.model];
  28038. const data2 = computed({
  28039. get: () => props.model[props.element.model],
  28040. set: (val) => {
  28041. props.model[props.element.model] = val;
  28042. if (JSON.stringify(originData) === JSON.stringify(val)) {
  28043. Reflect.deleteProperty(props.updatedModel, props.element.model);
  28044. } else {
  28045. props.updatedModel[props.element.model] = val;
  28046. }
  28047. }
  28048. });
  28049. const handleUploadSuccess = (_res, _file, fileList) => {
  28050. data2.value = fileList;
  28051. };
  28052. async function download(defaultValue, label) {
  28053. const a2 = document.createElement("a");
  28054. if (!props.request)
  28055. return;
  28056. a2.href = await props.request({
  28057. url: `/sys/common/static/${defaultValue}`,
  28058. responseType: "blob"
  28059. }).then((i) => {
  28060. if (i.size === 0)
  28061. return "";
  28062. return URL.createObjectURL(i);
  28063. });
  28064. a2.download = `${label}.${defaultValue.split(".")[1]}`;
  28065. a2.click();
  28066. }
  28067. const specializedHandleSelect = (val, element) => {
  28068. const field = element.model;
  28069. if (field == "customerId") {
  28070. let list = JSON.parse(JSON.stringify(props.widgetFormData));
  28071. for (var i in list) {
  28072. if (list[i].list[0].model == "contactsId") {
  28073. let item = list[i].list[0];
  28074. const token = sessionStorage.getItem("token");
  28075. fetch(`${item.options.remoteFunc}?customerId=${val}`, {
  28076. headers: {
  28077. "Content-type": " application/x-www-form-urlencoded; charset=UTF-8",
  28078. "Token": token
  28079. }
  28080. }).then((resp) => resp.json()).then((json) => {
  28081. const res = json.data;
  28082. if (res instanceof Array) {
  28083. item.options.remoteOptions = res.map((data22) => ({
  28084. label: data22[item.options.props.label],
  28085. value: data22[item.options.props.value],
  28086. children: data22[item.options.props.children]
  28087. }));
  28088. }
  28089. list[i].list[0].options = __spreadProps(__spreadValues({}, list[i].list[0].options), { disabled: false, defaultValue: "" });
  28090. });
  28091. }
  28092. }
  28093. setTimeout(() => {
  28094. console.log("\u5F00\u59CB\u6267\u884C");
  28095. updateWidgetForm(list);
  28096. }, 100);
  28097. }
  28098. };
  28099. const updateWidgetForm = (list) => {
  28100. emits("updateWidgetForm", list);
  28101. };
  28102. return (_ctx, _cache) => {
  28103. const _component_GenerateFormItem = resolveComponent("GenerateFormItem", true);
  28104. const _component_el_table_column = ElTableColumn;
  28105. const _component_el_table = ElTable;
  28106. const _component_el_divider = ElDivider;
  28107. const _component_el_input = ElInput;
  28108. const _component_el_input_number = ElInputNumber;
  28109. const _component_el_radio = ElRadio;
  28110. const _component_el_radio_group = ElRadioGroup;
  28111. const _component_el_checkbox = ElCheckbox;
  28112. const _component_el_checkbox_group = ElCheckboxGroup$1;
  28113. const _component_el_time_picker = ElTimePicker;
  28114. const _component_el_config_provider = ElConfigProvider;
  28115. const _component_el_date_picker = ElDatePicker;
  28116. const _component_el_rate = ElRate;
  28117. const _component_el_option = ElOption;
  28118. const _component_el_select = ElSelect;
  28119. const _component_el_switch = ElSwitch;
  28120. const _component_el_slider = ElSlider;
  28121. const _component_el_image = ElImage;
  28122. const _component_el_button = ElButton;
  28123. const _component_el_upload = ElUpload;
  28124. const _component_el_cascader = ElCascader;
  28125. const _component_el_form_item = ElFormItem;
  28126. return __props.element.type === "grid" ? (openBlock(), createElementBlock("div", {
  28127. key: 0,
  28128. grid: "~ cols-24",
  28129. style: normalizeStyle(`gap: ${__props.element.options.gutter}px; align-items: ${__props.element.options.align};`)
  28130. }, [
  28131. (openBlock(true), createElementBlock(Fragment, null, renderList(__props.element.columns, (col, colIndex) => {
  28132. return openBlock(), createElementBlock("div", {
  28133. key: colIndex,
  28134. style: normalizeStyle(`grid-column: span ${col.span}`)
  28135. }, [
  28136. (openBlock(true), createElementBlock(Fragment, null, renderList(col.list, (colItem) => {
  28137. return openBlock(), createBlock(_component_GenerateFormItem, {
  28138. key: colItem.key,
  28139. request: __props.request,
  28140. model: __props.model,
  28141. "updated-model": __props.updatedModel,
  28142. element: colItem,
  28143. config: __props.config,
  28144. disabled: __props.disabled,
  28145. widgetFormData: __props.element.columns,
  28146. onUpdateWidgetForm: updateWidgetForm
  28147. }, null, 8, ["request", "model", "updated-model", "element", "config", "disabled", "widgetFormData"]);
  28148. }), 128))
  28149. ], 4);
  28150. }), 128))
  28151. ], 4)) : __props.element.type === "table" ? (openBlock(), createBlock(_component_el_table, {
  28152. key: 1,
  28153. border: "",
  28154. class: "mb-4.5",
  28155. data: __props.element.options.defaultValue
  28156. }, {
  28157. default: withCtx(() => [
  28158. (openBlock(true), createElementBlock(Fragment, null, renderList(__props.element.columns, (i) => {
  28159. return openBlock(), createBlock(_component_el_table_column, mergeProps({
  28160. key: i.prop,
  28161. align: __props.element.options.align
  28162. }, i), null, 16, ["align"]);
  28163. }), 128))
  28164. ]),
  28165. _: 1
  28166. }, 8, ["data"])) : __props.element.type === "divider" ? (openBlock(), createBlock(_component_el_divider, {
  28167. key: 2,
  28168. data: __props.element.options.defaultValue,
  28169. "content-position": "left"
  28170. }, {
  28171. default: withCtx(() => [
  28172. createTextVNode(toDisplayString(__props.element.label), 1)
  28173. ]),
  28174. _: 1
  28175. }, 8, ["data"])) : __props.element ? (openBlock(), createBlock(_component_el_form_item, {
  28176. key: __props.element.key,
  28177. label: __props.element.label,
  28178. prop: __props.element.model,
  28179. style: normalizeStyle(__props.element.type === "download" ? "display:inline-flex;margin-right:40px" : ""),
  28180. "label-width": __props.element.labelWidth
  28181. }, createSlots({
  28182. default: withCtx(() => [
  28183. __props.element.type === "input" ? (openBlock(), createBlock(_component_el_input, {
  28184. key: 0,
  28185. modelValue: unref(data2),
  28186. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(data2) ? data2.value = $event : null),
  28187. modelModifiers: { trim: true },
  28188. style: normalizeStyle({ width: __props.element.options.width }),
  28189. placeholder: __props.element.options.placeholder,
  28190. maxlength: parseInt(__props.element.options.maxlength),
  28191. clearable: __props.element.options.clearable,
  28192. readonly: __props.element.options.readonly,
  28193. disabled: __props.disabled || __props.element.options.disabled
  28194. }, createSlots({ _: 2 }, [
  28195. __props.element.options.prefix ? {
  28196. name: "prefix",
  28197. fn: withCtx(() => [
  28198. createTextVNode(toDisplayString(__props.element.options.prefix), 1)
  28199. ])
  28200. } : void 0,
  28201. __props.element.options.suffix ? {
  28202. name: "suffix",
  28203. fn: withCtx(() => [
  28204. createTextVNode(toDisplayString(__props.element.options.suffix), 1)
  28205. ])
  28206. } : void 0,
  28207. __props.element.options.prepend ? {
  28208. name: "prepend",
  28209. fn: withCtx(() => [
  28210. createTextVNode(toDisplayString(__props.element.options.prepend), 1)
  28211. ])
  28212. } : void 0,
  28213. __props.element.options.append ? {
  28214. name: "append",
  28215. fn: withCtx(() => [
  28216. createTextVNode(toDisplayString(__props.element.options.append), 1)
  28217. ])
  28218. } : void 0
  28219. ]), 1032, ["modelValue", "style", "placeholder", "maxlength", "clearable", "readonly", "disabled"])) : createCommentVNode("", true),
  28220. __props.element.type === "password" ? (openBlock(), createBlock(_component_el_input, {
  28221. key: 1,
  28222. modelValue: unref(data2),
  28223. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => isRef(data2) ? data2.value = $event : null),
  28224. modelModifiers: { trim: true },
  28225. style: normalizeStyle({ width: __props.element.options.width }),
  28226. placeholder: __props.element.options.placeholder,
  28227. maxlength: parseInt(__props.element.options.maxlength),
  28228. clearable: __props.element.options.clearable,
  28229. disabled: __props.disabled || __props.element.options.disabled,
  28230. readonly: __props.element.options.readonly,
  28231. "show-password": __props.element.options.showPassword
  28232. }, createSlots({ _: 2 }, [
  28233. __props.element.options.prefix ? {
  28234. name: "prefix",
  28235. fn: withCtx(() => [
  28236. createTextVNode(toDisplayString(__props.element.options.prefix), 1)
  28237. ])
  28238. } : void 0,
  28239. __props.element.options.suffix ? {
  28240. name: "suffix",
  28241. fn: withCtx(() => [
  28242. createTextVNode(toDisplayString(__props.element.options.suffix), 1)
  28243. ])
  28244. } : void 0,
  28245. __props.element.options.prepend ? {
  28246. name: "prepend",
  28247. fn: withCtx(() => [
  28248. createTextVNode(toDisplayString(__props.element.options.prepend), 1)
  28249. ])
  28250. } : void 0,
  28251. __props.element.options.append ? {
  28252. name: "append",
  28253. fn: withCtx(() => [
  28254. createTextVNode(toDisplayString(__props.element.options.append), 1)
  28255. ])
  28256. } : void 0
  28257. ]), 1032, ["modelValue", "style", "placeholder", "maxlength", "clearable", "disabled", "readonly", "show-password"])) : createCommentVNode("", true),
  28258. __props.element.type === "textarea" ? (openBlock(), createBlock(_component_el_input, {
  28259. key: 2,
  28260. modelValue: unref(data2),
  28261. "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => isRef(data2) ? data2.value = $event : null),
  28262. modelModifiers: { trim: true },
  28263. type: "textarea",
  28264. resize: "none",
  28265. rows: __props.element.options.rows,
  28266. style: normalizeStyle({ width: __props.element.options.width }),
  28267. placeholder: __props.element.options.placeholder,
  28268. maxlength: parseInt(__props.element.options.maxlength),
  28269. "show-word-limit": __props.element.options.showWordLimit,
  28270. autosize: __props.element.options.autosize,
  28271. clearable: __props.element.options.clearable,
  28272. readonly: __props.element.options.readonly,
  28273. disabled: __props.disabled || __props.element.options.disabled
  28274. }, null, 8, ["modelValue", "rows", "style", "placeholder", "maxlength", "show-word-limit", "autosize", "clearable", "readonly", "disabled"])) : createCommentVNode("", true),
  28275. __props.element.type === "number" ? (openBlock(), createBlock(_component_el_input_number, {
  28276. key: 3,
  28277. modelValue: unref(data2),
  28278. "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => isRef(data2) ? data2.value = $event : null),
  28279. style: normalizeStyle({ width: __props.element.options.width }),
  28280. max: __props.element.options.max,
  28281. min: __props.element.options.min,
  28282. disabled: __props.disabled || __props.element.options.disabled,
  28283. "controls-position": "right"
  28284. }, null, 8, ["modelValue", "style", "max", "min", "disabled"])) : createCommentVNode("", true),
  28285. __props.element.type === "radio" ? (openBlock(), createBlock(_component_el_radio_group, {
  28286. key: 4,
  28287. modelValue: unref(data2),
  28288. "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => isRef(data2) ? data2.value = $event : null),
  28289. style: normalizeStyle({ width: __props.element.options.width }),
  28290. disabled: __props.disabled || __props.element.options.disabled
  28291. }, {
  28292. default: withCtx(() => [
  28293. (openBlock(true), createElementBlock(Fragment, null, renderList(__props.element.options.remote ? __props.element.options.remoteOptions : __props.element.options.options, (item) => {
  28294. return openBlock(), createBlock(_component_el_radio, {
  28295. key: item.value,
  28296. label: item.value,
  28297. style: normalizeStyle({
  28298. display: __props.element.options.inline ? "inline-block" : "block"
  28299. })
  28300. }, {
  28301. default: withCtx(() => [
  28302. createTextVNode(toDisplayString(__props.element.options.showLabel ? item.label : item.value), 1)
  28303. ]),
  28304. _: 2
  28305. }, 1032, ["label", "style"]);
  28306. }), 128))
  28307. ]),
  28308. _: 1
  28309. }, 8, ["modelValue", "style", "disabled"])) : createCommentVNode("", true),
  28310. __props.element.type === "checkbox" ? (openBlock(), createBlock(_component_el_checkbox_group, {
  28311. key: 5,
  28312. modelValue: unref(data2),
  28313. "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => isRef(data2) ? data2.value = $event : null),
  28314. style: normalizeStyle({ width: __props.element.options.width }),
  28315. disabled: __props.disabled || __props.element.options.disabled
  28316. }, {
  28317. default: withCtx(() => [
  28318. (openBlock(true), createElementBlock(Fragment, null, renderList(__props.element.options.remote ? __props.element.options.remoteOptions : __props.element.options.options, (item) => {
  28319. return openBlock(), createBlock(_component_el_checkbox, {
  28320. key: item.value,
  28321. label: item.value,
  28322. style: normalizeStyle({
  28323. display: __props.element.options.inline ? "inline-block" : "block"
  28324. })
  28325. }, {
  28326. default: withCtx(() => [
  28327. createTextVNode(toDisplayString(__props.element.options.showLabel ? item.label : item.value), 1)
  28328. ]),
  28329. _: 2
  28330. }, 1032, ["label", "style"]);
  28331. }), 128))
  28332. ]),
  28333. _: 1
  28334. }, 8, ["modelValue", "style", "disabled"])) : createCommentVNode("", true),
  28335. __props.element.type === "time" ? (openBlock(), createBlock(_component_el_config_provider, {
  28336. key: 6,
  28337. locale: unref(zhCn)
  28338. }, {
  28339. default: withCtx(() => [
  28340. createVNode(_component_el_time_picker, {
  28341. modelValue: unref(data2),
  28342. "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => isRef(data2) ? data2.value = $event : null),
  28343. placeholder: __props.element.options.placeholder,
  28344. readonly: __props.element.options.readonly,
  28345. editable: __props.element.options.editable,
  28346. clearable: __props.element.options.clearable,
  28347. format: __props.element.options.format,
  28348. disabled: __props.disabled || __props.element.options.disabled,
  28349. style: normalizeStyle({ width: __props.element.options.width })
  28350. }, null, 8, ["modelValue", "placeholder", "readonly", "editable", "clearable", "format", "disabled", "style"])
  28351. ]),
  28352. _: 1
  28353. }, 8, ["locale"])) : createCommentVNode("", true),
  28354. __props.element.type === "date" ? (openBlock(), createBlock(_component_el_config_provider, {
  28355. key: 7,
  28356. locale: unref(zhCn)
  28357. }, {
  28358. default: withCtx(() => [
  28359. createVNode(_component_el_date_picker, {
  28360. modelValue: unref(data2),
  28361. "onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => isRef(data2) ? data2.value = $event : null),
  28362. placeholder: __props.element.options.placeholder,
  28363. readonly: __props.element.options.readonly,
  28364. editable: __props.element.options.editable,
  28365. clearable: __props.element.options.clearable,
  28366. format: __props.element.options.format,
  28367. disabled: __props.disabled || __props.element.options.disabled,
  28368. style: normalizeStyle({ width: __props.element.options.width })
  28369. }, null, 8, ["modelValue", "placeholder", "readonly", "editable", "clearable", "format", "disabled", "style"])
  28370. ]),
  28371. _: 1
  28372. }, 8, ["locale"])) : createCommentVNode("", true),
  28373. __props.element.type === "rate" ? (openBlock(), createBlock(_component_el_rate, {
  28374. key: 8,
  28375. modelValue: unref(data2),
  28376. "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => isRef(data2) ? data2.value = $event : null),
  28377. max: __props.element.options.max,
  28378. "allow-half": __props.element.options.allowHalf,
  28379. disabled: __props.disabled || __props.element.options.disabled
  28380. }, null, 8, ["modelValue", "max", "allow-half", "disabled"])) : createCommentVNode("", true),
  28381. __props.element.type === "select" ? (openBlock(), createElementBlock(Fragment, { key: 9 }, [
  28382. unref(userInfo).userNameNeedTranslate == 1 && __props.element.options.remoteFunc.indexOf("getSimpleActiveUserListNew") > -1 ? (openBlock(), createBlock(_sfc_main$9, {
  28383. key: 0,
  28384. modelValue: unref(data2),
  28385. "onUpdate:modelValue": _cache[9] || (_cache[9] = ($event) => isRef(data2) ? data2.value = $event : null),
  28386. multiple: __props.element.options.multiple,
  28387. placeholder: __props.element.options.placeholder,
  28388. clearable: __props.element.options.clearable,
  28389. filterable: __props.element.options.filterable,
  28390. disabled: __props.disabled || __props.element.options.disabled,
  28391. url: __props.element.options.remoteFunc,
  28392. size: __props.config.size,
  28393. options: [],
  28394. style: normalizeStyle({ width: __props.element.options.width }),
  28395. onChange: _cache[10] || (_cache[10] = (value) => specializedHandleSelect(value, __props.element))
  28396. }, null, 8, ["modelValue", "multiple", "placeholder", "clearable", "filterable", "disabled", "url", "size", "style"])) : (openBlock(), createBlock(_component_el_select, {
  28397. key: 1,
  28398. modelValue: unref(data2),
  28399. "onUpdate:modelValue": _cache[11] || (_cache[11] = ($event) => isRef(data2) ? data2.value = $event : null),
  28400. multiple: __props.element.options.multiple,
  28401. placeholder: __props.element.options.placeholder,
  28402. clearable: __props.element.options.clearable,
  28403. filterable: __props.element.options.filterable,
  28404. disabled: __props.disabled || __props.element.options.disabled,
  28405. style: normalizeStyle({ width: __props.element.options.width }),
  28406. onChange: _cache[12] || (_cache[12] = (value) => specializedHandleSelect(value, __props.element))
  28407. }, {
  28408. default: withCtx(() => [
  28409. (openBlock(true), createElementBlock(Fragment, null, renderList(__props.element.options.remote ? __props.element.options.remoteOptions : __props.element.options.options, (item) => {
  28410. return openBlock(), createBlock(_component_el_option, {
  28411. key: item.value,
  28412. value: item.value,
  28413. label: __props.element.options.showLabel ? item.label : item.value
  28414. }, null, 8, ["value", "label"]);
  28415. }), 128))
  28416. ]),
  28417. _: 1
  28418. }, 8, ["modelValue", "multiple", "placeholder", "clearable", "filterable", "disabled", "style"]))
  28419. ], 64)) : createCommentVNode("", true),
  28420. __props.element.type === "switch" ? (openBlock(), createBlock(_component_el_switch, {
  28421. key: 10,
  28422. modelValue: unref(data2),
  28423. "onUpdate:modelValue": _cache[13] || (_cache[13] = ($event) => isRef(data2) ? data2.value = $event : null),
  28424. "active-text": __props.element.options.activeText,
  28425. "inactive-text": __props.element.options.inactiveText,
  28426. disabled: __props.disabled || __props.element.options.disabled
  28427. }, null, 8, ["modelValue", "active-text", "inactive-text", "disabled"])) : createCommentVNode("", true),
  28428. __props.element.type === "slider" ? (openBlock(), createBlock(_component_el_slider, {
  28429. key: 11,
  28430. modelValue: unref(data2),
  28431. "onUpdate:modelValue": _cache[14] || (_cache[14] = ($event) => isRef(data2) ? data2.value = $event : null),
  28432. min: __props.element.options.min,
  28433. max: __props.element.options.max,
  28434. step: __props.element.options.step,
  28435. range: __props.element.options.range,
  28436. disabled: __props.disabled || __props.element.options.disabled,
  28437. style: normalizeStyle({ width: __props.element.options.width })
  28438. }, null, 8, ["modelValue", "min", "max", "step", "range", "disabled", "style"])) : createCommentVNode("", true),
  28439. __props.element.type == "text" ? (openBlock(), createElementBlock("span", _hoisted_1$6, toDisplayString(__props.element.options.defaultValue), 1)) : createCommentVNode("", true),
  28440. __props.element.type === "img-upload" ? (openBlock(), createBlock(_component_el_upload, {
  28441. key: 13,
  28442. name: __props.element.options.file,
  28443. action: __props.element.options.action,
  28444. accept: __props.element.options.accept,
  28445. "list-type": __props.element.options.listType,
  28446. multiple: __props.element.options.multiple,
  28447. limit: __props.element.options.limit,
  28448. disabled: __props.disabled || __props.element.options.disabled,
  28449. "on-success": handleUploadSuccess
  28450. }, {
  28451. default: withCtx(() => {
  28452. var _a2;
  28453. return [
  28454. __props.element.options.listType === "picture-card" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  28455. ((_a2 = __props.element.options.defaultValue) == null ? void 0 : _a2.length) ? (openBlock(), createBlock(_component_el_image, {
  28456. key: 0,
  28457. style: { "width": "100%", "height": "100%" },
  28458. "preview-src-list": [
  28459. "/api/sys/common/static/" + __props.element.options.defaultValue
  28460. ],
  28461. src: "/api/sys/common/static/" + __props.element.options.defaultValue
  28462. }, null, 8, ["preview-src-list", "src"])) : (openBlock(), createElementBlock("i", _hoisted_2$5))
  28463. ], 64)) : (openBlock(), createBlock(_component_el_button, { key: 1 }, {
  28464. default: withCtx(() => [
  28465. _hoisted_3$4,
  28466. _hoisted_4$4
  28467. ]),
  28468. _: 1
  28469. }))
  28470. ];
  28471. }),
  28472. _: 1
  28473. }, 8, ["name", "action", "accept", "list-type", "multiple", "limit", "disabled"])) : createCommentVNode("", true),
  28474. __props.element.type === "download" ? (openBlock(), createBlock(_component_el_button, {
  28475. key: 14,
  28476. style: { "margin-top": "-4px" },
  28477. type: "text",
  28478. onClick: _cache[15] || (_cache[15] = ($event) => download(__props.element.options.defaultValue, __props.element.label))
  28479. }, {
  28480. default: withCtx(() => [
  28481. _hoisted_6$4
  28482. ]),
  28483. _: 1
  28484. })) : createCommentVNode("", true),
  28485. __props.element.type === "cascader" ? (openBlock(), createBlock(_component_el_cascader, {
  28486. key: 15,
  28487. modelValue: unref(data2),
  28488. "onUpdate:modelValue": _cache[16] || (_cache[16] = ($event) => isRef(data2) ? data2.value = $event : null),
  28489. options: __props.element.options.remoteOptions,
  28490. placeholder: __props.element.options.placeholder,
  28491. filterable: __props.element.options.filterable,
  28492. clearable: __props.element.options.clearable,
  28493. disabled: __props.disabled || __props.element.options.disabled,
  28494. style: normalizeStyle({ width: __props.element.options.width })
  28495. }, null, 8, ["modelValue", "options", "placeholder", "filterable", "clearable", "disabled", "style"])) : createCommentVNode("", true)
  28496. ]),
  28497. _: 2
  28498. }, [
  28499. __props.element.type === "download" ? {
  28500. name: "label",
  28501. fn: withCtx(({ label }) => [
  28502. createElementVNode("a", {
  28503. href: `/api/sys/common/static/${__props.element.options.defaultValue}?inline=1`,
  28504. style: { "color": "#606266" },
  28505. target: "_blank"
  28506. }, toDisplayString(label), 9, _hoisted_5$4)
  28507. ])
  28508. } : void 0
  28509. ]), 1032, ["label", "prop", "style", "label-width"])) : createCommentVNode("", true);
  28510. };
  28511. }
  28512. });
  28513. var GenerateFormItem = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-38ee7c8b"]]);
  28514. const _sfc_main$7 = defineComponent({
  28515. name: "FormGenerate",
  28516. components: {
  28517. GenerateFormItem
  28518. },
  28519. props: {
  28520. data: {
  28521. type: Object,
  28522. default: getWidgetForm()
  28523. },
  28524. value: {
  28525. type: Object
  28526. },
  28527. disabled: {
  28528. type: Boolean,
  28529. default: false
  28530. },
  28531. request: {
  28532. type: Function
  28533. }
  28534. },
  28535. setup(props) {
  28536. var _a2;
  28537. const state = reactive({
  28538. generateForm: null,
  28539. model: {},
  28540. updatedModel: {},
  28541. rules: {},
  28542. widgetForm: (_a2 = props.data && JSON.parse(JSON.stringify(props.data))) != null ? _a2 : getWidgetForm()
  28543. });
  28544. const generateModel = (list) => {
  28545. for (let index = 0; index < list.length; index++) {
  28546. const model = list[index].model;
  28547. if (!model)
  28548. return;
  28549. if (list[index].type === "grid") {
  28550. list[index].columns.forEach((col) => generateModel(col.list));
  28551. } else {
  28552. if (props.value && Object.keys(props.value).includes(model))
  28553. state.model[model] = props.value[model];
  28554. else
  28555. state.model[model] = list[index].options.defaultValue;
  28556. state.rules[model] = list[index].options.rules;
  28557. }
  28558. }
  28559. };
  28560. const generateOptions = (list) => {
  28561. list.forEach(async (item) => {
  28562. if (item.type === "grid") {
  28563. item.columns.forEach((col) => generateOptions(col.list));
  28564. } else {
  28565. if (item.options.remote && item.options.remoteFunc) {
  28566. if (props.request) {
  28567. const { data: data2 } = await props.request({
  28568. url: item.options.remoteFunc
  28569. });
  28570. item.options.remoteOptions = data2.map((i) => ({
  28571. label: i[item.options.props.label],
  28572. value: i[item.options.props.value],
  28573. children: i[item.options.props.children]
  28574. }));
  28575. return;
  28576. }
  28577. const token = sessionStorage.getItem("token");
  28578. fetch(item.options.remoteFunc, {
  28579. headers: {
  28580. "Content-type": " application/x-www-form-urlencoded; charset=UTF-8",
  28581. "Token": token
  28582. }
  28583. }).then((resp) => resp.json()).then((json) => {
  28584. const res = json.data;
  28585. if (res instanceof Array) {
  28586. item.options.remoteOptions = res.map((data2) => ({
  28587. label: data2[item.options.props.label],
  28588. value: data2[item.options.props.value],
  28589. children: data2[item.options.props.children]
  28590. }));
  28591. }
  28592. });
  28593. }
  28594. }
  28595. });
  28596. };
  28597. const updateWidgetForm = (list) => {
  28598. const listIndex2 = state.widgetForm.list.findIndex((item) => item.type === "grid");
  28599. state.widgetForm.list[listIndex2].columns = list;
  28600. state.model = __spreadProps(__spreadValues({}, state.model), { contactsId: "" });
  28601. };
  28602. watch(() => props.data, (val) => {
  28603. var _a3;
  28604. state.widgetForm = (_a3 = val && JSON.parse(JSON.stringify(val))) != null ? _a3 : getWidgetForm();
  28605. state.model = {};
  28606. state.rules = {};
  28607. generateModel(state.widgetForm.list);
  28608. generateOptions(state.widgetForm.list);
  28609. }, { deep: true, immediate: true });
  28610. const getData = () => {
  28611. return new Promise((resolve, reject) => {
  28612. state.generateForm.validate().then((validate) => {
  28613. if (validate)
  28614. resolve(state.updatedModel);
  28615. else
  28616. ElMessage.error("\u9A8C\u8BC1\u5931\u8D25");
  28617. }).catch((error) => {
  28618. reject(error);
  28619. });
  28620. });
  28621. };
  28622. const reset = () => {
  28623. state.generateForm.resetFields();
  28624. };
  28625. return __spreadProps(__spreadValues({}, toRefs(state)), {
  28626. getData,
  28627. reset,
  28628. updateWidgetForm
  28629. });
  28630. }
  28631. });
  28632. function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
  28633. const _component_GenerateFormItem = resolveComponent("GenerateFormItem");
  28634. const _component_el_form = ElForm;
  28635. return openBlock(), createBlock(_component_el_form, {
  28636. ref: "generateForm",
  28637. "label-suffix": ":",
  28638. model: _ctx.model,
  28639. rules: _ctx.rules,
  28640. size: _ctx.widgetForm.config.size,
  28641. "label-position": _ctx.widgetForm.config.labelPosition,
  28642. "label-width": `${_ctx.widgetForm.config.labelWidth}px`,
  28643. "hide-required-asterisk": _ctx.widgetForm.config.hideRequiredAsterisk
  28644. }, {
  28645. default: withCtx(() => [
  28646. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.widgetForm.list, (element, index) => {
  28647. return openBlock(), createBlock(_component_GenerateFormItem, {
  28648. key: element.key,
  28649. model: _ctx.model,
  28650. "updated-model": _ctx.updatedModel,
  28651. element: _ctx.widgetForm.list[index],
  28652. config: _ctx.data.config,
  28653. disabled: _ctx.disabled,
  28654. request: _ctx.request,
  28655. widgetFormData: _ctx.widgetForm.list,
  28656. onUpdateWidgetForm: _ctx.updateWidgetForm
  28657. }, null, 8, ["model", "updated-model", "element", "config", "disabled", "request", "widgetFormData", "onUpdateWidgetForm"]);
  28658. }), 128))
  28659. ]),
  28660. _: 1
  28661. }, 8, ["model", "rules", "size", "label-position", "label-width", "hide-required-asterisk"]);
  28662. }
  28663. var GenerateForm = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["render", _sfc_render$1]]);
  28664. const _hoisted_1$5 = { class: "px-3 py-2 text-sm text-gray-700" };
  28665. const _hoisted_2$4 = {
  28666. key: 0,
  28667. 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"
  28668. };
  28669. let listIndex = 1;
  28670. function setListIndex(list) {
  28671. if (list.list.length > 0) {
  28672. const array4 = list.list.map((item) => item.model);
  28673. const plateNumbers = array4.filter((item) => item.includes("plate")).map((item) => {
  28674. const match = item.match(/plate(\d+)/);
  28675. return match ? match[1] : null;
  28676. });
  28677. listIndex = findMissingPositive(plateNumbers);
  28678. }
  28679. }
  28680. function cloneWidget(params) {
  28681. const key = Math.random().toString(36).substring(2, 9);
  28682. params = cloneDeep(__spreadProps(__spreadValues({}, params), {
  28683. key,
  28684. model: `plate${listIndex}`
  28685. }));
  28686. if (params.type === "grid") {
  28687. params.columns.forEach((i) => {
  28688. i.list = i.list.map(cloneWidget);
  28689. });
  28690. }
  28691. return params;
  28692. }
  28693. function findMissingPositive(nums) {
  28694. let numbers = nums.map(Number);
  28695. numbers.sort((a2, b2) => a2 - b2);
  28696. let missing = 1;
  28697. for (let i = 0; i < numbers.length; i++) {
  28698. if (numbers[i] === missing) {
  28699. missing++;
  28700. }
  28701. }
  28702. return missing;
  28703. }
  28704. const _sfc_main$6 = /* @__PURE__ */ defineComponent({
  28705. props: {
  28706. fields: null,
  28707. title: null,
  28708. list: null,
  28709. allList: null
  28710. },
  28711. setup(__props) {
  28712. const props = __props;
  28713. let moveFlag = ref(false);
  28714. const moveStart = () => {
  28715. const array4 = props.allList.list.map((item) => item.model);
  28716. const plateNumbers = array4.filter((item) => item.includes("plate")).map((item) => {
  28717. const match = item.match(/plate(\d+)/);
  28718. return match ? match[1] : null;
  28719. });
  28720. const flag = plateNumbers.length < 5;
  28721. if (!flag && !moveFlag.value) {
  28722. moveFlag.value = true;
  28723. ElMessage.warning("\u6700\u591A\u6DFB\u52A0\u4E94\u4E2A");
  28724. return false;
  28725. }
  28726. return flag;
  28727. };
  28728. const stopMove = () => {
  28729. moveFlag.value = false;
  28730. };
  28731. return (_ctx, _cache) => {
  28732. return openBlock(), createElementBlock(Fragment, null, [
  28733. createElementVNode("div", _hoisted_1$5, toDisplayString(__props.title), 1),
  28734. createVNode(unref(Draggable), {
  28735. tag: "ul",
  28736. class: "m-0 p-3 pt-0 grid grid-cols-2 gap-1",
  28737. "item-key": "type",
  28738. group: { name: "form-design", pull: "clone", put: false },
  28739. clone: cloneWidget,
  28740. sort: false,
  28741. list: __props.list,
  28742. allList: __props.allList,
  28743. move: moveStart,
  28744. choose: setListIndex(__props.allList),
  28745. onAdd: _cache[0] || (_cache[0] = ($event) => stopMove())
  28746. }, {
  28747. item: withCtx(({ element }) => [
  28748. __props.fields.includes(element.type) ? (openBlock(), createElementBlock("li", _hoisted_2$4, [
  28749. createElementVNode("i", {
  28750. class: normalizeClass(["custom:" + element.type, "ml-2 mr-1"])
  28751. }, null, 2),
  28752. createElementVNode("span", null, toDisplayString(element.label), 1)
  28753. ])) : createCommentVNode("", true)
  28754. ]),
  28755. _: 1
  28756. }, 8, ["list", "allList", "choose"])
  28757. ], 64);
  28758. };
  28759. }
  28760. });
  28761. const _hoisted_1$4 = { key: 12 };
  28762. const _hoisted_2$3 = {
  28763. key: 1,
  28764. class: "custom:insert"
  28765. };
  28766. const _hoisted_3$3 = /* @__PURE__ */ createElementVNode("i", {
  28767. "icon-class": "custom:img-upload",
  28768. style: { "margin-right": "10px" }
  28769. }, null, -1);
  28770. const _hoisted_4$3 = /* @__PURE__ */ createTextVNode(" \u70B9\u51FB\u4E0A\u4F20 ");
  28771. const _hoisted_5$3 = /* @__PURE__ */ createTextVNode(" \u4E0B\u8F7D ");
  28772. const _hoisted_6$3 = /* @__PURE__ */ createElementVNode("i", {
  28773. class: "eva:move-outline",
  28774. "text-lg": ""
  28775. }, null, -1);
  28776. const _hoisted_7$2 = [
  28777. _hoisted_6$3
  28778. ];
  28779. const _sfc_main$5 = /* @__PURE__ */ defineComponent({
  28780. props: {
  28781. list: null,
  28782. element: null,
  28783. index: null,
  28784. selectWidget: null,
  28785. configurationItems: null
  28786. },
  28787. emits: ["itemClick", "delete", "update:selectWidget"],
  28788. setup(__props) {
  28789. const props = createPropsRestProxy(__props, ["element", "index", "list"]);
  28790. let selectWidget = useVModel(props, "selectWidget");
  28791. const { userInfo = {} } = JSON.parse(sessionStorage.getItem("storeInfo") || "{}");
  28792. const handleDeleteClick = () => {
  28793. __props.list.splice(__props.index, 1);
  28794. selectWidget.value = __props.list[__props.list.length === __props.index ? __props.index - 1 : __props.index];
  28795. };
  28796. return (_ctx, _cache) => {
  28797. var _a2, _b2;
  28798. const _component_WidgetFormItem = resolveComponent("WidgetFormItem", true);
  28799. const _component_el_table_column = ElTableColumn;
  28800. const _component_el_table = ElTable;
  28801. const _component_el_divider = ElDivider;
  28802. const _component_el_input = ElInput;
  28803. const _component_el_input_number = ElInputNumber;
  28804. const _component_el_radio = ElRadio;
  28805. const _component_el_radio_group = ElRadioGroup;
  28806. const _component_el_checkbox = ElCheckbox;
  28807. const _component_el_checkbox_group = ElCheckboxGroup$1;
  28808. const _component_el_time_picker = ElTimePicker;
  28809. const _component_el_date_picker = ElDatePicker;
  28810. const _component_el_rate = ElRate;
  28811. const _component_el_option = ElOption;
  28812. const _component_el_select = ElSelect;
  28813. const _component_el_switch = ElSwitch;
  28814. const _component_el_slider = ElSlider;
  28815. const _component_el_image = ElImage;
  28816. const _component_el_button = ElButton;
  28817. const _component_el_upload = ElUpload;
  28818. const _component_el_cascader = ElCascader;
  28819. const _component_el_form_item = ElFormItem;
  28820. return openBlock(), createElementBlock("div", {
  28821. class: normalizeClass(["widget-view", { active: ((_a2 = selectWidget.value) == null ? void 0 : _a2.key) === __props.element.key, col: __props.element.type === "grid" }]),
  28822. style: normalizeStyle(__props.element.type === "grid" ? `gap: ${__props.element.options.gutter}px; align-items: ${__props.element.options.align};` : ""),
  28823. onClick: _cache[3] || (_cache[3] = withModifiers(($event) => selectWidget.value = __props.element, ["stop"]))
  28824. }, [
  28825. __props.element.type === "grid" ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(__props.element.columns, (col, key) => {
  28826. return openBlock(), createBlock(unref(Draggable), {
  28827. key,
  28828. class: "bg-white min-h-12 border border-dashed border-gray-300",
  28829. style: normalizeStyle(`grid-column: span ${col.span}`),
  28830. "item-key": "key",
  28831. handle: "[cursor-move]",
  28832. animation: 200,
  28833. group: "form-design",
  28834. "no-transition-on-drag": true,
  28835. list: col.list,
  28836. onAdd: ($event) => selectWidget.value = col.list[$event.newIndex]
  28837. }, {
  28838. item: withCtx(({ element: colElement, index: colIndex }) => [
  28839. createVNode(_component_WidgetFormItem, {
  28840. selectWidget: selectWidget.value,
  28841. "onUpdate:selectWidget": _cache[0] || (_cache[0] = ($event) => selectWidget.value = $event),
  28842. element: colElement,
  28843. list: col.list,
  28844. index: colIndex,
  28845. configurationItems: __props.configurationItems
  28846. }, null, 8, ["selectWidget", "element", "list", "index", "configurationItems"])
  28847. ]),
  28848. _: 2
  28849. }, 1032, ["style", "list", "onAdd"]);
  28850. }), 128)) : __props.element.type === "table" ? (openBlock(), createBlock(_component_el_table, {
  28851. key: 1,
  28852. class: "w-0 flex-1",
  28853. border: "",
  28854. data: __props.element.options.defaultValue
  28855. }, {
  28856. default: withCtx(() => [
  28857. (openBlock(true), createElementBlock(Fragment, null, renderList(__props.element.columns, (i) => {
  28858. return openBlock(), createBlock(_component_el_table_column, mergeProps({
  28859. key: i.prop,
  28860. "header-align": __props.element.options.align,
  28861. align: __props.element.options.align
  28862. }, i), null, 16, ["header-align", "align"]);
  28863. }), 128))
  28864. ]),
  28865. _: 1
  28866. }, 8, ["data"])) : __props.element.type === "divider" ? (openBlock(), createBlock(_component_el_divider, {
  28867. key: 2,
  28868. class: "pb-0",
  28869. data: __props.element.options.defaultValue,
  28870. "content-position": "left"
  28871. }, {
  28872. default: withCtx(() => [
  28873. createTextVNode(toDisplayString(__props.element.label), 1)
  28874. ]),
  28875. _: 1
  28876. }, 8, ["data"])) : __props.element ? (openBlock(), createBlock(_component_el_form_item, {
  28877. key: __props.element.key,
  28878. label: __props.element.label,
  28879. "label-width": __props.element.labelWidth,
  28880. rules: __props.element.options.rules
  28881. }, {
  28882. default: withCtx(() => [
  28883. __props.element.type === "input" ? (openBlock(), createBlock(_component_el_input, {
  28884. key: 0,
  28885. readonly: "",
  28886. "model-value": __props.element.options.defaultValue,
  28887. style: normalizeStyle({ width: __props.element.options.width }),
  28888. placeholder: __props.element.options.placeholder,
  28889. maxlength: parseInt(__props.element.options.maxlength),
  28890. clearable: __props.element.options.clearable,
  28891. disabled: __props.element.options.disabled
  28892. }, createSlots({ _: 2 }, [
  28893. __props.element.options.prefix ? {
  28894. name: "prefix",
  28895. fn: withCtx(() => [
  28896. createTextVNode(toDisplayString(__props.element.options.prefix), 1)
  28897. ])
  28898. } : void 0,
  28899. __props.element.options.suffix ? {
  28900. name: "suffix",
  28901. fn: withCtx(() => [
  28902. createTextVNode(toDisplayString(__props.element.options.suffix), 1)
  28903. ])
  28904. } : void 0,
  28905. __props.element.options.prepend ? {
  28906. name: "prepend",
  28907. fn: withCtx(() => [
  28908. createTextVNode(toDisplayString(__props.element.options.prepend), 1)
  28909. ])
  28910. } : void 0,
  28911. __props.element.options.append ? {
  28912. name: "append",
  28913. fn: withCtx(() => [
  28914. createTextVNode(toDisplayString(__props.element.options.append), 1)
  28915. ])
  28916. } : void 0
  28917. ]), 1032, ["model-value", "style", "placeholder", "maxlength", "clearable", "disabled"])) : createCommentVNode("", true),
  28918. __props.element.type === "password" ? (openBlock(), createBlock(_component_el_input, {
  28919. key: 1,
  28920. readonly: "",
  28921. "model-value": __props.element.options.defaultValue,
  28922. style: normalizeStyle({ width: __props.element.options.width }),
  28923. placeholder: __props.element.options.placeholder,
  28924. maxlength: parseInt(__props.element.options.maxlength),
  28925. clearable: __props.element.options.clearable,
  28926. disabled: __props.element.options.disabled,
  28927. "show-password": __props.element.options.showPassword
  28928. }, createSlots({ _: 2 }, [
  28929. __props.element.options.prefix ? {
  28930. name: "prefix",
  28931. fn: withCtx(() => [
  28932. createTextVNode(toDisplayString(__props.element.options.prefix), 1)
  28933. ])
  28934. } : void 0,
  28935. __props.element.options.suffix ? {
  28936. name: "suffix",
  28937. fn: withCtx(() => [
  28938. createTextVNode(toDisplayString(__props.element.options.suffix), 1)
  28939. ])
  28940. } : void 0,
  28941. __props.element.options.prepend ? {
  28942. name: "prepend",
  28943. fn: withCtx(() => [
  28944. createTextVNode(toDisplayString(__props.element.options.prepend), 1)
  28945. ])
  28946. } : void 0,
  28947. __props.element.options.append ? {
  28948. name: "append",
  28949. fn: withCtx(() => [
  28950. createTextVNode(toDisplayString(__props.element.options.append), 1)
  28951. ])
  28952. } : void 0
  28953. ]), 1032, ["model-value", "style", "placeholder", "maxlength", "clearable", "disabled", "show-password"])) : createCommentVNode("", true),
  28954. __props.element.type === "textarea" ? (openBlock(), createBlock(_component_el_input, {
  28955. key: 2,
  28956. type: "textarea",
  28957. resize: "none",
  28958. readonly: "",
  28959. rows: __props.element.options.rows,
  28960. "model-value": __props.element.options.defaultValue,
  28961. style: normalizeStyle({ width: __props.element.options.width }),
  28962. placeholder: __props.element.options.placeholder,
  28963. maxlength: parseInt(__props.element.options.maxlength),
  28964. "show-word-limit": __props.element.options.showWordLimit,
  28965. autosize: __props.element.options.autosize,
  28966. clearable: __props.element.options.clearable,
  28967. disabled: __props.element.options.disabled
  28968. }, null, 8, ["rows", "model-value", "style", "placeholder", "maxlength", "show-word-limit", "autosize", "clearable", "disabled"])) : createCommentVNode("", true),
  28969. __props.element.type === "number" ? (openBlock(), createBlock(_component_el_input_number, {
  28970. key: 3,
  28971. "model-value": __props.element.options.defaultValue,
  28972. style: normalizeStyle({ width: __props.element.options.width }),
  28973. max: __props.element.options.max,
  28974. min: __props.element.options.min,
  28975. disabled: __props.element.options.disabled,
  28976. "controls-position": "right"
  28977. }, null, 8, ["model-value", "style", "max", "min", "disabled"])) : createCommentVNode("", true),
  28978. __props.element.type === "radio" ? (openBlock(), createBlock(_component_el_radio_group, {
  28979. key: 4,
  28980. "model-value": __props.element.options.defaultValue,
  28981. style: normalizeStyle({ width: __props.element.options.width }),
  28982. disabled: __props.element.options.disabled
  28983. }, {
  28984. default: withCtx(() => [
  28985. (openBlock(true), createElementBlock(Fragment, null, renderList(__props.element.options.options, (item) => {
  28986. return openBlock(), createBlock(_component_el_radio, {
  28987. key: item.value,
  28988. label: item.value,
  28989. style: normalizeStyle({
  28990. display: __props.element.options.inline ? "inline-block" : "block"
  28991. })
  28992. }, {
  28993. default: withCtx(() => [
  28994. createTextVNode(toDisplayString(__props.element.options.showLabel ? item.label : item.value), 1)
  28995. ]),
  28996. _: 2
  28997. }, 1032, ["label", "style"]);
  28998. }), 128))
  28999. ]),
  29000. _: 1
  29001. }, 8, ["model-value", "style", "disabled"])) : createCommentVNode("", true),
  29002. __props.element.type === "checkbox" ? (openBlock(), createBlock(_component_el_checkbox_group, {
  29003. key: 5,
  29004. "model-value": __props.element.options.defaultValue,
  29005. style: normalizeStyle({ width: __props.element.options.width }),
  29006. disabled: __props.element.options.disabled
  29007. }, {
  29008. default: withCtx(() => [
  29009. (openBlock(true), createElementBlock(Fragment, null, renderList(__props.element.options.options, (item) => {
  29010. return openBlock(), createBlock(_component_el_checkbox, {
  29011. key: item.value,
  29012. label: item.value,
  29013. style: normalizeStyle({
  29014. display: __props.element.options.inline ? "inline-block" : "block"
  29015. })
  29016. }, {
  29017. default: withCtx(() => [
  29018. createTextVNode(toDisplayString(__props.element.options.showLabel ? item.label : item.value), 1)
  29019. ]),
  29020. _: 2
  29021. }, 1032, ["label", "style"]);
  29022. }), 128))
  29023. ]),
  29024. _: 1
  29025. }, 8, ["model-value", "style", "disabled"])) : createCommentVNode("", true),
  29026. __props.element.type === "time" ? (openBlock(), createBlock(_component_el_time_picker, {
  29027. key: 6,
  29028. "model-value": __props.element.options.defaultValue,
  29029. placeholder: __props.element.options.placeholder,
  29030. readonly: __props.element.options.readonly,
  29031. editable: __props.element.options.editable,
  29032. clearable: __props.element.options.clearable,
  29033. format: __props.element.options.format,
  29034. disabled: __props.element.options.disabled,
  29035. style: normalizeStyle({ width: __props.element.options.width })
  29036. }, null, 8, ["model-value", "placeholder", "readonly", "editable", "clearable", "format", "disabled", "style"])) : createCommentVNode("", true),
  29037. __props.element.type === "date" ? (openBlock(), createBlock(_component_el_date_picker, {
  29038. key: 7,
  29039. "model-value": __props.element.options.defaultValue,
  29040. placeholder: __props.element.options.placeholder,
  29041. readonly: __props.element.options.readonly,
  29042. editable: __props.element.options.editable,
  29043. clearable: __props.element.options.clearable,
  29044. format: __props.element.options.format,
  29045. disabled: __props.element.options.disabled,
  29046. style: normalizeStyle({ width: __props.element.options.width })
  29047. }, null, 8, ["model-value", "placeholder", "readonly", "editable", "clearable", "format", "disabled", "style"])) : createCommentVNode("", true),
  29048. __props.element.type === "rate" ? (openBlock(), createBlock(_component_el_rate, {
  29049. key: 8,
  29050. "model-value": __props.element.options.defaultValue,
  29051. max: __props.element.options.max,
  29052. "allow-half": __props.element.options.allowHalf,
  29053. disabled: __props.element.options.disabled
  29054. }, null, 8, ["model-value", "max", "allow-half", "disabled"])) : createCommentVNode("", true),
  29055. __props.element.type === "select" ? (openBlock(), createElementBlock(Fragment, { key: 9 }, [
  29056. unref(userInfo).userNameNeedTranslate == 1 && __props.element.options.remoteFunc.indexOf("getSimpleActiveUserListNew") > -1 ? (openBlock(), createBlock(_sfc_main$9, {
  29057. key: 0,
  29058. "model-value": __props.element.options.defaultValue,
  29059. multiple: __props.element.options.multiple,
  29060. placeholder: __props.element.options.placeholder,
  29061. clearable: __props.element.options.clearable,
  29062. filterable: __props.element.options.filterable,
  29063. disabled: __props.element.options.disabled,
  29064. url: __props.element.options.remoteFunc,
  29065. size: __props.configurationItems.size,
  29066. options: [],
  29067. style: normalizeStyle({ width: __props.element.options.width })
  29068. }, null, 8, ["model-value", "multiple", "placeholder", "clearable", "filterable", "disabled", "url", "size", "style"])) : (openBlock(), createBlock(_component_el_select, {
  29069. key: 1,
  29070. "model-value": __props.element.options.defaultValue,
  29071. multiple: __props.element.options.multiple,
  29072. placeholder: __props.element.options.placeholder,
  29073. clearable: __props.element.options.clearable,
  29074. filterable: __props.element.options.filterable,
  29075. disabled: __props.element.options.disabled,
  29076. style: normalizeStyle({ width: __props.element.options.width })
  29077. }, {
  29078. default: withCtx(() => [
  29079. (openBlock(true), createElementBlock(Fragment, null, renderList(__props.element.options.options, (item) => {
  29080. return openBlock(), createBlock(_component_el_option, {
  29081. key: item.value,
  29082. value: item.value,
  29083. label: __props.element.options.showLabel ? item.label : item.value
  29084. }, null, 8, ["value", "label"]);
  29085. }), 128))
  29086. ]),
  29087. _: 1
  29088. }, 8, ["model-value", "multiple", "placeholder", "clearable", "filterable", "disabled", "style"]))
  29089. ], 64)) : createCommentVNode("", true),
  29090. __props.element.type === "switch" ? (openBlock(), createBlock(_component_el_switch, {
  29091. key: 10,
  29092. "model-value": __props.element.options.defaultValue,
  29093. "active-text": __props.element.options.activeText,
  29094. "inactive-text": __props.element.options.inactiveText,
  29095. disabled: __props.element.options.disabled
  29096. }, null, 8, ["model-value", "active-text", "inactive-text", "disabled"])) : createCommentVNode("", true),
  29097. __props.element.type === "slider" ? (openBlock(), createBlock(_component_el_slider, {
  29098. key: 11,
  29099. "model-value": __props.element.options.defaultValue,
  29100. min: __props.element.options.min,
  29101. max: __props.element.options.max,
  29102. step: __props.element.options.step,
  29103. range: __props.element.options.range,
  29104. disabled: __props.element.options.disabled,
  29105. style: normalizeStyle({ width: __props.element.options.width })
  29106. }, null, 8, ["model-value", "min", "max", "step", "range", "disabled", "style"])) : createCommentVNode("", true),
  29107. __props.element.type == "text" ? (openBlock(), createElementBlock("span", _hoisted_1$4, toDisplayString(__props.element.options.defaultValue), 1)) : createCommentVNode("", true),
  29108. __props.element.type === "img-upload" ? (openBlock(), createBlock(_component_el_upload, {
  29109. key: 13,
  29110. name: __props.element.options.file,
  29111. action: __props.element.options.action,
  29112. accept: __props.element.options.accept,
  29113. "list-type": __props.element.options.listType,
  29114. multiple: __props.element.options.multiple,
  29115. limit: __props.element.options.limit,
  29116. disabled: __props.element.options.disabled
  29117. }, {
  29118. default: withCtx(() => {
  29119. var _a3;
  29120. return [
  29121. __props.element.options.listType === "picture-card" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  29122. ((_a3 = __props.element.options.defaultValue) == null ? void 0 : _a3.length) ? (openBlock(), createBlock(_component_el_image, {
  29123. key: 0,
  29124. style: { "width": "100%", "height": "100%" },
  29125. "preview-src-list": [
  29126. "/api/sys/common/static/" + __props.element.options.defaultValue
  29127. ],
  29128. src: "/api/sys/common/static/" + __props.element.options.defaultValue
  29129. }, null, 8, ["preview-src-list", "src"])) : (openBlock(), createElementBlock("i", _hoisted_2$3))
  29130. ], 64)) : (openBlock(), createBlock(_component_el_button, { key: 1 }, {
  29131. default: withCtx(() => [
  29132. _hoisted_3$3,
  29133. _hoisted_4$3
  29134. ]),
  29135. _: 1
  29136. }))
  29137. ];
  29138. }),
  29139. _: 1
  29140. }, 8, ["name", "action", "accept", "list-type", "multiple", "limit", "disabled"])) : createCommentVNode("", true),
  29141. __props.element.type === "download" ? (openBlock(), createBlock(_component_el_button, {
  29142. key: 14,
  29143. type: "text",
  29144. style: { "margin-top": "-4px" }
  29145. }, {
  29146. default: withCtx(() => [
  29147. _hoisted_5$3
  29148. ]),
  29149. _: 1
  29150. })) : createCommentVNode("", true),
  29151. __props.element.type === "cascader" ? (openBlock(), createBlock(_component_el_cascader, {
  29152. key: 15,
  29153. "model-value": __props.element.options.defaultValue,
  29154. options: __props.element.options.remoteOptions,
  29155. placeholder: __props.element.options.placeholder,
  29156. filterable: __props.element.options.filterable,
  29157. clearable: __props.element.options.clearable,
  29158. disabled: __props.element.options.disabled,
  29159. style: normalizeStyle({ width: __props.element.options.width })
  29160. }, null, 8, ["model-value", "options", "placeholder", "filterable", "clearable", "disabled", "style"])) : createCommentVNode("", true)
  29161. ]),
  29162. _: 1
  29163. }, 8, ["label", "label-width", "rules"])) : createCommentVNode("", true),
  29164. ((_b2 = selectWidget.value) == null ? void 0 : _b2.key) === __props.element.key ? (openBlock(), createElementBlock(Fragment, { key: 4 }, [
  29165. createElementVNode("div", {
  29166. absolute: "",
  29167. "z-10": "",
  29168. "left-0": "",
  29169. top: "-.5",
  29170. "bg-blue-500": "",
  29171. "text-white": "",
  29172. p: ".5 l-0 t-0",
  29173. "cursor-move": "",
  29174. class: normalizeClass({ "bg-yellow-500": __props.element.type === "grid" })
  29175. }, _hoisted_7$2, 2),
  29176. createElementVNode("div", {
  29177. absolute: "",
  29178. "z-10": "",
  29179. "right-0": "",
  29180. bottom: "-0.5",
  29181. "bg-blue-500": "",
  29182. flex: "",
  29183. "gap-1": "",
  29184. p: "1 r-.5",
  29185. "text-white": "",
  29186. "cursor-pointer": "",
  29187. class: normalizeClass({ "bg-yellow-500": __props.element.type === "grid" })
  29188. }, [
  29189. createCommentVNode("", true),
  29190. !__props.element.allDisable ? (openBlock(), createElementBlock("i", {
  29191. key: 1,
  29192. class: "fa6-regular:trash-can",
  29193. onClick: _cache[2] || (_cache[2] = withModifiers(($event) => handleDeleteClick(), ["stop"]))
  29194. })) : createCommentVNode("", true)
  29195. ], 2)
  29196. ], 64)) : createCommentVNode("", true)
  29197. ], 6);
  29198. };
  29199. }
  29200. });
  29201. var WidgetForm_vue_vue_type_style_index_0_lang = "";
  29202. const _hoisted_1$3 = {
  29203. key: 0,
  29204. text: "gray-400 lg",
  29205. absolute: "",
  29206. "top-50": "",
  29207. left: "1/2",
  29208. "translate-x": "-1/2"
  29209. };
  29210. const _sfc_main$4 = /* @__PURE__ */ defineComponent({
  29211. props: {
  29212. list: null,
  29213. config: null,
  29214. selectWidget: null
  29215. },
  29216. emits: ["update:selectWidget"],
  29217. setup(__props) {
  29218. const props = __props;
  29219. const selectWidget = useVModel(props, "selectWidget");
  29220. return (_ctx, _cache) => {
  29221. const _component_el_form = ElForm;
  29222. return openBlock(), createBlock(_component_el_form, mergeProps({
  29223. "label-suffix": ":",
  29224. "bg-gray-50": "",
  29225. relative: "",
  29226. flex: "~ 1"
  29227. }, __props.config, { class: "layoutForm" }), {
  29228. default: withCtx(() => {
  29229. var _a2;
  29230. return [
  29231. !((_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),
  29232. createVNode(unref(Draggable), {
  29233. class: "flex-1 m-2 bg-white shadow p-1",
  29234. "item-key": "key",
  29235. handle: "[cursor-move]",
  29236. animation: 200,
  29237. group: "form-design",
  29238. list: __props.list,
  29239. onAdd: _cache[1] || (_cache[1] = ($event) => selectWidget.value = __props.list[$event.newIndex])
  29240. }, {
  29241. item: withCtx(({ element, index }) => [
  29242. createVNode(_sfc_main$5, {
  29243. selectWidget: unref(selectWidget),
  29244. "onUpdate:selectWidget": _cache[0] || (_cache[0] = ($event) => isRef(selectWidget) ? selectWidget.value = $event : null),
  29245. element,
  29246. index,
  29247. list: __props.list,
  29248. configurationItems: __props.config
  29249. }, null, 8, ["selectWidget", "element", "index", "list", "configurationItems"])
  29250. ]),
  29251. _: 1
  29252. }, 8, ["list"])
  29253. ];
  29254. }),
  29255. _: 1
  29256. }, 16);
  29257. };
  29258. }
  29259. });
  29260. var elSpace = "";
  29261. var elRadioButton = "";
  29262. var WidgetConfig_vue_vue_type_style_index_0_lang = "";
  29263. const _sfc_main$3 = defineComponent({
  29264. name: "ElWidgetConfig",
  29265. components: {
  29266. Draggable
  29267. },
  29268. props: {
  29269. select: {
  29270. type: Object
  29271. }
  29272. },
  29273. emits: ["update:select"],
  29274. setup(props, context) {
  29275. const data2 = ref(props.select);
  29276. watch(() => props.select, (val) => data2.value = val);
  29277. watch(data2, (val) => context.emit("update:select", val), { deep: true });
  29278. const hasKey = (key) => Object.keys(data2.value.options).includes(key);
  29279. const handleInsertColumn = () => {
  29280. data2.value.columns.push({
  29281. span: 0,
  29282. list: []
  29283. });
  29284. };
  29285. const handleInsertOption = () => {
  29286. const index = data2.value.options.options.length + 1;
  29287. data2.value.options.options.push({
  29288. label: `Option ${index}`,
  29289. value: `Option ${index}`
  29290. });
  29291. };
  29292. const handleOptionsRemove = (index) => {
  29293. if (data2.value.type === "grid")
  29294. data2.value.columns.splice(index, 1);
  29295. else
  29296. data2.value.options.options.splice(index, 1);
  29297. };
  29298. const handleSliderModeChange = (checked) => {
  29299. checked ? data2.value.options.defaultValue = [10, 90] : data2.value.options.defaultValue = 0;
  29300. };
  29301. const handleSelectModeChange = (val) => {
  29302. if (data2.value.type === "img-upload")
  29303. return;
  29304. if (val) {
  29305. if (data2.value.options.defaultValue) {
  29306. if (!(data2.value.options.defaultValue instanceof Array))
  29307. data2.value.options.defaultValue = [data2.value.options.defaultValue];
  29308. } else {
  29309. data2.value.options.defaultValue = [];
  29310. }
  29311. } else {
  29312. data2.value.options.defaultValue.length ? data2.value.options.defaultValue = data2.value.options.defaultValue[0] : data2.value.options.defaultValue = null;
  29313. }
  29314. };
  29315. return {
  29316. data: data2,
  29317. hasKey,
  29318. handleInsertColumn,
  29319. handleInsertOption,
  29320. handleOptionsRemove,
  29321. handleSliderModeChange,
  29322. handleSelectModeChange
  29323. };
  29324. }
  29325. });
  29326. const _hoisted_1$2 = /* @__PURE__ */ createTextVNode(" \u884C\u5185 ");
  29327. const _hoisted_2$2 = /* @__PURE__ */ createTextVNode(" \u5757\u7EA7 ");
  29328. const _hoisted_3$2 = /* @__PURE__ */ createTextVNode(" \u9759\u6001\u6570\u636E ");
  29329. const _hoisted_4$2 = /* @__PURE__ */ createTextVNode(" \u8FDC\u7AEF\u6570\u636E ");
  29330. const _hoisted_5$2 = /* @__PURE__ */ createTextVNode(" \u8FDC\u7AEF\u65B9\u6CD5 ");
  29331. const _hoisted_6$2 = /* @__PURE__ */ createTextVNode(" \u6807\u7B7E ");
  29332. const _hoisted_7$1 = /* @__PURE__ */ createTextVNode(" \u503C ");
  29333. const _hoisted_8$1 = { class: "flex items-center" };
  29334. const _hoisted_9$1 = /* @__PURE__ */ createElementVNode("i", {
  29335. style: { "margin": "0 5px", "cursor": "move" },
  29336. class: "drag-item custom:item"
  29337. }, null, -1);
  29338. const _hoisted_10$1 = /* @__PURE__ */ createElementVNode("i", { class: "fa6-regular:trash-can" }, null, -1);
  29339. const _hoisted_11$1 = { class: "flex items-center justify-center gap-2 mb-2" };
  29340. const _hoisted_12$1 = /* @__PURE__ */ createTextVNode(/* @__PURE__ */ toDisplayString(""));
  29341. const _hoisted_13$1 = /* @__PURE__ */ createElementVNode("i", { class: "cursor-move text-sm custom:item" }, null, -1);
  29342. const _hoisted_14$1 = /* @__PURE__ */ createElementVNode("i", { class: "fa6-regular:trash-can" }, null, -1);
  29343. const _hoisted_15 = { style: { "margin-top": "5px" } };
  29344. const _hoisted_16 = /* @__PURE__ */ createTextVNode(" \u6DFB\u52A0\u9009\u9879 ");
  29345. const _hoisted_17 = /* @__PURE__ */ createTextVNode(" text ");
  29346. const _hoisted_18 = /* @__PURE__ */ createTextVNode(" picture ");
  29347. const _hoisted_19 = /* @__PURE__ */ createTextVNode(" picture-card ");
  29348. const _hoisted_20 = /* @__PURE__ */ createTextVNode(" POST ");
  29349. const _hoisted_21 = /* @__PURE__ */ createTextVNode(" PUT ");
  29350. const _hoisted_22 = /* @__PURE__ */ createTextVNode(" GET ");
  29351. const _hoisted_23 = /* @__PURE__ */ createTextVNode(" DELETE ");
  29352. const _hoisted_24 = /* @__PURE__ */ createTextVNode(" \u8FDC\u7AEF\u65B9\u6CD5 ");
  29353. const _hoisted_25 = /* @__PURE__ */ createTextVNode(" \u6807\u7B7E ");
  29354. const _hoisted_26 = /* @__PURE__ */ createTextVNode(" \u503C ");
  29355. const _hoisted_27 = /* @__PURE__ */ createTextVNode(" \u5B50\u9009\u9879 ");
  29356. const _hoisted_28 = { style: { "display": "flex", "gap": "5px", "margin-bottom": "5px" } };
  29357. const _hoisted_29 = /* @__PURE__ */ createElementVNode("i", { class: "drag-item custom:item" }, null, -1);
  29358. const _hoisted_30 = /* @__PURE__ */ createElementVNode("i", { class: "fa6-regular:trash-can" }, null, -1);
  29359. const _hoisted_31 = /* @__PURE__ */ createTextVNode(" \u6DFB\u52A0\u5217 ");
  29360. const _hoisted_32 = /* @__PURE__ */ createTextVNode(" \u5C45\u5DE6\u5BF9\u9F50 ");
  29361. const _hoisted_33 = /* @__PURE__ */ createTextVNode(" \u5C45\u4E2D\u5BF9\u9F50 ");
  29362. const _hoisted_34 = /* @__PURE__ */ createTextVNode(" \u5DE8\u53F3\u5BF9\u9F50 ");
  29363. const _hoisted_35 = { style: { "margin-bottom": "5px" } };
  29364. const _hoisted_36 = /* @__PURE__ */ createElementVNode("i", { class: "drag-item custom:item" }, null, -1);
  29365. const _hoisted_37 = /* @__PURE__ */ createElementVNode("i", { class: "fa6-regular:trash-can" }, null, -1);
  29366. const _hoisted_38 = /* @__PURE__ */ createTextVNode(" \u6DFB\u52A0\u5217 ");
  29367. const _hoisted_39 = /* @__PURE__ */ createTextVNode(" \u9876\u90E8\u5BF9\u9F50 ");
  29368. const _hoisted_40 = /* @__PURE__ */ createTextVNode(" \u5C45\u4E2D\u5BF9\u9F50 ");
  29369. const _hoisted_41 = /* @__PURE__ */ createTextVNode(" \u5E95\u90E8\u5BF9\u9F50 ");
  29370. const _hoisted_42 = /* @__PURE__ */ createTextVNode(" \u5FC5\u586B ");
  29371. const _hoisted_43 = /* @__PURE__ */ createTextVNode(" \u53EA\u8BFB ");
  29372. const _hoisted_44 = /* @__PURE__ */ createTextVNode(" \u7981\u7528 ");
  29373. const _hoisted_45 = /* @__PURE__ */ createTextVNode(" \u6E05\u9664 ");
  29374. 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);
  29375. const _hoisted_47 = /* @__PURE__ */ createTextVNode(" Blur ");
  29376. const _hoisted_48 = /* @__PURE__ */ createTextVNode(" Change ");
  29377. const _hoisted_49 = /* @__PURE__ */ createTextVNode(" \u5B57\u7B26\u4E32 ");
  29378. const _hoisted_50 = /* @__PURE__ */ createTextVNode(" \u6570\u5B57 ");
  29379. const _hoisted_51 = /* @__PURE__ */ createTextVNode(" \u5E03\u5C14\u503C ");
  29380. const _hoisted_52 = /* @__PURE__ */ createTextVNode(" \u65B9\u6CD5 ");
  29381. const _hoisted_53 = /* @__PURE__ */ createTextVNode(" \u6B63\u5219\u8868\u8FBE\u5F0F ");
  29382. const _hoisted_54 = /* @__PURE__ */ createTextVNode(" \u6574\u6570 ");
  29383. const _hoisted_55 = /* @__PURE__ */ createTextVNode(" \u6D6E\u70B9\u6570 ");
  29384. const _hoisted_56 = /* @__PURE__ */ createTextVNode(" \u6570\u7EC4 ");
  29385. const _hoisted_57 = /* @__PURE__ */ createTextVNode(" \u5BF9\u8C61 ");
  29386. const _hoisted_58 = /* @__PURE__ */ createTextVNode(" \u679A\u4E3E ");
  29387. const _hoisted_59 = /* @__PURE__ */ createTextVNode(" \u65E5\u671F ");
  29388. const _hoisted_60 = /* @__PURE__ */ createTextVNode(" URL\u5730\u5740 ");
  29389. const _hoisted_61 = /* @__PURE__ */ createTextVNode(" \u5341\u516D\u8FDB\u5236 ");
  29390. const _hoisted_62 = /* @__PURE__ */ createTextVNode(" \u90AE\u7BB1\u5730\u5740 ");
  29391. const _hoisted_63 = /* @__PURE__ */ createTextVNode(" \u4EFB\u610F\u7C7B\u578B ");
  29392. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  29393. const _component_el_input = ElInput;
  29394. const _component_el_form_item = ElFormItem;
  29395. const _component_el_rate = ElRate;
  29396. const _component_el_switch = ElSwitch;
  29397. const _component_el_input_number = ElInputNumber;
  29398. const _component_el_radio_button = ElRadioButton;
  29399. const _component_el_radio_group = ElRadioGroup;
  29400. const _component_el_space = ElSpace;
  29401. const _component_el_radio = ElRadio;
  29402. const _component_el_button = ElButton;
  29403. const _component_Draggable = resolveComponent("Draggable");
  29404. const _component_el_checkbox = ElCheckbox;
  29405. const _component_el_checkbox_group = ElCheckboxGroup$1;
  29406. const _component_el_time_picker = ElTimePicker;
  29407. const _component_el_date_picker = ElDatePicker;
  29408. const _component_el_option = ElOption;
  29409. const _component_el_select = ElSelect;
  29410. const _component_el_form = ElForm;
  29411. return _ctx.data ? (openBlock(), createBlock(_component_el_form, {
  29412. key: _ctx.data.key,
  29413. "label-position": "top",
  29414. "p-2": "",
  29415. "flex-1": "",
  29416. "overflow-auto": ""
  29417. }, {
  29418. default: withCtx(() => [
  29419. !["grid"].includes(_ctx.data.type) ? (openBlock(), createBlock(_component_el_form_item, {
  29420. key: 0,
  29421. label: "\u5B57\u6BB5\u6807\u8BC6"
  29422. }, {
  29423. default: withCtx(() => [
  29424. createVNode(_component_el_input, {
  29425. modelValue: _ctx.data.model,
  29426. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.data.model = $event),
  29427. disabled: true
  29428. }, null, 8, ["modelValue"])
  29429. ]),
  29430. _: 1
  29431. })) : createCommentVNode("", true),
  29432. !["grid", "table"].includes(_ctx.data.type) ? (openBlock(), createBlock(_component_el_form_item, {
  29433. key: 1,
  29434. label: "\u6807\u9898"
  29435. }, {
  29436. default: withCtx(() => [
  29437. createVNode(_component_el_input, {
  29438. modelValue: _ctx.data.label,
  29439. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.data.label = $event),
  29440. disabled: _ctx.data.allDisable
  29441. }, null, 8, ["modelValue", "disabled"])
  29442. ]),
  29443. _: 1
  29444. })) : createCommentVNode("", true),
  29445. _ctx.hasKey("width") ? (openBlock(), createBlock(_component_el_form_item, {
  29446. key: 2,
  29447. label: "\u5BBD\u5EA6"
  29448. }, {
  29449. default: withCtx(() => [
  29450. createVNode(_component_el_input, {
  29451. modelValue: _ctx.data.options.width,
  29452. "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => _ctx.data.options.width = $event)
  29453. }, null, 8, ["modelValue"])
  29454. ]),
  29455. _: 1
  29456. })) : createCommentVNode("", true),
  29457. _ctx.hasKey("placeholder") ? (openBlock(), createBlock(_component_el_form_item, {
  29458. key: 3,
  29459. label: "\u5360\u4F4D\u5185\u5BB9"
  29460. }, {
  29461. default: withCtx(() => [
  29462. createVNode(_component_el_input, {
  29463. modelValue: _ctx.data.options.placeholder,
  29464. "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => _ctx.data.options.placeholder = $event),
  29465. disabled: _ctx.data.allDisable
  29466. }, null, 8, ["modelValue", "disabled"])
  29467. ]),
  29468. _: 1
  29469. })) : createCommentVNode("", true),
  29470. _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, {
  29471. key: 4,
  29472. label: "\u9ED8\u8BA4\u5185\u5BB9"
  29473. }, {
  29474. default: withCtx(() => [
  29475. _ctx.data.type === "input" || _ctx.data.type === "password" || _ctx.data.type === "text" ? (openBlock(), createBlock(_component_el_input, {
  29476. key: 0,
  29477. modelValue: _ctx.data.options.defaultValue,
  29478. "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => _ctx.data.options.defaultValue = $event)
  29479. }, null, 8, ["modelValue"])) : createCommentVNode("", true),
  29480. _ctx.data.type === "textarea" ? (openBlock(), createBlock(_component_el_input, {
  29481. key: 1,
  29482. modelValue: _ctx.data.options.defaultValue,
  29483. "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => _ctx.data.options.defaultValue = $event),
  29484. type: "textarea"
  29485. }, null, 8, ["modelValue"])) : createCommentVNode("", true),
  29486. _ctx.data.type === "rate" ? (openBlock(), createBlock(_component_el_rate, {
  29487. key: 2,
  29488. modelValue: _ctx.data.options.defaultValue,
  29489. "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => _ctx.data.options.defaultValue = $event),
  29490. max: _ctx.data.options.max,
  29491. "allow-half": _ctx.data.options.allowHalf
  29492. }, null, 8, ["modelValue", "max", "allow-half"])) : createCommentVNode("", true),
  29493. _ctx.data.type === "switch" ? (openBlock(), createBlock(_component_el_switch, {
  29494. key: 3,
  29495. modelValue: _ctx.data.options.defaultValue,
  29496. "onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => _ctx.data.options.defaultValue = $event)
  29497. }, null, 8, ["modelValue"])) : createCommentVNode("", true),
  29498. _ctx.data.type === "slider" ? (openBlock(), createElementBlock(Fragment, { key: 4 }, [
  29499. !_ctx.data.options.range ? (openBlock(), createBlock(_component_el_input_number, {
  29500. key: 0,
  29501. modelValue: _ctx.data.options.defaultValue,
  29502. "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => _ctx.data.options.defaultValue = $event),
  29503. modelModifiers: { number: true }
  29504. }, null, 8, ["modelValue"])) : createCommentVNode("", true),
  29505. _ctx.data.options.range ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  29506. createVNode(_component_el_input_number, {
  29507. modelValue: _ctx.data.options.defaultValue[0],
  29508. "onUpdate:modelValue": _cache[9] || (_cache[9] = ($event) => _ctx.data.options.defaultValue[0] = $event),
  29509. modelModifiers: { number: true },
  29510. max: _ctx.data.options.max
  29511. }, null, 8, ["modelValue", "max"]),
  29512. createVNode(_component_el_input_number, {
  29513. modelValue: _ctx.data.options.defaultValue[1],
  29514. "onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => _ctx.data.options.defaultValue[1] = $event),
  29515. modelModifiers: { number: true },
  29516. max: _ctx.data.options.max
  29517. }, null, 8, ["modelValue", "max"])
  29518. ], 64)) : createCommentVNode("", true)
  29519. ], 64)) : createCommentVNode("", true)
  29520. ]),
  29521. _: 1
  29522. })) : createCommentVNode("", true),
  29523. _ctx.hasKey("maxlength") ? (openBlock(), createBlock(_component_el_form_item, {
  29524. key: 5,
  29525. label: "\u6700\u5927\u957F\u5EA6"
  29526. }, {
  29527. default: withCtx(() => [
  29528. createVNode(_component_el_input, {
  29529. modelValue: _ctx.data.options.maxlength,
  29530. "onUpdate:modelValue": _cache[11] || (_cache[11] = ($event) => _ctx.data.options.maxlength = $event),
  29531. modelModifiers: { number: true },
  29532. disabled: _ctx.data.allDisable
  29533. }, null, 8, ["modelValue", "disabled"])
  29534. ]),
  29535. _: 1
  29536. })) : createCommentVNode("", true),
  29537. _ctx.hasKey("max") ? (openBlock(), createBlock(_component_el_form_item, {
  29538. key: 6,
  29539. label: "\u6700\u5927\u503C"
  29540. }, {
  29541. default: withCtx(() => [
  29542. createVNode(_component_el_input_number, {
  29543. modelValue: _ctx.data.options.max,
  29544. "onUpdate:modelValue": _cache[12] || (_cache[12] = ($event) => _ctx.data.options.max = $event),
  29545. modelModifiers: { number: true },
  29546. disabled: _ctx.data.allDisable
  29547. }, null, 8, ["modelValue", "disabled"])
  29548. ]),
  29549. _: 1
  29550. })) : createCommentVNode("", true),
  29551. _ctx.hasKey("min") ? (openBlock(), createBlock(_component_el_form_item, {
  29552. key: 7,
  29553. label: "\u6700\u5C0F\u503C"
  29554. }, {
  29555. default: withCtx(() => [
  29556. createVNode(_component_el_input_number, {
  29557. modelValue: _ctx.data.options.min,
  29558. "onUpdate:modelValue": _cache[13] || (_cache[13] = ($event) => _ctx.data.options.min = $event),
  29559. modelModifiers: { number: true },
  29560. disabled: _ctx.data.allDisable
  29561. }, null, 8, ["modelValue", "disabled"])
  29562. ]),
  29563. _: 1
  29564. })) : createCommentVNode("", true),
  29565. _ctx.hasKey("step") ? (openBlock(), createBlock(_component_el_form_item, {
  29566. key: 8,
  29567. label: "\u6B65\u957F"
  29568. }, {
  29569. default: withCtx(() => [
  29570. createVNode(_component_el_input_number, {
  29571. modelValue: _ctx.data.options.step,
  29572. "onUpdate:modelValue": _cache[14] || (_cache[14] = ($event) => _ctx.data.options.step = $event),
  29573. modelModifiers: { number: true },
  29574. min: 0,
  29575. disabled: _ctx.data.allDisable
  29576. }, null, 8, ["modelValue", "disabled"])
  29577. ]),
  29578. _: 1
  29579. })) : createCommentVNode("", true),
  29580. _ctx.hasKey("prefix") ? (openBlock(), createBlock(_component_el_form_item, {
  29581. key: 9,
  29582. label: "\u524D\u7F00"
  29583. }, {
  29584. default: withCtx(() => [
  29585. createVNode(_component_el_input, {
  29586. modelValue: _ctx.data.options.prefix,
  29587. "onUpdate:modelValue": _cache[15] || (_cache[15] = ($event) => _ctx.data.options.prefix = $event),
  29588. disabled: _ctx.data.allDisable
  29589. }, null, 8, ["modelValue", "disabled"])
  29590. ]),
  29591. _: 1
  29592. })) : createCommentVNode("", true),
  29593. _ctx.hasKey("suffix") ? (openBlock(), createBlock(_component_el_form_item, {
  29594. key: 10,
  29595. label: "\u540E\u7F00"
  29596. }, {
  29597. default: withCtx(() => [
  29598. createVNode(_component_el_input, {
  29599. modelValue: _ctx.data.options.suffix,
  29600. "onUpdate:modelValue": _cache[16] || (_cache[16] = ($event) => _ctx.data.options.suffix = $event),
  29601. disabled: _ctx.data.allDisable
  29602. }, null, 8, ["modelValue", "disabled"])
  29603. ]),
  29604. _: 1
  29605. })) : createCommentVNode("", true),
  29606. _ctx.hasKey("prepend") ? (openBlock(), createBlock(_component_el_form_item, {
  29607. key: 11,
  29608. label: "\u524D\u7F6E\u6807\u7B7E"
  29609. }, {
  29610. default: withCtx(() => [
  29611. createVNode(_component_el_input, {
  29612. modelValue: _ctx.data.options.prepend,
  29613. "onUpdate:modelValue": _cache[17] || (_cache[17] = ($event) => _ctx.data.options.prepend = $event),
  29614. disabled: _ctx.data.allDisable
  29615. }, null, 8, ["modelValue", "disabled"])
  29616. ]),
  29617. _: 1
  29618. })) : createCommentVNode("", true),
  29619. _ctx.hasKey("append") ? (openBlock(), createBlock(_component_el_form_item, {
  29620. key: 12,
  29621. label: "\u540E\u7F6E\u6807\u7B7E"
  29622. }, {
  29623. default: withCtx(() => [
  29624. createVNode(_component_el_input, {
  29625. modelValue: _ctx.data.options.append,
  29626. "onUpdate:modelValue": _cache[18] || (_cache[18] = ($event) => _ctx.data.options.append = $event),
  29627. disabled: _ctx.data.allDisable
  29628. }, null, 8, ["modelValue", "disabled"])
  29629. ]),
  29630. _: 1
  29631. })) : createCommentVNode("", true),
  29632. _ctx.hasKey("activeText") ? (openBlock(), createBlock(_component_el_form_item, {
  29633. key: 13,
  29634. label: "\u9009\u4E2D\u65F6\u7684\u5185\u5BB9"
  29635. }, {
  29636. default: withCtx(() => [
  29637. createVNode(_component_el_input, {
  29638. modelValue: _ctx.data.options.activeText,
  29639. "onUpdate:modelValue": _cache[19] || (_cache[19] = ($event) => _ctx.data.options.activeText = $event)
  29640. }, null, 8, ["modelValue"])
  29641. ]),
  29642. _: 1
  29643. })) : createCommentVNode("", true),
  29644. _ctx.hasKey("inactiveText") ? (openBlock(), createBlock(_component_el_form_item, {
  29645. key: 14,
  29646. label: "\u975E\u9009\u4E2D\u65F6\u7684\u5185\u5BB9"
  29647. }, {
  29648. default: withCtx(() => [
  29649. createVNode(_component_el_input, {
  29650. modelValue: _ctx.data.options.inactiveText,
  29651. "onUpdate:modelValue": _cache[20] || (_cache[20] = ($event) => _ctx.data.options.inactiveText = $event)
  29652. }, null, 8, ["modelValue"])
  29653. ]),
  29654. _: 1
  29655. })) : createCommentVNode("", true),
  29656. _ctx.hasKey("editable") ? (openBlock(), createBlock(_component_el_form_item, {
  29657. key: 15,
  29658. label: "\u6587\u672C\u6846\u53EF\u8F93\u5165"
  29659. }, {
  29660. default: withCtx(() => [
  29661. createVNode(_component_el_switch, {
  29662. modelValue: _ctx.data.options.editable,
  29663. "onUpdate:modelValue": _cache[21] || (_cache[21] = ($event) => _ctx.data.options.editable = $event)
  29664. }, null, 8, ["modelValue"])
  29665. ]),
  29666. _: 1
  29667. })) : createCommentVNode("", true),
  29668. _ctx.hasKey("range") ? (openBlock(), createBlock(_component_el_form_item, {
  29669. key: 16,
  29670. label: "\u8303\u56F4\u9009\u62E9"
  29671. }, {
  29672. default: withCtx(() => [
  29673. createVNode(_component_el_switch, {
  29674. modelValue: _ctx.data.options.range,
  29675. "onUpdate:modelValue": _cache[22] || (_cache[22] = ($event) => _ctx.data.options.range = $event),
  29676. onChange: _ctx.handleSliderModeChange
  29677. }, null, 8, ["modelValue", "onChange"])
  29678. ]),
  29679. _: 1
  29680. })) : createCommentVNode("", true),
  29681. _ctx.hasKey("showPassword") ? (openBlock(), createBlock(_component_el_form_item, {
  29682. key: 17,
  29683. label: "\u662F\u5426\u663E\u793A\u5207\u6362\u6309\u94AE"
  29684. }, {
  29685. default: withCtx(() => [
  29686. createVNode(_component_el_switch, {
  29687. modelValue: _ctx.data.options.showPassword,
  29688. "onUpdate:modelValue": _cache[23] || (_cache[23] = ($event) => _ctx.data.options.showPassword = $event)
  29689. }, null, 8, ["modelValue"])
  29690. ]),
  29691. _: 1
  29692. })) : createCommentVNode("", true),
  29693. _ctx.hasKey("showWordLimit") ? (openBlock(), createBlock(_component_el_form_item, {
  29694. key: 18,
  29695. label: "\u662F\u5426\u663E\u793A\u5B57\u6570"
  29696. }, {
  29697. default: withCtx(() => [
  29698. createVNode(_component_el_switch, {
  29699. modelValue: _ctx.data.options.showWordLimit,
  29700. "onUpdate:modelValue": _cache[24] || (_cache[24] = ($event) => _ctx.data.options.showWordLimit = $event)
  29701. }, null, 8, ["modelValue"])
  29702. ]),
  29703. _: 1
  29704. })) : createCommentVNode("", true),
  29705. _ctx.hasKey("autosize") ? (openBlock(), createBlock(_component_el_form_item, {
  29706. key: 19,
  29707. label: "\u662F\u5426\u81EA\u9002\u5E94\u5185\u5BB9\u9AD8\u5EA6"
  29708. }, {
  29709. default: withCtx(() => [
  29710. createVNode(_component_el_switch, {
  29711. modelValue: _ctx.data.options.autosize,
  29712. "onUpdate:modelValue": _cache[25] || (_cache[25] = ($event) => _ctx.data.options.autosize = $event)
  29713. }, null, 8, ["modelValue"])
  29714. ]),
  29715. _: 1
  29716. })) : createCommentVNode("", true),
  29717. _ctx.hasKey("rows") && !_ctx.data.options.autosize ? (openBlock(), createBlock(_component_el_form_item, {
  29718. key: 20,
  29719. label: "\u884C\u6570"
  29720. }, {
  29721. default: withCtx(() => [
  29722. createVNode(_component_el_input_number, {
  29723. modelValue: _ctx.data.options.rows,
  29724. "onUpdate:modelValue": _cache[26] || (_cache[26] = ($event) => _ctx.data.options.rows = $event),
  29725. min: 0
  29726. }, null, 8, ["modelValue"])
  29727. ]),
  29728. _: 1
  29729. })) : createCommentVNode("", true),
  29730. _ctx.hasKey("allowHalf") ? (openBlock(), createBlock(_component_el_form_item, {
  29731. key: 21,
  29732. label: "\u662F\u5426\u5141\u8BB8\u534A\u9009"
  29733. }, {
  29734. default: withCtx(() => [
  29735. createVNode(_component_el_switch, {
  29736. modelValue: _ctx.data.options.allowHalf,
  29737. "onUpdate:modelValue": _cache[27] || (_cache[27] = ($event) => _ctx.data.options.allowHalf = $event)
  29738. }, null, 8, ["modelValue"])
  29739. ]),
  29740. _: 1
  29741. })) : createCommentVNode("", true),
  29742. _ctx.hasKey("inline") ? (openBlock(), createBlock(_component_el_form_item, {
  29743. key: 22,
  29744. label: "\u5E03\u5C40\u65B9\u5F0F"
  29745. }, {
  29746. default: withCtx(() => [
  29747. createVNode(_component_el_radio_group, {
  29748. modelValue: _ctx.data.options.inline,
  29749. "onUpdate:modelValue": _cache[28] || (_cache[28] = ($event) => _ctx.data.options.inline = $event)
  29750. }, {
  29751. default: withCtx(() => [
  29752. createVNode(_component_el_radio_button, { label: true }, {
  29753. default: withCtx(() => [
  29754. _hoisted_1$2
  29755. ]),
  29756. _: 1
  29757. }),
  29758. createVNode(_component_el_radio_button, { label: false }, {
  29759. default: withCtx(() => [
  29760. _hoisted_2$2
  29761. ]),
  29762. _: 1
  29763. })
  29764. ]),
  29765. _: 1
  29766. }, 8, ["modelValue"])
  29767. ]),
  29768. _: 1
  29769. })) : createCommentVNode("", true),
  29770. _ctx.hasKey("multiple") ? (openBlock(), createBlock(_component_el_form_item, {
  29771. key: 23,
  29772. label: "\u662F\u5426\u591A\u9009"
  29773. }, {
  29774. default: withCtx(() => [
  29775. createVNode(_component_el_switch, {
  29776. modelValue: _ctx.data.options.multiple,
  29777. "onUpdate:modelValue": _cache[29] || (_cache[29] = ($event) => _ctx.data.options.multiple = $event),
  29778. onChange: _ctx.handleSelectModeChange,
  29779. disabled: _ctx.data.allDisable
  29780. }, null, 8, ["modelValue", "onChange", "disabled"])
  29781. ]),
  29782. _: 1
  29783. })) : createCommentVNode("", true),
  29784. _ctx.hasKey("filterable") ? (openBlock(), createBlock(_component_el_form_item, {
  29785. key: 24,
  29786. label: "\u662F\u5426\u53EF\u641C\u7D22"
  29787. }, {
  29788. default: withCtx(() => [
  29789. createVNode(_component_el_switch, {
  29790. modelValue: _ctx.data.options.filterable,
  29791. "onUpdate:modelValue": _cache[30] || (_cache[30] = ($event) => _ctx.data.options.filterable = $event),
  29792. disabled: _ctx.data.allDisable
  29793. }, null, 8, ["modelValue", "disabled"])
  29794. ]),
  29795. _: 1
  29796. })) : createCommentVNode("", true),
  29797. _ctx.hasKey("showLabel") ? (openBlock(), createBlock(_component_el_form_item, {
  29798. key: 25,
  29799. label: "\u662F\u5426\u663E\u793A\u6807\u7B7E"
  29800. }, {
  29801. default: withCtx(() => [
  29802. createVNode(_component_el_switch, {
  29803. modelValue: _ctx.data.options.showLabel,
  29804. "onUpdate:modelValue": _cache[31] || (_cache[31] = ($event) => _ctx.data.options.showLabel = $event)
  29805. }, null, 8, ["modelValue"])
  29806. ]),
  29807. _: 1
  29808. })) : createCommentVNode("", true),
  29809. _ctx.hasKey("options") ? (openBlock(), createBlock(_component_el_form_item, {
  29810. key: 26,
  29811. label: "\u9009\u9879"
  29812. }, {
  29813. default: withCtx(() => [
  29814. createVNode(_component_el_radio_group, {
  29815. modelValue: _ctx.data.options.remote,
  29816. "onUpdate:modelValue": _cache[32] || (_cache[32] = ($event) => _ctx.data.options.remote = $event)
  29817. }, {
  29818. default: withCtx(() => [
  29819. createVNode(_component_el_radio_button, { label: false }, {
  29820. default: withCtx(() => [
  29821. _hoisted_3$2
  29822. ]),
  29823. _: 1
  29824. }),
  29825. createVNode(_component_el_radio_button, { label: true }, {
  29826. default: withCtx(() => [
  29827. _hoisted_4$2
  29828. ]),
  29829. _: 1
  29830. })
  29831. ]),
  29832. _: 1
  29833. }, 8, ["modelValue"]),
  29834. _ctx.data.options.remote ? (openBlock(), createBlock(_component_el_space, {
  29835. key: 0,
  29836. alignment: "start",
  29837. direction: "vertical",
  29838. style: { "margin-top": "10px" }
  29839. }, {
  29840. default: withCtx(() => [
  29841. createVNode(_component_el_input, {
  29842. modelValue: _ctx.data.options.remoteFunc,
  29843. "onUpdate:modelValue": _cache[33] || (_cache[33] = ($event) => _ctx.data.options.remoteFunc = $event)
  29844. }, {
  29845. prepend: withCtx(() => [
  29846. _hoisted_5$2
  29847. ]),
  29848. _: 1
  29849. }, 8, ["modelValue"]),
  29850. createVNode(_component_el_input, {
  29851. modelValue: _ctx.data.options.props.label,
  29852. "onUpdate:modelValue": _cache[34] || (_cache[34] = ($event) => _ctx.data.options.props.label = $event)
  29853. }, {
  29854. prepend: withCtx(() => [
  29855. _hoisted_6$2
  29856. ]),
  29857. _: 1
  29858. }, 8, ["modelValue"]),
  29859. createVNode(_component_el_input, {
  29860. modelValue: _ctx.data.options.props.value,
  29861. "onUpdate:modelValue": _cache[35] || (_cache[35] = ($event) => _ctx.data.options.props.value = $event)
  29862. }, {
  29863. prepend: withCtx(() => [
  29864. _hoisted_7$1
  29865. ]),
  29866. _: 1
  29867. }, 8, ["modelValue"])
  29868. ]),
  29869. _: 1
  29870. })) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  29871. _ctx.data.type === "radio" || _ctx.data.type === "select" && !_ctx.data.options.multiple ? (openBlock(), createBlock(_component_el_radio_group, {
  29872. key: 0,
  29873. modelValue: _ctx.data.options.defaultValue,
  29874. "onUpdate:modelValue": _cache[36] || (_cache[36] = ($event) => _ctx.data.options.defaultValue = $event),
  29875. style: { "margin-top": "8px" }
  29876. }, {
  29877. default: withCtx(() => [
  29878. createVNode(_component_Draggable, {
  29879. "item-key": "index",
  29880. "ghost-class": "ghost",
  29881. handle: ".drag-item",
  29882. group: { name: "options" },
  29883. list: _ctx.data.options.options
  29884. }, {
  29885. item: withCtx(({ element, index }) => [
  29886. createElementVNode("div", _hoisted_8$1, [
  29887. createVNode(_component_el_radio, {
  29888. label: element.value,
  29889. style: { "margin-right": "0", "margin-bottom": "0" }
  29890. }, {
  29891. default: withCtx(() => [
  29892. createVNode(_component_el_input, {
  29893. modelValue: element.value,
  29894. "onUpdate:modelValue": ($event) => element.value = $event,
  29895. style: normalizeStyle({
  29896. width: _ctx.data.options.showLabel ? "90px" : "180px"
  29897. })
  29898. }, null, 8, ["modelValue", "onUpdate:modelValue", "style"]),
  29899. _ctx.data.options.showLabel ? (openBlock(), createBlock(_component_el_input, {
  29900. key: 0,
  29901. modelValue: element.label,
  29902. "onUpdate:modelValue": ($event) => element.label = $event,
  29903. class: "ml-1",
  29904. style: {
  29905. width: "90px"
  29906. }
  29907. }, null, 8, ["modelValue", "onUpdate:modelValue"])) : createCommentVNode("", true)
  29908. ]),
  29909. _: 2
  29910. }, 1032, ["label"]),
  29911. _hoisted_9$1,
  29912. createVNode(_component_el_button, {
  29913. type: "primary",
  29914. circle: "",
  29915. onClick: ($event) => _ctx.handleOptionsRemove(index)
  29916. }, {
  29917. default: withCtx(() => [
  29918. _hoisted_10$1
  29919. ]),
  29920. _: 2
  29921. }, 1032, ["onClick"])
  29922. ])
  29923. ]),
  29924. _: 1
  29925. }, 8, ["list"])
  29926. ]),
  29927. _: 1
  29928. }, 8, ["modelValue"])) : createCommentVNode("", true),
  29929. _ctx.data.type === "checkbox" || _ctx.data.type === "select" && _ctx.data.options.multiple ? (openBlock(), createBlock(_component_el_checkbox_group, {
  29930. key: 1,
  29931. modelValue: _ctx.data.options.defaultValue,
  29932. "onUpdate:modelValue": _cache[37] || (_cache[37] = ($event) => _ctx.data.options.defaultValue = $event),
  29933. style: { "margin-top": "8px" }
  29934. }, {
  29935. default: withCtx(() => [
  29936. createVNode(_component_Draggable, {
  29937. "item-key": "index",
  29938. "ghost-class": "ghost",
  29939. handle: "[cursor-move]",
  29940. group: { name: "options" },
  29941. list: _ctx.data.options.options
  29942. }, {
  29943. item: withCtx(({ element, index }) => [
  29944. createElementVNode("div", _hoisted_11$1, [
  29945. createVNode(_component_el_checkbox, {
  29946. label: element.value
  29947. }, {
  29948. default: withCtx(() => [
  29949. _hoisted_12$1
  29950. ]),
  29951. _: 2
  29952. }, 1032, ["label"]),
  29953. createVNode(_component_el_input, {
  29954. modelValue: element.value,
  29955. "onUpdate:modelValue": ($event) => element.value = $event,
  29956. style: normalizeStyle({
  29957. width: _ctx.data.options.showLabel ? "90px" : "180px"
  29958. })
  29959. }, null, 8, ["modelValue", "onUpdate:modelValue", "style"]),
  29960. _ctx.data.options.showLabel ? (openBlock(), createBlock(_component_el_input, {
  29961. key: 0,
  29962. modelValue: element.label,
  29963. "onUpdate:modelValue": ($event) => element.label = $event,
  29964. style: { width: "90px" }
  29965. }, null, 8, ["modelValue", "onUpdate:modelValue"])) : createCommentVNode("", true),
  29966. _hoisted_13$1,
  29967. createVNode(_component_el_button, {
  29968. type: "primary",
  29969. circle: "",
  29970. onClick: ($event) => _ctx.handleOptionsRemove(index)
  29971. }, {
  29972. default: withCtx(() => [
  29973. _hoisted_14$1
  29974. ]),
  29975. _: 2
  29976. }, 1032, ["onClick"])
  29977. ])
  29978. ]),
  29979. _: 1
  29980. }, 8, ["list"])
  29981. ]),
  29982. _: 1
  29983. }, 8, ["modelValue"])) : createCommentVNode("", true),
  29984. createElementVNode("div", _hoisted_15, [
  29985. createVNode(_component_el_button, {
  29986. type: "text",
  29987. onClick: _ctx.handleInsertOption
  29988. }, {
  29989. default: withCtx(() => [
  29990. _hoisted_16
  29991. ]),
  29992. _: 1
  29993. }, 8, ["onClick"])
  29994. ])
  29995. ], 64))
  29996. ]),
  29997. _: 1
  29998. })) : createCommentVNode("", true),
  29999. _ctx.data.type === "time" ? (openBlock(), createBlock(_component_el_form_item, {
  30000. key: 27,
  30001. label: "\u9ED8\u8BA4\u503C"
  30002. }, {
  30003. default: withCtx(() => [
  30004. createVNode(_component_el_time_picker, {
  30005. modelValue: _ctx.data.options.defaultValue,
  30006. "onUpdate:modelValue": _cache[38] || (_cache[38] = ($event) => _ctx.data.options.defaultValue = $event),
  30007. style: { "width": "100%" },
  30008. format: _ctx.data.options.format,
  30009. placeholder: _ctx.data.options.placeholder
  30010. }, null, 8, ["modelValue", "format", "placeholder"])
  30011. ]),
  30012. _: 1
  30013. })) : createCommentVNode("", true),
  30014. _ctx.data.type === "date" ? (openBlock(), createBlock(_component_el_form_item, {
  30015. key: 28,
  30016. label: "\u9ED8\u8BA4\u503C"
  30017. }, {
  30018. default: withCtx(() => [
  30019. createVNode(_component_el_date_picker, {
  30020. modelValue: _ctx.data.options.defaultValue,
  30021. "onUpdate:modelValue": _cache[39] || (_cache[39] = ($event) => _ctx.data.options.defaultValue = $event),
  30022. style: { "width": "100%" },
  30023. format: _ctx.data.options.format,
  30024. placeholder: _ctx.data.options.placeholder
  30025. }, null, 8, ["modelValue", "format", "placeholder"])
  30026. ]),
  30027. _: 1
  30028. })) : createCommentVNode("", true),
  30029. _ctx.data.type === "time" || _ctx.data.type === "date" ? (openBlock(), createBlock(_component_el_form_item, {
  30030. key: 29,
  30031. label: "\u683C\u5F0F"
  30032. }, {
  30033. default: withCtx(() => [
  30034. createVNode(_component_el_input, {
  30035. modelValue: _ctx.data.options.format,
  30036. "onUpdate:modelValue": _cache[40] || (_cache[40] = ($event) => _ctx.data.options.format = $event)
  30037. }, null, 8, ["modelValue"])
  30038. ]),
  30039. _: 1
  30040. })) : createCommentVNode("", true),
  30041. _ctx.data.type === "download" ? (openBlock(), createBlock(_component_el_form_item, {
  30042. key: 30,
  30043. label: "\u5730\u5740"
  30044. }, {
  30045. default: withCtx(() => [
  30046. createVNode(_component_el_input, {
  30047. modelValue: _ctx.data.options.defaultValue,
  30048. "onUpdate:modelValue": _cache[41] || (_cache[41] = ($event) => _ctx.data.options.defaultValue = $event)
  30049. }, null, 8, ["modelValue"])
  30050. ]),
  30051. _: 1
  30052. })) : createCommentVNode("", true),
  30053. _ctx.data.type === "img-upload" ? (openBlock(), createElementBlock(Fragment, { key: 31 }, [
  30054. createVNode(_component_el_form_item, { label: "\u6A21\u5F0F" }, {
  30055. default: withCtx(() => [
  30056. createVNode(_component_el_radio_group, {
  30057. modelValue: _ctx.data.options.listType,
  30058. "onUpdate:modelValue": _cache[42] || (_cache[42] = ($event) => _ctx.data.options.listType = $event)
  30059. }, {
  30060. default: withCtx(() => [
  30061. createVNode(_component_el_radio_button, { label: "text" }, {
  30062. default: withCtx(() => [
  30063. _hoisted_17
  30064. ]),
  30065. _: 1
  30066. }),
  30067. createVNode(_component_el_radio_button, { label: "picture" }, {
  30068. default: withCtx(() => [
  30069. _hoisted_18
  30070. ]),
  30071. _: 1
  30072. }),
  30073. createVNode(_component_el_radio_button, { label: "picture-card" }, {
  30074. default: withCtx(() => [
  30075. _hoisted_19
  30076. ]),
  30077. _: 1
  30078. })
  30079. ]),
  30080. _: 1
  30081. }, 8, ["modelValue"])
  30082. ]),
  30083. _: 1
  30084. }),
  30085. createVNode(_component_el_form_item, { label: "\u6587\u4EF6\u53C2\u6570\u540D" }, {
  30086. default: withCtx(() => [
  30087. createVNode(_component_el_input, {
  30088. modelValue: _ctx.data.options.name,
  30089. "onUpdate:modelValue": _cache[43] || (_cache[43] = ($event) => _ctx.data.options.name = $event)
  30090. }, null, 8, ["modelValue"])
  30091. ]),
  30092. _: 1
  30093. }),
  30094. createVNode(_component_el_form_item, { label: "\u4E0A\u4F20\u5730\u5740" }, {
  30095. default: withCtx(() => [
  30096. createVNode(_component_el_input, {
  30097. modelValue: _ctx.data.options.action,
  30098. "onUpdate:modelValue": _cache[44] || (_cache[44] = ($event) => _ctx.data.options.action = $event)
  30099. }, null, 8, ["modelValue"])
  30100. ]),
  30101. _: 1
  30102. }),
  30103. createVNode(_component_el_form_item, { label: "\u63A5\u53D7\u4E0A\u4F20\u7684\u6587\u4EF6\u7C7B\u578B(\u591A\u4E2A\u4F7F\u7528 , \u9694\u5F00)" }, {
  30104. default: withCtx(() => [
  30105. createVNode(_component_el_input, {
  30106. modelValue: _ctx.data.options.accept,
  30107. "onUpdate:modelValue": _cache[45] || (_cache[45] = ($event) => _ctx.data.options.accept = $event)
  30108. }, null, 8, ["modelValue"])
  30109. ]),
  30110. _: 1
  30111. }),
  30112. createVNode(_component_el_form_item, { label: "\u6700\u5927\u4E0A\u4F20\u6570\u91CF" }, {
  30113. default: withCtx(() => [
  30114. createVNode(_component_el_input_number, {
  30115. modelValue: _ctx.data.options.limit,
  30116. "onUpdate:modelValue": _cache[46] || (_cache[46] = ($event) => _ctx.data.options.limit = $event),
  30117. modelModifiers: { number: true },
  30118. min: 1
  30119. }, null, 8, ["modelValue"])
  30120. ]),
  30121. _: 1
  30122. }),
  30123. createVNode(_component_el_form_item, { label: "\u4E0A\u4F20\u8BF7\u6C42\u65B9\u6CD5" }, {
  30124. default: withCtx(() => [
  30125. createVNode(_component_el_radio_group, {
  30126. modelValue: _ctx.data.options.method,
  30127. "onUpdate:modelValue": _cache[47] || (_cache[47] = ($event) => _ctx.data.options.method = $event)
  30128. }, {
  30129. default: withCtx(() => [
  30130. createVNode(_component_el_radio_button, { label: "post" }, {
  30131. default: withCtx(() => [
  30132. _hoisted_20
  30133. ]),
  30134. _: 1
  30135. }),
  30136. createVNode(_component_el_radio_button, { label: "put" }, {
  30137. default: withCtx(() => [
  30138. _hoisted_21
  30139. ]),
  30140. _: 1
  30141. }),
  30142. createVNode(_component_el_radio_button, { label: "get" }, {
  30143. default: withCtx(() => [
  30144. _hoisted_22
  30145. ]),
  30146. _: 1
  30147. }),
  30148. createVNode(_component_el_radio_button, { label: "delete" }, {
  30149. default: withCtx(() => [
  30150. _hoisted_23
  30151. ]),
  30152. _: 1
  30153. })
  30154. ]),
  30155. _: 1
  30156. }, 8, ["modelValue"])
  30157. ]),
  30158. _: 1
  30159. })
  30160. ], 64)) : createCommentVNode("", true),
  30161. _ctx.data.type === "cascader" ? (openBlock(), createBlock(_component_el_form_item, {
  30162. key: 32,
  30163. label: "\u8FDC\u7AEF\u6570\u636E"
  30164. }, {
  30165. default: withCtx(() => [
  30166. createVNode(_component_el_space, {
  30167. direction: "vertical",
  30168. alignment: "start"
  30169. }, {
  30170. default: withCtx(() => [
  30171. createVNode(_component_el_input, {
  30172. modelValue: _ctx.data.options.remoteFunc,
  30173. "onUpdate:modelValue": _cache[48] || (_cache[48] = ($event) => _ctx.data.options.remoteFunc = $event)
  30174. }, {
  30175. prepend: withCtx(() => [
  30176. _hoisted_24
  30177. ]),
  30178. _: 1
  30179. }, 8, ["modelValue"]),
  30180. createVNode(_component_el_input, {
  30181. modelValue: _ctx.data.options.props.label,
  30182. "onUpdate:modelValue": _cache[49] || (_cache[49] = ($event) => _ctx.data.options.props.label = $event)
  30183. }, {
  30184. prepend: withCtx(() => [
  30185. _hoisted_25
  30186. ]),
  30187. _: 1
  30188. }, 8, ["modelValue"]),
  30189. createVNode(_component_el_input, {
  30190. modelValue: _ctx.data.options.props.value,
  30191. "onUpdate:modelValue": _cache[50] || (_cache[50] = ($event) => _ctx.data.options.props.value = $event)
  30192. }, {
  30193. prepend: withCtx(() => [
  30194. _hoisted_26
  30195. ]),
  30196. _: 1
  30197. }, 8, ["modelValue"]),
  30198. createVNode(_component_el_input, {
  30199. modelValue: _ctx.data.options.props.children,
  30200. "onUpdate:modelValue": _cache[51] || (_cache[51] = ($event) => _ctx.data.options.props.children = $event)
  30201. }, {
  30202. prepend: withCtx(() => [
  30203. _hoisted_27
  30204. ]),
  30205. _: 1
  30206. }, 8, ["modelValue"])
  30207. ]),
  30208. _: 1
  30209. })
  30210. ]),
  30211. _: 1
  30212. })) : createCommentVNode("", true),
  30213. _ctx.data.type === "table" ? (openBlock(), createElementBlock(Fragment, { key: 33 }, [
  30214. createVNode(_component_el_form_item, { label: "\u5217\u914D\u7F6E\u9879" }, {
  30215. default: withCtx(() => [
  30216. createVNode(_component_Draggable, {
  30217. tag: "ul",
  30218. "item-key": "index",
  30219. "ghost-class": "ghost",
  30220. handle: ".drag-item",
  30221. group: { name: "options" },
  30222. list: _ctx.data.columns
  30223. }, {
  30224. item: withCtx(({ element, index }) => [
  30225. createElementVNode("li", _hoisted_28, [
  30226. _hoisted_29,
  30227. createVNode(_component_el_input, {
  30228. modelValue: element.label,
  30229. "onUpdate:modelValue": ($event) => element.label = $event,
  30230. placeholder: "\u663E\u793A\u540D\u79F0"
  30231. }, null, 8, ["modelValue", "onUpdate:modelValue"]),
  30232. createVNode(_component_el_input, {
  30233. modelValue: element.prop,
  30234. "onUpdate:modelValue": ($event) => element.prop = $event,
  30235. placeholder: "\u5B57\u6BB5\u5B57\u6BB5"
  30236. }, null, 8, ["modelValue", "onUpdate:modelValue"]),
  30237. createVNode(_component_el_button, {
  30238. type: "primary",
  30239. circle: "",
  30240. style: { "margin-left": "5px" },
  30241. onClick: ($event) => _ctx.data.columns.splice(index, 1)
  30242. }, {
  30243. default: withCtx(() => [
  30244. _hoisted_30
  30245. ]),
  30246. _: 2
  30247. }, 1032, ["onClick"])
  30248. ])
  30249. ]),
  30250. _: 1
  30251. }, 8, ["list"]),
  30252. createElementVNode("div", null, [
  30253. createVNode(_component_el_button, {
  30254. type: "text",
  30255. onClick: _cache[52] || (_cache[52] = ($event) => _ctx.data.columns.push({}))
  30256. }, {
  30257. default: withCtx(() => [
  30258. _hoisted_31
  30259. ]),
  30260. _: 1
  30261. })
  30262. ])
  30263. ]),
  30264. _: 1
  30265. }),
  30266. createVNode(_component_el_form_item, { label: "\u5BF9\u9F50\u65B9\u5F0F" }, {
  30267. default: withCtx(() => [
  30268. createVNode(_component_el_radio_group, {
  30269. modelValue: _ctx.data.options.align,
  30270. "onUpdate:modelValue": _cache[53] || (_cache[53] = ($event) => _ctx.data.options.align = $event)
  30271. }, {
  30272. default: withCtx(() => [
  30273. createVNode(_component_el_radio_button, { label: "left" }, {
  30274. default: withCtx(() => [
  30275. _hoisted_32
  30276. ]),
  30277. _: 1
  30278. }),
  30279. createVNode(_component_el_radio_button, { label: "center" }, {
  30280. default: withCtx(() => [
  30281. _hoisted_33
  30282. ]),
  30283. _: 1
  30284. }),
  30285. createVNode(_component_el_radio_button, { label: "right" }, {
  30286. default: withCtx(() => [
  30287. _hoisted_34
  30288. ]),
  30289. _: 1
  30290. })
  30291. ]),
  30292. _: 1
  30293. }, 8, ["modelValue"])
  30294. ]),
  30295. _: 1
  30296. })
  30297. ], 64)) : createCommentVNode("", true),
  30298. _ctx.data.type === "grid" ? (openBlock(), createElementBlock(Fragment, { key: 34 }, [
  30299. createVNode(_component_el_form_item, { label: "\u6805\u683C\u95F4\u9694" }, {
  30300. default: withCtx(() => [
  30301. createVNode(_component_el_input_number, {
  30302. modelValue: _ctx.data.options.gutter,
  30303. "onUpdate:modelValue": _cache[54] || (_cache[54] = ($event) => _ctx.data.options.gutter = $event),
  30304. modelModifiers: { number: true },
  30305. min: 0
  30306. }, null, 8, ["modelValue"])
  30307. ]),
  30308. _: 1
  30309. }),
  30310. createVNode(_component_el_form_item, { label: "\u5217\u914D\u7F6E\u9879" }, {
  30311. default: withCtx(() => [
  30312. createVNode(_component_Draggable, {
  30313. tag: "ul",
  30314. "item-key": "index",
  30315. "ghost-class": "ghost",
  30316. handle: ".drag-item",
  30317. group: { name: "options" },
  30318. list: _ctx.data.columns
  30319. }, {
  30320. item: withCtx(({ element, index }) => [
  30321. createElementVNode("li", _hoisted_35, [
  30322. _hoisted_36,
  30323. createVNode(_component_el_input_number, {
  30324. modelValue: element.span,
  30325. "onUpdate:modelValue": ($event) => element.span = $event,
  30326. modelModifiers: { number: true },
  30327. placeholder: "\u6805\u683C\u503C",
  30328. min: 0,
  30329. max: 24
  30330. }, null, 8, ["modelValue", "onUpdate:modelValue"]),
  30331. createVNode(_component_el_button, {
  30332. type: "primary",
  30333. circle: "",
  30334. style: { "margin-left": "5px" },
  30335. onClick: ($event) => _ctx.handleOptionsRemove(index)
  30336. }, {
  30337. default: withCtx(() => [
  30338. _hoisted_37
  30339. ]),
  30340. _: 2
  30341. }, 1032, ["onClick"])
  30342. ])
  30343. ]),
  30344. _: 1
  30345. }, 8, ["list"]),
  30346. createElementVNode("div", null, [
  30347. createVNode(_component_el_button, {
  30348. type: "text",
  30349. onClick: _ctx.handleInsertColumn
  30350. }, {
  30351. default: withCtx(() => [
  30352. _hoisted_38
  30353. ]),
  30354. _: 1
  30355. }, 8, ["onClick"])
  30356. ])
  30357. ]),
  30358. _: 1
  30359. }),
  30360. createVNode(_component_el_form_item, { label: "\u5782\u76F4\u5BF9\u9F50\u65B9\u5F0F" }, {
  30361. default: withCtx(() => [
  30362. createVNode(_component_el_radio_group, {
  30363. modelValue: _ctx.data.options.align,
  30364. "onUpdate:modelValue": _cache[55] || (_cache[55] = ($event) => _ctx.data.options.align = $event)
  30365. }, {
  30366. default: withCtx(() => [
  30367. createVNode(_component_el_radio_button, { label: "initial" }, {
  30368. default: withCtx(() => [
  30369. _hoisted_39
  30370. ]),
  30371. _: 1
  30372. }),
  30373. createVNode(_component_el_radio_button, { label: "center" }, {
  30374. default: withCtx(() => [
  30375. _hoisted_40
  30376. ]),
  30377. _: 1
  30378. }),
  30379. createVNode(_component_el_radio_button, { label: "flex-end" }, {
  30380. default: withCtx(() => [
  30381. _hoisted_41
  30382. ]),
  30383. _: 1
  30384. })
  30385. ]),
  30386. _: 1
  30387. }, 8, ["modelValue"])
  30388. ]),
  30389. _: 1
  30390. })
  30391. ], 64)) : createCommentVNode("", true),
  30392. _ctx.data.type !== "grid" ? (openBlock(), createElementBlock(Fragment, { key: 35 }, [
  30393. _ctx.hasKey("rules") || _ctx.hasKey("readonly") || _ctx.hasKey("disabled") || _ctx.hasKey("allowClear") ? (openBlock(), createBlock(_component_el_form_item, {
  30394. key: 0,
  30395. label: "\u64CD\u4F5C\u5C5E\u6027"
  30396. }, {
  30397. default: withCtx(() => [
  30398. _ctx.hasKey("rules") ? (openBlock(), createBlock(_component_el_checkbox, {
  30399. key: 0,
  30400. modelValue: _ctx.data.options.rules.required,
  30401. "onUpdate:modelValue": _cache[56] || (_cache[56] = ($event) => _ctx.data.options.rules.required = $event),
  30402. disabled: _ctx.data.allDisable
  30403. }, {
  30404. default: withCtx(() => [
  30405. _hoisted_42
  30406. ]),
  30407. _: 1
  30408. }, 8, ["modelValue", "disabled"])) : createCommentVNode("", true),
  30409. _ctx.hasKey("readonly") ? (openBlock(), createBlock(_component_el_checkbox, {
  30410. key: 1,
  30411. modelValue: _ctx.data.options.readonly,
  30412. "onUpdate:modelValue": _cache[57] || (_cache[57] = ($event) => _ctx.data.options.readonly = $event),
  30413. disabled: _ctx.data.allDisable
  30414. }, {
  30415. default: withCtx(() => [
  30416. _hoisted_43
  30417. ]),
  30418. _: 1
  30419. }, 8, ["modelValue", "disabled"])) : createCommentVNode("", true),
  30420. _ctx.hasKey("disabled") ? (openBlock(), createBlock(_component_el_checkbox, {
  30421. key: 2,
  30422. modelValue: _ctx.data.options.disabled,
  30423. "onUpdate:modelValue": _cache[58] || (_cache[58] = ($event) => _ctx.data.options.disabled = $event),
  30424. disabled: _ctx.data.allDisable
  30425. }, {
  30426. default: withCtx(() => [
  30427. _hoisted_44
  30428. ]),
  30429. _: 1
  30430. }, 8, ["modelValue", "disabled"])) : createCommentVNode("", true),
  30431. _ctx.hasKey("clearable") ? (openBlock(), createBlock(_component_el_checkbox, {
  30432. key: 3,
  30433. modelValue: _ctx.data.options.clearable,
  30434. "onUpdate:modelValue": _cache[59] || (_cache[59] = ($event) => _ctx.data.options.clearable = $event),
  30435. disabled: _ctx.data.allDisable
  30436. }, {
  30437. default: withCtx(() => [
  30438. _hoisted_45
  30439. ]),
  30440. _: 1
  30441. }, 8, ["modelValue", "disabled"])) : createCommentVNode("", true)
  30442. ]),
  30443. _: 1
  30444. })) : createCommentVNode("", true),
  30445. _ctx.hasKey("rules") ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  30446. _hoisted_46,
  30447. createVNode(_component_el_form_item, { label: "\u89E6\u53D1\u65F6\u673A" }, {
  30448. default: withCtx(() => [
  30449. createVNode(_component_el_radio_group, {
  30450. modelValue: _ctx.data.options.rules.trigger,
  30451. "onUpdate:modelValue": _cache[60] || (_cache[60] = ($event) => _ctx.data.options.rules.trigger = $event)
  30452. }, {
  30453. default: withCtx(() => [
  30454. createVNode(_component_el_radio_button, { label: "blur" }, {
  30455. default: withCtx(() => [
  30456. _hoisted_47
  30457. ]),
  30458. _: 1
  30459. }),
  30460. createVNode(_component_el_radio_button, { label: "change" }, {
  30461. default: withCtx(() => [
  30462. _hoisted_48
  30463. ]),
  30464. _: 1
  30465. })
  30466. ]),
  30467. _: 1
  30468. }, 8, ["modelValue"])
  30469. ]),
  30470. _: 1
  30471. }),
  30472. createVNode(_component_el_form_item, { label: "\u679A\u4E3E\u7C7B\u578B" }, {
  30473. default: withCtx(() => [
  30474. createVNode(_component_el_input, {
  30475. value: _ctx.data.options.rules.enum,
  30476. "onUpdate:value": _cache[61] || (_cache[61] = ($event) => _ctx.data.options.rules.enum = $event)
  30477. }, null, 8, ["value"])
  30478. ]),
  30479. _: 1
  30480. }),
  30481. createVNode(_component_el_form_item, { label: "\u5B57\u6BB5\u957F\u5EA6" }, {
  30482. default: withCtx(() => [
  30483. createVNode(_component_el_input, {
  30484. modelValue: _ctx.data.options.rules.len,
  30485. "onUpdate:modelValue": _cache[62] || (_cache[62] = ($event) => _ctx.data.options.rules.len = $event),
  30486. modelModifiers: { number: true }
  30487. }, null, 8, ["modelValue"])
  30488. ]),
  30489. _: 1
  30490. }),
  30491. createVNode(_component_el_form_item, { label: "\u6700\u5927\u957F\u5EA6" }, {
  30492. default: withCtx(() => [
  30493. createVNode(_component_el_input, {
  30494. modelValue: _ctx.data.options.rules.max,
  30495. "onUpdate:modelValue": _cache[63] || (_cache[63] = ($event) => _ctx.data.options.rules.max = $event),
  30496. modelModifiers: { number: true }
  30497. }, null, 8, ["modelValue"])
  30498. ]),
  30499. _: 1
  30500. }),
  30501. createVNode(_component_el_form_item, { label: "\u6700\u5C0F\u957F\u5EA6" }, {
  30502. default: withCtx(() => [
  30503. createVNode(_component_el_input, {
  30504. modelValue: _ctx.data.options.rules.min,
  30505. "onUpdate:modelValue": _cache[64] || (_cache[64] = ($event) => _ctx.data.options.rules.min = $event),
  30506. modelModifiers: { number: true }
  30507. }, null, 8, ["modelValue"])
  30508. ]),
  30509. _: 1
  30510. }),
  30511. createVNode(_component_el_form_item, { label: "\u6821\u9A8C\u6587\u6848" }, {
  30512. default: withCtx(() => [
  30513. createVNode(_component_el_input, {
  30514. modelValue: _ctx.data.options.rules.message,
  30515. "onUpdate:modelValue": _cache[65] || (_cache[65] = ($event) => _ctx.data.options.rules.message = $event)
  30516. }, null, 8, ["modelValue"])
  30517. ]),
  30518. _: 1
  30519. }),
  30520. createVNode(_component_el_form_item, { label: "\u6B63\u5219\u8868\u8FBE\u5F0F" }, {
  30521. default: withCtx(() => [
  30522. createVNode(_component_el_input, {
  30523. modelValue: _ctx.data.options.rules.pattern,
  30524. "onUpdate:modelValue": _cache[66] || (_cache[66] = ($event) => _ctx.data.options.rules.pattern = $event)
  30525. }, null, 8, ["modelValue"])
  30526. ]),
  30527. _: 1
  30528. }),
  30529. createVNode(_component_el_form_item, { label: "\u6821\u9A8C\u7C7B\u578B" }, {
  30530. default: withCtx(() => [
  30531. createVNode(_component_el_select, {
  30532. modelValue: _ctx.data.options.rules.type,
  30533. "onUpdate:modelValue": _cache[67] || (_cache[67] = ($event) => _ctx.data.options.rules.type = $event)
  30534. }, {
  30535. default: withCtx(() => [
  30536. createVNode(_component_el_option, { value: "string" }, {
  30537. default: withCtx(() => [
  30538. _hoisted_49
  30539. ]),
  30540. _: 1
  30541. }),
  30542. createVNode(_component_el_option, { value: "number" }, {
  30543. default: withCtx(() => [
  30544. _hoisted_50
  30545. ]),
  30546. _: 1
  30547. }),
  30548. createVNode(_component_el_option, { value: "boolean" }, {
  30549. default: withCtx(() => [
  30550. _hoisted_51
  30551. ]),
  30552. _: 1
  30553. }),
  30554. createVNode(_component_el_option, { value: "method" }, {
  30555. default: withCtx(() => [
  30556. _hoisted_52
  30557. ]),
  30558. _: 1
  30559. }),
  30560. createVNode(_component_el_option, { value: "regexp" }, {
  30561. default: withCtx(() => [
  30562. _hoisted_53
  30563. ]),
  30564. _: 1
  30565. }),
  30566. createVNode(_component_el_option, { value: "integer" }, {
  30567. default: withCtx(() => [
  30568. _hoisted_54
  30569. ]),
  30570. _: 1
  30571. }),
  30572. createVNode(_component_el_option, { value: "float" }, {
  30573. default: withCtx(() => [
  30574. _hoisted_55
  30575. ]),
  30576. _: 1
  30577. }),
  30578. createVNode(_component_el_option, { value: "array" }, {
  30579. default: withCtx(() => [
  30580. _hoisted_56
  30581. ]),
  30582. _: 1
  30583. }),
  30584. createVNode(_component_el_option, { value: "object" }, {
  30585. default: withCtx(() => [
  30586. _hoisted_57
  30587. ]),
  30588. _: 1
  30589. }),
  30590. createVNode(_component_el_option, { value: "enum" }, {
  30591. default: withCtx(() => [
  30592. _hoisted_58
  30593. ]),
  30594. _: 1
  30595. }),
  30596. createVNode(_component_el_option, { value: "date" }, {
  30597. default: withCtx(() => [
  30598. _hoisted_59
  30599. ]),
  30600. _: 1
  30601. }),
  30602. createVNode(_component_el_option, { value: "url" }, {
  30603. default: withCtx(() => [
  30604. _hoisted_60
  30605. ]),
  30606. _: 1
  30607. }),
  30608. createVNode(_component_el_option, { value: "hex" }, {
  30609. default: withCtx(() => [
  30610. _hoisted_61
  30611. ]),
  30612. _: 1
  30613. }),
  30614. createVNode(_component_el_option, { value: "email" }, {
  30615. default: withCtx(() => [
  30616. _hoisted_62
  30617. ]),
  30618. _: 1
  30619. }),
  30620. createVNode(_component_el_option, { value: "any" }, {
  30621. default: withCtx(() => [
  30622. _hoisted_63
  30623. ]),
  30624. _: 1
  30625. })
  30626. ]),
  30627. _: 1
  30628. }, 8, ["modelValue"])
  30629. ]),
  30630. _: 1
  30631. })
  30632. ], 64)) : createCommentVNode("", true)
  30633. ], 64)) : createCommentVNode("", true)
  30634. ]),
  30635. _: 1
  30636. })) : createCommentVNode("", true);
  30637. }
  30638. var WidgetConfig = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render]]);
  30639. const _hoisted_1$1 = /* @__PURE__ */ createTextVNode(" \u5DE6\u5BF9\u9F50 ");
  30640. const _hoisted_2$1 = /* @__PURE__ */ createTextVNode(" \u53F3\u5BF9\u9F50 ");
  30641. const _hoisted_3$1 = /* @__PURE__ */ createTextVNode(" \u9876\u90E8\u5BF9\u9F50 ");
  30642. const _hoisted_4$1 = /* @__PURE__ */ createTextVNode(" \u5927 ");
  30643. const _hoisted_5$1 = /* @__PURE__ */ createTextVNode(" \u9ED8\u8BA4 ");
  30644. const _hoisted_6$1 = /* @__PURE__ */ createTextVNode(" \u5C0F ");
  30645. const _sfc_main$2 = /* @__PURE__ */ defineComponent({
  30646. props: {
  30647. config: null
  30648. },
  30649. setup(__props) {
  30650. return (_ctx, _cache) => {
  30651. const _component_el_radio_button = ElRadioButton;
  30652. const _component_el_radio_group = ElRadioGroup;
  30653. const _component_el_form_item = ElFormItem;
  30654. const _component_el_input_number = ElInputNumber;
  30655. const _component_el_switch = ElSwitch;
  30656. const _component_el_form = ElForm;
  30657. return openBlock(), createBlock(_component_el_form, {
  30658. "p-2": "",
  30659. "label-position": "top",
  30660. onSubmit: _cache[4] || (_cache[4] = withModifiers(() => {
  30661. }, ["prevent"]))
  30662. }, {
  30663. default: withCtx(() => [
  30664. createVNode(_component_el_form_item, { label: "\u6807\u7B7E\u5BF9\u9F50\u65B9\u5F0F" }, {
  30665. default: withCtx(() => [
  30666. createVNode(_component_el_radio_group, {
  30667. modelValue: __props.config.labelPosition,
  30668. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => __props.config.labelPosition = $event)
  30669. }, {
  30670. default: withCtx(() => [
  30671. createVNode(_component_el_radio_button, { label: "left" }, {
  30672. default: withCtx(() => [
  30673. _hoisted_1$1
  30674. ]),
  30675. _: 1
  30676. }),
  30677. createVNode(_component_el_radio_button, { label: "right" }, {
  30678. default: withCtx(() => [
  30679. _hoisted_2$1
  30680. ]),
  30681. _: 1
  30682. }),
  30683. createVNode(_component_el_radio_button, { label: "top" }, {
  30684. default: withCtx(() => [
  30685. _hoisted_3$1
  30686. ]),
  30687. _: 1
  30688. })
  30689. ]),
  30690. _: 1
  30691. }, 8, ["modelValue"])
  30692. ]),
  30693. _: 1
  30694. }),
  30695. createVNode(_component_el_form_item, { label: "\u6807\u7B7E\u5BBD\u5EA6" }, {
  30696. default: withCtx(() => [
  30697. createVNode(_component_el_input_number, {
  30698. modelValue: __props.config.labelWidth,
  30699. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => __props.config.labelWidth = $event),
  30700. modelModifiers: { number: true },
  30701. min: 0
  30702. }, null, 8, ["modelValue"])
  30703. ]),
  30704. _: 1
  30705. }),
  30706. createVNode(_component_el_form_item, { label: "\u7EC4\u4EF6\u5C3A\u5BF8" }, {
  30707. default: withCtx(() => [
  30708. createVNode(_component_el_radio_group, {
  30709. modelValue: __props.config.size,
  30710. "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => __props.config.size = $event)
  30711. }, {
  30712. default: withCtx(() => [
  30713. createVNode(_component_el_radio_button, { label: "large" }, {
  30714. default: withCtx(() => [
  30715. _hoisted_4$1
  30716. ]),
  30717. _: 1
  30718. }),
  30719. createVNode(_component_el_radio_button, { label: "default" }, {
  30720. default: withCtx(() => [
  30721. _hoisted_5$1
  30722. ]),
  30723. _: 1
  30724. }),
  30725. createVNode(_component_el_radio_button, { label: "small" }, {
  30726. default: withCtx(() => [
  30727. _hoisted_6$1
  30728. ]),
  30729. _: 1
  30730. })
  30731. ]),
  30732. _: 1
  30733. }, 8, ["modelValue"])
  30734. ]),
  30735. _: 1
  30736. }),
  30737. createVNode(_component_el_form_item, { label: "\u9690\u85CF\u5FC5\u9009\u6807\u8BB0" }, {
  30738. default: withCtx(() => [
  30739. createVNode(_component_el_switch, {
  30740. modelValue: __props.config.hideRequiredAsterisk,
  30741. "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => __props.config.hideRequiredAsterisk = $event)
  30742. }, null, 8, ["modelValue"])
  30743. ]),
  30744. _: 1
  30745. })
  30746. ]),
  30747. _: 1
  30748. });
  30749. };
  30750. }
  30751. });
  30752. function _extends() {
  30753. _extends = Object.assign || function(target) {
  30754. for (var i = 1; i < arguments.length; i++) {
  30755. var source = arguments[i];
  30756. for (var key in source) {
  30757. if (Object.prototype.hasOwnProperty.call(source, key)) {
  30758. target[key] = source[key];
  30759. }
  30760. }
  30761. }
  30762. return target;
  30763. };
  30764. return _extends.apply(this, arguments);
  30765. }
  30766. var KEYCODE_ENTER = 13;
  30767. var KEYCODE_TAB = 9;
  30768. var KEYCODE_BACKSPACE = 8;
  30769. var KEYCODE_Y = 89;
  30770. var KEYCODE_Z = 90;
  30771. var KEYCODE_M = 77;
  30772. var KEYCODE_PARENS = 57;
  30773. var KEYCODE_BRACKETS = 219;
  30774. var KEYCODE_QUOTE = 222;
  30775. var KEYCODE_BACK_QUOTE = 192;
  30776. var KEYCODE_ESCAPE = 27;
  30777. var HISTORY_LIMIT = 100;
  30778. var HISTORY_TIME_GAP = 3e3;
  30779. var isWindows = typeof window !== "undefined" && navigator && /* @__PURE__ */ /Win/i.test(navigator.platform);
  30780. var isMacLike = typeof window !== "undefined" && navigator && /* @__PURE__ */ /(Mac|iPhone|iPod|iPad)/i.test(navigator.platform);
  30781. var PrismEditor = /* @__PURE__ */ defineComponent({
  30782. props: {
  30783. lineNumbers: {
  30784. type: Boolean,
  30785. "default": false
  30786. },
  30787. autoStyleLineNumbers: {
  30788. type: Boolean,
  30789. "default": true
  30790. },
  30791. readonly: {
  30792. type: Boolean,
  30793. "default": false
  30794. },
  30795. modelValue: {
  30796. type: String,
  30797. "default": ""
  30798. },
  30799. highlight: {
  30800. type: Function,
  30801. required: true
  30802. },
  30803. tabSize: {
  30804. type: Number,
  30805. "default": 2
  30806. },
  30807. insertSpaces: {
  30808. type: Boolean,
  30809. "default": true
  30810. },
  30811. ignoreTabKey: {
  30812. type: Boolean,
  30813. "default": false
  30814. },
  30815. placeholder: {
  30816. type: String,
  30817. "default": ""
  30818. }
  30819. },
  30820. data: function data() {
  30821. return {
  30822. capture: true,
  30823. history: {
  30824. stack: [],
  30825. offset: -1
  30826. },
  30827. lineNumbersHeight: "20px",
  30828. codeData: ""
  30829. };
  30830. },
  30831. watch: {
  30832. modelValue: {
  30833. immediate: true,
  30834. handler: function handler(newVal) {
  30835. if (!newVal) {
  30836. this.codeData = "";
  30837. } else {
  30838. this.codeData = newVal;
  30839. }
  30840. }
  30841. },
  30842. content: {
  30843. immediate: true,
  30844. handler: function handler2() {
  30845. var _this = this;
  30846. if (this.lineNumbers) {
  30847. this.$nextTick(function() {
  30848. _this.setLineNumbersHeight();
  30849. });
  30850. }
  30851. }
  30852. },
  30853. lineNumbers: function lineNumbers() {
  30854. var _this2 = this;
  30855. this.$nextTick(function() {
  30856. _this2.styleLineNumbers();
  30857. _this2.setLineNumbersHeight();
  30858. });
  30859. }
  30860. },
  30861. computed: {
  30862. isEmpty: function isEmpty2() {
  30863. return this.codeData.length === 0;
  30864. },
  30865. content: function content() {
  30866. var result = this.highlight(this.codeData) + "<br />";
  30867. return result;
  30868. },
  30869. lineNumbersCount: function lineNumbersCount() {
  30870. var totalLines = this.codeData.split(/\r\n|\n/).length;
  30871. return totalLines;
  30872. }
  30873. },
  30874. mounted: function mounted() {
  30875. this._recordCurrentState();
  30876. this.styleLineNumbers();
  30877. },
  30878. methods: {
  30879. setLineNumbersHeight: function setLineNumbersHeight() {
  30880. this.lineNumbersHeight = getComputedStyle(this.$refs.pre).height;
  30881. },
  30882. styleLineNumbers: function styleLineNumbers() {
  30883. if (!this.lineNumbers || !this.autoStyleLineNumbers)
  30884. return;
  30885. var $editor = this.$refs.pre;
  30886. var $lineNumbers = this.$el.querySelector(".prism-editor__line-numbers");
  30887. var editorStyles = window.getComputedStyle($editor);
  30888. this.$nextTick(function() {
  30889. var btlr = "border-top-left-radius";
  30890. var bblr = "border-bottom-left-radius";
  30891. if (!$lineNumbers)
  30892. return;
  30893. $lineNumbers.style[btlr] = editorStyles[btlr];
  30894. $lineNumbers.style[bblr] = editorStyles[bblr];
  30895. $editor.style[btlr] = "0";
  30896. $editor.style[bblr] = "0";
  30897. var stylesList = ["background-color", "margin-top", "padding-top", "font-family", "font-size", "line-height"];
  30898. stylesList.forEach(function(style) {
  30899. $lineNumbers.style[style] = editorStyles[style];
  30900. });
  30901. $lineNumbers.style["margin-bottom"] = "-" + editorStyles["padding-top"];
  30902. });
  30903. },
  30904. _recordCurrentState: function _recordCurrentState() {
  30905. var input = this.$refs.textarea;
  30906. if (!input)
  30907. return;
  30908. var value = input.value, selectionStart = input.selectionStart, selectionEnd = input.selectionEnd;
  30909. this._recordChange({
  30910. value,
  30911. selectionStart,
  30912. selectionEnd
  30913. });
  30914. },
  30915. _getLines: function _getLines(text, position) {
  30916. return text.substring(0, position).split("\n");
  30917. },
  30918. _applyEdits: function _applyEdits(record) {
  30919. var input = this.$refs.textarea;
  30920. var last = this.history.stack[this.history.offset];
  30921. if (last && input) {
  30922. this.history.stack[this.history.offset] = _extends({}, last, {
  30923. selectionStart: input.selectionStart,
  30924. selectionEnd: input.selectionEnd
  30925. });
  30926. }
  30927. this._recordChange(record);
  30928. this._updateInput(record);
  30929. },
  30930. _recordChange: function _recordChange(record, overwrite) {
  30931. if (overwrite === void 0) {
  30932. overwrite = false;
  30933. }
  30934. var _this$history = this.history, stack = _this$history.stack, offset2 = _this$history.offset;
  30935. if (stack.length && offset2 > -1) {
  30936. this.history.stack = stack.slice(0, offset2 + 1);
  30937. var count = this.history.stack.length;
  30938. if (count > HISTORY_LIMIT) {
  30939. var extras = count - HISTORY_LIMIT;
  30940. this.history.stack = stack.slice(extras, count);
  30941. this.history.offset = Math.max(this.history.offset - extras, 0);
  30942. }
  30943. }
  30944. var timestamp = Date.now();
  30945. if (overwrite) {
  30946. var last = this.history.stack[this.history.offset];
  30947. if (last && timestamp - last.timestamp < HISTORY_TIME_GAP) {
  30948. var _this$_getLines$pop, _this$_getLines$pop2;
  30949. var re = /[^a-z0-9]([a-z0-9]+)$/i;
  30950. 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);
  30951. 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);
  30952. if (previous && current && current[1].startsWith(previous[1])) {
  30953. this.history.stack[this.history.offset] = _extends({}, record, {
  30954. timestamp
  30955. });
  30956. return;
  30957. }
  30958. }
  30959. }
  30960. this.history.stack.push(_extends({}, record, {
  30961. timestamp
  30962. }));
  30963. this.history.offset++;
  30964. },
  30965. _updateInput: function _updateInput(record) {
  30966. var input = this.$refs.textarea;
  30967. if (!input)
  30968. return;
  30969. input.value = record.value;
  30970. input.selectionStart = record.selectionStart;
  30971. input.selectionEnd = record.selectionEnd;
  30972. this.$emit("update:modelValue", record.value);
  30973. },
  30974. handleChange: function handleChange(e) {
  30975. var _e$target = e.target, value = _e$target.value, selectionStart = _e$target.selectionStart, selectionEnd = _e$target.selectionEnd;
  30976. this._recordChange({
  30977. value,
  30978. selectionStart,
  30979. selectionEnd
  30980. }, true);
  30981. this.$emit("update:modelValue", value);
  30982. },
  30983. _undoEdit: function _undoEdit() {
  30984. var _this$history2 = this.history, stack = _this$history2.stack, offset2 = _this$history2.offset;
  30985. var record = stack[offset2 - 1];
  30986. if (record) {
  30987. this._updateInput(record);
  30988. this.history.offset = Math.max(offset2 - 1, 0);
  30989. }
  30990. },
  30991. _redoEdit: function _redoEdit() {
  30992. var _this$history3 = this.history, stack = _this$history3.stack, offset2 = _this$history3.offset;
  30993. var record = stack[offset2 + 1];
  30994. if (record) {
  30995. this._updateInput(record);
  30996. this.history.offset = Math.min(offset2 + 1, stack.length - 1);
  30997. }
  30998. },
  30999. handleKeyDown: function handleKeyDown(e) {
  31000. var tabSize = this.tabSize, insertSpaces = this.insertSpaces, ignoreTabKey = this.ignoreTabKey;
  31001. this.$emit("keydown", e);
  31002. if (e.defaultPrevented) {
  31003. return;
  31004. }
  31005. if (e.keyCode === KEYCODE_ESCAPE) {
  31006. e.target.blur();
  31007. this.$emit("blur", e);
  31008. }
  31009. var _e$target2 = e.target, value = _e$target2.value, selectionStart = _e$target2.selectionStart, selectionEnd = _e$target2.selectionEnd;
  31010. var tabCharacter = (insertSpaces ? " " : " ").repeat(tabSize);
  31011. if (e.keyCode === KEYCODE_TAB && !ignoreTabKey && this.capture) {
  31012. e.preventDefault();
  31013. if (e.shiftKey) {
  31014. var linesBeforeCaret = this._getLines(value, selectionStart);
  31015. var startLine = linesBeforeCaret.length - 1;
  31016. var endLine = this._getLines(value, selectionEnd).length - 1;
  31017. var nextValue = value.split("\n").map(function(line2, i) {
  31018. if (i >= startLine && i <= endLine && line2.startsWith(tabCharacter)) {
  31019. return line2.substring(tabCharacter.length);
  31020. }
  31021. return line2;
  31022. }).join("\n");
  31023. if (value !== nextValue) {
  31024. var startLineText = linesBeforeCaret[startLine];
  31025. this._applyEdits({
  31026. value: nextValue,
  31027. selectionStart: startLineText.startsWith(tabCharacter) ? selectionStart - tabCharacter.length : selectionStart,
  31028. selectionEnd: selectionEnd - (value.length - nextValue.length)
  31029. });
  31030. }
  31031. } else if (selectionStart !== selectionEnd) {
  31032. var _linesBeforeCaret = this._getLines(value, selectionStart);
  31033. var _startLine = _linesBeforeCaret.length - 1;
  31034. var _endLine = this._getLines(value, selectionEnd).length - 1;
  31035. var _startLineText = _linesBeforeCaret[_startLine];
  31036. this._applyEdits({
  31037. value: value.split("\n").map(function(line2, i) {
  31038. if (i >= _startLine && i <= _endLine) {
  31039. return tabCharacter + line2;
  31040. }
  31041. return line2;
  31042. }).join("\n"),
  31043. selectionStart: /\S/.test(_startLineText) ? selectionStart + tabCharacter.length : selectionStart,
  31044. selectionEnd: selectionEnd + tabCharacter.length * (_endLine - _startLine + 1)
  31045. });
  31046. } else {
  31047. var updatedSelection = selectionStart + tabCharacter.length;
  31048. this._applyEdits({
  31049. value: value.substring(0, selectionStart) + tabCharacter + value.substring(selectionEnd),
  31050. selectionStart: updatedSelection,
  31051. selectionEnd: updatedSelection
  31052. });
  31053. }
  31054. } else if (e.keyCode === KEYCODE_BACKSPACE) {
  31055. var hasSelection = selectionStart !== selectionEnd;
  31056. var textBeforeCaret = value.substring(0, selectionStart);
  31057. if (textBeforeCaret.endsWith(tabCharacter) && !hasSelection) {
  31058. e.preventDefault();
  31059. var _updatedSelection = selectionStart - tabCharacter.length;
  31060. this._applyEdits({
  31061. value: value.substring(0, selectionStart - tabCharacter.length) + value.substring(selectionEnd),
  31062. selectionStart: _updatedSelection,
  31063. selectionEnd: _updatedSelection
  31064. });
  31065. }
  31066. } else if (e.keyCode === KEYCODE_ENTER) {
  31067. if (selectionStart === selectionEnd) {
  31068. var line = this._getLines(value, selectionStart).pop();
  31069. var matches = line === null || line === void 0 ? void 0 : line.match(/^\s+/);
  31070. if (matches && matches[0]) {
  31071. e.preventDefault();
  31072. var indent = "\n" + matches[0];
  31073. var _updatedSelection2 = selectionStart + indent.length;
  31074. this._applyEdits({
  31075. value: value.substring(0, selectionStart) + indent + value.substring(selectionEnd),
  31076. selectionStart: _updatedSelection2,
  31077. selectionEnd: _updatedSelection2
  31078. });
  31079. }
  31080. }
  31081. } else if (e.keyCode === KEYCODE_PARENS || e.keyCode === KEYCODE_BRACKETS || e.keyCode === KEYCODE_QUOTE || e.keyCode === KEYCODE_BACK_QUOTE) {
  31082. var chars;
  31083. if (e.keyCode === KEYCODE_PARENS && e.shiftKey) {
  31084. chars = ["(", ")"];
  31085. } else if (e.keyCode === KEYCODE_BRACKETS) {
  31086. if (e.shiftKey) {
  31087. chars = ["{", "}"];
  31088. } else {
  31089. chars = ["[", "]"];
  31090. }
  31091. } else if (e.keyCode === KEYCODE_QUOTE) {
  31092. if (e.shiftKey) {
  31093. chars = ['"', '"'];
  31094. } else {
  31095. chars = ["'", "'"];
  31096. }
  31097. } else if (e.keyCode === KEYCODE_BACK_QUOTE && !e.shiftKey) {
  31098. chars = ["`", "`"];
  31099. }
  31100. if (selectionStart !== selectionEnd && chars) {
  31101. e.preventDefault();
  31102. this._applyEdits({
  31103. value: value.substring(0, selectionStart) + chars[0] + value.substring(selectionStart, selectionEnd) + chars[1] + value.substring(selectionEnd),
  31104. selectionStart,
  31105. selectionEnd: selectionEnd + 2
  31106. });
  31107. }
  31108. } else if ((isMacLike ? e.metaKey && e.keyCode === KEYCODE_Z : e.ctrlKey && e.keyCode === KEYCODE_Z) && !e.shiftKey && !e.altKey) {
  31109. e.preventDefault();
  31110. this._undoEdit();
  31111. } 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) {
  31112. e.preventDefault();
  31113. this._redoEdit();
  31114. } else if (e.keyCode === KEYCODE_M && e.ctrlKey && (isMacLike ? e.shiftKey : true)) {
  31115. e.preventDefault();
  31116. this.capture = !this.capture;
  31117. }
  31118. }
  31119. },
  31120. render: function render() {
  31121. var _this3 = this;
  31122. var lineNumberWidthCalculator = h$1("div", {
  31123. "class": "prism-editor__line-width-calc",
  31124. style: "height: 0px; visibility: hidden; pointer-events: none;"
  31125. }, "999");
  31126. var lineNumbers2 = h$1("div", {
  31127. "class": "prism-editor__line-numbers",
  31128. style: {
  31129. "min-height": this.lineNumbersHeight
  31130. },
  31131. "aria-hidden": "true"
  31132. }, [lineNumberWidthCalculator, Array.from(Array(this.lineNumbersCount).keys()).map(function(_2, index) {
  31133. return h$1("div", {
  31134. "class": "prism-editor__line-number token comment"
  31135. }, "" + ++index);
  31136. })]);
  31137. var textarea = h$1("textarea", {
  31138. ref: "textarea",
  31139. onInput: this.handleChange,
  31140. onKeydown: this.handleKeyDown,
  31141. onClick: function onClick($event) {
  31142. _this3.$emit("click", $event);
  31143. },
  31144. onKeyup: function onKeyup($event) {
  31145. _this3.$emit("keyup", $event);
  31146. },
  31147. onFocus: function onFocus($event) {
  31148. _this3.$emit("focus", $event);
  31149. },
  31150. onBlur: function onBlur($event) {
  31151. _this3.$emit("blur", $event);
  31152. },
  31153. "class": {
  31154. "prism-editor__textarea": true,
  31155. "prism-editor__textarea--empty": this.isEmpty
  31156. },
  31157. spellCheck: "false",
  31158. autocapitalize: "off",
  31159. autocomplete: "off",
  31160. autocorrect: "off",
  31161. "data-gramm": "false",
  31162. placeholder: this.placeholder,
  31163. "data-testid": "textarea",
  31164. readonly: this.readonly,
  31165. value: this.codeData
  31166. });
  31167. var preview = h$1("pre", {
  31168. ref: "pre",
  31169. "class": "prism-editor__editor",
  31170. "data-testid": "preview",
  31171. innerHTML: this.content
  31172. });
  31173. var editorContainer = h$1("div", {
  31174. "class": "prism-editor__container"
  31175. }, [textarea, preview]);
  31176. return h$1("div", {
  31177. "class": "prism-editor-wrapper"
  31178. }, [this.lineNumbers && lineNumbers2, editorContainer]);
  31179. }
  31180. });
  31181. var prismeditor_min = "";
  31182. var prismCore = { exports: {} };
  31183. (function(module2) {
  31184. var _self = typeof window !== "undefined" ? window : typeof WorkerGlobalScope !== "undefined" && self instanceof WorkerGlobalScope ? self : {};
  31185. /**
  31186. * Prism: Lightweight, robust, elegant syntax highlighting
  31187. *
  31188. * @license MIT <https://opensource.org/licenses/MIT>
  31189. * @author Lea Verou <https://lea.verou.me>
  31190. * @namespace
  31191. * @public
  31192. */
  31193. var Prism2 = function(_self2) {
  31194. var lang = /(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i;
  31195. var uniqueId = 0;
  31196. var plainTextGrammar = {};
  31197. var _2 = {
  31198. manual: _self2.Prism && _self2.Prism.manual,
  31199. disableWorkerMessageHandler: _self2.Prism && _self2.Prism.disableWorkerMessageHandler,
  31200. util: {
  31201. encode: function encode(tokens) {
  31202. if (tokens instanceof Token) {
  31203. return new Token(tokens.type, encode(tokens.content), tokens.alias);
  31204. } else if (Array.isArray(tokens)) {
  31205. return tokens.map(encode);
  31206. } else {
  31207. return tokens.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/\u00a0/g, " ");
  31208. }
  31209. },
  31210. type: function(o2) {
  31211. return Object.prototype.toString.call(o2).slice(8, -1);
  31212. },
  31213. objId: function(obj) {
  31214. if (!obj["__id"]) {
  31215. Object.defineProperty(obj, "__id", { value: ++uniqueId });
  31216. }
  31217. return obj["__id"];
  31218. },
  31219. clone: function deepClone(o2, visited) {
  31220. visited = visited || {};
  31221. var clone2;
  31222. var id;
  31223. switch (_2.util.type(o2)) {
  31224. case "Object":
  31225. id = _2.util.objId(o2);
  31226. if (visited[id]) {
  31227. return visited[id];
  31228. }
  31229. clone2 = {};
  31230. visited[id] = clone2;
  31231. for (var key in o2) {
  31232. if (o2.hasOwnProperty(key)) {
  31233. clone2[key] = deepClone(o2[key], visited);
  31234. }
  31235. }
  31236. return clone2;
  31237. case "Array":
  31238. id = _2.util.objId(o2);
  31239. if (visited[id]) {
  31240. return visited[id];
  31241. }
  31242. clone2 = [];
  31243. visited[id] = clone2;
  31244. o2.forEach(function(v2, i) {
  31245. clone2[i] = deepClone(v2, visited);
  31246. });
  31247. return clone2;
  31248. default:
  31249. return o2;
  31250. }
  31251. },
  31252. getLanguage: function(element) {
  31253. while (element) {
  31254. var m2 = lang.exec(element.className);
  31255. if (m2) {
  31256. return m2[1].toLowerCase();
  31257. }
  31258. element = element.parentElement;
  31259. }
  31260. return "none";
  31261. },
  31262. setLanguage: function(element, language) {
  31263. element.className = element.className.replace(RegExp(lang, "gi"), "");
  31264. element.classList.add("language-" + language);
  31265. },
  31266. currentScript: function() {
  31267. if (typeof document === "undefined") {
  31268. return null;
  31269. }
  31270. if ("currentScript" in document && 1 < 2) {
  31271. return document.currentScript;
  31272. }
  31273. try {
  31274. throw new Error();
  31275. } catch (err) {
  31276. var src = (/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(err.stack) || [])[1];
  31277. if (src) {
  31278. var scripts = document.getElementsByTagName("script");
  31279. for (var i in scripts) {
  31280. if (scripts[i].src == src) {
  31281. return scripts[i];
  31282. }
  31283. }
  31284. }
  31285. return null;
  31286. }
  31287. },
  31288. isActive: function(element, className, defaultActivation) {
  31289. var no = "no-" + className;
  31290. while (element) {
  31291. var classList = element.classList;
  31292. if (classList.contains(className)) {
  31293. return true;
  31294. }
  31295. if (classList.contains(no)) {
  31296. return false;
  31297. }
  31298. element = element.parentElement;
  31299. }
  31300. return !!defaultActivation;
  31301. }
  31302. },
  31303. languages: {
  31304. plain: plainTextGrammar,
  31305. plaintext: plainTextGrammar,
  31306. text: plainTextGrammar,
  31307. txt: plainTextGrammar,
  31308. extend: function(id, redef) {
  31309. var lang2 = _2.util.clone(_2.languages[id]);
  31310. for (var key in redef) {
  31311. lang2[key] = redef[key];
  31312. }
  31313. return lang2;
  31314. },
  31315. insertBefore: function(inside, before, insert, root2) {
  31316. root2 = root2 || _2.languages;
  31317. var grammar = root2[inside];
  31318. var ret = {};
  31319. for (var token in grammar) {
  31320. if (grammar.hasOwnProperty(token)) {
  31321. if (token == before) {
  31322. for (var newToken in insert) {
  31323. if (insert.hasOwnProperty(newToken)) {
  31324. ret[newToken] = insert[newToken];
  31325. }
  31326. }
  31327. }
  31328. if (!insert.hasOwnProperty(token)) {
  31329. ret[token] = grammar[token];
  31330. }
  31331. }
  31332. }
  31333. var old = root2[inside];
  31334. root2[inside] = ret;
  31335. _2.languages.DFS(_2.languages, function(key, value) {
  31336. if (value === old && key != inside) {
  31337. this[key] = ret;
  31338. }
  31339. });
  31340. return ret;
  31341. },
  31342. DFS: function DFS(o2, callback, type4, visited) {
  31343. visited = visited || {};
  31344. var objId = _2.util.objId;
  31345. for (var i in o2) {
  31346. if (o2.hasOwnProperty(i)) {
  31347. callback.call(o2, i, o2[i], type4 || i);
  31348. var property = o2[i];
  31349. var propertyType = _2.util.type(property);
  31350. if (propertyType === "Object" && !visited[objId(property)]) {
  31351. visited[objId(property)] = true;
  31352. DFS(property, callback, null, visited);
  31353. } else if (propertyType === "Array" && !visited[objId(property)]) {
  31354. visited[objId(property)] = true;
  31355. DFS(property, callback, i, visited);
  31356. }
  31357. }
  31358. }
  31359. }
  31360. },
  31361. plugins: {},
  31362. highlightAll: function(async, callback) {
  31363. _2.highlightAllUnder(document, async, callback);
  31364. },
  31365. highlightAllUnder: function(container, async, callback) {
  31366. var env = {
  31367. callback,
  31368. container,
  31369. selector: 'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'
  31370. };
  31371. _2.hooks.run("before-highlightall", env);
  31372. env.elements = Array.prototype.slice.apply(env.container.querySelectorAll(env.selector));
  31373. _2.hooks.run("before-all-elements-highlight", env);
  31374. for (var i = 0, element; element = env.elements[i++]; ) {
  31375. _2.highlightElement(element, async === true, env.callback);
  31376. }
  31377. },
  31378. highlightElement: function(element, async, callback) {
  31379. var language = _2.util.getLanguage(element);
  31380. var grammar = _2.languages[language];
  31381. _2.util.setLanguage(element, language);
  31382. var parent = element.parentElement;
  31383. if (parent && parent.nodeName.toLowerCase() === "pre") {
  31384. _2.util.setLanguage(parent, language);
  31385. }
  31386. var code = element.textContent;
  31387. var env = {
  31388. element,
  31389. language,
  31390. grammar,
  31391. code
  31392. };
  31393. function insertHighlightedCode(highlightedCode) {
  31394. env.highlightedCode = highlightedCode;
  31395. _2.hooks.run("before-insert", env);
  31396. env.element.innerHTML = env.highlightedCode;
  31397. _2.hooks.run("after-highlight", env);
  31398. _2.hooks.run("complete", env);
  31399. callback && callback.call(env.element);
  31400. }
  31401. _2.hooks.run("before-sanity-check", env);
  31402. parent = env.element.parentElement;
  31403. if (parent && parent.nodeName.toLowerCase() === "pre" && !parent.hasAttribute("tabindex")) {
  31404. parent.setAttribute("tabindex", "0");
  31405. }
  31406. if (!env.code) {
  31407. _2.hooks.run("complete", env);
  31408. callback && callback.call(env.element);
  31409. return;
  31410. }
  31411. _2.hooks.run("before-highlight", env);
  31412. if (!env.grammar) {
  31413. insertHighlightedCode(_2.util.encode(env.code));
  31414. return;
  31415. }
  31416. if (async && _self2.Worker) {
  31417. var worker = new Worker(_2.filename);
  31418. worker.onmessage = function(evt) {
  31419. insertHighlightedCode(evt.data);
  31420. };
  31421. worker.postMessage(JSON.stringify({
  31422. language: env.language,
  31423. code: env.code,
  31424. immediateClose: true
  31425. }));
  31426. } else {
  31427. insertHighlightedCode(_2.highlight(env.code, env.grammar, env.language));
  31428. }
  31429. },
  31430. highlight: function(text, grammar, language) {
  31431. var env = {
  31432. code: text,
  31433. grammar,
  31434. language
  31435. };
  31436. _2.hooks.run("before-tokenize", env);
  31437. if (!env.grammar) {
  31438. throw new Error('The language "' + env.language + '" has no grammar.');
  31439. }
  31440. env.tokens = _2.tokenize(env.code, env.grammar);
  31441. _2.hooks.run("after-tokenize", env);
  31442. return Token.stringify(_2.util.encode(env.tokens), env.language);
  31443. },
  31444. tokenize: function(text, grammar) {
  31445. var rest = grammar.rest;
  31446. if (rest) {
  31447. for (var token in rest) {
  31448. grammar[token] = rest[token];
  31449. }
  31450. delete grammar.rest;
  31451. }
  31452. var tokenList = new LinkedList();
  31453. addAfter(tokenList, tokenList.head, text);
  31454. matchGrammar(text, tokenList, grammar, tokenList.head, 0);
  31455. return toArray(tokenList);
  31456. },
  31457. hooks: {
  31458. all: {},
  31459. add: function(name, callback) {
  31460. var hooks = _2.hooks.all;
  31461. hooks[name] = hooks[name] || [];
  31462. hooks[name].push(callback);
  31463. },
  31464. run: function(name, env) {
  31465. var callbacks = _2.hooks.all[name];
  31466. if (!callbacks || !callbacks.length) {
  31467. return;
  31468. }
  31469. for (var i = 0, callback; callback = callbacks[i++]; ) {
  31470. callback(env);
  31471. }
  31472. }
  31473. },
  31474. Token
  31475. };
  31476. _self2.Prism = _2;
  31477. function Token(type4, content2, alias, matchedStr) {
  31478. this.type = type4;
  31479. this.content = content2;
  31480. this.alias = alias;
  31481. this.length = (matchedStr || "").length | 0;
  31482. }
  31483. Token.stringify = function stringify(o2, language) {
  31484. if (typeof o2 == "string") {
  31485. return o2;
  31486. }
  31487. if (Array.isArray(o2)) {
  31488. var s2 = "";
  31489. o2.forEach(function(e) {
  31490. s2 += stringify(e, language);
  31491. });
  31492. return s2;
  31493. }
  31494. var env = {
  31495. type: o2.type,
  31496. content: stringify(o2.content, language),
  31497. tag: "span",
  31498. classes: ["token", o2.type],
  31499. attributes: {},
  31500. language
  31501. };
  31502. var aliases = o2.alias;
  31503. if (aliases) {
  31504. if (Array.isArray(aliases)) {
  31505. Array.prototype.push.apply(env.classes, aliases);
  31506. } else {
  31507. env.classes.push(aliases);
  31508. }
  31509. }
  31510. _2.hooks.run("wrap", env);
  31511. var attributes = "";
  31512. for (var name in env.attributes) {
  31513. attributes += " " + name + '="' + (env.attributes[name] || "").replace(/"/g, "&quot;") + '"';
  31514. }
  31515. return "<" + env.tag + ' class="' + env.classes.join(" ") + '"' + attributes + ">" + env.content + "</" + env.tag + ">";
  31516. };
  31517. function matchPattern(pattern4, pos, text, lookbehind) {
  31518. pattern4.lastIndex = pos;
  31519. var match = pattern4.exec(text);
  31520. if (match && lookbehind && match[1]) {
  31521. var lookbehindLength = match[1].length;
  31522. match.index += lookbehindLength;
  31523. match[0] = match[0].slice(lookbehindLength);
  31524. }
  31525. return match;
  31526. }
  31527. function matchGrammar(text, tokenList, grammar, startNode, startPos, rematch) {
  31528. for (var token in grammar) {
  31529. if (!grammar.hasOwnProperty(token) || !grammar[token]) {
  31530. continue;
  31531. }
  31532. var patterns = grammar[token];
  31533. patterns = Array.isArray(patterns) ? patterns : [patterns];
  31534. for (var j = 0; j < patterns.length; ++j) {
  31535. if (rematch && rematch.cause == token + "," + j) {
  31536. return;
  31537. }
  31538. var patternObj = patterns[j];
  31539. var inside = patternObj.inside;
  31540. var lookbehind = !!patternObj.lookbehind;
  31541. var greedy = !!patternObj.greedy;
  31542. var alias = patternObj.alias;
  31543. if (greedy && !patternObj.pattern.global) {
  31544. var flags = patternObj.pattern.toString().match(/[imsuy]*$/)[0];
  31545. patternObj.pattern = RegExp(patternObj.pattern.source, flags + "g");
  31546. }
  31547. var pattern4 = patternObj.pattern || patternObj;
  31548. for (var currentNode = startNode.next, pos = startPos; currentNode !== tokenList.tail; pos += currentNode.value.length, currentNode = currentNode.next) {
  31549. if (rematch && pos >= rematch.reach) {
  31550. break;
  31551. }
  31552. var str = currentNode.value;
  31553. if (tokenList.length > text.length) {
  31554. return;
  31555. }
  31556. if (str instanceof Token) {
  31557. continue;
  31558. }
  31559. var removeCount = 1;
  31560. var match;
  31561. if (greedy) {
  31562. match = matchPattern(pattern4, pos, text, lookbehind);
  31563. if (!match || match.index >= text.length) {
  31564. break;
  31565. }
  31566. var from = match.index;
  31567. var to = match.index + match[0].length;
  31568. var p2 = pos;
  31569. p2 += currentNode.value.length;
  31570. while (from >= p2) {
  31571. currentNode = currentNode.next;
  31572. p2 += currentNode.value.length;
  31573. }
  31574. p2 -= currentNode.value.length;
  31575. pos = p2;
  31576. if (currentNode.value instanceof Token) {
  31577. continue;
  31578. }
  31579. for (var k = currentNode; k !== tokenList.tail && (p2 < to || typeof k.value === "string"); k = k.next) {
  31580. removeCount++;
  31581. p2 += k.value.length;
  31582. }
  31583. removeCount--;
  31584. str = text.slice(pos, p2);
  31585. match.index -= pos;
  31586. } else {
  31587. match = matchPattern(pattern4, 0, str, lookbehind);
  31588. if (!match) {
  31589. continue;
  31590. }
  31591. }
  31592. var from = match.index;
  31593. var matchStr = match[0];
  31594. var before = str.slice(0, from);
  31595. var after = str.slice(from + matchStr.length);
  31596. var reach = pos + str.length;
  31597. if (rematch && reach > rematch.reach) {
  31598. rematch.reach = reach;
  31599. }
  31600. var removeFrom = currentNode.prev;
  31601. if (before) {
  31602. removeFrom = addAfter(tokenList, removeFrom, before);
  31603. pos += before.length;
  31604. }
  31605. removeRange(tokenList, removeFrom, removeCount);
  31606. var wrapped = new Token(token, inside ? _2.tokenize(matchStr, inside) : matchStr, alias, matchStr);
  31607. currentNode = addAfter(tokenList, removeFrom, wrapped);
  31608. if (after) {
  31609. addAfter(tokenList, currentNode, after);
  31610. }
  31611. if (removeCount > 1) {
  31612. var nestedRematch = {
  31613. cause: token + "," + j,
  31614. reach
  31615. };
  31616. matchGrammar(text, tokenList, grammar, currentNode.prev, pos, nestedRematch);
  31617. if (rematch && nestedRematch.reach > rematch.reach) {
  31618. rematch.reach = nestedRematch.reach;
  31619. }
  31620. }
  31621. }
  31622. }
  31623. }
  31624. }
  31625. function LinkedList() {
  31626. var head = { value: null, prev: null, next: null };
  31627. var tail = { value: null, prev: head, next: null };
  31628. head.next = tail;
  31629. this.head = head;
  31630. this.tail = tail;
  31631. this.length = 0;
  31632. }
  31633. function addAfter(list, node, value) {
  31634. var next = node.next;
  31635. var newNode = { value, prev: node, next };
  31636. node.next = newNode;
  31637. next.prev = newNode;
  31638. list.length++;
  31639. return newNode;
  31640. }
  31641. function removeRange(list, node, count) {
  31642. var next = node.next;
  31643. for (var i = 0; i < count && next !== list.tail; i++) {
  31644. next = next.next;
  31645. }
  31646. node.next = next;
  31647. next.prev = node;
  31648. list.length -= i;
  31649. }
  31650. function toArray(list) {
  31651. var array4 = [];
  31652. var node = list.head.next;
  31653. while (node !== list.tail) {
  31654. array4.push(node.value);
  31655. node = node.next;
  31656. }
  31657. return array4;
  31658. }
  31659. if (!_self2.document) {
  31660. if (!_self2.addEventListener) {
  31661. return _2;
  31662. }
  31663. if (!_2.disableWorkerMessageHandler) {
  31664. _self2.addEventListener("message", function(evt) {
  31665. var message = JSON.parse(evt.data);
  31666. var lang2 = message.language;
  31667. var code = message.code;
  31668. var immediateClose = message.immediateClose;
  31669. _self2.postMessage(_2.highlight(code, _2.languages[lang2], lang2));
  31670. if (immediateClose) {
  31671. _self2.close();
  31672. }
  31673. }, false);
  31674. }
  31675. return _2;
  31676. }
  31677. var script = _2.util.currentScript();
  31678. if (script) {
  31679. _2.filename = script.src;
  31680. if (script.hasAttribute("data-manual")) {
  31681. _2.manual = true;
  31682. }
  31683. }
  31684. function highlightAutomaticallyCallback() {
  31685. if (!_2.manual) {
  31686. _2.highlightAll();
  31687. }
  31688. }
  31689. if (!_2.manual) {
  31690. var readyState = document.readyState;
  31691. if (readyState === "loading" || readyState === "interactive" && script && script.defer) {
  31692. document.addEventListener("DOMContentLoaded", highlightAutomaticallyCallback);
  31693. } else {
  31694. if (window.requestAnimationFrame) {
  31695. window.requestAnimationFrame(highlightAutomaticallyCallback);
  31696. } else {
  31697. window.setTimeout(highlightAutomaticallyCallback, 16);
  31698. }
  31699. }
  31700. }
  31701. return _2;
  31702. }(_self);
  31703. if (module2.exports) {
  31704. module2.exports = Prism2;
  31705. }
  31706. if (typeof commonjsGlobal !== "undefined") {
  31707. commonjsGlobal.Prism = Prism2;
  31708. }
  31709. })(prismCore);
  31710. Prism.languages.clike = {
  31711. "comment": [
  31712. {
  31713. pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
  31714. lookbehind: true,
  31715. greedy: true
  31716. },
  31717. {
  31718. pattern: /(^|[^\\:])\/\/.*/,
  31719. lookbehind: true,
  31720. greedy: true
  31721. }
  31722. ],
  31723. "string": {
  31724. pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
  31725. greedy: true
  31726. },
  31727. "class-name": {
  31728. pattern: /(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,
  31729. lookbehind: true,
  31730. inside: {
  31731. "punctuation": /[.\\]/
  31732. }
  31733. },
  31734. "keyword": /\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,
  31735. "boolean": /\b(?:false|true)\b/,
  31736. "function": /\b\w+(?=\()/,
  31737. "number": /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
  31738. "operator": /[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,
  31739. "punctuation": /[{}[\];(),.:]/
  31740. };
  31741. Prism.languages.json = {
  31742. "property": {
  31743. pattern: /(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,
  31744. lookbehind: true,
  31745. greedy: true
  31746. },
  31747. "string": {
  31748. pattern: /(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,
  31749. lookbehind: true,
  31750. greedy: true
  31751. },
  31752. "comment": {
  31753. pattern: /\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,
  31754. greedy: true
  31755. },
  31756. "number": /-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,
  31757. "punctuation": /[{}[\],]/,
  31758. "operator": /:/,
  31759. "boolean": /\b(?:false|true)\b/,
  31760. "null": {
  31761. pattern: /\bnull\b/,
  31762. alias: "keyword"
  31763. }
  31764. };
  31765. Prism.languages.webmanifest = Prism.languages.json;
  31766. var prismTomorrow = "";
  31767. var CodeEditor_vue_vue_type_style_index_0_lang = "";
  31768. const _sfc_main$1 = /* @__PURE__ */ defineComponent({
  31769. props: {
  31770. modelValue: { default: "" },
  31771. language: { default: "json" },
  31772. readonly: { type: Boolean, default: false }
  31773. },
  31774. emits: ["update:modelValue"],
  31775. setup(__props, { emit }) {
  31776. const code = computed({
  31777. get() {
  31778. return __props.modelValue;
  31779. },
  31780. set(val) {
  31781. emit("update:modelValue", val);
  31782. }
  31783. });
  31784. return (_ctx, _cache) => {
  31785. return openBlock(), createBlock(unref(PrismEditor), {
  31786. modelValue: code.value,
  31787. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => code.value = $event),
  31788. "max-h-xl": "",
  31789. class: "form-design-editor",
  31790. highlight: (code2) => {
  31791. return unref(prismCore.exports.highlight)(code2, unref(prismCore.exports.languages)[__props.language]);
  31792. },
  31793. readonly: __props.readonly,
  31794. "line-numbers": ""
  31795. }, null, 8, ["modelValue", "highlight", "readonly"]);
  31796. };
  31797. }
  31798. });
  31799. var DesignForm_vue_vue_type_style_index_0_lang = "";
  31800. const _hoisted_1 = {
  31801. "h-full": "",
  31802. "bg-white": "",
  31803. flex: ""
  31804. };
  31805. const _hoisted_2 = {
  31806. "pt-2": "",
  31807. "w-62": ""
  31808. };
  31809. const _hoisted_3 = {
  31810. border: "0 x solid gray-200",
  31811. flex: "~ 1 col nowrap"
  31812. };
  31813. const _hoisted_4 = {
  31814. border: "0 b solid gray-200",
  31815. flex: "",
  31816. "gap-2": "",
  31817. "items-center": "",
  31818. "justify-end": "",
  31819. "h-11": "",
  31820. "py-0": "",
  31821. "px-2": ""
  31822. };
  31823. const _hoisted_5 = /* @__PURE__ */ createElementVNode("i", { class: "ep:edit" }, null, -1);
  31824. const _hoisted_6 = /* @__PURE__ */ createTextVNode("\u4FEE\u6539 ");
  31825. const _hoisted_7 = /* @__PURE__ */ createElementVNode("i", { class: "custom:clearable" }, null, -1);
  31826. const _hoisted_8 = /* @__PURE__ */ createTextVNode("\u6E05\u7A7A ");
  31827. const _hoisted_9 = /* @__PURE__ */ createElementVNode("i", { class: "custom:preview" }, null, -1);
  31828. const _hoisted_10 = /* @__PURE__ */ createTextVNode("\u9884\u89C8 ");
  31829. const _hoisted_11 = {
  31830. relative: "",
  31831. "w-75": "",
  31832. flex: "~ col"
  31833. };
  31834. const _hoisted_12 = {
  31835. border: "0 b-1 gray-200",
  31836. grid: "~ cols-2",
  31837. "min-h-11": "",
  31838. "px-2": ""
  31839. };
  31840. const _hoisted_13 = /* @__PURE__ */ createTextVNode(" \u590D\u5236 ");
  31841. const _hoisted_14 = /* @__PURE__ */ createTextVNode(" \u786E\u8BA4\u4FEE\u6539 ");
  31842. const __default__ = { name: "DesignForm" };
  31843. const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__), {
  31844. props: {
  31845. preview: {
  31846. type: Boolean,
  31847. default: true
  31848. },
  31849. generateJson: {
  31850. type: Boolean,
  31851. default: true
  31852. },
  31853. clearable: {
  31854. type: Boolean,
  31855. default: true
  31856. },
  31857. basicFieldsList: {
  31858. type: Array,
  31859. default: () => basicFields
  31860. },
  31861. advanceFieldsList: {
  31862. type: Array,
  31863. default: () => advanceFields
  31864. },
  31865. layoutFieldsList: {
  31866. type: Array,
  31867. default: () => layoutFields
  31868. },
  31869. request: {
  31870. type: Function
  31871. }
  31872. },
  31873. setup(__props, { expose }) {
  31874. let tab = ref(0);
  31875. let selectWidget = ref();
  31876. watch(() => selectWidget.value, (val) => {
  31877. tab.value = val ? 0 : 1;
  31878. });
  31879. let widgetForm = ref(getWidgetForm());
  31880. let generateJsonVisible = ref(false);
  31881. let generateJsonTemplate = ref(JSON.stringify(getWidgetForm(), null, 2));
  31882. const handleUploadJson = () => {
  31883. var _a2;
  31884. try {
  31885. widgetForm.value = JSON.parse(generateJsonTemplate.value);
  31886. selectWidget.value = (_a2 = widgetForm.value.list) == null ? void 0 : _a2[0];
  31887. generateJsonVisible.value = false;
  31888. ElMessage.success("\u4FEE\u6539\u6210\u529F");
  31889. } catch (error) {
  31890. ElMessage.error("\u4FEE\u6539\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5JSON\u683C\u5F0F\u662F\u5426\u6B63\u786E\u3002");
  31891. }
  31892. };
  31893. const handleGenerateJson = () => (generateJsonTemplate.value = JSON.stringify(widgetForm.value, null, 2)) && (generateJsonVisible.value = true);
  31894. const handleClearable = () => {
  31895. widgetForm.value = getWidgetForm();
  31896. selectWidget.value = void 0;
  31897. };
  31898. let dataVisible = ref(false);
  31899. const generateFormRef = ref(null);
  31900. const handleGetData = async () => {
  31901. var _a2;
  31902. dataVisible.value = !dataVisible.value;
  31903. if (!dataVisible.value)
  31904. return;
  31905. const res = await ((_a2 = generateFormRef.value) == null ? void 0 : _a2.getData());
  31906. generateJsonTemplate.value = JSON.stringify(res, null, 2);
  31907. };
  31908. const handleReset = () => {
  31909. var _a2;
  31910. return (_a2 = generateFormRef.value) == null ? void 0 : _a2.reset();
  31911. };
  31912. const handleCopyClick = (text) => {
  31913. navigator.clipboard.writeText(text);
  31914. ElMessage.success({ message: "Copy\u6210\u529F" });
  31915. };
  31916. const previewVisible = ref(false);
  31917. expose({
  31918. getJson: () => widgetForm.value,
  31919. setJson: (json) => {
  31920. var _a2;
  31921. widgetForm.value = json;
  31922. selectWidget.value = (_a2 = json.list) == null ? void 0 : _a2[0];
  31923. },
  31924. clear: handleClearable
  31925. });
  31926. return (_ctx, _cache) => {
  31927. const _component_el_button = ElButton;
  31928. const _component_el_dialog = ElDialog;
  31929. return openBlock(), createElementBlock("section", _hoisted_1, [
  31930. createElementVNode("aside", _hoisted_2, [
  31931. createVNode(_sfc_main$6, {
  31932. title: "\u57FA\u7840\u5B57\u6BB5",
  31933. fields: __props.basicFieldsList,
  31934. list: unref(basicComponents),
  31935. allList: widgetForm.value
  31936. }, null, 8, ["fields", "list", "allList"]),
  31937. createVNode(_sfc_main$6, {
  31938. title: "\u9AD8\u7EA7\u5B57\u6BB5",
  31939. fields: __props.advanceFieldsList,
  31940. list: unref(advanceComponents),
  31941. allList: widgetForm.value
  31942. }, null, 8, ["fields", "list", "allList"]),
  31943. createVNode(_sfc_main$6, {
  31944. title: "\u5E03\u5C40\u5B57\u6BB5",
  31945. fields: __props.layoutFieldsList,
  31946. list: unref(layoutComponents),
  31947. allList: widgetForm.value
  31948. }, null, 8, ["fields", "list", "allList"])
  31949. ]),
  31950. createElementVNode("main", _hoisted_3, [
  31951. createElementVNode("header", _hoisted_4, [
  31952. renderSlot(_ctx.$slots, "default"),
  31953. __props.generateJson ? (openBlock(), createBlock(_component_el_button, {
  31954. key: 0,
  31955. type: "text",
  31956. onClick: handleGenerateJson
  31957. }, {
  31958. icon: withCtx(() => [
  31959. _hoisted_5
  31960. ]),
  31961. default: withCtx(() => [
  31962. _hoisted_6
  31963. ]),
  31964. _: 1
  31965. })) : createCommentVNode("", true),
  31966. __props.clearable ? (openBlock(), createBlock(_component_el_button, {
  31967. key: 1,
  31968. type: "text",
  31969. onClick: handleClearable
  31970. }, {
  31971. icon: withCtx(() => [
  31972. _hoisted_7
  31973. ]),
  31974. default: withCtx(() => [
  31975. _hoisted_8
  31976. ]),
  31977. _: 1
  31978. })) : createCommentVNode("", true),
  31979. __props.preview ? (openBlock(), createBlock(_component_el_button, {
  31980. key: 2,
  31981. type: "text",
  31982. onClick: _cache[0] || (_cache[0] = ($event) => previewVisible.value = true)
  31983. }, {
  31984. icon: withCtx(() => [
  31985. _hoisted_9
  31986. ]),
  31987. default: withCtx(() => [
  31988. _hoisted_10
  31989. ]),
  31990. _: 1
  31991. })) : createCommentVNode("", true)
  31992. ]),
  31993. createVNode(_sfc_main$4, mergeProps({ ref: "widgetFormRef" }, widgetForm.value, {
  31994. selectWidget: selectWidget.value,
  31995. "onUpdate:selectWidget": _cache[1] || (_cache[1] = ($event) => selectWidget.value = $event)
  31996. }), null, 16, ["selectWidget"])
  31997. ]),
  31998. createElementVNode("aside", _hoisted_11, [
  31999. createElementVNode("header", _hoisted_12, [
  32000. createElementVNode("div", {
  32001. class: normalizeClass([{ active: !tab.value }, "config-tab"]),
  32002. onClick: _cache[2] || (_cache[2] = ($event) => tab.value = 0)
  32003. }, " \u5B57\u6BB5\u5C5E\u6027 ", 2),
  32004. createElementVNode("div", {
  32005. class: normalizeClass([{ active: tab.value }, "config-tab"]),
  32006. onClick: _cache[3] || (_cache[3] = ($event) => tab.value = 1)
  32007. }, " \u8868\u5355\u5C5E\u6027 ", 2)
  32008. ]),
  32009. withDirectives(createVNode(WidgetConfig, {
  32010. select: selectWidget.value,
  32011. "onUpdate:select": _cache[4] || (_cache[4] = ($event) => selectWidget.value = $event)
  32012. }, null, 8, ["select"]), [
  32013. [vShow, !tab.value]
  32014. ]),
  32015. withDirectives(createVNode(_sfc_main$2, {
  32016. config: widgetForm.value.config,
  32017. "onUpdate:config": _cache[5] || (_cache[5] = ($event) => widgetForm.value.config = $event)
  32018. }, null, 8, ["config"]), [
  32019. [vShow, tab.value]
  32020. ])
  32021. ]),
  32022. createVNode(_component_el_dialog, {
  32023. modelValue: previewVisible.value,
  32024. "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => previewVisible.value = $event),
  32025. "destroy-on-close": "",
  32026. title: "\u9884\u89C8",
  32027. "z-index": 2e3,
  32028. width: 800,
  32029. onClose: _cache[9] || (_cache[9] = ($event) => dataVisible.value = false)
  32030. }, {
  32031. footer: withCtx(() => [
  32032. createVNode(_component_el_button, {
  32033. onClick: _cache[7] || (_cache[7] = ($event) => dataVisible.value ? handleCopyClick(generateJsonTemplate.value) : handleReset())
  32034. }, {
  32035. default: withCtx(() => [
  32036. createTextVNode(toDisplayString(dataVisible.value ? "\u590D\u5236" : "\u91CD\u7F6E"), 1)
  32037. ]),
  32038. _: 1
  32039. }),
  32040. createVNode(_component_el_button, {
  32041. type: "primary",
  32042. onClick: handleGetData
  32043. }, {
  32044. default: withCtx(() => [
  32045. createTextVNode(toDisplayString(dataVisible.value ? "\u8FD4\u56DE\u9884\u89C8" : "\u83B7\u53D6\u6570\u636E"), 1)
  32046. ]),
  32047. _: 1
  32048. })
  32049. ]),
  32050. default: withCtx(() => [
  32051. withDirectives(createVNode(_sfc_main$1, {
  32052. modelValue: generateJsonTemplate.value,
  32053. "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => generateJsonTemplate.value = $event)
  32054. }, null, 8, ["modelValue"]), [
  32055. [vShow, dataVisible.value]
  32056. ]),
  32057. withDirectives(createVNode(GenerateForm, {
  32058. ref_key: "generateFormRef",
  32059. ref: generateFormRef,
  32060. request: __props.request,
  32061. data: widgetForm.value
  32062. }, null, 8, ["request", "data"]), [
  32063. [vShow, !dataVisible.value]
  32064. ])
  32065. ]),
  32066. _: 1
  32067. }, 8, ["modelValue"]),
  32068. createVNode(_component_el_dialog, {
  32069. modelValue: generateJsonVisible.value,
  32070. "onUpdate:modelValue": _cache[12] || (_cache[12] = ($event) => generateJsonVisible.value = $event),
  32071. "append-to-body": "",
  32072. title: "\u4FEE\u6539JSON",
  32073. "z-index": 2e4,
  32074. width: 800
  32075. }, {
  32076. footer: withCtx(() => [
  32077. createVNode(_component_el_button, {
  32078. onClick: _cache[11] || (_cache[11] = ($event) => handleCopyClick(generateJsonTemplate.value))
  32079. }, {
  32080. default: withCtx(() => [
  32081. _hoisted_13
  32082. ]),
  32083. _: 1
  32084. }),
  32085. createVNode(_component_el_button, {
  32086. type: "primary",
  32087. onClick: handleUploadJson
  32088. }, {
  32089. default: withCtx(() => [
  32090. _hoisted_14
  32091. ]),
  32092. _: 1
  32093. })
  32094. ]),
  32095. default: withCtx(() => [
  32096. createVNode(_sfc_main$1, {
  32097. modelValue: generateJsonTemplate.value,
  32098. "onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => generateJsonTemplate.value = $event)
  32099. }, null, 8, ["modelValue"])
  32100. ]),
  32101. _: 1
  32102. }, 8, ["modelValue"])
  32103. ]);
  32104. };
  32105. }
  32106. }));
  32107. export { _sfc_main as DesignForm, GenerateForm, advanceFields, basicFields, layoutFields };
  32108. //# sourceMappingURL=index.es.js.map