index.umd.js 1.2 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778
  1. (function webpackUniversalModuleDefinition(root, factory) {
  2. if(typeof exports === 'object' && typeof module === 'object')
  3. module.exports = factory(require("vue"), require("@vxe-ui/core"), require("xe-utils"));
  4. else if(typeof define === 'function' && define.amd)
  5. define([, "@vxe-ui/core", "xe-utils"], factory);
  6. else if(typeof exports === 'object')
  7. exports["VxeUITable"] = factory(require("vue"), require("@vxe-ui/core"), require("xe-utils"));
  8. else
  9. root["VxeUITable"] = factory(root["Vue"], root["VxeUI"], root["XEUtils"]);
  10. })((typeof self !== 'undefined' ? self : this), function(__WEBPACK_EXTERNAL_MODULE__9274__, __WEBPACK_EXTERNAL_MODULE__4345__, __WEBPACK_EXTERNAL_MODULE__8871__) {
  11. return /******/ (function() { // webpackBootstrap
  12. /******/ "use strict";
  13. /******/ var __webpack_modules__ = ({
  14. /***/ 9274:
  15. /***/ (function(module) {
  16. module.exports = __WEBPACK_EXTERNAL_MODULE__9274__;
  17. /***/ }),
  18. /***/ 4345:
  19. /***/ (function(module) {
  20. module.exports = __WEBPACK_EXTERNAL_MODULE__4345__;
  21. /***/ }),
  22. /***/ 8871:
  23. /***/ (function(module) {
  24. module.exports = __WEBPACK_EXTERNAL_MODULE__8871__;
  25. /***/ }),
  26. /***/ 9306:
  27. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  28. var isCallable = __webpack_require__(4901);
  29. var tryToString = __webpack_require__(6823);
  30. var $TypeError = TypeError;
  31. // `Assert: IsCallable(argument) is true`
  32. module.exports = function (argument) {
  33. if (isCallable(argument)) return argument;
  34. throw new $TypeError(tryToString(argument) + ' is not a function');
  35. };
  36. /***/ }),
  37. /***/ 8551:
  38. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  39. var isObject = __webpack_require__(34);
  40. var $String = String;
  41. var $TypeError = TypeError;
  42. // `Assert: Type(argument) is Object`
  43. module.exports = function (argument) {
  44. if (isObject(argument)) return argument;
  45. throw new $TypeError($String(argument) + ' is not an object');
  46. };
  47. /***/ }),
  48. /***/ 9617:
  49. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  50. var toIndexedObject = __webpack_require__(5397);
  51. var toAbsoluteIndex = __webpack_require__(5610);
  52. var lengthOfArrayLike = __webpack_require__(6198);
  53. // `Array.prototype.{ indexOf, includes }` methods implementation
  54. var createMethod = function (IS_INCLUDES) {
  55. return function ($this, el, fromIndex) {
  56. var O = toIndexedObject($this);
  57. var length = lengthOfArrayLike(O);
  58. if (length === 0) return !IS_INCLUDES && -1;
  59. var index = toAbsoluteIndex(fromIndex, length);
  60. var value;
  61. // Array#includes uses SameValueZero equality algorithm
  62. // eslint-disable-next-line no-self-compare -- NaN check
  63. if (IS_INCLUDES && el !== el) while (length > index) {
  64. value = O[index++];
  65. // eslint-disable-next-line no-self-compare -- NaN check
  66. if (value !== value) return true;
  67. // Array#indexOf ignores holes, Array#includes - not
  68. } else for (;length > index; index++) {
  69. if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
  70. } return !IS_INCLUDES && -1;
  71. };
  72. };
  73. module.exports = {
  74. // `Array.prototype.includes` method
  75. // https://tc39.es/ecma262/#sec-array.prototype.includes
  76. includes: createMethod(true),
  77. // `Array.prototype.indexOf` method
  78. // https://tc39.es/ecma262/#sec-array.prototype.indexof
  79. indexOf: createMethod(false)
  80. };
  81. /***/ }),
  82. /***/ 4527:
  83. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  84. var DESCRIPTORS = __webpack_require__(3724);
  85. var isArray = __webpack_require__(4376);
  86. var $TypeError = TypeError;
  87. // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
  88. var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  89. // Safari < 13 does not throw an error in this case
  90. var SILENT_ON_NON_WRITABLE_LENGTH_SET = DESCRIPTORS && !function () {
  91. // makes no sense without proper strict mode support
  92. if (this !== undefined) return true;
  93. try {
  94. // eslint-disable-next-line es/no-object-defineproperty -- safe
  95. Object.defineProperty([], 'length', { writable: false }).length = 1;
  96. } catch (error) {
  97. return error instanceof TypeError;
  98. }
  99. }();
  100. module.exports = SILENT_ON_NON_WRITABLE_LENGTH_SET ? function (O, length) {
  101. if (isArray(O) && !getOwnPropertyDescriptor(O, 'length').writable) {
  102. throw new $TypeError('Cannot set read only .length');
  103. } return O.length = length;
  104. } : function (O, length) {
  105. return O.length = length;
  106. };
  107. /***/ }),
  108. /***/ 2195:
  109. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  110. var uncurryThis = __webpack_require__(9504);
  111. var toString = uncurryThis({}.toString);
  112. var stringSlice = uncurryThis(''.slice);
  113. module.exports = function (it) {
  114. return stringSlice(toString(it), 8, -1);
  115. };
  116. /***/ }),
  117. /***/ 7740:
  118. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  119. var hasOwn = __webpack_require__(9297);
  120. var ownKeys = __webpack_require__(5031);
  121. var getOwnPropertyDescriptorModule = __webpack_require__(7347);
  122. var definePropertyModule = __webpack_require__(4913);
  123. module.exports = function (target, source, exceptions) {
  124. var keys = ownKeys(source);
  125. var defineProperty = definePropertyModule.f;
  126. var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
  127. for (var i = 0; i < keys.length; i++) {
  128. var key = keys[i];
  129. if (!hasOwn(target, key) && !(exceptions && hasOwn(exceptions, key))) {
  130. defineProperty(target, key, getOwnPropertyDescriptor(source, key));
  131. }
  132. }
  133. };
  134. /***/ }),
  135. /***/ 6699:
  136. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  137. var DESCRIPTORS = __webpack_require__(3724);
  138. var definePropertyModule = __webpack_require__(4913);
  139. var createPropertyDescriptor = __webpack_require__(6980);
  140. module.exports = DESCRIPTORS ? function (object, key, value) {
  141. return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));
  142. } : function (object, key, value) {
  143. object[key] = value;
  144. return object;
  145. };
  146. /***/ }),
  147. /***/ 6980:
  148. /***/ (function(module) {
  149. module.exports = function (bitmap, value) {
  150. return {
  151. enumerable: !(bitmap & 1),
  152. configurable: !(bitmap & 2),
  153. writable: !(bitmap & 4),
  154. value: value
  155. };
  156. };
  157. /***/ }),
  158. /***/ 6840:
  159. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  160. var isCallable = __webpack_require__(4901);
  161. var definePropertyModule = __webpack_require__(4913);
  162. var makeBuiltIn = __webpack_require__(283);
  163. var defineGlobalProperty = __webpack_require__(9433);
  164. module.exports = function (O, key, value, options) {
  165. if (!options) options = {};
  166. var simple = options.enumerable;
  167. var name = options.name !== undefined ? options.name : key;
  168. if (isCallable(value)) makeBuiltIn(value, name, options);
  169. if (options.global) {
  170. if (simple) O[key] = value;
  171. else defineGlobalProperty(key, value);
  172. } else {
  173. try {
  174. if (!options.unsafe) delete O[key];
  175. else if (O[key]) simple = true;
  176. } catch (error) { /* empty */ }
  177. if (simple) O[key] = value;
  178. else definePropertyModule.f(O, key, {
  179. value: value,
  180. enumerable: false,
  181. configurable: !options.nonConfigurable,
  182. writable: !options.nonWritable
  183. });
  184. } return O;
  185. };
  186. /***/ }),
  187. /***/ 9433:
  188. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  189. var globalThis = __webpack_require__(4576);
  190. // eslint-disable-next-line es/no-object-defineproperty -- safe
  191. var defineProperty = Object.defineProperty;
  192. module.exports = function (key, value) {
  193. try {
  194. defineProperty(globalThis, key, { value: value, configurable: true, writable: true });
  195. } catch (error) {
  196. globalThis[key] = value;
  197. } return value;
  198. };
  199. /***/ }),
  200. /***/ 3724:
  201. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  202. var fails = __webpack_require__(9039);
  203. // Detect IE8's incomplete defineProperty implementation
  204. module.exports = !fails(function () {
  205. // eslint-disable-next-line es/no-object-defineproperty -- required for testing
  206. return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] !== 7;
  207. });
  208. /***/ }),
  209. /***/ 4055:
  210. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  211. var globalThis = __webpack_require__(4576);
  212. var isObject = __webpack_require__(34);
  213. var document = globalThis.document;
  214. // typeof document.createElement is 'object' in old IE
  215. var EXISTS = isObject(document) && isObject(document.createElement);
  216. module.exports = function (it) {
  217. return EXISTS ? document.createElement(it) : {};
  218. };
  219. /***/ }),
  220. /***/ 6837:
  221. /***/ (function(module) {
  222. var $TypeError = TypeError;
  223. var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF; // 2 ** 53 - 1 == 9007199254740991
  224. module.exports = function (it) {
  225. if (it > MAX_SAFE_INTEGER) throw $TypeError('Maximum allowed index exceeded');
  226. return it;
  227. };
  228. /***/ }),
  229. /***/ 8727:
  230. /***/ (function(module) {
  231. // IE8- don't enum bug keys
  232. module.exports = [
  233. 'constructor',
  234. 'hasOwnProperty',
  235. 'isPrototypeOf',
  236. 'propertyIsEnumerable',
  237. 'toLocaleString',
  238. 'toString',
  239. 'valueOf'
  240. ];
  241. /***/ }),
  242. /***/ 2839:
  243. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  244. var globalThis = __webpack_require__(4576);
  245. var navigator = globalThis.navigator;
  246. var userAgent = navigator && navigator.userAgent;
  247. module.exports = userAgent ? String(userAgent) : '';
  248. /***/ }),
  249. /***/ 9519:
  250. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  251. var globalThis = __webpack_require__(4576);
  252. var userAgent = __webpack_require__(2839);
  253. var process = globalThis.process;
  254. var Deno = globalThis.Deno;
  255. var versions = process && process.versions || Deno && Deno.version;
  256. var v8 = versions && versions.v8;
  257. var match, version;
  258. if (v8) {
  259. match = v8.split('.');
  260. // in old Chrome, versions of V8 isn't V8 = Chrome / 10
  261. // but their correct versions are not interesting for us
  262. version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
  263. }
  264. // BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
  265. // so check `userAgent` even if `.v8` exists, but 0
  266. if (!version && userAgent) {
  267. match = userAgent.match(/Edge\/(\d+)/);
  268. if (!match || match[1] >= 74) {
  269. match = userAgent.match(/Chrome\/(\d+)/);
  270. if (match) version = +match[1];
  271. }
  272. }
  273. module.exports = version;
  274. /***/ }),
  275. /***/ 6518:
  276. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  277. var globalThis = __webpack_require__(4576);
  278. var getOwnPropertyDescriptor = (__webpack_require__(7347).f);
  279. var createNonEnumerableProperty = __webpack_require__(6699);
  280. var defineBuiltIn = __webpack_require__(6840);
  281. var defineGlobalProperty = __webpack_require__(9433);
  282. var copyConstructorProperties = __webpack_require__(7740);
  283. var isForced = __webpack_require__(2796);
  284. /*
  285. options.target - name of the target object
  286. options.global - target is the global object
  287. options.stat - export as static methods of target
  288. options.proto - export as prototype methods of target
  289. options.real - real prototype method for the `pure` version
  290. options.forced - export even if the native feature is available
  291. options.bind - bind methods to the target, required for the `pure` version
  292. options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
  293. options.unsafe - use the simple assignment of property instead of delete + defineProperty
  294. options.sham - add a flag to not completely full polyfills
  295. options.enumerable - export as enumerable property
  296. options.dontCallGetSet - prevent calling a getter on target
  297. options.name - the .name of the function if it does not match the key
  298. */
  299. module.exports = function (options, source) {
  300. var TARGET = options.target;
  301. var GLOBAL = options.global;
  302. var STATIC = options.stat;
  303. var FORCED, target, key, targetProperty, sourceProperty, descriptor;
  304. if (GLOBAL) {
  305. target = globalThis;
  306. } else if (STATIC) {
  307. target = globalThis[TARGET] || defineGlobalProperty(TARGET, {});
  308. } else {
  309. target = globalThis[TARGET] && globalThis[TARGET].prototype;
  310. }
  311. if (target) for (key in source) {
  312. sourceProperty = source[key];
  313. if (options.dontCallGetSet) {
  314. descriptor = getOwnPropertyDescriptor(target, key);
  315. targetProperty = descriptor && descriptor.value;
  316. } else targetProperty = target[key];
  317. FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
  318. // contained in target
  319. if (!FORCED && targetProperty !== undefined) {
  320. if (typeof sourceProperty == typeof targetProperty) continue;
  321. copyConstructorProperties(sourceProperty, targetProperty);
  322. }
  323. // add a flag to not completely full polyfills
  324. if (options.sham || (targetProperty && targetProperty.sham)) {
  325. createNonEnumerableProperty(sourceProperty, 'sham', true);
  326. }
  327. defineBuiltIn(target, key, sourceProperty, options);
  328. }
  329. };
  330. /***/ }),
  331. /***/ 9039:
  332. /***/ (function(module) {
  333. module.exports = function (exec) {
  334. try {
  335. return !!exec();
  336. } catch (error) {
  337. return true;
  338. }
  339. };
  340. /***/ }),
  341. /***/ 616:
  342. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  343. var fails = __webpack_require__(9039);
  344. module.exports = !fails(function () {
  345. // eslint-disable-next-line es/no-function-prototype-bind -- safe
  346. var test = (function () { /* empty */ }).bind();
  347. // eslint-disable-next-line no-prototype-builtins -- safe
  348. return typeof test != 'function' || test.hasOwnProperty('prototype');
  349. });
  350. /***/ }),
  351. /***/ 9565:
  352. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  353. var NATIVE_BIND = __webpack_require__(616);
  354. var call = Function.prototype.call;
  355. module.exports = NATIVE_BIND ? call.bind(call) : function () {
  356. return call.apply(call, arguments);
  357. };
  358. /***/ }),
  359. /***/ 350:
  360. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  361. var DESCRIPTORS = __webpack_require__(3724);
  362. var hasOwn = __webpack_require__(9297);
  363. var FunctionPrototype = Function.prototype;
  364. // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
  365. var getDescriptor = DESCRIPTORS && Object.getOwnPropertyDescriptor;
  366. var EXISTS = hasOwn(FunctionPrototype, 'name');
  367. // additional protection from minified / mangled / dropped function names
  368. var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';
  369. var CONFIGURABLE = EXISTS && (!DESCRIPTORS || (DESCRIPTORS && getDescriptor(FunctionPrototype, 'name').configurable));
  370. module.exports = {
  371. EXISTS: EXISTS,
  372. PROPER: PROPER,
  373. CONFIGURABLE: CONFIGURABLE
  374. };
  375. /***/ }),
  376. /***/ 9504:
  377. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  378. var NATIVE_BIND = __webpack_require__(616);
  379. var FunctionPrototype = Function.prototype;
  380. var call = FunctionPrototype.call;
  381. var uncurryThisWithBind = NATIVE_BIND && FunctionPrototype.bind.bind(call, call);
  382. module.exports = NATIVE_BIND ? uncurryThisWithBind : function (fn) {
  383. return function () {
  384. return call.apply(fn, arguments);
  385. };
  386. };
  387. /***/ }),
  388. /***/ 7751:
  389. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  390. var globalThis = __webpack_require__(4576);
  391. var isCallable = __webpack_require__(4901);
  392. var aFunction = function (argument) {
  393. return isCallable(argument) ? argument : undefined;
  394. };
  395. module.exports = function (namespace, method) {
  396. return arguments.length < 2 ? aFunction(globalThis[namespace]) : globalThis[namespace] && globalThis[namespace][method];
  397. };
  398. /***/ }),
  399. /***/ 5966:
  400. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  401. var aCallable = __webpack_require__(9306);
  402. var isNullOrUndefined = __webpack_require__(4117);
  403. // `GetMethod` abstract operation
  404. // https://tc39.es/ecma262/#sec-getmethod
  405. module.exports = function (V, P) {
  406. var func = V[P];
  407. return isNullOrUndefined(func) ? undefined : aCallable(func);
  408. };
  409. /***/ }),
  410. /***/ 4576:
  411. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  412. var check = function (it) {
  413. return it && it.Math === Math && it;
  414. };
  415. // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
  416. module.exports =
  417. // eslint-disable-next-line es/no-global-this -- safe
  418. check(typeof globalThis == 'object' && globalThis) ||
  419. check(typeof window == 'object' && window) ||
  420. // eslint-disable-next-line no-restricted-globals -- safe
  421. check(typeof self == 'object' && self) ||
  422. check(typeof __webpack_require__.g == 'object' && __webpack_require__.g) ||
  423. check(typeof this == 'object' && this) ||
  424. // eslint-disable-next-line no-new-func -- fallback
  425. (function () { return this; })() || Function('return this')();
  426. /***/ }),
  427. /***/ 9297:
  428. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  429. var uncurryThis = __webpack_require__(9504);
  430. var toObject = __webpack_require__(8981);
  431. var hasOwnProperty = uncurryThis({}.hasOwnProperty);
  432. // `HasOwnProperty` abstract operation
  433. // https://tc39.es/ecma262/#sec-hasownproperty
  434. // eslint-disable-next-line es/no-object-hasown -- safe
  435. module.exports = Object.hasOwn || function hasOwn(it, key) {
  436. return hasOwnProperty(toObject(it), key);
  437. };
  438. /***/ }),
  439. /***/ 421:
  440. /***/ (function(module) {
  441. module.exports = {};
  442. /***/ }),
  443. /***/ 5917:
  444. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  445. var DESCRIPTORS = __webpack_require__(3724);
  446. var fails = __webpack_require__(9039);
  447. var createElement = __webpack_require__(4055);
  448. // Thanks to IE8 for its funny defineProperty
  449. module.exports = !DESCRIPTORS && !fails(function () {
  450. // eslint-disable-next-line es/no-object-defineproperty -- required for testing
  451. return Object.defineProperty(createElement('div'), 'a', {
  452. get: function () { return 7; }
  453. }).a !== 7;
  454. });
  455. /***/ }),
  456. /***/ 7055:
  457. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  458. var uncurryThis = __webpack_require__(9504);
  459. var fails = __webpack_require__(9039);
  460. var classof = __webpack_require__(2195);
  461. var $Object = Object;
  462. var split = uncurryThis(''.split);
  463. // fallback for non-array-like ES3 and non-enumerable old V8 strings
  464. module.exports = fails(function () {
  465. // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
  466. // eslint-disable-next-line no-prototype-builtins -- safe
  467. return !$Object('z').propertyIsEnumerable(0);
  468. }) ? function (it) {
  469. return classof(it) === 'String' ? split(it, '') : $Object(it);
  470. } : $Object;
  471. /***/ }),
  472. /***/ 3706:
  473. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  474. var uncurryThis = __webpack_require__(9504);
  475. var isCallable = __webpack_require__(4901);
  476. var store = __webpack_require__(7629);
  477. var functionToString = uncurryThis(Function.toString);
  478. // this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
  479. if (!isCallable(store.inspectSource)) {
  480. store.inspectSource = function (it) {
  481. return functionToString(it);
  482. };
  483. }
  484. module.exports = store.inspectSource;
  485. /***/ }),
  486. /***/ 1181:
  487. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  488. var NATIVE_WEAK_MAP = __webpack_require__(8622);
  489. var globalThis = __webpack_require__(4576);
  490. var isObject = __webpack_require__(34);
  491. var createNonEnumerableProperty = __webpack_require__(6699);
  492. var hasOwn = __webpack_require__(9297);
  493. var shared = __webpack_require__(7629);
  494. var sharedKey = __webpack_require__(6119);
  495. var hiddenKeys = __webpack_require__(421);
  496. var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
  497. var TypeError = globalThis.TypeError;
  498. var WeakMap = globalThis.WeakMap;
  499. var set, get, has;
  500. var enforce = function (it) {
  501. return has(it) ? get(it) : set(it, {});
  502. };
  503. var getterFor = function (TYPE) {
  504. return function (it) {
  505. var state;
  506. if (!isObject(it) || (state = get(it)).type !== TYPE) {
  507. throw new TypeError('Incompatible receiver, ' + TYPE + ' required');
  508. } return state;
  509. };
  510. };
  511. if (NATIVE_WEAK_MAP || shared.state) {
  512. var store = shared.state || (shared.state = new WeakMap());
  513. /* eslint-disable no-self-assign -- prototype methods protection */
  514. store.get = store.get;
  515. store.has = store.has;
  516. store.set = store.set;
  517. /* eslint-enable no-self-assign -- prototype methods protection */
  518. set = function (it, metadata) {
  519. if (store.has(it)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);
  520. metadata.facade = it;
  521. store.set(it, metadata);
  522. return metadata;
  523. };
  524. get = function (it) {
  525. return store.get(it) || {};
  526. };
  527. has = function (it) {
  528. return store.has(it);
  529. };
  530. } else {
  531. var STATE = sharedKey('state');
  532. hiddenKeys[STATE] = true;
  533. set = function (it, metadata) {
  534. if (hasOwn(it, STATE)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);
  535. metadata.facade = it;
  536. createNonEnumerableProperty(it, STATE, metadata);
  537. return metadata;
  538. };
  539. get = function (it) {
  540. return hasOwn(it, STATE) ? it[STATE] : {};
  541. };
  542. has = function (it) {
  543. return hasOwn(it, STATE);
  544. };
  545. }
  546. module.exports = {
  547. set: set,
  548. get: get,
  549. has: has,
  550. enforce: enforce,
  551. getterFor: getterFor
  552. };
  553. /***/ }),
  554. /***/ 4376:
  555. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  556. var classof = __webpack_require__(2195);
  557. // `IsArray` abstract operation
  558. // https://tc39.es/ecma262/#sec-isarray
  559. // eslint-disable-next-line es/no-array-isarray -- safe
  560. module.exports = Array.isArray || function isArray(argument) {
  561. return classof(argument) === 'Array';
  562. };
  563. /***/ }),
  564. /***/ 4901:
  565. /***/ (function(module) {
  566. // https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot
  567. var documentAll = typeof document == 'object' && document.all;
  568. // `IsCallable` abstract operation
  569. // https://tc39.es/ecma262/#sec-iscallable
  570. // eslint-disable-next-line unicorn/no-typeof-undefined -- required for testing
  571. module.exports = typeof documentAll == 'undefined' && documentAll !== undefined ? function (argument) {
  572. return typeof argument == 'function' || argument === documentAll;
  573. } : function (argument) {
  574. return typeof argument == 'function';
  575. };
  576. /***/ }),
  577. /***/ 2796:
  578. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  579. var fails = __webpack_require__(9039);
  580. var isCallable = __webpack_require__(4901);
  581. var replacement = /#|\.prototype\./;
  582. var isForced = function (feature, detection) {
  583. var value = data[normalize(feature)];
  584. return value === POLYFILL ? true
  585. : value === NATIVE ? false
  586. : isCallable(detection) ? fails(detection)
  587. : !!detection;
  588. };
  589. var normalize = isForced.normalize = function (string) {
  590. return String(string).replace(replacement, '.').toLowerCase();
  591. };
  592. var data = isForced.data = {};
  593. var NATIVE = isForced.NATIVE = 'N';
  594. var POLYFILL = isForced.POLYFILL = 'P';
  595. module.exports = isForced;
  596. /***/ }),
  597. /***/ 4117:
  598. /***/ (function(module) {
  599. // we can't use just `it == null` since of `document.all` special case
  600. // https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot-aec
  601. module.exports = function (it) {
  602. return it === null || it === undefined;
  603. };
  604. /***/ }),
  605. /***/ 34:
  606. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  607. var isCallable = __webpack_require__(4901);
  608. module.exports = function (it) {
  609. return typeof it == 'object' ? it !== null : isCallable(it);
  610. };
  611. /***/ }),
  612. /***/ 6395:
  613. /***/ (function(module) {
  614. module.exports = false;
  615. /***/ }),
  616. /***/ 757:
  617. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  618. var getBuiltIn = __webpack_require__(7751);
  619. var isCallable = __webpack_require__(4901);
  620. var isPrototypeOf = __webpack_require__(1625);
  621. var USE_SYMBOL_AS_UID = __webpack_require__(7040);
  622. var $Object = Object;
  623. module.exports = USE_SYMBOL_AS_UID ? function (it) {
  624. return typeof it == 'symbol';
  625. } : function (it) {
  626. var $Symbol = getBuiltIn('Symbol');
  627. return isCallable($Symbol) && isPrototypeOf($Symbol.prototype, $Object(it));
  628. };
  629. /***/ }),
  630. /***/ 6198:
  631. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  632. var toLength = __webpack_require__(8014);
  633. // `LengthOfArrayLike` abstract operation
  634. // https://tc39.es/ecma262/#sec-lengthofarraylike
  635. module.exports = function (obj) {
  636. return toLength(obj.length);
  637. };
  638. /***/ }),
  639. /***/ 283:
  640. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  641. var uncurryThis = __webpack_require__(9504);
  642. var fails = __webpack_require__(9039);
  643. var isCallable = __webpack_require__(4901);
  644. var hasOwn = __webpack_require__(9297);
  645. var DESCRIPTORS = __webpack_require__(3724);
  646. var CONFIGURABLE_FUNCTION_NAME = (__webpack_require__(350).CONFIGURABLE);
  647. var inspectSource = __webpack_require__(3706);
  648. var InternalStateModule = __webpack_require__(1181);
  649. var enforceInternalState = InternalStateModule.enforce;
  650. var getInternalState = InternalStateModule.get;
  651. var $String = String;
  652. // eslint-disable-next-line es/no-object-defineproperty -- safe
  653. var defineProperty = Object.defineProperty;
  654. var stringSlice = uncurryThis(''.slice);
  655. var replace = uncurryThis(''.replace);
  656. var join = uncurryThis([].join);
  657. var CONFIGURABLE_LENGTH = DESCRIPTORS && !fails(function () {
  658. return defineProperty(function () { /* empty */ }, 'length', { value: 8 }).length !== 8;
  659. });
  660. var TEMPLATE = String(String).split('String');
  661. var makeBuiltIn = module.exports = function (value, name, options) {
  662. if (stringSlice($String(name), 0, 7) === 'Symbol(') {
  663. name = '[' + replace($String(name), /^Symbol\(([^)]*)\).*$/, '$1') + ']';
  664. }
  665. if (options && options.getter) name = 'get ' + name;
  666. if (options && options.setter) name = 'set ' + name;
  667. if (!hasOwn(value, 'name') || (CONFIGURABLE_FUNCTION_NAME && value.name !== name)) {
  668. if (DESCRIPTORS) defineProperty(value, 'name', { value: name, configurable: true });
  669. else value.name = name;
  670. }
  671. if (CONFIGURABLE_LENGTH && options && hasOwn(options, 'arity') && value.length !== options.arity) {
  672. defineProperty(value, 'length', { value: options.arity });
  673. }
  674. try {
  675. if (options && hasOwn(options, 'constructor') && options.constructor) {
  676. if (DESCRIPTORS) defineProperty(value, 'prototype', { writable: false });
  677. // in V8 ~ Chrome 53, prototypes of some methods, like `Array.prototype.values`, are non-writable
  678. } else if (value.prototype) value.prototype = undefined;
  679. } catch (error) { /* empty */ }
  680. var state = enforceInternalState(value);
  681. if (!hasOwn(state, 'source')) {
  682. state.source = join(TEMPLATE, typeof name == 'string' ? name : '');
  683. } return value;
  684. };
  685. // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
  686. // eslint-disable-next-line no-extend-native -- required
  687. Function.prototype.toString = makeBuiltIn(function toString() {
  688. return isCallable(this) && getInternalState(this).source || inspectSource(this);
  689. }, 'toString');
  690. /***/ }),
  691. /***/ 741:
  692. /***/ (function(module) {
  693. var ceil = Math.ceil;
  694. var floor = Math.floor;
  695. // `Math.trunc` method
  696. // https://tc39.es/ecma262/#sec-math.trunc
  697. // eslint-disable-next-line es/no-math-trunc -- safe
  698. module.exports = Math.trunc || function trunc(x) {
  699. var n = +x;
  700. return (n > 0 ? floor : ceil)(n);
  701. };
  702. /***/ }),
  703. /***/ 4913:
  704. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  705. var DESCRIPTORS = __webpack_require__(3724);
  706. var IE8_DOM_DEFINE = __webpack_require__(5917);
  707. var V8_PROTOTYPE_DEFINE_BUG = __webpack_require__(8686);
  708. var anObject = __webpack_require__(8551);
  709. var toPropertyKey = __webpack_require__(6969);
  710. var $TypeError = TypeError;
  711. // eslint-disable-next-line es/no-object-defineproperty -- safe
  712. var $defineProperty = Object.defineProperty;
  713. // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
  714. var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  715. var ENUMERABLE = 'enumerable';
  716. var CONFIGURABLE = 'configurable';
  717. var WRITABLE = 'writable';
  718. // `Object.defineProperty` method
  719. // https://tc39.es/ecma262/#sec-object.defineproperty
  720. exports.f = DESCRIPTORS ? V8_PROTOTYPE_DEFINE_BUG ? function defineProperty(O, P, Attributes) {
  721. anObject(O);
  722. P = toPropertyKey(P);
  723. anObject(Attributes);
  724. if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
  725. var current = $getOwnPropertyDescriptor(O, P);
  726. if (current && current[WRITABLE]) {
  727. O[P] = Attributes.value;
  728. Attributes = {
  729. configurable: CONFIGURABLE in Attributes ? Attributes[CONFIGURABLE] : current[CONFIGURABLE],
  730. enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],
  731. writable: false
  732. };
  733. }
  734. } return $defineProperty(O, P, Attributes);
  735. } : $defineProperty : function defineProperty(O, P, Attributes) {
  736. anObject(O);
  737. P = toPropertyKey(P);
  738. anObject(Attributes);
  739. if (IE8_DOM_DEFINE) try {
  740. return $defineProperty(O, P, Attributes);
  741. } catch (error) { /* empty */ }
  742. if ('get' in Attributes || 'set' in Attributes) throw new $TypeError('Accessors not supported');
  743. if ('value' in Attributes) O[P] = Attributes.value;
  744. return O;
  745. };
  746. /***/ }),
  747. /***/ 7347:
  748. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  749. var DESCRIPTORS = __webpack_require__(3724);
  750. var call = __webpack_require__(9565);
  751. var propertyIsEnumerableModule = __webpack_require__(8773);
  752. var createPropertyDescriptor = __webpack_require__(6980);
  753. var toIndexedObject = __webpack_require__(5397);
  754. var toPropertyKey = __webpack_require__(6969);
  755. var hasOwn = __webpack_require__(9297);
  756. var IE8_DOM_DEFINE = __webpack_require__(5917);
  757. // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
  758. var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  759. // `Object.getOwnPropertyDescriptor` method
  760. // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
  761. exports.f = DESCRIPTORS ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
  762. O = toIndexedObject(O);
  763. P = toPropertyKey(P);
  764. if (IE8_DOM_DEFINE) try {
  765. return $getOwnPropertyDescriptor(O, P);
  766. } catch (error) { /* empty */ }
  767. if (hasOwn(O, P)) return createPropertyDescriptor(!call(propertyIsEnumerableModule.f, O, P), O[P]);
  768. };
  769. /***/ }),
  770. /***/ 8480:
  771. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  772. var internalObjectKeys = __webpack_require__(1828);
  773. var enumBugKeys = __webpack_require__(8727);
  774. var hiddenKeys = enumBugKeys.concat('length', 'prototype');
  775. // `Object.getOwnPropertyNames` method
  776. // https://tc39.es/ecma262/#sec-object.getownpropertynames
  777. // eslint-disable-next-line es/no-object-getownpropertynames -- safe
  778. exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
  779. return internalObjectKeys(O, hiddenKeys);
  780. };
  781. /***/ }),
  782. /***/ 3717:
  783. /***/ (function(__unused_webpack_module, exports) {
  784. // eslint-disable-next-line es/no-object-getownpropertysymbols -- safe
  785. exports.f = Object.getOwnPropertySymbols;
  786. /***/ }),
  787. /***/ 1625:
  788. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  789. var uncurryThis = __webpack_require__(9504);
  790. module.exports = uncurryThis({}.isPrototypeOf);
  791. /***/ }),
  792. /***/ 1828:
  793. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  794. var uncurryThis = __webpack_require__(9504);
  795. var hasOwn = __webpack_require__(9297);
  796. var toIndexedObject = __webpack_require__(5397);
  797. var indexOf = (__webpack_require__(9617).indexOf);
  798. var hiddenKeys = __webpack_require__(421);
  799. var push = uncurryThis([].push);
  800. module.exports = function (object, names) {
  801. var O = toIndexedObject(object);
  802. var i = 0;
  803. var result = [];
  804. var key;
  805. for (key in O) !hasOwn(hiddenKeys, key) && hasOwn(O, key) && push(result, key);
  806. // Don't enum bug & hidden keys
  807. while (names.length > i) if (hasOwn(O, key = names[i++])) {
  808. ~indexOf(result, key) || push(result, key);
  809. }
  810. return result;
  811. };
  812. /***/ }),
  813. /***/ 8773:
  814. /***/ (function(__unused_webpack_module, exports) {
  815. var $propertyIsEnumerable = {}.propertyIsEnumerable;
  816. // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
  817. var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  818. // Nashorn ~ JDK8 bug
  819. var NASHORN_BUG = getOwnPropertyDescriptor && !$propertyIsEnumerable.call({ 1: 2 }, 1);
  820. // `Object.prototype.propertyIsEnumerable` method implementation
  821. // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
  822. exports.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
  823. var descriptor = getOwnPropertyDescriptor(this, V);
  824. return !!descriptor && descriptor.enumerable;
  825. } : $propertyIsEnumerable;
  826. /***/ }),
  827. /***/ 4270:
  828. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  829. var call = __webpack_require__(9565);
  830. var isCallable = __webpack_require__(4901);
  831. var isObject = __webpack_require__(34);
  832. var $TypeError = TypeError;
  833. // `OrdinaryToPrimitive` abstract operation
  834. // https://tc39.es/ecma262/#sec-ordinarytoprimitive
  835. module.exports = function (input, pref) {
  836. var fn, val;
  837. if (pref === 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val;
  838. if (isCallable(fn = input.valueOf) && !isObject(val = call(fn, input))) return val;
  839. if (pref !== 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val;
  840. throw new $TypeError("Can't convert object to primitive value");
  841. };
  842. /***/ }),
  843. /***/ 5031:
  844. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  845. var getBuiltIn = __webpack_require__(7751);
  846. var uncurryThis = __webpack_require__(9504);
  847. var getOwnPropertyNamesModule = __webpack_require__(8480);
  848. var getOwnPropertySymbolsModule = __webpack_require__(3717);
  849. var anObject = __webpack_require__(8551);
  850. var concat = uncurryThis([].concat);
  851. // all object keys, includes non-enumerable and symbols
  852. module.exports = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
  853. var keys = getOwnPropertyNamesModule.f(anObject(it));
  854. var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
  855. return getOwnPropertySymbols ? concat(keys, getOwnPropertySymbols(it)) : keys;
  856. };
  857. /***/ }),
  858. /***/ 7750:
  859. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  860. var isNullOrUndefined = __webpack_require__(4117);
  861. var $TypeError = TypeError;
  862. // `RequireObjectCoercible` abstract operation
  863. // https://tc39.es/ecma262/#sec-requireobjectcoercible
  864. module.exports = function (it) {
  865. if (isNullOrUndefined(it)) throw new $TypeError("Can't call method on " + it);
  866. return it;
  867. };
  868. /***/ }),
  869. /***/ 6119:
  870. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  871. var shared = __webpack_require__(5745);
  872. var uid = __webpack_require__(3392);
  873. var keys = shared('keys');
  874. module.exports = function (key) {
  875. return keys[key] || (keys[key] = uid(key));
  876. };
  877. /***/ }),
  878. /***/ 7629:
  879. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  880. var IS_PURE = __webpack_require__(6395);
  881. var globalThis = __webpack_require__(4576);
  882. var defineGlobalProperty = __webpack_require__(9433);
  883. var SHARED = '__core-js_shared__';
  884. var store = module.exports = globalThis[SHARED] || defineGlobalProperty(SHARED, {});
  885. (store.versions || (store.versions = [])).push({
  886. version: '3.38.1',
  887. mode: IS_PURE ? 'pure' : 'global',
  888. copyright: '© 2014-2024 Denis Pushkarev (zloirock.ru)',
  889. license: 'https://github.com/zloirock/core-js/blob/v3.38.1/LICENSE',
  890. source: 'https://github.com/zloirock/core-js'
  891. });
  892. /***/ }),
  893. /***/ 5745:
  894. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  895. var store = __webpack_require__(7629);
  896. module.exports = function (key, value) {
  897. return store[key] || (store[key] = value || {});
  898. };
  899. /***/ }),
  900. /***/ 4495:
  901. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  902. /* eslint-disable es/no-symbol -- required for testing */
  903. var V8_VERSION = __webpack_require__(9519);
  904. var fails = __webpack_require__(9039);
  905. var globalThis = __webpack_require__(4576);
  906. var $String = globalThis.String;
  907. // eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
  908. module.exports = !!Object.getOwnPropertySymbols && !fails(function () {
  909. var symbol = Symbol('symbol detection');
  910. // Chrome 38 Symbol has incorrect toString conversion
  911. // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
  912. // nb: Do not call `String` directly to avoid this being optimized out to `symbol+''` which will,
  913. // of course, fail.
  914. return !$String(symbol) || !(Object(symbol) instanceof Symbol) ||
  915. // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
  916. !Symbol.sham && V8_VERSION && V8_VERSION < 41;
  917. });
  918. /***/ }),
  919. /***/ 5610:
  920. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  921. var toIntegerOrInfinity = __webpack_require__(1291);
  922. var max = Math.max;
  923. var min = Math.min;
  924. // Helper for a popular repeating case of the spec:
  925. // Let integer be ? ToInteger(index).
  926. // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
  927. module.exports = function (index, length) {
  928. var integer = toIntegerOrInfinity(index);
  929. return integer < 0 ? max(integer + length, 0) : min(integer, length);
  930. };
  931. /***/ }),
  932. /***/ 5397:
  933. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  934. // toObject with fallback for non-array-like ES3 strings
  935. var IndexedObject = __webpack_require__(7055);
  936. var requireObjectCoercible = __webpack_require__(7750);
  937. module.exports = function (it) {
  938. return IndexedObject(requireObjectCoercible(it));
  939. };
  940. /***/ }),
  941. /***/ 1291:
  942. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  943. var trunc = __webpack_require__(741);
  944. // `ToIntegerOrInfinity` abstract operation
  945. // https://tc39.es/ecma262/#sec-tointegerorinfinity
  946. module.exports = function (argument) {
  947. var number = +argument;
  948. // eslint-disable-next-line no-self-compare -- NaN check
  949. return number !== number || number === 0 ? 0 : trunc(number);
  950. };
  951. /***/ }),
  952. /***/ 8014:
  953. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  954. var toIntegerOrInfinity = __webpack_require__(1291);
  955. var min = Math.min;
  956. // `ToLength` abstract operation
  957. // https://tc39.es/ecma262/#sec-tolength
  958. module.exports = function (argument) {
  959. var len = toIntegerOrInfinity(argument);
  960. return len > 0 ? min(len, 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
  961. };
  962. /***/ }),
  963. /***/ 8981:
  964. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  965. var requireObjectCoercible = __webpack_require__(7750);
  966. var $Object = Object;
  967. // `ToObject` abstract operation
  968. // https://tc39.es/ecma262/#sec-toobject
  969. module.exports = function (argument) {
  970. return $Object(requireObjectCoercible(argument));
  971. };
  972. /***/ }),
  973. /***/ 2777:
  974. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  975. var call = __webpack_require__(9565);
  976. var isObject = __webpack_require__(34);
  977. var isSymbol = __webpack_require__(757);
  978. var getMethod = __webpack_require__(5966);
  979. var ordinaryToPrimitive = __webpack_require__(4270);
  980. var wellKnownSymbol = __webpack_require__(8227);
  981. var $TypeError = TypeError;
  982. var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
  983. // `ToPrimitive` abstract operation
  984. // https://tc39.es/ecma262/#sec-toprimitive
  985. module.exports = function (input, pref) {
  986. if (!isObject(input) || isSymbol(input)) return input;
  987. var exoticToPrim = getMethod(input, TO_PRIMITIVE);
  988. var result;
  989. if (exoticToPrim) {
  990. if (pref === undefined) pref = 'default';
  991. result = call(exoticToPrim, input, pref);
  992. if (!isObject(result) || isSymbol(result)) return result;
  993. throw new $TypeError("Can't convert object to primitive value");
  994. }
  995. if (pref === undefined) pref = 'number';
  996. return ordinaryToPrimitive(input, pref);
  997. };
  998. /***/ }),
  999. /***/ 6969:
  1000. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  1001. var toPrimitive = __webpack_require__(2777);
  1002. var isSymbol = __webpack_require__(757);
  1003. // `ToPropertyKey` abstract operation
  1004. // https://tc39.es/ecma262/#sec-topropertykey
  1005. module.exports = function (argument) {
  1006. var key = toPrimitive(argument, 'string');
  1007. return isSymbol(key) ? key : key + '';
  1008. };
  1009. /***/ }),
  1010. /***/ 6823:
  1011. /***/ (function(module) {
  1012. var $String = String;
  1013. module.exports = function (argument) {
  1014. try {
  1015. return $String(argument);
  1016. } catch (error) {
  1017. return 'Object';
  1018. }
  1019. };
  1020. /***/ }),
  1021. /***/ 3392:
  1022. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  1023. var uncurryThis = __webpack_require__(9504);
  1024. var id = 0;
  1025. var postfix = Math.random();
  1026. var toString = uncurryThis(1.0.toString);
  1027. module.exports = function (key) {
  1028. return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString(++id + postfix, 36);
  1029. };
  1030. /***/ }),
  1031. /***/ 7040:
  1032. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  1033. /* eslint-disable es/no-symbol -- required for testing */
  1034. var NATIVE_SYMBOL = __webpack_require__(4495);
  1035. module.exports = NATIVE_SYMBOL
  1036. && !Symbol.sham
  1037. && typeof Symbol.iterator == 'symbol';
  1038. /***/ }),
  1039. /***/ 8686:
  1040. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  1041. var DESCRIPTORS = __webpack_require__(3724);
  1042. var fails = __webpack_require__(9039);
  1043. // V8 ~ Chrome 36-
  1044. // https://bugs.chromium.org/p/v8/issues/detail?id=3334
  1045. module.exports = DESCRIPTORS && fails(function () {
  1046. // eslint-disable-next-line es/no-object-defineproperty -- required for testing
  1047. return Object.defineProperty(function () { /* empty */ }, 'prototype', {
  1048. value: 42,
  1049. writable: false
  1050. }).prototype !== 42;
  1051. });
  1052. /***/ }),
  1053. /***/ 8622:
  1054. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  1055. var globalThis = __webpack_require__(4576);
  1056. var isCallable = __webpack_require__(4901);
  1057. var WeakMap = globalThis.WeakMap;
  1058. module.exports = isCallable(WeakMap) && /native code/.test(String(WeakMap));
  1059. /***/ }),
  1060. /***/ 8227:
  1061. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  1062. var globalThis = __webpack_require__(4576);
  1063. var shared = __webpack_require__(5745);
  1064. var hasOwn = __webpack_require__(9297);
  1065. var uid = __webpack_require__(3392);
  1066. var NATIVE_SYMBOL = __webpack_require__(4495);
  1067. var USE_SYMBOL_AS_UID = __webpack_require__(7040);
  1068. var Symbol = globalThis.Symbol;
  1069. var WellKnownSymbolsStore = shared('wks');
  1070. var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol['for'] || Symbol : Symbol && Symbol.withoutSetter || uid;
  1071. module.exports = function (name) {
  1072. if (!hasOwn(WellKnownSymbolsStore, name)) {
  1073. WellKnownSymbolsStore[name] = NATIVE_SYMBOL && hasOwn(Symbol, name)
  1074. ? Symbol[name]
  1075. : createWellKnownSymbol('Symbol.' + name);
  1076. } return WellKnownSymbolsStore[name];
  1077. };
  1078. /***/ }),
  1079. /***/ 4114:
  1080. /***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
  1081. var $ = __webpack_require__(6518);
  1082. var toObject = __webpack_require__(8981);
  1083. var lengthOfArrayLike = __webpack_require__(6198);
  1084. var setArrayLength = __webpack_require__(4527);
  1085. var doesNotExceedSafeInteger = __webpack_require__(6837);
  1086. var fails = __webpack_require__(9039);
  1087. var INCORRECT_TO_LENGTH = fails(function () {
  1088. return [].push.call({ length: 0x100000000 }, 1) !== 4294967297;
  1089. });
  1090. // V8 <= 121 and Safari <= 15.4; FF < 23 throws InternalError
  1091. // https://bugs.chromium.org/p/v8/issues/detail?id=12681
  1092. var properErrorOnNonWritableLength = function () {
  1093. try {
  1094. // eslint-disable-next-line es/no-object-defineproperty -- safe
  1095. Object.defineProperty([], 'length', { writable: false }).push();
  1096. } catch (error) {
  1097. return error instanceof TypeError;
  1098. }
  1099. };
  1100. var FORCED = INCORRECT_TO_LENGTH || !properErrorOnNonWritableLength();
  1101. // `Array.prototype.push` method
  1102. // https://tc39.es/ecma262/#sec-array.prototype.push
  1103. $({ target: 'Array', proto: true, arity: 1, forced: FORCED }, {
  1104. // eslint-disable-next-line no-unused-vars -- required for `.length`
  1105. push: function push(item) {
  1106. var O = toObject(this);
  1107. var len = lengthOfArrayLike(O);
  1108. var argCount = arguments.length;
  1109. doesNotExceedSafeInteger(len + argCount);
  1110. for (var i = 0; i < argCount; i++) {
  1111. O[len] = arguments[i];
  1112. len++;
  1113. }
  1114. setArrayLength(O, len);
  1115. return len;
  1116. }
  1117. });
  1118. /***/ })
  1119. /******/ });
  1120. /************************************************************************/
  1121. /******/ // The module cache
  1122. /******/ var __webpack_module_cache__ = {};
  1123. /******/
  1124. /******/ // The require function
  1125. /******/ function __webpack_require__(moduleId) {
  1126. /******/ // Check if module is in cache
  1127. /******/ var cachedModule = __webpack_module_cache__[moduleId];
  1128. /******/ if (cachedModule !== undefined) {
  1129. /******/ return cachedModule.exports;
  1130. /******/ }
  1131. /******/ // Create a new module (and put it into the cache)
  1132. /******/ var module = __webpack_module_cache__[moduleId] = {
  1133. /******/ // no module.id needed
  1134. /******/ // no module.loaded needed
  1135. /******/ exports: {}
  1136. /******/ };
  1137. /******/
  1138. /******/ // Execute the module function
  1139. /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  1140. /******/
  1141. /******/ // Return the exports of the module
  1142. /******/ return module.exports;
  1143. /******/ }
  1144. /******/
  1145. /************************************************************************/
  1146. /******/ /* webpack/runtime/compat get default export */
  1147. /******/ !function() {
  1148. /******/ // getDefaultExport function for compatibility with non-harmony modules
  1149. /******/ __webpack_require__.n = function(module) {
  1150. /******/ var getter = module && module.__esModule ?
  1151. /******/ function() { return module['default']; } :
  1152. /******/ function() { return module; };
  1153. /******/ __webpack_require__.d(getter, { a: getter });
  1154. /******/ return getter;
  1155. /******/ };
  1156. /******/ }();
  1157. /******/
  1158. /******/ /* webpack/runtime/define property getters */
  1159. /******/ !function() {
  1160. /******/ // define getter functions for harmony exports
  1161. /******/ __webpack_require__.d = function(exports, definition) {
  1162. /******/ for(var key in definition) {
  1163. /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
  1164. /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
  1165. /******/ }
  1166. /******/ }
  1167. /******/ };
  1168. /******/ }();
  1169. /******/
  1170. /******/ /* webpack/runtime/global */
  1171. /******/ !function() {
  1172. /******/ __webpack_require__.g = (function() {
  1173. /******/ if (typeof globalThis === 'object') return globalThis;
  1174. /******/ try {
  1175. /******/ return this || new Function('return this')();
  1176. /******/ } catch (e) {
  1177. /******/ if (typeof window === 'object') return window;
  1178. /******/ }
  1179. /******/ })();
  1180. /******/ }();
  1181. /******/
  1182. /******/ /* webpack/runtime/hasOwnProperty shorthand */
  1183. /******/ !function() {
  1184. /******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
  1185. /******/ }();
  1186. /******/
  1187. /******/ /* webpack/runtime/make namespace object */
  1188. /******/ !function() {
  1189. /******/ // define __esModule on exports
  1190. /******/ __webpack_require__.r = function(exports) {
  1191. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  1192. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  1193. /******/ }
  1194. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  1195. /******/ };
  1196. /******/ }();
  1197. /******/
  1198. /******/ /* webpack/runtime/publicPath */
  1199. /******/ !function() {
  1200. /******/ __webpack_require__.p = "";
  1201. /******/ }();
  1202. /******/
  1203. /************************************************************************/
  1204. var __webpack_exports__ = {};
  1205. // ESM COMPAT FLAG
  1206. __webpack_require__.r(__webpack_exports__);
  1207. // EXPORTS
  1208. __webpack_require__.d(__webpack_exports__, {
  1209. Colgroup: function() { return /* reexport */ Colgroup; },
  1210. Column: function() { return /* reexport */ Column; },
  1211. Grid: function() { return /* reexport */ Grid; },
  1212. Table: function() { return /* reexport */ Table; },
  1213. Toolbar: function() { return /* reexport */ Toolbar; },
  1214. VXETable: function() { return /* reexport */ VXETable; },
  1215. VxeColgroup: function() { return /* reexport */ VxeColgroup; },
  1216. VxeColumn: function() { return /* reexport */ VxeColumn; },
  1217. VxeGrid: function() { return /* reexport */ VxeGrid; },
  1218. VxeTable: function() { return /* reexport */ VxeTable; },
  1219. VxeToolbar: function() { return /* reexport */ VxeToolbar; },
  1220. VxeUI: function() { return /* reexport */ core_.VxeUI; },
  1221. _t: function() { return /* reexport */ _t; },
  1222. clipboard: function() { return /* reexport */ clipboard; },
  1223. commands: function() { return /* reexport */ commands; },
  1224. config: function() { return /* reexport */ config; },
  1225. "default": function() { return /* binding */ entry_lib; },
  1226. formats: function() { return /* reexport */ formats; },
  1227. getConfig: function() { return /* reexport */ ui_getConfig; },
  1228. getI18n: function() { return /* reexport */ getI18n; },
  1229. getIcon: function() { return /* reexport */ getIcon; },
  1230. getTheme: function() { return /* reexport */ getTheme; },
  1231. globalEvents: function() { return /* reexport */ globalEvents; },
  1232. globalResize: function() { return /* reexport */ globalResize; },
  1233. install: function() { return /* reexport */ install; },
  1234. interceptor: function() { return /* reexport */ interceptor; },
  1235. log: function() { return /* reexport */ log; },
  1236. menus: function() { return /* reexport */ menus; },
  1237. modal: function() { return /* reexport */ modal; },
  1238. print: function() { return /* reexport */ print; },
  1239. readFile: function() { return /* reexport */ readFile; },
  1240. renderer: function() { return /* reexport */ renderer; },
  1241. saveFile: function() { return /* reexport */ saveFile; },
  1242. setConfig: function() { return /* reexport */ setConfig; },
  1243. setI18n: function() { return /* reexport */ setI18n; },
  1244. setIcon: function() { return /* reexport */ setIcon; },
  1245. setLanguage: function() { return /* reexport */ setLanguage; },
  1246. setTheme: function() { return /* reexport */ setTheme; },
  1247. setup: function() { return /* reexport */ setup; },
  1248. t: function() { return /* reexport */ t; },
  1249. use: function() { return /* reexport */ use; },
  1250. validators: function() { return /* reexport */ validators; },
  1251. version: function() { return /* reexport */ version; }
  1252. });
  1253. // NAMESPACE OBJECT: ./packages/components.ts
  1254. var components_namespaceObject = {};
  1255. __webpack_require__.r(components_namespaceObject);
  1256. __webpack_require__.d(components_namespaceObject, {
  1257. Colgroup: function() { return Colgroup; },
  1258. Column: function() { return Column; },
  1259. Grid: function() { return Grid; },
  1260. Table: function() { return Table; },
  1261. Toolbar: function() { return Toolbar; },
  1262. VXETable: function() { return VXETable; },
  1263. VxeColgroup: function() { return VxeColgroup; },
  1264. VxeColumn: function() { return VxeColumn; },
  1265. VxeGrid: function() { return VxeGrid; },
  1266. VxeTable: function() { return VxeTable; },
  1267. VxeToolbar: function() { return VxeToolbar; },
  1268. VxeUI: function() { return core_.VxeUI; },
  1269. _t: function() { return _t; },
  1270. clipboard: function() { return clipboard; },
  1271. commands: function() { return commands; },
  1272. config: function() { return config; },
  1273. formats: function() { return formats; },
  1274. getConfig: function() { return ui_getConfig; },
  1275. getI18n: function() { return getI18n; },
  1276. getIcon: function() { return getIcon; },
  1277. getTheme: function() { return getTheme; },
  1278. globalEvents: function() { return globalEvents; },
  1279. globalResize: function() { return globalResize; },
  1280. install: function() { return install; },
  1281. interceptor: function() { return interceptor; },
  1282. log: function() { return log; },
  1283. menus: function() { return menus; },
  1284. modal: function() { return modal; },
  1285. print: function() { return print; },
  1286. readFile: function() { return readFile; },
  1287. renderer: function() { return renderer; },
  1288. saveFile: function() { return saveFile; },
  1289. setConfig: function() { return setConfig; },
  1290. setI18n: function() { return setI18n; },
  1291. setIcon: function() { return setIcon; },
  1292. setLanguage: function() { return setLanguage; },
  1293. setTheme: function() { return setTheme; },
  1294. setup: function() { return setup; },
  1295. t: function() { return t; },
  1296. use: function() { return use; },
  1297. validators: function() { return validators; },
  1298. version: function() { return version; }
  1299. });
  1300. ;// CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/setPublicPath.js
  1301. /* eslint-disable no-var */
  1302. // This file is imported into lib/wc client bundles.
  1303. if (typeof window !== 'undefined') {
  1304. var currentScript = window.document.currentScript
  1305. if (false) { var getCurrentScript; }
  1306. var src = currentScript && currentScript.src.match(/(.+\/)[^/]+\.js(\?.*)?$/)
  1307. if (src) {
  1308. __webpack_require__.p = src[1] // eslint-disable-line
  1309. }
  1310. }
  1311. // Indicate to webpack that this file can be concatenated
  1312. /* harmony default export */ var setPublicPath = (null);
  1313. // EXTERNAL MODULE: external {"root":"VxeUI","commonjs":"@vxe-ui/core","commonjs2":"@vxe-ui/core","amd":"@vxe-ui/core"}
  1314. var core_ = __webpack_require__(4345);
  1315. // EXTERNAL MODULE: external {"root":"XEUtils","commonjs":"xe-utils","commonjs2":"xe-utils","amd":"xe-utils"}
  1316. var external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_ = __webpack_require__(8871);
  1317. var external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default = /*#__PURE__*/__webpack_require__.n(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_);
  1318. ;// CONCATENATED MODULE: ./node_modules/dom-zindex/es/index.esm.js
  1319. var winDom = null;
  1320. var bodyEl = null;
  1321. var storeEl = null;
  1322. var storeId = 'z-index-manage';
  1323. var styleEl = null;
  1324. var styleId = 'z-index-style';
  1325. var storeMainKey = 'm';
  1326. var storeSubKey = 's';
  1327. var storeData = {
  1328. m: 1000,
  1329. s: 1000
  1330. };
  1331. function getDocument() {
  1332. if (!winDom) {
  1333. if (typeof document !== 'undefined') {
  1334. winDom = document;
  1335. }
  1336. }
  1337. return winDom;
  1338. }
  1339. function getBody() {
  1340. if (winDom && !bodyEl) {
  1341. bodyEl = winDom.body || winDom.getElementsByTagName('body')[0];
  1342. }
  1343. return bodyEl;
  1344. }
  1345. function getDomMaxZIndex() {
  1346. var max = 0;
  1347. var dom = getDocument();
  1348. if (dom) {
  1349. var body = getBody();
  1350. if (body) {
  1351. var allElem = body.getElementsByTagName('*');
  1352. for (var i = 0; i < allElem.length; i++) {
  1353. var elem = allElem[i];
  1354. if (elem && elem.style && elem.nodeType === 1) {
  1355. var zIndex = elem.style.zIndex;
  1356. if (zIndex && /^\d+$/.test(zIndex)) {
  1357. max = Math.max(max, Number(zIndex));
  1358. }
  1359. }
  1360. }
  1361. }
  1362. }
  1363. return max;
  1364. }
  1365. function getStyle() {
  1366. if (!styleEl) {
  1367. var dom = getDocument();
  1368. if (dom) {
  1369. styleEl = dom.getElementById(styleId);
  1370. if (!styleEl) {
  1371. styleEl = dom.createElement('style');
  1372. styleEl.id = styleId;
  1373. dom.getElementsByTagName('head')[0].appendChild(styleEl);
  1374. }
  1375. }
  1376. }
  1377. return styleEl;
  1378. }
  1379. function updateVar() {
  1380. var styEl = getStyle();
  1381. if (styEl) {
  1382. var prefixes = '--dom-';
  1383. var propKey = '-z-index';
  1384. styEl.innerHTML = ':root{' + prefixes + 'main' + propKey + ':' + getCurrent() + ';' + prefixes + 'sub' + propKey + ':' + getSubCurrent() + '}';
  1385. }
  1386. }
  1387. function getStoreDom() {
  1388. if (!storeEl) {
  1389. var dom = getDocument();
  1390. if (dom) {
  1391. storeEl = dom.getElementById(storeId);
  1392. if (!storeEl) {
  1393. var body = getBody();
  1394. if (body) {
  1395. storeEl = dom.createElement('div');
  1396. storeEl.id = storeId;
  1397. storeEl.style.display = 'none';
  1398. body.appendChild(storeEl);
  1399. setCurrent(storeData.m);
  1400. setSubCurrent(storeData.s);
  1401. }
  1402. }
  1403. }
  1404. }
  1405. return storeEl;
  1406. }
  1407. function createSetHandle(key) {
  1408. return function (value) {
  1409. if (value) {
  1410. value = Number(value);
  1411. storeData[key] = value;
  1412. var el = getStoreDom();
  1413. if (el) {
  1414. if (el.dataset) {
  1415. el.dataset[key] = value + '';
  1416. } else {
  1417. el.setAttribute('data-' + key, value + '');
  1418. }
  1419. }
  1420. }
  1421. updateVar();
  1422. return storeData[key];
  1423. };
  1424. }
  1425. var setCurrent = createSetHandle(storeMainKey);
  1426. function createGetHandle(key, nextMethod) {
  1427. return function getCurrent(currZindex) {
  1428. var zIndex;
  1429. var el = getStoreDom();
  1430. if (el) {
  1431. var domVal = el.dataset ? el.dataset[key] : el.getAttribute('data-' + key);
  1432. if (domVal) {
  1433. zIndex = Number(domVal);
  1434. }
  1435. }
  1436. if (!zIndex) {
  1437. zIndex = storeData[key];
  1438. }
  1439. if (currZindex) {
  1440. if (Number(currZindex) < zIndex) {
  1441. return nextMethod();
  1442. }
  1443. return currZindex;
  1444. }
  1445. return zIndex;
  1446. };
  1447. }
  1448. var getCurrent = createGetHandle(storeMainKey, getNext);
  1449. function getNext() {
  1450. return setCurrent(getCurrent() + 1);
  1451. }
  1452. var setSubCurrent = createSetHandle(storeSubKey);
  1453. var _getSubCurrent = createGetHandle(storeSubKey, getSubNext);
  1454. function getSubCurrent() {
  1455. return getCurrent() + _getSubCurrent();
  1456. }
  1457. function getSubNext() {
  1458. setSubCurrent(_getSubCurrent() + 1);
  1459. return getSubCurrent();
  1460. }
  1461. /**
  1462. * Web common z-index style management
  1463. */
  1464. var DomZIndex = {
  1465. setCurrent: setCurrent,
  1466. getCurrent: getCurrent,
  1467. getNext: getNext,
  1468. setSubCurrent: setSubCurrent,
  1469. getSubCurrent: getSubCurrent,
  1470. getSubNext: getSubNext,
  1471. getMax: getDomMaxZIndex
  1472. };
  1473. updateVar();
  1474. /* harmony default export */ var index_esm = (DomZIndex);
  1475. ;// CONCATENATED MODULE: ./packages/ui/src/utils.ts
  1476. const {
  1477. getConfig
  1478. } = core_.VxeUI;
  1479. function isEnableConf(conf) {
  1480. return conf && conf.enabled !== false;
  1481. }
  1482. function isEmptyValue(cellValue) {
  1483. return cellValue === null || cellValue === undefined || cellValue === '';
  1484. }
  1485. function parseFile(file) {
  1486. const name = file.name;
  1487. const tIndex = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().lastIndexOf(name, '.');
  1488. const type = name.substring(tIndex + 1, name.length).toLowerCase();
  1489. const filename = name.substring(0, tIndex);
  1490. return {
  1491. filename,
  1492. type
  1493. };
  1494. }
  1495. function nextZIndex() {
  1496. return index_esm.getNext();
  1497. }
  1498. function getLastZIndex() {
  1499. return index_esm.getCurrent();
  1500. }
  1501. function hasChildrenList(item) {
  1502. return item && item.children && item.children.length > 0;
  1503. }
  1504. function getFuncText(content, args) {
  1505. if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(content)) {
  1506. return '';
  1507. }
  1508. const translate = getConfig().translate;
  1509. return `${translate ? translate('' + content, args) : content}`;
  1510. }
  1511. function formatText(value, placeholder) {
  1512. return '' + (isEmptyValue(value) ? placeholder ? getConfig().emptyCell : '' : value);
  1513. }
  1514. /**
  1515. * 判断值为:'' | null | undefined 时都属于空值
  1516. */
  1517. function eqEmptyValue(cellValue) {
  1518. return cellValue === '' || external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(cellValue);
  1519. }
  1520. function getClass(property, params) {
  1521. return property ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(property) ? property(params) : property : '';
  1522. }
  1523. ;// CONCATENATED MODULE: ./packages/ui/index.ts
  1524. const version = "3.19.1";
  1525. core_.VxeUI.version = version;
  1526. core_.VxeUI.tableVersion = version;
  1527. core_.VxeUI.setConfig({
  1528. emptyCell: ' ',
  1529. table: {
  1530. fit: true,
  1531. showHeader: true,
  1532. animat: true,
  1533. delayHover: 250,
  1534. autoResize: true,
  1535. padding: true,
  1536. minHeight: 144,
  1537. // keepSource: false,
  1538. // showOverflow: null,
  1539. // showHeaderOverflow: null,
  1540. // showFooterOverflow: null,
  1541. // resizeInterval: 500,
  1542. // size: null,
  1543. // zIndex: null,
  1544. // stripe: false,
  1545. // border: false,
  1546. // round: false,
  1547. // emptyText: '暂无数据',
  1548. // emptyRender: {
  1549. // name: ''
  1550. // },
  1551. // rowConfig: {
  1552. // keyField: '_X_ROW_KEY' // 行数据的唯一主键字段名
  1553. // },
  1554. resizeConfig: {
  1555. // refreshDelay: 20
  1556. },
  1557. resizableConfig: {
  1558. dragMode: 'auto',
  1559. showDragTip: true,
  1560. isSyncAutoHeight: true,
  1561. isSyncAutoWidth: true,
  1562. minHeight: 18
  1563. },
  1564. radioConfig: {
  1565. // trigger: 'default'
  1566. strict: true
  1567. },
  1568. rowDragConfig: {
  1569. showIcon: true,
  1570. animation: true,
  1571. showGuidesStatus: true,
  1572. showDragTip: true
  1573. },
  1574. columnDragConfig: {
  1575. showIcon: true,
  1576. animation: true,
  1577. showGuidesStatus: true,
  1578. showDragTip: true
  1579. },
  1580. checkboxConfig: {
  1581. // trigger: 'default',
  1582. strict: true
  1583. },
  1584. tooltipConfig: {
  1585. enterable: true
  1586. },
  1587. headerTooltipConfig: {
  1588. enterable: true
  1589. },
  1590. footerTooltipConfig: {
  1591. enterable: true
  1592. },
  1593. validConfig: {
  1594. showMessage: true,
  1595. autoClear: true,
  1596. autoPos: true,
  1597. message: 'inline',
  1598. msgMode: 'single',
  1599. theme: 'beautify'
  1600. },
  1601. columnConfig: {
  1602. autoOptions: {
  1603. isCalcHeader: true,
  1604. isCalcBody: true,
  1605. isCalcFooter: true
  1606. },
  1607. maxFixedSize: 4
  1608. },
  1609. cellConfig: {
  1610. padding: true
  1611. },
  1612. headerCellConfig: {
  1613. height: 'unset'
  1614. },
  1615. footerCellConfig: {
  1616. height: 'unset'
  1617. },
  1618. menuConfig: {
  1619. // visibleMethod () {},
  1620. // transfer: false,
  1621. destroyOnClose: true
  1622. },
  1623. customConfig: {
  1624. // enabled: false,
  1625. allowVisible: true,
  1626. allowResizable: true,
  1627. allowFixed: true,
  1628. allowSort: true,
  1629. showFooter: true,
  1630. placement: 'top-right',
  1631. // storage: false,
  1632. storeOptions: {
  1633. visible: true,
  1634. resizable: true,
  1635. sort: true,
  1636. fixed: true
  1637. // rowGroup: false,
  1638. // aggFunc: false
  1639. },
  1640. // autoAggGroupValues: false,
  1641. // checkMethod () {},
  1642. modalOptions: {
  1643. showMaximize: true,
  1644. mask: true,
  1645. lockView: true,
  1646. resize: true,
  1647. escClosable: true
  1648. },
  1649. drawerOptions: {
  1650. mask: true,
  1651. lockView: true,
  1652. escClosable: true,
  1653. resize: true
  1654. }
  1655. },
  1656. sortConfig: {
  1657. // remote: false,
  1658. // trigger: 'default',
  1659. // orders: ['asc', 'desc', null],
  1660. // sortMethod: null,
  1661. showIcon: true,
  1662. allowClear: true,
  1663. allowBtn: true,
  1664. iconLayout: 'vertical'
  1665. },
  1666. filterConfig: {
  1667. // remote: false,
  1668. // filterMethod: null,
  1669. // isEvery: false,
  1670. // transfer: false,
  1671. destroyOnClose: true,
  1672. multiple: true,
  1673. showIcon: true
  1674. },
  1675. floatingFilterConfig: {
  1676. // enabled: false
  1677. },
  1678. aggregateConfig: {
  1679. padding: true,
  1680. rowField: 'id',
  1681. parentField: '_X_ROW_PARENT_KEY',
  1682. childrenField: '_X_ROW_CHILDREN',
  1683. mapChildrenField: '_X_ROW_CHILD_LIST',
  1684. indent: 20,
  1685. showIcon: true,
  1686. maxGroupSize: 4,
  1687. showAggFuncTitle: true
  1688. },
  1689. treeConfig: {
  1690. padding: true,
  1691. rowField: 'id',
  1692. parentField: 'parentId',
  1693. childrenField: 'children',
  1694. hasChildField: 'hasChild',
  1695. mapChildrenField: '_X_ROW_CHILD',
  1696. indent: 20,
  1697. showIcon: true
  1698. },
  1699. expandConfig: {
  1700. // trigger: 'default',
  1701. showIcon: true,
  1702. mode: 'fixed'
  1703. },
  1704. editConfig: {
  1705. // mode: 'cell',
  1706. showIcon: true,
  1707. showAsterisk: true,
  1708. autoFocus: true
  1709. },
  1710. importConfig: {
  1711. _typeMaps: {
  1712. csv: 1,
  1713. html: 1,
  1714. xml: 1,
  1715. txt: 1
  1716. }
  1717. },
  1718. exportConfig: {
  1719. _typeMaps: {
  1720. csv: 1,
  1721. html: 1,
  1722. xml: 1,
  1723. txt: 1
  1724. }
  1725. },
  1726. printConfig: {},
  1727. mouseConfig: {
  1728. extension: true
  1729. },
  1730. keyboardConfig: {
  1731. isAll: true,
  1732. isEsc: true
  1733. },
  1734. areaConfig: {
  1735. autoClear: true,
  1736. selectCellByHeader: true,
  1737. selectCellByBody: true,
  1738. extendDirection: {
  1739. top: true,
  1740. left: true,
  1741. bottom: true,
  1742. right: true
  1743. }
  1744. },
  1745. clipConfig: {
  1746. isCopy: true,
  1747. isCut: true,
  1748. isPaste: true
  1749. },
  1750. fnrConfig: {
  1751. isFind: true,
  1752. isReplace: true
  1753. },
  1754. virtualXConfig: {
  1755. // enabled: false,
  1756. gt: 24,
  1757. preSize: 0,
  1758. oSize: 0
  1759. },
  1760. virtualYConfig: {
  1761. // enabled: false,
  1762. // mode: 'wheel',
  1763. gt: 100,
  1764. preSize: 1,
  1765. oSize: 0
  1766. },
  1767. scrollbarConfig: {
  1768. // width: 14,
  1769. // height: 14,
  1770. x: {
  1771. // position: 'bottom',
  1772. visible: true
  1773. },
  1774. y: {
  1775. // position: 'right',
  1776. visible: true
  1777. }
  1778. }
  1779. },
  1780. grid: {
  1781. // size: null,
  1782. // zoomConfig: {
  1783. // escRestore: true
  1784. // },
  1785. formConfig: {
  1786. enabled: true
  1787. },
  1788. pagerConfig: {
  1789. enabled: true
  1790. // perfect: false
  1791. },
  1792. toolbarConfig: {
  1793. enabled: true
  1794. // perfect: false
  1795. },
  1796. proxyConfig: {
  1797. enabled: true,
  1798. autoLoad: true,
  1799. showLoading: true,
  1800. showResponseMsg: true,
  1801. showActionMsg: true,
  1802. response: {
  1803. list: null,
  1804. result: 'result',
  1805. total: 'page.total',
  1806. message: 'message'
  1807. }
  1808. // beforeItem: null,
  1809. // beforeColumn: null,
  1810. // beforeQuery: null,
  1811. // afterQuery: null,
  1812. // beforeDelete: null,
  1813. // afterDelete: null,
  1814. // beforeSave: null,
  1815. // afterSave: null
  1816. }
  1817. },
  1818. toolbar: {
  1819. // size: null,
  1820. // import: {
  1821. // mode: 'covering'
  1822. // },
  1823. // export: {
  1824. // types: ['csv', 'html', 'xml', 'txt']
  1825. // },
  1826. // buttons: []
  1827. },
  1828. gantt: {}
  1829. });
  1830. const iconPrefix = 'vxe-table-icon-';
  1831. core_.VxeUI.setIcon({
  1832. // table
  1833. TABLE_SORT_ASC: iconPrefix + 'caret-up',
  1834. TABLE_SORT_DESC: iconPrefix + 'caret-down',
  1835. TABLE_FILTER_NONE: iconPrefix + 'funnel',
  1836. TABLE_FILTER_MATCH: iconPrefix + 'funnel',
  1837. TABLE_EDIT: iconPrefix + 'edit',
  1838. TABLE_TITLE_PREFIX: iconPrefix + 'question-circle-fill',
  1839. TABLE_TITLE_SUFFIX: iconPrefix + 'question-circle-fill',
  1840. TABLE_TREE_LOADED: iconPrefix + 'spinner roll',
  1841. TABLE_TREE_OPEN: iconPrefix + 'caret-right rotate90',
  1842. TABLE_TREE_CLOSE: iconPrefix + 'caret-right',
  1843. TABLE_EXPAND_LOADED: iconPrefix + 'spinner roll',
  1844. TABLE_EXPAND_OPEN: iconPrefix + 'arrow-right rotate90',
  1845. TABLE_EXPAND_CLOSE: iconPrefix + 'arrow-right',
  1846. TABLE_CHECKBOX_CHECKED: iconPrefix + 'checkbox-checked-fill',
  1847. TABLE_CHECKBOX_UNCHECKED: iconPrefix + 'checkbox-unchecked',
  1848. TABLE_CHECKBOX_INDETERMINATE: iconPrefix + 'checkbox-indeterminate-fill',
  1849. TABLE_CHECKBOX_DISABLED_UNCHECKED: iconPrefix + 'checkbox-unchecked-fill',
  1850. TABLE_RADIO_CHECKED: iconPrefix + 'radio-checked-fill',
  1851. TABLE_RADIO_UNCHECKED: iconPrefix + 'radio-unchecked',
  1852. TABLE_RADIO_DISABLED_UNCHECKED: iconPrefix + 'radio-unchecked-fill',
  1853. TABLE_CUSTOM_SORT: iconPrefix + 'drag-handle',
  1854. TABLE_MENU_OPTIONS: iconPrefix + 'arrow-right',
  1855. TABLE_DRAG_ROW: iconPrefix + 'drag-handle',
  1856. TABLE_DRAG_COLUMN: iconPrefix + 'drag-handle',
  1857. TABLE_DRAG_STATUS_ROW: iconPrefix + 'sort',
  1858. TABLE_DRAG_STATUS_SUB_ROW: iconPrefix + 'add-sub',
  1859. TABLE_DRAG_STATUS_AGG_GROUP: iconPrefix + 'grouping',
  1860. TABLE_DRAG_STATUS_AGG_VALUES: iconPrefix + 'values',
  1861. TABLE_DRAG_STATUS_COLUMN: iconPrefix + 'swap',
  1862. TABLE_DRAG_DISABLED: iconPrefix + 'no-drop',
  1863. TABLE_ROW_GROUP_OPEN: iconPrefix + 'arrow-right rotate90',
  1864. TABLE_ROW_GROUP_CLOSE: iconPrefix + 'arrow-right',
  1865. TABLE_AGGREGATE_GROUPING: iconPrefix + 'grouping',
  1866. TABLE_AGGREGATE_VALUES: iconPrefix + 'values',
  1867. TABLE_AGGREGATE_SORT: iconPrefix + 'drag-handle',
  1868. TABLE_AGGREGATE_DELETE: iconPrefix + 'close',
  1869. // toolbar
  1870. TOOLBAR_TOOLS_REFRESH: iconPrefix + 'repeat',
  1871. TOOLBAR_TOOLS_REFRESH_LOADING: iconPrefix + 'repeat roll',
  1872. TOOLBAR_TOOLS_IMPORT: iconPrefix + 'upload',
  1873. TOOLBAR_TOOLS_EXPORT: iconPrefix + 'download',
  1874. TOOLBAR_TOOLS_PRINT: iconPrefix + 'print',
  1875. TOOLBAR_TOOLS_FULLSCREEN: iconPrefix + 'fullscreen',
  1876. TOOLBAR_TOOLS_MINIMIZE: iconPrefix + 'minimize',
  1877. TOOLBAR_TOOLS_CUSTOM: iconPrefix + 'custom-column',
  1878. TOOLBAR_TOOLS_FIXED_LEFT: iconPrefix + 'fixed-left',
  1879. TOOLBAR_TOOLS_FIXED_LEFT_ACTIVE: iconPrefix + 'fixed-left-fill',
  1880. TOOLBAR_TOOLS_FIXED_RIGHT: iconPrefix + 'fixed-right',
  1881. TOOLBAR_TOOLS_FIXED_RIGHT_ACTIVE: iconPrefix + 'fixed-right-fill'
  1882. });
  1883. const setTheme = core_.VxeUI.setTheme;
  1884. const getTheme = core_.VxeUI.getTheme;
  1885. const setConfig = core_.VxeUI.setConfig;
  1886. const ui_getConfig = core_.VxeUI.getConfig;
  1887. const setIcon = core_.VxeUI.setIcon;
  1888. const getIcon = core_.VxeUI.getIcon;
  1889. const setLanguage = core_.VxeUI.setLanguage;
  1890. const setI18n = core_.VxeUI.setI18n;
  1891. const getI18n = core_.VxeUI.getI18n;
  1892. const globalEvents = core_.VxeUI.globalEvents;
  1893. const globalResize = core_.VxeUI.globalResize;
  1894. const renderer = core_.VxeUI.renderer;
  1895. const validators = core_.VxeUI.validators;
  1896. const menus = core_.VxeUI.menus;
  1897. const formats = core_.VxeUI.formats;
  1898. const commands = core_.VxeUI.commands;
  1899. const interceptor = core_.VxeUI.interceptor;
  1900. const clipboard = core_.VxeUI.clipboard;
  1901. const log = core_.VxeUI.log;
  1902. const use = core_.VxeUI.use;
  1903. /**
  1904. * 已废弃
  1905. * @deprecated
  1906. */
  1907. const setup = options => {
  1908. return core_.VxeUI.setConfig(options);
  1909. };
  1910. core_.VxeUI.setup = setup;
  1911. /**
  1912. * 已废弃
  1913. * @deprecated
  1914. */
  1915. const config = options => {
  1916. return core_.VxeUI.setConfig(options);
  1917. };
  1918. core_.VxeUI.config = config;
  1919. /**
  1920. * 已废弃
  1921. * @deprecated
  1922. */
  1923. const t = (key, args) => {
  1924. return core_.VxeUI.getI18n(key, args);
  1925. };
  1926. core_.VxeUI.t = t;
  1927. /**
  1928. * 已废弃
  1929. * @deprecated
  1930. */
  1931. const _t = (content, args) => {
  1932. return getFuncText(content, args);
  1933. };
  1934. core_.VxeUI._t = _t;
  1935. /**
  1936. * 已废弃,兼容老版本
  1937. * @deprecated
  1938. */
  1939. const VXETable = core_.VxeUI;
  1940. /**
  1941. * 已废弃,兼容老版本
  1942. * @deprecated
  1943. */
  1944. const saveFile = options => {
  1945. return core_.VxeUI.saveFile(options);
  1946. };
  1947. /**
  1948. * 已废弃,兼容老版本
  1949. * @deprecated
  1950. */
  1951. const readFile = options => {
  1952. return core_.VxeUI.readFile(options);
  1953. };
  1954. /**
  1955. * 已废弃,兼容老版本
  1956. * @deprecated
  1957. */
  1958. const print = options => {
  1959. return core_.VxeUI.print(options);
  1960. };
  1961. /**
  1962. * 已废弃,兼容老版本
  1963. * @deprecated
  1964. */
  1965. const modal = {
  1966. /**
  1967. * 已废弃,兼容老版本
  1968. * @deprecated
  1969. */
  1970. get(id) {
  1971. return core_.VxeUI.modal.get(id);
  1972. },
  1973. /**
  1974. * 已废弃,兼容老版本
  1975. * @deprecated
  1976. */
  1977. close(id) {
  1978. return core_.VxeUI.modal.close(id);
  1979. },
  1980. /**
  1981. * 已废弃,兼容老版本
  1982. * @deprecated
  1983. */
  1984. open(options) {
  1985. return core_.VxeUI.modal.open(options);
  1986. },
  1987. /**
  1988. * 已废弃,兼容老版本
  1989. * @deprecated
  1990. */
  1991. alert(content, title, options) {
  1992. return core_.VxeUI.modal.alert(content, title, options);
  1993. },
  1994. /**
  1995. * 已废弃,兼容老版本
  1996. * @deprecated
  1997. */
  1998. confirm(content, title, options) {
  1999. return core_.VxeUI.modal.confirm(content, title, options);
  2000. },
  2001. /**
  2002. * 已废弃,兼容老版本
  2003. * @deprecated
  2004. */
  2005. message(content, options) {
  2006. return core_.VxeUI.modal.message(content, options);
  2007. },
  2008. /**
  2009. * 已废弃,兼容老版本
  2010. * @deprecated
  2011. */
  2012. notification(content, title, options) {
  2013. return core_.VxeUI.modal.notification(content, title, options);
  2014. }
  2015. };
  2016. /* harmony default export */ var ui = ((/* unused pure expression or super */ null && (VxeUI)));
  2017. // EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.push.js
  2018. var es_array_push = __webpack_require__(4114);
  2019. ;// CONCATENATED MODULE: ./packages/ui/src/dom.ts
  2020. const reClsMap = {};
  2021. let tpImgEl;
  2022. function initTpImg() {
  2023. if (!tpImgEl) {
  2024. tpImgEl = new Image();
  2025. tpImgEl.src = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=';
  2026. }
  2027. return tpImgEl;
  2028. }
  2029. function getTpImg() {
  2030. if (!tpImgEl) {
  2031. return initTpImg();
  2032. }
  2033. return tpImgEl;
  2034. }
  2035. function getPropClass(property, params) {
  2036. return property ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(property) ? property(params) : property : '';
  2037. }
  2038. function getClsRE(cls) {
  2039. if (!reClsMap[cls]) {
  2040. reClsMap[cls] = new RegExp(`(?:^|\\s)${cls}(?!\\S)`, 'g');
  2041. }
  2042. return reClsMap[cls];
  2043. }
  2044. function getNodeOffset(elem, container, rest) {
  2045. if (elem) {
  2046. const parentElem = elem.parentNode;
  2047. rest.top += elem.offsetTop;
  2048. rest.left += elem.offsetLeft;
  2049. if (parentElem && parentElem !== document.documentElement && parentElem !== document.body) {
  2050. rest.top -= parentElem.scrollTop;
  2051. rest.left -= parentElem.scrollLeft;
  2052. }
  2053. if (container && (elem === container || elem.offsetParent === container) ? 0 : elem.offsetParent) {
  2054. return getNodeOffset(elem.offsetParent, container, rest);
  2055. }
  2056. }
  2057. return rest;
  2058. }
  2059. function isPx(val) {
  2060. return val && /^\d+(px)?$/.test(val);
  2061. }
  2062. function isScale(val) {
  2063. return val && /^\d+%$/.test(val);
  2064. }
  2065. function hasClass(elem, cls) {
  2066. return !!(elem && elem.className && elem.className.match && elem.className.match(getClsRE(cls)));
  2067. }
  2068. function removeClass(elem, cls) {
  2069. if (elem && hasClass(elem, cls)) {
  2070. elem.className = elem.className.replace(getClsRE(cls), '');
  2071. }
  2072. }
  2073. function addClass(elem, cls) {
  2074. if (elem && !hasClass(elem, cls)) {
  2075. removeClass(elem, cls);
  2076. elem.className = `${elem.className} ${cls}`;
  2077. }
  2078. }
  2079. function hasControlKey(evnt) {
  2080. return evnt.ctrlKey || evnt.metaKey;
  2081. }
  2082. function toCssUnit(val, unit = 'px') {
  2083. if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(val) || /^\d+$/.test(`${val}`)) {
  2084. return `${val}${unit}`;
  2085. }
  2086. return `${val || ''}`;
  2087. }
  2088. function queryElement(elem, selector) {
  2089. if (elem) {
  2090. return elem.querySelector(selector);
  2091. }
  2092. return null;
  2093. }
  2094. function getDomNode() {
  2095. const documentElement = document.documentElement;
  2096. const bodyElem = document.body;
  2097. return {
  2098. scrollTop: documentElement.scrollTop || bodyElem.scrollTop,
  2099. scrollLeft: documentElement.scrollLeft || bodyElem.scrollLeft,
  2100. visibleHeight: documentElement.clientHeight || bodyElem.clientHeight,
  2101. visibleWidth: documentElement.clientWidth || bodyElem.clientWidth
  2102. };
  2103. }
  2104. function getOffsetHeight(elem) {
  2105. return elem ? elem.offsetHeight : 0;
  2106. }
  2107. function getPaddingTopBottomSize(elem) {
  2108. if (elem) {
  2109. const computedStyle = getComputedStyle(elem);
  2110. const paddingTop = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(computedStyle.paddingTop);
  2111. const paddingBottom = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(computedStyle.paddingBottom);
  2112. return paddingTop + paddingBottom;
  2113. }
  2114. return 0;
  2115. }
  2116. function setScrollTop(elem, scrollTop) {
  2117. if (elem) {
  2118. elem.scrollTop = scrollTop;
  2119. }
  2120. }
  2121. function setScrollLeft(elem, scrollLeft) {
  2122. if (elem) {
  2123. elem.scrollLeft = scrollLeft;
  2124. }
  2125. }
  2126. // export function setScrollLeftAndTop (elem: HTMLElement | null, scrollLeft: number, scrollTop: number) {
  2127. // if (elem) {
  2128. // elem.scrollLeft = scrollLeft
  2129. // elem.scrollTop = scrollTop
  2130. // }
  2131. // }
  2132. function updateCellTitle(overflowElem, column) {
  2133. const content = column.type === 'html' ? overflowElem.innerText : overflowElem.textContent;
  2134. if (overflowElem.getAttribute('title') !== content) {
  2135. overflowElem.setAttribute('title', content);
  2136. }
  2137. }
  2138. /**
  2139. * 检查触发源是否属于目标节点
  2140. */
  2141. function getEventTargetNode(evnt, container, queryCls, queryMethod) {
  2142. let targetElem;
  2143. let target = evnt.target.shadowRoot && evnt.composed ? evnt.composedPath()[0] || evnt.target : evnt.target;
  2144. while (target && target.nodeType && target !== document) {
  2145. if (queryCls && hasClass(target, queryCls) && (!queryMethod || queryMethod(target))) {
  2146. targetElem = target;
  2147. } else if (target === container) {
  2148. return {
  2149. flag: queryCls ? !!targetElem : true,
  2150. container,
  2151. targetElem: targetElem
  2152. };
  2153. }
  2154. target = target.parentNode;
  2155. }
  2156. return {
  2157. flag: false
  2158. };
  2159. }
  2160. /**
  2161. * 获取元素相对于 document 的位置
  2162. */
  2163. function getOffsetPos(elem, container) {
  2164. return getNodeOffset(elem, container, {
  2165. left: 0,
  2166. top: 0
  2167. });
  2168. }
  2169. function getAbsolutePos(elem) {
  2170. const bounding = elem.getBoundingClientRect();
  2171. const boundingTop = bounding.top;
  2172. const boundingLeft = bounding.left;
  2173. const {
  2174. scrollTop,
  2175. scrollLeft,
  2176. visibleHeight,
  2177. visibleWidth
  2178. } = getDomNode();
  2179. return {
  2180. boundingTop,
  2181. top: scrollTop + boundingTop,
  2182. boundingLeft,
  2183. left: scrollLeft + boundingLeft,
  2184. visibleHeight,
  2185. visibleWidth
  2186. };
  2187. }
  2188. const scrollIntoViewIfNeeded = 'scrollIntoViewIfNeeded';
  2189. const scrollIntoView = 'scrollIntoView';
  2190. function scrollToView(elem) {
  2191. if (elem) {
  2192. if (elem[scrollIntoViewIfNeeded]) {
  2193. elem[scrollIntoViewIfNeeded]();
  2194. } else if (elem[scrollIntoView]) {
  2195. elem[scrollIntoView]();
  2196. }
  2197. }
  2198. }
  2199. function triggerEvent(targetElem, type) {
  2200. if (targetElem) {
  2201. targetElem.dispatchEvent(new Event(type));
  2202. }
  2203. }
  2204. function isNodeElement(elem) {
  2205. return elem && elem.nodeType === 1;
  2206. }
  2207. ;// CONCATENATED MODULE: ./packages/ui/src/log.ts
  2208. const {
  2209. log: log_log
  2210. } = core_.VxeUI;
  2211. const log_version = `table v${"3.19.1"}`;
  2212. const warnLog = log_log.create('warn', log_version);
  2213. const errLog = log_log.create('error', log_version);
  2214. ;// CONCATENATED MODULE: ./packages/table/src/columnInfo.ts
  2215. const {
  2216. getI18n: columnInfo_getI18n,
  2217. formats: columnInfo_formats,
  2218. renderer: columnInfo_renderer
  2219. } = core_.VxeUI;
  2220. class ColumnInfo {
  2221. /* eslint-disable @typescript-eslint/no-use-before-define */
  2222. constructor($xeTable, _vm, {
  2223. renderHeader,
  2224. renderCell,
  2225. renderFooter,
  2226. renderData
  2227. } = {}) {
  2228. const tableProps = $xeTable;
  2229. const $xeGrid = $xeTable.$xeGrid;
  2230. const $xeGantt = $xeTable.$xeGantt;
  2231. const $xeGGWrapper = $xeGrid || $xeGantt;
  2232. const {
  2233. field,
  2234. editRender,
  2235. filterRender
  2236. } = _vm;
  2237. const colId = _vm.colId || external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().uniqueId('col_');
  2238. const proxyOpts = $xeGrid ? $xeGrid.computeProxyOpts : null;
  2239. const formatter = _vm.formatter;
  2240. const visible = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isBoolean(_vm.visible) ? _vm.visible : true;
  2241. const flCompConf = isEnableConf(filterRender) ? columnInfo_renderer.get(filterRender.name) : null;
  2242. const ctFilterOptions = flCompConf ? flCompConf.createTableFilterOptions : null;
  2243. const filters = toFilters(_vm.filters, colId);
  2244. const types = ['seq', 'checkbox', 'radio', 'expand', 'html'];
  2245. if (_vm.type && types.indexOf(_vm.type) === -1) {
  2246. warnLog('vxe.error.errProp', [`type=${_vm.type}`, types.join(', ')]);
  2247. }
  2248. if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isBoolean(_vm.cellRender) || _vm.cellRender && !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isObject(_vm.cellRender)) {
  2249. warnLog('vxe.error.errProp', [`column.cell-render=${_vm.cellRender}`, 'column.cell-render={}']);
  2250. }
  2251. if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isBoolean(_vm.editRender) || _vm.editRender && !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isObject(_vm.editRender)) {
  2252. warnLog('vxe.error.errProp', [`column.edit-render=${_vm.editRender}`, 'column.edit-render={}']);
  2253. }
  2254. if (_vm.type === 'expand') {
  2255. const {
  2256. treeConfig
  2257. } = tableProps;
  2258. if (treeConfig && ($xeTable.treeOpts.showLine || $xeTable.treeOpts.line)) {
  2259. errLog('vxe.error.errConflicts', ['tree-config.line', 'column.type=expand']);
  2260. }
  2261. }
  2262. if (_vm.remoteSort) {
  2263. warnLog('vxe.error.delProp', ['column.remote-sort', 'sort-config.remote']);
  2264. }
  2265. if (_vm.sortMethod) {
  2266. warnLog('vxe.error.delProp', ['column.sort-method', 'sort-config.sortMethod']);
  2267. }
  2268. if (formatter) {
  2269. if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(formatter)) {
  2270. const gFormatOpts = columnInfo_formats.get(formatter) || (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default())[formatter];
  2271. if (!gFormatOpts || !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(gFormatOpts.tableCellFormatMethod || gFormatOpts.cellFormatMethod)) {
  2272. errLog('vxe.error.notFormats', [formatter]);
  2273. }
  2274. } else if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(formatter)) {
  2275. const gFormatOpts = columnInfo_formats.get(formatter[0]) || (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default())[formatter[0]];
  2276. if (!gFormatOpts || !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(gFormatOpts.tableCellFormatMethod || gFormatOpts.cellFormatMethod)) {
  2277. errLog('vxe.error.notFormats', [formatter[0]]);
  2278. }
  2279. }
  2280. }
  2281. if (_vm.aggFunc) {
  2282. if (!$xeTable.handlePivotTableAggregateData && _vm.aggFunc !== true) {
  2283. errLog('vxe.error.errProp', [`column.agg-func=${_vm.aggFunc}`, 'column.agg-func=true']);
  2284. }
  2285. }
  2286. if (field && editRender) {
  2287. if (editRender.startField && `${editRender.startField}`.indexOf(field) >= 0) {
  2288. errLog('vxe.error.modelConflicts', [`field=${field}`, `edit-render.startField=${editRender.startField}`]);
  2289. }
  2290. if (editRender.endField && `${editRender.endField}`.indexOf(field) >= 0) {
  2291. errLog('vxe.error.modelConflicts', [`field=${field}`, `edit-render.endField=${editRender.endField}`]);
  2292. }
  2293. }
  2294. Object.assign(this, {
  2295. // 基本属性
  2296. type: _vm.type,
  2297. property: _vm.field,
  2298. field: field,
  2299. title: _vm.title,
  2300. width: _vm.width,
  2301. minWidth: _vm.minWidth,
  2302. maxWidth: _vm.maxWidth,
  2303. resizable: _vm.resizable,
  2304. fixed: _vm.fixed,
  2305. align: _vm.align,
  2306. headerAlign: _vm.headerAlign,
  2307. footerAlign: _vm.footerAlign,
  2308. showOverflow: _vm.showOverflow,
  2309. showHeaderOverflow: _vm.showHeaderOverflow,
  2310. showFooterOverflow: _vm.showFooterOverflow,
  2311. className: _vm.className,
  2312. headerClassName: _vm.headerClassName,
  2313. footerClassName: _vm.footerClassName,
  2314. formatter,
  2315. headerFormatter: _vm.headerFormatter,
  2316. footerFormatter: _vm.footerFormatter,
  2317. padding: _vm.padding,
  2318. verticalAlign: _vm.verticalAlign,
  2319. sortable: _vm.sortable,
  2320. sortBy: _vm.sortBy,
  2321. sortType: _vm.sortType,
  2322. sortMethod: _vm.sortMethod,
  2323. remoteSort: _vm.remoteSort,
  2324. filters: filters,
  2325. filterMultiple: external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isBoolean(_vm.filterMultiple) ? _vm.filterMultiple : true,
  2326. filterMethod: _vm.filterMethod,
  2327. filterResetMethod: _vm.filterResetMethod,
  2328. filterRecoverMethod: _vm.filterRecoverMethod,
  2329. filterRender: filterRender,
  2330. floatingFilters: _vm.floatingFilters,
  2331. rowGroupNode: _vm.rowGroupNode,
  2332. treeNode: _vm.treeNode,
  2333. dragSort: _vm.dragSort,
  2334. rowResize: _vm.rowResize,
  2335. cellType: _vm.cellType,
  2336. cellRender: _vm.cellRender,
  2337. editRender: editRender,
  2338. contentRender: _vm.contentRender,
  2339. headerExportMethod: _vm.headerExportMethod,
  2340. exportMethod: _vm.exportMethod,
  2341. footerExportMethod: _vm.footerExportMethod,
  2342. titleHelp: _vm.titleHelp,
  2343. titlePrefix: _vm.titlePrefix,
  2344. titleSuffix: _vm.titleSuffix,
  2345. aggFunc: _vm.aggFunc,
  2346. // 自定义参数
  2347. params: _vm.params,
  2348. // 渲染属性
  2349. id: colId,
  2350. parentId: null,
  2351. visible,
  2352. // 内部属性(一旦被使用,将导致不可升级版本)
  2353. defaultParentId: null,
  2354. halfVisible: false,
  2355. defaultVisible: visible,
  2356. defaultFixed: _vm.fixed,
  2357. defaultAggGroup: _vm.aggGroup,
  2358. defaultAggFunc: _vm.aggFunc,
  2359. checked: false,
  2360. halfChecked: false,
  2361. disabled: false,
  2362. // 分组层级
  2363. level: 1,
  2364. // 跨行
  2365. rowSpan: 1,
  2366. // 跨列
  2367. colSpan: 1,
  2368. // 数据排序
  2369. order: null,
  2370. sortTime: 0,
  2371. // 列排序
  2372. sortNumber: 0,
  2373. renderSortNumber: 0,
  2374. renderAggFn: '',
  2375. renderFixed: '',
  2376. renderVisible: false,
  2377. renderWidth: 0,
  2378. renderHeight: 0,
  2379. renderResizeWidth: 0,
  2380. renderAutoWidth: 0,
  2381. resizeWidth: 0,
  2382. renderLeft: 0,
  2383. renderArgs: [],
  2384. model: {},
  2385. renderHeader: renderHeader || _vm.renderHeader,
  2386. renderCell: renderCell || _vm.renderCell,
  2387. renderFooter: renderFooter || _vm.renderFooter,
  2388. renderData,
  2389. // 单元格插槽,只对 grid 有效
  2390. slots: _vm.slots
  2391. });
  2392. if (ctFilterOptions && (!filters || !filters.length)) {
  2393. this.filters = toFilters(ctFilterOptions({
  2394. $table: $xeTable,
  2395. column: this
  2396. }), colId);
  2397. }
  2398. if ($xeGGWrapper) {
  2399. if (proxyOpts && proxyOpts.beforeColumn) {
  2400. proxyOpts.beforeColumn({
  2401. $table: $xeTable,
  2402. $grid: $xeGrid,
  2403. $gantt: $xeGantt,
  2404. column: this
  2405. });
  2406. }
  2407. }
  2408. }
  2409. getTitle() {
  2410. return getFuncText(this.title || (this.type === 'seq' ? columnInfo_getI18n('vxe.table.seqTitle') : ''));
  2411. }
  2412. getKey() {
  2413. const {
  2414. type
  2415. } = this;
  2416. return this.field || (type ? `type=${type}` : null);
  2417. }
  2418. update(name, value) {
  2419. // 不支持直接修改的属性
  2420. if (name !== 'filters') {
  2421. if (name === 'field') {
  2422. // 兼容旧属性
  2423. this.property = value;
  2424. }
  2425. this[name] = value;
  2426. }
  2427. }
  2428. }
  2429. ;// CONCATENATED MODULE: ./packages/table/src/util.ts
  2430. function createInternalData() {
  2431. return {
  2432. tZindex: 0,
  2433. currKeyField: '',
  2434. isCurrDeepKey: false,
  2435. elemStore: {},
  2436. // 存放横向 X 虚拟滚动相关的信息
  2437. scrollXStore: {
  2438. preloadSize: 0,
  2439. offsetSize: 0,
  2440. visibleSize: 0,
  2441. visibleStartIndex: 0,
  2442. visibleEndIndex: 0,
  2443. startIndex: 0,
  2444. endIndex: 0
  2445. },
  2446. // 存放纵向 Y 虚拟滚动相关信息
  2447. scrollYStore: {
  2448. preloadSize: 0,
  2449. offsetSize: 0,
  2450. visibleSize: 0,
  2451. visibleStartIndex: 0,
  2452. visibleEndIndex: 0,
  2453. startIndex: 0,
  2454. endIndex: 0
  2455. },
  2456. // 表格宽度
  2457. tableWidth: 0,
  2458. // 表格高度
  2459. tableHeight: 0,
  2460. customHeight: 0,
  2461. customMinHeight: 0,
  2462. customMaxHeight: 0,
  2463. // 当前 hover 行
  2464. hoverRow: null,
  2465. // 最后滚动位置
  2466. lastScrollLeft: 0,
  2467. lastScrollTop: 0,
  2468. // 单选框属性,已选中保留的行
  2469. radioReserveRow: null,
  2470. // 复选框属性,已选中保留的行集合
  2471. checkboxReserveRowMap: {},
  2472. // 行数据,已展开保留的行集合
  2473. rowExpandedReserveRowMap: {},
  2474. // 树结构数据,已展开保留的行集合
  2475. treeExpandedReserveRowMap: {},
  2476. // 树结构数据,不确定状态的集合
  2477. treeIndeterminateRowMaps: {},
  2478. // 列表完整数据、条件处理后
  2479. tableFullData: [],
  2480. afterFullData: [],
  2481. afterTreeFullData: [],
  2482. afterGroupFullData: [],
  2483. // 列表条件处理后数据集合
  2484. afterFullRowMaps: {},
  2485. // 树结构完整数据、条件处理后
  2486. tableFullTreeData: [],
  2487. // 行分组全量数据、条件处理后
  2488. tableFullGroupData: [],
  2489. tableSynchData: [],
  2490. tableSourceData: [],
  2491. // 收集的列配置(带分组)
  2492. collectColumn: [],
  2493. // 完整所有列(不带分组)
  2494. tableFullColumn: [],
  2495. // 渲染所有列
  2496. visibleColumn: [],
  2497. // 全量数据集(包括当前和已删除)
  2498. fullAllDataRowIdData: {},
  2499. // 数据集(仅当前)
  2500. fullDataRowIdData: {},
  2501. // 数据集(仅可视)
  2502. visibleDataRowIdData: {},
  2503. // 渲染中缓存数据
  2504. sourceDataRowIdData: {},
  2505. fullColumnIdData: {},
  2506. fullColumnFieldData: {},
  2507. // 合并表头单元格的数据
  2508. mergeHeaderList: [],
  2509. mergeHeaderMaps: {},
  2510. // 已合并单元格数据集合
  2511. mergeHeaderCellMaps: {},
  2512. // 合并单元格的数据
  2513. mergeBodyList: [],
  2514. mergeBodyMaps: {},
  2515. // 已合并单元格数据集合
  2516. mergeBodyCellMaps: {},
  2517. // 合并表尾的数据
  2518. mergeFooterList: [],
  2519. mergeFooterMaps: {},
  2520. // 已合并表尾数据集合
  2521. mergeFooterCellMaps: {},
  2522. // 已展开的行集合
  2523. rowExpandedMaps: {},
  2524. // 懒加载中的展开行的集合
  2525. rowExpandLazyLoadedMaps: {},
  2526. // 已展开的分组行
  2527. rowGroupExpandedMaps: {},
  2528. // 已展开树节点集合
  2529. treeExpandedMaps: {},
  2530. // 懒加载中的树节点的集合
  2531. treeExpandLazyLoadedMaps: {},
  2532. // 复选框属性,已选中的行集合
  2533. selectCheckboxMaps: {},
  2534. // 已标记的对象集
  2535. pendingRowMaps: {},
  2536. // 已新增的临时行
  2537. insertRowMaps: {},
  2538. // 已删除行
  2539. removeRowMaps: {},
  2540. cvCacheMaps: {},
  2541. // 表头高度
  2542. tHeaderHeight: 0,
  2543. // 表体高度
  2544. tBodyHeight: 0,
  2545. // 表尾高度
  2546. tFooterHeight: 0,
  2547. teleportToWrapperElem: null,
  2548. popupToWrapperElem: null,
  2549. inited: false,
  2550. tooltipTimeout: null,
  2551. initStatus: false,
  2552. isActivated: false
  2553. };
  2554. }
  2555. const getAllConvertColumns = (columns, parentColumn) => {
  2556. const result = [];
  2557. columns.forEach(column => {
  2558. column.parentId = parentColumn ? parentColumn.id : null;
  2559. if (column.visible) {
  2560. if (column.children && column.children.length && column.children.some(column => column.visible)) {
  2561. result.push(column);
  2562. result.push(...getAllConvertColumns(column.children, column));
  2563. } else {
  2564. result.push(column);
  2565. }
  2566. }
  2567. });
  2568. return result;
  2569. };
  2570. const convertHeaderColumnToRows = originColumns => {
  2571. let maxLevel = 1;
  2572. const traverse = (column, parent) => {
  2573. if (parent) {
  2574. column.level = parent.level + 1;
  2575. if (maxLevel < column.level) {
  2576. maxLevel = column.level;
  2577. }
  2578. }
  2579. if (column.children && column.children.length && column.children.some(column => column.visible)) {
  2580. let colSpan = 0;
  2581. column.children.forEach(subColumn => {
  2582. if (subColumn.visible) {
  2583. traverse(subColumn, column);
  2584. colSpan += subColumn.colSpan;
  2585. }
  2586. });
  2587. column.colSpan = colSpan;
  2588. } else {
  2589. column.colSpan = 1;
  2590. }
  2591. };
  2592. originColumns.forEach(column => {
  2593. column.level = 1;
  2594. traverse(column);
  2595. });
  2596. const rows = [];
  2597. for (let i = 0; i < maxLevel; i++) {
  2598. rows.push([]);
  2599. }
  2600. const allColumns = getAllConvertColumns(originColumns);
  2601. allColumns.forEach(column => {
  2602. if (column.children && column.children.length && column.children.some(column => column.visible)) {
  2603. column.rowSpan = 1;
  2604. } else {
  2605. column.rowSpan = maxLevel - column.level + 1;
  2606. }
  2607. rows[column.level - 1].push(column);
  2608. });
  2609. return rows;
  2610. };
  2611. function convertHeaderToGridRows(spanColumns) {
  2612. const rSize = spanColumns.length;
  2613. const cSize = spanColumns[0].reduce((sum, cell) => sum + cell.colSpan, 0);
  2614. const occupiedRows = [];
  2615. const fullRows = [];
  2616. for (let rIndex = 0; rIndex < rSize; rIndex++) {
  2617. const oCols = [];
  2618. const dCols = [];
  2619. for (let cIndex = 0; cIndex < cSize; cIndex++) {
  2620. oCols.push(false);
  2621. dCols.push('');
  2622. }
  2623. occupiedRows.push(oCols);
  2624. fullRows.push(dCols);
  2625. }
  2626. for (let rIndex = 0; rIndex < rSize; rIndex++) {
  2627. let currColIndex = 0;
  2628. for (const column of spanColumns[rIndex]) {
  2629. const {
  2630. colSpan,
  2631. rowSpan
  2632. } = column;
  2633. let startColIndex = -1;
  2634. for (let ccIndex = currColIndex; ccIndex <= cSize - colSpan; ccIndex++) {
  2635. let oFlag = true;
  2636. for (let csIndex = 0; csIndex < colSpan; csIndex++) {
  2637. if (occupiedRows[rIndex][ccIndex + csIndex]) {
  2638. oFlag = false;
  2639. break;
  2640. }
  2641. }
  2642. if (oFlag) {
  2643. startColIndex = ccIndex;
  2644. break;
  2645. }
  2646. }
  2647. if (startColIndex === -1) {
  2648. for (let j = 0; j <= cSize - colSpan; j++) {
  2649. let oFlag = true;
  2650. for (let k = 0; k < colSpan; k++) {
  2651. if (occupiedRows[rIndex][j + k]) {
  2652. oFlag = false;
  2653. break;
  2654. }
  2655. }
  2656. if (oFlag) {
  2657. startColIndex = j;
  2658. break;
  2659. }
  2660. }
  2661. if (startColIndex === -1) {
  2662. // error
  2663. break;
  2664. }
  2665. }
  2666. for (let srIndex = rIndex; srIndex < rIndex + rowSpan; srIndex++) {
  2667. for (let scIndex = startColIndex; scIndex < startColIndex + colSpan; scIndex++) {
  2668. occupiedRows[srIndex][scIndex] = true;
  2669. fullRows[srIndex][scIndex] = column;
  2670. }
  2671. }
  2672. currColIndex = startColIndex + colSpan;
  2673. }
  2674. }
  2675. return fullRows;
  2676. }
  2677. function restoreScrollLocation($xeTable, scrollLeft, scrollTop) {
  2678. const internalData = $xeTable;
  2679. if (scrollLeft || scrollTop) {
  2680. internalData.intoRunScroll = false;
  2681. internalData.inVirtualScroll = false;
  2682. internalData.inWheelScroll = false;
  2683. internalData.inHeaderScroll = false;
  2684. internalData.inBodyScroll = false;
  2685. internalData.inFooterScroll = false;
  2686. internalData.scrollRenderType = '';
  2687. // 还原滚动状态
  2688. return $xeTable.scrollTo(scrollLeft, scrollTop);
  2689. }
  2690. return $xeTable.clearScroll();
  2691. }
  2692. function toTreePathSeq(path) {
  2693. return path.map((num, i) => i % 2 === 0 ? Number(num) + 1 : '.').join('');
  2694. }
  2695. /**
  2696. * 生成行的唯一主键
  2697. */
  2698. function getRowUniqueId() {
  2699. return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().uniqueId('row_');
  2700. }
  2701. function hasDeepKey(rowKey) {
  2702. return rowKey.indexOf('.') > -1;
  2703. }
  2704. // 行主键 key
  2705. function getRowkey($xeTable) {
  2706. const internalData = $xeTable;
  2707. const {
  2708. currKeyField
  2709. } = internalData;
  2710. return currKeyField;
  2711. }
  2712. // 行主键 value
  2713. function getRowid($xeTable, row) {
  2714. const internalData = $xeTable;
  2715. const {
  2716. isCurrDeepKey,
  2717. currKeyField
  2718. } = internalData;
  2719. return row ? encodeRowid((isCurrDeepKey ? getDeepRowIdByKey : getFastRowIdByKey)(row, currKeyField)) : '';
  2720. }
  2721. function createHandleUpdateRowId($xeTable) {
  2722. const internalData = $xeTable;
  2723. const {
  2724. isCurrDeepKey,
  2725. currKeyField
  2726. } = internalData;
  2727. const updateRId = isCurrDeepKey ? updateDeepRowKey : updateFastRowKey;
  2728. return {
  2729. rowKey: currKeyField,
  2730. handleUpdateRowId(row) {
  2731. return row ? updateRId(row, currKeyField) : '';
  2732. }
  2733. };
  2734. }
  2735. function createHandleGetRowId($xeTable) {
  2736. const internalData = $xeTable;
  2737. const {
  2738. isCurrDeepKey,
  2739. currKeyField
  2740. } = internalData;
  2741. const getRId = isCurrDeepKey ? getDeepRowIdByKey : getFastRowIdByKey;
  2742. return {
  2743. rowKey: currKeyField,
  2744. handleGetRowId(row) {
  2745. return row ? encodeRowid(getRId(row, currKeyField)) : '';
  2746. }
  2747. };
  2748. }
  2749. // 编码行主键
  2750. function encodeRowid(rowVal) {
  2751. return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(rowVal) ? '' : encodeURIComponent(rowVal);
  2752. }
  2753. function getDeepRowIdByKey(row, rowKey) {
  2754. return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, rowKey);
  2755. }
  2756. function updateDeepRowKey(row, rowKey) {
  2757. let rowid = encodeRowid(getDeepRowIdByKey(row, rowKey));
  2758. if (eqEmptyValue(rowid)) {
  2759. rowid = getRowUniqueId();
  2760. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(row, rowKey, rowid);
  2761. }
  2762. return rowid;
  2763. }
  2764. function getFastRowIdByKey(row, rowKey) {
  2765. return row[rowKey];
  2766. }
  2767. function updateFastRowKey(row, rowKey) {
  2768. let rowid = encodeRowid(getFastRowIdByKey(row, rowKey));
  2769. if (eqEmptyValue(rowid)) {
  2770. rowid = getRowUniqueId();
  2771. row[rowKey] = rowid;
  2772. }
  2773. return rowid;
  2774. }
  2775. function getPaddingLeftRightSize(elem) {
  2776. if (elem) {
  2777. const computedStyle = getComputedStyle(elem);
  2778. const paddingLeft = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(computedStyle.paddingLeft);
  2779. const paddingRight = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(computedStyle.paddingRight);
  2780. return paddingLeft + paddingRight;
  2781. }
  2782. return 0;
  2783. }
  2784. function getElementMarginAndWidth(elem) {
  2785. if (elem) {
  2786. const computedStyle = getComputedStyle(elem);
  2787. const marginLeft = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(computedStyle.marginLeft);
  2788. const marginRight = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(computedStyle.marginRight);
  2789. return elem.offsetWidth + marginLeft + marginRight;
  2790. }
  2791. return 0;
  2792. }
  2793. function getCalcHeight(height) {
  2794. if (height === 'unset') {
  2795. return 0;
  2796. }
  2797. return height || 0;
  2798. }
  2799. function handleFieldOrColumn($xeTable, fieldOrColumn) {
  2800. if (fieldOrColumn) {
  2801. return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(fieldOrColumn) || external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(fieldOrColumn) ? $xeTable.getColumnByField(`${fieldOrColumn}`) : fieldOrColumn;
  2802. }
  2803. return null;
  2804. }
  2805. function handleRowidOrRow($xeTable, rowidOrRow) {
  2806. if (rowidOrRow) {
  2807. const rowid = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(rowidOrRow) || external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(rowidOrRow) ? rowidOrRow : getRowid($xeTable, rowidOrRow);
  2808. return $xeTable.getRowById(rowid);
  2809. }
  2810. return null;
  2811. }
  2812. function getCellRestHeight(rowRest, cellOpts, rowOpts, defaultRowHeight) {
  2813. return rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight;
  2814. }
  2815. // 组装列配置
  2816. function assembleColumn(_vm) {
  2817. const $xeTable = _vm.$xeTable;
  2818. const reactData = $xeTable;
  2819. const {
  2820. staticColumns
  2821. } = reactData;
  2822. const {
  2823. $el,
  2824. $xeColumn,
  2825. columnConfig
  2826. } = _vm;
  2827. const groupConfig = $xeColumn ? $xeColumn.columnConfig : null;
  2828. if (groupConfig) {
  2829. if ($xeColumn.$options._componentTag === 'vxe-table-column') {
  2830. errLog('vxe.error.groupTag', [`<vxe-table-colgroup title=${$xeColumn.title} ...>`, `<vxe-table-column title=${$xeColumn.title} ...>`]);
  2831. } else if ($xeColumn.$options._componentTag === 'vxe-column') {
  2832. warnLog('vxe.error.groupTag', [`<vxe-colgroup title=${$xeColumn.title} ...>`, `<vxe-column title=${$xeColumn.title} ...>`]);
  2833. }
  2834. if (!groupConfig.children) {
  2835. groupConfig.children = [];
  2836. }
  2837. columnConfig.defaultParentId = groupConfig.id;
  2838. groupConfig.children.splice(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayIndexOf($xeColumn.$el.children, $el), 0, columnConfig);
  2839. } else {
  2840. staticColumns.splice(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayIndexOf($xeTable.$refs.hideColumn.children, $el), 0, columnConfig);
  2841. }
  2842. }
  2843. // 销毁列
  2844. function destroyColumn(_vm) {
  2845. const $xeTable = _vm.$xeTable;
  2846. const reactData = $xeTable;
  2847. const {
  2848. staticColumns
  2849. } = reactData;
  2850. const {
  2851. columnConfig
  2852. } = _vm;
  2853. const matchObj = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findTree(staticColumns, column => column === columnConfig);
  2854. if (matchObj) {
  2855. matchObj.items.splice(matchObj.index, 1);
  2856. }
  2857. }
  2858. function getRootColumn($xeTable, column) {
  2859. const internalData = $xeTable;
  2860. const {
  2861. fullColumnIdData
  2862. } = internalData;
  2863. if (!column) {
  2864. return null;
  2865. }
  2866. let parentColId = column.parentId;
  2867. while (fullColumnIdData[parentColId]) {
  2868. const column = fullColumnIdData[parentColId].column;
  2869. parentColId = column.parentId;
  2870. if (!parentColId) {
  2871. return column;
  2872. }
  2873. }
  2874. return column;
  2875. }
  2876. function toFilters(filters, colid) {
  2877. if (filters) {
  2878. if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(filters)) {
  2879. return filters.map(({
  2880. label,
  2881. value,
  2882. data,
  2883. resetValue,
  2884. checked
  2885. }) => {
  2886. return {
  2887. label,
  2888. value,
  2889. data,
  2890. resetValue,
  2891. checked: !!checked,
  2892. _checked: !!checked,
  2893. _colId: colid
  2894. };
  2895. });
  2896. }
  2897. return [];
  2898. }
  2899. return filters;
  2900. }
  2901. function getColReMinWidth(params) {
  2902. const {
  2903. $table,
  2904. column,
  2905. cell
  2906. } = params;
  2907. const internalData = $table;
  2908. const {
  2909. showHeaderOverflow: allColumnHeaderOverflow,
  2910. resizableOpts
  2911. } = $table;
  2912. const {
  2913. minWidth
  2914. } = resizableOpts;
  2915. // 如果自定义调整宽度逻辑
  2916. if (minWidth) {
  2917. const customMinWidth = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(minWidth) ? minWidth(params) : minWidth;
  2918. if (customMinWidth !== 'auto') {
  2919. return Math.max(1, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(customMinWidth));
  2920. }
  2921. }
  2922. const {
  2923. elemStore
  2924. } = internalData;
  2925. const {
  2926. showHeaderOverflow,
  2927. minWidth: colMinWidth
  2928. } = column;
  2929. const headOverflow = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isUndefined(showHeaderOverflow) || external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNull(showHeaderOverflow) ? allColumnHeaderOverflow : showHeaderOverflow;
  2930. const showEllipsis = headOverflow === 'ellipsis';
  2931. const showTitle = headOverflow === 'title';
  2932. const showTooltip = headOverflow === true || headOverflow === 'tooltip';
  2933. const hasEllipsis = showTitle || showTooltip || showEllipsis;
  2934. const minTitleWidth = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().floor((external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(getComputedStyle(cell).fontSize) || 14) * 1.8);
  2935. const paddingLeftRight = getPaddingLeftRightSize(cell) + getPaddingLeftRightSize(queryElement(cell, '.vxe-cell'));
  2936. let mWidth = minTitleWidth + paddingLeftRight;
  2937. // 默认最小宽处理
  2938. if (hasEllipsis) {
  2939. const dragIconWidth = getElementMarginAndWidth(queryElement(cell, '.vxe-cell--drag-handle'));
  2940. const checkboxIconWidth = getElementMarginAndWidth(queryElement(cell, '.vxe-cell--checkbox'));
  2941. const requiredIconWidth = getElementMarginAndWidth(queryElement(cell, '.vxe-cell--required-icon'));
  2942. const editIconWidth = getElementMarginAndWidth(queryElement(cell, '.vxe-cell--edit-icon'));
  2943. const prefixIconWidth = getElementMarginAndWidth(queryElement(cell, '.vxe-cell-title-prefix-icon'));
  2944. const suffixIconWidth = getElementMarginAndWidth(queryElement(cell, '.vxe-cell-title-suffix-icon'));
  2945. const sortIconWidth = getElementMarginAndWidth(queryElement(cell, '.vxe-cell--sort'));
  2946. const filterIconWidth = getElementMarginAndWidth(queryElement(cell, '.vxe-cell--filter'));
  2947. mWidth += dragIconWidth + checkboxIconWidth + requiredIconWidth + editIconWidth + prefixIconWidth + suffixIconWidth + filterIconWidth + sortIconWidth;
  2948. }
  2949. // 如果设置最小宽
  2950. if (colMinWidth) {
  2951. const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
  2952. if (bodyScrollElem) {
  2953. if (isScale(colMinWidth)) {
  2954. const bodyWidth = bodyScrollElem.clientWidth - 1;
  2955. const meanWidth = bodyWidth / 100;
  2956. return Math.max(mWidth, Math.floor(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(colMinWidth) * meanWidth));
  2957. } else if (isPx(colMinWidth)) {
  2958. return Math.max(mWidth, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(colMinWidth));
  2959. }
  2960. }
  2961. }
  2962. return mWidth;
  2963. }
  2964. function getFirstChildColumn(column) {
  2965. const {
  2966. children
  2967. } = column;
  2968. if (children && children.length) {
  2969. return getFirstChildColumn(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().first(children));
  2970. }
  2971. return column;
  2972. }
  2973. function getLastChildColumn(column) {
  2974. const {
  2975. children
  2976. } = column;
  2977. if (children && children.length) {
  2978. return getFirstChildColumn(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().last(children));
  2979. }
  2980. return column;
  2981. }
  2982. const lineOffsetSizes = {
  2983. mini: 3,
  2984. small: 2,
  2985. medium: 1,
  2986. large: 0
  2987. };
  2988. function countTreeExpandSize(prevRow, params) {
  2989. let count = 1;
  2990. if (!prevRow) {
  2991. return count;
  2992. }
  2993. const {
  2994. $table
  2995. } = params;
  2996. const reactData = $table;
  2997. const {
  2998. treeExpandedFlag
  2999. } = reactData;
  3000. const internalData = $table;
  3001. const {
  3002. treeExpandedMaps
  3003. } = internalData;
  3004. const treeOpts = $table.computeTreeOpts;
  3005. const {
  3006. transform,
  3007. mapChildrenField
  3008. } = treeOpts;
  3009. const childrenField = treeOpts.children || treeOpts.childrenField;
  3010. const rowChildren = prevRow[transform ? mapChildrenField : childrenField];
  3011. if (rowChildren && treeExpandedFlag && treeExpandedMaps[getRowid($table, prevRow)]) {
  3012. for (let index = 0; index < rowChildren.length; index++) {
  3013. count += countTreeExpandSize(rowChildren[index], params);
  3014. }
  3015. }
  3016. return count;
  3017. }
  3018. function getOffsetSize($xeTable) {
  3019. const vSize = $xeTable.computeSize;
  3020. if (vSize) {
  3021. return lineOffsetSizes[vSize] || 0;
  3022. }
  3023. return 0;
  3024. }
  3025. function calcTreeLine(params, prevRow) {
  3026. const {
  3027. $table,
  3028. row
  3029. } = params;
  3030. const tableProps = $table;
  3031. const tableReactData = $table;
  3032. const tableInternalData = $table;
  3033. const {
  3034. showOverflow
  3035. } = tableProps;
  3036. const {
  3037. scrollYLoad
  3038. } = tableReactData;
  3039. const {
  3040. fullAllDataRowIdData
  3041. } = tableInternalData;
  3042. const rowOpts = $table.computeRowOpts;
  3043. const cellOpts = $table.computeCellOpts;
  3044. const defaultRowHeight = $table.computeDefaultRowHeight;
  3045. const rowid = getRowid($table, row);
  3046. const rowRest = fullAllDataRowIdData[rowid];
  3047. const currCellHeight = rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight;
  3048. let expandSize = 1;
  3049. if (prevRow) {
  3050. expandSize = countTreeExpandSize(prevRow, params);
  3051. }
  3052. let cellHeight = currCellHeight;
  3053. const vnHeight = rowRest.height;
  3054. if (scrollYLoad) {
  3055. if (!showOverflow) {
  3056. cellHeight = vnHeight || currCellHeight;
  3057. }
  3058. }
  3059. return cellHeight * expandSize - (prevRow ? 1 : 12 - getOffsetSize($table));
  3060. }
  3061. function getCellValue(row, column) {
  3062. return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, column.field);
  3063. }
  3064. function setCellValue(row, column, value) {
  3065. return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(row, column.field, value);
  3066. }
  3067. function getRefElem(refEl) {
  3068. if (refEl) {
  3069. return refEl.$el || refEl;
  3070. }
  3071. return null;
  3072. }
  3073. function clearTableDefaultStatus($xeTable) {
  3074. const props = $xeTable;
  3075. const internalData = $xeTable;
  3076. internalData.initStatus = false;
  3077. const actionList = [$xeTable.clearSort(), $xeTable.clearCurrentRow(), $xeTable.clearCurrentColumn(), $xeTable.clearRadioRow(), $xeTable.clearRadioReserve(), $xeTable.clearCheckboxRow(), $xeTable.clearCheckboxReserve(), $xeTable.clearRowExpand(), $xeTable.clearTreeExpand(), $xeTable.clearTreeExpandReserve(), $xeTable.clearPendingRow()];
  3078. if ($xeTable.clearFilter) {
  3079. actionList.push($xeTable.clearFilter());
  3080. }
  3081. if ($xeTable.clearSelected && (props.keyboardConfig || props.mouseConfig)) {
  3082. actionList.push($xeTable.clearSelected());
  3083. }
  3084. if ($xeTable.clearCellAreas && props.mouseConfig) {
  3085. actionList.push($xeTable.clearCellAreas(), $xeTable.clearCopyCellArea());
  3086. }
  3087. return Promise.all(actionList).then(() => {
  3088. return $xeTable.clearScroll();
  3089. });
  3090. }
  3091. function clearTableAllStatus(_vm) {
  3092. if (_vm.clearFilter) {
  3093. _vm.clearFilter();
  3094. }
  3095. return clearTableDefaultStatus(_vm);
  3096. }
  3097. function isColumnInfo(column) {
  3098. return column instanceof ColumnInfo;
  3099. }
  3100. // 获取所有的列,排除分组
  3101. function getColumnList(columns) {
  3102. const result = [];
  3103. columns.forEach(column => {
  3104. result.push(...(column.children && column.children.length ? getColumnList(column.children) : [column]));
  3105. });
  3106. return result;
  3107. }
  3108. function createColumn($xeTable, options, renderOptions) {
  3109. return isColumnInfo(options) ? options : new ColumnInfo($xeTable, options, renderOptions);
  3110. }
  3111. function rowToVisible($xeTable, row) {
  3112. const tableProps = $xeTable;
  3113. const reactData = $xeTable;
  3114. const internalData = $xeTable;
  3115. const {
  3116. showOverflow
  3117. } = tableProps;
  3118. const {
  3119. scrollYLoad,
  3120. scrollYTop
  3121. } = reactData;
  3122. const {
  3123. elemStore,
  3124. afterFullData,
  3125. fullAllDataRowIdData,
  3126. isResizeCellHeight
  3127. } = internalData;
  3128. const rowOpts = $xeTable.computeRowOpts;
  3129. const cellOpts = $xeTable.computeCellOpts;
  3130. const defaultRowHeight = $xeTable.computeDefaultRowHeight;
  3131. const leftFixedWidth = $xeTable.computeLeftFixedWidth;
  3132. const rightFixedWidth = $xeTable.computeRightFixedWidth;
  3133. const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
  3134. const rowid = getRowid($xeTable, row);
  3135. if (bodyScrollElem) {
  3136. const bodyHeight = bodyScrollElem.clientHeight;
  3137. const bodyScrollTop = bodyScrollElem.scrollTop;
  3138. const trElem = bodyScrollElem.querySelector(`[rowid="${rowid}"]`);
  3139. if (trElem) {
  3140. const trOffsetTop = trElem.offsetTop + (scrollYLoad ? scrollYTop : 0);
  3141. const trHeight = trElem.clientHeight;
  3142. // 检测行是否在可视区中
  3143. if (trOffsetTop < bodyScrollTop || trOffsetTop > bodyScrollTop + bodyHeight) {
  3144. return $xeTable.scrollTo(null, trOffsetTop);
  3145. } else if (trOffsetTop + trHeight >= bodyHeight + bodyScrollTop) {
  3146. return $xeTable.scrollTo(null, bodyScrollTop + trHeight);
  3147. }
  3148. } else {
  3149. // 如果是虚拟渲染滚动
  3150. if (scrollYLoad) {
  3151. const isCustomCellHeight = isResizeCellHeight || cellOpts.height || rowOpts.height;
  3152. if (!isCustomCellHeight && showOverflow) {
  3153. return $xeTable.scrollTo(null, ($xeTable.findRowIndexOf(afterFullData, row) - 1) * defaultRowHeight);
  3154. }
  3155. let scrollTop = 0;
  3156. const rowRest = fullAllDataRowIdData[rowid];
  3157. const rHeight = rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight;
  3158. for (let i = 0; i < afterFullData.length; i++) {
  3159. const currRow = afterFullData[i];
  3160. const currRowid = getRowid($xeTable, currRow);
  3161. if (currRow === row || currRowid === rowid) {
  3162. break;
  3163. }
  3164. const currRowRest = fullAllDataRowIdData[currRowid];
  3165. scrollTop += currRowRest.resizeHeight || cellOpts.height || rowOpts.height || currRowRest.height || defaultRowHeight;
  3166. }
  3167. if (scrollTop < bodyScrollTop) {
  3168. return $xeTable.scrollTo(null, scrollTop - leftFixedWidth - 1);
  3169. }
  3170. return $xeTable.scrollTo(null, scrollTop + rHeight - (bodyHeight - rightFixedWidth - 1));
  3171. }
  3172. }
  3173. }
  3174. return Promise.resolve();
  3175. }
  3176. function colToVisible($xeTable, column, row) {
  3177. const reactData = $xeTable;
  3178. const internalData = $xeTable;
  3179. const {
  3180. scrollXLoad,
  3181. scrollXLeft
  3182. } = reactData;
  3183. const {
  3184. elemStore,
  3185. visibleColumn
  3186. } = internalData;
  3187. const leftFixedWidth = $xeTable.computeLeftFixedWidth;
  3188. const rightFixedWidth = $xeTable.computeRightFixedWidth;
  3189. const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
  3190. if (column.fixed) {
  3191. return Promise.resolve();
  3192. }
  3193. if (bodyScrollElem) {
  3194. const bodyWidth = bodyScrollElem.clientWidth;
  3195. const bodyScrollLeft = bodyScrollElem.scrollLeft;
  3196. let tdElem = null;
  3197. if (row) {
  3198. const rowid = getRowid($xeTable, row);
  3199. tdElem = bodyScrollElem.querySelector(`[rowid="${rowid}"] .${column.id}`);
  3200. }
  3201. if (!tdElem) {
  3202. tdElem = bodyScrollElem.querySelector(`.${column.id}`);
  3203. }
  3204. if (tdElem) {
  3205. const tdOffsetLeft = tdElem.offsetLeft + (scrollXLoad ? scrollXLeft : 0);
  3206. const cellWidth = tdElem.clientWidth;
  3207. // 检测是否在可视区中
  3208. if (tdOffsetLeft < bodyScrollLeft + leftFixedWidth) {
  3209. return $xeTable.scrollTo(tdOffsetLeft - leftFixedWidth - 1);
  3210. } else if (tdOffsetLeft + cellWidth - bodyScrollLeft > bodyWidth - rightFixedWidth) {
  3211. return $xeTable.scrollTo(tdOffsetLeft + cellWidth - (bodyWidth - rightFixedWidth - 1));
  3212. }
  3213. } else {
  3214. // 检测是否在虚拟渲染可视区中
  3215. if (scrollXLoad) {
  3216. let scrollLeft = 0;
  3217. const cellWidth = column.renderWidth;
  3218. for (let i = 0; i < visibleColumn.length; i++) {
  3219. const currCol = visibleColumn[i];
  3220. if (currCol === column || currCol.id === column.id) {
  3221. break;
  3222. }
  3223. scrollLeft += currCol.renderWidth;
  3224. }
  3225. if (scrollLeft < bodyScrollLeft) {
  3226. return $xeTable.scrollTo(scrollLeft - leftFixedWidth - 1);
  3227. }
  3228. return $xeTable.scrollTo(scrollLeft + cellWidth - (bodyWidth - rightFixedWidth - 1));
  3229. }
  3230. }
  3231. }
  3232. return Promise.resolve();
  3233. }
  3234. ;// CONCATENATED MODULE: ./packages/ui/src/vn.ts
  3235. function getOnName(type) {
  3236. return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().kebabCase(type);
  3237. }
  3238. function getModelEvent(renderOpts) {
  3239. switch (renderOpts.name) {
  3240. case 'VxeInput':
  3241. case 'VxeTextarea':
  3242. case 'VxeNumberInput':
  3243. case 'VxePasswordInput':
  3244. case 'VxeSelect':
  3245. case 'VxeTreeSelect':
  3246. case 'VxeTableSelect':
  3247. case 'VxeDatePicker':
  3248. case 'VxeDateRangePicker':
  3249. case 'VxeIconPicker':
  3250. case 'VxeColorPicker':
  3251. case 'VxeSlider':
  3252. case 'VxeUpload':
  3253. return 'modelValue';
  3254. case 'select':
  3255. return 'change';
  3256. }
  3257. return 'input';
  3258. }
  3259. function getChangeEvent(renderOpts) {
  3260. switch (renderOpts.name) {
  3261. case 'input':
  3262. case 'textarea':
  3263. case 'VxeInput':
  3264. case 'VxeTextarea':
  3265. case '$input': // 已废弃
  3266. case '$textarea':
  3267. // 已废弃
  3268. return 'input';
  3269. }
  3270. return 'change';
  3271. }
  3272. function hasInputType(renderOpts) {
  3273. switch (renderOpts.name) {
  3274. case 'VxeInput':
  3275. case 'VxeNumberInput':
  3276. case 'VxeTextarea':
  3277. case '$input':
  3278. case '$textarea':
  3279. return true;
  3280. }
  3281. return false;
  3282. }
  3283. function getSlotVNs(vns) {
  3284. if (vns === null || vns === undefined) {
  3285. return [];
  3286. }
  3287. if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(vns)) {
  3288. return vns;
  3289. }
  3290. return [vns];
  3291. }
  3292. ;// CONCATENATED MODULE: ./packages/table/src/cell.ts
  3293. const {
  3294. getI18n: cell_getI18n,
  3295. getIcon: cell_getIcon,
  3296. renderer: cell_renderer,
  3297. formats: cell_formats,
  3298. renderEmptyElement
  3299. } = core_.VxeUI;
  3300. function renderTitlePrefixIcon(h, params) {
  3301. const {
  3302. $table,
  3303. column
  3304. } = params;
  3305. const titlePrefix = column.titlePrefix || column.titleHelp;
  3306. if (titlePrefix) {
  3307. return h('i', {
  3308. class: ['vxe-cell-title-prefix-icon', titlePrefix.iconStatus ? `theme--${titlePrefix.iconStatus}` : ''],
  3309. on: {
  3310. mouseenter(evnt) {
  3311. $table.triggerHeaderTitleEvent(evnt, titlePrefix, params);
  3312. },
  3313. mouseleave(evnt) {
  3314. $table.handleTargetLeaveEvent(evnt);
  3315. }
  3316. }
  3317. }, [h('i', {
  3318. class: titlePrefix.icon || cell_getIcon().TABLE_TITLE_PREFIX
  3319. })]);
  3320. }
  3321. return renderEmptyElement($table);
  3322. }
  3323. function renderTitleSuffixIcon(h, params) {
  3324. const {
  3325. $table,
  3326. column
  3327. } = params;
  3328. const titleSuffix = column.titleSuffix;
  3329. if (titleSuffix) {
  3330. return h('i', {
  3331. class: ['vxe-cell-title-suffix-icon', titleSuffix.iconStatus ? `theme--${titleSuffix.iconStatus}` : ''],
  3332. on: {
  3333. mouseenter(evnt) {
  3334. $table.triggerHeaderTitleEvent(evnt, titleSuffix, params);
  3335. },
  3336. mouseleave(evnt) {
  3337. $table.handleTargetLeaveEvent(evnt);
  3338. }
  3339. }
  3340. }, [h('i', {
  3341. class: titleSuffix.icon || cell_getIcon().TABLE_TITLE_SUFFIX
  3342. })]);
  3343. }
  3344. return renderEmptyElement($table);
  3345. }
  3346. function renderCellDragIcon(h, params) {
  3347. const {
  3348. $table
  3349. } = params;
  3350. const tableSlots = $table.$scopedSlots;
  3351. const tableProps = $table;
  3352. const {
  3353. dragConfig
  3354. } = tableProps;
  3355. const rowDragOpts = $table.computeRowDragOpts;
  3356. const {
  3357. icon,
  3358. trigger,
  3359. disabledMethod
  3360. } = rowDragOpts;
  3361. const rDisabledMethod = disabledMethod || (dragConfig ? dragConfig.rowDisabledMethod : null);
  3362. const isDisabled = rDisabledMethod && rDisabledMethod(params);
  3363. const rowDragIconSlot = tableSlots.rowDragIcon || tableSlots['row-drag-icon'];
  3364. const ons = {};
  3365. if (trigger !== 'cell') {
  3366. ons.mousedown = evnt => {
  3367. if (!isDisabled) {
  3368. $table.handleCellDragMousedownEvent(evnt, params);
  3369. }
  3370. };
  3371. ons.mouseup = $table.handleCellDragMouseupEvent;
  3372. }
  3373. return h('span', {
  3374. key: 'dg',
  3375. class: ['vxe-cell--drag-handle', {
  3376. 'is--disabled': isDisabled
  3377. }],
  3378. on: ons
  3379. }, rowDragIconSlot ? $table.callSlot(rowDragIconSlot, params, h) : [h('i', {
  3380. class: icon || (dragConfig ? dragConfig.rowIcon : '') || cell_getIcon().TABLE_DRAG_ROW
  3381. })]);
  3382. }
  3383. function renderCellBaseVNs(h, params, content) {
  3384. const {
  3385. $table,
  3386. column,
  3387. level
  3388. } = params;
  3389. const {
  3390. dragSort
  3391. } = column;
  3392. const tableProps = $table;
  3393. const {
  3394. treeConfig,
  3395. dragConfig
  3396. } = tableProps;
  3397. const rowOpts = $table.computeRowOpts;
  3398. const rowDragOpts = $table.computeRowDragOpts;
  3399. const treeOpts = $table.computeTreeOpts;
  3400. const {
  3401. showIcon,
  3402. isPeerDrag,
  3403. isCrossDrag,
  3404. visibleMethod
  3405. } = rowDragOpts;
  3406. const rVisibleMethod = visibleMethod || (dragConfig ? dragConfig.rowVisibleMethod : null);
  3407. const vns = [];
  3408. if (dragSort && rowOpts.drag && (showIcon || (dragConfig ? dragConfig.showRowIcon : false)) && (!rVisibleMethod || rVisibleMethod(params))) {
  3409. if (treeConfig) {
  3410. if (treeOpts.transform && (isPeerDrag || isCrossDrag || !level)) {
  3411. vns.unshift(renderCellDragIcon(h, params));
  3412. }
  3413. } else {
  3414. vns.unshift(renderCellDragIcon(h, params));
  3415. }
  3416. }
  3417. return vns.concat(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(content) ? content : [content]);
  3418. }
  3419. function renderHeaderCellDragIcon(h, params) {
  3420. const {
  3421. $table,
  3422. column
  3423. } = params;
  3424. const tableSlots = $table.$scopedSlots;
  3425. const {
  3426. slots
  3427. } = column;
  3428. const columnOpts = $table.computeColumnOpts;
  3429. const columnDragOpts = $table.computeColumnDragOpts;
  3430. const {
  3431. showIcon,
  3432. icon,
  3433. trigger,
  3434. isPeerDrag,
  3435. isCrossDrag,
  3436. visibleMethod,
  3437. disabledMethod
  3438. } = columnDragOpts;
  3439. if (columnOpts.drag && showIcon && (!visibleMethod || visibleMethod(params))) {
  3440. if (!column.fixed && (isPeerDrag || isCrossDrag || !column.parentId)) {
  3441. const isDisabled = disabledMethod && disabledMethod(params);
  3442. const columnDragIconSlot = (slots ? slots.columnDragIcon || slots['column-drag-icon'] : null) || tableSlots.columnDragIcon || tableSlots['column-drag-icon'];
  3443. const ons = {};
  3444. if (trigger !== 'cell') {
  3445. ons.mousedown = evnt => {
  3446. if (!isDisabled) {
  3447. $table.handleHeaderCellDragMousedownEvent(evnt, params);
  3448. }
  3449. };
  3450. ons.mouseup = $table.handleHeaderCellDragMouseupEvent;
  3451. }
  3452. return h('span', {
  3453. key: 'dg',
  3454. class: ['vxe-cell--drag-handle', {
  3455. 'is--disabled': isDisabled
  3456. }],
  3457. on: ons
  3458. }, columnDragIconSlot ? $table.callSlot(columnDragIconSlot, params, h) : [h('i', {
  3459. class: icon || cell_getIcon().TABLE_DRAG_COLUMN
  3460. })]);
  3461. }
  3462. }
  3463. return renderEmptyElement($table);
  3464. }
  3465. function renderHeaderCellBaseVNs(h, params, content) {
  3466. const vns = [renderTitlePrefixIcon(h, params), renderHeaderCellDragIcon(h, params), ...(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(content) ? content : [content]), renderTitleSuffixIcon(h, params)];
  3467. return vns;
  3468. }
  3469. function getRenderDefaultColumnTitle(h, column, content) {
  3470. if (column.type === 'html' && external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(content)) {
  3471. return h('span', {
  3472. key: 'ch',
  3473. domProps: {
  3474. innerHTML: content
  3475. }
  3476. });
  3477. }
  3478. return h('span', {
  3479. key: 'ct'
  3480. }, getSlotVNs(content));
  3481. }
  3482. function renderTitleContent(h, params, content) {
  3483. const {
  3484. $table,
  3485. column
  3486. } = params;
  3487. const tableProps = $table;
  3488. const tableReactData = $table;
  3489. const {
  3490. showHeaderOverflow: allColumnHeaderOverflow
  3491. } = tableProps;
  3492. const {
  3493. isRowGroupStatus
  3494. } = tableReactData;
  3495. const {
  3496. showHeaderOverflow
  3497. } = column;
  3498. const headerTooltipOpts = $table.computeHeaderTooltipOpts;
  3499. const showAllTip = headerTooltipOpts.showAll;
  3500. const headOverflow = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(showHeaderOverflow) ? allColumnHeaderOverflow : showHeaderOverflow;
  3501. const showTitle = headOverflow === 'title';
  3502. const showTooltip = headOverflow === true || headOverflow === 'tooltip';
  3503. const ons = {};
  3504. if (showTitle || showTooltip || showAllTip) {
  3505. ons.mouseenter = evnt => {
  3506. if (tableReactData.isDragResize) {
  3507. return;
  3508. }
  3509. if (showTitle) {
  3510. updateCellTitle(evnt.currentTarget, column);
  3511. } else if (showTooltip || showAllTip) {
  3512. $table.triggerHeaderTooltipEvent(evnt, params);
  3513. }
  3514. };
  3515. }
  3516. if (showTooltip || showAllTip) {
  3517. ons.mouseleave = evnt => {
  3518. if (tableReactData.isDragResize) {
  3519. return;
  3520. }
  3521. if (showTooltip || showAllTip) {
  3522. $table.handleTargetLeaveEvent(evnt);
  3523. }
  3524. };
  3525. }
  3526. const titleVN = getRenderDefaultColumnTitle(h, column, content);
  3527. return [h('span', {
  3528. class: 'vxe-cell--title',
  3529. on: ons
  3530. }, isRowGroupStatus && column.aggFunc && $table.getPivotTableAggregateRenderColTitles ? $table.getPivotTableAggregateRenderColTitles(h, column, titleVN) : [titleVN])];
  3531. }
  3532. function getFooterContent(h, params) {
  3533. const {
  3534. $table,
  3535. column,
  3536. _columnIndex,
  3537. row,
  3538. items
  3539. } = params;
  3540. const {
  3541. slots,
  3542. editRender,
  3543. cellRender,
  3544. footerFormatter
  3545. } = column;
  3546. const renderOpts = editRender || cellRender;
  3547. if (slots && slots.footer) {
  3548. return $table.callSlot(slots.footer, params, h);
  3549. }
  3550. let itemValue = '';
  3551. // 兼容老模式
  3552. if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(items)) {
  3553. itemValue = items[_columnIndex];
  3554. } else {
  3555. itemValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, column.field);
  3556. }
  3557. const footParams = Object.assign(params, {
  3558. itemValue
  3559. });
  3560. if (footerFormatter) {
  3561. if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(footerFormatter)) {
  3562. return `${footerFormatter(footParams)}`;
  3563. }
  3564. const isArr = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(footerFormatter);
  3565. const gFormatOpts = isArr ? cell_formats.get(footerFormatter[0]) : cell_formats.get(footerFormatter);
  3566. const footerFormatMethod = gFormatOpts ? gFormatOpts.tableFooterCellFormatMethod : null;
  3567. if (footerFormatMethod) {
  3568. return `${isArr ? footerFormatMethod(footParams, ...footerFormatter.slice(1)) : footerFormatMethod(footParams)}`;
  3569. }
  3570. return '';
  3571. }
  3572. if (renderOpts) {
  3573. const compConf = cell_renderer.get(renderOpts.name);
  3574. const rtFooter = compConf ? compConf.renderTableFooter || compConf.renderFooter : null;
  3575. if (rtFooter) {
  3576. return getSlotVNs(rtFooter.call($table, h, renderOpts, footParams));
  3577. }
  3578. }
  3579. return [formatText(itemValue, 1)];
  3580. }
  3581. function getDefaultCellLabel(params) {
  3582. const {
  3583. $table,
  3584. row,
  3585. column
  3586. } = params;
  3587. return formatText($table.getCellLabel(row, column), 1);
  3588. }
  3589. function renderCellHandle(h, params) {
  3590. const {
  3591. column,
  3592. row,
  3593. $table
  3594. } = params;
  3595. const tableProps = $table;
  3596. const tableReactData = $table;
  3597. const {
  3598. editConfig
  3599. } = tableProps;
  3600. const {
  3601. isRowGroupStatus
  3602. } = tableReactData;
  3603. const {
  3604. type,
  3605. treeNode,
  3606. rowGroupNode,
  3607. editRender
  3608. } = column;
  3609. const aggregateOpts = $table.computeAggregateOpts;
  3610. const {
  3611. mode
  3612. } = aggregateOpts;
  3613. const checkboxOpts = $table.computeCheckboxOpts;
  3614. const editOpts = $table.computeEditOpts;
  3615. const isDeepCell = treeNode || isRowGroupStatus && (mode === 'column' ? column.field === row.groupField : rowGroupNode);
  3616. switch (type) {
  3617. case 'seq':
  3618. return isDeepCell ? Cell.renderDeepIndexCell(h, params) : Cell.renderSeqCell(h, params);
  3619. case 'radio':
  3620. return isDeepCell ? Cell.renderDeepRadioCell(h, params) : Cell.renderRadioCell(h, params);
  3621. case 'checkbox':
  3622. return checkboxOpts.checkField ? isDeepCell ? Cell.renderDeepSelectionCellByProp(h, params) : Cell.renderCheckboxCellByProp(h, params) : isDeepCell ? Cell.renderDeepSelectionCell(h, params) : Cell.renderCheckboxCell(h, params);
  3623. case 'expand':
  3624. return Cell.renderExpandCell(h, params);
  3625. case 'html':
  3626. return isDeepCell ? Cell.renderDeepHTMLCell(h, params) : Cell.renderHTMLCell(h, params);
  3627. }
  3628. if (editConfig && isEnableConf(editOpts) && editRender) {
  3629. return editOpts.mode === 'cell' ? isDeepCell ? Cell.renderDeepCellEdit(h, params) : Cell.renderCellEdit(h, params) : isDeepCell ? Cell.renderDeepRowEdit(h, params) : Cell.renderRowEdit(h, params);
  3630. }
  3631. return isDeepCell ? Cell.renderDeepCell(h, params) : Cell.renderDefaultCell(h, params);
  3632. }
  3633. function renderHeaderHandle(h, params) {
  3634. const {
  3635. column,
  3636. $table
  3637. } = params;
  3638. const tableProps = $table;
  3639. const {
  3640. editConfig
  3641. } = tableProps;
  3642. const editOpts = $table.computeEditOpts;
  3643. const {
  3644. type,
  3645. filters,
  3646. sortable,
  3647. editRender
  3648. } = column;
  3649. switch (type) {
  3650. case 'seq':
  3651. return Cell.renderSeqHeader(h, params);
  3652. case 'radio':
  3653. return Cell.renderRadioHeader(h, params);
  3654. case 'checkbox':
  3655. return Cell.renderCheckboxHeader(h, params);
  3656. case 'html':
  3657. if (filters && sortable) {
  3658. return Cell.renderSortAndFilterHeader(h, params);
  3659. } else if (sortable) {
  3660. return Cell.renderSortHeader(h, params);
  3661. } else if (filters) {
  3662. return Cell.renderFilterHeader(h, params);
  3663. }
  3664. break;
  3665. }
  3666. if (editConfig && isEnableConf(editOpts) && editRender) {
  3667. return Cell.renderEditHeader(h, params);
  3668. } else if (filters && sortable) {
  3669. return Cell.renderSortAndFilterHeader(h, params);
  3670. } else if (sortable) {
  3671. return Cell.renderSortHeader(h, params);
  3672. } else if (filters) {
  3673. return Cell.renderFilterHeader(h, params);
  3674. }
  3675. return Cell.renderDefaultHeader(h, params);
  3676. }
  3677. function renderFooterHandle(h, params) {
  3678. return Cell.renderDefaultFooter(h, params);
  3679. }
  3680. const Cell = {
  3681. createColumn($xeTable, _vm) {
  3682. const {
  3683. type
  3684. } = _vm;
  3685. const renConfs = {
  3686. renderHeader: renderHeaderHandle,
  3687. renderCell: renderCellHandle,
  3688. renderFooter: renderFooterHandle
  3689. };
  3690. if (type === 'expand') {
  3691. renConfs.renderData = Cell.renderExpandData;
  3692. }
  3693. return createColumn($xeTable, _vm, renConfs);
  3694. },
  3695. /**
  3696. * 列头标题
  3697. */
  3698. renderHeaderTitle(h, params) {
  3699. const {
  3700. $table,
  3701. column
  3702. } = params;
  3703. const {
  3704. slots,
  3705. editRender,
  3706. cellRender
  3707. } = column;
  3708. const renderOpts = editRender || cellRender;
  3709. if (slots && slots.header) {
  3710. return renderTitleContent(h, params, $table.callSlot(slots.header, params, h));
  3711. }
  3712. if (renderOpts) {
  3713. const compConf = cell_renderer.get(renderOpts.name);
  3714. const rtHeader = compConf ? compConf.renderTableHeader || compConf.renderHeader : null;
  3715. if (rtHeader) {
  3716. return getSlotVNs(renderTitleContent(h, params, rtHeader.call($table, h, renderOpts, params)));
  3717. }
  3718. }
  3719. return renderTitleContent(h, params, formatText(column.getTitle(), 1));
  3720. },
  3721. renderDefaultHeader(h, params) {
  3722. return renderHeaderCellBaseVNs(h, params, Cell.renderHeaderTitle(h, params));
  3723. },
  3724. renderDefaultCell(h, params) {
  3725. const {
  3726. $table,
  3727. row,
  3728. column
  3729. } = params;
  3730. const tableProps = $table;
  3731. const tableReactData = $table;
  3732. const tableInternalData = $table;
  3733. const {
  3734. isRowGroupStatus
  3735. } = tableReactData;
  3736. const {
  3737. editConfig
  3738. } = tableProps;
  3739. const editOpts = $table.computeEditOpts;
  3740. const {
  3741. field,
  3742. slots,
  3743. editRender,
  3744. cellRender,
  3745. rowGroupNode,
  3746. aggFunc
  3747. } = column;
  3748. const renderOpts = editConfig && isEnableConf(editOpts) && editRender ? editRender : cellRender;
  3749. const defaultSlot = slots ? slots.default : null;
  3750. const gcSlot = slots ? slots.groupContent || slots['group-content'] : null;
  3751. let cellValue = '';
  3752. if (isRowGroupStatus && field && row.isAggregate) {
  3753. const aggRow = row;
  3754. const {
  3755. fullColumnFieldData
  3756. } = tableInternalData;
  3757. const aggregateOpts = $table.computeAggregateOpts;
  3758. const {
  3759. mode,
  3760. showTotal,
  3761. totalMethod,
  3762. countFields,
  3763. contentMethod,
  3764. mapChildrenField
  3765. } = aggregateOpts;
  3766. const aggCalcMethod = aggregateOpts.calcValuesMethod || aggregateOpts.countMethod || aggregateOpts.aggregateMethod;
  3767. const groupField = aggRow.groupField;
  3768. const groupContent = aggRow.groupContent;
  3769. const childList = mapChildrenField ? aggRow[mapChildrenField] || [] : [];
  3770. const childCount = aggRow.childCount;
  3771. const colRest = fullColumnFieldData[groupField] || {};
  3772. const ctParams = {
  3773. $table,
  3774. groupField,
  3775. groupColumn: colRest ? colRest.column : null,
  3776. column,
  3777. groupValue: groupContent,
  3778. childList,
  3779. childCount,
  3780. aggValue: null,
  3781. /**
  3782. * 已废弃
  3783. * @deprecated
  3784. */
  3785. children: childList,
  3786. /**
  3787. * 已废弃
  3788. * @deprecated
  3789. */
  3790. totalValue: childCount
  3791. };
  3792. if (gcSlot) {
  3793. return renderCellBaseVNs(h, params, $table.callSlot(gcSlot, Object.assign({
  3794. groupField,
  3795. groupContent,
  3796. childList,
  3797. childCount
  3798. }, params), h));
  3799. }
  3800. if (mode === 'column' ? field === aggRow.groupField : rowGroupNode) {
  3801. cellValue = groupContent;
  3802. if (contentMethod) {
  3803. cellValue = `${contentMethod(ctParams)}`;
  3804. }
  3805. if (showTotal) {
  3806. cellValue = cell_getI18n('vxe.table.rowGroupContentTotal', [cellValue, totalMethod ? totalMethod(ctParams) : childCount, childCount]);
  3807. }
  3808. } else if ($table.getPivotTableAggregateCellAggValue) {
  3809. cellValue = $table.getPivotTableAggregateCellAggValue(params);
  3810. } else if (aggFunc === true || countFields && countFields.includes(field)) {
  3811. if (aggCalcMethod) {
  3812. ctParams.aggValue = childCount;
  3813. cellValue = `${aggCalcMethod(ctParams)}`;
  3814. }
  3815. }
  3816. } else {
  3817. if (defaultSlot) {
  3818. return renderCellBaseVNs(h, params, $table.callSlot(defaultSlot, params, h));
  3819. }
  3820. if (renderOpts) {
  3821. const compConf = cell_renderer.get(renderOpts.name);
  3822. const rtDefault = compConf ? compConf.renderTableDefault || compConf.renderDefault : null;
  3823. const rtCell = compConf ? compConf.renderTableCell || compConf.renderCell : null;
  3824. const renderFn = editRender ? rtCell : rtDefault;
  3825. if (renderFn) {
  3826. return renderCellBaseVNs(h, params, getSlotVNs(renderFn.call($table, h, renderOpts, Object.assign({
  3827. $type: editRender ? 'edit' : 'cell'
  3828. }, params))));
  3829. }
  3830. }
  3831. cellValue = $table.getCellLabel(row, column);
  3832. }
  3833. const cellPlaceholder = editRender ? editRender.placeholder : '';
  3834. return renderCellBaseVNs(h, params, [h('span', {
  3835. class: 'vxe-cell--label'
  3836. }, [
  3837. // 如果设置占位符
  3838. editRender && eqEmptyValue(cellValue) ? h('span', {
  3839. class: 'vxe-cell--placeholder'
  3840. }, formatText(getFuncText(cellPlaceholder), 1)) : h('span', formatText(cellValue, 1))])]);
  3841. },
  3842. renderDeepCell(h, params) {
  3843. return Cell.renderDeepNodeBtn(h, params, Cell.renderDefaultCell.call(this, h, params));
  3844. },
  3845. renderDefaultFooter(h, params) {
  3846. return getFooterContent(h, params);
  3847. },
  3848. /**
  3849. * 行分组
  3850. */
  3851. renderRowGroupBtn(h, params, cellVNodes) {
  3852. const {
  3853. $table
  3854. } = params;
  3855. const tableReactData = $table;
  3856. const tableInternalData = $table;
  3857. const {
  3858. row,
  3859. level
  3860. } = params;
  3861. const {
  3862. rowGroupExpandedFlag
  3863. } = tableReactData;
  3864. const {
  3865. rowGroupExpandedMaps
  3866. } = tableInternalData;
  3867. const aggregateOpts = $table.computeAggregateOpts;
  3868. const {
  3869. mode,
  3870. padding,
  3871. indent
  3872. } = aggregateOpts;
  3873. const rowid = getRowid($table, row);
  3874. const isExpand = !!rowGroupExpandedFlag && !!rowGroupExpandedMaps[rowid];
  3875. return h('div', {
  3876. class: ['vxe-row-group--tree-node', {
  3877. 'is--expanded': isExpand
  3878. }],
  3879. style: mode !== 'column' && padding && indent ? {
  3880. paddingLeft: `${level * indent}px`
  3881. } : undefined
  3882. }, [row.isAggregate ? h('span', {
  3883. class: 'vxe-row-group--node-btn',
  3884. on: {
  3885. click(evnt) {
  3886. $table.triggerRowGroupExpandEvent(evnt, params);
  3887. }
  3888. }
  3889. }, [h('i', {
  3890. class: isExpand ? cell_getIcon().TABLE_ROW_GROUP_OPEN : cell_getIcon().TABLE_ROW_GROUP_CLOSE
  3891. })]) : renderEmptyElement($table), h('div', {
  3892. class: 'vxe-row-group-cell'
  3893. }, cellVNodes)]);
  3894. },
  3895. /**
  3896. * 树
  3897. */
  3898. renderTreeNodeBtn(h, params, cellVNodes) {
  3899. const {
  3900. $table,
  3901. isHidden
  3902. } = params;
  3903. const tableReactData = $table;
  3904. const tableInternalData = $table;
  3905. const {
  3906. treeExpandedFlag
  3907. } = tableReactData;
  3908. const {
  3909. fullAllDataRowIdData,
  3910. treeExpandedMaps,
  3911. treeExpandLazyLoadedMaps
  3912. } = tableInternalData;
  3913. const treeOpts = $table.computeTreeOpts;
  3914. const {
  3915. row,
  3916. column,
  3917. level
  3918. } = params;
  3919. const {
  3920. slots
  3921. } = column;
  3922. const {
  3923. padding,
  3924. indent,
  3925. lazy,
  3926. trigger,
  3927. iconLoaded,
  3928. showIcon,
  3929. iconOpen,
  3930. iconClose
  3931. } = treeOpts;
  3932. const childrenField = treeOpts.children || treeOpts.childrenField;
  3933. const hasChildField = treeOpts.hasChild || treeOpts.hasChildField;
  3934. const rowChilds = row[childrenField];
  3935. const hasChild = rowChilds && rowChilds.length;
  3936. const iconSlot = slots ? slots.icon : null;
  3937. let hasLazyChilds = false;
  3938. let isActive = false;
  3939. let isLazyLoading = false;
  3940. let isLazyLoaded = false;
  3941. const ons = {};
  3942. if (iconSlot) {
  3943. return $table.callSlot(iconSlot, params, h);
  3944. }
  3945. if (!isHidden) {
  3946. const rowid = getRowid($table, row);
  3947. isActive = !!treeExpandedFlag && !!treeExpandedMaps[rowid];
  3948. if (lazy) {
  3949. const rest = fullAllDataRowIdData[rowid];
  3950. isLazyLoading = !!treeExpandLazyLoadedMaps[rowid];
  3951. hasLazyChilds = row[hasChildField];
  3952. isLazyLoaded = !!rest.treeLoaded;
  3953. }
  3954. }
  3955. if (!trigger || trigger === 'default') {
  3956. ons.click = evnt => {
  3957. $table.triggerTreeExpandEvent(evnt, params);
  3958. };
  3959. }
  3960. return [h('div', {
  3961. class: ['vxe-cell--tree-node', {
  3962. 'is--active': isActive
  3963. }],
  3964. style: padding && indent ? {
  3965. paddingLeft: `${level * indent}px`
  3966. } : undefined
  3967. }, [showIcon && (lazy ? isLazyLoaded ? hasChild : hasChild || hasLazyChilds : hasChild) ? [h('div', {
  3968. class: 'vxe-cell--tree-btn',
  3969. on: ons
  3970. }, [h('i', {
  3971. class: isLazyLoading ? iconLoaded || cell_getIcon().TABLE_TREE_LOADED : isActive ? iconOpen || cell_getIcon().TABLE_TREE_OPEN : iconClose || cell_getIcon().TABLE_TREE_CLOSE
  3972. })])] : null, h('div', {
  3973. class: 'vxe-tree-cell'
  3974. }, cellVNodes)])];
  3975. },
  3976. /**
  3977. * 层级节点。
  3978. * 行分组、树结构
  3979. */
  3980. renderDeepNodeBtn(h, params, cellVNodes) {
  3981. const {
  3982. $table,
  3983. row,
  3984. column
  3985. } = params;
  3986. const {
  3987. rowGroupNode
  3988. } = column;
  3989. const tableReactData = $table;
  3990. const {
  3991. rowGroupList
  3992. } = tableReactData;
  3993. if (rowGroupList.length) {
  3994. const aggregateOpts = $table.computeAggregateOpts;
  3995. const {
  3996. mode
  3997. } = aggregateOpts;
  3998. if (mode === 'column' ? column.field === row.groupField : rowGroupNode) {
  3999. return [Cell.renderRowGroupBtn(h, params, cellVNodes)];
  4000. }
  4001. }
  4002. return [Cell.renderTreeNodeBtn(h, params, cellVNodes)];
  4003. },
  4004. /**
  4005. * 序号
  4006. */
  4007. renderSeqHeader(h, params) {
  4008. const {
  4009. $table,
  4010. column
  4011. } = params;
  4012. const {
  4013. slots
  4014. } = column;
  4015. return renderHeaderCellBaseVNs(h, params, renderTitleContent(h, params, slots && slots.header ? $table.callSlot(slots.header, params, h) : formatText(column.getTitle(), 1)));
  4016. },
  4017. renderSeqCell(h, params) {
  4018. const {
  4019. $table,
  4020. column
  4021. } = params;
  4022. const tableProps = $table;
  4023. const {
  4024. treeConfig
  4025. } = tableProps;
  4026. const seqOpts = $table.computeSeqOpts;
  4027. const {
  4028. slots
  4029. } = column;
  4030. if (slots && slots.default) {
  4031. return renderCellBaseVNs(h, params, $table.callSlot(slots.default, params, h));
  4032. }
  4033. const {
  4034. seq
  4035. } = params;
  4036. const seqMethod = seqOpts.seqMethod;
  4037. return renderCellBaseVNs(h, params, [h('span', `${formatText(seqMethod ? seqMethod(params) : treeConfig ? seq : (seqOpts.startIndex || 0) + seq, 1)}`)]);
  4038. },
  4039. renderDeepIndexCell(h, params) {
  4040. return Cell.renderDeepNodeBtn(h, params, Cell.renderSeqCell(h, params));
  4041. },
  4042. /**
  4043. * 单选
  4044. */
  4045. renderRadioHeader(h, params) {
  4046. const {
  4047. $table,
  4048. column
  4049. } = params;
  4050. const {
  4051. slots
  4052. } = column;
  4053. const headerSlot = slots ? slots.header : null;
  4054. const titleSlot = slots ? slots.title : null;
  4055. return renderHeaderCellBaseVNs(h, params, renderTitleContent(h, params, headerSlot ? $table.callSlot(headerSlot, params, h) : [h('span', {
  4056. class: 'vxe-radio--label'
  4057. }, titleSlot ? $table.callSlot(titleSlot, params, h) : formatText(column.getTitle(), 1))]));
  4058. },
  4059. renderRadioCell(h, params) {
  4060. const {
  4061. $table,
  4062. column,
  4063. isHidden
  4064. } = params;
  4065. const tableReactData = $table;
  4066. const {
  4067. selectRadioRow
  4068. } = tableReactData;
  4069. const radioOpts = $table.computeRadioOpts;
  4070. const {
  4071. slots
  4072. } = column;
  4073. const {
  4074. labelField,
  4075. checkMethod,
  4076. visibleMethod
  4077. } = radioOpts;
  4078. const {
  4079. row
  4080. } = params;
  4081. const defaultSlot = slots ? slots.default : null;
  4082. const radioSlot = slots ? slots.radio : null;
  4083. const isChecked = row === selectRadioRow;
  4084. const isVisible = !visibleMethod || visibleMethod({
  4085. $table,
  4086. row
  4087. });
  4088. let isDisabled = !!checkMethod;
  4089. let on;
  4090. if (!isHidden) {
  4091. on = {
  4092. click(evnt) {
  4093. if (!isDisabled && isVisible) {
  4094. $table.triggerRadioRowEvent(evnt, params);
  4095. }
  4096. }
  4097. };
  4098. if (checkMethod) {
  4099. isDisabled = !checkMethod({
  4100. $table,
  4101. row
  4102. });
  4103. }
  4104. }
  4105. const radioParams = {
  4106. ...params,
  4107. checked: isChecked,
  4108. disabled: isDisabled,
  4109. visible: isVisible
  4110. };
  4111. if (radioSlot) {
  4112. return renderCellBaseVNs(h, params, $table.callSlot(radioSlot, radioParams, h));
  4113. }
  4114. const radioVNs = [];
  4115. if (isVisible) {
  4116. radioVNs.push(h('span', {
  4117. class: ['vxe-radio--icon', isChecked ? cell_getIcon().TABLE_RADIO_CHECKED : isDisabled ? cell_getIcon().TABLE_RADIO_DISABLED_UNCHECKED : cell_getIcon().TABLE_RADIO_UNCHECKED]
  4118. }));
  4119. }
  4120. if (defaultSlot || labelField) {
  4121. radioVNs.push(h('span', {
  4122. class: 'vxe-radio--label'
  4123. }, defaultSlot ? $table.callSlot(defaultSlot, radioParams, h) : external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, labelField)));
  4124. }
  4125. return renderCellBaseVNs(h, params, [h('span', {
  4126. class: ['vxe-cell--radio', {
  4127. 'is--checked': isChecked,
  4128. 'is--disabled': isDisabled
  4129. }],
  4130. on
  4131. }, radioVNs)]);
  4132. },
  4133. renderDeepRadioCell(h, params) {
  4134. return Cell.renderDeepNodeBtn(h, params, Cell.renderRadioCell(h, params));
  4135. },
  4136. /**
  4137. * 多选
  4138. */
  4139. renderCheckboxHeader(h, params) {
  4140. const {
  4141. $table,
  4142. column,
  4143. isHidden
  4144. } = params;
  4145. const tableReactData = $table;
  4146. const {
  4147. isAllSelected: isAllCheckboxSelected,
  4148. isIndeterminate: isAllCheckboxIndeterminate
  4149. } = tableReactData;
  4150. const isAllCheckboxDisabled = $table.computeIsAllCheckboxDisabled;
  4151. const {
  4152. slots
  4153. } = column;
  4154. const headerSlot = slots ? slots.header : null;
  4155. const titleSlot = slots ? slots.title : null;
  4156. const checkboxOpts = $table.computeCheckboxOpts;
  4157. const {
  4158. checkStrictly,
  4159. showHeader,
  4160. headerTitle
  4161. } = checkboxOpts;
  4162. const colTitle = column.getTitle();
  4163. const ons = {};
  4164. if (!isHidden) {
  4165. ons.click = evnt => {
  4166. if (!isAllCheckboxDisabled) {
  4167. $table.triggerCheckAllEvent(evnt, !isAllCheckboxSelected);
  4168. }
  4169. };
  4170. }
  4171. const checkboxParams = {
  4172. ...params,
  4173. checked: isAllCheckboxSelected,
  4174. disabled: isAllCheckboxDisabled,
  4175. indeterminate: isAllCheckboxIndeterminate
  4176. };
  4177. if (headerSlot) {
  4178. return renderHeaderCellBaseVNs(h, params, renderTitleContent(h, checkboxParams, $table.callSlot(headerSlot, checkboxParams, h)));
  4179. }
  4180. if (checkStrictly ? !showHeader : showHeader === false) {
  4181. return renderHeaderCellBaseVNs(h, params, renderTitleContent(h, checkboxParams, [h('span', {
  4182. class: 'vxe-checkbox--label'
  4183. }, titleSlot ? $table.callSlot(titleSlot, checkboxParams, h) : colTitle)]));
  4184. }
  4185. return renderHeaderCellBaseVNs(h, params, renderTitleContent(h, checkboxParams, [h('span', {
  4186. class: ['vxe-cell--checkbox', {
  4187. 'is--checked': isAllCheckboxSelected,
  4188. 'is--disabled': isAllCheckboxDisabled,
  4189. 'is--indeterminate': isAllCheckboxIndeterminate
  4190. }],
  4191. attrs: {
  4192. title: external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(headerTitle) ? cell_getI18n('vxe.table.allTitle') : `${headerTitle || ''}`
  4193. },
  4194. on: ons
  4195. }, [h('span', {
  4196. class: ['vxe-checkbox--icon', isAllCheckboxIndeterminate ? cell_getIcon().TABLE_CHECKBOX_INDETERMINATE : isAllCheckboxSelected ? cell_getIcon().TABLE_CHECKBOX_CHECKED : isAllCheckboxDisabled ? cell_getIcon().TABLE_CHECKBOX_DISABLED_UNCHECKED : cell_getIcon().TABLE_CHECKBOX_UNCHECKED]
  4197. })].concat(titleSlot || colTitle ? [h('span', {
  4198. class: 'vxe-checkbox--label'
  4199. }, titleSlot ? $table.callSlot(titleSlot, checkboxParams, h) : colTitle)] : []))]));
  4200. },
  4201. renderCheckboxCell(h, params) {
  4202. const {
  4203. $table,
  4204. row,
  4205. column,
  4206. isHidden
  4207. } = params;
  4208. const tableProps = $table;
  4209. const tableReactData = $table;
  4210. const tableInternalData = $table;
  4211. const {
  4212. treeConfig
  4213. } = tableProps;
  4214. const {
  4215. updateCheckboxFlag,
  4216. isRowGroupStatus
  4217. } = tableReactData;
  4218. const {
  4219. selectCheckboxMaps,
  4220. treeIndeterminateRowMaps
  4221. } = tableInternalData;
  4222. const aggregateOpts = $table.computeAggregateOpts;
  4223. const {
  4224. mapChildrenField
  4225. } = aggregateOpts;
  4226. const checkboxOpts = $table.computeCheckboxOpts;
  4227. const {
  4228. labelField,
  4229. checkMethod,
  4230. visibleMethod
  4231. } = checkboxOpts;
  4232. const {
  4233. slots
  4234. } = column;
  4235. const defaultSlot = slots ? slots.default : null;
  4236. const checkboxSlot = slots ? slots.checkbox : null;
  4237. let indeterminate = false;
  4238. let isChecked = false;
  4239. let isVisible = true;
  4240. let isDisabled = false;
  4241. const ons = {};
  4242. if (!isHidden) {
  4243. const rowid = getRowid($table, row);
  4244. isChecked = !!updateCheckboxFlag && !!selectCheckboxMaps[rowid];
  4245. if (checkMethod && isRowGroupStatus && $table.isAggregateRecord(row)) {
  4246. const childList = row[mapChildrenField || ''];
  4247. if (!childList || !childList.length || childList.every(item => !checkMethod({
  4248. $table,
  4249. row: item
  4250. }))) {
  4251. isDisabled = true;
  4252. }
  4253. } else {
  4254. isVisible = !visibleMethod || visibleMethod({
  4255. $table,
  4256. row
  4257. });
  4258. isDisabled = checkMethod ? !checkMethod({
  4259. $table,
  4260. row
  4261. }) : !!checkMethod;
  4262. }
  4263. if (treeConfig || isRowGroupStatus) {
  4264. indeterminate = !!treeIndeterminateRowMaps[rowid];
  4265. }
  4266. ons.click = evnt => {
  4267. if (!isDisabled && isVisible) {
  4268. $table.triggerCheckRowEvent(evnt, params, !isChecked);
  4269. }
  4270. };
  4271. }
  4272. const checkboxParams = {
  4273. ...params,
  4274. checked: isChecked,
  4275. disabled: isDisabled,
  4276. visible: isVisible,
  4277. indeterminate
  4278. };
  4279. if (checkboxSlot) {
  4280. return renderCellBaseVNs(h, params, $table.callSlot(checkboxSlot, checkboxParams, h));
  4281. }
  4282. const checkVNs = [];
  4283. if (isVisible) {
  4284. checkVNs.push(h('span', {
  4285. class: ['vxe-checkbox--icon', indeterminate ? cell_getIcon().TABLE_CHECKBOX_INDETERMINATE : isChecked ? cell_getIcon().TABLE_CHECKBOX_CHECKED : isDisabled ? cell_getIcon().TABLE_CHECKBOX_DISABLED_UNCHECKED : cell_getIcon().TABLE_CHECKBOX_UNCHECKED]
  4286. }));
  4287. }
  4288. if (defaultSlot || labelField) {
  4289. checkVNs.push(h('span', {
  4290. class: 'vxe-checkbox--label'
  4291. }, defaultSlot ? $table.callSlot(defaultSlot, checkboxParams, h) : external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, labelField)));
  4292. }
  4293. return renderCellBaseVNs(h, params, [h('span', {
  4294. class: ['vxe-cell--checkbox', {
  4295. 'is--checked': isChecked,
  4296. 'is--disabled': isDisabled,
  4297. 'is--indeterminate': indeterminate,
  4298. 'is--hidden': !isVisible
  4299. }],
  4300. on: ons
  4301. }, checkVNs)]);
  4302. },
  4303. renderDeepSelectionCell(h, params) {
  4304. return Cell.renderDeepNodeBtn(h, params, Cell.renderCheckboxCell(h, params));
  4305. },
  4306. renderCheckboxCellByProp(h, params) {
  4307. const {
  4308. $table,
  4309. row,
  4310. column,
  4311. isHidden
  4312. } = params;
  4313. const tableProps = $table;
  4314. const tableReactData = $table;
  4315. const tableInternalData = $table;
  4316. const {
  4317. treeConfig
  4318. } = tableProps;
  4319. const {
  4320. updateCheckboxFlag,
  4321. isRowGroupStatus
  4322. } = tableReactData;
  4323. const {
  4324. treeIndeterminateRowMaps
  4325. } = tableInternalData;
  4326. const aggregateOpts = $table.computeAggregateOpts;
  4327. const {
  4328. mapChildrenField
  4329. } = aggregateOpts;
  4330. const checkboxOpts = $table.computeCheckboxOpts;
  4331. const {
  4332. labelField,
  4333. checkField,
  4334. checkMethod,
  4335. visibleMethod
  4336. } = checkboxOpts;
  4337. const indeterminateField = checkboxOpts.indeterminateField || checkboxOpts.halfField;
  4338. const {
  4339. slots
  4340. } = column;
  4341. const defaultSlot = slots ? slots.default : null;
  4342. const checkboxSlot = slots ? slots.checkbox : null;
  4343. let indeterminate = false;
  4344. let isChecked = false;
  4345. let isVisible = true;
  4346. let isDisabled = false;
  4347. const ons = {};
  4348. if (!isHidden) {
  4349. const rowid = getRowid($table, row);
  4350. isChecked = !!updateCheckboxFlag && external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, checkField);
  4351. if (checkMethod && isRowGroupStatus && $table.isAggregateRecord(row)) {
  4352. const childList = row[mapChildrenField || ''];
  4353. if (!childList || !childList.length || childList.every(item => !checkMethod({
  4354. $table,
  4355. row: item
  4356. }))) {
  4357. isDisabled = true;
  4358. }
  4359. } else {
  4360. isVisible = !visibleMethod || visibleMethod({
  4361. $table,
  4362. row
  4363. });
  4364. isDisabled = checkMethod ? !checkMethod({
  4365. $table,
  4366. row
  4367. }) : !!checkMethod;
  4368. }
  4369. if (treeConfig || isRowGroupStatus) {
  4370. indeterminate = !!treeIndeterminateRowMaps[rowid];
  4371. }
  4372. ons.click = evnt => {
  4373. if (!isDisabled && isVisible) {
  4374. $table.triggerCheckRowEvent(evnt, params, !isChecked);
  4375. }
  4376. };
  4377. }
  4378. const checkboxParams = {
  4379. ...params,
  4380. checked: isChecked,
  4381. disabled: isDisabled,
  4382. visible: isVisible,
  4383. indeterminate
  4384. };
  4385. if (checkboxSlot) {
  4386. return renderCellBaseVNs(h, params, $table.callSlot(checkboxSlot, checkboxParams, h));
  4387. }
  4388. const checkVNs = [];
  4389. if (isVisible) {
  4390. checkVNs.push(h('span', {
  4391. class: ['vxe-checkbox--icon', indeterminate ? cell_getIcon().TABLE_CHECKBOX_INDETERMINATE : isChecked ? cell_getIcon().TABLE_CHECKBOX_CHECKED : isDisabled ? cell_getIcon().TABLE_CHECKBOX_DISABLED_UNCHECKED : cell_getIcon().TABLE_CHECKBOX_UNCHECKED]
  4392. }));
  4393. }
  4394. if (defaultSlot || labelField) {
  4395. checkVNs.push(h('span', {
  4396. class: 'vxe-checkbox--label'
  4397. }, defaultSlot ? $table.callSlot(defaultSlot, checkboxParams, h) : external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, labelField)));
  4398. }
  4399. return renderCellBaseVNs(h, params, [h('span', {
  4400. class: ['vxe-cell--checkbox', {
  4401. 'is--checked': isChecked,
  4402. 'is--disabled': isDisabled,
  4403. 'is--indeterminate': indeterminateField && !isChecked ? row[indeterminateField] : indeterminate,
  4404. 'is--hidden': !isVisible
  4405. }],
  4406. on: ons
  4407. }, checkVNs)]);
  4408. },
  4409. renderDeepSelectionCellByProp(h, params) {
  4410. return Cell.renderDeepNodeBtn(h, params, Cell.renderCheckboxCellByProp(h, params));
  4411. },
  4412. /**
  4413. * 展开行
  4414. */
  4415. renderExpandCell(h, params) {
  4416. const {
  4417. $table,
  4418. isHidden,
  4419. row,
  4420. column
  4421. } = params;
  4422. const tableReactData = $table;
  4423. const tableInternalData = $table;
  4424. const {
  4425. isRowGroupStatus
  4426. } = tableReactData;
  4427. const {
  4428. rowExpandedMaps,
  4429. rowExpandLazyLoadedMaps
  4430. } = tableInternalData;
  4431. const expandOpts = $table.computeExpandOpts;
  4432. const {
  4433. lazy,
  4434. labelField,
  4435. iconLoaded,
  4436. showIcon,
  4437. iconOpen,
  4438. iconClose,
  4439. visibleMethod
  4440. } = expandOpts;
  4441. const {
  4442. slots
  4443. } = column;
  4444. const defaultSlot = slots ? slots.default : null;
  4445. const iconSlot = slots ? slots.icon : null;
  4446. let isActive = false;
  4447. let isLazyLoading = false;
  4448. if (isRowGroupStatus && row.isAggregate) {
  4449. return renderCellBaseVNs(h, params, []);
  4450. }
  4451. if (iconSlot) {
  4452. return renderCellBaseVNs(h, params, $table.callSlot(iconSlot, params, h));
  4453. }
  4454. if (!isHidden) {
  4455. const rowid = getRowid($table, row);
  4456. isActive = !!rowExpandedMaps[rowid];
  4457. if (lazy) {
  4458. isLazyLoading = !!rowExpandLazyLoadedMaps[rowid];
  4459. }
  4460. }
  4461. return renderCellBaseVNs(h, params, [showIcon && (!visibleMethod || visibleMethod(params)) ? h('span', {
  4462. class: ['vxe-table--expanded', {
  4463. 'is--active': isActive
  4464. }],
  4465. on: {
  4466. mousedown(evnt) {
  4467. evnt.stopPropagation();
  4468. },
  4469. click(evnt) {
  4470. $table.triggerRowExpandEvent(evnt, params);
  4471. }
  4472. }
  4473. }, [h('i', {
  4474. class: ['vxe-table--expand-btn', isLazyLoading ? iconLoaded || cell_getIcon().TABLE_EXPAND_LOADED : isActive ? iconOpen || cell_getIcon().TABLE_EXPAND_OPEN : iconClose || cell_getIcon().TABLE_EXPAND_CLOSE]
  4475. })]) : renderEmptyElement($table), defaultSlot || labelField ? h('span', {
  4476. class: 'vxe-table--expand-label'
  4477. }, defaultSlot ? $table.callSlot(defaultSlot, params, h) : external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, labelField)) : renderEmptyElement($table)]);
  4478. },
  4479. renderExpandData(h, params) {
  4480. const {
  4481. $table,
  4482. column
  4483. } = params;
  4484. const {
  4485. slots,
  4486. contentRender
  4487. } = column;
  4488. if (slots && slots.content) {
  4489. return $table.callSlot(slots.content, params, h);
  4490. }
  4491. if (contentRender) {
  4492. const compConf = cell_renderer.get(contentRender.name);
  4493. const rtExpand = compConf ? compConf.renderTableExpand || compConf.renderExpand : null;
  4494. if (rtExpand) {
  4495. return getSlotVNs(rtExpand.call($table, h, contentRender, params));
  4496. }
  4497. }
  4498. return [];
  4499. },
  4500. /**
  4501. * HTML 标签
  4502. */
  4503. renderHTMLCell(h, params) {
  4504. const {
  4505. $table,
  4506. column
  4507. } = params;
  4508. const {
  4509. slots
  4510. } = column;
  4511. if (slots && slots.default) {
  4512. return renderCellBaseVNs(h, params, $table.callSlot(slots.default, params, h));
  4513. }
  4514. return renderCellBaseVNs(h, params, [h('span', {
  4515. class: 'vxe-cell--html',
  4516. domProps: {
  4517. innerHTML: getDefaultCellLabel(params)
  4518. }
  4519. })]);
  4520. },
  4521. renderDeepHTMLCell(h, params) {
  4522. return Cell.renderDeepNodeBtn(h, params, Cell.renderHTMLCell(h, params));
  4523. },
  4524. /**
  4525. * 排序和筛选
  4526. */
  4527. renderSortAndFilterHeader(h, params) {
  4528. return renderHeaderCellBaseVNs(h, params, Cell.renderHeaderTitle(h, params).concat(Cell.renderSortIcon(h, params).concat(Cell.renderFilterIcon(h, params))));
  4529. },
  4530. /**
  4531. * 排序
  4532. */
  4533. renderSortHeader(h, params) {
  4534. return renderHeaderCellBaseVNs(h, params, Cell.renderHeaderTitle(h, params).concat(Cell.renderSortIcon(h, params)));
  4535. },
  4536. renderSortIcon(h, params) {
  4537. const {
  4538. $table,
  4539. column
  4540. } = params;
  4541. const sortOpts = $table.computeSortOpts;
  4542. const {
  4543. showIcon,
  4544. allowBtn,
  4545. ascTitle,
  4546. descTitle,
  4547. iconLayout,
  4548. iconAsc,
  4549. iconDesc,
  4550. iconVisibleMethod
  4551. } = sortOpts;
  4552. if (showIcon && (!iconVisibleMethod || iconVisibleMethod(params))) {
  4553. return [h('span', {
  4554. class: ['vxe-cell--sort', `vxe-cell--sort-${iconLayout}-layout`]
  4555. }, [h('i', {
  4556. class: ['vxe-sort--asc-btn', iconAsc || cell_getIcon().TABLE_SORT_ASC, {
  4557. 'sort--active': column.order === 'asc'
  4558. }],
  4559. attrs: {
  4560. title: external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(ascTitle) ? cell_getI18n('vxe.table.sortAsc') : `${ascTitle || ''}`
  4561. },
  4562. on: allowBtn ? {
  4563. click(evnt) {
  4564. evnt.stopPropagation();
  4565. $table.triggerSortEvent(evnt, column, 'asc');
  4566. }
  4567. } : undefined
  4568. }), h('i', {
  4569. class: ['vxe-sort--desc-btn', iconDesc || cell_getIcon().TABLE_SORT_DESC, {
  4570. 'sort--active': column.order === 'desc'
  4571. }],
  4572. attrs: {
  4573. title: external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(descTitle) ? cell_getI18n('vxe.table.sortDesc') : `${descTitle || ''}`
  4574. },
  4575. on: allowBtn ? {
  4576. click(evnt) {
  4577. evnt.stopPropagation();
  4578. $table.triggerSortEvent(evnt, column, 'desc');
  4579. }
  4580. } : undefined
  4581. })])];
  4582. }
  4583. return [];
  4584. },
  4585. /**
  4586. * 筛选
  4587. */
  4588. renderFilterHeader(h, params) {
  4589. return renderHeaderCellBaseVNs(h, params, Cell.renderHeaderTitle(h, params).concat(Cell.renderFilterIcon(h, params)));
  4590. },
  4591. renderFilterIcon(h, params) {
  4592. const {
  4593. $table,
  4594. column,
  4595. hasFilter
  4596. } = params;
  4597. const tableReactData = $table;
  4598. const {
  4599. filterStore
  4600. } = tableReactData;
  4601. const filterOpts = $table.computeFilterOpts;
  4602. const {
  4603. showIcon,
  4604. iconNone,
  4605. iconMatch,
  4606. iconVisibleMethod
  4607. } = filterOpts;
  4608. if (showIcon && (!iconVisibleMethod || iconVisibleMethod(params))) {
  4609. return [h('span', {
  4610. class: ['vxe-cell--filter', {
  4611. 'is--active': filterStore.visible && filterStore.column === column
  4612. }],
  4613. on: {
  4614. click(evnt) {
  4615. if ($table.triggerFilterEvent) {
  4616. $table.triggerFilterEvent(evnt, params.column, params);
  4617. }
  4618. }
  4619. }
  4620. }, [h('i', {
  4621. class: ['vxe-filter--btn', hasFilter ? iconMatch || cell_getIcon().TABLE_FILTER_MATCH : iconNone || cell_getIcon().TABLE_FILTER_NONE],
  4622. attrs: {
  4623. title: cell_getI18n('vxe.table.filter')
  4624. }
  4625. })])];
  4626. }
  4627. return [];
  4628. },
  4629. /**
  4630. * 可编辑
  4631. */
  4632. renderEditHeader(h, params) {
  4633. const {
  4634. $table,
  4635. column
  4636. } = params;
  4637. const tableProps = $table;
  4638. const {
  4639. editConfig,
  4640. editRules
  4641. } = tableProps;
  4642. const editOpts = $table.computeEditOpts;
  4643. const {
  4644. sortable,
  4645. filters,
  4646. editRender
  4647. } = column;
  4648. let isRequired = false;
  4649. if (editRules) {
  4650. const columnRules = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(editRules, column.field);
  4651. if (columnRules) {
  4652. isRequired = columnRules.some(rule => rule.required);
  4653. }
  4654. }
  4655. let editIconVNs = [];
  4656. if (isEnableConf(editConfig)) {
  4657. const {
  4658. showAsterisk,
  4659. showIcon,
  4660. icon
  4661. } = editOpts;
  4662. editIconVNs = [isRequired && showAsterisk ? h('i', {
  4663. class: 'vxe-cell--required-icon'
  4664. }, [h('i', {
  4665. class: 'vxe-cell--required-icon'
  4666. })]) : renderEmptyElement($table), isEnableConf(editRender) && showIcon ? h('i', {
  4667. class: 'vxe-cell--edit-icon'
  4668. }, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(icon) ? getSlotVNs(icon({})) : [h('i', {
  4669. class: icon || cell_getIcon().TABLE_EDIT
  4670. })]) : renderEmptyElement($table)];
  4671. }
  4672. return renderHeaderCellBaseVNs(h, params, editIconVNs.concat(Cell.renderHeaderTitle(h, params)).concat(sortable ? Cell.renderSortIcon(h, params) : []).concat(filters ? Cell.renderFilterIcon(h, params) : []));
  4673. },
  4674. // 行格编辑模式
  4675. renderRowEdit(h, params) {
  4676. const {
  4677. $table,
  4678. column
  4679. } = params;
  4680. const tableReactData = $table;
  4681. const {
  4682. editStore
  4683. } = tableReactData;
  4684. const {
  4685. actived
  4686. } = editStore;
  4687. const {
  4688. editRender
  4689. } = column;
  4690. return Cell.runRenderer(h, params, this, isEnableConf(editRender) && actived && actived.row === params.row);
  4691. },
  4692. renderDeepRowEdit(h, params) {
  4693. return Cell.renderDeepNodeBtn(h, params, Cell.renderRowEdit(h, params));
  4694. },
  4695. // 单元格编辑模式
  4696. renderCellEdit(h, params) {
  4697. const {
  4698. $table,
  4699. column
  4700. } = params;
  4701. const tableReactData = $table;
  4702. const {
  4703. editStore
  4704. } = tableReactData;
  4705. const {
  4706. actived
  4707. } = editStore;
  4708. const {
  4709. editRender
  4710. } = column;
  4711. return Cell.runRenderer(h, params, this, isEnableConf(editRender) && actived && actived.row === params.row && actived.column === params.column);
  4712. },
  4713. renderDeepCellEdit(h, params) {
  4714. return Cell.renderDeepNodeBtn(h, params, Cell.renderCellEdit(h, params));
  4715. },
  4716. runRenderer(h, params, _vm, isEdit) {
  4717. const {
  4718. $table,
  4719. row,
  4720. column
  4721. } = params;
  4722. const tableReactData = $table;
  4723. const {
  4724. isRowGroupStatus
  4725. } = tableReactData;
  4726. const {
  4727. slots,
  4728. field,
  4729. editRender,
  4730. formatter
  4731. } = column;
  4732. const compConf = cell_renderer.get(editRender.name);
  4733. const rtEdit = compConf ? compConf.renderTableEdit || compConf.renderEdit : null;
  4734. const defaultSlot = slots ? slots.default : null;
  4735. const gcSlot = slots ? slots.groupContent || slots['group-content'] : null;
  4736. const cellParams = Object.assign({
  4737. $type: '',
  4738. isEdit
  4739. }, params);
  4740. if (isEdit) {
  4741. if (slots && slots.edit) {
  4742. return $table.callSlot(slots.edit, cellParams, h);
  4743. }
  4744. if (rtEdit) {
  4745. return getSlotVNs(rtEdit.call($table, h, editRender, cellParams));
  4746. }
  4747. return [];
  4748. }
  4749. if (isRowGroupStatus && field && row.isAggregate) {
  4750. const aggRow = row;
  4751. const aggregateOpts = $table.computeAggregateOpts;
  4752. const {
  4753. mapChildrenField
  4754. } = aggregateOpts;
  4755. const groupField = aggRow.groupField;
  4756. const groupContent = aggRow.groupContent;
  4757. const childList = mapChildrenField ? aggRow[mapChildrenField] || [] : [];
  4758. const childCount = aggRow.childCount;
  4759. if (gcSlot) {
  4760. return renderCellBaseVNs(h, params, $table.callSlot(gcSlot, Object.assign({
  4761. groupField,
  4762. groupContent,
  4763. childList,
  4764. childCount
  4765. }, params), h));
  4766. }
  4767. } else {
  4768. if (defaultSlot) {
  4769. return renderCellBaseVNs(h, params, $table.callSlot(defaultSlot, cellParams, h));
  4770. }
  4771. }
  4772. if (formatter) {
  4773. return renderCellBaseVNs(h, params, [h('span', {
  4774. class: 'vxe-cell--label'
  4775. }, [getDefaultCellLabel(cellParams)])]);
  4776. }
  4777. return Cell.renderDefaultCell.call(_vm, h, cellParams);
  4778. }
  4779. };
  4780. /* harmony default export */ var cell = (Cell);
  4781. ;// CONCATENATED MODULE: ./packages/ui/src/comp.ts
  4782. const defineVxeComponent = options => options;
  4783. ;// CONCATENATED MODULE: ./packages/table/src/column.ts
  4784. const columnProps = {
  4785. // 列唯一主键
  4786. colId: [String, Number],
  4787. // 渲染类型 seq,radio,checkbox,expand,html
  4788. type: String,
  4789. // 列字段名
  4790. field: String,
  4791. // 列标题
  4792. title: String,
  4793. // 列宽度
  4794. width: [Number, String],
  4795. // 列最小宽度,把剩余宽度按比例分配
  4796. minWidth: [Number, String],
  4797. // 列最大宽度
  4798. maxWidth: [Number, String],
  4799. // 是否允许拖动列宽调整大小
  4800. resizable: {
  4801. type: Boolean,
  4802. default: null
  4803. },
  4804. // 将列固定在左侧或者右侧
  4805. fixed: String,
  4806. // 列对其方式
  4807. align: String,
  4808. // 表头对齐方式
  4809. headerAlign: String,
  4810. // 表尾列的对齐方式
  4811. footerAlign: String,
  4812. // 当内容过长时显示为省略号
  4813. showOverflow: {
  4814. type: [Boolean, String],
  4815. default: null
  4816. },
  4817. // 当表头内容过长时显示为省略号
  4818. showHeaderOverflow: {
  4819. type: [Boolean, String],
  4820. default: null
  4821. },
  4822. // 当表尾内容过长时显示为省略号
  4823. showFooterOverflow: {
  4824. type: [Boolean, String],
  4825. default: null
  4826. },
  4827. // 给单元格附加 className
  4828. className: [String, Function],
  4829. // 给表头单元格附加 className
  4830. headerClassName: [String, Function],
  4831. // 给表尾单元格附加 className
  4832. footerClassName: [String, Function],
  4833. // 格式化显示内容
  4834. formatter: [Function, Array, String],
  4835. // 格式化表头显示内容
  4836. headerFormatter: [Function, Array, String],
  4837. // 格式化表尾显示内容
  4838. footerFormatter: [Function, Array, String],
  4839. // 是否显示间距
  4840. padding: {
  4841. type: Boolean,
  4842. default: null
  4843. },
  4844. // 垂直对齐方式
  4845. verticalAlign: {
  4846. type: String,
  4847. default: null
  4848. },
  4849. // 是否允许排序
  4850. sortable: Boolean,
  4851. // 在 v3 中废弃
  4852. remoteSort: {
  4853. type: Boolean,
  4854. default: null
  4855. },
  4856. // 在 v3 中只支持字符串类型
  4857. sortBy: [String, Function],
  4858. // 排序的字段类型,比如字符串转数值等
  4859. sortType: String,
  4860. // 在 v3 中废弃
  4861. sortMethod: Function,
  4862. // 配置筛选条件数组
  4863. filters: {
  4864. type: Array,
  4865. default: null
  4866. },
  4867. // 筛选是否允许多选
  4868. filterMultiple: {
  4869. type: Boolean,
  4870. default: true
  4871. },
  4872. // 自定义筛选方法
  4873. filterMethod: Function,
  4874. // 筛选重置方法
  4875. filterResetMethod: Function,
  4876. // 筛选复原方法
  4877. filterRecoverMethod: Function,
  4878. // 筛选模板配置项
  4879. filterRender: Object,
  4880. // 是否显示浮动筛选
  4881. floatingFilters: Object,
  4882. // 设置为分组节点
  4883. rowGroupNode: Boolean,
  4884. // 设置为树节点
  4885. treeNode: Boolean,
  4886. // 设置为拖拽排序
  4887. dragSort: Boolean,
  4888. // 设置为行高拖拽
  4889. rowResize: Boolean,
  4890. // 是否可视
  4891. visible: {
  4892. type: Boolean,
  4893. default: null
  4894. },
  4895. // 表头单元格数据导出方法
  4896. headerExportMethod: Function,
  4897. // 单元格数据导出方法
  4898. exportMethod: Function,
  4899. // 表尾单元格数据导出方法
  4900. footerExportMethod: Function,
  4901. // 已废弃,被 titlePrefix 替换
  4902. titleHelp: Object,
  4903. // 标题前缀图标配置项
  4904. titlePrefix: Object,
  4905. // 标题后缀图标配置项
  4906. titleSuffix: Object,
  4907. // 单元格值类型
  4908. cellType: String,
  4909. // 单元格渲染配置项
  4910. cellRender: Object,
  4911. // 单元格编辑渲染配置项
  4912. editRender: Object,
  4913. // 内容渲染配置项
  4914. contentRender: Object,
  4915. // 聚合函数
  4916. aggFunc: [String, Boolean],
  4917. // 额外的参数
  4918. params: Object
  4919. };
  4920. const columnWatch = {};
  4921. Object.keys(columnProps).forEach(name => {
  4922. columnWatch[name] = function (value) {
  4923. const $xeTable = this.$xeTable;
  4924. this.columnConfig.update(name, value);
  4925. if ($xeTable) {
  4926. if (name === 'filters') {
  4927. $xeTable.setFilter(this.columnConfig, value);
  4928. $xeTable.handleUpdateDataQueue();
  4929. } else if (['visible', 'fixed', 'width', 'minWidth', 'maxWidth'].includes(name)) {
  4930. $xeTable.handleRefreshColumnQueue();
  4931. }
  4932. }
  4933. };
  4934. });
  4935. /* harmony default export */ var column = (/* define-vxe-component start */defineVxeComponent({
  4936. name: 'VxeColumn',
  4937. props: columnProps,
  4938. provide() {
  4939. return {
  4940. $xeColumn: this,
  4941. $xeGrid: null,
  4942. $xeGantt: null
  4943. };
  4944. },
  4945. inject: {
  4946. $xeTable: {
  4947. default: null
  4948. },
  4949. $xeColumn: {
  4950. default: null
  4951. }
  4952. },
  4953. watch: columnWatch,
  4954. created() {
  4955. const $xeTable = this.$xeTable;
  4956. this.columnConfig = this.createColumn($xeTable, this);
  4957. },
  4958. mounted() {
  4959. this.columnConfig.slots = this.$scopedSlots;
  4960. assembleColumn(this);
  4961. },
  4962. destroyed() {
  4963. destroyColumn(this);
  4964. },
  4965. render(h) {
  4966. return h('div', this.$slots.default);
  4967. },
  4968. methods: cell
  4969. })); /* define-vxe-component end */
  4970. ;// CONCATENATED MODULE: ./packages/column/index.ts
  4971. const VxeColumn = Object.assign({}, column, {
  4972. install(app) {
  4973. app.component(column.name, column);
  4974. // 兼容旧用法
  4975. app.component('VxeTableColumn', column);
  4976. }
  4977. });
  4978. if (core_.VxeUI.dynamicApp) {
  4979. core_.VxeUI.dynamicApp.component(column.name, column);
  4980. // 兼容旧用法
  4981. core_.VxeUI.dynamicApp.component('VxeTableColumn', column);
  4982. }
  4983. core_.VxeUI.component(column);
  4984. const Column = VxeColumn;
  4985. /* harmony default export */ var packages_column = ((/* unused pure expression or super */ null && (VxeColumn)));
  4986. ;// CONCATENATED MODULE: ./packages/table/src/group.ts
  4987. /* harmony default export */ var group = (/* define-vxe-component start */defineVxeComponent({
  4988. name: 'VxeColgroup',
  4989. props: columnProps,
  4990. provide() {
  4991. return {
  4992. $xeColumn: this,
  4993. $xeGrid: null,
  4994. $xeGantt: null
  4995. };
  4996. },
  4997. inject: {
  4998. $xeTable: {
  4999. default: null
  5000. },
  5001. $xeColumn: {
  5002. default: null
  5003. }
  5004. },
  5005. watch: columnWatch,
  5006. created() {
  5007. const $xeTable = this.$xeTable;
  5008. this.columnConfig = this.createColumn($xeTable, this);
  5009. },
  5010. mounted() {
  5011. const {
  5012. $scopedSlots
  5013. } = this;
  5014. const columnSlots = {};
  5015. if ($scopedSlots.header) {
  5016. columnSlots.header = $scopedSlots.header;
  5017. }
  5018. this.columnConfig.slots = columnSlots;
  5019. assembleColumn(this);
  5020. },
  5021. destroyed() {
  5022. destroyColumn(this);
  5023. },
  5024. render(h) {
  5025. return h('div', this.$slots.default);
  5026. },
  5027. methods: cell
  5028. })); /* define-vxe-component end */
  5029. ;// CONCATENATED MODULE: ./packages/colgroup/index.ts
  5030. const VxeColgroup = Object.assign({}, group, {
  5031. install(app) {
  5032. app.component(group.name, group);
  5033. // 兼容旧用法
  5034. app.component('VxeTableColgroup', group);
  5035. }
  5036. });
  5037. if (core_.VxeUI.dynamicApp) {
  5038. core_.VxeUI.dynamicApp.component(group.name, group);
  5039. // 兼容旧用法
  5040. core_.VxeUI.dynamicApp.component('VxeTableColgroup', group);
  5041. }
  5042. core_.VxeUI.component(group);
  5043. const Colgroup = VxeColgroup;
  5044. /* harmony default export */ var colgroup = ((/* unused pure expression or super */ null && (VxeColgroup)));
  5045. ;// CONCATENATED MODULE: ./packages/table/src/props.ts
  5046. const {
  5047. getConfig: props_getConfig
  5048. } = core_.VxeUI;
  5049. const tableProps = {
  5050. /** 基本属性 */
  5051. id: [String, Function],
  5052. // 数据
  5053. data: Array,
  5054. // 表格的高度
  5055. height: [Number, String],
  5056. // 表格的最小高度
  5057. minHeight: {
  5058. type: [Number, String],
  5059. default: () => null
  5060. },
  5061. // 表格的最大高度
  5062. maxHeight: [Number, String],
  5063. // 已废弃,被 column-config.resizable 替换
  5064. resizable: {
  5065. type: Boolean,
  5066. default: () => props_getConfig().table.resizable
  5067. },
  5068. // 是否带有斑马纹
  5069. stripe: {
  5070. type: Boolean,
  5071. default: () => props_getConfig().table.stripe
  5072. },
  5073. // 是否带有边框
  5074. border: {
  5075. type: [Boolean, String],
  5076. default: () => props_getConfig().table.border
  5077. },
  5078. // 已废弃,被 cell-config.padding 替换
  5079. padding: {
  5080. type: Boolean,
  5081. default: null
  5082. },
  5083. // 是否圆角边框
  5084. round: {
  5085. type: Boolean,
  5086. default: () => props_getConfig().table.round
  5087. },
  5088. // 表格的尺寸
  5089. size: {
  5090. type: String,
  5091. default: () => props_getConfig().table.size || props_getConfig().size
  5092. },
  5093. // 列的宽度是否自撑开(可能会被废弃的参数,不要使用)
  5094. fit: {
  5095. type: Boolean,
  5096. default: () => props_getConfig().table.fit
  5097. },
  5098. // 表格是否加载中
  5099. loading: Boolean,
  5100. // 所有的列对其方式
  5101. align: {
  5102. type: String,
  5103. default: () => props_getConfig().table.align
  5104. },
  5105. // 所有的表头列的对齐方式
  5106. headerAlign: {
  5107. type: String,
  5108. default: () => props_getConfig().table.headerAlign
  5109. },
  5110. // 所有的表尾列的对齐方式
  5111. footerAlign: {
  5112. type: String,
  5113. default: () => props_getConfig().table.footerAlign
  5114. },
  5115. // 是否显示表头
  5116. showHeader: {
  5117. type: Boolean,
  5118. default: () => props_getConfig().table.showHeader
  5119. },
  5120. // 已废弃,被 row-config.isCurrent 替换
  5121. highlightCurrentRow: {
  5122. type: Boolean,
  5123. default: () => props_getConfig().table.highlightCurrentRow
  5124. },
  5125. // 已废弃,被 row-config.isHover 替换
  5126. highlightHoverRow: {
  5127. type: Boolean,
  5128. default: () => props_getConfig().table.highlightHoverRow
  5129. },
  5130. /**
  5131. * (即将废弃)是否要高亮当前选中列
  5132. * @deprecated
  5133. */
  5134. highlightCurrentColumn: {
  5135. type: Boolean,
  5136. default: () => props_getConfig().table.highlightCurrentColumn
  5137. },
  5138. /**
  5139. * (即将废弃)鼠标移到列是否要高亮显示
  5140. * @deprecated
  5141. */
  5142. highlightHoverColumn: {
  5143. type: Boolean,
  5144. default: () => props_getConfig().table.highlightHoverColumn
  5145. },
  5146. // 已废弃,直接删除
  5147. highlightCell: Boolean,
  5148. // 是否显示表尾合计
  5149. showFooter: Boolean,
  5150. // 表尾数据
  5151. footerData: Array,
  5152. // 表尾合计的计算方法
  5153. footerMethod: Function,
  5154. // 给行附加 className
  5155. rowClassName: [String, Function],
  5156. // 给单元格附加 className
  5157. cellClassName: [String, Function],
  5158. // 给表头的行附加 className
  5159. headerRowClassName: [String, Function],
  5160. // 给表头的单元格附加 className
  5161. headerCellClassName: [String, Function],
  5162. // 给表尾的行附加 className
  5163. footerRowClassName: [String, Function],
  5164. // 给表尾的单元格附加 className
  5165. footerCellClassName: [String, Function],
  5166. // 给单元格附加样式
  5167. cellStyle: [Object, Function],
  5168. // 给表头单元格附加样式
  5169. headerCellStyle: [Object, Function],
  5170. // 给表尾单元格附加样式
  5171. footerCellStyle: [Object, Function],
  5172. // 给行附加样式
  5173. rowStyle: [Object, Function],
  5174. // 给表头行附加样式
  5175. headerRowStyle: [Object, Function],
  5176. // 给表尾行附加样式
  5177. footerRowStyle: [Object, Function],
  5178. // 用于分组表头,显示为自定义列头,配合 mergeHeaderCells 灵活实现自定义合并
  5179. showCustomHeader: {
  5180. type: Boolean,
  5181. default: () => props_getConfig().table.showCustomHeader
  5182. },
  5183. // 临时合并指定的表头单元格
  5184. mergeHeaderCells: Array,
  5185. // 临时合并指定的单元格
  5186. mergeCells: Array,
  5187. // 临时合并指定的表尾单元格
  5188. mergeFooterCells: Array,
  5189. mergeFooterItems: Array,
  5190. // 自定义合并行或列的方法
  5191. spanMethod: Function,
  5192. // 表尾合并行或列
  5193. footerSpanMethod: Function,
  5194. // 设置所有内容过长时显示为省略号
  5195. showOverflow: {
  5196. type: [Boolean, String],
  5197. default: () => props_getConfig().table.showOverflow
  5198. },
  5199. // 设置表头所有内容过长时显示为省略号
  5200. showHeaderOverflow: {
  5201. type: [Boolean, String],
  5202. default: () => props_getConfig().table.showHeaderOverflow
  5203. },
  5204. // 设置表尾所有内容过长时显示为省略号
  5205. showFooterOverflow: {
  5206. type: [Boolean, String],
  5207. default: () => props_getConfig().table.showFooterOverflow
  5208. },
  5209. /** 高级属性 */
  5210. /**
  5211. * (即将废弃)columnKey 已废弃,被 column-config.useKey 替换
  5212. * @deprecated
  5213. */
  5214. columnKey: Boolean,
  5215. /**
  5216. * (即将废弃)rowKey 已废弃,被 row-config.useKey 替换
  5217. * @deprecated
  5218. */
  5219. rowKey: Boolean,
  5220. /**
  5221. * (即将废弃)rowId 已废弃,被 row-config.keyField 替换
  5222. * @deprecated
  5223. */
  5224. rowId: {
  5225. type: String,
  5226. default: () => props_getConfig().table.rowId
  5227. },
  5228. zIndex: Number,
  5229. emptyText: {
  5230. type: String,
  5231. default: () => props_getConfig().table.emptyText
  5232. },
  5233. keepSource: {
  5234. type: Boolean,
  5235. default: () => props_getConfig().table.keepSource
  5236. },
  5237. // 是否自动监听父容器变化去更新响应式表格宽高
  5238. autoResize: {
  5239. type: Boolean,
  5240. default: () => props_getConfig().table.autoResize
  5241. },
  5242. // 是否自动根据状态属性去更新响应式表格宽高
  5243. syncResize: [Boolean, String, Number],
  5244. // 响应式布局配置项
  5245. resizeConfig: Object,
  5246. // 列配置项
  5247. columnConfig: Object,
  5248. // 当前列配置项
  5249. currentColumnConfig: Object,
  5250. // 单元格配置项
  5251. cellConfig: Object,
  5252. // 表头单元格配置项
  5253. headerCellConfig: Object,
  5254. // 表尾单元格配置项
  5255. footerCellConfig: Object,
  5256. // 行配置项
  5257. rowConfig: Object,
  5258. // 数据聚合配置项
  5259. aggregateConfig: Object,
  5260. /**
  5261. * 已废弃,被 aggregateConfig 替换
  5262. * @deprecated
  5263. */
  5264. rowGroupConfig: Object,
  5265. // 当前行配置项
  5266. currentRowConfig: Object,
  5267. /**
  5268. * 已废弃,被 rowDragConfig 替换
  5269. * @deprecated
  5270. */
  5271. dragConfig: Object,
  5272. // 行拖拽排序配置项
  5273. rowDragConfig: Object,
  5274. // 列拖拽排序配置项
  5275. columnDragConfig: Object,
  5276. // 列调整配置项
  5277. resizableConfig: Object,
  5278. // 序号配置项
  5279. seqConfig: Object,
  5280. // 排序配置项
  5281. sortConfig: Object,
  5282. // 筛选配置项
  5283. filterConfig: Object,
  5284. // 浮动筛选配置项
  5285. floatingFilterConfig: Object,
  5286. // 单选框配置
  5287. radioConfig: Object,
  5288. // 复选框配置项
  5289. checkboxConfig: Object,
  5290. // tooltip 配置项
  5291. tooltipConfig: Object,
  5292. // 表头 tooltip 配置项
  5293. headerTooltipConfig: Object,
  5294. // 表尾 tooltip 配置项
  5295. footerTooltipConfig: Object,
  5296. // 导出配置项
  5297. exportConfig: [Boolean, Object],
  5298. // 导入配置项
  5299. importConfig: [Boolean, Object],
  5300. // 打印配置项
  5301. printConfig: Object,
  5302. // 展开行配置项
  5303. expandConfig: Object,
  5304. // 树形结构配置项
  5305. treeConfig: [Boolean, Object],
  5306. // 快捷菜单配置项
  5307. menuConfig: [Boolean, Object],
  5308. /**
  5309. * 在 v4 中废弃 contextMenu
  5310. * @deprecated
  5311. */
  5312. contextMenu: [Boolean, Object],
  5313. // 鼠标配置项
  5314. mouseConfig: Object,
  5315. // 区域配置项
  5316. areaConfig: Object,
  5317. // 按键配置项
  5318. keyboardConfig: Object,
  5319. // 复制/粘贴配置项
  5320. clipConfig: Object,
  5321. // 查找/替换配置项
  5322. fnrConfig: Object,
  5323. // 编辑配置项
  5324. editConfig: [Boolean, Object],
  5325. // 校验配置项
  5326. validConfig: Object,
  5327. // 校验规则配置项
  5328. editRules: Object,
  5329. // 加载中配置项
  5330. loadingConfig: Object,
  5331. // 空内容渲染配置项
  5332. emptyRender: [Boolean, Object],
  5333. // 自定义列配置项
  5334. customConfig: Object,
  5335. /**
  5336. * (即将废弃)横向虚拟滚动配置项
  5337. * @deprecated
  5338. */
  5339. scrollX: Object,
  5340. /**
  5341. * (即将废弃)纵向虚拟滚动配置项
  5342. * @deprecated
  5343. */
  5344. scrollY: Object,
  5345. // 横向虚拟滚动配置项
  5346. virtualXConfig: Object,
  5347. // 纵向虚拟滚动配置项
  5348. virtualYConfig: Object,
  5349. // 滚动条配置项
  5350. scrollbarConfig: Object,
  5351. // (即将废弃)优化相关
  5352. animat: {
  5353. type: Boolean,
  5354. default: () => props_getConfig().table.animat
  5355. },
  5356. // (可能会被废弃的参数,不要使用)
  5357. delayHover: {
  5358. type: Number,
  5359. default: () => props_getConfig().table.delayHover
  5360. },
  5361. // 额外的参数
  5362. params: Object
  5363. };
  5364. ;// CONCATENATED MODULE: ./packages/table/src/anime.ts
  5365. const rowMoveCls = 'row--drag-move';
  5366. const colMoveClass = 'col--drag-move';
  5367. /**
  5368. * 上下拖拽
  5369. */
  5370. function moveRowAnimateToTb(elemList, offsetTop) {
  5371. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayEach(elemList, trEl => {
  5372. trEl.style.transform = `translateY(${offsetTop}px)`;
  5373. });
  5374. requestAnimationFrame(() => {
  5375. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayEach(elemList, trEl => {
  5376. addClass(trEl, rowMoveCls);
  5377. trEl.style.transform = '';
  5378. });
  5379. });
  5380. }
  5381. function clearRowAnimate(elem, clss) {
  5382. setTimeout(() => {
  5383. if (elem) {
  5384. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayEach(elem.querySelectorAll(clss.map(cls => `${cls}.${rowMoveCls}`).join(',')), elem => removeClass(elem, rowMoveCls));
  5385. }
  5386. }, 500);
  5387. }
  5388. /**
  5389. * 左右拖拽
  5390. */
  5391. function moveColAnimateToLr(elemList, offsetLeft) {
  5392. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayEach(elemList, trEl => {
  5393. trEl.style.transform = `translateX(${offsetLeft}px)`;
  5394. });
  5395. requestAnimationFrame(() => {
  5396. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayEach(elemList, trEl => {
  5397. addClass(trEl, colMoveClass);
  5398. trEl.style.transform = '';
  5399. });
  5400. });
  5401. }
  5402. function clearColAnimate(elem, clss) {
  5403. setTimeout(() => {
  5404. if (elem) {
  5405. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayEach(elem.querySelectorAll(clss.map(cls => `${cls}.${rowMoveCls}`).join(',')), elem => removeClass(elem, colMoveClass));
  5406. }
  5407. }, 500);
  5408. }
  5409. ;// CONCATENATED MODULE: ./packages/table/src/store.ts
  5410. // 跨表拖拽
  5411. const crossTableDragRowGlobal = {
  5412. row: null
  5413. };
  5414. function getCrossTableDragRowInfo($xeTable) {
  5415. const crossTableDragRowInfo = $xeTable.crossTableDragRowInfo;
  5416. return crossTableDragRowInfo;
  5417. }
  5418. ;// CONCATENATED MODULE: ./packages/table/src/methods.ts
  5419. const {
  5420. getConfig: methods_getConfig,
  5421. getI18n: methods_getI18n,
  5422. renderer: methods_renderer,
  5423. formats: methods_formats,
  5424. interceptor: methods_interceptor,
  5425. createEvent
  5426. } = core_.VxeUI;
  5427. const browseObj = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().browse();
  5428. const supportMaxRow = 5e6;
  5429. const customStorageKey = 'VXE_CUSTOM_STORE';
  5430. const maxYHeight = 5e6;
  5431. const maxXWidth = 5e6;
  5432. let crossTableDragRowObj = null;
  5433. function eqCellValue(row1, row2, field) {
  5434. const val1 = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row1, field);
  5435. const val2 = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row2, field);
  5436. if (eqEmptyValue(val1) && eqEmptyValue(val2)) {
  5437. return true;
  5438. }
  5439. if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(val1) || external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(val1)) {
  5440. return '' + val1 === '' + val2;
  5441. }
  5442. return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isEqual(val1, val2);
  5443. }
  5444. function hangleStorageDefaultValue(value, isAll) {
  5445. return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isBoolean(value) ? value : isAll;
  5446. }
  5447. function getNextSortOrder($xeTable, column) {
  5448. const sortOpts = $xeTable.computeSortOpts;
  5449. const {
  5450. orders = []
  5451. } = sortOpts;
  5452. const currOrder = column.order || null;
  5453. const oIndex = orders.indexOf(currOrder) + 1;
  5454. return orders[oIndex < orders.length ? oIndex : 0];
  5455. }
  5456. const getCustomStorageMap = id => {
  5457. const version = methods_getConfig().version;
  5458. const rest = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toStringJSON(localStorage.getItem(customStorageKey) || '');
  5459. const maps = rest && rest._v === version ? rest : {
  5460. _v: version
  5461. };
  5462. return (id ? maps[id] : maps) || {};
  5463. };
  5464. const setCustomStorageMap = (id, data) => {
  5465. const version = methods_getConfig().version;
  5466. const maps = getCustomStorageMap();
  5467. maps[id] = data || undefined;
  5468. maps._v = version;
  5469. localStorage.setItem(customStorageKey, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toJSONString(maps));
  5470. };
  5471. const getRecoverRowMaps = ($xeTable, keyMaps) => {
  5472. const internalData = $xeTable;
  5473. const {
  5474. fullAllDataRowIdData
  5475. } = internalData;
  5476. const restKeys = {};
  5477. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(keyMaps, (row, rowid) => {
  5478. if (fullAllDataRowIdData[rowid]) {
  5479. restKeys[rowid] = row;
  5480. }
  5481. });
  5482. return restKeys;
  5483. };
  5484. function handleReserveRow($xeTable, reserveRowMap) {
  5485. const internalData = $xeTable;
  5486. const {
  5487. fullDataRowIdData
  5488. } = internalData;
  5489. const reserveList = [];
  5490. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(reserveRowMap, (item, rowid) => {
  5491. if (fullDataRowIdData[rowid] && reserveList.indexOf(fullDataRowIdData[rowid].row) === -1) {
  5492. reserveList.push(fullDataRowIdData[rowid].row);
  5493. }
  5494. });
  5495. return reserveList;
  5496. }
  5497. function handleVirtualXVisible($xeTable) {
  5498. const reactData = $xeTable;
  5499. const internalData = $xeTable;
  5500. const {
  5501. isScrollXBig,
  5502. scrollXWidth
  5503. } = reactData;
  5504. const {
  5505. elemStore,
  5506. visibleColumn,
  5507. fullColumnIdData
  5508. } = internalData;
  5509. const leftFixedWidth = $xeTable.computeLeftFixedWidth;
  5510. const rightFixedWidth = $xeTable.computeRightFixedWidth;
  5511. const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
  5512. if (bodyScrollElem) {
  5513. const clientWidth = bodyScrollElem.clientWidth;
  5514. let scrollLeft = bodyScrollElem.scrollLeft;
  5515. if (isScrollXBig) {
  5516. scrollLeft = Math.ceil((scrollXWidth - clientWidth) * Math.min(1, scrollLeft / (maxXWidth - clientWidth)));
  5517. }
  5518. const startLeft = scrollLeft + leftFixedWidth;
  5519. const endLeft = scrollLeft + clientWidth - rightFixedWidth;
  5520. let leftIndex = 0;
  5521. let rightIndex = visibleColumn.length;
  5522. while (leftIndex < rightIndex) {
  5523. const cIndex = Math.floor((leftIndex + rightIndex) / 2);
  5524. const column = visibleColumn[cIndex];
  5525. const colid = column.id;
  5526. const colRest = fullColumnIdData[colid] || {};
  5527. if (colRest.oLeft <= startLeft) {
  5528. leftIndex = cIndex + 1;
  5529. } else {
  5530. rightIndex = cIndex;
  5531. }
  5532. }
  5533. let visibleSize = 0;
  5534. const toVisibleIndex = leftIndex === visibleColumn.length ? leftIndex : Math.max(0, leftIndex < visibleColumn.length ? leftIndex - 2 : 0);
  5535. for (let cIndex = toVisibleIndex, cLen = visibleColumn.length; cIndex < cLen; cIndex++) {
  5536. const column = visibleColumn[cIndex];
  5537. const colid = column.id;
  5538. const colRest = fullColumnIdData[colid] || {};
  5539. visibleSize++;
  5540. if (colRest.oLeft > endLeft || visibleSize >= 60) {
  5541. break;
  5542. }
  5543. }
  5544. return {
  5545. toVisibleIndex: Math.max(0, toVisibleIndex),
  5546. visibleSize: Math.max(6, visibleSize)
  5547. };
  5548. }
  5549. return {
  5550. toVisibleIndex: 0,
  5551. visibleSize: 6
  5552. };
  5553. }
  5554. function handleCustomRestore($xeTable, storeData) {
  5555. const props = $xeTable;
  5556. const reactData = $xeTable;
  5557. const internalData = $xeTable;
  5558. const {
  5559. aggregateConfig,
  5560. rowGroupConfig
  5561. } = props;
  5562. const {
  5563. collectColumn
  5564. } = internalData;
  5565. const customOpts = $xeTable.computeCustomOpts;
  5566. const {
  5567. storage,
  5568. storeOptions
  5569. } = customOpts;
  5570. const isAllCustom = storage === true;
  5571. const storageOpts = isAllCustom ? {} : Object.assign({}, storage || {}, storeOptions);
  5572. const isCustomResizable = hangleStorageDefaultValue(storageOpts.resizable, isAllCustom);
  5573. const isCustomVisible = hangleStorageDefaultValue(storageOpts.visible, isAllCustom);
  5574. const isCustomFixed = hangleStorageDefaultValue(storageOpts.fixed, isAllCustom);
  5575. const isCustomSort = hangleStorageDefaultValue(storageOpts.sort, isAllCustom);
  5576. const isCustomAggGroup = hangleStorageDefaultValue(storageOpts.aggGroup, isAllCustom);
  5577. const isCustomAggFunc = hangleStorageDefaultValue(storageOpts.aggFunc, isAllCustom);
  5578. let {
  5579. resizableData,
  5580. sortData,
  5581. visibleData,
  5582. fixedData,
  5583. aggGroupData,
  5584. aggFuncData
  5585. } = storeData;
  5586. // 处理还原
  5587. if (isCustomResizable && resizableData || isCustomSort && sortData || isCustomVisible && visibleData || isCustomFixed && fixedData || isCustomAggGroup && aggGroupData || isCustomAggFunc && aggFuncData) {
  5588. const sortColMaps = {};
  5589. if (isCustomSort && sortData) {
  5590. // 转换兼容老版本数据,即将废弃兼容
  5591. if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(sortData)) {
  5592. const sortRests = [];
  5593. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(sortData, (index, colKey) => {
  5594. sortRests.push({
  5595. key: colKey,
  5596. index
  5597. });
  5598. });
  5599. sortData = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().orderBy(sortRests, {
  5600. field: 'index',
  5601. order: 'asc'
  5602. }).map(item => ({
  5603. k: item.key
  5604. }));
  5605. }
  5606. let colNum = 1;
  5607. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(sortData, (sObj, index, sOjs, path, pSObj) => {
  5608. sortColMaps[sObj.k] = {
  5609. key: sObj.k,
  5610. sNum: colNum++,
  5611. pKey: pSObj ? pSObj.k : null
  5612. };
  5613. }, {
  5614. children: 'c'
  5615. });
  5616. }
  5617. const colKeyMaps = {};
  5618. const allCols = [];
  5619. const aggGroupConfs = [];
  5620. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(collectColumn, (column, index, items, path, parentColumn) => {
  5621. const colKey = column.getKey();
  5622. // 支持一级
  5623. if (!parentColumn) {
  5624. if (isCustomFixed && fixedData && fixedData[colKey] !== undefined) {
  5625. column.fixed = fixedData[colKey];
  5626. }
  5627. }
  5628. if (isCustomResizable && resizableData && external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(resizableData[colKey])) {
  5629. column.resizeWidth = resizableData[colKey];
  5630. }
  5631. if (isCustomVisible && visibleData && external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isBoolean(visibleData[colKey])) {
  5632. column.visible = visibleData[colKey];
  5633. }
  5634. if (isCustomAggFunc && aggFuncData && (aggregateConfig || rowGroupConfig) && aggFuncData[colKey]) {
  5635. column.aggFunc = aggFuncData[colKey];
  5636. }
  5637. if (isCustomAggGroup && aggGroupData && aggGroupData[colKey]) {
  5638. aggGroupConfs.push({
  5639. field: column.field
  5640. });
  5641. }
  5642. colKeyMaps[colKey] = column;
  5643. allCols.push(column);
  5644. });
  5645. if ((aggregateConfig || rowGroupConfig) && aggGroupConfs.length) {
  5646. const groupRest = handleGroupData($xeTable, internalData.tableFullData, aggGroupConfs);
  5647. internalData.tableFullTreeData = [];
  5648. internalData.tableFullGroupData = groupRest.treeData;
  5649. reactData.isRowGroupStatus = true;
  5650. reactData.rowGroupList = aggGroupConfs;
  5651. $xeTable.cacheRowMap(false);
  5652. }
  5653. // 如果自定义了顺序
  5654. if (isCustomSort && sortData) {
  5655. allCols.forEach(column => {
  5656. const colKey = column.getKey();
  5657. const scItem = sortColMaps[colKey];
  5658. if (scItem) {
  5659. const parentColumn = scItem.pKey ? colKeyMaps[scItem.pKey] : null;
  5660. column.parentId = parentColumn ? parentColumn.id : null;
  5661. column.renderSortNumber = scItem.sNum;
  5662. }
  5663. });
  5664. const newCollectCols = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toArrayTree(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().orderBy(allCols, 'renderSortNumber'), {
  5665. key: 'id',
  5666. parentKey: 'parentId',
  5667. children: 'children'
  5668. });
  5669. internalData.collectColumn = newCollectCols;
  5670. internalData.tableFullColumn = getColumnList(newCollectCols);
  5671. }
  5672. reactData.isCustomStatus = true;
  5673. } else {
  5674. reactData.isCustomStatus = false;
  5675. }
  5676. }
  5677. /**
  5678. * 还原自定义列操作状态
  5679. */
  5680. function restoreCustomStorage($xeTable) {
  5681. const props = $xeTable;
  5682. const {
  5683. customConfig
  5684. } = props;
  5685. const tableId = $xeTable.computeTableId;
  5686. const customOpts = $xeTable.computeCustomOpts;
  5687. const {
  5688. storage,
  5689. restoreStore,
  5690. storeOptions
  5691. } = customOpts;
  5692. const isAllCustom = storage === true;
  5693. const storageOpts = isAllCustom ? {} : Object.assign({}, storage || {}, storeOptions);
  5694. const isCustomResizable = hangleStorageDefaultValue(storageOpts.resizable, isAllCustom);
  5695. const isCustomVisible = hangleStorageDefaultValue(storageOpts.visible, isAllCustom);
  5696. const isCustomFixed = hangleStorageDefaultValue(storageOpts.fixed, isAllCustom);
  5697. const isCustomSort = hangleStorageDefaultValue(storageOpts.sort, isAllCustom);
  5698. const isCustomAggFunc = hangleStorageDefaultValue(storageOpts.aggFunc, isAllCustom);
  5699. if (storage && (customConfig ? isEnableConf(customOpts) : customOpts.enabled) && (isCustomResizable || isCustomVisible || isCustomFixed || isCustomSort || isCustomAggFunc)) {
  5700. if (!tableId) {
  5701. errLog('vxe.error.reqProp', ['id']);
  5702. return;
  5703. }
  5704. const storeData = getCustomStorageMap(tableId);
  5705. if (restoreStore) {
  5706. return Promise.resolve(restoreStore({
  5707. $table: $xeTable,
  5708. id: tableId,
  5709. type: 'restore',
  5710. storeData
  5711. })).then(storeData => {
  5712. if (!storeData) {
  5713. return;
  5714. }
  5715. return handleCustomRestore($xeTable, storeData);
  5716. }).catch(e => e);
  5717. } else {
  5718. return handleCustomRestore($xeTable, storeData);
  5719. }
  5720. }
  5721. }
  5722. /**
  5723. * 更新数据列的 Map
  5724. * 牺牲数据组装的耗时,用来换取使用过程中的流畅
  5725. */
  5726. function cacheColumnMap($xeTable) {
  5727. const props = $xeTable;
  5728. const reactData = $xeTable;
  5729. const internalData = $xeTable;
  5730. const {
  5731. treeConfig,
  5732. showOverflow
  5733. } = props;
  5734. const {
  5735. tableFullColumn,
  5736. collectColumn
  5737. } = internalData;
  5738. const fullColIdData = internalData.fullColumnIdData = {};
  5739. const fullColFieldData = internalData.fullColumnFieldData = {};
  5740. const mouseOpts = $xeTable.computeMouseOpts;
  5741. const expandOpts = $xeTable.computeExpandOpts;
  5742. const columnOpts = $xeTable.computeColumnOpts;
  5743. const columnDragOpts = $xeTable.computeColumnDragOpts;
  5744. const virtualYOpts = $xeTable.computeVirtualYOpts;
  5745. const {
  5746. isCrossDrag,
  5747. isSelfToChildDrag
  5748. } = columnDragOpts;
  5749. const customOpts = $xeTable.computeCustomOpts;
  5750. const treeOpts = $xeTable.computeTreeOpts;
  5751. const {
  5752. storage
  5753. } = customOpts;
  5754. const rowOpts = $xeTable.computeRowOpts;
  5755. const isGroup = collectColumn.some(hasChildrenList);
  5756. let isAllOverflow = !!showOverflow;
  5757. let rowGroupColumn;
  5758. let expandColumn;
  5759. let treeNodeColumn;
  5760. let checkboxColumn;
  5761. let radioColumn;
  5762. let htmlColumn;
  5763. let hasFixed;
  5764. const handleFunc = (column, index, items, path, parentColumn) => {
  5765. const {
  5766. id: colid,
  5767. field,
  5768. fixed,
  5769. type,
  5770. treeNode,
  5771. rowGroupNode
  5772. } = column;
  5773. const rest = {
  5774. $index: -1,
  5775. _index: -1,
  5776. column,
  5777. colid,
  5778. index,
  5779. items,
  5780. parent: parentColumn || null,
  5781. width: 0,
  5782. oLeft: 0
  5783. };
  5784. if (field) {
  5785. if (fullColFieldData[field]) {
  5786. errLog('vxe.error.colRepet', ['field', field]);
  5787. }
  5788. fullColFieldData[field] = rest;
  5789. } else {
  5790. if (storage && !type) {
  5791. errLog('vxe.error.reqSupportProp', ['storage', `[${type ? `type=${type}` : `title=${column.getTitle()}`}]field=?`]);
  5792. }
  5793. if (columnOpts.drag && (isCrossDrag || isSelfToChildDrag)) {
  5794. errLog('vxe.error.reqSupportProp', ['column-drag-config.isCrossDrag | column-drag-config.isSelfToChildDrag', `${column.getTitle() || type || ''} -> field=?`]);
  5795. }
  5796. }
  5797. if (!hasFixed && fixed) {
  5798. hasFixed = fixed;
  5799. }
  5800. if (!htmlColumn && type === 'html') {
  5801. htmlColumn = column;
  5802. }
  5803. if (treeNode) {
  5804. if (treeNodeColumn) {
  5805. warnLog('vxe.error.colRepet', ['tree-node', treeNode]);
  5806. }
  5807. if (!treeNodeColumn) {
  5808. treeNodeColumn = column;
  5809. }
  5810. }
  5811. if (rowGroupNode) {
  5812. if (treeNodeColumn) {
  5813. warnLog('vxe.error.colRepet', ['row-group-node', rowGroupNode]);
  5814. }
  5815. if (!rowGroupColumn) {
  5816. rowGroupColumn = column;
  5817. }
  5818. }
  5819. if (type === 'expand') {
  5820. if (expandColumn) {
  5821. warnLog('vxe.error.colRepet', ['type', type]);
  5822. }
  5823. if (!expandColumn) {
  5824. expandColumn = column;
  5825. }
  5826. }
  5827. if (type === 'checkbox') {
  5828. if (checkboxColumn) {
  5829. warnLog('vxe.error.colRepet', ['type', type]);
  5830. }
  5831. if (!checkboxColumn) {
  5832. checkboxColumn = column;
  5833. }
  5834. } else if (type === 'radio') {
  5835. if (radioColumn) {
  5836. warnLog('vxe.error.colRepet', ['type', type]);
  5837. }
  5838. if (!radioColumn) {
  5839. radioColumn = column;
  5840. }
  5841. }
  5842. if (isAllOverflow && column.showOverflow === false) {
  5843. isAllOverflow = false;
  5844. }
  5845. if (fullColIdData[colid]) {
  5846. errLog('vxe.error.colRepet', ['colId', colid]);
  5847. }
  5848. fullColIdData[colid] = rest;
  5849. };
  5850. if (isGroup) {
  5851. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(collectColumn, (column, index, items, path, parentColumn, nodes) => {
  5852. column.level = nodes.length;
  5853. handleFunc(column, index, items, path, parentColumn);
  5854. });
  5855. } else {
  5856. tableFullColumn.forEach(handleFunc);
  5857. }
  5858. if (expandColumn && expandOpts.mode !== 'fixed' && virtualYOpts.enabled) {
  5859. warnLog('vxe.error.notConflictProp', ['column.type="expand', 'virtual-y-config.enabled=false']);
  5860. }
  5861. if (expandColumn && expandOpts.mode !== 'fixed' && mouseOpts.area) {
  5862. errLog('vxe.error.errConflicts', ['mouse-config.area', 'column.type=expand']);
  5863. }
  5864. if (expandColumn && expandOpts.mode !== 'inside' && treeConfig && !treeOpts.transform) {
  5865. errLog('vxe.error.notConflictProp', ['tree-config.transform=false', 'expand-config.mode=fixed']);
  5866. }
  5867. if (htmlColumn) {
  5868. if (!columnOpts.useKey) {
  5869. errLog('vxe.error.notSupportProp', ['column.type=html', 'column-config.useKey=false', 'column-config.useKey=true']);
  5870. }
  5871. if (!rowOpts.useKey) {
  5872. errLog('vxe.error.notSupportProp', ['column.type=html', 'row-config.useKey=false', 'row-config.useKey=true']);
  5873. }
  5874. }
  5875. reactData.isGroup = isGroup;
  5876. reactData.rowGroupColumn = rowGroupColumn;
  5877. reactData.treeNodeColumn = treeNodeColumn;
  5878. reactData.expandColumn = expandColumn;
  5879. reactData.checkboxColumn = checkboxColumn;
  5880. reactData.radioColumn = radioColumn;
  5881. reactData.isAllOverflow = isAllOverflow;
  5882. }
  5883. function updateScrollXStatus($xeTable, fullColumn) {
  5884. const reactData = $xeTable;
  5885. const internalData = $xeTable;
  5886. const virtualXOpts = $xeTable.computeVirtualXOpts;
  5887. const allCols = fullColumn || internalData.tableFullColumn;
  5888. // 如果gt为0,则总是启用
  5889. const scrollXLoad = !!virtualXOpts.enabled && virtualXOpts.gt > -1 && (virtualXOpts.gt === 0 || virtualXOpts.gt < allCols.length);
  5890. reactData.scrollXLoad = scrollXLoad;
  5891. return scrollXLoad;
  5892. }
  5893. function updateScrollYStatus($xeTable, fullData) {
  5894. const props = $xeTable;
  5895. const reactData = $xeTable;
  5896. const internalData = $xeTable;
  5897. const {
  5898. treeConfig
  5899. } = props;
  5900. const $xeGanttView = internalData.xeGanttView;
  5901. const virtualYOpts = $xeTable.computeVirtualYOpts;
  5902. const treeOpts = $xeTable.computeTreeOpts;
  5903. const {
  5904. transform
  5905. } = treeOpts;
  5906. const allList = fullData || internalData.tableFullData;
  5907. // 如果gt为0,则总是启用
  5908. const scrollYLoad = (transform || !treeConfig) && !!virtualYOpts.enabled && virtualYOpts.gt > -1 && (virtualYOpts.gt === 0 || virtualYOpts.gt < allList.length);
  5909. reactData.scrollYLoad = scrollYLoad;
  5910. if ($xeGanttView && $xeGanttView.handleUpdateSYStatus) {
  5911. $xeGanttView.handleUpdateSYStatus(scrollYLoad);
  5912. }
  5913. return scrollYLoad;
  5914. }
  5915. /**
  5916. * 展开与收起树节点
  5917. * @param rows
  5918. * @param expanded
  5919. * @returns
  5920. */
  5921. function handleBaseTreeExpand($xeTable, rows, expanded) {
  5922. const reactData = $xeTable;
  5923. const internalData = $xeTable;
  5924. const {
  5925. treeNodeColumn
  5926. } = reactData;
  5927. const {
  5928. fullAllDataRowIdData,
  5929. tableFullTreeData,
  5930. treeExpandedMaps,
  5931. treeExpandLazyLoadedMaps
  5932. } = internalData;
  5933. const treeOpts = $xeTable.computeTreeOpts;
  5934. const {
  5935. reserve,
  5936. lazy,
  5937. accordion,
  5938. toggleMethod
  5939. } = treeOpts;
  5940. const childrenField = treeOpts.children || treeOpts.childrenField;
  5941. const hasChildField = treeOpts.hasChild || treeOpts.hasChildField;
  5942. const result = [];
  5943. const columnIndex = $xeTable.getColumnIndex(treeNodeColumn);
  5944. const $columnIndex = $xeTable.getVMColumnIndex(treeNodeColumn);
  5945. const {
  5946. handleGetRowId
  5947. } = createHandleGetRowId($xeTable);
  5948. let validRows = toggleMethod ? rows.filter(row => toggleMethod({
  5949. $table: $xeTable,
  5950. expanded,
  5951. column: treeNodeColumn,
  5952. columnIndex,
  5953. $columnIndex,
  5954. row
  5955. })) : rows;
  5956. if (accordion) {
  5957. validRows = validRows.length ? [validRows[validRows.length - 1]] : [];
  5958. // 同一级只能展开一个
  5959. const matchObj = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findTree(tableFullTreeData, item => item === validRows[0], {
  5960. children: childrenField
  5961. });
  5962. if (matchObj) {
  5963. matchObj.items.forEach(item => {
  5964. const rowid = handleGetRowId(item);
  5965. if (treeExpandedMaps[rowid]) {
  5966. delete treeExpandedMaps[rowid];
  5967. }
  5968. });
  5969. }
  5970. }
  5971. if (expanded) {
  5972. validRows.forEach(row => {
  5973. const rowid = handleGetRowId(row);
  5974. if (!treeExpandedMaps[rowid]) {
  5975. const rowRest = fullAllDataRowIdData[rowid];
  5976. if (rowRest) {
  5977. const isLoad = lazy && row[hasChildField] && !rowRest.treeLoaded && !treeExpandLazyLoadedMaps[rowid];
  5978. // 是否使用懒加载
  5979. if (isLoad) {
  5980. result.push(handleAsyncTreeExpandChilds($xeTable, row));
  5981. } else {
  5982. if (row[childrenField] && row[childrenField].length) {
  5983. treeExpandedMaps[rowid] = row;
  5984. }
  5985. }
  5986. }
  5987. }
  5988. });
  5989. } else {
  5990. validRows.forEach(item => {
  5991. const rowid = handleGetRowId(item);
  5992. if (treeExpandedMaps[rowid]) {
  5993. delete treeExpandedMaps[rowid];
  5994. }
  5995. });
  5996. }
  5997. if (reserve) {
  5998. validRows.forEach(row => handleTreeExpandReserve($xeTable, row, expanded));
  5999. }
  6000. reactData.treeExpandedFlag++;
  6001. return Promise.all(result).then(() => {
  6002. return $xeTable.recalculate();
  6003. });
  6004. }
  6005. /**
  6006. * 虚拟树的展开与收起
  6007. * @param rows
  6008. * @param expanded
  6009. * @returns
  6010. */
  6011. function handleVirtualTreeExpand($xeTable, rows, expanded) {
  6012. const reactData = $xeTable;
  6013. return handleBaseTreeExpand($xeTable, rows, expanded).then(() => {
  6014. handleVirtualTreeToList($xeTable);
  6015. $xeTable.handleTableData();
  6016. reactData.treeExpandedFlag++;
  6017. updateAfterDataIndex($xeTable);
  6018. return $xeTable.$nextTick();
  6019. }).then(() => {
  6020. updateTreeLineStyle($xeTable);
  6021. return handleLazyRecalculate($xeTable, true, true, true);
  6022. }).then(() => {
  6023. updateTreeLineStyle($xeTable);
  6024. setTimeout(() => {
  6025. $xeTable.updateCellAreas();
  6026. }, 30);
  6027. });
  6028. }
  6029. /**
  6030. * 展开与收起行分组节点
  6031. * @param rows
  6032. * @param expanded
  6033. * @returns
  6034. */
  6035. function handleRowGroupBaseExpand($xeTable, rows, expanded) {
  6036. const reactData = $xeTable;
  6037. const internalData = $xeTable;
  6038. const {
  6039. fullAllDataRowIdData,
  6040. tableFullGroupData,
  6041. rowGroupExpandedMaps
  6042. } = internalData;
  6043. const aggregateOpts = $xeTable.computeAggregateOpts;
  6044. const {
  6045. mapChildrenField,
  6046. accordion
  6047. } = aggregateOpts;
  6048. const {
  6049. handleGetRowId
  6050. } = createHandleGetRowId($xeTable);
  6051. let validRows = rows;
  6052. if (mapChildrenField) {
  6053. if (accordion) {
  6054. validRows = validRows.length ? [validRows[validRows.length - 1]] : [];
  6055. // 同一级只能展开一个
  6056. const matchObj = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findTree(tableFullGroupData, item => getRowid($xeTable, item) === getRowid($xeTable, validRows[0]), {
  6057. children: mapChildrenField
  6058. });
  6059. if (matchObj) {
  6060. matchObj.items.forEach(item => {
  6061. const rowid = handleGetRowId(item);
  6062. if (rowGroupExpandedMaps[rowid]) {
  6063. delete rowGroupExpandedMaps[rowid];
  6064. }
  6065. });
  6066. }
  6067. }
  6068. if (expanded) {
  6069. validRows.forEach(row => {
  6070. const rowid = handleGetRowId(row);
  6071. if (!rowGroupExpandedMaps[rowid]) {
  6072. const rowRest = fullAllDataRowIdData[rowid];
  6073. if (rowRest) {
  6074. if (row[mapChildrenField] && row[mapChildrenField].length) {
  6075. rowGroupExpandedMaps[rowid] = row;
  6076. }
  6077. }
  6078. }
  6079. });
  6080. } else {
  6081. validRows.forEach(item => {
  6082. const rowid = handleGetRowId(item);
  6083. if (rowGroupExpandedMaps[rowid]) {
  6084. delete rowGroupExpandedMaps[rowid];
  6085. }
  6086. });
  6087. }
  6088. }
  6089. reactData.rowGroupExpandedFlag++;
  6090. return $xeTable.recalculate();
  6091. }
  6092. /**
  6093. * 行分组的展开与收起
  6094. * @param rows
  6095. * @param expanded
  6096. * @returns
  6097. */
  6098. function handleRowGroupVirtualExpand($xeTable, rows, expanded) {
  6099. const reactData = $xeTable;
  6100. return handleRowGroupBaseExpand($xeTable, rows, expanded).then(() => {
  6101. handleVirtualTreeToList($xeTable);
  6102. $xeTable.handleTableData();
  6103. reactData.rowGroupExpandedFlag++;
  6104. updateAfterDataIndex($xeTable);
  6105. return $xeTable.$nextTick();
  6106. }).then(() => {
  6107. return handleLazyRecalculate($xeTable, true, true, true);
  6108. }).then(() => {
  6109. setTimeout(() => {
  6110. $xeTable.updateCellAreas();
  6111. }, 30);
  6112. });
  6113. }
  6114. /**
  6115. * 处理默认展开分组行
  6116. */
  6117. function handleDefaultRowGroupExpand($xeTable) {
  6118. const reactData = $xeTable;
  6119. const {
  6120. isRowGroupStatus
  6121. } = reactData;
  6122. if (isRowGroupStatus) {
  6123. const aggregateOpts = $xeTable.computeAggregateOpts;
  6124. const {
  6125. expandAll,
  6126. expandGroupFields
  6127. } = aggregateOpts;
  6128. if (expandAll) {
  6129. $xeTable.setAllRowGroupExpand(true);
  6130. } else if (expandGroupFields && expandGroupFields.length) {
  6131. $xeTable.setRowGroupExpandByField(expandGroupFields, true);
  6132. }
  6133. }
  6134. }
  6135. function updateAfterListIndex($xeTable) {
  6136. const props = $xeTable;
  6137. const internalData = $xeTable;
  6138. const {
  6139. treeConfig
  6140. } = props;
  6141. const {
  6142. afterFullData,
  6143. fullDataRowIdData,
  6144. fullAllDataRowIdData
  6145. } = internalData;
  6146. const {
  6147. handleGetRowId
  6148. } = createHandleGetRowId($xeTable);
  6149. const fullMaps = {};
  6150. afterFullData.forEach((row, index) => {
  6151. const rowid = handleGetRowId(row);
  6152. const rowRest = fullAllDataRowIdData[rowid];
  6153. const seq = index + 1;
  6154. if (rowRest) {
  6155. if (!treeConfig) {
  6156. rowRest.seq = seq;
  6157. }
  6158. rowRest._index = index;
  6159. } else {
  6160. const rest = {
  6161. row,
  6162. rowid,
  6163. seq,
  6164. index: -1,
  6165. $index: -1,
  6166. _index: index,
  6167. treeIndex: -1,
  6168. _tIndex: -1,
  6169. items: [],
  6170. parent: null,
  6171. level: 0,
  6172. height: 0,
  6173. resizeHeight: 0,
  6174. oTop: 0,
  6175. expandHeight: 0
  6176. };
  6177. fullAllDataRowIdData[rowid] = rest;
  6178. fullDataRowIdData[rowid] = rest;
  6179. }
  6180. fullMaps[rowid] = row;
  6181. });
  6182. internalData.afterFullRowMaps = fullMaps;
  6183. }
  6184. /**
  6185. * 预编译
  6186. * 对渲染中的数据提前解析序号及索引。牺牲提前编译耗时换取渲染中额外损耗,使运行时更加流畅
  6187. */
  6188. function updateAfterDataIndex($xeTable) {
  6189. const props = $xeTable;
  6190. const internalData = $xeTable;
  6191. const {
  6192. treeConfig
  6193. } = props;
  6194. const {
  6195. fullDataRowIdData,
  6196. fullAllDataRowIdData,
  6197. afterFullData,
  6198. afterTreeFullData
  6199. } = internalData;
  6200. const treeOpts = $xeTable.computeTreeOpts;
  6201. const {
  6202. transform
  6203. } = treeOpts;
  6204. const childrenField = treeOpts.children || treeOpts.childrenField;
  6205. const fullMaps = {};
  6206. if (treeConfig) {
  6207. let _treeIndex = 0;
  6208. const {
  6209. handleGetRowId
  6210. } = createHandleGetRowId($xeTable);
  6211. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(afterTreeFullData, (row, index, items, path) => {
  6212. const rowid = handleGetRowId(row);
  6213. const rowRest = fullAllDataRowIdData[rowid];
  6214. const seq = path.map((num, i) => i % 2 === 0 ? Number(num) + 1 : '.').join('');
  6215. if (rowRest) {
  6216. rowRest.seq = seq;
  6217. rowRest.treeIndex = index;
  6218. rowRest._tIndex = _treeIndex;
  6219. } else {
  6220. const rest = {
  6221. row,
  6222. rowid,
  6223. seq,
  6224. index: -1,
  6225. $index: -1,
  6226. _index: -1,
  6227. treeIndex: -1,
  6228. _tIndex: _treeIndex,
  6229. items: [],
  6230. parent: null,
  6231. level: 0,
  6232. height: 0,
  6233. resizeHeight: 0,
  6234. oTop: 0,
  6235. expandHeight: 0
  6236. };
  6237. fullAllDataRowIdData[rowid] = rest;
  6238. fullDataRowIdData[rowid] = rest;
  6239. }
  6240. _treeIndex++;
  6241. fullMaps[rowid] = row;
  6242. }, {
  6243. children: transform ? treeOpts.mapChildrenField : childrenField
  6244. });
  6245. if (transform) {
  6246. afterFullData.forEach((row, index) => {
  6247. const rowid = handleGetRowId(row);
  6248. const rowRest = fullAllDataRowIdData[rowid];
  6249. const seq = index + 1;
  6250. if (rowRest) {
  6251. if (!treeConfig) {
  6252. rowRest.seq = seq;
  6253. }
  6254. rowRest._index = index;
  6255. }
  6256. });
  6257. }
  6258. internalData.afterFullRowMaps = fullMaps;
  6259. } else {
  6260. updateAfterListIndex($xeTable);
  6261. }
  6262. }
  6263. /**
  6264. * 如果为虚拟树、行分组、则将树结构拍平
  6265. * @returns
  6266. */
  6267. function handleVirtualTreeToList($xeTable) {
  6268. const props = $xeTable;
  6269. const reactData = $xeTable;
  6270. const internalData = $xeTable;
  6271. const {
  6272. treeConfig
  6273. } = props;
  6274. const {
  6275. isRowGroupStatus
  6276. } = reactData;
  6277. const {
  6278. fullAllDataRowIdData,
  6279. treeExpandedMaps,
  6280. rowGroupExpandedMaps
  6281. } = internalData;
  6282. const aggregateOpts = $xeTable.computeAggregateOpts;
  6283. const treeOpts = $xeTable.computeTreeOpts;
  6284. const {
  6285. handleGetRowId
  6286. } = createHandleGetRowId($xeTable);
  6287. const fullData = [];
  6288. const expandMaps = {};
  6289. if (treeConfig && treeOpts.transform) {
  6290. const childrenField = treeOpts.children || treeOpts.childrenField;
  6291. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(internalData.afterTreeFullData, (row, index, items, path, parentRow) => {
  6292. const rowid = handleGetRowId(row);
  6293. const parentRowid = handleGetRowId(parentRow);
  6294. if (!parentRow || expandMaps[parentRowid] && treeExpandedMaps[parentRowid]) {
  6295. const rowRest = fullAllDataRowIdData[rowid];
  6296. if (rowRest) {
  6297. rowRest._index = fullData.length;
  6298. }
  6299. expandMaps[rowid] = 1;
  6300. fullData.push(row);
  6301. }
  6302. }, {
  6303. children: childrenField
  6304. });
  6305. internalData.afterFullData = fullData;
  6306. updateScrollYStatus($xeTable, fullData);
  6307. return fullData;
  6308. } else if (isRowGroupStatus) {
  6309. const {
  6310. childrenField
  6311. } = aggregateOpts;
  6312. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(internalData.afterGroupFullData, (row, index, items, path, parentRow) => {
  6313. const rowid = handleGetRowId(row);
  6314. const parentRowid = handleGetRowId(parentRow);
  6315. if (!parentRow || expandMaps[parentRowid] && rowGroupExpandedMaps[parentRowid]) {
  6316. const rowRest = fullAllDataRowIdData[rowid];
  6317. if (rowRest) {
  6318. rowRest._index = fullData.length;
  6319. }
  6320. expandMaps[rowid] = 1;
  6321. fullData.push(row);
  6322. }
  6323. }, {
  6324. children: childrenField
  6325. });
  6326. internalData.afterFullData = fullData;
  6327. updateScrollYStatus($xeTable, fullData);
  6328. return fullData;
  6329. }
  6330. return internalData.afterFullData;
  6331. }
  6332. /**
  6333. * 编译处理后全量的表格数据
  6334. * 如果存在筛选条件,继续处理
  6335. */
  6336. function updateAfterFullData($xeTable) {
  6337. const props = $xeTable;
  6338. const reactData = $xeTable;
  6339. const internalData = $xeTable;
  6340. const {
  6341. treeConfig
  6342. } = props;
  6343. const {
  6344. isRowGroupStatus
  6345. } = reactData;
  6346. const {
  6347. tableFullColumn,
  6348. tableFullData,
  6349. tableFullTreeData,
  6350. tableFullGroupData
  6351. } = internalData;
  6352. const filterOpts = $xeTable.computeFilterOpts;
  6353. const sortOpts = $xeTable.computeSortOpts;
  6354. const aggregateOpts = $xeTable.computeAggregateOpts;
  6355. const treeOpts = $xeTable.computeTreeOpts;
  6356. const childrenField = treeOpts.children || treeOpts.childrenField;
  6357. const {
  6358. transform,
  6359. rowField,
  6360. parentField,
  6361. mapChildrenField
  6362. } = treeOpts;
  6363. const {
  6364. isEvery,
  6365. remote: allRemoteFilter,
  6366. filterMethod: allFilterMethod
  6367. } = filterOpts;
  6368. const {
  6369. remote: allRemoteSort,
  6370. sortMethod: allSortMethod,
  6371. multiple: sortMultiple,
  6372. chronological
  6373. } = sortOpts;
  6374. let tableData = [];
  6375. let tableTree = [];
  6376. // 处理数据
  6377. if (!allRemoteFilter || !allRemoteSort) {
  6378. const filterColumns = [];
  6379. let orderColumns = [];
  6380. tableFullColumn.forEach(column => {
  6381. const {
  6382. field,
  6383. sortable,
  6384. order,
  6385. filters
  6386. } = column;
  6387. if (!allRemoteFilter && filters && filters.length) {
  6388. const valueList = [];
  6389. const itemList = [];
  6390. filters.forEach(item => {
  6391. if (item.checked) {
  6392. itemList.push(item);
  6393. valueList.push(item.value);
  6394. }
  6395. });
  6396. if (itemList.length) {
  6397. filterColumns.push({
  6398. column,
  6399. valueList,
  6400. itemList
  6401. });
  6402. }
  6403. }
  6404. if (!allRemoteSort && sortable && order) {
  6405. orderColumns.push({
  6406. column,
  6407. field,
  6408. property: field,
  6409. order: order,
  6410. sortTime: column.sortTime
  6411. });
  6412. }
  6413. });
  6414. if (sortMultiple && chronological && orderColumns.length > 1) {
  6415. orderColumns = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().orderBy(orderColumns, 'sortTime');
  6416. }
  6417. // 处理筛选
  6418. // 支持单列、多列、组合筛选
  6419. if (!allRemoteFilter && filterColumns.length) {
  6420. const handleFilter = row => {
  6421. return filterColumns.every(({
  6422. column,
  6423. valueList,
  6424. itemList
  6425. }) => {
  6426. const {
  6427. filterMethod,
  6428. filterRender
  6429. } = column;
  6430. const compConf = isEnableConf(filterRender) ? methods_renderer.get(filterRender.name) : null;
  6431. const compFilterMethod = compConf ? compConf.tableFilterMethod || compConf.filterMethod : null;
  6432. const tdFilterMethod = compConf ? compConf.tableFilterDefaultMethod || compConf.defaultTableFilterMethod || compConf.defaultFilterMethod : null;
  6433. const cellValue = getCellValue(row, column);
  6434. if (filterMethod) {
  6435. return itemList.some(item => filterMethod({
  6436. value: item.value,
  6437. option: item,
  6438. cellValue,
  6439. row,
  6440. column,
  6441. $table: $xeTable
  6442. }));
  6443. } else if (compFilterMethod) {
  6444. return itemList.some(item => compFilterMethod({
  6445. value: item.value,
  6446. option: item,
  6447. cellValue,
  6448. row,
  6449. column,
  6450. $table: $xeTable
  6451. }));
  6452. } else if (allFilterMethod) {
  6453. return allFilterMethod({
  6454. $table: $xeTable,
  6455. options: itemList,
  6456. values: valueList,
  6457. cellValue,
  6458. row,
  6459. column
  6460. });
  6461. } else if (tdFilterMethod) {
  6462. return itemList.some(item => tdFilterMethod({
  6463. value: item.value,
  6464. option: item,
  6465. cellValue,
  6466. row,
  6467. column,
  6468. $table: $xeTable
  6469. }));
  6470. }
  6471. return valueList.indexOf(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, column.field)) > -1;
  6472. });
  6473. };
  6474. if (isRowGroupStatus) {
  6475. // 行分组
  6476. tableTree = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().searchTree(tableFullGroupData, handleFilter, {
  6477. original: true,
  6478. isEvery: true,
  6479. children: aggregateOpts.mapChildrenField,
  6480. mapChildren: aggregateOpts.childrenField
  6481. });
  6482. tableData = tableTree;
  6483. } else if (treeConfig && transform) {
  6484. // 筛选虚拟树
  6485. tableTree = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().searchTree(tableFullTreeData, handleFilter, {
  6486. original: true,
  6487. isEvery,
  6488. children: mapChildrenField,
  6489. mapChildren: childrenField
  6490. });
  6491. tableData = tableTree;
  6492. } else {
  6493. tableData = treeConfig ? tableFullTreeData.filter(handleFilter) : tableFullData.filter(handleFilter);
  6494. tableTree = tableData;
  6495. }
  6496. } else {
  6497. if (isRowGroupStatus) {
  6498. // 还原行分组
  6499. tableTree = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().searchTree(tableFullGroupData, () => true, {
  6500. original: true,
  6501. isEvery: true,
  6502. children: aggregateOpts.mapChildrenField,
  6503. mapChildren: aggregateOpts.childrenField
  6504. });
  6505. tableData = tableTree;
  6506. } else if (treeConfig && transform) {
  6507. // 还原虚拟树
  6508. tableTree = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().searchTree(tableFullTreeData, () => true, {
  6509. original: true,
  6510. isEvery,
  6511. children: mapChildrenField,
  6512. mapChildren: childrenField
  6513. });
  6514. tableData = tableTree;
  6515. } else {
  6516. tableData = treeConfig ? tableFullTreeData.slice(0) : tableFullData.slice(0);
  6517. tableTree = tableData;
  6518. }
  6519. }
  6520. // 处理排序
  6521. // 支持单列、多列、组合排序
  6522. if (!allRemoteSort && orderColumns.length) {
  6523. if (isRowGroupStatus) {
  6524. // 行分组的排序
  6525. if (allSortMethod) {
  6526. const sortRests = allSortMethod({
  6527. data: tableTree,
  6528. sortList: orderColumns,
  6529. $table: $xeTable
  6530. });
  6531. tableTree = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(sortRests) ? sortRests : tableTree;
  6532. } else {
  6533. const treeList = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toTreeArray(tableTree, {
  6534. key: aggregateOpts.rowField,
  6535. parentKey: aggregateOpts.parentField,
  6536. children: aggregateOpts.mapChildrenField
  6537. });
  6538. tableTree = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toArrayTree(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().orderBy(treeList, orderColumns.map(({
  6539. column,
  6540. order
  6541. }) => [getOrderField($xeTable, column), order])), {
  6542. key: aggregateOpts.rowField,
  6543. parentKey: aggregateOpts.parentField,
  6544. children: aggregateOpts.childrenField,
  6545. mapChildren: aggregateOpts.mapChildrenField
  6546. });
  6547. }
  6548. tableData = tableTree;
  6549. } else if (treeConfig && transform) {
  6550. // 虚拟树的排序
  6551. if (allSortMethod) {
  6552. const sortRests = allSortMethod({
  6553. data: tableTree,
  6554. sortList: orderColumns,
  6555. $table: $xeTable
  6556. });
  6557. tableTree = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(sortRests) ? sortRests : tableTree;
  6558. } else {
  6559. const treeList = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toTreeArray(tableTree, {
  6560. children: mapChildrenField
  6561. });
  6562. tableTree = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toArrayTree(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().orderBy(treeList, orderColumns.map(({
  6563. column,
  6564. order
  6565. }) => [getOrderField($xeTable, column), order])), {
  6566. key: rowField,
  6567. parentKey: parentField,
  6568. children: childrenField,
  6569. mapChildren: mapChildrenField
  6570. });
  6571. }
  6572. tableData = tableTree;
  6573. } else {
  6574. if (allSortMethod) {
  6575. const sortRests = allSortMethod({
  6576. data: tableData,
  6577. sortList: orderColumns,
  6578. $table: $xeTable
  6579. });
  6580. tableData = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(sortRests) ? sortRests : tableData;
  6581. } else {
  6582. // 兼容 v4
  6583. if (sortMultiple) {
  6584. tableData = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().orderBy(tableData, orderColumns.map(({
  6585. column,
  6586. order
  6587. }) => [getOrderField($xeTable, column), order]));
  6588. } else {
  6589. const firstOrderColumn = orderColumns[0];
  6590. let sortByConfs;
  6591. // 已废弃,兼容 v2,在 v4 中废弃, sortBy 不能为数组
  6592. if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(firstOrderColumn.sortBy)) {
  6593. sortByConfs = firstOrderColumn.sortBy.map(item => [item, firstOrderColumn.order]);
  6594. }
  6595. tableData = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().orderBy(tableData, sortByConfs || [firstOrderColumn].map(({
  6596. column,
  6597. order
  6598. }) => [getOrderField($xeTable, column), order]));
  6599. }
  6600. tableData = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().orderBy(tableData, orderColumns.map(({
  6601. column,
  6602. order
  6603. }) => [getOrderField($xeTable, column), order]));
  6604. }
  6605. tableTree = tableData;
  6606. }
  6607. }
  6608. } else {
  6609. if (isRowGroupStatus) {
  6610. // 还原行分组
  6611. // 还原虚拟树
  6612. tableTree = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().searchTree(tableFullGroupData, () => true, {
  6613. original: true,
  6614. isEvery: true,
  6615. children: aggregateOpts.mapChildrenField,
  6616. mapChildren: aggregateOpts.childrenField
  6617. });
  6618. tableData = tableTree;
  6619. } else if (treeConfig && transform) {
  6620. // 还原虚拟树
  6621. tableTree = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().searchTree(tableFullTreeData, () => true, {
  6622. original: true,
  6623. isEvery,
  6624. children: mapChildrenField,
  6625. mapChildren: childrenField
  6626. });
  6627. tableData = tableTree;
  6628. } else {
  6629. tableData = treeConfig ? tableFullTreeData.slice(0) : tableFullData.slice(0);
  6630. tableTree = tableData;
  6631. }
  6632. }
  6633. internalData.afterFullData = tableData;
  6634. internalData.afterTreeFullData = tableTree;
  6635. internalData.afterGroupFullData = tableTree;
  6636. updateAfterDataIndex($xeTable);
  6637. }
  6638. function updateStyle($xeTable) {
  6639. const props = $xeTable;
  6640. const reactData = $xeTable;
  6641. const internalData = $xeTable;
  6642. const {
  6643. showHeaderOverflow: allColumnHeaderOverflow,
  6644. showFooterOverflow: allColumnFooterOverflow,
  6645. mouseConfig,
  6646. spanMethod,
  6647. footerSpanMethod
  6648. } = props;
  6649. const {
  6650. isGroup,
  6651. currentRow,
  6652. tableColumn,
  6653. scrollXLoad,
  6654. scrollYLoad,
  6655. overflowX,
  6656. scrollbarWidth,
  6657. overflowY,
  6658. scrollbarHeight,
  6659. scrollXWidth,
  6660. columnStore,
  6661. editStore,
  6662. isAllOverflow,
  6663. expandColumn,
  6664. isColLoading
  6665. } = reactData;
  6666. const {
  6667. visibleColumn,
  6668. tableHeight,
  6669. elemStore,
  6670. customHeight,
  6671. customMinHeight,
  6672. customMaxHeight,
  6673. tHeaderHeight,
  6674. tFooterHeight
  6675. } = internalData;
  6676. const $xeGanttView = internalData.xeGanttView;
  6677. const el = $xeTable.$refs.refElem;
  6678. if (!el || internalData.tBodyHeight && !el.clientHeight) {
  6679. return;
  6680. }
  6681. const containerList = ['main', 'left', 'right'];
  6682. let osbWidth = overflowY ? scrollbarWidth : 0;
  6683. let osbHeight = overflowX ? scrollbarHeight : 0;
  6684. const emptyPlaceholderElem = $xeTable.$refs.refEmptyPlaceholder;
  6685. const scrollbarOpts = $xeTable.computeScrollbarOpts;
  6686. const mouseOpts = $xeTable.computeMouseOpts;
  6687. const expandOpts = $xeTable.computeExpandOpts;
  6688. const bodyWrapperElem = getRefElem(elemStore['main-body-wrapper']);
  6689. const bodyTableElem = getRefElem(elemStore['main-body-table']);
  6690. if (emptyPlaceholderElem) {
  6691. emptyPlaceholderElem.style.top = `${tHeaderHeight}px`;
  6692. emptyPlaceholderElem.style.height = bodyWrapperElem ? `${bodyWrapperElem.offsetHeight - osbHeight}px` : '';
  6693. }
  6694. const scrollbarXConf = scrollbarOpts.x || {};
  6695. const scrollbarYConf = scrollbarOpts.y || {};
  6696. const scrollbarYToLeft = $xeTable.computeScrollbarYToLeft;
  6697. let xScrollbarVisible = overflowX ? 'visible' : 'hidden';
  6698. if (scrollbarXConf.visible === 'visible' || $xeGanttView) {
  6699. osbHeight = scrollbarHeight;
  6700. xScrollbarVisible = 'visible';
  6701. } else if (scrollbarXConf.visible === 'hidden' || scrollbarXConf.visible === false) {
  6702. osbHeight = 0;
  6703. xScrollbarVisible = 'hidden';
  6704. }
  6705. let yScrollbarVisible = overflowY ? 'visible' : 'hidden';
  6706. if (scrollbarYConf.visible === 'hidden' || scrollbarYConf.visible === false || $xeGanttView && !scrollbarYToLeft) {
  6707. osbWidth = 0;
  6708. yScrollbarVisible = 'hidden';
  6709. } else if (scrollbarYConf.visible === 'visible') {
  6710. osbWidth = scrollbarWidth;
  6711. yScrollbarVisible = 'visible';
  6712. }
  6713. let tbHeight = 0;
  6714. let bodyMaxHeight = 0;
  6715. const bodyMinHeight = customMinHeight - tHeaderHeight - tFooterHeight - osbHeight;
  6716. if (customMaxHeight) {
  6717. bodyMaxHeight = Math.max(bodyMinHeight, customMaxHeight - tHeaderHeight - tFooterHeight - osbHeight);
  6718. }
  6719. if (customHeight) {
  6720. tbHeight = customHeight - tHeaderHeight - tFooterHeight - osbHeight;
  6721. }
  6722. if (!tbHeight) {
  6723. if (bodyTableElem) {
  6724. tbHeight = bodyTableElem.clientHeight;
  6725. }
  6726. }
  6727. if (tbHeight) {
  6728. if (bodyMaxHeight) {
  6729. tbHeight = Math.min(bodyMaxHeight, tbHeight);
  6730. }
  6731. tbHeight = Math.max(bodyMinHeight, tbHeight);
  6732. }
  6733. const xLeftCornerEl = $xeTable.$refs.refScrollXLeftCornerElem;
  6734. const xRightCornerEl = $xeTable.$refs.refScrollXRightCornerElem;
  6735. const scrollXVirtualEl = $xeTable.$refs.refScrollXVirtualElem;
  6736. if (scrollXVirtualEl) {
  6737. scrollXVirtualEl.style.height = `${osbHeight}px`;
  6738. scrollXVirtualEl.style.visibility = xScrollbarVisible;
  6739. }
  6740. const xWrapperEl = $xeTable.$refs.refScrollXWrapperElem;
  6741. if (xWrapperEl) {
  6742. xWrapperEl.style.width = `${el.clientWidth - osbWidth}px`;
  6743. if (scrollbarYToLeft) {
  6744. xWrapperEl.style.left = `${osbWidth}px`;
  6745. } else {
  6746. xWrapperEl.style.left = '';
  6747. }
  6748. }
  6749. if (xLeftCornerEl) {
  6750. if (scrollbarYToLeft) {
  6751. xLeftCornerEl.style.width = `${osbWidth}px`;
  6752. xLeftCornerEl.style.display = overflowY && osbWidth ? 'block' : '';
  6753. } else {
  6754. xLeftCornerEl.style.display = '';
  6755. }
  6756. }
  6757. if (xRightCornerEl) {
  6758. if (scrollbarYToLeft) {
  6759. xRightCornerEl.style.display = '';
  6760. } else {
  6761. xRightCornerEl.style.width = `${osbWidth}px`;
  6762. xRightCornerEl.style.display = xScrollbarVisible === 'visible' ? 'block' : '';
  6763. }
  6764. }
  6765. const scrollYVirtualEl = $xeTable.$refs.refScrollYVirtualElem;
  6766. if (scrollYVirtualEl) {
  6767. scrollYVirtualEl.style.width = `${osbWidth}px`;
  6768. scrollYVirtualEl.style.height = `${tbHeight + tHeaderHeight + tFooterHeight}px`;
  6769. scrollYVirtualEl.style.visibility = yScrollbarVisible;
  6770. }
  6771. const yTopCornerEl = $xeTable.$refs.refScrollYTopCornerElem;
  6772. if (yTopCornerEl) {
  6773. yTopCornerEl.style.height = `${tHeaderHeight}px`;
  6774. yTopCornerEl.style.display = tHeaderHeight && yScrollbarVisible === 'visible' ? 'block' : '';
  6775. }
  6776. const yWrapperEl = $xeTable.$refs.refScrollYWrapperElem;
  6777. if (yWrapperEl) {
  6778. yWrapperEl.style.height = `${tbHeight}px`;
  6779. yWrapperEl.style.top = `${tHeaderHeight}px`;
  6780. }
  6781. const yBottomCornerEl = $xeTable.$refs.refScrollYBottomCornerElem;
  6782. if (yBottomCornerEl) {
  6783. yBottomCornerEl.style.height = `${tFooterHeight}px`;
  6784. yBottomCornerEl.style.top = `${tHeaderHeight + tbHeight}px`;
  6785. yBottomCornerEl.style.display = tFooterHeight && yScrollbarVisible === 'visible' ? 'block' : '';
  6786. }
  6787. const rowExpandEl = $xeTable.$refs.refRowExpandElem;
  6788. if (rowExpandEl) {
  6789. rowExpandEl.style.height = `${tbHeight}px`;
  6790. rowExpandEl.style.top = `${tHeaderHeight}px`;
  6791. }
  6792. internalData.tBodyHeight = tbHeight;
  6793. containerList.forEach((name, index) => {
  6794. const fixedType = index > 0 ? name : '';
  6795. const layoutList = ['header', 'body', 'footer'];
  6796. const isFixedLeft = fixedType === 'left';
  6797. let fixedColumn = [];
  6798. let fixedWrapperElem;
  6799. if (fixedType) {
  6800. fixedColumn = isFixedLeft ? columnStore.leftList : columnStore.rightList;
  6801. fixedWrapperElem = isFixedLeft ? $xeTable.$refs.refLeftContainer : $xeTable.$refs.refRightContainer;
  6802. }
  6803. layoutList.forEach(layout => {
  6804. const wrapperElem = getRefElem(elemStore[`${name}-${layout}-wrapper`]);
  6805. const currScrollElem = getRefElem(elemStore[`${name}-${layout}-scroll`]);
  6806. const tableElem = getRefElem(elemStore[`${name}-${layout}-table`]);
  6807. if (layout === 'header') {
  6808. // 表头体样式处理
  6809. // 横向滚动渲染
  6810. let renderColumnList = tableColumn;
  6811. let isOptimizeMode = false;
  6812. if (isGroup) {
  6813. renderColumnList = visibleColumn;
  6814. } else {
  6815. // 如果是使用优化模式
  6816. if (scrollXLoad && allColumnHeaderOverflow) {
  6817. if (spanMethod || footerSpanMethod) {
  6818. // 如果不支持优化模式
  6819. } else {
  6820. isOptimizeMode = true;
  6821. }
  6822. }
  6823. if (!isOptimizeMode || !isColLoading && (fixedType || !overflowX)) {
  6824. renderColumnList = visibleColumn;
  6825. }
  6826. if (fixedType) {
  6827. // 如果是使用优化模式
  6828. if (isOptimizeMode) {
  6829. renderColumnList = fixedColumn || [];
  6830. }
  6831. }
  6832. }
  6833. const tWidth = renderColumnList.reduce((previous, column) => previous + column.renderWidth, 0);
  6834. if (fixedType) {
  6835. if (isGroup) {
  6836. if (wrapperElem) {
  6837. wrapperElem.style.width = scrollXWidth ? `${scrollXWidth}px` : '';
  6838. }
  6839. } else {
  6840. if (isOptimizeMode) {
  6841. if (wrapperElem) {
  6842. wrapperElem.style.width = tWidth ? `${tWidth}px` : '';
  6843. }
  6844. } else {
  6845. if (wrapperElem) {
  6846. wrapperElem.style.width = scrollXWidth ? `${scrollXWidth}px` : '';
  6847. }
  6848. }
  6849. }
  6850. }
  6851. if (currScrollElem) {
  6852. currScrollElem.style.height = `${tHeaderHeight}px`;
  6853. }
  6854. if (tableElem) {
  6855. tableElem.style.width = tWidth ? `${tWidth}px` : '';
  6856. }
  6857. } else if (layout === 'body') {
  6858. if (currScrollElem) {
  6859. currScrollElem.style.maxHeight = customMaxHeight ? `${bodyMaxHeight}px` : '';
  6860. currScrollElem.style.height = customHeight ? `${tbHeight}px` : '';
  6861. currScrollElem.style.minHeight = `${bodyMinHeight}px`;
  6862. }
  6863. // 如果是固定列
  6864. if (fixedWrapperElem) {
  6865. if (wrapperElem) {
  6866. wrapperElem.style.top = `${tHeaderHeight}px`;
  6867. }
  6868. fixedWrapperElem.style.height = `${customHeight > 0 ? customHeight : tableHeight + tHeaderHeight + tFooterHeight + osbHeight}px`;
  6869. fixedWrapperElem.style.width = `${fixedColumn.reduce((previous, column) => previous + column.renderWidth, 0)}px`;
  6870. }
  6871. let renderColumnList = tableColumn;
  6872. let isOptimizeMode = false;
  6873. // 如果是使用优化模式
  6874. if (scrollXLoad || scrollYLoad || isAllOverflow) {
  6875. if (expandColumn && expandOpts.mode !== 'fixed' || spanMethod || footerSpanMethod) {
  6876. // 如果不支持优化模式
  6877. } else {
  6878. isOptimizeMode = true;
  6879. }
  6880. }
  6881. if (fixedType) {
  6882. renderColumnList = visibleColumn;
  6883. if (isOptimizeMode) {
  6884. renderColumnList = fixedColumn || [];
  6885. }
  6886. }
  6887. const tWidth = renderColumnList.reduce((previous, column) => previous + column.renderWidth, 0);
  6888. if (fixedType) {
  6889. if (isOptimizeMode) {
  6890. if (wrapperElem) {
  6891. wrapperElem.style.width = tWidth ? `${tWidth}px` : '';
  6892. }
  6893. } else {
  6894. if (wrapperElem) {
  6895. wrapperElem.style.width = scrollXWidth ? `${scrollXWidth}px` : '';
  6896. }
  6897. }
  6898. }
  6899. if (tableElem) {
  6900. tableElem.style.width = tWidth ? `${tWidth}px` : '';
  6901. // 兼容性处理
  6902. tableElem.style.paddingRight = osbWidth && fixedType && (browseObj.firefox || browseObj.safari) ? `${osbWidth}px` : '';
  6903. }
  6904. const emptyBlockElem = getRefElem(elemStore[`${name}-${layout}-emptyBlock`]);
  6905. if (emptyBlockElem) {
  6906. emptyBlockElem.style.width = tWidth ? `${tWidth}px` : '';
  6907. }
  6908. } else if (layout === 'footer') {
  6909. let renderColumnList = tableColumn;
  6910. let isOptimizeMode = false;
  6911. // 如果是使用优化模式
  6912. if (scrollXLoad && allColumnFooterOverflow) {
  6913. if (spanMethod || footerSpanMethod) {
  6914. // 如果不支持优化模式
  6915. } else {
  6916. isOptimizeMode = true;
  6917. }
  6918. }
  6919. if (!isOptimizeMode || !isColLoading && (fixedType || !overflowX)) {
  6920. renderColumnList = visibleColumn;
  6921. }
  6922. if (fixedType) {
  6923. if (isOptimizeMode) {
  6924. renderColumnList = fixedColumn || [];
  6925. }
  6926. }
  6927. const tWidth = renderColumnList.reduce((previous, column) => previous + column.renderWidth, 0);
  6928. if (fixedType) {
  6929. if (isOptimizeMode) {
  6930. if (wrapperElem) {
  6931. wrapperElem.style.width = tWidth ? `${tWidth}px` : '';
  6932. }
  6933. } else {
  6934. if (wrapperElem) {
  6935. wrapperElem.style.width = scrollXWidth ? `${scrollXWidth}px` : '';
  6936. }
  6937. }
  6938. }
  6939. if (currScrollElem) {
  6940. currScrollElem.style.height = `${tFooterHeight}px`;
  6941. // 如果是固定列
  6942. if (fixedWrapperElem) {
  6943. if (wrapperElem) {
  6944. wrapperElem.style.top = `${customHeight > 0 ? customHeight - tFooterHeight - osbHeight : tableHeight + tHeaderHeight}px`;
  6945. }
  6946. }
  6947. }
  6948. if (tableElem) {
  6949. tableElem.style.width = tWidth ? `${tWidth}px` : '';
  6950. }
  6951. }
  6952. });
  6953. });
  6954. if (currentRow) {
  6955. $xeTable.setCurrentRow(currentRow);
  6956. }
  6957. if (mouseConfig && mouseOpts.selected && editStore.selected.row && editStore.selected.column) {
  6958. $xeTable.addCellSelectedClass();
  6959. }
  6960. if ($xeGanttView && $xeGanttView.handleUpdateStyle) {
  6961. $xeGanttView.handleUpdateStyle();
  6962. }
  6963. return $xeTable.$nextTick();
  6964. }
  6965. function checkValidate($xeTable, type) {
  6966. if ($xeTable.triggerValidate) {
  6967. return $xeTable.triggerValidate(type);
  6968. }
  6969. return $xeTable.$nextTick();
  6970. }
  6971. /**
  6972. * 当单元格发生改变时
  6973. * 如果存在规则,则校验
  6974. */
  6975. function handleChangeCell($xeTable, evnt, params) {
  6976. checkValidate($xeTable, 'blur').catch(e => e).then(() => {
  6977. $xeTable.handleEdit(params, evnt).then(() => checkValidate($xeTable, 'change')).catch(e => e);
  6978. });
  6979. }
  6980. function handleDefaultSort($xeTable) {
  6981. const props = $xeTable;
  6982. const {
  6983. sortConfig
  6984. } = props;
  6985. if (sortConfig) {
  6986. const sortOpts = $xeTable.computeSortOpts;
  6987. let {
  6988. defaultSort
  6989. } = sortOpts;
  6990. if (defaultSort) {
  6991. if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(defaultSort)) {
  6992. defaultSort = [defaultSort];
  6993. }
  6994. if (defaultSort.length) {
  6995. (sortConfig.multiple ? defaultSort : defaultSort.slice(0, 1)).forEach((item, index) => {
  6996. const {
  6997. field,
  6998. order
  6999. } = item;
  7000. if (field && order) {
  7001. const column = $xeTable.getColumnByField(field);
  7002. if (column && column.sortable) {
  7003. column.order = order;
  7004. column.sortTime = Date.now() + index;
  7005. }
  7006. }
  7007. });
  7008. if (!sortOpts.remote) {
  7009. $xeTable.handleTableData(true).then(updateStyle);
  7010. }
  7011. }
  7012. }
  7013. }
  7014. }
  7015. /**
  7016. * 处理默认勾选
  7017. */
  7018. function handleDefaultSelectionChecked($xeTable) {
  7019. const props = $xeTable;
  7020. const internalData = $xeTable;
  7021. const {
  7022. checkboxConfig
  7023. } = props;
  7024. if (checkboxConfig) {
  7025. const {
  7026. fullDataRowIdData
  7027. } = internalData;
  7028. const checkboxOpts = $xeTable.computeCheckboxOpts;
  7029. const {
  7030. checkAll,
  7031. checkRowKeys
  7032. } = checkboxOpts;
  7033. if (checkAll) {
  7034. handleCheckedAllCheckboxRow($xeTable, true, true);
  7035. } else if (checkRowKeys) {
  7036. const defSelection = [];
  7037. checkRowKeys.forEach(rowid => {
  7038. if (fullDataRowIdData[rowid]) {
  7039. defSelection.push(fullDataRowIdData[rowid].row);
  7040. }
  7041. });
  7042. handleCheckedCheckboxRow($xeTable, defSelection, true, true);
  7043. }
  7044. }
  7045. }
  7046. /**
  7047. * 处理单选框默认勾选
  7048. */
  7049. function handleDefaultRadioChecked($xeTable) {
  7050. const props = $xeTable;
  7051. const internalData = $xeTable;
  7052. const {
  7053. radioConfig
  7054. } = props;
  7055. if (radioConfig) {
  7056. const {
  7057. fullDataRowIdData
  7058. } = internalData;
  7059. const radioOpts = $xeTable.computeRadioOpts;
  7060. const {
  7061. checkRowKey: rowid,
  7062. reserve
  7063. } = radioOpts;
  7064. if (rowid) {
  7065. if (fullDataRowIdData[rowid]) {
  7066. handleCheckedRadioRow(fullDataRowIdData[rowid].row, true);
  7067. }
  7068. if (reserve) {
  7069. const rowkey = getRowkey($xeTable);
  7070. internalData.radioReserveRow = {
  7071. [rowkey]: rowid
  7072. };
  7073. }
  7074. }
  7075. }
  7076. }
  7077. /**
  7078. * 处理默认展开行
  7079. */
  7080. function handleDefaultRowExpand($xeTable) {
  7081. const props = $xeTable;
  7082. const internalData = $xeTable;
  7083. const {
  7084. expandConfig
  7085. } = props;
  7086. if (expandConfig) {
  7087. const {
  7088. fullDataRowIdData
  7089. } = internalData;
  7090. const expandOpts = $xeTable.computeExpandOpts;
  7091. const {
  7092. expandAll,
  7093. expandRowKeys
  7094. } = expandOpts;
  7095. if (expandAll) {
  7096. $xeTable.setAllRowExpand(true);
  7097. } else if (expandRowKeys) {
  7098. const defExpandeds = [];
  7099. expandRowKeys.forEach(rowid => {
  7100. if (fullDataRowIdData[rowid]) {
  7101. defExpandeds.push(fullDataRowIdData[rowid].row);
  7102. }
  7103. });
  7104. $xeTable.setRowExpand(defExpandeds, true);
  7105. }
  7106. }
  7107. }
  7108. function handleRadioReserveRow($xeTable, row) {
  7109. const internalData = $xeTable;
  7110. const radioOpts = $xeTable.computeRadioOpts;
  7111. if (radioOpts.reserve) {
  7112. internalData.radioReserveRow = row;
  7113. }
  7114. }
  7115. function handleCheckboxReserveRow($xeTable, row, checked) {
  7116. const internalData = $xeTable;
  7117. const {
  7118. checkboxReserveRowMap
  7119. } = internalData;
  7120. const checkboxOpts = $xeTable.computeCheckboxOpts;
  7121. if (checkboxOpts.reserve) {
  7122. const rowid = getRowid($xeTable, row);
  7123. if (checked) {
  7124. checkboxReserveRowMap[rowid] = row;
  7125. } else if (checkboxReserveRowMap[rowid]) {
  7126. delete checkboxReserveRowMap[rowid];
  7127. }
  7128. }
  7129. }
  7130. function handleCheckedRadioRow($xeTable, row, isForce) {
  7131. const reactData = $xeTable;
  7132. const radioOpts = $xeTable.computeRadioOpts;
  7133. const {
  7134. checkMethod
  7135. } = radioOpts;
  7136. if (row && (isForce || !checkMethod || checkMethod({
  7137. $table: $xeTable,
  7138. row
  7139. }))) {
  7140. reactData.selectRadioRow = row;
  7141. handleRadioReserveRow($xeTable, row);
  7142. }
  7143. return $xeTable.$nextTick();
  7144. }
  7145. function handleCheckedCheckboxRow($xeTable, rows, value, isForce) {
  7146. if (rows && !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(rows)) {
  7147. rows = [rows];
  7148. }
  7149. $xeTable.handleBatchSelectRows(rows, !!value, isForce);
  7150. $xeTable.checkSelectionStatus();
  7151. return $xeTable.$nextTick();
  7152. }
  7153. function handleCheckedAllCheckboxRow($xeTable, checked, isForce) {
  7154. const props = $xeTable;
  7155. const reactData = $xeTable;
  7156. const internalData = $xeTable;
  7157. const {
  7158. treeConfig
  7159. } = props;
  7160. const {
  7161. isRowGroupStatus
  7162. } = reactData;
  7163. const {
  7164. afterFullData,
  7165. afterTreeFullData,
  7166. afterGroupFullData,
  7167. checkboxReserveRowMap,
  7168. selectCheckboxMaps
  7169. } = internalData;
  7170. const treeOpts = $xeTable.computeTreeOpts;
  7171. const aggregateOpts = $xeTable.computeAggregateOpts;
  7172. const childrenField = treeOpts.children || treeOpts.childrenField;
  7173. const checkboxOpts = $xeTable.computeCheckboxOpts;
  7174. const {
  7175. checkField,
  7176. reserve,
  7177. checkMethod
  7178. } = checkboxOpts;
  7179. const {
  7180. handleGetRowId
  7181. } = createHandleGetRowId($xeTable);
  7182. // indeterminateField 仅支持读取
  7183. const indeterminateField = checkboxOpts.indeterminateField || checkboxOpts.halfField;
  7184. const selectRowMaps = {};
  7185. /**
  7186. * 绑定属性方式(有污染)
  7187. * 必须在行数据存在对应的属性,否则将不响应
  7188. */
  7189. if (checkField) {
  7190. const checkValFn = row => {
  7191. if (isForce || !checkMethod || checkMethod({
  7192. $table: $xeTable,
  7193. row
  7194. })) {
  7195. if (checked) {
  7196. selectRowMaps[handleGetRowId(row)] = row;
  7197. }
  7198. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(row, checkField, checked);
  7199. }
  7200. if ((treeConfig || isRowGroupStatus) && indeterminateField) {
  7201. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(row, indeterminateField, false);
  7202. }
  7203. };
  7204. // 如果存在选中方法
  7205. // 如果方法成立,则更新值,否则忽略该数据
  7206. if (treeConfig || isRowGroupStatus) {
  7207. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(afterFullData, checkValFn, {
  7208. children: childrenField
  7209. });
  7210. } else {
  7211. afterFullData.forEach(checkValFn);
  7212. }
  7213. } else {
  7214. /**
  7215. * 默认方式(无污染)
  7216. * 无需任何属性,直接绑定
  7217. */
  7218. if (isRowGroupStatus) {
  7219. if (checked) {
  7220. /**
  7221. * 如果是行分组勾选
  7222. * 如果方法成立,则添加到临时集合中
  7223. */
  7224. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(afterGroupFullData, row => {
  7225. if (isForce || !checkMethod || checkMethod({
  7226. $table: $xeTable,
  7227. row
  7228. })) {
  7229. const rowid = handleGetRowId(row);
  7230. selectRowMaps[rowid] = row;
  7231. }
  7232. }, {
  7233. children: aggregateOpts.mapChildrenField
  7234. });
  7235. } else {
  7236. /**
  7237. * 如果是树取消
  7238. * 如果方法成立,则不添加到临时集合中
  7239. */
  7240. if (!isForce && checkMethod) {
  7241. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(afterGroupFullData, row => {
  7242. const rowid = handleGetRowId(row);
  7243. if (checkMethod({
  7244. $table: $xeTable,
  7245. row
  7246. }) ? false : selectCheckboxMaps[rowid]) {
  7247. selectRowMaps[rowid] = row;
  7248. }
  7249. }, {
  7250. children: aggregateOpts.mapChildrenField
  7251. });
  7252. }
  7253. }
  7254. } else if (treeConfig) {
  7255. if (checked) {
  7256. /**
  7257. * 如果是树勾选
  7258. * 如果方法成立,则添加到临时集合中
  7259. */
  7260. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(afterTreeFullData, row => {
  7261. if (isForce || !checkMethod || checkMethod({
  7262. $table: $xeTable,
  7263. row
  7264. })) {
  7265. const rowid = handleGetRowId(row);
  7266. selectRowMaps[rowid] = row;
  7267. }
  7268. }, {
  7269. children: childrenField
  7270. });
  7271. } else {
  7272. /**
  7273. * 如果是树取消
  7274. * 如果方法成立,则不添加到临时集合中
  7275. */
  7276. if (!isForce && checkMethod) {
  7277. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(afterTreeFullData, row => {
  7278. const rowid = handleGetRowId(row);
  7279. if (checkMethod({
  7280. $table: $xeTable,
  7281. row
  7282. }) ? false : selectCheckboxMaps[rowid]) {
  7283. selectRowMaps[rowid] = row;
  7284. }
  7285. }, {
  7286. children: childrenField
  7287. });
  7288. }
  7289. }
  7290. } else {
  7291. if (checked) {
  7292. /**
  7293. * 如果是行勾选
  7294. * 如果存在选中方法且成立或者本身已勾选,则添加到临时集合中
  7295. * 如果不存在选中方法,则添加所有数据到临时集合中
  7296. */
  7297. if (!isForce && checkMethod) {
  7298. afterFullData.forEach(row => {
  7299. const rowid = handleGetRowId(row);
  7300. if (selectCheckboxMaps[rowid] || checkMethod({
  7301. $table: $xeTable,
  7302. row
  7303. })) {
  7304. selectRowMaps[rowid] = row;
  7305. }
  7306. });
  7307. } else {
  7308. afterFullData.forEach(row => {
  7309. const rowid = handleGetRowId(row);
  7310. selectRowMaps[rowid] = row;
  7311. });
  7312. }
  7313. } else {
  7314. /**
  7315. * 如果是行取消
  7316. * 如果方法成立,则不添加到临时集合中;如果方法不成立则判断当前是否已勾选,如果已被勾选则添加到新集合中
  7317. * 如果不存在选中方法,无需处理,临时集合默认为空
  7318. */
  7319. if (!isForce && checkMethod) {
  7320. afterFullData.forEach(row => {
  7321. const rowid = handleGetRowId(row);
  7322. if (checkMethod({
  7323. $table: $xeTable,
  7324. row
  7325. }) ? false : selectCheckboxMaps[rowid]) {
  7326. selectRowMaps[rowid] = row;
  7327. }
  7328. });
  7329. }
  7330. }
  7331. }
  7332. }
  7333. if (reserve) {
  7334. if (checked) {
  7335. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(selectRowMaps, (row, rowid) => {
  7336. checkboxReserveRowMap[rowid] = row;
  7337. });
  7338. } else {
  7339. afterFullData.forEach(row => handleCheckboxReserveRow($xeTable, row, false));
  7340. }
  7341. }
  7342. reactData.updateCheckboxFlag++;
  7343. internalData.selectCheckboxMaps = checkField ? {} : selectRowMaps;
  7344. reactData.isAllSelected = checked;
  7345. reactData.isIndeterminate = false;
  7346. internalData.treeIndeterminateRowMaps = {};
  7347. $xeTable.checkSelectionStatus();
  7348. return $xeTable.$nextTick();
  7349. }
  7350. // 还原展开、选中等相关状态
  7351. function handleReserveStatus($xeTable) {
  7352. const props = $xeTable;
  7353. const reactData = $xeTable;
  7354. const internalData = $xeTable;
  7355. const {
  7356. treeConfig
  7357. } = props;
  7358. const {
  7359. expandColumn,
  7360. currentRow,
  7361. selectRadioRow
  7362. } = reactData;
  7363. const {
  7364. fullDataRowIdData,
  7365. fullAllDataRowIdData,
  7366. radioReserveRow,
  7367. selectCheckboxMaps,
  7368. treeExpandedMaps,
  7369. rowExpandedMaps
  7370. } = internalData;
  7371. const expandOpts = $xeTable.computeExpandOpts;
  7372. const treeOpts = $xeTable.computeTreeOpts;
  7373. const radioOpts = $xeTable.computeRadioOpts;
  7374. const checkboxOpts = $xeTable.computeCheckboxOpts;
  7375. // 单选框
  7376. if (selectRadioRow && !fullAllDataRowIdData[getRowid($xeTable, selectRadioRow)]) {
  7377. reactData.selectRadioRow = null; // 刷新单选行状态
  7378. }
  7379. // 还原保留选中状态
  7380. if (radioOpts.reserve && radioReserveRow) {
  7381. const rowid = getRowid($xeTable, radioReserveRow);
  7382. if (fullDataRowIdData[rowid]) {
  7383. handleCheckedRadioRow($xeTable, fullDataRowIdData[rowid].row, true);
  7384. }
  7385. }
  7386. // 复选框
  7387. internalData.selectCheckboxMaps = getRecoverRowMaps($xeTable, selectCheckboxMaps); // 刷新多选行状态
  7388. reactData.updateCheckboxFlag++;
  7389. // 还原保留选中状态
  7390. if (checkboxOpts.reserve) {
  7391. handleCheckedCheckboxRow($xeTable, handleReserveRow($xeTable, internalData.checkboxReserveRowMap), true, true);
  7392. }
  7393. if (currentRow && !fullAllDataRowIdData[getRowid($xeTable, currentRow)]) {
  7394. reactData.currentRow = null; // 刷新当前行状态
  7395. }
  7396. // 行展开
  7397. internalData.rowExpandedMaps = expandColumn ? getRecoverRowMaps($xeTable, rowExpandedMaps) : {}; // 刷新行展开状态
  7398. reactData.rowExpandedFlag++;
  7399. // 还原保留状态
  7400. if (expandColumn && expandOpts.reserve) {
  7401. $xeTable.setRowExpand(handleReserveRow($xeTable, internalData.rowExpandedReserveRowMap), true);
  7402. }
  7403. // 树展开
  7404. internalData.treeExpandedMaps = treeConfig ? getRecoverRowMaps($xeTable, treeExpandedMaps) : {}; // 刷新树展开状态
  7405. reactData.treeExpandedFlag++;
  7406. if (treeConfig && treeOpts.reserve) {
  7407. $xeTable.setTreeExpand(handleReserveRow($xeTable, internalData.treeExpandedReserveRowMap), true);
  7408. }
  7409. }
  7410. /**
  7411. * 处理默认展开树节点
  7412. */
  7413. const handleDefaultTreeExpand = $xeTable => {
  7414. const props = $xeTable;
  7415. const internalData = $xeTable;
  7416. const {
  7417. treeConfig
  7418. } = props;
  7419. if (treeConfig) {
  7420. const {
  7421. fullAllDataRowIdData
  7422. } = internalData;
  7423. const treeOpts = $xeTable.computeTreeOpts;
  7424. const {
  7425. expandAll,
  7426. expandRowKeys
  7427. } = treeOpts;
  7428. if (expandAll) {
  7429. $xeTable.setAllTreeExpand(true);
  7430. } else if (expandRowKeys) {
  7431. const defExpandeds = [];
  7432. expandRowKeys.forEach(rowid => {
  7433. const rowRest = fullAllDataRowIdData[rowid];
  7434. if (rowRest) {
  7435. defExpandeds.push(rowRest.row);
  7436. }
  7437. });
  7438. $xeTable.setTreeExpand(defExpandeds, true);
  7439. }
  7440. }
  7441. };
  7442. const handleAsyncTreeExpandChilds = ($xeTable, row) => {
  7443. const reactData = $xeTable;
  7444. const internalData = $xeTable;
  7445. const treeOpts = $xeTable.computeTreeOpts;
  7446. const checkboxOpts = $xeTable.computeCheckboxOpts;
  7447. const {
  7448. transform,
  7449. loadMethod
  7450. } = treeOpts;
  7451. const {
  7452. checkStrictly
  7453. } = checkboxOpts;
  7454. return new Promise(resolve => {
  7455. if (loadMethod) {
  7456. const {
  7457. fullAllDataRowIdData,
  7458. treeExpandLazyLoadedMaps
  7459. } = internalData;
  7460. const rowid = getRowid($xeTable, row);
  7461. const rowRest = fullAllDataRowIdData[rowid];
  7462. treeExpandLazyLoadedMaps[rowid] = row;
  7463. Promise.resolve(loadMethod({
  7464. $table: $xeTable,
  7465. row
  7466. })).then(childRecords => {
  7467. if (rowRest) {
  7468. rowRest.treeLoaded = true;
  7469. }
  7470. if (treeExpandLazyLoadedMaps[rowid]) {
  7471. delete treeExpandLazyLoadedMaps[rowid];
  7472. }
  7473. if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(childRecords)) {
  7474. childRecords = [];
  7475. }
  7476. if (childRecords) {
  7477. return $xeTable.loadTreeChildren(row, childRecords).then(childRows => {
  7478. const {
  7479. treeExpandedMaps
  7480. } = internalData;
  7481. if (childRows.length && !treeExpandedMaps[rowid]) {
  7482. treeExpandedMaps[rowid] = row;
  7483. }
  7484. reactData.treeExpandedFlag++;
  7485. // 如果当前节点已选中,则展开后子节点也被选中
  7486. if (!checkStrictly && $xeTable.isCheckedByCheckboxRow(row)) {
  7487. handleCheckedCheckboxRow($xeTable, childRows, true);
  7488. }
  7489. return $xeTable.$nextTick().then(() => {
  7490. if (transform) {
  7491. $xeTable.handleTableData();
  7492. updateAfterDataIndex($xeTable);
  7493. return $xeTable.$nextTick();
  7494. }
  7495. });
  7496. });
  7497. }
  7498. }).catch(() => {
  7499. const {
  7500. treeExpandLazyLoadedMaps
  7501. } = internalData;
  7502. if (rowRest) {
  7503. rowRest.treeLoaded = false;
  7504. }
  7505. if (treeExpandLazyLoadedMaps[rowid]) {
  7506. delete treeExpandLazyLoadedMaps[rowid];
  7507. }
  7508. }).finally(() => {
  7509. reactData.treeExpandedFlag++;
  7510. $xeTable.$nextTick().then(() => $xeTable.recalculate()).then(() => resolve());
  7511. });
  7512. } else {
  7513. resolve();
  7514. }
  7515. });
  7516. };
  7517. const handleTreeExpandReserve = ($xeTable, row, expanded) => {
  7518. const internalData = $xeTable;
  7519. const {
  7520. treeExpandedReserveRowMap
  7521. } = internalData;
  7522. const treeOpts = $xeTable.computeTreeOpts;
  7523. if (treeOpts.reserve) {
  7524. const rowid = getRowid($xeTable, row);
  7525. if (expanded) {
  7526. treeExpandedReserveRowMap[rowid] = row;
  7527. } else if (treeExpandedReserveRowMap[rowid]) {
  7528. delete treeExpandedReserveRowMap[rowid];
  7529. }
  7530. }
  7531. };
  7532. const handleAsyncRowExpand = ($xeTable, row) => {
  7533. const reactData = $xeTable;
  7534. const internalData = $xeTable;
  7535. return new Promise(resolve => {
  7536. const expandOpts = $xeTable.computeExpandOpts;
  7537. const {
  7538. loadMethod
  7539. } = expandOpts;
  7540. if (loadMethod) {
  7541. const {
  7542. fullAllDataRowIdData,
  7543. rowExpandLazyLoadedMaps
  7544. } = internalData;
  7545. const rowid = getRowid($xeTable, row);
  7546. const rowRest = fullAllDataRowIdData[rowid];
  7547. rowExpandLazyLoadedMaps[rowid] = row;
  7548. loadMethod({
  7549. $table: $xeTable,
  7550. row,
  7551. rowIndex: $xeTable.getRowIndex(row),
  7552. $rowIndex: $xeTable.getVMRowIndex(row)
  7553. }).then(() => {
  7554. const {
  7555. rowExpandedMaps
  7556. } = internalData;
  7557. if (rowRest) {
  7558. rowRest.expandLoaded = true;
  7559. }
  7560. rowExpandedMaps[rowid] = row;
  7561. reactData.rowExpandedFlag++;
  7562. }).catch(() => {
  7563. if (rowRest) {
  7564. rowRest.expandLoaded = false;
  7565. }
  7566. }).finally(() => {
  7567. const {
  7568. rowExpandLazyLoadedMaps
  7569. } = internalData;
  7570. if (rowExpandLazyLoadedMaps[rowid]) {
  7571. delete rowExpandLazyLoadedMaps[rowid];
  7572. }
  7573. reactData.rowExpandedFlag++;
  7574. $xeTable.$nextTick().then(() => $xeTable.recalculate()).then(() => $xeTable.updateCellAreas()).then(() => resolve());
  7575. });
  7576. } else {
  7577. resolve();
  7578. }
  7579. });
  7580. };
  7581. function calcVarRowHeightConfig($xeTable, sizeKey, sizeEl) {
  7582. const reactData = $xeTable;
  7583. const {
  7584. rowHeightStore
  7585. } = reactData;
  7586. if (sizeEl && sizeEl.clientHeight) {
  7587. rowHeightStore[sizeKey] = sizeEl.clientHeight;
  7588. }
  7589. }
  7590. function computeRowHeight($xeTable) {
  7591. const reactData = $xeTable;
  7592. const {
  7593. isAllOverflow
  7594. } = reactData;
  7595. const tableHeader = $xeTable.$refs.refTableHeader;
  7596. const tableBody = $xeTable.$refs.refTableBody;
  7597. const tableBodyElem = tableBody ? tableBody.$el : null;
  7598. const defaultRowHeight = $xeTable.computeDefaultRowHeight;
  7599. let rowHeight = 0;
  7600. if (isAllOverflow) {
  7601. if (tableBodyElem) {
  7602. const tableHeaderElem = tableHeader ? tableHeader.$el : null;
  7603. let firstTrElem;
  7604. firstTrElem = tableBodyElem.querySelector('tr');
  7605. if (!firstTrElem && tableHeaderElem) {
  7606. firstTrElem = tableHeaderElem.querySelector('tr');
  7607. }
  7608. if (firstTrElem) {
  7609. rowHeight = firstTrElem.clientHeight;
  7610. }
  7611. }
  7612. if (!rowHeight) {
  7613. rowHeight = defaultRowHeight;
  7614. }
  7615. } else {
  7616. rowHeight = defaultRowHeight;
  7617. }
  7618. // 最低支持 18px 行高
  7619. return Math.max(18, rowHeight);
  7620. }
  7621. function handleVirtualYVisible($xeTable) {
  7622. const reactData = $xeTable;
  7623. const internalData = $xeTable;
  7624. const {
  7625. isAllOverflow,
  7626. expandColumn,
  7627. isScrollYBig,
  7628. scrollYHeight
  7629. } = reactData;
  7630. const {
  7631. elemStore,
  7632. isResizeCellHeight,
  7633. afterFullData,
  7634. fullAllDataRowIdData
  7635. } = internalData;
  7636. const rowOpts = $xeTable.computeRowOpts;
  7637. const cellOpts = $xeTable.computeCellOpts;
  7638. const defaultRowHeight = $xeTable.computeDefaultRowHeight;
  7639. const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
  7640. if (bodyScrollElem) {
  7641. const clientHeight = bodyScrollElem.clientHeight;
  7642. let scrollTop = bodyScrollElem.scrollTop;
  7643. if (isScrollYBig) {
  7644. scrollTop = Math.ceil((scrollYHeight - clientHeight) * Math.min(1, scrollTop / (maxYHeight - clientHeight)));
  7645. }
  7646. const startTop = scrollTop;
  7647. const endTop = scrollTop + clientHeight;
  7648. let toVisibleIndex = -1;
  7649. let visibleSize = 0;
  7650. const isCustomCellHeight = isResizeCellHeight || cellOpts.height || rowOpts.height;
  7651. if (!isCustomCellHeight && !expandColumn && isAllOverflow) {
  7652. toVisibleIndex = Math.floor(startTop / defaultRowHeight) - 1;
  7653. visibleSize = Math.ceil(clientHeight / defaultRowHeight) + 1;
  7654. } else {
  7655. const {
  7656. handleGetRowId
  7657. } = createHandleGetRowId($xeTable);
  7658. let leftIndex = 0;
  7659. let rightIndex = afterFullData.length;
  7660. while (leftIndex < rightIndex) {
  7661. const rIndex = Math.floor((leftIndex + rightIndex) / 2);
  7662. const row = afterFullData[rIndex];
  7663. const rowid = handleGetRowId(row);
  7664. const rowRest = fullAllDataRowIdData[rowid] || {};
  7665. if (rowRest.oTop <= startTop) {
  7666. leftIndex = rIndex + 1;
  7667. } else {
  7668. rightIndex = rIndex;
  7669. }
  7670. }
  7671. toVisibleIndex = leftIndex === afterFullData.length ? leftIndex : Math.max(0, leftIndex < afterFullData.length ? leftIndex - 2 : 0);
  7672. for (let rIndex = toVisibleIndex, rLen = afterFullData.length; rIndex < rLen; rIndex++) {
  7673. const row = afterFullData[rIndex];
  7674. const rowid = handleGetRowId(row);
  7675. const rowRest = fullAllDataRowIdData[rowid] || {};
  7676. visibleSize++;
  7677. if (rowRest.oTop > endTop || visibleSize >= 100) {
  7678. break;
  7679. }
  7680. }
  7681. }
  7682. return {
  7683. toVisibleIndex: Math.max(0, toVisibleIndex),
  7684. visibleSize: Math.max(6, visibleSize)
  7685. };
  7686. }
  7687. return {
  7688. toVisibleIndex: 0,
  7689. visibleSize: 6
  7690. };
  7691. }
  7692. function calculateMergerOffsetIndex(list, offsetItem, type) {
  7693. for (let mcIndex = 0, len = list.length; mcIndex < len; mcIndex++) {
  7694. const mergeItem = list[mcIndex];
  7695. const {
  7696. startIndex,
  7697. endIndex
  7698. } = offsetItem;
  7699. const mergeStartIndex = mergeItem[type];
  7700. const mergeSpanNumber = mergeItem[type + 'span'];
  7701. const mergeEndIndex = mergeStartIndex + mergeSpanNumber;
  7702. if (mergeStartIndex < startIndex && startIndex < mergeEndIndex) {
  7703. offsetItem.startIndex = mergeStartIndex;
  7704. }
  7705. if (mergeStartIndex < endIndex && endIndex < mergeEndIndex) {
  7706. offsetItem.endIndex = mergeEndIndex;
  7707. }
  7708. if (offsetItem.startIndex !== startIndex || offsetItem.endIndex !== endIndex) {
  7709. mcIndex = -1;
  7710. }
  7711. }
  7712. }
  7713. function buildMergeData(mergeConfigs) {
  7714. const mergeMaps = {};
  7715. if (mergeConfigs && mergeConfigs.length) {
  7716. for (let mIndex = 0; mIndex < mergeConfigs.length; mIndex++) {
  7717. const {
  7718. row: _rowIndex,
  7719. col: _columnIndex,
  7720. rowspan: mergeRowspan,
  7721. colspan: mergeColspan
  7722. } = mergeConfigs[mIndex];
  7723. for (let i = 0; i < mergeRowspan; i++) {
  7724. for (let j = 0; j < mergeColspan; j++) {
  7725. mergeMaps[`${_rowIndex + i}:${_columnIndex + j}`] = !i && !j ? {
  7726. rowspan: mergeRowspan,
  7727. colspan: mergeColspan
  7728. } : {
  7729. rowspan: 0,
  7730. colspan: 0
  7731. };
  7732. }
  7733. }
  7734. }
  7735. }
  7736. return mergeMaps;
  7737. }
  7738. function handleBodyMerge($xeTable, merges) {
  7739. const internalData = $xeTable;
  7740. const {
  7741. fullAllDataRowIdData,
  7742. fullColumnIdData,
  7743. visibleColumn,
  7744. afterFullData,
  7745. mergeBodyList,
  7746. mergeBodyMaps
  7747. } = internalData;
  7748. if (merges) {
  7749. const {
  7750. handleGetRowId
  7751. } = createHandleGetRowId($xeTable);
  7752. if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(merges)) {
  7753. merges = [merges];
  7754. }
  7755. merges.forEach(item => {
  7756. let {
  7757. row,
  7758. col,
  7759. rowspan,
  7760. colspan
  7761. } = item;
  7762. let mergeRowIndex = -1;
  7763. let mergeColumnIndex = -1;
  7764. if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(row)) {
  7765. mergeRowIndex = row;
  7766. } else {
  7767. const rowid = row ? handleGetRowId(row) : null;
  7768. const rowRest = rowid ? fullAllDataRowIdData[rowid] : null;
  7769. if (rowRest) {
  7770. mergeRowIndex = rowRest._index;
  7771. }
  7772. }
  7773. if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(col)) {
  7774. mergeColumnIndex = col;
  7775. } else {
  7776. const colid = col ? col.id : null;
  7777. const colRest = colid ? fullColumnIdData[colid] : null;
  7778. if (colRest) {
  7779. mergeColumnIndex = colRest._index;
  7780. }
  7781. }
  7782. if (mergeRowIndex > -1 && mergeColumnIndex > -1 && (rowspan || colspan)) {
  7783. rowspan = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(rowspan) || 1;
  7784. colspan = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(colspan) || 1;
  7785. if (rowspan > 1 || colspan > 1) {
  7786. const row = afterFullData[mergeRowIndex];
  7787. const column = visibleColumn[mergeColumnIndex];
  7788. let mergeItem = mergeBodyMaps[`${mergeRowIndex}:${mergeColumnIndex}`];
  7789. if (mergeItem) {
  7790. mergeItem.rowspan = rowspan;
  7791. mergeItem.colspan = colspan;
  7792. mergeItem._rowspan = rowspan;
  7793. mergeItem._colspan = colspan;
  7794. } else {
  7795. mergeItem = {
  7796. row: mergeRowIndex,
  7797. col: mergeColumnIndex,
  7798. rowspan,
  7799. colspan,
  7800. _row: row,
  7801. _col: column,
  7802. _rowspan: rowspan,
  7803. _colspan: colspan
  7804. };
  7805. mergeBodyMaps[`${mergeRowIndex}:${mergeColumnIndex}`] = mergeItem;
  7806. mergeBodyList.push(mergeItem);
  7807. }
  7808. }
  7809. }
  7810. });
  7811. }
  7812. }
  7813. function removeBodyMerges($xeTable, merges) {
  7814. const internalData = $xeTable;
  7815. const {
  7816. mergeBodyList,
  7817. fullColumnIdData,
  7818. fullAllDataRowIdData,
  7819. mergeBodyMaps
  7820. } = internalData;
  7821. const rest = [];
  7822. if (merges) {
  7823. const {
  7824. handleGetRowId
  7825. } = createHandleGetRowId($xeTable);
  7826. if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(merges)) {
  7827. merges = [merges];
  7828. }
  7829. merges.forEach(item => {
  7830. const {
  7831. row: margeRow,
  7832. col: margeCol
  7833. } = item;
  7834. let mergeRowIndex = -1;
  7835. let mergeColumnIndex = -1;
  7836. if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(margeRow)) {
  7837. mergeRowIndex = margeRow;
  7838. } else {
  7839. const rowid = margeRow ? handleGetRowId(margeRow) : null;
  7840. const rowRest = rowid ? fullAllDataRowIdData[rowid] : null;
  7841. if (rowRest) {
  7842. mergeRowIndex = rowRest._index;
  7843. }
  7844. }
  7845. if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(margeCol)) {
  7846. mergeColumnIndex = margeCol;
  7847. } else {
  7848. const colid = margeCol ? margeCol.id : null;
  7849. const colRest = colid ? fullColumnIdData[colid] : null;
  7850. if (colRest) {
  7851. mergeColumnIndex = colRest._index;
  7852. }
  7853. }
  7854. const mcIndex = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findIndexOf(mergeBodyList, item => item.row === mergeRowIndex && item.col === mergeColumnIndex);
  7855. if (mcIndex > -1) {
  7856. const rItems = mergeBodyList.splice(mcIndex, 1);
  7857. const item = rItems[0];
  7858. if (item) {
  7859. rest.push(rItems[0]);
  7860. if (mergeBodyMaps[`${mergeRowIndex}:${mergeColumnIndex}`]) {
  7861. delete mergeBodyMaps[`${mergeRowIndex}:${mergeColumnIndex}`];
  7862. }
  7863. }
  7864. }
  7865. });
  7866. }
  7867. return rest;
  7868. }
  7869. function handleHeaderMerge($xeTable, merges) {
  7870. const props = $xeTable;
  7871. const reactData = $xeTable;
  7872. const internalData = $xeTable;
  7873. const {
  7874. showCustomHeader
  7875. } = props;
  7876. const {
  7877. footerTableData
  7878. } = reactData;
  7879. const {
  7880. mergeHeaderList,
  7881. mergeHeaderMaps,
  7882. fullColumnIdData
  7883. } = internalData;
  7884. if (merges) {
  7885. const {
  7886. visibleColumn
  7887. } = internalData;
  7888. if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(merges)) {
  7889. merges = [merges];
  7890. }
  7891. merges.forEach(item => {
  7892. let {
  7893. row: margeRow,
  7894. col: margeCol,
  7895. rowspan,
  7896. colspan
  7897. } = item;
  7898. const mergeRowIndex = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(margeRow) ? margeRow : -1;
  7899. let mergeColumnIndex = -1;
  7900. if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(margeCol)) {
  7901. mergeColumnIndex = margeCol;
  7902. } else {
  7903. const colid = margeCol ? margeCol.id : null;
  7904. const colRest = colid ? fullColumnIdData[colid] : null;
  7905. if (colRest) {
  7906. mergeColumnIndex = colRest._index;
  7907. }
  7908. }
  7909. if (mergeRowIndex > -1 && mergeColumnIndex > -1 && (rowspan || colspan)) {
  7910. rowspan = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(rowspan) || 1;
  7911. colspan = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(colspan) || 1;
  7912. if (!showCustomHeader && rowspan > 1) {
  7913. errLog('vxe.error.notSupportProp', ['[table] show-custom-header=false', `rowspan=${rowspan}`, 'rowspan=1']);
  7914. return;
  7915. }
  7916. if (rowspan > 1 || colspan > 1) {
  7917. const row = footerTableData[mergeRowIndex];
  7918. const column = visibleColumn[mergeColumnIndex];
  7919. let mergeItem = mergeHeaderMaps[`${mergeRowIndex}:${mergeColumnIndex}`];
  7920. if (mergeItem) {
  7921. mergeItem.rowspan = rowspan;
  7922. mergeItem.colspan = colspan;
  7923. mergeItem._rowspan = rowspan;
  7924. mergeItem._colspan = colspan;
  7925. } else {
  7926. mergeItem = {
  7927. row: mergeRowIndex,
  7928. col: mergeColumnIndex,
  7929. rowspan,
  7930. colspan,
  7931. _row: row,
  7932. _col: column,
  7933. _rowspan: rowspan,
  7934. _colspan: colspan
  7935. };
  7936. mergeHeaderMaps[`${mergeRowIndex}:${mergeColumnIndex}`] = mergeItem;
  7937. mergeHeaderList.push(mergeItem);
  7938. }
  7939. }
  7940. }
  7941. });
  7942. }
  7943. }
  7944. function removeHeaderMerges($xeTable, merges) {
  7945. const internalData = $xeTable;
  7946. const {
  7947. mergeHeaderList,
  7948. fullColumnIdData,
  7949. mergeHeaderMaps
  7950. } = internalData;
  7951. const rest = [];
  7952. if (merges) {
  7953. if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(merges)) {
  7954. merges = [merges];
  7955. }
  7956. merges.forEach(item => {
  7957. const {
  7958. row: margeRow,
  7959. col: margeCol
  7960. } = item;
  7961. const mergeRowIndex = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(margeRow) ? margeRow : -1;
  7962. let mergeColumnIndex = -1;
  7963. if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(margeCol)) {
  7964. mergeColumnIndex = margeCol;
  7965. } else {
  7966. const colid = margeCol ? margeCol.id : null;
  7967. const colRest = colid ? fullColumnIdData[colid] : null;
  7968. if (colRest) {
  7969. mergeColumnIndex = colRest._index;
  7970. }
  7971. }
  7972. const mcIndex = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findIndexOf(mergeHeaderList, item => item.row === mergeRowIndex && item.col === mergeColumnIndex);
  7973. if (mcIndex > -1) {
  7974. const rItems = mergeHeaderList.splice(mcIndex, 1);
  7975. const item = rItems[0];
  7976. if (item) {
  7977. rest.push(item);
  7978. if (mergeHeaderMaps[`${mergeRowIndex}:${mergeColumnIndex}`]) {
  7979. delete mergeHeaderMaps[`${mergeRowIndex}:${mergeColumnIndex}`];
  7980. }
  7981. }
  7982. }
  7983. });
  7984. }
  7985. return rest;
  7986. }
  7987. function handleFooterMerge($xeTable, merges) {
  7988. const reactData = $xeTable;
  7989. const internalData = $xeTable;
  7990. const {
  7991. footerTableData
  7992. } = reactData;
  7993. const {
  7994. mergeFooterList,
  7995. mergeFooterMaps,
  7996. fullColumnIdData
  7997. } = internalData;
  7998. if (merges) {
  7999. const {
  8000. visibleColumn
  8001. } = internalData;
  8002. if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(merges)) {
  8003. merges = [merges];
  8004. }
  8005. merges.forEach(item => {
  8006. let {
  8007. row: margeRow,
  8008. col: margeCol,
  8009. rowspan,
  8010. colspan
  8011. } = item;
  8012. const mergeRowIndex = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(margeRow) ? margeRow : -1;
  8013. let mergeColumnIndex = -1;
  8014. if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(margeCol)) {
  8015. mergeColumnIndex = margeCol;
  8016. } else {
  8017. const colid = margeCol ? margeCol.id : null;
  8018. const colRest = colid ? fullColumnIdData[colid] : null;
  8019. if (colRest) {
  8020. mergeColumnIndex = colRest._index;
  8021. }
  8022. }
  8023. if (mergeRowIndex > -1 && mergeColumnIndex > -1 && (rowspan || colspan)) {
  8024. rowspan = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(rowspan) || 1;
  8025. colspan = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(colspan) || 1;
  8026. if (rowspan > 1 || colspan > 1) {
  8027. const row = footerTableData[mergeRowIndex];
  8028. const column = visibleColumn[mergeColumnIndex];
  8029. let mergeItem = mergeFooterMaps[`${mergeRowIndex}:${mergeColumnIndex}`];
  8030. if (mergeItem) {
  8031. mergeItem.rowspan = rowspan;
  8032. mergeItem.colspan = colspan;
  8033. mergeItem._rowspan = rowspan;
  8034. mergeItem._colspan = colspan;
  8035. } else {
  8036. mergeItem = {
  8037. row: mergeRowIndex,
  8038. col: mergeColumnIndex,
  8039. rowspan,
  8040. colspan,
  8041. _row: row,
  8042. _col: column,
  8043. _rowspan: rowspan,
  8044. _colspan: colspan
  8045. };
  8046. mergeFooterMaps[`${mergeRowIndex}:${mergeColumnIndex}`] = mergeItem;
  8047. mergeFooterList.push(mergeItem);
  8048. }
  8049. }
  8050. }
  8051. });
  8052. }
  8053. }
  8054. function removeFooterMerges($xeTable, merges) {
  8055. const internalData = $xeTable;
  8056. const {
  8057. mergeFooterList,
  8058. fullColumnIdData,
  8059. mergeFooterMaps
  8060. } = internalData;
  8061. const rest = [];
  8062. if (merges) {
  8063. if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(merges)) {
  8064. merges = [merges];
  8065. }
  8066. merges.forEach(item => {
  8067. const {
  8068. row: margeRow,
  8069. col: margeCol
  8070. } = item;
  8071. const mergeRowIndex = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(margeRow) ? margeRow : -1;
  8072. let mergeColumnIndex = -1;
  8073. if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(margeCol)) {
  8074. mergeColumnIndex = margeCol;
  8075. } else {
  8076. const colid = margeCol ? margeCol.id : null;
  8077. const colRest = colid ? fullColumnIdData[colid] : null;
  8078. if (colRest) {
  8079. mergeColumnIndex = colRest._index;
  8080. }
  8081. }
  8082. const mcIndex = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findIndexOf(mergeFooterList, item => item.row === mergeRowIndex && item.col === mergeColumnIndex);
  8083. if (mcIndex > -1) {
  8084. const rItems = mergeFooterList.splice(mcIndex, 1);
  8085. const item = rItems[0];
  8086. if (item) {
  8087. rest.push(item);
  8088. if (mergeFooterMaps[`${mergeRowIndex}:${mergeColumnIndex}`]) {
  8089. delete mergeFooterMaps[`${mergeRowIndex}:${mergeColumnIndex}`];
  8090. }
  8091. }
  8092. }
  8093. });
  8094. }
  8095. return rest;
  8096. }
  8097. function handleSortEvent($xeTable, evnt, sortConfs, isUpdate) {
  8098. const internalData = $xeTable;
  8099. const {
  8100. tableFullColumn
  8101. } = internalData;
  8102. const sortOpts = $xeTable.computeSortOpts;
  8103. const {
  8104. multiple,
  8105. remote,
  8106. orders
  8107. } = sortOpts;
  8108. if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(sortConfs)) {
  8109. sortConfs = [sortConfs];
  8110. }
  8111. if (sortConfs && sortConfs.length) {
  8112. const orderActiveMaps = {};
  8113. if (!multiple) {
  8114. sortConfs = [sortConfs[0]];
  8115. tableFullColumn.forEach(column => {
  8116. if (column.order) {
  8117. orderActiveMaps[column.id] = column;
  8118. }
  8119. });
  8120. }
  8121. const sortColMpps = {};
  8122. let firstColumn = null;
  8123. sortConfs.forEach((confs, index) => {
  8124. let {
  8125. field,
  8126. order
  8127. } = confs;
  8128. let column = field;
  8129. if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(field)) {
  8130. column = $xeTable.getColumnByField(field);
  8131. }
  8132. if (!firstColumn) {
  8133. firstColumn = column;
  8134. }
  8135. if (column && column.sortable) {
  8136. if (orders && orders.indexOf(order) === -1) {
  8137. order = getNextSortOrder($xeTable, column);
  8138. }
  8139. if (column.order !== order) {
  8140. column.order = order;
  8141. }
  8142. column.sortTime = Date.now() + index;
  8143. sortColMpps[column.id] = column;
  8144. }
  8145. });
  8146. if (!multiple) {
  8147. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(orderActiveMaps, (oaCol, oaId) => {
  8148. if (!sortColMpps[oaId]) {
  8149. oaCol.order = null;
  8150. }
  8151. });
  8152. }
  8153. if (isUpdate) {
  8154. if (!remote) {
  8155. $xeTable.handleTableData(true);
  8156. }
  8157. }
  8158. if (evnt) {
  8159. $xeTable.handleColumnSortEvent(evnt, firstColumn);
  8160. }
  8161. return $xeTable.$nextTick().then(() => {
  8162. updateRowOffsetTop($xeTable);
  8163. $xeTable.updateCellAreas();
  8164. return updateStyle($xeTable);
  8165. });
  8166. }
  8167. return $xeTable.$nextTick();
  8168. }
  8169. function clearAllSort($xeTable) {
  8170. const internalData = $xeTable;
  8171. const {
  8172. tableFullColumn
  8173. } = internalData;
  8174. tableFullColumn.forEach(column => {
  8175. column.order = null;
  8176. });
  8177. }
  8178. function calcTableHeight($xeTable, key) {
  8179. const props = $xeTable;
  8180. const reactData = $xeTable;
  8181. const {
  8182. editConfig,
  8183. editRules
  8184. } = props;
  8185. const {
  8186. parentHeight
  8187. } = reactData;
  8188. let val = props[key];
  8189. if (key === 'minHeight') {
  8190. const defMinHeight = methods_getConfig().table.minHeight;
  8191. if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(val)) {
  8192. if (eqEmptyValue(defMinHeight)) {
  8193. // 编辑模式默认最小高度
  8194. if (editRules && isEnableConf(editConfig)) {
  8195. val = 144;
  8196. }
  8197. } else {
  8198. val = defMinHeight;
  8199. }
  8200. }
  8201. }
  8202. let num = 0;
  8203. if (val) {
  8204. if (val === '100%' || val === 'auto') {
  8205. num = parentHeight;
  8206. } else {
  8207. const excludeHeight = $xeTable.getExcludeHeight();
  8208. if (isScale(val)) {
  8209. num = Math.floor((external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(val) || 1) / 100 * parentHeight);
  8210. } else {
  8211. num = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(val);
  8212. }
  8213. num = Math.max(40, num - excludeHeight);
  8214. }
  8215. }
  8216. return num;
  8217. }
  8218. /**
  8219. * 列宽算法,计算单元格列宽,动态分配可用剩余空间
  8220. * 支持 px、%、固定 混合分配
  8221. * 支持动态列表调整分配
  8222. * 支持自动分配偏移量
  8223. * 支持 width=60 width=60px width=10% min-width=60 min-width=60px min-width=10%
  8224. */
  8225. function autoCellWidth($xeTable) {
  8226. const props = $xeTable;
  8227. const reactData = $xeTable;
  8228. const internalData = $xeTable;
  8229. const {
  8230. elemStore
  8231. } = internalData;
  8232. const bodyWrapperElem = getRefElem(elemStore['main-body-wrapper']);
  8233. if (!bodyWrapperElem) {
  8234. return;
  8235. }
  8236. const yHandleEl = $xeTable.$refs.refScrollYHandleElem;
  8237. if (!yHandleEl) {
  8238. return;
  8239. }
  8240. const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
  8241. if (!xHandleEl) {
  8242. return;
  8243. }
  8244. let tWidth = 0;
  8245. const minCellWidth = 40; // 列宽最少限制 40px
  8246. const bodyWidth = bodyWrapperElem.clientWidth;
  8247. let remainWidth = bodyWidth;
  8248. let meanWidth = remainWidth / 100;
  8249. const {
  8250. fit
  8251. } = props;
  8252. const {
  8253. columnStore
  8254. } = reactData;
  8255. const {
  8256. resizeList,
  8257. pxMinList,
  8258. autoMinList,
  8259. pxList,
  8260. scaleList,
  8261. scaleMinList,
  8262. autoList,
  8263. remainList
  8264. } = columnStore;
  8265. // 最小宽
  8266. pxMinList.forEach(column => {
  8267. const minWidth = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(column.minWidth);
  8268. tWidth += minWidth;
  8269. column.renderWidth = minWidth;
  8270. });
  8271. // 最小自适应
  8272. autoMinList.forEach(column => {
  8273. const scaleWidth = Math.max(60, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(column.renderAutoWidth));
  8274. tWidth += scaleWidth;
  8275. column.renderWidth = scaleWidth;
  8276. });
  8277. // 最小百分比
  8278. scaleMinList.forEach(column => {
  8279. const scaleWidth = Math.floor(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(column.minWidth) * meanWidth);
  8280. tWidth += scaleWidth;
  8281. column.renderWidth = scaleWidth;
  8282. });
  8283. // 固定百分比
  8284. scaleList.forEach(column => {
  8285. const scaleWidth = Math.floor(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(column.width) * meanWidth);
  8286. tWidth += scaleWidth;
  8287. column.renderWidth = scaleWidth;
  8288. });
  8289. // 固定宽
  8290. pxList.forEach(column => {
  8291. const width = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(column.width);
  8292. tWidth += width;
  8293. column.renderWidth = width;
  8294. });
  8295. // 自适应宽
  8296. autoList.forEach(column => {
  8297. const width = Math.max(60, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(column.renderAutoWidth));
  8298. tWidth += width;
  8299. column.renderWidth = width;
  8300. });
  8301. // 调整了列宽
  8302. resizeList.forEach(column => {
  8303. const width = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(column.resizeWidth);
  8304. tWidth += width;
  8305. column.renderWidth = width;
  8306. });
  8307. remainWidth -= tWidth;
  8308. meanWidth = remainWidth > 0 ? Math.floor(remainWidth / (scaleMinList.length + pxMinList.length + autoMinList.length + remainList.length)) : 0;
  8309. if (fit) {
  8310. if (remainWidth > 0) {
  8311. scaleMinList.concat(pxMinList).concat(autoMinList).forEach(column => {
  8312. tWidth += meanWidth;
  8313. column.renderWidth += meanWidth;
  8314. });
  8315. }
  8316. } else {
  8317. meanWidth = minCellWidth;
  8318. }
  8319. // 剩余均分
  8320. remainList.forEach(column => {
  8321. const width = Math.max(meanWidth, minCellWidth);
  8322. column.renderWidth = width;
  8323. tWidth += width;
  8324. });
  8325. if (fit) {
  8326. /**
  8327. * 偏移量算法
  8328. * 如果所有列足够放的情况下,从最后动态列开始分配
  8329. */
  8330. const dynamicList = scaleList.concat(scaleMinList).concat(pxMinList).concat(autoMinList).concat(remainList);
  8331. let dynamicSize = dynamicList.length - 1;
  8332. if (dynamicSize > 0) {
  8333. let i = bodyWidth - tWidth;
  8334. if (i > 0) {
  8335. while (i > 0 && dynamicSize >= 0) {
  8336. i--;
  8337. dynamicList[dynamicSize--].renderWidth++;
  8338. }
  8339. tWidth = bodyWidth;
  8340. }
  8341. }
  8342. }
  8343. reactData.scrollXWidth = tWidth;
  8344. reactData.resizeWidthFlag++;
  8345. updateColumnOffsetLeft($xeTable);
  8346. updateHeight($xeTable);
  8347. }
  8348. const calcCellAutoHeight = (rowRest, wrapperEl) => {
  8349. const cellElemList = wrapperEl.querySelectorAll(`.vxe-cell--wrapper[rowid="${rowRest.rowid}"]`);
  8350. let colHeight = rowRest.height;
  8351. let firstCellStyle = null;
  8352. let topBottomPadding = 0;
  8353. for (let i = 0; i < cellElemList.length; i++) {
  8354. const wrapperElem = cellElemList[i];
  8355. const cellElem = wrapperElem.parentElement;
  8356. if (!firstCellStyle) {
  8357. firstCellStyle = getComputedStyle(cellElem);
  8358. topBottomPadding = firstCellStyle ? Math.ceil(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(firstCellStyle.paddingTop) + external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(firstCellStyle.paddingBottom)) : 0;
  8359. }
  8360. const cellHeight = wrapperElem ? wrapperElem.clientHeight : 0;
  8361. colHeight = Math.max(colHeight, Math.ceil(cellHeight + topBottomPadding));
  8362. }
  8363. return colHeight;
  8364. };
  8365. const calcCellHeight = $xeTable => {
  8366. const reactData = $xeTable;
  8367. const internalData = $xeTable;
  8368. const {
  8369. tableData,
  8370. isAllOverflow,
  8371. scrollYLoad,
  8372. scrollXLoad
  8373. } = reactData;
  8374. const {
  8375. fullAllDataRowIdData
  8376. } = internalData;
  8377. const defaultRowHeight = $xeTable.computeDefaultRowHeight;
  8378. const el = $xeTable.$refs.refElem;
  8379. if (!isAllOverflow && (scrollYLoad || scrollXLoad) && el) {
  8380. const {
  8381. handleGetRowId
  8382. } = createHandleGetRowId($xeTable);
  8383. tableData.forEach(row => {
  8384. const rowid = handleGetRowId(row);
  8385. const rowRest = fullAllDataRowIdData[rowid];
  8386. if (rowRest) {
  8387. const height = calcCellAutoHeight(rowRest, el);
  8388. rowRest.height = Math.max(defaultRowHeight, scrollXLoad ? Math.max(rowRest.height, height) : height);
  8389. }
  8390. });
  8391. reactData.calcCellHeightFlag++;
  8392. }
  8393. };
  8394. function getOrderField($xeTable, column) {
  8395. const {
  8396. sortBy,
  8397. sortType
  8398. } = column;
  8399. return row => {
  8400. let cellValue;
  8401. if (sortBy) {
  8402. cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(sortBy) ? sortBy({
  8403. row,
  8404. column
  8405. }) : external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, sortBy);
  8406. } else {
  8407. cellValue = $xeTable.getCellLabel(row, column);
  8408. }
  8409. if (!sortType || sortType === 'auto') {
  8410. return isNaN(cellValue) ? cellValue : external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(cellValue);
  8411. } else if (sortType === 'number') {
  8412. return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(cellValue);
  8413. } else if (sortType === 'string') {
  8414. return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toValueString(cellValue);
  8415. }
  8416. return cellValue;
  8417. };
  8418. }
  8419. function handleTargetEnterEvent($xeTable, isClear) {
  8420. const internalData = $xeTable;
  8421. const $tooltip = $xeTable.$refs.refTooltip;
  8422. clearTimeout(internalData.tooltipTimeout);
  8423. if (isClear) {
  8424. $xeTable.closeTooltip();
  8425. } else {
  8426. if ($tooltip && $tooltip.setActived) {
  8427. $tooltip.setActived(true);
  8428. }
  8429. }
  8430. }
  8431. function clearCrossTableDragStatus($xeTable) {
  8432. const crossTableDragRowInfo = getCrossTableDragRowInfo($xeTable);
  8433. crossTableDragRowObj = null;
  8434. crossTableDragRowInfo.row = null;
  8435. }
  8436. function clearDragStatus($xeTable) {
  8437. const reactData = $xeTable;
  8438. const {
  8439. dragRow,
  8440. dragCol
  8441. } = reactData;
  8442. if (dragRow || dragCol) {
  8443. clearColDropOrigin($xeTable);
  8444. clearRowDropOrigin($xeTable);
  8445. hideDropTip($xeTable);
  8446. clearCrossTableDragStatus($xeTable);
  8447. reactData.dragRow = null;
  8448. reactData.dragCol = null;
  8449. }
  8450. }
  8451. function clearRowDropOrigin($xeTable) {
  8452. const el = $xeTable.$el;
  8453. if (el) {
  8454. const clss = 'row--drag-origin';
  8455. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayEach(el.querySelectorAll(`.${clss}`), elem => {
  8456. elem.draggable = false;
  8457. removeClass(elem, clss);
  8458. });
  8459. }
  8460. }
  8461. function updateRowDropOrigin($xeTable, row) {
  8462. const el = $xeTable.$el;
  8463. if (el) {
  8464. const clss = 'row--drag-origin';
  8465. const rowid = getRowid($xeTable, row);
  8466. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayEach(el.querySelectorAll(`[rowid="${rowid}"]`), elem => {
  8467. addClass(elem, clss);
  8468. });
  8469. }
  8470. }
  8471. function updateRowDropTipContent($xeTable, tdEl) {
  8472. const reactData = $xeTable;
  8473. const props = $xeTable;
  8474. const {
  8475. dragConfig
  8476. } = props;
  8477. const {
  8478. dragRow
  8479. } = reactData;
  8480. const rowDragOpts = $xeTable.computeRowDragOpts;
  8481. const {
  8482. tooltipMethod
  8483. } = rowDragOpts;
  8484. const rTooltipMethod = tooltipMethod || (dragConfig ? dragConfig.rowTooltipMethod : null);
  8485. let tipContent = '';
  8486. if (rTooltipMethod) {
  8487. const rtParams = {
  8488. $table: $xeTable,
  8489. row: dragRow
  8490. };
  8491. tipContent = `${rTooltipMethod(rtParams) || ''}`;
  8492. } else {
  8493. tipContent = methods_getI18n('vxe.table.dragTip', [tdEl.textContent || '']);
  8494. }
  8495. reactData.dragTipText = tipContent;
  8496. }
  8497. function updateColDropOrigin($xeTable, column) {
  8498. const el = $xeTable.$el;
  8499. if (el) {
  8500. const colQuerys = [];
  8501. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree([column], item => {
  8502. colQuerys.push(`[colid="${item.id}"]`);
  8503. });
  8504. const clss = 'col--drag-origin';
  8505. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayEach(el.querySelectorAll(colQuerys.join(',')), elem => {
  8506. addClass(elem, clss);
  8507. });
  8508. }
  8509. }
  8510. function clearColDropOrigin($xeTable) {
  8511. const el = $xeTable.$el;
  8512. if (el) {
  8513. const clss = 'col--drag-origin';
  8514. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayEach(el.querySelectorAll(`.${clss}`), elem => {
  8515. elem.draggable = false;
  8516. removeClass(elem, clss);
  8517. });
  8518. }
  8519. }
  8520. function updateColDropTipContent($xeTable, tdEl) {
  8521. const reactData = $xeTable;
  8522. const {
  8523. dragCol
  8524. } = reactData;
  8525. const columnDragOpts = $xeTable.computeColumnDragOpts;
  8526. const {
  8527. tooltipMethod
  8528. } = columnDragOpts;
  8529. let tipContent = '';
  8530. if (tooltipMethod) {
  8531. const dtParams = {
  8532. $table: $xeTable,
  8533. column: dragCol
  8534. };
  8535. tipContent = `${tooltipMethod(dtParams) || ''}`;
  8536. } else {
  8537. tipContent = methods_getI18n('vxe.table.dragTip', [tdEl.textContent || '']);
  8538. }
  8539. reactData.dragTipText = tipContent;
  8540. }
  8541. function showDropTip($xeTable, evnt, trEl, thEl, showLine, dragPos) {
  8542. const $xeGantt = $xeTable.$xeGantt;
  8543. const reactData = $xeTable;
  8544. const internalData = $xeTable;
  8545. let wrapperEl = $xeTable.$refs.refElem;
  8546. if ($xeGantt && trEl) {
  8547. const ganttContainerElem = $xeGantt.$refs.refGanttContainerElem;
  8548. if (ganttContainerElem) {
  8549. wrapperEl = ganttContainerElem;
  8550. }
  8551. }
  8552. if (!wrapperEl) {
  8553. return;
  8554. }
  8555. const {
  8556. overflowX,
  8557. scrollbarWidth,
  8558. overflowY,
  8559. scrollbarHeight
  8560. } = reactData;
  8561. const {
  8562. prevDragToChild
  8563. } = internalData;
  8564. const wrapperRect = wrapperEl.getBoundingClientRect();
  8565. const osbWidth = overflowY ? scrollbarWidth : 0;
  8566. const osbHeight = overflowX ? scrollbarHeight : 0;
  8567. const tableWrapperWidth = wrapperEl.clientWidth;
  8568. const tableWrapperHeight = wrapperEl.clientHeight;
  8569. if (trEl) {
  8570. const rdLineEl = $xeTable.$refs.refDragRowLineElem;
  8571. if (rdLineEl) {
  8572. if (showLine) {
  8573. const scrollbarYToLeft = $xeTable.computeScrollbarYToLeft;
  8574. const trRect = trEl.getBoundingClientRect();
  8575. let trHeight = trEl.clientHeight;
  8576. const offsetTop = Math.max(1, trRect.y - wrapperRect.y);
  8577. if (offsetTop + trHeight > tableWrapperHeight - osbHeight) {
  8578. trHeight = tableWrapperHeight - offsetTop - osbHeight;
  8579. }
  8580. rdLineEl.style.display = 'block';
  8581. rdLineEl.style.left = `${scrollbarYToLeft ? osbWidth : 0}px`;
  8582. rdLineEl.style.top = `${offsetTop}px`;
  8583. rdLineEl.style.height = `${trHeight}px`;
  8584. rdLineEl.style.width = `${tableWrapperWidth - osbWidth}px`;
  8585. rdLineEl.setAttribute('drag-pos', dragPos);
  8586. rdLineEl.setAttribute('drag-to-child', prevDragToChild ? 'y' : 'n');
  8587. } else {
  8588. rdLineEl.style.display = '';
  8589. }
  8590. }
  8591. } else if (thEl) {
  8592. const cdLineEl = $xeTable.$refs.refDragColLineElem;
  8593. if (cdLineEl) {
  8594. if (showLine) {
  8595. const scrollbarXToTop = $xeTable.computeScrollbarXToTop;
  8596. const leftContainerElem = $xeTable.$refs.refLeftContainer;
  8597. const leftContainerWidth = leftContainerElem ? leftContainerElem.clientWidth : 0;
  8598. const rightContainerElem = $xeTable.$refs.refRightContainer;
  8599. const rightContainerWidth = rightContainerElem ? rightContainerElem.clientWidth : 0;
  8600. const thRect = thEl.getBoundingClientRect();
  8601. let thWidth = thEl.clientWidth;
  8602. const offsetTop = Math.max(0, thRect.y - wrapperRect.y);
  8603. const startX = leftContainerWidth;
  8604. let offsetLeft = thRect.x - wrapperRect.x;
  8605. if (offsetLeft < startX) {
  8606. thWidth -= startX - offsetLeft;
  8607. offsetLeft = startX;
  8608. }
  8609. const endX = tableWrapperWidth - rightContainerWidth - (rightContainerWidth ? 0 : osbWidth);
  8610. if (offsetLeft + thWidth > endX) {
  8611. thWidth = endX - offsetLeft;
  8612. }
  8613. cdLineEl.style.display = 'block';
  8614. cdLineEl.style.top = `${offsetTop}px`;
  8615. cdLineEl.style.left = `${offsetLeft}px`;
  8616. cdLineEl.style.width = `${thWidth}px`;
  8617. if (prevDragToChild) {
  8618. cdLineEl.style.height = `${thRect.height}px`;
  8619. } else {
  8620. cdLineEl.style.height = `${tableWrapperHeight - offsetTop - (scrollbarXToTop ? 0 : osbHeight)}px`;
  8621. }
  8622. cdLineEl.setAttribute('drag-pos', dragPos);
  8623. cdLineEl.setAttribute('drag-to-child', prevDragToChild ? 'y' : 'n');
  8624. } else {
  8625. cdLineEl.style.display = '';
  8626. }
  8627. }
  8628. }
  8629. const rdTipEl = $xeTable.$refs.refDragTipElem;
  8630. if (rdTipEl) {
  8631. rdTipEl.style.display = 'block';
  8632. rdTipEl.style.top = `${Math.min(wrapperEl.clientHeight - wrapperEl.scrollTop - rdTipEl.clientHeight, evnt.clientY - wrapperRect.y)}px`;
  8633. rdTipEl.style.left = `${Math.min(wrapperEl.clientWidth - wrapperEl.scrollLeft - rdTipEl.clientWidth - 16, evnt.clientX - wrapperRect.x)}px`;
  8634. rdTipEl.setAttribute('drag-status', showLine ? prevDragToChild ? 'sub' : 'normal' : 'disabled');
  8635. }
  8636. }
  8637. function hideDropTip($xeTable) {
  8638. const rdTipEl = $xeTable.$refs.refDragTipElem;
  8639. const rdLineEl = $xeTable.$refs.refDragRowLineElem;
  8640. const cdLineEl = $xeTable.$refs.refDragColLineElem;
  8641. if (rdTipEl) {
  8642. rdTipEl.style.display = '';
  8643. }
  8644. if (rdLineEl) {
  8645. rdLineEl.style.display = '';
  8646. }
  8647. if (cdLineEl) {
  8648. cdLineEl.style.display = '';
  8649. }
  8650. }
  8651. function clearRowDragData($xeTable) {
  8652. const $xeGantt = $xeTable.$xeGantt;
  8653. const reactData = $xeTable;
  8654. const internalData = $xeTable;
  8655. let wrapperEl = $xeTable.$refs.refElem;
  8656. const dtClss = ['.vxe-body--row'];
  8657. if ($xeGantt) {
  8658. const ganttContainerElem = $xeGantt.$refs.refGanttContainerElem;
  8659. if (ganttContainerElem) {
  8660. wrapperEl = ganttContainerElem;
  8661. }
  8662. dtClss.push('.vxe-gantt-view--body-row', '.vxe-gantt-view--chart-row');
  8663. }
  8664. hideDropTip($xeTable);
  8665. clearRowDropOrigin($xeTable);
  8666. clearRowAnimate(wrapperEl, dtClss);
  8667. internalData.prevDragToChild = false;
  8668. reactData.dragRow = null;
  8669. reactData.dragCol = null;
  8670. }
  8671. /**
  8672. * 处理显示 tooltip
  8673. * @param {Event} evnt 事件
  8674. * @param {Row} row 行对象
  8675. */
  8676. function handleTooltip($xeTable, evnt, tipOpts, type, tdEl, overflowElem, tipElem, params) {
  8677. const reactData = $xeTable;
  8678. const tipOverEl = overflowElem || tdEl;
  8679. if (!tipOverEl) {
  8680. return $xeTable.$nextTick();
  8681. }
  8682. params.cell = tdEl;
  8683. const {
  8684. tooltipStore
  8685. } = reactData;
  8686. const {
  8687. column,
  8688. row
  8689. } = params;
  8690. const {
  8691. showAll,
  8692. contentMethod
  8693. } = tipOpts;
  8694. const customContent = contentMethod ? contentMethod(params) : null;
  8695. const useCustom = contentMethod && !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(customContent);
  8696. const content = useCustom ? customContent : external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toString(column.type === 'html' ? tipOverEl.innerText : tipOverEl.textContent).trim();
  8697. const isOver = tipOverEl.scrollWidth > tipOverEl.clientWidth;
  8698. if (content && (showAll || useCustom || isOver)) {
  8699. const tipContent = formatText(content);
  8700. Object.assign(tooltipStore, {
  8701. row,
  8702. column,
  8703. visible: true,
  8704. content: tipContent,
  8705. type,
  8706. currOpts: tipOpts
  8707. });
  8708. $xeTable.$nextTick(() => {
  8709. const $tooltip = $xeTable.$refs.refTooltip;
  8710. if ($tooltip && $tooltip.open) {
  8711. $tooltip.open(isOver ? tipOverEl : tipElem, tipContent);
  8712. }
  8713. });
  8714. }
  8715. return $xeTable.$nextTick();
  8716. }
  8717. function handleScrollToRowColumn($xeTable, fieldOrColumn, row) {
  8718. const internalData = $xeTable;
  8719. const {
  8720. fullColumnIdData
  8721. } = internalData;
  8722. const column = handleFieldOrColumn($xeTable, fieldOrColumn);
  8723. if (column && fullColumnIdData[column.id]) {
  8724. return colToVisible($xeTable, column, row);
  8725. }
  8726. return $xeTable.$nextTick();
  8727. }
  8728. function handleRowExpandReserve($xeTable, row, expanded) {
  8729. const internalData = $xeTable;
  8730. const {
  8731. rowExpandedReserveRowMap
  8732. } = internalData;
  8733. const expandOpts = $xeTable.computeExpandOpts;
  8734. if (expandOpts.reserve) {
  8735. const rowid = getRowid($xeTable, row);
  8736. if (expanded) {
  8737. rowExpandedReserveRowMap[rowid] = row;
  8738. } else if (rowExpandedReserveRowMap[rowid]) {
  8739. delete rowExpandedReserveRowMap[rowid];
  8740. }
  8741. }
  8742. }
  8743. function handleDefaultMergeCells($xeTable) {
  8744. const props = $xeTable;
  8745. const {
  8746. mergeCells
  8747. } = props;
  8748. if (mergeCells) {
  8749. $xeTable.setMergeCells(mergeCells);
  8750. }
  8751. }
  8752. function handleDefaultMergeHeaderItems($xeTable) {
  8753. const props = $xeTable;
  8754. const {
  8755. mergeHeaderCells
  8756. } = props;
  8757. if (mergeHeaderCells) {
  8758. $xeTable.setMergeHeaderCells(mergeHeaderCells);
  8759. }
  8760. }
  8761. function handleDefaultMergeFooterItems($xeTable) {
  8762. const props = $xeTable;
  8763. const {
  8764. mergeFooterCells,
  8765. mergeFooterItems
  8766. } = props;
  8767. const mFooterCells = mergeFooterCells || mergeFooterItems;
  8768. if (mFooterCells) {
  8769. $xeTable.setMergeFooterCells(mFooterCells);
  8770. }
  8771. }
  8772. // 计算可视渲染相关数据
  8773. function computeScrollLoad($xeTable) {
  8774. const reactData = $xeTable;
  8775. const internalData = $xeTable;
  8776. return $xeTable.$nextTick().then(() => {
  8777. const {
  8778. scrollXLoad,
  8779. scrollYLoad
  8780. } = reactData;
  8781. const {
  8782. scrollXStore,
  8783. scrollYStore
  8784. } = internalData;
  8785. const virtualYOpts = $xeTable.computeVirtualYOpts;
  8786. const virtualXOpts = $xeTable.computeVirtualXOpts;
  8787. // 计算 X 逻辑
  8788. if (scrollXLoad) {
  8789. const {
  8790. toVisibleIndex: toXVisibleIndex,
  8791. visibleSize: visibleXSize
  8792. } = handleVirtualXVisible($xeTable);
  8793. const offsetXSize = Math.max(0, virtualXOpts.oSize ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(virtualXOpts.oSize) : 0);
  8794. scrollXStore.preloadSize = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(virtualXOpts.preSize);
  8795. scrollXStore.offsetSize = offsetXSize;
  8796. scrollXStore.visibleSize = visibleXSize;
  8797. scrollXStore.endIndex = Math.max(scrollXStore.startIndex + scrollXStore.visibleSize + offsetXSize, scrollXStore.endIndex);
  8798. scrollXStore.visibleStartIndex = Math.max(scrollXStore.startIndex, toXVisibleIndex);
  8799. scrollXStore.visibleEndIndex = Math.min(scrollXStore.endIndex, toXVisibleIndex + visibleXSize);
  8800. $xeTable.updateScrollXData().then(() => {
  8801. loadScrollXData($xeTable);
  8802. });
  8803. } else {
  8804. $xeTable.updateScrollXSpace();
  8805. }
  8806. // 计算 Y 逻辑
  8807. const rowHeight = computeRowHeight($xeTable);
  8808. scrollYStore.rowHeight = rowHeight; // 已废弃
  8809. reactData.rowHeight = rowHeight;
  8810. const {
  8811. toVisibleIndex: toYVisibleIndex,
  8812. visibleSize: visibleYSize
  8813. } = handleVirtualYVisible($xeTable);
  8814. if (scrollYLoad) {
  8815. const offsetYSize = Math.max(0, virtualYOpts.oSize ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(virtualYOpts.oSize) : 0);
  8816. scrollYStore.preloadSize = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(virtualYOpts.preSize);
  8817. scrollYStore.offsetSize = offsetYSize;
  8818. scrollYStore.visibleSize = visibleYSize;
  8819. scrollYStore.endIndex = Math.max(scrollYStore.startIndex + visibleYSize + offsetYSize, scrollYStore.endIndex);
  8820. scrollYStore.visibleStartIndex = Math.max(scrollYStore.startIndex, toYVisibleIndex);
  8821. scrollYStore.visibleEndIndex = Math.min(scrollYStore.endIndex, toYVisibleIndex + visibleYSize);
  8822. $xeTable.updateScrollYData().then(() => {
  8823. loadScrollYData($xeTable);
  8824. });
  8825. } else {
  8826. $xeTable.updateScrollYSpace();
  8827. }
  8828. });
  8829. }
  8830. function calcScrollbar($xeTable) {
  8831. const reactData = $xeTable;
  8832. const internalData = $xeTable;
  8833. const {
  8834. scrollXWidth,
  8835. scrollYHeight
  8836. } = reactData;
  8837. const {
  8838. elemStore
  8839. } = internalData;
  8840. const scrollbarOpts = $xeTable.computeScrollbarOpts;
  8841. const bodyWrapperElem = getRefElem(elemStore['main-body-wrapper']);
  8842. const headerTableElem = getRefElem(elemStore['main-header-table']);
  8843. const footerTableElem = getRefElem(elemStore['main-footer-table']);
  8844. const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
  8845. const yHandleEl = $xeTable.$refs.refScrollYHandleElem;
  8846. let overflowY = false;
  8847. let overflowX = false;
  8848. if (bodyWrapperElem) {
  8849. overflowY = scrollYHeight > bodyWrapperElem.clientHeight;
  8850. if (yHandleEl) {
  8851. reactData.scrollbarWidth = scrollbarOpts.width || yHandleEl.offsetWidth - yHandleEl.clientWidth || 14;
  8852. }
  8853. reactData.overflowY = overflowY;
  8854. overflowX = scrollXWidth > bodyWrapperElem.clientWidth;
  8855. if (xHandleEl) {
  8856. reactData.scrollbarHeight = scrollbarOpts.height || xHandleEl.offsetHeight - xHandleEl.clientHeight || 14;
  8857. }
  8858. reactData.overflowX = overflowX;
  8859. const hHeight = headerTableElem ? headerTableElem.clientHeight : 0;
  8860. const fHeight = footerTableElem ? footerTableElem.clientHeight : 0;
  8861. internalData.tableHeight = bodyWrapperElem.offsetHeight;
  8862. internalData.tHeaderHeight = hHeight;
  8863. internalData.tFooterHeight = fHeight;
  8864. reactData.overflowX = overflowX;
  8865. reactData.parentHeight = Math.max(hHeight + fHeight + 20, $xeTable.getParentHeight());
  8866. }
  8867. if (overflowX) {
  8868. $xeTable.checkScrolling();
  8869. }
  8870. }
  8871. function handleRecalculateStyle($xeTable, reFull, reWidth, reHeight) {
  8872. const internalData = $xeTable;
  8873. const el = $xeTable.$refs.refElem;
  8874. internalData.rceRunTime = Date.now();
  8875. if (!el || !el.clientWidth) {
  8876. return $xeTable.$nextTick();
  8877. }
  8878. const varEl = $xeTable.$refs.refVarElem;
  8879. if (varEl) {
  8880. const [defEl, mediumEl, smallEl, miniEl] = varEl.children;
  8881. calcVarRowHeightConfig($xeTable, 'default', defEl);
  8882. calcVarRowHeightConfig($xeTable, 'medium', mediumEl);
  8883. calcVarRowHeightConfig($xeTable, 'small', smallEl);
  8884. calcVarRowHeightConfig($xeTable, 'mini', miniEl);
  8885. }
  8886. if (reWidth) {
  8887. calcCellWidth($xeTable);
  8888. }
  8889. if (reFull) {
  8890. autoCellWidth($xeTable);
  8891. }
  8892. calcScrollbar($xeTable);
  8893. updateStyle($xeTable);
  8894. updateRowExpandStyle($xeTable);
  8895. return computeScrollLoad($xeTable).then(() => {
  8896. // 初始化时需要在列计算之后再执行优化运算,达到最优显示效果
  8897. if (reWidth) {
  8898. calcCellWidth($xeTable);
  8899. }
  8900. if (reFull) {
  8901. autoCellWidth($xeTable);
  8902. }
  8903. if (reHeight) {
  8904. calcCellHeight($xeTable);
  8905. }
  8906. updateStyle($xeTable);
  8907. calcScrollbar($xeTable);
  8908. if (reFull) {
  8909. updateRowOffsetTop($xeTable);
  8910. }
  8911. updateRowExpandStyle($xeTable);
  8912. if (reFull) {
  8913. return computeScrollLoad($xeTable);
  8914. }
  8915. });
  8916. }
  8917. function handleLazyRecalculate($xeTable, reFull, reWidth, reHeight) {
  8918. const internalData = $xeTable;
  8919. return new Promise(resolve => {
  8920. const {
  8921. rceTimeout,
  8922. rceRunTime
  8923. } = internalData;
  8924. const $xeGanttView = internalData.xeGanttView;
  8925. const resizeOpts = $xeTable.computeResizeOpts;
  8926. const refreshDelay = resizeOpts.refreshDelay || 20;
  8927. const el = $xeTable.$refs.refElem;
  8928. if (el && el.clientWidth) {
  8929. autoCellWidth($xeTable);
  8930. updateRowExpandStyle($xeTable);
  8931. }
  8932. if (rceTimeout) {
  8933. clearTimeout(rceTimeout);
  8934. if (rceRunTime && rceRunTime + (refreshDelay - 5) < Date.now()) {
  8935. resolve(handleRecalculateStyle($xeTable, reFull, reWidth, reHeight));
  8936. } else {
  8937. $xeTable.$nextTick(() => {
  8938. resolve();
  8939. });
  8940. }
  8941. } else {
  8942. resolve(handleRecalculateStyle($xeTable, reFull, reWidth, reHeight));
  8943. }
  8944. if ($xeGanttView && $xeGanttView.handleLazyRecalculate) {
  8945. $xeGanttView.handleLazyRecalculate();
  8946. }
  8947. internalData.rceTimeout = setTimeout(() => {
  8948. internalData.rceTimeout = undefined;
  8949. handleRecalculateStyle($xeTable, reFull, reWidth, reHeight);
  8950. }, refreshDelay);
  8951. });
  8952. }
  8953. function handleResizeEvent($xeTable) {
  8954. handleLazyRecalculate($xeTable, true, true, true);
  8955. }
  8956. function handleUpdateAggValues($xeTable) {
  8957. const reactData = $xeTable;
  8958. const internalData = $xeTable;
  8959. const {
  8960. visibleColumn
  8961. } = internalData;
  8962. const aggCols = [];
  8963. visibleColumn.forEach(column => {
  8964. if (column.aggFunc) {
  8965. aggCols.push(column);
  8966. }
  8967. });
  8968. reactData.aggHandleAggColumns = aggCols;
  8969. }
  8970. function handleUpdateRowGroup($xeTable, groupFields) {
  8971. const reactData = $xeTable;
  8972. const aggGroupFields = [];
  8973. const aggGroupConfs = [];
  8974. if (groupFields) {
  8975. (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(groupFields) ? groupFields : [groupFields]).forEach(field => {
  8976. aggGroupFields.push(field);
  8977. aggGroupConfs.push({
  8978. field
  8979. });
  8980. });
  8981. }
  8982. reactData.rowGroupList = aggGroupConfs;
  8983. reactData.aggHandleFields = aggGroupFields;
  8984. handleUpdateAggValues($xeTable);
  8985. }
  8986. function handleeGroupSummary($xeTable, aggList) {
  8987. const aggregateOpts = $xeTable.computeAggregateOpts;
  8988. const {
  8989. mapChildrenField
  8990. } = aggregateOpts;
  8991. if (mapChildrenField) {
  8992. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().lastEach(aggList, aggRow => {
  8993. let count = 0;
  8994. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(aggRow[mapChildrenField], row => {
  8995. if (row.isAggregate) {
  8996. count += row.childCount || 0;
  8997. } else {
  8998. count++;
  8999. }
  9000. });
  9001. aggRow.childCount = count;
  9002. });
  9003. if ($xeTable.handlePivotTableAggregateData) {
  9004. $xeTable.handlePivotTableAggregateData(aggList);
  9005. }
  9006. }
  9007. }
  9008. function updateGroupData($xeTable) {
  9009. const props = $xeTable;
  9010. const reactData = $xeTable;
  9011. const internalData = $xeTable;
  9012. const {
  9013. aggregateConfig,
  9014. rowGroupConfig
  9015. } = props;
  9016. const {
  9017. isRowGroupStatus
  9018. } = reactData;
  9019. const {
  9020. tableFullGroupData
  9021. } = internalData;
  9022. const aggregateOpts = $xeTable.computeAggregateOpts;
  9023. const {
  9024. mapChildrenField
  9025. } = aggregateOpts;
  9026. if ((aggregateConfig || rowGroupConfig) && isRowGroupStatus) {
  9027. const aggList = [];
  9028. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(tableFullGroupData, row => {
  9029. if (row.isAggregate) {
  9030. aggList.push(row);
  9031. }
  9032. }, {
  9033. children: mapChildrenField
  9034. });
  9035. handleeGroupSummary($xeTable, aggList);
  9036. }
  9037. }
  9038. function handleGroupData($xeTable, list, rowGroups) {
  9039. let fullData = list;
  9040. let treeData = list;
  9041. if (rowGroups) {
  9042. const aggregateOpts = $xeTable.computeAggregateOpts;
  9043. const {
  9044. rowField,
  9045. parentField,
  9046. childrenField,
  9047. mapChildrenField
  9048. } = aggregateOpts;
  9049. const checkboxOpts = $xeTable.computeCheckboxOpts;
  9050. const {
  9051. checkField
  9052. } = checkboxOpts;
  9053. const indeterminateField = checkboxOpts.indeterminateField || checkboxOpts.halfField;
  9054. const rgItem = rowGroups[0];
  9055. if (rgItem && rowField && parentField && childrenField && mapChildrenField) {
  9056. fullData = [];
  9057. treeData = [];
  9058. const groupField = rgItem.field;
  9059. const groupColumn = $xeTable.getColumnByField(groupField);
  9060. const groupMaps = {};
  9061. const aggList = [];
  9062. const rowkey = getRowkey($xeTable);
  9063. list.forEach(row => {
  9064. const cellValue = groupColumn ? $xeTable.getCellLabel(row, groupColumn) : external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, groupField);
  9065. const groupValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(cellValue) ? '' : cellValue;
  9066. let childList = groupMaps[groupValue];
  9067. if (!childList) {
  9068. childList = [];
  9069. groupMaps[groupValue] = childList;
  9070. }
  9071. if (row.isAggregate) {
  9072. row.isAggregate = undefined;
  9073. }
  9074. childList.push(row);
  9075. });
  9076. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().objectEach(groupMaps, (childList, groupValue) => {
  9077. const {
  9078. fullData: childFullData,
  9079. treeData: childTreeData
  9080. } = handleGroupData($xeTable, childList, rowGroups.slice(1));
  9081. const aggRow = {
  9082. isAggregate: true,
  9083. aggData: {},
  9084. groupContent: groupValue,
  9085. groupField,
  9086. childCount: 0,
  9087. [rowField]: getRowUniqueId(),
  9088. [parentField]: null,
  9089. [rowkey]: getRowUniqueId(),
  9090. [childrenField]: childTreeData,
  9091. [mapChildrenField]: childTreeData
  9092. };
  9093. if (checkField) {
  9094. aggRow[checkField] = false;
  9095. }
  9096. if (indeterminateField) {
  9097. aggRow[indeterminateField] = false;
  9098. }
  9099. aggList.push(aggRow);
  9100. treeData.push(aggRow);
  9101. fullData.push(aggRow);
  9102. if (childFullData.length) {
  9103. fullData.push(...childFullData);
  9104. }
  9105. });
  9106. handleeGroupSummary($xeTable, aggList);
  9107. }
  9108. }
  9109. return {
  9110. treeData,
  9111. fullData
  9112. };
  9113. }
  9114. /**
  9115. * 加载表格数据
  9116. * @param {Array} datas 数据
  9117. */
  9118. function loadTableData($xeTable, datas, isReset) {
  9119. const props = $xeTable;
  9120. const reactData = $xeTable;
  9121. const internalData = $xeTable;
  9122. const {
  9123. keepSource,
  9124. treeConfig,
  9125. aggregateConfig,
  9126. rowGroupConfig
  9127. } = props;
  9128. const {
  9129. rowGroupList,
  9130. scrollYLoad: oldScrollYLoad
  9131. } = reactData;
  9132. const {
  9133. scrollYStore,
  9134. scrollXStore,
  9135. lastScrollLeft,
  9136. lastScrollTop
  9137. } = internalData;
  9138. const rowOpts = $xeTable.computeRowOpts;
  9139. const treeOpts = $xeTable.computeTreeOpts;
  9140. const expandOpts = $xeTable.computeExpandOpts;
  9141. const {
  9142. transform
  9143. } = treeOpts;
  9144. const childrenField = treeOpts.children || treeOpts.childrenField;
  9145. let treeData = [];
  9146. let fullData = datas ? datas.slice(0) : []; // 转为响应式数据
  9147. if (fullData.length > supportMaxRow) {
  9148. errLog('vxe.error.errMaxRow', [supportMaxRow]);
  9149. }
  9150. if (treeConfig && rowGroupList.length) {
  9151. errLog('vxe.error.noTree', ['aggregate-config']);
  9152. return $xeTable.$nextTick();
  9153. }
  9154. if (rowOpts.drag && rowGroupList.length) {
  9155. errLog('vxe.error.errConflicts', ['row-config.drag', 'aggregate-config']);
  9156. return $xeTable.$nextTick();
  9157. }
  9158. let isRGroup = false;
  9159. if (treeConfig) {
  9160. if (transform) {
  9161. // 树结构自动转换
  9162. if (!treeOpts.rowField) {
  9163. errLog('vxe.error.reqProp', ['tree-config.rowField']);
  9164. }
  9165. if (!treeOpts.parentField) {
  9166. errLog('vxe.error.reqProp', ['tree-config.parentField']);
  9167. }
  9168. if (!childrenField) {
  9169. errLog('vxe.error.reqProp', ['tree-config.childrenField']);
  9170. }
  9171. if (!treeOpts.mapChildrenField) {
  9172. errLog('vxe.error.reqProp', ['tree-config.mapChildrenField']);
  9173. }
  9174. if (childrenField === treeOpts.mapChildrenField) {
  9175. errLog('vxe.error.errConflicts', ['tree-config.childrenField', 'tree-config.mapChildrenField']);
  9176. }
  9177. // fullData.forEach(row => {
  9178. // if (row[treeOpts.children] && row[treeOpts.children].length) {
  9179. // warnLog('vxe.error.errConflicts', ['tree-config.transform', `row.${treeOpts.children}`])
  9180. // }
  9181. // })
  9182. treeData = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toArrayTree(fullData, {
  9183. key: treeOpts.rowField,
  9184. parentKey: treeOpts.parentField,
  9185. children: childrenField,
  9186. mapChildren: treeOpts.mapChildrenField
  9187. });
  9188. fullData = treeData.slice(0);
  9189. } else {
  9190. treeData = fullData.slice(0);
  9191. }
  9192. } else if ((aggregateConfig || rowGroupConfig) && rowGroupList.length) {
  9193. const groupRest = handleGroupData($xeTable, fullData, rowGroupList);
  9194. treeData = groupRest.treeData;
  9195. fullData = groupRest.fullData;
  9196. isRGroup = true;
  9197. }
  9198. reactData.isRowGroupStatus = isRGroup;
  9199. scrollYStore.startIndex = 0;
  9200. scrollYStore.endIndex = 1;
  9201. scrollXStore.startIndex = 0;
  9202. scrollXStore.endIndex = 1;
  9203. internalData.cvCacheMaps = {};
  9204. reactData.isRowLoading = true;
  9205. reactData.scrollVMLoading = false;
  9206. reactData.treeExpandedFlag++;
  9207. reactData.rowExpandedFlag++;
  9208. internalData.insertRowMaps = {};
  9209. reactData.insertRowFlag++;
  9210. internalData.removeRowMaps = {};
  9211. reactData.removeRowFlag++;
  9212. const sYLoad = updateScrollYStatus($xeTable, fullData);
  9213. // 全量数据
  9214. internalData.tableFullData = fullData;
  9215. internalData.tableFullTreeData = isRGroup ? [] : treeData;
  9216. internalData.tableFullGroupData = isRGroup ? treeData : [];
  9217. // 缓存数据
  9218. $xeTable.cacheRowMap(isReset);
  9219. // 原始数据
  9220. internalData.tableSynchData = datas;
  9221. if (isReset) {
  9222. internalData.isResizeCellHeight = false;
  9223. }
  9224. // 克隆原数据,用于显示编辑状态,与编辑值做对比
  9225. if (keepSource) {
  9226. $xeTable.cacheSourceMap(fullData);
  9227. }
  9228. if ($xeTable.clearCellAreas && props.mouseConfig) {
  9229. $xeTable.clearCellAreas();
  9230. $xeTable.clearCopyCellArea();
  9231. }
  9232. $xeTable.clearMergeCells();
  9233. $xeTable.clearMergeFooterItems();
  9234. $xeTable.handleTableData(true);
  9235. $xeTable.updateFooter();
  9236. $xeTable.handleUpdateBodyMerge();
  9237. return $xeTable.$nextTick().then(() => {
  9238. updateHeight($xeTable);
  9239. updateStyle($xeTable);
  9240. }).then(() => {
  9241. computeScrollLoad($xeTable);
  9242. }).then(() => {
  9243. const virtualYOpts = $xeTable.computeVirtualYOpts;
  9244. // 是否启用了虚拟滚动
  9245. if (sYLoad) {
  9246. scrollYStore.endIndex = scrollYStore.visibleSize;
  9247. }
  9248. if (sYLoad) {
  9249. if (reactData.expandColumn && expandOpts.mode !== 'fixed') {
  9250. errLog('vxe.error.notConflictProp', ['column.type="expand', 'expand-config.mode="fixed"']);
  9251. }
  9252. if (virtualYOpts.mode === 'scroll' && expandOpts.mode === 'fixed') {
  9253. warnLog('vxe.error.notConflictProp', ['virtual-y-config.mode=scroll', 'expand-config.mode=inside']);
  9254. }
  9255. // if (showOverflow) {
  9256. // if (!rowOpts.height) {
  9257. // const errColumn = internalData.tableFullColumn.find(column => column.showOverflow === false)
  9258. // if (errColumn) {
  9259. // errLog('vxe.error.errProp', [`column[field="${errColumn.field}"].show-overflow=false`, 'show-overflow=true'])
  9260. // }
  9261. // }
  9262. // }
  9263. if (!(props.height || props.maxHeight)) {
  9264. errLog('vxe.error.reqProp', ['height | max-height | virtual-y-config={enabled: false}']);
  9265. }
  9266. // if (!props.showOverflow) {
  9267. // warnLog('vxe.error.reqProp', ['table.show-overflow'])
  9268. // }
  9269. if (props.spanMethod) {
  9270. errLog('vxe.error.scrollErrProp', ['table.span-method']);
  9271. }
  9272. }
  9273. handleReserveStatus($xeTable);
  9274. $xeTable.checkSelectionStatus();
  9275. $xeTable.dispatchEvent('data-change', {
  9276. visibleColumn: internalData.visibleColumn,
  9277. visibleData: internalData.afterFullData
  9278. }, null);
  9279. return new Promise(resolve => {
  9280. $xeTable.$nextTick().then(() => handleRecalculateStyle($xeTable, false, false, false)).then(() => {
  9281. handleRecalculateStyle($xeTable, false, true, true);
  9282. updateRowOffsetTop($xeTable);
  9283. }).then(() => {
  9284. let targetScrollLeft = lastScrollLeft;
  9285. let targetScrollTop = lastScrollTop;
  9286. const virtualXOpts = $xeTable.computeVirtualXOpts;
  9287. const virtualYOpts = $xeTable.computeVirtualYOpts;
  9288. // 是否在更新数据之后自动滚动重置滚动条
  9289. if (virtualXOpts.scrollToLeftOnChange) {
  9290. targetScrollLeft = 0;
  9291. }
  9292. if (virtualYOpts.scrollToTopOnChange) {
  9293. targetScrollTop = 0;
  9294. }
  9295. reactData.isRowLoading = false;
  9296. handleRecalculateStyle($xeTable, false, false, false);
  9297. // 如果是自动行高,特殊情况需调用 recalculate 手动刷新
  9298. if (!props.showOverflow) {
  9299. setTimeout(() => {
  9300. handleLazyRecalculate($xeTable, false, true, true);
  9301. setTimeout(() => handleLazyRecalculate($xeTable, false, true, true), 3000);
  9302. }, 2000);
  9303. }
  9304. // 是否变更虚拟滚动
  9305. if (oldScrollYLoad === sYLoad) {
  9306. restoreScrollLocation($xeTable, targetScrollLeft, targetScrollTop).then(() => {
  9307. handleRecalculateStyle($xeTable, false, true, true);
  9308. updateRowOffsetTop($xeTable);
  9309. resolve();
  9310. });
  9311. } else {
  9312. setTimeout(() => {
  9313. restoreScrollLocation($xeTable, targetScrollLeft, targetScrollTop).then(() => {
  9314. handleRecalculateStyle($xeTable, false, true, true);
  9315. updateRowOffsetTop($xeTable);
  9316. resolve();
  9317. });
  9318. });
  9319. }
  9320. });
  9321. });
  9322. });
  9323. }
  9324. /**
  9325. * 处理数据加载默认行为
  9326. * 默认执行一次,除非被重置
  9327. */
  9328. function handleLoadDefaults($xeTable) {
  9329. handleDefaultSelectionChecked($xeTable);
  9330. handleDefaultRadioChecked($xeTable);
  9331. handleDefaultRowExpand($xeTable);
  9332. handleDefaultTreeExpand($xeTable);
  9333. handleDefaultRowGroupExpand($xeTable);
  9334. handleDefaultMergeCells($xeTable);
  9335. handleDefaultMergeHeaderItems($xeTable);
  9336. handleDefaultMergeFooterItems($xeTable);
  9337. $xeTable.$nextTick(() => setTimeout(() => $xeTable.recalculate()));
  9338. }
  9339. /**
  9340. * 处理初始化的默认行为
  9341. * 只会执行一次
  9342. */
  9343. function handleInitDefaults($xeTable) {
  9344. handleDefaultSort($xeTable);
  9345. }
  9346. function handleTableColumn($xeTable) {
  9347. const reactData = $xeTable;
  9348. const internalData = $xeTable;
  9349. const {
  9350. scrollXLoad
  9351. } = reactData;
  9352. const {
  9353. visibleColumn,
  9354. scrollXStore,
  9355. fullColumnIdData
  9356. } = internalData;
  9357. const tableColumn = scrollXLoad ? visibleColumn.slice(scrollXStore.startIndex, scrollXStore.endIndex) : visibleColumn.slice(0);
  9358. tableColumn.forEach((column, $index) => {
  9359. const colid = column.id;
  9360. const colRest = fullColumnIdData[colid];
  9361. if (colRest) {
  9362. colRest.$index = $index;
  9363. }
  9364. });
  9365. reactData.tableColumn = tableColumn;
  9366. }
  9367. function handleUpdateColumn($xeTable) {
  9368. const internalData = $xeTable;
  9369. const columnList = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().orderBy(internalData.collectColumn, 'renderSortNumber');
  9370. internalData.collectColumn = columnList;
  9371. const tableFullColumn = getColumnList(columnList);
  9372. internalData.tableFullColumn = tableFullColumn;
  9373. cacheColumnMap($xeTable);
  9374. }
  9375. function loadScrollXData($xeTable) {
  9376. const reactData = $xeTable;
  9377. const internalData = $xeTable;
  9378. const {
  9379. isScrollXBig
  9380. } = reactData;
  9381. const {
  9382. mergeBodyList,
  9383. mergeFooterList,
  9384. scrollXStore
  9385. } = internalData;
  9386. const {
  9387. preloadSize,
  9388. startIndex,
  9389. endIndex,
  9390. offsetSize
  9391. } = scrollXStore;
  9392. const {
  9393. toVisibleIndex,
  9394. visibleSize
  9395. } = handleVirtualXVisible($xeTable);
  9396. const offsetItem = {
  9397. startIndex: Math.max(0, isScrollXBig ? toVisibleIndex - 1 : toVisibleIndex - 1 - offsetSize - preloadSize),
  9398. endIndex: isScrollXBig ? toVisibleIndex + visibleSize : toVisibleIndex + visibleSize + offsetSize + preloadSize
  9399. };
  9400. scrollXStore.visibleStartIndex = toVisibleIndex - 1;
  9401. scrollXStore.visibleEndIndex = toVisibleIndex + visibleSize + 1;
  9402. calculateMergerOffsetIndex(mergeBodyList.concat(mergeFooterList), offsetItem, 'col');
  9403. const {
  9404. startIndex: offsetStartIndex,
  9405. endIndex: offsetEndIndex
  9406. } = offsetItem;
  9407. if (toVisibleIndex <= startIndex || toVisibleIndex >= endIndex - visibleSize - 1) {
  9408. if (startIndex !== offsetStartIndex || endIndex !== offsetEndIndex) {
  9409. scrollXStore.startIndex = offsetStartIndex;
  9410. scrollXStore.endIndex = offsetEndIndex;
  9411. $xeTable.updateScrollXData();
  9412. }
  9413. }
  9414. $xeTable.closeTooltip();
  9415. }
  9416. function parseColumns($xeTable, isReset) {
  9417. const props = $xeTable;
  9418. const reactData = $xeTable;
  9419. const internalData = $xeTable;
  9420. // const { showOverflow } = props
  9421. // const rowOpts = $xeTable.computeRowOpts
  9422. const leftList = [];
  9423. const centerList = [];
  9424. const rightList = [];
  9425. const {
  9426. isGroup,
  9427. columnStore
  9428. } = reactData;
  9429. const {
  9430. collectColumn,
  9431. tableFullColumn,
  9432. scrollXStore,
  9433. fullColumnIdData
  9434. } = internalData;
  9435. // 如果是分组表头,如果子列全部被隐藏,则根列也隐藏
  9436. if (isGroup) {
  9437. const leftGroupList = [];
  9438. const centerGroupList = [];
  9439. const rightGroupList = [];
  9440. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(collectColumn, (column, index, items, path, parentColumn) => {
  9441. const isColGroup = hasChildrenList(column);
  9442. // 如果是分组,必须按组设置固定列,不允许给子列设置固定
  9443. if (parentColumn && parentColumn.fixed) {
  9444. column.fixed = parentColumn.fixed;
  9445. }
  9446. if (parentColumn && (column.fixed || '') !== (parentColumn.fixed || '')) {
  9447. errLog('vxe.error.groupFixed');
  9448. }
  9449. if (isColGroup) {
  9450. column.visible = !!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findTree(column.children, subColumn => hasChildrenList(subColumn) ? false : subColumn.visible);
  9451. } else if (column.visible) {
  9452. if (column.fixed === 'left') {
  9453. leftList.push(column);
  9454. } else if (column.fixed === 'right') {
  9455. rightList.push(column);
  9456. } else {
  9457. centerList.push(column);
  9458. }
  9459. }
  9460. });
  9461. collectColumn.forEach(column => {
  9462. if (column.visible) {
  9463. if (column.fixed === 'left') {
  9464. leftGroupList.push(column);
  9465. } else if (column.fixed === 'right') {
  9466. rightGroupList.push(column);
  9467. } else {
  9468. centerGroupList.push(column);
  9469. }
  9470. }
  9471. });
  9472. reactData.tableGroupColumn = leftGroupList.concat(centerGroupList).concat(rightGroupList);
  9473. } else {
  9474. // 重新分配列
  9475. tableFullColumn.forEach(column => {
  9476. if (column.visible) {
  9477. if (column.fixed === 'left') {
  9478. leftList.push(column);
  9479. } else if (column.fixed === 'right') {
  9480. rightList.push(column);
  9481. } else {
  9482. centerList.push(column);
  9483. }
  9484. }
  9485. });
  9486. }
  9487. const visibleColumn = leftList.concat(centerList).concat(rightList);
  9488. internalData.visibleColumn = visibleColumn;
  9489. updateColumnOffsetLeft($xeTable);
  9490. const sXLoad = updateScrollXStatus($xeTable);
  9491. reactData.hasFixedColumn = leftList.length > 0 || rightList.length > 0;
  9492. Object.assign(columnStore, {
  9493. leftList,
  9494. centerList,
  9495. rightList
  9496. });
  9497. if (sXLoad) {
  9498. // if (showOverflow) {
  9499. // if (!rowOpts.height) {
  9500. // const errColumn = internalData.tableFullColumn.find(column => column.showOverflow === false)
  9501. // if (errColumn) {
  9502. // errLog('vxe.error.errProp', [`column[field="${errColumn.field}"].show-overflow=false`, 'show-overflow=true'])
  9503. // }
  9504. // }
  9505. // }
  9506. // if (props.showHeader && !props.showHeaderOverflow) {
  9507. // warnLog('vxe.error.reqProp', ['show-header-overflow'])
  9508. // }
  9509. // if (props.showFooter && !props.showFooterOverflow) {
  9510. // warnLog('vxe.error.reqProp', ['show-footer-overflow'])
  9511. // }
  9512. if (props.spanMethod) {
  9513. warnLog('vxe.error.scrollErrProp', ['span-method']);
  9514. }
  9515. if (props.footerSpanMethod) {
  9516. warnLog('vxe.error.scrollErrProp', ['footer-span-method']);
  9517. }
  9518. if (isReset) {
  9519. const {
  9520. visibleSize
  9521. } = handleVirtualXVisible($xeTable);
  9522. scrollXStore.startIndex = 0;
  9523. scrollXStore.endIndex = visibleSize;
  9524. scrollXStore.visibleSize = visibleSize;
  9525. scrollXStore.visibleStartIndex = 0;
  9526. scrollXStore.visibleEndIndex = visibleSize;
  9527. }
  9528. }
  9529. // 如果列被显示/隐藏,则清除合并状态
  9530. // 如果列被设置为固定,则清除合并状态
  9531. if (visibleColumn.length !== internalData.visibleColumn.length || !internalData.visibleColumn.every((column, index) => column === visibleColumn[index])) {
  9532. $xeTable.clearMergeCells();
  9533. $xeTable.clearMergeFooterItems();
  9534. }
  9535. visibleColumn.forEach((column, index) => {
  9536. const colid = column.id;
  9537. const colRest = fullColumnIdData[colid];
  9538. if (colRest) {
  9539. colRest._index = index;
  9540. }
  9541. });
  9542. handleTableColumn($xeTable);
  9543. handleUpdateAggValues($xeTable);
  9544. if (isReset) {
  9545. return $xeTable.updateFooter().then(() => {
  9546. return $xeTable.recalculate();
  9547. }).then(() => {
  9548. $xeTable.updateCellAreas();
  9549. return $xeTable.recalculate();
  9550. });
  9551. }
  9552. return $xeTable.updateFooter();
  9553. }
  9554. function initColumnHierarchy($xeTable) {
  9555. const internalData = $xeTable;
  9556. const {
  9557. collectColumn
  9558. } = internalData;
  9559. const fullColIdData = {};
  9560. const fullColFieldData = {};
  9561. let sortIndex = 1;
  9562. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(collectColumn, (column, index, items, path, parentColumn) => {
  9563. const {
  9564. id: colid,
  9565. field
  9566. } = column;
  9567. const parentId = parentColumn ? parentColumn.id : null;
  9568. const rest = {
  9569. $index: -1,
  9570. _index: -1,
  9571. column,
  9572. colid,
  9573. index,
  9574. items,
  9575. parent: parentColumn || null,
  9576. width: 0,
  9577. oLeft: 0
  9578. };
  9579. column.parentId = parentId;
  9580. column.defaultParentId = parentId;
  9581. column.sortNumber = sortIndex;
  9582. column.renderSortNumber = sortIndex;
  9583. sortIndex++;
  9584. if (field) {
  9585. if (fullColFieldData[field]) {
  9586. errLog('vxe.error.colRepet', ['field', field]);
  9587. }
  9588. fullColFieldData[field] = rest;
  9589. }
  9590. fullColIdData[colid] = rest;
  9591. });
  9592. internalData.fullColumnIdData = fullColIdData;
  9593. internalData.fullColumnFieldData = fullColFieldData;
  9594. }
  9595. function handleInitColumn($xeTable, collectColumn) {
  9596. const props = $xeTable;
  9597. const $xeToolbar = $xeTable.$refs.$xeToolbar;
  9598. const reactData = $xeTable;
  9599. const internalData = $xeTable;
  9600. const expandOpts = $xeTable.computeExpandOpts;
  9601. internalData.collectColumn = collectColumn;
  9602. const tableFullColumn = getColumnList(collectColumn);
  9603. internalData.tableFullColumn = tableFullColumn;
  9604. reactData.isColLoading = true;
  9605. initColumnHierarchy($xeTable);
  9606. return Promise.resolve(restoreCustomStorage($xeTable)).then(() => {
  9607. const {
  9608. scrollXLoad,
  9609. scrollYLoad,
  9610. expandColumn
  9611. } = reactData;
  9612. cacheColumnMap($xeTable);
  9613. parseColumns($xeTable, true).then(() => {
  9614. if (reactData.scrollXLoad) {
  9615. loadScrollXData($xeTable);
  9616. }
  9617. });
  9618. $xeTable.clearMergeCells();
  9619. $xeTable.clearMergeFooterItems();
  9620. $xeTable.handleTableData(true);
  9621. $xeTable.handleAggregateSummaryData();
  9622. if ((scrollXLoad || scrollYLoad) && expandColumn && expandOpts.mode !== 'fixed') {
  9623. warnLog('vxe.error.scrollErrProp', ['column.type=expand']);
  9624. }
  9625. return $xeTable.$nextTick().then(() => {
  9626. if ($xeToolbar) {
  9627. $xeToolbar.syncUpdate({
  9628. collectColumn: internalData.collectColumn,
  9629. $table: $xeTable
  9630. });
  9631. }
  9632. if ($xeTable.handleUpdateCustomColumn) {
  9633. $xeTable.handleUpdateCustomColumn();
  9634. }
  9635. const columnOpts = $xeTable.computeColumnOpts;
  9636. if (props.showCustomHeader && reactData.isGroup && (columnOpts.resizable || props.resizable)) {
  9637. warnLog('vxe.error.notConflictProp', ['show-custom-header & colgroup', 'column-config.resizable=false']);
  9638. }
  9639. reactData.isColLoading = false;
  9640. return handleLazyRecalculate($xeTable, false, true, true);
  9641. });
  9642. });
  9643. }
  9644. /**
  9645. * 纵向 Y 可视渲染处理
  9646. */
  9647. function loadScrollYData($xeTable) {
  9648. const reactData = $xeTable;
  9649. const internalData = $xeTable;
  9650. const {
  9651. isAllOverflow,
  9652. isScrollYBig
  9653. } = reactData;
  9654. const {
  9655. mergeBodyList,
  9656. scrollYStore
  9657. } = internalData;
  9658. const {
  9659. preloadSize,
  9660. startIndex,
  9661. endIndex,
  9662. offsetSize
  9663. } = scrollYStore;
  9664. const autoOffsetYSize = isAllOverflow ? offsetSize : offsetSize + 1;
  9665. const {
  9666. toVisibleIndex,
  9667. visibleSize
  9668. } = handleVirtualYVisible($xeTable);
  9669. const offsetItem = {
  9670. startIndex: Math.max(0, isScrollYBig ? toVisibleIndex - 1 : toVisibleIndex - 1 - offsetSize - preloadSize),
  9671. endIndex: isScrollYBig ? toVisibleIndex + visibleSize : toVisibleIndex + visibleSize + autoOffsetYSize + preloadSize
  9672. };
  9673. scrollYStore.visibleStartIndex = toVisibleIndex - 1;
  9674. scrollYStore.visibleEndIndex = toVisibleIndex + visibleSize + 1;
  9675. calculateMergerOffsetIndex(mergeBodyList, offsetItem, 'row');
  9676. const {
  9677. startIndex: offsetStartIndex,
  9678. endIndex: offsetEndIndex
  9679. } = offsetItem;
  9680. if (toVisibleIndex <= startIndex || toVisibleIndex >= endIndex - visibleSize - 1) {
  9681. if (startIndex !== offsetStartIndex || endIndex !== offsetEndIndex) {
  9682. scrollYStore.startIndex = offsetStartIndex;
  9683. scrollYStore.endIndex = offsetEndIndex;
  9684. $xeTable.updateScrollYData();
  9685. }
  9686. }
  9687. }
  9688. const createGetRowCacheProp = prop => {
  9689. return function (row) {
  9690. const $xeTable = this;
  9691. const internalData = $xeTable;
  9692. const {
  9693. fullAllDataRowIdData
  9694. } = internalData;
  9695. if (row) {
  9696. const rowid = getRowid($xeTable, row);
  9697. const rowRest = fullAllDataRowIdData[rowid];
  9698. if (rowRest) {
  9699. return rowRest[prop];
  9700. }
  9701. }
  9702. return -1;
  9703. };
  9704. };
  9705. const createGetColumnCacheProp = prop => {
  9706. return function (column) {
  9707. const $xeTable = this;
  9708. const internalData = $xeTable;
  9709. const {
  9710. fullColumnIdData
  9711. } = internalData;
  9712. if (column) {
  9713. const colRest = fullColumnIdData[column.id];
  9714. if (colRest) {
  9715. return colRest[prop];
  9716. }
  9717. }
  9718. return -1;
  9719. };
  9720. };
  9721. function lazyScrollXData($xeTable) {
  9722. const internalData = $xeTable;
  9723. const {
  9724. lxTimeout,
  9725. lxRunTime,
  9726. scrollXStore
  9727. } = internalData;
  9728. const {
  9729. visibleSize
  9730. } = scrollXStore;
  9731. const fpsTime = visibleSize > 26 ? 26 : visibleSize > 16 ? 14 : 6;
  9732. if (lxTimeout) {
  9733. clearTimeout(lxTimeout);
  9734. }
  9735. if (!lxRunTime || lxRunTime + fpsTime < Date.now()) {
  9736. internalData.lxRunTime = Date.now();
  9737. loadScrollXData($xeTable);
  9738. }
  9739. internalData.lxTimeout = setTimeout(() => {
  9740. internalData.lxTimeout = undefined;
  9741. internalData.lxRunTime = undefined;
  9742. loadScrollXData($xeTable);
  9743. }, fpsTime);
  9744. }
  9745. function lazyScrollYData($xeTable) {
  9746. const internalData = $xeTable;
  9747. const {
  9748. lyTimeout,
  9749. lyRunTime,
  9750. scrollYStore
  9751. } = internalData;
  9752. const {
  9753. visibleSize
  9754. } = scrollYStore;
  9755. const fpsTime = visibleSize > 30 ? 32 : visibleSize > 20 ? 18 : 8;
  9756. if (lyTimeout) {
  9757. clearTimeout(lyTimeout);
  9758. }
  9759. if (!lyRunTime || lyRunTime + fpsTime < Date.now()) {
  9760. internalData.lyRunTime = Date.now();
  9761. loadScrollYData($xeTable);
  9762. }
  9763. internalData.lyTimeout = setTimeout(() => {
  9764. internalData.lyTimeout = undefined;
  9765. internalData.lyRunTime = undefined;
  9766. loadScrollYData($xeTable);
  9767. }, fpsTime);
  9768. }
  9769. function checkLastSyncScroll($xeTable, isRollX, isRollY) {
  9770. const reactData = $xeTable;
  9771. const internalData = $xeTable;
  9772. const {
  9773. lcsTimeout
  9774. } = internalData;
  9775. if (lcsTimeout) {
  9776. clearTimeout(lcsTimeout);
  9777. }
  9778. internalData.lcsTimeout = setTimeout(() => {
  9779. const {
  9780. scrollXLoad,
  9781. scrollYLoad,
  9782. isAllOverflow
  9783. } = reactData;
  9784. internalData.lcsRunTime = Date.now();
  9785. internalData.lcsTimeout = undefined;
  9786. internalData.intoRunScroll = false;
  9787. internalData.inVirtualScroll = false;
  9788. internalData.inWheelScroll = false;
  9789. internalData.inHeaderScroll = false;
  9790. internalData.inBodyScroll = false;
  9791. internalData.inFooterScroll = false;
  9792. internalData.scrollRenderType = '';
  9793. if (!isAllOverflow) {
  9794. calcCellHeight($xeTable);
  9795. updateRowOffsetTop($xeTable);
  9796. }
  9797. if (isRollX && scrollXLoad) {
  9798. $xeTable.updateScrollXData();
  9799. }
  9800. if (isRollY && scrollYLoad) {
  9801. $xeTable.updateScrollYData().then(() => {
  9802. if (!isAllOverflow) {
  9803. calcCellHeight($xeTable);
  9804. updateRowOffsetTop($xeTable);
  9805. }
  9806. $xeTable.updateScrollYSpace();
  9807. });
  9808. }
  9809. $xeTable.updateCellAreas();
  9810. }, 200);
  9811. }
  9812. const getWheelSpeed = lastScrollTime => {
  9813. let multiple = 1;
  9814. const currTime = Date.now();
  9815. if (lastScrollTime + 25 > currTime) {
  9816. multiple = 1.18;
  9817. } else if (lastScrollTime + 30 > currTime) {
  9818. multiple = 1.15;
  9819. } else if (lastScrollTime + 40 > currTime) {
  9820. multiple = 1.12;
  9821. } else if (lastScrollTime + 55 > currTime) {
  9822. multiple = 1.09;
  9823. } else if (lastScrollTime + 75 > currTime) {
  9824. multiple = 1.06;
  9825. } else if (lastScrollTime + 100 > currTime) {
  9826. multiple = 1.03;
  9827. }
  9828. return multiple;
  9829. };
  9830. const wheelScrollLeftTo = (scrollLeft, cb) => {
  9831. requestAnimationFrame(() => {
  9832. cb(scrollLeft);
  9833. });
  9834. };
  9835. const wheelScrollTopTo = (diffNum, cb) => {
  9836. const duration = Math.abs(diffNum);
  9837. const startTime = performance.now();
  9838. let countTop = 0;
  9839. const step = timestamp => {
  9840. let progress = (timestamp - startTime) / duration;
  9841. if (progress < 0) {
  9842. progress = 0;
  9843. } else if (progress > 1) {
  9844. progress = 1;
  9845. }
  9846. const easedProgress = Math.pow(progress, 2);
  9847. const offsetTop = Math.floor(diffNum * easedProgress) - countTop;
  9848. countTop += offsetTop;
  9849. cb(offsetTop);
  9850. if (progress < 1) {
  9851. requestAnimationFrame(step);
  9852. }
  9853. };
  9854. requestAnimationFrame(step);
  9855. };
  9856. const syncGanttScrollTop = ($xeTable, scrollTop) => {
  9857. const internalData = $xeTable;
  9858. const $xeGanttView = internalData.xeGanttView;
  9859. if ($xeGanttView) {
  9860. const ganttInternalData = $xeGanttView.internalData;
  9861. const {
  9862. elemStore: ganttElemStore
  9863. } = ganttInternalData;
  9864. const ganttBodyScrollElem = getRefElem(ganttElemStore['main-body-scroll']);
  9865. if (ganttBodyScrollElem) {
  9866. ganttBodyScrollElem.scrollTop = scrollTop;
  9867. }
  9868. }
  9869. };
  9870. function updateHeight($xeTable) {
  9871. const reactData = $xeTable;
  9872. const internalData = $xeTable;
  9873. internalData.customHeight = calcTableHeight($xeTable, 'height');
  9874. internalData.customMinHeight = calcTableHeight($xeTable, 'minHeight');
  9875. internalData.customMaxHeight = calcTableHeight($xeTable, 'maxHeight');
  9876. // 如果启用虚拟滚动,默认高度
  9877. if (reactData.scrollYLoad && !(internalData.customHeight || internalData.customMinHeight)) {
  9878. internalData.customHeight = 300;
  9879. }
  9880. }
  9881. function calcColumnAutoWidth($xeTable, column, wrapperEl) {
  9882. const columnOpts = $xeTable.computeColumnOpts;
  9883. const {
  9884. autoOptions
  9885. } = columnOpts;
  9886. const {
  9887. isCalcHeader,
  9888. isCalcBody,
  9889. isCalcFooter
  9890. } = autoOptions || {};
  9891. const querySelections = [];
  9892. if (isCalcHeader) {
  9893. querySelections.push(`.vxe-header-cell--wrapper[colid="${column.id}"]`);
  9894. }
  9895. if (isCalcBody) {
  9896. querySelections.push(`.vxe-body-cell--wrapper[colid="${column.id}"]`);
  9897. }
  9898. if (isCalcFooter) {
  9899. querySelections.push(`.vxe-footer-cell--wrapper[colid="${column.id}"]`);
  9900. }
  9901. const cellElemList = querySelections.length ? wrapperEl.querySelectorAll(querySelections.join(',')) : [];
  9902. let leftRightPadding = 0;
  9903. const firstCellEl = cellElemList[0];
  9904. if (firstCellEl && firstCellEl.parentElement) {
  9905. const cellStyle = getComputedStyle(firstCellEl.parentElement);
  9906. leftRightPadding = Math.ceil(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(cellStyle.paddingLeft) + external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(cellStyle.paddingRight));
  9907. }
  9908. let colWidth = column.renderAutoWidth - leftRightPadding;
  9909. for (let i = 0; i < cellElemList.length; i++) {
  9910. const celEl = cellElemList[i];
  9911. colWidth = Math.max(colWidth, celEl ? Math.ceil(celEl.scrollWidth) + 4 : 0);
  9912. }
  9913. return colWidth + leftRightPadding;
  9914. }
  9915. function calcCellWidth($xeTable) {
  9916. const internalData = $xeTable;
  9917. const autoWidthColumnList = $xeTable.computeAutoWidthColumnList;
  9918. const {
  9919. fullColumnIdData
  9920. } = internalData;
  9921. const el = $xeTable.$refs.refElem;
  9922. if (el) {
  9923. el.setAttribute('data-calc-col', 'Y');
  9924. autoWidthColumnList.forEach(column => {
  9925. const colid = column.id;
  9926. const colRest = fullColumnIdData[colid];
  9927. const colWidth = calcColumnAutoWidth($xeTable, column, el);
  9928. if (colRest) {
  9929. colRest.width = Math.max(colWidth, colRest.width);
  9930. }
  9931. column.renderAutoWidth = colWidth;
  9932. });
  9933. $xeTable.analyColumnWidth();
  9934. el.removeAttribute('data-calc-col');
  9935. }
  9936. }
  9937. function handleUpdateColResize($xeTable, evnt, params) {
  9938. $xeTable.analyColumnWidth();
  9939. $xeTable.recalculate().then(() => {
  9940. $xeTable.saveCustomStore('update:width');
  9941. $xeTable.updateCellAreas();
  9942. $xeTable.dispatchEvent('column-resizable-change', params, evnt);
  9943. // 已废弃 resizable-change
  9944. $xeTable.dispatchEvent('resizable-change', params, evnt);
  9945. setTimeout(() => $xeTable.recalculate(true), 300);
  9946. });
  9947. }
  9948. function handleUpdateRowResize($xeTable, evnt, params) {
  9949. const reactData = $xeTable;
  9950. reactData.resizeHeightFlag++;
  9951. $xeTable.recalculate().then(() => {
  9952. $xeTable.updateCellAreas();
  9953. $xeTable.dispatchEvent('row-resizable-change', params, evnt);
  9954. setTimeout(() => $xeTable.recalculate(true), 300);
  9955. });
  9956. }
  9957. function updateColumnOffsetLeft($xeTable) {
  9958. const internalData = $xeTable;
  9959. const {
  9960. visibleColumn,
  9961. fullColumnIdData
  9962. } = internalData;
  9963. let offsetLeft = 0;
  9964. for (let cIndex = 0, rLen = visibleColumn.length; cIndex < rLen; cIndex++) {
  9965. const column = visibleColumn[cIndex];
  9966. const colid = column.id;
  9967. const colRest = fullColumnIdData[colid];
  9968. if (colRest) {
  9969. colRest.oLeft = offsetLeft;
  9970. }
  9971. offsetLeft += column.renderWidth;
  9972. }
  9973. }
  9974. function updateRowOffsetTop($xeTable) {
  9975. const reactData = $xeTable;
  9976. const internalData = $xeTable;
  9977. const {
  9978. expandColumn
  9979. } = reactData;
  9980. const {
  9981. afterFullData,
  9982. fullAllDataRowIdData,
  9983. rowExpandedMaps
  9984. } = internalData;
  9985. const expandOpts = $xeTable.computeExpandOpts;
  9986. const rowOpts = $xeTable.computeRowOpts;
  9987. const cellOpts = $xeTable.computeCellOpts;
  9988. const defaultRowHeight = $xeTable.computeDefaultRowHeight;
  9989. const {
  9990. handleGetRowId
  9991. } = createHandleGetRowId($xeTable);
  9992. let offsetTop = 0;
  9993. for (let rIndex = 0, rLen = afterFullData.length; rIndex < rLen; rIndex++) {
  9994. const row = afterFullData[rIndex];
  9995. const rowid = handleGetRowId(row);
  9996. const rowRest = fullAllDataRowIdData[rowid] || {};
  9997. rowRest.oTop = offsetTop;
  9998. offsetTop += rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight;
  9999. // 是否展开行
  10000. if (expandColumn && rowExpandedMaps[rowid]) {
  10001. offsetTop += rowRest.expandHeight || expandOpts.height || 0;
  10002. }
  10003. }
  10004. }
  10005. /**
  10006. * 更新展开行样式
  10007. */
  10008. function updateRowExpandStyle($xeTable) {
  10009. const reactData = $xeTable;
  10010. const internalData = $xeTable;
  10011. const {
  10012. expandColumn,
  10013. scrollYLoad,
  10014. scrollYTop,
  10015. isScrollYBig
  10016. } = reactData;
  10017. const expandOpts = $xeTable.computeExpandOpts;
  10018. const rowOpts = $xeTable.computeRowOpts;
  10019. const cellOpts = $xeTable.computeCellOpts;
  10020. const defaultRowHeight = $xeTable.computeDefaultRowHeight;
  10021. const {
  10022. mode
  10023. } = expandOpts;
  10024. if (expandColumn && mode === 'fixed') {
  10025. const {
  10026. elemStore,
  10027. fullAllDataRowIdData
  10028. } = internalData;
  10029. const rowExpandEl = $xeTable.$refs.refRowExpandElem;
  10030. const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
  10031. if (rowExpandEl && bodyScrollElem) {
  10032. let isUpdateHeight = false;
  10033. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayEach(rowExpandEl.children, reEl => {
  10034. const expandEl = reEl;
  10035. const rowid = expandEl.getAttribute('rowid') || '';
  10036. const rowRest = fullAllDataRowIdData[rowid];
  10037. if (rowRest) {
  10038. const expandHeight = expandEl.offsetHeight + 1;
  10039. const trEl = bodyScrollElem.querySelector(`.vxe-body--row[rowid="${rowid}"]`);
  10040. let offsetTop = 0;
  10041. if (scrollYLoad) {
  10042. if (isScrollYBig && trEl) {
  10043. offsetTop = trEl.offsetTop + trEl.offsetHeight;
  10044. } else {
  10045. offsetTop = rowRest.oTop + (rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight);
  10046. }
  10047. } else {
  10048. if (trEl) {
  10049. offsetTop = trEl.offsetTop + trEl.offsetHeight;
  10050. }
  10051. }
  10052. if (isScrollYBig) {
  10053. offsetTop += scrollYTop;
  10054. }
  10055. expandEl.style.top = toCssUnit(offsetTop);
  10056. if (!isUpdateHeight) {
  10057. if (rowRest.expandHeight !== expandHeight) {
  10058. isUpdateHeight = true;
  10059. }
  10060. }
  10061. rowRest.expandHeight = expandHeight;
  10062. }
  10063. });
  10064. if (isUpdateHeight) {
  10065. reactData.rowExpandHeightFlag++;
  10066. $xeTable.$nextTick(() => {
  10067. updateRowOffsetTop($xeTable);
  10068. });
  10069. }
  10070. }
  10071. }
  10072. }
  10073. /**
  10074. * 更新树连接线样式
  10075. */
  10076. // eslint-disable-next-line @typescript-eslint/no-unused-vars
  10077. function updateTreeLineStyle($xeTable) {
  10078. // 待优化
  10079. }
  10080. function handleRowExpandScroll($xeTable) {
  10081. const internalData = $xeTable;
  10082. const {
  10083. elemStore
  10084. } = internalData;
  10085. const rowExpandEl = $xeTable.$refs.refRowExpandElem;
  10086. const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
  10087. if (rowExpandEl && bodyScrollElem) {
  10088. rowExpandEl.scrollTop = bodyScrollElem.scrollTop;
  10089. }
  10090. }
  10091. const Methods = {
  10092. callSlot(slotFunc, params, h, vNodes) {
  10093. const $xeTable = this;
  10094. // const slots = $xeTable.$scopedSlots
  10095. const $xeGrid = $xeTable.$xeGrid;
  10096. const $xeGantt = $xeTable.$xeGantt;
  10097. const $xeGGWrapper = $xeGrid || $xeGantt;
  10098. if (slotFunc) {
  10099. if ($xeGGWrapper) {
  10100. return $xeGGWrapper.callSlot(slotFunc, params, h);
  10101. }
  10102. // if (XEUtils.isString(slotFunc)) {
  10103. // slotFunc = slots[slotFunc] || null
  10104. // }
  10105. if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(slotFunc)) {
  10106. return getSlotVNs(slotFunc.call(this, params, h, vNodes));
  10107. }
  10108. }
  10109. return [];
  10110. },
  10111. getEl() {
  10112. const $xeTable = this;
  10113. return $xeTable.$refs.refElem;
  10114. },
  10115. /**
  10116. * 获取父容器元素
  10117. */
  10118. getParentElem() {
  10119. const $xeTable = this;
  10120. const $xeGrid = $xeTable.$xeGrid;
  10121. const $xeGantt = $xeTable.$xeGantt;
  10122. const $xeGGWrapper = $xeGrid || $xeGantt;
  10123. const {
  10124. $el
  10125. } = this;
  10126. return $xeGGWrapper ? $xeGGWrapper.$el.parentNode : $el.parentNode;
  10127. },
  10128. /**
  10129. * 获取父容器的高度
  10130. */
  10131. getParentHeight() {
  10132. const $xeTable = this;
  10133. const $xeGrid = $xeTable.$xeGrid;
  10134. const $xeGantt = $xeTable.$xeGantt;
  10135. const props = $xeTable;
  10136. const {
  10137. height
  10138. } = props;
  10139. const el = $xeTable.$refs.refElem;
  10140. if (el) {
  10141. const parentElem = el.parentNode;
  10142. const parentPaddingSize = height === '100%' || height === 'auto' ? getPaddingTopBottomSize(parentElem) : 0;
  10143. let parentWrapperHeight = 0;
  10144. if (parentElem) {
  10145. if ($xeGantt && hasClass(parentElem, 'vxe-gantt--table-wrapper')) {
  10146. parentWrapperHeight = $xeGantt.getParentHeight();
  10147. } else if ($xeGrid && hasClass(parentElem, 'vxe-grid--table-wrapper')) {
  10148. parentWrapperHeight = $xeGrid.getParentHeight();
  10149. } else {
  10150. parentWrapperHeight = parentElem.clientHeight;
  10151. }
  10152. }
  10153. return Math.floor(parentWrapperHeight - parentPaddingSize);
  10154. }
  10155. return 0;
  10156. },
  10157. /**
  10158. * 获取需要排除的高度
  10159. * 但渲染表格高度时,需要排除工具栏或分页等相关组件的高度
  10160. * 如果存在表尾合计滚动条,则需要排除滚动条高度
  10161. */
  10162. getExcludeHeight() {
  10163. const $xeTable = this;
  10164. const $xeGrid = $xeTable.$xeGrid;
  10165. const $xeGantt = $xeTable.$xeGantt;
  10166. const $xeGGWrapper = $xeGrid || $xeGantt;
  10167. return $xeGGWrapper ? $xeGGWrapper.getExcludeHeight() : 0;
  10168. },
  10169. /**
  10170. * 重置表格的一切数据状态
  10171. */
  10172. clearAll() {
  10173. return clearTableAllStatus(this);
  10174. },
  10175. handleUpdateRowGroup(groupFields) {
  10176. const $xeTable = this;
  10177. handleUpdateRowGroup($xeTable, groupFields);
  10178. },
  10179. /**
  10180. * 同步 data 数据(即将废弃)
  10181. * 如果用了该方法,那么组件将不再记录增删改的状态,只能自行实现对应逻辑
  10182. * 对于某些特殊的场景,比如深层树节点元素发生变动时可能会用到
  10183. */
  10184. syncData() {
  10185. const $xeTable = this;
  10186. const reactData = $xeTable;
  10187. const internalData = $xeTable;
  10188. errLog('vxe.error.delFunc', ['syncData', 'getData']);
  10189. return $xeTable.$nextTick().then(() => {
  10190. reactData.tableData = [];
  10191. return $xeTable.$nextTick().then(() => loadTableData($xeTable, internalData.tableFullData, true));
  10192. });
  10193. },
  10194. /**
  10195. * 手动处理数据,用于手动排序与筛选
  10196. * 对于手动更改了排序、筛选...等条件后需要重新处理数据时可能会用到
  10197. */
  10198. updateData() {
  10199. const $xeTable = this;
  10200. const reactData = $xeTable;
  10201. const {
  10202. scrollXLoad,
  10203. scrollYLoad
  10204. } = reactData;
  10205. return $xeTable.handleTableData(true).then(() => {
  10206. $xeTable.updateFooter();
  10207. if (scrollXLoad || scrollYLoad) {
  10208. if (scrollXLoad) {
  10209. $xeTable.updateScrollXSpace();
  10210. }
  10211. if (scrollYLoad) {
  10212. $xeTable.updateScrollYSpace();
  10213. }
  10214. return $xeTable.refreshScroll();
  10215. }
  10216. }).then(() => {
  10217. $xeTable.updateCellAreas();
  10218. return handleLazyRecalculate($xeTable, true, true, true);
  10219. }).then(() => {
  10220. // 存在滚动行为未结束情况
  10221. setTimeout(() => handleLazyRecalculate($xeTable, false, true, true), 50);
  10222. });
  10223. },
  10224. handleTableData(force) {
  10225. const $xeTable = this;
  10226. const reactData = $xeTable;
  10227. const internalData = $xeTable;
  10228. const {
  10229. scrollYLoad
  10230. } = reactData;
  10231. const {
  10232. scrollYStore,
  10233. fullDataRowIdData
  10234. } = internalData;
  10235. const $xeGanttView = internalData.xeGanttView;
  10236. let fullList = internalData.afterFullData;
  10237. // 是否进行数据处理
  10238. if (force) {
  10239. // 更新数据,处理筛选和排序
  10240. updateAfterFullData($xeTable);
  10241. // 如果为虚拟树,将树结构拍平
  10242. fullList = handleVirtualTreeToList($xeTable);
  10243. }
  10244. const tableData = scrollYLoad ? fullList.slice(scrollYStore.startIndex, scrollYStore.endIndex) : fullList.slice(0);
  10245. const visibleDataRowIdMaps = {};
  10246. tableData.forEach((row, $index) => {
  10247. const rowid = getRowid($xeTable, row);
  10248. const rest = fullDataRowIdData[rowid];
  10249. if (rest) {
  10250. rest.$index = $index;
  10251. }
  10252. visibleDataRowIdMaps[rowid] = row;
  10253. });
  10254. reactData.tableData = tableData;
  10255. internalData.visibleDataRowIdData = visibleDataRowIdMaps;
  10256. if ($xeGanttView && $xeGanttView.updateViewData) {
  10257. $xeGanttView.updateViewData();
  10258. }
  10259. return $xeTable.$nextTick();
  10260. },
  10261. /**
  10262. * 加载表格数据
  10263. * @param {Array} datas 数据
  10264. */
  10265. loadTableData(datas, isReset) {
  10266. const $xeTable = this;
  10267. return loadTableData($xeTable, datas, isReset);
  10268. },
  10269. /**
  10270. * 重新加载数据,不会清空表格状态
  10271. * @param {Array} datas 数据
  10272. */
  10273. loadData(datas) {
  10274. const $xeTable = this;
  10275. const {
  10276. initStatus
  10277. } = this;
  10278. return loadTableData($xeTable, datas, false).then(() => {
  10279. this.inited = true;
  10280. this.initStatus = true;
  10281. if (!initStatus) {
  10282. handleLoadDefaults($xeTable);
  10283. }
  10284. return handleLazyRecalculate($xeTable, false, true, true);
  10285. });
  10286. },
  10287. /**
  10288. * 重新加载数据,会清空表格状态
  10289. * @param {Array} datas 数据
  10290. */
  10291. reloadData(datas) {
  10292. const $xeTable = this;
  10293. return this.clearAll().then(() => {
  10294. this.inited = true;
  10295. this.initStatus = true;
  10296. return loadTableData($xeTable, datas, true);
  10297. }).then(() => {
  10298. handleLoadDefaults($xeTable);
  10299. return handleLazyRecalculate($xeTable, false, true, true);
  10300. });
  10301. },
  10302. /**
  10303. * 修改行数据
  10304. */
  10305. setRow(rows, record) {
  10306. if (record) {
  10307. let rest = rows;
  10308. if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(rows)) {
  10309. rest = [rows];
  10310. }
  10311. rest.forEach(item => Object.assign(item, record));
  10312. }
  10313. return this.$nextTick();
  10314. },
  10315. /**
  10316. * 局部加载行数据并恢复到初始状态
  10317. * 对于行数据需要局部更改的场景中可能会用到
  10318. * @param {Row} row 行对象
  10319. * @param {Object} record 新数据
  10320. * @param {String} field 字段名
  10321. */
  10322. reloadRow(row, record, field) {
  10323. const $xeTable = this;
  10324. const props = $xeTable;
  10325. const reactData = $xeTable;
  10326. const internalData = $xeTable;
  10327. const {
  10328. keepSource
  10329. } = props;
  10330. const {
  10331. tableData
  10332. } = reactData;
  10333. const {
  10334. sourceDataRowIdData
  10335. } = internalData;
  10336. if (keepSource) {
  10337. if ($xeTable.isAggregateRecord(row)) {
  10338. return $xeTable.$nextTick();
  10339. }
  10340. const oRow = sourceDataRowIdData[getRowid($xeTable, row)];
  10341. if (oRow && row) {
  10342. if (field) {
  10343. const newValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().clone(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(record || row, field), true);
  10344. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(row, field, newValue);
  10345. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(oRow, field, newValue);
  10346. } else {
  10347. const rowkey = getRowkey($xeTable);
  10348. const rowid = getRowid($xeTable, row);
  10349. const newRecord = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().clone(Object.assign({}, record), true);
  10350. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(newRecord, rowkey, rowid);
  10351. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().destructuring(oRow, Object.assign(row, newRecord));
  10352. }
  10353. }
  10354. reactData.tableData = tableData.slice(0);
  10355. } else {
  10356. errLog('vxe.error.reqProp', ['keep-source']);
  10357. }
  10358. return $xeTable.$nextTick();
  10359. },
  10360. /**
  10361. * 加载列配置
  10362. * 对于表格列需要重载、局部递增场景下可能会用到
  10363. * @param {ColumnInfo} columns 列配置
  10364. */
  10365. loadColumn(columns) {
  10366. const $xeTable = this;
  10367. const internalData = $xeTable;
  10368. const {
  10369. lastScrollLeft,
  10370. lastScrollTop
  10371. } = internalData;
  10372. const collectColumn = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().mapTree(columns, column => cell.createColumn($xeTable, column), {
  10373. children: 'children'
  10374. });
  10375. return handleInitColumn($xeTable, collectColumn).then(() => {
  10376. let targetScrollLeft = lastScrollLeft;
  10377. let targetScrollTop = lastScrollTop;
  10378. const virtualXOpts = $xeTable.computeVirtualXOpts;
  10379. const virtualYOpts = $xeTable.computeVirtualYOpts;
  10380. // 是否在更新数据之后自动滚动重置滚动条
  10381. if (virtualXOpts.scrollToLeftOnChange) {
  10382. targetScrollLeft = 0;
  10383. }
  10384. if (virtualYOpts.scrollToTopOnChange) {
  10385. targetScrollTop = 0;
  10386. }
  10387. restoreScrollLocation($xeTable, targetScrollLeft, targetScrollTop);
  10388. });
  10389. },
  10390. /**
  10391. * 加载列配置并恢复到初始状态
  10392. * 对于表格列需要重载、局部递增场景下可能会用到
  10393. * @param {ColumnInfo} columns 列配置
  10394. */
  10395. reloadColumn(columns) {
  10396. return this.clearAll().then(() => {
  10397. return this.loadColumn(columns);
  10398. });
  10399. },
  10400. handleInitColumn(collectColumn) {
  10401. const $xeTable = this;
  10402. return handleInitColumn($xeTable, collectColumn);
  10403. },
  10404. /**
  10405. * 更新数据行的 Map
  10406. */
  10407. cacheRowMap(isReset) {
  10408. const $xeTable = this;
  10409. const props = $xeTable;
  10410. const reactData = $xeTable;
  10411. const internalData = $xeTable;
  10412. const {
  10413. treeConfig
  10414. } = props;
  10415. const {
  10416. isRowGroupStatus
  10417. } = reactData;
  10418. const {
  10419. currKeyField,
  10420. fullAllDataRowIdData,
  10421. tableFullData,
  10422. tableFullTreeData,
  10423. tableFullGroupData,
  10424. treeExpandedMaps
  10425. } = internalData;
  10426. const fullAllDataRowIdMaps = isReset ? {} : {
  10427. ...fullAllDataRowIdData
  10428. }; // 存在已删除数据
  10429. const fullDataRowIdMaps = {};
  10430. const idMaps = {};
  10431. const {
  10432. handleUpdateRowId
  10433. } = createHandleUpdateRowId($xeTable);
  10434. const handleRowCache = (row, index, items, currIndex, parentRow, rowid, level, seq) => {
  10435. let rowRest = fullAllDataRowIdMaps[rowid];
  10436. if (idMaps[rowid]) {
  10437. errLog('vxe.error.repeatKey', [currKeyField, rowid]);
  10438. }
  10439. if (!rowRest) {
  10440. rowRest = {
  10441. row,
  10442. rowid,
  10443. seq,
  10444. index: -1,
  10445. _index: -1,
  10446. $index: -1,
  10447. treeIndex: index,
  10448. _tIndex: -1,
  10449. items,
  10450. parent: parentRow,
  10451. level,
  10452. height: 0,
  10453. resizeHeight: 0,
  10454. oTop: 0,
  10455. expandHeight: 0
  10456. };
  10457. }
  10458. rowRest.treeLoaded = false;
  10459. rowRest.expandLoaded = false;
  10460. rowRest.row = row;
  10461. rowRest.items = items;
  10462. rowRest.parent = parentRow;
  10463. rowRest.level = level;
  10464. rowRest.index = currIndex;
  10465. rowRest.treeIndex = index;
  10466. idMaps[rowid] = true;
  10467. fullDataRowIdMaps[rowid] = rowRest;
  10468. fullAllDataRowIdMaps[rowid] = rowRest;
  10469. };
  10470. if (treeConfig) {
  10471. const treeOpts = $xeTable.computeTreeOpts;
  10472. const {
  10473. lazy
  10474. } = treeOpts;
  10475. const childrenField = treeOpts.children || treeOpts.childrenField;
  10476. const hasChildField = treeOpts.hasChild || treeOpts.hasChildField;
  10477. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(tableFullTreeData, (row, index, items, path, parentRow, nodes) => {
  10478. const rowid = handleUpdateRowId(row);
  10479. if (treeConfig && lazy) {
  10480. if (row[hasChildField] && row[childrenField] === undefined) {
  10481. row[childrenField] = null;
  10482. }
  10483. if (treeExpandedMaps[rowid]) {
  10484. if (!row[childrenField] || !row[childrenField].length) {
  10485. delete treeExpandedMaps[rowid];
  10486. }
  10487. }
  10488. }
  10489. handleRowCache(row, index, items, parentRow ? -1 : index, parentRow, rowid, nodes.length - 1, toTreePathSeq(path));
  10490. }, {
  10491. children: childrenField
  10492. });
  10493. } else if (isRowGroupStatus) {
  10494. const aggregateOpts = $xeTable.computeAggregateOpts;
  10495. const {
  10496. mapChildrenField
  10497. } = aggregateOpts;
  10498. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(tableFullGroupData, (row, index, items, path, parentRow, nodes) => {
  10499. const rowid = handleUpdateRowId(row);
  10500. handleRowCache(row, index, items, parentRow ? -1 : index, parentRow, rowid, nodes.length - 1, toTreePathSeq(path));
  10501. }, {
  10502. children: mapChildrenField
  10503. });
  10504. } else {
  10505. tableFullData.forEach((row, index, items) => {
  10506. handleRowCache(row, index, items, index, null, handleUpdateRowId(row), 0, index + 1);
  10507. });
  10508. }
  10509. internalData.fullDataRowIdData = fullDataRowIdMaps;
  10510. internalData.fullAllDataRowIdData = fullAllDataRowIdMaps;
  10511. reactData.treeExpandedFlag++;
  10512. },
  10513. cacheSourceMap(fullData) {
  10514. const $xeTable = this;
  10515. const props = $xeTable;
  10516. const internalData = $xeTable;
  10517. const {
  10518. treeConfig
  10519. } = props;
  10520. const treeOpts = $xeTable.computeTreeOpts;
  10521. const sourceData = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().clone(fullData, true);
  10522. const {
  10523. handleUpdateRowId
  10524. } = createHandleUpdateRowId($xeTable);
  10525. const sourceRowIdData = {};
  10526. const handleSourceRow = row => {
  10527. const rowid = handleUpdateRowId(row);
  10528. sourceRowIdData[rowid] = row;
  10529. };
  10530. // 源数据缓存
  10531. if (treeConfig) {
  10532. const childrenField = treeOpts.children || treeOpts.childrenField;
  10533. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(sourceData, handleSourceRow, {
  10534. children: treeOpts.transform ? treeOpts.mapChildrenField : childrenField
  10535. });
  10536. } else {
  10537. sourceData.forEach(handleSourceRow);
  10538. }
  10539. internalData.sourceDataRowIdData = sourceRowIdData;
  10540. internalData.tableSourceData = sourceData;
  10541. },
  10542. getParams() {
  10543. const $xeTable = this;
  10544. const props = $xeTable;
  10545. return props.params;
  10546. },
  10547. loadTreeChildren(row, childRecords) {
  10548. const $xeTable = this;
  10549. const props = $xeTable;
  10550. const internalData = $xeTable;
  10551. const {
  10552. keepSource
  10553. } = props;
  10554. const {
  10555. tableSourceData,
  10556. fullDataRowIdData,
  10557. fullAllDataRowIdData,
  10558. sourceDataRowIdData
  10559. } = internalData;
  10560. const treeOpts = $xeTable.computeTreeOpts;
  10561. const {
  10562. transform,
  10563. mapChildrenField
  10564. } = treeOpts;
  10565. const childrenField = treeOpts.children || treeOpts.childrenField;
  10566. const parentRest = fullAllDataRowIdData[getRowid($xeTable, row)];
  10567. const parentLevel = parentRest ? parentRest.level : 0;
  10568. return this.createData(childRecords).then(rows => {
  10569. if (keepSource) {
  10570. const rowid = getRowid(this, row);
  10571. const matchObj = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findTree(tableSourceData, item => rowid === getRowid(this, item), {
  10572. children: childrenField
  10573. });
  10574. if (matchObj) {
  10575. matchObj.item[childrenField] = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().clone(rows, true);
  10576. }
  10577. rows.forEach(childRow => {
  10578. const rowid = getRowid(this, childRow);
  10579. sourceDataRowIdData[rowid] = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().clone(childRow, true);
  10580. });
  10581. }
  10582. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(rows, (childRow, index, items, path, parentItem, nodes) => {
  10583. const rowid = getRowid($xeTable, childRow);
  10584. const parentRow = parentItem || parentRest.row;
  10585. const rest = {
  10586. row: childRow,
  10587. rowid,
  10588. seq: -1,
  10589. index,
  10590. _index: -1,
  10591. $index: -1,
  10592. treeIndex: -1,
  10593. _tIndex: -1,
  10594. items,
  10595. parent: parentRow,
  10596. level: parentLevel + nodes.length,
  10597. height: 0,
  10598. resizeHeight: 0,
  10599. oTop: 0,
  10600. expandHeight: 0
  10601. };
  10602. fullDataRowIdData[rowid] = rest;
  10603. fullAllDataRowIdData[rowid] = rest;
  10604. }, {
  10605. children: childrenField
  10606. });
  10607. row[childrenField] = rows;
  10608. if (transform) {
  10609. row[mapChildrenField] = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().clone(rows, false);
  10610. }
  10611. updateAfterDataIndex($xeTable);
  10612. return rows;
  10613. });
  10614. },
  10615. /**
  10616. * 根据 tr 元素获取对应的 row 信息
  10617. * @param {Element} tr 元素
  10618. */
  10619. getRowNode(tr) {
  10620. const $xeTable = this;
  10621. const internalData = $xeTable;
  10622. if (tr) {
  10623. const {
  10624. fullAllDataRowIdData
  10625. } = internalData;
  10626. const rowid = tr.getAttribute('rowid');
  10627. if (rowid) {
  10628. const rowRest = fullAllDataRowIdData[rowid];
  10629. if (rowRest) {
  10630. return {
  10631. rowid: rowRest.rowid,
  10632. item: rowRest.row,
  10633. index: rowRest.index,
  10634. items: rowRest.items,
  10635. parent: rowRest.parent
  10636. };
  10637. }
  10638. }
  10639. }
  10640. return null;
  10641. },
  10642. /**
  10643. * 根据 th/td 元素获取对应的 column 信息
  10644. * @param {Element} cell 元素
  10645. */
  10646. getColumnNode(cell) {
  10647. const $xeTable = this;
  10648. const internalData = $xeTable;
  10649. if (cell) {
  10650. const {
  10651. fullColumnIdData
  10652. } = internalData;
  10653. const colid = cell.getAttribute('colid');
  10654. if (colid) {
  10655. const colRest = fullColumnIdData[colid];
  10656. if (colRest) {
  10657. return {
  10658. colid: colRest.colid,
  10659. item: colRest.column,
  10660. index: colRest.index,
  10661. items: colRest.items,
  10662. parent: colRest.parent
  10663. };
  10664. }
  10665. }
  10666. }
  10667. return null;
  10668. },
  10669. /**
  10670. * 根据 row 获取序号
  10671. * @param {Row} row 行对象
  10672. */
  10673. getRowSeq: createGetRowCacheProp('seq'),
  10674. /**
  10675. * 根据 row 获取相对于 data 中的索引
  10676. * @param {Row} row 行对象
  10677. */
  10678. getRowIndex: createGetRowCacheProp('index'),
  10679. /**
  10680. * 根据 row 获取相对于当前数据中的索引
  10681. * @param {Row} row 行对象
  10682. */
  10683. getVTRowIndex: createGetRowCacheProp('_index'),
  10684. /**
  10685. * 根据 row 获取渲染中的虚拟索引
  10686. * @param {Row} row 行对象
  10687. */
  10688. getVMRowIndex: createGetRowCacheProp('$index'),
  10689. // 在 v3 中废弃
  10690. _getRowIndex(row) {
  10691. warnLog('vxe.error.delFunc', ['_getRowIndex', 'getVTRowIndex']);
  10692. return this.getVTRowIndex(row);
  10693. },
  10694. // 在 v3 中废弃
  10695. $getRowIndex(row) {
  10696. warnLog('vxe.error.delFunc', ['$getRowIndex', 'getVMRowIndex']);
  10697. return this.getVMRowIndex(row);
  10698. },
  10699. /**
  10700. * 根据 column 获取相对于 columns 中的索引
  10701. * @param {ColumnInfo} column 列配置
  10702. */
  10703. getColumnIndex: createGetColumnCacheProp('index'),
  10704. /**
  10705. * 根据 column 获取相对于当前表格列中的索引
  10706. * @param {ColumnInfo} column 列配置
  10707. */
  10708. getVTColumnIndex: createGetColumnCacheProp('_index'),
  10709. /**
  10710. * 根据 column 获取渲染中的虚拟索引
  10711. * @param {ColumnInfo} column 列配置
  10712. */
  10713. getVMColumnIndex: createGetColumnCacheProp('$index'),
  10714. // 在 v3 中废弃
  10715. _getColumnIndex(column) {
  10716. warnLog('vxe.error.delFunc', ['_getColumnIndex', 'getVTColumnIndex']);
  10717. return this.getVTColumnIndex(column);
  10718. },
  10719. // 在 v3 中废弃
  10720. $getColumnIndex(column) {
  10721. warnLog('vxe.error.delFunc', ['$getColumnIndex', 'getVMColumnIndex']);
  10722. return this.getVMColumnIndex(column);
  10723. },
  10724. /**
  10725. * 判断是否为索引列
  10726. * @param {ColumnInfo} column 列配置
  10727. */
  10728. isSeqColumn(column) {
  10729. return column && column.type === 'seq';
  10730. },
  10731. /**
  10732. * 定义行数据中的列属性,如果不存在则定义
  10733. * @param {Row} records 行数据
  10734. */
  10735. defineField(records) {
  10736. const $xeTable = this;
  10737. const props = $xeTable;
  10738. const internalData = $xeTable;
  10739. const {
  10740. treeConfig
  10741. } = props;
  10742. const expandOpts = $xeTable.computeExpandOpts;
  10743. const treeOpts = $xeTable.computeTreeOpts;
  10744. const radioOpts = $xeTable.computeRadioOpts;
  10745. const checkboxOpts = $xeTable.computeCheckboxOpts;
  10746. const childrenField = treeOpts.children || treeOpts.childrenField;
  10747. const rowkey = getRowkey($xeTable);
  10748. if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(records)) {
  10749. records = [records || {}];
  10750. }
  10751. return records.map(record => {
  10752. internalData.tableFullColumn.forEach(column => {
  10753. const {
  10754. field,
  10755. editRender
  10756. } = column;
  10757. if (field && !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().has(record, field)) {
  10758. let cellValue = null;
  10759. if (editRender) {
  10760. const {
  10761. defaultValue
  10762. } = editRender;
  10763. if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(defaultValue)) {
  10764. cellValue = defaultValue({
  10765. column
  10766. });
  10767. } else if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isUndefined(defaultValue)) {
  10768. cellValue = defaultValue;
  10769. }
  10770. }
  10771. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(record, field, cellValue);
  10772. }
  10773. });
  10774. const otherFields = [radioOpts.labelField, checkboxOpts.checkField, checkboxOpts.labelField, expandOpts.labelField];
  10775. otherFields.forEach(key => {
  10776. if (key && eqEmptyValue(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(record, key))) {
  10777. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(record, key, null);
  10778. }
  10779. });
  10780. if (treeConfig && treeOpts.lazy && external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isUndefined(record[childrenField])) {
  10781. record[childrenField] = null;
  10782. }
  10783. // 必须有行数据的唯一主键,可以自行设置;也可以默认生成一个随机数
  10784. if (eqEmptyValue(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(record, rowkey))) {
  10785. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(record, rowkey, getRowUniqueId());
  10786. }
  10787. return record;
  10788. });
  10789. },
  10790. /**
  10791. * 创建 data 对象
  10792. * 对于某些特殊场景可能会用到,会自动对数据的字段名进行检测,如果不存在就自动定义
  10793. * @param {Array} records 新数据
  10794. */
  10795. createData(records) {
  10796. const $xeTable = this;
  10797. return $xeTable.$nextTick().then(() => {
  10798. return $xeTable.defineField(records);
  10799. });
  10800. },
  10801. /**
  10802. * 创建 Row|Rows 对象
  10803. * 对于某些特殊场景需要对数据进行手动插入时可能会用到
  10804. * @param {Array/Object} records 新数据
  10805. */
  10806. createRow(records) {
  10807. const $xeTable = this;
  10808. const isArr = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(records);
  10809. if (!isArr) {
  10810. records = [records];
  10811. }
  10812. return $xeTable.createData(records).then(rows => isArr ? rows : rows[0]);
  10813. },
  10814. /**
  10815. * 还原数据
  10816. * 如果不传任何参数,则还原整个表格
  10817. * 如果传 row 则还原一行
  10818. * 如果传 rows 则还原多行
  10819. * 如果还额外传了 field 则还原指定的单元格数据
  10820. */
  10821. revertData(rows, field) {
  10822. const $xeTable = this;
  10823. const props = $xeTable;
  10824. const reactData = $xeTable;
  10825. const internalData = $xeTable;
  10826. const {
  10827. keepSource,
  10828. treeConfig
  10829. } = props;
  10830. const {
  10831. fullAllDataRowIdData,
  10832. fullDataRowIdData,
  10833. tableSourceData,
  10834. sourceDataRowIdData,
  10835. tableFullData,
  10836. afterFullData,
  10837. removeRowMaps
  10838. } = internalData;
  10839. const treeOpts = $xeTable.computeTreeOpts;
  10840. const {
  10841. transform
  10842. } = treeOpts;
  10843. const {
  10844. handleGetRowId
  10845. } = createHandleGetRowId($xeTable);
  10846. if (!keepSource) {
  10847. errLog('vxe.error.reqProp', ['keep-source']);
  10848. return $xeTable.$nextTick();
  10849. }
  10850. let targetRows = rows;
  10851. if (rows) {
  10852. if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(rows)) {
  10853. targetRows = [rows];
  10854. }
  10855. } else {
  10856. targetRows = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toArray($xeTable.getUpdateRecords());
  10857. }
  10858. let reDelFlag = false;
  10859. if (targetRows.length) {
  10860. targetRows.forEach(item => {
  10861. const rowid = handleGetRowId(item);
  10862. const rowRest = fullAllDataRowIdData[rowid];
  10863. if (rowRest) {
  10864. const row = rowRest.row;
  10865. if (!$xeTable.isInsertByRow(row)) {
  10866. const oRow = sourceDataRowIdData[rowid];
  10867. if (oRow && row) {
  10868. if (field) {
  10869. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(row, field, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().clone(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(oRow, field), true));
  10870. } else {
  10871. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().destructuring(row, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().clone(oRow, true));
  10872. }
  10873. if (!fullDataRowIdData[rowid] && $xeTable.isRemoveByRow(row)) {
  10874. if (removeRowMaps[rowid]) {
  10875. delete removeRowMaps[rowid];
  10876. }
  10877. tableFullData.unshift(row);
  10878. afterFullData.unshift(row);
  10879. reDelFlag = true;
  10880. }
  10881. }
  10882. }
  10883. }
  10884. });
  10885. }
  10886. if (rows) {
  10887. if (reDelFlag) {
  10888. reactData.removeRowFlag++;
  10889. $xeTable.updateFooter();
  10890. $xeTable.cacheRowMap(false);
  10891. $xeTable.handleTableData(treeConfig && transform);
  10892. if (!(treeConfig && transform)) {
  10893. $xeTable.updateAfterDataIndex();
  10894. }
  10895. $xeTable.checkSelectionStatus();
  10896. if (reactData.scrollYLoad) {
  10897. $xeTable.updateScrollYSpace();
  10898. }
  10899. }
  10900. return $xeTable.$nextTick().then(() => {
  10901. $xeTable.updateCellAreas();
  10902. return handleLazyRecalculate($xeTable, false, true, true);
  10903. });
  10904. }
  10905. return $xeTable.reloadData(tableSourceData);
  10906. },
  10907. /**
  10908. * 清空单元格内容
  10909. * 如果不创参数,则清空整个表格内容
  10910. * 如果传 row 则清空一行内容
  10911. * 如果传 rows 则清空多行内容
  10912. * 如果还额外传了 field 则清空指定单元格内容
  10913. * @param {Array/Row} rows 行数据
  10914. * @param {String} field 字段名
  10915. */
  10916. clearData(rows, field) {
  10917. const $xeTable = this;
  10918. const internalData = $xeTable;
  10919. const {
  10920. tableFullData,
  10921. visibleColumn
  10922. } = internalData;
  10923. if (!arguments.length) {
  10924. rows = tableFullData;
  10925. } else if (rows && !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(rows)) {
  10926. rows = [rows];
  10927. }
  10928. if (field) {
  10929. rows.forEach(row => external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(row, field, null));
  10930. } else {
  10931. rows.forEach(row => {
  10932. visibleColumn.forEach(column => {
  10933. if (column.field) {
  10934. setCellValue(row, column, null);
  10935. }
  10936. });
  10937. });
  10938. }
  10939. return $xeTable.$nextTick();
  10940. },
  10941. getCellElement(row, fieldOrColumn) {
  10942. const $xeTable = this;
  10943. const internalData = $xeTable;
  10944. const {
  10945. elemStore
  10946. } = internalData;
  10947. const column = handleFieldOrColumn($xeTable, fieldOrColumn);
  10948. if (!column) {
  10949. return null;
  10950. }
  10951. const rowid = getRowid($xeTable, row);
  10952. const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
  10953. const leftScrollElem = getRefElem(elemStore['left-body-scroll']);
  10954. const rightScrollElem = getRefElem(elemStore['right-body-scroll']);
  10955. let bodyElem;
  10956. if (column) {
  10957. if (column.fixed) {
  10958. if (column.fixed === 'left') {
  10959. if (leftScrollElem) {
  10960. bodyElem = leftScrollElem;
  10961. }
  10962. } else {
  10963. if (rightScrollElem) {
  10964. bodyElem = rightScrollElem;
  10965. }
  10966. }
  10967. }
  10968. if (!bodyElem) {
  10969. bodyElem = bodyScrollElem;
  10970. }
  10971. if (bodyElem) {
  10972. return bodyElem.querySelector(`.vxe-body--row[rowid="${rowid}"] .${column.id}`);
  10973. }
  10974. }
  10975. return null;
  10976. },
  10977. getCellLabel(row, fieldOrColumn) {
  10978. const $xeTable = this;
  10979. const internalData = $xeTable;
  10980. const column = handleFieldOrColumn(this, fieldOrColumn);
  10981. if (!column) {
  10982. return null;
  10983. }
  10984. const formatter = column.formatter;
  10985. const cellValue = getCellValue(row, column);
  10986. let cellLabel = cellValue;
  10987. if (formatter) {
  10988. let formatData;
  10989. const {
  10990. fullAllDataRowIdData
  10991. } = internalData;
  10992. const rowid = getRowid($xeTable, row);
  10993. const colid = column.id;
  10994. const rowRest = fullAllDataRowIdData[rowid];
  10995. if (rowRest) {
  10996. formatData = rowRest.formatData;
  10997. if (!formatData) {
  10998. formatData = fullAllDataRowIdData[rowid].formatData = {};
  10999. }
  11000. if (rowRest && formatData[colid]) {
  11001. if (formatData[colid].value === cellValue) {
  11002. return formatData[colid].label;
  11003. }
  11004. }
  11005. }
  11006. const formatParams = {
  11007. cellValue,
  11008. row,
  11009. rowIndex: this.getRowIndex(row),
  11010. column,
  11011. columnIndex: this.getColumnIndex(column)
  11012. };
  11013. if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(formatter)) {
  11014. const gFormatOpts = methods_formats.get(formatter);
  11015. const tcFormatMethod = gFormatOpts ? gFormatOpts.tableCellFormatMethod || gFormatOpts.cellFormatMethod : null;
  11016. cellLabel = tcFormatMethod ? tcFormatMethod(formatParams) : '';
  11017. } else if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(formatter)) {
  11018. const gFormatOpts = methods_formats.get(formatter[0]);
  11019. const tcFormatMethod = gFormatOpts ? gFormatOpts.tableCellFormatMethod || gFormatOpts.cellFormatMethod : null;
  11020. cellLabel = tcFormatMethod ? tcFormatMethod(formatParams, ...formatter.slice(1)) : '';
  11021. } else {
  11022. cellLabel = formatter(formatParams);
  11023. }
  11024. if (formatData) {
  11025. formatData[colid] = {
  11026. value: cellValue,
  11027. label: cellLabel
  11028. };
  11029. }
  11030. }
  11031. return cellLabel;
  11032. },
  11033. /**
  11034. * 检查是否为临时行数据
  11035. */
  11036. isInsertByRow(row) {
  11037. const $xeTable = this;
  11038. const reactData = $xeTable;
  11039. const internalData = $xeTable;
  11040. const rowid = getRowid($xeTable, row);
  11041. return !!reactData.insertRowFlag && !!internalData.insertRowMaps[rowid];
  11042. },
  11043. isRemoveByRow(row) {
  11044. const $xeTable = this;
  11045. const reactData = $xeTable;
  11046. const internalData = $xeTable;
  11047. const rowid = getRowid($xeTable, row);
  11048. return !!reactData.removeRowFlag && !!internalData.removeRowMaps[rowid];
  11049. },
  11050. /**
  11051. * 删除所有新增的临时数据
  11052. */
  11053. removeInsertRow() {
  11054. const $xeTable = this;
  11055. const internalData = $xeTable;
  11056. const {
  11057. insertRowMaps
  11058. } = internalData;
  11059. return $xeTable.remove(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().values(insertRowMaps));
  11060. },
  11061. /**
  11062. * 检查行或列数据是否发生改变
  11063. */
  11064. isUpdateByRow(rowOrId, field) {
  11065. const $xeTable = this;
  11066. const props = $xeTable;
  11067. const internalData = $xeTable;
  11068. const {
  11069. keepSource
  11070. } = props;
  11071. const {
  11072. tableFullColumn,
  11073. fullDataRowIdData,
  11074. sourceDataRowIdData
  11075. } = internalData;
  11076. if (keepSource) {
  11077. const rowid = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(rowOrId) || external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(rowOrId) ? rowOrId : getRowid($xeTable, rowOrId);
  11078. const rowRest = fullDataRowIdData[rowid];
  11079. // 新增的数据不需要检测
  11080. if (!rowRest) {
  11081. return false;
  11082. }
  11083. const row = rowRest.row;
  11084. const oRow = sourceDataRowIdData[rowid];
  11085. if (oRow) {
  11086. if (arguments.length > 1) {
  11087. return !eqCellValue(oRow, row, field);
  11088. }
  11089. for (let index = 0, len = tableFullColumn.length; index < len; index++) {
  11090. const property = tableFullColumn[index].field;
  11091. if (property && !eqCellValue(oRow, row, property)) {
  11092. return true;
  11093. }
  11094. }
  11095. }
  11096. }
  11097. return false;
  11098. },
  11099. /**
  11100. * 获取表格的可视列,也可以指定索引获取列
  11101. * @param {Number} columnIndex 索引
  11102. */
  11103. getColumns(columnIndex) {
  11104. const $xeTable = this;
  11105. const internalData = $xeTable;
  11106. const {
  11107. visibleColumn
  11108. } = internalData;
  11109. return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isUndefined(columnIndex) ? visibleColumn.slice(0) : visibleColumn[columnIndex];
  11110. },
  11111. /**
  11112. * 根据列获取列的唯一主键
  11113. */
  11114. getColid(fieldOrColumn) {
  11115. const $xeTable = this;
  11116. const column = handleFieldOrColumn($xeTable, fieldOrColumn);
  11117. return column ? column.id : null;
  11118. },
  11119. /**
  11120. * 根据列的唯一主键获取列
  11121. * @param {String} colid 列主键
  11122. */
  11123. getColumnById(colid) {
  11124. const $xeTable = this;
  11125. const internalData = $xeTable;
  11126. const {
  11127. fullColumnIdData
  11128. } = internalData;
  11129. return fullColumnIdData[colid] ? fullColumnIdData[colid].column : null;
  11130. },
  11131. /**
  11132. * 根据列的字段名获取列
  11133. * @param {String} field 字段名
  11134. */
  11135. getColumnByField(field) {
  11136. const $xeTable = this;
  11137. const internalData = $xeTable;
  11138. const {
  11139. fullColumnFieldData
  11140. } = internalData;
  11141. return fullColumnFieldData[field] ? fullColumnFieldData[field].column : null;
  11142. },
  11143. getParentColumn(fieldOrColumn) {
  11144. const fullColumnIdData = this.fullColumnIdData;
  11145. const column = handleFieldOrColumn(this, fieldOrColumn);
  11146. return column && column.parentId && fullColumnIdData[column.parentId] ? fullColumnIdData[column.parentId].column : null;
  11147. },
  11148. /**
  11149. * 获取当前表格的列
  11150. * 收集到的全量列、全量表头列、处理条件之后的全量表头列、当前渲染中的表头列
  11151. */
  11152. getTableColumn() {
  11153. const $xeTable = this;
  11154. const reactData = $xeTable;
  11155. const internalData = $xeTable;
  11156. return {
  11157. collectColumn: internalData.collectColumn.slice(0),
  11158. fullColumn: internalData.tableFullColumn.slice(0),
  11159. visibleColumn: internalData.visibleColumn.slice(0),
  11160. tableColumn: reactData.tableColumn.slice(0)
  11161. };
  11162. },
  11163. /**
  11164. * 移动列到指定列的位置
  11165. * @param fieldOrColumn
  11166. * @param targetFieldOrColumn
  11167. * @param options
  11168. */
  11169. moveColumnTo(fieldOrColumn, targetFieldOrColumn, options) {
  11170. const $xeTable = this;
  11171. const internalData = $xeTable;
  11172. const {
  11173. fullColumnIdData,
  11174. visibleColumn
  11175. } = internalData;
  11176. const {
  11177. dragToChild,
  11178. dragPos,
  11179. isCrossDrag
  11180. } = Object.assign({}, options);
  11181. const dragCol = handleFieldOrColumn($xeTable, fieldOrColumn);
  11182. let prevDragCol = null;
  11183. const colRest = dragCol ? fullColumnIdData[dragCol.id] : null;
  11184. let defPos = 'left';
  11185. if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(targetFieldOrColumn)) {
  11186. if (colRest && targetFieldOrColumn) {
  11187. let currList = colRest.items;
  11188. let offsetIndex = colRest._index + targetFieldOrColumn;
  11189. if (isCrossDrag) {
  11190. currList = visibleColumn;
  11191. offsetIndex = colRest._index + targetFieldOrColumn;
  11192. }
  11193. if (offsetIndex > 0 && offsetIndex < currList.length - 1) {
  11194. prevDragCol = currList[offsetIndex];
  11195. }
  11196. if (targetFieldOrColumn > 0) {
  11197. defPos = 'right';
  11198. }
  11199. }
  11200. } else {
  11201. prevDragCol = handleFieldOrColumn($xeTable, targetFieldOrColumn);
  11202. const targetColRest = prevDragCol ? fullColumnIdData[prevDragCol.id] : null;
  11203. if (colRest && targetColRest) {
  11204. if (targetColRest._index > colRest._index) {
  11205. defPos = 'right';
  11206. }
  11207. }
  11208. }
  11209. return $xeTable.handleColDragSwapEvent(null, true, dragCol, prevDragCol, dragPos || defPos, dragToChild === true);
  11210. },
  11211. /**
  11212. * 移动行到指定行的位置
  11213. * @param rowidOrRow
  11214. * @param targetRowidOrRow
  11215. * @param options
  11216. */
  11217. moveRowTo(rowidOrRow, targetRowidOrRow, options) {
  11218. const $xeTable = this;
  11219. const props = $xeTable;
  11220. const internalData = $xeTable;
  11221. const {
  11222. treeConfig
  11223. } = props;
  11224. const {
  11225. fullAllDataRowIdData,
  11226. afterFullData
  11227. } = internalData;
  11228. const {
  11229. dragToChild,
  11230. dragPos,
  11231. isCrossDrag
  11232. } = Object.assign({}, options);
  11233. const treeOpts = $xeTable.computeTreeOpts;
  11234. const dragRow = handleRowidOrRow($xeTable, rowidOrRow);
  11235. let prevDragRow = null;
  11236. let defPos = 'top';
  11237. const rowRest = dragRow ? fullAllDataRowIdData[getRowid($xeTable, dragRow)] : null;
  11238. if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(targetRowidOrRow)) {
  11239. if (rowRest && targetRowidOrRow) {
  11240. let currList = afterFullData;
  11241. let offsetIndex = rowRest._index + targetRowidOrRow;
  11242. if (treeConfig) {
  11243. currList = rowRest.items;
  11244. if (treeOpts.transform) {
  11245. offsetIndex = rowRest.treeIndex + targetRowidOrRow;
  11246. if (isCrossDrag) {
  11247. currList = afterFullData;
  11248. offsetIndex = rowRest._index + targetRowidOrRow;
  11249. }
  11250. }
  11251. }
  11252. if (offsetIndex >= 0 && offsetIndex <= currList.length - 1) {
  11253. prevDragRow = currList[offsetIndex];
  11254. }
  11255. if (targetRowidOrRow > 0) {
  11256. defPos = 'bottom';
  11257. }
  11258. }
  11259. } else {
  11260. prevDragRow = handleRowidOrRow($xeTable, targetRowidOrRow);
  11261. const targetRowRest = prevDragRow ? fullAllDataRowIdData[getRowid($xeTable, prevDragRow)] : null;
  11262. if (rowRest && targetRowRest) {
  11263. if (targetRowRest._index > rowRest._index) {
  11264. defPos = 'bottom';
  11265. }
  11266. }
  11267. }
  11268. const rest = $xeTable.handleRowDragSwapEvent(null, true, dragRow, prevDragRow, dragPos || defPos, dragToChild === true);
  11269. clearRowDragData($xeTable);
  11270. return rest;
  11271. },
  11272. /**
  11273. * 获取表格的全量列
  11274. */
  11275. getFullColumns() {
  11276. const $xeTable = this;
  11277. const internalData = $xeTable;
  11278. const {
  11279. collectColumn
  11280. } = internalData;
  11281. return collectColumn.slice(0);
  11282. },
  11283. /**
  11284. * 获取数据,和 data 的行为一致,也可以指定索引获取数据
  11285. */
  11286. getData(rowIndex) {
  11287. const tableSynchData = this.data || this.tableSynchData;
  11288. return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isUndefined(rowIndex) ? tableSynchData.slice(0) : tableSynchData[rowIndex];
  11289. },
  11290. /**
  11291. * 用于多选行,获取已选中的数据
  11292. */
  11293. getCheckboxRecords(isFull) {
  11294. const $xeTable = this;
  11295. const props = $xeTable;
  11296. const reactData = $xeTable;
  11297. const internalData = $xeTable;
  11298. const {
  11299. treeConfig
  11300. } = props;
  11301. const {
  11302. updateCheckboxFlag
  11303. } = reactData;
  11304. const {
  11305. tableFullData,
  11306. afterFullData,
  11307. tableFullTreeData,
  11308. fullDataRowIdData,
  11309. afterFullRowMaps,
  11310. selectCheckboxMaps
  11311. } = internalData;
  11312. const treeOpts = $xeTable.computeTreeOpts;
  11313. const checkboxOpts = $xeTable.computeCheckboxOpts;
  11314. const {
  11315. transform,
  11316. mapChildrenField
  11317. } = treeOpts;
  11318. const {
  11319. checkField
  11320. } = checkboxOpts;
  11321. const childrenField = treeOpts.children || treeOpts.childrenField;
  11322. let rowList = [];
  11323. if (updateCheckboxFlag) {
  11324. if (checkField) {
  11325. if (treeConfig) {
  11326. const currTableData = isFull ? transform ? tableFullTreeData : tableFullData : transform ? tableFullTreeData : afterFullData;
  11327. rowList = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().filterTree(currTableData, row => external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, checkField), {
  11328. children: transform ? mapChildrenField : childrenField
  11329. });
  11330. } else {
  11331. const currTableData = isFull ? tableFullData : afterFullData;
  11332. rowList = currTableData.filter(row => external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, checkField));
  11333. }
  11334. } else {
  11335. const currMaps = isFull || treeConfig && !transform ? fullDataRowIdData : afterFullRowMaps;
  11336. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(selectCheckboxMaps, (row, rowid) => {
  11337. if (currMaps[rowid]) {
  11338. rowList.push(fullDataRowIdData[rowid].row);
  11339. }
  11340. });
  11341. }
  11342. }
  11343. return rowList;
  11344. },
  11345. /**
  11346. * 预编译
  11347. * 对渲染中的数据提前解析序号及索引。牺牲提前编译耗时换取渲染中额外损耗,使运行时更加流畅
  11348. */
  11349. updateAfterDataIndex() {
  11350. const $xeTable = this;
  11351. updateAfterDataIndex($xeTable);
  11352. },
  11353. /**
  11354. * 只对 tree-config 有效,获取行的子级
  11355. */
  11356. getTreeRowChildren(rowOrRowid) {
  11357. const $xeTable = this;
  11358. const props = $xeTable;
  11359. const internalData = $xeTable;
  11360. const {
  11361. treeConfig
  11362. } = props;
  11363. const {
  11364. fullAllDataRowIdData
  11365. } = internalData;
  11366. const treeOpts = $xeTable.computeTreeOpts;
  11367. const {
  11368. transform,
  11369. mapChildrenField
  11370. } = treeOpts;
  11371. const childrenField = treeOpts.children || treeOpts.childrenField;
  11372. if (rowOrRowid && treeConfig) {
  11373. let rowid;
  11374. if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(rowOrRowid)) {
  11375. rowid = rowOrRowid;
  11376. } else {
  11377. rowid = getRowid($xeTable, rowOrRowid);
  11378. }
  11379. if (rowid) {
  11380. const rest = fullAllDataRowIdData[rowid];
  11381. const row = rest ? rest.row : null;
  11382. if (row) {
  11383. return row[transform ? mapChildrenField : childrenField] || [];
  11384. }
  11385. }
  11386. }
  11387. return [];
  11388. },
  11389. /**
  11390. * 只对 tree-config 有效,用于树形结构,获取指定行的层级
  11391. */
  11392. getTreeRowLevel(rowOrRowid) {
  11393. const $xeTable = this;
  11394. const props = $xeTable;
  11395. const internalData = $xeTable;
  11396. const {
  11397. treeConfig
  11398. } = props;
  11399. const {
  11400. fullAllDataRowIdData
  11401. } = internalData;
  11402. if (rowOrRowid && treeConfig) {
  11403. let rowid;
  11404. if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(rowOrRowid)) {
  11405. rowid = rowOrRowid;
  11406. } else {
  11407. rowid = getRowid($xeTable, rowOrRowid);
  11408. }
  11409. if (rowid) {
  11410. const rest = fullAllDataRowIdData[rowid];
  11411. if (rest) {
  11412. return rest.level;
  11413. }
  11414. }
  11415. }
  11416. return -1;
  11417. },
  11418. /**
  11419. * 只对 tree-config 有效,获取行的父级
  11420. */
  11421. getTreeParentRow(rowOrRowid) {
  11422. const $xeTable = this;
  11423. const props = $xeTable;
  11424. const internalData = $xeTable;
  11425. const {
  11426. treeConfig
  11427. } = props;
  11428. const {
  11429. fullAllDataRowIdData
  11430. } = internalData;
  11431. if (rowOrRowid && treeConfig) {
  11432. let rowid;
  11433. if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(rowOrRowid)) {
  11434. rowid = rowOrRowid;
  11435. } else {
  11436. rowid = getRowid($xeTable, rowOrRowid);
  11437. }
  11438. if (rowid) {
  11439. const rest = fullAllDataRowIdData[rowid];
  11440. if (rest) {
  11441. return rest.parent;
  11442. }
  11443. }
  11444. }
  11445. return null;
  11446. },
  11447. getParentRow(rowOrRowid) {
  11448. const $xeTable = this;
  11449. warnLog('vxe.error.delFunc', ['getParentRow', 'getTreeParentRow']);
  11450. return $xeTable.getTreeParentRow(rowOrRowid);
  11451. },
  11452. /**
  11453. * 根据行的唯一主键获取行
  11454. * @param {String/Number} rowid 行主键
  11455. */
  11456. getRowById(cellValue) {
  11457. const $xeTable = this;
  11458. const internalData = $xeTable;
  11459. const {
  11460. fullAllDataRowIdData
  11461. } = internalData;
  11462. const rowid = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(cellValue) ? '' : encodeURIComponent(cellValue);
  11463. return fullAllDataRowIdData[rowid] ? fullAllDataRowIdData[rowid].row : null;
  11464. },
  11465. /**
  11466. * 根据行获取行的唯一主键
  11467. * @param {Row} row 行对象
  11468. */
  11469. getRowid(row) {
  11470. const $xeTable = this;
  11471. return getRowid($xeTable, row);
  11472. },
  11473. /**
  11474. * 获取处理后的表格数据
  11475. * 如果存在筛选条件,继续处理
  11476. * 如果存在排序,继续处理
  11477. */
  11478. getTableData() {
  11479. const $xeTable = this;
  11480. const props = $xeTable;
  11481. const reactData = $xeTable;
  11482. const internalData = $xeTable;
  11483. const {
  11484. tableData,
  11485. footerTableData
  11486. } = reactData;
  11487. const {
  11488. tableFullData,
  11489. afterFullData,
  11490. tableFullTreeData
  11491. } = internalData;
  11492. return {
  11493. fullData: props.treeConfig ? tableFullTreeData.slice(0) : tableFullData.slice(0),
  11494. visibleData: afterFullData.slice(0),
  11495. tableData: tableData.slice(0),
  11496. footerData: footerTableData.slice(0)
  11497. };
  11498. },
  11499. /**
  11500. * 获取表格的全量数据,如果是 tree-config 则返回带层级的树结构
  11501. */
  11502. getFullData() {
  11503. const $xeTable = this;
  11504. const props = $xeTable;
  11505. const internalData = $xeTable;
  11506. const {
  11507. treeConfig
  11508. } = props;
  11509. const {
  11510. tableFullData,
  11511. tableFullTreeData
  11512. } = internalData;
  11513. if (treeConfig) {
  11514. const treeOpts = $xeTable.computeTreeOpts;
  11515. const {
  11516. transform,
  11517. mapChildrenField,
  11518. rowField,
  11519. parentField
  11520. } = treeOpts;
  11521. const childrenField = treeOpts.children || treeOpts.childrenField;
  11522. if (transform) {
  11523. return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toArrayTree(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toTreeArray(tableFullTreeData, {
  11524. children: mapChildrenField
  11525. }), {
  11526. key: rowField,
  11527. parentKey: parentField,
  11528. children: childrenField,
  11529. mapChildren: mapChildrenField
  11530. });
  11531. }
  11532. return tableFullTreeData.slice(0);
  11533. }
  11534. return tableFullData.slice(0);
  11535. },
  11536. /**
  11537. * 处理数据加载默认行为
  11538. * 默认执行一次,除非被重置
  11539. */
  11540. handleLoadDefaults() {
  11541. const $xeTable = this;
  11542. handleLoadDefaults($xeTable);
  11543. },
  11544. /**
  11545. * 处理初始化的默认行为
  11546. * 只会执行一次
  11547. */
  11548. handleInitDefaults() {
  11549. const $xeTable = this;
  11550. handleInitDefaults($xeTable);
  11551. },
  11552. /**
  11553. * 设置为固定列
  11554. */
  11555. setColumnFixed(fieldOrColumn, fixed) {
  11556. const $xeTable = this;
  11557. let status = false;
  11558. const cols = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(fieldOrColumn) ? fieldOrColumn : [fieldOrColumn];
  11559. const columnOpts = $xeTable.computeColumnOpts;
  11560. const isMaxFixedColumn = $xeTable.computeIsMaxFixedColumn;
  11561. for (let i = 0; i < cols.length; i++) {
  11562. const item = cols[i];
  11563. const column = handleFieldOrColumn($xeTable, item);
  11564. const targetColumn = getRootColumn($xeTable, column);
  11565. if (targetColumn && targetColumn.fixed !== fixed) {
  11566. // 是否超过最大固定列数量
  11567. if (!targetColumn.fixed && isMaxFixedColumn) {
  11568. if (core_.VxeUI.modal) {
  11569. core_.VxeUI.modal.message({
  11570. status: 'error',
  11571. content: methods_getI18n('vxe.table.maxFixedCol', [columnOpts.maxFixedSize])
  11572. });
  11573. }
  11574. return $xeTable.$nextTick();
  11575. }
  11576. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree([targetColumn], column => {
  11577. column.fixed = fixed;
  11578. column.renderFixed = fixed;
  11579. });
  11580. $xeTable.saveCustomStore('update:fixed');
  11581. if (!status) {
  11582. status = true;
  11583. }
  11584. }
  11585. }
  11586. if (status) {
  11587. return $xeTable.refreshColumn();
  11588. }
  11589. return $xeTable.$nextTick();
  11590. },
  11591. /**
  11592. * 取消指定固定列
  11593. */
  11594. clearColumnFixed(fieldOrColumn) {
  11595. const $xeTable = this;
  11596. let status = false;
  11597. const cols = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(fieldOrColumn) ? fieldOrColumn : [fieldOrColumn];
  11598. cols.forEach(item => {
  11599. const column = handleFieldOrColumn($xeTable, item);
  11600. const targetColumn = getRootColumn($xeTable, column);
  11601. if (targetColumn && targetColumn.fixed) {
  11602. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree([targetColumn], column => {
  11603. column.fixed = null;
  11604. column.renderFixed = null;
  11605. });
  11606. $xeTable.saveCustomStore('update:fixed');
  11607. if (!status) {
  11608. status = true;
  11609. }
  11610. }
  11611. });
  11612. if (status) {
  11613. return $xeTable.refreshColumn();
  11614. }
  11615. return $xeTable.$nextTick();
  11616. },
  11617. /**
  11618. * 隐藏指定列
  11619. */
  11620. hideColumn(fieldOrColumn) {
  11621. const $xeTable = this;
  11622. let status = false;
  11623. const cols = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(fieldOrColumn) ? fieldOrColumn : [fieldOrColumn];
  11624. cols.forEach(item => {
  11625. const column = handleFieldOrColumn($xeTable, item);
  11626. if (column && column.visible) {
  11627. column.visible = false;
  11628. if (!status) {
  11629. status = true;
  11630. }
  11631. }
  11632. });
  11633. if (status) {
  11634. return $xeTable.handleCustom();
  11635. }
  11636. return $xeTable.$nextTick();
  11637. },
  11638. /**
  11639. * 显示指定列
  11640. */
  11641. showColumn(fieldOrColumn) {
  11642. const $xeTable = this;
  11643. let status = false;
  11644. const cols = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(fieldOrColumn) ? fieldOrColumn : [fieldOrColumn];
  11645. cols.forEach(item => {
  11646. const column = handleFieldOrColumn($xeTable, item);
  11647. if (column && !column.visible) {
  11648. column.visible = true;
  11649. if (!status) {
  11650. status = true;
  11651. }
  11652. }
  11653. });
  11654. if (status) {
  11655. return $xeTable.handleCustom();
  11656. }
  11657. return $xeTable.$nextTick();
  11658. },
  11659. setColumnWidth(fieldOrColumn, width) {
  11660. const $xeTable = this;
  11661. const internalData = $xeTable;
  11662. const {
  11663. elemStore
  11664. } = internalData;
  11665. let status = false;
  11666. const cols = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(fieldOrColumn) ? fieldOrColumn : [fieldOrColumn];
  11667. let cWidth = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(width);
  11668. if (isScale(width)) {
  11669. const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
  11670. const bodyWidth = bodyScrollElem ? bodyScrollElem.clientWidth - 1 : 0;
  11671. cWidth = Math.floor(cWidth * bodyWidth);
  11672. }
  11673. if (cWidth) {
  11674. cols.forEach(item => {
  11675. const column = handleFieldOrColumn($xeTable, item);
  11676. if (column) {
  11677. column.resizeWidth = cWidth;
  11678. if (!status) {
  11679. status = true;
  11680. }
  11681. }
  11682. });
  11683. if (status) {
  11684. return $xeTable.refreshColumn().then(() => {
  11685. return {
  11686. status
  11687. };
  11688. });
  11689. }
  11690. }
  11691. return $xeTable.$nextTick().then(() => {
  11692. return {
  11693. status
  11694. };
  11695. });
  11696. },
  11697. getColumnWidth(fieldOrColumn) {
  11698. const column = handleFieldOrColumn(this, fieldOrColumn);
  11699. if (column) {
  11700. return column.renderWidth;
  11701. }
  11702. return 0;
  11703. },
  11704. /**
  11705. * 手动重置列的显示隐藏、列宽拖动的状态;
  11706. * 如果为 true 则重置所有状态
  11707. * 如果已关联工具栏,则会同步更新
  11708. */
  11709. resetColumn(options) {
  11710. warnLog('vxe.error.delFunc', ['resetColumn', 'resetCustom']);
  11711. return this.resetCustom(options);
  11712. },
  11713. handleCustom() {
  11714. const $xeTable = this;
  11715. const props = $xeTable;
  11716. const {
  11717. mouseConfig
  11718. } = props;
  11719. if (mouseConfig) {
  11720. if ($xeTable.clearSelected) {
  11721. $xeTable.clearSelected();
  11722. }
  11723. if ($xeTable.clearCellAreas) {
  11724. $xeTable.clearCellAreas();
  11725. $xeTable.clearCopyCellArea();
  11726. }
  11727. }
  11728. $xeTable.analyColumnWidth();
  11729. return $xeTable.refreshColumn(true);
  11730. },
  11731. /**
  11732. * 还原自定义列操作状态
  11733. */
  11734. restoreCustomStorage() {
  11735. const $xeTable = this;
  11736. const props = $xeTable;
  11737. const {
  11738. customConfig
  11739. } = props;
  11740. const tableId = $xeTable.computeTableId;
  11741. const customOpts = $xeTable.computeCustomOpts;
  11742. const {
  11743. storage,
  11744. restoreStore,
  11745. storeOptions
  11746. } = customOpts;
  11747. const isAllCustom = storage === true;
  11748. const storageOpts = isAllCustom ? {} : Object.assign({}, storage || {}, storeOptions);
  11749. const isCustomResizable = hangleStorageDefaultValue(storageOpts.resizable, isAllCustom);
  11750. const isCustomVisible = hangleStorageDefaultValue(storageOpts.visible, isAllCustom);
  11751. const isCustomFixed = hangleStorageDefaultValue(storageOpts.fixed, isAllCustom);
  11752. const isCustomAggGroup = hangleStorageDefaultValue(storageOpts.aggGroup, isAllCustom);
  11753. const isCustomSort = hangleStorageDefaultValue(storageOpts.sort, isAllCustom);
  11754. if (storage && (customConfig ? isEnableConf(customOpts) : customOpts.enabled) && (isCustomResizable || isCustomVisible || isCustomFixed || isCustomAggGroup || isCustomSort)) {
  11755. if (!tableId) {
  11756. errLog('vxe.error.reqProp', ['id']);
  11757. return;
  11758. }
  11759. const storeData = getCustomStorageMap(tableId);
  11760. if (restoreStore) {
  11761. return Promise.resolve(restoreStore({
  11762. $table: $xeTable,
  11763. id: tableId,
  11764. type: 'restore',
  11765. storeData
  11766. })).then(storeData => {
  11767. if (!storeData) {
  11768. return;
  11769. }
  11770. return handleCustomRestore($xeTable, storeData);
  11771. }).catch(e => e);
  11772. } else {
  11773. return handleCustomRestore($xeTable, storeData);
  11774. }
  11775. }
  11776. },
  11777. getCustomStoreData() {
  11778. const $xeTable = this;
  11779. const props = $xeTable;
  11780. const reactData = $xeTable;
  11781. const internalData = $xeTable;
  11782. const {
  11783. id
  11784. } = props;
  11785. const customOpts = $xeTable.computeCustomOpts;
  11786. const {
  11787. isRowGroupStatus,
  11788. rowGroupList
  11789. } = reactData;
  11790. const {
  11791. fullColumnFieldData,
  11792. collectColumn
  11793. } = internalData;
  11794. const {
  11795. storage,
  11796. checkMethod,
  11797. storeOptions
  11798. } = customOpts;
  11799. const isAllCustom = storage === true;
  11800. const storageOpts = isAllCustom ? {} : Object.assign({}, storage || {}, storeOptions);
  11801. const isCustomResizable = hangleStorageDefaultValue(storageOpts.resizable, isAllCustom);
  11802. const isCustomVisible = hangleStorageDefaultValue(storageOpts.visible, isAllCustom);
  11803. const isCustomFixed = hangleStorageDefaultValue(storageOpts.fixed, isAllCustom);
  11804. const isCustomSort = hangleStorageDefaultValue(storageOpts.sort, isAllCustom);
  11805. const isCustomAggGroup = hangleStorageDefaultValue(storageOpts.aggGroup, isAllCustom);
  11806. const isCustomAggFunc = hangleStorageDefaultValue(storageOpts.aggFunc, isAllCustom);
  11807. const resizableData = {};
  11808. const sortData = [];
  11809. const visibleData = {};
  11810. const fixedData = {};
  11811. const aggGroupData = {};
  11812. const aggFuncData = {};
  11813. const storeData = {
  11814. resizableData: undefined,
  11815. sortData: undefined,
  11816. visibleData: undefined,
  11817. fixedData: undefined,
  11818. aggGroupData: undefined,
  11819. aggFuncData: undefined
  11820. };
  11821. if (!id) {
  11822. if (storage) {
  11823. errLog('vxe.error.reqProp', ['id']);
  11824. }
  11825. return storeData;
  11826. }
  11827. let hasResizable = 0;
  11828. let hasSort = 0;
  11829. let hasFixed = 0;
  11830. let hasVisible = 0;
  11831. let hasAggFunc = 0;
  11832. const sortMaps = {};
  11833. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(collectColumn, (column, index, items, path, parentColumn) => {
  11834. const colKey = column.getKey();
  11835. if (!colKey) {
  11836. errLog('vxe.error.reqProp', [`${column.getTitle() || column.type || ''} -> column.field=?`]);
  11837. return;
  11838. }
  11839. if (parentColumn) {
  11840. if (isCustomSort) {
  11841. const pColKey = parentColumn.getKey();
  11842. const psObj = sortMaps[pColKey];
  11843. hasSort = 1;
  11844. if (psObj) {
  11845. const sObj = {
  11846. k: colKey
  11847. };
  11848. sortMaps[colKey] = sObj;
  11849. if (!psObj.c) {
  11850. psObj.c = [];
  11851. }
  11852. psObj.c.push(sObj);
  11853. }
  11854. }
  11855. } else {
  11856. if (isCustomSort) {
  11857. hasSort = 1;
  11858. const sObj = {
  11859. k: colKey
  11860. };
  11861. sortMaps[colKey] = sObj;
  11862. sortData.push(sObj);
  11863. }
  11864. // 只支持一级
  11865. if (isCustomFixed && (column.fixed || '') !== (column.defaultFixed || '')) {
  11866. hasFixed = 1;
  11867. fixedData[colKey] = column.fixed;
  11868. }
  11869. }
  11870. if (isCustomResizable && column.resizeWidth) {
  11871. hasResizable = 1;
  11872. resizableData[colKey] = column.renderWidth;
  11873. }
  11874. if (isCustomVisible && (!checkMethod || checkMethod({
  11875. $table: $xeTable,
  11876. column
  11877. }))) {
  11878. if (!column.visible && column.defaultVisible) {
  11879. hasVisible = 1;
  11880. visibleData[colKey] = false;
  11881. } else if (column.visible && !column.defaultVisible) {
  11882. hasVisible = 1;
  11883. visibleData[colKey] = true;
  11884. }
  11885. }
  11886. if (isCustomAggFunc && (column.aggFunc || '') !== (column.defaultAggFunc || '')) {
  11887. hasAggFunc = 1;
  11888. aggFuncData[colKey] = column.aggFunc;
  11889. }
  11890. });
  11891. if (hasResizable) {
  11892. storeData.resizableData = resizableData;
  11893. }
  11894. if (hasSort) {
  11895. storeData.sortData = sortData;
  11896. }
  11897. if (hasFixed) {
  11898. storeData.fixedData = fixedData;
  11899. }
  11900. if (hasVisible) {
  11901. storeData.visibleData = visibleData;
  11902. }
  11903. if (isCustomAggGroup && isRowGroupStatus) {
  11904. rowGroupList.forEach(aggConf => {
  11905. const colRest = fullColumnFieldData[aggConf.field];
  11906. if (colRest) {
  11907. aggGroupData[colRest.column.getKey()] = true;
  11908. }
  11909. });
  11910. storeData.aggGroupData = aggGroupData;
  11911. }
  11912. if (hasAggFunc) {
  11913. storeData.aggFuncData = aggFuncData;
  11914. }
  11915. return storeData;
  11916. },
  11917. saveCustomStore(type) {
  11918. const $xeTable = this;
  11919. const props = $xeTable;
  11920. const reactData = $xeTable;
  11921. const {
  11922. customConfig
  11923. } = props;
  11924. const tableId = $xeTable.computeTableId;
  11925. const customOpts = $xeTable.computeCustomOpts;
  11926. const {
  11927. updateStore,
  11928. storage,
  11929. storeOptions
  11930. } = customOpts;
  11931. const isAllCustom = storage === true;
  11932. const storageOpts = isAllCustom ? {} : Object.assign({}, storage || {}, storeOptions);
  11933. const isCustomResizable = hangleStorageDefaultValue(storageOpts.resizable, isAllCustom);
  11934. const isCustomVisible = hangleStorageDefaultValue(storageOpts.visible, isAllCustom);
  11935. const isCustomFixed = hangleStorageDefaultValue(storageOpts.fixed, isAllCustom);
  11936. const isCustomSort = hangleStorageDefaultValue(storageOpts.sort, isAllCustom);
  11937. const isCustomAggGroup = hangleStorageDefaultValue(storageOpts.aggGroup, isAllCustom);
  11938. const isCustomAggFunc = hangleStorageDefaultValue(storageOpts.aggFunc, isAllCustom);
  11939. if (type !== 'reset') {
  11940. reactData.isCustomStatus = true;
  11941. }
  11942. if (storage && (customConfig ? isEnableConf(customOpts) : customOpts.enabled) && (isCustomResizable || isCustomVisible || isCustomFixed || isCustomSort || isCustomAggGroup || isCustomAggFunc)) {
  11943. if (!tableId) {
  11944. errLog('vxe.error.reqProp', ['id']);
  11945. return this.$nextTick();
  11946. }
  11947. const storeData = type === 'reset' ? {
  11948. resizableData: {},
  11949. sortData: {},
  11950. visibleData: {},
  11951. fixedData: {},
  11952. aggGroupData: {},
  11953. aggFuncData: {}
  11954. } : this.getCustomStoreData();
  11955. if (updateStore) {
  11956. return updateStore({
  11957. $table: $xeTable,
  11958. id: tableId,
  11959. type,
  11960. storeData
  11961. });
  11962. } else {
  11963. setCustomStorageMap(tableId, type === 'reset' ? null : storeData);
  11964. }
  11965. }
  11966. return this.$nextTick();
  11967. },
  11968. handleUpdateDataQueue() {
  11969. this.upDataFlag++;
  11970. },
  11971. handleRefreshColumnQueue() {
  11972. this.reColumnFlag++;
  11973. },
  11974. handleFilterOptions(column) {
  11975. const $xeTable = this;
  11976. const reactData = $xeTable;
  11977. if (column) {
  11978. const {
  11979. filterStore
  11980. } = reactData;
  11981. const {
  11982. filterRender,
  11983. filters
  11984. } = column;
  11985. const filterOptions = filters || [];
  11986. const compConf = isEnableConf(filterRender) ? methods_renderer.get(filterRender.name) : null;
  11987. const frMethod = column.filterRecoverMethod || (compConf ? compConf.tableFilterRecoverMethod || compConf.filterRecoverMethod : null);
  11988. filterStore.column = column;
  11989. // 复原状态
  11990. filterOptions.forEach(option => {
  11991. const {
  11992. _checked,
  11993. checked
  11994. } = option;
  11995. option._checked = checked;
  11996. if (!checked && _checked !== checked) {
  11997. if (frMethod) {
  11998. frMethod({
  11999. option,
  12000. column,
  12001. $table: $xeTable
  12002. });
  12003. }
  12004. }
  12005. });
  12006. $xeTable.checkFilterOptions();
  12007. }
  12008. },
  12009. /**
  12010. * 刷新列配置
  12011. */
  12012. refreshColumn(initSort) {
  12013. const $xeTable = this;
  12014. if (initSort) {
  12015. handleUpdateColumn($xeTable);
  12016. }
  12017. return parseColumns($xeTable, true).then(() => {
  12018. return this.refreshScroll();
  12019. }).then(() => {
  12020. return handleLazyRecalculate($xeTable, false, true, true);
  12021. });
  12022. },
  12023. /**
  12024. * 指定列宽的列进行拆分
  12025. */
  12026. analyColumnWidth() {
  12027. const {
  12028. columnOpts
  12029. } = this;
  12030. const {
  12031. width: defaultWidth,
  12032. minWidth: defaultMinWidth
  12033. } = columnOpts;
  12034. const resizeList = [];
  12035. const pxList = [];
  12036. const pxMinList = [];
  12037. const autoMinList = [];
  12038. const scaleList = [];
  12039. const scaleMinList = [];
  12040. const autoList = [];
  12041. const remainList = [];
  12042. this.tableFullColumn.forEach(column => {
  12043. if (defaultWidth && !column.width) {
  12044. column.width = defaultWidth;
  12045. }
  12046. if (defaultMinWidth && !column.minWidth) {
  12047. column.minWidth = defaultMinWidth;
  12048. }
  12049. if (column.visible) {
  12050. if (column.resizeWidth) {
  12051. resizeList.push(column);
  12052. } else if (column.width === 'auto') {
  12053. autoList.push(column);
  12054. } else if (isPx(column.width)) {
  12055. pxList.push(column);
  12056. } else if (isScale(column.width)) {
  12057. scaleList.push(column);
  12058. } else if (isPx(column.minWidth)) {
  12059. pxMinList.push(column);
  12060. } else if (column.minWidth === 'auto') {
  12061. autoMinList.push(column);
  12062. } else if (isScale(column.minWidth)) {
  12063. scaleMinList.push(column);
  12064. } else {
  12065. remainList.push(column);
  12066. }
  12067. }
  12068. });
  12069. Object.assign(this.columnStore, {
  12070. resizeList,
  12071. pxList,
  12072. pxMinList,
  12073. autoMinList,
  12074. scaleList,
  12075. scaleMinList,
  12076. autoList,
  12077. remainList
  12078. });
  12079. },
  12080. handleColResizeMousedownEvent(evnt, fixedType, params) {
  12081. const $xeTable = this;
  12082. const reactData = $xeTable;
  12083. const internalData = $xeTable;
  12084. evnt.stopPropagation();
  12085. evnt.preventDefault();
  12086. const {
  12087. column
  12088. } = params;
  12089. const {
  12090. columnStore,
  12091. overflowX,
  12092. scrollbarHeight
  12093. } = reactData;
  12094. const {
  12095. visibleColumn
  12096. } = internalData;
  12097. const {
  12098. leftList,
  12099. rightList
  12100. } = columnStore;
  12101. const resizableOpts = $xeTable.computeResizableOpts;
  12102. const osbHeight = overflowX ? scrollbarHeight : 0;
  12103. const tableEl = $xeTable.$refs.refElem;
  12104. const leftContainerElem = $xeTable.$refs.refLeftContainer;
  12105. const rightContainerElem = $xeTable.$refs.refRightContainer;
  12106. const resizeBarElem = $xeTable.$refs.refColResizeBar;
  12107. if (!resizeBarElem) {
  12108. return;
  12109. }
  12110. const isLeftFixed = fixedType === 'left';
  12111. const isRightFixed = fixedType === 'right';
  12112. const resizeTipElem = resizeBarElem.firstElementChild;
  12113. const scrollbarXToTop = $xeTable.computeScrollbarXToTop;
  12114. const {
  12115. clientX: dragClientX
  12116. } = evnt;
  12117. const dragBtnElem = evnt.target;
  12118. let cell = dragBtnElem.parentElement;
  12119. let resizeColumn = column;
  12120. const isDragGroupCol = column.children && column.children.length;
  12121. if (isDragGroupCol) {
  12122. resizeColumn = getLastChildColumn(column);
  12123. if (isDragGroupCol) {
  12124. const trEl = cell ? cell.parentElement : null;
  12125. const theadEl = trEl ? trEl.parentElement : null;
  12126. cell = theadEl ? theadEl.querySelector(`.vxe-header--column[colid="${resizeColumn.id}"]`) : null;
  12127. }
  12128. }
  12129. if (!cell) {
  12130. return;
  12131. }
  12132. const cellParams = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().assign(params, {
  12133. cell,
  12134. $table: $xeTable
  12135. });
  12136. let dragLeft = 0;
  12137. const tableRect = tableEl.getBoundingClientRect();
  12138. const rightContainerRect = rightContainerElem ? rightContainerElem.getBoundingClientRect() : null;
  12139. const cellRect = cell.getBoundingClientRect();
  12140. const dragBtnRect = dragBtnElem.getBoundingClientRect();
  12141. const dragBtnWidth = dragBtnElem.clientWidth;
  12142. const dragBtnOffsetWidth = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().floor(dragBtnWidth / 2);
  12143. const dragPosLeft = dragBtnRect.x - tableRect.x + dragBtnOffsetWidth;
  12144. const minInterval = getColReMinWidth(cellParams) - dragBtnOffsetWidth; // 列之间的最小间距
  12145. const dragMinLeft = isRightFixed ? 0 : cellRect.x - tableRect.x + dragBtnWidth + minInterval;
  12146. const dragMaxLeft = cellRect.x - tableRect.x + cell.clientWidth - minInterval;
  12147. let fixedLeftRemainWidth = 0;
  12148. let fixedRightRemainWidth = 0;
  12149. if (isLeftFixed || isRightFixed) {
  12150. let isMach = false;
  12151. const fixedColumn = isLeftFixed ? leftList : rightList;
  12152. for (let i = 0; i < fixedColumn.length; i++) {
  12153. const item = fixedColumn[i];
  12154. if (isMach) {
  12155. fixedLeftRemainWidth += item.renderWidth;
  12156. } else {
  12157. isMach = item.id === resizeColumn.id;
  12158. if (!isMach) {
  12159. fixedRightRemainWidth += item.renderWidth;
  12160. }
  12161. }
  12162. }
  12163. }
  12164. // 处理拖动事件
  12165. const updateEvent = evnt => {
  12166. evnt.stopPropagation();
  12167. evnt.preventDefault();
  12168. const tableHeight = tableEl.clientHeight;
  12169. const offsetX = evnt.clientX - dragClientX;
  12170. let left = dragPosLeft + offsetX;
  12171. if (isLeftFixed) {
  12172. if (rightContainerRect) {
  12173. left = Math.min(left, rightContainerRect.x - tableRect.x - fixedLeftRemainWidth - minInterval);
  12174. }
  12175. } else if (isRightFixed) {
  12176. if (leftContainerElem) {
  12177. left = Math.max(left, leftContainerElem.clientWidth + fixedRightRemainWidth + minInterval);
  12178. }
  12179. left = Math.min(left, dragMaxLeft);
  12180. }
  12181. dragLeft = Math.max(left, dragMinLeft);
  12182. const resizeBarLeft = Math.max(1, dragLeft);
  12183. resizeBarElem.style.left = `${resizeBarLeft}px`;
  12184. resizeBarElem.style.top = `${scrollbarXToTop ? osbHeight : 0}px`;
  12185. resizeBarElem.style.height = `${scrollbarXToTop ? tableHeight - osbHeight : tableHeight}px`;
  12186. if (resizableOpts.showDragTip && resizeTipElem) {
  12187. resizeTipElem.textContent = methods_getI18n('vxe.table.resizeColTip', [Math.floor(resizeColumn.renderWidth + (isRightFixed ? dragPosLeft - dragLeft : dragLeft - dragPosLeft))]);
  12188. const tableWrapperWidth = tableEl.clientWidth;
  12189. const resizeBarWidth = resizeBarElem.clientWidth;
  12190. const resizeTipWidth = resizeTipElem.clientWidth;
  12191. const resizeTipHeight = resizeTipElem.clientHeight;
  12192. let resizeTipLeft = -resizeTipWidth;
  12193. if (resizeBarLeft < resizeTipWidth + resizeBarWidth) {
  12194. resizeTipLeft = 0;
  12195. } else if (resizeBarLeft > tableWrapperWidth) {
  12196. resizeTipLeft += tableWrapperWidth - resizeBarLeft;
  12197. }
  12198. resizeTipElem.style.left = `${resizeTipLeft}px`;
  12199. resizeTipElem.style.top = `${Math.min(tableHeight - resizeTipHeight, Math.max(0, evnt.clientY - tableRect.y - resizeTipHeight / 2))}px`;
  12200. }
  12201. reactData.isDragResize = true;
  12202. };
  12203. reactData.isDragResize = true;
  12204. addClass(tableEl, 'col-drag--resize');
  12205. resizeBarElem.style.display = 'block';
  12206. document.onmousemove = updateEvent;
  12207. document.onmouseup = function (evnt) {
  12208. document.onmousemove = null;
  12209. document.onmouseup = null;
  12210. resizeBarElem.style.display = 'none';
  12211. internalData._lastResizeTime = Date.now();
  12212. setTimeout(() => {
  12213. reactData.isDragResize = false;
  12214. }, 50);
  12215. const resizeWidth = resizeColumn.renderWidth + (isRightFixed ? dragPosLeft - dragLeft : dragLeft - dragPosLeft);
  12216. const resizeParams = {
  12217. ...params,
  12218. resizeWidth,
  12219. resizeColumn
  12220. };
  12221. if (resizableOpts.dragMode === 'fixed') {
  12222. visibleColumn.forEach(item => {
  12223. if (item.id !== resizeColumn.id) {
  12224. if (!item.resizeWidth) {
  12225. item.resizeWidth = item.renderWidth;
  12226. }
  12227. }
  12228. });
  12229. }
  12230. if ($xeTable.handleColResizeCellAreaEvent) {
  12231. $xeTable.handleColResizeCellAreaEvent(evnt, resizeParams);
  12232. } else {
  12233. resizeColumn.resizeWidth = resizeWidth;
  12234. handleUpdateColResize($xeTable, evnt, resizeParams);
  12235. }
  12236. removeClass(tableEl, 'col-drag--resize');
  12237. };
  12238. updateEvent(evnt);
  12239. if ($xeTable.closeMenu) {
  12240. $xeTable.closeMenu();
  12241. }
  12242. },
  12243. handleColResizeDblclickEvent(evnt, params) {
  12244. const $xeTable = this;
  12245. const reactData = $xeTable;
  12246. const internalData = $xeTable;
  12247. const resizableOpts = $xeTable.computeResizableOpts;
  12248. const {
  12249. isDblclickAutoWidth
  12250. } = resizableOpts;
  12251. const el = $xeTable.$refs.refElem;
  12252. if (isDblclickAutoWidth && el) {
  12253. evnt.stopPropagation();
  12254. evnt.preventDefault();
  12255. const {
  12256. fullColumnIdData
  12257. } = internalData;
  12258. const {
  12259. column
  12260. } = params;
  12261. let resizeColumn = column;
  12262. if (column.children && column.children.length) {
  12263. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(column.children, childColumn => {
  12264. resizeColumn = childColumn;
  12265. });
  12266. }
  12267. const colid = resizeColumn.id;
  12268. const colRest = fullColumnIdData[colid];
  12269. const dragBtnElem = evnt.target;
  12270. const cell = dragBtnElem.parentNode;
  12271. const cellParams = Object.assign(params, {
  12272. cell,
  12273. $table: $xeTable
  12274. });
  12275. const colMinWidth = getColReMinWidth(cellParams);
  12276. el.setAttribute('data-calc-col', 'Y');
  12277. let resizeWidth = calcColumnAutoWidth($xeTable, resizeColumn, el);
  12278. el.removeAttribute('data-calc-col');
  12279. if (colRest) {
  12280. resizeWidth = Math.max(resizeWidth, colRest.width);
  12281. }
  12282. resizeWidth = Math.max(colMinWidth, resizeWidth);
  12283. const resizeParams = {
  12284. ...params,
  12285. resizeWidth,
  12286. resizeColumn
  12287. };
  12288. reactData.isDragResize = false;
  12289. internalData._lastResizeTime = Date.now();
  12290. if ($xeTable.handleColResizeDblclickCellAreaEvent) {
  12291. $xeTable.handleColResizeDblclickCellAreaEvent(evnt, resizeParams);
  12292. } else {
  12293. resizeColumn.resizeWidth = resizeWidth;
  12294. handleUpdateColResize($xeTable, evnt, resizeParams);
  12295. }
  12296. }
  12297. },
  12298. handleRowResizeMousedownEvent(evnt, params) {
  12299. const $xeTable = this;
  12300. const props = $xeTable;
  12301. const reactData = $xeTable;
  12302. const internalData = $xeTable;
  12303. evnt.stopPropagation();
  12304. evnt.preventDefault();
  12305. const $xeGantt = $xeTable.$xeGantt;
  12306. const {
  12307. row
  12308. } = params;
  12309. const {
  12310. showOverflow
  12311. } = props;
  12312. const {
  12313. overflowX,
  12314. scrollbarWidth,
  12315. overflowY,
  12316. scrollbarHeight
  12317. } = reactData;
  12318. const {
  12319. elemStore,
  12320. fullAllDataRowIdData
  12321. } = internalData;
  12322. const osbWidth = overflowY ? scrollbarWidth : 0;
  12323. const osbHeight = overflowX ? scrollbarHeight : 0;
  12324. const scrollbarYToLeft = $xeTable.computeScrollbarYToLeft;
  12325. const resizableOpts = $xeTable.computeResizableOpts;
  12326. const rowOpts = $xeTable.computeRowOpts;
  12327. const cellOpts = $xeTable.computeCellOpts;
  12328. let tableEl = $xeTable.$refs.refElem;
  12329. if ($xeGantt) {
  12330. const ganttContainerElem = $xeGantt.$refs.refGanttContainerElem;
  12331. if (ganttContainerElem) {
  12332. tableEl = ganttContainerElem;
  12333. }
  12334. }
  12335. const resizeBarElem = $xeTable.$refs.refRowResizeBar;
  12336. if (!resizeBarElem) {
  12337. return;
  12338. }
  12339. const {
  12340. clientY: dragClientY
  12341. } = evnt;
  12342. const resizeTipElem = resizeBarElem.firstElementChild;
  12343. const dragBtnElem = evnt.currentTarget;
  12344. const tdEl = dragBtnElem.parentNode;
  12345. const trEl = tdEl.parentNode;
  12346. const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
  12347. if (!bodyScrollElem) {
  12348. return;
  12349. }
  12350. const rowid = getRowid($xeTable, row);
  12351. const rowRest = fullAllDataRowIdData[rowid];
  12352. if (!rowRest) {
  12353. return;
  12354. }
  12355. const defaultRowHeight = $xeTable.computeDefaultRowHeight;
  12356. let currCellHeight = rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight;
  12357. if (!showOverflow) {
  12358. currCellHeight = tdEl.clientHeight;
  12359. }
  12360. const tableRect = tableEl.getBoundingClientRect();
  12361. const trRect = trEl.getBoundingClientRect();
  12362. const targetOffsetY = dragClientY - trRect.y - trEl.clientHeight;
  12363. let resizeHeight = currCellHeight;
  12364. const cellEl = tdEl.querySelector('.vxe-cell');
  12365. let cellMinHeight = 0;
  12366. if (cellEl) {
  12367. const cellStyle = getComputedStyle(cellEl);
  12368. cellMinHeight = Math.max(1, Math.ceil(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(cellStyle.paddingTop) + external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(cellStyle.paddingBottom)));
  12369. }
  12370. const minTop = trRect.y - tableRect.y + cellMinHeight;
  12371. // 处理拖动事件
  12372. const updateEvent = evnt => {
  12373. evnt.stopPropagation();
  12374. evnt.preventDefault();
  12375. const rtWidth = tableEl.clientWidth - osbWidth;
  12376. const tableHeight = tableEl.clientHeight - osbHeight;
  12377. let dragTop = evnt.clientY - tableRect.y - targetOffsetY;
  12378. if (dragTop < minTop) {
  12379. dragTop = minTop;
  12380. } else {
  12381. resizeHeight = Math.max(cellMinHeight, currCellHeight + evnt.clientY - dragClientY);
  12382. }
  12383. resizeBarElem.style.left = `${scrollbarYToLeft ? osbWidth : 0}px`;
  12384. resizeBarElem.style.top = `${dragTop}px`;
  12385. resizeBarElem.style.width = `${rtWidth}px`;
  12386. if (resizableOpts.showDragTip && resizeTipElem) {
  12387. resizeTipElem.textContent = methods_getI18n('vxe.table.resizeRowTip', [resizeHeight]);
  12388. const resizeTipWidth = resizeTipElem.clientWidth;
  12389. const resizeTipHeight = resizeTipElem.clientHeight;
  12390. let resizeBarLeft = Math.max(2, evnt.clientX - tableRect.x);
  12391. let resizeBarTop = 0;
  12392. if (resizeBarLeft + resizeTipWidth >= rtWidth - 2) {
  12393. resizeBarLeft = rtWidth - resizeTipWidth - 2;
  12394. }
  12395. if (dragTop + resizeTipHeight >= tableHeight) {
  12396. resizeBarTop = tableHeight - (dragTop + resizeTipHeight);
  12397. }
  12398. resizeTipElem.style.left = `${resizeBarLeft}px`;
  12399. resizeTipElem.style.top = `${resizeBarTop}px`;
  12400. }
  12401. reactData.isDragResize = true;
  12402. };
  12403. reactData.isDragResize = true;
  12404. addClass(tableEl, 'row-drag--resize');
  12405. resizeBarElem.style.display = 'block';
  12406. document.onmousemove = updateEvent;
  12407. document.onmouseup = function (evnt) {
  12408. document.onmousemove = null;
  12409. document.onmouseup = null;
  12410. resizeBarElem.style.display = 'none';
  12411. internalData._lastResizeTime = Date.now();
  12412. setTimeout(() => {
  12413. reactData.isDragResize = false;
  12414. }, 50);
  12415. if (resizeHeight !== currCellHeight) {
  12416. const resizeParams = {
  12417. ...params,
  12418. resizeHeight,
  12419. resizeRow: row
  12420. };
  12421. internalData.isResizeCellHeight = true;
  12422. if ($xeTable.handleRowResizeCellAreaEvent) {
  12423. $xeTable.handleRowResizeCellAreaEvent(evnt, resizeParams);
  12424. } else {
  12425. rowRest.resizeHeight = resizeHeight;
  12426. handleUpdateRowResize($xeTable, evnt, resizeParams);
  12427. updateRowOffsetTop($xeTable);
  12428. }
  12429. }
  12430. removeClass(tableEl, 'row-drag--resize');
  12431. };
  12432. updateEvent(evnt);
  12433. },
  12434. handleRowResizeDblclickEvent(evnt, params) {
  12435. const $xeTable = this;
  12436. const reactData = $xeTable;
  12437. const internalData = $xeTable;
  12438. const resizableOpts = $xeTable.computeResizableOpts;
  12439. const {
  12440. isDblclickAutoHeight
  12441. } = resizableOpts;
  12442. const el = $xeTable.$refs.refElem;
  12443. if (isDblclickAutoHeight && el) {
  12444. evnt.stopPropagation();
  12445. evnt.preventDefault();
  12446. const {
  12447. editStore
  12448. } = reactData;
  12449. const {
  12450. fullAllDataRowIdData
  12451. } = internalData;
  12452. const {
  12453. actived
  12454. } = editStore;
  12455. const {
  12456. row
  12457. } = params;
  12458. const rowid = getRowid($xeTable, row);
  12459. const rowRest = fullAllDataRowIdData[rowid];
  12460. if (!rowRest) {
  12461. return;
  12462. }
  12463. const handleRsHeight = () => {
  12464. const resizeHeight = calcCellAutoHeight(rowRest, el);
  12465. const resizeParams = {
  12466. ...params,
  12467. resizeHeight,
  12468. resizeRow: row
  12469. };
  12470. reactData.isDragResize = false;
  12471. internalData._lastResizeTime = Date.now();
  12472. if ($xeTable.handleRowResizeDblclickCellAreaEvent) {
  12473. $xeTable.handleRowResizeDblclickCellAreaEvent(evnt, resizeParams);
  12474. } else {
  12475. rowRest.resizeHeight = resizeHeight;
  12476. handleUpdateRowResize($xeTable, evnt, resizeParams);
  12477. }
  12478. };
  12479. if (actived.row || actived.column) {
  12480. $xeTable.clearEdit().then(handleRsHeight);
  12481. } else {
  12482. handleRsHeight();
  12483. }
  12484. }
  12485. },
  12486. setRowHeightConf(heightConf) {
  12487. const $xeTable = this;
  12488. const reactData = $xeTable;
  12489. const internalData = $xeTable;
  12490. const {
  12491. fullAllDataRowIdData
  12492. } = internalData;
  12493. let status = false;
  12494. if (heightConf) {
  12495. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(heightConf, (height, rowid) => {
  12496. const rowRest = fullAllDataRowIdData[rowid];
  12497. if (rowRest) {
  12498. const rHeight = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(height);
  12499. if (rHeight) {
  12500. rowRest.resizeHeight = rHeight;
  12501. if (!status) {
  12502. status = true;
  12503. }
  12504. }
  12505. }
  12506. });
  12507. if (status) {
  12508. internalData.isResizeCellHeight = true;
  12509. reactData.resizeHeightFlag++;
  12510. }
  12511. }
  12512. return $xeTable.$nextTick().then(() => {
  12513. updateRowOffsetTop($xeTable);
  12514. return {
  12515. status
  12516. };
  12517. });
  12518. },
  12519. getRowHeightConf(isFull) {
  12520. const $xeTable = this;
  12521. const internalData = $xeTable;
  12522. const {
  12523. fullAllDataRowIdData,
  12524. afterFullData
  12525. } = internalData;
  12526. const {
  12527. handleGetRowId
  12528. } = createHandleGetRowId($xeTable);
  12529. const rowOpts = $xeTable.computeRowOpts;
  12530. const cellOpts = $xeTable.computeCellOpts;
  12531. const defaultRowHeight = $xeTable.computeDefaultRowHeight;
  12532. const rest = {};
  12533. afterFullData.forEach(row => {
  12534. const rowid = handleGetRowId(row);
  12535. const rowRest = fullAllDataRowIdData[rowid];
  12536. if (rowRest) {
  12537. const resizeHeight = rowRest.resizeHeight;
  12538. if (resizeHeight || isFull) {
  12539. const currCellHeight = resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight;
  12540. rest[rowid] = currCellHeight;
  12541. }
  12542. }
  12543. });
  12544. return rest;
  12545. },
  12546. recalcRowHeight(rowOrId) {
  12547. const $xeTable = this;
  12548. const reactData = $xeTable;
  12549. const internalData = $xeTable;
  12550. const {
  12551. fullAllDataRowIdData
  12552. } = internalData;
  12553. const rows = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(rowOrId) ? rowOrId : [rowOrId];
  12554. const el = $xeTable.$refs.refElem;
  12555. if (el) {
  12556. const {
  12557. handleGetRowId
  12558. } = createHandleGetRowId($xeTable);
  12559. el.setAttribute('data-calc-row', 'Y');
  12560. rows.forEach(row => {
  12561. const rowid = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(row) || external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(row) ? row : handleGetRowId(row);
  12562. const rowRest = fullAllDataRowIdData[rowid];
  12563. if (rowRest) {
  12564. rowRest.resizeHeight = calcCellAutoHeight(rowRest, el);
  12565. }
  12566. el.removeAttribute('data-calc-row');
  12567. });
  12568. reactData.calcCellHeightFlag++;
  12569. }
  12570. return $xeTable.$nextTick();
  12571. },
  12572. setRowHeight(rowOrId, height) {
  12573. const $xeTable = this;
  12574. const reactData = $xeTable;
  12575. const internalData = $xeTable;
  12576. const {
  12577. fullAllDataRowIdData
  12578. } = internalData;
  12579. let status = false;
  12580. const rows = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(rowOrId) ? rowOrId : [rowOrId];
  12581. let rHeight = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(height);
  12582. if (isScale(height)) {
  12583. const tableBody = $xeTable.$refs.refTableBody;
  12584. const bodyElem = tableBody ? tableBody.$el : null;
  12585. const bodyHeight = bodyElem ? bodyElem.clientHeight - 1 : 0;
  12586. rHeight = Math.floor(rHeight * bodyHeight);
  12587. }
  12588. if (rHeight) {
  12589. const {
  12590. handleGetRowId
  12591. } = createHandleGetRowId($xeTable);
  12592. rows.forEach(row => {
  12593. const rowid = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(row) || external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(row) ? row : handleGetRowId(row);
  12594. const rowRest = fullAllDataRowIdData[rowid];
  12595. if (rowRest) {
  12596. rowRest.resizeHeight = rHeight;
  12597. if (!status) {
  12598. status = true;
  12599. }
  12600. }
  12601. });
  12602. if (status) {
  12603. internalData.isResizeCellHeight = true;
  12604. reactData.resizeHeightFlag++;
  12605. }
  12606. }
  12607. return $xeTable.$nextTick();
  12608. },
  12609. getRowHeight(rowOrId) {
  12610. const $xeTable = this;
  12611. const internalData = $xeTable;
  12612. const {
  12613. fullAllDataRowIdData
  12614. } = internalData;
  12615. const rowOpts = $xeTable.computeRowOpts;
  12616. const cellOpts = $xeTable.computeCellOpts;
  12617. const defaultRowHeight = $xeTable.computeDefaultRowHeight;
  12618. const rowid = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(rowOrId) || external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(rowOrId) ? rowOrId : getRowid($xeTable, rowOrId);
  12619. const rowRest = fullAllDataRowIdData[rowid];
  12620. if (rowRest) {
  12621. return rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight;
  12622. }
  12623. return 0;
  12624. },
  12625. /**
  12626. * 刷新滚动操作,手动同步滚动相关位置(对于某些特殊的操作,比如滚动条错位、固定列不同步)
  12627. */
  12628. refreshScroll() {
  12629. const $xeTable = this;
  12630. const internalData = $xeTable;
  12631. const {
  12632. elemStore,
  12633. lastScrollLeft,
  12634. lastScrollTop
  12635. } = internalData;
  12636. const headerScrollElem = getRefElem(elemStore['main-header-scroll']);
  12637. const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
  12638. const footerScrollElem = getRefElem(elemStore['main-footer-scroll']);
  12639. const leftScrollElem = getRefElem(elemStore['left-body-scroll']);
  12640. const rightScrollElem = getRefElem(elemStore['right-body-scroll']);
  12641. const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
  12642. const yHandleEl = $xeTable.$refs.refScrollYHandleElem;
  12643. return new Promise(resolve => {
  12644. // 还原滚动条位置
  12645. if (lastScrollLeft || lastScrollTop) {
  12646. return restoreScrollLocation($xeTable, lastScrollLeft, lastScrollTop).then(() => {
  12647. // 存在滚动行为未结束情况
  12648. setTimeout(resolve, 10);
  12649. });
  12650. }
  12651. internalData.intoRunScroll = true;
  12652. // 重置
  12653. setScrollTop(yHandleEl, lastScrollTop);
  12654. setScrollTop(bodyScrollElem, lastScrollTop);
  12655. setScrollTop(leftScrollElem, lastScrollTop);
  12656. setScrollTop(rightScrollElem, lastScrollTop);
  12657. setScrollLeft(xHandleEl, lastScrollLeft);
  12658. setScrollLeft(bodyScrollElem, lastScrollLeft);
  12659. setScrollLeft(headerScrollElem, lastScrollLeft);
  12660. setScrollLeft(footerScrollElem, lastScrollLeft);
  12661. // 存在滚动行为未结束情况
  12662. setTimeout(() => {
  12663. internalData.intoRunScroll = false;
  12664. resolve();
  12665. }, 10);
  12666. });
  12667. },
  12668. handleResizeEvent() {
  12669. const $xeTable = this;
  12670. handleResizeEvent($xeTable);
  12671. },
  12672. /**
  12673. * 重新渲染布局
  12674. * 刷新布局
  12675. */
  12676. recalculate(reFull) {
  12677. const $xeTable = this;
  12678. const isForce = !!reFull;
  12679. return handleLazyRecalculate($xeTable, isForce, isForce, isForce);
  12680. },
  12681. updateStyle() {
  12682. const $xeTable = this;
  12683. return updateStyle($xeTable);
  12684. },
  12685. /**
  12686. * 处理固定列的显示状态
  12687. */
  12688. checkScrolling() {
  12689. const $xeTable = this;
  12690. const internalData = $xeTable;
  12691. const {
  12692. elemStore
  12693. } = internalData;
  12694. const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
  12695. const leftContainerElem = $xeTable.$refs.refLeftContainer;
  12696. const rightContainerElem = $xeTable.$refs.refRightContainer;
  12697. const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
  12698. const bodtTargetEl = xHandleEl || bodyScrollElem;
  12699. if (bodtTargetEl) {
  12700. if (leftContainerElem) {
  12701. if (bodtTargetEl.scrollLeft > 0) {
  12702. addClass(leftContainerElem, 'scrolling--middle');
  12703. } else {
  12704. removeClass(leftContainerElem, 'scrolling--middle');
  12705. }
  12706. }
  12707. if (rightContainerElem) {
  12708. if (bodtTargetEl.clientWidth < bodtTargetEl.scrollWidth - Math.ceil(bodtTargetEl.scrollLeft)) {
  12709. addClass(rightContainerElem, 'scrolling--middle');
  12710. } else {
  12711. removeClass(rightContainerElem, 'scrolling--middle');
  12712. }
  12713. }
  12714. }
  12715. },
  12716. preventEvent(evnt, type, args, next, end) {
  12717. const $xeTable = this;
  12718. const $xeGrid = $xeTable.$xeGrid;
  12719. const $xeGantt = $xeTable.$xeGantt;
  12720. let evntList = methods_interceptor.get(type);
  12721. // 兼容老版本
  12722. if (!evntList.length && type === 'event.clearEdit') {
  12723. evntList = methods_interceptor.get('event.clearActived');
  12724. if (evntList.length) {
  12725. warnLog('vxe.error.delEvent', ['event.clearActived', 'event.clearEdit']);
  12726. }
  12727. }
  12728. // 兼容老版本
  12729. let rest = null;
  12730. let isStop = false;
  12731. for (let i = 0; i < evntList.length; i++) {
  12732. const func = evntList[i];
  12733. const fnRest = func(Object.assign({
  12734. $table: $xeTable,
  12735. $grid: $xeGrid,
  12736. $gantt: $xeGantt,
  12737. $event: evnt
  12738. }, args));
  12739. if (fnRest === false) {
  12740. isStop = true;
  12741. break;
  12742. } else if (fnRest && fnRest.status === false) {
  12743. rest = fnRest.result;
  12744. isStop = true;
  12745. break;
  12746. }
  12747. }
  12748. if (!isStop) {
  12749. if (next) {
  12750. rest = next();
  12751. }
  12752. }
  12753. if (end) {
  12754. end();
  12755. }
  12756. return rest;
  12757. },
  12758. /**
  12759. * 全局按下事件处理
  12760. */
  12761. handleGlobalMousedownEvent(evnt) {
  12762. const $xeTable = this;
  12763. const props = $xeTable;
  12764. const $xeGrid = $xeTable.$xeGrid;
  12765. const $xeGantt = $xeTable.$xeGantt;
  12766. const $xeGGWrapper = $xeGrid || $xeGantt;
  12767. const reactData = $xeTable;
  12768. const internalData = $xeTable;
  12769. const {
  12770. editStore,
  12771. ctxMenuStore,
  12772. customStore
  12773. } = reactData;
  12774. const {
  12775. mouseConfig,
  12776. editRules
  12777. } = props;
  12778. const el = $xeTable.$refs.refElem;
  12779. const editOpts = $xeTable.computeEditOpts;
  12780. const validOpts = $xeTable.computeValidOpts;
  12781. const areaOpts = $xeTable.computeAreaOpts;
  12782. const {
  12783. actived
  12784. } = editStore;
  12785. const tableFilter = $xeTable.$refs.refTableFilter;
  12786. const tableMenu = $xeTable.$refs.refTableMenu;
  12787. const tableCustom = $xeTable.$refs.refTableCustom;
  12788. const validTooltip = $xeTable.$refs.refValidTooltip;
  12789. // 筛选
  12790. if (tableFilter) {
  12791. if (getEventTargetNode(evnt, el, 'vxe-cell--filter').flag) {
  12792. // 如果点击了筛选按钮
  12793. } else if (getEventTargetNode(evnt, tableFilter.$el).flag) {
  12794. // 如果点击筛选容器
  12795. } else {
  12796. if (!getEventTargetNode(evnt, document.body, 'vxe-table--ignore-clear').flag) {
  12797. this.preventEvent(evnt, 'event.clearFilter', internalData._currFilterParams, this.closeFilter);
  12798. }
  12799. }
  12800. }
  12801. // 自定义列
  12802. if (tableCustom) {
  12803. if (customStore.btnEl === evnt.target || getEventTargetNode(evnt, document.body, 'vxe-toolbar-custom-target').flag) {
  12804. // 如果点击了自定义列按钮
  12805. } else if (getEventTargetNode(evnt, tableCustom.$el).flag) {
  12806. // 如果点击自定义列容器
  12807. } else {
  12808. if (!getEventTargetNode(evnt, document.body, 'vxe-table--ignore-clear').flag) {
  12809. this.preventEvent(evnt, 'event.clearCustom', {}, () => this.closeCustom());
  12810. }
  12811. }
  12812. }
  12813. // 如果已激活了编辑状态
  12814. if (actived.row) {
  12815. if (!(editOpts.autoClear === false)) {
  12816. // 如果是激活状态,点击了单元格之外
  12817. const cell = actived.args.cell;
  12818. if (!cell || !getEventTargetNode(evnt, cell).flag) {
  12819. if (validTooltip && getEventTargetNode(evnt, validTooltip.$el).flag) {
  12820. // 如果是激活状态,且点击了校验提示框
  12821. } else if (!this.lastCallTime || this.lastCallTime + 50 < Date.now()) {
  12822. if (!getEventTargetNode(evnt, document.body, 'vxe-table--ignore-clear').flag) {
  12823. // 如果手动调用了激活单元格,避免触发源被移除后导致重复关闭
  12824. this.preventEvent(evnt, 'event.clearEdit', actived.args, () => {
  12825. let isClear;
  12826. if (editOpts.mode === 'row') {
  12827. const rowTargetNode = getEventTargetNode(evnt, el, 'vxe-body--row');
  12828. const rowNodeRest = rowTargetNode.flag ? $xeTable.getRowNode(rowTargetNode.targetElem) : null;
  12829. // row 方式,如果点击了不同行
  12830. isClear = rowNodeRest ? !$xeTable.eqRow(rowNodeRest.item, actived.args.row) : false;
  12831. } else {
  12832. // cell 方式,如果是非编辑列
  12833. isClear = !getEventTargetNode(evnt, el, 'col--edit').flag;
  12834. }
  12835. // 如果点击表头行,则清除激活状态
  12836. if (!isClear) {
  12837. isClear = getEventTargetNode(evnt, el, 'vxe-header--row').flag;
  12838. }
  12839. // 如果点击表尾行,则清除激活状态
  12840. if (!isClear) {
  12841. isClear = getEventTargetNode(evnt, el, 'vxe-footer--row').flag;
  12842. }
  12843. // 如果固定了高度且点击了行之外的空白处,则清除激活状态
  12844. if (!isClear && this.height && !this.overflowY) {
  12845. const bodyWrapperElem = evnt.target;
  12846. if (hasClass(bodyWrapperElem, 'vxe-table--body-wrapper')) {
  12847. isClear = evnt.offsetY < bodyWrapperElem.clientHeight;
  12848. }
  12849. }
  12850. if (isClear ||
  12851. // 如果点击了当前表格之外
  12852. !getEventTargetNode(evnt, el).flag) {
  12853. setTimeout(() => {
  12854. $xeTable.handleClearEdit(evnt).then(() => {
  12855. // 如果存在校验,点击了表格之外则清除
  12856. if (!this.isActivated && editRules && validOpts.autoClear) {
  12857. this.validErrorMaps = {};
  12858. }
  12859. });
  12860. });
  12861. }
  12862. });
  12863. }
  12864. }
  12865. }
  12866. }
  12867. } else if (mouseConfig) {
  12868. if (!getEventTargetNode(evnt, el).flag && !($xeGGWrapper && getEventTargetNode(evnt, $xeGGWrapper.$el).flag) && !(tableMenu && getEventTargetNode(evnt, tableMenu.$el).flag) && !(this.$toolbar && getEventTargetNode(evnt, this.$toolbar.$el).flag)) {
  12869. if ($xeTable.clearSelected) {
  12870. $xeTable.clearSelected();
  12871. }
  12872. if (areaOpts.autoClear) {
  12873. if ($xeTable.getCellAreas) {
  12874. const cellAreas = $xeTable.getCellAreas();
  12875. if (cellAreas && cellAreas.length && !getEventTargetNode(evnt, document.body, 'vxe-table--ignore-areas-clear').flag) {
  12876. $xeTable.preventEvent(evnt, 'event.clearAreas', {}, () => {
  12877. $xeTable.clearCellAreas();
  12878. $xeTable.clearCopyCellArea();
  12879. $xeTable.dispatchEvent('clear-cell-area-selection', {
  12880. cellAreas
  12881. }, evnt);
  12882. });
  12883. }
  12884. }
  12885. }
  12886. }
  12887. }
  12888. // 如果配置了快捷菜单且,点击了其他地方则关闭
  12889. if (ctxMenuStore.visible && tableMenu && !getEventTargetNode(evnt, tableMenu.$el).flag) {
  12890. this.closeMenu();
  12891. }
  12892. const isActivated = getEventTargetNode(evnt, ($xeGGWrapper || $xeTable).$el).flag;
  12893. // 如果存在校验,点击了表格之外则清除
  12894. if (!isActivated && editRules && validOpts.autoClear) {
  12895. this.validErrorMaps = {};
  12896. }
  12897. // 最后激活的表格
  12898. this.isActivated = isActivated;
  12899. },
  12900. /**
  12901. * 窗口失焦事件处理
  12902. */
  12903. handleGlobalBlurEvent() {
  12904. this.closeFilter();
  12905. this.closeMenu();
  12906. },
  12907. /**
  12908. * 全局滚动事件
  12909. */
  12910. handleGlobalMousewheelEvent() {
  12911. this.closeTooltip();
  12912. this.closeMenu();
  12913. },
  12914. /**
  12915. * 表格键盘事件
  12916. */
  12917. keydownEvent(evnt) {
  12918. const $xeTable = this;
  12919. const {
  12920. filterStore,
  12921. ctxMenuStore,
  12922. editStore,
  12923. keyboardConfig,
  12924. mouseConfig,
  12925. mouseOpts,
  12926. keyboardOpts
  12927. } = this;
  12928. const {
  12929. actived
  12930. } = editStore;
  12931. const {
  12932. keyCode
  12933. } = evnt;
  12934. const isEsc = keyCode === 27;
  12935. if (isEsc) {
  12936. this.preventEvent(evnt, 'event.keydown', null, () => {
  12937. $xeTable.dispatchEvent('keydown-start', {}, evnt);
  12938. if (keyboardConfig && mouseConfig && mouseOpts.area && this.handleKeyboardCellAreaEvent) {
  12939. this.handleKeyboardCellAreaEvent(evnt);
  12940. } else if (actived.row || filterStore.visible || ctxMenuStore.visible) {
  12941. evnt.stopPropagation();
  12942. // 如果按下了 Esc 键,关闭快捷菜单、筛选
  12943. this.closeFilter();
  12944. this.closeMenu();
  12945. if (keyboardConfig && keyboardOpts.isEsc) {
  12946. // 如果是激活编辑状态,则取消编辑
  12947. if (actived.row) {
  12948. const params = actived.args;
  12949. this.handleClearEdit(evnt);
  12950. // 如果配置了选中功能,则为选中状态
  12951. if (mouseConfig && mouseOpts.selected) {
  12952. this.$nextTick(() => this.handleSelected(params, evnt));
  12953. }
  12954. }
  12955. }
  12956. }
  12957. $xeTable.dispatchEvent('keydown', {}, evnt);
  12958. $xeTable.dispatchEvent('keydown-end', {}, evnt);
  12959. });
  12960. }
  12961. },
  12962. /**
  12963. * 全局键盘事件
  12964. */
  12965. handleGlobalKeydownEvent(evnt) {
  12966. const $xeTable = this;
  12967. const props = $xeTable;
  12968. const internalData = $xeTable;
  12969. const reactData = $xeTable;
  12970. const $xeGrid = $xeTable.$xeGrid;
  12971. const $xeGantt = $xeTable.$xeGantt;
  12972. // 该行为只对当前激活的表格有效
  12973. if (internalData.isActivated) {
  12974. $xeTable.preventEvent(evnt, 'event.keydown', null, () => {
  12975. const {
  12976. mouseConfig,
  12977. keyboardConfig,
  12978. treeConfig,
  12979. editConfig,
  12980. highlightCurrentRow,
  12981. highlightCurrentColumn
  12982. } = props;
  12983. const {
  12984. ctxMenuStore,
  12985. editStore,
  12986. currentRow
  12987. } = reactData;
  12988. const {
  12989. afterFullData
  12990. } = internalData;
  12991. const isContentMenu = $xeTable.computeIsContentMenu;
  12992. const bodyMenu = $xeTable.computeBodyMenu;
  12993. const keyboardOpts = $xeTable.computeKeyboardOpts;
  12994. const mouseOpts = $xeTable.computeMouseOpts;
  12995. const editOpts = $xeTable.computeEditOpts;
  12996. const treeOpts = $xeTable.computeTreeOpts;
  12997. const menuList = $xeTable.computeMenuList;
  12998. const rowOpts = $xeTable.computeRowOpts;
  12999. const columnOpts = $xeTable.computeColumnOpts;
  13000. const {
  13001. selected,
  13002. actived
  13003. } = editStore;
  13004. const {
  13005. keyCode
  13006. } = evnt;
  13007. const hasBackspaceKey = keyCode === 8;
  13008. const isTab = keyCode === 9;
  13009. const isEnter = keyCode === 13;
  13010. const isEsc = keyCode === 27;
  13011. const isSpacebar = keyCode === 32;
  13012. const isLeftArrow = keyCode === 37;
  13013. const isUpArrow = keyCode === 38;
  13014. const isRightArrow = keyCode === 39;
  13015. const isDwArrow = keyCode === 40;
  13016. const hasDeleteKey = keyCode === 46;
  13017. const isF2 = keyCode === 113;
  13018. const isContextMenu = keyCode === 93;
  13019. const isControlKey = hasControlKey(evnt);
  13020. const hasShiftKey = evnt.shiftKey;
  13021. const hasAltKey = evnt.altKey;
  13022. const operArrow = isLeftArrow || isUpArrow || isRightArrow || isDwArrow;
  13023. const operCtxMenu = isContentMenu && ctxMenuStore.visible && (isEnter || isSpacebar || operArrow);
  13024. const isEditStatus = isEnableConf(editConfig) && actived.column && actived.row;
  13025. const childrenField = treeOpts.children || treeOpts.childrenField;
  13026. const beforeEditMethod = editOpts.beforeEditMethod || editOpts.activeMethod;
  13027. if (operCtxMenu) {
  13028. // 如果配置了右键菜单; 支持方向键操作、回车
  13029. evnt.preventDefault();
  13030. if (ctxMenuStore.showChild && hasChildrenList(ctxMenuStore.selected)) {
  13031. $xeTable.moveCtxMenu(evnt, ctxMenuStore, 'selectChild', isLeftArrow, false, ctxMenuStore.selected.children);
  13032. } else {
  13033. $xeTable.moveCtxMenu(evnt, ctxMenuStore, 'selected', isRightArrow, true, menuList);
  13034. }
  13035. } else if (keyboardConfig && mouseConfig && mouseOpts.area && $xeTable.handleKeyboardCellAreaEvent) {
  13036. $xeTable.handleKeyboardCellAreaEvent(evnt);
  13037. } else if (isEsc) {
  13038. // 如果按下了 Esc 键,关闭快捷菜单、筛选
  13039. if ($xeTable.closeMenu) {
  13040. $xeTable.closeMenu();
  13041. }
  13042. $xeTable.closeFilter();
  13043. if (keyboardConfig && keyboardOpts.isEsc) {
  13044. // 如果是激活编辑状态,则取消编辑
  13045. if (actived.row) {
  13046. const params = actived.args;
  13047. $xeTable.handleClearEdit(evnt);
  13048. // 如果配置了选中功能,则为选中状态
  13049. if (mouseOpts.selected) {
  13050. $xeTable.$nextTick(() => $xeTable.handleSelected(params, evnt));
  13051. }
  13052. }
  13053. }
  13054. } else if (keyboardConfig && isSpacebar && keyboardOpts.isChecked && selected.row && selected.column && (selected.column.type === 'checkbox' || selected.column.type === 'radio')) {
  13055. // 空格键支持选中复选框
  13056. evnt.preventDefault();
  13057. if (selected.column.type === 'checkbox') {
  13058. $xeTable.handleToggleCheckRowEvent(evnt, selected.args);
  13059. } else {
  13060. $xeTable.triggerRadioRowEvent(evnt, selected.args);
  13061. }
  13062. } else if (isF2 && isEnableConf(editConfig)) {
  13063. if (!isEditStatus) {
  13064. // 如果按下了 F2 键
  13065. if (selected.row && selected.column) {
  13066. evnt.stopPropagation();
  13067. evnt.preventDefault();
  13068. $xeTable.handleEdit(selected.args, evnt);
  13069. }
  13070. }
  13071. } else if (isContextMenu) {
  13072. // 如果按下上下文键
  13073. internalData._keyCtx = selected.row && selected.column && bodyMenu.length;
  13074. clearTimeout(internalData.keyCtxTimeout);
  13075. internalData.keyCtxTimeout = setTimeout(() => {
  13076. internalData._keyCtx = false;
  13077. }, 1000);
  13078. } else if (isEnter && !hasAltKey && keyboardConfig && keyboardOpts.isEnter && (selected.row || actived.row || treeConfig && (rowOpts.isCurrent || highlightCurrentRow) && currentRow)) {
  13079. const {
  13080. isLastEnterAppendRow,
  13081. beforeEnterMethod,
  13082. enterMethod
  13083. } = keyboardOpts;
  13084. // 退出选中
  13085. if (isControlKey) {
  13086. // 如果是激活编辑状态,则取消编辑
  13087. if (actived.row) {
  13088. const params = actived.args;
  13089. $xeTable.handleClearEdit(evnt);
  13090. // 如果配置了选中功能,则为选中状态
  13091. if (mouseConfig && mouseOpts.selected) {
  13092. $xeTable.$nextTick(() => $xeTable.handleSelected(params, evnt));
  13093. }
  13094. }
  13095. } else {
  13096. // 如果是激活状态,退则出到上一行/下一行
  13097. if (selected.row || actived.row) {
  13098. const activeParams = selected.row ? selected.args : actived.args;
  13099. if (hasShiftKey) {
  13100. if (keyboardOpts.enterToTab) {
  13101. $xeTable.moveTabSelected(activeParams, hasShiftKey, evnt);
  13102. } else {
  13103. $xeTable.moveEnterSelected(activeParams, isLeftArrow, true, isRightArrow, false, evnt);
  13104. }
  13105. } else {
  13106. if (keyboardOpts.enterToTab) {
  13107. $xeTable.moveTabSelected(activeParams, hasShiftKey, evnt);
  13108. } else {
  13109. const activeRow = selected.row || actived.row;
  13110. const activeColumn = selected.column || actived.column;
  13111. const _rowIndex = $xeTable.getVTRowIndex(activeRow);
  13112. const etrParams = {
  13113. row: activeRow,
  13114. rowIndex: $xeTable.getRowIndex(activeRow),
  13115. $rowIndex: $xeTable.getVMRowIndex(activeRow),
  13116. _rowIndex,
  13117. column: activeColumn,
  13118. columnIndex: $xeTable.getColumnIndex(activeColumn),
  13119. $columnIndex: $xeTable.getVMColumnIndex(activeColumn),
  13120. _columnIndex: $xeTable.getVTColumnIndex(activeColumn),
  13121. $table: $xeTable
  13122. };
  13123. if (!beforeEnterMethod || beforeEnterMethod(etrParams) !== false) {
  13124. // 最后一行按下回车键,自动追加一行
  13125. if (isLastEnterAppendRow) {
  13126. if (_rowIndex >= afterFullData.length - 1) {
  13127. $xeTable.insertAt({}, -1).then(({
  13128. row: newRow
  13129. }) => {
  13130. $xeTable.scrollToRow(newRow, selected.column);
  13131. $xeTable.handleSelected({
  13132. ...activeParams,
  13133. row: newRow
  13134. }, evnt);
  13135. });
  13136. $xeTable.dispatchEvent('enter-append-row', etrParams, evnt);
  13137. return;
  13138. }
  13139. }
  13140. $xeTable.moveEnterSelected(activeParams, isLeftArrow, false, isRightArrow, true, evnt);
  13141. if (enterMethod) {
  13142. enterMethod(etrParams);
  13143. }
  13144. }
  13145. }
  13146. }
  13147. } else if (treeConfig && (rowOpts.isCurrent || highlightCurrentRow) && currentRow) {
  13148. // 如果是树形表格当前行回车移动到子节点
  13149. const childrens = currentRow[childrenField];
  13150. if (childrens && childrens.length) {
  13151. evnt.preventDefault();
  13152. const targetRow = childrens[0];
  13153. const params = {
  13154. $table: $xeTable,
  13155. row: targetRow,
  13156. rowIndex: $xeTable.getRowIndex(targetRow),
  13157. $rowIndex: $xeTable.getVMRowIndex(targetRow)
  13158. };
  13159. $xeTable.setTreeExpand(currentRow, true).then(() => $xeTable.scrollToRow(targetRow)).then(() => $xeTable.triggerCurrentRowEvent(evnt, params));
  13160. }
  13161. }
  13162. }
  13163. } else if (operArrow && keyboardConfig && keyboardOpts.isArrow) {
  13164. if (!isEditStatus) {
  13165. // 如果按下了方向键
  13166. if (mouseOpts.selected && selected.row && selected.column) {
  13167. $xeTable.moveArrowSelected(selected.args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow, evnt);
  13168. } else {
  13169. // 当前行按键上下移动
  13170. if ((isUpArrow || isDwArrow) && (rowOpts.isCurrent || highlightCurrentRow)) {
  13171. $xeTable.moveCurrentRow(isUpArrow, isDwArrow, evnt);
  13172. }
  13173. // 当前行按键左右移动
  13174. if ((isLeftArrow || isRightArrow) && (columnOpts.isCurrent || highlightCurrentColumn)) {
  13175. $xeTable.moveCurrentColumn(isLeftArrow, isRightArrow, evnt);
  13176. }
  13177. }
  13178. }
  13179. } else if (isTab && keyboardConfig && keyboardOpts.isTab) {
  13180. // 如果按下了 Tab 键切换
  13181. if (selected.row || selected.column) {
  13182. $xeTable.moveTabSelected(selected.args, hasShiftKey, evnt);
  13183. } else if (actived.row || actived.column) {
  13184. $xeTable.moveTabSelected(actived.args, hasShiftKey, evnt);
  13185. }
  13186. } else if (keyboardConfig && keyboardOpts.isDel && hasDeleteKey && isEnableConf(editConfig) && (selected.row || selected.column)) {
  13187. // 如果是删除键
  13188. if (!isEditStatus) {
  13189. const {
  13190. delMethod
  13191. } = keyboardOpts;
  13192. const params = {
  13193. row: selected.row,
  13194. rowIndex: $xeTable.getRowIndex(selected.row),
  13195. column: selected.column,
  13196. columnIndex: $xeTable.getColumnIndex(selected.column),
  13197. $table: $xeTable,
  13198. $grid: $xeGrid,
  13199. $gantt: $xeGantt
  13200. };
  13201. // 是否被禁用
  13202. if (!beforeEditMethod || beforeEditMethod(params)) {
  13203. if (delMethod) {
  13204. delMethod(params);
  13205. } else {
  13206. setCellValue(selected.row, selected.column, null);
  13207. }
  13208. // 如果按下 del 键,更新表尾数据
  13209. $xeTable.updateFooter();
  13210. $xeTable.dispatchEvent('cell-delete-value', params, evnt);
  13211. }
  13212. }
  13213. } else if (hasBackspaceKey && keyboardConfig && keyboardOpts.isBack && isEnableConf(editConfig) && (selected.row || selected.column)) {
  13214. if (!isEditStatus) {
  13215. const {
  13216. editMode,
  13217. backMethod
  13218. } = keyboardOpts;
  13219. // 如果是删除键
  13220. if (keyboardOpts.isDel && isEnableConf(editConfig) && (selected.row || selected.column)) {
  13221. const params = {
  13222. row: selected.row,
  13223. rowIndex: $xeTable.getRowIndex(selected.row),
  13224. column: selected.column,
  13225. columnIndex: $xeTable.getColumnIndex(selected.column),
  13226. $table: $xeTable,
  13227. $grid: $xeGrid,
  13228. $gantt: $xeGantt
  13229. };
  13230. // 是否被禁用
  13231. if (!beforeEditMethod || beforeEditMethod(params)) {
  13232. if (backMethod) {
  13233. backMethod(params);
  13234. } else {
  13235. // 追加方式与覆盖式
  13236. if (editMode !== 'insert') {
  13237. setCellValue(selected.row, selected.column, null);
  13238. }
  13239. $xeTable.handleEdit(selected.args, evnt);
  13240. }
  13241. $xeTable.dispatchEvent('cell-backspace-value', params, evnt);
  13242. }
  13243. }
  13244. }
  13245. } else if (hasBackspaceKey && keyboardConfig && treeConfig && keyboardOpts.isBack && (rowOpts.isCurrent || highlightCurrentRow) && currentRow) {
  13246. // 如果树形表格回退键关闭当前行返回父节点
  13247. const {
  13248. parent: parentRow
  13249. } = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findTree(internalData.afterTreeFullData, item => item === currentRow, {
  13250. children: childrenField
  13251. });
  13252. if (parentRow) {
  13253. evnt.preventDefault();
  13254. const params = {
  13255. row: parentRow,
  13256. rowIndex: $xeTable.getRowIndex(parentRow),
  13257. $rowIndex: $xeTable.getVMRowIndex(parentRow),
  13258. $table: $xeTable,
  13259. $grid: $xeGrid,
  13260. $gantt: $xeGantt
  13261. };
  13262. $xeTable.setTreeExpand(parentRow, false).then(() => $xeTable.scrollToRow(parentRow)).then(() => $xeTable.triggerCurrentRowEvent(evnt, params));
  13263. }
  13264. } else if (keyboardConfig && keyboardOpts.isEdit && !isControlKey && (isSpacebar || keyCode >= 48 && keyCode <= 57 || keyCode >= 65 && keyCode <= 90 || keyCode >= 96 && keyCode <= 111 || keyCode >= 186 && keyCode <= 192 || keyCode >= 219 && keyCode <= 222)) {
  13265. const {
  13266. editMethod
  13267. } = keyboardOpts;
  13268. // 启用编辑后,空格键功能将失效
  13269. // if (isSpacebar) {
  13270. // evnt.preventDefault()
  13271. // }
  13272. // 如果是按下非功能键之外允许直接编辑
  13273. if (selected.column && selected.row && isEnableConf(selected.column.editRender)) {
  13274. const beforeEditMethod = editOpts.beforeEditMethod || editOpts.activeMethod;
  13275. const params = {
  13276. row: selected.row,
  13277. rowIndex: $xeTable.getRowIndex(selected.row),
  13278. column: selected.column,
  13279. columnIndex: $xeTable.getColumnIndex(selected.column),
  13280. $table: $xeTable,
  13281. $grid: $xeGrid,
  13282. $gantt: $xeGantt
  13283. };
  13284. if (!beforeEditMethod || beforeEditMethod(params)) {
  13285. if (editMethod) {
  13286. editMethod(params);
  13287. } else {
  13288. setCellValue(selected.row, selected.column, null);
  13289. $xeTable.handleEdit(selected.args, evnt);
  13290. }
  13291. }
  13292. }
  13293. }
  13294. $xeTable.dispatchEvent('keydown', {}, evnt);
  13295. });
  13296. }
  13297. },
  13298. handleGlobalPasteEvent(evnt) {
  13299. const $xeTable = this;
  13300. const {
  13301. isActivated,
  13302. keyboardConfig,
  13303. keyboardOpts,
  13304. mouseConfig,
  13305. mouseOpts,
  13306. editStore,
  13307. filterStore
  13308. } = this;
  13309. const {
  13310. actived
  13311. } = editStore;
  13312. if (isActivated && !filterStore.visible) {
  13313. if (!(actived.row || actived.column)) {
  13314. if (keyboardConfig && keyboardOpts.isClip && mouseConfig && mouseOpts.area && this.handlePasteCellAreaEvent) {
  13315. this.handlePasteCellAreaEvent(evnt);
  13316. }
  13317. }
  13318. $xeTable.dispatchEvent('paste', {}, evnt);
  13319. }
  13320. },
  13321. handleGlobalCopyEvent(evnt) {
  13322. const $xeTable = this;
  13323. const {
  13324. isActivated,
  13325. keyboardConfig,
  13326. keyboardOpts,
  13327. mouseConfig,
  13328. mouseOpts,
  13329. editStore,
  13330. filterStore
  13331. } = this;
  13332. const {
  13333. actived
  13334. } = editStore;
  13335. if (isActivated && !filterStore.visible) {
  13336. if (!(actived.row || actived.column)) {
  13337. if (keyboardConfig && keyboardOpts.isClip && mouseConfig && mouseOpts.area && this.handleCopyCellAreaEvent) {
  13338. this.handleCopyCellAreaEvent(evnt);
  13339. }
  13340. }
  13341. $xeTable.dispatchEvent('copy', {}, evnt);
  13342. }
  13343. },
  13344. handleGlobalCutEvent(evnt) {
  13345. const $xeTable = this;
  13346. const {
  13347. isActivated,
  13348. keyboardConfig,
  13349. keyboardOpts,
  13350. mouseConfig,
  13351. mouseOpts,
  13352. editStore,
  13353. filterStore
  13354. } = this;
  13355. const {
  13356. actived
  13357. } = editStore;
  13358. if (isActivated && !filterStore.visible) {
  13359. if (!(actived.row || actived.column)) {
  13360. if (keyboardConfig && keyboardOpts.isClip && mouseConfig && mouseOpts.area && this.handleCutCellAreaEvent) {
  13361. this.handleCutCellAreaEvent(evnt);
  13362. }
  13363. }
  13364. $xeTable.dispatchEvent('cut', {}, evnt);
  13365. }
  13366. },
  13367. handleGlobalResizeEvent() {
  13368. const $xeTable = this;
  13369. $xeTable.closeMenu();
  13370. $xeTable.updateCellAreas();
  13371. handleResizeEvent($xeTable);
  13372. $xeTable.updateCellAreas();
  13373. },
  13374. /**
  13375. * 处理合并
  13376. */
  13377. handleUpdateBodyMerge() {
  13378. const $xeTable = this;
  13379. const reactData = $xeTable;
  13380. const internalData = $xeTable;
  13381. const {
  13382. mergeBodyList
  13383. } = internalData;
  13384. internalData.mergeBodyCellMaps = buildMergeData(mergeBodyList);
  13385. reactData.mergeBodyFlag++;
  13386. },
  13387. handleUpdateHeaderMerge() {
  13388. const $xeTable = this;
  13389. const reactData = $xeTable;
  13390. const internalData = $xeTable;
  13391. const {
  13392. mergeHeaderList
  13393. } = internalData;
  13394. internalData.mergeHeaderCellMaps = buildMergeData(mergeHeaderList);
  13395. reactData.mergeHeadFlag++;
  13396. },
  13397. handleUpdateFooterMerge() {
  13398. const $xeTable = this;
  13399. const reactData = $xeTable;
  13400. const internalData = $xeTable;
  13401. const {
  13402. mergeFooterList
  13403. } = internalData;
  13404. internalData.mergeFooterCellMaps = buildMergeData(mergeFooterList);
  13405. reactData.mergeFootFlag++;
  13406. },
  13407. handleAggregateSummaryData() {
  13408. const $xeTable = this;
  13409. return updateGroupData($xeTable);
  13410. },
  13411. handleTargetLeaveEvent() {
  13412. const $xeTable = this;
  13413. const internalData = $xeTable;
  13414. const tooltipOpts = $xeTable.computeTooltipOpts;
  13415. let $tooltip = $xeTable.$refs.refTooltip;
  13416. if ($tooltip && $tooltip.setActived) {
  13417. $tooltip.setActived(false);
  13418. }
  13419. if (tooltipOpts.enterable) {
  13420. internalData.tooltipTimeout = setTimeout(() => {
  13421. $tooltip = $xeTable.$refs.refTooltip;
  13422. if ($tooltip && $tooltip.isActived && !$tooltip.isActived()) {
  13423. $xeTable.closeTooltip();
  13424. }
  13425. }, tooltipOpts.leaveDelay);
  13426. } else {
  13427. $xeTable.closeTooltip();
  13428. }
  13429. },
  13430. triggerHeaderTitleEvent(evnt, iconParams, params) {
  13431. const $xeTable = this;
  13432. const reactData = $xeTable;
  13433. const tipContent = iconParams.content || iconParams.message;
  13434. if (tipContent) {
  13435. const {
  13436. tooltipStore
  13437. } = reactData;
  13438. const {
  13439. column
  13440. } = params;
  13441. const content = getFuncText(tipContent);
  13442. handleTargetEnterEvent($xeTable, true);
  13443. tooltipStore.row = null;
  13444. tooltipStore.column = column;
  13445. tooltipStore.visible = true;
  13446. tooltipStore.currOpts = iconParams;
  13447. $xeTable.$nextTick(() => {
  13448. const $tooltip = $xeTable.$refs.refTooltip;
  13449. if ($tooltip && $tooltip.open) {
  13450. $tooltip.open(evnt.currentTarget, content);
  13451. }
  13452. });
  13453. }
  13454. },
  13455. /**
  13456. * 触发表头 tooltip 事件
  13457. */
  13458. triggerHeaderTooltipEvent(evnt, params) {
  13459. const $xeTable = this;
  13460. const reactData = $xeTable;
  13461. const {
  13462. tooltipStore
  13463. } = reactData;
  13464. const headerTooltipOpts = $xeTable.computeHeaderTooltipOpts;
  13465. const {
  13466. column
  13467. } = params;
  13468. handleTargetEnterEvent($xeTable, true);
  13469. const titleElem = evnt.currentTarget;
  13470. if (!titleElem) {
  13471. return;
  13472. }
  13473. const cWrapperEl = titleElem.parentElement;
  13474. if (!cWrapperEl) {
  13475. return;
  13476. }
  13477. const cellEl = cWrapperEl.parentElement;
  13478. if (!cellEl) {
  13479. return;
  13480. }
  13481. const thEl = cellEl.parentElement;
  13482. if (!thEl) {
  13483. return;
  13484. }
  13485. if (tooltipStore.column !== column || !tooltipStore.visible) {
  13486. const ctEl = thEl.querySelector('.vxe-cell--title');
  13487. handleTooltip($xeTable, evnt, headerTooltipOpts, 'header', thEl, (hasClass(thEl, 'col--ellipsis') ? ctEl : cWrapperEl) || cWrapperEl, ctEl || cellEl, params);
  13488. }
  13489. },
  13490. /**
  13491. * 触发单元格 tooltip 事件
  13492. */
  13493. triggerBodyTooltipEvent(evnt, params) {
  13494. const $xeTable = this;
  13495. const props = $xeTable;
  13496. const reactData = $xeTable;
  13497. const {
  13498. editConfig
  13499. } = props;
  13500. const {
  13501. editStore
  13502. } = reactData;
  13503. const {
  13504. tooltipStore
  13505. } = reactData;
  13506. const tooltipOpts = $xeTable.computeTooltipOpts;
  13507. const editOpts = $xeTable.computeEditOpts;
  13508. const {
  13509. actived
  13510. } = editStore;
  13511. const {
  13512. row,
  13513. column
  13514. } = params;
  13515. const tdEl = evnt.currentTarget;
  13516. handleTargetEnterEvent($xeTable, tooltipStore.column !== column || tooltipStore.row !== row);
  13517. // 单元格处于编辑状态时不触发提示框
  13518. if (column.editRender && isEnableConf(editConfig)) {
  13519. // 如果是行编辑模式
  13520. if (editOpts.mode === 'row' && actived.row === row) {
  13521. return;
  13522. }
  13523. // 如果是单元格编辑模式
  13524. if (actived.row === row && actived.column === column) {
  13525. return;
  13526. }
  13527. }
  13528. if (tooltipStore.column !== column || tooltipStore.row !== row || !tooltipStore.visible) {
  13529. const ctEl = tdEl.querySelector('.vxe-cell--wrapper');
  13530. let ovEl = null;
  13531. let tipEl = tdEl.querySelector(column.type === 'html' ? '.vxe-cell--html' : '.vxe-cell--label');
  13532. if (column.treeNode) {
  13533. ovEl = tdEl.querySelector('.vxe-tree-cell');
  13534. }
  13535. if (!tipEl) {
  13536. tipEl = ctEl;
  13537. }
  13538. handleTooltip($xeTable, evnt, tooltipOpts, 'body', tdEl, ovEl || ctEl, tipEl, params);
  13539. }
  13540. },
  13541. /**
  13542. * 触发表尾 tooltip 事件
  13543. */
  13544. triggerFooterTooltipEvent(evnt, params) {
  13545. const $xeTable = this;
  13546. const reactData = $xeTable;
  13547. const {
  13548. column
  13549. } = params;
  13550. const {
  13551. tooltipStore
  13552. } = reactData;
  13553. const footerTooltipOpts = $xeTable.computeFooterTooltipOpts;
  13554. const tdEl = evnt.currentTarget;
  13555. handleTargetEnterEvent($xeTable, tooltipStore.column !== column || !!tooltipStore.row);
  13556. if (tooltipStore.column !== column || !tooltipStore.visible) {
  13557. const ctEl = tdEl.querySelector('.vxe-cell--wrapper');
  13558. let ovEl = null;
  13559. let tipEl = tdEl.querySelector(column.type === 'html' ? '.vxe-cell--html' : '.vxe-cell--label');
  13560. if (column.type === 'html') {
  13561. ovEl = tdEl.querySelector('.vxe-cell--html');
  13562. }
  13563. if (!tipEl) {
  13564. tipEl = ctEl;
  13565. }
  13566. handleTooltip($xeTable, evnt, footerTooltipOpts, 'footer', tdEl, ovEl || ctEl, tipEl, params);
  13567. }
  13568. },
  13569. openTooltip(target, content) {
  13570. const {
  13571. $refs
  13572. } = this;
  13573. const commTip = $refs.refCommTooltip;
  13574. if (commTip) {
  13575. return commTip.open(target, content);
  13576. }
  13577. return this.$nextTick();
  13578. },
  13579. /**
  13580. * 关闭 tooltip
  13581. */
  13582. closeTooltip() {
  13583. const $xeTable = this;
  13584. const reactData = $xeTable;
  13585. const {
  13586. tooltipStore
  13587. } = reactData;
  13588. const tooltip = $xeTable.$refs.refTooltip;
  13589. const commTip = $xeTable.$refs.refCommTooltip;
  13590. if (tooltipStore.visible) {
  13591. Object.assign(tooltipStore, {
  13592. row: null,
  13593. column: null,
  13594. content: null,
  13595. visible: false,
  13596. type: null,
  13597. currOpts: {}
  13598. });
  13599. if (tooltip) {
  13600. tooltip.close();
  13601. }
  13602. }
  13603. if (commTip) {
  13604. commTip.close();
  13605. }
  13606. return this.$nextTick();
  13607. },
  13608. /**
  13609. * 判断列头复选框是否被选中
  13610. */
  13611. isAllCheckboxChecked() {
  13612. return this.isAllSelected;
  13613. },
  13614. /**
  13615. * 判断列头复选框是否被半选
  13616. */
  13617. isAllCheckboxIndeterminate() {
  13618. return !this.isAllSelected && this.isIndeterminate;
  13619. },
  13620. isCheckboxIndeterminate() {
  13621. warnLog('vxe.error.delFunc', ['isCheckboxIndeterminate', 'isAllCheckboxIndeterminate']);
  13622. return this.isAllCheckboxIndeterminate();
  13623. },
  13624. /**
  13625. * 获取复选框半选状态的行数据
  13626. */
  13627. getCheckboxIndeterminateRecords(isFull) {
  13628. const $xeTable = this;
  13629. const props = $xeTable;
  13630. const internalData = $xeTable;
  13631. const {
  13632. treeConfig
  13633. } = props;
  13634. const {
  13635. fullDataRowIdData,
  13636. treeIndeterminateRowMaps
  13637. } = internalData;
  13638. if (treeConfig) {
  13639. const fullRest = [];
  13640. const defRest = [];
  13641. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(treeIndeterminateRowMaps, (item, rowid) => {
  13642. if (item) {
  13643. fullRest.push(item);
  13644. if (fullDataRowIdData[rowid]) {
  13645. defRest.push(item);
  13646. }
  13647. }
  13648. });
  13649. if (isFull) {
  13650. return fullRest;
  13651. }
  13652. return defRest;
  13653. }
  13654. return [];
  13655. },
  13656. handleCheckedCheckboxRow(rows, value, isForce) {
  13657. const $xeTable = this;
  13658. return handleCheckedCheckboxRow($xeTable, rows, value, isForce);
  13659. },
  13660. /**
  13661. * 用于多选行,设置行为选中状态,第二个参数为选中与否
  13662. * @param {Array/Row} rows 行数据
  13663. * @param {Boolean} value 是否选中
  13664. */
  13665. setCheckboxRow(rows, checked) {
  13666. const $xeTable = this;
  13667. if (rows && !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(rows)) {
  13668. rows = [rows];
  13669. }
  13670. return handleCheckedCheckboxRow($xeTable, rows, checked, true);
  13671. },
  13672. setCheckboxRowKey(keys, checked) {
  13673. const $xeTable = this;
  13674. const internalData = $xeTable;
  13675. const {
  13676. fullAllDataRowIdData
  13677. } = internalData;
  13678. if (keys && !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(keys)) {
  13679. keys = [keys];
  13680. }
  13681. const rows = [];
  13682. keys.forEach(rowid => {
  13683. const rowRest = fullAllDataRowIdData[rowid];
  13684. if (rowRest) {
  13685. rows.push(rowRest.row);
  13686. }
  13687. });
  13688. return handleCheckedCheckboxRow($xeTable, rows, checked, true);
  13689. },
  13690. isCheckedByCheckboxRow(row) {
  13691. const $xeTable = this;
  13692. const reactData = $xeTable;
  13693. const internalData = $xeTable;
  13694. const {
  13695. updateCheckboxFlag
  13696. } = reactData;
  13697. const {
  13698. selectCheckboxMaps
  13699. } = internalData;
  13700. const checkboxOpts = $xeTable.computeCheckboxOpts;
  13701. const {
  13702. checkField
  13703. } = checkboxOpts;
  13704. if (checkField) {
  13705. return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, checkField);
  13706. }
  13707. return !!updateCheckboxFlag && !!selectCheckboxMaps[getRowid($xeTable, row)];
  13708. },
  13709. isCheckedByCheckboxRowKey(rowid) {
  13710. const $xeTable = this;
  13711. const reactData = $xeTable;
  13712. const internalData = $xeTable;
  13713. const {
  13714. updateCheckboxFlag
  13715. } = reactData;
  13716. const {
  13717. fullAllDataRowIdData,
  13718. selectCheckboxMaps
  13719. } = internalData;
  13720. const checkboxOpts = $xeTable.computeCheckboxOpts;
  13721. const {
  13722. checkField
  13723. } = checkboxOpts;
  13724. if (checkField) {
  13725. const rowRest = fullAllDataRowIdData[rowid];
  13726. if (rowRest) {
  13727. return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(rowRest.row, checkField);
  13728. }
  13729. return false;
  13730. }
  13731. return !!updateCheckboxFlag && !!selectCheckboxMaps[rowid];
  13732. },
  13733. isIndeterminateByCheckboxRow(row) {
  13734. const $xeTable = this;
  13735. const internalData = $xeTable;
  13736. const {
  13737. treeIndeterminateRowMaps
  13738. } = internalData;
  13739. return !!treeIndeterminateRowMaps[getRowid($xeTable, row)] && !$xeTable.isCheckedByCheckboxRow(row);
  13740. },
  13741. isIndeterminateByCheckboxRowKey(rowid) {
  13742. const $xeTable = this;
  13743. const internalData = $xeTable;
  13744. const {
  13745. treeIndeterminateRowMaps
  13746. } = internalData;
  13747. return !!treeIndeterminateRowMaps[rowid] && !$xeTable.isCheckedByCheckboxRowKey(rowid);
  13748. },
  13749. /**
  13750. * 切换选中
  13751. * 多选,行选中事件
  13752. */
  13753. handleBatchSelectRows(rows, checked, isForce) {
  13754. const $xeTable = this;
  13755. const props = $xeTable;
  13756. const reactData = $xeTable;
  13757. const internalData = $xeTable;
  13758. const {
  13759. treeConfig
  13760. } = props;
  13761. const {
  13762. isRowGroupStatus
  13763. } = reactData;
  13764. const {
  13765. selectCheckboxMaps
  13766. } = internalData;
  13767. const aggregateOpts = $xeTable.computeAggregateOpts;
  13768. const treeOpts = $xeTable.computeTreeOpts;
  13769. const {
  13770. transform,
  13771. mapChildrenField
  13772. } = treeOpts;
  13773. const childrenField = treeOpts.children || treeOpts.childrenField;
  13774. const checkboxOpts = $xeTable.computeCheckboxOpts;
  13775. const {
  13776. checkField,
  13777. checkStrictly,
  13778. checkMethod
  13779. } = checkboxOpts;
  13780. const {
  13781. handleGetRowId
  13782. } = createHandleGetRowId($xeTable);
  13783. // indeterminateField 仅支持读取
  13784. const indeterminateField = checkboxOpts.indeterminateField || checkboxOpts.halfField;
  13785. if (checkField) {
  13786. // 树结构
  13787. if ((treeConfig || isRowGroupStatus) && !checkStrictly) {
  13788. // 更新子节点状态
  13789. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(rows, row => {
  13790. if (isForce || !checkMethod || checkMethod({
  13791. $table: $xeTable,
  13792. row
  13793. })) {
  13794. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(row, checkField, checked);
  13795. if (indeterminateField) {
  13796. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(row, indeterminateField, false);
  13797. }
  13798. handleCheckboxReserveRow($xeTable, row, checked);
  13799. }
  13800. }, {
  13801. children: transform ? mapChildrenField : childrenField
  13802. });
  13803. reactData.updateCheckboxFlag++;
  13804. return;
  13805. }
  13806. // 列表
  13807. rows.forEach(row => {
  13808. if (isForce || !checkMethod || checkMethod({
  13809. $table: $xeTable,
  13810. row
  13811. })) {
  13812. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(row, checkField, checked);
  13813. handleCheckboxReserveRow($xeTable, row, checked);
  13814. }
  13815. });
  13816. reactData.updateCheckboxFlag++;
  13817. return;
  13818. }
  13819. // 树结构
  13820. if (!checkStrictly) {
  13821. if (isRowGroupStatus) {
  13822. // 更新行分组节点状态
  13823. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(rows, row => {
  13824. const rowid = handleGetRowId(row);
  13825. if (isForce || !checkMethod || checkMethod({
  13826. $table: $xeTable,
  13827. row
  13828. })) {
  13829. if (checked) {
  13830. selectCheckboxMaps[rowid] = row;
  13831. } else {
  13832. if (selectCheckboxMaps[rowid]) {
  13833. delete selectCheckboxMaps[rowid];
  13834. }
  13835. }
  13836. handleCheckboxReserveRow($xeTable, row, checked);
  13837. }
  13838. }, {
  13839. children: aggregateOpts.mapChildrenField
  13840. });
  13841. reactData.updateCheckboxFlag++;
  13842. return;
  13843. } else if (treeConfig) {
  13844. // 更新子节点状态
  13845. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(rows, row => {
  13846. const rowid = handleGetRowId(row);
  13847. if (isForce || !checkMethod || checkMethod({
  13848. $table: $xeTable,
  13849. row
  13850. })) {
  13851. if (checked) {
  13852. selectCheckboxMaps[rowid] = row;
  13853. } else {
  13854. if (selectCheckboxMaps[rowid]) {
  13855. delete selectCheckboxMaps[rowid];
  13856. }
  13857. }
  13858. handleCheckboxReserveRow($xeTable, row, checked);
  13859. }
  13860. }, {
  13861. children: transform ? mapChildrenField : childrenField
  13862. });
  13863. reactData.updateCheckboxFlag++;
  13864. return;
  13865. }
  13866. }
  13867. // 列表
  13868. rows.forEach(row => {
  13869. const rowid = handleGetRowId(row);
  13870. if (isForce || !checkMethod || checkMethod({
  13871. $table: $xeTable,
  13872. row
  13873. })) {
  13874. if (checked) {
  13875. if (!selectCheckboxMaps[rowid]) {
  13876. selectCheckboxMaps[rowid] = row;
  13877. }
  13878. } else {
  13879. if (selectCheckboxMaps[rowid]) {
  13880. delete selectCheckboxMaps[rowid];
  13881. }
  13882. }
  13883. handleCheckboxReserveRow($xeTable, row, checked);
  13884. reactData.updateCheckboxFlag++;
  13885. }
  13886. });
  13887. },
  13888. /**
  13889. * 即将移除
  13890. * @deprecated
  13891. */
  13892. handleSelectRow({
  13893. row
  13894. }, checked, isForce) {
  13895. const $xeTable = this;
  13896. $xeTable.handleBatchSelectRows([row], checked, isForce);
  13897. },
  13898. handleToggleCheckRowEvent(evnt, params) {
  13899. const $xeTable = this;
  13900. const internalData = $xeTable;
  13901. const {
  13902. selectCheckboxMaps
  13903. } = internalData;
  13904. const checkboxOpts = $xeTable.computeCheckboxOpts;
  13905. const {
  13906. checkField,
  13907. trigger
  13908. } = checkboxOpts;
  13909. const {
  13910. row
  13911. } = params;
  13912. if (trigger === 'manual') {
  13913. return;
  13914. }
  13915. let checked = false;
  13916. if (checkField) {
  13917. checked = !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, checkField);
  13918. } else {
  13919. checked = !selectCheckboxMaps[getRowid($xeTable, row)];
  13920. }
  13921. if (evnt) {
  13922. $xeTable.triggerCheckRowEvent(evnt, params, checked);
  13923. } else {
  13924. $xeTable.handleBatchSelectRows([row], checked);
  13925. $xeTable.checkSelectionStatus();
  13926. }
  13927. },
  13928. triggerCheckRowEvent(evnt, params, checked) {
  13929. const $xeTable = this;
  13930. const props = $xeTable;
  13931. const reactData = $xeTable;
  13932. const internalData = $xeTable;
  13933. const {
  13934. treeConfig
  13935. } = props;
  13936. const {
  13937. row
  13938. } = params;
  13939. const {
  13940. isRowGroupStatus
  13941. } = reactData;
  13942. const {
  13943. afterFullData
  13944. } = internalData;
  13945. const checkboxOpts = $xeTable.computeCheckboxOpts;
  13946. const {
  13947. checkMethod,
  13948. trigger
  13949. } = checkboxOpts;
  13950. if (trigger === 'manual') {
  13951. return;
  13952. }
  13953. evnt.stopPropagation();
  13954. if (checkboxOpts.isShiftKey && evnt.shiftKey && !(treeConfig || isRowGroupStatus)) {
  13955. const checkboxRecords = $xeTable.getCheckboxRecords();
  13956. if (checkboxRecords.length) {
  13957. const firstRow = checkboxRecords[0];
  13958. const _rowIndex = $xeTable.getVTRowIndex(row);
  13959. const _firstRowIndex = $xeTable.getVTRowIndex(firstRow);
  13960. if (_rowIndex !== _firstRowIndex) {
  13961. $xeTable.setAllCheckboxRow(false);
  13962. const rangeRows = _rowIndex < _firstRowIndex ? afterFullData.slice(_rowIndex, _firstRowIndex + 1) : afterFullData.slice(_firstRowIndex, _rowIndex + 1);
  13963. $xeTable.$nextTick(() => {
  13964. handleCheckedCheckboxRow($xeTable, rangeRows, true, false);
  13965. });
  13966. $xeTable.dispatchEvent('checkbox-range-select', Object.assign({
  13967. rangeRecords: rangeRows
  13968. }, params), evnt);
  13969. return;
  13970. }
  13971. }
  13972. }
  13973. if (isRowGroupStatus || !checkMethod || checkMethod({
  13974. $table: $xeTable,
  13975. row
  13976. })) {
  13977. $xeTable.handleBatchSelectRows([row], checked);
  13978. $xeTable.checkSelectionStatus();
  13979. $xeTable.dispatchEvent('checkbox-change', Object.assign({
  13980. records: () => $xeTable.getCheckboxRecords(),
  13981. reserves: () => $xeTable.getCheckboxReserveRecords(),
  13982. indeterminates: () => $xeTable.getCheckboxIndeterminateRecords(),
  13983. checked
  13984. }, params), evnt);
  13985. }
  13986. },
  13987. /**
  13988. * 多选,切换某一行的选中状态
  13989. */
  13990. toggleCheckboxRow(row) {
  13991. const $xeTable = this;
  13992. const internalData = $xeTable;
  13993. const {
  13994. selectCheckboxMaps
  13995. } = internalData;
  13996. const checkboxOpts = $xeTable.computeCheckboxOpts;
  13997. const {
  13998. checkField
  13999. } = checkboxOpts;
  14000. const checked = checkField ? !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, checkField) : !selectCheckboxMaps[getRowid($xeTable, row)];
  14001. $xeTable.handleBatchSelectRows([row], checked, true);
  14002. $xeTable.checkSelectionStatus();
  14003. return $xeTable.$nextTick();
  14004. },
  14005. /**
  14006. * 用于多选行,设置所有行的选中状态
  14007. * @param {Boolean} value 是否选中
  14008. */
  14009. setAllCheckboxRow(value) {
  14010. const $xeTable = this;
  14011. return handleCheckedAllCheckboxRow($xeTable, value, true);
  14012. },
  14013. updateCheckboxStatus() {
  14014. const $xeTable = this;
  14015. const props = $xeTable;
  14016. const reactData = $xeTable;
  14017. const internalData = $xeTable;
  14018. const {
  14019. treeConfig
  14020. } = props;
  14021. const {
  14022. isRowGroupStatus
  14023. } = reactData;
  14024. const {
  14025. afterTreeFullData,
  14026. afterGroupFullData,
  14027. selectCheckboxMaps,
  14028. treeIndeterminateRowMaps
  14029. } = internalData;
  14030. const aggregateOpts = $xeTable.computeAggregateOpts;
  14031. const treeOpts = $xeTable.computeTreeOpts;
  14032. const childrenField = treeOpts.children || treeOpts.childrenField;
  14033. const checkboxOpts = $xeTable.computeCheckboxOpts;
  14034. const {
  14035. checkField,
  14036. indeterminateField,
  14037. checkStrictly,
  14038. checkMethod
  14039. } = checkboxOpts;
  14040. if (checkStrictly) {
  14041. return;
  14042. }
  14043. if (isRowGroupStatus || treeConfig) {
  14044. const {
  14045. handleGetRowId
  14046. } = createHandleGetRowId($xeTable);
  14047. const childRowMaps = {};
  14048. const childRowList = [];
  14049. if (isRowGroupStatus) {
  14050. // 行分组
  14051. const mapChildrenField = aggregateOpts.mapChildrenField;
  14052. if (mapChildrenField) {
  14053. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(afterGroupFullData, row => {
  14054. const rowid = handleGetRowId(row);
  14055. const childList = row[mapChildrenField];
  14056. if (childList && childList.length && !childRowMaps[rowid]) {
  14057. childRowMaps[rowid] = 1;
  14058. childRowList.unshift([row, rowid, childList]);
  14059. }
  14060. }, {
  14061. children: mapChildrenField
  14062. });
  14063. }
  14064. } else if (treeConfig) {
  14065. // 树结构
  14066. const {
  14067. transform,
  14068. mapChildrenField
  14069. } = treeOpts;
  14070. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(afterTreeFullData, row => {
  14071. const rowid = handleGetRowId(row);
  14072. const childList = row[transform ? mapChildrenField : childrenField];
  14073. if (childList && childList.length && !childRowMaps[rowid]) {
  14074. childRowMaps[rowid] = 1;
  14075. childRowList.unshift([row, rowid, childList]);
  14076. } else {
  14077. if (indeterminateField) {
  14078. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(row, indeterminateField, false);
  14079. }
  14080. }
  14081. }, {
  14082. children: transform ? mapChildrenField : childrenField
  14083. });
  14084. }
  14085. childRowList.forEach(vals => {
  14086. const row = vals[0];
  14087. const rowid = vals[1];
  14088. const childList = vals[2];
  14089. let sLen = 0; // 已选
  14090. let hLen = 0; // 半选
  14091. let vLen = 0; // 有效子行
  14092. const cLen = childList.length; // 子行
  14093. childList.forEach(checkMethod ? item => {
  14094. const childRowid = handleGetRowId(item);
  14095. const isSelect = checkField ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(item, checkField) : selectCheckboxMaps[childRowid];
  14096. if (checkMethod({
  14097. $table: $xeTable,
  14098. row: item
  14099. })) {
  14100. if (isSelect) {
  14101. sLen++;
  14102. } else if (treeIndeterminateRowMaps[childRowid]) {
  14103. hLen++;
  14104. }
  14105. vLen++;
  14106. } else {
  14107. if (isSelect) {
  14108. sLen++;
  14109. } else if (treeIndeterminateRowMaps[childRowid]) {
  14110. hLen++;
  14111. }
  14112. }
  14113. } : item => {
  14114. const childRowid = handleGetRowId(item);
  14115. const isSelect = checkField ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(item, checkField) : selectCheckboxMaps[childRowid];
  14116. if (isSelect) {
  14117. sLen++;
  14118. } else if (treeIndeterminateRowMaps[childRowid]) {
  14119. hLen++;
  14120. }
  14121. vLen++;
  14122. });
  14123. let isSelected = false;
  14124. if (cLen > 0) {
  14125. if (vLen > 0) {
  14126. isSelected = (sLen > 0 || hLen > 0) && sLen >= vLen;
  14127. } else {
  14128. // 如果存在子项禁用
  14129. if (sLen > 0 && sLen >= vLen) {
  14130. isSelected = true;
  14131. } else if (selectCheckboxMaps[rowid]) {
  14132. isSelected = true;
  14133. } else {
  14134. isSelected = false;
  14135. }
  14136. }
  14137. } else {
  14138. // 如果无子项
  14139. isSelected = selectCheckboxMaps[rowid];
  14140. }
  14141. const halfSelect = !isSelected && (sLen > 0 || hLen > 0);
  14142. if (checkField) {
  14143. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(row, checkField, isSelected);
  14144. }
  14145. if (indeterminateField) {
  14146. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(row, indeterminateField, halfSelect);
  14147. }
  14148. if (isSelected) {
  14149. if (!checkField) {
  14150. selectCheckboxMaps[rowid] = row;
  14151. }
  14152. if (treeIndeterminateRowMaps[rowid]) {
  14153. delete treeIndeterminateRowMaps[rowid];
  14154. }
  14155. } else {
  14156. if (!checkField) {
  14157. if (selectCheckboxMaps[rowid]) {
  14158. delete selectCheckboxMaps[rowid];
  14159. }
  14160. }
  14161. if (halfSelect) {
  14162. treeIndeterminateRowMaps[rowid] = row;
  14163. } else {
  14164. if (treeIndeterminateRowMaps[rowid]) {
  14165. delete treeIndeterminateRowMaps[rowid];
  14166. }
  14167. }
  14168. }
  14169. });
  14170. }
  14171. reactData.updateCheckboxFlag++;
  14172. },
  14173. updateAllCheckboxStatus() {
  14174. const $xeTable = this;
  14175. const props = $xeTable;
  14176. const reactData = $xeTable;
  14177. const internalData = $xeTable;
  14178. const {
  14179. treeConfig
  14180. } = props;
  14181. const {
  14182. isRowGroupStatus
  14183. } = reactData;
  14184. const {
  14185. afterFullData,
  14186. afterTreeFullData,
  14187. afterGroupFullData,
  14188. checkboxReserveRowMap,
  14189. selectCheckboxMaps,
  14190. treeIndeterminateRowMaps
  14191. } = internalData;
  14192. const aggregateOpts = $xeTable.computeAggregateOpts;
  14193. const {
  14194. mapChildrenField
  14195. } = aggregateOpts;
  14196. const checkboxOpts = $xeTable.computeCheckboxOpts;
  14197. const {
  14198. checkField,
  14199. checkMethod,
  14200. showReserveStatus
  14201. } = checkboxOpts;
  14202. const {
  14203. handleGetRowId
  14204. } = createHandleGetRowId($xeTable);
  14205. let sLen = 0; // 已选
  14206. let dsLen = 0; // 禁用的已选
  14207. let hLen = 0; // 半选
  14208. let dhLen = 0; // 禁用的半选
  14209. let vLen = 0; // 有效行
  14210. const rootList = treeConfig ? afterTreeFullData : isRowGroupStatus ? afterGroupFullData : afterFullData;
  14211. rootList.forEach(checkMethod ? row => {
  14212. const childRowid = handleGetRowId(row);
  14213. const selected = checkField ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, checkField) : selectCheckboxMaps[childRowid];
  14214. if (isRowGroupStatus && $xeTable.isAggregateRecord(row)) {
  14215. const childList = row[mapChildrenField || ''];
  14216. if (selected) {
  14217. vLen++;
  14218. sLen++;
  14219. } else if (treeIndeterminateRowMaps[childRowid]) {
  14220. vLen++;
  14221. hLen++;
  14222. } else if (childList && childList.length && childList.some(item => checkMethod({
  14223. $table: $xeTable,
  14224. row: item
  14225. }))) {
  14226. vLen++;
  14227. }
  14228. } else if (checkMethod({
  14229. $table: $xeTable,
  14230. row
  14231. })) {
  14232. if (selected) {
  14233. sLen++;
  14234. } else if (treeIndeterminateRowMaps[childRowid]) {
  14235. hLen++;
  14236. }
  14237. vLen++;
  14238. } else {
  14239. if (selected) {
  14240. dsLen++;
  14241. } else if (treeIndeterminateRowMaps[childRowid]) {
  14242. dhLen++;
  14243. }
  14244. }
  14245. } : row => {
  14246. const childRowid = handleGetRowId(row);
  14247. const selected = checkField ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, checkField) : selectCheckboxMaps[childRowid];
  14248. if (selected) {
  14249. sLen++;
  14250. } else if (treeIndeterminateRowMaps[childRowid]) {
  14251. hLen++;
  14252. }
  14253. vLen++;
  14254. });
  14255. const isSelected = rootList.length > 0 ? vLen > 0 ? sLen >= vLen : sLen >= rootList.length : false;
  14256. let halfSelect = !isSelected && (sLen > 0 || hLen > 0 || dsLen > 0 || dhLen > 0);
  14257. // 如果复选框启用保留记录,当保留数据存在时显示半选
  14258. if (!isSelected && !halfSelect && showReserveStatus) {
  14259. halfSelect = !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isEmpty(checkboxReserveRowMap);
  14260. }
  14261. reactData.isAllSelected = isSelected;
  14262. reactData.isIndeterminate = halfSelect;
  14263. },
  14264. checkSelectionStatus() {
  14265. const $xeTable = this;
  14266. $xeTable.updateCheckboxStatus();
  14267. $xeTable.updateAllCheckboxStatus();
  14268. },
  14269. /**
  14270. * 获取单选框保留选中的行
  14271. */
  14272. getRadioReserveRecord(isFull) {
  14273. const {
  14274. fullDataRowIdData,
  14275. radioReserveRow,
  14276. radioOpts,
  14277. afterFullData,
  14278. treeConfig,
  14279. treeOpts
  14280. } = this;
  14281. const childrenField = treeOpts.children || treeOpts.childrenField;
  14282. if (radioOpts.reserve && radioReserveRow) {
  14283. const rowid = getRowid(this, radioReserveRow);
  14284. if (isFull) {
  14285. if (!fullDataRowIdData[rowid]) {
  14286. return radioReserveRow;
  14287. }
  14288. } else {
  14289. const rowkey = getRowkey(this);
  14290. if (treeConfig) {
  14291. const matchObj = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findTree(afterFullData, row => rowid === external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, rowkey), {
  14292. children: childrenField
  14293. });
  14294. if (matchObj) {
  14295. return radioReserveRow;
  14296. }
  14297. } else {
  14298. if (!afterFullData.some(row => rowid === external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, rowkey))) {
  14299. return radioReserveRow;
  14300. }
  14301. }
  14302. }
  14303. }
  14304. return null;
  14305. },
  14306. clearRadioReserve() {
  14307. this.radioReserveRow = null;
  14308. return this.$nextTick();
  14309. },
  14310. /**
  14311. * 获取复选框保留选中的行
  14312. */
  14313. getCheckboxReserveRecords(isFull) {
  14314. const $xeTable = this;
  14315. const props = $xeTable;
  14316. const internalData = $xeTable;
  14317. const {
  14318. treeConfig
  14319. } = props;
  14320. const {
  14321. afterFullData,
  14322. fullDataRowIdData,
  14323. checkboxReserveRowMap
  14324. } = internalData;
  14325. const checkboxOpts = $xeTable.computeCheckboxOpts;
  14326. const treeOpts = $xeTable.computeTreeOpts;
  14327. const childrenField = treeOpts.children || treeOpts.childrenField;
  14328. const reserveSelection = [];
  14329. if (checkboxOpts.reserve) {
  14330. const {
  14331. handleGetRowId
  14332. } = createHandleGetRowId($xeTable);
  14333. const afterFullIdMaps = {};
  14334. if (treeConfig) {
  14335. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(afterFullData, row => {
  14336. afterFullIdMaps[handleGetRowId(row)] = 1;
  14337. }, {
  14338. children: childrenField
  14339. });
  14340. } else {
  14341. afterFullData.forEach(row => {
  14342. afterFullIdMaps[handleGetRowId(row)] = 1;
  14343. });
  14344. }
  14345. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(checkboxReserveRowMap, (oldRow, oldRowid) => {
  14346. if (oldRow) {
  14347. if (isFull) {
  14348. if (!fullDataRowIdData[oldRowid]) {
  14349. reserveSelection.push(oldRow);
  14350. }
  14351. } else {
  14352. if (!afterFullIdMaps[oldRowid]) {
  14353. reserveSelection.push(oldRow);
  14354. }
  14355. }
  14356. }
  14357. });
  14358. }
  14359. return reserveSelection;
  14360. },
  14361. clearCheckboxReserve() {
  14362. this.checkboxReserveRowMap = {};
  14363. return this.$nextTick();
  14364. },
  14365. handleCheckboxReserveRow(row, checked) {
  14366. const {
  14367. checkboxReserveRowMap,
  14368. checkboxOpts
  14369. } = this;
  14370. if (checkboxOpts.reserve) {
  14371. const rowid = getRowid(this, row);
  14372. if (checked) {
  14373. checkboxReserveRowMap[rowid] = row;
  14374. } else if (checkboxReserveRowMap[rowid]) {
  14375. delete checkboxReserveRowMap[rowid];
  14376. }
  14377. }
  14378. },
  14379. handleCheckAllEvent(evnt, value) {
  14380. const $xeTable = this;
  14381. handleCheckedAllCheckboxRow($xeTable, value);
  14382. if (evnt) {
  14383. $xeTable.dispatchEvent('checkbox-all', {
  14384. records: () => $xeTable.getCheckboxRecords(),
  14385. reserves: () => $xeTable.getCheckboxReserveRecords(),
  14386. indeterminates: () => $xeTable.getCheckboxIndeterminateRecords(),
  14387. checked: value
  14388. }, evnt);
  14389. }
  14390. },
  14391. /**
  14392. * 多选,选中所有事件
  14393. */
  14394. triggerCheckAllEvent(evnt, value) {
  14395. const $xeTable = this;
  14396. const {
  14397. checkboxOpts
  14398. } = this;
  14399. const {
  14400. trigger
  14401. } = checkboxOpts;
  14402. if (trigger === 'manual') {
  14403. return;
  14404. }
  14405. if (evnt) {
  14406. evnt.stopPropagation();
  14407. }
  14408. $xeTable.handleCheckAllEvent(evnt, value);
  14409. },
  14410. /**
  14411. * 多选,切换所有行的选中状态
  14412. */
  14413. toggleAllCheckboxRow() {
  14414. this.handleCheckAllEvent(null, !this.isAllSelected);
  14415. return this.$nextTick();
  14416. },
  14417. /**
  14418. * 用于多选行,手动清空用户的选择
  14419. * 清空行为不管是否被禁用还是保留记录,都将彻底清空选中状态
  14420. */
  14421. clearCheckboxRow() {
  14422. const $xeTable = this;
  14423. const props = $xeTable;
  14424. const reactData = $xeTable;
  14425. const internalData = $xeTable;
  14426. const {
  14427. treeConfig
  14428. } = props;
  14429. const {
  14430. tableFullData
  14431. } = internalData;
  14432. const treeOpts = $xeTable.computeTreeOpts;
  14433. const childrenField = treeOpts.children || treeOpts.childrenField;
  14434. const checkboxOpts = $xeTable.computeCheckboxOpts;
  14435. const {
  14436. checkField,
  14437. reserve
  14438. } = checkboxOpts;
  14439. // indeterminateField 仅支持读取
  14440. const indeterminateField = checkboxOpts.indeterminateField || checkboxOpts.halfField;
  14441. if (checkField) {
  14442. const handleClearChecked = item => {
  14443. if (treeConfig && indeterminateField) {
  14444. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(item, indeterminateField, false);
  14445. }
  14446. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(item, checkField, false);
  14447. };
  14448. if (treeConfig) {
  14449. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(tableFullData, handleClearChecked, {
  14450. children: childrenField
  14451. });
  14452. } else {
  14453. tableFullData.forEach(handleClearChecked);
  14454. }
  14455. }
  14456. if (reserve) {
  14457. tableFullData.forEach(row => this.handleCheckboxReserveRow(row, false));
  14458. }
  14459. reactData.isAllSelected = false;
  14460. reactData.isIndeterminate = false;
  14461. internalData.selectCheckboxMaps = {};
  14462. internalData.treeIndeterminateRowMaps = {};
  14463. reactData.updateCheckboxFlag++;
  14464. return this.$nextTick();
  14465. },
  14466. /**
  14467. * 单选,行选中事件
  14468. */
  14469. triggerRadioRowEvent(evnt, params) {
  14470. const $xeTable = this;
  14471. const reactData = $xeTable;
  14472. const {
  14473. selectRadioRow: oldValue
  14474. } = reactData;
  14475. const {
  14476. row
  14477. } = params;
  14478. const radioOpts = $xeTable.computeRadioOpts;
  14479. const {
  14480. trigger,
  14481. checkMethod
  14482. } = radioOpts;
  14483. if (trigger === 'manual') {
  14484. return;
  14485. }
  14486. evnt.stopPropagation();
  14487. if (!checkMethod || checkMethod({
  14488. $table: $xeTable,
  14489. row
  14490. })) {
  14491. let newValue = row;
  14492. let isChange = oldValue !== newValue;
  14493. if (isChange) {
  14494. handleCheckedRadioRow($xeTable, newValue);
  14495. } else if (!radioOpts.strict) {
  14496. isChange = oldValue === newValue;
  14497. if (isChange) {
  14498. newValue = null;
  14499. $xeTable.clearRadioRow();
  14500. }
  14501. }
  14502. if (isChange) {
  14503. $xeTable.dispatchEvent('radio-change', {
  14504. oldValue,
  14505. newValue,
  14506. ...params
  14507. }, evnt);
  14508. }
  14509. }
  14510. },
  14511. triggerCurrentColumnEvent(evnt, params) {
  14512. const $xeTable = this;
  14513. const reactData = $xeTable;
  14514. const {
  14515. currentColumn: oldValue
  14516. } = reactData;
  14517. const columnOpts = $xeTable.computeColumnOpts;
  14518. const currentColumnOpts = $xeTable.computeCurrentColumnOpts;
  14519. const beforeRowMethod = currentColumnOpts.beforeSelectMethod || columnOpts.currentMethod;
  14520. const {
  14521. column: newValue
  14522. } = params;
  14523. const {
  14524. trigger
  14525. } = currentColumnOpts;
  14526. if (trigger === 'manual') {
  14527. return;
  14528. }
  14529. const isChange = oldValue !== newValue;
  14530. if (!beforeRowMethod || beforeRowMethod({
  14531. column: newValue,
  14532. $table: $xeTable
  14533. })) {
  14534. $xeTable.setCurrentColumn(newValue);
  14535. if (isChange) {
  14536. $xeTable.dispatchEvent('current-column-change', {
  14537. oldValue,
  14538. newValue,
  14539. ...params
  14540. }, evnt);
  14541. }
  14542. } else {
  14543. $xeTable.dispatchEvent('current-column-disabled', params, evnt);
  14544. }
  14545. },
  14546. triggerCurrentRowEvent(evnt, params) {
  14547. const $xeTable = this;
  14548. const reactData = $xeTable;
  14549. const {
  14550. currentRow: oldValue
  14551. } = reactData;
  14552. const rowOpts = $xeTable.computeRowOpts;
  14553. const currentRowOpts = $xeTable.computeCurrentRowOpts;
  14554. const beforeRowMethod = currentRowOpts.beforeSelectMethod || rowOpts.currentMethod;
  14555. const {
  14556. row: newValue
  14557. } = params;
  14558. const {
  14559. trigger
  14560. } = currentRowOpts;
  14561. if (trigger === 'manual') {
  14562. return;
  14563. }
  14564. const isChange = oldValue !== newValue;
  14565. if (!beforeRowMethod || beforeRowMethod({
  14566. row: newValue,
  14567. $table: $xeTable
  14568. })) {
  14569. $xeTable.setCurrentRow(newValue);
  14570. if (isChange) {
  14571. $xeTable.dispatchEvent('current-row-change', {
  14572. oldValue,
  14573. newValue,
  14574. ...params
  14575. }, evnt);
  14576. // 已废弃
  14577. $xeTable.dispatchEvent('current-change', {
  14578. oldValue,
  14579. newValue,
  14580. ...params
  14581. }, evnt);
  14582. }
  14583. } else {
  14584. $xeTable.dispatchEvent('current-row-disabled', params, evnt);
  14585. }
  14586. },
  14587. /**
  14588. * 用于当前行,设置某一行为高亮状态
  14589. * @param {Row} row 行对象
  14590. */
  14591. setCurrentRow(row) {
  14592. const $xeTable = this;
  14593. const internalData = $xeTable;
  14594. const $xeGanttView = internalData.xeGanttView;
  14595. const el = $xeTable.$refs.refElem;
  14596. const rowOpts = $xeTable.computeRowOpts;
  14597. this.clearCurrentRow();
  14598. // this.clearCurrentColumn()
  14599. this.currentRow = row;
  14600. if (rowOpts.isCurrent || this.highlightCurrentRow) {
  14601. if (el) {
  14602. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayEach(el.querySelectorAll(`[rowid="${getRowid($xeTable, row)}"]`), elem => addClass(elem, 'row--current'));
  14603. }
  14604. }
  14605. if ($xeGanttView && $xeGanttView.handleUpdateCurrentRow) {
  14606. $xeGanttView.handleUpdateCurrentRow(row);
  14607. }
  14608. return this.$nextTick();
  14609. },
  14610. isCheckedByRadioRow(row) {
  14611. const $xeTable = this;
  14612. const reactData = $xeTable;
  14613. const {
  14614. selectRadioRow
  14615. } = reactData;
  14616. if (row && selectRadioRow) {
  14617. return $xeTable.eqRow(selectRadioRow, row);
  14618. }
  14619. return false;
  14620. },
  14621. isCheckedByRadioRowKey(key) {
  14622. const $xeTable = this;
  14623. const reactData = $xeTable;
  14624. const {
  14625. selectRadioRow
  14626. } = reactData;
  14627. if (selectRadioRow) {
  14628. return key === getRowid($xeTable, selectRadioRow);
  14629. }
  14630. return false;
  14631. },
  14632. /**
  14633. * 用于单选行,设置某一行为选中状态
  14634. * @param {Row} row 行对象
  14635. */
  14636. setRadioRow(row) {
  14637. const $xeTable = this;
  14638. return handleCheckedRadioRow($xeTable, row, true);
  14639. },
  14640. /**
  14641. * 用于单选行,设置某一行为选中状态
  14642. * @param key 行主键
  14643. */
  14644. setRadioRowKey(rowid) {
  14645. const $xeTable = this;
  14646. const internalData = $xeTable;
  14647. const {
  14648. fullAllDataRowIdData
  14649. } = internalData;
  14650. const rowRest = fullAllDataRowIdData[rowid];
  14651. if (rowRest) {
  14652. return handleCheckedRadioRow($xeTable, rowRest.row, true);
  14653. }
  14654. return $xeTable.$nextTick();
  14655. },
  14656. /**
  14657. * 用于当前行,手动清空当前高亮的状态
  14658. */
  14659. clearCurrentRow() {
  14660. const $xeTable = this;
  14661. const reactData = $xeTable;
  14662. const internalData = $xeTable;
  14663. const $xeGanttView = internalData.xeGanttView;
  14664. const el = $xeTable.$refs.refElem;
  14665. reactData.currentRow = null;
  14666. internalData.hoverRow = null;
  14667. if (el) {
  14668. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayEach(el.querySelectorAll('.row--current'), elem => removeClass(elem, 'row--current'));
  14669. }
  14670. if ($xeGanttView && $xeGanttView.handleUpdateCurrentRow) {
  14671. $xeGanttView.handleUpdateCurrentRow();
  14672. }
  14673. return $xeTable.$nextTick();
  14674. },
  14675. /**
  14676. * 用于单选行,手动清空用户的选择
  14677. */
  14678. clearRadioRow() {
  14679. this.selectRadioRow = null;
  14680. return this.$nextTick();
  14681. },
  14682. /**
  14683. * 用于当前行,获取当前行的数据
  14684. */
  14685. getCurrentRecord(isFull) {
  14686. const $xeTable = this;
  14687. const props = $xeTable;
  14688. const reactData = $xeTable;
  14689. const internalData = $xeTable;
  14690. const {
  14691. currentRow
  14692. } = reactData;
  14693. const {
  14694. fullDataRowIdData,
  14695. afterFullRowMaps
  14696. } = internalData;
  14697. const rowOpts = $xeTable.computeRowOpts;
  14698. if (rowOpts.isCurrent || props.highlightCurrentRow) {
  14699. const rowid = getRowid($xeTable, currentRow);
  14700. if (isFull) {
  14701. if (fullDataRowIdData[rowid]) {
  14702. return currentRow;
  14703. }
  14704. } else {
  14705. if (afterFullRowMaps[rowid]) {
  14706. return currentRow;
  14707. }
  14708. }
  14709. }
  14710. return null;
  14711. },
  14712. /**
  14713. * 用于单选行,获取当已选中的数据
  14714. */
  14715. getRadioRecord(isFull) {
  14716. const {
  14717. selectRadioRow,
  14718. fullDataRowIdData,
  14719. afterFullRowMaps
  14720. } = this;
  14721. if (selectRadioRow) {
  14722. const rowid = getRowid(this, selectRadioRow);
  14723. if (isFull) {
  14724. if (fullDataRowIdData[rowid]) {
  14725. return selectRadioRow;
  14726. }
  14727. } else {
  14728. if (afterFullRowMaps[rowid]) {
  14729. return selectRadioRow;
  14730. }
  14731. }
  14732. }
  14733. return null;
  14734. },
  14735. /**
  14736. * 行 hover 事件
  14737. */
  14738. triggerHoverEvent(evnt, {
  14739. row
  14740. }) {
  14741. this.setHoverRow(row);
  14742. },
  14743. setHoverRow(row) {
  14744. const $xeTable = this;
  14745. const internalData = $xeTable;
  14746. const $xeGanttView = internalData.xeGanttView;
  14747. const el = $xeTable.$refs.refElem;
  14748. $xeTable.clearHoverRow();
  14749. if (el) {
  14750. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayEach(el.querySelectorAll(`.vxe-body--row[rowid="${getRowid($xeTable, row)}"]`), elem => addClass(elem, 'row--hover'));
  14751. }
  14752. internalData.hoverRow = row;
  14753. if ($xeGanttView && $xeGanttView.handleUpdateHoverRow) {
  14754. $xeGanttView.handleUpdateHoverRow(row);
  14755. }
  14756. },
  14757. clearHoverRow() {
  14758. const $xeTable = this;
  14759. const internalData = $xeTable;
  14760. const $xeGanttView = internalData.xeGanttView;
  14761. const el = $xeTable.$refs.refElem;
  14762. if (el) {
  14763. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayEach(el.querySelectorAll('.vxe-body--row.row--hover'), elem => removeClass(elem, 'row--hover'));
  14764. }
  14765. internalData.hoverRow = null;
  14766. if ($xeGanttView && $xeGanttView.handleUpdateHoverRow) {
  14767. $xeGanttView.handleUpdateHoverRow();
  14768. }
  14769. },
  14770. triggerHeaderCellClickEvent(evnt, params) {
  14771. const $xeTable = this;
  14772. const props = $xeTable;
  14773. const internalData = $xeTable;
  14774. const {
  14775. _lastResizeTime
  14776. } = internalData;
  14777. const sortOpts = $xeTable.computeSortOpts;
  14778. const columnOpts = $xeTable.computeColumnOpts;
  14779. const currentColumnOpts = $xeTable.computeCurrentColumnOpts;
  14780. const {
  14781. column
  14782. } = params;
  14783. const cell = evnt.currentTarget;
  14784. const triggerResizable = _lastResizeTime && _lastResizeTime > Date.now() - 300;
  14785. const triggerSort = getEventTargetNode(evnt, cell, 'vxe-cell--sort').flag;
  14786. const triggerFilter = getEventTargetNode(evnt, cell, 'vxe-cell--filter').flag;
  14787. if (sortOpts.trigger === 'cell' && !(triggerResizable || triggerSort || triggerFilter)) {
  14788. $xeTable.triggerSortEvent(evnt, column, getNextSortOrder($xeTable, column));
  14789. }
  14790. $xeTable.dispatchEvent('header-cell-click', Object.assign({
  14791. triggerResizable,
  14792. triggerSort,
  14793. triggerFilter,
  14794. cell
  14795. }, params), evnt);
  14796. if ((columnOpts.isCurrent || props.highlightCurrentColumn) && (!currentColumnOpts.trigger || ['header', 'default'].includes(currentColumnOpts.trigger))) {
  14797. $xeTable.triggerCurrentColumnEvent(evnt, params);
  14798. }
  14799. return $xeTable.$nextTick();
  14800. },
  14801. triggerHeaderCellDblclickEvent(evnt, params) {
  14802. const $xeTable = this;
  14803. $xeTable.dispatchEvent('header-cell-dblclick', Object.assign({
  14804. cell: evnt.currentTarget
  14805. }, params), evnt);
  14806. },
  14807. getCurrentColumn() {
  14808. return this.columnOpts.isCurrent || this.highlightCurrentColumn ? this.currentColumn : null;
  14809. },
  14810. /**
  14811. * 用于当前列,设置某列行为高亮状态
  14812. * @param {ColumnInfo} fieldOrColumn 列配置
  14813. */
  14814. setCurrentColumn(fieldOrColumn) {
  14815. const $xeTable = this;
  14816. const props = $xeTable;
  14817. const reactData = $xeTable;
  14818. const {
  14819. mouseConfig
  14820. } = props;
  14821. const mouseOpts = $xeTable.computeMouseOpts;
  14822. const isMouseSelected = mouseConfig && mouseOpts.selected;
  14823. const column = handleFieldOrColumn($xeTable, fieldOrColumn);
  14824. if (column) {
  14825. $xeTable.clearCurrentColumn();
  14826. reactData.currentColumn = column;
  14827. }
  14828. return $xeTable.$nextTick().then(() => {
  14829. // 更新状选中态
  14830. if (isMouseSelected) {
  14831. $xeTable.addCellSelectedClass();
  14832. }
  14833. });
  14834. },
  14835. /**
  14836. * 用于当前列,手动清空当前高亮的状态
  14837. */
  14838. clearCurrentColumn() {
  14839. this.currentColumn = null;
  14840. return this.$nextTick();
  14841. },
  14842. /**
  14843. * 列点击事件
  14844. * 如果是单击模式,则激活为编辑状态
  14845. * 如果是双击模式,则单击后选中状态
  14846. */
  14847. triggerCellClickEvent(evnt, params) {
  14848. const $xeTable = this;
  14849. const props = $xeTable;
  14850. const reactData = $xeTable;
  14851. const {
  14852. treeConfig,
  14853. highlightCurrentRow,
  14854. highlightCurrentColumn,
  14855. editConfig,
  14856. aggregateConfig,
  14857. rowGroupConfig
  14858. } = props;
  14859. const {
  14860. editStore,
  14861. isDragResize,
  14862. expandColumn,
  14863. checkboxColumn,
  14864. radioColumn
  14865. } = reactData;
  14866. if (isDragResize) {
  14867. return;
  14868. }
  14869. const expandOpts = $xeTable.computeExpandOpts;
  14870. const editOpts = $xeTable.computeEditOpts;
  14871. const treeOpts = $xeTable.computeTreeOpts;
  14872. const radioOpts = $xeTable.computeRadioOpts;
  14873. const checkboxOpts = $xeTable.computeCheckboxOpts;
  14874. const keyboardOpts = $xeTable.computeKeyboardOpts;
  14875. const aggregateOpts = $xeTable.computeAggregateOpts;
  14876. const rowOpts = $xeTable.computeRowOpts;
  14877. const columnOpts = $xeTable.computeColumnOpts;
  14878. const currentColumnOpts = $xeTable.computeCurrentColumnOpts;
  14879. const {
  14880. actived,
  14881. focused
  14882. } = editStore;
  14883. const {
  14884. row,
  14885. column
  14886. } = params;
  14887. const {
  14888. type,
  14889. treeNode,
  14890. rowGroupNode
  14891. } = column;
  14892. const isRadioType = type === 'radio';
  14893. const isCheckboxType = type === 'checkbox';
  14894. const isExpandType = type === 'expand';
  14895. const cell = evnt.currentTarget;
  14896. const triggerRadio = isRadioType && getEventTargetNode(evnt, cell, 'vxe-cell--radio').flag;
  14897. const triggerCheckbox = isCheckboxType && getEventTargetNode(evnt, cell, 'vxe-cell--checkbox').flag;
  14898. const triggerTreeNode = treeNode && getEventTargetNode(evnt, cell, 'vxe-cell--tree-btn').flag;
  14899. const triggerExpandNode = isExpandType && getEventTargetNode(evnt, cell, 'vxe-table--expanded').flag;
  14900. const triggerRowGroupNode = isExpandType && getEventTargetNode(evnt, cell, 'vxe-row-group--node-btn').flag;
  14901. params = Object.assign({
  14902. cell,
  14903. triggerRadio,
  14904. triggerCheckbox,
  14905. triggerTreeNode,
  14906. triggerExpandNode
  14907. }, params);
  14908. if (!triggerCheckbox && !triggerRadio) {
  14909. // 如果是展开行
  14910. if (!triggerExpandNode && (expandColumn && expandOpts.trigger === 'row' || isExpandType && expandOpts.trigger === 'cell')) {
  14911. $xeTable.triggerRowExpandEvent(evnt, params);
  14912. }
  14913. // 如果是树形表格
  14914. if (treeConfig && (treeOpts.trigger === 'row' || treeNode && treeOpts.trigger === 'cell')) {
  14915. $xeTable.triggerTreeExpandEvent(evnt, params);
  14916. }
  14917. // 如果是行分组
  14918. if ((aggregateConfig || rowGroupConfig) && (aggregateOpts.trigger === 'row' || rowGroupNode && aggregateOpts.trigger === 'cell')) {
  14919. $xeTable.triggerRowGroupExpandEvent(evnt, params);
  14920. }
  14921. }
  14922. // 如果点击了树节点
  14923. if (!triggerTreeNode) {
  14924. if (!triggerExpandNode && !triggerRowGroupNode) {
  14925. // 如果是当前行
  14926. if (rowOpts.isCurrent || highlightCurrentRow) {
  14927. if (!triggerCheckbox && !triggerRadio) {
  14928. $xeTable.triggerCurrentRowEvent(evnt, params);
  14929. }
  14930. }
  14931. // 如果是当前列
  14932. if ((columnOpts.isCurrent || highlightCurrentColumn) && (!currentColumnOpts.trigger || ['cell', 'default'].includes(currentColumnOpts.trigger))) {
  14933. if (!triggerCheckbox && !triggerRadio) {
  14934. $xeTable.triggerCurrentColumnEvent(evnt, params);
  14935. }
  14936. }
  14937. // 如果是单选框
  14938. if (!triggerRadio && (radioColumn && radioOpts.trigger === 'row' || isRadioType && radioOpts.trigger === 'cell')) {
  14939. $xeTable.triggerRadioRowEvent(evnt, params);
  14940. }
  14941. // 如果是复选框
  14942. if (!triggerCheckbox && (checkboxColumn && checkboxOpts.trigger === 'row' || isCheckboxType && checkboxOpts.trigger === 'cell')) {
  14943. $xeTable.handleToggleCheckRowEvent(evnt, params);
  14944. }
  14945. }
  14946. // 如果设置了单元格选中功能,则不会使用点击事件去处理(只能支持双击模式)
  14947. if (isEnableConf(editConfig)) {
  14948. // 记录点击输入框聚焦状态
  14949. if (keyboardOpts.arrowCursorLock && evnt && editOpts.mode === 'cell' && evnt.target && /^input|textarea$/i.test(evnt.target.tagName)) {
  14950. focused.column = column;
  14951. focused.row = row;
  14952. }
  14953. if (editOpts.trigger === 'manual') {
  14954. if (actived.args && actived.row === row && column !== actived.column) {
  14955. handleChangeCell($xeTable, evnt, params);
  14956. }
  14957. } else if (!actived.args || row !== actived.row || column !== actived.column) {
  14958. if (editOpts.trigger === 'click') {
  14959. handleChangeCell($xeTable, evnt, params);
  14960. } else if (editOpts.trigger === 'dblclick') {
  14961. if (editOpts.mode === 'row' && actived.row === row) {
  14962. handleChangeCell($xeTable, evnt, params);
  14963. }
  14964. }
  14965. }
  14966. }
  14967. }
  14968. // 如果是双击编辑模式
  14969. if (isEnableConf(editConfig) && editOpts.trigger === 'dblclick') {
  14970. if (actived.row && actived.column) {
  14971. if (editOpts.mode === 'row') {
  14972. if (!$xeTable.eqRow(actived.row, row)) {
  14973. $xeTable.handleClearEdit(evnt);
  14974. }
  14975. } else if (editOpts.mode === 'cell') {
  14976. if (!$xeTable.eqRow(actived.row, row) || actived.column.id !== column.id) {
  14977. $xeTable.handleClearEdit(evnt);
  14978. }
  14979. }
  14980. }
  14981. }
  14982. $xeTable.dispatchEvent('cell-click', params, evnt);
  14983. },
  14984. /**
  14985. * 列双击点击事件
  14986. * 如果是双击模式,则激活为编辑状态
  14987. */
  14988. triggerCellDblclickEvent(evnt, params) {
  14989. const $xeTable = this;
  14990. const props = $xeTable;
  14991. const reactData = $xeTable;
  14992. const {
  14993. editConfig
  14994. } = props;
  14995. const {
  14996. editStore,
  14997. isDragResize
  14998. } = reactData;
  14999. if (isDragResize) {
  15000. return;
  15001. }
  15002. const editOpts = $xeTable.computeEditOpts;
  15003. const {
  15004. actived
  15005. } = editStore;
  15006. const cell = evnt.currentTarget;
  15007. params = Object.assign({
  15008. cell
  15009. }, params);
  15010. if (isEnableConf(editConfig) && editOpts.trigger === 'dblclick') {
  15011. if (!actived.args || evnt.currentTarget !== actived.args.cell) {
  15012. if (editOpts.mode === 'row') {
  15013. checkValidate($xeTable, 'blur').catch(e => e).then(() => {
  15014. $xeTable.handleEdit(params, evnt).then(() => checkValidate($xeTable, 'change')).catch(e => e);
  15015. });
  15016. } else if (editOpts.mode === 'cell') {
  15017. $xeTable.handleEdit(params, evnt).then(() => checkValidate($xeTable, 'change')).catch(e => e);
  15018. }
  15019. }
  15020. }
  15021. $xeTable.dispatchEvent('cell-dblclick', params, evnt);
  15022. },
  15023. handleColumnSortEvent(evnt, column) {
  15024. const $xeTable = this;
  15025. const props = $xeTable;
  15026. const {
  15027. mouseConfig
  15028. } = props;
  15029. const mouseOpts = $xeTable.computeMouseOpts;
  15030. const {
  15031. field,
  15032. sortable,
  15033. order
  15034. } = column;
  15035. if (sortable) {
  15036. const params = {
  15037. $table: $xeTable,
  15038. $event: evnt,
  15039. column,
  15040. field,
  15041. property: field,
  15042. order,
  15043. sortList: $xeTable.getSortColumns(),
  15044. sortTime: column.sortTime
  15045. };
  15046. if (mouseConfig && mouseOpts.area && $xeTable.handleSortEvent) {
  15047. $xeTable.handleSortEvent(evnt, params);
  15048. }
  15049. if (!order) {
  15050. $xeTable.dispatchEvent('clear-sort', params, evnt);
  15051. }
  15052. $xeTable.dispatchEvent('sort-change', params, evnt);
  15053. }
  15054. },
  15055. /**
  15056. * 点击排序事件
  15057. */
  15058. triggerSortEvent(evnt, column, order) {
  15059. const $xeTable = this;
  15060. const sortOpts = $xeTable.computeSortOpts;
  15061. const {
  15062. multiple,
  15063. allowClear
  15064. } = sortOpts;
  15065. const {
  15066. field,
  15067. sortable
  15068. } = column;
  15069. if (sortable || column.remoteSort) {
  15070. if (!order || column.order === order) {
  15071. if (allowClear) {
  15072. $xeTable.clearSort(multiple ? column : null);
  15073. }
  15074. } else {
  15075. $xeTable.sort({
  15076. field,
  15077. order
  15078. });
  15079. }
  15080. $xeTable.handleColumnSortEvent(evnt, column);
  15081. }
  15082. },
  15083. handleCellRuleUpdateStatus(type, cellParams, cellValue) {
  15084. const $xeTable = this;
  15085. const reactData = $xeTable;
  15086. const {
  15087. validStore
  15088. } = reactData;
  15089. const {
  15090. row,
  15091. column
  15092. } = cellParams;
  15093. if ($xeTable.hasCellRules) {
  15094. if ($xeTable.hasCellRules(type, row, column)) {
  15095. const cell = $xeTable.getCellElement(row, column);
  15096. if (cell) {
  15097. const customVal = !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isUndefined(cellValue);
  15098. return $xeTable.validCellRules(type, row, column, cellValue).then(() => {
  15099. if (customVal && validStore.visible) {
  15100. setCellValue(row, column, cellValue);
  15101. }
  15102. $xeTable.clearValidate(row, column);
  15103. }).catch(({
  15104. rule
  15105. }) => {
  15106. if (customVal) {
  15107. setCellValue(row, column, cellValue);
  15108. }
  15109. $xeTable.showValidTooltip({
  15110. rule,
  15111. row,
  15112. column,
  15113. cell
  15114. });
  15115. });
  15116. }
  15117. }
  15118. }
  15119. return $xeTable.$nextTick();
  15120. },
  15121. /**
  15122. * 表头单元格按下事件
  15123. */
  15124. triggerHeaderCellMousedownEvent(evnt, params) {
  15125. const $xeTable = this;
  15126. const props = $xeTable;
  15127. const {
  15128. mouseConfig
  15129. } = props;
  15130. const mouseOpts = $xeTable.computeMouseOpts;
  15131. const columnOpts = $xeTable.computeColumnOpts;
  15132. const columnDragOpts = $xeTable.computeColumnDragOpts;
  15133. const {
  15134. trigger,
  15135. isCrossDrag,
  15136. isPeerDrag,
  15137. disabledMethod
  15138. } = columnDragOpts;
  15139. const cell = evnt.currentTarget;
  15140. const triggerInput = cell && cell.tagName && cell.tagName.toLowerCase() === 'input';
  15141. const triggerCheckbox = getEventTargetNode(evnt, cell, 'vxe-cell--checkbox').flag;
  15142. const triggerSort = getEventTargetNode(evnt, cell, 'vxe-cell--sort').flag;
  15143. const triggerFilter = getEventTargetNode(evnt, cell, 'vxe-cell--filter').flag;
  15144. let triggerDrag = false;
  15145. const isColDragCell = columnOpts.drag && trigger === 'cell';
  15146. if (!(triggerInput || triggerCheckbox || triggerSort || triggerFilter)) {
  15147. const {
  15148. column
  15149. } = params;
  15150. if (isColDragCell && !column.fixed && (isCrossDrag || isPeerDrag || !column.parentId) && !(disabledMethod && disabledMethod(params))) {
  15151. triggerDrag = true;
  15152. $xeTable.handleHeaderCellDragMousedownEvent(evnt, params);
  15153. }
  15154. }
  15155. if (!triggerDrag && mouseConfig && mouseOpts.area && $xeTable.handleHeaderCellAreaMouseDnEvent) {
  15156. $xeTable.handleHeaderCellAreaMouseDnEvent(evnt, Object.assign({
  15157. cell,
  15158. triggerSort,
  15159. triggerFilter
  15160. }, params));
  15161. }
  15162. $xeTable.focus();
  15163. if ($xeTable.closeMenu) {
  15164. $xeTable.closeMenu();
  15165. }
  15166. },
  15167. /**
  15168. * 单元格按下事件
  15169. */
  15170. triggerCellMousedownEvent(evnt, params) {
  15171. const $xeTable = this;
  15172. const {
  15173. column
  15174. } = params;
  15175. const {
  15176. type,
  15177. treeNode
  15178. } = column;
  15179. const isRadioType = type === 'radio';
  15180. const isCheckboxType = type === 'checkbox';
  15181. const isExpandType = type === 'expand';
  15182. const rowOpts = $xeTable.computeRowOpts;
  15183. const rowDragOpts = $xeTable.computeRowDragOpts;
  15184. const {
  15185. trigger,
  15186. isCrossDrag,
  15187. isPeerDrag,
  15188. disabledMethod
  15189. } = rowDragOpts;
  15190. const cell = evnt.currentTarget;
  15191. params.cell = cell;
  15192. const triggerInput = cell && cell.tagName && cell.tagName.toLowerCase() === 'input';
  15193. const triggerRadio = isRadioType && getEventTargetNode(evnt, cell, 'vxe-cell--radio').flag;
  15194. const triggerCheckbox = isCheckboxType && getEventTargetNode(evnt, cell, 'vxe-cell--checkbox').flag;
  15195. const triggerTreeNode = treeNode && getEventTargetNode(evnt, cell, 'vxe-cell--tree-btn').flag;
  15196. const triggerExpandNode = isExpandType && getEventTargetNode(evnt, cell, 'vxe-table--expanded').flag;
  15197. let isColDragCell = false;
  15198. if (rowOpts.drag) {
  15199. isColDragCell = trigger === 'row' || column.dragSort && trigger === 'cell';
  15200. }
  15201. let triggerDrag = false;
  15202. if (!(triggerInput || triggerRadio || triggerCheckbox || triggerTreeNode || triggerExpandNode)) {
  15203. if (isColDragCell && (isCrossDrag || isPeerDrag || !params.level) && !(disabledMethod && disabledMethod(params))) {
  15204. triggerDrag = true;
  15205. $xeTable.handleCellDragMousedownEvent(evnt, params);
  15206. }
  15207. }
  15208. if (!triggerDrag && $xeTable.handleCellMousedownEvent) {
  15209. $xeTable.handleCellMousedownEvent(evnt, params);
  15210. }
  15211. $xeTable.focus();
  15212. $xeTable.closeFilter();
  15213. if ($xeTable.closeMenu) {
  15214. $xeTable.closeMenu();
  15215. }
  15216. },
  15217. triggerCellMouseupEvent() {
  15218. const $xeTable = this;
  15219. clearDragStatus($xeTable);
  15220. },
  15221. /**
  15222. * 行拖拽
  15223. */
  15224. handleRowDragDragstartEvent(evnt) {
  15225. if (evnt.dataTransfer) {
  15226. evnt.dataTransfer.setDragImage(getTpImg(), 0, 0);
  15227. }
  15228. },
  15229. handleRowDragSwapEvent(evnt, isSyncRow, dragRow, prevDragRow, prevDragPos, prevDragToChild) {
  15230. const $xeTable = this;
  15231. const $xeGantt = $xeTable.$xeGantt;
  15232. const props = $xeTable;
  15233. const reactData = $xeTable;
  15234. const internalData = $xeTable;
  15235. const {
  15236. treeConfig,
  15237. dragConfig
  15238. } = props;
  15239. const rowDragOpts = $xeTable.computeRowDragOpts;
  15240. const {
  15241. afterFullData,
  15242. tableFullData,
  15243. fullAllDataRowIdData
  15244. } = internalData;
  15245. const {
  15246. animation,
  15247. isPeerDrag,
  15248. isCrossDrag,
  15249. isSelfToChildDrag,
  15250. dragEndMethod,
  15251. dragToChildMethod
  15252. } = rowDragOpts;
  15253. const treeOpts = $xeTable.computeTreeOpts;
  15254. const cellOpts = $xeTable.computeCellOpts;
  15255. const rowOpts = $xeTable.computeRowOpts;
  15256. const defaultRowHeight = $xeTable.computeDefaultRowHeight;
  15257. const {
  15258. transform,
  15259. rowField,
  15260. mapChildrenField,
  15261. parentField
  15262. } = treeOpts;
  15263. const childrenField = treeOpts.children || treeOpts.childrenField;
  15264. const dEndMethod = dragEndMethod || (dragConfig ? dragConfig.dragEndMethod : null);
  15265. const dragOffsetIndex = prevDragPos === 'bottom' ? 1 : 0;
  15266. const el = $xeTable.$refs.refElem;
  15267. const errRest = {
  15268. status: false
  15269. };
  15270. if (!(el && prevDragRow && dragRow)) {
  15271. return Promise.resolve(errRest);
  15272. }
  15273. // 判断是否有拖动
  15274. if (prevDragRow !== dragRow) {
  15275. const dragParams = {
  15276. oldRow: dragRow,
  15277. newRow: prevDragRow,
  15278. dragRow,
  15279. dragPos: prevDragPos,
  15280. dragToChild: !!prevDragToChild,
  15281. offsetIndex: dragOffsetIndex
  15282. };
  15283. const isDragToChildFlag = isSelfToChildDrag && dragToChildMethod ? dragToChildMethod(dragParams) : prevDragToChild;
  15284. return Promise.resolve(dEndMethod ? dEndMethod(dragParams) : true).then(status => {
  15285. if (!status) {
  15286. return errRest;
  15287. }
  15288. const dragRowid = getRowid($xeTable, dragRow);
  15289. const dragRowRest = fullAllDataRowIdData[dragRowid] || {};
  15290. const _dragRowIndex = dragRowRest._index;
  15291. let dragRowHeight = 0;
  15292. let dragOffsetTop = -1;
  15293. if (animation) {
  15294. dragRowHeight = getCellRestHeight(dragRowRest, cellOpts, rowOpts, defaultRowHeight);
  15295. const oldTrEl = el.querySelector(`.vxe-body--row[rowid="${dragRowid}"]`);
  15296. if (oldTrEl) {
  15297. dragOffsetTop = oldTrEl.offsetTop;
  15298. }
  15299. }
  15300. let oafIndex = -1;
  15301. let nafIndex = -1;
  15302. // 如果为树结构
  15303. if (treeConfig) {
  15304. if (transform) {
  15305. // 移出源位置
  15306. const oldRest = dragRowRest;
  15307. const newRowid = getRowid($xeTable, prevDragRow);
  15308. const newRest = fullAllDataRowIdData[newRowid];
  15309. if (oldRest && newRest) {
  15310. const {
  15311. level: oldLevel
  15312. } = oldRest;
  15313. const {
  15314. level: newLevel
  15315. } = newRest;
  15316. const oldAllMaps = {};
  15317. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree([dragRow], item => {
  15318. oldAllMaps[getRowid($xeTable, item)] = item;
  15319. }, {
  15320. children: mapChildrenField
  15321. });
  15322. let isSelfToChildStatus = false;
  15323. if (oldLevel && newLevel) {
  15324. // 子到子
  15325. if (isPeerDrag && !isCrossDrag) {
  15326. if (oldRest.row[parentField] !== newRest.row[parentField]) {
  15327. // 非同级
  15328. return errRest;
  15329. }
  15330. } else {
  15331. if (!isCrossDrag) {
  15332. return errRest;
  15333. }
  15334. if (oldAllMaps[newRowid]) {
  15335. isSelfToChildStatus = true;
  15336. if (!(isCrossDrag && isSelfToChildDrag)) {
  15337. if (core_.VxeUI.modal) {
  15338. core_.VxeUI.modal.message({
  15339. status: 'error',
  15340. content: methods_getI18n('vxe.error.treeDragChild')
  15341. });
  15342. }
  15343. return errRest;
  15344. }
  15345. }
  15346. }
  15347. } else if (oldLevel) {
  15348. // 子到根
  15349. if (!isCrossDrag) {
  15350. return errRest;
  15351. }
  15352. } else if (newLevel) {
  15353. // 根到子
  15354. if (!isCrossDrag) {
  15355. return errRest;
  15356. }
  15357. if (oldAllMaps[newRowid]) {
  15358. isSelfToChildStatus = true;
  15359. if (!(isCrossDrag && isSelfToChildDrag)) {
  15360. if (core_.VxeUI.modal) {
  15361. core_.VxeUI.modal.message({
  15362. status: 'error',
  15363. content: methods_getI18n('vxe.error.treeDragChild')
  15364. });
  15365. }
  15366. return errRest;
  15367. }
  15368. }
  15369. } else {
  15370. // 根到根
  15371. }
  15372. const fullList = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toTreeArray(internalData.afterTreeFullData, {
  15373. key: rowField,
  15374. parentKey: parentField,
  15375. children: mapChildrenField
  15376. });
  15377. // 移出
  15378. const otfIndex = $xeTable.findRowIndexOf(fullList, dragRow);
  15379. fullList.splice(otfIndex, 1);
  15380. // 插入
  15381. const ptfIndex = $xeTable.findRowIndexOf(fullList, prevDragRow);
  15382. const ntfIndex = ptfIndex + dragOffsetIndex;
  15383. fullList.splice(ntfIndex, 0, dragRow);
  15384. // 改变层级
  15385. if (isSelfToChildStatus && isCrossDrag && isSelfToChildDrag) {
  15386. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(dragRow[childrenField], childRow => {
  15387. childRow[parentField] = dragRow[parentField];
  15388. });
  15389. }
  15390. dragRow[parentField] = isDragToChildFlag ? prevDragRow[rowField] : prevDragRow[parentField];
  15391. internalData.tableFullTreeData = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toArrayTree(fullList, {
  15392. key: rowField,
  15393. parentKey: parentField,
  15394. children: childrenField,
  15395. mapChildren: mapChildrenField
  15396. });
  15397. }
  15398. }
  15399. } else {
  15400. // 移出
  15401. oafIndex = $xeTable.findRowIndexOf(afterFullData, dragRow);
  15402. const otfIndex = $xeTable.findRowIndexOf(tableFullData, dragRow);
  15403. afterFullData.splice(oafIndex, 1);
  15404. tableFullData.splice(otfIndex, 1);
  15405. // 插入
  15406. const pafIndex = $xeTable.findRowIndexOf(afterFullData, prevDragRow);
  15407. const ptfIndex = $xeTable.findRowIndexOf(tableFullData, prevDragRow);
  15408. nafIndex = pafIndex + dragOffsetIndex;
  15409. const ntfIndex = ptfIndex + dragOffsetIndex;
  15410. afterFullData.splice(nafIndex, 0, dragRow);
  15411. tableFullData.splice(ntfIndex, 0, dragRow);
  15412. }
  15413. $xeTable.handleTableData(treeConfig && transform);
  15414. $xeTable.cacheRowMap(false);
  15415. updateScrollYStatus($xeTable);
  15416. if (!(treeConfig && transform)) {
  15417. updateAfterDataIndex($xeTable);
  15418. }
  15419. $xeTable.checkSelectionStatus();
  15420. if (reactData.scrollYLoad) {
  15421. $xeTable.updateScrollYSpace();
  15422. }
  15423. if (evnt) {
  15424. $xeTable.dispatchEvent('row-dragend', {
  15425. oldRow: dragRow,
  15426. newRow: prevDragRow,
  15427. dragRow,
  15428. dragPos: prevDragPos,
  15429. dragToChild: isDragToChildFlag,
  15430. offsetIndex: dragOffsetIndex,
  15431. _index: {
  15432. newIndex: nafIndex,
  15433. oldIndex: oafIndex
  15434. }
  15435. }, evnt);
  15436. }
  15437. return $xeTable.$nextTick().then(() => {
  15438. if (animation) {
  15439. const {
  15440. tableData
  15441. } = reactData;
  15442. const dragRowRest = fullAllDataRowIdData[dragRowid];
  15443. const _newRowIndex = dragRowRest._index;
  15444. const firstRow = tableData[0];
  15445. const firstRowRest = fullAllDataRowIdData[getRowid($xeTable, firstRow)];
  15446. let wrapperEl = el;
  15447. if ($xeGantt) {
  15448. const ganttContainerElem = $xeGantt.$refs.refGanttContainerElem;
  15449. if (ganttContainerElem) {
  15450. wrapperEl = ganttContainerElem;
  15451. }
  15452. }
  15453. if (firstRowRest) {
  15454. const _firstRowIndex = firstRowRest._index;
  15455. const _lastRowIndex = _firstRowIndex + tableData.length;
  15456. let rsIndex = -1;
  15457. let reIndex = -1;
  15458. let offsetRate = 1;
  15459. if (_dragRowIndex < _firstRowIndex) {
  15460. // 从上往下虚拟拖拽
  15461. rsIndex = 0;
  15462. reIndex = _newRowIndex - _firstRowIndex;
  15463. } else if (_dragRowIndex > _lastRowIndex) {
  15464. // 从下往上虚拟拖拽
  15465. const $newRowIndex = dragRowRest.$index;
  15466. rsIndex = $newRowIndex + 1;
  15467. reIndex = tableData.length;
  15468. offsetRate = -1;
  15469. } else {
  15470. if (_newRowIndex > _dragRowIndex) {
  15471. // 从上往下拖拽
  15472. rsIndex = _dragRowIndex - _firstRowIndex;
  15473. reIndex = rsIndex + _newRowIndex - _dragRowIndex;
  15474. } else {
  15475. // 从下往上拖拽
  15476. rsIndex = _newRowIndex - _firstRowIndex;
  15477. reIndex = rsIndex + _dragRowIndex - _newRowIndex + 1;
  15478. offsetRate = -1;
  15479. }
  15480. }
  15481. const dragRangeList = tableData.slice(rsIndex, reIndex);
  15482. if (dragRangeList.length) {
  15483. const dtClss = [];
  15484. dragRangeList.forEach(row => {
  15485. const rowid = getRowid($xeTable, row);
  15486. dtClss.push(`.vxe-body--row[rowid="${rowid}"]`);
  15487. if ($xeGantt) {
  15488. dtClss.push(`.vxe-gantt-view--body-row[rowid="${rowid}"]`, `.vxe-gantt-view--chart-row[rowid="${rowid}"]`);
  15489. }
  15490. });
  15491. const dtTrList = wrapperEl.querySelectorAll(dtClss.join(','));
  15492. moveRowAnimateToTb(dtTrList, offsetRate * dragRowHeight);
  15493. }
  15494. }
  15495. const drClss = [`.vxe-body--row[rowid="${dragRowid}"]`];
  15496. if ($xeGantt) {
  15497. drClss.push(`.vxe-gantt-view--body-row[rowid="${dragRowid}"]`, `.vxe-gantt-view--chart-row[rowid="${dragRowid}"]`);
  15498. }
  15499. const newDtTrList = wrapperEl.querySelectorAll(drClss.join(','));
  15500. const newTrEl = newDtTrList[0];
  15501. if (dragOffsetTop > -1 && newTrEl) {
  15502. moveRowAnimateToTb(newDtTrList, dragOffsetTop - newTrEl.offsetTop);
  15503. }
  15504. }
  15505. updateRowOffsetTop($xeTable);
  15506. updateRowExpandStyle($xeTable);
  15507. $xeTable.updateCellAreas();
  15508. $xeTable.recalculate();
  15509. }).then(() => {
  15510. return {
  15511. status: true
  15512. };
  15513. });
  15514. }).catch(() => {
  15515. return errRest;
  15516. });
  15517. }
  15518. return Promise.resolve(errRest);
  15519. },
  15520. /**
  15521. * 处理跨表拖拽完成
  15522. */
  15523. handleCrossTableRowDragFinishEvent(evnt) {
  15524. const $xeTable = this;
  15525. const $xeGantt = $xeTable.$xeGantt;
  15526. const reactData = $xeTable;
  15527. const internalData = $xeTable;
  15528. const crossTableDragRowInfo = getCrossTableDragRowInfo($xeTable);
  15529. const {
  15530. tableData
  15531. } = reactData;
  15532. const {
  15533. fullAllDataRowIdData
  15534. } = internalData;
  15535. const rowOpts = $xeTable.computeRowOpts;
  15536. const cellOpts = $xeTable.computeCellOpts;
  15537. const defaultRowHeight = $xeTable.computeDefaultRowHeight;
  15538. const rowDragOpts = $xeTable.computeRowDragOpts;
  15539. const {
  15540. animation,
  15541. isCrossTableDrag
  15542. } = rowDragOpts;
  15543. const treeOpts = $xeTable.computeTreeOpts;
  15544. const {
  15545. mapChildrenField
  15546. } = treeOpts;
  15547. const el = $xeTable.$refs.refElem;
  15548. if (isCrossTableDrag && crossTableDragRowObj && crossTableDragRowInfo) {
  15549. const {
  15550. row: dragRow
  15551. } = crossTableDragRowInfo;
  15552. if (dragRow) {
  15553. const dragRowid = getRowid($xeTable, dragRow);
  15554. const dragRowRest = fullAllDataRowIdData[dragRowid];
  15555. let dragRowHeight = 0;
  15556. let rsIndex = -1;
  15557. if (dragRowRest) {
  15558. if (animation) {
  15559. dragRowHeight = getCellRestHeight(dragRowRest, cellOpts, rowOpts, defaultRowHeight);
  15560. }
  15561. rsIndex = dragRowRest.$index;
  15562. }
  15563. const dragRangeList = rsIndex > -1 && rsIndex < tableData.length - 1 ? tableData.slice(rsIndex + 1) : [];
  15564. const dragList = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toTreeArray([dragRow], {
  15565. updated: true,
  15566. children: mapChildrenField
  15567. });
  15568. $xeTable.remove(dragList).then(() => {
  15569. if (animation && dragRowHeight && dragRangeList.length) {
  15570. const $xeGanttView = internalData.xeGanttView;
  15571. let wrapperEl = el;
  15572. if ($xeGantt && $xeGanttView) {
  15573. const ganttContainerElem = $xeGantt.$refs.refGanttContainerElem;
  15574. if (ganttContainerElem) {
  15575. wrapperEl = ganttContainerElem;
  15576. }
  15577. }
  15578. const dtClss = [];
  15579. dragRangeList.forEach(row => {
  15580. const rowid = getRowid($xeTable, row);
  15581. dtClss.push(`.vxe-body--row[rowid="${rowid}"]`);
  15582. if ($xeGantt) {
  15583. dtClss.push(`.vxe-gantt-view--body-row[rowid="${rowid}"]`, `.vxe-gantt-view--chart-row[rowid="${rowid}"]`);
  15584. }
  15585. });
  15586. const dtTrList = wrapperEl.querySelectorAll(dtClss.join(','));
  15587. moveRowAnimateToTb(dtTrList, dragRowHeight);
  15588. }
  15589. });
  15590. $xeTable.dispatchEvent('row-remove-dragend', {
  15591. row: dragRow
  15592. }, evnt);
  15593. clearRowDragData($xeTable);
  15594. clearCrossTableDragStatus($xeTable);
  15595. }
  15596. }
  15597. },
  15598. /**
  15599. * 处理跨表拖至新的空表
  15600. */
  15601. handleCrossTableRowDragoverEmptyEvent(evnt) {
  15602. const $xeTable = this;
  15603. const reactData = $xeTable;
  15604. const internalData = $xeTable;
  15605. const {
  15606. tableData
  15607. } = reactData;
  15608. const rowDragOpts = $xeTable.computeRowDragOpts;
  15609. const {
  15610. isCrossTableDrag
  15611. } = rowDragOpts;
  15612. if (isCrossTableDrag && crossTableDragRowObj && !tableData.length) {
  15613. const {
  15614. $oldTable,
  15615. $newTable
  15616. } = crossTableDragRowObj;
  15617. if ($oldTable) {
  15618. const oldTableReactData = $oldTable;
  15619. if ($oldTable.xID !== $xeTable.xID) {
  15620. if ($newTable && $newTable.xID !== $xeTable.xID) {
  15621. $newTable.hideCrossTableRowDropClearStatus();
  15622. }
  15623. evnt.preventDefault();
  15624. $oldTable.hideCrossTableRowDropClearStatus();
  15625. crossTableDragRowObj.$newTable = $xeTable;
  15626. internalData.prevDragRow = null;
  15627. reactData.dragTipText = oldTableReactData.dragTipText;
  15628. showDropTip($xeTable, evnt, evnt.currentTarget, null, true, '');
  15629. }
  15630. }
  15631. }
  15632. },
  15633. /**
  15634. * 处理跨表拖插入
  15635. */
  15636. handleCrossTableRowDragInsertEvent(evnt) {
  15637. const $xeTable = this;
  15638. const $xeGantt = $xeTable.$xeGantt;
  15639. const props = $xeTable;
  15640. const reactData = $xeTable;
  15641. const internalData = $xeTable;
  15642. const crossTableDragRowInfo = getCrossTableDragRowInfo($xeTable);
  15643. const {
  15644. treeConfig
  15645. } = props;
  15646. const {
  15647. prevDragRow,
  15648. prevDragPos,
  15649. prevDragToChild
  15650. } = internalData;
  15651. const rowDragOpts = $xeTable.computeRowDragOpts;
  15652. const {
  15653. animation,
  15654. isSelfToChildDrag,
  15655. isCrossTableDrag,
  15656. dragEndMethod,
  15657. dragToChildMethod
  15658. } = rowDragOpts;
  15659. const rowOpts = $xeTable.computeRowOpts;
  15660. const cellOpts = $xeTable.computeCellOpts;
  15661. const defaultRowHeight = $xeTable.computeDefaultRowHeight;
  15662. const treeOpts = $xeTable.computeTreeOpts;
  15663. const {
  15664. parentField,
  15665. mapChildrenField
  15666. } = treeOpts;
  15667. const childrenField = treeOpts.children || treeOpts.childrenField;
  15668. // 跨表拖拽
  15669. if (isCrossTableDrag && crossTableDragRowObj && crossTableDragRowInfo) {
  15670. const {
  15671. row: oldRow
  15672. } = crossTableDragRowInfo;
  15673. const {
  15674. $oldTable
  15675. } = crossTableDragRowObj;
  15676. const el = $xeTable.$refs.refElem;
  15677. if ($oldTable && oldRow) {
  15678. const dragRow = oldRow;
  15679. let dragOffsetIndex = -1;
  15680. if (prevDragRow) {
  15681. dragOffsetIndex = prevDragPos === 'bottom' ? 1 : 0;
  15682. }
  15683. const dragParams = {
  15684. oldRow: dragRow,
  15685. newRow: prevDragRow,
  15686. dragRow,
  15687. dragPos: prevDragPos,
  15688. dragToChild: !!prevDragToChild,
  15689. offsetIndex: dragOffsetIndex
  15690. };
  15691. const isDragToChildFlag = isSelfToChildDrag && dragToChildMethod ? dragToChildMethod(dragParams) : prevDragToChild;
  15692. const errRest = {
  15693. status: false
  15694. };
  15695. Promise.resolve(dragEndMethod ? dragEndMethod(dragParams) : true).then(status => {
  15696. if (!status) {
  15697. return errRest;
  15698. }
  15699. let insertRest = Promise.resolve();
  15700. if (treeConfig) {
  15701. const dragList = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toTreeArray([dragRow], {
  15702. updated: true,
  15703. children: mapChildrenField
  15704. });
  15705. $oldTable.handleCrossTableRowDragFinishEvent(evnt);
  15706. if (prevDragRow) {
  15707. dragRow[parentField] = prevDragRow[parentField];
  15708. } else {
  15709. dragRow[parentField] = null;
  15710. }
  15711. dragList.forEach(row => {
  15712. row[childrenField] = undefined;
  15713. row[mapChildrenField] = undefined;
  15714. });
  15715. if (prevDragRow) {
  15716. if (prevDragPos === 'bottom') {
  15717. insertRest = $xeTable.insertNextAt(dragList, prevDragRow);
  15718. } else {
  15719. insertRest = $xeTable.insertAt(dragList, prevDragRow);
  15720. }
  15721. } else {
  15722. insertRest = $xeTable.insert(dragList);
  15723. }
  15724. } else {
  15725. $oldTable.handleCrossTableRowDragFinishEvent(evnt);
  15726. if (prevDragRow) {
  15727. if (prevDragPos === 'bottom') {
  15728. insertRest = $xeTable.insertNextAt(dragRow, prevDragRow);
  15729. } else {
  15730. insertRest = $xeTable.insertAt(dragRow, prevDragRow);
  15731. }
  15732. } else {
  15733. insertRest = $xeTable.insert(dragRow);
  15734. }
  15735. }
  15736. $xeTable.dispatchEvent('row-insert-dragend', {
  15737. oldRow,
  15738. newRow: prevDragRow,
  15739. dragRow,
  15740. dragPos: prevDragPos,
  15741. dragToChild: isDragToChildFlag,
  15742. offsetIndex: dragOffsetIndex
  15743. }, evnt);
  15744. clearRowDragData($xeTable);
  15745. insertRest.then(() => {
  15746. const {
  15747. tableData
  15748. } = reactData;
  15749. const {
  15750. fullAllDataRowIdData
  15751. } = internalData;
  15752. const oldRowid = getRowid($xeTable, dragRow);
  15753. const oldRowRest = fullAllDataRowIdData[oldRowid];
  15754. let dragRowHeight = 0;
  15755. let rsIndex = -1;
  15756. if (oldRowRest) {
  15757. if (animation) {
  15758. dragRowHeight = getCellRestHeight(oldRowRest, cellOpts, rowOpts, defaultRowHeight);
  15759. }
  15760. rsIndex = oldRowRest.$index;
  15761. }
  15762. const dragRangeList = rsIndex > -1 ? tableData.slice(rsIndex) : [];
  15763. if (animation && dragRowHeight && dragRangeList.length) {
  15764. const $xeGanttView = internalData.xeGanttView;
  15765. let wrapperEl = el;
  15766. if ($xeGantt && $xeGanttView) {
  15767. const ganttContainerElem = $xeGantt.$refs.refGanttContainerElem;
  15768. if (ganttContainerElem) {
  15769. wrapperEl = ganttContainerElem;
  15770. }
  15771. }
  15772. const dtClss = [];
  15773. dragRangeList.forEach(row => {
  15774. const rowid = getRowid($xeTable, row);
  15775. dtClss.push(`.vxe-body--row[rowid="${rowid}"]`);
  15776. if ($xeGantt) {
  15777. dtClss.push(`.vxe-gantt-view--body-row[rowid="${rowid}"]`, `.vxe-gantt-view--chart-row[rowid="${rowid}"]`);
  15778. }
  15779. });
  15780. const dtTrList = wrapperEl.querySelectorAll(dtClss.join(','));
  15781. moveRowAnimateToTb(dtTrList, -dragRowHeight);
  15782. }
  15783. });
  15784. });
  15785. }
  15786. }
  15787. },
  15788. hideCrossTableRowDropClearStatus() {
  15789. const $xeTable = this;
  15790. hideDropTip($xeTable);
  15791. },
  15792. handleRowDragDragendEvent(evnt) {
  15793. const $xeTable = this;
  15794. const props = $xeTable;
  15795. const reactData = $xeTable;
  15796. const internalData = $xeTable;
  15797. const {
  15798. treeConfig
  15799. } = props;
  15800. const {
  15801. fullAllDataRowIdData,
  15802. prevDragToChild
  15803. } = internalData;
  15804. const {
  15805. dragRow
  15806. } = reactData;
  15807. const treeOpts = $xeTable.computeTreeOpts;
  15808. const {
  15809. lazy
  15810. } = treeOpts;
  15811. const hasChildField = treeOpts.hasChild || treeOpts.hasChildField;
  15812. const {
  15813. prevDragRow,
  15814. prevDragPos
  15815. } = internalData;
  15816. const rowDragOpts = $xeTable.computeRowDragOpts;
  15817. const {
  15818. isCrossTableDrag,
  15819. isCrossDrag
  15820. } = rowDragOpts;
  15821. // 跨表拖拽
  15822. if (isCrossTableDrag && crossTableDragRowObj) {
  15823. const {
  15824. $newTable
  15825. } = crossTableDragRowObj;
  15826. if ($newTable && $newTable.xID !== $xeTable.xID) {
  15827. if (!treeConfig || isCrossDrag) {
  15828. $newTable.handleCrossTableRowDragInsertEvent(evnt);
  15829. }
  15830. return;
  15831. }
  15832. }
  15833. if (treeConfig && lazy && prevDragToChild) {
  15834. // 懒加载
  15835. const newRowid = getRowid($xeTable, prevDragRow);
  15836. const rowRest = fullAllDataRowIdData[newRowid];
  15837. if (prevDragRow[hasChildField]) {
  15838. if (rowRest && rowRest.treeLoaded) {
  15839. $xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild);
  15840. }
  15841. } else {
  15842. $xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild);
  15843. }
  15844. } else {
  15845. $xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild);
  15846. }
  15847. clearRowDragData($xeTable);
  15848. clearCrossTableDragStatus($xeTable);
  15849. },
  15850. handleRowDragDragoverEvent(evnt) {
  15851. const $xeTable = this;
  15852. const props = $xeTable;
  15853. const reactData = $xeTable;
  15854. const internalData = $xeTable;
  15855. const {
  15856. treeConfig
  15857. } = props;
  15858. const {
  15859. fullAllDataRowIdData
  15860. } = internalData;
  15861. const {
  15862. dragRow
  15863. } = reactData;
  15864. const treeOpts = $xeTable.computeTreeOpts;
  15865. const {
  15866. lazy,
  15867. transform,
  15868. parentField
  15869. } = treeOpts;
  15870. const hasChildField = treeOpts.hasChild || treeOpts.hasChildField;
  15871. const rowDragOpts = $xeTable.computeRowDragOpts;
  15872. const {
  15873. isPeerDrag,
  15874. isCrossDrag,
  15875. isToChildDrag,
  15876. isCrossTableDrag
  15877. } = rowDragOpts;
  15878. if (!dragRow && !(isCrossTableDrag && (!treeConfig || isCrossDrag) && crossTableDragRowObj)) {
  15879. evnt.preventDefault();
  15880. return;
  15881. }
  15882. const isControlKey = hasControlKey(evnt);
  15883. const trEl = evnt.currentTarget;
  15884. const rowid = trEl.getAttribute('rowid') || '';
  15885. const rest = fullAllDataRowIdData[rowid];
  15886. if (rest) {
  15887. evnt.preventDefault();
  15888. const row = rest.row;
  15889. const rowid = getRowid($xeTable, row);
  15890. const rowRest = fullAllDataRowIdData[rowid];
  15891. const offsetY = evnt.clientY - trEl.getBoundingClientRect().y;
  15892. const dragPos = offsetY < trEl.clientHeight / 2 ? 'top' : 'bottom';
  15893. internalData.prevDragToChild = !!(treeConfig && transform && isCrossDrag && isToChildDrag && isControlKey);
  15894. internalData.prevDragRow = row;
  15895. internalData.prevDragPos = dragPos;
  15896. // 跨表拖拽
  15897. if (isCrossTableDrag && (!treeConfig || isCrossDrag) && crossTableDragRowObj) {
  15898. const {
  15899. $oldTable,
  15900. $newTable
  15901. } = crossTableDragRowObj;
  15902. if ($oldTable) {
  15903. const oldTableReactData = $oldTable;
  15904. if ($oldTable.xID === $xeTable.xID) {
  15905. if ($newTable) {
  15906. $newTable.hideCrossTableRowDropClearStatus();
  15907. }
  15908. reactData.isCrossDragRow = false;
  15909. oldTableReactData.isCrossDragRow = false;
  15910. crossTableDragRowObj.$newTable = null;
  15911. } else if (!treeConfig || isCrossDrag) {
  15912. if ($newTable && $newTable.xID !== $xeTable.xID) {
  15913. $newTable.hideCrossTableRowDropClearStatus();
  15914. }
  15915. $oldTable.hideCrossTableRowDropClearStatus();
  15916. oldTableReactData.isCrossDragRow = true;
  15917. reactData.dragTipText = oldTableReactData.dragTipText;
  15918. crossTableDragRowObj.$newTable = $xeTable;
  15919. showDropTip($xeTable, evnt, trEl, null, true, dragPos);
  15920. return;
  15921. }
  15922. }
  15923. }
  15924. if ($xeTable.eqRow(dragRow, row) || isControlKey && treeConfig && lazy && row[hasChildField] && rowRest && !rowRest.treeLoaded || !isCrossDrag && treeConfig && transform && (isPeerDrag ? dragRow[parentField] !== row[parentField] : rest.level)) {
  15925. showDropTip($xeTable, evnt, trEl, null, false, dragPos);
  15926. return;
  15927. }
  15928. showDropTip($xeTable, evnt, trEl, null, true, dragPos);
  15929. $xeTable.dispatchEvent('row-dragover', {
  15930. oldRow: dragRow,
  15931. targetRow: row,
  15932. dragPos
  15933. }, evnt);
  15934. }
  15935. },
  15936. handleCellDragMousedownEvent(evnt, params) {
  15937. const $xeTable = this;
  15938. const props = $xeTable;
  15939. const reactData = $xeTable;
  15940. const crossTableDragRowInfo = getCrossTableDragRowInfo($xeTable);
  15941. evnt.stopPropagation();
  15942. const {
  15943. dragConfig
  15944. } = props;
  15945. const rowDragOpts = $xeTable.computeRowDragOpts;
  15946. const {
  15947. isCrossTableDrag,
  15948. trigger,
  15949. dragStartMethod
  15950. } = rowDragOpts;
  15951. const {
  15952. row
  15953. } = params;
  15954. const dragEl = evnt.currentTarget;
  15955. const tdEl = trigger === 'cell' || trigger === 'row' ? dragEl : dragEl.parentElement?.parentElement;
  15956. const trEl = tdEl.parentElement;
  15957. const dStartMethod = dragStartMethod || (dragConfig ? dragConfig.dragStartMethod : null);
  15958. clearRowDropOrigin($xeTable);
  15959. if (dStartMethod && !dStartMethod(params)) {
  15960. trEl.draggable = false;
  15961. reactData.dragRow = null;
  15962. reactData.dragCol = null;
  15963. clearCrossTableDragStatus($xeTable);
  15964. hideDropTip($xeTable);
  15965. return;
  15966. }
  15967. if (isCrossTableDrag) {
  15968. crossTableDragRowInfo.row = row;
  15969. crossTableDragRowObj = {
  15970. $oldTable: $xeTable,
  15971. $newTable: null
  15972. };
  15973. }
  15974. reactData.dragRow = row;
  15975. reactData.isCrossDragRow = false;
  15976. reactData.dragCol = null;
  15977. trEl.draggable = true;
  15978. updateRowDropOrigin($xeTable, row);
  15979. updateRowDropTipContent($xeTable, tdEl);
  15980. $xeTable.dispatchEvent('row-dragstart', params, evnt);
  15981. },
  15982. handleCellDragMouseupEvent() {
  15983. const $xeTable = this;
  15984. clearDragStatus($xeTable);
  15985. },
  15986. /**
  15987. * 列拖拽
  15988. */
  15989. handleHeaderCellDragDragstartEvent(evnt) {
  15990. if (evnt.dataTransfer) {
  15991. evnt.dataTransfer.setDragImage(getTpImg(), 0, 0);
  15992. }
  15993. },
  15994. handleColDragSwapColumn() {
  15995. const $xeTable = this;
  15996. handleUpdateColumn($xeTable);
  15997. return parseColumns($xeTable, false).then(() => {
  15998. $xeTable.updateCellAreas();
  15999. $xeTable.saveCustomStore('update:sort');
  16000. });
  16001. },
  16002. handleColDragSwapEvent(evnt, isSyncColumn, dragCol, prevDragCol, prevDragPos, prevDragToChild) {
  16003. const $xeTable = this;
  16004. const props = $xeTable;
  16005. const reactData = $xeTable;
  16006. const internalData = $xeTable;
  16007. const {
  16008. mouseConfig
  16009. } = props;
  16010. const columnDragOpts = $xeTable.computeColumnDragOpts;
  16011. const {
  16012. animation,
  16013. isPeerDrag,
  16014. isCrossDrag,
  16015. isSelfToChildDrag,
  16016. isToChildDrag,
  16017. dragEndMethod,
  16018. dragToChildMethod
  16019. } = columnDragOpts;
  16020. const {
  16021. collectColumn,
  16022. fullColumnIdData
  16023. } = internalData;
  16024. const el = $xeTable.$refs.refElem;
  16025. const dragOffsetIndex = prevDragPos === 'right' ? 1 : 0;
  16026. const errRest = {
  16027. status: false
  16028. };
  16029. if (!(el && prevDragCol && dragCol)) {
  16030. return Promise.resolve(errRest);
  16031. }
  16032. // 判断是否有拖动
  16033. if (prevDragCol !== dragCol) {
  16034. const dragColumn = dragCol;
  16035. const newColumn = prevDragCol;
  16036. const dragParams = {
  16037. oldColumn: dragColumn,
  16038. newColumn,
  16039. dragColumn,
  16040. dragPos: prevDragPos,
  16041. dragToChild: !!prevDragToChild,
  16042. offsetIndex: dragOffsetIndex
  16043. };
  16044. const isDragToChildFlag = isSelfToChildDrag && dragToChildMethod ? dragToChildMethod(dragParams) : prevDragToChild;
  16045. return Promise.resolve(dragEndMethod ? dragEndMethod(dragParams) : true).then(status => {
  16046. if (!status) {
  16047. return errRest;
  16048. }
  16049. let dragTargetColumn = null;
  16050. const dragAllTargetCols = [];
  16051. let dragColWidth = 0;
  16052. if (animation) {
  16053. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree([dragColumn], column => {
  16054. if (!dragTargetColumn && (!column.children || !column.children.length)) {
  16055. dragTargetColumn = column;
  16056. dragColWidth += column.renderWidth;
  16057. }
  16058. dragAllTargetCols.push(column);
  16059. });
  16060. }
  16061. if (!dragTargetColumn) {
  16062. dragTargetColumn = dragColumn;
  16063. }
  16064. const dragColRest = fullColumnIdData[dragTargetColumn.id] || {};
  16065. const _dragColIndex = dragColRest._index;
  16066. let dragOffsetLeft = -1;
  16067. if (animation) {
  16068. const oldTrEl = el.querySelector(`.vxe-table--column[colid="${dragTargetColumn.id}"]`);
  16069. if (oldTrEl) {
  16070. dragOffsetLeft = oldTrEl.offsetLeft;
  16071. }
  16072. }
  16073. let oafIndex = -1;
  16074. let nafIndex = -1;
  16075. const oldAllMaps = {};
  16076. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree([dragColumn], column => {
  16077. oldAllMaps[column.id] = column;
  16078. });
  16079. let isSelfToChildStatus = false;
  16080. if (dragColumn.parentId && newColumn.parentId) {
  16081. // 子到子
  16082. if (isPeerDrag && !isCrossDrag) {
  16083. if (dragColumn.parentId !== newColumn.parentId) {
  16084. // 非同级
  16085. return errRest;
  16086. }
  16087. } else {
  16088. if (!isCrossDrag) {
  16089. return errRest;
  16090. }
  16091. if (oldAllMaps[newColumn.id]) {
  16092. isSelfToChildStatus = true;
  16093. if (!(isCrossDrag && isSelfToChildDrag)) {
  16094. if (core_.VxeUI.modal) {
  16095. core_.VxeUI.modal.message({
  16096. status: 'error',
  16097. content: methods_getI18n('vxe.error.treeDragChild')
  16098. });
  16099. }
  16100. return errRest;
  16101. }
  16102. }
  16103. }
  16104. } else if (dragColumn.parentId) {
  16105. // 子到根
  16106. if (!isCrossDrag) {
  16107. return errRest;
  16108. }
  16109. } else if (newColumn.parentId) {
  16110. // 根到子
  16111. if (!isCrossDrag) {
  16112. return errRest;
  16113. }
  16114. if (oldAllMaps[newColumn.id]) {
  16115. isSelfToChildStatus = true;
  16116. if (!(isCrossDrag && isSelfToChildDrag)) {
  16117. if (core_.VxeUI.modal) {
  16118. core_.VxeUI.modal.message({
  16119. status: 'error',
  16120. content: methods_getI18n('vxe.error.treeDragChild')
  16121. });
  16122. }
  16123. return errRest;
  16124. }
  16125. }
  16126. } else {
  16127. // 根到根
  16128. }
  16129. const oldewMatchRest = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findTree(collectColumn, item => item.id === dragColumn.id);
  16130. // 改变层级
  16131. if (isSelfToChildStatus && isCrossDrag && isSelfToChildDrag) {
  16132. if (oldewMatchRest) {
  16133. const {
  16134. items: oCols,
  16135. index: oIndex
  16136. } = oldewMatchRest;
  16137. const childList = dragColumn.children || [];
  16138. childList.forEach(column => {
  16139. column.parentId = dragColumn.parentId;
  16140. });
  16141. oCols.splice(oIndex, 1, ...childList);
  16142. dragColumn.children = [];
  16143. }
  16144. } else {
  16145. if (oldewMatchRest) {
  16146. const {
  16147. items: oCols,
  16148. index: oIndex,
  16149. parent: oParent
  16150. } = oldewMatchRest;
  16151. oCols.splice(oIndex, 1);
  16152. if (!oParent) {
  16153. oafIndex = oIndex;
  16154. }
  16155. }
  16156. }
  16157. const newMatchRest = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findTree(collectColumn, item => item.id === newColumn.id);
  16158. if (newMatchRest) {
  16159. const {
  16160. items: nCols,
  16161. index: nIndex,
  16162. parent: nParent
  16163. } = newMatchRest;
  16164. // 转子级
  16165. if (isCrossDrag && isToChildDrag && isDragToChildFlag) {
  16166. dragColumn.parentId = newColumn.id;
  16167. newColumn.children = (newColumn.children || []).concat([dragColumn]);
  16168. } else {
  16169. dragColumn.parentId = newColumn.parentId;
  16170. nCols.splice(nIndex + dragOffsetIndex, 0, dragColumn);
  16171. }
  16172. if (!nParent) {
  16173. nafIndex = nIndex;
  16174. }
  16175. }
  16176. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(collectColumn, (column, index, items, path, parentColumn) => {
  16177. if (!parentColumn) {
  16178. const sortIndex = index + 1;
  16179. column.renderSortNumber = sortIndex;
  16180. }
  16181. });
  16182. if (mouseConfig) {
  16183. if ($xeTable.clearSelected) {
  16184. $xeTable.clearSelected();
  16185. }
  16186. if ($xeTable.clearCellAreas) {
  16187. $xeTable.clearCellAreas();
  16188. $xeTable.clearCopyCellArea();
  16189. }
  16190. }
  16191. if (evnt) {
  16192. $xeTable.dispatchEvent('column-dragend', {
  16193. oldColumn: dragColumn,
  16194. newColumn,
  16195. dragColumn,
  16196. dragPos: prevDragPos,
  16197. dragToChild: isDragToChildFlag,
  16198. offsetIndex: dragOffsetIndex,
  16199. _index: {
  16200. newIndex: nafIndex,
  16201. oldIndex: oafIndex
  16202. }
  16203. }, evnt);
  16204. }
  16205. return $xeTable.$nextTick().then(() => {
  16206. if (isSyncColumn) {
  16207. return $xeTable.handleColDragSwapColumn();
  16208. }
  16209. }).then(() => {
  16210. if (animation) {
  16211. const {
  16212. tableColumn
  16213. } = reactData;
  16214. const {
  16215. visibleColumn,
  16216. fullColumnIdData
  16217. } = internalData;
  16218. let dragNewColumn = null;
  16219. const dragNewColMaps = {};
  16220. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree([dragColumn], column => {
  16221. if (!dragNewColumn && (!column.children || !column.children.length)) {
  16222. dragNewColumn = column;
  16223. }
  16224. dragNewColMaps[column.id] = column;
  16225. });
  16226. if (!dragNewColumn) {
  16227. dragNewColumn = dragColumn;
  16228. }
  16229. if (dragColWidth && dragAllTargetCols.length) {
  16230. const _newColIndex = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findIndexOf(visibleColumn, column => !!dragNewColumn && column.id === dragNewColumn.id);
  16231. const firstCol = tableColumn[0];
  16232. const firstColRest = fullColumnIdData[firstCol.id];
  16233. if (firstColRest) {
  16234. const _firstColIndex = firstColRest._index;
  16235. const _lastColIndex = _firstColIndex + tableColumn.length;
  16236. let csIndex = -1;
  16237. let ceIndex = -1;
  16238. let offsetRate = 1;
  16239. if (_dragColIndex < _firstColIndex) {
  16240. // 从左往右虚拟拖拽
  16241. csIndex = 0;
  16242. ceIndex = _newColIndex - _firstColIndex;
  16243. } else if (_dragColIndex > _lastColIndex) {
  16244. // 从右往左虚拟拖拽
  16245. const $newRowIndex = dragColRest.$index;
  16246. csIndex = $newRowIndex + 1;
  16247. ceIndex = tableColumn.length;
  16248. offsetRate = -1;
  16249. } else {
  16250. if (_newColIndex > _dragColIndex) {
  16251. // 从左往右拖拽
  16252. csIndex = _dragColIndex - _firstColIndex;
  16253. ceIndex = csIndex + _newColIndex - _dragColIndex;
  16254. } else {
  16255. // 从右往左拖拽
  16256. csIndex = _newColIndex - _firstColIndex + 1;
  16257. ceIndex = csIndex + _dragColIndex - _newColIndex;
  16258. offsetRate = -1;
  16259. }
  16260. }
  16261. const dragRangeList = [];
  16262. const dragRangeMaps = {};
  16263. for (let i = csIndex; i < ceIndex; i++) {
  16264. const column = tableColumn[i];
  16265. if (!dragRangeMaps[column.id] && !dragNewColMaps[column.id]) {
  16266. dragRangeMaps[column.id] = column;
  16267. dragRangeList.push(column);
  16268. }
  16269. }
  16270. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree([newColumn], column => {
  16271. if (!dragRangeMaps[column.id]) {
  16272. dragRangeMaps[column.id] = column;
  16273. dragRangeList.push(column);
  16274. }
  16275. });
  16276. if (dragRangeList.length) {
  16277. const dtTrList = el.querySelectorAll(dragRangeList.map(column => `.vxe-table--column[colid="${column.id}"]`).join(','));
  16278. moveColAnimateToLr(dtTrList, offsetRate * dragColWidth);
  16279. }
  16280. }
  16281. const newTrList = el.querySelectorAll(dragAllTargetCols.map(column => `.vxe-table--column[colid="${column.id}"]`).join(','));
  16282. const newTdEl = newTrList[0];
  16283. if (dragOffsetLeft > -1 && newTdEl) {
  16284. moveColAnimateToLr(newTrList, dragOffsetLeft - newTdEl.offsetLeft);
  16285. }
  16286. }
  16287. }
  16288. updateColumnOffsetLeft($xeTable);
  16289. loadScrollXData($xeTable);
  16290. $xeTable.updateCellAreas();
  16291. return {
  16292. status: true
  16293. };
  16294. });
  16295. }).catch(() => {
  16296. return errRest;
  16297. });
  16298. }
  16299. return Promise.resolve(errRest);
  16300. },
  16301. handleHeaderCellDragDragendEvent(evnt) {
  16302. const $xeTable = this;
  16303. const reactData = $xeTable;
  16304. const internalData = $xeTable;
  16305. const {
  16306. dragCol
  16307. } = reactData;
  16308. const {
  16309. prevDragCol,
  16310. prevDragPos,
  16311. prevDragToChild
  16312. } = internalData;
  16313. const el = $xeTable.$refs.refElem;
  16314. $xeTable.handleColDragSwapEvent(evnt, true, dragCol, prevDragCol, prevDragPos, prevDragToChild);
  16315. hideDropTip($xeTable);
  16316. clearColDropOrigin($xeTable);
  16317. clearColAnimate(el, ['.vxe-table--column']);
  16318. internalData.prevDragToChild = false;
  16319. reactData.dragRow = null;
  16320. reactData.dragCol = null;
  16321. clearCrossTableDragStatus($xeTable);
  16322. },
  16323. handleHeaderCellDragDragoverEvent(evnt) {
  16324. const $xeTable = this;
  16325. const reactData = $xeTable;
  16326. const internalData = $xeTable;
  16327. const {
  16328. dragCol
  16329. } = reactData;
  16330. const columnDragOpts = $xeTable.computeColumnDragOpts;
  16331. const {
  16332. isToChildDrag,
  16333. isPeerDrag,
  16334. isCrossDrag
  16335. } = columnDragOpts;
  16336. if (!dragCol) {
  16337. evnt.preventDefault();
  16338. return;
  16339. }
  16340. const isControlKey = hasControlKey(evnt);
  16341. const thEl = evnt.currentTarget;
  16342. const colid = thEl.getAttribute('colid');
  16343. const column = $xeTable.getColumnById(colid);
  16344. if (column) {
  16345. evnt.preventDefault();
  16346. const {
  16347. clientX
  16348. } = evnt;
  16349. const offsetX = clientX - thEl.getBoundingClientRect().x;
  16350. const dragPos = offsetX < thEl.clientWidth / 2 ? 'left' : 'right';
  16351. internalData.prevDragToChild = !!(isCrossDrag && isToChildDrag && isControlKey);
  16352. internalData.prevDragCol = column;
  16353. internalData.prevDragPos = dragPos;
  16354. if (column.fixed || dragCol && dragCol.id === column.id || !isCrossDrag && (isPeerDrag ? dragCol.parentId !== column.parentId : column.parentId)) {
  16355. showDropTip($xeTable, evnt, null, thEl, false, dragPos);
  16356. return;
  16357. }
  16358. showDropTip($xeTable, evnt, null, thEl, true, dragPos);
  16359. $xeTable.dispatchEvent('column-dragover', {
  16360. oldColumn: dragCol,
  16361. targetColumn: column,
  16362. dragPos
  16363. }, evnt);
  16364. // 边缘滚动
  16365. const el = $xeTable.$refs.refElem;
  16366. if (!el) {
  16367. return;
  16368. }
  16369. const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
  16370. const refTableBody = $xeTable.$refs.refTableBody;
  16371. const tableBodyElem = refTableBody ? refTableBody.$el : null;
  16372. const scrollTargetEl = xHandleEl || tableBodyElem;
  16373. if (scrollTargetEl) {
  16374. const wrapperRect = el.getBoundingClientRect();
  16375. const tableWrapperWidth = el.clientWidth;
  16376. const leftContainerElem = $xeTable.$refs.refLeftContainer;
  16377. const leftContainerWidth = leftContainerElem ? leftContainerElem.clientWidth : 0;
  16378. const rightContainerElem = $xeTable.$refs.refRightContainer;
  16379. const rightContainerWidth = rightContainerElem ? rightContainerElem.clientWidth : 0;
  16380. const srartX = wrapperRect.x + leftContainerWidth;
  16381. const endX = wrapperRect.x + tableWrapperWidth - rightContainerWidth;
  16382. const distSize = 28;
  16383. const startDistSize = clientX - srartX;
  16384. const endDistSize = endX - clientX;
  16385. if (startDistSize > 0 && startDistSize <= distSize) {
  16386. const scrollRatio = Math.floor(tableWrapperWidth / (startDistSize > distSize / 2 ? 240 : 120));
  16387. scrollTargetEl.scrollLeft -= scrollRatio * (distSize - startDistSize);
  16388. } else if (endDistSize > 0 && endDistSize <= distSize) {
  16389. const scrollRatio = Math.floor(tableWrapperWidth / (endDistSize > distSize / 2 ? 240 : 120));
  16390. scrollTargetEl.scrollLeft += scrollRatio * (distSize - endDistSize);
  16391. }
  16392. }
  16393. }
  16394. },
  16395. handleHeaderCellDragMousedownEvent(evnt, params) {
  16396. const $xeTable = this;
  16397. const reactData = $xeTable;
  16398. evnt.stopPropagation();
  16399. const columnDragOpts = $xeTable.computeColumnDragOpts;
  16400. const {
  16401. trigger,
  16402. dragStartMethod
  16403. } = columnDragOpts;
  16404. const {
  16405. column
  16406. } = params;
  16407. const dragEl = evnt.currentTarget;
  16408. const thEl = trigger === 'cell' ? dragEl : dragEl.parentElement?.parentElement;
  16409. clearColDropOrigin($xeTable);
  16410. if (dragStartMethod && !dragStartMethod(params)) {
  16411. thEl.draggable = false;
  16412. reactData.dragRow = null;
  16413. reactData.dragCol = null;
  16414. hideDropTip($xeTable);
  16415. clearCrossTableDragStatus($xeTable);
  16416. return;
  16417. }
  16418. reactData.dragCol = column;
  16419. reactData.dragRow = null;
  16420. thEl.draggable = true;
  16421. clearCrossTableDragStatus($xeTable);
  16422. updateColDropOrigin($xeTable, column);
  16423. updateColDropTipContent($xeTable, thEl);
  16424. $xeTable.dispatchEvent('column-dragstart', params, evnt);
  16425. },
  16426. handleHeaderCellDragMouseupEvent() {
  16427. const $xeTable = this;
  16428. const reactData = $xeTable;
  16429. clearColDropOrigin($xeTable);
  16430. hideDropTip($xeTable);
  16431. clearCrossTableDragStatus($xeTable);
  16432. reactData.dragRow = null;
  16433. reactData.dragCol = null;
  16434. },
  16435. setPendingRow(rows, status) {
  16436. const $xeTable = this;
  16437. const reactData = $xeTable;
  16438. const internalData = $xeTable;
  16439. const {
  16440. handleGetRowId
  16441. } = createHandleGetRowId($xeTable);
  16442. const {
  16443. pendingRowMaps
  16444. } = internalData;
  16445. if (rows && !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(rows)) {
  16446. rows = [rows];
  16447. }
  16448. if (status) {
  16449. rows.forEach(row => {
  16450. const rowid = handleGetRowId(row);
  16451. if (rowid && !pendingRowMaps[rowid]) {
  16452. pendingRowMaps[rowid] = row;
  16453. }
  16454. });
  16455. } else {
  16456. rows.forEach(row => {
  16457. const rowid = handleGetRowId(row);
  16458. if (rowid && pendingRowMaps[rowid]) {
  16459. delete pendingRowMaps[rowid];
  16460. }
  16461. });
  16462. }
  16463. reactData.pendingRowFlag++;
  16464. return $xeTable.$nextTick();
  16465. },
  16466. togglePendingRow(rows) {
  16467. const $xeTable = this;
  16468. const reactData = $xeTable;
  16469. const internalData = $xeTable;
  16470. const {
  16471. handleGetRowId
  16472. } = createHandleGetRowId($xeTable);
  16473. const {
  16474. pendingRowMaps
  16475. } = internalData;
  16476. if (rows && !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(rows)) {
  16477. rows = [rows];
  16478. }
  16479. rows.forEach(row => {
  16480. const rowid = handleGetRowId(row);
  16481. if (rowid) {
  16482. if (pendingRowMaps[rowid]) {
  16483. delete pendingRowMaps[rowid];
  16484. } else {
  16485. pendingRowMaps[rowid] = row;
  16486. }
  16487. }
  16488. });
  16489. reactData.pendingRowFlag++;
  16490. return $xeTable.$nextTick();
  16491. },
  16492. hasPendingByRow(row) {
  16493. const $xeTable = this;
  16494. return $xeTable.isPendingByRow(row);
  16495. },
  16496. isPendingByRow(row) {
  16497. const $xeTable = this;
  16498. const reactData = $xeTable;
  16499. const {
  16500. pendingRowMaps
  16501. } = reactData;
  16502. const rowid = getRowid($xeTable, row);
  16503. return !!pendingRowMaps[rowid];
  16504. },
  16505. getPendingRecords() {
  16506. const $xeTable = this;
  16507. const internalData = $xeTable;
  16508. const {
  16509. fullAllDataRowIdData,
  16510. pendingRowMaps
  16511. } = internalData;
  16512. const insertRecords = [];
  16513. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(pendingRowMaps, (row, rowid) => {
  16514. if (fullAllDataRowIdData[rowid]) {
  16515. insertRecords.push(row);
  16516. }
  16517. });
  16518. return insertRecords;
  16519. },
  16520. clearPendingRow() {
  16521. const $xeTable = this;
  16522. const reactData = $xeTable;
  16523. const internalData = $xeTable;
  16524. internalData.pendingRowMaps = {};
  16525. reactData.pendingRowFlag++;
  16526. return $xeTable.$nextTick();
  16527. },
  16528. sort(sortConfs, sortOrder) {
  16529. const $xeTable = this;
  16530. const sortOpts = $xeTable.computeSortOpts;
  16531. const {
  16532. multiple,
  16533. remote,
  16534. orders
  16535. } = sortOpts;
  16536. if (sortConfs) {
  16537. if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(sortConfs)) {
  16538. sortConfs = [{
  16539. field: sortConfs,
  16540. order: sortOrder
  16541. }];
  16542. }
  16543. }
  16544. if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(sortConfs)) {
  16545. sortConfs = [sortConfs];
  16546. }
  16547. if (sortConfs.length) {
  16548. let firstSortColumn;
  16549. if (!multiple) {
  16550. clearAllSort($xeTable);
  16551. }
  16552. (multiple ? sortConfs : [sortConfs[0]]).forEach((confs, index) => {
  16553. let {
  16554. field,
  16555. order
  16556. } = confs;
  16557. let column = field;
  16558. if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(field)) {
  16559. column = $xeTable.getColumnByField(field);
  16560. }
  16561. if (column && (column.sortable || column.remoteSort)) {
  16562. if (!firstSortColumn) {
  16563. firstSortColumn = column;
  16564. }
  16565. if (orders && orders.indexOf(order) === -1) {
  16566. order = getNextSortOrder($xeTable, column);
  16567. }
  16568. if (column.order !== order) {
  16569. column.order = order;
  16570. }
  16571. column.sortTime = Date.now() + index;
  16572. }
  16573. });
  16574. // 如果是服务端排序,则跳过本地排序处理
  16575. if (!remote || firstSortColumn && firstSortColumn.remoteSort) {
  16576. $xeTable.handleTableData(true);
  16577. }
  16578. return $xeTable.$nextTick().then(() => {
  16579. updateRowOffsetTop($xeTable);
  16580. $xeTable.updateCellAreas();
  16581. return updateStyle($xeTable);
  16582. });
  16583. }
  16584. return $xeTable.$nextTick();
  16585. },
  16586. setSort(sortConfs, isUpdate) {
  16587. const $xeTable = this;
  16588. return handleSortEvent($xeTable, null, sortConfs, isUpdate);
  16589. },
  16590. setSortByEvent(evnt, sortConfs) {
  16591. const $xeTable = this;
  16592. return handleSortEvent($xeTable, evnt, sortConfs, true);
  16593. },
  16594. /**
  16595. * 清空指定列的排序条件
  16596. * 如果为空则清空所有列的排序条件
  16597. * @param {String} column 列或字段名
  16598. */
  16599. clearSort(fieldOrColumn) {
  16600. const $xeTable = this;
  16601. const sortOpts = $xeTable.computeSortOpts;
  16602. if (fieldOrColumn) {
  16603. const column = handleFieldOrColumn($xeTable, fieldOrColumn);
  16604. if (column) {
  16605. column.order = null;
  16606. }
  16607. } else {
  16608. clearAllSort($xeTable);
  16609. }
  16610. if (!sortOpts.remote) {
  16611. $xeTable.handleTableData(true);
  16612. }
  16613. return $xeTable.$nextTick().then(() => {
  16614. updateRowOffsetTop($xeTable);
  16615. return updateStyle($xeTable);
  16616. });
  16617. },
  16618. clearSortByEvent(evnt, fieldOrColumn) {
  16619. const $xeTable = this;
  16620. const internalData = $xeTable;
  16621. const {
  16622. tableFullColumn
  16623. } = internalData;
  16624. const sortOpts = $xeTable.computeSortOpts;
  16625. const {
  16626. multiple
  16627. } = sortOpts;
  16628. const sortCols = [];
  16629. let column = null;
  16630. if (evnt) {
  16631. if (fieldOrColumn) {
  16632. column = handleFieldOrColumn($xeTable, fieldOrColumn);
  16633. if (column) {
  16634. column.order = null;
  16635. }
  16636. } else {
  16637. tableFullColumn.forEach(column => {
  16638. if (column.order) {
  16639. column.order = null;
  16640. sortCols.push(column);
  16641. }
  16642. });
  16643. }
  16644. if (!sortOpts.remote) {
  16645. $xeTable.handleTableData(true);
  16646. }
  16647. if (!multiple) {
  16648. column = sortCols[0];
  16649. }
  16650. if (column) {
  16651. $xeTable.handleColumnSortEvent(evnt, column);
  16652. }
  16653. if (multiple && sortCols.length) {
  16654. const params = {
  16655. $table: $xeTable,
  16656. $event: evnt,
  16657. cols: sortCols,
  16658. sortList: []
  16659. };
  16660. $xeTable.dispatchEvent('clear-all-sort', params, evnt);
  16661. }
  16662. }
  16663. return $xeTable.$nextTick().then(() => {
  16664. updateRowOffsetTop($xeTable);
  16665. return updateStyle($xeTable);
  16666. });
  16667. },
  16668. // 在 v3 中废弃
  16669. getSortColumn() {
  16670. warnLog('vxe.error.delFunc', ['getSortColumn', 'getSortColumns']);
  16671. return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().find(this.tableFullColumn, column => (column.sortable || column.remoteSort) && column.order);
  16672. },
  16673. isSort(fieldOrColumn) {
  16674. if (fieldOrColumn) {
  16675. const column = handleFieldOrColumn(this, fieldOrColumn);
  16676. return column && column.sortable && !!column.order;
  16677. }
  16678. return this.getSortColumns().length > 0;
  16679. },
  16680. getSortColumns() {
  16681. const {
  16682. multiple,
  16683. chronological
  16684. } = this.sortOpts;
  16685. const sortList = [];
  16686. this.tableFullColumn.forEach(column => {
  16687. const {
  16688. field,
  16689. order
  16690. } = column;
  16691. if ((column.sortable || column.remoteSort) && order) {
  16692. sortList.push({
  16693. column,
  16694. field,
  16695. property: field,
  16696. order,
  16697. sortTime: column.sortTime
  16698. });
  16699. }
  16700. });
  16701. if (multiple && chronological && sortList.length > 1) {
  16702. return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().orderBy(sortList, 'sortTime');
  16703. }
  16704. return sortList;
  16705. },
  16706. setFilterByEvent(evnt, fieldOrColumn, options) {
  16707. const $xeTable = this;
  16708. const column = handleFieldOrColumn($xeTable, fieldOrColumn);
  16709. if (column && column.filters) {
  16710. column.filters = toFilters(options || [], column.id);
  16711. return $xeTable.handleColumnConfirmFilter(column, evnt);
  16712. }
  16713. return $xeTable.$nextTick();
  16714. },
  16715. /**
  16716. * 关闭筛选
  16717. * @param {Event} evnt 事件
  16718. */
  16719. closeFilter() {
  16720. const $xeTable = this;
  16721. const reactData = $xeTable;
  16722. const {
  16723. filterStore
  16724. } = reactData;
  16725. const {
  16726. column,
  16727. visible
  16728. } = filterStore;
  16729. filterStore.isAllSelected = false;
  16730. filterStore.isIndeterminate = false;
  16731. filterStore.visible = false;
  16732. if (visible) {
  16733. const field = column ? column.field : null;
  16734. $xeTable.dispatchEvent('filter-visible', {
  16735. column,
  16736. property: field,
  16737. field,
  16738. filterList: () => $xeTable.getCheckedFilters(),
  16739. visible: false
  16740. }, null);
  16741. }
  16742. return $xeTable.$nextTick();
  16743. },
  16744. /**
  16745. * 判断指定列是否为筛选状态,如果为空则判断所有列
  16746. * @param {String} fieldOrColumn 字段名
  16747. */
  16748. isActiveFilterByColumn(fieldOrColumn) {
  16749. const column = handleFieldOrColumn(this, fieldOrColumn);
  16750. if (column) {
  16751. return column.filters && column.filters.some(option => option.checked);
  16752. }
  16753. return this.getCheckedFilters().length > 0;
  16754. },
  16755. // 已废弃
  16756. isFilter(fieldOrColumn) {
  16757. return this.isActiveFilterByColumn(fieldOrColumn);
  16758. },
  16759. clearFilterByEvent(evnt, fieldOrColumn) {
  16760. const $xeTable = this;
  16761. const reactData = $xeTable;
  16762. const internalData = $xeTable;
  16763. const {
  16764. filterStore
  16765. } = reactData;
  16766. const {
  16767. tableFullColumn
  16768. } = internalData;
  16769. const filterOpts = $xeTable.computeFilterOpts;
  16770. const {
  16771. multiple
  16772. } = filterOpts;
  16773. const filterCols = [];
  16774. let column = null;
  16775. if (fieldOrColumn) {
  16776. column = handleFieldOrColumn($xeTable, fieldOrColumn);
  16777. if (column) {
  16778. $xeTable.handleClearFilter(column);
  16779. }
  16780. } else {
  16781. tableFullColumn.forEach(column => {
  16782. if (column.filters) {
  16783. filterCols.push(column);
  16784. $xeTable.handleClearFilter(column);
  16785. }
  16786. });
  16787. }
  16788. if (!fieldOrColumn || column !== filterStore.column) {
  16789. Object.assign(filterStore, {
  16790. isAllSelected: false,
  16791. isIndeterminate: false,
  16792. style: null,
  16793. options: [],
  16794. column: null,
  16795. multiple: false,
  16796. visible: false
  16797. });
  16798. }
  16799. if (!filterOpts.remote) {
  16800. $xeTable.updateData();
  16801. }
  16802. if (!multiple) {
  16803. column = filterCols[0];
  16804. }
  16805. if (column) {
  16806. const filterList = () => $xeTable.getCheckedFilters();
  16807. const values = [];
  16808. const datas = [];
  16809. column.filters.forEach(item => {
  16810. if (item.checked) {
  16811. values.push(item.value);
  16812. datas.push(item.data);
  16813. }
  16814. });
  16815. const params = {
  16816. $table: $xeTable,
  16817. $event: evnt,
  16818. column,
  16819. field: column.field,
  16820. property: column.field,
  16821. values,
  16822. datas,
  16823. filters: filterList,
  16824. filterList
  16825. };
  16826. $xeTable.dispatchEvent('filter-change', params, evnt);
  16827. $xeTable.dispatchEvent('clear-filter', params, evnt);
  16828. }
  16829. if (multiple && filterCols.length) {
  16830. const params = {
  16831. $table: $xeTable,
  16832. $event: evnt,
  16833. cols: filterCols,
  16834. filterList: []
  16835. };
  16836. $xeTable.dispatchEvent('clear-all-filter', params, evnt);
  16837. }
  16838. return $xeTable.$nextTick();
  16839. },
  16840. /**
  16841. * 判断展开行是否懒加载完成
  16842. * @param {Row} row 行对象
  16843. */
  16844. isRowExpandLoaded(row) {
  16845. const $xeTable = this;
  16846. const {
  16847. fullAllDataRowIdData
  16848. } = this;
  16849. const rowRest = fullAllDataRowIdData[getRowid($xeTable, row)];
  16850. return rowRest && !!rowRest.expandLoaded;
  16851. },
  16852. clearRowExpandLoaded(row) {
  16853. const $xeTable = this;
  16854. const reactData = $xeTable;
  16855. const internalData = $xeTable;
  16856. const {
  16857. fullAllDataRowIdData,
  16858. rowExpandLazyLoadedMaps
  16859. } = internalData;
  16860. const expandOpts = $xeTable.computeExpandOpts;
  16861. const {
  16862. lazy
  16863. } = expandOpts;
  16864. const rowid = getRowid($xeTable, row);
  16865. const rowRest = fullAllDataRowIdData[rowid];
  16866. if (lazy && rowRest) {
  16867. rowRest.expandLoaded = false;
  16868. delete rowExpandLazyLoadedMaps[rowid];
  16869. }
  16870. reactData.rowExpandedFlag++;
  16871. return $xeTable.$nextTick();
  16872. },
  16873. /**
  16874. * 重新懒加载展开行,并展开内容
  16875. * @param {Row} row 行对象
  16876. */
  16877. reloadRowExpand(row) {
  16878. const $xeTable = this;
  16879. const internalData = $xeTable;
  16880. const {
  16881. rowExpandLazyLoadedMaps
  16882. } = internalData;
  16883. const expandOpts = $xeTable.computeExpandOpts;
  16884. const {
  16885. lazy
  16886. } = expandOpts;
  16887. const rowid = getRowid(this, row);
  16888. if (lazy && !rowExpandLazyLoadedMaps[rowid]) {
  16889. $xeTable.clearRowExpandLoaded(row).then(() => handleAsyncRowExpand($xeTable, row));
  16890. }
  16891. return $xeTable.$nextTick();
  16892. },
  16893. reloadExpandContent(row) {
  16894. warnLog('vxe.error.delFunc', ['reloadExpandContent', 'reloadRowExpand']);
  16895. // 即将废弃
  16896. return this.reloadRowExpand(row);
  16897. },
  16898. /**
  16899. * 展开行事件
  16900. */
  16901. triggerRowExpandEvent(evnt, params) {
  16902. const $xeTable = this;
  16903. const reactData = $xeTable;
  16904. const internalData = $xeTable;
  16905. const {
  16906. expandColumn
  16907. } = reactData;
  16908. const {
  16909. rowExpandLazyLoadedMaps
  16910. } = internalData;
  16911. const expandOpts = $xeTable.computeExpandOpts;
  16912. const {
  16913. row
  16914. } = params;
  16915. const {
  16916. lazy,
  16917. trigger
  16918. } = expandOpts;
  16919. if (trigger === 'manual') {
  16920. return;
  16921. }
  16922. evnt.stopPropagation();
  16923. const rowid = getRowid($xeTable, row);
  16924. if (!lazy || !rowExpandLazyLoadedMaps[rowid]) {
  16925. const expanded = !$xeTable.isRowExpandByRow(row);
  16926. const columnIndex = expandColumn ? $xeTable.getColumnIndex(expandColumn) : -1;
  16927. const $columnIndex = expandColumn ? $xeTable.getVMColumnIndex(expandColumn) : -1;
  16928. $xeTable.setRowExpand(row, expanded);
  16929. $xeTable.dispatchEvent('toggle-row-expand', {
  16930. expanded,
  16931. column: expandColumn,
  16932. columnIndex,
  16933. $columnIndex,
  16934. row,
  16935. rowIndex: $xeTable.getRowIndex(row),
  16936. $rowIndex: $xeTable.getVMRowIndex(row)
  16937. }, evnt);
  16938. }
  16939. },
  16940. /**
  16941. * 切换展开行
  16942. */
  16943. toggleRowExpand(row) {
  16944. return this.setRowExpand(row, !this.isRowExpandByRow(row));
  16945. },
  16946. /**
  16947. * 设置所有行的展开与否
  16948. * @param {Boolean} expanded 是否展开
  16949. */
  16950. setAllRowExpand(expanded) {
  16951. const {
  16952. treeConfig,
  16953. treeOpts,
  16954. tableFullData,
  16955. tableFullTreeData
  16956. } = this;
  16957. const childrenField = treeOpts.children || treeOpts.childrenField;
  16958. let expandedRows = [];
  16959. if (treeConfig) {
  16960. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(tableFullTreeData, row => {
  16961. expandedRows.push(row);
  16962. }, {
  16963. children: childrenField
  16964. });
  16965. } else {
  16966. expandedRows = tableFullData;
  16967. }
  16968. return this.setRowExpand(expandedRows, expanded);
  16969. },
  16970. /**
  16971. * 设置展开行,二个参数设置这一行展开与否
  16972. * 支持单行
  16973. * 支持多行
  16974. * @param {Array/Row} rows 行数据
  16975. * @param {Boolean} expanded 是否展开
  16976. */
  16977. setRowExpand(rows, expanded) {
  16978. const $xeTable = this;
  16979. const reactData = $xeTable;
  16980. const internalData = $xeTable;
  16981. const {
  16982. expandColumn
  16983. } = reactData;
  16984. let {
  16985. fullAllDataRowIdData,
  16986. rowExpandedMaps,
  16987. rowExpandLazyLoadedMaps
  16988. } = internalData;
  16989. const {
  16990. handleGetRowId
  16991. } = createHandleGetRowId($xeTable);
  16992. const expandOpts = $xeTable.computeExpandOpts;
  16993. const {
  16994. reserve,
  16995. lazy,
  16996. accordion,
  16997. toggleMethod
  16998. } = expandOpts;
  16999. const lazyRests = [];
  17000. const columnIndex = expandColumn ? $xeTable.getColumnIndex(expandColumn) : -1;
  17001. const $columnIndex = expandColumn ? $xeTable.getVMColumnIndex(expandColumn) : -1;
  17002. if (rows) {
  17003. if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(rows)) {
  17004. rows = [rows];
  17005. }
  17006. if (accordion) {
  17007. // 只能同时展开一个
  17008. rowExpandedMaps = {};
  17009. internalData.rowExpandedMaps = rowExpandedMaps;
  17010. rows = rows.slice(rows.length - 1, rows.length);
  17011. }
  17012. const validRows = toggleMethod ? rows.filter(row => toggleMethod({
  17013. $table: $xeTable,
  17014. expanded,
  17015. column: expandColumn,
  17016. columnIndex,
  17017. $columnIndex,
  17018. row,
  17019. rowIndex: $xeTable.getRowIndex(row),
  17020. $rowIndex: $xeTable.getVMRowIndex(row)
  17021. })) : rows;
  17022. if (expanded) {
  17023. validRows.forEach(row => {
  17024. const rowid = handleGetRowId(row);
  17025. if (!rowExpandedMaps[rowid]) {
  17026. const rowRest = fullAllDataRowIdData[rowid];
  17027. const isLoad = lazy && !rowRest.expandLoaded && !rowExpandLazyLoadedMaps[rowid];
  17028. if (isLoad) {
  17029. lazyRests.push(handleAsyncRowExpand($xeTable, row));
  17030. } else {
  17031. rowExpandedMaps[rowid] = row;
  17032. }
  17033. }
  17034. });
  17035. } else {
  17036. validRows.forEach(item => {
  17037. const rowid = handleGetRowId(item);
  17038. if (rowExpandedMaps[rowid]) {
  17039. delete rowExpandedMaps[rowid];
  17040. }
  17041. });
  17042. }
  17043. if (reserve) {
  17044. validRows.forEach(row => handleRowExpandReserve($xeTable, row, expanded));
  17045. }
  17046. }
  17047. reactData.rowExpandedFlag++;
  17048. return Promise.all(lazyRests).then(() => $xeTable.$nextTick()).then(() => handleLazyRecalculate($xeTable, true, true, true)).then(() => {
  17049. updateRowOffsetTop($xeTable);
  17050. updateRowExpandStyle($xeTable);
  17051. handleRowExpandScroll($xeTable);
  17052. return $xeTable.updateCellAreas();
  17053. });
  17054. },
  17055. /**
  17056. * 判断行是否为展开状态
  17057. * @param {Row} row 行对象
  17058. */
  17059. isRowExpandByRow(row) {
  17060. const $xeTable = this;
  17061. const reactData = $xeTable;
  17062. const internalData = $xeTable;
  17063. const {
  17064. rowExpandedFlag
  17065. } = reactData;
  17066. const {
  17067. rowExpandedMaps
  17068. } = internalData;
  17069. const rowid = getRowid(this, row);
  17070. return !!rowExpandedFlag && !!rowExpandedMaps[rowid];
  17071. },
  17072. isExpandByRow(row) {
  17073. warnLog('vxe.error.delFunc', ['isExpandByRow', 'isRowExpandByRow']);
  17074. // 即将废弃
  17075. return this.isRowExpandByRow(row);
  17076. },
  17077. /**
  17078. * 手动清空展开行状态,数据会恢复成未展开的状态
  17079. */
  17080. clearRowExpand() {
  17081. const $xeTable = this;
  17082. const reactData = $xeTable;
  17083. const internalData = $xeTable;
  17084. const {
  17085. tableFullData,
  17086. scrollYStore
  17087. } = internalData;
  17088. const expandOpts = $xeTable.computeExpandOpts;
  17089. const {
  17090. reserve
  17091. } = expandOpts;
  17092. const expList = $xeTable.getRowExpandRecords();
  17093. internalData.rowExpandedMaps = {};
  17094. if (reserve) {
  17095. tableFullData.forEach(row => handleRowExpandReserve($xeTable, row, false));
  17096. }
  17097. reactData.rowExpandedFlag++;
  17098. scrollYStore.startIndex = 0;
  17099. scrollYStore.endIndex = 1;
  17100. return $xeTable.$nextTick().then(() => {
  17101. if (expList.length) {
  17102. return handleLazyRecalculate($xeTable, true, true, true);
  17103. }
  17104. }).then(() => {
  17105. updateRowOffsetTop($xeTable);
  17106. updateRowExpandStyle($xeTable);
  17107. handleRowExpandScroll($xeTable);
  17108. return $xeTable.updateCellAreas();
  17109. });
  17110. },
  17111. clearRowExpandReserve() {
  17112. this.rowExpandedReserveRowMap = {};
  17113. return this.$nextTick();
  17114. },
  17115. getRowExpandRecords() {
  17116. const $xeTable = this;
  17117. const internalData = $xeTable;
  17118. const rest = [];
  17119. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(internalData.rowExpandedMaps, item => {
  17120. if (item) {
  17121. rest.push(item);
  17122. }
  17123. });
  17124. return rest;
  17125. },
  17126. setRowGroups(fieldOrColumns) {
  17127. const $xeTable = this;
  17128. const props = $xeTable;
  17129. const internalData = $xeTable;
  17130. const {
  17131. aggregateConfig,
  17132. rowGroupConfig
  17133. } = props;
  17134. const aggregateOpts = $xeTable.computeAggregateOpts;
  17135. const {
  17136. maxGroupSize
  17137. } = aggregateOpts;
  17138. if (!(aggregateConfig || rowGroupConfig)) {
  17139. errLog('vxe.error.reqProp', ['aggregate-config']);
  17140. return $xeTable.$nextTick();
  17141. }
  17142. const confList = fieldOrColumns ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(fieldOrColumns) ? fieldOrColumns : [fieldOrColumns] : [];
  17143. if (maxGroupSize && confList.length > maxGroupSize) {
  17144. if (core_.VxeUI.modal) {
  17145. core_.VxeUI.modal.message({
  17146. status: 'error',
  17147. content: methods_getI18n('vxe.table.maxGroupCol', [maxGroupSize])
  17148. });
  17149. }
  17150. return $xeTable.$nextTick();
  17151. }
  17152. if (confList.length) {
  17153. handleUpdateRowGroup($xeTable, confList.map(fieldOrColumn => {
  17154. return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(fieldOrColumn) ? fieldOrColumn : fieldOrColumn.field;
  17155. }));
  17156. return loadTableData($xeTable, internalData.tableSynchData, true);
  17157. }
  17158. return $xeTable.$nextTick();
  17159. },
  17160. getRowGroups() {
  17161. const $xeTable = this;
  17162. const props = $xeTable;
  17163. const reactData = $xeTable;
  17164. const internalData = $xeTable;
  17165. const {
  17166. aggregateConfig,
  17167. rowGroupConfig
  17168. } = props;
  17169. const {
  17170. fullColumnFieldData
  17171. } = internalData;
  17172. if (aggregateConfig || rowGroupConfig) {
  17173. const {
  17174. rowGroupList
  17175. } = reactData;
  17176. return rowGroupList.map(({
  17177. field
  17178. }) => {
  17179. const colRet = fullColumnFieldData[field];
  17180. if (colRet) {
  17181. return colRet.column;
  17182. }
  17183. return {
  17184. field
  17185. };
  17186. });
  17187. }
  17188. return [];
  17189. },
  17190. getRowGroupFields() {
  17191. const $xeTable = this;
  17192. return $xeTable.getRowGroups().map(item => item.field);
  17193. },
  17194. clearRowGroups() {
  17195. const $xeTable = this;
  17196. const props = $xeTable;
  17197. const internalData = $xeTable;
  17198. const {
  17199. aggregateConfig,
  17200. rowGroupConfig
  17201. } = props;
  17202. if (!(aggregateConfig || rowGroupConfig)) {
  17203. errLog('vxe.error.reqProp', ['aggregate-config']);
  17204. return $xeTable.$nextTick();
  17205. }
  17206. handleUpdateRowGroup($xeTable, []);
  17207. return loadTableData($xeTable, internalData.tableSynchData, true);
  17208. },
  17209. isRowGroupRecord(row) {
  17210. const $xeTable = this;
  17211. warnLog('vxe.error.delFunc', ['isRowGroupRecord', 'isAggregateRecord']);
  17212. return $xeTable.isAggregateRecord(row);
  17213. },
  17214. isRowGroupExpandByRow(row) {
  17215. const $xeTable = this;
  17216. warnLog('vxe.error.delFunc', ['isRowGroupExpandByRow', 'isAggregateExpandByRow']);
  17217. return $xeTable.isAggregateExpandByRow(row);
  17218. },
  17219. isAggregateRecord(row) {
  17220. const $xeTable = this;
  17221. const reactData = $xeTable;
  17222. const {
  17223. isRowGroupStatus
  17224. } = reactData;
  17225. return isRowGroupStatus && row.isAggregate;
  17226. },
  17227. getAggregateContentByRow(row) {
  17228. const $xeTable = this;
  17229. const reactData = $xeTable;
  17230. const {
  17231. isRowGroupStatus
  17232. } = reactData;
  17233. return isRowGroupStatus && row && row.isAggregate ? row.groupContent : '';
  17234. },
  17235. getAggregateRowChildren(row) {
  17236. const $xeTable = this;
  17237. const reactData = $xeTable;
  17238. const aggregateOpts = $xeTable.computeAggregateOpts;
  17239. const {
  17240. childrenField,
  17241. mapChildrenField
  17242. } = aggregateOpts;
  17243. const {
  17244. isRowGroupStatus
  17245. } = reactData;
  17246. return isRowGroupStatus && row && row.isAggregate && childrenField && mapChildrenField ? row[mapChildrenField] || [] : [];
  17247. },
  17248. isAggregateExpandByRow(row) {
  17249. const $xeTable = this;
  17250. const reactData = $xeTable;
  17251. const internalData = $xeTable;
  17252. const {
  17253. rowGroupExpandedFlag
  17254. } = reactData;
  17255. const {
  17256. rowGroupExpandedMaps
  17257. } = internalData;
  17258. return !!rowGroupExpandedFlag && !!rowGroupExpandedMaps[getRowid($xeTable, row)];
  17259. },
  17260. setRowGroupExpand(rows, expanded) {
  17261. const $xeTable = this;
  17262. if (rows) {
  17263. if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(rows)) {
  17264. rows = [rows];
  17265. }
  17266. return handleRowGroupVirtualExpand($xeTable, rows, expanded);
  17267. }
  17268. return $xeTable.$nextTick();
  17269. },
  17270. setRowGroupExpandByField(groupFields, expanded) {
  17271. const $xeTable = this;
  17272. const reactData = $xeTable;
  17273. const internalData = $xeTable;
  17274. const {
  17275. isRowGroupStatus
  17276. } = reactData;
  17277. const aggregateOpts = $xeTable.computeAggregateOpts;
  17278. const {
  17279. childrenField
  17280. } = aggregateOpts;
  17281. if (groupFields) {
  17282. if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(groupFields)) {
  17283. groupFields = [groupFields];
  17284. }
  17285. if (isRowGroupStatus) {
  17286. const rows = [];
  17287. const gfKeys = {};
  17288. groupFields.forEach(groupField => {
  17289. gfKeys[groupField] = true;
  17290. });
  17291. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(internalData.afterGroupFullData, row => {
  17292. if (row.isAggregate && gfKeys[row.groupField]) {
  17293. rows.push(row);
  17294. }
  17295. }, {
  17296. children: childrenField
  17297. });
  17298. if (rows.length) {
  17299. return handleRowGroupVirtualExpand($xeTable, rows, expanded);
  17300. }
  17301. }
  17302. }
  17303. return $xeTable.$nextTick();
  17304. },
  17305. setAllRowGroupExpand(expanded) {
  17306. const $xeTable = this;
  17307. const reactData = $xeTable;
  17308. const internalData = $xeTable;
  17309. const {
  17310. tableFullGroupData
  17311. } = internalData;
  17312. const aggregateOpts = $xeTable.computeAggregateOpts;
  17313. const {
  17314. mapChildrenField
  17315. } = aggregateOpts;
  17316. const rgExpandedMaps = {};
  17317. if (expanded && mapChildrenField) {
  17318. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(tableFullGroupData, row => {
  17319. if (row[mapChildrenField] && row[mapChildrenField].length) {
  17320. rgExpandedMaps[getRowid($xeTable, row)] = row;
  17321. }
  17322. }, {
  17323. children: mapChildrenField
  17324. });
  17325. }
  17326. internalData.rowGroupExpandedMaps = rgExpandedMaps;
  17327. handleVirtualTreeToList($xeTable);
  17328. $xeTable.handleTableData();
  17329. updateAfterDataIndex($xeTable);
  17330. reactData.rowGroupExpandedFlag++;
  17331. return handleLazyRecalculate($xeTable, true, true, true);
  17332. },
  17333. clearRowGroupExpand() {
  17334. const $xeTable = this;
  17335. const reactData = $xeTable;
  17336. const internalData = $xeTable;
  17337. internalData.rowGroupExpandedMaps = {};
  17338. handleVirtualTreeToList($xeTable);
  17339. $xeTable.handleTableData();
  17340. updateAfterDataIndex($xeTable);
  17341. reactData.rowGroupExpandedFlag++;
  17342. return handleLazyRecalculate($xeTable, true, true, true);
  17343. },
  17344. getTreeExpandRecords() {
  17345. const $xeTable = this;
  17346. const internalData = $xeTable;
  17347. const rest = [];
  17348. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(internalData.treeExpandedMaps, item => {
  17349. if (item) {
  17350. rest.push(item);
  17351. }
  17352. });
  17353. return rest;
  17354. },
  17355. /**
  17356. * 内部方法、获取树表格状态
  17357. * @deprecated
  17358. * @private
  17359. */
  17360. getTreeStatus() {
  17361. if (this.treeConfig) {
  17362. return {
  17363. config: this.treeOpts,
  17364. rowExpandeds: this.getTreeExpandRecords()
  17365. };
  17366. }
  17367. return null;
  17368. },
  17369. /**
  17370. * 判断树节点是否懒加载完成
  17371. * @param {Row} row 行对象
  17372. */
  17373. isTreeExpandLoaded(row) {
  17374. const $xeTable = this;
  17375. const {
  17376. fullAllDataRowIdData
  17377. } = this;
  17378. const rowRest = fullAllDataRowIdData[getRowid($xeTable, row)];
  17379. return rowRest && !!rowRest.treeLoaded;
  17380. },
  17381. clearTreeExpandLoaded(rows) {
  17382. const $xeTable = this;
  17383. const reactData = $xeTable;
  17384. const internalData = $xeTable;
  17385. const {
  17386. fullAllDataRowIdData,
  17387. treeExpandedMaps
  17388. } = internalData;
  17389. const treeOpts = $xeTable.computeTreeOpts;
  17390. const {
  17391. transform
  17392. } = treeOpts;
  17393. if (rows) {
  17394. if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(rows)) {
  17395. rows = [rows];
  17396. }
  17397. rows.forEach(row => {
  17398. const rowid = getRowid($xeTable, row);
  17399. const rowRest = fullAllDataRowIdData[rowid];
  17400. if (rowRest) {
  17401. rowRest.treeLoaded = false;
  17402. if (treeExpandedMaps[rowid]) {
  17403. delete treeExpandedMaps[rowid];
  17404. }
  17405. }
  17406. });
  17407. } else {
  17408. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(fullAllDataRowIdData, rowRest => {
  17409. rowRest.treeLoaded = false;
  17410. });
  17411. }
  17412. internalData.treeExpandedMaps = {};
  17413. if (transform) {
  17414. handleVirtualTreeToList($xeTable);
  17415. $xeTable.handleTableData();
  17416. }
  17417. reactData.treeExpandedFlag++;
  17418. return $xeTable.$nextTick();
  17419. },
  17420. /**
  17421. * 重新懒加载树节点,并展开该节点
  17422. * @param {Row} row 行对象
  17423. */
  17424. reloadTreeExpand(row) {
  17425. const $xeTable = this;
  17426. const reactData = $xeTable;
  17427. const internalData = $xeTable;
  17428. const {
  17429. treeExpandLazyLoadedMaps
  17430. } = internalData;
  17431. const treeOpts = $xeTable.computeTreeOpts;
  17432. const {
  17433. transform,
  17434. lazy
  17435. } = treeOpts;
  17436. const hasChildField = treeOpts.hasChild || treeOpts.hasChildField;
  17437. const rowid = getRowid($xeTable, row);
  17438. if (lazy && row[hasChildField] && !treeExpandLazyLoadedMaps[rowid]) {
  17439. return $xeTable.clearTreeExpandLoaded(row).then(() => {
  17440. return handleAsyncTreeExpandChilds($xeTable, row);
  17441. }).then(() => {
  17442. if (transform) {
  17443. handleVirtualTreeToList($xeTable);
  17444. $xeTable.handleTableData();
  17445. }
  17446. reactData.treeExpandedFlag++;
  17447. }).then(() => {
  17448. return $xeTable.recalculate();
  17449. });
  17450. }
  17451. return $xeTable.$nextTick();
  17452. },
  17453. reloadTreeChilds(row) {
  17454. const $xeTable = this;
  17455. warnLog('vxe.error.delFunc', ['reloadTreeChilds', 'reloadTreeExpand']);
  17456. // 即将废弃
  17457. return $xeTable.reloadTreeExpand(row);
  17458. },
  17459. /**
  17460. * 行分组事件
  17461. */
  17462. triggerRowGroupExpandEvent(evnt, params) {
  17463. const $xeTable = this;
  17464. const internalData = $xeTable;
  17465. const {
  17466. rowGroupExpandedMaps
  17467. } = internalData;
  17468. const aggregateOpts = $xeTable.computeAggregateOpts;
  17469. const {
  17470. row,
  17471. column
  17472. } = params;
  17473. const {
  17474. trigger
  17475. } = aggregateOpts;
  17476. if (trigger === 'manual') {
  17477. return;
  17478. }
  17479. evnt.stopPropagation();
  17480. const rowid = getRowid($xeTable, row);
  17481. const expanded = !rowGroupExpandedMaps[rowid];
  17482. const columnIndex = $xeTable.getColumnIndex(column);
  17483. const $columnIndex = $xeTable.getVMColumnIndex(column);
  17484. $xeTable.setRowGroupExpand(row, expanded);
  17485. $xeTable.dispatchEvent('toggle-row-group-expand', {
  17486. expanded,
  17487. column,
  17488. columnIndex,
  17489. $columnIndex,
  17490. row
  17491. }, evnt);
  17492. },
  17493. /**
  17494. * 展开树节点事件
  17495. */
  17496. triggerTreeExpandEvent(evnt, params) {
  17497. const $xeTable = this;
  17498. const internalData = $xeTable;
  17499. const {
  17500. treeExpandLazyLoadedMaps,
  17501. treeEATime
  17502. } = internalData;
  17503. const treeOpts = $xeTable.computeTreeOpts;
  17504. const {
  17505. row,
  17506. column
  17507. } = params;
  17508. const {
  17509. lazy,
  17510. trigger,
  17511. accordion
  17512. } = treeOpts;
  17513. if (trigger === 'manual') {
  17514. return;
  17515. }
  17516. evnt.stopPropagation();
  17517. const rowid = getRowid(this, row);
  17518. if (!lazy || !treeExpandLazyLoadedMaps[rowid]) {
  17519. const expanded = !$xeTable.isTreeExpandByRow(row);
  17520. const columnIndex = $xeTable.getColumnIndex(column);
  17521. const $columnIndex = $xeTable.getVMColumnIndex(column);
  17522. if (treeEATime) {
  17523. clearTimeout(treeEATime);
  17524. }
  17525. $xeTable.setTreeExpand(row, expanded).then(() => {
  17526. if (accordion) {
  17527. internalData.treeEATime = setTimeout(() => {
  17528. internalData.treeEATime = undefined;
  17529. $xeTable.scrollToRow(row);
  17530. }, 30);
  17531. }
  17532. });
  17533. $xeTable.dispatchEvent('toggle-tree-expand', {
  17534. expanded,
  17535. column,
  17536. columnIndex,
  17537. $columnIndex,
  17538. row
  17539. }, evnt);
  17540. }
  17541. },
  17542. /**
  17543. * 切换/展开树节点
  17544. */
  17545. toggleTreeExpand(row) {
  17546. return this.setTreeExpand(row, !this.isTreeExpandByRow(row));
  17547. },
  17548. /**
  17549. * 设置所有树节点的展开与否
  17550. * @param {Boolean} expanded 是否展开
  17551. */
  17552. setAllTreeExpand(expanded) {
  17553. const $xeTable = this;
  17554. const reactData = $xeTable;
  17555. const internalData = $xeTable;
  17556. const {
  17557. tableFullData
  17558. } = internalData;
  17559. const treeOpts = $xeTable.computeTreeOpts;
  17560. const {
  17561. transform,
  17562. lazy
  17563. } = treeOpts;
  17564. const childrenField = treeOpts.children || treeOpts.childrenField;
  17565. const expandeds = [];
  17566. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(tableFullData, row => {
  17567. const rowChildren = row[childrenField];
  17568. if (lazy || rowChildren && rowChildren.length) {
  17569. expandeds.push(row);
  17570. }
  17571. }, {
  17572. children: childrenField
  17573. });
  17574. return $xeTable.setTreeExpand(expandeds, expanded).then(() => {
  17575. if (transform) {
  17576. handleVirtualTreeToList($xeTable);
  17577. reactData.treeExpandedFlag++;
  17578. return $xeTable.recalculate();
  17579. }
  17580. });
  17581. },
  17582. /**
  17583. * 设置展开树形节点,二个参数设置这一行展开与否
  17584. * 支持单行
  17585. * 支持多行
  17586. * @param {Array/Row} rows 行数据
  17587. * @param {Boolean} expanded 是否展开
  17588. */
  17589. setTreeExpand(rows, expanded) {
  17590. const $xeTable = this;
  17591. const {
  17592. treeOpts
  17593. } = this;
  17594. const {
  17595. transform
  17596. } = treeOpts;
  17597. if (rows) {
  17598. if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(rows)) {
  17599. rows = [rows];
  17600. }
  17601. if (rows.length) {
  17602. // 如果为虚拟树
  17603. if (transform) {
  17604. return handleVirtualTreeExpand($xeTable, rows, expanded);
  17605. } else {
  17606. return handleBaseTreeExpand($xeTable, rows, expanded);
  17607. }
  17608. }
  17609. }
  17610. return this.$nextTick();
  17611. },
  17612. /**
  17613. * 判断行是否为树形节点展开状态
  17614. * @param {Row} row 行对象
  17615. */
  17616. isTreeExpandByRow(row) {
  17617. const $xeTable = this;
  17618. const reactData = $xeTable;
  17619. const internalData = $xeTable;
  17620. const {
  17621. treeExpandedFlag
  17622. } = reactData;
  17623. const {
  17624. treeExpandedMaps
  17625. } = internalData;
  17626. return !!treeExpandedFlag && !!treeExpandedMaps[getRowid($xeTable, row)];
  17627. },
  17628. /**
  17629. * 手动清空树形节点的展开状态,数据会恢复成未展开的状态
  17630. */
  17631. clearTreeExpand() {
  17632. const $xeTable = this;
  17633. const reactData = $xeTable;
  17634. const internalData = $xeTable;
  17635. const {
  17636. tableFullTreeData
  17637. } = internalData;
  17638. const treeOpts = $xeTable.computeTreeOpts;
  17639. const childrenField = treeOpts.children || treeOpts.childrenField;
  17640. const {
  17641. transform,
  17642. reserve
  17643. } = treeOpts;
  17644. const expList = $xeTable.getTreeExpandRecords();
  17645. internalData.treeExpandedMaps = {};
  17646. if (reserve) {
  17647. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(tableFullTreeData, row => handleTreeExpandReserve($xeTable, row, false), {
  17648. children: childrenField
  17649. });
  17650. }
  17651. return $xeTable.handleTableData().then(() => {
  17652. if (transform) {
  17653. handleVirtualTreeToList($xeTable);
  17654. $xeTable.handleTableData();
  17655. }
  17656. reactData.treeExpandedFlag++;
  17657. }).then(() => {
  17658. if (expList.length) {
  17659. $xeTable.recalculate();
  17660. }
  17661. });
  17662. },
  17663. clearTreeExpandReserve() {
  17664. this.treeExpandedReserveRowMap = {};
  17665. return this.$nextTick();
  17666. },
  17667. /**
  17668. * 获取表格的滚动状态
  17669. */
  17670. getScroll() {
  17671. const $xeTable = this;
  17672. return $xeTable.getScrollData();
  17673. },
  17674. /**
  17675. * 获取表格的滚动数据
  17676. */
  17677. getScrollData() {
  17678. const $xeTable = this;
  17679. const reactData = $xeTable;
  17680. const internalData = $xeTable;
  17681. const {
  17682. scrollXLoad,
  17683. scrollYLoad,
  17684. scrollbarHeight,
  17685. scrollbarWidth
  17686. } = reactData;
  17687. const {
  17688. elemStore
  17689. } = internalData;
  17690. const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
  17691. const scrollTop = bodyScrollElem ? bodyScrollElem.scrollTop : 0;
  17692. const scrollLeft = bodyScrollElem ? bodyScrollElem.scrollLeft : 0;
  17693. const clientHeight = bodyScrollElem ? bodyScrollElem.clientHeight : 0;
  17694. const clientWidth = bodyScrollElem ? bodyScrollElem.clientWidth : 0;
  17695. const scrollHeight = bodyScrollElem ? bodyScrollElem.scrollHeight : 0;
  17696. const scrollWidth = bodyScrollElem ? bodyScrollElem.scrollWidth : 0;
  17697. const isTop = scrollTop <= 0;
  17698. const isBottom = scrollTop + clientHeight >= scrollHeight;
  17699. const isLeft = scrollLeft <= 0;
  17700. const isRight = scrollLeft + clientWidth >= scrollWidth;
  17701. return {
  17702. virtualX: scrollXLoad,
  17703. virtualY: scrollYLoad,
  17704. isTop,
  17705. isBottom,
  17706. isLeft,
  17707. isRight,
  17708. scrollbarHeight,
  17709. scrollbarWidth,
  17710. scrollTop,
  17711. scrollLeft,
  17712. scrollHeight,
  17713. scrollWidth,
  17714. clientHeight,
  17715. clientWidth
  17716. };
  17717. },
  17718. handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, params) {
  17719. const $xeTable = this;
  17720. const props = $xeTable;
  17721. const reactData = $xeTable;
  17722. const internalData = $xeTable;
  17723. const {
  17724. highlightHoverRow
  17725. } = props;
  17726. const {
  17727. lastScrollLeft,
  17728. lastScrollTop
  17729. } = internalData;
  17730. const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
  17731. const yHandleEl = $xeTable.$refs.refScrollYHandleElem;
  17732. if (!xHandleEl || !yHandleEl) {
  17733. return;
  17734. }
  17735. const rowOpts = $xeTable.computeRowOpts;
  17736. const validTip = $xeTable.$refs.refValidTooltip;
  17737. const tooltip = $xeTable.$refs.refTooltip;
  17738. const bodyHeight = yHandleEl.clientHeight;
  17739. const bodyWidth = xHandleEl.clientWidth;
  17740. const scrollHeight = yHandleEl.scrollHeight;
  17741. const scrollWidth = xHandleEl.scrollWidth;
  17742. let isTop = false;
  17743. let isBottom = false;
  17744. let isLeft = false;
  17745. let isRight = false;
  17746. let direction = '';
  17747. let isTopBoundary = false;
  17748. let isBottomBoundary = false;
  17749. let isLeftBoundary = false;
  17750. let isRightBoundary = false;
  17751. if (isRollX) {
  17752. const xThreshold = $xeTable.computeScrollXThreshold;
  17753. isLeft = scrollLeft <= 0;
  17754. if (!isLeft) {
  17755. isRight = scrollLeft + bodyWidth >= scrollWidth - 1;
  17756. }
  17757. if (scrollLeft > lastScrollLeft) {
  17758. direction = 'right';
  17759. if (scrollLeft + bodyWidth >= scrollWidth - xThreshold) {
  17760. isRightBoundary = true;
  17761. }
  17762. } else {
  17763. direction = 'left';
  17764. if (scrollLeft <= xThreshold) {
  17765. isLeftBoundary = true;
  17766. }
  17767. }
  17768. $xeTable.checkScrolling();
  17769. internalData.lastScrollLeft = scrollLeft;
  17770. }
  17771. if (isRollY) {
  17772. const yThreshold = $xeTable.computeScrollYThreshold;
  17773. isTop = scrollTop <= 0;
  17774. if (!isTop) {
  17775. isBottom = scrollTop + bodyHeight >= scrollHeight - 1;
  17776. }
  17777. if (scrollTop > lastScrollTop) {
  17778. direction = 'bottom';
  17779. if (scrollTop + bodyHeight >= scrollHeight - yThreshold) {
  17780. isBottomBoundary = true;
  17781. }
  17782. } else {
  17783. direction = 'top';
  17784. if (scrollTop <= yThreshold) {
  17785. isTopBoundary = true;
  17786. }
  17787. }
  17788. internalData.lastScrollTop = scrollTop;
  17789. }
  17790. reactData.lastScrollTime = Date.now();
  17791. const evntParams = {
  17792. scrollTop,
  17793. scrollLeft,
  17794. bodyHeight,
  17795. bodyWidth,
  17796. scrollHeight,
  17797. scrollWidth,
  17798. isX: isRollX,
  17799. isY: isRollY,
  17800. isTop,
  17801. isBottom,
  17802. isLeft,
  17803. isRight,
  17804. direction,
  17805. ...params
  17806. };
  17807. updateRowExpandStyle($xeTable);
  17808. checkLastSyncScroll($xeTable, isRollX, isRollY);
  17809. if (isRollX) {
  17810. $xeTable.closeFilter();
  17811. }
  17812. if (rowOpts.isHover || highlightHoverRow) {
  17813. $xeTable.clearHoverRow();
  17814. }
  17815. if (validTip && validTip.reactData.visible) {
  17816. validTip.close();
  17817. }
  17818. if (tooltip && tooltip.reactData.visible) {
  17819. tooltip.close();
  17820. }
  17821. if (isBottomBoundary || isTopBoundary || isRightBoundary || isLeftBoundary) {
  17822. $xeTable.dispatchEvent('scroll-boundary', evntParams, evnt);
  17823. }
  17824. $xeTable.dispatchEvent('scroll', evntParams, evnt);
  17825. },
  17826. /**
  17827. * 横向 X 可视渲染事件处理
  17828. */
  17829. triggerScrollXEvent() {
  17830. const $xeTable = this;
  17831. const virtualXOpts = $xeTable.computeVirtualXOpts;
  17832. if (virtualXOpts.immediate) {
  17833. loadScrollXData($xeTable);
  17834. } else {
  17835. lazyScrollXData($xeTable);
  17836. }
  17837. },
  17838. /**
  17839. * 纵向 Y 可视渲染事件处理
  17840. */
  17841. triggerScrollYEvent() {
  17842. const $xeTable = this;
  17843. const virtualYOpts = $xeTable.computeVirtualYOpts;
  17844. if (virtualYOpts.immediate) {
  17845. loadScrollYData($xeTable);
  17846. } else {
  17847. lazyScrollYData($xeTable);
  17848. }
  17849. },
  17850. triggerBodyScrollEvent(evnt, fixedType) {
  17851. const $xeTable = this;
  17852. const reactData = $xeTable;
  17853. const internalData = $xeTable;
  17854. const {
  17855. scrollYLoad,
  17856. scrollXLoad
  17857. } = reactData;
  17858. const {
  17859. elemStore,
  17860. intoRunScroll,
  17861. lastScrollTop,
  17862. lastScrollLeft,
  17863. inWheelScroll,
  17864. inVirtualScroll,
  17865. inHeaderScroll,
  17866. inBodyScroll,
  17867. scrollRenderType,
  17868. inFooterScroll
  17869. } = internalData;
  17870. if (inWheelScroll || inVirtualScroll || inHeaderScroll || inFooterScroll) {
  17871. return;
  17872. }
  17873. const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
  17874. const yHandleEl = $xeTable.$refs.refScrollYHandleElem;
  17875. const leftScrollElem = getRefElem(elemStore['left-body-scroll']);
  17876. const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
  17877. const rightScrollElem = getRefElem(elemStore['right-body-scroll']);
  17878. const headerScrollElem = getRefElem(elemStore['main-header-scroll']);
  17879. const footerScrollElem = getRefElem(elemStore['main-footer-scroll']);
  17880. const rowExpandEl = $xeTable.$refs.refRowExpandElem;
  17881. if (intoRunScroll) {
  17882. return;
  17883. }
  17884. if (!bodyScrollElem) {
  17885. return;
  17886. }
  17887. if (!xHandleEl) {
  17888. return;
  17889. }
  17890. if (!yHandleEl) {
  17891. return;
  17892. }
  17893. if (inBodyScroll) {
  17894. if (scrollRenderType !== fixedType) {
  17895. return;
  17896. }
  17897. }
  17898. let scrollTop = yHandleEl.scrollTop;
  17899. let scrollLeft = xHandleEl.scrollLeft;
  17900. if (leftScrollElem && fixedType === 'left') {
  17901. scrollTop = leftScrollElem.scrollTop;
  17902. } else if (rightScrollElem && fixedType === 'right') {
  17903. scrollTop = rightScrollElem.scrollTop;
  17904. } else {
  17905. scrollTop = bodyScrollElem.scrollTop;
  17906. scrollLeft = bodyScrollElem.scrollLeft;
  17907. }
  17908. const isRollX = scrollLeft !== lastScrollLeft;
  17909. const isRollY = scrollTop !== lastScrollTop;
  17910. internalData.inBodyScroll = true;
  17911. internalData.scrollRenderType = fixedType;
  17912. if (isRollY) {
  17913. if (fixedType === 'left') {
  17914. setScrollTop(bodyScrollElem, scrollTop);
  17915. setScrollTop(rightScrollElem, scrollTop);
  17916. } else if (fixedType === 'right') {
  17917. setScrollTop(bodyScrollElem, scrollTop);
  17918. setScrollTop(leftScrollElem, scrollTop);
  17919. } else {
  17920. setScrollTop(leftScrollElem, scrollTop);
  17921. setScrollTop(rightScrollElem, scrollTop);
  17922. }
  17923. setScrollTop(yHandleEl, scrollTop);
  17924. setScrollTop(rowExpandEl, scrollTop);
  17925. syncGanttScrollTop($xeTable, scrollTop);
  17926. if (scrollYLoad) {
  17927. $xeTable.triggerScrollYEvent(evnt);
  17928. }
  17929. }
  17930. if (isRollX) {
  17931. setScrollLeft(xHandleEl, scrollLeft);
  17932. setScrollLeft(headerScrollElem, scrollLeft);
  17933. setScrollLeft(footerScrollElem, scrollLeft);
  17934. if (scrollXLoad) {
  17935. $xeTable.triggerScrollXEvent(evnt);
  17936. }
  17937. }
  17938. $xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
  17939. type: 'body',
  17940. fixed: fixedType
  17941. });
  17942. },
  17943. triggerHeaderScrollEvent(evnt, fixedType) {
  17944. const $xeTable = this;
  17945. const reactData = $xeTable;
  17946. const internalData = $xeTable;
  17947. const {
  17948. scrollXLoad
  17949. } = reactData;
  17950. const {
  17951. elemStore,
  17952. intoRunScroll,
  17953. inWheelScroll,
  17954. inVirtualScroll,
  17955. inBodyScroll,
  17956. inFooterScroll
  17957. } = internalData;
  17958. if (inWheelScroll || inVirtualScroll || inBodyScroll || inFooterScroll) {
  17959. return;
  17960. }
  17961. if (intoRunScroll) {
  17962. return;
  17963. }
  17964. const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
  17965. const yHandleEl = $xeTable.$refs.refScrollYHandleElem;
  17966. const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
  17967. const headerScrollElem = getRefElem(elemStore['main-header-scroll']);
  17968. const footerScrollElem = getRefElem(elemStore['main-footer-scroll']);
  17969. if (!headerScrollElem) {
  17970. return;
  17971. }
  17972. if (!xHandleEl) {
  17973. return;
  17974. }
  17975. if (!yHandleEl) {
  17976. return;
  17977. }
  17978. const scrollTop = yHandleEl.scrollTop;
  17979. const scrollLeft = headerScrollElem.scrollLeft;
  17980. const isRollX = true;
  17981. const isRollY = false;
  17982. internalData.inHeaderScroll = true;
  17983. setScrollLeft(xHandleEl, scrollLeft);
  17984. setScrollLeft(footerScrollElem, scrollLeft);
  17985. setScrollLeft(bodyScrollElem, scrollLeft);
  17986. if (scrollXLoad) {
  17987. $xeTable.triggerScrollXEvent(evnt);
  17988. }
  17989. $xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
  17990. type: 'header',
  17991. fixed: fixedType
  17992. });
  17993. },
  17994. triggerFooterScrollEvent(evnt, fixedType) {
  17995. const $xeTable = this;
  17996. const reactData = $xeTable;
  17997. const internalData = $xeTable;
  17998. const {
  17999. scrollXLoad
  18000. } = reactData;
  18001. const {
  18002. elemStore,
  18003. intoRunScroll,
  18004. inWheelScroll,
  18005. inVirtualScroll,
  18006. inHeaderScroll,
  18007. inBodyScroll
  18008. } = internalData;
  18009. if (inWheelScroll || inVirtualScroll || inHeaderScroll || inBodyScroll) {
  18010. return;
  18011. }
  18012. const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
  18013. const yHandleEl = $xeTable.$refs.refScrollYHandleElem;
  18014. const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
  18015. const headerScrollElem = getRefElem(elemStore['main-header-scroll']);
  18016. const footerScrollElem = getRefElem(elemStore['main-footer-scroll']);
  18017. if (intoRunScroll) {
  18018. return;
  18019. }
  18020. if (!footerScrollElem) {
  18021. return;
  18022. }
  18023. if (!xHandleEl) {
  18024. return;
  18025. }
  18026. if (!yHandleEl) {
  18027. return;
  18028. }
  18029. const scrollTop = yHandleEl.scrollTop;
  18030. const scrollLeft = footerScrollElem.scrollLeft;
  18031. const isRollX = true;
  18032. const isRollY = false;
  18033. internalData.inFooterScroll = true;
  18034. setScrollLeft(xHandleEl, scrollLeft);
  18035. setScrollLeft(headerScrollElem, scrollLeft);
  18036. setScrollLeft(bodyScrollElem, scrollLeft);
  18037. if (scrollXLoad) {
  18038. $xeTable.triggerScrollXEvent(evnt);
  18039. }
  18040. $xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
  18041. type: 'footer',
  18042. fixed: fixedType
  18043. });
  18044. },
  18045. triggerBodyWheelEvent(evnt) {
  18046. const $xeTable = this;
  18047. const tableProps = $xeTable;
  18048. const reactData = $xeTable;
  18049. const internalData = $xeTable;
  18050. const {
  18051. target,
  18052. deltaY,
  18053. deltaX,
  18054. shiftKey
  18055. } = evnt;
  18056. if (target && /^textarea$/i.test(target.tagName)) {
  18057. return;
  18058. }
  18059. // 如果滚轮未移动或者触摸板未变化位置
  18060. if (!deltaY && !deltaX) {
  18061. return;
  18062. }
  18063. const {
  18064. highlightHoverRow
  18065. } = tableProps;
  18066. const {
  18067. scrollXLoad,
  18068. scrollYLoad,
  18069. expandColumn
  18070. } = reactData;
  18071. const leftFixedWidth = $xeTable.computeLeftFixedWidth;
  18072. const rightFixedWidth = $xeTable.computeRightFixedWidth;
  18073. const {
  18074. elemStore,
  18075. lastScrollTop,
  18076. lastScrollLeft
  18077. } = internalData;
  18078. const rowOpts = $xeTable.computeRowOpts;
  18079. const scrollbarXOpts = $xeTable.computeScrollbarXOpts;
  18080. const scrollbarYOpts = $xeTable.computeScrollbarYOpts;
  18081. const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
  18082. const yHandleEl = $xeTable.$refs.refScrollYHandleElem;
  18083. const leftScrollElem = getRefElem(elemStore['left-body-scroll']);
  18084. const headerScrollElem = getRefElem(elemStore['main-header-scroll']);
  18085. const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
  18086. const footerScrollElem = getRefElem(elemStore['main-footer-scroll']);
  18087. const rightScrollElem = getRefElem(elemStore['right-body-scroll']);
  18088. const rowExpandEl = $xeTable.$refs.refRowExpandElem;
  18089. if (!bodyScrollElem) {
  18090. return;
  18091. }
  18092. const wheelSpeed = getWheelSpeed(reactData.lastScrollTime);
  18093. const deltaTop = shiftKey ? 0 : deltaY * wheelSpeed;
  18094. const deltaLeft = (shiftKey ? deltaX || deltaY : deltaX) * wheelSpeed;
  18095. const currScrollTop = bodyScrollElem.scrollTop;
  18096. const currScrollLeft = bodyScrollElem.scrollLeft;
  18097. const scrollTop = currScrollTop + deltaTop;
  18098. const scrollLeft = currScrollLeft + deltaLeft;
  18099. const isRollX = scrollLeft !== lastScrollLeft;
  18100. const isRollY = scrollTop !== lastScrollTop;
  18101. if (isRollX) {
  18102. // 如果禁用滚动
  18103. if (scrollbarXOpts.visible === 'hidden') {
  18104. evnt.preventDefault();
  18105. return;
  18106. }
  18107. }
  18108. if (isRollY) {
  18109. // 如果禁用滚动
  18110. if (scrollbarYOpts.visible === 'hidden') {
  18111. evnt.preventDefault();
  18112. return;
  18113. }
  18114. const isTopWheel = deltaTop < 0;
  18115. // 如果滚动位置已经是顶部或底部,则不需要触发
  18116. if (isTopWheel ? currScrollTop <= 0 : currScrollTop >= bodyScrollElem.scrollHeight - bodyScrollElem.clientHeight) {
  18117. return;
  18118. }
  18119. }
  18120. if (!(leftFixedWidth || rightFixedWidth || expandColumn)) {
  18121. return;
  18122. }
  18123. if (rowOpts.isHover || highlightHoverRow) {
  18124. $xeTable.clearHoverRow();
  18125. }
  18126. // 用于鼠标纵向滚轮处理
  18127. if (isRollX) {
  18128. evnt.preventDefault();
  18129. internalData.inWheelScroll = true;
  18130. if (browseObj.firefox || browseObj.safari) {
  18131. const currLeftNum = scrollLeft;
  18132. setScrollLeft(xHandleEl, currLeftNum);
  18133. setScrollLeft(bodyScrollElem, currLeftNum);
  18134. setScrollLeft(headerScrollElem, currLeftNum);
  18135. setScrollLeft(footerScrollElem, currLeftNum);
  18136. if (scrollXLoad) {
  18137. $xeTable.triggerScrollXEvent(evnt);
  18138. }
  18139. $xeTable.handleScrollEvent(evnt, isRollY, isRollX, bodyScrollElem.scrollTop, currLeftNum, {
  18140. type: 'table',
  18141. fixed: ''
  18142. });
  18143. } else {
  18144. wheelScrollLeftTo(scrollLeft, offsetLeft => {
  18145. const currLeftNum = offsetLeft;
  18146. setScrollLeft(xHandleEl, currLeftNum);
  18147. setScrollLeft(bodyScrollElem, currLeftNum);
  18148. setScrollLeft(headerScrollElem, currLeftNum);
  18149. setScrollLeft(footerScrollElem, currLeftNum);
  18150. if (scrollXLoad) {
  18151. $xeTable.triggerScrollXEvent(evnt);
  18152. }
  18153. $xeTable.handleScrollEvent(evnt, isRollY, isRollX, bodyScrollElem.scrollTop, currLeftNum, {
  18154. type: 'table',
  18155. fixed: ''
  18156. });
  18157. });
  18158. }
  18159. }
  18160. if (isRollY) {
  18161. evnt.preventDefault();
  18162. if (browseObj.firefox || browseObj.safari) {
  18163. const currTopNum = scrollTop;
  18164. setScrollTop(yHandleEl, currTopNum);
  18165. setScrollTop(bodyScrollElem, currTopNum);
  18166. setScrollTop(leftScrollElem, currTopNum);
  18167. setScrollTop(rightScrollElem, currTopNum);
  18168. setScrollTop(rowExpandEl, currTopNum);
  18169. syncGanttScrollTop($xeTable, currTopNum);
  18170. if (scrollYLoad) {
  18171. $xeTable.triggerScrollYEvent(evnt);
  18172. }
  18173. $xeTable.handleScrollEvent(evnt, isRollY, isRollX, currTopNum, bodyScrollElem.scrollLeft, {
  18174. type: 'table',
  18175. fixed: ''
  18176. });
  18177. } else {
  18178. wheelScrollTopTo(scrollTop - currScrollTop, offsetTop => {
  18179. const currTopNum = bodyScrollElem.scrollTop + offsetTop;
  18180. internalData.inWheelScroll = true;
  18181. setScrollTop(yHandleEl, currTopNum);
  18182. setScrollTop(bodyScrollElem, currTopNum);
  18183. setScrollTop(leftScrollElem, currTopNum);
  18184. setScrollTop(rightScrollElem, currTopNum);
  18185. setScrollTop(rowExpandEl, currTopNum);
  18186. syncGanttScrollTop($xeTable, currTopNum);
  18187. if (scrollYLoad) {
  18188. $xeTable.triggerScrollYEvent(evnt);
  18189. }
  18190. $xeTable.handleScrollEvent(evnt, isRollY, isRollX, currTopNum, bodyScrollElem.scrollLeft, {
  18191. type: 'table',
  18192. fixed: ''
  18193. });
  18194. });
  18195. }
  18196. }
  18197. },
  18198. triggerVirtualScrollXEvent(evnt) {
  18199. const $xeTable = this;
  18200. const reactData = $xeTable;
  18201. const internalData = $xeTable;
  18202. const {
  18203. scrollXLoad
  18204. } = reactData;
  18205. const {
  18206. elemStore,
  18207. inWheelScroll,
  18208. lastScrollTop,
  18209. inHeaderScroll,
  18210. inBodyScroll,
  18211. inFooterScroll
  18212. } = internalData;
  18213. if (inHeaderScroll || inBodyScroll || inFooterScroll) {
  18214. return;
  18215. }
  18216. if (inWheelScroll) {
  18217. return;
  18218. }
  18219. const headerScrollElem = getRefElem(elemStore['main-header-scroll']);
  18220. const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
  18221. const footerScrollElem = getRefElem(elemStore['main-footer-scroll']);
  18222. const yHandleEl = $xeTable.$refs.refScrollYHandleElem;
  18223. const wrapperEl = evnt.currentTarget;
  18224. const {
  18225. scrollLeft
  18226. } = wrapperEl;
  18227. const yBodyEl = yHandleEl || bodyScrollElem;
  18228. let scrollTop = 0;
  18229. if (yBodyEl) {
  18230. scrollTop = yBodyEl.scrollTop;
  18231. }
  18232. const isRollX = true;
  18233. const isRollY = scrollTop !== lastScrollTop;
  18234. internalData.inVirtualScroll = true;
  18235. setScrollLeft(bodyScrollElem, scrollLeft);
  18236. setScrollLeft(headerScrollElem, scrollLeft);
  18237. setScrollLeft(footerScrollElem, scrollLeft);
  18238. if (scrollXLoad) {
  18239. $xeTable.triggerScrollXEvent(evnt);
  18240. }
  18241. $xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
  18242. type: 'table',
  18243. fixed: ''
  18244. });
  18245. },
  18246. triggerVirtualScrollYEvent(evnt) {
  18247. const $xeTable = this;
  18248. const reactData = $xeTable;
  18249. const internalData = $xeTable;
  18250. const {
  18251. scrollYLoad
  18252. } = reactData;
  18253. const {
  18254. elemStore,
  18255. inWheelScroll,
  18256. lastScrollLeft,
  18257. inHeaderScroll,
  18258. inBodyScroll,
  18259. inFooterScroll
  18260. } = internalData;
  18261. if (inHeaderScroll || inBodyScroll || inFooterScroll) {
  18262. return;
  18263. }
  18264. if (inWheelScroll) {
  18265. return;
  18266. }
  18267. const leftScrollElem = getRefElem(elemStore['left-body-scroll']);
  18268. const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
  18269. const rightScrollElem = getRefElem(elemStore['right-body-scroll']);
  18270. const rowExpandEl = $xeTable.$refs.refRowExpandElem;
  18271. const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
  18272. const wrapperEl = evnt.currentTarget;
  18273. const {
  18274. scrollTop
  18275. } = wrapperEl;
  18276. const xBodyEl = xHandleEl || bodyScrollElem;
  18277. let scrollLeft = 0;
  18278. if (xBodyEl) {
  18279. scrollLeft = xBodyEl.scrollLeft;
  18280. }
  18281. const isRollX = scrollLeft !== lastScrollLeft;
  18282. const isRollY = true;
  18283. internalData.inVirtualScroll = true;
  18284. setScrollTop(bodyScrollElem, scrollTop);
  18285. setScrollTop(leftScrollElem, scrollTop);
  18286. setScrollTop(rightScrollElem, scrollTop);
  18287. setScrollTop(rowExpandEl, scrollTop);
  18288. syncGanttScrollTop($xeTable, scrollTop);
  18289. if (scrollYLoad) {
  18290. $xeTable.triggerScrollYEvent(evnt);
  18291. }
  18292. $xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
  18293. type: 'table',
  18294. fixed: ''
  18295. });
  18296. },
  18297. updateScrollXData() {
  18298. const $xeTable = this;
  18299. const reactData = $xeTable;
  18300. const {
  18301. isAllOverflow
  18302. } = reactData;
  18303. handleTableColumn($xeTable);
  18304. $xeTable.updateScrollXSpace();
  18305. return $xeTable.$nextTick().then(() => {
  18306. handleTableColumn($xeTable);
  18307. $xeTable.updateScrollXSpace();
  18308. if (!isAllOverflow) {
  18309. $xeTable.updateScrollYSpace();
  18310. }
  18311. });
  18312. },
  18313. // 更新横向 X 可视渲染上下剩余空间大小
  18314. updateScrollXSpace() {
  18315. const $xeTable = this;
  18316. const reactData = $xeTable;
  18317. const internalData = $xeTable;
  18318. const {
  18319. scrollXLoad,
  18320. overflowX,
  18321. scrollXWidth
  18322. } = reactData;
  18323. const {
  18324. visibleColumn,
  18325. scrollXStore,
  18326. elemStore,
  18327. fullColumnIdData
  18328. } = internalData;
  18329. const $xeGanttView = internalData.xeGanttView;
  18330. const mouseOpts = $xeTable.computeMouseOpts;
  18331. const tableBody = $xeTable.$refs.refTableBody;
  18332. const tableBodyElem = tableBody ? tableBody.$el : null;
  18333. if (tableBodyElem) {
  18334. const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
  18335. const bodyTableElem = getRefElem(elemStore['main-body-table']);
  18336. const headerTableElem = getRefElem(elemStore['main-header-table']);
  18337. const footerTableElem = getRefElem(elemStore['main-footer-table']);
  18338. let xSpaceLeft = 0;
  18339. const firstColumn = visibleColumn[scrollXStore.startIndex];
  18340. if (firstColumn) {
  18341. const colRest = fullColumnIdData[firstColumn.id] || {};
  18342. xSpaceLeft = colRest.oLeft;
  18343. }
  18344. let clientWidth = 0;
  18345. if (bodyScrollElem) {
  18346. clientWidth = bodyScrollElem.clientWidth;
  18347. }
  18348. // 虚拟渲染
  18349. let isScrollXBig = false;
  18350. let ySpaceWidth = scrollXWidth;
  18351. if (scrollXWidth > maxXWidth) {
  18352. // 触右
  18353. if (bodyScrollElem && bodyTableElem && bodyScrollElem.scrollLeft + clientWidth >= maxXWidth) {
  18354. xSpaceLeft = maxXWidth - bodyTableElem.clientWidth;
  18355. } else {
  18356. xSpaceLeft = (maxXWidth - clientWidth) * (xSpaceLeft / (scrollXWidth - clientWidth));
  18357. }
  18358. ySpaceWidth = maxXWidth;
  18359. isScrollXBig = true;
  18360. }
  18361. if (!(scrollXLoad && overflowX)) {
  18362. xSpaceLeft = 0;
  18363. }
  18364. if (headerTableElem) {
  18365. headerTableElem.style.transform = headerTableElem.getAttribute('xvm') ? `translate(${xSpaceLeft}px, 0px)` : '';
  18366. }
  18367. if (bodyTableElem) {
  18368. bodyTableElem.style.transform = `translate(${xSpaceLeft}px, ${reactData.scrollYTop || 0}px)`;
  18369. }
  18370. if (footerTableElem) {
  18371. footerTableElem.style.transform = footerTableElem.getAttribute('xvm') ? `translate(${xSpaceLeft}px, 0px)` : '';
  18372. }
  18373. const containerList = ['main'];
  18374. containerList.forEach(name => {
  18375. const layoutList = ['header', 'body', 'footer'];
  18376. layoutList.forEach(layout => {
  18377. const xSpaceElem = getRefElem(elemStore[`${name}-${layout}-xSpace`]);
  18378. if (xSpaceElem) {
  18379. xSpaceElem.style.width = scrollXLoad ? `${ySpaceWidth}px` : '';
  18380. }
  18381. });
  18382. });
  18383. reactData.scrollXLeft = xSpaceLeft;
  18384. reactData.scrollXWidth = ySpaceWidth;
  18385. reactData.isScrollXBig = isScrollXBig;
  18386. const scrollXSpaceEl = $xeTable.$refs.refScrollXSpaceElem;
  18387. if (scrollXSpaceEl) {
  18388. scrollXSpaceEl.style.width = `${ySpaceWidth}px`;
  18389. }
  18390. calcScrollbar($xeTable);
  18391. if (isScrollXBig && mouseOpts.area) {
  18392. errLog('vxe.error.notProp', ['mouse-config.area']);
  18393. }
  18394. if ($xeGanttView && $xeGanttView.handleUpdateSXSpace) {
  18395. $xeGanttView.handleUpdateSXSpace();
  18396. }
  18397. return $xeTable.$nextTick(() => {
  18398. updateStyle($xeTable);
  18399. });
  18400. }
  18401. },
  18402. updateScrollYData() {
  18403. const $xeTable = this;
  18404. $xeTable.handleTableData();
  18405. $xeTable.updateScrollYSpace();
  18406. return $xeTable.$nextTick().then(() => {
  18407. $xeTable.handleTableData();
  18408. $xeTable.updateScrollYSpace();
  18409. });
  18410. },
  18411. // 更新纵向 Y 可视渲染上下剩余空间大小
  18412. updateScrollYSpace() {
  18413. const $xeTable = this;
  18414. const reactData = $xeTable;
  18415. const internalData = $xeTable;
  18416. const {
  18417. isAllOverflow,
  18418. scrollYLoad,
  18419. expandColumn
  18420. } = reactData;
  18421. const {
  18422. scrollYStore,
  18423. elemStore,
  18424. isResizeCellHeight,
  18425. afterFullData,
  18426. fullAllDataRowIdData,
  18427. rowExpandedMaps
  18428. } = internalData;
  18429. const $xeGanttView = internalData.xeGanttView;
  18430. const {
  18431. startIndex
  18432. } = scrollYStore;
  18433. const mouseOpts = $xeTable.computeMouseOpts;
  18434. const expandOpts = $xeTable.computeExpandOpts;
  18435. const rowOpts = $xeTable.computeRowOpts;
  18436. const cellOpts = $xeTable.computeCellOpts;
  18437. const defaultRowHeight = $xeTable.computeDefaultRowHeight;
  18438. const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
  18439. const bodyTableElem = getRefElem(elemStore['main-body-table']);
  18440. const leftBodyTableElem = getRefElem(elemStore['left-body-table']);
  18441. const rightbodyTableElem = getRefElem(elemStore['right-body-table']);
  18442. const containerList = ['main', 'left', 'right'];
  18443. let ySpaceTop = 0;
  18444. let scrollYHeight = 0;
  18445. let isScrollYBig = false;
  18446. if (scrollYLoad) {
  18447. const isCustomCellHeight = isResizeCellHeight || cellOpts.height || rowOpts.height;
  18448. if (!isCustomCellHeight && !expandColumn && isAllOverflow) {
  18449. scrollYHeight = afterFullData.length * defaultRowHeight;
  18450. if (scrollYHeight > maxYHeight) {
  18451. isScrollYBig = true;
  18452. }
  18453. ySpaceTop = Math.max(0, startIndex * defaultRowHeight);
  18454. } else {
  18455. const firstRow = afterFullData[startIndex];
  18456. let rowid = getRowid($xeTable, firstRow);
  18457. let rowRest = fullAllDataRowIdData[rowid] || {};
  18458. ySpaceTop = rowRest.oTop || 0;
  18459. const lastRow = afterFullData[afterFullData.length - 1];
  18460. rowid = getRowid($xeTable, lastRow);
  18461. rowRest = fullAllDataRowIdData[rowid] || {};
  18462. scrollYHeight = (rowRest.oTop || 0) + (rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight);
  18463. // 是否展开行
  18464. if (expandColumn && rowExpandedMaps[rowid]) {
  18465. scrollYHeight += rowRest.expandHeight || expandOpts.height || 0;
  18466. }
  18467. if (scrollYHeight > maxYHeight) {
  18468. isScrollYBig = true;
  18469. }
  18470. }
  18471. } else {
  18472. if (bodyTableElem) {
  18473. scrollYHeight = bodyTableElem.clientHeight;
  18474. }
  18475. }
  18476. let clientHeight = 0;
  18477. if (bodyScrollElem) {
  18478. clientHeight = bodyScrollElem.clientHeight;
  18479. }
  18480. // 虚拟渲染
  18481. let ySpaceHeight = scrollYHeight;
  18482. let scrollYTop = ySpaceTop;
  18483. if (isScrollYBig) {
  18484. // 触底
  18485. if (bodyScrollElem && bodyTableElem && bodyScrollElem.scrollTop + clientHeight >= maxYHeight) {
  18486. scrollYTop = maxYHeight - bodyTableElem.clientHeight;
  18487. } else {
  18488. scrollYTop = (maxYHeight - clientHeight) * (ySpaceTop / (scrollYHeight - clientHeight));
  18489. }
  18490. ySpaceHeight = maxYHeight;
  18491. }
  18492. if (leftBodyTableElem) {
  18493. leftBodyTableElem.style.transform = `translate(0px, ${scrollYTop}px)`;
  18494. }
  18495. if (bodyTableElem) {
  18496. bodyTableElem.style.transform = `translate(${reactData.scrollXLeft || 0}px, ${scrollYTop}px)`;
  18497. }
  18498. if (rightbodyTableElem) {
  18499. rightbodyTableElem.style.transform = `translate(0px, ${scrollYTop}px)`;
  18500. }
  18501. containerList.forEach(name => {
  18502. const layoutList = ['header', 'body', 'footer'];
  18503. layoutList.forEach(layout => {
  18504. const ySpaceElem = getRefElem(elemStore[`${name}-${layout}-ySpace`]);
  18505. if (ySpaceElem) {
  18506. ySpaceElem.style.height = ySpaceHeight ? `${ySpaceHeight}px` : '';
  18507. }
  18508. });
  18509. });
  18510. const scrollYSpaceEl = $xeTable.$refs.refScrollYSpaceElem;
  18511. if (scrollYSpaceEl) {
  18512. scrollYSpaceEl.style.height = ySpaceHeight ? `${ySpaceHeight}px` : '';
  18513. }
  18514. const rowExpandYSpaceEl = $xeTable.$refs.refRowExpandYSpaceElem;
  18515. if (rowExpandYSpaceEl) {
  18516. rowExpandYSpaceEl.style.height = ySpaceHeight ? `${ySpaceHeight}px` : '';
  18517. }
  18518. reactData.scrollYTop = scrollYTop;
  18519. reactData.scrollYHeight = scrollYHeight;
  18520. reactData.isScrollYBig = isScrollYBig;
  18521. calcScrollbar($xeTable);
  18522. if (isScrollYBig && mouseOpts.area) {
  18523. errLog('vxe.error.notProp', ['mouse-config.area']);
  18524. }
  18525. if ($xeGanttView && $xeGanttView.handleUpdateSYSpace) {
  18526. $xeGanttView.handleUpdateSYSpace();
  18527. }
  18528. return $xeTable.$nextTick().then(() => {
  18529. updateStyle($xeTable);
  18530. });
  18531. },
  18532. updateScrollYStatus() {
  18533. const $xeTable = this;
  18534. return updateScrollYStatus($xeTable);
  18535. },
  18536. /**
  18537. * 如果有滚动条,则滚动到对应的位置
  18538. */
  18539. scrollTo(scrollLeft, scrollTop) {
  18540. const $xeTable = this;
  18541. const reactData = $xeTable;
  18542. const internalData = $xeTable;
  18543. const {
  18544. elemStore
  18545. } = internalData;
  18546. const headerScrollElem = getRefElem(elemStore['main-header-scroll']);
  18547. const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
  18548. const footerScrollElem = getRefElem(elemStore['main-footer-scroll']);
  18549. const leftScrollElem = getRefElem(elemStore['left-body-scroll']);
  18550. const rightScrollElem = getRefElem(elemStore['right-body-scroll']);
  18551. const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
  18552. const yHandleEl = $xeTable.$refs.refScrollYHandleElem;
  18553. internalData.intoRunScroll = true;
  18554. if (scrollLeft) {
  18555. if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(scrollLeft)) {
  18556. scrollTop = scrollLeft.top;
  18557. scrollLeft = scrollLeft.left;
  18558. }
  18559. }
  18560. if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(scrollLeft)) {
  18561. setScrollLeft(xHandleEl, scrollLeft);
  18562. setScrollLeft(bodyScrollElem, scrollLeft);
  18563. setScrollLeft(headerScrollElem, scrollLeft);
  18564. setScrollLeft(footerScrollElem, scrollLeft);
  18565. loadScrollXData($xeTable);
  18566. }
  18567. if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(scrollTop)) {
  18568. setScrollTop(yHandleEl, scrollTop);
  18569. setScrollTop(bodyScrollElem, scrollTop);
  18570. setScrollTop(leftScrollElem, scrollTop);
  18571. setScrollTop(rightScrollElem, scrollTop);
  18572. loadScrollYData($xeTable);
  18573. }
  18574. if (reactData.scrollXLoad || reactData.scrollYLoad) {
  18575. return new Promise(resolve => {
  18576. setTimeout(() => {
  18577. $xeTable.$nextTick(() => {
  18578. internalData.intoRunScroll = false;
  18579. resolve();
  18580. });
  18581. }, 30);
  18582. });
  18583. }
  18584. return $xeTable.$nextTick().then(() => {
  18585. internalData.intoRunScroll = false;
  18586. });
  18587. },
  18588. /**
  18589. * 如果有滚动条,则滚动到对应的行
  18590. * @param {Row} row 行对象
  18591. * @param {ColumnInfo} column 列配置
  18592. */
  18593. scrollToRow(row, fieldOrColumn) {
  18594. const $xeTable = this;
  18595. const props = $xeTable;
  18596. const reactData = $xeTable;
  18597. const {
  18598. isAllOverflow,
  18599. scrollYLoad,
  18600. scrollXLoad
  18601. } = reactData;
  18602. const rest = [];
  18603. if (row) {
  18604. if (props.treeConfig) {
  18605. rest.push($xeTable.scrollToTreeRow(row));
  18606. } else {
  18607. rest.push(rowToVisible($xeTable, row));
  18608. }
  18609. }
  18610. if (fieldOrColumn) {
  18611. rest.push(handleScrollToRowColumn($xeTable, fieldOrColumn, row));
  18612. }
  18613. return Promise.all(rest).then(() => {
  18614. if (row) {
  18615. if (!isAllOverflow && (scrollYLoad || scrollXLoad)) {
  18616. calcCellHeight($xeTable);
  18617. calcCellWidth($xeTable);
  18618. }
  18619. return $xeTable.$nextTick();
  18620. }
  18621. });
  18622. },
  18623. /**
  18624. * 如果有滚动条,则滚动到对应的列
  18625. * @param {ColumnInfo} column 列配置
  18626. */
  18627. scrollToColumn(fieldOrColumn) {
  18628. const $xeTable = this;
  18629. return handleScrollToRowColumn($xeTable, fieldOrColumn);
  18630. },
  18631. /**
  18632. * 对于树形结构中,可以直接滚动到指定深层节点中
  18633. * 对于某些特定的场景可能会用到,比如定位到某一节点
  18634. * @param {Row} row 行对象
  18635. */
  18636. scrollToTreeRow(row) {
  18637. const $xeTable = this;
  18638. const props = $xeTable;
  18639. const reactData = $xeTable;
  18640. const internalData = $xeTable;
  18641. const {
  18642. treeConfig
  18643. } = props;
  18644. const {
  18645. isRowGroupStatus
  18646. } = reactData;
  18647. const {
  18648. tableFullData
  18649. } = internalData;
  18650. const rests = [];
  18651. if (treeConfig || isRowGroupStatus) {
  18652. const aggregateOpts = $xeTable.computeAggregateOpts;
  18653. const treeOpts = $xeTable.computeTreeOpts;
  18654. const childrenField = treeOpts.children || treeOpts.childrenField;
  18655. const matchObj = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findTree(tableFullData, item => $xeTable.eqRow(item, row), {
  18656. children: isRowGroupStatus ? aggregateOpts.mapChildrenField : childrenField
  18657. });
  18658. if (matchObj) {
  18659. const nodes = matchObj.nodes;
  18660. nodes.forEach((row, index) => {
  18661. if (index < nodes.length - 1 && !$xeTable.isTreeExpandByRow(row)) {
  18662. rests.push($xeTable.setTreeExpand(row, true));
  18663. }
  18664. });
  18665. }
  18666. }
  18667. return Promise.all(rests).then(() => rowToVisible($xeTable, row));
  18668. },
  18669. /**
  18670. * 手动清除滚动相关信息,还原到初始状态
  18671. */
  18672. clearScroll() {
  18673. const $xeTable = this;
  18674. const internalData = $xeTable;
  18675. const {
  18676. elemStore,
  18677. scrollXStore,
  18678. scrollYStore
  18679. } = internalData;
  18680. const headerScrollElem = getRefElem(elemStore['main-header-scroll']);
  18681. const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
  18682. const footerScrollElem = getRefElem(elemStore['main-footer-scroll']);
  18683. const leftScrollElem = getRefElem(elemStore['left-body-scroll']);
  18684. const rightScrollElem = getRefElem(elemStore['right-body-scroll']);
  18685. const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
  18686. const yHandleEl = $xeTable.$refs.refScrollYHandleElem;
  18687. internalData.intoRunScroll = true;
  18688. setScrollLeft(xHandleEl, 0);
  18689. setScrollLeft(bodyScrollElem, 0);
  18690. setScrollLeft(headerScrollElem, 0);
  18691. setScrollLeft(footerScrollElem, 0);
  18692. setScrollTop(yHandleEl, 0);
  18693. setScrollTop(bodyScrollElem, 0);
  18694. setScrollTop(leftScrollElem, 0);
  18695. setScrollTop(rightScrollElem, 0);
  18696. scrollXStore.startIndex = 0;
  18697. scrollXStore.visibleStartIndex = 0;
  18698. scrollXStore.endIndex = scrollXStore.visibleSize;
  18699. scrollXStore.visibleEndIndex = scrollXStore.visibleSize;
  18700. scrollYStore.startIndex = 0;
  18701. scrollYStore.visibleStartIndex = 0;
  18702. scrollYStore.endIndex = scrollYStore.visibleSize;
  18703. scrollYStore.visibleEndIndex = scrollYStore.visibleSize;
  18704. return $xeTable.$nextTick().then(() => {
  18705. internalData.lastScrollLeft = 0;
  18706. internalData.lastScrollTop = 0;
  18707. internalData.intoRunScroll = false;
  18708. });
  18709. },
  18710. /**
  18711. * 更新表尾合计
  18712. */
  18713. updateFooter() {
  18714. const $xeTable = this;
  18715. const props = $xeTable;
  18716. const reactData = $xeTable;
  18717. const internalData = $xeTable;
  18718. const $xeGrid = $xeTable.$xeGrid;
  18719. const $xeGantt = $xeTable.$xeGantt;
  18720. const {
  18721. showFooter,
  18722. footerData,
  18723. footerMethod
  18724. } = props;
  18725. const {
  18726. visibleColumn,
  18727. afterFullData
  18728. } = internalData;
  18729. let footData = [];
  18730. if (showFooter && footerData && footerData.length) {
  18731. footData = footerData.slice(0);
  18732. } else if (showFooter && footerMethod) {
  18733. footData = visibleColumn.length ? footerMethod({
  18734. columns: visibleColumn,
  18735. data: afterFullData,
  18736. $table: $xeTable,
  18737. $grid: $xeGrid,
  18738. $gantt: $xeGantt
  18739. }) : [];
  18740. }
  18741. reactData.footerTableData = footData;
  18742. $xeTable.handleUpdateFooterMerge();
  18743. $xeTable.dispatchEvent('footer-data-change', {
  18744. visibleColumn: internalData.visibleColumn,
  18745. footData
  18746. }, null);
  18747. return $xeTable.$nextTick();
  18748. },
  18749. /**
  18750. * 更新列状态 updateStatus({ row, column }, cellValue)
  18751. * 如果组件值 v-model 发生 change 时,调用改函数用于更新某一列编辑状态
  18752. * 如果单元格配置了校验规则,则会进行校验
  18753. */
  18754. updateStatus(slotParams, cellValue) {
  18755. const $xeTable = this;
  18756. const props = $xeTable;
  18757. return this.$nextTick().then(() => {
  18758. const {
  18759. editRules
  18760. } = props;
  18761. if (slotParams && editRules) {
  18762. return $xeTable.handleCellRuleUpdateStatus('change', slotParams, cellValue);
  18763. }
  18764. });
  18765. },
  18766. /**
  18767. * 设置合并单元格 [{ row: Row|number, column: ColumnInfo|number, rowspan: number, colspan: number }]
  18768. */
  18769. setMergeCells(merges) {
  18770. const $xeTable = this;
  18771. const props = $xeTable;
  18772. const reactData = $xeTable;
  18773. const internalData = $xeTable;
  18774. if (props.spanMethod) {
  18775. errLog('vxe.error.errConflicts', ['merge-cells', 'span-method']);
  18776. }
  18777. handleBodyMerge($xeTable, merges);
  18778. $xeTable.handleUpdateBodyMerge();
  18779. return $xeTable.$nextTick().then(() => {
  18780. const {
  18781. expandColumn
  18782. } = reactData;
  18783. const {
  18784. mergeBodyList
  18785. } = internalData;
  18786. if (expandColumn && mergeBodyList.length) {
  18787. warnLog('vxe.error.errConflicts', ['type=expand', 'merge-cells | span-method']);
  18788. }
  18789. $xeTable.updateCellAreas();
  18790. return updateStyle($xeTable);
  18791. });
  18792. },
  18793. /**
  18794. * 移除单元格合并 [{row:Row|number, col:ColumnInfo|number}]
  18795. */
  18796. removeMergeCells(merges) {
  18797. const $xeTable = this;
  18798. const props = $xeTable;
  18799. if (props.spanMethod) {
  18800. errLog('vxe.error.errConflicts', ['merge-cells', 'span-method']);
  18801. }
  18802. const rest = removeBodyMerges($xeTable, merges);
  18803. $xeTable.handleUpdateBodyMerge();
  18804. return $xeTable.$nextTick().then(() => {
  18805. $xeTable.updateCellAreas();
  18806. updateStyle($xeTable);
  18807. return rest;
  18808. });
  18809. },
  18810. /**
  18811. * 获取所有被合并的单元格
  18812. */
  18813. getMergeCells() {
  18814. const $xeTable = this;
  18815. const internalData = $xeTable;
  18816. return internalData.mergeBodyList.slice(0);
  18817. },
  18818. /**
  18819. * 清除所有单元格合并
  18820. */
  18821. clearMergeCells() {
  18822. const $xeTable = this;
  18823. const reactData = $xeTable;
  18824. const internalData = $xeTable;
  18825. internalData.mergeBodyList = [];
  18826. internalData.mergeBodyMaps = {};
  18827. internalData.mergeBodyCellMaps = {};
  18828. reactData.mergeBodyFlag++;
  18829. return $xeTable.$nextTick().then(() => {
  18830. return updateStyle($xeTable);
  18831. });
  18832. },
  18833. setMergeHeaderCells(merges) {
  18834. const $xeTable = this;
  18835. handleHeaderMerge($xeTable, merges);
  18836. $xeTable.handleUpdateHeaderMerge();
  18837. return $xeTable.$nextTick().then(() => {
  18838. return updateStyle($xeTable);
  18839. });
  18840. },
  18841. /**
  18842. * 移除表头单元格合并 [{row:Row|number, col:ColumnInfo|number}]
  18843. */
  18844. removeMergeHeaderCells(merges) {
  18845. const $xeTable = this;
  18846. const rest = removeHeaderMerges($xeTable, merges);
  18847. $xeTable.handleUpdateHeaderMerge();
  18848. return $xeTable.$nextTick().then(() => {
  18849. updateStyle($xeTable);
  18850. return rest;
  18851. });
  18852. },
  18853. /**
  18854. * 获取所有被合并的表头单元格
  18855. */
  18856. getMergeHeaderCells() {
  18857. const $xeTable = this;
  18858. const internalData = $xeTable;
  18859. return internalData.mergeHeaderList.slice(0);
  18860. },
  18861. /**
  18862. * 清除所有表头单元格合并
  18863. */
  18864. clearMergeHeaderCells() {
  18865. const $xeTable = this;
  18866. const reactData = $xeTable;
  18867. const internalData = $xeTable;
  18868. internalData.mergeHeaderList = [];
  18869. internalData.mergeHeaderMaps = {};
  18870. internalData.mergeHeaderCellMaps = {};
  18871. reactData.mergeHeadFlag++;
  18872. return $xeTable.$nextTick().then(() => {
  18873. return updateStyle($xeTable);
  18874. });
  18875. },
  18876. setMergeFooterCells(merges) {
  18877. const $xeTable = this;
  18878. const props = $xeTable;
  18879. if (props.footerSpanMethod) {
  18880. errLog('vxe.error.errConflicts', ['merge-footer-cells | merge-footer-items', 'footer-span-method']);
  18881. }
  18882. handleFooterMerge($xeTable, merges);
  18883. $xeTable.handleUpdateFooterMerge();
  18884. return $xeTable.$nextTick().then(() => {
  18885. return updateStyle($xeTable);
  18886. });
  18887. },
  18888. setMergeFooterItems(merges) {
  18889. const $xeTable = this;
  18890. // errLog('vxe.error.delFunc', ['setMergeFooterItems', 'setMergeFooterCells'])
  18891. return $xeTable.setMergeFooterCells(merges);
  18892. },
  18893. removeMergeFooterCells(merges) {
  18894. const $xeTable = this;
  18895. const props = $xeTable;
  18896. if (props.footerSpanMethod) {
  18897. errLog('vxe.error.errConflicts', ['merge-footer-cells | merge-footer-items', 'footer-span-method']);
  18898. }
  18899. const rest = removeFooterMerges($xeTable, merges);
  18900. $xeTable.handleUpdateFooterMerge();
  18901. return $xeTable.$nextTick().then(() => {
  18902. updateStyle($xeTable);
  18903. return rest;
  18904. });
  18905. },
  18906. removeMergeFooterItems(merges) {
  18907. const $xeTable = this;
  18908. // errLog('vxe.error.delFunc', ['removeMergeFooterItems', 'removeMergeFooterCells'])
  18909. return $xeTable.removeMergeFooterCells(merges);
  18910. },
  18911. /**
  18912. * 获取所有被合并的表尾
  18913. */
  18914. getMergeFooterCells() {
  18915. const $xeTable = this;
  18916. const internalData = $xeTable;
  18917. return internalData.mergeFooterList.slice(0);
  18918. },
  18919. getMergeFooterItems() {
  18920. const $xeTable = this;
  18921. // errLog('vxe.error.delFunc', ['getMergeFooterItems', 'getMergeFooterCells'])
  18922. return $xeTable.getMergeFooterCells();
  18923. },
  18924. /**
  18925. * 清除所有表尾合并
  18926. */
  18927. clearMergeFooterCells() {
  18928. const $xeTable = this;
  18929. const reactData = $xeTable;
  18930. const internalData = $xeTable;
  18931. internalData.mergeFooterList = [];
  18932. internalData.mergeFooterMaps = {};
  18933. internalData.mergeFooterCellMaps = {};
  18934. reactData.mergeFootFlag++;
  18935. return $xeTable.$nextTick().then(() => {
  18936. return updateStyle($xeTable);
  18937. });
  18938. },
  18939. clearMergeFooterItems() {
  18940. const $xeTable = this;
  18941. // errLog('vxe.error.delFunc', ['clearMergeFooterItems', 'clearMergeFooterCells'])
  18942. return $xeTable.clearMergeFooterCells();
  18943. },
  18944. handleUpdateAggData() {
  18945. const $xeTable = this;
  18946. const internalData = $xeTable;
  18947. return loadTableData($xeTable, internalData.tableSynchData, true);
  18948. },
  18949. updateZindex() {
  18950. if (this.zIndex) {
  18951. this.tZindex = this.zIndex;
  18952. } else if (this.tZindex < getLastZIndex()) {
  18953. this.tZindex = nextZIndex();
  18954. }
  18955. },
  18956. updateCellAreas() {
  18957. const $xeTable = this;
  18958. const props = $xeTable;
  18959. const {
  18960. mouseConfig
  18961. } = props;
  18962. const mouseOpts = $xeTable.computeMouseOpts;
  18963. if (mouseConfig && mouseOpts.area && $xeTable.handleRecalculateCellAreaEvent) {
  18964. return $xeTable.handleRecalculateCellAreaEvent();
  18965. }
  18966. return $xeTable.$nextTick();
  18967. },
  18968. dispatchEvent(type, params, evnt) {
  18969. const $xeTable = this;
  18970. const $xeGrid = $xeTable.$xeGrid;
  18971. const $xeGantt = $xeTable.$xeGantt;
  18972. $xeTable.$emit(type, createEvent(evnt, {
  18973. $table: $xeTable,
  18974. $grid: $xeGrid,
  18975. $gantt: $xeGantt
  18976. }, params));
  18977. },
  18978. // 已废弃,使用 dispatchEvent
  18979. emitEvent(type, params, evnt) {
  18980. const $xeTable = this;
  18981. $xeTable.dispatchEvent(type, params, evnt);
  18982. },
  18983. focus() {
  18984. this.isActivated = true;
  18985. return this.$nextTick();
  18986. },
  18987. blur() {
  18988. this.isActivated = false;
  18989. return this.$nextTick();
  18990. },
  18991. /**
  18992. * 已废弃,被 connectToolbar 替换
  18993. * @deprecated
  18994. */
  18995. connect($toolbar) {
  18996. return this.connectToolbar($toolbar);
  18997. },
  18998. /**
  18999. * 连接工具栏
  19000. * @param $toolbar
  19001. */
  19002. connectToolbar($toolbar) {
  19003. const $xeTable = this;
  19004. if ($toolbar && $toolbar.syncUpdate) {
  19005. $toolbar.syncUpdate({
  19006. collectColumn: this.collectColumn,
  19007. $table: $xeTable
  19008. });
  19009. this.$toolbar = $toolbar;
  19010. } else {
  19011. errLog('vxe.error.barUnableLink');
  19012. }
  19013. return this.$nextTick();
  19014. },
  19015. handleConnectGanttView($ganttView) {
  19016. const $xeTable = this;
  19017. const internalData = $xeTable;
  19018. if ($ganttView && $ganttView.connectUpdate) {
  19019. $ganttView.connectUpdate({
  19020. $table: $xeTable
  19021. });
  19022. internalData.xeGanttView = $ganttView;
  19023. }
  19024. return $xeTable.$nextTick();
  19025. },
  19026. /*************************
  19027. * Publish methods
  19028. *************************/
  19029. /**
  19030. * 已废弃,被 getCellElement 替换
  19031. * @deprecated
  19032. */
  19033. getCell(row, column) {
  19034. return this.getCellElement(row, column);
  19035. },
  19036. findRowIndexOf(list, row) {
  19037. return row ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findIndexOf(list, item => this.eqRow(item, row)) : -1;
  19038. },
  19039. eqRow(row1, row2) {
  19040. if (row1 && row2) {
  19041. if (row1 === row2) {
  19042. return true;
  19043. }
  19044. return getRowid(this, row1) === getRowid(this, row2);
  19045. }
  19046. return false;
  19047. },
  19048. /*************************
  19049. * Publish methods
  19050. *************************/
  19051. getSetupOptions() {
  19052. return methods_getConfig();
  19053. }
  19054. };
  19055. // Module methods
  19056. const funcs = 'setFilter,openFilter,clearFilter,saveFilter,saveFilterByEvent,resetFilter,resetFilterByEvent,saveFilterPanel,saveFilterPanelByEvent,resetFilterPanel,resetFilterPanelByEvent,getCheckedFilters,updateFilterOptionStatus,closeMenu,setActiveCellArea,getActiveCellArea,getCellAreas,clearCellAreas,copyCellArea,cutCellArea,pasteCellArea,getCopyCellArea,getCopyCellAreas,clearCopyCellArea,setCellAreas,openFNR,openFind,openReplace,closeFNR,getSelectedCell,clearSelected,insert,insertAt,insertNextAt,insertChild,insertChildAt,insertChildNextAt,remove,removeCheckboxRow,removeRadioRow,removeCurrentRow,getRecordset,getInsertRecords,getRemoveRecords,getUpdateRecords,clearEdit,clearActived,getEditRecord,getEditCell,getActiveRecord,isEditByRow,isActiveByRow,setEditRow,setActiveRow,setEditCell,setActiveCell,setSelectCell,clearValidate,fullValidate,validate,fullValidateField,validateField,openExport,closeExport,openPrint,closePrint,getPrintHtml,exportData,openImport,closeImport,importData,saveFile,readFile,importByFile,print,getCustomVisible,openCustom,closeCustom,toggleCustom,saveCustom,cancelCustom,resetCustom,toggleCustomAllCheckbox,setCustomAllCheckbox'.split(',');
  19057. funcs.forEach(name => {
  19058. Methods[name] = function (...args) {
  19059. // if (!this[`_${name}`]) {
  19060. // if ('openExport,openPrint,exportData,openImport,importData,saveFile,readFile,importByFile,print'.split(',').includes(name)) {
  19061. // errLog('vxe.error.reqModule', ['Export'])
  19062. // } else if ('fullValidate,validate'.split(',').includes(name)) {
  19063. // errLog('vxe.error.reqModule', ['Validator'])
  19064. // } else if ('setFilter,openFilter,clearFilter,getCheckedFilters'.split(',').includes(name)) {
  19065. // errLog('vxe.error.reqModule', ['Filter'])
  19066. // } else if ('insert,insertAt,insertNextAt,remove,removeCheckboxRow,removeRadioRow,removeCurrentRow,getRecordset,getInsertRecords,getRemoveRecords,getUpdateRecords,getEditRecord,getEditCell,getActiveRecord,isEditByRow,isActiveByRow,setEditRow,setActiveRow,setEditCell,setActiveCell'.split(',').includes(name)) {
  19067. // errLog('vxe.error.reqModule', ['Edit'])
  19068. // } else if ('openCustom'.split(',').includes(name)) {
  19069. // errLog('vxe.error.reqModule', ['Custom'])
  19070. // }
  19071. // }
  19072. return this[`_${name}`] ? this[`_${name}`](...args) : null;
  19073. };
  19074. });
  19075. /* harmony default export */ var methods = (Methods);
  19076. ;// CONCATENATED MODULE: ./packages/table/src/body.ts
  19077. const {
  19078. getI18n: body_getI18n,
  19079. renderer: body_renderer,
  19080. renderEmptyElement: body_renderEmptyElement
  19081. } = core_.VxeUI;
  19082. const sourceType = 'table';
  19083. const renderType = 'body';
  19084. // 滚动、拖动过程中不需要触发
  19085. const isVMScrollProcess = $xeTable => {
  19086. const tableProps = $xeTable;
  19087. const tableReactData = $xeTable;
  19088. const {
  19089. delayHover
  19090. } = tableProps;
  19091. const {
  19092. lastScrollTime,
  19093. isDragResize
  19094. } = tableReactData;
  19095. return !!(isDragResize || lastScrollTime && Date.now() < lastScrollTime + delayHover);
  19096. };
  19097. function renderLine(h, $xeTable, rowid, params, cellHeight) {
  19098. const tableProps = $xeTable;
  19099. const tableInternalData = $xeTable;
  19100. const {
  19101. column
  19102. } = params;
  19103. const {
  19104. afterFullData
  19105. } = tableInternalData;
  19106. const {
  19107. treeConfig
  19108. } = tableProps;
  19109. const treeOpts = $xeTable.computeTreeOpts;
  19110. const {
  19111. slots,
  19112. treeNode
  19113. } = column;
  19114. const {
  19115. fullAllDataRowIdData
  19116. } = tableInternalData;
  19117. if (slots && slots.line) {
  19118. return $xeTable.callSlot(slots.line, params, h);
  19119. }
  19120. const rowRest = fullAllDataRowIdData[rowid];
  19121. let rLevel = 0;
  19122. let prevRow = null;
  19123. if (rowRest) {
  19124. rLevel = rowRest.level;
  19125. prevRow = rowRest.items[rowRest.treeIndex - 1];
  19126. }
  19127. if (treeConfig && treeNode && (treeOpts.showLine || treeOpts.line)) {
  19128. return [h('div', {
  19129. key: 'tl',
  19130. class: 'vxe-tree--line-wrapper'
  19131. }, [h('div', {
  19132. class: 'vxe-tree--line',
  19133. style: {
  19134. height: `${getRowid($xeTable, afterFullData[0]) === rowid ? 1 : calcTreeLine(params, prevRow)}px`,
  19135. bottom: `-${Math.floor(cellHeight / 2)}px`,
  19136. left: `${rLevel * treeOpts.indent + (rLevel ? 2 - getOffsetSize($xeTable) : 0) + 16}px`
  19137. }
  19138. })])];
  19139. }
  19140. return [];
  19141. }
  19142. /**
  19143. * 渲染列
  19144. */
  19145. function renderTdColumn(h, $xeTable, seq, rowid, fixedType, isOptimizeMode, rowLevel, row, rowIndex, $rowIndex, _rowIndex, column, $columnIndex, columns, items) {
  19146. const tableProps = $xeTable;
  19147. const tableReactData = $xeTable;
  19148. const tableInternalData = $xeTable;
  19149. const $xeGrid = $xeTable.$xeGrid;
  19150. const $xeGantt = $xeTable.$xeGantt;
  19151. const {
  19152. columnKey,
  19153. resizable: allResizable,
  19154. showOverflow: allShowOverflow,
  19155. border,
  19156. height,
  19157. treeConfig,
  19158. cellClassName: allCellClassName,
  19159. cellStyle,
  19160. align: allAlign,
  19161. spanMethod,
  19162. mouseConfig,
  19163. editConfig,
  19164. editRules,
  19165. tooltipConfig,
  19166. padding: allPadding
  19167. } = tableProps;
  19168. const {
  19169. tableData,
  19170. tableColumn,
  19171. dragRow,
  19172. overflowX,
  19173. overflowY,
  19174. currentColumn,
  19175. scrollXLoad,
  19176. scrollYLoad,
  19177. mergeBodyFlag,
  19178. calcCellHeightFlag,
  19179. resizeHeightFlag,
  19180. resizeWidthFlag,
  19181. editStore,
  19182. isAllOverflow,
  19183. validErrorMaps
  19184. } = tableReactData;
  19185. const {
  19186. fullAllDataRowIdData,
  19187. fullColumnIdData,
  19188. mergeBodyCellMaps,
  19189. visibleColumn,
  19190. afterFullData,
  19191. mergeBodyList,
  19192. scrollXStore,
  19193. scrollYStore
  19194. } = tableInternalData;
  19195. const cellOpts = $xeTable.computeCellOpts;
  19196. const validOpts = $xeTable.computeValidOpts;
  19197. const checkboxOpts = $xeTable.computeCheckboxOpts;
  19198. const editOpts = $xeTable.computeEditOpts;
  19199. const tooltipOpts = $xeTable.computeTooltipOpts;
  19200. const virtualXOpts = $xeTable.computeVirtualXOpts;
  19201. const virtualYOpts = $xeTable.computeVirtualYOpts;
  19202. const {
  19203. isAllColumnDrag,
  19204. isAllRowDrag
  19205. } = $xeTable.resizableOpts;
  19206. const rowOpts = $xeTable.computeRowOpts;
  19207. const rowDragOpts = $xeTable.computeRowDragOpts;
  19208. const defaultRowHeight = $xeTable.computeDefaultRowHeight;
  19209. const customCellHeight = calcCellHeightFlag ? cellOpts.height || rowOpts.height : 0;
  19210. const {
  19211. disabledMethod: dragDisabledMethod,
  19212. isCrossDrag,
  19213. isPeerDrag
  19214. } = rowDragOpts;
  19215. const columnOpts = $xeTable.computeColumnOpts;
  19216. const mouseOpts = $xeTable.computeMouseOpts;
  19217. const areaOpts = $xeTable.computeAreaOpts;
  19218. const cellOffsetWidth = $xeTable.computeCellOffsetWidth;
  19219. const {
  19220. selectCellToRow
  19221. } = areaOpts;
  19222. const {
  19223. type,
  19224. cellRender,
  19225. editRender,
  19226. align,
  19227. showOverflow,
  19228. className,
  19229. treeNode,
  19230. rowResize,
  19231. padding,
  19232. verticalAlign,
  19233. slots
  19234. } = column;
  19235. const {
  19236. verticalAlign: allVerticalAlign
  19237. } = cellOpts;
  19238. const {
  19239. actived
  19240. } = editStore;
  19241. const rowRest = fullAllDataRowIdData[rowid] || {};
  19242. const colid = column.id;
  19243. const colRest = fullColumnIdData[colid] || {};
  19244. const renderOpts = editRender || cellRender;
  19245. const compConf = renderOpts ? body_renderer.get(renderOpts.name) : null;
  19246. const compCellClassName = compConf ? compConf.tableCellClassName || compConf.cellClassName : null;
  19247. const compCellStyle = compConf ? compConf.tableCellStyle || compConf.cellStyle : '';
  19248. const showAllTip = tooltipOpts.showAll;
  19249. const columnIndex = colRest.index;
  19250. const _columnIndex = colRest._index;
  19251. const isEdit = isEnableConf(editRender);
  19252. const resizeHeight = resizeHeightFlag ? rowRest.resizeHeight : 0;
  19253. let fixedHiddenColumn = overflowX && (fixedType ? column.fixed !== fixedType : !!column.fixed);
  19254. const isCellPadding = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(padding) ? allPadding === null ? cellOpts.padding : allPadding : padding;
  19255. const cellOverflow = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(showOverflow) ? allShowOverflow : showOverflow;
  19256. const showEllipsis = cellOverflow === 'ellipsis';
  19257. const showTitle = cellOverflow === 'title';
  19258. const showTooltip = cellOverflow === true || cellOverflow === 'tooltip';
  19259. const hasEllipsis = isAllOverflow || showTitle || showTooltip || showEllipsis;
  19260. const showResizable = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isBoolean(column.resizable) ? column.resizable : columnOpts.resizable || allResizable;
  19261. const isCsHeight = !!customCellHeight;
  19262. const isRsHeight = resizeHeight > 0;
  19263. let isDirty;
  19264. const tdOns = {};
  19265. const cellAlign = align || (compConf ? compConf.tableCellAlign : '') || allAlign;
  19266. const cellVerticalAlign = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(verticalAlign) ? allVerticalAlign : verticalAlign;
  19267. const errorValidItem = validErrorMaps[`${rowid}:${colid}`];
  19268. const showValidTip = editRules && validOpts.showMessage && (validOpts.message === 'default' ? height || tableData.length > 1 : validOpts.message === 'inline');
  19269. const tdAttrs = {
  19270. colid
  19271. };
  19272. const cellParams = {
  19273. $table: $xeTable,
  19274. $grid: $xeGrid,
  19275. $gantt: $xeGantt,
  19276. isEdit: false,
  19277. seq,
  19278. rowid,
  19279. row,
  19280. rowIndex,
  19281. $rowIndex,
  19282. _rowIndex,
  19283. column,
  19284. columnIndex,
  19285. $columnIndex,
  19286. _columnIndex,
  19287. fixed: fixedType,
  19288. source: sourceType,
  19289. type: renderType,
  19290. isHidden: !!fixedHiddenColumn,
  19291. level: rowLevel,
  19292. visibleData: afterFullData,
  19293. data: tableData,
  19294. items
  19295. };
  19296. let isRowDragCell = false;
  19297. let isDisabledDrag = false;
  19298. if (rowOpts.drag) {
  19299. isRowDragCell = rowDragOpts.trigger === 'row' || column.dragSort && rowDragOpts.trigger === 'cell';
  19300. }
  19301. if (isRowDragCell) {
  19302. isDisabledDrag = !!(dragDisabledMethod && dragDisabledMethod(cellParams));
  19303. }
  19304. // hover 进入事件
  19305. if (showTitle || showTooltip || showAllTip || tooltipConfig) {
  19306. tdOns.mouseover = evnt => {
  19307. if (!isVMScrollProcess($xeTable)) {
  19308. if (showTitle) {
  19309. updateCellTitle(evnt.currentTarget, column);
  19310. } else if (showTooltip || showAllTip) {
  19311. // 如果配置了显示 tooltip
  19312. $xeTable.triggerBodyTooltipEvent(evnt, cellParams);
  19313. }
  19314. }
  19315. $xeTable.dispatchEvent('cell-mouseenter', Object.assign({
  19316. cell: evnt.currentTarget
  19317. }, cellParams), evnt);
  19318. };
  19319. }
  19320. // hover 退出事件
  19321. if (showTooltip || showAllTip || tooltipConfig) {
  19322. tdOns.mouseleave = evnt => {
  19323. if (!isVMScrollProcess($xeTable)) {
  19324. if (showTooltip || showAllTip) {
  19325. $xeTable.handleTargetLeaveEvent(evnt);
  19326. }
  19327. }
  19328. $xeTable.dispatchEvent('cell-mouseleave', Object.assign({
  19329. cell: evnt.currentTarget
  19330. }, cellParams), evnt);
  19331. };
  19332. }
  19333. // 按下事件处理
  19334. if (isRowDragCell || checkboxOpts.range || mouseConfig) {
  19335. tdOns.mousedown = evnt => {
  19336. $xeTable.triggerCellMousedownEvent(evnt, cellParams);
  19337. };
  19338. }
  19339. // 拖拽列事件
  19340. if (isRowDragCell) {
  19341. tdOns.mouseup = $xeTable.triggerCellMouseupEvent;
  19342. }
  19343. // 点击事件处理
  19344. tdOns.click = evnt => {
  19345. $xeTable.triggerCellClickEvent(evnt, cellParams);
  19346. };
  19347. // 双击事件处理
  19348. tdOns.dblclick = evnt => {
  19349. $xeTable.triggerCellDblclickEvent(evnt, cellParams);
  19350. };
  19351. let isMergeCell = false;
  19352. let mergeColspan = 1;
  19353. let mergeRowspan = 1;
  19354. // 合并行或列
  19355. if (mergeBodyFlag && mergeBodyList.length) {
  19356. const spanRest = mergeBodyCellMaps[`${_rowIndex}:${_columnIndex}`];
  19357. if (spanRest) {
  19358. const {
  19359. rowspan,
  19360. colspan
  19361. } = spanRest;
  19362. if (!rowspan || !colspan) {
  19363. return body_renderEmptyElement($xeTable);
  19364. }
  19365. if (rowspan > 1) {
  19366. isMergeCell = true;
  19367. mergeRowspan = rowspan;
  19368. tdAttrs.rowspan = rowspan;
  19369. }
  19370. if (colspan > 1) {
  19371. isMergeCell = true;
  19372. mergeColspan = colspan;
  19373. tdAttrs.colspan = colspan;
  19374. }
  19375. }
  19376. } else if (spanMethod) {
  19377. // 自定义合并行或列的方法
  19378. const {
  19379. rowspan = 1,
  19380. colspan = 1
  19381. } = spanMethod(cellParams) || {};
  19382. if (!rowspan || !colspan) {
  19383. return body_renderEmptyElement($xeTable);
  19384. }
  19385. if (rowspan > 1) {
  19386. isMergeCell = true;
  19387. mergeRowspan = rowspan;
  19388. tdAttrs.rowspan = rowspan;
  19389. }
  19390. if (colspan > 1) {
  19391. isMergeCell = true;
  19392. mergeColspan = colspan;
  19393. tdAttrs.colspan = colspan;
  19394. }
  19395. }
  19396. // 如果被合并不可隐藏
  19397. if (fixedHiddenColumn && isMergeCell) {
  19398. if (tdAttrs.colspan > 1 || tdAttrs.rowspan > 1) {
  19399. fixedHiddenColumn = false;
  19400. }
  19401. }
  19402. // 如果编辑列开启显示状态
  19403. if (!fixedHiddenColumn && editConfig && (editRender || cellRender) && (editOpts.showStatus || editOpts.showUpdateStatus)) {
  19404. isDirty = $xeTable.isUpdateByRow(row, column.field);
  19405. }
  19406. const isVNAutoHeight = !hasEllipsis && (scrollYLoad || scrollXLoad);
  19407. let cellHeight = getCellRestHeight(rowRest, cellOpts, rowOpts, defaultRowHeight);
  19408. const isLastColumn = $columnIndex === columns.length - 1;
  19409. const isAutoCellWidth = !column.resizeWidth && (column.minWidth === 'auto' || column.width === 'auto');
  19410. let isVNPreEmptyStatus = false;
  19411. if (!isMergeCell) {
  19412. if (!dragRow || getRowid($xeTable, dragRow) !== rowid) {
  19413. if (overflowY && scrollYLoad && !treeConfig && tableData.length > 16 && !virtualYOpts.immediate && (_rowIndex < scrollYStore.visibleStartIndex - scrollYStore.preloadSize || _rowIndex > scrollYStore.visibleEndIndex + scrollYStore.preloadSize)) {
  19414. isVNPreEmptyStatus = true;
  19415. } else if (overflowX && scrollXLoad && tableColumn.length > 10 && !virtualXOpts.immediate && !column.fixed && (_columnIndex < scrollXStore.visibleStartIndex - scrollXStore.preloadSize || _columnIndex > scrollXStore.visibleEndIndex + scrollXStore.preloadSize)) {
  19416. isVNPreEmptyStatus = true;
  19417. }
  19418. }
  19419. }
  19420. if (mergeRowspan > 1) {
  19421. const mEndRow = afterFullData[_rowIndex + mergeRowspan - 1];
  19422. if (mEndRow) {
  19423. const meRowRest = fullAllDataRowIdData[getRowid($xeTable, mEndRow)];
  19424. if (meRowRest) {
  19425. cellHeight += meRowRest.oTop + getCellRestHeight(meRowRest, cellOpts, rowOpts, defaultRowHeight) - rowRest.oTop - getCellRestHeight(rowRest, cellOpts, rowOpts, defaultRowHeight);
  19426. }
  19427. }
  19428. }
  19429. const tcStyle = {};
  19430. if (hasEllipsis && resizeWidthFlag) {
  19431. let mergeColWidth = 0;
  19432. if (mergeColspan > 1) {
  19433. for (let index = 1; index < mergeColspan; index++) {
  19434. const nextColumn = visibleColumn[columnIndex + index];
  19435. if (nextColumn) {
  19436. mergeColWidth += nextColumn.renderWidth;
  19437. }
  19438. }
  19439. }
  19440. tcStyle.width = `${column.renderWidth + mergeColWidth - cellOffsetWidth}px`;
  19441. }
  19442. if (scrollYLoad || scrollXLoad || hasEllipsis || isCsHeight || isRsHeight) {
  19443. tcStyle.height = `${cellHeight}px`;
  19444. } else {
  19445. tcStyle.minHeight = `${cellHeight}px`;
  19446. }
  19447. const tdVNs = [];
  19448. if (fixedHiddenColumn && isAllOverflow) {
  19449. tdVNs.push(h('div', {
  19450. key: 'tc',
  19451. class: ['vxe-cell', {
  19452. 'c--title': showTitle,
  19453. 'c--tooltip': showTooltip,
  19454. 'c--ellipsis': showEllipsis
  19455. }],
  19456. style: tcStyle
  19457. }));
  19458. } else {
  19459. // 渲染单元格
  19460. if (treeConfig) {
  19461. tdVNs.push(...renderLine(h, $xeTable, rowid, cellParams, cellHeight));
  19462. }
  19463. tdVNs.push(h('div', {
  19464. key: 'tc',
  19465. class: ['vxe-cell', {
  19466. 'c--title': showTitle,
  19467. 'c--tooltip': showTooltip,
  19468. 'c--ellipsis': showEllipsis
  19469. }],
  19470. style: tcStyle,
  19471. attrs: {
  19472. title: showTitle ? $xeTable.getCellLabel(row, column) : null
  19473. }
  19474. }, isVNPreEmptyStatus ? [] : [h('div', {
  19475. attrs: {
  19476. colid,
  19477. rowid
  19478. },
  19479. class: 'vxe-cell--wrapper vxe-body-cell--wrapper'
  19480. }, column.renderCell(h, cellParams))]));
  19481. if (showValidTip && errorValidItem) {
  19482. const errRule = errorValidItem.rule;
  19483. const validSlot = slots ? slots.valid : null;
  19484. const validParams = {
  19485. ...cellParams,
  19486. ...errorValidItem,
  19487. rule: errorValidItem
  19488. };
  19489. tdVNs.push(h('div', {
  19490. key: 'tcv',
  19491. class: ['vxe-cell--valid-error-tip', getClass(validOpts.className, errorValidItem)],
  19492. style: errRule && errRule.maxWidth ? {
  19493. width: `${errRule.maxWidth}px`
  19494. } : undefined
  19495. }, [h('div', {
  19496. class: `vxe-cell--valid-error-wrapper vxe-cell--valid-error-theme-${validOpts.theme || 'normal'}`
  19497. }, [validSlot ? $xeTable.callSlot(validSlot, validParams, h) : [h('span', {
  19498. class: 'vxe-cell--valid-error-msg'
  19499. }, errorValidItem.content)]])]));
  19500. }
  19501. }
  19502. let showAreaRowStatus = false;
  19503. if (mouseConfig && mouseOpts.area && !_columnIndex && selectCellToRow) {
  19504. showAreaRowStatus = true;
  19505. }
  19506. if (!fixedHiddenColumn && showResizable && isAllColumnDrag) {
  19507. tdVNs.push(h('div', {
  19508. key: 'tcc',
  19509. class: ['vxe-cell--col-resizable', {
  19510. 'is--line': !border || border === 'none'
  19511. }],
  19512. on: {
  19513. mousedown: evnt => $xeTable.handleColResizeMousedownEvent(evnt, fixedType, cellParams),
  19514. dblclick: evnt => $xeTable.handleColResizeDblclickEvent(evnt, cellParams)
  19515. }
  19516. }));
  19517. }
  19518. if ((rowResize || isAllRowDrag) && rowOpts.resizable) {
  19519. tdVNs.push(h('div', {
  19520. key: 'tcr',
  19521. class: 'vxe-cell--row-resizable',
  19522. on: {
  19523. mousedown: evnt => $xeTable.handleRowResizeMousedownEvent(evnt, cellParams),
  19524. dblclick: evnt => $xeTable.handleRowResizeDblclickEvent(evnt, cellParams)
  19525. }
  19526. }));
  19527. }
  19528. return h('td', {
  19529. class: ['vxe-table--column vxe-body--column', colid, cellVerticalAlign ? `col--vertical-${cellVerticalAlign}` : '', cellAlign ? `col--${cellAlign}` : '', type ? `col--${type}` : '', {
  19530. 'col--last': isLastColumn,
  19531. 'col--tree-node': treeNode,
  19532. 'col--edit': isEdit,
  19533. 'col--ellipsis': hasEllipsis,
  19534. 'col--cs-height': isCsHeight,
  19535. 'col--rs-height': isRsHeight,
  19536. 'col--to-row': showAreaRowStatus,
  19537. 'col--auto-height': isVNAutoHeight,
  19538. 'fixed--width': !isAutoCellWidth,
  19539. 'fixed--hidden': fixedHiddenColumn,
  19540. 'is--padding': isCellPadding,
  19541. 'is--progress': fixedHiddenColumn && isAllOverflow || isVNPreEmptyStatus,
  19542. 'is--drag-cell': isRowDragCell && (isCrossDrag || isPeerDrag || !rowLevel),
  19543. 'is--drag-disabled': isDisabledDrag,
  19544. 'col--dirty': isDirty,
  19545. 'col--active': editConfig && isEdit && actived.row === row && (actived.column === column || editOpts.mode === 'row'),
  19546. 'col--valid-error': !!errorValidItem,
  19547. 'col--current': currentColumn === column
  19548. }, getClass(compCellClassName, cellParams), getClass(className, cellParams), getClass(allCellClassName, cellParams)],
  19549. key: columnKey || scrollXLoad || scrollYLoad || columnOpts.useKey || rowOpts.useKey || columnOpts.drag ? column.id : $columnIndex,
  19550. attrs: tdAttrs,
  19551. style: Object.assign({}, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(compCellStyle) ? compCellStyle(cellParams) : compCellStyle, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(cellStyle) ? cellStyle(cellParams) : cellStyle),
  19552. on: tdOns
  19553. }, isOptimizeMode && fixedHiddenColumn ? [] : tdVNs);
  19554. }
  19555. function renderRows(h, _vm, fixedType, isOptimizeMode, tableData, tableColumn) {
  19556. const $xeTable = _vm.$parent;
  19557. const tableProps = $xeTable;
  19558. const tableReactData = $xeTable;
  19559. const tableInternalData = $xeTable;
  19560. const $xeGrid = $xeTable.$xeGrid;
  19561. const $xeGantt = $xeTable.$xeGantt;
  19562. const {
  19563. stripe,
  19564. rowKey,
  19565. highlightHoverRow,
  19566. rowClassName,
  19567. rowStyle,
  19568. editConfig,
  19569. treeConfig
  19570. } = tableProps;
  19571. const {
  19572. hasFixedColumn,
  19573. treeExpandedFlag,
  19574. scrollXLoad,
  19575. scrollYLoad,
  19576. isAllOverflow,
  19577. rowExpandedFlag,
  19578. expandColumn,
  19579. selectRadioRow,
  19580. pendingRowFlag,
  19581. rowExpandHeightFlag,
  19582. isRowGroupStatus
  19583. } = tableReactData;
  19584. const {
  19585. fullAllDataRowIdData,
  19586. fullColumnIdData,
  19587. treeExpandedMaps,
  19588. pendingRowMaps,
  19589. rowExpandedMaps
  19590. } = tableInternalData;
  19591. const checkboxOpts = $xeTable.computeCheckboxOpts;
  19592. const radioOpts = $xeTable.computeRadioOpts;
  19593. const treeOpts = $xeTable.computeTreeOpts;
  19594. const editOpts = $xeTable.computeEditOpts;
  19595. const rowOpts = $xeTable.computeRowOpts;
  19596. const columnOpts = $xeTable.computeColumnOpts;
  19597. const {
  19598. transform,
  19599. seqMode
  19600. } = treeOpts;
  19601. const childrenField = treeOpts.children || treeOpts.childrenField;
  19602. const rows = [];
  19603. const {
  19604. handleGetRowId
  19605. } = createHandleGetRowId($xeTable);
  19606. const isDeepRow = treeConfig || isRowGroupStatus;
  19607. tableData.forEach((row, $rowIndex) => {
  19608. const trOn = {};
  19609. const rowid = handleGetRowId(row);
  19610. const rowRest = fullAllDataRowIdData[rowid] || {};
  19611. let rowIndex = $rowIndex;
  19612. let rowLevel = 0;
  19613. let seq = -1;
  19614. let _rowIndex = -1;
  19615. const hasRowGroupAggregate = isRowGroupStatus && row.isAggregate;
  19616. // 当前行事件
  19617. if (rowOpts.isHover || highlightHoverRow) {
  19618. trOn.mouseover = evnt => {
  19619. if (isVMScrollProcess($xeTable)) {
  19620. return;
  19621. }
  19622. $xeTable.triggerHoverEvent(evnt, {
  19623. row,
  19624. rowIndex
  19625. });
  19626. };
  19627. trOn.mouseleave = () => {
  19628. if (isVMScrollProcess($xeTable)) {
  19629. return;
  19630. }
  19631. $xeTable.clearHoverRow();
  19632. };
  19633. }
  19634. if (rowRest) {
  19635. rowIndex = rowRest.index;
  19636. _rowIndex = rowRest._index;
  19637. rowLevel = rowRest.level;
  19638. seq = rowRest.seq;
  19639. if (hasRowGroupAggregate || treeConfig && transform && seqMode === 'increasing') {
  19640. seq = rowRest._index + 1;
  19641. } else if (treeConfig && seqMode === 'fixed') {
  19642. seq = rowRest._tIndex + 1;
  19643. }
  19644. }
  19645. const params = {
  19646. $table: $xeTable,
  19647. seq,
  19648. rowid,
  19649. fixed: fixedType,
  19650. type: renderType,
  19651. level: rowLevel,
  19652. row,
  19653. rowIndex,
  19654. $rowIndex,
  19655. _rowIndex
  19656. };
  19657. // 行是否被展开
  19658. const isExpandRow = expandColumn && !!rowExpandedFlag && !!rowExpandedMaps[rowid];
  19659. // 树节点是否被展开
  19660. let isExpandTree = false;
  19661. let rowChildren = [];
  19662. // 是否新增行
  19663. let isNewRow = false;
  19664. if (editConfig) {
  19665. isNewRow = $xeTable.isInsertByRow(row);
  19666. }
  19667. if (treeConfig && !scrollYLoad && !transform) {
  19668. rowChildren = row[childrenField];
  19669. isExpandTree = !!treeExpandedFlag && rowChildren && rowChildren.length > 0 && !!treeExpandedMaps[rowid];
  19670. }
  19671. // 拖拽行事件
  19672. if (rowOpts.drag && !isRowGroupStatus && (!treeConfig || transform)) {
  19673. trOn.dragstart = $xeTable.handleRowDragDragstartEvent;
  19674. trOn.dragend = $xeTable.handleRowDragDragendEvent;
  19675. trOn.dragover = $xeTable.handleRowDragDragoverEvent;
  19676. }
  19677. const trClass = ['vxe-body--row', isDeepRow ? `row--level-${rowLevel}` : '', {
  19678. 'row--stripe': stripe && (_rowIndex + 1) % 2 === 0,
  19679. 'is--new': isNewRow,
  19680. 'is--expand-row': isExpandRow,
  19681. 'is--expand-tree': isExpandTree,
  19682. 'row--new': isNewRow && (editOpts.showStatus || editOpts.showInsertStatus),
  19683. 'row--radio': radioOpts.highlight && selectRadioRow === row,
  19684. 'row--checked': checkboxOpts.highlight && $xeTable.isCheckedByCheckboxRow(row),
  19685. 'row--pending': !!pendingRowFlag && !!pendingRowMaps[rowid],
  19686. 'row--group': hasRowGroupAggregate
  19687. }, rowClassName ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(rowClassName) ? rowClassName(params) : rowClassName : ''];
  19688. const tdVNs = tableColumn.map((column, $columnIndex) => {
  19689. return renderTdColumn(h, $xeTable, seq, rowid, fixedType, isOptimizeMode, rowLevel, row, rowIndex, $rowIndex, _rowIndex, column, $columnIndex, tableColumn, tableData);
  19690. });
  19691. rows.push(h('tr', {
  19692. class: trClass,
  19693. attrs: {
  19694. rowid
  19695. },
  19696. style: rowStyle ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(rowStyle) ? rowStyle(params) : rowStyle : undefined,
  19697. key: rowKey || scrollXLoad || scrollYLoad || rowOpts.useKey || rowOpts.drag || columnOpts.drag || isRowGroupStatus || treeConfig ? rowid : $rowIndex,
  19698. on: trOn
  19699. }, tdVNs));
  19700. // 如果行被展开了
  19701. if (isExpandRow) {
  19702. const expandOpts = $xeTable.computeExpandOpts;
  19703. const {
  19704. height: expandHeight,
  19705. padding,
  19706. mode: expandMode
  19707. } = expandOpts;
  19708. if (expandMode === 'fixed') {
  19709. rows.push(h('tr', {
  19710. class: 'vxe-body--row-expanded-place',
  19711. key: `expand_${rowid}`,
  19712. attrs: {
  19713. rowid
  19714. }
  19715. }, [h('td', {
  19716. class: 'vxe-body--row-expanded-place-column',
  19717. attrs: {
  19718. colspan: tableColumn.length
  19719. },
  19720. style: {
  19721. height: `${rowExpandHeightFlag ? rowRest.expandHeight || expandHeight : 0}px`
  19722. }
  19723. })]));
  19724. } else {
  19725. const cellStyle = {};
  19726. if (expandHeight) {
  19727. cellStyle.height = `${expandHeight}px`;
  19728. }
  19729. if (treeConfig) {
  19730. cellStyle.paddingLeft = `${rowLevel * treeOpts.indent + 30}px`;
  19731. }
  19732. const {
  19733. showOverflow
  19734. } = expandColumn || {};
  19735. const colid = expandColumn.id;
  19736. const colRest = fullColumnIdData[colid] || {};
  19737. const hasEllipsis = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(showOverflow) ? isAllOverflow : showOverflow;
  19738. let columnIndex = -1;
  19739. let $columnIndex = -1;
  19740. let _columnIndex = -1;
  19741. if (colRest) {
  19742. columnIndex = colRest.index;
  19743. $columnIndex = colRest.$index;
  19744. _columnIndex = colRest._index;
  19745. }
  19746. const expandParams = {
  19747. $grid: $xeGrid,
  19748. $table: $xeTable,
  19749. $gantt: $xeGantt,
  19750. seq,
  19751. column: expandColumn,
  19752. columnIndex,
  19753. $columnIndex,
  19754. _columnIndex,
  19755. fixed: fixedType,
  19756. source: sourceType,
  19757. type: renderType,
  19758. level: rowLevel,
  19759. row,
  19760. rowid,
  19761. rowIndex,
  19762. $rowIndex,
  19763. _rowIndex,
  19764. isHidden: false,
  19765. isEdit: false,
  19766. visibleData: [],
  19767. data: [],
  19768. items: []
  19769. };
  19770. rows.push(h('tr', {
  19771. class: ['vxe-body--expanded-row', {
  19772. 'is--padding': padding
  19773. }],
  19774. key: `expand_${rowid}`
  19775. }, [h('td', {
  19776. class: ['vxe-body--expanded-column', {
  19777. 'fixed--hidden': fixedType && !hasFixedColumn,
  19778. 'col--ellipsis': hasEllipsis
  19779. }],
  19780. attrs: {
  19781. colspan: tableColumn.length
  19782. }
  19783. }, [h('div', {
  19784. class: ['vxe-body--expanded-cell', {
  19785. 'is--ellipsis': expandHeight
  19786. }],
  19787. style: cellStyle
  19788. }, [expandColumn.renderData(h, expandParams)])])]));
  19789. }
  19790. }
  19791. // 如果是树形表格
  19792. if (isExpandTree) {
  19793. rows.push(...renderRows(h, _vm, fixedType, isOptimizeMode, rowChildren, tableColumn));
  19794. }
  19795. });
  19796. return rows;
  19797. }
  19798. /* harmony default export */ var body = ({
  19799. name: 'VxeTableBody',
  19800. props: {
  19801. tableData: Array,
  19802. tableColumn: Array,
  19803. fixedColumn: Array,
  19804. fixedType: {
  19805. type: String,
  19806. default: ''
  19807. }
  19808. },
  19809. mounted() {
  19810. const _vm = this;
  19811. const props = _vm;
  19812. const $xeTable = _vm.$parent;
  19813. const tableInternalData = $xeTable;
  19814. const {
  19815. fixedType
  19816. } = props;
  19817. const {
  19818. elemStore
  19819. } = tableInternalData;
  19820. const prefix = `${fixedType || 'main'}-body-`;
  19821. elemStore[`${prefix}wrapper`] = _vm.$refs.refElem;
  19822. elemStore[`${prefix}scroll`] = _vm.$refs.refBodyScroll;
  19823. elemStore[`${prefix}table`] = _vm.$refs.refBodyTable;
  19824. elemStore[`${prefix}colgroup`] = _vm.$refs.refBodyColgroup;
  19825. elemStore[`${prefix}list`] = _vm.$refs.refBodyTBody;
  19826. elemStore[`${prefix}xSpace`] = _vm.$refs.refBodyXSpace;
  19827. elemStore[`${prefix}ySpace`] = _vm.$refs.refBodyYSpace;
  19828. elemStore[`${prefix}emptyBlock`] = _vm.$refs.refBodyEmptyBlock;
  19829. },
  19830. destroyed() {
  19831. const props = this;
  19832. const $xeTable = this.$parent;
  19833. const tableInternalData = $xeTable;
  19834. const {
  19835. fixedType
  19836. } = props;
  19837. const {
  19838. elemStore
  19839. } = tableInternalData;
  19840. const prefix = `${fixedType || 'main'}-body-`;
  19841. elemStore[`${prefix}wrapper`] = null;
  19842. elemStore[`${prefix}scroll`] = null;
  19843. elemStore[`${prefix}table`] = null;
  19844. elemStore[`${prefix}colgroup`] = null;
  19845. elemStore[`${prefix}list`] = null;
  19846. elemStore[`${prefix}xSpace`] = null;
  19847. elemStore[`${prefix}ySpace`] = null;
  19848. elemStore[`${prefix}emptyBlock`] = null;
  19849. },
  19850. render(h) {
  19851. const props = this;
  19852. const $xeTable = this.$parent;
  19853. const tableProps = $xeTable;
  19854. const tableReactData = $xeTable;
  19855. const tableInternalData = $xeTable;
  19856. const $xeGrid = $xeTable.$xeGrid;
  19857. const $xeGantt = $xeTable.$xeGantt;
  19858. const slots = $xeTable.$scopedSlots;
  19859. const {
  19860. xID
  19861. } = $xeTable;
  19862. const {
  19863. fixedColumn,
  19864. fixedType,
  19865. tableColumn
  19866. } = props;
  19867. const {
  19868. spanMethod,
  19869. footerSpanMethod,
  19870. mouseConfig
  19871. } = tableProps;
  19872. const {
  19873. isGroup,
  19874. tableData,
  19875. isColLoading,
  19876. overflowX,
  19877. scrollXLoad,
  19878. scrollYLoad,
  19879. isAllOverflow,
  19880. expandColumn,
  19881. dragRow,
  19882. dragCol
  19883. } = tableReactData;
  19884. const {
  19885. visibleColumn,
  19886. fullAllDataRowIdData,
  19887. fullColumnIdData
  19888. } = tableInternalData;
  19889. const emptyOpts = $xeTable.computeEmptyOpts;
  19890. const mouseOpts = $xeTable.computeMouseOpts;
  19891. const expandOpts = $xeTable.computeExpandOpts;
  19892. let renderDataList = tableData;
  19893. let renderColumnList = tableColumn;
  19894. let isOptimizeMode = false;
  19895. // 如果是使用优化模式
  19896. if (scrollXLoad || scrollYLoad || isAllOverflow) {
  19897. if (expandColumn && expandOpts.mode !== 'fixed' || spanMethod || footerSpanMethod) {
  19898. // 如果不支持优化模式
  19899. } else {
  19900. isOptimizeMode = true;
  19901. }
  19902. }
  19903. if (!isColLoading && (fixedType || !overflowX)) {
  19904. renderColumnList = visibleColumn;
  19905. }
  19906. if (fixedType) {
  19907. if (isOptimizeMode) {
  19908. renderColumnList = fixedColumn || [];
  19909. }
  19910. }
  19911. // 行拖拽
  19912. if (scrollYLoad && dragRow) {
  19913. if (renderDataList.length > 2) {
  19914. const dRowRest = fullAllDataRowIdData[getRowid($xeTable, dragRow)];
  19915. if (dRowRest) {
  19916. const drIndex = dRowRest._index;
  19917. const firstRow = renderDataList[0];
  19918. const lastRow = renderDataList[renderDataList.length - 1];
  19919. const firstRowRest = fullAllDataRowIdData[getRowid($xeTable, firstRow)];
  19920. const lastRowRest = fullAllDataRowIdData[getRowid($xeTable, lastRow)];
  19921. if (firstRowRest && lastRowRest) {
  19922. const frIndex = firstRowRest._index;
  19923. const lrIndex = lastRowRest._index;
  19924. if (drIndex < frIndex) {
  19925. renderDataList = [dragRow].concat(renderDataList);
  19926. } else if (drIndex > lrIndex) {
  19927. renderDataList = renderDataList.concat([dragRow]);
  19928. }
  19929. }
  19930. }
  19931. }
  19932. }
  19933. if (!fixedType && !isGroup) {
  19934. // 列拖拽
  19935. if (scrollXLoad && dragCol) {
  19936. if (renderColumnList.length > 2) {
  19937. const dCowRest = fullColumnIdData[dragCol.id];
  19938. if (dCowRest) {
  19939. const dcIndex = dCowRest._index;
  19940. const firstCol = renderColumnList[0];
  19941. const lastCol = renderColumnList[renderColumnList.length - 1];
  19942. const firstColRest = fullColumnIdData[firstCol.id];
  19943. const lastColRest = fullColumnIdData[lastCol.id];
  19944. if (firstColRest && lastColRest) {
  19945. const fcIndex = firstColRest._index;
  19946. const lcIndex = lastColRest._index;
  19947. if (dcIndex < fcIndex) {
  19948. renderColumnList = [dragCol].concat(renderColumnList);
  19949. } else if (dcIndex > lcIndex) {
  19950. renderColumnList = renderColumnList.concat([dragCol]);
  19951. }
  19952. }
  19953. }
  19954. }
  19955. }
  19956. }
  19957. let emptyContent;
  19958. const emptySlot = slots ? slots.empty : null;
  19959. const emptyParams = {
  19960. $table: $xeTable,
  19961. $grid: $xeGrid,
  19962. $gantt: $xeGantt
  19963. };
  19964. if (emptySlot) {
  19965. emptyContent = emptySlot.call($xeTable, emptyParams);
  19966. } else {
  19967. const compConf = emptyOpts.name ? body_renderer.get(emptyOpts.name) : null;
  19968. const rtEmptyView = compConf ? compConf.renderTableEmpty || compConf.renderTableEmptyView || compConf.renderEmpty : null;
  19969. if (rtEmptyView) {
  19970. emptyContent = getSlotVNs(rtEmptyView.call($xeTable, h, emptyOpts, emptyParams));
  19971. } else {
  19972. emptyContent = tableProps.emptyText || body_getI18n('vxe.table.emptyText');
  19973. }
  19974. }
  19975. const ons = {
  19976. scroll(evnt) {
  19977. $xeTable.triggerBodyScrollEvent(evnt, fixedType);
  19978. }
  19979. };
  19980. return h('div', {
  19981. ref: 'refElem',
  19982. class: ['vxe-table--body-wrapper', fixedType ? `fixed-${fixedType}--wrapper` : 'body--wrapper'],
  19983. attrs: {
  19984. xid: xID
  19985. }
  19986. }, [h('div', {
  19987. ref: 'refBodyScroll',
  19988. class: 'vxe-table--body-inner-wrapper',
  19989. on: ons
  19990. }, [fixedType ? body_renderEmptyElement($xeTable) : h('div', {
  19991. ref: 'refBodyXSpace',
  19992. class: 'vxe-body--x-space'
  19993. }), h('div', {
  19994. ref: 'refBodyYSpace',
  19995. class: 'vxe-body--y-space'
  19996. }), h('table', {
  19997. ref: 'refBodyTable',
  19998. class: 'vxe-table--body',
  19999. attrs: {
  20000. xid: xID,
  20001. cellspacing: 0,
  20002. cellpadding: 0,
  20003. border: 0,
  20004. xvm: isOptimizeMode ? '1' : null
  20005. }
  20006. }, [
  20007. /**
  20008. * 列宽
  20009. */
  20010. h('colgroup', {
  20011. ref: 'refBodyColgroup'
  20012. }, renderColumnList.map((column, $columnIndex) => {
  20013. return h('col', {
  20014. attrs: {
  20015. name: column.id
  20016. },
  20017. key: $columnIndex,
  20018. style: {
  20019. width: `${column.renderWidth}px`
  20020. }
  20021. });
  20022. })),
  20023. /**
  20024. * 内容
  20025. */
  20026. h('tbody', {
  20027. ref: 'refBodyTBody'
  20028. }, renderRows(h, this, fixedType, isOptimizeMode, renderDataList, renderColumnList))]), h('div', {
  20029. class: 'vxe-table--checkbox-range'
  20030. }), mouseConfig && mouseOpts.area ? h('div', {
  20031. class: 'vxe-table--cell-area',
  20032. attrs: {
  20033. xid: xID
  20034. }
  20035. }, [h('span', {
  20036. class: 'vxe-table--cell-main-area'
  20037. }, mouseOpts.extension ? [h('span', {
  20038. class: 'vxe-table--cell-main-area-btn',
  20039. on: {
  20040. mousedown(evnt) {
  20041. if ($xeTable.triggerCellAreaExtendMousedownEvent) {
  20042. $xeTable.triggerCellAreaExtendMousedownEvent(evnt, {
  20043. $table: $xeTable,
  20044. fixed: fixedType,
  20045. type: renderType
  20046. });
  20047. }
  20048. }
  20049. }
  20050. })] : null), h('span', {
  20051. class: 'vxe-table--cell-clip-area'
  20052. }), h('span', {
  20053. class: 'vxe-table--cell-extend-area'
  20054. }), h('span', {
  20055. class: 'vxe-table--cell-multi-area'
  20056. }), h('span', {
  20057. class: 'vxe-table--cell-active-area'
  20058. }), h('span', {
  20059. class: 'vxe-table--cell-row-status-area'
  20060. })]) : body_renderEmptyElement($xeTable), !fixedType ? h('div', {
  20061. class: 'vxe-table--empty-block',
  20062. ref: 'emptyBlock'
  20063. }, [h('div', {
  20064. class: 'vxe-table--empty-content'
  20065. }, emptyContent)]) : body_renderEmptyElement($xeTable)])]);
  20066. }
  20067. });
  20068. ;// CONCATENATED MODULE: ./packages/table/src/header.ts
  20069. const {
  20070. renderer: header_renderer,
  20071. renderEmptyElement: header_renderEmptyElement
  20072. } = core_.VxeUI;
  20073. const header_sourceType = 'table';
  20074. const header_renderType = 'header';
  20075. function getColumnFirstChild(column) {
  20076. const {
  20077. children
  20078. } = column;
  20079. if (children && children.length) {
  20080. return getColumnFirstChild(children[0]);
  20081. }
  20082. return column;
  20083. }
  20084. function getColumnLastChild(column) {
  20085. const {
  20086. children
  20087. } = column;
  20088. if (children && children.length) {
  20089. return getColumnLastChild(children[children.length - 1]);
  20090. }
  20091. return column;
  20092. }
  20093. function header_renderRows(h, _vm, isGroup, isOptimizeMode, headerGroups, $rowIndex, cols) {
  20094. const props = _vm;
  20095. const $xeTable = _vm.$parent;
  20096. const $xeGrid = $xeTable.$xeGrid;
  20097. const $xeGantt = $xeTable.$xeGantt;
  20098. const tableProps = $xeTable;
  20099. const tableReactData = $xeTable;
  20100. const tableInternalData = $xeTable;
  20101. const {
  20102. fixedType
  20103. } = props;
  20104. const {
  20105. resizable: allResizable,
  20106. columnKey,
  20107. showCustomHeader,
  20108. headerCellClassName,
  20109. headerCellStyle,
  20110. showHeaderOverflow: allColumnHeaderOverflow,
  20111. headerAlign: allHeaderAlign,
  20112. align: allAlign,
  20113. mouseConfig
  20114. } = tableProps;
  20115. const {
  20116. currentColumn,
  20117. dragCol,
  20118. scrollXLoad,
  20119. scrollYLoad,
  20120. overflowX,
  20121. mergeHeadFlag,
  20122. tableColumn
  20123. } = tableReactData;
  20124. const {
  20125. fullColumnIdData,
  20126. scrollXStore,
  20127. mergeHeaderList,
  20128. mergeHeaderCellMaps
  20129. } = tableInternalData;
  20130. const virtualXOpts = $xeTable.computeVirtualXOpts;
  20131. const columnOpts = $xeTable.computeColumnOpts;
  20132. const columnDragOpts = $xeTable.computeColumnDragOpts;
  20133. const cellOpts = $xeTable.computeCellOpts;
  20134. const defaultRowHeight = $xeTable.computeDefaultRowHeight;
  20135. const headerCellOpts = $xeTable.computeHeaderCellOpts;
  20136. const currCellHeight = getCalcHeight(headerCellOpts.height) || defaultRowHeight;
  20137. const {
  20138. disabledMethod: dragDisabledMethod,
  20139. isCrossDrag,
  20140. isPeerDrag
  20141. } = columnDragOpts;
  20142. const isLastRow = $rowIndex === headerGroups.length - 1;
  20143. return cols.map((column, $columnIndex) => {
  20144. const {
  20145. type,
  20146. showHeaderOverflow,
  20147. headerAlign,
  20148. align,
  20149. filters,
  20150. headerClassName,
  20151. editRender,
  20152. cellRender
  20153. } = column;
  20154. // const { enabled } = tooltipOpts
  20155. const colid = column.id;
  20156. const colRest = fullColumnIdData[colid] || {};
  20157. const renderOpts = editRender || cellRender;
  20158. const compConf = renderOpts ? header_renderer.get(renderOpts.name) : null;
  20159. const isColGroup = column.children && column.children.length;
  20160. const fixedHiddenColumn = overflowX && !isColGroup && (fixedType ? column.fixed !== fixedType : !!column.fixed);
  20161. const isPadding = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isBoolean(headerCellOpts.padding) ? headerCellOpts.padding : cellOpts.padding;
  20162. const headOverflow = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isUndefined(showHeaderOverflow) || external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNull(showHeaderOverflow) ? allColumnHeaderOverflow : showHeaderOverflow;
  20163. const headAlign = headerAlign || (compConf ? compConf.tableHeaderCellAlign : '') || allHeaderAlign || align || (compConf ? compConf.tableCellAlign : '') || allAlign;
  20164. const showEllipsis = headOverflow === 'ellipsis';
  20165. const showTitle = headOverflow === 'title';
  20166. const showTooltip = headOverflow === true || headOverflow === 'tooltip';
  20167. const hasEllipsis = showTitle || showTooltip || showEllipsis;
  20168. let hasFilter = false;
  20169. let firstFilterOption = null;
  20170. if (filters) {
  20171. firstFilterOption = filters[0];
  20172. hasFilter = filters.some(item => item.checked);
  20173. }
  20174. const columnIndex = colRest.index;
  20175. const _columnIndex = showCustomHeader ? $columnIndex : colRest._index;
  20176. const cellParams = {
  20177. $table: $xeTable,
  20178. $grid: $xeGrid,
  20179. $gantt: $xeGantt,
  20180. $rowIndex,
  20181. column,
  20182. columnIndex,
  20183. $columnIndex,
  20184. _columnIndex,
  20185. firstFilterOption: firstFilterOption,
  20186. fixed: fixedType,
  20187. source: header_sourceType,
  20188. type: header_renderType,
  20189. isHidden: fixedHiddenColumn,
  20190. hasFilter
  20191. };
  20192. const thAttrs = {
  20193. colid
  20194. };
  20195. let isMergeCell = false;
  20196. // 合并行或列
  20197. if (!showCustomHeader) {
  20198. thAttrs.colspan = column.colSpan > 1 ? column.colSpan : null;
  20199. thAttrs.rowspan = column.rowSpan > 1 ? column.rowSpan : null;
  20200. }
  20201. if (mergeHeadFlag && mergeHeaderList.length && (showCustomHeader || isLastRow)) {
  20202. const spanRest = mergeHeaderCellMaps[`${$rowIndex}:${showCustomHeader ? $columnIndex : _columnIndex}`];
  20203. if (spanRest) {
  20204. const {
  20205. rowspan,
  20206. colspan
  20207. } = spanRest;
  20208. if (!rowspan || !colspan) {
  20209. return null;
  20210. }
  20211. if (rowspan > 1) {
  20212. isMergeCell = true;
  20213. thAttrs.rowspan = rowspan;
  20214. }
  20215. if (colspan > 1) {
  20216. isMergeCell = true;
  20217. thAttrs.colspan = colspan;
  20218. }
  20219. }
  20220. }
  20221. const thOns = {
  20222. click: evnt => $xeTable.triggerHeaderCellClickEvent(evnt, cellParams),
  20223. dblclick: evnt => $xeTable.triggerHeaderCellDblclickEvent(evnt, cellParams)
  20224. };
  20225. const isColDragCell = columnOpts.drag && columnDragOpts.trigger === 'cell';
  20226. let isDisabledDrag = false;
  20227. if (isColDragCell) {
  20228. isDisabledDrag = !!(dragDisabledMethod && dragDisabledMethod(cellParams));
  20229. }
  20230. // 按下事件处理
  20231. if (mouseConfig || isColDragCell) {
  20232. thOns.mousedown = evnt => $xeTable.triggerHeaderCellMousedownEvent(evnt, cellParams);
  20233. }
  20234. // 拖拽列事件
  20235. if (columnOpts.drag) {
  20236. thOns.dragstart = $xeTable.handleHeaderCellDragDragstartEvent;
  20237. thOns.dragend = $xeTable.handleHeaderCellDragDragendEvent;
  20238. thOns.dragover = $xeTable.handleHeaderCellDragDragoverEvent;
  20239. if (isColDragCell) {
  20240. thOns.mouseup = $xeTable.handleHeaderCellDragMouseupEvent;
  20241. }
  20242. }
  20243. const isLastColumn = $columnIndex === cols.length - 1;
  20244. const showResizable = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isBoolean(column.resizable) ? column.resizable : columnOpts.resizable || allResizable;
  20245. const isAutoCellWidth = !column.resizeWidth && (column.minWidth === 'auto' || column.width === 'auto');
  20246. let isVNPreEmptyStatus = false;
  20247. if (isOptimizeMode && overflowX && !isGroup && !isMergeCell) {
  20248. if (!dragCol || dragCol.id !== colid) {
  20249. if (scrollXLoad && tableColumn.length > 10 && !column.fixed && !virtualXOpts.immediate && (_columnIndex < scrollXStore.visibleStartIndex - scrollXStore.preloadSize || _columnIndex > scrollXStore.visibleEndIndex + scrollXStore.preloadSize)) {
  20250. isVNPreEmptyStatus = true;
  20251. }
  20252. }
  20253. }
  20254. const tcStyle = {};
  20255. if (hasEllipsis) {
  20256. tcStyle.height = `${currCellHeight}px`;
  20257. } else {
  20258. tcStyle.minHeight = `${currCellHeight}px`;
  20259. }
  20260. if (showCustomHeader) {
  20261. // custom
  20262. } else if (isColGroup && !isLastRow) {
  20263. const firstCol = getColumnFirstChild(column);
  20264. const lastCol = getColumnLastChild(column);
  20265. if (firstCol && lastCol && firstCol.id !== lastCol.id) {
  20266. const firstColRest = fullColumnIdData[firstCol.id];
  20267. const lastColRest = fullColumnIdData[lastCol.id];
  20268. if (firstColRest && lastColRest) {
  20269. tcStyle.width = `${lastColRest.oLeft - firstColRest.oLeft + lastCol.renderWidth}px`;
  20270. }
  20271. }
  20272. }
  20273. return h('th', {
  20274. class: ['vxe-table--column vxe-header--column', colid, fixedHiddenColumn ? 'fixed--hidden' : 'fixed--visible', {
  20275. [`col--${headAlign}`]: headAlign,
  20276. [`col--${type}`]: type,
  20277. 'col--last': isLastColumn,
  20278. 'col--fixed': column.fixed,
  20279. 'col--group': isColGroup,
  20280. 'col--ellipsis': hasEllipsis,
  20281. 'fixed--width': !isAutoCellWidth,
  20282. 'is--padding': isPadding,
  20283. 'is--sortable': column.sortable,
  20284. 'col--filter': !!filters,
  20285. 'is--filter-active': hasFilter,
  20286. 'is--drag-active': columnOpts.drag && !column.fixed && !isDisabledDrag && (isCrossDrag || isPeerDrag || !column.parentId),
  20287. 'is--drag-disabled': columnOpts.drag && isDisabledDrag,
  20288. 'col--current': currentColumn === column
  20289. }, getClass(headerClassName, cellParams), getClass(headerCellClassName, cellParams)],
  20290. attrs: thAttrs,
  20291. style: headerCellStyle ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(headerCellStyle) ? headerCellStyle(cellParams) : headerCellStyle : undefined,
  20292. on: thOns,
  20293. key: showCustomHeader ? `${colid}${$columnIndex}` : columnKey || scrollXLoad || scrollYLoad || columnOpts.useKey || columnOpts.drag || isColGroup ? colid : $columnIndex
  20294. }, [h('div', {
  20295. class: ['vxe-cell', {
  20296. 'c--title': showTitle,
  20297. 'c--tooltip': showTooltip,
  20298. 'c--ellipsis': showEllipsis
  20299. }],
  20300. style: tcStyle
  20301. }, isVNPreEmptyStatus || isOptimizeMode && fixedHiddenColumn ? [] : [h('div', {
  20302. attrs: {
  20303. colid
  20304. },
  20305. class: 'vxe-cell--wrapper vxe-header-cell--wrapper'
  20306. }, column.renderHeader(h, cellParams))]),
  20307. /**
  20308. * 列宽拖动
  20309. */
  20310. !fixedHiddenColumn && showResizable && (!showCustomHeader || isLastRow) ? h('div', {
  20311. class: 'vxe-cell--col-resizable',
  20312. on: {
  20313. mousedown: evnt => $xeTable.handleColResizeMousedownEvent(evnt, fixedType, cellParams),
  20314. dblclick: evnt => $xeTable.handleColResizeDblclickEvent(evnt, cellParams)
  20315. }
  20316. }) : header_renderEmptyElement($xeTable)]);
  20317. });
  20318. }
  20319. function renderFilterRows(h, _vm, isOptimizeMode, cols) {
  20320. const props = _vm;
  20321. const $xeTable = _vm.$parent;
  20322. const $xeGrid = $xeTable.$xeGrid;
  20323. const $xeGantt = $xeTable.$xeGantt;
  20324. const tableProps = $xeTable;
  20325. const tableReactData = $xeTable;
  20326. const tableInternalData = $xeTable;
  20327. const {
  20328. fixedType
  20329. } = props;
  20330. const {
  20331. showHeaderOverflow: allColumnHeaderOverflow,
  20332. headerAlign: allHeaderAlign,
  20333. align: allAlign
  20334. } = tableProps;
  20335. const {
  20336. currentColumn,
  20337. overflowX
  20338. } = tableReactData;
  20339. const {
  20340. fullColumnIdData
  20341. } = tableInternalData;
  20342. const cellOpts = $xeTable.computeCellOpts;
  20343. const defaultRowHeight = $xeTable.computeDefaultRowHeight;
  20344. const headerCellOpts = $xeTable.computeHeaderCellOpts;
  20345. const currCellHeight = getCalcHeight(headerCellOpts.height) || defaultRowHeight;
  20346. return cols.map((column, $columnIndex) => {
  20347. const {
  20348. type,
  20349. showHeaderOverflow,
  20350. headerAlign,
  20351. align,
  20352. filters,
  20353. editRender,
  20354. cellRender,
  20355. floatingFilters,
  20356. filterRender,
  20357. slots
  20358. } = column;
  20359. const colid = column.id;
  20360. const colRest = fullColumnIdData[colid] || {};
  20361. const renderOpts = editRender || cellRender;
  20362. const compConf = renderOpts ? header_renderer.get(renderOpts.name) : null;
  20363. const flCompConf = isEnableConf(filterRender) ? header_renderer.get(filterRender.name) : null;
  20364. const rtFloatingFilter = flCompConf ? flCompConf.renderTableFloatingFilter : null;
  20365. const flSlot = slots ? slots.floatingFilter || slots['floating-filter'] : null;
  20366. const fixedHiddenColumn = overflowX && (fixedType ? column.fixed !== fixedType : !!column.fixed);
  20367. const isPadding = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isBoolean(headerCellOpts.padding) ? headerCellOpts.padding : cellOpts.padding;
  20368. const headOverflow = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(showHeaderOverflow) ? allColumnHeaderOverflow : showHeaderOverflow;
  20369. const headAlign = headerAlign || (compConf ? compConf.tableHeaderCellAlign : '') || allHeaderAlign || align || (compConf ? compConf.tableCellAlign : '') || allAlign;
  20370. const showEllipsis = headOverflow === 'ellipsis';
  20371. const showTitle = headOverflow === 'title';
  20372. const showTooltip = headOverflow === true || headOverflow === 'tooltip';
  20373. const hasEllipsis = showTitle || showTooltip || showEllipsis;
  20374. let hasFilter = false;
  20375. let firstFilterOption = null;
  20376. if (filters) {
  20377. firstFilterOption = filters[0];
  20378. hasFilter = filters.some(item => item.checked);
  20379. }
  20380. const columnIndex = colRest.index;
  20381. const _columnIndex = colRest._index;
  20382. const cellParams = {
  20383. $table: $xeTable,
  20384. $grid: $xeGrid,
  20385. $gantt: $xeGantt,
  20386. column: column,
  20387. columnIndex,
  20388. $columnIndex,
  20389. _columnIndex,
  20390. option: firstFilterOption,
  20391. fixed: fixedType,
  20392. source: header_sourceType,
  20393. type: header_renderType,
  20394. isHidden: fixedHiddenColumn,
  20395. hasFilter
  20396. };
  20397. const thAttrs = {
  20398. colid
  20399. };
  20400. const isLastColumn = $columnIndex === cols.length - 1;
  20401. const isAutoCellWidth = !column.resizeWidth && (column.minWidth === 'auto' || column.width === 'auto');
  20402. const tcStyle = {};
  20403. if (hasEllipsis) {
  20404. tcStyle.height = `${currCellHeight}px`;
  20405. } else {
  20406. tcStyle.minHeight = `${currCellHeight}px`;
  20407. }
  20408. return h('th', {
  20409. class: ['vxe-table--column vxe-header--column', colid, fixedHiddenColumn ? 'fixed--hidden' : 'fixed--visible', {
  20410. [`col--${headAlign}`]: headAlign,
  20411. [`col--${type}`]: type,
  20412. 'col--last': isLastColumn,
  20413. 'col--fixed': column.fixed,
  20414. 'col--ellipsis': hasEllipsis,
  20415. 'fixed--width': !isAutoCellWidth,
  20416. 'is--padding': isPadding,
  20417. 'is--sortable': column.sortable,
  20418. 'col--current': currentColumn === column
  20419. }],
  20420. key: colid,
  20421. attrs: thAttrs
  20422. }, [h('div', {
  20423. class: ['vxe-cell', {
  20424. 'c--title': showTitle,
  20425. 'c--tooltip': showTooltip,
  20426. 'c--ellipsis': showEllipsis
  20427. }],
  20428. style: tcStyle
  20429. }, isOptimizeMode && fixedHiddenColumn && !floatingFilters ? [] : [h('div', {
  20430. attrs: {
  20431. colid
  20432. },
  20433. class: 'vxe-cell--wrapper vxe-header-cell--wrapper'
  20434. }, flSlot ? $xeTable.callSlot(flSlot, cellParams, h) : rtFloatingFilter && firstFilterOption ? getSlotVNs(rtFloatingFilter.call($xeTable, h, filterRender, {
  20435. $table: $xeTable,
  20436. option: firstFilterOption,
  20437. column: column,
  20438. columnIndex,
  20439. $columnIndex
  20440. })) : [])])]);
  20441. });
  20442. }
  20443. function renderHeads(h, _vm, isGroup, isOptimizeMode, headerGroups) {
  20444. const props = _vm;
  20445. const $xeTable = _vm.$parent;
  20446. const tableProps = $xeTable;
  20447. const tableInternalData = $xeTable;
  20448. const {
  20449. fixedType,
  20450. fixedColumn
  20451. } = props;
  20452. const {
  20453. headerRowClassName,
  20454. headerRowStyle
  20455. } = tableProps;
  20456. const {
  20457. visibleColumn
  20458. } = tableInternalData;
  20459. const floatingFilterOpts = $xeTable.computeFloatingFilterOpts;
  20460. const rowVNs = headerGroups.map((cols, $rowIndex) => {
  20461. const params = {
  20462. $table: $xeTable,
  20463. $rowIndex,
  20464. fixed: fixedType,
  20465. type: header_renderType
  20466. };
  20467. return h('tr', {
  20468. key: $rowIndex,
  20469. class: ['vxe-header--row', headerRowClassName ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(headerRowClassName) ? headerRowClassName(params) : headerRowClassName : ''],
  20470. style: headerRowStyle ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(headerRowStyle) ? headerRowStyle(params) : headerRowStyle : undefined
  20471. }, header_renderRows(h, _vm, isGroup, isOptimizeMode, headerGroups, $rowIndex, cols));
  20472. });
  20473. if (floatingFilterOpts.enabled) {
  20474. rowVNs.push(h('tr', {
  20475. key: 'ff',
  20476. class: ['vxe-header--row']
  20477. }, renderFilterRows(h, _vm, isOptimizeMode, isOptimizeMode && fixedType ? fixedColumn : visibleColumn)));
  20478. }
  20479. return rowVNs;
  20480. }
  20481. /* harmony default export */ var header = ({
  20482. name: 'VxeTableHeader',
  20483. props: {
  20484. tableData: Array,
  20485. tableColumn: Array,
  20486. tableGroupColumn: Array,
  20487. fixedColumn: Array,
  20488. fixedType: {
  20489. type: String,
  20490. default: null
  20491. }
  20492. },
  20493. data() {
  20494. return {
  20495. headerColumn: []
  20496. };
  20497. },
  20498. watch: {
  20499. tableColumn() {
  20500. const _vm = this;
  20501. _vm.uploadColumn();
  20502. }
  20503. },
  20504. created() {
  20505. const _vm = this;
  20506. _vm.uploadColumn();
  20507. },
  20508. mounted() {
  20509. const _vm = this;
  20510. const props = _vm;
  20511. const $xeTable = _vm.$parent;
  20512. const internalData = $xeTable;
  20513. const {
  20514. fixedType
  20515. } = props;
  20516. const {
  20517. elemStore
  20518. } = internalData;
  20519. const prefix = `${fixedType || 'main'}-header-`;
  20520. elemStore[`${prefix}wrapper`] = _vm.$refs.refElem;
  20521. elemStore[`${prefix}scroll`] = _vm.$refs.refHeaderScroll;
  20522. elemStore[`${prefix}table`] = _vm.$refs.refHeaderTable;
  20523. elemStore[`${prefix}colgroup`] = _vm.$refs.refHeaderColgroup;
  20524. elemStore[`${prefix}list`] = _vm.$refs.refHeaderTHead;
  20525. elemStore[`${prefix}xSpace`] = _vm.$refs.refHeaderXSpace;
  20526. elemStore[`${prefix}repair`] = _vm.$refs.refHeaderBorderRepair;
  20527. },
  20528. destroyed() {
  20529. const _vm = this;
  20530. const props = _vm;
  20531. const $xeTable = _vm.$parent;
  20532. const internalData = $xeTable;
  20533. const {
  20534. fixedType
  20535. } = props;
  20536. const {
  20537. elemStore
  20538. } = internalData;
  20539. const prefix = `${fixedType || 'main'}-header-`;
  20540. elemStore[`${prefix}wrapper`] = null;
  20541. elemStore[`${prefix}scroll`] = null;
  20542. elemStore[`${prefix}table`] = null;
  20543. elemStore[`${prefix}colgroup`] = null;
  20544. elemStore[`${prefix}list`] = null;
  20545. elemStore[`${prefix}xSpace`] = null;
  20546. elemStore[`${prefix}repair`] = null;
  20547. },
  20548. render(h) {
  20549. const _vm = this;
  20550. const props = _vm;
  20551. const $xeTable = _vm.$parent;
  20552. const tableProps = $xeTable;
  20553. const tableReactData = $xeTable;
  20554. const tableInternalData = $xeTable;
  20555. const {
  20556. xID
  20557. } = $xeTable;
  20558. const {
  20559. fixedType,
  20560. fixedColumn,
  20561. tableColumn
  20562. } = props;
  20563. const {
  20564. headerColumn
  20565. } = _vm;
  20566. const {
  20567. mouseConfig,
  20568. showHeaderOverflow: allColumnHeaderOverflow,
  20569. spanMethod,
  20570. footerSpanMethod
  20571. } = tableProps;
  20572. const {
  20573. isGroup,
  20574. isColLoading,
  20575. overflowX,
  20576. scrollXLoad,
  20577. dragCol
  20578. } = tableReactData;
  20579. const {
  20580. visibleColumn,
  20581. fullColumnIdData
  20582. } = tableInternalData;
  20583. const mouseOpts = $xeTable.computeMouseOpts;
  20584. let renderHeaderList = headerColumn;
  20585. let renderColumnList = tableColumn;
  20586. let isOptimizeMode = false;
  20587. if (isGroup) {
  20588. renderColumnList = visibleColumn;
  20589. } else {
  20590. // 如果是使用优化模式
  20591. if (scrollXLoad && allColumnHeaderOverflow) {
  20592. if (spanMethod || footerSpanMethod) {
  20593. // 如果不支持优化模式
  20594. } else {
  20595. isOptimizeMode = true;
  20596. }
  20597. }
  20598. if (!isOptimizeMode || !isColLoading && (fixedType || !overflowX)) {
  20599. renderColumnList = visibleColumn;
  20600. }
  20601. if (fixedType) {
  20602. // 如果是使用优化模式
  20603. if (isOptimizeMode) {
  20604. renderColumnList = fixedColumn || [];
  20605. }
  20606. }
  20607. renderHeaderList = [renderColumnList];
  20608. }
  20609. if (!fixedType && !isGroup) {
  20610. // 列拖拽
  20611. if (scrollXLoad && dragCol) {
  20612. if (renderColumnList.length > 2) {
  20613. const dCowRest = fullColumnIdData[dragCol.id];
  20614. if (dCowRest) {
  20615. const dcIndex = dCowRest._index;
  20616. const firstCol = renderColumnList[0];
  20617. const lastCol = renderColumnList[renderColumnList.length - 1];
  20618. const firstColRest = fullColumnIdData[firstCol.id];
  20619. const lastColRest = fullColumnIdData[lastCol.id];
  20620. if (firstColRest && lastColRest) {
  20621. const fcIndex = firstColRest._index;
  20622. const lcIndex = lastColRest._index;
  20623. if (dcIndex < fcIndex) {
  20624. renderColumnList = [dragCol].concat(renderColumnList);
  20625. renderHeaderList = [[dragCol].concat(renderHeaderList[0])].concat(renderHeaderList.slice(1));
  20626. } else if (dcIndex > lcIndex) {
  20627. renderColumnList = renderColumnList.concat([dragCol]);
  20628. renderHeaderList = [renderHeaderList[0].concat([dragCol])].concat(renderHeaderList.slice(1));
  20629. }
  20630. }
  20631. }
  20632. }
  20633. }
  20634. }
  20635. return h('div', {
  20636. ref: 'refElem',
  20637. class: ['vxe-table--header-wrapper', fixedType ? `fixed-${fixedType}--wrapper` : 'body--wrapper'],
  20638. attrs: {
  20639. xid: xID
  20640. }
  20641. }, [h('div', {
  20642. ref: 'refHeaderScroll',
  20643. class: 'vxe-table--header-inner-wrapper',
  20644. on: {
  20645. scroll(evnt) {
  20646. $xeTable.triggerHeaderScrollEvent(evnt, fixedType);
  20647. }
  20648. }
  20649. }, [fixedType ? header_renderEmptyElement($xeTable) : h('div', {
  20650. ref: 'refHeaderXSpace',
  20651. class: 'vxe-body--x-space'
  20652. }), h('table', {
  20653. ref: 'refHeaderTable',
  20654. class: 'vxe-table--header',
  20655. attrs: {
  20656. xid: xID,
  20657. cellspacing: 0,
  20658. cellpadding: 0,
  20659. border: 0,
  20660. xvm: isOptimizeMode ? '1' : null
  20661. }
  20662. }, [
  20663. /**
  20664. * 列宽
  20665. */
  20666. h('colgroup', {
  20667. ref: 'refHeaderColgroup'
  20668. }, renderColumnList.map((column, $columnIndex) => {
  20669. return h('col', {
  20670. attrs: {
  20671. name: column.id
  20672. },
  20673. key: $columnIndex,
  20674. style: {
  20675. width: `${column.renderWidth}px`
  20676. }
  20677. });
  20678. })),
  20679. /**
  20680. * 头部
  20681. */
  20682. h('thead', {
  20683. ref: 'refHeaderTHead'
  20684. }, renderHeads(h, _vm, isGroup, isOptimizeMode, renderHeaderList))]), mouseConfig && mouseOpts.area ? h('div', {
  20685. class: 'vxe-table--cell-area',
  20686. attrs: {
  20687. xid: xID
  20688. }
  20689. }, [h('span', {
  20690. class: 'vxe-table--cell-main-area'
  20691. }), h('span', {
  20692. class: 'vxe-table--cell-clip-area'
  20693. }), h('span', {
  20694. class: 'vxe-table--cell-extend-area'
  20695. }), h('span', {
  20696. class: 'vxe-table--cell-multi-area'
  20697. }), h('span', {
  20698. class: 'vxe-table--cell-active-area'
  20699. }), h('span', {
  20700. class: 'vxe-table--cell-col-status-area'
  20701. })]) : header_renderEmptyElement($xeTable)])]);
  20702. },
  20703. methods: {
  20704. uploadColumn() {
  20705. const _vm = this;
  20706. const $xeTable = _vm.$parent;
  20707. const tableProps = $xeTable;
  20708. const tableReactData = $xeTable;
  20709. const tableInternalData = $xeTable;
  20710. const props = _vm;
  20711. const {
  20712. showCustomHeader
  20713. } = tableProps;
  20714. const {
  20715. collectColumn,
  20716. visibleColumn
  20717. } = tableInternalData;
  20718. const {
  20719. tableGroupColumn
  20720. } = props;
  20721. const {
  20722. isGroup
  20723. } = tableReactData;
  20724. let spanColumns = isGroup ? convertHeaderColumnToRows(tableGroupColumn) : [];
  20725. let visibleColgroups = [];
  20726. if (showCustomHeader && spanColumns.length > 1) {
  20727. visibleColgroups = convertHeaderToGridRows(spanColumns);
  20728. spanColumns = visibleColgroups;
  20729. }
  20730. _vm.headerColumn = spanColumns;
  20731. $xeTable.dispatchEvent('columns-change', {
  20732. visibleColgroups,
  20733. collectColumn,
  20734. visibleColumn
  20735. }, null);
  20736. }
  20737. }
  20738. });
  20739. ;// CONCATENATED MODULE: ./packages/table/src/footer.ts
  20740. const footer_sourceType = 'table';
  20741. const footer_renderType = 'footer';
  20742. const {
  20743. renderer: footer_renderer,
  20744. renderEmptyElement: footer_renderEmptyElement
  20745. } = core_.VxeUI;
  20746. function footer_renderRows(h, _vm, isOptimizeMode, tableColumn, footerTableData, row, $rowIndex, _rowIndex) {
  20747. const props = _vm;
  20748. const $xeTable = _vm.$parent;
  20749. const tableProps = $xeTable;
  20750. const tableReactData = $xeTable;
  20751. const tableInternalData = $xeTable;
  20752. const $xeGrid = $xeTable.$xeGrid;
  20753. const $xeGantt = $xeTable.$xeGantt;
  20754. const {
  20755. fixedType
  20756. } = props;
  20757. const {
  20758. resizable: allResizable,
  20759. border,
  20760. footerCellClassName,
  20761. footerCellStyle,
  20762. footerAlign: allFooterAlign,
  20763. footerSpanMethod,
  20764. align: allAlign,
  20765. columnKey,
  20766. showFooterOverflow: allColumnFooterOverflow
  20767. } = tableProps;
  20768. const {
  20769. scrollXLoad,
  20770. scrollYLoad,
  20771. overflowX,
  20772. currentColumn,
  20773. mergeFootFlag
  20774. } = tableReactData;
  20775. const {
  20776. fullColumnIdData,
  20777. mergeFooterList,
  20778. mergeFooterCellMaps,
  20779. scrollXStore
  20780. } = tableInternalData;
  20781. const virtualXOpts = $xeTable.computeVirtualXOpts;
  20782. const footerTooltipOpts = $xeTable.computeFooterTooltipOpts;
  20783. const resizableOpts = $xeTable.resizableOpts;
  20784. const {
  20785. isAllColumnDrag
  20786. } = resizableOpts;
  20787. const columnOpts = $xeTable.computeColumnOpts;
  20788. const defaultRowHeight = $xeTable.computeDefaultRowHeight;
  20789. const cellOpts = $xeTable.computeCellOpts;
  20790. const footerCellOpts = $xeTable.computeFooterCellOpts;
  20791. const currCellHeight = getCalcHeight(footerCellOpts.height) || defaultRowHeight;
  20792. return tableColumn.map((column, $columnIndex) => {
  20793. const {
  20794. type,
  20795. showFooterOverflow,
  20796. footerAlign,
  20797. align,
  20798. footerClassName,
  20799. editRender,
  20800. cellRender
  20801. } = column;
  20802. const colid = column.id;
  20803. const colRest = fullColumnIdData[colid] || {};
  20804. const renderOpts = editRender || cellRender;
  20805. const compConf = renderOpts ? footer_renderer.get(renderOpts.name) : null;
  20806. const showAllTip = footerTooltipOpts.showAll;
  20807. const fixedHiddenColumn = overflowX && (fixedType ? column.fixed !== fixedType : !!column.fixed);
  20808. const isPadding = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isBoolean(footerCellOpts.padding) ? footerCellOpts.padding : cellOpts.padding;
  20809. const footOverflow = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(showFooterOverflow) ? allColumnFooterOverflow : showFooterOverflow;
  20810. const footAlign = footerAlign || (compConf ? compConf.tableFooterCellAlign : '') || allFooterAlign || align || (compConf ? compConf.tableCellAlign : '') || allAlign;
  20811. const showEllipsis = footOverflow === 'ellipsis';
  20812. const showTitle = footOverflow === 'title';
  20813. const showTooltip = footOverflow === true || footOverflow === 'tooltip';
  20814. const hasEllipsis = showTitle || showTooltip || showEllipsis;
  20815. const showResizable = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isBoolean(column.resizable) ? column.resizable : columnOpts.resizable || allResizable;
  20816. const attrs = {
  20817. colid
  20818. };
  20819. const tfOns = {};
  20820. const columnIndex = colRest.index;
  20821. const _columnIndex = colRest._index;
  20822. const itemIndex = _columnIndex;
  20823. const cellParams = {
  20824. source: footer_sourceType,
  20825. $table: $xeTable,
  20826. $grid: $xeGrid,
  20827. $gantt: $xeGantt,
  20828. row,
  20829. rowIndex: _rowIndex,
  20830. _rowIndex,
  20831. $rowIndex,
  20832. column,
  20833. columnIndex,
  20834. $columnIndex,
  20835. _columnIndex,
  20836. itemIndex,
  20837. items: row,
  20838. fixed: fixedType,
  20839. type: footer_renderType,
  20840. data: footerTableData
  20841. };
  20842. if (showTitle || showTooltip || showAllTip) {
  20843. tfOns.mouseenter = evnt => {
  20844. if (showTitle) {
  20845. updateCellTitle(evnt.currentTarget, column);
  20846. } else if (showTooltip || showAllTip) {
  20847. $xeTable.triggerFooterTooltipEvent(evnt, cellParams);
  20848. }
  20849. };
  20850. }
  20851. if (showTooltip || showAllTip) {
  20852. tfOns.mouseleave = evnt => {
  20853. if (showTooltip || showAllTip) {
  20854. $xeTable.handleTargetLeaveEvent(evnt);
  20855. }
  20856. };
  20857. }
  20858. tfOns.click = evnt => {
  20859. $xeTable.dispatchEvent('footer-cell-click', Object.assign({
  20860. cell: evnt.currentTarget
  20861. }, cellParams), evnt);
  20862. };
  20863. tfOns.dblclick = evnt => {
  20864. $xeTable.dispatchEvent('footer-cell-dblclick', Object.assign({
  20865. cell: evnt.currentTarget
  20866. }, cellParams), evnt);
  20867. };
  20868. let isMergeCell = false;
  20869. // 合并行或列
  20870. if (mergeFootFlag && mergeFooterList.length) {
  20871. const spanRest = mergeFooterCellMaps[`${_rowIndex}:${_columnIndex}`];
  20872. if (spanRest) {
  20873. const {
  20874. rowspan,
  20875. colspan
  20876. } = spanRest;
  20877. if (!rowspan || !colspan) {
  20878. return null;
  20879. }
  20880. if (rowspan > 1) {
  20881. isMergeCell = true;
  20882. attrs.rowspan = rowspan;
  20883. }
  20884. if (colspan > 1) {
  20885. isMergeCell = true;
  20886. attrs.colspan = colspan;
  20887. }
  20888. }
  20889. } else if (footerSpanMethod) {
  20890. // 自定义合并方法
  20891. const {
  20892. rowspan = 1,
  20893. colspan = 1
  20894. } = footerSpanMethod(cellParams) || {};
  20895. if (!rowspan || !colspan) {
  20896. return null;
  20897. }
  20898. if (rowspan > 1) {
  20899. attrs.rowspan = rowspan;
  20900. }
  20901. if (colspan > 1) {
  20902. attrs.colspan = colspan;
  20903. }
  20904. }
  20905. const isLastColumn = $columnIndex === tableColumn.length - 1;
  20906. const isAutoCellWidth = !column.resizeWidth && (column.minWidth === 'auto' || column.width === 'auto');
  20907. let isVNPreEmptyStatus = false;
  20908. if (isOptimizeMode && overflowX && !isMergeCell) {
  20909. if (scrollXLoad && tableColumn.length > 10 && !column.fixed && !virtualXOpts.immediate && (_columnIndex < scrollXStore.visibleStartIndex - scrollXStore.preloadSize || _columnIndex > scrollXStore.visibleEndIndex + scrollXStore.preloadSize)) {
  20910. isVNPreEmptyStatus = true;
  20911. }
  20912. }
  20913. const tcStyle = {};
  20914. if (hasEllipsis) {
  20915. tcStyle.height = `${currCellHeight}px`;
  20916. } else {
  20917. tcStyle.minHeight = `${currCellHeight}px`;
  20918. }
  20919. return h('td', {
  20920. class: ['vxe-table--column vxe-footer--column', column.id, {
  20921. [`col--${footAlign}`]: footAlign,
  20922. [`col--${type}`]: type,
  20923. 'col--last': isLastColumn,
  20924. 'fixed--width': !isAutoCellWidth,
  20925. 'fixed--hidden': fixedHiddenColumn,
  20926. 'is--padding': isPadding,
  20927. 'col--ellipsis': hasEllipsis,
  20928. 'col--current': currentColumn === column
  20929. }, getClass(footerClassName, cellParams), getClass(footerCellClassName, cellParams)],
  20930. attrs,
  20931. style: footerCellStyle ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(footerCellStyle) ? footerCellStyle(cellParams) : footerCellStyle : undefined,
  20932. on: tfOns,
  20933. key: columnKey || scrollXLoad || scrollYLoad || columnOpts.useKey || columnOpts.drag ? column.id : $columnIndex
  20934. }, [h('div', {
  20935. class: ['vxe-cell', {
  20936. 'c--title': showTitle,
  20937. 'c--tooltip': showTooltip,
  20938. 'c--ellipsis': showEllipsis
  20939. }],
  20940. style: tcStyle
  20941. }, isVNPreEmptyStatus ? [] : [h('div', {
  20942. attrs: {
  20943. colid
  20944. },
  20945. class: 'vxe-cell--wrapper vxe-footer-cell--wrapper'
  20946. }, column.renderFooter(h, cellParams))]),
  20947. /**
  20948. * 列宽拖动
  20949. */
  20950. !fixedHiddenColumn && showResizable && isAllColumnDrag ? h('div', {
  20951. class: ['vxe-cell--col-resizable', {
  20952. 'is--line': !border || border === 'none'
  20953. }],
  20954. on: {
  20955. mousedown: evnt => $xeTable.handleColResizeMousedownEvent(evnt, fixedType, cellParams),
  20956. dblclick: evnt => $xeTable.handleColResizeDblclickEvent(evnt, cellParams)
  20957. }
  20958. }) : footer_renderEmptyElement($xeTable)]);
  20959. });
  20960. }
  20961. function footer_renderHeads(h, _vm, isOptimizeMode, renderColumnList) {
  20962. const props = _vm;
  20963. const $xeTable = _vm.$parent;
  20964. const tableProps = $xeTable;
  20965. const {
  20966. fixedType,
  20967. footerTableData
  20968. } = props;
  20969. const {
  20970. footerRowClassName,
  20971. footerRowStyle
  20972. } = tableProps;
  20973. return footerTableData.map((row, $rowIndex) => {
  20974. const _rowIndex = $rowIndex;
  20975. const rowParams = {
  20976. $table: $xeTable,
  20977. row,
  20978. _rowIndex,
  20979. $rowIndex,
  20980. fixed: fixedType,
  20981. type: footer_renderType
  20982. };
  20983. return h('tr', {
  20984. key: $rowIndex,
  20985. class: ['vxe-footer--row', footerRowClassName ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(footerRowClassName) ? footerRowClassName(rowParams) : footerRowClassName : ''],
  20986. style: footerRowStyle ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(footerRowStyle) ? footerRowStyle(rowParams) : footerRowStyle : undefined
  20987. }, footer_renderRows(h, _vm, isOptimizeMode, renderColumnList, footerTableData, row, $rowIndex, _rowIndex));
  20988. });
  20989. }
  20990. /* harmony default export */ var footer = ({
  20991. name: 'VxeTableFooter',
  20992. props: {
  20993. footerTableData: {
  20994. type: Array,
  20995. default: () => []
  20996. },
  20997. tableColumn: {
  20998. type: Array,
  20999. default: () => []
  21000. },
  21001. fixedColumn: {
  21002. type: Array,
  21003. default: () => []
  21004. },
  21005. fixedType: {
  21006. type: String,
  21007. default: null
  21008. }
  21009. },
  21010. mounted() {
  21011. const _vm = this;
  21012. const props = _vm;
  21013. const $xeTable = _vm.$parent;
  21014. const tableInternalData = $xeTable;
  21015. const {
  21016. fixedType
  21017. } = props;
  21018. const {
  21019. elemStore
  21020. } = tableInternalData;
  21021. const prefix = `${fixedType || 'main'}-footer-`;
  21022. elemStore[`${prefix}wrapper`] = _vm.$refs.refElem;
  21023. elemStore[`${prefix}scroll`] = _vm.$refs.refFooterScroll;
  21024. elemStore[`${prefix}table`] = _vm.$refs.refFooterTable;
  21025. elemStore[`${prefix}colgroup`] = _vm.$refs.refFooterColgroup;
  21026. elemStore[`${prefix}list`] = _vm.$refs.refFooterTFoot;
  21027. elemStore[`${prefix}xSpace`] = _vm.$refs.refFooterXSpace;
  21028. },
  21029. destroyed() {
  21030. const _vm = this;
  21031. const props = _vm;
  21032. const $xeTable = _vm.$parent;
  21033. const tableInternalData = $xeTable;
  21034. const {
  21035. fixedType
  21036. } = props;
  21037. const {
  21038. elemStore
  21039. } = tableInternalData;
  21040. const prefix = `${fixedType || 'main'}-footer-`;
  21041. elemStore[`${prefix}wrapper`] = null;
  21042. elemStore[`${prefix}scroll`] = null;
  21043. elemStore[`${prefix}table`] = null;
  21044. elemStore[`${prefix}colgroup`] = null;
  21045. elemStore[`${prefix}list`] = null;
  21046. elemStore[`${prefix}xSpace`] = null;
  21047. },
  21048. render(h) {
  21049. const _vm = this;
  21050. const props = _vm;
  21051. const $xeTable = _vm.$parent;
  21052. const tableProps = $xeTable;
  21053. const tableReactData = $xeTable;
  21054. const tableInternalData = $xeTable;
  21055. const {
  21056. xID
  21057. } = $xeTable;
  21058. const {
  21059. fixedType,
  21060. fixedColumn,
  21061. tableColumn
  21062. } = props;
  21063. const {
  21064. spanMethod,
  21065. footerSpanMethod,
  21066. showFooterOverflow: allColumnFooterOverflow
  21067. } = tableProps;
  21068. const {
  21069. visibleColumn,
  21070. fullColumnIdData
  21071. } = tableInternalData;
  21072. const {
  21073. isGroup,
  21074. isColLoading,
  21075. overflowX,
  21076. scrollXLoad,
  21077. dragCol
  21078. } = tableReactData;
  21079. let renderColumnList = tableColumn;
  21080. let isOptimizeMode = false;
  21081. // 如果是使用优化模式
  21082. if (scrollXLoad && allColumnFooterOverflow) {
  21083. if (spanMethod || footerSpanMethod) {
  21084. // 如果不支持优化模式
  21085. } else {
  21086. isOptimizeMode = true;
  21087. }
  21088. }
  21089. if (!isOptimizeMode || !isColLoading && (fixedType || !overflowX)) {
  21090. renderColumnList = visibleColumn;
  21091. }
  21092. if (fixedType) {
  21093. if (isOptimizeMode) {
  21094. renderColumnList = fixedColumn || [];
  21095. }
  21096. }
  21097. if (!fixedType && !isGroup) {
  21098. // 列拖拽
  21099. if (scrollXLoad && dragCol) {
  21100. if (renderColumnList.length > 2) {
  21101. const dCowRest = fullColumnIdData[dragCol.id];
  21102. if (dCowRest) {
  21103. const dcIndex = dCowRest._index;
  21104. const firstCol = renderColumnList[0];
  21105. const lastCol = renderColumnList[renderColumnList.length - 1];
  21106. const firstColRest = fullColumnIdData[firstCol.id];
  21107. const lastColRest = fullColumnIdData[lastCol.id];
  21108. if (firstColRest && lastColRest) {
  21109. const fcIndex = firstColRest._index;
  21110. const lcIndex = lastColRest._index;
  21111. if (dcIndex < fcIndex) {
  21112. renderColumnList = [dragCol].concat(renderColumnList);
  21113. } else if (dcIndex > lcIndex) {
  21114. renderColumnList = renderColumnList.concat([dragCol]);
  21115. }
  21116. }
  21117. }
  21118. }
  21119. }
  21120. }
  21121. return h('div', {
  21122. ref: 'refElem',
  21123. class: ['vxe-table--footer-wrapper', fixedType ? `fixed-${fixedType}--wrapper` : 'body--wrapper'],
  21124. attrs: {
  21125. xid: xID
  21126. }
  21127. }, [h('div', {
  21128. ref: 'refFooterScroll',
  21129. class: 'vxe-table--footer-inner-wrapper',
  21130. on: {
  21131. scroll(evnt) {
  21132. $xeTable.triggerFooterScrollEvent(evnt, fixedType);
  21133. }
  21134. }
  21135. }, [fixedType ? footer_renderEmptyElement($xeTable) : h('div', {
  21136. ref: 'refFooterXSpace',
  21137. class: 'vxe-body--x-space'
  21138. }), h('table', {
  21139. ref: 'refFooterTable',
  21140. class: 'vxe-table--footer',
  21141. attrs: {
  21142. xid: xID,
  21143. cellspacing: 0,
  21144. cellpadding: 0,
  21145. border: 0,
  21146. xvm: isOptimizeMode ? '1' : null
  21147. }
  21148. }, [
  21149. /**
  21150. * 列宽
  21151. */
  21152. h('colgroup', {
  21153. ref: 'refFooterColgroup'
  21154. }, renderColumnList.map((column, $columnIndex) => {
  21155. return h('col', {
  21156. attrs: {
  21157. name: column.id
  21158. },
  21159. key: $columnIndex,
  21160. style: {
  21161. width: `${column.renderWidth}px`
  21162. }
  21163. });
  21164. })),
  21165. /**
  21166. * 底部
  21167. */
  21168. h('tfoot', {
  21169. ref: 'refFooterTFoot'
  21170. }, footer_renderHeads(h, _vm, isOptimizeMode, renderColumnList))])])]);
  21171. }
  21172. });
  21173. ;// CONCATENATED MODULE: ./packages/table/module/custom/panel.ts
  21174. const {
  21175. getI18n: panel_getI18n,
  21176. getIcon: panel_getIcon,
  21177. renderEmptyElement: panel_renderEmptyElement
  21178. } = core_.VxeUI;
  21179. function panel_showDropTip($xeTableCustomPanel, evnt, optEl, showLine, dragPos) {
  21180. const customPanelInternalData = $xeTableCustomPanel.internalData;
  21181. const bodyWrapperElem = $xeTableCustomPanel.$refs.refBodyWrapperElem;
  21182. if (!bodyWrapperElem) {
  21183. return;
  21184. }
  21185. const customBodyElem = $xeTableCustomPanel.$refs.refCustomBodyElem;
  21186. if (!customBodyElem) {
  21187. return;
  21188. }
  21189. const {
  21190. prevDragToChild
  21191. } = customPanelInternalData;
  21192. const bodyWrapperRect = bodyWrapperElem.getBoundingClientRect();
  21193. const customBodyRect = customBodyElem.getBoundingClientRect();
  21194. const dragLineEl = $xeTableCustomPanel.$refs.refDragLineElem;
  21195. if (optEl) {
  21196. if (dragLineEl) {
  21197. if (showLine) {
  21198. const optRect = optEl.getBoundingClientRect();
  21199. dragLineEl.style.display = 'block';
  21200. dragLineEl.style.left = `${Math.max(0, customBodyRect.x - bodyWrapperRect.x)}px`;
  21201. dragLineEl.style.top = `${Math.max(1, optRect.y + bodyWrapperElem.scrollTop - bodyWrapperRect.y)}px`;
  21202. dragLineEl.style.height = `${optRect.height}px`;
  21203. dragLineEl.style.width = `${optRect.width}px`;
  21204. dragLineEl.setAttribute('drag-pos', dragPos);
  21205. dragLineEl.setAttribute('drag-to-child', prevDragToChild ? 'y' : 'n');
  21206. } else {
  21207. dragLineEl.style.display = '';
  21208. }
  21209. }
  21210. } else {
  21211. if (dragLineEl) {
  21212. dragLineEl.style.display = 'node';
  21213. }
  21214. }
  21215. const dragTipEl = $xeTableCustomPanel.$refs.refDragTipElem;
  21216. if (dragTipEl) {
  21217. dragTipEl.style.display = 'block';
  21218. dragTipEl.style.top = `${Math.min(bodyWrapperElem.clientHeight + bodyWrapperElem.scrollTop - dragTipEl.clientHeight, evnt.clientY + bodyWrapperElem.scrollTop - bodyWrapperRect.y)}px`;
  21219. dragTipEl.style.left = `${Math.min(bodyWrapperElem.clientWidth + bodyWrapperElem.scrollLeft - dragTipEl.clientWidth, evnt.clientX + bodyWrapperElem.scrollLeft - bodyWrapperRect.x)}px`;
  21220. dragTipEl.setAttribute('drag-status', showLine ? prevDragToChild ? 'sub' : 'normal' : 'disabled');
  21221. }
  21222. }
  21223. function panel_hideDropTip($xeTableCustomPanel) {
  21224. const dragTipEl = $xeTableCustomPanel.$refs.refDragTipElem;
  21225. const dragLineEl = $xeTableCustomPanel.$refs.refDragLineElem;
  21226. if (dragTipEl) {
  21227. dragTipEl.style.display = '';
  21228. }
  21229. if (dragLineEl) {
  21230. dragLineEl.style.display = '';
  21231. }
  21232. }
  21233. const renderDragTip = (h, $xeTableCustomPanel) => {
  21234. const $xeTable = $xeTableCustomPanel.$xeTable;
  21235. const customPanelReactData = $xeTableCustomPanel.reactData;
  21236. const {
  21237. dragTipText
  21238. } = customPanelReactData;
  21239. const columnDragOpts = $xeTable.computeColumnDragOpts;
  21240. return h('div', {}, [h('div', {
  21241. ref: 'refDragLineElem',
  21242. class: ['vxe-table-custom-popup--drag-line', {
  21243. 'is--guides': columnDragOpts.showGuidesStatus
  21244. }]
  21245. }), h('div', {
  21246. ref: 'refDragTipElem',
  21247. class: 'vxe-table-custom-popup--drag-tip'
  21248. }, [h('div', {
  21249. class: 'vxe-table-custom-popup--drag-tip-wrapper'
  21250. }, [h('div', {
  21251. class: 'vxe-table-custom-popup--drag-tip-status'
  21252. }, [h('span', {
  21253. class: ['vxe-table-custom-popup--drag-tip-normal-status', panel_getIcon().TABLE_DRAG_STATUS_ROW]
  21254. }), h('span', {
  21255. class: ['vxe-table-custom-popup--drag-tip-sub-status', panel_getIcon().TABLE_DRAG_STATUS_SUB_ROW]
  21256. }), h('span', {
  21257. class: ['vxe-table-custom-popup--drag-tip-group-status', panel_getIcon().TABLE_DRAG_STATUS_AGG_GROUP]
  21258. }), h('span', {
  21259. class: ['vxe-table-custom-popup--drag-tip-values-status', panel_getIcon().TABLE_DRAG_STATUS_AGG_VALUES]
  21260. }), h('span', {
  21261. class: ['vxe-table-custom-popup--drag-tip-disabled-status', panel_getIcon().TABLE_DRAG_DISABLED]
  21262. })]), h('div', {
  21263. class: 'vxe-table-custom-popup--drag-tip-content'
  21264. }, `${dragTipText || ''}`)])])]);
  21265. };
  21266. const renderSimplePanel = (h, _vm) => {
  21267. const VxeUIButtonComponent = core_.VxeUI.getComponent('VxeButton');
  21268. const props = _vm;
  21269. const $xeTable = _vm.$xeTable;
  21270. const tableProps = $xeTable;
  21271. const tableReactData = $xeTable;
  21272. const $xeGrid = $xeTable.$xeGrid;
  21273. const $xeGantt = $xeTable.$xeGantt;
  21274. const {
  21275. customStore
  21276. } = props;
  21277. const {
  21278. treeConfig,
  21279. rowGroupConfig,
  21280. aggregateConfig
  21281. } = tableProps;
  21282. const {
  21283. isCustomStatus,
  21284. customColumnList
  21285. } = tableReactData;
  21286. const customOpts = $xeTable.computeCustomOpts;
  21287. const {
  21288. immediate
  21289. } = customOpts;
  21290. const columnDragOpts = $xeTable.computeColumnDragOpts;
  21291. const {
  21292. maxHeight
  21293. } = customStore;
  21294. const {
  21295. checkMethod,
  21296. visibleMethod,
  21297. allowVisible,
  21298. allowSort,
  21299. allowFixed,
  21300. trigger,
  21301. placement
  21302. } = customOpts;
  21303. const isMaxFixedColumn = $xeTable.computeIsMaxFixedColumn;
  21304. const {
  21305. isCrossDrag
  21306. } = columnDragOpts;
  21307. const slots = customOpts.slots || {};
  21308. const headerSlot = slots.header;
  21309. const topSlot = slots.top;
  21310. const bottomSlot = slots.bottom;
  21311. const defaultSlot = slots.default;
  21312. const footerSlot = slots.footer;
  21313. const colVNs = [];
  21314. const customWrapperOns = {};
  21315. const isAllChecked = customStore.isAll;
  21316. const isAllIndeterminate = customStore.isIndeterminate;
  21317. // hover 触发
  21318. if (trigger === 'hover') {
  21319. customWrapperOns.mouseenter = _vm.handleWrapperMouseenterEvent;
  21320. customWrapperOns.mouseleave = _vm.handleWrapperMouseleaveEvent;
  21321. }
  21322. const params = {
  21323. $table: $xeTable,
  21324. $grid: $xeGrid,
  21325. $gantt: $xeGantt,
  21326. columns: customColumnList,
  21327. isAllChecked,
  21328. isAllIndeterminate,
  21329. isCustomStatus
  21330. };
  21331. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(customColumnList, (column, index, items, path, parent) => {
  21332. const isVisible = visibleMethod ? visibleMethod({
  21333. $table: $xeTable,
  21334. column
  21335. }) : true;
  21336. if (isVisible) {
  21337. const isChecked = column.renderVisible;
  21338. const isIndeterminate = column.halfVisible;
  21339. const isColGroup = column.children && column.children.length;
  21340. const colTitle = formatText(column.getTitle(), 1);
  21341. const isDisabled = checkMethod ? !checkMethod({
  21342. $table: $xeTable,
  21343. column
  21344. }) : false;
  21345. const isHidden = !isChecked;
  21346. colVNs.push(h('li', {
  21347. key: column.id,
  21348. attrs: {
  21349. colid: column.id
  21350. },
  21351. class: ['vxe-table-custom--option', `level--${column.level}`, {
  21352. 'is--hidden': isDisabled || isHidden,
  21353. 'is--group': isColGroup
  21354. }],
  21355. on: {
  21356. dragstart: _vm.sortDragstartEvent,
  21357. dragend: _vm.sortDragendEvent,
  21358. dragover: _vm.sortDragoverEvent
  21359. }
  21360. }, [allowVisible ? h('div', {
  21361. class: ['vxe-table-custom--checkbox-option', {
  21362. 'is--checked': isChecked,
  21363. 'is--indeterminate': isIndeterminate,
  21364. 'is--disabled': isDisabled
  21365. }],
  21366. attrs: {
  21367. title: panel_getI18n('vxe.custom.setting.colVisible')
  21368. },
  21369. on: {
  21370. click: evnt => {
  21371. if (!isDisabled) {
  21372. _vm.changeCheckboxOption(column, evnt);
  21373. }
  21374. }
  21375. }
  21376. }, [h('span', {
  21377. class: ['vxe-checkbox--icon', isIndeterminate ? panel_getIcon().TABLE_CHECKBOX_INDETERMINATE : isChecked ? panel_getIcon().TABLE_CHECKBOX_CHECKED : panel_getIcon().TABLE_CHECKBOX_UNCHECKED]
  21378. })]) : panel_renderEmptyElement($xeTable), h('div', {
  21379. class: 'vxe-table-custom--name-option'
  21380. }, [allowSort && ((isCrossDrag ? immediate : false) || column.level === 1) ? h('div', {
  21381. class: 'vxe-table-custom--sort-option'
  21382. }, [h('span', {
  21383. class: ['vxe-table-custom--sort-btn', {
  21384. 'is--disabled': isDisabled || isHidden
  21385. }],
  21386. attrs: {
  21387. title: panel_getI18n('vxe.custom.setting.sortHelpTip')
  21388. },
  21389. on: isDisabled || isHidden ? {} : {
  21390. mousedown: _vm.sortMousedownEvent,
  21391. mouseup: _vm.sortMouseupEvent
  21392. }
  21393. }, [h('i', {
  21394. class: panel_getIcon().TABLE_CUSTOM_SORT
  21395. })])]) : panel_renderEmptyElement($xeTable), column.type === 'html' ? h('div', {
  21396. key: '1',
  21397. class: 'vxe-table-custom--checkbox-label',
  21398. domProps: {
  21399. innerHTML: colTitle
  21400. }
  21401. }) : h('div', {
  21402. key: '0',
  21403. class: 'vxe-table-custom--checkbox-label',
  21404. attrs: {
  21405. title: colTitle
  21406. }
  21407. }, colTitle)]), !parent && allowFixed ? h('div', {
  21408. class: 'vxe-table-custom--fixed-option'
  21409. }, [h(VxeUIButtonComponent, {
  21410. props: {
  21411. mode: 'text',
  21412. icon: column.renderFixed === 'left' ? panel_getIcon().TOOLBAR_TOOLS_FIXED_LEFT_ACTIVE : panel_getIcon().TOOLBAR_TOOLS_FIXED_LEFT,
  21413. status: column.renderFixed === 'left' ? 'primary' : '',
  21414. disabled: isDisabled || isHidden || isMaxFixedColumn && !column.renderFixed,
  21415. title: panel_getI18n(column.renderFixed === 'left' ? 'vxe.toolbar.cancelFixed' : 'vxe.toolbar.fixedLeft')
  21416. },
  21417. on: {
  21418. click: ({
  21419. $event
  21420. }) => {
  21421. _vm.changeFixedOption(column, 'left', $event);
  21422. }
  21423. }
  21424. }), h(VxeUIButtonComponent, {
  21425. props: {
  21426. mode: 'text',
  21427. icon: column.renderFixed === 'right' ? panel_getIcon().TOOLBAR_TOOLS_FIXED_RIGHT_ACTIVE : panel_getIcon().TOOLBAR_TOOLS_FIXED_RIGHT,
  21428. status: column.renderFixed === 'right' ? 'primary' : '',
  21429. disabled: isDisabled || isHidden || isMaxFixedColumn && !column.renderFixed,
  21430. title: panel_getI18n(column.renderFixed === 'right' ? 'vxe.toolbar.cancelFixed' : 'vxe.toolbar.fixedRight')
  21431. },
  21432. on: {
  21433. click: ({
  21434. $event
  21435. }) => {
  21436. _vm.changeFixedOption(column, 'right', $event);
  21437. }
  21438. }
  21439. })]) : panel_renderEmptyElement($xeTable)]));
  21440. }
  21441. });
  21442. return h('div', {
  21443. ref: 'refElem',
  21444. key: 'simple',
  21445. class: ['vxe-table-custom-wrapper', `placement--${placement}`, {
  21446. 'is--active': customStore.visible
  21447. }],
  21448. style: maxHeight && !['left', 'right'].includes(placement || '') ? {
  21449. maxHeight: `${maxHeight}px`
  21450. } : {}
  21451. }, customStore.visible ? [h('div', {
  21452. ref: 'refBodyWrapperElem',
  21453. class: 'vxe-table-custom-simple--body-wrapper'
  21454. }, [!treeConfig && (aggregateConfig || rowGroupConfig) && $xeTable.getPivotTableAggregateSimplePanel ? h($xeTable.getPivotTableAggregateSimplePanel(), {
  21455. props: {
  21456. customStore
  21457. }
  21458. }) : panel_renderEmptyElement($xeTable), h('div', {
  21459. ref: 'refCustomBodyElem',
  21460. class: 'vxe-table-custom--handle-wrapper'
  21461. }, [h('div', {
  21462. class: 'vxe-table-custom--header'
  21463. }, headerSlot ? $xeTable.callSlot(headerSlot, params, h) : [h('ul', {
  21464. class: 'vxe-table-custom--panel-list'
  21465. }, [h('li', {
  21466. class: 'vxe-table-custom--option'
  21467. }, [allowVisible ? h('div', {
  21468. class: ['vxe-table-custom--checkbox-option', {
  21469. 'is--checked': isAllChecked,
  21470. 'is--indeterminate': isAllIndeterminate
  21471. }],
  21472. attrs: {
  21473. title: panel_getI18n('vxe.table.allTitle')
  21474. },
  21475. on: {
  21476. click: _vm.allOptionEvent
  21477. }
  21478. }, [h('span', {
  21479. class: ['vxe-checkbox--icon', isAllIndeterminate ? panel_getIcon().TABLE_CHECKBOX_INDETERMINATE : isAllChecked ? panel_getIcon().TABLE_CHECKBOX_CHECKED : panel_getIcon().TABLE_CHECKBOX_UNCHECKED]
  21480. }), h('span', {
  21481. class: 'vxe-checkbox--label'
  21482. }, panel_getI18n('vxe.toolbar.customAll'))]) : h('span', {
  21483. class: 'vxe-checkbox--label'
  21484. }, panel_getI18n('vxe.table.customTitle'))])])]), h('div', {
  21485. class: 'vxe-table-custom--body'
  21486. }, [topSlot ? h('div', {
  21487. class: 'vxe-table-custom--panel-top'
  21488. }, $xeTable.callSlot(topSlot, params, h)) : panel_renderEmptyElement($xeTable), defaultSlot ? h('div', {
  21489. class: 'vxe-table-custom--panel-body'
  21490. }, $xeTable.callSlot(defaultSlot, params, h)) : h('transition-group', {
  21491. class: 'vxe-table-custom--panel-list',
  21492. props: {
  21493. name: 'vxe-table-custom--list',
  21494. tag: 'ul'
  21495. },
  21496. on: customWrapperOns
  21497. }, colVNs), bottomSlot ? h('div', {
  21498. class: 'vxe-table-custom--panel-bottom'
  21499. }, $xeTable.callSlot(bottomSlot, params, h)) : panel_renderEmptyElement($xeTable)]), customOpts.showFooter ? h('div', {
  21500. class: 'vxe-table-custom--footer'
  21501. }, footerSlot ? $xeTable.callSlot(footerSlot, params, h) : [h('div', {
  21502. class: 'vxe-table-custom--footer-buttons'
  21503. }, [h(VxeUIButtonComponent, {
  21504. props: {
  21505. mode: 'text',
  21506. content: customOpts.resetButtonText || panel_getI18n('vxe.table.customRestore'),
  21507. disabled: !isCustomStatus
  21508. },
  21509. on: {
  21510. click: _vm.resetCustomEvent
  21511. }
  21512. }), immediate ? h(VxeUIButtonComponent, {
  21513. props: {
  21514. mode: 'text',
  21515. content: customOpts.closeButtonText || panel_getI18n('vxe.table.customClose')
  21516. },
  21517. on: {
  21518. click: _vm.cancelCloseEvent
  21519. }
  21520. }) : h(VxeUIButtonComponent, {
  21521. props: {
  21522. mode: 'text',
  21523. content: customOpts.resetButtonText || panel_getI18n('vxe.table.customCancel')
  21524. },
  21525. on: {
  21526. click: _vm.cancelCustomEvent
  21527. }
  21528. }), immediate ? panel_renderEmptyElement($xeTable) : h(VxeUIButtonComponent, {
  21529. props: {
  21530. mode: 'text',
  21531. status: 'primary',
  21532. content: customOpts.confirmButtonText || panel_getI18n('vxe.table.customConfirm')
  21533. },
  21534. on: {
  21535. click: _vm.confirmCustomEvent
  21536. }
  21537. })])]) : null]), renderDragTip(h, _vm)])] : []);
  21538. };
  21539. const renderPopupPanel = (h, $xeTableCustomPanel) => {
  21540. const VxeUIModalComponent = core_.VxeUI.getComponent('VxeModal');
  21541. const VxeUIDrawerComponent = core_.VxeUI.getComponent('VxeDrawer');
  21542. const VxeUIButtonComponent = core_.VxeUI.getComponent('VxeButton');
  21543. const VxeUINumberInputComponent = core_.VxeUI.getComponent('VxeNumberInput');
  21544. const _vm = $xeTableCustomPanel;
  21545. const props = $xeTableCustomPanel;
  21546. const $xeTable = $xeTableCustomPanel.$xeTable;
  21547. const tableProps = $xeTable;
  21548. const tableReactData = $xeTable;
  21549. const $xeGrid = $xeTable.$xeGrid;
  21550. const $xeGantt = $xeTable.$xeGantt;
  21551. const {
  21552. customStore
  21553. } = props;
  21554. const {
  21555. treeConfig,
  21556. rowGroupConfig,
  21557. aggregateConfig,
  21558. resizable: allResizable
  21559. } = tableProps;
  21560. const {
  21561. isCustomStatus,
  21562. customColumnList
  21563. } = tableReactData;
  21564. const customOpts = $xeTable.computeCustomOpts;
  21565. const {
  21566. immediate
  21567. } = customOpts;
  21568. const columnDragOpts = $xeTable.computeColumnDragOpts;
  21569. const {
  21570. mode,
  21571. modalOptions,
  21572. drawerOptions,
  21573. allowVisible,
  21574. allowSort,
  21575. allowFixed,
  21576. allowResizable,
  21577. checkMethod,
  21578. visibleMethod
  21579. } = customOpts;
  21580. const columnOpts = $xeTable.computeColumnOpts;
  21581. const {
  21582. maxFixedSize
  21583. } = columnOpts;
  21584. const resizableOpts = $xeTable.computeResizableOpts;
  21585. const {
  21586. minWidth: reMinWidth,
  21587. maxWidth: reMaxWidth
  21588. } = resizableOpts;
  21589. const modalOpts = Object.assign({}, modalOptions);
  21590. const drawerOpts = Object.assign({}, drawerOptions);
  21591. const isMaxFixedColumn = $xeTable.computeIsMaxFixedColumn;
  21592. const {
  21593. isCrossDrag
  21594. } = columnDragOpts;
  21595. const slots = customOpts.slots || {};
  21596. const headerSlot = slots.header;
  21597. const topSlot = slots.top;
  21598. const bottomSlot = slots.bottom;
  21599. const defaultSlot = slots.default;
  21600. const footerSlot = slots.footer;
  21601. const trVNs = [];
  21602. const isAllChecked = customStore.isAll;
  21603. const isAllIndeterminate = customStore.isIndeterminate;
  21604. const params = {
  21605. $table: $xeTable,
  21606. $grid: $xeGrid,
  21607. $gantt: $xeGantt,
  21608. columns: customColumnList,
  21609. isAllChecked,
  21610. isAllIndeterminate,
  21611. isCustomStatus
  21612. };
  21613. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(customColumnList, (column, index, items, path, parent) => {
  21614. const isVisible = visibleMethod ? visibleMethod({
  21615. $table: $xeTable,
  21616. column
  21617. }) : true;
  21618. if (isVisible) {
  21619. // 默认继承调整宽度
  21620. let customMinWidth = 0;
  21621. let customMaxWidth = 0;
  21622. if (allowResizable) {
  21623. const resizeParams = {
  21624. $table: $xeTable,
  21625. column,
  21626. columnIndex: index,
  21627. $columnIndex: index,
  21628. $rowIndex: -1
  21629. };
  21630. if (reMinWidth) {
  21631. customMinWidth = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(reMinWidth) ? reMinWidth(resizeParams) : reMinWidth);
  21632. }
  21633. if (reMaxWidth) {
  21634. customMaxWidth = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(reMaxWidth) ? reMaxWidth(resizeParams) : reMaxWidth);
  21635. }
  21636. }
  21637. const isChecked = column.renderVisible;
  21638. const isIndeterminate = column.halfVisible;
  21639. const colTitle = formatText(column.getTitle(), 1);
  21640. const isColGroup = column.children && column.children.length;
  21641. const isDisabled = checkMethod ? !checkMethod({
  21642. $table: $xeTable,
  21643. column
  21644. }) : false;
  21645. const isHidden = !isChecked;
  21646. trVNs.push(h('tr', {
  21647. key: column.id,
  21648. attrs: {
  21649. colid: column.id
  21650. },
  21651. class: [`vxe-table-custom-popup--row level--${column.level}`, {
  21652. 'is--group': isColGroup
  21653. }],
  21654. on: {
  21655. dragstart: _vm.sortDragstartEvent,
  21656. dragend: _vm.sortDragendEvent,
  21657. dragover: _vm.sortDragoverEvent
  21658. }
  21659. }, [allowVisible ? h('td', {
  21660. class: 'vxe-table-custom-popup--column-item col--visible'
  21661. }, [h('div', {
  21662. class: ['vxe-table-custom--checkbox-option', {
  21663. 'is--checked': isChecked,
  21664. 'is--indeterminate': isIndeterminate,
  21665. 'is--disabled': isDisabled
  21666. }],
  21667. attrs: {
  21668. title: panel_getI18n('vxe.custom.setting.colVisible')
  21669. },
  21670. on: {
  21671. click: evnt => {
  21672. if (!isDisabled) {
  21673. _vm.changeCheckboxOption(column, evnt);
  21674. }
  21675. }
  21676. }
  21677. }, [h('span', {
  21678. class: ['vxe-checkbox--icon', isIndeterminate ? panel_getIcon().TABLE_CHECKBOX_INDETERMINATE : isChecked ? panel_getIcon().TABLE_CHECKBOX_CHECKED : panel_getIcon().TABLE_CHECKBOX_UNCHECKED]
  21679. })])]) : panel_renderEmptyElement($xeTable), h('td', {
  21680. class: 'vxe-table-custom-popup--column-item col--name'
  21681. }, [h('div', {
  21682. class: 'vxe-table-custom-popup--name'
  21683. }, [allowSort ? (isCrossDrag ? immediate : false) || column.level === 1 ? h('div', {
  21684. class: ['vxe-table-custom-popup--column-sort-btn', {
  21685. 'is--disabled': isDisabled || isHidden
  21686. }],
  21687. attrs: {
  21688. title: panel_getI18n('vxe.custom.setting.sortHelpTip')
  21689. },
  21690. on: isDisabled || isHidden ? {} : {
  21691. mousedown: _vm.sortMousedownEvent,
  21692. mouseup: _vm.sortMouseupEvent
  21693. }
  21694. }, [h('i', {
  21695. class: panel_getIcon().TABLE_CUSTOM_SORT
  21696. })]) : h('div', {
  21697. class: 'vxe-table-custom-popup--column-sort-placeholder'
  21698. }) : panel_renderEmptyElement($xeTable), column.type === 'html' ? h('div', {
  21699. key: '1',
  21700. class: 'vxe-table-custom-popup--title',
  21701. domProps: {
  21702. innerHTML: colTitle
  21703. }
  21704. }) : h('div', {
  21705. key: '0',
  21706. class: 'vxe-table-custom-popup--title',
  21707. attrs: {
  21708. title: colTitle
  21709. }
  21710. }, colTitle)])]), allowResizable ? h('td', {
  21711. class: 'vxe-table-custom-popup--column-item col--resizable'
  21712. }, [column.children && column.children.length || !(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isBoolean(column.resizable) ? column.resizable : columnOpts.resizable || allResizable) ? h('span', '-') : VxeUINumberInputComponent ? h(VxeUINumberInputComponent, {
  21713. props: {
  21714. type: 'integer',
  21715. immediate: false,
  21716. disabled: isDisabled || isHidden,
  21717. value: column.renderResizeWidth,
  21718. min: customMinWidth || undefined,
  21719. max: customMaxWidth || undefined
  21720. },
  21721. on: {
  21722. modelValue(value) {
  21723. column.renderResizeWidth = Math.max(0, Number(value));
  21724. },
  21725. change() {
  21726. _vm.changeColumnWidth(column);
  21727. }
  21728. }
  21729. }) : panel_renderEmptyElement($xeTableCustomPanel)]) : panel_renderEmptyElement($xeTable), allowFixed ? h('td', {
  21730. class: 'vxe-table-custom-popup--column-item col--fixed'
  21731. }, [parent ? h('span', '-') : h('vxe-radio-group', {
  21732. props: {
  21733. value: column.renderFixed || '',
  21734. type: 'button',
  21735. size: 'mini',
  21736. disabled: isDisabled || isHidden,
  21737. options: [{
  21738. label: panel_getI18n('vxe.custom.setting.fixedLeft'),
  21739. value: 'left',
  21740. disabled: isDisabled || isHidden || isMaxFixedColumn
  21741. }, {
  21742. label: panel_getI18n('vxe.custom.setting.fixedUnset'),
  21743. value: '',
  21744. disabled: isDisabled || isHidden
  21745. }, {
  21746. label: panel_getI18n('vxe.custom.setting.fixedRight'),
  21747. value: 'right',
  21748. disabled: isDisabled || isHidden || isMaxFixedColumn
  21749. }]
  21750. },
  21751. on: {
  21752. change({
  21753. label,
  21754. $event
  21755. }) {
  21756. _vm.changeFixedOption(column, label, $event);
  21757. }
  21758. }
  21759. })]) : panel_renderEmptyElement($xeTable)]));
  21760. }
  21761. });
  21762. const scopedSlots = {
  21763. default: () => {
  21764. return h('div', {
  21765. ref: 'refBodyWrapperElem',
  21766. class: 'vxe-table-custom-popup--body-wrapper'
  21767. }, defaultSlot ? $xeTable.callSlot(defaultSlot, params, h) : [h('div', {
  21768. ref: 'refCustomBodyElem',
  21769. class: 'vxe-table-custom-popup--handle-wrapper'
  21770. }, [topSlot ? h('div', {
  21771. class: 'vxe-table-custom-popup--table-top'
  21772. }, $xeTable.callSlot(topSlot, params, h)) : panel_renderEmptyElement($xeTable), h('div', {
  21773. class: 'vxe-table-custom-popup--table-wrapper'
  21774. }, [h('table', {}, [h('colgroup', {}, [allowVisible ? h('col', {
  21775. class: 'vxe-table-custom-popup--table-col-seq'
  21776. }) : panel_renderEmptyElement($xeTable), h('col', {
  21777. class: 'vxe-table-custom-popup--table-col-title'
  21778. }), allowResizable ? h('col', {
  21779. class: 'vxe-table-custom-popup--table-col-width'
  21780. }) : panel_renderEmptyElement($xeTable), allowFixed ? h('col', {
  21781. class: 'vxe-table-custom-popup--table-col-fixed'
  21782. }) : panel_renderEmptyElement($xeTable)]), h('thead', {}, [h('tr', {}, [allowVisible ? h('th', {}, [h('div', {
  21783. class: ['vxe-table-custom--checkbox-option', {
  21784. 'is--checked': isAllChecked,
  21785. 'is--indeterminate': isAllIndeterminate
  21786. }],
  21787. attrs: {
  21788. title: panel_getI18n('vxe.table.allTitle')
  21789. },
  21790. on: {
  21791. click: _vm.allOptionEvent
  21792. }
  21793. }, [h('span', {
  21794. class: ['vxe-checkbox--icon', isAllIndeterminate ? panel_getIcon().TABLE_CHECKBOX_INDETERMINATE : isAllChecked ? panel_getIcon().TABLE_CHECKBOX_CHECKED : panel_getIcon().TABLE_CHECKBOX_UNCHECKED]
  21795. }), h('span', {
  21796. class: 'vxe-checkbox--label'
  21797. }, panel_getI18n('vxe.toolbar.customAll'))])]) : panel_renderEmptyElement($xeTable), h('th', {}, panel_getI18n('vxe.custom.setting.colTitle')), allowResizable ? h('th', {}, panel_getI18n('vxe.custom.setting.colResizable')) : panel_renderEmptyElement($xeTable), allowFixed ? h('th', {}, panel_getI18n(`vxe.custom.setting.${maxFixedSize ? 'colFixedMax' : 'colFixed'}`, [maxFixedSize])) : panel_renderEmptyElement($xeTable)])]), h('transition-group', {
  21798. class: 'vxe-table-custom--panel-list',
  21799. props: {
  21800. tag: 'tbody',
  21801. name: 'vxe-table-custom--list'
  21802. }
  21803. }, trVNs)])]), bottomSlot ? h('div', {
  21804. class: 'vxe-table-custom-popup--table-bottom'
  21805. }, $xeTable.callSlot(bottomSlot, params, h)) : panel_renderEmptyElement($xeTable), renderDragTip(h, _vm)]), !treeConfig && (aggregateConfig || rowGroupConfig) && $xeTable.getPivotTableAggregatePopupPanel ? h($xeTable.getPivotTableAggregatePopupPanel(), {
  21806. props: {
  21807. customStore
  21808. }
  21809. }) : panel_renderEmptyElement($xeTable)]);
  21810. },
  21811. footer: () => {
  21812. if (footerSlot) {
  21813. return $xeTable.callSlot(footerSlot, params, h);
  21814. }
  21815. return h('div', {
  21816. class: 'vxe-table-custom-popup--footer'
  21817. }, [h(VxeUIButtonComponent, {
  21818. props: {
  21819. content: customOpts.resetButtonText || panel_getI18n('vxe.custom.cstmRestore'),
  21820. disabled: !isCustomStatus
  21821. },
  21822. on: {
  21823. click: _vm.resetCustomEvent
  21824. }
  21825. }), immediate ? h(VxeUIButtonComponent, {
  21826. props: {
  21827. content: customOpts.resetButtonText || panel_getI18n('vxe.table.customClose')
  21828. },
  21829. on: {
  21830. click: _vm.cancelCloseEvent
  21831. }
  21832. }) : h(VxeUIButtonComponent, {
  21833. props: {
  21834. content: customOpts.resetButtonText || panel_getI18n('vxe.custom.cstmCancel')
  21835. },
  21836. on: {
  21837. click: _vm.cancelCustomEvent
  21838. }
  21839. }), immediate ? panel_renderEmptyElement($xeTable) : h(VxeUIButtonComponent, {
  21840. props: {
  21841. status: 'primary',
  21842. content: customOpts.confirmButtonText || panel_getI18n('vxe.custom.cstmConfirm')
  21843. },
  21844. on: {
  21845. click: _vm.confirmCustomEvent
  21846. }
  21847. })]);
  21848. }
  21849. };
  21850. if (headerSlot) {
  21851. scopedSlots.header = () => $xeTable.callSlot(headerSlot, params, h);
  21852. }
  21853. if (mode === 'drawer') {
  21854. return VxeUIDrawerComponent ? h(VxeUIDrawerComponent, {
  21855. key: 'drawer',
  21856. props: {
  21857. className: ['vxe-table-custom-drawer-wrapper', 'vxe-table--ignore-clear', drawerOpts.className || ''].join(' '),
  21858. value: customStore.visible,
  21859. title: drawerOpts.title || panel_getI18n('vxe.custom.cstmTitle'),
  21860. width: drawerOpts.width || Math.min(880, Math.floor(document.documentElement.clientWidth * 0.6)),
  21861. position: drawerOpts.position,
  21862. resize: !!drawerOpts.resize,
  21863. escClosable: !!drawerOpts.escClosable,
  21864. maskClosable: !!drawerOpts.maskClosable,
  21865. destroyOnClose: true,
  21866. showFooter: true
  21867. },
  21868. on: {
  21869. input(value) {
  21870. customStore.visible = value;
  21871. }
  21872. },
  21873. scopedSlots
  21874. }) : panel_renderEmptyElement($xeTableCustomPanel);
  21875. }
  21876. return VxeUIModalComponent ? h(VxeUIModalComponent, {
  21877. key: 'modal',
  21878. props: {
  21879. className: ['vxe-table-custom-popup-wrapper', 'vxe-table--ignore-clear', modalOpts.className || ''].join(' '),
  21880. value: customStore.visible,
  21881. title: modalOpts.title || panel_getI18n('vxe.custom.cstmTitle'),
  21882. width: modalOpts.width || Math.min(880, document.documentElement.clientWidth),
  21883. minWidth: modalOpts.minWidth || 700,
  21884. height: modalOpts.height || Math.min(680, document.documentElement.clientHeight),
  21885. minHeight: modalOpts.minHeight || 400,
  21886. showZoom: modalOpts.showZoom,
  21887. showMaximize: modalOpts.showMaximize,
  21888. showMinimize: modalOpts.showMinimize,
  21889. mask: modalOpts.mask,
  21890. lockView: modalOpts.lockView,
  21891. resize: modalOpts.resize,
  21892. escClosable: !!modalOpts.escClosable,
  21893. maskClosable: !!modalOpts.maskClosable,
  21894. destroyOnClose: true,
  21895. showFooter: true
  21896. },
  21897. on: {
  21898. input(value) {
  21899. customStore.visible = value;
  21900. }
  21901. },
  21902. scopedSlots
  21903. }) : panel_renderEmptyElement($xeTableCustomPanel);
  21904. };
  21905. /* harmony default export */ var panel = ({
  21906. name: 'VxeTableCustomPanel',
  21907. props: {
  21908. customStore: {
  21909. type: Object,
  21910. default: () => ({})
  21911. }
  21912. },
  21913. provide() {
  21914. const $xeTableCustomPanel = this;
  21915. return {
  21916. $xeTableCustomPanel
  21917. };
  21918. },
  21919. inject: {
  21920. $xeTable: {
  21921. default: null
  21922. }
  21923. },
  21924. data() {
  21925. const reactData = {
  21926. dragCol: null,
  21927. dragGroupField: null,
  21928. dragAggFnCol: null,
  21929. dragTipText: ''
  21930. };
  21931. const internalData = {
  21932. // prevDragCol: undefined,
  21933. // prevDragGroupField: undefined,
  21934. // prevDragAggFnColid: undefined,
  21935. // prevDragToChild: false,
  21936. // prevDragPos: null
  21937. };
  21938. return {
  21939. reactData,
  21940. internalData
  21941. };
  21942. },
  21943. computed: {},
  21944. created() {
  21945. const $xeTableCustomPanel = this;
  21946. const VxeUIModalComponent = core_.VxeUI.getComponent('VxeModal');
  21947. const VxeUIDrawerComponent = core_.VxeUI.getComponent('VxeDrawer');
  21948. const VxeUIButtonComponent = core_.VxeUI.getComponent('VxeButton');
  21949. const VxeUINumberInputComponent = core_.VxeUI.getComponent('VxeNumberInput');
  21950. const VxeUIRadioGroupComponent = core_.VxeUI.getComponent('VxeRadioGroup');
  21951. $xeTableCustomPanel.$nextTick(() => {
  21952. const $xeTable = $xeTableCustomPanel.$xeTable;
  21953. const {
  21954. customOpts
  21955. } = $xeTable;
  21956. const {
  21957. mode
  21958. } = customOpts;
  21959. if (!VxeUIModalComponent && mode === 'modal') {
  21960. errLog('vxe.error.reqComp', ['vxe-modal']);
  21961. }
  21962. if (!VxeUIDrawerComponent && mode === 'drawer') {
  21963. errLog('vxe.error.reqComp', ['vxe-drawer']);
  21964. }
  21965. if (!VxeUIButtonComponent) {
  21966. errLog('vxe.error.reqComp', ['vxe-button']);
  21967. }
  21968. if (!VxeUINumberInputComponent) {
  21969. errLog('vxe.error.reqComp', ['vxe-number-input']);
  21970. }
  21971. if (!VxeUIRadioGroupComponent) {
  21972. errLog('vxe.error.reqComp', ['vxe-radio-group']);
  21973. }
  21974. });
  21975. },
  21976. render(h) {
  21977. const $xeTableCustomPanel = this;
  21978. const $xeTable = $xeTableCustomPanel.$xeTable;
  21979. const customOpts = $xeTable.computeCustomOpts;
  21980. if (['modal', 'drawer', 'popup'].includes(`${customOpts.mode}`)) {
  21981. return renderPopupPanel(h, $xeTableCustomPanel);
  21982. }
  21983. return renderSimplePanel(h, $xeTableCustomPanel);
  21984. },
  21985. methods: {
  21986. handleWrapperMouseenterEvent(evnt) {
  21987. const $xeTableCustomPanel = this;
  21988. const $xeTable = $xeTableCustomPanel.$xeTable;
  21989. const {
  21990. customStore
  21991. } = this;
  21992. customStore.activeWrapper = true;
  21993. $xeTable.customOpenEvent(evnt);
  21994. },
  21995. handleWrapperMouseleaveEvent(evnt) {
  21996. const $xeTableCustomPanel = this;
  21997. const $xeTable = $xeTableCustomPanel.$xeTable;
  21998. const props = $xeTableCustomPanel;
  21999. const {
  22000. customStore
  22001. } = props;
  22002. customStore.activeWrapper = false;
  22003. setTimeout(() => {
  22004. if (!customStore.activeBtn && !customStore.activeWrapper) {
  22005. $xeTable.customCloseEvent(evnt);
  22006. }
  22007. }, 300);
  22008. },
  22009. getStoreData() {
  22010. return {};
  22011. },
  22012. confirmCustomEvent({
  22013. $event
  22014. }) {
  22015. const $xeTableCustomPanel = this;
  22016. const $xeTable = $xeTableCustomPanel.$xeTable;
  22017. const tableReactData = $xeTable;
  22018. tableReactData.isCustomStatus = true;
  22019. $xeTable.saveCustom();
  22020. $xeTable.closeCustom();
  22021. $xeTable.emitCustomEvent('confirm', $event);
  22022. },
  22023. cancelCloseEvent({
  22024. $event
  22025. }) {
  22026. const $xeTableCustomPanel = this;
  22027. const $xeTable = $xeTableCustomPanel.$xeTable;
  22028. $xeTable.closeCustom();
  22029. $xeTable.emitCustomEvent('close', $event);
  22030. },
  22031. cancelCustomEvent({
  22032. $event
  22033. }) {
  22034. const $xeTableCustomPanel = this;
  22035. const $xeTable = $xeTableCustomPanel.$xeTable;
  22036. $xeTable.cancelCustom();
  22037. $xeTable.closeCustom();
  22038. $xeTable.emitCustomEvent('cancel', $event);
  22039. },
  22040. handleResetCustomEvent(evnt) {
  22041. const $xeTableCustomPanel = this;
  22042. const $xeTable = $xeTableCustomPanel.$xeTable;
  22043. $xeTable.resetCustom(true);
  22044. $xeTable.closeCustom();
  22045. $xeTable.emitCustomEvent('reset', evnt);
  22046. },
  22047. resetCustomEvent(evnt) {
  22048. if (core_.VxeUI.modal) {
  22049. core_.VxeUI.modal.confirm({
  22050. content: panel_getI18n('vxe.custom.cstmConfirmRestore'),
  22051. className: 'vxe-table--ignore-clear',
  22052. escClosable: true
  22053. }).then(type => {
  22054. if (type === 'confirm') {
  22055. this.handleResetCustomEvent(evnt);
  22056. }
  22057. });
  22058. } else {
  22059. this.handleResetCustomEvent(evnt);
  22060. }
  22061. },
  22062. handleOptionCheck(column) {
  22063. const $xeTableCustomPanel = this;
  22064. const $xeTable = $xeTableCustomPanel.$xeTable;
  22065. const tableReactData = $xeTable;
  22066. const {
  22067. customColumnList
  22068. } = tableReactData;
  22069. const matchObj = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findTree(customColumnList, item => item === column);
  22070. if (matchObj && matchObj.parent) {
  22071. const {
  22072. parent
  22073. } = matchObj;
  22074. if (parent.children && parent.children.length) {
  22075. parent.renderVisible = parent.children.every(column => column.renderVisible);
  22076. parent.halfVisible = !parent.renderVisible && parent.children.some(column => column.renderVisible || column.halfVisible);
  22077. this.handleOptionCheck(parent);
  22078. }
  22079. }
  22080. },
  22081. changeCheckboxOption(column, evnt) {
  22082. const $xeTableCustomPanel = this;
  22083. const $xeTable = $xeTableCustomPanel.$xeTable;
  22084. const tableReactData = $xeTable;
  22085. const isChecked = !column.renderVisible;
  22086. const customOpts = $xeTable.computeCustomOpts;
  22087. if (customOpts.immediate) {
  22088. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree([column], item => {
  22089. item.visible = isChecked;
  22090. item.renderVisible = isChecked;
  22091. item.halfVisible = false;
  22092. });
  22093. tableReactData.isCustomStatus = true;
  22094. $xeTable.handleCustom();
  22095. $xeTable.saveCustomStore('update:visible');
  22096. } else {
  22097. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree([column], item => {
  22098. item.renderVisible = isChecked;
  22099. item.halfVisible = false;
  22100. });
  22101. }
  22102. this.handleOptionCheck(column);
  22103. $xeTable.checkCustomStatus();
  22104. $xeTable.dispatchEvent('custom-visible-change', {
  22105. column,
  22106. checked: isChecked
  22107. }, evnt);
  22108. },
  22109. changeColumnWidth(column) {
  22110. const $xeTableCustomPanel = this;
  22111. const $xeTable = $xeTableCustomPanel.$xeTable;
  22112. const tableReactData = $xeTable;
  22113. const customOpts = $xeTable.computeCustomOpts;
  22114. if (customOpts.immediate) {
  22115. if (column.renderResizeWidth !== column.renderWidth) {
  22116. column.resizeWidth = column.renderResizeWidth;
  22117. column.renderWidth = column.renderResizeWidth;
  22118. tableReactData.isCustomStatus = true;
  22119. $xeTable.handleCustom();
  22120. $xeTable.saveCustomStore('update:width');
  22121. }
  22122. }
  22123. },
  22124. changeFixedOption(column, colFixed, evnt) {
  22125. const $xeTableCustomPanel = this;
  22126. const $xeTable = $xeTableCustomPanel.$xeTable;
  22127. const tableReactData = $xeTable;
  22128. const isMaxFixedColumn = $xeTable.computeIsMaxFixedColumn;
  22129. const customOpts = $xeTable.computeCustomOpts;
  22130. let targetFixed = null;
  22131. if (customOpts.immediate) {
  22132. if (column.renderFixed === colFixed) {
  22133. targetFixed = '';
  22134. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree([column], col => {
  22135. col.fixed = '';
  22136. col.renderFixed = '';
  22137. });
  22138. } else {
  22139. if (!isMaxFixedColumn || column.renderFixed) {
  22140. targetFixed = colFixed;
  22141. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree([column], col => {
  22142. col.fixed = colFixed;
  22143. col.renderFixed = colFixed;
  22144. });
  22145. }
  22146. }
  22147. tableReactData.isCustomStatus = true;
  22148. $xeTable.handleCustom();
  22149. $xeTable.saveCustomStore('update:fixed');
  22150. } else {
  22151. if (column.renderFixed === colFixed) {
  22152. targetFixed = '';
  22153. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree([column], col => {
  22154. col.renderFixed = '';
  22155. });
  22156. } else {
  22157. if (!isMaxFixedColumn || column.renderFixed) {
  22158. targetFixed = colFixed;
  22159. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree([column], col => {
  22160. col.renderFixed = colFixed;
  22161. });
  22162. }
  22163. }
  22164. }
  22165. if (targetFixed !== null) {
  22166. $xeTable.dispatchEvent('custom-fixed-change', {
  22167. column,
  22168. fixed: targetFixed
  22169. }, evnt);
  22170. }
  22171. },
  22172. allOptionEvent(evnt) {
  22173. const $xeTableCustomPanel = this;
  22174. const $xeTable = $xeTableCustomPanel.$xeTable;
  22175. const tableReactData = $xeTable;
  22176. const {
  22177. customStore
  22178. } = tableReactData;
  22179. const isAll = !customStore.isAll;
  22180. $xeTable.toggleCustomAllCheckbox();
  22181. $xeTable.dispatchEvent('custom-visible-all', {
  22182. checked: isAll
  22183. }, evnt);
  22184. },
  22185. updateColDropTipContent() {
  22186. const $xeTableCustomPanel = this;
  22187. const $xeTable = $xeTableCustomPanel.$xeTable;
  22188. const customPanelReactData = $xeTableCustomPanel.reactData;
  22189. const {
  22190. dragCol
  22191. } = customPanelReactData;
  22192. const columnDragOpts = $xeTable.computeColumnDragOpts;
  22193. const {
  22194. tooltipMethod
  22195. } = columnDragOpts;
  22196. let tipContent = '';
  22197. if (tooltipMethod) {
  22198. const dtParams = {
  22199. $table: $xeTable,
  22200. column: dragCol
  22201. };
  22202. tipContent = `${tooltipMethod(dtParams) || ''}`;
  22203. } else {
  22204. tipContent = panel_getI18n('vxe.custom.cstmDragTarget', [dragCol && dragCol.type !== 'html' ? dragCol.getTitle() : '']);
  22205. }
  22206. customPanelReactData.dragTipText = tipContent;
  22207. },
  22208. sortMousedownEvent(evnt) {
  22209. const $xeTableCustomPanel = this;
  22210. const $xeTable = $xeTableCustomPanel.$xeTable;
  22211. const customPanelReactData = $xeTableCustomPanel.reactData;
  22212. const btnEl = evnt.currentTarget;
  22213. const cellEl = btnEl.parentElement;
  22214. const tdEl = cellEl.parentElement;
  22215. const trEl = tdEl.parentElement;
  22216. const colid = trEl.getAttribute('colid');
  22217. const column = $xeTable.getColumnById(colid);
  22218. trEl.draggable = true;
  22219. customPanelReactData.dragCol = column;
  22220. customPanelReactData.dragGroupField = null;
  22221. customPanelReactData.dragAggFnCol = null;
  22222. this.updateColDropTipContent();
  22223. addClass(trEl, 'active--drag-origin');
  22224. },
  22225. sortMouseupEvent(evnt) {
  22226. const $xeTableCustomPanel = this;
  22227. const customPanelReactData = $xeTableCustomPanel.reactData;
  22228. const btnEl = evnt.currentTarget;
  22229. const cellEl = btnEl.parentElement;
  22230. const tdEl = cellEl.parentElement;
  22231. const trEl = tdEl.parentElement;
  22232. panel_hideDropTip($xeTableCustomPanel);
  22233. trEl.draggable = false;
  22234. customPanelReactData.dragCol = null;
  22235. customPanelReactData.dragGroupField = null;
  22236. customPanelReactData.dragAggFnCol = null;
  22237. removeClass(trEl, 'active--drag-origin');
  22238. },
  22239. sortDragstartEvent(evnt) {
  22240. const $xeTableCustomPanel = this;
  22241. const customPanelInternalData = $xeTableCustomPanel.internalData;
  22242. if (evnt.dataTransfer) {
  22243. evnt.dataTransfer.setDragImage(getTpImg(), 0, 0);
  22244. }
  22245. customPanelInternalData.prevDragGroupField = null;
  22246. customPanelInternalData.prevDragAggFnColid = null;
  22247. },
  22248. sortDragendEvent(evnt) {
  22249. const $xeTableCustomPanel = this;
  22250. const $xeTable = $xeTableCustomPanel.$xeTable;
  22251. const tableProps = $xeTable;
  22252. const tableReactData = $xeTable;
  22253. const tableInternalData = $xeTable;
  22254. const customPanelReactData = $xeTableCustomPanel.reactData;
  22255. const customPanelInternalData = $xeTableCustomPanel.internalData;
  22256. const {
  22257. mouseConfig
  22258. } = tableProps;
  22259. const {
  22260. customColumnList
  22261. } = tableReactData;
  22262. const {
  22263. collectColumn
  22264. } = tableInternalData;
  22265. const customOpts = $xeTable.computeCustomOpts;
  22266. const {
  22267. immediate
  22268. } = customOpts;
  22269. const trEl = evnt.currentTarget;
  22270. const columnDragOpts = $xeTable.computeColumnDragOpts;
  22271. const {
  22272. isCrossDrag,
  22273. isSelfToChildDrag,
  22274. isToChildDrag,
  22275. dragEndMethod
  22276. } = columnDragOpts;
  22277. const {
  22278. dragCol
  22279. } = customPanelReactData;
  22280. const {
  22281. prevDragCol,
  22282. prevDragGroupField,
  22283. prevDragAggFnColid,
  22284. prevDragPos,
  22285. prevDragToChild
  22286. } = customPanelInternalData;
  22287. const dragOffsetIndex = prevDragPos === 'bottom' ? 1 : 0;
  22288. if (prevDragGroupField || prevDragAggFnColid) {
  22289. if ($xeTable.handlePivotTableAggregatePanelDragendEvent) {
  22290. $xeTable.handlePivotTableAggregatePanelDragendEvent(evnt);
  22291. }
  22292. } else if (prevDragCol && dragCol) {
  22293. // 判断是否有拖动
  22294. if (prevDragCol !== dragCol) {
  22295. const dragColumn = dragCol;
  22296. const newColumn = prevDragCol;
  22297. Promise.resolve(dragEndMethod ? dragEndMethod({
  22298. oldColumn: dragColumn,
  22299. newColumn,
  22300. dragColumn,
  22301. dragPos: prevDragPos,
  22302. dragToChild: !!prevDragToChild,
  22303. offsetIndex: dragOffsetIndex
  22304. }) : true).then(status => {
  22305. if (!status) {
  22306. return;
  22307. }
  22308. let oafIndex = -1;
  22309. let nafIndex = -1;
  22310. const oldAllMaps = {};
  22311. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree([dragColumn], column => {
  22312. oldAllMaps[column.id] = column;
  22313. });
  22314. let isSelfToChildStatus = false;
  22315. // 只有实时拖拽支持跨层级
  22316. if (immediate) {
  22317. if (dragColumn.parentId && newColumn.parentId) {
  22318. // 子到子
  22319. if (!isCrossDrag) {
  22320. return;
  22321. }
  22322. if (oldAllMaps[newColumn.id]) {
  22323. isSelfToChildStatus = true;
  22324. if (!(isCrossDrag && isSelfToChildDrag)) {
  22325. if (core_.VxeUI.modal) {
  22326. core_.VxeUI.modal.message({
  22327. status: 'error',
  22328. content: panel_getI18n('vxe.error.treeDragChild')
  22329. });
  22330. }
  22331. return;
  22332. }
  22333. }
  22334. } else if (dragColumn.parentId) {
  22335. // 子到根
  22336. if (!isCrossDrag) {
  22337. return;
  22338. }
  22339. } else if (newColumn.parentId) {
  22340. // 根到子
  22341. if (!isCrossDrag) {
  22342. return;
  22343. }
  22344. if (oldAllMaps[newColumn.id]) {
  22345. isSelfToChildStatus = true;
  22346. if (!(isCrossDrag && isSelfToChildDrag)) {
  22347. if (core_.VxeUI.modal) {
  22348. core_.VxeUI.modal.message({
  22349. status: 'error',
  22350. content: panel_getI18n('vxe.error.treeDragChild')
  22351. });
  22352. }
  22353. return;
  22354. }
  22355. }
  22356. } else {
  22357. // 根到根
  22358. }
  22359. const oldewMatchRest = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findTree(collectColumn, item => item.id === dragColumn.id);
  22360. // 改变层级
  22361. if (isSelfToChildStatus && isCrossDrag && isSelfToChildDrag) {
  22362. if (oldewMatchRest) {
  22363. const {
  22364. items: oCols,
  22365. index: oIndex
  22366. } = oldewMatchRest;
  22367. const childList = dragColumn.children || [];
  22368. childList.forEach(column => {
  22369. column.parentId = dragColumn.parentId;
  22370. });
  22371. oCols.splice(oIndex, 1, ...childList);
  22372. dragColumn.children = [];
  22373. }
  22374. } else {
  22375. if (oldewMatchRest) {
  22376. const {
  22377. items: oCols,
  22378. index: oIndex,
  22379. parent: oParent
  22380. } = oldewMatchRest;
  22381. oCols.splice(oIndex, 1);
  22382. if (!oParent) {
  22383. oafIndex = oIndex;
  22384. }
  22385. }
  22386. }
  22387. const newMatchRest = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findTree(collectColumn, item => item.id === newColumn.id);
  22388. if (newMatchRest) {
  22389. const {
  22390. items: nCols,
  22391. index: nIndex,
  22392. parent: nParent
  22393. } = newMatchRest;
  22394. // 转子级
  22395. if (isCrossDrag && isToChildDrag && prevDragToChild) {
  22396. dragColumn.parentId = newColumn.id;
  22397. newColumn.children = (newColumn.children || []).concat([dragColumn]);
  22398. } else {
  22399. dragColumn.parentId = newColumn.parentId;
  22400. nCols.splice(nIndex + dragOffsetIndex, 0, dragColumn);
  22401. }
  22402. if (!nParent) {
  22403. nafIndex = nIndex;
  22404. }
  22405. }
  22406. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(collectColumn, (column, index, items, path, parent) => {
  22407. if (!parent) {
  22408. const sortIndex = index + 1;
  22409. column.renderSortNumber = sortIndex;
  22410. }
  22411. });
  22412. } else {
  22413. oafIndex = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findIndexOf(customColumnList, item => item.id === dragColumn.id);
  22414. customColumnList.splice(oafIndex, 1);
  22415. nafIndex = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findIndexOf(customColumnList, item => item.id === newColumn.id);
  22416. customColumnList.splice(nafIndex + dragOffsetIndex, 0, dragColumn);
  22417. }
  22418. if (mouseConfig) {
  22419. if ($xeTable.clearSelected) {
  22420. $xeTable.clearSelected();
  22421. }
  22422. if ($xeTable.clearCellAreas) {
  22423. $xeTable.clearCellAreas();
  22424. $xeTable.clearCopyCellArea();
  22425. }
  22426. }
  22427. const csParams = {
  22428. oldColumn: dragColumn,
  22429. newColumn,
  22430. dragColumn,
  22431. dragPos: prevDragPos,
  22432. offsetIndex: dragOffsetIndex,
  22433. _index: {
  22434. newIndex: nafIndex,
  22435. oldIndex: oafIndex
  22436. }
  22437. };
  22438. $xeTable.dispatchEvent('custom-sort-change', csParams, evnt);
  22439. $xeTable.dispatchEvent('column-dragend', csParams, evnt);
  22440. if (immediate) {
  22441. tableReactData.customColumnList = collectColumn.slice(0);
  22442. $xeTable.handleColDragSwapColumn();
  22443. }
  22444. }).catch(() => {});
  22445. }
  22446. }
  22447. panel_hideDropTip($xeTableCustomPanel);
  22448. customPanelReactData.dragCol = null;
  22449. customPanelReactData.dragGroupField = null;
  22450. customPanelReactData.dragAggFnCol = null;
  22451. customPanelInternalData.prevDragGroupField = null;
  22452. customPanelInternalData.prevDragAggFnColid = null;
  22453. trEl.draggable = false;
  22454. trEl.removeAttribute('drag-pos');
  22455. removeClass(trEl, 'active--drag-target');
  22456. removeClass(trEl, 'active--drag-origin');
  22457. },
  22458. sortDragoverEvent(evnt) {
  22459. const $xeTableCustomPanel = this;
  22460. const $xeTable = $xeTableCustomPanel.$xeTable;
  22461. const customPanelReactData = $xeTableCustomPanel.reactData;
  22462. const customPanelInternalData = $xeTableCustomPanel.internalData;
  22463. const {
  22464. dragCol
  22465. } = customPanelReactData;
  22466. const customOpts = $xeTable.computeCustomOpts;
  22467. const {
  22468. immediate
  22469. } = customOpts;
  22470. const columnDragOpts = $xeTable.computeColumnDragOpts;
  22471. const {
  22472. isCrossDrag,
  22473. isToChildDrag
  22474. } = columnDragOpts;
  22475. const optEl = evnt.currentTarget;
  22476. const isControlKey = hasControlKey(evnt);
  22477. const colid = optEl.getAttribute('colid');
  22478. const column = $xeTable.getColumnById(colid);
  22479. customPanelInternalData.prevDragGroupField = null;
  22480. customPanelInternalData.prevDragAggFnColid = null;
  22481. // 是否移入有效列
  22482. if (column && (isCrossDrag || column.level === 1)) {
  22483. evnt.preventDefault();
  22484. const offsetY = evnt.clientY - optEl.getBoundingClientRect().y;
  22485. const dragPos = offsetY < optEl.clientHeight / 2 ? 'top' : 'bottom';
  22486. if (!dragCol || dragCol && dragCol.id === column.id || !isCrossDrag && column.level > 1 || !immediate && column.level > 1) {
  22487. panel_showDropTip($xeTableCustomPanel, evnt, optEl, false, dragPos);
  22488. return;
  22489. }
  22490. customPanelInternalData.prevDragToChild = !!(isCrossDrag && isToChildDrag && isControlKey && immediate);
  22491. customPanelInternalData.prevDragCol = column;
  22492. customPanelInternalData.prevDragPos = dragPos;
  22493. panel_showDropTip($xeTableCustomPanel, evnt, optEl, true, dragPos);
  22494. }
  22495. }
  22496. }
  22497. });
  22498. ;// CONCATENATED MODULE: ./packages/table/module/filter/panel.ts
  22499. const {
  22500. getI18n: filter_panel_getI18n,
  22501. getIcon: filter_panel_getIcon,
  22502. renderer: panel_renderer,
  22503. globalMixins,
  22504. renderEmptyElement: filter_panel_renderEmptyElement
  22505. } = core_.VxeUI;
  22506. // 全部筛选事件
  22507. function filterCheckAllEvent($xeFilterPanel, evnt, value) {
  22508. const props = $xeFilterPanel;
  22509. const {
  22510. filterStore
  22511. } = props;
  22512. const {
  22513. column
  22514. } = filterStore;
  22515. if (column && column.filters) {
  22516. column.filters.forEach(option => {
  22517. option._checked = value;
  22518. option.checked = value;
  22519. });
  22520. }
  22521. filterStore.isAllSelected = value;
  22522. filterStore.isIndeterminate = false;
  22523. }
  22524. /* harmony default export */ var filter_panel = (/* define-vxe-component start */defineVxeComponent({
  22525. name: 'VxeTableFilterPanel',
  22526. mixins: [globalMixins.sizeMixin],
  22527. props: {
  22528. filterStore: {
  22529. type: Object,
  22530. default: () => ({})
  22531. }
  22532. },
  22533. inject: {
  22534. $xeTable: {
  22535. default: null
  22536. }
  22537. },
  22538. computed: {
  22539. ...{},
  22540. computeHasCheckOption() {
  22541. const $xeFilterPanel = this;
  22542. const props = $xeFilterPanel;
  22543. const {
  22544. filterStore
  22545. } = props;
  22546. const {
  22547. column
  22548. } = filterStore;
  22549. return column && column.filters && column.filters.some(option => option.checked);
  22550. }
  22551. },
  22552. mounted() {
  22553. const $xeFilterPanel = this;
  22554. const $xeTable = $xeFilterPanel.$xeTable;
  22555. const filterOpts = $xeTable.computeFilterOpts;
  22556. const {
  22557. transfer
  22558. } = filterOpts;
  22559. const el = $xeFilterPanel.$refs.refElem;
  22560. if (transfer && el) {
  22561. document.body.appendChild(el);
  22562. }
  22563. },
  22564. beforeDestroy() {
  22565. const $xeFilterPanel = this;
  22566. const el = $xeFilterPanel.$refs.refElem;
  22567. if (el && el.parentNode) {
  22568. el.parentNode.removeChild(el);
  22569. }
  22570. },
  22571. methods: {
  22572. /*************************
  22573. * Publish methods
  22574. *************************/
  22575. // (单选)筛选发生改变
  22576. changeRadioOption(evnt, checked, item) {
  22577. const $xeFilterPanel = this;
  22578. const $xeTable = $xeFilterPanel.$xeTable;
  22579. $xeTable.handleFilterChangeRadioOption(evnt, checked, item);
  22580. },
  22581. // (多选)筛选发生改变
  22582. changeMultipleOption(evnt, checked, item) {
  22583. const $xeFilterPanel = this;
  22584. const $xeTable = $xeFilterPanel.$xeTable;
  22585. item._checked = checked;
  22586. $xeTable.checkFilterOptions();
  22587. },
  22588. changeAllOption(evnt, checked) {
  22589. const $xeFilterPanel = this;
  22590. const props = $xeFilterPanel;
  22591. const {
  22592. filterStore
  22593. } = props;
  22594. const {
  22595. column
  22596. } = filterStore;
  22597. if (column && column.filterMultiple) {
  22598. filterCheckAllEvent($xeFilterPanel, evnt, checked);
  22599. } else {
  22600. $xeFilterPanel.resetFilter(evnt);
  22601. }
  22602. },
  22603. // 筛选发生改变
  22604. changeOption(evnt, checked, item) {
  22605. const $xeFilterPanel = this;
  22606. const $xeTable = $xeFilterPanel.$xeTable;
  22607. $xeTable.handleFilterChangeOption(evnt, checked, item);
  22608. },
  22609. // 确认筛选
  22610. confirmFilter(evnt) {
  22611. const $xeFilterPanel = this;
  22612. const props = $xeFilterPanel;
  22613. const $xeTable = $xeFilterPanel.$xeTable;
  22614. const {
  22615. filterStore
  22616. } = props;
  22617. if (!evnt) {
  22618. warnLog('vxe.error.delFunc', ['confirmFilter', 'saveFilterPanelByEvent']);
  22619. }
  22620. $xeTable.handleFilterConfirmFilter(evnt || new Event('click'), filterStore.column || null);
  22621. },
  22622. // 重置筛选
  22623. resetFilter(evnt) {
  22624. const $xeFilterPanel = this;
  22625. const props = $xeFilterPanel;
  22626. const $xeTable = $xeFilterPanel.$xeTable;
  22627. const {
  22628. filterStore
  22629. } = props;
  22630. $xeTable.handleFilterResetFilter(evnt, filterStore.column || null);
  22631. },
  22632. /*************************
  22633. * Publish methods
  22634. *************************/
  22635. renderOptions(h, filterRender, compConf) {
  22636. const $xeFilterPanel = this;
  22637. const props = $xeFilterPanel;
  22638. const $xeTable = $xeFilterPanel.$xeTable;
  22639. const tableInternalData = $xeTable;
  22640. const {
  22641. filterStore
  22642. } = props;
  22643. const {
  22644. column,
  22645. maxHeight
  22646. } = filterStore;
  22647. if (!column) {
  22648. return [];
  22649. }
  22650. const {
  22651. filterMultiple,
  22652. filters,
  22653. slots
  22654. } = column;
  22655. const filterOptions = filters || [];
  22656. const filterSlot = slots ? slots.filter : null;
  22657. const params = Object.assign({}, tableInternalData._currFilterParams, {
  22658. option: filterOptions[0],
  22659. $panel: $xeFilterPanel,
  22660. $table: $xeTable
  22661. });
  22662. const rtFilter = compConf ? compConf.renderTableFilter || compConf.renderFilter : null;
  22663. if (filterSlot) {
  22664. return [h('div', {
  22665. class: 'vxe-table--filter-template',
  22666. style: maxHeight ? {
  22667. maxHeight: toCssUnit(maxHeight)
  22668. } : {}
  22669. }, $xeTable.callSlot(filterSlot, params, h))];
  22670. } else if (filterRender && rtFilter) {
  22671. return [h('div', {
  22672. class: 'vxe-table--filter-template',
  22673. style: maxHeight ? {
  22674. maxHeight: toCssUnit(maxHeight)
  22675. } : {}
  22676. }, getSlotVNs(rtFilter.call($xeTable, h, filterRender, params)))];
  22677. }
  22678. const isAllChecked = filterMultiple ? filterStore.isAllSelected : !filterOptions.some(item => item._checked);
  22679. const isAllIndeterminate = filterMultiple && filterStore.isIndeterminate;
  22680. return [h('ul', {
  22681. class: 'vxe-table--filter-header'
  22682. }, [h('li', {
  22683. class: ['vxe-table--filter-option', {
  22684. 'is--checked': isAllChecked,
  22685. 'is--indeterminate': isAllIndeterminate
  22686. }],
  22687. attrs: {
  22688. title: filter_panel_getI18n(filterMultiple ? 'vxe.table.allTitle' : 'vxe.table.allFilter')
  22689. },
  22690. on: {
  22691. click: evnt => {
  22692. $xeFilterPanel.changeAllOption(evnt, !filterStore.isAllSelected);
  22693. }
  22694. }
  22695. }, (filterMultiple ? [h('span', {
  22696. class: ['vxe-checkbox--icon', isAllIndeterminate ? filter_panel_getIcon().TABLE_CHECKBOX_INDETERMINATE : isAllChecked ? filter_panel_getIcon().TABLE_CHECKBOX_CHECKED : filter_panel_getIcon().TABLE_CHECKBOX_UNCHECKED]
  22697. })] : []).concat([h('span', {
  22698. class: 'vxe-checkbox--label'
  22699. }, filter_panel_getI18n('vxe.table.allFilter'))]))]), h('ul', {
  22700. class: 'vxe-table--filter-body',
  22701. style: maxHeight ? {
  22702. maxHeight: toCssUnit(maxHeight)
  22703. } : {}
  22704. }, filterOptions.map(item => {
  22705. const isChecked = item._checked;
  22706. const isIndeterminate = false;
  22707. return h('li', {
  22708. class: ['vxe-table--filter-option', {
  22709. 'is--checked': isChecked
  22710. }],
  22711. attrs: {
  22712. title: item.label
  22713. },
  22714. on: {
  22715. click: evnt => {
  22716. $xeFilterPanel.changeOption(evnt, !item._checked, item);
  22717. }
  22718. }
  22719. }, (filterMultiple ? [h('span', {
  22720. class: ['vxe-checkbox--icon', isIndeterminate ? filter_panel_getIcon().TABLE_CHECKBOX_INDETERMINATE : isChecked ? filter_panel_getIcon().TABLE_CHECKBOX_CHECKED : filter_panel_getIcon().TABLE_CHECKBOX_UNCHECKED]
  22721. })] : []).concat([h('span', {
  22722. class: 'vxe-checkbox--label'
  22723. }, formatText(item.label, 1))]));
  22724. }))];
  22725. },
  22726. renderFooter(h) {
  22727. const $xeFilterPanel = this;
  22728. const props = $xeFilterPanel;
  22729. const $xeTable = $xeFilterPanel.$xeTable;
  22730. const {
  22731. filterStore
  22732. } = props;
  22733. const {
  22734. column
  22735. } = filterStore;
  22736. if (!column) {
  22737. return [];
  22738. }
  22739. const filterOpts = $xeTable.computeFilterOpts;
  22740. const hasCheckOption = $xeFilterPanel.computeHasCheckOption;
  22741. const {
  22742. filterRender,
  22743. filterMultiple
  22744. } = column;
  22745. const compConf = isEnableConf(filterRender) ? panel_renderer.get(filterRender.name) : null;
  22746. const isDisabled = !hasCheckOption && !filterStore.isAllSelected && !filterStore.isIndeterminate;
  22747. return filterMultiple && (compConf ? !(compConf.showTableFilterFooter === false || compConf.showFilterFooter === false || compConf.isFooter === false) : true) ? [h('div', {
  22748. class: 'vxe-table--filter-footer'
  22749. }, [h('button', {
  22750. class: {
  22751. 'is--disabled': isDisabled
  22752. },
  22753. attrs: {
  22754. disabled: isDisabled
  22755. },
  22756. on: {
  22757. click: $xeFilterPanel.confirmFilter
  22758. }
  22759. }, filterOpts.confirmButtonText || filter_panel_getI18n('vxe.table.confirmFilter')), h('button', {
  22760. on: {
  22761. click: $xeFilterPanel.resetFilter
  22762. }
  22763. }, filterOpts.resetButtonText || filter_panel_getI18n('vxe.table.resetFilter'))])] : [];
  22764. },
  22765. renderVN(h) {
  22766. const $xeFilterPanel = this;
  22767. const props = $xeFilterPanel;
  22768. const $xeTable = $xeFilterPanel.$xeTable;
  22769. const tableInternalData = $xeTable;
  22770. const {
  22771. filterStore
  22772. } = props;
  22773. const {
  22774. visible,
  22775. column
  22776. } = filterStore;
  22777. if (!column) {
  22778. return filter_panel_renderEmptyElement($xeFilterPanel);
  22779. }
  22780. const filterRender = column ? column.filterRender : null;
  22781. const compConf = filterRender && isEnableConf(filterRender) ? panel_renderer.get(filterRender.name) : null;
  22782. const filterClassName = compConf ? compConf.tableFilterClassName || compConf.filterClassName : '';
  22783. const params = Object.assign({}, tableInternalData._currFilterParams, {
  22784. $panel: $xeFilterPanel,
  22785. $table: $xeTable
  22786. });
  22787. const tableProps = $xeTable;
  22788. const vSize = $xeFilterPanel.computeSize;
  22789. const filterOpts = $xeTable.computeFilterOpts;
  22790. const {
  22791. destroyOnClose,
  22792. className
  22793. } = filterOpts;
  22794. return h('div', {
  22795. ref: 'refElem',
  22796. class: ['vxe-table--filter-wrapper', 'filter--prevent-default', className, compConf && compConf.className ? compConf.className : '', getPropClass(filterClassName, params), {
  22797. [`size--${vSize}`]: vSize,
  22798. 'is--animat': tableProps.animat,
  22799. 'is--multiple': column.filterMultiple,
  22800. 'is--active': visible
  22801. }],
  22802. style: filterStore.style
  22803. }, filterStore.visible && (destroyOnClose ? visible : true) && column ? $xeFilterPanel.renderOptions(h, filterRender, compConf).concat($xeFilterPanel.renderFooter(h)) : []);
  22804. }
  22805. },
  22806. render(h) {
  22807. return this.renderVN(h);
  22808. }
  22809. })); /* define-vxe-component end */
  22810. ;// CONCATENATED MODULE: ./packages/table/module/export/import-panel.ts
  22811. const {
  22812. getI18n: import_panel_getI18n,
  22813. getIcon: import_panel_getIcon,
  22814. globalMixins: import_panel_globalMixins,
  22815. renderEmptyElement: import_panel_renderEmptyElement
  22816. } = core_.VxeUI;
  22817. /* harmony default export */ var import_panel = ({
  22818. name: 'VxeTableImportPanel',
  22819. mixins: [import_panel_globalMixins.sizeMixin],
  22820. props: {
  22821. defaultOptions: Object,
  22822. storeData: Object
  22823. },
  22824. components: {
  22825. // VxeModal,
  22826. // VxeRadio
  22827. },
  22828. inject: {
  22829. $xeTable: {
  22830. default: null
  22831. }
  22832. },
  22833. data() {
  22834. return {
  22835. loading: false
  22836. };
  22837. },
  22838. computed: {
  22839. selectName() {
  22840. return `${this.storeData.filename}.${this.storeData.type}`;
  22841. },
  22842. hasFile() {
  22843. return this.storeData.file && this.storeData.type;
  22844. },
  22845. parseTypeLabel() {
  22846. const {
  22847. storeData
  22848. } = this;
  22849. const {
  22850. type,
  22851. typeList
  22852. } = storeData;
  22853. if (type) {
  22854. const selectItem = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().find(typeList, item => type === item.value);
  22855. return selectItem ? selectItem.label : '*.*';
  22856. }
  22857. return `*.${typeList.map(item => item.value).join(', *.')}`;
  22858. }
  22859. },
  22860. created() {
  22861. const $xeTableImportPanel = this;
  22862. const VxeUIModalComponent = core_.VxeUI.getComponent('VxeModal');
  22863. const VxeUIButtonComponent = core_.VxeUI.getComponent('VxeButton');
  22864. const VxeUISelectComponent = core_.VxeUI.getComponent('VxeSelect');
  22865. $xeTableImportPanel.$nextTick(() => {
  22866. if (!VxeUIModalComponent) {
  22867. errLog('vxe.error.reqComp', ['vxe-modal']);
  22868. }
  22869. if (!VxeUIButtonComponent) {
  22870. errLog('vxe.error.reqComp', ['vxe-button']);
  22871. }
  22872. if (!VxeUISelectComponent) {
  22873. errLog('vxe.error.reqComp', ['vxe-select']);
  22874. }
  22875. });
  22876. },
  22877. render(h) {
  22878. const $xeTable = this.$parent;
  22879. const $xeGrid = $xeTable.$xeGrid;
  22880. const $xeGantt = $xeTable.$xeGantt;
  22881. const {
  22882. hasFile,
  22883. loading,
  22884. parseTypeLabel,
  22885. defaultOptions,
  22886. storeData,
  22887. selectName
  22888. } = this;
  22889. const slots = defaultOptions.slots || {};
  22890. const topSlot = slots.top;
  22891. const bottomSlot = slots.bottom;
  22892. const defaultSlot = slots.default;
  22893. const footerSlot = slots.footer;
  22894. return h('vxe-modal', {
  22895. ref: 'modal',
  22896. props: {
  22897. id: 'VXE_IMPORT_MODAL',
  22898. value: storeData.visible,
  22899. title: import_panel_getI18n('vxe.import.impTitle'),
  22900. width: 540,
  22901. minWidth: 360,
  22902. minHeight: 240,
  22903. mask: true,
  22904. lockView: true,
  22905. showFooter: true,
  22906. escClosable: true,
  22907. maskClosable: true,
  22908. showMaximize: true,
  22909. resize: true,
  22910. loading
  22911. },
  22912. on: {
  22913. input(value) {
  22914. storeData.visible = value;
  22915. },
  22916. show: this.showEvent
  22917. },
  22918. scopedSlots: {
  22919. default: () => {
  22920. const params = {
  22921. $table: $xeTable,
  22922. $grid: $xeGrid,
  22923. $gantt: $xeGantt,
  22924. options: defaultOptions,
  22925. params: defaultOptions.params
  22926. };
  22927. return h('div', {
  22928. class: 'vxe-table-export--panel'
  22929. }, [topSlot ? h('div', {
  22930. class: 'vxe-table-export--panel-top'
  22931. }, $xeTable.callSlot(topSlot, params, h)) : import_panel_renderEmptyElement(this), h('div', {
  22932. class: 'vxe-table-export--panel-body'
  22933. }, defaultSlot ? $xeTable.callSlot(defaultSlot, params, h) : [h('table', {
  22934. class: 'vxe-table-export--panel-table',
  22935. attrs: {
  22936. cellspacing: 0,
  22937. cellpadding: 0,
  22938. border: 0
  22939. }
  22940. }, [h('tbody', [h('tr', [h('td', import_panel_getI18n('vxe.import.impFile')), h('td', [hasFile ? h('div', {
  22941. class: 'vxe-table-export--selected--file',
  22942. attrs: {
  22943. title: selectName
  22944. }
  22945. }, [h('span', selectName), h('i', {
  22946. class: import_panel_getIcon().INPUT_CLEAR,
  22947. on: {
  22948. click: this.clearFileEvent
  22949. }
  22950. })]) : h('button', {
  22951. ref: 'fileBtn',
  22952. class: 'vxe-table-export--select--file',
  22953. attrs: {
  22954. type: 'button'
  22955. },
  22956. on: {
  22957. click: this.selectFileEvent
  22958. }
  22959. }, import_panel_getI18n('vxe.import.impSelect'))])]), h('tr', [h('td', import_panel_getI18n('vxe.import.impType')), h('td', parseTypeLabel)]), h('tr', [h('td', import_panel_getI18n('vxe.import.impMode')), h('td', [h('vxe-select', {
  22960. props: {
  22961. value: defaultOptions.mode,
  22962. options: storeData.modeList
  22963. },
  22964. on: {
  22965. modelValue(value) {
  22966. defaultOptions.mode = value;
  22967. }
  22968. }
  22969. })])])])])]), bottomSlot ? h('div', {
  22970. class: 'vxe-table-export--panel-bottom'
  22971. }, $xeTable.callSlot(bottomSlot, params, h)) : import_panel_renderEmptyElement(this)]);
  22972. },
  22973. footer: () => {
  22974. const params = {
  22975. $table: $xeTable,
  22976. $grid: $xeGrid,
  22977. $gantt: $xeGantt,
  22978. options: defaultOptions,
  22979. params: defaultOptions.params
  22980. };
  22981. return h('div', {
  22982. class: 'vxe-table-export--panel-footer'
  22983. }, footerSlot ? $xeTable.callSlot(footerSlot, params, h) : [h('div', {
  22984. class: 'vxe-table-export--panel-btns'
  22985. }, [h('vxe-button', {
  22986. on: {
  22987. click: this.cancelEvent
  22988. }
  22989. }, import_panel_getI18n('vxe.import.impCancel')), h('vxe-button', {
  22990. props: {
  22991. status: 'primary',
  22992. disabled: !hasFile || loading
  22993. },
  22994. on: {
  22995. click: this.importEvent
  22996. }
  22997. }, import_panel_getI18n('vxe.import.impConfirm'))])]);
  22998. }
  22999. }
  23000. });
  23001. },
  23002. methods: {
  23003. clearFileEvent() {
  23004. Object.assign(this.storeData, {
  23005. filename: '',
  23006. sheetName: '',
  23007. type: ''
  23008. });
  23009. },
  23010. selectFileEvent() {
  23011. const $xeTable = this.$parent;
  23012. $xeTable.readFile(this.defaultOptions).then(params => {
  23013. const {
  23014. file
  23015. } = params;
  23016. Object.assign(this.storeData, parseFile(file), {
  23017. file
  23018. });
  23019. }).catch(e => e);
  23020. },
  23021. showEvent() {
  23022. this.$nextTick(() => {
  23023. const {
  23024. $refs
  23025. } = this;
  23026. const targetElem = $refs.fileBtn;
  23027. if (targetElem) {
  23028. targetElem.focus();
  23029. }
  23030. });
  23031. },
  23032. cancelEvent() {
  23033. this.storeData.visible = false;
  23034. },
  23035. importEvent() {
  23036. const $xeTable = this.$parent;
  23037. this.loading = true;
  23038. $xeTable.importByFile(this.storeData.file, Object.assign({}, $xeTable.importOpts, this.defaultOptions)).then(() => {
  23039. this.loading = false;
  23040. this.storeData.visible = false;
  23041. }).catch(() => {
  23042. this.loading = false;
  23043. });
  23044. }
  23045. }
  23046. });
  23047. ;// CONCATENATED MODULE: ./packages/table/module/export/export-panel.ts
  23048. const {
  23049. getI18n: export_panel_getI18n,
  23050. getIcon: export_panel_getIcon,
  23051. globalMixins: export_panel_globalMixins,
  23052. renderEmptyElement: export_panel_renderEmptyElement
  23053. } = core_.VxeUI;
  23054. /* harmony default export */ var export_panel = ({
  23055. name: 'VxeTableExportPanel',
  23056. mixins: [export_panel_globalMixins.sizeMixin],
  23057. props: {
  23058. defaultOptions: Object,
  23059. storeData: Object
  23060. },
  23061. components: {
  23062. // VxeModal,
  23063. // VxeInput,
  23064. // VxeCheckbox,
  23065. // VxeSelect,
  23066. // VxeOption
  23067. },
  23068. inject: {
  23069. $xeTable: {
  23070. default: null
  23071. }
  23072. },
  23073. data() {
  23074. return {
  23075. isAll: false,
  23076. isIndeterminate: false,
  23077. loading: false
  23078. };
  23079. },
  23080. computed: {
  23081. checkedAll() {
  23082. return this.storeData.columns.every(column => column.checked);
  23083. },
  23084. showSheet() {
  23085. return ['html', 'xml', 'xlsx', 'pdf'].indexOf(this.defaultOptions.type) > -1;
  23086. },
  23087. supportMerge() {
  23088. const {
  23089. storeData,
  23090. defaultOptions
  23091. } = this;
  23092. return !defaultOptions.original && defaultOptions.mode === 'current' && (storeData.isPrint || ['html', 'xlsx'].indexOf(defaultOptions.type) > -1);
  23093. },
  23094. // computeSupportGroup () {
  23095. // const { defaultOptions } = this
  23096. // return ['html', 'xlsx', 'csv', 'txt'].indexOf(defaultOptions.type) > -1
  23097. // },
  23098. supportStyle() {
  23099. const {
  23100. defaultOptions
  23101. } = this;
  23102. return !defaultOptions.original && ['xlsx'].indexOf(defaultOptions.type) > -1;
  23103. }
  23104. },
  23105. created() {
  23106. const $xeTableExportPanel = this;
  23107. const VxeUIModalComponent = core_.VxeUI.getComponent('VxeModal');
  23108. const VxeUIButtonComponent = core_.VxeUI.getComponent('VxeButton');
  23109. const VxeUISelectComponent = core_.VxeUI.getComponent('VxeSelect');
  23110. const VxeUIInputComponent = core_.VxeUI.getComponent('VxeInput');
  23111. const VxeUICheckboxComponent = core_.VxeUI.getComponent('VxeCheckbox');
  23112. $xeTableExportPanel.$nextTick(() => {
  23113. if (!VxeUIModalComponent) {
  23114. errLog('vxe.error.reqComp', ['vxe-modal']);
  23115. }
  23116. if (!VxeUIButtonComponent) {
  23117. errLog('vxe.error.reqComp', ['vxe-button']);
  23118. }
  23119. if (!VxeUISelectComponent) {
  23120. errLog('vxe.error.reqComp', ['vxe-select']);
  23121. }
  23122. if (!VxeUIInputComponent) {
  23123. errLog('vxe.error.reqComp', ['vxe-input']);
  23124. }
  23125. if (!VxeUICheckboxComponent) {
  23126. errLog('vxe.error.reqComp', ['vxe-checkbox']);
  23127. }
  23128. });
  23129. },
  23130. render(h) {
  23131. const $xeTable = this.$xeTable;
  23132. const $xeGrid = $xeTable.$xeGrid;
  23133. const $xeGantt = $xeTable.$xeGantt;
  23134. const {
  23135. _e,
  23136. checkedAll,
  23137. isAll: isAllChecked,
  23138. isIndeterminate: isAllIndeterminate,
  23139. showSheet,
  23140. supportMerge,
  23141. supportStyle,
  23142. defaultOptions,
  23143. storeData
  23144. } = this;
  23145. const {
  23146. hasTree,
  23147. hasMerge,
  23148. isPrint,
  23149. hasColgroup,
  23150. columns
  23151. } = storeData;
  23152. const {
  23153. isHeader
  23154. } = defaultOptions;
  23155. // const supportGroup = this.computeSupportGroup
  23156. const slots = defaultOptions.slots || {};
  23157. const topSlot = slots.top;
  23158. const bottomSlot = slots.bottom;
  23159. const defaultSlot = slots.default;
  23160. const footerSlot = slots.footer;
  23161. const parameterSlot = slots.parameter;
  23162. const cols = [];
  23163. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(columns, column => {
  23164. const colTitle = formatText(column.getTitle(), 1);
  23165. const isColGroup = column.children && column.children.length;
  23166. const isChecked = column.checked;
  23167. const indeterminate = column.halfChecked;
  23168. const isHtml = column.type === 'html';
  23169. cols.push(h('li', {
  23170. class: ['vxe-table-export--panel-column-option', `level--${column.level}`, {
  23171. 'is--group': isColGroup,
  23172. 'is--checked': isChecked,
  23173. 'is--indeterminate': indeterminate,
  23174. 'is--disabled': column.disabled
  23175. }],
  23176. attrs: {
  23177. title: colTitle
  23178. },
  23179. on: {
  23180. click: () => {
  23181. if (!column.disabled) {
  23182. this.changeOption(column);
  23183. }
  23184. }
  23185. }
  23186. }, [h('span', {
  23187. class: ['vxe-checkbox--icon', indeterminate ? export_panel_getIcon().TABLE_CHECKBOX_INDETERMINATE : isChecked ? export_panel_getIcon().TABLE_CHECKBOX_CHECKED : export_panel_getIcon().TABLE_CHECKBOX_UNCHECKED]
  23188. }), isHtml ? h('span', {
  23189. key: '1',
  23190. class: 'vxe-checkbox--label',
  23191. domProps: {
  23192. innerHTML: colTitle
  23193. }
  23194. }) : h('span', {
  23195. key: '0',
  23196. class: 'vxe-checkbox--label'
  23197. }, colTitle)]));
  23198. });
  23199. return h('vxe-modal', {
  23200. ref: 'modal',
  23201. props: {
  23202. id: 'VXE_EXPORT_MODAL',
  23203. value: storeData.visible,
  23204. title: export_panel_getI18n(isPrint ? 'vxe.export.printTitle' : 'vxe.export.expTitle'),
  23205. width: 660,
  23206. minWidth: 500,
  23207. minHeight: 400,
  23208. mask: true,
  23209. lockView: true,
  23210. showFooter: true,
  23211. escClosable: true,
  23212. maskClosable: true,
  23213. showMaximize: true,
  23214. resize: true,
  23215. loading: this.loading
  23216. },
  23217. on: {
  23218. input(value) {
  23219. storeData.visible = value;
  23220. },
  23221. show: this.showEvent
  23222. },
  23223. scopedSlots: {
  23224. default: () => {
  23225. const params = {
  23226. $table: $xeTable,
  23227. $grid: $xeGrid,
  23228. $gantt: $xeGantt,
  23229. options: defaultOptions,
  23230. columns,
  23231. params: defaultOptions.params
  23232. };
  23233. const hasEmptyData = defaultOptions.mode === 'empty';
  23234. return h('div', {
  23235. class: 'vxe-table-export--panel'
  23236. }, [topSlot ? h('div', {
  23237. class: 'vxe-table-export--panel-top'
  23238. }, $xeTable.callSlot(topSlot, params, h)) : export_panel_renderEmptyElement(this), h('div', {
  23239. class: 'vxe-table-export--panel-body'
  23240. }, defaultSlot ? $xeTable.callSlot(defaultSlot, params, h) : [h('table', {
  23241. attrs: {
  23242. class: 'vxe-table-export--panel-table',
  23243. cellspacing: 0,
  23244. cellpadding: 0,
  23245. border: 0
  23246. }
  23247. }, [h('tbody', [[isPrint ? _e() : h('tr', [h('td', export_panel_getI18n('vxe.export.expName')), h('td', [h('vxe-input', {
  23248. ref: 'filename',
  23249. props: {
  23250. value: defaultOptions.filename,
  23251. type: 'text',
  23252. clearable: true,
  23253. placeholder: export_panel_getI18n('vxe.export.expNamePlaceholder')
  23254. },
  23255. on: {
  23256. modelValue(value) {
  23257. defaultOptions.filename = value;
  23258. }
  23259. }
  23260. })])]), isPrint ? _e() : h('tr', [h('td', export_panel_getI18n('vxe.export.expType')), h('td', [h('vxe-select', {
  23261. props: {
  23262. value: defaultOptions.type,
  23263. options: storeData.typeList
  23264. },
  23265. on: {
  23266. modelValue(value) {
  23267. defaultOptions.type = value;
  23268. }
  23269. }
  23270. })])]), isPrint || showSheet ? h('tr', [h('td', export_panel_getI18n('vxe.export.expSheetName')), h('td', [h('vxe-input', {
  23271. ref: 'sheetname',
  23272. props: {
  23273. value: defaultOptions.sheetName,
  23274. type: 'text',
  23275. clearable: true,
  23276. placeholder: export_panel_getI18n('vxe.export.expSheetNamePlaceholder')
  23277. },
  23278. on: {
  23279. modelValue(value) {
  23280. defaultOptions.sheetName = value;
  23281. }
  23282. }
  23283. })])]) : _e(), h('tr', [h('td', export_panel_getI18n('vxe.export.expMode')), h('td', [h('vxe-select', {
  23284. props: {
  23285. value: defaultOptions.mode,
  23286. options: storeData.modeList
  23287. },
  23288. on: {
  23289. modelValue(value) {
  23290. defaultOptions.mode = value;
  23291. }
  23292. }
  23293. })])]), h('tr', [h('td', [export_panel_getI18n('vxe.export.expColumn')]), h('td', [h('div', {
  23294. class: 'vxe-table-export--panel-column'
  23295. }, [h('ul', {
  23296. class: 'vxe-table-export--panel-column-header'
  23297. }, [h('li', {
  23298. class: ['vxe-table-export--panel-column-option', {
  23299. 'is--checked': isAllChecked,
  23300. 'is--indeterminate': isAllIndeterminate
  23301. }],
  23302. attrs: {
  23303. title: export_panel_getI18n('vxe.table.allTitle')
  23304. },
  23305. on: {
  23306. click: this.allColumnEvent
  23307. }
  23308. }, [h('span', {
  23309. class: ['vxe-checkbox--icon', isAllIndeterminate ? export_panel_getIcon().TABLE_CHECKBOX_INDETERMINATE : isAllChecked ? export_panel_getIcon().TABLE_CHECKBOX_CHECKED : export_panel_getIcon().TABLE_CHECKBOX_UNCHECKED]
  23310. }), h('span', {
  23311. class: 'vxe-checkbox--label'
  23312. }, export_panel_getI18n('vxe.export.expCurrentColumn'))])]), h('ul', {
  23313. class: 'vxe-table-export--panel-column-body'
  23314. }, cols)])])]), h('tr', [h('td', export_panel_getI18n('vxe.export.expOpts')), parameterSlot ? h('td', [h('div', {
  23315. class: 'vxe-table-export--panel-option-row'
  23316. }, $xeTable.callSlot(parameterSlot, params, h))]) : h('td', [h('div', {
  23317. class: 'vxe-table-export--panel-option-row'
  23318. }, [h('vxe-checkbox', {
  23319. props: {
  23320. value: hasEmptyData || isHeader,
  23321. disabled: hasEmptyData,
  23322. title: export_panel_getI18n('vxe.export.expHeaderTitle'),
  23323. content: export_panel_getI18n('vxe.export.expOptHeader')
  23324. },
  23325. on: {
  23326. input(value) {
  23327. defaultOptions.isHeader = value;
  23328. }
  23329. }
  23330. }), h('vxe-checkbox', {
  23331. props: {
  23332. value: isHeader ? defaultOptions.isTitle : false,
  23333. disabled: !isHeader,
  23334. title: export_panel_getI18n('vxe.export.expTitleTitle'),
  23335. content: export_panel_getI18n('vxe.export.expOptTitle')
  23336. },
  23337. on: {
  23338. input(value) {
  23339. defaultOptions.isTitle = value;
  23340. }
  23341. }
  23342. }), h('vxe-checkbox', {
  23343. props: {
  23344. value: isHeader && hasColgroup && supportMerge ? defaultOptions.isColgroup : false,
  23345. disabled: !isHeader || !hasColgroup || !supportMerge,
  23346. title: export_panel_getI18n('vxe.export.expColgroupTitle'),
  23347. content: export_panel_getI18n('vxe.export.expOptColgroup')
  23348. },
  23349. on: {
  23350. input(value) {
  23351. defaultOptions.isColgroup = value;
  23352. }
  23353. }
  23354. })]), h('div', {
  23355. class: 'vxe-table-export--panel-option-row'
  23356. }, [h('vxe-checkbox', {
  23357. props: {
  23358. value: hasEmptyData ? false : defaultOptions.original,
  23359. disabled: hasEmptyData,
  23360. title: export_panel_getI18n('vxe.export.expOriginalTitle'),
  23361. content: export_panel_getI18n('vxe.export.expOptOriginal')
  23362. },
  23363. on: {
  23364. input(value) {
  23365. defaultOptions.original = value;
  23366. }
  23367. }
  23368. }), h('vxe-checkbox', {
  23369. props: {
  23370. value: hasMerge && supportMerge && checkedAll ? defaultOptions.isMerge : false,
  23371. disabled: hasEmptyData || !hasMerge || !supportMerge || !checkedAll,
  23372. title: export_panel_getI18n('vxe.export.expMergeTitle'),
  23373. content: export_panel_getI18n('vxe.export.expOptMerge')
  23374. },
  23375. on: {
  23376. input(value) {
  23377. defaultOptions.isMerge = value;
  23378. }
  23379. }
  23380. }), isPrint ? _e() : h('vxe-checkbox', {
  23381. props: {
  23382. value: supportStyle ? defaultOptions.useStyle : false,
  23383. disabled: !supportStyle,
  23384. title: export_panel_getI18n('vxe.export.expUseStyleTitle'),
  23385. content: export_panel_getI18n('vxe.export.expOptUseStyle')
  23386. },
  23387. on: {
  23388. input(value) {
  23389. defaultOptions.useStyle = value;
  23390. }
  23391. }
  23392. }), h('vxe-checkbox', {
  23393. props: {
  23394. value: hasTree ? defaultOptions.isAllExpand : false,
  23395. disabled: hasEmptyData || !hasTree,
  23396. title: export_panel_getI18n('vxe.export.expAllExpandTitle'),
  23397. content: export_panel_getI18n('vxe.export.expOptAllExpand')
  23398. },
  23399. on: {
  23400. input(value) {
  23401. defaultOptions.isAllExpand = value;
  23402. }
  23403. }
  23404. })]), h('div', {
  23405. class: 'vxe-table-export--panel-option-row'
  23406. }, [h('vxe-checkbox', {
  23407. props: {
  23408. value: defaultOptions.isFooter,
  23409. disabled: !storeData.hasFooter,
  23410. title: export_panel_getI18n('vxe.export.expFooterTitle'),
  23411. content: export_panel_getI18n('vxe.export.expOptFooter')
  23412. },
  23413. on: {
  23414. input(value) {
  23415. defaultOptions.isFooter = value;
  23416. }
  23417. }
  23418. })])])])]])])]), bottomSlot ? h('div', {
  23419. class: 'vxe-table-export--panel-bottom'
  23420. }, $xeTable.callSlot(bottomSlot, params, h)) : export_panel_renderEmptyElement(this)]);
  23421. },
  23422. footer: () => {
  23423. const params = {
  23424. $table: $xeTable,
  23425. $grid: $xeGrid,
  23426. $gantt: $xeGantt,
  23427. options: defaultOptions,
  23428. columns,
  23429. params: defaultOptions.params
  23430. };
  23431. return h('div', {
  23432. class: 'vxe-table-export--panel-footer'
  23433. }, footerSlot ? $xeTable.callSlot(footerSlot, params, h) : [h('div', {
  23434. class: 'vxe-table-export--panel-btns'
  23435. }, [h('vxe-button', {
  23436. props: {
  23437. content: export_panel_getI18n('vxe.export.expCancel')
  23438. },
  23439. on: {
  23440. click: this.cancelEvent
  23441. }
  23442. }), h('vxe-button', {
  23443. ref: 'confirmBtn',
  23444. props: {
  23445. status: 'primary',
  23446. content: export_panel_getI18n(isPrint ? 'vxe.export.expPrint' : 'vxe.export.expConfirm')
  23447. },
  23448. on: {
  23449. click: this.confirmEvent
  23450. }
  23451. })])]);
  23452. }
  23453. }
  23454. });
  23455. },
  23456. methods: {
  23457. changeOption(column) {
  23458. const isChecked = !column.checked;
  23459. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree([column], item => {
  23460. item.checked = isChecked;
  23461. item.halfChecked = false;
  23462. });
  23463. this.handleOptionCheck(column);
  23464. this.checkStatus();
  23465. },
  23466. handleOptionCheck(column) {
  23467. const matchObj = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findTree(this.storeData.columns, item => item === column);
  23468. if (matchObj && matchObj.parent) {
  23469. const {
  23470. parent
  23471. } = matchObj;
  23472. if (parent.children && parent.children.length) {
  23473. parent.checked = parent.children.every(column => column.checked);
  23474. parent.halfChecked = !parent.checked && parent.children.some(column => column.checked || column.halfChecked);
  23475. this.handleOptionCheck(parent);
  23476. }
  23477. }
  23478. },
  23479. checkStatus() {
  23480. const columns = this.storeData.columns;
  23481. this.isAll = columns.every(column => column.disabled || column.checked);
  23482. this.isIndeterminate = !this.isAll && columns.some(column => !column.disabled && (column.checked || column.halfChecked));
  23483. },
  23484. allColumnEvent() {
  23485. const isAll = !this.isAll;
  23486. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(this.storeData.columns, column => {
  23487. if (!column.disabled) {
  23488. column.checked = isAll;
  23489. column.halfChecked = false;
  23490. }
  23491. });
  23492. this.isAll = isAll;
  23493. this.checkStatus();
  23494. },
  23495. showEvent() {
  23496. this.$nextTick(() => {
  23497. const {
  23498. $refs
  23499. } = this;
  23500. const targetElem = $refs.filename || $refs.sheetname || $refs.confirmBtn;
  23501. if (targetElem) {
  23502. targetElem.focus();
  23503. }
  23504. });
  23505. this.checkStatus();
  23506. },
  23507. getExportOption() {
  23508. const {
  23509. checkedAll,
  23510. storeData,
  23511. defaultOptions,
  23512. supportMerge
  23513. } = this;
  23514. const {
  23515. hasMerge,
  23516. columns
  23517. } = storeData;
  23518. const expColumns = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().searchTree(columns, column => column.checked, {
  23519. children: 'children',
  23520. mapChildren: 'childNodes',
  23521. original: true
  23522. });
  23523. return Object.assign({}, defaultOptions, {
  23524. columns: expColumns,
  23525. isMerge: hasMerge && supportMerge && checkedAll ? defaultOptions.isMerge : false
  23526. });
  23527. },
  23528. cancelEvent() {
  23529. this.storeData.visible = false;
  23530. },
  23531. confirmEvent(evnt) {
  23532. if (this.storeData.isPrint) {
  23533. this.printEvent(evnt);
  23534. } else {
  23535. this.exportEvent(evnt);
  23536. }
  23537. },
  23538. printEvent() {
  23539. const $xeTable = this.$parent;
  23540. this.storeData.visible = false;
  23541. $xeTable.print(Object.assign({}, $xeTable.printOpts, this.getExportOption()));
  23542. },
  23543. exportEvent() {
  23544. const $xeTable = this.$xeTable;
  23545. const exportOpts = $xeTable.exportOpts;
  23546. this.loading = true;
  23547. $xeTable.exportData(Object.assign({}, exportOpts, this.getExportOption())).then(() => {
  23548. this.loading = false;
  23549. this.storeData.visible = false;
  23550. }).catch(() => {
  23551. this.loading = false;
  23552. });
  23553. }
  23554. }
  23555. });
  23556. ;// CONCATENATED MODULE: ./packages/table/module/menu/panel.ts
  23557. const {
  23558. getIcon: menu_panel_getIcon,
  23559. renderEmptyElement: menu_panel_renderEmptyElement
  23560. } = core_.VxeUI;
  23561. /* harmony default export */ var menu_panel = ({
  23562. name: 'VxeTableMenuPanel',
  23563. props: {
  23564. ctxMenuStore: Object,
  23565. ctxMenuOpts: Object
  23566. },
  23567. inject: {
  23568. $xeTable: {
  23569. default: null
  23570. }
  23571. },
  23572. mounted() {
  23573. const $xeMenuPanel = this;
  23574. const $xeTable = $xeMenuPanel.$xeTable;
  23575. const menuOpts = $xeTable.computeMenuOpts;
  23576. const {
  23577. transfer
  23578. } = menuOpts;
  23579. const el = this.$refs.refElem;
  23580. if (transfer && el) {
  23581. document.body.appendChild(el);
  23582. }
  23583. },
  23584. beforeDestroy() {
  23585. const el = this.$refs.refElem;
  23586. if (el && el.parentNode) {
  23587. el.parentNode.removeChild(el);
  23588. }
  23589. },
  23590. render(h) {
  23591. const $xeMenuPanel = this;
  23592. const $xeTable = $xeMenuPanel.$xeTable;
  23593. const tableReactData = $xeTable;
  23594. const {
  23595. ctxMenuStore
  23596. } = tableReactData;
  23597. const menuOpts = $xeTable.computeMenuOpts;
  23598. const {
  23599. destroyOnClose
  23600. } = menuOpts;
  23601. const {
  23602. visible,
  23603. list,
  23604. className
  23605. } = ctxMenuStore;
  23606. return h('div', {
  23607. ref: 'refElem',
  23608. class: ['vxe-table--context-menu-wrapper', className, {
  23609. 'is--visible': visible
  23610. }],
  23611. style: ctxMenuStore.style
  23612. }, (destroyOnClose ? visible : true) ? list.map((options, gIndex) => {
  23613. return options.every(item => item.visible === false) ? menu_panel_renderEmptyElement($xeTable) : h('ul', {
  23614. class: 'vxe-context-menu--option-wrapper',
  23615. key: gIndex
  23616. }, options.map((item, index) => {
  23617. const hasChildMenus = item.children && item.children.some(child => child.visible !== false);
  23618. const prefixOpts = Object.assign({}, item.prefixConfig);
  23619. const prefixIcon = prefixOpts.icon || item.prefixIcon;
  23620. const suffixOpts = Object.assign({}, item.suffixConfig);
  23621. const suffixIcon = suffixOpts.icon || item.suffixIcon;
  23622. const menuContent = getFuncText(item.name);
  23623. return item.visible === false ? menu_panel_renderEmptyElement($xeTable) : h('li', {
  23624. class: [item.className, {
  23625. 'link--disabled': item.disabled,
  23626. 'link--active': item === ctxMenuStore.selected
  23627. }],
  23628. key: `${gIndex}_${index}`
  23629. }, [h('a', {
  23630. class: 'vxe-context-menu--link',
  23631. on: {
  23632. click(evnt) {
  23633. $xeTable.ctxMenuLinkEvent(evnt, item);
  23634. },
  23635. mouseover(evnt) {
  23636. $xeTable.ctxMenuMouseoverEvent(evnt, item);
  23637. },
  23638. mouseout(evnt) {
  23639. $xeTable.ctxMenuMouseoutEvent(evnt, item);
  23640. }
  23641. }
  23642. }, [h('div', {
  23643. class: ['vxe-context-menu--link-prefix', prefixOpts.className || '']
  23644. }, [prefixIcon && external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(prefixIcon) ? h('span', {}, getSlotVNs(prefixIcon.call($xeTable, {}))) : h('i', {
  23645. class: prefixIcon
  23646. }), prefixOpts.content ? h('span', {}, `${prefixOpts.content}`) : menu_panel_renderEmptyElement($xeTable)]), h('span', {
  23647. class: 'vxe-context-menu--link-content',
  23648. attrs: {
  23649. title: menuContent
  23650. }
  23651. }, menuContent), h('div', {
  23652. class: ['vxe-context-menu--link-suffix', suffixOpts.className || '']
  23653. }, [suffixIcon && external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(suffixIcon) ? h('span', {}, getSlotVNs(suffixIcon.call($xeTable, {}))) : h('i', {
  23654. class: suffixIcon || (hasChildMenus ? menu_panel_getIcon().TABLE_MENU_OPTIONS : '')
  23655. }), suffixOpts.content ? h('span', `${suffixOpts.content}`) : menu_panel_renderEmptyElement($xeTable)])]), hasChildMenus && item.children ? h('ul', {
  23656. class: ['vxe-table--context-menu-clild-wrapper', {
  23657. 'is--show': item === ctxMenuStore.selected && ctxMenuStore.showChild
  23658. }]
  23659. }, item.children.map((child, cIndex) => {
  23660. const childPrefixOpts = Object.assign({}, child.prefixConfig);
  23661. const childPrefixIcon = childPrefixOpts.icon || child.prefixIcon;
  23662. const childSuffixOpts = Object.assign({}, child.suffixConfig);
  23663. const childSuffixIcon = childSuffixOpts.icon || child.suffixIcon;
  23664. const childMenuContent = getFuncText(child.name);
  23665. return child.visible === false ? null : h('li', {
  23666. class: [child.className, {
  23667. 'link--disabled': child.disabled,
  23668. 'link--active': child === ctxMenuStore.selectChild
  23669. }],
  23670. key: `${gIndex}_${index}_${cIndex}`
  23671. }, [h('a', {
  23672. class: 'vxe-context-menu--link',
  23673. on: {
  23674. click(evnt) {
  23675. $xeTable.ctxMenuLinkEvent(evnt, child);
  23676. },
  23677. mouseover(evnt) {
  23678. $xeTable.ctxMenuMouseoverEvent(evnt, item, child);
  23679. },
  23680. mouseout(evnt) {
  23681. $xeTable.ctxMenuMouseoutEvent(evnt, item);
  23682. }
  23683. }
  23684. }, [h('div', {
  23685. class: ['vxe-context-menu--link-prefix', childPrefixOpts.className || '']
  23686. }, [childPrefixIcon && external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(childPrefixIcon) ? h('span', {}, getSlotVNs(childPrefixIcon.call($xeTable, {}))) : h('i', {
  23687. class: childPrefixIcon
  23688. }), childPrefixOpts.content ? h('span', `${childPrefixOpts.content}`) : menu_panel_renderEmptyElement($xeTable)]), h('span', {
  23689. class: 'vxe-context-menu--link-content',
  23690. attrs: {
  23691. title: childMenuContent
  23692. }
  23693. }, childMenuContent), h('div', {
  23694. class: ['vxe-context-menu--link-suffix', childSuffixOpts.className || '']
  23695. }, [childSuffixIcon && external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(childSuffixIcon) ? h('span', {}, getSlotVNs(childSuffixIcon.call($xeTable, {}))) : h('i', {
  23696. class: childSuffixIcon
  23697. }), childSuffixOpts.content ? h('span', `${childSuffixOpts.content}`) : menu_panel_renderEmptyElement($xeTable)])])]);
  23698. })) : null]);
  23699. }));
  23700. }) : []);
  23701. }
  23702. });
  23703. ;// CONCATENATED MODULE: ./packages/table/module/filter/mixin.ts
  23704. const {
  23705. renderer: mixin_renderer
  23706. } = core_.VxeUI;
  23707. /* harmony default export */ var mixin = ({
  23708. methods: {
  23709. /**
  23710. * 手动弹出筛选面板
  23711. * @param column
  23712. */
  23713. _openFilter(fieldOrColumn) {
  23714. const $xeTable = this;
  23715. const column = handleFieldOrColumn(this, fieldOrColumn);
  23716. if (column && column.filters) {
  23717. const {
  23718. elemStore
  23719. } = this;
  23720. const {
  23721. fixed
  23722. } = column;
  23723. return $xeTable.scrollToColumn(column).then(() => {
  23724. const headerWrapperElem = elemStore[`${fixed || 'main'}-header-wrapper`] || elemStore['main-header-wrapper'];
  23725. if (headerWrapperElem) {
  23726. const filterBtnElem = headerWrapperElem.querySelector(`.vxe-header--column.${column.id} .vxe-cell--filter`);
  23727. triggerEvent(filterBtnElem, 'click');
  23728. }
  23729. });
  23730. }
  23731. return $xeTable.$nextTick();
  23732. },
  23733. /**
  23734. * 修改筛选条件列表
  23735. * @param {ColumnInfo} fieldOrColumn 列
  23736. * @param {Array} options 选项
  23737. */
  23738. _setFilter(fieldOrColumn, options, isUpdate) {
  23739. const $xeTable = this;
  23740. const reactData = $xeTable;
  23741. const {
  23742. filterStore
  23743. } = reactData;
  23744. const column = handleFieldOrColumn($xeTable, fieldOrColumn);
  23745. if (column && column.filters) {
  23746. column.filters = toFilters(options || [], column.id);
  23747. if (isUpdate) {
  23748. return $xeTable.handleColumnConfirmFilter(column, null);
  23749. } else {
  23750. if (filterStore.visible) {
  23751. $xeTable.handleFilterOptions(column);
  23752. }
  23753. }
  23754. }
  23755. return $xeTable.$nextTick();
  23756. },
  23757. checkFilterOptions() {
  23758. const $xeTable = this;
  23759. const reactData = $xeTable;
  23760. const {
  23761. filterStore
  23762. } = reactData;
  23763. const {
  23764. column
  23765. } = filterStore;
  23766. if (column) {
  23767. const filterOptions = column.filters || [];
  23768. filterStore.isAllSelected = filterOptions.every(item => item._checked);
  23769. filterStore.isIndeterminate = !filterStore.isAllSelected && filterOptions.some(item => item._checked);
  23770. }
  23771. },
  23772. /**
  23773. * 点击筛选事件
  23774. * 当筛选图标被点击时触发
  23775. * 更新选项是否全部状态
  23776. * 打开筛选面板
  23777. * @param {Event} evnt 事件
  23778. * @param {ColumnInfo} column 列配置
  23779. * @param {Object} params 参数
  23780. */
  23781. triggerFilterEvent(evnt, column, params) {
  23782. const $xeTable = this;
  23783. const $xeGrid = $xeTable.$xeGrid;
  23784. const $xeGantt = $xeTable.$xeGantt;
  23785. const reactData = $xeTable;
  23786. const internalData = $xeTable;
  23787. const $xeGGWrapper = $xeGrid || $xeGantt;
  23788. const {
  23789. initStore,
  23790. filterStore
  23791. } = reactData;
  23792. const {
  23793. elemStore
  23794. } = internalData;
  23795. if (filterStore.column === column && filterStore.visible) {
  23796. filterStore.visible = false;
  23797. } else {
  23798. const tableEl = $xeTable.$refs.refElem;
  23799. const {
  23800. scrollTop,
  23801. scrollLeft,
  23802. visibleHeight,
  23803. visibleWidth
  23804. } = getDomNode();
  23805. const filterOpts = $xeTable.computeFilterOpts;
  23806. const {
  23807. transfer
  23808. } = filterOpts;
  23809. const tableRect = tableEl.getBoundingClientRect();
  23810. const btnElem = evnt.currentTarget;
  23811. const filterRender = column ? column.filterRender : null;
  23812. const compConf = filterRender && isEnableConf(filterRender) ? mixin_renderer.get(filterRender.name) : null;
  23813. $xeTable.handleFilterOptions(column);
  23814. internalData._currFilterParams = params;
  23815. filterStore.style = null;
  23816. filterStore.visible = true;
  23817. initStore.filter = true;
  23818. $xeTable.$nextTick(() => {
  23819. const headerScrollElem = getRefElem(elemStore['main-header-scroll']);
  23820. if (!headerScrollElem) {
  23821. return;
  23822. }
  23823. const tableFilter = $xeTable.$refs.refTableFilter;
  23824. const filterWrapperElem = tableFilter ? tableFilter.$el : null;
  23825. if (!filterWrapperElem) {
  23826. return;
  23827. }
  23828. const btnRect = btnElem.getBoundingClientRect();
  23829. const filterHeadElem = filterWrapperElem.querySelector('.vxe-table--filter-header');
  23830. const filterFootElem = filterWrapperElem.querySelector('.vxe-table--filter-footer');
  23831. const filterWidth = filterWrapperElem.offsetWidth;
  23832. const centerWidth = filterWidth / 2;
  23833. let left = 0;
  23834. let top = 0;
  23835. let maxHeight = 0;
  23836. if (transfer) {
  23837. left = btnRect.left - centerWidth + scrollLeft;
  23838. top = btnRect.top + btnElem.clientHeight + scrollTop;
  23839. maxHeight = Math.min(Math.max(tableRect.height, Math.floor(visibleHeight / 2)), Math.max(80, visibleHeight - top - (filterHeadElem ? filterHeadElem.clientHeight : 0) - (filterFootElem ? filterFootElem.clientHeight : 0) - 28));
  23840. if (left < 16) {
  23841. left = 16;
  23842. } else if (left > visibleWidth - filterWidth - 16) {
  23843. left = visibleWidth - filterWidth - 16;
  23844. }
  23845. } else {
  23846. left = btnRect.left - tableRect.left - centerWidth;
  23847. top = btnRect.top - tableRect.top + btnElem.clientHeight;
  23848. maxHeight = Math.max(40, tableEl.clientHeight - top - (filterHeadElem ? filterHeadElem.clientHeight : 0) - (filterFootElem ? filterFootElem.clientHeight : 0) - 14);
  23849. if (left < 1) {
  23850. left = 1;
  23851. } else if (left > tableEl.clientWidth - filterWidth - 1) {
  23852. left = tableEl.clientWidth - filterWidth - 1;
  23853. }
  23854. if ($xeGGWrapper) {
  23855. const wrapperEl = $xeGGWrapper.$refs.refElem;
  23856. if (wrapperEl) {
  23857. const wrapperRect = wrapperEl.getBoundingClientRect();
  23858. top += tableRect.top - wrapperRect.top;
  23859. }
  23860. }
  23861. }
  23862. filterStore.style = {
  23863. top: toCssUnit(top),
  23864. left: toCssUnit(left)
  23865. };
  23866. // 筛选面板是自适应表格高度
  23867. if (compConf ? !compConf.tableFilterAutoHeight : false) {
  23868. maxHeight = 0;
  23869. }
  23870. // 判断面板不能大于表格高度
  23871. filterStore.maxHeight = maxHeight;
  23872. });
  23873. }
  23874. $xeTable.dispatchEvent('filter-visible', {
  23875. column,
  23876. field: column.field,
  23877. property: column.field,
  23878. filterList: $xeTable.getCheckedFilters(),
  23879. visible: filterStore.visible
  23880. }, evnt);
  23881. },
  23882. // (单选)筛选发生改变
  23883. handleFilterChangeRadioOption(evnt, checked, item) {
  23884. const $xeTable = this;
  23885. const reactData = $xeTable;
  23886. const {
  23887. filterStore
  23888. } = reactData;
  23889. const {
  23890. column
  23891. } = filterStore;
  23892. if (column) {
  23893. const filterOptions = column.filters || [];
  23894. filterOptions.forEach(option => {
  23895. option._checked = false;
  23896. });
  23897. item._checked = checked;
  23898. $xeTable.checkFilterOptions();
  23899. $xeTable.handleFilterConfirmFilter(evnt, column);
  23900. }
  23901. },
  23902. // (多选)筛选发生改变
  23903. handleFilterChangeMultipleOption(evnt, checked, item) {
  23904. const $xeTable = this;
  23905. item._checked = checked;
  23906. $xeTable.checkFilterOptions();
  23907. },
  23908. // 筛选发生改变
  23909. handleFilterChangeOption(evnt, checked, item) {
  23910. const $xeTable = this;
  23911. const reactData = $xeTable;
  23912. const internalData = $xeTable;
  23913. const {
  23914. filterStore
  23915. } = reactData;
  23916. const {
  23917. fullColumnIdData
  23918. } = internalData;
  23919. let column = filterStore.column;
  23920. if (!column) {
  23921. const colRest = fullColumnIdData[item._colId];
  23922. if (colRest) {
  23923. column = colRest.column;
  23924. filterStore.column = column;
  23925. }
  23926. }
  23927. if (column) {
  23928. if (column.filterMultiple) {
  23929. $xeTable.handleFilterChangeMultipleOption(evnt, checked, item);
  23930. } else {
  23931. $xeTable.handleFilterChangeRadioOption(evnt, checked, item);
  23932. }
  23933. }
  23934. },
  23935. // 确认筛选
  23936. handleFilterConfirmFilter(evnt, column) {
  23937. const $xeTable = this;
  23938. if (column) {
  23939. const filterOptions = column.filters || [];
  23940. filterOptions.forEach(option => {
  23941. option.checked = option._checked;
  23942. });
  23943. $xeTable.confirmFilterEvent(evnt, column);
  23944. }
  23945. },
  23946. _saveFilter(fieldOrColumn) {
  23947. const $xeTable = this;
  23948. if (fieldOrColumn) {
  23949. const column = handleFieldOrColumn($xeTable, fieldOrColumn);
  23950. $xeTable.handleFilterConfirmFilter(null, column);
  23951. }
  23952. return $xeTable.$nextTick();
  23953. },
  23954. _saveFilterByEvent(evnt, fieldOrColumn) {
  23955. const $xeTable = this;
  23956. if (fieldOrColumn) {
  23957. const column = handleFieldOrColumn($xeTable, fieldOrColumn);
  23958. $xeTable.handleFilterConfirmFilter(evnt, column);
  23959. }
  23960. return $xeTable.$nextTick();
  23961. },
  23962. _resetFilter(fieldOrColumn) {
  23963. const $xeTable = this;
  23964. if (fieldOrColumn) {
  23965. const column = handleFieldOrColumn($xeTable, fieldOrColumn);
  23966. $xeTable.handleFilterResetFilter(null, column);
  23967. }
  23968. return $xeTable.$nextTick();
  23969. },
  23970. _resetFilterByEvent(evnt, fieldOrColumn) {
  23971. const $xeTable = this;
  23972. if (fieldOrColumn) {
  23973. const column = handleFieldOrColumn($xeTable, fieldOrColumn);
  23974. $xeTable.handleFilterResetFilter(evnt, column);
  23975. }
  23976. return $xeTable.$nextTick();
  23977. },
  23978. _saveFilterPanel() {
  23979. const $xeTable = this;
  23980. const reactData = $xeTable;
  23981. const {
  23982. filterStore
  23983. } = reactData;
  23984. $xeTable.handleFilterConfirmFilter(null, filterStore.column || null);
  23985. return $xeTable.$nextTick();
  23986. },
  23987. _saveFilterPanelByEvent(evnt) {
  23988. const $xeTable = this;
  23989. const reactData = $xeTable;
  23990. const {
  23991. filterStore
  23992. } = reactData;
  23993. $xeTable.handleFilterConfirmFilter(evnt, filterStore.column || null);
  23994. return $xeTable.$nextTick();
  23995. },
  23996. _resetFilterPanel() {
  23997. const $xeTable = this;
  23998. const reactData = $xeTable;
  23999. const {
  24000. filterStore
  24001. } = reactData;
  24002. $xeTable.handleFilterResetFilter(null, filterStore.column || null);
  24003. return $xeTable.$nextTick();
  24004. },
  24005. _resetFilterPanelByEvent(evnt) {
  24006. const $xeTable = this;
  24007. const reactData = $xeTable;
  24008. const {
  24009. filterStore
  24010. } = reactData;
  24011. $xeTable.handleFilterResetFilter(evnt, filterStore.column || null);
  24012. return $xeTable.$nextTick();
  24013. },
  24014. _getCheckedFilters() {
  24015. const $xeTable = this;
  24016. const internalData = $xeTable;
  24017. const {
  24018. tableFullColumn
  24019. } = internalData;
  24020. const filterList = [];
  24021. tableFullColumn.forEach(column => {
  24022. const {
  24023. field,
  24024. filters
  24025. } = column;
  24026. const filterOptions = filters || [];
  24027. const valueList = [];
  24028. const dataList = [];
  24029. if (filterOptions) {
  24030. filterOptions.forEach(item => {
  24031. if (item.checked) {
  24032. valueList.push(item.value);
  24033. dataList.push(item.data);
  24034. }
  24035. });
  24036. if (valueList.length) {
  24037. filterList.push({
  24038. column,
  24039. field,
  24040. property: field,
  24041. values: valueList,
  24042. datas: dataList
  24043. });
  24044. }
  24045. }
  24046. });
  24047. return filterList;
  24048. },
  24049. handleColumnConfirmFilter(column, evnt) {
  24050. const $xeTable = this;
  24051. const props = $xeTable;
  24052. const reactData = $xeTable;
  24053. const {
  24054. mouseConfig
  24055. } = props;
  24056. const {
  24057. scrollXLoad: oldScrollXLoad,
  24058. scrollYLoad: oldScrollYLoad
  24059. } = reactData;
  24060. const filterOpts = $xeTable.computeFilterOpts;
  24061. const mouseOpts = $xeTable.computeMouseOpts;
  24062. const {
  24063. field,
  24064. filters
  24065. } = column;
  24066. const filterOptions = filters || [];
  24067. const values = [];
  24068. const datas = [];
  24069. filterOptions.forEach(item => {
  24070. if (item.checked) {
  24071. values.push(item.value);
  24072. datas.push(item.data);
  24073. }
  24074. });
  24075. const filterList = $xeTable.getCheckedFilters();
  24076. const params = {
  24077. $table: $xeTable,
  24078. $event: evnt,
  24079. column,
  24080. field,
  24081. property: field,
  24082. values,
  24083. datas,
  24084. filters: filterList,
  24085. filterList
  24086. };
  24087. // 如果是服务端筛选,则跳过本地筛选处理
  24088. if (!filterOpts.remote) {
  24089. $xeTable.handleTableData(true);
  24090. $xeTable.checkSelectionStatus();
  24091. }
  24092. if (mouseConfig && mouseOpts.area && $xeTable.handleFilterEvent) {
  24093. $xeTable.handleFilterEvent(evnt, params);
  24094. }
  24095. if (evnt) {
  24096. $xeTable.dispatchEvent('filter-change', params, evnt);
  24097. }
  24098. $xeTable.closeFilter();
  24099. return $xeTable.updateFooter().then(() => {
  24100. const {
  24101. scrollXLoad,
  24102. scrollYLoad
  24103. } = reactData;
  24104. if (oldScrollXLoad || scrollXLoad || oldScrollYLoad || scrollYLoad) {
  24105. if (oldScrollXLoad || scrollXLoad) {
  24106. $xeTable.updateScrollXSpace();
  24107. }
  24108. if (oldScrollYLoad || scrollYLoad) {
  24109. $xeTable.updateScrollYSpace();
  24110. }
  24111. return $xeTable.refreshScroll();
  24112. }
  24113. }).then(() => {
  24114. $xeTable.updateCellAreas();
  24115. return $xeTable.recalculate(true);
  24116. }).then(() => {
  24117. // 存在滚动行为未结束情况
  24118. setTimeout(() => $xeTable.recalculate(), 50);
  24119. });
  24120. },
  24121. /**
  24122. * 确认筛选
  24123. * 当筛选面板中的确定按钮被按下时触发
  24124. */
  24125. confirmFilterEvent(evnt, column) {
  24126. const $xeTable = this;
  24127. if (column) {
  24128. $xeTable.handleColumnConfirmFilter(column, evnt);
  24129. }
  24130. },
  24131. handleClearFilter(column) {
  24132. const $xeTable = this;
  24133. if (column) {
  24134. const {
  24135. filters,
  24136. filterRender
  24137. } = column;
  24138. if (filters) {
  24139. const compConf = isEnableConf(filterRender) ? mixin_renderer.get(filterRender.name) : null;
  24140. const filterResetMethod = column.filterResetMethod || (compConf ? compConf.tableFilterResetMethod || compConf.filterResetMethod : null);
  24141. filters.forEach(item => {
  24142. item._checked = false;
  24143. item.checked = false;
  24144. if (!filterResetMethod) {
  24145. item.data = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().clone(item.resetValue, true);
  24146. }
  24147. });
  24148. if (filterResetMethod) {
  24149. filterResetMethod({
  24150. options: filters,
  24151. column,
  24152. $table: $xeTable
  24153. });
  24154. }
  24155. }
  24156. }
  24157. },
  24158. /**
  24159. * 重置筛选
  24160. * 当筛选面板中的重置按钮被按下时触发
  24161. * @param {Event} evnt 事件
  24162. */
  24163. handleFilterResetFilter(evnt, column) {
  24164. const $xeTable = this;
  24165. if (column) {
  24166. $xeTable.handleClearFilter(column);
  24167. $xeTable.confirmFilterEvent(evnt, column);
  24168. if (evnt) {
  24169. $xeTable.dispatchEvent('clear-filter', {
  24170. filterList: []
  24171. }, evnt);
  24172. }
  24173. }
  24174. },
  24175. /**
  24176. * 清空指定列的筛选条件
  24177. * 如果为空则清空所有列的筛选条件
  24178. * @param {String} fieldOrColumn 列
  24179. */
  24180. _clearFilter(fieldOrColumn) {
  24181. const $xeTable = this;
  24182. const reactData = $xeTable;
  24183. const internalData = $xeTable;
  24184. const {
  24185. filterStore
  24186. } = reactData;
  24187. const {
  24188. tableFullColumn
  24189. } = internalData;
  24190. let column;
  24191. if (fieldOrColumn) {
  24192. column = handleFieldOrColumn($xeTable, fieldOrColumn);
  24193. if (column) {
  24194. $xeTable.handleClearFilter(column);
  24195. }
  24196. } else {
  24197. tableFullColumn.forEach($xeTable.handleClearFilter);
  24198. }
  24199. if (!fieldOrColumn || column !== filterStore.column) {
  24200. Object.assign(filterStore, {
  24201. isAllSelected: false,
  24202. isIndeterminate: false,
  24203. style: null,
  24204. options: [],
  24205. column: null,
  24206. multiple: false,
  24207. visible: false
  24208. });
  24209. }
  24210. return $xeTable.updateData();
  24211. },
  24212. _updateFilterOptionStatus(item, checked) {
  24213. const $xeTable = this;
  24214. item._checked = checked;
  24215. item.checked = checked;
  24216. return $xeTable.$nextTick();
  24217. }
  24218. }
  24219. });
  24220. ;// CONCATENATED MODULE: ./packages/table/module/menu/mixin.ts
  24221. const {
  24222. menus: mixin_menus,
  24223. globalEvents: mixin_globalEvents,
  24224. GLOBAL_EVENT_KEYS
  24225. } = core_.VxeUI;
  24226. /* harmony default export */ var menu_mixin = ({
  24227. methods: {
  24228. /**
  24229. * 关闭快捷菜单
  24230. */
  24231. _closeMenu() {
  24232. const $xeTable = this;
  24233. const reactData = $xeTable;
  24234. Object.assign(reactData.ctxMenuStore, {
  24235. visible: false,
  24236. selected: null,
  24237. selectChild: null,
  24238. showChild: false
  24239. });
  24240. return $xeTable.$nextTick();
  24241. },
  24242. // 处理菜单的移动
  24243. moveCtxMenu(evnt, ctxMenuStore, property, hasOper, operRest, menuList) {
  24244. const $xeTable = this;
  24245. let selectItem;
  24246. const selectIndex = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findIndexOf(menuList, item => ctxMenuStore[property] === item);
  24247. if (hasOper) {
  24248. if (operRest && hasChildrenList(ctxMenuStore.selected)) {
  24249. ctxMenuStore.showChild = true;
  24250. } else {
  24251. ctxMenuStore.showChild = false;
  24252. ctxMenuStore.selectChild = null;
  24253. }
  24254. } else if (mixin_globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ARROW_UP)) {
  24255. for (let len = selectIndex - 1; len >= 0; len--) {
  24256. if (menuList[len].visible !== false) {
  24257. selectItem = menuList[len];
  24258. break;
  24259. }
  24260. }
  24261. ctxMenuStore[property] = selectItem || menuList[menuList.length - 1];
  24262. } else if (mixin_globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ARROW_DOWN)) {
  24263. for (let index = selectIndex + 1; index < menuList.length; index++) {
  24264. if (menuList[index].visible !== false) {
  24265. selectItem = menuList[index];
  24266. break;
  24267. }
  24268. }
  24269. ctxMenuStore[property] = selectItem || menuList[0];
  24270. } else if (ctxMenuStore[property] && (mixin_globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ENTER) || mixin_globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.SPACEBAR))) {
  24271. $xeTable.ctxMenuLinkEvent(evnt, ctxMenuStore[property]);
  24272. }
  24273. },
  24274. /**
  24275. * 快捷菜单事件处理
  24276. */
  24277. handleGlobalContextmenuEvent(evnt) {
  24278. const $xeTable = this;
  24279. const $xeGrid = $xeTable.$xeGrid;
  24280. const $xeGantt = $xeTable.$xeGantt;
  24281. const props = $xeTable;
  24282. const reactData = $xeTable;
  24283. const internalData = $xeTable;
  24284. const {
  24285. xID
  24286. } = $xeTable;
  24287. const {
  24288. mouseConfig,
  24289. menuConfig
  24290. } = props;
  24291. const {
  24292. editStore,
  24293. ctxMenuStore
  24294. } = reactData;
  24295. const {
  24296. visibleColumn
  24297. } = internalData;
  24298. const tableFilter = $xeTable.$refs.refTableFilter;
  24299. const tableMenu = $xeTable.$refs.refTableMenu;
  24300. const mouseOpts = $xeTable.computeMouseOpts;
  24301. const menuOpts = $xeTable.computeMenuOpts;
  24302. const el = $xeTable.$refs.refElem;
  24303. const {
  24304. selected
  24305. } = editStore;
  24306. const layoutList = ['header', 'body', 'footer'];
  24307. if (isEnableConf(menuConfig)) {
  24308. if (ctxMenuStore.visible && tableMenu && getEventTargetNode(evnt, tableMenu.$el).flag) {
  24309. evnt.preventDefault();
  24310. return;
  24311. }
  24312. if (internalData._keyCtx) {
  24313. const type = 'body';
  24314. const params = {
  24315. source: 'table',
  24316. type,
  24317. $table: $xeTable,
  24318. $grid: $xeGrid,
  24319. $gantt: $xeGantt,
  24320. keyboard: true,
  24321. columns: visibleColumn.slice(0),
  24322. $event: evnt
  24323. };
  24324. // 如果开启单元格区域
  24325. if (mouseConfig && mouseOpts.area) {
  24326. const activeArea = $xeTable.getActiveCellArea();
  24327. if (activeArea && activeArea.row && activeArea.column) {
  24328. params.row = activeArea.row;
  24329. params.column = activeArea.column;
  24330. $xeTable.handleOpenMenuEvent(evnt, type, params);
  24331. return;
  24332. }
  24333. } else if (mouseConfig && mouseOpts.selected) {
  24334. // 如果启用键盘导航且已选中单元格
  24335. if (selected.row && selected.column) {
  24336. params.row = selected.row;
  24337. params.column = selected.column;
  24338. $xeTable.handleOpenMenuEvent(evnt, type, params);
  24339. return;
  24340. }
  24341. }
  24342. }
  24343. // 分别匹配表尾、内容、表尾的快捷菜单
  24344. for (let index = 0; index < layoutList.length; index++) {
  24345. const layout = layoutList[index];
  24346. const columnTargetNode = getEventTargetNode(evnt, el, `vxe-${layout}--column`, target => {
  24347. // target=td|th,直接向上找 table 去匹配即可
  24348. return target.parentNode.parentNode.parentNode.getAttribute('xid') === xID;
  24349. });
  24350. const params = {
  24351. source: 'table',
  24352. type: layout,
  24353. $table: $xeTable,
  24354. $grid: $xeGrid,
  24355. $gantt: $xeGantt,
  24356. columns: visibleColumn.slice(0),
  24357. $event: evnt
  24358. };
  24359. if (columnTargetNode.flag) {
  24360. const cell = columnTargetNode.targetElem;
  24361. const columnNodeRest = $xeTable.getColumnNode(cell);
  24362. const column = columnNodeRest ? columnNodeRest.item : null;
  24363. let typePrefix = `${layout}-`;
  24364. if (column) {
  24365. Object.assign(params, {
  24366. column,
  24367. columnIndex: $xeTable.getColumnIndex(column),
  24368. cell
  24369. });
  24370. }
  24371. if (layout === 'body') {
  24372. const rowNodeRest = $xeTable.getRowNode(cell.parentNode);
  24373. const row = rowNodeRest ? rowNodeRest.item : null;
  24374. typePrefix = '';
  24375. if (row) {
  24376. params.row = row;
  24377. params.rowIndex = $xeTable.getRowIndex(row);
  24378. }
  24379. }
  24380. const eventType = `${typePrefix}cell-menu`;
  24381. $xeTable.handleOpenMenuEvent(evnt, layout, params);
  24382. // 在 v4 中废弃事件 cell-context-menu、header-cell-context-menu、footer-cell-context-menu
  24383. if ($xeTable.$listeners[`${typePrefix}cell-context-menu`]) {
  24384. warnLog('vxe.error.delEvent', [`${typePrefix}cell-context-menu`, `${typePrefix}cell-menu`]);
  24385. $xeTable.dispatchEvent(`${typePrefix}cell-context-menu`, params, evnt);
  24386. } else {
  24387. $xeTable.dispatchEvent(eventType, params, evnt);
  24388. }
  24389. return;
  24390. } else if (getEventTargetNode(evnt, $xeTable.$el, `vxe-table--${layout}-wrapper`, target => target.getAttribute('xid') === xID).flag) {
  24391. if (menuOpts.trigger === 'cell') {
  24392. evnt.preventDefault();
  24393. } else {
  24394. $xeTable.handleOpenMenuEvent(evnt, layout, params);
  24395. }
  24396. return;
  24397. }
  24398. }
  24399. }
  24400. if (tableFilter && !getEventTargetNode(evnt, tableFilter.$el).flag) {
  24401. $xeTable.closeFilter();
  24402. }
  24403. $xeTable.closeMenu();
  24404. },
  24405. /**
  24406. * 显示快捷菜单
  24407. */
  24408. handleOpenMenuEvent(evnt, type, params) {
  24409. const $xeTable = this;
  24410. const reactData = $xeTable;
  24411. const internalData = $xeTable;
  24412. const {
  24413. ctxMenuStore
  24414. } = reactData;
  24415. const isContentMenu = $xeTable.computeIsContentMenu;
  24416. const menuOpts = $xeTable.computeMenuOpts;
  24417. const config = menuOpts[type];
  24418. const {
  24419. transfer,
  24420. visibleMethod
  24421. } = menuOpts;
  24422. if (config) {
  24423. const {
  24424. options,
  24425. disabled
  24426. } = config;
  24427. if (disabled) {
  24428. evnt.preventDefault();
  24429. } else if (isContentMenu && options && options.length) {
  24430. params.options = options;
  24431. $xeTable.preventEvent(evnt, 'event.showMenu', params, () => {
  24432. if (!visibleMethod || visibleMethod(params)) {
  24433. evnt.preventDefault();
  24434. $xeTable.updateZindex();
  24435. const el = $xeTable.$refs.refElem;
  24436. const tableRect = el.getBoundingClientRect();
  24437. const {
  24438. scrollTop,
  24439. scrollLeft,
  24440. visibleHeight,
  24441. visibleWidth
  24442. } = getDomNode();
  24443. let top = evnt.clientY - tableRect.y;
  24444. let left = evnt.clientX - tableRect.x;
  24445. if (transfer) {
  24446. top = evnt.clientY + scrollTop;
  24447. left = evnt.clientX + scrollLeft;
  24448. }
  24449. const handleVisible = () => {
  24450. internalData._currMenuParams = params;
  24451. Object.assign(ctxMenuStore, {
  24452. visible: true,
  24453. list: options,
  24454. selected: null,
  24455. selectChild: null,
  24456. showChild: false,
  24457. style: {
  24458. zIndex: internalData.tZindex,
  24459. top: `${top}px`,
  24460. left: `${left}px`
  24461. }
  24462. });
  24463. $xeTable.$nextTick(() => {
  24464. const tableMenu = $xeTable.$refs.refTableMenu;
  24465. const ctxElem = tableMenu.$el;
  24466. const clientHeight = ctxElem.clientHeight;
  24467. const clientWidth = ctxElem.clientWidth;
  24468. const {
  24469. boundingTop,
  24470. boundingLeft
  24471. } = getAbsolutePos(ctxElem);
  24472. const offsetTop = boundingTop + clientHeight - visibleHeight;
  24473. const offsetLeft = boundingLeft + clientWidth - visibleWidth;
  24474. if (offsetTop > -10) {
  24475. ctxMenuStore.style.top = `${Math.max(scrollTop + 2, top - clientHeight - 2)}px`;
  24476. }
  24477. if (offsetLeft > -10) {
  24478. ctxMenuStore.style.left = `${Math.max(scrollLeft + 2, left - clientWidth - 2)}px`;
  24479. }
  24480. });
  24481. };
  24482. const {
  24483. keyboard,
  24484. row,
  24485. column
  24486. } = params;
  24487. if (keyboard && row && column) {
  24488. $xeTable.scrollToRow(row, column).then(() => {
  24489. const cell = $xeTable.getCellElement(row, column);
  24490. if (cell) {
  24491. const {
  24492. boundingTop,
  24493. boundingLeft
  24494. } = getAbsolutePos(cell);
  24495. top = boundingTop + scrollTop + Math.floor(cell.offsetHeight / 2);
  24496. left = boundingLeft + scrollLeft + Math.floor(cell.offsetWidth / 2);
  24497. }
  24498. handleVisible();
  24499. });
  24500. } else {
  24501. handleVisible();
  24502. }
  24503. } else {
  24504. $xeTable.closeMenu();
  24505. }
  24506. });
  24507. }
  24508. }
  24509. $xeTable.closeFilter();
  24510. },
  24511. ctxMenuMouseoverEvent(evnt, item, child) {
  24512. const $xeTable = this;
  24513. const reactData = $xeTable;
  24514. const menuElem = evnt.currentTarget;
  24515. const {
  24516. ctxMenuStore
  24517. } = reactData;
  24518. evnt.preventDefault();
  24519. evnt.stopPropagation();
  24520. ctxMenuStore.selected = item;
  24521. ctxMenuStore.selectChild = child;
  24522. if (!child) {
  24523. ctxMenuStore.showChild = hasChildrenList(item);
  24524. if (ctxMenuStore.showChild) {
  24525. $xeTable.$nextTick(() => {
  24526. const childWrapperElem = menuElem.nextElementSibling;
  24527. if (childWrapperElem) {
  24528. const {
  24529. boundingTop,
  24530. boundingLeft,
  24531. visibleHeight,
  24532. visibleWidth
  24533. } = getAbsolutePos(menuElem);
  24534. const posTop = boundingTop + menuElem.offsetHeight;
  24535. const posLeft = boundingLeft + menuElem.offsetWidth;
  24536. let left = '';
  24537. let right = '';
  24538. // 是否超出右侧
  24539. if (posLeft + childWrapperElem.offsetWidth > visibleWidth - 10) {
  24540. left = 'auto';
  24541. right = `${menuElem.offsetWidth}px`;
  24542. }
  24543. // 是否超出底部
  24544. let top = '';
  24545. let bottom = '';
  24546. if (posTop + childWrapperElem.offsetHeight > visibleHeight - 10) {
  24547. top = 'auto';
  24548. bottom = '0';
  24549. }
  24550. childWrapperElem.style.left = left;
  24551. childWrapperElem.style.right = right;
  24552. childWrapperElem.style.top = top;
  24553. childWrapperElem.style.bottom = bottom;
  24554. }
  24555. });
  24556. }
  24557. }
  24558. },
  24559. ctxMenuMouseoutEvent(evnt, item) {
  24560. const $xeTable = this;
  24561. const reactData = $xeTable;
  24562. const {
  24563. ctxMenuStore
  24564. } = reactData;
  24565. if (!item.children) {
  24566. ctxMenuStore.selected = null;
  24567. }
  24568. ctxMenuStore.selectChild = null;
  24569. },
  24570. /**
  24571. * 快捷菜单点击事件
  24572. */
  24573. ctxMenuLinkEvent(evnt, menu) {
  24574. const $xeTable = this;
  24575. const $xeGrid = $xeTable.$xeGrid;
  24576. const $xeGantt = $xeTable.$xeGantt;
  24577. const internalData = $xeTable;
  24578. // 如果一级菜单有配置 code 则允许点击,否则不能点击
  24579. if (!menu.disabled && (menu.code || !menu.children || !menu.children.length)) {
  24580. const gMenuOpts = mixin_menus.get(menu.code);
  24581. const params = Object.assign({}, internalData._currMenuParams, {
  24582. menu,
  24583. $table: $xeTable,
  24584. $grid: $xeGrid,
  24585. $gantt: $xeGantt,
  24586. $event: evnt
  24587. });
  24588. if (gMenuOpts && gMenuOpts.menuMethod) {
  24589. gMenuOpts.menuMethod(params, evnt);
  24590. }
  24591. // 在 v4 中废弃事件 context-menu-click
  24592. if ($xeTable.$listeners['context-menu-click']) {
  24593. warnLog('vxe.error.delEvent', ['context-menu-click', 'menu-click']);
  24594. $xeTable.dispatchEvent('context-menu-click', params, evnt);
  24595. } else {
  24596. $xeTable.dispatchEvent('menu-click', params, evnt);
  24597. }
  24598. $xeTable.closeMenu();
  24599. }
  24600. }
  24601. }
  24602. });
  24603. ;// CONCATENATED MODULE: ./packages/table/module/edit/mixin.ts
  24604. const {
  24605. getConfig: mixin_getConfig,
  24606. renderer: edit_mixin_renderer,
  24607. getI18n: mixin_getI18n
  24608. } = core_.VxeUI;
  24609. const mixin_browseObj = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().browse();
  24610. function getEditColumnModel(row, column) {
  24611. const {
  24612. model,
  24613. editRender
  24614. } = column;
  24615. if (editRender) {
  24616. model.value = getCellValue(row, column);
  24617. model.update = false;
  24618. }
  24619. }
  24620. function setEditColumnModel(row, column) {
  24621. const {
  24622. model,
  24623. editRender
  24624. } = column;
  24625. if (editRender && model.update) {
  24626. setCellValue(row, column, model.value);
  24627. model.update = false;
  24628. model.value = null;
  24629. }
  24630. }
  24631. function removeCellSelectedClass($xeTable) {
  24632. const el = $xeTable.$refs.refElem;
  24633. if (el) {
  24634. const cell = el.querySelector('.col--selected');
  24635. if (cell) {
  24636. removeClass(cell, 'col--selected');
  24637. }
  24638. }
  24639. }
  24640. function syncActivedCell($xeTable) {
  24641. const reactData = $xeTable;
  24642. const {
  24643. editStore,
  24644. tableColumn
  24645. } = reactData;
  24646. const editOpts = $xeTable.computeEditOpts;
  24647. const {
  24648. actived
  24649. } = editStore;
  24650. const {
  24651. row,
  24652. column
  24653. } = actived;
  24654. if (row || column) {
  24655. if (editOpts.mode === 'row') {
  24656. tableColumn.forEach(column => setEditColumnModel(row, column));
  24657. } else {
  24658. setEditColumnModel(row, column);
  24659. }
  24660. }
  24661. }
  24662. function insertTreeRow($xeTable, newRecords, isAppend) {
  24663. const internalData = $xeTable;
  24664. const {
  24665. tableFullTreeData,
  24666. afterFullData,
  24667. fullDataRowIdData,
  24668. fullAllDataRowIdData
  24669. } = internalData;
  24670. const treeOpts = $xeTable.computeTreeOpts;
  24671. const {
  24672. rowField,
  24673. parentField,
  24674. mapChildrenField
  24675. } = treeOpts;
  24676. const childrenField = treeOpts.children || treeOpts.childrenField;
  24677. const funcName = isAppend ? 'push' : 'unshift';
  24678. newRecords.forEach(item => {
  24679. const parentRowId = item[parentField];
  24680. const rowid = getRowid($xeTable, item);
  24681. const matchObj = parentRowId ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findTree(tableFullTreeData, item => parentRowId === item[rowField], {
  24682. children: mapChildrenField
  24683. }) : null;
  24684. if (matchObj) {
  24685. const {
  24686. item: parentRow
  24687. } = matchObj;
  24688. const parentRest = fullAllDataRowIdData[getRowid($xeTable, parentRow)];
  24689. const parentLevel = parentRest ? parentRest.level : 0;
  24690. let parentChilds = parentRow[childrenField];
  24691. let mapChilds = parentRow[mapChildrenField];
  24692. if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(parentChilds)) {
  24693. parentChilds = parentRow[childrenField] = [];
  24694. }
  24695. if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(mapChilds)) {
  24696. mapChilds = parentRow[childrenField] = [];
  24697. }
  24698. parentChilds[funcName](item);
  24699. mapChilds[funcName](item);
  24700. const rest = {
  24701. row: item,
  24702. rowid,
  24703. seq: -1,
  24704. index: -1,
  24705. _index: -1,
  24706. $index: -1,
  24707. treeIndex: -1,
  24708. _tIndex: -1,
  24709. items: parentChilds,
  24710. parent: parentRow,
  24711. level: parentLevel + 1,
  24712. height: 0,
  24713. resizeHeight: 0,
  24714. oTop: 0,
  24715. expandHeight: 0
  24716. };
  24717. fullDataRowIdData[rowid] = rest;
  24718. fullAllDataRowIdData[rowid] = rest;
  24719. } else {
  24720. if (parentRowId) {
  24721. warnLog('vxe.error.unableInsert');
  24722. }
  24723. afterFullData[funcName](item);
  24724. tableFullTreeData[funcName](item);
  24725. const rest = {
  24726. row: item,
  24727. rowid,
  24728. seq: -1,
  24729. index: -1,
  24730. _index: -1,
  24731. $index: -1,
  24732. treeIndex: -1,
  24733. _tIndex: -1,
  24734. items: tableFullTreeData,
  24735. parent: null,
  24736. level: 0,
  24737. height: 0,
  24738. resizeHeight: 0,
  24739. oTop: 0,
  24740. expandHeight: 0
  24741. };
  24742. fullDataRowIdData[rowid] = rest;
  24743. fullAllDataRowIdData[rowid] = rest;
  24744. }
  24745. });
  24746. }
  24747. // function insertGroupRow ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, newRecords: any[], isAppend: boolean) {
  24748. // }
  24749. function handleInsertRowAt($xeTable, records, targetRow, isInsertNextRow) {
  24750. const props = $xeTable;
  24751. const reactData = $xeTable;
  24752. const internalData = $xeTable;
  24753. const {
  24754. treeConfig
  24755. } = props;
  24756. const {
  24757. isRowGroupStatus
  24758. } = reactData;
  24759. const {
  24760. tableFullTreeData,
  24761. afterFullData,
  24762. mergeBodyList,
  24763. tableFullData,
  24764. fullDataRowIdData,
  24765. fullAllDataRowIdData,
  24766. insertRowMaps,
  24767. removeRowMaps
  24768. } = internalData;
  24769. const treeOpts = $xeTable.computeTreeOpts;
  24770. const {
  24771. transform,
  24772. parentField,
  24773. rowField,
  24774. mapChildrenField
  24775. } = treeOpts;
  24776. const childrenField = treeOpts.children || treeOpts.childrenField;
  24777. if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(records)) {
  24778. records = [records];
  24779. }
  24780. const newRecords = $xeTable.defineField(records.map(record => Object.assign(treeConfig && transform ? {
  24781. [mapChildrenField]: [],
  24782. [childrenField]: []
  24783. } : {}, record)));
  24784. let treeRecords = [];
  24785. if (treeConfig && transform) {
  24786. treeRecords = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toArrayTree(newRecords, {
  24787. key: rowField,
  24788. parentKey: parentField,
  24789. children: childrenField
  24790. });
  24791. }
  24792. if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(targetRow)) {
  24793. // 如果为虚拟树
  24794. if (treeConfig && transform) {
  24795. insertTreeRow($xeTable, newRecords, false);
  24796. } else if (isRowGroupStatus) {
  24797. // 如果分组
  24798. if (treeConfig) {
  24799. throw new Error(mixin_getI18n('vxe.error.noTree', ['insert']));
  24800. }
  24801. warnLog(mixin_getI18n('vxe.error.noGroup', ['remove']));
  24802. // insertGroupRow($xeTable, newRecords, false)
  24803. } else {
  24804. newRecords.forEach(item => {
  24805. const rowid = getRowid($xeTable, item);
  24806. const rest = {
  24807. row: item,
  24808. rowid,
  24809. seq: -1,
  24810. index: -1,
  24811. _index: -1,
  24812. $index: -1,
  24813. treeIndex: -1,
  24814. _tIndex: -1,
  24815. items: afterFullData,
  24816. parent: null,
  24817. level: 0,
  24818. height: 0,
  24819. resizeHeight: 0,
  24820. oTop: 0,
  24821. expandHeight: 0
  24822. };
  24823. fullDataRowIdData[rowid] = rest;
  24824. fullAllDataRowIdData[rowid] = rest;
  24825. afterFullData.unshift(item);
  24826. tableFullData.unshift(item);
  24827. });
  24828. // 刷新单元格合并
  24829. mergeBodyList.forEach(mergeItem => {
  24830. const {
  24831. row: mergeRowIndex
  24832. } = mergeItem;
  24833. if (mergeRowIndex >= 0) {
  24834. mergeItem.row = mergeRowIndex + newRecords.length;
  24835. }
  24836. });
  24837. }
  24838. } else {
  24839. if (targetRow === -1) {
  24840. // 如果为虚拟树
  24841. if (treeConfig && transform) {
  24842. insertTreeRow($xeTable, newRecords, true);
  24843. } else if (isRowGroupStatus) {
  24844. // 如果分组
  24845. if (treeConfig) {
  24846. throw new Error(mixin_getI18n('vxe.error.noTree', ['insert']));
  24847. }
  24848. warnLog(mixin_getI18n('vxe.error.noGroup', ['remove']));
  24849. // insertGroupRow($xeTable, newRecords, true)
  24850. } else {
  24851. newRecords.forEach(item => {
  24852. const rowid = getRowid($xeTable, item);
  24853. const rest = {
  24854. row: item,
  24855. rowid,
  24856. seq: -1,
  24857. index: -1,
  24858. _index: -1,
  24859. $index: -1,
  24860. treeIndex: -1,
  24861. _tIndex: -1,
  24862. items: afterFullData,
  24863. parent: null,
  24864. level: 0,
  24865. height: 0,
  24866. resizeHeight: 0,
  24867. oTop: 0,
  24868. expandHeight: 0
  24869. };
  24870. fullDataRowIdData[rowid] = rest;
  24871. fullAllDataRowIdData[rowid] = rest;
  24872. afterFullData.push(item);
  24873. tableFullData.push(item);
  24874. });
  24875. }
  24876. } else {
  24877. // 如果为虚拟树
  24878. if (treeConfig && transform) {
  24879. const matchMapObj = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findTree(tableFullTreeData, item => targetRow[rowField] === item[rowField], {
  24880. children: mapChildrenField
  24881. });
  24882. if (matchMapObj) {
  24883. const {
  24884. parent: parentRow
  24885. } = matchMapObj;
  24886. const parentMapChilds = parentRow ? parentRow[mapChildrenField] : tableFullTreeData;
  24887. const parentRest = fullAllDataRowIdData[getRowid($xeTable, parentRow)];
  24888. const parentLevel = parentRest ? parentRest.level : 0;
  24889. treeRecords.forEach((row, i) => {
  24890. if (parentRow) {
  24891. if (row[parentField] !== parentRow[rowField]) {
  24892. row[parentField] = parentRow[rowField];
  24893. errLog('vxe.error.errProp', [`${parentField}=${row[parentField]}`, `${parentField}=${parentRow[rowField]}`]);
  24894. }
  24895. } else {
  24896. if (row[parentField] !== null) {
  24897. row[parentField] = null;
  24898. errLog('vxe.error.errProp', [`${parentField}=${row[parentField]}`, 'null']);
  24899. }
  24900. }
  24901. let targetIndex = matchMapObj.index + i;
  24902. if (isInsertNextRow) {
  24903. targetIndex = targetIndex + 1;
  24904. }
  24905. parentMapChilds.splice(targetIndex, 0, row);
  24906. });
  24907. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(treeRecords, item => {
  24908. const rowid = getRowid($xeTable, item);
  24909. const rest = {
  24910. row: item,
  24911. rowid,
  24912. seq: -1,
  24913. index: -1,
  24914. _index: -1,
  24915. $index: -1,
  24916. treeIndex: -1,
  24917. _tIndex: -1,
  24918. items: parentMapChilds,
  24919. parent: parentRow,
  24920. level: parentLevel + 1,
  24921. height: 0,
  24922. resizeHeight: 0,
  24923. oTop: 0,
  24924. expandHeight: 0
  24925. };
  24926. if (item[childrenField]) {
  24927. item[mapChildrenField] = item[childrenField];
  24928. }
  24929. fullDataRowIdData[rowid] = rest;
  24930. fullAllDataRowIdData[rowid] = rest;
  24931. }, {
  24932. children: childrenField
  24933. });
  24934. // 源
  24935. if (parentRow) {
  24936. const matchObj = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findTree(tableFullTreeData, item => targetRow[rowField] === item[rowField], {
  24937. children: childrenField
  24938. });
  24939. if (matchObj) {
  24940. const parentChilds = matchObj.items;
  24941. let targetIndex = matchObj.index;
  24942. if (isInsertNextRow) {
  24943. targetIndex = targetIndex + 1;
  24944. }
  24945. parentChilds.splice(targetIndex, 0, ...treeRecords);
  24946. }
  24947. }
  24948. } else {
  24949. warnLog('vxe.error.unableInsert');
  24950. insertTreeRow($xeTable, newRecords, true);
  24951. }
  24952. } else if (isRowGroupStatus) {
  24953. // 如果分组
  24954. if (treeConfig) {
  24955. throw new Error(mixin_getI18n('vxe.error.noTree', ['insert']));
  24956. }
  24957. warnLog(mixin_getI18n('vxe.error.noGroup', ['remove']));
  24958. } else {
  24959. if (treeConfig) {
  24960. throw new Error(mixin_getI18n('vxe.error.noTree', ['insert']));
  24961. }
  24962. let afIndex = -1;
  24963. // 如果是可视索引
  24964. if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(targetRow)) {
  24965. if (targetRow < afterFullData.length) {
  24966. afIndex = targetRow;
  24967. }
  24968. } else {
  24969. afIndex = $xeTable.findRowIndexOf(afterFullData, targetRow);
  24970. }
  24971. // 如果是插入指定行的下一行
  24972. if (isInsertNextRow) {
  24973. afIndex = Math.min(afterFullData.length, afIndex + 1);
  24974. }
  24975. if (afIndex === -1) {
  24976. throw new Error(mixin_getI18n('vxe.error.unableInsert'));
  24977. }
  24978. afterFullData.splice(afIndex, 0, ...newRecords);
  24979. const tfIndex = $xeTable.findRowIndexOf(tableFullData, targetRow);
  24980. if (tfIndex > -1) {
  24981. tableFullData.splice(tfIndex + (isInsertNextRow ? 1 : 0), 0, ...newRecords);
  24982. } else {
  24983. tableFullData.push(...newRecords);
  24984. }
  24985. // 刷新单元格合并
  24986. mergeBodyList.forEach(mergeItem => {
  24987. const {
  24988. row: mergeRowIndex,
  24989. rowspan: mergeRowspan
  24990. } = mergeItem;
  24991. if (mergeRowIndex >= afIndex) {
  24992. mergeItem.row = mergeRowIndex + newRecords.length;
  24993. } else if (isInsertNextRow ? mergeRowIndex + mergeRowspan >= afIndex : mergeRowIndex + mergeRowspan > afIndex) {
  24994. mergeItem.rowspan = mergeRowspan + newRecords.length;
  24995. }
  24996. });
  24997. }
  24998. }
  24999. }
  25000. const handleStatus = newRow => {
  25001. const rowid = getRowid($xeTable, newRow);
  25002. // 如果是被删除的数据,则还原状态
  25003. if (removeRowMaps[rowid]) {
  25004. delete removeRowMaps[rowid];
  25005. if (insertRowMaps[rowid]) {
  25006. delete insertRowMaps[rowid];
  25007. }
  25008. } else {
  25009. insertRowMaps[rowid] = newRow;
  25010. }
  25011. };
  25012. // 如果为虚拟树
  25013. if (treeConfig && transform) {
  25014. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(treeRecords, handleStatus, {
  25015. children: mapChildrenField
  25016. });
  25017. } else {
  25018. newRecords.forEach(handleStatus);
  25019. }
  25020. reactData.removeRowFlag++;
  25021. reactData.insertRowFlag++;
  25022. $xeTable.cacheRowMap(false);
  25023. $xeTable.updateScrollYStatus();
  25024. $xeTable.handleTableData(treeConfig && transform);
  25025. if (!(treeConfig && transform)) {
  25026. $xeTable.updateAfterDataIndex();
  25027. }
  25028. $xeTable.updateFooter();
  25029. $xeTable.handleUpdateBodyMerge();
  25030. $xeTable.checkSelectionStatus();
  25031. if (reactData.scrollYLoad) {
  25032. $xeTable.updateScrollYSpace();
  25033. }
  25034. return $xeTable.$nextTick().then(() => {
  25035. $xeTable.updateCellAreas();
  25036. return $xeTable.recalculate(true);
  25037. }).then(() => {
  25038. return {
  25039. row: newRecords.length ? newRecords[newRecords.length - 1] : null,
  25040. rows: newRecords
  25041. };
  25042. });
  25043. }
  25044. function handleInsertChildRowAt($xeTable, records, parentRow, targetRow, isInsertNextRow) {
  25045. const props = $xeTable;
  25046. const {
  25047. treeConfig
  25048. } = props;
  25049. const treeOpts = $xeTable.computeTreeOpts;
  25050. const {
  25051. transform,
  25052. rowField,
  25053. parentField
  25054. } = treeOpts;
  25055. if (treeConfig && transform) {
  25056. if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(records)) {
  25057. records = [records];
  25058. }
  25059. return handleInsertRowAt($xeTable, records.map(item => Object.assign({}, item, {
  25060. [parentField]: parentRow[rowField]
  25061. })), targetRow, isInsertNextRow);
  25062. } else {
  25063. errLog('vxe.error.errProp', ['tree-config.transform=false', 'tree-config.transform=true']);
  25064. }
  25065. return Promise.resolve({
  25066. row: null,
  25067. rows: []
  25068. });
  25069. }
  25070. function handleClearEdit($xeTable, evnt, targetRow) {
  25071. const reactData = $xeTable;
  25072. const {
  25073. editStore
  25074. } = reactData;
  25075. const {
  25076. actived,
  25077. focused
  25078. } = editStore;
  25079. const {
  25080. row,
  25081. column
  25082. } = actived;
  25083. const validOpts = $xeTable.computeValidOpts;
  25084. if (row || column) {
  25085. if (targetRow && getRowid($xeTable, targetRow) !== getRowid($xeTable, row)) {
  25086. return $xeTable.$nextTick();
  25087. }
  25088. syncActivedCell($xeTable);
  25089. actived.args = null;
  25090. actived.row = null;
  25091. actived.column = null;
  25092. $xeTable.updateFooter();
  25093. $xeTable.dispatchEvent('edit-closed', {
  25094. row,
  25095. rowIndex: $xeTable.getRowIndex(row),
  25096. $rowIndex: $xeTable.getVMRowIndex(row),
  25097. column,
  25098. columnIndex: $xeTable.getColumnIndex(column),
  25099. $columnIndex: $xeTable.getVMColumnIndex(column)
  25100. }, evnt || null);
  25101. }
  25102. focused.row = null;
  25103. focused.column = null;
  25104. if (validOpts.autoClear) {
  25105. if (validOpts.msgMode !== 'full' || mixin_getConfig().cellVaildMode === 'obsolete') {
  25106. if ($xeTable.clearValidate) {
  25107. return $xeTable.clearValidate();
  25108. }
  25109. }
  25110. }
  25111. return $xeTable.$nextTick().then(() => $xeTable.updateCellAreas());
  25112. }
  25113. function handleEditActive($xeTable, params, evnt, isFocus, isPos) {
  25114. const props = $xeTable;
  25115. const reactData = $xeTable;
  25116. const $xeGrid = $xeTable.$xeGrid;
  25117. const {
  25118. editConfig,
  25119. mouseConfig
  25120. } = props;
  25121. const {
  25122. editStore,
  25123. tableColumn
  25124. } = reactData;
  25125. const editOpts = $xeTable.computeEditOpts;
  25126. const {
  25127. mode
  25128. } = editOpts;
  25129. const {
  25130. actived,
  25131. focused
  25132. } = editStore;
  25133. const {
  25134. row,
  25135. column
  25136. } = params;
  25137. const {
  25138. editRender
  25139. } = column;
  25140. const cell = params.cell || $xeTable.getCellElement(row, column);
  25141. const beforeEditMethod = editOpts.beforeEditMethod || editOpts.activeMethod;
  25142. params.cell = cell;
  25143. if (cell && isEnableConf(editConfig) && isEnableConf(editRender)) {
  25144. // 激活编辑
  25145. if (!$xeTable.isPendingByRow(row) && !$xeTable.isAggregateRecord(row)) {
  25146. if (actived.row !== row || (mode === 'cell' ? actived.column !== column : false)) {
  25147. // 判断是否禁用编辑
  25148. let type = 'edit-disabled';
  25149. if (!beforeEditMethod || beforeEditMethod({
  25150. ...params,
  25151. $table: $xeTable,
  25152. $grid: $xeGrid
  25153. })) {
  25154. if (mouseConfig) {
  25155. $xeTable.clearSelected();
  25156. if ($xeTable.clearCellAreas) {
  25157. $xeTable.clearCellAreas();
  25158. $xeTable.clearCopyCellArea();
  25159. }
  25160. }
  25161. $xeTable.closeTooltip();
  25162. if (actived.column) {
  25163. handleClearEdit($xeTable, evnt);
  25164. }
  25165. type = 'edit-activated';
  25166. column.renderHeight = cell.offsetHeight;
  25167. actived.args = params;
  25168. actived.row = row;
  25169. actived.column = column;
  25170. if (mode === 'row') {
  25171. tableColumn.forEach(column => getEditColumnModel(row, column));
  25172. } else {
  25173. getEditColumnModel(row, column);
  25174. }
  25175. const afterEditMethod = editOpts.afterEditMethod;
  25176. $xeTable.$nextTick(() => {
  25177. if (isFocus) {
  25178. $xeTable.handleFocus(params, evnt);
  25179. }
  25180. if (afterEditMethod) {
  25181. afterEditMethod({
  25182. ...params,
  25183. $table: $xeTable,
  25184. $grid: $xeGrid
  25185. });
  25186. }
  25187. });
  25188. }
  25189. $xeTable.dispatchEvent(type, {
  25190. row,
  25191. rowIndex: $xeTable.getRowIndex(row),
  25192. $rowIndex: $xeTable.getVMRowIndex(row),
  25193. column,
  25194. columnIndex: $xeTable.getColumnIndex(column),
  25195. $columnIndex: $xeTable.getVMColumnIndex(column)
  25196. }, evnt);
  25197. // v4已废弃
  25198. if (type === 'edit-activated') {
  25199. $xeTable.dispatchEvent('edit-actived', {
  25200. row,
  25201. rowIndex: $xeTable.getRowIndex(row),
  25202. $rowIndex: $xeTable.getVMRowIndex(row),
  25203. column,
  25204. columnIndex: $xeTable.getColumnIndex(column),
  25205. $columnIndex: $xeTable.getVMColumnIndex(column)
  25206. }, evnt);
  25207. }
  25208. } else {
  25209. const {
  25210. column: oldColumn
  25211. } = actived;
  25212. if (mouseConfig) {
  25213. $xeTable.clearSelected();
  25214. if ($xeTable.clearCellAreas) {
  25215. $xeTable.clearCellAreas();
  25216. $xeTable.clearCopyCellArea();
  25217. }
  25218. }
  25219. if (oldColumn !== column) {
  25220. const {
  25221. model: oldModel
  25222. } = oldColumn;
  25223. if (oldModel.update) {
  25224. setCellValue(row, oldColumn, oldModel.value);
  25225. }
  25226. if ($xeTable.clearValidate) {
  25227. $xeTable.clearValidate(row, column);
  25228. }
  25229. }
  25230. column.renderHeight = cell.offsetHeight;
  25231. actived.args = params;
  25232. actived.column = column;
  25233. if (isPos) {
  25234. setTimeout(() => {
  25235. $xeTable.handleFocus(params, evnt);
  25236. });
  25237. }
  25238. }
  25239. focused.column = null;
  25240. focused.row = null;
  25241. $xeTable.focus();
  25242. }
  25243. }
  25244. return $xeTable.$nextTick();
  25245. }
  25246. function handleEditCell($xeTable, row, fieldOrColumn, isPos) {
  25247. const props = $xeTable;
  25248. const internalData = $xeTable;
  25249. const {
  25250. editConfig
  25251. } = props;
  25252. const column = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(fieldOrColumn) ? $xeTable.getColumnByField(fieldOrColumn) : fieldOrColumn;
  25253. if (row && column && isEnableConf(editConfig) && isEnableConf(column.editRender) && !$xeTable.isAggregateRecord(row)) {
  25254. return Promise.resolve(isPos ? $xeTable.scrollToRow(row, column) : null).then(() => {
  25255. const cell = $xeTable.getCellElement(row, column);
  25256. if (cell) {
  25257. handleEditActive($xeTable, {
  25258. row,
  25259. rowIndex: $xeTable.getRowIndex(row),
  25260. column,
  25261. columnIndex: $xeTable.getColumnIndex(column),
  25262. cell,
  25263. $table: $xeTable
  25264. }, null, isPos, isPos);
  25265. internalData._lastCallTime = Date.now();
  25266. }
  25267. return $xeTable.$nextTick();
  25268. });
  25269. }
  25270. return $xeTable.$nextTick();
  25271. }
  25272. /* harmony default export */ var edit_mixin = ({
  25273. methods: {
  25274. /**
  25275. * 往表格中插入临时数据
  25276. *
  25277. * @param {*} records
  25278. */
  25279. _insert(records) {
  25280. return handleInsertRowAt(this, records, null);
  25281. },
  25282. /**
  25283. * 往表格指定行中插入临时数据
  25284. * 如果 row 为空则从插入到顶部
  25285. * 如果 row 为 -1 则从插入到底部
  25286. * 如果 row 为有效行则插入到该行的位置
  25287. * @param {Object/Array} records 新的数据
  25288. * @param {Row} targetRow 指定行
  25289. * @returns
  25290. */
  25291. _insertAt(records, targetRow) {
  25292. return handleInsertRowAt(this, records, targetRow);
  25293. },
  25294. _insertNextAt(records, targetRow) {
  25295. return handleInsertRowAt(this, records, targetRow, true);
  25296. },
  25297. _insertChild(records, parentRow) {
  25298. return handleInsertChildRowAt(this, records, parentRow, null);
  25299. },
  25300. _insertChildAt(records, parentRow, targetRow) {
  25301. return handleInsertChildRowAt(this, records, parentRow, targetRow);
  25302. },
  25303. _insertChildNextAt(records, parentRow, targetRow) {
  25304. return handleInsertChildRowAt(this, records, parentRow, targetRow, true);
  25305. },
  25306. /**
  25307. * 删除指定行数据
  25308. * 如果传 row 则删除一行
  25309. * 如果传 rows 则删除多行
  25310. * 如果为空则删除所有
  25311. */
  25312. _remove(rows) {
  25313. const $xeTable = this;
  25314. const props = $xeTable;
  25315. const reactData = $xeTable;
  25316. const internalData = $xeTable;
  25317. const {
  25318. treeConfig
  25319. } = props;
  25320. const {
  25321. editStore,
  25322. isRowGroupStatus
  25323. } = reactData;
  25324. const {
  25325. tableFullTreeData,
  25326. selectCheckboxMaps,
  25327. afterFullData,
  25328. mergeBodyList,
  25329. tableFullData,
  25330. pendingRowMaps,
  25331. insertRowMaps,
  25332. removeRowMaps
  25333. } = internalData;
  25334. const checkboxOpts = $xeTable.computeCheckboxOpts;
  25335. const treeOpts = $xeTable.computeTreeOpts;
  25336. const {
  25337. transform,
  25338. mapChildrenField
  25339. } = treeOpts;
  25340. const childrenField = treeOpts.children || treeOpts.childrenField;
  25341. const {
  25342. actived
  25343. } = editStore;
  25344. const {
  25345. checkField
  25346. } = checkboxOpts;
  25347. let delList = [];
  25348. if (!rows) {
  25349. rows = tableFullData;
  25350. } else if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(rows)) {
  25351. rows = [rows];
  25352. }
  25353. // 如果是新增,则保存记录
  25354. rows.forEach(row => {
  25355. if (!$xeTable.isInsertByRow(row)) {
  25356. const rowid = getRowid($xeTable, row);
  25357. removeRowMaps[rowid] = row;
  25358. }
  25359. });
  25360. // 如果绑定了多选属性,则更新状态
  25361. if (!checkField) {
  25362. rows.forEach(row => {
  25363. const rowid = getRowid(this, row);
  25364. if (selectCheckboxMaps[rowid]) {
  25365. delete selectCheckboxMaps[rowid];
  25366. }
  25367. });
  25368. reactData.updateCheckboxFlag++;
  25369. }
  25370. // 从数据源中移除
  25371. if (tableFullData === rows) {
  25372. rows = delList = tableFullData.slice(0);
  25373. this.tableFullData = [];
  25374. this.afterFullData = [];
  25375. this.clearMergeCells();
  25376. } else {
  25377. // 如果为虚拟树
  25378. if (treeConfig && transform) {
  25379. rows.forEach(row => {
  25380. const rowid = getRowid(this, row);
  25381. const matchMapObj = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findTree(tableFullTreeData, item => rowid === getRowid(this, item), {
  25382. children: mapChildrenField
  25383. });
  25384. if (matchMapObj) {
  25385. const rItems = matchMapObj.items.splice(matchMapObj.index, 1);
  25386. delList.push(rItems[0]);
  25387. }
  25388. const matchObj = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findTree(tableFullTreeData, item => rowid === getRowid(this, item), {
  25389. children: childrenField
  25390. });
  25391. if (matchObj) {
  25392. matchObj.items.splice(matchObj.index, 1);
  25393. }
  25394. const afIndex = this.findRowIndexOf(afterFullData, row);
  25395. if (afIndex > -1) {
  25396. afterFullData.splice(afIndex, 1);
  25397. }
  25398. });
  25399. } else if (isRowGroupStatus) {
  25400. // 如果分组
  25401. warnLog(mixin_getI18n('vxe.error.noGroup', ['remove']));
  25402. } else {
  25403. rows.forEach(row => {
  25404. const tfIndex = this.findRowIndexOf(tableFullData, row);
  25405. if (tfIndex > -1) {
  25406. const rItems = tableFullData.splice(tfIndex, 1);
  25407. delList.push(rItems[0]);
  25408. }
  25409. const afIndex = this.findRowIndexOf(afterFullData, row);
  25410. if (afIndex > -1) {
  25411. // 刷新单元格合并
  25412. mergeBodyList.forEach(mergeItem => {
  25413. const {
  25414. row: mergeRowIndex,
  25415. rowspan: mergeRowspan
  25416. } = mergeItem;
  25417. if (mergeRowIndex > afIndex) {
  25418. mergeItem.row = mergeRowIndex - 1;
  25419. } else if (mergeRowIndex + mergeRowspan > afIndex) {
  25420. mergeItem.rowspan = mergeRowspan - 1;
  25421. }
  25422. });
  25423. afterFullData.splice(afIndex, 1);
  25424. }
  25425. });
  25426. }
  25427. }
  25428. // 如果当前行被激活编辑,则清除激活状态
  25429. if (actived.row && $xeTable.findRowIndexOf(rows, actived.row) > -1) {
  25430. $xeTable.clearEdit();
  25431. }
  25432. // 从新增中移除已删除的数据
  25433. rows.forEach(row => {
  25434. const rowid = getRowid($xeTable, row);
  25435. if (insertRowMaps[rowid]) {
  25436. delete insertRowMaps[rowid];
  25437. }
  25438. if (pendingRowMaps[rowid]) {
  25439. delete pendingRowMaps[rowid];
  25440. }
  25441. });
  25442. reactData.removeRowFlag++;
  25443. reactData.insertRowFlag++;
  25444. reactData.pendingRowFlag++;
  25445. $xeTable.cacheRowMap(false);
  25446. $xeTable.handleTableData(treeConfig && transform);
  25447. $xeTable.updateFooter();
  25448. $xeTable.handleUpdateBodyMerge();
  25449. if (!(treeConfig && transform)) {
  25450. $xeTable.updateAfterDataIndex();
  25451. }
  25452. $xeTable.checkSelectionStatus();
  25453. if (reactData.scrollYLoad) {
  25454. $xeTable.updateScrollYSpace();
  25455. }
  25456. return this.$nextTick().then(() => {
  25457. this.updateCellAreas();
  25458. return this.recalculate(true);
  25459. }).then(() => {
  25460. return {
  25461. row: delList.length ? delList[delList.length - 1] : null,
  25462. rows: delList
  25463. };
  25464. });
  25465. },
  25466. /**
  25467. * 删除复选框选中的数据
  25468. */
  25469. _removeCheckboxRow() {
  25470. return this.remove(this.getCheckboxRecords()).then(params => {
  25471. this.clearCheckboxRow();
  25472. return params;
  25473. });
  25474. },
  25475. /**
  25476. * 删除单选框选中的数据
  25477. */
  25478. _removeRadioRow() {
  25479. const radioRecord = this.getRadioRecord();
  25480. return this.remove(radioRecord || []).then(params => {
  25481. this.clearRadioRow();
  25482. return params;
  25483. });
  25484. },
  25485. /**
  25486. * 删除当前行选中的数据
  25487. */
  25488. _removeCurrentRow() {
  25489. const currentRecord = this.getCurrentRecord();
  25490. return this.remove(currentRecord || []).then(params => {
  25491. this.clearCurrentRow();
  25492. return params;
  25493. });
  25494. },
  25495. /**
  25496. * 获取表格数据集,包含新增、删除、修改
  25497. */
  25498. _getRecordset() {
  25499. const removeRecords = this.getRemoveRecords();
  25500. const pendingRecords = this.getPendingRecords();
  25501. const delRecords = removeRecords.concat(pendingRecords);
  25502. // 如果已经被删除,则无需放到更新数组
  25503. const updateRecords = this.getUpdateRecords().filter(row => {
  25504. return !delRecords.some(item => this.eqRow(item, row));
  25505. });
  25506. return {
  25507. insertRecords: this.getInsertRecords(),
  25508. removeRecords,
  25509. updateRecords,
  25510. pendingRecords
  25511. };
  25512. },
  25513. /**
  25514. * 获取新增的临时数据
  25515. */
  25516. _getInsertRecords() {
  25517. const $xeTable = this;
  25518. const internalData = $xeTable;
  25519. const {
  25520. fullAllDataRowIdData,
  25521. insertRowMaps
  25522. } = internalData;
  25523. const insertRecords = [];
  25524. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(insertRowMaps, (row, rowid) => {
  25525. if (fullAllDataRowIdData[rowid]) {
  25526. insertRecords.push(row);
  25527. }
  25528. });
  25529. return insertRecords;
  25530. },
  25531. /**
  25532. * 获取已删除的数据
  25533. */
  25534. _getRemoveRecords() {
  25535. const $xeTable = this;
  25536. const internalData = $xeTable;
  25537. const {
  25538. removeRowMaps
  25539. } = internalData;
  25540. const removeRecords = [];
  25541. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(removeRowMaps, row => {
  25542. removeRecords.push(row);
  25543. });
  25544. return removeRecords;
  25545. },
  25546. /**
  25547. * 获取更新数据
  25548. * 只精准匹配 row 的更改
  25549. * 如果是树表格,子节点更改状态不会影响父节点的更新状态
  25550. */
  25551. _getUpdateRecords() {
  25552. const $xeTable = this;
  25553. const props = $xeTable;
  25554. const internalData = $xeTable;
  25555. const {
  25556. keepSource,
  25557. treeConfig
  25558. } = props;
  25559. const {
  25560. tableFullData
  25561. } = internalData;
  25562. const treeOpts = $xeTable.computeTreeOpts;
  25563. if (keepSource) {
  25564. syncActivedCell($xeTable);
  25565. if (treeConfig) {
  25566. return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().filterTree(tableFullData, row => $xeTable.isUpdateByRow(row), treeOpts);
  25567. }
  25568. return tableFullData.filter(row => $xeTable.isUpdateByRow(row));
  25569. }
  25570. return [];
  25571. },
  25572. /**
  25573. * 处理激活编辑
  25574. */
  25575. handleEdit(params, evnt) {
  25576. const $xeTable = this;
  25577. return handleEditActive($xeTable, params, evnt, true, true);
  25578. },
  25579. /**
  25580. * @deprecated
  25581. */
  25582. handleActived(params, evnt) {
  25583. return this.handleEdit(params, evnt);
  25584. },
  25585. _getColumnModel(row, column) {
  25586. getEditColumnModel(row, column);
  25587. },
  25588. _setColumnModel(row, column) {
  25589. setEditColumnModel(row, column);
  25590. },
  25591. _syncActivedCell() {
  25592. const $xeTable = this;
  25593. syncActivedCell($xeTable);
  25594. },
  25595. _clearActived(row) {
  25596. warnLog('vxe.error.delFunc', ['clearActived', 'clearEdit']);
  25597. // 即将废弃
  25598. return this.clearEdit(row);
  25599. },
  25600. /**
  25601. * 清除激活的编辑
  25602. */
  25603. _clearEdit(row) {
  25604. const $xeTable = this;
  25605. return handleClearEdit($xeTable, null, row);
  25606. },
  25607. /**
  25608. * 取消编辑
  25609. */
  25610. handleClearEdit(evnt, targetRow) {
  25611. const $xeTable = this;
  25612. return handleClearEdit($xeTable, evnt, targetRow);
  25613. },
  25614. _getActiveRecord() {
  25615. const $xeTable = this;
  25616. const reactData = $xeTable;
  25617. const internalData = $xeTable;
  25618. warnLog('vxe.error.delFunc', ['getActiveRecord', 'getEditCell']);
  25619. const {
  25620. editStore
  25621. } = reactData;
  25622. const {
  25623. fullAllDataRowIdData
  25624. } = internalData;
  25625. const {
  25626. args,
  25627. row
  25628. } = editStore.actived;
  25629. if (args && row && fullAllDataRowIdData[getRowid($xeTable, row)]) {
  25630. return Object.assign({}, args, {
  25631. row
  25632. });
  25633. }
  25634. return null;
  25635. },
  25636. _getEditRecord() {
  25637. const $xeTable = this;
  25638. const reactData = $xeTable;
  25639. const internalData = $xeTable;
  25640. warnLog('vxe.error.delFunc', ['getEditRecord', 'getEditCell']);
  25641. const {
  25642. editStore
  25643. } = reactData;
  25644. const {
  25645. fullAllDataRowIdData
  25646. } = internalData;
  25647. const {
  25648. args,
  25649. row
  25650. } = editStore.actived;
  25651. if (args && row && fullAllDataRowIdData[getRowid($xeTable, row)]) {
  25652. return Object.assign({}, args, {
  25653. row
  25654. });
  25655. }
  25656. return null;
  25657. },
  25658. _getEditCell() {
  25659. const $xeTable = this;
  25660. const reactData = $xeTable;
  25661. const {
  25662. editStore
  25663. } = reactData;
  25664. const {
  25665. row,
  25666. column
  25667. } = editStore.actived;
  25668. if (column && row) {
  25669. return {
  25670. row,
  25671. rowIndex: $xeTable.getRowIndex(row),
  25672. column,
  25673. columnIndex: $xeTable.getColumnIndex(column)
  25674. };
  25675. }
  25676. return null;
  25677. },
  25678. _isActiveByRow(row) {
  25679. const $xeTable = this;
  25680. warnLog('vxe.error.delFunc', ['isActiveByRow', 'isEditByRow']);
  25681. // 即将废弃
  25682. return $xeTable.isEditByRow(row);
  25683. },
  25684. /**
  25685. * 判断行是否为激活编辑状态
  25686. * @param {Row} row 行对象
  25687. */
  25688. _isEditByRow(row) {
  25689. const $xeTable = this;
  25690. const reactData = $xeTable;
  25691. const {
  25692. editStore
  25693. } = reactData;
  25694. return editStore.actived.row === row;
  25695. },
  25696. /**
  25697. * 处理聚焦
  25698. */
  25699. handleFocus(params) {
  25700. const $xeTable = this;
  25701. const {
  25702. row,
  25703. column,
  25704. cell
  25705. } = params;
  25706. const {
  25707. editRender
  25708. } = column;
  25709. const editOpts = $xeTable.computeEditOpts;
  25710. if (isEnableConf(editRender)) {
  25711. const compRender = edit_mixin_renderer.get(editRender.name);
  25712. let autoFocus = editRender.autofocus || editRender.autoFocus;
  25713. let autoSelect = editRender.autoSelect || editRender.autoselect;
  25714. let inputElem;
  25715. // 是否启用聚焦
  25716. if (editOpts.autoFocus) {
  25717. if (!autoFocus && compRender) {
  25718. autoFocus = compRender.tableAutoFocus || compRender.tableAutofocus || compRender.autoFocus || compRender.autofocus;
  25719. }
  25720. if (!autoSelect && compRender) {
  25721. autoSelect = compRender.tableAutoSelect || compRender.autoSelect || compRender.autoselect;
  25722. }
  25723. // 如果指定了聚焦 class
  25724. if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(autoFocus)) {
  25725. inputElem = autoFocus.call($xeTable, params);
  25726. } else if (autoFocus) {
  25727. if (autoFocus === true) {
  25728. // 自动匹配模式,会自动匹配第一个可输入元素
  25729. inputElem = cell.querySelector('input,textarea');
  25730. } else {
  25731. inputElem = cell.querySelector(autoFocus);
  25732. }
  25733. if (inputElem) {
  25734. inputElem.focus();
  25735. }
  25736. }
  25737. }
  25738. if (inputElem) {
  25739. if (autoSelect) {
  25740. inputElem.select();
  25741. } else {
  25742. // 保持一致行为,光标移到末端
  25743. if (mixin_browseObj.msie) {
  25744. const textRange = inputElem.createTextRange();
  25745. textRange.collapse(false);
  25746. textRange.select();
  25747. }
  25748. }
  25749. } else {
  25750. // 是否自动定位
  25751. if (editOpts.autoPos) {
  25752. if (!column.fixed) {
  25753. // 显示到可视区中
  25754. $xeTable.scrollToRow(row, column);
  25755. }
  25756. }
  25757. }
  25758. }
  25759. },
  25760. _setActiveRow(row) {
  25761. const $xeTable = this;
  25762. warnLog('vxe.error.delFunc', ['setActiveRow', 'setEditRow']);
  25763. // 即将废弃
  25764. return $xeTable.setEditRow(row);
  25765. },
  25766. /**
  25767. * 激活行编辑
  25768. */
  25769. _setEditRow(row, fieldOrColumn) {
  25770. const $xeTable = this;
  25771. let column = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().find(this.visibleColumn, column => isEnableConf(column.editRender));
  25772. let isPos = false;
  25773. if (fieldOrColumn) {
  25774. isPos = true;
  25775. if (fieldOrColumn !== true) {
  25776. column = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(fieldOrColumn) ? $xeTable.getColumnByField(fieldOrColumn) : fieldOrColumn;
  25777. }
  25778. }
  25779. return handleEditCell($xeTable, row, column, isPos);
  25780. },
  25781. _setActiveCell(row, fieldOrColumn) {
  25782. warnLog('vxe.error.delFunc', ['setActiveCell', 'setEditCell']);
  25783. // 即将废弃
  25784. return this.setEditCell(row, fieldOrColumn);
  25785. },
  25786. /**
  25787. * 激活单元格编辑
  25788. */
  25789. _setEditCell(row, fieldOrColumn) {
  25790. const $xeTable = this;
  25791. return handleEditCell($xeTable, row, fieldOrColumn, true);
  25792. },
  25793. /**
  25794. * 只对 trigger=dblclick 有效,选中单元格
  25795. */
  25796. _setSelectCell(row, fieldOrColumn) {
  25797. const $xeTable = this;
  25798. const reactData = $xeTable;
  25799. const {
  25800. tableData
  25801. } = reactData;
  25802. const editOpts = $xeTable.computeEditOpts;
  25803. const column = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(fieldOrColumn) ? $xeTable.getColumnByField(fieldOrColumn) : fieldOrColumn;
  25804. if (row && column && editOpts.trigger !== 'manual') {
  25805. const rowIndex = $xeTable.findRowIndexOf(tableData, row);
  25806. if (rowIndex > -1) {
  25807. const cell = $xeTable.getCellElement(row, column);
  25808. const params = {
  25809. row,
  25810. rowIndex,
  25811. column,
  25812. columnIndex: $xeTable.getColumnIndex(column),
  25813. cell
  25814. };
  25815. $xeTable.handleSelected(params, {});
  25816. }
  25817. }
  25818. return $xeTable.$nextTick();
  25819. },
  25820. /**
  25821. * 处理选中源
  25822. */
  25823. handleSelected(params, evnt) {
  25824. const $xeTable = this;
  25825. const props = $xeTable;
  25826. const reactData = $xeTable;
  25827. const {
  25828. mouseConfig
  25829. } = props;
  25830. const {
  25831. editStore
  25832. } = reactData;
  25833. const mouseOpts = $xeTable.computeMouseOpts;
  25834. const editOpts = $xeTable.computeEditOpts;
  25835. const {
  25836. actived,
  25837. selected
  25838. } = editStore;
  25839. const {
  25840. row,
  25841. column
  25842. } = params;
  25843. const isMouseSelected = mouseConfig && mouseOpts.selected;
  25844. const selectMethod = () => {
  25845. if (isMouseSelected && (selected.row !== row || selected.column !== column)) {
  25846. if (actived.row !== row || (editOpts.mode === 'cell' ? actived.column !== column : false)) {
  25847. handleClearEdit($xeTable, evnt);
  25848. $xeTable.clearSelected();
  25849. if ($xeTable.clearCellAreas) {
  25850. $xeTable.clearCellAreas();
  25851. $xeTable.clearCopyCellArea();
  25852. }
  25853. selected.args = params;
  25854. selected.row = row;
  25855. selected.column = column;
  25856. if (isMouseSelected) {
  25857. this.addCellSelectedClass();
  25858. }
  25859. $xeTable.focus();
  25860. if (evnt) {
  25861. $xeTable.dispatchEvent('cell-selected', params, evnt);
  25862. }
  25863. }
  25864. }
  25865. return $xeTable.$nextTick();
  25866. };
  25867. return selectMethod();
  25868. },
  25869. /**
  25870. * 获取选中的单元格
  25871. */
  25872. _getSelectedCell() {
  25873. const $xeTable = this;
  25874. const reactData = $xeTable;
  25875. const {
  25876. editStore
  25877. } = reactData;
  25878. const {
  25879. row,
  25880. column
  25881. } = editStore.selected;
  25882. if (row && column) {
  25883. return {
  25884. row,
  25885. column
  25886. };
  25887. }
  25888. return null;
  25889. },
  25890. /**
  25891. * 清除所选中源状态
  25892. */
  25893. _clearSelected() {
  25894. const $xeTable = this;
  25895. const reactData = $xeTable;
  25896. const {
  25897. editStore
  25898. } = reactData;
  25899. const {
  25900. selected
  25901. } = editStore;
  25902. selected.row = null;
  25903. selected.column = null;
  25904. removeCellSelectedClass($xeTable);
  25905. return $xeTable.$nextTick();
  25906. },
  25907. reColTitleSdCls() {
  25908. const headerElem = this.elemStore['main-header-list'];
  25909. if (headerElem) {
  25910. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayEach(headerElem.querySelectorAll('.col--title-selected'), elem => removeClass(elem, 'col--title-selected'));
  25911. }
  25912. },
  25913. addCellSelectedClass() {
  25914. const $xeTable = this;
  25915. const reactData = $xeTable;
  25916. const {
  25917. editStore
  25918. } = reactData;
  25919. const {
  25920. selected
  25921. } = editStore;
  25922. const {
  25923. row,
  25924. column
  25925. } = selected;
  25926. removeCellSelectedClass($xeTable);
  25927. if (row && column) {
  25928. const cell = $xeTable.getCellElement(row, column);
  25929. if (cell) {
  25930. addClass(cell, 'col--selected');
  25931. }
  25932. }
  25933. }
  25934. }
  25935. });
  25936. ;// CONCATENATED MODULE: ./packages/table/module/export/util.ts
  25937. // 默认导出或打印的 HTML 样式
  25938. const defaultHtmlStyle = 'body{margin:0;padding: 0 1px;color:#333333;font-size:14px;font-family:"Microsoft YaHei",微软雅黑,"MicrosoftJhengHei",华文细黑,STHeiti,MingLiu}body *{-webkit-box-sizing:border-box;box-sizing:border-box}.vxe-table{border-collapse:collapse;text-align:left;border-spacing:0}.vxe-table:not(.is--print){table-layout:fixed}.vxe-table,.vxe-table th,.vxe-table td,.vxe-table td{border-color:#D0D0D0;border-style:solid;border-width:0}.vxe-table.is--print{width:100%}.border--default,.border--full,.border--outer{border-top-width:1px}.border--default,.border--full,.border--outer{border-left-width:1px}.border--outer,.border--default th,.border--default td,.border--full th,.border--full td,.border--outer th,.border--inner th,.border--inner td{border-bottom-width:1px}.border--default,.border--outer,.border--full th,.border--full td{border-right-width:1px}.border--default th,.border--full th,.border--outer th{background-color:#f8f8f9}.vxe-table td>div,.vxe-table th>div{padding:.5em .4em}.col--center{text-align:center}.col--right{text-align:right}.vxe-table:not(.is--print) .col--ellipsis>div{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;word-break:break-all}.vxe-table--tree-node{text-align:left}.vxe-table--tree-node-wrapper{position:relative}.vxe-table--tree-icon-wrapper{position:absolute;top:50%;width:1em;height:1em;text-align:center;-webkit-transform:translateY(-50%);transform:translateY(-50%);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:pointer}.vxe-table--tree-unfold-icon,.vxe-table--tree-fold-icon{position:absolute;width:0;height:0;border-style:solid;border-width:.5em;border-right-color:transparent;border-bottom-color:transparent}.vxe-table--tree-unfold-icon{left:.3em;top:0;border-left-color:#939599;border-top-color:transparent}.vxe-table--tree-fold-icon{left:0;top:.3em;border-left-color:transparent;border-top-color:#939599}.vxe-table--tree-cell{display:block;padding-left:1.5em}.vxe-table input[type="checkbox"]{margin:0}.vxe-table input[type="checkbox"],.vxe-table input[type="radio"],.vxe-table input[type="checkbox"]+span,.vxe-table input[type="radio"]+span{vertical-align:middle;padding-left:0.4em}';
  25939. function getExportBlobByContent(content, options) {
  25940. return new Blob([content], {
  25941. type: `text/${options.type};charset=utf-8;`
  25942. });
  25943. }
  25944. function createHtmlPage(opts, content) {
  25945. const {
  25946. style
  25947. } = opts;
  25948. return ['<!DOCTYPE html><html>', '<head>', '<meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no,minimal-ui">', `<title>${opts.sheetName}</title>`, '<style media="print">.vxe-page-break-before{page-break-before:always;}.vxe-page-break-after{page-break-after:always;}</style>', `<style>${defaultHtmlStyle}</style>`, style ? `<style>${style}</style>` : '', '</head>', `<body>${content}</body>`, '</html>'].join('');
  25949. }
  25950. ;// CONCATENATED MODULE: ./packages/table/module/export/mixin.ts
  25951. const {
  25952. getI18n: export_mixin_getI18n,
  25953. renderer: export_mixin_renderer
  25954. } = core_.VxeUI;
  25955. let htmlCellElem;
  25956. const csvBOM = '\ufeff';
  25957. const enterSymbol = '\r\n';
  25958. function hasTreeChildren($xeTable, row) {
  25959. const treeOpts = $xeTable.computeTreeOpts;
  25960. const childrenField = treeOpts.children || treeOpts.childrenField;
  25961. return row[childrenField] && row[childrenField].length;
  25962. }
  25963. function getSeq($xeTable, cellValue, row, $rowIndex, column, $columnIndex) {
  25964. const seqOpts = $xeTable.computeSeqOpts;
  25965. const seqMethod = seqOpts.seqMethod || column.seqMethod;
  25966. if (seqMethod) {
  25967. return seqMethod({
  25968. $table: $xeTable,
  25969. row,
  25970. rowIndex: $xeTable.getRowIndex(row),
  25971. $rowIndex,
  25972. column,
  25973. columnIndex: $xeTable.getColumnIndex(column),
  25974. $columnIndex
  25975. });
  25976. }
  25977. return cellValue;
  25978. }
  25979. function defaultFilterExportColumn(column) {
  25980. return !!column.field || ['seq', 'checkbox', 'radio'].indexOf(column.type || '') === -1;
  25981. }
  25982. function toTableBorder(border) {
  25983. if (border === true) {
  25984. return 'full';
  25985. }
  25986. if (border) {
  25987. return border;
  25988. }
  25989. return 'default';
  25990. }
  25991. function toBooleanValue(cellValue) {
  25992. return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isBoolean(cellValue) ? cellValue ? 'TRUE' : 'FALSE' : cellValue;
  25993. }
  25994. const toStringValue = cellValue => {
  25995. return eqEmptyValue(cellValue) ? '' : `${cellValue}`;
  25996. };
  25997. function getBodyLabelData($xeTable, opts, columns, datas) {
  25998. const props = $xeTable;
  25999. const {
  26000. isAllExpand,
  26001. mode
  26002. } = opts;
  26003. const {
  26004. treeConfig
  26005. } = props;
  26006. const radioOpts = $xeTable.computeRadioOpts;
  26007. const checkboxOpts = $xeTable.computeCheckboxOpts;
  26008. const treeOpts = $xeTable.computeTreeOpts;
  26009. const columnOpts = $xeTable.computeColumnOpts;
  26010. if (!htmlCellElem) {
  26011. htmlCellElem = document.createElement('div');
  26012. }
  26013. if (treeConfig) {
  26014. const childrenField = treeOpts.children || treeOpts.childrenField;
  26015. // 如果是树表格只允许导出数据源
  26016. const rest = [];
  26017. const expandMaps = {};
  26018. const useMaps = {};
  26019. const {
  26020. handleGetRowId
  26021. } = createHandleGetRowId($xeTable);
  26022. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(datas, (item, $rowIndex, items, path, parent, nodes) => {
  26023. const row = item._row || item;
  26024. const rowid = handleGetRowId(row);
  26025. if (useMaps[rowid]) {
  26026. return;
  26027. }
  26028. const parentRow = parent && parent._row ? parent._row : parent;
  26029. const pRowid = parentRow ? handleGetRowId(parentRow) : '';
  26030. if (isAllExpand || !parentRow || expandMaps[pRowid] && $xeTable.isTreeExpandByRow(parentRow)) {
  26031. const hasRowChild = hasTreeChildren($xeTable, row);
  26032. const item = {
  26033. _row: row,
  26034. _level: nodes.length - 1,
  26035. _hasChild: hasRowChild,
  26036. _expand: hasRowChild && $xeTable.isTreeExpandByRow(row)
  26037. };
  26038. columns.forEach((column, $columnIndex) => {
  26039. let cellValue = '';
  26040. const renderOpts = column.editRender || column.cellRender;
  26041. let bodyExportMethod = column.exportMethod || columnOpts.exportMethod;
  26042. if (!bodyExportMethod && renderOpts && renderOpts.name) {
  26043. const compConf = export_mixin_renderer.get(renderOpts.name);
  26044. if (compConf) {
  26045. bodyExportMethod = compConf.tableExportMethod || compConf.exportMethod;
  26046. }
  26047. }
  26048. if (!bodyExportMethod) {
  26049. bodyExportMethod = columnOpts.exportMethod;
  26050. }
  26051. if (bodyExportMethod) {
  26052. cellValue = bodyExportMethod({
  26053. $table: $xeTable,
  26054. row,
  26055. column,
  26056. options: opts
  26057. });
  26058. } else {
  26059. switch (column.type) {
  26060. case 'seq':
  26061. {
  26062. const seqVal = path.map((num, i) => i % 2 === 0 ? Number(num) + 1 : '.').join('');
  26063. cellValue = mode === 'all' ? seqVal : getSeq($xeTable, seqVal, row, $rowIndex, column, $columnIndex);
  26064. break;
  26065. }
  26066. case 'checkbox':
  26067. cellValue = toBooleanValue($xeTable.isCheckedByCheckboxRow(row));
  26068. item._checkboxLabel = checkboxOpts.labelField ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, checkboxOpts.labelField) : '';
  26069. item._checkboxDisabled = checkboxOpts.checkMethod && !checkboxOpts.checkMethod({
  26070. $table: $xeTable,
  26071. row
  26072. });
  26073. break;
  26074. case 'radio':
  26075. cellValue = toBooleanValue($xeTable.isCheckedByRadioRow(row));
  26076. item._radioLabel = radioOpts.labelField ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, radioOpts.labelField) : '';
  26077. item._radioDisabled = radioOpts.checkMethod && !radioOpts.checkMethod({
  26078. $table: $xeTable,
  26079. row
  26080. });
  26081. break;
  26082. default:
  26083. if (opts.original) {
  26084. cellValue = getCellValue(row, column);
  26085. } else {
  26086. cellValue = $xeTable.getCellLabel(row, column);
  26087. if (column.type === 'html') {
  26088. htmlCellElem.innerHTML = cellValue;
  26089. cellValue = htmlCellElem.innerText.trim();
  26090. } else {
  26091. const cell = $xeTable.getCellElement(row, column);
  26092. if (cell && !hasClass(cell, 'is--progress')) {
  26093. cellValue = cell.innerText.trim();
  26094. }
  26095. }
  26096. }
  26097. }
  26098. }
  26099. item[column.id] = toStringValue(cellValue);
  26100. });
  26101. useMaps[rowid] = true;
  26102. if (pRowid) {
  26103. expandMaps[pRowid] = true;
  26104. }
  26105. rest.push(Object.assign(item, row));
  26106. }
  26107. }, {
  26108. children: childrenField
  26109. });
  26110. return rest;
  26111. }
  26112. return datas.map((row, $rowIndex) => {
  26113. const item = {
  26114. _row: row
  26115. };
  26116. columns.forEach((column, $columnIndex) => {
  26117. let cellValue = '';
  26118. const renderOpts = column.editRender || column.cellRender;
  26119. let bodyExportMethod = column.exportMethod || columnOpts.exportMethod;
  26120. if (!bodyExportMethod && renderOpts && renderOpts.name) {
  26121. const compConf = export_mixin_renderer.get(renderOpts.name);
  26122. if (compConf) {
  26123. bodyExportMethod = compConf.tableExportMethod || compConf.exportMethod;
  26124. }
  26125. }
  26126. if (bodyExportMethod) {
  26127. cellValue = bodyExportMethod({
  26128. $table: $xeTable,
  26129. row,
  26130. column,
  26131. options: opts
  26132. });
  26133. } else {
  26134. switch (column.type) {
  26135. case 'seq':
  26136. {
  26137. const seqValue = $rowIndex + 1;
  26138. cellValue = mode === 'all' ? seqValue : getSeq($xeTable, seqValue, row, $rowIndex, column, $columnIndex);
  26139. break;
  26140. }
  26141. case 'checkbox':
  26142. cellValue = toBooleanValue($xeTable.isCheckedByCheckboxRow(row));
  26143. item._checkboxLabel = checkboxOpts.labelField ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, checkboxOpts.labelField) : '';
  26144. item._checkboxDisabled = checkboxOpts.checkMethod && !checkboxOpts.checkMethod({
  26145. $table: $xeTable,
  26146. row
  26147. });
  26148. break;
  26149. case 'radio':
  26150. cellValue = toBooleanValue($xeTable.isCheckedByRadioRow(row));
  26151. item._radioLabel = radioOpts.labelField ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, radioOpts.labelField) : '';
  26152. item._radioDisabled = radioOpts.checkMethod && !radioOpts.checkMethod({
  26153. $table: $xeTable,
  26154. row
  26155. });
  26156. break;
  26157. default:
  26158. if (opts.original) {
  26159. cellValue = getCellValue(row, column);
  26160. } else {
  26161. cellValue = $xeTable.getCellLabel(row, column);
  26162. if (column.type === 'html') {
  26163. htmlCellElem.innerHTML = cellValue;
  26164. cellValue = htmlCellElem.innerText.trim();
  26165. } else {
  26166. const cell = $xeTable.getCellElement(row, column);
  26167. if (cell && !hasClass(cell, 'is--progress')) {
  26168. cellValue = cell.innerText.trim();
  26169. }
  26170. }
  26171. }
  26172. }
  26173. }
  26174. item[column.id] = toStringValue(cellValue);
  26175. });
  26176. return item;
  26177. });
  26178. }
  26179. function getExportData($xeTable, opts) {
  26180. const $xeGrid = $xeTable.$xeGrid;
  26181. const $xeGantt = $xeTable.$xeGantt;
  26182. const {
  26183. columns,
  26184. dataFilterMethod
  26185. } = opts;
  26186. let datas = opts.data;
  26187. if (dataFilterMethod) {
  26188. datas = datas.filter((row, index) => dataFilterMethod({
  26189. $table: $xeTable,
  26190. $grid: $xeGrid,
  26191. $gantt: $xeGantt,
  26192. row,
  26193. $rowIndex: index
  26194. }));
  26195. }
  26196. return getBodyLabelData($xeTable, opts, columns, datas);
  26197. }
  26198. function getBooleanValue(cellValue) {
  26199. return cellValue === 'TRUE' || cellValue === 'true' || cellValue === true;
  26200. }
  26201. function getHeaderTitle($xeTable, opts, column) {
  26202. const columnOpts = $xeTable.computeColumnOpts;
  26203. const headExportMethod = column.headerExportMethod || columnOpts.headerExportMethod;
  26204. return headExportMethod ? headExportMethod({
  26205. column,
  26206. options: opts,
  26207. $table: $xeTable
  26208. }) : (opts.isTitle ? column.getTitle() : column.field) || '';
  26209. }
  26210. function getFooterCellValue($xeTable, opts, row, column) {
  26211. const columnOpts = $xeTable.computeColumnOpts;
  26212. const renderOpts = column.editRender || column.cellRender;
  26213. let footLabelMethod = column.footerExportMethod;
  26214. if (!footLabelMethod && renderOpts && renderOpts.name) {
  26215. const compConf = export_mixin_renderer.get(renderOpts.name);
  26216. if (compConf) {
  26217. footLabelMethod = compConf.tableFooterExportMethod || compConf.footerExportMethod || compConf.footerCellExportMethod;
  26218. }
  26219. }
  26220. if (!footLabelMethod) {
  26221. footLabelMethod = columnOpts.footerExportMethod;
  26222. }
  26223. const _columnIndex = $xeTable.getVTColumnIndex(column);
  26224. if (footLabelMethod) {
  26225. return footLabelMethod({
  26226. $table: $xeTable,
  26227. items: row,
  26228. itemIndex: _columnIndex,
  26229. row,
  26230. _columnIndex,
  26231. column,
  26232. options: opts
  26233. });
  26234. }
  26235. // 兼容老模式
  26236. if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(row)) {
  26237. return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toValueString(row[_columnIndex]);
  26238. }
  26239. return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, column.field);
  26240. }
  26241. function getFooterData($xeTable, opts, footerTableData) {
  26242. const $xeGrid = $xeTable.$xeGrid;
  26243. const $xeGantt = $xeTable.$xeGantt;
  26244. const {
  26245. footerFilterMethod
  26246. } = opts;
  26247. return footerFilterMethod ? footerTableData.filter((items, index) => footerFilterMethod({
  26248. $table: $xeTable,
  26249. $grid: $xeGrid,
  26250. $gantt: $xeGantt,
  26251. items,
  26252. $rowIndex: index
  26253. })) : footerTableData;
  26254. }
  26255. function getCsvCellTypeLabel(column, cellValue) {
  26256. if (cellValue) {
  26257. if (column.type === 'seq') {
  26258. return `\t${cellValue}`;
  26259. }
  26260. switch (column.cellType) {
  26261. case 'string':
  26262. if (!isNaN(cellValue)) {
  26263. return `\t${cellValue}`;
  26264. }
  26265. break;
  26266. case 'number':
  26267. break;
  26268. default:
  26269. if (cellValue.length >= 12 && !isNaN(cellValue)) {
  26270. return `\t${cellValue}`;
  26271. }
  26272. break;
  26273. }
  26274. }
  26275. return cellValue;
  26276. }
  26277. function toTxtCellLabel(val) {
  26278. if (/[",\s\n]/.test(val)) {
  26279. return `"${val.replace(/"/g, '""')}"`;
  26280. }
  26281. return val;
  26282. }
  26283. function toCsv($xeTable, opts, columns, datas) {
  26284. const reactData = $xeTable;
  26285. let content = csvBOM;
  26286. if (opts.isHeader) {
  26287. content += columns.map(column => toTxtCellLabel(getHeaderTitle($xeTable, opts, column))).join(',') + enterSymbol;
  26288. }
  26289. datas.forEach(row => {
  26290. content += columns.map(column => toTxtCellLabel(getCsvCellTypeLabel(column, row[column.id]))).join(',') + enterSymbol;
  26291. });
  26292. if (opts.isFooter) {
  26293. const {
  26294. footerTableData
  26295. } = reactData;
  26296. const footers = getFooterData($xeTable, opts, footerTableData);
  26297. footers.forEach(row => {
  26298. content += columns.map(column => toTxtCellLabel(getFooterCellValue($xeTable, opts, row, column))).join(',') + enterSymbol;
  26299. });
  26300. }
  26301. return content;
  26302. }
  26303. function toTxt($xeTable, opts, columns, datas) {
  26304. const reactData = $xeTable;
  26305. let content = '';
  26306. if (opts.isHeader) {
  26307. content += columns.map(column => toTxtCellLabel(getHeaderTitle($xeTable, opts, column))).join('\t') + enterSymbol;
  26308. }
  26309. datas.forEach(row => {
  26310. content += columns.map(column => toTxtCellLabel(row[column.id])).join('\t') + enterSymbol;
  26311. });
  26312. if (opts.isFooter) {
  26313. const {
  26314. footerTableData
  26315. } = reactData;
  26316. const footers = getFooterData($xeTable, opts, footerTableData);
  26317. footers.forEach(row => {
  26318. content += columns.map(column => toTxtCellLabel(getFooterCellValue($xeTable, opts, row, column))).join('\t') + enterSymbol;
  26319. });
  26320. }
  26321. return content;
  26322. }
  26323. function hasEllipsis($xeTable, column, property, allColumnOverflow) {
  26324. const reactData = $xeTable;
  26325. const columnOverflow = column[property];
  26326. const headOverflow = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isUndefined(columnOverflow) || external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNull(columnOverflow) ? allColumnOverflow : columnOverflow;
  26327. const showEllipsis = headOverflow === 'ellipsis';
  26328. const showTitle = headOverflow === 'title';
  26329. const showTooltip = headOverflow === true || headOverflow === 'tooltip';
  26330. let isEllipsis = showTitle || showTooltip || showEllipsis;
  26331. // 虚拟滚动不支持动态高度
  26332. const {
  26333. scrollXLoad,
  26334. scrollYLoad
  26335. } = reactData;
  26336. if ((scrollXLoad || scrollYLoad) && !isEllipsis) {
  26337. isEllipsis = true;
  26338. }
  26339. return isEllipsis;
  26340. }
  26341. function toHtml($xeTable, opts, columns, datas) {
  26342. const props = $xeTable;
  26343. const reactData = $xeTable;
  26344. const internalData = $xeTable;
  26345. const {
  26346. id,
  26347. border,
  26348. treeConfig,
  26349. headerAlign: allHeaderAlign,
  26350. align: allAlign,
  26351. footerAlign: allFooterAlign,
  26352. showOverflow: allColumnOverflow,
  26353. showHeaderOverflow: allColumnHeaderOverflow
  26354. } = props;
  26355. const {
  26356. isAllSelected,
  26357. isIndeterminate
  26358. } = reactData;
  26359. const {
  26360. mergeBodyCellMaps
  26361. } = internalData;
  26362. const treeOpts = $xeTable.computeTreeOpts;
  26363. const {
  26364. print: isPrint,
  26365. isHeader,
  26366. isFooter,
  26367. isColgroup,
  26368. isMerge,
  26369. colgroups,
  26370. original
  26371. } = opts;
  26372. const allCls = 'check-all';
  26373. const clss = ['vxe-table', `border--${toTableBorder(border)}`, isPrint ? 'is--print' : '', isHeader ? 'is--header' : ''].filter(cls => cls);
  26374. const tables = [`<table class="${clss.join(' ')}" border="0" cellspacing="0" cellpadding="0">`, `<colgroup>${columns.map(column => `<col style="width:${column.renderWidth}px">`).join('')}</colgroup>`];
  26375. if (isHeader) {
  26376. tables.push('<thead>');
  26377. if (isColgroup && !original) {
  26378. colgroups.forEach(cols => {
  26379. tables.push(`<tr>${cols.map(column => {
  26380. const headAlign = column.headerAlign || column.align || allHeaderAlign || allAlign;
  26381. const classNames = hasEllipsis($xeTable, column, 'showHeaderOverflow', allColumnHeaderOverflow) ? ['col--ellipsis'] : [];
  26382. const cellTitle = getHeaderTitle($xeTable, opts, column);
  26383. let childWidth = 0;
  26384. let countChild = 0;
  26385. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree([column], item => {
  26386. if (!item.childNodes || !column.childNodes.length) {
  26387. countChild++;
  26388. }
  26389. childWidth += item.renderWidth;
  26390. }, {
  26391. children: 'childNodes'
  26392. });
  26393. const cellWidth = childWidth - countChild;
  26394. if (headAlign) {
  26395. classNames.push(`col--${headAlign}`);
  26396. }
  26397. if (column.type === 'checkbox') {
  26398. return `<th class="${classNames.join(' ')}" colspan="${column._colSpan}" rowspan="${column._rowSpan}"><div ${isPrint ? '' : `style="width: ${cellWidth}px"`}><input type="checkbox" class="${allCls}" ${isAllSelected ? 'checked' : ''}><span>${cellTitle}</span></div></th>`;
  26399. }
  26400. return `<th class="${classNames.join(' ')}" colspan="${column._colSpan}" rowspan="${column._rowSpan}" title="${cellTitle}"><div ${isPrint ? '' : `style="width: ${cellWidth}px"`}><span>${formatText(cellTitle, true)}</span></div></th>`;
  26401. }).join('')}</tr>`);
  26402. });
  26403. } else {
  26404. tables.push(`<tr>${columns.map(column => {
  26405. const headAlign = column.headerAlign || column.align || allHeaderAlign || allAlign;
  26406. const classNames = hasEllipsis($xeTable, column, 'showHeaderOverflow', allColumnHeaderOverflow) ? ['col--ellipsis'] : [];
  26407. const cellTitle = getHeaderTitle($xeTable, opts, column);
  26408. if (headAlign) {
  26409. classNames.push(`col--${headAlign}`);
  26410. }
  26411. if (column.type === 'checkbox') {
  26412. return `<th class="${classNames.join(' ')}"><div ${isPrint ? '' : `style="width: ${column.renderWidth}px"`}><input type="checkbox" class="${allCls}" ${isAllSelected ? 'checked' : ''}><span>${cellTitle}</span></div></th>`;
  26413. }
  26414. return `<th class="${classNames.join(' ')}" title="${cellTitle}"><div ${isPrint ? '' : `style="width: ${column.renderWidth}px"`}><span>${formatText(cellTitle, true)}</span></div></th>`;
  26415. }).join('')}</tr>`);
  26416. }
  26417. tables.push('</thead>');
  26418. }
  26419. if (datas.length) {
  26420. tables.push('<tbody>');
  26421. if (treeConfig) {
  26422. datas.forEach(item => {
  26423. tables.push('<tr>' + columns.map(column => {
  26424. const cellAlign = column.align || allAlign;
  26425. const classNames = hasEllipsis($xeTable, column, 'showOverflow', allColumnOverflow) ? ['col--ellipsis'] : [];
  26426. const cellValue = item[column.id];
  26427. if (cellAlign) {
  26428. classNames.push(`col--${cellAlign}`);
  26429. }
  26430. if (column.treeNode) {
  26431. let treeIcon = '';
  26432. if (item._hasChild) {
  26433. treeIcon = `<i class="${item._expand ? 'vxe-table--tree-fold-icon' : 'vxe-table--tree-unfold-icon'}"></i>`;
  26434. }
  26435. classNames.push('vxe-table--tree-node');
  26436. if (column.type === 'radio') {
  26437. return `<td class="${classNames.join(' ')}" title="${cellValue}"><div ${isPrint ? '' : `style="width: ${column.renderWidth}px"`}><div class="vxe-table--tree-node-wrapper" style="padding-left: ${item._level * treeOpts.indent}px"><div class="vxe-table--tree-icon-wrapper">${treeIcon}</div><div class="vxe-table--tree-cell"><input type="radio" name="radio_${id}" ${item._radioDisabled ? 'disabled ' : ''}${getBooleanValue(cellValue) ? 'checked' : ''}><span>${item._radioLabel}</span></div></div></div></td>`;
  26438. } else if (column.type === 'checkbox') {
  26439. return `<td class="${classNames.join(' ')}" title="${cellValue}"><div ${isPrint ? '' : `style="width: ${column.renderWidth}px"`}><div class="vxe-table--tree-node-wrapper" style="padding-left: ${item._level * treeOpts.indent}px"><div class="vxe-table--tree-icon-wrapper">${treeIcon}</div><div class="vxe-table--tree-cell"><input type="checkbox" ${item._checkboxDisabled ? 'disabled ' : ''}${getBooleanValue(cellValue) ? 'checked' : ''}><span>${item._checkboxLabel}</span></div></div></div></td>`;
  26440. }
  26441. return `<td class="${classNames.join(' ')}" title="${cellValue}"><div ${isPrint ? '' : `style="width: ${column.renderWidth}px"`}><div class="vxe-table--tree-node-wrapper" style="padding-left: ${item._level * treeOpts.indent}px"><div class="vxe-table--tree-icon-wrapper">${treeIcon}</div><div class="vxe-table--tree-cell">${cellValue}</div></div></div></td>`;
  26442. }
  26443. if (column.type === 'radio') {
  26444. return `<td class="${classNames.join(' ')}"><div ${isPrint ? '' : `style="width: ${column.renderWidth}px"`}><input type="radio" name="radio_${id}" ${item._radioDisabled ? 'disabled ' : ''}${getBooleanValue(cellValue) ? 'checked' : ''}><span>${item._radioLabel}</span></div></td>`;
  26445. } else if (column.type === 'checkbox') {
  26446. return `<td class="${classNames.join(' ')}"><div ${isPrint ? '' : `style="width: ${column.renderWidth}px"`}><input type="checkbox" ${item._checkboxDisabled ? 'disabled ' : ''}${getBooleanValue(cellValue) ? 'checked' : ''}><span>${item._checkboxLabel}</span></div></td>`;
  26447. }
  26448. return `<td class="${classNames.join(' ')}" title="${cellValue}"><div ${isPrint ? '' : `style="width: ${column.renderWidth}px"`}>${formatText(cellValue, true)}</div></td>`;
  26449. }).join('') + '</tr>');
  26450. });
  26451. } else {
  26452. datas.forEach(item => {
  26453. tables.push('<tr>' + columns.map(column => {
  26454. const colid = column.id;
  26455. const cellAlign = column.align || allAlign;
  26456. const classNames = hasEllipsis($xeTable, column, 'showOverflow', allColumnOverflow) ? ['col--ellipsis'] : [];
  26457. const cellValue = item[colid];
  26458. let rowSpan = 1;
  26459. let colSpan = 1;
  26460. if (isMerge) {
  26461. const _rowIndex = $xeTable.getVTRowIndex(item._row);
  26462. const _columnIndex = $xeTable.getVTColumnIndex(column);
  26463. const spanRest = mergeBodyCellMaps[`${_rowIndex}:${_columnIndex}`];
  26464. if (spanRest) {
  26465. const {
  26466. rowspan,
  26467. colspan
  26468. } = spanRest;
  26469. if (!rowspan || !colspan) {
  26470. return '';
  26471. }
  26472. if (rowspan > 1) {
  26473. rowSpan = rowspan;
  26474. }
  26475. if (colspan > 1) {
  26476. colSpan = colspan;
  26477. }
  26478. }
  26479. }
  26480. if (cellAlign) {
  26481. classNames.push(`col--${cellAlign}`);
  26482. }
  26483. if (column.type === 'radio') {
  26484. return `<td class="${classNames.join(' ')}" rowspan="${rowSpan}" colspan="${colSpan}"><div ${isPrint ? '' : `style="width: ${column.renderWidth}px"`}><input type="radio" name="radio_${id}" ${item._radioDisabled ? 'disabled ' : ''}${getBooleanValue(cellValue) ? 'checked' : ''}><span>${item._radioLabel}</span></div></td>`;
  26485. } else if (column.type === 'checkbox') {
  26486. return `<td class="${classNames.join(' ')}" rowspan="${rowSpan}" colspan="${colSpan}"><div ${isPrint ? '' : `style="width: ${column.renderWidth}px"`}><input type="checkbox" ${item._checkboxDisabled ? 'disabled ' : ''}${getBooleanValue(cellValue) ? 'checked' : ''}><span>${item._checkboxLabel}</span></div></td>`;
  26487. }
  26488. return `<td class="${classNames.join(' ')}" rowspan="${rowSpan}" colspan="${colSpan}" title="${cellValue}"><div ${isPrint ? '' : `style="width: ${column.renderWidth}px"`}>${formatText(cellValue, true)}</div></td>`;
  26489. }).join('') + '</tr>');
  26490. });
  26491. }
  26492. tables.push('</tbody>');
  26493. }
  26494. if (isFooter) {
  26495. const {
  26496. footerTableData
  26497. } = reactData;
  26498. const footers = getFooterData($xeTable, opts, footerTableData);
  26499. if (footers.length) {
  26500. tables.push('<tfoot>');
  26501. footers.forEach(row => {
  26502. tables.push(`<tr>${columns.map(column => {
  26503. const footAlign = column.footerAlign || column.align || allFooterAlign || allAlign;
  26504. const classNames = hasEllipsis($xeTable, column, 'showOverflow', allColumnOverflow) ? ['col--ellipsis'] : [];
  26505. const cellValue = getFooterCellValue($xeTable, opts, row, column);
  26506. if (footAlign) {
  26507. classNames.push(`col--${footAlign}`);
  26508. }
  26509. return `<td class="${classNames.join(' ')}" title="${cellValue}"><div ${isPrint ? '' : `style="width: ${column.renderWidth}px"`}>${formatText(cellValue, true)}</div></td>`;
  26510. }).join('')}</tr>`);
  26511. });
  26512. tables.push('</tfoot>');
  26513. }
  26514. }
  26515. // 是否半选状态
  26516. const script = !isAllSelected && isIndeterminate ? `<script>(function(){var a=document.querySelector(".${allCls}");if(a){a.indeterminate=true}})()</script>` : '';
  26517. tables.push('</table>', script);
  26518. return isPrint ? tables.join('') : createHtmlPage(opts, tables.join(''));
  26519. }
  26520. function toXML($xeTable, opts, columns, datas) {
  26521. const reactData = $xeTable;
  26522. let xml = ['<?xml version="1.0"?>', '<?mso-application progid="Excel.Sheet"?>', '<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40">', '<DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">', '<Version>16.00</Version>', '</DocumentProperties>', '<ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">', '<WindowHeight>7920</WindowHeight>', '<WindowWidth>21570</WindowWidth>', '<WindowTopX>32767</WindowTopX>', '<WindowTopY>32767</WindowTopY>', '<ProtectStructure>False</ProtectStructure>', '<ProtectWindows>False</ProtectWindows>', '</ExcelWorkbook>', `<Worksheet ss:Name="${opts.sheetName}">`, '<Table>', columns.map(column => `<Column ss:Width="${column.renderWidth}"/>`).join('')].join('');
  26523. if (opts.isHeader) {
  26524. xml += `<Row>${columns.map(column => `<Cell><Data ss:Type="String">${getHeaderTitle($xeTable, opts, column)}</Data></Cell>`).join('')}</Row>`;
  26525. }
  26526. datas.forEach(row => {
  26527. xml += '<Row>' + columns.map(column => `<Cell><Data ss:Type="String">${row[column.id]}</Data></Cell>`).join('') + '</Row>';
  26528. });
  26529. if (opts.isFooter) {
  26530. const {
  26531. footerTableData
  26532. } = reactData;
  26533. const footers = getFooterData($xeTable, opts, footerTableData);
  26534. footers.forEach(row => {
  26535. xml += `<Row>${columns.map(column => `<Cell><Data ss:Type="String">${getFooterCellValue($xeTable, opts, row, column)}</Data></Cell>`).join('')}</Row>`;
  26536. });
  26537. }
  26538. return `${xml}</Table></Worksheet></Workbook>`;
  26539. }
  26540. function getContent($xeTable, opts, columns, datas) {
  26541. if (columns.length) {
  26542. switch (opts.type) {
  26543. case 'csv':
  26544. return toCsv($xeTable, opts, columns, datas);
  26545. case 'txt':
  26546. return toTxt($xeTable, opts, columns, datas);
  26547. case 'html':
  26548. return toHtml($xeTable, opts, columns, datas);
  26549. case 'xml':
  26550. return toXML($xeTable, opts, columns, datas);
  26551. }
  26552. }
  26553. return '';
  26554. }
  26555. function downloadFile($xeTable, opts, content) {
  26556. const {
  26557. filename,
  26558. type,
  26559. download
  26560. } = opts;
  26561. if (!download) {
  26562. const blob = getExportBlobByContent(content, opts);
  26563. return Promise.resolve({
  26564. type,
  26565. content,
  26566. blob
  26567. });
  26568. }
  26569. if (core_.VxeUI.saveFile) {
  26570. core_.VxeUI.saveFile({
  26571. filename,
  26572. type,
  26573. content
  26574. }).then(() => {
  26575. if (opts.message !== false) {
  26576. if (core_.VxeUI.modal) {
  26577. core_.VxeUI.modal.message({
  26578. content: export_mixin_getI18n('vxe.table.expSuccess'),
  26579. status: 'success'
  26580. });
  26581. }
  26582. }
  26583. });
  26584. }
  26585. }
  26586. function clearColumnConvert(columns) {
  26587. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(columns, column => {
  26588. delete column._level;
  26589. delete column._colSpan;
  26590. delete column._rowSpan;
  26591. delete column._children;
  26592. delete column.childNodes;
  26593. }, {
  26594. children: 'children'
  26595. });
  26596. }
  26597. function handleExport($xeTable, opts) {
  26598. const $xeGrid = $xeTable.$xeGrid;
  26599. const $xeGantt = $xeTable.$xeGantt;
  26600. const {
  26601. remote,
  26602. columns,
  26603. colgroups,
  26604. exportMethod,
  26605. afterExportMethod
  26606. } = opts;
  26607. return new Promise(resolve => {
  26608. if (remote) {
  26609. const params = {
  26610. options: opts,
  26611. $table: $xeTable,
  26612. $grid: $xeGrid,
  26613. $gantt: $xeGantt
  26614. };
  26615. resolve(exportMethod ? exportMethod(params) : params);
  26616. } else {
  26617. const datas = getExportData($xeTable, opts);
  26618. resolve($xeTable.preventEvent(null, 'event.export', {
  26619. options: opts,
  26620. columns,
  26621. colgroups,
  26622. datas
  26623. }, () => {
  26624. return downloadFile($xeTable, opts, getContent($xeTable, opts, columns, datas));
  26625. }));
  26626. }
  26627. }).then(params => {
  26628. clearColumnConvert(columns);
  26629. if (!opts.print) {
  26630. if (afterExportMethod) {
  26631. afterExportMethod({
  26632. status: true,
  26633. options: opts,
  26634. $table: $xeTable,
  26635. $grid: $xeGrid,
  26636. $gantt: $xeGantt
  26637. });
  26638. }
  26639. }
  26640. return Object.assign({
  26641. status: true
  26642. }, params);
  26643. }).catch(() => {
  26644. clearColumnConvert(columns);
  26645. if (!opts.print) {
  26646. if (afterExportMethod) {
  26647. afterExportMethod({
  26648. status: false,
  26649. options: opts,
  26650. $table: $xeTable,
  26651. $grid: $xeGrid,
  26652. $gantt: $xeGantt
  26653. });
  26654. }
  26655. }
  26656. const params = {
  26657. status: false
  26658. };
  26659. return Promise.reject(params);
  26660. });
  26661. }
  26662. function getElementsByTagName(elem, qualifiedName) {
  26663. return elem.getElementsByTagName(qualifiedName);
  26664. }
  26665. function getTxtCellKey(now) {
  26666. return `#${now}@${external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().uniqueId()}`;
  26667. }
  26668. function replaceTxtCell(cell, vMaps) {
  26669. return cell.replace(/#\d+@\d+/g, key => external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().hasOwnProp(vMaps, key) ? vMaps[key] : key);
  26670. }
  26671. function getTxtCellValue(val, vMaps) {
  26672. const rest = replaceTxtCell(val, vMaps);
  26673. return rest.replace(/^"+$/g, qVal => '"'.repeat(Math.ceil(qVal.length / 2)));
  26674. }
  26675. function toExportField(tableConf, field) {
  26676. const {
  26677. fieldMaps,
  26678. titleMaps
  26679. } = tableConf;
  26680. // title 转 field
  26681. if (!fieldMaps[field]) {
  26682. const teCol = titleMaps[field];
  26683. if (teCol && teCol.field) {
  26684. field = teCol.field;
  26685. }
  26686. }
  26687. return field;
  26688. }
  26689. function parseCsvAndTxt(tableConf, content, cellSeparator) {
  26690. const list = content.split(enterSymbol);
  26691. const rows = [];
  26692. let fields = [];
  26693. if (list.length) {
  26694. const vMaps = {};
  26695. const now = Date.now();
  26696. list.forEach(rVal => {
  26697. if (rVal) {
  26698. const item = {};
  26699. rVal = rVal.replace(/("")|(\n)/g, (text, dVal) => {
  26700. const key = getTxtCellKey(now);
  26701. vMaps[key] = dVal ? '"' : '\n';
  26702. return key;
  26703. }).replace(/"(.*?)"/g, (text, cVal) => {
  26704. const key = getTxtCellKey(now);
  26705. vMaps[key] = replaceTxtCell(cVal, vMaps);
  26706. return key;
  26707. });
  26708. const cells = rVal.split(cellSeparator);
  26709. if (!fields.length) {
  26710. fields = cells.map(val => toExportField(tableConf, getTxtCellValue(val.trim(), vMaps)));
  26711. } else {
  26712. cells.forEach((val, colIndex) => {
  26713. if (colIndex < fields.length) {
  26714. item[fields[colIndex]] = getTxtCellValue(val.trim(), vMaps);
  26715. }
  26716. });
  26717. rows.push(item);
  26718. }
  26719. }
  26720. });
  26721. }
  26722. return {
  26723. fields,
  26724. rows
  26725. };
  26726. }
  26727. function parseCsv(tableConf, content) {
  26728. return parseCsvAndTxt(tableConf, content, ',');
  26729. }
  26730. function parseTxt(tableConf, content) {
  26731. return parseCsvAndTxt(tableConf, content, '\t');
  26732. }
  26733. function parseHTML(tableConf, content) {
  26734. const domParser = new DOMParser();
  26735. const xmlDoc = domParser.parseFromString(content, 'text/html');
  26736. const bodyNodes = getElementsByTagName(xmlDoc, 'body');
  26737. const rows = [];
  26738. const fields = [];
  26739. if (bodyNodes.length) {
  26740. const tableNodes = getElementsByTagName(bodyNodes[0], 'table');
  26741. if (tableNodes.length) {
  26742. const theadNodes = getElementsByTagName(tableNodes[0], 'thead');
  26743. if (theadNodes.length) {
  26744. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayEach(getElementsByTagName(theadNodes[0], 'tr'), rowNode => {
  26745. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayEach(getElementsByTagName(rowNode, 'th'), cellNode => {
  26746. fields.push(toExportField(tableConf, cellNode.textContent || ''));
  26747. });
  26748. });
  26749. const tbodyNodes = getElementsByTagName(tableNodes[0], 'tbody');
  26750. if (tbodyNodes.length) {
  26751. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayEach(getElementsByTagName(tbodyNodes[0], 'tr'), rowNode => {
  26752. const item = {};
  26753. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayEach(getElementsByTagName(rowNode, 'td'), (cellNode, colIndex) => {
  26754. if (fields[colIndex]) {
  26755. item[fields[colIndex]] = cellNode.textContent || '';
  26756. }
  26757. });
  26758. rows.push(item);
  26759. });
  26760. }
  26761. }
  26762. }
  26763. }
  26764. return {
  26765. fields,
  26766. rows
  26767. };
  26768. }
  26769. function parseXML(tableConf, content) {
  26770. const domParser = new DOMParser();
  26771. const xmlDoc = domParser.parseFromString(content, 'application/xml');
  26772. const sheetNodes = getElementsByTagName(xmlDoc, 'Worksheet');
  26773. const rows = [];
  26774. const fields = [];
  26775. if (sheetNodes.length) {
  26776. const tableNodes = getElementsByTagName(sheetNodes[0], 'Table');
  26777. if (tableNodes.length) {
  26778. const rowNodes = getElementsByTagName(tableNodes[0], 'Row');
  26779. if (rowNodes.length) {
  26780. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayEach(getElementsByTagName(rowNodes[0], 'Cell'), cellNode => {
  26781. fields.push(toExportField(tableConf, cellNode.textContent || ''));
  26782. });
  26783. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayEach(rowNodes, (rowNode, index) => {
  26784. if (index) {
  26785. const item = {};
  26786. const cellNodes = getElementsByTagName(rowNode, 'Cell');
  26787. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayEach(cellNodes, (cellNode, colIndex) => {
  26788. if (fields[colIndex]) {
  26789. item[fields[colIndex]] = cellNode.textContent;
  26790. }
  26791. });
  26792. rows.push(item);
  26793. }
  26794. });
  26795. }
  26796. }
  26797. }
  26798. return {
  26799. fields,
  26800. rows
  26801. };
  26802. }
  26803. function handleImport($xeTable, content, opts) {
  26804. const internalData = $xeTable;
  26805. const {
  26806. tableFullColumn,
  26807. _importResolve,
  26808. _importReject
  26809. } = internalData;
  26810. let rest = {
  26811. fields: [],
  26812. rows: []
  26813. };
  26814. const tableFieldMaps = {};
  26815. const tableTitleMaps = {};
  26816. tableFullColumn.forEach(column => {
  26817. const field = column.field;
  26818. const title = column.getTitle();
  26819. if (field) {
  26820. tableFieldMaps[field] = column;
  26821. }
  26822. if (title) {
  26823. tableTitleMaps[column.getTitle()] = column;
  26824. }
  26825. });
  26826. const tableConf = {
  26827. fieldMaps: tableFieldMaps,
  26828. titleMaps: tableTitleMaps
  26829. };
  26830. switch (opts.type) {
  26831. case 'csv':
  26832. rest = parseCsv(tableConf, content);
  26833. break;
  26834. case 'txt':
  26835. rest = parseTxt(tableConf, content);
  26836. break;
  26837. case 'html':
  26838. rest = parseHTML(tableConf, content);
  26839. break;
  26840. case 'xml':
  26841. rest = parseXML(tableConf, content);
  26842. break;
  26843. }
  26844. const {
  26845. fields,
  26846. rows
  26847. } = rest;
  26848. const status = fields.some(field => tableFieldMaps[field] || tableTitleMaps[field]);
  26849. if (status) {
  26850. $xeTable.createData(rows).then(data => {
  26851. let loadRest;
  26852. if (opts.mode === 'insert' || opts.mode === 'insertBottom') {
  26853. loadRest = $xeTable.insertAt(data, -1);
  26854. }
  26855. if (opts.mode === 'insertTop') {
  26856. loadRest = $xeTable.insert(data);
  26857. } else {
  26858. loadRest = $xeTable.reloadData(data);
  26859. }
  26860. if (opts.message !== false) {
  26861. // 检测弹窗模块
  26862. if (!core_.VxeUI.modal) {
  26863. errLog('vxe.error.reqModule', ['Modal']);
  26864. }
  26865. core_.VxeUI.modal.message({
  26866. content: export_mixin_getI18n('vxe.table.impSuccess', [rows.length]),
  26867. status: 'success'
  26868. });
  26869. }
  26870. return loadRest.then(() => {
  26871. if (_importResolve) {
  26872. _importResolve({
  26873. status: true
  26874. });
  26875. }
  26876. });
  26877. });
  26878. } else if (opts.message !== false) {
  26879. // 检测弹窗模块
  26880. if (!core_.VxeUI.modal) {
  26881. errLog('vxe.error.reqModule', ['Modal']);
  26882. }
  26883. core_.VxeUI.modal.message({
  26884. content: export_mixin_getI18n('vxe.error.impFields'),
  26885. status: 'error'
  26886. });
  26887. if (_importReject) {
  26888. _importReject({
  26889. status: false
  26890. });
  26891. }
  26892. }
  26893. }
  26894. function handleFileImport($xeTable, file, opts) {
  26895. const internalData = $xeTable;
  26896. const importOpts = $xeTable.computeImportOpts;
  26897. const {
  26898. importMethod,
  26899. afterImportMethod
  26900. } = opts;
  26901. const {
  26902. type,
  26903. filename
  26904. } = parseFile(file);
  26905. // 检查类型,如果为自定义导出,则不需要校验类型
  26906. if (!importMethod && !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().includes(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().keys(importOpts._typeMaps), type)) {
  26907. if (opts.message !== false) {
  26908. // 检测弹窗模块
  26909. if (!core_.VxeUI.modal) {
  26910. errLog('vxe.error.reqModule', ['Modal']);
  26911. }
  26912. core_.VxeUI.modal.message({
  26913. content: export_mixin_getI18n('vxe.error.notType', [type]),
  26914. status: 'error'
  26915. });
  26916. }
  26917. const params = {
  26918. status: false
  26919. };
  26920. return Promise.reject(params);
  26921. }
  26922. const rest = new Promise((resolve, reject) => {
  26923. const _importResolve = params => {
  26924. resolve(params);
  26925. $xeTable._importResolve = null;
  26926. $xeTable._importReject = null;
  26927. };
  26928. const _importReject = params => {
  26929. reject(params);
  26930. $xeTable._importResolve = null;
  26931. $xeTable._importReject = null;
  26932. };
  26933. $xeTable._importResolve = _importResolve;
  26934. $xeTable._importReject = _importReject;
  26935. if (window.FileReader) {
  26936. const options = Object.assign({
  26937. mode: 'insertTop'
  26938. }, opts, {
  26939. type,
  26940. filename
  26941. });
  26942. if (options.remote) {
  26943. if (importMethod) {
  26944. Promise.resolve(importMethod({
  26945. file,
  26946. options,
  26947. $table: $xeTable
  26948. })).then(() => {
  26949. _importResolve({
  26950. status: true
  26951. });
  26952. }).catch(() => {
  26953. _importResolve({
  26954. status: true
  26955. });
  26956. });
  26957. } else {
  26958. _importResolve({
  26959. status: true
  26960. });
  26961. }
  26962. } else {
  26963. const {
  26964. tableFullColumn
  26965. } = internalData;
  26966. $xeTable.preventEvent(null, 'event.import', {
  26967. file,
  26968. options,
  26969. columns: tableFullColumn
  26970. }, () => {
  26971. const reader = new FileReader();
  26972. reader.onerror = () => {
  26973. errLog('vxe.error.notType', [type]);
  26974. _importReject({
  26975. status: false
  26976. });
  26977. };
  26978. reader.onload = e => {
  26979. handleImport($xeTable, e.target.result, options);
  26980. };
  26981. reader.readAsText(file, options.encoding || 'UTF-8');
  26982. });
  26983. }
  26984. } else {
  26985. // 不支持的浏览器
  26986. errLog('vxe.error.notExp');
  26987. _importResolve({
  26988. status: true
  26989. });
  26990. }
  26991. });
  26992. return rest.then(() => {
  26993. if (afterImportMethod) {
  26994. afterImportMethod({
  26995. status: true,
  26996. options: opts,
  26997. $table: $xeTable
  26998. });
  26999. }
  27000. }).catch(e => {
  27001. if (afterImportMethod) {
  27002. afterImportMethod({
  27003. status: false,
  27004. options: opts,
  27005. $table: $xeTable
  27006. });
  27007. }
  27008. return Promise.reject(e);
  27009. });
  27010. }
  27011. function handleCloseExport() {
  27012. if (core_.VxeUI.modal) {
  27013. return core_.VxeUI.modal.close('VXE_EXPORT_MODAL');
  27014. }
  27015. return Promise.resolve();
  27016. }
  27017. function handleFilterColumns(exportOpts, column, columns) {
  27018. return columns.some(item => {
  27019. if (isColumnInfo(item)) {
  27020. return column.id === item.id;
  27021. } else if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(item)) {
  27022. return column.field === item;
  27023. } else {
  27024. const colid = item.id || item.colId;
  27025. const type = item.type;
  27026. const field = item.field;
  27027. if (colid) {
  27028. return column.id === colid;
  27029. } else if (field && type) {
  27030. return column.field === field && column.type === type;
  27031. } else if (field) {
  27032. return column.field === field;
  27033. } else if (type) {
  27034. return column.type === type;
  27035. }
  27036. }
  27037. return false;
  27038. });
  27039. }
  27040. function handleFilterFields(exportOpts, column, includeFields, excludeFields) {
  27041. if (excludeFields) {
  27042. if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().includes(excludeFields, column.field)) {
  27043. return false;
  27044. }
  27045. }
  27046. if (includeFields) {
  27047. if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().includes(includeFields, column.field)) {
  27048. return true;
  27049. }
  27050. return false;
  27051. }
  27052. return exportOpts.original ? !!column.field : defaultFilterExportColumn(column);
  27053. }
  27054. function handleExportAndPrint($xeTable, options, isPrint) {
  27055. const props = $xeTable;
  27056. const reactData = $xeTable;
  27057. const internalData = $xeTable;
  27058. const $xeGrid = $xeTable.$xeGrid;
  27059. const $xeGantt = $xeTable.$xeGantt;
  27060. const $xeGGWrapper = $xeGrid || $xeGantt;
  27061. const {
  27062. treeConfig,
  27063. showHeader,
  27064. showFooter
  27065. } = props;
  27066. const {
  27067. initStore,
  27068. isGroup,
  27069. footerTableData,
  27070. exportStore,
  27071. exportParams
  27072. } = reactData;
  27073. const {
  27074. collectColumn,
  27075. mergeBodyList,
  27076. mergeFooterList
  27077. } = internalData;
  27078. const exportOpts = $xeTable.computeExportOpts;
  27079. const hasTree = treeConfig;
  27080. const customOpts = $xeTable.computeCustomOpts;
  27081. const selectRecords = $xeTable.getCheckboxRecords();
  27082. const proxyOpts = $xeGGWrapper ? $xeGGWrapper.computeProxyOpts : {};
  27083. const hasFooter = !!footerTableData.length;
  27084. const hasMerge = !!(mergeBodyList.length || mergeFooterList.length);
  27085. const defOpts = Object.assign({
  27086. message: true,
  27087. isHeader: showHeader,
  27088. isTitle: showHeader,
  27089. isFooter: showFooter,
  27090. isColgroup: isGroup,
  27091. isMerge: hasMerge,
  27092. useStyle: true,
  27093. current: 'current',
  27094. modes: (proxyOpts.ajax && proxyOpts.ajax.queryAll ? ['all'] : []).concat(['current', 'selected', 'empty'])
  27095. }, options);
  27096. const types = defOpts.types || external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().keys(exportOpts._typeMaps);
  27097. const modes = defOpts.modes || [];
  27098. const checkMethod = customOpts.checkMethod;
  27099. const exportColumns = collectColumn.slice(0);
  27100. const {
  27101. columns,
  27102. excludeFields,
  27103. includeFields
  27104. } = defOpts;
  27105. // 处理类型
  27106. const typeList = types.map(value => {
  27107. return {
  27108. value,
  27109. label: export_mixin_getI18n(`vxe.export.types.${value}`)
  27110. };
  27111. });
  27112. const modeList = modes.map(item => {
  27113. if (item && item.value) {
  27114. return {
  27115. value: item.value,
  27116. label: item.label || item.value
  27117. };
  27118. }
  27119. return {
  27120. value: item,
  27121. label: export_mixin_getI18n(`vxe.export.modes.${item}`)
  27122. };
  27123. });
  27124. // 默认选中
  27125. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(exportColumns, (column, index, items, path, parent) => {
  27126. const isColGroup = column.children && column.children.length > 0;
  27127. let isChecked = false;
  27128. if (columns && columns.length) {
  27129. isChecked = handleFilterColumns(defOpts, column, columns);
  27130. } else if (excludeFields || includeFields) {
  27131. isChecked = handleFilterFields(defOpts, column, includeFields, excludeFields);
  27132. } else {
  27133. isChecked = column.visible && (isColGroup || defaultFilterExportColumn(column));
  27134. }
  27135. column.checked = isChecked;
  27136. column.halfChecked = false;
  27137. column.disabled = parent && parent.disabled || (checkMethod ? !checkMethod({
  27138. $table: $xeTable,
  27139. column
  27140. }) : false);
  27141. });
  27142. // 更新条件
  27143. Object.assign(exportStore, {
  27144. columns: exportColumns,
  27145. typeList,
  27146. modeList,
  27147. hasFooter,
  27148. hasMerge,
  27149. hasTree,
  27150. isPrint,
  27151. hasColgroup: isGroup,
  27152. visible: true
  27153. });
  27154. // 默认参数
  27155. Object.assign(exportParams, {
  27156. mode: selectRecords.length ? 'selected' : 'current'
  27157. }, defOpts);
  27158. const {
  27159. filename,
  27160. sheetName,
  27161. mode,
  27162. type
  27163. } = exportParams;
  27164. if (filename) {
  27165. if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(filename)) {
  27166. exportParams.filename = filename({
  27167. options: defOpts,
  27168. $table: $xeTable,
  27169. $grid: $xeGrid,
  27170. $gantt: $xeGantt
  27171. });
  27172. } else {
  27173. exportParams.filename = `${filename}`;
  27174. }
  27175. }
  27176. if (sheetName) {
  27177. if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(sheetName)) {
  27178. exportParams.sheetName = sheetName({
  27179. options: defOpts,
  27180. $table: $xeTable,
  27181. $grid: $xeGrid,
  27182. $gantt: $xeGantt
  27183. });
  27184. } else {
  27185. exportParams.sheetName = `${sheetName}`;
  27186. }
  27187. }
  27188. if (!modeList.some(item => item.value === mode)) {
  27189. exportParams.mode = modeList[0].value;
  27190. }
  27191. if (!typeList.some(item => item.value === type)) {
  27192. exportParams.type = typeList[0].value;
  27193. }
  27194. initStore.export = true;
  27195. return $xeTable.$nextTick();
  27196. }
  27197. const getConvertColumns = columns => {
  27198. const result = [];
  27199. columns.forEach(column => {
  27200. if (column.childNodes && column.childNodes.length) {
  27201. result.push(column);
  27202. result.push(...getConvertColumns(column.childNodes));
  27203. } else {
  27204. result.push(column);
  27205. }
  27206. });
  27207. return result;
  27208. };
  27209. const convertToRows = originColumns => {
  27210. let maxLevel = 1;
  27211. const traverse = (column, parent) => {
  27212. if (parent) {
  27213. column._level = parent._level + 1;
  27214. if (maxLevel < column._level) {
  27215. maxLevel = column._level;
  27216. }
  27217. }
  27218. if (column.childNodes && column.childNodes.length) {
  27219. let colSpan = 0;
  27220. column.childNodes.forEach(subColumn => {
  27221. traverse(subColumn, column);
  27222. colSpan += subColumn._colSpan;
  27223. });
  27224. column._colSpan = colSpan;
  27225. } else {
  27226. column._colSpan = 1;
  27227. }
  27228. };
  27229. originColumns.forEach(column => {
  27230. column._level = 1;
  27231. traverse(column);
  27232. });
  27233. const rows = [];
  27234. for (let i = 0; i < maxLevel; i++) {
  27235. rows.push([]);
  27236. }
  27237. const allColumns = getConvertColumns(originColumns);
  27238. allColumns.forEach(column => {
  27239. if (column.childNodes && column.childNodes.length) {
  27240. column._rowSpan = 1;
  27241. } else {
  27242. column._rowSpan = maxLevel - column._level + 1;
  27243. }
  27244. rows[column._level - 1].push(column);
  27245. });
  27246. return rows;
  27247. };
  27248. /* harmony default export */ var export_mixin = ({
  27249. methods: {
  27250. /**
  27251. * 导出文件,支持 csv/html/xml/txt
  27252. * 如果是树表格,则默认是导出所有节点
  27253. * 如果是启用了虚拟滚动,则只能导出数据源,可以配合 dataFilterMethod 函数转换数据
  27254. * @param {Object} options 参数
  27255. */
  27256. _exportData(options) {
  27257. const $xeTable = this;
  27258. const props = $xeTable;
  27259. const reactData = $xeTable;
  27260. const internalData = $xeTable;
  27261. const $xeGrid = $xeTable.$xeGrid;
  27262. const $xeGantt = $xeTable.$xeGantt;
  27263. const $xeGGWrapper = $xeGrid || $xeGantt;
  27264. const {
  27265. treeConfig,
  27266. showHeader,
  27267. showFooter
  27268. } = props;
  27269. const {
  27270. isGroup
  27271. } = reactData;
  27272. const {
  27273. tableFullColumn,
  27274. afterFullData,
  27275. afterTreeFullData,
  27276. collectColumn,
  27277. mergeBodyList,
  27278. mergeFooterList
  27279. } = internalData;
  27280. const exportOpts = $xeTable.computeExportOpts;
  27281. const treeOpts = $xeTable.computeTreeOpts;
  27282. const proxyOpts = $xeGGWrapper ? $xeGGWrapper.computeProxyOpts : {};
  27283. const hasMerge = !!(mergeBodyList.length || mergeFooterList.length);
  27284. const opts = Object.assign({
  27285. message: true,
  27286. isHeader: showHeader,
  27287. isTitle: showHeader,
  27288. isFooter: showFooter,
  27289. isColgroup: isGroup,
  27290. isMerge: hasMerge,
  27291. useStyle: true,
  27292. current: 'current',
  27293. modes: (proxyOpts.ajax && proxyOpts.ajax.queryAll ? ['all'] : []).concat(['current', 'selected', 'empty']),
  27294. download: true,
  27295. type: 'csv'
  27296. // filename: '',
  27297. // sheetName: '',
  27298. // original: false,
  27299. // isAllExpand: false,
  27300. // data: null,
  27301. // remote: false,
  27302. // dataFilterMethod: null,
  27303. // footerFilterMethod: null,
  27304. // exportMethod: null,
  27305. // columnFilterMethod: null,
  27306. // beforeExportMethod: null,
  27307. // afterExportMethod: null
  27308. }, exportOpts, options);
  27309. let {
  27310. filename,
  27311. sheetName,
  27312. type,
  27313. mode,
  27314. columns,
  27315. original,
  27316. columnFilterMethod,
  27317. beforeExportMethod,
  27318. includeFields,
  27319. excludeFields
  27320. } = opts;
  27321. let groups = [];
  27322. const selectRecords = $xeTable.getCheckboxRecords();
  27323. if (!mode) {
  27324. mode = selectRecords.length ? 'selected' : 'current';
  27325. }
  27326. let isCustomCol = false;
  27327. let customCols = [];
  27328. if (columns && columns.length) {
  27329. isCustomCol = true;
  27330. customCols = columns;
  27331. } else {
  27332. customCols = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().searchTree(collectColumn, column => {
  27333. const isColGroup = column.children && column.children.length > 0;
  27334. let isChecked = false;
  27335. if (columns && columns.length) {
  27336. isChecked = handleFilterColumns(opts, column, columns);
  27337. } else if (excludeFields || includeFields) {
  27338. isChecked = handleFilterFields(opts, column, includeFields, excludeFields);
  27339. } else {
  27340. isChecked = column.visible && (isColGroup || defaultFilterExportColumn(column));
  27341. }
  27342. return isChecked;
  27343. }, {
  27344. children: 'children',
  27345. mapChildren: 'childNodes',
  27346. original: true
  27347. });
  27348. }
  27349. const handleOptions = Object.assign({}, opts, {
  27350. filename: '',
  27351. sheetName: ''
  27352. });
  27353. // 如果设置源数据,则默认导出设置了字段的列
  27354. if (!isCustomCol && !columnFilterMethod) {
  27355. columnFilterMethod = ({
  27356. column
  27357. }) => {
  27358. if (excludeFields) {
  27359. if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().includes(excludeFields, column.field)) {
  27360. return false;
  27361. }
  27362. }
  27363. if (includeFields) {
  27364. if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().includes(includeFields, column.field)) {
  27365. return true;
  27366. }
  27367. return false;
  27368. }
  27369. return original ? !!column.field : defaultFilterExportColumn(column);
  27370. };
  27371. handleOptions.columnFilterMethod = columnFilterMethod;
  27372. }
  27373. if (customCols) {
  27374. handleOptions._isCustomColumn = true;
  27375. groups = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().searchTree(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().mapTree(customCols, item => {
  27376. let targetColumn;
  27377. if (item) {
  27378. if (isColumnInfo(item)) {
  27379. targetColumn = item;
  27380. } else if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(item)) {
  27381. targetColumn = $xeTable.getColumnByField(item);
  27382. } else {
  27383. const colid = item.id || item.colId;
  27384. const type = item.type;
  27385. const field = item.field;
  27386. if (colid) {
  27387. targetColumn = $xeTable.getColumnById(colid);
  27388. } else if (field && type) {
  27389. targetColumn = tableFullColumn.find(column => column.field === field && column.type === type);
  27390. } else if (field) {
  27391. targetColumn = $xeTable.getColumnByField(field);
  27392. } else if (type) {
  27393. targetColumn = tableFullColumn.find(column => column.type === type);
  27394. }
  27395. }
  27396. return targetColumn || {};
  27397. }
  27398. }, {
  27399. children: 'childNodes',
  27400. mapChildren: '_children'
  27401. }), (column, index) => isColumnInfo(column) && (!columnFilterMethod || columnFilterMethod({
  27402. $table: $xeTable,
  27403. $grid: $xeGrid,
  27404. $gantt: $xeGantt,
  27405. column: column,
  27406. $columnIndex: index
  27407. })), {
  27408. children: '_children',
  27409. mapChildren: 'childNodes',
  27410. original: true
  27411. });
  27412. } else {
  27413. groups = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().searchTree(isGroup ? collectColumn : tableFullColumn, (column, index) => column.visible && (!columnFilterMethod || columnFilterMethod({
  27414. $table: $xeTable,
  27415. $grid: $xeGrid,
  27416. $gantt: $xeGantt,
  27417. column,
  27418. $columnIndex: index
  27419. })), {
  27420. children: 'children',
  27421. mapChildren: 'childNodes',
  27422. original: true
  27423. });
  27424. }
  27425. // 获取所有列
  27426. const cols = [];
  27427. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(groups, column => {
  27428. const isColGroup = column.children && column.children.length;
  27429. if (!isColGroup) {
  27430. cols.push(column);
  27431. }
  27432. }, {
  27433. children: 'childNodes'
  27434. });
  27435. // 构建分组层级
  27436. handleOptions.columns = cols;
  27437. handleOptions.colgroups = convertToRows(groups);
  27438. if (filename) {
  27439. if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(filename)) {
  27440. handleOptions.filename = filename({
  27441. options: opts,
  27442. $table: $xeTable,
  27443. $grid: $xeGrid,
  27444. $gantt: $xeGantt
  27445. });
  27446. } else {
  27447. handleOptions.filename = `${filename}`;
  27448. }
  27449. }
  27450. if (!handleOptions.filename) {
  27451. handleOptions.filename = export_mixin_getI18n(handleOptions.original ? 'vxe.table.expOriginFilename' : 'vxe.table.expFilename', [external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toDateString(Date.now(), 'yyyyMMddHHmmss')]);
  27452. }
  27453. if (sheetName) {
  27454. if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(sheetName)) {
  27455. handleOptions.sheetName = sheetName({
  27456. options: opts,
  27457. $table: $xeTable,
  27458. $grid: $xeGrid,
  27459. $gantt: $xeGantt
  27460. });
  27461. } else {
  27462. handleOptions.sheetName = `${sheetName}`;
  27463. }
  27464. }
  27465. if (!handleOptions.sheetName) {
  27466. handleOptions.sheetName = document.title || '';
  27467. }
  27468. // 检查类型,如果为自定义导出,则不需要校验类型
  27469. if (!handleOptions.exportMethod && !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().includes(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().keys(exportOpts._typeMaps), type)) {
  27470. errLog('vxe.error.notType', [type]);
  27471. if (['xlsx', 'pdf'].includes(type)) {
  27472. warnLog('vxe.error.reqPlugin', [4, 'plugin-export-xlsx']);
  27473. }
  27474. const params = {
  27475. status: false
  27476. };
  27477. return Promise.reject(params);
  27478. }
  27479. if (!handleOptions.print) {
  27480. if (beforeExportMethod) {
  27481. beforeExportMethod({
  27482. options: handleOptions,
  27483. $table: $xeTable,
  27484. $grid: $xeGrid,
  27485. $gantt: $xeGantt
  27486. });
  27487. }
  27488. }
  27489. if (!handleOptions.data) {
  27490. handleOptions.data = [];
  27491. if (mode === 'selected') {
  27492. if (['html', 'pdf'].indexOf(type) > -1 && treeConfig) {
  27493. handleOptions.data = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().searchTree($xeTable.getTableData().fullData, item => $xeTable.findRowIndexOf(selectRecords, item) > -1, Object.assign({}, treeOpts, {
  27494. data: '_row'
  27495. }));
  27496. } else {
  27497. handleOptions.data = selectRecords;
  27498. }
  27499. } else if (mode === 'all') {
  27500. if (!$xeGGWrapper) {
  27501. errLog('vxe.error.errProp', ['all', 'mode=current,selected']);
  27502. }
  27503. if ($xeGGWrapper && !handleOptions.remote) {
  27504. const gridReactData = $xeGGWrapper;
  27505. const proxyOpts = $xeGGWrapper.computeProxyOpts;
  27506. const {
  27507. sortData
  27508. } = gridReactData;
  27509. const {
  27510. beforeQueryAll,
  27511. afterQueryAll,
  27512. ajax = {}
  27513. } = proxyOpts;
  27514. const resConfigs = proxyOpts.response || proxyOpts.props || {};
  27515. const ajaxMethods = ajax.queryAll;
  27516. const queryAllSuccessMethods = ajax.queryAllSuccess;
  27517. const queryAllErrorMethods = ajax.queryAllError;
  27518. if (!ajaxMethods) {
  27519. errLog('vxe.error.notFunc', ['proxy-config.ajax.queryAll']);
  27520. }
  27521. if (ajaxMethods) {
  27522. const params = {
  27523. $table: $xeTable,
  27524. $grid: $xeGrid,
  27525. $gantt: $xeGantt,
  27526. sort: sortData.length ? sortData[0] : {},
  27527. sorts: sortData,
  27528. filters: gridReactData.filterData,
  27529. form: gridReactData.formData,
  27530. options: handleOptions
  27531. };
  27532. return Promise.resolve((beforeQueryAll || ajaxMethods)(params)).then(rest => {
  27533. const listProp = resConfigs.list;
  27534. handleOptions.data = (listProp ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(listProp) ? listProp({
  27535. data: rest,
  27536. $table: $xeTable,
  27537. $grid: $xeGrid,
  27538. $gantt: $xeGantt
  27539. }) : external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(rest, listProp) : rest) || [];
  27540. if (afterQueryAll) {
  27541. afterQueryAll(params);
  27542. }
  27543. if (queryAllSuccessMethods) {
  27544. queryAllSuccessMethods({
  27545. ...params,
  27546. response: rest
  27547. });
  27548. }
  27549. return handleExport($xeTable, handleOptions);
  27550. }).catch(rest => {
  27551. if (queryAllErrorMethods) {
  27552. queryAllErrorMethods({
  27553. ...params,
  27554. response: rest
  27555. });
  27556. }
  27557. });
  27558. }
  27559. }
  27560. } else if (mode === 'current') {
  27561. handleOptions.data = treeConfig ? afterTreeFullData : afterFullData;
  27562. }
  27563. } else {
  27564. handleOptions._isCustomData = true;
  27565. }
  27566. return handleExport($xeTable, handleOptions);
  27567. },
  27568. _importByFile(file, options) {
  27569. const $xeTable = this;
  27570. const opts = Object.assign({}, options);
  27571. const {
  27572. beforeImportMethod
  27573. } = opts;
  27574. if (beforeImportMethod) {
  27575. beforeImportMethod({
  27576. options: opts,
  27577. $table: $xeTable
  27578. });
  27579. }
  27580. return handleFileImport($xeTable, file, opts);
  27581. },
  27582. _importData(options) {
  27583. const $xeTable = this;
  27584. const {
  27585. importOpts
  27586. } = this;
  27587. const opts = Object.assign({
  27588. types: external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().keys(importOpts._typeMaps)
  27589. // beforeImportMethod: null,
  27590. // afterImportMethod: null
  27591. }, importOpts, options);
  27592. const {
  27593. beforeImportMethod,
  27594. afterImportMethod
  27595. } = opts;
  27596. if (beforeImportMethod) {
  27597. beforeImportMethod({
  27598. options: opts,
  27599. $table: this
  27600. });
  27601. }
  27602. return core_.VxeUI.readFile(opts).catch(e => {
  27603. if (afterImportMethod) {
  27604. afterImportMethod({
  27605. status: false,
  27606. options: opts,
  27607. $table: $xeTable
  27608. });
  27609. }
  27610. return Promise.reject(e);
  27611. }).then(params => {
  27612. const {
  27613. file
  27614. } = params;
  27615. return handleFileImport($xeTable, file, opts);
  27616. });
  27617. },
  27618. _saveFile(options) {
  27619. return core_.VxeUI.saveFile(options);
  27620. },
  27621. _readFile(options) {
  27622. return core_.VxeUI.readFile(options);
  27623. },
  27624. _print(options) {
  27625. const $xeTable = this;
  27626. const $xeGrid = $xeTable.$xeGrid;
  27627. const $xeGantt = $xeTable.$xeGantt;
  27628. const printOpts = $xeTable.computePrintOpts;
  27629. const opts = Object.assign({
  27630. original: false
  27631. // beforePrintMethod
  27632. }, printOpts, options, {
  27633. type: 'html',
  27634. download: false,
  27635. remote: false,
  27636. print: true
  27637. });
  27638. const {
  27639. sheetName
  27640. } = opts;
  27641. let printTitle = '';
  27642. if (sheetName) {
  27643. if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(sheetName)) {
  27644. printTitle = sheetName({
  27645. options: opts,
  27646. $table: $xeTable,
  27647. $grid: $xeGrid,
  27648. $gantt: $xeGantt
  27649. });
  27650. } else {
  27651. printTitle = `${sheetName}`;
  27652. }
  27653. }
  27654. if (!printTitle) {
  27655. printTitle = document.title || '';
  27656. }
  27657. const beforePrintMethod = opts.beforePrintMethod;
  27658. const tableHtml = opts.html || opts.content;
  27659. return new Promise((resolve, reject) => {
  27660. if (core_.VxeUI.print) {
  27661. if (tableHtml) {
  27662. resolve(core_.VxeUI.print({
  27663. title: printTitle,
  27664. html: tableHtml,
  27665. customStyle: opts.style,
  27666. beforeMethod: beforePrintMethod ? ({
  27667. html
  27668. }) => {
  27669. return beforePrintMethod({
  27670. html,
  27671. content: html,
  27672. options: opts,
  27673. $table: $xeTable,
  27674. $grid: $xeGrid,
  27675. $gantt: $xeGantt
  27676. });
  27677. } : undefined
  27678. }));
  27679. } else {
  27680. resolve($xeTable.exportData(opts).then(({
  27681. content
  27682. }) => {
  27683. return core_.VxeUI.print({
  27684. title: printTitle,
  27685. html: content,
  27686. customStyle: opts.style,
  27687. beforeMethod: beforePrintMethod ? ({
  27688. html
  27689. }) => {
  27690. return beforePrintMethod({
  27691. html,
  27692. content: html,
  27693. options: opts,
  27694. $table: $xeTable,
  27695. $grid: $xeGrid,
  27696. $gantt: $xeGantt
  27697. });
  27698. } : undefined
  27699. });
  27700. }));
  27701. }
  27702. } else {
  27703. const e = {
  27704. status: false
  27705. };
  27706. reject(e);
  27707. }
  27708. });
  27709. },
  27710. _getPrintHtml(options) {
  27711. const $xeTable = this;
  27712. const printOpts = $xeTable.computePrintOpts;
  27713. const opts = Object.assign({
  27714. original: false
  27715. // beforePrintMethod
  27716. }, printOpts, options, {
  27717. type: 'html',
  27718. download: false,
  27719. remote: false,
  27720. print: true
  27721. });
  27722. return $xeTable.exportData(opts).then(({
  27723. content
  27724. }) => {
  27725. return {
  27726. html: content
  27727. };
  27728. });
  27729. },
  27730. _closeImport() {
  27731. if (core_.VxeUI.modal) {
  27732. return core_.VxeUI.modal.close('VXE_IMPORT_MODAL');
  27733. }
  27734. return Promise.resolve();
  27735. },
  27736. _openImport(options) {
  27737. const $xeTable = this;
  27738. const props = $xeTable;
  27739. const reactData = $xeTable;
  27740. const {
  27741. treeConfig,
  27742. importConfig
  27743. } = props;
  27744. const {
  27745. initStore,
  27746. importStore,
  27747. importParams
  27748. } = reactData;
  27749. const importOpts = $xeTable.computeImportOpts;
  27750. const defOpts = Object.assign({
  27751. mode: 'insertTop',
  27752. message: true,
  27753. types: external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().keys(importOpts._typeMaps),
  27754. modes: ['insertTop', 'covering']
  27755. }, importOpts, options);
  27756. const types = defOpts.types || [];
  27757. const modes = defOpts.modes || [];
  27758. const isTree = !!treeConfig;
  27759. if (isTree) {
  27760. if (defOpts.message) {
  27761. core_.VxeUI.modal.message({
  27762. content: export_mixin_getI18n('vxe.error.treeNotImp'),
  27763. status: 'error'
  27764. });
  27765. }
  27766. return;
  27767. }
  27768. if (!importConfig) {
  27769. errLog('vxe.error.reqProp', ['import-config']);
  27770. }
  27771. // 处理类型
  27772. const typeList = types.map(value => {
  27773. return {
  27774. value,
  27775. label: export_mixin_getI18n(`vxe.export.types.${value}`)
  27776. };
  27777. });
  27778. const modeList = modes.map(item => {
  27779. if (item && item.value) {
  27780. return {
  27781. value: item.value,
  27782. label: item.label || item.value
  27783. };
  27784. }
  27785. return {
  27786. value: item,
  27787. label: export_mixin_getI18n(`vxe.import.modes.${item}`)
  27788. };
  27789. });
  27790. Object.assign(importStore, {
  27791. file: null,
  27792. type: '',
  27793. filename: '',
  27794. modeList,
  27795. typeList,
  27796. visible: true
  27797. });
  27798. Object.assign(importParams, defOpts);
  27799. if (!modeList.some(item => item.value === importParams.mode)) {
  27800. importParams.mode = modeList[0].value;
  27801. }
  27802. initStore.import = true;
  27803. },
  27804. _closeExport: handleCloseExport,
  27805. _openExport(options) {
  27806. const $xeTable = this;
  27807. const props = $xeTable;
  27808. const exportOpts = $xeTable.computeExportOpts;
  27809. const defOpts = Object.assign({
  27810. message: true,
  27811. types: external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().keys(exportOpts._typeMaps)
  27812. }, exportOpts, options);
  27813. if (!props.exportConfig) {
  27814. errLog('vxe.error.reqProp', ['export-config']);
  27815. }
  27816. return handleExportAndPrint($xeTable, defOpts);
  27817. },
  27818. _closePrint: handleCloseExport,
  27819. _openPrint(options) {
  27820. const $xeTable = this;
  27821. const props = $xeTable;
  27822. const printOpts = $xeTable.computePrintOpts;
  27823. const defOpts = Object.assign({
  27824. message: true
  27825. }, printOpts, options);
  27826. if (!props.printConfig) {
  27827. errLog('vxe.error.reqProp', ['print-config']);
  27828. }
  27829. return handleExportAndPrint($xeTable, defOpts, true);
  27830. }
  27831. }
  27832. });
  27833. ;// CONCATENATED MODULE: ./packages/table/module/keyboard/mixin.ts
  27834. function getCheckboxRangeRows($xeTable, evnt, params, targetTrElem, trRect, offsetClientTop, moveRange) {
  27835. const props = $xeTable;
  27836. const reactData = $xeTable;
  27837. const internalData = $xeTable;
  27838. const {
  27839. showOverflow
  27840. } = props;
  27841. const {
  27842. fullAllDataRowIdData,
  27843. isResizeCellHeight
  27844. } = internalData;
  27845. const rowOpts = $xeTable.computeRowOpts;
  27846. const cellOpts = $xeTable.computeCellOpts;
  27847. const defaultRowHeight = $xeTable.computeDefaultRowHeight;
  27848. const {
  27849. row
  27850. } = params;
  27851. let countHeight = 0;
  27852. let rangeRows = [];
  27853. let moveSize = 0;
  27854. const isDown = moveRange > 0;
  27855. const {
  27856. scrollYLoad
  27857. } = reactData;
  27858. const {
  27859. afterFullData
  27860. } = internalData;
  27861. if (isDown) {
  27862. moveSize = offsetClientTop + moveRange;
  27863. } else {
  27864. moveSize = trRect.height - offsetClientTop + Math.abs(moveRange);
  27865. }
  27866. if (scrollYLoad) {
  27867. const _rowIndex = $xeTable.getVTRowIndex(row);
  27868. const isCustomCellHeight = isResizeCellHeight || cellOpts.height || rowOpts.height;
  27869. if (!isCustomCellHeight && showOverflow) {
  27870. if (isDown) {
  27871. rangeRows = afterFullData.slice(_rowIndex, _rowIndex + Math.ceil(moveSize / defaultRowHeight));
  27872. } else {
  27873. rangeRows = afterFullData.slice(_rowIndex - Math.floor(moveSize / defaultRowHeight), _rowIndex + 1);
  27874. }
  27875. } else {
  27876. if (isDown) {
  27877. for (let i = _rowIndex; i < afterFullData.length; i++) {
  27878. const item = afterFullData[i];
  27879. const rowid = $xeTable.getRowid(item);
  27880. const rowRest = fullAllDataRowIdData[rowid] || {};
  27881. countHeight += rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight;
  27882. rangeRows.push(item);
  27883. if (countHeight > moveSize) {
  27884. return rangeRows;
  27885. }
  27886. }
  27887. } else {
  27888. for (let len = _rowIndex; len >= 0; len--) {
  27889. const item = afterFullData[len];
  27890. const rowid = $xeTable.getRowid(item);
  27891. const rowRest = fullAllDataRowIdData[rowid] || {};
  27892. countHeight += rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight;
  27893. rangeRows.push(item);
  27894. if (countHeight > moveSize) {
  27895. return rangeRows;
  27896. }
  27897. }
  27898. }
  27899. }
  27900. } else {
  27901. const siblingProp = isDown ? 'next' : 'previous';
  27902. while (targetTrElem && countHeight < moveSize) {
  27903. const rowNodeRest = $xeTable.getRowNode(targetTrElem);
  27904. if (rowNodeRest) {
  27905. rangeRows.push(rowNodeRest.item);
  27906. countHeight += targetTrElem.offsetHeight;
  27907. targetTrElem = targetTrElem[`${siblingProp}ElementSibling`];
  27908. }
  27909. }
  27910. }
  27911. return rangeRows;
  27912. }
  27913. function handleMoveSelected($xeTable, evnt, args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow) {
  27914. const internalData = $xeTable;
  27915. const {
  27916. afterFullData,
  27917. visibleColumn
  27918. } = internalData;
  27919. const params = Object.assign({}, args);
  27920. const _rowIndex = $xeTable.getVTRowIndex(params.row);
  27921. const _columnIndex = $xeTable.getVTColumnIndex(params.column);
  27922. evnt.preventDefault();
  27923. if (isUpArrow && _rowIndex > 0) {
  27924. // 移动到上一行
  27925. params.rowIndex = _rowIndex - 1;
  27926. params.row = afterFullData[params.rowIndex];
  27927. } else if (isDwArrow && _rowIndex < afterFullData.length - 1) {
  27928. // 移动到下一行
  27929. params.rowIndex = _rowIndex + 1;
  27930. params.row = afterFullData[params.rowIndex];
  27931. } else if (isLeftArrow && _columnIndex) {
  27932. // 移动到左侧单元格
  27933. params.columnIndex = _columnIndex - 1;
  27934. params.column = visibleColumn[params.columnIndex];
  27935. } else if (isRightArrow && _columnIndex < visibleColumn.length - 1) {
  27936. // 移动到右侧单元格
  27937. params.columnIndex = _columnIndex + 1;
  27938. params.column = visibleColumn[params.columnIndex];
  27939. }
  27940. $xeTable.scrollToRow(params.row, params.column).then(() => {
  27941. params.cell = $xeTable.getCellElement(params.row, params.column);
  27942. $xeTable.handleSelected(params, evnt);
  27943. });
  27944. return params;
  27945. }
  27946. function handleCheckboxRangeEvent($xeTable, evnt, params) {
  27947. const internalData = $xeTable;
  27948. const {
  27949. elemStore
  27950. } = internalData;
  27951. const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
  27952. const leftScrollElem = getRefElem(elemStore['left-body-scroll']);
  27953. const rightScrollElem = getRefElem(elemStore['right-body-scroll']);
  27954. const {
  27955. column,
  27956. cell
  27957. } = params;
  27958. if (column.type === 'checkbox') {
  27959. let bodyWrapperElem = bodyScrollElem;
  27960. if (leftScrollElem && column.fixed === 'left') {
  27961. bodyWrapperElem = leftScrollElem;
  27962. } else if (rightScrollElem && column.fixed === 'right') {
  27963. bodyWrapperElem = rightScrollElem;
  27964. }
  27965. if (!bodyWrapperElem) {
  27966. return;
  27967. }
  27968. const bodyRect = bodyWrapperElem.getBoundingClientRect();
  27969. const el = $xeTable.$refs.refElem;
  27970. const disX = evnt.clientX;
  27971. const disY = evnt.clientY;
  27972. const checkboxRangeElem = bodyWrapperElem.querySelector('.vxe-table--checkbox-range');
  27973. const trElem = cell.parentNode;
  27974. const selectRecords = $xeTable.getCheckboxRecords();
  27975. let lastRangeRows = [];
  27976. const marginSize = 1;
  27977. const startTop = evnt.clientY - bodyRect.y + bodyWrapperElem.scrollTop;
  27978. const startLeft = evnt.clientX - bodyRect.x + bodyWrapperElem.scrollLeft;
  27979. const startScrollTop = bodyWrapperElem.scrollTop;
  27980. const rowHeight = trElem.offsetHeight;
  27981. const trRect = trElem.getBoundingClientRect();
  27982. const offsetClientTop = disY - trRect.y;
  27983. let mouseScrollTimeout = null;
  27984. let isMouseScrollDown = false;
  27985. let mouseScrollSpaceSize = 1;
  27986. const triggerEvent = (type, evnt) => {
  27987. $xeTable.dispatchEvent(`checkbox-range-${type}`, {
  27988. records: () => $xeTable.getCheckboxRecords(),
  27989. reserves: () => $xeTable.getCheckboxReserveRecords()
  27990. }, evnt);
  27991. };
  27992. const handleChecked = evnt => {
  27993. const {
  27994. clientX,
  27995. clientY
  27996. } = evnt;
  27997. const offsetLeft = clientX - disX;
  27998. const offsetTop = clientY - disY + (bodyWrapperElem.scrollTop - startScrollTop);
  27999. let rangeHeight = Math.abs(offsetTop);
  28000. let rangeWidth = Math.abs(offsetLeft);
  28001. let rangeTop = startTop;
  28002. let rangeLeft = startLeft;
  28003. if (offsetTop < marginSize) {
  28004. // 向上
  28005. rangeTop += offsetTop;
  28006. if (rangeTop < marginSize) {
  28007. rangeTop = marginSize;
  28008. rangeHeight = startTop;
  28009. }
  28010. } else {
  28011. // 向下
  28012. rangeHeight = Math.min(rangeHeight, bodyWrapperElem.scrollHeight - startTop - marginSize);
  28013. }
  28014. if (offsetLeft < marginSize) {
  28015. // 向左
  28016. rangeLeft += offsetLeft;
  28017. if (rangeWidth > startLeft) {
  28018. rangeLeft = marginSize;
  28019. rangeWidth = startLeft;
  28020. }
  28021. } else {
  28022. // 向右
  28023. rangeWidth = Math.min(rangeWidth, bodyWrapperElem.clientWidth - startLeft - marginSize);
  28024. }
  28025. checkboxRangeElem.style.height = `${rangeHeight}px`;
  28026. checkboxRangeElem.style.width = `${rangeWidth}px`;
  28027. checkboxRangeElem.style.left = `${rangeLeft}px`;
  28028. checkboxRangeElem.style.top = `${rangeTop}px`;
  28029. checkboxRangeElem.style.display = 'block';
  28030. const rangeRows = getCheckboxRangeRows($xeTable, evnt, params, trElem, trRect, offsetClientTop, offsetTop < marginSize ? -rangeHeight : rangeHeight);
  28031. // 至少滑动 10px 才能有效匹配
  28032. if (rangeHeight > 10 && rangeRows.length !== lastRangeRows.length) {
  28033. const isControlKey = hasControlKey(evnt);
  28034. lastRangeRows = rangeRows;
  28035. if (isControlKey) {
  28036. rangeRows.forEach(row => {
  28037. $xeTable.handleBatchSelectRows([row], selectRecords.indexOf(row) === -1);
  28038. });
  28039. } else {
  28040. $xeTable.setAllCheckboxRow(false);
  28041. $xeTable.handleCheckedCheckboxRow(rangeRows, true, false);
  28042. }
  28043. triggerEvent('change', evnt);
  28044. }
  28045. };
  28046. // 停止鼠标滚动
  28047. const stopMouseScroll = () => {
  28048. clearTimeout(mouseScrollTimeout);
  28049. mouseScrollTimeout = null;
  28050. };
  28051. // 开始鼠标滚动
  28052. const startMouseScroll = evnt => {
  28053. stopMouseScroll();
  28054. mouseScrollTimeout = setTimeout(() => {
  28055. if (mouseScrollTimeout) {
  28056. const {
  28057. scrollLeft,
  28058. scrollTop,
  28059. clientHeight,
  28060. scrollHeight
  28061. } = bodyWrapperElem;
  28062. const topSize = Math.ceil(mouseScrollSpaceSize * 50 / rowHeight);
  28063. if (isMouseScrollDown) {
  28064. if (scrollTop + clientHeight < scrollHeight) {
  28065. $xeTable.scrollTo(scrollLeft, scrollTop + topSize);
  28066. startMouseScroll(evnt);
  28067. handleChecked(evnt);
  28068. } else {
  28069. stopMouseScroll();
  28070. }
  28071. } else {
  28072. if (scrollTop) {
  28073. $xeTable.scrollTo(scrollLeft, scrollTop - topSize);
  28074. startMouseScroll(evnt);
  28075. handleChecked(evnt);
  28076. } else {
  28077. stopMouseScroll();
  28078. }
  28079. }
  28080. }
  28081. }, 50);
  28082. };
  28083. addClass(el, 'drag--range');
  28084. document.onmousemove = evnt => {
  28085. evnt.preventDefault();
  28086. evnt.stopPropagation();
  28087. const {
  28088. clientY
  28089. } = evnt;
  28090. const {
  28091. boundingTop
  28092. } = getAbsolutePos(bodyWrapperElem);
  28093. // 如果超过可视区,触发滚动
  28094. if (clientY < boundingTop) {
  28095. isMouseScrollDown = false;
  28096. mouseScrollSpaceSize = boundingTop - clientY;
  28097. if (!mouseScrollTimeout) {
  28098. startMouseScroll(evnt);
  28099. }
  28100. } else if (clientY > boundingTop + bodyWrapperElem.clientHeight) {
  28101. isMouseScrollDown = true;
  28102. mouseScrollSpaceSize = clientY - boundingTop - bodyWrapperElem.clientHeight;
  28103. if (!mouseScrollTimeout) {
  28104. startMouseScroll(evnt);
  28105. }
  28106. } else if (mouseScrollTimeout) {
  28107. stopMouseScroll();
  28108. }
  28109. handleChecked(evnt);
  28110. };
  28111. document.onmouseup = evnt => {
  28112. stopMouseScroll();
  28113. removeClass(el, 'drag--range');
  28114. checkboxRangeElem.removeAttribute('style');
  28115. document.onmousemove = null;
  28116. document.onmouseup = null;
  28117. triggerEvent('end', evnt);
  28118. };
  28119. triggerEvent('start', evnt);
  28120. }
  28121. }
  28122. /* harmony default export */ var keyboard_mixin = ({
  28123. methods: {
  28124. // 处理 Tab 键移动
  28125. moveTabSelected(args, isLeft, evnt) {
  28126. const $xeTable = this;
  28127. const props = $xeTable;
  28128. const internalData = $xeTable;
  28129. const {
  28130. editConfig
  28131. } = props;
  28132. const {
  28133. afterFullData,
  28134. visibleColumn
  28135. } = internalData;
  28136. const editOpts = $xeTable.computeEditOpts;
  28137. const rowOpts = $xeTable.computeRowOpts;
  28138. const currentRowOpts = $xeTable.computeCurrentRowOpts;
  28139. const columnOpts = $xeTable.computeColumnOpts;
  28140. const currentColumnOpts = $xeTable.computeCurrentColumnOpts;
  28141. let targetRow;
  28142. let targetRowIndex;
  28143. let targetColumnIndex;
  28144. const params = Object.assign({}, args);
  28145. const _rowIndex = $xeTable.getVTRowIndex(params.row);
  28146. const _columnIndex = $xeTable.getVTColumnIndex(params.column);
  28147. evnt.preventDefault();
  28148. if (isLeft) {
  28149. // 向左
  28150. if (_columnIndex <= 0) {
  28151. // 如果已经是第一列,则移动到上一行
  28152. if (_rowIndex > 0) {
  28153. targetRowIndex = _rowIndex - 1;
  28154. targetRow = afterFullData[targetRowIndex];
  28155. targetColumnIndex = visibleColumn.length - 1;
  28156. }
  28157. } else {
  28158. targetColumnIndex = _columnIndex - 1;
  28159. }
  28160. } else {
  28161. if (_columnIndex >= visibleColumn.length - 1) {
  28162. // 如果已经是第一列,则移动到上一行
  28163. if (_rowIndex < afterFullData.length - 1) {
  28164. targetRowIndex = _rowIndex + 1;
  28165. targetRow = afterFullData[targetRowIndex];
  28166. targetColumnIndex = 0;
  28167. }
  28168. } else {
  28169. targetColumnIndex = _columnIndex + 1;
  28170. }
  28171. }
  28172. const targetColumn = visibleColumn[targetColumnIndex];
  28173. if (targetColumn) {
  28174. if (targetRow) {
  28175. params.rowIndex = targetRowIndex;
  28176. params.row = targetRow;
  28177. } else {
  28178. params.rowIndex = _rowIndex;
  28179. }
  28180. params.columnIndex = targetColumnIndex;
  28181. params.column = targetColumn;
  28182. params.cell = $xeTable.getCellElement(params.row, params.column);
  28183. if (rowOpts.isCurrent && currentRowOpts.isFollowSelected) {
  28184. $xeTable.triggerCurrentRowEvent(evnt, params);
  28185. }
  28186. if (columnOpts.isCurrent && currentColumnOpts.isFollowSelected) {
  28187. $xeTable.triggerCurrentColumnEvent(evnt, params);
  28188. }
  28189. if (editConfig) {
  28190. if (editOpts.trigger === 'click' || editOpts.trigger === 'dblclick') {
  28191. if (editOpts.mode === 'row') {
  28192. $xeTable.handleEdit(params, evnt);
  28193. } else {
  28194. $xeTable.scrollToRow(params.row, params.column).then(() => {
  28195. $xeTable.handleSelected(params, evnt);
  28196. });
  28197. }
  28198. }
  28199. } else {
  28200. $xeTable.scrollToRow(params.row, params.column).then(() => {
  28201. $xeTable.handleSelected(params, evnt);
  28202. });
  28203. }
  28204. }
  28205. },
  28206. // 处理当前行方向键移动
  28207. moveCurrentRow(isUpArrow, isDwArrow, evnt) {
  28208. const $xeTable = this;
  28209. const props = $xeTable;
  28210. const reactData = $xeTable;
  28211. const internalData = $xeTable;
  28212. const {
  28213. treeConfig
  28214. } = props;
  28215. const {
  28216. currentRow
  28217. } = reactData;
  28218. const {
  28219. afterFullData
  28220. } = internalData;
  28221. const treeOpts = $xeTable.computeTreeOpts;
  28222. const childrenField = treeOpts.children || treeOpts.childrenField;
  28223. let targetRow;
  28224. if (currentRow) {
  28225. if (treeConfig) {
  28226. const {
  28227. index,
  28228. items
  28229. } = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findTree(afterFullData, item => item === currentRow, {
  28230. children: childrenField
  28231. });
  28232. if (isUpArrow && index > 0) {
  28233. targetRow = items[index - 1];
  28234. } else if (isDwArrow && index < items.length - 1) {
  28235. targetRow = items[index + 1];
  28236. }
  28237. } else {
  28238. const _rowIndex = $xeTable.getVTRowIndex(currentRow);
  28239. if (isUpArrow && _rowIndex > 0) {
  28240. targetRow = afterFullData[_rowIndex - 1];
  28241. } else if (isDwArrow && _rowIndex < afterFullData.length - 1) {
  28242. targetRow = afterFullData[_rowIndex + 1];
  28243. }
  28244. }
  28245. } else {
  28246. targetRow = afterFullData[0];
  28247. }
  28248. if (targetRow) {
  28249. evnt.preventDefault();
  28250. const params = {
  28251. $table: $xeTable,
  28252. row: targetRow,
  28253. rowIndex: $xeTable.getRowIndex(targetRow),
  28254. $rowIndex: $xeTable.getVMRowIndex(targetRow)
  28255. };
  28256. $xeTable.scrollToRow(targetRow).then(() => $xeTable.triggerCurrentRowEvent(evnt, params));
  28257. }
  28258. },
  28259. // 处理当前列方向键移动
  28260. moveCurrentColumn(isLeftArrow, isRightArrow, evnt) {
  28261. const $xeTable = this;
  28262. const reactData = $xeTable;
  28263. const internalData = $xeTable;
  28264. const {
  28265. currentColumn
  28266. } = reactData;
  28267. const {
  28268. visibleColumn
  28269. } = internalData;
  28270. let targetCol = null;
  28271. if (currentColumn) {
  28272. const _columnIndex = $xeTable.getVTColumnIndex(currentColumn);
  28273. if (isLeftArrow && _columnIndex > 0) {
  28274. targetCol = visibleColumn[_columnIndex - 1];
  28275. } else if (isRightArrow && _columnIndex < visibleColumn.length - 1) {
  28276. targetCol = visibleColumn[_columnIndex + 1];
  28277. }
  28278. } else {
  28279. targetCol = visibleColumn[0];
  28280. }
  28281. if (targetCol) {
  28282. evnt.preventDefault();
  28283. const params = {
  28284. $table: $xeTable,
  28285. column: targetCol,
  28286. columnIndex: $xeTable.getColumnIndex(targetCol),
  28287. $columnIndex: $xeTable.getVMColumnIndex(targetCol)
  28288. };
  28289. $xeTable.scrollToColumn(targetCol).then(() => $xeTable.triggerCurrentColumnEvent(evnt, params));
  28290. }
  28291. },
  28292. // 处理可编辑方向键移动
  28293. moveArrowSelected(args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow, evnt) {
  28294. const $xeTable = this;
  28295. const props = $xeTable;
  28296. const {
  28297. highlightCurrentRow,
  28298. highlightCurrentColumn
  28299. } = props;
  28300. const rowOpts = $xeTable.computeRowOpts;
  28301. const currentRowOpts = $xeTable.computeCurrentRowOpts;
  28302. const columnOpts = $xeTable.computeColumnOpts;
  28303. const currentColumnOpts = $xeTable.computeCurrentColumnOpts;
  28304. const params = handleMoveSelected($xeTable, evnt, args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow);
  28305. if (rowOpts.isCurrent || highlightCurrentRow) {
  28306. if (currentRowOpts.isFollowSelected) {
  28307. $xeTable.triggerCurrentRowEvent(evnt, params);
  28308. } else {
  28309. // 当前行按键上下移动
  28310. if ((isUpArrow || isDwArrow) && (rowOpts.isCurrent || highlightCurrentRow)) {
  28311. $xeTable.moveCurrentRow(isUpArrow, isDwArrow, evnt);
  28312. }
  28313. }
  28314. }
  28315. if (columnOpts.isCurrent || highlightCurrentColumn) {
  28316. if (currentColumnOpts.isFollowSelected) {
  28317. $xeTable.triggerCurrentColumnEvent(evnt, params);
  28318. } else {
  28319. // 当前行按键左右移动
  28320. if ((isLeftArrow || isRightArrow) && (columnOpts.isCurrent || highlightCurrentColumn)) {
  28321. $xeTable.moveCurrentColumn(isLeftArrow, isRightArrow, evnt);
  28322. }
  28323. }
  28324. }
  28325. },
  28326. moveEnterSelected(args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow, evnt) {
  28327. const $xeTable = this;
  28328. const props = $xeTable;
  28329. const {
  28330. highlightCurrentRow,
  28331. highlightCurrentColumn
  28332. } = props;
  28333. const rowOpts = $xeTable.computeRowOpts;
  28334. const currentRowOpts = $xeTable.computeCurrentRowOpts;
  28335. const columnOpts = $xeTable.computeColumnOpts;
  28336. const currentColumnOpts = $xeTable.computeCurrentColumnOpts;
  28337. const params = handleMoveSelected($xeTable, evnt, args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow);
  28338. if ((rowOpts.isCurrent || highlightCurrentRow) && currentRowOpts.isFollowSelected) {
  28339. $xeTable.triggerCurrentRowEvent(evnt, params);
  28340. }
  28341. if ((columnOpts.isCurrent || highlightCurrentColumn) && currentColumnOpts.isFollowSelected) {
  28342. $xeTable.triggerCurrentColumnEvent(evnt, params);
  28343. }
  28344. },
  28345. // 处理可编辑方向键移动
  28346. moveSelected(args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow, evnt) {
  28347. const $xeTable = this;
  28348. handleMoveSelected($xeTable, evnt, args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow);
  28349. },
  28350. handleCellMousedownEvent(evnt, params) {
  28351. const $xeTable = this;
  28352. const props = $xeTable;
  28353. const {
  28354. editConfig,
  28355. checkboxConfig,
  28356. mouseConfig
  28357. } = props;
  28358. const checkboxOpts = $xeTable.computeCheckboxOpts;
  28359. const mouseOpts = $xeTable.computeMouseOpts;
  28360. const editOpts = $xeTable.computeEditOpts;
  28361. if (mouseConfig && mouseOpts.area && $xeTable.triggerCellAreaModnEvent) {
  28362. return $xeTable.triggerCellAreaModnEvent(evnt, params);
  28363. } else {
  28364. if (checkboxConfig && checkboxOpts.range) {
  28365. handleCheckboxRangeEvent($xeTable, evnt, params);
  28366. }
  28367. if (mouseConfig && mouseOpts.selected) {
  28368. if (!editConfig || editOpts.mode === 'cell') {
  28369. $xeTable.handleSelected(params, evnt);
  28370. }
  28371. }
  28372. }
  28373. }
  28374. }
  28375. });
  28376. ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/typeof.js
  28377. function _typeof(o) {
  28378. "@babel/helpers - typeof";
  28379. return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
  28380. return typeof o;
  28381. } : function (o) {
  28382. return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
  28383. }, _typeof(o);
  28384. }
  28385. ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toPrimitive.js
  28386. function toPrimitive(t, r) {
  28387. if ("object" != _typeof(t) || !t) return t;
  28388. var e = t[Symbol.toPrimitive];
  28389. if (void 0 !== e) {
  28390. var i = e.call(t, r || "default");
  28391. if ("object" != _typeof(i)) return i;
  28392. throw new TypeError("@@toPrimitive must return a primitive value.");
  28393. }
  28394. return ("string" === r ? String : Number)(t);
  28395. }
  28396. ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
  28397. function toPropertyKey(t) {
  28398. var i = toPrimitive(t, "string");
  28399. return "symbol" == _typeof(i) ? i : i + "";
  28400. }
  28401. ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
  28402. function _defineProperty(e, r, t) {
  28403. return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
  28404. value: t,
  28405. enumerable: !0,
  28406. configurable: !0,
  28407. writable: !0
  28408. }) : e[r] = t, e;
  28409. }
  28410. ;// CONCATENATED MODULE: ./packages/table/module/validator/mixin.ts
  28411. const {
  28412. getConfig: validator_mixin_getConfig,
  28413. validators: mixin_validators
  28414. } = core_.VxeUI;
  28415. /**
  28416. * 校验规则
  28417. */
  28418. class Rule {
  28419. constructor(rule) {
  28420. _defineProperty(this, "$options", void 0);
  28421. Object.assign(this, {
  28422. $options: rule,
  28423. required: rule.required,
  28424. min: rule.min,
  28425. max: rule.max,
  28426. type: rule.type,
  28427. pattern: rule.pattern,
  28428. validator: rule.validator,
  28429. trigger: rule.trigger,
  28430. maxWidth: rule.maxWidth
  28431. });
  28432. }
  28433. /**
  28434. * 获取校验不通过的消息
  28435. * 支持国际化翻译
  28436. */
  28437. get content() {
  28438. return getFuncText(this.$options.content || this.$options.message);
  28439. }
  28440. get message() {
  28441. return this.content;
  28442. }
  28443. }
  28444. // 如果存在 pattern,判断正则
  28445. function validREValue(pattern, val) {
  28446. if (pattern && !(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isRegExp(pattern) ? pattern : new RegExp(pattern)).test(val)) {
  28447. return false;
  28448. }
  28449. return true;
  28450. }
  28451. // 如果存在 max,判断最大值
  28452. function validMaxValue(max, num) {
  28453. if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(max) && num > external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(max)) {
  28454. return false;
  28455. }
  28456. return true;
  28457. }
  28458. // 如果存在 min,判断最小值
  28459. function validMinValue(min, num) {
  28460. if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(min) && num < external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(min)) {
  28461. return false;
  28462. }
  28463. return true;
  28464. }
  28465. function validRuleValue(rule, val, required) {
  28466. const {
  28467. type,
  28468. min,
  28469. max,
  28470. pattern
  28471. } = rule;
  28472. const isArrType = type === 'array';
  28473. const isNumType = type === 'number';
  28474. const isStrType = type === 'string';
  28475. const strVal = `${val}`;
  28476. if (!validREValue(pattern, strVal)) {
  28477. return false;
  28478. }
  28479. if (isArrType) {
  28480. if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(val)) {
  28481. return false;
  28482. }
  28483. if (required) {
  28484. if (!val.length) {
  28485. return false;
  28486. }
  28487. }
  28488. if (!validMinValue(min, val.length)) {
  28489. return false;
  28490. }
  28491. if (!validMaxValue(max, val.length)) {
  28492. return false;
  28493. }
  28494. } else if (isNumType) {
  28495. const numVal = Number(val);
  28496. if (isNaN(numVal)) {
  28497. return false;
  28498. }
  28499. if (!validMinValue(min, numVal)) {
  28500. return false;
  28501. }
  28502. if (!validMaxValue(max, numVal)) {
  28503. return false;
  28504. }
  28505. } else {
  28506. if (isStrType) {
  28507. if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(val)) {
  28508. return false;
  28509. }
  28510. }
  28511. if (required) {
  28512. if (!strVal) {
  28513. return false;
  28514. }
  28515. }
  28516. if (!validMinValue(min, strVal.length)) {
  28517. return false;
  28518. }
  28519. if (!validMaxValue(max, strVal.length)) {
  28520. return false;
  28521. }
  28522. }
  28523. return true;
  28524. }
  28525. function checkRuleStatus(rule, val) {
  28526. const {
  28527. required
  28528. } = rule;
  28529. const isEmptyVal = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(val) ? !val.length : eqEmptyValue(val);
  28530. if (required) {
  28531. if (isEmptyVal) {
  28532. return false;
  28533. }
  28534. if (!validRuleValue(rule, val, required)) {
  28535. return false;
  28536. }
  28537. } else {
  28538. if (!isEmptyVal) {
  28539. if (!validRuleValue(rule, val, required)) {
  28540. return false;
  28541. }
  28542. }
  28543. }
  28544. return true;
  28545. }
  28546. /* harmony default export */ var validator_mixin = ({
  28547. methods: {
  28548. /**
  28549. * 完整校验,和 validate 的区别就是会给有效数据中的每一行进行校验
  28550. */
  28551. _fullValidate(rows, cb) {
  28552. if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(cb)) {
  28553. warnLog('vxe.error.notValidators', ['fullValidate(rows, callback)', 'fullValidate(rows)']);
  28554. }
  28555. return this.beginValidate(rows, null, cb, true);
  28556. },
  28557. /**
  28558. * 快速校验,如果存在记录不通过的记录,则返回不再继续校验(异步校验除外)
  28559. */
  28560. _validate(rows, cb) {
  28561. if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(cb)) {
  28562. warnLog('vxe.error.notValidators', ['validate(rows, callback)', 'validate(rows)']);
  28563. }
  28564. return this.beginValidate(rows, null, cb);
  28565. },
  28566. /**
  28567. * 完整校验单元格,和 validateField 的区别就是会给有效数据中的每一行进行校验
  28568. */
  28569. _fullValidateField(rows, fieldOrColumn) {
  28570. const colList = (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(fieldOrColumn) ? fieldOrColumn : fieldOrColumn ? [fieldOrColumn] : []).map(column => handleFieldOrColumn(this, column));
  28571. if (colList.length) {
  28572. return this.beginValidate(rows, colList, null, true);
  28573. }
  28574. return this.$nextTick();
  28575. },
  28576. /**
  28577. * 快速校验单元格,如果存在记录不通过的记录,则返回不再继续校验(异步校验除外)
  28578. */
  28579. _validateField(rows, fieldOrColumn) {
  28580. const colList = (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(fieldOrColumn) ? fieldOrColumn : fieldOrColumn ? [fieldOrColumn] : []).map(column => handleFieldOrColumn(this, column));
  28581. if (colList.length) {
  28582. return this.beginValidate(rows, colList, null);
  28583. }
  28584. return this.$nextTick();
  28585. },
  28586. /**
  28587. * 聚焦到校验通过的单元格并弹出校验错误提示
  28588. */
  28589. handleValidError(params) {
  28590. const $xeTable = this;
  28591. const {
  28592. validOpts
  28593. } = this;
  28594. return new Promise(resolve => {
  28595. if (validOpts.autoPos === false) {
  28596. $xeTable.dispatchEvent('valid-error', params, null);
  28597. resolve();
  28598. } else {
  28599. this.handleEdit(params, {
  28600. type: 'valid-error',
  28601. trigger: 'call'
  28602. }).then(() => {
  28603. setTimeout(() => {
  28604. resolve(this.showValidTooltip(params));
  28605. }, 10);
  28606. });
  28607. }
  28608. });
  28609. },
  28610. handleErrMsgMode(validErrMaps) {
  28611. const {
  28612. validOpts
  28613. } = this;
  28614. if (validOpts.msgMode === 'single') {
  28615. const keys = Object.keys(validErrMaps);
  28616. const resMaps = {};
  28617. if (keys.length) {
  28618. const firstKey = keys[0];
  28619. resMaps[firstKey] = validErrMaps[firstKey];
  28620. }
  28621. return resMaps;
  28622. }
  28623. return validErrMaps;
  28624. },
  28625. /**
  28626. * 对表格数据进行校验
  28627. * 如果不指定数据,则默认只校验临时变动的数据,例如新增或修改
  28628. * 如果传 true 则校验当前表格数据
  28629. * 如果传 row 指定行记录,则只验证传入的行
  28630. * 如果传 rows 为多行记录,则只验证传入的行
  28631. * 如果只传 callback 否则默认验证整个表格数据
  28632. * 返回 Promise 对象,或者使用回调方式
  28633. */
  28634. beginValidate(rows, cols, cb, isFull) {
  28635. const $xeTable = this;
  28636. const props = $xeTable;
  28637. const reactData = $xeTable;
  28638. const internalData = $xeTable;
  28639. const validRest = {};
  28640. const {
  28641. editRules,
  28642. treeConfig
  28643. } = props;
  28644. const {
  28645. isRowGroupStatus
  28646. } = reactData;
  28647. const {
  28648. afterFullData,
  28649. pendingRowMaps,
  28650. removeRowMaps
  28651. } = internalData;
  28652. const treeOpts = $xeTable.computeTreeOpts;
  28653. const aggregateOpts = $xeTable.computeAggregateOpts;
  28654. let validList;
  28655. if (rows === true) {
  28656. validList = afterFullData;
  28657. } else if (rows) {
  28658. if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(rows)) {
  28659. cb = rows;
  28660. } else {
  28661. validList = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(rows) ? rows : [rows];
  28662. }
  28663. }
  28664. if (!validList) {
  28665. validList = this.getInsertRecords().concat(this.getUpdateRecords());
  28666. }
  28667. const rowValidErrs = [];
  28668. this.lastCallTime = Date.now();
  28669. this.validRuleErr = false; // 如果为快速校验,当存在某列校验不通过时将终止执行
  28670. this.clearValidate();
  28671. const validErrMaps = {};
  28672. if (editRules) {
  28673. const columns = cols && cols.length ? cols : this.getColumns();
  28674. const handleVaild = row => {
  28675. const rowid = getRowid($xeTable, row);
  28676. // 是否删除
  28677. if (removeRowMaps[rowid]) {
  28678. return;
  28679. }
  28680. // 是否标记删除
  28681. if (pendingRowMaps[rowid]) {
  28682. return;
  28683. }
  28684. if ($xeTable.isAggregateRecord(row)) {
  28685. return;
  28686. }
  28687. if (isFull || !this.validRuleErr) {
  28688. const colVailds = [];
  28689. columns.forEach(column => {
  28690. const field = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(column) ? column : column.field;
  28691. if ((isFull || !this.validRuleErr) && external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().has(editRules, field)) {
  28692. colVailds.push(this.validCellRules('all', row, column).catch(({
  28693. rule,
  28694. rules
  28695. }) => {
  28696. const rest = {
  28697. rule,
  28698. rules,
  28699. rowIndex: this.getRowIndex(row),
  28700. row,
  28701. columnIndex: this.getColumnIndex(column),
  28702. column,
  28703. field,
  28704. $table: this
  28705. };
  28706. if (!validRest[field]) {
  28707. validRest[field] = [];
  28708. }
  28709. validErrMaps[`${getRowid(this, row)}:${column.id}`] = {
  28710. column,
  28711. row,
  28712. rule,
  28713. content: rule.content
  28714. };
  28715. validRest[field].push(rest);
  28716. if (!isFull) {
  28717. this.validRuleErr = true;
  28718. return Promise.reject(rest);
  28719. }
  28720. }));
  28721. }
  28722. });
  28723. rowValidErrs.push(Promise.all(colVailds));
  28724. }
  28725. };
  28726. if (isRowGroupStatus) {
  28727. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(validList, handleVaild, {
  28728. children: aggregateOpts.mapChildrenField
  28729. });
  28730. } else if (treeConfig) {
  28731. const childrenField = treeOpts.children || treeOpts.childrenField;
  28732. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(validList, handleVaild, {
  28733. children: childrenField
  28734. });
  28735. } else {
  28736. validList.forEach(handleVaild);
  28737. }
  28738. return Promise.all(rowValidErrs).then(() => {
  28739. const ruleProps = Object.keys(validRest);
  28740. this.validErrorMaps = this.handleErrMsgMode(validErrMaps);
  28741. return this.$nextTick().then(() => {
  28742. if (ruleProps.length) {
  28743. return Promise.reject(validRest[ruleProps[0]][0]);
  28744. }
  28745. if (cb) {
  28746. cb();
  28747. }
  28748. });
  28749. }).catch(firstErrParams => {
  28750. return new Promise((resolve, reject) => {
  28751. const finish = () => {
  28752. this.$nextTick(() => {
  28753. if (cb) {
  28754. cb(validRest);
  28755. resolve();
  28756. } else {
  28757. if (validator_mixin_getConfig().validToReject === 'obsolete') {
  28758. // 已废弃,校验失败将不会执行catch
  28759. reject(validRest);
  28760. } else {
  28761. resolve(validRest);
  28762. }
  28763. }
  28764. });
  28765. };
  28766. const posAndFinish = () => {
  28767. firstErrParams.cell = this.getCellElement(firstErrParams.row, firstErrParams.column);
  28768. scrollToView(firstErrParams.cell);
  28769. this.handleValidError(firstErrParams).then(finish);
  28770. };
  28771. /**
  28772. * 当校验不通过时
  28773. * 将表格滚动到可视区
  28774. * 由于提示信息至少需要占一行,定位向上偏移一行
  28775. */
  28776. if (this.validOpts.autoPos === false) {
  28777. finish();
  28778. } else {
  28779. const row = firstErrParams.row;
  28780. const column = firstErrParams.column;
  28781. this.scrollToRow(row, column).then(posAndFinish);
  28782. }
  28783. });
  28784. });
  28785. } else {
  28786. this.validErrorMaps = {};
  28787. }
  28788. return this.$nextTick().then(() => {
  28789. if (cb) {
  28790. cb();
  28791. }
  28792. });
  28793. },
  28794. hasCellRules(type, row, column) {
  28795. const {
  28796. editRules
  28797. } = this;
  28798. const {
  28799. property
  28800. } = column;
  28801. if (property && editRules) {
  28802. const rules = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(editRules, property);
  28803. return rules && external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().find(rules, rule => type === 'all' || !rule.trigger || type === rule.trigger);
  28804. }
  28805. return false;
  28806. },
  28807. /**
  28808. * 校验数据
  28809. * 按表格行、列顺序依次校验(同步或异步)
  28810. * 校验规则根据索引顺序依次校验,如果是异步则会等待校验完成才会继续校验下一列
  28811. * 如果校验失败则,触发回调或者Promise<不通过列的错误消息>
  28812. * 如果是传回调方式这返回一个校验不通过列的错误消息
  28813. *
  28814. * rule 配置:
  28815. * required=Boolean 是否必填
  28816. * min=Number 最小长度
  28817. * max=Number 最大长度
  28818. * validator=Function({ cellValue, rule, rules, row, column, rowIndex, columnIndex }) 自定义校验,接收一个 Promise
  28819. * trigger=blur|change 触发方式(除非特殊场景,否则默认为空就行)
  28820. */
  28821. validCellRules(validType, row, column, val) {
  28822. const {
  28823. editRules
  28824. } = this;
  28825. const {
  28826. property
  28827. } = column;
  28828. const errorRules = [];
  28829. const syncValidList = [];
  28830. if (property && editRules) {
  28831. const rules = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(editRules, property);
  28832. if (rules) {
  28833. const cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isUndefined(val) ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, property) : val;
  28834. rules.forEach(rule => {
  28835. const {
  28836. trigger,
  28837. validator
  28838. } = rule;
  28839. if (validType === 'all' || !trigger || validType === trigger) {
  28840. if (validator) {
  28841. const validParams = {
  28842. cellValue,
  28843. rule,
  28844. rules,
  28845. row,
  28846. rowIndex: this.getRowIndex(row),
  28847. column,
  28848. columnIndex: this.getColumnIndex(column),
  28849. field: column.property,
  28850. $table: this
  28851. };
  28852. let customValid;
  28853. if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(validator)) {
  28854. const gvItem = mixin_validators.get(validator);
  28855. if (gvItem) {
  28856. const tcvMethod = gvItem.tableCellValidatorMethod || gvItem.cellValidatorMethod;
  28857. if (tcvMethod) {
  28858. customValid = tcvMethod(validParams);
  28859. } else {
  28860. errLog('vxe.error.notValidators', [validator]);
  28861. }
  28862. } else {
  28863. errLog('vxe.error.notValidators', [validator]);
  28864. }
  28865. } else {
  28866. customValid = validator(validParams);
  28867. }
  28868. if (customValid) {
  28869. if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isError(customValid)) {
  28870. this.validRuleErr = true;
  28871. errorRules.push(new Rule({
  28872. type: 'custom',
  28873. trigger,
  28874. content: customValid.message,
  28875. rule: new Rule(rule)
  28876. }));
  28877. } else if (customValid.catch) {
  28878. // 如果为异步校验(注:异步校验是并发无序的)
  28879. syncValidList.push(customValid.catch(e => {
  28880. this.validRuleErr = true;
  28881. errorRules.push(new Rule({
  28882. type: 'custom',
  28883. trigger,
  28884. content: e && e.message ? e.message : rule.content || rule.message,
  28885. rule: new Rule(rule)
  28886. }));
  28887. }));
  28888. }
  28889. }
  28890. } else {
  28891. if (!checkRuleStatus(rule, cellValue)) {
  28892. this.validRuleErr = true;
  28893. errorRules.push(new Rule(rule));
  28894. }
  28895. }
  28896. }
  28897. });
  28898. }
  28899. }
  28900. return Promise.all(syncValidList).then(() => {
  28901. if (errorRules.length) {
  28902. const rest = {
  28903. rules: errorRules,
  28904. rule: errorRules[0]
  28905. };
  28906. return Promise.reject(rest);
  28907. }
  28908. });
  28909. },
  28910. _clearValidate(rows, fieldOrColumn) {
  28911. const {
  28912. validOpts,
  28913. validErrorMaps
  28914. } = this;
  28915. const validTip = this.$refs.refValidTooltip;
  28916. const rowList = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(rows) ? rows : rows ? [rows] : [];
  28917. const colList = (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(fieldOrColumn) ? fieldOrColumn : fieldOrColumn ? [fieldOrColumn] : []).map(column => handleFieldOrColumn(this, column));
  28918. let validErrMaps = {};
  28919. if (validTip && validTip.visible) {
  28920. validTip.close();
  28921. }
  28922. // 如果是单个提示模式
  28923. if (validOpts.msgMode === 'single') {
  28924. this.validErrorMaps = {};
  28925. return this.$nextTick();
  28926. }
  28927. if (rowList.length && colList.length) {
  28928. validErrMaps = Object.assign({}, validErrorMaps);
  28929. rowList.forEach(row => {
  28930. colList.forEach(column => {
  28931. const validKey = `${getRowid(this, row)}:${column.id}`;
  28932. if (validErrMaps[validKey]) {
  28933. delete validErrMaps[validKey];
  28934. }
  28935. });
  28936. });
  28937. } else if (rowList.length) {
  28938. const rowIdList = rowList.map(row => `${getRowid(this, row)}`);
  28939. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(validErrorMaps, (item, key) => {
  28940. if (rowIdList.indexOf(key.split(':')[0]) > -1) {
  28941. validErrMaps[key] = item;
  28942. }
  28943. });
  28944. } else if (colList.length) {
  28945. const colidList = colList.map(column => `${column.id}`);
  28946. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(validErrorMaps, (item, key) => {
  28947. if (colidList.indexOf(key.split(':')[1]) > -1) {
  28948. validErrMaps[key] = item;
  28949. }
  28950. });
  28951. }
  28952. this.validErrorMaps = validErrMaps;
  28953. return this.$nextTick();
  28954. },
  28955. /**
  28956. * 触发校验
  28957. */
  28958. triggerValidate(type) {
  28959. const {
  28960. editConfig,
  28961. editStore,
  28962. editRules,
  28963. editOpts,
  28964. validOpts
  28965. } = this;
  28966. const {
  28967. actived
  28968. } = editStore;
  28969. // 检查清除校验消息
  28970. if (editRules && validOpts.msgMode === 'single') {
  28971. this.validErrorMaps = {};
  28972. }
  28973. // 校验单元格
  28974. if (editConfig && editRules && actived.row) {
  28975. const {
  28976. row,
  28977. column,
  28978. cell
  28979. } = actived.args;
  28980. if (this.hasCellRules(type, row, column)) {
  28981. return this.validCellRules(type, row, column).then(() => {
  28982. if (editOpts.mode === 'row') {
  28983. this.clearValidate(row, column);
  28984. }
  28985. }).catch(({
  28986. rule
  28987. }) => {
  28988. // 如果校验不通过与触发方式一致,则聚焦提示错误,否则跳过并不作任何处理
  28989. if (!rule.trigger || type === rule.trigger) {
  28990. const rest = {
  28991. rule,
  28992. row,
  28993. column,
  28994. cell
  28995. };
  28996. this.showValidTooltip(rest);
  28997. return Promise.reject(rest);
  28998. }
  28999. return Promise.resolve();
  29000. });
  29001. }
  29002. }
  29003. return Promise.resolve();
  29004. },
  29005. /**
  29006. * 弹出校验错误提示
  29007. */
  29008. showValidTooltip(params) {
  29009. const $xeTable = this;
  29010. const {
  29011. $refs,
  29012. height,
  29013. validStore,
  29014. validErrorMaps,
  29015. tableData,
  29016. validOpts
  29017. } = this;
  29018. const {
  29019. rule,
  29020. row,
  29021. column,
  29022. cell
  29023. } = params;
  29024. const validTip = $refs.refValidTooltip;
  29025. const content = rule.content;
  29026. validStore.visible = true;
  29027. if (validOpts.msgMode === 'single') {
  29028. this.validErrorMaps = {
  29029. [`${getRowid(this, row)}:${column.id}`]: {
  29030. column,
  29031. row,
  29032. rule,
  29033. content
  29034. }
  29035. };
  29036. } else {
  29037. this.validErrorMaps = Object.assign({}, validErrorMaps, {
  29038. [`${getRowid(this, row)}:${column.id}`]: {
  29039. column,
  29040. row,
  29041. rule,
  29042. content
  29043. }
  29044. });
  29045. }
  29046. $xeTable.dispatchEvent('valid-error', params, null);
  29047. if (validTip) {
  29048. if (validTip && (validOpts.message === 'tooltip' || validOpts.message === 'default' && !height && tableData.length < 2)) {
  29049. return validTip.open(cell, content);
  29050. }
  29051. }
  29052. return this.$nextTick();
  29053. }
  29054. }
  29055. });
  29056. ;// CONCATENATED MODULE: ./packages/table/module/custom/mixin.ts
  29057. function calcMaxHeight($xeTable) {
  29058. const $xeGantt = $xeTable.$xeGantt;
  29059. const reactData = $xeTable;
  29060. const {
  29061. customStore
  29062. } = reactData;
  29063. let wrapperEl = $xeTable.$refs.refElem;
  29064. // 判断面板不能大于表格高度
  29065. let tableHeight = 0;
  29066. if ($xeGantt) {
  29067. const ganttContainerElem = $xeGantt.$refs.refGanttContainerElem;
  29068. if (ganttContainerElem) {
  29069. wrapperEl = ganttContainerElem;
  29070. }
  29071. }
  29072. if (wrapperEl) {
  29073. tableHeight = wrapperEl.clientHeight - 28;
  29074. }
  29075. customStore.maxHeight = Math.max(88, tableHeight);
  29076. }
  29077. function emitCustomEvent($xeTable, type, evnt) {
  29078. const $xeGrid = $xeTable.$xeGrid;
  29079. const $xeGantt = $xeTable.$xeGantt;
  29080. const comp = $xeGrid || $xeGantt || $xeTable;
  29081. comp.dispatchEvent('custom', {
  29082. type
  29083. }, evnt);
  29084. }
  29085. /* harmony default export */ var custom_mixin = ({
  29086. methods: {
  29087. _getCustomVisible() {
  29088. const $xeTable = this;
  29089. const reactData = $xeTable;
  29090. const {
  29091. customStore
  29092. } = reactData;
  29093. return customStore.visible;
  29094. },
  29095. _openCustom() {
  29096. const $xeTable = this;
  29097. const reactData = $xeTable;
  29098. const {
  29099. initStore,
  29100. customStore
  29101. } = reactData;
  29102. customStore.visible = true;
  29103. initStore.custom = true;
  29104. $xeTable.handleUpdateCustomColumn();
  29105. $xeTable.checkCustomStatus();
  29106. calcMaxHeight($xeTable);
  29107. return $xeTable.$nextTick().then(() => calcMaxHeight($xeTable));
  29108. },
  29109. _closeCustom() {
  29110. const $xeTable = this;
  29111. const reactData = $xeTable;
  29112. const {
  29113. customStore
  29114. } = reactData;
  29115. const customOpts = $xeTable.computeCustomOpts;
  29116. if (customStore.visible) {
  29117. customStore.visible = false;
  29118. if (!customOpts.immediate) {
  29119. $xeTable.handleCustom();
  29120. }
  29121. }
  29122. return $xeTable.$nextTick();
  29123. },
  29124. _toggleCustom() {
  29125. const $xeTable = this;
  29126. const reactData = $xeTable;
  29127. const {
  29128. customStore
  29129. } = reactData;
  29130. if (customStore.visible) {
  29131. return $xeTable.closeCustom();
  29132. }
  29133. return $xeTable.openCustom();
  29134. },
  29135. _saveCustom() {
  29136. const $xeTable = this;
  29137. const reactData = $xeTable;
  29138. const internalData = $xeTable;
  29139. const {
  29140. customColumnList,
  29141. aggHandleFields,
  29142. rowGroupList
  29143. } = reactData;
  29144. const customOpts = $xeTable.computeCustomOpts;
  29145. const {
  29146. allowVisible,
  29147. allowSort,
  29148. allowFixed,
  29149. allowResizable,
  29150. allowGroup,
  29151. allowValues
  29152. } = customOpts;
  29153. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(customColumnList, (column, index, items, path, parentColumn) => {
  29154. if (parentColumn) {
  29155. // 更新子列信息
  29156. column.fixed = parentColumn.fixed;
  29157. } else {
  29158. if (allowSort) {
  29159. const sortIndex = index + 1;
  29160. column.renderSortNumber = sortIndex;
  29161. }
  29162. if (allowFixed) {
  29163. column.fixed = column.renderFixed;
  29164. }
  29165. }
  29166. if (allowResizable) {
  29167. if (column.renderVisible && (!column.children || column.children.length)) {
  29168. if (column.renderResizeWidth !== column.renderWidth) {
  29169. column.resizeWidth = column.renderResizeWidth;
  29170. column.renderWidth = column.renderResizeWidth;
  29171. }
  29172. }
  29173. }
  29174. if (allowVisible) {
  29175. column.visible = column.renderVisible;
  29176. }
  29177. if (allowGroup && allowValues) {
  29178. column.aggFunc = column.renderAggFn;
  29179. }
  29180. });
  29181. reactData.isCustomStatus = true;
  29182. if (allowGroup && allowValues && !!$xeTable.handlePivotTableAggregateData) {
  29183. if (rowGroupList.length !== aggHandleFields.length || rowGroupList.some((conf, i) => conf.field !== aggHandleFields[i])) {
  29184. // 更新数据分组
  29185. if (aggHandleFields.length) {
  29186. $xeTable.setRowGroups(aggHandleFields);
  29187. } else {
  29188. $xeTable.clearRowGroups();
  29189. }
  29190. } else if (allowValues) {
  29191. // 更新聚合函数
  29192. $xeTable.handleUpdateAggData();
  29193. }
  29194. }
  29195. if (allowSort) {
  29196. internalData.collectColumn = customColumnList;
  29197. }
  29198. return $xeTable.saveCustomStore('confirm');
  29199. },
  29200. _cancelCustom() {
  29201. const $xeTable = this;
  29202. const reactData = $xeTable;
  29203. const {
  29204. customColumnList,
  29205. customStore
  29206. } = reactData;
  29207. const {
  29208. oldSortMaps,
  29209. oldFixedMaps,
  29210. oldVisibleMaps
  29211. } = customStore;
  29212. const customOpts = $xeTable.computeCustomOpts;
  29213. const {
  29214. allowVisible,
  29215. allowSort,
  29216. allowFixed,
  29217. allowResizable
  29218. } = customOpts;
  29219. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(customColumnList, column => {
  29220. const colid = column.getKey();
  29221. const visible = !!oldVisibleMaps[colid];
  29222. const fixed = oldFixedMaps[colid] || '';
  29223. if (allowVisible) {
  29224. column.renderVisible = visible;
  29225. column.visible = visible;
  29226. }
  29227. if (allowFixed) {
  29228. column.renderFixed = fixed;
  29229. column.fixed = fixed;
  29230. }
  29231. if (allowSort) {
  29232. column.renderSortNumber = oldSortMaps[colid] || 0;
  29233. }
  29234. if (allowResizable) {
  29235. column.renderResizeWidth = column.renderWidth;
  29236. }
  29237. }, {
  29238. children: 'children'
  29239. });
  29240. return $xeTable.$nextTick();
  29241. },
  29242. _resetCustom(options) {
  29243. const $xeTable = this;
  29244. const reactData = $xeTable;
  29245. const internalData = $xeTable;
  29246. const {
  29247. rowGroupList
  29248. } = reactData;
  29249. const {
  29250. collectColumn
  29251. } = internalData;
  29252. const customOpts = $xeTable.computeCustomOpts;
  29253. const {
  29254. checkMethod
  29255. } = customOpts;
  29256. const opts = Object.assign({
  29257. visible: true,
  29258. resizable: options === true,
  29259. fixed: options === true,
  29260. sort: options === true,
  29261. aggFunc: options === true
  29262. }, options);
  29263. const allCols = [];
  29264. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(collectColumn, column => {
  29265. if (opts.resizable) {
  29266. column.resizeWidth = 0;
  29267. }
  29268. if (opts.fixed) {
  29269. column.fixed = column.defaultFixed;
  29270. }
  29271. if (opts.sort) {
  29272. column.renderSortNumber = column.sortNumber;
  29273. column.parentId = column.defaultParentId;
  29274. }
  29275. if (!checkMethod || checkMethod({
  29276. $table: $xeTable,
  29277. column
  29278. })) {
  29279. column.visible = column.defaultVisible;
  29280. }
  29281. if (opts.aggFunc) {
  29282. column.aggFunc = column.defaultAggFunc;
  29283. column.renderAggFn = column.defaultAggFunc;
  29284. }
  29285. column.renderResizeWidth = column.renderWidth;
  29286. allCols.push(column);
  29287. });
  29288. if (opts.sort) {
  29289. const newCollectCols = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toArrayTree(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().orderBy(allCols, 'renderSortNumber'), {
  29290. key: 'id',
  29291. parentKey: 'parentId',
  29292. children: 'children'
  29293. });
  29294. internalData.collectColumn = newCollectCols;
  29295. internalData.tableFullColumn = getColumnList(newCollectCols);
  29296. }
  29297. reactData.isCustomStatus = false;
  29298. return $xeTable.handleCustom().then(() => {
  29299. if (opts.aggFunc && $xeTable.handlePivotTableAggregateData) {
  29300. const rowGroupFields = $xeTable.computeRowGroupFields;
  29301. if (rowGroupFields ? rowGroupFields.length : rowGroupList.length) {
  29302. if (rowGroupFields && rowGroupFields.length) {
  29303. $xeTable.setRowGroups(rowGroupFields);
  29304. } else {
  29305. $xeTable.clearRowGroups();
  29306. }
  29307. } else {
  29308. $xeTable.handleUpdateAggData();
  29309. }
  29310. }
  29311. $xeTable.saveCustomStore('reset');
  29312. });
  29313. },
  29314. _toggleCustomAllCheckbox() {
  29315. const {
  29316. customStore
  29317. } = this;
  29318. const isAll = !customStore.isAll;
  29319. return this.setCustomAllCheckbox(isAll);
  29320. },
  29321. _setCustomAllCheckbox(checked) {
  29322. const $xeTable = this;
  29323. const reactData = $xeTable;
  29324. const {
  29325. customStore
  29326. } = reactData;
  29327. const {
  29328. customColumnList
  29329. } = reactData;
  29330. const customOpts = $xeTable.computeCustomOpts;
  29331. const {
  29332. checkMethod,
  29333. visibleMethod
  29334. } = customOpts;
  29335. const isAll = !!checked;
  29336. if (customOpts.immediate) {
  29337. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(customColumnList, column => {
  29338. if (visibleMethod && !visibleMethod({
  29339. $table: $xeTable,
  29340. column
  29341. })) {
  29342. return;
  29343. }
  29344. if (checkMethod && !checkMethod({
  29345. $table: $xeTable,
  29346. column
  29347. })) {
  29348. return;
  29349. }
  29350. column.visible = isAll;
  29351. column.renderVisible = isAll;
  29352. column.halfVisible = false;
  29353. });
  29354. customStore.isAll = isAll;
  29355. reactData.isCustomStatus = true;
  29356. $xeTable.handleCustom();
  29357. $xeTable.saveCustomStore('update:visible');
  29358. } else {
  29359. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(customColumnList, column => {
  29360. if (visibleMethod && !visibleMethod({
  29361. $table: $xeTable,
  29362. column
  29363. })) {
  29364. return;
  29365. }
  29366. if (checkMethod && !checkMethod({
  29367. $table: $xeTable,
  29368. column
  29369. })) {
  29370. return;
  29371. }
  29372. column.renderVisible = isAll;
  29373. column.halfVisible = false;
  29374. });
  29375. customStore.isAll = isAll;
  29376. }
  29377. $xeTable.checkCustomStatus();
  29378. },
  29379. checkCustomStatus() {
  29380. const $xeTable = this;
  29381. const reactData = $xeTable;
  29382. const internalData = $xeTable;
  29383. const {
  29384. customStore
  29385. } = reactData;
  29386. const {
  29387. collectColumn
  29388. } = internalData;
  29389. const customOpts = $xeTable.computeCustomOpts;
  29390. const {
  29391. checkMethod
  29392. } = customOpts;
  29393. customStore.isAll = collectColumn.every(column => (checkMethod ? !checkMethod({
  29394. $table: $xeTable,
  29395. column
  29396. }) : false) || column.renderVisible);
  29397. customStore.isIndeterminate = !customStore.isAll && collectColumn.some(column => (!checkMethod || checkMethod({
  29398. $table: $xeTable,
  29399. column
  29400. })) && (column.renderVisible || column.halfVisible));
  29401. },
  29402. emitCustomEvent(type, evnt) {
  29403. const $xeTable = this;
  29404. const $xeGrid = $xeTable.$xeGrid;
  29405. const $xeGantt = $xeTable.$xeGantt;
  29406. const comp = $xeGrid || $xeGantt || $xeTable;
  29407. comp.dispatchEvent('custom', {
  29408. type
  29409. }, evnt);
  29410. },
  29411. triggerCustomEvent(evnt) {
  29412. const $xeTable = this;
  29413. const reactData = $xeTable;
  29414. const {
  29415. customStore
  29416. } = reactData;
  29417. if (customStore.visible) {
  29418. this.closeCustom();
  29419. emitCustomEvent($xeTable, 'close', evnt);
  29420. } else {
  29421. customStore.btnEl = evnt.target;
  29422. this.openCustom();
  29423. emitCustomEvent($xeTable, 'open', evnt);
  29424. }
  29425. },
  29426. customOpenEvent(evnt) {
  29427. const $xeTable = this;
  29428. const reactData = $xeTable;
  29429. const {
  29430. customStore
  29431. } = reactData;
  29432. if (customStore.visible) {
  29433. customStore.activeBtn = true;
  29434. customStore.btnEl = evnt.target;
  29435. $xeTable.openCustom();
  29436. emitCustomEvent($xeTable, 'open', evnt);
  29437. }
  29438. },
  29439. customCloseEvent(evnt) {
  29440. const $xeTable = this;
  29441. const reactData = $xeTable;
  29442. const {
  29443. customStore
  29444. } = reactData;
  29445. if (customStore.visible) {
  29446. customStore.activeBtn = false;
  29447. $xeTable.closeCustom();
  29448. emitCustomEvent($xeTable, 'close', evnt);
  29449. }
  29450. },
  29451. handleUpdateCustomColumn() {
  29452. const $xeTable = this;
  29453. const reactData = $xeTable;
  29454. const internalData = $xeTable;
  29455. const {
  29456. customStore
  29457. } = reactData;
  29458. const {
  29459. collectColumn
  29460. } = internalData;
  29461. if (customStore.visible) {
  29462. const sortMaps = {};
  29463. const fixedMaps = {};
  29464. const visibleMaps = {};
  29465. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(collectColumn, column => {
  29466. const colid = column.getKey();
  29467. column.renderFixed = column.fixed;
  29468. column.renderVisible = column.visible;
  29469. column.renderResizeWidth = column.renderWidth;
  29470. sortMaps[colid] = column.renderSortNumber;
  29471. fixedMaps[colid] = column.fixed;
  29472. visibleMaps[colid] = column.visible;
  29473. });
  29474. customStore.oldSortMaps = sortMaps;
  29475. customStore.oldFixedMaps = fixedMaps;
  29476. customStore.oldVisibleMaps = visibleMaps;
  29477. reactData.customColumnList = collectColumn.slice(0);
  29478. }
  29479. }
  29480. }
  29481. });
  29482. ;// CONCATENATED MODULE: ./packages/table/src/table.ts
  29483. const {
  29484. getConfig: table_getConfig,
  29485. getIcon: table_getIcon,
  29486. getI18n: table_getI18n,
  29487. renderer: table_renderer,
  29488. globalResize: table_globalResize,
  29489. globalEvents: table_globalEvents,
  29490. globalMixins: table_globalMixins,
  29491. renderEmptyElement: table_renderEmptyElement
  29492. } = core_.VxeUI;
  29493. function handleUpdateMergeBodyCells($xeTable, merges) {
  29494. const internalData = $xeTable;
  29495. internalData.mergeBodyList = [];
  29496. internalData.mergeBodyMaps = {};
  29497. internalData.mergeBodyCellMaps = {};
  29498. $xeTable.setMergeCells(merges);
  29499. }
  29500. function handleUpdateMergeHeaderCells($xeTable, merges) {
  29501. const internalData = $xeTable;
  29502. internalData.mergeHeaderList = [];
  29503. internalData.mergeHeaderMaps = {};
  29504. internalData.mergeHeaderCellMaps = {};
  29505. $xeTable.setMergeHeaderCells(merges);
  29506. }
  29507. function handleUpdateMergeFooterCells($xeTable, merges) {
  29508. const internalData = $xeTable;
  29509. internalData.mergeFooterList = [];
  29510. internalData.mergeFooterMaps = {};
  29511. internalData.mergeFooterCellMaps = {};
  29512. $xeTable.setMergeFooterCells(merges);
  29513. }
  29514. function handleKeyField($xeTable) {
  29515. const internalData = $xeTable;
  29516. const keyField = $xeTable.computeRowField;
  29517. internalData.currKeyField = keyField;
  29518. internalData.isCurrDeepKey = hasDeepKey(keyField);
  29519. }
  29520. /**
  29521. * 渲染浮固定列
  29522. * 分别渲染左边固定列和右边固定列
  29523. * 如果宽度足够情况下,则不需要渲染固定列
  29524. */
  29525. function renderViewFixed(h, $xeTable, fixedType) {
  29526. const props = $xeTable;
  29527. const reactData = $xeTable;
  29528. const {
  29529. showHeader,
  29530. showFooter
  29531. } = props;
  29532. const {
  29533. tableData,
  29534. tableColumn,
  29535. tableGroupColumn,
  29536. columnStore,
  29537. footerTableData
  29538. } = reactData;
  29539. const scrollbarOpts = $xeTable.computeScrollbarOpts;
  29540. const scrollbarXOpts = $xeTable.computeScrollbarXOpts;
  29541. const scrollbarYOpts = $xeTable.computeScrollbarYOpts;
  29542. const {
  29543. overscrollBehavior: overscrollXBehavior
  29544. } = scrollbarXOpts;
  29545. const {
  29546. overscrollBehavior: overscrollYBehavior
  29547. } = scrollbarYOpts;
  29548. const isFixedLeft = fixedType === 'left';
  29549. const fixedColumn = isFixedLeft ? columnStore.leftList : columnStore.rightList;
  29550. const osXBehavior = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(overscrollXBehavior) ? scrollbarOpts.overscrollBehavior : overscrollXBehavior;
  29551. const osYBehavior = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(overscrollYBehavior) ? scrollbarOpts.overscrollBehavior : overscrollYBehavior;
  29552. return h('div', {
  29553. ref: isFixedLeft ? 'refLeftContainer' : 'refRightContainer',
  29554. class: [`vxe-table--fixed-${fixedType}-wrapper`, `sx--${scrollbarXOpts.visible}`, `sy--${scrollbarYOpts.visible}`, {
  29555. [`x-ob--${osXBehavior}`]: osXBehavior,
  29556. [`y-ob--${osYBehavior}`]: osYBehavior
  29557. }]
  29558. }, [showHeader ? h(header, {
  29559. props: {
  29560. fixedType,
  29561. tableData,
  29562. tableColumn,
  29563. tableGroupColumn,
  29564. fixedColumn
  29565. },
  29566. ref: `${fixedType}Header`
  29567. }) : table_renderEmptyElement($xeTable), h(body, {
  29568. props: {
  29569. fixedType,
  29570. tableData,
  29571. tableColumn,
  29572. fixedColumn
  29573. },
  29574. ref: `${fixedType}Body`
  29575. }), showFooter ? h(footer, {
  29576. props: {
  29577. footerTableData,
  29578. tableColumn,
  29579. fixedColumn,
  29580. fixedType
  29581. },
  29582. ref: `${fixedType}Footer`
  29583. }) : table_renderEmptyElement($xeTable)]);
  29584. }
  29585. function renderEmptyBody(h, $xeTable) {
  29586. const slots = $xeTable.$scopedSlots;
  29587. const $xeGrid = $xeTable.$xeGrid;
  29588. const $xeGantt = $xeTable.$xeGantt;
  29589. const emptyOpts = $xeTable.computeEmptyOpts;
  29590. const emptySlot = slots.empty;
  29591. let emptyContent = '';
  29592. const emptyParams = {
  29593. $table: $xeTable,
  29594. $grid: $xeGrid,
  29595. $gantt: $xeGantt
  29596. };
  29597. if (emptySlot) {
  29598. emptyContent = emptySlot.call($xeTable, emptyParams);
  29599. } else {
  29600. const compConf = emptyOpts.name ? table_renderer.get(emptyOpts.name) : null;
  29601. const rtEmptyView = compConf ? compConf.renderTableEmpty || compConf.renderTableEmptyView || compConf.renderEmpty : null;
  29602. if (rtEmptyView) {
  29603. emptyContent = getSlotVNs(rtEmptyView.call($xeTable, h, emptyOpts, emptyParams));
  29604. } else {
  29605. emptyContent = getFuncText($xeTable.emptyText) || table_getI18n('vxe.table.emptyText');
  29606. }
  29607. }
  29608. return emptyContent;
  29609. }
  29610. const renderDragTipContents = (h, $xeTable) => {
  29611. const props = $xeTable;
  29612. const reactData = $xeTable;
  29613. const crossTableDragRowInfo = getCrossTableDragRowInfo($xeTable);
  29614. const {
  29615. dragConfig
  29616. } = props;
  29617. const {
  29618. dragRow,
  29619. dragCol,
  29620. dragTipText
  29621. } = reactData;
  29622. const columnDragOpts = $xeTable.computeColumnDragOpts;
  29623. const rowDragOpts = $xeTable.computeRowDragOpts;
  29624. const rowDragSlots = rowDragOpts.slots || {};
  29625. const rTipSlot = rowDragSlots.tip || (dragConfig && dragConfig.slots ? dragConfig.slots.rowTip : null);
  29626. const columnDragSlots = columnDragOpts.slots || {};
  29627. const cTipSlot = columnDragSlots.tip;
  29628. const dRow = dragRow || (rowDragOpts.isCrossTableDrag ? crossTableDragRowInfo.row : null);
  29629. if (dRow && rTipSlot) {
  29630. return $xeTable.callSlot(rTipSlot, {
  29631. row: dRow
  29632. }, h);
  29633. }
  29634. if (dragCol && cTipSlot) {
  29635. return $xeTable.callSlot(cTipSlot, {
  29636. column: dragCol
  29637. }, h);
  29638. }
  29639. return [h('span', dragTipText)];
  29640. };
  29641. const table_renderDragTip = (h, $xeTable) => {
  29642. const reactData = $xeTable;
  29643. const crossTableDragRowInfo = getCrossTableDragRowInfo($xeTable);
  29644. const {
  29645. dragRow,
  29646. dragCol
  29647. } = reactData;
  29648. const rowOpts = $xeTable.computeRowOpts;
  29649. const columnOpts = $xeTable.computeColumnOpts;
  29650. const rowDragOpts = $xeTable.computeRowDragOpts;
  29651. const columnDragOpts = $xeTable.computeColumnDragOpts;
  29652. const dRow = dragRow || (rowDragOpts.isCrossTableDrag ? crossTableDragRowInfo.row : null);
  29653. if (rowOpts.drag || columnOpts.drag) {
  29654. return h('div', {
  29655. class: 'vxe-table--drag-wrapper'
  29656. }, [h('div', {
  29657. ref: 'refDragRowLineElem',
  29658. class: ['vxe-table--drag-row-line', {
  29659. 'is--guides': rowDragOpts.showGuidesStatus
  29660. }]
  29661. }), h('div', {
  29662. ref: 'refDragColLineElem',
  29663. class: ['vxe-table--drag-col-line', {
  29664. 'is--guides': columnDragOpts.showGuidesStatus
  29665. }]
  29666. }), dRow && rowDragOpts.showDragTip || dragCol && columnDragOpts.showDragTip ? h('div', {
  29667. ref: 'refDragTipElem',
  29668. class: 'vxe-table--drag-sort-tip'
  29669. }, [h('div', {
  29670. class: 'vxe-table--drag-sort-tip-wrapper'
  29671. }, [h('div', {
  29672. class: 'vxe-table--drag-sort-tip-status'
  29673. }, [h('span', {
  29674. class: ['vxe-table--drag-sort-tip-normal-status', dRow ? table_getIcon().TABLE_DRAG_STATUS_ROW : table_getIcon().TABLE_DRAG_STATUS_COLUMN]
  29675. }), h('span', {
  29676. class: ['vxe-table--drag-sort-tip-sub-status', table_getIcon().TABLE_DRAG_STATUS_SUB_ROW]
  29677. }), h('span', {
  29678. class: ['vxe-table--drag-sort-tip-disabled-status', table_getIcon().TABLE_DRAG_DISABLED]
  29679. })]), h('div', {
  29680. class: 'vxe-table--drag-sort-tip-content'
  29681. }, renderDragTipContents(h, $xeTable))])]) : table_renderEmptyElement($xeTable)]);
  29682. }
  29683. return table_renderEmptyElement($xeTable);
  29684. };
  29685. function handleUpdateResize($xeTable) {
  29686. const el = $xeTable.$refs.refElem;
  29687. if (el && el.clientWidth && el.clientHeight) {
  29688. $xeTable.recalculate();
  29689. }
  29690. }
  29691. function renderRowExpandedVNs(h, $xeTable) {
  29692. const props = $xeTable;
  29693. const reactData = $xeTable;
  29694. const internalData = $xeTable;
  29695. const $xeGrid = $xeTable.$xeGrid;
  29696. const $xeGantt = $xeTable.$xeGantt;
  29697. const {
  29698. treeConfig
  29699. } = props;
  29700. const {
  29701. expandColumn,
  29702. isRowGroupStatus
  29703. } = reactData;
  29704. const tableRowExpandedList = $xeTable.computeTableRowExpandedList;
  29705. const expandOpts = $xeTable.computeExpandOpts;
  29706. const {
  29707. mode
  29708. } = expandOpts;
  29709. if (mode !== 'fixed') {
  29710. return table_renderEmptyElement($xeTable);
  29711. }
  29712. const expandVNs = [h('div', {
  29713. key: 'repY',
  29714. ref: 'refRowExpandYSpaceElem'
  29715. })];
  29716. if (expandColumn) {
  29717. const {
  29718. handleGetRowId
  29719. } = createHandleGetRowId($xeTable);
  29720. tableRowExpandedList.forEach(row => {
  29721. const expandOpts = $xeTable.computeExpandOpts;
  29722. const {
  29723. height: expandHeight,
  29724. padding,
  29725. indent
  29726. } = expandOpts;
  29727. const {
  29728. fullAllDataRowIdData,
  29729. fullColumnIdData
  29730. } = internalData;
  29731. const treeOpts = $xeTable.computeTreeOpts;
  29732. const {
  29733. transform,
  29734. seqMode
  29735. } = treeOpts;
  29736. const cellStyle = {};
  29737. const rowid = handleGetRowId(row);
  29738. const rowRest = fullAllDataRowIdData[rowid];
  29739. const colid = expandColumn.id;
  29740. const colRest = fullColumnIdData[colid] || {};
  29741. let rowLevel = 0;
  29742. let seq = -1;
  29743. let _rowIndex = -1;
  29744. let rowIndex = -1;
  29745. let $rowIndex = -1;
  29746. if (rowRest) {
  29747. rowIndex = rowRest.index;
  29748. $rowIndex = rowRest.$index;
  29749. _rowIndex = rowRest._index;
  29750. rowLevel = rowRest.level;
  29751. seq = rowRest.seq;
  29752. if (isRowGroupStatus || treeConfig && transform && seqMode === 'increasing') {
  29753. seq = rowRest._index + 1;
  29754. } else if (treeConfig && seqMode === 'fixed') {
  29755. seq = rowRest._tIndex + 1;
  29756. }
  29757. }
  29758. if (expandHeight) {
  29759. cellStyle.height = `${expandHeight}px`;
  29760. }
  29761. if (isRowGroupStatus || treeConfig) {
  29762. cellStyle.paddingLeft = `${rowLevel * (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(indent) ? indent : treeOpts.indent) + 30}px`;
  29763. }
  29764. let columnIndex = -1;
  29765. let $columnIndex = -1;
  29766. let _columnIndex = -1;
  29767. if (colRest) {
  29768. columnIndex = colRest.index;
  29769. $columnIndex = colRest.$index;
  29770. _columnIndex = colRest._index;
  29771. }
  29772. const expandParams = {
  29773. $table: $xeTable,
  29774. $grid: $xeGrid,
  29775. $gantt: $xeGantt,
  29776. seq,
  29777. column: expandColumn,
  29778. columnIndex,
  29779. $columnIndex,
  29780. _columnIndex,
  29781. fixed: '',
  29782. source: 'table',
  29783. type: 'body',
  29784. level: rowLevel,
  29785. rowid,
  29786. row,
  29787. rowIndex,
  29788. $rowIndex,
  29789. _rowIndex,
  29790. isHidden: false,
  29791. isEdit: false,
  29792. visibleData: [],
  29793. data: [],
  29794. items: []
  29795. };
  29796. expandVNs.push(h('div', {
  29797. key: rowid,
  29798. class: ['vxe-body--row-expanded-cell', {
  29799. 'is--padding': padding,
  29800. 'is--ellipsis': expandHeight
  29801. }],
  29802. attrs: {
  29803. rowid
  29804. },
  29805. style: cellStyle
  29806. }, expandColumn.renderData(h, expandParams)));
  29807. });
  29808. }
  29809. return h('div', {
  29810. ref: 'refRowExpandElem',
  29811. class: 'vxe-table--row-expanded-wrapper'
  29812. }, expandVNs);
  29813. }
  29814. function renderScrollX(h, $xeTable) {
  29815. return h('div', {
  29816. key: 'vsx',
  29817. ref: 'refScrollXVirtualElem',
  29818. class: 'vxe-table--scroll-x-virtual'
  29819. }, [h('div', {
  29820. ref: 'refScrollXLeftCornerElem',
  29821. class: 'vxe-table--scroll-x-left-corner'
  29822. }), h('div', {
  29823. ref: 'refScrollXWrapperElem',
  29824. class: 'vxe-table--scroll-x-wrapper'
  29825. }, [h('div', {
  29826. ref: 'refScrollXHandleElem',
  29827. class: 'vxe-table--scroll-x-handle',
  29828. on: {
  29829. scroll: $xeTable.triggerVirtualScrollXEvent
  29830. }
  29831. }, [h('div', {
  29832. ref: 'refScrollXSpaceElem',
  29833. class: 'vxe-table--scroll-x-space'
  29834. })]), h('div', {
  29835. class: 'vxe-table--scroll-x-handle-appearance'
  29836. })]), h('div', {
  29837. ref: 'refScrollXRightCornerElem',
  29838. class: 'vxe-table--scroll-x-right-corner'
  29839. })]);
  29840. }
  29841. function renderScrollY(h, $xeTable) {
  29842. return h('div', {
  29843. ref: 'refScrollYVirtualElem',
  29844. class: 'vxe-table--scroll-y-virtual'
  29845. }, [h('div', {
  29846. ref: 'refScrollYTopCornerElem',
  29847. class: 'vxe-table--scroll-y-top-corner'
  29848. }), h('div', {
  29849. ref: 'refScrollYWrapperElem',
  29850. class: 'vxe-table--scroll-y-wrapper'
  29851. }, [h('div', {
  29852. ref: 'refScrollYHandleElem',
  29853. class: 'vxe-table--scroll-y-handle',
  29854. on: {
  29855. scroll: $xeTable.triggerVirtualScrollYEvent
  29856. }
  29857. }, [h('div', {
  29858. ref: 'refScrollYSpaceElem',
  29859. class: 'vxe-table--scroll-y-space'
  29860. })])]), h('div', {
  29861. ref: 'refScrollYBottomCornerElem',
  29862. class: 'vxe-table--scroll-y-bottom-corner'
  29863. })]);
  29864. }
  29865. function renderViewport(h, $xeTable) {
  29866. const props = $xeTable;
  29867. const reactData = $xeTable;
  29868. const {
  29869. showHeader,
  29870. showFooter
  29871. } = props;
  29872. const {
  29873. overflowX,
  29874. tableData,
  29875. tableColumn,
  29876. tableGroupColumn,
  29877. footerTableData,
  29878. columnStore
  29879. } = reactData;
  29880. const scrollbarOpts = $xeTable.computeScrollbarOpts;
  29881. const scrollbarXOpts = $xeTable.computeScrollbarXOpts;
  29882. const scrollbarYOpts = $xeTable.computeScrollbarYOpts;
  29883. const {
  29884. overscrollBehavior: overscrollXBehavior
  29885. } = scrollbarXOpts;
  29886. const {
  29887. overscrollBehavior: overscrollYBehavior
  29888. } = scrollbarYOpts;
  29889. const {
  29890. leftList,
  29891. rightList
  29892. } = columnStore;
  29893. const osXBehavior = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(overscrollXBehavior) ? scrollbarOpts.overscrollBehavior : overscrollXBehavior;
  29894. const osYBehavior = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(overscrollYBehavior) ? scrollbarOpts.overscrollBehavior : overscrollYBehavior;
  29895. return h('div', {
  29896. ref: 'refTableViewportElem',
  29897. class: ['vxe-table--viewport-wrapper', {
  29898. [`x-ob--${osXBehavior}`]: osXBehavior,
  29899. [`y-ob--${osYBehavior}`]: osYBehavior
  29900. }]
  29901. }, [h('div', {
  29902. class: ['vxe-table--main-wrapper', `sx--${scrollbarXOpts.visible}`, `sy--${scrollbarYOpts.visible}`]
  29903. }, [
  29904. /**
  29905. * 表头
  29906. */
  29907. showHeader ? h(header, {
  29908. ref: 'refTableHeader',
  29909. props: {
  29910. tableData,
  29911. tableColumn,
  29912. tableGroupColumn
  29913. }
  29914. }) : table_renderEmptyElement($xeTable),
  29915. /**
  29916. * 表体
  29917. */
  29918. h(body, {
  29919. ref: 'refTableBody',
  29920. props: {
  29921. tableData,
  29922. tableColumn
  29923. }
  29924. }),
  29925. /**
  29926. * 表尾
  29927. */
  29928. showFooter ? h(footer, {
  29929. ref: 'refTableFooter',
  29930. props: {
  29931. footerTableData,
  29932. tableColumn
  29933. }
  29934. }) : table_renderEmptyElement($xeTable)]), h('div', {
  29935. class: 'vxe-table--fixed-wrapper'
  29936. }, [leftList && leftList.length && overflowX ? renderViewFixed(h, $xeTable, 'left') : table_renderEmptyElement($xeTable), rightList && rightList.length && overflowX ? renderViewFixed(h, $xeTable, 'right') : table_renderEmptyElement($xeTable)]), renderRowExpandedVNs(h, $xeTable)]);
  29937. }
  29938. function renderBody(h, $xeTable) {
  29939. const scrollbarYToLeft = $xeTable.computeScrollbarYToLeft;
  29940. return h('div', {
  29941. class: 'vxe-table--layout-wrapper'
  29942. }, scrollbarYToLeft ? [renderScrollY(h, $xeTable), renderViewport(h, $xeTable)] : [renderViewport(h, $xeTable), renderScrollY(h, $xeTable)]);
  29943. }
  29944. /* harmony default export */ var table = ({
  29945. name: 'VxeTable',
  29946. mixins: [table_globalMixins.sizeMixin, mixin, menu_mixin, edit_mixin, export_mixin, keyboard_mixin, validator_mixin, custom_mixin],
  29947. props: tableProps,
  29948. provide() {
  29949. return {
  29950. $xeTable: this,
  29951. xecolgroup: null
  29952. };
  29953. },
  29954. inject: {
  29955. $xeTabs: {
  29956. default: null
  29957. },
  29958. $xeGrid: {
  29959. default: null
  29960. },
  29961. $xeGantt: {
  29962. default: null
  29963. }
  29964. },
  29965. data() {
  29966. const xID = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().uniqueId();
  29967. const reactData = {
  29968. // 低性能的静态列
  29969. staticColumns: [],
  29970. // 渲染的列分组
  29971. tableGroupColumn: [],
  29972. // 可视区渲染的列
  29973. tableColumn: [],
  29974. // 渲染中的数据
  29975. tableData: [],
  29976. // 是否启用了横向 X 可视渲染方式加载
  29977. scrollXLoad: false,
  29978. // 是否启用了纵向 Y 可视渲染方式加载
  29979. scrollYLoad: false,
  29980. // 是否存在纵向滚动条
  29981. overflowY: true,
  29982. // 是否存在横向滚动条
  29983. overflowX: false,
  29984. // 纵向滚动条的宽度
  29985. scrollbarWidth: 0,
  29986. // 横向滚动条的高度
  29987. scrollbarHeight: 0,
  29988. // 最后滚动时间戳
  29989. lastScrollTime: 0,
  29990. // 行高
  29991. rowHeight: 0,
  29992. // 表格父容器的高度
  29993. parentHeight: 0,
  29994. // 是否使用分组表头
  29995. isGroup: false,
  29996. isAllOverflow: false,
  29997. // 复选框属性,是否全选
  29998. isAllSelected: false,
  29999. // 复选框属性,有选中且非全选状态
  30000. isIndeterminate: false,
  30001. // 当前行
  30002. currentRow: null,
  30003. // 单选框属性,选中列
  30004. currentColumn: null,
  30005. // 单选框属性,选中行
  30006. selectRadioRow: null,
  30007. // 表尾合计数据
  30008. footerTableData: [],
  30009. // 行分组列信息
  30010. rowGroupColumn: null,
  30011. // 展开列信息
  30012. expandColumn: null,
  30013. checkboxColumn: null,
  30014. radioColumn: null,
  30015. // 树节点列信息
  30016. treeNodeColumn: null,
  30017. hasFixedColumn: false,
  30018. // 刷新列标识,当列筛选被改变时,触发表格刷新数据
  30019. upDataFlag: 0,
  30020. // 刷新列标识,当列的特定属性被改变时,触发表格刷新列
  30021. reColumnFlag: 0,
  30022. // 初始化标识
  30023. initStore: {
  30024. filter: false,
  30025. import: false,
  30026. export: false,
  30027. custom: false
  30028. },
  30029. // 自定义列相关的信息
  30030. customStore: {
  30031. btnEl: null,
  30032. isAll: false,
  30033. isIndeterminate: false,
  30034. activeBtn: false,
  30035. activeWrapper: false,
  30036. visible: false,
  30037. maxHeight: 0,
  30038. oldSortMaps: {},
  30039. oldFixedMaps: {},
  30040. oldVisibleMaps: {}
  30041. },
  30042. customColumnList: [],
  30043. // 当前选中的筛选列
  30044. filterStore: {
  30045. isAllSelected: false,
  30046. isIndeterminate: false,
  30047. style: null,
  30048. column: null,
  30049. visible: false,
  30050. maxHeight: null
  30051. },
  30052. // 存放列相关的信息
  30053. columnStore: {
  30054. leftList: [],
  30055. centerList: [],
  30056. rightList: [],
  30057. resizeList: [],
  30058. pxList: [],
  30059. pxMinList: [],
  30060. autoMinList: [],
  30061. scaleList: [],
  30062. scaleMinList: [],
  30063. autoList: [],
  30064. remainList: []
  30065. },
  30066. // 存放快捷菜单的信息
  30067. ctxMenuStore: {
  30068. selected: null,
  30069. visible: false,
  30070. showChild: false,
  30071. selectChild: null,
  30072. list: [],
  30073. style: null
  30074. },
  30075. // 存放可编辑相关信息
  30076. editStore: {
  30077. indexs: {
  30078. columns: []
  30079. },
  30080. titles: {
  30081. columns: []
  30082. },
  30083. // 选中源
  30084. selected: {
  30085. row: null,
  30086. column: null
  30087. },
  30088. // 已复制源
  30089. copyed: {
  30090. cut: false,
  30091. rows: [],
  30092. columns: []
  30093. },
  30094. // 激活
  30095. actived: {
  30096. row: null,
  30097. column: null
  30098. },
  30099. // 当前被强制聚焦单元格,只会在鼠标点击后算聚焦
  30100. focused: {
  30101. row: null,
  30102. column: null
  30103. }
  30104. },
  30105. // 存放 tooltip 相关信息
  30106. tooltipStore: {
  30107. row: null,
  30108. column: null,
  30109. content: null,
  30110. visible: false,
  30111. type: null,
  30112. currOpts: {}
  30113. },
  30114. // 存放数据校验相关信息
  30115. validStore: {
  30116. visible: false
  30117. },
  30118. validErrorMaps: {},
  30119. // 导入相关信息
  30120. importStore: {
  30121. inited: false,
  30122. file: null,
  30123. type: '',
  30124. modeList: [],
  30125. typeList: [],
  30126. filename: '',
  30127. visible: false
  30128. },
  30129. importParams: {
  30130. mode: '',
  30131. types: null,
  30132. message: true
  30133. },
  30134. // 导出相关信息
  30135. exportStore: {
  30136. inited: false,
  30137. name: '',
  30138. modeList: [],
  30139. typeList: [],
  30140. columns: [],
  30141. isPrint: false,
  30142. hasFooter: false,
  30143. hasMerge: false,
  30144. hasTree: false,
  30145. hasColgroup: false,
  30146. visible: false
  30147. },
  30148. exportParams: {
  30149. filename: '',
  30150. sheetName: '',
  30151. mode: '',
  30152. type: '',
  30153. isColgroup: false,
  30154. isMerge: false,
  30155. isAllExpand: false,
  30156. useStyle: false,
  30157. original: false,
  30158. message: true,
  30159. isHeader: false,
  30160. isTitle: false,
  30161. isFooter: false
  30162. },
  30163. visiblwRowsFlag: 1,
  30164. isRowGroupStatus: false,
  30165. rowGroupList: [],
  30166. aggHandleFields: [],
  30167. aggHandleAggColumns: [],
  30168. rowGroupExpandedFlag: 1,
  30169. rowExpandedFlag: 1,
  30170. treeExpandedFlag: 1,
  30171. updateCheckboxFlag: 1,
  30172. pendingRowFlag: 1,
  30173. insertRowFlag: 1,
  30174. removeRowFlag: 1,
  30175. mergeHeadFlag: 1,
  30176. mergeBodyFlag: 1,
  30177. mergeFootFlag: 1,
  30178. rowHeightStore: {
  30179. large: 52,
  30180. default: 48,
  30181. medium: 44,
  30182. small: 40,
  30183. mini: 36
  30184. },
  30185. scrollVMLoading: false,
  30186. scrollYHeight: 0,
  30187. scrollYTop: 0,
  30188. isScrollYBig: false,
  30189. scrollXLeft: 0,
  30190. scrollXWidth: 0,
  30191. isScrollXBig: false,
  30192. lazScrollLoading: false,
  30193. rowExpandHeightFlag: 1,
  30194. calcCellHeightFlag: 1,
  30195. resizeHeightFlag: 1,
  30196. resizeWidthFlag: 1,
  30197. isCustomStatus: false,
  30198. isCrossDragRow: false,
  30199. dragRow: null,
  30200. isCrossDragCol: false,
  30201. dragCol: null,
  30202. dragTipText: '',
  30203. isDragResize: false,
  30204. isRowLoading: false,
  30205. isColLoading: false
  30206. };
  30207. return {
  30208. xID,
  30209. ...reactData,
  30210. // 私有属性
  30211. reScrollFlag: 0,
  30212. reLayoutFlag: 0,
  30213. footFlag: 0,
  30214. mergeFooteCellFlag: 0,
  30215. crossTableDragRowInfo: crossTableDragRowGlobal
  30216. };
  30217. },
  30218. computed: {
  30219. ...{},
  30220. tableId() {
  30221. return this.computeTableId;
  30222. },
  30223. computeTableId() {
  30224. const $xeTable = this;
  30225. const props = $xeTable;
  30226. const $xeGrid = $xeTable.$xeGrid;
  30227. const $xeGantt = $xeTable.$xeGantt;
  30228. const {
  30229. id
  30230. } = props;
  30231. if (id) {
  30232. if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(id)) {
  30233. return `${id({
  30234. $table: $xeTable,
  30235. $grid: $xeGrid,
  30236. $gantt: $xeGantt
  30237. }) || ''}`;
  30238. }
  30239. return `${id}`;
  30240. }
  30241. return '';
  30242. },
  30243. computeRowField() {
  30244. const $xeTable = this;
  30245. const props = $xeTable;
  30246. const rowOpts = $xeTable.computeRowOpts;
  30247. return `${props.rowId || rowOpts.keyField || '_X_ROW_KEY'}`;
  30248. },
  30249. validOpts() {
  30250. return this.computeValidOpts;
  30251. },
  30252. computeValidOpts() {
  30253. const $xeTable = this;
  30254. const props = $xeTable;
  30255. return Object.assign({}, table_getConfig().table.validConfig, props.validConfig);
  30256. },
  30257. sXOpts() {
  30258. return this.computeVirtualXOpts;
  30259. },
  30260. computeSXOpts() {
  30261. return this.computeVirtualXOpts;
  30262. },
  30263. computeScrollXThreshold() {
  30264. const $xeTable = this;
  30265. const virtualXOpts = $xeTable.computeVirtualXOpts;
  30266. const {
  30267. threshold
  30268. } = virtualXOpts;
  30269. if (threshold) {
  30270. return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(threshold);
  30271. }
  30272. return 0;
  30273. },
  30274. sYOpts() {
  30275. return this.computeVirtualYOpts;
  30276. },
  30277. computeSYOpts() {
  30278. return this.computeVirtualYOpts;
  30279. },
  30280. computeVirtualXOpts() {
  30281. const $xeTable = this;
  30282. const props = $xeTable;
  30283. const {
  30284. virtualXConfig,
  30285. scrollX
  30286. } = props;
  30287. const globalVirtualXConfig = table_getConfig().table.virtualXConfig;
  30288. const globalScrollX = table_getConfig().table.scrollX;
  30289. if (virtualXConfig) {
  30290. return Object.assign({}, globalVirtualXConfig, virtualXConfig);
  30291. }
  30292. if (scrollX) {
  30293. // 已废弃,保留兼容
  30294. return Object.assign({}, globalScrollX, scrollX);
  30295. }
  30296. if (globalVirtualXConfig) {
  30297. return Object.assign({}, globalVirtualXConfig, virtualXConfig);
  30298. }
  30299. // 已废弃,保留兼容
  30300. return Object.assign({}, globalScrollX, scrollX);
  30301. },
  30302. computeVirtualYOpts() {
  30303. const $xeTable = this;
  30304. const props = $xeTable;
  30305. const {
  30306. virtualYConfig,
  30307. scrollY
  30308. } = props;
  30309. const globalVirtualYConfig = table_getConfig().table.virtualYConfig;
  30310. const globalScrollY = table_getConfig().table.scrollY;
  30311. if (virtualYConfig) {
  30312. return Object.assign({}, globalVirtualYConfig, virtualYConfig);
  30313. }
  30314. if (scrollY) {
  30315. // 已废弃,保留兼容
  30316. return Object.assign({}, globalScrollY, scrollY);
  30317. }
  30318. if (globalVirtualYConfig) {
  30319. return Object.assign({}, globalVirtualYConfig, virtualYConfig);
  30320. }
  30321. // 已废弃,保留兼容
  30322. return Object.assign({}, globalScrollY, scrollY);
  30323. },
  30324. computeScrollbarOpts() {
  30325. const $xeTable = this;
  30326. const props = $xeTable;
  30327. return Object.assign({}, table_getConfig().table.scrollbarConfig, props.scrollbarConfig);
  30328. },
  30329. computeScrollbarXOpts() {
  30330. const $xeTable = this;
  30331. const props = $xeTable;
  30332. const scrollbarOpts = $xeTable.computeScrollbarOpts;
  30333. return Object.assign({}, scrollbarOpts.x, props.scrollbarConfig?.x || {});
  30334. },
  30335. computeScrollbarYOpts() {
  30336. const $xeTable = this;
  30337. const props = $xeTable;
  30338. const scrollbarOpts = $xeTable.computeScrollbarOpts;
  30339. return Object.assign({}, scrollbarOpts.y, props.scrollbarConfig?.y || {});
  30340. },
  30341. computeScrollbarXToTop() {
  30342. const $xeTable = this;
  30343. const scrollbarXOpts = $xeTable.computeScrollbarXOpts;
  30344. return scrollbarXOpts.position === 'top';
  30345. },
  30346. computeScrollbarYToLeft() {
  30347. const $xeTable = this;
  30348. const scrollbarYOpts = $xeTable.computeScrollbarYOpts;
  30349. return scrollbarYOpts.position === 'left';
  30350. },
  30351. computeScrollYThreshold() {
  30352. const $xeTable = this;
  30353. const virtualYOpts = $xeTable.computeVirtualYOpts;
  30354. const {
  30355. threshold
  30356. } = virtualYOpts;
  30357. if (threshold) {
  30358. return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(threshold);
  30359. }
  30360. return 0;
  30361. },
  30362. rowHeightMaps() {
  30363. return this.computeRowHeightMaps;
  30364. },
  30365. computeRowHeightMaps() {
  30366. const $xeTable = this;
  30367. const reactData = $xeTable;
  30368. return reactData.rowHeightStore;
  30369. },
  30370. computeDefaultRowHeight() {
  30371. const $xeTable = this;
  30372. const vSize = $xeTable.computeSize;
  30373. const rowHeightMaps = $xeTable.computeRowHeightMaps;
  30374. return rowHeightMaps[vSize || 'default'] || 18;
  30375. },
  30376. columnOpts() {
  30377. return this.computeColumnOpts;
  30378. },
  30379. computeColumnOpts() {
  30380. const $xeTable = this;
  30381. const props = $xeTable;
  30382. return Object.assign({}, table_getConfig().table.columnConfig, props.columnConfig);
  30383. },
  30384. computeCurrentColumnOpts() {
  30385. const $xeTable = this;
  30386. const props = $xeTable;
  30387. return Object.assign({}, table_getConfig().table.currentColumnConfig, props.currentColumnConfig);
  30388. },
  30389. computeCellOpts() {
  30390. const $xeTable = this;
  30391. const props = $xeTable;
  30392. const cellOpts = Object.assign({}, table_getConfig().table.cellConfig, props.cellConfig);
  30393. if (cellOpts.height) {
  30394. cellOpts.height = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(cellOpts.height);
  30395. }
  30396. return cellOpts;
  30397. },
  30398. computeHeaderCellOpts() {
  30399. const $xeTable = this;
  30400. const $xeGantt = $xeTable.$xeGantt;
  30401. const props = $xeTable;
  30402. const headerCellOpts = Object.assign({}, table_getConfig().table.headerCellConfig, props.headerCellConfig);
  30403. const defaultRowHeight = $xeTable.computeDefaultRowHeight;
  30404. const cellOpts = $xeTable.computeCellOpts;
  30405. let headCellHeight = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(getCalcHeight(headerCellOpts.height || cellOpts.height));
  30406. if ($xeGantt) {
  30407. const taskScaleConfs = $xeGantt.computeTaskScaleConfs;
  30408. if (taskScaleConfs && taskScaleConfs.length > 2) {
  30409. const ganttMinHeadCellHeight = defaultRowHeight / 2 * taskScaleConfs.length;
  30410. headCellHeight = Math.max(ganttMinHeadCellHeight, headCellHeight);
  30411. }
  30412. }
  30413. headerCellOpts.height = headCellHeight;
  30414. return headerCellOpts;
  30415. },
  30416. computeFooterCellOpts() {
  30417. const $xeTable = this;
  30418. const props = $xeTable;
  30419. const footerCellOpts = Object.assign({}, table_getConfig().table.footerCellConfig, props.footerCellConfig);
  30420. const cellOpts = $xeTable.computeCellOpts;
  30421. footerCellOpts.height = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(getCalcHeight(footerCellOpts.height || cellOpts.height));
  30422. return footerCellOpts;
  30423. },
  30424. rowOpts() {
  30425. return this.computeRowOpts;
  30426. },
  30427. computeRowOpts() {
  30428. const $xeTable = this;
  30429. const props = $xeTable;
  30430. return Object.assign({}, table_getConfig().table.rowConfig, props.rowConfig);
  30431. },
  30432. computeAggregateOpts() {
  30433. const $xeTable = this;
  30434. const props = $xeTable;
  30435. return Object.assign({}, table_getConfig().table.aggregateConfig || table_getConfig().table.rowGroupConfig, props.aggregateConfig || props.rowGroupConfig);
  30436. },
  30437. computeRowGroupOpts() {
  30438. const $xeTable = this;
  30439. return $xeTable.computeAggregateOpts;
  30440. },
  30441. computeCurrentRowOpts() {
  30442. const $xeTable = this;
  30443. const props = $xeTable;
  30444. return Object.assign({}, table_getConfig().table.currentRowConfig, props.currentRowConfig);
  30445. },
  30446. computeRowDragOpts() {
  30447. const $xeTable = this;
  30448. const props = $xeTable;
  30449. return Object.assign({}, table_getConfig().table.rowDragConfig, props.rowDragConfig);
  30450. },
  30451. computeColumnDragOpts() {
  30452. const $xeTable = this;
  30453. const props = $xeTable;
  30454. return Object.assign({}, table_getConfig().table.columnDragConfig, props.columnDragConfig);
  30455. },
  30456. resizeOpts() {
  30457. return this.computeResizeOpts;
  30458. },
  30459. computeResizeOpts() {
  30460. const $xeTable = this;
  30461. const props = $xeTable;
  30462. return Object.assign({}, table_getConfig().table.resizeConfig, props.resizeConfig);
  30463. },
  30464. resizableOpts() {
  30465. return this.computeResizableOpts;
  30466. },
  30467. computeResizableOpts() {
  30468. const $xeTable = this;
  30469. const props = $xeTable;
  30470. return Object.assign({}, table_getConfig().table.resizableConfig, props.resizableConfig);
  30471. },
  30472. seqOpts() {
  30473. return this.computeSeqOpts;
  30474. },
  30475. computeSeqOpts() {
  30476. const $xeTable = this;
  30477. const props = $xeTable;
  30478. return Object.assign({
  30479. startIndex: 0
  30480. }, table_getConfig().table.seqConfig, props.seqConfig);
  30481. },
  30482. radioOpts() {
  30483. return this.computeRadioOpts;
  30484. },
  30485. computeRadioOpts() {
  30486. const $xeTable = this;
  30487. const props = $xeTable;
  30488. return Object.assign({}, table_getConfig().table.radioConfig, props.radioConfig);
  30489. },
  30490. checkboxOpts() {
  30491. return this.computeCheckboxOpts;
  30492. },
  30493. computeCheckboxOpts() {
  30494. const $xeTable = this;
  30495. const props = $xeTable;
  30496. return Object.assign({}, table_getConfig().table.checkboxConfig, props.checkboxConfig);
  30497. },
  30498. tooltipOpts() {
  30499. return this.computeTooltipOpts;
  30500. },
  30501. computeTooltipOpts() {
  30502. const $xeTable = this;
  30503. const props = $xeTable;
  30504. return Object.assign({}, table_getConfig().tooltip, table_getConfig().table.tooltipConfig, props.tooltipConfig);
  30505. },
  30506. tipConfig() {
  30507. return {
  30508. ...this.tooltipOpts
  30509. };
  30510. },
  30511. computeHeaderTooltipOpts() {
  30512. const $xeTable = this;
  30513. const props = $xeTable;
  30514. return Object.assign({}, table_getConfig().tooltip, table_getConfig().table.headerTooltipConfig, props.headerTooltipConfig);
  30515. },
  30516. computeFooterTooltipOpts() {
  30517. const $xeTable = this;
  30518. const props = $xeTable;
  30519. return Object.assign({}, table_getConfig().tooltip, table_getConfig().table.footerTooltipConfig, props.footerTooltipConfig);
  30520. },
  30521. computeTableTipConfig() {
  30522. const $xeTable = this;
  30523. const reactData = $xeTable;
  30524. const {
  30525. tooltipStore
  30526. } = reactData;
  30527. const tooltipOpts = $xeTable.computeTooltipOpts;
  30528. return Object.assign({}, tooltipOpts, tooltipStore.currOpts);
  30529. },
  30530. computeValidTipConfig() {
  30531. const $xeTable = this;
  30532. const tooltipOpts = $xeTable.computeTooltipOpts;
  30533. return Object.assign({}, tooltipOpts);
  30534. },
  30535. validTipOpts() {
  30536. return Object.assign({
  30537. isArrow: false
  30538. }, this.tooltipOpts);
  30539. },
  30540. editOpts() {
  30541. return this.computeEditOpts;
  30542. },
  30543. computeEditOpts() {
  30544. return Object.assign({}, table_getConfig().table.editConfig, this.editConfig);
  30545. },
  30546. sortOpts() {
  30547. return this.computeSortOpts;
  30548. },
  30549. computeSortOpts() {
  30550. return Object.assign({
  30551. orders: ['asc', 'desc', null]
  30552. }, table_getConfig().table.sortConfig, this.sortConfig);
  30553. },
  30554. filterOpts() {
  30555. return this.computeFilterOpts;
  30556. },
  30557. computeFilterOpts() {
  30558. const $xeTable = this;
  30559. const props = $xeTable;
  30560. return Object.assign({}, table_getConfig().table.filterConfig, props.filterConfig);
  30561. },
  30562. computeFloatingFilterOpts() {
  30563. const $xeTable = this;
  30564. const props = $xeTable;
  30565. return Object.assign({}, table_getConfig().table.floatingFilterConfig, props.floatingFilterConfig);
  30566. },
  30567. mouseOpts() {
  30568. return this.computeMouseOpts;
  30569. },
  30570. computeMouseOpts() {
  30571. return Object.assign({}, table_getConfig().table.mouseConfig, this.mouseConfig);
  30572. },
  30573. areaOpts() {
  30574. return this.computeAreaOpts;
  30575. },
  30576. computeAreaOpts() {
  30577. return Object.assign({}, table_getConfig().table.areaConfig, this.areaConfig);
  30578. },
  30579. keyboardOpts() {
  30580. return this.computeKeyboardOpts;
  30581. },
  30582. computeKeyboardOpts() {
  30583. return Object.assign({}, table_getConfig().table.keyboardConfig, this.keyboardConfig);
  30584. },
  30585. clipOpts() {
  30586. return this.computeClipOpts;
  30587. },
  30588. computeClipOpts() {
  30589. return Object.assign({}, table_getConfig().table.clipConfig, this.clipConfig);
  30590. },
  30591. fnrOpts() {
  30592. return this.computeFnrOpts;
  30593. },
  30594. computeFNROpts() {
  30595. return this.computeFnrOpts;
  30596. },
  30597. computeFnrOpts() {
  30598. return Object.assign({}, table_getConfig().table.fnrConfig, this.fnrConfig);
  30599. },
  30600. headerCtxMenu() {
  30601. return this.computeHeaderMenu;
  30602. },
  30603. computeHeaderMenu() {
  30604. const $xeTable = this;
  30605. const menuOpts = $xeTable.computeMenuOpts;
  30606. const headerOpts = menuOpts.header;
  30607. return headerOpts && headerOpts.options ? headerOpts.options : [];
  30608. },
  30609. bodyCtxMenu() {
  30610. return this.computeBodyMenu;
  30611. },
  30612. computeBodyMenu() {
  30613. const $xeTable = this;
  30614. const menuOpts = $xeTable.computeMenuOpts;
  30615. const bodyOpts = menuOpts.body;
  30616. return bodyOpts && bodyOpts.options ? bodyOpts.options : [];
  30617. },
  30618. footerCtxMenu() {
  30619. return this.computeFooterMenu;
  30620. },
  30621. computeFooterMenu() {
  30622. const $xeTable = this;
  30623. const menuOpts = $xeTable.computeMenuOpts;
  30624. const footerOpts = menuOpts.footer;
  30625. return footerOpts && footerOpts.options ? footerOpts.options : [];
  30626. },
  30627. isCtxMenu() {
  30628. return this.computeIsContentMenu;
  30629. },
  30630. computeIsMenu() {
  30631. return this.computeIsContentMenu;
  30632. },
  30633. computeIsContentMenu() {
  30634. const $xeTable = this;
  30635. const props = $xeTable;
  30636. const menuOpts = $xeTable.computeMenuOpts;
  30637. const headerMenu = $xeTable.computeHeaderMenu;
  30638. const bodyMenu = $xeTable.computeBodyMenu;
  30639. const footerMenu = $xeTable.computeFooterMenu;
  30640. return !!((props.contextMenu || props.menuConfig) && isEnableConf(menuOpts) && (headerMenu.length || bodyMenu.length || footerMenu.length));
  30641. },
  30642. ctxMenuList() {
  30643. return this.computeMenuList;
  30644. },
  30645. computeMenuList() {
  30646. const $xeTable = this;
  30647. const reactData = $xeTable;
  30648. const {
  30649. ctxMenuStore
  30650. } = reactData;
  30651. const rest = [];
  30652. ctxMenuStore.list.forEach(list => {
  30653. list.forEach(item => {
  30654. rest.push(item);
  30655. });
  30656. });
  30657. return rest;
  30658. },
  30659. ctxMenuOpts() {
  30660. return this.computeMenuOpts;
  30661. },
  30662. computeMenuOpts() {
  30663. return Object.assign({}, table_getConfig().table.menuConfig, this.contextMenu, this.menuConfig);
  30664. },
  30665. computeLeftFixedWidth() {
  30666. const $xeTable = this;
  30667. const reactData = $xeTable;
  30668. const {
  30669. columnStore
  30670. } = reactData;
  30671. const {
  30672. leftList
  30673. } = columnStore;
  30674. let leftWidth = 0;
  30675. for (let i = 0; i < leftList.length; i++) {
  30676. const column = leftList[i];
  30677. leftWidth += column.renderWidth;
  30678. }
  30679. return leftWidth;
  30680. },
  30681. computeRightFixedWidth() {
  30682. const $xeTable = this;
  30683. const reactData = $xeTable;
  30684. const {
  30685. columnStore
  30686. } = reactData;
  30687. const {
  30688. rightList
  30689. } = columnStore;
  30690. let leftWidth = 0;
  30691. for (let i = 0; i < rightList.length; i++) {
  30692. const column = rightList[i];
  30693. leftWidth += column.renderWidth;
  30694. }
  30695. return leftWidth;
  30696. },
  30697. exportOpts() {
  30698. return this.computeExportOpts;
  30699. },
  30700. computeExportOpts() {
  30701. return Object.assign({}, table_getConfig().table.exportConfig, this.exportConfig);
  30702. },
  30703. importOpts() {
  30704. return this.computeImportOpts;
  30705. },
  30706. computeImportOpts() {
  30707. return Object.assign({}, table_getConfig().table.importConfig, this.importConfig);
  30708. },
  30709. printOpts() {
  30710. return this.computePrintOpts;
  30711. },
  30712. computePrintOpts() {
  30713. return Object.assign({}, table_getConfig().table.printConfig, this.printConfig);
  30714. },
  30715. expandOpts() {
  30716. return this.computeExpandOpts;
  30717. },
  30718. computeExpandOpts() {
  30719. return Object.assign({}, table_getConfig().table.expandConfig, this.expandConfig);
  30720. },
  30721. treeOpts() {
  30722. return this.computeTreeOpts;
  30723. },
  30724. computeTreeOpts() {
  30725. return Object.assign({}, table_getConfig().table.treeConfig, this.treeConfig);
  30726. },
  30727. emptyOpts() {
  30728. return this.computeEmptyOpts;
  30729. },
  30730. computeEmptyOpts() {
  30731. return Object.assign({}, table_getConfig().table.emptyRender, this.emptyRender);
  30732. },
  30733. loadingOpts() {
  30734. return this.computeLoadingOpts;
  30735. },
  30736. computeLoadingOpts() {
  30737. return Object.assign({}, table_getConfig().table.loadingConfig, this.loadingConfig);
  30738. },
  30739. computeCellOffsetWidth() {
  30740. return this.border ? Math.max(2, Math.ceil(this.scrollbarWidth / this.tableColumn.length)) : 1;
  30741. },
  30742. customOpts() {
  30743. return this.computeCustomOpts;
  30744. },
  30745. computeCustomOpts() {
  30746. return Object.assign({}, table_getConfig().table.customConfig, this.customConfig);
  30747. },
  30748. computeTableRowExpandedList() {
  30749. const $xeTable = this;
  30750. const reactData = $xeTable;
  30751. const internalData = $xeTable;
  30752. const {
  30753. tableData,
  30754. rowExpandedFlag,
  30755. expandColumn,
  30756. rowGroupExpandedFlag,
  30757. treeExpandedFlag
  30758. } = reactData;
  30759. const {
  30760. visibleDataRowIdData,
  30761. rowExpandedMaps
  30762. } = internalData;
  30763. const expandList = [];
  30764. if (tableData.length && expandColumn && rowExpandedFlag && rowGroupExpandedFlag && treeExpandedFlag) {
  30765. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(rowExpandedMaps, (row, rowid) => {
  30766. if (visibleDataRowIdData[rowid]) {
  30767. expandList.push(row);
  30768. }
  30769. });
  30770. }
  30771. return expandList;
  30772. },
  30773. computeAutoWidthColumnList() {
  30774. const {
  30775. tableColumn,
  30776. visibleColumn
  30777. } = this;
  30778. return tableColumn.length || visibleColumn.length ? visibleColumn.filter(column => column.width === 'auto' || column.minWidth === 'auto') : [];
  30779. },
  30780. computeFixedColumnSize() {
  30781. const $xeTable = this;
  30782. const reactData = $xeTable;
  30783. const internalData = $xeTable;
  30784. const {
  30785. tableColumn
  30786. } = reactData;
  30787. const {
  30788. collectColumn
  30789. } = internalData;
  30790. let fixedSize = 0;
  30791. // 只判断第一层
  30792. if (tableColumn.length && collectColumn.length) {
  30793. collectColumn.forEach(column => {
  30794. if (column.renderFixed) {
  30795. fixedSize++;
  30796. }
  30797. });
  30798. }
  30799. return fixedSize;
  30800. },
  30801. fixedColumnSize() {
  30802. const $xeTable = this;
  30803. return $xeTable.computeFixedColumnSize;
  30804. },
  30805. computeIsMaxFixedColumn() {
  30806. const $xeTable = this;
  30807. const fixedColumnSize = $xeTable.computeFixedColumnSize;
  30808. const columnOpts = $xeTable.columnOpts;
  30809. const {
  30810. maxFixedSize
  30811. } = columnOpts;
  30812. if (maxFixedSize) {
  30813. return fixedColumnSize >= maxFixedSize;
  30814. }
  30815. return false;
  30816. },
  30817. computeTableBorder() {
  30818. const $xeTable = this;
  30819. const props = $xeTable;
  30820. const {
  30821. border
  30822. } = props;
  30823. if (border === true) {
  30824. return 'full';
  30825. }
  30826. if (border) {
  30827. return border;
  30828. }
  30829. return 'default';
  30830. },
  30831. /**
  30832. * 判断列全选的复选框是否禁用
  30833. */
  30834. isAllCheckboxDisabled() {
  30835. const {
  30836. tableFullData,
  30837. tableData,
  30838. treeConfig,
  30839. checkboxOpts
  30840. } = this;
  30841. const {
  30842. strict,
  30843. checkMethod
  30844. } = checkboxOpts;
  30845. if (strict) {
  30846. if (tableData.length || tableFullData.length) {
  30847. if (checkMethod) {
  30848. if (treeConfig) {
  30849. // 暂时不支持树形结构
  30850. }
  30851. // 如果所有行都被禁用
  30852. return tableFullData.every(row => !checkMethod({
  30853. row
  30854. }));
  30855. }
  30856. return false;
  30857. }
  30858. return true;
  30859. }
  30860. return false;
  30861. },
  30862. computeVirtualScrollBars() {
  30863. const $xeTable = this;
  30864. const reactData = $xeTable;
  30865. const {
  30866. overflowX,
  30867. scrollXLoad,
  30868. overflowY,
  30869. scrollYLoad
  30870. } = reactData;
  30871. return {
  30872. x: overflowX && scrollXLoad,
  30873. y: overflowY && scrollYLoad
  30874. };
  30875. },
  30876. computeRowGroupFields() {
  30877. const $xeTable = this;
  30878. const aggregateOpts = $xeTable.computeAggregateOpts;
  30879. return aggregateOpts.groupFields;
  30880. },
  30881. computeRowGroupColumns() {
  30882. const $xeTable = this;
  30883. const reactData = $xeTable;
  30884. const internalData = $xeTable;
  30885. const {
  30886. rowGroupList
  30887. } = reactData;
  30888. const {
  30889. fullColumnFieldData
  30890. } = internalData;
  30891. const rgColumns = [];
  30892. rowGroupList.forEach(aggConf => {
  30893. const colRest = fullColumnFieldData[aggConf.field];
  30894. if (colRest) {
  30895. rgColumns.push(colRest.column);
  30896. }
  30897. });
  30898. return rgColumns;
  30899. },
  30900. tabsResizeFlag() {
  30901. const $xeTable = this;
  30902. const $xeTabs = $xeTable.$xeTabs;
  30903. return $xeTabs ? $xeTabs.reactData.resizeFlag : null;
  30904. },
  30905. computeVxeLanguage() {
  30906. return core_.VxeUI.getLanguage();
  30907. },
  30908. computeScrollbarVisible() {
  30909. const $xeTable = this;
  30910. const scrollbarXOpts = $xeTable.computeScrollbarXOpts;
  30911. const scrollbarYOpts = $xeTable.computeScrollbarYOpts;
  30912. return `${scrollbarXOpts.visible}${scrollbarYOpts.visible}`;
  30913. }
  30914. },
  30915. watch: {
  30916. data(value) {
  30917. const $xeTable = this;
  30918. const reactData = $xeTable;
  30919. const {
  30920. initStatus
  30921. } = this;
  30922. if (value && value.length >= 50000) {
  30923. warnLog('vxe.error.errLargeData', ['loadData(data), reloadData(data)']);
  30924. }
  30925. this.loadTableData(value || [], true).then(() => {
  30926. const {
  30927. scrollXLoad,
  30928. scrollYLoad,
  30929. expandColumn
  30930. } = reactData;
  30931. const expandOpts = $xeTable.computeExpandOpts;
  30932. this.inited = true;
  30933. this.initStatus = true;
  30934. if (!initStatus) {
  30935. this.handleLoadDefaults();
  30936. }
  30937. // const checkboxColumn = this.tableFullColumn.find(column => column.type === 'checkbox')
  30938. // if (checkboxColumn && this.tableFullData.length > 300 && !this.checkboxOpts.checkField) {
  30939. // warnLog('vxe.error.checkProp', ['checkbox-config.checkField'])
  30940. // }
  30941. if ((scrollXLoad || scrollYLoad) && expandColumn && expandOpts.mode !== 'fixed') {
  30942. warnLog('vxe.error.scrollErrProp', ['column.type=expand']);
  30943. }
  30944. this.recalculate();
  30945. });
  30946. },
  30947. staticColumns(value) {
  30948. this.$nextTick(() => this.handleInitColumn(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().clone(value)));
  30949. },
  30950. tableColumn() {
  30951. this.analyColumnWidth();
  30952. },
  30953. upDataFlag() {
  30954. this.$nextTick().then(() => this.updateData());
  30955. },
  30956. reColumnFlag() {
  30957. this.$nextTick().then(() => this.refreshColumn());
  30958. },
  30959. computeSize() {
  30960. this.reLayoutFlag++;
  30961. },
  30962. showHeader() {
  30963. this.reLayoutFlag++;
  30964. },
  30965. showFooter() {
  30966. this.reLayoutFlag++;
  30967. },
  30968. overflowX() {
  30969. this.reLayoutFlag++;
  30970. },
  30971. overflowY() {
  30972. this.reLayoutFlag++;
  30973. },
  30974. height() {
  30975. this.reLayoutFlag++;
  30976. },
  30977. maxHeight() {
  30978. this.reLayoutFlag++;
  30979. },
  30980. computeScrollbarXToTop() {
  30981. this.reLayoutFlag++;
  30982. },
  30983. computeScrollbarYToLeft() {
  30984. this.reLayoutFlag++;
  30985. },
  30986. computeVxeLanguage() {
  30987. this.reLayoutFlag++;
  30988. },
  30989. computeScrollbarVisible() {
  30990. this.reLayoutFlag++;
  30991. },
  30992. reLayoutFlag() {
  30993. const $xeTable = this;
  30994. $xeTable.$nextTick(() => $xeTable.recalculate(true));
  30995. },
  30996. footerData() {
  30997. this.footFlag++;
  30998. },
  30999. footFlag() {
  31000. const $xeTable = this;
  31001. $xeTable.updateFooter();
  31002. },
  31003. syncResize(value) {
  31004. const $xeTable = this;
  31005. if (value) {
  31006. handleUpdateResize($xeTable);
  31007. $xeTable.$nextTick(() => {
  31008. handleUpdateResize($xeTable);
  31009. setTimeout(() => handleUpdateResize($xeTable));
  31010. });
  31011. }
  31012. },
  31013. tabsResizeFlag() {
  31014. this.handleGlobalResizeEvent();
  31015. },
  31016. mergeCells(value) {
  31017. const $xeTable = this;
  31018. handleUpdateMergeBodyCells($xeTable, value);
  31019. },
  31020. mergeHeaderCells(value) {
  31021. const $xeTable = this;
  31022. handleUpdateMergeHeaderCells($xeTable, value);
  31023. },
  31024. mergeFooterCells() {
  31025. this.mergeFooteCellFlag++;
  31026. },
  31027. mergeFooterItems() {
  31028. this.mergeFooteCellFlag++;
  31029. },
  31030. mergeFooteCellFlag() {
  31031. const $xeTable = this;
  31032. const props = $xeTable;
  31033. const mFooterCells = props.mergeFooterCells || props.mergeFooterItems;
  31034. handleUpdateMergeFooterCells($xeTable, mFooterCells || []);
  31035. },
  31036. computeRowGroupFields(val) {
  31037. const $xeTable = this;
  31038. $xeTable.handleUpdateRowGroup(val);
  31039. },
  31040. computeRowField() {
  31041. const $xeTable = this;
  31042. const reactData = $xeTable;
  31043. const internalData = $xeTable;
  31044. // 行主键被改变,重载表格
  31045. const {
  31046. inited,
  31047. tableFullData
  31048. } = internalData;
  31049. if (inited) {
  31050. handleKeyField($xeTable);
  31051. reactData.tableData = [];
  31052. $xeTable.$nextTick(() => {
  31053. $xeTable.reloadData(tableFullData);
  31054. });
  31055. }
  31056. }
  31057. },
  31058. created() {
  31059. const $xeTable = this;
  31060. const props = $xeTable;
  31061. const internalData = $xeTable;
  31062. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().assign(internalData, createInternalData());
  31063. handleKeyField($xeTable);
  31064. const {
  31065. data,
  31066. exportConfig,
  31067. importConfig,
  31068. treeConfig,
  31069. showOverflow,
  31070. highlightCurrentRow,
  31071. highlightCurrentColumn
  31072. } = props;
  31073. const {
  31074. scrollXStore,
  31075. scrollYStore
  31076. } = internalData;
  31077. const columnOpts = $xeTable.computeColumnOpts;
  31078. const editOpts = $xeTable.computeEditOpts;
  31079. const treeOpts = $xeTable.computeTreeOpts;
  31080. const radioOpts = $xeTable.computeRadioOpts;
  31081. const checkboxOpts = $xeTable.computeCheckboxOpts;
  31082. const expandOpts = $xeTable.computeExpandOpts;
  31083. const rowOpts = $xeTable.computeRowOpts;
  31084. const customOpts = $xeTable.computeCustomOpts;
  31085. const mouseOpts = $xeTable.computeMouseOpts;
  31086. const exportOpts = $xeTable.computeExportOpts;
  31087. const importOpts = $xeTable.computeImportOpts;
  31088. const currentRowOpts = $xeTable.computeCurrentRowOpts;
  31089. const currentColumnOpts = $xeTable.computeCurrentColumnOpts;
  31090. const keyboardOpts = $xeTable.computeKeyboardOpts;
  31091. const aggregateOpts = $xeTable.computeAggregateOpts;
  31092. const rowDragOpts = $xeTable.computeRowDragOpts;
  31093. const {
  31094. groupFields
  31095. } = aggregateOpts;
  31096. if (props.rowId) {
  31097. warnLog('vxe.error.delProp', ['row-id', 'row-config.keyField']);
  31098. }
  31099. if (props.rowKey) {
  31100. warnLog('vxe.error.delProp', ['row-key', 'row-config.useKey']);
  31101. }
  31102. if (props.columnKey) {
  31103. warnLog('vxe.error.delProp', ['column-id', 'column-config.useKey']);
  31104. }
  31105. if (!(props.rowId || rowOpts.keyField) && (checkboxOpts.reserve || checkboxOpts.checkRowKeys || radioOpts.reserve || radioOpts.checkRowKey || expandOpts.expandRowKeys || treeOpts.expandRowKeys)) {
  31106. warnLog('vxe.error.reqProp', ['row-config.keyField']);
  31107. }
  31108. if (props.editConfig && editOpts.showStatus && !props.keepSource) {
  31109. warnLog('vxe.error.reqProp', ['keep-source']);
  31110. }
  31111. if (treeConfig && (treeOpts.showLine || treeOpts.line) && !showOverflow) {
  31112. warnLog('vxe.error.reqProp', ['show-overflow']);
  31113. }
  31114. if (treeConfig && !treeOpts.transform && props.stripe) {
  31115. warnLog('vxe.error.noTree', ['stripe']);
  31116. }
  31117. if (props.showFooter && !(props.footerMethod || props.footerData)) {
  31118. warnLog('vxe.error.reqProp', ['footer-data | footer-method']);
  31119. }
  31120. if (rowOpts.height) {
  31121. warnLog('vxe.error.delProp', ['row-config.height', 'cell-config.height']);
  31122. }
  31123. if (this.tooltipOpts.enabled) {
  31124. warnLog('vxe.error.delProp', ['tooltip-config.enabled', 'tooltip-config.showAll']);
  31125. }
  31126. if (this.highlightCurrentRow) {
  31127. warnLog('vxe.error.delProp', ['highlight-current-row', 'row-config.isCurrent']);
  31128. }
  31129. if (this.highlightHoverRow) {
  31130. warnLog('vxe.error.delProp', ['highlight-hover-row', 'row-config.isHover']);
  31131. }
  31132. if (this.highlightCurrentColumn) {
  31133. warnLog('vxe.error.delProp', ['highlight-current-column', 'column-config.isCurrent']);
  31134. }
  31135. if (this.highlightHoverColumn) {
  31136. warnLog('vxe.error.delProp', ['highlight-hover-column', 'column-config.isHover']);
  31137. }
  31138. if (props.resizable) {
  31139. warnLog('vxe.error.delProp', ['resizable', 'column-config.resizable']);
  31140. }
  31141. if (props.virtualXConfig && props.scrollX) {
  31142. warnLog('vxe.error.notSupportProp', ['virtual-x-config', 'scroll-x', 'scroll-x=null']);
  31143. }
  31144. if (props.virtualYConfig && props.scrollY) {
  31145. warnLog('vxe.error.notSupportProp', ['virtual-y-config', 'scroll-y', 'scroll-y=null']);
  31146. }
  31147. if (props.aggregateConfig && props.rowGroupConfig) {
  31148. warnLog('vxe.error.notSupportProp', ['aggregate-config', 'row-group-config', 'row-group-config=null']);
  31149. }
  31150. // if (props.scrollY) {
  31151. // warnLog('vxe.error.delProp', ['scroll-y', 'virtual-y-config'])
  31152. // }
  31153. // if (props.scrollX) {
  31154. // warnLog('vxe.error.delProp', ['scroll-x', 'virtual-x-config'])
  31155. // }
  31156. // 检查导入导出类型,如果自定义导入导出方法,则不校验类型
  31157. if (importConfig && importOpts.types && !importOpts.importMethod && !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().includeArrays(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().keys(importOpts._typeMaps), importOpts.types)) {
  31158. warnLog('vxe.error.errProp', [`export-config.types=${importOpts.types.join(',')}`, importOpts.types.filter(type => external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().includes(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().keys(importOpts._typeMaps), type)).join(',') || external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().keys(importOpts._typeMaps).join(',')]);
  31159. }
  31160. if (exportConfig && exportOpts.types && !exportOpts.exportMethod && !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().includeArrays(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().keys(exportOpts._typeMaps), exportOpts.types)) {
  31161. warnLog('vxe.error.errProp', [`export-config.types=${exportOpts.types.join(',')}`, exportOpts.types.filter(type => external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().includes(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().keys(exportOpts._typeMaps), type)).join(',') || external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().keys(exportOpts._typeMaps).join(',')]);
  31162. }
  31163. if (!props.id) {
  31164. if ((props.customConfig ? isEnableConf(customOpts) : customOpts.enabled) && customOpts.storage) {
  31165. errLog('vxe.error.reqProp', ['id']);
  31166. }
  31167. }
  31168. if (treeConfig && checkboxOpts.range) {
  31169. errLog('vxe.error.noTree', ['checkbox-config.range']);
  31170. }
  31171. if (rowOpts.height && !this.showOverflow) {
  31172. warnLog('vxe.error.notProp', ['table.show-overflow']);
  31173. }
  31174. if (!$xeTable.triggerCellAreaModnEvent) {
  31175. if (props.areaConfig) {
  31176. warnLog('vxe.error.notProp', ['area-config']);
  31177. }
  31178. if (props.clipConfig) {
  31179. warnLog('vxe.error.notProp', ['clip-config']);
  31180. }
  31181. if (props.fnrConfig) {
  31182. warnLog('vxe.error.notProp', ['fnr-config']);
  31183. }
  31184. if (mouseOpts.area) {
  31185. errLog('vxe.error.notProp', ['mouse-config.area']);
  31186. return;
  31187. }
  31188. }
  31189. if (!$xeTable.handlePivotTableAggregateData) {
  31190. if (customOpts.allowGroup) {
  31191. errLog('vxe.error.notProp', ['custom-config.allowGroup']);
  31192. return;
  31193. }
  31194. if (customOpts.allowValues) {
  31195. errLog('vxe.error.notProp', ['custom-config.allowValues']);
  31196. return;
  31197. }
  31198. }
  31199. if (treeConfig && rowOpts.drag && !treeOpts.transform) {
  31200. warnLog('vxe.error.notSupportProp', ['row-config.drag', 'tree-config.transform=false', 'tree-config.transform=true']);
  31201. }
  31202. if (treeConfig && rowDragOpts.isCrossTableDrag && !rowDragOpts.isCrossDrag) {
  31203. errLog('vxe.error.reqSupportProp', ['tree-config & row-drag-config.isCrossTableDrag', 'row-drag-config.isCrossDrag']);
  31204. }
  31205. if (props.dragConfig) {
  31206. warnLog('vxe.error.delProp', ['drag-config', 'row-drag-config']);
  31207. }
  31208. if (props.rowGroupConfig) {
  31209. warnLog('vxe.error.delProp', ['row-group-config', 'aggregate-config']);
  31210. }
  31211. if (aggregateOpts.countFields) {
  31212. warnLog('vxe.error.delProp', ['row-group-config.countFields', 'column.agg-func']);
  31213. }
  31214. if (aggregateOpts.aggregateMethod) {
  31215. warnLog('vxe.error.delProp', ['row-group-config.aggregateMethod', 'aggregate-config.calcValuesMethod']);
  31216. }
  31217. if (aggregateOpts.countMethod) {
  31218. warnLog('vxe.error.delProp', ['aggregate-config.countMethod', 'aggregate-config.calcValuesMethod']);
  31219. }
  31220. if (props.treeConfig && treeOpts.children) {
  31221. warnLog('vxe.error.delProp', ['tree-config.children', 'tree-config.childrenField']);
  31222. }
  31223. if (props.treeConfig && treeOpts.line) {
  31224. warnLog('vxe.error.delProp', ['tree-config.line', 'tree-config.showLine']);
  31225. }
  31226. if (mouseOpts.area && mouseOpts.selected) {
  31227. warnLog('vxe.error.errConflicts', ['mouse-config.area', 'mouse-config.selected']);
  31228. }
  31229. if (mouseOpts.area && props.treeConfig && !treeOpts.transform) {
  31230. errLog('vxe.error.noTree', ['mouse-config.area']);
  31231. }
  31232. if (props.editConfig && editOpts.activeMethod) {
  31233. warnLog('vxe.error.delProp', ['table.edit-config.activeMethod', 'table.edit-config.beforeEditMethod']);
  31234. }
  31235. if (props.treeConfig && checkboxOpts.isShiftKey) {
  31236. errLog('vxe.error.errConflicts', ['tree-config', 'checkbox-config.isShiftKey']);
  31237. }
  31238. if (checkboxOpts.halfField) {
  31239. warnLog('vxe.error.delProp', ['checkbox-config.halfField', 'checkbox-config.indeterminateField']);
  31240. }
  31241. if (treeConfig) {
  31242. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayEach(['rowField', 'parentField', 'childrenField', 'hasChildField', 'mapChildrenField'], key => {
  31243. const val = treeOpts[key];
  31244. if (val && val.indexOf('.') > -1) {
  31245. errLog('vxe.error.errProp', [`${key}=${val}`, `${key}=${val.split('.')[0]}`]);
  31246. }
  31247. });
  31248. }
  31249. // 在 v3.0 中废弃 context-menu
  31250. if (this.contextMenu) {
  31251. warnLog('vxe.error.delProp', ['context-menu', 'menu-config']);
  31252. if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isObject(this.contextMenu)) {
  31253. warnLog('vxe.error.errProp', [`table.context-menu=${this.contextMenu}`, 'table.context-menu={}']);
  31254. }
  31255. }
  31256. if (props.menuConfig && !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isObject(props.menuConfig)) {
  31257. warnLog('vxe.error.errProp', [`table.menu-config=${props.menuConfig}`, 'table.menu-config={}']);
  31258. }
  31259. if (props.exportConfig && !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isObject(props.exportConfig)) {
  31260. warnLog('vxe.error.errProp', [`table.export-config=${props.exportConfig}`, 'table.export-config={}']);
  31261. }
  31262. if (props.importConfig && !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isObject(props.importConfig)) {
  31263. warnLog('vxe.error.errProp', [`table.import-config=${props.importConfig}`, 'table.import-config={}']);
  31264. }
  31265. if (props.printConfig && !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isObject(props.printConfig)) {
  31266. warnLog('vxe.error.errProp', [`table.print-config=${props.printConfig}`, 'table.print-config={}']);
  31267. }
  31268. if (props.treeConfig && !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isObject(props.treeConfig)) {
  31269. warnLog('vxe.error.errProp', [`table.tree-config=${props.treeConfig}`, 'table.tree-config={}']);
  31270. }
  31271. if (props.customConfig && !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isObject(props.customConfig)) {
  31272. warnLog('vxe.error.errProp', [`table.custom-config=${props.customConfig}`, 'table.custom-config={}']);
  31273. }
  31274. if (props.editConfig && !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isObject(props.editConfig)) {
  31275. warnLog('vxe.error.errProp', [`table.edit-config=${props.editConfig}`, 'table.edit-config={}']);
  31276. }
  31277. if (props.emptyRender && !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isObject(props.emptyRender)) {
  31278. warnLog('vxe.error.errProp', [`table.empty-render=${props.emptyRender}`, 'table.empty-render={}']);
  31279. }
  31280. if (rowOpts.currentMethod) {
  31281. warnLog('vxe.error.delProp', ['row-config.currentMethod', 'current-row-config.beforeSelectMethod']);
  31282. }
  31283. if (columnOpts.currentMethod) {
  31284. warnLog('vxe.error.delProp', ['row-config.currentMethod', 'current-column-config.beforeSelectMethod']);
  31285. }
  31286. if ((rowOpts.isCurrent || highlightCurrentRow) && props.keyboardConfig && keyboardOpts.isArrow && !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isBoolean(currentRowOpts.isFollowSelected)) {
  31287. warnLog('vxe.error.notConflictProp', ['row-config.isCurrent', 'current-row-config.isFollowSelected']);
  31288. }
  31289. if ((columnOpts.isCurrent || highlightCurrentColumn) && props.keyboardConfig && keyboardOpts.isArrow && !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isBoolean(currentColumnOpts.isFollowSelected)) {
  31290. warnLog('vxe.error.notConflictProp', ['column-config.isCurrent', 'current-column-config.isFollowSelected']);
  31291. }
  31292. // 如果不支持虚拟滚动
  31293. // if (props.spanMethod) {
  31294. // if (virtualXOpts.enabled) {
  31295. // warnLog('vxe.error.notConflictProp', ['span-method', 'virtual-x-config.enabled=false'])
  31296. // }
  31297. // if (virtualYOpts.enabled) {
  31298. // warnLog('vxe.error.notConflictProp', ['span-method', 'virtual-y-config.enabled=false'])
  31299. // }
  31300. // }
  31301. // if (props.footerSpanMethod) {
  31302. // if (virtualXOpts.enabled) {
  31303. // warnLog('vxe.error.notConflictProp', ['footer-span-method', 'virtual-x-config.enabled=false'])
  31304. // }
  31305. // }
  31306. // 检查是否有安装需要的模块
  31307. if (props.editConfig && !$xeTable.insert) {
  31308. errLog('vxe.error.reqModule', ['Edit']);
  31309. }
  31310. if (props.editRules && !$xeTable.validate) {
  31311. errLog('vxe.error.reqModule', ['Validator']);
  31312. }
  31313. if ((checkboxOpts.range || props.keyboardConfig || props.mouseConfig) && !$xeTable.handleCellMousedownEvent) {
  31314. errLog('vxe.error.reqModule', ['Keyboard']);
  31315. }
  31316. if ((props.printConfig || props.importConfig || props.exportConfig) && !$xeTable.exportData) {
  31317. errLog('vxe.error.reqModule', ['Export']);
  31318. }
  31319. Object.assign(scrollYStore, {
  31320. startIndex: 0,
  31321. endIndex: 1,
  31322. visibleSize: 0
  31323. });
  31324. Object.assign(scrollXStore, {
  31325. startIndex: 0,
  31326. endIndex: 1,
  31327. visibleSize: 0
  31328. });
  31329. this.handleUpdateRowGroup(groupFields);
  31330. this.loadTableData(data, true).then(() => {
  31331. if (data && data.length) {
  31332. this.inited = true;
  31333. this.initStatus = true;
  31334. this.handleLoadDefaults();
  31335. }
  31336. this.handleInitDefaults();
  31337. this.updateStyle();
  31338. });
  31339. table_globalEvents.on($xeTable, 'paste', this.handleGlobalPasteEvent);
  31340. table_globalEvents.on($xeTable, 'copy', this.handleGlobalCopyEvent);
  31341. table_globalEvents.on($xeTable, 'cut', this.handleGlobalCutEvent);
  31342. table_globalEvents.on($xeTable, 'mousedown', this.handleGlobalMousedownEvent);
  31343. table_globalEvents.on($xeTable, 'blur', this.handleGlobalBlurEvent);
  31344. table_globalEvents.on($xeTable, 'mousewheel', this.handleGlobalMousewheelEvent);
  31345. table_globalEvents.on($xeTable, 'keydown', this.handleGlobalKeydownEvent);
  31346. table_globalEvents.on($xeTable, 'resize', this.handleGlobalResizeEvent);
  31347. table_globalEvents.on($xeTable, 'contextmenu', this.handleGlobalContextmenuEvent);
  31348. $xeTable.preventEvent(null, 'created');
  31349. },
  31350. mounted() {
  31351. const $xeTable = this;
  31352. const props = $xeTable;
  31353. const internalData = $xeTable;
  31354. const $xeGrid = $xeTable.$xeGrid;
  31355. const $xeGantt = $xeTable.$xeGantt;
  31356. const $xeGGWrapper = $xeGrid || $xeGantt;
  31357. const columnOpts = $xeTable.computeColumnOpts;
  31358. const rowOpts = $xeTable.computeRowOpts;
  31359. const customOpts = $xeTable.computeCustomOpts;
  31360. const virtualYOpts = $xeTable.computeVirtualYOpts;
  31361. if ($xeGantt) {
  31362. const classifyWrapperEl = $xeGantt.$refs.refClassifyWrapperElem;
  31363. const teleportWrapperEl = $xeTable.$refs.refTeleportWrapper;
  31364. if (classifyWrapperEl) {
  31365. if (teleportWrapperEl) {
  31366. classifyWrapperEl.appendChild(teleportWrapperEl);
  31367. }
  31368. internalData.teleportToWrapperElem = classifyWrapperEl;
  31369. }
  31370. }
  31371. if ($xeGGWrapper) {
  31372. const popupContainerElem = $xeGGWrapper.$refs.refPopupContainerElem;
  31373. const popupWrapperEl = $xeTable.$refs.refPopupWrapperElem;
  31374. if (popupContainerElem) {
  31375. if (popupWrapperEl) {
  31376. popupContainerElem.appendChild(popupWrapperEl);
  31377. }
  31378. internalData.popupToWrapperElem = popupContainerElem;
  31379. }
  31380. }
  31381. if (columnOpts.drag || rowOpts.drag || customOpts.allowSort) {
  31382. initTpImg();
  31383. }
  31384. const {
  31385. $listeners
  31386. } = this;
  31387. if (!this.menuConfig && ($listeners['menu-click'] || $listeners['cell-menu'] || $listeners['header-cell-menu'] || $listeners['footer-cell-menu'])) {
  31388. warnLog('vxe.error.reqProp', ['menu-config']);
  31389. }
  31390. if (!this.tooltipConfig && ($listeners['cell-mouseenter'] || $listeners['cell-mouseleave'])) {
  31391. warnLog('vxe.error.reqProp', ['tooltip-config']);
  31392. }
  31393. $xeTable.$nextTick(() => {
  31394. // 使用已安装的组件,如果未安装则不渲染
  31395. const VxeUILoadingComponent = core_.VxeUI.getComponent('VxeLoading');
  31396. const VxeUITooltipComponent = core_.VxeUI.getComponent('VxeTooltip');
  31397. if (props.loading) {
  31398. if (!VxeUILoadingComponent && !this.$scopedSlots.loading) {
  31399. errLog('vxe.error.errProp', ['loading=true', 'loading=false | <template #loading>...</template>']);
  31400. errLog('vxe.error.reqComp', ['vxe-loading']);
  31401. }
  31402. }
  31403. if (props.showOverflow === true || props.showOverflow === 'tooltip' || props.showHeaderOverflow === true || props.showHeaderOverflow === 'tooltip' || props.showFooterOverflow === true || props.showFooterOverflow === 'tooltip' || props.tooltipConfig || props.editRules) {
  31404. if (!VxeUITooltipComponent) {
  31405. if (props.showOverflow === true) {
  31406. errLog('vxe.error.errProp', ['show-overflow=true', 'show-overflow=title']);
  31407. }
  31408. if (props.showOverflow === 'tooltip') {
  31409. errLog('vxe.error.errProp', ['show-overflow=tooltip', 'show-overflow=title']);
  31410. }
  31411. if (props.showHeaderOverflow === true) {
  31412. errLog('vxe.error.errProp', ['show-header-overflow=true', 'show-header-overflow=title']);
  31413. }
  31414. if (props.showHeaderOverflow === 'tooltip') {
  31415. errLog('vxe.error.errProp', ['show-header-overflow=tooltip', 'show-header-overflow=title']);
  31416. }
  31417. if (props.showFooterOverflow === true) {
  31418. errLog('vxe.error.errProp', ['show-footer-overflow=true', 'show-footer-overflow=title']);
  31419. }
  31420. if (props.showFooterOverflow === 'tooltip') {
  31421. errLog('vxe.error.errProp', ['show-footer-overflow=tooltip', 'show-footer-overflow=title']);
  31422. }
  31423. errLog('vxe.error.reqComp', ['vxe-tooltip']);
  31424. }
  31425. }
  31426. if (this.autoResize) {
  31427. const resizeObserver = table_globalResize.create(() => {
  31428. if (this.autoResize) {
  31429. this.handleResizeEvent();
  31430. }
  31431. });
  31432. resizeObserver.observe(this.$el);
  31433. resizeObserver.observe(this.getParentElem());
  31434. this.$resize = resizeObserver;
  31435. }
  31436. });
  31437. if (virtualYOpts.mode !== 'scroll') {
  31438. const tableViewportEl = $xeTable.$refs.refTableViewportElem;
  31439. if (tableViewportEl) {
  31440. tableViewportEl.addEventListener('wheel', $xeTable.triggerBodyWheelEvent, {
  31441. passive: false
  31442. });
  31443. }
  31444. }
  31445. $xeTable.preventEvent(null, 'mounted');
  31446. },
  31447. activated() {
  31448. this.recalculate().then(() => this.refreshScroll());
  31449. this.preventEvent(null, 'activated');
  31450. },
  31451. deactivated() {
  31452. const $xeTable = this;
  31453. const reactData = $xeTable;
  31454. const internalData = $xeTable;
  31455. const {
  31456. filterStore
  31457. } = reactData;
  31458. if (filterStore.visible) {
  31459. $xeTable.clearFilter();
  31460. }
  31461. $xeTable.closeTooltip();
  31462. internalData.isActivated = false;
  31463. this.preventEvent(null, 'deactivated');
  31464. },
  31465. beforeDestroy() {
  31466. const $xeTable = this;
  31467. const teleportWrapperEl = $xeTable.$refs.refTeleportWrapper;
  31468. if (teleportWrapperEl && teleportWrapperEl.parentElement) {
  31469. teleportWrapperEl.parentElement.removeChild(teleportWrapperEl);
  31470. }
  31471. const popupWrapperEl = $xeTable.$refs.refPopupWrapperElem;
  31472. if (popupWrapperEl && popupWrapperEl.parentElement) {
  31473. popupWrapperEl.parentElement.removeChild(popupWrapperEl);
  31474. }
  31475. const tableViewportEl = $xeTable.$refs.refTableViewportElem;
  31476. if (tableViewportEl) {
  31477. tableViewportEl.removeEventListener('wheel', $xeTable.triggerBodyWheelEvent);
  31478. }
  31479. if (this.$resize) {
  31480. this.$resize.disconnect();
  31481. }
  31482. this.closeFilter();
  31483. this.closeMenu();
  31484. table_globalEvents.off($xeTable, 'paste');
  31485. table_globalEvents.off($xeTable, 'copy');
  31486. table_globalEvents.off($xeTable, 'cut');
  31487. table_globalEvents.off($xeTable, 'mousedown');
  31488. table_globalEvents.off($xeTable, 'blur');
  31489. table_globalEvents.off($xeTable, 'mousewheel');
  31490. table_globalEvents.off($xeTable, 'keydown');
  31491. table_globalEvents.off($xeTable, 'resize');
  31492. table_globalEvents.off($xeTable, 'contextmenu');
  31493. this.preventEvent(null, 'beforeDestroy');
  31494. },
  31495. destroyed() {
  31496. const $xeTable = this;
  31497. const internalData = $xeTable;
  31498. this.preventEvent(null, 'destroyed');
  31499. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().assign(internalData, createInternalData());
  31500. },
  31501. render(h) {
  31502. // 使用已安装的组件,如果未安装则不渲染
  31503. const VxeUILoadingComponent = core_.VxeUI.getComponent('VxeLoading');
  31504. const VxeUITooltipComponent = core_.VxeUI.getComponent('VxeTooltip');
  31505. const $xeTable = this;
  31506. const $xeGrid = $xeTable.$xeGrid;
  31507. const $xeGantt = $xeTable.$xeGantt;
  31508. const props = $xeTable;
  31509. const slots = $xeTable.$scopedSlots;
  31510. const reactData = $xeTable;
  31511. const {
  31512. xID
  31513. } = $xeTable;
  31514. const {
  31515. loading,
  31516. stripe,
  31517. showHeader,
  31518. height,
  31519. treeConfig,
  31520. mouseConfig,
  31521. showFooter,
  31522. highlightCell,
  31523. highlightHoverRow,
  31524. highlightHoverColumn,
  31525. editConfig,
  31526. editRules
  31527. } = props;
  31528. const {
  31529. isGroup,
  31530. overflowX,
  31531. overflowY,
  31532. scrollXLoad,
  31533. scrollYLoad,
  31534. tableData,
  31535. initStore,
  31536. isRowGroupStatus,
  31537. columnStore,
  31538. filterStore,
  31539. customStore,
  31540. tooltipStore
  31541. } = reactData;
  31542. const {
  31543. leftList,
  31544. rightList
  31545. } = columnStore;
  31546. const loadingSlot = slots.loading;
  31547. const tipSlots = {
  31548. header: slots.headerTooltip || slots['header-tooltip'],
  31549. body: slots.tooltip,
  31550. footer: slots.footerTooltip || slots['footer-tooltip']
  31551. };
  31552. const currTooltipSlot = tooltipStore.visible && tooltipStore.type ? tipSlots[tooltipStore.type] : null;
  31553. const rowDragOpts = $xeTable.computeRowDragOpts;
  31554. const tableTipConfig = $xeTable.computeTableTipConfig;
  31555. const validTipConfig = $xeTable.computeValidTipConfig;
  31556. const validOpts = $xeTable.computeValidOpts;
  31557. const checkboxOpts = $xeTable.computeCheckboxOpts;
  31558. const treeOpts = $xeTable.computeTreeOpts;
  31559. const rowOpts = $xeTable.computeRowOpts;
  31560. const columnOpts = $xeTable.computeColumnOpts;
  31561. const vSize = $xeTable.computeSize;
  31562. const tableBorder = $xeTable.computeTableBorder;
  31563. const mouseOpts = $xeTable.computeMouseOpts;
  31564. const areaOpts = $xeTable.computeAreaOpts;
  31565. const loadingOpts = $xeTable.computeLoadingOpts;
  31566. const isContentMenu = $xeTable.computeIsContentMenu;
  31567. const currLoading = reactData.isColLoading || reactData.isRowLoading || loading;
  31568. const resizableOpts = $xeTable.computeResizableOpts;
  31569. const isArea = mouseConfig && mouseOpts.area;
  31570. const columnDragOpts = $xeTable.computeColumnDragOpts;
  31571. const scrollbarXToTop = $xeTable.computeScrollbarXToTop;
  31572. const scrollbarYToLeft = $xeTable.computeScrollbarYToLeft;
  31573. const {
  31574. isCrossTableDrag
  31575. } = rowDragOpts;
  31576. const tbOns = {
  31577. keydown: this.keydownEvent
  31578. };
  31579. if (isCrossTableDrag && !tableData.length) {
  31580. tbOns.dragover = $xeTable.handleCrossTableRowDragoverEmptyEvent;
  31581. }
  31582. return h('div', {
  31583. ref: 'refElem',
  31584. class: ['vxe-table', 'vxe-table--render-default', `tid_${xID}`, `border--${tableBorder}`, `sx-pos--${scrollbarXToTop ? 'top' : 'bottom'}`, `sy-pos--${scrollbarYToLeft ? 'left' : 'right'}`, {
  31585. [`size--${vSize}`]: vSize,
  31586. [`valid-msg--${validOpts.msgMode}`]: !!editRules,
  31587. 'vxe-editable': !!editConfig,
  31588. 'old-cell-valid': editRules && table_getConfig().cellVaildMode === 'obsolete',
  31589. 'cell--highlight': highlightCell,
  31590. 'cell--selected': mouseConfig && mouseOpts.selected,
  31591. 'cell--area': isArea,
  31592. 'header-cell--area': isArea && areaOpts.selectCellByHeader,
  31593. 'body-cell--area': isArea && areaOpts.selectCellByBody,
  31594. 'row--highlight': rowOpts.isHover || highlightHoverRow,
  31595. 'column--highlight': columnOpts.isHover || highlightHoverColumn,
  31596. 'checkbox--range': checkboxOpts.range,
  31597. 'col--drag-cell': columnOpts.drag && columnDragOpts.trigger === 'cell',
  31598. 'is--header': showHeader,
  31599. 'is--footer': showFooter,
  31600. 'is--group': isGroup,
  31601. 'is-row-group': isRowGroupStatus,
  31602. 'is--tree-line': treeConfig && (treeOpts.showLine || treeOpts.line),
  31603. 'is--fixed-left': leftList.length,
  31604. 'is--fixed-right': rightList.length,
  31605. 'is--animat': !!props.animat,
  31606. 'is--round': props.round,
  31607. 'is--stripe': !treeConfig && stripe,
  31608. 'is--loading': currLoading,
  31609. 'is--empty': !currLoading && !tableData.length,
  31610. 'is--scroll-y': overflowY,
  31611. 'is--scroll-x': overflowX,
  31612. 'is--virtual-x': scrollXLoad,
  31613. 'is--virtual-y': scrollYLoad
  31614. }],
  31615. attrs: {
  31616. spellcheck: false
  31617. },
  31618. on: tbOns
  31619. }, [
  31620. /**
  31621. * 隐藏列
  31622. */
  31623. h('div', {
  31624. class: 'vxe-table-slots',
  31625. ref: 'hideColumn'
  31626. }, this.$slots.default), h('div', {
  31627. ref: 'refVarElem',
  31628. class: 'vxe-table-vars'
  31629. }, [h('div', {
  31630. class: 'vxe-table-var-default'
  31631. }), h('div', {
  31632. class: 'vxe-table-var-medium'
  31633. }), h('div', {
  31634. class: 'vxe-table-var-small'
  31635. }), h('div', {
  31636. class: 'vxe-table-var-mini'
  31637. })]), h('div', {
  31638. key: 'tw',
  31639. class: 'vxe-table--render-wrapper'
  31640. }, scrollbarXToTop ? [renderScrollX(h, $xeTable), renderBody(h, $xeTable)] : [renderBody(h, $xeTable), renderScrollX(h, $xeTable)]),
  31641. /**
  31642. * 空数据
  31643. */
  31644. h('div', {
  31645. key: 'tn',
  31646. ref: 'refEmptyPlaceholder',
  31647. class: 'vxe-table--empty-place-wrapper'
  31648. }, [h('div', {
  31649. class: 'vxe-table--empty-placeholder'
  31650. }, [h('div', {
  31651. class: 'vxe-table--empty-content'
  31652. }, renderEmptyBody(h, $xeTable))])]),
  31653. /**
  31654. * 边框线
  31655. */
  31656. h('div', {
  31657. key: 'tl',
  31658. class: 'vxe-table--border-line'
  31659. }),
  31660. /**
  31661. * 列宽线
  31662. */
  31663. h('div', {
  31664. key: 'tcl',
  31665. ref: 'refColResizeBar',
  31666. class: 'vxe-table--resizable-col-bar'
  31667. }, resizableOpts.showDragTip ? [h('div', {
  31668. ref: 'refColResizeTip',
  31669. class: 'vxe-table--resizable-number-tip'
  31670. })] : []), h('div', {
  31671. key: 'ttw'
  31672. }, [h('div', {
  31673. ref: 'refTeleportWrapper'
  31674. }, [
  31675. /**
  31676. * 行高线
  31677. */
  31678. h('div', {
  31679. key: 'trl',
  31680. ref: 'refRowResizeBar',
  31681. class: 'vxe-table--resizable-row-bar'
  31682. }, resizableOpts.showDragTip ? [h('div', {
  31683. class: 'vxe-table--resizable-number-tip'
  31684. })] : []),
  31685. /**
  31686. * 自定义列
  31687. */
  31688. initStore.custom ? h(panel, {
  31689. key: 'cs',
  31690. ref: 'refTableCustom',
  31691. props: {
  31692. customStore
  31693. }
  31694. }) : table_renderEmptyElement($xeTable),
  31695. /**
  31696. * 加载中
  31697. */
  31698. VxeUILoadingComponent ? h(VxeUILoadingComponent, {
  31699. key: 'lg',
  31700. class: 'vxe-table--loading',
  31701. props: {
  31702. value: currLoading,
  31703. icon: loadingOpts.icon,
  31704. text: loadingOpts.text
  31705. },
  31706. scopedSlots: loadingSlot ? {
  31707. default: () => $xeTable.callSlot(loadingSlot, {
  31708. $table: $xeTable,
  31709. $grid: $xeGrid,
  31710. $gantt: $xeGantt,
  31711. loading: currLoading
  31712. }, h)
  31713. } : {}
  31714. }) : loadingSlot ? h('div', {
  31715. class: ['vxe-loading--custom-wrapper', {
  31716. 'is--visible': currLoading
  31717. }]
  31718. }, $xeTable.callSlot(loadingSlot, {
  31719. $table: $xeTable,
  31720. $grid: $xeGrid,
  31721. $gantt: $xeGantt,
  31722. loading: currLoading
  31723. }, h)) : table_renderEmptyElement($xeTable),
  31724. /**
  31725. * 拖拽提示
  31726. */
  31727. table_renderDragTip(h, this)])]), h('div', {
  31728. key: 'tpw'
  31729. }, [h('div', {
  31730. ref: 'refPopupWrapperElem'
  31731. }, [
  31732. /**
  31733. * 筛选
  31734. */
  31735. initStore.filter ? h(filter_panel, {
  31736. key: 'tf',
  31737. ref: 'refTableFilter',
  31738. props: {
  31739. filterStore
  31740. }
  31741. }) : table_renderEmptyElement($xeTable),
  31742. /**
  31743. * 快捷菜单
  31744. */
  31745. isContentMenu ? h(menu_panel, {
  31746. key: 'tm',
  31747. ref: 'refTableMenu',
  31748. props: {
  31749. ctxMenuStore: this.ctxMenuStore,
  31750. ctxMenuOpts: this.ctxMenuOpts
  31751. }
  31752. }) : table_renderEmptyElement($xeTable)])]),
  31753. /**
  31754. * 导入
  31755. */
  31756. initStore.import && this.importConfig ? h(import_panel, {
  31757. key: 'it',
  31758. props: {
  31759. defaultOptions: this.importParams,
  31760. storeData: this.importStore
  31761. }
  31762. }) : table_renderEmptyElement($xeTable),
  31763. /**
  31764. * 导出
  31765. */
  31766. initStore.export && (this.exportConfig || this.printConfig) ? h(export_panel, {
  31767. key: 'et',
  31768. props: {
  31769. defaultOptions: this.exportParams,
  31770. storeData: this.exportStore
  31771. }
  31772. }) : table_renderEmptyElement($xeTable), h('div', {}, [
  31773. /**
  31774. * 提示相关
  31775. */
  31776. VxeUITooltipComponent ? h(VxeUITooltipComponent, {
  31777. key: 'ctp',
  31778. ref: 'refCommTooltip',
  31779. props: {
  31780. isArrow: false,
  31781. enterable: false
  31782. }
  31783. }) : table_renderEmptyElement($xeTable),
  31784. /**
  31785. * 工具提示
  31786. */
  31787. VxeUITooltipComponent ? h(VxeUITooltipComponent, {
  31788. key: 'btp',
  31789. ref: 'refTooltip',
  31790. props: {
  31791. theme: tableTipConfig.theme,
  31792. enterable: tableTipConfig.enterable,
  31793. enterDelay: tableTipConfig.enterDelay,
  31794. leaveDelay: tableTipConfig.leaveDelay,
  31795. useHTML: tableTipConfig.useHTML,
  31796. width: tableTipConfig.width,
  31797. height: tableTipConfig.height,
  31798. minWidth: tableTipConfig.minWidth,
  31799. minHeight: tableTipConfig.minHeight,
  31800. maxWidth: tableTipConfig.maxWidth,
  31801. maxHeight: tableTipConfig.maxHeight
  31802. },
  31803. scopedSlots: currTooltipSlot ? {
  31804. content: () => {
  31805. const {
  31806. type,
  31807. row,
  31808. column,
  31809. content: tooltipContent
  31810. } = tooltipStore;
  31811. if (currTooltipSlot) {
  31812. if (column && type === 'header') {
  31813. return h('div', {
  31814. key: type
  31815. }, currTooltipSlot({
  31816. column,
  31817. tooltipContent,
  31818. $table: $xeTable,
  31819. $grid: $xeGrid,
  31820. $gantt: $xeGantt
  31821. }));
  31822. }
  31823. if (row && column && type === 'body') {
  31824. return h('div', {
  31825. key: type
  31826. }, currTooltipSlot({
  31827. row,
  31828. column,
  31829. tooltipContent,
  31830. $table: $xeTable,
  31831. $grid: $xeGrid,
  31832. $gantt: $xeGantt
  31833. }));
  31834. }
  31835. if (row && column && type === 'footer') {
  31836. return h('div', {
  31837. key: type
  31838. }, currTooltipSlot({
  31839. row,
  31840. column,
  31841. tooltipContent,
  31842. $table: $xeTable,
  31843. $grid: $xeGrid,
  31844. $gantt: $xeGantt
  31845. }));
  31846. }
  31847. }
  31848. return table_renderEmptyElement($xeTable);
  31849. }
  31850. } : {}
  31851. }) : table_renderEmptyElement($xeTable),
  31852. /**
  31853. * 校验提示
  31854. */
  31855. VxeUITooltipComponent && this.editRules && validOpts.showMessage && (validOpts.message === 'default' ? !height : validOpts.message === 'tooltip') ? h(VxeUITooltipComponent, {
  31856. key: 'vtp',
  31857. ref: 'refValidTooltip',
  31858. class: [{
  31859. 'old-cell-valid': editRules && table_getConfig().cellVaildMode === 'obsolete'
  31860. }, 'vxe-table--valid-error'],
  31861. props: {
  31862. theme: validTipConfig.theme,
  31863. enterable: validTipConfig.enterable,
  31864. enterDelay: validTipConfig.enterDelay,
  31865. leaveDelay: validTipConfig.leaveDelay
  31866. }
  31867. }) : table_renderEmptyElement($xeTable)])]);
  31868. },
  31869. methods: methods
  31870. });
  31871. ;// CONCATENATED MODULE: ./packages/toolbar/src/toolbar.ts
  31872. const {
  31873. getConfig: toolbar_getConfig,
  31874. getIcon: toolbar_getIcon,
  31875. getI18n: toolbar_getI18n,
  31876. renderer: toolbar_renderer,
  31877. commands: toolbar_commands,
  31878. createEvent: toolbar_createEvent,
  31879. globalMixins: toolbar_globalMixins,
  31880. renderEmptyElement: toolbar_renderEmptyElement
  31881. } = core_.VxeUI;
  31882. function toolbar_createInternalData() {
  31883. return {
  31884. connectTable: null
  31885. };
  31886. }
  31887. /* harmony default export */ var toolbar = (/* define-vxe-component start */defineVxeComponent({
  31888. name: 'VxeToolbar',
  31889. mixins: [toolbar_globalMixins.sizeMixin],
  31890. props: {
  31891. loading: Boolean,
  31892. refresh: [Boolean, Object],
  31893. refreshOptions: Object,
  31894. import: [Boolean, Object],
  31895. importOptions: Object,
  31896. export: [Boolean, Object],
  31897. exportOptions: Object,
  31898. print: [Boolean, Object],
  31899. printOptions: Object,
  31900. zoom: [Boolean, Object],
  31901. zoomOptions: Object,
  31902. custom: [Boolean, Object],
  31903. customOptions: Object,
  31904. buttons: {
  31905. type: Array,
  31906. default: () => toolbar_getConfig().toolbar.buttons
  31907. },
  31908. tools: {
  31909. type: Array,
  31910. default: () => toolbar_getConfig().toolbar.tools
  31911. },
  31912. perfect: {
  31913. type: Boolean,
  31914. default: () => toolbar_getConfig().toolbar.perfect
  31915. },
  31916. size: {
  31917. type: String,
  31918. default: () => toolbar_getConfig().toolbar.size || toolbar_getConfig().size
  31919. },
  31920. className: [String, Function]
  31921. },
  31922. inject: {
  31923. $xeGrid: {
  31924. default: null
  31925. },
  31926. $xeGantt: {
  31927. default: null
  31928. }
  31929. },
  31930. data() {
  31931. const xID = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().uniqueId();
  31932. const reactData = {
  31933. isRefresh: false,
  31934. connectFlag: 0,
  31935. columns: []
  31936. };
  31937. const internalData = toolbar_createInternalData();
  31938. return {
  31939. xID,
  31940. reactData,
  31941. internalData
  31942. };
  31943. },
  31944. computed: {
  31945. ...{},
  31946. computeRefreshOpts() {
  31947. const $xeToolbar = this;
  31948. const props = $xeToolbar;
  31949. return Object.assign({}, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().clone(toolbar_getConfig().toolbar.refresh, true), props.refreshOptions, props.refresh);
  31950. },
  31951. computeImportOpts() {
  31952. const $xeToolbar = this;
  31953. const props = $xeToolbar;
  31954. return Object.assign({}, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().clone(toolbar_getConfig().toolbar.import, true), props.importOptions, props.import);
  31955. },
  31956. computeExportOpts() {
  31957. const $xeToolbar = this;
  31958. const props = $xeToolbar;
  31959. return Object.assign({}, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().clone(toolbar_getConfig().toolbar.export, true), props.exportOptions, props.export);
  31960. },
  31961. computePrintOpts() {
  31962. const $xeToolbar = this;
  31963. const props = $xeToolbar;
  31964. return Object.assign({}, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().clone(toolbar_getConfig().toolbar.print, true), props.printOptions, props.print);
  31965. },
  31966. computeZoomOpts() {
  31967. const $xeToolbar = this;
  31968. const props = $xeToolbar;
  31969. return Object.assign({}, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().clone(toolbar_getConfig().toolbar.zoom, true), props.zoomOptions, props.zoom);
  31970. },
  31971. computeCustomOpts() {
  31972. const $xeToolbar = this;
  31973. const props = $xeToolbar;
  31974. return Object.assign({}, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().clone(toolbar_getConfig().toolbar.custom, true), props.customOptions, props.custom);
  31975. },
  31976. computeTableCustomOpts() {
  31977. const $xeToolbar = this;
  31978. const reactData = $xeToolbar.reactData;
  31979. const internalData = $xeToolbar.internalData;
  31980. const {
  31981. connectTable
  31982. } = internalData;
  31983. const $table = connectTable;
  31984. if (reactData.connectFlag || $table) {
  31985. if ($table) {
  31986. return $table.computeCustomOpts;
  31987. }
  31988. }
  31989. return {
  31990. trigger: ''
  31991. };
  31992. },
  31993. computeTrigger() {
  31994. const $xeToolbar = this;
  31995. const tableCustomOpts = $xeToolbar.computeTableCustomOpts;
  31996. return tableCustomOpts.trigger;
  31997. }
  31998. },
  31999. methods: {
  32000. //
  32001. // Method
  32002. //
  32003. dispatchEvent(type, params, evnt) {
  32004. const $xeToolbar = this;
  32005. $xeToolbar.$emit(type, toolbar_createEvent(evnt, {
  32006. $toolbar: $xeToolbar
  32007. }, params));
  32008. },
  32009. fintTable() {
  32010. const {
  32011. $children
  32012. } = this.$parent;
  32013. const selfIndex = $children.indexOf(this);
  32014. return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().find($children, (comp, index) => comp && comp.loadData && index > selfIndex && comp.$vnode.componentOptions.tag === 'vxe-table');
  32015. },
  32016. syncUpdate(params) {
  32017. const $xeToolbar = this;
  32018. const reactData = $xeToolbar.reactData;
  32019. const internalData = $xeToolbar.internalData;
  32020. internalData.connectTable = params.$table;
  32021. reactData.columns = params.collectColumn;
  32022. reactData.connectFlag++;
  32023. },
  32024. checkTable() {
  32025. const $xeToolbar = this;
  32026. const internalData = $xeToolbar.internalData;
  32027. const {
  32028. connectTable
  32029. } = internalData;
  32030. const $table = connectTable;
  32031. if ($table) {
  32032. return true;
  32033. }
  32034. errLog('vxe.error.barUnableLink');
  32035. },
  32036. handleClickSettingEvent({
  32037. $event
  32038. }) {
  32039. const $xeToolbar = this;
  32040. const internalData = $xeToolbar.internalData;
  32041. const {
  32042. connectTable
  32043. } = internalData;
  32044. const $table = connectTable;
  32045. if ($table) {
  32046. if ($table.triggerCustomEvent) {
  32047. $table.triggerCustomEvent($event);
  32048. }
  32049. }
  32050. },
  32051. handleMouseenterSettingEvent({
  32052. $event
  32053. }) {
  32054. const $xeToolbar = this;
  32055. const internalData = $xeToolbar.internalData;
  32056. const {
  32057. connectTable
  32058. } = internalData;
  32059. const $table = connectTable;
  32060. if ($table) {
  32061. $table.customOpenEvent($event);
  32062. }
  32063. },
  32064. handleMouseleaveSettingEvent({
  32065. $event
  32066. }) {
  32067. const $xeToolbar = this;
  32068. const internalData = $xeToolbar.internalData;
  32069. const {
  32070. connectTable
  32071. } = internalData;
  32072. const $table = connectTable;
  32073. if ($table) {
  32074. const {
  32075. customStore
  32076. } = $table.reactData;
  32077. customStore.activeBtn = false;
  32078. setTimeout(() => {
  32079. if (!customStore.activeBtn && !customStore.activeWrapper) {
  32080. $table.customCloseEvent($event);
  32081. }
  32082. }, 350);
  32083. }
  32084. },
  32085. refreshEvent({
  32086. $event
  32087. }) {
  32088. const $xeToolbar = this;
  32089. const reactData = $xeToolbar.reactData;
  32090. const $xeGrid = $xeToolbar.$xeGrid;
  32091. const $xeGantt = $xeToolbar.$xeGantt;
  32092. const $xeGGWrapper = $xeGrid || $xeGantt;
  32093. const {
  32094. isRefresh
  32095. } = reactData;
  32096. const refreshOpts = $xeToolbar.computeRefreshOpts;
  32097. if (!isRefresh) {
  32098. const queryMethod = refreshOpts.queryMethod || refreshOpts.query;
  32099. if (queryMethod) {
  32100. reactData.isRefresh = true;
  32101. try {
  32102. Promise.resolve(queryMethod({})).catch(e => e).then(() => {
  32103. reactData.isRefresh = false;
  32104. });
  32105. } catch (e) {
  32106. reactData.isRefresh = false;
  32107. }
  32108. } else if ($xeGGWrapper) {
  32109. reactData.isRefresh = true;
  32110. $xeGGWrapper.triggerToolbarCommitEvent({
  32111. code: refreshOpts.code || 'reload'
  32112. }, $event).catch(() => {}).then(() => {
  32113. reactData.isRefresh = false;
  32114. });
  32115. }
  32116. }
  32117. },
  32118. zoomEvent({
  32119. $event
  32120. }) {
  32121. const $xeToolbar = this;
  32122. const $xeGrid = $xeToolbar.$xeGrid;
  32123. const $xeGantt = $xeToolbar.$xeGantt;
  32124. const $xeGGWrapper = $xeGrid || $xeGantt;
  32125. if ($xeGGWrapper) {
  32126. $xeGGWrapper.triggerZoomEvent($event);
  32127. } else {
  32128. warnLog('vxe.error.notProp', ['[toolbar] zoom']);
  32129. }
  32130. },
  32131. importEvent() {
  32132. const $xeToolbar = this;
  32133. const internalData = $xeToolbar.internalData;
  32134. if ($xeToolbar.checkTable()) {
  32135. const {
  32136. connectTable
  32137. } = internalData;
  32138. const $table = connectTable;
  32139. if ($table) {
  32140. $table.importData();
  32141. }
  32142. }
  32143. },
  32144. openImportEvent() {
  32145. const $xeToolbar = this;
  32146. const internalData = $xeToolbar.internalData;
  32147. if ($xeToolbar.checkTable()) {
  32148. const {
  32149. connectTable
  32150. } = internalData;
  32151. const $table = connectTable;
  32152. if ($table) {
  32153. $table.openImport();
  32154. }
  32155. }
  32156. },
  32157. exportEvent() {
  32158. const $xeToolbar = this;
  32159. const internalData = $xeToolbar.internalData;
  32160. if ($xeToolbar.checkTable()) {
  32161. const {
  32162. connectTable
  32163. } = internalData;
  32164. const $table = connectTable;
  32165. if ($table) {
  32166. $table.exportData();
  32167. }
  32168. }
  32169. },
  32170. openExportEvent() {
  32171. const $xeToolbar = this;
  32172. const internalData = $xeToolbar.internalData;
  32173. if ($xeToolbar.checkTable()) {
  32174. const {
  32175. connectTable
  32176. } = internalData;
  32177. const $table = connectTable;
  32178. if ($table) {
  32179. $table.openExport();
  32180. }
  32181. }
  32182. },
  32183. printEvent() {
  32184. const $xeToolbar = this;
  32185. const internalData = $xeToolbar.internalData;
  32186. if ($xeToolbar.checkTable()) {
  32187. const {
  32188. connectTable
  32189. } = internalData;
  32190. const $table = connectTable;
  32191. if ($table) {
  32192. $table.print();
  32193. }
  32194. }
  32195. },
  32196. openPrintEvent() {
  32197. const $xeToolbar = this;
  32198. const internalData = $xeToolbar.internalData;
  32199. if ($xeToolbar.checkTable()) {
  32200. const {
  32201. connectTable
  32202. } = internalData;
  32203. const $table = connectTable;
  32204. if ($table) {
  32205. $table.openPrint();
  32206. }
  32207. }
  32208. },
  32209. handleDefaultCodeEvent(eventParams, item, cb) {
  32210. const $xeToolbar = this;
  32211. switch (item.code) {
  32212. case 'print':
  32213. $xeToolbar.printEvent();
  32214. break;
  32215. case 'open_print':
  32216. $xeToolbar.openPrintEvent();
  32217. break;
  32218. case 'custom':
  32219. $xeToolbar.handleClickSettingEvent(eventParams);
  32220. break;
  32221. case 'export':
  32222. $xeToolbar.exportEvent();
  32223. break;
  32224. case 'open_export':
  32225. $xeToolbar.openExportEvent();
  32226. break;
  32227. case 'import':
  32228. $xeToolbar.importEvent();
  32229. break;
  32230. case 'open_import':
  32231. $xeToolbar.openImportEvent();
  32232. break;
  32233. case 'zoom':
  32234. $xeToolbar.zoomEvent(eventParams);
  32235. break;
  32236. case 'refresh':
  32237. $xeToolbar.refreshEvent(eventParams);
  32238. break;
  32239. default:
  32240. cb();
  32241. break;
  32242. }
  32243. },
  32244. btnEvent(eventParams, item) {
  32245. const $xeToolbar = this;
  32246. const internalData = $xeToolbar.internalData;
  32247. const $xeGrid = $xeToolbar.$xeGrid;
  32248. const $xeGantt = $xeToolbar.$xeGantt;
  32249. const $xeGGWrapper = $xeGrid || $xeGantt;
  32250. const {
  32251. $event
  32252. } = eventParams;
  32253. const {
  32254. connectTable
  32255. } = internalData;
  32256. const $table = connectTable;
  32257. const {
  32258. code
  32259. } = item;
  32260. if (code) {
  32261. $xeToolbar.handleDefaultCodeEvent(eventParams, item, () => {
  32262. if ($xeGGWrapper) {
  32263. $xeGGWrapper.triggerToolbarBtnEvent(item, $event);
  32264. } else {
  32265. const gCommandOpts = toolbar_commands.get(code);
  32266. const params = {
  32267. code,
  32268. button: item,
  32269. $table: $table,
  32270. $grid: $xeGrid,
  32271. $gantt: $xeGantt,
  32272. $event
  32273. };
  32274. if (gCommandOpts) {
  32275. const tCommandMethod = gCommandOpts.tableCommandMethod || gCommandOpts.commandMethod;
  32276. if (tCommandMethod) {
  32277. tCommandMethod(params);
  32278. } else {
  32279. errLog('vxe.error.notCommands', [`[toolbar] ${code}`]);
  32280. }
  32281. }
  32282. $xeToolbar.dispatchEvent('button-click', params, $event);
  32283. }
  32284. });
  32285. }
  32286. },
  32287. tolEvent(eventParams, item) {
  32288. const $xeToolbar = this;
  32289. const internalData = $xeToolbar.internalData;
  32290. const $xeGrid = $xeToolbar.$xeGrid;
  32291. const $xeGantt = $xeToolbar.$xeGantt;
  32292. const $xeGGWrapper = $xeGrid || $xeGantt;
  32293. const {
  32294. $event
  32295. } = eventParams;
  32296. const {
  32297. connectTable
  32298. } = internalData;
  32299. const $table = connectTable;
  32300. const {
  32301. code
  32302. } = item;
  32303. if (code) {
  32304. $xeToolbar.handleDefaultCodeEvent(eventParams, item, () => {
  32305. if ($xeGGWrapper) {
  32306. $xeGGWrapper.triggerToolbarTolEvent(item, $event);
  32307. } else {
  32308. const gCommandOpts = toolbar_commands.get(code);
  32309. const params = {
  32310. code,
  32311. button: null,
  32312. tool: item,
  32313. $table: $table,
  32314. $grid: $xeGrid,
  32315. $gantt: $xeGantt,
  32316. $event
  32317. };
  32318. if (gCommandOpts) {
  32319. const tCommandMethod = gCommandOpts.tableCommandMethod || gCommandOpts.commandMethod;
  32320. if (tCommandMethod) {
  32321. tCommandMethod(params);
  32322. } else {
  32323. errLog('vxe.error.notCommands', [`[toolbar] ${code}`]);
  32324. }
  32325. }
  32326. $xeToolbar.dispatchEvent('tool-click', params, $event);
  32327. }
  32328. });
  32329. }
  32330. },
  32331. //
  32332. // Render
  32333. //
  32334. renderDropdowns(h, item, isBtn) {
  32335. // 使用已安装的组件,如果未安装则不渲染
  32336. const VxeUIButtonComponent = core_.VxeUI.getComponent('VxeButton');
  32337. const $xeToolbar = this;
  32338. const {
  32339. dropdowns
  32340. } = item;
  32341. const downVNs = [];
  32342. if (dropdowns) {
  32343. return dropdowns.map((child, index) => {
  32344. if (child.visible === false) {
  32345. return toolbar_renderEmptyElement($xeToolbar);
  32346. }
  32347. return VxeUIButtonComponent ? h(VxeUIButtonComponent, {
  32348. key: index,
  32349. props: Object.assign({}, child, {
  32350. content: child.name,
  32351. options: undefined
  32352. }),
  32353. on: {
  32354. click: eventParams => isBtn ? $xeToolbar.btnEvent(eventParams, child) : $xeToolbar.tolEvent(eventParams, child)
  32355. }
  32356. }) : toolbar_renderEmptyElement($xeToolbar);
  32357. });
  32358. }
  32359. return downVNs;
  32360. },
  32361. /**
  32362. * 渲染按钮
  32363. */
  32364. renderLeftBtns(h) {
  32365. // 使用已安装的组件,如果未安装则不渲染
  32366. const VxeUIButtonComponent = core_.VxeUI.getComponent('VxeButton');
  32367. const $xeToolbar = this;
  32368. const props = $xeToolbar;
  32369. const slots = $xeToolbar.$scopedSlots;
  32370. const internalData = $xeToolbar.internalData;
  32371. const $xeGrid = $xeToolbar.$xeGrid;
  32372. const $xeGantt = $xeToolbar.$xeGantt;
  32373. const {
  32374. buttons
  32375. } = props;
  32376. const {
  32377. connectTable
  32378. } = internalData;
  32379. const $table = connectTable;
  32380. const buttonPrefixSlot = slots.buttonPrefix || slots['button-prefix'];
  32381. const buttonSuffixSlot = slots.buttonSuffix || slots['button-suffix'];
  32382. const btnVNs = [];
  32383. if (buttonPrefixSlot) {
  32384. btnVNs.push(...getSlotVNs(buttonPrefixSlot.call($xeToolbar, {
  32385. buttons: buttons || [],
  32386. $grid: $xeGrid,
  32387. $gantt: $xeGantt,
  32388. $table: $table
  32389. })));
  32390. }
  32391. if (buttons) {
  32392. buttons.forEach(item => {
  32393. const {
  32394. dropdowns,
  32395. buttonRender
  32396. } = item;
  32397. if (item.visible !== false) {
  32398. const compConf = buttonRender ? toolbar_renderer.get(buttonRender.name) : null;
  32399. if (buttonRender && compConf && compConf.renderToolbarButton) {
  32400. const toolbarButtonClassName = compConf.toolbarButtonClassName;
  32401. const params = {
  32402. $grid: $xeGrid,
  32403. $gantt: $xeGantt,
  32404. $table: $table,
  32405. button: item
  32406. };
  32407. btnVNs.push(h('span', {
  32408. class: ['vxe-button--item', toolbarButtonClassName ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(toolbarButtonClassName) ? toolbarButtonClassName(params) : toolbarButtonClassName : '']
  32409. }, getSlotVNs(compConf.renderToolbarButton(h, buttonRender, params))));
  32410. } else {
  32411. if (VxeUIButtonComponent) {
  32412. btnVNs.push(h(VxeUIButtonComponent, {
  32413. props: Object.assign({}, item, {
  32414. content: item.name,
  32415. options: undefined
  32416. }),
  32417. on: {
  32418. click: eventParams => $xeToolbar.btnEvent(eventParams, item)
  32419. },
  32420. scopedSlots: dropdowns && dropdowns.length ? {
  32421. dropdowns: () => $xeToolbar.renderDropdowns(h, item, true)
  32422. } : {}
  32423. }));
  32424. }
  32425. }
  32426. }
  32427. });
  32428. }
  32429. if (buttonSuffixSlot) {
  32430. btnVNs.push(...getSlotVNs(buttonSuffixSlot.call($xeToolbar, {
  32431. buttons: buttons || [],
  32432. $grid: $xeGrid,
  32433. $gantt: $xeGantt,
  32434. $table: $table
  32435. })));
  32436. }
  32437. return btnVNs;
  32438. },
  32439. /**
  32440. * 渲染右侧工具
  32441. */
  32442. renderRightTools(h) {
  32443. // 使用已安装的组件,如果未安装则不渲染
  32444. const VxeUIButtonComponent = core_.VxeUI.getComponent('VxeButton');
  32445. const $xeToolbar = this;
  32446. const props = $xeToolbar;
  32447. const slots = $xeToolbar.$scopedSlots;
  32448. const internalData = $xeToolbar.internalData;
  32449. const $xeGrid = $xeToolbar.$xeGrid;
  32450. const $xeGantt = $xeToolbar.$xeGantt;
  32451. const {
  32452. tools
  32453. } = props;
  32454. const {
  32455. connectTable
  32456. } = internalData;
  32457. const $table = connectTable;
  32458. const toolPrefixSlot = slots.toolPrefix || slots['tool-prefix'];
  32459. const toolSuffixSlot = slots.toolSuffix || slots['tool-suffix'];
  32460. const btnVNs = [];
  32461. if (toolPrefixSlot) {
  32462. btnVNs.push(...getSlotVNs(toolPrefixSlot.call($xeToolbar, {
  32463. tools: tools || [],
  32464. $grid: $xeGrid,
  32465. $gantt: $xeGantt,
  32466. $table: $table
  32467. })));
  32468. }
  32469. if (tools) {
  32470. tools.forEach((item, tIndex) => {
  32471. const {
  32472. dropdowns,
  32473. toolRender
  32474. } = item;
  32475. if (item.visible !== false) {
  32476. const rdName = toolRender ? toolRender.name : null;
  32477. const compConf = toolRender ? toolbar_renderer.get(rdName) : null;
  32478. if (toolRender && compConf && compConf.renderToolbarTool) {
  32479. const toolbarToolClassName = compConf.toolbarToolClassName;
  32480. const params = {
  32481. $grid: $xeGrid,
  32482. $gantt: $xeGantt,
  32483. $table: $table,
  32484. tool: item
  32485. };
  32486. btnVNs.push(h('span', {
  32487. key: rdName,
  32488. class: ['vxe-tool--item', toolbarToolClassName ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(toolbarToolClassName) ? toolbarToolClassName(params) : toolbarToolClassName : '']
  32489. }, getSlotVNs(compConf.renderToolbarTool(h, toolRender, params))));
  32490. } else {
  32491. if (VxeUIButtonComponent) {
  32492. btnVNs.push(h(VxeUIButtonComponent, {
  32493. key: tIndex,
  32494. props: Object.assign({}, item, {
  32495. content: item.name,
  32496. options: undefined
  32497. }),
  32498. on: {
  32499. click: eventParams => $xeToolbar.tolEvent(eventParams, item)
  32500. },
  32501. scopedSlots: dropdowns && dropdowns.length ? {
  32502. dropdowns: () => $xeToolbar.renderDropdowns(h, item, false)
  32503. } : {}
  32504. }));
  32505. }
  32506. }
  32507. }
  32508. });
  32509. }
  32510. if (toolSuffixSlot) {
  32511. btnVNs.push(...getSlotVNs(toolSuffixSlot.call($xeToolbar, {
  32512. tools: tools || [],
  32513. $grid: $xeGrid,
  32514. $gantt: $xeGantt,
  32515. $table: $table
  32516. })));
  32517. }
  32518. return btnVNs;
  32519. },
  32520. renderToolImport(h) {
  32521. // 使用已安装的组件,如果未安装则不渲染
  32522. const VxeUIButtonComponent = core_.VxeUI.getComponent('VxeButton');
  32523. const $xeToolbar = this;
  32524. const importOpts = $xeToolbar.computeImportOpts;
  32525. return VxeUIButtonComponent ? h(VxeUIButtonComponent, {
  32526. key: 'import',
  32527. props: {
  32528. circle: true,
  32529. icon: importOpts.icon || toolbar_getIcon().TOOLBAR_TOOLS_IMPORT,
  32530. title: toolbar_getI18n('vxe.toolbar.import')
  32531. },
  32532. on: {
  32533. click: $xeToolbar.openImportEvent
  32534. }
  32535. }) : toolbar_renderEmptyElement($xeToolbar);
  32536. },
  32537. renderToolExport(h) {
  32538. // 使用已安装的组件,如果未安装则不渲染
  32539. const VxeUIButtonComponent = core_.VxeUI.getComponent('VxeButton');
  32540. const $xeToolbar = this;
  32541. const exportOpts = $xeToolbar.computeExportOpts;
  32542. return VxeUIButtonComponent ? h(VxeUIButtonComponent, {
  32543. key: 'export',
  32544. props: {
  32545. circle: true,
  32546. icon: exportOpts.icon || toolbar_getIcon().TOOLBAR_TOOLS_EXPORT,
  32547. title: toolbar_getI18n('vxe.toolbar.export')
  32548. },
  32549. on: {
  32550. click: $xeToolbar.openExportEvent
  32551. }
  32552. }) : toolbar_renderEmptyElement($xeToolbar);
  32553. },
  32554. renderToolPrint(h) {
  32555. // 使用已安装的组件,如果未安装则不渲染
  32556. const VxeUIButtonComponent = core_.VxeUI.getComponent('VxeButton');
  32557. const $xeToolbar = this;
  32558. const printOpts = $xeToolbar.computePrintOpts;
  32559. return VxeUIButtonComponent ? h(VxeUIButtonComponent, {
  32560. key: 'print',
  32561. props: {
  32562. circle: true,
  32563. icon: printOpts.icon || toolbar_getIcon().TOOLBAR_TOOLS_PRINT,
  32564. title: toolbar_getI18n('vxe.toolbar.print')
  32565. },
  32566. on: {
  32567. click: $xeToolbar.openPrintEvent
  32568. }
  32569. }) : toolbar_renderEmptyElement($xeToolbar);
  32570. },
  32571. renderToolRefresh(h) {
  32572. // 使用已安装的组件,如果未安装则不渲染
  32573. const VxeUIButtonComponent = core_.VxeUI.getComponent('VxeButton');
  32574. const $xeToolbar = this;
  32575. const reactData = $xeToolbar.reactData;
  32576. const refreshOpts = $xeToolbar.computeRefreshOpts;
  32577. return VxeUIButtonComponent ? h(VxeUIButtonComponent, {
  32578. key: 'refresh',
  32579. props: {
  32580. circle: true,
  32581. icon: reactData.isRefresh ? refreshOpts.iconLoading || toolbar_getIcon().TOOLBAR_TOOLS_REFRESH_LOADING : refreshOpts.icon || toolbar_getIcon().TOOLBAR_TOOLS_REFRESH,
  32582. title: toolbar_getI18n('vxe.toolbar.refresh')
  32583. },
  32584. on: {
  32585. click: $xeToolbar.refreshEvent
  32586. }
  32587. }) : toolbar_renderEmptyElement($xeToolbar);
  32588. },
  32589. renderToolZoom(h) {
  32590. // 使用已安装的组件,如果未安装则不渲染
  32591. const VxeUIButtonComponent = core_.VxeUI.getComponent('VxeButton');
  32592. const $xeToolbar = this;
  32593. const $xeGrid = $xeToolbar.$xeGrid;
  32594. const $xeGantt = $xeToolbar.$xeGantt;
  32595. const $xeGGWrapper = $xeGrid || $xeGantt;
  32596. const zoomOpts = $xeToolbar.computeZoomOpts;
  32597. return $xeGGWrapper && VxeUIButtonComponent ? h(VxeUIButtonComponent, {
  32598. key: 'zoom',
  32599. props: {
  32600. circle: true,
  32601. icon: $xeGGWrapper.isMaximized() ? zoomOpts.iconOut || toolbar_getIcon().TOOLBAR_TOOLS_MINIMIZE : zoomOpts.iconIn || toolbar_getIcon().TOOLBAR_TOOLS_FULLSCREEN,
  32602. title: toolbar_getI18n(`vxe.toolbar.zoom${$xeGGWrapper.isMaximized() ? 'Out' : 'In'}`)
  32603. },
  32604. on: {
  32605. click: $xeToolbar.zoomEvent
  32606. }
  32607. }) : toolbar_renderEmptyElement($xeToolbar);
  32608. },
  32609. renderToolCustom(h) {
  32610. // 使用已安装的组件,如果未安装则不渲染
  32611. const VxeUIButtonComponent = core_.VxeUI.getComponent('VxeButton');
  32612. const $xeToolbar = this;
  32613. const customOpts = $xeToolbar.computeCustomOpts;
  32614. const btnTrigger = $xeToolbar.computeTrigger;
  32615. const customBtnOns = {};
  32616. if (btnTrigger === 'manual') {
  32617. // 手动触发
  32618. } else if (btnTrigger === 'hover') {
  32619. // hover 触发
  32620. customBtnOns.mouseenter = $xeToolbar.handleMouseenterSettingEvent;
  32621. customBtnOns.mouseleave = $xeToolbar.handleMouseleaveSettingEvent;
  32622. } else {
  32623. // 点击触发
  32624. customBtnOns.click = $xeToolbar.handleClickSettingEvent;
  32625. }
  32626. return VxeUIButtonComponent ? h(VxeUIButtonComponent, {
  32627. key: 'custom',
  32628. props: {
  32629. circle: true,
  32630. icon: customOpts.icon || toolbar_getIcon().TOOLBAR_TOOLS_CUSTOM,
  32631. title: toolbar_getI18n('vxe.toolbar.custom'),
  32632. className: 'vxe-toolbar-custom-target'
  32633. },
  32634. on: customBtnOns
  32635. }) : toolbar_renderEmptyElement($xeToolbar);
  32636. },
  32637. renderVN(h) {
  32638. const $xeToolbar = this;
  32639. const props = $xeToolbar;
  32640. const slots = $xeToolbar.$scopedSlots;
  32641. const internalData = $xeToolbar.internalData;
  32642. const $xeGrid = $xeToolbar.$xeGrid;
  32643. const $xeGantt = $xeToolbar.$xeGantt;
  32644. const $xeGGWrapper = $xeGrid || $xeGantt;
  32645. const {
  32646. perfect,
  32647. loading,
  32648. refresh,
  32649. zoom,
  32650. custom,
  32651. className
  32652. } = props;
  32653. const {
  32654. connectTable
  32655. } = internalData;
  32656. const $table = connectTable;
  32657. const toolsSlot = slots.tools;
  32658. const buttonsSlot = slots.buttons;
  32659. const vSize = $xeToolbar.computeSize;
  32660. return h('div', {
  32661. ref: 'refElem',
  32662. class: ['vxe-toolbar', className ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(className) ? className({
  32663. $toolbar: $xeToolbar
  32664. }) : className : '', {
  32665. [`size--${vSize}`]: vSize,
  32666. 'is--perfect': perfect,
  32667. 'is--loading': loading
  32668. }]
  32669. }, [h('div', {
  32670. class: 'vxe-buttons--wrapper'
  32671. }, buttonsSlot ? buttonsSlot({
  32672. $grid: $xeGrid,
  32673. $gantt: $xeGantt,
  32674. $table: $table
  32675. }) : $xeToolbar.renderLeftBtns(h)), h('div', {
  32676. class: 'vxe-tools--wrapper'
  32677. }, toolsSlot ? toolsSlot({
  32678. $grid: $xeGrid,
  32679. $gantt: $xeGantt,
  32680. $table: $table
  32681. }) : $xeToolbar.renderRightTools(h)), h('div', {
  32682. class: 'vxe-tools--operate'
  32683. }, [props.import ? $xeToolbar.renderToolImport(h) : toolbar_renderEmptyElement($xeToolbar), props.export ? $xeToolbar.renderToolExport(h) : toolbar_renderEmptyElement($xeToolbar), props.print ? $xeToolbar.renderToolPrint(h) : toolbar_renderEmptyElement($xeToolbar), refresh ? $xeToolbar.renderToolRefresh(h) : toolbar_renderEmptyElement($xeToolbar), zoom && $xeGGWrapper ? $xeToolbar.renderToolZoom(h) : toolbar_renderEmptyElement($xeToolbar), custom ? $xeToolbar.renderToolCustom(h) : toolbar_renderEmptyElement($xeToolbar)])]);
  32684. }
  32685. },
  32686. created() {
  32687. const $xeToolbar = this;
  32688. const props = $xeToolbar;
  32689. const $xeGrid = $xeToolbar.$xeGrid;
  32690. const $xeGantt = $xeToolbar.$xeGantt;
  32691. const $xeGGWrapper = $xeGrid || $xeGantt;
  32692. $xeToolbar.$nextTick(() => {
  32693. const refreshOpts = $xeToolbar.computeRefreshOpts;
  32694. const $xeTable = $xeToolbar.fintTable();
  32695. const queryMethod = refreshOpts.queryMethod || refreshOpts.query;
  32696. if (props.refresh && !$xeGGWrapper && !queryMethod) {
  32697. warnLog('vxe.error.notFunc', ['[toolbar] queryMethod']);
  32698. }
  32699. if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isPlainObject(props.custom)) {
  32700. warnLog('vxe.error.delProp', ['[toolbar] custom={...}', 'custom=boolean & custom-options={...}']);
  32701. }
  32702. if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isPlainObject(props.print)) {
  32703. warnLog('vxe.error.delProp', ['[toolbar] print={...}', 'print=boolean & print-options={...}']);
  32704. }
  32705. if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isPlainObject(props.export)) {
  32706. warnLog('vxe.error.delProp', ['[toolbar] export={...}', 'export=boolean & export-options={...}']);
  32707. }
  32708. if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isPlainObject(props.import)) {
  32709. warnLog('vxe.error.delProp', ['[toolbar] import={...}', 'import=boolean & import-options={...}']);
  32710. }
  32711. if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isPlainObject(props.refresh)) {
  32712. warnLog('vxe.error.delProp', ['[toolbar] refresh={...}', 'refresh=boolean & refresh-options={...}']);
  32713. }
  32714. if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isPlainObject(props.refresh)) {
  32715. warnLog('vxe.error.delProp', ['[toolbar] zoom={...}', 'zoom=boolean & zoom-options={...}']);
  32716. }
  32717. if ($xeTable) {
  32718. $xeTable.connect(this);
  32719. }
  32720. const customOpts = $xeToolbar.computeCustomOpts;
  32721. if (customOpts.isFooter) {
  32722. warnLog('vxe.error.delProp', ['[toolbar] toolbar.custom.isFooter', 'table.custom-config.showFooter']);
  32723. }
  32724. if (customOpts.showFooter) {
  32725. warnLog('vxe.error.delProp', ['[toolbar] toolbar.custom.showFooter', 'table.custom-config.showFooter']);
  32726. }
  32727. if (customOpts.immediate) {
  32728. warnLog('vxe.error.delProp', ['[toolbar] toolbar.custom.immediate', 'table.custom-config.immediate']);
  32729. }
  32730. if (customOpts.trigger) {
  32731. warnLog('vxe.error.delProp', ['[toolbar] toolbar.custom.trigger', 'table.custom-config.trigger']);
  32732. }
  32733. });
  32734. // 使用已安装的组件,如果未安装则不渲染
  32735. const VxeUIButtonComponent = core_.VxeUI.getComponent('VxeButton');
  32736. if (props.refresh || props.import || props.export || props.print || props.zoom) {
  32737. if (!VxeUIButtonComponent) {
  32738. errLog('vxe.error.reqComp', ['vxe-button']);
  32739. }
  32740. }
  32741. },
  32742. destroyed() {
  32743. const $xeToolbar = this;
  32744. const internalData = $xeToolbar.internalData;
  32745. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().assign(internalData, toolbar_createInternalData());
  32746. },
  32747. render(h) {
  32748. return this.renderVN(h);
  32749. }
  32750. })); /* define-vxe-component end */
  32751. ;// CONCATENATED MODULE: ./packages/grid/src/grid.ts
  32752. const {
  32753. getConfig: grid_getConfig,
  32754. getI18n: grid_getI18n,
  32755. commands: grid_commands,
  32756. globalEvents: grid_globalEvents,
  32757. globalMixins: grid_globalMixins,
  32758. createEvent: grid_createEvent,
  32759. GLOBAL_EVENT_KEYS: grid_GLOBAL_EVENT_KEYS,
  32760. renderEmptyElement: grid_renderEmptyElement
  32761. } = core_.VxeUI;
  32762. const tableMethods = {};
  32763. const propKeys = Object.keys(tableProps);
  32764. const defaultLayouts = [['Form'], ['Toolbar', 'Top', 'Table', 'Bottom', 'Pager']];
  32765. function getTableOns(_vm) {
  32766. const {
  32767. $listeners,
  32768. proxyConfig,
  32769. proxyOpts
  32770. } = _vm;
  32771. const ons = {};
  32772. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each($listeners, (cb, type) => {
  32773. ons[type] = (...args) => {
  32774. _vm.$emit(type, ...args);
  32775. };
  32776. });
  32777. if (proxyConfig) {
  32778. if (proxyOpts.sort) {
  32779. ons['sort-change'] = _vm.sortChangeEvent;
  32780. ons['clear-all-sort'] = _vm.clearAllSortEvent;
  32781. }
  32782. if (proxyOpts.filter) {
  32783. ons['filter-change'] = _vm.filterChangeEvent;
  32784. ons['clear-all-filter'] = _vm.clearAllFilterEvent;
  32785. }
  32786. }
  32787. return ons;
  32788. }
  32789. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(table.methods, (fn, name) => {
  32790. tableMethods[name] = function (...args) {
  32791. const $xeGrid = this;
  32792. const $xeTable = $xeGrid.$refs.refTable;
  32793. return $xeTable && $xeTable[name](...args);
  32794. };
  32795. });
  32796. function grid_createInternalData() {
  32797. return {};
  32798. }
  32799. /* harmony default export */ var grid = (/* define-vxe-component start */defineVxeComponent({
  32800. name: 'VxeGrid',
  32801. mixins: [grid_globalMixins.sizeMixin],
  32802. props: {
  32803. ...tableProps,
  32804. layouts: Array,
  32805. columns: Array,
  32806. pagerConfig: Object,
  32807. proxyConfig: Object,
  32808. toolbarConfig: Object,
  32809. formConfig: Object,
  32810. zoomConfig: Object,
  32811. size: {
  32812. type: String,
  32813. default: () => grid_getConfig().grid.size || grid_getConfig().size
  32814. }
  32815. },
  32816. provide() {
  32817. const $xeGrid = this;
  32818. const $xeGantt = null;
  32819. return {
  32820. $xeGrid,
  32821. $xeGantt
  32822. };
  32823. },
  32824. data() {
  32825. const xID = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().uniqueId();
  32826. const reactData = {
  32827. tableLoading: false,
  32828. proxyInited: false,
  32829. isZMax: false,
  32830. tableData: [],
  32831. filterData: [],
  32832. formData: {},
  32833. sortData: [],
  32834. tZindex: 0,
  32835. tablePage: {
  32836. total: 0,
  32837. pageSize: grid_getConfig().pager?.pageSize || 10,
  32838. currentPage: 1
  32839. }
  32840. };
  32841. const internalData = grid_createInternalData();
  32842. return {
  32843. xID,
  32844. reactData,
  32845. internalData
  32846. };
  32847. },
  32848. computed: {
  32849. ...{},
  32850. isRespMsg() {
  32851. const $xeGrid = this;
  32852. return $xeGrid.computeIsRespMsg;
  32853. },
  32854. computeIsRespMsg() {
  32855. const $xeGrid = this;
  32856. const proxyOpts = $xeGrid.computeProxyOpts;
  32857. return !!(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isBoolean(proxyOpts.message) ? proxyOpts.message : proxyOpts.showResponseMsg);
  32858. },
  32859. isActiveMsg() {
  32860. const $xeGrid = this;
  32861. return $xeGrid.computeIsActiveMsg;
  32862. },
  32863. computeIsActiveMsg() {
  32864. const $xeGrid = this;
  32865. const proxyOpts = $xeGrid.computeProxyOpts;
  32866. return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isBoolean(proxyOpts.showActionMsg) ? proxyOpts.showActionMsg : !!proxyOpts.showActiveMsg;
  32867. },
  32868. proxyOpts() {
  32869. const $xeGrid = this;
  32870. return $xeGrid.computeProxyOpts;
  32871. },
  32872. computeProxyOpts() {
  32873. const $xeGrid = this;
  32874. const props = $xeGrid;
  32875. return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().merge({}, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().clone(grid_getConfig().grid.proxyConfig, true), props.proxyConfig);
  32876. },
  32877. pagerOpts() {
  32878. const $xeGrid = this;
  32879. return $xeGrid.computePagerOpts;
  32880. },
  32881. computePagerOpts() {
  32882. const $xeGrid = this;
  32883. const props = $xeGrid;
  32884. return Object.assign({}, grid_getConfig().grid.pagerConfig, props.pagerConfig);
  32885. },
  32886. formOpts() {
  32887. const $xeGrid = this;
  32888. return $xeGrid.computeFormOpts;
  32889. },
  32890. computeFormOpts() {
  32891. const $xeGrid = this;
  32892. const props = $xeGrid;
  32893. return Object.assign({}, grid_getConfig().grid.formConfig, props.formConfig);
  32894. },
  32895. toolbarOpts() {
  32896. const $xeGrid = this;
  32897. return $xeGrid.computeToolbarOpts;
  32898. },
  32899. computeToolbarOpts() {
  32900. const $xeGrid = this;
  32901. const props = $xeGrid;
  32902. return Object.assign({}, grid_getConfig().grid.toolbarConfig, props.toolbarConfig);
  32903. },
  32904. zoomOpts() {
  32905. const $xeGrid = this;
  32906. return $xeGrid.computeZoomOpts;
  32907. },
  32908. computeZoomOpts() {
  32909. const $xeGrid = this;
  32910. const props = $xeGrid;
  32911. return Object.assign({}, grid_getConfig().grid.zoomConfig, props.zoomConfig);
  32912. },
  32913. computeStyles() {
  32914. const $xeGrid = this;
  32915. const props = $xeGrid;
  32916. const reactData = $xeGrid.reactData;
  32917. const {
  32918. height,
  32919. maxHeight
  32920. } = props;
  32921. const {
  32922. isZMax,
  32923. tZindex
  32924. } = reactData;
  32925. const stys = {};
  32926. if (isZMax) {
  32927. stys.zIndex = tZindex;
  32928. } else {
  32929. if (height) {
  32930. stys.height = height === 'auto' || height === '100%' ? '100%' : toCssUnit(height);
  32931. }
  32932. if (maxHeight) {
  32933. stys.maxHeight = maxHeight === 'auto' || maxHeight === '100%' ? '100%' : toCssUnit(maxHeight);
  32934. }
  32935. }
  32936. return stys;
  32937. },
  32938. computeTableExtendProps() {
  32939. const $xeGrid = this;
  32940. const props = $xeGrid;
  32941. const rest = {};
  32942. const gridProps = props;
  32943. propKeys.forEach(key => {
  32944. rest[key] = gridProps[key];
  32945. });
  32946. return rest;
  32947. },
  32948. computeTableProps() {
  32949. const $xeGrid = this;
  32950. const props = $xeGrid;
  32951. const reactData = $xeGrid.reactData;
  32952. const {
  32953. seqConfig,
  32954. pagerConfig,
  32955. editConfig,
  32956. proxyConfig
  32957. } = props;
  32958. const {
  32959. isZMax,
  32960. tablePage
  32961. } = reactData;
  32962. const tableExtendProps = $xeGrid.computeTableExtendProps;
  32963. const proxyOpts = $xeGrid.computeProxyOpts;
  32964. const pagerOpts = $xeGrid.computePagerOpts;
  32965. const isLoading = $xeGrid.computeIsLoading;
  32966. const tProps = Object.assign({}, tableExtendProps);
  32967. if (isZMax) {
  32968. if (tableExtendProps.maxHeight) {
  32969. tProps.maxHeight = '100%';
  32970. } else {
  32971. tProps.height = '100%';
  32972. }
  32973. }
  32974. if (proxyConfig && isEnableConf(proxyOpts)) {
  32975. tProps.loading = isLoading;
  32976. if (pagerConfig && proxyOpts.seq && isEnableConf(pagerOpts)) {
  32977. tProps.seqConfig = Object.assign({}, seqConfig, {
  32978. startIndex: (tablePage.currentPage - 1) * tablePage.pageSize
  32979. });
  32980. }
  32981. }
  32982. if (editConfig) {
  32983. tProps.editConfig = Object.assign({}, editConfig);
  32984. }
  32985. return tProps;
  32986. },
  32987. tableProps() {
  32988. const $xeGrid = this;
  32989. return $xeGrid.computeTableProps;
  32990. },
  32991. computeCurrLayoutConf() {
  32992. const $xeGrid = this;
  32993. const props = $xeGrid;
  32994. const {
  32995. layouts
  32996. } = props;
  32997. let confs = [];
  32998. if (layouts && layouts.length) {
  32999. confs = layouts;
  33000. } else {
  33001. confs = grid_getConfig().grid.layouts || defaultLayouts;
  33002. }
  33003. let headKeys = [];
  33004. let bodyKeys = [];
  33005. let footKeys = [];
  33006. if (confs.length) {
  33007. if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(confs[0])) {
  33008. headKeys = confs[0];
  33009. bodyKeys = confs[1] || [];
  33010. footKeys = confs[2] || [];
  33011. } else {
  33012. bodyKeys = confs;
  33013. }
  33014. }
  33015. return {
  33016. headKeys,
  33017. bodyKeys,
  33018. footKeys
  33019. };
  33020. },
  33021. computeCustomCurrentPageFlag() {
  33022. const $xeGrid = this;
  33023. const pagerOpts = $xeGrid.computePagerOpts;
  33024. return pagerOpts.currentPage;
  33025. },
  33026. computeCustomPageSizeFlag() {
  33027. const $xeGrid = this;
  33028. const pagerOpts = $xeGrid.computePagerOpts;
  33029. return pagerOpts.pageSize;
  33030. },
  33031. computeCustomTotalFlag() {
  33032. const $xeGrid = this;
  33033. const pagerOpts = $xeGrid.computePagerOpts;
  33034. return pagerOpts.total;
  33035. },
  33036. computePageCount() {
  33037. const $xeGrid = this;
  33038. const reactData = $xeGrid.reactData;
  33039. const {
  33040. tablePage
  33041. } = reactData;
  33042. return Math.max(Math.ceil(tablePage.total / tablePage.pageSize), 1);
  33043. },
  33044. computeIsLoading() {
  33045. const $xeGrid = this;
  33046. const props = $xeGrid;
  33047. const reactData = $xeGrid.reactData;
  33048. const {
  33049. loading,
  33050. proxyConfig
  33051. } = props;
  33052. const {
  33053. tableLoading
  33054. } = reactData;
  33055. const proxyOpts = $xeGrid.computeProxyOpts;
  33056. const {
  33057. showLoading
  33058. } = proxyOpts;
  33059. return loading || tableLoading && showLoading && proxyConfig && isEnableConf(proxyOpts);
  33060. }
  33061. },
  33062. watch: {
  33063. columns(value) {
  33064. const $xeGrid = this;
  33065. $xeGrid.$nextTick(() => $xeGrid.loadColumn(value));
  33066. },
  33067. toolbar(value) {
  33068. const $xeGrid = this;
  33069. if (value) {
  33070. $xeGrid.initToolbar();
  33071. }
  33072. },
  33073. toolbarConfig(value) {
  33074. const $xeGrid = this;
  33075. if (value) {
  33076. $xeGrid.initToolbar();
  33077. }
  33078. },
  33079. proxyConfig() {
  33080. const $xeGrid = this;
  33081. $xeGrid.initProxy();
  33082. },
  33083. computeCustomCurrentPageFlag() {
  33084. const $xeGrid = this;
  33085. $xeGrid.initPages('currentPage');
  33086. },
  33087. computeCustomPageSizeFlag() {
  33088. const $xeGrid = this;
  33089. $xeGrid.initPages('pageSize');
  33090. },
  33091. computeCustomTotalFlag() {
  33092. const $xeGrid = this;
  33093. $xeGrid.initPages('total');
  33094. }
  33095. },
  33096. methods: {
  33097. ...tableMethods,
  33098. dispatchEvent(type, params, evnt) {
  33099. const $xeGrid = this;
  33100. $xeGrid.$emit(type, grid_createEvent(evnt, {
  33101. $grid: $xeGrid,
  33102. $gantt: null
  33103. }, params));
  33104. },
  33105. initPages(propKey) {
  33106. const $xeGrid = this;
  33107. const props = $xeGrid;
  33108. const reactData = $xeGrid.reactData;
  33109. const {
  33110. tablePage
  33111. } = reactData;
  33112. const {
  33113. pagerConfig
  33114. } = props;
  33115. const pagerOpts = $xeGrid.computePagerOpts;
  33116. if (pagerConfig && isEnableConf(pagerOpts)) {
  33117. if (propKey) {
  33118. if (pagerOpts[propKey]) {
  33119. tablePage[propKey] = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(pagerOpts[propKey]);
  33120. }
  33121. } else {
  33122. const {
  33123. currentPage,
  33124. pageSize,
  33125. total
  33126. } = pagerOpts;
  33127. if (currentPage) {
  33128. tablePage.currentPage = currentPage;
  33129. }
  33130. if (pageSize) {
  33131. tablePage.pageSize = pageSize;
  33132. }
  33133. if (total) {
  33134. tablePage.total = total;
  33135. }
  33136. }
  33137. }
  33138. },
  33139. callSlot(slotFunc, params, h) {
  33140. const $xeGrid = this;
  33141. const slots = $xeGrid.$scopedSlots;
  33142. if (slotFunc) {
  33143. if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(slotFunc)) {
  33144. slotFunc = slots[slotFunc] || null;
  33145. }
  33146. if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(slotFunc)) {
  33147. return getSlotVNs(slotFunc.call(this, params, h));
  33148. }
  33149. }
  33150. return [];
  33151. },
  33152. getEl() {
  33153. const $xeGrid = this;
  33154. return $xeGrid.$refs.refElem;
  33155. },
  33156. /**
  33157. * 获取需要排除的高度
  33158. */
  33159. getExcludeHeight() {
  33160. const $xeGrid = this;
  33161. const props = $xeGrid;
  33162. const reactData = $xeGrid.reactData;
  33163. const {
  33164. height
  33165. } = props;
  33166. const {
  33167. isZMax
  33168. } = reactData;
  33169. const el = $xeGrid.$refs.refElem;
  33170. if (el) {
  33171. const formWrapper = $xeGrid.$refs.refFormWrapper;
  33172. const toolbarWrapper = $xeGrid.$refs.refToolbarWrapper;
  33173. const topWrapper = $xeGrid.$refs.refTopWrapper;
  33174. const bottomWrapper = $xeGrid.$refs.refBottomWrapper;
  33175. const pagerWrapper = $xeGrid.$refs.refPagerWrapper;
  33176. const parentEl = el.parentElement;
  33177. let parentPaddingSize = 0;
  33178. if (parentEl && (height === '100%' || height === 'auto')) {
  33179. parentPaddingSize = isZMax ? 0 : getPaddingTopBottomSize(parentEl);
  33180. }
  33181. return parentPaddingSize + getPaddingTopBottomSize(el) + getOffsetHeight(formWrapper) + getOffsetHeight(toolbarWrapper) + getOffsetHeight(topWrapper) + getOffsetHeight(bottomWrapper) + getOffsetHeight(pagerWrapper);
  33182. }
  33183. return 0;
  33184. },
  33185. getParentHeight() {
  33186. const $xeGrid = this;
  33187. const reactData = $xeGrid.reactData;
  33188. const el = $xeGrid.$refs.refElem;
  33189. if (el) {
  33190. const parentEl = el.parentElement;
  33191. return (reactData.isZMax ? getDomNode().visibleHeight : parentEl ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(getComputedStyle(parentEl).height) : 0) - $xeGrid.getExcludeHeight();
  33192. }
  33193. return 0;
  33194. },
  33195. initToolbar() {
  33196. const $xeGrid = this;
  33197. $xeGrid.$nextTick(() => {
  33198. const $xeTable = $xeGrid.$refs.refTable;
  33199. const $xeToolbar = $xeGrid.$refs.refToolbar;
  33200. if ($xeTable && $xeToolbar) {
  33201. $xeTable.connectToolbar($xeToolbar);
  33202. }
  33203. });
  33204. },
  33205. getDefaultFormData() {
  33206. const $xeGrid = this;
  33207. const formOpts = $xeGrid.computeFormOpts;
  33208. if (formOpts.items) {
  33209. const fData = {};
  33210. formOpts.items.forEach(item => {
  33211. const {
  33212. field,
  33213. itemRender
  33214. } = item;
  33215. if (field) {
  33216. let itemValue = null;
  33217. if (itemRender) {
  33218. const {
  33219. startField,
  33220. endField,
  33221. defaultValue
  33222. } = itemRender;
  33223. if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(defaultValue)) {
  33224. itemValue = defaultValue({
  33225. item
  33226. });
  33227. } else if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isUndefined(defaultValue)) {
  33228. itemValue = defaultValue;
  33229. }
  33230. if (startField && endField) {
  33231. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(fData, startField, null);
  33232. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(fData, endField, null);
  33233. }
  33234. }
  33235. fData[field] = itemValue;
  33236. }
  33237. });
  33238. return fData;
  33239. }
  33240. return {};
  33241. },
  33242. initProxy() {
  33243. const $xeGrid = this;
  33244. const props = $xeGrid;
  33245. const reactData = $xeGrid.reactData;
  33246. const {
  33247. proxyConfig,
  33248. formConfig
  33249. } = props;
  33250. const {
  33251. proxyInited
  33252. } = reactData;
  33253. const proxyOpts = $xeGrid.computeProxyOpts;
  33254. const formOpts = $xeGrid.computeFormOpts;
  33255. if (proxyConfig) {
  33256. if (isEnableConf(formConfig) && proxyOpts.form && formOpts.items) {
  33257. reactData.formData = $xeGrid.getDefaultFormData();
  33258. }
  33259. if (!proxyInited && proxyOpts.autoLoad !== false) {
  33260. reactData.proxyInited = true;
  33261. $xeGrid.$nextTick().then(() => $xeGrid.commitProxy('initial')).then(rest => {
  33262. $xeGrid.dispatchEvent('proxy-query', {
  33263. ...rest,
  33264. isInited: true
  33265. }, new Event('initial'));
  33266. });
  33267. }
  33268. }
  33269. },
  33270. handleGlobalKeydownEvent(evnt) {
  33271. const $xeGrid = this;
  33272. const reactData = $xeGrid.reactData;
  33273. const zoomOpts = $xeGrid.computeZoomOpts;
  33274. const isEsc = grid_globalEvents.hasKey(evnt, grid_GLOBAL_EVENT_KEYS.ESCAPE);
  33275. if (isEsc && reactData.isZMax && zoomOpts.escRestore !== false) {
  33276. $xeGrid.triggerZoomEvent(evnt);
  33277. }
  33278. },
  33279. getRespMsg(rest, defaultMsg) {
  33280. const $xeGrid = this;
  33281. const proxyOpts = $xeGrid.computeProxyOpts;
  33282. const resConfigs = proxyOpts.response || proxyOpts.props || {};
  33283. const messageProp = resConfigs.message;
  33284. const $xeTable = $xeGrid.$refs.refTable;
  33285. let msg;
  33286. if (rest && messageProp) {
  33287. msg = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(messageProp) ? messageProp({
  33288. data: rest,
  33289. $table: $xeTable,
  33290. $grid: $xeGrid,
  33291. $gantt: null
  33292. }) : external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(rest, messageProp);
  33293. }
  33294. return msg || grid_getI18n(defaultMsg);
  33295. },
  33296. handleDeleteRow(code, alertKey, callback) {
  33297. const $xeGrid = this;
  33298. const isActiveMsg = $xeGrid.computeIsActiveMsg;
  33299. const selectRecords = $xeGrid.getCheckboxRecords();
  33300. if (isActiveMsg) {
  33301. if (selectRecords.length) {
  33302. if (core_.VxeUI.modal) {
  33303. return core_.VxeUI.modal.confirm({
  33304. id: `cfm_${code}`,
  33305. content: grid_getI18n(alertKey),
  33306. escClosable: true
  33307. }).then(type => {
  33308. if (type === 'confirm') {
  33309. return callback();
  33310. }
  33311. });
  33312. }
  33313. } else {
  33314. if (core_.VxeUI.modal) {
  33315. core_.VxeUI.modal.message({
  33316. id: `msg_${code}`,
  33317. content: grid_getI18n('vxe.grid.selectOneRecord'),
  33318. status: 'warning'
  33319. });
  33320. }
  33321. }
  33322. } else {
  33323. if (selectRecords.length) {
  33324. callback();
  33325. }
  33326. }
  33327. return Promise.resolve();
  33328. },
  33329. triggerPendingEvent(code) {
  33330. const $xeGrid = this;
  33331. const isActiveMsg = $xeGrid.computeIsActiveMsg;
  33332. const $xeTable = $xeGrid.$refs.refTable;
  33333. const selectRecords = $xeTable.getCheckboxRecords();
  33334. if (selectRecords.length) {
  33335. $xeTable.togglePendingRow(selectRecords);
  33336. $xeGrid.clearCheckboxRow();
  33337. } else {
  33338. if (isActiveMsg) {
  33339. if (core_.VxeUI.modal) {
  33340. core_.VxeUI.modal.message({
  33341. id: code,
  33342. content: grid_getI18n('vxe.grid.selectOneRecord'),
  33343. status: 'warning'
  33344. });
  33345. }
  33346. }
  33347. }
  33348. },
  33349. /**
  33350. * 提交指令,支持 code 或 button
  33351. * @param {String/Object} code 字符串或对象
  33352. */
  33353. commitProxy(proxyTarget, ...args) {
  33354. const $xeGrid = this;
  33355. const props = $xeGrid;
  33356. const reactData = $xeGrid.reactData;
  33357. /**
  33358. * 已废弃
  33359. * @deprecated
  33360. */
  33361. const toolbar = props.toolbar;
  33362. const {
  33363. proxyConfig,
  33364. toolbarConfig,
  33365. pagerConfig,
  33366. editRules,
  33367. validConfig
  33368. } = props;
  33369. const {
  33370. tablePage
  33371. } = reactData;
  33372. const isActiveMsg = $xeGrid.computeIsActiveMsg;
  33373. const isRespMsg = $xeGrid.computeIsRespMsg;
  33374. const proxyOpts = $xeGrid.computeProxyOpts;
  33375. const pagerOpts = $xeGrid.computePagerOpts;
  33376. const toolbarOpts = $xeGrid.computeToolbarOpts;
  33377. const {
  33378. beforeQuery,
  33379. afterQuery,
  33380. beforeDelete,
  33381. afterDelete,
  33382. beforeSave,
  33383. afterSave,
  33384. ajax = {}
  33385. } = proxyOpts;
  33386. const resConfigs = proxyOpts.response || proxyOpts.props || {};
  33387. const $xeTable = $xeGrid.$refs.refTable;
  33388. let formData = $xeGrid.getFormData();
  33389. let button = null;
  33390. let code = null;
  33391. if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(proxyTarget)) {
  33392. const {
  33393. buttons
  33394. } = toolbarOpts;
  33395. const matchObj = (toolbarConfig || toolbar) && isEnableConf(toolbarOpts) && buttons ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findTree(buttons, item => item.code === proxyTarget, {
  33396. children: 'dropdowns'
  33397. }) : null;
  33398. button = matchObj ? matchObj.item : null;
  33399. code = proxyTarget;
  33400. } else {
  33401. button = proxyTarget;
  33402. code = button.code;
  33403. }
  33404. const btnParams = button ? button.params : null;
  33405. switch (code) {
  33406. case 'insert':
  33407. return $xeTable.insert({});
  33408. case 'insert_edit':
  33409. return $xeTable.insert({}).then(({
  33410. row
  33411. }) => $xeTable.setEditRow(row, true));
  33412. // 已废弃
  33413. case 'insert_actived':
  33414. return $xeTable.insert({}).then(({
  33415. row
  33416. }) => $xeTable.setEditRow(row, true));
  33417. // 已废弃
  33418. case 'mark_cancel':
  33419. $xeGrid.triggerPendingEvent(code);
  33420. break;
  33421. case 'remove':
  33422. return $xeGrid.handleDeleteRow(code, 'vxe.grid.removeSelectRecord', () => $xeTable.removeCheckboxRow());
  33423. case 'import':
  33424. $xeTable.importData(btnParams);
  33425. break;
  33426. case 'open_import':
  33427. $xeTable.openImport(btnParams);
  33428. break;
  33429. case 'export':
  33430. $xeTable.exportData(btnParams);
  33431. break;
  33432. case 'open_export':
  33433. $xeTable.openExport(btnParams);
  33434. break;
  33435. case 'reset_custom':
  33436. $xeTable.resetCustom(true);
  33437. break;
  33438. case 'initial':
  33439. case 'reload':
  33440. case 'query':
  33441. {
  33442. const ajaxMethods = ajax.query;
  33443. const querySuccessMethods = ajax.querySuccess;
  33444. const queryErrorMethods = ajax.queryError;
  33445. if (ajaxMethods) {
  33446. const isInited = code === 'initial';
  33447. const isReload = code === 'reload';
  33448. if (!isInited && reactData.tableLoading) {
  33449. return $xeGrid.$nextTick();
  33450. }
  33451. let operPromise = null;
  33452. let sortList = [];
  33453. let filterList = [];
  33454. let pageParams = {};
  33455. if (pagerConfig) {
  33456. if (isInited || isReload) {
  33457. tablePage.currentPage = 1;
  33458. }
  33459. if (isEnableConf(pagerConfig)) {
  33460. pageParams = {
  33461. ...tablePage
  33462. };
  33463. }
  33464. }
  33465. if (isInited) {
  33466. // 重置代理表单数据
  33467. if (proxyConfig && isEnableConf(proxyOpts) && proxyOpts.form) {
  33468. formData = $xeGrid.getDefaultFormData();
  33469. reactData.formData = formData;
  33470. }
  33471. if ($xeTable) {
  33472. const tableInternalData = $xeTable;
  33473. const {
  33474. tableFullColumn,
  33475. fullColumnFieldData
  33476. } = tableInternalData;
  33477. const sortOpts = $xeTable.computeSortOpts;
  33478. let defaultSort = sortOpts.defaultSort;
  33479. tableFullColumn.forEach(column => {
  33480. column.order = null;
  33481. });
  33482. // 如果使用默认排序
  33483. if (defaultSort) {
  33484. if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(defaultSort)) {
  33485. defaultSort = [defaultSort];
  33486. }
  33487. sortList = defaultSort.map(item => {
  33488. const {
  33489. field,
  33490. order
  33491. } = item;
  33492. const colRest = fullColumnFieldData[field];
  33493. if (colRest) {
  33494. const column = colRest.column;
  33495. if (column) {
  33496. column.order = order;
  33497. }
  33498. }
  33499. return {
  33500. field,
  33501. property: field,
  33502. order
  33503. };
  33504. });
  33505. }
  33506. filterList = $xeTable.getCheckedFilters();
  33507. }
  33508. } else {
  33509. if ($xeTable) {
  33510. if (isReload) {
  33511. operPromise = $xeTable.clearAll();
  33512. } else {
  33513. sortList = $xeTable.getSortColumns();
  33514. filterList = $xeTable.getCheckedFilters();
  33515. }
  33516. }
  33517. }
  33518. const commitParams = {
  33519. $table: $xeTable,
  33520. $grid: $xeGrid,
  33521. $gantt: null,
  33522. code,
  33523. button,
  33524. isInited,
  33525. isReload,
  33526. page: pageParams,
  33527. sort: sortList.length ? sortList[0] : {},
  33528. sorts: sortList,
  33529. filters: filterList,
  33530. form: formData,
  33531. options: ajaxMethods
  33532. };
  33533. reactData.sortData = sortList;
  33534. reactData.filterData = filterList;
  33535. reactData.tableLoading = true;
  33536. return Promise.all([Promise.resolve((beforeQuery || ajaxMethods)(commitParams, ...args)), operPromise]).then(([rest]) => {
  33537. let tableData = [];
  33538. reactData.tableLoading = false;
  33539. if (rest) {
  33540. if (pagerConfig && isEnableConf(pagerOpts)) {
  33541. const totalProp = resConfigs.total;
  33542. const total = (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(totalProp) ? totalProp({
  33543. data: rest,
  33544. $table: $xeTable,
  33545. $grid: $xeGrid,
  33546. $gantt: null
  33547. }) : external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(rest, totalProp || 'page.total')) || 0;
  33548. tablePage.total = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(total);
  33549. const resultProp = resConfigs.result;
  33550. tableData = (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(resultProp) ? resultProp({
  33551. data: rest,
  33552. $table: $xeTable,
  33553. $grid: $xeGrid,
  33554. $gantt: null
  33555. }) : external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(rest, resultProp || 'result')) || [];
  33556. // 检验当前页码,不能超出当前最大页数
  33557. const pageCount = Math.max(Math.ceil(total / tablePage.pageSize), 1);
  33558. if (tablePage.currentPage > pageCount) {
  33559. tablePage.currentPage = pageCount;
  33560. }
  33561. } else {
  33562. const listProp = resConfigs.list;
  33563. tableData = (listProp ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(listProp) ? listProp({
  33564. data: rest,
  33565. $table: $xeTable,
  33566. $grid: $xeGrid,
  33567. $gantt: null
  33568. }) : external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(rest, listProp) : rest) || [];
  33569. }
  33570. }
  33571. if ($xeTable) {
  33572. $xeTable.loadData(tableData);
  33573. } else {
  33574. $xeGrid.$nextTick(() => {
  33575. const $xeTable = $xeGrid.$refs.refTable;
  33576. if ($xeTable) {
  33577. $xeTable.loadData(tableData);
  33578. }
  33579. });
  33580. }
  33581. if (afterQuery) {
  33582. afterQuery(commitParams, ...args);
  33583. }
  33584. if (querySuccessMethods) {
  33585. querySuccessMethods({
  33586. ...commitParams,
  33587. response: rest
  33588. });
  33589. }
  33590. return {
  33591. status: true
  33592. };
  33593. }).catch(rest => {
  33594. reactData.tableLoading = false;
  33595. if (queryErrorMethods) {
  33596. queryErrorMethods({
  33597. ...commitParams,
  33598. response: rest
  33599. });
  33600. }
  33601. return {
  33602. status: false
  33603. };
  33604. });
  33605. } else {
  33606. errLog('vxe.error.notFunc', ['[grid] proxy-config.ajax.query']);
  33607. }
  33608. break;
  33609. }
  33610. case 'delete':
  33611. {
  33612. const ajaxMethods = ajax.delete;
  33613. const deleteSuccessMethods = ajax.deleteSuccess;
  33614. const deleteErrorMethods = ajax.deleteError;
  33615. if (ajaxMethods) {
  33616. const selectRecords = $xeTable.getCheckboxRecords();
  33617. const removeRecords = selectRecords.filter(row => !$xeTable.isInsertByRow(row));
  33618. const body = {
  33619. removeRecords
  33620. };
  33621. const commitParams = {
  33622. $table: $xeTable,
  33623. $grid: $xeGrid,
  33624. $gantt: null,
  33625. code,
  33626. button,
  33627. body,
  33628. form: formData,
  33629. options: ajaxMethods
  33630. };
  33631. const applyArgs = [commitParams].concat(args);
  33632. if (selectRecords.length) {
  33633. return $xeGrid.handleDeleteRow(code, 'vxe.grid.deleteSelectRecord', () => {
  33634. if (!removeRecords.length) {
  33635. return $xeTable.remove(selectRecords);
  33636. }
  33637. reactData.tableLoading = true;
  33638. return Promise.resolve((beforeDelete || ajaxMethods)(...applyArgs)).then(rest => {
  33639. reactData.tableLoading = false;
  33640. $xeTable.setPendingRow(removeRecords, false);
  33641. if (isRespMsg) {
  33642. if (core_.VxeUI.modal) {
  33643. core_.VxeUI.modal.message({
  33644. content: $xeGrid.getRespMsg(rest, 'vxe.grid.delSuccess'),
  33645. status: 'success'
  33646. });
  33647. }
  33648. }
  33649. if (afterDelete) {
  33650. afterDelete(...applyArgs);
  33651. } else {
  33652. $xeGrid.commitProxy('query');
  33653. }
  33654. if (deleteSuccessMethods) {
  33655. deleteSuccessMethods({
  33656. ...commitParams,
  33657. response: rest
  33658. });
  33659. }
  33660. return {
  33661. status: true
  33662. };
  33663. }).catch(rest => {
  33664. reactData.tableLoading = false;
  33665. if (isRespMsg) {
  33666. if (core_.VxeUI.modal) {
  33667. core_.VxeUI.modal.message({
  33668. id: code,
  33669. content: $xeGrid.getRespMsg(rest, 'vxe.grid.operError'),
  33670. status: 'error'
  33671. });
  33672. }
  33673. }
  33674. if (deleteErrorMethods) {
  33675. deleteErrorMethods({
  33676. ...commitParams,
  33677. response: rest
  33678. });
  33679. }
  33680. return {
  33681. status: false
  33682. };
  33683. });
  33684. });
  33685. } else {
  33686. if (isActiveMsg) {
  33687. if (core_.VxeUI.modal) {
  33688. core_.VxeUI.modal.message({
  33689. id: code,
  33690. content: grid_getI18n('vxe.grid.selectOneRecord'),
  33691. status: 'warning'
  33692. });
  33693. }
  33694. }
  33695. }
  33696. } else {
  33697. errLog('vxe.error.notFunc', ['[grid] proxy-config.ajax.delete']);
  33698. }
  33699. break;
  33700. }
  33701. case 'save':
  33702. {
  33703. const ajaxMethods = ajax.save;
  33704. const saveSuccessMethods = ajax.saveSuccess;
  33705. const saveErrorMethods = ajax.saveError;
  33706. if (ajaxMethods) {
  33707. const body = $xeGrid.getRecordset();
  33708. const {
  33709. insertRecords,
  33710. removeRecords,
  33711. updateRecords,
  33712. pendingRecords
  33713. } = body;
  33714. const commitParams = {
  33715. $table: $xeTable,
  33716. $grid: $xeGrid,
  33717. $gantt: null,
  33718. code,
  33719. button,
  33720. body,
  33721. form: formData,
  33722. options: ajaxMethods
  33723. };
  33724. const applyArgs = [commitParams].concat(args);
  33725. // 排除掉新增且标记为删除的数据
  33726. if (insertRecords.length) {
  33727. body.pendingRecords = pendingRecords.filter(row => insertRecords.indexOf(row) === -1);
  33728. }
  33729. // 排除已标记为删除的数据
  33730. if (pendingRecords.length) {
  33731. body.insertRecords = insertRecords.filter(row => pendingRecords.indexOf(row) === -1);
  33732. }
  33733. let restPromise = Promise.resolve();
  33734. if (editRules) {
  33735. // 只校验新增和修改的数据
  33736. restPromise = $xeGrid[validConfig && validConfig.msgMode === 'full' ? 'fullValidate' : 'validate'](body.insertRecords.concat(updateRecords));
  33737. }
  33738. return restPromise.then(errMap => {
  33739. if (errMap) {
  33740. // 如果校验不通过
  33741. return;
  33742. }
  33743. if (body.insertRecords.length || removeRecords.length || updateRecords.length || body.pendingRecords.length) {
  33744. reactData.tableLoading = true;
  33745. return Promise.resolve((beforeSave || ajaxMethods)(...applyArgs)).then(rest => {
  33746. reactData.tableLoading = false;
  33747. $xeTable.clearPendingRow();
  33748. if (isRespMsg) {
  33749. if (core_.VxeUI.modal) {
  33750. core_.VxeUI.modal.message({
  33751. content: $xeGrid.getRespMsg(rest, 'vxe.grid.saveSuccess'),
  33752. status: 'success'
  33753. });
  33754. }
  33755. }
  33756. if (afterSave) {
  33757. afterSave(...applyArgs);
  33758. } else {
  33759. $xeGrid.commitProxy('query');
  33760. }
  33761. if (saveSuccessMethods) {
  33762. saveSuccessMethods({
  33763. ...commitParams,
  33764. response: rest
  33765. });
  33766. }
  33767. return {
  33768. status: true
  33769. };
  33770. }).catch(rest => {
  33771. reactData.tableLoading = false;
  33772. if (isRespMsg) {
  33773. if (core_.VxeUI.modal) {
  33774. core_.VxeUI.modal.message({
  33775. id: code,
  33776. content: $xeGrid.getRespMsg(rest, 'vxe.grid.operError'),
  33777. status: 'error'
  33778. });
  33779. }
  33780. }
  33781. if (saveErrorMethods) {
  33782. saveErrorMethods({
  33783. ...commitParams,
  33784. response: rest
  33785. });
  33786. }
  33787. return {
  33788. status: false
  33789. };
  33790. });
  33791. } else {
  33792. if (isActiveMsg) {
  33793. if (core_.VxeUI.modal) {
  33794. core_.VxeUI.modal.message({
  33795. id: code,
  33796. content: grid_getI18n('vxe.grid.dataUnchanged'),
  33797. status: 'info'
  33798. });
  33799. }
  33800. }
  33801. }
  33802. });
  33803. } else {
  33804. errLog('vxe.error.notFunc', ['[grid] proxy-config.ajax.save']);
  33805. }
  33806. break;
  33807. }
  33808. default:
  33809. {
  33810. const gCommandOpts = grid_commands.get(code);
  33811. if (gCommandOpts) {
  33812. const tCommandMethod = gCommandOpts.tableCommandMethod || gCommandOpts.commandMethod;
  33813. if (tCommandMethod) {
  33814. tCommandMethod({
  33815. code,
  33816. button,
  33817. $grid: $xeGrid,
  33818. $table: $xeTable,
  33819. $gantt: null
  33820. }, ...args);
  33821. } else {
  33822. errLog('vxe.error.notCommands', [`[grid] ${code}`]);
  33823. }
  33824. }
  33825. }
  33826. }
  33827. return $xeGrid.$nextTick();
  33828. },
  33829. getFormData() {
  33830. const $xeGrid = this;
  33831. const props = $xeGrid;
  33832. const reactData = $xeGrid.reactData;
  33833. const {
  33834. proxyConfig
  33835. } = props;
  33836. const {
  33837. formData
  33838. } = reactData;
  33839. const proxyOpts = $xeGrid.computeProxyOpts;
  33840. const formOpts = $xeGrid.computeFormOpts;
  33841. return proxyConfig && isEnableConf(proxyOpts) && proxyOpts.form ? formData : formOpts.data;
  33842. },
  33843. getFormItems(itemIndex) {
  33844. const $xeGrid = this;
  33845. const props = $xeGrid;
  33846. const formOpts = $xeGrid.computeFormOpts;
  33847. const {
  33848. formConfig
  33849. } = props;
  33850. const {
  33851. items
  33852. } = formOpts;
  33853. const itemList = [];
  33854. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(formConfig && isEnableConf(formOpts) && items ? items : [], item => {
  33855. itemList.push(item);
  33856. }, {
  33857. children: 'children'
  33858. });
  33859. return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isUndefined(itemIndex) ? itemList : itemList[itemIndex];
  33860. },
  33861. resetForm() {
  33862. const $xeGrid = this;
  33863. const $form = $xeGrid.$refs.refForm;
  33864. if ($form) {
  33865. return $form.reset();
  33866. }
  33867. return $xeGrid.$nextTick();
  33868. },
  33869. validateForm() {
  33870. const $xeGrid = this;
  33871. const $form = $xeGrid.$refs.refForm;
  33872. if ($form) {
  33873. return $form.validate();
  33874. }
  33875. return $xeGrid.$nextTick();
  33876. },
  33877. validateFormField(field) {
  33878. const $xeGrid = this;
  33879. const $form = $xeGrid.$refs.refForm;
  33880. if ($form) {
  33881. return $form.validateField(field);
  33882. }
  33883. return $xeGrid.$nextTick();
  33884. },
  33885. clearFormValidate(field) {
  33886. const $xeGrid = this;
  33887. const $form = $xeGrid.$refs.refForm;
  33888. if ($form) {
  33889. return $form.clearValidate(field);
  33890. }
  33891. return $xeGrid.$nextTick();
  33892. },
  33893. homePage() {
  33894. const $xeGrid = this;
  33895. const reactData = $xeGrid.reactData;
  33896. const {
  33897. tablePage
  33898. } = reactData;
  33899. tablePage.currentPage = 1;
  33900. return $xeGrid.$nextTick();
  33901. },
  33902. homePageByEvent(evnt) {
  33903. const $xeGrid = this;
  33904. const $pager = $xeGrid.$refs.refPager;
  33905. if ($pager) {
  33906. $pager.homePageByEvent(evnt);
  33907. }
  33908. },
  33909. endPage() {
  33910. const $xeGrid = this;
  33911. const reactData = $xeGrid.reactData;
  33912. const {
  33913. tablePage
  33914. } = reactData;
  33915. const pageCount = $xeGrid.computePageCount;
  33916. tablePage.currentPage = pageCount;
  33917. return $xeGrid.$nextTick();
  33918. },
  33919. endPageByEvent(evnt) {
  33920. const $xeGrid = this;
  33921. const $pager = $xeGrid.$refs.refPager;
  33922. if ($pager) {
  33923. $pager.endPageByEvent(evnt);
  33924. }
  33925. },
  33926. getCurrentPage() {
  33927. const $xeGrid = this;
  33928. const reactData = $xeGrid.reactData;
  33929. const {
  33930. tablePage
  33931. } = reactData;
  33932. return tablePage.currentPage;
  33933. },
  33934. setCurrentPage(currentPage) {
  33935. const $xeGrid = this;
  33936. const reactData = $xeGrid.reactData;
  33937. const {
  33938. tablePage
  33939. } = reactData;
  33940. const pageCount = $xeGrid.computePageCount;
  33941. tablePage.currentPage = Math.min(pageCount, Math.max(1, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(currentPage)));
  33942. return $xeGrid.$nextTick();
  33943. },
  33944. setCurrentPageByEvent(evnt, currentPage) {
  33945. const $xeGrid = this;
  33946. const $pager = $xeGrid.$refs.refPager;
  33947. if ($pager) {
  33948. $pager.setCurrentPageByEvent(evnt, currentPage);
  33949. }
  33950. },
  33951. getPageSize() {
  33952. const $xeGrid = this;
  33953. const reactData = $xeGrid.reactData;
  33954. const {
  33955. tablePage
  33956. } = reactData;
  33957. return tablePage.pageSize;
  33958. },
  33959. setPageSize(pageSize) {
  33960. const $xeGrid = this;
  33961. const reactData = $xeGrid.reactData;
  33962. const {
  33963. tablePage
  33964. } = reactData;
  33965. tablePage.pageSize = Math.max(1, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(pageSize));
  33966. return $xeGrid.$nextTick();
  33967. },
  33968. setPageSizeByEvent(evnt, pageSize) {
  33969. const $xeGrid = this;
  33970. const $pager = $xeGrid.$refs.refPager;
  33971. if ($pager) {
  33972. $pager.setPageSizeByEvent(evnt, pageSize);
  33973. }
  33974. },
  33975. triggerToolbarCommitEvent(params, evnt) {
  33976. const $xeGrid = this;
  33977. const {
  33978. code
  33979. } = params;
  33980. return $xeGrid.commitProxy(params, evnt).then(rest => {
  33981. if (code && rest && rest.status && ['query', 'reload', 'delete', 'save'].includes(code)) {
  33982. $xeGrid.dispatchEvent(code === 'delete' || code === 'save' ? `proxy-${code}` : 'proxy-query', {
  33983. ...rest,
  33984. isReload: code === 'reload'
  33985. }, evnt);
  33986. }
  33987. });
  33988. },
  33989. triggerToolbarBtnEvent(button, evnt) {
  33990. const $xeGrid = this;
  33991. $xeGrid.triggerToolbarCommitEvent(button, evnt);
  33992. $xeGrid.dispatchEvent('toolbar-button-click', {
  33993. code: button.code,
  33994. button
  33995. }, evnt);
  33996. },
  33997. triggerToolbarTolEvent(tool, evnt) {
  33998. const $xeGrid = this;
  33999. $xeGrid.triggerToolbarCommitEvent(tool, evnt);
  34000. $xeGrid.dispatchEvent('toolbar-tool-click', {
  34001. code: tool.code,
  34002. tool
  34003. }, evnt);
  34004. },
  34005. pageChangeEvent(params) {
  34006. const $xeGrid = this;
  34007. const props = $xeGrid;
  34008. const reactData = $xeGrid.reactData;
  34009. const {
  34010. proxyConfig
  34011. } = props;
  34012. const {
  34013. tablePage
  34014. } = reactData;
  34015. const {
  34016. $event,
  34017. currentPage,
  34018. pageSize
  34019. } = params;
  34020. const proxyOpts = $xeGrid.computeProxyOpts;
  34021. tablePage.currentPage = currentPage;
  34022. tablePage.pageSize = pageSize;
  34023. $xeGrid.dispatchEvent('page-change', params, $event);
  34024. if (proxyConfig && isEnableConf(proxyOpts)) {
  34025. $xeGrid.commitProxy('query').then(rest => {
  34026. $xeGrid.dispatchEvent('proxy-query', rest, $event);
  34027. });
  34028. }
  34029. },
  34030. handleSortEvent(params) {
  34031. const $xeGrid = this;
  34032. const props = $xeGrid;
  34033. const reactData = $xeGrid.reactData;
  34034. const $xeTable = $xeGrid.$refs.refTable;
  34035. const {
  34036. proxyConfig
  34037. } = props;
  34038. const proxyOpts = $xeGrid.computeProxyOpts;
  34039. const sortOpts = $xeTable.computeSortOpts;
  34040. // 如果是服务端排序
  34041. if (sortOpts.remote) {
  34042. reactData.sortData = params.sortList;
  34043. if (proxyConfig && isEnableConf(proxyOpts)) {
  34044. reactData.tablePage.currentPage = 1;
  34045. $xeGrid.commitProxy('query').then(rest => {
  34046. $xeGrid.dispatchEvent('proxy-query', rest, params.$event);
  34047. });
  34048. }
  34049. }
  34050. },
  34051. sortChangeEvent(params) {
  34052. const $xeGrid = this;
  34053. $xeGrid.handleSortEvent(params);
  34054. $xeGrid.dispatchEvent('sort-change', params, params.$event);
  34055. },
  34056. clearAllSortEvent(params) {
  34057. const $xeGrid = this;
  34058. $xeGrid.handleSortEvent(params);
  34059. $xeGrid.dispatchEvent('clear-all-sort', params, params.$event);
  34060. },
  34061. handleFilterEvent(params) {
  34062. const $xeGrid = this;
  34063. const props = $xeGrid;
  34064. const reactData = $xeGrid.reactData;
  34065. const $xeTable = $xeGrid.$refs.refTable;
  34066. const {
  34067. proxyConfig
  34068. } = props;
  34069. const proxyOpts = $xeGrid.computeProxyOpts;
  34070. const filterOpts = $xeTable.computeFilterOpts;
  34071. // 如果是服务端过滤
  34072. if (filterOpts.remote) {
  34073. reactData.filterData = params.filterList;
  34074. if (proxyConfig && isEnableConf(proxyOpts)) {
  34075. reactData.tablePage.currentPage = 1;
  34076. $xeGrid.commitProxy('query').then(rest => {
  34077. $xeGrid.dispatchEvent('proxy-query', rest, params.$event);
  34078. });
  34079. }
  34080. }
  34081. },
  34082. filterChangeEvent(params) {
  34083. const $xeGrid = this;
  34084. $xeGrid.handleFilterEvent(params);
  34085. $xeGrid.dispatchEvent('filter-change', params, params.$event);
  34086. },
  34087. clearAllFilterEvent(params) {
  34088. const $xeGrid = this;
  34089. $xeGrid.handleFilterEvent(params);
  34090. $xeGrid.dispatchEvent('clear-all-filter', params, params.$event);
  34091. },
  34092. submitFormEvent(params) {
  34093. const $xeGrid = this;
  34094. const props = $xeGrid;
  34095. const reactData = $xeGrid.reactData;
  34096. const {
  34097. proxyConfig
  34098. } = props;
  34099. const proxyOpts = $xeGrid.computeProxyOpts;
  34100. if (reactData.tableLoading) {
  34101. return;
  34102. }
  34103. if (proxyConfig && isEnableConf(proxyOpts)) {
  34104. $xeGrid.commitProxy('reload').then(rest => {
  34105. $xeGrid.dispatchEvent('proxy-query', {
  34106. ...rest,
  34107. isReload: true
  34108. }, params.$event);
  34109. });
  34110. }
  34111. $xeGrid.dispatchEvent('form-submit', params, params.$event);
  34112. },
  34113. resetFormEvent(params) {
  34114. const $xeGrid = this;
  34115. const props = $xeGrid;
  34116. const $xeTable = $xeGrid.$refs.refTable;
  34117. const {
  34118. proxyConfig
  34119. } = props;
  34120. const {
  34121. $event
  34122. } = params;
  34123. const proxyOpts = $xeGrid.computeProxyOpts;
  34124. if (proxyConfig && isEnableConf(proxyOpts)) {
  34125. $xeTable.clearScroll();
  34126. $xeGrid.commitProxy('reload').then(rest => {
  34127. $xeGrid.dispatchEvent('proxy-query', {
  34128. ...rest,
  34129. isReload: true
  34130. }, $event);
  34131. });
  34132. }
  34133. $xeGrid.dispatchEvent('form-reset', params, $event);
  34134. },
  34135. submitInvalidEvent(params) {
  34136. const $xeGrid = this;
  34137. $xeGrid.dispatchEvent('form-submit-invalid', params, params.$event);
  34138. },
  34139. collapseEvent(params) {
  34140. const $xeGrid = this;
  34141. const {
  34142. $event
  34143. } = params;
  34144. $xeGrid.dispatchEvent('form-toggle-collapse', params, $event);
  34145. $xeGrid.dispatchEvent('form-collapse', params, $event);
  34146. },
  34147. triggerZoomEvent(evnt) {
  34148. const $xeGrid = this;
  34149. const reactData = $xeGrid.reactData;
  34150. $xeGrid.zoom();
  34151. $xeGrid.dispatchEvent('zoom', {
  34152. type: reactData.isZMax ? 'max' : 'revert'
  34153. }, evnt);
  34154. },
  34155. getParams() {
  34156. const $xeGrid = this;
  34157. const props = $xeGrid;
  34158. return props.params;
  34159. },
  34160. zoom() {
  34161. const $xeGrid = this;
  34162. const reactData = $xeGrid.reactData;
  34163. if (reactData.isZMax) {
  34164. return $xeGrid.revert();
  34165. }
  34166. return $xeGrid.maximize();
  34167. },
  34168. isMaximized() {
  34169. const $xeGrid = this;
  34170. const reactData = $xeGrid.reactData;
  34171. return reactData.isZMax;
  34172. },
  34173. maximize() {
  34174. const $xeGrid = this;
  34175. return $xeGrid.handleZoom(true);
  34176. },
  34177. revert() {
  34178. const $xeGrid = this;
  34179. return $xeGrid.handleZoom();
  34180. },
  34181. handleZoom(isMax) {
  34182. const $xeGrid = this;
  34183. const reactData = $xeGrid.reactData;
  34184. const {
  34185. isZMax
  34186. } = reactData;
  34187. if (isMax ? !isZMax : isZMax) {
  34188. reactData.isZMax = !isZMax;
  34189. if (reactData.tZindex < getLastZIndex()) {
  34190. reactData.tZindex = nextZIndex();
  34191. }
  34192. }
  34193. return $xeGrid.$nextTick().then(() => $xeGrid.recalculate(true)).then(() => {
  34194. setTimeout(() => $xeGrid.recalculate(true), 15);
  34195. return reactData.isZMax;
  34196. });
  34197. },
  34198. getProxyInfo() {
  34199. const $xeGrid = this;
  34200. const props = $xeGrid;
  34201. const $xeTable = $xeGrid.$refs.refTable;
  34202. const reactData = $xeGrid.reactData;
  34203. if (props.proxyConfig) {
  34204. const {
  34205. sortData
  34206. } = reactData;
  34207. return {
  34208. data: $xeTable ? $xeTable.getFullData() : [],
  34209. filter: reactData.filterData,
  34210. form: $xeGrid.getFormData(),
  34211. sort: sortData.length ? sortData[0] : {},
  34212. sorts: sortData,
  34213. pager: reactData.tablePage,
  34214. pendingRecords: $xeTable ? $xeTable.getPendingRecords() : []
  34215. };
  34216. }
  34217. return null;
  34218. },
  34219. loadColumn(columns) {
  34220. const $xeGrid = this;
  34221. const slots = $xeGrid.$scopedSlots;
  34222. const $xeTable = $xeGrid.$refs.refTable;
  34223. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(columns, column => {
  34224. if (column.slots) {
  34225. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(column.slots, func => {
  34226. if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(func)) {
  34227. if (!slots[func]) {
  34228. errLog('vxe.error.notSlot', [`[grid] ${func}`]);
  34229. }
  34230. }
  34231. });
  34232. }
  34233. });
  34234. return $xeTable.loadColumn(columns);
  34235. },
  34236. reloadColumn(columns) {
  34237. const $xeGrid = this;
  34238. $xeGrid.clearAll();
  34239. return $xeGrid.loadColumn(columns);
  34240. },
  34241. getConfigSlot(slotConfigs) {
  34242. const $xeGrid = this;
  34243. const slots = $xeGrid.$scopedSlots;
  34244. const slotConf = {};
  34245. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().objectMap(slotConfigs, (slotFunc, slotKey) => {
  34246. if (slotFunc) {
  34247. if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(slotFunc)) {
  34248. if (slots[slotFunc]) {
  34249. slotConf[slotKey] = slots[slotFunc];
  34250. } else {
  34251. errLog('vxe.error.notSlot', [`[grid] ${slotFunc}`]);
  34252. }
  34253. } else {
  34254. slotConf[slotKey] = slotFunc;
  34255. }
  34256. }
  34257. });
  34258. return slotConf;
  34259. },
  34260. getToolbarSlots() {
  34261. const $xeGrid = this;
  34262. const slots = $xeGrid.$scopedSlots;
  34263. const toolbarOpts = $xeGrid.computeToolbarOpts;
  34264. const toolbarOptSlots = toolbarOpts.slots;
  34265. const toolbarSlots = {};
  34266. if (slots.buttons && (!toolbarOptSlots || toolbarOptSlots.buttons !== 'buttons')) {
  34267. warnLog('vxe.error.reqProp', ['[grid] toolbar-config.slots.buttons']);
  34268. }
  34269. if (slots.tools && (!toolbarOptSlots || toolbarOptSlots.tools !== 'tools')) {
  34270. warnLog('vxe.error.reqProp', ['[grid] toolbar-config.slots.tools']);
  34271. }
  34272. if (toolbarOptSlots) {
  34273. const buttonsSlot = $xeGrid.getFuncSlot(toolbarOptSlots, 'buttons');
  34274. const buttonPrefixSlot = $xeGrid.getFuncSlot(toolbarOptSlots, 'buttonPrefix');
  34275. const buttonSuffixSlot = $xeGrid.getFuncSlot(toolbarOptSlots, 'buttonSuffix');
  34276. const toolsSlot = $xeGrid.getFuncSlot(toolbarOptSlots, 'tools');
  34277. const toolPrefixSlot = $xeGrid.getFuncSlot(toolbarOptSlots, 'toolPrefix');
  34278. const toolSuffixSlot = $xeGrid.getFuncSlot(toolbarOptSlots, 'toolSuffix');
  34279. if (buttonsSlot) {
  34280. toolbarSlots.buttons = buttonsSlot;
  34281. }
  34282. if (buttonPrefixSlot) {
  34283. toolbarSlots.buttonPrefix = buttonPrefixSlot;
  34284. }
  34285. if (buttonSuffixSlot) {
  34286. toolbarSlots.buttonSuffix = buttonSuffixSlot;
  34287. }
  34288. if (toolsSlot) {
  34289. toolbarSlots.tools = toolsSlot;
  34290. }
  34291. if (toolPrefixSlot) {
  34292. toolbarSlots.toolPrefix = toolPrefixSlot;
  34293. }
  34294. if (toolSuffixSlot) {
  34295. toolbarSlots.toolSuffix = toolSuffixSlot;
  34296. }
  34297. }
  34298. return toolbarSlots;
  34299. },
  34300. getFuncSlot(optSlots, slotKey) {
  34301. const $xeGrid = this;
  34302. const slots = $xeGrid.$scopedSlots;
  34303. const funcSlot = optSlots[slotKey];
  34304. if (funcSlot) {
  34305. if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(funcSlot)) {
  34306. if (slots[funcSlot]) {
  34307. return slots[funcSlot];
  34308. } else {
  34309. errLog('vxe.error.notSlot', [`[grid] ${funcSlot}`]);
  34310. }
  34311. } else {
  34312. return funcSlot;
  34313. }
  34314. }
  34315. return null;
  34316. },
  34317. //
  34318. // Render
  34319. //
  34320. renderDefaultForm(h) {
  34321. const VxeUIFormComponent = core_.VxeUI.getComponent('VxeForm');
  34322. const $xeGrid = this;
  34323. const props = $xeGrid;
  34324. const slots = $xeGrid.$scopedSlots;
  34325. const reactData = $xeGrid.reactData;
  34326. const {
  34327. proxyConfig,
  34328. formConfig
  34329. } = props;
  34330. const {
  34331. formData
  34332. } = reactData;
  34333. const proxyOpts = $xeGrid.computeProxyOpts;
  34334. const formOpts = $xeGrid.computeFormOpts;
  34335. if (isEnableConf(formConfig) && formOpts.items && formOpts.items.length) {
  34336. const formSlots = {};
  34337. if (!formOpts.inited) {
  34338. formOpts.inited = true;
  34339. const beforeItem = proxyOpts.beforeItem;
  34340. if (proxyOpts && beforeItem) {
  34341. formOpts.items.forEach(item => {
  34342. beforeItem.call($xeGrid, {
  34343. $grid: $xeGrid,
  34344. $gantt: null,
  34345. item
  34346. });
  34347. });
  34348. }
  34349. }
  34350. // 处理插槽
  34351. formOpts.items.forEach(item => {
  34352. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(item.slots, func => {
  34353. if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(func)) {
  34354. if (slots[func]) {
  34355. formSlots[func] = slots[func];
  34356. }
  34357. }
  34358. });
  34359. });
  34360. return [VxeUIFormComponent ? h(VxeUIFormComponent, {
  34361. props: Object.assign({}, formOpts, {
  34362. data: proxyConfig && proxyOpts.form ? formData : formOpts.data
  34363. }),
  34364. on: {
  34365. submit: $xeGrid.submitFormEvent,
  34366. reset: $xeGrid.resetFormEvent,
  34367. collapse: $xeGrid.collapseEvent,
  34368. 'submit-invalid': $xeGrid.submitInvalidEvent
  34369. },
  34370. scopedSlots: formSlots
  34371. }) : grid_renderEmptyElement($xeGrid)];
  34372. }
  34373. return [];
  34374. },
  34375. renderForm(h) {
  34376. const $xeGrid = this;
  34377. const props = $xeGrid;
  34378. const slots = $xeGrid.$scopedSlots;
  34379. const {
  34380. formConfig
  34381. } = props;
  34382. const formSlot = slots.form;
  34383. const hasForm = !!(formSlot || isEnableConf(formConfig));
  34384. if (hasForm) {
  34385. return h('div', {
  34386. key: 'form',
  34387. ref: 'refFormWrapper',
  34388. class: 'vxe-grid--form-wrapper'
  34389. }, formSlot ? formSlot.call($xeGrid, {
  34390. $grid: $xeGrid,
  34391. $gantt: null
  34392. }) : $xeGrid.renderDefaultForm(h));
  34393. }
  34394. return grid_renderEmptyElement($xeGrid);
  34395. },
  34396. renderToolbar(h) {
  34397. const $xeGrid = this;
  34398. const props = $xeGrid;
  34399. const slots = $xeGrid.$scopedSlots;
  34400. const {
  34401. toolbarConfig
  34402. } = props;
  34403. const toolbarSlot = slots.toolbar;
  34404. const toolbarOpts = $xeGrid.computeToolbarOpts;
  34405. if (toolbarConfig && isEnableConf(toolbarOpts) || toolbarSlot) {
  34406. return h('div', {
  34407. key: 'toolbar',
  34408. ref: 'refToolbarWrapper',
  34409. class: 'vxe-grid--toolbar-wrapper'
  34410. }, toolbarSlot ? toolbarSlot.call($xeGrid, {
  34411. $grid: $xeGrid,
  34412. $gantt: null
  34413. }) : [h(toolbar, {
  34414. props: Object.assign({}, toolbarOpts, {
  34415. slots: undefined
  34416. }),
  34417. ref: 'refToolbar',
  34418. scopedSlots: $xeGrid.getToolbarSlots()
  34419. })]);
  34420. }
  34421. return grid_renderEmptyElement($xeGrid);
  34422. },
  34423. renderTop(h) {
  34424. const $xeGrid = this;
  34425. const slots = $xeGrid.$scopedSlots;
  34426. const topSlot = slots.top;
  34427. return topSlot ? h('div', {
  34428. key: 'top',
  34429. ref: 'refTopWrapper',
  34430. class: 'vxe-grid--top-wrapper'
  34431. }, topSlot.call($xeGrid, {
  34432. $grid: $xeGrid,
  34433. $gantt: null
  34434. })) : grid_renderEmptyElement($xeGrid);
  34435. },
  34436. renderTableLeft(h) {
  34437. const $xeGrid = this;
  34438. const slots = $xeGrid.$scopedSlots;
  34439. const leftSlot = slots.left;
  34440. if (leftSlot) {
  34441. return h('div', {
  34442. class: 'vxe-grid--left-wrapper'
  34443. }, leftSlot({
  34444. $grid: $xeGrid,
  34445. $gantt: null
  34446. }));
  34447. }
  34448. return grid_renderEmptyElement($xeGrid);
  34449. },
  34450. renderTableRight(h) {
  34451. const $xeGrid = this;
  34452. const slots = $xeGrid.$scopedSlots;
  34453. const rightSlot = slots.right;
  34454. if (rightSlot) {
  34455. return h('div', {
  34456. class: 'vxe-grid--right-wrapper'
  34457. }, rightSlot({
  34458. $grid: $xeGrid,
  34459. $gantt: null
  34460. }));
  34461. }
  34462. return grid_renderEmptyElement($xeGrid);
  34463. },
  34464. renderTable(h) {
  34465. const $xeGrid = this;
  34466. const slots = $xeGrid.$scopedSlots;
  34467. const tableProps = $xeGrid.computeTableProps;
  34468. return h('div', {
  34469. class: 'vxe-grid--table-wrapper'
  34470. }, [h(table, {
  34471. key: 'table',
  34472. props: tableProps,
  34473. on: getTableOns($xeGrid),
  34474. scopedSlots: slots,
  34475. ref: 'refTable'
  34476. })]);
  34477. },
  34478. renderBottom(h) {
  34479. const $xeGrid = this;
  34480. const slots = $xeGrid.$scopedSlots;
  34481. const bottomSlot = slots.bottom;
  34482. return bottomSlot ? h('div', {
  34483. key: 'bottom',
  34484. ref: 'refBottomWrapper',
  34485. class: 'vxe-grid--bottom-wrapper'
  34486. }, bottomSlot.call($xeGrid, {
  34487. $grid: $xeGrid,
  34488. $gantt: null
  34489. })) : grid_renderEmptyElement($xeGrid);
  34490. },
  34491. renderPager(h) {
  34492. const VxeUIPagerComponent = core_.VxeUI.getComponent('VxePager');
  34493. const $xeGrid = this;
  34494. const props = $xeGrid;
  34495. const slots = $xeGrid.$scopedSlots;
  34496. const reactData = $xeGrid.reactData;
  34497. const {
  34498. proxyConfig,
  34499. pagerConfig
  34500. } = props;
  34501. const proxyOpts = $xeGrid.computeProxyOpts;
  34502. const pagerOpts = $xeGrid.computePagerOpts;
  34503. const pagerSlot = slots.pager;
  34504. if (pagerConfig && isEnableConf(pagerOpts) || slots.pager) {
  34505. return h('div', {
  34506. ref: 'refPagerWrapper',
  34507. key: 'pager',
  34508. class: 'vxe-grid--pager-wrapper'
  34509. }, pagerSlot ? pagerSlot.call($xeGrid, {
  34510. $grid: $xeGrid,
  34511. $gantt: null
  34512. }) : [VxeUIPagerComponent ? h(VxeUIPagerComponent, {
  34513. ref: 'refPager',
  34514. props: {
  34515. ...pagerOpts,
  34516. ...(proxyConfig && isEnableConf(proxyOpts) ? reactData.tablePage : {})
  34517. },
  34518. on: {
  34519. 'page-change': $xeGrid.pageChangeEvent
  34520. },
  34521. scopedSlots: $xeGrid.getConfigSlot(pagerOpts.slots)
  34522. }) : grid_renderEmptyElement($xeGrid)]);
  34523. }
  34524. return grid_renderEmptyElement($xeGrid);
  34525. },
  34526. renderChildLayout(h, layoutKeys) {
  34527. const $xeGrid = this;
  34528. const childVNs = [];
  34529. layoutKeys.forEach(key => {
  34530. switch (key) {
  34531. case 'Form':
  34532. childVNs.push($xeGrid.renderForm(h));
  34533. break;
  34534. case 'Toolbar':
  34535. childVNs.push($xeGrid.renderToolbar(h));
  34536. break;
  34537. case 'Top':
  34538. childVNs.push($xeGrid.renderTop(h));
  34539. break;
  34540. case 'Table':
  34541. childVNs.push(h('div', {
  34542. key: 'table',
  34543. class: 'vxe-grid--table-container'
  34544. }, [$xeGrid.renderTableLeft(h), $xeGrid.renderTable(h), $xeGrid.renderTableRight(h)]));
  34545. break;
  34546. case 'Bottom':
  34547. childVNs.push($xeGrid.renderBottom(h));
  34548. break;
  34549. case 'Pager':
  34550. childVNs.push($xeGrid.renderPager(h));
  34551. break;
  34552. default:
  34553. errLog('vxe.error.notProp', [`[grid] layouts -> ${key}`]);
  34554. break;
  34555. }
  34556. });
  34557. return childVNs;
  34558. },
  34559. renderLayout(h) {
  34560. const $xeGrid = this;
  34561. const slots = $xeGrid.$scopedSlots;
  34562. const currLayoutConf = $xeGrid.computeCurrLayoutConf;
  34563. const {
  34564. headKeys,
  34565. bodyKeys,
  34566. footKeys
  34567. } = currLayoutConf;
  34568. const asideLeftSlot = slots.asideLeft || slots['aside-left'];
  34569. const asideRightSlot = slots.asideRight || slots['aside-right'];
  34570. return [h('div', {
  34571. class: 'vxe-grid--layout-header-wrapper'
  34572. }, $xeGrid.renderChildLayout(h, headKeys)), h('div', {
  34573. class: 'vxe-grid--layout-body-wrapper'
  34574. }, [asideLeftSlot ? h('div', {
  34575. class: 'vxe-grid--layout-aside-left-wrapper'
  34576. }, asideLeftSlot({})) : grid_renderEmptyElement($xeGrid), h('div', {
  34577. class: 'vxe-grid--layout-body-content-wrapper'
  34578. }, $xeGrid.renderChildLayout(h, bodyKeys)), asideRightSlot ? h('div', {
  34579. class: 'vxe-grid--layout-aside-right-wrapper'
  34580. }, asideRightSlot({})) : grid_renderEmptyElement($xeGrid)]), h('div', {
  34581. class: 'vxe-grid--layout-footer-wrapper'
  34582. }, $xeGrid.renderChildLayout(h, footKeys)), h('div', {
  34583. ref: 'refPopupContainerElem'
  34584. })];
  34585. },
  34586. renderVN(h) {
  34587. const $xeGrid = this;
  34588. const props = $xeGrid;
  34589. const reactData = $xeGrid.reactData;
  34590. const vSize = $xeGrid.computeSize;
  34591. const styles = $xeGrid.computeStyles;
  34592. const isLoading = $xeGrid.computeIsLoading;
  34593. return h('div', {
  34594. ref: 'refElem',
  34595. class: ['vxe-grid', {
  34596. [`size--${vSize}`]: vSize,
  34597. 'is--animat': !!props.animat,
  34598. 'is--round': props.round,
  34599. 'is--maximize': reactData.isZMax,
  34600. 'is--loading': isLoading
  34601. }],
  34602. style: styles
  34603. }, $xeGrid.renderLayout(h));
  34604. }
  34605. },
  34606. created() {
  34607. // 使用已安装的组件,如果未安装则不渲染
  34608. const VxeUIFormComponent = core_.VxeUI.getComponent('VxeForm');
  34609. const VxeUIPagerComponent = core_.VxeUI.getComponent('VxePager');
  34610. const $xeGrid = this;
  34611. const props = $xeGrid;
  34612. const proxyOpts = $xeGrid.computeProxyOpts;
  34613. // const { data, formOpts, proxyOpts, proxyConfig } = this
  34614. // if (proxyConfig && (data || (proxyOpts.form && formOpts.data))) {
  34615. // errLog('vxe.error.errConflicts', ['[grid] data', 'proxy-config'])
  34616. // }
  34617. if (props.toolbar) {
  34618. errLog('vxe.error.delProp', ['[grid] toolbar', 'toolbar-config']);
  34619. }
  34620. if (props.toolbarConfig && !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isObject(props.toolbarConfig)) {
  34621. errLog('vxe.error.errProp', [`[grid] toolbar-config=${props.toolbarConfig}`, 'toolbar-config={}']);
  34622. }
  34623. if (proxyOpts.props) {
  34624. warnLog('vxe.error.delProp', ['[grid] proxy-config.props', 'proxy-config.response']);
  34625. }
  34626. $xeGrid.$nextTick(() => {
  34627. if (props.formConfig) {
  34628. if (!VxeUIFormComponent) {
  34629. errLog('vxe.error.reqComp', ['vxe-form']);
  34630. }
  34631. }
  34632. if (props.pagerConfig) {
  34633. if (!VxeUIPagerComponent) {
  34634. errLog('vxe.error.reqComp', ['vxe-pager']);
  34635. }
  34636. }
  34637. });
  34638. $xeGrid.initPages();
  34639. grid_globalEvents.on($xeGrid, 'keydown', $xeGrid.handleGlobalKeydownEvent);
  34640. },
  34641. mounted() {
  34642. const $xeGrid = this;
  34643. const props = $xeGrid;
  34644. const {
  34645. columns
  34646. } = props;
  34647. if (columns && columns.length) {
  34648. $xeGrid.loadColumn(columns);
  34649. }
  34650. $xeGrid.initToolbar();
  34651. $xeGrid.initProxy();
  34652. },
  34653. destroyed() {
  34654. const $xeGrid = this;
  34655. const internalData = $xeGrid.internalData;
  34656. grid_globalEvents.off($xeGrid, 'keydown');
  34657. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().assign(internalData, grid_createInternalData());
  34658. },
  34659. render(h) {
  34660. return this.renderVN(h);
  34661. }
  34662. })); /* define-vxe-component end */
  34663. ;// CONCATENATED MODULE: ./packages/grid/index.ts
  34664. let isReg = false;
  34665. const VxeGrid = Object.assign({}, grid, {
  34666. install(app) {
  34667. if (!isReg) {
  34668. isReg = true;
  34669. if (core_.VxeUI.dynamicApp) {
  34670. core_.VxeUI.dynamicApp.component(grid.name, grid);
  34671. }
  34672. }
  34673. app.component(grid.name, grid);
  34674. }
  34675. });
  34676. core_.VxeUI.component(grid);
  34677. const Grid = VxeGrid;
  34678. /* harmony default export */ var packages_grid = ((/* unused pure expression or super */ null && (VxeGrid)));
  34679. // EXTERNAL MODULE: external {"commonjs":"vue","commonjs2":"vue","root":"Vue"}
  34680. var external_commonjs_vue_commonjs2_vue_root_Vue_ = __webpack_require__(9274);
  34681. var external_commonjs_vue_commonjs2_vue_root_Vue_default = /*#__PURE__*/__webpack_require__.n(external_commonjs_vue_commonjs2_vue_root_Vue_);
  34682. ;// CONCATENATED MODULE: ./packages/table/render/index.ts
  34683. const {
  34684. getConfig: render_getConfig,
  34685. renderer: render_renderer,
  34686. getI18n: render_getI18n,
  34687. getComponent
  34688. } = core_.VxeUI;
  34689. const componentDefaultModelProp = 'value';
  34690. const defaultCompProps = {};
  34691. function handleDefaultValue(value, defaultVal, initVal) {
  34692. return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(value) ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(defaultVal) ? initVal : defaultVal : value;
  34693. }
  34694. function parseDate(value, props) {
  34695. return value && props.valueFormat ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toStringDate(value, props.valueFormat) : value;
  34696. }
  34697. function getFormatDate(value, props, defaultFormat) {
  34698. const {
  34699. dateConfig = {}
  34700. } = props;
  34701. return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toDateString(parseDate(value, props), dateConfig.labelFormat || defaultFormat);
  34702. }
  34703. function getLabelFormatDate(value, props) {
  34704. return getFormatDate(value, props, render_getI18n(`vxe.input.date.labelFormat.${props.type || 'date'}`));
  34705. }
  34706. /**
  34707. * 已废弃
  34708. * @deprecated
  34709. */
  34710. function getOldComponentName(name) {
  34711. return `vxe-${name.replace('$', '')}`;
  34712. }
  34713. /**
  34714. * 已废弃
  34715. * @deprecated
  34716. */
  34717. function getOldComponent({
  34718. name
  34719. }) {
  34720. return getOldComponentName(name);
  34721. }
  34722. function getDefaultComponent({
  34723. name
  34724. }) {
  34725. return getComponent(name) || name;
  34726. }
  34727. function updateFilterChangeOption(params, checked, option) {
  34728. const {
  34729. $table
  34730. } = params;
  34731. $table.updateFilterOptionStatus(option, checked);
  34732. }
  34733. function saveFilterEvent(params) {
  34734. const {
  34735. $table,
  34736. column
  34737. } = params;
  34738. $table.saveFilterByEvent(new Event('change'), column);
  34739. }
  34740. function getNativeAttrs(renderOpts) {
  34741. let {
  34742. name,
  34743. attrs
  34744. } = renderOpts;
  34745. if (name === 'input') {
  34746. attrs = Object.assign({
  34747. type: 'text'
  34748. }, attrs);
  34749. }
  34750. return attrs;
  34751. }
  34752. function getInputImmediateModel(renderOpts) {
  34753. const {
  34754. name,
  34755. immediate,
  34756. props
  34757. } = renderOpts;
  34758. if (!immediate) {
  34759. if (name === 'VxeInput' || name === '$input') {
  34760. const {
  34761. type
  34762. } = props || {};
  34763. return !(!type || type === 'text' || type === 'number' || type === 'integer' || type === 'float');
  34764. }
  34765. if (name === 'input' || name === 'textarea' || name === '$textarea') {
  34766. return false;
  34767. }
  34768. return true;
  34769. }
  34770. return immediate;
  34771. }
  34772. function getCellEditProps(renderOpts, params, value, defaultProps) {
  34773. return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().assign({
  34774. immediate: getInputImmediateModel(renderOpts)
  34775. }, defaultCompProps, defaultProps, renderOpts.props, {
  34776. [componentDefaultModelProp]: value
  34777. });
  34778. }
  34779. function getCellEditFilterProps(renderOpts, params, value, defaultProps) {
  34780. return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().assign({}, defaultCompProps, defaultProps, renderOpts.props, {
  34781. [componentDefaultModelProp]: value
  34782. });
  34783. }
  34784. function isImmediateCell(renderOpts, params) {
  34785. return params.$type === 'cell' || getInputImmediateModel(renderOpts);
  34786. }
  34787. function getCellLabelVNs(h, renderOpts, params, cellLabel, opts) {
  34788. const {
  34789. placeholder
  34790. } = renderOpts;
  34791. return [h('span', {
  34792. class: ['vxe-cell--label', opts ? opts.class : '']
  34793. }, placeholder && isEmptyValue(cellLabel) ? [h('span', {
  34794. class: 'vxe-cell--placeholder'
  34795. }, formatText(getFuncText(placeholder), 1))] : formatText(cellLabel, 1))];
  34796. }
  34797. /**
  34798. * 原生事件处理
  34799. * @param renderOpts
  34800. * @param params
  34801. * @param modelFunc
  34802. * @param changeFunc
  34803. */
  34804. function getNativeElementOns(renderOpts, params, eFns) {
  34805. const {
  34806. events
  34807. } = renderOpts;
  34808. const modelEvent = getModelEvent(renderOpts);
  34809. const changeEvent = getChangeEvent(renderOpts);
  34810. const {
  34811. model: modelFunc,
  34812. change: changeFunc,
  34813. blur: blurFunc
  34814. } = eFns || {};
  34815. const isSameEvent = changeEvent === modelEvent;
  34816. const ons = {};
  34817. if (events) {
  34818. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().objectEach(events, (func, key) => {
  34819. ons[getOnName(key)] = function (...args) {
  34820. func(params, ...args);
  34821. };
  34822. });
  34823. }
  34824. if (modelFunc) {
  34825. ons[getOnName(modelEvent)] = function (targetEvnt) {
  34826. modelFunc(targetEvnt);
  34827. if (isSameEvent && changeFunc) {
  34828. changeFunc(targetEvnt);
  34829. }
  34830. if (events && events[modelEvent]) {
  34831. events[modelEvent](params, targetEvnt);
  34832. }
  34833. };
  34834. }
  34835. if (!isSameEvent && changeFunc) {
  34836. ons[getOnName(changeEvent)] = function (evnt) {
  34837. changeFunc(evnt);
  34838. if (events && events[changeEvent]) {
  34839. events[changeEvent](params, evnt);
  34840. }
  34841. };
  34842. }
  34843. if (blurFunc) {
  34844. ons[getOnName(blurEvent)] = function (evnt) {
  34845. blurFunc(evnt);
  34846. if (events && events[blurEvent]) {
  34847. events[blurEvent](params, evnt);
  34848. }
  34849. };
  34850. }
  34851. return ons;
  34852. }
  34853. const blurEvent = 'blur';
  34854. const clearEvent = 'clear';
  34855. /**
  34856. * 组件事件处理
  34857. * @param renderOpts
  34858. * @param params
  34859. * @param modelFunc
  34860. * @param changeFunc
  34861. */
  34862. function getComponentOns(renderOpts, params, eFns, eventOns) {
  34863. const {
  34864. events
  34865. } = renderOpts;
  34866. const modelEvent = getModelEvent(renderOpts);
  34867. const changeEvent = getChangeEvent(renderOpts);
  34868. const {
  34869. model: modelFunc,
  34870. change: changeFunc,
  34871. blur: blurFunc,
  34872. clear: clearFunc
  34873. } = eFns || {};
  34874. const ons = {};
  34875. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().objectEach(events, (func, key) => {
  34876. ons[getOnName(key)] = function (...args) {
  34877. if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(func)) {
  34878. errLog('vxe.error.errFunc', [func]);
  34879. }
  34880. func(params, ...args);
  34881. };
  34882. });
  34883. if (modelFunc) {
  34884. ons[getOnName(modelEvent)] = function (targetEvnt) {
  34885. modelFunc(targetEvnt);
  34886. if (events && events[modelEvent]) {
  34887. events[modelEvent](params, targetEvnt);
  34888. }
  34889. };
  34890. }
  34891. if (changeFunc) {
  34892. ons[getOnName(changeEvent)] = function (...args) {
  34893. changeFunc(...args);
  34894. if (events && events[changeEvent]) {
  34895. events[changeEvent](params, ...args);
  34896. }
  34897. };
  34898. }
  34899. if (blurFunc) {
  34900. ons[getOnName(blurEvent)] = function (...args) {
  34901. blurFunc(...args);
  34902. if (events && events[blurEvent]) {
  34903. events[blurEvent](params, ...args);
  34904. }
  34905. };
  34906. }
  34907. if (clearFunc) {
  34908. ons[getOnName(clearEvent)] = function (...args) {
  34909. clearFunc(...args);
  34910. if (events && events[clearEvent]) {
  34911. events[clearEvent](params, ...args);
  34912. }
  34913. };
  34914. }
  34915. return eventOns ? Object.assign(ons, eventOns) : ons;
  34916. }
  34917. function getEditOns(renderOpts, params) {
  34918. const {
  34919. $table,
  34920. row,
  34921. column
  34922. } = params;
  34923. const {
  34924. name
  34925. } = renderOpts;
  34926. const {
  34927. model
  34928. } = column;
  34929. const isImmediate = isImmediateCell(renderOpts, params);
  34930. return getComponentOns(renderOpts, params, {
  34931. model(cellValue) {
  34932. // 处理 model 值双向绑定
  34933. model.update = true;
  34934. model.value = cellValue;
  34935. if (isImmediate) {
  34936. setCellValue(row, column, cellValue);
  34937. }
  34938. },
  34939. change(eventParams) {
  34940. // 处理 change 事件相关逻辑
  34941. if (!isImmediate && name && ['VxeInput', 'VxeNumberInput', 'VxeTextarea', '$input', '$textarea'].includes(name)) {
  34942. const cellValue = eventParams.value;
  34943. model.update = true;
  34944. model.value = cellValue;
  34945. $table.updateStatus(params, cellValue);
  34946. } else {
  34947. $table.updateStatus(params);
  34948. }
  34949. },
  34950. blur() {
  34951. if (isImmediate) {
  34952. $table.handleCellRuleUpdateStatus('blur', params);
  34953. } else {
  34954. $table.handleCellRuleUpdateStatus('blur', params, model.value);
  34955. }
  34956. }
  34957. });
  34958. }
  34959. function getFilterOns(renderOpts, params, option) {
  34960. return getComponentOns(renderOpts, params, {
  34961. model(value) {
  34962. // 处理 model 值双向绑定
  34963. option.data = value;
  34964. },
  34965. change() {
  34966. updateFilterChangeOption(params, !isEmptyValue(option.data), option);
  34967. },
  34968. blur() {
  34969. updateFilterChangeOption(params, !isEmptyValue(option.data), option);
  34970. }
  34971. });
  34972. }
  34973. function getFloatingFilterOns(renderOpts, params, option) {
  34974. const {
  34975. $table,
  34976. column
  34977. } = params;
  34978. if (hasInputType(renderOpts)) {
  34979. return getComponentOns(renderOpts, params, {
  34980. model(value) {
  34981. // 处理 model 值双向绑定
  34982. option.data = value;
  34983. },
  34984. change() {
  34985. updateFilterChangeOption(params, !isEmptyValue(option.data), option);
  34986. },
  34987. clear() {
  34988. updateFilterChangeOption(params, !isEmptyValue(option.data), option);
  34989. saveFilterEvent(params);
  34990. },
  34991. blur() {
  34992. $table.saveFilterByEvent(new Event('change'), column);
  34993. }
  34994. }, renderOpts.name === 'VxeNumberInput' ? {
  34995. [getOnName('plus-number')]() {
  34996. updateFilterChangeOption(params, !isEmptyValue(option.data), option);
  34997. saveFilterEvent(params);
  34998. },
  34999. [getOnName('minus-number')]() {
  35000. updateFilterChangeOption(params, !isEmptyValue(option.data), option);
  35001. saveFilterEvent(params);
  35002. }
  35003. } : {});
  35004. }
  35005. return getComponentOns(renderOpts, params, {
  35006. model(value) {
  35007. // 处理 model 值双向绑定
  35008. option.data = value;
  35009. },
  35010. clear() {
  35011. updateFilterChangeOption(params, !isEmptyValue(option.data), option);
  35012. $table.saveFilterByEvent(new Event('change'), column);
  35013. },
  35014. change() {
  35015. updateFilterChangeOption(params, !isEmptyValue(option.data), option);
  35016. $table.saveFilterByEvent(new Event('change'), column);
  35017. }
  35018. });
  35019. }
  35020. function getNativeEditOns(renderOpts, params) {
  35021. const {
  35022. $table,
  35023. row,
  35024. column
  35025. } = params;
  35026. const {
  35027. model
  35028. } = column;
  35029. return getNativeElementOns(renderOpts, params, {
  35030. model(evnt) {
  35031. // 处理 model 值双向绑定
  35032. const targetEl = evnt.target;
  35033. if (targetEl) {
  35034. const cellValue = targetEl.value;
  35035. if (isImmediateCell(renderOpts, params)) {
  35036. setCellValue(row, column, cellValue);
  35037. } else {
  35038. model.update = true;
  35039. model.value = cellValue;
  35040. }
  35041. }
  35042. },
  35043. change(evnt) {
  35044. // 处理 change 事件相关逻辑
  35045. const targetEl = evnt.target;
  35046. if (targetEl) {
  35047. const cellValue = targetEl.value;
  35048. $table.updateStatus(params, cellValue);
  35049. }
  35050. },
  35051. blur(evnt) {
  35052. const targetEl = evnt.target;
  35053. if (targetEl) {
  35054. const cellValue = targetEl.value;
  35055. $table.updateStatus(params, cellValue);
  35056. }
  35057. }
  35058. });
  35059. }
  35060. function getNativeFilterOns(renderOpts, params, option) {
  35061. return getNativeElementOns(renderOpts, params, {
  35062. model(evnt) {
  35063. // 处理 model 值双向绑定
  35064. const targetEl = evnt.target;
  35065. if (targetEl) {
  35066. option.data = targetEl.value;
  35067. }
  35068. },
  35069. change() {
  35070. updateFilterChangeOption(params, !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(option.data), option);
  35071. },
  35072. blur() {
  35073. updateFilterChangeOption(params, !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(option.data), option);
  35074. }
  35075. });
  35076. }
  35077. /**
  35078. * 单元格可编辑渲染-原生的标签
  35079. * input、textarea、select
  35080. */
  35081. function nativeEditRender(h, renderOpts, params) {
  35082. const {
  35083. row,
  35084. column
  35085. } = params;
  35086. const {
  35087. name
  35088. } = renderOpts;
  35089. const cellValue = isImmediateCell(renderOpts, params) ? getCellValue(row, column) : column.model.value;
  35090. return [h(`${name}`, {
  35091. class: `vxe-default-${name}`,
  35092. attrs: getNativeAttrs(renderOpts),
  35093. domProps: {
  35094. value: cellValue
  35095. },
  35096. on: getNativeEditOns(renderOpts, params)
  35097. })];
  35098. }
  35099. function buttonCellRender(h, renderOpts, params) {
  35100. return [h(getDefaultComponent(renderOpts), {
  35101. props: getCellEditProps(renderOpts, params, null),
  35102. on: getComponentOns(renderOpts, params)
  35103. })];
  35104. }
  35105. function defaultEditRender(h, renderOpts, params) {
  35106. const {
  35107. row,
  35108. column
  35109. } = params;
  35110. const cellValue = getCellValue(row, column);
  35111. return [h(getDefaultComponent(renderOpts), {
  35112. props: getCellEditProps(renderOpts, params, cellValue),
  35113. on: getEditOns(renderOpts, params)
  35114. })];
  35115. }
  35116. function checkboxEditRender(h, renderOpts, params) {
  35117. const {
  35118. row,
  35119. column
  35120. } = params;
  35121. const cellValue = getCellValue(row, column);
  35122. return [h(getDefaultComponent(renderOpts), {
  35123. props: getCellEditProps(renderOpts, params, cellValue),
  35124. on: getEditOns(renderOpts, params)
  35125. })];
  35126. }
  35127. function radioAndCheckboxGroupEditRender(h, renderOpts, params) {
  35128. const {
  35129. options
  35130. } = renderOpts;
  35131. const {
  35132. row,
  35133. column
  35134. } = params;
  35135. const cellValue = getCellValue(row, column);
  35136. return [h(getDefaultComponent(renderOpts), {
  35137. props: {
  35138. options,
  35139. ...getCellEditProps(renderOpts, params, cellValue)
  35140. },
  35141. on: getEditOns(renderOpts, params)
  35142. })];
  35143. }
  35144. /**
  35145. * 已废弃
  35146. * @deprecated
  35147. */
  35148. function oldEditRender(h, renderOpts, params) {
  35149. const {
  35150. row,
  35151. column
  35152. } = params;
  35153. const cellValue = getCellValue(row, column);
  35154. return [h(getOldComponent(renderOpts), {
  35155. props: getCellEditProps(renderOpts, params, cellValue),
  35156. on: getEditOns(renderOpts, params)
  35157. })];
  35158. }
  35159. /**
  35160. * 已废弃
  35161. * @deprecated
  35162. */
  35163. function oldButtonEditRender(h, renderOpts, params) {
  35164. return [h('vxe-button', {
  35165. props: getCellEditProps(renderOpts, params, null),
  35166. on: getComponentOns(renderOpts, params)
  35167. })];
  35168. }
  35169. /**
  35170. * 已废弃
  35171. * @deprecated
  35172. */
  35173. function oldButtonsEditRender(h, renderOpts, params) {
  35174. const {
  35175. children
  35176. } = renderOpts;
  35177. return children ? children.map(childRenderOpts => oldButtonEditRender(h, childRenderOpts, params)[0]) : [];
  35178. }
  35179. function renderNativeOptgroups(h, renderOpts, params, renderOptionsMethods) {
  35180. const {
  35181. optionGroups,
  35182. optionGroupProps = {}
  35183. } = renderOpts;
  35184. const groupOptions = optionGroupProps.options || 'options';
  35185. const groupLabel = optionGroupProps.label || 'label';
  35186. if (optionGroups) {
  35187. return optionGroups.map((group, gIndex) => {
  35188. return h('optgroup', {
  35189. key: gIndex,
  35190. attrs: {
  35191. label: group[groupLabel]
  35192. }
  35193. }, renderOptionsMethods(h, group[groupOptions], renderOpts, params));
  35194. });
  35195. }
  35196. return [];
  35197. }
  35198. /**
  35199. * 渲染原生的 option 标签
  35200. */
  35201. function renderNativeOptions(h, options, renderOpts, params) {
  35202. const {
  35203. optionProps = {}
  35204. } = renderOpts;
  35205. const {
  35206. row,
  35207. column
  35208. } = params;
  35209. const labelProp = optionProps.label || 'label';
  35210. const valueProp = optionProps.value || 'value';
  35211. const disabledProp = optionProps.disabled || 'disabled';
  35212. const cellValue = isImmediateCell(renderOpts, params) ? getCellValue(row, column) : column.model.value;
  35213. if (options) {
  35214. return options.map((option, oIndex) => {
  35215. return h('option', {
  35216. key: oIndex,
  35217. attrs: {
  35218. value: option[valueProp],
  35219. disabled: option[disabledProp]
  35220. },
  35221. domProps: {
  35222. /* eslint-disable eqeqeq */
  35223. selected: option[valueProp] == cellValue
  35224. }
  35225. }, option[labelProp]);
  35226. });
  35227. }
  35228. return [];
  35229. }
  35230. function nativeFilterRender(h, renderOpts, params) {
  35231. const {
  35232. column
  35233. } = params;
  35234. const {
  35235. name
  35236. } = renderOpts;
  35237. const attrs = getNativeAttrs(renderOpts);
  35238. return column.filters.map((option, oIndex) => {
  35239. return h(`${name}`, {
  35240. key: oIndex,
  35241. class: `vxe-default-${name}`,
  35242. attrs,
  35243. domProps: {
  35244. value: option.data
  35245. },
  35246. on: getNativeFilterOns(renderOpts, params, option)
  35247. });
  35248. });
  35249. }
  35250. function defaultFilterRender(h, renderOpts, params) {
  35251. const {
  35252. column
  35253. } = params;
  35254. return column.filters.map((option, oIndex) => {
  35255. const optionValue = option.data;
  35256. return h(getDefaultComponent(renderOpts), {
  35257. key: oIndex,
  35258. props: getCellEditFilterProps(renderOpts, renderOpts, optionValue),
  35259. on: getFilterOns(renderOpts, params, option)
  35260. });
  35261. });
  35262. }
  35263. function defaultFloatingFilterRender(h, renderOpts, params) {
  35264. const {
  35265. option
  35266. } = params;
  35267. const optionValue = option.data;
  35268. return [h(getDefaultComponent(renderOpts), {
  35269. props: getCellEditFilterProps(renderOpts, renderOpts, optionValue),
  35270. on: getFloatingFilterOns(renderOpts, params, option)
  35271. })];
  35272. }
  35273. function defaultFilterOptions() {
  35274. return [{
  35275. data: null
  35276. }];
  35277. }
  35278. /**
  35279. * 已废弃
  35280. * @deprecated
  35281. */
  35282. function oldFilterRender(h, renderOpts, params) {
  35283. const {
  35284. column
  35285. } = params;
  35286. return column.filters.map((option, oIndex) => {
  35287. const optionValue = option.data;
  35288. return h(getOldComponent(renderOpts), {
  35289. key: oIndex,
  35290. props: getCellEditFilterProps(renderOpts, renderOpts, optionValue),
  35291. on: getFilterOns(renderOpts, params, option)
  35292. });
  35293. });
  35294. }
  35295. function handleFilterMethod({
  35296. option,
  35297. row,
  35298. column
  35299. }) {
  35300. const {
  35301. data
  35302. } = option;
  35303. const cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, column.field);
  35304. /* eslint-disable eqeqeq */
  35305. return cellValue == data;
  35306. }
  35307. function handleInputFilterMethod({
  35308. option,
  35309. row,
  35310. column
  35311. }) {
  35312. const {
  35313. data
  35314. } = option;
  35315. const cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, column.field);
  35316. /* eslint-disable eqeqeq */
  35317. return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toValueString(cellValue).indexOf(data) > -1;
  35318. }
  35319. function nativeSelectEditRender(h, renderOpts, params) {
  35320. return [h('select', {
  35321. class: 'vxe-default-select',
  35322. attrs: getNativeAttrs(renderOpts),
  35323. on: getNativeEditOns(renderOpts, params)
  35324. }, renderOpts.optionGroups ? renderNativeOptgroups(h, renderOpts, params, renderNativeOptions) : renderNativeOptions(h, renderOpts.options, renderOpts, params))];
  35325. }
  35326. function defaultSelectEditRender(h, renderOpts, params) {
  35327. const {
  35328. row,
  35329. column
  35330. } = params;
  35331. const {
  35332. options,
  35333. optionProps,
  35334. optionGroups,
  35335. optionGroupProps
  35336. } = renderOpts;
  35337. const cellValue = getCellValue(row, column);
  35338. return [h(getDefaultComponent(renderOpts), {
  35339. props: getCellEditProps(renderOpts, params, cellValue, {
  35340. options,
  35341. optionProps,
  35342. optionGroups,
  35343. optionGroupProps
  35344. }),
  35345. on: getEditOns(renderOpts, params)
  35346. })];
  35347. }
  35348. function defaultTableOrTreeSelectEditRender(h, renderOpts, params) {
  35349. const {
  35350. row,
  35351. column
  35352. } = params;
  35353. const {
  35354. options,
  35355. optionProps
  35356. } = renderOpts;
  35357. const cellValue = getCellValue(row, column);
  35358. return [h(getDefaultComponent(renderOpts), {
  35359. props: getCellEditProps(renderOpts, params, cellValue, {
  35360. options,
  35361. optionProps
  35362. }),
  35363. on: getEditOns(renderOpts, params)
  35364. })];
  35365. }
  35366. /**
  35367. * 已废弃
  35368. * @deprecated
  35369. */
  35370. function oldSelectEditRender(h, renderOpts, params) {
  35371. const {
  35372. row,
  35373. column
  35374. } = params;
  35375. const {
  35376. options,
  35377. optionProps,
  35378. optionGroups,
  35379. optionGroupProps
  35380. } = renderOpts;
  35381. const cellValue = getCellValue(row, column);
  35382. return [h(getOldComponent(renderOpts), {
  35383. props: getCellEditProps(renderOpts, params, cellValue, {
  35384. options,
  35385. optionProps,
  35386. optionGroups,
  35387. optionGroupProps
  35388. }),
  35389. on: getEditOns(renderOpts, params)
  35390. })];
  35391. }
  35392. function getSelectCellValue(renderOpts, {
  35393. row,
  35394. column
  35395. }) {
  35396. const {
  35397. options,
  35398. optionGroups,
  35399. optionProps = {},
  35400. optionGroupProps = {},
  35401. props = {}
  35402. } = renderOpts;
  35403. const cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, column.field);
  35404. let selectItem;
  35405. const labelProp = optionProps.label || 'label';
  35406. const valueProp = optionProps.value || 'value';
  35407. if (!(cellValue === null || cellValue === undefined)) {
  35408. let vals = [];
  35409. if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(cellValue)) {
  35410. vals = cellValue;
  35411. } else {
  35412. if (props.multiple && `${cellValue}`.indexOf(',') > -1) {
  35413. vals = `${cellValue}`.split(',');
  35414. } else {
  35415. vals = [cellValue];
  35416. }
  35417. }
  35418. return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().map(vals, optionGroups ? value => {
  35419. const groupOptions = optionGroupProps.options || 'options';
  35420. for (let index = 0; index < optionGroups.length; index++) {
  35421. /* eslint-disable eqeqeq */
  35422. selectItem = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().find(optionGroups[index][groupOptions], item => item[valueProp] == value);
  35423. if (selectItem) {
  35424. break;
  35425. }
  35426. }
  35427. return selectItem ? selectItem[labelProp] : value;
  35428. } : value => {
  35429. /* eslint-disable eqeqeq */
  35430. selectItem = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().find(options, item => item[valueProp] == value);
  35431. return selectItem ? selectItem[labelProp] : value;
  35432. }).join(', ');
  35433. }
  35434. return '';
  35435. }
  35436. function handleExportSelectMethod(params) {
  35437. const {
  35438. row,
  35439. column,
  35440. options
  35441. } = params;
  35442. return options.original ? getCellValue(row, column) : getSelectCellValue(column.editRender || column.cellRender, params);
  35443. }
  35444. function getTreeSelectCellValue(renderOpts, {
  35445. row,
  35446. column
  35447. }) {
  35448. const {
  35449. options,
  35450. optionProps = {}
  35451. } = renderOpts;
  35452. const cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, column.field);
  35453. const labelProp = optionProps.label || 'label';
  35454. const valueProp = optionProps.value || 'value';
  35455. const childrenProp = optionProps.children || 'children';
  35456. if (!(cellValue === null || cellValue === undefined)) {
  35457. const keyMaps = {};
  35458. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(options, item => {
  35459. keyMaps[external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(item, valueProp)] = item;
  35460. }, {
  35461. children: childrenProp
  35462. });
  35463. return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().map(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(cellValue) ? cellValue : [cellValue], value => {
  35464. const item = keyMaps[value];
  35465. return item ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(item, labelProp) : item;
  35466. }).join(', ');
  35467. }
  35468. return '';
  35469. }
  35470. function handleExportTreeSelectMethod(params) {
  35471. const {
  35472. row,
  35473. column,
  35474. options
  35475. } = params;
  35476. return options.original ? getCellValue(row, column) : getTreeSelectCellValue(column.editRender || column.cellRender, params);
  35477. }
  35478. function handleNumberCell(h, renderOpts, params) {
  35479. const {
  35480. props = {},
  35481. showNegativeStatus
  35482. } = renderOpts;
  35483. const {
  35484. row,
  35485. column
  35486. } = params;
  35487. const {
  35488. type
  35489. } = props;
  35490. let cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, column.field);
  35491. let isNegative = false;
  35492. if (!isEmptyValue(cellValue)) {
  35493. const numberInputConfig = render_getConfig().numberInput || {};
  35494. if (type === 'float') {
  35495. const autoFill = handleDefaultValue(props.autoFill, numberInputConfig.autoFill, true);
  35496. const digits = handleDefaultValue(props.digits, numberInputConfig.digits, 1);
  35497. cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toFixed(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().floor(cellValue, digits), digits);
  35498. if (!autoFill) {
  35499. cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(cellValue);
  35500. }
  35501. if (showNegativeStatus) {
  35502. if (cellValue < 0) {
  35503. isNegative = true;
  35504. }
  35505. }
  35506. } else if (type === 'amount') {
  35507. const autoFill = handleDefaultValue(props.autoFill, numberInputConfig.autoFill, true);
  35508. const digits = handleDefaultValue(props.digits, numberInputConfig.digits, 2);
  35509. const showCurrency = handleDefaultValue(props.showCurrency, numberInputConfig.showCurrency, false);
  35510. cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(cellValue);
  35511. if (showNegativeStatus) {
  35512. if (cellValue < 0) {
  35513. isNegative = true;
  35514. }
  35515. }
  35516. cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().commafy(cellValue, {
  35517. digits
  35518. });
  35519. if (!autoFill) {
  35520. const [iStr, dStr] = cellValue.split('.');
  35521. if (dStr) {
  35522. const dRest = dStr.replace(/0+$/, '');
  35523. cellValue = dRest ? [iStr, '.', dRest].join('') : iStr;
  35524. }
  35525. }
  35526. if (showCurrency) {
  35527. cellValue = `${props.currencySymbol || numberInputConfig.currencySymbol || render_getI18n('vxe.numberInput.currencySymbol') || ''}${cellValue}`;
  35528. }
  35529. } else {
  35530. if (showNegativeStatus) {
  35531. if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(cellValue) < 0) {
  35532. isNegative = true;
  35533. }
  35534. }
  35535. }
  35536. }
  35537. return getCellLabelVNs(h, renderOpts, params, cellValue, isNegative ? {
  35538. class: 'is--negative'
  35539. } : {});
  35540. }
  35541. /**
  35542. * 表格 - 渲染器
  35543. */
  35544. render_renderer.mixin({
  35545. input: {
  35546. tableAutoFocus: 'input',
  35547. renderTableEdit: nativeEditRender,
  35548. renderTableDefault: nativeEditRender,
  35549. renderTableFilter: nativeFilterRender,
  35550. tableFilterDefaultMethod: handleInputFilterMethod
  35551. },
  35552. textarea: {
  35553. tableAutoFocus: 'textarea',
  35554. renderTableEdit: nativeEditRender
  35555. },
  35556. select: {
  35557. renderTableEdit: nativeSelectEditRender,
  35558. renderTableDefault: nativeSelectEditRender,
  35559. renderTableCell(h, renderOpts, params) {
  35560. return getCellLabelVNs(h, renderOpts, params, getSelectCellValue(renderOpts, params));
  35561. },
  35562. renderTableFilter(h, renderOpts, params) {
  35563. const {
  35564. column
  35565. } = params;
  35566. return column.filters.map((option, oIndex) => {
  35567. return h('select', {
  35568. key: oIndex,
  35569. class: 'vxe-default-select',
  35570. attrs: getNativeAttrs(renderOpts),
  35571. on: getNativeFilterOns(renderOpts, params, option)
  35572. }, renderOpts.optionGroups ? renderNativeOptgroups(h, renderOpts, params, renderNativeOptions) : renderNativeOptions(h, renderOpts.options, renderOpts, params));
  35573. });
  35574. },
  35575. tableFilterDefaultMethod: handleFilterMethod,
  35576. tableExportMethod: handleExportSelectMethod
  35577. },
  35578. VxeInput: {
  35579. tableAutoFocus: 'input',
  35580. renderTableEdit: defaultEditRender,
  35581. renderTableCell(h, renderOpts, params) {
  35582. const {
  35583. props = {}
  35584. } = renderOpts;
  35585. const {
  35586. row,
  35587. column
  35588. } = params;
  35589. const inputConfig = render_getConfig().input || {};
  35590. const digits = props.digits || inputConfig.digits || 2;
  35591. let cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, column.field);
  35592. if (cellValue) {
  35593. switch (props.type) {
  35594. case 'date':
  35595. case 'week':
  35596. case 'month':
  35597. case 'quarter':
  35598. case 'year':
  35599. cellValue = getLabelFormatDate(cellValue, props);
  35600. break;
  35601. case 'float':
  35602. cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toFixed(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().floor(cellValue, digits), digits);
  35603. break;
  35604. }
  35605. }
  35606. return getCellLabelVNs(h, renderOpts, params, cellValue);
  35607. },
  35608. renderTableDefault: defaultEditRender,
  35609. createTableFilterOptions: defaultFilterOptions,
  35610. renderTableFilter: defaultFilterRender,
  35611. renderTableFloatingFilter: defaultFloatingFilterRender,
  35612. tableFilterDefaultMethod: handleInputFilterMethod
  35613. },
  35614. FormatNumberInput: {
  35615. renderTableDefault: handleNumberCell,
  35616. tableFilterDefaultMethod: handleInputFilterMethod,
  35617. tableExportMethod(params) {
  35618. const {
  35619. row,
  35620. column
  35621. } = params;
  35622. const cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, column.field);
  35623. return cellValue;
  35624. }
  35625. },
  35626. VxeNumberInput: {
  35627. tableAutoFocus: 'input',
  35628. renderTableEdit: defaultEditRender,
  35629. renderTableCell: handleNumberCell,
  35630. renderTableFooter(h, renderOpts, params) {
  35631. const {
  35632. props = {}
  35633. } = renderOpts;
  35634. const {
  35635. row,
  35636. column,
  35637. _columnIndex
  35638. } = params;
  35639. const {
  35640. type
  35641. } = props;
  35642. // 兼容老模式
  35643. const itemValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(row) ? row[_columnIndex] : external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, column.field);
  35644. if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(itemValue)) {
  35645. const numberInputConfig = render_getConfig().numberInput || {};
  35646. if (type === 'float') {
  35647. const autoFill = handleDefaultValue(props.autoFill, numberInputConfig.autoFill, true);
  35648. const digits = handleDefaultValue(props.digits, numberInputConfig.digits, 1);
  35649. let amountLabel = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toFixed(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().floor(itemValue, digits), digits);
  35650. if (!autoFill) {
  35651. amountLabel = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(amountLabel);
  35652. }
  35653. return amountLabel;
  35654. } else if (type === 'amount') {
  35655. const autoFill = handleDefaultValue(props.autoFill, numberInputConfig.autoFill, true);
  35656. const digits = handleDefaultValue(props.digits, numberInputConfig.digits, 2);
  35657. const showCurrency = handleDefaultValue(props.showCurrency, numberInputConfig.showCurrency, false);
  35658. let amountLabel = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().commafy(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(itemValue), {
  35659. digits
  35660. });
  35661. if (!autoFill) {
  35662. const [iStr, dStr] = amountLabel.split('.');
  35663. if (dStr) {
  35664. const dRest = dStr.replace(/0+$/, '');
  35665. amountLabel = dRest ? [iStr, '.', dRest].join('') : iStr;
  35666. }
  35667. }
  35668. if (showCurrency) {
  35669. amountLabel = `${props.currencySymbol || numberInputConfig.currencySymbol || render_getI18n('vxe.numberInput.currencySymbol') || ''}${amountLabel}`;
  35670. }
  35671. return amountLabel;
  35672. }
  35673. }
  35674. return getFuncText(itemValue, 1);
  35675. },
  35676. renderTableDefault: defaultEditRender,
  35677. createTableFilterOptions: defaultFilterOptions,
  35678. renderTableFilter: defaultFilterRender,
  35679. renderTableFloatingFilter: defaultFloatingFilterRender,
  35680. tableFilterDefaultMethod: handleInputFilterMethod,
  35681. tableExportMethod(params) {
  35682. const {
  35683. row,
  35684. column
  35685. } = params;
  35686. const cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, column.field);
  35687. return cellValue;
  35688. }
  35689. },
  35690. VxeDatePicker: {
  35691. tableAutoFocus: 'input',
  35692. renderTableEdit: defaultEditRender,
  35693. renderTableCell(h, renderOpts, params) {
  35694. const {
  35695. props = {}
  35696. } = renderOpts;
  35697. const {
  35698. row,
  35699. column
  35700. } = params;
  35701. let cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, column.field);
  35702. if (cellValue) {
  35703. if (props.type !== 'time') {
  35704. cellValue = getLabelFormatDate(cellValue, props);
  35705. }
  35706. }
  35707. return getCellLabelVNs(h, renderOpts, params, cellValue);
  35708. },
  35709. renderTableDefault: defaultEditRender,
  35710. createTableFilterOptions: defaultFilterOptions,
  35711. renderTableFilter: defaultFilterRender,
  35712. renderTableFloatingFilter: defaultFloatingFilterRender,
  35713. tableFilterDefaultMethod: handleFilterMethod
  35714. },
  35715. VxeDateRangePicker: {
  35716. tableAutoFocus: 'input',
  35717. renderTableEdit(h, renderOpts, params) {
  35718. const {
  35719. startField,
  35720. endField
  35721. } = renderOpts;
  35722. const {
  35723. $table,
  35724. row,
  35725. column
  35726. } = params;
  35727. const {
  35728. model
  35729. } = column;
  35730. const cellValue = getCellValue(row, column);
  35731. const seProps = {};
  35732. const seOs = {};
  35733. if (startField && endField) {
  35734. seProps.startValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, startField);
  35735. seProps.endValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, endField);
  35736. seOs['update:startValue'] = value => {
  35737. if (startField) {
  35738. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(row, startField, value);
  35739. }
  35740. };
  35741. seOs['update:endValue'] = value => {
  35742. if (endField) {
  35743. external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(row, endField, value);
  35744. }
  35745. };
  35746. }
  35747. return [h(getDefaultComponent(renderOpts), {
  35748. props: getCellEditProps(renderOpts, params, cellValue, seProps),
  35749. on: getComponentOns(renderOpts, params, {
  35750. model(cellValue) {
  35751. model.update = true;
  35752. model.value = cellValue;
  35753. setCellValue(row, column, cellValue);
  35754. },
  35755. change() {
  35756. $table.updateStatus(params);
  35757. },
  35758. blur() {
  35759. $table.handleCellRuleUpdateStatus('blur', params);
  35760. }
  35761. }, seOs)
  35762. })];
  35763. },
  35764. renderTableCell(h, renderOpts, params) {
  35765. const {
  35766. startField,
  35767. endField
  35768. } = renderOpts;
  35769. const {
  35770. row,
  35771. column
  35772. } = params;
  35773. let startValue = '';
  35774. let endValue = '';
  35775. if (startField && endField) {
  35776. startValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, startField);
  35777. endValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, endField);
  35778. } else {
  35779. const cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, column.field);
  35780. if (cellValue) {
  35781. if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(cellValue)) {
  35782. startValue = cellValue[0];
  35783. endValue = cellValue[1];
  35784. } else {
  35785. const strs = `${cellValue}`.split(',');
  35786. startValue = strs[0];
  35787. endValue = strs[1];
  35788. }
  35789. }
  35790. }
  35791. let cellLabel = '';
  35792. if (startValue && endValue) {
  35793. cellLabel = `${startValue} ~ ${endValue}`;
  35794. }
  35795. return getCellLabelVNs(h, renderOpts, params, cellLabel);
  35796. }
  35797. },
  35798. VxeTextarea: {
  35799. tableAutoFocus: 'textarea',
  35800. renderTableEdit: defaultEditRender
  35801. },
  35802. VxeButton: {
  35803. renderTableDefault: buttonCellRender
  35804. },
  35805. VxeButtonGroup: {
  35806. renderTableDefault(h, renderOpts, params) {
  35807. const {
  35808. options
  35809. } = renderOpts;
  35810. return [h(getDefaultComponent(renderOpts), {
  35811. props: {
  35812. options,
  35813. ...getCellEditProps(renderOpts, params, null)
  35814. },
  35815. on: getComponentOns(renderOpts, params)
  35816. })];
  35817. }
  35818. },
  35819. VxeSelect: {
  35820. tableAutoFocus: 'input',
  35821. renderTableEdit: defaultSelectEditRender,
  35822. renderTableDefault: defaultSelectEditRender,
  35823. renderTableCell(h, renderOpts, params) {
  35824. return getCellLabelVNs(h, renderOpts, params, getSelectCellValue(renderOpts, params));
  35825. },
  35826. createTableFilterOptions: defaultFilterOptions,
  35827. renderTableFilter(h, renderOpts, params) {
  35828. const {
  35829. column
  35830. } = params;
  35831. const {
  35832. options,
  35833. optionProps,
  35834. optionGroups,
  35835. optionGroupProps
  35836. } = renderOpts;
  35837. return column.filters.map((option, oIndex) => {
  35838. const optionValue = option.data;
  35839. return h(getDefaultComponent(renderOpts), {
  35840. key: oIndex,
  35841. props: getCellEditFilterProps(renderOpts, params, optionValue, {
  35842. options,
  35843. optionProps,
  35844. optionGroups,
  35845. optionGroupProps
  35846. }),
  35847. on: getFilterOns(renderOpts, params, option)
  35848. });
  35849. });
  35850. },
  35851. renderTableFloatingFilter(h, renderOpts, params) {
  35852. const {
  35853. option
  35854. } = params;
  35855. const {
  35856. options,
  35857. optionProps,
  35858. optionGroups,
  35859. optionGroupProps
  35860. } = renderOpts;
  35861. const optionValue = option.data;
  35862. return h(getDefaultComponent(renderOpts), {
  35863. props: getCellEditFilterProps(renderOpts, params, optionValue, {
  35864. options,
  35865. optionProps,
  35866. optionGroups,
  35867. optionGroupProps
  35868. }),
  35869. on: getFloatingFilterOns(renderOpts, params, option)
  35870. });
  35871. },
  35872. tableFilterDefaultMethod: handleFilterMethod,
  35873. tableExportMethod: handleExportSelectMethod
  35874. },
  35875. VxeText: {
  35876. renderTableDefault(h, renderOpts, params) {
  35877. const {
  35878. $table,
  35879. row,
  35880. column
  35881. } = params;
  35882. const {
  35883. props
  35884. } = renderOpts;
  35885. const cellLabel = $table.getCellLabel(row, column);
  35886. return [h(getDefaultComponent(renderOpts), {
  35887. props: {
  35888. ...(props || {}),
  35889. content: cellLabel
  35890. },
  35891. on: getComponentOns(renderOpts, params)
  35892. })];
  35893. }
  35894. },
  35895. VxeLink: {
  35896. renderTableDefault(h, renderOpts, params) {
  35897. const {
  35898. $table,
  35899. row,
  35900. column
  35901. } = params;
  35902. const {
  35903. props
  35904. } = renderOpts;
  35905. const {
  35906. href
  35907. } = props || {};
  35908. const cellLabel = $table.getCellLabel(row, column);
  35909. return [h(getDefaultComponent(renderOpts), {
  35910. props: {
  35911. ...(props || {}),
  35912. content: cellLabel,
  35913. href: external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toFormatString(href, params)
  35914. },
  35915. on: getComponentOns(renderOpts, params)
  35916. })];
  35917. }
  35918. },
  35919. /**
  35920. * 已废弃,被 FormatSelect 替换
  35921. * @deprecated
  35922. */
  35923. formatOption: {
  35924. renderTableDefault(h, renderOpts, params) {
  35925. return getCellLabelVNs(h, renderOpts, params, getSelectCellValue(renderOpts, params));
  35926. }
  35927. },
  35928. FormatSelect: {
  35929. renderTableDefault(h, renderOpts, params) {
  35930. return getCellLabelVNs(h, renderOpts, params, getSelectCellValue(renderOpts, params));
  35931. },
  35932. tableFilterDefaultMethod: handleFilterMethod,
  35933. tableExportMethod: handleExportSelectMethod
  35934. },
  35935. VxeTreeSelect: {
  35936. tableAutoFocus: 'input',
  35937. renderTableEdit: defaultTableOrTreeSelectEditRender,
  35938. renderTableCell(h, renderOpts, params) {
  35939. return getCellLabelVNs(h, renderOpts, params, getTreeSelectCellValue(renderOpts, params));
  35940. },
  35941. tableExportMethod: handleExportTreeSelectMethod
  35942. },
  35943. VxeTableSelect: {
  35944. tableAutoFocus: 'input',
  35945. renderTableEdit: defaultTableOrTreeSelectEditRender,
  35946. renderTableCell(h, renderOpts, params) {
  35947. return getCellLabelVNs(h, renderOpts, params, getTreeSelectCellValue(renderOpts, params));
  35948. },
  35949. tableExportMethod: handleExportTreeSelectMethod
  35950. },
  35951. /**
  35952. * 已废弃,被 FormatTreeSelect 替换
  35953. * @deprecated
  35954. */
  35955. formatTree: {
  35956. renderTableDefault(h, renderOpts, params) {
  35957. return getCellLabelVNs(h, renderOpts, params, getTreeSelectCellValue(renderOpts, params));
  35958. }
  35959. },
  35960. FormatTreeSelect: {
  35961. renderTableDefault(h, renderOpts, params) {
  35962. return getCellLabelVNs(h, renderOpts, params, getTreeSelectCellValue(renderOpts, params));
  35963. },
  35964. tableExportMethod: handleExportTreeSelectMethod
  35965. },
  35966. VxeColorPicker: {
  35967. tableAutoFocus: 'input',
  35968. renderTableEdit(h, renderOpts, params) {
  35969. const {
  35970. row,
  35971. column
  35972. } = params;
  35973. const {
  35974. options
  35975. } = renderOpts;
  35976. const cellValue = getCellValue(row, column);
  35977. return [h(getDefaultComponent(renderOpts), {
  35978. props: getCellEditProps(renderOpts, params, cellValue, {
  35979. colors: options
  35980. }),
  35981. on: getEditOns(renderOpts, params)
  35982. })];
  35983. },
  35984. renderTableCell(h, renderOpts, params) {
  35985. const {
  35986. row,
  35987. column
  35988. } = params;
  35989. const cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, column.field);
  35990. return h('span', {
  35991. class: 'vxe-color-picker--readonly'
  35992. }, [h('div', {
  35993. class: 'vxe-color-picker--readonly-color',
  35994. style: {
  35995. backgroundColor: cellValue
  35996. }
  35997. })]);
  35998. }
  35999. },
  36000. VxeIconPicker: {
  36001. tableAutoFocus: 'input',
  36002. renderTableEdit(h, renderOpts, params) {
  36003. const {
  36004. row,
  36005. column
  36006. } = params;
  36007. const {
  36008. options
  36009. } = renderOpts;
  36010. const cellValue = getCellValue(row, column);
  36011. return [h(getDefaultComponent(renderOpts), {
  36012. props: getCellEditProps(renderOpts, params, cellValue, {
  36013. icons: options
  36014. }),
  36015. on: getEditOns(renderOpts, params)
  36016. })];
  36017. },
  36018. renderTableCell(h, renderOpts, params) {
  36019. const {
  36020. row,
  36021. column
  36022. } = params;
  36023. const cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, column.field);
  36024. return h('i', {
  36025. class: cellValue
  36026. });
  36027. }
  36028. },
  36029. VxeRadioGroup: {
  36030. renderTableDefault: radioAndCheckboxGroupEditRender
  36031. },
  36032. VxeCheckbox: {
  36033. renderTableDefault: checkboxEditRender
  36034. },
  36035. VxeCheckboxGroup: {
  36036. renderTableDefault: radioAndCheckboxGroupEditRender
  36037. },
  36038. VxeSwitch: {
  36039. tableAutoFocus: 'button',
  36040. renderTableEdit: defaultEditRender,
  36041. renderTableDefault: defaultEditRender
  36042. },
  36043. VxeUpload: {
  36044. renderTableEdit: defaultEditRender,
  36045. renderTableCell: defaultEditRender,
  36046. renderTableDefault: defaultEditRender
  36047. },
  36048. VxeImage: {
  36049. renderTableDefault(h, renderOpts, params) {
  36050. const {
  36051. row,
  36052. column
  36053. } = params;
  36054. const {
  36055. props
  36056. } = renderOpts;
  36057. const cellValue = getCellValue(row, column);
  36058. return [h(getDefaultComponent(renderOpts), {
  36059. props: {
  36060. ...props,
  36061. src: cellValue
  36062. },
  36063. on: getEditOns(renderOpts, params)
  36064. })];
  36065. }
  36066. },
  36067. VxeImageGroup: {
  36068. renderTableDefault(h, renderOpts, params) {
  36069. const {
  36070. row,
  36071. column
  36072. } = params;
  36073. const {
  36074. props
  36075. } = renderOpts;
  36076. const cellValue = getCellValue(row, column);
  36077. return [h(getDefaultComponent(renderOpts), {
  36078. props: {
  36079. ...props,
  36080. urlList: cellValue
  36081. },
  36082. on: getEditOns(renderOpts, params)
  36083. })];
  36084. }
  36085. },
  36086. VxeTextEllipsis: {
  36087. renderTableDefault(h, renderOpts, params) {
  36088. const {
  36089. row,
  36090. column
  36091. } = params;
  36092. const {
  36093. props
  36094. } = renderOpts;
  36095. const cellValue = getCellValue(row, column);
  36096. return [h(getDefaultComponent(renderOpts), {
  36097. props: {
  36098. ...props,
  36099. content: cellValue
  36100. },
  36101. on: getEditOns(renderOpts, params)
  36102. })];
  36103. }
  36104. },
  36105. VxeRate: {
  36106. renderTableDefault: defaultEditRender
  36107. },
  36108. VxeSlider: {
  36109. renderTableDefault: defaultEditRender
  36110. },
  36111. // 以下已废弃
  36112. $input: {
  36113. tableAutoFocus: '.vxe-input--inner',
  36114. renderTableEdit: oldEditRender,
  36115. renderTableCell(h, renderOpts, params) {
  36116. const {
  36117. props = {}
  36118. } = renderOpts;
  36119. const {
  36120. row,
  36121. column
  36122. } = params;
  36123. const digits = props.digits || render_getConfig().input?.digits || 2;
  36124. let cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, column.field);
  36125. if (cellValue) {
  36126. switch (props.type) {
  36127. case 'date':
  36128. case 'week':
  36129. case 'month':
  36130. case 'year':
  36131. cellValue = getLabelFormatDate(cellValue, props);
  36132. break;
  36133. case 'float':
  36134. cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toFixed(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().floor(cellValue, digits), digits);
  36135. break;
  36136. }
  36137. }
  36138. return getCellLabelVNs(h, renderOpts, params, cellValue);
  36139. },
  36140. renderTableDefault: oldEditRender,
  36141. renderTableFilter: oldFilterRender,
  36142. tableFilterDefaultMethod: handleInputFilterMethod
  36143. },
  36144. $textarea: {
  36145. tableAutoFocus: '.vxe-textarea--inner'
  36146. },
  36147. $button: {
  36148. renderTableDefault: oldButtonEditRender
  36149. },
  36150. $buttons: {
  36151. renderTableDefault: oldButtonsEditRender
  36152. },
  36153. $select: {
  36154. tableAutoFocus: '.vxe-input--inner',
  36155. renderTableEdit: oldSelectEditRender,
  36156. renderTableDefault: oldSelectEditRender,
  36157. renderTableCell(h, renderOpts, params) {
  36158. return getCellLabelVNs(h, renderOpts, params, getSelectCellValue(renderOpts, params));
  36159. },
  36160. renderTableFilter(h, renderOpts, params) {
  36161. const {
  36162. column
  36163. } = params;
  36164. const {
  36165. options,
  36166. optionProps,
  36167. optionGroups,
  36168. optionGroupProps
  36169. } = renderOpts;
  36170. return column.filters.map((option, oIndex) => {
  36171. const optionValue = option.data;
  36172. return h(getOldComponent(renderOpts), {
  36173. key: oIndex,
  36174. props: getCellEditFilterProps(renderOpts, params, optionValue, {
  36175. options,
  36176. optionProps,
  36177. optionGroups,
  36178. optionGroupProps
  36179. }),
  36180. on: getFilterOns(renderOpts, params, option)
  36181. });
  36182. });
  36183. },
  36184. tableFilterDefaultMethod: handleFilterMethod,
  36185. tableExportMethod: handleExportSelectMethod
  36186. },
  36187. $radio: {
  36188. tableAutoFocus: '.vxe-radio--input'
  36189. },
  36190. $checkbox: {
  36191. tableAutoFocus: '.vxe-checkbox--input'
  36192. },
  36193. $switch: {
  36194. tableAutoFocus: '.vxe-switch--button',
  36195. renderTableEdit: oldEditRender,
  36196. renderTableDefault: oldEditRender
  36197. }
  36198. // 以上已废弃
  36199. });
  36200. ;// CONCATENATED MODULE: ./packages/table/index.ts
  36201. let table_isReg = false;
  36202. const VxeTable = Object.assign({}, table, {
  36203. install(app) {
  36204. if (typeof window !== 'undefined') {
  36205. if (window.VxeTableExtendCellArea && window.VxeTableExtendCellArea.use) {
  36206. window.VxeTableExtendCellArea.use(core_.VxeUI);
  36207. } else if (window.VXETableMixin) {
  36208. table.mixins.push(window.VXETableMixin);
  36209. delete window.VXETableMixin;
  36210. }
  36211. if (window.VxeTableExtendPivotTable && window.VxeTableExtendPivotTable.use) {
  36212. window.VxeTableExtendPivotTable.use(core_.VxeUI);
  36213. }
  36214. }
  36215. // 兼容老版本
  36216. if (typeof window !== 'undefined' && window.VxeTableExtendCellArea && window.VxeTableExtendCellArea.init) {
  36217. window.VxeTableExtendCellArea.init(core_.VxeUI);
  36218. delete window.VxeTableExtendCellArea;
  36219. delete window.VXETablePro;
  36220. } else if (typeof window !== 'undefined' && window.VXETablePro && window.VXETablePro.init) {
  36221. window.VXETablePro.init(core_.VxeUI);
  36222. delete window.VXETablePro;
  36223. }
  36224. if (!(external_commonjs_vue_commonjs2_vue_root_Vue_default()).prototype.$vxe) {
  36225. (external_commonjs_vue_commonjs2_vue_root_Vue_default()).prototype.$vxe = {
  36226. t: core_.VxeUI.t,
  36227. _t: core_.VxeUI._t
  36228. };
  36229. } else {
  36230. (external_commonjs_vue_commonjs2_vue_root_Vue_default()).prototype.$vxe.t = core_.VxeUI.t;
  36231. (external_commonjs_vue_commonjs2_vue_root_Vue_default()).prototype.$vxe._t = core_.VxeUI._t;
  36232. }
  36233. if (!table_isReg) {
  36234. table_isReg = true;
  36235. if (core_.VxeUI.dynamicApp) {
  36236. core_.VxeUI.dynamicApp.component(table.name, table);
  36237. }
  36238. }
  36239. app.component(table.name, table);
  36240. }
  36241. });
  36242. core_.VxeUI.component(table);
  36243. const Table = VxeTable;
  36244. /* harmony default export */ var packages_table = ((/* unused pure expression or super */ null && (VxeTable)));
  36245. ;// CONCATENATED MODULE: ./packages/toolbar/index.ts
  36246. const VxeToolbar = Object.assign({}, toolbar, {
  36247. install(app) {
  36248. app.component(toolbar.name, toolbar);
  36249. }
  36250. });
  36251. if (core_.VxeUI.dynamicApp) {
  36252. core_.VxeUI.dynamicApp.component(toolbar.name, toolbar);
  36253. }
  36254. core_.VxeUI.component(toolbar);
  36255. const Toolbar = VxeToolbar;
  36256. /* harmony default export */ var packages_toolbar = ((/* unused pure expression or super */ null && (VxeToolbar)));
  36257. ;// CONCATENATED MODULE: ./packages/locale/lang/zh-CN.ts
  36258. /* harmony default export */ var zh_CN = ({
  36259. vxe: {
  36260. base: {
  36261. pleaseInput: '请输入',
  36262. pleaseSelect: '请选择',
  36263. comma: ',',
  36264. fullStop: '。'
  36265. },
  36266. loading: {
  36267. text: '加载中...'
  36268. },
  36269. error: {
  36270. downErr: '下载失败',
  36271. errLargeData: '当绑定的数据量过大时,应该请使用 {0},否则可能会出现卡顿',
  36272. groupFixed: '如果使用分组表头,冻结列必须按组设置',
  36273. groupMouseRange: '分组表头与 "{0}" 不能同时使用,这可能会出现错误',
  36274. groupTag: '分组列头应该使用 "{0}" 而不是 "{1}",这可能会出现错误',
  36275. scrollErrProp: '启用虚拟滚动后不支持该参数 "{0}"',
  36276. errConflicts: '参数 "{0}" 与 "{1}" 有冲突',
  36277. modelConflicts: '绑定的字段值 "{0}" 与 "{1}" 存在冲突,将会出现错误',
  36278. notSupportProp: '当启用参数 "{0}" 时不支持 "{1}",应该为 "{2}",否则将会出现错误',
  36279. reqSupportProp: '当使用 "{0}" 时,应该设置 "{1}",否则可能会出现错误',
  36280. notConflictProp: '当使用 "{0}" 时,应该设置 "{1}",否则可能会存在功能冲突',
  36281. unableInsert: '无法插入到指定位置,请检查参数是否正确',
  36282. useErr: '安装 "{0}" 模块时发生错误,可能顺序不正确,依赖的模块需要在 Table 之前安装',
  36283. barUnableLink: '工具栏无法关联表格',
  36284. expandContent: '展开行的插槽应该是 "content",请检查是否正确',
  36285. reqComp: '缺少 "{0}" 组件,请检查是否正确安装。 https://vxeui.com/#/start/useGlobal',
  36286. reqModule: '缺少 "{0}" 模块',
  36287. reqProp: '缺少必要的 "{0}" 参数,这可能会导致出现错误',
  36288. emptyProp: '参数 "{0}" 不允许为空',
  36289. errProp: '不支持的参数 "{0}",可能为 "{1}"',
  36290. colRepet: 'column.{0}="{1}" 重复了,这可能会导致某些功能无法使用',
  36291. notFunc: '方法 "{0}" 不存在',
  36292. errFunc: '参数 "{0}" 不是一个方法',
  36293. notValidators: '全局校验 "{0}" 不存在',
  36294. notFormats: '全局格式化 "{0}" 不存在',
  36295. notCommands: '全局指令 "{0}" 不存在',
  36296. notSlot: '插槽 "{0}" 不存在',
  36297. noTree: '树结构不支持 "{0}"',
  36298. noGroup: '数据分组后不支持 "{0}"',
  36299. notProp: '不支持的参数 "{0}"',
  36300. checkProp: '当数据量过大时可能会导致复选框卡顿,建议设置参数 "{0}" 提升渲染速度',
  36301. coverProp: '"{0}" 的参数 "{1}" 重复定义,这可能会出现错误',
  36302. uniField: '字段名 "{0}" 重复定义,这可能会出现错误',
  36303. repeatKey: '主键重复 {0}="{1}",这可能会出现错误',
  36304. repeatProp: '参数重复 {0}="{1}",这可能会出现错误',
  36305. delFunc: '方法 "{0}" 已废弃,请使用 "{1}"',
  36306. delProp: '参数 "{0}" 已废弃,请使用 "{1}"',
  36307. delEvent: '事件 "{0}" 已废弃,请使用 "{1}"',
  36308. removeProp: '参数 "{0}" 已废弃,不建议使用,这可能会导致出现错误',
  36309. errFormat: '全局的格式化内容应该使用 "VXETable.formats" 定义,挂载 "formatter={0}" 的方式已不建议使用',
  36310. notType: '不支持的文件类型 "{0}"',
  36311. notExp: '该浏览器不支持导入/导出功能',
  36312. impFields: '导入失败,请检查字段名和数据格式是否正确',
  36313. treeNotImp: '树表格不支持导入',
  36314. treeCrossDrag: '只能拖拽第一层级',
  36315. treeDragChild: '父级不能拖拽到自己的子级中',
  36316. reqPlugin: '扩展插件未安装 "{1}" https://vxeui.com/other{0}/#/{1}/install',
  36317. errMaxRow: '超过支持的最大数据量 {0} 行,这可能会导致出现错误',
  36318. useNew: '不建议使用 {0},请使用 {1}',
  36319. errorVersion: '版本不匹配,当前版本 {0},最低支持版本为 {1}'
  36320. },
  36321. table: {
  36322. emptyText: '暂无数据',
  36323. allTitle: '全选/取消',
  36324. seqTitle: '序号',
  36325. actionTitle: '操作',
  36326. confirmFilter: '筛选',
  36327. resetFilter: '重置',
  36328. allFilter: '全部',
  36329. sortAsc: '升序:最低到最高',
  36330. sortDesc: '降序:最高到最低',
  36331. filter: '对所选的列启用筛选',
  36332. impSuccess: '成功导入 {0} 条记录',
  36333. expLoading: '正在导出中',
  36334. expSuccess: '导出成功',
  36335. expError: '导出失败',
  36336. expFilename: '导出_{0}',
  36337. expOriginFilename: '导出_源_{0}',
  36338. customTitle: '列设置',
  36339. customAll: '全部',
  36340. customConfirm: '确认',
  36341. customClose: '关闭',
  36342. customCancel: '取消',
  36343. customRestore: '恢复默认',
  36344. maxFixedCol: '最大冻结列的数量不能超过 {0} 个',
  36345. maxGroupCol: '最大分组字段的数量不能超过 {0} 个',
  36346. dragTip: '移动:{0}',
  36347. resizeColTip: '宽:{0} 像素',
  36348. resizeRowTip: '高:{0} 像素',
  36349. rowGroupContentTotal: '{0}({1})'
  36350. },
  36351. grid: {
  36352. selectOneRecord: '请至少选择一条记录!',
  36353. deleteSelectRecord: '您确定要删除所选记录吗?',
  36354. removeSelectRecord: '您确定要移除所选记录吗?',
  36355. dataUnchanged: '数据未改动!',
  36356. delSuccess: '成功删除所选记录!',
  36357. saveSuccess: '保存成功!',
  36358. operError: '发生错误,操作失败!'
  36359. },
  36360. select: {
  36361. clear: '清除',
  36362. allChecked: '全选',
  36363. total: '{0} / {1}',
  36364. search: '搜索',
  36365. loadingText: '加载中',
  36366. emptyText: '暂无数据',
  36367. maxSize: '最大可选择的数量不能超过 {0} 个',
  36368. overSizeErr: '已超出最大可选数量 {0} 个,超出部分将被忽略!',
  36369. searchEmpty: '未匹配到数据!'
  36370. },
  36371. tree: {
  36372. searchEmpty: '未匹配到数据!'
  36373. },
  36374. treeSelect: {
  36375. clearChecked: '清除',
  36376. allChecked: '全选',
  36377. allExpand: '全部展开',
  36378. clearExpand: '全部收起',
  36379. total: '已选 {0}',
  36380. search: '搜索',
  36381. emptyText: '暂无数据'
  36382. },
  36383. pager: {
  36384. goto: '前往',
  36385. gotoTitle: '页数',
  36386. pagesize: '{0}条/页',
  36387. total: '共 {0} 条记录',
  36388. pageClassifier: '页',
  36389. homePage: '首页',
  36390. homePageTitle: '首页',
  36391. prevPage: '上一页',
  36392. prevPageTitle: '上一页',
  36393. nextPage: '下一页',
  36394. nextPageTitle: '下一页',
  36395. prevJump: '向上跳页',
  36396. prevJumpTitle: '向上跳页',
  36397. nextJump: '向下跳页',
  36398. nextJumpTitle: '向下跳页',
  36399. endPage: '末页',
  36400. endPageTitle: '末页'
  36401. },
  36402. alert: {
  36403. title: '系统提示'
  36404. },
  36405. button: {
  36406. confirm: '确认',
  36407. cancel: '取消',
  36408. clear: '清除'
  36409. },
  36410. filter: {
  36411. search: '搜索'
  36412. },
  36413. custom: {
  36414. cstmTitle: '列设置',
  36415. cstmRestore: '恢复默认',
  36416. cstmCancel: '取消',
  36417. cstmConfirm: '确定',
  36418. cstmConfirmRestore: '请确认是否恢复成默认列配置?',
  36419. cstmDragTarget: '移动:{0}',
  36420. setting: {
  36421. colSort: '排序',
  36422. sortHelpTip: '点击并拖动图标可以调整顺序',
  36423. colTitle: '列标题',
  36424. colResizable: '列宽(像素)',
  36425. colVisible: '是否显示',
  36426. colFixed: '冻结列',
  36427. colFixedMax: '冻结列(最多 {0} 列)',
  36428. fixedLeft: '左侧',
  36429. fixedUnset: '不设置',
  36430. fixedRight: '右侧'
  36431. }
  36432. },
  36433. import: {
  36434. modes: {
  36435. covering: '覆盖方式(直接覆盖表格数据)',
  36436. insert: '底部追加(在表格的底部追加新数据)',
  36437. insertTop: '顶部追加(在表格的顶部追加新数据)',
  36438. insertBottom: '底部追加(在表格的底部追加新数据)'
  36439. },
  36440. impTitle: '导入数据',
  36441. impFile: '文件名',
  36442. impSelect: '选择文件',
  36443. impType: '文件类型',
  36444. impOpts: '参数设置',
  36445. impMode: '导入模式',
  36446. impConfirm: '导入',
  36447. impCancel: '取消'
  36448. },
  36449. export: {
  36450. types: {
  36451. csv: 'CSV (逗号分隔)(*.csv)',
  36452. html: '网页(*.html)',
  36453. xml: 'XML 数据(*.xml)',
  36454. txt: '文本文件(制表符分隔)(*.txt)',
  36455. xls: 'Excel 97-2003 工作簿(*.xls)',
  36456. xlsx: 'Excel 工作簿(*.xlsx)',
  36457. pdf: 'PDF (*.pdf)'
  36458. },
  36459. modes: {
  36460. empty: '空数据',
  36461. current: '当前数据(当前页的数据)',
  36462. selected: '选中数据(当前页选中的数据)',
  36463. all: '全量数据(包括所有分页的数据)'
  36464. },
  36465. printTitle: '打印数据',
  36466. expTitle: '导出数据',
  36467. expName: '文件名',
  36468. expNamePlaceholder: '请输入文件名',
  36469. expSheetName: '标题',
  36470. expSheetNamePlaceholder: '请输入标题',
  36471. expType: '保存类型',
  36472. expMode: '选择数据',
  36473. expCurrentColumn: '全部字段',
  36474. expColumn: '选择字段',
  36475. expOpts: '参数设置',
  36476. expOptHeader: '表头',
  36477. expHeaderTitle: '是否需要表头',
  36478. expOptFooter: '表尾',
  36479. expFooterTitle: '是否需要表尾',
  36480. expOptColgroup: '分组表头',
  36481. expOptTitle: '列标题',
  36482. expTitleTitle: '是否为列标题,否则显示为列的字段名',
  36483. expColgroupTitle: '如果存在,则支持带有分组结构的表头',
  36484. expOptMerge: '合并',
  36485. expMergeTitle: '如果存在,则支持带有合并结构的单元格',
  36486. expOptAllExpand: '展开树',
  36487. expAllExpandTitle: '如果存在,则支持将带有层级结构的数据全部展开',
  36488. expOptUseStyle: '样式',
  36489. expUseStyleTitle: '如果存在,则支持带样式的单元格',
  36490. expOptOriginal: '源数据',
  36491. expOriginalTitle: '如果为源数据,则支持导入到表格中',
  36492. expPrint: '打印',
  36493. expConfirm: '导出',
  36494. expCancel: '取消'
  36495. },
  36496. modal: {
  36497. errTitle: '错误提示',
  36498. zoomMin: '最小化',
  36499. zoomIn: '最大化',
  36500. zoomOut: '还原',
  36501. close: '关闭',
  36502. miniMaxSize: '最小化窗口的数量不能超过 {0} 个',
  36503. footPropErr: 'show-footer 仅用于启用表尾,需配合 show-confirm-button | show-cancel-button | 插槽使用'
  36504. },
  36505. drawer: {
  36506. close: '关闭'
  36507. },
  36508. form: {
  36509. folding: '收起',
  36510. unfolding: '展开'
  36511. },
  36512. toolbar: {
  36513. import: '导入',
  36514. export: '导出',
  36515. print: '打印',
  36516. refresh: '刷新',
  36517. zoomIn: '全屏',
  36518. zoomOut: '还原',
  36519. custom: '列设置',
  36520. customAll: '全部',
  36521. customConfirm: '确认',
  36522. customRestore: '重置',
  36523. fixedLeft: '冻结在左侧',
  36524. fixedRight: '冻结在右侧',
  36525. cancelFixed: '取消冻结列'
  36526. },
  36527. datePicker: {
  36528. yearTitle: '{0} 年'
  36529. },
  36530. dateRangePicker: {
  36531. pleaseRange: '请选择开始日期与结束日期'
  36532. },
  36533. input: {
  36534. date: {
  36535. m1: '01 月',
  36536. m2: '02 月',
  36537. m3: '03 月',
  36538. m4: '04 月',
  36539. m5: '05 月',
  36540. m6: '06 月',
  36541. m7: '07 月',
  36542. m8: '08 月',
  36543. m9: '09 月',
  36544. m10: '10 月',
  36545. m11: '11 月',
  36546. m12: '12 月',
  36547. quarterLabel: '{0} 年',
  36548. monthLabel: '{0} 年',
  36549. dayLabel: '{0} 年 {1}',
  36550. labelFormat: {
  36551. date: 'yyyy-MM-dd',
  36552. time: 'HH:mm:ss',
  36553. datetime: 'yyyy-MM-dd HH:mm:ss',
  36554. week: 'yyyy 年第 WW 周',
  36555. month: 'yyyy-MM',
  36556. quarter: 'yyyy 年第 q 季度',
  36557. year: 'yyyy'
  36558. },
  36559. weeks: {
  36560. w: '',
  36561. w0: '周日',
  36562. w1: '周一',
  36563. w2: '周二',
  36564. w3: '周三',
  36565. w4: '周四',
  36566. w5: '周五',
  36567. w6: '周六'
  36568. },
  36569. months: {
  36570. m0: '一月',
  36571. m1: '二月',
  36572. m2: '三月',
  36573. m3: '四月',
  36574. m4: '五月',
  36575. m5: '六月',
  36576. m6: '七月',
  36577. m7: '八月',
  36578. m8: '九月',
  36579. m9: '十月',
  36580. m10: '十一月',
  36581. m11: '十二月'
  36582. },
  36583. quarters: {
  36584. q1: '第一季度',
  36585. q2: '第二季度',
  36586. q3: '第三季度',
  36587. q4: '第四季度'
  36588. }
  36589. }
  36590. },
  36591. numberInput: {
  36592. currencySymbol: '¥'
  36593. },
  36594. imagePreview: {
  36595. popupTitle: '预览',
  36596. operBtn: {
  36597. zoomOut: '缩小',
  36598. zoomIn: '放大',
  36599. pctFull: '等比例缩放',
  36600. pct11: '显示原始尺寸',
  36601. rotateLeft: '向左旋转',
  36602. rotateRight: '向右旋转',
  36603. print: '点击打印图片',
  36604. download: '点击下载图片'
  36605. }
  36606. },
  36607. upload: {
  36608. fileBtnText: '点击或拖拽上传',
  36609. imgBtnText: '点击或拖拽上传',
  36610. dragPlaceholder: '请把文件拖放到这个区域即可上传',
  36611. imgSizeHint: '单张{0}',
  36612. imgCountHint: '最多{0}张',
  36613. fileTypeHint: '支持 {0} 文件类型',
  36614. fileSizeHint: '单个文件大小不超过{0}',
  36615. fileCountHint: '最多可上传{0}个文件',
  36616. uploadTypeErr: '文件类型不匹配!',
  36617. overCountErr: '最多只能选择{0}个文件!',
  36618. overCountExtraErr: '已超出最大数量{0}个,超出的{1}个文件将被忽略!',
  36619. overSizeErr: '文件大小最大不能超过{0}!',
  36620. manualUpload: '点击上传',
  36621. reUpload: '重新上传',
  36622. uploadProgress: '上传中 {0}%',
  36623. uploadErr: '上传失败',
  36624. uploadSuccess: '上传成功',
  36625. moreBtnText: '更多({0})',
  36626. viewItemTitle: '点击查看',
  36627. morePopup: {
  36628. readTitle: '查看列表',
  36629. imageTitle: '上传图片',
  36630. fileTitle: '上传文件'
  36631. }
  36632. },
  36633. empty: {
  36634. defText: '暂无数据'
  36635. },
  36636. colorPicker: {
  36637. clear: '清除',
  36638. confirm: '确认',
  36639. copySuccess: '已复制到剪贴板:{0}',
  36640. hex: '十六进制'
  36641. },
  36642. formDesign: {
  36643. formName: '表单名称',
  36644. defFormTitle: '未命名的表单',
  36645. widgetPropTab: '控件属性',
  36646. widgetFormTab: '表单属性',
  36647. error: {
  36648. wdFormUni: '该类型的控件在表单中只允许添加一个',
  36649. wdSubUni: '该类型的控件在子表中只允许添加一个'
  36650. },
  36651. styleSetting: {
  36652. btn: '样式设置',
  36653. title: '表单的样式设置',
  36654. layoutTitle: '控件布局',
  36655. verticalLayout: '上下布局',
  36656. horizontalLayout: '横向布局',
  36657. styleTitle: '标题样式',
  36658. boldTitle: '标题加粗',
  36659. fontBold: '加粗',
  36660. fontNormal: '常规',
  36661. colonTitle: '显示冒号',
  36662. colonVisible: '显示',
  36663. colonHidden: '隐藏',
  36664. alignTitle: '对齐方式',
  36665. widthTitle: '标题宽度',
  36666. alignLeft: '居左',
  36667. alignRight: '居右',
  36668. unitPx: '像素',
  36669. unitPct: '百分比'
  36670. },
  36671. widget: {
  36672. group: {
  36673. base: '基础控件',
  36674. layout: '布局控件',
  36675. system: '系统控件',
  36676. module: '模块控件',
  36677. chart: '图表控件',
  36678. advanced: '高级控件'
  36679. },
  36680. copyTitle: '副本_{0}',
  36681. component: {
  36682. input: '输入框',
  36683. textarea: '文本域',
  36684. select: '下拉选择',
  36685. row: '一行多列',
  36686. title: '标题',
  36687. text: '文本',
  36688. subtable: '子表',
  36689. VxeSwitch: '是/否',
  36690. VxeInput: '输入框',
  36691. VxeNumberInput: '数字',
  36692. VxeDatePicker: '日期',
  36693. VxeTextarea: '文本域',
  36694. VxeSelect: '下拉选择',
  36695. VxeTreeSelect: '树形选择',
  36696. VxeRadioGroup: '单选框',
  36697. VxeCheckboxGroup: '复选框',
  36698. VxeUploadFile: '文件',
  36699. VxeUploadImage: '图片',
  36700. VxeRate: '评分',
  36701. VxeSlider: '滑块'
  36702. }
  36703. },
  36704. widgetProp: {
  36705. name: '控件名称',
  36706. placeholder: '提示语',
  36707. required: '必填校验',
  36708. multiple: '允许多选',
  36709. displaySetting: {
  36710. name: '显示设置',
  36711. pc: '电脑端',
  36712. mobile: '手机端',
  36713. visible: '显示',
  36714. hidden: '隐藏'
  36715. },
  36716. dataSource: {
  36717. name: '数据源',
  36718. defValue: '选项{0}',
  36719. addOption: '添加选项',
  36720. batchEditOption: '批量编辑',
  36721. batchEditTip: '每行对应一个选项,支持从表格、Excel、WPS 中直接复制粘贴。',
  36722. batchEditSubTip: '每行对应一个选项,如果是分组,子项可以是空格或制表键开头,支持从表格、Excel、WPS 中直接复制粘贴。',
  36723. buildOption: '生成选项'
  36724. },
  36725. rowProp: {
  36726. colSize: '列数',
  36727. col2: '两列',
  36728. col3: '三列',
  36729. col4: '四列',
  36730. col6: '六列',
  36731. layout: '布局'
  36732. },
  36733. textProp: {
  36734. name: '内容',
  36735. alignTitle: '对齐方式',
  36736. alignLeft: '居左',
  36737. alignCenter: '居中',
  36738. alignRight: '居右',
  36739. colorTitle: '字体颜色',
  36740. sizeTitle: '字体大小',
  36741. boldTitle: '字体加粗',
  36742. fontNormal: '常规',
  36743. fontBold: '加粗'
  36744. },
  36745. subtableProp: {
  36746. seqTitle: '序号',
  36747. showSeq: '显示序号',
  36748. showCheckbox: '允许多选',
  36749. errSubDrag: '子表不支持该控件,请使用其他控件',
  36750. colPlace: '将控件拖拽进来'
  36751. },
  36752. uploadProp: {
  36753. limitFileCount: '文件数量限制',
  36754. limitFileSize: '文件大小限制',
  36755. multiFile: '允许上传多个文件',
  36756. limitImgCount: '图片数量限制',
  36757. limitImgSize: '图片大小限制',
  36758. multiImg: '允许上传多张图片'
  36759. }
  36760. }
  36761. },
  36762. listDesign: {
  36763. fieldSettingTab: '字段设置',
  36764. listSettingTab: '参数设置',
  36765. searchTitle: '查询条件',
  36766. listTitle: '列表字段',
  36767. searchField: '查询字段',
  36768. listField: '列表字段',
  36769. activeBtn: {
  36770. ActionButtonUpdate: '编辑',
  36771. ActionButtonDelete: '删除'
  36772. },
  36773. search: {
  36774. addBtn: '编辑',
  36775. emptyText: '未配置查询条件',
  36776. editPopupTitle: '编辑查询字段'
  36777. },
  36778. searchPopup: {
  36779. colTitle: '标题',
  36780. saveBtn: '保存'
  36781. }
  36782. },
  36783. text: {
  36784. copySuccess: '已复制到剪贴板',
  36785. copyError: '当前环境不支持该操作'
  36786. },
  36787. countdown: {
  36788. formats: {
  36789. yyyy: '年',
  36790. MM: '月',
  36791. dd: '天',
  36792. HH: '时',
  36793. mm: '分',
  36794. ss: '秒'
  36795. }
  36796. },
  36797. gantt: {
  36798. tFullFormat: {
  36799. year: '{yy}年',
  36800. quarter: '{yy}年第{q}季度',
  36801. month: '{yy}年{M}月',
  36802. week: '{yy}年第{W}周',
  36803. day: '{yy}年{M}月{E}日',
  36804. date: '{yy}年{M}月{d}日',
  36805. hour: '{yy}年 {M}月{d}日{H}时',
  36806. minute: '{yy}年{M}月{d}日{H}时{m}分'
  36807. },
  36808. tSimpleFormat: {
  36809. year: '{yy}年',
  36810. quarter: '{q}季度',
  36811. month: '{M}月',
  36812. week: '{W}周',
  36813. day: '{d}',
  36814. date: '{d}',
  36815. hour: '{H}时',
  36816. minute: '{m}分'
  36817. },
  36818. dayss: {
  36819. w0: '日',
  36820. w1: '一',
  36821. w2: '二',
  36822. w3: '三',
  36823. w4: '四',
  36824. w5: '五',
  36825. w6: '六'
  36826. }
  36827. },
  36828. plugins: {
  36829. extendCellArea: {
  36830. area: {
  36831. mergeErr: '无法对合并单元格进行该操作',
  36832. multiErr: '无法对多重选择区域进行该操作',
  36833. selectErr: '无法操作指定区域的单元格',
  36834. extendErr: '如果延伸的区域包含被合并的单元格,所有合并的单元格需大小相同',
  36835. pasteMultiErr: '无法粘贴,需要相同大小的复制的区域和粘贴的区域才能执行此操作',
  36836. cpInvalidErr: '该操作无法进行,您选择的区域中存在被禁止的列({0})'
  36837. },
  36838. fnr: {
  36839. title: '查找和替换',
  36840. findLabel: '查找',
  36841. replaceLabel: '替换',
  36842. findTitle: '查找内容:',
  36843. replaceTitle: '替换为:',
  36844. tabs: {
  36845. find: '查找',
  36846. replace: '替换'
  36847. },
  36848. filter: {
  36849. re: '正则表达式',
  36850. whole: '全词匹配',
  36851. sensitive: '区分大小写'
  36852. },
  36853. btns: {
  36854. findNext: '查找下一个',
  36855. findAll: '查找全部',
  36856. replace: '替换',
  36857. replaceAll: '替换全部',
  36858. cancel: '取消'
  36859. },
  36860. header: {
  36861. seq: '#',
  36862. cell: '单元格',
  36863. value: '值'
  36864. },
  36865. body: {
  36866. row: '行:{0}',
  36867. col: '列:{0}'
  36868. },
  36869. empty: '(空值)',
  36870. reError: '无效的正则表达式',
  36871. recordCount: '已找到 {0} 个单元格',
  36872. notCell: '找不到匹配的单元格',
  36873. replaceSuccess: '成功替换 {0} 个单元格'
  36874. }
  36875. },
  36876. extendPivotTable: {
  36877. aggregation: {
  36878. grouping: '分组',
  36879. values: '值',
  36880. groupPlaceholder: '拖至此处进行分组',
  36881. valuesPlaceholder: '拖至此处进行聚合',
  36882. dragExistCol: '该列已存在',
  36883. sortHelpTip: '点击并拖动图标可以调整顺序'
  36884. },
  36885. aggFuncs: {
  36886. sum: '求和',
  36887. count: '计数',
  36888. avg: '平均值',
  36889. min: '最小值',
  36890. max: '最大值',
  36891. first: '首个值',
  36892. last: '末尾值'
  36893. }
  36894. },
  36895. filterComplexInput: {
  36896. menus: {
  36897. fixedColumn: '冻结列',
  36898. fixedGroup: '冻结分组',
  36899. cancelFixed: '取消冻结',
  36900. fixedLeft: '冻结左侧',
  36901. fixedRight: '冻结右侧'
  36902. },
  36903. cases: {
  36904. equal: '等于',
  36905. gt: '大于',
  36906. lt: '小于',
  36907. begin: '开头是',
  36908. endin: '结尾是',
  36909. include: '包含',
  36910. isSensitive: '区分大小写'
  36911. }
  36912. },
  36913. filterCombination: {
  36914. menus: {
  36915. sort: '排序',
  36916. clearSort: '清除排序',
  36917. sortAsc: '升序',
  36918. sortDesc: '降序',
  36919. fixedColumn: '冻结列',
  36920. fixedGroup: '冻结分组',
  36921. cancelFixed: '取消冻结',
  36922. fixedLeft: '冻结左侧',
  36923. fixedRight: '冻结右侧',
  36924. clearFilter: '清除筛选',
  36925. textOption: '文本筛选',
  36926. numberOption: '数值筛选'
  36927. },
  36928. popup: {
  36929. title: '自定义筛选的方式',
  36930. currColumnTitle: '当前列:',
  36931. and: '与',
  36932. or: '或',
  36933. describeHtml: '可用 ? 代表单个字符<br/>用 * 代表任意多个字符'
  36934. },
  36935. cases: {
  36936. equal: '等于',
  36937. unequal: '不等于',
  36938. gt: '大于',
  36939. ge: '大于或等于',
  36940. lt: '小于',
  36941. le: '小于或等于',
  36942. begin: '开头是',
  36943. notbegin: '开头不是',
  36944. endin: '结尾是',
  36945. notendin: '结尾不是',
  36946. include: '包含',
  36947. exclude: '不包含',
  36948. between: '介于',
  36949. custom: '自定义筛选',
  36950. insensitive: '不区分大小写',
  36951. isSensitive: '区分大小写'
  36952. },
  36953. empty: '(空白)',
  36954. notData: '无匹配项'
  36955. }
  36956. },
  36957. pro: {
  36958. area: {
  36959. mergeErr: '无法对合并单元格进行该操作',
  36960. multiErr: '无法对多重选择区域进行该操作',
  36961. extendErr: '如果延伸的区域包含被合并的单元格,所有合并的单元格需大小相同',
  36962. pasteMultiErr: '无法粘贴,需要相同大小的复制的区域和粘贴的区域才能执行此操作'
  36963. },
  36964. fnr: {
  36965. title: '查找和替换',
  36966. findLabel: '查找',
  36967. replaceLabel: '替换',
  36968. findTitle: '查找内容:',
  36969. replaceTitle: '替换为:',
  36970. tabs: {
  36971. find: '查找',
  36972. replace: '替换'
  36973. },
  36974. filter: {
  36975. re: '正则表达式',
  36976. whole: '全词匹配',
  36977. sensitive: '区分大小写'
  36978. },
  36979. btns: {
  36980. findNext: '查找下一个',
  36981. findAll: '查找全部',
  36982. replace: '替换',
  36983. replaceAll: '替换全部',
  36984. cancel: '取消'
  36985. },
  36986. header: {
  36987. seq: '#',
  36988. cell: '单元格',
  36989. value: '值'
  36990. },
  36991. empty: '(空值)',
  36992. reError: '无效的正则表达式',
  36993. recordCount: '已找到 {0} 个单元格',
  36994. notCell: '找不到匹配的单元格',
  36995. replaceSuccess: '成功替换 {0} 个单元格'
  36996. }
  36997. },
  36998. renderer: {
  36999. search: '搜索',
  37000. cases: {
  37001. equal: '等于',
  37002. unequal: '不等于',
  37003. gt: '大于',
  37004. ge: '大于或等于',
  37005. lt: '小于',
  37006. le: '小于或等于',
  37007. begin: '开头是',
  37008. notbegin: '开头不是',
  37009. endin: '结尾是',
  37010. notendin: '结尾不是',
  37011. include: '包含',
  37012. exclude: '不包含',
  37013. between: '介于',
  37014. custom: '自定义筛选',
  37015. insensitive: '不区分大小写',
  37016. isSensitive: '区分大小写'
  37017. },
  37018. combination: {
  37019. menus: {
  37020. sort: '排序',
  37021. clearSort: '清除排序',
  37022. sortAsc: '升序',
  37023. sortDesc: '降序',
  37024. fixedColumn: '冻结列',
  37025. fixedGroup: '冻结分组',
  37026. cancelFixed: '取消冻结',
  37027. fixedLeft: '冻结到左侧',
  37028. fixedRight: '冻结到右侧',
  37029. clearFilter: '清除筛选',
  37030. textOption: '文本筛选',
  37031. numberOption: '数值筛选'
  37032. },
  37033. popup: {
  37034. title: '自定义筛选的方式',
  37035. currColumnTitle: '当前列:',
  37036. and: '与',
  37037. or: '或',
  37038. describeHtml: '可用 ? 代表单个字符<br/>用 * 代表任意多个字符'
  37039. },
  37040. empty: '(空白)',
  37041. notData: '无匹配项'
  37042. }
  37043. }
  37044. }
  37045. });
  37046. ;// CONCATENATED MODULE: ./packages/components.ts
  37047. const components = [VxeColumn, VxeColgroup, VxeGrid, VxeTable, VxeToolbar];
  37048. // 默认安装
  37049. function install(app, options) {
  37050. core_.VxeUI.setConfig(options);
  37051. components.forEach(component => component.install(app));
  37052. }
  37053. // 保留兼容老版本
  37054. if (!core_.VxeUI.hasLanguage('zh-CN')) {
  37055. const defaultLanguage = 'zh-CN';
  37056. core_.VxeUI.setI18n(defaultLanguage, zh_CN);
  37057. core_.VxeUI.setLanguage(defaultLanguage);
  37058. }
  37059. core_.VxeUI.setTheme('light');
  37060. // Components
  37061. ;// CONCATENATED MODULE: ./index.ts
  37062. if (typeof window !== 'undefined' && window.Vue) {
  37063. if (window.VXETable) {
  37064. if (!window.VXETable) {
  37065. window.VXETable = components_namespaceObject;
  37066. }
  37067. }
  37068. window.Vue.use(components_namespaceObject);
  37069. }
  37070. /* harmony default export */ var index = (components_namespaceObject);
  37071. ;// CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/entry-lib.js
  37072. /* harmony default export */ var entry_lib = (index);
  37073. /******/ return __webpack_exports__;
  37074. /******/ })()
  37075. ;
  37076. });