1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108 |
- import './index.css';
- var __defProp = Object.defineProperty;
- var __defProps = Object.defineProperties;
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
- var __hasOwnProp = Object.prototype.hasOwnProperty;
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
- var __spreadValues = (a2, b2) => {
- for (var prop in b2 || (b2 = {}))
- if (__hasOwnProp.call(b2, prop))
- __defNormalProp(a2, prop, b2[prop]);
- if (__getOwnPropSymbols)
- for (var prop of __getOwnPropSymbols(b2)) {
- if (__propIsEnum.call(b2, prop))
- __defNormalProp(a2, prop, b2[prop]);
- }
- return a2;
- };
- var __spreadProps = (a2, b2) => __defProps(a2, __getOwnPropDescs(b2));
- var __objRest = (source, exclude) => {
- var target = {};
- for (var prop in source)
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
- target[prop] = source[prop];
- if (source != null && __getOwnPropSymbols)
- for (var prop of __getOwnPropSymbols(source)) {
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
- target[prop] = source[prop];
- }
- return target;
- };
- 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";
- import { ElMessage } from "element-plus";
- import Draggable from "vuedraggable";
- var elMessage = "";
- const rules$1 = {
- trigger: "blur",
- enum: "",
- len: void 0,
- max: void 0,
- message: "",
- min: void 0,
- pattern: "",
- required: false,
- type: "any"
- };
- const getWidgetForm = () => ({
- list: [],
- config: {
- size: "default",
- hideRequiredAsterisk: false,
- labelWidth: 100,
- labelPosition: "right"
- }
- });
- const basicComponents = [
- {
- label: "\u5355\u884C\u6587\u672C",
- type: "input",
- options: {
- width: "100%",
- defaultValue: "",
- placeholder: "",
- maxlength: null,
- prefix: "",
- suffix: "",
- prepend: "",
- append: "",
- disabled: false,
- clearable: false,
- readonly: false,
- rules: rules$1
- }
- },
- {
- label: "\u5BC6\u7801\u6846",
- type: "password",
- options: {
- width: "100%",
- defaultValue: "",
- placeholder: "",
- maxlength: null,
- prefix: "",
- suffix: "",
- prepend: "",
- append: "",
- showPassword: true,
- disabled: false,
- clearable: false,
- readonly: false,
- rules: rules$1
- }
- },
- {
- label: "\u591A\u884C\u6587\u672C",
- type: "textarea",
- options: {
- width: "100%",
- defaultValue: "",
- placeholder: "",
- maxlength: null,
- rows: 4,
- autosize: false,
- showWordLimit: false,
- disabled: false,
- clearable: false,
- readonly: false,
- rules: rules$1
- }
- },
- {
- label: "\u8BA1\u6570\u5668",
- type: "number",
- options: {
- width: "",
- defaultValue: 0,
- min: 0,
- max: 100,
- step: 1,
- disabled: false,
- rules: rules$1
- }
- },
- {
- label: "\u5355\u9009\u6846\u7EC4",
- type: "radio",
- options: {
- defaultValue: "",
- width: "",
- inline: true,
- remote: false,
- showLabel: true,
- remoteFunc: "https://raw.githubusercontent.com/fuchengwei/vue-form-create/master/mock/mock.json",
- options: [
- {
- value: "Option 1",
- label: "Option 1"
- },
- {
- value: "Option 2",
- label: "Option 2"
- },
- {
- value: "Option 3",
- label: "Option 3"
- }
- ],
- remoteOptions: [],
- props: {
- value: "value",
- label: "label"
- },
- disabled: false,
- rules: rules$1
- }
- },
- {
- label: "\u591A\u9009\u6846\u7EC4",
- type: "checkbox",
- options: {
- defaultValue: [],
- width: "",
- inline: true,
- remote: false,
- showLabel: true,
- remoteFunc: "https://raw.githubusercontent.com/fuchengwei/vue-form-create/master/mock/mock.json",
- options: [
- {
- label: "Option 1",
- value: "Option 1"
- },
- {
- label: "Option 2",
- value: "Option 2"
- },
- {
- label: "Option 3",
- value: "Option 3"
- }
- ],
- remoteOptions: [],
- props: {
- value: "value",
- label: "label"
- },
- disabled: false,
- rules: rules$1
- }
- },
- {
- label: "\u65F6\u95F4\u9009\u62E9\u5668",
- type: "time",
- options: {
- defaultValue: "",
- width: "",
- placeholder: "\u8BF7\u9009\u62E9\u65F6\u95F4",
- format: "HH:mm:ss",
- valueFormat: "HH:mm:ss",
- readonly: false,
- editable: true,
- clearable: true,
- disabled: false,
- rules: rules$1
- }
- },
- {
- label: "\u65E5\u671F\u9009\u62E9\u5668",
- type: "date",
- options: {
- defaultValue: "",
- width: "",
- placeholder: "\u8BF7\u9009\u62E9\u65F6\u95F4",
- format: "YYYY-MM-DD",
- readonly: false,
- editable: true,
- clearable: true,
- disabled: false,
- rules: rules$1
- }
- },
- {
- label: "\u8BC4\u5206",
- type: "rate",
- options: {
- defaultValue: 0,
- max: 5,
- allowHalf: false,
- disabled: false,
- rules: rules$1
- }
- },
- {
- label: "\u4E0B\u62C9\u9009\u62E9\u6846",
- type: "select",
- options: {
- defaultValue: "",
- width: "200px",
- multiple: false,
- placeholder: "",
- remote: false,
- showLabel: true,
- filterable: false,
- clearable: false,
- disabled: false,
- props: {
- label: "label",
- value: "value"
- },
- options: [
- {
- label: "Option 1",
- value: "Option 1"
- },
- {
- label: "Option 2",
- value: "Option 2"
- },
- {
- label: "Option 3",
- value: "Option 3"
- }
- ],
- remoteOptions: [],
- remoteFunc: "https://raw.githubusercontent.com/fuchengwei/vue-form-create/master/mock/mock.json",
- rules: rules$1
- }
- },
- {
- label: "\u5F00\u5173",
- type: "switch",
- options: {
- defaultValue: false,
- disabled: false,
- activeText: "",
- inactiveText: "",
- rules: rules$1
- }
- },
- {
- label: "\u6ED1\u5757",
- type: "slider",
- options: {
- defaultValue: 0,
- width: "",
- min: 0,
- max: 100,
- step: 1,
- disabled: false,
- range: false,
- rules: rules$1
- }
- },
- {
- label: "\u6587\u5B57",
- type: "text",
- options: {
- defaultValue: "This is a text"
- }
- }
- ];
- const basicFields = basicComponents.map((i) => i.type);
- const advanceComponents = [
- {
- label: "\u56FE\u7247",
- type: "img-upload",
- options: {
- defaultValue: [],
- name: "file",
- action: "http://example.com/upload",
- method: "post",
- listType: "text",
- accept: "image/*",
- limit: 1,
- multiple: false,
- disabled: true,
- rules: rules$1
- }
- },
- {
- label: "\u4E0B\u8F7D",
- type: "download",
- labelWidth: "auto",
- options: {
- defaultValue: "",
- name: "file"
- }
- },
- {
- label: "\u7EA7\u8054\u9009\u62E9\u5668",
- type: "cascader",
- options: {
- defaultValue: [],
- width: "200px",
- placeholder: "",
- disabled: false,
- clearable: false,
- filterable: false,
- remote: true,
- remoteOptions: [],
- props: {
- label: "label",
- value: "value",
- children: "children"
- },
- remoteFunc: "https://raw.githubusercontent.com/fuchengwei/vue-form-create/master/mock/mock.json",
- rules: rules$1
- }
- }
- ];
- const advanceFields = advanceComponents.map((i) => i.type);
- const layoutComponents = [
- {
- label: "\u6805\u683C\u5E03\u5C40",
- type: "grid",
- columns: [
- {
- span: 12,
- list: []
- },
- {
- span: 12,
- list: []
- }
- ],
- options: {
- gutter: 0,
- align: "initial"
- }
- },
- {
- label: "\u6570\u636E\u8868\u683C",
- type: "table",
- columns: [
- { label: "\u540D\u79F0", prop: "name" },
- { label: "\u521B\u5EFA\u65F6\u95F4", prop: "createTime" }
- ],
- options: {
- defaultValue: [],
- disabled: false,
- size: "",
- align: "center"
- }
- },
- {
- label: "\u5206\u5272\u7EBF",
- type: "divider",
- options: {}
- }
- ];
- const layoutFields = layoutComponents.map((i) => i.type);
- var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
- var freeGlobal$1 = freeGlobal;
- var freeSelf = typeof self == "object" && self && self.Object === Object && self;
- var root = freeGlobal$1 || freeSelf || Function("return this")();
- var root$1 = root;
- var Symbol$1 = root$1.Symbol;
- var Symbol$2 = Symbol$1;
- var objectProto$e = Object.prototype;
- var hasOwnProperty$c = objectProto$e.hasOwnProperty;
- var nativeObjectToString$1 = objectProto$e.toString;
- var symToStringTag$1 = Symbol$2 ? Symbol$2.toStringTag : void 0;
- function getRawTag(value) {
- var isOwn = hasOwnProperty$c.call(value, symToStringTag$1), tag = value[symToStringTag$1];
- try {
- value[symToStringTag$1] = void 0;
- var unmasked = true;
- } catch (e) {
- }
- var result = nativeObjectToString$1.call(value);
- if (unmasked) {
- if (isOwn) {
- value[symToStringTag$1] = tag;
- } else {
- delete value[symToStringTag$1];
- }
- }
- return result;
- }
- var objectProto$d = Object.prototype;
- var nativeObjectToString = objectProto$d.toString;
- function objectToString$1(value) {
- return nativeObjectToString.call(value);
- }
- var nullTag = "[object Null]", undefinedTag = "[object Undefined]";
- var symToStringTag = Symbol$2 ? Symbol$2.toStringTag : void 0;
- function baseGetTag(value) {
- if (value == null) {
- return value === void 0 ? undefinedTag : nullTag;
- }
- return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString$1(value);
- }
- function isObjectLike(value) {
- return value != null && typeof value == "object";
- }
- var symbolTag$3 = "[object Symbol]";
- function isSymbol(value) {
- return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag$3;
- }
- function arrayMap(array4, iteratee) {
- var index = -1, length = array4 == null ? 0 : array4.length, result = Array(length);
- while (++index < length) {
- result[index] = iteratee(array4[index], index, array4);
- }
- return result;
- }
- var isArray$1 = Array.isArray;
- var isArray$2 = isArray$1;
- var INFINITY$3 = 1 / 0;
- var symbolProto$2 = Symbol$2 ? Symbol$2.prototype : void 0, symbolToString = symbolProto$2 ? symbolProto$2.toString : void 0;
- function baseToString(value) {
- if (typeof value == "string") {
- return value;
- }
- if (isArray$2(value)) {
- return arrayMap(value, baseToString) + "";
- }
- if (isSymbol(value)) {
- return symbolToString ? symbolToString.call(value) : "";
- }
- var result = value + "";
- return result == "0" && 1 / value == -INFINITY$3 ? "-0" : result;
- }
- var reWhitespace = /\s/;
- function trimmedEndIndex(string3) {
- var index = string3.length;
- while (index-- && reWhitespace.test(string3.charAt(index))) {
- }
- return index;
- }
- var reTrimStart = /^\s+/;
- function baseTrim(string3) {
- return string3 ? string3.slice(0, trimmedEndIndex(string3) + 1).replace(reTrimStart, "") : string3;
- }
- function isObject$2(value) {
- var type4 = typeof value;
- return value != null && (type4 == "object" || type4 == "function");
- }
- var NAN = 0 / 0;
- var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
- var reIsBinary = /^0b[01]+$/i;
- var reIsOctal = /^0o[0-7]+$/i;
- var freeParseInt = parseInt;
- function toNumber(value) {
- if (typeof value == "number") {
- return value;
- }
- if (isSymbol(value)) {
- return NAN;
- }
- if (isObject$2(value)) {
- var other = typeof value.valueOf == "function" ? value.valueOf() : value;
- value = isObject$2(other) ? other + "" : other;
- }
- if (typeof value != "string") {
- return value === 0 ? value : +value;
- }
- value = baseTrim(value);
- var isBinary = reIsBinary.test(value);
- return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
- }
- function identity(value) {
- return value;
- }
- var asyncTag = "[object AsyncFunction]", funcTag$2 = "[object Function]", genTag$1 = "[object GeneratorFunction]", proxyTag = "[object Proxy]";
- function isFunction$1(value) {
- if (!isObject$2(value)) {
- return false;
- }
- var tag = baseGetTag(value);
- return tag == funcTag$2 || tag == genTag$1 || tag == asyncTag || tag == proxyTag;
- }
- var coreJsData = root$1["__core-js_shared__"];
- var coreJsData$1 = coreJsData;
- var maskSrcKey = function() {
- var uid2 = /[^.]+$/.exec(coreJsData$1 && coreJsData$1.keys && coreJsData$1.keys.IE_PROTO || "");
- return uid2 ? "Symbol(src)_1." + uid2 : "";
- }();
- function isMasked(func) {
- return !!maskSrcKey && maskSrcKey in func;
- }
- var funcProto$1 = Function.prototype;
- var funcToString$1 = funcProto$1.toString;
- function toSource(func) {
- if (func != null) {
- try {
- return funcToString$1.call(func);
- } catch (e) {
- }
- try {
- return func + "";
- } catch (e) {
- }
- }
- return "";
- }
- var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
- var reIsHostCtor = /^\[object .+?Constructor\]$/;
- var funcProto = Function.prototype, objectProto$c = Object.prototype;
- var funcToString = funcProto.toString;
- var hasOwnProperty$b = objectProto$c.hasOwnProperty;
- var reIsNative = RegExp("^" + funcToString.call(hasOwnProperty$b).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$");
- function baseIsNative(value) {
- if (!isObject$2(value) || isMasked(value)) {
- return false;
- }
- var pattern4 = isFunction$1(value) ? reIsNative : reIsHostCtor;
- return pattern4.test(toSource(value));
- }
- function getValue$1(object4, key) {
- return object4 == null ? void 0 : object4[key];
- }
- function getNative(object4, key) {
- var value = getValue$1(object4, key);
- return baseIsNative(value) ? value : void 0;
- }
- var WeakMap = getNative(root$1, "WeakMap");
- var WeakMap$1 = WeakMap;
- var objectCreate = Object.create;
- var baseCreate = function() {
- function object4() {
- }
- return function(proto) {
- if (!isObject$2(proto)) {
- return {};
- }
- if (objectCreate) {
- return objectCreate(proto);
- }
- object4.prototype = proto;
- var result = new object4();
- object4.prototype = void 0;
- return result;
- };
- }();
- var baseCreate$1 = baseCreate;
- function apply(func, thisArg, args) {
- switch (args.length) {
- case 0:
- return func.call(thisArg);
- case 1:
- return func.call(thisArg, args[0]);
- case 2:
- return func.call(thisArg, args[0], args[1]);
- case 3:
- return func.call(thisArg, args[0], args[1], args[2]);
- }
- return func.apply(thisArg, args);
- }
- function noop$1() {
- }
- function copyArray(source, array4) {
- var index = -1, length = source.length;
- array4 || (array4 = Array(length));
- while (++index < length) {
- array4[index] = source[index];
- }
- return array4;
- }
- var HOT_COUNT = 800, HOT_SPAN = 16;
- var nativeNow = Date.now;
- function shortOut(func) {
- var count = 0, lastCalled = 0;
- return function() {
- var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled);
- lastCalled = stamp;
- if (remaining > 0) {
- if (++count >= HOT_COUNT) {
- return arguments[0];
- }
- } else {
- count = 0;
- }
- return func.apply(void 0, arguments);
- };
- }
- function constant(value) {
- return function() {
- return value;
- };
- }
- var defineProperty = function() {
- try {
- var func = getNative(Object, "defineProperty");
- func({}, "", {});
- return func;
- } catch (e) {
- }
- }();
- var defineProperty$1 = defineProperty;
- var baseSetToString = !defineProperty$1 ? identity : function(func, string3) {
- return defineProperty$1(func, "toString", {
- "configurable": true,
- "enumerable": false,
- "value": constant(string3),
- "writable": true
- });
- };
- var baseSetToString$1 = baseSetToString;
- var setToString = shortOut(baseSetToString$1);
- var setToString$1 = setToString;
- function arrayEach(array4, iteratee) {
- var index = -1, length = array4 == null ? 0 : array4.length;
- while (++index < length) {
- if (iteratee(array4[index], index, array4) === false) {
- break;
- }
- }
- return array4;
- }
- function baseFindIndex(array4, predicate, fromIndex, fromRight) {
- var length = array4.length, index = fromIndex + (fromRight ? 1 : -1);
- while (fromRight ? index-- : ++index < length) {
- if (predicate(array4[index], index, array4)) {
- return index;
- }
- }
- return -1;
- }
- function baseIsNaN(value) {
- return value !== value;
- }
- function strictIndexOf(array4, value, fromIndex) {
- var index = fromIndex - 1, length = array4.length;
- while (++index < length) {
- if (array4[index] === value) {
- return index;
- }
- }
- return -1;
- }
- function baseIndexOf(array4, value, fromIndex) {
- return value === value ? strictIndexOf(array4, value, fromIndex) : baseFindIndex(array4, baseIsNaN, fromIndex);
- }
- function arrayIncludes(array4, value) {
- var length = array4 == null ? 0 : array4.length;
- return !!length && baseIndexOf(array4, value, 0) > -1;
- }
- var MAX_SAFE_INTEGER$1 = 9007199254740991;
- var reIsUint = /^(?:0|[1-9]\d*)$/;
- function isIndex(value, length) {
- var type4 = typeof value;
- length = length == null ? MAX_SAFE_INTEGER$1 : length;
- return !!length && (type4 == "number" || type4 != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
- }
- function baseAssignValue(object4, key, value) {
- if (key == "__proto__" && defineProperty$1) {
- defineProperty$1(object4, key, {
- "configurable": true,
- "enumerable": true,
- "value": value,
- "writable": true
- });
- } else {
- object4[key] = value;
- }
- }
- function eq(value, other) {
- return value === other || value !== value && other !== other;
- }
- var objectProto$b = Object.prototype;
- var hasOwnProperty$a = objectProto$b.hasOwnProperty;
- function assignValue(object4, key, value) {
- var objValue = object4[key];
- if (!(hasOwnProperty$a.call(object4, key) && eq(objValue, value)) || value === void 0 && !(key in object4)) {
- baseAssignValue(object4, key, value);
- }
- }
- function copyObject(source, props, object4, customizer) {
- var isNew = !object4;
- object4 || (object4 = {});
- var index = -1, length = props.length;
- while (++index < length) {
- var key = props[index];
- var newValue = customizer ? customizer(object4[key], source[key], key, object4, source) : void 0;
- if (newValue === void 0) {
- newValue = source[key];
- }
- if (isNew) {
- baseAssignValue(object4, key, newValue);
- } else {
- assignValue(object4, key, newValue);
- }
- }
- return object4;
- }
- var nativeMax$1 = Math.max;
- function overRest(func, start2, transform) {
- start2 = nativeMax$1(start2 === void 0 ? func.length - 1 : start2, 0);
- return function() {
- var args = arguments, index = -1, length = nativeMax$1(args.length - start2, 0), array4 = Array(length);
- while (++index < length) {
- array4[index] = args[start2 + index];
- }
- index = -1;
- var otherArgs = Array(start2 + 1);
- while (++index < start2) {
- otherArgs[index] = args[index];
- }
- otherArgs[start2] = transform(array4);
- return apply(func, this, otherArgs);
- };
- }
- function baseRest(func, start2) {
- return setToString$1(overRest(func, start2, identity), func + "");
- }
- var MAX_SAFE_INTEGER = 9007199254740991;
- function isLength(value) {
- return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
- }
- function isArrayLike(value) {
- return value != null && isLength(value.length) && !isFunction$1(value);
- }
- var objectProto$a = Object.prototype;
- function isPrototype(value) {
- var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto$a;
- return value === proto;
- }
- function baseTimes(n, iteratee) {
- var index = -1, result = Array(n);
- while (++index < n) {
- result[index] = iteratee(index);
- }
- return result;
- }
- var argsTag$3 = "[object Arguments]";
- function baseIsArguments(value) {
- return isObjectLike(value) && baseGetTag(value) == argsTag$3;
- }
- var objectProto$9 = Object.prototype;
- var hasOwnProperty$9 = objectProto$9.hasOwnProperty;
- var propertyIsEnumerable$1 = objectProto$9.propertyIsEnumerable;
- var isArguments = baseIsArguments(function() {
- return arguments;
- }()) ? baseIsArguments : function(value) {
- return isObjectLike(value) && hasOwnProperty$9.call(value, "callee") && !propertyIsEnumerable$1.call(value, "callee");
- };
- var isArguments$1 = isArguments;
- function stubFalse() {
- return false;
- }
- var freeExports$2 = typeof exports == "object" && exports && !exports.nodeType && exports;
- var freeModule$2 = freeExports$2 && typeof module == "object" && module && !module.nodeType && module;
- var moduleExports$2 = freeModule$2 && freeModule$2.exports === freeExports$2;
- var Buffer$1 = moduleExports$2 ? root$1.Buffer : void 0;
- var nativeIsBuffer = Buffer$1 ? Buffer$1.isBuffer : void 0;
- var isBuffer = nativeIsBuffer || stubFalse;
- var isBuffer$1 = isBuffer;
- 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]";
- 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]";
- var typedArrayTags = {};
- 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;
- 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;
- function baseIsTypedArray(value) {
- return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
- }
- function baseUnary(func) {
- return function(value) {
- return func(value);
- };
- }
- var freeExports$1 = typeof exports == "object" && exports && !exports.nodeType && exports;
- var freeModule$1 = freeExports$1 && typeof module == "object" && module && !module.nodeType && module;
- var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1;
- var freeProcess = moduleExports$1 && freeGlobal$1.process;
- var nodeUtil = function() {
- try {
- var types2 = freeModule$1 && freeModule$1.require && freeModule$1.require("util").types;
- if (types2) {
- return types2;
- }
- return freeProcess && freeProcess.binding && freeProcess.binding("util");
- } catch (e) {
- }
- }();
- var nodeUtil$1 = nodeUtil;
- var nodeIsTypedArray = nodeUtil$1 && nodeUtil$1.isTypedArray;
- var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
- var isTypedArray$1 = isTypedArray;
- var objectProto$8 = Object.prototype;
- var hasOwnProperty$8 = objectProto$8.hasOwnProperty;
- function arrayLikeKeys(value, inherited) {
- 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;
- for (var key in value) {
- 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)))) {
- result.push(key);
- }
- }
- return result;
- }
- function overArg(func, transform) {
- return function(arg) {
- return func(transform(arg));
- };
- }
- var nativeKeys = overArg(Object.keys, Object);
- var nativeKeys$1 = nativeKeys;
- var objectProto$7 = Object.prototype;
- var hasOwnProperty$7 = objectProto$7.hasOwnProperty;
- function baseKeys(object4) {
- if (!isPrototype(object4)) {
- return nativeKeys$1(object4);
- }
- var result = [];
- for (var key in Object(object4)) {
- if (hasOwnProperty$7.call(object4, key) && key != "constructor") {
- result.push(key);
- }
- }
- return result;
- }
- function keys(object4) {
- return isArrayLike(object4) ? arrayLikeKeys(object4) : baseKeys(object4);
- }
- function nativeKeysIn(object4) {
- var result = [];
- if (object4 != null) {
- for (var key in Object(object4)) {
- result.push(key);
- }
- }
- return result;
- }
- var objectProto$6 = Object.prototype;
- var hasOwnProperty$6 = objectProto$6.hasOwnProperty;
- function baseKeysIn(object4) {
- if (!isObject$2(object4)) {
- return nativeKeysIn(object4);
- }
- var isProto = isPrototype(object4), result = [];
- for (var key in object4) {
- if (!(key == "constructor" && (isProto || !hasOwnProperty$6.call(object4, key)))) {
- result.push(key);
- }
- }
- return result;
- }
- function keysIn(object4) {
- return isArrayLike(object4) ? arrayLikeKeys(object4, true) : baseKeysIn(object4);
- }
- var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/;
- function isKey(value, object4) {
- if (isArray$2(value)) {
- return false;
- }
- var type4 = typeof value;
- if (type4 == "number" || type4 == "symbol" || type4 == "boolean" || value == null || isSymbol(value)) {
- return true;
- }
- return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object4 != null && value in Object(object4);
- }
- var nativeCreate = getNative(Object, "create");
- var nativeCreate$1 = nativeCreate;
- function hashClear() {
- this.__data__ = nativeCreate$1 ? nativeCreate$1(null) : {};
- this.size = 0;
- }
- function hashDelete(key) {
- var result = this.has(key) && delete this.__data__[key];
- this.size -= result ? 1 : 0;
- return result;
- }
- var HASH_UNDEFINED$2 = "__lodash_hash_undefined__";
- var objectProto$5 = Object.prototype;
- var hasOwnProperty$5 = objectProto$5.hasOwnProperty;
- function hashGet(key) {
- var data2 = this.__data__;
- if (nativeCreate$1) {
- var result = data2[key];
- return result === HASH_UNDEFINED$2 ? void 0 : result;
- }
- return hasOwnProperty$5.call(data2, key) ? data2[key] : void 0;
- }
- var objectProto$4 = Object.prototype;
- var hasOwnProperty$4 = objectProto$4.hasOwnProperty;
- function hashHas(key) {
- var data2 = this.__data__;
- return nativeCreate$1 ? data2[key] !== void 0 : hasOwnProperty$4.call(data2, key);
- }
- var HASH_UNDEFINED$1 = "__lodash_hash_undefined__";
- function hashSet(key, value) {
- var data2 = this.__data__;
- this.size += this.has(key) ? 0 : 1;
- data2[key] = nativeCreate$1 && value === void 0 ? HASH_UNDEFINED$1 : value;
- return this;
- }
- function Hash(entries) {
- var index = -1, length = entries == null ? 0 : entries.length;
- this.clear();
- while (++index < length) {
- var entry = entries[index];
- this.set(entry[0], entry[1]);
- }
- }
- Hash.prototype.clear = hashClear;
- Hash.prototype["delete"] = hashDelete;
- Hash.prototype.get = hashGet;
- Hash.prototype.has = hashHas;
- Hash.prototype.set = hashSet;
- function listCacheClear() {
- this.__data__ = [];
- this.size = 0;
- }
- function assocIndexOf(array4, key) {
- var length = array4.length;
- while (length--) {
- if (eq(array4[length][0], key)) {
- return length;
- }
- }
- return -1;
- }
- var arrayProto = Array.prototype;
- var splice = arrayProto.splice;
- function listCacheDelete(key) {
- var data2 = this.__data__, index = assocIndexOf(data2, key);
- if (index < 0) {
- return false;
- }
- var lastIndex = data2.length - 1;
- if (index == lastIndex) {
- data2.pop();
- } else {
- splice.call(data2, index, 1);
- }
- --this.size;
- return true;
- }
- function listCacheGet(key) {
- var data2 = this.__data__, index = assocIndexOf(data2, key);
- return index < 0 ? void 0 : data2[index][1];
- }
- function listCacheHas(key) {
- return assocIndexOf(this.__data__, key) > -1;
- }
- function listCacheSet(key, value) {
- var data2 = this.__data__, index = assocIndexOf(data2, key);
- if (index < 0) {
- ++this.size;
- data2.push([key, value]);
- } else {
- data2[index][1] = value;
- }
- return this;
- }
- function ListCache(entries) {
- var index = -1, length = entries == null ? 0 : entries.length;
- this.clear();
- while (++index < length) {
- var entry = entries[index];
- this.set(entry[0], entry[1]);
- }
- }
- ListCache.prototype.clear = listCacheClear;
- ListCache.prototype["delete"] = listCacheDelete;
- ListCache.prototype.get = listCacheGet;
- ListCache.prototype.has = listCacheHas;
- ListCache.prototype.set = listCacheSet;
- var Map$1 = getNative(root$1, "Map");
- var Map$2 = Map$1;
- function mapCacheClear() {
- this.size = 0;
- this.__data__ = {
- "hash": new Hash(),
- "map": new (Map$2 || ListCache)(),
- "string": new Hash()
- };
- }
- function isKeyable(value) {
- var type4 = typeof value;
- return type4 == "string" || type4 == "number" || type4 == "symbol" || type4 == "boolean" ? value !== "__proto__" : value === null;
- }
- function getMapData(map, key) {
- var data2 = map.__data__;
- return isKeyable(key) ? data2[typeof key == "string" ? "string" : "hash"] : data2.map;
- }
- function mapCacheDelete(key) {
- var result = getMapData(this, key)["delete"](key);
- this.size -= result ? 1 : 0;
- return result;
- }
- function mapCacheGet(key) {
- return getMapData(this, key).get(key);
- }
- function mapCacheHas(key) {
- return getMapData(this, key).has(key);
- }
- function mapCacheSet(key, value) {
- var data2 = getMapData(this, key), size = data2.size;
- data2.set(key, value);
- this.size += data2.size == size ? 0 : 1;
- return this;
- }
- function MapCache(entries) {
- var index = -1, length = entries == null ? 0 : entries.length;
- this.clear();
- while (++index < length) {
- var entry = entries[index];
- this.set(entry[0], entry[1]);
- }
- }
- MapCache.prototype.clear = mapCacheClear;
- MapCache.prototype["delete"] = mapCacheDelete;
- MapCache.prototype.get = mapCacheGet;
- MapCache.prototype.has = mapCacheHas;
- MapCache.prototype.set = mapCacheSet;
- var FUNC_ERROR_TEXT$2 = "Expected a function";
- function memoize(func, resolver) {
- if (typeof func != "function" || resolver != null && typeof resolver != "function") {
- throw new TypeError(FUNC_ERROR_TEXT$2);
- }
- var memoized = function() {
- var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
- if (cache.has(key)) {
- return cache.get(key);
- }
- var result = func.apply(this, args);
- memoized.cache = cache.set(key, result) || cache;
- return result;
- };
- memoized.cache = new (memoize.Cache || MapCache)();
- return memoized;
- }
- memoize.Cache = MapCache;
- var MAX_MEMOIZE_SIZE = 500;
- function memoizeCapped(func) {
- var result = memoize(func, function(key) {
- if (cache.size === MAX_MEMOIZE_SIZE) {
- cache.clear();
- }
- return key;
- });
- var cache = result.cache;
- return result;
- }
- var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
- var reEscapeChar = /\\(\\)?/g;
- var stringToPath = memoizeCapped(function(string3) {
- var result = [];
- if (string3.charCodeAt(0) === 46) {
- result.push("");
- }
- string3.replace(rePropName, function(match, number4, quote, subString) {
- result.push(quote ? subString.replace(reEscapeChar, "$1") : number4 || match);
- });
- return result;
- });
- var stringToPath$1 = stringToPath;
- function toString(value) {
- return value == null ? "" : baseToString(value);
- }
- function castPath(value, object4) {
- if (isArray$2(value)) {
- return value;
- }
- return isKey(value, object4) ? [value] : stringToPath$1(toString(value));
- }
- var INFINITY$2 = 1 / 0;
- function toKey(value) {
- if (typeof value == "string" || isSymbol(value)) {
- return value;
- }
- var result = value + "";
- return result == "0" && 1 / value == -INFINITY$2 ? "-0" : result;
- }
- function baseGet(object4, path) {
- path = castPath(path, object4);
- var index = 0, length = path.length;
- while (object4 != null && index < length) {
- object4 = object4[toKey(path[index++])];
- }
- return index && index == length ? object4 : void 0;
- }
- function get(object4, path, defaultValue) {
- var result = object4 == null ? void 0 : baseGet(object4, path);
- return result === void 0 ? defaultValue : result;
- }
- function arrayPush(array4, values) {
- var index = -1, length = values.length, offset2 = array4.length;
- while (++index < length) {
- array4[offset2 + index] = values[index];
- }
- return array4;
- }
- var spreadableSymbol = Symbol$2 ? Symbol$2.isConcatSpreadable : void 0;
- function isFlattenable(value) {
- return isArray$2(value) || isArguments$1(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
- }
- function baseFlatten(array4, depth, predicate, isStrict, result) {
- var index = -1, length = array4.length;
- predicate || (predicate = isFlattenable);
- result || (result = []);
- while (++index < length) {
- var value = array4[index];
- if (depth > 0 && predicate(value)) {
- if (depth > 1) {
- baseFlatten(value, depth - 1, predicate, isStrict, result);
- } else {
- arrayPush(result, value);
- }
- } else if (!isStrict) {
- result[result.length] = value;
- }
- }
- return result;
- }
- var getPrototype = overArg(Object.getPrototypeOf, Object);
- var getPrototype$1 = getPrototype;
- function castArray$1() {
- if (!arguments.length) {
- return [];
- }
- var value = arguments[0];
- return isArray$2(value) ? value : [value];
- }
- function stackClear() {
- this.__data__ = new ListCache();
- this.size = 0;
- }
- function stackDelete(key) {
- var data2 = this.__data__, result = data2["delete"](key);
- this.size = data2.size;
- return result;
- }
- function stackGet(key) {
- return this.__data__.get(key);
- }
- function stackHas(key) {
- return this.__data__.has(key);
- }
- var LARGE_ARRAY_SIZE$1 = 200;
- function stackSet(key, value) {
- var data2 = this.__data__;
- if (data2 instanceof ListCache) {
- var pairs = data2.__data__;
- if (!Map$2 || pairs.length < LARGE_ARRAY_SIZE$1 - 1) {
- pairs.push([key, value]);
- this.size = ++data2.size;
- return this;
- }
- data2 = this.__data__ = new MapCache(pairs);
- }
- data2.set(key, value);
- this.size = data2.size;
- return this;
- }
- function Stack(entries) {
- var data2 = this.__data__ = new ListCache(entries);
- this.size = data2.size;
- }
- Stack.prototype.clear = stackClear;
- Stack.prototype["delete"] = stackDelete;
- Stack.prototype.get = stackGet;
- Stack.prototype.has = stackHas;
- Stack.prototype.set = stackSet;
- function baseAssign(object4, source) {
- return object4 && copyObject(source, keys(source), object4);
- }
- function baseAssignIn(object4, source) {
- return object4 && copyObject(source, keysIn(source), object4);
- }
- var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
- var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
- var moduleExports = freeModule && freeModule.exports === freeExports;
- var Buffer2 = moduleExports ? root$1.Buffer : void 0, allocUnsafe = Buffer2 ? Buffer2.allocUnsafe : void 0;
- function cloneBuffer(buffer, isDeep) {
- if (isDeep) {
- return buffer.slice();
- }
- var length = buffer.length, result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
- buffer.copy(result);
- return result;
- }
- function arrayFilter(array4, predicate) {
- var index = -1, length = array4 == null ? 0 : array4.length, resIndex = 0, result = [];
- while (++index < length) {
- var value = array4[index];
- if (predicate(value, index, array4)) {
- result[resIndex++] = value;
- }
- }
- return result;
- }
- function stubArray() {
- return [];
- }
- var objectProto$3 = Object.prototype;
- var propertyIsEnumerable = objectProto$3.propertyIsEnumerable;
- var nativeGetSymbols$1 = Object.getOwnPropertySymbols;
- var getSymbols = !nativeGetSymbols$1 ? stubArray : function(object4) {
- if (object4 == null) {
- return [];
- }
- object4 = Object(object4);
- return arrayFilter(nativeGetSymbols$1(object4), function(symbol) {
- return propertyIsEnumerable.call(object4, symbol);
- });
- };
- var getSymbols$1 = getSymbols;
- function copySymbols(source, object4) {
- return copyObject(source, getSymbols$1(source), object4);
- }
- var nativeGetSymbols = Object.getOwnPropertySymbols;
- var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object4) {
- var result = [];
- while (object4) {
- arrayPush(result, getSymbols$1(object4));
- object4 = getPrototype$1(object4);
- }
- return result;
- };
- var getSymbolsIn$1 = getSymbolsIn;
- function copySymbolsIn(source, object4) {
- return copyObject(source, getSymbolsIn$1(source), object4);
- }
- function baseGetAllKeys(object4, keysFunc, symbolsFunc) {
- var result = keysFunc(object4);
- return isArray$2(object4) ? result : arrayPush(result, symbolsFunc(object4));
- }
- function getAllKeys(object4) {
- return baseGetAllKeys(object4, keys, getSymbols$1);
- }
- function getAllKeysIn(object4) {
- return baseGetAllKeys(object4, keysIn, getSymbolsIn$1);
- }
- var DataView = getNative(root$1, "DataView");
- var DataView$1 = DataView;
- var Promise$1 = getNative(root$1, "Promise");
- var Promise$2 = Promise$1;
- var Set$1 = getNative(root$1, "Set");
- var Set$2 = Set$1;
- var mapTag$4 = "[object Map]", objectTag$2 = "[object Object]", promiseTag = "[object Promise]", setTag$4 = "[object Set]", weakMapTag$1 = "[object WeakMap]";
- var dataViewTag$3 = "[object DataView]";
- var dataViewCtorString = toSource(DataView$1), mapCtorString = toSource(Map$2), promiseCtorString = toSource(Promise$2), setCtorString = toSource(Set$2), weakMapCtorString = toSource(WeakMap$1);
- var getTag = baseGetTag;
- 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) {
- getTag = function(value) {
- var result = baseGetTag(value), Ctor = result == objectTag$2 ? value.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : "";
- if (ctorString) {
- switch (ctorString) {
- case dataViewCtorString:
- return dataViewTag$3;
- case mapCtorString:
- return mapTag$4;
- case promiseCtorString:
- return promiseTag;
- case setCtorString:
- return setTag$4;
- case weakMapCtorString:
- return weakMapTag$1;
- }
- }
- return result;
- };
- }
- var getTag$1 = getTag;
- var objectProto$2 = Object.prototype;
- var hasOwnProperty$3 = objectProto$2.hasOwnProperty;
- function initCloneArray(array4) {
- var length = array4.length, result = new array4.constructor(length);
- if (length && typeof array4[0] == "string" && hasOwnProperty$3.call(array4, "index")) {
- result.index = array4.index;
- result.input = array4.input;
- }
- return result;
- }
- var Uint8Array2 = root$1.Uint8Array;
- var Uint8Array$1 = Uint8Array2;
- function cloneArrayBuffer(arrayBuffer) {
- var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
- new Uint8Array$1(result).set(new Uint8Array$1(arrayBuffer));
- return result;
- }
- function cloneDataView(dataView, isDeep) {
- var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
- return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
- }
- var reFlags = /\w*$/;
- function cloneRegExp(regexp4) {
- var result = new regexp4.constructor(regexp4.source, reFlags.exec(regexp4));
- result.lastIndex = regexp4.lastIndex;
- return result;
- }
- var symbolProto$1 = Symbol$2 ? Symbol$2.prototype : void 0, symbolValueOf$1 = symbolProto$1 ? symbolProto$1.valueOf : void 0;
- function cloneSymbol(symbol) {
- return symbolValueOf$1 ? Object(symbolValueOf$1.call(symbol)) : {};
- }
- function cloneTypedArray(typedArray, isDeep) {
- var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
- return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
- }
- 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]";
- 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]";
- function initCloneByTag(object4, tag, isDeep) {
- var Ctor = object4.constructor;
- switch (tag) {
- case arrayBufferTag$2:
- return cloneArrayBuffer(object4);
- case boolTag$2:
- case dateTag$2:
- return new Ctor(+object4);
- case dataViewTag$2:
- return cloneDataView(object4, isDeep);
- case float32Tag$1:
- case float64Tag$1:
- case int8Tag$1:
- case int16Tag$1:
- case int32Tag$1:
- case uint8Tag$1:
- case uint8ClampedTag$1:
- case uint16Tag$1:
- case uint32Tag$1:
- return cloneTypedArray(object4, isDeep);
- case mapTag$3:
- return new Ctor();
- case numberTag$2:
- case stringTag$2:
- return new Ctor(object4);
- case regexpTag$2:
- return cloneRegExp(object4);
- case setTag$3:
- return new Ctor();
- case symbolTag$2:
- return cloneSymbol(object4);
- }
- }
- function initCloneObject(object4) {
- return typeof object4.constructor == "function" && !isPrototype(object4) ? baseCreate$1(getPrototype$1(object4)) : {};
- }
- var mapTag$2 = "[object Map]";
- function baseIsMap(value) {
- return isObjectLike(value) && getTag$1(value) == mapTag$2;
- }
- var nodeIsMap = nodeUtil$1 && nodeUtil$1.isMap;
- var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
- var isMap$1 = isMap;
- var setTag$2 = "[object Set]";
- function baseIsSet(value) {
- return isObjectLike(value) && getTag$1(value) == setTag$2;
- }
- var nodeIsSet = nodeUtil$1 && nodeUtil$1.isSet;
- var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
- var isSet$1 = isSet;
- var CLONE_DEEP_FLAG$1 = 1, CLONE_FLAT_FLAG = 2, CLONE_SYMBOLS_FLAG$2 = 4;
- 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]";
- 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]";
- var cloneableTags = {};
- 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;
- cloneableTags[errorTag$1] = cloneableTags[funcTag] = cloneableTags[weakMapTag] = false;
- function baseClone(value, bitmask, customizer, key, object4, stack) {
- var result, isDeep = bitmask & CLONE_DEEP_FLAG$1, isFlat = bitmask & CLONE_FLAT_FLAG, isFull = bitmask & CLONE_SYMBOLS_FLAG$2;
- if (customizer) {
- result = object4 ? customizer(value, key, object4, stack) : customizer(value);
- }
- if (result !== void 0) {
- return result;
- }
- if (!isObject$2(value)) {
- return value;
- }
- var isArr = isArray$2(value);
- if (isArr) {
- result = initCloneArray(value);
- if (!isDeep) {
- return copyArray(value, result);
- }
- } else {
- var tag = getTag$1(value), isFunc = tag == funcTag || tag == genTag;
- if (isBuffer$1(value)) {
- return cloneBuffer(value, isDeep);
- }
- if (tag == objectTag$1 || tag == argsTag$1 || isFunc && !object4) {
- result = isFlat || isFunc ? {} : initCloneObject(value);
- if (!isDeep) {
- return isFlat ? copySymbolsIn(value, baseAssignIn(result, value)) : copySymbols(value, baseAssign(result, value));
- }
- } else {
- if (!cloneableTags[tag]) {
- return object4 ? value : {};
- }
- result = initCloneByTag(value, tag, isDeep);
- }
- }
- stack || (stack = new Stack());
- var stacked = stack.get(value);
- if (stacked) {
- return stacked;
- }
- stack.set(value, result);
- if (isSet$1(value)) {
- value.forEach(function(subValue) {
- result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
- });
- } else if (isMap$1(value)) {
- value.forEach(function(subValue, key2) {
- result.set(key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
- });
- }
- var keysFunc = isFull ? isFlat ? getAllKeysIn : getAllKeys : isFlat ? keysIn : keys;
- var props = isArr ? void 0 : keysFunc(value);
- arrayEach(props || value, function(subValue, key2) {
- if (props) {
- key2 = subValue;
- subValue = value[key2];
- }
- assignValue(result, key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
- });
- return result;
- }
- var CLONE_SYMBOLS_FLAG$1 = 4;
- function clone(value) {
- return baseClone(value, CLONE_SYMBOLS_FLAG$1);
- }
- var CLONE_DEEP_FLAG = 1, CLONE_SYMBOLS_FLAG = 4;
- function cloneDeep(value) {
- return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
- }
- var HASH_UNDEFINED = "__lodash_hash_undefined__";
- function setCacheAdd(value) {
- this.__data__.set(value, HASH_UNDEFINED);
- return this;
- }
- function setCacheHas(value) {
- return this.__data__.has(value);
- }
- function SetCache(values) {
- var index = -1, length = values == null ? 0 : values.length;
- this.__data__ = new MapCache();
- while (++index < length) {
- this.add(values[index]);
- }
- }
- SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
- SetCache.prototype.has = setCacheHas;
- function arraySome(array4, predicate) {
- var index = -1, length = array4 == null ? 0 : array4.length;
- while (++index < length) {
- if (predicate(array4[index], index, array4)) {
- return true;
- }
- }
- return false;
- }
- function cacheHas(cache, key) {
- return cache.has(key);
- }
- var COMPARE_PARTIAL_FLAG$3 = 1, COMPARE_UNORDERED_FLAG$1 = 2;
- function equalArrays(array4, other, bitmask, customizer, equalFunc, stack) {
- var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3, arrLength = array4.length, othLength = other.length;
- if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
- return false;
- }
- var arrStacked = stack.get(array4);
- var othStacked = stack.get(other);
- if (arrStacked && othStacked) {
- return arrStacked == other && othStacked == array4;
- }
- var index = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG$1 ? new SetCache() : void 0;
- stack.set(array4, other);
- stack.set(other, array4);
- while (++index < arrLength) {
- var arrValue = array4[index], othValue = other[index];
- if (customizer) {
- var compared = isPartial ? customizer(othValue, arrValue, index, other, array4, stack) : customizer(arrValue, othValue, index, array4, other, stack);
- }
- if (compared !== void 0) {
- if (compared) {
- continue;
- }
- result = false;
- break;
- }
- if (seen) {
- if (!arraySome(other, function(othValue2, othIndex) {
- if (!cacheHas(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
- return seen.push(othIndex);
- }
- })) {
- result = false;
- break;
- }
- } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
- result = false;
- break;
- }
- }
- stack["delete"](array4);
- stack["delete"](other);
- return result;
- }
- function mapToArray(map) {
- var index = -1, result = Array(map.size);
- map.forEach(function(value, key) {
- result[++index] = [key, value];
- });
- return result;
- }
- function setToArray(set2) {
- var index = -1, result = Array(set2.size);
- set2.forEach(function(value) {
- result[++index] = value;
- });
- return result;
- }
- var COMPARE_PARTIAL_FLAG$2 = 1, COMPARE_UNORDERED_FLAG = 2;
- 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]";
- var arrayBufferTag = "[object ArrayBuffer]", dataViewTag = "[object DataView]";
- var symbolProto = Symbol$2 ? Symbol$2.prototype : void 0, symbolValueOf = symbolProto ? symbolProto.valueOf : void 0;
- function equalByTag(object4, other, tag, bitmask, customizer, equalFunc, stack) {
- switch (tag) {
- case dataViewTag:
- if (object4.byteLength != other.byteLength || object4.byteOffset != other.byteOffset) {
- return false;
- }
- object4 = object4.buffer;
- other = other.buffer;
- case arrayBufferTag:
- if (object4.byteLength != other.byteLength || !equalFunc(new Uint8Array$1(object4), new Uint8Array$1(other))) {
- return false;
- }
- return true;
- case boolTag:
- case dateTag:
- case numberTag:
- return eq(+object4, +other);
- case errorTag:
- return object4.name == other.name && object4.message == other.message;
- case regexpTag:
- case stringTag:
- return object4 == other + "";
- case mapTag:
- var convert = mapToArray;
- case setTag:
- var isPartial = bitmask & COMPARE_PARTIAL_FLAG$2;
- convert || (convert = setToArray);
- if (object4.size != other.size && !isPartial) {
- return false;
- }
- var stacked = stack.get(object4);
- if (stacked) {
- return stacked == other;
- }
- bitmask |= COMPARE_UNORDERED_FLAG;
- stack.set(object4, other);
- var result = equalArrays(convert(object4), convert(other), bitmask, customizer, equalFunc, stack);
- stack["delete"](object4);
- return result;
- case symbolTag:
- if (symbolValueOf) {
- return symbolValueOf.call(object4) == symbolValueOf.call(other);
- }
- }
- return false;
- }
- var COMPARE_PARTIAL_FLAG$1 = 1;
- var objectProto$1 = Object.prototype;
- var hasOwnProperty$2 = objectProto$1.hasOwnProperty;
- function equalObjects(object4, other, bitmask, customizer, equalFunc, stack) {
- var isPartial = bitmask & COMPARE_PARTIAL_FLAG$1, objProps = getAllKeys(object4), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length;
- if (objLength != othLength && !isPartial) {
- return false;
- }
- var index = objLength;
- while (index--) {
- var key = objProps[index];
- if (!(isPartial ? key in other : hasOwnProperty$2.call(other, key))) {
- return false;
- }
- }
- var objStacked = stack.get(object4);
- var othStacked = stack.get(other);
- if (objStacked && othStacked) {
- return objStacked == other && othStacked == object4;
- }
- var result = true;
- stack.set(object4, other);
- stack.set(other, object4);
- var skipCtor = isPartial;
- while (++index < objLength) {
- key = objProps[index];
- var objValue = object4[key], othValue = other[key];
- if (customizer) {
- var compared = isPartial ? customizer(othValue, objValue, key, other, object4, stack) : customizer(objValue, othValue, key, object4, other, stack);
- }
- if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
- result = false;
- break;
- }
- skipCtor || (skipCtor = key == "constructor");
- }
- if (result && !skipCtor) {
- var objCtor = object4.constructor, othCtor = other.constructor;
- if (objCtor != othCtor && ("constructor" in object4 && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
- result = false;
- }
- }
- stack["delete"](object4);
- stack["delete"](other);
- return result;
- }
- var COMPARE_PARTIAL_FLAG = 1;
- var argsTag = "[object Arguments]", arrayTag = "[object Array]", objectTag = "[object Object]";
- var objectProto = Object.prototype;
- var hasOwnProperty$1 = objectProto.hasOwnProperty;
- function baseIsEqualDeep(object4, other, bitmask, customizer, equalFunc, stack) {
- var objIsArr = isArray$2(object4), othIsArr = isArray$2(other), objTag = objIsArr ? arrayTag : getTag$1(object4), othTag = othIsArr ? arrayTag : getTag$1(other);
- objTag = objTag == argsTag ? objectTag : objTag;
- othTag = othTag == argsTag ? objectTag : othTag;
- var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag;
- if (isSameTag && isBuffer$1(object4)) {
- if (!isBuffer$1(other)) {
- return false;
- }
- objIsArr = true;
- objIsObj = false;
- }
- if (isSameTag && !objIsObj) {
- stack || (stack = new Stack());
- return objIsArr || isTypedArray$1(object4) ? equalArrays(object4, other, bitmask, customizer, equalFunc, stack) : equalByTag(object4, other, objTag, bitmask, customizer, equalFunc, stack);
- }
- if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
- var objIsWrapped = objIsObj && hasOwnProperty$1.call(object4, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty$1.call(other, "__wrapped__");
- if (objIsWrapped || othIsWrapped) {
- var objUnwrapped = objIsWrapped ? object4.value() : object4, othUnwrapped = othIsWrapped ? other.value() : other;
- stack || (stack = new Stack());
- return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
- }
- }
- if (!isSameTag) {
- return false;
- }
- stack || (stack = new Stack());
- return equalObjects(object4, other, bitmask, customizer, equalFunc, stack);
- }
- function baseIsEqual(value, other, bitmask, customizer, stack) {
- if (value === other) {
- return true;
- }
- if (value == null || other == null || !isObjectLike(value) && !isObjectLike(other)) {
- return value !== value && other !== other;
- }
- return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
- }
- var now = function() {
- return root$1.Date.now();
- };
- var now$1 = now;
- var FUNC_ERROR_TEXT$1 = "Expected a function";
- var nativeMax = Math.max, nativeMin = Math.min;
- function debounce$1(func, wait, options) {
- var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
- if (typeof func != "function") {
- throw new TypeError(FUNC_ERROR_TEXT$1);
- }
- wait = toNumber(wait) || 0;
- if (isObject$2(options)) {
- leading = !!options.leading;
- maxing = "maxWait" in options;
- maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
- trailing = "trailing" in options ? !!options.trailing : trailing;
- }
- function invokeFunc(time) {
- var args = lastArgs, thisArg = lastThis;
- lastArgs = lastThis = void 0;
- lastInvokeTime = time;
- result = func.apply(thisArg, args);
- return result;
- }
- function leadingEdge(time) {
- lastInvokeTime = time;
- timerId = setTimeout(timerExpired, wait);
- return leading ? invokeFunc(time) : result;
- }
- function remainingWait(time) {
- var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
- return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
- }
- function shouldInvoke(time) {
- var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
- return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
- }
- function timerExpired() {
- var time = now$1();
- if (shouldInvoke(time)) {
- return trailingEdge(time);
- }
- timerId = setTimeout(timerExpired, remainingWait(time));
- }
- function trailingEdge(time) {
- timerId = void 0;
- if (trailing && lastArgs) {
- return invokeFunc(time);
- }
- lastArgs = lastThis = void 0;
- return result;
- }
- function cancel() {
- if (timerId !== void 0) {
- clearTimeout(timerId);
- }
- lastInvokeTime = 0;
- lastArgs = lastCallTime = lastThis = timerId = void 0;
- }
- function flush() {
- return timerId === void 0 ? result : trailingEdge(now$1());
- }
- function debounced() {
- var time = now$1(), isInvoking = shouldInvoke(time);
- lastArgs = arguments;
- lastThis = this;
- lastCallTime = time;
- if (isInvoking) {
- if (timerId === void 0) {
- return leadingEdge(lastCallTime);
- }
- if (maxing) {
- clearTimeout(timerId);
- timerId = setTimeout(timerExpired, wait);
- return invokeFunc(lastCallTime);
- }
- }
- if (timerId === void 0) {
- timerId = setTimeout(timerExpired, wait);
- }
- return result;
- }
- debounced.cancel = cancel;
- debounced.flush = flush;
- return debounced;
- }
- function isArrayLikeObject(value) {
- return isObjectLike(value) && isArrayLike(value);
- }
- function arrayIncludesWith(array4, value, comparator) {
- var index = -1, length = array4 == null ? 0 : array4.length;
- while (++index < length) {
- if (comparator(value, array4[index])) {
- return true;
- }
- }
- return false;
- }
- var INFINITY$1 = 1 / 0;
- function flattenDeep(array4) {
- var length = array4 == null ? 0 : array4.length;
- return length ? baseFlatten(array4, INFINITY$1) : [];
- }
- function fromPairs(pairs) {
- var index = -1, length = pairs == null ? 0 : pairs.length, result = {};
- while (++index < length) {
- var pair = pairs[index];
- result[pair[0]] = pair[1];
- }
- return result;
- }
- function isEqual(value, other) {
- return baseIsEqual(value, other);
- }
- function isNil(value) {
- return value == null;
- }
- function baseSet(object4, path, value, customizer) {
- if (!isObject$2(object4)) {
- return object4;
- }
- path = castPath(path, object4);
- var index = -1, length = path.length, lastIndex = length - 1, nested = object4;
- while (nested != null && ++index < length) {
- var key = toKey(path[index]), newValue = value;
- if (key === "__proto__" || key === "constructor" || key === "prototype") {
- return object4;
- }
- if (index != lastIndex) {
- var objValue = nested[key];
- newValue = customizer ? customizer(objValue, key, nested) : void 0;
- if (newValue === void 0) {
- newValue = isObject$2(objValue) ? objValue : isIndex(path[index + 1]) ? [] : {};
- }
- }
- assignValue(nested, key, newValue);
- nested = nested[key];
- }
- return object4;
- }
- function set(object4, path, value) {
- return object4 == null ? object4 : baseSet(object4, path, value);
- }
- var FUNC_ERROR_TEXT = "Expected a function";
- function throttle(func, wait, options) {
- var leading = true, trailing = true;
- if (typeof func != "function") {
- throw new TypeError(FUNC_ERROR_TEXT);
- }
- if (isObject$2(options)) {
- leading = "leading" in options ? !!options.leading : leading;
- trailing = "trailing" in options ? !!options.trailing : trailing;
- }
- return debounce$1(func, wait, {
- "leading": leading,
- "maxWait": wait,
- "trailing": trailing
- });
- }
- var INFINITY = 1 / 0;
- var createSet = !(Set$2 && 1 / setToArray(new Set$2([, -0]))[1] == INFINITY) ? noop$1 : function(values) {
- return new Set$2(values);
- };
- var createSet$1 = createSet;
- var LARGE_ARRAY_SIZE = 200;
- function baseUniq(array4, iteratee, comparator) {
- var index = -1, includes = arrayIncludes, length = array4.length, isCommon = true, result = [], seen = result;
- if (comparator) {
- isCommon = false;
- includes = arrayIncludesWith;
- } else if (length >= LARGE_ARRAY_SIZE) {
- var set2 = iteratee ? null : createSet$1(array4);
- if (set2) {
- return setToArray(set2);
- }
- isCommon = false;
- includes = cacheHas;
- seen = new SetCache();
- } else {
- seen = iteratee ? [] : result;
- }
- outer:
- while (++index < length) {
- var value = array4[index], computed2 = iteratee ? iteratee(value) : value;
- value = comparator || value !== 0 ? value : 0;
- if (isCommon && computed2 === computed2) {
- var seenIndex = seen.length;
- while (seenIndex--) {
- if (seen[seenIndex] === computed2) {
- continue outer;
- }
- }
- if (iteratee) {
- seen.push(computed2);
- }
- result.push(value);
- } else if (!includes(seen, computed2, comparator)) {
- if (seen !== result) {
- seen.push(computed2);
- }
- result.push(value);
- }
- }
- return result;
- }
- var union = baseRest(function(arrays) {
- return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
- });
- var union$1 = union;
- const isLeaf = (el) => !el.getAttribute("aria-owns");
- const getSibling = (el, distance, elClass) => {
- const { parentNode } = el;
- if (!parentNode)
- return null;
- const siblings = parentNode.querySelectorAll(elClass);
- const index = Array.prototype.indexOf.call(siblings, el);
- return siblings[index + distance] || null;
- };
- const focusNode = (el) => {
- if (!el)
- return;
- el.focus();
- !isLeaf(el) && el.click();
- };
- const on = (element, event, handler3, useCapture = false) => {
- if (element && event && handler3) {
- element == null ? void 0 : element.addEventListener(event, handler3, useCapture);
- }
- };
- const off = (element, event, handler3, useCapture = false) => {
- if (element && event && handler3) {
- element == null ? void 0 : element.removeEventListener(event, handler3, useCapture);
- }
- };
- const once = (el, event, fn2) => {
- const listener = function(...args) {
- if (fn2) {
- fn2.apply(this, args);
- }
- off(el, event, listener);
- };
- on(el, event, listener);
- };
- const composeEventHandlers = (theirsHandler, oursHandler, { checkForDefaultPrevented = true } = {}) => {
- const handleEvent = (event) => {
- const shouldPrevent = theirsHandler == null ? void 0 : theirsHandler(event);
- if (checkForDefaultPrevented === false || !shouldPrevent) {
- return oursHandler == null ? void 0 : oursHandler(event);
- }
- };
- return handleEvent;
- };
- function tryOnScopeDispose(fn2) {
- if (getCurrentScope()) {
- onScopeDispose(fn2);
- return true;
- }
- return false;
- }
- const isClient = typeof window !== "undefined";
- const isBoolean = (val) => typeof val === "boolean";
- const isNumber = (val) => typeof val === "number";
- const isString$1 = (val) => typeof val === "string";
- const noop = () => {
- };
- function createFilterWrapper(filter, fn2) {
- function wrapper(...args) {
- filter(() => fn2.apply(this, args), { fn: fn2, thisArg: this, args });
- }
- return wrapper;
- }
- function debounceFilter(ms, options = {}) {
- let timer;
- let maxTimer;
- const filter = (invoke) => {
- const duration = unref(ms);
- const maxDuration = unref(options.maxWait);
- if (timer)
- clearTimeout(timer);
- if (duration <= 0 || maxDuration !== void 0 && maxDuration <= 0) {
- if (maxTimer) {
- clearTimeout(maxTimer);
- maxTimer = null;
- }
- return invoke();
- }
- if (maxDuration && !maxTimer) {
- maxTimer = setTimeout(() => {
- if (timer)
- clearTimeout(timer);
- maxTimer = null;
- invoke();
- }, maxDuration);
- }
- timer = setTimeout(() => {
- if (maxTimer)
- clearTimeout(maxTimer);
- maxTimer = null;
- invoke();
- }, duration);
- };
- return filter;
- }
- function throttleFilter(ms, trailing = true, leading = true) {
- let lastExec = 0;
- let timer;
- let preventLeading = !leading;
- const clear = () => {
- if (timer) {
- clearTimeout(timer);
- timer = void 0;
- }
- };
- const filter = (invoke) => {
- const duration = unref(ms);
- const elapsed = Date.now() - lastExec;
- clear();
- if (duration <= 0) {
- lastExec = Date.now();
- return invoke();
- }
- if (elapsed > duration) {
- lastExec = Date.now();
- if (preventLeading)
- preventLeading = false;
- else
- invoke();
- }
- if (trailing) {
- timer = setTimeout(() => {
- lastExec = Date.now();
- if (!leading)
- preventLeading = true;
- clear();
- invoke();
- }, duration);
- }
- if (!leading && !timer)
- timer = setTimeout(() => preventLeading = true, duration);
- };
- return filter;
- }
- function useDebounceFn(fn2, ms = 200, options = {}) {
- return createFilterWrapper(debounceFilter(ms, options), fn2);
- }
- function refDebounced(value, ms = 200, options = {}) {
- if (ms <= 0)
- return value;
- const debounced = ref(value.value);
- const updater = useDebounceFn(() => {
- debounced.value = value.value;
- }, ms, options);
- watch(value, () => updater());
- return debounced;
- }
- function useThrottleFn(fn2, ms = 200, trailing = true, leading = true) {
- return createFilterWrapper(throttleFilter(ms, trailing, leading), fn2);
- }
- function useTimeoutFn(cb, interval, options = {}) {
- const {
- immediate = true
- } = options;
- const isPending = ref(false);
- let timer = null;
- function clear() {
- if (timer) {
- clearTimeout(timer);
- timer = null;
- }
- }
- function stop() {
- isPending.value = false;
- clear();
- }
- function start2(...args) {
- clear();
- isPending.value = true;
- timer = setTimeout(() => {
- isPending.value = false;
- timer = null;
- cb(...args);
- }, unref(interval));
- }
- if (immediate) {
- isPending.value = true;
- if (isClient)
- start2();
- }
- tryOnScopeDispose(stop);
- return {
- isPending,
- start: start2,
- stop
- };
- }
- function unrefElement(elRef) {
- var _a2;
- const plain = unref(elRef);
- return (_a2 = plain == null ? void 0 : plain.$el) != null ? _a2 : plain;
- }
- const defaultWindow = isClient ? window : void 0;
- isClient ? window.document : void 0;
- isClient ? window.navigator : void 0;
- isClient ? window.location : void 0;
- function useEventListener(...args) {
- let target;
- let event;
- let listener;
- let options;
- if (isString$1(args[0])) {
- [event, listener, options] = args;
- target = defaultWindow;
- } else {
- [target, event, listener, options] = args;
- }
- if (!target)
- return noop;
- let cleanup = noop;
- const stopWatch = watch(() => unrefElement(target), (el) => {
- cleanup();
- if (!el)
- return;
- el.addEventListener(event, listener, options);
- cleanup = () => {
- el.removeEventListener(event, listener, options);
- cleanup = noop;
- };
- }, { immediate: true, flush: "post" });
- const stop = () => {
- stopWatch();
- cleanup();
- };
- tryOnScopeDispose(stop);
- return stop;
- }
- function onClickOutside(target, handler3, options = {}) {
- const { window: window2 = defaultWindow, ignore, capture = true } = options;
- if (!window2)
- return;
- const shouldListen = ref(true);
- const listener = (event) => {
- const el = unrefElement(target);
- const composedPath = event.composedPath();
- if (!el || el === event.target || composedPath.includes(el) || !shouldListen.value)
- return;
- if (ignore && ignore.length > 0) {
- if (ignore.some((target2) => {
- const el2 = unrefElement(target2);
- return el2 && (event.target === el2 || composedPath.includes(el2));
- }))
- return;
- }
- handler3(event);
- };
- const cleanup = [
- useEventListener(window2, "click", listener, { passive: true, capture }),
- useEventListener(window2, "pointerdown", (e) => {
- const el = unrefElement(target);
- shouldListen.value = !!el && !e.composedPath().includes(el);
- }, { passive: true })
- ];
- const stop = () => cleanup.forEach((fn2) => fn2());
- return stop;
- }
- const _global = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
- const globalKey = "__vueuse_ssr_handlers__";
- _global[globalKey] = _global[globalKey] || {};
- _global[globalKey];
- var __getOwnPropSymbols$c = Object.getOwnPropertySymbols;
- var __hasOwnProp$c = Object.prototype.hasOwnProperty;
- var __propIsEnum$c = Object.prototype.propertyIsEnumerable;
- var __objRest$2 = (source, exclude) => {
- var target = {};
- for (var prop in source)
- if (__hasOwnProp$c.call(source, prop) && exclude.indexOf(prop) < 0)
- target[prop] = source[prop];
- if (source != null && __getOwnPropSymbols$c)
- for (var prop of __getOwnPropSymbols$c(source)) {
- if (exclude.indexOf(prop) < 0 && __propIsEnum$c.call(source, prop))
- target[prop] = source[prop];
- }
- return target;
- };
- function useResizeObserver(target, callback, options = {}) {
- const _a2 = options, { window: window2 = defaultWindow } = _a2, observerOptions = __objRest$2(_a2, ["window"]);
- let observer;
- const isSupported = window2 && "ResizeObserver" in window2;
- const cleanup = () => {
- if (observer) {
- observer.disconnect();
- observer = void 0;
- }
- };
- const stopWatch = watch(() => unrefElement(target), (el) => {
- cleanup();
- if (isSupported && window2 && el) {
- observer = new ResizeObserver(callback);
- observer.observe(el, observerOptions);
- }
- }, { immediate: true, flush: "post" });
- const stop = () => {
- cleanup();
- stopWatch();
- };
- tryOnScopeDispose(stop);
- return {
- isSupported,
- stop
- };
- }
- var _a, _b;
- 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);
- function useVModel(props, key, emit, options = {}) {
- var _a2;
- const {
- passive: passive2 = false,
- eventName,
- deep = false
- } = options;
- const vm = getCurrentInstance();
- const _emit = emit || (vm == null ? void 0 : vm.emit) || ((_a2 = vm == null ? void 0 : vm.$emit) == null ? void 0 : _a2.bind(vm));
- let event = eventName;
- if (!key) {
- {
- key = "modelValue";
- }
- }
- event = eventName || event || `update:${key}`;
- if (passive2) {
- const proxy = ref(props[key]);
- watch(() => props[key], (v2) => proxy.value = v2);
- watch(proxy, (v2) => {
- if (v2 !== props[key] || deep)
- _emit(event, v2);
- }, {
- deep
- });
- return proxy;
- } else {
- return computed({
- get() {
- return props[key];
- },
- set(value) {
- _emit(event, value);
- }
- });
- }
- }
- const isInContainer = (el, container) => {
- if (!isClient || !el || !container)
- return false;
- const elRect = el.getBoundingClientRect();
- let containerRect;
- if (container instanceof Element) {
- containerRect = container.getBoundingClientRect();
- } else {
- containerRect = {
- top: 0,
- right: window.innerWidth,
- bottom: window.innerHeight,
- left: 0
- };
- }
- return elRect.top < containerRect.bottom && elRect.bottom > containerRect.top && elRect.right > containerRect.left && elRect.left < containerRect.right;
- };
- const resizeHandler = function(entries) {
- for (const entry of entries) {
- const listeners = entry.target.__resizeListeners__ || [];
- if (listeners.length) {
- listeners.forEach((fn2) => {
- fn2();
- });
- }
- }
- };
- const addResizeListener = function(element, fn2) {
- if (!isClient || !element)
- return;
- if (!element.__resizeListeners__) {
- element.__resizeListeners__ = [];
- element.__ro__ = new ResizeObserver(resizeHandler);
- element.__ro__.observe(element);
- }
- element.__resizeListeners__.push(fn2);
- };
- const removeResizeListener = function(element, fn2) {
- var _a2;
- if (!element || !element.__resizeListeners__)
- return;
- element.__resizeListeners__.splice(element.__resizeListeners__.indexOf(fn2), 1);
- if (!element.__resizeListeners__.length) {
- (_a2 = element.__ro__) == null ? void 0 : _a2.disconnect();
- }
- };
- const NOOP = () => {
- };
- const hasOwnProperty = Object.prototype.hasOwnProperty;
- const hasOwn = (val, key) => hasOwnProperty.call(val, key);
- const isArray = Array.isArray;
- const isFunction = (val) => typeof val === "function";
- const isString = (val) => typeof val === "string";
- const isObject$1 = (val) => val !== null && typeof val === "object";
- const isPromise = (val) => {
- return isObject$1(val) && isFunction(val.then) && isFunction(val.catch);
- };
- const objectToString = Object.prototype.toString;
- const toTypeString = (value) => objectToString.call(value);
- const toRawType = (value) => {
- return toTypeString(value).slice(8, -1);
- };
- const cacheStringFunction = (fn2) => {
- const cache = /* @__PURE__ */ Object.create(null);
- return (str) => {
- const hit = cache[str];
- return hit || (cache[str] = fn2(str));
- };
- };
- const camelizeRE = /-(\w)/g;
- const camelize = cacheStringFunction((str) => {
- return str.replace(camelizeRE, (_2, c2) => c2 ? c2.toUpperCase() : "");
- });
- const capitalize = cacheStringFunction((str) => str.charAt(0).toUpperCase() + str.slice(1));
- const isUndefined = (val) => val === void 0;
- const isEmpty = (val) => !val && val !== 0 || isArray(val) && val.length === 0 || isObject$1(val) && !Object.keys(val).length;
- const isElement$1 = (e) => {
- if (typeof Element === "undefined")
- return false;
- return e instanceof Element;
- };
- const escapeStringRegexp = (string3 = "") => string3.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
- const keysOf = (arr) => Object.keys(arr);
- const entriesOf = (arr) => Object.entries(arr);
- const getProp = (obj, path, defaultValue) => {
- return {
- get value() {
- return get(obj, path, defaultValue);
- },
- set value(val) {
- set(obj, path, val);
- }
- };
- };
- const classNameToArray = (cls = "") => cls.split(" ").filter((item) => !!item.trim());
- const hasClass = (el, cls) => {
- if (!el || !cls)
- return false;
- if (cls.includes(" "))
- throw new Error("className should not contain space.");
- return el.classList.contains(cls);
- };
- const addClass = (el, cls) => {
- if (!el || !cls.trim())
- return;
- el.classList.add(...classNameToArray(cls));
- };
- const removeClass = (el, cls) => {
- if (!el || !cls.trim())
- return;
- el.classList.remove(...classNameToArray(cls));
- };
- const getStyle = (element, styleName) => {
- var _a2;
- if (!isClient || !element || !styleName)
- return "";
- camelize(styleName);
- try {
- const style = element.style[styleName];
- if (style)
- return style;
- const computed2 = (_a2 = document.defaultView) == null ? void 0 : _a2.getComputedStyle(element, "");
- return computed2 ? computed2[styleName] : "";
- } catch (e) {
- return element.style[styleName];
- }
- };
- const isScroll = (el, isVertical) => {
- if (!isClient)
- return false;
- const key = {
- undefined: "overflow",
- true: "overflow-y",
- false: "overflow-x"
- }[String(isVertical)];
- const overflow = getStyle(el, key);
- return ["scroll", "auto", "overlay"].some((s2) => overflow.includes(s2));
- };
- const getScrollContainer = (el, isVertical) => {
- if (!isClient)
- return;
- let parent = el;
- while (parent) {
- if ([window, document, document.documentElement].includes(parent))
- return window;
- if (isScroll(parent, isVertical))
- return parent;
- parent = parent.parentNode;
- }
- return parent;
- };
- let scrollBarWidth;
- const getScrollBarWidth = () => {
- var _a2;
- if (!isClient)
- return 0;
- if (scrollBarWidth !== void 0)
- return scrollBarWidth;
- const outer = document.createElement("div");
- outer.className = "el-scrollbar__wrap";
- outer.style.visibility = "hidden";
- outer.style.width = "100px";
- outer.style.position = "absolute";
- outer.style.top = "-9999px";
- document.body.appendChild(outer);
- const widthNoScroll = outer.offsetWidth;
- outer.style.overflow = "scroll";
- const inner = document.createElement("div");
- inner.style.width = "100%";
- outer.appendChild(inner);
- const widthWithScroll = inner.offsetWidth;
- (_a2 = outer.parentNode) == null ? void 0 : _a2.removeChild(outer);
- scrollBarWidth = widthNoScroll - widthWithScroll;
- return scrollBarWidth;
- };
- function scrollIntoView(container, selected) {
- if (!isClient)
- return;
- if (!selected) {
- container.scrollTop = 0;
- return;
- }
- const offsetParents = [];
- let pointer = selected.offsetParent;
- while (pointer !== null && container !== pointer && container.contains(pointer)) {
- offsetParents.push(pointer);
- pointer = pointer.offsetParent;
- }
- const top2 = selected.offsetTop + offsetParents.reduce((prev, curr) => prev + curr.offsetTop, 0);
- const bottom2 = top2 + selected.offsetHeight;
- const viewRectTop = container.scrollTop;
- const viewRectBottom = viewRectTop + container.clientHeight;
- if (top2 < viewRectTop) {
- container.scrollTop = top2;
- } else if (bottom2 > viewRectBottom) {
- container.scrollTop = bottom2 - container.clientHeight;
- }
- }
- var _export_sfc$2 = (sfc, props) => {
- const target = sfc.__vccOpts || sfc;
- for (const [key, val] of props) {
- target[key] = val;
- }
- return target;
- };
- const _sfc_main$1y = defineComponent({
- name: "ArrowDown"
- });
- const _hoisted_1$13 = {
- viewBox: "0 0 1024 1024",
- xmlns: "http://www.w3.org/2000/svg"
- };
- const _hoisted_2$W = /* @__PURE__ */ createElementVNode("path", {
- fill: "currentColor",
- 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"
- }, null, -1);
- const _hoisted_3$J = [
- _hoisted_2$W
- ];
- function _sfc_render$13(_ctx, _cache, $props, $setup, $data, $options) {
- return openBlock(), createElementBlock("svg", _hoisted_1$13, _hoisted_3$J);
- }
- var arrowDown = /* @__PURE__ */ _export_sfc$2(_sfc_main$1y, [["render", _sfc_render$13]]);
- const _sfc_main$1x = defineComponent({
- name: "ArrowLeft"
- });
- const _hoisted_1$12 = {
- viewBox: "0 0 1024 1024",
- xmlns: "http://www.w3.org/2000/svg"
- };
- const _hoisted_2$V = /* @__PURE__ */ createElementVNode("path", {
- fill: "currentColor",
- 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"
- }, null, -1);
- const _hoisted_3$I = [
- _hoisted_2$V
- ];
- function _sfc_render$12(_ctx, _cache, $props, $setup, $data, $options) {
- return openBlock(), createElementBlock("svg", _hoisted_1$12, _hoisted_3$I);
- }
- var arrowLeft = /* @__PURE__ */ _export_sfc$2(_sfc_main$1x, [["render", _sfc_render$12]]);
- const _sfc_main$1w = defineComponent({
- name: "ArrowRight"
- });
- const _hoisted_1$11 = {
- viewBox: "0 0 1024 1024",
- xmlns: "http://www.w3.org/2000/svg"
- };
- const _hoisted_2$U = /* @__PURE__ */ createElementVNode("path", {
- fill: "currentColor",
- 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"
- }, null, -1);
- const _hoisted_3$H = [
- _hoisted_2$U
- ];
- function _sfc_render$11(_ctx, _cache, $props, $setup, $data, $options) {
- return openBlock(), createElementBlock("svg", _hoisted_1$11, _hoisted_3$H);
- }
- var arrowRight = /* @__PURE__ */ _export_sfc$2(_sfc_main$1w, [["render", _sfc_render$11]]);
- const _sfc_main$1v = defineComponent({
- name: "ArrowUp"
- });
- const _hoisted_1$10 = {
- viewBox: "0 0 1024 1024",
- xmlns: "http://www.w3.org/2000/svg"
- };
- const _hoisted_2$T = /* @__PURE__ */ createElementVNode("path", {
- fill: "currentColor",
- 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"
- }, null, -1);
- const _hoisted_3$G = [
- _hoisted_2$T
- ];
- function _sfc_render$10(_ctx, _cache, $props, $setup, $data, $options) {
- return openBlock(), createElementBlock("svg", _hoisted_1$10, _hoisted_3$G);
- }
- var arrowUp = /* @__PURE__ */ _export_sfc$2(_sfc_main$1v, [["render", _sfc_render$10]]);
- const _sfc_main$1u = defineComponent({
- name: "Calendar"
- });
- const _hoisted_1$$ = {
- viewBox: "0 0 1024 1024",
- xmlns: "http://www.w3.org/2000/svg"
- };
- const _hoisted_2$S = /* @__PURE__ */ createElementVNode("path", {
- fill: "currentColor",
- 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"
- }, null, -1);
- const _hoisted_3$F = [
- _hoisted_2$S
- ];
- function _sfc_render$$(_ctx, _cache, $props, $setup, $data, $options) {
- return openBlock(), createElementBlock("svg", _hoisted_1$$, _hoisted_3$F);
- }
- var calendar = /* @__PURE__ */ _export_sfc$2(_sfc_main$1u, [["render", _sfc_render$$]]);
- const _sfc_main$1t = defineComponent({
- name: "Check"
- });
- const _hoisted_1$_ = {
- viewBox: "0 0 1024 1024",
- xmlns: "http://www.w3.org/2000/svg"
- };
- const _hoisted_2$R = /* @__PURE__ */ createElementVNode("path", {
- fill: "currentColor",
- 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"
- }, null, -1);
- const _hoisted_3$E = [
- _hoisted_2$R
- ];
- function _sfc_render$_(_ctx, _cache, $props, $setup, $data, $options) {
- return openBlock(), createElementBlock("svg", _hoisted_1$_, _hoisted_3$E);
- }
- var check = /* @__PURE__ */ _export_sfc$2(_sfc_main$1t, [["render", _sfc_render$_]]);
- const _sfc_main$1s = defineComponent({
- name: "CircleCheck"
- });
- const _hoisted_1$Z = {
- viewBox: "0 0 1024 1024",
- xmlns: "http://www.w3.org/2000/svg"
- };
- const _hoisted_2$Q = /* @__PURE__ */ createElementVNode("path", {
- fill: "currentColor",
- 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"
- }, null, -1);
- const _hoisted_3$D = /* @__PURE__ */ createElementVNode("path", {
- fill: "currentColor",
- 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"
- }, null, -1);
- const _hoisted_4$i = [
- _hoisted_2$Q,
- _hoisted_3$D
- ];
- function _sfc_render$Z(_ctx, _cache, $props, $setup, $data, $options) {
- return openBlock(), createElementBlock("svg", _hoisted_1$Z, _hoisted_4$i);
- }
- var circleCheck = /* @__PURE__ */ _export_sfc$2(_sfc_main$1s, [["render", _sfc_render$Z]]);
- const _sfc_main$1r = defineComponent({
- name: "CircleClose"
- });
- const _hoisted_1$Y = {
- viewBox: "0 0 1024 1024",
- xmlns: "http://www.w3.org/2000/svg"
- };
- const _hoisted_2$P = /* @__PURE__ */ createElementVNode("path", {
- fill: "currentColor",
- 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"
- }, null, -1);
- const _hoisted_3$C = /* @__PURE__ */ createElementVNode("path", {
- fill: "currentColor",
- 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"
- }, null, -1);
- const _hoisted_4$h = [
- _hoisted_2$P,
- _hoisted_3$C
- ];
- function _sfc_render$Y(_ctx, _cache, $props, $setup, $data, $options) {
- return openBlock(), createElementBlock("svg", _hoisted_1$Y, _hoisted_4$h);
- }
- var circleClose = /* @__PURE__ */ _export_sfc$2(_sfc_main$1r, [["render", _sfc_render$Y]]);
- const _sfc_main$1q = defineComponent({
- name: "Clock"
- });
- const _hoisted_1$X = {
- viewBox: "0 0 1024 1024",
- xmlns: "http://www.w3.org/2000/svg"
- };
- const _hoisted_2$O = /* @__PURE__ */ createElementVNode("path", {
- fill: "currentColor",
- 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"
- }, null, -1);
- const _hoisted_3$B = /* @__PURE__ */ createElementVNode("path", {
- fill: "currentColor",
- d: "M480 256a32 32 0 0 1 32 32v256a32 32 0 0 1-64 0V288a32 32 0 0 1 32-32z"
- }, null, -1);
- const _hoisted_4$g = /* @__PURE__ */ createElementVNode("path", {
- fill: "currentColor",
- d: "M480 512h256q32 0 32 32t-32 32H480q-32 0-32-32t32-32z"
- }, null, -1);
- const _hoisted_5$d = [
- _hoisted_2$O,
- _hoisted_3$B,
- _hoisted_4$g
- ];
- function _sfc_render$X(_ctx, _cache, $props, $setup, $data, $options) {
- return openBlock(), createElementBlock("svg", _hoisted_1$X, _hoisted_5$d);
- }
- var clock = /* @__PURE__ */ _export_sfc$2(_sfc_main$1q, [["render", _sfc_render$X]]);
- const _sfc_main$1p = defineComponent({
- name: "Close"
- });
- const _hoisted_1$W = {
- viewBox: "0 0 1024 1024",
- xmlns: "http://www.w3.org/2000/svg"
- };
- const _hoisted_2$N = /* @__PURE__ */ createElementVNode("path", {
- fill: "currentColor",
- 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"
- }, null, -1);
- const _hoisted_3$A = [
- _hoisted_2$N
- ];
- function _sfc_render$W(_ctx, _cache, $props, $setup, $data, $options) {
- return openBlock(), createElementBlock("svg", _hoisted_1$W, _hoisted_3$A);
- }
- var close = /* @__PURE__ */ _export_sfc$2(_sfc_main$1p, [["render", _sfc_render$W]]);
- const _sfc_main$1o = defineComponent({
- name: "DArrowLeft"
- });
- const _hoisted_1$V = {
- viewBox: "0 0 1024 1024",
- xmlns: "http://www.w3.org/2000/svg"
- };
- const _hoisted_2$M = /* @__PURE__ */ createElementVNode("path", {
- fill: "currentColor",
- 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"
- }, null, -1);
- const _hoisted_3$z = [
- _hoisted_2$M
- ];
- function _sfc_render$V(_ctx, _cache, $props, $setup, $data, $options) {
- return openBlock(), createElementBlock("svg", _hoisted_1$V, _hoisted_3$z);
- }
- var dArrowLeft = /* @__PURE__ */ _export_sfc$2(_sfc_main$1o, [["render", _sfc_render$V]]);
- const _sfc_main$1n = defineComponent({
- name: "DArrowRight"
- });
- const _hoisted_1$U = {
- viewBox: "0 0 1024 1024",
- xmlns: "http://www.w3.org/2000/svg"
- };
- const _hoisted_2$L = /* @__PURE__ */ createElementVNode("path", {
- fill: "currentColor",
- 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"
- }, null, -1);
- const _hoisted_3$y = [
- _hoisted_2$L
- ];
- function _sfc_render$U(_ctx, _cache, $props, $setup, $data, $options) {
- return openBlock(), createElementBlock("svg", _hoisted_1$U, _hoisted_3$y);
- }
- var dArrowRight = /* @__PURE__ */ _export_sfc$2(_sfc_main$1n, [["render", _sfc_render$U]]);
- const _sfc_main$1m = defineComponent({
- name: "Delete"
- });
- const _hoisted_1$T = {
- viewBox: "0 0 1024 1024",
- xmlns: "http://www.w3.org/2000/svg"
- };
- const _hoisted_2$K = /* @__PURE__ */ createElementVNode("path", {
- fill: "currentColor",
- 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"
- }, null, -1);
- const _hoisted_3$x = [
- _hoisted_2$K
- ];
- function _sfc_render$T(_ctx, _cache, $props, $setup, $data, $options) {
- return openBlock(), createElementBlock("svg", _hoisted_1$T, _hoisted_3$x);
- }
- var _delete = /* @__PURE__ */ _export_sfc$2(_sfc_main$1m, [["render", _sfc_render$T]]);
- const _sfc_main$1l = defineComponent({
- name: "Document"
- });
- const _hoisted_1$S = {
- viewBox: "0 0 1024 1024",
- xmlns: "http://www.w3.org/2000/svg"
- };
- const _hoisted_2$J = /* @__PURE__ */ createElementVNode("path", {
- fill: "currentColor",
- 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"
- }, null, -1);
- const _hoisted_3$w = [
- _hoisted_2$J
- ];
- function _sfc_render$S(_ctx, _cache, $props, $setup, $data, $options) {
- return openBlock(), createElementBlock("svg", _hoisted_1$S, _hoisted_3$w);
- }
- var document$1 = /* @__PURE__ */ _export_sfc$2(_sfc_main$1l, [["render", _sfc_render$S]]);
- const _sfc_main$1k = defineComponent({
- name: "FullScreen"
- });
- const _hoisted_1$R = {
- viewBox: "0 0 1024 1024",
- xmlns: "http://www.w3.org/2000/svg"
- };
- const _hoisted_2$I = /* @__PURE__ */ createElementVNode("path", {
- fill: "currentColor",
- 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"
- }, null, -1);
- const _hoisted_3$v = [
- _hoisted_2$I
- ];
- function _sfc_render$R(_ctx, _cache, $props, $setup, $data, $options) {
- return openBlock(), createElementBlock("svg", _hoisted_1$R, _hoisted_3$v);
- }
- var fullScreen = /* @__PURE__ */ _export_sfc$2(_sfc_main$1k, [["render", _sfc_render$R]]);
- const _sfc_main$1j = defineComponent({
- name: "Hide"
- });
- const _hoisted_1$Q = {
- viewBox: "0 0 1024 1024",
- xmlns: "http://www.w3.org/2000/svg"
- };
- const _hoisted_2$H = /* @__PURE__ */ createElementVNode("path", {
- 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",
- fill: "currentColor"
- }, null, -1);
- const _hoisted_3$u = /* @__PURE__ */ createElementVNode("path", {
- 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",
- fill: "currentColor"
- }, null, -1);
- const _hoisted_4$f = [
- _hoisted_2$H,
- _hoisted_3$u
- ];
- function _sfc_render$Q(_ctx, _cache, $props, $setup, $data, $options) {
- return openBlock(), createElementBlock("svg", _hoisted_1$Q, _hoisted_4$f);
- }
- var hide$2 = /* @__PURE__ */ _export_sfc$2(_sfc_main$1j, [["render", _sfc_render$Q]]);
- const _sfc_main$1i = defineComponent({
- name: "Loading"
- });
- const _hoisted_1$P = {
- viewBox: "0 0 1024 1024",
- xmlns: "http://www.w3.org/2000/svg"
- };
- const _hoisted_2$G = /* @__PURE__ */ createElementVNode("path", {
- fill: "currentColor",
- 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"
- }, null, -1);
- const _hoisted_3$t = [
- _hoisted_2$G
- ];
- function _sfc_render$P(_ctx, _cache, $props, $setup, $data, $options) {
- return openBlock(), createElementBlock("svg", _hoisted_1$P, _hoisted_3$t);
- }
- var loading = /* @__PURE__ */ _export_sfc$2(_sfc_main$1i, [["render", _sfc_render$P]]);
- const _sfc_main$1h = defineComponent({
- name: "Minus"
- });
- const _hoisted_1$O = {
- viewBox: "0 0 1024 1024",
- xmlns: "http://www.w3.org/2000/svg"
- };
- const _hoisted_2$F = /* @__PURE__ */ createElementVNode("path", {
- fill: "currentColor",
- d: "M128 544h768a32 32 0 1 0 0-64H128a32 32 0 0 0 0 64z"
- }, null, -1);
- const _hoisted_3$s = [
- _hoisted_2$F
- ];
- function _sfc_render$O(_ctx, _cache, $props, $setup, $data, $options) {
- return openBlock(), createElementBlock("svg", _hoisted_1$O, _hoisted_3$s);
- }
- var minus = /* @__PURE__ */ _export_sfc$2(_sfc_main$1h, [["render", _sfc_render$O]]);
- const _sfc_main$1g = defineComponent({
- name: "Plus"
- });
- const _hoisted_1$N = {
- viewBox: "0 0 1024 1024",
- xmlns: "http://www.w3.org/2000/svg"
- };
- const _hoisted_2$E = /* @__PURE__ */ createElementVNode("path", {
- fill: "currentColor",
- 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"
- }, null, -1);
- const _hoisted_3$r = [
- _hoisted_2$E
- ];
- function _sfc_render$N(_ctx, _cache, $props, $setup, $data, $options) {
- return openBlock(), createElementBlock("svg", _hoisted_1$N, _hoisted_3$r);
- }
- var plus = /* @__PURE__ */ _export_sfc$2(_sfc_main$1g, [["render", _sfc_render$N]]);
- const _sfc_main$1f = defineComponent({
- name: "RefreshLeft"
- });
- const _hoisted_1$M = {
- viewBox: "0 0 1024 1024",
- xmlns: "http://www.w3.org/2000/svg"
- };
- const _hoisted_2$D = /* @__PURE__ */ createElementVNode("path", {
- fill: "currentColor",
- 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"
- }, null, -1);
- const _hoisted_3$q = [
- _hoisted_2$D
- ];
- function _sfc_render$M(_ctx, _cache, $props, $setup, $data, $options) {
- return openBlock(), createElementBlock("svg", _hoisted_1$M, _hoisted_3$q);
- }
- var refreshLeft = /* @__PURE__ */ _export_sfc$2(_sfc_main$1f, [["render", _sfc_render$M]]);
- const _sfc_main$1e = defineComponent({
- name: "RefreshRight"
- });
- const _hoisted_1$L = {
- viewBox: "0 0 1024 1024",
- xmlns: "http://www.w3.org/2000/svg"
- };
- const _hoisted_2$C = /* @__PURE__ */ createElementVNode("path", {
- fill: "currentColor",
- 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"
- }, null, -1);
- const _hoisted_3$p = [
- _hoisted_2$C
- ];
- function _sfc_render$L(_ctx, _cache, $props, $setup, $data, $options) {
- return openBlock(), createElementBlock("svg", _hoisted_1$L, _hoisted_3$p);
- }
- var refreshRight = /* @__PURE__ */ _export_sfc$2(_sfc_main$1e, [["render", _sfc_render$L]]);
- const _sfc_main$1d = defineComponent({
- name: "ScaleToOriginal"
- });
- const _hoisted_1$K = {
- viewBox: "0 0 1024 1024",
- xmlns: "http://www.w3.org/2000/svg"
- };
- const _hoisted_2$B = /* @__PURE__ */ createElementVNode("path", {
- fill: "currentColor",
- 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"
- }, null, -1);
- const _hoisted_3$o = [
- _hoisted_2$B
- ];
- function _sfc_render$K(_ctx, _cache, $props, $setup, $data, $options) {
- return openBlock(), createElementBlock("svg", _hoisted_1$K, _hoisted_3$o);
- }
- var scaleToOriginal = /* @__PURE__ */ _export_sfc$2(_sfc_main$1d, [["render", _sfc_render$K]]);
- const _sfc_main$1c = defineComponent({
- name: "StarFilled"
- });
- const _hoisted_1$J = {
- viewBox: "0 0 1024 1024",
- xmlns: "http://www.w3.org/2000/svg"
- };
- const _hoisted_2$A = /* @__PURE__ */ createElementVNode("path", {
- fill: "currentColor",
- 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"
- }, null, -1);
- const _hoisted_3$n = [
- _hoisted_2$A
- ];
- function _sfc_render$J(_ctx, _cache, $props, $setup, $data, $options) {
- return openBlock(), createElementBlock("svg", _hoisted_1$J, _hoisted_3$n);
- }
- var starFilled = /* @__PURE__ */ _export_sfc$2(_sfc_main$1c, [["render", _sfc_render$J]]);
- const _sfc_main$1b = defineComponent({
- name: "Star"
- });
- const _hoisted_1$I = {
- viewBox: "0 0 1024 1024",
- xmlns: "http://www.w3.org/2000/svg"
- };
- const _hoisted_2$z = /* @__PURE__ */ createElementVNode("path", {
- fill: "currentColor",
- 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"
- }, null, -1);
- const _hoisted_3$m = [
- _hoisted_2$z
- ];
- function _sfc_render$I(_ctx, _cache, $props, $setup, $data, $options) {
- return openBlock(), createElementBlock("svg", _hoisted_1$I, _hoisted_3$m);
- }
- var star = /* @__PURE__ */ _export_sfc$2(_sfc_main$1b, [["render", _sfc_render$I]]);
- const _sfc_main$1a = defineComponent({
- name: "View"
- });
- const _hoisted_1$H = {
- viewBox: "0 0 1024 1024",
- xmlns: "http://www.w3.org/2000/svg"
- };
- const _hoisted_2$y = /* @__PURE__ */ createElementVNode("path", {
- fill: "currentColor",
- 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"
- }, null, -1);
- const _hoisted_3$l = [
- _hoisted_2$y
- ];
- function _sfc_render$H(_ctx, _cache, $props, $setup, $data, $options) {
- return openBlock(), createElementBlock("svg", _hoisted_1$H, _hoisted_3$l);
- }
- var view = /* @__PURE__ */ _export_sfc$2(_sfc_main$1a, [["render", _sfc_render$H]]);
- const _sfc_main$19 = defineComponent({
- name: "WarningFilled"
- });
- const _hoisted_1$G = {
- viewBox: "0 0 1024 1024",
- xmlns: "http://www.w3.org/2000/svg"
- };
- const _hoisted_2$x = /* @__PURE__ */ createElementVNode("path", {
- fill: "currentColor",
- 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"
- }, null, -1);
- const _hoisted_3$k = [
- _hoisted_2$x
- ];
- function _sfc_render$G(_ctx, _cache, $props, $setup, $data, $options) {
- return openBlock(), createElementBlock("svg", _hoisted_1$G, _hoisted_3$k);
- }
- var warningFilled = /* @__PURE__ */ _export_sfc$2(_sfc_main$19, [["render", _sfc_render$G]]);
- const _sfc_main$18 = defineComponent({
- name: "ZoomIn"
- });
- const _hoisted_1$F = {
- viewBox: "0 0 1024 1024",
- xmlns: "http://www.w3.org/2000/svg"
- };
- const _hoisted_2$w = /* @__PURE__ */ createElementVNode("path", {
- fill: "currentColor",
- 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"
- }, null, -1);
- const _hoisted_3$j = [
- _hoisted_2$w
- ];
- function _sfc_render$F(_ctx, _cache, $props, $setup, $data, $options) {
- return openBlock(), createElementBlock("svg", _hoisted_1$F, _hoisted_3$j);
- }
- var zoomIn = /* @__PURE__ */ _export_sfc$2(_sfc_main$18, [["render", _sfc_render$F]]);
- const _sfc_main$17 = defineComponent({
- name: "ZoomOut"
- });
- const _hoisted_1$E = {
- viewBox: "0 0 1024 1024",
- xmlns: "http://www.w3.org/2000/svg"
- };
- const _hoisted_2$v = /* @__PURE__ */ createElementVNode("path", {
- fill: "currentColor",
- 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"
- }, null, -1);
- const _hoisted_3$i = [
- _hoisted_2$v
- ];
- function _sfc_render$E(_ctx, _cache, $props, $setup, $data, $options) {
- return openBlock(), createElementBlock("svg", _hoisted_1$E, _hoisted_3$i);
- }
- var zoomOut = /* @__PURE__ */ _export_sfc$2(_sfc_main$17, [["render", _sfc_render$E]]);
- const wrapperKey = Symbol();
- const propKey = "__elPropsReservedKey";
- function buildProp(option, key) {
- if (!isObject$1(option) || !!option[propKey])
- return option;
- const { values, required: required4, default: defaultValue, type: type4, validator } = option;
- const _validator = values || validator ? (val) => {
- let valid = false;
- let allowedValues = [];
- if (values) {
- allowedValues = Array.from(values);
- if (hasOwn(option, "default")) {
- allowedValues.push(defaultValue);
- }
- valid || (valid = allowedValues.includes(val));
- }
- if (validator)
- valid || (valid = validator(val));
- if (!valid && allowedValues.length > 0) {
- const allowValuesText = [...new Set(allowedValues)].map((value) => JSON.stringify(value)).join(", ");
- warn(`Invalid prop: validation failed${key ? ` for prop "${key}"` : ""}. Expected one of [${allowValuesText}], got value ${JSON.stringify(val)}.`);
- }
- return valid;
- } : void 0;
- const prop = {
- type: isObject$1(type4) && Object.getOwnPropertySymbols(type4).includes(wrapperKey) ? type4[wrapperKey] : type4,
- required: !!required4,
- validator: _validator,
- [propKey]: true
- };
- if (hasOwn(option, "default"))
- prop.default = defaultValue;
- return prop;
- }
- const buildProps = (props) => fromPairs(Object.entries(props).map(([key, option]) => [
- key,
- buildProp(option, key)
- ]));
- const definePropType = (val) => ({ [wrapperKey]: val });
- const iconPropType = definePropType([
- String,
- Object,
- Function
- ]);
- const CloseComponents = {
- Close: close
- };
- const ValidateComponentsMap = {
- validating: loading,
- success: circleCheck,
- error: circleClose
- };
- const withInstall = (main2, extra) => {
- main2.install = (app) => {
- for (const comp of [main2, ...Object.values(extra != null ? extra : {})]) {
- app.component(comp.name, comp);
- }
- };
- if (extra) {
- for (const [key, comp] of Object.entries(extra)) {
- main2[key] = comp;
- }
- }
- return main2;
- };
- const withNoopInstall = (component) => {
- component.install = NOOP;
- return component;
- };
- class ElementPlusError extends Error {
- constructor(m2) {
- super(m2);
- this.name = "ElementPlusError";
- }
- }
- function throwError(scope, m2) {
- throw new ElementPlusError(`[${scope}] ${m2}`);
- }
- function debugWarn(scope, message) {
- }
- function addUnit(value, defaultUnit = "px") {
- if (!value)
- return "";
- if (isString(value)) {
- return value;
- } else if (isNumber(value)) {
- return `${value}${defaultUnit}`;
- }
- }
- const EVENT_CODE = {
- tab: "Tab",
- enter: "Enter",
- space: "Space",
- left: "ArrowLeft",
- up: "ArrowUp",
- right: "ArrowRight",
- down: "ArrowDown",
- esc: "Escape",
- delete: "Delete",
- backspace: "Backspace",
- numpadEnter: "NumpadEnter",
- pageUp: "PageUp",
- pageDown: "PageDown",
- home: "Home",
- end: "End"
- };
- const datePickTypes = [
- "year",
- "month",
- "date",
- "dates",
- "week",
- "datetime",
- "datetimerange",
- "daterange",
- "monthrange"
- ];
- const UPDATE_MODEL_EVENT = "update:modelValue";
- const CHANGE_EVENT = "change";
- const INPUT_EVENT = "input";
- const componentSizes = ["", "default", "small", "large"];
- const componentSizeMap = {
- large: 40,
- default: 32,
- small: 24
- };
- const getComponentSize = (size = "default") => {
- return componentSizeMap[size || "default"];
- };
- const isValidComponentSize = (val) => ["", ...componentSizes].includes(val);
- const isValidDatePickType = (val) => [...datePickTypes].includes(val);
- var PatchFlags = /* @__PURE__ */ ((PatchFlags2) => {
- PatchFlags2[PatchFlags2["TEXT"] = 1] = "TEXT";
- PatchFlags2[PatchFlags2["CLASS"] = 2] = "CLASS";
- PatchFlags2[PatchFlags2["STYLE"] = 4] = "STYLE";
- PatchFlags2[PatchFlags2["PROPS"] = 8] = "PROPS";
- PatchFlags2[PatchFlags2["FULL_PROPS"] = 16] = "FULL_PROPS";
- PatchFlags2[PatchFlags2["HYDRATE_EVENTS"] = 32] = "HYDRATE_EVENTS";
- PatchFlags2[PatchFlags2["STABLE_FRAGMENT"] = 64] = "STABLE_FRAGMENT";
- PatchFlags2[PatchFlags2["KEYED_FRAGMENT"] = 128] = "KEYED_FRAGMENT";
- PatchFlags2[PatchFlags2["UNKEYED_FRAGMENT"] = 256] = "UNKEYED_FRAGMENT";
- PatchFlags2[PatchFlags2["NEED_PATCH"] = 512] = "NEED_PATCH";
- PatchFlags2[PatchFlags2["DYNAMIC_SLOTS"] = 1024] = "DYNAMIC_SLOTS";
- PatchFlags2[PatchFlags2["HOISTED"] = -1] = "HOISTED";
- PatchFlags2[PatchFlags2["BAIL"] = -2] = "BAIL";
- return PatchFlags2;
- })(PatchFlags || {});
- function isFragment(node) {
- return isVNode(node) && node.type === Fragment;
- }
- function isComment(node) {
- return isVNode(node) && node.type === Comment;
- }
- function isValidElementNode(node) {
- return isVNode(node) && !isFragment(node) && !isComment(node);
- }
- const unique = (arr) => [...new Set(arr)];
- const castArray = (arr) => {
- if (!arr && arr !== 0)
- return [];
- return Array.isArray(arr) ? arr : [arr];
- };
- const isFirefox = () => isClient && /firefox/i.test(window.navigator.userAgent);
- const isKorean = (text) => /([(\uAC00-\uD7AF)|(\u3130-\u318F)])+/gi.test(text);
- const generateId = () => Math.floor(Math.random() * 1e4);
- const mutable = (val) => val;
- const DEFAULT_EXCLUDE_KEYS = ["class", "style"];
- const LISTENER_PREFIX = /^on[A-Z]/;
- const useAttrs = (params = {}) => {
- const { excludeListeners = false, excludeKeys = [] } = params;
- const allExcludeKeys = excludeKeys.concat(DEFAULT_EXCLUDE_KEYS);
- const instance = getCurrentInstance();
- if (!instance) {
- return computed(() => ({}));
- }
- return computed(() => {
- var _a2;
- return fromPairs(Object.entries((_a2 = instance.proxy) == null ? void 0 : _a2.$attrs).filter(([key]) => !allExcludeKeys.includes(key) && !(excludeListeners && LISTENER_PREFIX.test(key))));
- });
- };
- const buttonGroupContextKey = Symbol("buttonGroupContextKey");
- const configProviderContextKey = Symbol();
- const dialogInjectionKey = Symbol("dialogInjectionKey");
- const formContextKey = Symbol("formContextKey");
- const formItemContextKey = Symbol("formItemContextKey");
- const radioGroupKey = Symbol("radioGroupKey");
- const scrollbarContextKey = Symbol("scrollbarContextKey");
- const uploadContextKey = Symbol("uploadContextKey");
- const POPPER_INJECTION_KEY = Symbol("popper");
- const POPPER_CONTENT_INJECTION_KEY = Symbol("popperContent");
- const useProp = (name) => {
- const vm = getCurrentInstance();
- return computed(() => {
- var _a2, _b2;
- return (_b2 = (_a2 = vm.proxy) == null ? void 0 : _a2.$props[name]) != null ? _b2 : void 0;
- });
- };
- const globalConfig = ref();
- function useGlobalConfig(key, defaultValue = void 0) {
- const config = getCurrentInstance() ? inject(configProviderContextKey, globalConfig) : globalConfig;
- if (key) {
- return computed(() => {
- var _a2, _b2;
- return (_b2 = (_a2 = config.value) == null ? void 0 : _a2[key]) != null ? _b2 : defaultValue;
- });
- } else {
- return config;
- }
- }
- const provideGlobalConfig = (config, app, global2 = false) => {
- var _a2;
- const inSetup = !!getCurrentInstance();
- const oldConfig = inSetup ? useGlobalConfig() : void 0;
- const provideFn = (_a2 = app == null ? void 0 : app.provide) != null ? _a2 : inSetup ? provide : void 0;
- if (!provideFn) {
- return;
- }
- const context = computed(() => {
- const cfg = unref(config);
- if (!(oldConfig == null ? void 0 : oldConfig.value))
- return cfg;
- return mergeConfig(oldConfig.value, cfg);
- });
- provideFn(configProviderContextKey, context);
- if (global2 || !globalConfig.value) {
- globalConfig.value = context.value;
- }
- return context;
- };
- const mergeConfig = (a2, b2) => {
- var _a2;
- const keys2 = [.../* @__PURE__ */ new Set([...keysOf(a2), ...keysOf(b2)])];
- const obj = {};
- for (const key of keys2) {
- obj[key] = (_a2 = b2[key]) != null ? _a2 : a2[key];
- }
- return obj;
- };
- const useSizeProp = buildProp({
- type: String,
- values: componentSizes,
- required: false
- });
- const useSize = (fallback, ignore = {}) => {
- const emptyRef = ref(void 0);
- const size = ignore.prop ? emptyRef : useProp("size");
- const globalConfig2 = ignore.global ? emptyRef : useGlobalConfig("size");
- const form = ignore.form ? { size: void 0 } : inject(formContextKey, void 0);
- const formItem = ignore.formItem ? { size: void 0 } : inject(formItemContextKey, void 0);
- return computed(() => size.value || unref(fallback) || (formItem == null ? void 0 : formItem.size) || (form == null ? void 0 : form.size) || globalConfig2.value || "");
- };
- const useDisabled$1 = (fallback) => {
- const disabled = useProp("disabled");
- const form = inject(formContextKey, void 0);
- return computed(() => disabled.value || unref(fallback) || (form == null ? void 0 : form.disabled) || false);
- };
- const useDeprecated = ({ from, replacement, scope, version, ref: ref2, type: type4 = "API" }, condition) => {
- watch(() => unref(condition), (val) => {
- }, {
- immediate: true
- });
- };
- const useDraggable = (targetRef, dragRef, draggable) => {
- let transform = {
- offsetX: 0,
- offsetY: 0
- };
- const onMousedown = (e) => {
- const downX = e.clientX;
- const downY = e.clientY;
- const { offsetX, offsetY } = transform;
- const targetRect = targetRef.value.getBoundingClientRect();
- const targetLeft = targetRect.left;
- const targetTop = targetRect.top;
- const targetWidth = targetRect.width;
- const targetHeight = targetRect.height;
- const clientWidth = document.documentElement.clientWidth;
- const clientHeight = document.documentElement.clientHeight;
- const minLeft = -targetLeft + offsetX;
- const minTop = -targetTop + offsetY;
- const maxLeft = clientWidth - targetLeft - targetWidth + offsetX;
- const maxTop = clientHeight - targetTop - targetHeight + offsetY;
- const onMousemove = (e2) => {
- const moveX = Math.min(Math.max(offsetX + e2.clientX - downX, minLeft), maxLeft);
- const moveY = Math.min(Math.max(offsetY + e2.clientY - downY, minTop), maxTop);
- transform = {
- offsetX: moveX,
- offsetY: moveY
- };
- targetRef.value.style.transform = `translate(${addUnit(moveX)}, ${addUnit(moveY)})`;
- };
- const onMouseup = () => {
- document.removeEventListener("mousemove", onMousemove);
- document.removeEventListener("mouseup", onMouseup);
- };
- document.addEventListener("mousemove", onMousemove);
- document.addEventListener("mouseup", onMouseup);
- };
- const onDraggable = () => {
- if (dragRef.value && targetRef.value) {
- dragRef.value.addEventListener("mousedown", onMousedown);
- }
- };
- const offDraggable = () => {
- if (dragRef.value && targetRef.value) {
- dragRef.value.removeEventListener("mousedown", onMousedown);
- }
- };
- onMounted(() => {
- watchEffect(() => {
- if (draggable.value) {
- onDraggable();
- } else {
- offDraggable();
- }
- });
- });
- onBeforeUnmount(() => {
- offDraggable();
- });
- };
- const useFocus = (el) => {
- return {
- focus: () => {
- var _a2, _b2;
- (_b2 = (_a2 = el.value) == null ? void 0 : _a2.focus) == null ? void 0 : _b2.call(_a2);
- }
- };
- };
- const useFormItem = () => {
- const form = inject(formContextKey, void 0);
- const formItem = inject(formItemContextKey, void 0);
- return {
- form,
- formItem
- };
- };
- var English = {
- name: "en",
- el: {
- colorpicker: {
- confirm: "OK",
- clear: "Clear"
- },
- datepicker: {
- now: "Now",
- today: "Today",
- cancel: "Cancel",
- clear: "Clear",
- confirm: "OK",
- selectDate: "Select date",
- selectTime: "Select time",
- startDate: "Start Date",
- startTime: "Start Time",
- endDate: "End Date",
- endTime: "End Time",
- prevYear: "Previous Year",
- nextYear: "Next Year",
- prevMonth: "Previous Month",
- nextMonth: "Next Month",
- year: "",
- month1: "January",
- month2: "February",
- month3: "March",
- month4: "April",
- month5: "May",
- month6: "June",
- month7: "July",
- month8: "August",
- month9: "September",
- month10: "October",
- month11: "November",
- month12: "December",
- week: "week",
- weeks: {
- sun: "Sun",
- mon: "Mon",
- tue: "Tue",
- wed: "Wed",
- thu: "Thu",
- fri: "Fri",
- sat: "Sat"
- },
- months: {
- jan: "Jan",
- feb: "Feb",
- mar: "Mar",
- apr: "Apr",
- may: "May",
- jun: "Jun",
- jul: "Jul",
- aug: "Aug",
- sep: "Sep",
- oct: "Oct",
- nov: "Nov",
- dec: "Dec"
- }
- },
- select: {
- loading: "Loading",
- noMatch: "No matching data",
- noData: "No data",
- placeholder: "Select"
- },
- cascader: {
- noMatch: "No matching data",
- loading: "Loading",
- placeholder: "Select",
- noData: "No data"
- },
- pagination: {
- goto: "Go to",
- pagesize: "/page",
- total: "Total {total}",
- pageClassifier: "",
- deprecationWarning: "Deprecated usages detected, please refer to the el-pagination documentation for more details"
- },
- messagebox: {
- title: "Message",
- confirm: "OK",
- cancel: "Cancel",
- error: "Illegal input"
- },
- upload: {
- deleteTip: "press delete to remove",
- delete: "Delete",
- preview: "Preview",
- continue: "Continue"
- },
- table: {
- emptyText: "No Data",
- confirmFilter: "Confirm",
- resetFilter: "Reset",
- clearFilter: "All",
- sumText: "Sum"
- },
- tree: {
- emptyText: "No Data"
- },
- transfer: {
- noMatch: "No matching data",
- noData: "No data",
- titles: ["List 1", "List 2"],
- filterPlaceholder: "Enter keyword",
- noCheckedFormat: "{total} items",
- hasCheckedFormat: "{checked}/{total} checked"
- },
- image: {
- error: "FAILED"
- },
- pageHeader: {
- title: "Back"
- },
- popconfirm: {
- confirmButtonText: "Yes",
- cancelButtonText: "No"
- }
- }
- };
- const buildTranslator = (locale) => (path, option) => translate(path, option, unref(locale));
- const translate = (path, option, locale) => get(locale, path, path).replace(/\{(\w+)\}/g, (_2, key) => {
- var _a2;
- return `${(_a2 = option == null ? void 0 : option[key]) != null ? _a2 : `{${key}}`}`;
- });
- const buildLocaleContext = (locale) => {
- const lang = computed(() => unref(locale).name);
- const localeRef = isRef(locale) ? locale : ref(locale);
- return {
- lang,
- locale: localeRef,
- t: buildTranslator(locale)
- };
- };
- const useLocale = () => {
- const locale = useGlobalConfig("locale");
- return buildLocaleContext(computed(() => locale.value || English));
- };
- const useLockscreen = (trigger) => {
- if (!isRef(trigger)) {
- throwError("[useLockscreen]", "You need to pass a ref param to this function");
- }
- if (!isClient || hasClass(document.body, "el-popup-parent--hidden")) {
- return;
- }
- let scrollBarWidth2 = 0;
- let withoutHiddenClass = false;
- let bodyPaddingRight = "0";
- let computedBodyPaddingRight = 0;
- const cleanup = () => {
- removeClass(document.body, "el-popup-parent--hidden");
- if (withoutHiddenClass) {
- document.body.style.paddingRight = bodyPaddingRight;
- }
- };
- watch(trigger, (val) => {
- if (!val) {
- cleanup();
- return;
- }
- withoutHiddenClass = !hasClass(document.body, "el-popup-parent--hidden");
- if (withoutHiddenClass) {
- bodyPaddingRight = document.body.style.paddingRight;
- computedBodyPaddingRight = Number.parseInt(getStyle(document.body, "paddingRight"), 10);
- }
- scrollBarWidth2 = getScrollBarWidth();
- const bodyHasOverflow = document.documentElement.clientHeight < document.body.scrollHeight;
- const bodyOverflowY = getStyle(document.body, "overflowY");
- if (scrollBarWidth2 > 0 && (bodyHasOverflow || bodyOverflowY === "scroll") && withoutHiddenClass) {
- document.body.style.paddingRight = `${computedBodyPaddingRight + scrollBarWidth2}px`;
- }
- addClass(document.body, "el-popup-parent--hidden");
- });
- onScopeDispose(() => cleanup());
- };
- const modalStack = [];
- const closeModal = (e) => {
- if (modalStack.length === 0)
- return;
- if (e.code === EVENT_CODE.esc) {
- e.stopPropagation();
- const topModal = modalStack[modalStack.length - 1];
- topModal.handleClose();
- }
- };
- const useModal = (instance, visibleRef) => {
- watch(visibleRef, (val) => {
- if (val) {
- modalStack.push(instance);
- } else {
- modalStack.splice(modalStack.indexOf(instance), 1);
- }
- });
- };
- if (isClient)
- useEventListener(document, "keydown", closeModal);
- const _prop = buildProp({
- type: definePropType(Boolean),
- default: null
- });
- const _event = buildProp({
- type: definePropType(Function)
- });
- const createModelToggleComposable = (name) => {
- const useModelToggleProps2 = {
- [name]: _prop,
- [`onUpdate:${name}`]: _event
- };
- const useModelToggleEmits2 = [`update:${name}`];
- const useModelToggle2 = ({
- indicator,
- shouldHideWhenRouteChanges,
- shouldProceed,
- onShow,
- onHide
- }) => {
- const instance = getCurrentInstance();
- const props = instance.props;
- const { emit } = instance;
- const updateEventKey = `update:${name}`;
- const hasUpdateHandler = computed(() => isFunction(props[`onUpdate:${name}`]));
- const isModelBindingAbsent = computed(() => props[name] === null);
- const doShow = () => {
- if (indicator.value === true) {
- return;
- }
- indicator.value = true;
- if (isFunction(onShow)) {
- onShow();
- }
- };
- const doHide = () => {
- if (indicator.value === false) {
- return;
- }
- indicator.value = false;
- if (isFunction(onHide)) {
- onHide();
- }
- };
- const show = () => {
- if (props.disabled === true || isFunction(shouldProceed) && !shouldProceed())
- return;
- const shouldEmit = hasUpdateHandler.value && isClient;
- if (shouldEmit) {
- emit(updateEventKey, true);
- }
- if (isModelBindingAbsent.value || !shouldEmit) {
- doShow();
- }
- };
- const hide2 = () => {
- if (props.disabled === true || !isClient)
- return;
- const shouldEmit = hasUpdateHandler.value && isClient;
- if (shouldEmit) {
- emit(updateEventKey, false);
- }
- if (isModelBindingAbsent.value || !shouldEmit) {
- doHide();
- }
- };
- const onChange = (val) => {
- if (!isBoolean(val))
- return;
- if (props.disabled && val) {
- if (hasUpdateHandler.value) {
- emit(updateEventKey, false);
- }
- } else if (indicator.value !== val) {
- if (val) {
- doShow();
- } else {
- doHide();
- }
- }
- };
- const toggle = () => {
- if (indicator.value) {
- hide2();
- } else {
- show();
- }
- };
- watch(() => props[name], onChange);
- if (shouldHideWhenRouteChanges && instance.appContext.config.globalProperties.$route !== void 0) {
- watch(() => __spreadValues({}, instance.proxy.$route), () => {
- if (shouldHideWhenRouteChanges.value && indicator.value) {
- hide2();
- }
- });
- }
- onMounted(() => {
- onChange(props[name]);
- });
- return {
- hide: hide2,
- show,
- toggle
- };
- };
- return {
- useModelToggle: useModelToggle2,
- useModelToggleProps: useModelToggleProps2,
- useModelToggleEmits: useModelToggleEmits2
- };
- };
- const useRestoreActive = (toggle, initialFocus) => {
- let previousActive;
- watch(() => toggle.value, (val) => {
- var _a2, _b2;
- if (val) {
- previousActive = document.activeElement;
- if (isRef(initialFocus)) {
- (_b2 = (_a2 = initialFocus.value).focus) == null ? void 0 : _b2.call(_a2);
- }
- } else {
- {
- previousActive.focus();
- }
- }
- });
- };
- const useSameTarget = (handleClick) => {
- if (!handleClick) {
- return { onClick: NOOP, onMousedown: NOOP, onMouseup: NOOP };
- }
- let mousedownTarget = false;
- let mouseupTarget = false;
- const onClick = (e) => {
- if (mousedownTarget && mouseupTarget) {
- handleClick(e);
- }
- mousedownTarget = mouseupTarget = false;
- };
- const onMousedown = (e) => {
- mousedownTarget = e.target === e.currentTarget;
- };
- const onMouseup = (e) => {
- mouseupTarget = e.target === e.currentTarget;
- };
- return { onClick, onMousedown, onMouseup };
- };
- function useTimeout() {
- let timeoutHandle;
- const registerTimeout = (fn2, delay) => {
- cancelTimeout();
- timeoutHandle = window.setTimeout(fn2, delay);
- };
- const cancelTimeout = () => window.clearTimeout(timeoutHandle);
- tryOnScopeDispose(() => cancelTimeout());
- return {
- registerTimeout,
- cancelTimeout
- };
- }
- const defaultIdInjection = {
- prefix: Math.floor(Math.random() * 1e4),
- current: 0
- };
- const ID_INJECTION_KEY = Symbol("elIdInjection");
- const useId = (deterministicId) => {
- const idInjection = inject(ID_INJECTION_KEY, defaultIdInjection);
- const idRef = computed(() => unref(deterministicId) || `el-id-${idInjection.prefix}-${idInjection.current++}`);
- return idRef;
- };
- const useEscapeKeydown = (handler3) => {
- const cachedHandler = (e) => {
- const event = e;
- if (event.key === EVENT_CODE.esc) {
- handler3 == null ? void 0 : handler3(event);
- }
- };
- onMounted(() => {
- on(document, "keydown", cachedHandler);
- });
- onBeforeUnmount(() => {
- off(document, "keydown", cachedHandler);
- });
- };
- let cachedContainer;
- const POPPER_CONTAINER_ID = `el-popper-container-${generateId()}`;
- const POPPER_CONTAINER_SELECTOR = `#${POPPER_CONTAINER_ID}`;
- const createContainer = () => {
- const container = document.createElement("div");
- container.id = POPPER_CONTAINER_ID;
- document.body.appendChild(container);
- return container;
- };
- const usePopperContainer = () => {
- onBeforeMount(() => {
- if (!isClient)
- return;
- if (!cachedContainer || !document.body.querySelector(POPPER_CONTAINER_SELECTOR)) {
- cachedContainer = createContainer();
- }
- });
- };
- const useDelayedToggleProps = buildProps({
- showAfter: {
- type: Number,
- default: 0
- },
- hideAfter: {
- type: Number,
- default: 200
- }
- });
- const useDelayedToggle = ({
- showAfter,
- hideAfter,
- open,
- close: close2
- }) => {
- const { registerTimeout } = useTimeout();
- const onOpen = () => {
- registerTimeout(() => {
- open();
- }, unref(showAfter));
- };
- const onClose = () => {
- registerTimeout(() => {
- close2();
- }, unref(hideAfter));
- };
- return {
- onOpen,
- onClose
- };
- };
- const FORWARD_REF_INJECTION_KEY = Symbol("elForwardRef");
- const useForwardRef = (forwardRef) => {
- const setForwardRef = (el) => {
- forwardRef.value = el;
- };
- provide(FORWARD_REF_INJECTION_KEY, {
- setForwardRef
- });
- };
- const useForwardRefDirective = (setForwardRef) => {
- return {
- mounted(el) {
- setForwardRef(el);
- },
- updated(el) {
- setForwardRef(el);
- },
- unmounted() {
- setForwardRef(null);
- }
- };
- };
- const defaultNamespace = "el";
- const statePrefix = "is-";
- const _bem = (namespace, block, blockSuffix, element, modifier) => {
- let cls = `${namespace}-${block}`;
- if (blockSuffix) {
- cls += `-${blockSuffix}`;
- }
- if (element) {
- cls += `__${element}`;
- }
- if (modifier) {
- cls += `--${modifier}`;
- }
- return cls;
- };
- const useNamespace = (block) => {
- const globalConfig2 = useGlobalConfig("namespace");
- const namespace = computed(() => globalConfig2.value || defaultNamespace);
- const b2 = (blockSuffix = "") => _bem(unref(namespace), block, blockSuffix, "", "");
- const e = (element) => element ? _bem(unref(namespace), block, "", element, "") : "";
- const m2 = (modifier) => modifier ? _bem(unref(namespace), block, "", "", modifier) : "";
- const be = (blockSuffix, element) => blockSuffix && element ? _bem(unref(namespace), block, blockSuffix, element, "") : "";
- const em = (element, modifier) => element && modifier ? _bem(unref(namespace), block, "", element, modifier) : "";
- const bm = (blockSuffix, modifier) => blockSuffix && modifier ? _bem(unref(namespace), block, blockSuffix, "", modifier) : "";
- const bem = (blockSuffix, element, modifier) => blockSuffix && element && modifier ? _bem(unref(namespace), block, blockSuffix, element, modifier) : "";
- const is = (name, ...args) => {
- const state = args.length >= 1 ? args[0] : true;
- return name && state ? `${statePrefix}${name}` : "";
- };
- return {
- namespace,
- b: b2,
- e,
- m: m2,
- be,
- em,
- bm,
- bem,
- is
- };
- };
- const zIndex = ref(0);
- const useZIndex = () => {
- const initialZIndex = useGlobalConfig("zIndex", 2e3);
- const currentZIndex = computed(() => initialZIndex.value + zIndex.value);
- const nextZIndex = () => {
- zIndex.value++;
- return currentZIndex.value;
- };
- return {
- initialZIndex,
- currentZIndex,
- nextZIndex
- };
- };
- var _export_sfc$1 = (sfc, props) => {
- const target = sfc.__vccOpts || sfc;
- for (const [key, val] of props) {
- target[key] = val;
- }
- return target;
- };
- const iconProps = buildProps({
- size: {
- type: definePropType([Number, String])
- },
- color: {
- type: String
- }
- });
- const __default__$l = {
- name: "ElIcon",
- inheritAttrs: false
- };
- const _sfc_main$16 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$l), {
- props: iconProps,
- setup(__props) {
- const props = __props;
- const ns = useNamespace("icon");
- const style = computed(() => {
- if (!props.size && !props.color)
- return {};
- return {
- fontSize: isUndefined(props.size) ? void 0 : addUnit(props.size),
- "--color": props.color
- };
- });
- return (_ctx, _cache) => {
- return openBlock(), createElementBlock("i", mergeProps({
- class: unref(ns).b(),
- style: unref(style)
- }, _ctx.$attrs), [
- renderSlot(_ctx.$slots, "default")
- ], 16);
- };
- }
- }));
- var Icon = /* @__PURE__ */ _export_sfc$1(_sfc_main$16, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/icon/src/icon.vue"]]);
- const ElIcon = withInstall(Icon);
- let hiddenTextarea = void 0;
- const HIDDEN_STYLE = `
- height:0 !important;
- visibility:hidden !important;
- overflow:hidden !important;
- position:absolute !important;
- z-index:-1000 !important;
- top:0 !important;
- right:0 !important;
- `;
- const CONTEXT_STYLE = [
- "letter-spacing",
- "line-height",
- "padding-top",
- "padding-bottom",
- "font-family",
- "font-weight",
- "font-size",
- "text-rendering",
- "text-transform",
- "width",
- "text-indent",
- "padding-left",
- "padding-right",
- "border-width",
- "box-sizing"
- ];
- function calculateNodeStyling(targetElement) {
- const style = window.getComputedStyle(targetElement);
- const boxSizing = style.getPropertyValue("box-sizing");
- const paddingSize = Number.parseFloat(style.getPropertyValue("padding-bottom")) + Number.parseFloat(style.getPropertyValue("padding-top"));
- const borderSize = Number.parseFloat(style.getPropertyValue("border-bottom-width")) + Number.parseFloat(style.getPropertyValue("border-top-width"));
- const contextStyle = CONTEXT_STYLE.map((name) => `${name}:${style.getPropertyValue(name)}`).join(";");
- return { contextStyle, paddingSize, borderSize, boxSizing };
- }
- function calcTextareaHeight(targetElement, minRows = 1, maxRows) {
- var _a2;
- if (!hiddenTextarea) {
- hiddenTextarea = document.createElement("textarea");
- document.body.appendChild(hiddenTextarea);
- }
- const { paddingSize, borderSize, boxSizing, contextStyle } = calculateNodeStyling(targetElement);
- hiddenTextarea.setAttribute("style", `${contextStyle};${HIDDEN_STYLE}`);
- hiddenTextarea.value = targetElement.value || targetElement.placeholder || "";
- let height = hiddenTextarea.scrollHeight;
- const result = {};
- if (boxSizing === "border-box") {
- height = height + borderSize;
- } else if (boxSizing === "content-box") {
- height = height - paddingSize;
- }
- hiddenTextarea.value = "";
- const singleRowHeight = hiddenTextarea.scrollHeight - paddingSize;
- if (isNumber(minRows)) {
- let minHeight = singleRowHeight * minRows;
- if (boxSizing === "border-box") {
- minHeight = minHeight + paddingSize + borderSize;
- }
- height = Math.max(minHeight, height);
- result.minHeight = `${minHeight}px`;
- }
- if (isNumber(maxRows)) {
- let maxHeight = singleRowHeight * maxRows;
- if (boxSizing === "border-box") {
- maxHeight = maxHeight + paddingSize + borderSize;
- }
- height = Math.min(maxHeight, height);
- }
- result.height = `${height}px`;
- (_a2 = hiddenTextarea.parentNode) == null ? void 0 : _a2.removeChild(hiddenTextarea);
- hiddenTextarea = void 0;
- return result;
- }
- const inputProps = buildProps({
- size: useSizeProp,
- disabled: Boolean,
- modelValue: {
- type: definePropType([
- String,
- Number,
- Object
- ]),
- default: ""
- },
- type: {
- type: String,
- default: "text"
- },
- resize: {
- type: String,
- values: ["none", "both", "horizontal", "vertical"]
- },
- autosize: {
- type: definePropType([Boolean, Object]),
- default: false
- },
- autocomplete: {
- type: String,
- default: "off"
- },
- placeholder: {
- type: String
- },
- form: {
- type: String,
- default: ""
- },
- readonly: {
- type: Boolean,
- default: false
- },
- clearable: {
- type: Boolean,
- default: false
- },
- showPassword: {
- type: Boolean,
- default: false
- },
- showWordLimit: {
- type: Boolean,
- default: false
- },
- suffixIcon: {
- type: iconPropType,
- default: ""
- },
- prefixIcon: {
- type: iconPropType,
- default: ""
- },
- label: {
- type: String
- },
- tabindex: {
- type: [Number, String]
- },
- validateEvent: {
- type: Boolean,
- default: true
- },
- inputStyle: {
- type: definePropType([Object, Array, String]),
- default: () => mutable({})
- }
- });
- const inputEmits = {
- [UPDATE_MODEL_EVENT]: (value) => isString(value),
- input: (value) => isString(value),
- change: (value) => isString(value),
- focus: (evt) => evt instanceof FocusEvent,
- blur: (evt) => evt instanceof FocusEvent,
- clear: () => true,
- mouseleave: (evt) => evt instanceof MouseEvent,
- mouseenter: (evt) => evt instanceof MouseEvent,
- keydown: (evt) => evt instanceof Event,
- compositionstart: (evt) => evt instanceof CompositionEvent,
- compositionupdate: (evt) => evt instanceof CompositionEvent,
- compositionend: (evt) => evt instanceof CompositionEvent
- };
- const _hoisted_1$D = ["type", "disabled", "readonly", "autocomplete", "tabindex", "aria-label", "placeholder"];
- const _hoisted_2$u = ["tabindex", "disabled", "readonly", "autocomplete", "aria-label", "placeholder"];
- const __default__$k = {
- name: "ElInput",
- inheritAttrs: false
- };
- const _sfc_main$15 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$k), {
- props: inputProps,
- emits: inputEmits,
- setup(__props, { expose, emit }) {
- const props = __props;
- const PENDANT_MAP = {
- suffix: "append",
- prefix: "prepend"
- };
- const instance = getCurrentInstance();
- const rawAttrs = useAttrs$1();
- const slots = useSlots();
- const attrs = useAttrs();
- const { form, formItem } = useFormItem();
- const inputSize = useSize();
- const inputDisabled = useDisabled$1();
- const nsInput = useNamespace("input");
- const nsTextarea = useNamespace("textarea");
- const input = shallowRef();
- const textarea = shallowRef();
- const focused = ref(false);
- const hovering = ref(false);
- const isComposing = ref(false);
- const passwordVisible = ref(false);
- const textareaCalcStyle = shallowRef(props.inputStyle);
- const _ref = computed(() => input.value || textarea.value);
- const needStatusIcon = computed(() => {
- var _a2;
- return (_a2 = form == null ? void 0 : form.statusIcon) != null ? _a2 : false;
- });
- const validateState = computed(() => (formItem == null ? void 0 : formItem.validateState) || "");
- const validateIcon = computed(() => ValidateComponentsMap[validateState.value]);
- const passwordIcon = computed(() => passwordVisible.value ? view : hide$2);
- const containerStyle = computed(() => [
- rawAttrs.style,
- props.inputStyle
- ]);
- const textareaStyle = computed(() => [
- props.inputStyle,
- textareaCalcStyle.value,
- { resize: props.resize }
- ]);
- const nativeInputValue = computed(() => isNil(props.modelValue) ? "" : String(props.modelValue));
- const showClear = computed(() => props.clearable && !inputDisabled.value && !props.readonly && !!nativeInputValue.value && (focused.value || hovering.value));
- const showPwdVisible = computed(() => props.showPassword && !inputDisabled.value && !props.readonly && (!!nativeInputValue.value || focused.value));
- const isWordLimitVisible = computed(() => props.showWordLimit && !!attrs.value.maxlength && (props.type === "text" || props.type === "textarea") && !inputDisabled.value && !props.readonly && !props.showPassword);
- const textLength = computed(() => Array.from(nativeInputValue.value).length);
- const inputExceed = computed(() => !!isWordLimitVisible.value && textLength.value > Number(attrs.value.maxlength));
- const suffixVisible = computed(() => !!slots.suffix || !!props.suffixIcon || showClear.value || props.showPassword || isWordLimitVisible.value || !!validateState.value && needStatusIcon.value);
- const resizeTextarea = () => {
- const { type: type4, autosize } = props;
- if (!isClient || type4 !== "textarea")
- return;
- if (autosize) {
- const minRows = isObject$1(autosize) ? autosize.minRows : void 0;
- const maxRows = isObject$1(autosize) ? autosize.maxRows : void 0;
- textareaCalcStyle.value = __spreadValues({}, calcTextareaHeight(textarea.value, minRows, maxRows));
- } else {
- textareaCalcStyle.value = {
- minHeight: calcTextareaHeight(textarea.value).minHeight
- };
- }
- };
- const setNativeInputValue = () => {
- const input2 = _ref.value;
- if (!input2 || input2.value === nativeInputValue.value)
- return;
- input2.value = nativeInputValue.value;
- };
- const calcIconOffset = (place) => {
- const { el } = instance.vnode;
- if (!el)
- return;
- const elList = Array.from(el.querySelectorAll(`.${nsInput.e(place)}`));
- const target = elList.find((item) => item.parentNode === el);
- if (!target)
- return;
- const pendant = PENDANT_MAP[place];
- if (slots[pendant]) {
- target.style.transform = `translateX(${place === "suffix" ? "-" : ""}${el.querySelector(`.${nsInput.be("group", pendant)}`).offsetWidth}px)`;
- } else {
- target.removeAttribute("style");
- }
- };
- const updateIconOffset = () => {
- calcIconOffset("prefix");
- calcIconOffset("suffix");
- };
- const handleInput = async (event) => {
- const { value } = event.target;
- if (isComposing.value)
- return;
- if (value === nativeInputValue.value)
- return;
- emit(UPDATE_MODEL_EVENT, value);
- emit("input", value);
- await nextTick();
- setNativeInputValue();
- };
- const handleChange2 = (event) => {
- emit("change", event.target.value);
- };
- const handleCompositionStart = (event) => {
- emit("compositionstart", event);
- isComposing.value = true;
- };
- const handleCompositionUpdate = (event) => {
- var _a2;
- emit("compositionupdate", event);
- const text = (_a2 = event.target) == null ? void 0 : _a2.value;
- const lastCharacter = text[text.length - 1] || "";
- isComposing.value = !isKorean(lastCharacter);
- };
- const handleCompositionEnd = (event) => {
- emit("compositionend", event);
- if (isComposing.value) {
- isComposing.value = false;
- handleInput(event);
- }
- };
- const handlePasswordVisible = () => {
- passwordVisible.value = !passwordVisible.value;
- focus();
- };
- const focus = async () => {
- var _a2;
- await nextTick();
- (_a2 = _ref.value) == null ? void 0 : _a2.focus();
- };
- const blur = () => {
- var _a2;
- return (_a2 = _ref.value) == null ? void 0 : _a2.blur();
- };
- const handleFocus = (event) => {
- focused.value = true;
- emit("focus", event);
- };
- const handleBlur = (event) => {
- var _a2;
- focused.value = false;
- emit("blur", event);
- if (props.validateEvent) {
- (_a2 = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a2.call(formItem, "blur").catch((err) => debugWarn());
- }
- };
- const handleMouseLeave = (evt) => {
- hovering.value = false;
- emit("mouseleave", evt);
- };
- const handleMouseEnter = (evt) => {
- hovering.value = true;
- emit("mouseenter", evt);
- };
- const handleKeydown = (evt) => {
- emit("keydown", evt);
- };
- const select = () => {
- var _a2;
- (_a2 = _ref.value) == null ? void 0 : _a2.select();
- };
- const clear = () => {
- emit(UPDATE_MODEL_EVENT, "");
- emit("change", "");
- emit("clear");
- emit("input", "");
- };
- watch(() => props.modelValue, () => {
- var _a2;
- nextTick(() => resizeTextarea());
- if (props.validateEvent) {
- (_a2 = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a2.call(formItem, "change").catch((err) => debugWarn());
- }
- });
- watch(nativeInputValue, () => setNativeInputValue());
- watch(() => props.type, async () => {
- await nextTick();
- setNativeInputValue();
- resizeTextarea();
- updateIconOffset();
- });
- onMounted(async () => {
- setNativeInputValue();
- updateIconOffset();
- await nextTick();
- resizeTextarea();
- });
- onUpdated(async () => {
- await nextTick();
- updateIconOffset();
- });
- expose({
- input,
- textarea,
- ref: _ref,
- textareaStyle,
- autosize: toRef(props, "autosize"),
- focus,
- blur,
- select,
- clear,
- resizeTextarea
- });
- return (_ctx, _cache) => {
- return withDirectives((openBlock(), createElementBlock("div", {
- class: normalizeClass([
- _ctx.type === "textarea" ? unref(nsTextarea).b() : unref(nsInput).b(),
- unref(nsInput).m(unref(inputSize)),
- unref(nsInput).is("disabled", unref(inputDisabled)),
- unref(nsInput).is("exceed", unref(inputExceed)),
- {
- [unref(nsInput).b("group")]: _ctx.$slots.prepend || _ctx.$slots.append,
- [unref(nsInput).bm("group", "append")]: _ctx.$slots.append,
- [unref(nsInput).bm("group", "prepend")]: _ctx.$slots.prepend,
- [unref(nsInput).m("prefix")]: _ctx.$slots.prefix || _ctx.prefixIcon,
- [unref(nsInput).m("suffix")]: _ctx.$slots.suffix || _ctx.suffixIcon || _ctx.clearable || _ctx.showPassword,
- [unref(nsInput).bm("suffix", "password-clear")]: unref(showClear) && unref(showPwdVisible)
- },
- _ctx.$attrs.class
- ]),
- style: normalizeStyle(unref(containerStyle)),
- onMouseenter: handleMouseEnter,
- onMouseleave: handleMouseLeave
- }, [
- createCommentVNode(" input "),
- _ctx.type !== "textarea" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
- createCommentVNode(" prepend slot "),
- _ctx.$slots.prepend ? (openBlock(), createElementBlock("div", {
- key: 0,
- class: normalizeClass(unref(nsInput).be("group", "prepend"))
- }, [
- renderSlot(_ctx.$slots, "prepend")
- ], 2)) : createCommentVNode("v-if", true),
- createElementVNode("div", {
- class: normalizeClass([unref(nsInput).e("wrapper"), unref(nsInput).is("focus", focused.value)])
- }, [
- createCommentVNode(" prefix slot "),
- _ctx.$slots.prefix || _ctx.prefixIcon ? (openBlock(), createElementBlock("span", {
- key: 0,
- class: normalizeClass(unref(nsInput).e("prefix"))
- }, [
- createElementVNode("span", {
- class: normalizeClass(unref(nsInput).e("prefix-inner"))
- }, [
- renderSlot(_ctx.$slots, "prefix"),
- _ctx.prefixIcon ? (openBlock(), createBlock(unref(ElIcon), {
- key: 0,
- class: normalizeClass(unref(nsInput).e("icon"))
- }, {
- default: withCtx(() => [
- (openBlock(), createBlock(resolveDynamicComponent(_ctx.prefixIcon)))
- ]),
- _: 1
- }, 8, ["class"])) : createCommentVNode("v-if", true)
- ], 2)
- ], 2)) : createCommentVNode("v-if", true),
- createElementVNode("input", mergeProps({
- ref_key: "input",
- ref: input,
- class: unref(nsInput).e("inner")
- }, unref(attrs), {
- type: _ctx.showPassword ? passwordVisible.value ? "text" : "password" : _ctx.type,
- disabled: unref(inputDisabled),
- readonly: _ctx.readonly,
- autocomplete: _ctx.autocomplete,
- tabindex: _ctx.tabindex,
- "aria-label": _ctx.label,
- placeholder: _ctx.placeholder,
- style: _ctx.inputStyle,
- onCompositionstart: handleCompositionStart,
- onCompositionupdate: handleCompositionUpdate,
- onCompositionend: handleCompositionEnd,
- onInput: handleInput,
- onFocus: handleFocus,
- onBlur: handleBlur,
- onChange: handleChange2,
- onKeydown: handleKeydown
- }), null, 16, _hoisted_1$D),
- createCommentVNode(" suffix slot "),
- unref(suffixVisible) ? (openBlock(), createElementBlock("span", {
- key: 1,
- class: normalizeClass(unref(nsInput).e("suffix"))
- }, [
- createElementVNode("span", {
- class: normalizeClass(unref(nsInput).e("suffix-inner"))
- }, [
- !unref(showClear) || !unref(showPwdVisible) || !unref(isWordLimitVisible) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
- renderSlot(_ctx.$slots, "suffix"),
- _ctx.suffixIcon ? (openBlock(), createBlock(unref(ElIcon), {
- key: 0,
- class: normalizeClass(unref(nsInput).e("icon"))
- }, {
- default: withCtx(() => [
- (openBlock(), createBlock(resolveDynamicComponent(_ctx.suffixIcon)))
- ]),
- _: 1
- }, 8, ["class"])) : createCommentVNode("v-if", true)
- ], 64)) : createCommentVNode("v-if", true),
- unref(showClear) ? (openBlock(), createBlock(unref(ElIcon), {
- key: 1,
- class: normalizeClass([unref(nsInput).e("icon"), unref(nsInput).e("clear")]),
- onMousedown: _cache[0] || (_cache[0] = withModifiers(() => {
- }, ["prevent"])),
- onClick: clear
- }, {
- default: withCtx(() => [
- createVNode(unref(circleClose))
- ]),
- _: 1
- }, 8, ["class"])) : createCommentVNode("v-if", true),
- unref(showPwdVisible) ? (openBlock(), createBlock(unref(ElIcon), {
- key: 2,
- class: normalizeClass([unref(nsInput).e("icon"), unref(nsInput).e("password")]),
- onClick: handlePasswordVisible
- }, {
- default: withCtx(() => [
- (openBlock(), createBlock(resolveDynamicComponent(unref(passwordIcon))))
- ]),
- _: 1
- }, 8, ["class"])) : createCommentVNode("v-if", true),
- unref(isWordLimitVisible) ? (openBlock(), createElementBlock("span", {
- key: 3,
- class: normalizeClass(unref(nsInput).e("count"))
- }, [
- createElementVNode("span", {
- class: normalizeClass(unref(nsInput).e("count-inner"))
- }, toDisplayString(unref(textLength)) + " / " + toDisplayString(unref(attrs).maxlength), 3)
- ], 2)) : createCommentVNode("v-if", true)
- ], 2),
- unref(validateState) && unref(validateIcon) && unref(needStatusIcon) ? (openBlock(), createBlock(unref(ElIcon), {
- key: 0,
- class: normalizeClass([
- unref(nsInput).e("icon"),
- unref(nsInput).e("validateIcon"),
- unref(nsInput).is("loading", unref(validateState) === "validating")
- ])
- }, {
- default: withCtx(() => [
- (openBlock(), createBlock(resolveDynamicComponent(unref(validateIcon))))
- ]),
- _: 1
- }, 8, ["class"])) : createCommentVNode("v-if", true)
- ], 2)) : createCommentVNode("v-if", true)
- ], 2),
- createCommentVNode(" append slot "),
- _ctx.$slots.append ? (openBlock(), createElementBlock("div", {
- key: 1,
- class: normalizeClass(unref(nsInput).be("group", "append"))
- }, [
- renderSlot(_ctx.$slots, "append")
- ], 2)) : createCommentVNode("v-if", true)
- ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
- createCommentVNode(" textarea "),
- createElementVNode("textarea", mergeProps({
- ref_key: "textarea",
- ref: textarea,
- class: unref(nsTextarea).e("inner")
- }, unref(attrs), {
- tabindex: _ctx.tabindex,
- disabled: unref(inputDisabled),
- readonly: _ctx.readonly,
- autocomplete: _ctx.autocomplete,
- style: unref(textareaStyle),
- "aria-label": _ctx.label,
- placeholder: _ctx.placeholder,
- onCompositionstart: handleCompositionStart,
- onCompositionupdate: handleCompositionUpdate,
- onCompositionend: handleCompositionEnd,
- onInput: handleInput,
- onFocus: handleFocus,
- onBlur: handleBlur,
- onChange: handleChange2,
- onKeydown: handleKeydown
- }), null, 16, _hoisted_2$u),
- unref(isWordLimitVisible) ? (openBlock(), createElementBlock("span", {
- key: 0,
- class: normalizeClass(unref(nsInput).e("count"))
- }, toDisplayString(unref(textLength)) + " / " + toDisplayString(unref(attrs).maxlength), 3)) : createCommentVNode("v-if", true)
- ], 64))
- ], 38)), [
- [vShow, _ctx.type !== "hidden"]
- ]);
- };
- }
- }));
- var Input = /* @__PURE__ */ _export_sfc$1(_sfc_main$15, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/input/src/input.vue"]]);
- const ElInput = withInstall(Input);
- const BAR_MAP = {
- vertical: {
- offset: "offsetHeight",
- scroll: "scrollTop",
- scrollSize: "scrollHeight",
- size: "height",
- key: "vertical",
- axis: "Y",
- client: "clientY",
- direction: "top"
- },
- horizontal: {
- offset: "offsetWidth",
- scroll: "scrollLeft",
- scrollSize: "scrollWidth",
- size: "width",
- key: "horizontal",
- axis: "X",
- client: "clientX",
- direction: "left"
- }
- };
- const renderThumbStyle = ({ move, size, bar }) => ({
- [bar.size]: size,
- transform: `translate${bar.axis}(${move}%)`
- });
- const thumbProps = buildProps({
- vertical: Boolean,
- size: String,
- move: Number,
- ratio: {
- type: Number,
- required: true
- },
- always: Boolean
- });
- const COMPONENT_NAME$4 = "Thumb";
- const _sfc_main$14 = defineComponent({
- name: COMPONENT_NAME$4,
- props: thumbProps,
- setup(props) {
- const scrollbar = inject(scrollbarContextKey);
- const ns = useNamespace("scrollbar");
- if (!scrollbar)
- throwError(COMPONENT_NAME$4, "can not inject scrollbar context");
- const instance = ref();
- const thumb = ref();
- const thumbState = ref({});
- const visible = ref(false);
- let cursorDown = false;
- let cursorLeave = false;
- let originalOnSelectStart = isClient ? document.onselectstart : null;
- const bar = computed(() => BAR_MAP[props.vertical ? "vertical" : "horizontal"]);
- const thumbStyle = computed(() => renderThumbStyle({
- size: props.size,
- move: props.move,
- bar: bar.value
- }));
- const offsetRatio = computed(() => instance.value[bar.value.offset] ** 2 / scrollbar.wrapElement[bar.value.scrollSize] / props.ratio / thumb.value[bar.value.offset]);
- const clickThumbHandler = (e) => {
- var _a2;
- e.stopPropagation();
- if (e.ctrlKey || [1, 2].includes(e.button))
- return;
- (_a2 = window.getSelection()) == null ? void 0 : _a2.removeAllRanges();
- startDrag(e);
- const el = e.currentTarget;
- if (!el)
- return;
- thumbState.value[bar.value.axis] = el[bar.value.offset] - (e[bar.value.client] - el.getBoundingClientRect()[bar.value.direction]);
- };
- const clickTrackHandler = (e) => {
- if (!thumb.value || !instance.value || !scrollbar.wrapElement)
- return;
- const offset2 = Math.abs(e.target.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]);
- const thumbHalf = thumb.value[bar.value.offset] / 2;
- const thumbPositionPercentage = (offset2 - thumbHalf) * 100 * offsetRatio.value / instance.value[bar.value.offset];
- scrollbar.wrapElement[bar.value.scroll] = thumbPositionPercentage * scrollbar.wrapElement[bar.value.scrollSize] / 100;
- };
- const startDrag = (e) => {
- e.stopImmediatePropagation();
- cursorDown = true;
- document.addEventListener("mousemove", mouseMoveDocumentHandler);
- document.addEventListener("mouseup", mouseUpDocumentHandler);
- originalOnSelectStart = document.onselectstart;
- document.onselectstart = () => false;
- };
- const mouseMoveDocumentHandler = (e) => {
- if (!instance.value || !thumb.value)
- return;
- if (cursorDown === false)
- return;
- const prevPage = thumbState.value[bar.value.axis];
- if (!prevPage)
- return;
- const offset2 = (instance.value.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]) * -1;
- const thumbClickPosition = thumb.value[bar.value.offset] - prevPage;
- const thumbPositionPercentage = (offset2 - thumbClickPosition) * 100 * offsetRatio.value / instance.value[bar.value.offset];
- scrollbar.wrapElement[bar.value.scroll] = thumbPositionPercentage * scrollbar.wrapElement[bar.value.scrollSize] / 100;
- };
- const mouseUpDocumentHandler = () => {
- cursorDown = false;
- thumbState.value[bar.value.axis] = 0;
- document.removeEventListener("mousemove", mouseMoveDocumentHandler);
- document.removeEventListener("mouseup", mouseUpDocumentHandler);
- restoreOnselectstart();
- if (cursorLeave)
- visible.value = false;
- };
- const mouseMoveScrollbarHandler = () => {
- cursorLeave = false;
- visible.value = !!props.size;
- };
- const mouseLeaveScrollbarHandler = () => {
- cursorLeave = true;
- visible.value = cursorDown;
- };
- onBeforeUnmount(() => {
- restoreOnselectstart();
- document.removeEventListener("mouseup", mouseUpDocumentHandler);
- });
- const restoreOnselectstart = () => {
- if (document.onselectstart !== originalOnSelectStart)
- document.onselectstart = originalOnSelectStart;
- };
- useEventListener(toRef(scrollbar, "scrollbarElement"), "mousemove", mouseMoveScrollbarHandler);
- useEventListener(toRef(scrollbar, "scrollbarElement"), "mouseleave", mouseLeaveScrollbarHandler);
- return {
- ns,
- instance,
- thumb,
- bar,
- thumbStyle,
- visible,
- clickTrackHandler,
- clickThumbHandler
- };
- }
- });
- function _sfc_render$D(_ctx, _cache, $props, $setup, $data, $options) {
- return openBlock(), createBlock(Transition, {
- name: _ctx.ns.b("fade")
- }, {
- default: withCtx(() => [
- withDirectives(createElementVNode("div", {
- ref: "instance",
- class: normalizeClass([_ctx.ns.e("bar"), _ctx.ns.is(_ctx.bar.key)]),
- onMousedown: _cache[1] || (_cache[1] = (...args) => _ctx.clickTrackHandler && _ctx.clickTrackHandler(...args))
- }, [
- createElementVNode("div", {
- ref: "thumb",
- class: normalizeClass(_ctx.ns.e("thumb")),
- style: normalizeStyle(_ctx.thumbStyle),
- onMousedown: _cache[0] || (_cache[0] = (...args) => _ctx.clickThumbHandler && _ctx.clickThumbHandler(...args))
- }, null, 38)
- ], 34), [
- [vShow, _ctx.always || _ctx.visible]
- ])
- ]),
- _: 1
- }, 8, ["name"]);
- }
- 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"]]);
- const barProps = buildProps({
- always: {
- type: Boolean,
- default: true
- },
- width: {
- type: String,
- default: ""
- },
- height: {
- type: String,
- default: ""
- },
- ratioX: {
- type: Number,
- default: 1
- },
- ratioY: {
- type: Number,
- default: 1
- }
- });
- const _sfc_main$13 = defineComponent({
- components: {
- Thumb
- },
- props: barProps,
- setup(props) {
- const moveX = ref(0);
- const moveY = ref(0);
- const GAP = 4;
- const handleScroll = (wrap) => {
- if (wrap) {
- const offsetHeight = wrap.offsetHeight - GAP;
- const offsetWidth = wrap.offsetWidth - GAP;
- moveY.value = wrap.scrollTop * 100 / offsetHeight * props.ratioY;
- moveX.value = wrap.scrollLeft * 100 / offsetWidth * props.ratioX;
- }
- };
- return {
- handleScroll,
- moveX,
- moveY
- };
- }
- });
- function _sfc_render$C(_ctx, _cache, $props, $setup, $data, $options) {
- const _component_thumb = resolveComponent("thumb");
- return openBlock(), createElementBlock(Fragment, null, [
- createVNode(_component_thumb, {
- move: _ctx.moveX,
- ratio: _ctx.ratioX,
- size: _ctx.width,
- always: _ctx.always
- }, null, 8, ["move", "ratio", "size", "always"]),
- createVNode(_component_thumb, {
- move: _ctx.moveY,
- ratio: _ctx.ratioY,
- size: _ctx.height,
- vertical: "",
- always: _ctx.always
- }, null, 8, ["move", "ratio", "size", "always"])
- ], 64);
- }
- 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"]]);
- const scrollbarProps = buildProps({
- height: {
- type: [String, Number],
- default: ""
- },
- maxHeight: {
- type: [String, Number],
- default: ""
- },
- native: {
- type: Boolean,
- default: false
- },
- wrapStyle: {
- type: definePropType([String, Object, Array]),
- default: ""
- },
- wrapClass: {
- type: [String, Array],
- default: ""
- },
- viewClass: {
- type: [String, Array],
- default: ""
- },
- viewStyle: {
- type: [String, Array, Object],
- default: ""
- },
- noresize: Boolean,
- tag: {
- type: String,
- default: "div"
- },
- always: {
- type: Boolean,
- default: false
- },
- minSize: {
- type: Number,
- default: 20
- }
- });
- const scrollbarEmits = {
- scroll: ({
- scrollTop,
- scrollLeft
- }) => isNumber(scrollTop) && isNumber(scrollLeft)
- };
- const _sfc_main$12 = defineComponent({
- name: "ElScrollbar",
- components: {
- Bar
- },
- props: scrollbarProps,
- emits: scrollbarEmits,
- setup(props, { emit }) {
- const ns = useNamespace("scrollbar");
- let stopResizeObserver = void 0;
- let stopResizeListener = void 0;
- const scrollbar$ = ref();
- const wrap$ = ref();
- const resize$ = ref();
- const sizeWidth = ref("0");
- const sizeHeight = ref("0");
- const barRef = ref();
- const moveX = ref(0);
- const moveY = ref(0);
- const ratioY = ref(1);
- const ratioX = ref(1);
- const GAP = 4;
- const style = computed(() => {
- const style2 = {};
- if (props.height)
- style2.height = addUnit(props.height);
- if (props.maxHeight)
- style2.maxHeight = addUnit(props.maxHeight);
- return [props.wrapStyle, style2];
- });
- const handleScroll = () => {
- var _a2;
- if (wrap$.value) {
- (_a2 = barRef.value) == null ? void 0 : _a2.handleScroll(wrap$.value);
- emit("scroll", {
- scrollTop: wrap$.value.scrollTop,
- scrollLeft: wrap$.value.scrollLeft
- });
- }
- };
- function scrollTo(arg1, arg2) {
- if (isObject$1(arg1)) {
- wrap$.value.scrollTo(arg1);
- } else if (isNumber(arg1) && isNumber(arg2)) {
- wrap$.value.scrollTo(arg1, arg2);
- }
- }
- const setScrollTop = (value) => {
- if (!isNumber(value)) {
- return;
- }
- wrap$.value.scrollTop = value;
- };
- const setScrollLeft = (value) => {
- if (!isNumber(value)) {
- return;
- }
- wrap$.value.scrollLeft = value;
- };
- const update = () => {
- if (!wrap$.value)
- return;
- const offsetHeight = wrap$.value.offsetHeight - GAP;
- const offsetWidth = wrap$.value.offsetWidth - GAP;
- const originalHeight = offsetHeight ** 2 / wrap$.value.scrollHeight;
- const originalWidth = offsetWidth ** 2 / wrap$.value.scrollWidth;
- const height = Math.max(originalHeight, props.minSize);
- const width = Math.max(originalWidth, props.minSize);
- ratioY.value = originalHeight / (offsetHeight - originalHeight) / (height / (offsetHeight - height));
- ratioX.value = originalWidth / (offsetWidth - originalWidth) / (width / (offsetWidth - width));
- sizeHeight.value = height + GAP < offsetHeight ? `${height}px` : "";
- sizeWidth.value = width + GAP < offsetWidth ? `${width}px` : "";
- };
- watch(() => props.noresize, (noresize) => {
- if (noresize) {
- stopResizeObserver == null ? void 0 : stopResizeObserver();
- stopResizeListener == null ? void 0 : stopResizeListener();
- } else {
- ({ stop: stopResizeObserver } = useResizeObserver(resize$, update));
- stopResizeListener = useEventListener("resize", update);
- }
- }, { immediate: true });
- watch(() => [props.maxHeight, props.height], () => {
- if (!props.native)
- nextTick(() => {
- var _a2;
- update();
- if (wrap$.value) {
- (_a2 = barRef.value) == null ? void 0 : _a2.handleScroll(wrap$.value);
- }
- });
- });
- provide(scrollbarContextKey, reactive({
- scrollbarElement: scrollbar$,
- wrapElement: wrap$
- }));
- onMounted(() => {
- if (!props.native)
- nextTick(() => update());
- });
- onUpdated(() => update());
- return {
- ns,
- scrollbar$,
- wrap$,
- resize$,
- barRef,
- moveX,
- moveY,
- ratioX,
- ratioY,
- sizeWidth,
- sizeHeight,
- style,
- update,
- handleScroll,
- scrollTo,
- setScrollTop,
- setScrollLeft
- };
- }
- });
- function _sfc_render$B(_ctx, _cache, $props, $setup, $data, $options) {
- const _component_bar = resolveComponent("bar");
- return openBlock(), createElementBlock("div", {
- ref: "scrollbar$",
- class: normalizeClass(_ctx.ns.b())
- }, [
- createElementVNode("div", {
- ref: "wrap$",
- class: normalizeClass([
- _ctx.wrapClass,
- _ctx.ns.e("wrap"),
- { [_ctx.ns.em("wrap", "hidden-default")]: !_ctx.native }
- ]),
- style: normalizeStyle(_ctx.style),
- onScroll: _cache[0] || (_cache[0] = (...args) => _ctx.handleScroll && _ctx.handleScroll(...args))
- }, [
- (openBlock(), createBlock(resolveDynamicComponent(_ctx.tag), {
- ref: "resize$",
- class: normalizeClass([_ctx.ns.e("view"), _ctx.viewClass]),
- style: normalizeStyle(_ctx.viewStyle)
- }, {
- default: withCtx(() => [
- renderSlot(_ctx.$slots, "default")
- ]),
- _: 3
- }, 8, ["class", "style"]))
- ], 38),
- !_ctx.native ? (openBlock(), createBlock(_component_bar, {
- key: 0,
- ref: "barRef",
- height: _ctx.sizeHeight,
- width: _ctx.sizeWidth,
- always: _ctx.always,
- "ratio-x": _ctx.ratioX,
- "ratio-y": _ctx.ratioY
- }, null, 8, ["height", "width", "always", "ratio-x", "ratio-y"])) : createCommentVNode("v-if", true)
- ], 2);
- }
- 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"]]);
- const ElScrollbar = withInstall(Scrollbar);
- const __default__$j = {
- name: "ElPopperRoot",
- inheritAttrs: false
- };
- const _sfc_main$11 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$j), {
- setup(__props, { expose }) {
- const triggerRef2 = ref();
- const popperInstanceRef = ref();
- const contentRef = ref();
- const referenceRef = ref();
- const popperProvides = {
- triggerRef: triggerRef2,
- popperInstanceRef,
- contentRef,
- referenceRef
- };
- expose(popperProvides);
- provide(POPPER_INJECTION_KEY, popperProvides);
- return (_ctx, _cache) => {
- return renderSlot(_ctx.$slots, "default");
- };
- }
- }));
- var Popper = /* @__PURE__ */ _export_sfc$1(_sfc_main$11, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/popper/src/popper.vue"]]);
- const usePopperArrowProps = buildProps({
- arrowOffset: {
- type: Number,
- default: 5
- }
- });
- const __default__$i = {
- name: "ElPopperArrow",
- inheritAttrs: false
- };
- const _sfc_main$10 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$i), {
- props: usePopperArrowProps,
- setup(__props, { expose }) {
- const props = __props;
- const ns = useNamespace("popper");
- const { arrowOffset, arrowRef } = inject(POPPER_CONTENT_INJECTION_KEY, void 0);
- watch(() => props.arrowOffset, (val) => {
- arrowOffset.value = val;
- });
- onBeforeUnmount(() => {
- arrowRef.value = void 0;
- });
- expose({
- arrowRef
- });
- return (_ctx, _cache) => {
- return openBlock(), createElementBlock("span", {
- ref_key: "arrowRef",
- ref: arrowRef,
- class: normalizeClass(unref(ns).e("arrow")),
- "data-popper-arrow": ""
- }, null, 2);
- };
- }
- }));
- var ElPopperArrow = /* @__PURE__ */ _export_sfc$1(_sfc_main$10, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/popper/src/arrow.vue"]]);
- const NAME = "ElOnlyChild";
- const OnlyChild = defineComponent({
- name: NAME,
- setup(_2, {
- slots,
- attrs
- }) {
- var _a2;
- const forwardRefInjection = inject(FORWARD_REF_INJECTION_KEY);
- const forwardRefDirective = useForwardRefDirective((_a2 = forwardRefInjection == null ? void 0 : forwardRefInjection.setForwardRef) != null ? _a2 : NOOP);
- return () => {
- var _a22;
- const defaultSlot = (_a22 = slots.default) == null ? void 0 : _a22.call(slots, attrs);
- if (!defaultSlot)
- return null;
- if (defaultSlot.length > 1) {
- return null;
- }
- const firstLegitNode = findFirstLegitChild(defaultSlot);
- if (!firstLegitNode) {
- return null;
- }
- return withDirectives(cloneVNode(firstLegitNode, attrs), [[forwardRefDirective]]);
- };
- }
- });
- function findFirstLegitChild(node) {
- if (!node)
- return null;
- const children = node;
- for (const child of children) {
- if (isObject$1(child)) {
- switch (child.type) {
- case Comment:
- continue;
- case Text:
- return wrapTextContent(child);
- case "svg":
- return wrapTextContent(child);
- case Fragment:
- return findFirstLegitChild(child.children);
- default:
- return child;
- }
- }
- return wrapTextContent(child);
- }
- return null;
- }
- function wrapTextContent(s2) {
- return createVNode("span", {
- "class": "el-only-child__content"
- }, [s2]);
- }
- const usePopperTriggerProps = buildProps({
- virtualRef: {
- type: definePropType(Object)
- },
- virtualTriggering: Boolean,
- onMouseenter: Function,
- onMouseleave: Function,
- onClick: Function,
- onKeydown: Function,
- onFocus: Function,
- onBlur: Function,
- onContextmenu: Function,
- id: String,
- open: Boolean
- });
- const __default__$h = {
- name: "ElPopperTrigger",
- inheritAttrs: false
- };
- const _sfc_main$$ = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$h), {
- props: usePopperTriggerProps,
- setup(__props, { expose }) {
- const props = __props;
- const { triggerRef: triggerRef2 } = inject(POPPER_INJECTION_KEY, void 0);
- useForwardRef(triggerRef2);
- onMounted(() => {
- watch(() => props.virtualRef, (virtualEl) => {
- if (virtualEl) {
- triggerRef2.value = unrefElement(virtualEl);
- }
- }, {
- immediate: true
- });
- watch(() => triggerRef2.value, (el, prevEl) => {
- if (isElement$1(el)) {
- [
- "onMouseenter",
- "onMouseleave",
- "onClick",
- "onKeydown",
- "onFocus",
- "onBlur",
- "onContextmenu"
- ].forEach((eventName) => {
- var _a2;
- const handler3 = props[eventName];
- if (handler3) {
- el.addEventListener(eventName.slice(2).toLowerCase(), handler3);
- (_a2 = prevEl == null ? void 0 : prevEl.removeEventListener) == null ? void 0 : _a2.call(prevEl, eventName.slice(2).toLowerCase(), handler3);
- }
- });
- }
- }, {
- immediate: true
- });
- });
- expose({
- triggerRef: triggerRef2
- });
- return (_ctx, _cache) => {
- return !_ctx.virtualTriggering ? (openBlock(), createBlock(unref(OnlyChild), mergeProps({ key: 0 }, _ctx.$attrs, {
- "aria-describedby": _ctx.open ? _ctx.id : void 0
- }), {
- default: withCtx(() => [
- renderSlot(_ctx.$slots, "default")
- ]),
- _: 3
- }, 16, ["aria-describedby"])) : createCommentVNode("v-if", true);
- };
- }
- }));
- var ElPopperTrigger = /* @__PURE__ */ _export_sfc$1(_sfc_main$$, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/popper/src/trigger.vue"]]);
- var top = "top";
- var bottom = "bottom";
- var right = "right";
- var left = "left";
- var auto = "auto";
- var basePlacements = [top, bottom, right, left];
- var start = "start";
- var end = "end";
- var clippingParents = "clippingParents";
- var viewport = "viewport";
- var popper = "popper";
- var reference = "reference";
- var variationPlacements = /* @__PURE__ */ basePlacements.reduce(function(acc, placement) {
- return acc.concat([placement + "-" + start, placement + "-" + end]);
- }, []);
- var placements = /* @__PURE__ */ [].concat(basePlacements, [auto]).reduce(function(acc, placement) {
- return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
- }, []);
- var beforeRead = "beforeRead";
- var read = "read";
- var afterRead = "afterRead";
- var beforeMain = "beforeMain";
- var main = "main";
- var afterMain = "afterMain";
- var beforeWrite = "beforeWrite";
- var write = "write";
- var afterWrite = "afterWrite";
- var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
- function getNodeName(element) {
- return element ? (element.nodeName || "").toLowerCase() : null;
- }
- function getWindow(node) {
- if (node == null) {
- return window;
- }
- if (node.toString() !== "[object Window]") {
- var ownerDocument = node.ownerDocument;
- return ownerDocument ? ownerDocument.defaultView || window : window;
- }
- return node;
- }
- function isElement(node) {
- var OwnElement = getWindow(node).Element;
- return node instanceof OwnElement || node instanceof Element;
- }
- function isHTMLElement(node) {
- var OwnElement = getWindow(node).HTMLElement;
- return node instanceof OwnElement || node instanceof HTMLElement;
- }
- function isShadowRoot(node) {
- if (typeof ShadowRoot === "undefined") {
- return false;
- }
- var OwnElement = getWindow(node).ShadowRoot;
- return node instanceof OwnElement || node instanceof ShadowRoot;
- }
- function applyStyles(_ref) {
- var state = _ref.state;
- Object.keys(state.elements).forEach(function(name) {
- var style = state.styles[name] || {};
- var attributes = state.attributes[name] || {};
- var element = state.elements[name];
- if (!isHTMLElement(element) || !getNodeName(element)) {
- return;
- }
- Object.assign(element.style, style);
- Object.keys(attributes).forEach(function(name2) {
- var value = attributes[name2];
- if (value === false) {
- element.removeAttribute(name2);
- } else {
- element.setAttribute(name2, value === true ? "" : value);
- }
- });
- });
- }
- function effect$2(_ref2) {
- var state = _ref2.state;
- var initialStyles = {
- popper: {
- position: state.options.strategy,
- left: "0",
- top: "0",
- margin: "0"
- },
- arrow: {
- position: "absolute"
- },
- reference: {}
- };
- Object.assign(state.elements.popper.style, initialStyles.popper);
- state.styles = initialStyles;
- if (state.elements.arrow) {
- Object.assign(state.elements.arrow.style, initialStyles.arrow);
- }
- return function() {
- Object.keys(state.elements).forEach(function(name) {
- var element = state.elements[name];
- var attributes = state.attributes[name] || {};
- var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]);
- var style = styleProperties.reduce(function(style2, property) {
- style2[property] = "";
- return style2;
- }, {});
- if (!isHTMLElement(element) || !getNodeName(element)) {
- return;
- }
- Object.assign(element.style, style);
- Object.keys(attributes).forEach(function(attribute) {
- element.removeAttribute(attribute);
- });
- });
- };
- }
- var applyStyles$1 = {
- name: "applyStyles",
- enabled: true,
- phase: "write",
- fn: applyStyles,
- effect: effect$2,
- requires: ["computeStyles"]
- };
- function getBasePlacement(placement) {
- return placement.split("-")[0];
- }
- var max = Math.max;
- var min = Math.min;
- var round = Math.round;
- function getUAString() {
- var uaData = navigator.userAgentData;
- if (uaData != null && uaData.brands && Array.isArray(uaData.brands)) {
- return uaData.brands.map(function(item) {
- return item.brand + "/" + item.version;
- }).join(" ");
- }
- return navigator.userAgent;
- }
- function isLayoutViewport() {
- return !/^((?!chrome|android).)*safari/i.test(getUAString());
- }
- function getBoundingClientRect(element, includeScale, isFixedStrategy) {
- if (includeScale === void 0) {
- includeScale = false;
- }
- if (isFixedStrategy === void 0) {
- isFixedStrategy = false;
- }
- var clientRect = element.getBoundingClientRect();
- var scaleX = 1;
- var scaleY = 1;
- if (includeScale && isHTMLElement(element)) {
- scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
- scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
- }
- var _ref = isElement(element) ? getWindow(element) : window, visualViewport = _ref.visualViewport;
- var addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
- var x2 = (clientRect.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX;
- var y = (clientRect.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY;
- var width = clientRect.width / scaleX;
- var height = clientRect.height / scaleY;
- return {
- width,
- height,
- top: y,
- right: x2 + width,
- bottom: y + height,
- left: x2,
- x: x2,
- y
- };
- }
- function getLayoutRect(element) {
- var clientRect = getBoundingClientRect(element);
- var width = element.offsetWidth;
- var height = element.offsetHeight;
- if (Math.abs(clientRect.width - width) <= 1) {
- width = clientRect.width;
- }
- if (Math.abs(clientRect.height - height) <= 1) {
- height = clientRect.height;
- }
- return {
- x: element.offsetLeft,
- y: element.offsetTop,
- width,
- height
- };
- }
- function contains(parent, child) {
- var rootNode = child.getRootNode && child.getRootNode();
- if (parent.contains(child)) {
- return true;
- } else if (rootNode && isShadowRoot(rootNode)) {
- var next = child;
- do {
- if (next && parent.isSameNode(next)) {
- return true;
- }
- next = next.parentNode || next.host;
- } while (next);
- }
- return false;
- }
- function getComputedStyle$1(element) {
- return getWindow(element).getComputedStyle(element);
- }
- function isTableElement(element) {
- return ["table", "td", "th"].indexOf(getNodeName(element)) >= 0;
- }
- function getDocumentElement(element) {
- return ((isElement(element) ? element.ownerDocument : element.document) || window.document).documentElement;
- }
- function getParentNode(element) {
- if (getNodeName(element) === "html") {
- return element;
- }
- return element.assignedSlot || element.parentNode || (isShadowRoot(element) ? element.host : null) || getDocumentElement(element);
- }
- function getTrueOffsetParent(element) {
- if (!isHTMLElement(element) || getComputedStyle$1(element).position === "fixed") {
- return null;
- }
- return element.offsetParent;
- }
- function getContainingBlock(element) {
- var isFirefox2 = /firefox/i.test(getUAString());
- var isIE = /Trident/i.test(getUAString());
- if (isIE && isHTMLElement(element)) {
- var elementCss = getComputedStyle$1(element);
- if (elementCss.position === "fixed") {
- return null;
- }
- }
- var currentNode = getParentNode(element);
- if (isShadowRoot(currentNode)) {
- currentNode = currentNode.host;
- }
- while (isHTMLElement(currentNode) && ["html", "body"].indexOf(getNodeName(currentNode)) < 0) {
- var css = getComputedStyle$1(currentNode);
- 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") {
- return currentNode;
- } else {
- currentNode = currentNode.parentNode;
- }
- }
- return null;
- }
- function getOffsetParent(element) {
- var window2 = getWindow(element);
- var offsetParent = getTrueOffsetParent(element);
- while (offsetParent && isTableElement(offsetParent) && getComputedStyle$1(offsetParent).position === "static") {
- offsetParent = getTrueOffsetParent(offsetParent);
- }
- if (offsetParent && (getNodeName(offsetParent) === "html" || getNodeName(offsetParent) === "body" && getComputedStyle$1(offsetParent).position === "static")) {
- return window2;
- }
- return offsetParent || getContainingBlock(element) || window2;
- }
- function getMainAxisFromPlacement(placement) {
- return ["top", "bottom"].indexOf(placement) >= 0 ? "x" : "y";
- }
- function within(min$1, value, max$1) {
- return max(min$1, min(value, max$1));
- }
- function withinMaxClamp(min2, value, max2) {
- var v2 = within(min2, value, max2);
- return v2 > max2 ? max2 : v2;
- }
- function getFreshSideObject() {
- return {
- top: 0,
- right: 0,
- bottom: 0,
- left: 0
- };
- }
- function mergePaddingObject(paddingObject) {
- return Object.assign({}, getFreshSideObject(), paddingObject);
- }
- function expandToHashMap(value, keys2) {
- return keys2.reduce(function(hashMap, key) {
- hashMap[key] = value;
- return hashMap;
- }, {});
- }
- var toPaddingObject = function toPaddingObject2(padding, state) {
- padding = typeof padding === "function" ? padding(Object.assign({}, state.rects, {
- placement: state.placement
- })) : padding;
- return mergePaddingObject(typeof padding !== "number" ? padding : expandToHashMap(padding, basePlacements));
- };
- function arrow(_ref) {
- var _state$modifiersData$;
- var state = _ref.state, name = _ref.name, options = _ref.options;
- var arrowElement = state.elements.arrow;
- var popperOffsets2 = state.modifiersData.popperOffsets;
- var basePlacement = getBasePlacement(state.placement);
- var axis = getMainAxisFromPlacement(basePlacement);
- var isVertical = [left, right].indexOf(basePlacement) >= 0;
- var len = isVertical ? "height" : "width";
- if (!arrowElement || !popperOffsets2) {
- return;
- }
- var paddingObject = toPaddingObject(options.padding, state);
- var arrowRect = getLayoutRect(arrowElement);
- var minProp = axis === "y" ? top : left;
- var maxProp = axis === "y" ? bottom : right;
- var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets2[axis] - state.rects.popper[len];
- var startDiff = popperOffsets2[axis] - state.rects.reference[axis];
- var arrowOffsetParent = getOffsetParent(arrowElement);
- var clientSize = arrowOffsetParent ? axis === "y" ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
- var centerToReference = endDiff / 2 - startDiff / 2;
- var min2 = paddingObject[minProp];
- var max2 = clientSize - arrowRect[len] - paddingObject[maxProp];
- var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;
- var offset2 = within(min2, center, max2);
- var axisProp = axis;
- state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset2, _state$modifiersData$.centerOffset = offset2 - center, _state$modifiersData$);
- }
- function effect$1(_ref2) {
- var state = _ref2.state, options = _ref2.options;
- var _options$element = options.element, arrowElement = _options$element === void 0 ? "[data-popper-arrow]" : _options$element;
- if (arrowElement == null) {
- return;
- }
- if (typeof arrowElement === "string") {
- arrowElement = state.elements.popper.querySelector(arrowElement);
- if (!arrowElement) {
- return;
- }
- }
- if (!contains(state.elements.popper, arrowElement)) {
- return;
- }
- state.elements.arrow = arrowElement;
- }
- var arrow$1 = {
- name: "arrow",
- enabled: true,
- phase: "main",
- fn: arrow,
- effect: effect$1,
- requires: ["popperOffsets"],
- requiresIfExists: ["preventOverflow"]
- };
- function getVariation(placement) {
- return placement.split("-")[1];
- }
- var unsetSides = {
- top: "auto",
- right: "auto",
- bottom: "auto",
- left: "auto"
- };
- function roundOffsetsByDPR(_ref, win) {
- var x2 = _ref.x, y = _ref.y;
- var dpr = win.devicePixelRatio || 1;
- return {
- x: round(x2 * dpr) / dpr || 0,
- y: round(y * dpr) / dpr || 0
- };
- }
- function mapToStyles(_ref2) {
- var _Object$assign2;
- 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;
- 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;
- var _ref3 = typeof roundOffsets === "function" ? roundOffsets({
- x: x2,
- y
- }) : {
- x: x2,
- y
- };
- x2 = _ref3.x;
- y = _ref3.y;
- var hasX = offsets.hasOwnProperty("x");
- var hasY = offsets.hasOwnProperty("y");
- var sideX = left;
- var sideY = top;
- var win = window;
- if (adaptive) {
- var offsetParent = getOffsetParent(popper2);
- var heightProp = "clientHeight";
- var widthProp = "clientWidth";
- if (offsetParent === getWindow(popper2)) {
- offsetParent = getDocumentElement(popper2);
- if (getComputedStyle$1(offsetParent).position !== "static" && position === "absolute") {
- heightProp = "scrollHeight";
- widthProp = "scrollWidth";
- }
- }
- offsetParent = offsetParent;
- if (placement === top || (placement === left || placement === right) && variation === end) {
- sideY = bottom;
- var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : offsetParent[heightProp];
- y -= offsetY - popperRect.height;
- y *= gpuAcceleration ? 1 : -1;
- }
- if (placement === left || (placement === top || placement === bottom) && variation === end) {
- sideX = right;
- var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : offsetParent[widthProp];
- x2 -= offsetX - popperRect.width;
- x2 *= gpuAcceleration ? 1 : -1;
- }
- }
- var commonStyles = Object.assign({
- position
- }, adaptive && unsetSides);
- var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
- x: x2,
- y
- }, getWindow(popper2)) : {
- x: x2,
- y
- };
- x2 = _ref4.x;
- y = _ref4.y;
- if (gpuAcceleration) {
- var _Object$assign;
- 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));
- }
- return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : "", _Object$assign2[sideX] = hasX ? x2 + "px" : "", _Object$assign2.transform = "", _Object$assign2));
- }
- function computeStyles(_ref5) {
- var state = _ref5.state, options = _ref5.options;
- 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;
- var commonStyles = {
- placement: getBasePlacement(state.placement),
- variation: getVariation(state.placement),
- popper: state.elements.popper,
- popperRect: state.rects.popper,
- gpuAcceleration,
- isFixed: state.options.strategy === "fixed"
- };
- if (state.modifiersData.popperOffsets != null) {
- state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
- offsets: state.modifiersData.popperOffsets,
- position: state.options.strategy,
- adaptive,
- roundOffsets
- })));
- }
- if (state.modifiersData.arrow != null) {
- state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
- offsets: state.modifiersData.arrow,
- position: "absolute",
- adaptive: false,
- roundOffsets
- })));
- }
- state.attributes.popper = Object.assign({}, state.attributes.popper, {
- "data-popper-placement": state.placement
- });
- }
- var computeStyles$1 = {
- name: "computeStyles",
- enabled: true,
- phase: "beforeWrite",
- fn: computeStyles,
- data: {}
- };
- var passive = {
- passive: true
- };
- function effect(_ref) {
- var state = _ref.state, instance = _ref.instance, options = _ref.options;
- 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;
- var window2 = getWindow(state.elements.popper);
- var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
- if (scroll) {
- scrollParents.forEach(function(scrollParent) {
- scrollParent.addEventListener("scroll", instance.update, passive);
- });
- }
- if (resize) {
- window2.addEventListener("resize", instance.update, passive);
- }
- return function() {
- if (scroll) {
- scrollParents.forEach(function(scrollParent) {
- scrollParent.removeEventListener("scroll", instance.update, passive);
- });
- }
- if (resize) {
- window2.removeEventListener("resize", instance.update, passive);
- }
- };
- }
- var eventListeners = {
- name: "eventListeners",
- enabled: true,
- phase: "write",
- fn: function fn() {
- },
- effect,
- data: {}
- };
- var hash$1 = {
- left: "right",
- right: "left",
- bottom: "top",
- top: "bottom"
- };
- function getOppositePlacement(placement) {
- return placement.replace(/left|right|bottom|top/g, function(matched) {
- return hash$1[matched];
- });
- }
- var hash = {
- start: "end",
- end: "start"
- };
- function getOppositeVariationPlacement(placement) {
- return placement.replace(/start|end/g, function(matched) {
- return hash[matched];
- });
- }
- function getWindowScroll(node) {
- var win = getWindow(node);
- var scrollLeft = win.pageXOffset;
- var scrollTop = win.pageYOffset;
- return {
- scrollLeft,
- scrollTop
- };
- }
- function getWindowScrollBarX(element) {
- return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
- }
- function getViewportRect(element, strategy) {
- var win = getWindow(element);
- var html = getDocumentElement(element);
- var visualViewport = win.visualViewport;
- var width = html.clientWidth;
- var height = html.clientHeight;
- var x2 = 0;
- var y = 0;
- if (visualViewport) {
- width = visualViewport.width;
- height = visualViewport.height;
- var layoutViewport = isLayoutViewport();
- if (layoutViewport || !layoutViewport && strategy === "fixed") {
- x2 = visualViewport.offsetLeft;
- y = visualViewport.offsetTop;
- }
- }
- return {
- width,
- height,
- x: x2 + getWindowScrollBarX(element),
- y
- };
- }
- function getDocumentRect(element) {
- var _element$ownerDocumen;
- var html = getDocumentElement(element);
- var winScroll = getWindowScroll(element);
- var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
- var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
- var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
- var x2 = -winScroll.scrollLeft + getWindowScrollBarX(element);
- var y = -winScroll.scrollTop;
- if (getComputedStyle$1(body || html).direction === "rtl") {
- x2 += max(html.clientWidth, body ? body.clientWidth : 0) - width;
- }
- return {
- width,
- height,
- x: x2,
- y
- };
- }
- function isScrollParent(element) {
- var _getComputedStyle = getComputedStyle$1(element), overflow = _getComputedStyle.overflow, overflowX = _getComputedStyle.overflowX, overflowY = _getComputedStyle.overflowY;
- return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
- }
- function getScrollParent(node) {
- if (["html", "body", "#document"].indexOf(getNodeName(node)) >= 0) {
- return node.ownerDocument.body;
- }
- if (isHTMLElement(node) && isScrollParent(node)) {
- return node;
- }
- return getScrollParent(getParentNode(node));
- }
- function listScrollParents(element, list) {
- var _element$ownerDocumen;
- if (list === void 0) {
- list = [];
- }
- var scrollParent = getScrollParent(element);
- var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
- var win = getWindow(scrollParent);
- var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
- var updatedList = list.concat(target);
- return isBody ? updatedList : updatedList.concat(listScrollParents(getParentNode(target)));
- }
- function rectToClientRect(rect) {
- return Object.assign({}, rect, {
- left: rect.x,
- top: rect.y,
- right: rect.x + rect.width,
- bottom: rect.y + rect.height
- });
- }
- function getInnerBoundingClientRect(element, strategy) {
- var rect = getBoundingClientRect(element, false, strategy === "fixed");
- rect.top = rect.top + element.clientTop;
- rect.left = rect.left + element.clientLeft;
- rect.bottom = rect.top + element.clientHeight;
- rect.right = rect.left + element.clientWidth;
- rect.width = element.clientWidth;
- rect.height = element.clientHeight;
- rect.x = rect.left;
- rect.y = rect.top;
- return rect;
- }
- function getClientRectFromMixedType(element, clippingParent, strategy) {
- return clippingParent === viewport ? rectToClientRect(getViewportRect(element, strategy)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent, strategy) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
- }
- function getClippingParents(element) {
- var clippingParents2 = listScrollParents(getParentNode(element));
- var canEscapeClipping = ["absolute", "fixed"].indexOf(getComputedStyle$1(element).position) >= 0;
- var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
- if (!isElement(clipperElement)) {
- return [];
- }
- return clippingParents2.filter(function(clippingParent) {
- return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== "body";
- });
- }
- function getClippingRect(element, boundary, rootBoundary, strategy) {
- var mainClippingParents = boundary === "clippingParents" ? getClippingParents(element) : [].concat(boundary);
- var clippingParents2 = [].concat(mainClippingParents, [rootBoundary]);
- var firstClippingParent = clippingParents2[0];
- var clippingRect = clippingParents2.reduce(function(accRect, clippingParent) {
- var rect = getClientRectFromMixedType(element, clippingParent, strategy);
- accRect.top = max(rect.top, accRect.top);
- accRect.right = min(rect.right, accRect.right);
- accRect.bottom = min(rect.bottom, accRect.bottom);
- accRect.left = max(rect.left, accRect.left);
- return accRect;
- }, getClientRectFromMixedType(element, firstClippingParent, strategy));
- clippingRect.width = clippingRect.right - clippingRect.left;
- clippingRect.height = clippingRect.bottom - clippingRect.top;
- clippingRect.x = clippingRect.left;
- clippingRect.y = clippingRect.top;
- return clippingRect;
- }
- function computeOffsets(_ref) {
- var reference2 = _ref.reference, element = _ref.element, placement = _ref.placement;
- var basePlacement = placement ? getBasePlacement(placement) : null;
- var variation = placement ? getVariation(placement) : null;
- var commonX = reference2.x + reference2.width / 2 - element.width / 2;
- var commonY = reference2.y + reference2.height / 2 - element.height / 2;
- var offsets;
- switch (basePlacement) {
- case top:
- offsets = {
- x: commonX,
- y: reference2.y - element.height
- };
- break;
- case bottom:
- offsets = {
- x: commonX,
- y: reference2.y + reference2.height
- };
- break;
- case right:
- offsets = {
- x: reference2.x + reference2.width,
- y: commonY
- };
- break;
- case left:
- offsets = {
- x: reference2.x - element.width,
- y: commonY
- };
- break;
- default:
- offsets = {
- x: reference2.x,
- y: reference2.y
- };
- }
- var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
- if (mainAxis != null) {
- var len = mainAxis === "y" ? "height" : "width";
- switch (variation) {
- case start:
- offsets[mainAxis] = offsets[mainAxis] - (reference2[len] / 2 - element[len] / 2);
- break;
- case end:
- offsets[mainAxis] = offsets[mainAxis] + (reference2[len] / 2 - element[len] / 2);
- break;
- }
- }
- return offsets;
- }
- function detectOverflow(state, options) {
- if (options === void 0) {
- options = {};
- }
- 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;
- var paddingObject = mergePaddingObject(typeof padding !== "number" ? padding : expandToHashMap(padding, basePlacements));
- var altContext = elementContext === popper ? reference : popper;
- var popperRect = state.rects.popper;
- var element = state.elements[altBoundary ? altContext : elementContext];
- var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary, strategy);
- var referenceClientRect = getBoundingClientRect(state.elements.reference);
- var popperOffsets2 = computeOffsets({
- reference: referenceClientRect,
- element: popperRect,
- strategy: "absolute",
- placement
- });
- var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets2));
- var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect;
- var overflowOffsets = {
- top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
- bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
- left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
- right: elementClientRect.right - clippingClientRect.right + paddingObject.right
- };
- var offsetData = state.modifiersData.offset;
- if (elementContext === popper && offsetData) {
- var offset2 = offsetData[placement];
- Object.keys(overflowOffsets).forEach(function(key) {
- var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;
- var axis = [top, bottom].indexOf(key) >= 0 ? "y" : "x";
- overflowOffsets[key] += offset2[axis] * multiply;
- });
- }
- return overflowOffsets;
- }
- function computeAutoPlacement(state, options) {
- if (options === void 0) {
- options = {};
- }
- 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;
- var variation = getVariation(placement);
- var placements$1 = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function(placement2) {
- return getVariation(placement2) === variation;
- }) : basePlacements;
- var allowedPlacements = placements$1.filter(function(placement2) {
- return allowedAutoPlacements.indexOf(placement2) >= 0;
- });
- if (allowedPlacements.length === 0) {
- allowedPlacements = placements$1;
- }
- var overflows = allowedPlacements.reduce(function(acc, placement2) {
- acc[placement2] = detectOverflow(state, {
- placement: placement2,
- boundary,
- rootBoundary,
- padding
- })[getBasePlacement(placement2)];
- return acc;
- }, {});
- return Object.keys(overflows).sort(function(a2, b2) {
- return overflows[a2] - overflows[b2];
- });
- }
- function getExpandedFallbackPlacements(placement) {
- if (getBasePlacement(placement) === auto) {
- return [];
- }
- var oppositePlacement = getOppositePlacement(placement);
- return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];
- }
- function flip(_ref) {
- var state = _ref.state, options = _ref.options, name = _ref.name;
- if (state.modifiersData[name]._skip) {
- return;
- }
- 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;
- var preferredPlacement = state.options.placement;
- var basePlacement = getBasePlacement(preferredPlacement);
- var isBasePlacement = basePlacement === preferredPlacement;
- var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));
- var placements2 = [preferredPlacement].concat(fallbackPlacements).reduce(function(acc, placement2) {
- return acc.concat(getBasePlacement(placement2) === auto ? computeAutoPlacement(state, {
- placement: placement2,
- boundary,
- rootBoundary,
- padding,
- flipVariations,
- allowedAutoPlacements
- }) : placement2);
- }, []);
- var referenceRect = state.rects.reference;
- var popperRect = state.rects.popper;
- var checksMap = /* @__PURE__ */ new Map();
- var makeFallbackChecks = true;
- var firstFittingPlacement = placements2[0];
- for (var i = 0; i < placements2.length; i++) {
- var placement = placements2[i];
- var _basePlacement = getBasePlacement(placement);
- var isStartVariation = getVariation(placement) === start;
- var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;
- var len = isVertical ? "width" : "height";
- var overflow = detectOverflow(state, {
- placement,
- boundary,
- rootBoundary,
- altBoundary,
- padding
- });
- var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top;
- if (referenceRect[len] > popperRect[len]) {
- mainVariationSide = getOppositePlacement(mainVariationSide);
- }
- var altVariationSide = getOppositePlacement(mainVariationSide);
- var checks = [];
- if (checkMainAxis) {
- checks.push(overflow[_basePlacement] <= 0);
- }
- if (checkAltAxis) {
- checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);
- }
- if (checks.every(function(check2) {
- return check2;
- })) {
- firstFittingPlacement = placement;
- makeFallbackChecks = false;
- break;
- }
- checksMap.set(placement, checks);
- }
- if (makeFallbackChecks) {
- var numberOfChecks = flipVariations ? 3 : 1;
- var _loop = function _loop2(_i2) {
- var fittingPlacement = placements2.find(function(placement2) {
- var checks2 = checksMap.get(placement2);
- if (checks2) {
- return checks2.slice(0, _i2).every(function(check2) {
- return check2;
- });
- }
- });
- if (fittingPlacement) {
- firstFittingPlacement = fittingPlacement;
- return "break";
- }
- };
- for (var _i = numberOfChecks; _i > 0; _i--) {
- var _ret = _loop(_i);
- if (_ret === "break")
- break;
- }
- }
- if (state.placement !== firstFittingPlacement) {
- state.modifiersData[name]._skip = true;
- state.placement = firstFittingPlacement;
- state.reset = true;
- }
- }
- var flip$1 = {
- name: "flip",
- enabled: true,
- phase: "main",
- fn: flip,
- requiresIfExists: ["offset"],
- data: {
- _skip: false
- }
- };
- function getSideOffsets(overflow, rect, preventedOffsets) {
- if (preventedOffsets === void 0) {
- preventedOffsets = {
- x: 0,
- y: 0
- };
- }
- return {
- top: overflow.top - rect.height - preventedOffsets.y,
- right: overflow.right - rect.width + preventedOffsets.x,
- bottom: overflow.bottom - rect.height + preventedOffsets.y,
- left: overflow.left - rect.width - preventedOffsets.x
- };
- }
- function isAnySideFullyClipped(overflow) {
- return [top, right, bottom, left].some(function(side) {
- return overflow[side] >= 0;
- });
- }
- function hide(_ref) {
- var state = _ref.state, name = _ref.name;
- var referenceRect = state.rects.reference;
- var popperRect = state.rects.popper;
- var preventedOffsets = state.modifiersData.preventOverflow;
- var referenceOverflow = detectOverflow(state, {
- elementContext: "reference"
- });
- var popperAltOverflow = detectOverflow(state, {
- altBoundary: true
- });
- var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);
- var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);
- var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);
- var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);
- state.modifiersData[name] = {
- referenceClippingOffsets,
- popperEscapeOffsets,
- isReferenceHidden,
- hasPopperEscaped
- };
- state.attributes.popper = Object.assign({}, state.attributes.popper, {
- "data-popper-reference-hidden": isReferenceHidden,
- "data-popper-escaped": hasPopperEscaped
- });
- }
- var hide$1 = {
- name: "hide",
- enabled: true,
- phase: "main",
- requiresIfExists: ["preventOverflow"],
- fn: hide
- };
- function distanceAndSkiddingToXY(placement, rects, offset2) {
- var basePlacement = getBasePlacement(placement);
- var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;
- var _ref = typeof offset2 === "function" ? offset2(Object.assign({}, rects, {
- placement
- })) : offset2, skidding = _ref[0], distance = _ref[1];
- skidding = skidding || 0;
- distance = (distance || 0) * invertDistance;
- return [left, right].indexOf(basePlacement) >= 0 ? {
- x: distance,
- y: skidding
- } : {
- x: skidding,
- y: distance
- };
- }
- function offset(_ref2) {
- var state = _ref2.state, options = _ref2.options, name = _ref2.name;
- var _options$offset = options.offset, offset2 = _options$offset === void 0 ? [0, 0] : _options$offset;
- var data2 = placements.reduce(function(acc, placement) {
- acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset2);
- return acc;
- }, {});
- var _data$state$placement = data2[state.placement], x2 = _data$state$placement.x, y = _data$state$placement.y;
- if (state.modifiersData.popperOffsets != null) {
- state.modifiersData.popperOffsets.x += x2;
- state.modifiersData.popperOffsets.y += y;
- }
- state.modifiersData[name] = data2;
- }
- var offset$1 = {
- name: "offset",
- enabled: true,
- phase: "main",
- requires: ["popperOffsets"],
- fn: offset
- };
- function popperOffsets(_ref) {
- var state = _ref.state, name = _ref.name;
- state.modifiersData[name] = computeOffsets({
- reference: state.rects.reference,
- element: state.rects.popper,
- strategy: "absolute",
- placement: state.placement
- });
- }
- var popperOffsets$1 = {
- name: "popperOffsets",
- enabled: true,
- phase: "read",
- fn: popperOffsets,
- data: {}
- };
- function getAltAxis(axis) {
- return axis === "x" ? "y" : "x";
- }
- function preventOverflow(_ref) {
- var state = _ref.state, options = _ref.options, name = _ref.name;
- 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;
- var overflow = detectOverflow(state, {
- boundary,
- rootBoundary,
- padding,
- altBoundary
- });
- var basePlacement = getBasePlacement(state.placement);
- var variation = getVariation(state.placement);
- var isBasePlacement = !variation;
- var mainAxis = getMainAxisFromPlacement(basePlacement);
- var altAxis = getAltAxis(mainAxis);
- var popperOffsets2 = state.modifiersData.popperOffsets;
- var referenceRect = state.rects.reference;
- var popperRect = state.rects.popper;
- var tetherOffsetValue = typeof tetherOffset === "function" ? tetherOffset(Object.assign({}, state.rects, {
- placement: state.placement
- })) : tetherOffset;
- var normalizedTetherOffsetValue = typeof tetherOffsetValue === "number" ? {
- mainAxis: tetherOffsetValue,
- altAxis: tetherOffsetValue
- } : Object.assign({
- mainAxis: 0,
- altAxis: 0
- }, tetherOffsetValue);
- var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;
- var data2 = {
- x: 0,
- y: 0
- };
- if (!popperOffsets2) {
- return;
- }
- if (checkMainAxis) {
- var _offsetModifierState$;
- var mainSide = mainAxis === "y" ? top : left;
- var altSide = mainAxis === "y" ? bottom : right;
- var len = mainAxis === "y" ? "height" : "width";
- var offset2 = popperOffsets2[mainAxis];
- var min$1 = offset2 + overflow[mainSide];
- var max$1 = offset2 - overflow[altSide];
- var additive = tether ? -popperRect[len] / 2 : 0;
- var minLen = variation === start ? referenceRect[len] : popperRect[len];
- var maxLen = variation === start ? -popperRect[len] : -referenceRect[len];
- var arrowElement = state.elements.arrow;
- var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {
- width: 0,
- height: 0
- };
- var arrowPaddingObject = state.modifiersData["arrow#persistent"] ? state.modifiersData["arrow#persistent"].padding : getFreshSideObject();
- var arrowPaddingMin = arrowPaddingObject[mainSide];
- var arrowPaddingMax = arrowPaddingObject[altSide];
- var arrowLen = within(0, referenceRect[len], arrowRect[len]);
- var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;
- var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;
- var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
- var clientOffset = arrowOffsetParent ? mainAxis === "y" ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
- var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;
- var tetherMin = offset2 + minOffset - offsetModifierValue - clientOffset;
- var tetherMax = offset2 + maxOffset - offsetModifierValue;
- var preventedOffset = within(tether ? min(min$1, tetherMin) : min$1, offset2, tether ? max(max$1, tetherMax) : max$1);
- popperOffsets2[mainAxis] = preventedOffset;
- data2[mainAxis] = preventedOffset - offset2;
- }
- if (checkAltAxis) {
- var _offsetModifierState$2;
- var _mainSide = mainAxis === "x" ? top : left;
- var _altSide = mainAxis === "x" ? bottom : right;
- var _offset = popperOffsets2[altAxis];
- var _len = altAxis === "y" ? "height" : "width";
- var _min = _offset + overflow[_mainSide];
- var _max = _offset - overflow[_altSide];
- var isOriginSide = [top, left].indexOf(basePlacement) !== -1;
- var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;
- var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;
- var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;
- var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);
- popperOffsets2[altAxis] = _preventedOffset;
- data2[altAxis] = _preventedOffset - _offset;
- }
- state.modifiersData[name] = data2;
- }
- var preventOverflow$1 = {
- name: "preventOverflow",
- enabled: true,
- phase: "main",
- fn: preventOverflow,
- requiresIfExists: ["offset"]
- };
- function getHTMLElementScroll(element) {
- return {
- scrollLeft: element.scrollLeft,
- scrollTop: element.scrollTop
- };
- }
- function getNodeScroll(node) {
- if (node === getWindow(node) || !isHTMLElement(node)) {
- return getWindowScroll(node);
- } else {
- return getHTMLElementScroll(node);
- }
- }
- function isElementScaled(element) {
- var rect = element.getBoundingClientRect();
- var scaleX = round(rect.width) / element.offsetWidth || 1;
- var scaleY = round(rect.height) / element.offsetHeight || 1;
- return scaleX !== 1 || scaleY !== 1;
- }
- function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
- if (isFixed === void 0) {
- isFixed = false;
- }
- var isOffsetParentAnElement = isHTMLElement(offsetParent);
- var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
- var documentElement = getDocumentElement(offsetParent);
- var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled, isFixed);
- var scroll = {
- scrollLeft: 0,
- scrollTop: 0
- };
- var offsets = {
- x: 0,
- y: 0
- };
- if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
- if (getNodeName(offsetParent) !== "body" || isScrollParent(documentElement)) {
- scroll = getNodeScroll(offsetParent);
- }
- if (isHTMLElement(offsetParent)) {
- offsets = getBoundingClientRect(offsetParent, true);
- offsets.x += offsetParent.clientLeft;
- offsets.y += offsetParent.clientTop;
- } else if (documentElement) {
- offsets.x = getWindowScrollBarX(documentElement);
- }
- }
- return {
- x: rect.left + scroll.scrollLeft - offsets.x,
- y: rect.top + scroll.scrollTop - offsets.y,
- width: rect.width,
- height: rect.height
- };
- }
- function order(modifiers) {
- var map = /* @__PURE__ */ new Map();
- var visited = /* @__PURE__ */ new Set();
- var result = [];
- modifiers.forEach(function(modifier) {
- map.set(modifier.name, modifier);
- });
- function sort(modifier) {
- visited.add(modifier.name);
- var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);
- requires.forEach(function(dep) {
- if (!visited.has(dep)) {
- var depModifier = map.get(dep);
- if (depModifier) {
- sort(depModifier);
- }
- }
- });
- result.push(modifier);
- }
- modifiers.forEach(function(modifier) {
- if (!visited.has(modifier.name)) {
- sort(modifier);
- }
- });
- return result;
- }
- function orderModifiers(modifiers) {
- var orderedModifiers = order(modifiers);
- return modifierPhases.reduce(function(acc, phase) {
- return acc.concat(orderedModifiers.filter(function(modifier) {
- return modifier.phase === phase;
- }));
- }, []);
- }
- function debounce(fn2) {
- var pending;
- return function() {
- if (!pending) {
- pending = new Promise(function(resolve) {
- Promise.resolve().then(function() {
- pending = void 0;
- resolve(fn2());
- });
- });
- }
- return pending;
- };
- }
- function mergeByName(modifiers) {
- var merged = modifiers.reduce(function(merged2, current) {
- var existing = merged2[current.name];
- merged2[current.name] = existing ? Object.assign({}, existing, current, {
- options: Object.assign({}, existing.options, current.options),
- data: Object.assign({}, existing.data, current.data)
- }) : current;
- return merged2;
- }, {});
- return Object.keys(merged).map(function(key) {
- return merged[key];
- });
- }
- var DEFAULT_OPTIONS = {
- placement: "bottom",
- modifiers: [],
- strategy: "absolute"
- };
- function areValidElements() {
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
- args[_key] = arguments[_key];
- }
- return !args.some(function(element) {
- return !(element && typeof element.getBoundingClientRect === "function");
- });
- }
- function popperGenerator(generatorOptions) {
- if (generatorOptions === void 0) {
- generatorOptions = {};
- }
- 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;
- return function createPopper2(reference2, popper2, options) {
- if (options === void 0) {
- options = defaultOptions;
- }
- var state = {
- placement: "bottom",
- orderedModifiers: [],
- options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
- modifiersData: {},
- elements: {
- reference: reference2,
- popper: popper2
- },
- attributes: {},
- styles: {}
- };
- var effectCleanupFns = [];
- var isDestroyed = false;
- var instance = {
- state,
- setOptions: function setOptions(setOptionsAction) {
- var options2 = typeof setOptionsAction === "function" ? setOptionsAction(state.options) : setOptionsAction;
- cleanupModifierEffects();
- state.options = Object.assign({}, defaultOptions, state.options, options2);
- state.scrollParents = {
- reference: isElement(reference2) ? listScrollParents(reference2) : reference2.contextElement ? listScrollParents(reference2.contextElement) : [],
- popper: listScrollParents(popper2)
- };
- var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers2, state.options.modifiers)));
- state.orderedModifiers = orderedModifiers.filter(function(m2) {
- return m2.enabled;
- });
- runModifierEffects();
- return instance.update();
- },
- forceUpdate: function forceUpdate() {
- if (isDestroyed) {
- return;
- }
- var _state$elements = state.elements, reference3 = _state$elements.reference, popper3 = _state$elements.popper;
- if (!areValidElements(reference3, popper3)) {
- return;
- }
- state.rects = {
- reference: getCompositeRect(reference3, getOffsetParent(popper3), state.options.strategy === "fixed"),
- popper: getLayoutRect(popper3)
- };
- state.reset = false;
- state.placement = state.options.placement;
- state.orderedModifiers.forEach(function(modifier) {
- return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
- });
- for (var index = 0; index < state.orderedModifiers.length; index++) {
- if (state.reset === true) {
- state.reset = false;
- index = -1;
- continue;
- }
- 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;
- if (typeof fn2 === "function") {
- state = fn2({
- state,
- options: _options,
- name,
- instance
- }) || state;
- }
- }
- },
- update: debounce(function() {
- return new Promise(function(resolve) {
- instance.forceUpdate();
- resolve(state);
- });
- }),
- destroy: function destroy() {
- cleanupModifierEffects();
- isDestroyed = true;
- }
- };
- if (!areValidElements(reference2, popper2)) {
- return instance;
- }
- instance.setOptions(options).then(function(state2) {
- if (!isDestroyed && options.onFirstUpdate) {
- options.onFirstUpdate(state2);
- }
- });
- function runModifierEffects() {
- state.orderedModifiers.forEach(function(_ref) {
- var name = _ref.name, _ref$options = _ref.options, options2 = _ref$options === void 0 ? {} : _ref$options, effect2 = _ref.effect;
- if (typeof effect2 === "function") {
- var cleanupFn = effect2({
- state,
- name,
- instance,
- options: options2
- });
- var noopFn = function noopFn2() {
- };
- effectCleanupFns.push(cleanupFn || noopFn);
- }
- });
- }
- function cleanupModifierEffects() {
- effectCleanupFns.forEach(function(fn2) {
- return fn2();
- });
- effectCleanupFns = [];
- }
- return instance;
- };
- }
- var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$1];
- var createPopper = /* @__PURE__ */ popperGenerator({
- defaultModifiers
- });
- const POSITIONING_STRATEGIES = ["fixed", "absolute"];
- const usePopperCoreConfigProps = buildProps({
- boundariesPadding: {
- type: Number,
- default: 0
- },
- fallbackPlacements: {
- type: definePropType(Array),
- default: () => []
- },
- gpuAcceleration: {
- type: Boolean,
- default: true
- },
- offset: {
- type: Number,
- default: 12
- },
- placement: {
- type: String,
- values: placements,
- default: "bottom"
- },
- popperOptions: {
- type: definePropType(Object),
- default: () => ({})
- },
- strategy: {
- type: String,
- values: POSITIONING_STRATEGIES,
- default: "absolute"
- }
- });
- const usePopperContentProps = buildProps(__spreadProps(__spreadValues({}, usePopperCoreConfigProps), {
- style: { type: definePropType([String, Array, Object]) },
- className: { type: definePropType([String, Array, Object]) },
- effect: {
- type: String,
- default: "dark"
- },
- visible: Boolean,
- enterable: {
- type: Boolean,
- default: true
- },
- pure: Boolean,
- popperClass: {
- type: definePropType([String, Array, Object])
- },
- popperStyle: {
- type: definePropType([String, Array, Object])
- },
- referenceEl: {
- type: definePropType(Object)
- },
- stopPopperMouseEvent: {
- type: Boolean,
- default: true
- },
- zIndex: Number
- }));
- const buildPopperOptions = (props, arrowProps) => {
- const { placement, strategy, popperOptions: popperOptions2 } = props;
- const options = __spreadProps(__spreadValues({
- placement,
- strategy
- }, popperOptions2), {
- modifiers: genModifiers(props)
- });
- attachArrow(options, arrowProps);
- deriveExtraModifiers(options, popperOptions2 == null ? void 0 : popperOptions2.modifiers);
- return options;
- };
- const unwrapMeasurableEl = ($el) => {
- if (!isClient)
- return;
- return unrefElement($el);
- };
- function genModifiers(options) {
- const { offset: offset2, gpuAcceleration, fallbackPlacements } = options;
- return [
- {
- name: "offset",
- options: {
- offset: [0, offset2 != null ? offset2 : 12]
- }
- },
- {
- name: "preventOverflow",
- options: {
- padding: {
- top: 2,
- bottom: 2,
- left: 5,
- right: 5
- }
- }
- },
- {
- name: "flip",
- options: {
- padding: 5,
- fallbackPlacements: fallbackPlacements != null ? fallbackPlacements : []
- }
- },
- {
- name: "computeStyles",
- options: {
- gpuAcceleration,
- adaptive: gpuAcceleration
- }
- }
- ];
- }
- function attachArrow(options, { arrowEl, arrowOffset }) {
- options.modifiers.push({
- name: "arrow",
- options: {
- element: arrowEl,
- padding: arrowOffset != null ? arrowOffset : 5
- }
- });
- }
- function deriveExtraModifiers(options, modifiers) {
- if (modifiers) {
- options.modifiers = [...options.modifiers, ...modifiers != null ? modifiers : []];
- }
- }
- const __default__$g = {
- name: "ElPopperContent"
- };
- const _sfc_main$_ = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$g), {
- props: usePopperContentProps,
- emits: ["mouseenter", "mouseleave"],
- setup(__props, { expose }) {
- const props = __props;
- const { popperInstanceRef, contentRef, triggerRef: triggerRef2 } = inject(POPPER_INJECTION_KEY, void 0);
- const { nextZIndex } = useZIndex();
- const ns = useNamespace("popper");
- const popperContentRef = ref();
- const arrowRef = ref();
- const arrowOffset = ref();
- provide(POPPER_CONTENT_INJECTION_KEY, {
- arrowRef,
- arrowOffset
- });
- const contentZIndex = ref(props.zIndex || nextZIndex());
- const computedReference = computed(() => unwrapMeasurableEl(props.referenceEl) || unref(triggerRef2));
- const contentStyle = computed(() => [{ zIndex: unref(contentZIndex) }, props.popperStyle]);
- const contentClass = computed(() => [
- ns.b(),
- ns.is("pure", props.pure),
- ns.is(props.effect),
- props.popperClass
- ]);
- const createPopperInstance = ({ referenceEl, popperContentEl, arrowEl }) => {
- const options = buildPopperOptions(props, {
- arrowEl,
- arrowOffset: unref(arrowOffset)
- });
- return createPopper(referenceEl, popperContentEl, options);
- };
- const updatePopper = (shouldUpdateZIndex = true) => {
- var _a2;
- (_a2 = unref(popperInstanceRef)) == null ? void 0 : _a2.update();
- shouldUpdateZIndex && (contentZIndex.value = props.zIndex || nextZIndex());
- };
- const togglePopperAlive = () => {
- var _a2, _b2;
- const monitorable = { name: "eventListeners", enabled: props.visible };
- (_b2 = (_a2 = unref(popperInstanceRef)) == null ? void 0 : _a2.setOptions) == null ? void 0 : _b2.call(_a2, (options) => __spreadProps(__spreadValues({}, options), {
- modifiers: [...options.modifiers || [], monitorable]
- }));
- updatePopper(false);
- };
- onMounted(() => {
- let updateHandle;
- watch(computedReference, (referenceEl) => {
- var _a2;
- updateHandle == null ? void 0 : updateHandle();
- const popperInstance = unref(popperInstanceRef);
- (_a2 = popperInstance == null ? void 0 : popperInstance.destroy) == null ? void 0 : _a2.call(popperInstance);
- if (referenceEl) {
- const popperContentEl = unref(popperContentRef);
- contentRef.value = popperContentEl;
- popperInstanceRef.value = createPopperInstance({
- referenceEl,
- popperContentEl,
- arrowEl: unref(arrowRef)
- });
- updateHandle = watch(() => referenceEl.getBoundingClientRect(), () => updatePopper(), {
- immediate: true
- });
- } else {
- popperInstanceRef.value = void 0;
- }
- }, {
- immediate: true
- });
- watch(() => props.visible, togglePopperAlive, { immediate: true });
- watch(() => buildPopperOptions(props, {
- arrowEl: unref(arrowRef),
- arrowOffset: unref(arrowOffset)
- }), (option) => {
- var _a2;
- return (_a2 = popperInstanceRef.value) == null ? void 0 : _a2.setOptions(option);
- });
- });
- expose({
- popperContentRef,
- popperInstanceRef,
- updatePopper,
- contentStyle
- });
- return (_ctx, _cache) => {
- return openBlock(), createElementBlock("div", {
- ref_key: "popperContentRef",
- ref: popperContentRef,
- style: normalizeStyle(unref(contentStyle)),
- class: normalizeClass(unref(contentClass)),
- role: "tooltip",
- onMouseenter: _cache[0] || (_cache[0] = (e) => _ctx.$emit("mouseenter", e)),
- onMouseleave: _cache[1] || (_cache[1] = (e) => _ctx.$emit("mouseleave", e))
- }, [
- renderSlot(_ctx.$slots, "default")
- ], 38);
- };
- }
- }));
- var ElPopperContent = /* @__PURE__ */ _export_sfc$1(_sfc_main$_, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/popper/src/content.vue"]]);
- function useDeprecateAppendToBody(scope, from) {
- const vm = getCurrentInstance();
- const compatTeleported = computed(() => {
- return isBoolean(vm.props[from]) ? vm.props[from] : vm.props.teleported;
- });
- useDeprecated({
- scope,
- from,
- replacement: "teleported",
- version: "2.1.0",
- ref: "https://element-plus.org/en-US/component/tooltip.html#attributes"
- }, computed(() => isBoolean(vm.props[from])));
- return {
- compatTeleported
- };
- }
- const ElPopper = withInstall(Popper);
- const _sfc_main$Z = defineComponent({
- name: "ElVisuallyHidden",
- props: {
- style: {
- type: [String, Object, Array]
- }
- },
- setup(props) {
- return {
- computedStyle: computed(() => {
- return [
- props.style,
- {
- position: "absolute",
- border: 0,
- width: 1,
- height: 1,
- padding: 0,
- margin: -1,
- overflow: "hidden",
- clip: "rect(0, 0, 0, 0)",
- whiteSpace: "nowrap",
- wordWrap: "normal"
- }
- ];
- })
- };
- }
- });
- function _sfc_render$A(_ctx, _cache, $props, $setup, $data, $options) {
- return openBlock(), createElementBlock("span", mergeProps(_ctx.$attrs, { style: _ctx.computedStyle }), [
- renderSlot(_ctx.$slots, "default")
- ], 16);
- }
- 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"]]);
- const useTooltipContentProps = buildProps(__spreadProps(__spreadValues(__spreadValues({}, useDelayedToggleProps), usePopperContentProps), {
- appendTo: {
- type: definePropType([String, Object]),
- default: POPPER_CONTAINER_SELECTOR
- },
- content: {
- type: String,
- default: ""
- },
- rawContent: {
- type: Boolean,
- default: false
- },
- persistent: Boolean,
- ariaLabel: String,
- visible: {
- type: definePropType(Boolean),
- default: null
- },
- transition: {
- type: String,
- default: "el-fade-in-linear"
- },
- teleported: {
- type: Boolean,
- default: true
- },
- disabled: {
- type: Boolean
- }
- }));
- const useTooltipTriggerProps = buildProps(__spreadProps(__spreadValues({}, usePopperTriggerProps), {
- disabled: Boolean,
- trigger: {
- type: definePropType([String, Array]),
- default: "hover"
- }
- }));
- const useTooltipProps = buildProps({
- openDelay: {
- type: Number
- },
- visibleArrow: {
- type: Boolean,
- default: void 0
- },
- hideAfter: {
- type: Number,
- default: 200
- },
- showArrow: {
- type: Boolean,
- default: true
- }
- });
- const TOOLTIP_INJECTION_KEY = Symbol("elTooltip");
- const _sfc_main$Y = defineComponent({
- name: "ElTooltipContent",
- components: {
- ElPopperContent,
- ElVisuallyHidden
- },
- inheritAttrs: false,
- props: useTooltipContentProps,
- setup(props) {
- const contentRef = ref(null);
- const intermediateOpen = ref(false);
- const entering = ref(false);
- const leaving = ref(false);
- const destroyed = ref(false);
- const {
- controlled,
- id,
- open,
- trigger,
- onClose,
- onOpen,
- onShow,
- onHide,
- onBeforeShow,
- onBeforeHide
- } = inject(TOOLTIP_INJECTION_KEY, void 0);
- const persistentRef = computed(() => {
- return props.persistent;
- });
- onBeforeUnmount(() => {
- destroyed.value = true;
- });
- const shouldRender = computed(() => {
- return unref(persistentRef) ? true : unref(open);
- });
- const shouldShow = computed(() => {
- return props.disabled ? false : unref(open);
- });
- const contentStyle = computed(() => {
- var _a2;
- return (_a2 = props.style) != null ? _a2 : {};
- });
- const ariaHidden = computed(() => !unref(open));
- useEscapeKeydown(onClose);
- const onTransitionLeave = () => {
- onHide();
- };
- const stopWhenControlled = () => {
- if (unref(controlled))
- return true;
- };
- const onContentEnter = composeEventHandlers(stopWhenControlled, () => {
- if (props.enterable && unref(trigger) === "hover") {
- onOpen();
- }
- });
- const onContentLeave = composeEventHandlers(stopWhenControlled, () => {
- if (unref(trigger) === "hover") {
- onClose();
- }
- });
- const onBeforeEnter = () => {
- var _a2, _b2;
- (_b2 = (_a2 = contentRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b2.call(_a2);
- onBeforeShow == null ? void 0 : onBeforeShow();
- };
- const onBeforeLeave = () => {
- onBeforeHide == null ? void 0 : onBeforeHide();
- };
- const onAfterShow = () => {
- onShow();
- };
- let stopHandle;
- watch(() => unref(open), (val) => {
- if (val) {
- stopHandle = onClickOutside(computed(() => {
- var _a2;
- return (_a2 = contentRef.value) == null ? void 0 : _a2.popperContentRef;
- }), () => {
- if (unref(controlled))
- return;
- const $trigger = unref(trigger);
- if ($trigger !== "hover") {
- onClose();
- }
- });
- } else {
- stopHandle == null ? void 0 : stopHandle();
- }
- }, {
- flush: "post"
- });
- return {
- ariaHidden,
- entering,
- leaving,
- id,
- intermediateOpen,
- contentStyle,
- contentRef,
- destroyed,
- shouldRender,
- shouldShow,
- open,
- onAfterShow,
- onBeforeEnter,
- onBeforeLeave,
- onContentEnter,
- onContentLeave,
- onTransitionLeave
- };
- }
- });
- function _sfc_render$z(_ctx, _cache, $props, $setup, $data, $options) {
- const _component_el_visually_hidden = resolveComponent("el-visually-hidden");
- const _component_el_popper_content = resolveComponent("el-popper-content");
- return openBlock(), createBlock(Teleport, {
- disabled: !_ctx.teleported,
- to: _ctx.appendTo
- }, [
- createVNode(Transition, {
- name: _ctx.transition,
- onAfterLeave: _ctx.onTransitionLeave,
- onBeforeEnter: _ctx.onBeforeEnter,
- onAfterEnter: _ctx.onAfterShow,
- onBeforeLeave: _ctx.onBeforeLeave
- }, {
- default: withCtx(() => [
- _ctx.shouldRender ? withDirectives((openBlock(), createBlock(_component_el_popper_content, mergeProps({
- key: 0,
- ref: "contentRef"
- }, _ctx.$attrs, {
- "aria-hidden": _ctx.ariaHidden,
- "boundaries-padding": _ctx.boundariesPadding,
- "fallback-placements": _ctx.fallbackPlacements,
- "gpu-acceleration": _ctx.gpuAcceleration,
- offset: _ctx.offset,
- placement: _ctx.placement,
- "popper-options": _ctx.popperOptions,
- strategy: _ctx.strategy,
- effect: _ctx.effect,
- enterable: _ctx.enterable,
- pure: _ctx.pure,
- "popper-class": _ctx.popperClass,
- "popper-style": [_ctx.popperStyle, _ctx.contentStyle],
- "reference-el": _ctx.referenceEl,
- visible: _ctx.shouldShow,
- "z-index": _ctx.zIndex,
- onMouseenter: _ctx.onContentEnter,
- onMouseleave: _ctx.onContentLeave
- }), {
- default: withCtx(() => [
- createCommentVNode(" Workaround bug #6378 "),
- !_ctx.destroyed ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
- renderSlot(_ctx.$slots, "default"),
- createVNode(_component_el_visually_hidden, {
- id: _ctx.id,
- role: "tooltip"
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(_ctx.ariaLabel), 1)
- ]),
- _: 1
- }, 8, ["id"])
- ], 64)) : createCommentVNode("v-if", true)
- ]),
- _: 3
- }, 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"])), [
- [vShow, _ctx.shouldShow]
- ]) : createCommentVNode("v-if", true)
- ]),
- _: 3
- }, 8, ["name", "onAfterLeave", "onBeforeEnter", "onAfterEnter", "onBeforeLeave"])
- ], 8, ["disabled", "to"]);
- }
- 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"]]);
- const isTriggerType = (trigger, type4) => {
- if (isArray(trigger)) {
- return trigger.includes(type4);
- }
- return trigger === type4;
- };
- const whenTrigger = (trigger, type4, handler3) => {
- return (e) => {
- isTriggerType(unref(trigger), type4) && handler3(e);
- };
- };
- const _sfc_main$X = defineComponent({
- name: "ElTooltipTrigger",
- components: {
- ElPopperTrigger
- },
- props: useTooltipTriggerProps,
- setup(props) {
- const ns = useNamespace("tooltip");
- const { controlled, id, open, onOpen, onClose, onToggle } = inject(TOOLTIP_INJECTION_KEY, void 0);
- const triggerRef2 = ref(null);
- const stopWhenControlledOrDisabled = () => {
- if (unref(controlled) || props.disabled) {
- return true;
- }
- };
- const trigger = toRef(props, "trigger");
- const onMouseenter = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "hover", onOpen));
- const onMouseleave = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "hover", onClose));
- const onClick = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "click", (e) => {
- if (e.button === 0) {
- onToggle(e);
- }
- }));
- const onFocus = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "focus", onOpen));
- const onBlur = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "focus", onClose));
- const onContextMenu = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "contextmenu", (e) => {
- e.preventDefault();
- onToggle(e);
- }));
- const onKeydown = composeEventHandlers(stopWhenControlledOrDisabled, (e) => {
- const { code } = e;
- if (code === EVENT_CODE.enter || code === EVENT_CODE.space) {
- onToggle(e);
- }
- });
- return {
- onBlur,
- onContextMenu,
- onFocus,
- onMouseenter,
- onMouseleave,
- onClick,
- onKeydown,
- open,
- id,
- triggerRef: triggerRef2,
- ns
- };
- }
- });
- function _sfc_render$y(_ctx, _cache, $props, $setup, $data, $options) {
- const _component_el_popper_trigger = resolveComponent("el-popper-trigger");
- return openBlock(), createBlock(_component_el_popper_trigger, {
- id: _ctx.id,
- "virtual-ref": _ctx.virtualRef,
- open: _ctx.open,
- "virtual-triggering": _ctx.virtualTriggering,
- class: normalizeClass(_ctx.ns.e("trigger")),
- onBlur: _ctx.onBlur,
- onClick: _ctx.onClick,
- onContextmenu: _ctx.onContextMenu,
- onFocus: _ctx.onFocus,
- onMouseenter: _ctx.onMouseenter,
- onMouseleave: _ctx.onMouseleave,
- onKeydown: _ctx.onKeydown
- }, {
- default: withCtx(() => [
- renderSlot(_ctx.$slots, "default")
- ]),
- _: 3
- }, 8, ["id", "virtual-ref", "open", "virtual-triggering", "class", "onBlur", "onClick", "onContextmenu", "onFocus", "onMouseenter", "onMouseleave", "onKeydown"]);
- }
- 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"]]);
- const { useModelToggleProps, useModelToggle, useModelToggleEmits } = createModelToggleComposable("visible");
- const _sfc_main$W = defineComponent({
- name: "ElTooltip",
- components: {
- ElPopper,
- ElPopperArrow,
- ElTooltipContent,
- ElTooltipTrigger
- },
- props: __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, useModelToggleProps), useTooltipContentProps), useTooltipTriggerProps), usePopperArrowProps), useTooltipProps),
- emits: [...useModelToggleEmits, "before-show", "before-hide", "show", "hide"],
- setup(props, { emit }) {
- usePopperContainer();
- const compatShowAfter = computed(() => {
- if (!isUndefined(props.openDelay))
- ;
- return props.openDelay || props.showAfter;
- });
- const compatShowArrow = computed(() => {
- if (!isUndefined(props.visibleArrow))
- ;
- return isBoolean(props.visibleArrow) ? props.visibleArrow : props.showArrow;
- });
- const id = useId();
- const popperRef = ref(null);
- const updatePopper = () => {
- var _a2;
- const popperComponent = unref(popperRef);
- if (popperComponent) {
- (_a2 = popperComponent.popperInstanceRef) == null ? void 0 : _a2.update();
- }
- };
- const open = ref(false);
- const { show, hide: hide2 } = useModelToggle({
- indicator: open
- });
- const { onOpen, onClose } = useDelayedToggle({
- showAfter: compatShowAfter,
- hideAfter: toRef(props, "hideAfter"),
- open: show,
- close: hide2
- });
- const controlled = computed(() => isBoolean(props.visible));
- provide(TOOLTIP_INJECTION_KEY, {
- controlled,
- id,
- open: readonly(open),
- trigger: toRef(props, "trigger"),
- onOpen,
- onClose,
- onToggle: () => {
- if (unref(open)) {
- onClose();
- } else {
- onOpen();
- }
- },
- onShow: () => {
- emit("show");
- },
- onHide: () => {
- emit("hide");
- },
- onBeforeShow: () => {
- emit("before-show");
- },
- onBeforeHide: () => {
- emit("before-hide");
- },
- updatePopper
- });
- watch(() => props.disabled, (disabled) => {
- if (disabled && open.value) {
- open.value = false;
- }
- });
- return {
- compatShowAfter,
- compatShowArrow,
- popperRef,
- open,
- hide: hide2,
- updatePopper,
- onOpen,
- onClose
- };
- }
- });
- const _hoisted_1$C = ["innerHTML"];
- const _hoisted_2$t = { key: 1 };
- function _sfc_render$x(_ctx, _cache, $props, $setup, $data, $options) {
- const _component_el_tooltip_trigger = resolveComponent("el-tooltip-trigger");
- const _component_el_popper_arrow = resolveComponent("el-popper-arrow");
- const _component_el_tooltip_content = resolveComponent("el-tooltip-content");
- const _component_el_popper = resolveComponent("el-popper");
- return openBlock(), createBlock(_component_el_popper, { ref: "popperRef" }, {
- default: withCtx(() => [
- createVNode(_component_el_tooltip_trigger, {
- disabled: _ctx.disabled,
- trigger: _ctx.trigger,
- "virtual-ref": _ctx.virtualRef,
- "virtual-triggering": _ctx.virtualTriggering
- }, {
- default: withCtx(() => [
- _ctx.$slots.default ? renderSlot(_ctx.$slots, "default", { key: 0 }) : createCommentVNode("v-if", true)
- ]),
- _: 3
- }, 8, ["disabled", "trigger", "virtual-ref", "virtual-triggering"]),
- createVNode(_component_el_tooltip_content, {
- "aria-label": _ctx.ariaLabel,
- "boundaries-padding": _ctx.boundariesPadding,
- content: _ctx.content,
- disabled: _ctx.disabled,
- effect: _ctx.effect,
- enterable: _ctx.enterable,
- "fallback-placements": _ctx.fallbackPlacements,
- "hide-after": _ctx.hideAfter,
- "gpu-acceleration": _ctx.gpuAcceleration,
- offset: _ctx.offset,
- persistent: _ctx.persistent,
- "popper-class": _ctx.popperClass,
- "popper-style": _ctx.popperStyle,
- placement: _ctx.placement,
- "popper-options": _ctx.popperOptions,
- pure: _ctx.pure,
- "raw-content": _ctx.rawContent,
- "reference-el": _ctx.referenceEl,
- "show-after": _ctx.compatShowAfter,
- strategy: _ctx.strategy,
- teleported: _ctx.teleported,
- transition: _ctx.transition,
- "z-index": _ctx.zIndex,
- "append-to": _ctx.appendTo
- }, {
- default: withCtx(() => [
- renderSlot(_ctx.$slots, "content", {}, () => [
- _ctx.rawContent ? (openBlock(), createElementBlock("span", {
- key: 0,
- innerHTML: _ctx.content
- }, null, 8, _hoisted_1$C)) : (openBlock(), createElementBlock("span", _hoisted_2$t, toDisplayString(_ctx.content), 1))
- ]),
- _ctx.compatShowArrow ? (openBlock(), createBlock(_component_el_popper_arrow, {
- key: 0,
- "arrow-offset": _ctx.arrowOffset
- }, null, 8, ["arrow-offset"])) : createCommentVNode("v-if", true)
- ]),
- _: 3
- }, 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"])
- ]),
- _: 3
- }, 512);
- }
- 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"]]);
- const ElTooltip = withInstall(Tooltip);
- const buttonTypes = [
- "default",
- "primary",
- "success",
- "warning",
- "info",
- "danger",
- "text",
- ""
- ];
- const buttonNativeTypes = ["button", "submit", "reset"];
- const buttonProps = buildProps({
- size: useSizeProp,
- disabled: Boolean,
- type: {
- type: String,
- values: buttonTypes,
- default: ""
- },
- icon: {
- type: iconPropType,
- default: ""
- },
- nativeType: {
- type: String,
- values: buttonNativeTypes,
- default: "button"
- },
- loading: Boolean,
- loadingIcon: {
- type: iconPropType,
- default: () => loading
- },
- plain: Boolean,
- autofocus: Boolean,
- round: Boolean,
- circle: Boolean,
- color: String,
- dark: Boolean,
- autoInsertSpace: {
- type: Boolean,
- default: void 0
- }
- });
- const buttonEmits = {
- click: (evt) => evt instanceof MouseEvent
- };
- function bound01(n, max2) {
- if (isOnePointZero(n)) {
- n = "100%";
- }
- var isPercent = isPercentage(n);
- n = max2 === 360 ? n : Math.min(max2, Math.max(0, parseFloat(n)));
- if (isPercent) {
- n = parseInt(String(n * max2), 10) / 100;
- }
- if (Math.abs(n - max2) < 1e-6) {
- return 1;
- }
- if (max2 === 360) {
- n = (n < 0 ? n % max2 + max2 : n % max2) / parseFloat(String(max2));
- } else {
- n = n % max2 / parseFloat(String(max2));
- }
- return n;
- }
- function clamp01(val) {
- return Math.min(1, Math.max(0, val));
- }
- function isOnePointZero(n) {
- return typeof n === "string" && n.indexOf(".") !== -1 && parseFloat(n) === 1;
- }
- function isPercentage(n) {
- return typeof n === "string" && n.indexOf("%") !== -1;
- }
- function boundAlpha(a2) {
- a2 = parseFloat(a2);
- if (isNaN(a2) || a2 < 0 || a2 > 1) {
- a2 = 1;
- }
- return a2;
- }
- function convertToPercentage(n) {
- if (n <= 1) {
- return "".concat(Number(n) * 100, "%");
- }
- return n;
- }
- function pad2(c2) {
- return c2.length === 1 ? "0" + c2 : String(c2);
- }
- function rgbToRgb(r, g, b2) {
- return {
- r: bound01(r, 255) * 255,
- g: bound01(g, 255) * 255,
- b: bound01(b2, 255) * 255
- };
- }
- function rgbToHsl(r, g, b2) {
- r = bound01(r, 255);
- g = bound01(g, 255);
- b2 = bound01(b2, 255);
- var max2 = Math.max(r, g, b2);
- var min2 = Math.min(r, g, b2);
- var h2 = 0;
- var s2 = 0;
- var l2 = (max2 + min2) / 2;
- if (max2 === min2) {
- s2 = 0;
- h2 = 0;
- } else {
- var d2 = max2 - min2;
- s2 = l2 > 0.5 ? d2 / (2 - max2 - min2) : d2 / (max2 + min2);
- switch (max2) {
- case r:
- h2 = (g - b2) / d2 + (g < b2 ? 6 : 0);
- break;
- case g:
- h2 = (b2 - r) / d2 + 2;
- break;
- case b2:
- h2 = (r - g) / d2 + 4;
- break;
- }
- h2 /= 6;
- }
- return { h: h2, s: s2, l: l2 };
- }
- function hue2rgb(p2, q, t) {
- if (t < 0) {
- t += 1;
- }
- if (t > 1) {
- t -= 1;
- }
- if (t < 1 / 6) {
- return p2 + (q - p2) * (6 * t);
- }
- if (t < 1 / 2) {
- return q;
- }
- if (t < 2 / 3) {
- return p2 + (q - p2) * (2 / 3 - t) * 6;
- }
- return p2;
- }
- function hslToRgb(h2, s2, l2) {
- var r;
- var g;
- var b2;
- h2 = bound01(h2, 360);
- s2 = bound01(s2, 100);
- l2 = bound01(l2, 100);
- if (s2 === 0) {
- g = l2;
- b2 = l2;
- r = l2;
- } else {
- var q = l2 < 0.5 ? l2 * (1 + s2) : l2 + s2 - l2 * s2;
- var p2 = 2 * l2 - q;
- r = hue2rgb(p2, q, h2 + 1 / 3);
- g = hue2rgb(p2, q, h2);
- b2 = hue2rgb(p2, q, h2 - 1 / 3);
- }
- return { r: r * 255, g: g * 255, b: b2 * 255 };
- }
- function rgbToHsv(r, g, b2) {
- r = bound01(r, 255);
- g = bound01(g, 255);
- b2 = bound01(b2, 255);
- var max2 = Math.max(r, g, b2);
- var min2 = Math.min(r, g, b2);
- var h2 = 0;
- var v2 = max2;
- var d2 = max2 - min2;
- var s2 = max2 === 0 ? 0 : d2 / max2;
- if (max2 === min2) {
- h2 = 0;
- } else {
- switch (max2) {
- case r:
- h2 = (g - b2) / d2 + (g < b2 ? 6 : 0);
- break;
- case g:
- h2 = (b2 - r) / d2 + 2;
- break;
- case b2:
- h2 = (r - g) / d2 + 4;
- break;
- }
- h2 /= 6;
- }
- return { h: h2, s: s2, v: v2 };
- }
- function hsvToRgb(h2, s2, v2) {
- h2 = bound01(h2, 360) * 6;
- s2 = bound01(s2, 100);
- v2 = bound01(v2, 100);
- var i = Math.floor(h2);
- var f2 = h2 - i;
- var p2 = v2 * (1 - s2);
- var q = v2 * (1 - f2 * s2);
- var t = v2 * (1 - (1 - f2) * s2);
- var mod = i % 6;
- var r = [v2, q, p2, p2, t, v2][mod];
- var g = [t, v2, v2, q, p2, p2][mod];
- var b2 = [p2, p2, t, v2, v2, q][mod];
- return { r: r * 255, g: g * 255, b: b2 * 255 };
- }
- function rgbToHex(r, g, b2, allow3Char) {
- var hex2 = [
- pad2(Math.round(r).toString(16)),
- pad2(Math.round(g).toString(16)),
- pad2(Math.round(b2).toString(16))
- ];
- if (allow3Char && hex2[0].startsWith(hex2[0].charAt(1)) && hex2[1].startsWith(hex2[1].charAt(1)) && hex2[2].startsWith(hex2[2].charAt(1))) {
- return hex2[0].charAt(0) + hex2[1].charAt(0) + hex2[2].charAt(0);
- }
- return hex2.join("");
- }
- function rgbaToHex(r, g, b2, a2, allow4Char) {
- var hex2 = [
- pad2(Math.round(r).toString(16)),
- pad2(Math.round(g).toString(16)),
- pad2(Math.round(b2).toString(16)),
- pad2(convertDecimalToHex(a2))
- ];
- 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))) {
- return hex2[0].charAt(0) + hex2[1].charAt(0) + hex2[2].charAt(0) + hex2[3].charAt(0);
- }
- return hex2.join("");
- }
- function convertDecimalToHex(d2) {
- return Math.round(parseFloat(d2) * 255).toString(16);
- }
- function convertHexToDecimal(h2) {
- return parseIntFromHex(h2) / 255;
- }
- function parseIntFromHex(val) {
- return parseInt(val, 16);
- }
- function numberInputToObject(color) {
- return {
- r: color >> 16,
- g: (color & 65280) >> 8,
- b: color & 255
- };
- }
- var names = {
- aliceblue: "#f0f8ff",
- antiquewhite: "#faebd7",
- aqua: "#00ffff",
- aquamarine: "#7fffd4",
- azure: "#f0ffff",
- beige: "#f5f5dc",
- bisque: "#ffe4c4",
- black: "#000000",
- blanchedalmond: "#ffebcd",
- blue: "#0000ff",
- blueviolet: "#8a2be2",
- brown: "#a52a2a",
- burlywood: "#deb887",
- cadetblue: "#5f9ea0",
- chartreuse: "#7fff00",
- chocolate: "#d2691e",
- coral: "#ff7f50",
- cornflowerblue: "#6495ed",
- cornsilk: "#fff8dc",
- crimson: "#dc143c",
- cyan: "#00ffff",
- darkblue: "#00008b",
- darkcyan: "#008b8b",
- darkgoldenrod: "#b8860b",
- darkgray: "#a9a9a9",
- darkgreen: "#006400",
- darkgrey: "#a9a9a9",
- darkkhaki: "#bdb76b",
- darkmagenta: "#8b008b",
- darkolivegreen: "#556b2f",
- darkorange: "#ff8c00",
- darkorchid: "#9932cc",
- darkred: "#8b0000",
- darksalmon: "#e9967a",
- darkseagreen: "#8fbc8f",
- darkslateblue: "#483d8b",
- darkslategray: "#2f4f4f",
- darkslategrey: "#2f4f4f",
- darkturquoise: "#00ced1",
- darkviolet: "#9400d3",
- deeppink: "#ff1493",
- deepskyblue: "#00bfff",
- dimgray: "#696969",
- dimgrey: "#696969",
- dodgerblue: "#1e90ff",
- firebrick: "#b22222",
- floralwhite: "#fffaf0",
- forestgreen: "#228b22",
- fuchsia: "#ff00ff",
- gainsboro: "#dcdcdc",
- ghostwhite: "#f8f8ff",
- goldenrod: "#daa520",
- gold: "#ffd700",
- gray: "#808080",
- green: "#008000",
- greenyellow: "#adff2f",
- grey: "#808080",
- honeydew: "#f0fff0",
- hotpink: "#ff69b4",
- indianred: "#cd5c5c",
- indigo: "#4b0082",
- ivory: "#fffff0",
- khaki: "#f0e68c",
- lavenderblush: "#fff0f5",
- lavender: "#e6e6fa",
- lawngreen: "#7cfc00",
- lemonchiffon: "#fffacd",
- lightblue: "#add8e6",
- lightcoral: "#f08080",
- lightcyan: "#e0ffff",
- lightgoldenrodyellow: "#fafad2",
- lightgray: "#d3d3d3",
- lightgreen: "#90ee90",
- lightgrey: "#d3d3d3",
- lightpink: "#ffb6c1",
- lightsalmon: "#ffa07a",
- lightseagreen: "#20b2aa",
- lightskyblue: "#87cefa",
- lightslategray: "#778899",
- lightslategrey: "#778899",
- lightsteelblue: "#b0c4de",
- lightyellow: "#ffffe0",
- lime: "#00ff00",
- limegreen: "#32cd32",
- linen: "#faf0e6",
- magenta: "#ff00ff",
- maroon: "#800000",
- mediumaquamarine: "#66cdaa",
- mediumblue: "#0000cd",
- mediumorchid: "#ba55d3",
- mediumpurple: "#9370db",
- mediumseagreen: "#3cb371",
- mediumslateblue: "#7b68ee",
- mediumspringgreen: "#00fa9a",
- mediumturquoise: "#48d1cc",
- mediumvioletred: "#c71585",
- midnightblue: "#191970",
- mintcream: "#f5fffa",
- mistyrose: "#ffe4e1",
- moccasin: "#ffe4b5",
- navajowhite: "#ffdead",
- navy: "#000080",
- oldlace: "#fdf5e6",
- olive: "#808000",
- olivedrab: "#6b8e23",
- orange: "#ffa500",
- orangered: "#ff4500",
- orchid: "#da70d6",
- palegoldenrod: "#eee8aa",
- palegreen: "#98fb98",
- paleturquoise: "#afeeee",
- palevioletred: "#db7093",
- papayawhip: "#ffefd5",
- peachpuff: "#ffdab9",
- peru: "#cd853f",
- pink: "#ffc0cb",
- plum: "#dda0dd",
- powderblue: "#b0e0e6",
- purple: "#800080",
- rebeccapurple: "#663399",
- red: "#ff0000",
- rosybrown: "#bc8f8f",
- royalblue: "#4169e1",
- saddlebrown: "#8b4513",
- salmon: "#fa8072",
- sandybrown: "#f4a460",
- seagreen: "#2e8b57",
- seashell: "#fff5ee",
- sienna: "#a0522d",
- silver: "#c0c0c0",
- skyblue: "#87ceeb",
- slateblue: "#6a5acd",
- slategray: "#708090",
- slategrey: "#708090",
- snow: "#fffafa",
- springgreen: "#00ff7f",
- steelblue: "#4682b4",
- tan: "#d2b48c",
- teal: "#008080",
- thistle: "#d8bfd8",
- tomato: "#ff6347",
- turquoise: "#40e0d0",
- violet: "#ee82ee",
- wheat: "#f5deb3",
- white: "#ffffff",
- whitesmoke: "#f5f5f5",
- yellow: "#ffff00",
- yellowgreen: "#9acd32"
- };
- function inputToRGB(color) {
- var rgb = { r: 0, g: 0, b: 0 };
- var a2 = 1;
- var s2 = null;
- var v2 = null;
- var l2 = null;
- var ok = false;
- var format2 = false;
- if (typeof color === "string") {
- color = stringInputToObject(color);
- }
- if (typeof color === "object") {
- if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
- rgb = rgbToRgb(color.r, color.g, color.b);
- ok = true;
- format2 = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
- } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
- s2 = convertToPercentage(color.s);
- v2 = convertToPercentage(color.v);
- rgb = hsvToRgb(color.h, s2, v2);
- ok = true;
- format2 = "hsv";
- } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
- s2 = convertToPercentage(color.s);
- l2 = convertToPercentage(color.l);
- rgb = hslToRgb(color.h, s2, l2);
- ok = true;
- format2 = "hsl";
- }
- if (Object.prototype.hasOwnProperty.call(color, "a")) {
- a2 = color.a;
- }
- }
- a2 = boundAlpha(a2);
- return {
- ok,
- format: color.format || format2,
- r: Math.min(255, Math.max(rgb.r, 0)),
- g: Math.min(255, Math.max(rgb.g, 0)),
- b: Math.min(255, Math.max(rgb.b, 0)),
- a: a2
- };
- }
- var CSS_INTEGER = "[-\\+]?\\d+%?";
- var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";
- var CSS_UNIT = "(?:".concat(CSS_NUMBER, ")|(?:").concat(CSS_INTEGER, ")");
- var PERMISSIVE_MATCH3 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
- var PERMISSIVE_MATCH4 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
- var matchers = {
- CSS_UNIT: new RegExp(CSS_UNIT),
- rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
- rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
- hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
- hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
- hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
- hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
- hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
- hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
- hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
- hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
- };
- function stringInputToObject(color) {
- color = color.trim().toLowerCase();
- if (color.length === 0) {
- return false;
- }
- var named = false;
- if (names[color]) {
- color = names[color];
- named = true;
- } else if (color === "transparent") {
- return { r: 0, g: 0, b: 0, a: 0, format: "name" };
- }
- var match = matchers.rgb.exec(color);
- if (match) {
- return { r: match[1], g: match[2], b: match[3] };
- }
- match = matchers.rgba.exec(color);
- if (match) {
- return { r: match[1], g: match[2], b: match[3], a: match[4] };
- }
- match = matchers.hsl.exec(color);
- if (match) {
- return { h: match[1], s: match[2], l: match[3] };
- }
- match = matchers.hsla.exec(color);
- if (match) {
- return { h: match[1], s: match[2], l: match[3], a: match[4] };
- }
- match = matchers.hsv.exec(color);
- if (match) {
- return { h: match[1], s: match[2], v: match[3] };
- }
- match = matchers.hsva.exec(color);
- if (match) {
- return { h: match[1], s: match[2], v: match[3], a: match[4] };
- }
- match = matchers.hex8.exec(color);
- if (match) {
- return {
- r: parseIntFromHex(match[1]),
- g: parseIntFromHex(match[2]),
- b: parseIntFromHex(match[3]),
- a: convertHexToDecimal(match[4]),
- format: named ? "name" : "hex8"
- };
- }
- match = matchers.hex6.exec(color);
- if (match) {
- return {
- r: parseIntFromHex(match[1]),
- g: parseIntFromHex(match[2]),
- b: parseIntFromHex(match[3]),
- format: named ? "name" : "hex"
- };
- }
- match = matchers.hex4.exec(color);
- if (match) {
- return {
- r: parseIntFromHex(match[1] + match[1]),
- g: parseIntFromHex(match[2] + match[2]),
- b: parseIntFromHex(match[3] + match[3]),
- a: convertHexToDecimal(match[4] + match[4]),
- format: named ? "name" : "hex8"
- };
- }
- match = matchers.hex3.exec(color);
- if (match) {
- return {
- r: parseIntFromHex(match[1] + match[1]),
- g: parseIntFromHex(match[2] + match[2]),
- b: parseIntFromHex(match[3] + match[3]),
- format: named ? "name" : "hex"
- };
- }
- return false;
- }
- function isValidCSSUnit(color) {
- return Boolean(matchers.CSS_UNIT.exec(String(color)));
- }
- var TinyColor = function() {
- function TinyColor2(color, opts) {
- if (color === void 0) {
- color = "";
- }
- if (opts === void 0) {
- opts = {};
- }
- var _a2;
- if (color instanceof TinyColor2) {
- return color;
- }
- if (typeof color === "number") {
- color = numberInputToObject(color);
- }
- this.originalInput = color;
- var rgb = inputToRGB(color);
- this.originalInput = color;
- this.r = rgb.r;
- this.g = rgb.g;
- this.b = rgb.b;
- this.a = rgb.a;
- this.roundA = Math.round(100 * this.a) / 100;
- this.format = (_a2 = opts.format) !== null && _a2 !== void 0 ? _a2 : rgb.format;
- this.gradientType = opts.gradientType;
- if (this.r < 1) {
- this.r = Math.round(this.r);
- }
- if (this.g < 1) {
- this.g = Math.round(this.g);
- }
- if (this.b < 1) {
- this.b = Math.round(this.b);
- }
- this.isValid = rgb.ok;
- }
- TinyColor2.prototype.isDark = function() {
- return this.getBrightness() < 128;
- };
- TinyColor2.prototype.isLight = function() {
- return !this.isDark();
- };
- TinyColor2.prototype.getBrightness = function() {
- var rgb = this.toRgb();
- return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1e3;
- };
- TinyColor2.prototype.getLuminance = function() {
- var rgb = this.toRgb();
- var R;
- var G;
- var B;
- var RsRGB = rgb.r / 255;
- var GsRGB = rgb.g / 255;
- var BsRGB = rgb.b / 255;
- if (RsRGB <= 0.03928) {
- R = RsRGB / 12.92;
- } else {
- R = Math.pow((RsRGB + 0.055) / 1.055, 2.4);
- }
- if (GsRGB <= 0.03928) {
- G = GsRGB / 12.92;
- } else {
- G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
- }
- if (BsRGB <= 0.03928) {
- B = BsRGB / 12.92;
- } else {
- B = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
- }
- return 0.2126 * R + 0.7152 * G + 0.0722 * B;
- };
- TinyColor2.prototype.getAlpha = function() {
- return this.a;
- };
- TinyColor2.prototype.setAlpha = function(alpha) {
- this.a = boundAlpha(alpha);
- this.roundA = Math.round(100 * this.a) / 100;
- return this;
- };
- TinyColor2.prototype.toHsv = function() {
- var hsv = rgbToHsv(this.r, this.g, this.b);
- return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this.a };
- };
- TinyColor2.prototype.toHsvString = function() {
- var hsv = rgbToHsv(this.r, this.g, this.b);
- var h2 = Math.round(hsv.h * 360);
- var s2 = Math.round(hsv.s * 100);
- var v2 = Math.round(hsv.v * 100);
- return this.a === 1 ? "hsv(".concat(h2, ", ").concat(s2, "%, ").concat(v2, "%)") : "hsva(".concat(h2, ", ").concat(s2, "%, ").concat(v2, "%, ").concat(this.roundA, ")");
- };
- TinyColor2.prototype.toHsl = function() {
- var hsl = rgbToHsl(this.r, this.g, this.b);
- return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this.a };
- };
- TinyColor2.prototype.toHslString = function() {
- var hsl = rgbToHsl(this.r, this.g, this.b);
- var h2 = Math.round(hsl.h * 360);
- var s2 = Math.round(hsl.s * 100);
- var l2 = Math.round(hsl.l * 100);
- return this.a === 1 ? "hsl(".concat(h2, ", ").concat(s2, "%, ").concat(l2, "%)") : "hsla(".concat(h2, ", ").concat(s2, "%, ").concat(l2, "%, ").concat(this.roundA, ")");
- };
- TinyColor2.prototype.toHex = function(allow3Char) {
- if (allow3Char === void 0) {
- allow3Char = false;
- }
- return rgbToHex(this.r, this.g, this.b, allow3Char);
- };
- TinyColor2.prototype.toHexString = function(allow3Char) {
- if (allow3Char === void 0) {
- allow3Char = false;
- }
- return "#" + this.toHex(allow3Char);
- };
- TinyColor2.prototype.toHex8 = function(allow4Char) {
- if (allow4Char === void 0) {
- allow4Char = false;
- }
- return rgbaToHex(this.r, this.g, this.b, this.a, allow4Char);
- };
- TinyColor2.prototype.toHex8String = function(allow4Char) {
- if (allow4Char === void 0) {
- allow4Char = false;
- }
- return "#" + this.toHex8(allow4Char);
- };
- TinyColor2.prototype.toRgb = function() {
- return {
- r: Math.round(this.r),
- g: Math.round(this.g),
- b: Math.round(this.b),
- a: this.a
- };
- };
- TinyColor2.prototype.toRgbString = function() {
- var r = Math.round(this.r);
- var g = Math.round(this.g);
- var b2 = Math.round(this.b);
- return this.a === 1 ? "rgb(".concat(r, ", ").concat(g, ", ").concat(b2, ")") : "rgba(".concat(r, ", ").concat(g, ", ").concat(b2, ", ").concat(this.roundA, ")");
- };
- TinyColor2.prototype.toPercentageRgb = function() {
- var fmt = function(x2) {
- return "".concat(Math.round(bound01(x2, 255) * 100), "%");
- };
- return {
- r: fmt(this.r),
- g: fmt(this.g),
- b: fmt(this.b),
- a: this.a
- };
- };
- TinyColor2.prototype.toPercentageRgbString = function() {
- var rnd = function(x2) {
- return Math.round(bound01(x2, 255) * 100);
- };
- 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, ")");
- };
- TinyColor2.prototype.toName = function() {
- if (this.a === 0) {
- return "transparent";
- }
- if (this.a < 1) {
- return false;
- }
- var hex2 = "#" + rgbToHex(this.r, this.g, this.b, false);
- for (var _i = 0, _a2 = Object.entries(names); _i < _a2.length; _i++) {
- var _b2 = _a2[_i], key = _b2[0], value = _b2[1];
- if (hex2 === value) {
- return key;
- }
- }
- return false;
- };
- TinyColor2.prototype.toString = function(format2) {
- var formatSet = Boolean(format2);
- format2 = format2 !== null && format2 !== void 0 ? format2 : this.format;
- var formattedString = false;
- var hasAlpha = this.a < 1 && this.a >= 0;
- var needsAlphaFormat = !formatSet && hasAlpha && (format2.startsWith("hex") || format2 === "name");
- if (needsAlphaFormat) {
- if (format2 === "name" && this.a === 0) {
- return this.toName();
- }
- return this.toRgbString();
- }
- if (format2 === "rgb") {
- formattedString = this.toRgbString();
- }
- if (format2 === "prgb") {
- formattedString = this.toPercentageRgbString();
- }
- if (format2 === "hex" || format2 === "hex6") {
- formattedString = this.toHexString();
- }
- if (format2 === "hex3") {
- formattedString = this.toHexString(true);
- }
- if (format2 === "hex4") {
- formattedString = this.toHex8String(true);
- }
- if (format2 === "hex8") {
- formattedString = this.toHex8String();
- }
- if (format2 === "name") {
- formattedString = this.toName();
- }
- if (format2 === "hsl") {
- formattedString = this.toHslString();
- }
- if (format2 === "hsv") {
- formattedString = this.toHsvString();
- }
- return formattedString || this.toHexString();
- };
- TinyColor2.prototype.toNumber = function() {
- return (Math.round(this.r) << 16) + (Math.round(this.g) << 8) + Math.round(this.b);
- };
- TinyColor2.prototype.clone = function() {
- return new TinyColor2(this.toString());
- };
- TinyColor2.prototype.lighten = function(amount) {
- if (amount === void 0) {
- amount = 10;
- }
- var hsl = this.toHsl();
- hsl.l += amount / 100;
- hsl.l = clamp01(hsl.l);
- return new TinyColor2(hsl);
- };
- TinyColor2.prototype.brighten = function(amount) {
- if (amount === void 0) {
- amount = 10;
- }
- var rgb = this.toRgb();
- rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100))));
- rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100))));
- rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100))));
- return new TinyColor2(rgb);
- };
- TinyColor2.prototype.darken = function(amount) {
- if (amount === void 0) {
- amount = 10;
- }
- var hsl = this.toHsl();
- hsl.l -= amount / 100;
- hsl.l = clamp01(hsl.l);
- return new TinyColor2(hsl);
- };
- TinyColor2.prototype.tint = function(amount) {
- if (amount === void 0) {
- amount = 10;
- }
- return this.mix("white", amount);
- };
- TinyColor2.prototype.shade = function(amount) {
- if (amount === void 0) {
- amount = 10;
- }
- return this.mix("black", amount);
- };
- TinyColor2.prototype.desaturate = function(amount) {
- if (amount === void 0) {
- amount = 10;
- }
- var hsl = this.toHsl();
- hsl.s -= amount / 100;
- hsl.s = clamp01(hsl.s);
- return new TinyColor2(hsl);
- };
- TinyColor2.prototype.saturate = function(amount) {
- if (amount === void 0) {
- amount = 10;
- }
- var hsl = this.toHsl();
- hsl.s += amount / 100;
- hsl.s = clamp01(hsl.s);
- return new TinyColor2(hsl);
- };
- TinyColor2.prototype.greyscale = function() {
- return this.desaturate(100);
- };
- TinyColor2.prototype.spin = function(amount) {
- var hsl = this.toHsl();
- var hue = (hsl.h + amount) % 360;
- hsl.h = hue < 0 ? 360 + hue : hue;
- return new TinyColor2(hsl);
- };
- TinyColor2.prototype.mix = function(color, amount) {
- if (amount === void 0) {
- amount = 50;
- }
- var rgb1 = this.toRgb();
- var rgb2 = new TinyColor2(color).toRgb();
- var p2 = amount / 100;
- var rgba = {
- r: (rgb2.r - rgb1.r) * p2 + rgb1.r,
- g: (rgb2.g - rgb1.g) * p2 + rgb1.g,
- b: (rgb2.b - rgb1.b) * p2 + rgb1.b,
- a: (rgb2.a - rgb1.a) * p2 + rgb1.a
- };
- return new TinyColor2(rgba);
- };
- TinyColor2.prototype.analogous = function(results, slices) {
- if (results === void 0) {
- results = 6;
- }
- if (slices === void 0) {
- slices = 30;
- }
- var hsl = this.toHsl();
- var part = 360 / slices;
- var ret = [this];
- for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results; ) {
- hsl.h = (hsl.h + part) % 360;
- ret.push(new TinyColor2(hsl));
- }
- return ret;
- };
- TinyColor2.prototype.complement = function() {
- var hsl = this.toHsl();
- hsl.h = (hsl.h + 180) % 360;
- return new TinyColor2(hsl);
- };
- TinyColor2.prototype.monochromatic = function(results) {
- if (results === void 0) {
- results = 6;
- }
- var hsv = this.toHsv();
- var h2 = hsv.h;
- var s2 = hsv.s;
- var v2 = hsv.v;
- var res = [];
- var modification = 1 / results;
- while (results--) {
- res.push(new TinyColor2({ h: h2, s: s2, v: v2 }));
- v2 = (v2 + modification) % 1;
- }
- return res;
- };
- TinyColor2.prototype.splitcomplement = function() {
- var hsl = this.toHsl();
- var h2 = hsl.h;
- return [
- this,
- new TinyColor2({ h: (h2 + 72) % 360, s: hsl.s, l: hsl.l }),
- new TinyColor2({ h: (h2 + 216) % 360, s: hsl.s, l: hsl.l })
- ];
- };
- TinyColor2.prototype.onBackground = function(background) {
- var fg = this.toRgb();
- var bg = new TinyColor2(background).toRgb();
- return new TinyColor2({
- r: bg.r + (fg.r - bg.r) * fg.a,
- g: bg.g + (fg.g - bg.g) * fg.a,
- b: bg.b + (fg.b - bg.b) * fg.a
- });
- };
- TinyColor2.prototype.triad = function() {
- return this.polyad(3);
- };
- TinyColor2.prototype.tetrad = function() {
- return this.polyad(4);
- };
- TinyColor2.prototype.polyad = function(n) {
- var hsl = this.toHsl();
- var h2 = hsl.h;
- var result = [this];
- var increment = 360 / n;
- for (var i = 1; i < n; i++) {
- result.push(new TinyColor2({ h: (h2 + i * increment) % 360, s: hsl.s, l: hsl.l }));
- }
- return result;
- };
- TinyColor2.prototype.equals = function(color) {
- return this.toRgbString() === new TinyColor2(color).toRgbString();
- };
- return TinyColor2;
- }();
- function darken(color, amount = 20) {
- return color.mix("#141414", amount).toString();
- }
- function useButtonCustomStyle(props) {
- const _disabled = useDisabled$1();
- return computed(() => {
- let styles = {};
- const buttonColor = props.color;
- if (buttonColor) {
- const color = new TinyColor(buttonColor);
- const activeBgColor = props.dark ? color.tint(20).toString() : darken(color, 20);
- if (props.plain) {
- styles = {
- "--el-button-bg-color": props.dark ? darken(color, 90) : color.tint(90).toString(),
- "--el-button-text-color": buttonColor,
- "--el-button-border-color": props.dark ? darken(color, 50) : color.tint(50).toString(),
- "--el-button-hover-text-color": "var(--el-color-white)",
- "--el-button-hover-bg-color": buttonColor,
- "--el-button-hover-border-color": buttonColor,
- "--el-button-active-bg-color": activeBgColor,
- "--el-button-active-text-color": "var(--el-color-white)",
- "--el-button-active-border-color": activeBgColor
- };
- if (_disabled.value) {
- styles["--el-button-disabled-bg-color"] = props.dark ? darken(color, 90) : color.tint(90).toString();
- styles["--el-button-disabled-text-color"] = props.dark ? darken(color, 50) : color.tint(50).toString();
- styles["--el-button-disabled-border-color"] = props.dark ? darken(color, 80) : color.tint(80).toString();
- }
- } else {
- const hoverBgColor = props.dark ? darken(color, 30) : color.tint(30).toString();
- const textColor = color.isDark() ? "var(--el-color-white)" : "var(--el-color-black)";
- styles = {
- "--el-button-bg-color": buttonColor,
- "--el-button-text-color": textColor,
- "--el-button-border-color": buttonColor,
- "--el-button-hover-bg-color": hoverBgColor,
- "--el-button-hover-text-color": textColor,
- "--el-button-hover-border-color": hoverBgColor,
- "--el-button-active-bg-color": activeBgColor,
- "--el-button-active-border-color": activeBgColor
- };
- if (_disabled.value) {
- const disabledButtonColor = props.dark ? darken(color, 50) : color.tint(50).toString();
- styles["--el-button-disabled-bg-color"] = disabledButtonColor;
- styles["--el-button-disabled-text-color"] = props.dark ? "rgba(255, 255, 255, 0.5)" : "var(--el-color-white)";
- styles["--el-button-disabled-border-color"] = disabledButtonColor;
- }
- }
- }
- return styles;
- });
- }
- const _hoisted_1$B = ["disabled", "autofocus", "type"];
- const __default__$f = {
- name: "ElButton"
- };
- const _sfc_main$V = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$f), {
- props: buttonProps,
- emits: buttonEmits,
- setup(__props, { expose, emit }) {
- const props = __props;
- const slots = useSlots();
- const buttonGroupContext = inject(buttonGroupContextKey, void 0);
- const globalConfig2 = useGlobalConfig("button");
- const ns = useNamespace("button");
- const { form } = useFormItem();
- const _size = useSize(computed(() => buttonGroupContext == null ? void 0 : buttonGroupContext.size));
- const _disabled = useDisabled$1();
- const _ref = ref();
- const _type = computed(() => props.type || (buttonGroupContext == null ? void 0 : buttonGroupContext.type) || "");
- const autoInsertSpace = computed(() => {
- var _a2, _b2, _c;
- return (_c = (_b2 = props.autoInsertSpace) != null ? _b2 : (_a2 = globalConfig2.value) == null ? void 0 : _a2.autoInsertSpace) != null ? _c : false;
- });
- const shouldAddSpace = computed(() => {
- var _a2;
- const defaultSlot = (_a2 = slots.default) == null ? void 0 : _a2.call(slots);
- if (autoInsertSpace.value && (defaultSlot == null ? void 0 : defaultSlot.length) === 1) {
- const slot = defaultSlot[0];
- if ((slot == null ? void 0 : slot.type) === Text) {
- const text = slot.children;
- return /^\p{Unified_Ideograph}{2}$/u.test(text.trim());
- }
- }
- return false;
- });
- const buttonStyle = useButtonCustomStyle(props);
- const handleClick = (evt) => {
- if (props.nativeType === "reset") {
- form == null ? void 0 : form.resetFields();
- }
- emit("click", evt);
- };
- expose({
- ref: _ref,
- size: _size,
- type: _type,
- disabled: _disabled,
- shouldAddSpace
- });
- return (_ctx, _cache) => {
- return openBlock(), createElementBlock("button", {
- ref_key: "_ref",
- ref: _ref,
- class: normalizeClass([
- unref(ns).b(),
- unref(ns).m(unref(_type)),
- unref(ns).m(unref(_size)),
- unref(ns).is("disabled", unref(_disabled)),
- unref(ns).is("loading", _ctx.loading),
- unref(ns).is("plain", _ctx.plain),
- unref(ns).is("round", _ctx.round),
- unref(ns).is("circle", _ctx.circle)
- ]),
- disabled: unref(_disabled) || _ctx.loading,
- autofocus: _ctx.autofocus,
- type: _ctx.nativeType,
- style: normalizeStyle(unref(buttonStyle)),
- onClick: handleClick
- }, [
- _ctx.loading ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
- _ctx.$slots.loading ? renderSlot(_ctx.$slots, "loading", { key: 0 }) : (openBlock(), createBlock(unref(ElIcon), {
- key: 1,
- class: normalizeClass(unref(ns).is("loading"))
- }, {
- default: withCtx(() => [
- (openBlock(), createBlock(resolveDynamicComponent(_ctx.loadingIcon)))
- ]),
- _: 1
- }, 8, ["class"]))
- ], 2112)) : _ctx.icon || _ctx.$slots.icon ? (openBlock(), createBlock(unref(ElIcon), { key: 1 }, {
- default: withCtx(() => [
- _ctx.icon ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon), { key: 0 })) : renderSlot(_ctx.$slots, "icon", { key: 1 })
- ]),
- _: 3
- })) : createCommentVNode("v-if", true),
- _ctx.$slots.default ? (openBlock(), createElementBlock("span", {
- key: 2,
- class: normalizeClass({ [unref(ns).em("text", "expand")]: unref(shouldAddSpace) })
- }, [
- renderSlot(_ctx.$slots, "default")
- ], 2)) : createCommentVNode("v-if", true)
- ], 14, _hoisted_1$B);
- };
- }
- }));
- var Button = /* @__PURE__ */ _export_sfc$1(_sfc_main$V, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/button/src/button.vue"]]);
- const buttonGroupProps = {
- size: buttonProps.size,
- type: buttonProps.type
- };
- const __default__$e = {
- name: "ElButtonGroup"
- };
- const _sfc_main$U = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$e), {
- props: buttonGroupProps,
- setup(__props) {
- const props = __props;
- provide(buttonGroupContextKey, reactive({
- size: toRef(props, "size"),
- type: toRef(props, "type")
- }));
- const ns = useNamespace("button");
- return (_ctx, _cache) => {
- return openBlock(), createElementBlock("div", {
- class: normalizeClass(`${unref(ns).b("group")}`)
- }, [
- renderSlot(_ctx.$slots, "default")
- ], 2);
- };
- }
- }));
- var ButtonGroup = /* @__PURE__ */ _export_sfc$1(_sfc_main$U, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/button/src/button-group.vue"]]);
- const ElButton = withInstall(Button, {
- ButtonGroup
- });
- withNoopInstall(ButtonGroup);
- var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
- var dayjs_min = { exports: {} };
- (function(module2, exports2) {
- !function(t, e) {
- module2.exports = e();
- }(commonjsGlobal, function() {
- 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) {
- var e2 = ["th", "st", "nd", "rd"], n2 = t2 % 100;
- return "[" + t2 + (e2[(n2 - 20) % 10] || e2[n2] || e2[0]) + "]";
- } }, m2 = function(t2, e2, n2) {
- var r2 = String(t2);
- return !r2 || r2.length >= e2 ? t2 : "" + Array(e2 + 1 - r2.length).join(n2) + t2;
- }, v2 = { s: m2, z: function(t2) {
- var e2 = -t2.utcOffset(), n2 = Math.abs(e2), r2 = Math.floor(n2 / 60), i2 = n2 % 60;
- return (e2 <= 0 ? "+" : "-") + m2(r2, 2, "0") + ":" + m2(i2, 2, "0");
- }, m: function t2(e2, n2) {
- if (e2.date() < n2.date())
- return -t2(n2, e2);
- 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);
- return +(-(r2 + (n2 - i2) / (s3 ? i2 - u3 : u3 - i2)) || 0);
- }, a: function(t2) {
- return t2 < 0 ? Math.ceil(t2) || 0 : Math.floor(t2);
- }, p: function(t2) {
- 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$/, "");
- }, u: function(t2) {
- return t2 === void 0;
- } }, g = "en", D2 = {};
- D2[g] = M2;
- var p2 = "$isDayjsObject", S2 = function(t2) {
- return t2 instanceof _2 || !(!t2 || !t2[p2]);
- }, w2 = function t2(e2, n2, r2) {
- var i2;
- if (!e2)
- return g;
- if (typeof e2 == "string") {
- var s3 = e2.toLowerCase();
- D2[s3] && (i2 = s3), n2 && (D2[s3] = n2, i2 = s3);
- var u3 = e2.split("-");
- if (!i2 && u3.length > 1)
- return t2(u3[0]);
- } else {
- var a3 = e2.name;
- D2[a3] = e2, i2 = a3;
- }
- return !r2 && i2 && (g = i2), i2 || !r2 && g;
- }, O2 = function(t2, e2) {
- if (S2(t2))
- return t2.clone();
- var n2 = typeof e2 == "object" ? e2 : {};
- return n2.date = t2, n2.args = arguments, new _2(n2);
- }, b2 = v2;
- b2.l = w2, b2.i = S2, b2.w = function(t2, e2) {
- return O2(t2, { locale: e2.$L, utc: e2.$u, x: e2.$x, $offset: e2.$offset });
- };
- var _2 = function() {
- function M3(t2) {
- this.$L = w2(t2.locale, null, true), this.parse(t2), this.$x = this.$x || t2.x || {}, this[p2] = true;
- }
- var m3 = M3.prototype;
- return m3.parse = function(t2) {
- this.$d = function(t3) {
- var e2 = t3.date, n2 = t3.utc;
- if (e2 === null)
- return new Date(NaN);
- if (b2.u(e2))
- return new Date();
- if (e2 instanceof Date)
- return new Date(e2);
- if (typeof e2 == "string" && !/Z$/i.test(e2)) {
- var r2 = e2.match($);
- if (r2) {
- var i2 = r2[2] - 1 || 0, s3 = (r2[7] || "0").substring(0, 3);
- 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);
- }
- }
- return new Date(e2);
- }(t2), this.init();
- }, m3.init = function() {
- var t2 = this.$d;
- 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();
- }, m3.$utils = function() {
- return b2;
- }, m3.isValid = function() {
- return !(this.$d.toString() === l2);
- }, m3.isSame = function(t2, e2) {
- var n2 = O2(t2);
- return this.startOf(e2) <= n2 && n2 <= this.endOf(e2);
- }, m3.isAfter = function(t2, e2) {
- return O2(t2) < this.startOf(e2);
- }, m3.isBefore = function(t2, e2) {
- return this.endOf(e2) < O2(t2);
- }, m3.$g = function(t2, e2, n2) {
- return b2.u(t2) ? this[e2] : this.set(n2, t2);
- }, m3.unix = function() {
- return Math.floor(this.valueOf() / 1e3);
- }, m3.valueOf = function() {
- return this.$d.getTime();
- }, m3.startOf = function(t2, e2) {
- var n2 = this, r2 = !!b2.u(e2) || e2, f3 = b2.p(t2), l3 = function(t3, e3) {
- var i2 = b2.w(n2.$u ? Date.UTC(n2.$y, e3, t3) : new Date(n2.$y, e3, t3), n2);
- return r2 ? i2 : i2.endOf(a2);
- }, $2 = function(t3, e3) {
- return b2.w(n2.toDate()[t3].apply(n2.toDate("s"), (r2 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e3)), n2);
- }, y2 = this.$W, M4 = this.$M, m4 = this.$D, v3 = "set" + (this.$u ? "UTC" : "");
- switch (f3) {
- case h2:
- return r2 ? l3(1, 0) : l3(31, 11);
- case c2:
- return r2 ? l3(1, M4) : l3(0, M4 + 1);
- case o2:
- var g2 = this.$locale().weekStart || 0, D3 = (y2 < g2 ? y2 + 7 : y2) - g2;
- return l3(r2 ? m4 - D3 : m4 + (6 - D3), M4);
- case a2:
- case d2:
- return $2(v3 + "Hours", 0);
- case u2:
- return $2(v3 + "Minutes", 1);
- case s2:
- return $2(v3 + "Seconds", 2);
- case i:
- return $2(v3 + "Milliseconds", 3);
- default:
- return this.clone();
- }
- }, m3.endOf = function(t2) {
- return this.startOf(t2, false);
- }, m3.$set = function(t2, e2) {
- 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;
- if (o3 === c2 || o3 === h2) {
- var y2 = this.clone().set(d2, 1);
- y2.$d[l3]($2), y2.init(), this.$d = y2.set(d2, Math.min(this.$D, y2.daysInMonth())).$d;
- } else
- l3 && this.$d[l3]($2);
- return this.init(), this;
- }, m3.set = function(t2, e2) {
- return this.clone().$set(t2, e2);
- }, m3.get = function(t2) {
- return this[b2.p(t2)]();
- }, m3.add = function(r2, f3) {
- var d3, l3 = this;
- r2 = Number(r2);
- var $2 = b2.p(f3), y2 = function(t2) {
- var e2 = O2(l3);
- return b2.w(e2.date(e2.date() + Math.round(t2 * r2)), l3);
- };
- if ($2 === c2)
- return this.set(c2, this.$M + r2);
- if ($2 === h2)
- return this.set(h2, this.$y + r2);
- if ($2 === a2)
- return y2(1);
- if ($2 === o2)
- return y2(7);
- var M4 = (d3 = {}, d3[s2] = e, d3[u2] = n, d3[i] = t, d3)[$2] || 1, m4 = this.$d.getTime() + r2 * M4;
- return b2.w(m4, this);
- }, m3.subtract = function(t2, e2) {
- return this.add(-1 * t2, e2);
- }, m3.format = function(t2) {
- var e2 = this, n2 = this.$locale();
- if (!this.isValid())
- return n2.invalidDate || l2;
- 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) {
- return t3 && (t3[n3] || t3(e2, r2)) || i3[n3].slice(0, s4);
- }, d3 = function(t3) {
- return b2.s(s3 % 12 || 12, t3, "0");
- }, $2 = f3 || function(t3, e3, n3) {
- var r3 = t3 < 12 ? "AM" : "PM";
- return n3 ? r3.toLowerCase() : r3;
- };
- return r2.replace(y, function(t3, r3) {
- return r3 || function(t4) {
- switch (t4) {
- case "YY":
- return String(e2.$y).slice(-2);
- case "YYYY":
- return b2.s(e2.$y, 4, "0");
- case "M":
- return a3 + 1;
- case "MM":
- return b2.s(a3 + 1, 2, "0");
- case "MMM":
- return h3(n2.monthsShort, a3, c3, 3);
- case "MMMM":
- return h3(c3, a3);
- case "D":
- return e2.$D;
- case "DD":
- return b2.s(e2.$D, 2, "0");
- case "d":
- return String(e2.$W);
- case "dd":
- return h3(n2.weekdaysMin, e2.$W, o3, 2);
- case "ddd":
- return h3(n2.weekdaysShort, e2.$W, o3, 3);
- case "dddd":
- return o3[e2.$W];
- case "H":
- return String(s3);
- case "HH":
- return b2.s(s3, 2, "0");
- case "h":
- return d3(1);
- case "hh":
- return d3(2);
- case "a":
- return $2(s3, u3, true);
- case "A":
- return $2(s3, u3, false);
- case "m":
- return String(u3);
- case "mm":
- return b2.s(u3, 2, "0");
- case "s":
- return String(e2.$s);
- case "ss":
- return b2.s(e2.$s, 2, "0");
- case "SSS":
- return b2.s(e2.$ms, 3, "0");
- case "Z":
- return i2;
- }
- return null;
- }(t3) || i2.replace(":", "");
- });
- }, m3.utcOffset = function() {
- return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
- }, m3.diff = function(r2, d3, l3) {
- var $2, y2 = this, M4 = b2.p(d3), m4 = O2(r2), v3 = (m4.utcOffset() - this.utcOffset()) * e, g2 = this - m4, D3 = function() {
- return b2.m(y2, m4);
- };
- switch (M4) {
- case h2:
- $2 = D3() / 12;
- break;
- case c2:
- $2 = D3();
- break;
- case f2:
- $2 = D3() / 3;
- break;
- case o2:
- $2 = (g2 - v3) / 6048e5;
- break;
- case a2:
- $2 = (g2 - v3) / 864e5;
- break;
- case u2:
- $2 = g2 / n;
- break;
- case s2:
- $2 = g2 / e;
- break;
- case i:
- $2 = g2 / t;
- break;
- default:
- $2 = g2;
- }
- return l3 ? $2 : b2.a($2);
- }, m3.daysInMonth = function() {
- return this.endOf(c2).$D;
- }, m3.$locale = function() {
- return D2[this.$L];
- }, m3.locale = function(t2, e2) {
- if (!t2)
- return this.$L;
- var n2 = this.clone(), r2 = w2(t2, e2, true);
- return r2 && (n2.$L = r2), n2;
- }, m3.clone = function() {
- return b2.w(this.$d, this);
- }, m3.toDate = function() {
- return new Date(this.valueOf());
- }, m3.toJSON = function() {
- return this.isValid() ? this.toISOString() : null;
- }, m3.toISOString = function() {
- return this.$d.toISOString();
- }, m3.toString = function() {
- return this.$d.toUTCString();
- }, M3;
- }(), k = _2.prototype;
- return O2.prototype = k, [["$ms", r], ["$s", i], ["$m", s2], ["$H", u2], ["$W", a2], ["$M", c2], ["$y", h2], ["$D", d2]].forEach(function(t2) {
- k[t2[1]] = function(e2) {
- return this.$g(e2, t2[0], t2[1]);
- };
- }), O2.extend = function(t2, e2) {
- return t2.$i || (t2(e2, _2, O2), t2.$i = true), O2;
- }, O2.locale = w2, O2.isDayjs = S2, O2.unix = function(t2) {
- return O2(1e3 * t2);
- }, O2.en = D2[g], O2.Ls = D2, O2.p = {}, O2;
- });
- })(dayjs_min);
- var dayjs = dayjs_min.exports;
- var localeData$1 = { exports: {} };
- (function(module2, exports2) {
- !function(n, e) {
- module2.exports = e();
- }(commonjsGlobal, function() {
- return function(n, e, t) {
- var r = e.prototype, o2 = function(n2) {
- return n2 && (n2.indexOf ? n2 : n2.s);
- }, u2 = function(n2, e2, t2, r2, u3) {
- var i2 = n2.name ? n2 : n2.$locale(), a3 = o2(i2[e2]), s3 = o2(i2[t2]), f2 = a3 || s3.map(function(n3) {
- return n3.slice(0, r2);
- });
- if (!u3)
- return f2;
- var d2 = i2.weekStart;
- return f2.map(function(n3, e3) {
- return f2[(e3 + (d2 || 0)) % 7];
- });
- }, i = function() {
- return t.Ls[t.locale()];
- }, a2 = function(n2, e2) {
- return n2.formats[e2] || function(n3) {
- return n3.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(n4, e3, t2) {
- return e3 || t2.slice(1);
- });
- }(n2.formats[e2.toUpperCase()]);
- }, s2 = function() {
- var n2 = this;
- return { months: function(e2) {
- return e2 ? e2.format("MMMM") : u2(n2, "months");
- }, monthsShort: function(e2) {
- return e2 ? e2.format("MMM") : u2(n2, "monthsShort", "months", 3);
- }, firstDayOfWeek: function() {
- return n2.$locale().weekStart || 0;
- }, weekdays: function(e2) {
- return e2 ? e2.format("dddd") : u2(n2, "weekdays");
- }, weekdaysMin: function(e2) {
- return e2 ? e2.format("dd") : u2(n2, "weekdaysMin", "weekdays", 2);
- }, weekdaysShort: function(e2) {
- return e2 ? e2.format("ddd") : u2(n2, "weekdaysShort", "weekdays", 3);
- }, longDateFormat: function(e2) {
- return a2(n2.$locale(), e2);
- }, meridiem: this.$locale().meridiem, ordinal: this.$locale().ordinal };
- };
- r.localeData = function() {
- return s2.bind(this)();
- }, t.localeData = function() {
- var n2 = i();
- return { firstDayOfWeek: function() {
- return n2.weekStart || 0;
- }, weekdays: function() {
- return t.weekdays();
- }, weekdaysShort: function() {
- return t.weekdaysShort();
- }, weekdaysMin: function() {
- return t.weekdaysMin();
- }, months: function() {
- return t.months();
- }, monthsShort: function() {
- return t.monthsShort();
- }, longDateFormat: function(e2) {
- return a2(n2, e2);
- }, meridiem: n2.meridiem, ordinal: n2.ordinal };
- }, t.months = function() {
- return u2(i(), "months");
- }, t.monthsShort = function() {
- return u2(i(), "monthsShort", "months", 3);
- }, t.weekdays = function(n2) {
- return u2(i(), "weekdays", null, null, n2);
- }, t.weekdaysShort = function(n2) {
- return u2(i(), "weekdaysShort", "weekdays", 3, n2);
- }, t.weekdaysMin = function(n2) {
- return u2(i(), "weekdaysMin", "weekdays", 2, n2);
- };
- };
- });
- })(localeData$1);
- var localeData = localeData$1.exports;
- var customParseFormat$1 = { exports: {} };
- (function(module2, exports2) {
- !function(e, t) {
- module2.exports = t();
- }(commonjsGlobal, function() {
- 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) {
- return (e2 = +e2) + (e2 > 68 ? 1900 : 2e3);
- };
- var f2 = function(e2) {
- return function(t2) {
- this[e2] = +t2;
- };
- }, h2 = [/[+-]\d\d:?(\d\d)?|Z/, function(e2) {
- (this.zone || (this.zone = {})).offset = function(e3) {
- if (!e3)
- return 0;
- if (e3 === "Z")
- return 0;
- var t2 = e3.match(/([+-]|\d\d)/g), n2 = 60 * t2[1] + (+t2[2] || 0);
- return n2 === 0 ? 0 : t2[0] === "+" ? -n2 : n2;
- }(e2);
- }], u2 = function(e2) {
- var t2 = s2[e2];
- return t2 && (t2.indexOf ? t2 : t2.s.concat(t2.f));
- }, d2 = function(e2, t2) {
- var n2, r2 = s2.meridiem;
- if (r2) {
- for (var i2 = 1; i2 <= 24; i2 += 1)
- if (e2.indexOf(r2(i2, 0, t2)) > -1) {
- n2 = i2 > 12;
- break;
- }
- } else
- n2 = e2 === (t2 ? "pm" : "PM");
- return n2;
- }, c2 = { A: [o2, function(e2) {
- this.afternoon = d2(e2, false);
- }], a: [o2, function(e2) {
- this.afternoon = d2(e2, true);
- }], Q: [n, function(e2) {
- this.month = 3 * (e2 - 1) + 1;
- }], S: [n, function(e2) {
- this.milliseconds = 100 * +e2;
- }], SS: [r, function(e2) {
- this.milliseconds = 10 * +e2;
- }], SSS: [/\d{3}/, function(e2) {
- this.milliseconds = +e2;
- }], 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) {
- var t2 = s2.ordinal, n2 = e2.match(/\d+/);
- if (this.day = n2[0], t2)
- for (var r2 = 1; r2 <= 31; r2 += 1)
- t2(r2).replace(/\[|\]/g, "") === e2 && (this.day = r2);
- }], w: [i, f2("week")], ww: [r, f2("week")], M: [i, f2("month")], MM: [r, f2("month")], MMM: [o2, function(e2) {
- var t2 = u2("months"), n2 = (u2("monthsShort") || t2.map(function(e3) {
- return e3.slice(0, 3);
- })).indexOf(e2) + 1;
- if (n2 < 1)
- throw new Error();
- this.month = n2 % 12 || n2;
- }], MMMM: [o2, function(e2) {
- var t2 = u2("months").indexOf(e2) + 1;
- if (t2 < 1)
- throw new Error();
- this.month = t2 % 12 || t2;
- }], Y: [/[+-]?\d+/, f2("year")], YY: [r, function(e2) {
- this.year = a2(e2);
- }], YYYY: [/\d{4}/, f2("year")], Z: h2, ZZ: h2 };
- function l2(n2) {
- var r2, i2;
- r2 = n2, i2 = s2 && s2.formats;
- for (var o3 = (n2 = r2.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, function(t2, n3, r3) {
- var o4 = r3 && r3.toUpperCase();
- return n3 || i2[r3] || e[r3] || i2[o4].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(e2, t3, n4) {
- return t3 || n4.slice(1);
- });
- })).match(t), a3 = o3.length, f3 = 0; f3 < a3; f3 += 1) {
- var h3 = o3[f3], u3 = c2[h3], d3 = u3 && u3[0], l3 = u3 && u3[1];
- o3[f3] = l3 ? { regex: d3, parser: l3 } : h3.replace(/^\[|\]$/g, "");
- }
- return function(e2) {
- for (var t2 = {}, n3 = 0, r3 = 0; n3 < a3; n3 += 1) {
- var i3 = o3[n3];
- if (typeof i3 == "string")
- r3 += i3.length;
- else {
- var s3 = i3.regex, f4 = i3.parser, h4 = e2.slice(r3), u4 = s3.exec(h4)[0];
- f4.call(t2, u4), e2 = e2.replace(u4, "");
- }
- }
- return function(e3) {
- var t3 = e3.afternoon;
- if (t3 !== void 0) {
- var n4 = e3.hours;
- t3 ? n4 < 12 && (e3.hours += 12) : n4 === 12 && (e3.hours = 0), delete e3.afternoon;
- }
- }(t2), t2;
- };
- }
- return function(e2, t2, n2) {
- n2.p.customParseFormat = true, e2 && e2.parseTwoDigitYear && (a2 = e2.parseTwoDigitYear);
- var r2 = t2.prototype, i2 = r2.parse;
- r2.parse = function(e3) {
- var t3 = e3.date, r3 = e3.utc, o3 = e3.args;
- this.$u = r3;
- var a3 = o3[1];
- if (typeof a3 == "string") {
- var f3 = o3[2] === true, h3 = o3[3] === true, u3 = f3 || h3, d3 = o3[2];
- h3 && (d3 = o3[2]), s2 = this.$locale(), !f3 && d3 && (s2 = n2.Ls[d3]), this.$d = function(e4, t4, n3, r4) {
- try {
- if (["x", "X"].indexOf(t4) > -1)
- return new Date((t4 === "X" ? 1e3 : 1) * e4);
- 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;
- o4 && !s3 || (v2 = s3 > 0 ? s3 - 1 : M3.getMonth());
- var D2, w2 = f4 || 0, g = h4 || 0, y = u4 || 0, L = d4 || 0;
- 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);
- } catch (e5) {
- return new Date("");
- }
- }(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 = {};
- } else if (a3 instanceof Array)
- for (var c3 = a3.length, m2 = 1; m2 <= c3; m2 += 1) {
- o3[1] = a3[m2 - 1];
- var M2 = n2.apply(this, o3);
- if (M2.isValid()) {
- this.$d = M2.$d, this.$L = M2.$L, this.init();
- break;
- }
- m2 === c3 && (this.$d = new Date(""));
- }
- else
- i2.call(this, e3);
- };
- };
- });
- })(customParseFormat$1);
- var customParseFormat = customParseFormat$1.exports;
- const DEFAULT_FORMATS_TIME = "HH:mm:ss";
- const DEFAULT_FORMATS_DATE = "YYYY-MM-DD";
- const DEFAULT_FORMATS_DATEPICKER = {
- date: DEFAULT_FORMATS_DATE,
- week: "gggg[w]ww",
- year: "YYYY",
- month: "YYYY-MM",
- datetime: `${DEFAULT_FORMATS_DATE} ${DEFAULT_FORMATS_TIME}`,
- monthrange: "YYYY-MM",
- daterange: DEFAULT_FORMATS_DATE,
- datetimerange: `${DEFAULT_FORMATS_DATE} ${DEFAULT_FORMATS_TIME}`
- };
- const timePickerDefaultProps = {
- id: {
- type: [Array, String]
- },
- name: {
- type: [Array, String],
- default: ""
- },
- popperClass: {
- type: String,
- default: ""
- },
- format: {
- type: String
- },
- valueFormat: {
- type: String
- },
- type: {
- type: String,
- default: ""
- },
- clearable: {
- type: Boolean,
- default: true
- },
- clearIcon: {
- type: [String, Object],
- default: circleClose
- },
- editable: {
- type: Boolean,
- default: true
- },
- prefixIcon: {
- type: [String, Object],
- default: ""
- },
- size: {
- type: String,
- validator: isValidComponentSize
- },
- readonly: {
- type: Boolean,
- default: false
- },
- disabled: {
- type: Boolean,
- default: false
- },
- placeholder: {
- type: String,
- default: ""
- },
- popperOptions: {
- type: Object,
- default: () => ({})
- },
- modelValue: {
- type: [Date, Array, String, Number],
- default: ""
- },
- rangeSeparator: {
- type: String,
- default: "-"
- },
- startPlaceholder: String,
- endPlaceholder: String,
- defaultValue: {
- type: [Date, Array]
- },
- defaultTime: {
- type: [Date, Array]
- },
- isRange: {
- type: Boolean,
- default: false
- },
- disabledHours: {
- type: Function
- },
- disabledMinutes: {
- type: Function
- },
- disabledSeconds: {
- type: Function
- },
- disabledDate: {
- type: Function
- },
- cellClassName: {
- type: Function
- },
- shortcuts: {
- type: Array,
- default: () => []
- },
- arrowControl: {
- type: Boolean,
- default: false
- },
- validateEvent: {
- type: Boolean,
- default: true
- },
- unlinkPanels: Boolean
- };
- const dateEquals = function(a2, b2) {
- const aIsDate = a2 instanceof Date;
- const bIsDate = b2 instanceof Date;
- if (aIsDate && bIsDate) {
- return a2.getTime() === b2.getTime();
- }
- if (!aIsDate && !bIsDate) {
- return a2 === b2;
- }
- return false;
- };
- const valueEquals = function(a2, b2) {
- const aIsArray = Array.isArray(a2);
- const bIsArray = Array.isArray(b2);
- if (aIsArray && bIsArray) {
- if (a2.length !== b2.length) {
- return false;
- }
- return a2.every((item, index) => dateEquals(item, b2[index]));
- }
- if (!aIsArray && !bIsArray) {
- return dateEquals(a2, b2);
- }
- return false;
- };
- const parser = function(date4, format2, lang) {
- const day = isEmpty(format2) || format2 === "x" ? dayjs(date4).locale(lang) : dayjs(date4, format2).locale(lang);
- return day.isValid() ? day : void 0;
- };
- const formatter = function(date4, format2, lang) {
- if (isEmpty(format2))
- return date4;
- if (format2 === "x")
- return +date4;
- return dayjs(date4).locale(lang).format(format2);
- };
- const _sfc_main$T = defineComponent({
- name: "Picker",
- components: {
- ElInput,
- ElTooltip,
- ElIcon
- },
- props: timePickerDefaultProps,
- emits: [
- "update:modelValue",
- "change",
- "focus",
- "blur",
- "calendar-change",
- "panel-change",
- "visible-change"
- ],
- setup(props, ctx) {
- const { lang } = useLocale();
- const nsDate = useNamespace("date");
- const nsInput = useNamespace("input");
- const nsRange = useNamespace("range");
- const elForm2 = inject(formContextKey, {});
- const elFormItem2 = inject(formItemContextKey, {});
- const elPopperOptions = inject("ElPopperOptions", {});
- const refPopper = ref();
- const inputRef = ref();
- const pickerVisible = ref(false);
- const pickerActualVisible = ref(false);
- const valueOnOpen = ref(null);
- watch(pickerVisible, (val) => {
- var _a2;
- if (!val) {
- userInput.value = null;
- nextTick(() => {
- emitChange(props.modelValue);
- });
- ctx.emit("blur");
- blurInput();
- props.validateEvent && ((_a2 = elFormItem2.validate) == null ? void 0 : _a2.call(elFormItem2, "blur").catch((err) => debugWarn()));
- } else {
- valueOnOpen.value = props.modelValue;
- }
- });
- const emitChange = (val, isClear) => {
- var _a2;
- if (isClear || !valueEquals(val, valueOnOpen.value)) {
- ctx.emit("change", val);
- props.validateEvent && ((_a2 = elFormItem2.validate) == null ? void 0 : _a2.call(elFormItem2, "change").catch((err) => debugWarn()));
- }
- };
- const emitInput = (val) => {
- if (!valueEquals(props.modelValue, val)) {
- let formatValue;
- if (Array.isArray(val)) {
- formatValue = val.map((_2) => formatter(_2, props.valueFormat, lang.value));
- } else if (val) {
- formatValue = formatter(val, props.valueFormat, lang.value);
- }
- ctx.emit("update:modelValue", val ? formatValue : val, lang.value);
- }
- };
- const refInput = computed(() => {
- if (inputRef.value) {
- const _r = isRangeInput.value ? inputRef.value : inputRef.value.$el;
- return Array.from(_r.querySelectorAll("input"));
- }
- return [];
- });
- const refStartInput = computed(() => {
- return refInput == null ? void 0 : refInput.value[0];
- });
- const refEndInput = computed(() => {
- return refInput == null ? void 0 : refInput.value[1];
- });
- const setSelectionRange = (start2, end2, pos) => {
- const _inputs = refInput.value;
- if (!_inputs.length)
- return;
- if (!pos || pos === "min") {
- _inputs[0].setSelectionRange(start2, end2);
- _inputs[0].focus();
- } else if (pos === "max") {
- _inputs[1].setSelectionRange(start2, end2);
- _inputs[1].focus();
- }
- };
- const onPick = (date4 = "", visible = false) => {
- pickerVisible.value = visible;
- let result;
- if (Array.isArray(date4)) {
- result = date4.map((_2) => _2.toDate());
- } else {
- result = date4 ? date4.toDate() : date4;
- }
- userInput.value = null;
- emitInput(result);
- };
- const onBeforeShow = () => {
- pickerActualVisible.value = true;
- };
- const onShow = () => {
- ctx.emit("visible-change", true);
- };
- const onHide = () => {
- pickerActualVisible.value = false;
- ctx.emit("visible-change", false);
- };
- const focus = (focusStartInput = true) => {
- let input = refStartInput.value;
- if (!focusStartInput && isRangeInput.value) {
- input = refEndInput.value;
- }
- if (input) {
- input.focus();
- }
- };
- const handleFocus = (e) => {
- if (props.readonly || pickerDisabled.value || pickerVisible.value)
- return;
- pickerVisible.value = true;
- ctx.emit("focus", e);
- };
- const handleBlur = () => {
- var _a2;
- (_a2 = refPopper.value) == null ? void 0 : _a2.onClose();
- blurInput();
- };
- const pickerDisabled = computed(() => {
- return props.disabled || elForm2.disabled;
- });
- const parsedValue = computed(() => {
- let result;
- if (valueIsEmpty.value) {
- if (pickerOptions.value.getDefaultValue) {
- result = pickerOptions.value.getDefaultValue();
- }
- } else {
- if (Array.isArray(props.modelValue)) {
- result = props.modelValue.map((_2) => parser(_2, props.valueFormat, lang.value));
- } else {
- result = parser(props.modelValue, props.valueFormat, lang.value);
- }
- }
- if (pickerOptions.value.getRangeAvailableTime) {
- const availableResult = pickerOptions.value.getRangeAvailableTime(result);
- if (!isEqual(availableResult, result)) {
- result = availableResult;
- emitInput(Array.isArray(result) ? result.map((_2) => _2.toDate()) : result.toDate());
- }
- }
- if (Array.isArray(result) && result.some((_2) => !_2)) {
- result = [];
- }
- return result;
- });
- const displayValue = computed(() => {
- if (!pickerOptions.value.panelReady)
- return;
- const formattedValue = formatDayjsToString(parsedValue.value);
- if (Array.isArray(userInput.value)) {
- return [
- userInput.value[0] || formattedValue && formattedValue[0] || "",
- userInput.value[1] || formattedValue && formattedValue[1] || ""
- ];
- } else if (userInput.value !== null) {
- return userInput.value;
- }
- if (!isTimePicker.value && valueIsEmpty.value)
- return;
- if (!pickerVisible.value && valueIsEmpty.value)
- return;
- if (formattedValue) {
- return isDatesPicker.value ? formattedValue.join(", ") : formattedValue;
- }
- return "";
- });
- const isTimeLikePicker = computed(() => props.type.includes("time"));
- const isTimePicker = computed(() => props.type.startsWith("time"));
- const isDatesPicker = computed(() => props.type === "dates");
- const triggerIcon = computed(() => props.prefixIcon || (isTimeLikePicker.value ? clock : calendar));
- const showClose = ref(false);
- const onClearIconClick = (event) => {
- if (props.readonly || pickerDisabled.value)
- return;
- if (showClose.value) {
- event.stopPropagation();
- emitInput(null);
- emitChange(null, true);
- showClose.value = false;
- pickerVisible.value = false;
- pickerOptions.value.handleClear && pickerOptions.value.handleClear();
- }
- };
- const valueIsEmpty = computed(() => {
- return !props.modelValue || Array.isArray(props.modelValue) && !props.modelValue.length;
- });
- const onMouseEnter = () => {
- if (props.readonly || pickerDisabled.value)
- return;
- if (!valueIsEmpty.value && props.clearable) {
- showClose.value = true;
- }
- };
- const onMouseLeave = () => {
- showClose.value = false;
- };
- const isRangeInput = computed(() => {
- return props.type.includes("range");
- });
- const pickerSize = useSize();
- const popperPaneRef = computed(() => {
- var _a2, _b2;
- return (_b2 = (_a2 = refPopper.value) == null ? void 0 : _a2.popperRef) == null ? void 0 : _b2.contentRef;
- });
- const popperEl = computed(() => {
- var _a2, _b2;
- return (_b2 = (_a2 = unref(refPopper)) == null ? void 0 : _a2.popperRef) == null ? void 0 : _b2.contentRef;
- });
- const actualInputRef = computed(() => {
- var _a2;
- if (unref(isRangeInput)) {
- return unref(inputRef);
- }
- return (_a2 = unref(inputRef)) == null ? void 0 : _a2.$el;
- });
- onClickOutside(actualInputRef, (e) => {
- const unrefedPopperEl = unref(popperEl);
- const inputEl = unref(actualInputRef);
- if (unrefedPopperEl && (e.target === unrefedPopperEl || e.composedPath().includes(unrefedPopperEl)) || e.target === inputEl || e.composedPath().includes(inputEl))
- return;
- pickerVisible.value = false;
- });
- const userInput = ref(null);
- const handleChange2 = () => {
- if (userInput.value) {
- const value = parseUserInputToDayjs(displayValue.value);
- if (value) {
- if (isValidValue(value)) {
- emitInput(Array.isArray(value) ? value.map((_2) => _2.toDate()) : value.toDate());
- userInput.value = null;
- }
- }
- }
- if (userInput.value === "") {
- emitInput(null);
- emitChange(null);
- userInput.value = null;
- }
- };
- const blurInput = () => {
- refInput.value.forEach((input) => input.blur());
- };
- const parseUserInputToDayjs = (value) => {
- if (!value)
- return null;
- return pickerOptions.value.parseUserInput(value);
- };
- const formatDayjsToString = (value) => {
- if (!value)
- return null;
- return pickerOptions.value.formatToString(value);
- };
- const isValidValue = (value) => {
- return pickerOptions.value.isValidValue(value);
- };
- const handleKeydown = (event) => {
- const code = event.code;
- if (code === EVENT_CODE.esc) {
- pickerVisible.value = false;
- event.stopPropagation();
- return;
- }
- if (code === EVENT_CODE.tab) {
- if (!isRangeInput.value) {
- handleChange2();
- pickerVisible.value = false;
- event.stopPropagation();
- } else {
- setTimeout(() => {
- if (!refInput.value.includes(document.activeElement)) {
- pickerVisible.value = false;
- blurInput();
- }
- }, 0);
- }
- return;
- }
- if (code === EVENT_CODE.enter || code === EVENT_CODE.numpadEnter) {
- if (userInput.value === null || userInput.value === "" || isValidValue(parseUserInputToDayjs(displayValue.value))) {
- handleChange2();
- pickerVisible.value = false;
- }
- event.stopPropagation();
- return;
- }
- if (userInput.value) {
- event.stopPropagation();
- return;
- }
- if (pickerOptions.value.handleKeydown) {
- pickerOptions.value.handleKeydown(event);
- }
- };
- const onUserInput = (e) => {
- userInput.value = e;
- };
- const handleStartInput = (event) => {
- if (userInput.value) {
- userInput.value = [event.target.value, userInput.value[1]];
- } else {
- userInput.value = [event.target.value, null];
- }
- };
- const handleEndInput = (event) => {
- if (userInput.value) {
- userInput.value = [userInput.value[0], event.target.value];
- } else {
- userInput.value = [null, event.target.value];
- }
- };
- const handleStartChange = () => {
- const value = parseUserInputToDayjs(userInput.value && userInput.value[0]);
- if (value && value.isValid()) {
- userInput.value = [formatDayjsToString(value), displayValue.value[1]];
- const newValue = [value, parsedValue.value && parsedValue.value[1]];
- if (isValidValue(newValue)) {
- emitInput(newValue);
- userInput.value = null;
- }
- }
- };
- const handleEndChange = () => {
- const value = parseUserInputToDayjs(userInput.value && userInput.value[1]);
- if (value && value.isValid()) {
- userInput.value = [displayValue.value[0], formatDayjsToString(value)];
- const newValue = [parsedValue.value && parsedValue.value[0], value];
- if (isValidValue(newValue)) {
- emitInput(newValue);
- userInput.value = null;
- }
- }
- };
- const pickerOptions = ref({});
- const onSetPickerOption = (e) => {
- pickerOptions.value[e[0]] = e[1];
- pickerOptions.value.panelReady = true;
- };
- const onCalendarChange = (e) => {
- ctx.emit("calendar-change", e);
- };
- const onPanelChange = (value, mode, view2) => {
- ctx.emit("panel-change", value, mode, view2);
- };
- provide("EP_PICKER_BASE", {
- props
- });
- return {
- nsDate,
- nsInput,
- nsRange,
- elPopperOptions,
- isDatesPicker,
- handleEndChange,
- handleStartChange,
- handleStartInput,
- handleEndInput,
- onUserInput,
- handleChange: handleChange2,
- handleKeydown,
- popperPaneRef,
- onClickOutside,
- pickerSize,
- isRangeInput,
- onMouseLeave,
- onMouseEnter,
- onClearIconClick,
- showClose,
- triggerIcon,
- onPick,
- handleFocus,
- handleBlur,
- pickerVisible,
- pickerActualVisible,
- displayValue,
- parsedValue,
- setSelectionRange,
- refPopper,
- inputRef,
- pickerDisabled,
- onSetPickerOption,
- onCalendarChange,
- onPanelChange,
- focus,
- onShow,
- onBeforeShow,
- onHide
- };
- }
- });
- const _hoisted_1$A = ["id", "name", "placeholder", "value", "disabled", "readonly"];
- const _hoisted_2$s = ["id", "name", "placeholder", "value", "disabled", "readonly"];
- function _sfc_render$w(_ctx, _cache, $props, $setup, $data, $options) {
- const _component_el_icon = resolveComponent("el-icon");
- const _component_el_input = resolveComponent("el-input");
- const _component_el_tooltip = resolveComponent("el-tooltip");
- return openBlock(), createBlock(_component_el_tooltip, mergeProps({
- ref: "refPopper",
- visible: _ctx.pickerVisible,
- "onUpdate:visible": _cache[17] || (_cache[17] = ($event) => _ctx.pickerVisible = $event),
- effect: "light",
- pure: "",
- trigger: "click"
- }, _ctx.$attrs, {
- "append-to-body": "",
- transition: `${_ctx.nsDate.namespace.value}-zoom-in-top`,
- "popper-class": [`${_ctx.nsDate.namespace.value}-picker__popper`, _ctx.popperClass],
- "popper-options": _ctx.elPopperOptions,
- "fallback-placements": ["bottom", "top", "right", "left"],
- "gpu-acceleration": false,
- "stop-popper-mouse-event": false,
- "hide-after": 0,
- persistent: "",
- onBeforeShow: _ctx.onBeforeShow,
- onShow: _ctx.onShow,
- onHide: _ctx.onHide
- }), {
- default: withCtx(() => [
- !_ctx.isRangeInput ? (openBlock(), createBlock(_component_el_input, {
- key: 0,
- id: _ctx.id,
- ref: "inputRef",
- "model-value": _ctx.displayValue,
- name: _ctx.name,
- size: _ctx.pickerSize,
- disabled: _ctx.pickerDisabled,
- placeholder: _ctx.placeholder,
- class: normalizeClass([_ctx.nsDate.b("editor"), _ctx.nsDate.bm("editor", _ctx.type), _ctx.$attrs.class]),
- style: normalizeStyle(_ctx.$attrs.style),
- readonly: !_ctx.editable || _ctx.readonly || _ctx.isDatesPicker || _ctx.type === "week",
- onInput: _ctx.onUserInput,
- onFocus: _ctx.handleFocus,
- onKeydown: _ctx.handleKeydown,
- onChange: _ctx.handleChange,
- onMouseenter: _ctx.onMouseEnter,
- onMouseleave: _ctx.onMouseLeave,
- onClick: _cache[0] || (_cache[0] = withModifiers(() => {
- }, ["stop"]))
- }, {
- prefix: withCtx(() => [
- _ctx.triggerIcon ? (openBlock(), createBlock(_component_el_icon, {
- key: 0,
- class: normalizeClass(_ctx.nsInput.e("icon")),
- onClick: _ctx.handleFocus
- }, {
- default: withCtx(() => [
- (openBlock(), createBlock(resolveDynamicComponent(_ctx.triggerIcon)))
- ]),
- _: 1
- }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true)
- ]),
- suffix: withCtx(() => [
- _ctx.showClose && _ctx.clearIcon ? (openBlock(), createBlock(_component_el_icon, {
- key: 0,
- class: normalizeClass(`${_ctx.nsInput.e("icon")} clear-icon`),
- onClick: _ctx.onClearIconClick
- }, {
- default: withCtx(() => [
- (openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon)))
- ]),
- _: 1
- }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true)
- ]),
- _: 1
- }, 8, ["id", "model-value", "name", "size", "disabled", "placeholder", "class", "style", "readonly", "onInput", "onFocus", "onKeydown", "onChange", "onMouseenter", "onMouseleave"])) : (openBlock(), createElementBlock("div", {
- key: 1,
- ref: "inputRef",
- class: normalizeClass([
- _ctx.nsDate.b("editor"),
- _ctx.nsDate.bm("editor", _ctx.type),
- _ctx.nsInput.e("inner"),
- _ctx.nsDate.is("disabled", _ctx.pickerDisabled),
- _ctx.nsDate.is("active", _ctx.pickerVisible),
- _ctx.nsRange.b("editor"),
- _ctx.pickerSize ? _ctx.nsRange.bm("editor", _ctx.pickerSize) : "",
- _ctx.$attrs.class
- ]),
- style: normalizeStyle(_ctx.$attrs.style),
- onClick: _cache[7] || (_cache[7] = (...args) => _ctx.handleFocus && _ctx.handleFocus(...args)),
- onMouseenter: _cache[8] || (_cache[8] = (...args) => _ctx.onMouseEnter && _ctx.onMouseEnter(...args)),
- onMouseleave: _cache[9] || (_cache[9] = (...args) => _ctx.onMouseLeave && _ctx.onMouseLeave(...args)),
- onKeydown: _cache[10] || (_cache[10] = (...args) => _ctx.handleKeydown && _ctx.handleKeydown(...args))
- }, [
- _ctx.triggerIcon ? (openBlock(), createBlock(_component_el_icon, {
- key: 0,
- class: normalizeClass([_ctx.nsInput.e("icon"), _ctx.nsRange.e("icon")]),
- onClick: _ctx.handleFocus
- }, {
- default: withCtx(() => [
- (openBlock(), createBlock(resolveDynamicComponent(_ctx.triggerIcon)))
- ]),
- _: 1
- }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true),
- createElementVNode("input", {
- id: _ctx.id && _ctx.id[0],
- autocomplete: "off",
- name: _ctx.name && _ctx.name[0],
- placeholder: _ctx.startPlaceholder,
- value: _ctx.displayValue && _ctx.displayValue[0],
- disabled: _ctx.pickerDisabled,
- readonly: !_ctx.editable || _ctx.readonly,
- class: normalizeClass(_ctx.nsRange.b("input")),
- onInput: _cache[1] || (_cache[1] = (...args) => _ctx.handleStartInput && _ctx.handleStartInput(...args)),
- onChange: _cache[2] || (_cache[2] = (...args) => _ctx.handleStartChange && _ctx.handleStartChange(...args)),
- onFocus: _cache[3] || (_cache[3] = (...args) => _ctx.handleFocus && _ctx.handleFocus(...args))
- }, null, 42, _hoisted_1$A),
- renderSlot(_ctx.$slots, "range-separator", {}, () => [
- createElementVNode("span", {
- class: normalizeClass(_ctx.nsRange.b("separator"))
- }, toDisplayString(_ctx.rangeSeparator), 3)
- ]),
- createElementVNode("input", {
- id: _ctx.id && _ctx.id[1],
- autocomplete: "off",
- name: _ctx.name && _ctx.name[1],
- placeholder: _ctx.endPlaceholder,
- value: _ctx.displayValue && _ctx.displayValue[1],
- disabled: _ctx.pickerDisabled,
- readonly: !_ctx.editable || _ctx.readonly,
- class: normalizeClass(_ctx.nsRange.b("input")),
- onFocus: _cache[4] || (_cache[4] = (...args) => _ctx.handleFocus && _ctx.handleFocus(...args)),
- onInput: _cache[5] || (_cache[5] = (...args) => _ctx.handleEndInput && _ctx.handleEndInput(...args)),
- onChange: _cache[6] || (_cache[6] = (...args) => _ctx.handleEndChange && _ctx.handleEndChange(...args))
- }, null, 42, _hoisted_2$s),
- _ctx.clearIcon ? (openBlock(), createBlock(_component_el_icon, {
- key: 1,
- class: normalizeClass([
- _ctx.nsInput.e("icon"),
- _ctx.nsRange.e("close-icon"),
- {
- [_ctx.nsRange.e("close-icon--hidden")]: !_ctx.showClose
- }
- ]),
- onClick: _ctx.onClearIconClick
- }, {
- default: withCtx(() => [
- (openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon)))
- ]),
- _: 1
- }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true)
- ], 38))
- ]),
- content: withCtx(() => [
- renderSlot(_ctx.$slots, "default", {
- visible: _ctx.pickerVisible,
- actualVisible: _ctx.pickerActualVisible,
- parsedValue: _ctx.parsedValue,
- format: _ctx.format,
- unlinkPanels: _ctx.unlinkPanels,
- type: _ctx.type,
- defaultValue: _ctx.defaultValue,
- onPick: _cache[11] || (_cache[11] = (...args) => _ctx.onPick && _ctx.onPick(...args)),
- onSelectRange: _cache[12] || (_cache[12] = (...args) => _ctx.setSelectionRange && _ctx.setSelectionRange(...args)),
- onSetPickerOption: _cache[13] || (_cache[13] = (...args) => _ctx.onSetPickerOption && _ctx.onSetPickerOption(...args)),
- onCalendarChange: _cache[14] || (_cache[14] = (...args) => _ctx.onCalendarChange && _ctx.onCalendarChange(...args)),
- onPanelChange: _cache[15] || (_cache[15] = (...args) => _ctx.onPanelChange && _ctx.onPanelChange(...args)),
- onMousedown: _cache[16] || (_cache[16] = withModifiers(() => {
- }, ["stop"]))
- })
- ]),
- _: 3
- }, 16, ["visible", "transition", "popper-class", "popper-options", "onBeforeShow", "onShow", "onHide"]);
- }
- 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"]]);
- const nodeList = /* @__PURE__ */ new Map();
- let startClick;
- if (isClient) {
- document.addEventListener("mousedown", (e) => startClick = e);
- document.addEventListener("mouseup", (e) => {
- for (const handlers of nodeList.values()) {
- for (const { documentHandler } of handlers) {
- documentHandler(e, startClick);
- }
- }
- });
- }
- function createDocumentHandler(el, binding) {
- let excludes = [];
- if (Array.isArray(binding.arg)) {
- excludes = binding.arg;
- } else if (isElement$1(binding.arg)) {
- excludes.push(binding.arg);
- }
- return function(mouseup, mousedown) {
- const popperRef = binding.instance.popperRef;
- const mouseUpTarget = mouseup.target;
- const mouseDownTarget = mousedown == null ? void 0 : mousedown.target;
- const isBound = !binding || !binding.instance;
- const isTargetExists = !mouseUpTarget || !mouseDownTarget;
- const isContainedByEl = el.contains(mouseUpTarget) || el.contains(mouseDownTarget);
- const isSelf = el === mouseUpTarget;
- const isTargetExcluded = excludes.length && excludes.some((item) => item == null ? void 0 : item.contains(mouseUpTarget)) || excludes.length && excludes.includes(mouseDownTarget);
- const isContainedByPopper = popperRef && (popperRef.contains(mouseUpTarget) || popperRef.contains(mouseDownTarget));
- if (isBound || isTargetExists || isContainedByEl || isSelf || isTargetExcluded || isContainedByPopper) {
- return;
- }
- binding.value(mouseup, mousedown);
- };
- }
- const ClickOutside = {
- beforeMount(el, binding) {
- if (!nodeList.has(el)) {
- nodeList.set(el, []);
- }
- nodeList.get(el).push({
- documentHandler: createDocumentHandler(el, binding),
- bindingFn: binding.value
- });
- },
- updated(el, binding) {
- if (!nodeList.has(el)) {
- nodeList.set(el, []);
- }
- const handlers = nodeList.get(el);
- const oldHandlerIndex = handlers.findIndex((item) => item.bindingFn === binding.oldValue);
- const newHandler = {
- documentHandler: createDocumentHandler(el, binding),
- bindingFn: binding.value
- };
- if (oldHandlerIndex >= 0) {
- handlers.splice(oldHandlerIndex, 1, newHandler);
- } else {
- handlers.push(newHandler);
- }
- },
- unmounted(el) {
- nodeList.delete(el);
- }
- };
- var RepeatClick = {
- beforeMount(el, binding) {
- let interval = null;
- let startTime;
- const handler3 = () => binding.value && binding.value();
- const clear = () => {
- if (Date.now() - startTime < 100) {
- handler3();
- }
- clearInterval(interval);
- interval = null;
- };
- on(el, "mousedown", (e) => {
- if (e.button !== 0)
- return;
- startTime = Date.now();
- once(document, "mouseup", clear);
- clearInterval(interval);
- interval = setInterval(handler3, 100);
- });
- }
- };
- var v = false, o, f, s, u, d, N, l, p, m, w, D, x, E, M, F;
- function a() {
- if (!v) {
- v = true;
- 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);
- 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) {
- o = n[1] ? parseFloat(n[1]) : n[5] ? parseFloat(n[5]) : NaN, o && document && document.documentMode && (o = document.documentMode);
- var r = /(?:Trident\/(\d+.\d+))/.exec(e);
- 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;
- } else
- o = f = s = d = u = NaN;
- if (i) {
- if (i[1]) {
- var t = /(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(e);
- l = t ? parseFloat(t[1].replace("_", ".")) : true;
- } else
- l = false;
- p = !!i[2], m = !!i[3];
- } else
- l = p = m = false;
- }
- }
- var _ = { ie: function() {
- return a() || o;
- }, ieCompatibilityMode: function() {
- return a() || N > o;
- }, ie64: function() {
- return _.ie() && D;
- }, firefox: function() {
- return a() || f;
- }, opera: function() {
- return a() || s;
- }, webkit: function() {
- return a() || u;
- }, safari: function() {
- return _.webkit();
- }, chrome: function() {
- return a() || d;
- }, windows: function() {
- return a() || p;
- }, osx: function() {
- return a() || l;
- }, linux: function() {
- return a() || m;
- }, iphone: function() {
- return a() || x;
- }, mobile: function() {
- return a() || x || E || w || F;
- }, nativeApp: function() {
- return a() || M;
- }, android: function() {
- return a() || w;
- }, ipad: function() {
- return a() || E;
- } }, A = _;
- 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;
- var X;
- h.canUseDOM && (X = document.implementation && document.implementation.hasFeature && document.implementation.hasFeature("", "") !== true);
- function S(e, n) {
- if (!h.canUseDOM || n && !("addEventListener" in document))
- return false;
- var i = "on" + e, r = i in document;
- if (!r) {
- var t = document.createElement("div");
- t.setAttribute(i, "return;"), r = typeof t[i] == "function";
- }
- return !r && X && e === "wheel" && (r = document.implementation.hasFeature("Events.wheel", "3.0")), r;
- }
- var b = S;
- var O = 10, I = 40, P = 800;
- function T(e) {
- var n = 0, i = 0, r = 0, t = 0;
- 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 };
- }
- T.getEventType = function() {
- return A.firefox() ? "DOMMouseScroll" : b("wheel") ? "wheel" : "mousewheel";
- };
- var Y = T;
- /**
- * Checks if an event is supported in the current execution environment.
- *
- * NOTE: This will not work correctly for non-generic events such as `change`,
- * `reset`, `load`, `error`, and `select`.
- *
- * Borrows from Modernizr.
- *
- * @param {string} eventNameSuffix Event name, e.g. "click".
- * @param {?boolean} capture Check if the capture phase is supported.
- * @return {boolean} True if the event is supported.
- * @internal
- * @license Modernizr 3.0.0pre (Custom Build) | MIT
- */
- const mousewheel = function(element, callback) {
- if (element && element.addEventListener) {
- const fn2 = function(event) {
- const normalized = Y(event);
- callback && Reflect.apply(callback, this, [event, normalized]);
- };
- if (isFirefox()) {
- element.addEventListener("DOMMouseScroll", fn2);
- } else {
- element.onmousewheel = fn2;
- }
- }
- };
- const Mousewheel = {
- beforeMount(el, binding) {
- mousewheel(el, binding.value);
- }
- };
- const makeList = (total, method4, methodFunc) => {
- const arr = [];
- const disabledArr = method4 && methodFunc();
- for (let i = 0; i < total; i++) {
- arr[i] = disabledArr ? disabledArr.includes(i) : false;
- }
- return arr;
- };
- const makeAvailableArr = (list) => {
- return list.map((_2, index) => !_2 ? index : _2).filter((_2) => _2 !== true);
- };
- const getTimeLists = (disabledHours, disabledMinutes, disabledSeconds) => {
- const getHoursList = (role, compare) => {
- return makeList(24, disabledHours, () => disabledHours(role, compare));
- };
- const getMinutesList = (hour, role, compare) => {
- return makeList(60, disabledMinutes, () => disabledMinutes(hour, role, compare));
- };
- const getSecondsList = (hour, minute, role, compare) => {
- return makeList(60, disabledSeconds, () => disabledSeconds(hour, minute, role, compare));
- };
- return {
- getHoursList,
- getMinutesList,
- getSecondsList
- };
- };
- const getAvailableArrs = (disabledHours, disabledMinutes, disabledSeconds) => {
- const { getHoursList, getMinutesList, getSecondsList } = getTimeLists(disabledHours, disabledMinutes, disabledSeconds);
- const getAvailableHours = (role, compare) => {
- return makeAvailableArr(getHoursList(role, compare));
- };
- const getAvailableMinutes = (hour, role, compare) => {
- return makeAvailableArr(getMinutesList(hour, role, compare));
- };
- const getAvailableSeconds = (hour, minute, role, compare) => {
- return makeAvailableArr(getSecondsList(hour, minute, role, compare));
- };
- return {
- getAvailableHours,
- getAvailableMinutes,
- getAvailableSeconds
- };
- };
- const useOldValue = (props) => {
- const oldValue = ref(props.parsedValue);
- watch(() => props.visible, (val) => {
- if (!val) {
- oldValue.value = props.parsedValue;
- }
- });
- return oldValue;
- };
- const _sfc_main$S = defineComponent({
- directives: {
- repeatClick: RepeatClick
- },
- components: {
- ElScrollbar,
- ElIcon,
- ArrowUp: arrowUp,
- ArrowDown: arrowDown
- },
- props: {
- role: {
- type: String,
- required: true
- },
- spinnerDate: {
- type: Object,
- required: true
- },
- showSeconds: {
- type: Boolean,
- default: true
- },
- arrowControl: Boolean,
- amPmMode: {
- type: String,
- default: ""
- },
- disabledHours: {
- type: Function
- },
- disabledMinutes: {
- type: Function
- },
- disabledSeconds: {
- type: Function
- }
- },
- emits: ["change", "select-range", "set-option"],
- setup(props, ctx) {
- const ns = useNamespace("time");
- let isScrolling = false;
- const debouncedResetScroll = debounce$1((type4) => {
- isScrolling = false;
- adjustCurrentSpinner(type4);
- }, 200);
- const currentScrollbar = ref(null);
- const listHoursRef = ref(null);
- const listMinutesRef = ref(null);
- const listSecondsRef = ref(null);
- const listRefsMap = {
- hours: listHoursRef,
- minutes: listMinutesRef,
- seconds: listSecondsRef
- };
- const spinnerItems = computed(() => {
- const arr = ["hours", "minutes", "seconds"];
- return props.showSeconds ? arr : arr.slice(0, 2);
- });
- const hours = computed(() => {
- return props.spinnerDate.hour();
- });
- const minutes = computed(() => {
- return props.spinnerDate.minute();
- });
- const seconds = computed(() => {
- return props.spinnerDate.second();
- });
- const timePartsMap = computed(() => ({
- hours,
- minutes,
- seconds
- }));
- const hoursList = computed(() => {
- return getHoursList(props.role);
- });
- const minutesList = computed(() => {
- return getMinutesList(hours.value, props.role);
- });
- const secondsList = computed(() => {
- return getSecondsList(hours.value, minutes.value, props.role);
- });
- const listMap = computed(() => ({
- hours: hoursList,
- minutes: minutesList,
- seconds: secondsList
- }));
- const arrowHourList = computed(() => {
- const hour = hours.value;
- return [
- hour > 0 ? hour - 1 : void 0,
- hour,
- hour < 23 ? hour + 1 : void 0
- ];
- });
- const arrowMinuteList = computed(() => {
- const minute = minutes.value;
- return [
- minute > 0 ? minute - 1 : void 0,
- minute,
- minute < 59 ? minute + 1 : void 0
- ];
- });
- const arrowSecondList = computed(() => {
- const second = seconds.value;
- return [
- second > 0 ? second - 1 : void 0,
- second,
- second < 59 ? second + 1 : void 0
- ];
- });
- const arrowListMap = computed(() => ({
- hours: arrowHourList,
- minutes: arrowMinuteList,
- seconds: arrowSecondList
- }));
- const getAmPmFlag = (hour) => {
- const shouldShowAmPm = !!props.amPmMode;
- if (!shouldShowAmPm)
- return "";
- const isCapital = props.amPmMode === "A";
- let content2 = hour < 12 ? " am" : " pm";
- if (isCapital)
- content2 = content2.toUpperCase();
- return content2;
- };
- const emitSelectRange = (type4) => {
- if (type4 === "hours") {
- ctx.emit("select-range", 0, 2);
- } else if (type4 === "minutes") {
- ctx.emit("select-range", 3, 5);
- } else if (type4 === "seconds") {
- ctx.emit("select-range", 6, 8);
- }
- currentScrollbar.value = type4;
- };
- const adjustCurrentSpinner = (type4) => {
- adjustSpinner(type4, timePartsMap.value[type4].value);
- };
- const adjustSpinners = () => {
- adjustCurrentSpinner("hours");
- adjustCurrentSpinner("minutes");
- adjustCurrentSpinner("seconds");
- };
- const getScrollbarElement = (el) => el.querySelector(`.${ns.namespace.value}-scrollbar__wrap`);
- const adjustSpinner = (type4, value) => {
- if (props.arrowControl)
- return;
- const el = listRefsMap[type4];
- if (el && el.$el) {
- getScrollbarElement(el.$el).scrollTop = Math.max(0, value * typeItemHeight(type4));
- }
- };
- const typeItemHeight = (type4) => {
- const el = listRefsMap[type4];
- return el.$el.querySelector("li").offsetHeight;
- };
- const onIncreaseClick = () => {
- scrollDown(1);
- };
- const onDecreaseClick = () => {
- scrollDown(-1);
- };
- const scrollDown = (step) => {
- if (!currentScrollbar.value) {
- emitSelectRange("hours");
- }
- const label = currentScrollbar.value;
- let now2 = timePartsMap.value[label].value;
- const total = currentScrollbar.value === "hours" ? 24 : 60;
- now2 = (now2 + step + total) % total;
- modifyDateField(label, now2);
- adjustSpinner(label, now2);
- nextTick(() => emitSelectRange(currentScrollbar.value));
- };
- const modifyDateField = (type4, value) => {
- const list = listMap.value[type4].value;
- const isDisabled = list[value];
- if (isDisabled)
- return;
- switch (type4) {
- case "hours":
- ctx.emit("change", props.spinnerDate.hour(value).minute(minutes.value).second(seconds.value));
- break;
- case "minutes":
- ctx.emit("change", props.spinnerDate.hour(hours.value).minute(value).second(seconds.value));
- break;
- case "seconds":
- ctx.emit("change", props.spinnerDate.hour(hours.value).minute(minutes.value).second(value));
- break;
- }
- };
- const handleClick = (type4, { value, disabled }) => {
- if (!disabled) {
- modifyDateField(type4, value);
- emitSelectRange(type4);
- adjustSpinner(type4, value);
- }
- };
- const handleScroll = (type4) => {
- isScrolling = true;
- debouncedResetScroll(type4);
- 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);
- modifyDateField(type4, value);
- };
- const scrollBarHeight = (type4) => {
- return listRefsMap[type4].$el.offsetHeight;
- };
- const bindScrollEvent = () => {
- const bindFunction = (type4) => {
- if (listRefsMap[type4] && listRefsMap[type4].$el) {
- getScrollbarElement(listRefsMap[type4].$el).onscroll = () => {
- handleScroll(type4);
- };
- }
- };
- bindFunction("hours");
- bindFunction("minutes");
- bindFunction("seconds");
- };
- onMounted(() => {
- nextTick(() => {
- !props.arrowControl && bindScrollEvent();
- adjustSpinners();
- if (props.role === "start")
- emitSelectRange("hours");
- });
- });
- const setRef = (scrollbar, type4) => {
- listRefsMap[type4] = scrollbar;
- };
- ctx.emit("set-option", [`${props.role}_scrollDown`, scrollDown]);
- ctx.emit("set-option", [`${props.role}_emitSelectRange`, emitSelectRange]);
- const { getHoursList, getMinutesList, getSecondsList } = getTimeLists(props.disabledHours, props.disabledMinutes, props.disabledSeconds);
- watch(() => props.spinnerDate, () => {
- if (isScrolling)
- return;
- adjustSpinners();
- });
- return {
- ns,
- setRef,
- spinnerItems,
- currentScrollbar,
- hours,
- minutes,
- seconds,
- hoursList,
- minutesList,
- arrowHourList,
- arrowMinuteList,
- arrowSecondList,
- getAmPmFlag,
- emitSelectRange,
- adjustCurrentSpinner,
- typeItemHeight,
- listHoursRef,
- listMinutesRef,
- listSecondsRef,
- onIncreaseClick,
- onDecreaseClick,
- handleClick,
- secondsList,
- timePartsMap,
- arrowListMap,
- listMap
- };
- }
- });
- const _hoisted_1$z = ["onClick"];
- const _hoisted_2$r = ["onMouseenter"];
- function _sfc_render$v(_ctx, _cache, $props, $setup, $data, $options) {
- const _component_el_scrollbar = resolveComponent("el-scrollbar");
- const _component_arrow_up = resolveComponent("arrow-up");
- const _component_el_icon = resolveComponent("el-icon");
- const _component_arrow_down = resolveComponent("arrow-down");
- const _directive_repeat_click = resolveDirective("repeat-click");
- return openBlock(), createElementBlock("div", {
- class: normalizeClass([_ctx.ns.b("spinner"), { "has-seconds": _ctx.showSeconds }])
- }, [
- !_ctx.arrowControl ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(_ctx.spinnerItems, (item) => {
- return openBlock(), createBlock(_component_el_scrollbar, {
- key: item,
- ref_for: true,
- ref: (scollbar) => _ctx.setRef(scollbar, item),
- class: normalizeClass(_ctx.ns.be("spinner", "wrapper")),
- "wrap-style": "max-height: inherit;",
- "view-class": _ctx.ns.be("spinner", "list"),
- noresize: "",
- tag: "ul",
- onMouseenter: ($event) => _ctx.emitSelectRange(item),
- onMousemove: ($event) => _ctx.adjustCurrentSpinner(item)
- }, {
- default: withCtx(() => [
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.listMap[item].value, (disabled, key) => {
- return openBlock(), createElementBlock("li", {
- key,
- class: normalizeClass([
- _ctx.ns.be("spinner", "item"),
- _ctx.ns.is("active", key === _ctx.timePartsMap[item].value),
- _ctx.ns.is("disabled", disabled)
- ]),
- onClick: ($event) => _ctx.handleClick(item, { value: key, disabled })
- }, [
- item === "hours" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
- createTextVNode(toDisplayString(("0" + (_ctx.amPmMode ? key % 12 || 12 : key)).slice(-2)) + toDisplayString(_ctx.getAmPmFlag(key)), 1)
- ], 2112)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
- createTextVNode(toDisplayString(("0" + key).slice(-2)), 1)
- ], 2112))
- ], 10, _hoisted_1$z);
- }), 128))
- ]),
- _: 2
- }, 1032, ["class", "view-class", "onMouseenter", "onMousemove"]);
- }), 128)) : createCommentVNode("v-if", true),
- _ctx.arrowControl ? (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(_ctx.spinnerItems, (item) => {
- return openBlock(), createElementBlock("div", {
- key: item,
- class: normalizeClass([_ctx.ns.be("spinner", "wrapper"), _ctx.ns.is("arrow")]),
- onMouseenter: ($event) => _ctx.emitSelectRange(item)
- }, [
- withDirectives((openBlock(), createBlock(_component_el_icon, {
- class: normalizeClass(["arrow-up", _ctx.ns.be("spinner", "arrow")])
- }, {
- default: withCtx(() => [
- createVNode(_component_arrow_up)
- ]),
- _: 1
- }, 8, ["class"])), [
- [_directive_repeat_click, _ctx.onDecreaseClick]
- ]),
- withDirectives((openBlock(), createBlock(_component_el_icon, {
- class: normalizeClass(["arrow-down", _ctx.ns.be("spinner", "arrow")])
- }, {
- default: withCtx(() => [
- createVNode(_component_arrow_down)
- ]),
- _: 1
- }, 8, ["class"])), [
- [_directive_repeat_click, _ctx.onIncreaseClick]
- ]),
- createElementVNode("ul", {
- class: normalizeClass(_ctx.ns.be("spinner", "list"))
- }, [
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.arrowListMap[item].value, (time, key) => {
- return openBlock(), createElementBlock("li", {
- key,
- class: normalizeClass([
- _ctx.ns.be("spinner", "item"),
- _ctx.ns.is("active", time === _ctx.timePartsMap[item].value),
- _ctx.ns.is("disabled", _ctx.listMap[item].value[time])
- ])
- }, [
- typeof time === "number" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
- item === "hours" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
- createTextVNode(toDisplayString(("0" + (_ctx.amPmMode ? time % 12 || 12 : time)).slice(-2)) + toDisplayString(_ctx.getAmPmFlag(time)), 1)
- ], 2112)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
- createTextVNode(toDisplayString(("0" + time).slice(-2)), 1)
- ], 2112))
- ], 2112)) : createCommentVNode("v-if", true)
- ], 2);
- }), 128))
- ], 2)
- ], 42, _hoisted_2$r);
- }), 128)) : createCommentVNode("v-if", true)
- ], 2);
- }
- 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"]]);
- const _sfc_main$R = defineComponent({
- components: {
- TimeSpinner
- },
- props: {
- visible: Boolean,
- actualVisible: {
- type: Boolean,
- default: void 0
- },
- datetimeRole: {
- type: String
- },
- parsedValue: {
- type: [Object, String]
- },
- format: {
- type: String,
- default: ""
- }
- },
- emits: ["pick", "select-range", "set-picker-option"],
- setup(props, ctx) {
- const ns = useNamespace("time");
- const { t, lang } = useLocale();
- const selectionRange = ref([0, 2]);
- const oldValue = useOldValue(props);
- const transitionName = computed(() => {
- return isUndefined(props.actualVisible) ? `${ns.namespace.value}-zoom-in-top` : "";
- });
- const showSeconds = computed(() => {
- return props.format.includes("ss");
- });
- const amPmMode = computed(() => {
- if (props.format.includes("A"))
- return "A";
- if (props.format.includes("a"))
- return "a";
- return "";
- });
- const isValidValue = (_date) => {
- const parsedDate = dayjs(_date).locale(lang.value);
- const result = getRangeAvailableTime(parsedDate);
- return parsedDate.isSame(result);
- };
- const handleCancel = () => {
- ctx.emit("pick", oldValue.value, false);
- };
- const handleConfirm = (visible = false, first = false) => {
- if (first)
- return;
- ctx.emit("pick", props.parsedValue, visible);
- };
- const handleChange2 = (_date) => {
- if (!props.visible) {
- return;
- }
- const result = getRangeAvailableTime(_date).millisecond(0);
- ctx.emit("pick", result, true);
- };
- const setSelectionRange = (start2, end2) => {
- ctx.emit("select-range", start2, end2);
- selectionRange.value = [start2, end2];
- };
- const changeSelectionRange = (step) => {
- const list = [0, 3].concat(showSeconds.value ? [6] : []);
- const mapping = ["hours", "minutes"].concat(showSeconds.value ? ["seconds"] : []);
- const index = list.indexOf(selectionRange.value[0]);
- const next = (index + step + list.length) % list.length;
- timePickerOptions["start_emitSelectRange"](mapping[next]);
- };
- const handleKeydown = (event) => {
- const code = event.code;
- if (code === EVENT_CODE.left || code === EVENT_CODE.right) {
- const step = code === EVENT_CODE.left ? -1 : 1;
- changeSelectionRange(step);
- event.preventDefault();
- return;
- }
- if (code === EVENT_CODE.up || code === EVENT_CODE.down) {
- const step = code === EVENT_CODE.up ? -1 : 1;
- timePickerOptions["start_scrollDown"](step);
- event.preventDefault();
- return;
- }
- };
- const getRangeAvailableTime = (date4) => {
- const availableMap = {
- hour: getAvailableHours,
- minute: getAvailableMinutes,
- second: getAvailableSeconds
- };
- let result = date4;
- ["hour", "minute", "second"].forEach((_2) => {
- if (availableMap[_2]) {
- let availableArr;
- const method4 = availableMap[_2];
- if (_2 === "minute") {
- availableArr = method4(result.hour(), props.datetimeRole);
- } else if (_2 === "second") {
- availableArr = method4(result.hour(), result.minute(), props.datetimeRole);
- } else {
- availableArr = method4(props.datetimeRole);
- }
- if (availableArr && availableArr.length && !availableArr.includes(result[_2]())) {
- result = result[_2](availableArr[0]);
- }
- }
- });
- return result;
- };
- const parseUserInput = (value) => {
- if (!value)
- return null;
- return dayjs(value, props.format).locale(lang.value);
- };
- const formatToString = (value) => {
- if (!value)
- return null;
- return value.format(props.format);
- };
- const getDefaultValue = () => {
- return dayjs(defaultValue).locale(lang.value);
- };
- ctx.emit("set-picker-option", ["isValidValue", isValidValue]);
- ctx.emit("set-picker-option", ["formatToString", formatToString]);
- ctx.emit("set-picker-option", ["parseUserInput", parseUserInput]);
- ctx.emit("set-picker-option", ["handleKeydown", handleKeydown]);
- ctx.emit("set-picker-option", [
- "getRangeAvailableTime",
- getRangeAvailableTime
- ]);
- ctx.emit("set-picker-option", ["getDefaultValue", getDefaultValue]);
- const timePickerOptions = {};
- const onSetOption = (e) => {
- timePickerOptions[e[0]] = e[1];
- };
- const pickerBase = inject("EP_PICKER_BASE");
- const {
- arrowControl,
- disabledHours,
- disabledMinutes,
- disabledSeconds,
- defaultValue
- } = pickerBase.props;
- const { getAvailableHours, getAvailableMinutes, getAvailableSeconds } = getAvailableArrs(disabledHours, disabledMinutes, disabledSeconds);
- return {
- ns,
- transitionName,
- arrowControl,
- onSetOption,
- t,
- handleConfirm,
- handleChange: handleChange2,
- setSelectionRange,
- amPmMode,
- showSeconds,
- handleCancel,
- disabledHours,
- disabledMinutes,
- disabledSeconds
- };
- }
- });
- function _sfc_render$u(_ctx, _cache, $props, $setup, $data, $options) {
- const _component_time_spinner = resolveComponent("time-spinner");
- return openBlock(), createBlock(Transition, { name: _ctx.transitionName }, {
- default: withCtx(() => [
- _ctx.actualVisible || _ctx.visible ? (openBlock(), createElementBlock("div", {
- key: 0,
- class: normalizeClass(_ctx.ns.b("panel"))
- }, [
- createElementVNode("div", {
- class: normalizeClass([_ctx.ns.be("panel", "content"), { "has-seconds": _ctx.showSeconds }])
- }, [
- createVNode(_component_time_spinner, {
- ref: "spinner",
- role: _ctx.datetimeRole || "start",
- "arrow-control": _ctx.arrowControl,
- "show-seconds": _ctx.showSeconds,
- "am-pm-mode": _ctx.amPmMode,
- "spinner-date": _ctx.parsedValue,
- "disabled-hours": _ctx.disabledHours,
- "disabled-minutes": _ctx.disabledMinutes,
- "disabled-seconds": _ctx.disabledSeconds,
- onChange: _ctx.handleChange,
- onSetOption: _ctx.onSetOption,
- onSelectRange: _ctx.setSelectionRange
- }, null, 8, ["role", "arrow-control", "show-seconds", "am-pm-mode", "spinner-date", "disabled-hours", "disabled-minutes", "disabled-seconds", "onChange", "onSetOption", "onSelectRange"])
- ], 2),
- createElementVNode("div", {
- class: normalizeClass(_ctx.ns.be("panel", "footer"))
- }, [
- createElementVNode("button", {
- type: "button",
- class: normalizeClass([_ctx.ns.be("panel", "btn"), "cancel"]),
- onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleCancel && _ctx.handleCancel(...args))
- }, toDisplayString(_ctx.t("el.datepicker.cancel")), 3),
- createElementVNode("button", {
- type: "button",
- class: normalizeClass([_ctx.ns.be("panel", "btn"), "confirm"]),
- onClick: _cache[1] || (_cache[1] = ($event) => _ctx.handleConfirm())
- }, toDisplayString(_ctx.t("el.datepicker.confirm")), 3)
- ], 2)
- ], 2)) : createCommentVNode("v-if", true)
- ]),
- _: 1
- }, 8, ["name"]);
- }
- 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"]]);
- const makeSelectRange = (start2, end2) => {
- const result = [];
- for (let i = start2; i <= end2; i++) {
- result.push(i);
- }
- return result;
- };
- const _sfc_main$Q = defineComponent({
- components: { TimeSpinner },
- props: {
- visible: Boolean,
- actualVisible: Boolean,
- parsedValue: {
- type: [Array]
- },
- format: {
- type: String,
- default: ""
- }
- },
- emits: ["pick", "select-range", "set-picker-option"],
- setup(props, ctx) {
- const { t, lang } = useLocale();
- const nsTime = useNamespace("time");
- const nsPicker = useNamespace("picker");
- const minDate = computed(() => props.parsedValue[0]);
- const maxDate = computed(() => props.parsedValue[1]);
- const oldValue = useOldValue(props);
- const handleCancel = () => {
- ctx.emit("pick", oldValue.value, false);
- };
- const showSeconds = computed(() => {
- return props.format.includes("ss");
- });
- const amPmMode = computed(() => {
- if (props.format.includes("A"))
- return "A";
- if (props.format.includes("a"))
- return "a";
- return "";
- });
- const minSelectableRange = ref([]);
- const maxSelectableRange = ref([]);
- const handleConfirm = (visible = false) => {
- ctx.emit("pick", [minDate.value, maxDate.value], visible);
- };
- const handleMinChange = (date4) => {
- handleChange2(date4.millisecond(0), maxDate.value);
- };
- const handleMaxChange = (date4) => {
- handleChange2(minDate.value, date4.millisecond(0));
- };
- const isValidValue = (_date) => {
- const parsedDate = _date.map((_2) => dayjs(_2).locale(lang.value));
- const result = getRangeAvailableTime(parsedDate);
- return parsedDate[0].isSame(result[0]) && parsedDate[1].isSame(result[1]);
- };
- const handleChange2 = (_minDate, _maxDate) => {
- ctx.emit("pick", [_minDate, _maxDate], true);
- };
- const btnConfirmDisabled = computed(() => {
- return minDate.value > maxDate.value;
- });
- const selectionRange = ref([0, 2]);
- const setMinSelectionRange = (start2, end2) => {
- ctx.emit("select-range", start2, end2, "min");
- selectionRange.value = [start2, end2];
- };
- const offset2 = computed(() => showSeconds.value ? 11 : 8);
- const setMaxSelectionRange = (start2, end2) => {
- ctx.emit("select-range", start2, end2, "max");
- selectionRange.value = [start2 + offset2.value, end2 + offset2.value];
- };
- const changeSelectionRange = (step) => {
- const list = showSeconds.value ? [0, 3, 6, 11, 14, 17] : [0, 3, 8, 11];
- const mapping = ["hours", "minutes"].concat(showSeconds.value ? ["seconds"] : []);
- const index = list.indexOf(selectionRange.value[0]);
- const next = (index + step + list.length) % list.length;
- const half = list.length / 2;
- if (next < half) {
- timePickerOptions["start_emitSelectRange"](mapping[next]);
- } else {
- timePickerOptions["end_emitSelectRange"](mapping[next - half]);
- }
- };
- const handleKeydown = (event) => {
- const code = event.code;
- if (code === EVENT_CODE.left || code === EVENT_CODE.right) {
- const step = code === EVENT_CODE.left ? -1 : 1;
- changeSelectionRange(step);
- event.preventDefault();
- return;
- }
- if (code === EVENT_CODE.up || code === EVENT_CODE.down) {
- const step = code === EVENT_CODE.up ? -1 : 1;
- const role = selectionRange.value[0] < offset2.value ? "start" : "end";
- timePickerOptions[`${role}_scrollDown`](step);
- event.preventDefault();
- return;
- }
- };
- const disabledHours_ = (role, compare) => {
- const defaultDisable = disabledHours ? disabledHours(role) : [];
- const isStart = role === "start";
- const compareDate = compare || (isStart ? maxDate.value : minDate.value);
- const compareHour = compareDate.hour();
- const nextDisable = isStart ? makeSelectRange(compareHour + 1, 23) : makeSelectRange(0, compareHour - 1);
- return union$1(defaultDisable, nextDisable);
- };
- const disabledMinutes_ = (hour, role, compare) => {
- const defaultDisable = disabledMinutes ? disabledMinutes(hour, role) : [];
- const isStart = role === "start";
- const compareDate = compare || (isStart ? maxDate.value : minDate.value);
- const compareHour = compareDate.hour();
- if (hour !== compareHour) {
- return defaultDisable;
- }
- const compareMinute = compareDate.minute();
- const nextDisable = isStart ? makeSelectRange(compareMinute + 1, 59) : makeSelectRange(0, compareMinute - 1);
- return union$1(defaultDisable, nextDisable);
- };
- const disabledSeconds_ = (hour, minute, role, compare) => {
- const defaultDisable = disabledSeconds ? disabledSeconds(hour, minute, role) : [];
- const isStart = role === "start";
- const compareDate = compare || (isStart ? maxDate.value : minDate.value);
- const compareHour = compareDate.hour();
- const compareMinute = compareDate.minute();
- if (hour !== compareHour || minute !== compareMinute) {
- return defaultDisable;
- }
- const compareSecond = compareDate.second();
- const nextDisable = isStart ? makeSelectRange(compareSecond + 1, 59) : makeSelectRange(0, compareSecond - 1);
- return union$1(defaultDisable, nextDisable);
- };
- const getRangeAvailableTime = (dates) => {
- return dates.map((_2, index) => getRangeAvailableTimeEach(dates[0], dates[1], index === 0 ? "start" : "end"));
- };
- const { getAvailableHours, getAvailableMinutes, getAvailableSeconds } = getAvailableArrs(disabledHours_, disabledMinutes_, disabledSeconds_);
- const getRangeAvailableTimeEach = (startDate, endDate, role) => {
- const availableMap = {
- hour: getAvailableHours,
- minute: getAvailableMinutes,
- second: getAvailableSeconds
- };
- const isStart = role === "start";
- let result = isStart ? startDate : endDate;
- const compareDate = isStart ? endDate : startDate;
- ["hour", "minute", "second"].forEach((_2) => {
- if (availableMap[_2]) {
- let availableArr;
- const method4 = availableMap[_2];
- if (_2 === "minute") {
- availableArr = method4(result.hour(), role, compareDate);
- } else if (_2 === "second") {
- availableArr = method4(result.hour(), result.minute(), role, compareDate);
- } else {
- availableArr = method4(role, compareDate);
- }
- if (availableArr && availableArr.length && !availableArr.includes(result[_2]())) {
- const pos = isStart ? 0 : availableArr.length - 1;
- result = result[_2](availableArr[pos]);
- }
- }
- });
- return result;
- };
- const parseUserInput = (value) => {
- if (!value)
- return null;
- if (Array.isArray(value)) {
- return value.map((_2) => dayjs(_2, props.format).locale(lang.value));
- }
- return dayjs(value, props.format).locale(lang.value);
- };
- const formatToString = (value) => {
- if (!value)
- return null;
- if (Array.isArray(value)) {
- return value.map((_2) => _2.format(props.format));
- }
- return value.format(props.format);
- };
- const getDefaultValue = () => {
- if (Array.isArray(defaultValue)) {
- return defaultValue.map((_2) => dayjs(_2).locale(lang.value));
- }
- const defaultDay = dayjs(defaultValue).locale(lang.value);
- return [defaultDay, defaultDay.add(60, "m")];
- };
- ctx.emit("set-picker-option", ["formatToString", formatToString]);
- ctx.emit("set-picker-option", ["parseUserInput", parseUserInput]);
- ctx.emit("set-picker-option", ["isValidValue", isValidValue]);
- ctx.emit("set-picker-option", ["handleKeydown", handleKeydown]);
- ctx.emit("set-picker-option", ["getDefaultValue", getDefaultValue]);
- ctx.emit("set-picker-option", [
- "getRangeAvailableTime",
- getRangeAvailableTime
- ]);
- const timePickerOptions = {};
- const onSetOption = (e) => {
- timePickerOptions[e[0]] = e[1];
- };
- const pickerBase = inject("EP_PICKER_BASE");
- const {
- arrowControl,
- disabledHours,
- disabledMinutes,
- disabledSeconds,
- defaultValue
- } = pickerBase.props;
- return {
- nsTime,
- nsPicker,
- arrowControl,
- onSetOption,
- setMaxSelectionRange,
- setMinSelectionRange,
- btnConfirmDisabled,
- handleCancel,
- handleConfirm,
- t,
- showSeconds,
- minDate,
- maxDate,
- amPmMode,
- handleMinChange,
- handleMaxChange,
- minSelectableRange,
- maxSelectableRange,
- disabledHours_,
- disabledMinutes_,
- disabledSeconds_
- };
- }
- });
- const _hoisted_1$y = ["disabled"];
- function _sfc_render$t(_ctx, _cache, $props, $setup, $data, $options) {
- const _component_time_spinner = resolveComponent("time-spinner");
- return _ctx.actualVisible ? (openBlock(), createElementBlock("div", {
- key: 0,
- class: normalizeClass([_ctx.nsTime.b("range-picker"), _ctx.nsPicker.b("panel")])
- }, [
- createElementVNode("div", {
- class: normalizeClass(_ctx.nsTime.be("range-picker", "content"))
- }, [
- createElementVNode("div", {
- class: normalizeClass(_ctx.nsTime.be("range-picker", "cell"))
- }, [
- createElementVNode("div", {
- class: normalizeClass(_ctx.nsTime.be("range-picker", "header"))
- }, toDisplayString(_ctx.t("el.datepicker.startTime")), 3),
- createElementVNode("div", {
- class: normalizeClass([
- _ctx.nsTime.be("range-picker", "body"),
- _ctx.nsTime.be("panel", "content"),
- _ctx.nsTime.is("arrow", _ctx.arrowControl),
- { "has-seconds": _ctx.showSeconds }
- ])
- }, [
- createVNode(_component_time_spinner, {
- ref: "minSpinner",
- role: "start",
- "show-seconds": _ctx.showSeconds,
- "am-pm-mode": _ctx.amPmMode,
- "arrow-control": _ctx.arrowControl,
- "spinner-date": _ctx.minDate,
- "disabled-hours": _ctx.disabledHours_,
- "disabled-minutes": _ctx.disabledMinutes_,
- "disabled-seconds": _ctx.disabledSeconds_,
- onChange: _ctx.handleMinChange,
- onSetOption: _ctx.onSetOption,
- onSelectRange: _ctx.setMinSelectionRange
- }, null, 8, ["show-seconds", "am-pm-mode", "arrow-control", "spinner-date", "disabled-hours", "disabled-minutes", "disabled-seconds", "onChange", "onSetOption", "onSelectRange"])
- ], 2)
- ], 2),
- createElementVNode("div", {
- class: normalizeClass(_ctx.nsTime.be("range-picker", "cell"))
- }, [
- createElementVNode("div", {
- class: normalizeClass(_ctx.nsTime.be("range-picker", "header"))
- }, toDisplayString(_ctx.t("el.datepicker.endTime")), 3),
- createElementVNode("div", {
- class: normalizeClass([
- _ctx.nsTime.be("range-picker", "body"),
- _ctx.nsTime.be("panel", "content"),
- _ctx.nsTime.is("arrow", _ctx.arrowControl),
- { "has-seconds": _ctx.showSeconds }
- ])
- }, [
- createVNode(_component_time_spinner, {
- ref: "maxSpinner",
- role: "end",
- "show-seconds": _ctx.showSeconds,
- "am-pm-mode": _ctx.amPmMode,
- "arrow-control": _ctx.arrowControl,
- "spinner-date": _ctx.maxDate,
- "disabled-hours": _ctx.disabledHours_,
- "disabled-minutes": _ctx.disabledMinutes_,
- "disabled-seconds": _ctx.disabledSeconds_,
- onChange: _ctx.handleMaxChange,
- onSetOption: _ctx.onSetOption,
- onSelectRange: _ctx.setMaxSelectionRange
- }, null, 8, ["show-seconds", "am-pm-mode", "arrow-control", "spinner-date", "disabled-hours", "disabled-minutes", "disabled-seconds", "onChange", "onSetOption", "onSelectRange"])
- ], 2)
- ], 2)
- ], 2),
- createElementVNode("div", {
- class: normalizeClass(_ctx.nsTime.be("panel", "footer"))
- }, [
- createElementVNode("button", {
- type: "button",
- class: normalizeClass([_ctx.nsTime.be("panel", "btn"), "cancel"]),
- onClick: _cache[0] || (_cache[0] = ($event) => _ctx.handleCancel())
- }, toDisplayString(_ctx.t("el.datepicker.cancel")), 3),
- createElementVNode("button", {
- type: "button",
- class: normalizeClass([_ctx.nsTime.be("panel", "btn"), "confirm"]),
- disabled: _ctx.btnConfirmDisabled,
- onClick: _cache[1] || (_cache[1] = ($event) => _ctx.handleConfirm())
- }, toDisplayString(_ctx.t("el.datepicker.confirm")), 11, _hoisted_1$y)
- ], 2)
- ], 2)) : createCommentVNode("v-if", true);
- }
- 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"]]);
- dayjs.extend(customParseFormat);
- var TimePicker = defineComponent({
- name: "ElTimePicker",
- install: null,
- props: __spreadProps(__spreadValues({}, timePickerDefaultProps), {
- isRange: {
- type: Boolean,
- default: false
- }
- }),
- emits: ["update:modelValue"],
- setup(props, ctx) {
- const commonPicker = ref(null);
- const type4 = props.isRange ? "timerange" : "time";
- const panel = props.isRange ? TimeRangePanel : TimePickPanel;
- const refProps = __spreadProps(__spreadValues({}, props), {
- focus: () => {
- var _a2;
- (_a2 = commonPicker.value) == null ? void 0 : _a2.handleFocus();
- },
- blur: () => {
- var _a2;
- (_a2 = commonPicker.value) == null ? void 0 : _a2.handleBlur();
- }
- });
- provide("ElPopperOptions", props.popperOptions);
- ctx.expose(refProps);
- return () => {
- var _a2;
- const format2 = (_a2 = props.format) != null ? _a2 : DEFAULT_FORMATS_TIME;
- return h$1(CommonPicker, __spreadProps(__spreadValues({}, props), {
- format: format2,
- type: type4,
- ref: commonPicker,
- "onUpdate:modelValue": (value) => ctx.emit("update:modelValue", value)
- }), {
- default: (scopedProps) => h$1(panel, scopedProps)
- });
- };
- }
- });
- const rangeArr = (n) => Array.from(Array.from({ length: n }).keys());
- const extractDateFormat = (format2) => {
- return format2.replace(/\W?m{1,2}|\W?ZZ/g, "").replace(/\W?h{1,2}|\W?s{1,3}|\W?a/gi, "").trim();
- };
- const extractTimeFormat = (format2) => {
- return format2.replace(/\W?D{1,2}|\W?Do|\W?d{1,4}|\W?M{1,4}|\W?Y{2,4}/g, "").trim();
- };
- const _TimePicker = TimePicker;
- _TimePicker.install = (app) => {
- app.component(_TimePicker.name, _TimePicker);
- };
- const ElTimePicker = _TimePicker;
- const useCheckboxProps = {
- modelValue: {
- type: [Boolean, Number, String],
- default: () => void 0
- },
- label: {
- type: [String, Boolean, Number, Object]
- },
- indeterminate: Boolean,
- disabled: Boolean,
- checked: Boolean,
- name: {
- type: String,
- default: void 0
- },
- trueLabel: {
- type: [String, Number],
- default: void 0
- },
- falseLabel: {
- type: [String, Number],
- default: void 0
- },
- tabindex: [String, Number],
- size: String
- };
- const useCheckboxGroup = () => {
- const elForm2 = inject(formContextKey, {});
- const elFormItem2 = inject(formItemContextKey, {});
- const checkboxGroup = inject("CheckboxGroup", {});
- const isGroup = computed(() => checkboxGroup && (checkboxGroup == null ? void 0 : checkboxGroup.name) === "ElCheckboxGroup");
- const elFormItemSize = computed(() => {
- return elFormItem2.size;
- });
- return {
- isGroup,
- checkboxGroup,
- elForm: elForm2,
- elFormItemSize,
- elFormItem: elFormItem2
- };
- };
- const useModel = (props) => {
- const selfModel = ref(false);
- const { emit } = getCurrentInstance();
- const { isGroup, checkboxGroup } = useCheckboxGroup();
- const isLimitExceeded = ref(false);
- const model = computed({
- get() {
- var _a2, _b2;
- return isGroup.value ? (_a2 = checkboxGroup.modelValue) == null ? void 0 : _a2.value : (_b2 = props.modelValue) != null ? _b2 : selfModel.value;
- },
- set(val) {
- var _a2;
- if (isGroup.value && Array.isArray(val)) {
- isLimitExceeded.value = checkboxGroup.max !== void 0 && val.length > checkboxGroup.max.value;
- isLimitExceeded.value === false && ((_a2 = checkboxGroup == null ? void 0 : checkboxGroup.changeEvent) == null ? void 0 : _a2.call(checkboxGroup, val));
- } else {
- emit(UPDATE_MODEL_EVENT, val);
- selfModel.value = val;
- }
- }
- });
- return {
- model,
- isLimitExceeded
- };
- };
- const useCheckboxStatus = (props, { model }) => {
- const { isGroup, checkboxGroup } = useCheckboxGroup();
- const focus = ref(false);
- const size = useSize(checkboxGroup == null ? void 0 : checkboxGroup.checkboxGroupSize, { prop: true });
- const isChecked = computed(() => {
- const value = model.value;
- if (toTypeString(value) === "[object Boolean]") {
- return value;
- } else if (Array.isArray(value)) {
- return value.includes(props.label);
- } else if (value !== null && value !== void 0) {
- return value === props.trueLabel;
- } else {
- return !!value;
- }
- });
- const checkboxSize = useSize(computed(() => {
- var _a2;
- return isGroup.value ? (_a2 = checkboxGroup == null ? void 0 : checkboxGroup.checkboxGroupSize) == null ? void 0 : _a2.value : void 0;
- }));
- return {
- isChecked,
- focus,
- size,
- checkboxSize
- };
- };
- const useDisabled = (props, {
- model,
- isChecked
- }) => {
- const { elForm: elForm2, isGroup, checkboxGroup } = useCheckboxGroup();
- const isLimitDisabled = computed(() => {
- var _a2, _b2;
- const max2 = (_a2 = checkboxGroup.max) == null ? void 0 : _a2.value;
- const min2 = (_b2 = checkboxGroup.min) == null ? void 0 : _b2.value;
- return !!(max2 || min2) && model.value.length >= max2 && !isChecked.value || model.value.length <= min2 && isChecked.value;
- });
- const isDisabled = computed(() => {
- var _a2, _b2;
- const disabled = props.disabled || elForm2.disabled;
- return (_b2 = isGroup.value ? ((_a2 = checkboxGroup.disabled) == null ? void 0 : _a2.value) || disabled || isLimitDisabled.value : props.disabled || elForm2.disabled) != null ? _b2 : false;
- });
- return {
- isDisabled,
- isLimitDisabled
- };
- };
- const setStoreValue = (props, { model }) => {
- function addToStore() {
- if (Array.isArray(model.value) && !model.value.includes(props.label)) {
- model.value.push(props.label);
- } else {
- model.value = props.trueLabel || true;
- }
- }
- props.checked && addToStore();
- };
- const useEvent$1 = (props, { isLimitExceeded }) => {
- const { elFormItem: elFormItem2 } = useCheckboxGroup();
- const { emit } = getCurrentInstance();
- function handleChange2(e) {
- var _a2, _b2;
- if (isLimitExceeded.value)
- return;
- const target = e.target;
- const value = target.checked ? (_a2 = props.trueLabel) != null ? _a2 : true : (_b2 = props.falseLabel) != null ? _b2 : false;
- emit("change", value, e);
- }
- watch(() => props.modelValue, () => {
- var _a2;
- (_a2 = elFormItem2.validate) == null ? void 0 : _a2.call(elFormItem2, "change").catch((err) => debugWarn());
- });
- return {
- handleChange: handleChange2
- };
- };
- const useCheckbox = (props) => {
- const { model, isLimitExceeded } = useModel(props);
- const { focus, size, isChecked, checkboxSize } = useCheckboxStatus(props, {
- model
- });
- const { isDisabled } = useDisabled(props, { model, isChecked });
- const { handleChange: handleChange2 } = useEvent$1(props, { isLimitExceeded });
- setStoreValue(props, { model });
- return {
- isChecked,
- isDisabled,
- checkboxSize,
- model,
- handleChange: handleChange2,
- focus,
- size
- };
- };
- const _sfc_main$P = defineComponent({
- name: "ElCheckbox",
- props: {
- modelValue: {
- type: [Number, String, Boolean],
- default: () => void 0
- },
- label: {
- type: [String, Boolean, Number, Object]
- },
- indeterminate: Boolean,
- disabled: Boolean,
- checked: Boolean,
- name: {
- type: String,
- default: void 0
- },
- trueLabel: {
- type: [String, Number],
- default: void 0
- },
- falseLabel: {
- type: [String, Number],
- default: void 0
- },
- id: {
- type: String,
- default: void 0
- },
- controls: {
- type: String,
- default: void 0
- },
- border: Boolean,
- size: {
- type: String,
- validator: isValidComponentSize
- },
- tabindex: [String, Number]
- },
- emits: [UPDATE_MODEL_EVENT, "change"],
- setup(props) {
- const ns = useNamespace("checkbox");
- return __spreadValues({
- ns
- }, useCheckbox(props));
- }
- });
- const _hoisted_1$x = ["id", "aria-controls"];
- const _hoisted_2$q = ["tabindex", "role", "aria-checked"];
- const _hoisted_3$h = ["aria-hidden", "name", "tabindex", "disabled", "true-value", "false-value"];
- const _hoisted_4$e = ["aria-hidden", "disabled", "value", "name", "tabindex"];
- function _sfc_render$s(_ctx, _cache, $props, $setup, $data, $options) {
- return openBlock(), createElementBlock("label", {
- id: _ctx.id,
- class: normalizeClass([
- _ctx.ns.b(),
- _ctx.ns.m(_ctx.checkboxSize),
- _ctx.ns.is("disabled", _ctx.isDisabled),
- _ctx.ns.is("bordered", _ctx.border),
- _ctx.ns.is("checked", _ctx.isChecked)
- ]),
- "aria-controls": _ctx.indeterminate ? _ctx.controls : null
- }, [
- createElementVNode("span", {
- class: normalizeClass([
- _ctx.ns.e("input"),
- _ctx.ns.is("disabled", _ctx.isDisabled),
- _ctx.ns.is("checked", _ctx.isChecked),
- _ctx.ns.is("indeterminate", _ctx.indeterminate),
- _ctx.ns.is("focus", _ctx.focus)
- ]),
- tabindex: _ctx.indeterminate ? 0 : void 0,
- role: _ctx.indeterminate ? "checkbox" : void 0,
- "aria-checked": _ctx.indeterminate ? "mixed" : false
- }, [
- createElementVNode("span", {
- class: normalizeClass(_ctx.ns.e("inner"))
- }, null, 2),
- _ctx.trueLabel || _ctx.falseLabel ? withDirectives((openBlock(), createElementBlock("input", {
- key: 0,
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model = $event),
- class: normalizeClass(_ctx.ns.e("original")),
- type: "checkbox",
- "aria-hidden": _ctx.indeterminate ? "true" : "false",
- name: _ctx.name,
- tabindex: _ctx.tabindex,
- disabled: _ctx.isDisabled,
- "true-value": _ctx.trueLabel,
- "false-value": _ctx.falseLabel,
- onChange: _cache[1] || (_cache[1] = (...args) => _ctx.handleChange && _ctx.handleChange(...args)),
- onFocus: _cache[2] || (_cache[2] = ($event) => _ctx.focus = true),
- onBlur: _cache[3] || (_cache[3] = ($event) => _ctx.focus = false)
- }, null, 42, _hoisted_3$h)), [
- [vModelCheckbox, _ctx.model]
- ]) : withDirectives((openBlock(), createElementBlock("input", {
- key: 1,
- "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => _ctx.model = $event),
- class: normalizeClass(_ctx.ns.e("original")),
- type: "checkbox",
- "aria-hidden": _ctx.indeterminate ? "true" : "false",
- disabled: _ctx.isDisabled,
- value: _ctx.label,
- name: _ctx.name,
- tabindex: _ctx.tabindex,
- onChange: _cache[5] || (_cache[5] = (...args) => _ctx.handleChange && _ctx.handleChange(...args)),
- onFocus: _cache[6] || (_cache[6] = ($event) => _ctx.focus = true),
- onBlur: _cache[7] || (_cache[7] = ($event) => _ctx.focus = false)
- }, null, 42, _hoisted_4$e)), [
- [vModelCheckbox, _ctx.model]
- ])
- ], 10, _hoisted_2$q),
- _ctx.$slots.default || _ctx.label ? (openBlock(), createElementBlock("span", {
- key: 0,
- class: normalizeClass(_ctx.ns.e("label"))
- }, [
- renderSlot(_ctx.$slots, "default"),
- !_ctx.$slots.default ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
- createTextVNode(toDisplayString(_ctx.label), 1)
- ], 2112)) : createCommentVNode("v-if", true)
- ], 2)) : createCommentVNode("v-if", true)
- ], 10, _hoisted_1$x);
- }
- 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"]]);
- const _sfc_main$O = defineComponent({
- name: "ElCheckboxButton",
- props: useCheckboxProps,
- emits: [UPDATE_MODEL_EVENT, "change"],
- setup(props) {
- const { focus, isChecked, isDisabled, size, model, handleChange: handleChange2 } = useCheckbox(props);
- const { checkboxGroup } = useCheckboxGroup();
- const ns = useNamespace("checkbox");
- const activeStyle = computed(() => {
- var _a2, _b2, _c, _d;
- const fillValue = (_b2 = (_a2 = checkboxGroup == null ? void 0 : checkboxGroup.fill) == null ? void 0 : _a2.value) != null ? _b2 : "";
- return {
- backgroundColor: fillValue,
- borderColor: fillValue,
- color: (_d = (_c = checkboxGroup == null ? void 0 : checkboxGroup.textColor) == null ? void 0 : _c.value) != null ? _d : "",
- boxShadow: fillValue ? `-1px 0 0 0 ${fillValue}` : null
- };
- });
- return {
- focus,
- isChecked,
- isDisabled,
- model,
- handleChange: handleChange2,
- activeStyle,
- size,
- ns
- };
- }
- });
- const _hoisted_1$w = ["aria-checked", "aria-disabled"];
- const _hoisted_2$p = ["name", "tabindex", "disabled", "true-value", "false-value"];
- const _hoisted_3$g = ["name", "tabindex", "disabled", "value"];
- function _sfc_render$r(_ctx, _cache, $props, $setup, $data, $options) {
- return openBlock(), createElementBlock("label", {
- class: normalizeClass([
- _ctx.ns.b("button"),
- _ctx.ns.bm("button", _ctx.size),
- _ctx.ns.is("disabled", _ctx.isDisabled),
- _ctx.ns.is("checked", _ctx.isChecked),
- _ctx.ns.is("focus", _ctx.focus)
- ]),
- role: "checkbox",
- "aria-checked": _ctx.isChecked,
- "aria-disabled": _ctx.isDisabled
- }, [
- _ctx.trueLabel || _ctx.falseLabel ? withDirectives((openBlock(), createElementBlock("input", {
- key: 0,
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model = $event),
- class: normalizeClass(_ctx.ns.be("button", "original")),
- type: "checkbox",
- name: _ctx.name,
- tabindex: _ctx.tabindex,
- disabled: _ctx.isDisabled,
- "true-value": _ctx.trueLabel,
- "false-value": _ctx.falseLabel,
- onChange: _cache[1] || (_cache[1] = (...args) => _ctx.handleChange && _ctx.handleChange(...args)),
- onFocus: _cache[2] || (_cache[2] = ($event) => _ctx.focus = true),
- onBlur: _cache[3] || (_cache[3] = ($event) => _ctx.focus = false)
- }, null, 42, _hoisted_2$p)), [
- [vModelCheckbox, _ctx.model]
- ]) : withDirectives((openBlock(), createElementBlock("input", {
- key: 1,
- "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => _ctx.model = $event),
- class: normalizeClass(_ctx.ns.be("button", "original")),
- type: "checkbox",
- name: _ctx.name,
- tabindex: _ctx.tabindex,
- disabled: _ctx.isDisabled,
- value: _ctx.label,
- onChange: _cache[5] || (_cache[5] = (...args) => _ctx.handleChange && _ctx.handleChange(...args)),
- onFocus: _cache[6] || (_cache[6] = ($event) => _ctx.focus = true),
- onBlur: _cache[7] || (_cache[7] = ($event) => _ctx.focus = false)
- }, null, 42, _hoisted_3$g)), [
- [vModelCheckbox, _ctx.model]
- ]),
- _ctx.$slots.default || _ctx.label ? (openBlock(), createElementBlock("span", {
- key: 2,
- class: normalizeClass(_ctx.ns.be("button", "inner")),
- style: normalizeStyle(_ctx.isChecked ? _ctx.activeStyle : null)
- }, [
- renderSlot(_ctx.$slots, "default", {}, () => [
- createTextVNode(toDisplayString(_ctx.label), 1)
- ])
- ], 6)) : createCommentVNode("v-if", true)
- ], 10, _hoisted_1$w);
- }
- 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"]]);
- const _sfc_main$N = defineComponent({
- name: "ElCheckboxGroup",
- props: {
- modelValue: {
- type: Array,
- default: () => []
- },
- disabled: Boolean,
- min: {
- type: Number,
- default: void 0
- },
- max: {
- type: Number,
- default: void 0
- },
- size: {
- type: String,
- validator: isValidComponentSize
- },
- fill: {
- type: String,
- default: void 0
- },
- textColor: {
- type: String,
- default: void 0
- },
- tag: {
- type: String,
- default: "div"
- }
- },
- emits: [UPDATE_MODEL_EVENT, "change"],
- setup(props, { emit, slots }) {
- const { elFormItem: elFormItem2 } = useCheckboxGroup();
- const checkboxGroupSize = useSize();
- const ns = useNamespace("checkbox");
- const changeEvent = (value) => {
- emit(UPDATE_MODEL_EVENT, value);
- nextTick(() => {
- emit("change", value);
- });
- };
- const modelValue = computed({
- get() {
- return props.modelValue;
- },
- set(val) {
- changeEvent(val);
- }
- });
- provide("CheckboxGroup", __spreadProps(__spreadValues({
- name: "ElCheckboxGroup",
- modelValue
- }, toRefs(props)), {
- checkboxGroupSize,
- changeEvent
- }));
- watch(() => props.modelValue, () => {
- var _a2;
- (_a2 = elFormItem2.validate) == null ? void 0 : _a2.call(elFormItem2, "change").catch((err) => debugWarn());
- });
- return () => {
- return h$1(props.tag, {
- class: ns.b("group"),
- role: "group",
- "aria-label": "checkbox-group"
- }, [renderSlot(slots, "default")]);
- };
- }
- });
- var CheckboxGroup = /* @__PURE__ */ _export_sfc$1(_sfc_main$N, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/checkbox/src/checkbox-group.vue"]]);
- const ElCheckbox = withInstall(Checkbox, {
- CheckboxButton,
- CheckboxGroup
- });
- withNoopInstall(CheckboxButton);
- const ElCheckboxGroup$1 = withNoopInstall(CheckboxGroup);
- const radioPropsBase = buildProps({
- size: useSizeProp,
- disabled: Boolean,
- label: {
- type: [String, Number, Boolean],
- default: ""
- }
- });
- const radioProps = buildProps(__spreadProps(__spreadValues({}, radioPropsBase), {
- modelValue: {
- type: [String, Number, Boolean],
- default: ""
- },
- name: {
- type: String,
- default: ""
- },
- border: Boolean
- }));
- const radioEmits = {
- [UPDATE_MODEL_EVENT]: (val) => isString(val) || isNumber(val) || isBoolean(val),
- change: (val) => isString(val) || isNumber(val) || isBoolean(val)
- };
- const useRadio = (props, emit) => {
- const radioRef = ref();
- const radioGroup = inject(radioGroupKey, void 0);
- const isGroup = computed(() => !!radioGroup);
- const modelValue = computed({
- get() {
- return isGroup.value ? radioGroup.modelValue : props.modelValue;
- },
- set(val) {
- if (isGroup.value) {
- radioGroup.changeEvent(val);
- } else {
- emit(UPDATE_MODEL_EVENT, val);
- }
- radioRef.value.checked = props.modelValue === props.label;
- }
- });
- const size = useSize(computed(() => radioGroup == null ? void 0 : radioGroup.size));
- const disabled = useDisabled$1(computed(() => radioGroup == null ? void 0 : radioGroup.disabled));
- const focus = ref(false);
- const tabIndex = computed(() => {
- return disabled.value || isGroup.value && modelValue.value !== props.label ? -1 : 0;
- });
- return {
- radioRef,
- isGroup,
- radioGroup,
- focus,
- size,
- disabled,
- tabIndex,
- modelValue
- };
- };
- const _sfc_main$M = defineComponent({
- name: "ElRadio",
- props: radioProps,
- emits: radioEmits,
- setup(props, { emit }) {
- const ns = useNamespace("radio");
- const { radioRef, isGroup, focus, size, disabled, tabIndex, modelValue } = useRadio(props, emit);
- function handleChange2() {
- nextTick(() => emit("change", modelValue.value));
- }
- return {
- ns,
- focus,
- isGroup,
- modelValue,
- tabIndex,
- size,
- disabled,
- radioRef,
- handleChange: handleChange2
- };
- }
- });
- const _hoisted_1$v = ["aria-checked", "aria-disabled", "tabindex"];
- const _hoisted_2$o = ["value", "name", "disabled"];
- function _sfc_render$q(_ctx, _cache, $props, $setup, $data, $options) {
- return openBlock(), createElementBlock("label", {
- class: normalizeClass([
- _ctx.ns.b(),
- _ctx.ns.is("disabled", _ctx.disabled),
- _ctx.ns.is("focus", _ctx.focus),
- _ctx.ns.is("bordered", _ctx.border),
- _ctx.ns.is("checked", _ctx.modelValue === _ctx.label),
- _ctx.ns.m(_ctx.size)
- ]),
- role: "radio",
- "aria-checked": _ctx.modelValue === _ctx.label,
- "aria-disabled": _ctx.disabled,
- tabindex: _ctx.tabIndex,
- onKeydown: _cache[5] || (_cache[5] = withKeys(withModifiers(($event) => _ctx.modelValue = _ctx.disabled ? _ctx.modelValue : _ctx.label, ["stop", "prevent"]), ["space"]))
- }, [
- createElementVNode("span", {
- class: normalizeClass([
- _ctx.ns.e("input"),
- _ctx.ns.is("disabled", _ctx.disabled),
- _ctx.ns.is("checked", _ctx.modelValue === _ctx.label)
- ])
- }, [
- createElementVNode("span", {
- class: normalizeClass(_ctx.ns.e("inner"))
- }, null, 2),
- withDirectives(createElementVNode("input", {
- ref: "radioRef",
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.modelValue = $event),
- class: normalizeClass(_ctx.ns.e("original")),
- value: _ctx.label,
- type: "radio",
- "aria-hidden": "true",
- name: _ctx.name,
- disabled: _ctx.disabled,
- tabindex: "-1",
- onFocus: _cache[1] || (_cache[1] = ($event) => _ctx.focus = true),
- onBlur: _cache[2] || (_cache[2] = ($event) => _ctx.focus = false),
- onChange: _cache[3] || (_cache[3] = (...args) => _ctx.handleChange && _ctx.handleChange(...args))
- }, null, 42, _hoisted_2$o), [
- [vModelRadio, _ctx.modelValue]
- ])
- ], 2),
- createElementVNode("span", {
- class: normalizeClass(_ctx.ns.e("label")),
- onKeydown: _cache[4] || (_cache[4] = withModifiers(() => {
- }, ["stop"]))
- }, [
- renderSlot(_ctx.$slots, "default", {}, () => [
- createTextVNode(toDisplayString(_ctx.label), 1)
- ])
- ], 34)
- ], 42, _hoisted_1$v);
- }
- 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"]]);
- const radioButtonProps = buildProps(__spreadProps(__spreadValues({}, radioPropsBase), {
- name: {
- type: String,
- default: ""
- }
- }));
- const _sfc_main$L = defineComponent({
- name: "ElRadioButton",
- props: radioButtonProps,
- setup(props, { emit }) {
- const ns = useNamespace("radio");
- const {
- radioRef,
- isGroup,
- focus,
- size,
- disabled,
- tabIndex,
- modelValue,
- radioGroup
- } = useRadio(props, emit);
- const activeStyle = computed(() => {
- return {
- backgroundColor: (radioGroup == null ? void 0 : radioGroup.fill) || "",
- borderColor: (radioGroup == null ? void 0 : radioGroup.fill) || "",
- boxShadow: (radioGroup == null ? void 0 : radioGroup.fill) ? `-1px 0 0 0 ${radioGroup.fill}` : "",
- color: (radioGroup == null ? void 0 : radioGroup.textColor) || ""
- };
- });
- return {
- ns,
- isGroup,
- size,
- disabled,
- tabIndex,
- modelValue,
- focus,
- activeStyle,
- radioRef
- };
- }
- });
- const _hoisted_1$u = ["aria-checked", "aria-disabled", "tabindex"];
- const _hoisted_2$n = ["value", "name", "disabled"];
- function _sfc_render$p(_ctx, _cache, $props, $setup, $data, $options) {
- return openBlock(), createElementBlock("label", {
- class: normalizeClass([
- _ctx.ns.b("button"),
- _ctx.ns.is("active", _ctx.modelValue === _ctx.label),
- _ctx.ns.is("disabled", _ctx.disabled),
- _ctx.ns.is("focus", _ctx.focus),
- _ctx.ns.bm("button", _ctx.size)
- ]),
- role: "radio",
- "aria-checked": _ctx.modelValue === _ctx.label,
- "aria-disabled": _ctx.disabled,
- tabindex: _ctx.tabIndex,
- onKeydown: _cache[4] || (_cache[4] = withKeys(withModifiers(($event) => _ctx.modelValue = _ctx.disabled ? _ctx.modelValue : _ctx.label, ["stop", "prevent"]), ["space"]))
- }, [
- withDirectives(createElementVNode("input", {
- ref: "radioRef",
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.modelValue = $event),
- class: normalizeClass(_ctx.ns.be("button", "original-radio")),
- value: _ctx.label,
- type: "radio",
- name: _ctx.name,
- disabled: _ctx.disabled,
- tabindex: "-1",
- onFocus: _cache[1] || (_cache[1] = ($event) => _ctx.focus = true),
- onBlur: _cache[2] || (_cache[2] = ($event) => _ctx.focus = false)
- }, null, 42, _hoisted_2$n), [
- [vModelRadio, _ctx.modelValue]
- ]),
- createElementVNode("span", {
- class: normalizeClass(_ctx.ns.be("button", "inner")),
- style: normalizeStyle(_ctx.modelValue === _ctx.label ? _ctx.activeStyle : {}),
- onKeydown: _cache[3] || (_cache[3] = withModifiers(() => {
- }, ["stop"]))
- }, [
- renderSlot(_ctx.$slots, "default", {}, () => [
- createTextVNode(toDisplayString(_ctx.label), 1)
- ])
- ], 38)
- ], 42, _hoisted_1$u);
- }
- 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"]]);
- const radioGroupProps = buildProps({
- size: useSizeProp,
- disabled: Boolean,
- modelValue: {
- type: [String, Number, Boolean],
- default: ""
- },
- fill: {
- type: String,
- default: ""
- },
- textColor: {
- type: String,
- default: ""
- }
- });
- const radioGroupEmits = radioEmits;
- const _sfc_main$K = defineComponent({
- name: "ElRadioGroup",
- props: radioGroupProps,
- emits: radioGroupEmits,
- setup(props, ctx) {
- const ns = useNamespace("radio");
- const radioGroupRef = ref();
- const { formItem } = useFormItem();
- const changeEvent = (value) => {
- ctx.emit(UPDATE_MODEL_EVENT, value);
- nextTick(() => ctx.emit("change", value));
- };
- const handleKeydown = (e) => {
- if (!radioGroupRef.value)
- return;
- const target = e.target;
- const className = target.nodeName === "INPUT" ? "[type=radio]" : "[role=radio]";
- const radios = radioGroupRef.value.querySelectorAll(className);
- const length = radios.length;
- const index = Array.from(radios).indexOf(target);
- const roleRadios = radioGroupRef.value.querySelectorAll("[role=radio]");
- let nextIndex = null;
- switch (e.code) {
- case EVENT_CODE.left:
- case EVENT_CODE.up:
- e.stopPropagation();
- e.preventDefault();
- nextIndex = index === 0 ? length - 1 : index - 1;
- break;
- case EVENT_CODE.right:
- case EVENT_CODE.down:
- e.stopPropagation();
- e.preventDefault();
- nextIndex = index === length - 1 ? 0 : index + 1;
- break;
- }
- if (nextIndex === null)
- return;
- roleRadios[nextIndex].click();
- roleRadios[nextIndex].focus();
- };
- onMounted(() => {
- const radios = radioGroupRef.value.querySelectorAll("[type=radio]");
- const firstLabel = radios[0];
- if (!Array.from(radios).some((radio) => radio.checked) && firstLabel) {
- firstLabel.tabIndex = 0;
- }
- });
- provide(radioGroupKey, reactive(__spreadProps(__spreadValues({}, toRefs(props)), {
- changeEvent
- })));
- watch(() => props.modelValue, () => formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn()));
- return {
- ns,
- radioGroupRef,
- handleKeydown
- };
- }
- });
- function _sfc_render$o(_ctx, _cache, $props, $setup, $data, $options) {
- return openBlock(), createElementBlock("div", {
- ref: "radioGroupRef",
- class: normalizeClass(_ctx.ns.b("group")),
- role: "radiogroup",
- onKeydown: _cache[0] || (_cache[0] = (...args) => _ctx.handleKeydown && _ctx.handleKeydown(...args))
- }, [
- renderSlot(_ctx.$slots, "default")
- ], 34);
- }
- 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"]]);
- const ElRadio = withInstall(Radio, {
- RadioButton,
- RadioGroup
- });
- const ElRadioGroup = withNoopInstall(RadioGroup);
- const ElRadioButton = withNoopInstall(RadioButton);
- var NodeContent = defineComponent({
- name: "NodeContent",
- setup() {
- const ns = useNamespace("cascader-node");
- return {
- ns
- };
- },
- render() {
- const { ns } = this;
- const { node, panel } = this.$parent;
- const { data: data2, label } = node;
- const { renderLabelFn } = panel;
- return h$1("span", { class: ns.e("label") }, renderLabelFn ? renderLabelFn({ node, data: data2 }) : label);
- }
- });
- const CASCADER_PANEL_INJECTION_KEY = Symbol();
- const _sfc_main$J = defineComponent({
- name: "ElCascaderNode",
- components: {
- ElCheckbox,
- ElRadio,
- NodeContent,
- ElIcon,
- Check: check,
- Loading: loading,
- ArrowRight: arrowRight
- },
- props: {
- node: {
- type: Object,
- required: true
- },
- menuId: String
- },
- emits: ["expand"],
- setup(props, { emit }) {
- const panel = inject(CASCADER_PANEL_INJECTION_KEY);
- const ns = useNamespace("cascader-node");
- const isHoverMenu = computed(() => panel.isHoverMenu);
- const multiple = computed(() => panel.config.multiple);
- const checkStrictly = computed(() => panel.config.checkStrictly);
- const checkedNodeId = computed(() => {
- var _a2;
- return (_a2 = panel.checkedNodes[0]) == null ? void 0 : _a2.uid;
- });
- const isDisabled = computed(() => props.node.isDisabled);
- const isLeaf2 = computed(() => props.node.isLeaf);
- const expandable = computed(() => checkStrictly.value && !isLeaf2.value || !isDisabled.value);
- const inExpandingPath = computed(() => isInPath(panel.expandingNode));
- const inCheckedPath = computed(() => checkStrictly.value && panel.checkedNodes.some(isInPath));
- const isInPath = (node) => {
- var _a2;
- const { level, uid: uid2 } = props.node;
- return ((_a2 = node == null ? void 0 : node.pathNodes[level - 1]) == null ? void 0 : _a2.uid) === uid2;
- };
- const doExpand = () => {
- if (inExpandingPath.value)
- return;
- panel.expandNode(props.node);
- };
- const doCheck = (checked) => {
- const { node } = props;
- if (checked === node.checked)
- return;
- panel.handleCheckChange(node, checked);
- };
- const doLoad = () => {
- panel.lazyLoad(props.node, () => {
- if (!isLeaf2.value)
- doExpand();
- });
- };
- const handleHoverExpand = (e) => {
- if (!isHoverMenu.value)
- return;
- handleExpand();
- !isLeaf2.value && emit("expand", e);
- };
- const handleExpand = () => {
- const { node } = props;
- if (!expandable.value || node.loading)
- return;
- node.loaded ? doExpand() : doLoad();
- };
- const handleClick = () => {
- if (isHoverMenu.value && !isLeaf2.value)
- return;
- if (isLeaf2.value && !isDisabled.value && !checkStrictly.value && !multiple.value) {
- handleCheck(true);
- } else {
- handleExpand();
- }
- };
- const handleSelectCheck = (checked) => {
- if (checkStrictly.value) {
- doCheck(checked);
- if (props.node.loaded) {
- doExpand();
- }
- } else {
- handleCheck(checked);
- }
- };
- const handleCheck = (checked) => {
- if (!props.node.loaded) {
- doLoad();
- } else {
- doCheck(checked);
- !checkStrictly.value && doExpand();
- }
- };
- return {
- panel,
- isHoverMenu,
- multiple,
- checkStrictly,
- checkedNodeId,
- isDisabled,
- isLeaf: isLeaf2,
- expandable,
- inExpandingPath,
- inCheckedPath,
- ns,
- handleHoverExpand,
- handleExpand,
- handleClick,
- handleCheck,
- handleSelectCheck
- };
- }
- });
- const _hoisted_1$t = ["id", "aria-haspopup", "aria-owns", "aria-expanded", "tabindex"];
- const _hoisted_2$m = /* @__PURE__ */ createElementVNode("span", null, null, -1);
- function _sfc_render$n(_ctx, _cache, $props, $setup, $data, $options) {
- const _component_el_checkbox = resolveComponent("el-checkbox");
- const _component_el_radio = resolveComponent("el-radio");
- const _component_check = resolveComponent("check");
- const _component_el_icon = resolveComponent("el-icon");
- const _component_node_content = resolveComponent("node-content");
- const _component_loading = resolveComponent("loading");
- const _component_arrow_right = resolveComponent("arrow-right");
- return openBlock(), createElementBlock("li", {
- id: `${_ctx.menuId}-${_ctx.node.uid}`,
- role: "menuitem",
- "aria-haspopup": !_ctx.isLeaf,
- "aria-owns": _ctx.isLeaf ? null : _ctx.menuId,
- "aria-expanded": _ctx.inExpandingPath,
- tabindex: _ctx.expandable ? -1 : void 0,
- class: normalizeClass([
- _ctx.ns.b(),
- _ctx.ns.is("selectable", _ctx.checkStrictly),
- _ctx.ns.is("active", _ctx.node.checked),
- _ctx.ns.is("disabled", !_ctx.expandable),
- _ctx.inExpandingPath && "in-active-path",
- _ctx.inCheckedPath && "in-checked-path"
- ]),
- onMouseenter: _cache[2] || (_cache[2] = (...args) => _ctx.handleHoverExpand && _ctx.handleHoverExpand(...args)),
- onFocus: _cache[3] || (_cache[3] = (...args) => _ctx.handleHoverExpand && _ctx.handleHoverExpand(...args)),
- onClick: _cache[4] || (_cache[4] = (...args) => _ctx.handleClick && _ctx.handleClick(...args))
- }, [
- createCommentVNode(" prefix "),
- _ctx.multiple ? (openBlock(), createBlock(_component_el_checkbox, {
- key: 0,
- "model-value": _ctx.node.checked,
- indeterminate: _ctx.node.indeterminate,
- disabled: _ctx.isDisabled,
- onClick: _cache[0] || (_cache[0] = withModifiers(() => {
- }, ["stop"])),
- "onUpdate:modelValue": _ctx.handleSelectCheck
- }, null, 8, ["model-value", "indeterminate", "disabled", "onUpdate:modelValue"])) : _ctx.checkStrictly ? (openBlock(), createBlock(_component_el_radio, {
- key: 1,
- "model-value": _ctx.checkedNodeId,
- label: _ctx.node.uid,
- disabled: _ctx.isDisabled,
- "onUpdate:modelValue": _ctx.handleSelectCheck,
- onClick: _cache[1] || (_cache[1] = withModifiers(() => {
- }, ["stop"]))
- }, {
- default: withCtx(() => [
- 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 "),
- _hoisted_2$m
- ]),
- _: 1
- }, 8, ["model-value", "label", "disabled", "onUpdate:modelValue"])) : _ctx.isLeaf && _ctx.node.checked ? (openBlock(), createBlock(_component_el_icon, {
- key: 2,
- class: normalizeClass(_ctx.ns.e("prefix"))
- }, {
- default: withCtx(() => [
- createVNode(_component_check)
- ]),
- _: 1
- }, 8, ["class"])) : createCommentVNode("v-if", true),
- createCommentVNode(" content "),
- createVNode(_component_node_content),
- createCommentVNode(" postfix "),
- !_ctx.isLeaf ? (openBlock(), createElementBlock(Fragment, { key: 3 }, [
- _ctx.node.loading ? (openBlock(), createBlock(_component_el_icon, {
- key: 0,
- class: normalizeClass([_ctx.ns.is("loading"), _ctx.ns.e("postfix")])
- }, {
- default: withCtx(() => [
- createVNode(_component_loading)
- ]),
- _: 1
- }, 8, ["class"])) : (openBlock(), createBlock(_component_el_icon, {
- key: 1,
- class: normalizeClass(["arrow-right", _ctx.ns.e("postfix")])
- }, {
- default: withCtx(() => [
- createVNode(_component_arrow_right)
- ]),
- _: 1
- }, 8, ["class"]))
- ], 2112)) : createCommentVNode("v-if", true)
- ], 42, _hoisted_1$t);
- }
- 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"]]);
- const _sfc_main$I = defineComponent({
- name: "ElCascaderMenu",
- components: {
- Loading: loading,
- ElIcon,
- ElScrollbar,
- ElCascaderNode
- },
- props: {
- nodes: {
- type: Array,
- required: true
- },
- index: {
- type: Number,
- required: true
- }
- },
- setup(props) {
- const instance = getCurrentInstance();
- const ns = useNamespace("cascader-menu");
- const { t } = useLocale();
- const id = generateId();
- let activeNode = null;
- let hoverTimer = null;
- const panel = inject(CASCADER_PANEL_INJECTION_KEY);
- const hoverZone = ref(null);
- const isEmpty3 = computed(() => !props.nodes.length);
- const isLoading = computed(() => !panel.initialLoaded);
- const menuId = computed(() => `cascader-menu-${id}-${props.index}`);
- const handleExpand = (e) => {
- activeNode = e.target;
- };
- const handleMouseMove = (e) => {
- if (!panel.isHoverMenu || !activeNode || !hoverZone.value)
- return;
- if (activeNode.contains(e.target)) {
- clearHoverTimer();
- const el = instance.vnode.el;
- const { left: left2 } = el.getBoundingClientRect();
- const { offsetWidth, offsetHeight } = el;
- const startX = e.clientX - left2;
- const top2 = activeNode.offsetTop;
- const bottom2 = top2 + activeNode.offsetHeight;
- hoverZone.value.innerHTML = `
- <path style="pointer-events: auto;" fill="transparent" d="M${startX} ${top2} L${offsetWidth} 0 V${top2} Z" />
- <path style="pointer-events: auto;" fill="transparent" d="M${startX} ${bottom2} L${offsetWidth} ${offsetHeight} V${bottom2} Z" />
- `;
- } else if (!hoverTimer) {
- hoverTimer = window.setTimeout(clearHoverZone, panel.config.hoverThreshold);
- }
- };
- const clearHoverTimer = () => {
- if (!hoverTimer)
- return;
- clearTimeout(hoverTimer);
- hoverTimer = null;
- };
- const clearHoverZone = () => {
- if (!hoverZone.value)
- return;
- hoverZone.value.innerHTML = "";
- clearHoverTimer();
- };
- return {
- ns,
- panel,
- hoverZone,
- isEmpty: isEmpty3,
- isLoading,
- menuId,
- t,
- handleExpand,
- handleMouseMove,
- clearHoverZone
- };
- }
- });
- function _sfc_render$m(_ctx, _cache, $props, $setup, $data, $options) {
- const _component_el_cascader_node = resolveComponent("el-cascader-node");
- const _component_loading = resolveComponent("loading");
- const _component_el_icon = resolveComponent("el-icon");
- const _component_el_scrollbar = resolveComponent("el-scrollbar");
- return openBlock(), createBlock(_component_el_scrollbar, {
- key: _ctx.menuId,
- tag: "ul",
- role: "menu",
- class: normalizeClass(_ctx.ns.b()),
- "wrap-class": _ctx.ns.e("wrap"),
- "view-class": [_ctx.ns.e("list"), _ctx.ns.is("empty", _ctx.isEmpty)],
- onMousemove: _ctx.handleMouseMove,
- onMouseleave: _ctx.clearHoverZone
- }, {
- default: withCtx(() => {
- var _a2;
- return [
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.nodes, (node) => {
- return openBlock(), createBlock(_component_el_cascader_node, {
- key: node.uid,
- node,
- "menu-id": _ctx.menuId,
- onExpand: _ctx.handleExpand
- }, null, 8, ["node", "menu-id", "onExpand"]);
- }), 128)),
- _ctx.isLoading ? (openBlock(), createElementBlock("div", {
- key: 0,
- class: normalizeClass(_ctx.ns.e("empty-text"))
- }, [
- createVNode(_component_el_icon, {
- size: "14",
- class: normalizeClass(_ctx.ns.is("loading"))
- }, {
- default: withCtx(() => [
- createVNode(_component_loading)
- ]),
- _: 1
- }, 8, ["class"]),
- createTextVNode(" " + toDisplayString(_ctx.t("el.cascader.loading")), 1)
- ], 2)) : _ctx.isEmpty ? (openBlock(), createElementBlock("div", {
- key: 1,
- class: normalizeClass(_ctx.ns.e("empty-text"))
- }, toDisplayString(_ctx.t("el.cascader.noData")), 3)) : ((_a2 = _ctx.panel) == null ? void 0 : _a2.isHoverMenu) ? (openBlock(), createElementBlock("svg", {
- key: 2,
- ref: "hoverZone",
- class: normalizeClass(_ctx.ns.e("hover-zone"))
- }, null, 2)) : createCommentVNode("v-if", true)
- ];
- }),
- _: 1
- }, 8, ["class", "wrap-class", "view-class", "onMousemove", "onMouseleave"]);
- }
- 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"]]);
- var ExpandTrigger = /* @__PURE__ */ ((ExpandTrigger2) => {
- ExpandTrigger2["CLICK"] = "click";
- ExpandTrigger2["HOVER"] = "hover";
- return ExpandTrigger2;
- })(ExpandTrigger || {});
- let uid = 0;
- const calculatePathNodes = (node) => {
- const nodes = [node];
- let { parent } = node;
- while (parent) {
- nodes.unshift(parent);
- parent = parent.parent;
- }
- return nodes;
- };
- class Node {
- constructor(data2, config, parent, root2 = false) {
- this.data = data2;
- this.config = config;
- this.parent = parent;
- this.root = root2;
- this.uid = uid++;
- this.checked = false;
- this.indeterminate = false;
- this.loading = false;
- const { value: valueKey, label: labelKey, children: childrenKey } = config;
- const childrenData = data2[childrenKey];
- const pathNodes = calculatePathNodes(this);
- this.level = root2 ? 0 : parent ? parent.level + 1 : 1;
- this.value = data2[valueKey];
- this.label = data2[labelKey];
- this.pathNodes = pathNodes;
- this.pathValues = pathNodes.map((node) => node.value);
- this.pathLabels = pathNodes.map((node) => node.label);
- this.childrenData = childrenData;
- this.children = (childrenData || []).map((child) => new Node(child, config, this));
- this.loaded = !config.lazy || this.isLeaf || !isEmpty(childrenData);
- }
- get isDisabled() {
- const { data: data2, parent, config } = this;
- const { disabled, checkStrictly } = config;
- const isDisabled = isFunction(disabled) ? disabled(data2, this) : !!data2[disabled];
- return isDisabled || !checkStrictly && (parent == null ? void 0 : parent.isDisabled);
- }
- get isLeaf() {
- const { data: data2, config, childrenData, loaded } = this;
- const { lazy, leaf } = config;
- const isLeaf2 = isFunction(leaf) ? leaf(data2, this) : data2[leaf];
- return isUndefined(isLeaf2) ? lazy && !loaded ? false : !(Array.isArray(childrenData) && childrenData.length) : !!isLeaf2;
- }
- get valueByOption() {
- return this.config.emitPath ? this.pathValues : this.value;
- }
- appendChild(childData) {
- const { childrenData, children } = this;
- const node = new Node(childData, this.config, this);
- if (Array.isArray(childrenData)) {
- childrenData.push(childData);
- } else {
- this.childrenData = [childData];
- }
- children.push(node);
- return node;
- }
- calcText(allLevels, separator) {
- const text = allLevels ? this.pathLabels.join(separator) : this.label;
- this.text = text;
- return text;
- }
- broadcast(event, ...args) {
- const handlerName = `onParent${capitalize(event)}`;
- this.children.forEach((child) => {
- if (child) {
- child.broadcast(event, ...args);
- child[handlerName] && child[handlerName](...args);
- }
- });
- }
- emit(event, ...args) {
- const { parent } = this;
- const handlerName = `onChild${capitalize(event)}`;
- if (parent) {
- parent[handlerName] && parent[handlerName](...args);
- parent.emit(event, ...args);
- }
- }
- onParentCheck(checked) {
- if (!this.isDisabled) {
- this.setCheckState(checked);
- }
- }
- onChildCheck() {
- const { children } = this;
- const validChildren = children.filter((child) => !child.isDisabled);
- const checked = validChildren.length ? validChildren.every((child) => child.checked) : false;
- this.setCheckState(checked);
- }
- setCheckState(checked) {
- const totalNum = this.children.length;
- const checkedNum = this.children.reduce((c2, p2) => {
- const num = p2.checked ? 1 : p2.indeterminate ? 0.5 : 0;
- return c2 + num;
- }, 0);
- this.checked = this.loaded && this.children.every((child) => child.loaded && child.checked) && checked;
- this.indeterminate = this.loaded && checkedNum !== totalNum && checkedNum > 0;
- }
- doCheck(checked) {
- if (this.checked === checked)
- return;
- const { checkStrictly, multiple } = this.config;
- if (checkStrictly || !multiple) {
- this.checked = checked;
- } else {
- this.broadcast("check", checked);
- this.setCheckState(checked);
- this.emit("check");
- }
- }
- }
- const flatNodes = (nodes, leafOnly) => {
- return nodes.reduce((res, node) => {
- if (node.isLeaf) {
- res.push(node);
- } else {
- !leafOnly && res.push(node);
- res = res.concat(flatNodes(node.children, leafOnly));
- }
- return res;
- }, []);
- };
- class Store {
- constructor(data2, config) {
- this.config = config;
- const nodes = (data2 || []).map((nodeData) => new Node(nodeData, this.config));
- this.nodes = nodes;
- this.allNodes = flatNodes(nodes, false);
- this.leafNodes = flatNodes(nodes, true);
- }
- getNodes() {
- return this.nodes;
- }
- getFlattedNodes(leafOnly) {
- return leafOnly ? this.leafNodes : this.allNodes;
- }
- appendNode(nodeData, parentNode) {
- const node = parentNode ? parentNode.appendChild(nodeData) : new Node(nodeData, this.config);
- if (!parentNode)
- this.nodes.push(node);
- this.allNodes.push(node);
- node.isLeaf && this.leafNodes.push(node);
- }
- appendNodes(nodeDataList, parentNode) {
- nodeDataList.forEach((nodeData) => this.appendNode(nodeData, parentNode));
- }
- getNodeByValue(value, leafOnly = false) {
- if (!value && value !== 0)
- return null;
- const node = this.getFlattedNodes(leafOnly).find((node2) => isEqual(node2.value, value) || isEqual(node2.pathValues, value));
- return node || null;
- }
- getSameNode(node) {
- if (!node)
- return null;
- const node_ = this.getFlattedNodes(false).find(({ value, level }) => isEqual(node.value, value) && node.level === level);
- return node_ || null;
- }
- }
- const CommonProps = {
- modelValue: [Number, String, Array],
- options: {
- type: Array,
- default: () => []
- },
- props: {
- type: Object,
- default: () => ({})
- }
- };
- const DefaultProps = {
- expandTrigger: ExpandTrigger.CLICK,
- multiple: false,
- checkStrictly: false,
- emitPath: true,
- lazy: false,
- lazyLoad: NOOP,
- value: "value",
- label: "label",
- children: "children",
- leaf: "leaf",
- disabled: "disabled",
- hoverThreshold: 500
- };
- const useCascaderConfig = (props) => {
- return computed(() => __spreadValues(__spreadValues({}, DefaultProps), props.props));
- };
- const getMenuIndex = (el) => {
- if (!el)
- return 0;
- const pieces = el.id.split("-");
- return Number(pieces[pieces.length - 2]);
- };
- const checkNode = (el) => {
- if (!el)
- return;
- const input = el.querySelector("input");
- if (input) {
- input.click();
- } else if (isLeaf(el)) {
- el.click();
- }
- };
- const sortByOriginalOrder = (oldNodes, newNodes) => {
- const newNodesCopy = newNodes.slice(0);
- const newIds = newNodesCopy.map((node) => node.uid);
- const res = oldNodes.reduce((acc, item) => {
- const index = newIds.indexOf(item.uid);
- if (index > -1) {
- acc.push(item);
- newNodesCopy.splice(index, 1);
- newIds.splice(index, 1);
- }
- return acc;
- }, []);
- res.push(...newNodesCopy);
- return res;
- };
- const _sfc_main$H = defineComponent({
- name: "ElCascaderPanel",
- components: {
- ElCascaderMenu
- },
- props: __spreadProps(__spreadValues({}, CommonProps), {
- border: {
- type: Boolean,
- default: true
- },
- renderLabel: Function
- }),
- emits: [UPDATE_MODEL_EVENT, CHANGE_EVENT, "close", "expand-change"],
- setup(props, { emit, slots }) {
- let manualChecked = false;
- const ns = useNamespace("cascader");
- const config = useCascaderConfig(props);
- let store = null;
- const initialLoaded = ref(true);
- const menuList = ref([]);
- const checkedValue = ref(null);
- const menus = ref([]);
- const expandingNode = ref(null);
- const checkedNodes = ref([]);
- const isHoverMenu = computed(() => config.value.expandTrigger === ExpandTrigger.HOVER);
- const renderLabelFn = computed(() => props.renderLabel || slots.default);
- const initStore = () => {
- const { options } = props;
- const cfg = config.value;
- manualChecked = false;
- store = new Store(options, cfg);
- menus.value = [store.getNodes()];
- if (cfg.lazy && isEmpty(props.options)) {
- initialLoaded.value = false;
- lazyLoad(void 0, (list) => {
- if (list) {
- store = new Store(list, cfg);
- menus.value = [store.getNodes()];
- }
- initialLoaded.value = true;
- syncCheckedValue(false, true);
- });
- } else {
- syncCheckedValue(false, true);
- }
- };
- const lazyLoad = (node, cb) => {
- const cfg = config.value;
- node = node || new Node({}, cfg, void 0, true);
- node.loading = true;
- const resolve = (dataList) => {
- const _node = node;
- const parent = _node.root ? null : _node;
- dataList && (store == null ? void 0 : store.appendNodes(dataList, parent));
- _node.loading = false;
- _node.loaded = true;
- _node.childrenData = _node.childrenData || [];
- cb && cb(dataList);
- };
- cfg.lazyLoad(node, resolve);
- };
- const expandNode = (node, silent) => {
- var _a2;
- const { level } = node;
- const newMenus = menus.value.slice(0, level);
- let newExpandingNode;
- if (node.isLeaf) {
- newExpandingNode = node.pathNodes[level - 2];
- } else {
- newExpandingNode = node;
- newMenus.push(node.children);
- }
- if (((_a2 = expandingNode.value) == null ? void 0 : _a2.uid) !== (newExpandingNode == null ? void 0 : newExpandingNode.uid)) {
- expandingNode.value = node;
- menus.value = newMenus;
- !silent && emit("expand-change", (node == null ? void 0 : node.pathValues) || []);
- }
- };
- const handleCheckChange = (node, checked, emitClose = true) => {
- const { checkStrictly, multiple } = config.value;
- const oldNode = checkedNodes.value[0];
- manualChecked = true;
- !multiple && (oldNode == null ? void 0 : oldNode.doCheck(false));
- node.doCheck(checked);
- calculateCheckedValue();
- emitClose && !multiple && !checkStrictly && emit("close");
- !emitClose && !multiple && !checkStrictly && expandParentNode(node);
- };
- const expandParentNode = (node) => {
- if (!node)
- return;
- node = node.parent;
- expandParentNode(node);
- node && expandNode(node);
- };
- const getFlattedNodes = (leafOnly) => {
- return store == null ? void 0 : store.getFlattedNodes(leafOnly);
- };
- const getCheckedNodes = (leafOnly) => {
- var _a2;
- return (_a2 = getFlattedNodes(leafOnly)) == null ? void 0 : _a2.filter((node) => node.checked !== false);
- };
- const clearCheckedNodes = () => {
- checkedNodes.value.forEach((node) => node.doCheck(false));
- calculateCheckedValue();
- };
- const calculateCheckedValue = () => {
- var _a2;
- const { checkStrictly, multiple } = config.value;
- const oldNodes = checkedNodes.value;
- const newNodes = getCheckedNodes(!checkStrictly);
- const nodes = sortByOriginalOrder(oldNodes, newNodes);
- const values = nodes.map((node) => node.valueByOption);
- checkedNodes.value = nodes;
- checkedValue.value = multiple ? values : (_a2 = values[0]) != null ? _a2 : null;
- };
- const syncCheckedValue = (loaded = false, forced = false) => {
- const { modelValue } = props;
- const { lazy, multiple, checkStrictly } = config.value;
- const leafOnly = !checkStrictly;
- if (!initialLoaded.value || manualChecked || !forced && isEqual(modelValue, checkedValue.value))
- return;
- if (lazy && !loaded) {
- const values = unique(flattenDeep(castArray(modelValue)));
- const nodes = values.map((val) => store == null ? void 0 : store.getNodeByValue(val)).filter((node) => !!node && !node.loaded && !node.loading);
- if (nodes.length) {
- nodes.forEach((node) => {
- lazyLoad(node, () => syncCheckedValue(false, forced));
- });
- } else {
- syncCheckedValue(true, forced);
- }
- } else {
- const values = multiple ? castArray(modelValue) : [modelValue];
- const nodes = unique(values.map((val) => store == null ? void 0 : store.getNodeByValue(val, leafOnly)));
- syncMenuState(nodes, false);
- checkedValue.value = modelValue;
- }
- };
- const syncMenuState = (newCheckedNodes, reserveExpandingState = true) => {
- const { checkStrictly } = config.value;
- const oldNodes = checkedNodes.value;
- const newNodes = newCheckedNodes.filter((node) => !!node && (checkStrictly || node.isLeaf));
- const oldExpandingNode = store == null ? void 0 : store.getSameNode(expandingNode.value);
- const newExpandingNode = reserveExpandingState && oldExpandingNode || newNodes[0];
- if (newExpandingNode) {
- newExpandingNode.pathNodes.forEach((node) => expandNode(node, true));
- } else {
- expandingNode.value = null;
- }
- oldNodes.forEach((node) => node.doCheck(false));
- newNodes.forEach((node) => node.doCheck(true));
- checkedNodes.value = newNodes;
- nextTick(scrollToExpandingNode);
- };
- const scrollToExpandingNode = () => {
- if (!isClient)
- return;
- menuList.value.forEach((menu) => {
- const menuElement = menu == null ? void 0 : menu.$el;
- if (menuElement) {
- const container = menuElement.querySelector(`.${ns.namespace.value}-scrollbar__wrap`);
- const activeNode = menuElement.querySelector(`.${ns.b("node")}.${ns.is("active")}`) || menuElement.querySelector(`.${ns.b("node")}.in-active-path`);
- scrollIntoView(container, activeNode);
- }
- });
- };
- const handleKeyDown2 = (e) => {
- const target = e.target;
- const { code } = e;
- switch (code) {
- case EVENT_CODE.up:
- case EVENT_CODE.down: {
- e.preventDefault();
- const distance = code === EVENT_CODE.up ? -1 : 1;
- focusNode(getSibling(target, distance, `.${ns.b("node")}[tabindex="-1"]`));
- break;
- }
- case EVENT_CODE.left: {
- e.preventDefault();
- const preMenu = menuList.value[getMenuIndex(target) - 1];
- const expandedNode = preMenu == null ? void 0 : preMenu.$el.querySelector(`.${ns.b("node")}[aria-expanded="true"]`);
- focusNode(expandedNode);
- break;
- }
- case EVENT_CODE.right: {
- e.preventDefault();
- const nextMenu = menuList.value[getMenuIndex(target) + 1];
- const firstNode = nextMenu == null ? void 0 : nextMenu.$el.querySelector(`.${ns.b("node")}[tabindex="-1"]`);
- focusNode(firstNode);
- break;
- }
- case EVENT_CODE.enter:
- checkNode(target);
- break;
- case EVENT_CODE.esc:
- case EVENT_CODE.tab:
- emit("close");
- break;
- }
- };
- provide(CASCADER_PANEL_INJECTION_KEY, reactive({
- config,
- expandingNode,
- checkedNodes,
- isHoverMenu,
- initialLoaded,
- renderLabelFn,
- lazyLoad,
- expandNode,
- handleCheckChange
- }));
- watch([config, () => props.options], initStore, {
- deep: true,
- immediate: true
- });
- watch(() => props.modelValue, () => {
- manualChecked = false;
- syncCheckedValue();
- });
- watch(checkedValue, (val) => {
- if (!isEqual(val, props.modelValue)) {
- emit(UPDATE_MODEL_EVENT, val);
- emit(CHANGE_EVENT, val);
- }
- });
- onBeforeUpdate(() => menuList.value = []);
- onMounted(() => !isEmpty(props.modelValue) && syncCheckedValue());
- return {
- ns,
- menuList,
- menus,
- checkedNodes,
- handleKeyDown: handleKeyDown2,
- handleCheckChange,
- getFlattedNodes,
- getCheckedNodes,
- clearCheckedNodes,
- calculateCheckedValue,
- scrollToExpandingNode
- };
- }
- });
- function _sfc_render$l(_ctx, _cache, $props, $setup, $data, $options) {
- const _component_el_cascader_menu = resolveComponent("el-cascader-menu");
- return openBlock(), createElementBlock("div", {
- class: normalizeClass([_ctx.ns.b("panel"), _ctx.ns.is("bordered", _ctx.border)]),
- onKeydown: _cache[0] || (_cache[0] = (...args) => _ctx.handleKeyDown && _ctx.handleKeyDown(...args))
- }, [
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.menus, (menu, index) => {
- return openBlock(), createBlock(_component_el_cascader_menu, {
- key: index,
- ref_for: true,
- ref: (item) => _ctx.menuList[index] = item,
- index,
- nodes: [...menu]
- }, null, 8, ["index", "nodes"]);
- }), 128))
- ], 34);
- }
- 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"]]);
- CascaderPanel.install = (app) => {
- app.component(CascaderPanel.name, CascaderPanel);
- };
- const _CascaderPanel = CascaderPanel;
- const tagProps = buildProps({
- closable: Boolean,
- type: {
- type: String,
- values: ["success", "info", "warning", "danger", ""],
- default: ""
- },
- hit: Boolean,
- disableTransitions: Boolean,
- color: {
- type: String,
- default: ""
- },
- size: {
- type: String,
- values: componentSizes,
- default: ""
- },
- effect: {
- type: String,
- values: ["dark", "light", "plain"],
- default: "light"
- },
- round: Boolean
- });
- const tagEmits = {
- close: (evt) => evt instanceof MouseEvent,
- click: (evt) => evt instanceof MouseEvent
- };
- const __default__$d = {
- name: "ElTag"
- };
- const _sfc_main$G = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$d), {
- props: tagProps,
- emits: tagEmits,
- setup(__props, { emit }) {
- const props = __props;
- const tagSize = useSize();
- const ns = useNamespace("tag");
- const classes = computed(() => {
- const { type: type4, hit, effect: effect2, closable, round: round2 } = props;
- return [
- ns.b(),
- ns.is("closable", closable),
- ns.m(type4),
- ns.m(tagSize.value),
- ns.m(effect2),
- ns.is("hit", hit),
- ns.is("round", round2)
- ];
- });
- const handleClose = (event) => {
- event.stopPropagation();
- emit("close", event);
- };
- const handleClick = (event) => {
- emit("click", event);
- };
- return (_ctx, _cache) => {
- return !_ctx.disableTransitions ? (openBlock(), createElementBlock("span", {
- key: 0,
- class: normalizeClass(unref(classes)),
- style: normalizeStyle({ backgroundColor: _ctx.color }),
- onClick: handleClick
- }, [
- createElementVNode("span", {
- class: normalizeClass(unref(ns).e("content"))
- }, [
- renderSlot(_ctx.$slots, "default")
- ], 2),
- _ctx.closable ? (openBlock(), createBlock(unref(ElIcon), {
- key: 0,
- class: normalizeClass(unref(ns).e("close")),
- onClick: handleClose
- }, {
- default: withCtx(() => [
- createVNode(unref(close))
- ]),
- _: 1
- }, 8, ["class"])) : createCommentVNode("v-if", true)
- ], 6)) : (openBlock(), createBlock(Transition, {
- key: 1,
- name: `${unref(ns).namespace.value}-zoom-in-center`
- }, {
- default: withCtx(() => [
- createElementVNode("span", {
- class: normalizeClass(unref(classes)),
- style: normalizeStyle({ backgroundColor: _ctx.color }),
- onClick: handleClick
- }, [
- createElementVNode("span", {
- class: normalizeClass(unref(ns).e("content"))
- }, [
- renderSlot(_ctx.$slots, "default")
- ], 2),
- _ctx.closable ? (openBlock(), createBlock(unref(ElIcon), {
- key: 0,
- class: normalizeClass(unref(ns).e("close")),
- onClick: handleClose
- }, {
- default: withCtx(() => [
- createVNode(unref(close))
- ]),
- _: 1
- }, 8, ["class"])) : createCommentVNode("v-if", true)
- ], 6)
- ]),
- _: 3
- }, 8, ["name"]));
- };
- }
- }));
- var Tag = /* @__PURE__ */ _export_sfc$1(_sfc_main$G, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/tag/src/tag.vue"]]);
- const ElTag = withInstall(Tag);
- const DEFAULT_INPUT_HEIGHT = 40;
- const INPUT_HEIGHT_MAP = {
- large: 36,
- default: 32,
- small: 28
- };
- const popperOptions = {
- modifiers: [
- {
- name: "arrowPosition",
- enabled: true,
- phase: "main",
- fn: ({ state }) => {
- const { modifiersData, placement } = state;
- if (["right", "left", "bottom", "top"].includes(placement))
- return;
- modifiersData.arrow.x = 35;
- },
- requires: ["arrow"]
- }
- ]
- };
- const COMPONENT_NAME$3 = "ElCascader";
- const _sfc_main$F = defineComponent({
- name: COMPONENT_NAME$3,
- components: {
- ElCascaderPanel: _CascaderPanel,
- ElInput,
- ElTooltip,
- ElScrollbar,
- ElTag,
- ElIcon,
- CircleClose: circleClose,
- Check: check,
- ArrowDown: arrowDown
- },
- directives: {
- Clickoutside: ClickOutside
- },
- props: __spreadProps(__spreadValues({}, CommonProps), {
- size: {
- type: String,
- validator: isValidComponentSize
- },
- placeholder: {
- type: String
- },
- disabled: Boolean,
- clearable: Boolean,
- filterable: Boolean,
- filterMethod: {
- type: Function,
- default: (node, keyword) => node.text.includes(keyword)
- },
- separator: {
- type: String,
- default: " / "
- },
- showAllLevels: {
- type: Boolean,
- default: true
- },
- collapseTags: Boolean,
- collapseTagsTooltip: {
- type: Boolean,
- default: false
- },
- debounce: {
- type: Number,
- default: 300
- },
- beforeFilter: {
- type: Function,
- default: () => true
- },
- popperClass: {
- type: String,
- default: ""
- },
- popperAppendToBody: {
- type: Boolean,
- default: void 0
- },
- teleported: useTooltipContentProps.teleported,
- tagType: __spreadProps(__spreadValues({}, tagProps.type), { default: "info" })
- }),
- emits: [
- UPDATE_MODEL_EVENT,
- CHANGE_EVENT,
- "focus",
- "blur",
- "visible-change",
- "expand-change",
- "remove-tag"
- ],
- setup(props, { emit }) {
- let inputInitialHeight = 0;
- let pressDeleteCount = 0;
- const { compatTeleported } = useDeprecateAppendToBody(COMPONENT_NAME$3, "popperAppendToBody");
- const nsCascader = useNamespace("cascader");
- const nsInput = useNamespace("input");
- const { t } = useLocale();
- const elForm2 = inject(formContextKey, {});
- const elFormItem2 = inject(formItemContextKey, {});
- const tooltipRef = ref(null);
- const input = ref(null);
- const tagWrapper = ref(null);
- const panel = ref(null);
- const suggestionPanel = ref(null);
- const popperVisible = ref(false);
- const inputHover = ref(false);
- const filtering = ref(false);
- const inputValue = ref("");
- const searchInputValue = ref("");
- const presentTags = ref([]);
- const allPresentTags = ref([]);
- const suggestions = ref([]);
- const isOnComposition = ref(false);
- const isDisabled = computed(() => props.disabled || elForm2.disabled);
- const inputPlaceholder = computed(() => props.placeholder || t("el.cascader.placeholder"));
- const realSize = useSize();
- const tagSize = computed(() => ["small"].includes(realSize.value) ? "small" : "default");
- const multiple = computed(() => !!props.props.multiple);
- const readonly2 = computed(() => !props.filterable || multiple.value);
- const searchKeyword = computed(() => multiple.value ? searchInputValue.value : inputValue.value);
- const checkedNodes = computed(() => {
- var _a2;
- return ((_a2 = panel.value) == null ? void 0 : _a2.checkedNodes) || [];
- });
- const clearBtnVisible = computed(() => {
- if (!props.clearable || isDisabled.value || filtering.value || !inputHover.value)
- return false;
- return !!checkedNodes.value.length;
- });
- const presentText = computed(() => {
- const { showAllLevels, separator } = props;
- const nodes = checkedNodes.value;
- return nodes.length ? multiple.value ? " " : nodes[0].calcText(showAllLevels, separator) : "";
- });
- const checkedValue = computed({
- get() {
- return props.modelValue;
- },
- set(val) {
- var _a2;
- emit(UPDATE_MODEL_EVENT, val);
- emit(CHANGE_EVENT, val);
- (_a2 = elFormItem2.validate) == null ? void 0 : _a2.call(elFormItem2, "change").catch((err) => debugWarn());
- }
- });
- const popperPaneRef = computed(() => {
- var _a2, _b2;
- return (_b2 = (_a2 = tooltipRef.value) == null ? void 0 : _a2.popperRef) == null ? void 0 : _b2.contentRef;
- });
- const togglePopperVisible = (visible) => {
- var _a2, _b2, _c;
- if (isDisabled.value)
- return;
- visible = visible != null ? visible : !popperVisible.value;
- if (visible !== popperVisible.value) {
- popperVisible.value = visible;
- (_b2 = (_a2 = input.value) == null ? void 0 : _a2.input) == null ? void 0 : _b2.setAttribute("aria-expanded", `${visible}`);
- if (visible) {
- updatePopperPosition();
- nextTick((_c = panel.value) == null ? void 0 : _c.scrollToExpandingNode);
- } else if (props.filterable) {
- const { value } = presentText;
- inputValue.value = value;
- searchInputValue.value = value;
- }
- emit("visible-change", visible);
- }
- };
- const updatePopperPosition = () => {
- nextTick(() => {
- var _a2;
- (_a2 = tooltipRef.value) == null ? void 0 : _a2.updatePopper();
- });
- };
- const hideSuggestionPanel = () => {
- filtering.value = false;
- };
- const genTag2 = (node) => {
- const { showAllLevels, separator } = props;
- return {
- node,
- key: node.uid,
- text: node.calcText(showAllLevels, separator),
- hitState: false,
- closable: !isDisabled.value && !node.isDisabled,
- isCollapseTag: false
- };
- };
- const deleteTag = (tag) => {
- var _a2;
- const node = tag.node;
- node.doCheck(false);
- (_a2 = panel.value) == null ? void 0 : _a2.calculateCheckedValue();
- emit("remove-tag", node.valueByOption);
- };
- const calculatePresentTags = () => {
- if (!multiple.value)
- return;
- const nodes = checkedNodes.value;
- const tags = [];
- const allTags = [];
- nodes.forEach((node) => allTags.push(genTag2(node)));
- allPresentTags.value = allTags;
- if (nodes.length) {
- const [first, ...rest] = nodes;
- const restCount = rest.length;
- tags.push(genTag2(first));
- if (restCount) {
- if (props.collapseTags) {
- tags.push({
- key: -1,
- text: `+ ${restCount}`,
- closable: false,
- isCollapseTag: true
- });
- } else {
- rest.forEach((node) => tags.push(genTag2(node)));
- }
- }
- }
- presentTags.value = tags;
- };
- const calculateSuggestions = () => {
- var _a2, _b2;
- const { filterMethod, showAllLevels, separator } = props;
- const res = (_b2 = (_a2 = panel.value) == null ? void 0 : _a2.getFlattedNodes(!props.props.checkStrictly)) == null ? void 0 : _b2.filter((node) => {
- if (node.isDisabled)
- return false;
- node.calcText(showAllLevels, separator);
- return filterMethod(node, searchKeyword.value);
- });
- if (multiple.value) {
- presentTags.value.forEach((tag) => {
- tag.hitState = false;
- });
- allPresentTags.value.forEach((tag) => {
- tag.hitState = false;
- });
- }
- filtering.value = true;
- suggestions.value = res;
- updatePopperPosition();
- };
- const focusFirstNode = () => {
- var _a2;
- let firstNode;
- if (filtering.value && suggestionPanel.value) {
- firstNode = suggestionPanel.value.$el.querySelector(`.${nsCascader.e("suggestion-item")}`);
- } else {
- firstNode = (_a2 = panel.value) == null ? void 0 : _a2.$el.querySelector(`.${nsCascader.b("node")}[tabindex="-1"]`);
- }
- if (firstNode) {
- firstNode.focus();
- !filtering.value && firstNode.click();
- }
- };
- const updateStyle = () => {
- var _a2, _b2;
- const inputInner = (_a2 = input.value) == null ? void 0 : _a2.input;
- const tagWrapperEl = tagWrapper.value;
- const suggestionPanelEl = (_b2 = suggestionPanel.value) == null ? void 0 : _b2.$el;
- if (!isClient || !inputInner)
- return;
- if (suggestionPanelEl) {
- const suggestionList = suggestionPanelEl.querySelector(`.${nsCascader.e("suggestion-list")}`);
- suggestionList.style.minWidth = `${inputInner.offsetWidth}px`;
- }
- if (tagWrapperEl) {
- const { offsetHeight } = tagWrapperEl;
- const height = presentTags.value.length > 0 ? `${Math.max(offsetHeight + 6, inputInitialHeight)}px` : `${inputInitialHeight}px`;
- inputInner.style.height = height;
- updatePopperPosition();
- }
- };
- const getCheckedNodes = (leafOnly) => {
- var _a2;
- return (_a2 = panel.value) == null ? void 0 : _a2.getCheckedNodes(leafOnly);
- };
- const handleExpandChange = (value) => {
- updatePopperPosition();
- emit("expand-change", value);
- };
- const handleComposition = (event) => {
- var _a2;
- const text = (_a2 = event.target) == null ? void 0 : _a2.value;
- if (event.type === "compositionend") {
- isOnComposition.value = false;
- nextTick(() => handleInput(text));
- } else {
- const lastCharacter = text[text.length - 1] || "";
- isOnComposition.value = !isKorean(lastCharacter);
- }
- };
- const handleKeyDown2 = (e) => {
- if (isOnComposition.value)
- return;
- switch (e.code) {
- case EVENT_CODE.enter:
- togglePopperVisible();
- break;
- case EVENT_CODE.down:
- togglePopperVisible(true);
- nextTick(focusFirstNode);
- e.preventDefault();
- break;
- case EVENT_CODE.esc:
- case EVENT_CODE.tab:
- togglePopperVisible(false);
- break;
- }
- };
- const handleClear = () => {
- var _a2;
- (_a2 = panel.value) == null ? void 0 : _a2.clearCheckedNodes();
- togglePopperVisible(false);
- };
- const handleSuggestionClick = (node) => {
- var _a2, _b2;
- const { checked } = node;
- if (multiple.value) {
- (_a2 = panel.value) == null ? void 0 : _a2.handleCheckChange(node, !checked, false);
- } else {
- !checked && ((_b2 = panel.value) == null ? void 0 : _b2.handleCheckChange(node, true, false));
- togglePopperVisible(false);
- }
- };
- const handleSuggestionKeyDown = (e) => {
- const target = e.target;
- const { code } = e;
- switch (code) {
- case EVENT_CODE.up:
- case EVENT_CODE.down: {
- const distance = code === EVENT_CODE.up ? -1 : 1;
- focusNode(getSibling(target, distance, `.${nsCascader.e("suggestion-item")}[tabindex="-1"]`));
- break;
- }
- case EVENT_CODE.enter:
- target.click();
- break;
- case EVENT_CODE.esc:
- case EVENT_CODE.tab:
- togglePopperVisible(false);
- break;
- }
- };
- const handleDelete = () => {
- const tags = presentTags.value;
- const lastTag = tags[tags.length - 1];
- pressDeleteCount = searchInputValue.value ? 0 : pressDeleteCount + 1;
- if (!lastTag || !pressDeleteCount)
- return;
- if (lastTag.hitState) {
- deleteTag(lastTag);
- } else {
- lastTag.hitState = true;
- }
- };
- const handleFilter = debounce$1(() => {
- const { value } = searchKeyword;
- if (!value)
- return;
- const passed = props.beforeFilter(value);
- if (isPromise(passed)) {
- passed.then(calculateSuggestions).catch(() => {
- });
- } else if (passed !== false) {
- calculateSuggestions();
- } else {
- hideSuggestionPanel();
- }
- }, props.debounce);
- const handleInput = (val, e) => {
- !popperVisible.value && togglePopperVisible(true);
- if (e == null ? void 0 : e.isComposing)
- return;
- val ? handleFilter() : hideSuggestionPanel();
- };
- watch(filtering, updatePopperPosition);
- watch([checkedNodes, isDisabled], calculatePresentTags);
- watch(presentTags, () => {
- nextTick(() => updateStyle());
- });
- watch(presentText, (val) => inputValue.value = val, { immediate: true });
- onMounted(() => {
- var _a2;
- const inputEl = (_a2 = input.value) == null ? void 0 : _a2.$el;
- inputInitialHeight = (inputEl == null ? void 0 : inputEl.offsetHeight) || INPUT_HEIGHT_MAP[realSize.value] || DEFAULT_INPUT_HEIGHT;
- addResizeListener(inputEl, updateStyle);
- });
- onBeforeUnmount(() => {
- var _a2;
- removeResizeListener((_a2 = input.value) == null ? void 0 : _a2.$el, updateStyle);
- });
- return {
- popperOptions,
- tooltipRef,
- popperPaneRef,
- input,
- tagWrapper,
- panel,
- suggestionPanel,
- popperVisible,
- inputHover,
- inputPlaceholder,
- filtering,
- presentText,
- checkedValue,
- inputValue,
- searchInputValue,
- presentTags,
- allPresentTags,
- suggestions,
- isDisabled,
- isOnComposition,
- realSize,
- tagSize,
- multiple,
- readonly: readonly2,
- clearBtnVisible,
- compatTeleported,
- nsCascader,
- nsInput,
- t,
- togglePopperVisible,
- hideSuggestionPanel,
- deleteTag,
- focusFirstNode,
- getCheckedNodes,
- handleExpandChange,
- handleKeyDown: handleKeyDown2,
- handleComposition,
- handleClear,
- handleSuggestionClick,
- handleSuggestionKeyDown,
- handleDelete,
- handleInput
- };
- }
- });
- const _hoisted_1$s = { key: 0 };
- const _hoisted_2$l = { class: "el-cascader__collapse-tags" };
- const _hoisted_3$f = ["placeholder"];
- const _hoisted_4$d = ["onClick"];
- function _sfc_render$k(_ctx, _cache, $props, $setup, $data, $options) {
- const _component_circle_close = resolveComponent("circle-close");
- const _component_el_icon = resolveComponent("el-icon");
- const _component_arrow_down = resolveComponent("arrow-down");
- const _component_el_input = resolveComponent("el-input");
- const _component_el_tag = resolveComponent("el-tag");
- const _component_el_tooltip = resolveComponent("el-tooltip");
- const _component_el_cascader_panel = resolveComponent("el-cascader-panel");
- const _component_check = resolveComponent("check");
- const _component_el_scrollbar = resolveComponent("el-scrollbar");
- const _directive_clickoutside = resolveDirective("clickoutside");
- return openBlock(), createBlock(_component_el_tooltip, {
- ref: "tooltipRef",
- visible: _ctx.popperVisible,
- "onUpdate:visible": _cache[17] || (_cache[17] = ($event) => _ctx.popperVisible = $event),
- teleported: _ctx.compatTeleported,
- "popper-class": [_ctx.nsCascader.e("dropdown"), _ctx.popperClass],
- "popper-options": _ctx.popperOptions,
- "fallback-placements": [
- "bottom-start",
- "bottom",
- "top-start",
- "top",
- "right",
- "left"
- ],
- "stop-popper-mouse-event": false,
- "gpu-acceleration": false,
- placement: "bottom-start",
- transition: `${_ctx.nsCascader.namespace.value}-zoom-in-top`,
- effect: "light",
- pure: "",
- persistent: "",
- onHide: _ctx.hideSuggestionPanel
- }, {
- default: withCtx(() => [
- withDirectives((openBlock(), createElementBlock("div", {
- class: normalizeClass([
- _ctx.nsCascader.b(),
- _ctx.nsCascader.m(_ctx.realSize),
- _ctx.nsCascader.is("disabled", _ctx.isDisabled),
- _ctx.$attrs.class
- ]),
- style: normalizeStyle(_ctx.$attrs.style),
- onClick: _cache[11] || (_cache[11] = () => _ctx.togglePopperVisible(_ctx.readonly ? void 0 : true)),
- onKeydown: _cache[12] || (_cache[12] = (...args) => _ctx.handleKeyDown && _ctx.handleKeyDown(...args)),
- onMouseenter: _cache[13] || (_cache[13] = ($event) => _ctx.inputHover = true),
- onMouseleave: _cache[14] || (_cache[14] = ($event) => _ctx.inputHover = false)
- }, [
- createVNode(_component_el_input, {
- ref: "input",
- modelValue: _ctx.inputValue,
- "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.inputValue = $event),
- placeholder: _ctx.inputPlaceholder,
- readonly: _ctx.readonly,
- disabled: _ctx.isDisabled,
- "validate-event": false,
- size: _ctx.realSize,
- class: normalizeClass(_ctx.nsCascader.is("focus", _ctx.popperVisible)),
- onCompositionstart: _ctx.handleComposition,
- onCompositionupdate: _ctx.handleComposition,
- onCompositionend: _ctx.handleComposition,
- onFocus: _cache[2] || (_cache[2] = (e) => _ctx.$emit("focus", e)),
- onBlur: _cache[3] || (_cache[3] = (e) => _ctx.$emit("blur", e)),
- onInput: _ctx.handleInput
- }, {
- suffix: withCtx(() => [
- _ctx.clearBtnVisible ? (openBlock(), createBlock(_component_el_icon, {
- key: "clear",
- class: normalizeClass([_ctx.nsInput.e("icon"), "icon-circle-close"]),
- onClick: withModifiers(_ctx.handleClear, ["stop"])
- }, {
- default: withCtx(() => [
- createVNode(_component_circle_close)
- ]),
- _: 1
- }, 8, ["class", "onClick"])) : (openBlock(), createBlock(_component_el_icon, {
- key: "arrow-down",
- class: normalizeClass([
- _ctx.nsInput.e("icon"),
- "icon-arrow-down",
- _ctx.nsCascader.is("reverse", _ctx.popperVisible)
- ]),
- onClick: _cache[0] || (_cache[0] = withModifiers(($event) => _ctx.togglePopperVisible(), ["stop"]))
- }, {
- default: withCtx(() => [
- createVNode(_component_arrow_down)
- ]),
- _: 1
- }, 8, ["class"]))
- ]),
- _: 1
- }, 8, ["modelValue", "placeholder", "readonly", "disabled", "size", "class", "onCompositionstart", "onCompositionupdate", "onCompositionend", "onInput"]),
- _ctx.multiple ? (openBlock(), createElementBlock("div", {
- key: 0,
- ref: "tagWrapper",
- class: normalizeClass(_ctx.nsCascader.e("tags"))
- }, [
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.presentTags, (tag) => {
- return openBlock(), createBlock(_component_el_tag, {
- key: tag.key,
- type: _ctx.tagType,
- size: _ctx.tagSize,
- hit: tag.hitState,
- closable: tag.closable,
- "disable-transitions": "",
- onClose: ($event) => _ctx.deleteTag(tag)
- }, {
- default: withCtx(() => [
- tag.isCollapseTag === false ? (openBlock(), createElementBlock("span", _hoisted_1$s, toDisplayString(tag.text), 1)) : (openBlock(), createBlock(_component_el_tooltip, {
- key: 1,
- teleported: false,
- disabled: _ctx.popperVisible || !_ctx.collapseTagsTooltip,
- "fallback-placements": ["bottom", "top", "right", "left"],
- placement: "bottom",
- effect: "light"
- }, {
- default: withCtx(() => [
- createElementVNode("span", null, toDisplayString(tag.text), 1)
- ]),
- content: withCtx(() => [
- createElementVNode("div", _hoisted_2$l, [
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.allPresentTags, (tag2, idx) => {
- return openBlock(), createElementBlock("div", {
- key: idx,
- class: "el-cascader__collapse-tag"
- }, [
- (openBlock(), createBlock(_component_el_tag, {
- key: tag2.key,
- class: "in-tooltip",
- type: _ctx.tagType,
- size: _ctx.tagSize,
- hit: tag2.hitState,
- closable: tag2.closable,
- "disable-transitions": "",
- onClose: ($event) => _ctx.deleteTag(tag2)
- }, {
- default: withCtx(() => [
- createElementVNode("span", null, toDisplayString(tag2.text), 1)
- ]),
- _: 2
- }, 1032, ["type", "size", "hit", "closable", "onClose"]))
- ]);
- }), 128))
- ])
- ]),
- _: 2
- }, 1032, ["disabled"]))
- ]),
- _: 2
- }, 1032, ["type", "size", "hit", "closable", "onClose"]);
- }), 128)),
- _ctx.filterable && !_ctx.isDisabled ? withDirectives((openBlock(), createElementBlock("input", {
- key: 0,
- "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => _ctx.searchInputValue = $event),
- type: "text",
- class: normalizeClass(_ctx.nsCascader.e("search-input")),
- placeholder: _ctx.presentText ? "" : _ctx.inputPlaceholder,
- onInput: _cache[5] || (_cache[5] = (e) => _ctx.handleInput(_ctx.searchInputValue, e)),
- onClick: _cache[6] || (_cache[6] = withModifiers(($event) => _ctx.togglePopperVisible(true), ["stop"])),
- onKeydown: _cache[7] || (_cache[7] = withKeys((...args) => _ctx.handleDelete && _ctx.handleDelete(...args), ["delete"])),
- onCompositionstart: _cache[8] || (_cache[8] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args)),
- onCompositionupdate: _cache[9] || (_cache[9] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args)),
- onCompositionend: _cache[10] || (_cache[10] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args))
- }, null, 42, _hoisted_3$f)), [
- [vModelText, _ctx.searchInputValue]
- ]) : createCommentVNode("v-if", true)
- ], 2)) : createCommentVNode("v-if", true)
- ], 38)), [
- [_directive_clickoutside, () => _ctx.togglePopperVisible(false), _ctx.popperPaneRef]
- ])
- ]),
- content: withCtx(() => [
- withDirectives(createVNode(_component_el_cascader_panel, {
- ref: "panel",
- modelValue: _ctx.checkedValue,
- "onUpdate:modelValue": _cache[15] || (_cache[15] = ($event) => _ctx.checkedValue = $event),
- options: _ctx.options,
- props: _ctx.props,
- border: false,
- "render-label": _ctx.$slots.default,
- onExpandChange: _ctx.handleExpandChange,
- onClose: _cache[16] || (_cache[16] = ($event) => _ctx.$nextTick(() => _ctx.togglePopperVisible(false)))
- }, null, 8, ["modelValue", "options", "props", "render-label", "onExpandChange"]), [
- [vShow, !_ctx.filtering]
- ]),
- _ctx.filterable ? withDirectives((openBlock(), createBlock(_component_el_scrollbar, {
- key: 0,
- ref: "suggestionPanel",
- tag: "ul",
- class: normalizeClass(_ctx.nsCascader.e("suggestion-panel")),
- "view-class": _ctx.nsCascader.e("suggestion-list"),
- onKeydown: _ctx.handleSuggestionKeyDown
- }, {
- default: withCtx(() => [
- _ctx.suggestions.length ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(_ctx.suggestions, (item) => {
- return openBlock(), createElementBlock("li", {
- key: item.uid,
- class: normalizeClass([
- _ctx.nsCascader.e("suggestion-item"),
- _ctx.nsCascader.is("checked", item.checked)
- ]),
- tabindex: -1,
- onClick: ($event) => _ctx.handleSuggestionClick(item)
- }, [
- createElementVNode("span", null, toDisplayString(item.text), 1),
- item.checked ? (openBlock(), createBlock(_component_el_icon, { key: 0 }, {
- default: withCtx(() => [
- createVNode(_component_check)
- ]),
- _: 1
- })) : createCommentVNode("v-if", true)
- ], 10, _hoisted_4$d);
- }), 128)) : renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [
- createElementVNode("li", {
- class: normalizeClass(_ctx.nsCascader.e("empty-text"))
- }, toDisplayString(_ctx.t("el.cascader.noMatch")), 3)
- ])
- ]),
- _: 3
- }, 8, ["class", "view-class", "onKeydown"])), [
- [vShow, _ctx.filtering]
- ]) : createCommentVNode("v-if", true)
- ]),
- _: 3
- }, 8, ["visible", "teleported", "popper-class", "popper-options", "transition", "onHide"]);
- }
- 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"]]);
- Cascader.install = (app) => {
- app.component(Cascader.name, Cascader);
- };
- const _Cascader = Cascader;
- const ElCascader = _Cascader;
- const messageConfig = {};
- const configProviderProps = buildProps({
- a11y: {
- type: Boolean,
- default: true
- },
- locale: {
- type: definePropType(Object)
- },
- size: {
- type: String,
- values: componentSizes,
- default: ""
- },
- button: {
- type: definePropType(Object)
- },
- experimentalFeatures: {
- type: definePropType(Object)
- },
- keyboardNavigation: {
- type: Boolean,
- default: true
- },
- message: {
- type: definePropType(Object)
- },
- zIndex: {
- type: Number
- },
- namespace: {
- type: String,
- default: "el"
- }
- });
- var ConfigProvider = defineComponent({
- name: "ElConfigProvider",
- props: configProviderProps,
- setup(props, { slots }) {
- watch(() => props.message, (val) => {
- Object.assign(messageConfig, val != null ? val : {});
- }, { immediate: true, deep: true });
- const config = provideGlobalConfig(props);
- return () => renderSlot(slots, "default", { config: config == null ? void 0 : config.value });
- }
- });
- const ElConfigProvider = withInstall(ConfigProvider);
- var advancedFormat$1 = { exports: {} };
- (function(module2, exports2) {
- !function(e, t) {
- module2.exports = t();
- }(commonjsGlobal, function() {
- return function(e, t) {
- var r = t.prototype, n = r.format;
- r.format = function(e2) {
- var t2 = this, r2 = this.$locale();
- if (!this.isValid())
- return n.bind(this)(e2);
- 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) {
- switch (e3) {
- case "Q":
- return Math.ceil((t2.$M + 1) / 3);
- case "Do":
- return r2.ordinal(t2.$D);
- case "gggg":
- return t2.weekYear();
- case "GGGG":
- return t2.isoWeekYear();
- case "wo":
- return r2.ordinal(t2.week(), "W");
- case "w":
- case "ww":
- return s2.s(t2.week(), e3 === "w" ? 1 : 2, "0");
- case "W":
- case "WW":
- return s2.s(t2.isoWeek(), e3 === "W" ? 1 : 2, "0");
- case "k":
- case "kk":
- return s2.s(String(t2.$H === 0 ? 24 : t2.$H), e3 === "k" ? 1 : 2, "0");
- case "X":
- return Math.floor(t2.$d.getTime() / 1e3);
- case "x":
- return t2.$d.getTime();
- case "z":
- return "[" + t2.offsetName() + "]";
- case "zzz":
- return "[" + t2.offsetName("long") + "]";
- default:
- return e3;
- }
- });
- return n.bind(this)(a2);
- };
- };
- });
- })(advancedFormat$1);
- var advancedFormat = advancedFormat$1.exports;
- var weekOfYear$1 = { exports: {} };
- (function(module2, exports2) {
- !function(e, t) {
- module2.exports = t();
- }(commonjsGlobal, function() {
- var e = "week", t = "year";
- return function(i, n, r) {
- var f2 = n.prototype;
- f2.week = function(i2) {
- if (i2 === void 0 && (i2 = null), i2 !== null)
- return this.add(7 * (i2 - this.week()), "day");
- var n2 = this.$locale().yearStart || 1;
- if (this.month() === 11 && this.date() > 25) {
- var f3 = r(this).startOf(t).add(1, t).date(n2), s2 = r(this).endOf(e);
- if (f3.isBefore(s2))
- return 1;
- }
- var a2 = r(this).startOf(t).date(n2).startOf(e).subtract(1, "millisecond"), o2 = this.diff(a2, e, true);
- return o2 < 0 ? r(this).startOf("week").week() : Math.ceil(o2);
- }, f2.weeks = function(e2) {
- return e2 === void 0 && (e2 = null), this.week(e2);
- };
- };
- });
- })(weekOfYear$1);
- var weekOfYear = weekOfYear$1.exports;
- var weekYear$1 = { exports: {} };
- (function(module2, exports2) {
- !function(e, t) {
- module2.exports = t();
- }(commonjsGlobal, function() {
- return function(e, t) {
- t.prototype.weekYear = function() {
- var e2 = this.month(), t2 = this.week(), n = this.year();
- return t2 === 1 && e2 === 11 ? n + 1 : e2 === 0 && t2 >= 52 ? n - 1 : n;
- };
- };
- });
- })(weekYear$1);
- var weekYear = weekYear$1.exports;
- var dayOfYear$1 = { exports: {} };
- (function(module2, exports2) {
- !function(e, t) {
- module2.exports = t();
- }(commonjsGlobal, function() {
- return function(e, t, n) {
- t.prototype.dayOfYear = function(e2) {
- var t2 = Math.round((n(this).startOf("day") - n(this).startOf("year")) / 864e5) + 1;
- return e2 == null ? t2 : this.add(e2 - t2, "day");
- };
- };
- });
- })(dayOfYear$1);
- var dayOfYear = dayOfYear$1.exports;
- var isSameOrAfter$1 = { exports: {} };
- (function(module2, exports2) {
- !function(e, t) {
- module2.exports = t();
- }(commonjsGlobal, function() {
- return function(e, t) {
- t.prototype.isSameOrAfter = function(e2, t2) {
- return this.isSame(e2, t2) || this.isAfter(e2, t2);
- };
- };
- });
- })(isSameOrAfter$1);
- var isSameOrAfter = isSameOrAfter$1.exports;
- var isSameOrBefore$1 = { exports: {} };
- (function(module2, exports2) {
- !function(e, i) {
- module2.exports = i();
- }(commonjsGlobal, function() {
- return function(e, i) {
- i.prototype.isSameOrBefore = function(e2, i2) {
- return this.isSame(e2, i2) || this.isBefore(e2, i2);
- };
- };
- });
- })(isSameOrBefore$1);
- var isSameOrBefore = isSameOrBefore$1.exports;
- const ROOT_PICKER_INJECTION_KEY = Symbol();
- var ElDatePickerCell = defineComponent({
- name: "ElDatePickerCell",
- props: buildProps({
- cell: {
- type: definePropType(Object)
- }
- }),
- setup(props) {
- const picker = inject(ROOT_PICKER_INJECTION_KEY);
- return () => {
- const cell = props.cell;
- if (picker == null ? void 0 : picker.ctx.slots.default) {
- const list = picker.ctx.slots.default(cell).filter((item) => {
- return item.patchFlag !== -2 && item.type.toString() !== "Symbol(Comment)";
- });
- if (list.length) {
- return list;
- }
- }
- return h$1("div", {
- class: "el-date-table-cell"
- }, [
- h$1("span", {
- class: "el-date-table-cell__text"
- }, [cell == null ? void 0 : cell.text])
- ]);
- };
- }
- });
- const _sfc_main$E = defineComponent({
- components: {
- ElDatePickerCell
- },
- props: {
- date: {
- type: Object
- },
- minDate: {
- type: Object
- },
- maxDate: {
- type: Object
- },
- parsedValue: {
- type: [Object, Array]
- },
- selectionMode: {
- type: String,
- default: "day"
- },
- showWeekNumber: {
- type: Boolean,
- default: false
- },
- disabledDate: {
- type: Function
- },
- cellClassName: {
- type: Function
- },
- rangeState: {
- type: Object,
- default: () => ({
- endDate: null,
- selecting: false
- })
- }
- },
- emits: ["changerange", "pick", "select"],
- setup(props, ctx) {
- const { t, lang } = useLocale();
- const lastRow = ref(null);
- const lastColumn = ref(null);
- const tableRows = ref([[], [], [], [], [], []]);
- const firstDayOfWeek = props.date.$locale().weekStart || 7;
- const WEEKS_CONSTANT = props.date.locale("en").localeData().weekdaysShort().map((_2) => _2.toLowerCase());
- const offsetDay = computed(() => {
- return firstDayOfWeek > 3 ? 7 - firstDayOfWeek : -firstDayOfWeek;
- });
- const startDate = computed(() => {
- const startDayOfMonth = props.date.startOf("month");
- return startDayOfMonth.subtract(startDayOfMonth.day() || 7, "day");
- });
- const WEEKS = computed(() => {
- return WEEKS_CONSTANT.concat(WEEKS_CONSTANT).slice(firstDayOfWeek, firstDayOfWeek + 7);
- });
- const rows = computed(() => {
- var _a2;
- const startOfMonth = props.date.startOf("month");
- const startOfMonthDay = startOfMonth.day() || 7;
- const dateCountOfMonth = startOfMonth.daysInMonth();
- const dateCountOfLastMonth = startOfMonth.subtract(1, "month").daysInMonth();
- const offset2 = offsetDay.value;
- const rows_ = tableRows.value;
- let count = 1;
- const selectedDate = props.selectionMode === "dates" ? castArray(props.parsedValue) : [];
- const calNow = dayjs().locale(lang.value).startOf("day");
- for (let i = 0; i < 6; i++) {
- const row = rows_[i];
- if (props.showWeekNumber) {
- if (!row[0]) {
- row[0] = {
- type: "week",
- text: startDate.value.add(i * 7 + 1, "day").week()
- };
- }
- }
- for (let j = 0; j < 7; j++) {
- let cell = row[props.showWeekNumber ? j + 1 : j];
- if (!cell) {
- cell = {
- row: i,
- column: j,
- type: "normal",
- inRange: false,
- start: false,
- end: false
- };
- }
- const index = i * 7 + j;
- const calTime = startDate.value.add(index - offset2, "day");
- cell.dayjs = calTime;
- cell.date = calTime.toDate();
- cell.timestamp = calTime.valueOf();
- cell.type = "normal";
- const calEndDate = props.rangeState.endDate || props.maxDate || props.rangeState.selecting && props.minDate;
- 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");
- if ((_a2 = props.minDate) == null ? void 0 : _a2.isSameOrAfter(calEndDate)) {
- cell.start = calEndDate && calTime.isSame(calEndDate, "day");
- cell.end = props.minDate && calTime.isSame(props.minDate, "day");
- } else {
- cell.start = props.minDate && calTime.isSame(props.minDate, "day");
- cell.end = calEndDate && calTime.isSame(calEndDate, "day");
- }
- const isToday = calTime.isSame(calNow, "day");
- if (isToday) {
- cell.type = "today";
- }
- if (i >= 0 && i <= 1) {
- const numberOfDaysFromPreviousMonth = startOfMonthDay + offset2 < 0 ? 7 + startOfMonthDay + offset2 : startOfMonthDay + offset2;
- if (j + i * 7 >= numberOfDaysFromPreviousMonth) {
- cell.text = count++;
- } else {
- cell.text = dateCountOfLastMonth - (numberOfDaysFromPreviousMonth - j % 7) + 1 + i * 7;
- cell.type = "prev-month";
- }
- } else {
- if (count <= dateCountOfMonth) {
- cell.text = count++;
- } else {
- cell.text = count++ - dateCountOfMonth;
- cell.type = "next-month";
- }
- }
- const cellDate = calTime.toDate();
- cell.selected = selectedDate.find((_2) => _2.valueOf() === calTime.valueOf());
- cell.isSelected = !!cell.selected;
- cell.isCurrent = isCurrent(cell);
- cell.disabled = props.disabledDate && props.disabledDate(cellDate);
- cell.customClass = props.cellClassName && props.cellClassName(cellDate);
- row[props.showWeekNumber ? j + 1 : j] = cell;
- }
- if (props.selectionMode === "week") {
- const start2 = props.showWeekNumber ? 1 : 0;
- const end2 = props.showWeekNumber ? 7 : 6;
- const isActive = isWeekActive(row[start2 + 1]);
- row[start2].inRange = isActive;
- row[start2].start = isActive;
- row[end2].inRange = isActive;
- row[end2].end = isActive;
- }
- }
- return rows_;
- });
- const isCurrent = (cell) => {
- return props.selectionMode === "day" && (cell.type === "normal" || cell.type === "today") && cellMatchesDate(cell, props.parsedValue);
- };
- const cellMatchesDate = (cell, date4) => {
- if (!date4)
- return false;
- return dayjs(date4).locale(lang.value).isSame(props.date.date(Number(cell.text)), "day");
- };
- const getCellClasses = (cell) => {
- const classes = [];
- if ((cell.type === "normal" || cell.type === "today") && !cell.disabled) {
- classes.push("available");
- if (cell.type === "today") {
- classes.push("today");
- }
- } else {
- classes.push(cell.type);
- }
- if (isCurrent(cell)) {
- classes.push("current");
- }
- if (cell.inRange && (cell.type === "normal" || cell.type === "today" || props.selectionMode === "week")) {
- classes.push("in-range");
- if (cell.start) {
- classes.push("start-date");
- }
- if (cell.end) {
- classes.push("end-date");
- }
- }
- if (cell.disabled) {
- classes.push("disabled");
- }
- if (cell.selected) {
- classes.push("selected");
- }
- if (cell.customClass) {
- classes.push(cell.customClass);
- }
- return classes.join(" ");
- };
- const getDateOfCell = (row, column) => {
- const offsetFromStart = row * 7 + (column - (props.showWeekNumber ? 1 : 0)) - offsetDay.value;
- return startDate.value.add(offsetFromStart, "day");
- };
- const handleMouseMove = (event) => {
- if (!props.rangeState.selecting)
- return;
- let target = event.target;
- if (target.tagName === "SPAN") {
- target = target.parentNode.parentNode;
- }
- if (target.tagName === "DIV") {
- target = target.parentNode;
- }
- if (target.tagName !== "TD")
- return;
- const row = target.parentNode.rowIndex - 1;
- const column = target.cellIndex;
- if (rows.value[row][column].disabled)
- return;
- if (row !== lastRow.value || column !== lastColumn.value) {
- lastRow.value = row;
- lastColumn.value = column;
- ctx.emit("changerange", {
- selecting: true,
- endDate: getDateOfCell(row, column)
- });
- }
- };
- const handleClick = (event) => {
- let target = event.target;
- while (target) {
- if (target.tagName === "TD") {
- break;
- }
- target = target.parentNode;
- }
- if (!target || target.tagName !== "TD")
- return;
- const row = target.parentNode.rowIndex - 1;
- const column = target.cellIndex;
- const cell = rows.value[row][column];
- if (cell.disabled || cell.type === "week")
- return;
- const newDate = getDateOfCell(row, column);
- if (props.selectionMode === "range") {
- if (!props.rangeState.selecting) {
- ctx.emit("pick", { minDate: newDate, maxDate: null });
- ctx.emit("select", true);
- } else {
- if (newDate >= props.minDate) {
- ctx.emit("pick", { minDate: props.minDate, maxDate: newDate });
- } else {
- ctx.emit("pick", { minDate: newDate, maxDate: props.minDate });
- }
- ctx.emit("select", false);
- }
- } else if (props.selectionMode === "day") {
- ctx.emit("pick", newDate);
- } else if (props.selectionMode === "week") {
- const weekNumber = newDate.week();
- const value = `${newDate.year()}w${weekNumber}`;
- ctx.emit("pick", {
- year: newDate.year(),
- week: weekNumber,
- value,
- date: newDate.startOf("week")
- });
- } else if (props.selectionMode === "dates") {
- const newValue = cell.selected ? castArray(props.parsedValue).filter((_2) => _2.valueOf() !== newDate.valueOf()) : castArray(props.parsedValue).concat([newDate]);
- ctx.emit("pick", newValue);
- }
- };
- const isWeekActive = (cell) => {
- if (props.selectionMode !== "week")
- return false;
- let newDate = props.date.startOf("day");
- if (cell.type === "prev-month") {
- newDate = newDate.subtract(1, "month");
- }
- if (cell.type === "next-month") {
- newDate = newDate.add(1, "month");
- }
- newDate = newDate.date(Number.parseInt(cell.text, 10));
- if (props.parsedValue && !Array.isArray(props.parsedValue)) {
- const dayOffset = (props.parsedValue.day() - firstDayOfWeek + 7) % 7 - 1;
- const weekDate = props.parsedValue.subtract(dayOffset, "day");
- return weekDate.isSame(newDate, "day");
- }
- return false;
- };
- return {
- handleMouseMove,
- t,
- rows,
- isWeekActive,
- getCellClasses,
- WEEKS,
- handleClick
- };
- }
- });
- const _hoisted_1$r = { key: 0 };
- function _sfc_render$j(_ctx, _cache, $props, $setup, $data, $options) {
- const _component_el_date_picker_cell = resolveComponent("el-date-picker-cell");
- return openBlock(), createElementBlock("table", {
- cellspacing: "0",
- cellpadding: "0",
- class: normalizeClass(["el-date-table", { "is-week-mode": _ctx.selectionMode === "week" }]),
- onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleClick && _ctx.handleClick(...args)),
- onMousemove: _cache[1] || (_cache[1] = (...args) => _ctx.handleMouseMove && _ctx.handleMouseMove(...args))
- }, [
- createElementVNode("tbody", null, [
- createElementVNode("tr", null, [
- _ctx.showWeekNumber ? (openBlock(), createElementBlock("th", _hoisted_1$r, toDisplayString(_ctx.t("el.datepicker.week")), 1)) : createCommentVNode("v-if", true),
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.WEEKS, (week, key) => {
- return openBlock(), createElementBlock("th", { key }, toDisplayString(_ctx.t("el.datepicker.weeks." + week)), 1);
- }), 128))
- ]),
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.rows, (row, key) => {
- return openBlock(), createElementBlock("tr", {
- key,
- class: normalizeClass(["el-date-table__row", { current: _ctx.isWeekActive(row[1]) }])
- }, [
- (openBlock(true), createElementBlock(Fragment, null, renderList(row, (cell, key_) => {
- return openBlock(), createElementBlock("td", {
- key: key_,
- class: normalizeClass(_ctx.getCellClasses(cell))
- }, [
- createVNode(_component_el_date_picker_cell, { cell }, null, 8, ["cell"])
- ], 2);
- }), 128))
- ], 2);
- }), 128))
- ])
- ], 34);
- }
- 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"]]);
- const datesInMonth = (year, month, lang) => {
- const firstDay = dayjs().locale(lang).startOf("month").month(month).year(year);
- const numOfDays = firstDay.daysInMonth();
- return rangeArr(numOfDays).map((n) => firstDay.add(n, "day").toDate());
- };
- const _sfc_main$D = defineComponent({
- props: {
- disabledDate: {
- type: Function
- },
- selectionMode: {
- type: String,
- default: "month"
- },
- minDate: {
- type: Object
- },
- maxDate: {
- type: Object
- },
- date: {
- type: Object
- },
- parsedValue: {
- type: Object
- },
- rangeState: {
- type: Object,
- default: () => ({
- endDate: null,
- selecting: false
- })
- }
- },
- emits: ["changerange", "pick", "select"],
- setup(props, ctx) {
- const { t, lang } = useLocale();
- const months = ref(props.date.locale("en").localeData().monthsShort().map((_2) => _2.toLowerCase()));
- const tableRows = ref([[], [], []]);
- const lastRow = ref(null);
- const lastColumn = ref(null);
- const rows = computed(() => {
- var _a2;
- const rows2 = tableRows.value;
- const now2 = dayjs().locale(lang.value).startOf("month");
- for (let i = 0; i < 3; i++) {
- const row = rows2[i];
- for (let j = 0; j < 4; j++) {
- let cell = row[j];
- if (!cell) {
- cell = {
- row: i,
- column: j,
- type: "normal",
- inRange: false,
- start: false,
- end: false
- };
- }
- cell.type = "normal";
- const index = i * 4 + j;
- const calTime = props.date.startOf("year").month(index);
- const calEndDate = props.rangeState.endDate || props.maxDate || props.rangeState.selecting && props.minDate;
- 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");
- if ((_a2 = props.minDate) == null ? void 0 : _a2.isSameOrAfter(calEndDate)) {
- cell.start = calEndDate && calTime.isSame(calEndDate, "month");
- cell.end = props.minDate && calTime.isSame(props.minDate, "month");
- } else {
- cell.start = props.minDate && calTime.isSame(props.minDate, "month");
- cell.end = calEndDate && calTime.isSame(calEndDate, "month");
- }
- const isToday = now2.isSame(calTime);
- if (isToday) {
- cell.type = "today";
- }
- cell.text = index;
- const cellDate = calTime.toDate();
- cell.disabled = props.disabledDate && props.disabledDate(cellDate);
- row[j] = cell;
- }
- }
- return rows2;
- });
- const getCellStyle = (cell) => {
- const style = {};
- const year = props.date.year();
- const today = new Date();
- const month = cell.text;
- style.disabled = props.disabledDate ? datesInMonth(year, month, lang.value).every(props.disabledDate) : false;
- style.current = castArray(props.parsedValue).findIndex((date4) => date4.year() === year && date4.month() === month) >= 0;
- style.today = today.getFullYear() === year && today.getMonth() === month;
- if (cell.inRange) {
- style["in-range"] = true;
- if (cell.start) {
- style["start-date"] = true;
- }
- if (cell.end) {
- style["end-date"] = true;
- }
- }
- return style;
- };
- const handleMouseMove = (event) => {
- if (!props.rangeState.selecting)
- return;
- let target = event.target;
- if (target.tagName === "A") {
- target = target.parentNode.parentNode;
- }
- if (target.tagName === "DIV") {
- target = target.parentNode;
- }
- if (target.tagName !== "TD")
- return;
- const row = target.parentNode.rowIndex;
- const column = target.cellIndex;
- if (rows.value[row][column].disabled)
- return;
- if (row !== lastRow.value || column !== lastColumn.value) {
- lastRow.value = row;
- lastColumn.value = column;
- ctx.emit("changerange", {
- selecting: true,
- endDate: props.date.startOf("year").month(row * 4 + column)
- });
- }
- };
- const handleMonthTableClick = (event) => {
- let target = event.target;
- if (target.tagName === "A") {
- target = target.parentNode.parentNode;
- }
- if (target.tagName === "DIV") {
- target = target.parentNode;
- }
- if (target.tagName !== "TD")
- return;
- if (hasClass(target, "disabled"))
- return;
- const column = target.cellIndex;
- const row = target.parentNode.rowIndex;
- const month = row * 4 + column;
- const newDate = props.date.startOf("year").month(month);
- if (props.selectionMode === "range") {
- if (!props.rangeState.selecting) {
- ctx.emit("pick", { minDate: newDate, maxDate: null });
- ctx.emit("select", true);
- } else {
- if (newDate >= props.minDate) {
- ctx.emit("pick", { minDate: props.minDate, maxDate: newDate });
- } else {
- ctx.emit("pick", { minDate: newDate, maxDate: props.minDate });
- }
- ctx.emit("select", false);
- }
- } else {
- ctx.emit("pick", month);
- }
- };
- return {
- handleMouseMove,
- handleMonthTableClick,
- rows,
- getCellStyle,
- t,
- months
- };
- }
- });
- const _hoisted_1$q = { class: "cell" };
- function _sfc_render$i(_ctx, _cache, $props, $setup, $data, $options) {
- return openBlock(), createElementBlock("table", {
- class: "el-month-table",
- onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleMonthTableClick && _ctx.handleMonthTableClick(...args)),
- onMousemove: _cache[1] || (_cache[1] = (...args) => _ctx.handleMouseMove && _ctx.handleMouseMove(...args))
- }, [
- createElementVNode("tbody", null, [
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.rows, (row, key) => {
- return openBlock(), createElementBlock("tr", { key }, [
- (openBlock(true), createElementBlock(Fragment, null, renderList(row, (cell, key_) => {
- return openBlock(), createElementBlock("td", {
- key: key_,
- class: normalizeClass(_ctx.getCellStyle(cell))
- }, [
- createElementVNode("div", null, [
- createElementVNode("a", _hoisted_1$q, toDisplayString(_ctx.t("el.datepicker.months." + _ctx.months[cell.text])), 1)
- ])
- ], 2);
- }), 128))
- ]);
- }), 128))
- ])
- ], 32);
- }
- 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"]]);
- const datesInYear = (year, lang) => {
- const firstDay = dayjs(String(year)).locale(lang).startOf("year");
- const lastDay = firstDay.endOf("year");
- const numOfDays = lastDay.dayOfYear();
- return rangeArr(numOfDays).map((n) => firstDay.add(n, "day").toDate());
- };
- const _sfc_main$C = defineComponent({
- props: {
- disabledDate: {
- type: Function
- },
- parsedValue: {
- type: Object
- },
- date: {
- type: Object
- }
- },
- emits: ["pick"],
- setup(props, ctx) {
- const { lang } = useLocale();
- const startYear = computed(() => {
- return Math.floor(props.date.year() / 10) * 10;
- });
- const getCellStyle = (year) => {
- const style = {};
- const today = dayjs().locale(lang.value);
- style.disabled = props.disabledDate ? datesInYear(year, lang.value).every(props.disabledDate) : false;
- style.current = castArray(props.parsedValue).findIndex((_2) => _2.year() === year) >= 0;
- style.today = today.year() === year;
- return style;
- };
- const handleYearTableClick = (event) => {
- const target = event.target;
- if (target.tagName === "A") {
- if (hasClass(target.parentNode, "disabled"))
- return;
- const year = target.textContent || target.innerText;
- ctx.emit("pick", Number(year));
- }
- };
- return {
- startYear,
- getCellStyle,
- handleYearTableClick
- };
- }
- });
- const _hoisted_1$p = { class: "cell" };
- const _hoisted_2$k = { class: "cell" };
- const _hoisted_3$e = { class: "cell" };
- const _hoisted_4$c = { class: "cell" };
- const _hoisted_5$c = { class: "cell" };
- const _hoisted_6$a = { class: "cell" };
- const _hoisted_7$6 = { class: "cell" };
- const _hoisted_8$5 = { class: "cell" };
- const _hoisted_9$5 = { class: "cell" };
- const _hoisted_10$5 = { class: "cell" };
- const _hoisted_11$4 = /* @__PURE__ */ createElementVNode("td", null, null, -1);
- const _hoisted_12$4 = /* @__PURE__ */ createElementVNode("td", null, null, -1);
- function _sfc_render$h(_ctx, _cache, $props, $setup, $data, $options) {
- return openBlock(), createElementBlock("table", {
- class: "el-year-table",
- onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleYearTableClick && _ctx.handleYearTableClick(...args))
- }, [
- createElementVNode("tbody", null, [
- createElementVNode("tr", null, [
- createElementVNode("td", {
- class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 0)])
- }, [
- createElementVNode("a", _hoisted_1$p, toDisplayString(_ctx.startYear), 1)
- ], 2),
- createElementVNode("td", {
- class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 1)])
- }, [
- createElementVNode("a", _hoisted_2$k, toDisplayString(_ctx.startYear + 1), 1)
- ], 2),
- createElementVNode("td", {
- class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 2)])
- }, [
- createElementVNode("a", _hoisted_3$e, toDisplayString(_ctx.startYear + 2), 1)
- ], 2),
- createElementVNode("td", {
- class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 3)])
- }, [
- createElementVNode("a", _hoisted_4$c, toDisplayString(_ctx.startYear + 3), 1)
- ], 2)
- ]),
- createElementVNode("tr", null, [
- createElementVNode("td", {
- class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 4)])
- }, [
- createElementVNode("a", _hoisted_5$c, toDisplayString(_ctx.startYear + 4), 1)
- ], 2),
- createElementVNode("td", {
- class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 5)])
- }, [
- createElementVNode("a", _hoisted_6$a, toDisplayString(_ctx.startYear + 5), 1)
- ], 2),
- createElementVNode("td", {
- class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 6)])
- }, [
- createElementVNode("a", _hoisted_7$6, toDisplayString(_ctx.startYear + 6), 1)
- ], 2),
- createElementVNode("td", {
- class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 7)])
- }, [
- createElementVNode("a", _hoisted_8$5, toDisplayString(_ctx.startYear + 7), 1)
- ], 2)
- ]),
- createElementVNode("tr", null, [
- createElementVNode("td", {
- class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 8)])
- }, [
- createElementVNode("a", _hoisted_9$5, toDisplayString(_ctx.startYear + 8), 1)
- ], 2),
- createElementVNode("td", {
- class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 9)])
- }, [
- createElementVNode("a", _hoisted_10$5, toDisplayString(_ctx.startYear + 9), 1)
- ], 2),
- _hoisted_11$4,
- _hoisted_12$4
- ])
- ])
- ]);
- }
- 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"]]);
- const timeWithinRange = (_2, __, ___) => true;
- const _sfc_main$B = defineComponent({
- components: {
- DateTable,
- ElInput,
- ElButton,
- ElIcon,
- TimePickPanel,
- MonthTable,
- YearTable,
- DArrowLeft: dArrowLeft,
- ArrowLeft: arrowLeft,
- DArrowRight: dArrowRight,
- ArrowRight: arrowRight
- },
- directives: { clickoutside: ClickOutside },
- props: {
- visible: {
- type: Boolean,
- default: false
- },
- parsedValue: {
- type: [Object, Array]
- },
- format: {
- type: String,
- default: ""
- },
- type: {
- type: String,
- required: true,
- validator: isValidDatePickType
- }
- },
- emits: ["pick", "set-picker-option", "panel-change"],
- setup(props, ctx) {
- const { t, lang } = useLocale();
- const pickerBase = inject("EP_PICKER_BASE");
- const popper2 = inject(TOOLTIP_INJECTION_KEY);
- const {
- shortcuts,
- disabledDate,
- cellClassName,
- defaultTime,
- arrowControl
- } = pickerBase.props;
- const defaultValue = toRef(pickerBase.props, "defaultValue");
- const innerDate = ref(dayjs().locale(lang.value));
- const defaultTimeD = computed(() => {
- return dayjs(defaultTime).locale(lang.value);
- });
- const month = computed(() => {
- return innerDate.value.month();
- });
- const year = computed(() => {
- return innerDate.value.year();
- });
- const selectableRange = ref([]);
- const userInputDate = ref(null);
- const userInputTime = ref(null);
- const checkDateWithinRange = (date4) => {
- return selectableRange.value.length > 0 ? timeWithinRange(date4, selectableRange.value, props.format || "HH:mm:ss") : true;
- };
- const formatEmit = (emitDayjs) => {
- if (defaultTime && !visibleTime.value) {
- return defaultTimeD.value.year(emitDayjs.year()).month(emitDayjs.month()).date(emitDayjs.date());
- }
- if (showTime.value)
- return emitDayjs.millisecond(0);
- return emitDayjs.startOf("day");
- };
- const emit = (value, ...args) => {
- if (!value) {
- ctx.emit("pick", value, ...args);
- } else if (Array.isArray(value)) {
- const dates = value.map(formatEmit);
- ctx.emit("pick", dates, ...args);
- } else {
- ctx.emit("pick", formatEmit(value), ...args);
- }
- userInputDate.value = null;
- userInputTime.value = null;
- };
- const handleDatePick = (value) => {
- if (selectionMode.value === "day") {
- let newDate = props.parsedValue ? props.parsedValue.year(value.year()).month(value.month()).date(value.date()) : value;
- if (!checkDateWithinRange(newDate)) {
- newDate = selectableRange.value[0][0].year(value.year()).month(value.month()).date(value.date());
- }
- innerDate.value = newDate;
- emit(newDate, showTime.value);
- } else if (selectionMode.value === "week") {
- emit(value.date);
- } else if (selectionMode.value === "dates") {
- emit(value, true);
- }
- };
- const prevMonth_ = () => {
- innerDate.value = innerDate.value.subtract(1, "month");
- handlePanelChange("month");
- };
- const nextMonth_ = () => {
- innerDate.value = innerDate.value.add(1, "month");
- handlePanelChange("month");
- };
- const prevYear_ = () => {
- if (currentView.value === "year") {
- innerDate.value = innerDate.value.subtract(10, "year");
- } else {
- innerDate.value = innerDate.value.subtract(1, "year");
- }
- handlePanelChange("year");
- };
- const nextYear_ = () => {
- if (currentView.value === "year") {
- innerDate.value = innerDate.value.add(10, "year");
- } else {
- innerDate.value = innerDate.value.add(1, "year");
- }
- handlePanelChange("year");
- };
- const currentView = ref("date");
- const yearLabel = computed(() => {
- const yearTranslation = t("el.datepicker.year");
- if (currentView.value === "year") {
- const startYear = Math.floor(year.value / 10) * 10;
- if (yearTranslation) {
- return `${startYear} ${yearTranslation} - ${startYear + 9} ${yearTranslation}`;
- }
- return `${startYear} - ${startYear + 9}`;
- }
- return `${year.value} ${yearTranslation}`;
- });
- const handleShortcutClick = (shortcut) => {
- const shortcutValue = typeof shortcut.value === "function" ? shortcut.value() : shortcut.value;
- if (shortcutValue) {
- emit(dayjs(shortcutValue).locale(lang.value));
- return;
- }
- if (shortcut.onClick) {
- shortcut.onClick(ctx);
- }
- };
- const selectionMode = computed(() => {
- if (["week", "month", "year", "dates"].includes(props.type)) {
- return props.type;
- }
- return "day";
- });
- watch(() => selectionMode.value, (val) => {
- if (["month", "year"].includes(val)) {
- currentView.value = val;
- return;
- }
- currentView.value = "date";
- }, { immediate: true });
- watch(() => currentView.value, () => {
- popper2 == null ? void 0 : popper2.updatePopper();
- });
- const hasShortcuts = computed(() => !!shortcuts.length);
- const handleMonthPick = (month2) => {
- innerDate.value = innerDate.value.startOf("month").month(month2);
- if (selectionMode.value === "month") {
- emit(innerDate.value);
- } else {
- currentView.value = "date";
- }
- handlePanelChange("month");
- };
- const handleYearPick = (year2) => {
- if (selectionMode.value === "year") {
- innerDate.value = innerDate.value.startOf("year").year(year2);
- emit(innerDate.value);
- } else {
- innerDate.value = innerDate.value.year(year2);
- currentView.value = "month";
- }
- handlePanelChange("year");
- };
- const showMonthPicker = () => {
- currentView.value = "month";
- };
- const showYearPicker = () => {
- currentView.value = "year";
- };
- const showTime = computed(() => props.type === "datetime" || props.type === "datetimerange");
- const footerVisible = computed(() => {
- return showTime.value || selectionMode.value === "dates";
- });
- const onConfirm = () => {
- if (selectionMode.value === "dates") {
- emit(props.parsedValue);
- } else {
- let result = props.parsedValue;
- if (!result) {
- const defaultTimeD2 = dayjs(defaultTime).locale(lang.value);
- const defaultValueD = getDefaultValue();
- result = defaultTimeD2.year(defaultValueD.year()).month(defaultValueD.month()).date(defaultValueD.date());
- }
- innerDate.value = result;
- emit(result);
- }
- };
- const changeToNow = () => {
- const now2 = dayjs().locale(lang.value);
- const nowDate = now2.toDate();
- if ((!disabledDate || !disabledDate(nowDate)) && checkDateWithinRange(nowDate)) {
- innerDate.value = dayjs().locale(lang.value);
- emit(innerDate.value);
- }
- };
- const timeFormat = computed(() => {
- return extractTimeFormat(props.format);
- });
- const dateFormat = computed(() => {
- return extractDateFormat(props.format);
- });
- const visibleTime = computed(() => {
- if (userInputTime.value)
- return userInputTime.value;
- if (!props.parsedValue && !defaultValue.value)
- return;
- return (props.parsedValue || innerDate.value).format(timeFormat.value);
- });
- const visibleDate = computed(() => {
- if (userInputDate.value)
- return userInputDate.value;
- if (!props.parsedValue && !defaultValue.value)
- return;
- return (props.parsedValue || innerDate.value).format(dateFormat.value);
- });
- const timePickerVisible = ref(false);
- const onTimePickerInputFocus = () => {
- timePickerVisible.value = true;
- };
- const handleTimePickClose = () => {
- timePickerVisible.value = false;
- };
- const handleTimePick = (value, visible, first) => {
- const newDate = props.parsedValue ? props.parsedValue.hour(value.hour()).minute(value.minute()).second(value.second()) : value;
- innerDate.value = newDate;
- emit(innerDate.value, true);
- if (!first) {
- timePickerVisible.value = visible;
- }
- };
- const handleVisibleTimeChange = (value) => {
- const newDate = dayjs(value, timeFormat.value).locale(lang.value);
- if (newDate.isValid() && checkDateWithinRange(newDate)) {
- innerDate.value = newDate.year(innerDate.value.year()).month(innerDate.value.month()).date(innerDate.value.date());
- userInputTime.value = null;
- timePickerVisible.value = false;
- emit(innerDate.value, true);
- }
- };
- const handleVisibleDateChange = (value) => {
- const newDate = dayjs(value, dateFormat.value).locale(lang.value);
- if (newDate.isValid()) {
- if (disabledDate && disabledDate(newDate.toDate())) {
- return;
- }
- innerDate.value = newDate.hour(innerDate.value.hour()).minute(innerDate.value.minute()).second(innerDate.value.second());
- userInputDate.value = null;
- emit(innerDate.value, true);
- }
- };
- const isValidValue = (date4) => {
- return dayjs.isDayjs(date4) && date4.isValid() && (disabledDate ? !disabledDate(date4.toDate()) : true);
- };
- const formatToString = (value) => {
- if (selectionMode.value === "dates") {
- return value.map((_2) => _2.format(props.format));
- }
- return value.format(props.format);
- };
- const parseUserInput = (value) => {
- return dayjs(value, props.format).locale(lang.value);
- };
- const getDefaultValue = () => {
- const parseDate = dayjs(defaultValue.value).locale(lang.value);
- if (!defaultValue.value) {
- const defaultTimeDValue = defaultTimeD.value;
- return dayjs().hour(defaultTimeDValue.hour()).minute(defaultTimeDValue.minute()).second(defaultTimeDValue.second()).locale(lang.value);
- }
- return parseDate;
- };
- const handleKeydown = (event) => {
- const { code, keyCode } = event;
- const list = [
- EVENT_CODE.up,
- EVENT_CODE.down,
- EVENT_CODE.left,
- EVENT_CODE.right
- ];
- if (props.visible && !timePickerVisible.value) {
- if (list.includes(code)) {
- handleKeyControl(keyCode);
- event.stopPropagation();
- event.preventDefault();
- }
- if (code === EVENT_CODE.enter && userInputDate.value === null && userInputTime.value === null) {
- emit(innerDate, false);
- }
- }
- };
- const handleKeyControl = (keyCode) => {
- const mapping = {
- year: {
- 38: -4,
- 40: 4,
- 37: -1,
- 39: 1,
- offset: (date4, step) => date4.setFullYear(date4.getFullYear() + step)
- },
- month: {
- 38: -4,
- 40: 4,
- 37: -1,
- 39: 1,
- offset: (date4, step) => date4.setMonth(date4.getMonth() + step)
- },
- week: {
- 38: -1,
- 40: 1,
- 37: -1,
- 39: 1,
- offset: (date4, step) => date4.setDate(date4.getDate() + step * 7)
- },
- day: {
- 38: -7,
- 40: 7,
- 37: -1,
- 39: 1,
- offset: (date4, step) => date4.setDate(date4.getDate() + step)
- }
- };
- const newDate = innerDate.value.toDate();
- while (Math.abs(innerDate.value.diff(newDate, "year", true)) < 1) {
- const map = mapping[selectionMode.value];
- map.offset(newDate, map[keyCode]);
- if (disabledDate && disabledDate(newDate)) {
- continue;
- }
- const result = dayjs(newDate).locale(lang.value);
- innerDate.value = result;
- ctx.emit("pick", result, true);
- break;
- }
- };
- const handlePanelChange = (mode) => {
- ctx.emit("panel-change", innerDate.value.toDate(), mode, currentView.value);
- };
- ctx.emit("set-picker-option", ["isValidValue", isValidValue]);
- ctx.emit("set-picker-option", ["formatToString", formatToString]);
- ctx.emit("set-picker-option", ["parseUserInput", parseUserInput]);
- ctx.emit("set-picker-option", ["handleKeydown", handleKeydown]);
- watch(() => defaultValue.value, (val) => {
- if (val) {
- innerDate.value = getDefaultValue();
- }
- }, { immediate: true });
- watch(() => props.parsedValue, (val) => {
- if (val) {
- if (selectionMode.value === "dates")
- return;
- if (Array.isArray(val))
- return;
- innerDate.value = val;
- } else {
- innerDate.value = getDefaultValue();
- }
- }, { immediate: true });
- return {
- handleTimePick,
- handleTimePickClose,
- onTimePickerInputFocus,
- timePickerVisible,
- visibleTime,
- visibleDate,
- showTime,
- changeToNow,
- onConfirm,
- footerVisible,
- handleYearPick,
- showMonthPicker,
- showYearPicker,
- handleMonthPick,
- hasShortcuts,
- shortcuts,
- arrowControl,
- disabledDate,
- cellClassName,
- selectionMode,
- handleShortcutClick,
- prevYear_,
- nextYear_,
- prevMonth_,
- nextMonth_,
- innerDate,
- t,
- yearLabel,
- currentView,
- month,
- handleDatePick,
- handleVisibleTimeChange,
- handleVisibleDateChange,
- timeFormat,
- userInputTime,
- userInputDate
- };
- }
- });
- const _hoisted_1$o = { class: "el-picker-panel__body-wrapper" };
- const _hoisted_2$j = {
- key: 0,
- class: "el-picker-panel__sidebar"
- };
- const _hoisted_3$d = ["onClick"];
- const _hoisted_4$b = { class: "el-picker-panel__body" };
- const _hoisted_5$b = {
- key: 0,
- class: "el-date-picker__time-header"
- };
- const _hoisted_6$9 = { class: "el-date-picker__editor-wrap" };
- const _hoisted_7$5 = { class: "el-date-picker__editor-wrap" };
- const _hoisted_8$4 = ["aria-label"];
- const _hoisted_9$4 = ["aria-label"];
- const _hoisted_10$4 = ["aria-label"];
- const _hoisted_11$3 = ["aria-label"];
- const _hoisted_12$3 = { class: "el-picker-panel__content" };
- const _hoisted_13$3 = { class: "el-picker-panel__footer" };
- function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) {
- const _component_el_input = resolveComponent("el-input");
- const _component_time_pick_panel = resolveComponent("time-pick-panel");
- const _component_d_arrow_left = resolveComponent("d-arrow-left");
- const _component_el_icon = resolveComponent("el-icon");
- const _component_arrow_left = resolveComponent("arrow-left");
- const _component_d_arrow_right = resolveComponent("d-arrow-right");
- const _component_arrow_right = resolveComponent("arrow-right");
- const _component_date_table = resolveComponent("date-table");
- const _component_year_table = resolveComponent("year-table");
- const _component_month_table = resolveComponent("month-table");
- const _component_el_button = resolveComponent("el-button");
- const _directive_clickoutside = resolveDirective("clickoutside");
- return openBlock(), createElementBlock("div", {
- class: normalizeClass(["el-picker-panel el-date-picker", [
- {
- "has-sidebar": _ctx.$slots.sidebar || _ctx.hasShortcuts,
- "has-time": _ctx.showTime
- }
- ]])
- }, [
- createElementVNode("div", _hoisted_1$o, [
- renderSlot(_ctx.$slots, "sidebar", { class: "el-picker-panel__sidebar" }),
- _ctx.hasShortcuts ? (openBlock(), createElementBlock("div", _hoisted_2$j, [
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.shortcuts, (shortcut, key) => {
- return openBlock(), createElementBlock("button", {
- key,
- type: "button",
- class: "el-picker-panel__shortcut",
- onClick: ($event) => _ctx.handleShortcutClick(shortcut)
- }, toDisplayString(shortcut.text), 9, _hoisted_3$d);
- }), 128))
- ])) : createCommentVNode("v-if", true),
- createElementVNode("div", _hoisted_4$b, [
- _ctx.showTime ? (openBlock(), createElementBlock("div", _hoisted_5$b, [
- createElementVNode("span", _hoisted_6$9, [
- createVNode(_component_el_input, {
- placeholder: _ctx.t("el.datepicker.selectDate"),
- "model-value": _ctx.visibleDate,
- size: "small",
- onInput: _cache[0] || (_cache[0] = (val) => _ctx.userInputDate = val),
- onChange: _ctx.handleVisibleDateChange
- }, null, 8, ["placeholder", "model-value", "onChange"])
- ]),
- withDirectives((openBlock(), createElementBlock("span", _hoisted_7$5, [
- createVNode(_component_el_input, {
- placeholder: _ctx.t("el.datepicker.selectTime"),
- "model-value": _ctx.visibleTime,
- size: "small",
- onFocus: _ctx.onTimePickerInputFocus,
- onInput: _cache[1] || (_cache[1] = (val) => _ctx.userInputTime = val),
- onChange: _ctx.handleVisibleTimeChange
- }, null, 8, ["placeholder", "model-value", "onFocus", "onChange"]),
- createVNode(_component_time_pick_panel, {
- visible: _ctx.timePickerVisible,
- format: _ctx.timeFormat,
- "time-arrow-control": _ctx.arrowControl,
- "parsed-value": _ctx.innerDate,
- onPick: _ctx.handleTimePick
- }, null, 8, ["visible", "format", "time-arrow-control", "parsed-value", "onPick"])
- ])), [
- [_directive_clickoutside, _ctx.handleTimePickClose]
- ])
- ])) : createCommentVNode("v-if", true),
- withDirectives(createElementVNode("div", {
- class: normalizeClass(["el-date-picker__header", {
- "el-date-picker__header--bordered": _ctx.currentView === "year" || _ctx.currentView === "month"
- }])
- }, [
- createElementVNode("button", {
- type: "button",
- "aria-label": _ctx.t(`el.datepicker.prevYear`),
- class: "el-picker-panel__icon-btn el-date-picker__prev-btn d-arrow-left",
- onClick: _cache[2] || (_cache[2] = (...args) => _ctx.prevYear_ && _ctx.prevYear_(...args))
- }, [
- createVNode(_component_el_icon, null, {
- default: withCtx(() => [
- createVNode(_component_d_arrow_left)
- ]),
- _: 1
- })
- ], 8, _hoisted_8$4),
- withDirectives(createElementVNode("button", {
- type: "button",
- "aria-label": _ctx.t(`el.datepicker.prevMonth`),
- class: "el-picker-panel__icon-btn el-date-picker__prev-btn arrow-left",
- onClick: _cache[3] || (_cache[3] = (...args) => _ctx.prevMonth_ && _ctx.prevMonth_(...args))
- }, [
- createVNode(_component_el_icon, null, {
- default: withCtx(() => [
- createVNode(_component_arrow_left)
- ]),
- _: 1
- })
- ], 8, _hoisted_9$4), [
- [vShow, _ctx.currentView === "date"]
- ]),
- createElementVNode("span", {
- role: "button",
- class: "el-date-picker__header-label",
- onClick: _cache[4] || (_cache[4] = (...args) => _ctx.showYearPicker && _ctx.showYearPicker(...args))
- }, toDisplayString(_ctx.yearLabel), 1),
- withDirectives(createElementVNode("span", {
- role: "button",
- class: normalizeClass(["el-date-picker__header-label", { active: _ctx.currentView === "month" }]),
- onClick: _cache[5] || (_cache[5] = (...args) => _ctx.showMonthPicker && _ctx.showMonthPicker(...args))
- }, toDisplayString(_ctx.t(`el.datepicker.month${_ctx.month + 1}`)), 3), [
- [vShow, _ctx.currentView === "date"]
- ]),
- createElementVNode("button", {
- type: "button",
- "aria-label": _ctx.t(`el.datepicker.nextYear`),
- class: "el-picker-panel__icon-btn el-date-picker__next-btn d-arrow-right",
- onClick: _cache[6] || (_cache[6] = (...args) => _ctx.nextYear_ && _ctx.nextYear_(...args))
- }, [
- createVNode(_component_el_icon, null, {
- default: withCtx(() => [
- createVNode(_component_d_arrow_right)
- ]),
- _: 1
- })
- ], 8, _hoisted_10$4),
- withDirectives(createElementVNode("button", {
- type: "button",
- "aria-label": _ctx.t(`el.datepicker.nextMonth`),
- class: "el-picker-panel__icon-btn el-date-picker__next-btn arrow-right",
- onClick: _cache[7] || (_cache[7] = (...args) => _ctx.nextMonth_ && _ctx.nextMonth_(...args))
- }, [
- createVNode(_component_el_icon, null, {
- default: withCtx(() => [
- createVNode(_component_arrow_right)
- ]),
- _: 1
- })
- ], 8, _hoisted_11$3), [
- [vShow, _ctx.currentView === "date"]
- ])
- ], 2), [
- [vShow, _ctx.currentView !== "time"]
- ]),
- createElementVNode("div", _hoisted_12$3, [
- _ctx.currentView === "date" ? (openBlock(), createBlock(_component_date_table, {
- key: 0,
- "selection-mode": _ctx.selectionMode,
- date: _ctx.innerDate,
- "parsed-value": _ctx.parsedValue,
- "disabled-date": _ctx.disabledDate,
- "cell-class-name": _ctx.cellClassName,
- onPick: _ctx.handleDatePick
- }, null, 8, ["selection-mode", "date", "parsed-value", "disabled-date", "cell-class-name", "onPick"])) : createCommentVNode("v-if", true),
- _ctx.currentView === "year" ? (openBlock(), createBlock(_component_year_table, {
- key: 1,
- date: _ctx.innerDate,
- "disabled-date": _ctx.disabledDate,
- "parsed-value": _ctx.parsedValue,
- onPick: _ctx.handleYearPick
- }, null, 8, ["date", "disabled-date", "parsed-value", "onPick"])) : createCommentVNode("v-if", true),
- _ctx.currentView === "month" ? (openBlock(), createBlock(_component_month_table, {
- key: 2,
- date: _ctx.innerDate,
- "parsed-value": _ctx.parsedValue,
- "disabled-date": _ctx.disabledDate,
- onPick: _ctx.handleMonthPick
- }, null, 8, ["date", "parsed-value", "disabled-date", "onPick"])) : createCommentVNode("v-if", true)
- ])
- ])
- ]),
- withDirectives(createElementVNode("div", _hoisted_13$3, [
- withDirectives(createVNode(_component_el_button, {
- size: "small",
- type: "text",
- class: "el-picker-panel__link-btn",
- onClick: _ctx.changeToNow
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(_ctx.t("el.datepicker.now")), 1)
- ]),
- _: 1
- }, 8, ["onClick"]), [
- [vShow, _ctx.selectionMode !== "dates"]
- ]),
- createVNode(_component_el_button, {
- plain: "",
- size: "small",
- class: "el-picker-panel__link-btn",
- onClick: _ctx.onConfirm
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(_ctx.t("el.datepicker.confirm")), 1)
- ]),
- _: 1
- }, 8, ["onClick"])
- ], 512), [
- [vShow, _ctx.footerVisible && _ctx.currentView === "date"]
- ])
- ], 2);
- }
- 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"]]);
- const _sfc_main$A = defineComponent({
- directives: { clickoutside: ClickOutside },
- components: {
- TimePickPanel,
- DateTable,
- ElInput,
- ElButton,
- ElIcon,
- DArrowLeft: dArrowLeft,
- ArrowLeft: arrowLeft,
- DArrowRight: dArrowRight,
- ArrowRight: arrowRight
- },
- props: {
- unlinkPanels: Boolean,
- parsedValue: {
- type: Array
- },
- type: {
- type: String,
- required: true,
- validator: isValidDatePickType
- }
- },
- emits: ["pick", "set-picker-option", "calendar-change", "panel-change"],
- setup(props, ctx) {
- const { t, lang } = useLocale();
- const leftDate = ref(dayjs().locale(lang.value));
- const rightDate = ref(dayjs().locale(lang.value).add(1, "month"));
- const minDate = ref(null);
- const maxDate = ref(null);
- const dateUserInput = ref({
- min: null,
- max: null
- });
- const timeUserInput = ref({
- min: null,
- max: null
- });
- const leftLabel = computed(() => {
- return `${leftDate.value.year()} ${t("el.datepicker.year")} ${t(`el.datepicker.month${leftDate.value.month() + 1}`)}`;
- });
- const rightLabel = computed(() => {
- return `${rightDate.value.year()} ${t("el.datepicker.year")} ${t(`el.datepicker.month${rightDate.value.month() + 1}`)}`;
- });
- const leftYear = computed(() => {
- return leftDate.value.year();
- });
- const leftMonth = computed(() => {
- return leftDate.value.month();
- });
- const rightYear = computed(() => {
- return rightDate.value.year();
- });
- const rightMonth = computed(() => {
- return rightDate.value.month();
- });
- const hasShortcuts = computed(() => !!shortcuts.length);
- const minVisibleDate = computed(() => {
- if (dateUserInput.value.min !== null)
- return dateUserInput.value.min;
- if (minDate.value)
- return minDate.value.format(dateFormat.value);
- return "";
- });
- const maxVisibleDate = computed(() => {
- if (dateUserInput.value.max !== null)
- return dateUserInput.value.max;
- if (maxDate.value || minDate.value)
- return (maxDate.value || minDate.value).format(dateFormat.value);
- return "";
- });
- const minVisibleTime = computed(() => {
- if (timeUserInput.value.min !== null)
- return timeUserInput.value.min;
- if (minDate.value)
- return minDate.value.format(timeFormat.value);
- return "";
- });
- const maxVisibleTime = computed(() => {
- if (timeUserInput.value.max !== null)
- return timeUserInput.value.max;
- if (maxDate.value || minDate.value)
- return (maxDate.value || minDate.value).format(timeFormat.value);
- return "";
- });
- const timeFormat = computed(() => {
- return extractTimeFormat(format2);
- });
- const dateFormat = computed(() => {
- return extractDateFormat(format2);
- });
- const leftPrevYear = () => {
- leftDate.value = leftDate.value.subtract(1, "year");
- if (!props.unlinkPanels) {
- rightDate.value = leftDate.value.add(1, "month");
- }
- handlePanelChange("year");
- };
- const leftPrevMonth = () => {
- leftDate.value = leftDate.value.subtract(1, "month");
- if (!props.unlinkPanels) {
- rightDate.value = leftDate.value.add(1, "month");
- }
- handlePanelChange("month");
- };
- const rightNextYear = () => {
- if (!props.unlinkPanels) {
- leftDate.value = leftDate.value.add(1, "year");
- rightDate.value = leftDate.value.add(1, "month");
- } else {
- rightDate.value = rightDate.value.add(1, "year");
- }
- handlePanelChange("year");
- };
- const rightNextMonth = () => {
- if (!props.unlinkPanels) {
- leftDate.value = leftDate.value.add(1, "month");
- rightDate.value = leftDate.value.add(1, "month");
- } else {
- rightDate.value = rightDate.value.add(1, "month");
- }
- handlePanelChange("month");
- };
- const leftNextYear = () => {
- leftDate.value = leftDate.value.add(1, "year");
- handlePanelChange("year");
- };
- const leftNextMonth = () => {
- leftDate.value = leftDate.value.add(1, "month");
- handlePanelChange("month");
- };
- const rightPrevYear = () => {
- rightDate.value = rightDate.value.subtract(1, "year");
- handlePanelChange("year");
- };
- const rightPrevMonth = () => {
- rightDate.value = rightDate.value.subtract(1, "month");
- handlePanelChange("month");
- };
- const handlePanelChange = (mode) => {
- ctx.emit("panel-change", [leftDate.value.toDate(), rightDate.value.toDate()], mode);
- };
- const enableMonthArrow = computed(() => {
- const nextMonth = (leftMonth.value + 1) % 12;
- const yearOffset = leftMonth.value + 1 >= 12 ? 1 : 0;
- return props.unlinkPanels && new Date(leftYear.value + yearOffset, nextMonth) < new Date(rightYear.value, rightMonth.value);
- });
- const enableYearArrow = computed(() => {
- return props.unlinkPanels && rightYear.value * 12 + rightMonth.value - (leftYear.value * 12 + leftMonth.value + 1) >= 12;
- });
- const isValidValue = (value) => {
- return Array.isArray(value) && value[0] && value[1] && value[0].valueOf() <= value[1].valueOf();
- };
- const rangeState = ref({
- endDate: null,
- selecting: false
- });
- const btnDisabled = computed(() => {
- return !(minDate.value && maxDate.value && !rangeState.value.selecting && isValidValue([minDate.value, maxDate.value]));
- });
- const handleChangeRange = (val) => {
- rangeState.value = val;
- };
- const onSelect = (selecting) => {
- rangeState.value.selecting = selecting;
- if (!selecting) {
- rangeState.value.endDate = null;
- }
- };
- const showTime = computed(() => props.type === "datetime" || props.type === "datetimerange");
- const handleConfirm = (visible = false) => {
- if (isValidValue([minDate.value, maxDate.value])) {
- ctx.emit("pick", [minDate.value, maxDate.value], visible);
- }
- };
- const formatEmit = (emitDayjs, index) => {
- if (!emitDayjs)
- return;
- if (defaultTime) {
- const defaultTimeD = dayjs(defaultTime[index] || defaultTime).locale(lang.value);
- return defaultTimeD.year(emitDayjs.year()).month(emitDayjs.month()).date(emitDayjs.date());
- }
- return emitDayjs;
- };
- const handleRangePick = (val, close2 = true) => {
- const min_ = val.minDate;
- const max_ = val.maxDate;
- const minDate_ = formatEmit(min_, 0);
- const maxDate_ = formatEmit(max_, 1);
- if (maxDate.value === maxDate_ && minDate.value === minDate_) {
- return;
- }
- ctx.emit("calendar-change", [min_.toDate(), max_ && max_.toDate()]);
- maxDate.value = maxDate_;
- minDate.value = minDate_;
- if (!close2 || showTime.value)
- return;
- handleConfirm();
- };
- const handleShortcutClick = (shortcut) => {
- const shortcutValues = typeof shortcut.value === "function" ? shortcut.value() : shortcut.value;
- if (shortcutValues) {
- ctx.emit("pick", [
- dayjs(shortcutValues[0]).locale(lang.value),
- dayjs(shortcutValues[1]).locale(lang.value)
- ]);
- return;
- }
- if (shortcut.onClick) {
- shortcut.onClick(ctx);
- }
- };
- const minTimePickerVisible = ref(false);
- const maxTimePickerVisible = ref(false);
- const handleMinTimeClose = () => {
- minTimePickerVisible.value = false;
- };
- const handleMaxTimeClose = () => {
- maxTimePickerVisible.value = false;
- };
- const handleDateInput = (value, type4) => {
- dateUserInput.value[type4] = value;
- const parsedValueD = dayjs(value, dateFormat.value).locale(lang.value);
- if (parsedValueD.isValid()) {
- if (disabledDate && disabledDate(parsedValueD.toDate())) {
- return;
- }
- if (type4 === "min") {
- leftDate.value = parsedValueD;
- minDate.value = (minDate.value || leftDate.value).year(parsedValueD.year()).month(parsedValueD.month()).date(parsedValueD.date());
- if (!props.unlinkPanels) {
- rightDate.value = parsedValueD.add(1, "month");
- maxDate.value = minDate.value.add(1, "month");
- }
- } else {
- rightDate.value = parsedValueD;
- maxDate.value = (maxDate.value || rightDate.value).year(parsedValueD.year()).month(parsedValueD.month()).date(parsedValueD.date());
- if (!props.unlinkPanels) {
- leftDate.value = parsedValueD.subtract(1, "month");
- minDate.value = maxDate.value.subtract(1, "month");
- }
- }
- }
- };
- const handleDateChange = (_2, type4) => {
- dateUserInput.value[type4] = null;
- };
- const handleTimeInput = (value, type4) => {
- timeUserInput.value[type4] = value;
- const parsedValueD = dayjs(value, timeFormat.value).locale(lang.value);
- if (parsedValueD.isValid()) {
- if (type4 === "min") {
- minTimePickerVisible.value = true;
- minDate.value = (minDate.value || leftDate.value).hour(parsedValueD.hour()).minute(parsedValueD.minute()).second(parsedValueD.second());
- if (!maxDate.value || maxDate.value.isBefore(minDate.value)) {
- maxDate.value = minDate.value;
- }
- } else {
- maxTimePickerVisible.value = true;
- maxDate.value = (maxDate.value || rightDate.value).hour(parsedValueD.hour()).minute(parsedValueD.minute()).second(parsedValueD.second());
- rightDate.value = maxDate.value;
- if (maxDate.value && maxDate.value.isBefore(minDate.value)) {
- minDate.value = maxDate.value;
- }
- }
- }
- };
- const handleTimeChange = (value, type4) => {
- timeUserInput.value[type4] = null;
- if (type4 === "min") {
- leftDate.value = minDate.value;
- minTimePickerVisible.value = false;
- } else {
- rightDate.value = maxDate.value;
- maxTimePickerVisible.value = false;
- }
- };
- const handleMinTimePick = (value, visible, first) => {
- if (timeUserInput.value.min)
- return;
- if (value) {
- leftDate.value = value;
- minDate.value = (minDate.value || leftDate.value).hour(value.hour()).minute(value.minute()).second(value.second());
- }
- if (!first) {
- minTimePickerVisible.value = visible;
- }
- if (!maxDate.value || maxDate.value.isBefore(minDate.value)) {
- maxDate.value = minDate.value;
- rightDate.value = value;
- }
- };
- const handleMaxTimePick = (value, visible, first) => {
- if (timeUserInput.value.max)
- return;
- if (value) {
- rightDate.value = value;
- maxDate.value = (maxDate.value || rightDate.value).hour(value.hour()).minute(value.minute()).second(value.second());
- }
- if (!first) {
- maxTimePickerVisible.value = visible;
- }
- if (maxDate.value && maxDate.value.isBefore(minDate.value)) {
- minDate.value = maxDate.value;
- }
- };
- const handleClear = () => {
- leftDate.value = getDefaultValue()[0];
- rightDate.value = leftDate.value.add(1, "month");
- ctx.emit("pick", null);
- };
- const formatToString = (value) => {
- return Array.isArray(value) ? value.map((_2) => _2.format(format2)) : value.format(format2);
- };
- const parseUserInput = (value) => {
- return Array.isArray(value) ? value.map((_2) => dayjs(_2, format2).locale(lang.value)) : dayjs(value, format2).locale(lang.value);
- };
- const getDefaultValue = () => {
- let start2;
- if (Array.isArray(defaultValue.value)) {
- const left2 = dayjs(defaultValue.value[0]);
- let right2 = dayjs(defaultValue.value[1]);
- if (!props.unlinkPanels) {
- right2 = left2.add(1, "month");
- }
- return [left2, right2];
- } else if (defaultValue.value) {
- start2 = dayjs(defaultValue.value);
- } else {
- start2 = dayjs();
- }
- start2 = start2.locale(lang.value);
- return [start2, start2.add(1, "month")];
- };
- ctx.emit("set-picker-option", ["isValidValue", isValidValue]);
- ctx.emit("set-picker-option", ["parseUserInput", parseUserInput]);
- ctx.emit("set-picker-option", ["formatToString", formatToString]);
- ctx.emit("set-picker-option", ["handleClear", handleClear]);
- const pickerBase = inject("EP_PICKER_BASE");
- const {
- shortcuts,
- disabledDate,
- cellClassName,
- format: format2,
- defaultTime,
- arrowControl,
- clearable
- } = pickerBase.props;
- const defaultValue = toRef(pickerBase.props, "defaultValue");
- watch(() => defaultValue.value, (val) => {
- if (val) {
- const defaultArr = getDefaultValue();
- minDate.value = null;
- maxDate.value = null;
- leftDate.value = defaultArr[0];
- rightDate.value = defaultArr[1];
- }
- }, { immediate: true });
- watch(() => props.parsedValue, (newVal) => {
- if (newVal && newVal.length === 2) {
- minDate.value = newVal[0];
- maxDate.value = newVal[1];
- leftDate.value = minDate.value;
- if (props.unlinkPanels && maxDate.value) {
- const minDateYear = minDate.value.year();
- const minDateMonth = minDate.value.month();
- const maxDateYear = maxDate.value.year();
- const maxDateMonth = maxDate.value.month();
- rightDate.value = minDateYear === maxDateYear && minDateMonth === maxDateMonth ? maxDate.value.add(1, "month") : maxDate.value;
- } else {
- rightDate.value = leftDate.value.add(1, "month");
- if (maxDate.value) {
- rightDate.value = rightDate.value.hour(maxDate.value.hour()).minute(maxDate.value.minute()).second(maxDate.value.second());
- }
- }
- } else {
- const defaultArr = getDefaultValue();
- minDate.value = null;
- maxDate.value = null;
- leftDate.value = defaultArr[0];
- rightDate.value = defaultArr[1];
- }
- }, { immediate: true });
- return {
- shortcuts,
- disabledDate,
- cellClassName,
- minTimePickerVisible,
- maxTimePickerVisible,
- handleMinTimeClose,
- handleMaxTimeClose,
- handleShortcutClick,
- rangeState,
- minDate,
- maxDate,
- handleRangePick,
- onSelect,
- handleChangeRange,
- btnDisabled,
- enableYearArrow,
- enableMonthArrow,
- rightPrevMonth,
- rightPrevYear,
- rightNextMonth,
- rightNextYear,
- leftPrevMonth,
- leftPrevYear,
- leftNextMonth,
- leftNextYear,
- hasShortcuts,
- leftLabel,
- rightLabel,
- leftDate,
- rightDate,
- showTime,
- t,
- minVisibleDate,
- maxVisibleDate,
- minVisibleTime,
- maxVisibleTime,
- arrowControl,
- handleDateInput,
- handleDateChange,
- handleTimeInput,
- handleTimeChange,
- handleMinTimePick,
- handleMaxTimePick,
- handleClear,
- handleConfirm,
- timeFormat,
- clearable
- };
- }
- });
- const _hoisted_1$n = { class: "el-picker-panel__body-wrapper" };
- const _hoisted_2$i = {
- key: 0,
- class: "el-picker-panel__sidebar"
- };
- const _hoisted_3$c = ["onClick"];
- const _hoisted_4$a = { class: "el-picker-panel__body" };
- const _hoisted_5$a = {
- key: 0,
- class: "el-date-range-picker__time-header"
- };
- const _hoisted_6$8 = { class: "el-date-range-picker__editors-wrap" };
- const _hoisted_7$4 = { class: "el-date-range-picker__time-picker-wrap" };
- const _hoisted_8$3 = { class: "el-date-range-picker__time-picker-wrap" };
- const _hoisted_9$3 = { class: "el-date-range-picker__editors-wrap is-right" };
- const _hoisted_10$3 = { class: "el-date-range-picker__time-picker-wrap" };
- const _hoisted_11$2 = { class: "el-date-range-picker__time-picker-wrap" };
- const _hoisted_12$2 = { class: "el-picker-panel__content el-date-range-picker__content is-left" };
- const _hoisted_13$2 = { class: "el-date-range-picker__header" };
- const _hoisted_14$2 = ["disabled"];
- const _hoisted_15$1 = ["disabled"];
- const _hoisted_16$1 = { class: "el-picker-panel__content el-date-range-picker__content is-right" };
- const _hoisted_17$1 = { class: "el-date-range-picker__header" };
- const _hoisted_18$1 = ["disabled"];
- const _hoisted_19$1 = ["disabled"];
- const _hoisted_20$1 = {
- key: 0,
- class: "el-picker-panel__footer"
- };
- function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
- const _component_el_input = resolveComponent("el-input");
- const _component_time_pick_panel = resolveComponent("time-pick-panel");
- const _component_arrow_right = resolveComponent("arrow-right");
- const _component_el_icon = resolveComponent("el-icon");
- const _component_d_arrow_left = resolveComponent("d-arrow-left");
- const _component_arrow_left = resolveComponent("arrow-left");
- const _component_d_arrow_right = resolveComponent("d-arrow-right");
- const _component_date_table = resolveComponent("date-table");
- const _component_el_button = resolveComponent("el-button");
- const _directive_clickoutside = resolveDirective("clickoutside");
- return openBlock(), createElementBlock("div", {
- class: normalizeClass(["el-picker-panel el-date-range-picker", [
- {
- "has-sidebar": _ctx.$slots.sidebar || _ctx.hasShortcuts,
- "has-time": _ctx.showTime
- }
- ]])
- }, [
- createElementVNode("div", _hoisted_1$n, [
- renderSlot(_ctx.$slots, "sidebar", { class: "el-picker-panel__sidebar" }),
- _ctx.hasShortcuts ? (openBlock(), createElementBlock("div", _hoisted_2$i, [
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.shortcuts, (shortcut, key) => {
- return openBlock(), createElementBlock("button", {
- key,
- type: "button",
- class: "el-picker-panel__shortcut",
- onClick: ($event) => _ctx.handleShortcutClick(shortcut)
- }, toDisplayString(shortcut.text), 9, _hoisted_3$c);
- }), 128))
- ])) : createCommentVNode("v-if", true),
- createElementVNode("div", _hoisted_4$a, [
- _ctx.showTime ? (openBlock(), createElementBlock("div", _hoisted_5$a, [
- createElementVNode("span", _hoisted_6$8, [
- createElementVNode("span", _hoisted_7$4, [
- createVNode(_component_el_input, {
- size: "small",
- disabled: _ctx.rangeState.selecting,
- placeholder: _ctx.t("el.datepicker.startDate"),
- class: "el-date-range-picker__editor",
- "model-value": _ctx.minVisibleDate,
- onInput: _cache[0] || (_cache[0] = (val) => _ctx.handleDateInput(val, "min")),
- onChange: _cache[1] || (_cache[1] = (val) => _ctx.handleDateChange(val, "min"))
- }, null, 8, ["disabled", "placeholder", "model-value"])
- ]),
- withDirectives((openBlock(), createElementBlock("span", _hoisted_8$3, [
- createVNode(_component_el_input, {
- size: "small",
- class: "el-date-range-picker__editor",
- disabled: _ctx.rangeState.selecting,
- placeholder: _ctx.t("el.datepicker.startTime"),
- "model-value": _ctx.minVisibleTime,
- onFocus: _cache[2] || (_cache[2] = ($event) => _ctx.minTimePickerVisible = true),
- onInput: _cache[3] || (_cache[3] = (val) => _ctx.handleTimeInput(val, "min")),
- onChange: _cache[4] || (_cache[4] = (val) => _ctx.handleTimeChange(val, "min"))
- }, null, 8, ["disabled", "placeholder", "model-value"]),
- createVNode(_component_time_pick_panel, {
- visible: _ctx.minTimePickerVisible,
- format: _ctx.timeFormat,
- "datetime-role": "start",
- "time-arrow-control": _ctx.arrowControl,
- "parsed-value": _ctx.leftDate,
- onPick: _ctx.handleMinTimePick
- }, null, 8, ["visible", "format", "time-arrow-control", "parsed-value", "onPick"])
- ])), [
- [_directive_clickoutside, _ctx.handleMinTimeClose]
- ])
- ]),
- createElementVNode("span", null, [
- createVNode(_component_el_icon, null, {
- default: withCtx(() => [
- createVNode(_component_arrow_right)
- ]),
- _: 1
- })
- ]),
- createElementVNode("span", _hoisted_9$3, [
- createElementVNode("span", _hoisted_10$3, [
- createVNode(_component_el_input, {
- size: "small",
- class: "el-date-range-picker__editor",
- disabled: _ctx.rangeState.selecting,
- placeholder: _ctx.t("el.datepicker.endDate"),
- "model-value": _ctx.maxVisibleDate,
- readonly: !_ctx.minDate,
- onInput: _cache[5] || (_cache[5] = (val) => _ctx.handleDateInput(val, "max")),
- onChange: _cache[6] || (_cache[6] = (val) => _ctx.handleDateChange(val, "max"))
- }, null, 8, ["disabled", "placeholder", "model-value", "readonly"])
- ]),
- withDirectives((openBlock(), createElementBlock("span", _hoisted_11$2, [
- createVNode(_component_el_input, {
- size: "small",
- class: "el-date-range-picker__editor",
- disabled: _ctx.rangeState.selecting,
- placeholder: _ctx.t("el.datepicker.endTime"),
- "model-value": _ctx.maxVisibleTime,
- readonly: !_ctx.minDate,
- onFocus: _cache[7] || (_cache[7] = ($event) => _ctx.minDate && (_ctx.maxTimePickerVisible = true)),
- onInput: _cache[8] || (_cache[8] = (val) => _ctx.handleTimeInput(val, "max")),
- onChange: _cache[9] || (_cache[9] = (val) => _ctx.handleTimeChange(val, "max"))
- }, null, 8, ["disabled", "placeholder", "model-value", "readonly"]),
- createVNode(_component_time_pick_panel, {
- "datetime-role": "end",
- visible: _ctx.maxTimePickerVisible,
- format: _ctx.timeFormat,
- "time-arrow-control": _ctx.arrowControl,
- "parsed-value": _ctx.rightDate,
- onPick: _ctx.handleMaxTimePick
- }, null, 8, ["visible", "format", "time-arrow-control", "parsed-value", "onPick"])
- ])), [
- [_directive_clickoutside, _ctx.handleMaxTimeClose]
- ])
- ])
- ])) : createCommentVNode("v-if", true),
- createElementVNode("div", _hoisted_12$2, [
- createElementVNode("div", _hoisted_13$2, [
- createElementVNode("button", {
- type: "button",
- class: "el-picker-panel__icon-btn d-arrow-left",
- onClick: _cache[10] || (_cache[10] = (...args) => _ctx.leftPrevYear && _ctx.leftPrevYear(...args))
- }, [
- createVNode(_component_el_icon, null, {
- default: withCtx(() => [
- createVNode(_component_d_arrow_left)
- ]),
- _: 1
- })
- ]),
- createElementVNode("button", {
- type: "button",
- class: "el-picker-panel__icon-btn arrow-left",
- onClick: _cache[11] || (_cache[11] = (...args) => _ctx.leftPrevMonth && _ctx.leftPrevMonth(...args))
- }, [
- createVNode(_component_el_icon, null, {
- default: withCtx(() => [
- createVNode(_component_arrow_left)
- ]),
- _: 1
- })
- ]),
- _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
- key: 0,
- type: "button",
- disabled: !_ctx.enableYearArrow,
- class: normalizeClass([{ "is-disabled": !_ctx.enableYearArrow }, "el-picker-panel__icon-btn d-arrow-right"]),
- onClick: _cache[12] || (_cache[12] = (...args) => _ctx.leftNextYear && _ctx.leftNextYear(...args))
- }, [
- createVNode(_component_el_icon, null, {
- default: withCtx(() => [
- createVNode(_component_d_arrow_right)
- ]),
- _: 1
- })
- ], 10, _hoisted_14$2)) : createCommentVNode("v-if", true),
- _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
- key: 1,
- type: "button",
- disabled: !_ctx.enableMonthArrow,
- class: normalizeClass([{ "is-disabled": !_ctx.enableMonthArrow }, "el-picker-panel__icon-btn arrow-right"]),
- onClick: _cache[13] || (_cache[13] = (...args) => _ctx.leftNextMonth && _ctx.leftNextMonth(...args))
- }, [
- createVNode(_component_el_icon, null, {
- default: withCtx(() => [
- createVNode(_component_arrow_right)
- ]),
- _: 1
- })
- ], 10, _hoisted_15$1)) : createCommentVNode("v-if", true),
- createElementVNode("div", null, toDisplayString(_ctx.leftLabel), 1)
- ]),
- createVNode(_component_date_table, {
- "selection-mode": "range",
- date: _ctx.leftDate,
- "min-date": _ctx.minDate,
- "max-date": _ctx.maxDate,
- "range-state": _ctx.rangeState,
- "disabled-date": _ctx.disabledDate,
- "cell-class-name": _ctx.cellClassName,
- onChangerange: _ctx.handleChangeRange,
- onPick: _ctx.handleRangePick,
- onSelect: _ctx.onSelect
- }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "cell-class-name", "onChangerange", "onPick", "onSelect"])
- ]),
- createElementVNode("div", _hoisted_16$1, [
- createElementVNode("div", _hoisted_17$1, [
- _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
- key: 0,
- type: "button",
- disabled: !_ctx.enableYearArrow,
- class: normalizeClass([{ "is-disabled": !_ctx.enableYearArrow }, "el-picker-panel__icon-btn d-arrow-left"]),
- onClick: _cache[14] || (_cache[14] = (...args) => _ctx.rightPrevYear && _ctx.rightPrevYear(...args))
- }, [
- createVNode(_component_el_icon, null, {
- default: withCtx(() => [
- createVNode(_component_d_arrow_left)
- ]),
- _: 1
- })
- ], 10, _hoisted_18$1)) : createCommentVNode("v-if", true),
- _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
- key: 1,
- type: "button",
- disabled: !_ctx.enableMonthArrow,
- class: normalizeClass([{ "is-disabled": !_ctx.enableMonthArrow }, "el-picker-panel__icon-btn arrow-left"]),
- onClick: _cache[15] || (_cache[15] = (...args) => _ctx.rightPrevMonth && _ctx.rightPrevMonth(...args))
- }, [
- createVNode(_component_el_icon, null, {
- default: withCtx(() => [
- createVNode(_component_arrow_left)
- ]),
- _: 1
- })
- ], 10, _hoisted_19$1)) : createCommentVNode("v-if", true),
- createElementVNode("button", {
- type: "button",
- class: "el-picker-panel__icon-btn d-arrow-right",
- onClick: _cache[16] || (_cache[16] = (...args) => _ctx.rightNextYear && _ctx.rightNextYear(...args))
- }, [
- createVNode(_component_el_icon, null, {
- default: withCtx(() => [
- createVNode(_component_d_arrow_right)
- ]),
- _: 1
- })
- ]),
- createElementVNode("button", {
- type: "button",
- class: "el-picker-panel__icon-btn arrow-right",
- onClick: _cache[17] || (_cache[17] = (...args) => _ctx.rightNextMonth && _ctx.rightNextMonth(...args))
- }, [
- createVNode(_component_el_icon, null, {
- default: withCtx(() => [
- createVNode(_component_arrow_right)
- ]),
- _: 1
- })
- ]),
- createElementVNode("div", null, toDisplayString(_ctx.rightLabel), 1)
- ]),
- createVNode(_component_date_table, {
- "selection-mode": "range",
- date: _ctx.rightDate,
- "min-date": _ctx.minDate,
- "max-date": _ctx.maxDate,
- "range-state": _ctx.rangeState,
- "disabled-date": _ctx.disabledDate,
- "cell-class-name": _ctx.cellClassName,
- onChangerange: _ctx.handleChangeRange,
- onPick: _ctx.handleRangePick,
- onSelect: _ctx.onSelect
- }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "cell-class-name", "onChangerange", "onPick", "onSelect"])
- ])
- ])
- ]),
- _ctx.showTime ? (openBlock(), createElementBlock("div", _hoisted_20$1, [
- _ctx.clearable ? (openBlock(), createBlock(_component_el_button, {
- key: 0,
- size: "small",
- type: "text",
- class: "el-picker-panel__link-btn",
- onClick: _ctx.handleClear
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(_ctx.t("el.datepicker.clear")), 1)
- ]),
- _: 1
- }, 8, ["onClick"])) : createCommentVNode("v-if", true),
- createVNode(_component_el_button, {
- plain: "",
- size: "small",
- class: "el-picker-panel__link-btn",
- disabled: _ctx.btnDisabled,
- onClick: _cache[18] || (_cache[18] = ($event) => _ctx.handleConfirm(false))
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(_ctx.t("el.datepicker.confirm")), 1)
- ]),
- _: 1
- }, 8, ["disabled"])
- ])) : createCommentVNode("v-if", true)
- ], 2);
- }
- 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"]]);
- const _sfc_main$z = defineComponent({
- components: { MonthTable, ElIcon, DArrowLeft: dArrowLeft, DArrowRight: dArrowRight },
- props: {
- unlinkPanels: Boolean,
- parsedValue: {
- type: Array
- }
- },
- emits: ["pick", "set-picker-option"],
- setup(props, ctx) {
- const { t, lang } = useLocale();
- const leftDate = ref(dayjs().locale(lang.value));
- const rightDate = ref(dayjs().locale(lang.value).add(1, "year"));
- const hasShortcuts = computed(() => !!shortcuts.length);
- const handleShortcutClick = (shortcut) => {
- const shortcutValues = typeof shortcut.value === "function" ? shortcut.value() : shortcut.value;
- if (shortcutValues) {
- ctx.emit("pick", [
- dayjs(shortcutValues[0]).locale(lang.value),
- dayjs(shortcutValues[1]).locale(lang.value)
- ]);
- return;
- }
- if (shortcut.onClick) {
- shortcut.onClick(ctx);
- }
- };
- const leftPrevYear = () => {
- leftDate.value = leftDate.value.subtract(1, "year");
- if (!props.unlinkPanels) {
- rightDate.value = rightDate.value.subtract(1, "year");
- }
- };
- const rightNextYear = () => {
- if (!props.unlinkPanels) {
- leftDate.value = leftDate.value.add(1, "year");
- }
- rightDate.value = rightDate.value.add(1, "year");
- };
- const leftNextYear = () => {
- leftDate.value = leftDate.value.add(1, "year");
- };
- const rightPrevYear = () => {
- rightDate.value = rightDate.value.subtract(1, "year");
- };
- const leftLabel = computed(() => {
- return `${leftDate.value.year()} ${t("el.datepicker.year")}`;
- });
- const rightLabel = computed(() => {
- return `${rightDate.value.year()} ${t("el.datepicker.year")}`;
- });
- const leftYear = computed(() => {
- return leftDate.value.year();
- });
- const rightYear = computed(() => {
- return rightDate.value.year() === leftDate.value.year() ? leftDate.value.year() + 1 : rightDate.value.year();
- });
- const enableYearArrow = computed(() => {
- return props.unlinkPanels && rightYear.value > leftYear.value + 1;
- });
- const minDate = ref(null);
- const maxDate = ref(null);
- const rangeState = ref({
- endDate: null,
- selecting: false
- });
- const handleChangeRange = (val) => {
- rangeState.value = val;
- };
- const handleRangePick = (val, close2 = true) => {
- const minDate_ = val.minDate;
- const maxDate_ = val.maxDate;
- if (maxDate.value === maxDate_ && minDate.value === minDate_) {
- return;
- }
- maxDate.value = maxDate_;
- minDate.value = minDate_;
- if (!close2)
- return;
- handleConfirm();
- };
- const isValidValue = (value) => {
- return Array.isArray(value) && value && value[0] && value[1] && value[0].valueOf() <= value[1].valueOf();
- };
- const handleConfirm = (visible = false) => {
- if (isValidValue([minDate.value, maxDate.value])) {
- ctx.emit("pick", [minDate.value, maxDate.value], visible);
- }
- };
- const onSelect = (selecting) => {
- rangeState.value.selecting = selecting;
- if (!selecting) {
- rangeState.value.endDate = null;
- }
- };
- const formatToString = (value) => {
- return value.map((_2) => _2.format(format2));
- };
- const getDefaultValue = () => {
- let start2;
- if (Array.isArray(defaultValue.value)) {
- const left2 = dayjs(defaultValue.value[0]);
- let right2 = dayjs(defaultValue.value[1]);
- if (!props.unlinkPanels) {
- right2 = left2.add(1, "year");
- }
- return [left2, right2];
- } else if (defaultValue.value) {
- start2 = dayjs(defaultValue.value);
- } else {
- start2 = dayjs();
- }
- start2 = start2.locale(lang.value);
- return [start2, start2.add(1, "year")];
- };
- ctx.emit("set-picker-option", ["formatToString", formatToString]);
- const pickerBase = inject("EP_PICKER_BASE");
- const { shortcuts, disabledDate, format: format2 } = pickerBase.props;
- const defaultValue = toRef(pickerBase.props, "defaultValue");
- watch(() => defaultValue.value, (val) => {
- if (val) {
- const defaultArr = getDefaultValue();
- leftDate.value = defaultArr[0];
- rightDate.value = defaultArr[1];
- }
- }, { immediate: true });
- watch(() => props.parsedValue, (newVal) => {
- if (newVal && newVal.length === 2) {
- minDate.value = newVal[0];
- maxDate.value = newVal[1];
- leftDate.value = minDate.value;
- if (props.unlinkPanels && maxDate.value) {
- const minDateYear = minDate.value.year();
- const maxDateYear = maxDate.value.year();
- rightDate.value = minDateYear === maxDateYear ? maxDate.value.add(1, "year") : maxDate.value;
- } else {
- rightDate.value = leftDate.value.add(1, "year");
- }
- } else {
- const defaultArr = getDefaultValue();
- minDate.value = null;
- maxDate.value = null;
- leftDate.value = defaultArr[0];
- rightDate.value = defaultArr[1];
- }
- }, { immediate: true });
- return {
- shortcuts,
- disabledDate,
- onSelect,
- handleRangePick,
- rangeState,
- handleChangeRange,
- minDate,
- maxDate,
- enableYearArrow,
- leftLabel,
- rightLabel,
- leftNextYear,
- leftPrevYear,
- rightNextYear,
- rightPrevYear,
- t,
- leftDate,
- rightDate,
- hasShortcuts,
- handleShortcutClick
- };
- }
- });
- const _hoisted_1$m = { class: "el-picker-panel__body-wrapper" };
- const _hoisted_2$h = {
- key: 0,
- class: "el-picker-panel__sidebar"
- };
- const _hoisted_3$b = ["onClick"];
- const _hoisted_4$9 = { class: "el-picker-panel__body" };
- const _hoisted_5$9 = { class: "el-picker-panel__content el-date-range-picker__content is-left" };
- const _hoisted_6$7 = { class: "el-date-range-picker__header" };
- const _hoisted_7$3 = ["disabled"];
- const _hoisted_8$2 = { class: "el-picker-panel__content el-date-range-picker__content is-right" };
- const _hoisted_9$2 = { class: "el-date-range-picker__header" };
- const _hoisted_10$2 = ["disabled"];
- function _sfc_render$e(_ctx, _cache, $props, $setup, $data, $options) {
- const _component_d_arrow_left = resolveComponent("d-arrow-left");
- const _component_el_icon = resolveComponent("el-icon");
- const _component_d_arrow_right = resolveComponent("d-arrow-right");
- const _component_month_table = resolveComponent("month-table");
- return openBlock(), createElementBlock("div", {
- class: normalizeClass(["el-picker-panel el-date-range-picker", [
- {
- "has-sidebar": _ctx.$slots.sidebar || _ctx.hasShortcuts
- }
- ]])
- }, [
- createElementVNode("div", _hoisted_1$m, [
- renderSlot(_ctx.$slots, "sidebar", { class: "el-picker-panel__sidebar" }),
- _ctx.hasShortcuts ? (openBlock(), createElementBlock("div", _hoisted_2$h, [
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.shortcuts, (shortcut, key) => {
- return openBlock(), createElementBlock("button", {
- key,
- type: "button",
- class: "el-picker-panel__shortcut",
- onClick: ($event) => _ctx.handleShortcutClick(shortcut)
- }, toDisplayString(shortcut.text), 9, _hoisted_3$b);
- }), 128))
- ])) : createCommentVNode("v-if", true),
- createElementVNode("div", _hoisted_4$9, [
- createElementVNode("div", _hoisted_5$9, [
- createElementVNode("div", _hoisted_6$7, [
- createElementVNode("button", {
- type: "button",
- class: "el-picker-panel__icon-btn d-arrow-left",
- onClick: _cache[0] || (_cache[0] = (...args) => _ctx.leftPrevYear && _ctx.leftPrevYear(...args))
- }, [
- createVNode(_component_el_icon, null, {
- default: withCtx(() => [
- createVNode(_component_d_arrow_left)
- ]),
- _: 1
- })
- ]),
- _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
- key: 0,
- type: "button",
- disabled: !_ctx.enableYearArrow,
- class: normalizeClass([{ "is-disabled": !_ctx.enableYearArrow }, "el-picker-panel__icon-btn d-arrow-right"]),
- onClick: _cache[1] || (_cache[1] = (...args) => _ctx.leftNextYear && _ctx.leftNextYear(...args))
- }, [
- createVNode(_component_el_icon, null, {
- default: withCtx(() => [
- createVNode(_component_d_arrow_right)
- ]),
- _: 1
- })
- ], 10, _hoisted_7$3)) : createCommentVNode("v-if", true),
- createElementVNode("div", null, toDisplayString(_ctx.leftLabel), 1)
- ]),
- createVNode(_component_month_table, {
- "selection-mode": "range",
- date: _ctx.leftDate,
- "min-date": _ctx.minDate,
- "max-date": _ctx.maxDate,
- "range-state": _ctx.rangeState,
- "disabled-date": _ctx.disabledDate,
- onChangerange: _ctx.handleChangeRange,
- onPick: _ctx.handleRangePick,
- onSelect: _ctx.onSelect
- }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "onChangerange", "onPick", "onSelect"])
- ]),
- createElementVNode("div", _hoisted_8$2, [
- createElementVNode("div", _hoisted_9$2, [
- _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
- key: 0,
- type: "button",
- disabled: !_ctx.enableYearArrow,
- class: normalizeClass([{ "is-disabled": !_ctx.enableYearArrow }, "el-picker-panel__icon-btn d-arrow-left"]),
- onClick: _cache[2] || (_cache[2] = (...args) => _ctx.rightPrevYear && _ctx.rightPrevYear(...args))
- }, [
- createVNode(_component_el_icon, null, {
- default: withCtx(() => [
- createVNode(_component_d_arrow_left)
- ]),
- _: 1
- })
- ], 10, _hoisted_10$2)) : createCommentVNode("v-if", true),
- createElementVNode("button", {
- type: "button",
- class: "el-picker-panel__icon-btn d-arrow-right",
- onClick: _cache[3] || (_cache[3] = (...args) => _ctx.rightNextYear && _ctx.rightNextYear(...args))
- }, [
- createVNode(_component_el_icon, null, {
- default: withCtx(() => [
- createVNode(_component_d_arrow_right)
- ]),
- _: 1
- })
- ]),
- createElementVNode("div", null, toDisplayString(_ctx.rightLabel), 1)
- ]),
- createVNode(_component_month_table, {
- "selection-mode": "range",
- date: _ctx.rightDate,
- "min-date": _ctx.minDate,
- "max-date": _ctx.maxDate,
- "range-state": _ctx.rangeState,
- "disabled-date": _ctx.disabledDate,
- onChangerange: _ctx.handleChangeRange,
- onPick: _ctx.handleRangePick,
- onSelect: _ctx.onSelect
- }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "onChangerange", "onPick", "onSelect"])
- ])
- ])
- ])
- ], 2);
- }
- 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"]]);
- dayjs.extend(localeData);
- dayjs.extend(advancedFormat);
- dayjs.extend(customParseFormat);
- dayjs.extend(weekOfYear);
- dayjs.extend(weekYear);
- dayjs.extend(dayOfYear);
- dayjs.extend(isSameOrAfter);
- dayjs.extend(isSameOrBefore);
- const getPanel = function(type4) {
- if (type4 === "daterange" || type4 === "datetimerange") {
- return DateRangePickPanel;
- } else if (type4 === "monthrange") {
- return MonthRangePickPanel;
- }
- return DatePickPanel;
- };
- var DatePicker = defineComponent({
- name: "ElDatePicker",
- install: null,
- props: __spreadProps(__spreadValues({}, timePickerDefaultProps), {
- type: {
- type: String,
- default: "date"
- }
- }),
- emits: ["update:modelValue"],
- setup(props, ctx) {
- provide("ElPopperOptions", props.popperOptions);
- provide(ROOT_PICKER_INJECTION_KEY, {
- ctx
- });
- const commonPicker = ref(null);
- const refProps = __spreadProps(__spreadValues({}, props), {
- focus: (focusStartInput = true) => {
- var _a2;
- (_a2 = commonPicker.value) == null ? void 0 : _a2.focus(focusStartInput);
- }
- });
- ctx.expose(refProps);
- return () => {
- var _a2;
- const format2 = (_a2 = props.format) != null ? _a2 : DEFAULT_FORMATS_DATEPICKER[props.type] || DEFAULT_FORMATS_DATE;
- return h$1(CommonPicker, __spreadProps(__spreadValues({}, props), {
- format: format2,
- type: props.type,
- ref: commonPicker,
- "onUpdate:modelValue": (value) => ctx.emit("update:modelValue", value)
- }), {
- default: (scopedProps) => h$1(getPanel(props.type), scopedProps),
- "range-separator": () => renderSlot(ctx.slots, "range-separator")
- });
- };
- }
- });
- const _DatePicker = DatePicker;
- _DatePicker.install = (app) => {
- app.component(_DatePicker.name, _DatePicker);
- };
- const ElDatePicker = _DatePicker;
- const overlayProps = buildProps({
- mask: {
- type: Boolean,
- default: true
- },
- customMaskEvent: {
- type: Boolean,
- default: false
- },
- overlayClass: {
- type: definePropType([
- String,
- Array,
- Object
- ])
- },
- zIndex: {
- type: definePropType([String, Number])
- }
- });
- const overlayEmits = {
- click: (evt) => evt instanceof MouseEvent
- };
- var Overlay = defineComponent({
- name: "ElOverlay",
- props: overlayProps,
- emits: overlayEmits,
- setup(props, { slots, emit }) {
- const ns = useNamespace("overlay");
- const onMaskClick = (e) => {
- emit("click", e);
- };
- const { onClick, onMousedown, onMouseup } = useSameTarget(props.customMaskEvent ? void 0 : onMaskClick);
- return () => {
- return props.mask ? createVNode("div", {
- class: [ns.b(), props.overlayClass],
- style: {
- zIndex: props.zIndex
- },
- onClick,
- onMousedown,
- onMouseup
- }, [renderSlot(slots, "default")], PatchFlags.STYLE | PatchFlags.CLASS | PatchFlags.PROPS, ["onClick", "onMouseup", "onMousedown"]) : h$1("div", {
- class: props.overlayClass,
- style: {
- zIndex: props.zIndex,
- position: "fixed",
- top: "0px",
- right: "0px",
- bottom: "0px",
- left: "0px"
- }
- }, [renderSlot(slots, "default")]);
- };
- }
- });
- const ElOverlay = Overlay;
- const dialogContentProps = buildProps({
- center: {
- type: Boolean,
- default: false
- },
- closeIcon: {
- type: iconPropType,
- default: ""
- },
- customClass: {
- type: String,
- default: ""
- },
- draggable: {
- type: Boolean,
- default: false
- },
- fullscreen: {
- type: Boolean,
- default: false
- },
- showClose: {
- type: Boolean,
- default: true
- },
- title: {
- type: String,
- default: ""
- }
- });
- const dialogContentEmits = {
- close: () => true
- };
- const _hoisted_1$l = ["aria-label"];
- const __default__$c = { name: "ElDialogContent" };
- const _sfc_main$y = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$c), {
- props: dialogContentProps,
- emits: dialogContentEmits,
- setup(__props) {
- const { Close } = CloseComponents;
- const { dialogRef, headerRef, ns, style } = inject(dialogInjectionKey);
- return (_ctx, _cache) => {
- return openBlock(), createElementBlock("div", {
- ref_key: "dialogRef",
- ref: dialogRef,
- class: normalizeClass([
- unref(ns).b(),
- unref(ns).is("fullscreen", _ctx.fullscreen),
- unref(ns).is("draggable", _ctx.draggable),
- { [unref(ns).m("center")]: _ctx.center },
- _ctx.customClass
- ]),
- "aria-modal": "true",
- role: "dialog",
- "aria-label": _ctx.title || "dialog",
- style: normalizeStyle(unref(style)),
- onClick: _cache[1] || (_cache[1] = withModifiers(() => {
- }, ["stop"]))
- }, [
- createElementVNode("div", {
- ref_key: "headerRef",
- ref: headerRef,
- class: normalizeClass(unref(ns).e("header"))
- }, [
- renderSlot(_ctx.$slots, "title", {}, () => [
- createElementVNode("span", {
- class: normalizeClass(unref(ns).e("title"))
- }, toDisplayString(_ctx.title), 3)
- ])
- ], 2),
- createElementVNode("div", {
- class: normalizeClass(unref(ns).e("body"))
- }, [
- renderSlot(_ctx.$slots, "default")
- ], 2),
- _ctx.$slots.footer ? (openBlock(), createElementBlock("div", {
- key: 0,
- class: normalizeClass(unref(ns).e("footer"))
- }, [
- renderSlot(_ctx.$slots, "footer")
- ], 2)) : createCommentVNode("v-if", true),
- _ctx.showClose ? (openBlock(), createElementBlock("button", {
- key: 1,
- "aria-label": "close",
- class: normalizeClass(unref(ns).e("headerbtn")),
- type: "button",
- onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("close"))
- }, [
- createVNode(unref(ElIcon), {
- class: normalizeClass(unref(ns).e("close"))
- }, {
- default: withCtx(() => [
- (openBlock(), createBlock(resolveDynamicComponent(_ctx.closeIcon || unref(Close))))
- ]),
- _: 1
- }, 8, ["class"])
- ], 2)) : createCommentVNode("v-if", true)
- ], 14, _hoisted_1$l);
- };
- }
- }));
- var ElDialogContent = /* @__PURE__ */ _export_sfc$1(_sfc_main$y, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/dialog/src/dialog-content.vue"]]);
- const dialogProps = buildProps(__spreadProps(__spreadValues({}, dialogContentProps), {
- appendToBody: {
- type: Boolean,
- default: false
- },
- beforeClose: {
- type: definePropType(Function)
- },
- destroyOnClose: {
- type: Boolean,
- default: false
- },
- closeOnClickModal: {
- type: Boolean,
- default: true
- },
- closeOnPressEscape: {
- type: Boolean,
- default: true
- },
- lockScroll: {
- type: Boolean,
- default: true
- },
- modal: {
- type: Boolean,
- default: true
- },
- openDelay: {
- type: Number,
- default: 0
- },
- closeDelay: {
- type: Number,
- default: 0
- },
- top: {
- type: String
- },
- modelValue: {
- type: Boolean,
- required: true
- },
- modalClass: String,
- width: {
- type: [String, Number]
- },
- zIndex: {
- type: Number
- },
- trapFocus: {
- type: Boolean,
- default: false
- }
- }));
- const dialogEmits = {
- open: () => true,
- opened: () => true,
- close: () => true,
- closed: () => true,
- [UPDATE_MODEL_EVENT]: (value) => isBoolean(value),
- openAutoFocus: () => true,
- closeAutoFocus: () => true
- };
- const useDialog = (props, targetRef) => {
- const instance = getCurrentInstance();
- const emit = instance.emit;
- const { nextZIndex } = useZIndex();
- let lastPosition = "";
- const visible = ref(false);
- const closed = ref(false);
- const rendered = ref(false);
- const zIndex2 = ref(props.zIndex || nextZIndex());
- let openTimer = void 0;
- let closeTimer = void 0;
- const normalizeWidth = computed(() => isNumber(props.width) ? `${props.width}px` : props.width);
- const style = computed(() => {
- const style2 = {};
- const varPrefix = `--el-dialog`;
- if (!props.fullscreen) {
- if (props.top) {
- style2[`${varPrefix}-margin-top`] = props.top;
- }
- if (props.width) {
- style2[`${varPrefix}-width`] = normalizeWidth.value;
- }
- }
- return style2;
- });
- function afterEnter() {
- emit("opened");
- }
- function afterLeave() {
- emit("closed");
- emit(UPDATE_MODEL_EVENT, false);
- if (props.destroyOnClose) {
- rendered.value = false;
- }
- }
- function beforeLeave() {
- emit("close");
- }
- function open() {
- closeTimer == null ? void 0 : closeTimer();
- openTimer == null ? void 0 : openTimer();
- if (props.openDelay && props.openDelay > 0) {
- ({ stop: openTimer } = useTimeoutFn(() => doOpen(), props.openDelay));
- } else {
- doOpen();
- }
- }
- function close2() {
- openTimer == null ? void 0 : openTimer();
- closeTimer == null ? void 0 : closeTimer();
- if (props.closeDelay && props.closeDelay > 0) {
- ({ stop: closeTimer } = useTimeoutFn(() => doClose(), props.closeDelay));
- } else {
- doClose();
- }
- }
- function handleClose() {
- function hide2(shouldCancel) {
- if (shouldCancel)
- return;
- closed.value = true;
- visible.value = false;
- }
- if (props.beforeClose) {
- props.beforeClose(hide2);
- } else {
- close2();
- }
- }
- function onModalClick() {
- if (props.closeOnClickModal) {
- handleClose();
- }
- }
- function doOpen() {
- if (!isClient)
- return;
- visible.value = true;
- }
- function doClose() {
- visible.value = false;
- }
- if (props.lockScroll) {
- useLockscreen(visible);
- }
- if (props.closeOnPressEscape) {
- useModal({
- handleClose
- }, visible);
- }
- useRestoreActive(visible);
- watch(() => props.modelValue, (val) => {
- if (val) {
- closed.value = false;
- open();
- rendered.value = true;
- emit("open");
- zIndex2.value = props.zIndex ? zIndex2.value++ : nextZIndex();
- nextTick(() => {
- if (targetRef.value) {
- targetRef.value.scrollTop = 0;
- }
- });
- } else {
- if (visible.value) {
- close2();
- }
- }
- });
- watch(() => props.fullscreen, (val) => {
- if (!targetRef.value)
- return;
- if (val) {
- lastPosition = targetRef.value.style.transform;
- targetRef.value.style.transform = "";
- } else {
- targetRef.value.style.transform = lastPosition;
- }
- });
- onMounted(() => {
- if (props.modelValue) {
- visible.value = true;
- rendered.value = true;
- open();
- }
- });
- return {
- afterEnter,
- afterLeave,
- beforeLeave,
- handleClose,
- onModalClick,
- close: close2,
- doClose,
- closed,
- style,
- rendered,
- visible,
- zIndex: zIndex2
- };
- };
- const __default__$b = {
- name: "ElDialog"
- };
- const _sfc_main$x = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$b), {
- props: dialogProps,
- emits: dialogEmits,
- setup(__props, { expose }) {
- const props = __props;
- const ns = useNamespace("dialog");
- const dialogRef = ref();
- const headerRef = ref();
- const {
- visible,
- style,
- rendered,
- zIndex: zIndex2,
- afterEnter,
- afterLeave,
- beforeLeave,
- handleClose,
- onModalClick
- } = useDialog(props, dialogRef);
- provide(dialogInjectionKey, {
- dialogRef,
- headerRef,
- ns,
- rendered,
- style
- });
- const overlayEvent = useSameTarget(onModalClick);
- const draggable = computed(() => props.draggable && !props.fullscreen);
- useDraggable(dialogRef, headerRef, draggable);
- expose({
- visible
- });
- return (_ctx, _cache) => {
- return openBlock(), createBlock(Teleport, {
- to: "body",
- disabled: !_ctx.appendToBody
- }, [
- createVNode(Transition, {
- name: "dialog-fade",
- onAfterEnter: unref(afterEnter),
- onAfterLeave: unref(afterLeave),
- onBeforeLeave: unref(beforeLeave)
- }, {
- default: withCtx(() => [
- withDirectives(createVNode(unref(ElOverlay), {
- "custom-mask-event": "",
- mask: _ctx.modal,
- "overlay-class": _ctx.modalClass,
- "z-index": unref(zIndex2)
- }, {
- default: withCtx(() => [
- createElementVNode("div", {
- class: normalizeClass(`${unref(ns).namespace.value}-overlay-dialog`),
- onClick: _cache[0] || (_cache[0] = (...args) => unref(overlayEvent).onClick && unref(overlayEvent).onClick(...args)),
- onMousedown: _cache[1] || (_cache[1] = (...args) => unref(overlayEvent).onMousedown && unref(overlayEvent).onMousedown(...args)),
- onMouseup: _cache[2] || (_cache[2] = (...args) => unref(overlayEvent).onMouseup && unref(overlayEvent).onMouseup(...args))
- }, [
- unref(rendered) ? (openBlock(), createBlock(ElDialogContent, {
- key: 0,
- "custom-class": _ctx.customClass,
- center: _ctx.center,
- "close-icon": _ctx.closeIcon,
- draggable: unref(draggable),
- fullscreen: _ctx.fullscreen,
- "show-close": _ctx.showClose,
- style: normalizeStyle(unref(style)),
- title: _ctx.title,
- onClose: unref(handleClose)
- }, createSlots({
- title: withCtx(() => [
- renderSlot(_ctx.$slots, "title")
- ]),
- default: withCtx(() => [
- renderSlot(_ctx.$slots, "default")
- ]),
- _: 2
- }, [
- _ctx.$slots.footer ? {
- name: "footer",
- fn: withCtx(() => [
- renderSlot(_ctx.$slots, "footer")
- ])
- } : void 0
- ]), 1032, ["custom-class", "center", "close-icon", "draggable", "fullscreen", "show-close", "style", "title", "onClose"])) : createCommentVNode("v-if", true)
- ], 34)
- ]),
- _: 3
- }, 8, ["mask", "overlay-class", "z-index"]), [
- [vShow, unref(visible)]
- ])
- ]),
- _: 3
- }, 8, ["onAfterEnter", "onAfterLeave", "onBeforeLeave"])
- ], 8, ["disabled"]);
- };
- }
- }));
- var Dialog = /* @__PURE__ */ _export_sfc$1(_sfc_main$x, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/dialog/src/dialog.vue"]]);
- const ElDialog = withInstall(Dialog);
- const dividerProps = buildProps({
- direction: {
- type: String,
- values: ["horizontal", "vertical"],
- default: "horizontal"
- },
- contentPosition: {
- type: String,
- values: ["left", "center", "right"],
- default: "center"
- },
- borderStyle: {
- type: definePropType(String),
- default: "solid"
- }
- });
- const __default__$a = {
- name: "ElDivider"
- };
- const _sfc_main$w = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$a), {
- props: dividerProps,
- setup(__props) {
- const props = __props;
- const ns = useNamespace("divider");
- const dividerStyle = computed(() => {
- return {
- "--el-border-style": props.borderStyle
- };
- });
- return (_ctx, _cache) => {
- return openBlock(), createElementBlock("div", {
- class: normalizeClass([unref(ns).b(), unref(ns).m(_ctx.direction)]),
- style: normalizeStyle(unref(dividerStyle))
- }, [
- _ctx.$slots.default && _ctx.direction !== "vertical" ? (openBlock(), createElementBlock("div", {
- key: 0,
- class: normalizeClass([unref(ns).e("text"), unref(ns).is(_ctx.contentPosition)])
- }, [
- renderSlot(_ctx.$slots, "default")
- ], 2)) : createCommentVNode("v-if", true)
- ], 6);
- };
- }
- }));
- var Divider = /* @__PURE__ */ _export_sfc$1(_sfc_main$w, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/divider/src/divider.vue"]]);
- const ElDivider = withInstall(Divider);
- const formProps = buildProps({
- model: Object,
- rules: {
- type: definePropType(Object)
- },
- labelPosition: String,
- labelWidth: {
- type: [String, Number],
- default: ""
- },
- labelSuffix: {
- type: String,
- default: ""
- },
- inline: Boolean,
- inlineMessage: Boolean,
- statusIcon: Boolean,
- showMessage: {
- type: Boolean,
- default: true
- },
- size: {
- type: String,
- values: componentSizes
- },
- disabled: Boolean,
- validateOnRuleChange: {
- type: Boolean,
- default: true
- },
- hideRequiredAsterisk: {
- type: Boolean,
- default: false
- },
- scrollToError: Boolean
- });
- const formEmits = {
- validate: (prop, isValid, message) => (isArray(prop) || isString(prop)) && isBoolean(isValid) && isString(message)
- };
- function useFormLabelWidth() {
- const potentialLabelWidthArr = ref([]);
- const autoLabelWidth = computed(() => {
- if (!potentialLabelWidthArr.value.length)
- return "0";
- const max2 = Math.max(...potentialLabelWidthArr.value);
- return max2 ? `${max2}px` : "";
- });
- function getLabelWidthIndex(width) {
- const index = potentialLabelWidthArr.value.indexOf(width);
- return index;
- }
- function registerLabelWidth(val, oldVal) {
- if (val && oldVal) {
- const index = getLabelWidthIndex(oldVal);
- potentialLabelWidthArr.value.splice(index, 1, val);
- } else if (val) {
- potentialLabelWidthArr.value.push(val);
- }
- }
- function deregisterLabelWidth(val) {
- const index = getLabelWidthIndex(val);
- if (index > -1) {
- potentialLabelWidthArr.value.splice(index, 1);
- }
- }
- return {
- autoLabelWidth,
- registerLabelWidth,
- deregisterLabelWidth
- };
- }
- const filterFields = (fields, props) => {
- const normalized = castArray$1(props);
- return normalized.length > 0 ? fields.filter((field) => field.prop && normalized.includes(field.prop)) : fields;
- };
- const __default__$9 = {
- name: "ElForm"
- };
- const _sfc_main$v = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$9), {
- props: formProps,
- emits: formEmits,
- setup(__props, { expose, emit }) {
- const props = __props;
- const fields = [];
- const formSize = useSize();
- const ns = useNamespace("form");
- const formClasses = computed(() => {
- const { labelPosition, inline } = props;
- return [
- ns.b(),
- ns.m(formSize.value || "default"),
- {
- [ns.m(`label-${labelPosition}`)]: labelPosition,
- [ns.m("inline")]: inline
- }
- ];
- });
- const addField = (field) => {
- fields.push(field);
- };
- const removeField = (field) => {
- if (field.prop) {
- fields.splice(fields.indexOf(field), 1);
- }
- };
- const resetFields = (properties = []) => {
- if (!props.model) {
- return;
- }
- filterFields(fields, properties).forEach((field) => field.resetField());
- };
- const clearValidate = (props2 = []) => {
- filterFields(fields, props2).forEach((field) => field.clearValidate());
- };
- const isValidatable = computed(() => {
- const hasModel = !!props.model;
- return hasModel;
- });
- const obtainValidateFields = (props2) => {
- if (fields.length === 0)
- return [];
- const filteredFields = filterFields(fields, props2);
- if (!filteredFields.length) {
- return [];
- }
- return filteredFields;
- };
- const validate = async (callback) => validateField(void 0, callback);
- const doValidateField = async (props2 = []) => {
- if (!isValidatable.value)
- return false;
- const fields2 = obtainValidateFields(props2);
- if (fields2.length === 0)
- return true;
- let validationErrors = {};
- for (const field of fields2) {
- try {
- await field.validate("");
- } catch (fields3) {
- validationErrors = __spreadValues(__spreadValues({}, validationErrors), fields3);
- }
- }
- if (Object.keys(validationErrors).length === 0)
- return true;
- return Promise.reject(validationErrors);
- };
- const validateField = async (modelProps = [], callback) => {
- const shouldThrow = !isFunction(callback);
- try {
- const result = await doValidateField(modelProps);
- if (result === true) {
- callback == null ? void 0 : callback(result);
- }
- return result;
- } catch (e) {
- const invalidFields = e;
- if (props.scrollToError) {
- scrollToField(Object.keys(invalidFields)[0]);
- }
- callback == null ? void 0 : callback(false, invalidFields);
- return shouldThrow && Promise.reject(invalidFields);
- }
- };
- const scrollToField = (prop) => {
- var _a2;
- const field = filterFields(fields, prop)[0];
- if (field) {
- (_a2 = field.$el) == null ? void 0 : _a2.scrollIntoView();
- }
- };
- watch(() => props.rules, () => {
- if (props.validateOnRuleChange)
- validate();
- }, { deep: true });
- provide(formContextKey, reactive(__spreadValues(__spreadProps(__spreadValues({}, toRefs(props)), {
- emit,
- resetFields,
- clearValidate,
- validateField,
- addField,
- removeField
- }), useFormLabelWidth())));
- expose({
- validate,
- validateField,
- resetFields,
- clearValidate,
- scrollToField
- });
- return (_ctx, _cache) => {
- return openBlock(), createElementBlock("form", {
- class: normalizeClass(unref(formClasses))
- }, [
- renderSlot(_ctx.$slots, "default")
- ], 2);
- };
- }
- }));
- var Form = /* @__PURE__ */ _export_sfc$1(_sfc_main$v, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/form/src/form.vue"]]);
- function _extends$1() {
- _extends$1 = Object.assign ? Object.assign.bind() : function(target) {
- for (var i = 1; i < arguments.length; i++) {
- var source = arguments[i];
- for (var key in source) {
- if (Object.prototype.hasOwnProperty.call(source, key)) {
- target[key] = source[key];
- }
- }
- }
- return target;
- };
- return _extends$1.apply(this, arguments);
- }
- function _inheritsLoose(subClass, superClass) {
- subClass.prototype = Object.create(superClass.prototype);
- subClass.prototype.constructor = subClass;
- _setPrototypeOf(subClass, superClass);
- }
- function _getPrototypeOf(o2) {
- _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf2(o3) {
- return o3.__proto__ || Object.getPrototypeOf(o3);
- };
- return _getPrototypeOf(o2);
- }
- function _setPrototypeOf(o2, p2) {
- _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o3, p3) {
- o3.__proto__ = p3;
- return o3;
- };
- return _setPrototypeOf(o2, p2);
- }
- function _isNativeReflectConstruct() {
- if (typeof Reflect === "undefined" || !Reflect.construct)
- return false;
- if (Reflect.construct.sham)
- return false;
- if (typeof Proxy === "function")
- return true;
- try {
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
- }));
- return true;
- } catch (e) {
- return false;
- }
- }
- function _construct(Parent, args, Class) {
- if (_isNativeReflectConstruct()) {
- _construct = Reflect.construct.bind();
- } else {
- _construct = function _construct2(Parent2, args2, Class2) {
- var a2 = [null];
- a2.push.apply(a2, args2);
- var Constructor = Function.bind.apply(Parent2, a2);
- var instance = new Constructor();
- if (Class2)
- _setPrototypeOf(instance, Class2.prototype);
- return instance;
- };
- }
- return _construct.apply(null, arguments);
- }
- function _isNativeFunction(fn2) {
- return Function.toString.call(fn2).indexOf("[native code]") !== -1;
- }
- function _wrapNativeSuper(Class) {
- var _cache = typeof Map === "function" ? /* @__PURE__ */ new Map() : void 0;
- _wrapNativeSuper = function _wrapNativeSuper2(Class2) {
- if (Class2 === null || !_isNativeFunction(Class2))
- return Class2;
- if (typeof Class2 !== "function") {
- throw new TypeError("Super expression must either be null or a function");
- }
- if (typeof _cache !== "undefined") {
- if (_cache.has(Class2))
- return _cache.get(Class2);
- _cache.set(Class2, Wrapper);
- }
- function Wrapper() {
- return _construct(Class2, arguments, _getPrototypeOf(this).constructor);
- }
- Wrapper.prototype = Object.create(Class2.prototype, {
- constructor: {
- value: Wrapper,
- enumerable: false,
- writable: true,
- configurable: true
- }
- });
- return _setPrototypeOf(Wrapper, Class2);
- };
- return _wrapNativeSuper(Class);
- }
- var formatRegExp = /%[sdj%]/g;
- var warning = function warning2() {
- };
- if (typeof process !== "undefined" && process.env && false) {
- warning = function warning3(type4, errors) {
- if (typeof console !== "undefined" && console.warn && typeof ASYNC_VALIDATOR_NO_WARNING === "undefined") {
- if (errors.every(function(e) {
- return typeof e === "string";
- })) {
- console.warn(type4, errors);
- }
- }
- };
- }
- function convertFieldsError(errors) {
- if (!errors || !errors.length)
- return null;
- var fields = {};
- errors.forEach(function(error) {
- var field = error.field;
- fields[field] = fields[field] || [];
- fields[field].push(error);
- });
- return fields;
- }
- function format(template) {
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
- args[_key - 1] = arguments[_key];
- }
- var i = 0;
- var len = args.length;
- if (typeof template === "function") {
- return template.apply(null, args);
- }
- if (typeof template === "string") {
- var str = template.replace(formatRegExp, function(x2) {
- if (x2 === "%%") {
- return "%";
- }
- if (i >= len) {
- return x2;
- }
- switch (x2) {
- case "%s":
- return String(args[i++]);
- case "%d":
- return Number(args[i++]);
- case "%j":
- try {
- return JSON.stringify(args[i++]);
- } catch (_2) {
- return "[Circular]";
- }
- break;
- default:
- return x2;
- }
- });
- return str;
- }
- return template;
- }
- function isNativeStringType(type4) {
- return type4 === "string" || type4 === "url" || type4 === "hex" || type4 === "email" || type4 === "date" || type4 === "pattern";
- }
- function isEmptyValue(value, type4) {
- if (value === void 0 || value === null) {
- return true;
- }
- if (type4 === "array" && Array.isArray(value) && !value.length) {
- return true;
- }
- if (isNativeStringType(type4) && typeof value === "string" && !value) {
- return true;
- }
- return false;
- }
- function asyncParallelArray(arr, func, callback) {
- var results = [];
- var total = 0;
- var arrLength = arr.length;
- function count(errors) {
- results.push.apply(results, errors || []);
- total++;
- if (total === arrLength) {
- callback(results);
- }
- }
- arr.forEach(function(a2) {
- func(a2, count);
- });
- }
- function asyncSerialArray(arr, func, callback) {
- var index = 0;
- var arrLength = arr.length;
- function next(errors) {
- if (errors && errors.length) {
- callback(errors);
- return;
- }
- var original = index;
- index = index + 1;
- if (original < arrLength) {
- func(arr[original], next);
- } else {
- callback([]);
- }
- }
- next([]);
- }
- function flattenObjArr(objArr) {
- var ret = [];
- Object.keys(objArr).forEach(function(k) {
- ret.push.apply(ret, objArr[k] || []);
- });
- return ret;
- }
- var AsyncValidationError = /* @__PURE__ */ function(_Error) {
- _inheritsLoose(AsyncValidationError2, _Error);
- function AsyncValidationError2(errors, fields) {
- var _this;
- _this = _Error.call(this, "Async Validation Error") || this;
- _this.errors = errors;
- _this.fields = fields;
- return _this;
- }
- return AsyncValidationError2;
- }(/* @__PURE__ */ _wrapNativeSuper(Error));
- function asyncMap(objArr, option, func, callback, source) {
- if (option.first) {
- var _pending = new Promise(function(resolve, reject) {
- var next = function next2(errors) {
- callback(errors);
- return errors.length ? reject(new AsyncValidationError(errors, convertFieldsError(errors))) : resolve(source);
- };
- var flattenArr = flattenObjArr(objArr);
- asyncSerialArray(flattenArr, func, next);
- });
- _pending["catch"](function(e) {
- return e;
- });
- return _pending;
- }
- var firstFields = option.firstFields === true ? Object.keys(objArr) : option.firstFields || [];
- var objArrKeys = Object.keys(objArr);
- var objArrLength = objArrKeys.length;
- var total = 0;
- var results = [];
- var pending = new Promise(function(resolve, reject) {
- var next = function next2(errors) {
- results.push.apply(results, errors);
- total++;
- if (total === objArrLength) {
- callback(results);
- return results.length ? reject(new AsyncValidationError(results, convertFieldsError(results))) : resolve(source);
- }
- };
- if (!objArrKeys.length) {
- callback(results);
- resolve(source);
- }
- objArrKeys.forEach(function(key) {
- var arr = objArr[key];
- if (firstFields.indexOf(key) !== -1) {
- asyncSerialArray(arr, func, next);
- } else {
- asyncParallelArray(arr, func, next);
- }
- });
- });
- pending["catch"](function(e) {
- return e;
- });
- return pending;
- }
- function isErrorObj(obj) {
- return !!(obj && obj.message !== void 0);
- }
- function getValue(value, path) {
- var v2 = value;
- for (var i = 0; i < path.length; i++) {
- if (v2 == void 0) {
- return v2;
- }
- v2 = v2[path[i]];
- }
- return v2;
- }
- function complementError(rule, source) {
- return function(oe) {
- var fieldValue;
- if (rule.fullFields) {
- fieldValue = getValue(source, rule.fullFields);
- } else {
- fieldValue = source[oe.field || rule.fullField];
- }
- if (isErrorObj(oe)) {
- oe.field = oe.field || rule.fullField;
- oe.fieldValue = fieldValue;
- return oe;
- }
- return {
- message: typeof oe === "function" ? oe() : oe,
- fieldValue,
- field: oe.field || rule.fullField
- };
- };
- }
- function deepMerge(target, source) {
- if (source) {
- for (var s2 in source) {
- if (source.hasOwnProperty(s2)) {
- var value = source[s2];
- if (typeof value === "object" && typeof target[s2] === "object") {
- target[s2] = _extends$1({}, target[s2], value);
- } else {
- target[s2] = value;
- }
- }
- }
- }
- return target;
- }
- var required$1 = function required(rule, value, source, errors, options, type4) {
- if (rule.required && (!source.hasOwnProperty(rule.field) || isEmptyValue(value, type4 || rule.type))) {
- errors.push(format(options.messages.required, rule.fullField));
- }
- };
- var whitespace = function whitespace2(rule, value, source, errors, options) {
- if (/^\s+$/.test(value) || value === "") {
- errors.push(format(options.messages.whitespace, rule.fullField));
- }
- };
- var urlReg;
- var getUrlRegex = function() {
- if (urlReg) {
- return urlReg;
- }
- var word = "[a-fA-F\\d:]";
- var b2 = function b3(options) {
- return options && options.includeBoundaries ? "(?:(?<=\\s|^)(?=" + word + ")|(?<=" + word + ")(?=\\s|$))" : "";
- };
- 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}";
- var v6seg = "[a-fA-F\\d]{1,4}";
- 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();
- var v46Exact = new RegExp("(?:^" + v4 + "$)|(?:^" + v6 + "$)");
- var v4exact = new RegExp("^" + v4 + "$");
- var v6exact = new RegExp("^" + v6 + "$");
- var ip = function ip2(options) {
- return options && options.exact ? v46Exact : new RegExp("(?:" + b2(options) + v4 + b2(options) + ")|(?:" + b2(options) + v6 + b2(options) + ")", "g");
- };
- ip.v4 = function(options) {
- return options && options.exact ? v4exact : new RegExp("" + b2(options) + v4 + b2(options), "g");
- };
- ip.v6 = function(options) {
- return options && options.exact ? v6exact : new RegExp("" + b2(options) + v6 + b2(options), "g");
- };
- var protocol = "(?:(?:[a-z]+:)?//)";
- var auth = "(?:\\S+(?::\\S*)?@)?";
- var ipv4 = ip.v4().source;
- var ipv6 = ip.v6().source;
- var host = "(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)";
- var domain = "(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*";
- var tld = "(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))";
- var port = "(?::\\d{2,5})?";
- var path = '(?:[/?#][^\\s"]*)?';
- var regex = "(?:" + protocol + "|www\\.)" + auth + "(?:localhost|" + ipv4 + "|" + ipv6 + "|" + host + domain + tld + ")" + port + path;
- urlReg = new RegExp("(?:^" + regex + "$)", "i");
- return urlReg;
- };
- var pattern$2 = {
- 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,}))$/,
- hex: /^#?([a-f0-9]{6}|[a-f0-9]{3})$/i
- };
- var types = {
- integer: function integer(value) {
- return types.number(value) && parseInt(value, 10) === value;
- },
- "float": function float(value) {
- return types.number(value) && !types.integer(value);
- },
- array: function array(value) {
- return Array.isArray(value);
- },
- regexp: function regexp(value) {
- if (value instanceof RegExp) {
- return true;
- }
- try {
- return !!new RegExp(value);
- } catch (e) {
- return false;
- }
- },
- date: function date(value) {
- return typeof value.getTime === "function" && typeof value.getMonth === "function" && typeof value.getYear === "function" && !isNaN(value.getTime());
- },
- number: function number(value) {
- if (isNaN(value)) {
- return false;
- }
- return typeof value === "number";
- },
- object: function object(value) {
- return typeof value === "object" && !types.array(value);
- },
- method: function method(value) {
- return typeof value === "function";
- },
- email: function email(value) {
- return typeof value === "string" && value.length <= 320 && !!value.match(pattern$2.email);
- },
- url: function url(value) {
- return typeof value === "string" && value.length <= 2048 && !!value.match(getUrlRegex());
- },
- hex: function hex(value) {
- return typeof value === "string" && !!value.match(pattern$2.hex);
- }
- };
- var type$1 = function type(rule, value, source, errors, options) {
- if (rule.required && value === void 0) {
- required$1(rule, value, source, errors, options);
- return;
- }
- var custom = ["integer", "float", "array", "regexp", "object", "method", "email", "number", "date", "url", "hex"];
- var ruleType = rule.type;
- if (custom.indexOf(ruleType) > -1) {
- if (!types[ruleType](value)) {
- errors.push(format(options.messages.types[ruleType], rule.fullField, rule.type));
- }
- } else if (ruleType && typeof value !== rule.type) {
- errors.push(format(options.messages.types[ruleType], rule.fullField, rule.type));
- }
- };
- var range = function range2(rule, value, source, errors, options) {
- var len = typeof rule.len === "number";
- var min2 = typeof rule.min === "number";
- var max2 = typeof rule.max === "number";
- var spRegexp = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
- var val = value;
- var key = null;
- var num = typeof value === "number";
- var str = typeof value === "string";
- var arr = Array.isArray(value);
- if (num) {
- key = "number";
- } else if (str) {
- key = "string";
- } else if (arr) {
- key = "array";
- }
- if (!key) {
- return false;
- }
- if (arr) {
- val = value.length;
- }
- if (str) {
- val = value.replace(spRegexp, "_").length;
- }
- if (len) {
- if (val !== rule.len) {
- errors.push(format(options.messages[key].len, rule.fullField, rule.len));
- }
- } else if (min2 && !max2 && val < rule.min) {
- errors.push(format(options.messages[key].min, rule.fullField, rule.min));
- } else if (max2 && !min2 && val > rule.max) {
- errors.push(format(options.messages[key].max, rule.fullField, rule.max));
- } else if (min2 && max2 && (val < rule.min || val > rule.max)) {
- errors.push(format(options.messages[key].range, rule.fullField, rule.min, rule.max));
- }
- };
- var ENUM$1 = "enum";
- var enumerable$1 = function enumerable(rule, value, source, errors, options) {
- rule[ENUM$1] = Array.isArray(rule[ENUM$1]) ? rule[ENUM$1] : [];
- if (rule[ENUM$1].indexOf(value) === -1) {
- errors.push(format(options.messages[ENUM$1], rule.fullField, rule[ENUM$1].join(", ")));
- }
- };
- var pattern$1 = function pattern(rule, value, source, errors, options) {
- if (rule.pattern) {
- if (rule.pattern instanceof RegExp) {
- rule.pattern.lastIndex = 0;
- if (!rule.pattern.test(value)) {
- errors.push(format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern));
- }
- } else if (typeof rule.pattern === "string") {
- var _pattern = new RegExp(rule.pattern);
- if (!_pattern.test(value)) {
- errors.push(format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern));
- }
- }
- }
- };
- var rules = {
- required: required$1,
- whitespace,
- type: type$1,
- range,
- "enum": enumerable$1,
- pattern: pattern$1
- };
- var string = function string2(rule, value, callback, source, options) {
- var errors = [];
- var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
- if (validate) {
- if (isEmptyValue(value, "string") && !rule.required) {
- return callback();
- }
- rules.required(rule, value, source, errors, options, "string");
- if (!isEmptyValue(value, "string")) {
- rules.type(rule, value, source, errors, options);
- rules.range(rule, value, source, errors, options);
- rules.pattern(rule, value, source, errors, options);
- if (rule.whitespace === true) {
- rules.whitespace(rule, value, source, errors, options);
- }
- }
- }
- callback(errors);
- };
- var method2 = function method3(rule, value, callback, source, options) {
- var errors = [];
- var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
- if (validate) {
- if (isEmptyValue(value) && !rule.required) {
- return callback();
- }
- rules.required(rule, value, source, errors, options);
- if (value !== void 0) {
- rules.type(rule, value, source, errors, options);
- }
- }
- callback(errors);
- };
- var number2 = function number3(rule, value, callback, source, options) {
- var errors = [];
- var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
- if (validate) {
- if (value === "") {
- value = void 0;
- }
- if (isEmptyValue(value) && !rule.required) {
- return callback();
- }
- rules.required(rule, value, source, errors, options);
- if (value !== void 0) {
- rules.type(rule, value, source, errors, options);
- rules.range(rule, value, source, errors, options);
- }
- }
- callback(errors);
- };
- var _boolean = function _boolean2(rule, value, callback, source, options) {
- var errors = [];
- var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
- if (validate) {
- if (isEmptyValue(value) && !rule.required) {
- return callback();
- }
- rules.required(rule, value, source, errors, options);
- if (value !== void 0) {
- rules.type(rule, value, source, errors, options);
- }
- }
- callback(errors);
- };
- var regexp2 = function regexp3(rule, value, callback, source, options) {
- var errors = [];
- var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
- if (validate) {
- if (isEmptyValue(value) && !rule.required) {
- return callback();
- }
- rules.required(rule, value, source, errors, options);
- if (!isEmptyValue(value)) {
- rules.type(rule, value, source, errors, options);
- }
- }
- callback(errors);
- };
- var integer2 = function integer3(rule, value, callback, source, options) {
- var errors = [];
- var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
- if (validate) {
- if (isEmptyValue(value) && !rule.required) {
- return callback();
- }
- rules.required(rule, value, source, errors, options);
- if (value !== void 0) {
- rules.type(rule, value, source, errors, options);
- rules.range(rule, value, source, errors, options);
- }
- }
- callback(errors);
- };
- var floatFn = function floatFn2(rule, value, callback, source, options) {
- var errors = [];
- var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
- if (validate) {
- if (isEmptyValue(value) && !rule.required) {
- return callback();
- }
- rules.required(rule, value, source, errors, options);
- if (value !== void 0) {
- rules.type(rule, value, source, errors, options);
- rules.range(rule, value, source, errors, options);
- }
- }
- callback(errors);
- };
- var array2 = function array3(rule, value, callback, source, options) {
- var errors = [];
- var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
- if (validate) {
- if ((value === void 0 || value === null) && !rule.required) {
- return callback();
- }
- rules.required(rule, value, source, errors, options, "array");
- if (value !== void 0 && value !== null) {
- rules.type(rule, value, source, errors, options);
- rules.range(rule, value, source, errors, options);
- }
- }
- callback(errors);
- };
- var object2 = function object3(rule, value, callback, source, options) {
- var errors = [];
- var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
- if (validate) {
- if (isEmptyValue(value) && !rule.required) {
- return callback();
- }
- rules.required(rule, value, source, errors, options);
- if (value !== void 0) {
- rules.type(rule, value, source, errors, options);
- }
- }
- callback(errors);
- };
- var ENUM = "enum";
- var enumerable2 = function enumerable3(rule, value, callback, source, options) {
- var errors = [];
- var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
- if (validate) {
- if (isEmptyValue(value) && !rule.required) {
- return callback();
- }
- rules.required(rule, value, source, errors, options);
- if (value !== void 0) {
- rules[ENUM](rule, value, source, errors, options);
- }
- }
- callback(errors);
- };
- var pattern2 = function pattern3(rule, value, callback, source, options) {
- var errors = [];
- var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
- if (validate) {
- if (isEmptyValue(value, "string") && !rule.required) {
- return callback();
- }
- rules.required(rule, value, source, errors, options);
- if (!isEmptyValue(value, "string")) {
- rules.pattern(rule, value, source, errors, options);
- }
- }
- callback(errors);
- };
- var date2 = function date3(rule, value, callback, source, options) {
- var errors = [];
- var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
- if (validate) {
- if (isEmptyValue(value, "date") && !rule.required) {
- return callback();
- }
- rules.required(rule, value, source, errors, options);
- if (!isEmptyValue(value, "date")) {
- var dateObject;
- if (value instanceof Date) {
- dateObject = value;
- } else {
- dateObject = new Date(value);
- }
- rules.type(rule, dateObject, source, errors, options);
- if (dateObject) {
- rules.range(rule, dateObject.getTime(), source, errors, options);
- }
- }
- }
- callback(errors);
- };
- var required2 = function required3(rule, value, callback, source, options) {
- var errors = [];
- var type4 = Array.isArray(value) ? "array" : typeof value;
- rules.required(rule, value, source, errors, options, type4);
- callback(errors);
- };
- var type2 = function type3(rule, value, callback, source, options) {
- var ruleType = rule.type;
- var errors = [];
- var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
- if (validate) {
- if (isEmptyValue(value, ruleType) && !rule.required) {
- return callback();
- }
- rules.required(rule, value, source, errors, options, ruleType);
- if (!isEmptyValue(value, ruleType)) {
- rules.type(rule, value, source, errors, options);
- }
- }
- callback(errors);
- };
- var any = function any2(rule, value, callback, source, options) {
- var errors = [];
- var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
- if (validate) {
- if (isEmptyValue(value) && !rule.required) {
- return callback();
- }
- rules.required(rule, value, source, errors, options);
- }
- callback(errors);
- };
- var validators = {
- string,
- method: method2,
- number: number2,
- "boolean": _boolean,
- regexp: regexp2,
- integer: integer2,
- "float": floatFn,
- array: array2,
- object: object2,
- "enum": enumerable2,
- pattern: pattern2,
- date: date2,
- url: type2,
- hex: type2,
- email: type2,
- required: required2,
- any
- };
- function newMessages() {
- return {
- "default": "Validation error on field %s",
- required: "%s is required",
- "enum": "%s must be one of %s",
- whitespace: "%s cannot be empty",
- date: {
- format: "%s date %s is invalid for format %s",
- parse: "%s date could not be parsed, %s is invalid ",
- invalid: "%s date %s is invalid"
- },
- types: {
- string: "%s is not a %s",
- method: "%s is not a %s (function)",
- array: "%s is not an %s",
- object: "%s is not an %s",
- number: "%s is not a %s",
- date: "%s is not a %s",
- "boolean": "%s is not a %s",
- integer: "%s is not an %s",
- "float": "%s is not a %s",
- regexp: "%s is not a valid %s",
- email: "%s is not a valid %s",
- url: "%s is not a valid %s",
- hex: "%s is not a valid %s"
- },
- string: {
- len: "%s must be exactly %s characters",
- min: "%s must be at least %s characters",
- max: "%s cannot be longer than %s characters",
- range: "%s must be between %s and %s characters"
- },
- number: {
- len: "%s must equal %s",
- min: "%s cannot be less than %s",
- max: "%s cannot be greater than %s",
- range: "%s must be between %s and %s"
- },
- array: {
- len: "%s must be exactly %s in length",
- min: "%s cannot be less than %s in length",
- max: "%s cannot be greater than %s in length",
- range: "%s must be between %s and %s in length"
- },
- pattern: {
- mismatch: "%s value %s does not match pattern %s"
- },
- clone: function clone2() {
- var cloned = JSON.parse(JSON.stringify(this));
- cloned.clone = this.clone;
- return cloned;
- }
- };
- }
- var messages = newMessages();
- var Schema = /* @__PURE__ */ function() {
- function Schema2(descriptor) {
- this.rules = null;
- this._messages = messages;
- this.define(descriptor);
- }
- var _proto = Schema2.prototype;
- _proto.define = function define(rules2) {
- var _this = this;
- if (!rules2) {
- throw new Error("Cannot configure a schema with no rules");
- }
- if (typeof rules2 !== "object" || Array.isArray(rules2)) {
- throw new Error("Rules must be an object");
- }
- this.rules = {};
- Object.keys(rules2).forEach(function(name) {
- var item = rules2[name];
- _this.rules[name] = Array.isArray(item) ? item : [item];
- });
- };
- _proto.messages = function messages2(_messages) {
- if (_messages) {
- this._messages = deepMerge(newMessages(), _messages);
- }
- return this._messages;
- };
- _proto.validate = function validate(source_, o2, oc) {
- var _this2 = this;
- if (o2 === void 0) {
- o2 = {};
- }
- if (oc === void 0) {
- oc = function oc2() {
- };
- }
- var source = source_;
- var options = o2;
- var callback = oc;
- if (typeof options === "function") {
- callback = options;
- options = {};
- }
- if (!this.rules || Object.keys(this.rules).length === 0) {
- if (callback) {
- callback(null, source);
- }
- return Promise.resolve(source);
- }
- function complete(results) {
- var errors = [];
- var fields = {};
- function add(e) {
- if (Array.isArray(e)) {
- var _errors;
- errors = (_errors = errors).concat.apply(_errors, e);
- } else {
- errors.push(e);
- }
- }
- for (var i = 0; i < results.length; i++) {
- add(results[i]);
- }
- if (!errors.length) {
- callback(null, source);
- } else {
- fields = convertFieldsError(errors);
- callback(errors, fields);
- }
- }
- if (options.messages) {
- var messages$1 = this.messages();
- if (messages$1 === messages) {
- messages$1 = newMessages();
- }
- deepMerge(messages$1, options.messages);
- options.messages = messages$1;
- } else {
- options.messages = this.messages();
- }
- var series = {};
- var keys2 = options.keys || Object.keys(this.rules);
- keys2.forEach(function(z) {
- var arr = _this2.rules[z];
- var value = source[z];
- arr.forEach(function(r) {
- var rule = r;
- if (typeof rule.transform === "function") {
- if (source === source_) {
- source = _extends$1({}, source);
- }
- value = source[z] = rule.transform(value);
- }
- if (typeof rule === "function") {
- rule = {
- validator: rule
- };
- } else {
- rule = _extends$1({}, rule);
- }
- rule.validator = _this2.getValidationMethod(rule);
- if (!rule.validator) {
- return;
- }
- rule.field = z;
- rule.fullField = rule.fullField || z;
- rule.type = _this2.getType(rule);
- series[z] = series[z] || [];
- series[z].push({
- rule,
- value,
- source,
- field: z
- });
- });
- });
- var errorFields = {};
- return asyncMap(series, options, function(data2, doIt) {
- var rule = data2.rule;
- var deep = (rule.type === "object" || rule.type === "array") && (typeof rule.fields === "object" || typeof rule.defaultField === "object");
- deep = deep && (rule.required || !rule.required && data2.value);
- rule.field = data2.field;
- function addFullField(key, schema) {
- return _extends$1({}, schema, {
- fullField: rule.fullField + "." + key,
- fullFields: rule.fullFields ? [].concat(rule.fullFields, [key]) : [key]
- });
- }
- function cb(e) {
- if (e === void 0) {
- e = [];
- }
- var errorList = Array.isArray(e) ? e : [e];
- if (!options.suppressWarning && errorList.length) {
- Schema2.warning("async-validator:", errorList);
- }
- if (errorList.length && rule.message !== void 0) {
- errorList = [].concat(rule.message);
- }
- var filledErrors = errorList.map(complementError(rule, source));
- if (options.first && filledErrors.length) {
- errorFields[rule.field] = 1;
- return doIt(filledErrors);
- }
- if (!deep) {
- doIt(filledErrors);
- } else {
- if (rule.required && !data2.value) {
- if (rule.message !== void 0) {
- filledErrors = [].concat(rule.message).map(complementError(rule, source));
- } else if (options.error) {
- filledErrors = [options.error(rule, format(options.messages.required, rule.field))];
- }
- return doIt(filledErrors);
- }
- var fieldsSchema = {};
- if (rule.defaultField) {
- Object.keys(data2.value).map(function(key) {
- fieldsSchema[key] = rule.defaultField;
- });
- }
- fieldsSchema = _extends$1({}, fieldsSchema, data2.rule.fields);
- var paredFieldsSchema = {};
- Object.keys(fieldsSchema).forEach(function(field) {
- var fieldSchema = fieldsSchema[field];
- var fieldSchemaList = Array.isArray(fieldSchema) ? fieldSchema : [fieldSchema];
- paredFieldsSchema[field] = fieldSchemaList.map(addFullField.bind(null, field));
- });
- var schema = new Schema2(paredFieldsSchema);
- schema.messages(options.messages);
- if (data2.rule.options) {
- data2.rule.options.messages = options.messages;
- data2.rule.options.error = options.error;
- }
- schema.validate(data2.value, data2.rule.options || options, function(errs) {
- var finalErrors = [];
- if (filledErrors && filledErrors.length) {
- finalErrors.push.apply(finalErrors, filledErrors);
- }
- if (errs && errs.length) {
- finalErrors.push.apply(finalErrors, errs);
- }
- doIt(finalErrors.length ? finalErrors : null);
- });
- }
- }
- var res;
- if (rule.asyncValidator) {
- res = rule.asyncValidator(rule, data2.value, cb, data2.source, options);
- } else if (rule.validator) {
- try {
- res = rule.validator(rule, data2.value, cb, data2.source, options);
- } catch (error) {
- console.error == null ? void 0 : console.error(error);
- if (!options.suppressValidatorError) {
- setTimeout(function() {
- throw error;
- }, 0);
- }
- cb(error.message);
- }
- if (res === true) {
- cb();
- } else if (res === false) {
- cb(typeof rule.message === "function" ? rule.message(rule.fullField || rule.field) : rule.message || (rule.fullField || rule.field) + " fails");
- } else if (res instanceof Array) {
- cb(res);
- } else if (res instanceof Error) {
- cb(res.message);
- }
- }
- if (res && res.then) {
- res.then(function() {
- return cb();
- }, function(e) {
- return cb(e);
- });
- }
- }, function(results) {
- complete(results);
- }, source);
- };
- _proto.getType = function getType(rule) {
- if (rule.type === void 0 && rule.pattern instanceof RegExp) {
- rule.type = "pattern";
- }
- if (typeof rule.validator !== "function" && rule.type && !validators.hasOwnProperty(rule.type)) {
- throw new Error(format("Unknown rule type %s", rule.type));
- }
- return rule.type || "string";
- };
- _proto.getValidationMethod = function getValidationMethod(rule) {
- if (typeof rule.validator === "function") {
- return rule.validator;
- }
- var keys2 = Object.keys(rule);
- var messageIndex = keys2.indexOf("message");
- if (messageIndex !== -1) {
- keys2.splice(messageIndex, 1);
- }
- if (keys2.length === 1 && keys2[0] === "required") {
- return validators.required;
- }
- return validators[this.getType(rule)] || void 0;
- };
- return Schema2;
- }();
- Schema.register = function register(type4, validator) {
- if (typeof validator !== "function") {
- throw new Error("Cannot register a validator by type, validator is not a function");
- }
- validators[type4] = validator;
- };
- Schema.warning = warning;
- Schema.messages = messages;
- Schema.validators = validators;
- const formItemValidateStates = [
- "",
- "error",
- "validating",
- "success"
- ];
- const formItemProps = buildProps({
- label: String,
- labelWidth: {
- type: [String, Number],
- default: ""
- },
- prop: {
- type: definePropType([String, Array])
- },
- required: {
- type: Boolean,
- default: void 0
- },
- rules: {
- type: definePropType([Object, Array])
- },
- error: String,
- validateStatus: {
- type: String,
- values: formItemValidateStates
- },
- for: String,
- inlineMessage: {
- type: [String, Boolean],
- default: ""
- },
- showMessage: {
- type: Boolean,
- default: true
- },
- size: {
- type: String,
- values: componentSizes
- }
- });
- const COMPONENT_NAME$2 = "ElLabelWrap";
- var FormLabelWrap = defineComponent({
- name: COMPONENT_NAME$2,
- props: {
- isAutoWidth: Boolean,
- updateAll: Boolean
- },
- setup(props, {
- slots
- }) {
- const formContext = inject(formContextKey, void 0);
- const formItemContext = inject(formItemContextKey);
- if (!formItemContext)
- throwError(COMPONENT_NAME$2, "usage: <el-form-item><label-wrap /></el-form-item>");
- const ns = useNamespace("form");
- const el = ref();
- const computedWidth = ref(0);
- const getLabelWidth = () => {
- var _a2;
- if ((_a2 = el.value) == null ? void 0 : _a2.firstElementChild) {
- const width = window.getComputedStyle(el.value.firstElementChild).width;
- return Math.ceil(Number.parseFloat(width));
- } else {
- return 0;
- }
- };
- const updateLabelWidth = (action = "update") => {
- nextTick(() => {
- if (slots.default && props.isAutoWidth) {
- if (action === "update") {
- computedWidth.value = getLabelWidth();
- } else if (action === "remove") {
- formContext == null ? void 0 : formContext.deregisterLabelWidth(computedWidth.value);
- }
- }
- });
- };
- const updateLabelWidthFn = () => updateLabelWidth("update");
- onMounted(() => {
- updateLabelWidthFn();
- });
- onBeforeUnmount(() => {
- updateLabelWidth("remove");
- });
- onUpdated(() => updateLabelWidthFn());
- watch(computedWidth, (val, oldVal) => {
- if (props.updateAll) {
- formContext == null ? void 0 : formContext.registerLabelWidth(val, oldVal);
- }
- });
- useResizeObserver(computed(() => {
- var _a2, _b2;
- return (_b2 = (_a2 = el.value) == null ? void 0 : _a2.firstElementChild) != null ? _b2 : null;
- }), updateLabelWidthFn);
- return () => {
- var _a2, _b2;
- if (!slots)
- return null;
- const {
- isAutoWidth
- } = props;
- if (isAutoWidth) {
- const autoLabelWidth = formContext == null ? void 0 : formContext.autoLabelWidth;
- const style = {};
- if (autoLabelWidth && autoLabelWidth !== "auto") {
- const marginWidth = Math.max(0, Number.parseInt(autoLabelWidth, 10) - computedWidth.value);
- const marginPosition = formContext.labelPosition === "left" ? "marginRight" : "marginLeft";
- if (marginWidth) {
- style[marginPosition] = `${marginWidth}px`;
- }
- }
- return createVNode("div", {
- "ref": el,
- "class": [ns.be("item", "label-wrap")],
- "style": style
- }, [(_a2 = slots.default) == null ? void 0 : _a2.call(slots)]);
- } else {
- return createVNode(Fragment, {
- "ref": el
- }, [(_b2 = slots.default) == null ? void 0 : _b2.call(slots)]);
- }
- };
- }
- });
- const _hoisted_1$k = ["for"];
- const __default__$8 = {
- name: "ElFormItem"
- };
- const _sfc_main$u = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$8), {
- props: formItemProps,
- setup(__props, { expose }) {
- const props = __props;
- const slots = useSlots();
- const formContext = inject(formContextKey, void 0);
- const parentFormItemContext = inject(formItemContextKey, void 0);
- const _size = useSize(void 0, { formItem: false });
- const ns = useNamespace("form-item");
- const validateState = ref("");
- const validateStateDebounced = refDebounced(validateState, 100);
- const validateMessage = ref("");
- const formItemRef = ref();
- let initialValue = void 0;
- let isResettingField = false;
- const labelStyle = computed(() => {
- if ((formContext == null ? void 0 : formContext.labelPosition) === "top") {
- return {};
- }
- const labelWidth = addUnit(props.labelWidth || (formContext == null ? void 0 : formContext.labelWidth) || "");
- if (labelWidth)
- return { width: labelWidth };
- return {};
- });
- const contentStyle = computed(() => {
- if ((formContext == null ? void 0 : formContext.labelPosition) === "top" || (formContext == null ? void 0 : formContext.inline)) {
- return {};
- }
- if (!props.label && !props.labelWidth && isNested) {
- return {};
- }
- const labelWidth = addUnit(props.labelWidth || (formContext == null ? void 0 : formContext.labelWidth) || "");
- if (!props.label && !slots.label) {
- return { marginLeft: labelWidth };
- }
- return {};
- });
- const formItemClasses = computed(() => [
- ns.b(),
- ns.m(_size.value),
- ns.is("error", validateState.value === "error"),
- ns.is("validating", validateState.value === "validating"),
- ns.is("success", validateState.value === "success"),
- ns.is("required", isRequired.value || props.required),
- ns.is("no-asterisk", formContext == null ? void 0 : formContext.hideRequiredAsterisk),
- { [ns.m("feedback")]: formContext == null ? void 0 : formContext.statusIcon }
- ]);
- const _inlineMessage = computed(() => isBoolean(props.inlineMessage) ? props.inlineMessage : (formContext == null ? void 0 : formContext.inlineMessage) || false);
- const validateClasses = computed(() => [
- ns.e("error"),
- { [ns.em("error", "inline")]: _inlineMessage.value }
- ]);
- const propString = computed(() => {
- if (!props.prop)
- return "";
- return isString(props.prop) ? props.prop : props.prop.join(".");
- });
- const labelFor = computed(() => props.for || propString.value);
- const isNested = !!parentFormItemContext;
- const fieldValue = computed(() => {
- const model = formContext == null ? void 0 : formContext.model;
- if (!model || !props.prop) {
- return;
- }
- return getProp(model, props.prop).value;
- });
- const _rules = computed(() => {
- const rules2 = props.rules ? castArray$1(props.rules) : [];
- const formRules = formContext == null ? void 0 : formContext.rules;
- if (formRules && props.prop) {
- const _rules2 = getProp(formRules, props.prop).value;
- if (_rules2) {
- rules2.push(...castArray$1(_rules2));
- }
- }
- if (props.required !== void 0) {
- rules2.push({ required: !!props.required });
- }
- return rules2;
- });
- const validateEnabled = computed(() => _rules.value.length > 0);
- const getFilteredRule = (trigger) => {
- const rules2 = _rules.value;
- return rules2.filter((rule) => {
- if (!rule.trigger || !trigger)
- return true;
- if (Array.isArray(rule.trigger)) {
- return rule.trigger.includes(trigger);
- } else {
- return rule.trigger === trigger;
- }
- }).map((_a2) => {
- var _b2 = _a2, { trigger: trigger2 } = _b2, rule = __objRest(_b2, ["trigger"]);
- return rule;
- });
- };
- const isRequired = computed(() => _rules.value.some((rule) => rule.required === true));
- const shouldShowError = computed(() => {
- var _a2;
- return validateStateDebounced.value === "error" && props.showMessage && ((_a2 = formContext == null ? void 0 : formContext.showMessage) != null ? _a2 : true);
- });
- const currentLabel = computed(() => `${props.label || ""}${(formContext == null ? void 0 : formContext.labelSuffix) || ""}`);
- const setValidationState = (state) => {
- validateState.value = state;
- };
- const onValidationFailed = (error) => {
- var _a2, _b2;
- const { errors, fields } = error;
- if (!errors || !fields) {
- console.error(error);
- }
- setValidationState("error");
- validateMessage.value = errors ? (_b2 = (_a2 = errors == null ? void 0 : errors[0]) == null ? void 0 : _a2.message) != null ? _b2 : `${props.prop} is required` : "";
- formContext == null ? void 0 : formContext.emit("validate", props.prop, false, validateMessage.value);
- };
- const onValidationSucceeded = () => {
- setValidationState("success");
- formContext == null ? void 0 : formContext.emit("validate", props.prop, true, "");
- };
- const doValidate = async (rules2) => {
- const modelName = propString.value;
- const validator = new Schema({
- [modelName]: rules2
- });
- return validator.validate({ [modelName]: fieldValue.value }, { firstFields: true }).then(() => {
- onValidationSucceeded();
- return true;
- }).catch((err) => {
- onValidationFailed(err);
- return Promise.reject(err);
- });
- };
- const validate = async (trigger, callback) => {
- if (isResettingField) {
- isResettingField = false;
- return false;
- }
- const hasCallback = isFunction(callback);
- if (!validateEnabled.value) {
- callback == null ? void 0 : callback(false);
- return false;
- }
- const rules2 = getFilteredRule(trigger);
- if (rules2.length === 0) {
- callback == null ? void 0 : callback(true);
- return true;
- }
- setValidationState("validating");
- return doValidate(rules2).then(() => {
- callback == null ? void 0 : callback(true);
- return true;
- }).catch((err) => {
- const { fields } = err;
- callback == null ? void 0 : callback(false, fields);
- return hasCallback ? false : Promise.reject(fields);
- });
- };
- const clearValidate = () => {
- setValidationState("");
- validateMessage.value = "";
- };
- const resetField = async () => {
- const model = formContext == null ? void 0 : formContext.model;
- if (!model || !props.prop)
- return;
- const computedValue = getProp(model, props.prop);
- if (!isEqual(computedValue.value, initialValue)) {
- isResettingField = true;
- }
- computedValue.value = initialValue;
- await nextTick();
- clearValidate();
- };
- watch(() => props.error, (val) => {
- validateMessage.value = val || "";
- setValidationState(val ? "error" : "");
- }, { immediate: true });
- watch(() => props.validateStatus, (val) => setValidationState(val || ""));
- const context = reactive(__spreadProps(__spreadValues({}, toRefs(props)), {
- $el: formItemRef,
- size: _size,
- validateState,
- resetField,
- clearValidate,
- validate
- }));
- provide(formItemContextKey, context);
- onMounted(() => {
- if (props.prop) {
- formContext == null ? void 0 : formContext.addField(context);
- initialValue = clone(fieldValue.value);
- }
- });
- onBeforeUnmount(() => {
- formContext == null ? void 0 : formContext.removeField(context);
- });
- expose({
- size: _size,
- validateMessage,
- validateState,
- validate,
- clearValidate,
- resetField
- });
- return (_ctx, _cache) => {
- var _a2;
- return openBlock(), createElementBlock("div", {
- ref_key: "formItemRef",
- ref: formItemRef,
- class: normalizeClass(unref(formItemClasses))
- }, [
- createVNode(unref(FormLabelWrap), {
- "is-auto-width": unref(labelStyle).width === "auto",
- "update-all": ((_a2 = unref(formContext)) == null ? void 0 : _a2.labelWidth) === "auto"
- }, {
- default: withCtx(() => [
- _ctx.label || _ctx.$slots.label ? (openBlock(), createElementBlock("label", {
- key: 0,
- for: unref(labelFor),
- class: normalizeClass(unref(ns).e("label")),
- style: normalizeStyle(unref(labelStyle))
- }, [
- renderSlot(_ctx.$slots, "label", { label: unref(currentLabel) }, () => [
- createTextVNode(toDisplayString(unref(currentLabel)), 1)
- ])
- ], 14, _hoisted_1$k)) : createCommentVNode("v-if", true)
- ]),
- _: 3
- }, 8, ["is-auto-width", "update-all"]),
- createElementVNode("div", {
- class: normalizeClass(unref(ns).e("content")),
- style: normalizeStyle(unref(contentStyle))
- }, [
- renderSlot(_ctx.$slots, "default"),
- createVNode(Transition, {
- name: `${unref(ns).namespace.value}-zoom-in-top`
- }, {
- default: withCtx(() => [
- unref(shouldShowError) ? renderSlot(_ctx.$slots, "error", {
- key: 0,
- error: validateMessage.value
- }, () => [
- createElementVNode("div", {
- class: normalizeClass(unref(validateClasses))
- }, toDisplayString(validateMessage.value), 3)
- ]) : createCommentVNode("v-if", true)
- ]),
- _: 3
- }, 8, ["name"])
- ], 6)
- ], 2);
- };
- }
- }));
- var FormItem = /* @__PURE__ */ _export_sfc$1(_sfc_main$u, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/form/src/form-item.vue"]]);
- const ElForm = withInstall(Form, {
- FormItem
- });
- const ElFormItem = withNoopInstall(FormItem);
- const imageViewerProps = buildProps({
- urlList: {
- type: definePropType(Array),
- default: () => mutable([])
- },
- zIndex: {
- type: Number
- },
- initialIndex: {
- type: Number,
- default: 0
- },
- infinite: {
- type: Boolean,
- default: true
- },
- hideOnClickModal: {
- type: Boolean,
- default: false
- },
- teleported: {
- type: Boolean,
- default: false
- }
- });
- const imageViewerEmits = {
- close: () => true,
- switch: (index) => typeof index === "number"
- };
- const _hoisted_1$j = ["src"];
- const __default__$7 = {
- name: "ElImageViewer"
- };
- const _sfc_main$t = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$7), {
- props: imageViewerProps,
- emits: imageViewerEmits,
- setup(__props, { emit }) {
- const props = __props;
- const Mode = {
- CONTAIN: {
- name: "contain",
- icon: markRaw(fullScreen)
- },
- ORIGINAL: {
- name: "original",
- icon: markRaw(scaleToOriginal)
- }
- };
- const mousewheelEventName = isFirefox() ? "DOMMouseScroll" : "mousewheel";
- const { t } = useLocale();
- const ns = useNamespace("image-viewer");
- const { nextZIndex } = useZIndex();
- const wrapper = ref();
- const imgRefs = ref([]);
- const scopeEventListener = effectScope();
- const loading2 = ref(true);
- const index = ref(props.initialIndex);
- const mode = ref(Mode.CONTAIN);
- const transform = ref({
- scale: 1,
- deg: 0,
- offsetX: 0,
- offsetY: 0,
- enableTransition: false
- });
- const isSingle = computed(() => {
- const { urlList } = props;
- return urlList.length <= 1;
- });
- const isFirst = computed(() => {
- return index.value === 0;
- });
- const isLast = computed(() => {
- return index.value === props.urlList.length - 1;
- });
- const currentImg = computed(() => {
- return props.urlList[index.value];
- });
- const imgStyle = computed(() => {
- const { scale, deg, offsetX, offsetY, enableTransition } = transform.value;
- let translateX = offsetX / scale;
- let translateY = offsetY / scale;
- switch (deg % 360) {
- case 90:
- case -270:
- [translateX, translateY] = [translateY, -translateX];
- break;
- case 180:
- case -180:
- [translateX, translateY] = [-translateX, -translateY];
- break;
- case 270:
- case -90:
- [translateX, translateY] = [-translateY, translateX];
- break;
- }
- const style = {
- transform: `scale(${scale}) rotate(${deg}deg) translate(${translateX}px, ${translateY}px)`,
- transition: enableTransition ? "transform .3s" : ""
- };
- if (mode.value.name === Mode.CONTAIN.name) {
- style.maxWidth = style.maxHeight = "100%";
- }
- return style;
- });
- const computedZIndex = computed(() => {
- return isNumber(props.zIndex) ? props.zIndex : nextZIndex();
- });
- function hide2() {
- unregisterEventListener();
- emit("close");
- }
- function registerEventListener() {
- const keydownHandler = throttle((e) => {
- switch (e.code) {
- case EVENT_CODE.esc:
- hide2();
- break;
- case EVENT_CODE.space:
- toggleMode();
- break;
- case EVENT_CODE.left:
- prev();
- break;
- case EVENT_CODE.up:
- handleActions("zoomIn");
- break;
- case EVENT_CODE.right:
- next();
- break;
- case EVENT_CODE.down:
- handleActions("zoomOut");
- break;
- }
- });
- const mousewheelHandler = throttle((e) => {
- const delta = e.wheelDelta ? e.wheelDelta : -e.detail;
- if (delta > 0) {
- handleActions("zoomIn", {
- zoomRate: 1.2,
- enableTransition: false
- });
- } else {
- handleActions("zoomOut", {
- zoomRate: 1.2,
- enableTransition: false
- });
- }
- });
- scopeEventListener.run(() => {
- useEventListener(document, "keydown", keydownHandler);
- useEventListener(document, mousewheelEventName, mousewheelHandler);
- });
- }
- function unregisterEventListener() {
- scopeEventListener.stop();
- }
- function handleImgLoad() {
- loading2.value = false;
- }
- function handleImgError(e) {
- loading2.value = false;
- e.target.alt = t("el.image.error");
- }
- function handleMouseDown(e) {
- if (loading2.value || e.button !== 0 || !wrapper.value)
- return;
- transform.value.enableTransition = false;
- const { offsetX, offsetY } = transform.value;
- const startX = e.pageX;
- const startY = e.pageY;
- const dragHandler = throttle((ev) => {
- transform.value = __spreadProps(__spreadValues({}, transform.value), {
- offsetX: offsetX + ev.pageX - startX,
- offsetY: offsetY + ev.pageY - startY
- });
- });
- const removeMousemove = useEventListener(document, "mousemove", dragHandler);
- useEventListener(document, "mouseup", () => {
- removeMousemove();
- });
- e.preventDefault();
- }
- function reset() {
- transform.value = {
- scale: 1,
- deg: 0,
- offsetX: 0,
- offsetY: 0,
- enableTransition: false
- };
- }
- function toggleMode() {
- if (loading2.value)
- return;
- const modeNames = Object.keys(Mode);
- const modeValues = Object.values(Mode);
- const currentMode = mode.value.name;
- const index2 = modeValues.findIndex((i) => i.name === currentMode);
- const nextIndex = (index2 + 1) % modeNames.length;
- mode.value = Mode[modeNames[nextIndex]];
- reset();
- }
- function prev() {
- if (isFirst.value && !props.infinite)
- return;
- const len = props.urlList.length;
- index.value = (index.value - 1 + len) % len;
- }
- function next() {
- if (isLast.value && !props.infinite)
- return;
- const len = props.urlList.length;
- index.value = (index.value + 1) % len;
- }
- function handleActions(action, options = {}) {
- if (loading2.value)
- return;
- const { zoomRate, rotateDeg, enableTransition } = __spreadValues({
- zoomRate: 1.4,
- rotateDeg: 90,
- enableTransition: true
- }, options);
- switch (action) {
- case "zoomOut":
- if (transform.value.scale > 0.2) {
- transform.value.scale = Number.parseFloat((transform.value.scale / zoomRate).toFixed(3));
- }
- break;
- case "zoomIn":
- if (transform.value.scale < 7) {
- transform.value.scale = Number.parseFloat((transform.value.scale * zoomRate).toFixed(3));
- }
- break;
- case "clockwise":
- transform.value.deg += rotateDeg;
- break;
- case "anticlockwise":
- transform.value.deg -= rotateDeg;
- break;
- }
- transform.value.enableTransition = enableTransition;
- }
- watch(currentImg, () => {
- nextTick(() => {
- const $img = imgRefs.value[0];
- if (!($img == null ? void 0 : $img.complete)) {
- loading2.value = true;
- }
- });
- });
- watch(index, (val) => {
- reset();
- emit("switch", val);
- });
- onMounted(() => {
- var _a2, _b2;
- registerEventListener();
- (_b2 = (_a2 = wrapper.value) == null ? void 0 : _a2.focus) == null ? void 0 : _b2.call(_a2);
- });
- return (_ctx, _cache) => {
- return openBlock(), createBlock(Teleport, {
- to: "body",
- disabled: !_ctx.teleported
- }, [
- createVNode(Transition, {
- name: "viewer-fade",
- appear: ""
- }, {
- default: withCtx(() => [
- createElementVNode("div", {
- ref_key: "wrapper",
- ref: wrapper,
- tabindex: -1,
- class: normalizeClass(unref(ns).e("wrapper")),
- style: normalizeStyle({ zIndex: unref(computedZIndex) })
- }, [
- createElementVNode("div", {
- class: normalizeClass(unref(ns).e("mask")),
- onClick: _cache[0] || (_cache[0] = withModifiers(($event) => _ctx.hideOnClickModal && hide2(), ["self"]))
- }, null, 2),
- createCommentVNode(" CLOSE "),
- createElementVNode("span", {
- class: normalizeClass([unref(ns).e("btn"), unref(ns).e("close")]),
- onClick: hide2
- }, [
- createVNode(unref(ElIcon), null, {
- default: withCtx(() => [
- createVNode(unref(close))
- ]),
- _: 1
- })
- ], 2),
- createCommentVNode(" ARROW "),
- !unref(isSingle) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
- createElementVNode("span", {
- class: normalizeClass([
- unref(ns).e("btn"),
- unref(ns).e("prev"),
- unref(ns).is("disabled", !_ctx.infinite && unref(isFirst))
- ]),
- onClick: prev
- }, [
- createVNode(unref(ElIcon), null, {
- default: withCtx(() => [
- createVNode(unref(arrowLeft))
- ]),
- _: 1
- })
- ], 2),
- createElementVNode("span", {
- class: normalizeClass([
- unref(ns).e("btn"),
- unref(ns).e("next"),
- unref(ns).is("disabled", !_ctx.infinite && unref(isLast))
- ]),
- onClick: next
- }, [
- createVNode(unref(ElIcon), null, {
- default: withCtx(() => [
- createVNode(unref(arrowRight))
- ]),
- _: 1
- })
- ], 2)
- ], 64)) : createCommentVNode("v-if", true),
- createCommentVNode(" ACTIONS "),
- createElementVNode("div", {
- class: normalizeClass([unref(ns).e("btn"), unref(ns).e("actions")])
- }, [
- createElementVNode("div", {
- class: normalizeClass(unref(ns).e("actions__inner"))
- }, [
- createVNode(unref(ElIcon), {
- onClick: _cache[1] || (_cache[1] = ($event) => handleActions("zoomOut"))
- }, {
- default: withCtx(() => [
- createVNode(unref(zoomOut))
- ]),
- _: 1
- }),
- createVNode(unref(ElIcon), {
- onClick: _cache[2] || (_cache[2] = ($event) => handleActions("zoomIn"))
- }, {
- default: withCtx(() => [
- createVNode(unref(zoomIn))
- ]),
- _: 1
- }),
- createElementVNode("i", {
- class: normalizeClass(unref(ns).e("actions__divider"))
- }, null, 2),
- createVNode(unref(ElIcon), { onClick: toggleMode }, {
- default: withCtx(() => [
- (openBlock(), createBlock(resolveDynamicComponent(mode.value.icon)))
- ]),
- _: 1
- }),
- createElementVNode("i", {
- class: normalizeClass(unref(ns).e("actions__divider"))
- }, null, 2),
- createVNode(unref(ElIcon), {
- onClick: _cache[3] || (_cache[3] = ($event) => handleActions("anticlockwise"))
- }, {
- default: withCtx(() => [
- createVNode(unref(refreshLeft))
- ]),
- _: 1
- }),
- createVNode(unref(ElIcon), {
- onClick: _cache[4] || (_cache[4] = ($event) => handleActions("clockwise"))
- }, {
- default: withCtx(() => [
- createVNode(unref(refreshRight))
- ]),
- _: 1
- })
- ], 2)
- ], 2),
- createCommentVNode(" CANVAS "),
- createElementVNode("div", {
- class: normalizeClass(unref(ns).e("canvas"))
- }, [
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.urlList, (url2, i) => {
- return withDirectives((openBlock(), createElementBlock("img", {
- ref_for: true,
- ref: (el) => imgRefs.value[i] = el,
- key: url2,
- src: url2,
- style: normalizeStyle(unref(imgStyle)),
- class: normalizeClass(unref(ns).e("img")),
- onLoad: handleImgLoad,
- onError: handleImgError,
- onMousedown: handleMouseDown
- }, null, 46, _hoisted_1$j)), [
- [vShow, i === index.value]
- ]);
- }), 128))
- ], 2),
- renderSlot(_ctx.$slots, "default")
- ], 6)
- ]),
- _: 3
- })
- ], 8, ["disabled"]);
- };
- }
- }));
- 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"]]);
- const ElImageViewer = withInstall(ImageViewer);
- const imageProps = buildProps({
- appendToBody: {
- type: Boolean,
- default: void 0
- },
- hideOnClickModal: {
- type: Boolean,
- default: false
- },
- src: {
- type: String,
- default: ""
- },
- fit: {
- type: String,
- values: ["", "contain", "cover", "fill", "none", "scale-down"],
- default: ""
- },
- lazy: {
- type: Boolean,
- default: false
- },
- scrollContainer: {
- type: definePropType([String, Object])
- },
- previewSrcList: {
- type: definePropType(Array),
- default: () => mutable([])
- },
- previewTeleported: {
- type: Boolean,
- default: false
- },
- zIndex: {
- type: Number
- },
- initialIndex: {
- type: Number,
- default: 0
- },
- infinite: {
- type: Boolean,
- default: true
- }
- });
- const imageEmits = {
- error: (evt) => evt instanceof Event,
- switch: (val) => isNumber(val),
- close: () => true
- };
- const _hoisted_1$i = ["src"];
- const _hoisted_2$g = { key: 0 };
- const __default__$6 = {
- name: "ElImage"
- };
- const _sfc_main$s = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$6), {
- props: imageProps,
- emits: imageEmits,
- setup(__props, { emit }) {
- const props = __props;
- let prevOverflow = "";
- useDeprecated({
- scope: "el-image",
- from: "append-to-body",
- replacement: "preview-teleported",
- version: "2.2.0",
- ref: "https://element-plus.org/en-US/component/image.html#image-attributess"
- }, computed(() => isBoolean(props.appendToBody)));
- const { t } = useLocale();
- const ns = useNamespace("image");
- const attrs = useAttrs();
- const hasLoadError = ref(false);
- const loading2 = ref(true);
- const imgWidth = ref(0);
- const imgHeight = ref(0);
- const showViewer = ref(false);
- const container = ref();
- const _scrollContainer = ref();
- let stopScrollListener;
- let stopWheelListener;
- const containerStyle = computed(() => attrs.value.style);
- const imageStyle = computed(() => {
- const { fit } = props;
- if (isClient && fit) {
- return { objectFit: fit };
- }
- return {};
- });
- const preview = computed(() => {
- const { previewSrcList } = props;
- return Array.isArray(previewSrcList) && previewSrcList.length > 0;
- });
- const teleported = computed(() => {
- return props.appendToBody || props.previewTeleported;
- });
- const imageIndex = computed(() => {
- const { previewSrcList, initialIndex } = props;
- let previewIndex = initialIndex;
- if (initialIndex > previewSrcList.length - 1) {
- previewIndex = 0;
- }
- return previewIndex;
- });
- const loadImage = () => {
- if (!isClient)
- return;
- loading2.value = true;
- hasLoadError.value = false;
- const img = new Image();
- const currentImageSrc = props.src;
- img.addEventListener("load", (e) => {
- if (currentImageSrc !== props.src) {
- return;
- }
- handleLoad(e, img);
- });
- img.addEventListener("error", (e) => {
- if (currentImageSrc !== props.src) {
- return;
- }
- handleError(e);
- });
- Object.entries(attrs.value).forEach(([key, value]) => {
- if (key.toLowerCase() === "onload")
- return;
- img.setAttribute(key, value);
- });
- img.src = currentImageSrc;
- };
- function handleLoad(e, img) {
- imgWidth.value = img.width;
- imgHeight.value = img.height;
- loading2.value = false;
- hasLoadError.value = false;
- }
- function handleError(event) {
- loading2.value = false;
- hasLoadError.value = true;
- emit("error", event);
- }
- function handleLazyLoad() {
- if (isInContainer(container.value, _scrollContainer.value)) {
- loadImage();
- removeLazyLoadListener();
- }
- }
- const lazyLoadHandler = useThrottleFn(handleLazyLoad, 200);
- async function addLazyLoadListener() {
- var _a2;
- if (!isClient)
- return;
- await nextTick();
- const { scrollContainer } = props;
- if (isElement$1(scrollContainer)) {
- _scrollContainer.value = scrollContainer;
- } else if (isString(scrollContainer) && scrollContainer !== "") {
- _scrollContainer.value = (_a2 = document.querySelector(scrollContainer)) != null ? _a2 : void 0;
- } else if (container.value) {
- _scrollContainer.value = getScrollContainer(container.value);
- }
- if (_scrollContainer.value) {
- stopScrollListener = useEventListener(_scrollContainer, "scroll", lazyLoadHandler);
- setTimeout(() => handleLazyLoad(), 100);
- }
- }
- function removeLazyLoadListener() {
- if (!isClient || !_scrollContainer.value || !lazyLoadHandler)
- return;
- stopScrollListener();
- _scrollContainer.value = void 0;
- }
- function wheelHandler(e) {
- if (!e.ctrlKey)
- return;
- if (e.deltaY < 0) {
- e.preventDefault();
- return false;
- } else if (e.deltaY > 0) {
- e.preventDefault();
- return false;
- }
- }
- function clickHandler() {
- if (!preview.value)
- return;
- stopWheelListener = useEventListener("wheel", wheelHandler, {
- passive: false
- });
- prevOverflow = document.body.style.overflow;
- document.body.style.overflow = "hidden";
- showViewer.value = true;
- }
- function closeViewer() {
- stopWheelListener == null ? void 0 : stopWheelListener();
- document.body.style.overflow = prevOverflow;
- showViewer.value = false;
- emit("close");
- }
- function switchViewer(val) {
- emit("switch", val);
- }
- watch(() => props.src, () => {
- if (props.lazy) {
- loading2.value = true;
- hasLoadError.value = false;
- removeLazyLoadListener();
- addLazyLoadListener();
- } else {
- loadImage();
- }
- });
- onMounted(() => {
- if (props.lazy) {
- addLazyLoadListener();
- } else {
- loadImage();
- }
- });
- return (_ctx, _cache) => {
- return openBlock(), createElementBlock("div", {
- ref_key: "container",
- ref: container,
- class: normalizeClass([unref(ns).b(), _ctx.$attrs.class]),
- style: normalizeStyle(unref(containerStyle))
- }, [
- loading2.value ? renderSlot(_ctx.$slots, "placeholder", { key: 0 }, () => [
- createElementVNode("div", {
- class: normalizeClass(unref(ns).e("placeholder"))
- }, null, 2)
- ]) : hasLoadError.value ? renderSlot(_ctx.$slots, "error", { key: 1 }, () => [
- createElementVNode("div", {
- class: normalizeClass(unref(ns).e("error"))
- }, toDisplayString(unref(t)("el.image.error")), 3)
- ]) : (openBlock(), createElementBlock("img", mergeProps({ key: 2 }, unref(attrs), {
- src: _ctx.src,
- style: unref(imageStyle),
- class: [unref(ns).e("inner"), unref(preview) ? unref(ns).e("preview") : ""],
- onClick: clickHandler
- }), null, 16, _hoisted_1$i)),
- unref(preview) ? (openBlock(), createElementBlock(Fragment, { key: 3 }, [
- showViewer.value ? (openBlock(), createBlock(unref(ElImageViewer), {
- key: 0,
- "z-index": _ctx.zIndex,
- "initial-index": unref(imageIndex),
- infinite: _ctx.infinite,
- "url-list": _ctx.previewSrcList,
- "hide-on-click-modal": _ctx.hideOnClickModal,
- teleported: unref(teleported),
- onClose: closeViewer,
- onSwitch: switchViewer
- }, {
- default: withCtx(() => [
- _ctx.$slots.viewer ? (openBlock(), createElementBlock("div", _hoisted_2$g, [
- renderSlot(_ctx.$slots, "viewer")
- ])) : createCommentVNode("v-if", true)
- ]),
- _: 3
- }, 8, ["z-index", "initial-index", "infinite", "url-list", "hide-on-click-modal", "teleported"])) : createCommentVNode("v-if", true)
- ], 2112)) : createCommentVNode("v-if", true)
- ], 6);
- };
- }
- }));
- var Image$1 = /* @__PURE__ */ _export_sfc$1(_sfc_main$s, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/image/src/image.vue"]]);
- const ElImage = withInstall(Image$1);
- const inputNumberProps = buildProps({
- step: {
- type: Number,
- default: 1
- },
- stepStrictly: {
- type: Boolean,
- default: false
- },
- max: {
- type: Number,
- default: Number.POSITIVE_INFINITY
- },
- min: {
- type: Number,
- default: Number.NEGATIVE_INFINITY
- },
- modelValue: {
- type: Number
- },
- disabled: {
- type: Boolean,
- default: false
- },
- size: {
- type: String,
- values: componentSizes
- },
- controls: {
- type: Boolean,
- default: true
- },
- controlsPosition: {
- type: String,
- default: "",
- values: ["", "right"]
- },
- name: String,
- label: String,
- placeholder: String,
- precision: {
- type: Number,
- validator: (val) => val >= 0 && val === Number.parseInt(`${val}`, 10)
- }
- });
- const inputNumberEmits = {
- change: (prev, cur) => prev !== cur,
- blur: (e) => e instanceof FocusEvent,
- focus: (e) => e instanceof FocusEvent,
- input: (val) => isNumber(val),
- "update:modelValue": (val) => isNumber(val) || val === void 0
- };
- const _sfc_main$r = defineComponent({
- name: "ElInputNumber",
- components: {
- ElInput,
- ElIcon,
- ArrowUp: arrowUp,
- ArrowDown: arrowDown,
- Plus: plus,
- Minus: minus
- },
- directives: {
- RepeatClick
- },
- props: inputNumberProps,
- emits: inputNumberEmits,
- setup(props, { emit }) {
- const input = ref();
- const data2 = reactive({
- currentValue: props.modelValue,
- userInput: null
- });
- const { formItem } = useFormItem();
- const ns = useNamespace("input-number");
- const minDisabled = computed(() => ensurePrecision(props.modelValue, -1) < props.min);
- const maxDisabled = computed(() => ensurePrecision(props.modelValue) > props.max);
- const numPrecision = computed(() => {
- const stepPrecision = getPrecision(props.step);
- if (!isUndefined(props.precision)) {
- if (stepPrecision > props.precision)
- ;
- return props.precision;
- } else {
- return Math.max(getPrecision(props.modelValue), stepPrecision);
- }
- });
- const controlsAtRight = computed(() => {
- return props.controls && props.controlsPosition === "right";
- });
- const inputNumberSize = useSize();
- const inputNumberDisabled = useDisabled$1();
- const displayValue = computed(() => {
- if (data2.userInput !== null) {
- return data2.userInput;
- }
- let currentValue = data2.currentValue;
- if (isNumber(currentValue)) {
- if (Number.isNaN(currentValue))
- return "";
- if (!isUndefined(props.precision)) {
- currentValue = currentValue.toFixed(props.precision);
- }
- }
- return currentValue;
- });
- const toPrecision = (num, pre) => {
- if (isUndefined(pre))
- pre = numPrecision.value;
- return Number.parseFloat(`${Math.round(num * 10 ** pre) / 10 ** pre}`);
- };
- const getPrecision = (value) => {
- if (isUndefined(value))
- return 0;
- const valueString = value.toString();
- const dotPosition = valueString.indexOf(".");
- let precision = 0;
- if (dotPosition !== -1) {
- precision = valueString.length - dotPosition - 1;
- }
- return precision;
- };
- const ensurePrecision = (val, coefficient = 1) => {
- if (!isNumber(val))
- return data2.currentValue;
- val = isNumber(val) ? val : Number.NaN;
- return toPrecision(val + props.step * coefficient);
- };
- const increase = () => {
- if (inputNumberDisabled.value || maxDisabled.value)
- return;
- const value = props.modelValue || 0;
- const newVal = ensurePrecision(value);
- setCurrentValue(newVal);
- };
- const decrease = () => {
- if (inputNumberDisabled.value || minDisabled.value)
- return;
- const value = props.modelValue || 0;
- const newVal = ensurePrecision(value, -1);
- setCurrentValue(newVal);
- };
- const verifyValue = (value, update) => {
- const { max: max2, min: min2, step, precision, stepStrictly } = props;
- let newVal = Number(value);
- if (value === null) {
- newVal = Number.NaN;
- }
- if (!Number.isNaN(newVal)) {
- if (stepStrictly) {
- newVal = Math.round(newVal / step) * step;
- }
- if (!isUndefined(precision)) {
- newVal = toPrecision(newVal, precision);
- }
- if (newVal > max2 || newVal < min2) {
- newVal = newVal > max2 ? max2 : min2;
- update && emit("update:modelValue", newVal);
- }
- }
- return newVal;
- };
- const setCurrentValue = (value) => {
- var _a2;
- const oldVal = data2.currentValue;
- let newVal = verifyValue(value);
- if (oldVal === newVal)
- return;
- if (Number.isNaN(newVal)) {
- newVal = void 0;
- }
- data2.userInput = null;
- emit("update:modelValue", newVal);
- emit("input", newVal);
- emit("change", newVal, oldVal);
- (_a2 = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a2.call(formItem, "change").catch((err) => debugWarn());
- data2.currentValue = newVal;
- };
- const handleInput = (value) => {
- return data2.userInput = value;
- };
- const handleInputChange = (value) => {
- const newVal = value !== "" ? Number(value) : "";
- if (isNumber(newVal) && !Number.isNaN(newVal) || value === "") {
- setCurrentValue(newVal);
- }
- data2.userInput = null;
- };
- const focus = () => {
- var _a2, _b2;
- (_b2 = (_a2 = input.value) == null ? void 0 : _a2.focus) == null ? void 0 : _b2.call(_a2);
- };
- const blur = () => {
- var _a2, _b2;
- (_b2 = (_a2 = input.value) == null ? void 0 : _a2.blur) == null ? void 0 : _b2.call(_a2);
- };
- const handleFocus = (event) => {
- emit("focus", event);
- };
- const handleBlur = (event) => {
- var _a2;
- emit("blur", event);
- (_a2 = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a2.call(formItem, "blur").catch((err) => debugWarn());
- };
- watch(() => props.modelValue, (value) => {
- const newVal = verifyValue(value, true);
- data2.currentValue = newVal;
- data2.userInput = null;
- }, { immediate: true });
- onMounted(() => {
- var _a2;
- const innerInput = (_a2 = input.value) == null ? void 0 : _a2.input;
- innerInput.setAttribute("role", "spinbutton");
- innerInput.setAttribute("aria-valuemax", String(props.max));
- innerInput.setAttribute("aria-valuemin", String(props.min));
- innerInput.setAttribute("aria-valuenow", String(data2.currentValue));
- innerInput.setAttribute("aria-disabled", String(inputNumberDisabled.value));
- if (!isNumber(props.modelValue)) {
- let val = Number(props.modelValue);
- if (Number.isNaN(val)) {
- val = void 0;
- }
- emit("update:modelValue", val);
- }
- });
- onUpdated(() => {
- var _a2;
- const innerInput = (_a2 = input.value) == null ? void 0 : _a2.input;
- innerInput == null ? void 0 : innerInput.setAttribute("aria-valuenow", data2.currentValue);
- });
- return {
- input,
- displayValue,
- handleInput,
- handleInputChange,
- controlsAtRight,
- decrease,
- increase,
- inputNumberSize,
- inputNumberDisabled,
- maxDisabled,
- minDisabled,
- focus,
- blur,
- handleFocus,
- handleBlur,
- ns
- };
- }
- });
- function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
- const _component_arrow_down = resolveComponent("arrow-down");
- const _component_minus = resolveComponent("minus");
- const _component_el_icon = resolveComponent("el-icon");
- const _component_arrow_up = resolveComponent("arrow-up");
- const _component_plus = resolveComponent("plus");
- const _component_el_input = resolveComponent("el-input");
- const _directive_repeat_click = resolveDirective("repeat-click");
- return openBlock(), createElementBlock("div", {
- class: normalizeClass([
- _ctx.ns.b(),
- _ctx.ns.m(_ctx.inputNumberSize),
- _ctx.ns.is("disabled", _ctx.inputNumberDisabled),
- _ctx.ns.is("without-controls", !_ctx.controls),
- _ctx.ns.is("controls-right", _ctx.controlsAtRight)
- ]),
- onDragstart: _cache[2] || (_cache[2] = withModifiers(() => {
- }, ["prevent"]))
- }, [
- _ctx.controls ? withDirectives((openBlock(), createElementBlock("span", {
- key: 0,
- role: "button",
- class: normalizeClass([_ctx.ns.e("decrease"), _ctx.ns.is("disabled", _ctx.minDisabled)]),
- onKeydown: _cache[0] || (_cache[0] = withKeys((...args) => _ctx.decrease && _ctx.decrease(...args), ["enter"]))
- }, [
- createVNode(_component_el_icon, null, {
- default: withCtx(() => [
- _ctx.controlsAtRight ? (openBlock(), createBlock(_component_arrow_down, { key: 0 })) : (openBlock(), createBlock(_component_minus, { key: 1 }))
- ]),
- _: 1
- })
- ], 34)), [
- [_directive_repeat_click, _ctx.decrease]
- ]) : createCommentVNode("v-if", true),
- _ctx.controls ? withDirectives((openBlock(), createElementBlock("span", {
- key: 1,
- role: "button",
- class: normalizeClass([_ctx.ns.e("increase"), _ctx.ns.is("disabled", _ctx.maxDisabled)]),
- onKeydown: _cache[1] || (_cache[1] = withKeys((...args) => _ctx.increase && _ctx.increase(...args), ["enter"]))
- }, [
- createVNode(_component_el_icon, null, {
- default: withCtx(() => [
- _ctx.controlsAtRight ? (openBlock(), createBlock(_component_arrow_up, { key: 0 })) : (openBlock(), createBlock(_component_plus, { key: 1 }))
- ]),
- _: 1
- })
- ], 34)), [
- [_directive_repeat_click, _ctx.increase]
- ]) : createCommentVNode("v-if", true),
- createVNode(_component_el_input, {
- ref: "input",
- type: "number",
- step: _ctx.step,
- "model-value": _ctx.displayValue,
- placeholder: _ctx.placeholder,
- disabled: _ctx.inputNumberDisabled,
- size: _ctx.inputNumberSize,
- max: _ctx.max,
- min: _ctx.min,
- name: _ctx.name,
- label: _ctx.label,
- "validate-event": false,
- onKeydown: [
- withKeys(withModifiers(_ctx.increase, ["prevent"]), ["up"]),
- withKeys(withModifiers(_ctx.decrease, ["prevent"]), ["down"])
- ],
- onBlur: _ctx.handleBlur,
- onFocus: _ctx.handleFocus,
- onInput: _ctx.handleInput,
- onChange: _ctx.handleInputChange
- }, null, 8, ["step", "model-value", "placeholder", "disabled", "size", "max", "min", "name", "label", "onKeydown", "onBlur", "onFocus", "onInput", "onChange"])
- ], 34);
- }
- 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"]]);
- const ElInputNumber = withInstall(InputNumber);
- const selectGroupKey = "ElSelectGroup";
- const selectKey = "ElSelect";
- function useOption(props, states) {
- const select = inject(selectKey);
- const selectGroup = inject(selectGroupKey, { disabled: false });
- const isObject2 = computed(() => {
- return Object.prototype.toString.call(props.value).toLowerCase() === "[object object]";
- });
- const itemSelected = computed(() => {
- if (!select.props.multiple) {
- return isEqual2(props.value, select.props.modelValue);
- } else {
- return contains2(select.props.modelValue, props.value);
- }
- });
- const limitReached = computed(() => {
- if (select.props.multiple) {
- const modelValue = select.props.modelValue || [];
- return !itemSelected.value && modelValue.length >= select.props.multipleLimit && select.props.multipleLimit > 0;
- } else {
- return false;
- }
- });
- const currentLabel = computed(() => {
- return props.label || (isObject2.value ? "" : props.value);
- });
- const currentValue = computed(() => {
- return props.value || props.label || "";
- });
- const isDisabled = computed(() => {
- return props.disabled || states.groupDisabled || limitReached.value;
- });
- const instance = getCurrentInstance();
- const contains2 = (arr = [], target) => {
- if (!isObject2.value) {
- return arr && arr.includes(target);
- } else {
- const valueKey = select.props.valueKey;
- return arr && arr.some((item) => {
- return get(item, valueKey) === get(target, valueKey);
- });
- }
- };
- const isEqual2 = (a2, b2) => {
- if (!isObject2.value) {
- return a2 === b2;
- } else {
- const { valueKey } = select.props;
- return get(a2, valueKey) === get(b2, valueKey);
- }
- };
- const hoverItem = () => {
- if (!props.disabled && !selectGroup.disabled) {
- select.hoverIndex = select.optionsArray.indexOf(instance.proxy);
- }
- };
- watch(() => currentLabel.value, () => {
- if (!props.created && !select.props.remote)
- select.setSelected();
- });
- watch(() => props.value, (val, oldVal) => {
- const { remote, valueKey } = select.props;
- if (!props.created && !remote) {
- if (valueKey && typeof val === "object" && typeof oldVal === "object" && val[valueKey] === oldVal[valueKey]) {
- return;
- }
- select.setSelected();
- }
- });
- watch(() => selectGroup.disabled, () => {
- states.groupDisabled = selectGroup.disabled;
- }, { immediate: true });
- const { queryChange } = toRaw(select);
- watch(queryChange, (changes) => {
- const { query } = unref(changes);
- const regexp4 = new RegExp(escapeStringRegexp(query), "i");
- states.visible = regexp4.test(currentLabel.value) || props.created;
- if (!states.visible) {
- select.filteredOptionsCount--;
- }
- });
- return {
- select,
- currentLabel,
- currentValue,
- itemSelected,
- isDisabled,
- hoverItem
- };
- }
- const _sfc_main$q = defineComponent({
- name: "ElOption",
- componentName: "ElOption",
- props: {
- value: {
- required: true,
- type: [String, Number, Boolean, Object]
- },
- label: [String, Number],
- created: Boolean,
- disabled: {
- type: Boolean,
- default: false
- }
- },
- setup(props) {
- const ns = useNamespace("select");
- const states = reactive({
- index: -1,
- groupDisabled: false,
- visible: true,
- hitState: false,
- hover: false
- });
- const { currentLabel, itemSelected, isDisabled, select, hoverItem } = useOption(props, states);
- const { visible, hover } = toRefs(states);
- const vm = getCurrentInstance().proxy;
- const key = vm.value;
- select.onOptionCreate(vm);
- onBeforeUnmount(() => {
- const { selected } = select;
- const selectedOptions = select.props.multiple ? selected : [selected];
- const doesSelected = selectedOptions.some((item) => {
- return item.value === vm.value;
- });
- if (select.cachedOptions.get(key) === vm && !doesSelected) {
- nextTick(() => {
- select.cachedOptions.delete(key);
- });
- }
- select.onOptionDestroy(key, vm);
- });
- function selectOptionClick() {
- if (props.disabled !== true && states.groupDisabled !== true) {
- select.handleOptionSelect(vm, true);
- }
- }
- return {
- ns,
- currentLabel,
- itemSelected,
- isDisabled,
- select,
- hoverItem,
- visible,
- hover,
- selectOptionClick,
- states
- };
- }
- });
- function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
- return withDirectives((openBlock(), createElementBlock("li", {
- class: normalizeClass([
- _ctx.ns.be("dropdown", "item"),
- _ctx.ns.is("disabled", _ctx.isDisabled),
- {
- selected: _ctx.itemSelected,
- hover: _ctx.hover
- }
- ]),
- onMouseenter: _cache[0] || (_cache[0] = (...args) => _ctx.hoverItem && _ctx.hoverItem(...args)),
- onClick: _cache[1] || (_cache[1] = withModifiers((...args) => _ctx.selectOptionClick && _ctx.selectOptionClick(...args), ["stop"]))
- }, [
- renderSlot(_ctx.$slots, "default", {}, () => [
- createElementVNode("span", null, toDisplayString(_ctx.currentLabel), 1)
- ])
- ], 34)), [
- [vShow, _ctx.visible]
- ]);
- }
- 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"]]);
- const _sfc_main$p = defineComponent({
- name: "ElSelectDropdown",
- componentName: "ElSelectDropdown",
- setup() {
- const select = inject(selectKey);
- const ns = useNamespace("select");
- const popperClass = computed(() => select.props.popperClass);
- const isMultiple = computed(() => select.props.multiple);
- const isFitInputWidth = computed(() => select.props.fitInputWidth);
- const minWidth = ref("");
- function updateMinWidth() {
- var _a2;
- minWidth.value = `${(_a2 = select.selectWrapper) == null ? void 0 : _a2.getBoundingClientRect().width}px`;
- }
- onMounted(() => {
- updateMinWidth();
- addResizeListener(select.selectWrapper, updateMinWidth);
- });
- onBeforeUnmount(() => {
- removeResizeListener(select.selectWrapper, updateMinWidth);
- });
- return {
- ns,
- minWidth,
- popperClass,
- isMultiple,
- isFitInputWidth
- };
- }
- });
- function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
- return openBlock(), createElementBlock("div", {
- class: normalizeClass([_ctx.ns.b("dropdown"), _ctx.ns.is("multiple", _ctx.isMultiple), _ctx.popperClass]),
- style: normalizeStyle({ [_ctx.isFitInputWidth ? "width" : "minWidth"]: _ctx.minWidth })
- }, [
- renderSlot(_ctx.$slots, "default")
- ], 6);
- }
- 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"]]);
- function useSelectStates(props) {
- const { t } = useLocale();
- return reactive({
- options: /* @__PURE__ */ new Map(),
- cachedOptions: /* @__PURE__ */ new Map(),
- createdLabel: null,
- createdSelected: false,
- selected: props.multiple ? [] : {},
- inputLength: 20,
- inputWidth: 0,
- initialInputHeight: 0,
- optionsCount: 0,
- filteredOptionsCount: 0,
- visible: false,
- softFocus: false,
- selectedLabel: "",
- hoverIndex: -1,
- query: "",
- previousQuery: null,
- inputHovering: false,
- cachedPlaceHolder: "",
- currentPlaceholder: t("el.select.placeholder"),
- menuVisibleOnFocus: false,
- isOnComposition: false,
- isSilentBlur: false,
- prefixWidth: 11,
- tagInMultiLine: false
- });
- }
- const useSelect = (props, states, ctx) => {
- const { t } = useLocale();
- const ns = useNamespace("select");
- const reference2 = ref(null);
- const input = ref(null);
- const tooltipRef = ref(null);
- const tags = ref(null);
- const selectWrapper = ref(null);
- const scrollbar = ref(null);
- const hoverOption = ref(-1);
- const queryChange = shallowRef({ query: "" });
- const groupQueryChange = shallowRef("");
- const elForm2 = inject(formContextKey, {});
- const elFormItem2 = inject(formItemContextKey, {});
- const readonly2 = computed(() => !props.filterable || props.multiple || !states.visible);
- const selectDisabled = computed(() => props.disabled || elForm2.disabled);
- const showClose = computed(() => {
- const hasValue = props.multiple ? Array.isArray(props.modelValue) && props.modelValue.length > 0 : props.modelValue !== void 0 && props.modelValue !== null && props.modelValue !== "";
- const criteria = props.clearable && !selectDisabled.value && states.inputHovering && hasValue;
- return criteria;
- });
- const iconComponent = computed(() => props.remote && props.filterable ? "" : props.suffixIcon);
- const iconReverse = computed(() => ns.is("reverse", iconComponent.value && states.visible));
- const debounce$1$1 = computed(() => props.remote ? 300 : 0);
- const emptyText = computed(() => {
- if (props.loading) {
- return props.loadingText || t("el.select.loading");
- } else {
- if (props.remote && states.query === "" && states.options.size === 0)
- return false;
- if (props.filterable && states.query && states.options.size > 0 && states.filteredOptionsCount === 0) {
- return props.noMatchText || t("el.select.noMatch");
- }
- if (states.options.size === 0) {
- return props.noDataText || t("el.select.noData");
- }
- }
- return null;
- });
- const optionsArray = computed(() => Array.from(states.options.values()));
- const cachedOptionsArray = computed(() => Array.from(states.cachedOptions.values()));
- const showNewOption = computed(() => {
- const hasExistingOption = optionsArray.value.filter((option) => {
- return !option.created;
- }).some((option) => {
- return option.currentLabel === states.query;
- });
- return props.filterable && props.allowCreate && states.query !== "" && !hasExistingOption;
- });
- const selectSize = useSize();
- const collapseTagSize = computed(() => ["small"].includes(selectSize.value) ? "small" : "default");
- const dropMenuVisible = computed({
- get() {
- return states.visible && emptyText.value !== false;
- },
- set(val) {
- states.visible = val;
- }
- });
- watch(() => selectDisabled.value, () => {
- nextTick(() => {
- resetInputHeight();
- });
- });
- watch(() => props.placeholder, (val) => {
- states.cachedPlaceHolder = states.currentPlaceholder = val;
- });
- watch(() => props.modelValue, (val, oldVal) => {
- var _a2;
- if (props.multiple) {
- resetInputHeight();
- if (val && val.length > 0 || input.value && states.query !== "") {
- states.currentPlaceholder = "";
- } else {
- states.currentPlaceholder = states.cachedPlaceHolder;
- }
- if (props.filterable && !props.reserveKeyword) {
- states.query = "";
- handleQueryChange(states.query);
- }
- }
- setSelected();
- if (props.filterable && !props.multiple) {
- states.inputLength = 20;
- }
- if (!isEqual(val, oldVal)) {
- (_a2 = elFormItem2.validate) == null ? void 0 : _a2.call(elFormItem2, "change").catch((err) => debugWarn());
- }
- }, {
- flush: "post",
- deep: true
- });
- watch(() => states.visible, (val) => {
- var _a2, _b2, _c;
- if (!val) {
- input.value && input.value.blur();
- states.query = "";
- states.previousQuery = null;
- states.selectedLabel = "";
- states.inputLength = 20;
- states.menuVisibleOnFocus = false;
- resetHoverIndex();
- nextTick(() => {
- if (input.value && input.value.value === "" && states.selected.length === 0) {
- states.currentPlaceholder = states.cachedPlaceHolder;
- }
- });
- if (!props.multiple) {
- if (states.selected) {
- if (props.filterable && props.allowCreate && states.createdSelected && states.createdLabel) {
- states.selectedLabel = states.createdLabel;
- } else {
- states.selectedLabel = states.selected.currentLabel;
- }
- if (props.filterable)
- states.query = states.selectedLabel;
- }
- if (props.filterable) {
- states.currentPlaceholder = states.cachedPlaceHolder;
- }
- }
- } else {
- (_b2 = (_a2 = tooltipRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b2.call(_a2);
- if (props.filterable) {
- states.filteredOptionsCount = states.optionsCount;
- states.query = props.remote ? "" : states.selectedLabel;
- if (props.multiple) {
- (_c = input.value) == null ? void 0 : _c.focus();
- } else {
- if (states.selectedLabel) {
- states.currentPlaceholder = `${states.selectedLabel}`;
- states.selectedLabel = "";
- }
- }
- handleQueryChange(states.query);
- if (!props.multiple && !props.remote) {
- queryChange.value.query = "";
- triggerRef(queryChange);
- triggerRef(groupQueryChange);
- }
- }
- }
- ctx.emit("visible-change", val);
- });
- watch(() => states.options.entries(), () => {
- var _a2, _b2, _c;
- if (!isClient)
- return;
- (_b2 = (_a2 = tooltipRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b2.call(_a2);
- if (props.multiple) {
- resetInputHeight();
- }
- const inputs = ((_c = selectWrapper.value) == null ? void 0 : _c.querySelectorAll("input")) || [];
- if (!Array.from(inputs).includes(document.activeElement)) {
- setSelected();
- }
- if (props.defaultFirstOption && (props.filterable || props.remote) && states.filteredOptionsCount) {
- checkDefaultFirstOption();
- }
- }, {
- flush: "post"
- });
- watch(() => states.hoverIndex, (val) => {
- if (typeof val === "number" && val > -1) {
- hoverOption.value = optionsArray.value[val] || {};
- }
- optionsArray.value.forEach((option) => {
- option.hover = hoverOption.value === option;
- });
- });
- const resetInputHeight = () => {
- if (props.collapseTags && !props.filterable)
- return;
- nextTick(() => {
- var _a2, _b2;
- if (!reference2.value)
- return;
- const input2 = reference2.value.$el.querySelector("input");
- const _tags = tags.value;
- const sizeInMap = states.initialInputHeight || getComponentSize(selectSize.value || elForm2.size);
- input2.style.height = states.selected.length === 0 ? `${sizeInMap}px` : `${Math.max(_tags ? _tags.clientHeight + (_tags.clientHeight > sizeInMap ? 6 : 0) : 0, sizeInMap)}px`;
- states.tagInMultiLine = Number.parseFloat(input2.style.height) >= sizeInMap;
- if (states.visible && emptyText.value !== false) {
- (_b2 = (_a2 = tooltipRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b2.call(_a2);
- }
- });
- };
- const handleQueryChange = (val) => {
- if (states.previousQuery === val || states.isOnComposition)
- return;
- if (states.previousQuery === null && (typeof props.filterMethod === "function" || typeof props.remoteMethod === "function")) {
- states.previousQuery = val;
- return;
- }
- states.previousQuery = val;
- nextTick(() => {
- var _a2, _b2;
- if (states.visible)
- (_b2 = (_a2 = tooltipRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b2.call(_a2);
- });
- states.hoverIndex = -1;
- if (props.multiple && props.filterable) {
- nextTick(() => {
- const length = input.value.value.length * 15 + 20;
- states.inputLength = props.collapseTags ? Math.min(50, length) : length;
- managePlaceholder();
- resetInputHeight();
- });
- }
- if (props.remote && typeof props.remoteMethod === "function") {
- states.hoverIndex = -1;
- props.remoteMethod(val);
- } else if (typeof props.filterMethod === "function") {
- props.filterMethod(val);
- triggerRef(groupQueryChange);
- } else {
- states.filteredOptionsCount = states.optionsCount;
- queryChange.value.query = val;
- triggerRef(queryChange);
- triggerRef(groupQueryChange);
- }
- if (props.defaultFirstOption && (props.filterable || props.remote) && states.filteredOptionsCount) {
- checkDefaultFirstOption();
- }
- };
- const managePlaceholder = () => {
- if (states.currentPlaceholder !== "") {
- states.currentPlaceholder = input.value.value ? "" : states.cachedPlaceHolder;
- }
- };
- const checkDefaultFirstOption = () => {
- const optionsInDropdown = optionsArray.value.filter((n) => n.visible && !n.disabled && !n.states.groupDisabled);
- const userCreatedOption = optionsInDropdown.find((n) => n.created);
- const firstOriginOption = optionsInDropdown[0];
- states.hoverIndex = getValueIndex(optionsArray.value, userCreatedOption || firstOriginOption);
- };
- const setSelected = () => {
- var _a2;
- if (!props.multiple) {
- const option = getOption(props.modelValue);
- if ((_a2 = option.props) == null ? void 0 : _a2.created) {
- states.createdLabel = option.props.value;
- states.createdSelected = true;
- } else {
- states.createdSelected = false;
- }
- states.selectedLabel = option.currentLabel;
- states.selected = option;
- if (props.filterable)
- states.query = states.selectedLabel;
- return;
- } else {
- states.selectedLabel = "";
- }
- const result = [];
- if (Array.isArray(props.modelValue)) {
- props.modelValue.forEach((value) => {
- result.push(getOption(value));
- });
- }
- states.selected = result;
- nextTick(() => {
- resetInputHeight();
- });
- };
- const getOption = (value) => {
- let option;
- const isObjectValue = toRawType(value).toLowerCase() === "object";
- const isNull = toRawType(value).toLowerCase() === "null";
- const isUndefined2 = toRawType(value).toLowerCase() === "undefined";
- for (let i = states.cachedOptions.size - 1; i >= 0; i--) {
- const cachedOption = cachedOptionsArray.value[i];
- const isEqualValue = isObjectValue ? get(cachedOption, props.valueKey) === get(value, props.valueKey) : cachedOption.value === value;
- if (isEqualValue) {
- option = {
- value,
- currentLabel: cachedOption.currentLabel,
- isDisabled: cachedOption.isDisabled
- };
- break;
- }
- }
- if (option)
- return option;
- const label = isObjectValue ? value.label : !isNull && !isUndefined2 ? value : "";
- const newOption = {
- value,
- currentLabel: label
- };
- if (props.multiple) {
- newOption.hitState = false;
- }
- return newOption;
- };
- const resetHoverIndex = () => {
- setTimeout(() => {
- const valueKey = props.valueKey;
- if (!props.multiple) {
- states.hoverIndex = optionsArray.value.findIndex((item) => {
- return getValueKey(item) === getValueKey(states.selected);
- });
- } else {
- if (states.selected.length > 0) {
- states.hoverIndex = Math.min.apply(null, states.selected.map((selected) => {
- return optionsArray.value.findIndex((item) => {
- return get(item, valueKey) === get(selected, valueKey);
- });
- }));
- } else {
- states.hoverIndex = -1;
- }
- }
- }, 300);
- };
- const handleResize = () => {
- var _a2, _b2;
- resetInputWidth();
- (_b2 = (_a2 = tooltipRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b2.call(_a2);
- if (props.multiple && !props.filterable)
- resetInputHeight();
- };
- const resetInputWidth = () => {
- var _a2;
- states.inputWidth = (_a2 = reference2.value) == null ? void 0 : _a2.$el.getBoundingClientRect().width;
- };
- const onInputChange = () => {
- if (props.filterable && states.query !== states.selectedLabel) {
- states.query = states.selectedLabel;
- handleQueryChange(states.query);
- }
- };
- const debouncedOnInputChange = debounce$1(() => {
- onInputChange();
- }, debounce$1$1.value);
- const debouncedQueryChange = debounce$1((e) => {
- handleQueryChange(e.target.value);
- }, debounce$1$1.value);
- const emitChange = (val) => {
- if (!isEqual(props.modelValue, val)) {
- ctx.emit(CHANGE_EVENT, val);
- }
- };
- const deletePrevTag = (e) => {
- if (e.target.value.length <= 0 && !toggleLastOptionHitState()) {
- const value = props.modelValue.slice();
- value.pop();
- ctx.emit(UPDATE_MODEL_EVENT, value);
- emitChange(value);
- }
- if (e.target.value.length === 1 && props.modelValue.length === 0) {
- states.currentPlaceholder = states.cachedPlaceHolder;
- }
- };
- const deleteTag = (event, tag) => {
- const index = states.selected.indexOf(tag);
- if (index > -1 && !selectDisabled.value) {
- const value = props.modelValue.slice();
- value.splice(index, 1);
- ctx.emit(UPDATE_MODEL_EVENT, value);
- emitChange(value);
- ctx.emit("remove-tag", tag.value);
- }
- event.stopPropagation();
- };
- const deleteSelected = (event) => {
- event.stopPropagation();
- const value = props.multiple ? [] : "";
- if (typeof value !== "string") {
- for (const item of states.selected) {
- if (item.isDisabled)
- value.push(item.value);
- }
- }
- ctx.emit(UPDATE_MODEL_EVENT, value);
- emitChange(value);
- states.visible = false;
- ctx.emit("clear");
- };
- const handleOptionSelect = (option, byClick) => {
- var _a2;
- if (props.multiple) {
- const value = (props.modelValue || []).slice();
- const optionIndex = getValueIndex(value, option.value);
- if (optionIndex > -1) {
- value.splice(optionIndex, 1);
- } else if (props.multipleLimit <= 0 || value.length < props.multipleLimit) {
- value.push(option.value);
- }
- ctx.emit(UPDATE_MODEL_EVENT, value);
- emitChange(value);
- if (option.created) {
- states.query = "";
- handleQueryChange("");
- states.inputLength = 20;
- }
- if (props.filterable)
- (_a2 = input.value) == null ? void 0 : _a2.focus();
- } else {
- ctx.emit(UPDATE_MODEL_EVENT, option.value);
- emitChange(option.value);
- states.visible = false;
- }
- states.isSilentBlur = byClick;
- setSoftFocus();
- if (states.visible)
- return;
- nextTick(() => {
- scrollToOption(option);
- });
- };
- const getValueIndex = (arr = [], value) => {
- if (!isObject$1(value))
- return arr.indexOf(value);
- const valueKey = props.valueKey;
- let index = -1;
- arr.some((item, i) => {
- if (get(item, valueKey) === get(value, valueKey)) {
- index = i;
- return true;
- }
- return false;
- });
- return index;
- };
- const setSoftFocus = () => {
- states.softFocus = true;
- const _input = input.value || reference2.value;
- if (_input) {
- _input == null ? void 0 : _input.focus();
- }
- };
- const scrollToOption = (option) => {
- var _a2, _b2, _c, _d, _e;
- const targetOption = Array.isArray(option) ? option[0] : option;
- let target = null;
- if (targetOption == null ? void 0 : targetOption.value) {
- const options = optionsArray.value.filter((item) => item.value === targetOption.value);
- if (options.length > 0) {
- target = options[0].$el;
- }
- }
- if (tooltipRef.value && target) {
- 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")}`);
- if (menu) {
- scrollIntoView(menu, target);
- }
- }
- (_e = scrollbar.value) == null ? void 0 : _e.handleScroll();
- };
- const onOptionCreate = (vm) => {
- states.optionsCount++;
- states.filteredOptionsCount++;
- states.options.set(vm.value, vm);
- states.cachedOptions.set(vm.value, vm);
- };
- const onOptionDestroy = (key, vm) => {
- if (states.options.get(key) === vm) {
- states.optionsCount--;
- states.filteredOptionsCount--;
- states.options.delete(key);
- }
- };
- const resetInputState = (e) => {
- if (e.code !== EVENT_CODE.backspace)
- toggleLastOptionHitState(false);
- states.inputLength = input.value.value.length * 15 + 20;
- resetInputHeight();
- };
- const toggleLastOptionHitState = (hit) => {
- if (!Array.isArray(states.selected))
- return;
- const option = states.selected[states.selected.length - 1];
- if (!option)
- return;
- if (hit === true || hit === false) {
- option.hitState = hit;
- return hit;
- }
- option.hitState = !option.hitState;
- return option.hitState;
- };
- const handleComposition = (event) => {
- const text = event.target.value;
- if (event.type === "compositionend") {
- states.isOnComposition = false;
- nextTick(() => handleQueryChange(text));
- } else {
- const lastCharacter = text[text.length - 1] || "";
- states.isOnComposition = !isKorean(lastCharacter);
- }
- };
- const handleMenuEnter = () => {
- nextTick(() => scrollToOption(states.selected));
- };
- const handleFocus = (event) => {
- if (!states.softFocus) {
- if (props.automaticDropdown || props.filterable) {
- if (props.filterable && !states.visible) {
- states.menuVisibleOnFocus = true;
- }
- states.visible = true;
- }
- ctx.emit("focus", event);
- } else {
- states.softFocus = false;
- }
- };
- const blur = () => {
- var _a2;
- states.visible = false;
- (_a2 = reference2.value) == null ? void 0 : _a2.blur();
- };
- const handleBlur = (event) => {
- nextTick(() => {
- if (states.isSilentBlur) {
- states.isSilentBlur = false;
- } else {
- ctx.emit("blur", event);
- }
- });
- states.softFocus = false;
- };
- const handleClearClick = (event) => {
- deleteSelected(event);
- };
- const handleClose = () => {
- states.visible = false;
- };
- const toggleMenu = () => {
- var _a2;
- if (props.automaticDropdown)
- return;
- if (!selectDisabled.value) {
- if (states.menuVisibleOnFocus) {
- states.menuVisibleOnFocus = false;
- } else {
- states.visible = !states.visible;
- }
- if (states.visible) {
- (_a2 = input.value || reference2.value) == null ? void 0 : _a2.focus();
- }
- }
- };
- const selectOption = () => {
- if (!states.visible) {
- toggleMenu();
- } else {
- if (optionsArray.value[states.hoverIndex]) {
- handleOptionSelect(optionsArray.value[states.hoverIndex], void 0);
- }
- }
- };
- const getValueKey = (item) => {
- return isObject$1(item.value) ? get(item.value, props.valueKey) : item.value;
- };
- const optionsAllDisabled = computed(() => optionsArray.value.filter((option) => option.visible).every((option) => option.disabled));
- const navigateOptions = (direction) => {
- if (!states.visible) {
- states.visible = true;
- return;
- }
- if (states.options.size === 0 || states.filteredOptionsCount === 0)
- return;
- if (states.isOnComposition)
- return;
- if (!optionsAllDisabled.value) {
- if (direction === "next") {
- states.hoverIndex++;
- if (states.hoverIndex === states.options.size) {
- states.hoverIndex = 0;
- }
- } else if (direction === "prev") {
- states.hoverIndex--;
- if (states.hoverIndex < 0) {
- states.hoverIndex = states.options.size - 1;
- }
- }
- const option = optionsArray.value[states.hoverIndex];
- if (option.disabled === true || option.states.groupDisabled === true || !option.visible) {
- navigateOptions(direction);
- }
- nextTick(() => scrollToOption(hoverOption.value));
- }
- };
- return {
- optionsArray,
- selectSize,
- handleResize,
- debouncedOnInputChange,
- debouncedQueryChange,
- deletePrevTag,
- deleteTag,
- deleteSelected,
- handleOptionSelect,
- scrollToOption,
- readonly: readonly2,
- resetInputHeight,
- showClose,
- iconComponent,
- iconReverse,
- showNewOption,
- collapseTagSize,
- setSelected,
- managePlaceholder,
- selectDisabled,
- emptyText,
- toggleLastOptionHitState,
- resetInputState,
- handleComposition,
- onOptionCreate,
- onOptionDestroy,
- handleMenuEnter,
- handleFocus,
- blur,
- handleBlur,
- handleClearClick,
- handleClose,
- toggleMenu,
- selectOption,
- getValueKey,
- navigateOptions,
- dropMenuVisible,
- queryChange,
- groupQueryChange,
- reference: reference2,
- input,
- tooltipRef,
- tags,
- selectWrapper,
- scrollbar
- };
- };
- const COMPONENT_NAME$1 = "ElSelect";
- const _sfc_main$o = defineComponent({
- name: COMPONENT_NAME$1,
- componentName: COMPONENT_NAME$1,
- components: {
- ElInput,
- ElSelectMenu,
- ElOption: Option,
- ElTag,
- ElScrollbar,
- ElTooltip,
- ElIcon
- },
- directives: { ClickOutside },
- props: {
- name: String,
- id: String,
- modelValue: {
- type: [Array, String, Number, Boolean, Object],
- default: void 0
- },
- autocomplete: {
- type: String,
- default: "off"
- },
- automaticDropdown: Boolean,
- size: {
- type: String,
- validator: isValidComponentSize
- },
- effect: {
- type: String,
- default: "light"
- },
- disabled: Boolean,
- clearable: Boolean,
- filterable: Boolean,
- allowCreate: Boolean,
- loading: Boolean,
- popperClass: {
- type: String,
- default: ""
- },
- remote: Boolean,
- loadingText: String,
- noMatchText: String,
- noDataText: String,
- remoteMethod: Function,
- filterMethod: Function,
- multiple: Boolean,
- multipleLimit: {
- type: Number,
- default: 0
- },
- placeholder: {
- type: String
- },
- defaultFirstOption: Boolean,
- reserveKeyword: {
- type: Boolean,
- default: true
- },
- valueKey: {
- type: String,
- default: "value"
- },
- collapseTags: Boolean,
- collapseTagsTooltip: {
- type: Boolean,
- default: false
- },
- popperAppendToBody: {
- type: Boolean,
- default: void 0
- },
- teleported: useTooltipContentProps.teleported,
- persistent: {
- type: Boolean,
- default: true
- },
- clearIcon: {
- type: [String, Object],
- default: circleClose
- },
- fitInputWidth: {
- type: Boolean,
- default: false
- },
- suffixIcon: {
- type: [String, Object],
- default: arrowUp
- },
- tagType: __spreadProps(__spreadValues({}, tagProps.type), { default: "info" })
- },
- emits: [
- UPDATE_MODEL_EVENT,
- CHANGE_EVENT,
- "remove-tag",
- "clear",
- "visible-change",
- "focus",
- "blur"
- ],
- setup(props, ctx) {
- const nsSelect = useNamespace("select");
- const nsInput = useNamespace("input");
- const { t } = useLocale();
- const states = useSelectStates(props);
- const {
- optionsArray,
- selectSize,
- readonly: readonly2,
- handleResize,
- collapseTagSize,
- debouncedOnInputChange,
- debouncedQueryChange,
- deletePrevTag,
- deleteTag,
- deleteSelected,
- handleOptionSelect,
- scrollToOption,
- setSelected,
- resetInputHeight,
- managePlaceholder,
- showClose,
- selectDisabled,
- iconComponent,
- iconReverse,
- showNewOption,
- emptyText,
- toggleLastOptionHitState,
- resetInputState,
- handleComposition,
- onOptionCreate,
- onOptionDestroy,
- handleMenuEnter,
- handleFocus,
- blur,
- handleBlur,
- handleClearClick,
- handleClose,
- toggleMenu,
- selectOption,
- getValueKey,
- navigateOptions,
- dropMenuVisible,
- reference: reference2,
- input,
- tooltipRef,
- tags,
- selectWrapper,
- scrollbar,
- queryChange,
- groupQueryChange
- } = useSelect(props, states, ctx);
- const { focus } = useFocus(reference2);
- const {
- inputWidth,
- selected,
- inputLength,
- filteredOptionsCount,
- visible,
- softFocus,
- selectedLabel,
- hoverIndex,
- query,
- inputHovering,
- currentPlaceholder,
- menuVisibleOnFocus,
- isOnComposition,
- isSilentBlur,
- options,
- cachedOptions,
- optionsCount,
- prefixWidth,
- tagInMultiLine
- } = toRefs(states);
- const wrapperKls = computed(() => {
- const classList = [nsSelect.b()];
- const _selectSize = unref(selectSize);
- if (_selectSize) {
- classList.push(nsSelect.m(_selectSize));
- }
- if (props.disabled) {
- classList.push(nsSelect.m("disabled"));
- }
- return classList;
- });
- const selectTagsStyle = computed(() => ({
- maxWidth: `${unref(inputWidth) - 32}px`,
- width: "100%"
- }));
- provide(selectKey, reactive({
- props,
- options,
- optionsArray,
- cachedOptions,
- optionsCount,
- filteredOptionsCount,
- hoverIndex,
- handleOptionSelect,
- onOptionCreate,
- onOptionDestroy,
- selectWrapper,
- selected,
- setSelected,
- queryChange,
- groupQueryChange
- }));
- onMounted(() => {
- states.cachedPlaceHolder = currentPlaceholder.value = props.placeholder || t("el.select.placeholder");
- if (props.multiple && Array.isArray(props.modelValue) && props.modelValue.length > 0) {
- currentPlaceholder.value = "";
- }
- addResizeListener(selectWrapper.value, handleResize);
- if (reference2.value && reference2.value.$el) {
- const input2 = reference2.value.input;
- states.initialInputHeight = input2.getBoundingClientRect().height || getComponentSize(selectSize.value);
- }
- if (props.remote && props.multiple) {
- resetInputHeight();
- }
- nextTick(() => {
- if (!reference2.value)
- return;
- if (reference2.value.$el) {
- inputWidth.value = reference2.value.$el.getBoundingClientRect().width;
- }
- if (ctx.slots.prefix) {
- const inputChildNodes = reference2.value.$el.childNodes;
- const input2 = Array.from(inputChildNodes).find((item) => item.tagName === "INPUT");
- const prefix = reference2.value.$el.querySelector(`.${nsInput.e("prefix")}`);
- prefixWidth.value = Math.max(prefix.getBoundingClientRect().width + 5, 30);
- if (states.prefixWidth) {
- input2.style.paddingLeft = `${Math.max(states.prefixWidth, 30)}px`;
- }
- }
- });
- setSelected();
- });
- onBeforeUnmount(() => {
- removeResizeListener(selectWrapper.value, handleResize);
- });
- if (props.multiple && !Array.isArray(props.modelValue)) {
- ctx.emit(UPDATE_MODEL_EVENT, []);
- }
- if (!props.multiple && Array.isArray(props.modelValue)) {
- ctx.emit(UPDATE_MODEL_EVENT, "");
- }
- const popperPaneRef = computed(() => {
- var _a2, _b2;
- return (_b2 = (_a2 = tooltipRef.value) == null ? void 0 : _a2.popperRef) == null ? void 0 : _b2.contentRef;
- });
- const { compatTeleported } = useDeprecateAppendToBody(COMPONENT_NAME$1, "popperAppendToBody");
- return {
- tagInMultiLine,
- prefixWidth,
- selectSize,
- readonly: readonly2,
- handleResize,
- collapseTagSize,
- debouncedOnInputChange,
- debouncedQueryChange,
- deletePrevTag,
- deleteTag,
- deleteSelected,
- handleOptionSelect,
- scrollToOption,
- inputWidth,
- selected,
- inputLength,
- filteredOptionsCount,
- visible,
- softFocus,
- selectedLabel,
- hoverIndex,
- query,
- inputHovering,
- currentPlaceholder,
- menuVisibleOnFocus,
- isOnComposition,
- isSilentBlur,
- options,
- resetInputHeight,
- managePlaceholder,
- showClose,
- selectDisabled,
- iconComponent,
- iconReverse,
- showNewOption,
- emptyText,
- toggleLastOptionHitState,
- resetInputState,
- handleComposition,
- handleMenuEnter,
- handleFocus,
- blur,
- handleBlur,
- handleClearClick,
- handleClose,
- toggleMenu,
- selectOption,
- getValueKey,
- navigateOptions,
- dropMenuVisible,
- focus,
- reference: reference2,
- input,
- tooltipRef,
- popperPaneRef,
- tags,
- selectWrapper,
- scrollbar,
- wrapperKls,
- selectTagsStyle,
- compatTeleported,
- nsSelect
- };
- }
- });
- const _hoisted_1$h = { class: "select-trigger" };
- const _hoisted_2$f = ["disabled", "autocomplete"];
- const _hoisted_3$a = { style: { "height": "100%", "display": "flex", "justify-content": "center", "align-items": "center" } };
- function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
- const _component_el_tag = resolveComponent("el-tag");
- const _component_el_tooltip = resolveComponent("el-tooltip");
- const _component_el_icon = resolveComponent("el-icon");
- const _component_el_input = resolveComponent("el-input");
- const _component_el_option = resolveComponent("el-option");
- const _component_el_scrollbar = resolveComponent("el-scrollbar");
- const _component_el_select_menu = resolveComponent("el-select-menu");
- const _directive_click_outside = resolveDirective("click-outside");
- return withDirectives((openBlock(), createElementBlock("div", {
- ref: "selectWrapper",
- class: normalizeClass(_ctx.wrapperKls),
- onClick: _cache[24] || (_cache[24] = withModifiers((...args) => _ctx.toggleMenu && _ctx.toggleMenu(...args), ["stop"]))
- }, [
- createVNode(_component_el_tooltip, {
- ref: "tooltipRef",
- visible: _ctx.dropMenuVisible,
- "onUpdate:visible": _cache[23] || (_cache[23] = ($event) => _ctx.dropMenuVisible = $event),
- placement: "bottom-start",
- teleported: _ctx.compatTeleported,
- "popper-class": [_ctx.nsSelect.e("popper"), _ctx.popperClass],
- "fallback-placements": ["bottom-start", "top-start", "right", "left"],
- effect: _ctx.effect,
- pure: "",
- trigger: "click",
- transition: `${_ctx.nsSelect.namespace.value}-zoom-in-top`,
- "stop-popper-mouse-event": false,
- "gpu-acceleration": false,
- persistent: _ctx.persistent,
- onShow: _ctx.handleMenuEnter
- }, {
- default: withCtx(() => [
- createElementVNode("div", _hoisted_1$h, [
- _ctx.multiple ? (openBlock(), createElementBlock("div", {
- key: 0,
- ref: "tags",
- class: normalizeClass(_ctx.nsSelect.e("tags")),
- style: normalizeStyle(_ctx.selectTagsStyle)
- }, [
- _ctx.collapseTags && _ctx.selected.length ? (openBlock(), createElementBlock("span", {
- key: 0,
- class: normalizeClass([
- _ctx.nsSelect.b("tags-wrapper"),
- { "has-prefix": _ctx.prefixWidth && _ctx.selected.length }
- ])
- }, [
- createVNode(_component_el_tag, {
- closable: !_ctx.selectDisabled && !_ctx.selected[0].isDisabled,
- size: _ctx.collapseTagSize,
- hit: _ctx.selected[0].hitState,
- type: _ctx.tagType,
- "disable-transitions": "",
- onClose: _cache[0] || (_cache[0] = ($event) => _ctx.deleteTag($event, _ctx.selected[0]))
- }, {
- default: withCtx(() => [
- createElementVNode("span", {
- class: normalizeClass(_ctx.nsSelect.e("tags-text")),
- style: normalizeStyle({ maxWidth: _ctx.inputWidth - 123 + "px" })
- }, toDisplayString(_ctx.selected[0].currentLabel), 7)
- ]),
- _: 1
- }, 8, ["closable", "size", "hit", "type"]),
- _ctx.selected.length > 1 ? (openBlock(), createBlock(_component_el_tag, {
- key: 0,
- closable: false,
- size: _ctx.collapseTagSize,
- type: _ctx.tagType,
- "disable-transitions": ""
- }, {
- default: withCtx(() => [
- _ctx.collapseTagsTooltip ? (openBlock(), createBlock(_component_el_tooltip, {
- key: 0,
- disabled: _ctx.dropMenuVisible,
- "fallback-placements": ["bottom", "top", "right", "left"],
- effect: _ctx.effect,
- placement: "bottom",
- teleported: false
- }, {
- default: withCtx(() => [
- createElementVNode("span", {
- class: normalizeClass(_ctx.nsSelect.e("tags-text"))
- }, "+ " + toDisplayString(_ctx.selected.length - 1), 3)
- ]),
- content: withCtx(() => [
- createElementVNode("div", {
- class: normalizeClass(_ctx.nsSelect.e("collapse-tags"))
- }, [
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.selected, (item, idx) => {
- return openBlock(), createElementBlock("div", {
- key: idx,
- class: normalizeClass(_ctx.nsSelect.e("collapse-tag"))
- }, [
- (openBlock(), createBlock(_component_el_tag, {
- key: _ctx.getValueKey(item),
- class: "in-tooltip",
- closable: !_ctx.selectDisabled && !item.isDisabled,
- size: _ctx.collapseTagSize,
- hit: item.hitState,
- type: _ctx.tagType,
- "disable-transitions": "",
- style: { margin: "2px" },
- onClose: ($event) => _ctx.deleteTag($event, item)
- }, {
- default: withCtx(() => [
- createElementVNode("span", {
- class: normalizeClass(_ctx.nsSelect.e("tags-text")),
- style: normalizeStyle({
- maxWidth: _ctx.inputWidth - 75 + "px"
- })
- }, toDisplayString(item.currentLabel), 7)
- ]),
- _: 2
- }, 1032, ["closable", "size", "hit", "type", "onClose"]))
- ], 2);
- }), 128))
- ], 2)
- ]),
- _: 1
- }, 8, ["disabled", "effect"])) : (openBlock(), createElementBlock("span", {
- key: 1,
- class: normalizeClass(_ctx.nsSelect.e("tags-text"))
- }, "+ " + toDisplayString(_ctx.selected.length - 1), 3))
- ]),
- _: 1
- }, 8, ["size", "type"])) : createCommentVNode("v-if", true)
- ], 2)) : createCommentVNode("v-if", true),
- createCommentVNode(" <div> "),
- !_ctx.collapseTags ? (openBlock(), createBlock(Transition, {
- key: 1,
- onAfterLeave: _ctx.resetInputHeight
- }, {
- default: withCtx(() => [
- createElementVNode("span", {
- class: normalizeClass([
- _ctx.nsSelect.b("tags-wrapper"),
- { "has-prefix": _ctx.prefixWidth && _ctx.selected.length }
- ])
- }, [
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.selected, (item) => {
- return openBlock(), createBlock(_component_el_tag, {
- key: _ctx.getValueKey(item),
- closable: !_ctx.selectDisabled && !item.isDisabled,
- size: _ctx.collapseTagSize,
- hit: item.hitState,
- type: _ctx.tagType,
- "disable-transitions": "",
- onClose: ($event) => _ctx.deleteTag($event, item)
- }, {
- default: withCtx(() => [
- createElementVNode("span", {
- class: normalizeClass(_ctx.nsSelect.e("tags-text")),
- style: normalizeStyle({ maxWidth: _ctx.inputWidth - 75 + "px" })
- }, toDisplayString(item.currentLabel), 7)
- ]),
- _: 2
- }, 1032, ["closable", "size", "hit", "type", "onClose"]);
- }), 128))
- ], 2)
- ]),
- _: 1
- }, 8, ["onAfterLeave"])) : createCommentVNode("v-if", true),
- createCommentVNode(" </div> "),
- _ctx.filterable ? withDirectives((openBlock(), createElementBlock("input", {
- key: 2,
- ref: "input",
- "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.query = $event),
- type: "text",
- class: normalizeClass([_ctx.nsSelect.e("input"), _ctx.nsSelect.is(_ctx.selectSize)]),
- disabled: _ctx.selectDisabled,
- autocomplete: _ctx.autocomplete,
- style: normalizeStyle({
- marginLeft: _ctx.prefixWidth && !_ctx.selected.length || _ctx.tagInMultiLine ? `${_ctx.prefixWidth}px` : "",
- flexGrow: 1,
- width: `${_ctx.inputLength / (_ctx.inputWidth - 32)}%`,
- maxWidth: `${_ctx.inputWidth - 42}px`
- }),
- onFocus: _cache[2] || (_cache[2] = (...args) => _ctx.handleFocus && _ctx.handleFocus(...args)),
- onBlur: _cache[3] || (_cache[3] = (...args) => _ctx.handleBlur && _ctx.handleBlur(...args)),
- onKeyup: _cache[4] || (_cache[4] = (...args) => _ctx.managePlaceholder && _ctx.managePlaceholder(...args)),
- onKeydown: [
- _cache[5] || (_cache[5] = (...args) => _ctx.resetInputState && _ctx.resetInputState(...args)),
- _cache[6] || (_cache[6] = withKeys(withModifiers(($event) => _ctx.navigateOptions("next"), ["prevent"]), ["down"])),
- _cache[7] || (_cache[7] = withKeys(withModifiers(($event) => _ctx.navigateOptions("prev"), ["prevent"]), ["up"])),
- _cache[8] || (_cache[8] = withKeys(withModifiers(($event) => _ctx.visible = false, ["stop", "prevent"]), ["esc"])),
- _cache[9] || (_cache[9] = withKeys(withModifiers((...args) => _ctx.selectOption && _ctx.selectOption(...args), ["stop", "prevent"]), ["enter"])),
- _cache[10] || (_cache[10] = withKeys((...args) => _ctx.deletePrevTag && _ctx.deletePrevTag(...args), ["delete"])),
- _cache[11] || (_cache[11] = withKeys(($event) => _ctx.visible = false, ["tab"]))
- ],
- onCompositionstart: _cache[12] || (_cache[12] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args)),
- onCompositionupdate: _cache[13] || (_cache[13] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args)),
- onCompositionend: _cache[14] || (_cache[14] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args)),
- onInput: _cache[15] || (_cache[15] = (...args) => _ctx.debouncedQueryChange && _ctx.debouncedQueryChange(...args))
- }, null, 46, _hoisted_2$f)), [
- [vModelText, _ctx.query]
- ]) : createCommentVNode("v-if", true)
- ], 6)) : createCommentVNode("v-if", true),
- createVNode(_component_el_input, {
- id: _ctx.id,
- ref: "reference",
- modelValue: _ctx.selectedLabel,
- "onUpdate:modelValue": _cache[16] || (_cache[16] = ($event) => _ctx.selectedLabel = $event),
- type: "text",
- placeholder: _ctx.currentPlaceholder,
- name: _ctx.name,
- autocomplete: _ctx.autocomplete,
- size: _ctx.selectSize,
- disabled: _ctx.selectDisabled,
- readonly: _ctx.readonly,
- "validate-event": false,
- class: normalizeClass([_ctx.nsSelect.is("focus", _ctx.visible)]),
- tabindex: _ctx.multiple && _ctx.filterable ? -1 : void 0,
- onFocus: _ctx.handleFocus,
- onBlur: _ctx.handleBlur,
- onInput: _ctx.debouncedOnInputChange,
- onPaste: _ctx.debouncedOnInputChange,
- onCompositionstart: _ctx.handleComposition,
- onCompositionupdate: _ctx.handleComposition,
- onCompositionend: _ctx.handleComposition,
- onKeydown: [
- _cache[17] || (_cache[17] = withKeys(withModifiers(($event) => _ctx.navigateOptions("next"), ["stop", "prevent"]), ["down"])),
- _cache[18] || (_cache[18] = withKeys(withModifiers(($event) => _ctx.navigateOptions("prev"), ["stop", "prevent"]), ["up"])),
- withKeys(withModifiers(_ctx.selectOption, ["stop", "prevent"]), ["enter"]),
- _cache[19] || (_cache[19] = withKeys(withModifiers(($event) => _ctx.visible = false, ["stop", "prevent"]), ["esc"])),
- _cache[20] || (_cache[20] = withKeys(($event) => _ctx.visible = false, ["tab"]))
- ],
- onMouseenter: _cache[21] || (_cache[21] = ($event) => _ctx.inputHovering = true),
- onMouseleave: _cache[22] || (_cache[22] = ($event) => _ctx.inputHovering = false)
- }, createSlots({
- suffix: withCtx(() => [
- _ctx.iconComponent && !_ctx.showClose ? (openBlock(), createBlock(_component_el_icon, {
- key: 0,
- class: normalizeClass([_ctx.nsSelect.e("caret"), _ctx.nsSelect.e("icon"), _ctx.iconReverse])
- }, {
- default: withCtx(() => [
- (openBlock(), createBlock(resolveDynamicComponent(_ctx.iconComponent)))
- ]),
- _: 1
- }, 8, ["class"])) : createCommentVNode("v-if", true),
- _ctx.showClose && _ctx.clearIcon ? (openBlock(), createBlock(_component_el_icon, {
- key: 1,
- class: normalizeClass([_ctx.nsSelect.e("caret"), _ctx.nsSelect.e("icon")]),
- onClick: _ctx.handleClearClick
- }, {
- default: withCtx(() => [
- (openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon)))
- ]),
- _: 1
- }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true)
- ]),
- _: 2
- }, [
- _ctx.$slots.prefix ? {
- name: "prefix",
- fn: withCtx(() => [
- createElementVNode("div", _hoisted_3$a, [
- renderSlot(_ctx.$slots, "prefix")
- ])
- ])
- } : void 0
- ]), 1032, ["id", "modelValue", "placeholder", "name", "autocomplete", "size", "disabled", "readonly", "class", "tabindex", "onFocus", "onBlur", "onInput", "onPaste", "onCompositionstart", "onCompositionupdate", "onCompositionend", "onKeydown"])
- ])
- ]),
- content: withCtx(() => [
- createVNode(_component_el_select_menu, null, {
- default: withCtx(() => [
- withDirectives(createVNode(_component_el_scrollbar, {
- ref: "scrollbar",
- tag: "ul",
- "wrap-class": _ctx.nsSelect.be("dropdown", "wrap"),
- "view-class": _ctx.nsSelect.be("dropdown", "list"),
- class: normalizeClass([
- _ctx.nsSelect.is("empty", !_ctx.allowCreate && Boolean(_ctx.query) && _ctx.filteredOptionsCount === 0)
- ])
- }, {
- default: withCtx(() => [
- _ctx.showNewOption ? (openBlock(), createBlock(_component_el_option, {
- key: 0,
- value: _ctx.query,
- created: true
- }, null, 8, ["value"])) : createCommentVNode("v-if", true),
- renderSlot(_ctx.$slots, "default")
- ]),
- _: 3
- }, 8, ["wrap-class", "view-class", "class"]), [
- [vShow, _ctx.options.size > 0 && !_ctx.loading]
- ]),
- _ctx.emptyText && (!_ctx.allowCreate || _ctx.loading || _ctx.allowCreate && _ctx.options.size === 0) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
- _ctx.$slots.empty ? renderSlot(_ctx.$slots, "empty", { key: 0 }) : (openBlock(), createElementBlock("p", {
- key: 1,
- class: normalizeClass(_ctx.nsSelect.be("dropdown", "empty"))
- }, toDisplayString(_ctx.emptyText), 3))
- ], 2112)) : createCommentVNode("v-if", true)
- ]),
- _: 3
- })
- ]),
- _: 3
- }, 8, ["visible", "teleported", "popper-class", "effect", "transition", "persistent", "onShow"])
- ], 2)), [
- [_directive_click_outside, _ctx.handleClose, _ctx.popperPaneRef]
- ]);
- }
- 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"]]);
- const _sfc_main$n = defineComponent({
- name: "ElOptionGroup",
- componentName: "ElOptionGroup",
- props: {
- label: String,
- disabled: {
- type: Boolean,
- default: false
- }
- },
- setup(props) {
- const ns = useNamespace("select");
- const visible = ref(true);
- const instance = getCurrentInstance();
- const children = ref([]);
- provide(selectGroupKey, reactive(__spreadValues({}, toRefs(props))));
- const select = inject(selectKey);
- onMounted(() => {
- children.value = flattedChildren(instance.subTree);
- });
- const flattedChildren = (node) => {
- const children2 = [];
- if (Array.isArray(node.children)) {
- node.children.forEach((child) => {
- var _a2;
- if (child.type && child.type.name === "ElOption" && child.component && child.component.proxy) {
- children2.push(child.component.proxy);
- } else if ((_a2 = child.children) == null ? void 0 : _a2.length) {
- children2.push(...flattedChildren(child));
- }
- });
- }
- return children2;
- };
- const { groupQueryChange } = toRaw(select);
- watch(groupQueryChange, () => {
- visible.value = children.value.some((option) => option.visible === true);
- });
- return {
- visible,
- ns
- };
- }
- });
- function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
- return withDirectives((openBlock(), createElementBlock("ul", {
- class: normalizeClass(_ctx.ns.be("group", "wrap"))
- }, [
- createElementVNode("li", {
- class: normalizeClass(_ctx.ns.be("group", "title"))
- }, toDisplayString(_ctx.label), 3),
- createElementVNode("li", null, [
- createElementVNode("ul", {
- class: normalizeClass(_ctx.ns.b("group"))
- }, [
- renderSlot(_ctx.$slots, "default")
- ], 2)
- ])
- ], 2)), [
- [vShow, _ctx.visible]
- ]);
- }
- 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"]]);
- const ElSelect = withInstall(Select, {
- Option,
- OptionGroup
- });
- const ElOption = withNoopInstall(Option);
- withNoopInstall(OptionGroup);
- const progressProps = buildProps({
- type: {
- type: String,
- default: "line",
- values: ["line", "circle", "dashboard"]
- },
- percentage: {
- type: Number,
- default: 0,
- validator: (val) => val >= 0 && val <= 100
- },
- status: {
- type: String,
- default: "",
- values: ["", "success", "exception", "warning"]
- },
- indeterminate: {
- type: Boolean,
- default: false
- },
- duration: {
- type: Number,
- default: 3
- },
- strokeWidth: {
- type: Number,
- default: 6
- },
- strokeLinecap: {
- type: definePropType(String),
- default: "round"
- },
- textInside: {
- type: Boolean,
- default: false
- },
- width: {
- type: Number,
- default: 126
- },
- showText: {
- type: Boolean,
- default: true
- },
- color: {
- type: definePropType([
- String,
- Array,
- Function
- ]),
- default: ""
- },
- format: {
- type: definePropType(Function),
- default: (percentage) => `${percentage}%`
- }
- });
- const _sfc_main$m = defineComponent({
- name: "ElProgress",
- components: {
- ElIcon,
- CircleCheck: circleCheck,
- CircleClose: circleClose,
- Check: check,
- Close: close,
- WarningFilled: warningFilled
- },
- props: progressProps,
- setup(props) {
- const ns = useNamespace("progress");
- const barStyle = computed(() => ({
- width: `${props.percentage}%`,
- animationDuration: `${props.duration}s`,
- backgroundColor: getCurrentColor(props.percentage)
- }));
- const relativeStrokeWidth = computed(() => (props.strokeWidth / props.width * 100).toFixed(1));
- const radius = computed(() => {
- if (props.type === "circle" || props.type === "dashboard") {
- return Number.parseInt(`${50 - Number.parseFloat(relativeStrokeWidth.value) / 2}`, 10);
- } else {
- return 0;
- }
- });
- const trackPath = computed(() => {
- const r = radius.value;
- const isDashboard = props.type === "dashboard";
- return `
- M 50 50
- m 0 ${isDashboard ? "" : "-"}${r}
- a ${r} ${r} 0 1 1 0 ${isDashboard ? "-" : ""}${r * 2}
- a ${r} ${r} 0 1 1 0 ${isDashboard ? "" : "-"}${r * 2}
- `;
- });
- const perimeter = computed(() => 2 * Math.PI * radius.value);
- const rate = computed(() => props.type === "dashboard" ? 0.75 : 1);
- const strokeDashoffset = computed(() => {
- const offset2 = -1 * perimeter.value * (1 - rate.value) / 2;
- return `${offset2}px`;
- });
- const trailPathStyle = computed(() => ({
- strokeDasharray: `${perimeter.value * rate.value}px, ${perimeter.value}px`,
- strokeDashoffset: strokeDashoffset.value
- }));
- const circlePathStyle = computed(() => ({
- strokeDasharray: `${perimeter.value * rate.value * (props.percentage / 100)}px, ${perimeter.value}px`,
- strokeDashoffset: strokeDashoffset.value,
- transition: "stroke-dasharray 0.6s ease 0s, stroke 0.6s ease"
- }));
- const stroke = computed(() => {
- let ret;
- if (props.color) {
- ret = getCurrentColor(props.percentage);
- } else {
- switch (props.status) {
- case "success":
- ret = "#13ce66";
- break;
- case "exception":
- ret = "#ff4949";
- break;
- case "warning":
- ret = "#e6a23c";
- break;
- default:
- ret = "#20a0ff";
- }
- }
- return ret;
- });
- const statusIcon = computed(() => {
- if (props.status === "warning") {
- return warningFilled;
- }
- if (props.type === "line") {
- return props.status === "success" ? circleCheck : circleClose;
- } else {
- return props.status === "success" ? check : close;
- }
- });
- const progressTextSize = computed(() => {
- return props.type === "line" ? 12 + props.strokeWidth * 0.4 : props.width * 0.111111 + 2;
- });
- const content2 = computed(() => props.format(props.percentage));
- const getCurrentColor = (percentage) => {
- var _a2;
- const { color } = props;
- if (typeof color === "function") {
- return color(percentage);
- } else if (typeof color === "string") {
- return color;
- } else {
- const span = 100 / color.length;
- const seriesColors = color.map((seriesColor, index) => {
- if (typeof seriesColor === "string") {
- return {
- color: seriesColor,
- percentage: (index + 1) * span
- };
- }
- return seriesColor;
- });
- const colors = seriesColors.sort((a2, b2) => a2.percentage - b2.percentage);
- for (const color2 of colors) {
- if (color2.percentage > percentage)
- return color2.color;
- }
- return (_a2 = colors[colors.length - 1]) == null ? void 0 : _a2.color;
- }
- };
- const slotData = computed(() => {
- return {
- percentage: props.percentage
- };
- });
- return {
- ns,
- barStyle,
- relativeStrokeWidth,
- radius,
- trackPath,
- perimeter,
- rate,
- strokeDashoffset,
- trailPathStyle,
- circlePathStyle,
- stroke,
- statusIcon,
- progressTextSize,
- content: content2,
- slotData
- };
- }
- });
- const _hoisted_1$g = ["aria-valuenow"];
- const _hoisted_2$e = { viewBox: "0 0 100 100" };
- const _hoisted_3$9 = ["d", "stroke-width"];
- const _hoisted_4$8 = ["d", "stroke", "stroke-linecap", "stroke-width"];
- const _hoisted_5$8 = { key: 0 };
- function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
- const _component_el_icon = resolveComponent("el-icon");
- return openBlock(), createElementBlock("div", {
- class: normalizeClass([
- _ctx.ns.b(),
- _ctx.ns.m(_ctx.type),
- _ctx.ns.is(_ctx.status),
- {
- [_ctx.ns.m("without-text")]: !_ctx.showText,
- [_ctx.ns.m("text-inside")]: _ctx.textInside
- }
- ]),
- role: "progressbar",
- "aria-valuenow": _ctx.percentage,
- "aria-valuemin": "0",
- "aria-valuemax": "100"
- }, [
- _ctx.type === "line" ? (openBlock(), createElementBlock("div", {
- key: 0,
- class: normalizeClass(_ctx.ns.b("bar"))
- }, [
- createElementVNode("div", {
- class: normalizeClass(_ctx.ns.be("bar", "outer")),
- style: normalizeStyle({ height: `${_ctx.strokeWidth}px` })
- }, [
- createElementVNode("div", {
- class: normalizeClass([
- _ctx.ns.be("bar", "inner"),
- { [_ctx.ns.bem("bar", "inner", "indeterminate")]: _ctx.indeterminate }
- ]),
- style: normalizeStyle(_ctx.barStyle)
- }, [
- (_ctx.showText || _ctx.$slots.default) && _ctx.textInside ? (openBlock(), createElementBlock("div", {
- key: 0,
- class: normalizeClass(_ctx.ns.be("bar", "innerText"))
- }, [
- renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(_ctx.slotData)), () => [
- createElementVNode("span", null, toDisplayString(_ctx.content), 1)
- ])
- ], 2)) : createCommentVNode("v-if", true)
- ], 6)
- ], 6)
- ], 2)) : (openBlock(), createElementBlock("div", {
- key: 1,
- class: normalizeClass(_ctx.ns.b("circle")),
- style: normalizeStyle({ height: `${_ctx.width}px`, width: `${_ctx.width}px` })
- }, [
- (openBlock(), createElementBlock("svg", _hoisted_2$e, [
- createElementVNode("path", {
- class: normalizeClass(_ctx.ns.be("circle", "track")),
- d: _ctx.trackPath,
- stroke: "var(--el-fill-color-light, #e5e9f2)",
- "stroke-width": _ctx.relativeStrokeWidth,
- fill: "none",
- style: normalizeStyle(_ctx.trailPathStyle)
- }, null, 14, _hoisted_3$9),
- createElementVNode("path", {
- class: normalizeClass(_ctx.ns.be("circle", "path")),
- d: _ctx.trackPath,
- stroke: _ctx.stroke,
- fill: "none",
- "stroke-linecap": _ctx.strokeLinecap,
- "stroke-width": _ctx.percentage ? _ctx.relativeStrokeWidth : 0,
- style: normalizeStyle(_ctx.circlePathStyle)
- }, null, 14, _hoisted_4$8)
- ]))
- ], 6)),
- (_ctx.showText || _ctx.$slots.default) && !_ctx.textInside ? (openBlock(), createElementBlock("div", {
- key: 2,
- class: normalizeClass(_ctx.ns.e("text")),
- style: normalizeStyle({ fontSize: `${_ctx.progressTextSize}px` })
- }, [
- renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(_ctx.slotData)), () => [
- !_ctx.status ? (openBlock(), createElementBlock("span", _hoisted_5$8, toDisplayString(_ctx.content), 1)) : (openBlock(), createBlock(_component_el_icon, { key: 1 }, {
- default: withCtx(() => [
- (openBlock(), createBlock(resolveDynamicComponent(_ctx.statusIcon)))
- ]),
- _: 1
- }))
- ])
- ], 6)) : createCommentVNode("v-if", true)
- ], 10, _hoisted_1$g);
- }
- 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"]]);
- const ElProgress = withInstall(Progress);
- const rateProps = buildProps({
- modelValue: {
- type: Number,
- default: 0
- },
- lowThreshold: {
- type: Number,
- default: 2
- },
- highThreshold: {
- type: Number,
- default: 4
- },
- max: {
- type: Number,
- default: 5
- },
- colors: {
- type: definePropType([Array, Object]),
- default: () => mutable(["", "", ""])
- },
- voidColor: {
- type: String,
- default: ""
- },
- disabledVoidColor: {
- type: String,
- default: ""
- },
- icons: {
- type: definePropType([Array, Object]),
- default: () => [starFilled, starFilled, starFilled]
- },
- voidIcon: {
- type: iconPropType,
- default: () => star
- },
- disabledVoidIcon: {
- type: iconPropType,
- default: () => starFilled
- },
- disabled: {
- type: Boolean,
- default: false
- },
- allowHalf: {
- type: Boolean,
- default: false
- },
- showText: {
- type: Boolean,
- default: false
- },
- showScore: {
- type: Boolean,
- default: false
- },
- textColor: {
- type: String,
- default: ""
- },
- texts: {
- type: definePropType(Array),
- default: () => mutable([
- "Extremely bad",
- "Disappointed",
- "Fair",
- "Satisfied",
- "Surprise"
- ])
- },
- scoreTemplate: {
- type: String,
- default: "{value}"
- },
- size: {
- type: String,
- validator: isValidComponentSize
- }
- });
- const rateEmits = {
- change: (value) => typeof value === "number",
- [UPDATE_MODEL_EVENT]: (value) => typeof value === "number"
- };
- const _hoisted_1$f = ["aria-valuenow", "aria-valuetext", "aria-valuemax"];
- const _hoisted_2$d = ["onMousemove", "onClick"];
- const __default__$5 = {
- name: "ElRate"
- };
- const _sfc_main$l = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$5), {
- props: rateProps,
- emits: rateEmits,
- setup(__props, { expose, emit }) {
- const props = __props;
- function getValueFromMap(value, map) {
- const isExcludedObject = (val) => isObject$1(val);
- const matchedKeys = Object.keys(map).map((key) => +key).filter((key) => {
- const val = map[key];
- const excluded = isExcludedObject(val) ? val.excluded : false;
- return excluded ? value < key : value <= key;
- }).sort((a2, b2) => a2 - b2);
- const matchedValue = map[matchedKeys[0]];
- return isExcludedObject(matchedValue) && matchedValue.value || matchedValue;
- }
- const formContext = inject(formContextKey, void 0);
- const rateSize = useSize();
- const ns = useNamespace("rate");
- const currentValue = ref(props.modelValue);
- const hoverIndex = ref(-1);
- const pointerAtLeftHalf = ref(true);
- const rateClasses = computed(() => [ns.b(), ns.m(rateSize.value)]);
- const rateDisabled = computed(() => props.disabled || (formContext == null ? void 0 : formContext.disabled));
- const rateStyles = computed(() => {
- return {
- "--el-rate-void-color": props.voidColor,
- "--el-rate-disabled-void-color": props.disabledVoidColor,
- "--el-rate-fill-color": activeColor.value
- };
- });
- const text = computed(() => {
- let result = "";
- if (props.showScore) {
- result = props.scoreTemplate.replace(/\{\s*value\s*\}/, rateDisabled.value ? `${props.modelValue}` : `${currentValue.value}`);
- } else if (props.showText) {
- result = props.texts[Math.ceil(currentValue.value) - 1];
- }
- return result;
- });
- const valueDecimal = computed(() => props.modelValue * 100 - Math.floor(props.modelValue) * 100);
- const colorMap = computed(() => isArray(props.colors) ? {
- [props.lowThreshold]: props.colors[0],
- [props.highThreshold]: { value: props.colors[1], excluded: true },
- [props.max]: props.colors[2]
- } : props.colors);
- const activeColor = computed(() => {
- const color = getValueFromMap(currentValue.value, colorMap.value);
- return isObject$1(color) ? "" : color;
- });
- const decimalStyle = computed(() => {
- let width = "";
- if (rateDisabled.value) {
- width = `${valueDecimal.value}%`;
- } else if (props.allowHalf) {
- width = "50%";
- }
- return {
- color: activeColor.value,
- width
- };
- });
- const componentMap = computed(() => isArray(props.icons) ? {
- [props.lowThreshold]: props.icons[0],
- [props.highThreshold]: {
- value: props.icons[1],
- excluded: true
- },
- [props.max]: props.icons[2]
- } : props.icons);
- const decimalIconComponent = computed(() => getValueFromMap(props.modelValue, componentMap.value));
- const voidComponent = computed(() => rateDisabled.value ? props.disabledVoidIcon : props.voidIcon);
- const activeComponent = computed(() => getValueFromMap(currentValue.value, componentMap.value));
- const iconComponents = computed(() => {
- const result = Array.from({ length: props.max });
- const threshold = currentValue.value;
- result.fill(activeComponent.value, 0, threshold);
- result.fill(voidComponent.value, threshold, props.max);
- return result;
- });
- function showDecimalIcon(item) {
- const showWhenDisabled = rateDisabled.value && valueDecimal.value > 0 && item - 1 < props.modelValue && item > props.modelValue;
- const showWhenAllowHalf = props.allowHalf && pointerAtLeftHalf.value && item - 0.5 <= currentValue.value && item > currentValue.value;
- return showWhenDisabled || showWhenAllowHalf;
- }
- function selectValue(value) {
- if (rateDisabled.value) {
- return;
- }
- if (props.allowHalf && pointerAtLeftHalf.value) {
- emit(UPDATE_MODEL_EVENT, currentValue.value);
- if (props.modelValue !== currentValue.value) {
- emit("change", currentValue.value);
- }
- } else {
- emit(UPDATE_MODEL_EVENT, value);
- if (props.modelValue !== value) {
- emit("change", value);
- }
- }
- }
- function handleKey(e) {
- if (rateDisabled.value) {
- return;
- }
- let _currentValue = currentValue.value;
- const code = e.code;
- if (code === EVENT_CODE.up || code === EVENT_CODE.right) {
- if (props.allowHalf) {
- _currentValue += 0.5;
- } else {
- _currentValue += 1;
- }
- e.stopPropagation();
- e.preventDefault();
- } else if (code === EVENT_CODE.left || code === EVENT_CODE.down) {
- if (props.allowHalf) {
- _currentValue -= 0.5;
- } else {
- _currentValue -= 1;
- }
- e.stopPropagation();
- e.preventDefault();
- }
- _currentValue = _currentValue < 0 ? 0 : _currentValue;
- _currentValue = _currentValue > props.max ? props.max : _currentValue;
- emit(UPDATE_MODEL_EVENT, _currentValue);
- emit("change", _currentValue);
- return _currentValue;
- }
- function setCurrentValue(value, event) {
- if (rateDisabled.value) {
- return;
- }
- if (props.allowHalf) {
- let target = event.target;
- if (hasClass(target, ns.e("item"))) {
- target = target.querySelector(`.${ns.e("icon")}`);
- }
- if (target.clientWidth === 0 || hasClass(target, ns.e("decimal"))) {
- target = target.parentNode;
- }
- pointerAtLeftHalf.value = event.offsetX * 2 <= target.clientWidth;
- currentValue.value = pointerAtLeftHalf.value ? value - 0.5 : value;
- } else {
- currentValue.value = value;
- }
- hoverIndex.value = value;
- }
- function resetCurrentValue() {
- if (rateDisabled.value) {
- return;
- }
- if (props.allowHalf) {
- pointerAtLeftHalf.value = props.modelValue !== Math.floor(props.modelValue);
- }
- currentValue.value = props.modelValue;
- hoverIndex.value = -1;
- }
- watch(() => props.modelValue, (val) => {
- currentValue.value = val;
- pointerAtLeftHalf.value = props.modelValue !== Math.floor(props.modelValue);
- });
- if (!props.modelValue) {
- emit(UPDATE_MODEL_EVENT, 0);
- }
- expose({
- setCurrentValue,
- resetCurrentValue
- });
- return (_ctx, _cache) => {
- return openBlock(), createElementBlock("div", {
- class: normalizeClass([unref(rateClasses), unref(ns).is("disabled", unref(rateDisabled))]),
- role: "slider",
- "aria-valuenow": currentValue.value,
- "aria-valuetext": unref(text),
- "aria-valuemin": "0",
- "aria-valuemax": _ctx.max,
- tabindex: "0",
- style: normalizeStyle(unref(rateStyles)),
- onKeydown: handleKey
- }, [
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.max, (item, key) => {
- return openBlock(), createElementBlock("span", {
- key,
- class: normalizeClass(unref(ns).e("item")),
- onMousemove: ($event) => setCurrentValue(item, $event),
- onMouseleave: resetCurrentValue,
- onClick: ($event) => selectValue(item)
- }, [
- createVNode(unref(ElIcon), {
- class: normalizeClass([
- unref(ns).e("icon"),
- { hover: hoverIndex.value === item },
- unref(ns).is("active", item <= currentValue.value)
- ])
- }, {
- default: withCtx(() => [
- !showDecimalIcon(item) ? (openBlock(), createBlock(resolveDynamicComponent(unref(iconComponents)[item - 1]), { key: 0 })) : createCommentVNode("v-if", true),
- showDecimalIcon(item) ? (openBlock(), createBlock(unref(ElIcon), {
- key: 1,
- style: normalizeStyle(unref(decimalStyle)),
- class: normalizeClass([unref(ns).e("icon"), unref(ns).e("decimal")])
- }, {
- default: withCtx(() => [
- (openBlock(), createBlock(resolveDynamicComponent(unref(decimalIconComponent))))
- ]),
- _: 1
- }, 8, ["style", "class"])) : createCommentVNode("v-if", true)
- ]),
- _: 2
- }, 1032, ["class"])
- ], 42, _hoisted_2$d);
- }), 128)),
- _ctx.showText || _ctx.showScore ? (openBlock(), createElementBlock("span", {
- key: 0,
- class: normalizeClass(unref(ns).e("text"))
- }, toDisplayString(unref(text)), 3)) : createCommentVNode("v-if", true)
- ], 46, _hoisted_1$f);
- };
- }
- }));
- var Rate = /* @__PURE__ */ _export_sfc$1(_sfc_main$l, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/rate/src/rate.vue"]]);
- const ElRate = withInstall(Rate);
- const useTooltip = (props, formatTooltip, showTooltip) => {
- const tooltip = ref(null);
- const tooltipVisible = ref(false);
- const enableFormat = computed(() => {
- return formatTooltip.value instanceof Function;
- });
- const formatValue = computed(() => {
- return enableFormat.value && formatTooltip.value(props.modelValue) || props.modelValue;
- });
- const displayTooltip = debounce$1(() => {
- showTooltip.value && (tooltipVisible.value = true);
- }, 50);
- const hideTooltip = debounce$1(() => {
- showTooltip.value && (tooltipVisible.value = false);
- }, 50);
- return {
- tooltip,
- tooltipVisible,
- formatValue,
- displayTooltip,
- hideTooltip
- };
- };
- const useSliderButton = (props, initData, emit) => {
- const {
- disabled,
- min: min2,
- max: max2,
- step,
- showTooltip,
- precision,
- sliderSize,
- formatTooltip,
- emitChange,
- resetSize,
- updateDragging
- } = inject("SliderProvider");
- const { tooltip, tooltipVisible, formatValue, displayTooltip, hideTooltip } = useTooltip(props, formatTooltip, showTooltip);
- const currentPosition = computed(() => {
- return `${(props.modelValue - min2.value) / (max2.value - min2.value) * 100}%`;
- });
- const wrapperStyle = computed(() => {
- return props.vertical ? { bottom: currentPosition.value } : { left: currentPosition.value };
- });
- const handleMouseEnter = () => {
- initData.hovering = true;
- displayTooltip();
- };
- const handleMouseLeave = () => {
- initData.hovering = false;
- if (!initData.dragging) {
- hideTooltip();
- }
- };
- const onButtonDown = (event) => {
- if (disabled.value)
- return;
- event.preventDefault();
- onDragStart(event);
- on(window, "mousemove", onDragging);
- on(window, "touchmove", onDragging);
- on(window, "mouseup", onDragEnd);
- on(window, "touchend", onDragEnd);
- on(window, "contextmenu", onDragEnd);
- };
- const onLeftKeyDown = () => {
- if (disabled.value)
- return;
- initData.newPosition = Number.parseFloat(currentPosition.value) - step.value / (max2.value - min2.value) * 100;
- setPosition(initData.newPosition);
- emitChange();
- };
- const onRightKeyDown = () => {
- if (disabled.value)
- return;
- initData.newPosition = Number.parseFloat(currentPosition.value) + step.value / (max2.value - min2.value) * 100;
- setPosition(initData.newPosition);
- emitChange();
- };
- const getClientXY = (event) => {
- let clientX;
- let clientY;
- if (event.type.startsWith("touch")) {
- clientY = event.touches[0].clientY;
- clientX = event.touches[0].clientX;
- } else {
- clientY = event.clientY;
- clientX = event.clientX;
- }
- return {
- clientX,
- clientY
- };
- };
- const onDragStart = (event) => {
- initData.dragging = true;
- initData.isClick = true;
- const { clientX, clientY } = getClientXY(event);
- if (props.vertical) {
- initData.startY = clientY;
- } else {
- initData.startX = clientX;
- }
- initData.startPosition = Number.parseFloat(currentPosition.value);
- initData.newPosition = initData.startPosition;
- };
- const onDragging = (event) => {
- if (initData.dragging) {
- initData.isClick = false;
- displayTooltip();
- resetSize();
- let diff;
- const { clientX, clientY } = getClientXY(event);
- if (props.vertical) {
- initData.currentY = clientY;
- diff = (initData.startY - initData.currentY) / sliderSize.value * 100;
- } else {
- initData.currentX = clientX;
- diff = (initData.currentX - initData.startX) / sliderSize.value * 100;
- }
- initData.newPosition = initData.startPosition + diff;
- setPosition(initData.newPosition);
- }
- };
- const onDragEnd = () => {
- if (initData.dragging) {
- setTimeout(() => {
- initData.dragging = false;
- if (!initData.hovering) {
- hideTooltip();
- }
- if (!initData.isClick) {
- setPosition(initData.newPosition);
- emitChange();
- }
- }, 0);
- off(window, "mousemove", onDragging);
- off(window, "touchmove", onDragging);
- off(window, "mouseup", onDragEnd);
- off(window, "touchend", onDragEnd);
- off(window, "contextmenu", onDragEnd);
- }
- };
- const setPosition = async (newPosition) => {
- if (newPosition === null || Number.isNaN(+newPosition))
- return;
- if (newPosition < 0) {
- newPosition = 0;
- } else if (newPosition > 100) {
- newPosition = 100;
- }
- const lengthPerStep = 100 / ((max2.value - min2.value) / step.value);
- const steps = Math.round(newPosition / lengthPerStep);
- let value = steps * lengthPerStep * (max2.value - min2.value) * 0.01 + min2.value;
- value = Number.parseFloat(value.toFixed(precision.value));
- emit(UPDATE_MODEL_EVENT, value);
- if (!initData.dragging && props.modelValue !== initData.oldValue) {
- initData.oldValue = props.modelValue;
- }
- await nextTick();
- initData.dragging && displayTooltip();
- tooltip.value.updatePopper();
- };
- watch(() => initData.dragging, (val) => {
- updateDragging(val);
- });
- return {
- tooltip,
- tooltipVisible,
- showTooltip,
- wrapperStyle,
- formatValue,
- handleMouseEnter,
- handleMouseLeave,
- onButtonDown,
- onLeftKeyDown,
- onRightKeyDown,
- setPosition
- };
- };
- const _sfc_main$k = defineComponent({
- name: "ElSliderButton",
- components: {
- ElTooltip
- },
- props: {
- modelValue: {
- type: Number,
- default: 0
- },
- vertical: {
- type: Boolean,
- default: false
- },
- tooltipClass: {
- type: String,
- default: ""
- }
- },
- emits: [UPDATE_MODEL_EVENT],
- setup(props, { emit }) {
- const ns = useNamespace("slider");
- const initData = reactive({
- hovering: false,
- dragging: false,
- isClick: false,
- startX: 0,
- currentX: 0,
- startY: 0,
- currentY: 0,
- startPosition: 0,
- newPosition: 0,
- oldValue: props.modelValue
- });
- const {
- tooltip,
- showTooltip,
- tooltipVisible,
- wrapperStyle,
- formatValue,
- handleMouseEnter,
- handleMouseLeave,
- onButtonDown,
- onLeftKeyDown,
- onRightKeyDown,
- setPosition
- } = useSliderButton(props, initData, emit);
- const { hovering, dragging } = toRefs(initData);
- return {
- ns,
- tooltip,
- tooltipVisible,
- showTooltip,
- wrapperStyle,
- formatValue,
- handleMouseEnter,
- handleMouseLeave,
- onButtonDown,
- onLeftKeyDown,
- onRightKeyDown,
- setPosition,
- hovering,
- dragging
- };
- }
- });
- function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
- const _component_el_tooltip = resolveComponent("el-tooltip");
- return openBlock(), createElementBlock("div", {
- ref: "button",
- class: normalizeClass([_ctx.ns.e("button-wrapper"), { hover: _ctx.hovering, dragging: _ctx.dragging }]),
- style: normalizeStyle(_ctx.wrapperStyle),
- tabindex: "0",
- onMouseenter: _cache[1] || (_cache[1] = (...args) => _ctx.handleMouseEnter && _ctx.handleMouseEnter(...args)),
- onMouseleave: _cache[2] || (_cache[2] = (...args) => _ctx.handleMouseLeave && _ctx.handleMouseLeave(...args)),
- onMousedown: _cache[3] || (_cache[3] = (...args) => _ctx.onButtonDown && _ctx.onButtonDown(...args)),
- onTouchstart: _cache[4] || (_cache[4] = (...args) => _ctx.onButtonDown && _ctx.onButtonDown(...args)),
- onFocus: _cache[5] || (_cache[5] = (...args) => _ctx.handleMouseEnter && _ctx.handleMouseEnter(...args)),
- onBlur: _cache[6] || (_cache[6] = (...args) => _ctx.handleMouseLeave && _ctx.handleMouseLeave(...args)),
- onKeydown: [
- _cache[7] || (_cache[7] = withKeys((...args) => _ctx.onLeftKeyDown && _ctx.onLeftKeyDown(...args), ["left"])),
- _cache[8] || (_cache[8] = withKeys((...args) => _ctx.onRightKeyDown && _ctx.onRightKeyDown(...args), ["right"])),
- _cache[9] || (_cache[9] = withKeys(withModifiers((...args) => _ctx.onLeftKeyDown && _ctx.onLeftKeyDown(...args), ["prevent"]), ["down"])),
- _cache[10] || (_cache[10] = withKeys(withModifiers((...args) => _ctx.onRightKeyDown && _ctx.onRightKeyDown(...args), ["prevent"]), ["up"]))
- ]
- }, [
- createVNode(_component_el_tooltip, {
- ref: "tooltip",
- visible: _ctx.tooltipVisible,
- "onUpdate:visible": _cache[0] || (_cache[0] = ($event) => _ctx.tooltipVisible = $event),
- placement: "top",
- "stop-popper-mouse-event": false,
- "popper-class": _ctx.tooltipClass,
- disabled: !_ctx.showTooltip,
- persistent: ""
- }, {
- content: withCtx(() => [
- createElementVNode("span", null, toDisplayString(_ctx.formatValue), 1)
- ]),
- default: withCtx(() => [
- createElementVNode("div", {
- class: normalizeClass([_ctx.ns.e("button"), { hover: _ctx.hovering, dragging: _ctx.dragging }])
- }, null, 2)
- ]),
- _: 1
- }, 8, ["visible", "popper-class", "disabled"])
- ], 38);
- }
- 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"]]);
- const _sfc_main$j = defineComponent({
- name: "ElMarker",
- props: {
- mark: {
- type: [String, Object],
- default: () => void 0
- }
- },
- setup(props) {
- const ns = useNamespace("slider");
- const label = computed(() => {
- return typeof props.mark === "string" ? props.mark : props.mark.label;
- });
- return {
- ns,
- label
- };
- },
- render() {
- var _a2;
- return h$1("div", {
- class: this.ns.e("marks-text"),
- style: (_a2 = this.mark) == null ? void 0 : _a2.style
- }, this.label);
- }
- });
- var SliderMarker = /* @__PURE__ */ _export_sfc$1(_sfc_main$j, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/slider/src/marker.vue"]]);
- const useMarks = (props) => {
- return computed(() => {
- if (!props.marks) {
- return [];
- }
- const marksKeys = Object.keys(props.marks);
- return marksKeys.map(parseFloat).sort((a2, b2) => a2 - b2).filter((point) => point <= props.max && point >= props.min).map((point) => ({
- point,
- position: (point - props.min) * 100 / (props.max - props.min),
- mark: props.marks[point]
- }));
- });
- };
- const useSlide = (props, initData, emit) => {
- const elForm2 = inject(formContextKey, {});
- const elFormItem2 = inject(formItemContextKey, {});
- const slider = shallowRef(null);
- const firstButton = ref(null);
- const secondButton = ref(null);
- const buttonRefs = {
- firstButton,
- secondButton
- };
- const sliderDisabled = computed(() => {
- return props.disabled || elForm2.disabled || false;
- });
- const minValue = computed(() => {
- return Math.min(initData.firstValue, initData.secondValue);
- });
- const maxValue = computed(() => {
- return Math.max(initData.firstValue, initData.secondValue);
- });
- const barSize = computed(() => {
- return props.range ? `${100 * (maxValue.value - minValue.value) / (props.max - props.min)}%` : `${100 * (initData.firstValue - props.min) / (props.max - props.min)}%`;
- });
- const barStart = computed(() => {
- return props.range ? `${100 * (minValue.value - props.min) / (props.max - props.min)}%` : "0%";
- });
- const runwayStyle = computed(() => {
- return props.vertical ? { height: props.height } : {};
- });
- const barStyle = computed(() => {
- return props.vertical ? {
- height: barSize.value,
- bottom: barStart.value
- } : {
- width: barSize.value,
- left: barStart.value
- };
- });
- const resetSize = () => {
- if (slider.value) {
- initData.sliderSize = slider.value[`client${props.vertical ? "Height" : "Width"}`];
- }
- };
- const setPosition = (percent) => {
- const targetValue = props.min + percent * (props.max - props.min) / 100;
- if (!props.range) {
- firstButton.value.setPosition(percent);
- return;
- }
- let buttonRefName;
- if (Math.abs(minValue.value - targetValue) < Math.abs(maxValue.value - targetValue)) {
- buttonRefName = initData.firstValue < initData.secondValue ? "firstButton" : "secondButton";
- } else {
- buttonRefName = initData.firstValue > initData.secondValue ? "firstButton" : "secondButton";
- }
- buttonRefs[buttonRefName].value.setPosition(percent);
- };
- const setFirstValue = (firstValue) => {
- initData.firstValue = firstValue;
- _emit(props.range ? [minValue.value, maxValue.value] : firstValue);
- };
- const setSecondValue = (secondValue) => {
- initData.secondValue = secondValue;
- if (props.range) {
- _emit([minValue.value, maxValue.value]);
- }
- };
- const _emit = (val) => {
- emit(UPDATE_MODEL_EVENT, val);
- emit(INPUT_EVENT, val);
- };
- const emitChange = async () => {
- await nextTick();
- emit(CHANGE_EVENT, props.range ? [minValue.value, maxValue.value] : props.modelValue);
- };
- const onSliderClick = (event) => {
- if (sliderDisabled.value || initData.dragging)
- return;
- resetSize();
- if (props.vertical) {
- const sliderOffsetBottom = slider.value.getBoundingClientRect().bottom;
- setPosition((sliderOffsetBottom - event.clientY) / initData.sliderSize * 100);
- } else {
- const sliderOffsetLeft = slider.value.getBoundingClientRect().left;
- setPosition((event.clientX - sliderOffsetLeft) / initData.sliderSize * 100);
- }
- emitChange();
- };
- return {
- elFormItem: elFormItem2,
- slider,
- firstButton,
- secondButton,
- sliderDisabled,
- minValue,
- maxValue,
- runwayStyle,
- barStyle,
- resetSize,
- setPosition,
- emitChange,
- onSliderClick,
- setFirstValue,
- setSecondValue
- };
- };
- const useStops = (props, initData, minValue, maxValue) => {
- const stops = computed(() => {
- if (!props.showStops || props.min > props.max)
- return [];
- if (props.step === 0) {
- return [];
- }
- const stopCount = (props.max - props.min) / props.step;
- const stepWidth = 100 * props.step / (props.max - props.min);
- const result = Array.from({ length: stopCount - 1 }).map((_2, index) => (index + 1) * stepWidth);
- if (props.range) {
- return result.filter((step) => {
- return step < 100 * (minValue.value - props.min) / (props.max - props.min) || step > 100 * (maxValue.value - props.min) / (props.max - props.min);
- });
- } else {
- return result.filter((step) => step > 100 * (initData.firstValue - props.min) / (props.max - props.min));
- }
- });
- const getStopStyle = (position) => {
- return props.vertical ? { bottom: `${position}%` } : { left: `${position}%` };
- };
- return {
- stops,
- getStopStyle
- };
- };
- const _sfc_main$i = defineComponent({
- name: "ElSlider",
- components: {
- ElInputNumber,
- SliderButton,
- SliderMarker
- },
- props: {
- modelValue: {
- type: [Number, Array],
- default: 0
- },
- min: {
- type: Number,
- default: 0
- },
- max: {
- type: Number,
- default: 100
- },
- step: {
- type: Number,
- default: 1
- },
- showInput: {
- type: Boolean,
- default: false
- },
- showInputControls: {
- type: Boolean,
- default: true
- },
- size: {
- type: String,
- validator: isValidComponentSize
- },
- inputSize: {
- type: String,
- validator: isValidComponentSize
- },
- showStops: {
- type: Boolean,
- default: false
- },
- showTooltip: {
- type: Boolean,
- default: true
- },
- formatTooltip: {
- type: Function,
- default: void 0
- },
- disabled: {
- type: Boolean,
- default: false
- },
- range: {
- type: Boolean,
- default: false
- },
- vertical: {
- type: Boolean,
- default: false
- },
- height: {
- type: String,
- default: ""
- },
- debounce: {
- type: Number,
- default: 300
- },
- label: {
- type: String,
- default: void 0
- },
- tooltipClass: {
- type: String,
- default: void 0
- },
- marks: Object
- },
- emits: [UPDATE_MODEL_EVENT, CHANGE_EVENT, INPUT_EVENT],
- setup(props, { emit }) {
- const ns = useNamespace("slider");
- const initData = reactive({
- firstValue: 0,
- secondValue: 0,
- oldValue: 0,
- dragging: false,
- sliderSize: 1
- });
- const {
- elFormItem: elFormItem2,
- slider,
- firstButton,
- secondButton,
- sliderDisabled,
- minValue,
- maxValue,
- runwayStyle,
- barStyle,
- resetSize,
- emitChange,
- onSliderClick,
- setFirstValue,
- setSecondValue
- } = useSlide(props, initData, emit);
- const { stops, getStopStyle } = useStops(props, initData, minValue, maxValue);
- const sliderWrapperSize = useSize();
- const sliderInputSize = computed(() => props.inputSize || sliderWrapperSize.value);
- const sliderKls = computed(() => [
- ns.b(),
- ns.m(sliderWrapperSize.value),
- ns.is("vertical", props.vertical),
- { [ns.m("with-input")]: props.showInput }
- ]);
- const markList = useMarks(props);
- useWatch(props, initData, minValue, maxValue, emit, elFormItem2);
- const precision = computed(() => {
- const precisions = [props.min, props.max, props.step].map((item) => {
- const decimal = `${item}`.split(".")[1];
- return decimal ? decimal.length : 0;
- });
- return Math.max.apply(null, precisions);
- });
- const { sliderWrapper } = useLifecycle(props, initData, resetSize);
- const { firstValue, secondValue, oldValue, dragging, sliderSize } = toRefs(initData);
- const updateDragging = (val) => {
- initData.dragging = val;
- };
- provide("SliderProvider", __spreadProps(__spreadValues({}, toRefs(props)), {
- sliderSize,
- disabled: sliderDisabled,
- precision,
- emitChange,
- resetSize,
- updateDragging
- }));
- return {
- ns,
- firstValue,
- secondValue,
- oldValue,
- dragging,
- sliderSize,
- slider,
- firstButton,
- secondButton,
- sliderDisabled,
- runwayStyle,
- barStyle,
- emitChange,
- onSliderClick,
- getStopStyle,
- setFirstValue,
- setSecondValue,
- stops,
- markList,
- sliderWrapper,
- sliderWrapperSize,
- sliderInputSize,
- sliderKls
- };
- }
- });
- const useWatch = (props, initData, minValue, maxValue, emit, elFormItem2) => {
- const _emit = (val) => {
- emit(UPDATE_MODEL_EVENT, val);
- emit(INPUT_EVENT, val);
- };
- const valueChanged = () => {
- if (props.range) {
- return ![minValue.value, maxValue.value].every((item, index) => item === initData.oldValue[index]);
- } else {
- return props.modelValue !== initData.oldValue;
- }
- };
- const setValues = () => {
- var _a2, _b2;
- if (props.min > props.max) {
- throwError("Slider", "min should not be greater than max.");
- return;
- }
- const val = props.modelValue;
- if (props.range && Array.isArray(val)) {
- if (val[1] < props.min) {
- _emit([props.min, props.min]);
- } else if (val[0] > props.max) {
- _emit([props.max, props.max]);
- } else if (val[0] < props.min) {
- _emit([props.min, val[1]]);
- } else if (val[1] > props.max) {
- _emit([val[0], props.max]);
- } else {
- initData.firstValue = val[0];
- initData.secondValue = val[1];
- if (valueChanged()) {
- (_a2 = elFormItem2.validate) == null ? void 0 : _a2.call(elFormItem2, "change").catch((err) => debugWarn());
- initData.oldValue = val.slice();
- }
- }
- } else if (!props.range && typeof val === "number" && !Number.isNaN(val)) {
- if (val < props.min) {
- _emit(props.min);
- } else if (val > props.max) {
- _emit(props.max);
- } else {
- initData.firstValue = val;
- if (valueChanged()) {
- (_b2 = elFormItem2.validate) == null ? void 0 : _b2.call(elFormItem2, "change").catch((err) => debugWarn());
- initData.oldValue = val;
- }
- }
- }
- };
- setValues();
- watch(() => initData.dragging, (val) => {
- if (!val) {
- setValues();
- }
- });
- watch(() => props.modelValue, (val, oldVal) => {
- if (initData.dragging || Array.isArray(val) && Array.isArray(oldVal) && val.every((item, index) => item === oldVal[index]) && initData.firstValue === val[0] && initData.secondValue === val[1]) {
- return;
- }
- setValues();
- }, {
- deep: true
- });
- watch(() => [props.min, props.max], () => {
- setValues();
- });
- };
- const useLifecycle = (props, initData, resetSize) => {
- const sliderWrapper = ref(null);
- onMounted(async () => {
- let valuetext;
- if (props.range) {
- if (Array.isArray(props.modelValue)) {
- initData.firstValue = Math.max(props.min, props.modelValue[0]);
- initData.secondValue = Math.min(props.max, props.modelValue[1]);
- } else {
- initData.firstValue = props.min;
- initData.secondValue = props.max;
- }
- initData.oldValue = [initData.firstValue, initData.secondValue];
- valuetext = `${initData.firstValue}-${initData.secondValue}`;
- } else {
- if (typeof props.modelValue !== "number" || Number.isNaN(props.modelValue)) {
- initData.firstValue = props.min;
- } else {
- initData.firstValue = Math.min(props.max, Math.max(props.min, props.modelValue));
- }
- initData.oldValue = initData.firstValue;
- valuetext = initData.firstValue;
- }
- sliderWrapper.value.setAttribute("aria-valuetext", valuetext);
- sliderWrapper.value.setAttribute("aria-label", props.label ? props.label : `slider between ${props.min} and ${props.max}`);
- on(window, "resize", resetSize);
- await nextTick();
- resetSize();
- });
- onBeforeUnmount(() => {
- off(window, "resize", resetSize);
- });
- return {
- sliderWrapper
- };
- };
- const _hoisted_1$e = ["aria-valuemin", "aria-valuemax", "aria-orientation", "aria-disabled"];
- const _hoisted_2$c = { key: 1 };
- function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
- const _component_slider_button = resolveComponent("slider-button");
- const _component_slider_marker = resolveComponent("slider-marker");
- const _component_el_input_number = resolveComponent("el-input-number");
- return openBlock(), createElementBlock("div", {
- ref: "sliderWrapper",
- class: normalizeClass(_ctx.sliderKls),
- role: "slider",
- "aria-valuemin": _ctx.min,
- "aria-valuemax": _ctx.max,
- "aria-orientation": _ctx.vertical ? "vertical" : "horizontal",
- "aria-disabled": _ctx.sliderDisabled
- }, [
- createElementVNode("div", {
- ref: "slider",
- class: normalizeClass([
- _ctx.ns.e("runway"),
- { "show-input": _ctx.showInput && !_ctx.range },
- _ctx.ns.is("disabled", _ctx.sliderDisabled)
- ]),
- style: normalizeStyle(_ctx.runwayStyle),
- onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onSliderClick && _ctx.onSliderClick(...args))
- }, [
- createElementVNode("div", {
- class: normalizeClass(_ctx.ns.e("bar")),
- style: normalizeStyle(_ctx.barStyle)
- }, null, 6),
- createVNode(_component_slider_button, {
- ref: "firstButton",
- "model-value": _ctx.firstValue,
- vertical: _ctx.vertical,
- "tooltip-class": _ctx.tooltipClass,
- "onUpdate:modelValue": _ctx.setFirstValue
- }, null, 8, ["model-value", "vertical", "tooltip-class", "onUpdate:modelValue"]),
- _ctx.range ? (openBlock(), createBlock(_component_slider_button, {
- key: 0,
- ref: "secondButton",
- "model-value": _ctx.secondValue,
- vertical: _ctx.vertical,
- "tooltip-class": _ctx.tooltipClass,
- "onUpdate:modelValue": _ctx.setSecondValue
- }, null, 8, ["model-value", "vertical", "tooltip-class", "onUpdate:modelValue"])) : createCommentVNode("v-if", true),
- _ctx.showStops ? (openBlock(), createElementBlock("div", _hoisted_2$c, [
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.stops, (item, key) => {
- return openBlock(), createElementBlock("div", {
- key,
- class: normalizeClass(_ctx.ns.e("stop")),
- style: normalizeStyle(_ctx.getStopStyle(item))
- }, null, 6);
- }), 128))
- ])) : createCommentVNode("v-if", true),
- _ctx.markList.length > 0 ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
- createElementVNode("div", null, [
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.markList, (item, key) => {
- return openBlock(), createElementBlock("div", {
- key,
- style: normalizeStyle(_ctx.getStopStyle(item.position)),
- class: normalizeClass([_ctx.ns.e("stop"), _ctx.ns.e("marks-stop")])
- }, null, 6);
- }), 128))
- ]),
- createElementVNode("div", {
- class: normalizeClass(_ctx.ns.e("marks"))
- }, [
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.markList, (item, key) => {
- return openBlock(), createBlock(_component_slider_marker, {
- key,
- mark: item.mark,
- style: normalizeStyle(_ctx.getStopStyle(item.position))
- }, null, 8, ["mark", "style"]);
- }), 128))
- ], 2)
- ], 64)) : createCommentVNode("v-if", true)
- ], 6),
- _ctx.showInput && !_ctx.range ? (openBlock(), createBlock(_component_el_input_number, {
- key: 0,
- ref: "input",
- "model-value": _ctx.firstValue,
- class: normalizeClass(_ctx.ns.e("input")),
- step: _ctx.step,
- disabled: _ctx.sliderDisabled,
- controls: _ctx.showInputControls,
- min: _ctx.min,
- max: _ctx.max,
- debounce: _ctx.debounce,
- size: _ctx.sliderInputSize,
- "onUpdate:modelValue": _ctx.setFirstValue,
- onChange: _ctx.emitChange
- }, null, 8, ["model-value", "class", "step", "disabled", "controls", "min", "max", "debounce", "size", "onUpdate:modelValue", "onChange"])) : createCommentVNode("v-if", true)
- ], 10, _hoisted_1$e);
- }
- 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"]]);
- Slider.install = (app) => {
- app.component(Slider.name, Slider);
- };
- const _Slider = Slider;
- const ElSlider = _Slider;
- const spaceItem = buildProps({
- prefixCls: {
- type: String,
- default: ""
- }
- });
- const _sfc_main$h = defineComponent({
- props: spaceItem,
- setup(props) {
- const ns = useNamespace("space");
- const classes = computed(() => `${props.prefixCls || ns.b()}__item`);
- return {
- classes
- };
- }
- });
- function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
- return openBlock(), createElementBlock("div", {
- class: normalizeClass(_ctx.classes)
- }, [
- renderSlot(_ctx.$slots, "default")
- ], 2);
- }
- 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"]]);
- const SIZE_MAP = {
- small: 8,
- default: 12,
- large: 16
- };
- function useSpace(props) {
- const ns = useNamespace("space");
- const classes = computed(() => [ns.b(), ns.m(props.direction), props.class]);
- const horizontalSize = ref(0);
- const verticalSize = ref(0);
- const containerStyle = computed(() => {
- const wrapKls = props.wrap || props.fill ? { flexWrap: "wrap", marginBottom: `-${verticalSize.value}px` } : {};
- const alignment = {
- alignItems: props.alignment
- };
- return [wrapKls, alignment, props.style];
- });
- const itemStyle = computed(() => {
- const itemBaseStyle = {
- paddingBottom: `${verticalSize.value}px`,
- marginRight: `${horizontalSize.value}px`
- };
- const fillStyle = props.fill ? { flexGrow: 1, minWidth: `${props.fillRatio}%` } : {};
- return [itemBaseStyle, fillStyle];
- });
- watchEffect(() => {
- const { size = "small", wrap, direction: dir, fill } = props;
- if (Array.isArray(size)) {
- const [h2 = 0, v2 = 0] = size;
- horizontalSize.value = h2;
- verticalSize.value = v2;
- } else {
- let val;
- if (isNumber(size)) {
- val = size;
- } else {
- val = SIZE_MAP[size] || SIZE_MAP.small;
- }
- if ((wrap || fill) && dir === "horizontal") {
- horizontalSize.value = verticalSize.value = val;
- } else {
- if (dir === "horizontal") {
- horizontalSize.value = val;
- verticalSize.value = 0;
- } else {
- verticalSize.value = val;
- horizontalSize.value = 0;
- }
- }
- }
- });
- return {
- classes,
- containerStyle,
- itemStyle
- };
- }
- const spaceProps = buildProps({
- direction: {
- type: String,
- values: ["horizontal", "vertical"],
- default: "horizontal"
- },
- class: {
- type: definePropType([
- String,
- Object,
- Array
- ]),
- default: ""
- },
- style: {
- type: definePropType([String, Array, Object]),
- default: ""
- },
- alignment: {
- type: definePropType(String),
- default: "center"
- },
- prefixCls: {
- type: String
- },
- spacer: {
- type: definePropType([Object, String, Number, Array]),
- default: null,
- validator: (val) => isVNode(val) || isNumber(val) || isString(val)
- },
- wrap: {
- type: Boolean,
- default: false
- },
- fill: {
- type: Boolean,
- default: false
- },
- fillRatio: {
- type: Number,
- default: 100
- },
- size: {
- type: [String, Array, Number],
- values: componentSizes,
- validator: (val) => {
- return isNumber(val) || isArray(val) && val.length === 2 && val.every((i) => isNumber(i));
- }
- }
- });
- var Space = defineComponent({
- name: "ElSpace",
- props: spaceProps,
- setup(props, { slots }) {
- const { classes, containerStyle, itemStyle } = useSpace(props);
- return () => {
- var _a2;
- const { spacer, prefixCls, direction } = props;
- const children = renderSlot(slots, "default", { key: 0 }, () => []);
- if (((_a2 = children.children) != null ? _a2 : []).length === 0)
- return null;
- if (isArray(children.children)) {
- let extractedChildren = [];
- children.children.forEach((child, loopKey) => {
- if (isFragment(child)) {
- if (isArray(child.children)) {
- child.children.forEach((nested, key) => {
- extractedChildren.push(createVNode(Item, {
- style: itemStyle.value,
- prefixCls,
- key: `nested-${key}`
- }, {
- default: () => [nested]
- }, PatchFlags.PROPS | PatchFlags.STYLE, ["style", "prefixCls"]));
- });
- }
- } else if (isValidElementNode(child)) {
- extractedChildren.push(createVNode(Item, {
- style: itemStyle.value,
- prefixCls,
- key: `LoopKey${loopKey}`
- }, {
- default: () => [child]
- }, PatchFlags.PROPS | PatchFlags.STYLE, ["style", "prefixCls"]));
- }
- });
- if (spacer) {
- const len = extractedChildren.length - 1;
- extractedChildren = extractedChildren.reduce((acc, child, idx) => {
- const children2 = [...acc, child];
- if (idx !== len) {
- children2.push(createVNode("span", {
- style: [
- itemStyle.value,
- direction === "vertical" ? "width: 100%" : null
- ],
- key: idx
- }, [
- isVNode(spacer) ? spacer : createTextVNode(spacer, PatchFlags.TEXT)
- ], PatchFlags.STYLE));
- }
- return children2;
- }, []);
- }
- return createVNode("div", {
- class: classes.value,
- style: containerStyle.value
- }, extractedChildren, PatchFlags.STYLE | PatchFlags.CLASS);
- }
- return children.children;
- };
- }
- });
- const ElSpace = withInstall(Space);
- const switchProps = buildProps({
- modelValue: {
- type: [Boolean, String, Number],
- default: false
- },
- value: {
- type: [Boolean, String, Number],
- default: false
- },
- disabled: {
- type: Boolean,
- default: false
- },
- width: {
- type: Number,
- default: 40
- },
- inlinePrompt: {
- type: Boolean,
- default: false
- },
- activeIcon: {
- type: iconPropType,
- default: ""
- },
- inactiveIcon: {
- type: iconPropType,
- default: ""
- },
- activeText: {
- type: String,
- default: ""
- },
- inactiveText: {
- type: String,
- default: ""
- },
- activeColor: {
- type: String,
- default: ""
- },
- inactiveColor: {
- type: String,
- default: ""
- },
- borderColor: {
- type: String,
- default: ""
- },
- activeValue: {
- type: [Boolean, String, Number],
- default: true
- },
- inactiveValue: {
- type: [Boolean, String, Number],
- default: false
- },
- name: {
- type: String,
- default: ""
- },
- validateEvent: {
- type: Boolean,
- default: true
- },
- id: String,
- loading: {
- type: Boolean,
- default: false
- },
- beforeChange: {
- type: definePropType(Function)
- },
- size: {
- type: String,
- validator: isValidComponentSize
- }
- });
- const switchEmits = {
- [UPDATE_MODEL_EVENT]: (val) => isBoolean(val) || isString(val) || isNumber(val),
- [CHANGE_EVENT]: (val) => isBoolean(val) || isString(val) || isNumber(val),
- [INPUT_EVENT]: (val) => isBoolean(val) || isString(val) || isNumber(val)
- };
- const COMPONENT_NAME = "ElSwitch";
- const _sfc_main$g = defineComponent({
- name: COMPONENT_NAME,
- components: { ElIcon, Loading: loading },
- props: switchProps,
- emits: switchEmits,
- setup(props, { emit }) {
- const { formItem } = useFormItem();
- const switchDisabled = useDisabled$1(computed(() => props.loading));
- const ns = useNamespace("switch");
- const switchSize = useSize();
- const isModelValue = ref(props.modelValue !== false);
- const input = ref();
- const core = ref();
- const switchKls = computed(() => [
- ns.b(),
- ns.m(switchSize.value),
- ns.is("disabled", switchDisabled.value),
- ns.is("checked", checked.value)
- ]);
- watch(() => props.modelValue, () => {
- isModelValue.value = true;
- });
- watch(() => props.value, () => {
- isModelValue.value = false;
- });
- const actualValue = computed(() => {
- return isModelValue.value ? props.modelValue : props.value;
- });
- const checked = computed(() => actualValue.value === props.activeValue);
- if (![props.activeValue, props.inactiveValue].includes(actualValue.value)) {
- emit(UPDATE_MODEL_EVENT, props.inactiveValue);
- emit(CHANGE_EVENT, props.inactiveValue);
- emit(INPUT_EVENT, props.inactiveValue);
- }
- watch(checked, () => {
- var _a2;
- input.value.checked = checked.value;
- if (props.activeColor || props.inactiveColor) {
- setBackgroundColor();
- }
- if (props.validateEvent) {
- (_a2 = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a2.call(formItem, "change").catch((err) => debugWarn());
- }
- });
- const handleChange2 = () => {
- const val = checked.value ? props.inactiveValue : props.activeValue;
- emit(UPDATE_MODEL_EVENT, val);
- emit(CHANGE_EVENT, val);
- emit(INPUT_EVENT, val);
- nextTick(() => {
- input.value.checked = checked.value;
- });
- };
- const switchValue = () => {
- if (switchDisabled.value)
- return;
- const { beforeChange } = props;
- if (!beforeChange) {
- handleChange2();
- return;
- }
- const shouldChange = beforeChange();
- const isExpectType = [
- isPromise(shouldChange),
- isBoolean(shouldChange)
- ].some((i) => i);
- if (!isExpectType) {
- throwError(COMPONENT_NAME, "beforeChange must return type `Promise<boolean>` or `boolean`");
- }
- if (isPromise(shouldChange)) {
- shouldChange.then((result) => {
- if (result) {
- handleChange2();
- }
- }).catch((e) => {
- });
- } else if (shouldChange) {
- handleChange2();
- }
- };
- const setBackgroundColor = () => {
- const newColor = checked.value ? props.activeColor : props.inactiveColor;
- const coreEl = core.value;
- if (props.borderColor)
- coreEl.style.borderColor = props.borderColor;
- else if (!props.borderColor)
- coreEl.style.borderColor = newColor;
- coreEl.style.backgroundColor = newColor;
- coreEl.children[0].style.color = newColor;
- };
- const focus = () => {
- var _a2, _b2;
- (_b2 = (_a2 = input.value) == null ? void 0 : _a2.focus) == null ? void 0 : _b2.call(_a2);
- };
- onMounted(() => {
- if (props.activeColor || props.inactiveColor || props.borderColor) {
- setBackgroundColor();
- }
- input.value.checked = checked.value;
- });
- return {
- ns,
- input,
- core,
- switchDisabled,
- checked,
- switchKls,
- handleChange: handleChange2,
- switchValue,
- focus
- };
- }
- });
- const _hoisted_1$d = ["aria-checked", "aria-disabled"];
- const _hoisted_2$b = ["id", "name", "true-value", "false-value", "disabled"];
- const _hoisted_3$8 = ["aria-hidden"];
- const _hoisted_4$7 = ["aria-hidden"];
- const _hoisted_5$7 = ["aria-hidden"];
- const _hoisted_6$6 = ["aria-hidden"];
- function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
- const _component_el_icon = resolveComponent("el-icon");
- const _component_loading = resolveComponent("loading");
- return openBlock(), createElementBlock("div", {
- class: normalizeClass(_ctx.switchKls),
- role: "switch",
- "aria-checked": _ctx.checked,
- "aria-disabled": _ctx.switchDisabled,
- onClick: _cache[2] || (_cache[2] = withModifiers((...args) => _ctx.switchValue && _ctx.switchValue(...args), ["prevent"]))
- }, [
- createElementVNode("input", {
- id: _ctx.id,
- ref: "input",
- class: normalizeClass(_ctx.ns.e("input")),
- type: "checkbox",
- name: _ctx.name,
- "true-value": _ctx.activeValue,
- "false-value": _ctx.inactiveValue,
- disabled: _ctx.switchDisabled,
- onChange: _cache[0] || (_cache[0] = (...args) => _ctx.handleChange && _ctx.handleChange(...args)),
- onKeydown: _cache[1] || (_cache[1] = withKeys((...args) => _ctx.switchValue && _ctx.switchValue(...args), ["enter"]))
- }, null, 42, _hoisted_2$b),
- !_ctx.inlinePrompt && (_ctx.inactiveIcon || _ctx.inactiveText) ? (openBlock(), createElementBlock("span", {
- key: 0,
- class: normalizeClass([
- _ctx.ns.e("label"),
- _ctx.ns.em("label", "left"),
- _ctx.ns.is("active", !_ctx.checked)
- ])
- }, [
- _ctx.inactiveIcon ? (openBlock(), createBlock(_component_el_icon, { key: 0 }, {
- default: withCtx(() => [
- (openBlock(), createBlock(resolveDynamicComponent(_ctx.inactiveIcon)))
- ]),
- _: 1
- })) : createCommentVNode("v-if", true),
- !_ctx.inactiveIcon && _ctx.inactiveText ? (openBlock(), createElementBlock("span", {
- key: 1,
- "aria-hidden": _ctx.checked
- }, toDisplayString(_ctx.inactiveText), 9, _hoisted_3$8)) : createCommentVNode("v-if", true)
- ], 2)) : createCommentVNode("v-if", true),
- createElementVNode("span", {
- ref: "core",
- class: normalizeClass(_ctx.ns.e("core")),
- style: normalizeStyle({ width: (_ctx.width || 40) + "px" })
- }, [
- _ctx.inlinePrompt ? (openBlock(), createElementBlock("div", {
- key: 0,
- class: normalizeClass(_ctx.ns.e("inner"))
- }, [
- _ctx.activeIcon || _ctx.inactiveIcon ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
- _ctx.activeIcon ? (openBlock(), createBlock(_component_el_icon, {
- key: 0,
- class: normalizeClass([_ctx.ns.is("icon"), _ctx.checked ? _ctx.ns.is("show") : _ctx.ns.is("hide")])
- }, {
- default: withCtx(() => [
- (openBlock(), createBlock(resolveDynamicComponent(_ctx.activeIcon)))
- ]),
- _: 1
- }, 8, ["class"])) : createCommentVNode("v-if", true),
- _ctx.inactiveIcon ? (openBlock(), createBlock(_component_el_icon, {
- key: 1,
- class: normalizeClass([_ctx.ns.is("icon"), !_ctx.checked ? _ctx.ns.is("show") : _ctx.ns.is("hide")])
- }, {
- default: withCtx(() => [
- (openBlock(), createBlock(resolveDynamicComponent(_ctx.inactiveIcon)))
- ]),
- _: 1
- }, 8, ["class"])) : createCommentVNode("v-if", true)
- ], 64)) : _ctx.activeText || _ctx.inactiveIcon ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
- _ctx.activeText ? (openBlock(), createElementBlock("span", {
- key: 0,
- class: normalizeClass([_ctx.ns.is("text"), _ctx.checked ? _ctx.ns.is("show") : _ctx.ns.is("hide")]),
- "aria-hidden": !_ctx.checked
- }, toDisplayString(_ctx.activeText.substring(0, 3)), 11, _hoisted_4$7)) : createCommentVNode("v-if", true),
- _ctx.inactiveText ? (openBlock(), createElementBlock("span", {
- key: 1,
- class: normalizeClass([_ctx.ns.is("text"), !_ctx.checked ? _ctx.ns.is("show") : _ctx.ns.is("hide")]),
- "aria-hidden": _ctx.checked
- }, toDisplayString(_ctx.inactiveText.substring(0, 3)), 11, _hoisted_5$7)) : createCommentVNode("v-if", true)
- ], 64)) : createCommentVNode("v-if", true)
- ], 2)) : createCommentVNode("v-if", true),
- createElementVNode("div", {
- class: normalizeClass(_ctx.ns.e("action"))
- }, [
- _ctx.loading ? (openBlock(), createBlock(_component_el_icon, {
- key: 0,
- class: normalizeClass(_ctx.ns.is("loading"))
- }, {
- default: withCtx(() => [
- createVNode(_component_loading)
- ]),
- _: 1
- }, 8, ["class"])) : createCommentVNode("v-if", true)
- ], 2)
- ], 6),
- !_ctx.inlinePrompt && (_ctx.activeIcon || _ctx.activeText) ? (openBlock(), createElementBlock("span", {
- key: 1,
- class: normalizeClass([
- _ctx.ns.e("label"),
- _ctx.ns.em("label", "right"),
- _ctx.ns.is("active", _ctx.checked)
- ])
- }, [
- _ctx.activeIcon ? (openBlock(), createBlock(_component_el_icon, { key: 0 }, {
- default: withCtx(() => [
- (openBlock(), createBlock(resolveDynamicComponent(_ctx.activeIcon)))
- ]),
- _: 1
- })) : createCommentVNode("v-if", true),
- !_ctx.activeIcon && _ctx.activeText ? (openBlock(), createElementBlock("span", {
- key: 1,
- "aria-hidden": !_ctx.checked
- }, toDisplayString(_ctx.activeText), 9, _hoisted_6$6)) : createCommentVNode("v-if", true)
- ], 2)) : createCommentVNode("v-if", true)
- ], 10, _hoisted_1$d);
- }
- 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"]]);
- const ElSwitch = withInstall(Switch);
- /*!
- * escape-html
- * Copyright(c) 2012-2013 TJ Holowaychuk
- * Copyright(c) 2015 Andreas Lubbe
- * Copyright(c) 2015 Tiancheng "Timothy" Gu
- * MIT Licensed
- */
- var matchHtmlRegExp = /["'&<>]/;
- var escapeHtml_1 = escapeHtml;
- function escapeHtml(string3) {
- var str = "" + string3;
- var match = matchHtmlRegExp.exec(str);
- if (!match) {
- return str;
- }
- var escape;
- var html = "";
- var index = 0;
- var lastIndex = 0;
- for (index = match.index; index < str.length; index++) {
- switch (str.charCodeAt(index)) {
- case 34:
- escape = """;
- break;
- case 38:
- escape = "&";
- break;
- case 39:
- escape = "'";
- break;
- case 60:
- escape = "<";
- break;
- case 62:
- escape = ">";
- break;
- default:
- continue;
- }
- if (lastIndex !== index) {
- html += str.substring(lastIndex, index);
- }
- lastIndex = index + 1;
- html += escape;
- }
- return lastIndex !== index ? html + str.substring(lastIndex, index) : html;
- }
- const getCell = function(event) {
- let cell = event.target;
- while (cell && cell.tagName.toUpperCase() !== "HTML") {
- if (cell.tagName.toUpperCase() === "TD") {
- return cell;
- }
- cell = cell.parentNode;
- }
- return null;
- };
- const isObject = function(obj) {
- return obj !== null && typeof obj === "object";
- };
- const orderBy = function(array4, sortKey, reverse, sortMethod, sortBy) {
- if (!sortKey && !sortMethod && (!sortBy || Array.isArray(sortBy) && !sortBy.length)) {
- return array4;
- }
- if (typeof reverse === "string") {
- reverse = reverse === "descending" ? -1 : 1;
- } else {
- reverse = reverse && reverse < 0 ? -1 : 1;
- }
- const getKey = sortMethod ? null : function(value, index) {
- if (sortBy) {
- if (!Array.isArray(sortBy)) {
- sortBy = [sortBy];
- }
- return sortBy.map((by) => {
- if (typeof by === "string") {
- return get(value, by);
- } else {
- return by(value, index, array4);
- }
- });
- }
- if (sortKey !== "$key") {
- if (isObject(value) && "$value" in value)
- value = value.$value;
- }
- return [isObject(value) ? get(value, sortKey) : value];
- };
- const compare = function(a2, b2) {
- if (sortMethod) {
- return sortMethod(a2.value, b2.value);
- }
- for (let i = 0, len = a2.key.length; i < len; i++) {
- if (a2.key[i] < b2.key[i]) {
- return -1;
- }
- if (a2.key[i] > b2.key[i]) {
- return 1;
- }
- }
- return 0;
- };
- return array4.map((value, index) => {
- return {
- value,
- index,
- key: getKey ? getKey(value, index) : null
- };
- }).sort((a2, b2) => {
- let order2 = compare(a2, b2);
- if (!order2) {
- order2 = a2.index - b2.index;
- }
- return order2 * +reverse;
- }).map((item) => item.value);
- };
- const getColumnById = function(table, columnId) {
- let column = null;
- table.columns.forEach((item) => {
- if (item.id === columnId) {
- column = item;
- }
- });
- return column;
- };
- const getColumnByKey = function(table, columnKey) {
- let column = null;
- for (let i = 0; i < table.columns.length; i++) {
- const item = table.columns[i];
- if (item.columnKey === columnKey) {
- column = item;
- break;
- }
- }
- return column;
- };
- const getColumnByCell = function(table, cell, namespace) {
- const matches = (cell.className || "").match(new RegExp(`${namespace}-table_[^\\s]+`, "gm"));
- if (matches) {
- return getColumnById(table, matches[0]);
- }
- return null;
- };
- const getRowIdentity = (row, rowKey) => {
- if (!row)
- throw new Error("Row is required when get row identity");
- if (typeof rowKey === "string") {
- if (!rowKey.includes(".")) {
- return `${row[rowKey]}`;
- }
- const key = rowKey.split(".");
- let current = row;
- for (const element of key) {
- current = current[element];
- }
- return `${current}`;
- } else if (typeof rowKey === "function") {
- return rowKey.call(null, row);
- }
- };
- const getKeysMap = function(array4, rowKey) {
- const arrayMap2 = {};
- (array4 || []).forEach((row, index) => {
- arrayMap2[getRowIdentity(row, rowKey)] = { row, index };
- });
- return arrayMap2;
- };
- function mergeOptions(defaults, config) {
- const options = {};
- let key;
- for (key in defaults) {
- options[key] = defaults[key];
- }
- for (key in config) {
- if (hasOwn(config, key)) {
- const value = config[key];
- if (typeof value !== "undefined") {
- options[key] = value;
- }
- }
- }
- return options;
- }
- function parseWidth(width) {
- if (width === "")
- return width;
- if (width !== void 0) {
- width = Number.parseInt(width, 10);
- if (Number.isNaN(width)) {
- width = "";
- }
- }
- return width;
- }
- function parseMinWidth(minWidth) {
- if (minWidth === "")
- return minWidth;
- if (minWidth !== void 0) {
- minWidth = parseWidth(minWidth);
- if (Number.isNaN(minWidth)) {
- minWidth = 80;
- }
- }
- return minWidth;
- }
- function parseHeight(height) {
- if (typeof height === "number") {
- return height;
- }
- if (typeof height === "string") {
- if (/^\d+(?:px)?$/.test(height)) {
- return Number.parseInt(height, 10);
- } else {
- return height;
- }
- }
- return null;
- }
- function compose(...funcs) {
- if (funcs.length === 0) {
- return (arg) => arg;
- }
- if (funcs.length === 1) {
- return funcs[0];
- }
- return funcs.reduce((a2, b2) => (...args) => a2(b2(...args)));
- }
- function toggleRowStatus(statusArr, row, newVal) {
- let changed = false;
- const index = statusArr.indexOf(row);
- const included = index !== -1;
- const addRow = () => {
- statusArr.push(row);
- changed = true;
- };
- const removeRow = () => {
- statusArr.splice(index, 1);
- changed = true;
- };
- if (typeof newVal === "boolean") {
- if (newVal && !included) {
- addRow();
- } else if (!newVal && included) {
- removeRow();
- }
- } else {
- if (included) {
- removeRow();
- } else {
- addRow();
- }
- }
- return changed;
- }
- function walkTreeNode(root2, cb, childrenKey = "children", lazyKey = "hasChildren") {
- const isNil2 = (array4) => !(Array.isArray(array4) && array4.length);
- function _walker(parent, children, level) {
- cb(parent, children, level);
- children.forEach((item) => {
- if (item[lazyKey]) {
- cb(item, null, level + 1);
- return;
- }
- const children2 = item[childrenKey];
- if (!isNil2(children2)) {
- _walker(item, children2, level + 1);
- }
- });
- }
- root2.forEach((item) => {
- if (item[lazyKey]) {
- cb(item, null, 0);
- return;
- }
- const children = item[childrenKey];
- if (!isNil2(children)) {
- _walker(item, children, 0);
- }
- });
- }
- let removePopper;
- function createTablePopper(trigger, popperContent, popperOptions2, tooltipEffect) {
- const { nextZIndex } = useZIndex();
- function renderContent() {
- const isLight = tooltipEffect === "light";
- const content22 = document.createElement("div");
- content22.className = `el-popper ${isLight ? "is-light" : "is-dark"}`;
- popperContent = escapeHtml_1(popperContent);
- content22.innerHTML = popperContent;
- content22.style.zIndex = String(nextZIndex());
- document.body.appendChild(content22);
- return content22;
- }
- function renderArrow() {
- const arrow22 = document.createElement("div");
- arrow22.className = "el-popper__arrow";
- return arrow22;
- }
- function showPopper() {
- popperInstance && popperInstance.update();
- }
- removePopper = function removePopper2() {
- try {
- popperInstance && popperInstance.destroy();
- content2 && document.body.removeChild(content2);
- off(trigger, "mouseenter", showPopper);
- off(trigger, "mouseleave", removePopper2);
- } catch (e) {
- }
- };
- let popperInstance = null;
- const content2 = renderContent();
- const arrow2 = renderArrow();
- content2.appendChild(arrow2);
- popperInstance = createPopper(trigger, content2, __spreadValues({
- modifiers: [
- {
- name: "offset",
- options: {
- offset: [0, 8]
- }
- },
- {
- name: "arrow",
- options: {
- element: arrow2,
- padding: 10
- }
- }
- ]
- }, popperOptions2));
- on(trigger, "mouseenter", showPopper);
- on(trigger, "mouseleave", removePopper);
- return popperInstance;
- }
- const isFixedColumn = (index, fixed, store, realColumns) => {
- let start2 = 0;
- let after = index;
- if (realColumns) {
- if (realColumns[index].colSpan > 1) {
- return {};
- }
- for (let i = 0; i < index; i++) {
- start2 += realColumns[i].colSpan;
- }
- after = start2 + realColumns[index].colSpan - 1;
- } else {
- start2 = index;
- }
- let fixedLayout;
- const columns = store.states.columns;
- switch (fixed) {
- case "left":
- if (after < store.states.fixedLeafColumnsLength.value) {
- fixedLayout = "left";
- }
- break;
- case "right":
- if (start2 >= columns.value.length - store.states.rightFixedLeafColumnsLength.value) {
- fixedLayout = "right";
- }
- break;
- default:
- if (after < store.states.fixedLeafColumnsLength.value) {
- fixedLayout = "left";
- } else if (start2 >= columns.value.length - store.states.rightFixedLeafColumnsLength.value) {
- fixedLayout = "right";
- }
- }
- return fixedLayout ? {
- direction: fixedLayout,
- start: start2,
- after
- } : {};
- };
- const getFixedColumnsClass = (namespace, index, fixed, store, realColumns) => {
- const classes = [];
- const { direction, start: start2 } = isFixedColumn(index, fixed, store, realColumns);
- if (direction) {
- const isLeft = direction === "left";
- classes.push(`${namespace}-fixed-column--${direction}`);
- if (isLeft && start2 === store.states.fixedLeafColumnsLength.value - 1) {
- classes.push("is-last-column");
- } else if (!isLeft && start2 === store.states.columns.value.length - store.states.rightFixedLeafColumnsLength.value) {
- classes.push("is-first-column");
- }
- }
- return classes;
- };
- function getOffset(offset2, column) {
- return offset2 + (column.realWidth === null || Number.isNaN(column.realWidth) ? Number(column.width) : column.realWidth);
- }
- const getFixedColumnOffset = (index, fixed, store, realColumns) => {
- const { direction, start: start2 = 0 } = isFixedColumn(index, fixed, store, realColumns);
- if (!direction) {
- return;
- }
- const styles = {};
- const isLeft = direction === "left";
- const columns = store.states.columns.value;
- if (isLeft) {
- styles.left = columns.slice(0, index).reduce(getOffset, 0);
- } else {
- styles.right = columns.slice(start2 + 1).reverse().reduce(getOffset, 0);
- }
- return styles;
- };
- const ensurePosition = (style, key) => {
- if (!style)
- return;
- if (!Number.isNaN(style[key])) {
- style[key] = `${style[key]}px`;
- }
- };
- function useExpand(watcherData) {
- const instance = getCurrentInstance();
- const defaultExpandAll = ref(false);
- const expandRows = ref([]);
- const updateExpandRows = () => {
- const data2 = watcherData.data.value || [];
- const rowKey = watcherData.rowKey.value;
- if (defaultExpandAll.value) {
- expandRows.value = data2.slice();
- } else if (rowKey) {
- const expandRowsMap = getKeysMap(expandRows.value, rowKey);
- expandRows.value = data2.reduce((prev, row) => {
- const rowId = getRowIdentity(row, rowKey);
- const rowInfo = expandRowsMap[rowId];
- if (rowInfo) {
- prev.push(row);
- }
- return prev;
- }, []);
- } else {
- expandRows.value = [];
- }
- };
- const toggleRowExpansion = (row, expanded) => {
- const changed = toggleRowStatus(expandRows.value, row, expanded);
- if (changed) {
- instance.emit("expand-change", row, expandRows.value.slice());
- }
- };
- const setExpandRowKeys = (rowKeys) => {
- instance.store.assertRowKey();
- const data2 = watcherData.data.value || [];
- const rowKey = watcherData.rowKey.value;
- const keysMap = getKeysMap(data2, rowKey);
- expandRows.value = rowKeys.reduce((prev, cur) => {
- const info = keysMap[cur];
- if (info) {
- prev.push(info.row);
- }
- return prev;
- }, []);
- };
- const isRowExpanded = (row) => {
- const rowKey = watcherData.rowKey.value;
- if (rowKey) {
- const expandMap = getKeysMap(expandRows.value, rowKey);
- return !!expandMap[getRowIdentity(row, rowKey)];
- }
- return expandRows.value.includes(row);
- };
- return {
- updateExpandRows,
- toggleRowExpansion,
- setExpandRowKeys,
- isRowExpanded,
- states: {
- expandRows,
- defaultExpandAll
- }
- };
- }
- function useCurrent(watcherData) {
- const instance = getCurrentInstance();
- const _currentRowKey = ref(null);
- const currentRow = ref(null);
- const setCurrentRowKey = (key) => {
- instance.store.assertRowKey();
- _currentRowKey.value = key;
- setCurrentRowByKey(key);
- };
- const restoreCurrentRowKey = () => {
- _currentRowKey.value = null;
- };
- const setCurrentRowByKey = (key) => {
- const { data: data2, rowKey } = watcherData;
- let _currentRow = null;
- if (rowKey.value) {
- _currentRow = (unref(data2) || []).find((item) => getRowIdentity(item, rowKey.value) === key);
- }
- currentRow.value = _currentRow;
- instance.emit("current-change", currentRow.value, null);
- };
- const updateCurrentRow = (_currentRow) => {
- const oldCurrentRow = currentRow.value;
- if (_currentRow && _currentRow !== oldCurrentRow) {
- currentRow.value = _currentRow;
- instance.emit("current-change", currentRow.value, oldCurrentRow);
- return;
- }
- if (!_currentRow && oldCurrentRow) {
- currentRow.value = null;
- instance.emit("current-change", null, oldCurrentRow);
- }
- };
- const updateCurrentRowData = () => {
- const rowKey = watcherData.rowKey.value;
- const data2 = watcherData.data.value || [];
- const oldCurrentRow = currentRow.value;
- if (!data2.includes(oldCurrentRow) && oldCurrentRow) {
- if (rowKey) {
- const currentRowKey = getRowIdentity(oldCurrentRow, rowKey);
- setCurrentRowByKey(currentRowKey);
- } else {
- currentRow.value = null;
- }
- if (currentRow.value === null) {
- instance.emit("current-change", null, oldCurrentRow);
- }
- } else if (_currentRowKey.value) {
- setCurrentRowByKey(_currentRowKey.value);
- restoreCurrentRowKey();
- }
- };
- return {
- setCurrentRowKey,
- restoreCurrentRowKey,
- setCurrentRowByKey,
- updateCurrentRow,
- updateCurrentRowData,
- states: {
- _currentRowKey,
- currentRow
- }
- };
- }
- function useTree(watcherData) {
- const expandRowKeys = ref([]);
- const treeData = ref({});
- const indent = ref(16);
- const lazy = ref(false);
- const lazyTreeNodeMap = ref({});
- const lazyColumnIdentifier = ref("hasChildren");
- const childrenColumnName = ref("children");
- const instance = getCurrentInstance();
- const normalizedData = computed(() => {
- if (!watcherData.rowKey.value)
- return {};
- const data2 = watcherData.data.value || [];
- return normalize(data2);
- });
- const normalizedLazyNode = computed(() => {
- const rowKey = watcherData.rowKey.value;
- const keys2 = Object.keys(lazyTreeNodeMap.value);
- const res = {};
- if (!keys2.length)
- return res;
- keys2.forEach((key) => {
- if (lazyTreeNodeMap.value[key].length) {
- const item = { children: [] };
- lazyTreeNodeMap.value[key].forEach((row) => {
- const currentRowKey = getRowIdentity(row, rowKey);
- item.children.push(currentRowKey);
- if (row[lazyColumnIdentifier.value] && !res[currentRowKey]) {
- res[currentRowKey] = { children: [] };
- }
- });
- res[key] = item;
- }
- });
- return res;
- });
- const normalize = (data2) => {
- const rowKey = watcherData.rowKey.value;
- const res = {};
- walkTreeNode(data2, (parent, children, level) => {
- const parentId = getRowIdentity(parent, rowKey);
- if (Array.isArray(children)) {
- res[parentId] = {
- children: children.map((row) => getRowIdentity(row, rowKey)),
- level
- };
- } else if (lazy.value) {
- res[parentId] = {
- children: [],
- lazy: true,
- level
- };
- }
- }, childrenColumnName.value, lazyColumnIdentifier.value);
- return res;
- };
- const updateTreeData = (ifChangeExpandRowKeys = false, ifExpandAll = ((_a2) => (_a2 = instance.store) == null ? void 0 : _a2.states.defaultExpandAll.value)()) => {
- var _a2;
- const nested = normalizedData.value;
- const normalizedLazyNode_ = normalizedLazyNode.value;
- const keys2 = Object.keys(nested);
- const newTreeData = {};
- if (keys2.length) {
- const oldTreeData = unref(treeData);
- const rootLazyRowKeys = [];
- const getExpanded = (oldValue, key) => {
- if (ifChangeExpandRowKeys) {
- if (expandRowKeys.value) {
- return ifExpandAll || expandRowKeys.value.includes(key);
- } else {
- return !!(ifExpandAll || (oldValue == null ? void 0 : oldValue.expanded));
- }
- } else {
- const included = ifExpandAll || expandRowKeys.value && expandRowKeys.value.includes(key);
- return !!((oldValue == null ? void 0 : oldValue.expanded) || included);
- }
- };
- keys2.forEach((key) => {
- const oldValue = oldTreeData[key];
- const newValue = __spreadValues({}, nested[key]);
- newValue.expanded = getExpanded(oldValue, key);
- if (newValue.lazy) {
- const { loaded = false, loading: loading2 = false } = oldValue || {};
- newValue.loaded = !!loaded;
- newValue.loading = !!loading2;
- rootLazyRowKeys.push(key);
- }
- newTreeData[key] = newValue;
- });
- const lazyKeys = Object.keys(normalizedLazyNode_);
- if (lazy.value && lazyKeys.length && rootLazyRowKeys.length) {
- lazyKeys.forEach((key) => {
- const oldValue = oldTreeData[key];
- const lazyNodeChildren = normalizedLazyNode_[key].children;
- if (rootLazyRowKeys.includes(key)) {
- if (newTreeData[key].children.length !== 0) {
- throw new Error("[ElTable]children must be an empty array.");
- }
- newTreeData[key].children = lazyNodeChildren;
- } else {
- const { loaded = false, loading: loading2 = false } = oldValue || {};
- newTreeData[key] = {
- lazy: true,
- loaded: !!loaded,
- loading: !!loading2,
- expanded: getExpanded(oldValue, key),
- children: lazyNodeChildren,
- level: ""
- };
- }
- });
- }
- }
- treeData.value = newTreeData;
- (_a2 = instance.store) == null ? void 0 : _a2.updateTableScrollY();
- };
- watch(() => expandRowKeys.value, () => {
- updateTreeData(true);
- });
- watch(() => normalizedData.value, () => {
- updateTreeData();
- });
- watch(() => normalizedLazyNode.value, () => {
- updateTreeData();
- });
- const updateTreeExpandKeys = (value) => {
- expandRowKeys.value = value;
- updateTreeData();
- };
- const toggleTreeExpansion = (row, expanded) => {
- instance.store.assertRowKey();
- const rowKey = watcherData.rowKey.value;
- const id = getRowIdentity(row, rowKey);
- const data2 = id && treeData.value[id];
- if (id && data2 && "expanded" in data2) {
- const oldExpanded = data2.expanded;
- expanded = typeof expanded === "undefined" ? !data2.expanded : expanded;
- treeData.value[id].expanded = expanded;
- if (oldExpanded !== expanded) {
- instance.emit("expand-change", row, expanded);
- }
- instance.store.updateTableScrollY();
- }
- };
- const loadOrToggle = (row) => {
- instance.store.assertRowKey();
- const rowKey = watcherData.rowKey.value;
- const id = getRowIdentity(row, rowKey);
- const data2 = treeData.value[id];
- if (lazy.value && data2 && "loaded" in data2 && !data2.loaded) {
- loadData(row, id, data2);
- } else {
- toggleTreeExpansion(row, void 0);
- }
- };
- const loadData = (row, key, treeNode) => {
- const { load } = instance.props;
- if (load && !treeData.value[key].loaded) {
- treeData.value[key].loading = true;
- load(row, treeNode, (data2) => {
- if (!Array.isArray(data2)) {
- throw new TypeError("[ElTable] data must be an array");
- }
- treeData.value[key].loading = false;
- treeData.value[key].loaded = true;
- treeData.value[key].expanded = true;
- if (data2.length) {
- lazyTreeNodeMap.value[key] = data2;
- }
- instance.emit("expand-change", row, true);
- });
- }
- };
- return {
- loadData,
- loadOrToggle,
- toggleTreeExpansion,
- updateTreeExpandKeys,
- updateTreeData,
- normalize,
- states: {
- expandRowKeys,
- treeData,
- indent,
- lazy,
- lazyTreeNodeMap,
- lazyColumnIdentifier,
- childrenColumnName
- }
- };
- }
- const sortData = (data2, states) => {
- const sortingColumn = states.sortingColumn;
- if (!sortingColumn || typeof sortingColumn.sortable === "string") {
- return data2;
- }
- return orderBy(data2, states.sortProp, states.sortOrder, sortingColumn.sortMethod, sortingColumn.sortBy);
- };
- const doFlattenColumns = (columns) => {
- const result = [];
- columns.forEach((column) => {
- if (column.children) {
- result.push.apply(result, doFlattenColumns(column.children));
- } else {
- result.push(column);
- }
- });
- return result;
- };
- function useWatcher$1() {
- var _a2;
- const instance = getCurrentInstance();
- const { size: tableSize } = toRefs((_a2 = instance.proxy) == null ? void 0 : _a2.$props);
- const rowKey = ref(null);
- const data2 = ref([]);
- const _data = ref([]);
- const isComplex = ref(false);
- const _columns = ref([]);
- const originColumns = ref([]);
- const columns = ref([]);
- const fixedColumns = ref([]);
- const rightFixedColumns = ref([]);
- const leafColumns = ref([]);
- const fixedLeafColumns = ref([]);
- const rightFixedLeafColumns = ref([]);
- const leafColumnsLength = ref(0);
- const fixedLeafColumnsLength = ref(0);
- const rightFixedLeafColumnsLength = ref(0);
- const isAllSelected = ref(false);
- const selection = ref([]);
- const reserveSelection = ref(false);
- const selectOnIndeterminate = ref(false);
- const selectable = ref(null);
- const filters = ref({});
- const filteredData = ref(null);
- const sortingColumn = ref(null);
- const sortProp = ref(null);
- const sortOrder = ref(null);
- const hoverRow = ref(null);
- watch(data2, () => instance.state && scheduleLayout(false), {
- deep: true
- });
- const assertRowKey = () => {
- if (!rowKey.value)
- throw new Error("[ElTable] prop row-key is required");
- };
- const updateColumns = () => {
- fixedColumns.value = _columns.value.filter((column) => column.fixed === true || column.fixed === "left");
- rightFixedColumns.value = _columns.value.filter((column) => column.fixed === "right");
- if (fixedColumns.value.length > 0 && _columns.value[0] && _columns.value[0].type === "selection" && !_columns.value[0].fixed) {
- _columns.value[0].fixed = true;
- fixedColumns.value.unshift(_columns.value[0]);
- }
- const notFixedColumns = _columns.value.filter((column) => !column.fixed);
- originColumns.value = [].concat(fixedColumns.value).concat(notFixedColumns).concat(rightFixedColumns.value);
- const leafColumns2 = doFlattenColumns(notFixedColumns);
- const fixedLeafColumns2 = doFlattenColumns(fixedColumns.value);
- const rightFixedLeafColumns2 = doFlattenColumns(rightFixedColumns.value);
- leafColumnsLength.value = leafColumns2.length;
- fixedLeafColumnsLength.value = fixedLeafColumns2.length;
- rightFixedLeafColumnsLength.value = rightFixedLeafColumns2.length;
- columns.value = [].concat(fixedLeafColumns2).concat(leafColumns2).concat(rightFixedLeafColumns2);
- isComplex.value = fixedColumns.value.length > 0 || rightFixedColumns.value.length > 0;
- };
- const scheduleLayout = (needUpdateColumns, immediate = false) => {
- if (needUpdateColumns) {
- updateColumns();
- }
- if (immediate) {
- instance.state.doLayout();
- } else {
- instance.state.debouncedUpdateLayout();
- }
- };
- const isSelected = (row) => {
- return selection.value.includes(row);
- };
- const clearSelection = () => {
- isAllSelected.value = false;
- const oldSelection = selection.value;
- if (oldSelection.length) {
- selection.value = [];
- instance.emit("selection-change", []);
- }
- };
- const cleanSelection = () => {
- let deleted;
- if (rowKey.value) {
- deleted = [];
- const selectedMap = getKeysMap(selection.value, rowKey.value);
- const dataMap = getKeysMap(data2.value, rowKey.value);
- for (const key in selectedMap) {
- if (hasOwn(selectedMap, key) && !dataMap[key]) {
- deleted.push(selectedMap[key].row);
- }
- }
- } else {
- deleted = selection.value.filter((item) => !data2.value.includes(item));
- }
- if (deleted.length) {
- const newSelection = selection.value.filter((item) => !deleted.includes(item));
- selection.value = newSelection;
- instance.emit("selection-change", newSelection.slice());
- }
- };
- const getSelectionRows = () => {
- return (selection.value || []).slice();
- };
- const toggleRowSelection = (row, selected = void 0, emitChange = true) => {
- const changed = toggleRowStatus(selection.value, row, selected);
- if (changed) {
- const newSelection = (selection.value || []).slice();
- if (emitChange) {
- instance.emit("select", newSelection, row);
- }
- instance.emit("selection-change", newSelection);
- }
- };
- const _toggleAllSelection = () => {
- var _a22, _b2;
- const value = selectOnIndeterminate.value ? !isAllSelected.value : !(isAllSelected.value || selection.value.length);
- isAllSelected.value = value;
- let selectionChanged = false;
- let childrenCount = 0;
- const rowKey2 = (_b2 = (_a22 = instance == null ? void 0 : instance.store) == null ? void 0 : _a22.states) == null ? void 0 : _b2.rowKey.value;
- data2.value.forEach((row, index) => {
- const rowIndex = index + childrenCount;
- if (selectable.value) {
- if (selectable.value.call(null, row, rowIndex) && toggleRowStatus(selection.value, row, value)) {
- selectionChanged = true;
- }
- } else {
- if (toggleRowStatus(selection.value, row, value)) {
- selectionChanged = true;
- }
- }
- childrenCount += getChildrenCount(getRowIdentity(row, rowKey2));
- });
- if (selectionChanged) {
- instance.emit("selection-change", selection.value ? selection.value.slice() : []);
- }
- instance.emit("select-all", selection.value);
- };
- const updateSelectionByRowKey = () => {
- const selectedMap = getKeysMap(selection.value, rowKey.value);
- data2.value.forEach((row) => {
- const rowId = getRowIdentity(row, rowKey.value);
- const rowInfo = selectedMap[rowId];
- if (rowInfo) {
- selection.value[rowInfo.index] = row;
- }
- });
- };
- const updateAllSelected = () => {
- var _a22, _b2, _c;
- if (((_a22 = data2.value) == null ? void 0 : _a22.length) === 0) {
- isAllSelected.value = false;
- return;
- }
- let selectedMap;
- if (rowKey.value) {
- selectedMap = getKeysMap(selection.value, rowKey.value);
- }
- const isSelected2 = function(row) {
- if (selectedMap) {
- return !!selectedMap[getRowIdentity(row, rowKey.value)];
- } else {
- return selection.value.includes(row);
- }
- };
- let isAllSelected_ = true;
- let selectedCount = 0;
- let childrenCount = 0;
- for (let i = 0, j = (data2.value || []).length; i < j; i++) {
- const keyProp = (_c = (_b2 = instance == null ? void 0 : instance.store) == null ? void 0 : _b2.states) == null ? void 0 : _c.rowKey.value;
- const rowIndex = i + childrenCount;
- const item = data2.value[i];
- const isRowSelectable = selectable.value && selectable.value.call(null, item, rowIndex);
- if (!isSelected2(item)) {
- if (!selectable.value || isRowSelectable) {
- isAllSelected_ = false;
- break;
- }
- } else {
- selectedCount++;
- }
- childrenCount += getChildrenCount(getRowIdentity(item, keyProp));
- }
- if (selectedCount === 0)
- isAllSelected_ = false;
- isAllSelected.value = isAllSelected_;
- };
- const getChildrenCount = (rowKey2) => {
- var _a22;
- if (!instance || !instance.store)
- return 0;
- const { treeData } = instance.store.states;
- let count = 0;
- const children = (_a22 = treeData.value[rowKey2]) == null ? void 0 : _a22.children;
- if (children) {
- count += children.length;
- children.forEach((childKey) => {
- count += getChildrenCount(childKey);
- });
- }
- return count;
- };
- const updateFilters = (columns2, values) => {
- if (!Array.isArray(columns2)) {
- columns2 = [columns2];
- }
- const filters_ = {};
- columns2.forEach((col) => {
- filters.value[col.id] = values;
- filters_[col.columnKey || col.id] = values;
- });
- return filters_;
- };
- const updateSort = (column, prop, order2) => {
- if (sortingColumn.value && sortingColumn.value !== column) {
- sortingColumn.value.order = null;
- }
- sortingColumn.value = column;
- sortProp.value = prop;
- sortOrder.value = order2;
- };
- const execFilter = () => {
- let sourceData = unref(_data);
- Object.keys(filters.value).forEach((columnId) => {
- const values = filters.value[columnId];
- if (!values || values.length === 0)
- return;
- const column = getColumnById({
- columns: columns.value
- }, columnId);
- if (column && column.filterMethod) {
- sourceData = sourceData.filter((row) => {
- return values.some((value) => column.filterMethod.call(null, value, row, column));
- });
- }
- });
- filteredData.value = sourceData;
- };
- const execSort = () => {
- data2.value = sortData(filteredData.value, {
- sortingColumn: sortingColumn.value,
- sortProp: sortProp.value,
- sortOrder: sortOrder.value
- });
- };
- const execQuery = (ignore = void 0) => {
- if (!(ignore && ignore.filter)) {
- execFilter();
- }
- execSort();
- };
- const clearFilter = (columnKeys) => {
- const { tableHeaderRef } = instance.refs;
- if (!tableHeaderRef)
- return;
- const panels = Object.assign({}, tableHeaderRef.filterPanels);
- const keys2 = Object.keys(panels);
- if (!keys2.length)
- return;
- if (typeof columnKeys === "string") {
- columnKeys = [columnKeys];
- }
- if (Array.isArray(columnKeys)) {
- const columns_ = columnKeys.map((key) => getColumnByKey({
- columns: columns.value
- }, key));
- keys2.forEach((key) => {
- const column = columns_.find((col) => col.id === key);
- if (column) {
- column.filteredValue = [];
- }
- });
- instance.store.commit("filterChange", {
- column: columns_,
- values: [],
- silent: true,
- multi: true
- });
- } else {
- keys2.forEach((key) => {
- const column = columns.value.find((col) => col.id === key);
- if (column) {
- column.filteredValue = [];
- }
- });
- filters.value = {};
- instance.store.commit("filterChange", {
- column: {},
- values: [],
- silent: true
- });
- }
- };
- const clearSort = () => {
- if (!sortingColumn.value)
- return;
- updateSort(null, null, null);
- instance.store.commit("changeSortCondition", {
- silent: true
- });
- };
- const {
- setExpandRowKeys,
- toggleRowExpansion,
- updateExpandRows,
- states: expandStates,
- isRowExpanded
- } = useExpand({
- data: data2,
- rowKey
- });
- const {
- updateTreeExpandKeys,
- toggleTreeExpansion,
- updateTreeData,
- loadOrToggle,
- states: treeStates
- } = useTree({
- data: data2,
- rowKey
- });
- const {
- updateCurrentRowData,
- updateCurrentRow,
- setCurrentRowKey,
- states: currentData
- } = useCurrent({
- data: data2,
- rowKey
- });
- const setExpandRowKeysAdapter = (val) => {
- setExpandRowKeys(val);
- updateTreeExpandKeys(val);
- };
- const toggleRowExpansionAdapter = (row, expanded) => {
- const hasExpandColumn = columns.value.some(({ type: type4 }) => type4 === "expand");
- if (hasExpandColumn) {
- toggleRowExpansion(row, expanded);
- } else {
- toggleTreeExpansion(row, expanded);
- }
- };
- return {
- assertRowKey,
- updateColumns,
- scheduleLayout,
- isSelected,
- clearSelection,
- cleanSelection,
- getSelectionRows,
- toggleRowSelection,
- _toggleAllSelection,
- toggleAllSelection: null,
- updateSelectionByRowKey,
- updateAllSelected,
- updateFilters,
- updateCurrentRow,
- updateSort,
- execFilter,
- execSort,
- execQuery,
- clearFilter,
- clearSort,
- toggleRowExpansion,
- setExpandRowKeysAdapter,
- setCurrentRowKey,
- toggleRowExpansionAdapter,
- isRowExpanded,
- updateExpandRows,
- updateCurrentRowData,
- loadOrToggle,
- updateTreeData,
- states: __spreadValues(__spreadValues(__spreadValues({
- tableSize,
- rowKey,
- data: data2,
- _data,
- isComplex,
- _columns,
- originColumns,
- columns,
- fixedColumns,
- rightFixedColumns,
- leafColumns,
- fixedLeafColumns,
- rightFixedLeafColumns,
- leafColumnsLength,
- fixedLeafColumnsLength,
- rightFixedLeafColumnsLength,
- isAllSelected,
- selection,
- reserveSelection,
- selectOnIndeterminate,
- selectable,
- filters,
- filteredData,
- sortingColumn,
- sortProp,
- sortOrder,
- hoverRow
- }, expandStates), treeStates), currentData)
- };
- }
- function replaceColumn(array4, column) {
- return array4.map((item) => {
- var _a2;
- if (item.id === column.id) {
- return column;
- } else if ((_a2 = item.children) == null ? void 0 : _a2.length) {
- item.children = replaceColumn(item.children, column);
- }
- return item;
- });
- }
- function sortColumn(array4) {
- array4.forEach((item) => {
- var _a2, _b2;
- item.no = (_a2 = item.getColumnIndex) == null ? void 0 : _a2.call(item);
- if ((_b2 = item.children) == null ? void 0 : _b2.length) {
- sortColumn(item.children);
- }
- });
- array4.sort((cur, pre) => cur.no - pre.no);
- }
- function useStore() {
- const instance = getCurrentInstance();
- const watcher = useWatcher$1();
- const ns = useNamespace("table");
- const mutations = {
- setData(states, data2) {
- const dataInstanceChanged = unref(states._data) !== data2;
- states.data.value = data2;
- states._data.value = data2;
- instance.store.execQuery();
- instance.store.updateCurrentRowData();
- instance.store.updateExpandRows();
- instance.store.updateTreeData(instance.store.states.defaultExpandAll.value);
- if (unref(states.reserveSelection)) {
- instance.store.assertRowKey();
- instance.store.updateSelectionByRowKey();
- } else {
- if (dataInstanceChanged) {
- instance.store.clearSelection();
- } else {
- instance.store.cleanSelection();
- }
- }
- instance.store.updateAllSelected();
- if (instance.$ready) {
- instance.store.scheduleLayout();
- }
- },
- insertColumn(states, column, parent) {
- const array4 = unref(states._columns);
- let newColumns = [];
- if (!parent) {
- array4.push(column);
- newColumns = array4;
- } else {
- if (parent && !parent.children) {
- parent.children = [];
- }
- parent.children.push(column);
- newColumns = replaceColumn(array4, parent);
- }
- sortColumn(newColumns);
- states._columns.value = newColumns;
- if (column.type === "selection") {
- states.selectable.value = column.selectable;
- states.reserveSelection.value = column.reserveSelection;
- }
- if (instance.$ready) {
- instance.store.updateColumns();
- instance.store.scheduleLayout();
- }
- },
- removeColumn(states, column, parent) {
- const array4 = unref(states._columns) || [];
- if (parent) {
- parent.children.splice(parent.children.findIndex((item) => item.id === column.id), 1);
- if (parent.children.length === 0) {
- delete parent.children;
- }
- states._columns.value = replaceColumn(array4, parent);
- } else {
- const index = array4.indexOf(column);
- if (index > -1) {
- array4.splice(index, 1);
- states._columns.value = array4;
- }
- }
- if (instance.$ready) {
- instance.store.updateColumns();
- instance.store.scheduleLayout();
- }
- },
- sort(states, options) {
- const { prop, order: order2, init } = options;
- if (prop) {
- const column = unref(states.columns).find((column2) => column2.property === prop);
- if (column) {
- column.order = order2;
- instance.store.updateSort(column, prop, order2);
- instance.store.commit("changeSortCondition", { init });
- }
- }
- },
- changeSortCondition(states, options) {
- const { sortingColumn: column, sortProp: prop, sortOrder: order2 } = states;
- if (unref(order2) === null) {
- states.sortingColumn.value = null;
- states.sortProp.value = null;
- }
- const ingore = { filter: true };
- instance.store.execQuery(ingore);
- if (!options || !(options.silent || options.init)) {
- instance.emit("sort-change", {
- column: unref(column),
- prop: unref(prop),
- order: unref(order2)
- });
- }
- instance.store.updateTableScrollY();
- },
- filterChange(_states, options) {
- const { column, values, silent } = options;
- const newFilters = instance.store.updateFilters(column, values);
- instance.store.execQuery();
- if (!silent) {
- instance.emit("filter-change", newFilters);
- }
- instance.store.updateTableScrollY();
- },
- toggleAllSelection() {
- instance.store.toggleAllSelection();
- },
- rowSelectedChanged(_states, row) {
- instance.store.toggleRowSelection(row);
- instance.store.updateAllSelected();
- },
- setHoverRow(states, row) {
- states.hoverRow.value = row;
- },
- setCurrentRow(_states, row) {
- instance.store.updateCurrentRow(row);
- }
- };
- const commit = function(name, ...args) {
- const mutations2 = instance.store.mutations;
- if (mutations2[name]) {
- mutations2[name].apply(instance, [instance.store.states].concat(args));
- } else {
- throw new Error(`Action not found: ${name}`);
- }
- };
- const updateTableScrollY = function() {
- nextTick(() => instance.layout.updateScrollY.apply(instance.layout));
- };
- return __spreadProps(__spreadValues({
- ns
- }, watcher), {
- mutations,
- commit,
- updateTableScrollY
- });
- }
- const InitialStateMap = {
- rowKey: "rowKey",
- defaultExpandAll: "defaultExpandAll",
- selectOnIndeterminate: "selectOnIndeterminate",
- indent: "indent",
- lazy: "lazy",
- data: "data",
- ["treeProps.hasChildren"]: {
- key: "lazyColumnIdentifier",
- default: "hasChildren"
- },
- ["treeProps.children"]: {
- key: "childrenColumnName",
- default: "children"
- }
- };
- function createStore(table, props) {
- if (!table) {
- throw new Error("Table is required.");
- }
- const store = useStore();
- store.toggleAllSelection = debounce$1(store._toggleAllSelection, 10);
- Object.keys(InitialStateMap).forEach((key) => {
- handleValue(getArrKeysValue(props, key), key, store);
- });
- proxyTableProps(store, props);
- return store;
- }
- function proxyTableProps(store, props) {
- Object.keys(InitialStateMap).forEach((key) => {
- watch(() => getArrKeysValue(props, key), (value) => {
- handleValue(value, key, store);
- });
- });
- }
- function handleValue(value, propsKey, store) {
- let newVal = value;
- let storeKey = InitialStateMap[propsKey];
- if (typeof InitialStateMap[propsKey] === "object") {
- storeKey = storeKey.key;
- newVal = newVal || InitialStateMap[propsKey].default;
- }
- store.states[storeKey].value = newVal;
- }
- function getArrKeysValue(props, keys2) {
- if (keys2.includes(".")) {
- const keyList = keys2.split(".");
- let value = props;
- keyList.forEach((key) => {
- value = value[key];
- });
- return value;
- } else {
- return props[keys2];
- }
- }
- class TableLayout {
- constructor(options) {
- this.observers = [];
- this.table = null;
- this.store = null;
- this.columns = [];
- this.fit = true;
- this.showHeader = true;
- this.height = ref(null);
- this.scrollX = ref(false);
- this.scrollY = ref(false);
- this.bodyWidth = ref(null);
- this.fixedWidth = ref(null);
- this.rightFixedWidth = ref(null);
- this.tableHeight = ref(null);
- this.headerHeight = ref(44);
- this.appendHeight = ref(0);
- this.footerHeight = ref(44);
- this.viewportHeight = ref(null);
- this.bodyHeight = ref(null);
- this.bodyScrollHeight = ref(0);
- this.fixedBodyHeight = ref(null);
- this.gutterWidth = 0;
- for (const name in options) {
- if (hasOwn(options, name)) {
- if (isRef(this[name])) {
- this[name].value = options[name];
- } else {
- this[name] = options[name];
- }
- }
- }
- if (!this.table) {
- throw new Error("Table is required for Table Layout");
- }
- if (!this.store) {
- throw new Error("Store is required for Table Layout");
- }
- }
- updateScrollY() {
- const height = this.height.value;
- if (height === null)
- return false;
- const bodyWrapper = this.table.refs.bodyWrapper;
- if (this.table.vnode.el && bodyWrapper) {
- let scrollY = true;
- const prevScrollY = this.scrollY.value;
- if (this.bodyHeight.value === null) {
- scrollY = false;
- } else {
- scrollY = bodyWrapper.scrollHeight > this.bodyHeight.value;
- }
- this.scrollY.value = scrollY;
- return prevScrollY !== scrollY;
- }
- return false;
- }
- setHeight(value, prop = "height") {
- if (!isClient)
- return;
- const el = this.table.vnode.el;
- value = parseHeight(value);
- this.height.value = Number(value);
- if (!el && (value || value === 0))
- return nextTick(() => this.setHeight(value, prop));
- if (typeof value === "number") {
- el.style[prop] = `${value}px`;
- this.updateElsHeight();
- } else if (typeof value === "string") {
- el.style[prop] = value;
- this.updateElsHeight();
- }
- }
- setMaxHeight(value) {
- this.setHeight(value, "max-height");
- }
- getFlattenColumns() {
- const flattenColumns = [];
- const columns = this.table.store.states.columns.value;
- columns.forEach((column) => {
- if (column.isColumnGroup) {
- flattenColumns.push.apply(flattenColumns, column.columns);
- } else {
- flattenColumns.push(column);
- }
- });
- return flattenColumns;
- }
- updateElsHeight() {
- var _a2, _b2;
- if (!this.table.$ready)
- return nextTick(() => this.updateElsHeight());
- const {
- tableWrapper,
- headerWrapper,
- appendWrapper,
- footerWrapper,
- tableHeader,
- tableBody
- } = this.table.refs;
- if (tableWrapper && tableWrapper.style.display === "none") {
- return;
- }
- const { tableLayout } = this.table.props;
- this.appendHeight.value = appendWrapper ? appendWrapper.offsetHeight : 0;
- if (this.showHeader && !headerWrapper && tableLayout === "fixed") {
- return;
- }
- const headerTrElm = tableHeader ? tableHeader : null;
- const noneHeader = this.headerDisplayNone(headerTrElm);
- const headerWrapperOffsetHeight = (headerWrapper == null ? void 0 : headerWrapper.offsetHeight) || 0;
- const headerHeight = this.headerHeight.value = !this.showHeader ? 0 : headerWrapperOffsetHeight;
- if (this.showHeader && !noneHeader && headerWrapperOffsetHeight > 0 && (this.table.store.states.columns.value || []).length > 0 && headerHeight < 2) {
- return nextTick(() => this.updateElsHeight());
- }
- const tableHeight = this.tableHeight.value = (_b2 = (_a2 = this.table) == null ? void 0 : _a2.vnode.el) == null ? void 0 : _b2.clientHeight;
- const footerHeight = this.footerHeight.value = footerWrapper ? footerWrapper.offsetHeight : 0;
- if (this.height.value !== null) {
- if (this.bodyHeight.value === null) {
- requestAnimationFrame(() => this.updateElsHeight());
- }
- this.bodyHeight.value = tableHeight - headerHeight - footerHeight + (footerWrapper ? 1 : 0);
- this.bodyScrollHeight.value = tableBody == null ? void 0 : tableBody.scrollHeight;
- }
- this.fixedBodyHeight.value = this.scrollX.value ? this.bodyHeight.value - this.gutterWidth : this.bodyHeight.value;
- this.viewportHeight.value = this.scrollX.value ? tableHeight - this.gutterWidth : tableHeight;
- this.updateScrollY();
- this.notifyObservers("scrollable");
- }
- headerDisplayNone(elm) {
- if (!elm)
- return true;
- let headerChild = elm;
- while (headerChild.tagName !== "DIV") {
- if (getComputedStyle(headerChild).display === "none") {
- return true;
- }
- headerChild = headerChild.parentElement;
- }
- return false;
- }
- updateColumnsWidth() {
- if (!isClient)
- return;
- const fit = this.fit;
- const bodyWidth = this.table.vnode.el.clientWidth;
- let bodyMinWidth = 0;
- const flattenColumns = this.getFlattenColumns();
- const flexColumns = flattenColumns.filter((column) => typeof column.width !== "number");
- flattenColumns.forEach((column) => {
- if (typeof column.width === "number" && column.realWidth)
- column.realWidth = null;
- });
- if (flexColumns.length > 0 && fit) {
- flattenColumns.forEach((column) => {
- bodyMinWidth += Number(column.width || column.minWidth || 80);
- });
- if (bodyMinWidth <= bodyWidth) {
- this.scrollX.value = false;
- const totalFlexWidth = bodyWidth - bodyMinWidth;
- if (flexColumns.length === 1) {
- flexColumns[0].realWidth = Number(flexColumns[0].minWidth || 80) + totalFlexWidth;
- } else {
- const allColumnsWidth = flexColumns.reduce((prev, column) => prev + Number(column.minWidth || 80), 0);
- const flexWidthPerPixel = totalFlexWidth / allColumnsWidth;
- let noneFirstWidth = 0;
- flexColumns.forEach((column, index) => {
- if (index === 0)
- return;
- const flexWidth = Math.floor(Number(column.minWidth || 80) * flexWidthPerPixel);
- noneFirstWidth += flexWidth;
- column.realWidth = Number(column.minWidth || 80) + flexWidth;
- });
- flexColumns[0].realWidth = Number(flexColumns[0].minWidth || 80) + totalFlexWidth - noneFirstWidth;
- }
- } else {
- this.scrollX.value = true;
- flexColumns.forEach((column) => {
- column.realWidth = Number(column.minWidth);
- });
- }
- this.bodyWidth.value = Math.max(bodyMinWidth, bodyWidth);
- this.table.state.resizeState.value.width = this.bodyWidth.value;
- } else {
- flattenColumns.forEach((column) => {
- if (!column.width && !column.minWidth) {
- column.realWidth = 80;
- } else {
- column.realWidth = Number(column.width || column.minWidth);
- }
- bodyMinWidth += column.realWidth;
- });
- this.scrollX.value = bodyMinWidth > bodyWidth;
- this.bodyWidth.value = bodyMinWidth;
- }
- const fixedColumns = this.store.states.fixedColumns.value;
- if (fixedColumns.length > 0) {
- let fixedWidth = 0;
- fixedColumns.forEach((column) => {
- fixedWidth += Number(column.realWidth || column.width);
- });
- this.fixedWidth.value = fixedWidth;
- }
- const rightFixedColumns = this.store.states.rightFixedColumns.value;
- if (rightFixedColumns.length > 0) {
- let rightFixedWidth = 0;
- rightFixedColumns.forEach((column) => {
- rightFixedWidth += Number(column.realWidth || column.width);
- });
- this.rightFixedWidth.value = rightFixedWidth;
- }
- this.notifyObservers("columns");
- }
- addObserver(observer) {
- this.observers.push(observer);
- }
- removeObserver(observer) {
- const index = this.observers.indexOf(observer);
- if (index !== -1) {
- this.observers.splice(index, 1);
- }
- }
- notifyObservers(event) {
- const observers = this.observers;
- observers.forEach((observer) => {
- var _a2, _b2;
- switch (event) {
- case "columns":
- (_a2 = observer.state) == null ? void 0 : _a2.onColumnsChange(this);
- break;
- case "scrollable":
- (_b2 = observer.state) == null ? void 0 : _b2.onScrollableChange(this);
- break;
- default:
- throw new Error(`Table Layout don't have event ${event}.`);
- }
- });
- }
- }
- const { CheckboxGroup: ElCheckboxGroup } = ElCheckbox;
- const _sfc_main$f = defineComponent({
- name: "ElTableFilterPanel",
- components: {
- ElCheckbox,
- ElCheckboxGroup,
- ElScrollbar,
- ElTooltip,
- ElIcon,
- ArrowDown: arrowDown,
- ArrowUp: arrowUp
- },
- directives: { ClickOutside },
- props: {
- placement: {
- type: String,
- default: "bottom-start"
- },
- store: {
- type: Object
- },
- column: {
- type: Object
- },
- upDataColumn: {
- type: Function
- }
- },
- setup(props) {
- const instance = getCurrentInstance();
- const { t } = useLocale();
- const ns = useNamespace("table-filter");
- const parent = instance == null ? void 0 : instance.parent;
- if (!parent.filterPanels.value[props.column.id]) {
- parent.filterPanels.value[props.column.id] = instance;
- }
- const tooltipVisible = ref(false);
- const tooltip = ref(null);
- const filters = computed(() => {
- return props.column && props.column.filters;
- });
- const filterValue = computed({
- get: () => {
- var _a2;
- return (((_a2 = props.column) == null ? void 0 : _a2.filteredValue) || [])[0];
- },
- set: (value) => {
- if (filteredValue.value) {
- if (typeof value !== "undefined" && value !== null) {
- filteredValue.value.splice(0, 1, value);
- } else {
- filteredValue.value.splice(0, 1);
- }
- }
- }
- });
- const filteredValue = computed({
- get() {
- if (props.column) {
- return props.column.filteredValue || [];
- }
- return [];
- },
- set(value) {
- if (props.column) {
- props.upDataColumn("filteredValue", value);
- }
- }
- });
- const multiple = computed(() => {
- if (props.column) {
- return props.column.filterMultiple;
- }
- return true;
- });
- const isActive = (filter) => {
- return filter.value === filterValue.value;
- };
- const hidden = () => {
- tooltipVisible.value = false;
- };
- const showFilterPanel = (e) => {
- e.stopPropagation();
- tooltipVisible.value = !tooltipVisible.value;
- };
- const hideFilterPanel = () => {
- tooltipVisible.value = false;
- };
- const handleConfirm = () => {
- confirmFilter(filteredValue.value);
- hidden();
- };
- const handleReset = () => {
- filteredValue.value = [];
- confirmFilter(filteredValue.value);
- hidden();
- };
- const handleSelect = (_filterValue) => {
- filterValue.value = _filterValue;
- if (typeof _filterValue !== "undefined" && _filterValue !== null) {
- confirmFilter(filteredValue.value);
- } else {
- confirmFilter([]);
- }
- hidden();
- };
- const confirmFilter = (filteredValue2) => {
- props.store.commit("filterChange", {
- column: props.column,
- values: filteredValue2
- });
- props.store.updateAllSelected();
- };
- watch(tooltipVisible, (value) => {
- if (props.column) {
- props.upDataColumn("filterOpened", value);
- }
- }, {
- immediate: true
- });
- const popperPaneRef = computed(() => {
- var _a2, _b2;
- return (_b2 = (_a2 = tooltip.value) == null ? void 0 : _a2.popperRef) == null ? void 0 : _b2.contentRef;
- });
- return {
- tooltipVisible,
- multiple,
- filteredValue,
- filterValue,
- filters,
- handleConfirm,
- handleReset,
- handleSelect,
- isActive,
- t,
- ns,
- showFilterPanel,
- hideFilterPanel,
- popperPaneRef,
- tooltip
- };
- }
- });
- const _hoisted_1$c = { key: 0 };
- const _hoisted_2$a = ["disabled"];
- const _hoisted_3$7 = ["label", "onClick"];
- function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
- const _component_el_checkbox = resolveComponent("el-checkbox");
- const _component_el_checkbox_group = resolveComponent("el-checkbox-group");
- const _component_el_scrollbar = resolveComponent("el-scrollbar");
- const _component_arrow_up = resolveComponent("arrow-up");
- const _component_arrow_down = resolveComponent("arrow-down");
- const _component_el_icon = resolveComponent("el-icon");
- const _component_el_tooltip = resolveComponent("el-tooltip");
- const _directive_click_outside = resolveDirective("click-outside");
- return openBlock(), createBlock(_component_el_tooltip, {
- ref: "tooltip",
- visible: _ctx.tooltipVisible,
- "onUpdate:visible": _cache[5] || (_cache[5] = ($event) => _ctx.tooltipVisible = $event),
- offset: 0,
- placement: _ctx.placement,
- "show-arrow": false,
- "stop-popper-mouse-event": false,
- "append-to-body": "",
- effect: "light",
- pure: "",
- "popper-class": _ctx.ns.b(),
- persistent: ""
- }, {
- content: withCtx(() => [
- _ctx.multiple ? (openBlock(), createElementBlock("div", _hoisted_1$c, [
- createElementVNode("div", {
- class: normalizeClass(_ctx.ns.e("content"))
- }, [
- createVNode(_component_el_scrollbar, {
- "wrap-class": _ctx.ns.e("wrap")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_checkbox_group, {
- modelValue: _ctx.filteredValue,
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.filteredValue = $event),
- class: normalizeClass(_ctx.ns.e("checkbox-group"))
- }, {
- default: withCtx(() => [
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.filters, (filter) => {
- return openBlock(), createBlock(_component_el_checkbox, {
- key: filter.value,
- label: filter.value
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(filter.text), 1)
- ]),
- _: 2
- }, 1032, ["label"]);
- }), 128))
- ]),
- _: 1
- }, 8, ["modelValue", "class"])
- ]),
- _: 1
- }, 8, ["wrap-class"])
- ], 2),
- createElementVNode("div", {
- class: normalizeClass(_ctx.ns.e("bottom"))
- }, [
- createElementVNode("button", {
- class: normalizeClass({ [_ctx.ns.is("disabled")]: _ctx.filteredValue.length === 0 }),
- disabled: _ctx.filteredValue.length === 0,
- type: "button",
- onClick: _cache[1] || (_cache[1] = (...args) => _ctx.handleConfirm && _ctx.handleConfirm(...args))
- }, toDisplayString(_ctx.t("el.table.confirmFilter")), 11, _hoisted_2$a),
- createElementVNode("button", {
- type: "button",
- onClick: _cache[2] || (_cache[2] = (...args) => _ctx.handleReset && _ctx.handleReset(...args))
- }, toDisplayString(_ctx.t("el.table.resetFilter")), 1)
- ], 2)
- ])) : (openBlock(), createElementBlock("ul", {
- key: 1,
- class: normalizeClass(_ctx.ns.e("list"))
- }, [
- createElementVNode("li", {
- class: normalizeClass([
- _ctx.ns.e("list-item"),
- {
- [_ctx.ns.is("active")]: _ctx.filterValue === void 0 || _ctx.filterValue === null
- }
- ]),
- onClick: _cache[3] || (_cache[3] = ($event) => _ctx.handleSelect(null))
- }, toDisplayString(_ctx.t("el.table.clearFilter")), 3),
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.filters, (filter) => {
- return openBlock(), createElementBlock("li", {
- key: filter.value,
- class: normalizeClass([_ctx.ns.e("list-item"), _ctx.ns.is("active", _ctx.isActive(filter))]),
- label: filter.value,
- onClick: ($event) => _ctx.handleSelect(filter.value)
- }, toDisplayString(filter.text), 11, _hoisted_3$7);
- }), 128))
- ], 2))
- ]),
- default: withCtx(() => [
- withDirectives((openBlock(), createElementBlock("span", {
- class: normalizeClass([
- `${_ctx.ns.namespace.value}-table__column-filter-trigger`,
- `${_ctx.ns.namespace.value}-none-outline`
- ]),
- onClick: _cache[4] || (_cache[4] = (...args) => _ctx.showFilterPanel && _ctx.showFilterPanel(...args))
- }, [
- createVNode(_component_el_icon, null, {
- default: withCtx(() => [
- _ctx.column.filterOpened ? (openBlock(), createBlock(_component_arrow_up, { key: 0 })) : (openBlock(), createBlock(_component_arrow_down, { key: 1 }))
- ]),
- _: 1
- })
- ], 2)), [
- [_directive_click_outside, _ctx.hideFilterPanel, _ctx.popperPaneRef]
- ])
- ]),
- _: 1
- }, 8, ["visible", "placement", "popper-class"]);
- }
- 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"]]);
- function useLayoutObserver(root2) {
- const instance = getCurrentInstance();
- onBeforeMount(() => {
- tableLayout.value.addObserver(instance);
- });
- onMounted(() => {
- onColumnsChange(tableLayout.value);
- onScrollableChange(tableLayout.value);
- });
- onUpdated(() => {
- onColumnsChange(tableLayout.value);
- onScrollableChange(tableLayout.value);
- });
- onUnmounted(() => {
- tableLayout.value.removeObserver(instance);
- });
- const tableLayout = computed(() => {
- const layout = root2.layout;
- if (!layout) {
- throw new Error("Can not find table layout.");
- }
- return layout;
- });
- const onColumnsChange = (layout) => {
- var _a2;
- const cols = ((_a2 = root2.vnode.el) == null ? void 0 : _a2.querySelectorAll("colgroup > col")) || [];
- if (!cols.length)
- return;
- const flattenColumns = layout.getFlattenColumns();
- const columnsMap = {};
- flattenColumns.forEach((column) => {
- columnsMap[column.id] = column;
- });
- for (let i = 0, j = cols.length; i < j; i++) {
- const col = cols[i];
- const name = col.getAttribute("name");
- const column = columnsMap[name];
- if (column) {
- col.setAttribute("width", column.realWidth || column.width);
- }
- }
- };
- const onScrollableChange = (layout) => {
- var _a2, _b2;
- const cols = ((_a2 = root2.vnode.el) == null ? void 0 : _a2.querySelectorAll("colgroup > col[name=gutter]")) || [];
- for (let i = 0, j = cols.length; i < j; i++) {
- const col = cols[i];
- col.setAttribute("width", layout.scrollY.value ? layout.gutterWidth : "0");
- }
- const ths = ((_b2 = root2.vnode.el) == null ? void 0 : _b2.querySelectorAll("th.gutter")) || [];
- for (let i = 0, j = ths.length; i < j; i++) {
- const th = ths[i];
- th.style.width = layout.scrollY.value ? `${layout.gutterWidth}px` : "0";
- th.style.display = layout.scrollY.value ? "" : "none";
- }
- };
- return {
- tableLayout: tableLayout.value,
- onColumnsChange,
- onScrollableChange
- };
- }
- const TABLE_INJECTION_KEY = Symbol("ElTable");
- function useEvent(props, emit) {
- const instance = getCurrentInstance();
- const parent = inject(TABLE_INJECTION_KEY);
- const handleFilterClick = (event) => {
- event.stopPropagation();
- return;
- };
- const handleHeaderClick = (event, column) => {
- if (!column.filters && column.sortable) {
- handleSortClick(event, column, false);
- } else if (column.filterable && !column.sortable) {
- handleFilterClick(event);
- }
- parent == null ? void 0 : parent.emit("header-click", column, event);
- };
- const handleHeaderContextMenu = (event, column) => {
- parent == null ? void 0 : parent.emit("header-contextmenu", column, event);
- };
- const draggingColumn = ref(null);
- const dragging = ref(false);
- const dragState = ref({});
- const handleMouseDown = (event, column) => {
- if (!isClient)
- return;
- if (column.children && column.children.length > 0)
- return;
- if (draggingColumn.value && props.border) {
- dragging.value = true;
- const table = parent;
- emit("set-drag-visible", true);
- const tableEl = table == null ? void 0 : table.vnode.el;
- const tableLeft = tableEl.getBoundingClientRect().left;
- const columnEl = instance.vnode.el.querySelector(`th.${column.id}`);
- const columnRect = columnEl.getBoundingClientRect();
- const minLeft = columnRect.left - tableLeft + 30;
- addClass(columnEl, "noclick");
- dragState.value = {
- startMouseLeft: event.clientX,
- startLeft: columnRect.right - tableLeft,
- startColumnLeft: columnRect.left - tableLeft,
- tableLeft
- };
- const resizeProxy = table == null ? void 0 : table.refs.resizeProxy;
- resizeProxy.style.left = `${dragState.value.startLeft}px`;
- document.onselectstart = function() {
- return false;
- };
- document.ondragstart = function() {
- return false;
- };
- const handleMouseMove2 = (event2) => {
- const deltaLeft = event2.clientX - dragState.value.startMouseLeft;
- const proxyLeft = dragState.value.startLeft + deltaLeft;
- resizeProxy.style.left = `${Math.max(minLeft, proxyLeft)}px`;
- };
- const handleMouseUp = () => {
- if (dragging.value) {
- const { startColumnLeft, startLeft } = dragState.value;
- const finalLeft = Number.parseInt(resizeProxy.style.left, 10);
- const columnWidth = finalLeft - startColumnLeft;
- column.width = column.realWidth = columnWidth;
- table == null ? void 0 : table.emit("header-dragend", column.width, startLeft - startColumnLeft, column, event);
- requestAnimationFrame(() => {
- props.store.scheduleLayout(false, true);
- });
- document.body.style.cursor = "";
- dragging.value = false;
- draggingColumn.value = null;
- dragState.value = {};
- emit("set-drag-visible", false);
- }
- document.removeEventListener("mousemove", handleMouseMove2);
- document.removeEventListener("mouseup", handleMouseUp);
- document.onselectstart = null;
- document.ondragstart = null;
- setTimeout(() => {
- removeClass(columnEl, "noclick");
- }, 0);
- };
- document.addEventListener("mousemove", handleMouseMove2);
- document.addEventListener("mouseup", handleMouseUp);
- }
- };
- const handleMouseMove = (event, column) => {
- if (column.children && column.children.length > 0)
- return;
- let target = event.target;
- while (target && target.tagName !== "TH") {
- target = target.parentNode;
- }
- if (!column || !column.resizable)
- return;
- if (!dragging.value && props.border) {
- const rect = target.getBoundingClientRect();
- const bodyStyle = document.body.style;
- if (rect.width > 12 && rect.right - event.pageX < 8) {
- bodyStyle.cursor = "col-resize";
- if (hasClass(target, "is-sortable")) {
- target.style.cursor = "col-resize";
- }
- draggingColumn.value = column;
- } else if (!dragging.value) {
- bodyStyle.cursor = "";
- if (hasClass(target, "is-sortable")) {
- target.style.cursor = "pointer";
- }
- draggingColumn.value = null;
- }
- }
- };
- const handleMouseOut = () => {
- if (!isClient)
- return;
- document.body.style.cursor = "";
- };
- const toggleOrder = ({ order: order2, sortOrders }) => {
- if (order2 === "")
- return sortOrders[0];
- const index = sortOrders.indexOf(order2 || null);
- return sortOrders[index > sortOrders.length - 2 ? 0 : index + 1];
- };
- const handleSortClick = (event, column, givenOrder) => {
- event.stopPropagation();
- const order2 = column.order === givenOrder ? null : givenOrder || toggleOrder(column);
- let target = event.target;
- while (target && target.tagName !== "TH") {
- target = target.parentNode;
- }
- if (target && target.tagName === "TH") {
- if (hasClass(target, "noclick")) {
- removeClass(target, "noclick");
- return;
- }
- }
- if (!column.sortable)
- return;
- const states = props.store.states;
- let sortProp = states.sortProp.value;
- let sortOrder;
- const sortingColumn = states.sortingColumn.value;
- if (sortingColumn !== column || sortingColumn === column && sortingColumn.order === null) {
- if (sortingColumn) {
- sortingColumn.order = null;
- }
- states.sortingColumn.value = column;
- sortProp = column.property;
- }
- if (!order2) {
- sortOrder = column.order = null;
- } else {
- sortOrder = column.order = order2;
- }
- states.sortProp.value = sortProp;
- states.sortOrder.value = sortOrder;
- parent == null ? void 0 : parent.store.commit("changeSortCondition");
- };
- return {
- handleHeaderClick,
- handleHeaderContextMenu,
- handleMouseDown,
- handleMouseMove,
- handleMouseOut,
- handleSortClick,
- handleFilterClick
- };
- }
- function useStyle$2(props) {
- const parent = inject(TABLE_INJECTION_KEY);
- const ns = useNamespace("table");
- const getHeaderRowStyle = (rowIndex) => {
- const headerRowStyle = parent == null ? void 0 : parent.props.headerRowStyle;
- if (typeof headerRowStyle === "function") {
- return headerRowStyle.call(null, { rowIndex });
- }
- return headerRowStyle;
- };
- const getHeaderRowClass = (rowIndex) => {
- const classes = [];
- const headerRowClassName = parent == null ? void 0 : parent.props.headerRowClassName;
- if (typeof headerRowClassName === "string") {
- classes.push(headerRowClassName);
- } else if (typeof headerRowClassName === "function") {
- classes.push(headerRowClassName.call(null, { rowIndex }));
- }
- return classes.join(" ");
- };
- const getHeaderCellStyle = (rowIndex, columnIndex, row, column) => {
- var _a2;
- let headerCellStyles = (_a2 = parent == null ? void 0 : parent.props.headerCellStyle) != null ? _a2 : {};
- if (typeof headerCellStyles === "function") {
- headerCellStyles = headerCellStyles.call(null, {
- rowIndex,
- columnIndex,
- row,
- column
- });
- }
- const fixedStyle = column.isSubColumn ? null : getFixedColumnOffset(columnIndex, column.fixed, props.store, row);
- ensurePosition(fixedStyle, "left");
- ensurePosition(fixedStyle, "right");
- return Object.assign({}, headerCellStyles, fixedStyle);
- };
- const getHeaderCellClass = (rowIndex, columnIndex, row, column) => {
- const fixedClasses = column.isSubColumn ? [] : getFixedColumnsClass(ns.b(), columnIndex, column.fixed, props.store, row);
- const classes = [
- column.id,
- column.order,
- column.headerAlign,
- column.className,
- column.labelClassName,
- ...fixedClasses
- ];
- if (!column.children) {
- classes.push("is-leaf");
- }
- if (column.sortable) {
- classes.push("is-sortable");
- }
- const headerCellClassName = parent == null ? void 0 : parent.props.headerCellClassName;
- if (typeof headerCellClassName === "string") {
- classes.push(headerCellClassName);
- } else if (typeof headerCellClassName === "function") {
- classes.push(headerCellClassName.call(null, {
- rowIndex,
- columnIndex,
- row,
- column
- }));
- }
- classes.push(ns.e("cell"));
- return classes.filter((className) => Boolean(className)).join(" ");
- };
- return {
- getHeaderRowStyle,
- getHeaderRowClass,
- getHeaderCellStyle,
- getHeaderCellClass
- };
- }
- const getAllColumns = (columns) => {
- const result = [];
- columns.forEach((column) => {
- if (column.children) {
- result.push(column);
- result.push.apply(result, getAllColumns(column.children));
- } else {
- result.push(column);
- }
- });
- return result;
- };
- const convertToRows = (originColumns) => {
- let maxLevel = 1;
- const traverse = (column, parent) => {
- if (parent) {
- column.level = parent.level + 1;
- if (maxLevel < column.level) {
- maxLevel = column.level;
- }
- }
- if (column.children) {
- let colSpan = 0;
- column.children.forEach((subColumn) => {
- traverse(subColumn, column);
- colSpan += subColumn.colSpan;
- });
- column.colSpan = colSpan;
- } else {
- column.colSpan = 1;
- }
- };
- originColumns.forEach((column) => {
- column.level = 1;
- traverse(column, void 0);
- });
- const rows = [];
- for (let i = 0; i < maxLevel; i++) {
- rows.push([]);
- }
- const allColumns = getAllColumns(originColumns);
- allColumns.forEach((column) => {
- if (!column.children) {
- column.rowSpan = maxLevel - column.level + 1;
- } else {
- column.rowSpan = 1;
- column.children.forEach((col) => col.isSubColumn = true);
- }
- rows[column.level - 1].push(column);
- });
- return rows;
- };
- function useUtils$1(props) {
- const parent = inject(TABLE_INJECTION_KEY);
- const columnRows = computed(() => {
- return convertToRows(props.store.states.originColumns.value);
- });
- const isGroup = computed(() => {
- const result = columnRows.value.length > 1;
- if (result && parent) {
- parent.state.isGroup.value = true;
- }
- return result;
- });
- const toggleAllSelection = (event) => {
- event.stopPropagation();
- parent == null ? void 0 : parent.store.commit("toggleAllSelection");
- };
- return {
- isGroup,
- toggleAllSelection,
- columnRows
- };
- }
- var TableHeader = defineComponent({
- name: "ElTableHeader",
- components: {
- ElCheckbox
- },
- props: {
- fixed: {
- type: String,
- default: ""
- },
- store: {
- required: true,
- type: Object
- },
- border: Boolean,
- defaultSort: {
- type: Object,
- default: () => {
- return {
- prop: "",
- order: ""
- };
- }
- }
- },
- setup(props, { emit }) {
- const instance = getCurrentInstance();
- const parent = inject(TABLE_INJECTION_KEY);
- const ns = useNamespace("table");
- const filterPanels = ref({});
- const { onColumnsChange, onScrollableChange } = useLayoutObserver(parent);
- onMounted(async () => {
- await nextTick();
- await nextTick();
- const { prop, order: order2 } = props.defaultSort;
- parent == null ? void 0 : parent.store.commit("sort", { prop, order: order2, init: true });
- });
- const {
- handleHeaderClick,
- handleHeaderContextMenu,
- handleMouseDown,
- handleMouseMove,
- handleMouseOut,
- handleSortClick,
- handleFilterClick
- } = useEvent(props, emit);
- const {
- getHeaderRowStyle,
- getHeaderRowClass,
- getHeaderCellStyle,
- getHeaderCellClass
- } = useStyle$2(props);
- const { isGroup, toggleAllSelection, columnRows } = useUtils$1(props);
- instance.state = {
- onColumnsChange,
- onScrollableChange
- };
- instance.filterPanels = filterPanels;
- return {
- ns,
- filterPanels,
- onColumnsChange,
- onScrollableChange,
- columnRows,
- getHeaderRowClass,
- getHeaderRowStyle,
- getHeaderCellClass,
- getHeaderCellStyle,
- handleHeaderClick,
- handleHeaderContextMenu,
- handleMouseDown,
- handleMouseMove,
- handleMouseOut,
- handleSortClick,
- handleFilterClick,
- isGroup,
- toggleAllSelection
- };
- },
- render() {
- const {
- ns,
- isGroup,
- columnRows,
- getHeaderCellStyle,
- getHeaderCellClass,
- getHeaderRowClass,
- getHeaderRowStyle,
- handleHeaderClick,
- handleHeaderContextMenu,
- handleMouseDown,
- handleMouseMove,
- handleSortClick,
- handleMouseOut,
- store,
- $parent
- } = this;
- let rowSpan = 1;
- return h$1("thead", {
- class: { [ns.is("group")]: isGroup }
- }, columnRows.map((subColumns, rowIndex) => h$1("tr", {
- class: getHeaderRowClass(rowIndex),
- key: rowIndex,
- style: getHeaderRowStyle(rowIndex)
- }, subColumns.map((column, cellIndex) => {
- if (column.rowSpan > rowSpan) {
- rowSpan = column.rowSpan;
- }
- return h$1("th", {
- class: getHeaderCellClass(rowIndex, cellIndex, subColumns, column),
- colspan: column.colSpan,
- key: `${column.id}-thead`,
- rowspan: column.rowSpan,
- style: getHeaderCellStyle(rowIndex, cellIndex, subColumns, column),
- onClick: ($event) => handleHeaderClick($event, column),
- onContextmenu: ($event) => handleHeaderContextMenu($event, column),
- onMousedown: ($event) => handleMouseDown($event, column),
- onMousemove: ($event) => handleMouseMove($event, column),
- onMouseout: handleMouseOut
- }, [
- h$1("div", {
- class: [
- "cell",
- column.filteredValue && column.filteredValue.length > 0 ? "highlight" : "",
- column.labelClassName
- ]
- }, [
- column.renderHeader ? column.renderHeader({
- column,
- $index: cellIndex,
- store,
- _self: $parent
- }) : column.label,
- column.sortable && h$1("span", {
- onClick: ($event) => handleSortClick($event, column),
- class: "caret-wrapper"
- }, [
- h$1("i", {
- onClick: ($event) => handleSortClick($event, column, "ascending"),
- class: "sort-caret ascending"
- }),
- h$1("i", {
- onClick: ($event) => handleSortClick($event, column, "descending"),
- class: "sort-caret descending"
- })
- ]),
- column.filterable && h$1(FilterPanel, {
- store,
- placement: column.filterPlacement || "bottom-start",
- column,
- upDataColumn: (key, value) => {
- column[key] = value;
- }
- })
- ])
- ]);
- }))));
- }
- });
- function useEvents(props) {
- const parent = inject(TABLE_INJECTION_KEY);
- const tooltipContent = ref("");
- const tooltipTrigger = ref(h$1("div"));
- const handleEvent = (event, row, name) => {
- var _a2;
- const table = parent;
- const cell = getCell(event);
- let column;
- const namespace = (_a2 = table == null ? void 0 : table.vnode.el) == null ? void 0 : _a2.dataset.prefix;
- if (cell) {
- column = getColumnByCell({
- columns: props.store.states.columns.value
- }, cell, namespace);
- if (column) {
- table == null ? void 0 : table.emit(`cell-${name}`, row, column, cell, event);
- }
- }
- table == null ? void 0 : table.emit(`row-${name}`, row, column, event);
- };
- const handleDoubleClick = (event, row) => {
- handleEvent(event, row, "dblclick");
- };
- const handleClick = (event, row) => {
- props.store.commit("setCurrentRow", row);
- handleEvent(event, row, "click");
- };
- const handleContextMenu = (event, row) => {
- handleEvent(event, row, "contextmenu");
- };
- const handleMouseEnter = debounce$1((index) => {
- props.store.commit("setHoverRow", index);
- }, 30);
- const handleMouseLeave = debounce$1(() => {
- props.store.commit("setHoverRow", null);
- }, 30);
- const handleCellMouseEnter = (event, row) => {
- var _a2;
- const table = parent;
- const cell = getCell(event);
- const namespace = (_a2 = table == null ? void 0 : table.vnode.el) == null ? void 0 : _a2.dataset.prefix;
- if (cell) {
- const column = getColumnByCell({
- columns: props.store.states.columns.value
- }, cell, namespace);
- const hoverState = table.hoverState = { cell, column, row };
- table == null ? void 0 : table.emit("cell-mouse-enter", hoverState.row, hoverState.column, hoverState.cell, event);
- }
- const cellChild = event.target.querySelector(".cell");
- if (!(hasClass(cellChild, `${namespace}-tooltip`) && cellChild.childNodes.length)) {
- return;
- }
- const range3 = document.createRange();
- range3.setStart(cellChild, 0);
- range3.setEnd(cellChild, cellChild.childNodes.length);
- const rangeWidth = range3.getBoundingClientRect().width;
- const padding = (Number.parseInt(getStyle(cellChild, "paddingLeft"), 10) || 0) + (Number.parseInt(getStyle(cellChild, "paddingRight"), 10) || 0);
- if (rangeWidth + padding > cellChild.offsetWidth || cellChild.scrollWidth > cellChild.offsetWidth) {
- createTablePopper(cell, cell.innerText || cell.textContent, {
- placement: "top",
- strategy: "fixed"
- }, row.tooltipEffect);
- }
- };
- const handleCellMouseLeave = (event) => {
- const cell = getCell(event);
- if (!cell)
- return;
- const oldHoverState = parent == null ? void 0 : parent.hoverState;
- 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);
- };
- return {
- handleDoubleClick,
- handleClick,
- handleContextMenu,
- handleMouseEnter,
- handleMouseLeave,
- handleCellMouseEnter,
- handleCellMouseLeave,
- tooltipContent,
- tooltipTrigger
- };
- }
- function useStyles(props) {
- const parent = inject(TABLE_INJECTION_KEY);
- const ns = useNamespace("table");
- const getRowStyle = (row, rowIndex) => {
- const rowStyle = parent == null ? void 0 : parent.props.rowStyle;
- if (typeof rowStyle === "function") {
- return rowStyle.call(null, {
- row,
- rowIndex
- });
- }
- return rowStyle || null;
- };
- const getRowClass = (row, rowIndex) => {
- const classes = [ns.e("row")];
- if ((parent == null ? void 0 : parent.props.highlightCurrentRow) && row === props.store.states.currentRow.value) {
- classes.push("current-row");
- }
- if (props.stripe && rowIndex % 2 === 1) {
- classes.push(ns.em("row", "striped"));
- }
- const rowClassName = parent == null ? void 0 : parent.props.rowClassName;
- if (typeof rowClassName === "string") {
- classes.push(rowClassName);
- } else if (typeof rowClassName === "function") {
- classes.push(rowClassName.call(null, {
- row,
- rowIndex
- }));
- }
- return classes;
- };
- const getCellStyle = (rowIndex, columnIndex, row, column) => {
- const cellStyle = parent == null ? void 0 : parent.props.cellStyle;
- let cellStyles = cellStyle != null ? cellStyle : {};
- if (typeof cellStyle === "function") {
- cellStyles = cellStyle.call(null, {
- rowIndex,
- columnIndex,
- row,
- column
- });
- }
- const fixedStyle = column.isSubColumn ? null : getFixedColumnOffset(columnIndex, props == null ? void 0 : props.fixed, props.store);
- ensurePosition(fixedStyle, "left");
- ensurePosition(fixedStyle, "right");
- return Object.assign({}, cellStyles, fixedStyle);
- };
- const getCellClass = (rowIndex, columnIndex, row, column) => {
- const fixedClasses = column.isSubColumn ? [] : getFixedColumnsClass(ns.b(), columnIndex, props == null ? void 0 : props.fixed, props.store);
- const classes = [column.id, column.align, column.className, ...fixedClasses];
- const cellClassName = parent == null ? void 0 : parent.props.cellClassName;
- if (typeof cellClassName === "string") {
- classes.push(cellClassName);
- } else if (typeof cellClassName === "function") {
- classes.push(cellClassName.call(null, {
- rowIndex,
- columnIndex,
- row,
- column
- }));
- }
- classes.push(ns.e("cell"));
- return classes.filter((className) => Boolean(className)).join(" ");
- };
- const getSpan = (row, column, rowIndex, columnIndex) => {
- let rowspan = 1;
- let colspan = 1;
- const fn2 = parent == null ? void 0 : parent.props.spanMethod;
- if (typeof fn2 === "function") {
- const result = fn2({
- row,
- column,
- rowIndex,
- columnIndex
- });
- if (Array.isArray(result)) {
- rowspan = result[0];
- colspan = result[1];
- } else if (typeof result === "object") {
- rowspan = result.rowspan;
- colspan = result.colspan;
- }
- }
- return { rowspan, colspan };
- };
- const getColspanRealWidth = (columns, colspan, index) => {
- if (colspan < 1) {
- return columns[index].realWidth;
- }
- const widthArr = columns.map(({ realWidth, width }) => realWidth || width).slice(index, index + colspan);
- return Number(widthArr.reduce((acc, width) => Number(acc) + Number(width), -1));
- };
- return {
- getRowStyle,
- getRowClass,
- getCellStyle,
- getCellClass,
- getSpan,
- getColspanRealWidth
- };
- }
- function useRender$1(props) {
- const parent = inject(TABLE_INJECTION_KEY);
- const {
- handleDoubleClick,
- handleClick,
- handleContextMenu,
- handleMouseEnter,
- handleMouseLeave,
- handleCellMouseEnter,
- handleCellMouseLeave,
- tooltipContent,
- tooltipTrigger
- } = useEvents(props);
- const {
- getRowStyle,
- getRowClass,
- getCellStyle,
- getCellClass,
- getSpan,
- getColspanRealWidth
- } = useStyles(props);
- const firstDefaultColumnIndex = computed(() => {
- return props.store.states.columns.value.findIndex(({ type: type4 }) => type4 === "default");
- });
- const getKeyOfRow = (row, index) => {
- const rowKey = parent.props.rowKey;
- if (rowKey) {
- return getRowIdentity(row, rowKey);
- }
- return index;
- };
- const rowRender = (row, $index, treeRowData, expanded = false) => {
- const { tooltipEffect, store } = props;
- const { indent, columns } = store.states;
- const rowClasses = getRowClass(row, $index);
- let display = true;
- if (treeRowData) {
- rowClasses.push(`el-table__row--level-${treeRowData.level}`);
- display = treeRowData.display;
- }
- const displayStyle = display ? null : {
- display: "none"
- };
- return h$1("tr", {
- style: [displayStyle, getRowStyle(row, $index)],
- class: rowClasses,
- key: getKeyOfRow(row, $index),
- onDblclick: ($event) => handleDoubleClick($event, row),
- onClick: ($event) => handleClick($event, row),
- onContextmenu: ($event) => handleContextMenu($event, row),
- onMouseenter: () => handleMouseEnter($index),
- onMouseleave: handleMouseLeave
- }, columns.value.map((column, cellIndex) => {
- const { rowspan, colspan } = getSpan(row, column, $index, cellIndex);
- if (!rowspan || !colspan) {
- return null;
- }
- const columnData = __spreadValues({}, column);
- columnData.realWidth = getColspanRealWidth(columns.value, colspan, cellIndex);
- const data2 = {
- store: props.store,
- _self: props.context || parent,
- column: columnData,
- row,
- $index,
- cellIndex,
- expanded
- };
- if (cellIndex === firstDefaultColumnIndex.value && treeRowData) {
- data2.treeNode = {
- indent: treeRowData.level * indent.value,
- level: treeRowData.level
- };
- if (typeof treeRowData.expanded === "boolean") {
- data2.treeNode.expanded = treeRowData.expanded;
- if ("loading" in treeRowData) {
- data2.treeNode.loading = treeRowData.loading;
- }
- if ("noLazyChildren" in treeRowData) {
- data2.treeNode.noLazyChildren = treeRowData.noLazyChildren;
- }
- }
- }
- const baseKey = `${$index},${cellIndex}`;
- const patchKey = columnData.columnKey || columnData.rawColumnKey || "";
- const tdChildren = cellChildren(cellIndex, column, data2);
- return h$1("td", {
- style: getCellStyle($index, cellIndex, row, column),
- class: getCellClass($index, cellIndex, row, column),
- key: `${patchKey}${baseKey}`,
- rowspan,
- colspan,
- onMouseenter: ($event) => handleCellMouseEnter($event, __spreadProps(__spreadValues({}, row), { tooltipEffect })),
- onMouseleave: handleCellMouseLeave
- }, [tdChildren]);
- }));
- };
- const cellChildren = (cellIndex, column, data2) => {
- return column.renderCell(data2);
- };
- const wrappedRowRender = (row, $index) => {
- const store = props.store;
- const { isRowExpanded, assertRowKey } = store;
- const { treeData, lazyTreeNodeMap, childrenColumnName, rowKey } = store.states;
- const columns = store.states.columns.value;
- const hasExpandColumn = columns.some(({ type: type4 }) => type4 === "expand");
- if (hasExpandColumn) {
- const expanded = isRowExpanded(row);
- const tr = rowRender(row, $index, void 0, expanded);
- const renderExpanded = parent.renderExpanded;
- if (expanded) {
- if (!renderExpanded) {
- console.error("[Element Error]renderExpanded is required.");
- return tr;
- }
- return [
- [
- tr,
- h$1("tr", {
- key: `expanded-row__${tr.key}`
- }, [
- h$1("td", {
- colspan: columns.length,
- class: "el-table__cell el-table__expanded-cell"
- }, [renderExpanded({ row, $index, store, expanded })])
- ])
- ]
- ];
- } else {
- return [[tr]];
- }
- } else if (Object.keys(treeData.value).length) {
- assertRowKey();
- const key = getRowIdentity(row, rowKey.value);
- let cur = treeData.value[key];
- let treeRowData = null;
- if (cur) {
- treeRowData = {
- expanded: cur.expanded,
- level: cur.level,
- display: true
- };
- if (typeof cur.lazy === "boolean") {
- if (typeof cur.loaded === "boolean" && cur.loaded) {
- treeRowData.noLazyChildren = !(cur.children && cur.children.length);
- }
- treeRowData.loading = cur.loading;
- }
- }
- const tmp = [rowRender(row, $index, treeRowData)];
- if (cur) {
- let i = 0;
- const traverse = (children, parent2) => {
- if (!(children && children.length && parent2))
- return;
- children.forEach((node) => {
- const innerTreeRowData = {
- display: parent2.display && parent2.expanded,
- level: parent2.level + 1,
- expanded: false,
- noLazyChildren: false,
- loading: false
- };
- const childKey = getRowIdentity(node, rowKey.value);
- if (childKey === void 0 || childKey === null) {
- throw new Error("For nested data item, row-key is required.");
- }
- cur = __spreadValues({}, treeData.value[childKey]);
- if (cur) {
- innerTreeRowData.expanded = cur.expanded;
- cur.level = cur.level || innerTreeRowData.level;
- cur.display = !!(cur.expanded && innerTreeRowData.display);
- if (typeof cur.lazy === "boolean") {
- if (typeof cur.loaded === "boolean" && cur.loaded) {
- innerTreeRowData.noLazyChildren = !(cur.children && cur.children.length);
- }
- innerTreeRowData.loading = cur.loading;
- }
- }
- i++;
- tmp.push(rowRender(node, $index + i, innerTreeRowData));
- if (cur) {
- const nodes2 = lazyTreeNodeMap.value[childKey] || node[childrenColumnName.value];
- traverse(nodes2, cur);
- }
- });
- };
- cur.display = true;
- const nodes = lazyTreeNodeMap.value[key] || row[childrenColumnName.value];
- traverse(nodes, cur);
- }
- return tmp;
- } else {
- return rowRender(row, $index, void 0);
- }
- };
- return {
- wrappedRowRender,
- tooltipContent,
- tooltipTrigger
- };
- }
- const defaultProps$2 = {
- store: {
- required: true,
- type: Object
- },
- stripe: Boolean,
- tooltipEffect: String,
- context: {
- default: () => ({}),
- type: Object
- },
- rowClassName: [String, Function],
- rowStyle: [Object, Function],
- fixed: {
- type: String,
- default: ""
- },
- highlight: Boolean
- };
- var TableBody = defineComponent({
- name: "ElTableBody",
- props: defaultProps$2,
- setup(props) {
- const instance = getCurrentInstance();
- const parent = inject(TABLE_INJECTION_KEY);
- const ns = useNamespace("table");
- const { wrappedRowRender, tooltipContent, tooltipTrigger } = useRender$1(props);
- const { onColumnsChange, onScrollableChange } = useLayoutObserver(parent);
- watch(props.store.states.hoverRow, (newVal, oldVal) => {
- if (!props.store.states.isComplex.value || !isClient)
- return;
- let raf = window.requestAnimationFrame;
- if (!raf) {
- raf = (fn2) => window.setTimeout(fn2, 16);
- }
- raf(() => {
- var _a2;
- const rows = (_a2 = instance == null ? void 0 : instance.vnode.el) == null ? void 0 : _a2.querySelectorAll(`.${ns.e("row")}`);
- const oldRow = rows[oldVal];
- const newRow = rows[newVal];
- if (oldRow) {
- removeClass(oldRow, "hover-row");
- }
- if (newRow) {
- addClass(newRow, "hover-row");
- }
- });
- });
- onUnmounted(() => {
- var _a2;
- (_a2 = removePopper) == null ? void 0 : _a2();
- });
- onUpdated(() => {
- var _a2;
- (_a2 = removePopper) == null ? void 0 : _a2();
- });
- return {
- ns,
- onColumnsChange,
- onScrollableChange,
- wrappedRowRender,
- tooltipContent,
- tooltipTrigger
- };
- },
- render() {
- const { wrappedRowRender, store } = this;
- const data2 = store.states.data.value || [];
- return h$1("tbody", {}, [
- data2.reduce((acc, row) => {
- return acc.concat(wrappedRowRender(row, acc.length));
- }, [])
- ]);
- }
- });
- function hColgroup(props) {
- const isAuto = props.tableLayout === "auto";
- let columns = props.columns || [];
- if (isAuto) {
- if (columns.every((column) => column.width === void 0)) {
- columns = [];
- }
- }
- const getPropsData = (column) => {
- const propsData = {
- key: `${props.tableLayout}_${column.id}`,
- style: {},
- name: void 0
- };
- if (isAuto) {
- propsData.style = {
- width: `${column.width}px`
- };
- } else {
- propsData.name = column.id;
- }
- return propsData;
- };
- return h$1("colgroup", {}, columns.map((column) => h$1("col", getPropsData(column))));
- }
- hColgroup.props = ["columns", "tableLayout"];
- function useMapState() {
- const table = inject(TABLE_INJECTION_KEY);
- const store = table == null ? void 0 : table.store;
- const leftFixedLeafCount = computed(() => {
- return store.states.fixedLeafColumnsLength.value;
- });
- const rightFixedLeafCount = computed(() => {
- return store.states.rightFixedColumns.value.length;
- });
- const columnsCount = computed(() => {
- return store.states.columns.value.length;
- });
- const leftFixedCount = computed(() => {
- return store.states.fixedColumns.value.length;
- });
- const rightFixedCount = computed(() => {
- return store.states.rightFixedColumns.value.length;
- });
- return {
- leftFixedLeafCount,
- rightFixedLeafCount,
- columnsCount,
- leftFixedCount,
- rightFixedCount,
- columns: store.states.columns
- };
- }
- function useStyle$1(props) {
- const { columns } = useMapState();
- const ns = useNamespace("table");
- const getCellClasses = (columns2, cellIndex) => {
- const column = columns2[cellIndex];
- const classes = [
- ns.e("cell"),
- column.id,
- column.align,
- column.labelClassName,
- ...getFixedColumnsClass(ns.b(), cellIndex, column.fixed, props.store)
- ];
- if (column.className) {
- classes.push(column.className);
- }
- if (!column.children) {
- classes.push(ns.is("leaf"));
- }
- return classes;
- };
- const getCellStyles = (column, cellIndex) => {
- const fixedStyle = getFixedColumnOffset(cellIndex, column.fixed, props.store);
- ensurePosition(fixedStyle, "left");
- ensurePosition(fixedStyle, "right");
- return fixedStyle;
- };
- return {
- getCellClasses,
- getCellStyles,
- columns
- };
- }
- var TableFooter = defineComponent({
- name: "ElTableFooter",
- props: {
- fixed: {
- type: String,
- default: ""
- },
- store: {
- required: true,
- type: Object
- },
- summaryMethod: Function,
- sumText: String,
- border: Boolean,
- defaultSort: {
- type: Object,
- default: () => {
- return {
- prop: "",
- order: ""
- };
- }
- }
- },
- setup(props) {
- const { getCellClasses, getCellStyles, columns } = useStyle$1(props);
- const ns = useNamespace("table");
- return {
- ns,
- getCellClasses,
- getCellStyles,
- columns
- };
- },
- render() {
- const {
- columns,
- getCellStyles,
- getCellClasses,
- summaryMethod,
- sumText,
- ns
- } = this;
- const data2 = this.store.states.data.value;
- let sums = [];
- if (summaryMethod) {
- sums = summaryMethod({
- columns,
- data: data2
- });
- } else {
- columns.forEach((column, index) => {
- if (index === 0) {
- sums[index] = sumText;
- return;
- }
- const values = data2.map((item) => Number(item[column.property]));
- const precisions = [];
- let notNumber = true;
- values.forEach((value) => {
- if (!Number.isNaN(+value)) {
- notNumber = false;
- const decimal = `${value}`.split(".")[1];
- precisions.push(decimal ? decimal.length : 0);
- }
- });
- const precision = Math.max.apply(null, precisions);
- if (!notNumber) {
- sums[index] = values.reduce((prev, curr) => {
- const value = Number(curr);
- if (!Number.isNaN(+value)) {
- return Number.parseFloat((prev + curr).toFixed(Math.min(precision, 20)));
- } else {
- return prev;
- }
- }, 0);
- } else {
- sums[index] = "";
- }
- });
- }
- return h$1("table", {
- class: ns.e("footer"),
- cellspacing: "0",
- cellpadding: "0",
- border: "0"
- }, [
- hColgroup({
- columns
- }),
- h$1("tbody", [
- h$1("tr", {}, [
- ...columns.map((column, cellIndex) => h$1("td", {
- key: cellIndex,
- colspan: column.colSpan,
- rowspan: column.rowSpan,
- class: getCellClasses(columns, cellIndex),
- style: getCellStyles(column, cellIndex)
- }, [
- h$1("div", {
- class: ["cell", column.labelClassName]
- }, [sums[cellIndex]])
- ]))
- ])
- ])
- ]);
- }
- });
- function useUtils(store) {
- const setCurrentRow = (row) => {
- store.commit("setCurrentRow", row);
- };
- const getSelectionRows = () => {
- return store.getSelectionRows();
- };
- const toggleRowSelection = (row, selected) => {
- store.toggleRowSelection(row, selected, false);
- store.updateAllSelected();
- };
- const clearSelection = () => {
- store.clearSelection();
- };
- const clearFilter = (columnKeys) => {
- store.clearFilter(columnKeys);
- };
- const toggleAllSelection = () => {
- store.commit("toggleAllSelection");
- };
- const toggleRowExpansion = (row, expanded) => {
- store.toggleRowExpansionAdapter(row, expanded);
- };
- const clearSort = () => {
- store.clearSort();
- };
- const sort = (prop, order2) => {
- store.commit("sort", { prop, order: order2 });
- };
- return {
- setCurrentRow,
- getSelectionRows,
- toggleRowSelection,
- clearSelection,
- clearFilter,
- toggleAllSelection,
- toggleRowExpansion,
- clearSort,
- sort
- };
- }
- function useStyle(props, layout, store, table) {
- const isHidden = ref(false);
- const renderExpanded = ref(null);
- const resizeProxyVisible = ref(false);
- const setDragVisible = (visible) => {
- resizeProxyVisible.value = visible;
- };
- const resizeState = ref({
- width: null,
- height: null
- });
- const isGroup = ref(false);
- const scrollbarViewStyle = {
- display: "inline-block",
- verticalAlign: "middle"
- };
- const tableWidth = ref();
- watchEffect(() => {
- layout.setHeight(props.height);
- });
- watchEffect(() => {
- layout.setMaxHeight(props.maxHeight);
- });
- watch(() => [props.currentRowKey, store.states.rowKey], ([currentRowKey, rowKey]) => {
- if (!unref(rowKey))
- return;
- store.setCurrentRowKey(`${currentRowKey}`);
- }, {
- immediate: true
- });
- watch(() => props.data, (data2) => {
- table.store.commit("setData", data2);
- }, {
- immediate: true,
- deep: true
- });
- watchEffect(() => {
- if (props.expandRowKeys) {
- store.setExpandRowKeysAdapter(props.expandRowKeys);
- }
- });
- const handleMouseLeave = () => {
- table.store.commit("setHoverRow", null);
- if (table.hoverState)
- table.hoverState = null;
- };
- const handleHeaderFooterMousewheel = (event, data2) => {
- const { pixelX, pixelY } = data2;
- if (Math.abs(pixelX) >= Math.abs(pixelY)) {
- table.refs.bodyWrapper.scrollLeft += data2.pixelX / 5;
- }
- };
- const shouldUpdateHeight = computed(() => {
- return props.height || props.maxHeight || store.states.fixedColumns.value.length > 0 || store.states.rightFixedColumns.value.length > 0;
- });
- const tableBodyStyles = computed(() => {
- return {
- width: layout.bodyWidth.value ? `${layout.bodyWidth.value}px` : ""
- };
- });
- const doLayout = () => {
- if (shouldUpdateHeight.value) {
- layout.updateElsHeight();
- }
- layout.updateColumnsWidth();
- requestAnimationFrame(syncPostion);
- };
- onMounted(async () => {
- await nextTick();
- store.updateColumns();
- bindEvents();
- requestAnimationFrame(doLayout);
- resizeState.value = {
- width: tableWidth.value = table.vnode.el.offsetWidth,
- height: table.vnode.el.offsetHeight
- };
- store.states.columns.value.forEach((column) => {
- if (column.filteredValue && column.filteredValue.length) {
- table.store.commit("filterChange", {
- column,
- values: column.filteredValue,
- silent: true
- });
- }
- });
- table.$ready = true;
- });
- const setScrollClassByEl = (el, className) => {
- if (!el)
- return;
- const classList = Array.from(el.classList).filter((item) => !item.startsWith("is-scrolling-"));
- classList.push(layout.scrollX.value ? className : "is-scrolling-none");
- el.className = classList.join(" ");
- };
- const setScrollClass = (className) => {
- const { tableWrapper } = table.refs;
- setScrollClassByEl(tableWrapper, className);
- };
- const hasScrollClass = (className) => {
- const { tableWrapper } = table.refs;
- if (tableWrapper && tableWrapper.classList.contains(className)) {
- return true;
- }
- return false;
- };
- const syncPostion = function() {
- if (!table.refs.scrollBarRef)
- return;
- if (!layout.scrollX.value) {
- const scrollingNoneClass = "is-scrolling-none";
- if (!hasScrollClass(scrollingNoneClass)) {
- setScrollClass(scrollingNoneClass);
- }
- return;
- }
- const scrollContainer = table.refs.scrollBarRef.wrap$;
- if (!scrollContainer)
- return;
- const { scrollLeft, offsetWidth, scrollWidth } = scrollContainer;
- const { headerWrapper, footerWrapper } = table.refs;
- if (headerWrapper)
- headerWrapper.scrollLeft = scrollLeft;
- if (footerWrapper)
- footerWrapper.scrollLeft = scrollLeft;
- const maxScrollLeftPosition = scrollWidth - offsetWidth - 1;
- if (scrollLeft >= maxScrollLeftPosition) {
- setScrollClass("is-scrolling-right");
- } else if (scrollLeft === 0) {
- setScrollClass("is-scrolling-left");
- } else {
- setScrollClass("is-scrolling-middle");
- }
- };
- const bindEvents = () => {
- var _a2;
- if (!table.refs.scrollBarRef)
- return;
- (_a2 = table.refs.scrollBarRef.wrap$) == null ? void 0 : _a2.addEventListener("scroll", syncPostion, {
- passive: true
- });
- if (props.fit) {
- addResizeListener(table.vnode.el, resizeListener);
- } else {
- on(window, "resize", doLayout);
- }
- };
- onBeforeUnmount(() => {
- unbindEvents();
- });
- const unbindEvents = () => {
- var _a2;
- (_a2 = table.refs.scrollBarRef.wrap$) == null ? void 0 : _a2.removeEventListener("scroll", syncPostion, true);
- if (props.fit) {
- removeResizeListener(table.vnode.el, resizeListener);
- } else {
- off(window, "resize", doLayout);
- }
- };
- const resizeListener = () => {
- if (!table.$ready)
- return;
- let shouldUpdateLayout = false;
- const el = table.vnode.el;
- const { width: oldWidth, height: oldHeight } = resizeState.value;
- const width = tableWidth.value = el.offsetWidth;
- if (oldWidth !== width) {
- shouldUpdateLayout = true;
- }
- const height2 = el.offsetHeight;
- if ((props.height || shouldUpdateHeight.value) && oldHeight !== height2) {
- shouldUpdateLayout = true;
- }
- if (shouldUpdateLayout) {
- resizeState.value = {
- width,
- height: height2
- };
- doLayout();
- }
- };
- const tableSize = useSize();
- const bodyWidth = computed(() => {
- const { bodyWidth: bodyWidth_, scrollY, gutterWidth } = layout;
- return bodyWidth_.value ? `${bodyWidth_.value - (scrollY.value ? gutterWidth : 0)}px` : "";
- });
- const tableLayout = computed(() => {
- if (props.maxHeight)
- return "fixed";
- return props.tableLayout;
- });
- function calcMaxHeight(maxHeight, footerHeight, headerHeight) {
- const parsedMaxHeight = parseHeight(maxHeight);
- const tableHeaderHeight = props.showHeader ? headerHeight : 0;
- if (parsedMaxHeight === null)
- return;
- if (isString(parsedMaxHeight)) {
- return `calc(${parsedMaxHeight} - ${footerHeight}px - ${tableHeaderHeight}px)`;
- }
- return parsedMaxHeight - footerHeight - tableHeaderHeight;
- }
- const height = computed(() => {
- const headerHeight = layout.headerHeight.value || 0;
- const bodyHeight2 = layout.bodyHeight.value;
- const footerHeight = layout.footerHeight.value || 0;
- if (props.height) {
- return bodyHeight2 ? bodyHeight2 : void 0;
- } else if (props.maxHeight) {
- return calcMaxHeight(props.maxHeight, footerHeight, headerHeight);
- }
- return void 0;
- });
- const bodyHeight = computed(() => {
- const headerHeight = layout.headerHeight.value || 0;
- const bodyHeight2 = layout.bodyHeight.value;
- const footerHeight = layout.footerHeight.value || 0;
- if (props.height) {
- return {
- height: bodyHeight2 ? `${bodyHeight2}px` : ""
- };
- } else if (props.maxHeight) {
- const maxHeight = calcMaxHeight(props.maxHeight, footerHeight, headerHeight);
- if (maxHeight !== null) {
- return {
- "max-height": `${maxHeight}${isNumber(maxHeight) ? "px" : ""}`
- };
- }
- }
- return {};
- });
- const emptyBlockStyle = computed(() => {
- if (props.data && props.data.length)
- return null;
- let height2 = "100%";
- if (layout.appendHeight.value) {
- height2 = `calc(100% - ${layout.appendHeight.value}px)`;
- }
- return {
- width: tableWidth.value ? `${tableWidth.value}px` : "",
- height: height2
- };
- });
- const handleFixedMousewheel = (event, data2) => {
- const bodyWrapper = table.refs.bodyWrapper;
- if (Math.abs(data2.spinY) > 0) {
- const currentScrollTop = bodyWrapper.scrollTop;
- if (data2.pixelY < 0 && currentScrollTop !== 0) {
- event.preventDefault();
- }
- if (data2.pixelY > 0 && bodyWrapper.scrollHeight - bodyWrapper.clientHeight > currentScrollTop) {
- event.preventDefault();
- }
- bodyWrapper.scrollTop += Math.ceil(data2.pixelY / 5);
- } else {
- bodyWrapper.scrollLeft += Math.ceil(data2.pixelX / 5);
- }
- };
- const fixedHeight = computed(() => {
- if (props.maxHeight) {
- if (props.showSummary) {
- return {
- bottom: 0
- };
- }
- return {
- bottom: layout.scrollX.value && props.data.length ? `${layout.gutterWidth}px` : ""
- };
- } else {
- if (props.showSummary) {
- return {
- height: layout.tableHeight.value ? `${layout.tableHeight.value}px` : ""
- };
- }
- return {
- height: layout.viewportHeight.value ? `${layout.viewportHeight.value}px` : ""
- };
- }
- });
- const fixedBodyHeight = computed(() => {
- if (props.height) {
- return {
- height: layout.fixedBodyHeight.value ? `${layout.fixedBodyHeight.value}px` : ""
- };
- } else if (props.maxHeight) {
- let maxHeight = parseHeight(props.maxHeight);
- if (typeof maxHeight === "number") {
- maxHeight = layout.scrollX.value ? maxHeight - layout.gutterWidth : maxHeight;
- if (props.showHeader) {
- maxHeight -= layout.headerHeight.value;
- }
- maxHeight -= layout.footerHeight.value;
- return {
- "max-height": `${maxHeight}px`
- };
- }
- }
- return {};
- });
- return {
- isHidden,
- renderExpanded,
- setDragVisible,
- isGroup,
- handleMouseLeave,
- handleHeaderFooterMousewheel,
- tableSize,
- bodyHeight,
- height,
- emptyBlockStyle,
- handleFixedMousewheel,
- fixedHeight,
- fixedBodyHeight,
- resizeProxyVisible,
- bodyWidth,
- resizeState,
- doLayout,
- tableBodyStyles,
- tableLayout,
- scrollbarViewStyle
- };
- }
- var defaultProps$1 = {
- data: {
- type: Array,
- default: () => {
- return [];
- }
- },
- size: String,
- width: [String, Number],
- height: [String, Number],
- maxHeight: [String, Number],
- fit: {
- type: Boolean,
- default: true
- },
- stripe: Boolean,
- border: Boolean,
- rowKey: [String, Function],
- showHeader: {
- type: Boolean,
- default: true
- },
- showSummary: Boolean,
- sumText: String,
- summaryMethod: Function,
- rowClassName: [String, Function],
- rowStyle: [Object, Function],
- cellClassName: [String, Function],
- cellStyle: [Object, Function],
- headerRowClassName: [String, Function],
- headerRowStyle: [Object, Function],
- headerCellClassName: [String, Function],
- headerCellStyle: [Object, Function],
- highlightCurrentRow: Boolean,
- currentRowKey: [String, Number],
- emptyText: String,
- expandRowKeys: Array,
- defaultExpandAll: Boolean,
- defaultSort: Object,
- tooltipEffect: String,
- spanMethod: Function,
- selectOnIndeterminate: {
- type: Boolean,
- default: true
- },
- indent: {
- type: Number,
- default: 16
- },
- treeProps: {
- type: Object,
- default: () => {
- return {
- hasChildren: "hasChildren",
- children: "children"
- };
- }
- },
- lazy: Boolean,
- load: Function,
- style: {
- type: Object,
- default: () => ({})
- },
- className: {
- type: String,
- default: ""
- },
- tableLayout: {
- type: String,
- default: "fixed"
- },
- scrollbarAlwaysOn: {
- type: Boolean,
- default: false
- }
- };
- const useScrollbar = () => {
- const scrollBarRef = ref();
- const scrollTo = (options, yCoord) => {
- const scrollbar = scrollBarRef.value;
- if (scrollbar) {
- scrollbar.scrollTo(options, yCoord);
- }
- };
- const setScrollPosition = (position, offset2) => {
- const scrollbar = scrollBarRef.value;
- if (scrollbar && isNumber(offset2) && ["Top", "Left"].includes(position)) {
- scrollbar[`setScroll${position}`](offset2);
- }
- };
- const setScrollTop = (top2) => setScrollPosition("Top", top2);
- const setScrollLeft = (left2) => setScrollPosition("Left", left2);
- return {
- scrollBarRef,
- scrollTo,
- setScrollTop,
- setScrollLeft
- };
- };
- let tableIdSeed = 1;
- const _sfc_main$e = defineComponent({
- name: "ElTable",
- directives: {
- Mousewheel
- },
- components: {
- TableHeader,
- TableBody,
- TableFooter,
- ElScrollbar,
- hColgroup
- },
- props: defaultProps$1,
- emits: [
- "select",
- "select-all",
- "selection-change",
- "cell-mouse-enter",
- "cell-mouse-leave",
- "cell-contextmenu",
- "cell-click",
- "cell-dblclick",
- "row-click",
- "row-contextmenu",
- "row-dblclick",
- "header-click",
- "header-contextmenu",
- "sort-change",
- "filter-change",
- "current-change",
- "header-dragend",
- "expand-change"
- ],
- setup(props) {
- const { t } = useLocale();
- const ns = useNamespace("table");
- const table = getCurrentInstance();
- provide(TABLE_INJECTION_KEY, table);
- const store = createStore(table, props);
- table.store = store;
- const layout = new TableLayout({
- store: table.store,
- table,
- fit: props.fit,
- showHeader: props.showHeader
- });
- table.layout = layout;
- const isEmpty3 = computed(() => (store.states.data.value || []).length === 0);
- const {
- setCurrentRow,
- getSelectionRows,
- toggleRowSelection,
- clearSelection,
- clearFilter,
- toggleAllSelection,
- toggleRowExpansion,
- clearSort,
- sort
- } = useUtils(store);
- const {
- isHidden,
- renderExpanded,
- setDragVisible,
- isGroup,
- handleMouseLeave,
- handleHeaderFooterMousewheel,
- tableSize,
- bodyHeight,
- height,
- emptyBlockStyle,
- handleFixedMousewheel,
- fixedHeight,
- fixedBodyHeight,
- resizeProxyVisible,
- bodyWidth,
- resizeState,
- doLayout,
- tableBodyStyles,
- tableLayout,
- scrollbarViewStyle
- } = useStyle(props, layout, store, table);
- const { scrollBarRef, scrollTo, setScrollLeft, setScrollTop } = useScrollbar();
- const debouncedUpdateLayout = debounce$1(doLayout, 50);
- const tableId = `el-table_${tableIdSeed++}`;
- table.tableId = tableId;
- table.state = {
- isGroup,
- resizeState,
- doLayout,
- debouncedUpdateLayout
- };
- const computedSumText = computed(() => props.sumText || t("el.table.sumText"));
- const computedEmptyText = computed(() => {
- return props.emptyText || t("el.table.emptyText");
- });
- return {
- ns,
- layout,
- store,
- handleHeaderFooterMousewheel,
- handleMouseLeave,
- tableId,
- tableSize,
- isHidden,
- isEmpty: isEmpty3,
- renderExpanded,
- resizeProxyVisible,
- resizeState,
- isGroup,
- bodyWidth,
- bodyHeight,
- height,
- tableBodyStyles,
- emptyBlockStyle,
- debouncedUpdateLayout,
- handleFixedMousewheel,
- fixedHeight,
- fixedBodyHeight,
- setCurrentRow,
- getSelectionRows,
- toggleRowSelection,
- clearSelection,
- clearFilter,
- toggleAllSelection,
- toggleRowExpansion,
- clearSort,
- doLayout,
- sort,
- t,
- setDragVisible,
- context: table,
- computedSumText,
- computedEmptyText,
- tableLayout,
- scrollbarViewStyle,
- scrollBarRef,
- scrollTo,
- setScrollLeft,
- setScrollTop
- };
- }
- });
- const _hoisted_1$b = ["data-prefix"];
- const _hoisted_2$9 = {
- ref: "hiddenColumns",
- class: "hidden-columns"
- };
- function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
- const _component_hColgroup = resolveComponent("hColgroup");
- const _component_table_header = resolveComponent("table-header");
- const _component_table_body = resolveComponent("table-body");
- const _component_el_scrollbar = resolveComponent("el-scrollbar");
- const _component_table_footer = resolveComponent("table-footer");
- const _directive_mousewheel = resolveDirective("mousewheel");
- return openBlock(), createElementBlock("div", {
- ref: "tableWrapper",
- class: normalizeClass([
- {
- [_ctx.ns.m("fit")]: _ctx.fit,
- [_ctx.ns.m("striped")]: _ctx.stripe,
- [_ctx.ns.m("border")]: _ctx.border || _ctx.isGroup,
- [_ctx.ns.m("hidden")]: _ctx.isHidden,
- [_ctx.ns.m("group")]: _ctx.isGroup,
- [_ctx.ns.m("fluid-height")]: _ctx.maxHeight,
- [_ctx.ns.m("scrollable-x")]: _ctx.layout.scrollX.value,
- [_ctx.ns.m("scrollable-y")]: _ctx.layout.scrollY.value,
- [_ctx.ns.m("enable-row-hover")]: !_ctx.store.states.isComplex.value,
- [_ctx.ns.m("enable-row-transition")]: (_ctx.store.states.data.value || []).length !== 0 && (_ctx.store.states.data.value || []).length < 100,
- "has-footer": _ctx.showSummary
- },
- _ctx.ns.m(_ctx.tableSize),
- _ctx.className,
- _ctx.ns.b(),
- _ctx.ns.m(`layout-${_ctx.tableLayout}`)
- ]),
- style: normalizeStyle(_ctx.style),
- "data-prefix": _ctx.ns.namespace.value,
- onMouseleave: _cache[0] || (_cache[0] = ($event) => _ctx.handleMouseLeave())
- }, [
- createElementVNode("div", {
- class: normalizeClass(_ctx.ns.e("inner-wrapper"))
- }, [
- createElementVNode("div", _hoisted_2$9, [
- renderSlot(_ctx.$slots, "default")
- ], 512),
- _ctx.showHeader && _ctx.tableLayout === "fixed" ? withDirectives((openBlock(), createElementBlock("div", {
- key: 0,
- ref: "headerWrapper",
- class: normalizeClass(_ctx.ns.e("header-wrapper"))
- }, [
- createElementVNode("table", {
- ref: "tableHeader",
- class: normalizeClass(_ctx.ns.e("header")),
- style: normalizeStyle(_ctx.tableBodyStyles),
- border: "0",
- cellpadding: "0",
- cellspacing: "0"
- }, [
- createVNode(_component_hColgroup, {
- columns: _ctx.store.states.columns.value,
- "table-layout": _ctx.tableLayout
- }, null, 8, ["columns", "table-layout"]),
- createVNode(_component_table_header, {
- ref: "tableHeaderRef",
- border: _ctx.border,
- "default-sort": _ctx.defaultSort,
- store: _ctx.store,
- onSetDragVisible: _ctx.setDragVisible
- }, null, 8, ["border", "default-sort", "store", "onSetDragVisible"])
- ], 6)
- ], 2)), [
- [_directive_mousewheel, _ctx.handleHeaderFooterMousewheel]
- ]) : createCommentVNode("v-if", true),
- createElementVNode("div", {
- ref: "bodyWrapper",
- style: normalizeStyle(_ctx.bodyHeight),
- class: normalizeClass(_ctx.ns.e("body-wrapper"))
- }, [
- createVNode(_component_el_scrollbar, {
- ref: "scrollBarRef",
- height: _ctx.maxHeight ? void 0 : _ctx.height,
- "max-height": _ctx.maxHeight ? _ctx.height : void 0,
- "view-style": _ctx.scrollbarViewStyle,
- always: _ctx.scrollbarAlwaysOn
- }, {
- default: withCtx(() => [
- createElementVNode("table", {
- ref: "tableBody",
- class: normalizeClass(_ctx.ns.e("body")),
- cellspacing: "0",
- cellpadding: "0",
- border: "0",
- style: normalizeStyle({
- width: _ctx.bodyWidth,
- tableLayout: _ctx.tableLayout
- })
- }, [
- createVNode(_component_hColgroup, {
- columns: _ctx.store.states.columns.value,
- "table-layout": _ctx.tableLayout
- }, null, 8, ["columns", "table-layout"]),
- _ctx.showHeader && _ctx.tableLayout === "auto" ? (openBlock(), createBlock(_component_table_header, {
- key: 0,
- border: _ctx.border,
- "default-sort": _ctx.defaultSort,
- store: _ctx.store,
- onSetDragVisible: _ctx.setDragVisible
- }, null, 8, ["border", "default-sort", "store", "onSetDragVisible"])) : createCommentVNode("v-if", true),
- createVNode(_component_table_body, {
- context: _ctx.context,
- highlight: _ctx.highlightCurrentRow,
- "row-class-name": _ctx.rowClassName,
- "tooltip-effect": _ctx.tooltipEffect,
- "row-style": _ctx.rowStyle,
- store: _ctx.store,
- stripe: _ctx.stripe
- }, null, 8, ["context", "highlight", "row-class-name", "tooltip-effect", "row-style", "store", "stripe"])
- ], 6),
- _ctx.isEmpty ? (openBlock(), createElementBlock("div", {
- key: 0,
- ref: "emptyBlock",
- style: normalizeStyle(_ctx.emptyBlockStyle),
- class: normalizeClass(_ctx.ns.e("empty-block"))
- }, [
- createElementVNode("span", {
- class: normalizeClass(_ctx.ns.e("empty-text"))
- }, [
- renderSlot(_ctx.$slots, "empty", {}, () => [
- createTextVNode(toDisplayString(_ctx.computedEmptyText), 1)
- ])
- ], 2)
- ], 6)) : createCommentVNode("v-if", true),
- _ctx.$slots.append ? (openBlock(), createElementBlock("div", {
- key: 1,
- ref: "appendWrapper",
- class: normalizeClass(_ctx.ns.e("append-wrapper"))
- }, [
- renderSlot(_ctx.$slots, "append")
- ], 2)) : createCommentVNode("v-if", true)
- ]),
- _: 3
- }, 8, ["height", "max-height", "view-style", "always"])
- ], 6),
- _ctx.border || _ctx.isGroup ? (openBlock(), createElementBlock("div", {
- key: 1,
- class: normalizeClass(_ctx.ns.e("border-left-patch"))
- }, null, 2)) : createCommentVNode("v-if", true)
- ], 2),
- _ctx.showSummary ? withDirectives((openBlock(), createElementBlock("div", {
- key: 0,
- ref: "footerWrapper",
- class: normalizeClass(_ctx.ns.e("footer-wrapper"))
- }, [
- createVNode(_component_table_footer, {
- border: _ctx.border,
- "default-sort": _ctx.defaultSort,
- store: _ctx.store,
- style: normalizeStyle(_ctx.tableBodyStyles),
- "sum-text": _ctx.computedSumText,
- "summary-method": _ctx.summaryMethod
- }, null, 8, ["border", "default-sort", "store", "style", "sum-text", "summary-method"])
- ], 2)), [
- [vShow, !_ctx.isEmpty],
- [_directive_mousewheel, _ctx.handleHeaderFooterMousewheel]
- ]) : createCommentVNode("v-if", true),
- withDirectives(createElementVNode("div", {
- ref: "resizeProxy",
- class: normalizeClass(_ctx.ns.e("column-resize-proxy"))
- }, null, 2), [
- [vShow, _ctx.resizeProxyVisible]
- ])
- ], 46, _hoisted_1$b);
- }
- 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"]]);
- const defaultClassNames = {
- selection: "table-column--selection",
- expand: "table__expand-column"
- };
- const cellStarts = {
- default: {
- order: ""
- },
- selection: {
- width: 48,
- minWidth: 48,
- realWidth: 48,
- order: ""
- },
- expand: {
- width: 48,
- minWidth: 48,
- realWidth: 48,
- order: ""
- },
- index: {
- width: 48,
- minWidth: 48,
- realWidth: 48,
- order: ""
- }
- };
- const getDefaultClassName = (type4) => {
- return defaultClassNames[type4] || "";
- };
- const cellForced = {
- selection: {
- renderHeader({ store }) {
- function isDisabled() {
- return store.states.data.value && store.states.data.value.length === 0;
- }
- return h$1(ElCheckbox, {
- disabled: isDisabled(),
- size: store.states.tableSize.value,
- indeterminate: store.states.selection.value.length > 0 && !store.states.isAllSelected.value,
- "onUpdate:modelValue": store.toggleAllSelection,
- modelValue: store.states.isAllSelected.value
- });
- },
- renderCell({
- row,
- column,
- store,
- $index
- }) {
- return h$1(ElCheckbox, {
- disabled: column.selectable ? !column.selectable.call(null, row, $index) : false,
- size: store.states.tableSize.value,
- onChange: () => {
- store.commit("rowSelectedChanged", row);
- },
- onClick: (event) => event.stopPropagation(),
- modelValue: store.isSelected(row)
- });
- },
- sortable: false,
- resizable: false
- },
- index: {
- renderHeader({ column }) {
- return column.label || "#";
- },
- renderCell({
- column,
- $index
- }) {
- let i = $index + 1;
- const index = column.index;
- if (typeof index === "number") {
- i = $index + index;
- } else if (typeof index === "function") {
- i = index($index);
- }
- return h$1("div", {}, [i]);
- },
- sortable: false
- },
- expand: {
- renderHeader({ column }) {
- return column.label || "";
- },
- renderCell({
- row,
- store,
- expanded
- }) {
- const { ns } = store;
- const classes = [ns.e("expand-icon")];
- if (expanded) {
- classes.push(ns.em("expand-icon", "expanded"));
- }
- const callback = function(e) {
- e.stopPropagation();
- store.toggleRowExpansion(row);
- };
- return h$1("div", {
- class: classes,
- onClick: callback
- }, {
- default: () => {
- return [
- h$1(ElIcon, null, {
- default: () => {
- return [h$1(arrowRight)];
- }
- })
- ];
- }
- });
- },
- sortable: false,
- resizable: false
- }
- };
- function defaultRenderCell({
- row,
- column,
- $index
- }) {
- var _a2;
- const property = column.property;
- const value = property && getProp(row, property).value;
- if (column && column.formatter) {
- return column.formatter(row, column, value, $index);
- }
- return ((_a2 = value == null ? void 0 : value.toString) == null ? void 0 : _a2.call(value)) || "";
- }
- function treeCellPrefix({
- row,
- treeNode,
- store
- }, createPlacehoder = false) {
- const { ns } = store;
- if (!treeNode) {
- if (createPlacehoder) {
- return [
- h$1("span", {
- class: ns.e("placeholder")
- })
- ];
- }
- return null;
- }
- const ele = [];
- const callback = function(e) {
- e.stopPropagation();
- store.loadOrToggle(row);
- };
- if (treeNode.indent) {
- ele.push(h$1("span", {
- class: ns.e("indent"),
- style: { "padding-left": `${treeNode.indent}px` }
- }));
- }
- if (typeof treeNode.expanded === "boolean" && !treeNode.noLazyChildren) {
- const expandClasses = [
- ns.e("expand-icon"),
- treeNode.expanded ? ns.em("expand-icon", "expanded") : ""
- ];
- let icon = arrowRight;
- if (treeNode.loading) {
- icon = loading;
- }
- ele.push(h$1("div", {
- class: expandClasses,
- onClick: callback
- }, {
- default: () => {
- return [
- h$1(ElIcon, { class: { [ns.is("loading")]: treeNode.loading } }, {
- default: () => [h$1(icon)]
- })
- ];
- }
- }));
- } else {
- ele.push(h$1("span", {
- class: ns.e("placeholder")
- }));
- }
- return ele;
- }
- function getAllAliases(props, aliases) {
- return props.reduce((prev, cur) => {
- prev[cur] = cur;
- return prev;
- }, aliases);
- }
- function useWatcher(owner, props_) {
- const instance = getCurrentInstance();
- const registerComplexWatchers = () => {
- const props = ["fixed"];
- const aliases = {
- realWidth: "width",
- realMinWidth: "minWidth"
- };
- const allAliases = getAllAliases(props, aliases);
- Object.keys(allAliases).forEach((key) => {
- const columnKey = aliases[key];
- if (hasOwn(props_, columnKey)) {
- watch(() => props_[columnKey], (newVal) => {
- let value = newVal;
- if (columnKey === "width" && key === "realWidth") {
- value = parseWidth(newVal);
- }
- if (columnKey === "minWidth" && key === "realMinWidth") {
- value = parseMinWidth(newVal);
- }
- instance.columnConfig.value[columnKey] = value;
- instance.columnConfig.value[key] = value;
- const updateColumns = columnKey === "fixed";
- owner.value.store.scheduleLayout(updateColumns);
- });
- }
- });
- };
- const registerNormalWatchers = () => {
- const props = [
- "label",
- "filters",
- "filterMultiple",
- "sortable",
- "index",
- "formatter",
- "className",
- "labelClassName",
- "showOverflowTooltip"
- ];
- const aliases = {
- property: "prop",
- align: "realAlign",
- headerAlign: "realHeaderAlign"
- };
- const allAliases = getAllAliases(props, aliases);
- Object.keys(allAliases).forEach((key) => {
- const columnKey = aliases[key];
- if (hasOwn(props_, columnKey)) {
- watch(() => props_[columnKey], (newVal) => {
- instance.columnConfig.value[key] = newVal;
- });
- }
- });
- };
- return {
- registerComplexWatchers,
- registerNormalWatchers
- };
- }
- function useRender(props, slots, owner) {
- const instance = getCurrentInstance();
- const columnId = ref("");
- const isSubColumn = ref(false);
- const realAlign = ref();
- const realHeaderAlign = ref();
- const ns = useNamespace("table");
- watchEffect(() => {
- realAlign.value = props.align ? `is-${props.align}` : null;
- realAlign.value;
- });
- watchEffect(() => {
- realHeaderAlign.value = props.headerAlign ? `is-${props.headerAlign}` : realAlign.value;
- realHeaderAlign.value;
- });
- const columnOrTableParent = computed(() => {
- let parent = instance.vnode.vParent || instance.parent;
- while (parent && !parent.tableId && !parent.columnId) {
- parent = parent.vnode.vParent || parent.parent;
- }
- return parent;
- });
- const hasTreeColumn = computed(() => {
- const { store } = instance.parent;
- if (!store)
- return false;
- const { treeData } = store.states;
- const treeDataValue = treeData.value;
- return treeDataValue && Object.keys(treeDataValue).length > 0;
- });
- const realWidth = ref(parseWidth(props.width));
- const realMinWidth = ref(parseMinWidth(props.minWidth));
- const setColumnWidth = (column) => {
- if (realWidth.value)
- column.width = realWidth.value;
- if (realMinWidth.value) {
- column.minWidth = realMinWidth.value;
- }
- if (!column.minWidth) {
- column.minWidth = 80;
- }
- column.realWidth = Number(column.width === void 0 ? column.minWidth : column.width);
- return column;
- };
- const setColumnForcedProps = (column) => {
- const type4 = column.type;
- const source = cellForced[type4] || {};
- Object.keys(source).forEach((prop) => {
- const value = source[prop];
- if (prop !== "className" && value !== void 0) {
- column[prop] = value;
- }
- });
- const className = getDefaultClassName(type4);
- if (className) {
- const forceClass = `${unref(ns.namespace)}-${className}`;
- column.className = column.className ? `${column.className} ${forceClass}` : forceClass;
- }
- return column;
- };
- const checkSubColumn = (children) => {
- if (Array.isArray(children)) {
- children.forEach((child) => check2(child));
- } else {
- check2(children);
- }
- function check2(item) {
- var _a2;
- if (((_a2 = item == null ? void 0 : item.type) == null ? void 0 : _a2.name) === "ElTableColumn") {
- item.vParent = instance;
- }
- }
- };
- const setColumnRenders = (column) => {
- if (props.renderHeader)
- ;
- else if (column.type !== "selection") {
- column.renderHeader = (scope) => {
- instance.columnConfig.value["label"];
- const renderHeader = slots.header;
- return renderHeader ? renderHeader(scope) : column.label;
- };
- }
- let originRenderCell = column.renderCell;
- const hasTreeColumnValue = hasTreeColumn.value;
- if (column.type === "expand") {
- column.renderCell = (data2) => h$1("div", {
- class: "cell"
- }, [originRenderCell(data2)]);
- owner.value.renderExpanded = (data2) => {
- return slots.default ? slots.default(data2) : slots.default;
- };
- } else {
- originRenderCell = originRenderCell || defaultRenderCell;
- column.renderCell = (data2) => {
- let children = null;
- if (slots.default) {
- const vnodes = slots.default(data2);
- children = vnodes.some((v2) => v2.type !== Comment) ? vnodes : originRenderCell(data2);
- } else {
- children = originRenderCell(data2);
- }
- const shouldCreatePlaceholder = hasTreeColumnValue && data2.cellIndex === 0;
- const prefix = treeCellPrefix(data2, shouldCreatePlaceholder);
- const props2 = {
- class: "cell",
- style: {}
- };
- if (column.showOverflowTooltip) {
- props2.class = `${props2.class} ${unref(ns.namespace)}-tooltip`;
- props2.style = {
- width: `${(data2.column.realWidth || Number(data2.column.width)) - 1}px`
- };
- }
- checkSubColumn(children);
- return h$1("div", props2, [prefix, children]);
- };
- }
- return column;
- };
- const getPropsData = (...propsKey) => {
- return propsKey.reduce((prev, cur) => {
- if (Array.isArray(cur)) {
- cur.forEach((key) => {
- prev[key] = props[key];
- });
- }
- return prev;
- }, {});
- };
- const getColumnElIndex = (children, child) => {
- return Array.prototype.indexOf.call(children, child);
- };
- return {
- columnId,
- realAlign,
- isSubColumn,
- realHeaderAlign,
- columnOrTableParent,
- setColumnWidth,
- setColumnForcedProps,
- setColumnRenders,
- getPropsData,
- getColumnElIndex
- };
- }
- var defaultProps = {
- type: {
- type: String,
- default: "default"
- },
- label: String,
- className: String,
- labelClassName: String,
- property: String,
- prop: String,
- width: {
- type: [String, Number],
- default: ""
- },
- minWidth: {
- type: [String, Number],
- default: ""
- },
- renderHeader: Function,
- sortable: {
- type: [Boolean, String],
- default: false
- },
- sortMethod: Function,
- sortBy: [String, Function, Array],
- resizable: {
- type: Boolean,
- default: true
- },
- columnKey: String,
- align: String,
- headerAlign: String,
- showTooltipWhenOverflow: Boolean,
- showOverflowTooltip: Boolean,
- fixed: [Boolean, String],
- formatter: Function,
- selectable: Function,
- reserveSelection: Boolean,
- filterMethod: Function,
- filteredValue: Array,
- filters: Array,
- filterPlacement: String,
- filterMultiple: {
- type: Boolean,
- default: true
- },
- index: [Number, Function],
- sortOrders: {
- type: Array,
- default: () => {
- return ["ascending", "descending", null];
- },
- validator: (val) => {
- return val.every((order2) => ["ascending", "descending", null].includes(order2));
- }
- }
- };
- let columnIdSeed = 1;
- var ElTableColumn$1 = defineComponent({
- name: "ElTableColumn",
- components: {
- ElCheckbox
- },
- props: defaultProps,
- setup(props, { slots }) {
- const instance = getCurrentInstance();
- const columnConfig = ref({});
- const owner = computed(() => {
- let parent2 = instance.parent;
- while (parent2 && !parent2.tableId) {
- parent2 = parent2.parent;
- }
- return parent2;
- });
- const { registerNormalWatchers, registerComplexWatchers } = useWatcher(owner, props);
- const {
- columnId,
- isSubColumn,
- realHeaderAlign,
- columnOrTableParent,
- setColumnWidth,
- setColumnForcedProps,
- setColumnRenders,
- getPropsData,
- getColumnElIndex,
- realAlign
- } = useRender(props, slots, owner);
- const parent = columnOrTableParent.value;
- columnId.value = `${parent.tableId || parent.columnId}_column_${columnIdSeed++}`;
- onBeforeMount(() => {
- isSubColumn.value = owner.value !== parent;
- const type4 = props.type || "default";
- const sortable = props.sortable === "" ? true : props.sortable;
- const defaults = __spreadProps(__spreadValues({}, cellStarts[type4]), {
- id: columnId.value,
- type: type4,
- property: props.prop || props.property,
- align: realAlign,
- headerAlign: realHeaderAlign,
- showOverflowTooltip: props.showOverflowTooltip || props.showTooltipWhenOverflow,
- filterable: props.filters || props.filterMethod,
- filteredValue: [],
- filterPlacement: "",
- isColumnGroup: false,
- isSubColumn: false,
- filterOpened: false,
- sortable,
- index: props.index,
- rawColumnKey: instance.vnode.key
- });
- const basicProps = [
- "columnKey",
- "label",
- "className",
- "labelClassName",
- "type",
- "renderHeader",
- "formatter",
- "fixed",
- "resizable"
- ];
- const sortProps = ["sortMethod", "sortBy", "sortOrders"];
- const selectProps = ["selectable", "reserveSelection"];
- const filterProps = [
- "filterMethod",
- "filters",
- "filterMultiple",
- "filterOpened",
- "filteredValue",
- "filterPlacement"
- ];
- let column = getPropsData(basicProps, sortProps, selectProps, filterProps);
- column = mergeOptions(defaults, column);
- const chains = compose(setColumnRenders, setColumnWidth, setColumnForcedProps);
- column = chains(column);
- columnConfig.value = column;
- registerNormalWatchers();
- registerComplexWatchers();
- });
- onMounted(() => {
- var _a2;
- const parent2 = columnOrTableParent.value;
- const children = isSubColumn.value ? parent2.vnode.el.children : (_a2 = parent2.refs.hiddenColumns) == null ? void 0 : _a2.children;
- const getColumnIndex = () => getColumnElIndex(children || [], instance.vnode.el);
- columnConfig.value.getColumnIndex = getColumnIndex;
- const columnIndex = getColumnIndex();
- columnIndex > -1 && owner.value.store.commit("insertColumn", columnConfig.value, isSubColumn.value ? parent2.columnConfig.value : null);
- });
- onBeforeUnmount(() => {
- owner.value.store.commit("removeColumn", columnConfig.value, isSubColumn.value ? parent.columnConfig.value : null);
- });
- instance.columnId = columnId.value;
- instance.columnConfig = columnConfig;
- return;
- },
- render() {
- var _a2, _b2, _c;
- try {
- const renderDefault = (_b2 = (_a2 = this.$slots).default) == null ? void 0 : _b2.call(_a2, {
- row: {},
- column: {},
- $index: -1
- });
- const children = [];
- if (Array.isArray(renderDefault)) {
- for (const childNode of renderDefault) {
- if (((_c = childNode.type) == null ? void 0 : _c.name) === "ElTableColumn" || childNode.shapeFlag & 2) {
- children.push(childNode);
- } else if (childNode.type === Fragment && Array.isArray(childNode.children)) {
- childNode.children.forEach((vnode2) => {
- if ((vnode2 == null ? void 0 : vnode2.patchFlag) !== 1024 && !isString(vnode2 == null ? void 0 : vnode2.children)) {
- children.push(vnode2);
- }
- });
- }
- }
- }
- const vnode = h$1("div", children);
- return vnode;
- } catch (e) {
- return h$1("div", []);
- }
- }
- });
- const ElTable = withInstall(Table, {
- TableColumn: ElTableColumn$1
- });
- const ElTableColumn = withNoopInstall(ElTableColumn$1);
- const SCOPE$1 = "ElUpload";
- class UploadAjaxError extends Error {
- constructor(message, status, method4, url2) {
- super(message);
- this.name = "UploadAjaxError";
- this.status = status;
- this.method = method4;
- this.url = url2;
- }
- }
- function getError(action, option, xhr) {
- let msg;
- if (xhr.response) {
- msg = `${xhr.response.error || xhr.response}`;
- } else if (xhr.responseText) {
- msg = `${xhr.responseText}`;
- } else {
- msg = `fail to ${option.method} ${action} ${xhr.status}`;
- }
- return new UploadAjaxError(msg, xhr.status, option.method, action);
- }
- function getBody(xhr) {
- const text = xhr.responseText || xhr.response;
- if (!text) {
- return text;
- }
- try {
- return JSON.parse(text);
- } catch (e) {
- return text;
- }
- }
- const ajaxUpload = (option) => {
- if (typeof XMLHttpRequest === "undefined")
- throwError(SCOPE$1, "XMLHttpRequest is undefined");
- const xhr = new XMLHttpRequest();
- const action = option.action;
- if (xhr.upload) {
- xhr.upload.addEventListener("progress", (evt) => {
- const progressEvt = evt;
- progressEvt.percent = evt.total > 0 ? evt.loaded / evt.total * 100 : 0;
- option.onProgress(progressEvt);
- });
- }
- const formData = new FormData();
- if (option.data) {
- for (const [key, value] of Object.entries(option.data)) {
- if (Array.isArray(value))
- formData.append(key, ...value);
- else
- formData.append(key, value);
- }
- }
- formData.append(option.filename, option.file, option.file.name);
- xhr.addEventListener("error", () => {
- option.onError(getError(action, option, xhr));
- });
- xhr.addEventListener("load", () => {
- if (xhr.status < 200 || xhr.status >= 300) {
- return option.onError(getError(action, option, xhr));
- }
- option.onSuccess(getBody(xhr));
- });
- xhr.open(option.method, action, true);
- if (option.withCredentials && "withCredentials" in xhr) {
- xhr.withCredentials = true;
- }
- const headers = option.headers || {};
- if (headers instanceof Headers) {
- headers.forEach((value, key) => xhr.setRequestHeader(key, value));
- } else {
- for (const [key, value] of Object.entries(headers)) {
- if (isNil(value))
- continue;
- xhr.setRequestHeader(key, String(value));
- }
- }
- xhr.send(formData);
- return xhr;
- };
- const uploadListTypes = ["text", "picture", "picture-card"];
- let fileId = 1;
- const genFileId = () => Date.now() + fileId++;
- const uploadBaseProps = buildProps({
- action: {
- type: String,
- required: true
- },
- headers: {
- type: definePropType(Object)
- },
- method: {
- type: String,
- default: "post"
- },
- data: {
- type: Object,
- default: () => mutable({})
- },
- multiple: {
- type: Boolean,
- default: false
- },
- name: {
- type: String,
- default: "file"
- },
- drag: {
- type: Boolean,
- default: false
- },
- withCredentials: Boolean,
- showFileList: {
- type: Boolean,
- default: true
- },
- accept: {
- type: String,
- default: ""
- },
- type: {
- type: String,
- default: "select"
- },
- fileList: {
- type: definePropType(Array),
- default: () => mutable([])
- },
- autoUpload: {
- type: Boolean,
- default: true
- },
- listType: {
- type: String,
- values: uploadListTypes,
- default: "text"
- },
- httpRequest: {
- type: definePropType(Function),
- default: ajaxUpload
- },
- disabled: Boolean,
- limit: Number
- });
- const uploadProps = buildProps(__spreadProps(__spreadValues({}, uploadBaseProps), {
- beforeUpload: {
- type: definePropType(Function),
- default: NOOP
- },
- beforeRemove: {
- type: definePropType(Function)
- },
- onRemove: {
- type: definePropType(Function),
- default: NOOP
- },
- onChange: {
- type: definePropType(Function),
- default: NOOP
- },
- onPreview: {
- type: definePropType(Function),
- default: NOOP
- },
- onSuccess: {
- type: definePropType(Function),
- default: NOOP
- },
- onProgress: {
- type: definePropType(Function),
- default: NOOP
- },
- onError: {
- type: definePropType(Function),
- default: NOOP
- },
- onExceed: {
- type: definePropType(Function),
- default: NOOP
- }
- }));
- const uploadListProps = buildProps({
- files: {
- type: definePropType(Array),
- default: () => mutable([])
- },
- disabled: {
- type: Boolean,
- default: false
- },
- handlePreview: {
- type: definePropType(Function),
- default: NOOP
- },
- listType: {
- type: String,
- values: uploadListTypes,
- default: "text"
- }
- });
- const uploadListEmits = {
- remove: (file) => !!file
- };
- const _hoisted_1$a = ["onKeydown"];
- const _hoisted_2$8 = ["src"];
- const _hoisted_3$6 = ["onClick"];
- const _hoisted_4$6 = ["onClick"];
- const _hoisted_5$6 = ["onClick"];
- const __default__$4 = {
- name: "ElUploadList"
- };
- const _sfc_main$d = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$4), {
- props: uploadListProps,
- emits: uploadListEmits,
- setup(__props, { emit }) {
- const props = __props;
- const { t } = useLocale();
- const nsUpload = useNamespace("upload");
- const nsIcon = useNamespace("icon");
- const nsList = useNamespace("list");
- const focusing = ref(false);
- const handleClick = (file) => {
- props.handlePreview(file);
- };
- const onFileClicked = (e) => {
- e.target.focus();
- };
- const handleRemove = (file) => {
- emit("remove", file);
- };
- return (_ctx, _cache) => {
- return openBlock(), createBlock(TransitionGroup, {
- tag: "ul",
- class: normalizeClass([
- unref(nsUpload).b("list"),
- unref(nsUpload).bm("list", _ctx.listType),
- unref(nsUpload).is("disabled", _ctx.disabled)
- ]),
- name: unref(nsList).b()
- }, {
- default: withCtx(() => [
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.files, (file) => {
- return openBlock(), createElementBlock("li", {
- key: file.uid || file.name,
- class: normalizeClass([
- unref(nsUpload).be("list", "item"),
- unref(nsUpload).is(file.status),
- { focusing: focusing.value }
- ]),
- tabindex: "0",
- onKeydown: withKeys(($event) => !_ctx.disabled && handleRemove(file), ["delete"]),
- onFocus: _cache[0] || (_cache[0] = ($event) => focusing.value = true),
- onBlur: _cache[1] || (_cache[1] = ($event) => focusing.value = false),
- onClick: onFileClicked
- }, [
- renderSlot(_ctx.$slots, "default", { file }, () => [
- _ctx.listType === "picture" || file.status !== "uploading" && _ctx.listType === "picture-card" ? (openBlock(), createElementBlock("img", {
- key: 0,
- class: normalizeClass(unref(nsUpload).be("list", "item-thumbnail")),
- src: file.url,
- alt: ""
- }, null, 10, _hoisted_2$8)) : createCommentVNode("v-if", true),
- _ctx.listType !== "picture" && (file.status === "uploading" || _ctx.listType !== "picture-card") ? (openBlock(), createElementBlock("div", {
- key: 1,
- class: normalizeClass(unref(nsUpload).be("list", "item-info"))
- }, [
- createElementVNode("a", {
- class: normalizeClass(unref(nsUpload).be("list", "item-name")),
- onClick: ($event) => handleClick(file)
- }, [
- createVNode(unref(ElIcon), {
- class: normalizeClass(unref(nsIcon).m("document"))
- }, {
- default: withCtx(() => [
- createVNode(unref(document$1))
- ]),
- _: 1
- }, 8, ["class"]),
- createTextVNode(" " + toDisplayString(file.name), 1)
- ], 10, _hoisted_3$6),
- file.status === "uploading" ? (openBlock(), createBlock(unref(ElProgress), {
- key: 0,
- type: _ctx.listType === "picture-card" ? "circle" : "line",
- "stroke-width": _ctx.listType === "picture-card" ? 6 : 2,
- percentage: Number(file.percentage),
- style: normalizeStyle(_ctx.listType === "picture-card" ? "" : "margin-top: 0.5rem")
- }, null, 8, ["type", "stroke-width", "percentage", "style"])) : createCommentVNode("v-if", true)
- ], 2)) : createCommentVNode("v-if", true),
- createElementVNode("label", {
- class: normalizeClass(unref(nsUpload).be("list", "item-status-label"))
- }, [
- _ctx.listType === "text" ? (openBlock(), createBlock(unref(ElIcon), {
- key: 0,
- class: normalizeClass([unref(nsIcon).m("upload-success"), unref(nsIcon).m("circle-check")])
- }, {
- default: withCtx(() => [
- createVNode(unref(circleCheck))
- ]),
- _: 1
- }, 8, ["class"])) : ["picture-card", "picture"].includes(_ctx.listType) ? (openBlock(), createBlock(unref(ElIcon), {
- key: 1,
- class: normalizeClass([unref(nsIcon).m("upload-success"), unref(nsIcon).m("check")])
- }, {
- default: withCtx(() => [
- createVNode(unref(check))
- ]),
- _: 1
- }, 8, ["class"])) : createCommentVNode("v-if", true)
- ], 2),
- !_ctx.disabled ? (openBlock(), createBlock(unref(ElIcon), {
- key: 2,
- class: normalizeClass(unref(nsIcon).m("close")),
- onClick: ($event) => handleRemove(file)
- }, {
- default: withCtx(() => [
- createVNode(unref(close))
- ]),
- _: 2
- }, 1032, ["class", "onClick"])) : createCommentVNode("v-if", true),
- createCommentVNode(" Due to close btn only appears when li gets focused disappears after li gets blurred, thus keyboard navigation can never reach close btn"),
- createCommentVNode(" This is a bug which needs to be fixed "),
- createCommentVNode(" TODO: Fix the incorrect navigation interaction "),
- !_ctx.disabled ? (openBlock(), createElementBlock("i", {
- key: 3,
- class: normalizeClass(unref(nsIcon).m("close-tip"))
- }, toDisplayString(unref(t)("el.upload.deleteTip")), 3)) : createCommentVNode("v-if", true),
- _ctx.listType === "picture-card" ? (openBlock(), createElementBlock("span", {
- key: 4,
- class: normalizeClass(unref(nsUpload).be("list", "item-actions"))
- }, [
- createElementVNode("span", {
- class: normalizeClass(unref(nsUpload).be("list", "item-preview")),
- onClick: ($event) => _ctx.handlePreview(file)
- }, [
- createVNode(unref(ElIcon), {
- class: normalizeClass(unref(nsIcon).m("zoom-in"))
- }, {
- default: withCtx(() => [
- createVNode(unref(zoomIn))
- ]),
- _: 1
- }, 8, ["class"])
- ], 10, _hoisted_4$6),
- !_ctx.disabled ? (openBlock(), createElementBlock("span", {
- key: 0,
- class: normalizeClass(unref(nsUpload).be("list", "item-delete")),
- onClick: ($event) => handleRemove(file)
- }, [
- createVNode(unref(ElIcon), {
- class: normalizeClass(unref(nsIcon).m("delete"))
- }, {
- default: withCtx(() => [
- createVNode(unref(_delete))
- ]),
- _: 1
- }, 8, ["class"])
- ], 10, _hoisted_5$6)) : createCommentVNode("v-if", true)
- ], 2)) : createCommentVNode("v-if", true)
- ])
- ], 42, _hoisted_1$a);
- }), 128)),
- renderSlot(_ctx.$slots, "append")
- ]),
- _: 3
- }, 8, ["class", "name"]);
- };
- }
- }));
- var UploadList = /* @__PURE__ */ _export_sfc$1(_sfc_main$d, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/upload/src/upload-list.vue"]]);
- const uploadDraggerProps = buildProps({
- disabled: {
- type: Boolean,
- default: false
- }
- });
- const uploadDraggerEmits = {
- file: (file) => isArray(file)
- };
- const _hoisted_1$9 = ["onDrop", "onDragover"];
- const __default__$3 = {
- name: "ElUploadDrag"
- };
- const _sfc_main$c = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$3), {
- props: uploadDraggerProps,
- emits: uploadDraggerEmits,
- setup(__props, { emit }) {
- const props = __props;
- const COMPONENT_NAME2 = "ElUploadDrag";
- const uploaderContext = inject(uploadContextKey);
- if (!uploaderContext) {
- throwError(COMPONENT_NAME2, "usage: <el-upload><el-upload-dragger /></el-upload>");
- }
- const ns = useNamespace("upload");
- const dragover = ref(false);
- const onDrop = (e) => {
- if (props.disabled)
- return;
- dragover.value = false;
- const files = Array.from(e.dataTransfer.files);
- const accept = uploaderContext.accept.value;
- if (!accept) {
- emit("file", files);
- return;
- }
- const filesFiltered = files.filter((file) => {
- const { type: type4, name } = file;
- const extension = name.includes(".") ? `.${name.split(".").pop()}` : "";
- const baseType = type4.replace(/\/.*$/, "");
- return accept.split(",").map((type22) => type22.trim()).filter((type22) => type22).some((acceptedType) => {
- if (acceptedType.startsWith(".")) {
- return extension === acceptedType;
- }
- if (/\/\*$/.test(acceptedType)) {
- return baseType === acceptedType.replace(/\/\*$/, "");
- }
- if (/^[^/]+\/[^/]+$/.test(acceptedType)) {
- return type4 === acceptedType;
- }
- return false;
- });
- });
- emit("file", filesFiltered);
- };
- const onDragover = () => {
- if (!props.disabled)
- dragover.value = true;
- };
- return (_ctx, _cache) => {
- return openBlock(), createElementBlock("div", {
- class: normalizeClass([unref(ns).b("dragger"), unref(ns).is("dragover", dragover.value)]),
- onDrop: withModifiers(onDrop, ["prevent"]),
- onDragover: withModifiers(onDragover, ["prevent"]),
- onDragleave: _cache[0] || (_cache[0] = withModifiers(($event) => dragover.value = false, ["prevent"]))
- }, [
- renderSlot(_ctx.$slots, "default")
- ], 42, _hoisted_1$9);
- };
- }
- }));
- var UploadDragger = /* @__PURE__ */ _export_sfc$1(_sfc_main$c, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/upload/src/upload-dragger.vue"]]);
- const uploadContentProps = buildProps(__spreadProps(__spreadValues({}, uploadBaseProps), {
- fileList: {
- type: definePropType(Array),
- default: () => mutable([])
- },
- beforeUpload: {
- type: definePropType(Function),
- default: NOOP
- },
- onRemove: {
- type: definePropType(Function),
- default: NOOP
- },
- onStart: {
- type: definePropType(Function),
- default: NOOP
- },
- onSuccess: {
- type: definePropType(Function),
- default: NOOP
- },
- onProgress: {
- type: definePropType(Function),
- default: NOOP
- },
- onError: {
- type: definePropType(Function),
- default: NOOP
- },
- onExceed: {
- type: definePropType(Function),
- default: NOOP
- }
- }));
- const _hoisted_1$8 = ["onKeydown"];
- const _hoisted_2$7 = ["name", "multiple", "accept"];
- const __default__$2 = {
- name: "ElUploadContent",
- inheritAttrs: false
- };
- const _sfc_main$b = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$2), {
- props: uploadContentProps,
- setup(__props, { expose }) {
- const props = __props;
- const ns = useNamespace("upload");
- const requests = shallowRef({});
- const inputRef = shallowRef();
- const uploadFiles = (files) => {
- if (files.length === 0)
- return;
- const { autoUpload, limit, fileList, multiple, onStart, onExceed } = props;
- if (limit && fileList.length + files.length > limit) {
- onExceed(files, fileList);
- return;
- }
- if (!multiple) {
- files = files.slice(0, 1);
- }
- for (const file of files) {
- const rawFile = file;
- rawFile.uid = genFileId();
- onStart(rawFile);
- if (autoUpload)
- upload(rawFile);
- }
- };
- const upload = async (rawFile) => {
- inputRef.value.value = "";
- if (!props.beforeUpload) {
- return doUpload(rawFile);
- }
- let hookResult;
- try {
- hookResult = await props.beforeUpload(rawFile);
- } catch (e) {
- hookResult = false;
- }
- if (hookResult === false) {
- props.onRemove(rawFile);
- return;
- }
- let file = rawFile;
- if (hookResult instanceof Blob) {
- if (hookResult instanceof File) {
- file = hookResult;
- } else {
- file = new File([hookResult], rawFile.name, {
- type: rawFile.type
- });
- }
- for (const key of Object.keys(rawFile)) {
- file[key] = rawFile[key];
- }
- }
- doUpload(rawFile);
- };
- const doUpload = (rawFile) => {
- const {
- headers,
- data: data2,
- method: method4,
- withCredentials,
- name: filename,
- action,
- onProgress,
- onSuccess,
- onError,
- httpRequest
- } = props;
- const { uid: uid2 } = rawFile;
- const options = {
- headers: headers || {},
- withCredentials,
- file: rawFile,
- data: data2,
- method: method4,
- filename,
- action,
- onProgress: (evt) => {
- onProgress(evt, rawFile);
- },
- onSuccess: (res) => {
- onSuccess(res, rawFile);
- delete requests.value[uid2];
- },
- onError: (err) => {
- onError(err, rawFile);
- delete requests.value[uid2];
- }
- };
- const request = httpRequest(options);
- requests.value[uid2] = request;
- if (request instanceof Promise) {
- request.then(options.onSuccess, options.onError);
- }
- };
- const handleChange2 = (e) => {
- const files = e.target.files;
- if (!files)
- return;
- uploadFiles(Array.from(files));
- };
- const handleClick = () => {
- if (!props.disabled) {
- inputRef.value.value = "";
- inputRef.value.click();
- }
- };
- const handleKeydown = () => {
- handleClick();
- };
- const abort = (file) => {
- const _reqs = entriesOf(requests.value).filter(file ? ([uid2]) => String(file.uid) === uid2 : () => true);
- _reqs.forEach(([uid2, req]) => {
- if (req instanceof XMLHttpRequest)
- req.abort();
- delete requests.value[uid2];
- });
- };
- expose({
- abort,
- upload
- });
- return (_ctx, _cache) => {
- return openBlock(), createElementBlock("div", {
- class: normalizeClass([unref(ns).b(), unref(ns).m(_ctx.listType)]),
- tabindex: "0",
- onClick: handleClick,
- onKeydown: withKeys(withModifiers(handleKeydown, ["self"]), ["enter", "space"])
- }, [
- _ctx.drag ? (openBlock(), createBlock(UploadDragger, {
- key: 0,
- disabled: _ctx.disabled,
- onFile: uploadFiles
- }, {
- default: withCtx(() => [
- renderSlot(_ctx.$slots, "default")
- ]),
- _: 3
- }, 8, ["disabled"])) : renderSlot(_ctx.$slots, "default", { key: 1 }),
- createElementVNode("input", {
- ref_key: "inputRef",
- ref: inputRef,
- class: normalizeClass(unref(ns).e("input")),
- name: _ctx.name,
- multiple: _ctx.multiple,
- accept: _ctx.accept,
- type: "file",
- onChange: handleChange2
- }, null, 42, _hoisted_2$7)
- ], 42, _hoisted_1$8);
- };
- }
- }));
- var UploadContent = /* @__PURE__ */ _export_sfc$1(_sfc_main$b, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/upload/src/upload-content.vue"]]);
- const SCOPE = "ElUpload";
- const revokeObjectURL = (file) => {
- var _a2;
- if ((_a2 = file.url) == null ? void 0 : _a2.startsWith("blob:")) {
- URL.revokeObjectURL(file.url);
- }
- };
- const useHandlers = (props, uploadRef) => {
- const uploadFiles = ref([]);
- const getFile = (rawFile) => uploadFiles.value.find((file) => file.uid === rawFile.uid);
- function abort(file) {
- var _a2;
- (_a2 = uploadRef.value) == null ? void 0 : _a2.abort(file);
- }
- function clearFiles(states = ["ready", "uploading", "success", "fail"]) {
- uploadFiles.value = uploadFiles.value.filter((row) => !states.includes(row.status));
- }
- const handleError = (err, rawFile) => {
- const file = getFile(rawFile);
- if (!file)
- return;
- file.status = "fail";
- uploadFiles.value.splice(uploadFiles.value.indexOf(file), 1);
- props.onError(err, file, uploadFiles.value);
- props.onChange(file, uploadFiles.value);
- };
- const handleProgress = (evt, rawFile) => {
- const file = getFile(rawFile);
- if (!file)
- return;
- props.onProgress(evt, file, uploadFiles.value);
- file.status = "uploading";
- file.percentage = Math.round(evt.percent);
- };
- const handleSuccess = (response, rawFile) => {
- const file = getFile(rawFile);
- if (!file)
- return;
- file.status = "success";
- file.response = response;
- props.onSuccess(response, file, uploadFiles.value);
- props.onChange(file, uploadFiles.value);
- };
- const handleStart = (file) => {
- const uploadFile = {
- name: file.name,
- percentage: 0,
- status: "ready",
- size: file.size,
- raw: file,
- uid: file.uid
- };
- if (props.listType === "picture-card" || props.listType === "picture") {
- try {
- uploadFile.url = URL.createObjectURL(file);
- } catch (err) {
- debugWarn(SCOPE, err.message);
- props.onError(err, uploadFile, uploadFiles.value);
- }
- }
- uploadFiles.value.push(uploadFile);
- props.onChange(uploadFile, uploadFiles.value);
- };
- const handleRemove = async (file, rawFile) => {
- if (rawFile) {
- useDeprecated({
- scope: SCOPE,
- from: "handleRemove second argument",
- version: "2.2",
- replacement: "first argument `file`",
- ref: "https://element-plus.org/en-US/component/upload.html#methods"
- }, true);
- }
- const _file = rawFile || file;
- const uploadFile = _file instanceof File ? getFile(_file) : _file;
- if (!uploadFile)
- throwError(SCOPE, "file to be removed not found");
- const doRemove = (file2) => {
- abort(file2);
- const fileList = uploadFiles.value;
- fileList.splice(fileList.indexOf(file2), 1);
- props.onRemove(file2, fileList);
- revokeObjectURL(file2);
- };
- if (props.beforeRemove) {
- const before = await props.beforeRemove(uploadFile, uploadFiles.value);
- if (before !== false)
- doRemove(uploadFile);
- } else {
- doRemove(uploadFile);
- }
- };
- function submit() {
- uploadFiles.value.filter(({ status }) => status === "ready").forEach(({ raw }) => {
- var _a2;
- return raw && ((_a2 = uploadRef.value) == null ? void 0 : _a2.upload(raw));
- });
- }
- watch(() => props.listType, (val) => {
- if (val !== "picture-card" && val !== "picture") {
- return;
- }
- uploadFiles.value = uploadFiles.value.map((file) => {
- const { raw, url: url2 } = file;
- if (!url2 && raw) {
- try {
- file.url = URL.createObjectURL(raw);
- } catch (err) {
- props.onError(err, file, uploadFiles.value);
- }
- }
- return file;
- });
- });
- watch(() => props.fileList, (fileList) => {
- for (const file of fileList) {
- file.uid || (file.uid = genFileId());
- file.status || (file.status = "success");
- }
- uploadFiles.value = fileList;
- }, { immediate: true, deep: true });
- return {
- abort,
- clearFiles,
- handleError,
- handleProgress,
- handleStart,
- handleSuccess,
- handleRemove,
- submit,
- uploadFiles
- };
- };
- const __default__$1 = {
- name: "ElUpload"
- };
- const _sfc_main$a = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$1), {
- props: uploadProps,
- setup(__props, { expose }) {
- const props = __props;
- const slots = useSlots();
- const disabled = useDisabled$1();
- const uploadRef = shallowRef();
- const {
- abort,
- submit,
- clearFiles,
- uploadFiles,
- handleStart,
- handleError,
- handleRemove,
- handleSuccess,
- handleProgress
- } = useHandlers(props, uploadRef);
- const isPictureCard = computed(() => props.listType === "picture-card");
- const uploadContentProps2 = computed(() => __spreadProps(__spreadValues({}, props), {
- onStart: handleStart,
- onProgress: handleProgress,
- onSuccess: handleSuccess,
- onError: handleError,
- onRemove: handleRemove
- }));
- onBeforeUnmount(() => {
- uploadFiles.value.forEach(({ url: url2 }) => {
- if (url2 == null ? void 0 : url2.startsWith("blob:"))
- URL.revokeObjectURL(url2);
- });
- });
- provide(uploadContextKey, {
- accept: toRef(props, "accept")
- });
- expose({
- abort,
- submit,
- clearFiles,
- handleStart,
- handleRemove
- });
- return (_ctx, _cache) => {
- return openBlock(), createElementBlock("div", null, [
- unref(isPictureCard) && _ctx.showFileList ? (openBlock(), createBlock(UploadList, {
- key: 0,
- disabled: unref(disabled),
- "list-type": _ctx.listType,
- files: unref(uploadFiles),
- "handle-preview": _ctx.onPreview,
- onRemove: unref(handleRemove)
- }, createSlots({
- append: withCtx(() => [
- _ctx.listType === "picture-card" ? (openBlock(), createBlock(UploadContent, mergeProps({
- key: 0,
- ref_key: "uploadRef",
- ref: uploadRef
- }, unref(uploadContentProps2)), {
- default: withCtx(() => [
- unref(slots).trigger ? renderSlot(_ctx.$slots, "trigger", { key: 0 }) : createCommentVNode("v-if", true),
- !unref(slots).trigger && unref(slots).default ? renderSlot(_ctx.$slots, "default", { key: 1 }) : createCommentVNode("v-if", true)
- ]),
- _: 3
- }, 16)) : createCommentVNode("v-if", true)
- ]),
- _: 2
- }, [
- _ctx.$slots.file ? {
- name: "default",
- fn: withCtx(({ file }) => [
- renderSlot(_ctx.$slots, "file", { file })
- ])
- } : void 0
- ]), 1032, ["disabled", "list-type", "files", "handle-preview", "onRemove"])) : createCommentVNode("v-if", true),
- _ctx.listType !== "picture-card" ? (openBlock(), createBlock(UploadContent, mergeProps({
- key: 1,
- ref_key: "uploadRef",
- ref: uploadRef
- }, unref(uploadContentProps2)), {
- default: withCtx(() => [
- unref(slots).trigger ? renderSlot(_ctx.$slots, "trigger", { key: 0 }) : createCommentVNode("v-if", true),
- !unref(slots).trigger && unref(slots).default ? renderSlot(_ctx.$slots, "default", { key: 1 }) : createCommentVNode("v-if", true)
- ]),
- _: 3
- }, 16)) : createCommentVNode("v-if", true),
- _ctx.$slots.trigger ? renderSlot(_ctx.$slots, "default", { key: 2 }) : createCommentVNode("v-if", true),
- renderSlot(_ctx.$slots, "tip"),
- !unref(isPictureCard) && _ctx.showFileList ? (openBlock(), createBlock(UploadList, {
- key: 3,
- disabled: unref(disabled),
- "list-type": _ctx.listType,
- files: unref(uploadFiles),
- "handle-preview": _ctx.onPreview,
- onRemove: unref(handleRemove)
- }, createSlots({ _: 2 }, [
- _ctx.$slots.file ? {
- name: "default",
- fn: withCtx(({ file }) => [
- renderSlot(_ctx.$slots, "file", { file })
- ])
- } : void 0
- ]), 1032, ["disabled", "list-type", "files", "handle-preview", "onRemove"])) : createCommentVNode("v-if", true)
- ]);
- };
- }
- }));
- var Upload = /* @__PURE__ */ _export_sfc$1(_sfc_main$a, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/upload/src/upload.vue"]]);
- const ElUpload = withInstall(Upload);
- var base = "";
- var elDialog = "";
- var elOverlay = "";
- var elButton = "";
- var elForm = "";
- var elFormItem = "";
- var elCascader = "";
- var elInput = "";
- var elPopper = "";
- var elTag = "";
- var elCascaderPanel = "";
- var elCheckbox = "";
- var elRadio = "";
- var elScrollbar = "";
- var elUpload = "";
- var elProgress = "";
- var elImage = "";
- var elImageViewer = "";
- var elSlider = "";
- var elInputNumber = "";
- var elTooltip = "";
- var elSwitch = "";
- var elOption = "";
- var elOptionGroup = "";
- var elSelect = "";
- var elRate = "";
- var elDatePicker = "";
- var elConfigProvider = "";
- var elTimePicker = "";
- var elCheckboxGroup = "";
- var elRadioGroup = "";
- var elDivider = "";
- var elTable = "";
- var elTableColumn = "";
- var zhCn = {
- name: "zh-cn",
- el: {
- colorpicker: {
- confirm: "\u786E\u5B9A",
- clear: "\u6E05\u7A7A"
- },
- datepicker: {
- now: "\u6B64\u523B",
- today: "\u4ECA\u5929",
- cancel: "\u53D6\u6D88",
- clear: "\u6E05\u7A7A",
- confirm: "\u786E\u5B9A",
- selectDate: "\u9009\u62E9\u65E5\u671F",
- selectTime: "\u9009\u62E9\u65F6\u95F4",
- startDate: "\u5F00\u59CB\u65E5\u671F",
- startTime: "\u5F00\u59CB\u65F6\u95F4",
- endDate: "\u7ED3\u675F\u65E5\u671F",
- endTime: "\u7ED3\u675F\u65F6\u95F4",
- prevYear: "\u524D\u4E00\u5E74",
- nextYear: "\u540E\u4E00\u5E74",
- prevMonth: "\u4E0A\u4E2A\u6708",
- nextMonth: "\u4E0B\u4E2A\u6708",
- year: "\u5E74",
- month1: "1 \u6708",
- month2: "2 \u6708",
- month3: "3 \u6708",
- month4: "4 \u6708",
- month5: "5 \u6708",
- month6: "6 \u6708",
- month7: "7 \u6708",
- month8: "8 \u6708",
- month9: "9 \u6708",
- month10: "10 \u6708",
- month11: "11 \u6708",
- month12: "12 \u6708",
- weeks: {
- sun: "\u65E5",
- mon: "\u4E00",
- tue: "\u4E8C",
- wed: "\u4E09",
- thu: "\u56DB",
- fri: "\u4E94",
- sat: "\u516D"
- },
- months: {
- jan: "\u4E00\u6708",
- feb: "\u4E8C\u6708",
- mar: "\u4E09\u6708",
- apr: "\u56DB\u6708",
- may: "\u4E94\u6708",
- jun: "\u516D\u6708",
- jul: "\u4E03\u6708",
- aug: "\u516B\u6708",
- sep: "\u4E5D\u6708",
- oct: "\u5341\u6708",
- nov: "\u5341\u4E00\u6708",
- dec: "\u5341\u4E8C\u6708"
- }
- },
- select: {
- loading: "\u52A0\u8F7D\u4E2D",
- noMatch: "\u65E0\u5339\u914D\u6570\u636E",
- noData: "\u65E0\u6570\u636E",
- placeholder: "\u8BF7\u9009\u62E9"
- },
- cascader: {
- noMatch: "\u65E0\u5339\u914D\u6570\u636E",
- loading: "\u52A0\u8F7D\u4E2D",
- placeholder: "\u8BF7\u9009\u62E9",
- noData: "\u6682\u65E0\u6570\u636E"
- },
- pagination: {
- goto: "\u524D\u5F80",
- pagesize: "\u6761/\u9875",
- total: "\u5171 {total} \u6761",
- pageClassifier: "\u9875",
- 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"
- },
- messagebox: {
- title: "\u63D0\u793A",
- confirm: "\u786E\u5B9A",
- cancel: "\u53D6\u6D88",
- error: "\u8F93\u5165\u7684\u6570\u636E\u4E0D\u5408\u6CD5!"
- },
- upload: {
- deleteTip: "\u6309 delete \u952E\u53EF\u5220\u9664",
- delete: "\u5220\u9664",
- preview: "\u67E5\u770B\u56FE\u7247",
- continue: "\u7EE7\u7EED\u4E0A\u4F20"
- },
- table: {
- emptyText: "\u6682\u65E0\u6570\u636E",
- confirmFilter: "\u7B5B\u9009",
- resetFilter: "\u91CD\u7F6E",
- clearFilter: "\u5168\u90E8",
- sumText: "\u5408\u8BA1"
- },
- tree: {
- emptyText: "\u6682\u65E0\u6570\u636E"
- },
- transfer: {
- noMatch: "\u65E0\u5339\u914D\u6570\u636E",
- noData: "\u65E0\u6570\u636E",
- titles: ["\u5217\u8868 1", "\u5217\u8868 2"],
- filterPlaceholder: "\u8BF7\u8F93\u5165\u641C\u7D22\u5185\u5BB9",
- noCheckedFormat: "\u5171 {total} \u9879",
- hasCheckedFormat: "\u5DF2\u9009 {checked}/{total} \u9879"
- },
- image: {
- error: "\u52A0\u8F7D\u5931\u8D25"
- },
- pageHeader: {
- title: "\u8FD4\u56DE"
- },
- popconfirm: {
- confirmButtonText: "\u786E\u5B9A",
- cancelButtonText: "\u53D6\u6D88"
- }
- }
- };
- var personnelSearch_vue_vue_type_style_index_0_lang = "";
- const _hoisted_1$7 = { class: "selectV2SingleChoiceReset" };
- const _hoisted_2$6 = {
- key: 0,
- style: { "color": "#A8ABB2" }
- };
- const _hoisted_3$5 = {
- key: 1,
- style: { "color": "#606266" }
- };
- const _hoisted_4$5 = { class: "selectV2SingleChoiceTwoReset" };
- const _hoisted_5$5 = {
- key: 0,
- style: { "color": "#A8ABB2" }
- };
- const _hoisted_6$5 = { style: { "float": "left" } };
- const _sfc_main$9 = /* @__PURE__ */ defineComponent({
- props: {
- modelValue: { type: null, required: true },
- multiple: { type: Boolean, required: false, default: false },
- size: { type: String, required: true, default: () => "" },
- placeholder: { type: String, required: false, default: () => "\u8BF7\u9009\u62E9" },
- disabled: { type: Boolean, required: false, default: false },
- options: { type: Array, required: false, default: () => [] },
- clearable: { type: Boolean, required: false, default: true },
- width: { type: String, required: false, default: () => "100%" },
- url: { type: String, required: false, default: () => "" }
- },
- emits: ["change", "update:modelValue"],
- setup(__props, { emit }) {
- const props = __props;
- const personnelArray = ref([]);
- const { userInfo = {}, personnelList = [] } = JSON.parse(sessionStorage.getItem("storeInfo") || "{}");
- const textSize = ref({
- "small": { height: "20px", fontSize: "12px" },
- "default": { height: "28px", fontSize: "14px" },
- "": { height: "28px", fontSize: "14px" },
- "large": { height: "36px", fontSize: "14px" }
- });
- const selectLoading = ref(false);
- const controlTranslation = reactive({
- visibleFlag: false
- });
- const selectedValue = ref(props.modelValue);
- watch(() => props.modelValue, (newValue, _oldValue) => {
- if (newValue != selectedValue.value) {
- selectedValue.value = newValue;
- }
- });
- const getSelectedLabel = computed(() => {
- if (!props.multiple) {
- const item = getPersonnelListItems(selectedValue.value || props.modelValue);
- return item ? item.label : props.placeholder;
- }
- if (props.multiple) {
- if (Array.isArray(selectedValue.value)) {
- if (selectedValue.value.length <= 0) {
- return props.placeholder;
- }
- const item = getPersonnelListItems(selectedValue.value || props.modelValue);
- return item ? item.label : props.placeholder;
- } else {
- return props.placeholder;
- }
- }
- return props.placeholder;
- });
- function tagClose(_evt) {
- if (Array.isArray(selectedValue.value)) {
- selectedValue.value.shift();
- updateValue(selectedValue.value);
- }
- }
- function getPersonnelListItems(val) {
- let value = val;
- if (Array.isArray(val) && val.length > 0) {
- value = val[0];
- }
- return personnelList.find((item) => item.value == value);
- }
- function getUserList(keyword = "") {
- newPost(props.url, keyword).then((res) => {
- personnelArray.value = res || [];
- }).finally(() => {
- selectLoading.value = false;
- });
- }
- function newPost(url2, keyword) {
- return new Promise((resolve, reject) => {
- const token = sessionStorage.getItem("token");
- if (!token) {
- reject(new Error("Token is missing"));
- return;
- }
- const body = new URLSearchParams();
- body.append("keyword", keyword);
- fetch(url2, {
- method: "POST",
- headers: {
- "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
- "Token": token
- },
- body: body.toString()
- }).then((resp) => {
- if (!resp.ok) {
- reject(new Error(`Error: ${resp.statusText}`));
- }
- return resp.json();
- }).then((json) => {
- const res = json.data;
- if (Array.isArray(res)) {
- const personnelArray2 = res.map((data2) => ({
- label: data2["label"],
- value: data2["value"]
- }));
- resolve(personnelArray2);
- } else {
- reject(new Error("Invalid data format"));
- }
- }).catch((error) => {
- reject(error);
- });
- });
- }
- function visibleChange(visible) {
- if (visible) {
- personnelArray.value = personnelList;
- }
- controlTranslation.visibleFlag = visible;
- }
- const filterMethod = debounce2(filterMethods, 500);
- function filterMethods(val) {
- if (val == "") {
- personnelArray.value = personnelList;
- selectLoading.value = false;
- return personnelArray.value;
- }
- selectLoading.value = true;
- getUserList(val);
- }
- function updateValue(val) {
- emit("update:modelValue", selectedValue.value);
- emit("change", val);
- }
- function debounce2(func, delay) {
- let timer;
- return (...args) => {
- if (timer) {
- clearTimeout(timer);
- }
- timer = setTimeout(() => {
- func(...args);
- }, delay);
- };
- }
- onMounted(() => {
- if (personnelList.length == 0) {
- getUserList();
- } else {
- personnelArray.value = personnelList;
- }
- });
- return (_ctx, _cache) => {
- const _component_ww_open_data = resolveComponent("ww-open-data");
- const _component_el_tag = ElTag;
- const _component_el_option = ElOption;
- const _component_el_select = ElSelect;
- return openBlock(), createBlock(_component_el_select, {
- modelValue: selectedValue.value,
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => selectedValue.value = $event),
- multiple: __props.multiple,
- size: __props.size,
- loading: selectLoading.value,
- placeholder: __props.placeholder,
- disabled: __props.disabled,
- clearable: __props.clearable,
- filterable: "",
- "collapse-tags": "",
- style: normalizeStyle(`width: ${__props.width}`),
- class: normalizeClass(`custom-select-v2-reset ${!unref(controlTranslation).visibleFlag ? "setUpInputReset" : ""}`),
- onChange: updateValue,
- onVisibleChange: visibleChange,
- "filter-method": unref(filterMethod)
- }, createSlots({
- default: withCtx(() => [
- (openBlock(true), createElementBlock(Fragment, null, renderList(personnelArray.value || [], (item) => {
- return openBlock(), createBlock(_component_el_option, {
- key: item.value,
- label: item.label,
- value: item.value
- }, {
- default: withCtx(() => [
- createElementVNode("span", _hoisted_6$5, [
- createVNode(_component_ww_open_data, {
- type: "userName",
- openid: item.label
- }, null, 8, ["openid"])
- ])
- ]),
- _: 2
- }, 1032, ["label", "value"]);
- }), 128))
- ]),
- _: 2
- }, [
- !__props.multiple ? {
- name: "prefix",
- fn: withCtx(() => [
- createElementVNode("div", _hoisted_1$7, [
- !unref(controlTranslation).visibleFlag ? (openBlock(), createElementBlock("div", {
- key: 0,
- class: "selectSingleChoice",
- style: normalizeStyle(`line-height: ${textSize.value[__props.size].height};font-size:${textSize.value[__props.size].fontSize}`)
- }, [
- unref(getSelectedLabel) == __props.placeholder ? (openBlock(), createElementBlock("span", _hoisted_2$6, toDisplayString(__props.placeholder), 1)) : (openBlock(), createElementBlock("span", _hoisted_3$5, [
- createVNode(_component_ww_open_data, {
- type: "userName",
- openid: unref(getSelectedLabel)
- }, null, 8, ["openid"])
- ]))
- ], 4)) : createCommentVNode("", true)
- ])
- ])
- } : void 0,
- __props.multiple ? {
- name: "prefix",
- fn: withCtx(() => [
- createElementVNode("div", _hoisted_4$5, [
- createElementVNode("div", {
- class: "selectSingleChoice",
- style: normalizeStyle(`line-height: ${textSize.value[__props.size].height};font-size:${textSize.value[__props.size].fontSize}`)
- }, [
- unref(getSelectedLabel) == __props.placeholder ? (openBlock(), createElementBlock("span", _hoisted_5$5, toDisplayString(__props.placeholder), 1)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
- createVNode(_component_el_tag, {
- type: "info",
- size: __props.size,
- closable: "",
- onClose: tagClose,
- style: { "margin-right": "5px" }
- }, {
- default: withCtx(() => [
- createVNode(_component_ww_open_data, {
- type: "userName",
- openid: unref(getSelectedLabel)
- }, null, 8, ["openid"])
- ]),
- _: 1
- }, 8, ["size"]),
- selectedValue.value.length > 1 ? (openBlock(), createBlock(_component_el_tag, {
- key: 0,
- type: "info",
- size: __props.size
- }, {
- default: withCtx(() => [
- createTextVNode("+" + toDisplayString(selectedValue.value.length), 1)
- ]),
- _: 1
- }, 8, ["size"])) : createCommentVNode("", true)
- ], 64))
- ], 4)
- ])
- ])
- } : void 0
- ]), 1032, ["modelValue", "multiple", "size", "loading", "placeholder", "disabled", "clearable", "style", "class", "filter-method"]);
- };
- }
- });
- var GenerateFormItem_vue_vue_type_style_index_0_scoped_true_lang = "";
- var _export_sfc = (sfc, props) => {
- const target = sfc.__vccOpts || sfc;
- for (const [key, val] of props) {
- target[key] = val;
- }
- return target;
- };
- const _withScopeId = (n) => (pushScopeId("data-v-38ee7c8b"), n = n(), popScopeId(), n);
- const _hoisted_1$6 = { key: 12 };
- const _hoisted_2$5 = {
- key: 1,
- class: "custom:insert"
- };
- const _hoisted_3$4 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("i", { class: "custom:img-upload mr-2" }, null, -1));
- const _hoisted_4$4 = /* @__PURE__ */ createTextVNode("\u70B9\u51FB\u4E0A\u4F20 ");
- const _hoisted_5$4 = ["href"];
- const _hoisted_6$4 = /* @__PURE__ */ createTextVNode(" \u4E0B\u8F7D ");
- const _sfc_main$8 = /* @__PURE__ */ defineComponent({
- props: {
- config: null,
- element: null,
- model: null,
- updatedModel: null,
- disabled: { type: Boolean },
- request: null,
- widgetFormData: null
- },
- emits: ["updateWidgetForm"],
- setup(__props, { emit: emits }) {
- const props = __props;
- const { userInfo = {} } = JSON.parse(sessionStorage.getItem("storeInfo") || "{}");
- const originData = props.model[props.element.model];
- const data2 = computed({
- get: () => props.model[props.element.model],
- set: (val) => {
- props.model[props.element.model] = val;
- if (JSON.stringify(originData) === JSON.stringify(val)) {
- Reflect.deleteProperty(props.updatedModel, props.element.model);
- } else {
- props.updatedModel[props.element.model] = val;
- }
- }
- });
- const handleUploadSuccess = (_res, _file, fileList) => {
- data2.value = fileList;
- };
- async function download(defaultValue, label) {
- const a2 = document.createElement("a");
- if (!props.request)
- return;
- a2.href = await props.request({
- url: `/sys/common/static/${defaultValue}`,
- responseType: "blob"
- }).then((i) => {
- if (i.size === 0)
- return "";
- return URL.createObjectURL(i);
- });
- a2.download = `${label}.${defaultValue.split(".")[1]}`;
- a2.click();
- }
- const specializedHandleSelect = (val, element) => {
- const field = element.model;
- if (field == "customerId") {
- let list = JSON.parse(JSON.stringify(props.widgetFormData));
- for (var i in list) {
- if (list[i].list[0].model == "contactsId") {
- let item = list[i].list[0];
- const token = sessionStorage.getItem("token");
- fetch(`${item.options.remoteFunc}?customerId=${val}`, {
- headers: {
- "Content-type": " application/x-www-form-urlencoded; charset=UTF-8",
- "Token": token
- }
- }).then((resp) => resp.json()).then((json) => {
- const res = json.data;
- if (res instanceof Array) {
- item.options.remoteOptions = res.map((data22) => ({
- label: data22[item.options.props.label],
- value: data22[item.options.props.value],
- children: data22[item.options.props.children]
- }));
- }
- list[i].list[0].options = __spreadProps(__spreadValues({}, list[i].list[0].options), { disabled: false, defaultValue: "" });
- });
- }
- }
- setTimeout(() => {
- console.log("\u5F00\u59CB\u6267\u884C");
- updateWidgetForm(list);
- }, 100);
- }
- };
- const updateWidgetForm = (list) => {
- emits("updateWidgetForm", list);
- };
- return (_ctx, _cache) => {
- const _component_GenerateFormItem = resolveComponent("GenerateFormItem", true);
- const _component_el_table_column = ElTableColumn;
- const _component_el_table = ElTable;
- const _component_el_divider = ElDivider;
- const _component_el_input = ElInput;
- const _component_el_input_number = ElInputNumber;
- const _component_el_radio = ElRadio;
- const _component_el_radio_group = ElRadioGroup;
- const _component_el_checkbox = ElCheckbox;
- const _component_el_checkbox_group = ElCheckboxGroup$1;
- const _component_el_time_picker = ElTimePicker;
- const _component_el_config_provider = ElConfigProvider;
- const _component_el_date_picker = ElDatePicker;
- const _component_el_rate = ElRate;
- const _component_el_option = ElOption;
- const _component_el_select = ElSelect;
- const _component_el_switch = ElSwitch;
- const _component_el_slider = ElSlider;
- const _component_el_image = ElImage;
- const _component_el_button = ElButton;
- const _component_el_upload = ElUpload;
- const _component_el_cascader = ElCascader;
- const _component_el_form_item = ElFormItem;
- return __props.element.type === "grid" ? (openBlock(), createElementBlock("div", {
- key: 0,
- grid: "~ cols-24",
- style: normalizeStyle(`gap: ${__props.element.options.gutter}px; align-items: ${__props.element.options.align};`)
- }, [
- (openBlock(true), createElementBlock(Fragment, null, renderList(__props.element.columns, (col, colIndex) => {
- return openBlock(), createElementBlock("div", {
- key: colIndex,
- style: normalizeStyle(`grid-column: span ${col.span}`)
- }, [
- (openBlock(true), createElementBlock(Fragment, null, renderList(col.list, (colItem) => {
- return openBlock(), createBlock(_component_GenerateFormItem, {
- key: colItem.key,
- request: __props.request,
- model: __props.model,
- "updated-model": __props.updatedModel,
- element: colItem,
- config: __props.config,
- disabled: __props.disabled,
- widgetFormData: __props.element.columns,
- onUpdateWidgetForm: updateWidgetForm
- }, null, 8, ["request", "model", "updated-model", "element", "config", "disabled", "widgetFormData"]);
- }), 128))
- ], 4);
- }), 128))
- ], 4)) : __props.element.type === "table" ? (openBlock(), createBlock(_component_el_table, {
- key: 1,
- border: "",
- class: "mb-4.5",
- data: __props.element.options.defaultValue
- }, {
- default: withCtx(() => [
- (openBlock(true), createElementBlock(Fragment, null, renderList(__props.element.columns, (i) => {
- return openBlock(), createBlock(_component_el_table_column, mergeProps({
- key: i.prop,
- align: __props.element.options.align
- }, i), null, 16, ["align"]);
- }), 128))
- ]),
- _: 1
- }, 8, ["data"])) : __props.element.type === "divider" ? (openBlock(), createBlock(_component_el_divider, {
- key: 2,
- data: __props.element.options.defaultValue,
- "content-position": "left"
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(__props.element.label), 1)
- ]),
- _: 1
- }, 8, ["data"])) : __props.element ? (openBlock(), createBlock(_component_el_form_item, {
- key: __props.element.key,
- label: __props.element.label,
- prop: __props.element.model,
- style: normalizeStyle(__props.element.type === "download" ? "display:inline-flex;margin-right:40px" : ""),
- "label-width": __props.element.labelWidth
- }, createSlots({
- default: withCtx(() => [
- __props.element.type === "input" ? (openBlock(), createBlock(_component_el_input, {
- key: 0,
- modelValue: unref(data2),
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(data2) ? data2.value = $event : null),
- modelModifiers: { trim: true },
- style: normalizeStyle({ width: __props.element.options.width }),
- placeholder: __props.element.options.placeholder,
- maxlength: parseInt(__props.element.options.maxlength),
- clearable: __props.element.options.clearable,
- readonly: __props.element.options.readonly,
- disabled: __props.disabled || __props.element.options.disabled
- }, createSlots({ _: 2 }, [
- __props.element.options.prefix ? {
- name: "prefix",
- fn: withCtx(() => [
- createTextVNode(toDisplayString(__props.element.options.prefix), 1)
- ])
- } : void 0,
- __props.element.options.suffix ? {
- name: "suffix",
- fn: withCtx(() => [
- createTextVNode(toDisplayString(__props.element.options.suffix), 1)
- ])
- } : void 0,
- __props.element.options.prepend ? {
- name: "prepend",
- fn: withCtx(() => [
- createTextVNode(toDisplayString(__props.element.options.prepend), 1)
- ])
- } : void 0,
- __props.element.options.append ? {
- name: "append",
- fn: withCtx(() => [
- createTextVNode(toDisplayString(__props.element.options.append), 1)
- ])
- } : void 0
- ]), 1032, ["modelValue", "style", "placeholder", "maxlength", "clearable", "readonly", "disabled"])) : createCommentVNode("", true),
- __props.element.type === "password" ? (openBlock(), createBlock(_component_el_input, {
- key: 1,
- modelValue: unref(data2),
- "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => isRef(data2) ? data2.value = $event : null),
- modelModifiers: { trim: true },
- style: normalizeStyle({ width: __props.element.options.width }),
- placeholder: __props.element.options.placeholder,
- maxlength: parseInt(__props.element.options.maxlength),
- clearable: __props.element.options.clearable,
- disabled: __props.disabled || __props.element.options.disabled,
- readonly: __props.element.options.readonly,
- "show-password": __props.element.options.showPassword
- }, createSlots({ _: 2 }, [
- __props.element.options.prefix ? {
- name: "prefix",
- fn: withCtx(() => [
- createTextVNode(toDisplayString(__props.element.options.prefix), 1)
- ])
- } : void 0,
- __props.element.options.suffix ? {
- name: "suffix",
- fn: withCtx(() => [
- createTextVNode(toDisplayString(__props.element.options.suffix), 1)
- ])
- } : void 0,
- __props.element.options.prepend ? {
- name: "prepend",
- fn: withCtx(() => [
- createTextVNode(toDisplayString(__props.element.options.prepend), 1)
- ])
- } : void 0,
- __props.element.options.append ? {
- name: "append",
- fn: withCtx(() => [
- createTextVNode(toDisplayString(__props.element.options.append), 1)
- ])
- } : void 0
- ]), 1032, ["modelValue", "style", "placeholder", "maxlength", "clearable", "disabled", "readonly", "show-password"])) : createCommentVNode("", true),
- __props.element.type === "textarea" ? (openBlock(), createBlock(_component_el_input, {
- key: 2,
- modelValue: unref(data2),
- "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => isRef(data2) ? data2.value = $event : null),
- modelModifiers: { trim: true },
- type: "textarea",
- resize: "none",
- rows: __props.element.options.rows,
- style: normalizeStyle({ width: __props.element.options.width }),
- placeholder: __props.element.options.placeholder,
- maxlength: parseInt(__props.element.options.maxlength),
- "show-word-limit": __props.element.options.showWordLimit,
- autosize: __props.element.options.autosize,
- clearable: __props.element.options.clearable,
- readonly: __props.element.options.readonly,
- disabled: __props.disabled || __props.element.options.disabled
- }, null, 8, ["modelValue", "rows", "style", "placeholder", "maxlength", "show-word-limit", "autosize", "clearable", "readonly", "disabled"])) : createCommentVNode("", true),
- __props.element.type === "number" ? (openBlock(), createBlock(_component_el_input_number, {
- key: 3,
- modelValue: unref(data2),
- "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => isRef(data2) ? data2.value = $event : null),
- style: normalizeStyle({ width: __props.element.options.width }),
- max: __props.element.options.max,
- min: __props.element.options.min,
- disabled: __props.disabled || __props.element.options.disabled,
- "controls-position": "right"
- }, null, 8, ["modelValue", "style", "max", "min", "disabled"])) : createCommentVNode("", true),
- __props.element.type === "radio" ? (openBlock(), createBlock(_component_el_radio_group, {
- key: 4,
- modelValue: unref(data2),
- "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => isRef(data2) ? data2.value = $event : null),
- style: normalizeStyle({ width: __props.element.options.width }),
- disabled: __props.disabled || __props.element.options.disabled
- }, {
- default: withCtx(() => [
- (openBlock(true), createElementBlock(Fragment, null, renderList(__props.element.options.remote ? __props.element.options.remoteOptions : __props.element.options.options, (item) => {
- return openBlock(), createBlock(_component_el_radio, {
- key: item.value,
- label: item.value,
- style: normalizeStyle({
- display: __props.element.options.inline ? "inline-block" : "block"
- })
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(__props.element.options.showLabel ? item.label : item.value), 1)
- ]),
- _: 2
- }, 1032, ["label", "style"]);
- }), 128))
- ]),
- _: 1
- }, 8, ["modelValue", "style", "disabled"])) : createCommentVNode("", true),
- __props.element.type === "checkbox" ? (openBlock(), createBlock(_component_el_checkbox_group, {
- key: 5,
- modelValue: unref(data2),
- "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => isRef(data2) ? data2.value = $event : null),
- style: normalizeStyle({ width: __props.element.options.width }),
- disabled: __props.disabled || __props.element.options.disabled
- }, {
- default: withCtx(() => [
- (openBlock(true), createElementBlock(Fragment, null, renderList(__props.element.options.remote ? __props.element.options.remoteOptions : __props.element.options.options, (item) => {
- return openBlock(), createBlock(_component_el_checkbox, {
- key: item.value,
- label: item.value,
- style: normalizeStyle({
- display: __props.element.options.inline ? "inline-block" : "block"
- })
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(__props.element.options.showLabel ? item.label : item.value), 1)
- ]),
- _: 2
- }, 1032, ["label", "style"]);
- }), 128))
- ]),
- _: 1
- }, 8, ["modelValue", "style", "disabled"])) : createCommentVNode("", true),
- __props.element.type === "time" ? (openBlock(), createBlock(_component_el_config_provider, {
- key: 6,
- locale: unref(zhCn)
- }, {
- default: withCtx(() => [
- createVNode(_component_el_time_picker, {
- modelValue: unref(data2),
- "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => isRef(data2) ? data2.value = $event : null),
- placeholder: __props.element.options.placeholder,
- readonly: __props.element.options.readonly,
- editable: __props.element.options.editable,
- clearable: __props.element.options.clearable,
- format: __props.element.options.format,
- disabled: __props.disabled || __props.element.options.disabled,
- style: normalizeStyle({ width: __props.element.options.width })
- }, null, 8, ["modelValue", "placeholder", "readonly", "editable", "clearable", "format", "disabled", "style"])
- ]),
- _: 1
- }, 8, ["locale"])) : createCommentVNode("", true),
- __props.element.type === "date" ? (openBlock(), createBlock(_component_el_config_provider, {
- key: 7,
- locale: unref(zhCn)
- }, {
- default: withCtx(() => [
- createVNode(_component_el_date_picker, {
- modelValue: unref(data2),
- "onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => isRef(data2) ? data2.value = $event : null),
- placeholder: __props.element.options.placeholder,
- readonly: __props.element.options.readonly,
- editable: __props.element.options.editable,
- clearable: __props.element.options.clearable,
- format: __props.element.options.format,
- disabled: __props.disabled || __props.element.options.disabled,
- style: normalizeStyle({ width: __props.element.options.width })
- }, null, 8, ["modelValue", "placeholder", "readonly", "editable", "clearable", "format", "disabled", "style"])
- ]),
- _: 1
- }, 8, ["locale"])) : createCommentVNode("", true),
- __props.element.type === "rate" ? (openBlock(), createBlock(_component_el_rate, {
- key: 8,
- modelValue: unref(data2),
- "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => isRef(data2) ? data2.value = $event : null),
- max: __props.element.options.max,
- "allow-half": __props.element.options.allowHalf,
- disabled: __props.disabled || __props.element.options.disabled
- }, null, 8, ["modelValue", "max", "allow-half", "disabled"])) : createCommentVNode("", true),
- __props.element.type === "select" ? (openBlock(), createElementBlock(Fragment, { key: 9 }, [
- unref(userInfo).userNameNeedTranslate == 1 && __props.element.options.remoteFunc.indexOf("getSimpleActiveUserListNew") > -1 ? (openBlock(), createBlock(_sfc_main$9, {
- key: 0,
- modelValue: unref(data2),
- "onUpdate:modelValue": _cache[9] || (_cache[9] = ($event) => isRef(data2) ? data2.value = $event : null),
- multiple: __props.element.options.multiple,
- placeholder: __props.element.options.placeholder,
- clearable: __props.element.options.clearable,
- filterable: __props.element.options.filterable,
- disabled: __props.disabled || __props.element.options.disabled,
- url: __props.element.options.remoteFunc,
- size: __props.config.size,
- options: [],
- style: normalizeStyle({ width: __props.element.options.width }),
- onChange: _cache[10] || (_cache[10] = (value) => specializedHandleSelect(value, __props.element))
- }, null, 8, ["modelValue", "multiple", "placeholder", "clearable", "filterable", "disabled", "url", "size", "style"])) : (openBlock(), createBlock(_component_el_select, {
- key: 1,
- modelValue: unref(data2),
- "onUpdate:modelValue": _cache[11] || (_cache[11] = ($event) => isRef(data2) ? data2.value = $event : null),
- multiple: __props.element.options.multiple,
- placeholder: __props.element.options.placeholder,
- clearable: __props.element.options.clearable,
- filterable: __props.element.options.filterable,
- disabled: __props.disabled || __props.element.options.disabled,
- style: normalizeStyle({ width: __props.element.options.width }),
- onChange: _cache[12] || (_cache[12] = (value) => specializedHandleSelect(value, __props.element))
- }, {
- default: withCtx(() => [
- (openBlock(true), createElementBlock(Fragment, null, renderList(__props.element.options.remote ? __props.element.options.remoteOptions : __props.element.options.options, (item) => {
- return openBlock(), createBlock(_component_el_option, {
- key: item.value,
- value: item.value,
- label: __props.element.options.showLabel ? item.label : item.value
- }, null, 8, ["value", "label"]);
- }), 128))
- ]),
- _: 1
- }, 8, ["modelValue", "multiple", "placeholder", "clearable", "filterable", "disabled", "style"]))
- ], 64)) : createCommentVNode("", true),
- __props.element.type === "switch" ? (openBlock(), createBlock(_component_el_switch, {
- key: 10,
- modelValue: unref(data2),
- "onUpdate:modelValue": _cache[13] || (_cache[13] = ($event) => isRef(data2) ? data2.value = $event : null),
- "active-text": __props.element.options.activeText,
- "inactive-text": __props.element.options.inactiveText,
- disabled: __props.disabled || __props.element.options.disabled
- }, null, 8, ["modelValue", "active-text", "inactive-text", "disabled"])) : createCommentVNode("", true),
- __props.element.type === "slider" ? (openBlock(), createBlock(_component_el_slider, {
- key: 11,
- modelValue: unref(data2),
- "onUpdate:modelValue": _cache[14] || (_cache[14] = ($event) => isRef(data2) ? data2.value = $event : null),
- min: __props.element.options.min,
- max: __props.element.options.max,
- step: __props.element.options.step,
- range: __props.element.options.range,
- disabled: __props.disabled || __props.element.options.disabled,
- style: normalizeStyle({ width: __props.element.options.width })
- }, null, 8, ["modelValue", "min", "max", "step", "range", "disabled", "style"])) : createCommentVNode("", true),
- __props.element.type == "text" ? (openBlock(), createElementBlock("span", _hoisted_1$6, toDisplayString(__props.element.options.defaultValue), 1)) : createCommentVNode("", true),
- __props.element.type === "img-upload" ? (openBlock(), createBlock(_component_el_upload, {
- key: 13,
- name: __props.element.options.file,
- action: __props.element.options.action,
- accept: __props.element.options.accept,
- "list-type": __props.element.options.listType,
- multiple: __props.element.options.multiple,
- limit: __props.element.options.limit,
- disabled: __props.disabled || __props.element.options.disabled,
- "on-success": handleUploadSuccess
- }, {
- default: withCtx(() => {
- var _a2;
- return [
- __props.element.options.listType === "picture-card" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
- ((_a2 = __props.element.options.defaultValue) == null ? void 0 : _a2.length) ? (openBlock(), createBlock(_component_el_image, {
- key: 0,
- style: { "width": "100%", "height": "100%" },
- "preview-src-list": [
- "/api/sys/common/static/" + __props.element.options.defaultValue
- ],
- src: "/api/sys/common/static/" + __props.element.options.defaultValue
- }, null, 8, ["preview-src-list", "src"])) : (openBlock(), createElementBlock("i", _hoisted_2$5))
- ], 64)) : (openBlock(), createBlock(_component_el_button, { key: 1 }, {
- default: withCtx(() => [
- _hoisted_3$4,
- _hoisted_4$4
- ]),
- _: 1
- }))
- ];
- }),
- _: 1
- }, 8, ["name", "action", "accept", "list-type", "multiple", "limit", "disabled"])) : createCommentVNode("", true),
- __props.element.type === "download" ? (openBlock(), createBlock(_component_el_button, {
- key: 14,
- style: { "margin-top": "-4px" },
- type: "text",
- onClick: _cache[15] || (_cache[15] = ($event) => download(__props.element.options.defaultValue, __props.element.label))
- }, {
- default: withCtx(() => [
- _hoisted_6$4
- ]),
- _: 1
- })) : createCommentVNode("", true),
- __props.element.type === "cascader" ? (openBlock(), createBlock(_component_el_cascader, {
- key: 15,
- modelValue: unref(data2),
- "onUpdate:modelValue": _cache[16] || (_cache[16] = ($event) => isRef(data2) ? data2.value = $event : null),
- options: __props.element.options.remoteOptions,
- placeholder: __props.element.options.placeholder,
- filterable: __props.element.options.filterable,
- clearable: __props.element.options.clearable,
- disabled: __props.disabled || __props.element.options.disabled,
- style: normalizeStyle({ width: __props.element.options.width })
- }, null, 8, ["modelValue", "options", "placeholder", "filterable", "clearable", "disabled", "style"])) : createCommentVNode("", true)
- ]),
- _: 2
- }, [
- __props.element.type === "download" ? {
- name: "label",
- fn: withCtx(({ label }) => [
- createElementVNode("a", {
- href: `/api/sys/common/static/${__props.element.options.defaultValue}?inline=1`,
- style: { "color": "#606266" },
- target: "_blank"
- }, toDisplayString(label), 9, _hoisted_5$4)
- ])
- } : void 0
- ]), 1032, ["label", "prop", "style", "label-width"])) : createCommentVNode("", true);
- };
- }
- });
- var GenerateFormItem = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-38ee7c8b"]]);
- const _sfc_main$7 = defineComponent({
- name: "FormGenerate",
- components: {
- GenerateFormItem
- },
- props: {
- data: {
- type: Object,
- default: getWidgetForm()
- },
- value: {
- type: Object
- },
- disabled: {
- type: Boolean,
- default: false
- },
- request: {
- type: Function
- }
- },
- setup(props) {
- var _a2;
- const state = reactive({
- generateForm: null,
- model: {},
- updatedModel: {},
- rules: {},
- widgetForm: (_a2 = props.data && JSON.parse(JSON.stringify(props.data))) != null ? _a2 : getWidgetForm()
- });
- const generateModel = (list) => {
- for (let index = 0; index < list.length; index++) {
- const model = list[index].model;
- if (!model)
- return;
- if (list[index].type === "grid") {
- list[index].columns.forEach((col) => generateModel(col.list));
- } else {
- if (props.value && Object.keys(props.value).includes(model))
- state.model[model] = props.value[model];
- else
- state.model[model] = list[index].options.defaultValue;
- state.rules[model] = list[index].options.rules;
- }
- }
- };
- const generateOptions = (list) => {
- list.forEach(async (item) => {
- if (item.type === "grid") {
- item.columns.forEach((col) => generateOptions(col.list));
- } else {
- if (item.options.remote && item.options.remoteFunc) {
- if (props.request) {
- const { data: data2 } = await props.request({
- url: item.options.remoteFunc
- });
- item.options.remoteOptions = data2.map((i) => ({
- label: i[item.options.props.label],
- value: i[item.options.props.value],
- children: i[item.options.props.children]
- }));
- return;
- }
- const token = sessionStorage.getItem("token");
- fetch(item.options.remoteFunc, {
- headers: {
- "Content-type": " application/x-www-form-urlencoded; charset=UTF-8",
- "Token": token
- }
- }).then((resp) => resp.json()).then((json) => {
- const res = json.data;
- if (res instanceof Array) {
- item.options.remoteOptions = res.map((data2) => ({
- label: data2[item.options.props.label],
- value: data2[item.options.props.value],
- children: data2[item.options.props.children]
- }));
- }
- });
- }
- }
- });
- };
- const updateWidgetForm = (list) => {
- const listIndex2 = state.widgetForm.list.findIndex((item) => item.type === "grid");
- state.widgetForm.list[listIndex2].columns = list;
- state.model = __spreadProps(__spreadValues({}, state.model), { contactsId: "" });
- };
- watch(() => props.data, (val) => {
- var _a3;
- state.widgetForm = (_a3 = val && JSON.parse(JSON.stringify(val))) != null ? _a3 : getWidgetForm();
- state.model = {};
- state.rules = {};
- generateModel(state.widgetForm.list);
- generateOptions(state.widgetForm.list);
- }, { deep: true, immediate: true });
- const getData = () => {
- return new Promise((resolve, reject) => {
- state.generateForm.validate().then((validate) => {
- if (validate)
- resolve(state.updatedModel);
- else
- ElMessage.error("\u9A8C\u8BC1\u5931\u8D25");
- }).catch((error) => {
- reject(error);
- });
- });
- };
- const reset = () => {
- state.generateForm.resetFields();
- };
- return __spreadProps(__spreadValues({}, toRefs(state)), {
- getData,
- reset,
- updateWidgetForm
- });
- }
- });
- function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
- const _component_GenerateFormItem = resolveComponent("GenerateFormItem");
- const _component_el_form = ElForm;
- return openBlock(), createBlock(_component_el_form, {
- ref: "generateForm",
- "label-suffix": ":",
- model: _ctx.model,
- rules: _ctx.rules,
- size: _ctx.widgetForm.config.size,
- "label-position": _ctx.widgetForm.config.labelPosition,
- "label-width": `${_ctx.widgetForm.config.labelWidth}px`,
- "hide-required-asterisk": _ctx.widgetForm.config.hideRequiredAsterisk
- }, {
- default: withCtx(() => [
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.widgetForm.list, (element, index) => {
- return openBlock(), createBlock(_component_GenerateFormItem, {
- key: element.key,
- model: _ctx.model,
- "updated-model": _ctx.updatedModel,
- element: _ctx.widgetForm.list[index],
- config: _ctx.data.config,
- disabled: _ctx.disabled,
- request: _ctx.request,
- widgetFormData: _ctx.widgetForm.list,
- onUpdateWidgetForm: _ctx.updateWidgetForm
- }, null, 8, ["model", "updated-model", "element", "config", "disabled", "request", "widgetFormData", "onUpdateWidgetForm"]);
- }), 128))
- ]),
- _: 1
- }, 8, ["model", "rules", "size", "label-position", "label-width", "hide-required-asterisk"]);
- }
- var GenerateForm = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["render", _sfc_render$1]]);
- const _hoisted_1$5 = { class: "px-3 py-2 text-sm text-gray-700" };
- const _hoisted_2$4 = {
- key: 0,
- 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"
- };
- let listIndex = 1;
- function setListIndex(list) {
- if (list.list.length > 0) {
- const array4 = list.list.map((item) => item.model);
- const plateNumbers = array4.filter((item) => item.includes("plate")).map((item) => {
- const match = item.match(/plate(\d+)/);
- return match ? match[1] : null;
- });
- listIndex = findMissingPositive(plateNumbers);
- }
- }
- function cloneWidget(params) {
- const key = Math.random().toString(36).substring(2, 9);
- params = cloneDeep(__spreadProps(__spreadValues({}, params), {
- key,
- model: `plate${listIndex}`
- }));
- if (params.type === "grid") {
- params.columns.forEach((i) => {
- i.list = i.list.map(cloneWidget);
- });
- }
- return params;
- }
- function findMissingPositive(nums) {
- let numbers = nums.map(Number);
- numbers.sort((a2, b2) => a2 - b2);
- let missing = 1;
- for (let i = 0; i < numbers.length; i++) {
- if (numbers[i] === missing) {
- missing++;
- }
- }
- return missing;
- }
- const _sfc_main$6 = /* @__PURE__ */ defineComponent({
- props: {
- fields: null,
- title: null,
- list: null,
- allList: null
- },
- setup(__props) {
- const props = __props;
- let moveFlag = ref(false);
- const moveStart = () => {
- const array4 = props.allList.list.map((item) => item.model);
- const plateNumbers = array4.filter((item) => item.includes("plate")).map((item) => {
- const match = item.match(/plate(\d+)/);
- return match ? match[1] : null;
- });
- const flag = plateNumbers.length < 5;
- if (!flag && !moveFlag.value) {
- moveFlag.value = true;
- ElMessage.warning("\u6700\u591A\u6DFB\u52A0\u4E94\u4E2A");
- return false;
- }
- return flag;
- };
- const stopMove = () => {
- moveFlag.value = false;
- };
- return (_ctx, _cache) => {
- return openBlock(), createElementBlock(Fragment, null, [
- createElementVNode("div", _hoisted_1$5, toDisplayString(__props.title), 1),
- createVNode(unref(Draggable), {
- tag: "ul",
- class: "m-0 p-3 pt-0 grid grid-cols-2 gap-1",
- "item-key": "type",
- group: { name: "form-design", pull: "clone", put: false },
- clone: cloneWidget,
- sort: false,
- list: __props.list,
- allList: __props.allList,
- move: moveStart,
- choose: setListIndex(__props.allList),
- onAdd: _cache[0] || (_cache[0] = ($event) => stopMove())
- }, {
- item: withCtx(({ element }) => [
- __props.fields.includes(element.type) ? (openBlock(), createElementBlock("li", _hoisted_2$4, [
- createElementVNode("i", {
- class: normalizeClass(["custom:" + element.type, "ml-2 mr-1"])
- }, null, 2),
- createElementVNode("span", null, toDisplayString(element.label), 1)
- ])) : createCommentVNode("", true)
- ]),
- _: 1
- }, 8, ["list", "allList", "choose"])
- ], 64);
- };
- }
- });
- const _hoisted_1$4 = { key: 12 };
- const _hoisted_2$3 = {
- key: 1,
- class: "custom:insert"
- };
- const _hoisted_3$3 = /* @__PURE__ */ createElementVNode("i", {
- "icon-class": "custom:img-upload",
- style: { "margin-right": "10px" }
- }, null, -1);
- const _hoisted_4$3 = /* @__PURE__ */ createTextVNode(" \u70B9\u51FB\u4E0A\u4F20 ");
- const _hoisted_5$3 = /* @__PURE__ */ createTextVNode(" \u4E0B\u8F7D ");
- const _hoisted_6$3 = /* @__PURE__ */ createElementVNode("i", {
- class: "eva:move-outline",
- "text-lg": ""
- }, null, -1);
- const _hoisted_7$2 = [
- _hoisted_6$3
- ];
- const _sfc_main$5 = /* @__PURE__ */ defineComponent({
- props: {
- list: null,
- element: null,
- index: null,
- selectWidget: null,
- configurationItems: null
- },
- emits: ["itemClick", "delete", "update:selectWidget"],
- setup(__props) {
- const props = createPropsRestProxy(__props, ["element", "index", "list"]);
- let selectWidget = useVModel(props, "selectWidget");
- const { userInfo = {} } = JSON.parse(sessionStorage.getItem("storeInfo") || "{}");
- const handleDeleteClick = () => {
- __props.list.splice(__props.index, 1);
- selectWidget.value = __props.list[__props.list.length === __props.index ? __props.index - 1 : __props.index];
- };
- return (_ctx, _cache) => {
- var _a2, _b2;
- const _component_WidgetFormItem = resolveComponent("WidgetFormItem", true);
- const _component_el_table_column = ElTableColumn;
- const _component_el_table = ElTable;
- const _component_el_divider = ElDivider;
- const _component_el_input = ElInput;
- const _component_el_input_number = ElInputNumber;
- const _component_el_radio = ElRadio;
- const _component_el_radio_group = ElRadioGroup;
- const _component_el_checkbox = ElCheckbox;
- const _component_el_checkbox_group = ElCheckboxGroup$1;
- const _component_el_time_picker = ElTimePicker;
- const _component_el_date_picker = ElDatePicker;
- const _component_el_rate = ElRate;
- const _component_el_option = ElOption;
- const _component_el_select = ElSelect;
- const _component_el_switch = ElSwitch;
- const _component_el_slider = ElSlider;
- const _component_el_image = ElImage;
- const _component_el_button = ElButton;
- const _component_el_upload = ElUpload;
- const _component_el_cascader = ElCascader;
- const _component_el_form_item = ElFormItem;
- return openBlock(), createElementBlock("div", {
- class: normalizeClass(["widget-view", { active: ((_a2 = selectWidget.value) == null ? void 0 : _a2.key) === __props.element.key, col: __props.element.type === "grid" }]),
- style: normalizeStyle(__props.element.type === "grid" ? `gap: ${__props.element.options.gutter}px; align-items: ${__props.element.options.align};` : ""),
- onClick: _cache[3] || (_cache[3] = withModifiers(($event) => selectWidget.value = __props.element, ["stop"]))
- }, [
- __props.element.type === "grid" ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(__props.element.columns, (col, key) => {
- return openBlock(), createBlock(unref(Draggable), {
- key,
- class: "bg-white min-h-12 border border-dashed border-gray-300",
- style: normalizeStyle(`grid-column: span ${col.span}`),
- "item-key": "key",
- handle: "[cursor-move]",
- animation: 200,
- group: "form-design",
- "no-transition-on-drag": true,
- list: col.list,
- onAdd: ($event) => selectWidget.value = col.list[$event.newIndex]
- }, {
- item: withCtx(({ element: colElement, index: colIndex }) => [
- createVNode(_component_WidgetFormItem, {
- selectWidget: selectWidget.value,
- "onUpdate:selectWidget": _cache[0] || (_cache[0] = ($event) => selectWidget.value = $event),
- element: colElement,
- list: col.list,
- index: colIndex,
- configurationItems: __props.configurationItems
- }, null, 8, ["selectWidget", "element", "list", "index", "configurationItems"])
- ]),
- _: 2
- }, 1032, ["style", "list", "onAdd"]);
- }), 128)) : __props.element.type === "table" ? (openBlock(), createBlock(_component_el_table, {
- key: 1,
- class: "w-0 flex-1",
- border: "",
- data: __props.element.options.defaultValue
- }, {
- default: withCtx(() => [
- (openBlock(true), createElementBlock(Fragment, null, renderList(__props.element.columns, (i) => {
- return openBlock(), createBlock(_component_el_table_column, mergeProps({
- key: i.prop,
- "header-align": __props.element.options.align,
- align: __props.element.options.align
- }, i), null, 16, ["header-align", "align"]);
- }), 128))
- ]),
- _: 1
- }, 8, ["data"])) : __props.element.type === "divider" ? (openBlock(), createBlock(_component_el_divider, {
- key: 2,
- class: "pb-0",
- data: __props.element.options.defaultValue,
- "content-position": "left"
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(__props.element.label), 1)
- ]),
- _: 1
- }, 8, ["data"])) : __props.element ? (openBlock(), createBlock(_component_el_form_item, {
- key: __props.element.key,
- label: __props.element.label,
- "label-width": __props.element.labelWidth,
- rules: __props.element.options.rules
- }, {
- default: withCtx(() => [
- __props.element.type === "input" ? (openBlock(), createBlock(_component_el_input, {
- key: 0,
- readonly: "",
- "model-value": __props.element.options.defaultValue,
- style: normalizeStyle({ width: __props.element.options.width }),
- placeholder: __props.element.options.placeholder,
- maxlength: parseInt(__props.element.options.maxlength),
- clearable: __props.element.options.clearable,
- disabled: __props.element.options.disabled
- }, createSlots({ _: 2 }, [
- __props.element.options.prefix ? {
- name: "prefix",
- fn: withCtx(() => [
- createTextVNode(toDisplayString(__props.element.options.prefix), 1)
- ])
- } : void 0,
- __props.element.options.suffix ? {
- name: "suffix",
- fn: withCtx(() => [
- createTextVNode(toDisplayString(__props.element.options.suffix), 1)
- ])
- } : void 0,
- __props.element.options.prepend ? {
- name: "prepend",
- fn: withCtx(() => [
- createTextVNode(toDisplayString(__props.element.options.prepend), 1)
- ])
- } : void 0,
- __props.element.options.append ? {
- name: "append",
- fn: withCtx(() => [
- createTextVNode(toDisplayString(__props.element.options.append), 1)
- ])
- } : void 0
- ]), 1032, ["model-value", "style", "placeholder", "maxlength", "clearable", "disabled"])) : createCommentVNode("", true),
- __props.element.type === "password" ? (openBlock(), createBlock(_component_el_input, {
- key: 1,
- readonly: "",
- "model-value": __props.element.options.defaultValue,
- style: normalizeStyle({ width: __props.element.options.width }),
- placeholder: __props.element.options.placeholder,
- maxlength: parseInt(__props.element.options.maxlength),
- clearable: __props.element.options.clearable,
- disabled: __props.element.options.disabled,
- "show-password": __props.element.options.showPassword
- }, createSlots({ _: 2 }, [
- __props.element.options.prefix ? {
- name: "prefix",
- fn: withCtx(() => [
- createTextVNode(toDisplayString(__props.element.options.prefix), 1)
- ])
- } : void 0,
- __props.element.options.suffix ? {
- name: "suffix",
- fn: withCtx(() => [
- createTextVNode(toDisplayString(__props.element.options.suffix), 1)
- ])
- } : void 0,
- __props.element.options.prepend ? {
- name: "prepend",
- fn: withCtx(() => [
- createTextVNode(toDisplayString(__props.element.options.prepend), 1)
- ])
- } : void 0,
- __props.element.options.append ? {
- name: "append",
- fn: withCtx(() => [
- createTextVNode(toDisplayString(__props.element.options.append), 1)
- ])
- } : void 0
- ]), 1032, ["model-value", "style", "placeholder", "maxlength", "clearable", "disabled", "show-password"])) : createCommentVNode("", true),
- __props.element.type === "textarea" ? (openBlock(), createBlock(_component_el_input, {
- key: 2,
- type: "textarea",
- resize: "none",
- readonly: "",
- rows: __props.element.options.rows,
- "model-value": __props.element.options.defaultValue,
- style: normalizeStyle({ width: __props.element.options.width }),
- placeholder: __props.element.options.placeholder,
- maxlength: parseInt(__props.element.options.maxlength),
- "show-word-limit": __props.element.options.showWordLimit,
- autosize: __props.element.options.autosize,
- clearable: __props.element.options.clearable,
- disabled: __props.element.options.disabled
- }, null, 8, ["rows", "model-value", "style", "placeholder", "maxlength", "show-word-limit", "autosize", "clearable", "disabled"])) : createCommentVNode("", true),
- __props.element.type === "number" ? (openBlock(), createBlock(_component_el_input_number, {
- key: 3,
- "model-value": __props.element.options.defaultValue,
- style: normalizeStyle({ width: __props.element.options.width }),
- max: __props.element.options.max,
- min: __props.element.options.min,
- disabled: __props.element.options.disabled,
- "controls-position": "right"
- }, null, 8, ["model-value", "style", "max", "min", "disabled"])) : createCommentVNode("", true),
- __props.element.type === "radio" ? (openBlock(), createBlock(_component_el_radio_group, {
- key: 4,
- "model-value": __props.element.options.defaultValue,
- style: normalizeStyle({ width: __props.element.options.width }),
- disabled: __props.element.options.disabled
- }, {
- default: withCtx(() => [
- (openBlock(true), createElementBlock(Fragment, null, renderList(__props.element.options.options, (item) => {
- return openBlock(), createBlock(_component_el_radio, {
- key: item.value,
- label: item.value,
- style: normalizeStyle({
- display: __props.element.options.inline ? "inline-block" : "block"
- })
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(__props.element.options.showLabel ? item.label : item.value), 1)
- ]),
- _: 2
- }, 1032, ["label", "style"]);
- }), 128))
- ]),
- _: 1
- }, 8, ["model-value", "style", "disabled"])) : createCommentVNode("", true),
- __props.element.type === "checkbox" ? (openBlock(), createBlock(_component_el_checkbox_group, {
- key: 5,
- "model-value": __props.element.options.defaultValue,
- style: normalizeStyle({ width: __props.element.options.width }),
- disabled: __props.element.options.disabled
- }, {
- default: withCtx(() => [
- (openBlock(true), createElementBlock(Fragment, null, renderList(__props.element.options.options, (item) => {
- return openBlock(), createBlock(_component_el_checkbox, {
- key: item.value,
- label: item.value,
- style: normalizeStyle({
- display: __props.element.options.inline ? "inline-block" : "block"
- })
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(__props.element.options.showLabel ? item.label : item.value), 1)
- ]),
- _: 2
- }, 1032, ["label", "style"]);
- }), 128))
- ]),
- _: 1
- }, 8, ["model-value", "style", "disabled"])) : createCommentVNode("", true),
- __props.element.type === "time" ? (openBlock(), createBlock(_component_el_time_picker, {
- key: 6,
- "model-value": __props.element.options.defaultValue,
- placeholder: __props.element.options.placeholder,
- readonly: __props.element.options.readonly,
- editable: __props.element.options.editable,
- clearable: __props.element.options.clearable,
- format: __props.element.options.format,
- disabled: __props.element.options.disabled,
- style: normalizeStyle({ width: __props.element.options.width })
- }, null, 8, ["model-value", "placeholder", "readonly", "editable", "clearable", "format", "disabled", "style"])) : createCommentVNode("", true),
- __props.element.type === "date" ? (openBlock(), createBlock(_component_el_date_picker, {
- key: 7,
- "model-value": __props.element.options.defaultValue,
- placeholder: __props.element.options.placeholder,
- readonly: __props.element.options.readonly,
- editable: __props.element.options.editable,
- clearable: __props.element.options.clearable,
- format: __props.element.options.format,
- disabled: __props.element.options.disabled,
- style: normalizeStyle({ width: __props.element.options.width })
- }, null, 8, ["model-value", "placeholder", "readonly", "editable", "clearable", "format", "disabled", "style"])) : createCommentVNode("", true),
- __props.element.type === "rate" ? (openBlock(), createBlock(_component_el_rate, {
- key: 8,
- "model-value": __props.element.options.defaultValue,
- max: __props.element.options.max,
- "allow-half": __props.element.options.allowHalf,
- disabled: __props.element.options.disabled
- }, null, 8, ["model-value", "max", "allow-half", "disabled"])) : createCommentVNode("", true),
- __props.element.type === "select" ? (openBlock(), createElementBlock(Fragment, { key: 9 }, [
- unref(userInfo).userNameNeedTranslate == 1 && __props.element.options.remoteFunc.indexOf("getSimpleActiveUserListNew") > -1 ? (openBlock(), createBlock(_sfc_main$9, {
- key: 0,
- "model-value": __props.element.options.defaultValue,
- multiple: __props.element.options.multiple,
- placeholder: __props.element.options.placeholder,
- clearable: __props.element.options.clearable,
- filterable: __props.element.options.filterable,
- disabled: __props.element.options.disabled,
- url: __props.element.options.remoteFunc,
- size: __props.configurationItems.size,
- options: [],
- style: normalizeStyle({ width: __props.element.options.width })
- }, null, 8, ["model-value", "multiple", "placeholder", "clearable", "filterable", "disabled", "url", "size", "style"])) : (openBlock(), createBlock(_component_el_select, {
- key: 1,
- "model-value": __props.element.options.defaultValue,
- multiple: __props.element.options.multiple,
- placeholder: __props.element.options.placeholder,
- clearable: __props.element.options.clearable,
- filterable: __props.element.options.filterable,
- disabled: __props.element.options.disabled,
- style: normalizeStyle({ width: __props.element.options.width })
- }, {
- default: withCtx(() => [
- (openBlock(true), createElementBlock(Fragment, null, renderList(__props.element.options.options, (item) => {
- return openBlock(), createBlock(_component_el_option, {
- key: item.value,
- value: item.value,
- label: __props.element.options.showLabel ? item.label : item.value
- }, null, 8, ["value", "label"]);
- }), 128))
- ]),
- _: 1
- }, 8, ["model-value", "multiple", "placeholder", "clearable", "filterable", "disabled", "style"]))
- ], 64)) : createCommentVNode("", true),
- __props.element.type === "switch" ? (openBlock(), createBlock(_component_el_switch, {
- key: 10,
- "model-value": __props.element.options.defaultValue,
- "active-text": __props.element.options.activeText,
- "inactive-text": __props.element.options.inactiveText,
- disabled: __props.element.options.disabled
- }, null, 8, ["model-value", "active-text", "inactive-text", "disabled"])) : createCommentVNode("", true),
- __props.element.type === "slider" ? (openBlock(), createBlock(_component_el_slider, {
- key: 11,
- "model-value": __props.element.options.defaultValue,
- min: __props.element.options.min,
- max: __props.element.options.max,
- step: __props.element.options.step,
- range: __props.element.options.range,
- disabled: __props.element.options.disabled,
- style: normalizeStyle({ width: __props.element.options.width })
- }, null, 8, ["model-value", "min", "max", "step", "range", "disabled", "style"])) : createCommentVNode("", true),
- __props.element.type == "text" ? (openBlock(), createElementBlock("span", _hoisted_1$4, toDisplayString(__props.element.options.defaultValue), 1)) : createCommentVNode("", true),
- __props.element.type === "img-upload" ? (openBlock(), createBlock(_component_el_upload, {
- key: 13,
- name: __props.element.options.file,
- action: __props.element.options.action,
- accept: __props.element.options.accept,
- "list-type": __props.element.options.listType,
- multiple: __props.element.options.multiple,
- limit: __props.element.options.limit,
- disabled: __props.element.options.disabled
- }, {
- default: withCtx(() => {
- var _a3;
- return [
- __props.element.options.listType === "picture-card" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
- ((_a3 = __props.element.options.defaultValue) == null ? void 0 : _a3.length) ? (openBlock(), createBlock(_component_el_image, {
- key: 0,
- style: { "width": "100%", "height": "100%" },
- "preview-src-list": [
- "/api/sys/common/static/" + __props.element.options.defaultValue
- ],
- src: "/api/sys/common/static/" + __props.element.options.defaultValue
- }, null, 8, ["preview-src-list", "src"])) : (openBlock(), createElementBlock("i", _hoisted_2$3))
- ], 64)) : (openBlock(), createBlock(_component_el_button, { key: 1 }, {
- default: withCtx(() => [
- _hoisted_3$3,
- _hoisted_4$3
- ]),
- _: 1
- }))
- ];
- }),
- _: 1
- }, 8, ["name", "action", "accept", "list-type", "multiple", "limit", "disabled"])) : createCommentVNode("", true),
- __props.element.type === "download" ? (openBlock(), createBlock(_component_el_button, {
- key: 14,
- type: "text",
- style: { "margin-top": "-4px" }
- }, {
- default: withCtx(() => [
- _hoisted_5$3
- ]),
- _: 1
- })) : createCommentVNode("", true),
- __props.element.type === "cascader" ? (openBlock(), createBlock(_component_el_cascader, {
- key: 15,
- "model-value": __props.element.options.defaultValue,
- options: __props.element.options.remoteOptions,
- placeholder: __props.element.options.placeholder,
- filterable: __props.element.options.filterable,
- clearable: __props.element.options.clearable,
- disabled: __props.element.options.disabled,
- style: normalizeStyle({ width: __props.element.options.width })
- }, null, 8, ["model-value", "options", "placeholder", "filterable", "clearable", "disabled", "style"])) : createCommentVNode("", true)
- ]),
- _: 1
- }, 8, ["label", "label-width", "rules"])) : createCommentVNode("", true),
- ((_b2 = selectWidget.value) == null ? void 0 : _b2.key) === __props.element.key ? (openBlock(), createElementBlock(Fragment, { key: 4 }, [
- createElementVNode("div", {
- absolute: "",
- "z-10": "",
- "left-0": "",
- top: "-.5",
- "bg-blue-500": "",
- "text-white": "",
- p: ".5 l-0 t-0",
- "cursor-move": "",
- class: normalizeClass({ "bg-yellow-500": __props.element.type === "grid" })
- }, _hoisted_7$2, 2),
- createElementVNode("div", {
- absolute: "",
- "z-10": "",
- "right-0": "",
- bottom: "-0.5",
- "bg-blue-500": "",
- flex: "",
- "gap-1": "",
- p: "1 r-.5",
- "text-white": "",
- "cursor-pointer": "",
- class: normalizeClass({ "bg-yellow-500": __props.element.type === "grid" })
- }, [
- createCommentVNode("", true),
- !__props.element.allDisable ? (openBlock(), createElementBlock("i", {
- key: 1,
- class: "fa6-regular:trash-can",
- onClick: _cache[2] || (_cache[2] = withModifiers(($event) => handleDeleteClick(), ["stop"]))
- })) : createCommentVNode("", true)
- ], 2)
- ], 64)) : createCommentVNode("", true)
- ], 6);
- };
- }
- });
- var WidgetForm_vue_vue_type_style_index_0_lang = "";
- const _hoisted_1$3 = {
- key: 0,
- text: "gray-400 lg",
- absolute: "",
- "top-50": "",
- left: "1/2",
- "translate-x": "-1/2"
- };
- const _sfc_main$4 = /* @__PURE__ */ defineComponent({
- props: {
- list: null,
- config: null,
- selectWidget: null
- },
- emits: ["update:selectWidget"],
- setup(__props) {
- const props = __props;
- const selectWidget = useVModel(props, "selectWidget");
- return (_ctx, _cache) => {
- const _component_el_form = ElForm;
- return openBlock(), createBlock(_component_el_form, mergeProps({
- "label-suffix": ":",
- "bg-gray-50": "",
- relative: "",
- flex: "~ 1"
- }, __props.config, { class: "layoutForm" }), {
- default: withCtx(() => {
- var _a2;
- return [
- !((_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),
- createVNode(unref(Draggable), {
- class: "flex-1 m-2 bg-white shadow p-1",
- "item-key": "key",
- handle: "[cursor-move]",
- animation: 200,
- group: "form-design",
- list: __props.list,
- onAdd: _cache[1] || (_cache[1] = ($event) => selectWidget.value = __props.list[$event.newIndex])
- }, {
- item: withCtx(({ element, index }) => [
- createVNode(_sfc_main$5, {
- selectWidget: unref(selectWidget),
- "onUpdate:selectWidget": _cache[0] || (_cache[0] = ($event) => isRef(selectWidget) ? selectWidget.value = $event : null),
- element,
- index,
- list: __props.list,
- configurationItems: __props.config
- }, null, 8, ["selectWidget", "element", "index", "list", "configurationItems"])
- ]),
- _: 1
- }, 8, ["list"])
- ];
- }),
- _: 1
- }, 16);
- };
- }
- });
- var elSpace = "";
- var elRadioButton = "";
- var WidgetConfig_vue_vue_type_style_index_0_lang = "";
- const _sfc_main$3 = defineComponent({
- name: "ElWidgetConfig",
- components: {
- Draggable
- },
- props: {
- select: {
- type: Object
- }
- },
- emits: ["update:select"],
- setup(props, context) {
- const data2 = ref(props.select);
- watch(() => props.select, (val) => data2.value = val);
- watch(data2, (val) => context.emit("update:select", val), { deep: true });
- const hasKey = (key) => Object.keys(data2.value.options).includes(key);
- const handleInsertColumn = () => {
- data2.value.columns.push({
- span: 0,
- list: []
- });
- };
- const handleInsertOption = () => {
- const index = data2.value.options.options.length + 1;
- data2.value.options.options.push({
- label: `Option ${index}`,
- value: `Option ${index}`
- });
- };
- const handleOptionsRemove = (index) => {
- if (data2.value.type === "grid")
- data2.value.columns.splice(index, 1);
- else
- data2.value.options.options.splice(index, 1);
- };
- const handleSliderModeChange = (checked) => {
- checked ? data2.value.options.defaultValue = [10, 90] : data2.value.options.defaultValue = 0;
- };
- const handleSelectModeChange = (val) => {
- if (data2.value.type === "img-upload")
- return;
- if (val) {
- if (data2.value.options.defaultValue) {
- if (!(data2.value.options.defaultValue instanceof Array))
- data2.value.options.defaultValue = [data2.value.options.defaultValue];
- } else {
- data2.value.options.defaultValue = [];
- }
- } else {
- data2.value.options.defaultValue.length ? data2.value.options.defaultValue = data2.value.options.defaultValue[0] : data2.value.options.defaultValue = null;
- }
- };
- return {
- data: data2,
- hasKey,
- handleInsertColumn,
- handleInsertOption,
- handleOptionsRemove,
- handleSliderModeChange,
- handleSelectModeChange
- };
- }
- });
- const _hoisted_1$2 = /* @__PURE__ */ createTextVNode(" \u884C\u5185 ");
- const _hoisted_2$2 = /* @__PURE__ */ createTextVNode(" \u5757\u7EA7 ");
- const _hoisted_3$2 = /* @__PURE__ */ createTextVNode(" \u9759\u6001\u6570\u636E ");
- const _hoisted_4$2 = /* @__PURE__ */ createTextVNode(" \u8FDC\u7AEF\u6570\u636E ");
- const _hoisted_5$2 = /* @__PURE__ */ createTextVNode(" \u8FDC\u7AEF\u65B9\u6CD5 ");
- const _hoisted_6$2 = /* @__PURE__ */ createTextVNode(" \u6807\u7B7E ");
- const _hoisted_7$1 = /* @__PURE__ */ createTextVNode(" \u503C ");
- const _hoisted_8$1 = { class: "flex items-center" };
- const _hoisted_9$1 = /* @__PURE__ */ createElementVNode("i", {
- style: { "margin": "0 5px", "cursor": "move" },
- class: "drag-item custom:item"
- }, null, -1);
- const _hoisted_10$1 = /* @__PURE__ */ createElementVNode("i", { class: "fa6-regular:trash-can" }, null, -1);
- const _hoisted_11$1 = { class: "flex items-center justify-center gap-2 mb-2" };
- const _hoisted_12$1 = /* @__PURE__ */ createTextVNode(/* @__PURE__ */ toDisplayString(""));
- const _hoisted_13$1 = /* @__PURE__ */ createElementVNode("i", { class: "cursor-move text-sm custom:item" }, null, -1);
- const _hoisted_14$1 = /* @__PURE__ */ createElementVNode("i", { class: "fa6-regular:trash-can" }, null, -1);
- const _hoisted_15 = { style: { "margin-top": "5px" } };
- const _hoisted_16 = /* @__PURE__ */ createTextVNode(" \u6DFB\u52A0\u9009\u9879 ");
- const _hoisted_17 = /* @__PURE__ */ createTextVNode(" text ");
- const _hoisted_18 = /* @__PURE__ */ createTextVNode(" picture ");
- const _hoisted_19 = /* @__PURE__ */ createTextVNode(" picture-card ");
- const _hoisted_20 = /* @__PURE__ */ createTextVNode(" POST ");
- const _hoisted_21 = /* @__PURE__ */ createTextVNode(" PUT ");
- const _hoisted_22 = /* @__PURE__ */ createTextVNode(" GET ");
- const _hoisted_23 = /* @__PURE__ */ createTextVNode(" DELETE ");
- const _hoisted_24 = /* @__PURE__ */ createTextVNode(" \u8FDC\u7AEF\u65B9\u6CD5 ");
- const _hoisted_25 = /* @__PURE__ */ createTextVNode(" \u6807\u7B7E ");
- const _hoisted_26 = /* @__PURE__ */ createTextVNode(" \u503C ");
- const _hoisted_27 = /* @__PURE__ */ createTextVNode(" \u5B50\u9009\u9879 ");
- const _hoisted_28 = { style: { "display": "flex", "gap": "5px", "margin-bottom": "5px" } };
- const _hoisted_29 = /* @__PURE__ */ createElementVNode("i", { class: "drag-item custom:item" }, null, -1);
- const _hoisted_30 = /* @__PURE__ */ createElementVNode("i", { class: "fa6-regular:trash-can" }, null, -1);
- const _hoisted_31 = /* @__PURE__ */ createTextVNode(" \u6DFB\u52A0\u5217 ");
- const _hoisted_32 = /* @__PURE__ */ createTextVNode(" \u5C45\u5DE6\u5BF9\u9F50 ");
- const _hoisted_33 = /* @__PURE__ */ createTextVNode(" \u5C45\u4E2D\u5BF9\u9F50 ");
- const _hoisted_34 = /* @__PURE__ */ createTextVNode(" \u5DE8\u53F3\u5BF9\u9F50 ");
- const _hoisted_35 = { style: { "margin-bottom": "5px" } };
- const _hoisted_36 = /* @__PURE__ */ createElementVNode("i", { class: "drag-item custom:item" }, null, -1);
- const _hoisted_37 = /* @__PURE__ */ createElementVNode("i", { class: "fa6-regular:trash-can" }, null, -1);
- const _hoisted_38 = /* @__PURE__ */ createTextVNode(" \u6DFB\u52A0\u5217 ");
- const _hoisted_39 = /* @__PURE__ */ createTextVNode(" \u9876\u90E8\u5BF9\u9F50 ");
- const _hoisted_40 = /* @__PURE__ */ createTextVNode(" \u5C45\u4E2D\u5BF9\u9F50 ");
- const _hoisted_41 = /* @__PURE__ */ createTextVNode(" \u5E95\u90E8\u5BF9\u9F50 ");
- const _hoisted_42 = /* @__PURE__ */ createTextVNode(" \u5FC5\u586B ");
- const _hoisted_43 = /* @__PURE__ */ createTextVNode(" \u53EA\u8BFB ");
- const _hoisted_44 = /* @__PURE__ */ createTextVNode(" \u7981\u7528 ");
- const _hoisted_45 = /* @__PURE__ */ createTextVNode(" \u6E05\u9664 ");
- 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);
- const _hoisted_47 = /* @__PURE__ */ createTextVNode(" Blur ");
- const _hoisted_48 = /* @__PURE__ */ createTextVNode(" Change ");
- const _hoisted_49 = /* @__PURE__ */ createTextVNode(" \u5B57\u7B26\u4E32 ");
- const _hoisted_50 = /* @__PURE__ */ createTextVNode(" \u6570\u5B57 ");
- const _hoisted_51 = /* @__PURE__ */ createTextVNode(" \u5E03\u5C14\u503C ");
- const _hoisted_52 = /* @__PURE__ */ createTextVNode(" \u65B9\u6CD5 ");
- const _hoisted_53 = /* @__PURE__ */ createTextVNode(" \u6B63\u5219\u8868\u8FBE\u5F0F ");
- const _hoisted_54 = /* @__PURE__ */ createTextVNode(" \u6574\u6570 ");
- const _hoisted_55 = /* @__PURE__ */ createTextVNode(" \u6D6E\u70B9\u6570 ");
- const _hoisted_56 = /* @__PURE__ */ createTextVNode(" \u6570\u7EC4 ");
- const _hoisted_57 = /* @__PURE__ */ createTextVNode(" \u5BF9\u8C61 ");
- const _hoisted_58 = /* @__PURE__ */ createTextVNode(" \u679A\u4E3E ");
- const _hoisted_59 = /* @__PURE__ */ createTextVNode(" \u65E5\u671F ");
- const _hoisted_60 = /* @__PURE__ */ createTextVNode(" URL\u5730\u5740 ");
- const _hoisted_61 = /* @__PURE__ */ createTextVNode(" \u5341\u516D\u8FDB\u5236 ");
- const _hoisted_62 = /* @__PURE__ */ createTextVNode(" \u90AE\u7BB1\u5730\u5740 ");
- const _hoisted_63 = /* @__PURE__ */ createTextVNode(" \u4EFB\u610F\u7C7B\u578B ");
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
- const _component_el_input = ElInput;
- const _component_el_form_item = ElFormItem;
- const _component_el_rate = ElRate;
- const _component_el_switch = ElSwitch;
- const _component_el_input_number = ElInputNumber;
- const _component_el_radio_button = ElRadioButton;
- const _component_el_radio_group = ElRadioGroup;
- const _component_el_space = ElSpace;
- const _component_el_radio = ElRadio;
- const _component_el_button = ElButton;
- const _component_Draggable = resolveComponent("Draggable");
- const _component_el_checkbox = ElCheckbox;
- const _component_el_checkbox_group = ElCheckboxGroup$1;
- const _component_el_time_picker = ElTimePicker;
- const _component_el_date_picker = ElDatePicker;
- const _component_el_option = ElOption;
- const _component_el_select = ElSelect;
- const _component_el_form = ElForm;
- return _ctx.data ? (openBlock(), createBlock(_component_el_form, {
- key: _ctx.data.key,
- "label-position": "top",
- "p-2": "",
- "flex-1": "",
- "overflow-auto": ""
- }, {
- default: withCtx(() => [
- !["grid"].includes(_ctx.data.type) ? (openBlock(), createBlock(_component_el_form_item, {
- key: 0,
- label: "\u5B57\u6BB5\u6807\u8BC6"
- }, {
- default: withCtx(() => [
- createVNode(_component_el_input, {
- modelValue: _ctx.data.model,
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.data.model = $event),
- disabled: true
- }, null, 8, ["modelValue"])
- ]),
- _: 1
- })) : createCommentVNode("", true),
- !["grid", "table"].includes(_ctx.data.type) ? (openBlock(), createBlock(_component_el_form_item, {
- key: 1,
- label: "\u6807\u9898"
- }, {
- default: withCtx(() => [
- createVNode(_component_el_input, {
- modelValue: _ctx.data.label,
- "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.data.label = $event),
- disabled: _ctx.data.allDisable
- }, null, 8, ["modelValue", "disabled"])
- ]),
- _: 1
- })) : createCommentVNode("", true),
- _ctx.hasKey("width") ? (openBlock(), createBlock(_component_el_form_item, {
- key: 2,
- label: "\u5BBD\u5EA6"
- }, {
- default: withCtx(() => [
- createVNode(_component_el_input, {
- modelValue: _ctx.data.options.width,
- "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => _ctx.data.options.width = $event)
- }, null, 8, ["modelValue"])
- ]),
- _: 1
- })) : createCommentVNode("", true),
- _ctx.hasKey("placeholder") ? (openBlock(), createBlock(_component_el_form_item, {
- key: 3,
- label: "\u5360\u4F4D\u5185\u5BB9"
- }, {
- default: withCtx(() => [
- createVNode(_component_el_input, {
- modelValue: _ctx.data.options.placeholder,
- "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => _ctx.data.options.placeholder = $event),
- disabled: _ctx.data.allDisable
- }, null, 8, ["modelValue", "disabled"])
- ]),
- _: 1
- })) : createCommentVNode("", true),
- _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, {
- key: 4,
- label: "\u9ED8\u8BA4\u5185\u5BB9"
- }, {
- default: withCtx(() => [
- _ctx.data.type === "input" || _ctx.data.type === "password" || _ctx.data.type === "text" ? (openBlock(), createBlock(_component_el_input, {
- key: 0,
- modelValue: _ctx.data.options.defaultValue,
- "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => _ctx.data.options.defaultValue = $event)
- }, null, 8, ["modelValue"])) : createCommentVNode("", true),
- _ctx.data.type === "textarea" ? (openBlock(), createBlock(_component_el_input, {
- key: 1,
- modelValue: _ctx.data.options.defaultValue,
- "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => _ctx.data.options.defaultValue = $event),
- type: "textarea"
- }, null, 8, ["modelValue"])) : createCommentVNode("", true),
- _ctx.data.type === "rate" ? (openBlock(), createBlock(_component_el_rate, {
- key: 2,
- modelValue: _ctx.data.options.defaultValue,
- "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => _ctx.data.options.defaultValue = $event),
- max: _ctx.data.options.max,
- "allow-half": _ctx.data.options.allowHalf
- }, null, 8, ["modelValue", "max", "allow-half"])) : createCommentVNode("", true),
- _ctx.data.type === "switch" ? (openBlock(), createBlock(_component_el_switch, {
- key: 3,
- modelValue: _ctx.data.options.defaultValue,
- "onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => _ctx.data.options.defaultValue = $event)
- }, null, 8, ["modelValue"])) : createCommentVNode("", true),
- _ctx.data.type === "slider" ? (openBlock(), createElementBlock(Fragment, { key: 4 }, [
- !_ctx.data.options.range ? (openBlock(), createBlock(_component_el_input_number, {
- key: 0,
- modelValue: _ctx.data.options.defaultValue,
- "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => _ctx.data.options.defaultValue = $event),
- modelModifiers: { number: true }
- }, null, 8, ["modelValue"])) : createCommentVNode("", true),
- _ctx.data.options.range ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
- createVNode(_component_el_input_number, {
- modelValue: _ctx.data.options.defaultValue[0],
- "onUpdate:modelValue": _cache[9] || (_cache[9] = ($event) => _ctx.data.options.defaultValue[0] = $event),
- modelModifiers: { number: true },
- max: _ctx.data.options.max
- }, null, 8, ["modelValue", "max"]),
- createVNode(_component_el_input_number, {
- modelValue: _ctx.data.options.defaultValue[1],
- "onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => _ctx.data.options.defaultValue[1] = $event),
- modelModifiers: { number: true },
- max: _ctx.data.options.max
- }, null, 8, ["modelValue", "max"])
- ], 64)) : createCommentVNode("", true)
- ], 64)) : createCommentVNode("", true)
- ]),
- _: 1
- })) : createCommentVNode("", true),
- _ctx.hasKey("maxlength") ? (openBlock(), createBlock(_component_el_form_item, {
- key: 5,
- label: "\u6700\u5927\u957F\u5EA6"
- }, {
- default: withCtx(() => [
- createVNode(_component_el_input, {
- modelValue: _ctx.data.options.maxlength,
- "onUpdate:modelValue": _cache[11] || (_cache[11] = ($event) => _ctx.data.options.maxlength = $event),
- modelModifiers: { number: true },
- disabled: _ctx.data.allDisable
- }, null, 8, ["modelValue", "disabled"])
- ]),
- _: 1
- })) : createCommentVNode("", true),
- _ctx.hasKey("max") ? (openBlock(), createBlock(_component_el_form_item, {
- key: 6,
- label: "\u6700\u5927\u503C"
- }, {
- default: withCtx(() => [
- createVNode(_component_el_input_number, {
- modelValue: _ctx.data.options.max,
- "onUpdate:modelValue": _cache[12] || (_cache[12] = ($event) => _ctx.data.options.max = $event),
- modelModifiers: { number: true },
- disabled: _ctx.data.allDisable
- }, null, 8, ["modelValue", "disabled"])
- ]),
- _: 1
- })) : createCommentVNode("", true),
- _ctx.hasKey("min") ? (openBlock(), createBlock(_component_el_form_item, {
- key: 7,
- label: "\u6700\u5C0F\u503C"
- }, {
- default: withCtx(() => [
- createVNode(_component_el_input_number, {
- modelValue: _ctx.data.options.min,
- "onUpdate:modelValue": _cache[13] || (_cache[13] = ($event) => _ctx.data.options.min = $event),
- modelModifiers: { number: true },
- disabled: _ctx.data.allDisable
- }, null, 8, ["modelValue", "disabled"])
- ]),
- _: 1
- })) : createCommentVNode("", true),
- _ctx.hasKey("step") ? (openBlock(), createBlock(_component_el_form_item, {
- key: 8,
- label: "\u6B65\u957F"
- }, {
- default: withCtx(() => [
- createVNode(_component_el_input_number, {
- modelValue: _ctx.data.options.step,
- "onUpdate:modelValue": _cache[14] || (_cache[14] = ($event) => _ctx.data.options.step = $event),
- modelModifiers: { number: true },
- min: 0,
- disabled: _ctx.data.allDisable
- }, null, 8, ["modelValue", "disabled"])
- ]),
- _: 1
- })) : createCommentVNode("", true),
- _ctx.hasKey("prefix") ? (openBlock(), createBlock(_component_el_form_item, {
- key: 9,
- label: "\u524D\u7F00"
- }, {
- default: withCtx(() => [
- createVNode(_component_el_input, {
- modelValue: _ctx.data.options.prefix,
- "onUpdate:modelValue": _cache[15] || (_cache[15] = ($event) => _ctx.data.options.prefix = $event),
- disabled: _ctx.data.allDisable
- }, null, 8, ["modelValue", "disabled"])
- ]),
- _: 1
- })) : createCommentVNode("", true),
- _ctx.hasKey("suffix") ? (openBlock(), createBlock(_component_el_form_item, {
- key: 10,
- label: "\u540E\u7F00"
- }, {
- default: withCtx(() => [
- createVNode(_component_el_input, {
- modelValue: _ctx.data.options.suffix,
- "onUpdate:modelValue": _cache[16] || (_cache[16] = ($event) => _ctx.data.options.suffix = $event),
- disabled: _ctx.data.allDisable
- }, null, 8, ["modelValue", "disabled"])
- ]),
- _: 1
- })) : createCommentVNode("", true),
- _ctx.hasKey("prepend") ? (openBlock(), createBlock(_component_el_form_item, {
- key: 11,
- label: "\u524D\u7F6E\u6807\u7B7E"
- }, {
- default: withCtx(() => [
- createVNode(_component_el_input, {
- modelValue: _ctx.data.options.prepend,
- "onUpdate:modelValue": _cache[17] || (_cache[17] = ($event) => _ctx.data.options.prepend = $event),
- disabled: _ctx.data.allDisable
- }, null, 8, ["modelValue", "disabled"])
- ]),
- _: 1
- })) : createCommentVNode("", true),
- _ctx.hasKey("append") ? (openBlock(), createBlock(_component_el_form_item, {
- key: 12,
- label: "\u540E\u7F6E\u6807\u7B7E"
- }, {
- default: withCtx(() => [
- createVNode(_component_el_input, {
- modelValue: _ctx.data.options.append,
- "onUpdate:modelValue": _cache[18] || (_cache[18] = ($event) => _ctx.data.options.append = $event),
- disabled: _ctx.data.allDisable
- }, null, 8, ["modelValue", "disabled"])
- ]),
- _: 1
- })) : createCommentVNode("", true),
- _ctx.hasKey("activeText") ? (openBlock(), createBlock(_component_el_form_item, {
- key: 13,
- label: "\u9009\u4E2D\u65F6\u7684\u5185\u5BB9"
- }, {
- default: withCtx(() => [
- createVNode(_component_el_input, {
- modelValue: _ctx.data.options.activeText,
- "onUpdate:modelValue": _cache[19] || (_cache[19] = ($event) => _ctx.data.options.activeText = $event)
- }, null, 8, ["modelValue"])
- ]),
- _: 1
- })) : createCommentVNode("", true),
- _ctx.hasKey("inactiveText") ? (openBlock(), createBlock(_component_el_form_item, {
- key: 14,
- label: "\u975E\u9009\u4E2D\u65F6\u7684\u5185\u5BB9"
- }, {
- default: withCtx(() => [
- createVNode(_component_el_input, {
- modelValue: _ctx.data.options.inactiveText,
- "onUpdate:modelValue": _cache[20] || (_cache[20] = ($event) => _ctx.data.options.inactiveText = $event)
- }, null, 8, ["modelValue"])
- ]),
- _: 1
- })) : createCommentVNode("", true),
- _ctx.hasKey("editable") ? (openBlock(), createBlock(_component_el_form_item, {
- key: 15,
- label: "\u6587\u672C\u6846\u53EF\u8F93\u5165"
- }, {
- default: withCtx(() => [
- createVNode(_component_el_switch, {
- modelValue: _ctx.data.options.editable,
- "onUpdate:modelValue": _cache[21] || (_cache[21] = ($event) => _ctx.data.options.editable = $event)
- }, null, 8, ["modelValue"])
- ]),
- _: 1
- })) : createCommentVNode("", true),
- _ctx.hasKey("range") ? (openBlock(), createBlock(_component_el_form_item, {
- key: 16,
- label: "\u8303\u56F4\u9009\u62E9"
- }, {
- default: withCtx(() => [
- createVNode(_component_el_switch, {
- modelValue: _ctx.data.options.range,
- "onUpdate:modelValue": _cache[22] || (_cache[22] = ($event) => _ctx.data.options.range = $event),
- onChange: _ctx.handleSliderModeChange
- }, null, 8, ["modelValue", "onChange"])
- ]),
- _: 1
- })) : createCommentVNode("", true),
- _ctx.hasKey("showPassword") ? (openBlock(), createBlock(_component_el_form_item, {
- key: 17,
- label: "\u662F\u5426\u663E\u793A\u5207\u6362\u6309\u94AE"
- }, {
- default: withCtx(() => [
- createVNode(_component_el_switch, {
- modelValue: _ctx.data.options.showPassword,
- "onUpdate:modelValue": _cache[23] || (_cache[23] = ($event) => _ctx.data.options.showPassword = $event)
- }, null, 8, ["modelValue"])
- ]),
- _: 1
- })) : createCommentVNode("", true),
- _ctx.hasKey("showWordLimit") ? (openBlock(), createBlock(_component_el_form_item, {
- key: 18,
- label: "\u662F\u5426\u663E\u793A\u5B57\u6570"
- }, {
- default: withCtx(() => [
- createVNode(_component_el_switch, {
- modelValue: _ctx.data.options.showWordLimit,
- "onUpdate:modelValue": _cache[24] || (_cache[24] = ($event) => _ctx.data.options.showWordLimit = $event)
- }, null, 8, ["modelValue"])
- ]),
- _: 1
- })) : createCommentVNode("", true),
- _ctx.hasKey("autosize") ? (openBlock(), createBlock(_component_el_form_item, {
- key: 19,
- label: "\u662F\u5426\u81EA\u9002\u5E94\u5185\u5BB9\u9AD8\u5EA6"
- }, {
- default: withCtx(() => [
- createVNode(_component_el_switch, {
- modelValue: _ctx.data.options.autosize,
- "onUpdate:modelValue": _cache[25] || (_cache[25] = ($event) => _ctx.data.options.autosize = $event)
- }, null, 8, ["modelValue"])
- ]),
- _: 1
- })) : createCommentVNode("", true),
- _ctx.hasKey("rows") && !_ctx.data.options.autosize ? (openBlock(), createBlock(_component_el_form_item, {
- key: 20,
- label: "\u884C\u6570"
- }, {
- default: withCtx(() => [
- createVNode(_component_el_input_number, {
- modelValue: _ctx.data.options.rows,
- "onUpdate:modelValue": _cache[26] || (_cache[26] = ($event) => _ctx.data.options.rows = $event),
- min: 0
- }, null, 8, ["modelValue"])
- ]),
- _: 1
- })) : createCommentVNode("", true),
- _ctx.hasKey("allowHalf") ? (openBlock(), createBlock(_component_el_form_item, {
- key: 21,
- label: "\u662F\u5426\u5141\u8BB8\u534A\u9009"
- }, {
- default: withCtx(() => [
- createVNode(_component_el_switch, {
- modelValue: _ctx.data.options.allowHalf,
- "onUpdate:modelValue": _cache[27] || (_cache[27] = ($event) => _ctx.data.options.allowHalf = $event)
- }, null, 8, ["modelValue"])
- ]),
- _: 1
- })) : createCommentVNode("", true),
- _ctx.hasKey("inline") ? (openBlock(), createBlock(_component_el_form_item, {
- key: 22,
- label: "\u5E03\u5C40\u65B9\u5F0F"
- }, {
- default: withCtx(() => [
- createVNode(_component_el_radio_group, {
- modelValue: _ctx.data.options.inline,
- "onUpdate:modelValue": _cache[28] || (_cache[28] = ($event) => _ctx.data.options.inline = $event)
- }, {
- default: withCtx(() => [
- createVNode(_component_el_radio_button, { label: true }, {
- default: withCtx(() => [
- _hoisted_1$2
- ]),
- _: 1
- }),
- createVNode(_component_el_radio_button, { label: false }, {
- default: withCtx(() => [
- _hoisted_2$2
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["modelValue"])
- ]),
- _: 1
- })) : createCommentVNode("", true),
- _ctx.hasKey("multiple") ? (openBlock(), createBlock(_component_el_form_item, {
- key: 23,
- label: "\u662F\u5426\u591A\u9009"
- }, {
- default: withCtx(() => [
- createVNode(_component_el_switch, {
- modelValue: _ctx.data.options.multiple,
- "onUpdate:modelValue": _cache[29] || (_cache[29] = ($event) => _ctx.data.options.multiple = $event),
- onChange: _ctx.handleSelectModeChange,
- disabled: _ctx.data.allDisable
- }, null, 8, ["modelValue", "onChange", "disabled"])
- ]),
- _: 1
- })) : createCommentVNode("", true),
- _ctx.hasKey("filterable") ? (openBlock(), createBlock(_component_el_form_item, {
- key: 24,
- label: "\u662F\u5426\u53EF\u641C\u7D22"
- }, {
- default: withCtx(() => [
- createVNode(_component_el_switch, {
- modelValue: _ctx.data.options.filterable,
- "onUpdate:modelValue": _cache[30] || (_cache[30] = ($event) => _ctx.data.options.filterable = $event),
- disabled: _ctx.data.allDisable
- }, null, 8, ["modelValue", "disabled"])
- ]),
- _: 1
- })) : createCommentVNode("", true),
- _ctx.hasKey("showLabel") ? (openBlock(), createBlock(_component_el_form_item, {
- key: 25,
- label: "\u662F\u5426\u663E\u793A\u6807\u7B7E"
- }, {
- default: withCtx(() => [
- createVNode(_component_el_switch, {
- modelValue: _ctx.data.options.showLabel,
- "onUpdate:modelValue": _cache[31] || (_cache[31] = ($event) => _ctx.data.options.showLabel = $event)
- }, null, 8, ["modelValue"])
- ]),
- _: 1
- })) : createCommentVNode("", true),
- _ctx.hasKey("options") ? (openBlock(), createBlock(_component_el_form_item, {
- key: 26,
- label: "\u9009\u9879"
- }, {
- default: withCtx(() => [
- createVNode(_component_el_radio_group, {
- modelValue: _ctx.data.options.remote,
- "onUpdate:modelValue": _cache[32] || (_cache[32] = ($event) => _ctx.data.options.remote = $event)
- }, {
- default: withCtx(() => [
- createVNode(_component_el_radio_button, { label: false }, {
- default: withCtx(() => [
- _hoisted_3$2
- ]),
- _: 1
- }),
- createVNode(_component_el_radio_button, { label: true }, {
- default: withCtx(() => [
- _hoisted_4$2
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["modelValue"]),
- _ctx.data.options.remote ? (openBlock(), createBlock(_component_el_space, {
- key: 0,
- alignment: "start",
- direction: "vertical",
- style: { "margin-top": "10px" }
- }, {
- default: withCtx(() => [
- createVNode(_component_el_input, {
- modelValue: _ctx.data.options.remoteFunc,
- "onUpdate:modelValue": _cache[33] || (_cache[33] = ($event) => _ctx.data.options.remoteFunc = $event)
- }, {
- prepend: withCtx(() => [
- _hoisted_5$2
- ]),
- _: 1
- }, 8, ["modelValue"]),
- createVNode(_component_el_input, {
- modelValue: _ctx.data.options.props.label,
- "onUpdate:modelValue": _cache[34] || (_cache[34] = ($event) => _ctx.data.options.props.label = $event)
- }, {
- prepend: withCtx(() => [
- _hoisted_6$2
- ]),
- _: 1
- }, 8, ["modelValue"]),
- createVNode(_component_el_input, {
- modelValue: _ctx.data.options.props.value,
- "onUpdate:modelValue": _cache[35] || (_cache[35] = ($event) => _ctx.data.options.props.value = $event)
- }, {
- prepend: withCtx(() => [
- _hoisted_7$1
- ]),
- _: 1
- }, 8, ["modelValue"])
- ]),
- _: 1
- })) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
- _ctx.data.type === "radio" || _ctx.data.type === "select" && !_ctx.data.options.multiple ? (openBlock(), createBlock(_component_el_radio_group, {
- key: 0,
- modelValue: _ctx.data.options.defaultValue,
- "onUpdate:modelValue": _cache[36] || (_cache[36] = ($event) => _ctx.data.options.defaultValue = $event),
- style: { "margin-top": "8px" }
- }, {
- default: withCtx(() => [
- createVNode(_component_Draggable, {
- "item-key": "index",
- "ghost-class": "ghost",
- handle: ".drag-item",
- group: { name: "options" },
- list: _ctx.data.options.options
- }, {
- item: withCtx(({ element, index }) => [
- createElementVNode("div", _hoisted_8$1, [
- createVNode(_component_el_radio, {
- label: element.value,
- style: { "margin-right": "0", "margin-bottom": "0" }
- }, {
- default: withCtx(() => [
- createVNode(_component_el_input, {
- modelValue: element.value,
- "onUpdate:modelValue": ($event) => element.value = $event,
- style: normalizeStyle({
- width: _ctx.data.options.showLabel ? "90px" : "180px"
- })
- }, null, 8, ["modelValue", "onUpdate:modelValue", "style"]),
- _ctx.data.options.showLabel ? (openBlock(), createBlock(_component_el_input, {
- key: 0,
- modelValue: element.label,
- "onUpdate:modelValue": ($event) => element.label = $event,
- class: "ml-1",
- style: {
- width: "90px"
- }
- }, null, 8, ["modelValue", "onUpdate:modelValue"])) : createCommentVNode("", true)
- ]),
- _: 2
- }, 1032, ["label"]),
- _hoisted_9$1,
- createVNode(_component_el_button, {
- type: "primary",
- circle: "",
- onClick: ($event) => _ctx.handleOptionsRemove(index)
- }, {
- default: withCtx(() => [
- _hoisted_10$1
- ]),
- _: 2
- }, 1032, ["onClick"])
- ])
- ]),
- _: 1
- }, 8, ["list"])
- ]),
- _: 1
- }, 8, ["modelValue"])) : createCommentVNode("", true),
- _ctx.data.type === "checkbox" || _ctx.data.type === "select" && _ctx.data.options.multiple ? (openBlock(), createBlock(_component_el_checkbox_group, {
- key: 1,
- modelValue: _ctx.data.options.defaultValue,
- "onUpdate:modelValue": _cache[37] || (_cache[37] = ($event) => _ctx.data.options.defaultValue = $event),
- style: { "margin-top": "8px" }
- }, {
- default: withCtx(() => [
- createVNode(_component_Draggable, {
- "item-key": "index",
- "ghost-class": "ghost",
- handle: "[cursor-move]",
- group: { name: "options" },
- list: _ctx.data.options.options
- }, {
- item: withCtx(({ element, index }) => [
- createElementVNode("div", _hoisted_11$1, [
- createVNode(_component_el_checkbox, {
- label: element.value
- }, {
- default: withCtx(() => [
- _hoisted_12$1
- ]),
- _: 2
- }, 1032, ["label"]),
- createVNode(_component_el_input, {
- modelValue: element.value,
- "onUpdate:modelValue": ($event) => element.value = $event,
- style: normalizeStyle({
- width: _ctx.data.options.showLabel ? "90px" : "180px"
- })
- }, null, 8, ["modelValue", "onUpdate:modelValue", "style"]),
- _ctx.data.options.showLabel ? (openBlock(), createBlock(_component_el_input, {
- key: 0,
- modelValue: element.label,
- "onUpdate:modelValue": ($event) => element.label = $event,
- style: { width: "90px" }
- }, null, 8, ["modelValue", "onUpdate:modelValue"])) : createCommentVNode("", true),
- _hoisted_13$1,
- createVNode(_component_el_button, {
- type: "primary",
- circle: "",
- onClick: ($event) => _ctx.handleOptionsRemove(index)
- }, {
- default: withCtx(() => [
- _hoisted_14$1
- ]),
- _: 2
- }, 1032, ["onClick"])
- ])
- ]),
- _: 1
- }, 8, ["list"])
- ]),
- _: 1
- }, 8, ["modelValue"])) : createCommentVNode("", true),
- createElementVNode("div", _hoisted_15, [
- createVNode(_component_el_button, {
- type: "text",
- onClick: _ctx.handleInsertOption
- }, {
- default: withCtx(() => [
- _hoisted_16
- ]),
- _: 1
- }, 8, ["onClick"])
- ])
- ], 64))
- ]),
- _: 1
- })) : createCommentVNode("", true),
- _ctx.data.type === "time" ? (openBlock(), createBlock(_component_el_form_item, {
- key: 27,
- label: "\u9ED8\u8BA4\u503C"
- }, {
- default: withCtx(() => [
- createVNode(_component_el_time_picker, {
- modelValue: _ctx.data.options.defaultValue,
- "onUpdate:modelValue": _cache[38] || (_cache[38] = ($event) => _ctx.data.options.defaultValue = $event),
- style: { "width": "100%" },
- format: _ctx.data.options.format,
- placeholder: _ctx.data.options.placeholder
- }, null, 8, ["modelValue", "format", "placeholder"])
- ]),
- _: 1
- })) : createCommentVNode("", true),
- _ctx.data.type === "date" ? (openBlock(), createBlock(_component_el_form_item, {
- key: 28,
- label: "\u9ED8\u8BA4\u503C"
- }, {
- default: withCtx(() => [
- createVNode(_component_el_date_picker, {
- modelValue: _ctx.data.options.defaultValue,
- "onUpdate:modelValue": _cache[39] || (_cache[39] = ($event) => _ctx.data.options.defaultValue = $event),
- style: { "width": "100%" },
- format: _ctx.data.options.format,
- placeholder: _ctx.data.options.placeholder
- }, null, 8, ["modelValue", "format", "placeholder"])
- ]),
- _: 1
- })) : createCommentVNode("", true),
- _ctx.data.type === "time" || _ctx.data.type === "date" ? (openBlock(), createBlock(_component_el_form_item, {
- key: 29,
- label: "\u683C\u5F0F"
- }, {
- default: withCtx(() => [
- createVNode(_component_el_input, {
- modelValue: _ctx.data.options.format,
- "onUpdate:modelValue": _cache[40] || (_cache[40] = ($event) => _ctx.data.options.format = $event)
- }, null, 8, ["modelValue"])
- ]),
- _: 1
- })) : createCommentVNode("", true),
- _ctx.data.type === "download" ? (openBlock(), createBlock(_component_el_form_item, {
- key: 30,
- label: "\u5730\u5740"
- }, {
- default: withCtx(() => [
- createVNode(_component_el_input, {
- modelValue: _ctx.data.options.defaultValue,
- "onUpdate:modelValue": _cache[41] || (_cache[41] = ($event) => _ctx.data.options.defaultValue = $event)
- }, null, 8, ["modelValue"])
- ]),
- _: 1
- })) : createCommentVNode("", true),
- _ctx.data.type === "img-upload" ? (openBlock(), createElementBlock(Fragment, { key: 31 }, [
- createVNode(_component_el_form_item, { label: "\u6A21\u5F0F" }, {
- default: withCtx(() => [
- createVNode(_component_el_radio_group, {
- modelValue: _ctx.data.options.listType,
- "onUpdate:modelValue": _cache[42] || (_cache[42] = ($event) => _ctx.data.options.listType = $event)
- }, {
- default: withCtx(() => [
- createVNode(_component_el_radio_button, { label: "text" }, {
- default: withCtx(() => [
- _hoisted_17
- ]),
- _: 1
- }),
- createVNode(_component_el_radio_button, { label: "picture" }, {
- default: withCtx(() => [
- _hoisted_18
- ]),
- _: 1
- }),
- createVNode(_component_el_radio_button, { label: "picture-card" }, {
- default: withCtx(() => [
- _hoisted_19
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["modelValue"])
- ]),
- _: 1
- }),
- createVNode(_component_el_form_item, { label: "\u6587\u4EF6\u53C2\u6570\u540D" }, {
- default: withCtx(() => [
- createVNode(_component_el_input, {
- modelValue: _ctx.data.options.name,
- "onUpdate:modelValue": _cache[43] || (_cache[43] = ($event) => _ctx.data.options.name = $event)
- }, null, 8, ["modelValue"])
- ]),
- _: 1
- }),
- createVNode(_component_el_form_item, { label: "\u4E0A\u4F20\u5730\u5740" }, {
- default: withCtx(() => [
- createVNode(_component_el_input, {
- modelValue: _ctx.data.options.action,
- "onUpdate:modelValue": _cache[44] || (_cache[44] = ($event) => _ctx.data.options.action = $event)
- }, null, 8, ["modelValue"])
- ]),
- _: 1
- }),
- createVNode(_component_el_form_item, { label: "\u63A5\u53D7\u4E0A\u4F20\u7684\u6587\u4EF6\u7C7B\u578B(\u591A\u4E2A\u4F7F\u7528 , \u9694\u5F00)" }, {
- default: withCtx(() => [
- createVNode(_component_el_input, {
- modelValue: _ctx.data.options.accept,
- "onUpdate:modelValue": _cache[45] || (_cache[45] = ($event) => _ctx.data.options.accept = $event)
- }, null, 8, ["modelValue"])
- ]),
- _: 1
- }),
- createVNode(_component_el_form_item, { label: "\u6700\u5927\u4E0A\u4F20\u6570\u91CF" }, {
- default: withCtx(() => [
- createVNode(_component_el_input_number, {
- modelValue: _ctx.data.options.limit,
- "onUpdate:modelValue": _cache[46] || (_cache[46] = ($event) => _ctx.data.options.limit = $event),
- modelModifiers: { number: true },
- min: 1
- }, null, 8, ["modelValue"])
- ]),
- _: 1
- }),
- createVNode(_component_el_form_item, { label: "\u4E0A\u4F20\u8BF7\u6C42\u65B9\u6CD5" }, {
- default: withCtx(() => [
- createVNode(_component_el_radio_group, {
- modelValue: _ctx.data.options.method,
- "onUpdate:modelValue": _cache[47] || (_cache[47] = ($event) => _ctx.data.options.method = $event)
- }, {
- default: withCtx(() => [
- createVNode(_component_el_radio_button, { label: "post" }, {
- default: withCtx(() => [
- _hoisted_20
- ]),
- _: 1
- }),
- createVNode(_component_el_radio_button, { label: "put" }, {
- default: withCtx(() => [
- _hoisted_21
- ]),
- _: 1
- }),
- createVNode(_component_el_radio_button, { label: "get" }, {
- default: withCtx(() => [
- _hoisted_22
- ]),
- _: 1
- }),
- createVNode(_component_el_radio_button, { label: "delete" }, {
- default: withCtx(() => [
- _hoisted_23
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["modelValue"])
- ]),
- _: 1
- })
- ], 64)) : createCommentVNode("", true),
- _ctx.data.type === "cascader" ? (openBlock(), createBlock(_component_el_form_item, {
- key: 32,
- label: "\u8FDC\u7AEF\u6570\u636E"
- }, {
- default: withCtx(() => [
- createVNode(_component_el_space, {
- direction: "vertical",
- alignment: "start"
- }, {
- default: withCtx(() => [
- createVNode(_component_el_input, {
- modelValue: _ctx.data.options.remoteFunc,
- "onUpdate:modelValue": _cache[48] || (_cache[48] = ($event) => _ctx.data.options.remoteFunc = $event)
- }, {
- prepend: withCtx(() => [
- _hoisted_24
- ]),
- _: 1
- }, 8, ["modelValue"]),
- createVNode(_component_el_input, {
- modelValue: _ctx.data.options.props.label,
- "onUpdate:modelValue": _cache[49] || (_cache[49] = ($event) => _ctx.data.options.props.label = $event)
- }, {
- prepend: withCtx(() => [
- _hoisted_25
- ]),
- _: 1
- }, 8, ["modelValue"]),
- createVNode(_component_el_input, {
- modelValue: _ctx.data.options.props.value,
- "onUpdate:modelValue": _cache[50] || (_cache[50] = ($event) => _ctx.data.options.props.value = $event)
- }, {
- prepend: withCtx(() => [
- _hoisted_26
- ]),
- _: 1
- }, 8, ["modelValue"]),
- createVNode(_component_el_input, {
- modelValue: _ctx.data.options.props.children,
- "onUpdate:modelValue": _cache[51] || (_cache[51] = ($event) => _ctx.data.options.props.children = $event)
- }, {
- prepend: withCtx(() => [
- _hoisted_27
- ]),
- _: 1
- }, 8, ["modelValue"])
- ]),
- _: 1
- })
- ]),
- _: 1
- })) : createCommentVNode("", true),
- _ctx.data.type === "table" ? (openBlock(), createElementBlock(Fragment, { key: 33 }, [
- createVNode(_component_el_form_item, { label: "\u5217\u914D\u7F6E\u9879" }, {
- default: withCtx(() => [
- createVNode(_component_Draggable, {
- tag: "ul",
- "item-key": "index",
- "ghost-class": "ghost",
- handle: ".drag-item",
- group: { name: "options" },
- list: _ctx.data.columns
- }, {
- item: withCtx(({ element, index }) => [
- createElementVNode("li", _hoisted_28, [
- _hoisted_29,
- createVNode(_component_el_input, {
- modelValue: element.label,
- "onUpdate:modelValue": ($event) => element.label = $event,
- placeholder: "\u663E\u793A\u540D\u79F0"
- }, null, 8, ["modelValue", "onUpdate:modelValue"]),
- createVNode(_component_el_input, {
- modelValue: element.prop,
- "onUpdate:modelValue": ($event) => element.prop = $event,
- placeholder: "\u5B57\u6BB5\u5B57\u6BB5"
- }, null, 8, ["modelValue", "onUpdate:modelValue"]),
- createVNode(_component_el_button, {
- type: "primary",
- circle: "",
- style: { "margin-left": "5px" },
- onClick: ($event) => _ctx.data.columns.splice(index, 1)
- }, {
- default: withCtx(() => [
- _hoisted_30
- ]),
- _: 2
- }, 1032, ["onClick"])
- ])
- ]),
- _: 1
- }, 8, ["list"]),
- createElementVNode("div", null, [
- createVNode(_component_el_button, {
- type: "text",
- onClick: _cache[52] || (_cache[52] = ($event) => _ctx.data.columns.push({}))
- }, {
- default: withCtx(() => [
- _hoisted_31
- ]),
- _: 1
- })
- ])
- ]),
- _: 1
- }),
- createVNode(_component_el_form_item, { label: "\u5BF9\u9F50\u65B9\u5F0F" }, {
- default: withCtx(() => [
- createVNode(_component_el_radio_group, {
- modelValue: _ctx.data.options.align,
- "onUpdate:modelValue": _cache[53] || (_cache[53] = ($event) => _ctx.data.options.align = $event)
- }, {
- default: withCtx(() => [
- createVNode(_component_el_radio_button, { label: "left" }, {
- default: withCtx(() => [
- _hoisted_32
- ]),
- _: 1
- }),
- createVNode(_component_el_radio_button, { label: "center" }, {
- default: withCtx(() => [
- _hoisted_33
- ]),
- _: 1
- }),
- createVNode(_component_el_radio_button, { label: "right" }, {
- default: withCtx(() => [
- _hoisted_34
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["modelValue"])
- ]),
- _: 1
- })
- ], 64)) : createCommentVNode("", true),
- _ctx.data.type === "grid" ? (openBlock(), createElementBlock(Fragment, { key: 34 }, [
- createVNode(_component_el_form_item, { label: "\u6805\u683C\u95F4\u9694" }, {
- default: withCtx(() => [
- createVNode(_component_el_input_number, {
- modelValue: _ctx.data.options.gutter,
- "onUpdate:modelValue": _cache[54] || (_cache[54] = ($event) => _ctx.data.options.gutter = $event),
- modelModifiers: { number: true },
- min: 0
- }, null, 8, ["modelValue"])
- ]),
- _: 1
- }),
- createVNode(_component_el_form_item, { label: "\u5217\u914D\u7F6E\u9879" }, {
- default: withCtx(() => [
- createVNode(_component_Draggable, {
- tag: "ul",
- "item-key": "index",
- "ghost-class": "ghost",
- handle: ".drag-item",
- group: { name: "options" },
- list: _ctx.data.columns
- }, {
- item: withCtx(({ element, index }) => [
- createElementVNode("li", _hoisted_35, [
- _hoisted_36,
- createVNode(_component_el_input_number, {
- modelValue: element.span,
- "onUpdate:modelValue": ($event) => element.span = $event,
- modelModifiers: { number: true },
- placeholder: "\u6805\u683C\u503C",
- min: 0,
- max: 24
- }, null, 8, ["modelValue", "onUpdate:modelValue"]),
- createVNode(_component_el_button, {
- type: "primary",
- circle: "",
- style: { "margin-left": "5px" },
- onClick: ($event) => _ctx.handleOptionsRemove(index)
- }, {
- default: withCtx(() => [
- _hoisted_37
- ]),
- _: 2
- }, 1032, ["onClick"])
- ])
- ]),
- _: 1
- }, 8, ["list"]),
- createElementVNode("div", null, [
- createVNode(_component_el_button, {
- type: "text",
- onClick: _ctx.handleInsertColumn
- }, {
- default: withCtx(() => [
- _hoisted_38
- ]),
- _: 1
- }, 8, ["onClick"])
- ])
- ]),
- _: 1
- }),
- createVNode(_component_el_form_item, { label: "\u5782\u76F4\u5BF9\u9F50\u65B9\u5F0F" }, {
- default: withCtx(() => [
- createVNode(_component_el_radio_group, {
- modelValue: _ctx.data.options.align,
- "onUpdate:modelValue": _cache[55] || (_cache[55] = ($event) => _ctx.data.options.align = $event)
- }, {
- default: withCtx(() => [
- createVNode(_component_el_radio_button, { label: "initial" }, {
- default: withCtx(() => [
- _hoisted_39
- ]),
- _: 1
- }),
- createVNode(_component_el_radio_button, { label: "center" }, {
- default: withCtx(() => [
- _hoisted_40
- ]),
- _: 1
- }),
- createVNode(_component_el_radio_button, { label: "flex-end" }, {
- default: withCtx(() => [
- _hoisted_41
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["modelValue"])
- ]),
- _: 1
- })
- ], 64)) : createCommentVNode("", true),
- _ctx.data.type !== "grid" ? (openBlock(), createElementBlock(Fragment, { key: 35 }, [
- _ctx.hasKey("rules") || _ctx.hasKey("readonly") || _ctx.hasKey("disabled") || _ctx.hasKey("allowClear") ? (openBlock(), createBlock(_component_el_form_item, {
- key: 0,
- label: "\u64CD\u4F5C\u5C5E\u6027"
- }, {
- default: withCtx(() => [
- _ctx.hasKey("rules") ? (openBlock(), createBlock(_component_el_checkbox, {
- key: 0,
- modelValue: _ctx.data.options.rules.required,
- "onUpdate:modelValue": _cache[56] || (_cache[56] = ($event) => _ctx.data.options.rules.required = $event),
- disabled: _ctx.data.allDisable
- }, {
- default: withCtx(() => [
- _hoisted_42
- ]),
- _: 1
- }, 8, ["modelValue", "disabled"])) : createCommentVNode("", true),
- _ctx.hasKey("readonly") ? (openBlock(), createBlock(_component_el_checkbox, {
- key: 1,
- modelValue: _ctx.data.options.readonly,
- "onUpdate:modelValue": _cache[57] || (_cache[57] = ($event) => _ctx.data.options.readonly = $event),
- disabled: _ctx.data.allDisable
- }, {
- default: withCtx(() => [
- _hoisted_43
- ]),
- _: 1
- }, 8, ["modelValue", "disabled"])) : createCommentVNode("", true),
- _ctx.hasKey("disabled") ? (openBlock(), createBlock(_component_el_checkbox, {
- key: 2,
- modelValue: _ctx.data.options.disabled,
- "onUpdate:modelValue": _cache[58] || (_cache[58] = ($event) => _ctx.data.options.disabled = $event),
- disabled: _ctx.data.allDisable
- }, {
- default: withCtx(() => [
- _hoisted_44
- ]),
- _: 1
- }, 8, ["modelValue", "disabled"])) : createCommentVNode("", true),
- _ctx.hasKey("clearable") ? (openBlock(), createBlock(_component_el_checkbox, {
- key: 3,
- modelValue: _ctx.data.options.clearable,
- "onUpdate:modelValue": _cache[59] || (_cache[59] = ($event) => _ctx.data.options.clearable = $event),
- disabled: _ctx.data.allDisable
- }, {
- default: withCtx(() => [
- _hoisted_45
- ]),
- _: 1
- }, 8, ["modelValue", "disabled"])) : createCommentVNode("", true)
- ]),
- _: 1
- })) : createCommentVNode("", true),
- _ctx.hasKey("rules") ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
- _hoisted_46,
- createVNode(_component_el_form_item, { label: "\u89E6\u53D1\u65F6\u673A" }, {
- default: withCtx(() => [
- createVNode(_component_el_radio_group, {
- modelValue: _ctx.data.options.rules.trigger,
- "onUpdate:modelValue": _cache[60] || (_cache[60] = ($event) => _ctx.data.options.rules.trigger = $event)
- }, {
- default: withCtx(() => [
- createVNode(_component_el_radio_button, { label: "blur" }, {
- default: withCtx(() => [
- _hoisted_47
- ]),
- _: 1
- }),
- createVNode(_component_el_radio_button, { label: "change" }, {
- default: withCtx(() => [
- _hoisted_48
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["modelValue"])
- ]),
- _: 1
- }),
- createVNode(_component_el_form_item, { label: "\u679A\u4E3E\u7C7B\u578B" }, {
- default: withCtx(() => [
- createVNode(_component_el_input, {
- value: _ctx.data.options.rules.enum,
- "onUpdate:value": _cache[61] || (_cache[61] = ($event) => _ctx.data.options.rules.enum = $event)
- }, null, 8, ["value"])
- ]),
- _: 1
- }),
- createVNode(_component_el_form_item, { label: "\u5B57\u6BB5\u957F\u5EA6" }, {
- default: withCtx(() => [
- createVNode(_component_el_input, {
- modelValue: _ctx.data.options.rules.len,
- "onUpdate:modelValue": _cache[62] || (_cache[62] = ($event) => _ctx.data.options.rules.len = $event),
- modelModifiers: { number: true }
- }, null, 8, ["modelValue"])
- ]),
- _: 1
- }),
- createVNode(_component_el_form_item, { label: "\u6700\u5927\u957F\u5EA6" }, {
- default: withCtx(() => [
- createVNode(_component_el_input, {
- modelValue: _ctx.data.options.rules.max,
- "onUpdate:modelValue": _cache[63] || (_cache[63] = ($event) => _ctx.data.options.rules.max = $event),
- modelModifiers: { number: true }
- }, null, 8, ["modelValue"])
- ]),
- _: 1
- }),
- createVNode(_component_el_form_item, { label: "\u6700\u5C0F\u957F\u5EA6" }, {
- default: withCtx(() => [
- createVNode(_component_el_input, {
- modelValue: _ctx.data.options.rules.min,
- "onUpdate:modelValue": _cache[64] || (_cache[64] = ($event) => _ctx.data.options.rules.min = $event),
- modelModifiers: { number: true }
- }, null, 8, ["modelValue"])
- ]),
- _: 1
- }),
- createVNode(_component_el_form_item, { label: "\u6821\u9A8C\u6587\u6848" }, {
- default: withCtx(() => [
- createVNode(_component_el_input, {
- modelValue: _ctx.data.options.rules.message,
- "onUpdate:modelValue": _cache[65] || (_cache[65] = ($event) => _ctx.data.options.rules.message = $event)
- }, null, 8, ["modelValue"])
- ]),
- _: 1
- }),
- createVNode(_component_el_form_item, { label: "\u6B63\u5219\u8868\u8FBE\u5F0F" }, {
- default: withCtx(() => [
- createVNode(_component_el_input, {
- modelValue: _ctx.data.options.rules.pattern,
- "onUpdate:modelValue": _cache[66] || (_cache[66] = ($event) => _ctx.data.options.rules.pattern = $event)
- }, null, 8, ["modelValue"])
- ]),
- _: 1
- }),
- createVNode(_component_el_form_item, { label: "\u6821\u9A8C\u7C7B\u578B" }, {
- default: withCtx(() => [
- createVNode(_component_el_select, {
- modelValue: _ctx.data.options.rules.type,
- "onUpdate:modelValue": _cache[67] || (_cache[67] = ($event) => _ctx.data.options.rules.type = $event)
- }, {
- default: withCtx(() => [
- createVNode(_component_el_option, { value: "string" }, {
- default: withCtx(() => [
- _hoisted_49
- ]),
- _: 1
- }),
- createVNode(_component_el_option, { value: "number" }, {
- default: withCtx(() => [
- _hoisted_50
- ]),
- _: 1
- }),
- createVNode(_component_el_option, { value: "boolean" }, {
- default: withCtx(() => [
- _hoisted_51
- ]),
- _: 1
- }),
- createVNode(_component_el_option, { value: "method" }, {
- default: withCtx(() => [
- _hoisted_52
- ]),
- _: 1
- }),
- createVNode(_component_el_option, { value: "regexp" }, {
- default: withCtx(() => [
- _hoisted_53
- ]),
- _: 1
- }),
- createVNode(_component_el_option, { value: "integer" }, {
- default: withCtx(() => [
- _hoisted_54
- ]),
- _: 1
- }),
- createVNode(_component_el_option, { value: "float" }, {
- default: withCtx(() => [
- _hoisted_55
- ]),
- _: 1
- }),
- createVNode(_component_el_option, { value: "array" }, {
- default: withCtx(() => [
- _hoisted_56
- ]),
- _: 1
- }),
- createVNode(_component_el_option, { value: "object" }, {
- default: withCtx(() => [
- _hoisted_57
- ]),
- _: 1
- }),
- createVNode(_component_el_option, { value: "enum" }, {
- default: withCtx(() => [
- _hoisted_58
- ]),
- _: 1
- }),
- createVNode(_component_el_option, { value: "date" }, {
- default: withCtx(() => [
- _hoisted_59
- ]),
- _: 1
- }),
- createVNode(_component_el_option, { value: "url" }, {
- default: withCtx(() => [
- _hoisted_60
- ]),
- _: 1
- }),
- createVNode(_component_el_option, { value: "hex" }, {
- default: withCtx(() => [
- _hoisted_61
- ]),
- _: 1
- }),
- createVNode(_component_el_option, { value: "email" }, {
- default: withCtx(() => [
- _hoisted_62
- ]),
- _: 1
- }),
- createVNode(_component_el_option, { value: "any" }, {
- default: withCtx(() => [
- _hoisted_63
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["modelValue"])
- ]),
- _: 1
- })
- ], 64)) : createCommentVNode("", true)
- ], 64)) : createCommentVNode("", true)
- ]),
- _: 1
- })) : createCommentVNode("", true);
- }
- var WidgetConfig = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render]]);
- const _hoisted_1$1 = /* @__PURE__ */ createTextVNode(" \u5DE6\u5BF9\u9F50 ");
- const _hoisted_2$1 = /* @__PURE__ */ createTextVNode(" \u53F3\u5BF9\u9F50 ");
- const _hoisted_3$1 = /* @__PURE__ */ createTextVNode(" \u9876\u90E8\u5BF9\u9F50 ");
- const _hoisted_4$1 = /* @__PURE__ */ createTextVNode(" \u5927 ");
- const _hoisted_5$1 = /* @__PURE__ */ createTextVNode(" \u9ED8\u8BA4 ");
- const _hoisted_6$1 = /* @__PURE__ */ createTextVNode(" \u5C0F ");
- const _sfc_main$2 = /* @__PURE__ */ defineComponent({
- props: {
- config: null
- },
- setup(__props) {
- return (_ctx, _cache) => {
- const _component_el_radio_button = ElRadioButton;
- const _component_el_radio_group = ElRadioGroup;
- const _component_el_form_item = ElFormItem;
- const _component_el_input_number = ElInputNumber;
- const _component_el_switch = ElSwitch;
- const _component_el_form = ElForm;
- return openBlock(), createBlock(_component_el_form, {
- "p-2": "",
- "label-position": "top",
- onSubmit: _cache[4] || (_cache[4] = withModifiers(() => {
- }, ["prevent"]))
- }, {
- default: withCtx(() => [
- createVNode(_component_el_form_item, { label: "\u6807\u7B7E\u5BF9\u9F50\u65B9\u5F0F" }, {
- default: withCtx(() => [
- createVNode(_component_el_radio_group, {
- modelValue: __props.config.labelPosition,
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => __props.config.labelPosition = $event)
- }, {
- default: withCtx(() => [
- createVNode(_component_el_radio_button, { label: "left" }, {
- default: withCtx(() => [
- _hoisted_1$1
- ]),
- _: 1
- }),
- createVNode(_component_el_radio_button, { label: "right" }, {
- default: withCtx(() => [
- _hoisted_2$1
- ]),
- _: 1
- }),
- createVNode(_component_el_radio_button, { label: "top" }, {
- default: withCtx(() => [
- _hoisted_3$1
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["modelValue"])
- ]),
- _: 1
- }),
- createVNode(_component_el_form_item, { label: "\u6807\u7B7E\u5BBD\u5EA6" }, {
- default: withCtx(() => [
- createVNode(_component_el_input_number, {
- modelValue: __props.config.labelWidth,
- "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => __props.config.labelWidth = $event),
- modelModifiers: { number: true },
- min: 0
- }, null, 8, ["modelValue"])
- ]),
- _: 1
- }),
- createVNode(_component_el_form_item, { label: "\u7EC4\u4EF6\u5C3A\u5BF8" }, {
- default: withCtx(() => [
- createVNode(_component_el_radio_group, {
- modelValue: __props.config.size,
- "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => __props.config.size = $event)
- }, {
- default: withCtx(() => [
- createVNode(_component_el_radio_button, { label: "large" }, {
- default: withCtx(() => [
- _hoisted_4$1
- ]),
- _: 1
- }),
- createVNode(_component_el_radio_button, { label: "default" }, {
- default: withCtx(() => [
- _hoisted_5$1
- ]),
- _: 1
- }),
- createVNode(_component_el_radio_button, { label: "small" }, {
- default: withCtx(() => [
- _hoisted_6$1
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["modelValue"])
- ]),
- _: 1
- }),
- createVNode(_component_el_form_item, { label: "\u9690\u85CF\u5FC5\u9009\u6807\u8BB0" }, {
- default: withCtx(() => [
- createVNode(_component_el_switch, {
- modelValue: __props.config.hideRequiredAsterisk,
- "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => __props.config.hideRequiredAsterisk = $event)
- }, null, 8, ["modelValue"])
- ]),
- _: 1
- })
- ]),
- _: 1
- });
- };
- }
- });
- function _extends() {
- _extends = Object.assign || function(target) {
- for (var i = 1; i < arguments.length; i++) {
- var source = arguments[i];
- for (var key in source) {
- if (Object.prototype.hasOwnProperty.call(source, key)) {
- target[key] = source[key];
- }
- }
- }
- return target;
- };
- return _extends.apply(this, arguments);
- }
- var KEYCODE_ENTER = 13;
- var KEYCODE_TAB = 9;
- var KEYCODE_BACKSPACE = 8;
- var KEYCODE_Y = 89;
- var KEYCODE_Z = 90;
- var KEYCODE_M = 77;
- var KEYCODE_PARENS = 57;
- var KEYCODE_BRACKETS = 219;
- var KEYCODE_QUOTE = 222;
- var KEYCODE_BACK_QUOTE = 192;
- var KEYCODE_ESCAPE = 27;
- var HISTORY_LIMIT = 100;
- var HISTORY_TIME_GAP = 3e3;
- var isWindows = typeof window !== "undefined" && navigator && /* @__PURE__ */ /Win/i.test(navigator.platform);
- var isMacLike = typeof window !== "undefined" && navigator && /* @__PURE__ */ /(Mac|iPhone|iPod|iPad)/i.test(navigator.platform);
- var PrismEditor = /* @__PURE__ */ defineComponent({
- props: {
- lineNumbers: {
- type: Boolean,
- "default": false
- },
- autoStyleLineNumbers: {
- type: Boolean,
- "default": true
- },
- readonly: {
- type: Boolean,
- "default": false
- },
- modelValue: {
- type: String,
- "default": ""
- },
- highlight: {
- type: Function,
- required: true
- },
- tabSize: {
- type: Number,
- "default": 2
- },
- insertSpaces: {
- type: Boolean,
- "default": true
- },
- ignoreTabKey: {
- type: Boolean,
- "default": false
- },
- placeholder: {
- type: String,
- "default": ""
- }
- },
- data: function data() {
- return {
- capture: true,
- history: {
- stack: [],
- offset: -1
- },
- lineNumbersHeight: "20px",
- codeData: ""
- };
- },
- watch: {
- modelValue: {
- immediate: true,
- handler: function handler(newVal) {
- if (!newVal) {
- this.codeData = "";
- } else {
- this.codeData = newVal;
- }
- }
- },
- content: {
- immediate: true,
- handler: function handler2() {
- var _this = this;
- if (this.lineNumbers) {
- this.$nextTick(function() {
- _this.setLineNumbersHeight();
- });
- }
- }
- },
- lineNumbers: function lineNumbers() {
- var _this2 = this;
- this.$nextTick(function() {
- _this2.styleLineNumbers();
- _this2.setLineNumbersHeight();
- });
- }
- },
- computed: {
- isEmpty: function isEmpty2() {
- return this.codeData.length === 0;
- },
- content: function content() {
- var result = this.highlight(this.codeData) + "<br />";
- return result;
- },
- lineNumbersCount: function lineNumbersCount() {
- var totalLines = this.codeData.split(/\r\n|\n/).length;
- return totalLines;
- }
- },
- mounted: function mounted() {
- this._recordCurrentState();
- this.styleLineNumbers();
- },
- methods: {
- setLineNumbersHeight: function setLineNumbersHeight() {
- this.lineNumbersHeight = getComputedStyle(this.$refs.pre).height;
- },
- styleLineNumbers: function styleLineNumbers() {
- if (!this.lineNumbers || !this.autoStyleLineNumbers)
- return;
- var $editor = this.$refs.pre;
- var $lineNumbers = this.$el.querySelector(".prism-editor__line-numbers");
- var editorStyles = window.getComputedStyle($editor);
- this.$nextTick(function() {
- var btlr = "border-top-left-radius";
- var bblr = "border-bottom-left-radius";
- if (!$lineNumbers)
- return;
- $lineNumbers.style[btlr] = editorStyles[btlr];
- $lineNumbers.style[bblr] = editorStyles[bblr];
- $editor.style[btlr] = "0";
- $editor.style[bblr] = "0";
- var stylesList = ["background-color", "margin-top", "padding-top", "font-family", "font-size", "line-height"];
- stylesList.forEach(function(style) {
- $lineNumbers.style[style] = editorStyles[style];
- });
- $lineNumbers.style["margin-bottom"] = "-" + editorStyles["padding-top"];
- });
- },
- _recordCurrentState: function _recordCurrentState() {
- var input = this.$refs.textarea;
- if (!input)
- return;
- var value = input.value, selectionStart = input.selectionStart, selectionEnd = input.selectionEnd;
- this._recordChange({
- value,
- selectionStart,
- selectionEnd
- });
- },
- _getLines: function _getLines(text, position) {
- return text.substring(0, position).split("\n");
- },
- _applyEdits: function _applyEdits(record) {
- var input = this.$refs.textarea;
- var last = this.history.stack[this.history.offset];
- if (last && input) {
- this.history.stack[this.history.offset] = _extends({}, last, {
- selectionStart: input.selectionStart,
- selectionEnd: input.selectionEnd
- });
- }
- this._recordChange(record);
- this._updateInput(record);
- },
- _recordChange: function _recordChange(record, overwrite) {
- if (overwrite === void 0) {
- overwrite = false;
- }
- var _this$history = this.history, stack = _this$history.stack, offset2 = _this$history.offset;
- if (stack.length && offset2 > -1) {
- this.history.stack = stack.slice(0, offset2 + 1);
- var count = this.history.stack.length;
- if (count > HISTORY_LIMIT) {
- var extras = count - HISTORY_LIMIT;
- this.history.stack = stack.slice(extras, count);
- this.history.offset = Math.max(this.history.offset - extras, 0);
- }
- }
- var timestamp = Date.now();
- if (overwrite) {
- var last = this.history.stack[this.history.offset];
- if (last && timestamp - last.timestamp < HISTORY_TIME_GAP) {
- var _this$_getLines$pop, _this$_getLines$pop2;
- var re = /[^a-z0-9]([a-z0-9]+)$/i;
- 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);
- 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);
- if (previous && current && current[1].startsWith(previous[1])) {
- this.history.stack[this.history.offset] = _extends({}, record, {
- timestamp
- });
- return;
- }
- }
- }
- this.history.stack.push(_extends({}, record, {
- timestamp
- }));
- this.history.offset++;
- },
- _updateInput: function _updateInput(record) {
- var input = this.$refs.textarea;
- if (!input)
- return;
- input.value = record.value;
- input.selectionStart = record.selectionStart;
- input.selectionEnd = record.selectionEnd;
- this.$emit("update:modelValue", record.value);
- },
- handleChange: function handleChange(e) {
- var _e$target = e.target, value = _e$target.value, selectionStart = _e$target.selectionStart, selectionEnd = _e$target.selectionEnd;
- this._recordChange({
- value,
- selectionStart,
- selectionEnd
- }, true);
- this.$emit("update:modelValue", value);
- },
- _undoEdit: function _undoEdit() {
- var _this$history2 = this.history, stack = _this$history2.stack, offset2 = _this$history2.offset;
- var record = stack[offset2 - 1];
- if (record) {
- this._updateInput(record);
- this.history.offset = Math.max(offset2 - 1, 0);
- }
- },
- _redoEdit: function _redoEdit() {
- var _this$history3 = this.history, stack = _this$history3.stack, offset2 = _this$history3.offset;
- var record = stack[offset2 + 1];
- if (record) {
- this._updateInput(record);
- this.history.offset = Math.min(offset2 + 1, stack.length - 1);
- }
- },
- handleKeyDown: function handleKeyDown(e) {
- var tabSize = this.tabSize, insertSpaces = this.insertSpaces, ignoreTabKey = this.ignoreTabKey;
- this.$emit("keydown", e);
- if (e.defaultPrevented) {
- return;
- }
- if (e.keyCode === KEYCODE_ESCAPE) {
- e.target.blur();
- this.$emit("blur", e);
- }
- var _e$target2 = e.target, value = _e$target2.value, selectionStart = _e$target2.selectionStart, selectionEnd = _e$target2.selectionEnd;
- var tabCharacter = (insertSpaces ? " " : " ").repeat(tabSize);
- if (e.keyCode === KEYCODE_TAB && !ignoreTabKey && this.capture) {
- e.preventDefault();
- if (e.shiftKey) {
- var linesBeforeCaret = this._getLines(value, selectionStart);
- var startLine = linesBeforeCaret.length - 1;
- var endLine = this._getLines(value, selectionEnd).length - 1;
- var nextValue = value.split("\n").map(function(line2, i) {
- if (i >= startLine && i <= endLine && line2.startsWith(tabCharacter)) {
- return line2.substring(tabCharacter.length);
- }
- return line2;
- }).join("\n");
- if (value !== nextValue) {
- var startLineText = linesBeforeCaret[startLine];
- this._applyEdits({
- value: nextValue,
- selectionStart: startLineText.startsWith(tabCharacter) ? selectionStart - tabCharacter.length : selectionStart,
- selectionEnd: selectionEnd - (value.length - nextValue.length)
- });
- }
- } else if (selectionStart !== selectionEnd) {
- var _linesBeforeCaret = this._getLines(value, selectionStart);
- var _startLine = _linesBeforeCaret.length - 1;
- var _endLine = this._getLines(value, selectionEnd).length - 1;
- var _startLineText = _linesBeforeCaret[_startLine];
- this._applyEdits({
- value: value.split("\n").map(function(line2, i) {
- if (i >= _startLine && i <= _endLine) {
- return tabCharacter + line2;
- }
- return line2;
- }).join("\n"),
- selectionStart: /\S/.test(_startLineText) ? selectionStart + tabCharacter.length : selectionStart,
- selectionEnd: selectionEnd + tabCharacter.length * (_endLine - _startLine + 1)
- });
- } else {
- var updatedSelection = selectionStart + tabCharacter.length;
- this._applyEdits({
- value: value.substring(0, selectionStart) + tabCharacter + value.substring(selectionEnd),
- selectionStart: updatedSelection,
- selectionEnd: updatedSelection
- });
- }
- } else if (e.keyCode === KEYCODE_BACKSPACE) {
- var hasSelection = selectionStart !== selectionEnd;
- var textBeforeCaret = value.substring(0, selectionStart);
- if (textBeforeCaret.endsWith(tabCharacter) && !hasSelection) {
- e.preventDefault();
- var _updatedSelection = selectionStart - tabCharacter.length;
- this._applyEdits({
- value: value.substring(0, selectionStart - tabCharacter.length) + value.substring(selectionEnd),
- selectionStart: _updatedSelection,
- selectionEnd: _updatedSelection
- });
- }
- } else if (e.keyCode === KEYCODE_ENTER) {
- if (selectionStart === selectionEnd) {
- var line = this._getLines(value, selectionStart).pop();
- var matches = line === null || line === void 0 ? void 0 : line.match(/^\s+/);
- if (matches && matches[0]) {
- e.preventDefault();
- var indent = "\n" + matches[0];
- var _updatedSelection2 = selectionStart + indent.length;
- this._applyEdits({
- value: value.substring(0, selectionStart) + indent + value.substring(selectionEnd),
- selectionStart: _updatedSelection2,
- selectionEnd: _updatedSelection2
- });
- }
- }
- } else if (e.keyCode === KEYCODE_PARENS || e.keyCode === KEYCODE_BRACKETS || e.keyCode === KEYCODE_QUOTE || e.keyCode === KEYCODE_BACK_QUOTE) {
- var chars;
- if (e.keyCode === KEYCODE_PARENS && e.shiftKey) {
- chars = ["(", ")"];
- } else if (e.keyCode === KEYCODE_BRACKETS) {
- if (e.shiftKey) {
- chars = ["{", "}"];
- } else {
- chars = ["[", "]"];
- }
- } else if (e.keyCode === KEYCODE_QUOTE) {
- if (e.shiftKey) {
- chars = ['"', '"'];
- } else {
- chars = ["'", "'"];
- }
- } else if (e.keyCode === KEYCODE_BACK_QUOTE && !e.shiftKey) {
- chars = ["`", "`"];
- }
- if (selectionStart !== selectionEnd && chars) {
- e.preventDefault();
- this._applyEdits({
- value: value.substring(0, selectionStart) + chars[0] + value.substring(selectionStart, selectionEnd) + chars[1] + value.substring(selectionEnd),
- selectionStart,
- selectionEnd: selectionEnd + 2
- });
- }
- } else if ((isMacLike ? e.metaKey && e.keyCode === KEYCODE_Z : e.ctrlKey && e.keyCode === KEYCODE_Z) && !e.shiftKey && !e.altKey) {
- e.preventDefault();
- this._undoEdit();
- } 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) {
- e.preventDefault();
- this._redoEdit();
- } else if (e.keyCode === KEYCODE_M && e.ctrlKey && (isMacLike ? e.shiftKey : true)) {
- e.preventDefault();
- this.capture = !this.capture;
- }
- }
- },
- render: function render() {
- var _this3 = this;
- var lineNumberWidthCalculator = h$1("div", {
- "class": "prism-editor__line-width-calc",
- style: "height: 0px; visibility: hidden; pointer-events: none;"
- }, "999");
- var lineNumbers2 = h$1("div", {
- "class": "prism-editor__line-numbers",
- style: {
- "min-height": this.lineNumbersHeight
- },
- "aria-hidden": "true"
- }, [lineNumberWidthCalculator, Array.from(Array(this.lineNumbersCount).keys()).map(function(_2, index) {
- return h$1("div", {
- "class": "prism-editor__line-number token comment"
- }, "" + ++index);
- })]);
- var textarea = h$1("textarea", {
- ref: "textarea",
- onInput: this.handleChange,
- onKeydown: this.handleKeyDown,
- onClick: function onClick($event) {
- _this3.$emit("click", $event);
- },
- onKeyup: function onKeyup($event) {
- _this3.$emit("keyup", $event);
- },
- onFocus: function onFocus($event) {
- _this3.$emit("focus", $event);
- },
- onBlur: function onBlur($event) {
- _this3.$emit("blur", $event);
- },
- "class": {
- "prism-editor__textarea": true,
- "prism-editor__textarea--empty": this.isEmpty
- },
- spellCheck: "false",
- autocapitalize: "off",
- autocomplete: "off",
- autocorrect: "off",
- "data-gramm": "false",
- placeholder: this.placeholder,
- "data-testid": "textarea",
- readonly: this.readonly,
- value: this.codeData
- });
- var preview = h$1("pre", {
- ref: "pre",
- "class": "prism-editor__editor",
- "data-testid": "preview",
- innerHTML: this.content
- });
- var editorContainer = h$1("div", {
- "class": "prism-editor__container"
- }, [textarea, preview]);
- return h$1("div", {
- "class": "prism-editor-wrapper"
- }, [this.lineNumbers && lineNumbers2, editorContainer]);
- }
- });
- var prismeditor_min = "";
- var prismCore = { exports: {} };
- (function(module2) {
- var _self = typeof window !== "undefined" ? window : typeof WorkerGlobalScope !== "undefined" && self instanceof WorkerGlobalScope ? self : {};
- /**
- * Prism: Lightweight, robust, elegant syntax highlighting
- *
- * @license MIT <https://opensource.org/licenses/MIT>
- * @author Lea Verou <https://lea.verou.me>
- * @namespace
- * @public
- */
- var Prism2 = function(_self2) {
- var lang = /(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i;
- var uniqueId = 0;
- var plainTextGrammar = {};
- var _2 = {
- manual: _self2.Prism && _self2.Prism.manual,
- disableWorkerMessageHandler: _self2.Prism && _self2.Prism.disableWorkerMessageHandler,
- util: {
- encode: function encode(tokens) {
- if (tokens instanceof Token) {
- return new Token(tokens.type, encode(tokens.content), tokens.alias);
- } else if (Array.isArray(tokens)) {
- return tokens.map(encode);
- } else {
- return tokens.replace(/&/g, "&").replace(/</g, "<").replace(/\u00a0/g, " ");
- }
- },
- type: function(o2) {
- return Object.prototype.toString.call(o2).slice(8, -1);
- },
- objId: function(obj) {
- if (!obj["__id"]) {
- Object.defineProperty(obj, "__id", { value: ++uniqueId });
- }
- return obj["__id"];
- },
- clone: function deepClone(o2, visited) {
- visited = visited || {};
- var clone2;
- var id;
- switch (_2.util.type(o2)) {
- case "Object":
- id = _2.util.objId(o2);
- if (visited[id]) {
- return visited[id];
- }
- clone2 = {};
- visited[id] = clone2;
- for (var key in o2) {
- if (o2.hasOwnProperty(key)) {
- clone2[key] = deepClone(o2[key], visited);
- }
- }
- return clone2;
- case "Array":
- id = _2.util.objId(o2);
- if (visited[id]) {
- return visited[id];
- }
- clone2 = [];
- visited[id] = clone2;
- o2.forEach(function(v2, i) {
- clone2[i] = deepClone(v2, visited);
- });
- return clone2;
- default:
- return o2;
- }
- },
- getLanguage: function(element) {
- while (element) {
- var m2 = lang.exec(element.className);
- if (m2) {
- return m2[1].toLowerCase();
- }
- element = element.parentElement;
- }
- return "none";
- },
- setLanguage: function(element, language) {
- element.className = element.className.replace(RegExp(lang, "gi"), "");
- element.classList.add("language-" + language);
- },
- currentScript: function() {
- if (typeof document === "undefined") {
- return null;
- }
- if ("currentScript" in document && 1 < 2) {
- return document.currentScript;
- }
- try {
- throw new Error();
- } catch (err) {
- var src = (/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(err.stack) || [])[1];
- if (src) {
- var scripts = document.getElementsByTagName("script");
- for (var i in scripts) {
- if (scripts[i].src == src) {
- return scripts[i];
- }
- }
- }
- return null;
- }
- },
- isActive: function(element, className, defaultActivation) {
- var no = "no-" + className;
- while (element) {
- var classList = element.classList;
- if (classList.contains(className)) {
- return true;
- }
- if (classList.contains(no)) {
- return false;
- }
- element = element.parentElement;
- }
- return !!defaultActivation;
- }
- },
- languages: {
- plain: plainTextGrammar,
- plaintext: plainTextGrammar,
- text: plainTextGrammar,
- txt: plainTextGrammar,
- extend: function(id, redef) {
- var lang2 = _2.util.clone(_2.languages[id]);
- for (var key in redef) {
- lang2[key] = redef[key];
- }
- return lang2;
- },
- insertBefore: function(inside, before, insert, root2) {
- root2 = root2 || _2.languages;
- var grammar = root2[inside];
- var ret = {};
- for (var token in grammar) {
- if (grammar.hasOwnProperty(token)) {
- if (token == before) {
- for (var newToken in insert) {
- if (insert.hasOwnProperty(newToken)) {
- ret[newToken] = insert[newToken];
- }
- }
- }
- if (!insert.hasOwnProperty(token)) {
- ret[token] = grammar[token];
- }
- }
- }
- var old = root2[inside];
- root2[inside] = ret;
- _2.languages.DFS(_2.languages, function(key, value) {
- if (value === old && key != inside) {
- this[key] = ret;
- }
- });
- return ret;
- },
- DFS: function DFS(o2, callback, type4, visited) {
- visited = visited || {};
- var objId = _2.util.objId;
- for (var i in o2) {
- if (o2.hasOwnProperty(i)) {
- callback.call(o2, i, o2[i], type4 || i);
- var property = o2[i];
- var propertyType = _2.util.type(property);
- if (propertyType === "Object" && !visited[objId(property)]) {
- visited[objId(property)] = true;
- DFS(property, callback, null, visited);
- } else if (propertyType === "Array" && !visited[objId(property)]) {
- visited[objId(property)] = true;
- DFS(property, callback, i, visited);
- }
- }
- }
- }
- },
- plugins: {},
- highlightAll: function(async, callback) {
- _2.highlightAllUnder(document, async, callback);
- },
- highlightAllUnder: function(container, async, callback) {
- var env = {
- callback,
- container,
- selector: 'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'
- };
- _2.hooks.run("before-highlightall", env);
- env.elements = Array.prototype.slice.apply(env.container.querySelectorAll(env.selector));
- _2.hooks.run("before-all-elements-highlight", env);
- for (var i = 0, element; element = env.elements[i++]; ) {
- _2.highlightElement(element, async === true, env.callback);
- }
- },
- highlightElement: function(element, async, callback) {
- var language = _2.util.getLanguage(element);
- var grammar = _2.languages[language];
- _2.util.setLanguage(element, language);
- var parent = element.parentElement;
- if (parent && parent.nodeName.toLowerCase() === "pre") {
- _2.util.setLanguage(parent, language);
- }
- var code = element.textContent;
- var env = {
- element,
- language,
- grammar,
- code
- };
- function insertHighlightedCode(highlightedCode) {
- env.highlightedCode = highlightedCode;
- _2.hooks.run("before-insert", env);
- env.element.innerHTML = env.highlightedCode;
- _2.hooks.run("after-highlight", env);
- _2.hooks.run("complete", env);
- callback && callback.call(env.element);
- }
- _2.hooks.run("before-sanity-check", env);
- parent = env.element.parentElement;
- if (parent && parent.nodeName.toLowerCase() === "pre" && !parent.hasAttribute("tabindex")) {
- parent.setAttribute("tabindex", "0");
- }
- if (!env.code) {
- _2.hooks.run("complete", env);
- callback && callback.call(env.element);
- return;
- }
- _2.hooks.run("before-highlight", env);
- if (!env.grammar) {
- insertHighlightedCode(_2.util.encode(env.code));
- return;
- }
- if (async && _self2.Worker) {
- var worker = new Worker(_2.filename);
- worker.onmessage = function(evt) {
- insertHighlightedCode(evt.data);
- };
- worker.postMessage(JSON.stringify({
- language: env.language,
- code: env.code,
- immediateClose: true
- }));
- } else {
- insertHighlightedCode(_2.highlight(env.code, env.grammar, env.language));
- }
- },
- highlight: function(text, grammar, language) {
- var env = {
- code: text,
- grammar,
- language
- };
- _2.hooks.run("before-tokenize", env);
- if (!env.grammar) {
- throw new Error('The language "' + env.language + '" has no grammar.');
- }
- env.tokens = _2.tokenize(env.code, env.grammar);
- _2.hooks.run("after-tokenize", env);
- return Token.stringify(_2.util.encode(env.tokens), env.language);
- },
- tokenize: function(text, grammar) {
- var rest = grammar.rest;
- if (rest) {
- for (var token in rest) {
- grammar[token] = rest[token];
- }
- delete grammar.rest;
- }
- var tokenList = new LinkedList();
- addAfter(tokenList, tokenList.head, text);
- matchGrammar(text, tokenList, grammar, tokenList.head, 0);
- return toArray(tokenList);
- },
- hooks: {
- all: {},
- add: function(name, callback) {
- var hooks = _2.hooks.all;
- hooks[name] = hooks[name] || [];
- hooks[name].push(callback);
- },
- run: function(name, env) {
- var callbacks = _2.hooks.all[name];
- if (!callbacks || !callbacks.length) {
- return;
- }
- for (var i = 0, callback; callback = callbacks[i++]; ) {
- callback(env);
- }
- }
- },
- Token
- };
- _self2.Prism = _2;
- function Token(type4, content2, alias, matchedStr) {
- this.type = type4;
- this.content = content2;
- this.alias = alias;
- this.length = (matchedStr || "").length | 0;
- }
- Token.stringify = function stringify(o2, language) {
- if (typeof o2 == "string") {
- return o2;
- }
- if (Array.isArray(o2)) {
- var s2 = "";
- o2.forEach(function(e) {
- s2 += stringify(e, language);
- });
- return s2;
- }
- var env = {
- type: o2.type,
- content: stringify(o2.content, language),
- tag: "span",
- classes: ["token", o2.type],
- attributes: {},
- language
- };
- var aliases = o2.alias;
- if (aliases) {
- if (Array.isArray(aliases)) {
- Array.prototype.push.apply(env.classes, aliases);
- } else {
- env.classes.push(aliases);
- }
- }
- _2.hooks.run("wrap", env);
- var attributes = "";
- for (var name in env.attributes) {
- attributes += " " + name + '="' + (env.attributes[name] || "").replace(/"/g, """) + '"';
- }
- return "<" + env.tag + ' class="' + env.classes.join(" ") + '"' + attributes + ">" + env.content + "</" + env.tag + ">";
- };
- function matchPattern(pattern4, pos, text, lookbehind) {
- pattern4.lastIndex = pos;
- var match = pattern4.exec(text);
- if (match && lookbehind && match[1]) {
- var lookbehindLength = match[1].length;
- match.index += lookbehindLength;
- match[0] = match[0].slice(lookbehindLength);
- }
- return match;
- }
- function matchGrammar(text, tokenList, grammar, startNode, startPos, rematch) {
- for (var token in grammar) {
- if (!grammar.hasOwnProperty(token) || !grammar[token]) {
- continue;
- }
- var patterns = grammar[token];
- patterns = Array.isArray(patterns) ? patterns : [patterns];
- for (var j = 0; j < patterns.length; ++j) {
- if (rematch && rematch.cause == token + "," + j) {
- return;
- }
- var patternObj = patterns[j];
- var inside = patternObj.inside;
- var lookbehind = !!patternObj.lookbehind;
- var greedy = !!patternObj.greedy;
- var alias = patternObj.alias;
- if (greedy && !patternObj.pattern.global) {
- var flags = patternObj.pattern.toString().match(/[imsuy]*$/)[0];
- patternObj.pattern = RegExp(patternObj.pattern.source, flags + "g");
- }
- var pattern4 = patternObj.pattern || patternObj;
- for (var currentNode = startNode.next, pos = startPos; currentNode !== tokenList.tail; pos += currentNode.value.length, currentNode = currentNode.next) {
- if (rematch && pos >= rematch.reach) {
- break;
- }
- var str = currentNode.value;
- if (tokenList.length > text.length) {
- return;
- }
- if (str instanceof Token) {
- continue;
- }
- var removeCount = 1;
- var match;
- if (greedy) {
- match = matchPattern(pattern4, pos, text, lookbehind);
- if (!match || match.index >= text.length) {
- break;
- }
- var from = match.index;
- var to = match.index + match[0].length;
- var p2 = pos;
- p2 += currentNode.value.length;
- while (from >= p2) {
- currentNode = currentNode.next;
- p2 += currentNode.value.length;
- }
- p2 -= currentNode.value.length;
- pos = p2;
- if (currentNode.value instanceof Token) {
- continue;
- }
- for (var k = currentNode; k !== tokenList.tail && (p2 < to || typeof k.value === "string"); k = k.next) {
- removeCount++;
- p2 += k.value.length;
- }
- removeCount--;
- str = text.slice(pos, p2);
- match.index -= pos;
- } else {
- match = matchPattern(pattern4, 0, str, lookbehind);
- if (!match) {
- continue;
- }
- }
- var from = match.index;
- var matchStr = match[0];
- var before = str.slice(0, from);
- var after = str.slice(from + matchStr.length);
- var reach = pos + str.length;
- if (rematch && reach > rematch.reach) {
- rematch.reach = reach;
- }
- var removeFrom = currentNode.prev;
- if (before) {
- removeFrom = addAfter(tokenList, removeFrom, before);
- pos += before.length;
- }
- removeRange(tokenList, removeFrom, removeCount);
- var wrapped = new Token(token, inside ? _2.tokenize(matchStr, inside) : matchStr, alias, matchStr);
- currentNode = addAfter(tokenList, removeFrom, wrapped);
- if (after) {
- addAfter(tokenList, currentNode, after);
- }
- if (removeCount > 1) {
- var nestedRematch = {
- cause: token + "," + j,
- reach
- };
- matchGrammar(text, tokenList, grammar, currentNode.prev, pos, nestedRematch);
- if (rematch && nestedRematch.reach > rematch.reach) {
- rematch.reach = nestedRematch.reach;
- }
- }
- }
- }
- }
- }
- function LinkedList() {
- var head = { value: null, prev: null, next: null };
- var tail = { value: null, prev: head, next: null };
- head.next = tail;
- this.head = head;
- this.tail = tail;
- this.length = 0;
- }
- function addAfter(list, node, value) {
- var next = node.next;
- var newNode = { value, prev: node, next };
- node.next = newNode;
- next.prev = newNode;
- list.length++;
- return newNode;
- }
- function removeRange(list, node, count) {
- var next = node.next;
- for (var i = 0; i < count && next !== list.tail; i++) {
- next = next.next;
- }
- node.next = next;
- next.prev = node;
- list.length -= i;
- }
- function toArray(list) {
- var array4 = [];
- var node = list.head.next;
- while (node !== list.tail) {
- array4.push(node.value);
- node = node.next;
- }
- return array4;
- }
- if (!_self2.document) {
- if (!_self2.addEventListener) {
- return _2;
- }
- if (!_2.disableWorkerMessageHandler) {
- _self2.addEventListener("message", function(evt) {
- var message = JSON.parse(evt.data);
- var lang2 = message.language;
- var code = message.code;
- var immediateClose = message.immediateClose;
- _self2.postMessage(_2.highlight(code, _2.languages[lang2], lang2));
- if (immediateClose) {
- _self2.close();
- }
- }, false);
- }
- return _2;
- }
- var script = _2.util.currentScript();
- if (script) {
- _2.filename = script.src;
- if (script.hasAttribute("data-manual")) {
- _2.manual = true;
- }
- }
- function highlightAutomaticallyCallback() {
- if (!_2.manual) {
- _2.highlightAll();
- }
- }
- if (!_2.manual) {
- var readyState = document.readyState;
- if (readyState === "loading" || readyState === "interactive" && script && script.defer) {
- document.addEventListener("DOMContentLoaded", highlightAutomaticallyCallback);
- } else {
- if (window.requestAnimationFrame) {
- window.requestAnimationFrame(highlightAutomaticallyCallback);
- } else {
- window.setTimeout(highlightAutomaticallyCallback, 16);
- }
- }
- }
- return _2;
- }(_self);
- if (module2.exports) {
- module2.exports = Prism2;
- }
- if (typeof commonjsGlobal !== "undefined") {
- commonjsGlobal.Prism = Prism2;
- }
- })(prismCore);
- Prism.languages.clike = {
- "comment": [
- {
- pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
- lookbehind: true,
- greedy: true
- },
- {
- pattern: /(^|[^\\:])\/\/.*/,
- lookbehind: true,
- greedy: true
- }
- ],
- "string": {
- pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
- greedy: true
- },
- "class-name": {
- pattern: /(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,
- lookbehind: true,
- inside: {
- "punctuation": /[.\\]/
- }
- },
- "keyword": /\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,
- "boolean": /\b(?:false|true)\b/,
- "function": /\b\w+(?=\()/,
- "number": /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
- "operator": /[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,
- "punctuation": /[{}[\];(),.:]/
- };
- Prism.languages.json = {
- "property": {
- pattern: /(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,
- lookbehind: true,
- greedy: true
- },
- "string": {
- pattern: /(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,
- lookbehind: true,
- greedy: true
- },
- "comment": {
- pattern: /\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,
- greedy: true
- },
- "number": /-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,
- "punctuation": /[{}[\],]/,
- "operator": /:/,
- "boolean": /\b(?:false|true)\b/,
- "null": {
- pattern: /\bnull\b/,
- alias: "keyword"
- }
- };
- Prism.languages.webmanifest = Prism.languages.json;
- var prismTomorrow = "";
- var CodeEditor_vue_vue_type_style_index_0_lang = "";
- const _sfc_main$1 = /* @__PURE__ */ defineComponent({
- props: {
- modelValue: { default: "" },
- language: { default: "json" },
- readonly: { type: Boolean, default: false }
- },
- emits: ["update:modelValue"],
- setup(__props, { emit }) {
- const code = computed({
- get() {
- return __props.modelValue;
- },
- set(val) {
- emit("update:modelValue", val);
- }
- });
- return (_ctx, _cache) => {
- return openBlock(), createBlock(unref(PrismEditor), {
- modelValue: code.value,
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => code.value = $event),
- "max-h-xl": "",
- class: "form-design-editor",
- highlight: (code2) => {
- return unref(prismCore.exports.highlight)(code2, unref(prismCore.exports.languages)[__props.language]);
- },
- readonly: __props.readonly,
- "line-numbers": ""
- }, null, 8, ["modelValue", "highlight", "readonly"]);
- };
- }
- });
- var DesignForm_vue_vue_type_style_index_0_lang = "";
- const _hoisted_1 = {
- "h-full": "",
- "bg-white": "",
- flex: ""
- };
- const _hoisted_2 = {
- "pt-2": "",
- "w-62": ""
- };
- const _hoisted_3 = {
- border: "0 x solid gray-200",
- flex: "~ 1 col nowrap"
- };
- const _hoisted_4 = {
- border: "0 b solid gray-200",
- flex: "",
- "gap-2": "",
- "items-center": "",
- "justify-end": "",
- "h-11": "",
- "py-0": "",
- "px-2": ""
- };
- const _hoisted_5 = /* @__PURE__ */ createElementVNode("i", { class: "ep:edit" }, null, -1);
- const _hoisted_6 = /* @__PURE__ */ createTextVNode("\u4FEE\u6539 ");
- const _hoisted_7 = /* @__PURE__ */ createElementVNode("i", { class: "custom:clearable" }, null, -1);
- const _hoisted_8 = /* @__PURE__ */ createTextVNode("\u6E05\u7A7A ");
- const _hoisted_9 = /* @__PURE__ */ createElementVNode("i", { class: "custom:preview" }, null, -1);
- const _hoisted_10 = /* @__PURE__ */ createTextVNode("\u9884\u89C8 ");
- const _hoisted_11 = {
- relative: "",
- "w-75": "",
- flex: "~ col"
- };
- const _hoisted_12 = {
- border: "0 b-1 gray-200",
- grid: "~ cols-2",
- "min-h-11": "",
- "px-2": ""
- };
- const _hoisted_13 = /* @__PURE__ */ createTextVNode(" \u590D\u5236 ");
- const _hoisted_14 = /* @__PURE__ */ createTextVNode(" \u786E\u8BA4\u4FEE\u6539 ");
- const __default__ = { name: "DesignForm" };
- const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__), {
- props: {
- preview: {
- type: Boolean,
- default: true
- },
- generateJson: {
- type: Boolean,
- default: true
- },
- clearable: {
- type: Boolean,
- default: true
- },
- basicFieldsList: {
- type: Array,
- default: () => basicFields
- },
- advanceFieldsList: {
- type: Array,
- default: () => advanceFields
- },
- layoutFieldsList: {
- type: Array,
- default: () => layoutFields
- },
- request: {
- type: Function
- }
- },
- setup(__props, { expose }) {
- let tab = ref(0);
- let selectWidget = ref();
- watch(() => selectWidget.value, (val) => {
- tab.value = val ? 0 : 1;
- });
- let widgetForm = ref(getWidgetForm());
- let generateJsonVisible = ref(false);
- let generateJsonTemplate = ref(JSON.stringify(getWidgetForm(), null, 2));
- const handleUploadJson = () => {
- var _a2;
- try {
- widgetForm.value = JSON.parse(generateJsonTemplate.value);
- selectWidget.value = (_a2 = widgetForm.value.list) == null ? void 0 : _a2[0];
- generateJsonVisible.value = false;
- ElMessage.success("\u4FEE\u6539\u6210\u529F");
- } catch (error) {
- ElMessage.error("\u4FEE\u6539\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5JSON\u683C\u5F0F\u662F\u5426\u6B63\u786E\u3002");
- }
- };
- const handleGenerateJson = () => (generateJsonTemplate.value = JSON.stringify(widgetForm.value, null, 2)) && (generateJsonVisible.value = true);
- const handleClearable = () => {
- widgetForm.value = getWidgetForm();
- selectWidget.value = void 0;
- };
- let dataVisible = ref(false);
- const generateFormRef = ref(null);
- const handleGetData = async () => {
- var _a2;
- dataVisible.value = !dataVisible.value;
- if (!dataVisible.value)
- return;
- const res = await ((_a2 = generateFormRef.value) == null ? void 0 : _a2.getData());
- generateJsonTemplate.value = JSON.stringify(res, null, 2);
- };
- const handleReset = () => {
- var _a2;
- return (_a2 = generateFormRef.value) == null ? void 0 : _a2.reset();
- };
- const handleCopyClick = (text) => {
- navigator.clipboard.writeText(text);
- ElMessage.success({ message: "Copy\u6210\u529F" });
- };
- const previewVisible = ref(false);
- expose({
- getJson: () => widgetForm.value,
- setJson: (json) => {
- var _a2;
- widgetForm.value = json;
- selectWidget.value = (_a2 = json.list) == null ? void 0 : _a2[0];
- },
- clear: handleClearable
- });
- return (_ctx, _cache) => {
- const _component_el_button = ElButton;
- const _component_el_dialog = ElDialog;
- return openBlock(), createElementBlock("section", _hoisted_1, [
- createElementVNode("aside", _hoisted_2, [
- createVNode(_sfc_main$6, {
- title: "\u57FA\u7840\u5B57\u6BB5",
- fields: __props.basicFieldsList,
- list: unref(basicComponents),
- allList: widgetForm.value
- }, null, 8, ["fields", "list", "allList"]),
- createVNode(_sfc_main$6, {
- title: "\u9AD8\u7EA7\u5B57\u6BB5",
- fields: __props.advanceFieldsList,
- list: unref(advanceComponents),
- allList: widgetForm.value
- }, null, 8, ["fields", "list", "allList"]),
- createVNode(_sfc_main$6, {
- title: "\u5E03\u5C40\u5B57\u6BB5",
- fields: __props.layoutFieldsList,
- list: unref(layoutComponents),
- allList: widgetForm.value
- }, null, 8, ["fields", "list", "allList"])
- ]),
- createElementVNode("main", _hoisted_3, [
- createElementVNode("header", _hoisted_4, [
- renderSlot(_ctx.$slots, "default"),
- __props.generateJson ? (openBlock(), createBlock(_component_el_button, {
- key: 0,
- type: "text",
- onClick: handleGenerateJson
- }, {
- icon: withCtx(() => [
- _hoisted_5
- ]),
- default: withCtx(() => [
- _hoisted_6
- ]),
- _: 1
- })) : createCommentVNode("", true),
- __props.clearable ? (openBlock(), createBlock(_component_el_button, {
- key: 1,
- type: "text",
- onClick: handleClearable
- }, {
- icon: withCtx(() => [
- _hoisted_7
- ]),
- default: withCtx(() => [
- _hoisted_8
- ]),
- _: 1
- })) : createCommentVNode("", true),
- __props.preview ? (openBlock(), createBlock(_component_el_button, {
- key: 2,
- type: "text",
- onClick: _cache[0] || (_cache[0] = ($event) => previewVisible.value = true)
- }, {
- icon: withCtx(() => [
- _hoisted_9
- ]),
- default: withCtx(() => [
- _hoisted_10
- ]),
- _: 1
- })) : createCommentVNode("", true)
- ]),
- createVNode(_sfc_main$4, mergeProps({ ref: "widgetFormRef" }, widgetForm.value, {
- selectWidget: selectWidget.value,
- "onUpdate:selectWidget": _cache[1] || (_cache[1] = ($event) => selectWidget.value = $event)
- }), null, 16, ["selectWidget"])
- ]),
- createElementVNode("aside", _hoisted_11, [
- createElementVNode("header", _hoisted_12, [
- createElementVNode("div", {
- class: normalizeClass([{ active: !tab.value }, "config-tab"]),
- onClick: _cache[2] || (_cache[2] = ($event) => tab.value = 0)
- }, " \u5B57\u6BB5\u5C5E\u6027 ", 2),
- createElementVNode("div", {
- class: normalizeClass([{ active: tab.value }, "config-tab"]),
- onClick: _cache[3] || (_cache[3] = ($event) => tab.value = 1)
- }, " \u8868\u5355\u5C5E\u6027 ", 2)
- ]),
- withDirectives(createVNode(WidgetConfig, {
- select: selectWidget.value,
- "onUpdate:select": _cache[4] || (_cache[4] = ($event) => selectWidget.value = $event)
- }, null, 8, ["select"]), [
- [vShow, !tab.value]
- ]),
- withDirectives(createVNode(_sfc_main$2, {
- config: widgetForm.value.config,
- "onUpdate:config": _cache[5] || (_cache[5] = ($event) => widgetForm.value.config = $event)
- }, null, 8, ["config"]), [
- [vShow, tab.value]
- ])
- ]),
- createVNode(_component_el_dialog, {
- modelValue: previewVisible.value,
- "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => previewVisible.value = $event),
- "destroy-on-close": "",
- title: "\u9884\u89C8",
- "z-index": 2e3,
- width: 800,
- onClose: _cache[9] || (_cache[9] = ($event) => dataVisible.value = false)
- }, {
- footer: withCtx(() => [
- createVNode(_component_el_button, {
- onClick: _cache[7] || (_cache[7] = ($event) => dataVisible.value ? handleCopyClick(generateJsonTemplate.value) : handleReset())
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(dataVisible.value ? "\u590D\u5236" : "\u91CD\u7F6E"), 1)
- ]),
- _: 1
- }),
- createVNode(_component_el_button, {
- type: "primary",
- onClick: handleGetData
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(dataVisible.value ? "\u8FD4\u56DE\u9884\u89C8" : "\u83B7\u53D6\u6570\u636E"), 1)
- ]),
- _: 1
- })
- ]),
- default: withCtx(() => [
- withDirectives(createVNode(_sfc_main$1, {
- modelValue: generateJsonTemplate.value,
- "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => generateJsonTemplate.value = $event)
- }, null, 8, ["modelValue"]), [
- [vShow, dataVisible.value]
- ]),
- withDirectives(createVNode(GenerateForm, {
- ref_key: "generateFormRef",
- ref: generateFormRef,
- request: __props.request,
- data: widgetForm.value
- }, null, 8, ["request", "data"]), [
- [vShow, !dataVisible.value]
- ])
- ]),
- _: 1
- }, 8, ["modelValue"]),
- createVNode(_component_el_dialog, {
- modelValue: generateJsonVisible.value,
- "onUpdate:modelValue": _cache[12] || (_cache[12] = ($event) => generateJsonVisible.value = $event),
- "append-to-body": "",
- title: "\u4FEE\u6539JSON",
- "z-index": 2e4,
- width: 800
- }, {
- footer: withCtx(() => [
- createVNode(_component_el_button, {
- onClick: _cache[11] || (_cache[11] = ($event) => handleCopyClick(generateJsonTemplate.value))
- }, {
- default: withCtx(() => [
- _hoisted_13
- ]),
- _: 1
- }),
- createVNode(_component_el_button, {
- type: "primary",
- onClick: handleUploadJson
- }, {
- default: withCtx(() => [
- _hoisted_14
- ]),
- _: 1
- })
- ]),
- default: withCtx(() => [
- createVNode(_sfc_main$1, {
- modelValue: generateJsonTemplate.value,
- "onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => generateJsonTemplate.value = $event)
- }, null, 8, ["modelValue"])
- ]),
- _: 1
- }, 8, ["modelValue"])
- ]);
- };
- }
- }));
- export { _sfc_main as DesignForm, GenerateForm, advanceFields, basicFields, layoutFields };
- //# sourceMappingURL=index.es.js.map
|