| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778 |
- (function webpackUniversalModuleDefinition(root, factory) {
- if(typeof exports === 'object' && typeof module === 'object')
- module.exports = factory(require("vue"), require("@vxe-ui/core"), require("xe-utils"));
- else if(typeof define === 'function' && define.amd)
- define([, "@vxe-ui/core", "xe-utils"], factory);
- else if(typeof exports === 'object')
- exports["VxeUITable"] = factory(require("vue"), require("@vxe-ui/core"), require("xe-utils"));
- else
- root["VxeUITable"] = factory(root["Vue"], root["VxeUI"], root["XEUtils"]);
- })((typeof self !== 'undefined' ? self : this), function(__WEBPACK_EXTERNAL_MODULE__9274__, __WEBPACK_EXTERNAL_MODULE__4345__, __WEBPACK_EXTERNAL_MODULE__8871__) {
- return /******/ (function() { // webpackBootstrap
- /******/ "use strict";
- /******/ var __webpack_modules__ = ({
- /***/ 9274:
- /***/ (function(module) {
- module.exports = __WEBPACK_EXTERNAL_MODULE__9274__;
- /***/ }),
- /***/ 4345:
- /***/ (function(module) {
- module.exports = __WEBPACK_EXTERNAL_MODULE__4345__;
- /***/ }),
- /***/ 8871:
- /***/ (function(module) {
- module.exports = __WEBPACK_EXTERNAL_MODULE__8871__;
- /***/ }),
- /***/ 9306:
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
- var isCallable = __webpack_require__(4901);
- var tryToString = __webpack_require__(6823);
- var $TypeError = TypeError;
- // `Assert: IsCallable(argument) is true`
- module.exports = function (argument) {
- if (isCallable(argument)) return argument;
- throw new $TypeError(tryToString(argument) + ' is not a function');
- };
- /***/ }),
- /***/ 8551:
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
- var isObject = __webpack_require__(34);
- var $String = String;
- var $TypeError = TypeError;
- // `Assert: Type(argument) is Object`
- module.exports = function (argument) {
- if (isObject(argument)) return argument;
- throw new $TypeError($String(argument) + ' is not an object');
- };
- /***/ }),
- /***/ 9617:
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
- var toIndexedObject = __webpack_require__(5397);
- var toAbsoluteIndex = __webpack_require__(5610);
- var lengthOfArrayLike = __webpack_require__(6198);
- // `Array.prototype.{ indexOf, includes }` methods implementation
- var createMethod = function (IS_INCLUDES) {
- return function ($this, el, fromIndex) {
- var O = toIndexedObject($this);
- var length = lengthOfArrayLike(O);
- if (length === 0) return !IS_INCLUDES && -1;
- var index = toAbsoluteIndex(fromIndex, length);
- var value;
- // Array#includes uses SameValueZero equality algorithm
- // eslint-disable-next-line no-self-compare -- NaN check
- if (IS_INCLUDES && el !== el) while (length > index) {
- value = O[index++];
- // eslint-disable-next-line no-self-compare -- NaN check
- if (value !== value) return true;
- // Array#indexOf ignores holes, Array#includes - not
- } else for (;length > index; index++) {
- if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
- } return !IS_INCLUDES && -1;
- };
- };
- module.exports = {
- // `Array.prototype.includes` method
- // https://tc39.es/ecma262/#sec-array.prototype.includes
- includes: createMethod(true),
- // `Array.prototype.indexOf` method
- // https://tc39.es/ecma262/#sec-array.prototype.indexof
- indexOf: createMethod(false)
- };
- /***/ }),
- /***/ 4527:
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
- var DESCRIPTORS = __webpack_require__(3724);
- var isArray = __webpack_require__(4376);
- var $TypeError = TypeError;
- // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
- var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
- // Safari < 13 does not throw an error in this case
- var SILENT_ON_NON_WRITABLE_LENGTH_SET = DESCRIPTORS && !function () {
- // makes no sense without proper strict mode support
- if (this !== undefined) return true;
- try {
- // eslint-disable-next-line es/no-object-defineproperty -- safe
- Object.defineProperty([], 'length', { writable: false }).length = 1;
- } catch (error) {
- return error instanceof TypeError;
- }
- }();
- module.exports = SILENT_ON_NON_WRITABLE_LENGTH_SET ? function (O, length) {
- if (isArray(O) && !getOwnPropertyDescriptor(O, 'length').writable) {
- throw new $TypeError('Cannot set read only .length');
- } return O.length = length;
- } : function (O, length) {
- return O.length = length;
- };
- /***/ }),
- /***/ 2195:
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
- var uncurryThis = __webpack_require__(9504);
- var toString = uncurryThis({}.toString);
- var stringSlice = uncurryThis(''.slice);
- module.exports = function (it) {
- return stringSlice(toString(it), 8, -1);
- };
- /***/ }),
- /***/ 7740:
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
- var hasOwn = __webpack_require__(9297);
- var ownKeys = __webpack_require__(5031);
- var getOwnPropertyDescriptorModule = __webpack_require__(7347);
- var definePropertyModule = __webpack_require__(4913);
- module.exports = function (target, source, exceptions) {
- var keys = ownKeys(source);
- var defineProperty = definePropertyModule.f;
- var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
- for (var i = 0; i < keys.length; i++) {
- var key = keys[i];
- if (!hasOwn(target, key) && !(exceptions && hasOwn(exceptions, key))) {
- defineProperty(target, key, getOwnPropertyDescriptor(source, key));
- }
- }
- };
- /***/ }),
- /***/ 6699:
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
- var DESCRIPTORS = __webpack_require__(3724);
- var definePropertyModule = __webpack_require__(4913);
- var createPropertyDescriptor = __webpack_require__(6980);
- module.exports = DESCRIPTORS ? function (object, key, value) {
- return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));
- } : function (object, key, value) {
- object[key] = value;
- return object;
- };
- /***/ }),
- /***/ 6980:
- /***/ (function(module) {
- module.exports = function (bitmap, value) {
- return {
- enumerable: !(bitmap & 1),
- configurable: !(bitmap & 2),
- writable: !(bitmap & 4),
- value: value
- };
- };
- /***/ }),
- /***/ 6840:
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
- var isCallable = __webpack_require__(4901);
- var definePropertyModule = __webpack_require__(4913);
- var makeBuiltIn = __webpack_require__(283);
- var defineGlobalProperty = __webpack_require__(9433);
- module.exports = function (O, key, value, options) {
- if (!options) options = {};
- var simple = options.enumerable;
- var name = options.name !== undefined ? options.name : key;
- if (isCallable(value)) makeBuiltIn(value, name, options);
- if (options.global) {
- if (simple) O[key] = value;
- else defineGlobalProperty(key, value);
- } else {
- try {
- if (!options.unsafe) delete O[key];
- else if (O[key]) simple = true;
- } catch (error) { /* empty */ }
- if (simple) O[key] = value;
- else definePropertyModule.f(O, key, {
- value: value,
- enumerable: false,
- configurable: !options.nonConfigurable,
- writable: !options.nonWritable
- });
- } return O;
- };
- /***/ }),
- /***/ 9433:
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
- var globalThis = __webpack_require__(4576);
- // eslint-disable-next-line es/no-object-defineproperty -- safe
- var defineProperty = Object.defineProperty;
- module.exports = function (key, value) {
- try {
- defineProperty(globalThis, key, { value: value, configurable: true, writable: true });
- } catch (error) {
- globalThis[key] = value;
- } return value;
- };
- /***/ }),
- /***/ 3724:
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
- var fails = __webpack_require__(9039);
- // Detect IE8's incomplete defineProperty implementation
- module.exports = !fails(function () {
- // eslint-disable-next-line es/no-object-defineproperty -- required for testing
- return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] !== 7;
- });
- /***/ }),
- /***/ 4055:
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
- var globalThis = __webpack_require__(4576);
- var isObject = __webpack_require__(34);
- var document = globalThis.document;
- // typeof document.createElement is 'object' in old IE
- var EXISTS = isObject(document) && isObject(document.createElement);
- module.exports = function (it) {
- return EXISTS ? document.createElement(it) : {};
- };
- /***/ }),
- /***/ 6837:
- /***/ (function(module) {
- var $TypeError = TypeError;
- var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF; // 2 ** 53 - 1 == 9007199254740991
- module.exports = function (it) {
- if (it > MAX_SAFE_INTEGER) throw $TypeError('Maximum allowed index exceeded');
- return it;
- };
- /***/ }),
- /***/ 8727:
- /***/ (function(module) {
- // IE8- don't enum bug keys
- module.exports = [
- 'constructor',
- 'hasOwnProperty',
- 'isPrototypeOf',
- 'propertyIsEnumerable',
- 'toLocaleString',
- 'toString',
- 'valueOf'
- ];
- /***/ }),
- /***/ 2839:
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
- var globalThis = __webpack_require__(4576);
- var navigator = globalThis.navigator;
- var userAgent = navigator && navigator.userAgent;
- module.exports = userAgent ? String(userAgent) : '';
- /***/ }),
- /***/ 9519:
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
- var globalThis = __webpack_require__(4576);
- var userAgent = __webpack_require__(2839);
- var process = globalThis.process;
- var Deno = globalThis.Deno;
- var versions = process && process.versions || Deno && Deno.version;
- var v8 = versions && versions.v8;
- var match, version;
- if (v8) {
- match = v8.split('.');
- // in old Chrome, versions of V8 isn't V8 = Chrome / 10
- // but their correct versions are not interesting for us
- version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
- }
- // BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
- // so check `userAgent` even if `.v8` exists, but 0
- if (!version && userAgent) {
- match = userAgent.match(/Edge\/(\d+)/);
- if (!match || match[1] >= 74) {
- match = userAgent.match(/Chrome\/(\d+)/);
- if (match) version = +match[1];
- }
- }
- module.exports = version;
- /***/ }),
- /***/ 6518:
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
- var globalThis = __webpack_require__(4576);
- var getOwnPropertyDescriptor = (__webpack_require__(7347).f);
- var createNonEnumerableProperty = __webpack_require__(6699);
- var defineBuiltIn = __webpack_require__(6840);
- var defineGlobalProperty = __webpack_require__(9433);
- var copyConstructorProperties = __webpack_require__(7740);
- var isForced = __webpack_require__(2796);
- /*
- options.target - name of the target object
- options.global - target is the global object
- options.stat - export as static methods of target
- options.proto - export as prototype methods of target
- options.real - real prototype method for the `pure` version
- options.forced - export even if the native feature is available
- options.bind - bind methods to the target, required for the `pure` version
- options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
- options.unsafe - use the simple assignment of property instead of delete + defineProperty
- options.sham - add a flag to not completely full polyfills
- options.enumerable - export as enumerable property
- options.dontCallGetSet - prevent calling a getter on target
- options.name - the .name of the function if it does not match the key
- */
- module.exports = function (options, source) {
- var TARGET = options.target;
- var GLOBAL = options.global;
- var STATIC = options.stat;
- var FORCED, target, key, targetProperty, sourceProperty, descriptor;
- if (GLOBAL) {
- target = globalThis;
- } else if (STATIC) {
- target = globalThis[TARGET] || defineGlobalProperty(TARGET, {});
- } else {
- target = globalThis[TARGET] && globalThis[TARGET].prototype;
- }
- if (target) for (key in source) {
- sourceProperty = source[key];
- if (options.dontCallGetSet) {
- descriptor = getOwnPropertyDescriptor(target, key);
- targetProperty = descriptor && descriptor.value;
- } else targetProperty = target[key];
- FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
- // contained in target
- if (!FORCED && targetProperty !== undefined) {
- if (typeof sourceProperty == typeof targetProperty) continue;
- copyConstructorProperties(sourceProperty, targetProperty);
- }
- // add a flag to not completely full polyfills
- if (options.sham || (targetProperty && targetProperty.sham)) {
- createNonEnumerableProperty(sourceProperty, 'sham', true);
- }
- defineBuiltIn(target, key, sourceProperty, options);
- }
- };
- /***/ }),
- /***/ 9039:
- /***/ (function(module) {
- module.exports = function (exec) {
- try {
- return !!exec();
- } catch (error) {
- return true;
- }
- };
- /***/ }),
- /***/ 616:
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
- var fails = __webpack_require__(9039);
- module.exports = !fails(function () {
- // eslint-disable-next-line es/no-function-prototype-bind -- safe
- var test = (function () { /* empty */ }).bind();
- // eslint-disable-next-line no-prototype-builtins -- safe
- return typeof test != 'function' || test.hasOwnProperty('prototype');
- });
- /***/ }),
- /***/ 9565:
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
- var NATIVE_BIND = __webpack_require__(616);
- var call = Function.prototype.call;
- module.exports = NATIVE_BIND ? call.bind(call) : function () {
- return call.apply(call, arguments);
- };
- /***/ }),
- /***/ 350:
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
- var DESCRIPTORS = __webpack_require__(3724);
- var hasOwn = __webpack_require__(9297);
- var FunctionPrototype = Function.prototype;
- // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
- var getDescriptor = DESCRIPTORS && Object.getOwnPropertyDescriptor;
- var EXISTS = hasOwn(FunctionPrototype, 'name');
- // additional protection from minified / mangled / dropped function names
- var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';
- var CONFIGURABLE = EXISTS && (!DESCRIPTORS || (DESCRIPTORS && getDescriptor(FunctionPrototype, 'name').configurable));
- module.exports = {
- EXISTS: EXISTS,
- PROPER: PROPER,
- CONFIGURABLE: CONFIGURABLE
- };
- /***/ }),
- /***/ 9504:
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
- var NATIVE_BIND = __webpack_require__(616);
- var FunctionPrototype = Function.prototype;
- var call = FunctionPrototype.call;
- var uncurryThisWithBind = NATIVE_BIND && FunctionPrototype.bind.bind(call, call);
- module.exports = NATIVE_BIND ? uncurryThisWithBind : function (fn) {
- return function () {
- return call.apply(fn, arguments);
- };
- };
- /***/ }),
- /***/ 7751:
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
- var globalThis = __webpack_require__(4576);
- var isCallable = __webpack_require__(4901);
- var aFunction = function (argument) {
- return isCallable(argument) ? argument : undefined;
- };
- module.exports = function (namespace, method) {
- return arguments.length < 2 ? aFunction(globalThis[namespace]) : globalThis[namespace] && globalThis[namespace][method];
- };
- /***/ }),
- /***/ 5966:
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
- var aCallable = __webpack_require__(9306);
- var isNullOrUndefined = __webpack_require__(4117);
- // `GetMethod` abstract operation
- // https://tc39.es/ecma262/#sec-getmethod
- module.exports = function (V, P) {
- var func = V[P];
- return isNullOrUndefined(func) ? undefined : aCallable(func);
- };
- /***/ }),
- /***/ 4576:
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
- var check = function (it) {
- return it && it.Math === Math && it;
- };
- // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
- module.exports =
- // eslint-disable-next-line es/no-global-this -- safe
- check(typeof globalThis == 'object' && globalThis) ||
- check(typeof window == 'object' && window) ||
- // eslint-disable-next-line no-restricted-globals -- safe
- check(typeof self == 'object' && self) ||
- check(typeof __webpack_require__.g == 'object' && __webpack_require__.g) ||
- check(typeof this == 'object' && this) ||
- // eslint-disable-next-line no-new-func -- fallback
- (function () { return this; })() || Function('return this')();
- /***/ }),
- /***/ 9297:
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
- var uncurryThis = __webpack_require__(9504);
- var toObject = __webpack_require__(8981);
- var hasOwnProperty = uncurryThis({}.hasOwnProperty);
- // `HasOwnProperty` abstract operation
- // https://tc39.es/ecma262/#sec-hasownproperty
- // eslint-disable-next-line es/no-object-hasown -- safe
- module.exports = Object.hasOwn || function hasOwn(it, key) {
- return hasOwnProperty(toObject(it), key);
- };
- /***/ }),
- /***/ 421:
- /***/ (function(module) {
- module.exports = {};
- /***/ }),
- /***/ 5917:
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
- var DESCRIPTORS = __webpack_require__(3724);
- var fails = __webpack_require__(9039);
- var createElement = __webpack_require__(4055);
- // Thanks to IE8 for its funny defineProperty
- module.exports = !DESCRIPTORS && !fails(function () {
- // eslint-disable-next-line es/no-object-defineproperty -- required for testing
- return Object.defineProperty(createElement('div'), 'a', {
- get: function () { return 7; }
- }).a !== 7;
- });
- /***/ }),
- /***/ 7055:
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
- var uncurryThis = __webpack_require__(9504);
- var fails = __webpack_require__(9039);
- var classof = __webpack_require__(2195);
- var $Object = Object;
- var split = uncurryThis(''.split);
- // fallback for non-array-like ES3 and non-enumerable old V8 strings
- module.exports = fails(function () {
- // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
- // eslint-disable-next-line no-prototype-builtins -- safe
- return !$Object('z').propertyIsEnumerable(0);
- }) ? function (it) {
- return classof(it) === 'String' ? split(it, '') : $Object(it);
- } : $Object;
- /***/ }),
- /***/ 3706:
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
- var uncurryThis = __webpack_require__(9504);
- var isCallable = __webpack_require__(4901);
- var store = __webpack_require__(7629);
- var functionToString = uncurryThis(Function.toString);
- // this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
- if (!isCallable(store.inspectSource)) {
- store.inspectSource = function (it) {
- return functionToString(it);
- };
- }
- module.exports = store.inspectSource;
- /***/ }),
- /***/ 1181:
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
- var NATIVE_WEAK_MAP = __webpack_require__(8622);
- var globalThis = __webpack_require__(4576);
- var isObject = __webpack_require__(34);
- var createNonEnumerableProperty = __webpack_require__(6699);
- var hasOwn = __webpack_require__(9297);
- var shared = __webpack_require__(7629);
- var sharedKey = __webpack_require__(6119);
- var hiddenKeys = __webpack_require__(421);
- var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
- var TypeError = globalThis.TypeError;
- var WeakMap = globalThis.WeakMap;
- var set, get, has;
- var enforce = function (it) {
- return has(it) ? get(it) : set(it, {});
- };
- var getterFor = function (TYPE) {
- return function (it) {
- var state;
- if (!isObject(it) || (state = get(it)).type !== TYPE) {
- throw new TypeError('Incompatible receiver, ' + TYPE + ' required');
- } return state;
- };
- };
- if (NATIVE_WEAK_MAP || shared.state) {
- var store = shared.state || (shared.state = new WeakMap());
- /* eslint-disable no-self-assign -- prototype methods protection */
- store.get = store.get;
- store.has = store.has;
- store.set = store.set;
- /* eslint-enable no-self-assign -- prototype methods protection */
- set = function (it, metadata) {
- if (store.has(it)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);
- metadata.facade = it;
- store.set(it, metadata);
- return metadata;
- };
- get = function (it) {
- return store.get(it) || {};
- };
- has = function (it) {
- return store.has(it);
- };
- } else {
- var STATE = sharedKey('state');
- hiddenKeys[STATE] = true;
- set = function (it, metadata) {
- if (hasOwn(it, STATE)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);
- metadata.facade = it;
- createNonEnumerableProperty(it, STATE, metadata);
- return metadata;
- };
- get = function (it) {
- return hasOwn(it, STATE) ? it[STATE] : {};
- };
- has = function (it) {
- return hasOwn(it, STATE);
- };
- }
- module.exports = {
- set: set,
- get: get,
- has: has,
- enforce: enforce,
- getterFor: getterFor
- };
- /***/ }),
- /***/ 4376:
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
- var classof = __webpack_require__(2195);
- // `IsArray` abstract operation
- // https://tc39.es/ecma262/#sec-isarray
- // eslint-disable-next-line es/no-array-isarray -- safe
- module.exports = Array.isArray || function isArray(argument) {
- return classof(argument) === 'Array';
- };
- /***/ }),
- /***/ 4901:
- /***/ (function(module) {
- // https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot
- var documentAll = typeof document == 'object' && document.all;
- // `IsCallable` abstract operation
- // https://tc39.es/ecma262/#sec-iscallable
- // eslint-disable-next-line unicorn/no-typeof-undefined -- required for testing
- module.exports = typeof documentAll == 'undefined' && documentAll !== undefined ? function (argument) {
- return typeof argument == 'function' || argument === documentAll;
- } : function (argument) {
- return typeof argument == 'function';
- };
- /***/ }),
- /***/ 2796:
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
- var fails = __webpack_require__(9039);
- var isCallable = __webpack_require__(4901);
- var replacement = /#|\.prototype\./;
- var isForced = function (feature, detection) {
- var value = data[normalize(feature)];
- return value === POLYFILL ? true
- : value === NATIVE ? false
- : isCallable(detection) ? fails(detection)
- : !!detection;
- };
- var normalize = isForced.normalize = function (string) {
- return String(string).replace(replacement, '.').toLowerCase();
- };
- var data = isForced.data = {};
- var NATIVE = isForced.NATIVE = 'N';
- var POLYFILL = isForced.POLYFILL = 'P';
- module.exports = isForced;
- /***/ }),
- /***/ 4117:
- /***/ (function(module) {
- // we can't use just `it == null` since of `document.all` special case
- // https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot-aec
- module.exports = function (it) {
- return it === null || it === undefined;
- };
- /***/ }),
- /***/ 34:
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
- var isCallable = __webpack_require__(4901);
- module.exports = function (it) {
- return typeof it == 'object' ? it !== null : isCallable(it);
- };
- /***/ }),
- /***/ 6395:
- /***/ (function(module) {
- module.exports = false;
- /***/ }),
- /***/ 757:
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
- var getBuiltIn = __webpack_require__(7751);
- var isCallable = __webpack_require__(4901);
- var isPrototypeOf = __webpack_require__(1625);
- var USE_SYMBOL_AS_UID = __webpack_require__(7040);
- var $Object = Object;
- module.exports = USE_SYMBOL_AS_UID ? function (it) {
- return typeof it == 'symbol';
- } : function (it) {
- var $Symbol = getBuiltIn('Symbol');
- return isCallable($Symbol) && isPrototypeOf($Symbol.prototype, $Object(it));
- };
- /***/ }),
- /***/ 6198:
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
- var toLength = __webpack_require__(8014);
- // `LengthOfArrayLike` abstract operation
- // https://tc39.es/ecma262/#sec-lengthofarraylike
- module.exports = function (obj) {
- return toLength(obj.length);
- };
- /***/ }),
- /***/ 283:
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
- var uncurryThis = __webpack_require__(9504);
- var fails = __webpack_require__(9039);
- var isCallable = __webpack_require__(4901);
- var hasOwn = __webpack_require__(9297);
- var DESCRIPTORS = __webpack_require__(3724);
- var CONFIGURABLE_FUNCTION_NAME = (__webpack_require__(350).CONFIGURABLE);
- var inspectSource = __webpack_require__(3706);
- var InternalStateModule = __webpack_require__(1181);
- var enforceInternalState = InternalStateModule.enforce;
- var getInternalState = InternalStateModule.get;
- var $String = String;
- // eslint-disable-next-line es/no-object-defineproperty -- safe
- var defineProperty = Object.defineProperty;
- var stringSlice = uncurryThis(''.slice);
- var replace = uncurryThis(''.replace);
- var join = uncurryThis([].join);
- var CONFIGURABLE_LENGTH = DESCRIPTORS && !fails(function () {
- return defineProperty(function () { /* empty */ }, 'length', { value: 8 }).length !== 8;
- });
- var TEMPLATE = String(String).split('String');
- var makeBuiltIn = module.exports = function (value, name, options) {
- if (stringSlice($String(name), 0, 7) === 'Symbol(') {
- name = '[' + replace($String(name), /^Symbol\(([^)]*)\).*$/, '$1') + ']';
- }
- if (options && options.getter) name = 'get ' + name;
- if (options && options.setter) name = 'set ' + name;
- if (!hasOwn(value, 'name') || (CONFIGURABLE_FUNCTION_NAME && value.name !== name)) {
- if (DESCRIPTORS) defineProperty(value, 'name', { value: name, configurable: true });
- else value.name = name;
- }
- if (CONFIGURABLE_LENGTH && options && hasOwn(options, 'arity') && value.length !== options.arity) {
- defineProperty(value, 'length', { value: options.arity });
- }
- try {
- if (options && hasOwn(options, 'constructor') && options.constructor) {
- if (DESCRIPTORS) defineProperty(value, 'prototype', { writable: false });
- // in V8 ~ Chrome 53, prototypes of some methods, like `Array.prototype.values`, are non-writable
- } else if (value.prototype) value.prototype = undefined;
- } catch (error) { /* empty */ }
- var state = enforceInternalState(value);
- if (!hasOwn(state, 'source')) {
- state.source = join(TEMPLATE, typeof name == 'string' ? name : '');
- } return value;
- };
- // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
- // eslint-disable-next-line no-extend-native -- required
- Function.prototype.toString = makeBuiltIn(function toString() {
- return isCallable(this) && getInternalState(this).source || inspectSource(this);
- }, 'toString');
- /***/ }),
- /***/ 741:
- /***/ (function(module) {
- var ceil = Math.ceil;
- var floor = Math.floor;
- // `Math.trunc` method
- // https://tc39.es/ecma262/#sec-math.trunc
- // eslint-disable-next-line es/no-math-trunc -- safe
- module.exports = Math.trunc || function trunc(x) {
- var n = +x;
- return (n > 0 ? floor : ceil)(n);
- };
- /***/ }),
- /***/ 4913:
- /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
- var DESCRIPTORS = __webpack_require__(3724);
- var IE8_DOM_DEFINE = __webpack_require__(5917);
- var V8_PROTOTYPE_DEFINE_BUG = __webpack_require__(8686);
- var anObject = __webpack_require__(8551);
- var toPropertyKey = __webpack_require__(6969);
- var $TypeError = TypeError;
- // eslint-disable-next-line es/no-object-defineproperty -- safe
- var $defineProperty = Object.defineProperty;
- // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
- var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
- var ENUMERABLE = 'enumerable';
- var CONFIGURABLE = 'configurable';
- var WRITABLE = 'writable';
- // `Object.defineProperty` method
- // https://tc39.es/ecma262/#sec-object.defineproperty
- exports.f = DESCRIPTORS ? V8_PROTOTYPE_DEFINE_BUG ? function defineProperty(O, P, Attributes) {
- anObject(O);
- P = toPropertyKey(P);
- anObject(Attributes);
- if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
- var current = $getOwnPropertyDescriptor(O, P);
- if (current && current[WRITABLE]) {
- O[P] = Attributes.value;
- Attributes = {
- configurable: CONFIGURABLE in Attributes ? Attributes[CONFIGURABLE] : current[CONFIGURABLE],
- enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],
- writable: false
- };
- }
- } return $defineProperty(O, P, Attributes);
- } : $defineProperty : function defineProperty(O, P, Attributes) {
- anObject(O);
- P = toPropertyKey(P);
- anObject(Attributes);
- if (IE8_DOM_DEFINE) try {
- return $defineProperty(O, P, Attributes);
- } catch (error) { /* empty */ }
- if ('get' in Attributes || 'set' in Attributes) throw new $TypeError('Accessors not supported');
- if ('value' in Attributes) O[P] = Attributes.value;
- return O;
- };
- /***/ }),
- /***/ 7347:
- /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
- var DESCRIPTORS = __webpack_require__(3724);
- var call = __webpack_require__(9565);
- var propertyIsEnumerableModule = __webpack_require__(8773);
- var createPropertyDescriptor = __webpack_require__(6980);
- var toIndexedObject = __webpack_require__(5397);
- var toPropertyKey = __webpack_require__(6969);
- var hasOwn = __webpack_require__(9297);
- var IE8_DOM_DEFINE = __webpack_require__(5917);
- // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
- var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
- // `Object.getOwnPropertyDescriptor` method
- // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
- exports.f = DESCRIPTORS ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
- O = toIndexedObject(O);
- P = toPropertyKey(P);
- if (IE8_DOM_DEFINE) try {
- return $getOwnPropertyDescriptor(O, P);
- } catch (error) { /* empty */ }
- if (hasOwn(O, P)) return createPropertyDescriptor(!call(propertyIsEnumerableModule.f, O, P), O[P]);
- };
- /***/ }),
- /***/ 8480:
- /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
- var internalObjectKeys = __webpack_require__(1828);
- var enumBugKeys = __webpack_require__(8727);
- var hiddenKeys = enumBugKeys.concat('length', 'prototype');
- // `Object.getOwnPropertyNames` method
- // https://tc39.es/ecma262/#sec-object.getownpropertynames
- // eslint-disable-next-line es/no-object-getownpropertynames -- safe
- exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
- return internalObjectKeys(O, hiddenKeys);
- };
- /***/ }),
- /***/ 3717:
- /***/ (function(__unused_webpack_module, exports) {
- // eslint-disable-next-line es/no-object-getownpropertysymbols -- safe
- exports.f = Object.getOwnPropertySymbols;
- /***/ }),
- /***/ 1625:
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
- var uncurryThis = __webpack_require__(9504);
- module.exports = uncurryThis({}.isPrototypeOf);
- /***/ }),
- /***/ 1828:
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
- var uncurryThis = __webpack_require__(9504);
- var hasOwn = __webpack_require__(9297);
- var toIndexedObject = __webpack_require__(5397);
- var indexOf = (__webpack_require__(9617).indexOf);
- var hiddenKeys = __webpack_require__(421);
- var push = uncurryThis([].push);
- module.exports = function (object, names) {
- var O = toIndexedObject(object);
- var i = 0;
- var result = [];
- var key;
- for (key in O) !hasOwn(hiddenKeys, key) && hasOwn(O, key) && push(result, key);
- // Don't enum bug & hidden keys
- while (names.length > i) if (hasOwn(O, key = names[i++])) {
- ~indexOf(result, key) || push(result, key);
- }
- return result;
- };
- /***/ }),
- /***/ 8773:
- /***/ (function(__unused_webpack_module, exports) {
- var $propertyIsEnumerable = {}.propertyIsEnumerable;
- // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
- var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
- // Nashorn ~ JDK8 bug
- var NASHORN_BUG = getOwnPropertyDescriptor && !$propertyIsEnumerable.call({ 1: 2 }, 1);
- // `Object.prototype.propertyIsEnumerable` method implementation
- // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
- exports.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
- var descriptor = getOwnPropertyDescriptor(this, V);
- return !!descriptor && descriptor.enumerable;
- } : $propertyIsEnumerable;
- /***/ }),
- /***/ 4270:
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
- var call = __webpack_require__(9565);
- var isCallable = __webpack_require__(4901);
- var isObject = __webpack_require__(34);
- var $TypeError = TypeError;
- // `OrdinaryToPrimitive` abstract operation
- // https://tc39.es/ecma262/#sec-ordinarytoprimitive
- module.exports = function (input, pref) {
- var fn, val;
- if (pref === 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val;
- if (isCallable(fn = input.valueOf) && !isObject(val = call(fn, input))) return val;
- if (pref !== 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val;
- throw new $TypeError("Can't convert object to primitive value");
- };
- /***/ }),
- /***/ 5031:
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
- var getBuiltIn = __webpack_require__(7751);
- var uncurryThis = __webpack_require__(9504);
- var getOwnPropertyNamesModule = __webpack_require__(8480);
- var getOwnPropertySymbolsModule = __webpack_require__(3717);
- var anObject = __webpack_require__(8551);
- var concat = uncurryThis([].concat);
- // all object keys, includes non-enumerable and symbols
- module.exports = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
- var keys = getOwnPropertyNamesModule.f(anObject(it));
- var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
- return getOwnPropertySymbols ? concat(keys, getOwnPropertySymbols(it)) : keys;
- };
- /***/ }),
- /***/ 7750:
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
- var isNullOrUndefined = __webpack_require__(4117);
- var $TypeError = TypeError;
- // `RequireObjectCoercible` abstract operation
- // https://tc39.es/ecma262/#sec-requireobjectcoercible
- module.exports = function (it) {
- if (isNullOrUndefined(it)) throw new $TypeError("Can't call method on " + it);
- return it;
- };
- /***/ }),
- /***/ 6119:
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
- var shared = __webpack_require__(5745);
- var uid = __webpack_require__(3392);
- var keys = shared('keys');
- module.exports = function (key) {
- return keys[key] || (keys[key] = uid(key));
- };
- /***/ }),
- /***/ 7629:
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
- var IS_PURE = __webpack_require__(6395);
- var globalThis = __webpack_require__(4576);
- var defineGlobalProperty = __webpack_require__(9433);
- var SHARED = '__core-js_shared__';
- var store = module.exports = globalThis[SHARED] || defineGlobalProperty(SHARED, {});
- (store.versions || (store.versions = [])).push({
- version: '3.38.1',
- mode: IS_PURE ? 'pure' : 'global',
- copyright: '© 2014-2024 Denis Pushkarev (zloirock.ru)',
- license: 'https://github.com/zloirock/core-js/blob/v3.38.1/LICENSE',
- source: 'https://github.com/zloirock/core-js'
- });
- /***/ }),
- /***/ 5745:
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
- var store = __webpack_require__(7629);
- module.exports = function (key, value) {
- return store[key] || (store[key] = value || {});
- };
- /***/ }),
- /***/ 4495:
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
- /* eslint-disable es/no-symbol -- required for testing */
- var V8_VERSION = __webpack_require__(9519);
- var fails = __webpack_require__(9039);
- var globalThis = __webpack_require__(4576);
- var $String = globalThis.String;
- // eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
- module.exports = !!Object.getOwnPropertySymbols && !fails(function () {
- var symbol = Symbol('symbol detection');
- // Chrome 38 Symbol has incorrect toString conversion
- // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
- // nb: Do not call `String` directly to avoid this being optimized out to `symbol+''` which will,
- // of course, fail.
- return !$String(symbol) || !(Object(symbol) instanceof Symbol) ||
- // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
- !Symbol.sham && V8_VERSION && V8_VERSION < 41;
- });
- /***/ }),
- /***/ 5610:
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
- var toIntegerOrInfinity = __webpack_require__(1291);
- var max = Math.max;
- var min = Math.min;
- // Helper for a popular repeating case of the spec:
- // Let integer be ? ToInteger(index).
- // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
- module.exports = function (index, length) {
- var integer = toIntegerOrInfinity(index);
- return integer < 0 ? max(integer + length, 0) : min(integer, length);
- };
- /***/ }),
- /***/ 5397:
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
- // toObject with fallback for non-array-like ES3 strings
- var IndexedObject = __webpack_require__(7055);
- var requireObjectCoercible = __webpack_require__(7750);
- module.exports = function (it) {
- return IndexedObject(requireObjectCoercible(it));
- };
- /***/ }),
- /***/ 1291:
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
- var trunc = __webpack_require__(741);
- // `ToIntegerOrInfinity` abstract operation
- // https://tc39.es/ecma262/#sec-tointegerorinfinity
- module.exports = function (argument) {
- var number = +argument;
- // eslint-disable-next-line no-self-compare -- NaN check
- return number !== number || number === 0 ? 0 : trunc(number);
- };
- /***/ }),
- /***/ 8014:
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
- var toIntegerOrInfinity = __webpack_require__(1291);
- var min = Math.min;
- // `ToLength` abstract operation
- // https://tc39.es/ecma262/#sec-tolength
- module.exports = function (argument) {
- var len = toIntegerOrInfinity(argument);
- return len > 0 ? min(len, 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
- };
- /***/ }),
- /***/ 8981:
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
- var requireObjectCoercible = __webpack_require__(7750);
- var $Object = Object;
- // `ToObject` abstract operation
- // https://tc39.es/ecma262/#sec-toobject
- module.exports = function (argument) {
- return $Object(requireObjectCoercible(argument));
- };
- /***/ }),
- /***/ 2777:
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
- var call = __webpack_require__(9565);
- var isObject = __webpack_require__(34);
- var isSymbol = __webpack_require__(757);
- var getMethod = __webpack_require__(5966);
- var ordinaryToPrimitive = __webpack_require__(4270);
- var wellKnownSymbol = __webpack_require__(8227);
- var $TypeError = TypeError;
- var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
- // `ToPrimitive` abstract operation
- // https://tc39.es/ecma262/#sec-toprimitive
- module.exports = function (input, pref) {
- if (!isObject(input) || isSymbol(input)) return input;
- var exoticToPrim = getMethod(input, TO_PRIMITIVE);
- var result;
- if (exoticToPrim) {
- if (pref === undefined) pref = 'default';
- result = call(exoticToPrim, input, pref);
- if (!isObject(result) || isSymbol(result)) return result;
- throw new $TypeError("Can't convert object to primitive value");
- }
- if (pref === undefined) pref = 'number';
- return ordinaryToPrimitive(input, pref);
- };
- /***/ }),
- /***/ 6969:
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
- var toPrimitive = __webpack_require__(2777);
- var isSymbol = __webpack_require__(757);
- // `ToPropertyKey` abstract operation
- // https://tc39.es/ecma262/#sec-topropertykey
- module.exports = function (argument) {
- var key = toPrimitive(argument, 'string');
- return isSymbol(key) ? key : key + '';
- };
- /***/ }),
- /***/ 6823:
- /***/ (function(module) {
- var $String = String;
- module.exports = function (argument) {
- try {
- return $String(argument);
- } catch (error) {
- return 'Object';
- }
- };
- /***/ }),
- /***/ 3392:
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
- var uncurryThis = __webpack_require__(9504);
- var id = 0;
- var postfix = Math.random();
- var toString = uncurryThis(1.0.toString);
- module.exports = function (key) {
- return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString(++id + postfix, 36);
- };
- /***/ }),
- /***/ 7040:
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
- /* eslint-disable es/no-symbol -- required for testing */
- var NATIVE_SYMBOL = __webpack_require__(4495);
- module.exports = NATIVE_SYMBOL
- && !Symbol.sham
- && typeof Symbol.iterator == 'symbol';
- /***/ }),
- /***/ 8686:
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
- var DESCRIPTORS = __webpack_require__(3724);
- var fails = __webpack_require__(9039);
- // V8 ~ Chrome 36-
- // https://bugs.chromium.org/p/v8/issues/detail?id=3334
- module.exports = DESCRIPTORS && fails(function () {
- // eslint-disable-next-line es/no-object-defineproperty -- required for testing
- return Object.defineProperty(function () { /* empty */ }, 'prototype', {
- value: 42,
- writable: false
- }).prototype !== 42;
- });
- /***/ }),
- /***/ 8622:
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
- var globalThis = __webpack_require__(4576);
- var isCallable = __webpack_require__(4901);
- var WeakMap = globalThis.WeakMap;
- module.exports = isCallable(WeakMap) && /native code/.test(String(WeakMap));
- /***/ }),
- /***/ 8227:
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
- var globalThis = __webpack_require__(4576);
- var shared = __webpack_require__(5745);
- var hasOwn = __webpack_require__(9297);
- var uid = __webpack_require__(3392);
- var NATIVE_SYMBOL = __webpack_require__(4495);
- var USE_SYMBOL_AS_UID = __webpack_require__(7040);
- var Symbol = globalThis.Symbol;
- var WellKnownSymbolsStore = shared('wks');
- var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol['for'] || Symbol : Symbol && Symbol.withoutSetter || uid;
- module.exports = function (name) {
- if (!hasOwn(WellKnownSymbolsStore, name)) {
- WellKnownSymbolsStore[name] = NATIVE_SYMBOL && hasOwn(Symbol, name)
- ? Symbol[name]
- : createWellKnownSymbol('Symbol.' + name);
- } return WellKnownSymbolsStore[name];
- };
- /***/ }),
- /***/ 4114:
- /***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
- var $ = __webpack_require__(6518);
- var toObject = __webpack_require__(8981);
- var lengthOfArrayLike = __webpack_require__(6198);
- var setArrayLength = __webpack_require__(4527);
- var doesNotExceedSafeInteger = __webpack_require__(6837);
- var fails = __webpack_require__(9039);
- var INCORRECT_TO_LENGTH = fails(function () {
- return [].push.call({ length: 0x100000000 }, 1) !== 4294967297;
- });
- // V8 <= 121 and Safari <= 15.4; FF < 23 throws InternalError
- // https://bugs.chromium.org/p/v8/issues/detail?id=12681
- var properErrorOnNonWritableLength = function () {
- try {
- // eslint-disable-next-line es/no-object-defineproperty -- safe
- Object.defineProperty([], 'length', { writable: false }).push();
- } catch (error) {
- return error instanceof TypeError;
- }
- };
- var FORCED = INCORRECT_TO_LENGTH || !properErrorOnNonWritableLength();
- // `Array.prototype.push` method
- // https://tc39.es/ecma262/#sec-array.prototype.push
- $({ target: 'Array', proto: true, arity: 1, forced: FORCED }, {
- // eslint-disable-next-line no-unused-vars -- required for `.length`
- push: function push(item) {
- var O = toObject(this);
- var len = lengthOfArrayLike(O);
- var argCount = arguments.length;
- doesNotExceedSafeInteger(len + argCount);
- for (var i = 0; i < argCount; i++) {
- O[len] = arguments[i];
- len++;
- }
- setArrayLength(O, len);
- return len;
- }
- });
- /***/ })
- /******/ });
- /************************************************************************/
- /******/ // The module cache
- /******/ var __webpack_module_cache__ = {};
- /******/
- /******/ // The require function
- /******/ function __webpack_require__(moduleId) {
- /******/ // Check if module is in cache
- /******/ var cachedModule = __webpack_module_cache__[moduleId];
- /******/ if (cachedModule !== undefined) {
- /******/ return cachedModule.exports;
- /******/ }
- /******/ // Create a new module (and put it into the cache)
- /******/ var module = __webpack_module_cache__[moduleId] = {
- /******/ // no module.id needed
- /******/ // no module.loaded needed
- /******/ exports: {}
- /******/ };
- /******/
- /******/ // Execute the module function
- /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
- /******/
- /******/ // Return the exports of the module
- /******/ return module.exports;
- /******/ }
- /******/
- /************************************************************************/
- /******/ /* webpack/runtime/compat get default export */
- /******/ !function() {
- /******/ // getDefaultExport function for compatibility with non-harmony modules
- /******/ __webpack_require__.n = function(module) {
- /******/ var getter = module && module.__esModule ?
- /******/ function() { return module['default']; } :
- /******/ function() { return module; };
- /******/ __webpack_require__.d(getter, { a: getter });
- /******/ return getter;
- /******/ };
- /******/ }();
- /******/
- /******/ /* webpack/runtime/define property getters */
- /******/ !function() {
- /******/ // define getter functions for harmony exports
- /******/ __webpack_require__.d = function(exports, definition) {
- /******/ for(var key in definition) {
- /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
- /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
- /******/ }
- /******/ }
- /******/ };
- /******/ }();
- /******/
- /******/ /* webpack/runtime/global */
- /******/ !function() {
- /******/ __webpack_require__.g = (function() {
- /******/ if (typeof globalThis === 'object') return globalThis;
- /******/ try {
- /******/ return this || new Function('return this')();
- /******/ } catch (e) {
- /******/ if (typeof window === 'object') return window;
- /******/ }
- /******/ })();
- /******/ }();
- /******/
- /******/ /* webpack/runtime/hasOwnProperty shorthand */
- /******/ !function() {
- /******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
- /******/ }();
- /******/
- /******/ /* webpack/runtime/make namespace object */
- /******/ !function() {
- /******/ // define __esModule on exports
- /******/ __webpack_require__.r = function(exports) {
- /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
- /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
- /******/ }
- /******/ Object.defineProperty(exports, '__esModule', { value: true });
- /******/ };
- /******/ }();
- /******/
- /******/ /* webpack/runtime/publicPath */
- /******/ !function() {
- /******/ __webpack_require__.p = "";
- /******/ }();
- /******/
- /************************************************************************/
- var __webpack_exports__ = {};
- // ESM COMPAT FLAG
- __webpack_require__.r(__webpack_exports__);
- // EXPORTS
- __webpack_require__.d(__webpack_exports__, {
- Colgroup: function() { return /* reexport */ Colgroup; },
- Column: function() { return /* reexport */ Column; },
- Grid: function() { return /* reexport */ Grid; },
- Table: function() { return /* reexport */ Table; },
- Toolbar: function() { return /* reexport */ Toolbar; },
- VXETable: function() { return /* reexport */ VXETable; },
- VxeColgroup: function() { return /* reexport */ VxeColgroup; },
- VxeColumn: function() { return /* reexport */ VxeColumn; },
- VxeGrid: function() { return /* reexport */ VxeGrid; },
- VxeTable: function() { return /* reexport */ VxeTable; },
- VxeToolbar: function() { return /* reexport */ VxeToolbar; },
- VxeUI: function() { return /* reexport */ core_.VxeUI; },
- _t: function() { return /* reexport */ _t; },
- clipboard: function() { return /* reexport */ clipboard; },
- commands: function() { return /* reexport */ commands; },
- config: function() { return /* reexport */ config; },
- "default": function() { return /* binding */ entry_lib; },
- formats: function() { return /* reexport */ formats; },
- getConfig: function() { return /* reexport */ ui_getConfig; },
- getI18n: function() { return /* reexport */ getI18n; },
- getIcon: function() { return /* reexport */ getIcon; },
- getTheme: function() { return /* reexport */ getTheme; },
- globalEvents: function() { return /* reexport */ globalEvents; },
- globalResize: function() { return /* reexport */ globalResize; },
- install: function() { return /* reexport */ install; },
- interceptor: function() { return /* reexport */ interceptor; },
- log: function() { return /* reexport */ log; },
- menus: function() { return /* reexport */ menus; },
- modal: function() { return /* reexport */ modal; },
- print: function() { return /* reexport */ print; },
- readFile: function() { return /* reexport */ readFile; },
- renderer: function() { return /* reexport */ renderer; },
- saveFile: function() { return /* reexport */ saveFile; },
- setConfig: function() { return /* reexport */ setConfig; },
- setI18n: function() { return /* reexport */ setI18n; },
- setIcon: function() { return /* reexport */ setIcon; },
- setLanguage: function() { return /* reexport */ setLanguage; },
- setTheme: function() { return /* reexport */ setTheme; },
- setup: function() { return /* reexport */ setup; },
- t: function() { return /* reexport */ t; },
- use: function() { return /* reexport */ use; },
- validators: function() { return /* reexport */ validators; },
- version: function() { return /* reexport */ version; }
- });
- // NAMESPACE OBJECT: ./packages/components.ts
- var components_namespaceObject = {};
- __webpack_require__.r(components_namespaceObject);
- __webpack_require__.d(components_namespaceObject, {
- Colgroup: function() { return Colgroup; },
- Column: function() { return Column; },
- Grid: function() { return Grid; },
- Table: function() { return Table; },
- Toolbar: function() { return Toolbar; },
- VXETable: function() { return VXETable; },
- VxeColgroup: function() { return VxeColgroup; },
- VxeColumn: function() { return VxeColumn; },
- VxeGrid: function() { return VxeGrid; },
- VxeTable: function() { return VxeTable; },
- VxeToolbar: function() { return VxeToolbar; },
- VxeUI: function() { return core_.VxeUI; },
- _t: function() { return _t; },
- clipboard: function() { return clipboard; },
- commands: function() { return commands; },
- config: function() { return config; },
- formats: function() { return formats; },
- getConfig: function() { return ui_getConfig; },
- getI18n: function() { return getI18n; },
- getIcon: function() { return getIcon; },
- getTheme: function() { return getTheme; },
- globalEvents: function() { return globalEvents; },
- globalResize: function() { return globalResize; },
- install: function() { return install; },
- interceptor: function() { return interceptor; },
- log: function() { return log; },
- menus: function() { return menus; },
- modal: function() { return modal; },
- print: function() { return print; },
- readFile: function() { return readFile; },
- renderer: function() { return renderer; },
- saveFile: function() { return saveFile; },
- setConfig: function() { return setConfig; },
- setI18n: function() { return setI18n; },
- setIcon: function() { return setIcon; },
- setLanguage: function() { return setLanguage; },
- setTheme: function() { return setTheme; },
- setup: function() { return setup; },
- t: function() { return t; },
- use: function() { return use; },
- validators: function() { return validators; },
- version: function() { return version; }
- });
- ;// CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/setPublicPath.js
- /* eslint-disable no-var */
- // This file is imported into lib/wc client bundles.
- if (typeof window !== 'undefined') {
- var currentScript = window.document.currentScript
- if (false) { var getCurrentScript; }
- var src = currentScript && currentScript.src.match(/(.+\/)[^/]+\.js(\?.*)?$/)
- if (src) {
- __webpack_require__.p = src[1] // eslint-disable-line
- }
- }
- // Indicate to webpack that this file can be concatenated
- /* harmony default export */ var setPublicPath = (null);
- // EXTERNAL MODULE: external {"root":"VxeUI","commonjs":"@vxe-ui/core","commonjs2":"@vxe-ui/core","amd":"@vxe-ui/core"}
- var core_ = __webpack_require__(4345);
- // EXTERNAL MODULE: external {"root":"XEUtils","commonjs":"xe-utils","commonjs2":"xe-utils","amd":"xe-utils"}
- var external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_ = __webpack_require__(8871);
- 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_);
- ;// CONCATENATED MODULE: ./node_modules/dom-zindex/es/index.esm.js
- var winDom = null;
- var bodyEl = null;
- var storeEl = null;
- var storeId = 'z-index-manage';
- var styleEl = null;
- var styleId = 'z-index-style';
- var storeMainKey = 'm';
- var storeSubKey = 's';
- var storeData = {
- m: 1000,
- s: 1000
- };
- function getDocument() {
- if (!winDom) {
- if (typeof document !== 'undefined') {
- winDom = document;
- }
- }
- return winDom;
- }
- function getBody() {
- if (winDom && !bodyEl) {
- bodyEl = winDom.body || winDom.getElementsByTagName('body')[0];
- }
- return bodyEl;
- }
- function getDomMaxZIndex() {
- var max = 0;
- var dom = getDocument();
- if (dom) {
- var body = getBody();
- if (body) {
- var allElem = body.getElementsByTagName('*');
- for (var i = 0; i < allElem.length; i++) {
- var elem = allElem[i];
- if (elem && elem.style && elem.nodeType === 1) {
- var zIndex = elem.style.zIndex;
- if (zIndex && /^\d+$/.test(zIndex)) {
- max = Math.max(max, Number(zIndex));
- }
- }
- }
- }
- }
- return max;
- }
- function getStyle() {
- if (!styleEl) {
- var dom = getDocument();
- if (dom) {
- styleEl = dom.getElementById(styleId);
- if (!styleEl) {
- styleEl = dom.createElement('style');
- styleEl.id = styleId;
- dom.getElementsByTagName('head')[0].appendChild(styleEl);
- }
- }
- }
- return styleEl;
- }
- function updateVar() {
- var styEl = getStyle();
- if (styEl) {
- var prefixes = '--dom-';
- var propKey = '-z-index';
- styEl.innerHTML = ':root{' + prefixes + 'main' + propKey + ':' + getCurrent() + ';' + prefixes + 'sub' + propKey + ':' + getSubCurrent() + '}';
- }
- }
- function getStoreDom() {
- if (!storeEl) {
- var dom = getDocument();
- if (dom) {
- storeEl = dom.getElementById(storeId);
- if (!storeEl) {
- var body = getBody();
- if (body) {
- storeEl = dom.createElement('div');
- storeEl.id = storeId;
- storeEl.style.display = 'none';
- body.appendChild(storeEl);
- setCurrent(storeData.m);
- setSubCurrent(storeData.s);
- }
- }
- }
- }
- return storeEl;
- }
- function createSetHandle(key) {
- return function (value) {
- if (value) {
- value = Number(value);
- storeData[key] = value;
- var el = getStoreDom();
- if (el) {
- if (el.dataset) {
- el.dataset[key] = value + '';
- } else {
- el.setAttribute('data-' + key, value + '');
- }
- }
- }
- updateVar();
- return storeData[key];
- };
- }
- var setCurrent = createSetHandle(storeMainKey);
- function createGetHandle(key, nextMethod) {
- return function getCurrent(currZindex) {
- var zIndex;
- var el = getStoreDom();
- if (el) {
- var domVal = el.dataset ? el.dataset[key] : el.getAttribute('data-' + key);
- if (domVal) {
- zIndex = Number(domVal);
- }
- }
- if (!zIndex) {
- zIndex = storeData[key];
- }
- if (currZindex) {
- if (Number(currZindex) < zIndex) {
- return nextMethod();
- }
- return currZindex;
- }
- return zIndex;
- };
- }
- var getCurrent = createGetHandle(storeMainKey, getNext);
- function getNext() {
- return setCurrent(getCurrent() + 1);
- }
- var setSubCurrent = createSetHandle(storeSubKey);
- var _getSubCurrent = createGetHandle(storeSubKey, getSubNext);
- function getSubCurrent() {
- return getCurrent() + _getSubCurrent();
- }
- function getSubNext() {
- setSubCurrent(_getSubCurrent() + 1);
- return getSubCurrent();
- }
- /**
- * Web common z-index style management
- */
- var DomZIndex = {
- setCurrent: setCurrent,
- getCurrent: getCurrent,
- getNext: getNext,
- setSubCurrent: setSubCurrent,
- getSubCurrent: getSubCurrent,
- getSubNext: getSubNext,
- getMax: getDomMaxZIndex
- };
- updateVar();
- /* harmony default export */ var index_esm = (DomZIndex);
- ;// CONCATENATED MODULE: ./packages/ui/src/utils.ts
- const {
- getConfig
- } = core_.VxeUI;
- function isEnableConf(conf) {
- return conf && conf.enabled !== false;
- }
- function isEmptyValue(cellValue) {
- return cellValue === null || cellValue === undefined || cellValue === '';
- }
- function parseFile(file) {
- const name = file.name;
- const tIndex = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().lastIndexOf(name, '.');
- const type = name.substring(tIndex + 1, name.length).toLowerCase();
- const filename = name.substring(0, tIndex);
- return {
- filename,
- type
- };
- }
- function nextZIndex() {
- return index_esm.getNext();
- }
- function getLastZIndex() {
- return index_esm.getCurrent();
- }
- function hasChildrenList(item) {
- return item && item.children && item.children.length > 0;
- }
- function getFuncText(content, args) {
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(content)) {
- return '';
- }
- const translate = getConfig().translate;
- return `${translate ? translate('' + content, args) : content}`;
- }
- function formatText(value, placeholder) {
- return '' + (isEmptyValue(value) ? placeholder ? getConfig().emptyCell : '' : value);
- }
- /**
- * 判断值为:'' | null | undefined 时都属于空值
- */
- function eqEmptyValue(cellValue) {
- return cellValue === '' || external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(cellValue);
- }
- function getClass(property, params) {
- return property ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(property) ? property(params) : property : '';
- }
- ;// CONCATENATED MODULE: ./packages/ui/index.ts
- const version = "3.19.1";
- core_.VxeUI.version = version;
- core_.VxeUI.tableVersion = version;
- core_.VxeUI.setConfig({
- emptyCell: ' ',
- table: {
- fit: true,
- showHeader: true,
- animat: true,
- delayHover: 250,
- autoResize: true,
- padding: true,
- minHeight: 144,
- // keepSource: false,
- // showOverflow: null,
- // showHeaderOverflow: null,
- // showFooterOverflow: null,
- // resizeInterval: 500,
- // size: null,
- // zIndex: null,
- // stripe: false,
- // border: false,
- // round: false,
- // emptyText: '暂无数据',
- // emptyRender: {
- // name: ''
- // },
- // rowConfig: {
- // keyField: '_X_ROW_KEY' // 行数据的唯一主键字段名
- // },
- resizeConfig: {
- // refreshDelay: 20
- },
- resizableConfig: {
- dragMode: 'auto',
- showDragTip: true,
- isSyncAutoHeight: true,
- isSyncAutoWidth: true,
- minHeight: 18
- },
- radioConfig: {
- // trigger: 'default'
- strict: true
- },
- rowDragConfig: {
- showIcon: true,
- animation: true,
- showGuidesStatus: true,
- showDragTip: true
- },
- columnDragConfig: {
- showIcon: true,
- animation: true,
- showGuidesStatus: true,
- showDragTip: true
- },
- checkboxConfig: {
- // trigger: 'default',
- strict: true
- },
- tooltipConfig: {
- enterable: true
- },
- headerTooltipConfig: {
- enterable: true
- },
- footerTooltipConfig: {
- enterable: true
- },
- validConfig: {
- showMessage: true,
- autoClear: true,
- autoPos: true,
- message: 'inline',
- msgMode: 'single',
- theme: 'beautify'
- },
- columnConfig: {
- autoOptions: {
- isCalcHeader: true,
- isCalcBody: true,
- isCalcFooter: true
- },
- maxFixedSize: 4
- },
- cellConfig: {
- padding: true
- },
- headerCellConfig: {
- height: 'unset'
- },
- footerCellConfig: {
- height: 'unset'
- },
- menuConfig: {
- // visibleMethod () {},
- // transfer: false,
- destroyOnClose: true
- },
- customConfig: {
- // enabled: false,
- allowVisible: true,
- allowResizable: true,
- allowFixed: true,
- allowSort: true,
- showFooter: true,
- placement: 'top-right',
- // storage: false,
- storeOptions: {
- visible: true,
- resizable: true,
- sort: true,
- fixed: true
- // rowGroup: false,
- // aggFunc: false
- },
- // autoAggGroupValues: false,
- // checkMethod () {},
- modalOptions: {
- showMaximize: true,
- mask: true,
- lockView: true,
- resize: true,
- escClosable: true
- },
- drawerOptions: {
- mask: true,
- lockView: true,
- escClosable: true,
- resize: true
- }
- },
- sortConfig: {
- // remote: false,
- // trigger: 'default',
- // orders: ['asc', 'desc', null],
- // sortMethod: null,
- showIcon: true,
- allowClear: true,
- allowBtn: true,
- iconLayout: 'vertical'
- },
- filterConfig: {
- // remote: false,
- // filterMethod: null,
- // isEvery: false,
- // transfer: false,
- destroyOnClose: true,
- multiple: true,
- showIcon: true
- },
- floatingFilterConfig: {
- // enabled: false
- },
- aggregateConfig: {
- padding: true,
- rowField: 'id',
- parentField: '_X_ROW_PARENT_KEY',
- childrenField: '_X_ROW_CHILDREN',
- mapChildrenField: '_X_ROW_CHILD_LIST',
- indent: 20,
- showIcon: true,
- maxGroupSize: 4,
- showAggFuncTitle: true
- },
- treeConfig: {
- padding: true,
- rowField: 'id',
- parentField: 'parentId',
- childrenField: 'children',
- hasChildField: 'hasChild',
- mapChildrenField: '_X_ROW_CHILD',
- indent: 20,
- showIcon: true
- },
- expandConfig: {
- // trigger: 'default',
- showIcon: true,
- mode: 'fixed'
- },
- editConfig: {
- // mode: 'cell',
- showIcon: true,
- showAsterisk: true,
- autoFocus: true
- },
- importConfig: {
- _typeMaps: {
- csv: 1,
- html: 1,
- xml: 1,
- txt: 1
- }
- },
- exportConfig: {
- _typeMaps: {
- csv: 1,
- html: 1,
- xml: 1,
- txt: 1
- }
- },
- printConfig: {},
- mouseConfig: {
- extension: true
- },
- keyboardConfig: {
- isAll: true,
- isEsc: true
- },
- areaConfig: {
- autoClear: true,
- selectCellByHeader: true,
- selectCellByBody: true,
- extendDirection: {
- top: true,
- left: true,
- bottom: true,
- right: true
- }
- },
- clipConfig: {
- isCopy: true,
- isCut: true,
- isPaste: true
- },
- fnrConfig: {
- isFind: true,
- isReplace: true
- },
- virtualXConfig: {
- // enabled: false,
- gt: 24,
- preSize: 0,
- oSize: 0
- },
- virtualYConfig: {
- // enabled: false,
- // mode: 'wheel',
- gt: 100,
- preSize: 1,
- oSize: 0
- },
- scrollbarConfig: {
- // width: 14,
- // height: 14,
- x: {
- // position: 'bottom',
- visible: true
- },
- y: {
- // position: 'right',
- visible: true
- }
- }
- },
- grid: {
- // size: null,
- // zoomConfig: {
- // escRestore: true
- // },
- formConfig: {
- enabled: true
- },
- pagerConfig: {
- enabled: true
- // perfect: false
- },
- toolbarConfig: {
- enabled: true
- // perfect: false
- },
- proxyConfig: {
- enabled: true,
- autoLoad: true,
- showLoading: true,
- showResponseMsg: true,
- showActionMsg: true,
- response: {
- list: null,
- result: 'result',
- total: 'page.total',
- message: 'message'
- }
- // beforeItem: null,
- // beforeColumn: null,
- // beforeQuery: null,
- // afterQuery: null,
- // beforeDelete: null,
- // afterDelete: null,
- // beforeSave: null,
- // afterSave: null
- }
- },
- toolbar: {
- // size: null,
- // import: {
- // mode: 'covering'
- // },
- // export: {
- // types: ['csv', 'html', 'xml', 'txt']
- // },
- // buttons: []
- },
- gantt: {}
- });
- const iconPrefix = 'vxe-table-icon-';
- core_.VxeUI.setIcon({
- // table
- TABLE_SORT_ASC: iconPrefix + 'caret-up',
- TABLE_SORT_DESC: iconPrefix + 'caret-down',
- TABLE_FILTER_NONE: iconPrefix + 'funnel',
- TABLE_FILTER_MATCH: iconPrefix + 'funnel',
- TABLE_EDIT: iconPrefix + 'edit',
- TABLE_TITLE_PREFIX: iconPrefix + 'question-circle-fill',
- TABLE_TITLE_SUFFIX: iconPrefix + 'question-circle-fill',
- TABLE_TREE_LOADED: iconPrefix + 'spinner roll',
- TABLE_TREE_OPEN: iconPrefix + 'caret-right rotate90',
- TABLE_TREE_CLOSE: iconPrefix + 'caret-right',
- TABLE_EXPAND_LOADED: iconPrefix + 'spinner roll',
- TABLE_EXPAND_OPEN: iconPrefix + 'arrow-right rotate90',
- TABLE_EXPAND_CLOSE: iconPrefix + 'arrow-right',
- TABLE_CHECKBOX_CHECKED: iconPrefix + 'checkbox-checked-fill',
- TABLE_CHECKBOX_UNCHECKED: iconPrefix + 'checkbox-unchecked',
- TABLE_CHECKBOX_INDETERMINATE: iconPrefix + 'checkbox-indeterminate-fill',
- TABLE_CHECKBOX_DISABLED_UNCHECKED: iconPrefix + 'checkbox-unchecked-fill',
- TABLE_RADIO_CHECKED: iconPrefix + 'radio-checked-fill',
- TABLE_RADIO_UNCHECKED: iconPrefix + 'radio-unchecked',
- TABLE_RADIO_DISABLED_UNCHECKED: iconPrefix + 'radio-unchecked-fill',
- TABLE_CUSTOM_SORT: iconPrefix + 'drag-handle',
- TABLE_MENU_OPTIONS: iconPrefix + 'arrow-right',
- TABLE_DRAG_ROW: iconPrefix + 'drag-handle',
- TABLE_DRAG_COLUMN: iconPrefix + 'drag-handle',
- TABLE_DRAG_STATUS_ROW: iconPrefix + 'sort',
- TABLE_DRAG_STATUS_SUB_ROW: iconPrefix + 'add-sub',
- TABLE_DRAG_STATUS_AGG_GROUP: iconPrefix + 'grouping',
- TABLE_DRAG_STATUS_AGG_VALUES: iconPrefix + 'values',
- TABLE_DRAG_STATUS_COLUMN: iconPrefix + 'swap',
- TABLE_DRAG_DISABLED: iconPrefix + 'no-drop',
- TABLE_ROW_GROUP_OPEN: iconPrefix + 'arrow-right rotate90',
- TABLE_ROW_GROUP_CLOSE: iconPrefix + 'arrow-right',
- TABLE_AGGREGATE_GROUPING: iconPrefix + 'grouping',
- TABLE_AGGREGATE_VALUES: iconPrefix + 'values',
- TABLE_AGGREGATE_SORT: iconPrefix + 'drag-handle',
- TABLE_AGGREGATE_DELETE: iconPrefix + 'close',
- // toolbar
- TOOLBAR_TOOLS_REFRESH: iconPrefix + 'repeat',
- TOOLBAR_TOOLS_REFRESH_LOADING: iconPrefix + 'repeat roll',
- TOOLBAR_TOOLS_IMPORT: iconPrefix + 'upload',
- TOOLBAR_TOOLS_EXPORT: iconPrefix + 'download',
- TOOLBAR_TOOLS_PRINT: iconPrefix + 'print',
- TOOLBAR_TOOLS_FULLSCREEN: iconPrefix + 'fullscreen',
- TOOLBAR_TOOLS_MINIMIZE: iconPrefix + 'minimize',
- TOOLBAR_TOOLS_CUSTOM: iconPrefix + 'custom-column',
- TOOLBAR_TOOLS_FIXED_LEFT: iconPrefix + 'fixed-left',
- TOOLBAR_TOOLS_FIXED_LEFT_ACTIVE: iconPrefix + 'fixed-left-fill',
- TOOLBAR_TOOLS_FIXED_RIGHT: iconPrefix + 'fixed-right',
- TOOLBAR_TOOLS_FIXED_RIGHT_ACTIVE: iconPrefix + 'fixed-right-fill'
- });
- const setTheme = core_.VxeUI.setTheme;
- const getTheme = core_.VxeUI.getTheme;
- const setConfig = core_.VxeUI.setConfig;
- const ui_getConfig = core_.VxeUI.getConfig;
- const setIcon = core_.VxeUI.setIcon;
- const getIcon = core_.VxeUI.getIcon;
- const setLanguage = core_.VxeUI.setLanguage;
- const setI18n = core_.VxeUI.setI18n;
- const getI18n = core_.VxeUI.getI18n;
- const globalEvents = core_.VxeUI.globalEvents;
- const globalResize = core_.VxeUI.globalResize;
- const renderer = core_.VxeUI.renderer;
- const validators = core_.VxeUI.validators;
- const menus = core_.VxeUI.menus;
- const formats = core_.VxeUI.formats;
- const commands = core_.VxeUI.commands;
- const interceptor = core_.VxeUI.interceptor;
- const clipboard = core_.VxeUI.clipboard;
- const log = core_.VxeUI.log;
- const use = core_.VxeUI.use;
- /**
- * 已废弃
- * @deprecated
- */
- const setup = options => {
- return core_.VxeUI.setConfig(options);
- };
- core_.VxeUI.setup = setup;
- /**
- * 已废弃
- * @deprecated
- */
- const config = options => {
- return core_.VxeUI.setConfig(options);
- };
- core_.VxeUI.config = config;
- /**
- * 已废弃
- * @deprecated
- */
- const t = (key, args) => {
- return core_.VxeUI.getI18n(key, args);
- };
- core_.VxeUI.t = t;
- /**
- * 已废弃
- * @deprecated
- */
- const _t = (content, args) => {
- return getFuncText(content, args);
- };
- core_.VxeUI._t = _t;
- /**
- * 已废弃,兼容老版本
- * @deprecated
- */
- const VXETable = core_.VxeUI;
- /**
- * 已废弃,兼容老版本
- * @deprecated
- */
- const saveFile = options => {
- return core_.VxeUI.saveFile(options);
- };
- /**
- * 已废弃,兼容老版本
- * @deprecated
- */
- const readFile = options => {
- return core_.VxeUI.readFile(options);
- };
- /**
- * 已废弃,兼容老版本
- * @deprecated
- */
- const print = options => {
- return core_.VxeUI.print(options);
- };
- /**
- * 已废弃,兼容老版本
- * @deprecated
- */
- const modal = {
- /**
- * 已废弃,兼容老版本
- * @deprecated
- */
- get(id) {
- return core_.VxeUI.modal.get(id);
- },
- /**
- * 已废弃,兼容老版本
- * @deprecated
- */
- close(id) {
- return core_.VxeUI.modal.close(id);
- },
- /**
- * 已废弃,兼容老版本
- * @deprecated
- */
- open(options) {
- return core_.VxeUI.modal.open(options);
- },
- /**
- * 已废弃,兼容老版本
- * @deprecated
- */
- alert(content, title, options) {
- return core_.VxeUI.modal.alert(content, title, options);
- },
- /**
- * 已废弃,兼容老版本
- * @deprecated
- */
- confirm(content, title, options) {
- return core_.VxeUI.modal.confirm(content, title, options);
- },
- /**
- * 已废弃,兼容老版本
- * @deprecated
- */
- message(content, options) {
- return core_.VxeUI.modal.message(content, options);
- },
- /**
- * 已废弃,兼容老版本
- * @deprecated
- */
- notification(content, title, options) {
- return core_.VxeUI.modal.notification(content, title, options);
- }
- };
- /* harmony default export */ var ui = ((/* unused pure expression or super */ null && (VxeUI)));
- // EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.push.js
- var es_array_push = __webpack_require__(4114);
- ;// CONCATENATED MODULE: ./packages/ui/src/dom.ts
- const reClsMap = {};
- let tpImgEl;
- function initTpImg() {
- if (!tpImgEl) {
- tpImgEl = new Image();
- tpImgEl.src = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=';
- }
- return tpImgEl;
- }
- function getTpImg() {
- if (!tpImgEl) {
- return initTpImg();
- }
- return tpImgEl;
- }
- function getPropClass(property, params) {
- return property ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(property) ? property(params) : property : '';
- }
- function getClsRE(cls) {
- if (!reClsMap[cls]) {
- reClsMap[cls] = new RegExp(`(?:^|\\s)${cls}(?!\\S)`, 'g');
- }
- return reClsMap[cls];
- }
- function getNodeOffset(elem, container, rest) {
- if (elem) {
- const parentElem = elem.parentNode;
- rest.top += elem.offsetTop;
- rest.left += elem.offsetLeft;
- if (parentElem && parentElem !== document.documentElement && parentElem !== document.body) {
- rest.top -= parentElem.scrollTop;
- rest.left -= parentElem.scrollLeft;
- }
- if (container && (elem === container || elem.offsetParent === container) ? 0 : elem.offsetParent) {
- return getNodeOffset(elem.offsetParent, container, rest);
- }
- }
- return rest;
- }
- function isPx(val) {
- return val && /^\d+(px)?$/.test(val);
- }
- function isScale(val) {
- return val && /^\d+%$/.test(val);
- }
- function hasClass(elem, cls) {
- return !!(elem && elem.className && elem.className.match && elem.className.match(getClsRE(cls)));
- }
- function removeClass(elem, cls) {
- if (elem && hasClass(elem, cls)) {
- elem.className = elem.className.replace(getClsRE(cls), '');
- }
- }
- function addClass(elem, cls) {
- if (elem && !hasClass(elem, cls)) {
- removeClass(elem, cls);
- elem.className = `${elem.className} ${cls}`;
- }
- }
- function hasControlKey(evnt) {
- return evnt.ctrlKey || evnt.metaKey;
- }
- function toCssUnit(val, unit = 'px') {
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(val) || /^\d+$/.test(`${val}`)) {
- return `${val}${unit}`;
- }
- return `${val || ''}`;
- }
- function queryElement(elem, selector) {
- if (elem) {
- return elem.querySelector(selector);
- }
- return null;
- }
- function getDomNode() {
- const documentElement = document.documentElement;
- const bodyElem = document.body;
- return {
- scrollTop: documentElement.scrollTop || bodyElem.scrollTop,
- scrollLeft: documentElement.scrollLeft || bodyElem.scrollLeft,
- visibleHeight: documentElement.clientHeight || bodyElem.clientHeight,
- visibleWidth: documentElement.clientWidth || bodyElem.clientWidth
- };
- }
- function getOffsetHeight(elem) {
- return elem ? elem.offsetHeight : 0;
- }
- function getPaddingTopBottomSize(elem) {
- if (elem) {
- const computedStyle = getComputedStyle(elem);
- const paddingTop = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(computedStyle.paddingTop);
- const paddingBottom = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(computedStyle.paddingBottom);
- return paddingTop + paddingBottom;
- }
- return 0;
- }
- function setScrollTop(elem, scrollTop) {
- if (elem) {
- elem.scrollTop = scrollTop;
- }
- }
- function setScrollLeft(elem, scrollLeft) {
- if (elem) {
- elem.scrollLeft = scrollLeft;
- }
- }
- // export function setScrollLeftAndTop (elem: HTMLElement | null, scrollLeft: number, scrollTop: number) {
- // if (elem) {
- // elem.scrollLeft = scrollLeft
- // elem.scrollTop = scrollTop
- // }
- // }
- function updateCellTitle(overflowElem, column) {
- const content = column.type === 'html' ? overflowElem.innerText : overflowElem.textContent;
- if (overflowElem.getAttribute('title') !== content) {
- overflowElem.setAttribute('title', content);
- }
- }
- /**
- * 检查触发源是否属于目标节点
- */
- function getEventTargetNode(evnt, container, queryCls, queryMethod) {
- let targetElem;
- let target = evnt.target.shadowRoot && evnt.composed ? evnt.composedPath()[0] || evnt.target : evnt.target;
- while (target && target.nodeType && target !== document) {
- if (queryCls && hasClass(target, queryCls) && (!queryMethod || queryMethod(target))) {
- targetElem = target;
- } else if (target === container) {
- return {
- flag: queryCls ? !!targetElem : true,
- container,
- targetElem: targetElem
- };
- }
- target = target.parentNode;
- }
- return {
- flag: false
- };
- }
- /**
- * 获取元素相对于 document 的位置
- */
- function getOffsetPos(elem, container) {
- return getNodeOffset(elem, container, {
- left: 0,
- top: 0
- });
- }
- function getAbsolutePos(elem) {
- const bounding = elem.getBoundingClientRect();
- const boundingTop = bounding.top;
- const boundingLeft = bounding.left;
- const {
- scrollTop,
- scrollLeft,
- visibleHeight,
- visibleWidth
- } = getDomNode();
- return {
- boundingTop,
- top: scrollTop + boundingTop,
- boundingLeft,
- left: scrollLeft + boundingLeft,
- visibleHeight,
- visibleWidth
- };
- }
- const scrollIntoViewIfNeeded = 'scrollIntoViewIfNeeded';
- const scrollIntoView = 'scrollIntoView';
- function scrollToView(elem) {
- if (elem) {
- if (elem[scrollIntoViewIfNeeded]) {
- elem[scrollIntoViewIfNeeded]();
- } else if (elem[scrollIntoView]) {
- elem[scrollIntoView]();
- }
- }
- }
- function triggerEvent(targetElem, type) {
- if (targetElem) {
- targetElem.dispatchEvent(new Event(type));
- }
- }
- function isNodeElement(elem) {
- return elem && elem.nodeType === 1;
- }
- ;// CONCATENATED MODULE: ./packages/ui/src/log.ts
- const {
- log: log_log
- } = core_.VxeUI;
- const log_version = `table v${"3.19.1"}`;
- const warnLog = log_log.create('warn', log_version);
- const errLog = log_log.create('error', log_version);
- ;// CONCATENATED MODULE: ./packages/table/src/columnInfo.ts
- const {
- getI18n: columnInfo_getI18n,
- formats: columnInfo_formats,
- renderer: columnInfo_renderer
- } = core_.VxeUI;
- class ColumnInfo {
- /* eslint-disable @typescript-eslint/no-use-before-define */
- constructor($xeTable, _vm, {
- renderHeader,
- renderCell,
- renderFooter,
- renderData
- } = {}) {
- const tableProps = $xeTable;
- const $xeGrid = $xeTable.$xeGrid;
- const $xeGantt = $xeTable.$xeGantt;
- const $xeGGWrapper = $xeGrid || $xeGantt;
- const {
- field,
- editRender,
- filterRender
- } = _vm;
- const colId = _vm.colId || external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().uniqueId('col_');
- const proxyOpts = $xeGrid ? $xeGrid.computeProxyOpts : null;
- const formatter = _vm.formatter;
- const visible = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isBoolean(_vm.visible) ? _vm.visible : true;
- const flCompConf = isEnableConf(filterRender) ? columnInfo_renderer.get(filterRender.name) : null;
- const ctFilterOptions = flCompConf ? flCompConf.createTableFilterOptions : null;
- const filters = toFilters(_vm.filters, colId);
- const types = ['seq', 'checkbox', 'radio', 'expand', 'html'];
- if (_vm.type && types.indexOf(_vm.type) === -1) {
- warnLog('vxe.error.errProp', [`type=${_vm.type}`, types.join(', ')]);
- }
- 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)) {
- warnLog('vxe.error.errProp', [`column.cell-render=${_vm.cellRender}`, 'column.cell-render={}']);
- }
- 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)) {
- warnLog('vxe.error.errProp', [`column.edit-render=${_vm.editRender}`, 'column.edit-render={}']);
- }
- if (_vm.type === 'expand') {
- const {
- treeConfig
- } = tableProps;
- if (treeConfig && ($xeTable.treeOpts.showLine || $xeTable.treeOpts.line)) {
- errLog('vxe.error.errConflicts', ['tree-config.line', 'column.type=expand']);
- }
- }
- if (_vm.remoteSort) {
- warnLog('vxe.error.delProp', ['column.remote-sort', 'sort-config.remote']);
- }
- if (_vm.sortMethod) {
- warnLog('vxe.error.delProp', ['column.sort-method', 'sort-config.sortMethod']);
- }
- if (formatter) {
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(formatter)) {
- const gFormatOpts = columnInfo_formats.get(formatter) || (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default())[formatter];
- if (!gFormatOpts || !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(gFormatOpts.tableCellFormatMethod || gFormatOpts.cellFormatMethod)) {
- errLog('vxe.error.notFormats', [formatter]);
- }
- } else if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(formatter)) {
- const gFormatOpts = columnInfo_formats.get(formatter[0]) || (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default())[formatter[0]];
- if (!gFormatOpts || !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(gFormatOpts.tableCellFormatMethod || gFormatOpts.cellFormatMethod)) {
- errLog('vxe.error.notFormats', [formatter[0]]);
- }
- }
- }
- if (_vm.aggFunc) {
- if (!$xeTable.handlePivotTableAggregateData && _vm.aggFunc !== true) {
- errLog('vxe.error.errProp', [`column.agg-func=${_vm.aggFunc}`, 'column.agg-func=true']);
- }
- }
- if (field && editRender) {
- if (editRender.startField && `${editRender.startField}`.indexOf(field) >= 0) {
- errLog('vxe.error.modelConflicts', [`field=${field}`, `edit-render.startField=${editRender.startField}`]);
- }
- if (editRender.endField && `${editRender.endField}`.indexOf(field) >= 0) {
- errLog('vxe.error.modelConflicts', [`field=${field}`, `edit-render.endField=${editRender.endField}`]);
- }
- }
- Object.assign(this, {
- // 基本属性
- type: _vm.type,
- property: _vm.field,
- field: field,
- title: _vm.title,
- width: _vm.width,
- minWidth: _vm.minWidth,
- maxWidth: _vm.maxWidth,
- resizable: _vm.resizable,
- fixed: _vm.fixed,
- align: _vm.align,
- headerAlign: _vm.headerAlign,
- footerAlign: _vm.footerAlign,
- showOverflow: _vm.showOverflow,
- showHeaderOverflow: _vm.showHeaderOverflow,
- showFooterOverflow: _vm.showFooterOverflow,
- className: _vm.className,
- headerClassName: _vm.headerClassName,
- footerClassName: _vm.footerClassName,
- formatter,
- headerFormatter: _vm.headerFormatter,
- footerFormatter: _vm.footerFormatter,
- padding: _vm.padding,
- verticalAlign: _vm.verticalAlign,
- sortable: _vm.sortable,
- sortBy: _vm.sortBy,
- sortType: _vm.sortType,
- sortMethod: _vm.sortMethod,
- remoteSort: _vm.remoteSort,
- filters: filters,
- filterMultiple: external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isBoolean(_vm.filterMultiple) ? _vm.filterMultiple : true,
- filterMethod: _vm.filterMethod,
- filterResetMethod: _vm.filterResetMethod,
- filterRecoverMethod: _vm.filterRecoverMethod,
- filterRender: filterRender,
- floatingFilters: _vm.floatingFilters,
- rowGroupNode: _vm.rowGroupNode,
- treeNode: _vm.treeNode,
- dragSort: _vm.dragSort,
- rowResize: _vm.rowResize,
- cellType: _vm.cellType,
- cellRender: _vm.cellRender,
- editRender: editRender,
- contentRender: _vm.contentRender,
- headerExportMethod: _vm.headerExportMethod,
- exportMethod: _vm.exportMethod,
- footerExportMethod: _vm.footerExportMethod,
- titleHelp: _vm.titleHelp,
- titlePrefix: _vm.titlePrefix,
- titleSuffix: _vm.titleSuffix,
- aggFunc: _vm.aggFunc,
- // 自定义参数
- params: _vm.params,
- // 渲染属性
- id: colId,
- parentId: null,
- visible,
- // 内部属性(一旦被使用,将导致不可升级版本)
- defaultParentId: null,
- halfVisible: false,
- defaultVisible: visible,
- defaultFixed: _vm.fixed,
- defaultAggGroup: _vm.aggGroup,
- defaultAggFunc: _vm.aggFunc,
- checked: false,
- halfChecked: false,
- disabled: false,
- // 分组层级
- level: 1,
- // 跨行
- rowSpan: 1,
- // 跨列
- colSpan: 1,
- // 数据排序
- order: null,
- sortTime: 0,
- // 列排序
- sortNumber: 0,
- renderSortNumber: 0,
- renderAggFn: '',
- renderFixed: '',
- renderVisible: false,
- renderWidth: 0,
- renderHeight: 0,
- renderResizeWidth: 0,
- renderAutoWidth: 0,
- resizeWidth: 0,
- renderLeft: 0,
- renderArgs: [],
- model: {},
- renderHeader: renderHeader || _vm.renderHeader,
- renderCell: renderCell || _vm.renderCell,
- renderFooter: renderFooter || _vm.renderFooter,
- renderData,
- // 单元格插槽,只对 grid 有效
- slots: _vm.slots
- });
- if (ctFilterOptions && (!filters || !filters.length)) {
- this.filters = toFilters(ctFilterOptions({
- $table: $xeTable,
- column: this
- }), colId);
- }
- if ($xeGGWrapper) {
- if (proxyOpts && proxyOpts.beforeColumn) {
- proxyOpts.beforeColumn({
- $table: $xeTable,
- $grid: $xeGrid,
- $gantt: $xeGantt,
- column: this
- });
- }
- }
- }
- getTitle() {
- return getFuncText(this.title || (this.type === 'seq' ? columnInfo_getI18n('vxe.table.seqTitle') : ''));
- }
- getKey() {
- const {
- type
- } = this;
- return this.field || (type ? `type=${type}` : null);
- }
- update(name, value) {
- // 不支持直接修改的属性
- if (name !== 'filters') {
- if (name === 'field') {
- // 兼容旧属性
- this.property = value;
- }
- this[name] = value;
- }
- }
- }
- ;// CONCATENATED MODULE: ./packages/table/src/util.ts
- function createInternalData() {
- return {
- tZindex: 0,
- currKeyField: '',
- isCurrDeepKey: false,
- elemStore: {},
- // 存放横向 X 虚拟滚动相关的信息
- scrollXStore: {
- preloadSize: 0,
- offsetSize: 0,
- visibleSize: 0,
- visibleStartIndex: 0,
- visibleEndIndex: 0,
- startIndex: 0,
- endIndex: 0
- },
- // 存放纵向 Y 虚拟滚动相关信息
- scrollYStore: {
- preloadSize: 0,
- offsetSize: 0,
- visibleSize: 0,
- visibleStartIndex: 0,
- visibleEndIndex: 0,
- startIndex: 0,
- endIndex: 0
- },
- // 表格宽度
- tableWidth: 0,
- // 表格高度
- tableHeight: 0,
- customHeight: 0,
- customMinHeight: 0,
- customMaxHeight: 0,
- // 当前 hover 行
- hoverRow: null,
- // 最后滚动位置
- lastScrollLeft: 0,
- lastScrollTop: 0,
- // 单选框属性,已选中保留的行
- radioReserveRow: null,
- // 复选框属性,已选中保留的行集合
- checkboxReserveRowMap: {},
- // 行数据,已展开保留的行集合
- rowExpandedReserveRowMap: {},
- // 树结构数据,已展开保留的行集合
- treeExpandedReserveRowMap: {},
- // 树结构数据,不确定状态的集合
- treeIndeterminateRowMaps: {},
- // 列表完整数据、条件处理后
- tableFullData: [],
- afterFullData: [],
- afterTreeFullData: [],
- afterGroupFullData: [],
- // 列表条件处理后数据集合
- afterFullRowMaps: {},
- // 树结构完整数据、条件处理后
- tableFullTreeData: [],
- // 行分组全量数据、条件处理后
- tableFullGroupData: [],
- tableSynchData: [],
- tableSourceData: [],
- // 收集的列配置(带分组)
- collectColumn: [],
- // 完整所有列(不带分组)
- tableFullColumn: [],
- // 渲染所有列
- visibleColumn: [],
- // 全量数据集(包括当前和已删除)
- fullAllDataRowIdData: {},
- // 数据集(仅当前)
- fullDataRowIdData: {},
- // 数据集(仅可视)
- visibleDataRowIdData: {},
- // 渲染中缓存数据
- sourceDataRowIdData: {},
- fullColumnIdData: {},
- fullColumnFieldData: {},
- // 合并表头单元格的数据
- mergeHeaderList: [],
- mergeHeaderMaps: {},
- // 已合并单元格数据集合
- mergeHeaderCellMaps: {},
- // 合并单元格的数据
- mergeBodyList: [],
- mergeBodyMaps: {},
- // 已合并单元格数据集合
- mergeBodyCellMaps: {},
- // 合并表尾的数据
- mergeFooterList: [],
- mergeFooterMaps: {},
- // 已合并表尾数据集合
- mergeFooterCellMaps: {},
- // 已展开的行集合
- rowExpandedMaps: {},
- // 懒加载中的展开行的集合
- rowExpandLazyLoadedMaps: {},
- // 已展开的分组行
- rowGroupExpandedMaps: {},
- // 已展开树节点集合
- treeExpandedMaps: {},
- // 懒加载中的树节点的集合
- treeExpandLazyLoadedMaps: {},
- // 复选框属性,已选中的行集合
- selectCheckboxMaps: {},
- // 已标记的对象集
- pendingRowMaps: {},
- // 已新增的临时行
- insertRowMaps: {},
- // 已删除行
- removeRowMaps: {},
- cvCacheMaps: {},
- // 表头高度
- tHeaderHeight: 0,
- // 表体高度
- tBodyHeight: 0,
- // 表尾高度
- tFooterHeight: 0,
- teleportToWrapperElem: null,
- popupToWrapperElem: null,
- inited: false,
- tooltipTimeout: null,
- initStatus: false,
- isActivated: false
- };
- }
- const getAllConvertColumns = (columns, parentColumn) => {
- const result = [];
- columns.forEach(column => {
- column.parentId = parentColumn ? parentColumn.id : null;
- if (column.visible) {
- if (column.children && column.children.length && column.children.some(column => column.visible)) {
- result.push(column);
- result.push(...getAllConvertColumns(column.children, column));
- } else {
- result.push(column);
- }
- }
- });
- return result;
- };
- const convertHeaderColumnToRows = originColumns => {
- let maxLevel = 1;
- const traverse = (column, parent) => {
- if (parent) {
- column.level = parent.level + 1;
- if (maxLevel < column.level) {
- maxLevel = column.level;
- }
- }
- if (column.children && column.children.length && column.children.some(column => column.visible)) {
- let colSpan = 0;
- column.children.forEach(subColumn => {
- if (subColumn.visible) {
- traverse(subColumn, column);
- colSpan += subColumn.colSpan;
- }
- });
- column.colSpan = colSpan;
- } else {
- column.colSpan = 1;
- }
- };
- originColumns.forEach(column => {
- column.level = 1;
- traverse(column);
- });
- const rows = [];
- for (let i = 0; i < maxLevel; i++) {
- rows.push([]);
- }
- const allColumns = getAllConvertColumns(originColumns);
- allColumns.forEach(column => {
- if (column.children && column.children.length && column.children.some(column => column.visible)) {
- column.rowSpan = 1;
- } else {
- column.rowSpan = maxLevel - column.level + 1;
- }
- rows[column.level - 1].push(column);
- });
- return rows;
- };
- function convertHeaderToGridRows(spanColumns) {
- const rSize = spanColumns.length;
- const cSize = spanColumns[0].reduce((sum, cell) => sum + cell.colSpan, 0);
- const occupiedRows = [];
- const fullRows = [];
- for (let rIndex = 0; rIndex < rSize; rIndex++) {
- const oCols = [];
- const dCols = [];
- for (let cIndex = 0; cIndex < cSize; cIndex++) {
- oCols.push(false);
- dCols.push('');
- }
- occupiedRows.push(oCols);
- fullRows.push(dCols);
- }
- for (let rIndex = 0; rIndex < rSize; rIndex++) {
- let currColIndex = 0;
- for (const column of spanColumns[rIndex]) {
- const {
- colSpan,
- rowSpan
- } = column;
- let startColIndex = -1;
- for (let ccIndex = currColIndex; ccIndex <= cSize - colSpan; ccIndex++) {
- let oFlag = true;
- for (let csIndex = 0; csIndex < colSpan; csIndex++) {
- if (occupiedRows[rIndex][ccIndex + csIndex]) {
- oFlag = false;
- break;
- }
- }
- if (oFlag) {
- startColIndex = ccIndex;
- break;
- }
- }
- if (startColIndex === -1) {
- for (let j = 0; j <= cSize - colSpan; j++) {
- let oFlag = true;
- for (let k = 0; k < colSpan; k++) {
- if (occupiedRows[rIndex][j + k]) {
- oFlag = false;
- break;
- }
- }
- if (oFlag) {
- startColIndex = j;
- break;
- }
- }
- if (startColIndex === -1) {
- // error
- break;
- }
- }
- for (let srIndex = rIndex; srIndex < rIndex + rowSpan; srIndex++) {
- for (let scIndex = startColIndex; scIndex < startColIndex + colSpan; scIndex++) {
- occupiedRows[srIndex][scIndex] = true;
- fullRows[srIndex][scIndex] = column;
- }
- }
- currColIndex = startColIndex + colSpan;
- }
- }
- return fullRows;
- }
- function restoreScrollLocation($xeTable, scrollLeft, scrollTop) {
- const internalData = $xeTable;
- if (scrollLeft || scrollTop) {
- internalData.intoRunScroll = false;
- internalData.inVirtualScroll = false;
- internalData.inWheelScroll = false;
- internalData.inHeaderScroll = false;
- internalData.inBodyScroll = false;
- internalData.inFooterScroll = false;
- internalData.scrollRenderType = '';
- // 还原滚动状态
- return $xeTable.scrollTo(scrollLeft, scrollTop);
- }
- return $xeTable.clearScroll();
- }
- function toTreePathSeq(path) {
- return path.map((num, i) => i % 2 === 0 ? Number(num) + 1 : '.').join('');
- }
- /**
- * 生成行的唯一主键
- */
- function getRowUniqueId() {
- return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().uniqueId('row_');
- }
- function hasDeepKey(rowKey) {
- return rowKey.indexOf('.') > -1;
- }
- // 行主键 key
- function getRowkey($xeTable) {
- const internalData = $xeTable;
- const {
- currKeyField
- } = internalData;
- return currKeyField;
- }
- // 行主键 value
- function getRowid($xeTable, row) {
- const internalData = $xeTable;
- const {
- isCurrDeepKey,
- currKeyField
- } = internalData;
- return row ? encodeRowid((isCurrDeepKey ? getDeepRowIdByKey : getFastRowIdByKey)(row, currKeyField)) : '';
- }
- function createHandleUpdateRowId($xeTable) {
- const internalData = $xeTable;
- const {
- isCurrDeepKey,
- currKeyField
- } = internalData;
- const updateRId = isCurrDeepKey ? updateDeepRowKey : updateFastRowKey;
- return {
- rowKey: currKeyField,
- handleUpdateRowId(row) {
- return row ? updateRId(row, currKeyField) : '';
- }
- };
- }
- function createHandleGetRowId($xeTable) {
- const internalData = $xeTable;
- const {
- isCurrDeepKey,
- currKeyField
- } = internalData;
- const getRId = isCurrDeepKey ? getDeepRowIdByKey : getFastRowIdByKey;
- return {
- rowKey: currKeyField,
- handleGetRowId(row) {
- return row ? encodeRowid(getRId(row, currKeyField)) : '';
- }
- };
- }
- // 编码行主键
- function encodeRowid(rowVal) {
- return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(rowVal) ? '' : encodeURIComponent(rowVal);
- }
- function getDeepRowIdByKey(row, rowKey) {
- return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, rowKey);
- }
- function updateDeepRowKey(row, rowKey) {
- let rowid = encodeRowid(getDeepRowIdByKey(row, rowKey));
- if (eqEmptyValue(rowid)) {
- rowid = getRowUniqueId();
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(row, rowKey, rowid);
- }
- return rowid;
- }
- function getFastRowIdByKey(row, rowKey) {
- return row[rowKey];
- }
- function updateFastRowKey(row, rowKey) {
- let rowid = encodeRowid(getFastRowIdByKey(row, rowKey));
- if (eqEmptyValue(rowid)) {
- rowid = getRowUniqueId();
- row[rowKey] = rowid;
- }
- return rowid;
- }
- function getPaddingLeftRightSize(elem) {
- if (elem) {
- const computedStyle = getComputedStyle(elem);
- const paddingLeft = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(computedStyle.paddingLeft);
- const paddingRight = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(computedStyle.paddingRight);
- return paddingLeft + paddingRight;
- }
- return 0;
- }
- function getElementMarginAndWidth(elem) {
- if (elem) {
- const computedStyle = getComputedStyle(elem);
- const marginLeft = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(computedStyle.marginLeft);
- const marginRight = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(computedStyle.marginRight);
- return elem.offsetWidth + marginLeft + marginRight;
- }
- return 0;
- }
- function getCalcHeight(height) {
- if (height === 'unset') {
- return 0;
- }
- return height || 0;
- }
- function handleFieldOrColumn($xeTable, fieldOrColumn) {
- if (fieldOrColumn) {
- 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;
- }
- return null;
- }
- function handleRowidOrRow($xeTable, rowidOrRow) {
- if (rowidOrRow) {
- 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);
- return $xeTable.getRowById(rowid);
- }
- return null;
- }
- function getCellRestHeight(rowRest, cellOpts, rowOpts, defaultRowHeight) {
- return rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight;
- }
- // 组装列配置
- function assembleColumn(_vm) {
- const $xeTable = _vm.$xeTable;
- const reactData = $xeTable;
- const {
- staticColumns
- } = reactData;
- const {
- $el,
- $xeColumn,
- columnConfig
- } = _vm;
- const groupConfig = $xeColumn ? $xeColumn.columnConfig : null;
- if (groupConfig) {
- if ($xeColumn.$options._componentTag === 'vxe-table-column') {
- errLog('vxe.error.groupTag', [`<vxe-table-colgroup title=${$xeColumn.title} ...>`, `<vxe-table-column title=${$xeColumn.title} ...>`]);
- } else if ($xeColumn.$options._componentTag === 'vxe-column') {
- warnLog('vxe.error.groupTag', [`<vxe-colgroup title=${$xeColumn.title} ...>`, `<vxe-column title=${$xeColumn.title} ...>`]);
- }
- if (!groupConfig.children) {
- groupConfig.children = [];
- }
- columnConfig.defaultParentId = groupConfig.id;
- groupConfig.children.splice(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayIndexOf($xeColumn.$el.children, $el), 0, columnConfig);
- } else {
- staticColumns.splice(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayIndexOf($xeTable.$refs.hideColumn.children, $el), 0, columnConfig);
- }
- }
- // 销毁列
- function destroyColumn(_vm) {
- const $xeTable = _vm.$xeTable;
- const reactData = $xeTable;
- const {
- staticColumns
- } = reactData;
- const {
- columnConfig
- } = _vm;
- const matchObj = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findTree(staticColumns, column => column === columnConfig);
- if (matchObj) {
- matchObj.items.splice(matchObj.index, 1);
- }
- }
- function getRootColumn($xeTable, column) {
- const internalData = $xeTable;
- const {
- fullColumnIdData
- } = internalData;
- if (!column) {
- return null;
- }
- let parentColId = column.parentId;
- while (fullColumnIdData[parentColId]) {
- const column = fullColumnIdData[parentColId].column;
- parentColId = column.parentId;
- if (!parentColId) {
- return column;
- }
- }
- return column;
- }
- function toFilters(filters, colid) {
- if (filters) {
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(filters)) {
- return filters.map(({
- label,
- value,
- data,
- resetValue,
- checked
- }) => {
- return {
- label,
- value,
- data,
- resetValue,
- checked: !!checked,
- _checked: !!checked,
- _colId: colid
- };
- });
- }
- return [];
- }
- return filters;
- }
- function getColReMinWidth(params) {
- const {
- $table,
- column,
- cell
- } = params;
- const internalData = $table;
- const {
- showHeaderOverflow: allColumnHeaderOverflow,
- resizableOpts
- } = $table;
- const {
- minWidth
- } = resizableOpts;
- // 如果自定义调整宽度逻辑
- if (minWidth) {
- const customMinWidth = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(minWidth) ? minWidth(params) : minWidth;
- if (customMinWidth !== 'auto') {
- return Math.max(1, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(customMinWidth));
- }
- }
- const {
- elemStore
- } = internalData;
- const {
- showHeaderOverflow,
- minWidth: colMinWidth
- } = column;
- 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;
- const showEllipsis = headOverflow === 'ellipsis';
- const showTitle = headOverflow === 'title';
- const showTooltip = headOverflow === true || headOverflow === 'tooltip';
- const hasEllipsis = showTitle || showTooltip || showEllipsis;
- 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);
- const paddingLeftRight = getPaddingLeftRightSize(cell) + getPaddingLeftRightSize(queryElement(cell, '.vxe-cell'));
- let mWidth = minTitleWidth + paddingLeftRight;
- // 默认最小宽处理
- if (hasEllipsis) {
- const dragIconWidth = getElementMarginAndWidth(queryElement(cell, '.vxe-cell--drag-handle'));
- const checkboxIconWidth = getElementMarginAndWidth(queryElement(cell, '.vxe-cell--checkbox'));
- const requiredIconWidth = getElementMarginAndWidth(queryElement(cell, '.vxe-cell--required-icon'));
- const editIconWidth = getElementMarginAndWidth(queryElement(cell, '.vxe-cell--edit-icon'));
- const prefixIconWidth = getElementMarginAndWidth(queryElement(cell, '.vxe-cell-title-prefix-icon'));
- const suffixIconWidth = getElementMarginAndWidth(queryElement(cell, '.vxe-cell-title-suffix-icon'));
- const sortIconWidth = getElementMarginAndWidth(queryElement(cell, '.vxe-cell--sort'));
- const filterIconWidth = getElementMarginAndWidth(queryElement(cell, '.vxe-cell--filter'));
- mWidth += dragIconWidth + checkboxIconWidth + requiredIconWidth + editIconWidth + prefixIconWidth + suffixIconWidth + filterIconWidth + sortIconWidth;
- }
- // 如果设置最小宽
- if (colMinWidth) {
- const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
- if (bodyScrollElem) {
- if (isScale(colMinWidth)) {
- const bodyWidth = bodyScrollElem.clientWidth - 1;
- const meanWidth = bodyWidth / 100;
- return Math.max(mWidth, Math.floor(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(colMinWidth) * meanWidth));
- } else if (isPx(colMinWidth)) {
- return Math.max(mWidth, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(colMinWidth));
- }
- }
- }
- return mWidth;
- }
- function getFirstChildColumn(column) {
- const {
- children
- } = column;
- if (children && children.length) {
- return getFirstChildColumn(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().first(children));
- }
- return column;
- }
- function getLastChildColumn(column) {
- const {
- children
- } = column;
- if (children && children.length) {
- return getFirstChildColumn(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().last(children));
- }
- return column;
- }
- const lineOffsetSizes = {
- mini: 3,
- small: 2,
- medium: 1,
- large: 0
- };
- function countTreeExpandSize(prevRow, params) {
- let count = 1;
- if (!prevRow) {
- return count;
- }
- const {
- $table
- } = params;
- const reactData = $table;
- const {
- treeExpandedFlag
- } = reactData;
- const internalData = $table;
- const {
- treeExpandedMaps
- } = internalData;
- const treeOpts = $table.computeTreeOpts;
- const {
- transform,
- mapChildrenField
- } = treeOpts;
- const childrenField = treeOpts.children || treeOpts.childrenField;
- const rowChildren = prevRow[transform ? mapChildrenField : childrenField];
- if (rowChildren && treeExpandedFlag && treeExpandedMaps[getRowid($table, prevRow)]) {
- for (let index = 0; index < rowChildren.length; index++) {
- count += countTreeExpandSize(rowChildren[index], params);
- }
- }
- return count;
- }
- function getOffsetSize($xeTable) {
- const vSize = $xeTable.computeSize;
- if (vSize) {
- return lineOffsetSizes[vSize] || 0;
- }
- return 0;
- }
- function calcTreeLine(params, prevRow) {
- const {
- $table,
- row
- } = params;
- const tableProps = $table;
- const tableReactData = $table;
- const tableInternalData = $table;
- const {
- showOverflow
- } = tableProps;
- const {
- scrollYLoad
- } = tableReactData;
- const {
- fullAllDataRowIdData
- } = tableInternalData;
- const rowOpts = $table.computeRowOpts;
- const cellOpts = $table.computeCellOpts;
- const defaultRowHeight = $table.computeDefaultRowHeight;
- const rowid = getRowid($table, row);
- const rowRest = fullAllDataRowIdData[rowid];
- const currCellHeight = rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight;
- let expandSize = 1;
- if (prevRow) {
- expandSize = countTreeExpandSize(prevRow, params);
- }
- let cellHeight = currCellHeight;
- const vnHeight = rowRest.height;
- if (scrollYLoad) {
- if (!showOverflow) {
- cellHeight = vnHeight || currCellHeight;
- }
- }
- return cellHeight * expandSize - (prevRow ? 1 : 12 - getOffsetSize($table));
- }
- function getCellValue(row, column) {
- return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, column.field);
- }
- function setCellValue(row, column, value) {
- return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(row, column.field, value);
- }
- function getRefElem(refEl) {
- if (refEl) {
- return refEl.$el || refEl;
- }
- return null;
- }
- function clearTableDefaultStatus($xeTable) {
- const props = $xeTable;
- const internalData = $xeTable;
- internalData.initStatus = false;
- const actionList = [$xeTable.clearSort(), $xeTable.clearCurrentRow(), $xeTable.clearCurrentColumn(), $xeTable.clearRadioRow(), $xeTable.clearRadioReserve(), $xeTable.clearCheckboxRow(), $xeTable.clearCheckboxReserve(), $xeTable.clearRowExpand(), $xeTable.clearTreeExpand(), $xeTable.clearTreeExpandReserve(), $xeTable.clearPendingRow()];
- if ($xeTable.clearFilter) {
- actionList.push($xeTable.clearFilter());
- }
- if ($xeTable.clearSelected && (props.keyboardConfig || props.mouseConfig)) {
- actionList.push($xeTable.clearSelected());
- }
- if ($xeTable.clearCellAreas && props.mouseConfig) {
- actionList.push($xeTable.clearCellAreas(), $xeTable.clearCopyCellArea());
- }
- return Promise.all(actionList).then(() => {
- return $xeTable.clearScroll();
- });
- }
- function clearTableAllStatus(_vm) {
- if (_vm.clearFilter) {
- _vm.clearFilter();
- }
- return clearTableDefaultStatus(_vm);
- }
- function isColumnInfo(column) {
- return column instanceof ColumnInfo;
- }
- // 获取所有的列,排除分组
- function getColumnList(columns) {
- const result = [];
- columns.forEach(column => {
- result.push(...(column.children && column.children.length ? getColumnList(column.children) : [column]));
- });
- return result;
- }
- function createColumn($xeTable, options, renderOptions) {
- return isColumnInfo(options) ? options : new ColumnInfo($xeTable, options, renderOptions);
- }
- function rowToVisible($xeTable, row) {
- const tableProps = $xeTable;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- showOverflow
- } = tableProps;
- const {
- scrollYLoad,
- scrollYTop
- } = reactData;
- const {
- elemStore,
- afterFullData,
- fullAllDataRowIdData,
- isResizeCellHeight
- } = internalData;
- const rowOpts = $xeTable.computeRowOpts;
- const cellOpts = $xeTable.computeCellOpts;
- const defaultRowHeight = $xeTable.computeDefaultRowHeight;
- const leftFixedWidth = $xeTable.computeLeftFixedWidth;
- const rightFixedWidth = $xeTable.computeRightFixedWidth;
- const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
- const rowid = getRowid($xeTable, row);
- if (bodyScrollElem) {
- const bodyHeight = bodyScrollElem.clientHeight;
- const bodyScrollTop = bodyScrollElem.scrollTop;
- const trElem = bodyScrollElem.querySelector(`[rowid="${rowid}"]`);
- if (trElem) {
- const trOffsetTop = trElem.offsetTop + (scrollYLoad ? scrollYTop : 0);
- const trHeight = trElem.clientHeight;
- // 检测行是否在可视区中
- if (trOffsetTop < bodyScrollTop || trOffsetTop > bodyScrollTop + bodyHeight) {
- return $xeTable.scrollTo(null, trOffsetTop);
- } else if (trOffsetTop + trHeight >= bodyHeight + bodyScrollTop) {
- return $xeTable.scrollTo(null, bodyScrollTop + trHeight);
- }
- } else {
- // 如果是虚拟渲染滚动
- if (scrollYLoad) {
- const isCustomCellHeight = isResizeCellHeight || cellOpts.height || rowOpts.height;
- if (!isCustomCellHeight && showOverflow) {
- return $xeTable.scrollTo(null, ($xeTable.findRowIndexOf(afterFullData, row) - 1) * defaultRowHeight);
- }
- let scrollTop = 0;
- const rowRest = fullAllDataRowIdData[rowid];
- const rHeight = rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight;
- for (let i = 0; i < afterFullData.length; i++) {
- const currRow = afterFullData[i];
- const currRowid = getRowid($xeTable, currRow);
- if (currRow === row || currRowid === rowid) {
- break;
- }
- const currRowRest = fullAllDataRowIdData[currRowid];
- scrollTop += currRowRest.resizeHeight || cellOpts.height || rowOpts.height || currRowRest.height || defaultRowHeight;
- }
- if (scrollTop < bodyScrollTop) {
- return $xeTable.scrollTo(null, scrollTop - leftFixedWidth - 1);
- }
- return $xeTable.scrollTo(null, scrollTop + rHeight - (bodyHeight - rightFixedWidth - 1));
- }
- }
- }
- return Promise.resolve();
- }
- function colToVisible($xeTable, column, row) {
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- scrollXLoad,
- scrollXLeft
- } = reactData;
- const {
- elemStore,
- visibleColumn
- } = internalData;
- const leftFixedWidth = $xeTable.computeLeftFixedWidth;
- const rightFixedWidth = $xeTable.computeRightFixedWidth;
- const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
- if (column.fixed) {
- return Promise.resolve();
- }
- if (bodyScrollElem) {
- const bodyWidth = bodyScrollElem.clientWidth;
- const bodyScrollLeft = bodyScrollElem.scrollLeft;
- let tdElem = null;
- if (row) {
- const rowid = getRowid($xeTable, row);
- tdElem = bodyScrollElem.querySelector(`[rowid="${rowid}"] .${column.id}`);
- }
- if (!tdElem) {
- tdElem = bodyScrollElem.querySelector(`.${column.id}`);
- }
- if (tdElem) {
- const tdOffsetLeft = tdElem.offsetLeft + (scrollXLoad ? scrollXLeft : 0);
- const cellWidth = tdElem.clientWidth;
- // 检测是否在可视区中
- if (tdOffsetLeft < bodyScrollLeft + leftFixedWidth) {
- return $xeTable.scrollTo(tdOffsetLeft - leftFixedWidth - 1);
- } else if (tdOffsetLeft + cellWidth - bodyScrollLeft > bodyWidth - rightFixedWidth) {
- return $xeTable.scrollTo(tdOffsetLeft + cellWidth - (bodyWidth - rightFixedWidth - 1));
- }
- } else {
- // 检测是否在虚拟渲染可视区中
- if (scrollXLoad) {
- let scrollLeft = 0;
- const cellWidth = column.renderWidth;
- for (let i = 0; i < visibleColumn.length; i++) {
- const currCol = visibleColumn[i];
- if (currCol === column || currCol.id === column.id) {
- break;
- }
- scrollLeft += currCol.renderWidth;
- }
- if (scrollLeft < bodyScrollLeft) {
- return $xeTable.scrollTo(scrollLeft - leftFixedWidth - 1);
- }
- return $xeTable.scrollTo(scrollLeft + cellWidth - (bodyWidth - rightFixedWidth - 1));
- }
- }
- }
- return Promise.resolve();
- }
- ;// CONCATENATED MODULE: ./packages/ui/src/vn.ts
- function getOnName(type) {
- return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().kebabCase(type);
- }
- function getModelEvent(renderOpts) {
- switch (renderOpts.name) {
- case 'VxeInput':
- case 'VxeTextarea':
- case 'VxeNumberInput':
- case 'VxePasswordInput':
- case 'VxeSelect':
- case 'VxeTreeSelect':
- case 'VxeTableSelect':
- case 'VxeDatePicker':
- case 'VxeDateRangePicker':
- case 'VxeIconPicker':
- case 'VxeColorPicker':
- case 'VxeSlider':
- case 'VxeUpload':
- return 'modelValue';
- case 'select':
- return 'change';
- }
- return 'input';
- }
- function getChangeEvent(renderOpts) {
- switch (renderOpts.name) {
- case 'input':
- case 'textarea':
- case 'VxeInput':
- case 'VxeTextarea':
- case '$input': // 已废弃
- case '$textarea':
- // 已废弃
- return 'input';
- }
- return 'change';
- }
- function hasInputType(renderOpts) {
- switch (renderOpts.name) {
- case 'VxeInput':
- case 'VxeNumberInput':
- case 'VxeTextarea':
- case '$input':
- case '$textarea':
- return true;
- }
- return false;
- }
- function getSlotVNs(vns) {
- if (vns === null || vns === undefined) {
- return [];
- }
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(vns)) {
- return vns;
- }
- return [vns];
- }
- ;// CONCATENATED MODULE: ./packages/table/src/cell.ts
- const {
- getI18n: cell_getI18n,
- getIcon: cell_getIcon,
- renderer: cell_renderer,
- formats: cell_formats,
- renderEmptyElement
- } = core_.VxeUI;
- function renderTitlePrefixIcon(h, params) {
- const {
- $table,
- column
- } = params;
- const titlePrefix = column.titlePrefix || column.titleHelp;
- if (titlePrefix) {
- return h('i', {
- class: ['vxe-cell-title-prefix-icon', titlePrefix.iconStatus ? `theme--${titlePrefix.iconStatus}` : ''],
- on: {
- mouseenter(evnt) {
- $table.triggerHeaderTitleEvent(evnt, titlePrefix, params);
- },
- mouseleave(evnt) {
- $table.handleTargetLeaveEvent(evnt);
- }
- }
- }, [h('i', {
- class: titlePrefix.icon || cell_getIcon().TABLE_TITLE_PREFIX
- })]);
- }
- return renderEmptyElement($table);
- }
- function renderTitleSuffixIcon(h, params) {
- const {
- $table,
- column
- } = params;
- const titleSuffix = column.titleSuffix;
- if (titleSuffix) {
- return h('i', {
- class: ['vxe-cell-title-suffix-icon', titleSuffix.iconStatus ? `theme--${titleSuffix.iconStatus}` : ''],
- on: {
- mouseenter(evnt) {
- $table.triggerHeaderTitleEvent(evnt, titleSuffix, params);
- },
- mouseleave(evnt) {
- $table.handleTargetLeaveEvent(evnt);
- }
- }
- }, [h('i', {
- class: titleSuffix.icon || cell_getIcon().TABLE_TITLE_SUFFIX
- })]);
- }
- return renderEmptyElement($table);
- }
- function renderCellDragIcon(h, params) {
- const {
- $table
- } = params;
- const tableSlots = $table.$scopedSlots;
- const tableProps = $table;
- const {
- dragConfig
- } = tableProps;
- const rowDragOpts = $table.computeRowDragOpts;
- const {
- icon,
- trigger,
- disabledMethod
- } = rowDragOpts;
- const rDisabledMethod = disabledMethod || (dragConfig ? dragConfig.rowDisabledMethod : null);
- const isDisabled = rDisabledMethod && rDisabledMethod(params);
- const rowDragIconSlot = tableSlots.rowDragIcon || tableSlots['row-drag-icon'];
- const ons = {};
- if (trigger !== 'cell') {
- ons.mousedown = evnt => {
- if (!isDisabled) {
- $table.handleCellDragMousedownEvent(evnt, params);
- }
- };
- ons.mouseup = $table.handleCellDragMouseupEvent;
- }
- return h('span', {
- key: 'dg',
- class: ['vxe-cell--drag-handle', {
- 'is--disabled': isDisabled
- }],
- on: ons
- }, rowDragIconSlot ? $table.callSlot(rowDragIconSlot, params, h) : [h('i', {
- class: icon || (dragConfig ? dragConfig.rowIcon : '') || cell_getIcon().TABLE_DRAG_ROW
- })]);
- }
- function renderCellBaseVNs(h, params, content) {
- const {
- $table,
- column,
- level
- } = params;
- const {
- dragSort
- } = column;
- const tableProps = $table;
- const {
- treeConfig,
- dragConfig
- } = tableProps;
- const rowOpts = $table.computeRowOpts;
- const rowDragOpts = $table.computeRowDragOpts;
- const treeOpts = $table.computeTreeOpts;
- const {
- showIcon,
- isPeerDrag,
- isCrossDrag,
- visibleMethod
- } = rowDragOpts;
- const rVisibleMethod = visibleMethod || (dragConfig ? dragConfig.rowVisibleMethod : null);
- const vns = [];
- if (dragSort && rowOpts.drag && (showIcon || (dragConfig ? dragConfig.showRowIcon : false)) && (!rVisibleMethod || rVisibleMethod(params))) {
- if (treeConfig) {
- if (treeOpts.transform && (isPeerDrag || isCrossDrag || !level)) {
- vns.unshift(renderCellDragIcon(h, params));
- }
- } else {
- vns.unshift(renderCellDragIcon(h, params));
- }
- }
- return vns.concat(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(content) ? content : [content]);
- }
- function renderHeaderCellDragIcon(h, params) {
- const {
- $table,
- column
- } = params;
- const tableSlots = $table.$scopedSlots;
- const {
- slots
- } = column;
- const columnOpts = $table.computeColumnOpts;
- const columnDragOpts = $table.computeColumnDragOpts;
- const {
- showIcon,
- icon,
- trigger,
- isPeerDrag,
- isCrossDrag,
- visibleMethod,
- disabledMethod
- } = columnDragOpts;
- if (columnOpts.drag && showIcon && (!visibleMethod || visibleMethod(params))) {
- if (!column.fixed && (isPeerDrag || isCrossDrag || !column.parentId)) {
- const isDisabled = disabledMethod && disabledMethod(params);
- const columnDragIconSlot = (slots ? slots.columnDragIcon || slots['column-drag-icon'] : null) || tableSlots.columnDragIcon || tableSlots['column-drag-icon'];
- const ons = {};
- if (trigger !== 'cell') {
- ons.mousedown = evnt => {
- if (!isDisabled) {
- $table.handleHeaderCellDragMousedownEvent(evnt, params);
- }
- };
- ons.mouseup = $table.handleHeaderCellDragMouseupEvent;
- }
- return h('span', {
- key: 'dg',
- class: ['vxe-cell--drag-handle', {
- 'is--disabled': isDisabled
- }],
- on: ons
- }, columnDragIconSlot ? $table.callSlot(columnDragIconSlot, params, h) : [h('i', {
- class: icon || cell_getIcon().TABLE_DRAG_COLUMN
- })]);
- }
- }
- return renderEmptyElement($table);
- }
- function renderHeaderCellBaseVNs(h, params, content) {
- 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)];
- return vns;
- }
- function getRenderDefaultColumnTitle(h, column, content) {
- if (column.type === 'html' && external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(content)) {
- return h('span', {
- key: 'ch',
- domProps: {
- innerHTML: content
- }
- });
- }
- return h('span', {
- key: 'ct'
- }, getSlotVNs(content));
- }
- function renderTitleContent(h, params, content) {
- const {
- $table,
- column
- } = params;
- const tableProps = $table;
- const tableReactData = $table;
- const {
- showHeaderOverflow: allColumnHeaderOverflow
- } = tableProps;
- const {
- isRowGroupStatus
- } = tableReactData;
- const {
- showHeaderOverflow
- } = column;
- const headerTooltipOpts = $table.computeHeaderTooltipOpts;
- const showAllTip = headerTooltipOpts.showAll;
- const headOverflow = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(showHeaderOverflow) ? allColumnHeaderOverflow : showHeaderOverflow;
- const showTitle = headOverflow === 'title';
- const showTooltip = headOverflow === true || headOverflow === 'tooltip';
- const ons = {};
- if (showTitle || showTooltip || showAllTip) {
- ons.mouseenter = evnt => {
- if (tableReactData.isDragResize) {
- return;
- }
- if (showTitle) {
- updateCellTitle(evnt.currentTarget, column);
- } else if (showTooltip || showAllTip) {
- $table.triggerHeaderTooltipEvent(evnt, params);
- }
- };
- }
- if (showTooltip || showAllTip) {
- ons.mouseleave = evnt => {
- if (tableReactData.isDragResize) {
- return;
- }
- if (showTooltip || showAllTip) {
- $table.handleTargetLeaveEvent(evnt);
- }
- };
- }
- const titleVN = getRenderDefaultColumnTitle(h, column, content);
- return [h('span', {
- class: 'vxe-cell--title',
- on: ons
- }, isRowGroupStatus && column.aggFunc && $table.getPivotTableAggregateRenderColTitles ? $table.getPivotTableAggregateRenderColTitles(h, column, titleVN) : [titleVN])];
- }
- function getFooterContent(h, params) {
- const {
- $table,
- column,
- _columnIndex,
- row,
- items
- } = params;
- const {
- slots,
- editRender,
- cellRender,
- footerFormatter
- } = column;
- const renderOpts = editRender || cellRender;
- if (slots && slots.footer) {
- return $table.callSlot(slots.footer, params, h);
- }
- let itemValue = '';
- // 兼容老模式
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(items)) {
- itemValue = items[_columnIndex];
- } else {
- itemValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, column.field);
- }
- const footParams = Object.assign(params, {
- itemValue
- });
- if (footerFormatter) {
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(footerFormatter)) {
- return `${footerFormatter(footParams)}`;
- }
- const isArr = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(footerFormatter);
- const gFormatOpts = isArr ? cell_formats.get(footerFormatter[0]) : cell_formats.get(footerFormatter);
- const footerFormatMethod = gFormatOpts ? gFormatOpts.tableFooterCellFormatMethod : null;
- if (footerFormatMethod) {
- return `${isArr ? footerFormatMethod(footParams, ...footerFormatter.slice(1)) : footerFormatMethod(footParams)}`;
- }
- return '';
- }
- if (renderOpts) {
- const compConf = cell_renderer.get(renderOpts.name);
- const rtFooter = compConf ? compConf.renderTableFooter || compConf.renderFooter : null;
- if (rtFooter) {
- return getSlotVNs(rtFooter.call($table, h, renderOpts, footParams));
- }
- }
- return [formatText(itemValue, 1)];
- }
- function getDefaultCellLabel(params) {
- const {
- $table,
- row,
- column
- } = params;
- return formatText($table.getCellLabel(row, column), 1);
- }
- function renderCellHandle(h, params) {
- const {
- column,
- row,
- $table
- } = params;
- const tableProps = $table;
- const tableReactData = $table;
- const {
- editConfig
- } = tableProps;
- const {
- isRowGroupStatus
- } = tableReactData;
- const {
- type,
- treeNode,
- rowGroupNode,
- editRender
- } = column;
- const aggregateOpts = $table.computeAggregateOpts;
- const {
- mode
- } = aggregateOpts;
- const checkboxOpts = $table.computeCheckboxOpts;
- const editOpts = $table.computeEditOpts;
- const isDeepCell = treeNode || isRowGroupStatus && (mode === 'column' ? column.field === row.groupField : rowGroupNode);
- switch (type) {
- case 'seq':
- return isDeepCell ? Cell.renderDeepIndexCell(h, params) : Cell.renderSeqCell(h, params);
- case 'radio':
- return isDeepCell ? Cell.renderDeepRadioCell(h, params) : Cell.renderRadioCell(h, params);
- case 'checkbox':
- return checkboxOpts.checkField ? isDeepCell ? Cell.renderDeepSelectionCellByProp(h, params) : Cell.renderCheckboxCellByProp(h, params) : isDeepCell ? Cell.renderDeepSelectionCell(h, params) : Cell.renderCheckboxCell(h, params);
- case 'expand':
- return Cell.renderExpandCell(h, params);
- case 'html':
- return isDeepCell ? Cell.renderDeepHTMLCell(h, params) : Cell.renderHTMLCell(h, params);
- }
- if (editConfig && isEnableConf(editOpts) && editRender) {
- return editOpts.mode === 'cell' ? isDeepCell ? Cell.renderDeepCellEdit(h, params) : Cell.renderCellEdit(h, params) : isDeepCell ? Cell.renderDeepRowEdit(h, params) : Cell.renderRowEdit(h, params);
- }
- return isDeepCell ? Cell.renderDeepCell(h, params) : Cell.renderDefaultCell(h, params);
- }
- function renderHeaderHandle(h, params) {
- const {
- column,
- $table
- } = params;
- const tableProps = $table;
- const {
- editConfig
- } = tableProps;
- const editOpts = $table.computeEditOpts;
- const {
- type,
- filters,
- sortable,
- editRender
- } = column;
- switch (type) {
- case 'seq':
- return Cell.renderSeqHeader(h, params);
- case 'radio':
- return Cell.renderRadioHeader(h, params);
- case 'checkbox':
- return Cell.renderCheckboxHeader(h, params);
- case 'html':
- if (filters && sortable) {
- return Cell.renderSortAndFilterHeader(h, params);
- } else if (sortable) {
- return Cell.renderSortHeader(h, params);
- } else if (filters) {
- return Cell.renderFilterHeader(h, params);
- }
- break;
- }
- if (editConfig && isEnableConf(editOpts) && editRender) {
- return Cell.renderEditHeader(h, params);
- } else if (filters && sortable) {
- return Cell.renderSortAndFilterHeader(h, params);
- } else if (sortable) {
- return Cell.renderSortHeader(h, params);
- } else if (filters) {
- return Cell.renderFilterHeader(h, params);
- }
- return Cell.renderDefaultHeader(h, params);
- }
- function renderFooterHandle(h, params) {
- return Cell.renderDefaultFooter(h, params);
- }
- const Cell = {
- createColumn($xeTable, _vm) {
- const {
- type
- } = _vm;
- const renConfs = {
- renderHeader: renderHeaderHandle,
- renderCell: renderCellHandle,
- renderFooter: renderFooterHandle
- };
- if (type === 'expand') {
- renConfs.renderData = Cell.renderExpandData;
- }
- return createColumn($xeTable, _vm, renConfs);
- },
- /**
- * 列头标题
- */
- renderHeaderTitle(h, params) {
- const {
- $table,
- column
- } = params;
- const {
- slots,
- editRender,
- cellRender
- } = column;
- const renderOpts = editRender || cellRender;
- if (slots && slots.header) {
- return renderTitleContent(h, params, $table.callSlot(slots.header, params, h));
- }
- if (renderOpts) {
- const compConf = cell_renderer.get(renderOpts.name);
- const rtHeader = compConf ? compConf.renderTableHeader || compConf.renderHeader : null;
- if (rtHeader) {
- return getSlotVNs(renderTitleContent(h, params, rtHeader.call($table, h, renderOpts, params)));
- }
- }
- return renderTitleContent(h, params, formatText(column.getTitle(), 1));
- },
- renderDefaultHeader(h, params) {
- return renderHeaderCellBaseVNs(h, params, Cell.renderHeaderTitle(h, params));
- },
- renderDefaultCell(h, params) {
- const {
- $table,
- row,
- column
- } = params;
- const tableProps = $table;
- const tableReactData = $table;
- const tableInternalData = $table;
- const {
- isRowGroupStatus
- } = tableReactData;
- const {
- editConfig
- } = tableProps;
- const editOpts = $table.computeEditOpts;
- const {
- field,
- slots,
- editRender,
- cellRender,
- rowGroupNode,
- aggFunc
- } = column;
- const renderOpts = editConfig && isEnableConf(editOpts) && editRender ? editRender : cellRender;
- const defaultSlot = slots ? slots.default : null;
- const gcSlot = slots ? slots.groupContent || slots['group-content'] : null;
- let cellValue = '';
- if (isRowGroupStatus && field && row.isAggregate) {
- const aggRow = row;
- const {
- fullColumnFieldData
- } = tableInternalData;
- const aggregateOpts = $table.computeAggregateOpts;
- const {
- mode,
- showTotal,
- totalMethod,
- countFields,
- contentMethod,
- mapChildrenField
- } = aggregateOpts;
- const aggCalcMethod = aggregateOpts.calcValuesMethod || aggregateOpts.countMethod || aggregateOpts.aggregateMethod;
- const groupField = aggRow.groupField;
- const groupContent = aggRow.groupContent;
- const childList = mapChildrenField ? aggRow[mapChildrenField] || [] : [];
- const childCount = aggRow.childCount;
- const colRest = fullColumnFieldData[groupField] || {};
- const ctParams = {
- $table,
- groupField,
- groupColumn: colRest ? colRest.column : null,
- column,
- groupValue: groupContent,
- childList,
- childCount,
- aggValue: null,
- /**
- * 已废弃
- * @deprecated
- */
- children: childList,
- /**
- * 已废弃
- * @deprecated
- */
- totalValue: childCount
- };
- if (gcSlot) {
- return renderCellBaseVNs(h, params, $table.callSlot(gcSlot, Object.assign({
- groupField,
- groupContent,
- childList,
- childCount
- }, params), h));
- }
- if (mode === 'column' ? field === aggRow.groupField : rowGroupNode) {
- cellValue = groupContent;
- if (contentMethod) {
- cellValue = `${contentMethod(ctParams)}`;
- }
- if (showTotal) {
- cellValue = cell_getI18n('vxe.table.rowGroupContentTotal', [cellValue, totalMethod ? totalMethod(ctParams) : childCount, childCount]);
- }
- } else if ($table.getPivotTableAggregateCellAggValue) {
- cellValue = $table.getPivotTableAggregateCellAggValue(params);
- } else if (aggFunc === true || countFields && countFields.includes(field)) {
- if (aggCalcMethod) {
- ctParams.aggValue = childCount;
- cellValue = `${aggCalcMethod(ctParams)}`;
- }
- }
- } else {
- if (defaultSlot) {
- return renderCellBaseVNs(h, params, $table.callSlot(defaultSlot, params, h));
- }
- if (renderOpts) {
- const compConf = cell_renderer.get(renderOpts.name);
- const rtDefault = compConf ? compConf.renderTableDefault || compConf.renderDefault : null;
- const rtCell = compConf ? compConf.renderTableCell || compConf.renderCell : null;
- const renderFn = editRender ? rtCell : rtDefault;
- if (renderFn) {
- return renderCellBaseVNs(h, params, getSlotVNs(renderFn.call($table, h, renderOpts, Object.assign({
- $type: editRender ? 'edit' : 'cell'
- }, params))));
- }
- }
- cellValue = $table.getCellLabel(row, column);
- }
- const cellPlaceholder = editRender ? editRender.placeholder : '';
- return renderCellBaseVNs(h, params, [h('span', {
- class: 'vxe-cell--label'
- }, [
- // 如果设置占位符
- editRender && eqEmptyValue(cellValue) ? h('span', {
- class: 'vxe-cell--placeholder'
- }, formatText(getFuncText(cellPlaceholder), 1)) : h('span', formatText(cellValue, 1))])]);
- },
- renderDeepCell(h, params) {
- return Cell.renderDeepNodeBtn(h, params, Cell.renderDefaultCell.call(this, h, params));
- },
- renderDefaultFooter(h, params) {
- return getFooterContent(h, params);
- },
- /**
- * 行分组
- */
- renderRowGroupBtn(h, params, cellVNodes) {
- const {
- $table
- } = params;
- const tableReactData = $table;
- const tableInternalData = $table;
- const {
- row,
- level
- } = params;
- const {
- rowGroupExpandedFlag
- } = tableReactData;
- const {
- rowGroupExpandedMaps
- } = tableInternalData;
- const aggregateOpts = $table.computeAggregateOpts;
- const {
- mode,
- padding,
- indent
- } = aggregateOpts;
- const rowid = getRowid($table, row);
- const isExpand = !!rowGroupExpandedFlag && !!rowGroupExpandedMaps[rowid];
- return h('div', {
- class: ['vxe-row-group--tree-node', {
- 'is--expanded': isExpand
- }],
- style: mode !== 'column' && padding && indent ? {
- paddingLeft: `${level * indent}px`
- } : undefined
- }, [row.isAggregate ? h('span', {
- class: 'vxe-row-group--node-btn',
- on: {
- click(evnt) {
- $table.triggerRowGroupExpandEvent(evnt, params);
- }
- }
- }, [h('i', {
- class: isExpand ? cell_getIcon().TABLE_ROW_GROUP_OPEN : cell_getIcon().TABLE_ROW_GROUP_CLOSE
- })]) : renderEmptyElement($table), h('div', {
- class: 'vxe-row-group-cell'
- }, cellVNodes)]);
- },
- /**
- * 树
- */
- renderTreeNodeBtn(h, params, cellVNodes) {
- const {
- $table,
- isHidden
- } = params;
- const tableReactData = $table;
- const tableInternalData = $table;
- const {
- treeExpandedFlag
- } = tableReactData;
- const {
- fullAllDataRowIdData,
- treeExpandedMaps,
- treeExpandLazyLoadedMaps
- } = tableInternalData;
- const treeOpts = $table.computeTreeOpts;
- const {
- row,
- column,
- level
- } = params;
- const {
- slots
- } = column;
- const {
- padding,
- indent,
- lazy,
- trigger,
- iconLoaded,
- showIcon,
- iconOpen,
- iconClose
- } = treeOpts;
- const childrenField = treeOpts.children || treeOpts.childrenField;
- const hasChildField = treeOpts.hasChild || treeOpts.hasChildField;
- const rowChilds = row[childrenField];
- const hasChild = rowChilds && rowChilds.length;
- const iconSlot = slots ? slots.icon : null;
- let hasLazyChilds = false;
- let isActive = false;
- let isLazyLoading = false;
- let isLazyLoaded = false;
- const ons = {};
- if (iconSlot) {
- return $table.callSlot(iconSlot, params, h);
- }
- if (!isHidden) {
- const rowid = getRowid($table, row);
- isActive = !!treeExpandedFlag && !!treeExpandedMaps[rowid];
- if (lazy) {
- const rest = fullAllDataRowIdData[rowid];
- isLazyLoading = !!treeExpandLazyLoadedMaps[rowid];
- hasLazyChilds = row[hasChildField];
- isLazyLoaded = !!rest.treeLoaded;
- }
- }
- if (!trigger || trigger === 'default') {
- ons.click = evnt => {
- $table.triggerTreeExpandEvent(evnt, params);
- };
- }
- return [h('div', {
- class: ['vxe-cell--tree-node', {
- 'is--active': isActive
- }],
- style: padding && indent ? {
- paddingLeft: `${level * indent}px`
- } : undefined
- }, [showIcon && (lazy ? isLazyLoaded ? hasChild : hasChild || hasLazyChilds : hasChild) ? [h('div', {
- class: 'vxe-cell--tree-btn',
- on: ons
- }, [h('i', {
- class: isLazyLoading ? iconLoaded || cell_getIcon().TABLE_TREE_LOADED : isActive ? iconOpen || cell_getIcon().TABLE_TREE_OPEN : iconClose || cell_getIcon().TABLE_TREE_CLOSE
- })])] : null, h('div', {
- class: 'vxe-tree-cell'
- }, cellVNodes)])];
- },
- /**
- * 层级节点。
- * 行分组、树结构
- */
- renderDeepNodeBtn(h, params, cellVNodes) {
- const {
- $table,
- row,
- column
- } = params;
- const {
- rowGroupNode
- } = column;
- const tableReactData = $table;
- const {
- rowGroupList
- } = tableReactData;
- if (rowGroupList.length) {
- const aggregateOpts = $table.computeAggregateOpts;
- const {
- mode
- } = aggregateOpts;
- if (mode === 'column' ? column.field === row.groupField : rowGroupNode) {
- return [Cell.renderRowGroupBtn(h, params, cellVNodes)];
- }
- }
- return [Cell.renderTreeNodeBtn(h, params, cellVNodes)];
- },
- /**
- * 序号
- */
- renderSeqHeader(h, params) {
- const {
- $table,
- column
- } = params;
- const {
- slots
- } = column;
- return renderHeaderCellBaseVNs(h, params, renderTitleContent(h, params, slots && slots.header ? $table.callSlot(slots.header, params, h) : formatText(column.getTitle(), 1)));
- },
- renderSeqCell(h, params) {
- const {
- $table,
- column
- } = params;
- const tableProps = $table;
- const {
- treeConfig
- } = tableProps;
- const seqOpts = $table.computeSeqOpts;
- const {
- slots
- } = column;
- if (slots && slots.default) {
- return renderCellBaseVNs(h, params, $table.callSlot(slots.default, params, h));
- }
- const {
- seq
- } = params;
- const seqMethod = seqOpts.seqMethod;
- return renderCellBaseVNs(h, params, [h('span', `${formatText(seqMethod ? seqMethod(params) : treeConfig ? seq : (seqOpts.startIndex || 0) + seq, 1)}`)]);
- },
- renderDeepIndexCell(h, params) {
- return Cell.renderDeepNodeBtn(h, params, Cell.renderSeqCell(h, params));
- },
- /**
- * 单选
- */
- renderRadioHeader(h, params) {
- const {
- $table,
- column
- } = params;
- const {
- slots
- } = column;
- const headerSlot = slots ? slots.header : null;
- const titleSlot = slots ? slots.title : null;
- return renderHeaderCellBaseVNs(h, params, renderTitleContent(h, params, headerSlot ? $table.callSlot(headerSlot, params, h) : [h('span', {
- class: 'vxe-radio--label'
- }, titleSlot ? $table.callSlot(titleSlot, params, h) : formatText(column.getTitle(), 1))]));
- },
- renderRadioCell(h, params) {
- const {
- $table,
- column,
- isHidden
- } = params;
- const tableReactData = $table;
- const {
- selectRadioRow
- } = tableReactData;
- const radioOpts = $table.computeRadioOpts;
- const {
- slots
- } = column;
- const {
- labelField,
- checkMethod,
- visibleMethod
- } = radioOpts;
- const {
- row
- } = params;
- const defaultSlot = slots ? slots.default : null;
- const radioSlot = slots ? slots.radio : null;
- const isChecked = row === selectRadioRow;
- const isVisible = !visibleMethod || visibleMethod({
- $table,
- row
- });
- let isDisabled = !!checkMethod;
- let on;
- if (!isHidden) {
- on = {
- click(evnt) {
- if (!isDisabled && isVisible) {
- $table.triggerRadioRowEvent(evnt, params);
- }
- }
- };
- if (checkMethod) {
- isDisabled = !checkMethod({
- $table,
- row
- });
- }
- }
- const radioParams = {
- ...params,
- checked: isChecked,
- disabled: isDisabled,
- visible: isVisible
- };
- if (radioSlot) {
- return renderCellBaseVNs(h, params, $table.callSlot(radioSlot, radioParams, h));
- }
- const radioVNs = [];
- if (isVisible) {
- radioVNs.push(h('span', {
- class: ['vxe-radio--icon', isChecked ? cell_getIcon().TABLE_RADIO_CHECKED : isDisabled ? cell_getIcon().TABLE_RADIO_DISABLED_UNCHECKED : cell_getIcon().TABLE_RADIO_UNCHECKED]
- }));
- }
- if (defaultSlot || labelField) {
- radioVNs.push(h('span', {
- class: 'vxe-radio--label'
- }, defaultSlot ? $table.callSlot(defaultSlot, radioParams, h) : external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, labelField)));
- }
- return renderCellBaseVNs(h, params, [h('span', {
- class: ['vxe-cell--radio', {
- 'is--checked': isChecked,
- 'is--disabled': isDisabled
- }],
- on
- }, radioVNs)]);
- },
- renderDeepRadioCell(h, params) {
- return Cell.renderDeepNodeBtn(h, params, Cell.renderRadioCell(h, params));
- },
- /**
- * 多选
- */
- renderCheckboxHeader(h, params) {
- const {
- $table,
- column,
- isHidden
- } = params;
- const tableReactData = $table;
- const {
- isAllSelected: isAllCheckboxSelected,
- isIndeterminate: isAllCheckboxIndeterminate
- } = tableReactData;
- const isAllCheckboxDisabled = $table.computeIsAllCheckboxDisabled;
- const {
- slots
- } = column;
- const headerSlot = slots ? slots.header : null;
- const titleSlot = slots ? slots.title : null;
- const checkboxOpts = $table.computeCheckboxOpts;
- const {
- checkStrictly,
- showHeader,
- headerTitle
- } = checkboxOpts;
- const colTitle = column.getTitle();
- const ons = {};
- if (!isHidden) {
- ons.click = evnt => {
- if (!isAllCheckboxDisabled) {
- $table.triggerCheckAllEvent(evnt, !isAllCheckboxSelected);
- }
- };
- }
- const checkboxParams = {
- ...params,
- checked: isAllCheckboxSelected,
- disabled: isAllCheckboxDisabled,
- indeterminate: isAllCheckboxIndeterminate
- };
- if (headerSlot) {
- return renderHeaderCellBaseVNs(h, params, renderTitleContent(h, checkboxParams, $table.callSlot(headerSlot, checkboxParams, h)));
- }
- if (checkStrictly ? !showHeader : showHeader === false) {
- return renderHeaderCellBaseVNs(h, params, renderTitleContent(h, checkboxParams, [h('span', {
- class: 'vxe-checkbox--label'
- }, titleSlot ? $table.callSlot(titleSlot, checkboxParams, h) : colTitle)]));
- }
- return renderHeaderCellBaseVNs(h, params, renderTitleContent(h, checkboxParams, [h('span', {
- class: ['vxe-cell--checkbox', {
- 'is--checked': isAllCheckboxSelected,
- 'is--disabled': isAllCheckboxDisabled,
- 'is--indeterminate': isAllCheckboxIndeterminate
- }],
- attrs: {
- title: external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(headerTitle) ? cell_getI18n('vxe.table.allTitle') : `${headerTitle || ''}`
- },
- on: ons
- }, [h('span', {
- 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]
- })].concat(titleSlot || colTitle ? [h('span', {
- class: 'vxe-checkbox--label'
- }, titleSlot ? $table.callSlot(titleSlot, checkboxParams, h) : colTitle)] : []))]));
- },
- renderCheckboxCell(h, params) {
- const {
- $table,
- row,
- column,
- isHidden
- } = params;
- const tableProps = $table;
- const tableReactData = $table;
- const tableInternalData = $table;
- const {
- treeConfig
- } = tableProps;
- const {
- updateCheckboxFlag,
- isRowGroupStatus
- } = tableReactData;
- const {
- selectCheckboxMaps,
- treeIndeterminateRowMaps
- } = tableInternalData;
- const aggregateOpts = $table.computeAggregateOpts;
- const {
- mapChildrenField
- } = aggregateOpts;
- const checkboxOpts = $table.computeCheckboxOpts;
- const {
- labelField,
- checkMethod,
- visibleMethod
- } = checkboxOpts;
- const {
- slots
- } = column;
- const defaultSlot = slots ? slots.default : null;
- const checkboxSlot = slots ? slots.checkbox : null;
- let indeterminate = false;
- let isChecked = false;
- let isVisible = true;
- let isDisabled = false;
- const ons = {};
- if (!isHidden) {
- const rowid = getRowid($table, row);
- isChecked = !!updateCheckboxFlag && !!selectCheckboxMaps[rowid];
- if (checkMethod && isRowGroupStatus && $table.isAggregateRecord(row)) {
- const childList = row[mapChildrenField || ''];
- if (!childList || !childList.length || childList.every(item => !checkMethod({
- $table,
- row: item
- }))) {
- isDisabled = true;
- }
- } else {
- isVisible = !visibleMethod || visibleMethod({
- $table,
- row
- });
- isDisabled = checkMethod ? !checkMethod({
- $table,
- row
- }) : !!checkMethod;
- }
- if (treeConfig || isRowGroupStatus) {
- indeterminate = !!treeIndeterminateRowMaps[rowid];
- }
- ons.click = evnt => {
- if (!isDisabled && isVisible) {
- $table.triggerCheckRowEvent(evnt, params, !isChecked);
- }
- };
- }
- const checkboxParams = {
- ...params,
- checked: isChecked,
- disabled: isDisabled,
- visible: isVisible,
- indeterminate
- };
- if (checkboxSlot) {
- return renderCellBaseVNs(h, params, $table.callSlot(checkboxSlot, checkboxParams, h));
- }
- const checkVNs = [];
- if (isVisible) {
- checkVNs.push(h('span', {
- 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]
- }));
- }
- if (defaultSlot || labelField) {
- checkVNs.push(h('span', {
- class: 'vxe-checkbox--label'
- }, defaultSlot ? $table.callSlot(defaultSlot, checkboxParams, h) : external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, labelField)));
- }
- return renderCellBaseVNs(h, params, [h('span', {
- class: ['vxe-cell--checkbox', {
- 'is--checked': isChecked,
- 'is--disabled': isDisabled,
- 'is--indeterminate': indeterminate,
- 'is--hidden': !isVisible
- }],
- on: ons
- }, checkVNs)]);
- },
- renderDeepSelectionCell(h, params) {
- return Cell.renderDeepNodeBtn(h, params, Cell.renderCheckboxCell(h, params));
- },
- renderCheckboxCellByProp(h, params) {
- const {
- $table,
- row,
- column,
- isHidden
- } = params;
- const tableProps = $table;
- const tableReactData = $table;
- const tableInternalData = $table;
- const {
- treeConfig
- } = tableProps;
- const {
- updateCheckboxFlag,
- isRowGroupStatus
- } = tableReactData;
- const {
- treeIndeterminateRowMaps
- } = tableInternalData;
- const aggregateOpts = $table.computeAggregateOpts;
- const {
- mapChildrenField
- } = aggregateOpts;
- const checkboxOpts = $table.computeCheckboxOpts;
- const {
- labelField,
- checkField,
- checkMethod,
- visibleMethod
- } = checkboxOpts;
- const indeterminateField = checkboxOpts.indeterminateField || checkboxOpts.halfField;
- const {
- slots
- } = column;
- const defaultSlot = slots ? slots.default : null;
- const checkboxSlot = slots ? slots.checkbox : null;
- let indeterminate = false;
- let isChecked = false;
- let isVisible = true;
- let isDisabled = false;
- const ons = {};
- if (!isHidden) {
- const rowid = getRowid($table, row);
- isChecked = !!updateCheckboxFlag && external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, checkField);
- if (checkMethod && isRowGroupStatus && $table.isAggregateRecord(row)) {
- const childList = row[mapChildrenField || ''];
- if (!childList || !childList.length || childList.every(item => !checkMethod({
- $table,
- row: item
- }))) {
- isDisabled = true;
- }
- } else {
- isVisible = !visibleMethod || visibleMethod({
- $table,
- row
- });
- isDisabled = checkMethod ? !checkMethod({
- $table,
- row
- }) : !!checkMethod;
- }
- if (treeConfig || isRowGroupStatus) {
- indeterminate = !!treeIndeterminateRowMaps[rowid];
- }
- ons.click = evnt => {
- if (!isDisabled && isVisible) {
- $table.triggerCheckRowEvent(evnt, params, !isChecked);
- }
- };
- }
- const checkboxParams = {
- ...params,
- checked: isChecked,
- disabled: isDisabled,
- visible: isVisible,
- indeterminate
- };
- if (checkboxSlot) {
- return renderCellBaseVNs(h, params, $table.callSlot(checkboxSlot, checkboxParams, h));
- }
- const checkVNs = [];
- if (isVisible) {
- checkVNs.push(h('span', {
- 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]
- }));
- }
- if (defaultSlot || labelField) {
- checkVNs.push(h('span', {
- class: 'vxe-checkbox--label'
- }, defaultSlot ? $table.callSlot(defaultSlot, checkboxParams, h) : external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, labelField)));
- }
- return renderCellBaseVNs(h, params, [h('span', {
- class: ['vxe-cell--checkbox', {
- 'is--checked': isChecked,
- 'is--disabled': isDisabled,
- 'is--indeterminate': indeterminateField && !isChecked ? row[indeterminateField] : indeterminate,
- 'is--hidden': !isVisible
- }],
- on: ons
- }, checkVNs)]);
- },
- renderDeepSelectionCellByProp(h, params) {
- return Cell.renderDeepNodeBtn(h, params, Cell.renderCheckboxCellByProp(h, params));
- },
- /**
- * 展开行
- */
- renderExpandCell(h, params) {
- const {
- $table,
- isHidden,
- row,
- column
- } = params;
- const tableReactData = $table;
- const tableInternalData = $table;
- const {
- isRowGroupStatus
- } = tableReactData;
- const {
- rowExpandedMaps,
- rowExpandLazyLoadedMaps
- } = tableInternalData;
- const expandOpts = $table.computeExpandOpts;
- const {
- lazy,
- labelField,
- iconLoaded,
- showIcon,
- iconOpen,
- iconClose,
- visibleMethod
- } = expandOpts;
- const {
- slots
- } = column;
- const defaultSlot = slots ? slots.default : null;
- const iconSlot = slots ? slots.icon : null;
- let isActive = false;
- let isLazyLoading = false;
- if (isRowGroupStatus && row.isAggregate) {
- return renderCellBaseVNs(h, params, []);
- }
- if (iconSlot) {
- return renderCellBaseVNs(h, params, $table.callSlot(iconSlot, params, h));
- }
- if (!isHidden) {
- const rowid = getRowid($table, row);
- isActive = !!rowExpandedMaps[rowid];
- if (lazy) {
- isLazyLoading = !!rowExpandLazyLoadedMaps[rowid];
- }
- }
- return renderCellBaseVNs(h, params, [showIcon && (!visibleMethod || visibleMethod(params)) ? h('span', {
- class: ['vxe-table--expanded', {
- 'is--active': isActive
- }],
- on: {
- mousedown(evnt) {
- evnt.stopPropagation();
- },
- click(evnt) {
- $table.triggerRowExpandEvent(evnt, params);
- }
- }
- }, [h('i', {
- 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]
- })]) : renderEmptyElement($table), defaultSlot || labelField ? h('span', {
- class: 'vxe-table--expand-label'
- }, defaultSlot ? $table.callSlot(defaultSlot, params, h) : external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, labelField)) : renderEmptyElement($table)]);
- },
- renderExpandData(h, params) {
- const {
- $table,
- column
- } = params;
- const {
- slots,
- contentRender
- } = column;
- if (slots && slots.content) {
- return $table.callSlot(slots.content, params, h);
- }
- if (contentRender) {
- const compConf = cell_renderer.get(contentRender.name);
- const rtExpand = compConf ? compConf.renderTableExpand || compConf.renderExpand : null;
- if (rtExpand) {
- return getSlotVNs(rtExpand.call($table, h, contentRender, params));
- }
- }
- return [];
- },
- /**
- * HTML 标签
- */
- renderHTMLCell(h, params) {
- const {
- $table,
- column
- } = params;
- const {
- slots
- } = column;
- if (slots && slots.default) {
- return renderCellBaseVNs(h, params, $table.callSlot(slots.default, params, h));
- }
- return renderCellBaseVNs(h, params, [h('span', {
- class: 'vxe-cell--html',
- domProps: {
- innerHTML: getDefaultCellLabel(params)
- }
- })]);
- },
- renderDeepHTMLCell(h, params) {
- return Cell.renderDeepNodeBtn(h, params, Cell.renderHTMLCell(h, params));
- },
- /**
- * 排序和筛选
- */
- renderSortAndFilterHeader(h, params) {
- return renderHeaderCellBaseVNs(h, params, Cell.renderHeaderTitle(h, params).concat(Cell.renderSortIcon(h, params).concat(Cell.renderFilterIcon(h, params))));
- },
- /**
- * 排序
- */
- renderSortHeader(h, params) {
- return renderHeaderCellBaseVNs(h, params, Cell.renderHeaderTitle(h, params).concat(Cell.renderSortIcon(h, params)));
- },
- renderSortIcon(h, params) {
- const {
- $table,
- column
- } = params;
- const sortOpts = $table.computeSortOpts;
- const {
- showIcon,
- allowBtn,
- ascTitle,
- descTitle,
- iconLayout,
- iconAsc,
- iconDesc,
- iconVisibleMethod
- } = sortOpts;
- if (showIcon && (!iconVisibleMethod || iconVisibleMethod(params))) {
- return [h('span', {
- class: ['vxe-cell--sort', `vxe-cell--sort-${iconLayout}-layout`]
- }, [h('i', {
- class: ['vxe-sort--asc-btn', iconAsc || cell_getIcon().TABLE_SORT_ASC, {
- 'sort--active': column.order === 'asc'
- }],
- attrs: {
- title: external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(ascTitle) ? cell_getI18n('vxe.table.sortAsc') : `${ascTitle || ''}`
- },
- on: allowBtn ? {
- click(evnt) {
- evnt.stopPropagation();
- $table.triggerSortEvent(evnt, column, 'asc');
- }
- } : undefined
- }), h('i', {
- class: ['vxe-sort--desc-btn', iconDesc || cell_getIcon().TABLE_SORT_DESC, {
- 'sort--active': column.order === 'desc'
- }],
- attrs: {
- title: external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(descTitle) ? cell_getI18n('vxe.table.sortDesc') : `${descTitle || ''}`
- },
- on: allowBtn ? {
- click(evnt) {
- evnt.stopPropagation();
- $table.triggerSortEvent(evnt, column, 'desc');
- }
- } : undefined
- })])];
- }
- return [];
- },
- /**
- * 筛选
- */
- renderFilterHeader(h, params) {
- return renderHeaderCellBaseVNs(h, params, Cell.renderHeaderTitle(h, params).concat(Cell.renderFilterIcon(h, params)));
- },
- renderFilterIcon(h, params) {
- const {
- $table,
- column,
- hasFilter
- } = params;
- const tableReactData = $table;
- const {
- filterStore
- } = tableReactData;
- const filterOpts = $table.computeFilterOpts;
- const {
- showIcon,
- iconNone,
- iconMatch,
- iconVisibleMethod
- } = filterOpts;
- if (showIcon && (!iconVisibleMethod || iconVisibleMethod(params))) {
- return [h('span', {
- class: ['vxe-cell--filter', {
- 'is--active': filterStore.visible && filterStore.column === column
- }],
- on: {
- click(evnt) {
- if ($table.triggerFilterEvent) {
- $table.triggerFilterEvent(evnt, params.column, params);
- }
- }
- }
- }, [h('i', {
- class: ['vxe-filter--btn', hasFilter ? iconMatch || cell_getIcon().TABLE_FILTER_MATCH : iconNone || cell_getIcon().TABLE_FILTER_NONE],
- attrs: {
- title: cell_getI18n('vxe.table.filter')
- }
- })])];
- }
- return [];
- },
- /**
- * 可编辑
- */
- renderEditHeader(h, params) {
- const {
- $table,
- column
- } = params;
- const tableProps = $table;
- const {
- editConfig,
- editRules
- } = tableProps;
- const editOpts = $table.computeEditOpts;
- const {
- sortable,
- filters,
- editRender
- } = column;
- let isRequired = false;
- if (editRules) {
- const columnRules = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(editRules, column.field);
- if (columnRules) {
- isRequired = columnRules.some(rule => rule.required);
- }
- }
- let editIconVNs = [];
- if (isEnableConf(editConfig)) {
- const {
- showAsterisk,
- showIcon,
- icon
- } = editOpts;
- editIconVNs = [isRequired && showAsterisk ? h('i', {
- class: 'vxe-cell--required-icon'
- }, [h('i', {
- class: 'vxe-cell--required-icon'
- })]) : renderEmptyElement($table), isEnableConf(editRender) && showIcon ? h('i', {
- class: 'vxe-cell--edit-icon'
- }, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(icon) ? getSlotVNs(icon({})) : [h('i', {
- class: icon || cell_getIcon().TABLE_EDIT
- })]) : renderEmptyElement($table)];
- }
- return renderHeaderCellBaseVNs(h, params, editIconVNs.concat(Cell.renderHeaderTitle(h, params)).concat(sortable ? Cell.renderSortIcon(h, params) : []).concat(filters ? Cell.renderFilterIcon(h, params) : []));
- },
- // 行格编辑模式
- renderRowEdit(h, params) {
- const {
- $table,
- column
- } = params;
- const tableReactData = $table;
- const {
- editStore
- } = tableReactData;
- const {
- actived
- } = editStore;
- const {
- editRender
- } = column;
- return Cell.runRenderer(h, params, this, isEnableConf(editRender) && actived && actived.row === params.row);
- },
- renderDeepRowEdit(h, params) {
- return Cell.renderDeepNodeBtn(h, params, Cell.renderRowEdit(h, params));
- },
- // 单元格编辑模式
- renderCellEdit(h, params) {
- const {
- $table,
- column
- } = params;
- const tableReactData = $table;
- const {
- editStore
- } = tableReactData;
- const {
- actived
- } = editStore;
- const {
- editRender
- } = column;
- return Cell.runRenderer(h, params, this, isEnableConf(editRender) && actived && actived.row === params.row && actived.column === params.column);
- },
- renderDeepCellEdit(h, params) {
- return Cell.renderDeepNodeBtn(h, params, Cell.renderCellEdit(h, params));
- },
- runRenderer(h, params, _vm, isEdit) {
- const {
- $table,
- row,
- column
- } = params;
- const tableReactData = $table;
- const {
- isRowGroupStatus
- } = tableReactData;
- const {
- slots,
- field,
- editRender,
- formatter
- } = column;
- const compConf = cell_renderer.get(editRender.name);
- const rtEdit = compConf ? compConf.renderTableEdit || compConf.renderEdit : null;
- const defaultSlot = slots ? slots.default : null;
- const gcSlot = slots ? slots.groupContent || slots['group-content'] : null;
- const cellParams = Object.assign({
- $type: '',
- isEdit
- }, params);
- if (isEdit) {
- if (slots && slots.edit) {
- return $table.callSlot(slots.edit, cellParams, h);
- }
- if (rtEdit) {
- return getSlotVNs(rtEdit.call($table, h, editRender, cellParams));
- }
- return [];
- }
- if (isRowGroupStatus && field && row.isAggregate) {
- const aggRow = row;
- const aggregateOpts = $table.computeAggregateOpts;
- const {
- mapChildrenField
- } = aggregateOpts;
- const groupField = aggRow.groupField;
- const groupContent = aggRow.groupContent;
- const childList = mapChildrenField ? aggRow[mapChildrenField] || [] : [];
- const childCount = aggRow.childCount;
- if (gcSlot) {
- return renderCellBaseVNs(h, params, $table.callSlot(gcSlot, Object.assign({
- groupField,
- groupContent,
- childList,
- childCount
- }, params), h));
- }
- } else {
- if (defaultSlot) {
- return renderCellBaseVNs(h, params, $table.callSlot(defaultSlot, cellParams, h));
- }
- }
- if (formatter) {
- return renderCellBaseVNs(h, params, [h('span', {
- class: 'vxe-cell--label'
- }, [getDefaultCellLabel(cellParams)])]);
- }
- return Cell.renderDefaultCell.call(_vm, h, cellParams);
- }
- };
- /* harmony default export */ var cell = (Cell);
- ;// CONCATENATED MODULE: ./packages/ui/src/comp.ts
- const defineVxeComponent = options => options;
- ;// CONCATENATED MODULE: ./packages/table/src/column.ts
- const columnProps = {
- // 列唯一主键
- colId: [String, Number],
- // 渲染类型 seq,radio,checkbox,expand,html
- type: String,
- // 列字段名
- field: String,
- // 列标题
- title: String,
- // 列宽度
- width: [Number, String],
- // 列最小宽度,把剩余宽度按比例分配
- minWidth: [Number, String],
- // 列最大宽度
- maxWidth: [Number, String],
- // 是否允许拖动列宽调整大小
- resizable: {
- type: Boolean,
- default: null
- },
- // 将列固定在左侧或者右侧
- fixed: String,
- // 列对其方式
- align: String,
- // 表头对齐方式
- headerAlign: String,
- // 表尾列的对齐方式
- footerAlign: String,
- // 当内容过长时显示为省略号
- showOverflow: {
- type: [Boolean, String],
- default: null
- },
- // 当表头内容过长时显示为省略号
- showHeaderOverflow: {
- type: [Boolean, String],
- default: null
- },
- // 当表尾内容过长时显示为省略号
- showFooterOverflow: {
- type: [Boolean, String],
- default: null
- },
- // 给单元格附加 className
- className: [String, Function],
- // 给表头单元格附加 className
- headerClassName: [String, Function],
- // 给表尾单元格附加 className
- footerClassName: [String, Function],
- // 格式化显示内容
- formatter: [Function, Array, String],
- // 格式化表头显示内容
- headerFormatter: [Function, Array, String],
- // 格式化表尾显示内容
- footerFormatter: [Function, Array, String],
- // 是否显示间距
- padding: {
- type: Boolean,
- default: null
- },
- // 垂直对齐方式
- verticalAlign: {
- type: String,
- default: null
- },
- // 是否允许排序
- sortable: Boolean,
- // 在 v3 中废弃
- remoteSort: {
- type: Boolean,
- default: null
- },
- // 在 v3 中只支持字符串类型
- sortBy: [String, Function],
- // 排序的字段类型,比如字符串转数值等
- sortType: String,
- // 在 v3 中废弃
- sortMethod: Function,
- // 配置筛选条件数组
- filters: {
- type: Array,
- default: null
- },
- // 筛选是否允许多选
- filterMultiple: {
- type: Boolean,
- default: true
- },
- // 自定义筛选方法
- filterMethod: Function,
- // 筛选重置方法
- filterResetMethod: Function,
- // 筛选复原方法
- filterRecoverMethod: Function,
- // 筛选模板配置项
- filterRender: Object,
- // 是否显示浮动筛选
- floatingFilters: Object,
- // 设置为分组节点
- rowGroupNode: Boolean,
- // 设置为树节点
- treeNode: Boolean,
- // 设置为拖拽排序
- dragSort: Boolean,
- // 设置为行高拖拽
- rowResize: Boolean,
- // 是否可视
- visible: {
- type: Boolean,
- default: null
- },
- // 表头单元格数据导出方法
- headerExportMethod: Function,
- // 单元格数据导出方法
- exportMethod: Function,
- // 表尾单元格数据导出方法
- footerExportMethod: Function,
- // 已废弃,被 titlePrefix 替换
- titleHelp: Object,
- // 标题前缀图标配置项
- titlePrefix: Object,
- // 标题后缀图标配置项
- titleSuffix: Object,
- // 单元格值类型
- cellType: String,
- // 单元格渲染配置项
- cellRender: Object,
- // 单元格编辑渲染配置项
- editRender: Object,
- // 内容渲染配置项
- contentRender: Object,
- // 聚合函数
- aggFunc: [String, Boolean],
- // 额外的参数
- params: Object
- };
- const columnWatch = {};
- Object.keys(columnProps).forEach(name => {
- columnWatch[name] = function (value) {
- const $xeTable = this.$xeTable;
- this.columnConfig.update(name, value);
- if ($xeTable) {
- if (name === 'filters') {
- $xeTable.setFilter(this.columnConfig, value);
- $xeTable.handleUpdateDataQueue();
- } else if (['visible', 'fixed', 'width', 'minWidth', 'maxWidth'].includes(name)) {
- $xeTable.handleRefreshColumnQueue();
- }
- }
- };
- });
- /* harmony default export */ var column = (/* define-vxe-component start */defineVxeComponent({
- name: 'VxeColumn',
- props: columnProps,
- provide() {
- return {
- $xeColumn: this,
- $xeGrid: null,
- $xeGantt: null
- };
- },
- inject: {
- $xeTable: {
- default: null
- },
- $xeColumn: {
- default: null
- }
- },
- watch: columnWatch,
- created() {
- const $xeTable = this.$xeTable;
- this.columnConfig = this.createColumn($xeTable, this);
- },
- mounted() {
- this.columnConfig.slots = this.$scopedSlots;
- assembleColumn(this);
- },
- destroyed() {
- destroyColumn(this);
- },
- render(h) {
- return h('div', this.$slots.default);
- },
- methods: cell
- })); /* define-vxe-component end */
- ;// CONCATENATED MODULE: ./packages/column/index.ts
- const VxeColumn = Object.assign({}, column, {
- install(app) {
- app.component(column.name, column);
- // 兼容旧用法
- app.component('VxeTableColumn', column);
- }
- });
- if (core_.VxeUI.dynamicApp) {
- core_.VxeUI.dynamicApp.component(column.name, column);
- // 兼容旧用法
- core_.VxeUI.dynamicApp.component('VxeTableColumn', column);
- }
- core_.VxeUI.component(column);
- const Column = VxeColumn;
- /* harmony default export */ var packages_column = ((/* unused pure expression or super */ null && (VxeColumn)));
- ;// CONCATENATED MODULE: ./packages/table/src/group.ts
- /* harmony default export */ var group = (/* define-vxe-component start */defineVxeComponent({
- name: 'VxeColgroup',
- props: columnProps,
- provide() {
- return {
- $xeColumn: this,
- $xeGrid: null,
- $xeGantt: null
- };
- },
- inject: {
- $xeTable: {
- default: null
- },
- $xeColumn: {
- default: null
- }
- },
- watch: columnWatch,
- created() {
- const $xeTable = this.$xeTable;
- this.columnConfig = this.createColumn($xeTable, this);
- },
- mounted() {
- const {
- $scopedSlots
- } = this;
- const columnSlots = {};
- if ($scopedSlots.header) {
- columnSlots.header = $scopedSlots.header;
- }
- this.columnConfig.slots = columnSlots;
- assembleColumn(this);
- },
- destroyed() {
- destroyColumn(this);
- },
- render(h) {
- return h('div', this.$slots.default);
- },
- methods: cell
- })); /* define-vxe-component end */
- ;// CONCATENATED MODULE: ./packages/colgroup/index.ts
- const VxeColgroup = Object.assign({}, group, {
- install(app) {
- app.component(group.name, group);
- // 兼容旧用法
- app.component('VxeTableColgroup', group);
- }
- });
- if (core_.VxeUI.dynamicApp) {
- core_.VxeUI.dynamicApp.component(group.name, group);
- // 兼容旧用法
- core_.VxeUI.dynamicApp.component('VxeTableColgroup', group);
- }
- core_.VxeUI.component(group);
- const Colgroup = VxeColgroup;
- /* harmony default export */ var colgroup = ((/* unused pure expression or super */ null && (VxeColgroup)));
- ;// CONCATENATED MODULE: ./packages/table/src/props.ts
- const {
- getConfig: props_getConfig
- } = core_.VxeUI;
- const tableProps = {
- /** 基本属性 */
- id: [String, Function],
- // 数据
- data: Array,
- // 表格的高度
- height: [Number, String],
- // 表格的最小高度
- minHeight: {
- type: [Number, String],
- default: () => null
- },
- // 表格的最大高度
- maxHeight: [Number, String],
- // 已废弃,被 column-config.resizable 替换
- resizable: {
- type: Boolean,
- default: () => props_getConfig().table.resizable
- },
- // 是否带有斑马纹
- stripe: {
- type: Boolean,
- default: () => props_getConfig().table.stripe
- },
- // 是否带有边框
- border: {
- type: [Boolean, String],
- default: () => props_getConfig().table.border
- },
- // 已废弃,被 cell-config.padding 替换
- padding: {
- type: Boolean,
- default: null
- },
- // 是否圆角边框
- round: {
- type: Boolean,
- default: () => props_getConfig().table.round
- },
- // 表格的尺寸
- size: {
- type: String,
- default: () => props_getConfig().table.size || props_getConfig().size
- },
- // 列的宽度是否自撑开(可能会被废弃的参数,不要使用)
- fit: {
- type: Boolean,
- default: () => props_getConfig().table.fit
- },
- // 表格是否加载中
- loading: Boolean,
- // 所有的列对其方式
- align: {
- type: String,
- default: () => props_getConfig().table.align
- },
- // 所有的表头列的对齐方式
- headerAlign: {
- type: String,
- default: () => props_getConfig().table.headerAlign
- },
- // 所有的表尾列的对齐方式
- footerAlign: {
- type: String,
- default: () => props_getConfig().table.footerAlign
- },
- // 是否显示表头
- showHeader: {
- type: Boolean,
- default: () => props_getConfig().table.showHeader
- },
- // 已废弃,被 row-config.isCurrent 替换
- highlightCurrentRow: {
- type: Boolean,
- default: () => props_getConfig().table.highlightCurrentRow
- },
- // 已废弃,被 row-config.isHover 替换
- highlightHoverRow: {
- type: Boolean,
- default: () => props_getConfig().table.highlightHoverRow
- },
- /**
- * (即将废弃)是否要高亮当前选中列
- * @deprecated
- */
- highlightCurrentColumn: {
- type: Boolean,
- default: () => props_getConfig().table.highlightCurrentColumn
- },
- /**
- * (即将废弃)鼠标移到列是否要高亮显示
- * @deprecated
- */
- highlightHoverColumn: {
- type: Boolean,
- default: () => props_getConfig().table.highlightHoverColumn
- },
- // 已废弃,直接删除
- highlightCell: Boolean,
- // 是否显示表尾合计
- showFooter: Boolean,
- // 表尾数据
- footerData: Array,
- // 表尾合计的计算方法
- footerMethod: Function,
- // 给行附加 className
- rowClassName: [String, Function],
- // 给单元格附加 className
- cellClassName: [String, Function],
- // 给表头的行附加 className
- headerRowClassName: [String, Function],
- // 给表头的单元格附加 className
- headerCellClassName: [String, Function],
- // 给表尾的行附加 className
- footerRowClassName: [String, Function],
- // 给表尾的单元格附加 className
- footerCellClassName: [String, Function],
- // 给单元格附加样式
- cellStyle: [Object, Function],
- // 给表头单元格附加样式
- headerCellStyle: [Object, Function],
- // 给表尾单元格附加样式
- footerCellStyle: [Object, Function],
- // 给行附加样式
- rowStyle: [Object, Function],
- // 给表头行附加样式
- headerRowStyle: [Object, Function],
- // 给表尾行附加样式
- footerRowStyle: [Object, Function],
- // 用于分组表头,显示为自定义列头,配合 mergeHeaderCells 灵活实现自定义合并
- showCustomHeader: {
- type: Boolean,
- default: () => props_getConfig().table.showCustomHeader
- },
- // 临时合并指定的表头单元格
- mergeHeaderCells: Array,
- // 临时合并指定的单元格
- mergeCells: Array,
- // 临时合并指定的表尾单元格
- mergeFooterCells: Array,
- mergeFooterItems: Array,
- // 自定义合并行或列的方法
- spanMethod: Function,
- // 表尾合并行或列
- footerSpanMethod: Function,
- // 设置所有内容过长时显示为省略号
- showOverflow: {
- type: [Boolean, String],
- default: () => props_getConfig().table.showOverflow
- },
- // 设置表头所有内容过长时显示为省略号
- showHeaderOverflow: {
- type: [Boolean, String],
- default: () => props_getConfig().table.showHeaderOverflow
- },
- // 设置表尾所有内容过长时显示为省略号
- showFooterOverflow: {
- type: [Boolean, String],
- default: () => props_getConfig().table.showFooterOverflow
- },
- /** 高级属性 */
- /**
- * (即将废弃)columnKey 已废弃,被 column-config.useKey 替换
- * @deprecated
- */
- columnKey: Boolean,
- /**
- * (即将废弃)rowKey 已废弃,被 row-config.useKey 替换
- * @deprecated
- */
- rowKey: Boolean,
- /**
- * (即将废弃)rowId 已废弃,被 row-config.keyField 替换
- * @deprecated
- */
- rowId: {
- type: String,
- default: () => props_getConfig().table.rowId
- },
- zIndex: Number,
- emptyText: {
- type: String,
- default: () => props_getConfig().table.emptyText
- },
- keepSource: {
- type: Boolean,
- default: () => props_getConfig().table.keepSource
- },
- // 是否自动监听父容器变化去更新响应式表格宽高
- autoResize: {
- type: Boolean,
- default: () => props_getConfig().table.autoResize
- },
- // 是否自动根据状态属性去更新响应式表格宽高
- syncResize: [Boolean, String, Number],
- // 响应式布局配置项
- resizeConfig: Object,
- // 列配置项
- columnConfig: Object,
- // 当前列配置项
- currentColumnConfig: Object,
- // 单元格配置项
- cellConfig: Object,
- // 表头单元格配置项
- headerCellConfig: Object,
- // 表尾单元格配置项
- footerCellConfig: Object,
- // 行配置项
- rowConfig: Object,
- // 数据聚合配置项
- aggregateConfig: Object,
- /**
- * 已废弃,被 aggregateConfig 替换
- * @deprecated
- */
- rowGroupConfig: Object,
- // 当前行配置项
- currentRowConfig: Object,
- /**
- * 已废弃,被 rowDragConfig 替换
- * @deprecated
- */
- dragConfig: Object,
- // 行拖拽排序配置项
- rowDragConfig: Object,
- // 列拖拽排序配置项
- columnDragConfig: Object,
- // 列调整配置项
- resizableConfig: Object,
- // 序号配置项
- seqConfig: Object,
- // 排序配置项
- sortConfig: Object,
- // 筛选配置项
- filterConfig: Object,
- // 浮动筛选配置项
- floatingFilterConfig: Object,
- // 单选框配置
- radioConfig: Object,
- // 复选框配置项
- checkboxConfig: Object,
- // tooltip 配置项
- tooltipConfig: Object,
- // 表头 tooltip 配置项
- headerTooltipConfig: Object,
- // 表尾 tooltip 配置项
- footerTooltipConfig: Object,
- // 导出配置项
- exportConfig: [Boolean, Object],
- // 导入配置项
- importConfig: [Boolean, Object],
- // 打印配置项
- printConfig: Object,
- // 展开行配置项
- expandConfig: Object,
- // 树形结构配置项
- treeConfig: [Boolean, Object],
- // 快捷菜单配置项
- menuConfig: [Boolean, Object],
- /**
- * 在 v4 中废弃 contextMenu
- * @deprecated
- */
- contextMenu: [Boolean, Object],
- // 鼠标配置项
- mouseConfig: Object,
- // 区域配置项
- areaConfig: Object,
- // 按键配置项
- keyboardConfig: Object,
- // 复制/粘贴配置项
- clipConfig: Object,
- // 查找/替换配置项
- fnrConfig: Object,
- // 编辑配置项
- editConfig: [Boolean, Object],
- // 校验配置项
- validConfig: Object,
- // 校验规则配置项
- editRules: Object,
- // 加载中配置项
- loadingConfig: Object,
- // 空内容渲染配置项
- emptyRender: [Boolean, Object],
- // 自定义列配置项
- customConfig: Object,
- /**
- * (即将废弃)横向虚拟滚动配置项
- * @deprecated
- */
- scrollX: Object,
- /**
- * (即将废弃)纵向虚拟滚动配置项
- * @deprecated
- */
- scrollY: Object,
- // 横向虚拟滚动配置项
- virtualXConfig: Object,
- // 纵向虚拟滚动配置项
- virtualYConfig: Object,
- // 滚动条配置项
- scrollbarConfig: Object,
- // (即将废弃)优化相关
- animat: {
- type: Boolean,
- default: () => props_getConfig().table.animat
- },
- // (可能会被废弃的参数,不要使用)
- delayHover: {
- type: Number,
- default: () => props_getConfig().table.delayHover
- },
- // 额外的参数
- params: Object
- };
- ;// CONCATENATED MODULE: ./packages/table/src/anime.ts
- const rowMoveCls = 'row--drag-move';
- const colMoveClass = 'col--drag-move';
- /**
- * 上下拖拽
- */
- function moveRowAnimateToTb(elemList, offsetTop) {
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayEach(elemList, trEl => {
- trEl.style.transform = `translateY(${offsetTop}px)`;
- });
- requestAnimationFrame(() => {
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayEach(elemList, trEl => {
- addClass(trEl, rowMoveCls);
- trEl.style.transform = '';
- });
- });
- }
- function clearRowAnimate(elem, clss) {
- setTimeout(() => {
- if (elem) {
- 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));
- }
- }, 500);
- }
- /**
- * 左右拖拽
- */
- function moveColAnimateToLr(elemList, offsetLeft) {
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayEach(elemList, trEl => {
- trEl.style.transform = `translateX(${offsetLeft}px)`;
- });
- requestAnimationFrame(() => {
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayEach(elemList, trEl => {
- addClass(trEl, colMoveClass);
- trEl.style.transform = '';
- });
- });
- }
- function clearColAnimate(elem, clss) {
- setTimeout(() => {
- if (elem) {
- 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));
- }
- }, 500);
- }
- ;// CONCATENATED MODULE: ./packages/table/src/store.ts
- // 跨表拖拽
- const crossTableDragRowGlobal = {
- row: null
- };
- function getCrossTableDragRowInfo($xeTable) {
- const crossTableDragRowInfo = $xeTable.crossTableDragRowInfo;
- return crossTableDragRowInfo;
- }
- ;// CONCATENATED MODULE: ./packages/table/src/methods.ts
- const {
- getConfig: methods_getConfig,
- getI18n: methods_getI18n,
- renderer: methods_renderer,
- formats: methods_formats,
- interceptor: methods_interceptor,
- createEvent
- } = core_.VxeUI;
- const browseObj = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().browse();
- const supportMaxRow = 5e6;
- const customStorageKey = 'VXE_CUSTOM_STORE';
- const maxYHeight = 5e6;
- const maxXWidth = 5e6;
- let crossTableDragRowObj = null;
- function eqCellValue(row1, row2, field) {
- const val1 = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row1, field);
- const val2 = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row2, field);
- if (eqEmptyValue(val1) && eqEmptyValue(val2)) {
- return true;
- }
- 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)) {
- return '' + val1 === '' + val2;
- }
- return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isEqual(val1, val2);
- }
- function hangleStorageDefaultValue(value, isAll) {
- return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isBoolean(value) ? value : isAll;
- }
- function getNextSortOrder($xeTable, column) {
- const sortOpts = $xeTable.computeSortOpts;
- const {
- orders = []
- } = sortOpts;
- const currOrder = column.order || null;
- const oIndex = orders.indexOf(currOrder) + 1;
- return orders[oIndex < orders.length ? oIndex : 0];
- }
- const getCustomStorageMap = id => {
- const version = methods_getConfig().version;
- const rest = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toStringJSON(localStorage.getItem(customStorageKey) || '');
- const maps = rest && rest._v === version ? rest : {
- _v: version
- };
- return (id ? maps[id] : maps) || {};
- };
- const setCustomStorageMap = (id, data) => {
- const version = methods_getConfig().version;
- const maps = getCustomStorageMap();
- maps[id] = data || undefined;
- maps._v = version;
- localStorage.setItem(customStorageKey, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toJSONString(maps));
- };
- const getRecoverRowMaps = ($xeTable, keyMaps) => {
- const internalData = $xeTable;
- const {
- fullAllDataRowIdData
- } = internalData;
- const restKeys = {};
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(keyMaps, (row, rowid) => {
- if (fullAllDataRowIdData[rowid]) {
- restKeys[rowid] = row;
- }
- });
- return restKeys;
- };
- function handleReserveRow($xeTable, reserveRowMap) {
- const internalData = $xeTable;
- const {
- fullDataRowIdData
- } = internalData;
- const reserveList = [];
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(reserveRowMap, (item, rowid) => {
- if (fullDataRowIdData[rowid] && reserveList.indexOf(fullDataRowIdData[rowid].row) === -1) {
- reserveList.push(fullDataRowIdData[rowid].row);
- }
- });
- return reserveList;
- }
- function handleVirtualXVisible($xeTable) {
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- isScrollXBig,
- scrollXWidth
- } = reactData;
- const {
- elemStore,
- visibleColumn,
- fullColumnIdData
- } = internalData;
- const leftFixedWidth = $xeTable.computeLeftFixedWidth;
- const rightFixedWidth = $xeTable.computeRightFixedWidth;
- const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
- if (bodyScrollElem) {
- const clientWidth = bodyScrollElem.clientWidth;
- let scrollLeft = bodyScrollElem.scrollLeft;
- if (isScrollXBig) {
- scrollLeft = Math.ceil((scrollXWidth - clientWidth) * Math.min(1, scrollLeft / (maxXWidth - clientWidth)));
- }
- const startLeft = scrollLeft + leftFixedWidth;
- const endLeft = scrollLeft + clientWidth - rightFixedWidth;
- let leftIndex = 0;
- let rightIndex = visibleColumn.length;
- while (leftIndex < rightIndex) {
- const cIndex = Math.floor((leftIndex + rightIndex) / 2);
- const column = visibleColumn[cIndex];
- const colid = column.id;
- const colRest = fullColumnIdData[colid] || {};
- if (colRest.oLeft <= startLeft) {
- leftIndex = cIndex + 1;
- } else {
- rightIndex = cIndex;
- }
- }
- let visibleSize = 0;
- const toVisibleIndex = leftIndex === visibleColumn.length ? leftIndex : Math.max(0, leftIndex < visibleColumn.length ? leftIndex - 2 : 0);
- for (let cIndex = toVisibleIndex, cLen = visibleColumn.length; cIndex < cLen; cIndex++) {
- const column = visibleColumn[cIndex];
- const colid = column.id;
- const colRest = fullColumnIdData[colid] || {};
- visibleSize++;
- if (colRest.oLeft > endLeft || visibleSize >= 60) {
- break;
- }
- }
- return {
- toVisibleIndex: Math.max(0, toVisibleIndex),
- visibleSize: Math.max(6, visibleSize)
- };
- }
- return {
- toVisibleIndex: 0,
- visibleSize: 6
- };
- }
- function handleCustomRestore($xeTable, storeData) {
- const props = $xeTable;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- aggregateConfig,
- rowGroupConfig
- } = props;
- const {
- collectColumn
- } = internalData;
- const customOpts = $xeTable.computeCustomOpts;
- const {
- storage,
- storeOptions
- } = customOpts;
- const isAllCustom = storage === true;
- const storageOpts = isAllCustom ? {} : Object.assign({}, storage || {}, storeOptions);
- const isCustomResizable = hangleStorageDefaultValue(storageOpts.resizable, isAllCustom);
- const isCustomVisible = hangleStorageDefaultValue(storageOpts.visible, isAllCustom);
- const isCustomFixed = hangleStorageDefaultValue(storageOpts.fixed, isAllCustom);
- const isCustomSort = hangleStorageDefaultValue(storageOpts.sort, isAllCustom);
- const isCustomAggGroup = hangleStorageDefaultValue(storageOpts.aggGroup, isAllCustom);
- const isCustomAggFunc = hangleStorageDefaultValue(storageOpts.aggFunc, isAllCustom);
- let {
- resizableData,
- sortData,
- visibleData,
- fixedData,
- aggGroupData,
- aggFuncData
- } = storeData;
- // 处理还原
- if (isCustomResizable && resizableData || isCustomSort && sortData || isCustomVisible && visibleData || isCustomFixed && fixedData || isCustomAggGroup && aggGroupData || isCustomAggFunc && aggFuncData) {
- const sortColMaps = {};
- if (isCustomSort && sortData) {
- // 转换兼容老版本数据,即将废弃兼容
- if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(sortData)) {
- const sortRests = [];
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(sortData, (index, colKey) => {
- sortRests.push({
- key: colKey,
- index
- });
- });
- sortData = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().orderBy(sortRests, {
- field: 'index',
- order: 'asc'
- }).map(item => ({
- k: item.key
- }));
- }
- let colNum = 1;
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(sortData, (sObj, index, sOjs, path, pSObj) => {
- sortColMaps[sObj.k] = {
- key: sObj.k,
- sNum: colNum++,
- pKey: pSObj ? pSObj.k : null
- };
- }, {
- children: 'c'
- });
- }
- const colKeyMaps = {};
- const allCols = [];
- const aggGroupConfs = [];
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(collectColumn, (column, index, items, path, parentColumn) => {
- const colKey = column.getKey();
- // 支持一级
- if (!parentColumn) {
- if (isCustomFixed && fixedData && fixedData[colKey] !== undefined) {
- column.fixed = fixedData[colKey];
- }
- }
- if (isCustomResizable && resizableData && external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(resizableData[colKey])) {
- column.resizeWidth = resizableData[colKey];
- }
- if (isCustomVisible && visibleData && external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isBoolean(visibleData[colKey])) {
- column.visible = visibleData[colKey];
- }
- if (isCustomAggFunc && aggFuncData && (aggregateConfig || rowGroupConfig) && aggFuncData[colKey]) {
- column.aggFunc = aggFuncData[colKey];
- }
- if (isCustomAggGroup && aggGroupData && aggGroupData[colKey]) {
- aggGroupConfs.push({
- field: column.field
- });
- }
- colKeyMaps[colKey] = column;
- allCols.push(column);
- });
- if ((aggregateConfig || rowGroupConfig) && aggGroupConfs.length) {
- const groupRest = handleGroupData($xeTable, internalData.tableFullData, aggGroupConfs);
- internalData.tableFullTreeData = [];
- internalData.tableFullGroupData = groupRest.treeData;
- reactData.isRowGroupStatus = true;
- reactData.rowGroupList = aggGroupConfs;
- $xeTable.cacheRowMap(false);
- }
- // 如果自定义了顺序
- if (isCustomSort && sortData) {
- allCols.forEach(column => {
- const colKey = column.getKey();
- const scItem = sortColMaps[colKey];
- if (scItem) {
- const parentColumn = scItem.pKey ? colKeyMaps[scItem.pKey] : null;
- column.parentId = parentColumn ? parentColumn.id : null;
- column.renderSortNumber = scItem.sNum;
- }
- });
- 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'), {
- key: 'id',
- parentKey: 'parentId',
- children: 'children'
- });
- internalData.collectColumn = newCollectCols;
- internalData.tableFullColumn = getColumnList(newCollectCols);
- }
- reactData.isCustomStatus = true;
- } else {
- reactData.isCustomStatus = false;
- }
- }
- /**
- * 还原自定义列操作状态
- */
- function restoreCustomStorage($xeTable) {
- const props = $xeTable;
- const {
- customConfig
- } = props;
- const tableId = $xeTable.computeTableId;
- const customOpts = $xeTable.computeCustomOpts;
- const {
- storage,
- restoreStore,
- storeOptions
- } = customOpts;
- const isAllCustom = storage === true;
- const storageOpts = isAllCustom ? {} : Object.assign({}, storage || {}, storeOptions);
- const isCustomResizable = hangleStorageDefaultValue(storageOpts.resizable, isAllCustom);
- const isCustomVisible = hangleStorageDefaultValue(storageOpts.visible, isAllCustom);
- const isCustomFixed = hangleStorageDefaultValue(storageOpts.fixed, isAllCustom);
- const isCustomSort = hangleStorageDefaultValue(storageOpts.sort, isAllCustom);
- const isCustomAggFunc = hangleStorageDefaultValue(storageOpts.aggFunc, isAllCustom);
- if (storage && (customConfig ? isEnableConf(customOpts) : customOpts.enabled) && (isCustomResizable || isCustomVisible || isCustomFixed || isCustomSort || isCustomAggFunc)) {
- if (!tableId) {
- errLog('vxe.error.reqProp', ['id']);
- return;
- }
- const storeData = getCustomStorageMap(tableId);
- if (restoreStore) {
- return Promise.resolve(restoreStore({
- $table: $xeTable,
- id: tableId,
- type: 'restore',
- storeData
- })).then(storeData => {
- if (!storeData) {
- return;
- }
- return handleCustomRestore($xeTable, storeData);
- }).catch(e => e);
- } else {
- return handleCustomRestore($xeTable, storeData);
- }
- }
- }
- /**
- * 更新数据列的 Map
- * 牺牲数据组装的耗时,用来换取使用过程中的流畅
- */
- function cacheColumnMap($xeTable) {
- const props = $xeTable;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- treeConfig,
- showOverflow
- } = props;
- const {
- tableFullColumn,
- collectColumn
- } = internalData;
- const fullColIdData = internalData.fullColumnIdData = {};
- const fullColFieldData = internalData.fullColumnFieldData = {};
- const mouseOpts = $xeTable.computeMouseOpts;
- const expandOpts = $xeTable.computeExpandOpts;
- const columnOpts = $xeTable.computeColumnOpts;
- const columnDragOpts = $xeTable.computeColumnDragOpts;
- const virtualYOpts = $xeTable.computeVirtualYOpts;
- const {
- isCrossDrag,
- isSelfToChildDrag
- } = columnDragOpts;
- const customOpts = $xeTable.computeCustomOpts;
- const treeOpts = $xeTable.computeTreeOpts;
- const {
- storage
- } = customOpts;
- const rowOpts = $xeTable.computeRowOpts;
- const isGroup = collectColumn.some(hasChildrenList);
- let isAllOverflow = !!showOverflow;
- let rowGroupColumn;
- let expandColumn;
- let treeNodeColumn;
- let checkboxColumn;
- let radioColumn;
- let htmlColumn;
- let hasFixed;
- const handleFunc = (column, index, items, path, parentColumn) => {
- const {
- id: colid,
- field,
- fixed,
- type,
- treeNode,
- rowGroupNode
- } = column;
- const rest = {
- $index: -1,
- _index: -1,
- column,
- colid,
- index,
- items,
- parent: parentColumn || null,
- width: 0,
- oLeft: 0
- };
- if (field) {
- if (fullColFieldData[field]) {
- errLog('vxe.error.colRepet', ['field', field]);
- }
- fullColFieldData[field] = rest;
- } else {
- if (storage && !type) {
- errLog('vxe.error.reqSupportProp', ['storage', `[${type ? `type=${type}` : `title=${column.getTitle()}`}]field=?`]);
- }
- if (columnOpts.drag && (isCrossDrag || isSelfToChildDrag)) {
- errLog('vxe.error.reqSupportProp', ['column-drag-config.isCrossDrag | column-drag-config.isSelfToChildDrag', `${column.getTitle() || type || ''} -> field=?`]);
- }
- }
- if (!hasFixed && fixed) {
- hasFixed = fixed;
- }
- if (!htmlColumn && type === 'html') {
- htmlColumn = column;
- }
- if (treeNode) {
- if (treeNodeColumn) {
- warnLog('vxe.error.colRepet', ['tree-node', treeNode]);
- }
- if (!treeNodeColumn) {
- treeNodeColumn = column;
- }
- }
- if (rowGroupNode) {
- if (treeNodeColumn) {
- warnLog('vxe.error.colRepet', ['row-group-node', rowGroupNode]);
- }
- if (!rowGroupColumn) {
- rowGroupColumn = column;
- }
- }
- if (type === 'expand') {
- if (expandColumn) {
- warnLog('vxe.error.colRepet', ['type', type]);
- }
- if (!expandColumn) {
- expandColumn = column;
- }
- }
- if (type === 'checkbox') {
- if (checkboxColumn) {
- warnLog('vxe.error.colRepet', ['type', type]);
- }
- if (!checkboxColumn) {
- checkboxColumn = column;
- }
- } else if (type === 'radio') {
- if (radioColumn) {
- warnLog('vxe.error.colRepet', ['type', type]);
- }
- if (!radioColumn) {
- radioColumn = column;
- }
- }
- if (isAllOverflow && column.showOverflow === false) {
- isAllOverflow = false;
- }
- if (fullColIdData[colid]) {
- errLog('vxe.error.colRepet', ['colId', colid]);
- }
- fullColIdData[colid] = rest;
- };
- if (isGroup) {
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(collectColumn, (column, index, items, path, parentColumn, nodes) => {
- column.level = nodes.length;
- handleFunc(column, index, items, path, parentColumn);
- });
- } else {
- tableFullColumn.forEach(handleFunc);
- }
- if (expandColumn && expandOpts.mode !== 'fixed' && virtualYOpts.enabled) {
- warnLog('vxe.error.notConflictProp', ['column.type="expand', 'virtual-y-config.enabled=false']);
- }
- if (expandColumn && expandOpts.mode !== 'fixed' && mouseOpts.area) {
- errLog('vxe.error.errConflicts', ['mouse-config.area', 'column.type=expand']);
- }
- if (expandColumn && expandOpts.mode !== 'inside' && treeConfig && !treeOpts.transform) {
- errLog('vxe.error.notConflictProp', ['tree-config.transform=false', 'expand-config.mode=fixed']);
- }
- if (htmlColumn) {
- if (!columnOpts.useKey) {
- errLog('vxe.error.notSupportProp', ['column.type=html', 'column-config.useKey=false', 'column-config.useKey=true']);
- }
- if (!rowOpts.useKey) {
- errLog('vxe.error.notSupportProp', ['column.type=html', 'row-config.useKey=false', 'row-config.useKey=true']);
- }
- }
- reactData.isGroup = isGroup;
- reactData.rowGroupColumn = rowGroupColumn;
- reactData.treeNodeColumn = treeNodeColumn;
- reactData.expandColumn = expandColumn;
- reactData.checkboxColumn = checkboxColumn;
- reactData.radioColumn = radioColumn;
- reactData.isAllOverflow = isAllOverflow;
- }
- function updateScrollXStatus($xeTable, fullColumn) {
- const reactData = $xeTable;
- const internalData = $xeTable;
- const virtualXOpts = $xeTable.computeVirtualXOpts;
- const allCols = fullColumn || internalData.tableFullColumn;
- // 如果gt为0,则总是启用
- const scrollXLoad = !!virtualXOpts.enabled && virtualXOpts.gt > -1 && (virtualXOpts.gt === 0 || virtualXOpts.gt < allCols.length);
- reactData.scrollXLoad = scrollXLoad;
- return scrollXLoad;
- }
- function updateScrollYStatus($xeTable, fullData) {
- const props = $xeTable;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- treeConfig
- } = props;
- const $xeGanttView = internalData.xeGanttView;
- const virtualYOpts = $xeTable.computeVirtualYOpts;
- const treeOpts = $xeTable.computeTreeOpts;
- const {
- transform
- } = treeOpts;
- const allList = fullData || internalData.tableFullData;
- // 如果gt为0,则总是启用
- const scrollYLoad = (transform || !treeConfig) && !!virtualYOpts.enabled && virtualYOpts.gt > -1 && (virtualYOpts.gt === 0 || virtualYOpts.gt < allList.length);
- reactData.scrollYLoad = scrollYLoad;
- if ($xeGanttView && $xeGanttView.handleUpdateSYStatus) {
- $xeGanttView.handleUpdateSYStatus(scrollYLoad);
- }
- return scrollYLoad;
- }
- /**
- * 展开与收起树节点
- * @param rows
- * @param expanded
- * @returns
- */
- function handleBaseTreeExpand($xeTable, rows, expanded) {
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- treeNodeColumn
- } = reactData;
- const {
- fullAllDataRowIdData,
- tableFullTreeData,
- treeExpandedMaps,
- treeExpandLazyLoadedMaps
- } = internalData;
- const treeOpts = $xeTable.computeTreeOpts;
- const {
- reserve,
- lazy,
- accordion,
- toggleMethod
- } = treeOpts;
- const childrenField = treeOpts.children || treeOpts.childrenField;
- const hasChildField = treeOpts.hasChild || treeOpts.hasChildField;
- const result = [];
- const columnIndex = $xeTable.getColumnIndex(treeNodeColumn);
- const $columnIndex = $xeTable.getVMColumnIndex(treeNodeColumn);
- const {
- handleGetRowId
- } = createHandleGetRowId($xeTable);
- let validRows = toggleMethod ? rows.filter(row => toggleMethod({
- $table: $xeTable,
- expanded,
- column: treeNodeColumn,
- columnIndex,
- $columnIndex,
- row
- })) : rows;
- if (accordion) {
- validRows = validRows.length ? [validRows[validRows.length - 1]] : [];
- // 同一级只能展开一个
- const matchObj = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findTree(tableFullTreeData, item => item === validRows[0], {
- children: childrenField
- });
- if (matchObj) {
- matchObj.items.forEach(item => {
- const rowid = handleGetRowId(item);
- if (treeExpandedMaps[rowid]) {
- delete treeExpandedMaps[rowid];
- }
- });
- }
- }
- if (expanded) {
- validRows.forEach(row => {
- const rowid = handleGetRowId(row);
- if (!treeExpandedMaps[rowid]) {
- const rowRest = fullAllDataRowIdData[rowid];
- if (rowRest) {
- const isLoad = lazy && row[hasChildField] && !rowRest.treeLoaded && !treeExpandLazyLoadedMaps[rowid];
- // 是否使用懒加载
- if (isLoad) {
- result.push(handleAsyncTreeExpandChilds($xeTable, row));
- } else {
- if (row[childrenField] && row[childrenField].length) {
- treeExpandedMaps[rowid] = row;
- }
- }
- }
- }
- });
- } else {
- validRows.forEach(item => {
- const rowid = handleGetRowId(item);
- if (treeExpandedMaps[rowid]) {
- delete treeExpandedMaps[rowid];
- }
- });
- }
- if (reserve) {
- validRows.forEach(row => handleTreeExpandReserve($xeTable, row, expanded));
- }
- reactData.treeExpandedFlag++;
- return Promise.all(result).then(() => {
- return $xeTable.recalculate();
- });
- }
- /**
- * 虚拟树的展开与收起
- * @param rows
- * @param expanded
- * @returns
- */
- function handleVirtualTreeExpand($xeTable, rows, expanded) {
- const reactData = $xeTable;
- return handleBaseTreeExpand($xeTable, rows, expanded).then(() => {
- handleVirtualTreeToList($xeTable);
- $xeTable.handleTableData();
- reactData.treeExpandedFlag++;
- updateAfterDataIndex($xeTable);
- return $xeTable.$nextTick();
- }).then(() => {
- updateTreeLineStyle($xeTable);
- return handleLazyRecalculate($xeTable, true, true, true);
- }).then(() => {
- updateTreeLineStyle($xeTable);
- setTimeout(() => {
- $xeTable.updateCellAreas();
- }, 30);
- });
- }
- /**
- * 展开与收起行分组节点
- * @param rows
- * @param expanded
- * @returns
- */
- function handleRowGroupBaseExpand($xeTable, rows, expanded) {
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- fullAllDataRowIdData,
- tableFullGroupData,
- rowGroupExpandedMaps
- } = internalData;
- const aggregateOpts = $xeTable.computeAggregateOpts;
- const {
- mapChildrenField,
- accordion
- } = aggregateOpts;
- const {
- handleGetRowId
- } = createHandleGetRowId($xeTable);
- let validRows = rows;
- if (mapChildrenField) {
- if (accordion) {
- validRows = validRows.length ? [validRows[validRows.length - 1]] : [];
- // 同一级只能展开一个
- 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]), {
- children: mapChildrenField
- });
- if (matchObj) {
- matchObj.items.forEach(item => {
- const rowid = handleGetRowId(item);
- if (rowGroupExpandedMaps[rowid]) {
- delete rowGroupExpandedMaps[rowid];
- }
- });
- }
- }
- if (expanded) {
- validRows.forEach(row => {
- const rowid = handleGetRowId(row);
- if (!rowGroupExpandedMaps[rowid]) {
- const rowRest = fullAllDataRowIdData[rowid];
- if (rowRest) {
- if (row[mapChildrenField] && row[mapChildrenField].length) {
- rowGroupExpandedMaps[rowid] = row;
- }
- }
- }
- });
- } else {
- validRows.forEach(item => {
- const rowid = handleGetRowId(item);
- if (rowGroupExpandedMaps[rowid]) {
- delete rowGroupExpandedMaps[rowid];
- }
- });
- }
- }
- reactData.rowGroupExpandedFlag++;
- return $xeTable.recalculate();
- }
- /**
- * 行分组的展开与收起
- * @param rows
- * @param expanded
- * @returns
- */
- function handleRowGroupVirtualExpand($xeTable, rows, expanded) {
- const reactData = $xeTable;
- return handleRowGroupBaseExpand($xeTable, rows, expanded).then(() => {
- handleVirtualTreeToList($xeTable);
- $xeTable.handleTableData();
- reactData.rowGroupExpandedFlag++;
- updateAfterDataIndex($xeTable);
- return $xeTable.$nextTick();
- }).then(() => {
- return handleLazyRecalculate($xeTable, true, true, true);
- }).then(() => {
- setTimeout(() => {
- $xeTable.updateCellAreas();
- }, 30);
- });
- }
- /**
- * 处理默认展开分组行
- */
- function handleDefaultRowGroupExpand($xeTable) {
- const reactData = $xeTable;
- const {
- isRowGroupStatus
- } = reactData;
- if (isRowGroupStatus) {
- const aggregateOpts = $xeTable.computeAggregateOpts;
- const {
- expandAll,
- expandGroupFields
- } = aggregateOpts;
- if (expandAll) {
- $xeTable.setAllRowGroupExpand(true);
- } else if (expandGroupFields && expandGroupFields.length) {
- $xeTable.setRowGroupExpandByField(expandGroupFields, true);
- }
- }
- }
- function updateAfterListIndex($xeTable) {
- const props = $xeTable;
- const internalData = $xeTable;
- const {
- treeConfig
- } = props;
- const {
- afterFullData,
- fullDataRowIdData,
- fullAllDataRowIdData
- } = internalData;
- const {
- handleGetRowId
- } = createHandleGetRowId($xeTable);
- const fullMaps = {};
- afterFullData.forEach((row, index) => {
- const rowid = handleGetRowId(row);
- const rowRest = fullAllDataRowIdData[rowid];
- const seq = index + 1;
- if (rowRest) {
- if (!treeConfig) {
- rowRest.seq = seq;
- }
- rowRest._index = index;
- } else {
- const rest = {
- row,
- rowid,
- seq,
- index: -1,
- $index: -1,
- _index: index,
- treeIndex: -1,
- _tIndex: -1,
- items: [],
- parent: null,
- level: 0,
- height: 0,
- resizeHeight: 0,
- oTop: 0,
- expandHeight: 0
- };
- fullAllDataRowIdData[rowid] = rest;
- fullDataRowIdData[rowid] = rest;
- }
- fullMaps[rowid] = row;
- });
- internalData.afterFullRowMaps = fullMaps;
- }
- /**
- * 预编译
- * 对渲染中的数据提前解析序号及索引。牺牲提前编译耗时换取渲染中额外损耗,使运行时更加流畅
- */
- function updateAfterDataIndex($xeTable) {
- const props = $xeTable;
- const internalData = $xeTable;
- const {
- treeConfig
- } = props;
- const {
- fullDataRowIdData,
- fullAllDataRowIdData,
- afterFullData,
- afterTreeFullData
- } = internalData;
- const treeOpts = $xeTable.computeTreeOpts;
- const {
- transform
- } = treeOpts;
- const childrenField = treeOpts.children || treeOpts.childrenField;
- const fullMaps = {};
- if (treeConfig) {
- let _treeIndex = 0;
- const {
- handleGetRowId
- } = createHandleGetRowId($xeTable);
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(afterTreeFullData, (row, index, items, path) => {
- const rowid = handleGetRowId(row);
- const rowRest = fullAllDataRowIdData[rowid];
- const seq = path.map((num, i) => i % 2 === 0 ? Number(num) + 1 : '.').join('');
- if (rowRest) {
- rowRest.seq = seq;
- rowRest.treeIndex = index;
- rowRest._tIndex = _treeIndex;
- } else {
- const rest = {
- row,
- rowid,
- seq,
- index: -1,
- $index: -1,
- _index: -1,
- treeIndex: -1,
- _tIndex: _treeIndex,
- items: [],
- parent: null,
- level: 0,
- height: 0,
- resizeHeight: 0,
- oTop: 0,
- expandHeight: 0
- };
- fullAllDataRowIdData[rowid] = rest;
- fullDataRowIdData[rowid] = rest;
- }
- _treeIndex++;
- fullMaps[rowid] = row;
- }, {
- children: transform ? treeOpts.mapChildrenField : childrenField
- });
- if (transform) {
- afterFullData.forEach((row, index) => {
- const rowid = handleGetRowId(row);
- const rowRest = fullAllDataRowIdData[rowid];
- const seq = index + 1;
- if (rowRest) {
- if (!treeConfig) {
- rowRest.seq = seq;
- }
- rowRest._index = index;
- }
- });
- }
- internalData.afterFullRowMaps = fullMaps;
- } else {
- updateAfterListIndex($xeTable);
- }
- }
- /**
- * 如果为虚拟树、行分组、则将树结构拍平
- * @returns
- */
- function handleVirtualTreeToList($xeTable) {
- const props = $xeTable;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- treeConfig
- } = props;
- const {
- isRowGroupStatus
- } = reactData;
- const {
- fullAllDataRowIdData,
- treeExpandedMaps,
- rowGroupExpandedMaps
- } = internalData;
- const aggregateOpts = $xeTable.computeAggregateOpts;
- const treeOpts = $xeTable.computeTreeOpts;
- const {
- handleGetRowId
- } = createHandleGetRowId($xeTable);
- const fullData = [];
- const expandMaps = {};
- if (treeConfig && treeOpts.transform) {
- const childrenField = treeOpts.children || treeOpts.childrenField;
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(internalData.afterTreeFullData, (row, index, items, path, parentRow) => {
- const rowid = handleGetRowId(row);
- const parentRowid = handleGetRowId(parentRow);
- if (!parentRow || expandMaps[parentRowid] && treeExpandedMaps[parentRowid]) {
- const rowRest = fullAllDataRowIdData[rowid];
- if (rowRest) {
- rowRest._index = fullData.length;
- }
- expandMaps[rowid] = 1;
- fullData.push(row);
- }
- }, {
- children: childrenField
- });
- internalData.afterFullData = fullData;
- updateScrollYStatus($xeTable, fullData);
- return fullData;
- } else if (isRowGroupStatus) {
- const {
- childrenField
- } = aggregateOpts;
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(internalData.afterGroupFullData, (row, index, items, path, parentRow) => {
- const rowid = handleGetRowId(row);
- const parentRowid = handleGetRowId(parentRow);
- if (!parentRow || expandMaps[parentRowid] && rowGroupExpandedMaps[parentRowid]) {
- const rowRest = fullAllDataRowIdData[rowid];
- if (rowRest) {
- rowRest._index = fullData.length;
- }
- expandMaps[rowid] = 1;
- fullData.push(row);
- }
- }, {
- children: childrenField
- });
- internalData.afterFullData = fullData;
- updateScrollYStatus($xeTable, fullData);
- return fullData;
- }
- return internalData.afterFullData;
- }
- /**
- * 编译处理后全量的表格数据
- * 如果存在筛选条件,继续处理
- */
- function updateAfterFullData($xeTable) {
- const props = $xeTable;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- treeConfig
- } = props;
- const {
- isRowGroupStatus
- } = reactData;
- const {
- tableFullColumn,
- tableFullData,
- tableFullTreeData,
- tableFullGroupData
- } = internalData;
- const filterOpts = $xeTable.computeFilterOpts;
- const sortOpts = $xeTable.computeSortOpts;
- const aggregateOpts = $xeTable.computeAggregateOpts;
- const treeOpts = $xeTable.computeTreeOpts;
- const childrenField = treeOpts.children || treeOpts.childrenField;
- const {
- transform,
- rowField,
- parentField,
- mapChildrenField
- } = treeOpts;
- const {
- isEvery,
- remote: allRemoteFilter,
- filterMethod: allFilterMethod
- } = filterOpts;
- const {
- remote: allRemoteSort,
- sortMethod: allSortMethod,
- multiple: sortMultiple,
- chronological
- } = sortOpts;
- let tableData = [];
- let tableTree = [];
- // 处理数据
- if (!allRemoteFilter || !allRemoteSort) {
- const filterColumns = [];
- let orderColumns = [];
- tableFullColumn.forEach(column => {
- const {
- field,
- sortable,
- order,
- filters
- } = column;
- if (!allRemoteFilter && filters && filters.length) {
- const valueList = [];
- const itemList = [];
- filters.forEach(item => {
- if (item.checked) {
- itemList.push(item);
- valueList.push(item.value);
- }
- });
- if (itemList.length) {
- filterColumns.push({
- column,
- valueList,
- itemList
- });
- }
- }
- if (!allRemoteSort && sortable && order) {
- orderColumns.push({
- column,
- field,
- property: field,
- order: order,
- sortTime: column.sortTime
- });
- }
- });
- if (sortMultiple && chronological && orderColumns.length > 1) {
- orderColumns = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().orderBy(orderColumns, 'sortTime');
- }
- // 处理筛选
- // 支持单列、多列、组合筛选
- if (!allRemoteFilter && filterColumns.length) {
- const handleFilter = row => {
- return filterColumns.every(({
- column,
- valueList,
- itemList
- }) => {
- const {
- filterMethod,
- filterRender
- } = column;
- const compConf = isEnableConf(filterRender) ? methods_renderer.get(filterRender.name) : null;
- const compFilterMethod = compConf ? compConf.tableFilterMethod || compConf.filterMethod : null;
- const tdFilterMethod = compConf ? compConf.tableFilterDefaultMethod || compConf.defaultTableFilterMethod || compConf.defaultFilterMethod : null;
- const cellValue = getCellValue(row, column);
- if (filterMethod) {
- return itemList.some(item => filterMethod({
- value: item.value,
- option: item,
- cellValue,
- row,
- column,
- $table: $xeTable
- }));
- } else if (compFilterMethod) {
- return itemList.some(item => compFilterMethod({
- value: item.value,
- option: item,
- cellValue,
- row,
- column,
- $table: $xeTable
- }));
- } else if (allFilterMethod) {
- return allFilterMethod({
- $table: $xeTable,
- options: itemList,
- values: valueList,
- cellValue,
- row,
- column
- });
- } else if (tdFilterMethod) {
- return itemList.some(item => tdFilterMethod({
- value: item.value,
- option: item,
- cellValue,
- row,
- column,
- $table: $xeTable
- }));
- }
- return valueList.indexOf(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, column.field)) > -1;
- });
- };
- if (isRowGroupStatus) {
- // 行分组
- tableTree = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().searchTree(tableFullGroupData, handleFilter, {
- original: true,
- isEvery: true,
- children: aggregateOpts.mapChildrenField,
- mapChildren: aggregateOpts.childrenField
- });
- tableData = tableTree;
- } else if (treeConfig && transform) {
- // 筛选虚拟树
- tableTree = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().searchTree(tableFullTreeData, handleFilter, {
- original: true,
- isEvery,
- children: mapChildrenField,
- mapChildren: childrenField
- });
- tableData = tableTree;
- } else {
- tableData = treeConfig ? tableFullTreeData.filter(handleFilter) : tableFullData.filter(handleFilter);
- tableTree = tableData;
- }
- } else {
- if (isRowGroupStatus) {
- // 还原行分组
- tableTree = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().searchTree(tableFullGroupData, () => true, {
- original: true,
- isEvery: true,
- children: aggregateOpts.mapChildrenField,
- mapChildren: aggregateOpts.childrenField
- });
- tableData = tableTree;
- } else if (treeConfig && transform) {
- // 还原虚拟树
- tableTree = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().searchTree(tableFullTreeData, () => true, {
- original: true,
- isEvery,
- children: mapChildrenField,
- mapChildren: childrenField
- });
- tableData = tableTree;
- } else {
- tableData = treeConfig ? tableFullTreeData.slice(0) : tableFullData.slice(0);
- tableTree = tableData;
- }
- }
- // 处理排序
- // 支持单列、多列、组合排序
- if (!allRemoteSort && orderColumns.length) {
- if (isRowGroupStatus) {
- // 行分组的排序
- if (allSortMethod) {
- const sortRests = allSortMethod({
- data: tableTree,
- sortList: orderColumns,
- $table: $xeTable
- });
- tableTree = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(sortRests) ? sortRests : tableTree;
- } else {
- const treeList = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toTreeArray(tableTree, {
- key: aggregateOpts.rowField,
- parentKey: aggregateOpts.parentField,
- children: aggregateOpts.mapChildrenField
- });
- 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(({
- column,
- order
- }) => [getOrderField($xeTable, column), order])), {
- key: aggregateOpts.rowField,
- parentKey: aggregateOpts.parentField,
- children: aggregateOpts.childrenField,
- mapChildren: aggregateOpts.mapChildrenField
- });
- }
- tableData = tableTree;
- } else if (treeConfig && transform) {
- // 虚拟树的排序
- if (allSortMethod) {
- const sortRests = allSortMethod({
- data: tableTree,
- sortList: orderColumns,
- $table: $xeTable
- });
- tableTree = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(sortRests) ? sortRests : tableTree;
- } else {
- const treeList = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toTreeArray(tableTree, {
- children: mapChildrenField
- });
- 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(({
- column,
- order
- }) => [getOrderField($xeTable, column), order])), {
- key: rowField,
- parentKey: parentField,
- children: childrenField,
- mapChildren: mapChildrenField
- });
- }
- tableData = tableTree;
- } else {
- if (allSortMethod) {
- const sortRests = allSortMethod({
- data: tableData,
- sortList: orderColumns,
- $table: $xeTable
- });
- tableData = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(sortRests) ? sortRests : tableData;
- } else {
- // 兼容 v4
- if (sortMultiple) {
- tableData = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().orderBy(tableData, orderColumns.map(({
- column,
- order
- }) => [getOrderField($xeTable, column), order]));
- } else {
- const firstOrderColumn = orderColumns[0];
- let sortByConfs;
- // 已废弃,兼容 v2,在 v4 中废弃, sortBy 不能为数组
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(firstOrderColumn.sortBy)) {
- sortByConfs = firstOrderColumn.sortBy.map(item => [item, firstOrderColumn.order]);
- }
- tableData = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().orderBy(tableData, sortByConfs || [firstOrderColumn].map(({
- column,
- order
- }) => [getOrderField($xeTable, column), order]));
- }
- tableData = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().orderBy(tableData, orderColumns.map(({
- column,
- order
- }) => [getOrderField($xeTable, column), order]));
- }
- tableTree = tableData;
- }
- }
- } else {
- if (isRowGroupStatus) {
- // 还原行分组
- // 还原虚拟树
- tableTree = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().searchTree(tableFullGroupData, () => true, {
- original: true,
- isEvery: true,
- children: aggregateOpts.mapChildrenField,
- mapChildren: aggregateOpts.childrenField
- });
- tableData = tableTree;
- } else if (treeConfig && transform) {
- // 还原虚拟树
- tableTree = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().searchTree(tableFullTreeData, () => true, {
- original: true,
- isEvery,
- children: mapChildrenField,
- mapChildren: childrenField
- });
- tableData = tableTree;
- } else {
- tableData = treeConfig ? tableFullTreeData.slice(0) : tableFullData.slice(0);
- tableTree = tableData;
- }
- }
- internalData.afterFullData = tableData;
- internalData.afterTreeFullData = tableTree;
- internalData.afterGroupFullData = tableTree;
- updateAfterDataIndex($xeTable);
- }
- function updateStyle($xeTable) {
- const props = $xeTable;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- showHeaderOverflow: allColumnHeaderOverflow,
- showFooterOverflow: allColumnFooterOverflow,
- mouseConfig,
- spanMethod,
- footerSpanMethod
- } = props;
- const {
- isGroup,
- currentRow,
- tableColumn,
- scrollXLoad,
- scrollYLoad,
- overflowX,
- scrollbarWidth,
- overflowY,
- scrollbarHeight,
- scrollXWidth,
- columnStore,
- editStore,
- isAllOverflow,
- expandColumn,
- isColLoading
- } = reactData;
- const {
- visibleColumn,
- tableHeight,
- elemStore,
- customHeight,
- customMinHeight,
- customMaxHeight,
- tHeaderHeight,
- tFooterHeight
- } = internalData;
- const $xeGanttView = internalData.xeGanttView;
- const el = $xeTable.$refs.refElem;
- if (!el || internalData.tBodyHeight && !el.clientHeight) {
- return;
- }
- const containerList = ['main', 'left', 'right'];
- let osbWidth = overflowY ? scrollbarWidth : 0;
- let osbHeight = overflowX ? scrollbarHeight : 0;
- const emptyPlaceholderElem = $xeTable.$refs.refEmptyPlaceholder;
- const scrollbarOpts = $xeTable.computeScrollbarOpts;
- const mouseOpts = $xeTable.computeMouseOpts;
- const expandOpts = $xeTable.computeExpandOpts;
- const bodyWrapperElem = getRefElem(elemStore['main-body-wrapper']);
- const bodyTableElem = getRefElem(elemStore['main-body-table']);
- if (emptyPlaceholderElem) {
- emptyPlaceholderElem.style.top = `${tHeaderHeight}px`;
- emptyPlaceholderElem.style.height = bodyWrapperElem ? `${bodyWrapperElem.offsetHeight - osbHeight}px` : '';
- }
- const scrollbarXConf = scrollbarOpts.x || {};
- const scrollbarYConf = scrollbarOpts.y || {};
- const scrollbarYToLeft = $xeTable.computeScrollbarYToLeft;
- let xScrollbarVisible = overflowX ? 'visible' : 'hidden';
- if (scrollbarXConf.visible === 'visible' || $xeGanttView) {
- osbHeight = scrollbarHeight;
- xScrollbarVisible = 'visible';
- } else if (scrollbarXConf.visible === 'hidden' || scrollbarXConf.visible === false) {
- osbHeight = 0;
- xScrollbarVisible = 'hidden';
- }
- let yScrollbarVisible = overflowY ? 'visible' : 'hidden';
- if (scrollbarYConf.visible === 'hidden' || scrollbarYConf.visible === false || $xeGanttView && !scrollbarYToLeft) {
- osbWidth = 0;
- yScrollbarVisible = 'hidden';
- } else if (scrollbarYConf.visible === 'visible') {
- osbWidth = scrollbarWidth;
- yScrollbarVisible = 'visible';
- }
- let tbHeight = 0;
- let bodyMaxHeight = 0;
- const bodyMinHeight = customMinHeight - tHeaderHeight - tFooterHeight - osbHeight;
- if (customMaxHeight) {
- bodyMaxHeight = Math.max(bodyMinHeight, customMaxHeight - tHeaderHeight - tFooterHeight - osbHeight);
- }
- if (customHeight) {
- tbHeight = customHeight - tHeaderHeight - tFooterHeight - osbHeight;
- }
- if (!tbHeight) {
- if (bodyTableElem) {
- tbHeight = bodyTableElem.clientHeight;
- }
- }
- if (tbHeight) {
- if (bodyMaxHeight) {
- tbHeight = Math.min(bodyMaxHeight, tbHeight);
- }
- tbHeight = Math.max(bodyMinHeight, tbHeight);
- }
- const xLeftCornerEl = $xeTable.$refs.refScrollXLeftCornerElem;
- const xRightCornerEl = $xeTable.$refs.refScrollXRightCornerElem;
- const scrollXVirtualEl = $xeTable.$refs.refScrollXVirtualElem;
- if (scrollXVirtualEl) {
- scrollXVirtualEl.style.height = `${osbHeight}px`;
- scrollXVirtualEl.style.visibility = xScrollbarVisible;
- }
- const xWrapperEl = $xeTable.$refs.refScrollXWrapperElem;
- if (xWrapperEl) {
- xWrapperEl.style.width = `${el.clientWidth - osbWidth}px`;
- if (scrollbarYToLeft) {
- xWrapperEl.style.left = `${osbWidth}px`;
- } else {
- xWrapperEl.style.left = '';
- }
- }
- if (xLeftCornerEl) {
- if (scrollbarYToLeft) {
- xLeftCornerEl.style.width = `${osbWidth}px`;
- xLeftCornerEl.style.display = overflowY && osbWidth ? 'block' : '';
- } else {
- xLeftCornerEl.style.display = '';
- }
- }
- if (xRightCornerEl) {
- if (scrollbarYToLeft) {
- xRightCornerEl.style.display = '';
- } else {
- xRightCornerEl.style.width = `${osbWidth}px`;
- xRightCornerEl.style.display = xScrollbarVisible === 'visible' ? 'block' : '';
- }
- }
- const scrollYVirtualEl = $xeTable.$refs.refScrollYVirtualElem;
- if (scrollYVirtualEl) {
- scrollYVirtualEl.style.width = `${osbWidth}px`;
- scrollYVirtualEl.style.height = `${tbHeight + tHeaderHeight + tFooterHeight}px`;
- scrollYVirtualEl.style.visibility = yScrollbarVisible;
- }
- const yTopCornerEl = $xeTable.$refs.refScrollYTopCornerElem;
- if (yTopCornerEl) {
- yTopCornerEl.style.height = `${tHeaderHeight}px`;
- yTopCornerEl.style.display = tHeaderHeight && yScrollbarVisible === 'visible' ? 'block' : '';
- }
- const yWrapperEl = $xeTable.$refs.refScrollYWrapperElem;
- if (yWrapperEl) {
- yWrapperEl.style.height = `${tbHeight}px`;
- yWrapperEl.style.top = `${tHeaderHeight}px`;
- }
- const yBottomCornerEl = $xeTable.$refs.refScrollYBottomCornerElem;
- if (yBottomCornerEl) {
- yBottomCornerEl.style.height = `${tFooterHeight}px`;
- yBottomCornerEl.style.top = `${tHeaderHeight + tbHeight}px`;
- yBottomCornerEl.style.display = tFooterHeight && yScrollbarVisible === 'visible' ? 'block' : '';
- }
- const rowExpandEl = $xeTable.$refs.refRowExpandElem;
- if (rowExpandEl) {
- rowExpandEl.style.height = `${tbHeight}px`;
- rowExpandEl.style.top = `${tHeaderHeight}px`;
- }
- internalData.tBodyHeight = tbHeight;
- containerList.forEach((name, index) => {
- const fixedType = index > 0 ? name : '';
- const layoutList = ['header', 'body', 'footer'];
- const isFixedLeft = fixedType === 'left';
- let fixedColumn = [];
- let fixedWrapperElem;
- if (fixedType) {
- fixedColumn = isFixedLeft ? columnStore.leftList : columnStore.rightList;
- fixedWrapperElem = isFixedLeft ? $xeTable.$refs.refLeftContainer : $xeTable.$refs.refRightContainer;
- }
- layoutList.forEach(layout => {
- const wrapperElem = getRefElem(elemStore[`${name}-${layout}-wrapper`]);
- const currScrollElem = getRefElem(elemStore[`${name}-${layout}-scroll`]);
- const tableElem = getRefElem(elemStore[`${name}-${layout}-table`]);
- if (layout === 'header') {
- // 表头体样式处理
- // 横向滚动渲染
- let renderColumnList = tableColumn;
- let isOptimizeMode = false;
- if (isGroup) {
- renderColumnList = visibleColumn;
- } else {
- // 如果是使用优化模式
- if (scrollXLoad && allColumnHeaderOverflow) {
- if (spanMethod || footerSpanMethod) {
- // 如果不支持优化模式
- } else {
- isOptimizeMode = true;
- }
- }
- if (!isOptimizeMode || !isColLoading && (fixedType || !overflowX)) {
- renderColumnList = visibleColumn;
- }
- if (fixedType) {
- // 如果是使用优化模式
- if (isOptimizeMode) {
- renderColumnList = fixedColumn || [];
- }
- }
- }
- const tWidth = renderColumnList.reduce((previous, column) => previous + column.renderWidth, 0);
- if (fixedType) {
- if (isGroup) {
- if (wrapperElem) {
- wrapperElem.style.width = scrollXWidth ? `${scrollXWidth}px` : '';
- }
- } else {
- if (isOptimizeMode) {
- if (wrapperElem) {
- wrapperElem.style.width = tWidth ? `${tWidth}px` : '';
- }
- } else {
- if (wrapperElem) {
- wrapperElem.style.width = scrollXWidth ? `${scrollXWidth}px` : '';
- }
- }
- }
- }
- if (currScrollElem) {
- currScrollElem.style.height = `${tHeaderHeight}px`;
- }
- if (tableElem) {
- tableElem.style.width = tWidth ? `${tWidth}px` : '';
- }
- } else if (layout === 'body') {
- if (currScrollElem) {
- currScrollElem.style.maxHeight = customMaxHeight ? `${bodyMaxHeight}px` : '';
- currScrollElem.style.height = customHeight ? `${tbHeight}px` : '';
- currScrollElem.style.minHeight = `${bodyMinHeight}px`;
- }
- // 如果是固定列
- if (fixedWrapperElem) {
- if (wrapperElem) {
- wrapperElem.style.top = `${tHeaderHeight}px`;
- }
- fixedWrapperElem.style.height = `${customHeight > 0 ? customHeight : tableHeight + tHeaderHeight + tFooterHeight + osbHeight}px`;
- fixedWrapperElem.style.width = `${fixedColumn.reduce((previous, column) => previous + column.renderWidth, 0)}px`;
- }
- let renderColumnList = tableColumn;
- let isOptimizeMode = false;
- // 如果是使用优化模式
- if (scrollXLoad || scrollYLoad || isAllOverflow) {
- if (expandColumn && expandOpts.mode !== 'fixed' || spanMethod || footerSpanMethod) {
- // 如果不支持优化模式
- } else {
- isOptimizeMode = true;
- }
- }
- if (fixedType) {
- renderColumnList = visibleColumn;
- if (isOptimizeMode) {
- renderColumnList = fixedColumn || [];
- }
- }
- const tWidth = renderColumnList.reduce((previous, column) => previous + column.renderWidth, 0);
- if (fixedType) {
- if (isOptimizeMode) {
- if (wrapperElem) {
- wrapperElem.style.width = tWidth ? `${tWidth}px` : '';
- }
- } else {
- if (wrapperElem) {
- wrapperElem.style.width = scrollXWidth ? `${scrollXWidth}px` : '';
- }
- }
- }
- if (tableElem) {
- tableElem.style.width = tWidth ? `${tWidth}px` : '';
- // 兼容性处理
- tableElem.style.paddingRight = osbWidth && fixedType && (browseObj.firefox || browseObj.safari) ? `${osbWidth}px` : '';
- }
- const emptyBlockElem = getRefElem(elemStore[`${name}-${layout}-emptyBlock`]);
- if (emptyBlockElem) {
- emptyBlockElem.style.width = tWidth ? `${tWidth}px` : '';
- }
- } else if (layout === 'footer') {
- let renderColumnList = tableColumn;
- let isOptimizeMode = false;
- // 如果是使用优化模式
- if (scrollXLoad && allColumnFooterOverflow) {
- if (spanMethod || footerSpanMethod) {
- // 如果不支持优化模式
- } else {
- isOptimizeMode = true;
- }
- }
- if (!isOptimizeMode || !isColLoading && (fixedType || !overflowX)) {
- renderColumnList = visibleColumn;
- }
- if (fixedType) {
- if (isOptimizeMode) {
- renderColumnList = fixedColumn || [];
- }
- }
- const tWidth = renderColumnList.reduce((previous, column) => previous + column.renderWidth, 0);
- if (fixedType) {
- if (isOptimizeMode) {
- if (wrapperElem) {
- wrapperElem.style.width = tWidth ? `${tWidth}px` : '';
- }
- } else {
- if (wrapperElem) {
- wrapperElem.style.width = scrollXWidth ? `${scrollXWidth}px` : '';
- }
- }
- }
- if (currScrollElem) {
- currScrollElem.style.height = `${tFooterHeight}px`;
- // 如果是固定列
- if (fixedWrapperElem) {
- if (wrapperElem) {
- wrapperElem.style.top = `${customHeight > 0 ? customHeight - tFooterHeight - osbHeight : tableHeight + tHeaderHeight}px`;
- }
- }
- }
- if (tableElem) {
- tableElem.style.width = tWidth ? `${tWidth}px` : '';
- }
- }
- });
- });
- if (currentRow) {
- $xeTable.setCurrentRow(currentRow);
- }
- if (mouseConfig && mouseOpts.selected && editStore.selected.row && editStore.selected.column) {
- $xeTable.addCellSelectedClass();
- }
- if ($xeGanttView && $xeGanttView.handleUpdateStyle) {
- $xeGanttView.handleUpdateStyle();
- }
- return $xeTable.$nextTick();
- }
- function checkValidate($xeTable, type) {
- if ($xeTable.triggerValidate) {
- return $xeTable.triggerValidate(type);
- }
- return $xeTable.$nextTick();
- }
- /**
- * 当单元格发生改变时
- * 如果存在规则,则校验
- */
- function handleChangeCell($xeTable, evnt, params) {
- checkValidate($xeTable, 'blur').catch(e => e).then(() => {
- $xeTable.handleEdit(params, evnt).then(() => checkValidate($xeTable, 'change')).catch(e => e);
- });
- }
- function handleDefaultSort($xeTable) {
- const props = $xeTable;
- const {
- sortConfig
- } = props;
- if (sortConfig) {
- const sortOpts = $xeTable.computeSortOpts;
- let {
- defaultSort
- } = sortOpts;
- if (defaultSort) {
- if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(defaultSort)) {
- defaultSort = [defaultSort];
- }
- if (defaultSort.length) {
- (sortConfig.multiple ? defaultSort : defaultSort.slice(0, 1)).forEach((item, index) => {
- const {
- field,
- order
- } = item;
- if (field && order) {
- const column = $xeTable.getColumnByField(field);
- if (column && column.sortable) {
- column.order = order;
- column.sortTime = Date.now() + index;
- }
- }
- });
- if (!sortOpts.remote) {
- $xeTable.handleTableData(true).then(updateStyle);
- }
- }
- }
- }
- }
- /**
- * 处理默认勾选
- */
- function handleDefaultSelectionChecked($xeTable) {
- const props = $xeTable;
- const internalData = $xeTable;
- const {
- checkboxConfig
- } = props;
- if (checkboxConfig) {
- const {
- fullDataRowIdData
- } = internalData;
- const checkboxOpts = $xeTable.computeCheckboxOpts;
- const {
- checkAll,
- checkRowKeys
- } = checkboxOpts;
- if (checkAll) {
- handleCheckedAllCheckboxRow($xeTable, true, true);
- } else if (checkRowKeys) {
- const defSelection = [];
- checkRowKeys.forEach(rowid => {
- if (fullDataRowIdData[rowid]) {
- defSelection.push(fullDataRowIdData[rowid].row);
- }
- });
- handleCheckedCheckboxRow($xeTable, defSelection, true, true);
- }
- }
- }
- /**
- * 处理单选框默认勾选
- */
- function handleDefaultRadioChecked($xeTable) {
- const props = $xeTable;
- const internalData = $xeTable;
- const {
- radioConfig
- } = props;
- if (radioConfig) {
- const {
- fullDataRowIdData
- } = internalData;
- const radioOpts = $xeTable.computeRadioOpts;
- const {
- checkRowKey: rowid,
- reserve
- } = radioOpts;
- if (rowid) {
- if (fullDataRowIdData[rowid]) {
- handleCheckedRadioRow(fullDataRowIdData[rowid].row, true);
- }
- if (reserve) {
- const rowkey = getRowkey($xeTable);
- internalData.radioReserveRow = {
- [rowkey]: rowid
- };
- }
- }
- }
- }
- /**
- * 处理默认展开行
- */
- function handleDefaultRowExpand($xeTable) {
- const props = $xeTable;
- const internalData = $xeTable;
- const {
- expandConfig
- } = props;
- if (expandConfig) {
- const {
- fullDataRowIdData
- } = internalData;
- const expandOpts = $xeTable.computeExpandOpts;
- const {
- expandAll,
- expandRowKeys
- } = expandOpts;
- if (expandAll) {
- $xeTable.setAllRowExpand(true);
- } else if (expandRowKeys) {
- const defExpandeds = [];
- expandRowKeys.forEach(rowid => {
- if (fullDataRowIdData[rowid]) {
- defExpandeds.push(fullDataRowIdData[rowid].row);
- }
- });
- $xeTable.setRowExpand(defExpandeds, true);
- }
- }
- }
- function handleRadioReserveRow($xeTable, row) {
- const internalData = $xeTable;
- const radioOpts = $xeTable.computeRadioOpts;
- if (radioOpts.reserve) {
- internalData.radioReserveRow = row;
- }
- }
- function handleCheckboxReserveRow($xeTable, row, checked) {
- const internalData = $xeTable;
- const {
- checkboxReserveRowMap
- } = internalData;
- const checkboxOpts = $xeTable.computeCheckboxOpts;
- if (checkboxOpts.reserve) {
- const rowid = getRowid($xeTable, row);
- if (checked) {
- checkboxReserveRowMap[rowid] = row;
- } else if (checkboxReserveRowMap[rowid]) {
- delete checkboxReserveRowMap[rowid];
- }
- }
- }
- function handleCheckedRadioRow($xeTable, row, isForce) {
- const reactData = $xeTable;
- const radioOpts = $xeTable.computeRadioOpts;
- const {
- checkMethod
- } = radioOpts;
- if (row && (isForce || !checkMethod || checkMethod({
- $table: $xeTable,
- row
- }))) {
- reactData.selectRadioRow = row;
- handleRadioReserveRow($xeTable, row);
- }
- return $xeTable.$nextTick();
- }
- function handleCheckedCheckboxRow($xeTable, rows, value, isForce) {
- if (rows && !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(rows)) {
- rows = [rows];
- }
- $xeTable.handleBatchSelectRows(rows, !!value, isForce);
- $xeTable.checkSelectionStatus();
- return $xeTable.$nextTick();
- }
- function handleCheckedAllCheckboxRow($xeTable, checked, isForce) {
- const props = $xeTable;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- treeConfig
- } = props;
- const {
- isRowGroupStatus
- } = reactData;
- const {
- afterFullData,
- afterTreeFullData,
- afterGroupFullData,
- checkboxReserveRowMap,
- selectCheckboxMaps
- } = internalData;
- const treeOpts = $xeTable.computeTreeOpts;
- const aggregateOpts = $xeTable.computeAggregateOpts;
- const childrenField = treeOpts.children || treeOpts.childrenField;
- const checkboxOpts = $xeTable.computeCheckboxOpts;
- const {
- checkField,
- reserve,
- checkMethod
- } = checkboxOpts;
- const {
- handleGetRowId
- } = createHandleGetRowId($xeTable);
- // indeterminateField 仅支持读取
- const indeterminateField = checkboxOpts.indeterminateField || checkboxOpts.halfField;
- const selectRowMaps = {};
- /**
- * 绑定属性方式(有污染)
- * 必须在行数据存在对应的属性,否则将不响应
- */
- if (checkField) {
- const checkValFn = row => {
- if (isForce || !checkMethod || checkMethod({
- $table: $xeTable,
- row
- })) {
- if (checked) {
- selectRowMaps[handleGetRowId(row)] = row;
- }
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(row, checkField, checked);
- }
- if ((treeConfig || isRowGroupStatus) && indeterminateField) {
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(row, indeterminateField, false);
- }
- };
- // 如果存在选中方法
- // 如果方法成立,则更新值,否则忽略该数据
- if (treeConfig || isRowGroupStatus) {
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(afterFullData, checkValFn, {
- children: childrenField
- });
- } else {
- afterFullData.forEach(checkValFn);
- }
- } else {
- /**
- * 默认方式(无污染)
- * 无需任何属性,直接绑定
- */
- if (isRowGroupStatus) {
- if (checked) {
- /**
- * 如果是行分组勾选
- * 如果方法成立,则添加到临时集合中
- */
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(afterGroupFullData, row => {
- if (isForce || !checkMethod || checkMethod({
- $table: $xeTable,
- row
- })) {
- const rowid = handleGetRowId(row);
- selectRowMaps[rowid] = row;
- }
- }, {
- children: aggregateOpts.mapChildrenField
- });
- } else {
- /**
- * 如果是树取消
- * 如果方法成立,则不添加到临时集合中
- */
- if (!isForce && checkMethod) {
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(afterGroupFullData, row => {
- const rowid = handleGetRowId(row);
- if (checkMethod({
- $table: $xeTable,
- row
- }) ? false : selectCheckboxMaps[rowid]) {
- selectRowMaps[rowid] = row;
- }
- }, {
- children: aggregateOpts.mapChildrenField
- });
- }
- }
- } else if (treeConfig) {
- if (checked) {
- /**
- * 如果是树勾选
- * 如果方法成立,则添加到临时集合中
- */
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(afterTreeFullData, row => {
- if (isForce || !checkMethod || checkMethod({
- $table: $xeTable,
- row
- })) {
- const rowid = handleGetRowId(row);
- selectRowMaps[rowid] = row;
- }
- }, {
- children: childrenField
- });
- } else {
- /**
- * 如果是树取消
- * 如果方法成立,则不添加到临时集合中
- */
- if (!isForce && checkMethod) {
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(afterTreeFullData, row => {
- const rowid = handleGetRowId(row);
- if (checkMethod({
- $table: $xeTable,
- row
- }) ? false : selectCheckboxMaps[rowid]) {
- selectRowMaps[rowid] = row;
- }
- }, {
- children: childrenField
- });
- }
- }
- } else {
- if (checked) {
- /**
- * 如果是行勾选
- * 如果存在选中方法且成立或者本身已勾选,则添加到临时集合中
- * 如果不存在选中方法,则添加所有数据到临时集合中
- */
- if (!isForce && checkMethod) {
- afterFullData.forEach(row => {
- const rowid = handleGetRowId(row);
- if (selectCheckboxMaps[rowid] || checkMethod({
- $table: $xeTable,
- row
- })) {
- selectRowMaps[rowid] = row;
- }
- });
- } else {
- afterFullData.forEach(row => {
- const rowid = handleGetRowId(row);
- selectRowMaps[rowid] = row;
- });
- }
- } else {
- /**
- * 如果是行取消
- * 如果方法成立,则不添加到临时集合中;如果方法不成立则判断当前是否已勾选,如果已被勾选则添加到新集合中
- * 如果不存在选中方法,无需处理,临时集合默认为空
- */
- if (!isForce && checkMethod) {
- afterFullData.forEach(row => {
- const rowid = handleGetRowId(row);
- if (checkMethod({
- $table: $xeTable,
- row
- }) ? false : selectCheckboxMaps[rowid]) {
- selectRowMaps[rowid] = row;
- }
- });
- }
- }
- }
- }
- if (reserve) {
- if (checked) {
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(selectRowMaps, (row, rowid) => {
- checkboxReserveRowMap[rowid] = row;
- });
- } else {
- afterFullData.forEach(row => handleCheckboxReserveRow($xeTable, row, false));
- }
- }
- reactData.updateCheckboxFlag++;
- internalData.selectCheckboxMaps = checkField ? {} : selectRowMaps;
- reactData.isAllSelected = checked;
- reactData.isIndeterminate = false;
- internalData.treeIndeterminateRowMaps = {};
- $xeTable.checkSelectionStatus();
- return $xeTable.$nextTick();
- }
- // 还原展开、选中等相关状态
- function handleReserveStatus($xeTable) {
- const props = $xeTable;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- treeConfig
- } = props;
- const {
- expandColumn,
- currentRow,
- selectRadioRow
- } = reactData;
- const {
- fullDataRowIdData,
- fullAllDataRowIdData,
- radioReserveRow,
- selectCheckboxMaps,
- treeExpandedMaps,
- rowExpandedMaps
- } = internalData;
- const expandOpts = $xeTable.computeExpandOpts;
- const treeOpts = $xeTable.computeTreeOpts;
- const radioOpts = $xeTable.computeRadioOpts;
- const checkboxOpts = $xeTable.computeCheckboxOpts;
- // 单选框
- if (selectRadioRow && !fullAllDataRowIdData[getRowid($xeTable, selectRadioRow)]) {
- reactData.selectRadioRow = null; // 刷新单选行状态
- }
- // 还原保留选中状态
- if (radioOpts.reserve && radioReserveRow) {
- const rowid = getRowid($xeTable, radioReserveRow);
- if (fullDataRowIdData[rowid]) {
- handleCheckedRadioRow($xeTable, fullDataRowIdData[rowid].row, true);
- }
- }
- // 复选框
- internalData.selectCheckboxMaps = getRecoverRowMaps($xeTable, selectCheckboxMaps); // 刷新多选行状态
- reactData.updateCheckboxFlag++;
- // 还原保留选中状态
- if (checkboxOpts.reserve) {
- handleCheckedCheckboxRow($xeTable, handleReserveRow($xeTable, internalData.checkboxReserveRowMap), true, true);
- }
- if (currentRow && !fullAllDataRowIdData[getRowid($xeTable, currentRow)]) {
- reactData.currentRow = null; // 刷新当前行状态
- }
- // 行展开
- internalData.rowExpandedMaps = expandColumn ? getRecoverRowMaps($xeTable, rowExpandedMaps) : {}; // 刷新行展开状态
- reactData.rowExpandedFlag++;
- // 还原保留状态
- if (expandColumn && expandOpts.reserve) {
- $xeTable.setRowExpand(handleReserveRow($xeTable, internalData.rowExpandedReserveRowMap), true);
- }
- // 树展开
- internalData.treeExpandedMaps = treeConfig ? getRecoverRowMaps($xeTable, treeExpandedMaps) : {}; // 刷新树展开状态
- reactData.treeExpandedFlag++;
- if (treeConfig && treeOpts.reserve) {
- $xeTable.setTreeExpand(handleReserveRow($xeTable, internalData.treeExpandedReserveRowMap), true);
- }
- }
- /**
- * 处理默认展开树节点
- */
- const handleDefaultTreeExpand = $xeTable => {
- const props = $xeTable;
- const internalData = $xeTable;
- const {
- treeConfig
- } = props;
- if (treeConfig) {
- const {
- fullAllDataRowIdData
- } = internalData;
- const treeOpts = $xeTable.computeTreeOpts;
- const {
- expandAll,
- expandRowKeys
- } = treeOpts;
- if (expandAll) {
- $xeTable.setAllTreeExpand(true);
- } else if (expandRowKeys) {
- const defExpandeds = [];
- expandRowKeys.forEach(rowid => {
- const rowRest = fullAllDataRowIdData[rowid];
- if (rowRest) {
- defExpandeds.push(rowRest.row);
- }
- });
- $xeTable.setTreeExpand(defExpandeds, true);
- }
- }
- };
- const handleAsyncTreeExpandChilds = ($xeTable, row) => {
- const reactData = $xeTable;
- const internalData = $xeTable;
- const treeOpts = $xeTable.computeTreeOpts;
- const checkboxOpts = $xeTable.computeCheckboxOpts;
- const {
- transform,
- loadMethod
- } = treeOpts;
- const {
- checkStrictly
- } = checkboxOpts;
- return new Promise(resolve => {
- if (loadMethod) {
- const {
- fullAllDataRowIdData,
- treeExpandLazyLoadedMaps
- } = internalData;
- const rowid = getRowid($xeTable, row);
- const rowRest = fullAllDataRowIdData[rowid];
- treeExpandLazyLoadedMaps[rowid] = row;
- Promise.resolve(loadMethod({
- $table: $xeTable,
- row
- })).then(childRecords => {
- if (rowRest) {
- rowRest.treeLoaded = true;
- }
- if (treeExpandLazyLoadedMaps[rowid]) {
- delete treeExpandLazyLoadedMaps[rowid];
- }
- if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(childRecords)) {
- childRecords = [];
- }
- if (childRecords) {
- return $xeTable.loadTreeChildren(row, childRecords).then(childRows => {
- const {
- treeExpandedMaps
- } = internalData;
- if (childRows.length && !treeExpandedMaps[rowid]) {
- treeExpandedMaps[rowid] = row;
- }
- reactData.treeExpandedFlag++;
- // 如果当前节点已选中,则展开后子节点也被选中
- if (!checkStrictly && $xeTable.isCheckedByCheckboxRow(row)) {
- handleCheckedCheckboxRow($xeTable, childRows, true);
- }
- return $xeTable.$nextTick().then(() => {
- if (transform) {
- $xeTable.handleTableData();
- updateAfterDataIndex($xeTable);
- return $xeTable.$nextTick();
- }
- });
- });
- }
- }).catch(() => {
- const {
- treeExpandLazyLoadedMaps
- } = internalData;
- if (rowRest) {
- rowRest.treeLoaded = false;
- }
- if (treeExpandLazyLoadedMaps[rowid]) {
- delete treeExpandLazyLoadedMaps[rowid];
- }
- }).finally(() => {
- reactData.treeExpandedFlag++;
- $xeTable.$nextTick().then(() => $xeTable.recalculate()).then(() => resolve());
- });
- } else {
- resolve();
- }
- });
- };
- const handleTreeExpandReserve = ($xeTable, row, expanded) => {
- const internalData = $xeTable;
- const {
- treeExpandedReserveRowMap
- } = internalData;
- const treeOpts = $xeTable.computeTreeOpts;
- if (treeOpts.reserve) {
- const rowid = getRowid($xeTable, row);
- if (expanded) {
- treeExpandedReserveRowMap[rowid] = row;
- } else if (treeExpandedReserveRowMap[rowid]) {
- delete treeExpandedReserveRowMap[rowid];
- }
- }
- };
- const handleAsyncRowExpand = ($xeTable, row) => {
- const reactData = $xeTable;
- const internalData = $xeTable;
- return new Promise(resolve => {
- const expandOpts = $xeTable.computeExpandOpts;
- const {
- loadMethod
- } = expandOpts;
- if (loadMethod) {
- const {
- fullAllDataRowIdData,
- rowExpandLazyLoadedMaps
- } = internalData;
- const rowid = getRowid($xeTable, row);
- const rowRest = fullAllDataRowIdData[rowid];
- rowExpandLazyLoadedMaps[rowid] = row;
- loadMethod({
- $table: $xeTable,
- row,
- rowIndex: $xeTable.getRowIndex(row),
- $rowIndex: $xeTable.getVMRowIndex(row)
- }).then(() => {
- const {
- rowExpandedMaps
- } = internalData;
- if (rowRest) {
- rowRest.expandLoaded = true;
- }
- rowExpandedMaps[rowid] = row;
- reactData.rowExpandedFlag++;
- }).catch(() => {
- if (rowRest) {
- rowRest.expandLoaded = false;
- }
- }).finally(() => {
- const {
- rowExpandLazyLoadedMaps
- } = internalData;
- if (rowExpandLazyLoadedMaps[rowid]) {
- delete rowExpandLazyLoadedMaps[rowid];
- }
- reactData.rowExpandedFlag++;
- $xeTable.$nextTick().then(() => $xeTable.recalculate()).then(() => $xeTable.updateCellAreas()).then(() => resolve());
- });
- } else {
- resolve();
- }
- });
- };
- function calcVarRowHeightConfig($xeTable, sizeKey, sizeEl) {
- const reactData = $xeTable;
- const {
- rowHeightStore
- } = reactData;
- if (sizeEl && sizeEl.clientHeight) {
- rowHeightStore[sizeKey] = sizeEl.clientHeight;
- }
- }
- function computeRowHeight($xeTable) {
- const reactData = $xeTable;
- const {
- isAllOverflow
- } = reactData;
- const tableHeader = $xeTable.$refs.refTableHeader;
- const tableBody = $xeTable.$refs.refTableBody;
- const tableBodyElem = tableBody ? tableBody.$el : null;
- const defaultRowHeight = $xeTable.computeDefaultRowHeight;
- let rowHeight = 0;
- if (isAllOverflow) {
- if (tableBodyElem) {
- const tableHeaderElem = tableHeader ? tableHeader.$el : null;
- let firstTrElem;
- firstTrElem = tableBodyElem.querySelector('tr');
- if (!firstTrElem && tableHeaderElem) {
- firstTrElem = tableHeaderElem.querySelector('tr');
- }
- if (firstTrElem) {
- rowHeight = firstTrElem.clientHeight;
- }
- }
- if (!rowHeight) {
- rowHeight = defaultRowHeight;
- }
- } else {
- rowHeight = defaultRowHeight;
- }
- // 最低支持 18px 行高
- return Math.max(18, rowHeight);
- }
- function handleVirtualYVisible($xeTable) {
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- isAllOverflow,
- expandColumn,
- isScrollYBig,
- scrollYHeight
- } = reactData;
- const {
- elemStore,
- isResizeCellHeight,
- afterFullData,
- fullAllDataRowIdData
- } = internalData;
- const rowOpts = $xeTable.computeRowOpts;
- const cellOpts = $xeTable.computeCellOpts;
- const defaultRowHeight = $xeTable.computeDefaultRowHeight;
- const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
- if (bodyScrollElem) {
- const clientHeight = bodyScrollElem.clientHeight;
- let scrollTop = bodyScrollElem.scrollTop;
- if (isScrollYBig) {
- scrollTop = Math.ceil((scrollYHeight - clientHeight) * Math.min(1, scrollTop / (maxYHeight - clientHeight)));
- }
- const startTop = scrollTop;
- const endTop = scrollTop + clientHeight;
- let toVisibleIndex = -1;
- let visibleSize = 0;
- const isCustomCellHeight = isResizeCellHeight || cellOpts.height || rowOpts.height;
- if (!isCustomCellHeight && !expandColumn && isAllOverflow) {
- toVisibleIndex = Math.floor(startTop / defaultRowHeight) - 1;
- visibleSize = Math.ceil(clientHeight / defaultRowHeight) + 1;
- } else {
- const {
- handleGetRowId
- } = createHandleGetRowId($xeTable);
- let leftIndex = 0;
- let rightIndex = afterFullData.length;
- while (leftIndex < rightIndex) {
- const rIndex = Math.floor((leftIndex + rightIndex) / 2);
- const row = afterFullData[rIndex];
- const rowid = handleGetRowId(row);
- const rowRest = fullAllDataRowIdData[rowid] || {};
- if (rowRest.oTop <= startTop) {
- leftIndex = rIndex + 1;
- } else {
- rightIndex = rIndex;
- }
- }
- toVisibleIndex = leftIndex === afterFullData.length ? leftIndex : Math.max(0, leftIndex < afterFullData.length ? leftIndex - 2 : 0);
- for (let rIndex = toVisibleIndex, rLen = afterFullData.length; rIndex < rLen; rIndex++) {
- const row = afterFullData[rIndex];
- const rowid = handleGetRowId(row);
- const rowRest = fullAllDataRowIdData[rowid] || {};
- visibleSize++;
- if (rowRest.oTop > endTop || visibleSize >= 100) {
- break;
- }
- }
- }
- return {
- toVisibleIndex: Math.max(0, toVisibleIndex),
- visibleSize: Math.max(6, visibleSize)
- };
- }
- return {
- toVisibleIndex: 0,
- visibleSize: 6
- };
- }
- function calculateMergerOffsetIndex(list, offsetItem, type) {
- for (let mcIndex = 0, len = list.length; mcIndex < len; mcIndex++) {
- const mergeItem = list[mcIndex];
- const {
- startIndex,
- endIndex
- } = offsetItem;
- const mergeStartIndex = mergeItem[type];
- const mergeSpanNumber = mergeItem[type + 'span'];
- const mergeEndIndex = mergeStartIndex + mergeSpanNumber;
- if (mergeStartIndex < startIndex && startIndex < mergeEndIndex) {
- offsetItem.startIndex = mergeStartIndex;
- }
- if (mergeStartIndex < endIndex && endIndex < mergeEndIndex) {
- offsetItem.endIndex = mergeEndIndex;
- }
- if (offsetItem.startIndex !== startIndex || offsetItem.endIndex !== endIndex) {
- mcIndex = -1;
- }
- }
- }
- function buildMergeData(mergeConfigs) {
- const mergeMaps = {};
- if (mergeConfigs && mergeConfigs.length) {
- for (let mIndex = 0; mIndex < mergeConfigs.length; mIndex++) {
- const {
- row: _rowIndex,
- col: _columnIndex,
- rowspan: mergeRowspan,
- colspan: mergeColspan
- } = mergeConfigs[mIndex];
- for (let i = 0; i < mergeRowspan; i++) {
- for (let j = 0; j < mergeColspan; j++) {
- mergeMaps[`${_rowIndex + i}:${_columnIndex + j}`] = !i && !j ? {
- rowspan: mergeRowspan,
- colspan: mergeColspan
- } : {
- rowspan: 0,
- colspan: 0
- };
- }
- }
- }
- }
- return mergeMaps;
- }
- function handleBodyMerge($xeTable, merges) {
- const internalData = $xeTable;
- const {
- fullAllDataRowIdData,
- fullColumnIdData,
- visibleColumn,
- afterFullData,
- mergeBodyList,
- mergeBodyMaps
- } = internalData;
- if (merges) {
- const {
- handleGetRowId
- } = createHandleGetRowId($xeTable);
- if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(merges)) {
- merges = [merges];
- }
- merges.forEach(item => {
- let {
- row,
- col,
- rowspan,
- colspan
- } = item;
- let mergeRowIndex = -1;
- let mergeColumnIndex = -1;
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(row)) {
- mergeRowIndex = row;
- } else {
- const rowid = row ? handleGetRowId(row) : null;
- const rowRest = rowid ? fullAllDataRowIdData[rowid] : null;
- if (rowRest) {
- mergeRowIndex = rowRest._index;
- }
- }
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(col)) {
- mergeColumnIndex = col;
- } else {
- const colid = col ? col.id : null;
- const colRest = colid ? fullColumnIdData[colid] : null;
- if (colRest) {
- mergeColumnIndex = colRest._index;
- }
- }
- if (mergeRowIndex > -1 && mergeColumnIndex > -1 && (rowspan || colspan)) {
- rowspan = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(rowspan) || 1;
- colspan = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(colspan) || 1;
- if (rowspan > 1 || colspan > 1) {
- const row = afterFullData[mergeRowIndex];
- const column = visibleColumn[mergeColumnIndex];
- let mergeItem = mergeBodyMaps[`${mergeRowIndex}:${mergeColumnIndex}`];
- if (mergeItem) {
- mergeItem.rowspan = rowspan;
- mergeItem.colspan = colspan;
- mergeItem._rowspan = rowspan;
- mergeItem._colspan = colspan;
- } else {
- mergeItem = {
- row: mergeRowIndex,
- col: mergeColumnIndex,
- rowspan,
- colspan,
- _row: row,
- _col: column,
- _rowspan: rowspan,
- _colspan: colspan
- };
- mergeBodyMaps[`${mergeRowIndex}:${mergeColumnIndex}`] = mergeItem;
- mergeBodyList.push(mergeItem);
- }
- }
- }
- });
- }
- }
- function removeBodyMerges($xeTable, merges) {
- const internalData = $xeTable;
- const {
- mergeBodyList,
- fullColumnIdData,
- fullAllDataRowIdData,
- mergeBodyMaps
- } = internalData;
- const rest = [];
- if (merges) {
- const {
- handleGetRowId
- } = createHandleGetRowId($xeTable);
- if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(merges)) {
- merges = [merges];
- }
- merges.forEach(item => {
- const {
- row: margeRow,
- col: margeCol
- } = item;
- let mergeRowIndex = -1;
- let mergeColumnIndex = -1;
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(margeRow)) {
- mergeRowIndex = margeRow;
- } else {
- const rowid = margeRow ? handleGetRowId(margeRow) : null;
- const rowRest = rowid ? fullAllDataRowIdData[rowid] : null;
- if (rowRest) {
- mergeRowIndex = rowRest._index;
- }
- }
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(margeCol)) {
- mergeColumnIndex = margeCol;
- } else {
- const colid = margeCol ? margeCol.id : null;
- const colRest = colid ? fullColumnIdData[colid] : null;
- if (colRest) {
- mergeColumnIndex = colRest._index;
- }
- }
- const mcIndex = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findIndexOf(mergeBodyList, item => item.row === mergeRowIndex && item.col === mergeColumnIndex);
- if (mcIndex > -1) {
- const rItems = mergeBodyList.splice(mcIndex, 1);
- const item = rItems[0];
- if (item) {
- rest.push(rItems[0]);
- if (mergeBodyMaps[`${mergeRowIndex}:${mergeColumnIndex}`]) {
- delete mergeBodyMaps[`${mergeRowIndex}:${mergeColumnIndex}`];
- }
- }
- }
- });
- }
- return rest;
- }
- function handleHeaderMerge($xeTable, merges) {
- const props = $xeTable;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- showCustomHeader
- } = props;
- const {
- footerTableData
- } = reactData;
- const {
- mergeHeaderList,
- mergeHeaderMaps,
- fullColumnIdData
- } = internalData;
- if (merges) {
- const {
- visibleColumn
- } = internalData;
- if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(merges)) {
- merges = [merges];
- }
- merges.forEach(item => {
- let {
- row: margeRow,
- col: margeCol,
- rowspan,
- colspan
- } = item;
- const mergeRowIndex = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(margeRow) ? margeRow : -1;
- let mergeColumnIndex = -1;
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(margeCol)) {
- mergeColumnIndex = margeCol;
- } else {
- const colid = margeCol ? margeCol.id : null;
- const colRest = colid ? fullColumnIdData[colid] : null;
- if (colRest) {
- mergeColumnIndex = colRest._index;
- }
- }
- if (mergeRowIndex > -1 && mergeColumnIndex > -1 && (rowspan || colspan)) {
- rowspan = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(rowspan) || 1;
- colspan = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(colspan) || 1;
- if (!showCustomHeader && rowspan > 1) {
- errLog('vxe.error.notSupportProp', ['[table] show-custom-header=false', `rowspan=${rowspan}`, 'rowspan=1']);
- return;
- }
- if (rowspan > 1 || colspan > 1) {
- const row = footerTableData[mergeRowIndex];
- const column = visibleColumn[mergeColumnIndex];
- let mergeItem = mergeHeaderMaps[`${mergeRowIndex}:${mergeColumnIndex}`];
- if (mergeItem) {
- mergeItem.rowspan = rowspan;
- mergeItem.colspan = colspan;
- mergeItem._rowspan = rowspan;
- mergeItem._colspan = colspan;
- } else {
- mergeItem = {
- row: mergeRowIndex,
- col: mergeColumnIndex,
- rowspan,
- colspan,
- _row: row,
- _col: column,
- _rowspan: rowspan,
- _colspan: colspan
- };
- mergeHeaderMaps[`${mergeRowIndex}:${mergeColumnIndex}`] = mergeItem;
- mergeHeaderList.push(mergeItem);
- }
- }
- }
- });
- }
- }
- function removeHeaderMerges($xeTable, merges) {
- const internalData = $xeTable;
- const {
- mergeHeaderList,
- fullColumnIdData,
- mergeHeaderMaps
- } = internalData;
- const rest = [];
- if (merges) {
- if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(merges)) {
- merges = [merges];
- }
- merges.forEach(item => {
- const {
- row: margeRow,
- col: margeCol
- } = item;
- const mergeRowIndex = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(margeRow) ? margeRow : -1;
- let mergeColumnIndex = -1;
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(margeCol)) {
- mergeColumnIndex = margeCol;
- } else {
- const colid = margeCol ? margeCol.id : null;
- const colRest = colid ? fullColumnIdData[colid] : null;
- if (colRest) {
- mergeColumnIndex = colRest._index;
- }
- }
- const mcIndex = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findIndexOf(mergeHeaderList, item => item.row === mergeRowIndex && item.col === mergeColumnIndex);
- if (mcIndex > -1) {
- const rItems = mergeHeaderList.splice(mcIndex, 1);
- const item = rItems[0];
- if (item) {
- rest.push(item);
- if (mergeHeaderMaps[`${mergeRowIndex}:${mergeColumnIndex}`]) {
- delete mergeHeaderMaps[`${mergeRowIndex}:${mergeColumnIndex}`];
- }
- }
- }
- });
- }
- return rest;
- }
- function handleFooterMerge($xeTable, merges) {
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- footerTableData
- } = reactData;
- const {
- mergeFooterList,
- mergeFooterMaps,
- fullColumnIdData
- } = internalData;
- if (merges) {
- const {
- visibleColumn
- } = internalData;
- if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(merges)) {
- merges = [merges];
- }
- merges.forEach(item => {
- let {
- row: margeRow,
- col: margeCol,
- rowspan,
- colspan
- } = item;
- const mergeRowIndex = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(margeRow) ? margeRow : -1;
- let mergeColumnIndex = -1;
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(margeCol)) {
- mergeColumnIndex = margeCol;
- } else {
- const colid = margeCol ? margeCol.id : null;
- const colRest = colid ? fullColumnIdData[colid] : null;
- if (colRest) {
- mergeColumnIndex = colRest._index;
- }
- }
- if (mergeRowIndex > -1 && mergeColumnIndex > -1 && (rowspan || colspan)) {
- rowspan = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(rowspan) || 1;
- colspan = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(colspan) || 1;
- if (rowspan > 1 || colspan > 1) {
- const row = footerTableData[mergeRowIndex];
- const column = visibleColumn[mergeColumnIndex];
- let mergeItem = mergeFooterMaps[`${mergeRowIndex}:${mergeColumnIndex}`];
- if (mergeItem) {
- mergeItem.rowspan = rowspan;
- mergeItem.colspan = colspan;
- mergeItem._rowspan = rowspan;
- mergeItem._colspan = colspan;
- } else {
- mergeItem = {
- row: mergeRowIndex,
- col: mergeColumnIndex,
- rowspan,
- colspan,
- _row: row,
- _col: column,
- _rowspan: rowspan,
- _colspan: colspan
- };
- mergeFooterMaps[`${mergeRowIndex}:${mergeColumnIndex}`] = mergeItem;
- mergeFooterList.push(mergeItem);
- }
- }
- }
- });
- }
- }
- function removeFooterMerges($xeTable, merges) {
- const internalData = $xeTable;
- const {
- mergeFooterList,
- fullColumnIdData,
- mergeFooterMaps
- } = internalData;
- const rest = [];
- if (merges) {
- if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(merges)) {
- merges = [merges];
- }
- merges.forEach(item => {
- const {
- row: margeRow,
- col: margeCol
- } = item;
- const mergeRowIndex = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(margeRow) ? margeRow : -1;
- let mergeColumnIndex = -1;
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(margeCol)) {
- mergeColumnIndex = margeCol;
- } else {
- const colid = margeCol ? margeCol.id : null;
- const colRest = colid ? fullColumnIdData[colid] : null;
- if (colRest) {
- mergeColumnIndex = colRest._index;
- }
- }
- const mcIndex = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findIndexOf(mergeFooterList, item => item.row === mergeRowIndex && item.col === mergeColumnIndex);
- if (mcIndex > -1) {
- const rItems = mergeFooterList.splice(mcIndex, 1);
- const item = rItems[0];
- if (item) {
- rest.push(item);
- if (mergeFooterMaps[`${mergeRowIndex}:${mergeColumnIndex}`]) {
- delete mergeFooterMaps[`${mergeRowIndex}:${mergeColumnIndex}`];
- }
- }
- }
- });
- }
- return rest;
- }
- function handleSortEvent($xeTable, evnt, sortConfs, isUpdate) {
- const internalData = $xeTable;
- const {
- tableFullColumn
- } = internalData;
- const sortOpts = $xeTable.computeSortOpts;
- const {
- multiple,
- remote,
- orders
- } = sortOpts;
- if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(sortConfs)) {
- sortConfs = [sortConfs];
- }
- if (sortConfs && sortConfs.length) {
- const orderActiveMaps = {};
- if (!multiple) {
- sortConfs = [sortConfs[0]];
- tableFullColumn.forEach(column => {
- if (column.order) {
- orderActiveMaps[column.id] = column;
- }
- });
- }
- const sortColMpps = {};
- let firstColumn = null;
- sortConfs.forEach((confs, index) => {
- let {
- field,
- order
- } = confs;
- let column = field;
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(field)) {
- column = $xeTable.getColumnByField(field);
- }
- if (!firstColumn) {
- firstColumn = column;
- }
- if (column && column.sortable) {
- if (orders && orders.indexOf(order) === -1) {
- order = getNextSortOrder($xeTable, column);
- }
- if (column.order !== order) {
- column.order = order;
- }
- column.sortTime = Date.now() + index;
- sortColMpps[column.id] = column;
- }
- });
- if (!multiple) {
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(orderActiveMaps, (oaCol, oaId) => {
- if (!sortColMpps[oaId]) {
- oaCol.order = null;
- }
- });
- }
- if (isUpdate) {
- if (!remote) {
- $xeTable.handleTableData(true);
- }
- }
- if (evnt) {
- $xeTable.handleColumnSortEvent(evnt, firstColumn);
- }
- return $xeTable.$nextTick().then(() => {
- updateRowOffsetTop($xeTable);
- $xeTable.updateCellAreas();
- return updateStyle($xeTable);
- });
- }
- return $xeTable.$nextTick();
- }
- function clearAllSort($xeTable) {
- const internalData = $xeTable;
- const {
- tableFullColumn
- } = internalData;
- tableFullColumn.forEach(column => {
- column.order = null;
- });
- }
- function calcTableHeight($xeTable, key) {
- const props = $xeTable;
- const reactData = $xeTable;
- const {
- editConfig,
- editRules
- } = props;
- const {
- parentHeight
- } = reactData;
- let val = props[key];
- if (key === 'minHeight') {
- const defMinHeight = methods_getConfig().table.minHeight;
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(val)) {
- if (eqEmptyValue(defMinHeight)) {
- // 编辑模式默认最小高度
- if (editRules && isEnableConf(editConfig)) {
- val = 144;
- }
- } else {
- val = defMinHeight;
- }
- }
- }
- let num = 0;
- if (val) {
- if (val === '100%' || val === 'auto') {
- num = parentHeight;
- } else {
- const excludeHeight = $xeTable.getExcludeHeight();
- if (isScale(val)) {
- num = Math.floor((external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(val) || 1) / 100 * parentHeight);
- } else {
- num = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(val);
- }
- num = Math.max(40, num - excludeHeight);
- }
- }
- return num;
- }
- /**
- * 列宽算法,计算单元格列宽,动态分配可用剩余空间
- * 支持 px、%、固定 混合分配
- * 支持动态列表调整分配
- * 支持自动分配偏移量
- * 支持 width=60 width=60px width=10% min-width=60 min-width=60px min-width=10%
- */
- function autoCellWidth($xeTable) {
- const props = $xeTable;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- elemStore
- } = internalData;
- const bodyWrapperElem = getRefElem(elemStore['main-body-wrapper']);
- if (!bodyWrapperElem) {
- return;
- }
- const yHandleEl = $xeTable.$refs.refScrollYHandleElem;
- if (!yHandleEl) {
- return;
- }
- const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
- if (!xHandleEl) {
- return;
- }
- let tWidth = 0;
- const minCellWidth = 40; // 列宽最少限制 40px
- const bodyWidth = bodyWrapperElem.clientWidth;
- let remainWidth = bodyWidth;
- let meanWidth = remainWidth / 100;
- const {
- fit
- } = props;
- const {
- columnStore
- } = reactData;
- const {
- resizeList,
- pxMinList,
- autoMinList,
- pxList,
- scaleList,
- scaleMinList,
- autoList,
- remainList
- } = columnStore;
- // 最小宽
- pxMinList.forEach(column => {
- const minWidth = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(column.minWidth);
- tWidth += minWidth;
- column.renderWidth = minWidth;
- });
- // 最小自适应
- autoMinList.forEach(column => {
- const scaleWidth = Math.max(60, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(column.renderAutoWidth));
- tWidth += scaleWidth;
- column.renderWidth = scaleWidth;
- });
- // 最小百分比
- scaleMinList.forEach(column => {
- const scaleWidth = Math.floor(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(column.minWidth) * meanWidth);
- tWidth += scaleWidth;
- column.renderWidth = scaleWidth;
- });
- // 固定百分比
- scaleList.forEach(column => {
- const scaleWidth = Math.floor(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(column.width) * meanWidth);
- tWidth += scaleWidth;
- column.renderWidth = scaleWidth;
- });
- // 固定宽
- pxList.forEach(column => {
- const width = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(column.width);
- tWidth += width;
- column.renderWidth = width;
- });
- // 自适应宽
- autoList.forEach(column => {
- const width = Math.max(60, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(column.renderAutoWidth));
- tWidth += width;
- column.renderWidth = width;
- });
- // 调整了列宽
- resizeList.forEach(column => {
- const width = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(column.resizeWidth);
- tWidth += width;
- column.renderWidth = width;
- });
- remainWidth -= tWidth;
- meanWidth = remainWidth > 0 ? Math.floor(remainWidth / (scaleMinList.length + pxMinList.length + autoMinList.length + remainList.length)) : 0;
- if (fit) {
- if (remainWidth > 0) {
- scaleMinList.concat(pxMinList).concat(autoMinList).forEach(column => {
- tWidth += meanWidth;
- column.renderWidth += meanWidth;
- });
- }
- } else {
- meanWidth = minCellWidth;
- }
- // 剩余均分
- remainList.forEach(column => {
- const width = Math.max(meanWidth, minCellWidth);
- column.renderWidth = width;
- tWidth += width;
- });
- if (fit) {
- /**
- * 偏移量算法
- * 如果所有列足够放的情况下,从最后动态列开始分配
- */
- const dynamicList = scaleList.concat(scaleMinList).concat(pxMinList).concat(autoMinList).concat(remainList);
- let dynamicSize = dynamicList.length - 1;
- if (dynamicSize > 0) {
- let i = bodyWidth - tWidth;
- if (i > 0) {
- while (i > 0 && dynamicSize >= 0) {
- i--;
- dynamicList[dynamicSize--].renderWidth++;
- }
- tWidth = bodyWidth;
- }
- }
- }
- reactData.scrollXWidth = tWidth;
- reactData.resizeWidthFlag++;
- updateColumnOffsetLeft($xeTable);
- updateHeight($xeTable);
- }
- const calcCellAutoHeight = (rowRest, wrapperEl) => {
- const cellElemList = wrapperEl.querySelectorAll(`.vxe-cell--wrapper[rowid="${rowRest.rowid}"]`);
- let colHeight = rowRest.height;
- let firstCellStyle = null;
- let topBottomPadding = 0;
- for (let i = 0; i < cellElemList.length; i++) {
- const wrapperElem = cellElemList[i];
- const cellElem = wrapperElem.parentElement;
- if (!firstCellStyle) {
- firstCellStyle = getComputedStyle(cellElem);
- 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;
- }
- const cellHeight = wrapperElem ? wrapperElem.clientHeight : 0;
- colHeight = Math.max(colHeight, Math.ceil(cellHeight + topBottomPadding));
- }
- return colHeight;
- };
- const calcCellHeight = $xeTable => {
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- tableData,
- isAllOverflow,
- scrollYLoad,
- scrollXLoad
- } = reactData;
- const {
- fullAllDataRowIdData
- } = internalData;
- const defaultRowHeight = $xeTable.computeDefaultRowHeight;
- const el = $xeTable.$refs.refElem;
- if (!isAllOverflow && (scrollYLoad || scrollXLoad) && el) {
- const {
- handleGetRowId
- } = createHandleGetRowId($xeTable);
- tableData.forEach(row => {
- const rowid = handleGetRowId(row);
- const rowRest = fullAllDataRowIdData[rowid];
- if (rowRest) {
- const height = calcCellAutoHeight(rowRest, el);
- rowRest.height = Math.max(defaultRowHeight, scrollXLoad ? Math.max(rowRest.height, height) : height);
- }
- });
- reactData.calcCellHeightFlag++;
- }
- };
- function getOrderField($xeTable, column) {
- const {
- sortBy,
- sortType
- } = column;
- return row => {
- let cellValue;
- if (sortBy) {
- cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(sortBy) ? sortBy({
- row,
- column
- }) : external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, sortBy);
- } else {
- cellValue = $xeTable.getCellLabel(row, column);
- }
- if (!sortType || sortType === 'auto') {
- return isNaN(cellValue) ? cellValue : external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(cellValue);
- } else if (sortType === 'number') {
- return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(cellValue);
- } else if (sortType === 'string') {
- return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toValueString(cellValue);
- }
- return cellValue;
- };
- }
- function handleTargetEnterEvent($xeTable, isClear) {
- const internalData = $xeTable;
- const $tooltip = $xeTable.$refs.refTooltip;
- clearTimeout(internalData.tooltipTimeout);
- if (isClear) {
- $xeTable.closeTooltip();
- } else {
- if ($tooltip && $tooltip.setActived) {
- $tooltip.setActived(true);
- }
- }
- }
- function clearCrossTableDragStatus($xeTable) {
- const crossTableDragRowInfo = getCrossTableDragRowInfo($xeTable);
- crossTableDragRowObj = null;
- crossTableDragRowInfo.row = null;
- }
- function clearDragStatus($xeTable) {
- const reactData = $xeTable;
- const {
- dragRow,
- dragCol
- } = reactData;
- if (dragRow || dragCol) {
- clearColDropOrigin($xeTable);
- clearRowDropOrigin($xeTable);
- hideDropTip($xeTable);
- clearCrossTableDragStatus($xeTable);
- reactData.dragRow = null;
- reactData.dragCol = null;
- }
- }
- function clearRowDropOrigin($xeTable) {
- const el = $xeTable.$el;
- if (el) {
- const clss = 'row--drag-origin';
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayEach(el.querySelectorAll(`.${clss}`), elem => {
- elem.draggable = false;
- removeClass(elem, clss);
- });
- }
- }
- function updateRowDropOrigin($xeTable, row) {
- const el = $xeTable.$el;
- if (el) {
- const clss = 'row--drag-origin';
- const rowid = getRowid($xeTable, row);
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayEach(el.querySelectorAll(`[rowid="${rowid}"]`), elem => {
- addClass(elem, clss);
- });
- }
- }
- function updateRowDropTipContent($xeTable, tdEl) {
- const reactData = $xeTable;
- const props = $xeTable;
- const {
- dragConfig
- } = props;
- const {
- dragRow
- } = reactData;
- const rowDragOpts = $xeTable.computeRowDragOpts;
- const {
- tooltipMethod
- } = rowDragOpts;
- const rTooltipMethod = tooltipMethod || (dragConfig ? dragConfig.rowTooltipMethod : null);
- let tipContent = '';
- if (rTooltipMethod) {
- const rtParams = {
- $table: $xeTable,
- row: dragRow
- };
- tipContent = `${rTooltipMethod(rtParams) || ''}`;
- } else {
- tipContent = methods_getI18n('vxe.table.dragTip', [tdEl.textContent || '']);
- }
- reactData.dragTipText = tipContent;
- }
- function updateColDropOrigin($xeTable, column) {
- const el = $xeTable.$el;
- if (el) {
- const colQuerys = [];
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree([column], item => {
- colQuerys.push(`[colid="${item.id}"]`);
- });
- const clss = 'col--drag-origin';
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayEach(el.querySelectorAll(colQuerys.join(',')), elem => {
- addClass(elem, clss);
- });
- }
- }
- function clearColDropOrigin($xeTable) {
- const el = $xeTable.$el;
- if (el) {
- const clss = 'col--drag-origin';
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayEach(el.querySelectorAll(`.${clss}`), elem => {
- elem.draggable = false;
- removeClass(elem, clss);
- });
- }
- }
- function updateColDropTipContent($xeTable, tdEl) {
- const reactData = $xeTable;
- const {
- dragCol
- } = reactData;
- const columnDragOpts = $xeTable.computeColumnDragOpts;
- const {
- tooltipMethod
- } = columnDragOpts;
- let tipContent = '';
- if (tooltipMethod) {
- const dtParams = {
- $table: $xeTable,
- column: dragCol
- };
- tipContent = `${tooltipMethod(dtParams) || ''}`;
- } else {
- tipContent = methods_getI18n('vxe.table.dragTip', [tdEl.textContent || '']);
- }
- reactData.dragTipText = tipContent;
- }
- function showDropTip($xeTable, evnt, trEl, thEl, showLine, dragPos) {
- const $xeGantt = $xeTable.$xeGantt;
- const reactData = $xeTable;
- const internalData = $xeTable;
- let wrapperEl = $xeTable.$refs.refElem;
- if ($xeGantt && trEl) {
- const ganttContainerElem = $xeGantt.$refs.refGanttContainerElem;
- if (ganttContainerElem) {
- wrapperEl = ganttContainerElem;
- }
- }
- if (!wrapperEl) {
- return;
- }
- const {
- overflowX,
- scrollbarWidth,
- overflowY,
- scrollbarHeight
- } = reactData;
- const {
- prevDragToChild
- } = internalData;
- const wrapperRect = wrapperEl.getBoundingClientRect();
- const osbWidth = overflowY ? scrollbarWidth : 0;
- const osbHeight = overflowX ? scrollbarHeight : 0;
- const tableWrapperWidth = wrapperEl.clientWidth;
- const tableWrapperHeight = wrapperEl.clientHeight;
- if (trEl) {
- const rdLineEl = $xeTable.$refs.refDragRowLineElem;
- if (rdLineEl) {
- if (showLine) {
- const scrollbarYToLeft = $xeTable.computeScrollbarYToLeft;
- const trRect = trEl.getBoundingClientRect();
- let trHeight = trEl.clientHeight;
- const offsetTop = Math.max(1, trRect.y - wrapperRect.y);
- if (offsetTop + trHeight > tableWrapperHeight - osbHeight) {
- trHeight = tableWrapperHeight - offsetTop - osbHeight;
- }
- rdLineEl.style.display = 'block';
- rdLineEl.style.left = `${scrollbarYToLeft ? osbWidth : 0}px`;
- rdLineEl.style.top = `${offsetTop}px`;
- rdLineEl.style.height = `${trHeight}px`;
- rdLineEl.style.width = `${tableWrapperWidth - osbWidth}px`;
- rdLineEl.setAttribute('drag-pos', dragPos);
- rdLineEl.setAttribute('drag-to-child', prevDragToChild ? 'y' : 'n');
- } else {
- rdLineEl.style.display = '';
- }
- }
- } else if (thEl) {
- const cdLineEl = $xeTable.$refs.refDragColLineElem;
- if (cdLineEl) {
- if (showLine) {
- const scrollbarXToTop = $xeTable.computeScrollbarXToTop;
- const leftContainerElem = $xeTable.$refs.refLeftContainer;
- const leftContainerWidth = leftContainerElem ? leftContainerElem.clientWidth : 0;
- const rightContainerElem = $xeTable.$refs.refRightContainer;
- const rightContainerWidth = rightContainerElem ? rightContainerElem.clientWidth : 0;
- const thRect = thEl.getBoundingClientRect();
- let thWidth = thEl.clientWidth;
- const offsetTop = Math.max(0, thRect.y - wrapperRect.y);
- const startX = leftContainerWidth;
- let offsetLeft = thRect.x - wrapperRect.x;
- if (offsetLeft < startX) {
- thWidth -= startX - offsetLeft;
- offsetLeft = startX;
- }
- const endX = tableWrapperWidth - rightContainerWidth - (rightContainerWidth ? 0 : osbWidth);
- if (offsetLeft + thWidth > endX) {
- thWidth = endX - offsetLeft;
- }
- cdLineEl.style.display = 'block';
- cdLineEl.style.top = `${offsetTop}px`;
- cdLineEl.style.left = `${offsetLeft}px`;
- cdLineEl.style.width = `${thWidth}px`;
- if (prevDragToChild) {
- cdLineEl.style.height = `${thRect.height}px`;
- } else {
- cdLineEl.style.height = `${tableWrapperHeight - offsetTop - (scrollbarXToTop ? 0 : osbHeight)}px`;
- }
- cdLineEl.setAttribute('drag-pos', dragPos);
- cdLineEl.setAttribute('drag-to-child', prevDragToChild ? 'y' : 'n');
- } else {
- cdLineEl.style.display = '';
- }
- }
- }
- const rdTipEl = $xeTable.$refs.refDragTipElem;
- if (rdTipEl) {
- rdTipEl.style.display = 'block';
- rdTipEl.style.top = `${Math.min(wrapperEl.clientHeight - wrapperEl.scrollTop - rdTipEl.clientHeight, evnt.clientY - wrapperRect.y)}px`;
- rdTipEl.style.left = `${Math.min(wrapperEl.clientWidth - wrapperEl.scrollLeft - rdTipEl.clientWidth - 16, evnt.clientX - wrapperRect.x)}px`;
- rdTipEl.setAttribute('drag-status', showLine ? prevDragToChild ? 'sub' : 'normal' : 'disabled');
- }
- }
- function hideDropTip($xeTable) {
- const rdTipEl = $xeTable.$refs.refDragTipElem;
- const rdLineEl = $xeTable.$refs.refDragRowLineElem;
- const cdLineEl = $xeTable.$refs.refDragColLineElem;
- if (rdTipEl) {
- rdTipEl.style.display = '';
- }
- if (rdLineEl) {
- rdLineEl.style.display = '';
- }
- if (cdLineEl) {
- cdLineEl.style.display = '';
- }
- }
- function clearRowDragData($xeTable) {
- const $xeGantt = $xeTable.$xeGantt;
- const reactData = $xeTable;
- const internalData = $xeTable;
- let wrapperEl = $xeTable.$refs.refElem;
- const dtClss = ['.vxe-body--row'];
- if ($xeGantt) {
- const ganttContainerElem = $xeGantt.$refs.refGanttContainerElem;
- if (ganttContainerElem) {
- wrapperEl = ganttContainerElem;
- }
- dtClss.push('.vxe-gantt-view--body-row', '.vxe-gantt-view--chart-row');
- }
- hideDropTip($xeTable);
- clearRowDropOrigin($xeTable);
- clearRowAnimate(wrapperEl, dtClss);
- internalData.prevDragToChild = false;
- reactData.dragRow = null;
- reactData.dragCol = null;
- }
- /**
- * 处理显示 tooltip
- * @param {Event} evnt 事件
- * @param {Row} row 行对象
- */
- function handleTooltip($xeTable, evnt, tipOpts, type, tdEl, overflowElem, tipElem, params) {
- const reactData = $xeTable;
- const tipOverEl = overflowElem || tdEl;
- if (!tipOverEl) {
- return $xeTable.$nextTick();
- }
- params.cell = tdEl;
- const {
- tooltipStore
- } = reactData;
- const {
- column,
- row
- } = params;
- const {
- showAll,
- contentMethod
- } = tipOpts;
- const customContent = contentMethod ? contentMethod(params) : null;
- const useCustom = contentMethod && !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(customContent);
- 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();
- const isOver = tipOverEl.scrollWidth > tipOverEl.clientWidth;
- if (content && (showAll || useCustom || isOver)) {
- const tipContent = formatText(content);
- Object.assign(tooltipStore, {
- row,
- column,
- visible: true,
- content: tipContent,
- type,
- currOpts: tipOpts
- });
- $xeTable.$nextTick(() => {
- const $tooltip = $xeTable.$refs.refTooltip;
- if ($tooltip && $tooltip.open) {
- $tooltip.open(isOver ? tipOverEl : tipElem, tipContent);
- }
- });
- }
- return $xeTable.$nextTick();
- }
- function handleScrollToRowColumn($xeTable, fieldOrColumn, row) {
- const internalData = $xeTable;
- const {
- fullColumnIdData
- } = internalData;
- const column = handleFieldOrColumn($xeTable, fieldOrColumn);
- if (column && fullColumnIdData[column.id]) {
- return colToVisible($xeTable, column, row);
- }
- return $xeTable.$nextTick();
- }
- function handleRowExpandReserve($xeTable, row, expanded) {
- const internalData = $xeTable;
- const {
- rowExpandedReserveRowMap
- } = internalData;
- const expandOpts = $xeTable.computeExpandOpts;
- if (expandOpts.reserve) {
- const rowid = getRowid($xeTable, row);
- if (expanded) {
- rowExpandedReserveRowMap[rowid] = row;
- } else if (rowExpandedReserveRowMap[rowid]) {
- delete rowExpandedReserveRowMap[rowid];
- }
- }
- }
- function handleDefaultMergeCells($xeTable) {
- const props = $xeTable;
- const {
- mergeCells
- } = props;
- if (mergeCells) {
- $xeTable.setMergeCells(mergeCells);
- }
- }
- function handleDefaultMergeHeaderItems($xeTable) {
- const props = $xeTable;
- const {
- mergeHeaderCells
- } = props;
- if (mergeHeaderCells) {
- $xeTable.setMergeHeaderCells(mergeHeaderCells);
- }
- }
- function handleDefaultMergeFooterItems($xeTable) {
- const props = $xeTable;
- const {
- mergeFooterCells,
- mergeFooterItems
- } = props;
- const mFooterCells = mergeFooterCells || mergeFooterItems;
- if (mFooterCells) {
- $xeTable.setMergeFooterCells(mFooterCells);
- }
- }
- // 计算可视渲染相关数据
- function computeScrollLoad($xeTable) {
- const reactData = $xeTable;
- const internalData = $xeTable;
- return $xeTable.$nextTick().then(() => {
- const {
- scrollXLoad,
- scrollYLoad
- } = reactData;
- const {
- scrollXStore,
- scrollYStore
- } = internalData;
- const virtualYOpts = $xeTable.computeVirtualYOpts;
- const virtualXOpts = $xeTable.computeVirtualXOpts;
- // 计算 X 逻辑
- if (scrollXLoad) {
- const {
- toVisibleIndex: toXVisibleIndex,
- visibleSize: visibleXSize
- } = handleVirtualXVisible($xeTable);
- const offsetXSize = Math.max(0, virtualXOpts.oSize ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(virtualXOpts.oSize) : 0);
- scrollXStore.preloadSize = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(virtualXOpts.preSize);
- scrollXStore.offsetSize = offsetXSize;
- scrollXStore.visibleSize = visibleXSize;
- scrollXStore.endIndex = Math.max(scrollXStore.startIndex + scrollXStore.visibleSize + offsetXSize, scrollXStore.endIndex);
- scrollXStore.visibleStartIndex = Math.max(scrollXStore.startIndex, toXVisibleIndex);
- scrollXStore.visibleEndIndex = Math.min(scrollXStore.endIndex, toXVisibleIndex + visibleXSize);
- $xeTable.updateScrollXData().then(() => {
- loadScrollXData($xeTable);
- });
- } else {
- $xeTable.updateScrollXSpace();
- }
- // 计算 Y 逻辑
- const rowHeight = computeRowHeight($xeTable);
- scrollYStore.rowHeight = rowHeight; // 已废弃
- reactData.rowHeight = rowHeight;
- const {
- toVisibleIndex: toYVisibleIndex,
- visibleSize: visibleYSize
- } = handleVirtualYVisible($xeTable);
- if (scrollYLoad) {
- const offsetYSize = Math.max(0, virtualYOpts.oSize ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(virtualYOpts.oSize) : 0);
- scrollYStore.preloadSize = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(virtualYOpts.preSize);
- scrollYStore.offsetSize = offsetYSize;
- scrollYStore.visibleSize = visibleYSize;
- scrollYStore.endIndex = Math.max(scrollYStore.startIndex + visibleYSize + offsetYSize, scrollYStore.endIndex);
- scrollYStore.visibleStartIndex = Math.max(scrollYStore.startIndex, toYVisibleIndex);
- scrollYStore.visibleEndIndex = Math.min(scrollYStore.endIndex, toYVisibleIndex + visibleYSize);
- $xeTable.updateScrollYData().then(() => {
- loadScrollYData($xeTable);
- });
- } else {
- $xeTable.updateScrollYSpace();
- }
- });
- }
- function calcScrollbar($xeTable) {
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- scrollXWidth,
- scrollYHeight
- } = reactData;
- const {
- elemStore
- } = internalData;
- const scrollbarOpts = $xeTable.computeScrollbarOpts;
- const bodyWrapperElem = getRefElem(elemStore['main-body-wrapper']);
- const headerTableElem = getRefElem(elemStore['main-header-table']);
- const footerTableElem = getRefElem(elemStore['main-footer-table']);
- const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
- const yHandleEl = $xeTable.$refs.refScrollYHandleElem;
- let overflowY = false;
- let overflowX = false;
- if (bodyWrapperElem) {
- overflowY = scrollYHeight > bodyWrapperElem.clientHeight;
- if (yHandleEl) {
- reactData.scrollbarWidth = scrollbarOpts.width || yHandleEl.offsetWidth - yHandleEl.clientWidth || 14;
- }
- reactData.overflowY = overflowY;
- overflowX = scrollXWidth > bodyWrapperElem.clientWidth;
- if (xHandleEl) {
- reactData.scrollbarHeight = scrollbarOpts.height || xHandleEl.offsetHeight - xHandleEl.clientHeight || 14;
- }
- reactData.overflowX = overflowX;
- const hHeight = headerTableElem ? headerTableElem.clientHeight : 0;
- const fHeight = footerTableElem ? footerTableElem.clientHeight : 0;
- internalData.tableHeight = bodyWrapperElem.offsetHeight;
- internalData.tHeaderHeight = hHeight;
- internalData.tFooterHeight = fHeight;
- reactData.overflowX = overflowX;
- reactData.parentHeight = Math.max(hHeight + fHeight + 20, $xeTable.getParentHeight());
- }
- if (overflowX) {
- $xeTable.checkScrolling();
- }
- }
- function handleRecalculateStyle($xeTable, reFull, reWidth, reHeight) {
- const internalData = $xeTable;
- const el = $xeTable.$refs.refElem;
- internalData.rceRunTime = Date.now();
- if (!el || !el.clientWidth) {
- return $xeTable.$nextTick();
- }
- const varEl = $xeTable.$refs.refVarElem;
- if (varEl) {
- const [defEl, mediumEl, smallEl, miniEl] = varEl.children;
- calcVarRowHeightConfig($xeTable, 'default', defEl);
- calcVarRowHeightConfig($xeTable, 'medium', mediumEl);
- calcVarRowHeightConfig($xeTable, 'small', smallEl);
- calcVarRowHeightConfig($xeTable, 'mini', miniEl);
- }
- if (reWidth) {
- calcCellWidth($xeTable);
- }
- if (reFull) {
- autoCellWidth($xeTable);
- }
- calcScrollbar($xeTable);
- updateStyle($xeTable);
- updateRowExpandStyle($xeTable);
- return computeScrollLoad($xeTable).then(() => {
- // 初始化时需要在列计算之后再执行优化运算,达到最优显示效果
- if (reWidth) {
- calcCellWidth($xeTable);
- }
- if (reFull) {
- autoCellWidth($xeTable);
- }
- if (reHeight) {
- calcCellHeight($xeTable);
- }
- updateStyle($xeTable);
- calcScrollbar($xeTable);
- if (reFull) {
- updateRowOffsetTop($xeTable);
- }
- updateRowExpandStyle($xeTable);
- if (reFull) {
- return computeScrollLoad($xeTable);
- }
- });
- }
- function handleLazyRecalculate($xeTable, reFull, reWidth, reHeight) {
- const internalData = $xeTable;
- return new Promise(resolve => {
- const {
- rceTimeout,
- rceRunTime
- } = internalData;
- const $xeGanttView = internalData.xeGanttView;
- const resizeOpts = $xeTable.computeResizeOpts;
- const refreshDelay = resizeOpts.refreshDelay || 20;
- const el = $xeTable.$refs.refElem;
- if (el && el.clientWidth) {
- autoCellWidth($xeTable);
- updateRowExpandStyle($xeTable);
- }
- if (rceTimeout) {
- clearTimeout(rceTimeout);
- if (rceRunTime && rceRunTime + (refreshDelay - 5) < Date.now()) {
- resolve(handleRecalculateStyle($xeTable, reFull, reWidth, reHeight));
- } else {
- $xeTable.$nextTick(() => {
- resolve();
- });
- }
- } else {
- resolve(handleRecalculateStyle($xeTable, reFull, reWidth, reHeight));
- }
- if ($xeGanttView && $xeGanttView.handleLazyRecalculate) {
- $xeGanttView.handleLazyRecalculate();
- }
- internalData.rceTimeout = setTimeout(() => {
- internalData.rceTimeout = undefined;
- handleRecalculateStyle($xeTable, reFull, reWidth, reHeight);
- }, refreshDelay);
- });
- }
- function handleResizeEvent($xeTable) {
- handleLazyRecalculate($xeTable, true, true, true);
- }
- function handleUpdateAggValues($xeTable) {
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- visibleColumn
- } = internalData;
- const aggCols = [];
- visibleColumn.forEach(column => {
- if (column.aggFunc) {
- aggCols.push(column);
- }
- });
- reactData.aggHandleAggColumns = aggCols;
- }
- function handleUpdateRowGroup($xeTable, groupFields) {
- const reactData = $xeTable;
- const aggGroupFields = [];
- const aggGroupConfs = [];
- if (groupFields) {
- (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(groupFields) ? groupFields : [groupFields]).forEach(field => {
- aggGroupFields.push(field);
- aggGroupConfs.push({
- field
- });
- });
- }
- reactData.rowGroupList = aggGroupConfs;
- reactData.aggHandleFields = aggGroupFields;
- handleUpdateAggValues($xeTable);
- }
- function handleeGroupSummary($xeTable, aggList) {
- const aggregateOpts = $xeTable.computeAggregateOpts;
- const {
- mapChildrenField
- } = aggregateOpts;
- if (mapChildrenField) {
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().lastEach(aggList, aggRow => {
- let count = 0;
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(aggRow[mapChildrenField], row => {
- if (row.isAggregate) {
- count += row.childCount || 0;
- } else {
- count++;
- }
- });
- aggRow.childCount = count;
- });
- if ($xeTable.handlePivotTableAggregateData) {
- $xeTable.handlePivotTableAggregateData(aggList);
- }
- }
- }
- function updateGroupData($xeTable) {
- const props = $xeTable;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- aggregateConfig,
- rowGroupConfig
- } = props;
- const {
- isRowGroupStatus
- } = reactData;
- const {
- tableFullGroupData
- } = internalData;
- const aggregateOpts = $xeTable.computeAggregateOpts;
- const {
- mapChildrenField
- } = aggregateOpts;
- if ((aggregateConfig || rowGroupConfig) && isRowGroupStatus) {
- const aggList = [];
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(tableFullGroupData, row => {
- if (row.isAggregate) {
- aggList.push(row);
- }
- }, {
- children: mapChildrenField
- });
- handleeGroupSummary($xeTable, aggList);
- }
- }
- function handleGroupData($xeTable, list, rowGroups) {
- let fullData = list;
- let treeData = list;
- if (rowGroups) {
- const aggregateOpts = $xeTable.computeAggregateOpts;
- const {
- rowField,
- parentField,
- childrenField,
- mapChildrenField
- } = aggregateOpts;
- const checkboxOpts = $xeTable.computeCheckboxOpts;
- const {
- checkField
- } = checkboxOpts;
- const indeterminateField = checkboxOpts.indeterminateField || checkboxOpts.halfField;
- const rgItem = rowGroups[0];
- if (rgItem && rowField && parentField && childrenField && mapChildrenField) {
- fullData = [];
- treeData = [];
- const groupField = rgItem.field;
- const groupColumn = $xeTable.getColumnByField(groupField);
- const groupMaps = {};
- const aggList = [];
- const rowkey = getRowkey($xeTable);
- list.forEach(row => {
- const cellValue = groupColumn ? $xeTable.getCellLabel(row, groupColumn) : external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, groupField);
- const groupValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(cellValue) ? '' : cellValue;
- let childList = groupMaps[groupValue];
- if (!childList) {
- childList = [];
- groupMaps[groupValue] = childList;
- }
- if (row.isAggregate) {
- row.isAggregate = undefined;
- }
- childList.push(row);
- });
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().objectEach(groupMaps, (childList, groupValue) => {
- const {
- fullData: childFullData,
- treeData: childTreeData
- } = handleGroupData($xeTable, childList, rowGroups.slice(1));
- const aggRow = {
- isAggregate: true,
- aggData: {},
- groupContent: groupValue,
- groupField,
- childCount: 0,
- [rowField]: getRowUniqueId(),
- [parentField]: null,
- [rowkey]: getRowUniqueId(),
- [childrenField]: childTreeData,
- [mapChildrenField]: childTreeData
- };
- if (checkField) {
- aggRow[checkField] = false;
- }
- if (indeterminateField) {
- aggRow[indeterminateField] = false;
- }
- aggList.push(aggRow);
- treeData.push(aggRow);
- fullData.push(aggRow);
- if (childFullData.length) {
- fullData.push(...childFullData);
- }
- });
- handleeGroupSummary($xeTable, aggList);
- }
- }
- return {
- treeData,
- fullData
- };
- }
- /**
- * 加载表格数据
- * @param {Array} datas 数据
- */
- function loadTableData($xeTable, datas, isReset) {
- const props = $xeTable;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- keepSource,
- treeConfig,
- aggregateConfig,
- rowGroupConfig
- } = props;
- const {
- rowGroupList,
- scrollYLoad: oldScrollYLoad
- } = reactData;
- const {
- scrollYStore,
- scrollXStore,
- lastScrollLeft,
- lastScrollTop
- } = internalData;
- const rowOpts = $xeTable.computeRowOpts;
- const treeOpts = $xeTable.computeTreeOpts;
- const expandOpts = $xeTable.computeExpandOpts;
- const {
- transform
- } = treeOpts;
- const childrenField = treeOpts.children || treeOpts.childrenField;
- let treeData = [];
- let fullData = datas ? datas.slice(0) : []; // 转为响应式数据
- if (fullData.length > supportMaxRow) {
- errLog('vxe.error.errMaxRow', [supportMaxRow]);
- }
- if (treeConfig && rowGroupList.length) {
- errLog('vxe.error.noTree', ['aggregate-config']);
- return $xeTable.$nextTick();
- }
- if (rowOpts.drag && rowGroupList.length) {
- errLog('vxe.error.errConflicts', ['row-config.drag', 'aggregate-config']);
- return $xeTable.$nextTick();
- }
- let isRGroup = false;
- if (treeConfig) {
- if (transform) {
- // 树结构自动转换
- if (!treeOpts.rowField) {
- errLog('vxe.error.reqProp', ['tree-config.rowField']);
- }
- if (!treeOpts.parentField) {
- errLog('vxe.error.reqProp', ['tree-config.parentField']);
- }
- if (!childrenField) {
- errLog('vxe.error.reqProp', ['tree-config.childrenField']);
- }
- if (!treeOpts.mapChildrenField) {
- errLog('vxe.error.reqProp', ['tree-config.mapChildrenField']);
- }
- if (childrenField === treeOpts.mapChildrenField) {
- errLog('vxe.error.errConflicts', ['tree-config.childrenField', 'tree-config.mapChildrenField']);
- }
- // fullData.forEach(row => {
- // if (row[treeOpts.children] && row[treeOpts.children].length) {
- // warnLog('vxe.error.errConflicts', ['tree-config.transform', `row.${treeOpts.children}`])
- // }
- // })
- treeData = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toArrayTree(fullData, {
- key: treeOpts.rowField,
- parentKey: treeOpts.parentField,
- children: childrenField,
- mapChildren: treeOpts.mapChildrenField
- });
- fullData = treeData.slice(0);
- } else {
- treeData = fullData.slice(0);
- }
- } else if ((aggregateConfig || rowGroupConfig) && rowGroupList.length) {
- const groupRest = handleGroupData($xeTable, fullData, rowGroupList);
- treeData = groupRest.treeData;
- fullData = groupRest.fullData;
- isRGroup = true;
- }
- reactData.isRowGroupStatus = isRGroup;
- scrollYStore.startIndex = 0;
- scrollYStore.endIndex = 1;
- scrollXStore.startIndex = 0;
- scrollXStore.endIndex = 1;
- internalData.cvCacheMaps = {};
- reactData.isRowLoading = true;
- reactData.scrollVMLoading = false;
- reactData.treeExpandedFlag++;
- reactData.rowExpandedFlag++;
- internalData.insertRowMaps = {};
- reactData.insertRowFlag++;
- internalData.removeRowMaps = {};
- reactData.removeRowFlag++;
- const sYLoad = updateScrollYStatus($xeTable, fullData);
- // 全量数据
- internalData.tableFullData = fullData;
- internalData.tableFullTreeData = isRGroup ? [] : treeData;
- internalData.tableFullGroupData = isRGroup ? treeData : [];
- // 缓存数据
- $xeTable.cacheRowMap(isReset);
- // 原始数据
- internalData.tableSynchData = datas;
- if (isReset) {
- internalData.isResizeCellHeight = false;
- }
- // 克隆原数据,用于显示编辑状态,与编辑值做对比
- if (keepSource) {
- $xeTable.cacheSourceMap(fullData);
- }
- if ($xeTable.clearCellAreas && props.mouseConfig) {
- $xeTable.clearCellAreas();
- $xeTable.clearCopyCellArea();
- }
- $xeTable.clearMergeCells();
- $xeTable.clearMergeFooterItems();
- $xeTable.handleTableData(true);
- $xeTable.updateFooter();
- $xeTable.handleUpdateBodyMerge();
- return $xeTable.$nextTick().then(() => {
- updateHeight($xeTable);
- updateStyle($xeTable);
- }).then(() => {
- computeScrollLoad($xeTable);
- }).then(() => {
- const virtualYOpts = $xeTable.computeVirtualYOpts;
- // 是否启用了虚拟滚动
- if (sYLoad) {
- scrollYStore.endIndex = scrollYStore.visibleSize;
- }
- if (sYLoad) {
- if (reactData.expandColumn && expandOpts.mode !== 'fixed') {
- errLog('vxe.error.notConflictProp', ['column.type="expand', 'expand-config.mode="fixed"']);
- }
- if (virtualYOpts.mode === 'scroll' && expandOpts.mode === 'fixed') {
- warnLog('vxe.error.notConflictProp', ['virtual-y-config.mode=scroll', 'expand-config.mode=inside']);
- }
- // if (showOverflow) {
- // if (!rowOpts.height) {
- // const errColumn = internalData.tableFullColumn.find(column => column.showOverflow === false)
- // if (errColumn) {
- // errLog('vxe.error.errProp', [`column[field="${errColumn.field}"].show-overflow=false`, 'show-overflow=true'])
- // }
- // }
- // }
- if (!(props.height || props.maxHeight)) {
- errLog('vxe.error.reqProp', ['height | max-height | virtual-y-config={enabled: false}']);
- }
- // if (!props.showOverflow) {
- // warnLog('vxe.error.reqProp', ['table.show-overflow'])
- // }
- if (props.spanMethod) {
- errLog('vxe.error.scrollErrProp', ['table.span-method']);
- }
- }
- handleReserveStatus($xeTable);
- $xeTable.checkSelectionStatus();
- $xeTable.dispatchEvent('data-change', {
- visibleColumn: internalData.visibleColumn,
- visibleData: internalData.afterFullData
- }, null);
- return new Promise(resolve => {
- $xeTable.$nextTick().then(() => handleRecalculateStyle($xeTable, false, false, false)).then(() => {
- handleRecalculateStyle($xeTable, false, true, true);
- updateRowOffsetTop($xeTable);
- }).then(() => {
- let targetScrollLeft = lastScrollLeft;
- let targetScrollTop = lastScrollTop;
- const virtualXOpts = $xeTable.computeVirtualXOpts;
- const virtualYOpts = $xeTable.computeVirtualYOpts;
- // 是否在更新数据之后自动滚动重置滚动条
- if (virtualXOpts.scrollToLeftOnChange) {
- targetScrollLeft = 0;
- }
- if (virtualYOpts.scrollToTopOnChange) {
- targetScrollTop = 0;
- }
- reactData.isRowLoading = false;
- handleRecalculateStyle($xeTable, false, false, false);
- // 如果是自动行高,特殊情况需调用 recalculate 手动刷新
- if (!props.showOverflow) {
- setTimeout(() => {
- handleLazyRecalculate($xeTable, false, true, true);
- setTimeout(() => handleLazyRecalculate($xeTable, false, true, true), 3000);
- }, 2000);
- }
- // 是否变更虚拟滚动
- if (oldScrollYLoad === sYLoad) {
- restoreScrollLocation($xeTable, targetScrollLeft, targetScrollTop).then(() => {
- handleRecalculateStyle($xeTable, false, true, true);
- updateRowOffsetTop($xeTable);
- resolve();
- });
- } else {
- setTimeout(() => {
- restoreScrollLocation($xeTable, targetScrollLeft, targetScrollTop).then(() => {
- handleRecalculateStyle($xeTable, false, true, true);
- updateRowOffsetTop($xeTable);
- resolve();
- });
- });
- }
- });
- });
- });
- }
- /**
- * 处理数据加载默认行为
- * 默认执行一次,除非被重置
- */
- function handleLoadDefaults($xeTable) {
- handleDefaultSelectionChecked($xeTable);
- handleDefaultRadioChecked($xeTable);
- handleDefaultRowExpand($xeTable);
- handleDefaultTreeExpand($xeTable);
- handleDefaultRowGroupExpand($xeTable);
- handleDefaultMergeCells($xeTable);
- handleDefaultMergeHeaderItems($xeTable);
- handleDefaultMergeFooterItems($xeTable);
- $xeTable.$nextTick(() => setTimeout(() => $xeTable.recalculate()));
- }
- /**
- * 处理初始化的默认行为
- * 只会执行一次
- */
- function handleInitDefaults($xeTable) {
- handleDefaultSort($xeTable);
- }
- function handleTableColumn($xeTable) {
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- scrollXLoad
- } = reactData;
- const {
- visibleColumn,
- scrollXStore,
- fullColumnIdData
- } = internalData;
- const tableColumn = scrollXLoad ? visibleColumn.slice(scrollXStore.startIndex, scrollXStore.endIndex) : visibleColumn.slice(0);
- tableColumn.forEach((column, $index) => {
- const colid = column.id;
- const colRest = fullColumnIdData[colid];
- if (colRest) {
- colRest.$index = $index;
- }
- });
- reactData.tableColumn = tableColumn;
- }
- function handleUpdateColumn($xeTable) {
- const internalData = $xeTable;
- const columnList = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().orderBy(internalData.collectColumn, 'renderSortNumber');
- internalData.collectColumn = columnList;
- const tableFullColumn = getColumnList(columnList);
- internalData.tableFullColumn = tableFullColumn;
- cacheColumnMap($xeTable);
- }
- function loadScrollXData($xeTable) {
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- isScrollXBig
- } = reactData;
- const {
- mergeBodyList,
- mergeFooterList,
- scrollXStore
- } = internalData;
- const {
- preloadSize,
- startIndex,
- endIndex,
- offsetSize
- } = scrollXStore;
- const {
- toVisibleIndex,
- visibleSize
- } = handleVirtualXVisible($xeTable);
- const offsetItem = {
- startIndex: Math.max(0, isScrollXBig ? toVisibleIndex - 1 : toVisibleIndex - 1 - offsetSize - preloadSize),
- endIndex: isScrollXBig ? toVisibleIndex + visibleSize : toVisibleIndex + visibleSize + offsetSize + preloadSize
- };
- scrollXStore.visibleStartIndex = toVisibleIndex - 1;
- scrollXStore.visibleEndIndex = toVisibleIndex + visibleSize + 1;
- calculateMergerOffsetIndex(mergeBodyList.concat(mergeFooterList), offsetItem, 'col');
- const {
- startIndex: offsetStartIndex,
- endIndex: offsetEndIndex
- } = offsetItem;
- if (toVisibleIndex <= startIndex || toVisibleIndex >= endIndex - visibleSize - 1) {
- if (startIndex !== offsetStartIndex || endIndex !== offsetEndIndex) {
- scrollXStore.startIndex = offsetStartIndex;
- scrollXStore.endIndex = offsetEndIndex;
- $xeTable.updateScrollXData();
- }
- }
- $xeTable.closeTooltip();
- }
- function parseColumns($xeTable, isReset) {
- const props = $xeTable;
- const reactData = $xeTable;
- const internalData = $xeTable;
- // const { showOverflow } = props
- // const rowOpts = $xeTable.computeRowOpts
- const leftList = [];
- const centerList = [];
- const rightList = [];
- const {
- isGroup,
- columnStore
- } = reactData;
- const {
- collectColumn,
- tableFullColumn,
- scrollXStore,
- fullColumnIdData
- } = internalData;
- // 如果是分组表头,如果子列全部被隐藏,则根列也隐藏
- if (isGroup) {
- const leftGroupList = [];
- const centerGroupList = [];
- const rightGroupList = [];
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(collectColumn, (column, index, items, path, parentColumn) => {
- const isColGroup = hasChildrenList(column);
- // 如果是分组,必须按组设置固定列,不允许给子列设置固定
- if (parentColumn && parentColumn.fixed) {
- column.fixed = parentColumn.fixed;
- }
- if (parentColumn && (column.fixed || '') !== (parentColumn.fixed || '')) {
- errLog('vxe.error.groupFixed');
- }
- if (isColGroup) {
- column.visible = !!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findTree(column.children, subColumn => hasChildrenList(subColumn) ? false : subColumn.visible);
- } else if (column.visible) {
- if (column.fixed === 'left') {
- leftList.push(column);
- } else if (column.fixed === 'right') {
- rightList.push(column);
- } else {
- centerList.push(column);
- }
- }
- });
- collectColumn.forEach(column => {
- if (column.visible) {
- if (column.fixed === 'left') {
- leftGroupList.push(column);
- } else if (column.fixed === 'right') {
- rightGroupList.push(column);
- } else {
- centerGroupList.push(column);
- }
- }
- });
- reactData.tableGroupColumn = leftGroupList.concat(centerGroupList).concat(rightGroupList);
- } else {
- // 重新分配列
- tableFullColumn.forEach(column => {
- if (column.visible) {
- if (column.fixed === 'left') {
- leftList.push(column);
- } else if (column.fixed === 'right') {
- rightList.push(column);
- } else {
- centerList.push(column);
- }
- }
- });
- }
- const visibleColumn = leftList.concat(centerList).concat(rightList);
- internalData.visibleColumn = visibleColumn;
- updateColumnOffsetLeft($xeTable);
- const sXLoad = updateScrollXStatus($xeTable);
- reactData.hasFixedColumn = leftList.length > 0 || rightList.length > 0;
- Object.assign(columnStore, {
- leftList,
- centerList,
- rightList
- });
- if (sXLoad) {
- // if (showOverflow) {
- // if (!rowOpts.height) {
- // const errColumn = internalData.tableFullColumn.find(column => column.showOverflow === false)
- // if (errColumn) {
- // errLog('vxe.error.errProp', [`column[field="${errColumn.field}"].show-overflow=false`, 'show-overflow=true'])
- // }
- // }
- // }
- // if (props.showHeader && !props.showHeaderOverflow) {
- // warnLog('vxe.error.reqProp', ['show-header-overflow'])
- // }
- // if (props.showFooter && !props.showFooterOverflow) {
- // warnLog('vxe.error.reqProp', ['show-footer-overflow'])
- // }
- if (props.spanMethod) {
- warnLog('vxe.error.scrollErrProp', ['span-method']);
- }
- if (props.footerSpanMethod) {
- warnLog('vxe.error.scrollErrProp', ['footer-span-method']);
- }
- if (isReset) {
- const {
- visibleSize
- } = handleVirtualXVisible($xeTable);
- scrollXStore.startIndex = 0;
- scrollXStore.endIndex = visibleSize;
- scrollXStore.visibleSize = visibleSize;
- scrollXStore.visibleStartIndex = 0;
- scrollXStore.visibleEndIndex = visibleSize;
- }
- }
- // 如果列被显示/隐藏,则清除合并状态
- // 如果列被设置为固定,则清除合并状态
- if (visibleColumn.length !== internalData.visibleColumn.length || !internalData.visibleColumn.every((column, index) => column === visibleColumn[index])) {
- $xeTable.clearMergeCells();
- $xeTable.clearMergeFooterItems();
- }
- visibleColumn.forEach((column, index) => {
- const colid = column.id;
- const colRest = fullColumnIdData[colid];
- if (colRest) {
- colRest._index = index;
- }
- });
- handleTableColumn($xeTable);
- handleUpdateAggValues($xeTable);
- if (isReset) {
- return $xeTable.updateFooter().then(() => {
- return $xeTable.recalculate();
- }).then(() => {
- $xeTable.updateCellAreas();
- return $xeTable.recalculate();
- });
- }
- return $xeTable.updateFooter();
- }
- function initColumnHierarchy($xeTable) {
- const internalData = $xeTable;
- const {
- collectColumn
- } = internalData;
- const fullColIdData = {};
- const fullColFieldData = {};
- let sortIndex = 1;
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(collectColumn, (column, index, items, path, parentColumn) => {
- const {
- id: colid,
- field
- } = column;
- const parentId = parentColumn ? parentColumn.id : null;
- const rest = {
- $index: -1,
- _index: -1,
- column,
- colid,
- index,
- items,
- parent: parentColumn || null,
- width: 0,
- oLeft: 0
- };
- column.parentId = parentId;
- column.defaultParentId = parentId;
- column.sortNumber = sortIndex;
- column.renderSortNumber = sortIndex;
- sortIndex++;
- if (field) {
- if (fullColFieldData[field]) {
- errLog('vxe.error.colRepet', ['field', field]);
- }
- fullColFieldData[field] = rest;
- }
- fullColIdData[colid] = rest;
- });
- internalData.fullColumnIdData = fullColIdData;
- internalData.fullColumnFieldData = fullColFieldData;
- }
- function handleInitColumn($xeTable, collectColumn) {
- const props = $xeTable;
- const $xeToolbar = $xeTable.$refs.$xeToolbar;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const expandOpts = $xeTable.computeExpandOpts;
- internalData.collectColumn = collectColumn;
- const tableFullColumn = getColumnList(collectColumn);
- internalData.tableFullColumn = tableFullColumn;
- reactData.isColLoading = true;
- initColumnHierarchy($xeTable);
- return Promise.resolve(restoreCustomStorage($xeTable)).then(() => {
- const {
- scrollXLoad,
- scrollYLoad,
- expandColumn
- } = reactData;
- cacheColumnMap($xeTable);
- parseColumns($xeTable, true).then(() => {
- if (reactData.scrollXLoad) {
- loadScrollXData($xeTable);
- }
- });
- $xeTable.clearMergeCells();
- $xeTable.clearMergeFooterItems();
- $xeTable.handleTableData(true);
- $xeTable.handleAggregateSummaryData();
- if ((scrollXLoad || scrollYLoad) && expandColumn && expandOpts.mode !== 'fixed') {
- warnLog('vxe.error.scrollErrProp', ['column.type=expand']);
- }
- return $xeTable.$nextTick().then(() => {
- if ($xeToolbar) {
- $xeToolbar.syncUpdate({
- collectColumn: internalData.collectColumn,
- $table: $xeTable
- });
- }
- if ($xeTable.handleUpdateCustomColumn) {
- $xeTable.handleUpdateCustomColumn();
- }
- const columnOpts = $xeTable.computeColumnOpts;
- if (props.showCustomHeader && reactData.isGroup && (columnOpts.resizable || props.resizable)) {
- warnLog('vxe.error.notConflictProp', ['show-custom-header & colgroup', 'column-config.resizable=false']);
- }
- reactData.isColLoading = false;
- return handleLazyRecalculate($xeTable, false, true, true);
- });
- });
- }
- /**
- * 纵向 Y 可视渲染处理
- */
- function loadScrollYData($xeTable) {
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- isAllOverflow,
- isScrollYBig
- } = reactData;
- const {
- mergeBodyList,
- scrollYStore
- } = internalData;
- const {
- preloadSize,
- startIndex,
- endIndex,
- offsetSize
- } = scrollYStore;
- const autoOffsetYSize = isAllOverflow ? offsetSize : offsetSize + 1;
- const {
- toVisibleIndex,
- visibleSize
- } = handleVirtualYVisible($xeTable);
- const offsetItem = {
- startIndex: Math.max(0, isScrollYBig ? toVisibleIndex - 1 : toVisibleIndex - 1 - offsetSize - preloadSize),
- endIndex: isScrollYBig ? toVisibleIndex + visibleSize : toVisibleIndex + visibleSize + autoOffsetYSize + preloadSize
- };
- scrollYStore.visibleStartIndex = toVisibleIndex - 1;
- scrollYStore.visibleEndIndex = toVisibleIndex + visibleSize + 1;
- calculateMergerOffsetIndex(mergeBodyList, offsetItem, 'row');
- const {
- startIndex: offsetStartIndex,
- endIndex: offsetEndIndex
- } = offsetItem;
- if (toVisibleIndex <= startIndex || toVisibleIndex >= endIndex - visibleSize - 1) {
- if (startIndex !== offsetStartIndex || endIndex !== offsetEndIndex) {
- scrollYStore.startIndex = offsetStartIndex;
- scrollYStore.endIndex = offsetEndIndex;
- $xeTable.updateScrollYData();
- }
- }
- }
- const createGetRowCacheProp = prop => {
- return function (row) {
- const $xeTable = this;
- const internalData = $xeTable;
- const {
- fullAllDataRowIdData
- } = internalData;
- if (row) {
- const rowid = getRowid($xeTable, row);
- const rowRest = fullAllDataRowIdData[rowid];
- if (rowRest) {
- return rowRest[prop];
- }
- }
- return -1;
- };
- };
- const createGetColumnCacheProp = prop => {
- return function (column) {
- const $xeTable = this;
- const internalData = $xeTable;
- const {
- fullColumnIdData
- } = internalData;
- if (column) {
- const colRest = fullColumnIdData[column.id];
- if (colRest) {
- return colRest[prop];
- }
- }
- return -1;
- };
- };
- function lazyScrollXData($xeTable) {
- const internalData = $xeTable;
- const {
- lxTimeout,
- lxRunTime,
- scrollXStore
- } = internalData;
- const {
- visibleSize
- } = scrollXStore;
- const fpsTime = visibleSize > 26 ? 26 : visibleSize > 16 ? 14 : 6;
- if (lxTimeout) {
- clearTimeout(lxTimeout);
- }
- if (!lxRunTime || lxRunTime + fpsTime < Date.now()) {
- internalData.lxRunTime = Date.now();
- loadScrollXData($xeTable);
- }
- internalData.lxTimeout = setTimeout(() => {
- internalData.lxTimeout = undefined;
- internalData.lxRunTime = undefined;
- loadScrollXData($xeTable);
- }, fpsTime);
- }
- function lazyScrollYData($xeTable) {
- const internalData = $xeTable;
- const {
- lyTimeout,
- lyRunTime,
- scrollYStore
- } = internalData;
- const {
- visibleSize
- } = scrollYStore;
- const fpsTime = visibleSize > 30 ? 32 : visibleSize > 20 ? 18 : 8;
- if (lyTimeout) {
- clearTimeout(lyTimeout);
- }
- if (!lyRunTime || lyRunTime + fpsTime < Date.now()) {
- internalData.lyRunTime = Date.now();
- loadScrollYData($xeTable);
- }
- internalData.lyTimeout = setTimeout(() => {
- internalData.lyTimeout = undefined;
- internalData.lyRunTime = undefined;
- loadScrollYData($xeTable);
- }, fpsTime);
- }
- function checkLastSyncScroll($xeTable, isRollX, isRollY) {
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- lcsTimeout
- } = internalData;
- if (lcsTimeout) {
- clearTimeout(lcsTimeout);
- }
- internalData.lcsTimeout = setTimeout(() => {
- const {
- scrollXLoad,
- scrollYLoad,
- isAllOverflow
- } = reactData;
- internalData.lcsRunTime = Date.now();
- internalData.lcsTimeout = undefined;
- internalData.intoRunScroll = false;
- internalData.inVirtualScroll = false;
- internalData.inWheelScroll = false;
- internalData.inHeaderScroll = false;
- internalData.inBodyScroll = false;
- internalData.inFooterScroll = false;
- internalData.scrollRenderType = '';
- if (!isAllOverflow) {
- calcCellHeight($xeTable);
- updateRowOffsetTop($xeTable);
- }
- if (isRollX && scrollXLoad) {
- $xeTable.updateScrollXData();
- }
- if (isRollY && scrollYLoad) {
- $xeTable.updateScrollYData().then(() => {
- if (!isAllOverflow) {
- calcCellHeight($xeTable);
- updateRowOffsetTop($xeTable);
- }
- $xeTable.updateScrollYSpace();
- });
- }
- $xeTable.updateCellAreas();
- }, 200);
- }
- const getWheelSpeed = lastScrollTime => {
- let multiple = 1;
- const currTime = Date.now();
- if (lastScrollTime + 25 > currTime) {
- multiple = 1.18;
- } else if (lastScrollTime + 30 > currTime) {
- multiple = 1.15;
- } else if (lastScrollTime + 40 > currTime) {
- multiple = 1.12;
- } else if (lastScrollTime + 55 > currTime) {
- multiple = 1.09;
- } else if (lastScrollTime + 75 > currTime) {
- multiple = 1.06;
- } else if (lastScrollTime + 100 > currTime) {
- multiple = 1.03;
- }
- return multiple;
- };
- const wheelScrollLeftTo = (scrollLeft, cb) => {
- requestAnimationFrame(() => {
- cb(scrollLeft);
- });
- };
- const wheelScrollTopTo = (diffNum, cb) => {
- const duration = Math.abs(diffNum);
- const startTime = performance.now();
- let countTop = 0;
- const step = timestamp => {
- let progress = (timestamp - startTime) / duration;
- if (progress < 0) {
- progress = 0;
- } else if (progress > 1) {
- progress = 1;
- }
- const easedProgress = Math.pow(progress, 2);
- const offsetTop = Math.floor(diffNum * easedProgress) - countTop;
- countTop += offsetTop;
- cb(offsetTop);
- if (progress < 1) {
- requestAnimationFrame(step);
- }
- };
- requestAnimationFrame(step);
- };
- const syncGanttScrollTop = ($xeTable, scrollTop) => {
- const internalData = $xeTable;
- const $xeGanttView = internalData.xeGanttView;
- if ($xeGanttView) {
- const ganttInternalData = $xeGanttView.internalData;
- const {
- elemStore: ganttElemStore
- } = ganttInternalData;
- const ganttBodyScrollElem = getRefElem(ganttElemStore['main-body-scroll']);
- if (ganttBodyScrollElem) {
- ganttBodyScrollElem.scrollTop = scrollTop;
- }
- }
- };
- function updateHeight($xeTable) {
- const reactData = $xeTable;
- const internalData = $xeTable;
- internalData.customHeight = calcTableHeight($xeTable, 'height');
- internalData.customMinHeight = calcTableHeight($xeTable, 'minHeight');
- internalData.customMaxHeight = calcTableHeight($xeTable, 'maxHeight');
- // 如果启用虚拟滚动,默认高度
- if (reactData.scrollYLoad && !(internalData.customHeight || internalData.customMinHeight)) {
- internalData.customHeight = 300;
- }
- }
- function calcColumnAutoWidth($xeTable, column, wrapperEl) {
- const columnOpts = $xeTable.computeColumnOpts;
- const {
- autoOptions
- } = columnOpts;
- const {
- isCalcHeader,
- isCalcBody,
- isCalcFooter
- } = autoOptions || {};
- const querySelections = [];
- if (isCalcHeader) {
- querySelections.push(`.vxe-header-cell--wrapper[colid="${column.id}"]`);
- }
- if (isCalcBody) {
- querySelections.push(`.vxe-body-cell--wrapper[colid="${column.id}"]`);
- }
- if (isCalcFooter) {
- querySelections.push(`.vxe-footer-cell--wrapper[colid="${column.id}"]`);
- }
- const cellElemList = querySelections.length ? wrapperEl.querySelectorAll(querySelections.join(',')) : [];
- let leftRightPadding = 0;
- const firstCellEl = cellElemList[0];
- if (firstCellEl && firstCellEl.parentElement) {
- const cellStyle = getComputedStyle(firstCellEl.parentElement);
- 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));
- }
- let colWidth = column.renderAutoWidth - leftRightPadding;
- for (let i = 0; i < cellElemList.length; i++) {
- const celEl = cellElemList[i];
- colWidth = Math.max(colWidth, celEl ? Math.ceil(celEl.scrollWidth) + 4 : 0);
- }
- return colWidth + leftRightPadding;
- }
- function calcCellWidth($xeTable) {
- const internalData = $xeTable;
- const autoWidthColumnList = $xeTable.computeAutoWidthColumnList;
- const {
- fullColumnIdData
- } = internalData;
- const el = $xeTable.$refs.refElem;
- if (el) {
- el.setAttribute('data-calc-col', 'Y');
- autoWidthColumnList.forEach(column => {
- const colid = column.id;
- const colRest = fullColumnIdData[colid];
- const colWidth = calcColumnAutoWidth($xeTable, column, el);
- if (colRest) {
- colRest.width = Math.max(colWidth, colRest.width);
- }
- column.renderAutoWidth = colWidth;
- });
- $xeTable.analyColumnWidth();
- el.removeAttribute('data-calc-col');
- }
- }
- function handleUpdateColResize($xeTable, evnt, params) {
- $xeTable.analyColumnWidth();
- $xeTable.recalculate().then(() => {
- $xeTable.saveCustomStore('update:width');
- $xeTable.updateCellAreas();
- $xeTable.dispatchEvent('column-resizable-change', params, evnt);
- // 已废弃 resizable-change
- $xeTable.dispatchEvent('resizable-change', params, evnt);
- setTimeout(() => $xeTable.recalculate(true), 300);
- });
- }
- function handleUpdateRowResize($xeTable, evnt, params) {
- const reactData = $xeTable;
- reactData.resizeHeightFlag++;
- $xeTable.recalculate().then(() => {
- $xeTable.updateCellAreas();
- $xeTable.dispatchEvent('row-resizable-change', params, evnt);
- setTimeout(() => $xeTable.recalculate(true), 300);
- });
- }
- function updateColumnOffsetLeft($xeTable) {
- const internalData = $xeTable;
- const {
- visibleColumn,
- fullColumnIdData
- } = internalData;
- let offsetLeft = 0;
- for (let cIndex = 0, rLen = visibleColumn.length; cIndex < rLen; cIndex++) {
- const column = visibleColumn[cIndex];
- const colid = column.id;
- const colRest = fullColumnIdData[colid];
- if (colRest) {
- colRest.oLeft = offsetLeft;
- }
- offsetLeft += column.renderWidth;
- }
- }
- function updateRowOffsetTop($xeTable) {
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- expandColumn
- } = reactData;
- const {
- afterFullData,
- fullAllDataRowIdData,
- rowExpandedMaps
- } = internalData;
- const expandOpts = $xeTable.computeExpandOpts;
- const rowOpts = $xeTable.computeRowOpts;
- const cellOpts = $xeTable.computeCellOpts;
- const defaultRowHeight = $xeTable.computeDefaultRowHeight;
- const {
- handleGetRowId
- } = createHandleGetRowId($xeTable);
- let offsetTop = 0;
- for (let rIndex = 0, rLen = afterFullData.length; rIndex < rLen; rIndex++) {
- const row = afterFullData[rIndex];
- const rowid = handleGetRowId(row);
- const rowRest = fullAllDataRowIdData[rowid] || {};
- rowRest.oTop = offsetTop;
- offsetTop += rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight;
- // 是否展开行
- if (expandColumn && rowExpandedMaps[rowid]) {
- offsetTop += rowRest.expandHeight || expandOpts.height || 0;
- }
- }
- }
- /**
- * 更新展开行样式
- */
- function updateRowExpandStyle($xeTable) {
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- expandColumn,
- scrollYLoad,
- scrollYTop,
- isScrollYBig
- } = reactData;
- const expandOpts = $xeTable.computeExpandOpts;
- const rowOpts = $xeTable.computeRowOpts;
- const cellOpts = $xeTable.computeCellOpts;
- const defaultRowHeight = $xeTable.computeDefaultRowHeight;
- const {
- mode
- } = expandOpts;
- if (expandColumn && mode === 'fixed') {
- const {
- elemStore,
- fullAllDataRowIdData
- } = internalData;
- const rowExpandEl = $xeTable.$refs.refRowExpandElem;
- const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
- if (rowExpandEl && bodyScrollElem) {
- let isUpdateHeight = false;
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayEach(rowExpandEl.children, reEl => {
- const expandEl = reEl;
- const rowid = expandEl.getAttribute('rowid') || '';
- const rowRest = fullAllDataRowIdData[rowid];
- if (rowRest) {
- const expandHeight = expandEl.offsetHeight + 1;
- const trEl = bodyScrollElem.querySelector(`.vxe-body--row[rowid="${rowid}"]`);
- let offsetTop = 0;
- if (scrollYLoad) {
- if (isScrollYBig && trEl) {
- offsetTop = trEl.offsetTop + trEl.offsetHeight;
- } else {
- offsetTop = rowRest.oTop + (rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight);
- }
- } else {
- if (trEl) {
- offsetTop = trEl.offsetTop + trEl.offsetHeight;
- }
- }
- if (isScrollYBig) {
- offsetTop += scrollYTop;
- }
- expandEl.style.top = toCssUnit(offsetTop);
- if (!isUpdateHeight) {
- if (rowRest.expandHeight !== expandHeight) {
- isUpdateHeight = true;
- }
- }
- rowRest.expandHeight = expandHeight;
- }
- });
- if (isUpdateHeight) {
- reactData.rowExpandHeightFlag++;
- $xeTable.$nextTick(() => {
- updateRowOffsetTop($xeTable);
- });
- }
- }
- }
- }
- /**
- * 更新树连接线样式
- */
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
- function updateTreeLineStyle($xeTable) {
- // 待优化
- }
- function handleRowExpandScroll($xeTable) {
- const internalData = $xeTable;
- const {
- elemStore
- } = internalData;
- const rowExpandEl = $xeTable.$refs.refRowExpandElem;
- const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
- if (rowExpandEl && bodyScrollElem) {
- rowExpandEl.scrollTop = bodyScrollElem.scrollTop;
- }
- }
- const Methods = {
- callSlot(slotFunc, params, h, vNodes) {
- const $xeTable = this;
- // const slots = $xeTable.$scopedSlots
- const $xeGrid = $xeTable.$xeGrid;
- const $xeGantt = $xeTable.$xeGantt;
- const $xeGGWrapper = $xeGrid || $xeGantt;
- if (slotFunc) {
- if ($xeGGWrapper) {
- return $xeGGWrapper.callSlot(slotFunc, params, h);
- }
- // if (XEUtils.isString(slotFunc)) {
- // slotFunc = slots[slotFunc] || null
- // }
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(slotFunc)) {
- return getSlotVNs(slotFunc.call(this, params, h, vNodes));
- }
- }
- return [];
- },
- getEl() {
- const $xeTable = this;
- return $xeTable.$refs.refElem;
- },
- /**
- * 获取父容器元素
- */
- getParentElem() {
- const $xeTable = this;
- const $xeGrid = $xeTable.$xeGrid;
- const $xeGantt = $xeTable.$xeGantt;
- const $xeGGWrapper = $xeGrid || $xeGantt;
- const {
- $el
- } = this;
- return $xeGGWrapper ? $xeGGWrapper.$el.parentNode : $el.parentNode;
- },
- /**
- * 获取父容器的高度
- */
- getParentHeight() {
- const $xeTable = this;
- const $xeGrid = $xeTable.$xeGrid;
- const $xeGantt = $xeTable.$xeGantt;
- const props = $xeTable;
- const {
- height
- } = props;
- const el = $xeTable.$refs.refElem;
- if (el) {
- const parentElem = el.parentNode;
- const parentPaddingSize = height === '100%' || height === 'auto' ? getPaddingTopBottomSize(parentElem) : 0;
- let parentWrapperHeight = 0;
- if (parentElem) {
- if ($xeGantt && hasClass(parentElem, 'vxe-gantt--table-wrapper')) {
- parentWrapperHeight = $xeGantt.getParentHeight();
- } else if ($xeGrid && hasClass(parentElem, 'vxe-grid--table-wrapper')) {
- parentWrapperHeight = $xeGrid.getParentHeight();
- } else {
- parentWrapperHeight = parentElem.clientHeight;
- }
- }
- return Math.floor(parentWrapperHeight - parentPaddingSize);
- }
- return 0;
- },
- /**
- * 获取需要排除的高度
- * 但渲染表格高度时,需要排除工具栏或分页等相关组件的高度
- * 如果存在表尾合计滚动条,则需要排除滚动条高度
- */
- getExcludeHeight() {
- const $xeTable = this;
- const $xeGrid = $xeTable.$xeGrid;
- const $xeGantt = $xeTable.$xeGantt;
- const $xeGGWrapper = $xeGrid || $xeGantt;
- return $xeGGWrapper ? $xeGGWrapper.getExcludeHeight() : 0;
- },
- /**
- * 重置表格的一切数据状态
- */
- clearAll() {
- return clearTableAllStatus(this);
- },
- handleUpdateRowGroup(groupFields) {
- const $xeTable = this;
- handleUpdateRowGroup($xeTable, groupFields);
- },
- /**
- * 同步 data 数据(即将废弃)
- * 如果用了该方法,那么组件将不再记录增删改的状态,只能自行实现对应逻辑
- * 对于某些特殊的场景,比如深层树节点元素发生变动时可能会用到
- */
- syncData() {
- const $xeTable = this;
- const reactData = $xeTable;
- const internalData = $xeTable;
- errLog('vxe.error.delFunc', ['syncData', 'getData']);
- return $xeTable.$nextTick().then(() => {
- reactData.tableData = [];
- return $xeTable.$nextTick().then(() => loadTableData($xeTable, internalData.tableFullData, true));
- });
- },
- /**
- * 手动处理数据,用于手动排序与筛选
- * 对于手动更改了排序、筛选...等条件后需要重新处理数据时可能会用到
- */
- updateData() {
- const $xeTable = this;
- const reactData = $xeTable;
- const {
- scrollXLoad,
- scrollYLoad
- } = reactData;
- return $xeTable.handleTableData(true).then(() => {
- $xeTable.updateFooter();
- if (scrollXLoad || scrollYLoad) {
- if (scrollXLoad) {
- $xeTable.updateScrollXSpace();
- }
- if (scrollYLoad) {
- $xeTable.updateScrollYSpace();
- }
- return $xeTable.refreshScroll();
- }
- }).then(() => {
- $xeTable.updateCellAreas();
- return handleLazyRecalculate($xeTable, true, true, true);
- }).then(() => {
- // 存在滚动行为未结束情况
- setTimeout(() => handleLazyRecalculate($xeTable, false, true, true), 50);
- });
- },
- handleTableData(force) {
- const $xeTable = this;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- scrollYLoad
- } = reactData;
- const {
- scrollYStore,
- fullDataRowIdData
- } = internalData;
- const $xeGanttView = internalData.xeGanttView;
- let fullList = internalData.afterFullData;
- // 是否进行数据处理
- if (force) {
- // 更新数据,处理筛选和排序
- updateAfterFullData($xeTable);
- // 如果为虚拟树,将树结构拍平
- fullList = handleVirtualTreeToList($xeTable);
- }
- const tableData = scrollYLoad ? fullList.slice(scrollYStore.startIndex, scrollYStore.endIndex) : fullList.slice(0);
- const visibleDataRowIdMaps = {};
- tableData.forEach((row, $index) => {
- const rowid = getRowid($xeTable, row);
- const rest = fullDataRowIdData[rowid];
- if (rest) {
- rest.$index = $index;
- }
- visibleDataRowIdMaps[rowid] = row;
- });
- reactData.tableData = tableData;
- internalData.visibleDataRowIdData = visibleDataRowIdMaps;
- if ($xeGanttView && $xeGanttView.updateViewData) {
- $xeGanttView.updateViewData();
- }
- return $xeTable.$nextTick();
- },
- /**
- * 加载表格数据
- * @param {Array} datas 数据
- */
- loadTableData(datas, isReset) {
- const $xeTable = this;
- return loadTableData($xeTable, datas, isReset);
- },
- /**
- * 重新加载数据,不会清空表格状态
- * @param {Array} datas 数据
- */
- loadData(datas) {
- const $xeTable = this;
- const {
- initStatus
- } = this;
- return loadTableData($xeTable, datas, false).then(() => {
- this.inited = true;
- this.initStatus = true;
- if (!initStatus) {
- handleLoadDefaults($xeTable);
- }
- return handleLazyRecalculate($xeTable, false, true, true);
- });
- },
- /**
- * 重新加载数据,会清空表格状态
- * @param {Array} datas 数据
- */
- reloadData(datas) {
- const $xeTable = this;
- return this.clearAll().then(() => {
- this.inited = true;
- this.initStatus = true;
- return loadTableData($xeTable, datas, true);
- }).then(() => {
- handleLoadDefaults($xeTable);
- return handleLazyRecalculate($xeTable, false, true, true);
- });
- },
- /**
- * 修改行数据
- */
- setRow(rows, record) {
- if (record) {
- let rest = rows;
- if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(rows)) {
- rest = [rows];
- }
- rest.forEach(item => Object.assign(item, record));
- }
- return this.$nextTick();
- },
- /**
- * 局部加载行数据并恢复到初始状态
- * 对于行数据需要局部更改的场景中可能会用到
- * @param {Row} row 行对象
- * @param {Object} record 新数据
- * @param {String} field 字段名
- */
- reloadRow(row, record, field) {
- const $xeTable = this;
- const props = $xeTable;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- keepSource
- } = props;
- const {
- tableData
- } = reactData;
- const {
- sourceDataRowIdData
- } = internalData;
- if (keepSource) {
- if ($xeTable.isAggregateRecord(row)) {
- return $xeTable.$nextTick();
- }
- const oRow = sourceDataRowIdData[getRowid($xeTable, row)];
- if (oRow && row) {
- if (field) {
- 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);
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(row, field, newValue);
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(oRow, field, newValue);
- } else {
- const rowkey = getRowkey($xeTable);
- const rowid = getRowid($xeTable, row);
- const newRecord = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().clone(Object.assign({}, record), true);
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(newRecord, rowkey, rowid);
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().destructuring(oRow, Object.assign(row, newRecord));
- }
- }
- reactData.tableData = tableData.slice(0);
- } else {
- errLog('vxe.error.reqProp', ['keep-source']);
- }
- return $xeTable.$nextTick();
- },
- /**
- * 加载列配置
- * 对于表格列需要重载、局部递增场景下可能会用到
- * @param {ColumnInfo} columns 列配置
- */
- loadColumn(columns) {
- const $xeTable = this;
- const internalData = $xeTable;
- const {
- lastScrollLeft,
- lastScrollTop
- } = internalData;
- const collectColumn = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().mapTree(columns, column => cell.createColumn($xeTable, column), {
- children: 'children'
- });
- return handleInitColumn($xeTable, collectColumn).then(() => {
- let targetScrollLeft = lastScrollLeft;
- let targetScrollTop = lastScrollTop;
- const virtualXOpts = $xeTable.computeVirtualXOpts;
- const virtualYOpts = $xeTable.computeVirtualYOpts;
- // 是否在更新数据之后自动滚动重置滚动条
- if (virtualXOpts.scrollToLeftOnChange) {
- targetScrollLeft = 0;
- }
- if (virtualYOpts.scrollToTopOnChange) {
- targetScrollTop = 0;
- }
- restoreScrollLocation($xeTable, targetScrollLeft, targetScrollTop);
- });
- },
- /**
- * 加载列配置并恢复到初始状态
- * 对于表格列需要重载、局部递增场景下可能会用到
- * @param {ColumnInfo} columns 列配置
- */
- reloadColumn(columns) {
- return this.clearAll().then(() => {
- return this.loadColumn(columns);
- });
- },
- handleInitColumn(collectColumn) {
- const $xeTable = this;
- return handleInitColumn($xeTable, collectColumn);
- },
- /**
- * 更新数据行的 Map
- */
- cacheRowMap(isReset) {
- const $xeTable = this;
- const props = $xeTable;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- treeConfig
- } = props;
- const {
- isRowGroupStatus
- } = reactData;
- const {
- currKeyField,
- fullAllDataRowIdData,
- tableFullData,
- tableFullTreeData,
- tableFullGroupData,
- treeExpandedMaps
- } = internalData;
- const fullAllDataRowIdMaps = isReset ? {} : {
- ...fullAllDataRowIdData
- }; // 存在已删除数据
- const fullDataRowIdMaps = {};
- const idMaps = {};
- const {
- handleUpdateRowId
- } = createHandleUpdateRowId($xeTable);
- const handleRowCache = (row, index, items, currIndex, parentRow, rowid, level, seq) => {
- let rowRest = fullAllDataRowIdMaps[rowid];
- if (idMaps[rowid]) {
- errLog('vxe.error.repeatKey', [currKeyField, rowid]);
- }
- if (!rowRest) {
- rowRest = {
- row,
- rowid,
- seq,
- index: -1,
- _index: -1,
- $index: -1,
- treeIndex: index,
- _tIndex: -1,
- items,
- parent: parentRow,
- level,
- height: 0,
- resizeHeight: 0,
- oTop: 0,
- expandHeight: 0
- };
- }
- rowRest.treeLoaded = false;
- rowRest.expandLoaded = false;
- rowRest.row = row;
- rowRest.items = items;
- rowRest.parent = parentRow;
- rowRest.level = level;
- rowRest.index = currIndex;
- rowRest.treeIndex = index;
- idMaps[rowid] = true;
- fullDataRowIdMaps[rowid] = rowRest;
- fullAllDataRowIdMaps[rowid] = rowRest;
- };
- if (treeConfig) {
- const treeOpts = $xeTable.computeTreeOpts;
- const {
- lazy
- } = treeOpts;
- const childrenField = treeOpts.children || treeOpts.childrenField;
- const hasChildField = treeOpts.hasChild || treeOpts.hasChildField;
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(tableFullTreeData, (row, index, items, path, parentRow, nodes) => {
- const rowid = handleUpdateRowId(row);
- if (treeConfig && lazy) {
- if (row[hasChildField] && row[childrenField] === undefined) {
- row[childrenField] = null;
- }
- if (treeExpandedMaps[rowid]) {
- if (!row[childrenField] || !row[childrenField].length) {
- delete treeExpandedMaps[rowid];
- }
- }
- }
- handleRowCache(row, index, items, parentRow ? -1 : index, parentRow, rowid, nodes.length - 1, toTreePathSeq(path));
- }, {
- children: childrenField
- });
- } else if (isRowGroupStatus) {
- const aggregateOpts = $xeTable.computeAggregateOpts;
- const {
- mapChildrenField
- } = aggregateOpts;
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(tableFullGroupData, (row, index, items, path, parentRow, nodes) => {
- const rowid = handleUpdateRowId(row);
- handleRowCache(row, index, items, parentRow ? -1 : index, parentRow, rowid, nodes.length - 1, toTreePathSeq(path));
- }, {
- children: mapChildrenField
- });
- } else {
- tableFullData.forEach((row, index, items) => {
- handleRowCache(row, index, items, index, null, handleUpdateRowId(row), 0, index + 1);
- });
- }
- internalData.fullDataRowIdData = fullDataRowIdMaps;
- internalData.fullAllDataRowIdData = fullAllDataRowIdMaps;
- reactData.treeExpandedFlag++;
- },
- cacheSourceMap(fullData) {
- const $xeTable = this;
- const props = $xeTable;
- const internalData = $xeTable;
- const {
- treeConfig
- } = props;
- const treeOpts = $xeTable.computeTreeOpts;
- const sourceData = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().clone(fullData, true);
- const {
- handleUpdateRowId
- } = createHandleUpdateRowId($xeTable);
- const sourceRowIdData = {};
- const handleSourceRow = row => {
- const rowid = handleUpdateRowId(row);
- sourceRowIdData[rowid] = row;
- };
- // 源数据缓存
- if (treeConfig) {
- const childrenField = treeOpts.children || treeOpts.childrenField;
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(sourceData, handleSourceRow, {
- children: treeOpts.transform ? treeOpts.mapChildrenField : childrenField
- });
- } else {
- sourceData.forEach(handleSourceRow);
- }
- internalData.sourceDataRowIdData = sourceRowIdData;
- internalData.tableSourceData = sourceData;
- },
- getParams() {
- const $xeTable = this;
- const props = $xeTable;
- return props.params;
- },
- loadTreeChildren(row, childRecords) {
- const $xeTable = this;
- const props = $xeTable;
- const internalData = $xeTable;
- const {
- keepSource
- } = props;
- const {
- tableSourceData,
- fullDataRowIdData,
- fullAllDataRowIdData,
- sourceDataRowIdData
- } = internalData;
- const treeOpts = $xeTable.computeTreeOpts;
- const {
- transform,
- mapChildrenField
- } = treeOpts;
- const childrenField = treeOpts.children || treeOpts.childrenField;
- const parentRest = fullAllDataRowIdData[getRowid($xeTable, row)];
- const parentLevel = parentRest ? parentRest.level : 0;
- return this.createData(childRecords).then(rows => {
- if (keepSource) {
- const rowid = getRowid(this, row);
- const matchObj = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findTree(tableSourceData, item => rowid === getRowid(this, item), {
- children: childrenField
- });
- if (matchObj) {
- matchObj.item[childrenField] = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().clone(rows, true);
- }
- rows.forEach(childRow => {
- const rowid = getRowid(this, childRow);
- sourceDataRowIdData[rowid] = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().clone(childRow, true);
- });
- }
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(rows, (childRow, index, items, path, parentItem, nodes) => {
- const rowid = getRowid($xeTable, childRow);
- const parentRow = parentItem || parentRest.row;
- const rest = {
- row: childRow,
- rowid,
- seq: -1,
- index,
- _index: -1,
- $index: -1,
- treeIndex: -1,
- _tIndex: -1,
- items,
- parent: parentRow,
- level: parentLevel + nodes.length,
- height: 0,
- resizeHeight: 0,
- oTop: 0,
- expandHeight: 0
- };
- fullDataRowIdData[rowid] = rest;
- fullAllDataRowIdData[rowid] = rest;
- }, {
- children: childrenField
- });
- row[childrenField] = rows;
- if (transform) {
- row[mapChildrenField] = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().clone(rows, false);
- }
- updateAfterDataIndex($xeTable);
- return rows;
- });
- },
- /**
- * 根据 tr 元素获取对应的 row 信息
- * @param {Element} tr 元素
- */
- getRowNode(tr) {
- const $xeTable = this;
- const internalData = $xeTable;
- if (tr) {
- const {
- fullAllDataRowIdData
- } = internalData;
- const rowid = tr.getAttribute('rowid');
- if (rowid) {
- const rowRest = fullAllDataRowIdData[rowid];
- if (rowRest) {
- return {
- rowid: rowRest.rowid,
- item: rowRest.row,
- index: rowRest.index,
- items: rowRest.items,
- parent: rowRest.parent
- };
- }
- }
- }
- return null;
- },
- /**
- * 根据 th/td 元素获取对应的 column 信息
- * @param {Element} cell 元素
- */
- getColumnNode(cell) {
- const $xeTable = this;
- const internalData = $xeTable;
- if (cell) {
- const {
- fullColumnIdData
- } = internalData;
- const colid = cell.getAttribute('colid');
- if (colid) {
- const colRest = fullColumnIdData[colid];
- if (colRest) {
- return {
- colid: colRest.colid,
- item: colRest.column,
- index: colRest.index,
- items: colRest.items,
- parent: colRest.parent
- };
- }
- }
- }
- return null;
- },
- /**
- * 根据 row 获取序号
- * @param {Row} row 行对象
- */
- getRowSeq: createGetRowCacheProp('seq'),
- /**
- * 根据 row 获取相对于 data 中的索引
- * @param {Row} row 行对象
- */
- getRowIndex: createGetRowCacheProp('index'),
- /**
- * 根据 row 获取相对于当前数据中的索引
- * @param {Row} row 行对象
- */
- getVTRowIndex: createGetRowCacheProp('_index'),
- /**
- * 根据 row 获取渲染中的虚拟索引
- * @param {Row} row 行对象
- */
- getVMRowIndex: createGetRowCacheProp('$index'),
- // 在 v3 中废弃
- _getRowIndex(row) {
- warnLog('vxe.error.delFunc', ['_getRowIndex', 'getVTRowIndex']);
- return this.getVTRowIndex(row);
- },
- // 在 v3 中废弃
- $getRowIndex(row) {
- warnLog('vxe.error.delFunc', ['$getRowIndex', 'getVMRowIndex']);
- return this.getVMRowIndex(row);
- },
- /**
- * 根据 column 获取相对于 columns 中的索引
- * @param {ColumnInfo} column 列配置
- */
- getColumnIndex: createGetColumnCacheProp('index'),
- /**
- * 根据 column 获取相对于当前表格列中的索引
- * @param {ColumnInfo} column 列配置
- */
- getVTColumnIndex: createGetColumnCacheProp('_index'),
- /**
- * 根据 column 获取渲染中的虚拟索引
- * @param {ColumnInfo} column 列配置
- */
- getVMColumnIndex: createGetColumnCacheProp('$index'),
- // 在 v3 中废弃
- _getColumnIndex(column) {
- warnLog('vxe.error.delFunc', ['_getColumnIndex', 'getVTColumnIndex']);
- return this.getVTColumnIndex(column);
- },
- // 在 v3 中废弃
- $getColumnIndex(column) {
- warnLog('vxe.error.delFunc', ['$getColumnIndex', 'getVMColumnIndex']);
- return this.getVMColumnIndex(column);
- },
- /**
- * 判断是否为索引列
- * @param {ColumnInfo} column 列配置
- */
- isSeqColumn(column) {
- return column && column.type === 'seq';
- },
- /**
- * 定义行数据中的列属性,如果不存在则定义
- * @param {Row} records 行数据
- */
- defineField(records) {
- const $xeTable = this;
- const props = $xeTable;
- const internalData = $xeTable;
- const {
- treeConfig
- } = props;
- const expandOpts = $xeTable.computeExpandOpts;
- const treeOpts = $xeTable.computeTreeOpts;
- const radioOpts = $xeTable.computeRadioOpts;
- const checkboxOpts = $xeTable.computeCheckboxOpts;
- const childrenField = treeOpts.children || treeOpts.childrenField;
- const rowkey = getRowkey($xeTable);
- if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(records)) {
- records = [records || {}];
- }
- return records.map(record => {
- internalData.tableFullColumn.forEach(column => {
- const {
- field,
- editRender
- } = column;
- if (field && !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().has(record, field)) {
- let cellValue = null;
- if (editRender) {
- const {
- defaultValue
- } = editRender;
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(defaultValue)) {
- cellValue = defaultValue({
- column
- });
- } else if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isUndefined(defaultValue)) {
- cellValue = defaultValue;
- }
- }
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(record, field, cellValue);
- }
- });
- const otherFields = [radioOpts.labelField, checkboxOpts.checkField, checkboxOpts.labelField, expandOpts.labelField];
- otherFields.forEach(key => {
- if (key && eqEmptyValue(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(record, key))) {
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(record, key, null);
- }
- });
- if (treeConfig && treeOpts.lazy && external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isUndefined(record[childrenField])) {
- record[childrenField] = null;
- }
- // 必须有行数据的唯一主键,可以自行设置;也可以默认生成一个随机数
- if (eqEmptyValue(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(record, rowkey))) {
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(record, rowkey, getRowUniqueId());
- }
- return record;
- });
- },
- /**
- * 创建 data 对象
- * 对于某些特殊场景可能会用到,会自动对数据的字段名进行检测,如果不存在就自动定义
- * @param {Array} records 新数据
- */
- createData(records) {
- const $xeTable = this;
- return $xeTable.$nextTick().then(() => {
- return $xeTable.defineField(records);
- });
- },
- /**
- * 创建 Row|Rows 对象
- * 对于某些特殊场景需要对数据进行手动插入时可能会用到
- * @param {Array/Object} records 新数据
- */
- createRow(records) {
- const $xeTable = this;
- const isArr = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(records);
- if (!isArr) {
- records = [records];
- }
- return $xeTable.createData(records).then(rows => isArr ? rows : rows[0]);
- },
- /**
- * 还原数据
- * 如果不传任何参数,则还原整个表格
- * 如果传 row 则还原一行
- * 如果传 rows 则还原多行
- * 如果还额外传了 field 则还原指定的单元格数据
- */
- revertData(rows, field) {
- const $xeTable = this;
- const props = $xeTable;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- keepSource,
- treeConfig
- } = props;
- const {
- fullAllDataRowIdData,
- fullDataRowIdData,
- tableSourceData,
- sourceDataRowIdData,
- tableFullData,
- afterFullData,
- removeRowMaps
- } = internalData;
- const treeOpts = $xeTable.computeTreeOpts;
- const {
- transform
- } = treeOpts;
- const {
- handleGetRowId
- } = createHandleGetRowId($xeTable);
- if (!keepSource) {
- errLog('vxe.error.reqProp', ['keep-source']);
- return $xeTable.$nextTick();
- }
- let targetRows = rows;
- if (rows) {
- if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(rows)) {
- targetRows = [rows];
- }
- } else {
- targetRows = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toArray($xeTable.getUpdateRecords());
- }
- let reDelFlag = false;
- if (targetRows.length) {
- targetRows.forEach(item => {
- const rowid = handleGetRowId(item);
- const rowRest = fullAllDataRowIdData[rowid];
- if (rowRest) {
- const row = rowRest.row;
- if (!$xeTable.isInsertByRow(row)) {
- const oRow = sourceDataRowIdData[rowid];
- if (oRow && row) {
- if (field) {
- 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));
- } else {
- 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));
- }
- if (!fullDataRowIdData[rowid] && $xeTable.isRemoveByRow(row)) {
- if (removeRowMaps[rowid]) {
- delete removeRowMaps[rowid];
- }
- tableFullData.unshift(row);
- afterFullData.unshift(row);
- reDelFlag = true;
- }
- }
- }
- }
- });
- }
- if (rows) {
- if (reDelFlag) {
- reactData.removeRowFlag++;
- $xeTable.updateFooter();
- $xeTable.cacheRowMap(false);
- $xeTable.handleTableData(treeConfig && transform);
- if (!(treeConfig && transform)) {
- $xeTable.updateAfterDataIndex();
- }
- $xeTable.checkSelectionStatus();
- if (reactData.scrollYLoad) {
- $xeTable.updateScrollYSpace();
- }
- }
- return $xeTable.$nextTick().then(() => {
- $xeTable.updateCellAreas();
- return handleLazyRecalculate($xeTable, false, true, true);
- });
- }
- return $xeTable.reloadData(tableSourceData);
- },
- /**
- * 清空单元格内容
- * 如果不创参数,则清空整个表格内容
- * 如果传 row 则清空一行内容
- * 如果传 rows 则清空多行内容
- * 如果还额外传了 field 则清空指定单元格内容
- * @param {Array/Row} rows 行数据
- * @param {String} field 字段名
- */
- clearData(rows, field) {
- const $xeTable = this;
- const internalData = $xeTable;
- const {
- tableFullData,
- visibleColumn
- } = internalData;
- if (!arguments.length) {
- rows = tableFullData;
- } else if (rows && !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(rows)) {
- rows = [rows];
- }
- if (field) {
- rows.forEach(row => external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(row, field, null));
- } else {
- rows.forEach(row => {
- visibleColumn.forEach(column => {
- if (column.field) {
- setCellValue(row, column, null);
- }
- });
- });
- }
- return $xeTable.$nextTick();
- },
- getCellElement(row, fieldOrColumn) {
- const $xeTable = this;
- const internalData = $xeTable;
- const {
- elemStore
- } = internalData;
- const column = handleFieldOrColumn($xeTable, fieldOrColumn);
- if (!column) {
- return null;
- }
- const rowid = getRowid($xeTable, row);
- const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
- const leftScrollElem = getRefElem(elemStore['left-body-scroll']);
- const rightScrollElem = getRefElem(elemStore['right-body-scroll']);
- let bodyElem;
- if (column) {
- if (column.fixed) {
- if (column.fixed === 'left') {
- if (leftScrollElem) {
- bodyElem = leftScrollElem;
- }
- } else {
- if (rightScrollElem) {
- bodyElem = rightScrollElem;
- }
- }
- }
- if (!bodyElem) {
- bodyElem = bodyScrollElem;
- }
- if (bodyElem) {
- return bodyElem.querySelector(`.vxe-body--row[rowid="${rowid}"] .${column.id}`);
- }
- }
- return null;
- },
- getCellLabel(row, fieldOrColumn) {
- const $xeTable = this;
- const internalData = $xeTable;
- const column = handleFieldOrColumn(this, fieldOrColumn);
- if (!column) {
- return null;
- }
- const formatter = column.formatter;
- const cellValue = getCellValue(row, column);
- let cellLabel = cellValue;
- if (formatter) {
- let formatData;
- const {
- fullAllDataRowIdData
- } = internalData;
- const rowid = getRowid($xeTable, row);
- const colid = column.id;
- const rowRest = fullAllDataRowIdData[rowid];
- if (rowRest) {
- formatData = rowRest.formatData;
- if (!formatData) {
- formatData = fullAllDataRowIdData[rowid].formatData = {};
- }
- if (rowRest && formatData[colid]) {
- if (formatData[colid].value === cellValue) {
- return formatData[colid].label;
- }
- }
- }
- const formatParams = {
- cellValue,
- row,
- rowIndex: this.getRowIndex(row),
- column,
- columnIndex: this.getColumnIndex(column)
- };
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(formatter)) {
- const gFormatOpts = methods_formats.get(formatter);
- const tcFormatMethod = gFormatOpts ? gFormatOpts.tableCellFormatMethod || gFormatOpts.cellFormatMethod : null;
- cellLabel = tcFormatMethod ? tcFormatMethod(formatParams) : '';
- } else if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(formatter)) {
- const gFormatOpts = methods_formats.get(formatter[0]);
- const tcFormatMethod = gFormatOpts ? gFormatOpts.tableCellFormatMethod || gFormatOpts.cellFormatMethod : null;
- cellLabel = tcFormatMethod ? tcFormatMethod(formatParams, ...formatter.slice(1)) : '';
- } else {
- cellLabel = formatter(formatParams);
- }
- if (formatData) {
- formatData[colid] = {
- value: cellValue,
- label: cellLabel
- };
- }
- }
- return cellLabel;
- },
- /**
- * 检查是否为临时行数据
- */
- isInsertByRow(row) {
- const $xeTable = this;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const rowid = getRowid($xeTable, row);
- return !!reactData.insertRowFlag && !!internalData.insertRowMaps[rowid];
- },
- isRemoveByRow(row) {
- const $xeTable = this;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const rowid = getRowid($xeTable, row);
- return !!reactData.removeRowFlag && !!internalData.removeRowMaps[rowid];
- },
- /**
- * 删除所有新增的临时数据
- */
- removeInsertRow() {
- const $xeTable = this;
- const internalData = $xeTable;
- const {
- insertRowMaps
- } = internalData;
- return $xeTable.remove(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().values(insertRowMaps));
- },
- /**
- * 检查行或列数据是否发生改变
- */
- isUpdateByRow(rowOrId, field) {
- const $xeTable = this;
- const props = $xeTable;
- const internalData = $xeTable;
- const {
- keepSource
- } = props;
- const {
- tableFullColumn,
- fullDataRowIdData,
- sourceDataRowIdData
- } = internalData;
- if (keepSource) {
- 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);
- const rowRest = fullDataRowIdData[rowid];
- // 新增的数据不需要检测
- if (!rowRest) {
- return false;
- }
- const row = rowRest.row;
- const oRow = sourceDataRowIdData[rowid];
- if (oRow) {
- if (arguments.length > 1) {
- return !eqCellValue(oRow, row, field);
- }
- for (let index = 0, len = tableFullColumn.length; index < len; index++) {
- const property = tableFullColumn[index].field;
- if (property && !eqCellValue(oRow, row, property)) {
- return true;
- }
- }
- }
- }
- return false;
- },
- /**
- * 获取表格的可视列,也可以指定索引获取列
- * @param {Number} columnIndex 索引
- */
- getColumns(columnIndex) {
- const $xeTable = this;
- const internalData = $xeTable;
- const {
- visibleColumn
- } = internalData;
- return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isUndefined(columnIndex) ? visibleColumn.slice(0) : visibleColumn[columnIndex];
- },
- /**
- * 根据列获取列的唯一主键
- */
- getColid(fieldOrColumn) {
- const $xeTable = this;
- const column = handleFieldOrColumn($xeTable, fieldOrColumn);
- return column ? column.id : null;
- },
- /**
- * 根据列的唯一主键获取列
- * @param {String} colid 列主键
- */
- getColumnById(colid) {
- const $xeTable = this;
- const internalData = $xeTable;
- const {
- fullColumnIdData
- } = internalData;
- return fullColumnIdData[colid] ? fullColumnIdData[colid].column : null;
- },
- /**
- * 根据列的字段名获取列
- * @param {String} field 字段名
- */
- getColumnByField(field) {
- const $xeTable = this;
- const internalData = $xeTable;
- const {
- fullColumnFieldData
- } = internalData;
- return fullColumnFieldData[field] ? fullColumnFieldData[field].column : null;
- },
- getParentColumn(fieldOrColumn) {
- const fullColumnIdData = this.fullColumnIdData;
- const column = handleFieldOrColumn(this, fieldOrColumn);
- return column && column.parentId && fullColumnIdData[column.parentId] ? fullColumnIdData[column.parentId].column : null;
- },
- /**
- * 获取当前表格的列
- * 收集到的全量列、全量表头列、处理条件之后的全量表头列、当前渲染中的表头列
- */
- getTableColumn() {
- const $xeTable = this;
- const reactData = $xeTable;
- const internalData = $xeTable;
- return {
- collectColumn: internalData.collectColumn.slice(0),
- fullColumn: internalData.tableFullColumn.slice(0),
- visibleColumn: internalData.visibleColumn.slice(0),
- tableColumn: reactData.tableColumn.slice(0)
- };
- },
- /**
- * 移动列到指定列的位置
- * @param fieldOrColumn
- * @param targetFieldOrColumn
- * @param options
- */
- moveColumnTo(fieldOrColumn, targetFieldOrColumn, options) {
- const $xeTable = this;
- const internalData = $xeTable;
- const {
- fullColumnIdData,
- visibleColumn
- } = internalData;
- const {
- dragToChild,
- dragPos,
- isCrossDrag
- } = Object.assign({}, options);
- const dragCol = handleFieldOrColumn($xeTable, fieldOrColumn);
- let prevDragCol = null;
- const colRest = dragCol ? fullColumnIdData[dragCol.id] : null;
- let defPos = 'left';
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(targetFieldOrColumn)) {
- if (colRest && targetFieldOrColumn) {
- let currList = colRest.items;
- let offsetIndex = colRest._index + targetFieldOrColumn;
- if (isCrossDrag) {
- currList = visibleColumn;
- offsetIndex = colRest._index + targetFieldOrColumn;
- }
- if (offsetIndex > 0 && offsetIndex < currList.length - 1) {
- prevDragCol = currList[offsetIndex];
- }
- if (targetFieldOrColumn > 0) {
- defPos = 'right';
- }
- }
- } else {
- prevDragCol = handleFieldOrColumn($xeTable, targetFieldOrColumn);
- const targetColRest = prevDragCol ? fullColumnIdData[prevDragCol.id] : null;
- if (colRest && targetColRest) {
- if (targetColRest._index > colRest._index) {
- defPos = 'right';
- }
- }
- }
- return $xeTable.handleColDragSwapEvent(null, true, dragCol, prevDragCol, dragPos || defPos, dragToChild === true);
- },
- /**
- * 移动行到指定行的位置
- * @param rowidOrRow
- * @param targetRowidOrRow
- * @param options
- */
- moveRowTo(rowidOrRow, targetRowidOrRow, options) {
- const $xeTable = this;
- const props = $xeTable;
- const internalData = $xeTable;
- const {
- treeConfig
- } = props;
- const {
- fullAllDataRowIdData,
- afterFullData
- } = internalData;
- const {
- dragToChild,
- dragPos,
- isCrossDrag
- } = Object.assign({}, options);
- const treeOpts = $xeTable.computeTreeOpts;
- const dragRow = handleRowidOrRow($xeTable, rowidOrRow);
- let prevDragRow = null;
- let defPos = 'top';
- const rowRest = dragRow ? fullAllDataRowIdData[getRowid($xeTable, dragRow)] : null;
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(targetRowidOrRow)) {
- if (rowRest && targetRowidOrRow) {
- let currList = afterFullData;
- let offsetIndex = rowRest._index + targetRowidOrRow;
- if (treeConfig) {
- currList = rowRest.items;
- if (treeOpts.transform) {
- offsetIndex = rowRest.treeIndex + targetRowidOrRow;
- if (isCrossDrag) {
- currList = afterFullData;
- offsetIndex = rowRest._index + targetRowidOrRow;
- }
- }
- }
- if (offsetIndex >= 0 && offsetIndex <= currList.length - 1) {
- prevDragRow = currList[offsetIndex];
- }
- if (targetRowidOrRow > 0) {
- defPos = 'bottom';
- }
- }
- } else {
- prevDragRow = handleRowidOrRow($xeTable, targetRowidOrRow);
- const targetRowRest = prevDragRow ? fullAllDataRowIdData[getRowid($xeTable, prevDragRow)] : null;
- if (rowRest && targetRowRest) {
- if (targetRowRest._index > rowRest._index) {
- defPos = 'bottom';
- }
- }
- }
- const rest = $xeTable.handleRowDragSwapEvent(null, true, dragRow, prevDragRow, dragPos || defPos, dragToChild === true);
- clearRowDragData($xeTable);
- return rest;
- },
- /**
- * 获取表格的全量列
- */
- getFullColumns() {
- const $xeTable = this;
- const internalData = $xeTable;
- const {
- collectColumn
- } = internalData;
- return collectColumn.slice(0);
- },
- /**
- * 获取数据,和 data 的行为一致,也可以指定索引获取数据
- */
- getData(rowIndex) {
- const tableSynchData = this.data || this.tableSynchData;
- return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isUndefined(rowIndex) ? tableSynchData.slice(0) : tableSynchData[rowIndex];
- },
- /**
- * 用于多选行,获取已选中的数据
- */
- getCheckboxRecords(isFull) {
- const $xeTable = this;
- const props = $xeTable;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- treeConfig
- } = props;
- const {
- updateCheckboxFlag
- } = reactData;
- const {
- tableFullData,
- afterFullData,
- tableFullTreeData,
- fullDataRowIdData,
- afterFullRowMaps,
- selectCheckboxMaps
- } = internalData;
- const treeOpts = $xeTable.computeTreeOpts;
- const checkboxOpts = $xeTable.computeCheckboxOpts;
- const {
- transform,
- mapChildrenField
- } = treeOpts;
- const {
- checkField
- } = checkboxOpts;
- const childrenField = treeOpts.children || treeOpts.childrenField;
- let rowList = [];
- if (updateCheckboxFlag) {
- if (checkField) {
- if (treeConfig) {
- const currTableData = isFull ? transform ? tableFullTreeData : tableFullData : transform ? tableFullTreeData : afterFullData;
- 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), {
- children: transform ? mapChildrenField : childrenField
- });
- } else {
- const currTableData = isFull ? tableFullData : afterFullData;
- rowList = currTableData.filter(row => external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, checkField));
- }
- } else {
- const currMaps = isFull || treeConfig && !transform ? fullDataRowIdData : afterFullRowMaps;
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(selectCheckboxMaps, (row, rowid) => {
- if (currMaps[rowid]) {
- rowList.push(fullDataRowIdData[rowid].row);
- }
- });
- }
- }
- return rowList;
- },
- /**
- * 预编译
- * 对渲染中的数据提前解析序号及索引。牺牲提前编译耗时换取渲染中额外损耗,使运行时更加流畅
- */
- updateAfterDataIndex() {
- const $xeTable = this;
- updateAfterDataIndex($xeTable);
- },
- /**
- * 只对 tree-config 有效,获取行的子级
- */
- getTreeRowChildren(rowOrRowid) {
- const $xeTable = this;
- const props = $xeTable;
- const internalData = $xeTable;
- const {
- treeConfig
- } = props;
- const {
- fullAllDataRowIdData
- } = internalData;
- const treeOpts = $xeTable.computeTreeOpts;
- const {
- transform,
- mapChildrenField
- } = treeOpts;
- const childrenField = treeOpts.children || treeOpts.childrenField;
- if (rowOrRowid && treeConfig) {
- let rowid;
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(rowOrRowid)) {
- rowid = rowOrRowid;
- } else {
- rowid = getRowid($xeTable, rowOrRowid);
- }
- if (rowid) {
- const rest = fullAllDataRowIdData[rowid];
- const row = rest ? rest.row : null;
- if (row) {
- return row[transform ? mapChildrenField : childrenField] || [];
- }
- }
- }
- return [];
- },
- /**
- * 只对 tree-config 有效,用于树形结构,获取指定行的层级
- */
- getTreeRowLevel(rowOrRowid) {
- const $xeTable = this;
- const props = $xeTable;
- const internalData = $xeTable;
- const {
- treeConfig
- } = props;
- const {
- fullAllDataRowIdData
- } = internalData;
- if (rowOrRowid && treeConfig) {
- let rowid;
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(rowOrRowid)) {
- rowid = rowOrRowid;
- } else {
- rowid = getRowid($xeTable, rowOrRowid);
- }
- if (rowid) {
- const rest = fullAllDataRowIdData[rowid];
- if (rest) {
- return rest.level;
- }
- }
- }
- return -1;
- },
- /**
- * 只对 tree-config 有效,获取行的父级
- */
- getTreeParentRow(rowOrRowid) {
- const $xeTable = this;
- const props = $xeTable;
- const internalData = $xeTable;
- const {
- treeConfig
- } = props;
- const {
- fullAllDataRowIdData
- } = internalData;
- if (rowOrRowid && treeConfig) {
- let rowid;
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(rowOrRowid)) {
- rowid = rowOrRowid;
- } else {
- rowid = getRowid($xeTable, rowOrRowid);
- }
- if (rowid) {
- const rest = fullAllDataRowIdData[rowid];
- if (rest) {
- return rest.parent;
- }
- }
- }
- return null;
- },
- getParentRow(rowOrRowid) {
- const $xeTable = this;
- warnLog('vxe.error.delFunc', ['getParentRow', 'getTreeParentRow']);
- return $xeTable.getTreeParentRow(rowOrRowid);
- },
- /**
- * 根据行的唯一主键获取行
- * @param {String/Number} rowid 行主键
- */
- getRowById(cellValue) {
- const $xeTable = this;
- const internalData = $xeTable;
- const {
- fullAllDataRowIdData
- } = internalData;
- const rowid = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(cellValue) ? '' : encodeURIComponent(cellValue);
- return fullAllDataRowIdData[rowid] ? fullAllDataRowIdData[rowid].row : null;
- },
- /**
- * 根据行获取行的唯一主键
- * @param {Row} row 行对象
- */
- getRowid(row) {
- const $xeTable = this;
- return getRowid($xeTable, row);
- },
- /**
- * 获取处理后的表格数据
- * 如果存在筛选条件,继续处理
- * 如果存在排序,继续处理
- */
- getTableData() {
- const $xeTable = this;
- const props = $xeTable;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- tableData,
- footerTableData
- } = reactData;
- const {
- tableFullData,
- afterFullData,
- tableFullTreeData
- } = internalData;
- return {
- fullData: props.treeConfig ? tableFullTreeData.slice(0) : tableFullData.slice(0),
- visibleData: afterFullData.slice(0),
- tableData: tableData.slice(0),
- footerData: footerTableData.slice(0)
- };
- },
- /**
- * 获取表格的全量数据,如果是 tree-config 则返回带层级的树结构
- */
- getFullData() {
- const $xeTable = this;
- const props = $xeTable;
- const internalData = $xeTable;
- const {
- treeConfig
- } = props;
- const {
- tableFullData,
- tableFullTreeData
- } = internalData;
- if (treeConfig) {
- const treeOpts = $xeTable.computeTreeOpts;
- const {
- transform,
- mapChildrenField,
- rowField,
- parentField
- } = treeOpts;
- const childrenField = treeOpts.children || treeOpts.childrenField;
- if (transform) {
- 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, {
- children: mapChildrenField
- }), {
- key: rowField,
- parentKey: parentField,
- children: childrenField,
- mapChildren: mapChildrenField
- });
- }
- return tableFullTreeData.slice(0);
- }
- return tableFullData.slice(0);
- },
- /**
- * 处理数据加载默认行为
- * 默认执行一次,除非被重置
- */
- handleLoadDefaults() {
- const $xeTable = this;
- handleLoadDefaults($xeTable);
- },
- /**
- * 处理初始化的默认行为
- * 只会执行一次
- */
- handleInitDefaults() {
- const $xeTable = this;
- handleInitDefaults($xeTable);
- },
- /**
- * 设置为固定列
- */
- setColumnFixed(fieldOrColumn, fixed) {
- const $xeTable = this;
- let status = false;
- const cols = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(fieldOrColumn) ? fieldOrColumn : [fieldOrColumn];
- const columnOpts = $xeTable.computeColumnOpts;
- const isMaxFixedColumn = $xeTable.computeIsMaxFixedColumn;
- for (let i = 0; i < cols.length; i++) {
- const item = cols[i];
- const column = handleFieldOrColumn($xeTable, item);
- const targetColumn = getRootColumn($xeTable, column);
- if (targetColumn && targetColumn.fixed !== fixed) {
- // 是否超过最大固定列数量
- if (!targetColumn.fixed && isMaxFixedColumn) {
- if (core_.VxeUI.modal) {
- core_.VxeUI.modal.message({
- status: 'error',
- content: methods_getI18n('vxe.table.maxFixedCol', [columnOpts.maxFixedSize])
- });
- }
- return $xeTable.$nextTick();
- }
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree([targetColumn], column => {
- column.fixed = fixed;
- column.renderFixed = fixed;
- });
- $xeTable.saveCustomStore('update:fixed');
- if (!status) {
- status = true;
- }
- }
- }
- if (status) {
- return $xeTable.refreshColumn();
- }
- return $xeTable.$nextTick();
- },
- /**
- * 取消指定固定列
- */
- clearColumnFixed(fieldOrColumn) {
- const $xeTable = this;
- let status = false;
- const cols = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(fieldOrColumn) ? fieldOrColumn : [fieldOrColumn];
- cols.forEach(item => {
- const column = handleFieldOrColumn($xeTable, item);
- const targetColumn = getRootColumn($xeTable, column);
- if (targetColumn && targetColumn.fixed) {
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree([targetColumn], column => {
- column.fixed = null;
- column.renderFixed = null;
- });
- $xeTable.saveCustomStore('update:fixed');
- if (!status) {
- status = true;
- }
- }
- });
- if (status) {
- return $xeTable.refreshColumn();
- }
- return $xeTable.$nextTick();
- },
- /**
- * 隐藏指定列
- */
- hideColumn(fieldOrColumn) {
- const $xeTable = this;
- let status = false;
- const cols = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(fieldOrColumn) ? fieldOrColumn : [fieldOrColumn];
- cols.forEach(item => {
- const column = handleFieldOrColumn($xeTable, item);
- if (column && column.visible) {
- column.visible = false;
- if (!status) {
- status = true;
- }
- }
- });
- if (status) {
- return $xeTable.handleCustom();
- }
- return $xeTable.$nextTick();
- },
- /**
- * 显示指定列
- */
- showColumn(fieldOrColumn) {
- const $xeTable = this;
- let status = false;
- const cols = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(fieldOrColumn) ? fieldOrColumn : [fieldOrColumn];
- cols.forEach(item => {
- const column = handleFieldOrColumn($xeTable, item);
- if (column && !column.visible) {
- column.visible = true;
- if (!status) {
- status = true;
- }
- }
- });
- if (status) {
- return $xeTable.handleCustom();
- }
- return $xeTable.$nextTick();
- },
- setColumnWidth(fieldOrColumn, width) {
- const $xeTable = this;
- const internalData = $xeTable;
- const {
- elemStore
- } = internalData;
- let status = false;
- const cols = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(fieldOrColumn) ? fieldOrColumn : [fieldOrColumn];
- let cWidth = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(width);
- if (isScale(width)) {
- const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
- const bodyWidth = bodyScrollElem ? bodyScrollElem.clientWidth - 1 : 0;
- cWidth = Math.floor(cWidth * bodyWidth);
- }
- if (cWidth) {
- cols.forEach(item => {
- const column = handleFieldOrColumn($xeTable, item);
- if (column) {
- column.resizeWidth = cWidth;
- if (!status) {
- status = true;
- }
- }
- });
- if (status) {
- return $xeTable.refreshColumn().then(() => {
- return {
- status
- };
- });
- }
- }
- return $xeTable.$nextTick().then(() => {
- return {
- status
- };
- });
- },
- getColumnWidth(fieldOrColumn) {
- const column = handleFieldOrColumn(this, fieldOrColumn);
- if (column) {
- return column.renderWidth;
- }
- return 0;
- },
- /**
- * 手动重置列的显示隐藏、列宽拖动的状态;
- * 如果为 true 则重置所有状态
- * 如果已关联工具栏,则会同步更新
- */
- resetColumn(options) {
- warnLog('vxe.error.delFunc', ['resetColumn', 'resetCustom']);
- return this.resetCustom(options);
- },
- handleCustom() {
- const $xeTable = this;
- const props = $xeTable;
- const {
- mouseConfig
- } = props;
- if (mouseConfig) {
- if ($xeTable.clearSelected) {
- $xeTable.clearSelected();
- }
- if ($xeTable.clearCellAreas) {
- $xeTable.clearCellAreas();
- $xeTable.clearCopyCellArea();
- }
- }
- $xeTable.analyColumnWidth();
- return $xeTable.refreshColumn(true);
- },
- /**
- * 还原自定义列操作状态
- */
- restoreCustomStorage() {
- const $xeTable = this;
- const props = $xeTable;
- const {
- customConfig
- } = props;
- const tableId = $xeTable.computeTableId;
- const customOpts = $xeTable.computeCustomOpts;
- const {
- storage,
- restoreStore,
- storeOptions
- } = customOpts;
- const isAllCustom = storage === true;
- const storageOpts = isAllCustom ? {} : Object.assign({}, storage || {}, storeOptions);
- const isCustomResizable = hangleStorageDefaultValue(storageOpts.resizable, isAllCustom);
- const isCustomVisible = hangleStorageDefaultValue(storageOpts.visible, isAllCustom);
- const isCustomFixed = hangleStorageDefaultValue(storageOpts.fixed, isAllCustom);
- const isCustomAggGroup = hangleStorageDefaultValue(storageOpts.aggGroup, isAllCustom);
- const isCustomSort = hangleStorageDefaultValue(storageOpts.sort, isAllCustom);
- if (storage && (customConfig ? isEnableConf(customOpts) : customOpts.enabled) && (isCustomResizable || isCustomVisible || isCustomFixed || isCustomAggGroup || isCustomSort)) {
- if (!tableId) {
- errLog('vxe.error.reqProp', ['id']);
- return;
- }
- const storeData = getCustomStorageMap(tableId);
- if (restoreStore) {
- return Promise.resolve(restoreStore({
- $table: $xeTable,
- id: tableId,
- type: 'restore',
- storeData
- })).then(storeData => {
- if (!storeData) {
- return;
- }
- return handleCustomRestore($xeTable, storeData);
- }).catch(e => e);
- } else {
- return handleCustomRestore($xeTable, storeData);
- }
- }
- },
- getCustomStoreData() {
- const $xeTable = this;
- const props = $xeTable;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- id
- } = props;
- const customOpts = $xeTable.computeCustomOpts;
- const {
- isRowGroupStatus,
- rowGroupList
- } = reactData;
- const {
- fullColumnFieldData,
- collectColumn
- } = internalData;
- const {
- storage,
- checkMethod,
- storeOptions
- } = customOpts;
- const isAllCustom = storage === true;
- const storageOpts = isAllCustom ? {} : Object.assign({}, storage || {}, storeOptions);
- const isCustomResizable = hangleStorageDefaultValue(storageOpts.resizable, isAllCustom);
- const isCustomVisible = hangleStorageDefaultValue(storageOpts.visible, isAllCustom);
- const isCustomFixed = hangleStorageDefaultValue(storageOpts.fixed, isAllCustom);
- const isCustomSort = hangleStorageDefaultValue(storageOpts.sort, isAllCustom);
- const isCustomAggGroup = hangleStorageDefaultValue(storageOpts.aggGroup, isAllCustom);
- const isCustomAggFunc = hangleStorageDefaultValue(storageOpts.aggFunc, isAllCustom);
- const resizableData = {};
- const sortData = [];
- const visibleData = {};
- const fixedData = {};
- const aggGroupData = {};
- const aggFuncData = {};
- const storeData = {
- resizableData: undefined,
- sortData: undefined,
- visibleData: undefined,
- fixedData: undefined,
- aggGroupData: undefined,
- aggFuncData: undefined
- };
- if (!id) {
- if (storage) {
- errLog('vxe.error.reqProp', ['id']);
- }
- return storeData;
- }
- let hasResizable = 0;
- let hasSort = 0;
- let hasFixed = 0;
- let hasVisible = 0;
- let hasAggFunc = 0;
- const sortMaps = {};
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(collectColumn, (column, index, items, path, parentColumn) => {
- const colKey = column.getKey();
- if (!colKey) {
- errLog('vxe.error.reqProp', [`${column.getTitle() || column.type || ''} -> column.field=?`]);
- return;
- }
- if (parentColumn) {
- if (isCustomSort) {
- const pColKey = parentColumn.getKey();
- const psObj = sortMaps[pColKey];
- hasSort = 1;
- if (psObj) {
- const sObj = {
- k: colKey
- };
- sortMaps[colKey] = sObj;
- if (!psObj.c) {
- psObj.c = [];
- }
- psObj.c.push(sObj);
- }
- }
- } else {
- if (isCustomSort) {
- hasSort = 1;
- const sObj = {
- k: colKey
- };
- sortMaps[colKey] = sObj;
- sortData.push(sObj);
- }
- // 只支持一级
- if (isCustomFixed && (column.fixed || '') !== (column.defaultFixed || '')) {
- hasFixed = 1;
- fixedData[colKey] = column.fixed;
- }
- }
- if (isCustomResizable && column.resizeWidth) {
- hasResizable = 1;
- resizableData[colKey] = column.renderWidth;
- }
- if (isCustomVisible && (!checkMethod || checkMethod({
- $table: $xeTable,
- column
- }))) {
- if (!column.visible && column.defaultVisible) {
- hasVisible = 1;
- visibleData[colKey] = false;
- } else if (column.visible && !column.defaultVisible) {
- hasVisible = 1;
- visibleData[colKey] = true;
- }
- }
- if (isCustomAggFunc && (column.aggFunc || '') !== (column.defaultAggFunc || '')) {
- hasAggFunc = 1;
- aggFuncData[colKey] = column.aggFunc;
- }
- });
- if (hasResizable) {
- storeData.resizableData = resizableData;
- }
- if (hasSort) {
- storeData.sortData = sortData;
- }
- if (hasFixed) {
- storeData.fixedData = fixedData;
- }
- if (hasVisible) {
- storeData.visibleData = visibleData;
- }
- if (isCustomAggGroup && isRowGroupStatus) {
- rowGroupList.forEach(aggConf => {
- const colRest = fullColumnFieldData[aggConf.field];
- if (colRest) {
- aggGroupData[colRest.column.getKey()] = true;
- }
- });
- storeData.aggGroupData = aggGroupData;
- }
- if (hasAggFunc) {
- storeData.aggFuncData = aggFuncData;
- }
- return storeData;
- },
- saveCustomStore(type) {
- const $xeTable = this;
- const props = $xeTable;
- const reactData = $xeTable;
- const {
- customConfig
- } = props;
- const tableId = $xeTable.computeTableId;
- const customOpts = $xeTable.computeCustomOpts;
- const {
- updateStore,
- storage,
- storeOptions
- } = customOpts;
- const isAllCustom = storage === true;
- const storageOpts = isAllCustom ? {} : Object.assign({}, storage || {}, storeOptions);
- const isCustomResizable = hangleStorageDefaultValue(storageOpts.resizable, isAllCustom);
- const isCustomVisible = hangleStorageDefaultValue(storageOpts.visible, isAllCustom);
- const isCustomFixed = hangleStorageDefaultValue(storageOpts.fixed, isAllCustom);
- const isCustomSort = hangleStorageDefaultValue(storageOpts.sort, isAllCustom);
- const isCustomAggGroup = hangleStorageDefaultValue(storageOpts.aggGroup, isAllCustom);
- const isCustomAggFunc = hangleStorageDefaultValue(storageOpts.aggFunc, isAllCustom);
- if (type !== 'reset') {
- reactData.isCustomStatus = true;
- }
- if (storage && (customConfig ? isEnableConf(customOpts) : customOpts.enabled) && (isCustomResizable || isCustomVisible || isCustomFixed || isCustomSort || isCustomAggGroup || isCustomAggFunc)) {
- if (!tableId) {
- errLog('vxe.error.reqProp', ['id']);
- return this.$nextTick();
- }
- const storeData = type === 'reset' ? {
- resizableData: {},
- sortData: {},
- visibleData: {},
- fixedData: {},
- aggGroupData: {},
- aggFuncData: {}
- } : this.getCustomStoreData();
- if (updateStore) {
- return updateStore({
- $table: $xeTable,
- id: tableId,
- type,
- storeData
- });
- } else {
- setCustomStorageMap(tableId, type === 'reset' ? null : storeData);
- }
- }
- return this.$nextTick();
- },
- handleUpdateDataQueue() {
- this.upDataFlag++;
- },
- handleRefreshColumnQueue() {
- this.reColumnFlag++;
- },
- handleFilterOptions(column) {
- const $xeTable = this;
- const reactData = $xeTable;
- if (column) {
- const {
- filterStore
- } = reactData;
- const {
- filterRender,
- filters
- } = column;
- const filterOptions = filters || [];
- const compConf = isEnableConf(filterRender) ? methods_renderer.get(filterRender.name) : null;
- const frMethod = column.filterRecoverMethod || (compConf ? compConf.tableFilterRecoverMethod || compConf.filterRecoverMethod : null);
- filterStore.column = column;
- // 复原状态
- filterOptions.forEach(option => {
- const {
- _checked,
- checked
- } = option;
- option._checked = checked;
- if (!checked && _checked !== checked) {
- if (frMethod) {
- frMethod({
- option,
- column,
- $table: $xeTable
- });
- }
- }
- });
- $xeTable.checkFilterOptions();
- }
- },
- /**
- * 刷新列配置
- */
- refreshColumn(initSort) {
- const $xeTable = this;
- if (initSort) {
- handleUpdateColumn($xeTable);
- }
- return parseColumns($xeTable, true).then(() => {
- return this.refreshScroll();
- }).then(() => {
- return handleLazyRecalculate($xeTable, false, true, true);
- });
- },
- /**
- * 指定列宽的列进行拆分
- */
- analyColumnWidth() {
- const {
- columnOpts
- } = this;
- const {
- width: defaultWidth,
- minWidth: defaultMinWidth
- } = columnOpts;
- const resizeList = [];
- const pxList = [];
- const pxMinList = [];
- const autoMinList = [];
- const scaleList = [];
- const scaleMinList = [];
- const autoList = [];
- const remainList = [];
- this.tableFullColumn.forEach(column => {
- if (defaultWidth && !column.width) {
- column.width = defaultWidth;
- }
- if (defaultMinWidth && !column.minWidth) {
- column.minWidth = defaultMinWidth;
- }
- if (column.visible) {
- if (column.resizeWidth) {
- resizeList.push(column);
- } else if (column.width === 'auto') {
- autoList.push(column);
- } else if (isPx(column.width)) {
- pxList.push(column);
- } else if (isScale(column.width)) {
- scaleList.push(column);
- } else if (isPx(column.minWidth)) {
- pxMinList.push(column);
- } else if (column.minWidth === 'auto') {
- autoMinList.push(column);
- } else if (isScale(column.minWidth)) {
- scaleMinList.push(column);
- } else {
- remainList.push(column);
- }
- }
- });
- Object.assign(this.columnStore, {
- resizeList,
- pxList,
- pxMinList,
- autoMinList,
- scaleList,
- scaleMinList,
- autoList,
- remainList
- });
- },
- handleColResizeMousedownEvent(evnt, fixedType, params) {
- const $xeTable = this;
- const reactData = $xeTable;
- const internalData = $xeTable;
- evnt.stopPropagation();
- evnt.preventDefault();
- const {
- column
- } = params;
- const {
- columnStore,
- overflowX,
- scrollbarHeight
- } = reactData;
- const {
- visibleColumn
- } = internalData;
- const {
- leftList,
- rightList
- } = columnStore;
- const resizableOpts = $xeTable.computeResizableOpts;
- const osbHeight = overflowX ? scrollbarHeight : 0;
- const tableEl = $xeTable.$refs.refElem;
- const leftContainerElem = $xeTable.$refs.refLeftContainer;
- const rightContainerElem = $xeTable.$refs.refRightContainer;
- const resizeBarElem = $xeTable.$refs.refColResizeBar;
- if (!resizeBarElem) {
- return;
- }
- const isLeftFixed = fixedType === 'left';
- const isRightFixed = fixedType === 'right';
- const resizeTipElem = resizeBarElem.firstElementChild;
- const scrollbarXToTop = $xeTable.computeScrollbarXToTop;
- const {
- clientX: dragClientX
- } = evnt;
- const dragBtnElem = evnt.target;
- let cell = dragBtnElem.parentElement;
- let resizeColumn = column;
- const isDragGroupCol = column.children && column.children.length;
- if (isDragGroupCol) {
- resizeColumn = getLastChildColumn(column);
- if (isDragGroupCol) {
- const trEl = cell ? cell.parentElement : null;
- const theadEl = trEl ? trEl.parentElement : null;
- cell = theadEl ? theadEl.querySelector(`.vxe-header--column[colid="${resizeColumn.id}"]`) : null;
- }
- }
- if (!cell) {
- return;
- }
- const cellParams = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().assign(params, {
- cell,
- $table: $xeTable
- });
- let dragLeft = 0;
- const tableRect = tableEl.getBoundingClientRect();
- const rightContainerRect = rightContainerElem ? rightContainerElem.getBoundingClientRect() : null;
- const cellRect = cell.getBoundingClientRect();
- const dragBtnRect = dragBtnElem.getBoundingClientRect();
- const dragBtnWidth = dragBtnElem.clientWidth;
- const dragBtnOffsetWidth = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().floor(dragBtnWidth / 2);
- const dragPosLeft = dragBtnRect.x - tableRect.x + dragBtnOffsetWidth;
- const minInterval = getColReMinWidth(cellParams) - dragBtnOffsetWidth; // 列之间的最小间距
- const dragMinLeft = isRightFixed ? 0 : cellRect.x - tableRect.x + dragBtnWidth + minInterval;
- const dragMaxLeft = cellRect.x - tableRect.x + cell.clientWidth - minInterval;
- let fixedLeftRemainWidth = 0;
- let fixedRightRemainWidth = 0;
- if (isLeftFixed || isRightFixed) {
- let isMach = false;
- const fixedColumn = isLeftFixed ? leftList : rightList;
- for (let i = 0; i < fixedColumn.length; i++) {
- const item = fixedColumn[i];
- if (isMach) {
- fixedLeftRemainWidth += item.renderWidth;
- } else {
- isMach = item.id === resizeColumn.id;
- if (!isMach) {
- fixedRightRemainWidth += item.renderWidth;
- }
- }
- }
- }
- // 处理拖动事件
- const updateEvent = evnt => {
- evnt.stopPropagation();
- evnt.preventDefault();
- const tableHeight = tableEl.clientHeight;
- const offsetX = evnt.clientX - dragClientX;
- let left = dragPosLeft + offsetX;
- if (isLeftFixed) {
- if (rightContainerRect) {
- left = Math.min(left, rightContainerRect.x - tableRect.x - fixedLeftRemainWidth - minInterval);
- }
- } else if (isRightFixed) {
- if (leftContainerElem) {
- left = Math.max(left, leftContainerElem.clientWidth + fixedRightRemainWidth + minInterval);
- }
- left = Math.min(left, dragMaxLeft);
- }
- dragLeft = Math.max(left, dragMinLeft);
- const resizeBarLeft = Math.max(1, dragLeft);
- resizeBarElem.style.left = `${resizeBarLeft}px`;
- resizeBarElem.style.top = `${scrollbarXToTop ? osbHeight : 0}px`;
- resizeBarElem.style.height = `${scrollbarXToTop ? tableHeight - osbHeight : tableHeight}px`;
- if (resizableOpts.showDragTip && resizeTipElem) {
- resizeTipElem.textContent = methods_getI18n('vxe.table.resizeColTip', [Math.floor(resizeColumn.renderWidth + (isRightFixed ? dragPosLeft - dragLeft : dragLeft - dragPosLeft))]);
- const tableWrapperWidth = tableEl.clientWidth;
- const resizeBarWidth = resizeBarElem.clientWidth;
- const resizeTipWidth = resizeTipElem.clientWidth;
- const resizeTipHeight = resizeTipElem.clientHeight;
- let resizeTipLeft = -resizeTipWidth;
- if (resizeBarLeft < resizeTipWidth + resizeBarWidth) {
- resizeTipLeft = 0;
- } else if (resizeBarLeft > tableWrapperWidth) {
- resizeTipLeft += tableWrapperWidth - resizeBarLeft;
- }
- resizeTipElem.style.left = `${resizeTipLeft}px`;
- resizeTipElem.style.top = `${Math.min(tableHeight - resizeTipHeight, Math.max(0, evnt.clientY - tableRect.y - resizeTipHeight / 2))}px`;
- }
- reactData.isDragResize = true;
- };
- reactData.isDragResize = true;
- addClass(tableEl, 'col-drag--resize');
- resizeBarElem.style.display = 'block';
- document.onmousemove = updateEvent;
- document.onmouseup = function (evnt) {
- document.onmousemove = null;
- document.onmouseup = null;
- resizeBarElem.style.display = 'none';
- internalData._lastResizeTime = Date.now();
- setTimeout(() => {
- reactData.isDragResize = false;
- }, 50);
- const resizeWidth = resizeColumn.renderWidth + (isRightFixed ? dragPosLeft - dragLeft : dragLeft - dragPosLeft);
- const resizeParams = {
- ...params,
- resizeWidth,
- resizeColumn
- };
- if (resizableOpts.dragMode === 'fixed') {
- visibleColumn.forEach(item => {
- if (item.id !== resizeColumn.id) {
- if (!item.resizeWidth) {
- item.resizeWidth = item.renderWidth;
- }
- }
- });
- }
- if ($xeTable.handleColResizeCellAreaEvent) {
- $xeTable.handleColResizeCellAreaEvent(evnt, resizeParams);
- } else {
- resizeColumn.resizeWidth = resizeWidth;
- handleUpdateColResize($xeTable, evnt, resizeParams);
- }
- removeClass(tableEl, 'col-drag--resize');
- };
- updateEvent(evnt);
- if ($xeTable.closeMenu) {
- $xeTable.closeMenu();
- }
- },
- handleColResizeDblclickEvent(evnt, params) {
- const $xeTable = this;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const resizableOpts = $xeTable.computeResizableOpts;
- const {
- isDblclickAutoWidth
- } = resizableOpts;
- const el = $xeTable.$refs.refElem;
- if (isDblclickAutoWidth && el) {
- evnt.stopPropagation();
- evnt.preventDefault();
- const {
- fullColumnIdData
- } = internalData;
- const {
- column
- } = params;
- let resizeColumn = column;
- if (column.children && column.children.length) {
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(column.children, childColumn => {
- resizeColumn = childColumn;
- });
- }
- const colid = resizeColumn.id;
- const colRest = fullColumnIdData[colid];
- const dragBtnElem = evnt.target;
- const cell = dragBtnElem.parentNode;
- const cellParams = Object.assign(params, {
- cell,
- $table: $xeTable
- });
- const colMinWidth = getColReMinWidth(cellParams);
- el.setAttribute('data-calc-col', 'Y');
- let resizeWidth = calcColumnAutoWidth($xeTable, resizeColumn, el);
- el.removeAttribute('data-calc-col');
- if (colRest) {
- resizeWidth = Math.max(resizeWidth, colRest.width);
- }
- resizeWidth = Math.max(colMinWidth, resizeWidth);
- const resizeParams = {
- ...params,
- resizeWidth,
- resizeColumn
- };
- reactData.isDragResize = false;
- internalData._lastResizeTime = Date.now();
- if ($xeTable.handleColResizeDblclickCellAreaEvent) {
- $xeTable.handleColResizeDblclickCellAreaEvent(evnt, resizeParams);
- } else {
- resizeColumn.resizeWidth = resizeWidth;
- handleUpdateColResize($xeTable, evnt, resizeParams);
- }
- }
- },
- handleRowResizeMousedownEvent(evnt, params) {
- const $xeTable = this;
- const props = $xeTable;
- const reactData = $xeTable;
- const internalData = $xeTable;
- evnt.stopPropagation();
- evnt.preventDefault();
- const $xeGantt = $xeTable.$xeGantt;
- const {
- row
- } = params;
- const {
- showOverflow
- } = props;
- const {
- overflowX,
- scrollbarWidth,
- overflowY,
- scrollbarHeight
- } = reactData;
- const {
- elemStore,
- fullAllDataRowIdData
- } = internalData;
- const osbWidth = overflowY ? scrollbarWidth : 0;
- const osbHeight = overflowX ? scrollbarHeight : 0;
- const scrollbarYToLeft = $xeTable.computeScrollbarYToLeft;
- const resizableOpts = $xeTable.computeResizableOpts;
- const rowOpts = $xeTable.computeRowOpts;
- const cellOpts = $xeTable.computeCellOpts;
- let tableEl = $xeTable.$refs.refElem;
- if ($xeGantt) {
- const ganttContainerElem = $xeGantt.$refs.refGanttContainerElem;
- if (ganttContainerElem) {
- tableEl = ganttContainerElem;
- }
- }
- const resizeBarElem = $xeTable.$refs.refRowResizeBar;
- if (!resizeBarElem) {
- return;
- }
- const {
- clientY: dragClientY
- } = evnt;
- const resizeTipElem = resizeBarElem.firstElementChild;
- const dragBtnElem = evnt.currentTarget;
- const tdEl = dragBtnElem.parentNode;
- const trEl = tdEl.parentNode;
- const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
- if (!bodyScrollElem) {
- return;
- }
- const rowid = getRowid($xeTable, row);
- const rowRest = fullAllDataRowIdData[rowid];
- if (!rowRest) {
- return;
- }
- const defaultRowHeight = $xeTable.computeDefaultRowHeight;
- let currCellHeight = rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight;
- if (!showOverflow) {
- currCellHeight = tdEl.clientHeight;
- }
- const tableRect = tableEl.getBoundingClientRect();
- const trRect = trEl.getBoundingClientRect();
- const targetOffsetY = dragClientY - trRect.y - trEl.clientHeight;
- let resizeHeight = currCellHeight;
- const cellEl = tdEl.querySelector('.vxe-cell');
- let cellMinHeight = 0;
- if (cellEl) {
- const cellStyle = getComputedStyle(cellEl);
- 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)));
- }
- const minTop = trRect.y - tableRect.y + cellMinHeight;
- // 处理拖动事件
- const updateEvent = evnt => {
- evnt.stopPropagation();
- evnt.preventDefault();
- const rtWidth = tableEl.clientWidth - osbWidth;
- const tableHeight = tableEl.clientHeight - osbHeight;
- let dragTop = evnt.clientY - tableRect.y - targetOffsetY;
- if (dragTop < minTop) {
- dragTop = minTop;
- } else {
- resizeHeight = Math.max(cellMinHeight, currCellHeight + evnt.clientY - dragClientY);
- }
- resizeBarElem.style.left = `${scrollbarYToLeft ? osbWidth : 0}px`;
- resizeBarElem.style.top = `${dragTop}px`;
- resizeBarElem.style.width = `${rtWidth}px`;
- if (resizableOpts.showDragTip && resizeTipElem) {
- resizeTipElem.textContent = methods_getI18n('vxe.table.resizeRowTip', [resizeHeight]);
- const resizeTipWidth = resizeTipElem.clientWidth;
- const resizeTipHeight = resizeTipElem.clientHeight;
- let resizeBarLeft = Math.max(2, evnt.clientX - tableRect.x);
- let resizeBarTop = 0;
- if (resizeBarLeft + resizeTipWidth >= rtWidth - 2) {
- resizeBarLeft = rtWidth - resizeTipWidth - 2;
- }
- if (dragTop + resizeTipHeight >= tableHeight) {
- resizeBarTop = tableHeight - (dragTop + resizeTipHeight);
- }
- resizeTipElem.style.left = `${resizeBarLeft}px`;
- resizeTipElem.style.top = `${resizeBarTop}px`;
- }
- reactData.isDragResize = true;
- };
- reactData.isDragResize = true;
- addClass(tableEl, 'row-drag--resize');
- resizeBarElem.style.display = 'block';
- document.onmousemove = updateEvent;
- document.onmouseup = function (evnt) {
- document.onmousemove = null;
- document.onmouseup = null;
- resizeBarElem.style.display = 'none';
- internalData._lastResizeTime = Date.now();
- setTimeout(() => {
- reactData.isDragResize = false;
- }, 50);
- if (resizeHeight !== currCellHeight) {
- const resizeParams = {
- ...params,
- resizeHeight,
- resizeRow: row
- };
- internalData.isResizeCellHeight = true;
- if ($xeTable.handleRowResizeCellAreaEvent) {
- $xeTable.handleRowResizeCellAreaEvent(evnt, resizeParams);
- } else {
- rowRest.resizeHeight = resizeHeight;
- handleUpdateRowResize($xeTable, evnt, resizeParams);
- updateRowOffsetTop($xeTable);
- }
- }
- removeClass(tableEl, 'row-drag--resize');
- };
- updateEvent(evnt);
- },
- handleRowResizeDblclickEvent(evnt, params) {
- const $xeTable = this;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const resizableOpts = $xeTable.computeResizableOpts;
- const {
- isDblclickAutoHeight
- } = resizableOpts;
- const el = $xeTable.$refs.refElem;
- if (isDblclickAutoHeight && el) {
- evnt.stopPropagation();
- evnt.preventDefault();
- const {
- editStore
- } = reactData;
- const {
- fullAllDataRowIdData
- } = internalData;
- const {
- actived
- } = editStore;
- const {
- row
- } = params;
- const rowid = getRowid($xeTable, row);
- const rowRest = fullAllDataRowIdData[rowid];
- if (!rowRest) {
- return;
- }
- const handleRsHeight = () => {
- const resizeHeight = calcCellAutoHeight(rowRest, el);
- const resizeParams = {
- ...params,
- resizeHeight,
- resizeRow: row
- };
- reactData.isDragResize = false;
- internalData._lastResizeTime = Date.now();
- if ($xeTable.handleRowResizeDblclickCellAreaEvent) {
- $xeTable.handleRowResizeDblclickCellAreaEvent(evnt, resizeParams);
- } else {
- rowRest.resizeHeight = resizeHeight;
- handleUpdateRowResize($xeTable, evnt, resizeParams);
- }
- };
- if (actived.row || actived.column) {
- $xeTable.clearEdit().then(handleRsHeight);
- } else {
- handleRsHeight();
- }
- }
- },
- setRowHeightConf(heightConf) {
- const $xeTable = this;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- fullAllDataRowIdData
- } = internalData;
- let status = false;
- if (heightConf) {
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(heightConf, (height, rowid) => {
- const rowRest = fullAllDataRowIdData[rowid];
- if (rowRest) {
- const rHeight = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(height);
- if (rHeight) {
- rowRest.resizeHeight = rHeight;
- if (!status) {
- status = true;
- }
- }
- }
- });
- if (status) {
- internalData.isResizeCellHeight = true;
- reactData.resizeHeightFlag++;
- }
- }
- return $xeTable.$nextTick().then(() => {
- updateRowOffsetTop($xeTable);
- return {
- status
- };
- });
- },
- getRowHeightConf(isFull) {
- const $xeTable = this;
- const internalData = $xeTable;
- const {
- fullAllDataRowIdData,
- afterFullData
- } = internalData;
- const {
- handleGetRowId
- } = createHandleGetRowId($xeTable);
- const rowOpts = $xeTable.computeRowOpts;
- const cellOpts = $xeTable.computeCellOpts;
- const defaultRowHeight = $xeTable.computeDefaultRowHeight;
- const rest = {};
- afterFullData.forEach(row => {
- const rowid = handleGetRowId(row);
- const rowRest = fullAllDataRowIdData[rowid];
- if (rowRest) {
- const resizeHeight = rowRest.resizeHeight;
- if (resizeHeight || isFull) {
- const currCellHeight = resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight;
- rest[rowid] = currCellHeight;
- }
- }
- });
- return rest;
- },
- recalcRowHeight(rowOrId) {
- const $xeTable = this;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- fullAllDataRowIdData
- } = internalData;
- const rows = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(rowOrId) ? rowOrId : [rowOrId];
- const el = $xeTable.$refs.refElem;
- if (el) {
- const {
- handleGetRowId
- } = createHandleGetRowId($xeTable);
- el.setAttribute('data-calc-row', 'Y');
- rows.forEach(row => {
- 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);
- const rowRest = fullAllDataRowIdData[rowid];
- if (rowRest) {
- rowRest.resizeHeight = calcCellAutoHeight(rowRest, el);
- }
- el.removeAttribute('data-calc-row');
- });
- reactData.calcCellHeightFlag++;
- }
- return $xeTable.$nextTick();
- },
- setRowHeight(rowOrId, height) {
- const $xeTable = this;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- fullAllDataRowIdData
- } = internalData;
- let status = false;
- const rows = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(rowOrId) ? rowOrId : [rowOrId];
- let rHeight = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(height);
- if (isScale(height)) {
- const tableBody = $xeTable.$refs.refTableBody;
- const bodyElem = tableBody ? tableBody.$el : null;
- const bodyHeight = bodyElem ? bodyElem.clientHeight - 1 : 0;
- rHeight = Math.floor(rHeight * bodyHeight);
- }
- if (rHeight) {
- const {
- handleGetRowId
- } = createHandleGetRowId($xeTable);
- rows.forEach(row => {
- 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);
- const rowRest = fullAllDataRowIdData[rowid];
- if (rowRest) {
- rowRest.resizeHeight = rHeight;
- if (!status) {
- status = true;
- }
- }
- });
- if (status) {
- internalData.isResizeCellHeight = true;
- reactData.resizeHeightFlag++;
- }
- }
- return $xeTable.$nextTick();
- },
- getRowHeight(rowOrId) {
- const $xeTable = this;
- const internalData = $xeTable;
- const {
- fullAllDataRowIdData
- } = internalData;
- const rowOpts = $xeTable.computeRowOpts;
- const cellOpts = $xeTable.computeCellOpts;
- const defaultRowHeight = $xeTable.computeDefaultRowHeight;
- 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);
- const rowRest = fullAllDataRowIdData[rowid];
- if (rowRest) {
- return rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight;
- }
- return 0;
- },
- /**
- * 刷新滚动操作,手动同步滚动相关位置(对于某些特殊的操作,比如滚动条错位、固定列不同步)
- */
- refreshScroll() {
- const $xeTable = this;
- const internalData = $xeTable;
- const {
- elemStore,
- lastScrollLeft,
- lastScrollTop
- } = internalData;
- const headerScrollElem = getRefElem(elemStore['main-header-scroll']);
- const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
- const footerScrollElem = getRefElem(elemStore['main-footer-scroll']);
- const leftScrollElem = getRefElem(elemStore['left-body-scroll']);
- const rightScrollElem = getRefElem(elemStore['right-body-scroll']);
- const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
- const yHandleEl = $xeTable.$refs.refScrollYHandleElem;
- return new Promise(resolve => {
- // 还原滚动条位置
- if (lastScrollLeft || lastScrollTop) {
- return restoreScrollLocation($xeTable, lastScrollLeft, lastScrollTop).then(() => {
- // 存在滚动行为未结束情况
- setTimeout(resolve, 10);
- });
- }
- internalData.intoRunScroll = true;
- // 重置
- setScrollTop(yHandleEl, lastScrollTop);
- setScrollTop(bodyScrollElem, lastScrollTop);
- setScrollTop(leftScrollElem, lastScrollTop);
- setScrollTop(rightScrollElem, lastScrollTop);
- setScrollLeft(xHandleEl, lastScrollLeft);
- setScrollLeft(bodyScrollElem, lastScrollLeft);
- setScrollLeft(headerScrollElem, lastScrollLeft);
- setScrollLeft(footerScrollElem, lastScrollLeft);
- // 存在滚动行为未结束情况
- setTimeout(() => {
- internalData.intoRunScroll = false;
- resolve();
- }, 10);
- });
- },
- handleResizeEvent() {
- const $xeTable = this;
- handleResizeEvent($xeTable);
- },
- /**
- * 重新渲染布局
- * 刷新布局
- */
- recalculate(reFull) {
- const $xeTable = this;
- const isForce = !!reFull;
- return handleLazyRecalculate($xeTable, isForce, isForce, isForce);
- },
- updateStyle() {
- const $xeTable = this;
- return updateStyle($xeTable);
- },
- /**
- * 处理固定列的显示状态
- */
- checkScrolling() {
- const $xeTable = this;
- const internalData = $xeTable;
- const {
- elemStore
- } = internalData;
- const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
- const leftContainerElem = $xeTable.$refs.refLeftContainer;
- const rightContainerElem = $xeTable.$refs.refRightContainer;
- const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
- const bodtTargetEl = xHandleEl || bodyScrollElem;
- if (bodtTargetEl) {
- if (leftContainerElem) {
- if (bodtTargetEl.scrollLeft > 0) {
- addClass(leftContainerElem, 'scrolling--middle');
- } else {
- removeClass(leftContainerElem, 'scrolling--middle');
- }
- }
- if (rightContainerElem) {
- if (bodtTargetEl.clientWidth < bodtTargetEl.scrollWidth - Math.ceil(bodtTargetEl.scrollLeft)) {
- addClass(rightContainerElem, 'scrolling--middle');
- } else {
- removeClass(rightContainerElem, 'scrolling--middle');
- }
- }
- }
- },
- preventEvent(evnt, type, args, next, end) {
- const $xeTable = this;
- const $xeGrid = $xeTable.$xeGrid;
- const $xeGantt = $xeTable.$xeGantt;
- let evntList = methods_interceptor.get(type);
- // 兼容老版本
- if (!evntList.length && type === 'event.clearEdit') {
- evntList = methods_interceptor.get('event.clearActived');
- if (evntList.length) {
- warnLog('vxe.error.delEvent', ['event.clearActived', 'event.clearEdit']);
- }
- }
- // 兼容老版本
- let rest = null;
- let isStop = false;
- for (let i = 0; i < evntList.length; i++) {
- const func = evntList[i];
- const fnRest = func(Object.assign({
- $table: $xeTable,
- $grid: $xeGrid,
- $gantt: $xeGantt,
- $event: evnt
- }, args));
- if (fnRest === false) {
- isStop = true;
- break;
- } else if (fnRest && fnRest.status === false) {
- rest = fnRest.result;
- isStop = true;
- break;
- }
- }
- if (!isStop) {
- if (next) {
- rest = next();
- }
- }
- if (end) {
- end();
- }
- return rest;
- },
- /**
- * 全局按下事件处理
- */
- handleGlobalMousedownEvent(evnt) {
- const $xeTable = this;
- const props = $xeTable;
- const $xeGrid = $xeTable.$xeGrid;
- const $xeGantt = $xeTable.$xeGantt;
- const $xeGGWrapper = $xeGrid || $xeGantt;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- editStore,
- ctxMenuStore,
- customStore
- } = reactData;
- const {
- mouseConfig,
- editRules
- } = props;
- const el = $xeTable.$refs.refElem;
- const editOpts = $xeTable.computeEditOpts;
- const validOpts = $xeTable.computeValidOpts;
- const areaOpts = $xeTable.computeAreaOpts;
- const {
- actived
- } = editStore;
- const tableFilter = $xeTable.$refs.refTableFilter;
- const tableMenu = $xeTable.$refs.refTableMenu;
- const tableCustom = $xeTable.$refs.refTableCustom;
- const validTooltip = $xeTable.$refs.refValidTooltip;
- // 筛选
- if (tableFilter) {
- if (getEventTargetNode(evnt, el, 'vxe-cell--filter').flag) {
- // 如果点击了筛选按钮
- } else if (getEventTargetNode(evnt, tableFilter.$el).flag) {
- // 如果点击筛选容器
- } else {
- if (!getEventTargetNode(evnt, document.body, 'vxe-table--ignore-clear').flag) {
- this.preventEvent(evnt, 'event.clearFilter', internalData._currFilterParams, this.closeFilter);
- }
- }
- }
- // 自定义列
- if (tableCustom) {
- if (customStore.btnEl === evnt.target || getEventTargetNode(evnt, document.body, 'vxe-toolbar-custom-target').flag) {
- // 如果点击了自定义列按钮
- } else if (getEventTargetNode(evnt, tableCustom.$el).flag) {
- // 如果点击自定义列容器
- } else {
- if (!getEventTargetNode(evnt, document.body, 'vxe-table--ignore-clear').flag) {
- this.preventEvent(evnt, 'event.clearCustom', {}, () => this.closeCustom());
- }
- }
- }
- // 如果已激活了编辑状态
- if (actived.row) {
- if (!(editOpts.autoClear === false)) {
- // 如果是激活状态,点击了单元格之外
- const cell = actived.args.cell;
- if (!cell || !getEventTargetNode(evnt, cell).flag) {
- if (validTooltip && getEventTargetNode(evnt, validTooltip.$el).flag) {
- // 如果是激活状态,且点击了校验提示框
- } else if (!this.lastCallTime || this.lastCallTime + 50 < Date.now()) {
- if (!getEventTargetNode(evnt, document.body, 'vxe-table--ignore-clear').flag) {
- // 如果手动调用了激活单元格,避免触发源被移除后导致重复关闭
- this.preventEvent(evnt, 'event.clearEdit', actived.args, () => {
- let isClear;
- if (editOpts.mode === 'row') {
- const rowTargetNode = getEventTargetNode(evnt, el, 'vxe-body--row');
- const rowNodeRest = rowTargetNode.flag ? $xeTable.getRowNode(rowTargetNode.targetElem) : null;
- // row 方式,如果点击了不同行
- isClear = rowNodeRest ? !$xeTable.eqRow(rowNodeRest.item, actived.args.row) : false;
- } else {
- // cell 方式,如果是非编辑列
- isClear = !getEventTargetNode(evnt, el, 'col--edit').flag;
- }
- // 如果点击表头行,则清除激活状态
- if (!isClear) {
- isClear = getEventTargetNode(evnt, el, 'vxe-header--row').flag;
- }
- // 如果点击表尾行,则清除激活状态
- if (!isClear) {
- isClear = getEventTargetNode(evnt, el, 'vxe-footer--row').flag;
- }
- // 如果固定了高度且点击了行之外的空白处,则清除激活状态
- if (!isClear && this.height && !this.overflowY) {
- const bodyWrapperElem = evnt.target;
- if (hasClass(bodyWrapperElem, 'vxe-table--body-wrapper')) {
- isClear = evnt.offsetY < bodyWrapperElem.clientHeight;
- }
- }
- if (isClear ||
- // 如果点击了当前表格之外
- !getEventTargetNode(evnt, el).flag) {
- setTimeout(() => {
- $xeTable.handleClearEdit(evnt).then(() => {
- // 如果存在校验,点击了表格之外则清除
- if (!this.isActivated && editRules && validOpts.autoClear) {
- this.validErrorMaps = {};
- }
- });
- });
- }
- });
- }
- }
- }
- }
- } else if (mouseConfig) {
- 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)) {
- if ($xeTable.clearSelected) {
- $xeTable.clearSelected();
- }
- if (areaOpts.autoClear) {
- if ($xeTable.getCellAreas) {
- const cellAreas = $xeTable.getCellAreas();
- if (cellAreas && cellAreas.length && !getEventTargetNode(evnt, document.body, 'vxe-table--ignore-areas-clear').flag) {
- $xeTable.preventEvent(evnt, 'event.clearAreas', {}, () => {
- $xeTable.clearCellAreas();
- $xeTable.clearCopyCellArea();
- $xeTable.dispatchEvent('clear-cell-area-selection', {
- cellAreas
- }, evnt);
- });
- }
- }
- }
- }
- }
- // 如果配置了快捷菜单且,点击了其他地方则关闭
- if (ctxMenuStore.visible && tableMenu && !getEventTargetNode(evnt, tableMenu.$el).flag) {
- this.closeMenu();
- }
- const isActivated = getEventTargetNode(evnt, ($xeGGWrapper || $xeTable).$el).flag;
- // 如果存在校验,点击了表格之外则清除
- if (!isActivated && editRules && validOpts.autoClear) {
- this.validErrorMaps = {};
- }
- // 最后激活的表格
- this.isActivated = isActivated;
- },
- /**
- * 窗口失焦事件处理
- */
- handleGlobalBlurEvent() {
- this.closeFilter();
- this.closeMenu();
- },
- /**
- * 全局滚动事件
- */
- handleGlobalMousewheelEvent() {
- this.closeTooltip();
- this.closeMenu();
- },
- /**
- * 表格键盘事件
- */
- keydownEvent(evnt) {
- const $xeTable = this;
- const {
- filterStore,
- ctxMenuStore,
- editStore,
- keyboardConfig,
- mouseConfig,
- mouseOpts,
- keyboardOpts
- } = this;
- const {
- actived
- } = editStore;
- const {
- keyCode
- } = evnt;
- const isEsc = keyCode === 27;
- if (isEsc) {
- this.preventEvent(evnt, 'event.keydown', null, () => {
- $xeTable.dispatchEvent('keydown-start', {}, evnt);
- if (keyboardConfig && mouseConfig && mouseOpts.area && this.handleKeyboardCellAreaEvent) {
- this.handleKeyboardCellAreaEvent(evnt);
- } else if (actived.row || filterStore.visible || ctxMenuStore.visible) {
- evnt.stopPropagation();
- // 如果按下了 Esc 键,关闭快捷菜单、筛选
- this.closeFilter();
- this.closeMenu();
- if (keyboardConfig && keyboardOpts.isEsc) {
- // 如果是激活编辑状态,则取消编辑
- if (actived.row) {
- const params = actived.args;
- this.handleClearEdit(evnt);
- // 如果配置了选中功能,则为选中状态
- if (mouseConfig && mouseOpts.selected) {
- this.$nextTick(() => this.handleSelected(params, evnt));
- }
- }
- }
- }
- $xeTable.dispatchEvent('keydown', {}, evnt);
- $xeTable.dispatchEvent('keydown-end', {}, evnt);
- });
- }
- },
- /**
- * 全局键盘事件
- */
- handleGlobalKeydownEvent(evnt) {
- const $xeTable = this;
- const props = $xeTable;
- const internalData = $xeTable;
- const reactData = $xeTable;
- const $xeGrid = $xeTable.$xeGrid;
- const $xeGantt = $xeTable.$xeGantt;
- // 该行为只对当前激活的表格有效
- if (internalData.isActivated) {
- $xeTable.preventEvent(evnt, 'event.keydown', null, () => {
- const {
- mouseConfig,
- keyboardConfig,
- treeConfig,
- editConfig,
- highlightCurrentRow,
- highlightCurrentColumn
- } = props;
- const {
- ctxMenuStore,
- editStore,
- currentRow
- } = reactData;
- const {
- afterFullData
- } = internalData;
- const isContentMenu = $xeTable.computeIsContentMenu;
- const bodyMenu = $xeTable.computeBodyMenu;
- const keyboardOpts = $xeTable.computeKeyboardOpts;
- const mouseOpts = $xeTable.computeMouseOpts;
- const editOpts = $xeTable.computeEditOpts;
- const treeOpts = $xeTable.computeTreeOpts;
- const menuList = $xeTable.computeMenuList;
- const rowOpts = $xeTable.computeRowOpts;
- const columnOpts = $xeTable.computeColumnOpts;
- const {
- selected,
- actived
- } = editStore;
- const {
- keyCode
- } = evnt;
- const hasBackspaceKey = keyCode === 8;
- const isTab = keyCode === 9;
- const isEnter = keyCode === 13;
- const isEsc = keyCode === 27;
- const isSpacebar = keyCode === 32;
- const isLeftArrow = keyCode === 37;
- const isUpArrow = keyCode === 38;
- const isRightArrow = keyCode === 39;
- const isDwArrow = keyCode === 40;
- const hasDeleteKey = keyCode === 46;
- const isF2 = keyCode === 113;
- const isContextMenu = keyCode === 93;
- const isControlKey = hasControlKey(evnt);
- const hasShiftKey = evnt.shiftKey;
- const hasAltKey = evnt.altKey;
- const operArrow = isLeftArrow || isUpArrow || isRightArrow || isDwArrow;
- const operCtxMenu = isContentMenu && ctxMenuStore.visible && (isEnter || isSpacebar || operArrow);
- const isEditStatus = isEnableConf(editConfig) && actived.column && actived.row;
- const childrenField = treeOpts.children || treeOpts.childrenField;
- const beforeEditMethod = editOpts.beforeEditMethod || editOpts.activeMethod;
- if (operCtxMenu) {
- // 如果配置了右键菜单; 支持方向键操作、回车
- evnt.preventDefault();
- if (ctxMenuStore.showChild && hasChildrenList(ctxMenuStore.selected)) {
- $xeTable.moveCtxMenu(evnt, ctxMenuStore, 'selectChild', isLeftArrow, false, ctxMenuStore.selected.children);
- } else {
- $xeTable.moveCtxMenu(evnt, ctxMenuStore, 'selected', isRightArrow, true, menuList);
- }
- } else if (keyboardConfig && mouseConfig && mouseOpts.area && $xeTable.handleKeyboardCellAreaEvent) {
- $xeTable.handleKeyboardCellAreaEvent(evnt);
- } else if (isEsc) {
- // 如果按下了 Esc 键,关闭快捷菜单、筛选
- if ($xeTable.closeMenu) {
- $xeTable.closeMenu();
- }
- $xeTable.closeFilter();
- if (keyboardConfig && keyboardOpts.isEsc) {
- // 如果是激活编辑状态,则取消编辑
- if (actived.row) {
- const params = actived.args;
- $xeTable.handleClearEdit(evnt);
- // 如果配置了选中功能,则为选中状态
- if (mouseOpts.selected) {
- $xeTable.$nextTick(() => $xeTable.handleSelected(params, evnt));
- }
- }
- }
- } else if (keyboardConfig && isSpacebar && keyboardOpts.isChecked && selected.row && selected.column && (selected.column.type === 'checkbox' || selected.column.type === 'radio')) {
- // 空格键支持选中复选框
- evnt.preventDefault();
- if (selected.column.type === 'checkbox') {
- $xeTable.handleToggleCheckRowEvent(evnt, selected.args);
- } else {
- $xeTable.triggerRadioRowEvent(evnt, selected.args);
- }
- } else if (isF2 && isEnableConf(editConfig)) {
- if (!isEditStatus) {
- // 如果按下了 F2 键
- if (selected.row && selected.column) {
- evnt.stopPropagation();
- evnt.preventDefault();
- $xeTable.handleEdit(selected.args, evnt);
- }
- }
- } else if (isContextMenu) {
- // 如果按下上下文键
- internalData._keyCtx = selected.row && selected.column && bodyMenu.length;
- clearTimeout(internalData.keyCtxTimeout);
- internalData.keyCtxTimeout = setTimeout(() => {
- internalData._keyCtx = false;
- }, 1000);
- } else if (isEnter && !hasAltKey && keyboardConfig && keyboardOpts.isEnter && (selected.row || actived.row || treeConfig && (rowOpts.isCurrent || highlightCurrentRow) && currentRow)) {
- const {
- isLastEnterAppendRow,
- beforeEnterMethod,
- enterMethod
- } = keyboardOpts;
- // 退出选中
- if (isControlKey) {
- // 如果是激活编辑状态,则取消编辑
- if (actived.row) {
- const params = actived.args;
- $xeTable.handleClearEdit(evnt);
- // 如果配置了选中功能,则为选中状态
- if (mouseConfig && mouseOpts.selected) {
- $xeTable.$nextTick(() => $xeTable.handleSelected(params, evnt));
- }
- }
- } else {
- // 如果是激活状态,退则出到上一行/下一行
- if (selected.row || actived.row) {
- const activeParams = selected.row ? selected.args : actived.args;
- if (hasShiftKey) {
- if (keyboardOpts.enterToTab) {
- $xeTable.moveTabSelected(activeParams, hasShiftKey, evnt);
- } else {
- $xeTable.moveEnterSelected(activeParams, isLeftArrow, true, isRightArrow, false, evnt);
- }
- } else {
- if (keyboardOpts.enterToTab) {
- $xeTable.moveTabSelected(activeParams, hasShiftKey, evnt);
- } else {
- const activeRow = selected.row || actived.row;
- const activeColumn = selected.column || actived.column;
- const _rowIndex = $xeTable.getVTRowIndex(activeRow);
- const etrParams = {
- row: activeRow,
- rowIndex: $xeTable.getRowIndex(activeRow),
- $rowIndex: $xeTable.getVMRowIndex(activeRow),
- _rowIndex,
- column: activeColumn,
- columnIndex: $xeTable.getColumnIndex(activeColumn),
- $columnIndex: $xeTable.getVMColumnIndex(activeColumn),
- _columnIndex: $xeTable.getVTColumnIndex(activeColumn),
- $table: $xeTable
- };
- if (!beforeEnterMethod || beforeEnterMethod(etrParams) !== false) {
- // 最后一行按下回车键,自动追加一行
- if (isLastEnterAppendRow) {
- if (_rowIndex >= afterFullData.length - 1) {
- $xeTable.insertAt({}, -1).then(({
- row: newRow
- }) => {
- $xeTable.scrollToRow(newRow, selected.column);
- $xeTable.handleSelected({
- ...activeParams,
- row: newRow
- }, evnt);
- });
- $xeTable.dispatchEvent('enter-append-row', etrParams, evnt);
- return;
- }
- }
- $xeTable.moveEnterSelected(activeParams, isLeftArrow, false, isRightArrow, true, evnt);
- if (enterMethod) {
- enterMethod(etrParams);
- }
- }
- }
- }
- } else if (treeConfig && (rowOpts.isCurrent || highlightCurrentRow) && currentRow) {
- // 如果是树形表格当前行回车移动到子节点
- const childrens = currentRow[childrenField];
- if (childrens && childrens.length) {
- evnt.preventDefault();
- const targetRow = childrens[0];
- const params = {
- $table: $xeTable,
- row: targetRow,
- rowIndex: $xeTable.getRowIndex(targetRow),
- $rowIndex: $xeTable.getVMRowIndex(targetRow)
- };
- $xeTable.setTreeExpand(currentRow, true).then(() => $xeTable.scrollToRow(targetRow)).then(() => $xeTable.triggerCurrentRowEvent(evnt, params));
- }
- }
- }
- } else if (operArrow && keyboardConfig && keyboardOpts.isArrow) {
- if (!isEditStatus) {
- // 如果按下了方向键
- if (mouseOpts.selected && selected.row && selected.column) {
- $xeTable.moveArrowSelected(selected.args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow, evnt);
- } else {
- // 当前行按键上下移动
- if ((isUpArrow || isDwArrow) && (rowOpts.isCurrent || highlightCurrentRow)) {
- $xeTable.moveCurrentRow(isUpArrow, isDwArrow, evnt);
- }
- // 当前行按键左右移动
- if ((isLeftArrow || isRightArrow) && (columnOpts.isCurrent || highlightCurrentColumn)) {
- $xeTable.moveCurrentColumn(isLeftArrow, isRightArrow, evnt);
- }
- }
- }
- } else if (isTab && keyboardConfig && keyboardOpts.isTab) {
- // 如果按下了 Tab 键切换
- if (selected.row || selected.column) {
- $xeTable.moveTabSelected(selected.args, hasShiftKey, evnt);
- } else if (actived.row || actived.column) {
- $xeTable.moveTabSelected(actived.args, hasShiftKey, evnt);
- }
- } else if (keyboardConfig && keyboardOpts.isDel && hasDeleteKey && isEnableConf(editConfig) && (selected.row || selected.column)) {
- // 如果是删除键
- if (!isEditStatus) {
- const {
- delMethod
- } = keyboardOpts;
- const params = {
- row: selected.row,
- rowIndex: $xeTable.getRowIndex(selected.row),
- column: selected.column,
- columnIndex: $xeTable.getColumnIndex(selected.column),
- $table: $xeTable,
- $grid: $xeGrid,
- $gantt: $xeGantt
- };
- // 是否被禁用
- if (!beforeEditMethod || beforeEditMethod(params)) {
- if (delMethod) {
- delMethod(params);
- } else {
- setCellValue(selected.row, selected.column, null);
- }
- // 如果按下 del 键,更新表尾数据
- $xeTable.updateFooter();
- $xeTable.dispatchEvent('cell-delete-value', params, evnt);
- }
- }
- } else if (hasBackspaceKey && keyboardConfig && keyboardOpts.isBack && isEnableConf(editConfig) && (selected.row || selected.column)) {
- if (!isEditStatus) {
- const {
- editMode,
- backMethod
- } = keyboardOpts;
- // 如果是删除键
- if (keyboardOpts.isDel && isEnableConf(editConfig) && (selected.row || selected.column)) {
- const params = {
- row: selected.row,
- rowIndex: $xeTable.getRowIndex(selected.row),
- column: selected.column,
- columnIndex: $xeTable.getColumnIndex(selected.column),
- $table: $xeTable,
- $grid: $xeGrid,
- $gantt: $xeGantt
- };
- // 是否被禁用
- if (!beforeEditMethod || beforeEditMethod(params)) {
- if (backMethod) {
- backMethod(params);
- } else {
- // 追加方式与覆盖式
- if (editMode !== 'insert') {
- setCellValue(selected.row, selected.column, null);
- }
- $xeTable.handleEdit(selected.args, evnt);
- }
- $xeTable.dispatchEvent('cell-backspace-value', params, evnt);
- }
- }
- }
- } else if (hasBackspaceKey && keyboardConfig && treeConfig && keyboardOpts.isBack && (rowOpts.isCurrent || highlightCurrentRow) && currentRow) {
- // 如果树形表格回退键关闭当前行返回父节点
- const {
- parent: parentRow
- } = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findTree(internalData.afterTreeFullData, item => item === currentRow, {
- children: childrenField
- });
- if (parentRow) {
- evnt.preventDefault();
- const params = {
- row: parentRow,
- rowIndex: $xeTable.getRowIndex(parentRow),
- $rowIndex: $xeTable.getVMRowIndex(parentRow),
- $table: $xeTable,
- $grid: $xeGrid,
- $gantt: $xeGantt
- };
- $xeTable.setTreeExpand(parentRow, false).then(() => $xeTable.scrollToRow(parentRow)).then(() => $xeTable.triggerCurrentRowEvent(evnt, params));
- }
- } 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)) {
- const {
- editMethod
- } = keyboardOpts;
- // 启用编辑后,空格键功能将失效
- // if (isSpacebar) {
- // evnt.preventDefault()
- // }
- // 如果是按下非功能键之外允许直接编辑
- if (selected.column && selected.row && isEnableConf(selected.column.editRender)) {
- const beforeEditMethod = editOpts.beforeEditMethod || editOpts.activeMethod;
- const params = {
- row: selected.row,
- rowIndex: $xeTable.getRowIndex(selected.row),
- column: selected.column,
- columnIndex: $xeTable.getColumnIndex(selected.column),
- $table: $xeTable,
- $grid: $xeGrid,
- $gantt: $xeGantt
- };
- if (!beforeEditMethod || beforeEditMethod(params)) {
- if (editMethod) {
- editMethod(params);
- } else {
- setCellValue(selected.row, selected.column, null);
- $xeTable.handleEdit(selected.args, evnt);
- }
- }
- }
- }
- $xeTable.dispatchEvent('keydown', {}, evnt);
- });
- }
- },
- handleGlobalPasteEvent(evnt) {
- const $xeTable = this;
- const {
- isActivated,
- keyboardConfig,
- keyboardOpts,
- mouseConfig,
- mouseOpts,
- editStore,
- filterStore
- } = this;
- const {
- actived
- } = editStore;
- if (isActivated && !filterStore.visible) {
- if (!(actived.row || actived.column)) {
- if (keyboardConfig && keyboardOpts.isClip && mouseConfig && mouseOpts.area && this.handlePasteCellAreaEvent) {
- this.handlePasteCellAreaEvent(evnt);
- }
- }
- $xeTable.dispatchEvent('paste', {}, evnt);
- }
- },
- handleGlobalCopyEvent(evnt) {
- const $xeTable = this;
- const {
- isActivated,
- keyboardConfig,
- keyboardOpts,
- mouseConfig,
- mouseOpts,
- editStore,
- filterStore
- } = this;
- const {
- actived
- } = editStore;
- if (isActivated && !filterStore.visible) {
- if (!(actived.row || actived.column)) {
- if (keyboardConfig && keyboardOpts.isClip && mouseConfig && mouseOpts.area && this.handleCopyCellAreaEvent) {
- this.handleCopyCellAreaEvent(evnt);
- }
- }
- $xeTable.dispatchEvent('copy', {}, evnt);
- }
- },
- handleGlobalCutEvent(evnt) {
- const $xeTable = this;
- const {
- isActivated,
- keyboardConfig,
- keyboardOpts,
- mouseConfig,
- mouseOpts,
- editStore,
- filterStore
- } = this;
- const {
- actived
- } = editStore;
- if (isActivated && !filterStore.visible) {
- if (!(actived.row || actived.column)) {
- if (keyboardConfig && keyboardOpts.isClip && mouseConfig && mouseOpts.area && this.handleCutCellAreaEvent) {
- this.handleCutCellAreaEvent(evnt);
- }
- }
- $xeTable.dispatchEvent('cut', {}, evnt);
- }
- },
- handleGlobalResizeEvent() {
- const $xeTable = this;
- $xeTable.closeMenu();
- $xeTable.updateCellAreas();
- handleResizeEvent($xeTable);
- $xeTable.updateCellAreas();
- },
- /**
- * 处理合并
- */
- handleUpdateBodyMerge() {
- const $xeTable = this;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- mergeBodyList
- } = internalData;
- internalData.mergeBodyCellMaps = buildMergeData(mergeBodyList);
- reactData.mergeBodyFlag++;
- },
- handleUpdateHeaderMerge() {
- const $xeTable = this;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- mergeHeaderList
- } = internalData;
- internalData.mergeHeaderCellMaps = buildMergeData(mergeHeaderList);
- reactData.mergeHeadFlag++;
- },
- handleUpdateFooterMerge() {
- const $xeTable = this;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- mergeFooterList
- } = internalData;
- internalData.mergeFooterCellMaps = buildMergeData(mergeFooterList);
- reactData.mergeFootFlag++;
- },
- handleAggregateSummaryData() {
- const $xeTable = this;
- return updateGroupData($xeTable);
- },
- handleTargetLeaveEvent() {
- const $xeTable = this;
- const internalData = $xeTable;
- const tooltipOpts = $xeTable.computeTooltipOpts;
- let $tooltip = $xeTable.$refs.refTooltip;
- if ($tooltip && $tooltip.setActived) {
- $tooltip.setActived(false);
- }
- if (tooltipOpts.enterable) {
- internalData.tooltipTimeout = setTimeout(() => {
- $tooltip = $xeTable.$refs.refTooltip;
- if ($tooltip && $tooltip.isActived && !$tooltip.isActived()) {
- $xeTable.closeTooltip();
- }
- }, tooltipOpts.leaveDelay);
- } else {
- $xeTable.closeTooltip();
- }
- },
- triggerHeaderTitleEvent(evnt, iconParams, params) {
- const $xeTable = this;
- const reactData = $xeTable;
- const tipContent = iconParams.content || iconParams.message;
- if (tipContent) {
- const {
- tooltipStore
- } = reactData;
- const {
- column
- } = params;
- const content = getFuncText(tipContent);
- handleTargetEnterEvent($xeTable, true);
- tooltipStore.row = null;
- tooltipStore.column = column;
- tooltipStore.visible = true;
- tooltipStore.currOpts = iconParams;
- $xeTable.$nextTick(() => {
- const $tooltip = $xeTable.$refs.refTooltip;
- if ($tooltip && $tooltip.open) {
- $tooltip.open(evnt.currentTarget, content);
- }
- });
- }
- },
- /**
- * 触发表头 tooltip 事件
- */
- triggerHeaderTooltipEvent(evnt, params) {
- const $xeTable = this;
- const reactData = $xeTable;
- const {
- tooltipStore
- } = reactData;
- const headerTooltipOpts = $xeTable.computeHeaderTooltipOpts;
- const {
- column
- } = params;
- handleTargetEnterEvent($xeTable, true);
- const titleElem = evnt.currentTarget;
- if (!titleElem) {
- return;
- }
- const cWrapperEl = titleElem.parentElement;
- if (!cWrapperEl) {
- return;
- }
- const cellEl = cWrapperEl.parentElement;
- if (!cellEl) {
- return;
- }
- const thEl = cellEl.parentElement;
- if (!thEl) {
- return;
- }
- if (tooltipStore.column !== column || !tooltipStore.visible) {
- const ctEl = thEl.querySelector('.vxe-cell--title');
- handleTooltip($xeTable, evnt, headerTooltipOpts, 'header', thEl, (hasClass(thEl, 'col--ellipsis') ? ctEl : cWrapperEl) || cWrapperEl, ctEl || cellEl, params);
- }
- },
- /**
- * 触发单元格 tooltip 事件
- */
- triggerBodyTooltipEvent(evnt, params) {
- const $xeTable = this;
- const props = $xeTable;
- const reactData = $xeTable;
- const {
- editConfig
- } = props;
- const {
- editStore
- } = reactData;
- const {
- tooltipStore
- } = reactData;
- const tooltipOpts = $xeTable.computeTooltipOpts;
- const editOpts = $xeTable.computeEditOpts;
- const {
- actived
- } = editStore;
- const {
- row,
- column
- } = params;
- const tdEl = evnt.currentTarget;
- handleTargetEnterEvent($xeTable, tooltipStore.column !== column || tooltipStore.row !== row);
- // 单元格处于编辑状态时不触发提示框
- if (column.editRender && isEnableConf(editConfig)) {
- // 如果是行编辑模式
- if (editOpts.mode === 'row' && actived.row === row) {
- return;
- }
- // 如果是单元格编辑模式
- if (actived.row === row && actived.column === column) {
- return;
- }
- }
- if (tooltipStore.column !== column || tooltipStore.row !== row || !tooltipStore.visible) {
- const ctEl = tdEl.querySelector('.vxe-cell--wrapper');
- let ovEl = null;
- let tipEl = tdEl.querySelector(column.type === 'html' ? '.vxe-cell--html' : '.vxe-cell--label');
- if (column.treeNode) {
- ovEl = tdEl.querySelector('.vxe-tree-cell');
- }
- if (!tipEl) {
- tipEl = ctEl;
- }
- handleTooltip($xeTable, evnt, tooltipOpts, 'body', tdEl, ovEl || ctEl, tipEl, params);
- }
- },
- /**
- * 触发表尾 tooltip 事件
- */
- triggerFooterTooltipEvent(evnt, params) {
- const $xeTable = this;
- const reactData = $xeTable;
- const {
- column
- } = params;
- const {
- tooltipStore
- } = reactData;
- const footerTooltipOpts = $xeTable.computeFooterTooltipOpts;
- const tdEl = evnt.currentTarget;
- handleTargetEnterEvent($xeTable, tooltipStore.column !== column || !!tooltipStore.row);
- if (tooltipStore.column !== column || !tooltipStore.visible) {
- const ctEl = tdEl.querySelector('.vxe-cell--wrapper');
- let ovEl = null;
- let tipEl = tdEl.querySelector(column.type === 'html' ? '.vxe-cell--html' : '.vxe-cell--label');
- if (column.type === 'html') {
- ovEl = tdEl.querySelector('.vxe-cell--html');
- }
- if (!tipEl) {
- tipEl = ctEl;
- }
- handleTooltip($xeTable, evnt, footerTooltipOpts, 'footer', tdEl, ovEl || ctEl, tipEl, params);
- }
- },
- openTooltip(target, content) {
- const {
- $refs
- } = this;
- const commTip = $refs.refCommTooltip;
- if (commTip) {
- return commTip.open(target, content);
- }
- return this.$nextTick();
- },
- /**
- * 关闭 tooltip
- */
- closeTooltip() {
- const $xeTable = this;
- const reactData = $xeTable;
- const {
- tooltipStore
- } = reactData;
- const tooltip = $xeTable.$refs.refTooltip;
- const commTip = $xeTable.$refs.refCommTooltip;
- if (tooltipStore.visible) {
- Object.assign(tooltipStore, {
- row: null,
- column: null,
- content: null,
- visible: false,
- type: null,
- currOpts: {}
- });
- if (tooltip) {
- tooltip.close();
- }
- }
- if (commTip) {
- commTip.close();
- }
- return this.$nextTick();
- },
- /**
- * 判断列头复选框是否被选中
- */
- isAllCheckboxChecked() {
- return this.isAllSelected;
- },
- /**
- * 判断列头复选框是否被半选
- */
- isAllCheckboxIndeterminate() {
- return !this.isAllSelected && this.isIndeterminate;
- },
- isCheckboxIndeterminate() {
- warnLog('vxe.error.delFunc', ['isCheckboxIndeterminate', 'isAllCheckboxIndeterminate']);
- return this.isAllCheckboxIndeterminate();
- },
- /**
- * 获取复选框半选状态的行数据
- */
- getCheckboxIndeterminateRecords(isFull) {
- const $xeTable = this;
- const props = $xeTable;
- const internalData = $xeTable;
- const {
- treeConfig
- } = props;
- const {
- fullDataRowIdData,
- treeIndeterminateRowMaps
- } = internalData;
- if (treeConfig) {
- const fullRest = [];
- const defRest = [];
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(treeIndeterminateRowMaps, (item, rowid) => {
- if (item) {
- fullRest.push(item);
- if (fullDataRowIdData[rowid]) {
- defRest.push(item);
- }
- }
- });
- if (isFull) {
- return fullRest;
- }
- return defRest;
- }
- return [];
- },
- handleCheckedCheckboxRow(rows, value, isForce) {
- const $xeTable = this;
- return handleCheckedCheckboxRow($xeTable, rows, value, isForce);
- },
- /**
- * 用于多选行,设置行为选中状态,第二个参数为选中与否
- * @param {Array/Row} rows 行数据
- * @param {Boolean} value 是否选中
- */
- setCheckboxRow(rows, checked) {
- const $xeTable = this;
- if (rows && !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(rows)) {
- rows = [rows];
- }
- return handleCheckedCheckboxRow($xeTable, rows, checked, true);
- },
- setCheckboxRowKey(keys, checked) {
- const $xeTable = this;
- const internalData = $xeTable;
- const {
- fullAllDataRowIdData
- } = internalData;
- if (keys && !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(keys)) {
- keys = [keys];
- }
- const rows = [];
- keys.forEach(rowid => {
- const rowRest = fullAllDataRowIdData[rowid];
- if (rowRest) {
- rows.push(rowRest.row);
- }
- });
- return handleCheckedCheckboxRow($xeTable, rows, checked, true);
- },
- isCheckedByCheckboxRow(row) {
- const $xeTable = this;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- updateCheckboxFlag
- } = reactData;
- const {
- selectCheckboxMaps
- } = internalData;
- const checkboxOpts = $xeTable.computeCheckboxOpts;
- const {
- checkField
- } = checkboxOpts;
- if (checkField) {
- return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, checkField);
- }
- return !!updateCheckboxFlag && !!selectCheckboxMaps[getRowid($xeTable, row)];
- },
- isCheckedByCheckboxRowKey(rowid) {
- const $xeTable = this;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- updateCheckboxFlag
- } = reactData;
- const {
- fullAllDataRowIdData,
- selectCheckboxMaps
- } = internalData;
- const checkboxOpts = $xeTable.computeCheckboxOpts;
- const {
- checkField
- } = checkboxOpts;
- if (checkField) {
- const rowRest = fullAllDataRowIdData[rowid];
- if (rowRest) {
- return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(rowRest.row, checkField);
- }
- return false;
- }
- return !!updateCheckboxFlag && !!selectCheckboxMaps[rowid];
- },
- isIndeterminateByCheckboxRow(row) {
- const $xeTable = this;
- const internalData = $xeTable;
- const {
- treeIndeterminateRowMaps
- } = internalData;
- return !!treeIndeterminateRowMaps[getRowid($xeTable, row)] && !$xeTable.isCheckedByCheckboxRow(row);
- },
- isIndeterminateByCheckboxRowKey(rowid) {
- const $xeTable = this;
- const internalData = $xeTable;
- const {
- treeIndeterminateRowMaps
- } = internalData;
- return !!treeIndeterminateRowMaps[rowid] && !$xeTable.isCheckedByCheckboxRowKey(rowid);
- },
- /**
- * 切换选中
- * 多选,行选中事件
- */
- handleBatchSelectRows(rows, checked, isForce) {
- const $xeTable = this;
- const props = $xeTable;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- treeConfig
- } = props;
- const {
- isRowGroupStatus
- } = reactData;
- const {
- selectCheckboxMaps
- } = internalData;
- const aggregateOpts = $xeTable.computeAggregateOpts;
- const treeOpts = $xeTable.computeTreeOpts;
- const {
- transform,
- mapChildrenField
- } = treeOpts;
- const childrenField = treeOpts.children || treeOpts.childrenField;
- const checkboxOpts = $xeTable.computeCheckboxOpts;
- const {
- checkField,
- checkStrictly,
- checkMethod
- } = checkboxOpts;
- const {
- handleGetRowId
- } = createHandleGetRowId($xeTable);
- // indeterminateField 仅支持读取
- const indeterminateField = checkboxOpts.indeterminateField || checkboxOpts.halfField;
- if (checkField) {
- // 树结构
- if ((treeConfig || isRowGroupStatus) && !checkStrictly) {
- // 更新子节点状态
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(rows, row => {
- if (isForce || !checkMethod || checkMethod({
- $table: $xeTable,
- row
- })) {
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(row, checkField, checked);
- if (indeterminateField) {
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(row, indeterminateField, false);
- }
- handleCheckboxReserveRow($xeTable, row, checked);
- }
- }, {
- children: transform ? mapChildrenField : childrenField
- });
- reactData.updateCheckboxFlag++;
- return;
- }
- // 列表
- rows.forEach(row => {
- if (isForce || !checkMethod || checkMethod({
- $table: $xeTable,
- row
- })) {
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(row, checkField, checked);
- handleCheckboxReserveRow($xeTable, row, checked);
- }
- });
- reactData.updateCheckboxFlag++;
- return;
- }
- // 树结构
- if (!checkStrictly) {
- if (isRowGroupStatus) {
- // 更新行分组节点状态
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(rows, row => {
- const rowid = handleGetRowId(row);
- if (isForce || !checkMethod || checkMethod({
- $table: $xeTable,
- row
- })) {
- if (checked) {
- selectCheckboxMaps[rowid] = row;
- } else {
- if (selectCheckboxMaps[rowid]) {
- delete selectCheckboxMaps[rowid];
- }
- }
- handleCheckboxReserveRow($xeTable, row, checked);
- }
- }, {
- children: aggregateOpts.mapChildrenField
- });
- reactData.updateCheckboxFlag++;
- return;
- } else if (treeConfig) {
- // 更新子节点状态
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(rows, row => {
- const rowid = handleGetRowId(row);
- if (isForce || !checkMethod || checkMethod({
- $table: $xeTable,
- row
- })) {
- if (checked) {
- selectCheckboxMaps[rowid] = row;
- } else {
- if (selectCheckboxMaps[rowid]) {
- delete selectCheckboxMaps[rowid];
- }
- }
- handleCheckboxReserveRow($xeTable, row, checked);
- }
- }, {
- children: transform ? mapChildrenField : childrenField
- });
- reactData.updateCheckboxFlag++;
- return;
- }
- }
- // 列表
- rows.forEach(row => {
- const rowid = handleGetRowId(row);
- if (isForce || !checkMethod || checkMethod({
- $table: $xeTable,
- row
- })) {
- if (checked) {
- if (!selectCheckboxMaps[rowid]) {
- selectCheckboxMaps[rowid] = row;
- }
- } else {
- if (selectCheckboxMaps[rowid]) {
- delete selectCheckboxMaps[rowid];
- }
- }
- handleCheckboxReserveRow($xeTable, row, checked);
- reactData.updateCheckboxFlag++;
- }
- });
- },
- /**
- * 即将移除
- * @deprecated
- */
- handleSelectRow({
- row
- }, checked, isForce) {
- const $xeTable = this;
- $xeTable.handleBatchSelectRows([row], checked, isForce);
- },
- handleToggleCheckRowEvent(evnt, params) {
- const $xeTable = this;
- const internalData = $xeTable;
- const {
- selectCheckboxMaps
- } = internalData;
- const checkboxOpts = $xeTable.computeCheckboxOpts;
- const {
- checkField,
- trigger
- } = checkboxOpts;
- const {
- row
- } = params;
- if (trigger === 'manual') {
- return;
- }
- let checked = false;
- if (checkField) {
- checked = !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, checkField);
- } else {
- checked = !selectCheckboxMaps[getRowid($xeTable, row)];
- }
- if (evnt) {
- $xeTable.triggerCheckRowEvent(evnt, params, checked);
- } else {
- $xeTable.handleBatchSelectRows([row], checked);
- $xeTable.checkSelectionStatus();
- }
- },
- triggerCheckRowEvent(evnt, params, checked) {
- const $xeTable = this;
- const props = $xeTable;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- treeConfig
- } = props;
- const {
- row
- } = params;
- const {
- isRowGroupStatus
- } = reactData;
- const {
- afterFullData
- } = internalData;
- const checkboxOpts = $xeTable.computeCheckboxOpts;
- const {
- checkMethod,
- trigger
- } = checkboxOpts;
- if (trigger === 'manual') {
- return;
- }
- evnt.stopPropagation();
- if (checkboxOpts.isShiftKey && evnt.shiftKey && !(treeConfig || isRowGroupStatus)) {
- const checkboxRecords = $xeTable.getCheckboxRecords();
- if (checkboxRecords.length) {
- const firstRow = checkboxRecords[0];
- const _rowIndex = $xeTable.getVTRowIndex(row);
- const _firstRowIndex = $xeTable.getVTRowIndex(firstRow);
- if (_rowIndex !== _firstRowIndex) {
- $xeTable.setAllCheckboxRow(false);
- const rangeRows = _rowIndex < _firstRowIndex ? afterFullData.slice(_rowIndex, _firstRowIndex + 1) : afterFullData.slice(_firstRowIndex, _rowIndex + 1);
- $xeTable.$nextTick(() => {
- handleCheckedCheckboxRow($xeTable, rangeRows, true, false);
- });
- $xeTable.dispatchEvent('checkbox-range-select', Object.assign({
- rangeRecords: rangeRows
- }, params), evnt);
- return;
- }
- }
- }
- if (isRowGroupStatus || !checkMethod || checkMethod({
- $table: $xeTable,
- row
- })) {
- $xeTable.handleBatchSelectRows([row], checked);
- $xeTable.checkSelectionStatus();
- $xeTable.dispatchEvent('checkbox-change', Object.assign({
- records: () => $xeTable.getCheckboxRecords(),
- reserves: () => $xeTable.getCheckboxReserveRecords(),
- indeterminates: () => $xeTable.getCheckboxIndeterminateRecords(),
- checked
- }, params), evnt);
- }
- },
- /**
- * 多选,切换某一行的选中状态
- */
- toggleCheckboxRow(row) {
- const $xeTable = this;
- const internalData = $xeTable;
- const {
- selectCheckboxMaps
- } = internalData;
- const checkboxOpts = $xeTable.computeCheckboxOpts;
- const {
- checkField
- } = checkboxOpts;
- const checked = checkField ? !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, checkField) : !selectCheckboxMaps[getRowid($xeTable, row)];
- $xeTable.handleBatchSelectRows([row], checked, true);
- $xeTable.checkSelectionStatus();
- return $xeTable.$nextTick();
- },
- /**
- * 用于多选行,设置所有行的选中状态
- * @param {Boolean} value 是否选中
- */
- setAllCheckboxRow(value) {
- const $xeTable = this;
- return handleCheckedAllCheckboxRow($xeTable, value, true);
- },
- updateCheckboxStatus() {
- const $xeTable = this;
- const props = $xeTable;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- treeConfig
- } = props;
- const {
- isRowGroupStatus
- } = reactData;
- const {
- afterTreeFullData,
- afterGroupFullData,
- selectCheckboxMaps,
- treeIndeterminateRowMaps
- } = internalData;
- const aggregateOpts = $xeTable.computeAggregateOpts;
- const treeOpts = $xeTable.computeTreeOpts;
- const childrenField = treeOpts.children || treeOpts.childrenField;
- const checkboxOpts = $xeTable.computeCheckboxOpts;
- const {
- checkField,
- indeterminateField,
- checkStrictly,
- checkMethod
- } = checkboxOpts;
- if (checkStrictly) {
- return;
- }
- if (isRowGroupStatus || treeConfig) {
- const {
- handleGetRowId
- } = createHandleGetRowId($xeTable);
- const childRowMaps = {};
- const childRowList = [];
- if (isRowGroupStatus) {
- // 行分组
- const mapChildrenField = aggregateOpts.mapChildrenField;
- if (mapChildrenField) {
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(afterGroupFullData, row => {
- const rowid = handleGetRowId(row);
- const childList = row[mapChildrenField];
- if (childList && childList.length && !childRowMaps[rowid]) {
- childRowMaps[rowid] = 1;
- childRowList.unshift([row, rowid, childList]);
- }
- }, {
- children: mapChildrenField
- });
- }
- } else if (treeConfig) {
- // 树结构
- const {
- transform,
- mapChildrenField
- } = treeOpts;
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(afterTreeFullData, row => {
- const rowid = handleGetRowId(row);
- const childList = row[transform ? mapChildrenField : childrenField];
- if (childList && childList.length && !childRowMaps[rowid]) {
- childRowMaps[rowid] = 1;
- childRowList.unshift([row, rowid, childList]);
- } else {
- if (indeterminateField) {
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(row, indeterminateField, false);
- }
- }
- }, {
- children: transform ? mapChildrenField : childrenField
- });
- }
- childRowList.forEach(vals => {
- const row = vals[0];
- const rowid = vals[1];
- const childList = vals[2];
- let sLen = 0; // 已选
- let hLen = 0; // 半选
- let vLen = 0; // 有效子行
- const cLen = childList.length; // 子行
- childList.forEach(checkMethod ? item => {
- const childRowid = handleGetRowId(item);
- const isSelect = checkField ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(item, checkField) : selectCheckboxMaps[childRowid];
- if (checkMethod({
- $table: $xeTable,
- row: item
- })) {
- if (isSelect) {
- sLen++;
- } else if (treeIndeterminateRowMaps[childRowid]) {
- hLen++;
- }
- vLen++;
- } else {
- if (isSelect) {
- sLen++;
- } else if (treeIndeterminateRowMaps[childRowid]) {
- hLen++;
- }
- }
- } : item => {
- const childRowid = handleGetRowId(item);
- const isSelect = checkField ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(item, checkField) : selectCheckboxMaps[childRowid];
- if (isSelect) {
- sLen++;
- } else if (treeIndeterminateRowMaps[childRowid]) {
- hLen++;
- }
- vLen++;
- });
- let isSelected = false;
- if (cLen > 0) {
- if (vLen > 0) {
- isSelected = (sLen > 0 || hLen > 0) && sLen >= vLen;
- } else {
- // 如果存在子项禁用
- if (sLen > 0 && sLen >= vLen) {
- isSelected = true;
- } else if (selectCheckboxMaps[rowid]) {
- isSelected = true;
- } else {
- isSelected = false;
- }
- }
- } else {
- // 如果无子项
- isSelected = selectCheckboxMaps[rowid];
- }
- const halfSelect = !isSelected && (sLen > 0 || hLen > 0);
- if (checkField) {
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(row, checkField, isSelected);
- }
- if (indeterminateField) {
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(row, indeterminateField, halfSelect);
- }
- if (isSelected) {
- if (!checkField) {
- selectCheckboxMaps[rowid] = row;
- }
- if (treeIndeterminateRowMaps[rowid]) {
- delete treeIndeterminateRowMaps[rowid];
- }
- } else {
- if (!checkField) {
- if (selectCheckboxMaps[rowid]) {
- delete selectCheckboxMaps[rowid];
- }
- }
- if (halfSelect) {
- treeIndeterminateRowMaps[rowid] = row;
- } else {
- if (treeIndeterminateRowMaps[rowid]) {
- delete treeIndeterminateRowMaps[rowid];
- }
- }
- }
- });
- }
- reactData.updateCheckboxFlag++;
- },
- updateAllCheckboxStatus() {
- const $xeTable = this;
- const props = $xeTable;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- treeConfig
- } = props;
- const {
- isRowGroupStatus
- } = reactData;
- const {
- afterFullData,
- afterTreeFullData,
- afterGroupFullData,
- checkboxReserveRowMap,
- selectCheckboxMaps,
- treeIndeterminateRowMaps
- } = internalData;
- const aggregateOpts = $xeTable.computeAggregateOpts;
- const {
- mapChildrenField
- } = aggregateOpts;
- const checkboxOpts = $xeTable.computeCheckboxOpts;
- const {
- checkField,
- checkMethod,
- showReserveStatus
- } = checkboxOpts;
- const {
- handleGetRowId
- } = createHandleGetRowId($xeTable);
- let sLen = 0; // 已选
- let dsLen = 0; // 禁用的已选
- let hLen = 0; // 半选
- let dhLen = 0; // 禁用的半选
- let vLen = 0; // 有效行
- const rootList = treeConfig ? afterTreeFullData : isRowGroupStatus ? afterGroupFullData : afterFullData;
- rootList.forEach(checkMethod ? row => {
- const childRowid = handleGetRowId(row);
- const selected = checkField ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, checkField) : selectCheckboxMaps[childRowid];
- if (isRowGroupStatus && $xeTable.isAggregateRecord(row)) {
- const childList = row[mapChildrenField || ''];
- if (selected) {
- vLen++;
- sLen++;
- } else if (treeIndeterminateRowMaps[childRowid]) {
- vLen++;
- hLen++;
- } else if (childList && childList.length && childList.some(item => checkMethod({
- $table: $xeTable,
- row: item
- }))) {
- vLen++;
- }
- } else if (checkMethod({
- $table: $xeTable,
- row
- })) {
- if (selected) {
- sLen++;
- } else if (treeIndeterminateRowMaps[childRowid]) {
- hLen++;
- }
- vLen++;
- } else {
- if (selected) {
- dsLen++;
- } else if (treeIndeterminateRowMaps[childRowid]) {
- dhLen++;
- }
- }
- } : row => {
- const childRowid = handleGetRowId(row);
- const selected = checkField ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, checkField) : selectCheckboxMaps[childRowid];
- if (selected) {
- sLen++;
- } else if (treeIndeterminateRowMaps[childRowid]) {
- hLen++;
- }
- vLen++;
- });
- const isSelected = rootList.length > 0 ? vLen > 0 ? sLen >= vLen : sLen >= rootList.length : false;
- let halfSelect = !isSelected && (sLen > 0 || hLen > 0 || dsLen > 0 || dhLen > 0);
- // 如果复选框启用保留记录,当保留数据存在时显示半选
- if (!isSelected && !halfSelect && showReserveStatus) {
- halfSelect = !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isEmpty(checkboxReserveRowMap);
- }
- reactData.isAllSelected = isSelected;
- reactData.isIndeterminate = halfSelect;
- },
- checkSelectionStatus() {
- const $xeTable = this;
- $xeTable.updateCheckboxStatus();
- $xeTable.updateAllCheckboxStatus();
- },
- /**
- * 获取单选框保留选中的行
- */
- getRadioReserveRecord(isFull) {
- const {
- fullDataRowIdData,
- radioReserveRow,
- radioOpts,
- afterFullData,
- treeConfig,
- treeOpts
- } = this;
- const childrenField = treeOpts.children || treeOpts.childrenField;
- if (radioOpts.reserve && radioReserveRow) {
- const rowid = getRowid(this, radioReserveRow);
- if (isFull) {
- if (!fullDataRowIdData[rowid]) {
- return radioReserveRow;
- }
- } else {
- const rowkey = getRowkey(this);
- if (treeConfig) {
- 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), {
- children: childrenField
- });
- if (matchObj) {
- return radioReserveRow;
- }
- } else {
- if (!afterFullData.some(row => rowid === external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, rowkey))) {
- return radioReserveRow;
- }
- }
- }
- }
- return null;
- },
- clearRadioReserve() {
- this.radioReserveRow = null;
- return this.$nextTick();
- },
- /**
- * 获取复选框保留选中的行
- */
- getCheckboxReserveRecords(isFull) {
- const $xeTable = this;
- const props = $xeTable;
- const internalData = $xeTable;
- const {
- treeConfig
- } = props;
- const {
- afterFullData,
- fullDataRowIdData,
- checkboxReserveRowMap
- } = internalData;
- const checkboxOpts = $xeTable.computeCheckboxOpts;
- const treeOpts = $xeTable.computeTreeOpts;
- const childrenField = treeOpts.children || treeOpts.childrenField;
- const reserveSelection = [];
- if (checkboxOpts.reserve) {
- const {
- handleGetRowId
- } = createHandleGetRowId($xeTable);
- const afterFullIdMaps = {};
- if (treeConfig) {
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(afterFullData, row => {
- afterFullIdMaps[handleGetRowId(row)] = 1;
- }, {
- children: childrenField
- });
- } else {
- afterFullData.forEach(row => {
- afterFullIdMaps[handleGetRowId(row)] = 1;
- });
- }
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(checkboxReserveRowMap, (oldRow, oldRowid) => {
- if (oldRow) {
- if (isFull) {
- if (!fullDataRowIdData[oldRowid]) {
- reserveSelection.push(oldRow);
- }
- } else {
- if (!afterFullIdMaps[oldRowid]) {
- reserveSelection.push(oldRow);
- }
- }
- }
- });
- }
- return reserveSelection;
- },
- clearCheckboxReserve() {
- this.checkboxReserveRowMap = {};
- return this.$nextTick();
- },
- handleCheckboxReserveRow(row, checked) {
- const {
- checkboxReserveRowMap,
- checkboxOpts
- } = this;
- if (checkboxOpts.reserve) {
- const rowid = getRowid(this, row);
- if (checked) {
- checkboxReserveRowMap[rowid] = row;
- } else if (checkboxReserveRowMap[rowid]) {
- delete checkboxReserveRowMap[rowid];
- }
- }
- },
- handleCheckAllEvent(evnt, value) {
- const $xeTable = this;
- handleCheckedAllCheckboxRow($xeTable, value);
- if (evnt) {
- $xeTable.dispatchEvent('checkbox-all', {
- records: () => $xeTable.getCheckboxRecords(),
- reserves: () => $xeTable.getCheckboxReserveRecords(),
- indeterminates: () => $xeTable.getCheckboxIndeterminateRecords(),
- checked: value
- }, evnt);
- }
- },
- /**
- * 多选,选中所有事件
- */
- triggerCheckAllEvent(evnt, value) {
- const $xeTable = this;
- const {
- checkboxOpts
- } = this;
- const {
- trigger
- } = checkboxOpts;
- if (trigger === 'manual') {
- return;
- }
- if (evnt) {
- evnt.stopPropagation();
- }
- $xeTable.handleCheckAllEvent(evnt, value);
- },
- /**
- * 多选,切换所有行的选中状态
- */
- toggleAllCheckboxRow() {
- this.handleCheckAllEvent(null, !this.isAllSelected);
- return this.$nextTick();
- },
- /**
- * 用于多选行,手动清空用户的选择
- * 清空行为不管是否被禁用还是保留记录,都将彻底清空选中状态
- */
- clearCheckboxRow() {
- const $xeTable = this;
- const props = $xeTable;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- treeConfig
- } = props;
- const {
- tableFullData
- } = internalData;
- const treeOpts = $xeTable.computeTreeOpts;
- const childrenField = treeOpts.children || treeOpts.childrenField;
- const checkboxOpts = $xeTable.computeCheckboxOpts;
- const {
- checkField,
- reserve
- } = checkboxOpts;
- // indeterminateField 仅支持读取
- const indeterminateField = checkboxOpts.indeterminateField || checkboxOpts.halfField;
- if (checkField) {
- const handleClearChecked = item => {
- if (treeConfig && indeterminateField) {
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(item, indeterminateField, false);
- }
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(item, checkField, false);
- };
- if (treeConfig) {
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(tableFullData, handleClearChecked, {
- children: childrenField
- });
- } else {
- tableFullData.forEach(handleClearChecked);
- }
- }
- if (reserve) {
- tableFullData.forEach(row => this.handleCheckboxReserveRow(row, false));
- }
- reactData.isAllSelected = false;
- reactData.isIndeterminate = false;
- internalData.selectCheckboxMaps = {};
- internalData.treeIndeterminateRowMaps = {};
- reactData.updateCheckboxFlag++;
- return this.$nextTick();
- },
- /**
- * 单选,行选中事件
- */
- triggerRadioRowEvent(evnt, params) {
- const $xeTable = this;
- const reactData = $xeTable;
- const {
- selectRadioRow: oldValue
- } = reactData;
- const {
- row
- } = params;
- const radioOpts = $xeTable.computeRadioOpts;
- const {
- trigger,
- checkMethod
- } = radioOpts;
- if (trigger === 'manual') {
- return;
- }
- evnt.stopPropagation();
- if (!checkMethod || checkMethod({
- $table: $xeTable,
- row
- })) {
- let newValue = row;
- let isChange = oldValue !== newValue;
- if (isChange) {
- handleCheckedRadioRow($xeTable, newValue);
- } else if (!radioOpts.strict) {
- isChange = oldValue === newValue;
- if (isChange) {
- newValue = null;
- $xeTable.clearRadioRow();
- }
- }
- if (isChange) {
- $xeTable.dispatchEvent('radio-change', {
- oldValue,
- newValue,
- ...params
- }, evnt);
- }
- }
- },
- triggerCurrentColumnEvent(evnt, params) {
- const $xeTable = this;
- const reactData = $xeTable;
- const {
- currentColumn: oldValue
- } = reactData;
- const columnOpts = $xeTable.computeColumnOpts;
- const currentColumnOpts = $xeTable.computeCurrentColumnOpts;
- const beforeRowMethod = currentColumnOpts.beforeSelectMethod || columnOpts.currentMethod;
- const {
- column: newValue
- } = params;
- const {
- trigger
- } = currentColumnOpts;
- if (trigger === 'manual') {
- return;
- }
- const isChange = oldValue !== newValue;
- if (!beforeRowMethod || beforeRowMethod({
- column: newValue,
- $table: $xeTable
- })) {
- $xeTable.setCurrentColumn(newValue);
- if (isChange) {
- $xeTable.dispatchEvent('current-column-change', {
- oldValue,
- newValue,
- ...params
- }, evnt);
- }
- } else {
- $xeTable.dispatchEvent('current-column-disabled', params, evnt);
- }
- },
- triggerCurrentRowEvent(evnt, params) {
- const $xeTable = this;
- const reactData = $xeTable;
- const {
- currentRow: oldValue
- } = reactData;
- const rowOpts = $xeTable.computeRowOpts;
- const currentRowOpts = $xeTable.computeCurrentRowOpts;
- const beforeRowMethod = currentRowOpts.beforeSelectMethod || rowOpts.currentMethod;
- const {
- row: newValue
- } = params;
- const {
- trigger
- } = currentRowOpts;
- if (trigger === 'manual') {
- return;
- }
- const isChange = oldValue !== newValue;
- if (!beforeRowMethod || beforeRowMethod({
- row: newValue,
- $table: $xeTable
- })) {
- $xeTable.setCurrentRow(newValue);
- if (isChange) {
- $xeTable.dispatchEvent('current-row-change', {
- oldValue,
- newValue,
- ...params
- }, evnt);
- // 已废弃
- $xeTable.dispatchEvent('current-change', {
- oldValue,
- newValue,
- ...params
- }, evnt);
- }
- } else {
- $xeTable.dispatchEvent('current-row-disabled', params, evnt);
- }
- },
- /**
- * 用于当前行,设置某一行为高亮状态
- * @param {Row} row 行对象
- */
- setCurrentRow(row) {
- const $xeTable = this;
- const internalData = $xeTable;
- const $xeGanttView = internalData.xeGanttView;
- const el = $xeTable.$refs.refElem;
- const rowOpts = $xeTable.computeRowOpts;
- this.clearCurrentRow();
- // this.clearCurrentColumn()
- this.currentRow = row;
- if (rowOpts.isCurrent || this.highlightCurrentRow) {
- if (el) {
- 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'));
- }
- }
- if ($xeGanttView && $xeGanttView.handleUpdateCurrentRow) {
- $xeGanttView.handleUpdateCurrentRow(row);
- }
- return this.$nextTick();
- },
- isCheckedByRadioRow(row) {
- const $xeTable = this;
- const reactData = $xeTable;
- const {
- selectRadioRow
- } = reactData;
- if (row && selectRadioRow) {
- return $xeTable.eqRow(selectRadioRow, row);
- }
- return false;
- },
- isCheckedByRadioRowKey(key) {
- const $xeTable = this;
- const reactData = $xeTable;
- const {
- selectRadioRow
- } = reactData;
- if (selectRadioRow) {
- return key === getRowid($xeTable, selectRadioRow);
- }
- return false;
- },
- /**
- * 用于单选行,设置某一行为选中状态
- * @param {Row} row 行对象
- */
- setRadioRow(row) {
- const $xeTable = this;
- return handleCheckedRadioRow($xeTable, row, true);
- },
- /**
- * 用于单选行,设置某一行为选中状态
- * @param key 行主键
- */
- setRadioRowKey(rowid) {
- const $xeTable = this;
- const internalData = $xeTable;
- const {
- fullAllDataRowIdData
- } = internalData;
- const rowRest = fullAllDataRowIdData[rowid];
- if (rowRest) {
- return handleCheckedRadioRow($xeTable, rowRest.row, true);
- }
- return $xeTable.$nextTick();
- },
- /**
- * 用于当前行,手动清空当前高亮的状态
- */
- clearCurrentRow() {
- const $xeTable = this;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const $xeGanttView = internalData.xeGanttView;
- const el = $xeTable.$refs.refElem;
- reactData.currentRow = null;
- internalData.hoverRow = null;
- if (el) {
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayEach(el.querySelectorAll('.row--current'), elem => removeClass(elem, 'row--current'));
- }
- if ($xeGanttView && $xeGanttView.handleUpdateCurrentRow) {
- $xeGanttView.handleUpdateCurrentRow();
- }
- return $xeTable.$nextTick();
- },
- /**
- * 用于单选行,手动清空用户的选择
- */
- clearRadioRow() {
- this.selectRadioRow = null;
- return this.$nextTick();
- },
- /**
- * 用于当前行,获取当前行的数据
- */
- getCurrentRecord(isFull) {
- const $xeTable = this;
- const props = $xeTable;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- currentRow
- } = reactData;
- const {
- fullDataRowIdData,
- afterFullRowMaps
- } = internalData;
- const rowOpts = $xeTable.computeRowOpts;
- if (rowOpts.isCurrent || props.highlightCurrentRow) {
- const rowid = getRowid($xeTable, currentRow);
- if (isFull) {
- if (fullDataRowIdData[rowid]) {
- return currentRow;
- }
- } else {
- if (afterFullRowMaps[rowid]) {
- return currentRow;
- }
- }
- }
- return null;
- },
- /**
- * 用于单选行,获取当已选中的数据
- */
- getRadioRecord(isFull) {
- const {
- selectRadioRow,
- fullDataRowIdData,
- afterFullRowMaps
- } = this;
- if (selectRadioRow) {
- const rowid = getRowid(this, selectRadioRow);
- if (isFull) {
- if (fullDataRowIdData[rowid]) {
- return selectRadioRow;
- }
- } else {
- if (afterFullRowMaps[rowid]) {
- return selectRadioRow;
- }
- }
- }
- return null;
- },
- /**
- * 行 hover 事件
- */
- triggerHoverEvent(evnt, {
- row
- }) {
- this.setHoverRow(row);
- },
- setHoverRow(row) {
- const $xeTable = this;
- const internalData = $xeTable;
- const $xeGanttView = internalData.xeGanttView;
- const el = $xeTable.$refs.refElem;
- $xeTable.clearHoverRow();
- if (el) {
- 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'));
- }
- internalData.hoverRow = row;
- if ($xeGanttView && $xeGanttView.handleUpdateHoverRow) {
- $xeGanttView.handleUpdateHoverRow(row);
- }
- },
- clearHoverRow() {
- const $xeTable = this;
- const internalData = $xeTable;
- const $xeGanttView = internalData.xeGanttView;
- const el = $xeTable.$refs.refElem;
- if (el) {
- 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'));
- }
- internalData.hoverRow = null;
- if ($xeGanttView && $xeGanttView.handleUpdateHoverRow) {
- $xeGanttView.handleUpdateHoverRow();
- }
- },
- triggerHeaderCellClickEvent(evnt, params) {
- const $xeTable = this;
- const props = $xeTable;
- const internalData = $xeTable;
- const {
- _lastResizeTime
- } = internalData;
- const sortOpts = $xeTable.computeSortOpts;
- const columnOpts = $xeTable.computeColumnOpts;
- const currentColumnOpts = $xeTable.computeCurrentColumnOpts;
- const {
- column
- } = params;
- const cell = evnt.currentTarget;
- const triggerResizable = _lastResizeTime && _lastResizeTime > Date.now() - 300;
- const triggerSort = getEventTargetNode(evnt, cell, 'vxe-cell--sort').flag;
- const triggerFilter = getEventTargetNode(evnt, cell, 'vxe-cell--filter').flag;
- if (sortOpts.trigger === 'cell' && !(triggerResizable || triggerSort || triggerFilter)) {
- $xeTable.triggerSortEvent(evnt, column, getNextSortOrder($xeTable, column));
- }
- $xeTable.dispatchEvent('header-cell-click', Object.assign({
- triggerResizable,
- triggerSort,
- triggerFilter,
- cell
- }, params), evnt);
- if ((columnOpts.isCurrent || props.highlightCurrentColumn) && (!currentColumnOpts.trigger || ['header', 'default'].includes(currentColumnOpts.trigger))) {
- $xeTable.triggerCurrentColumnEvent(evnt, params);
- }
- return $xeTable.$nextTick();
- },
- triggerHeaderCellDblclickEvent(evnt, params) {
- const $xeTable = this;
- $xeTable.dispatchEvent('header-cell-dblclick', Object.assign({
- cell: evnt.currentTarget
- }, params), evnt);
- },
- getCurrentColumn() {
- return this.columnOpts.isCurrent || this.highlightCurrentColumn ? this.currentColumn : null;
- },
- /**
- * 用于当前列,设置某列行为高亮状态
- * @param {ColumnInfo} fieldOrColumn 列配置
- */
- setCurrentColumn(fieldOrColumn) {
- const $xeTable = this;
- const props = $xeTable;
- const reactData = $xeTable;
- const {
- mouseConfig
- } = props;
- const mouseOpts = $xeTable.computeMouseOpts;
- const isMouseSelected = mouseConfig && mouseOpts.selected;
- const column = handleFieldOrColumn($xeTable, fieldOrColumn);
- if (column) {
- $xeTable.clearCurrentColumn();
- reactData.currentColumn = column;
- }
- return $xeTable.$nextTick().then(() => {
- // 更新状选中态
- if (isMouseSelected) {
- $xeTable.addCellSelectedClass();
- }
- });
- },
- /**
- * 用于当前列,手动清空当前高亮的状态
- */
- clearCurrentColumn() {
- this.currentColumn = null;
- return this.$nextTick();
- },
- /**
- * 列点击事件
- * 如果是单击模式,则激活为编辑状态
- * 如果是双击模式,则单击后选中状态
- */
- triggerCellClickEvent(evnt, params) {
- const $xeTable = this;
- const props = $xeTable;
- const reactData = $xeTable;
- const {
- treeConfig,
- highlightCurrentRow,
- highlightCurrentColumn,
- editConfig,
- aggregateConfig,
- rowGroupConfig
- } = props;
- const {
- editStore,
- isDragResize,
- expandColumn,
- checkboxColumn,
- radioColumn
- } = reactData;
- if (isDragResize) {
- return;
- }
- const expandOpts = $xeTable.computeExpandOpts;
- const editOpts = $xeTable.computeEditOpts;
- const treeOpts = $xeTable.computeTreeOpts;
- const radioOpts = $xeTable.computeRadioOpts;
- const checkboxOpts = $xeTable.computeCheckboxOpts;
- const keyboardOpts = $xeTable.computeKeyboardOpts;
- const aggregateOpts = $xeTable.computeAggregateOpts;
- const rowOpts = $xeTable.computeRowOpts;
- const columnOpts = $xeTable.computeColumnOpts;
- const currentColumnOpts = $xeTable.computeCurrentColumnOpts;
- const {
- actived,
- focused
- } = editStore;
- const {
- row,
- column
- } = params;
- const {
- type,
- treeNode,
- rowGroupNode
- } = column;
- const isRadioType = type === 'radio';
- const isCheckboxType = type === 'checkbox';
- const isExpandType = type === 'expand';
- const cell = evnt.currentTarget;
- const triggerRadio = isRadioType && getEventTargetNode(evnt, cell, 'vxe-cell--radio').flag;
- const triggerCheckbox = isCheckboxType && getEventTargetNode(evnt, cell, 'vxe-cell--checkbox').flag;
- const triggerTreeNode = treeNode && getEventTargetNode(evnt, cell, 'vxe-cell--tree-btn').flag;
- const triggerExpandNode = isExpandType && getEventTargetNode(evnt, cell, 'vxe-table--expanded').flag;
- const triggerRowGroupNode = isExpandType && getEventTargetNode(evnt, cell, 'vxe-row-group--node-btn').flag;
- params = Object.assign({
- cell,
- triggerRadio,
- triggerCheckbox,
- triggerTreeNode,
- triggerExpandNode
- }, params);
- if (!triggerCheckbox && !triggerRadio) {
- // 如果是展开行
- if (!triggerExpandNode && (expandColumn && expandOpts.trigger === 'row' || isExpandType && expandOpts.trigger === 'cell')) {
- $xeTable.triggerRowExpandEvent(evnt, params);
- }
- // 如果是树形表格
- if (treeConfig && (treeOpts.trigger === 'row' || treeNode && treeOpts.trigger === 'cell')) {
- $xeTable.triggerTreeExpandEvent(evnt, params);
- }
- // 如果是行分组
- if ((aggregateConfig || rowGroupConfig) && (aggregateOpts.trigger === 'row' || rowGroupNode && aggregateOpts.trigger === 'cell')) {
- $xeTable.triggerRowGroupExpandEvent(evnt, params);
- }
- }
- // 如果点击了树节点
- if (!triggerTreeNode) {
- if (!triggerExpandNode && !triggerRowGroupNode) {
- // 如果是当前行
- if (rowOpts.isCurrent || highlightCurrentRow) {
- if (!triggerCheckbox && !triggerRadio) {
- $xeTable.triggerCurrentRowEvent(evnt, params);
- }
- }
- // 如果是当前列
- if ((columnOpts.isCurrent || highlightCurrentColumn) && (!currentColumnOpts.trigger || ['cell', 'default'].includes(currentColumnOpts.trigger))) {
- if (!triggerCheckbox && !triggerRadio) {
- $xeTable.triggerCurrentColumnEvent(evnt, params);
- }
- }
- // 如果是单选框
- if (!triggerRadio && (radioColumn && radioOpts.trigger === 'row' || isRadioType && radioOpts.trigger === 'cell')) {
- $xeTable.triggerRadioRowEvent(evnt, params);
- }
- // 如果是复选框
- if (!triggerCheckbox && (checkboxColumn && checkboxOpts.trigger === 'row' || isCheckboxType && checkboxOpts.trigger === 'cell')) {
- $xeTable.handleToggleCheckRowEvent(evnt, params);
- }
- }
- // 如果设置了单元格选中功能,则不会使用点击事件去处理(只能支持双击模式)
- if (isEnableConf(editConfig)) {
- // 记录点击输入框聚焦状态
- if (keyboardOpts.arrowCursorLock && evnt && editOpts.mode === 'cell' && evnt.target && /^input|textarea$/i.test(evnt.target.tagName)) {
- focused.column = column;
- focused.row = row;
- }
- if (editOpts.trigger === 'manual') {
- if (actived.args && actived.row === row && column !== actived.column) {
- handleChangeCell($xeTable, evnt, params);
- }
- } else if (!actived.args || row !== actived.row || column !== actived.column) {
- if (editOpts.trigger === 'click') {
- handleChangeCell($xeTable, evnt, params);
- } else if (editOpts.trigger === 'dblclick') {
- if (editOpts.mode === 'row' && actived.row === row) {
- handleChangeCell($xeTable, evnt, params);
- }
- }
- }
- }
- }
- // 如果是双击编辑模式
- if (isEnableConf(editConfig) && editOpts.trigger === 'dblclick') {
- if (actived.row && actived.column) {
- if (editOpts.mode === 'row') {
- if (!$xeTable.eqRow(actived.row, row)) {
- $xeTable.handleClearEdit(evnt);
- }
- } else if (editOpts.mode === 'cell') {
- if (!$xeTable.eqRow(actived.row, row) || actived.column.id !== column.id) {
- $xeTable.handleClearEdit(evnt);
- }
- }
- }
- }
- $xeTable.dispatchEvent('cell-click', params, evnt);
- },
- /**
- * 列双击点击事件
- * 如果是双击模式,则激活为编辑状态
- */
- triggerCellDblclickEvent(evnt, params) {
- const $xeTable = this;
- const props = $xeTable;
- const reactData = $xeTable;
- const {
- editConfig
- } = props;
- const {
- editStore,
- isDragResize
- } = reactData;
- if (isDragResize) {
- return;
- }
- const editOpts = $xeTable.computeEditOpts;
- const {
- actived
- } = editStore;
- const cell = evnt.currentTarget;
- params = Object.assign({
- cell
- }, params);
- if (isEnableConf(editConfig) && editOpts.trigger === 'dblclick') {
- if (!actived.args || evnt.currentTarget !== actived.args.cell) {
- if (editOpts.mode === 'row') {
- checkValidate($xeTable, 'blur').catch(e => e).then(() => {
- $xeTable.handleEdit(params, evnt).then(() => checkValidate($xeTable, 'change')).catch(e => e);
- });
- } else if (editOpts.mode === 'cell') {
- $xeTable.handleEdit(params, evnt).then(() => checkValidate($xeTable, 'change')).catch(e => e);
- }
- }
- }
- $xeTable.dispatchEvent('cell-dblclick', params, evnt);
- },
- handleColumnSortEvent(evnt, column) {
- const $xeTable = this;
- const props = $xeTable;
- const {
- mouseConfig
- } = props;
- const mouseOpts = $xeTable.computeMouseOpts;
- const {
- field,
- sortable,
- order
- } = column;
- if (sortable) {
- const params = {
- $table: $xeTable,
- $event: evnt,
- column,
- field,
- property: field,
- order,
- sortList: $xeTable.getSortColumns(),
- sortTime: column.sortTime
- };
- if (mouseConfig && mouseOpts.area && $xeTable.handleSortEvent) {
- $xeTable.handleSortEvent(evnt, params);
- }
- if (!order) {
- $xeTable.dispatchEvent('clear-sort', params, evnt);
- }
- $xeTable.dispatchEvent('sort-change', params, evnt);
- }
- },
- /**
- * 点击排序事件
- */
- triggerSortEvent(evnt, column, order) {
- const $xeTable = this;
- const sortOpts = $xeTable.computeSortOpts;
- const {
- multiple,
- allowClear
- } = sortOpts;
- const {
- field,
- sortable
- } = column;
- if (sortable || column.remoteSort) {
- if (!order || column.order === order) {
- if (allowClear) {
- $xeTable.clearSort(multiple ? column : null);
- }
- } else {
- $xeTable.sort({
- field,
- order
- });
- }
- $xeTable.handleColumnSortEvent(evnt, column);
- }
- },
- handleCellRuleUpdateStatus(type, cellParams, cellValue) {
- const $xeTable = this;
- const reactData = $xeTable;
- const {
- validStore
- } = reactData;
- const {
- row,
- column
- } = cellParams;
- if ($xeTable.hasCellRules) {
- if ($xeTable.hasCellRules(type, row, column)) {
- const cell = $xeTable.getCellElement(row, column);
- if (cell) {
- const customVal = !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isUndefined(cellValue);
- return $xeTable.validCellRules(type, row, column, cellValue).then(() => {
- if (customVal && validStore.visible) {
- setCellValue(row, column, cellValue);
- }
- $xeTable.clearValidate(row, column);
- }).catch(({
- rule
- }) => {
- if (customVal) {
- setCellValue(row, column, cellValue);
- }
- $xeTable.showValidTooltip({
- rule,
- row,
- column,
- cell
- });
- });
- }
- }
- }
- return $xeTable.$nextTick();
- },
- /**
- * 表头单元格按下事件
- */
- triggerHeaderCellMousedownEvent(evnt, params) {
- const $xeTable = this;
- const props = $xeTable;
- const {
- mouseConfig
- } = props;
- const mouseOpts = $xeTable.computeMouseOpts;
- const columnOpts = $xeTable.computeColumnOpts;
- const columnDragOpts = $xeTable.computeColumnDragOpts;
- const {
- trigger,
- isCrossDrag,
- isPeerDrag,
- disabledMethod
- } = columnDragOpts;
- const cell = evnt.currentTarget;
- const triggerInput = cell && cell.tagName && cell.tagName.toLowerCase() === 'input';
- const triggerCheckbox = getEventTargetNode(evnt, cell, 'vxe-cell--checkbox').flag;
- const triggerSort = getEventTargetNode(evnt, cell, 'vxe-cell--sort').flag;
- const triggerFilter = getEventTargetNode(evnt, cell, 'vxe-cell--filter').flag;
- let triggerDrag = false;
- const isColDragCell = columnOpts.drag && trigger === 'cell';
- if (!(triggerInput || triggerCheckbox || triggerSort || triggerFilter)) {
- const {
- column
- } = params;
- if (isColDragCell && !column.fixed && (isCrossDrag || isPeerDrag || !column.parentId) && !(disabledMethod && disabledMethod(params))) {
- triggerDrag = true;
- $xeTable.handleHeaderCellDragMousedownEvent(evnt, params);
- }
- }
- if (!triggerDrag && mouseConfig && mouseOpts.area && $xeTable.handleHeaderCellAreaMouseDnEvent) {
- $xeTable.handleHeaderCellAreaMouseDnEvent(evnt, Object.assign({
- cell,
- triggerSort,
- triggerFilter
- }, params));
- }
- $xeTable.focus();
- if ($xeTable.closeMenu) {
- $xeTable.closeMenu();
- }
- },
- /**
- * 单元格按下事件
- */
- triggerCellMousedownEvent(evnt, params) {
- const $xeTable = this;
- const {
- column
- } = params;
- const {
- type,
- treeNode
- } = column;
- const isRadioType = type === 'radio';
- const isCheckboxType = type === 'checkbox';
- const isExpandType = type === 'expand';
- const rowOpts = $xeTable.computeRowOpts;
- const rowDragOpts = $xeTable.computeRowDragOpts;
- const {
- trigger,
- isCrossDrag,
- isPeerDrag,
- disabledMethod
- } = rowDragOpts;
- const cell = evnt.currentTarget;
- params.cell = cell;
- const triggerInput = cell && cell.tagName && cell.tagName.toLowerCase() === 'input';
- const triggerRadio = isRadioType && getEventTargetNode(evnt, cell, 'vxe-cell--radio').flag;
- const triggerCheckbox = isCheckboxType && getEventTargetNode(evnt, cell, 'vxe-cell--checkbox').flag;
- const triggerTreeNode = treeNode && getEventTargetNode(evnt, cell, 'vxe-cell--tree-btn').flag;
- const triggerExpandNode = isExpandType && getEventTargetNode(evnt, cell, 'vxe-table--expanded').flag;
- let isColDragCell = false;
- if (rowOpts.drag) {
- isColDragCell = trigger === 'row' || column.dragSort && trigger === 'cell';
- }
- let triggerDrag = false;
- if (!(triggerInput || triggerRadio || triggerCheckbox || triggerTreeNode || triggerExpandNode)) {
- if (isColDragCell && (isCrossDrag || isPeerDrag || !params.level) && !(disabledMethod && disabledMethod(params))) {
- triggerDrag = true;
- $xeTable.handleCellDragMousedownEvent(evnt, params);
- }
- }
- if (!triggerDrag && $xeTable.handleCellMousedownEvent) {
- $xeTable.handleCellMousedownEvent(evnt, params);
- }
- $xeTable.focus();
- $xeTable.closeFilter();
- if ($xeTable.closeMenu) {
- $xeTable.closeMenu();
- }
- },
- triggerCellMouseupEvent() {
- const $xeTable = this;
- clearDragStatus($xeTable);
- },
- /**
- * 行拖拽
- */
- handleRowDragDragstartEvent(evnt) {
- if (evnt.dataTransfer) {
- evnt.dataTransfer.setDragImage(getTpImg(), 0, 0);
- }
- },
- handleRowDragSwapEvent(evnt, isSyncRow, dragRow, prevDragRow, prevDragPos, prevDragToChild) {
- const $xeTable = this;
- const $xeGantt = $xeTable.$xeGantt;
- const props = $xeTable;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- treeConfig,
- dragConfig
- } = props;
- const rowDragOpts = $xeTable.computeRowDragOpts;
- const {
- afterFullData,
- tableFullData,
- fullAllDataRowIdData
- } = internalData;
- const {
- animation,
- isPeerDrag,
- isCrossDrag,
- isSelfToChildDrag,
- dragEndMethod,
- dragToChildMethod
- } = rowDragOpts;
- const treeOpts = $xeTable.computeTreeOpts;
- const cellOpts = $xeTable.computeCellOpts;
- const rowOpts = $xeTable.computeRowOpts;
- const defaultRowHeight = $xeTable.computeDefaultRowHeight;
- const {
- transform,
- rowField,
- mapChildrenField,
- parentField
- } = treeOpts;
- const childrenField = treeOpts.children || treeOpts.childrenField;
- const dEndMethod = dragEndMethod || (dragConfig ? dragConfig.dragEndMethod : null);
- const dragOffsetIndex = prevDragPos === 'bottom' ? 1 : 0;
- const el = $xeTable.$refs.refElem;
- const errRest = {
- status: false
- };
- if (!(el && prevDragRow && dragRow)) {
- return Promise.resolve(errRest);
- }
- // 判断是否有拖动
- if (prevDragRow !== dragRow) {
- const dragParams = {
- oldRow: dragRow,
- newRow: prevDragRow,
- dragRow,
- dragPos: prevDragPos,
- dragToChild: !!prevDragToChild,
- offsetIndex: dragOffsetIndex
- };
- const isDragToChildFlag = isSelfToChildDrag && dragToChildMethod ? dragToChildMethod(dragParams) : prevDragToChild;
- return Promise.resolve(dEndMethod ? dEndMethod(dragParams) : true).then(status => {
- if (!status) {
- return errRest;
- }
- const dragRowid = getRowid($xeTable, dragRow);
- const dragRowRest = fullAllDataRowIdData[dragRowid] || {};
- const _dragRowIndex = dragRowRest._index;
- let dragRowHeight = 0;
- let dragOffsetTop = -1;
- if (animation) {
- dragRowHeight = getCellRestHeight(dragRowRest, cellOpts, rowOpts, defaultRowHeight);
- const oldTrEl = el.querySelector(`.vxe-body--row[rowid="${dragRowid}"]`);
- if (oldTrEl) {
- dragOffsetTop = oldTrEl.offsetTop;
- }
- }
- let oafIndex = -1;
- let nafIndex = -1;
- // 如果为树结构
- if (treeConfig) {
- if (transform) {
- // 移出源位置
- const oldRest = dragRowRest;
- const newRowid = getRowid($xeTable, prevDragRow);
- const newRest = fullAllDataRowIdData[newRowid];
- if (oldRest && newRest) {
- const {
- level: oldLevel
- } = oldRest;
- const {
- level: newLevel
- } = newRest;
- const oldAllMaps = {};
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree([dragRow], item => {
- oldAllMaps[getRowid($xeTable, item)] = item;
- }, {
- children: mapChildrenField
- });
- let isSelfToChildStatus = false;
- if (oldLevel && newLevel) {
- // 子到子
- if (isPeerDrag && !isCrossDrag) {
- if (oldRest.row[parentField] !== newRest.row[parentField]) {
- // 非同级
- return errRest;
- }
- } else {
- if (!isCrossDrag) {
- return errRest;
- }
- if (oldAllMaps[newRowid]) {
- isSelfToChildStatus = true;
- if (!(isCrossDrag && isSelfToChildDrag)) {
- if (core_.VxeUI.modal) {
- core_.VxeUI.modal.message({
- status: 'error',
- content: methods_getI18n('vxe.error.treeDragChild')
- });
- }
- return errRest;
- }
- }
- }
- } else if (oldLevel) {
- // 子到根
- if (!isCrossDrag) {
- return errRest;
- }
- } else if (newLevel) {
- // 根到子
- if (!isCrossDrag) {
- return errRest;
- }
- if (oldAllMaps[newRowid]) {
- isSelfToChildStatus = true;
- if (!(isCrossDrag && isSelfToChildDrag)) {
- if (core_.VxeUI.modal) {
- core_.VxeUI.modal.message({
- status: 'error',
- content: methods_getI18n('vxe.error.treeDragChild')
- });
- }
- return errRest;
- }
- }
- } else {
- // 根到根
- }
- const fullList = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toTreeArray(internalData.afterTreeFullData, {
- key: rowField,
- parentKey: parentField,
- children: mapChildrenField
- });
- // 移出
- const otfIndex = $xeTable.findRowIndexOf(fullList, dragRow);
- fullList.splice(otfIndex, 1);
- // 插入
- const ptfIndex = $xeTable.findRowIndexOf(fullList, prevDragRow);
- const ntfIndex = ptfIndex + dragOffsetIndex;
- fullList.splice(ntfIndex, 0, dragRow);
- // 改变层级
- if (isSelfToChildStatus && isCrossDrag && isSelfToChildDrag) {
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(dragRow[childrenField], childRow => {
- childRow[parentField] = dragRow[parentField];
- });
- }
- dragRow[parentField] = isDragToChildFlag ? prevDragRow[rowField] : prevDragRow[parentField];
- internalData.tableFullTreeData = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toArrayTree(fullList, {
- key: rowField,
- parentKey: parentField,
- children: childrenField,
- mapChildren: mapChildrenField
- });
- }
- }
- } else {
- // 移出
- oafIndex = $xeTable.findRowIndexOf(afterFullData, dragRow);
- const otfIndex = $xeTable.findRowIndexOf(tableFullData, dragRow);
- afterFullData.splice(oafIndex, 1);
- tableFullData.splice(otfIndex, 1);
- // 插入
- const pafIndex = $xeTable.findRowIndexOf(afterFullData, prevDragRow);
- const ptfIndex = $xeTable.findRowIndexOf(tableFullData, prevDragRow);
- nafIndex = pafIndex + dragOffsetIndex;
- const ntfIndex = ptfIndex + dragOffsetIndex;
- afterFullData.splice(nafIndex, 0, dragRow);
- tableFullData.splice(ntfIndex, 0, dragRow);
- }
- $xeTable.handleTableData(treeConfig && transform);
- $xeTable.cacheRowMap(false);
- updateScrollYStatus($xeTable);
- if (!(treeConfig && transform)) {
- updateAfterDataIndex($xeTable);
- }
- $xeTable.checkSelectionStatus();
- if (reactData.scrollYLoad) {
- $xeTable.updateScrollYSpace();
- }
- if (evnt) {
- $xeTable.dispatchEvent('row-dragend', {
- oldRow: dragRow,
- newRow: prevDragRow,
- dragRow,
- dragPos: prevDragPos,
- dragToChild: isDragToChildFlag,
- offsetIndex: dragOffsetIndex,
- _index: {
- newIndex: nafIndex,
- oldIndex: oafIndex
- }
- }, evnt);
- }
- return $xeTable.$nextTick().then(() => {
- if (animation) {
- const {
- tableData
- } = reactData;
- const dragRowRest = fullAllDataRowIdData[dragRowid];
- const _newRowIndex = dragRowRest._index;
- const firstRow = tableData[0];
- const firstRowRest = fullAllDataRowIdData[getRowid($xeTable, firstRow)];
- let wrapperEl = el;
- if ($xeGantt) {
- const ganttContainerElem = $xeGantt.$refs.refGanttContainerElem;
- if (ganttContainerElem) {
- wrapperEl = ganttContainerElem;
- }
- }
- if (firstRowRest) {
- const _firstRowIndex = firstRowRest._index;
- const _lastRowIndex = _firstRowIndex + tableData.length;
- let rsIndex = -1;
- let reIndex = -1;
- let offsetRate = 1;
- if (_dragRowIndex < _firstRowIndex) {
- // 从上往下虚拟拖拽
- rsIndex = 0;
- reIndex = _newRowIndex - _firstRowIndex;
- } else if (_dragRowIndex > _lastRowIndex) {
- // 从下往上虚拟拖拽
- const $newRowIndex = dragRowRest.$index;
- rsIndex = $newRowIndex + 1;
- reIndex = tableData.length;
- offsetRate = -1;
- } else {
- if (_newRowIndex > _dragRowIndex) {
- // 从上往下拖拽
- rsIndex = _dragRowIndex - _firstRowIndex;
- reIndex = rsIndex + _newRowIndex - _dragRowIndex;
- } else {
- // 从下往上拖拽
- rsIndex = _newRowIndex - _firstRowIndex;
- reIndex = rsIndex + _dragRowIndex - _newRowIndex + 1;
- offsetRate = -1;
- }
- }
- const dragRangeList = tableData.slice(rsIndex, reIndex);
- if (dragRangeList.length) {
- const dtClss = [];
- dragRangeList.forEach(row => {
- const rowid = getRowid($xeTable, row);
- dtClss.push(`.vxe-body--row[rowid="${rowid}"]`);
- if ($xeGantt) {
- dtClss.push(`.vxe-gantt-view--body-row[rowid="${rowid}"]`, `.vxe-gantt-view--chart-row[rowid="${rowid}"]`);
- }
- });
- const dtTrList = wrapperEl.querySelectorAll(dtClss.join(','));
- moveRowAnimateToTb(dtTrList, offsetRate * dragRowHeight);
- }
- }
- const drClss = [`.vxe-body--row[rowid="${dragRowid}"]`];
- if ($xeGantt) {
- drClss.push(`.vxe-gantt-view--body-row[rowid="${dragRowid}"]`, `.vxe-gantt-view--chart-row[rowid="${dragRowid}"]`);
- }
- const newDtTrList = wrapperEl.querySelectorAll(drClss.join(','));
- const newTrEl = newDtTrList[0];
- if (dragOffsetTop > -1 && newTrEl) {
- moveRowAnimateToTb(newDtTrList, dragOffsetTop - newTrEl.offsetTop);
- }
- }
- updateRowOffsetTop($xeTable);
- updateRowExpandStyle($xeTable);
- $xeTable.updateCellAreas();
- $xeTable.recalculate();
- }).then(() => {
- return {
- status: true
- };
- });
- }).catch(() => {
- return errRest;
- });
- }
- return Promise.resolve(errRest);
- },
- /**
- * 处理跨表拖拽完成
- */
- handleCrossTableRowDragFinishEvent(evnt) {
- const $xeTable = this;
- const $xeGantt = $xeTable.$xeGantt;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const crossTableDragRowInfo = getCrossTableDragRowInfo($xeTable);
- const {
- tableData
- } = reactData;
- const {
- fullAllDataRowIdData
- } = internalData;
- const rowOpts = $xeTable.computeRowOpts;
- const cellOpts = $xeTable.computeCellOpts;
- const defaultRowHeight = $xeTable.computeDefaultRowHeight;
- const rowDragOpts = $xeTable.computeRowDragOpts;
- const {
- animation,
- isCrossTableDrag
- } = rowDragOpts;
- const treeOpts = $xeTable.computeTreeOpts;
- const {
- mapChildrenField
- } = treeOpts;
- const el = $xeTable.$refs.refElem;
- if (isCrossTableDrag && crossTableDragRowObj && crossTableDragRowInfo) {
- const {
- row: dragRow
- } = crossTableDragRowInfo;
- if (dragRow) {
- const dragRowid = getRowid($xeTable, dragRow);
- const dragRowRest = fullAllDataRowIdData[dragRowid];
- let dragRowHeight = 0;
- let rsIndex = -1;
- if (dragRowRest) {
- if (animation) {
- dragRowHeight = getCellRestHeight(dragRowRest, cellOpts, rowOpts, defaultRowHeight);
- }
- rsIndex = dragRowRest.$index;
- }
- const dragRangeList = rsIndex > -1 && rsIndex < tableData.length - 1 ? tableData.slice(rsIndex + 1) : [];
- const dragList = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toTreeArray([dragRow], {
- updated: true,
- children: mapChildrenField
- });
- $xeTable.remove(dragList).then(() => {
- if (animation && dragRowHeight && dragRangeList.length) {
- const $xeGanttView = internalData.xeGanttView;
- let wrapperEl = el;
- if ($xeGantt && $xeGanttView) {
- const ganttContainerElem = $xeGantt.$refs.refGanttContainerElem;
- if (ganttContainerElem) {
- wrapperEl = ganttContainerElem;
- }
- }
- const dtClss = [];
- dragRangeList.forEach(row => {
- const rowid = getRowid($xeTable, row);
- dtClss.push(`.vxe-body--row[rowid="${rowid}"]`);
- if ($xeGantt) {
- dtClss.push(`.vxe-gantt-view--body-row[rowid="${rowid}"]`, `.vxe-gantt-view--chart-row[rowid="${rowid}"]`);
- }
- });
- const dtTrList = wrapperEl.querySelectorAll(dtClss.join(','));
- moveRowAnimateToTb(dtTrList, dragRowHeight);
- }
- });
- $xeTable.dispatchEvent('row-remove-dragend', {
- row: dragRow
- }, evnt);
- clearRowDragData($xeTable);
- clearCrossTableDragStatus($xeTable);
- }
- }
- },
- /**
- * 处理跨表拖至新的空表
- */
- handleCrossTableRowDragoverEmptyEvent(evnt) {
- const $xeTable = this;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- tableData
- } = reactData;
- const rowDragOpts = $xeTable.computeRowDragOpts;
- const {
- isCrossTableDrag
- } = rowDragOpts;
- if (isCrossTableDrag && crossTableDragRowObj && !tableData.length) {
- const {
- $oldTable,
- $newTable
- } = crossTableDragRowObj;
- if ($oldTable) {
- const oldTableReactData = $oldTable;
- if ($oldTable.xID !== $xeTable.xID) {
- if ($newTable && $newTable.xID !== $xeTable.xID) {
- $newTable.hideCrossTableRowDropClearStatus();
- }
- evnt.preventDefault();
- $oldTable.hideCrossTableRowDropClearStatus();
- crossTableDragRowObj.$newTable = $xeTable;
- internalData.prevDragRow = null;
- reactData.dragTipText = oldTableReactData.dragTipText;
- showDropTip($xeTable, evnt, evnt.currentTarget, null, true, '');
- }
- }
- }
- },
- /**
- * 处理跨表拖插入
- */
- handleCrossTableRowDragInsertEvent(evnt) {
- const $xeTable = this;
- const $xeGantt = $xeTable.$xeGantt;
- const props = $xeTable;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const crossTableDragRowInfo = getCrossTableDragRowInfo($xeTable);
- const {
- treeConfig
- } = props;
- const {
- prevDragRow,
- prevDragPos,
- prevDragToChild
- } = internalData;
- const rowDragOpts = $xeTable.computeRowDragOpts;
- const {
- animation,
- isSelfToChildDrag,
- isCrossTableDrag,
- dragEndMethod,
- dragToChildMethod
- } = rowDragOpts;
- const rowOpts = $xeTable.computeRowOpts;
- const cellOpts = $xeTable.computeCellOpts;
- const defaultRowHeight = $xeTable.computeDefaultRowHeight;
- const treeOpts = $xeTable.computeTreeOpts;
- const {
- parentField,
- mapChildrenField
- } = treeOpts;
- const childrenField = treeOpts.children || treeOpts.childrenField;
- // 跨表拖拽
- if (isCrossTableDrag && crossTableDragRowObj && crossTableDragRowInfo) {
- const {
- row: oldRow
- } = crossTableDragRowInfo;
- const {
- $oldTable
- } = crossTableDragRowObj;
- const el = $xeTable.$refs.refElem;
- if ($oldTable && oldRow) {
- const dragRow = oldRow;
- let dragOffsetIndex = -1;
- if (prevDragRow) {
- dragOffsetIndex = prevDragPos === 'bottom' ? 1 : 0;
- }
- const dragParams = {
- oldRow: dragRow,
- newRow: prevDragRow,
- dragRow,
- dragPos: prevDragPos,
- dragToChild: !!prevDragToChild,
- offsetIndex: dragOffsetIndex
- };
- const isDragToChildFlag = isSelfToChildDrag && dragToChildMethod ? dragToChildMethod(dragParams) : prevDragToChild;
- const errRest = {
- status: false
- };
- Promise.resolve(dragEndMethod ? dragEndMethod(dragParams) : true).then(status => {
- if (!status) {
- return errRest;
- }
- let insertRest = Promise.resolve();
- if (treeConfig) {
- const dragList = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toTreeArray([dragRow], {
- updated: true,
- children: mapChildrenField
- });
- $oldTable.handleCrossTableRowDragFinishEvent(evnt);
- if (prevDragRow) {
- dragRow[parentField] = prevDragRow[parentField];
- } else {
- dragRow[parentField] = null;
- }
- dragList.forEach(row => {
- row[childrenField] = undefined;
- row[mapChildrenField] = undefined;
- });
- if (prevDragRow) {
- if (prevDragPos === 'bottom') {
- insertRest = $xeTable.insertNextAt(dragList, prevDragRow);
- } else {
- insertRest = $xeTable.insertAt(dragList, prevDragRow);
- }
- } else {
- insertRest = $xeTable.insert(dragList);
- }
- } else {
- $oldTable.handleCrossTableRowDragFinishEvent(evnt);
- if (prevDragRow) {
- if (prevDragPos === 'bottom') {
- insertRest = $xeTable.insertNextAt(dragRow, prevDragRow);
- } else {
- insertRest = $xeTable.insertAt(dragRow, prevDragRow);
- }
- } else {
- insertRest = $xeTable.insert(dragRow);
- }
- }
- $xeTable.dispatchEvent('row-insert-dragend', {
- oldRow,
- newRow: prevDragRow,
- dragRow,
- dragPos: prevDragPos,
- dragToChild: isDragToChildFlag,
- offsetIndex: dragOffsetIndex
- }, evnt);
- clearRowDragData($xeTable);
- insertRest.then(() => {
- const {
- tableData
- } = reactData;
- const {
- fullAllDataRowIdData
- } = internalData;
- const oldRowid = getRowid($xeTable, dragRow);
- const oldRowRest = fullAllDataRowIdData[oldRowid];
- let dragRowHeight = 0;
- let rsIndex = -1;
- if (oldRowRest) {
- if (animation) {
- dragRowHeight = getCellRestHeight(oldRowRest, cellOpts, rowOpts, defaultRowHeight);
- }
- rsIndex = oldRowRest.$index;
- }
- const dragRangeList = rsIndex > -1 ? tableData.slice(rsIndex) : [];
- if (animation && dragRowHeight && dragRangeList.length) {
- const $xeGanttView = internalData.xeGanttView;
- let wrapperEl = el;
- if ($xeGantt && $xeGanttView) {
- const ganttContainerElem = $xeGantt.$refs.refGanttContainerElem;
- if (ganttContainerElem) {
- wrapperEl = ganttContainerElem;
- }
- }
- const dtClss = [];
- dragRangeList.forEach(row => {
- const rowid = getRowid($xeTable, row);
- dtClss.push(`.vxe-body--row[rowid="${rowid}"]`);
- if ($xeGantt) {
- dtClss.push(`.vxe-gantt-view--body-row[rowid="${rowid}"]`, `.vxe-gantt-view--chart-row[rowid="${rowid}"]`);
- }
- });
- const dtTrList = wrapperEl.querySelectorAll(dtClss.join(','));
- moveRowAnimateToTb(dtTrList, -dragRowHeight);
- }
- });
- });
- }
- }
- },
- hideCrossTableRowDropClearStatus() {
- const $xeTable = this;
- hideDropTip($xeTable);
- },
- handleRowDragDragendEvent(evnt) {
- const $xeTable = this;
- const props = $xeTable;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- treeConfig
- } = props;
- const {
- fullAllDataRowIdData,
- prevDragToChild
- } = internalData;
- const {
- dragRow
- } = reactData;
- const treeOpts = $xeTable.computeTreeOpts;
- const {
- lazy
- } = treeOpts;
- const hasChildField = treeOpts.hasChild || treeOpts.hasChildField;
- const {
- prevDragRow,
- prevDragPos
- } = internalData;
- const rowDragOpts = $xeTable.computeRowDragOpts;
- const {
- isCrossTableDrag,
- isCrossDrag
- } = rowDragOpts;
- // 跨表拖拽
- if (isCrossTableDrag && crossTableDragRowObj) {
- const {
- $newTable
- } = crossTableDragRowObj;
- if ($newTable && $newTable.xID !== $xeTable.xID) {
- if (!treeConfig || isCrossDrag) {
- $newTable.handleCrossTableRowDragInsertEvent(evnt);
- }
- return;
- }
- }
- if (treeConfig && lazy && prevDragToChild) {
- // 懒加载
- const newRowid = getRowid($xeTable, prevDragRow);
- const rowRest = fullAllDataRowIdData[newRowid];
- if (prevDragRow[hasChildField]) {
- if (rowRest && rowRest.treeLoaded) {
- $xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild);
- }
- } else {
- $xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild);
- }
- } else {
- $xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild);
- }
- clearRowDragData($xeTable);
- clearCrossTableDragStatus($xeTable);
- },
- handleRowDragDragoverEvent(evnt) {
- const $xeTable = this;
- const props = $xeTable;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- treeConfig
- } = props;
- const {
- fullAllDataRowIdData
- } = internalData;
- const {
- dragRow
- } = reactData;
- const treeOpts = $xeTable.computeTreeOpts;
- const {
- lazy,
- transform,
- parentField
- } = treeOpts;
- const hasChildField = treeOpts.hasChild || treeOpts.hasChildField;
- const rowDragOpts = $xeTable.computeRowDragOpts;
- const {
- isPeerDrag,
- isCrossDrag,
- isToChildDrag,
- isCrossTableDrag
- } = rowDragOpts;
- if (!dragRow && !(isCrossTableDrag && (!treeConfig || isCrossDrag) && crossTableDragRowObj)) {
- evnt.preventDefault();
- return;
- }
- const isControlKey = hasControlKey(evnt);
- const trEl = evnt.currentTarget;
- const rowid = trEl.getAttribute('rowid') || '';
- const rest = fullAllDataRowIdData[rowid];
- if (rest) {
- evnt.preventDefault();
- const row = rest.row;
- const rowid = getRowid($xeTable, row);
- const rowRest = fullAllDataRowIdData[rowid];
- const offsetY = evnt.clientY - trEl.getBoundingClientRect().y;
- const dragPos = offsetY < trEl.clientHeight / 2 ? 'top' : 'bottom';
- internalData.prevDragToChild = !!(treeConfig && transform && isCrossDrag && isToChildDrag && isControlKey);
- internalData.prevDragRow = row;
- internalData.prevDragPos = dragPos;
- // 跨表拖拽
- if (isCrossTableDrag && (!treeConfig || isCrossDrag) && crossTableDragRowObj) {
- const {
- $oldTable,
- $newTable
- } = crossTableDragRowObj;
- if ($oldTable) {
- const oldTableReactData = $oldTable;
- if ($oldTable.xID === $xeTable.xID) {
- if ($newTable) {
- $newTable.hideCrossTableRowDropClearStatus();
- }
- reactData.isCrossDragRow = false;
- oldTableReactData.isCrossDragRow = false;
- crossTableDragRowObj.$newTable = null;
- } else if (!treeConfig || isCrossDrag) {
- if ($newTable && $newTable.xID !== $xeTable.xID) {
- $newTable.hideCrossTableRowDropClearStatus();
- }
- $oldTable.hideCrossTableRowDropClearStatus();
- oldTableReactData.isCrossDragRow = true;
- reactData.dragTipText = oldTableReactData.dragTipText;
- crossTableDragRowObj.$newTable = $xeTable;
- showDropTip($xeTable, evnt, trEl, null, true, dragPos);
- return;
- }
- }
- }
- if ($xeTable.eqRow(dragRow, row) || isControlKey && treeConfig && lazy && row[hasChildField] && rowRest && !rowRest.treeLoaded || !isCrossDrag && treeConfig && transform && (isPeerDrag ? dragRow[parentField] !== row[parentField] : rest.level)) {
- showDropTip($xeTable, evnt, trEl, null, false, dragPos);
- return;
- }
- showDropTip($xeTable, evnt, trEl, null, true, dragPos);
- $xeTable.dispatchEvent('row-dragover', {
- oldRow: dragRow,
- targetRow: row,
- dragPos
- }, evnt);
- }
- },
- handleCellDragMousedownEvent(evnt, params) {
- const $xeTable = this;
- const props = $xeTable;
- const reactData = $xeTable;
- const crossTableDragRowInfo = getCrossTableDragRowInfo($xeTable);
- evnt.stopPropagation();
- const {
- dragConfig
- } = props;
- const rowDragOpts = $xeTable.computeRowDragOpts;
- const {
- isCrossTableDrag,
- trigger,
- dragStartMethod
- } = rowDragOpts;
- const {
- row
- } = params;
- const dragEl = evnt.currentTarget;
- const tdEl = trigger === 'cell' || trigger === 'row' ? dragEl : dragEl.parentElement?.parentElement;
- const trEl = tdEl.parentElement;
- const dStartMethod = dragStartMethod || (dragConfig ? dragConfig.dragStartMethod : null);
- clearRowDropOrigin($xeTable);
- if (dStartMethod && !dStartMethod(params)) {
- trEl.draggable = false;
- reactData.dragRow = null;
- reactData.dragCol = null;
- clearCrossTableDragStatus($xeTable);
- hideDropTip($xeTable);
- return;
- }
- if (isCrossTableDrag) {
- crossTableDragRowInfo.row = row;
- crossTableDragRowObj = {
- $oldTable: $xeTable,
- $newTable: null
- };
- }
- reactData.dragRow = row;
- reactData.isCrossDragRow = false;
- reactData.dragCol = null;
- trEl.draggable = true;
- updateRowDropOrigin($xeTable, row);
- updateRowDropTipContent($xeTable, tdEl);
- $xeTable.dispatchEvent('row-dragstart', params, evnt);
- },
- handleCellDragMouseupEvent() {
- const $xeTable = this;
- clearDragStatus($xeTable);
- },
- /**
- * 列拖拽
- */
- handleHeaderCellDragDragstartEvent(evnt) {
- if (evnt.dataTransfer) {
- evnt.dataTransfer.setDragImage(getTpImg(), 0, 0);
- }
- },
- handleColDragSwapColumn() {
- const $xeTable = this;
- handleUpdateColumn($xeTable);
- return parseColumns($xeTable, false).then(() => {
- $xeTable.updateCellAreas();
- $xeTable.saveCustomStore('update:sort');
- });
- },
- handleColDragSwapEvent(evnt, isSyncColumn, dragCol, prevDragCol, prevDragPos, prevDragToChild) {
- const $xeTable = this;
- const props = $xeTable;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- mouseConfig
- } = props;
- const columnDragOpts = $xeTable.computeColumnDragOpts;
- const {
- animation,
- isPeerDrag,
- isCrossDrag,
- isSelfToChildDrag,
- isToChildDrag,
- dragEndMethod,
- dragToChildMethod
- } = columnDragOpts;
- const {
- collectColumn,
- fullColumnIdData
- } = internalData;
- const el = $xeTable.$refs.refElem;
- const dragOffsetIndex = prevDragPos === 'right' ? 1 : 0;
- const errRest = {
- status: false
- };
- if (!(el && prevDragCol && dragCol)) {
- return Promise.resolve(errRest);
- }
- // 判断是否有拖动
- if (prevDragCol !== dragCol) {
- const dragColumn = dragCol;
- const newColumn = prevDragCol;
- const dragParams = {
- oldColumn: dragColumn,
- newColumn,
- dragColumn,
- dragPos: prevDragPos,
- dragToChild: !!prevDragToChild,
- offsetIndex: dragOffsetIndex
- };
- const isDragToChildFlag = isSelfToChildDrag && dragToChildMethod ? dragToChildMethod(dragParams) : prevDragToChild;
- return Promise.resolve(dragEndMethod ? dragEndMethod(dragParams) : true).then(status => {
- if (!status) {
- return errRest;
- }
- let dragTargetColumn = null;
- const dragAllTargetCols = [];
- let dragColWidth = 0;
- if (animation) {
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree([dragColumn], column => {
- if (!dragTargetColumn && (!column.children || !column.children.length)) {
- dragTargetColumn = column;
- dragColWidth += column.renderWidth;
- }
- dragAllTargetCols.push(column);
- });
- }
- if (!dragTargetColumn) {
- dragTargetColumn = dragColumn;
- }
- const dragColRest = fullColumnIdData[dragTargetColumn.id] || {};
- const _dragColIndex = dragColRest._index;
- let dragOffsetLeft = -1;
- if (animation) {
- const oldTrEl = el.querySelector(`.vxe-table--column[colid="${dragTargetColumn.id}"]`);
- if (oldTrEl) {
- dragOffsetLeft = oldTrEl.offsetLeft;
- }
- }
- let oafIndex = -1;
- let nafIndex = -1;
- const oldAllMaps = {};
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree([dragColumn], column => {
- oldAllMaps[column.id] = column;
- });
- let isSelfToChildStatus = false;
- if (dragColumn.parentId && newColumn.parentId) {
- // 子到子
- if (isPeerDrag && !isCrossDrag) {
- if (dragColumn.parentId !== newColumn.parentId) {
- // 非同级
- return errRest;
- }
- } else {
- if (!isCrossDrag) {
- return errRest;
- }
- if (oldAllMaps[newColumn.id]) {
- isSelfToChildStatus = true;
- if (!(isCrossDrag && isSelfToChildDrag)) {
- if (core_.VxeUI.modal) {
- core_.VxeUI.modal.message({
- status: 'error',
- content: methods_getI18n('vxe.error.treeDragChild')
- });
- }
- return errRest;
- }
- }
- }
- } else if (dragColumn.parentId) {
- // 子到根
- if (!isCrossDrag) {
- return errRest;
- }
- } else if (newColumn.parentId) {
- // 根到子
- if (!isCrossDrag) {
- return errRest;
- }
- if (oldAllMaps[newColumn.id]) {
- isSelfToChildStatus = true;
- if (!(isCrossDrag && isSelfToChildDrag)) {
- if (core_.VxeUI.modal) {
- core_.VxeUI.modal.message({
- status: 'error',
- content: methods_getI18n('vxe.error.treeDragChild')
- });
- }
- return errRest;
- }
- }
- } else {
- // 根到根
- }
- const oldewMatchRest = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findTree(collectColumn, item => item.id === dragColumn.id);
- // 改变层级
- if (isSelfToChildStatus && isCrossDrag && isSelfToChildDrag) {
- if (oldewMatchRest) {
- const {
- items: oCols,
- index: oIndex
- } = oldewMatchRest;
- const childList = dragColumn.children || [];
- childList.forEach(column => {
- column.parentId = dragColumn.parentId;
- });
- oCols.splice(oIndex, 1, ...childList);
- dragColumn.children = [];
- }
- } else {
- if (oldewMatchRest) {
- const {
- items: oCols,
- index: oIndex,
- parent: oParent
- } = oldewMatchRest;
- oCols.splice(oIndex, 1);
- if (!oParent) {
- oafIndex = oIndex;
- }
- }
- }
- const newMatchRest = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findTree(collectColumn, item => item.id === newColumn.id);
- if (newMatchRest) {
- const {
- items: nCols,
- index: nIndex,
- parent: nParent
- } = newMatchRest;
- // 转子级
- if (isCrossDrag && isToChildDrag && isDragToChildFlag) {
- dragColumn.parentId = newColumn.id;
- newColumn.children = (newColumn.children || []).concat([dragColumn]);
- } else {
- dragColumn.parentId = newColumn.parentId;
- nCols.splice(nIndex + dragOffsetIndex, 0, dragColumn);
- }
- if (!nParent) {
- nafIndex = nIndex;
- }
- }
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(collectColumn, (column, index, items, path, parentColumn) => {
- if (!parentColumn) {
- const sortIndex = index + 1;
- column.renderSortNumber = sortIndex;
- }
- });
- if (mouseConfig) {
- if ($xeTable.clearSelected) {
- $xeTable.clearSelected();
- }
- if ($xeTable.clearCellAreas) {
- $xeTable.clearCellAreas();
- $xeTable.clearCopyCellArea();
- }
- }
- if (evnt) {
- $xeTable.dispatchEvent('column-dragend', {
- oldColumn: dragColumn,
- newColumn,
- dragColumn,
- dragPos: prevDragPos,
- dragToChild: isDragToChildFlag,
- offsetIndex: dragOffsetIndex,
- _index: {
- newIndex: nafIndex,
- oldIndex: oafIndex
- }
- }, evnt);
- }
- return $xeTable.$nextTick().then(() => {
- if (isSyncColumn) {
- return $xeTable.handleColDragSwapColumn();
- }
- }).then(() => {
- if (animation) {
- const {
- tableColumn
- } = reactData;
- const {
- visibleColumn,
- fullColumnIdData
- } = internalData;
- let dragNewColumn = null;
- const dragNewColMaps = {};
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree([dragColumn], column => {
- if (!dragNewColumn && (!column.children || !column.children.length)) {
- dragNewColumn = column;
- }
- dragNewColMaps[column.id] = column;
- });
- if (!dragNewColumn) {
- dragNewColumn = dragColumn;
- }
- if (dragColWidth && dragAllTargetCols.length) {
- const _newColIndex = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findIndexOf(visibleColumn, column => !!dragNewColumn && column.id === dragNewColumn.id);
- const firstCol = tableColumn[0];
- const firstColRest = fullColumnIdData[firstCol.id];
- if (firstColRest) {
- const _firstColIndex = firstColRest._index;
- const _lastColIndex = _firstColIndex + tableColumn.length;
- let csIndex = -1;
- let ceIndex = -1;
- let offsetRate = 1;
- if (_dragColIndex < _firstColIndex) {
- // 从左往右虚拟拖拽
- csIndex = 0;
- ceIndex = _newColIndex - _firstColIndex;
- } else if (_dragColIndex > _lastColIndex) {
- // 从右往左虚拟拖拽
- const $newRowIndex = dragColRest.$index;
- csIndex = $newRowIndex + 1;
- ceIndex = tableColumn.length;
- offsetRate = -1;
- } else {
- if (_newColIndex > _dragColIndex) {
- // 从左往右拖拽
- csIndex = _dragColIndex - _firstColIndex;
- ceIndex = csIndex + _newColIndex - _dragColIndex;
- } else {
- // 从右往左拖拽
- csIndex = _newColIndex - _firstColIndex + 1;
- ceIndex = csIndex + _dragColIndex - _newColIndex;
- offsetRate = -1;
- }
- }
- const dragRangeList = [];
- const dragRangeMaps = {};
- for (let i = csIndex; i < ceIndex; i++) {
- const column = tableColumn[i];
- if (!dragRangeMaps[column.id] && !dragNewColMaps[column.id]) {
- dragRangeMaps[column.id] = column;
- dragRangeList.push(column);
- }
- }
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree([newColumn], column => {
- if (!dragRangeMaps[column.id]) {
- dragRangeMaps[column.id] = column;
- dragRangeList.push(column);
- }
- });
- if (dragRangeList.length) {
- const dtTrList = el.querySelectorAll(dragRangeList.map(column => `.vxe-table--column[colid="${column.id}"]`).join(','));
- moveColAnimateToLr(dtTrList, offsetRate * dragColWidth);
- }
- }
- const newTrList = el.querySelectorAll(dragAllTargetCols.map(column => `.vxe-table--column[colid="${column.id}"]`).join(','));
- const newTdEl = newTrList[0];
- if (dragOffsetLeft > -1 && newTdEl) {
- moveColAnimateToLr(newTrList, dragOffsetLeft - newTdEl.offsetLeft);
- }
- }
- }
- updateColumnOffsetLeft($xeTable);
- loadScrollXData($xeTable);
- $xeTable.updateCellAreas();
- return {
- status: true
- };
- });
- }).catch(() => {
- return errRest;
- });
- }
- return Promise.resolve(errRest);
- },
- handleHeaderCellDragDragendEvent(evnt) {
- const $xeTable = this;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- dragCol
- } = reactData;
- const {
- prevDragCol,
- prevDragPos,
- prevDragToChild
- } = internalData;
- const el = $xeTable.$refs.refElem;
- $xeTable.handleColDragSwapEvent(evnt, true, dragCol, prevDragCol, prevDragPos, prevDragToChild);
- hideDropTip($xeTable);
- clearColDropOrigin($xeTable);
- clearColAnimate(el, ['.vxe-table--column']);
- internalData.prevDragToChild = false;
- reactData.dragRow = null;
- reactData.dragCol = null;
- clearCrossTableDragStatus($xeTable);
- },
- handleHeaderCellDragDragoverEvent(evnt) {
- const $xeTable = this;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- dragCol
- } = reactData;
- const columnDragOpts = $xeTable.computeColumnDragOpts;
- const {
- isToChildDrag,
- isPeerDrag,
- isCrossDrag
- } = columnDragOpts;
- if (!dragCol) {
- evnt.preventDefault();
- return;
- }
- const isControlKey = hasControlKey(evnt);
- const thEl = evnt.currentTarget;
- const colid = thEl.getAttribute('colid');
- const column = $xeTable.getColumnById(colid);
- if (column) {
- evnt.preventDefault();
- const {
- clientX
- } = evnt;
- const offsetX = clientX - thEl.getBoundingClientRect().x;
- const dragPos = offsetX < thEl.clientWidth / 2 ? 'left' : 'right';
- internalData.prevDragToChild = !!(isCrossDrag && isToChildDrag && isControlKey);
- internalData.prevDragCol = column;
- internalData.prevDragPos = dragPos;
- if (column.fixed || dragCol && dragCol.id === column.id || !isCrossDrag && (isPeerDrag ? dragCol.parentId !== column.parentId : column.parentId)) {
- showDropTip($xeTable, evnt, null, thEl, false, dragPos);
- return;
- }
- showDropTip($xeTable, evnt, null, thEl, true, dragPos);
- $xeTable.dispatchEvent('column-dragover', {
- oldColumn: dragCol,
- targetColumn: column,
- dragPos
- }, evnt);
- // 边缘滚动
- const el = $xeTable.$refs.refElem;
- if (!el) {
- return;
- }
- const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
- const refTableBody = $xeTable.$refs.refTableBody;
- const tableBodyElem = refTableBody ? refTableBody.$el : null;
- const scrollTargetEl = xHandleEl || tableBodyElem;
- if (scrollTargetEl) {
- const wrapperRect = el.getBoundingClientRect();
- const tableWrapperWidth = el.clientWidth;
- const leftContainerElem = $xeTable.$refs.refLeftContainer;
- const leftContainerWidth = leftContainerElem ? leftContainerElem.clientWidth : 0;
- const rightContainerElem = $xeTable.$refs.refRightContainer;
- const rightContainerWidth = rightContainerElem ? rightContainerElem.clientWidth : 0;
- const srartX = wrapperRect.x + leftContainerWidth;
- const endX = wrapperRect.x + tableWrapperWidth - rightContainerWidth;
- const distSize = 28;
- const startDistSize = clientX - srartX;
- const endDistSize = endX - clientX;
- if (startDistSize > 0 && startDistSize <= distSize) {
- const scrollRatio = Math.floor(tableWrapperWidth / (startDistSize > distSize / 2 ? 240 : 120));
- scrollTargetEl.scrollLeft -= scrollRatio * (distSize - startDistSize);
- } else if (endDistSize > 0 && endDistSize <= distSize) {
- const scrollRatio = Math.floor(tableWrapperWidth / (endDistSize > distSize / 2 ? 240 : 120));
- scrollTargetEl.scrollLeft += scrollRatio * (distSize - endDistSize);
- }
- }
- }
- },
- handleHeaderCellDragMousedownEvent(evnt, params) {
- const $xeTable = this;
- const reactData = $xeTable;
- evnt.stopPropagation();
- const columnDragOpts = $xeTable.computeColumnDragOpts;
- const {
- trigger,
- dragStartMethod
- } = columnDragOpts;
- const {
- column
- } = params;
- const dragEl = evnt.currentTarget;
- const thEl = trigger === 'cell' ? dragEl : dragEl.parentElement?.parentElement;
- clearColDropOrigin($xeTable);
- if (dragStartMethod && !dragStartMethod(params)) {
- thEl.draggable = false;
- reactData.dragRow = null;
- reactData.dragCol = null;
- hideDropTip($xeTable);
- clearCrossTableDragStatus($xeTable);
- return;
- }
- reactData.dragCol = column;
- reactData.dragRow = null;
- thEl.draggable = true;
- clearCrossTableDragStatus($xeTable);
- updateColDropOrigin($xeTable, column);
- updateColDropTipContent($xeTable, thEl);
- $xeTable.dispatchEvent('column-dragstart', params, evnt);
- },
- handleHeaderCellDragMouseupEvent() {
- const $xeTable = this;
- const reactData = $xeTable;
- clearColDropOrigin($xeTable);
- hideDropTip($xeTable);
- clearCrossTableDragStatus($xeTable);
- reactData.dragRow = null;
- reactData.dragCol = null;
- },
- setPendingRow(rows, status) {
- const $xeTable = this;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- handleGetRowId
- } = createHandleGetRowId($xeTable);
- const {
- pendingRowMaps
- } = internalData;
- if (rows && !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(rows)) {
- rows = [rows];
- }
- if (status) {
- rows.forEach(row => {
- const rowid = handleGetRowId(row);
- if (rowid && !pendingRowMaps[rowid]) {
- pendingRowMaps[rowid] = row;
- }
- });
- } else {
- rows.forEach(row => {
- const rowid = handleGetRowId(row);
- if (rowid && pendingRowMaps[rowid]) {
- delete pendingRowMaps[rowid];
- }
- });
- }
- reactData.pendingRowFlag++;
- return $xeTable.$nextTick();
- },
- togglePendingRow(rows) {
- const $xeTable = this;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- handleGetRowId
- } = createHandleGetRowId($xeTable);
- const {
- pendingRowMaps
- } = internalData;
- if (rows && !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(rows)) {
- rows = [rows];
- }
- rows.forEach(row => {
- const rowid = handleGetRowId(row);
- if (rowid) {
- if (pendingRowMaps[rowid]) {
- delete pendingRowMaps[rowid];
- } else {
- pendingRowMaps[rowid] = row;
- }
- }
- });
- reactData.pendingRowFlag++;
- return $xeTable.$nextTick();
- },
- hasPendingByRow(row) {
- const $xeTable = this;
- return $xeTable.isPendingByRow(row);
- },
- isPendingByRow(row) {
- const $xeTable = this;
- const reactData = $xeTable;
- const {
- pendingRowMaps
- } = reactData;
- const rowid = getRowid($xeTable, row);
- return !!pendingRowMaps[rowid];
- },
- getPendingRecords() {
- const $xeTable = this;
- const internalData = $xeTable;
- const {
- fullAllDataRowIdData,
- pendingRowMaps
- } = internalData;
- const insertRecords = [];
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(pendingRowMaps, (row, rowid) => {
- if (fullAllDataRowIdData[rowid]) {
- insertRecords.push(row);
- }
- });
- return insertRecords;
- },
- clearPendingRow() {
- const $xeTable = this;
- const reactData = $xeTable;
- const internalData = $xeTable;
- internalData.pendingRowMaps = {};
- reactData.pendingRowFlag++;
- return $xeTable.$nextTick();
- },
- sort(sortConfs, sortOrder) {
- const $xeTable = this;
- const sortOpts = $xeTable.computeSortOpts;
- const {
- multiple,
- remote,
- orders
- } = sortOpts;
- if (sortConfs) {
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(sortConfs)) {
- sortConfs = [{
- field: sortConfs,
- order: sortOrder
- }];
- }
- }
- if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(sortConfs)) {
- sortConfs = [sortConfs];
- }
- if (sortConfs.length) {
- let firstSortColumn;
- if (!multiple) {
- clearAllSort($xeTable);
- }
- (multiple ? sortConfs : [sortConfs[0]]).forEach((confs, index) => {
- let {
- field,
- order
- } = confs;
- let column = field;
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(field)) {
- column = $xeTable.getColumnByField(field);
- }
- if (column && (column.sortable || column.remoteSort)) {
- if (!firstSortColumn) {
- firstSortColumn = column;
- }
- if (orders && orders.indexOf(order) === -1) {
- order = getNextSortOrder($xeTable, column);
- }
- if (column.order !== order) {
- column.order = order;
- }
- column.sortTime = Date.now() + index;
- }
- });
- // 如果是服务端排序,则跳过本地排序处理
- if (!remote || firstSortColumn && firstSortColumn.remoteSort) {
- $xeTable.handleTableData(true);
- }
- return $xeTable.$nextTick().then(() => {
- updateRowOffsetTop($xeTable);
- $xeTable.updateCellAreas();
- return updateStyle($xeTable);
- });
- }
- return $xeTable.$nextTick();
- },
- setSort(sortConfs, isUpdate) {
- const $xeTable = this;
- return handleSortEvent($xeTable, null, sortConfs, isUpdate);
- },
- setSortByEvent(evnt, sortConfs) {
- const $xeTable = this;
- return handleSortEvent($xeTable, evnt, sortConfs, true);
- },
- /**
- * 清空指定列的排序条件
- * 如果为空则清空所有列的排序条件
- * @param {String} column 列或字段名
- */
- clearSort(fieldOrColumn) {
- const $xeTable = this;
- const sortOpts = $xeTable.computeSortOpts;
- if (fieldOrColumn) {
- const column = handleFieldOrColumn($xeTable, fieldOrColumn);
- if (column) {
- column.order = null;
- }
- } else {
- clearAllSort($xeTable);
- }
- if (!sortOpts.remote) {
- $xeTable.handleTableData(true);
- }
- return $xeTable.$nextTick().then(() => {
- updateRowOffsetTop($xeTable);
- return updateStyle($xeTable);
- });
- },
- clearSortByEvent(evnt, fieldOrColumn) {
- const $xeTable = this;
- const internalData = $xeTable;
- const {
- tableFullColumn
- } = internalData;
- const sortOpts = $xeTable.computeSortOpts;
- const {
- multiple
- } = sortOpts;
- const sortCols = [];
- let column = null;
- if (evnt) {
- if (fieldOrColumn) {
- column = handleFieldOrColumn($xeTable, fieldOrColumn);
- if (column) {
- column.order = null;
- }
- } else {
- tableFullColumn.forEach(column => {
- if (column.order) {
- column.order = null;
- sortCols.push(column);
- }
- });
- }
- if (!sortOpts.remote) {
- $xeTable.handleTableData(true);
- }
- if (!multiple) {
- column = sortCols[0];
- }
- if (column) {
- $xeTable.handleColumnSortEvent(evnt, column);
- }
- if (multiple && sortCols.length) {
- const params = {
- $table: $xeTable,
- $event: evnt,
- cols: sortCols,
- sortList: []
- };
- $xeTable.dispatchEvent('clear-all-sort', params, evnt);
- }
- }
- return $xeTable.$nextTick().then(() => {
- updateRowOffsetTop($xeTable);
- return updateStyle($xeTable);
- });
- },
- // 在 v3 中废弃
- getSortColumn() {
- warnLog('vxe.error.delFunc', ['getSortColumn', 'getSortColumns']);
- return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().find(this.tableFullColumn, column => (column.sortable || column.remoteSort) && column.order);
- },
- isSort(fieldOrColumn) {
- if (fieldOrColumn) {
- const column = handleFieldOrColumn(this, fieldOrColumn);
- return column && column.sortable && !!column.order;
- }
- return this.getSortColumns().length > 0;
- },
- getSortColumns() {
- const {
- multiple,
- chronological
- } = this.sortOpts;
- const sortList = [];
- this.tableFullColumn.forEach(column => {
- const {
- field,
- order
- } = column;
- if ((column.sortable || column.remoteSort) && order) {
- sortList.push({
- column,
- field,
- property: field,
- order,
- sortTime: column.sortTime
- });
- }
- });
- if (multiple && chronological && sortList.length > 1) {
- return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().orderBy(sortList, 'sortTime');
- }
- return sortList;
- },
- setFilterByEvent(evnt, fieldOrColumn, options) {
- const $xeTable = this;
- const column = handleFieldOrColumn($xeTable, fieldOrColumn);
- if (column && column.filters) {
- column.filters = toFilters(options || [], column.id);
- return $xeTable.handleColumnConfirmFilter(column, evnt);
- }
- return $xeTable.$nextTick();
- },
- /**
- * 关闭筛选
- * @param {Event} evnt 事件
- */
- closeFilter() {
- const $xeTable = this;
- const reactData = $xeTable;
- const {
- filterStore
- } = reactData;
- const {
- column,
- visible
- } = filterStore;
- filterStore.isAllSelected = false;
- filterStore.isIndeterminate = false;
- filterStore.visible = false;
- if (visible) {
- const field = column ? column.field : null;
- $xeTable.dispatchEvent('filter-visible', {
- column,
- property: field,
- field,
- filterList: () => $xeTable.getCheckedFilters(),
- visible: false
- }, null);
- }
- return $xeTable.$nextTick();
- },
- /**
- * 判断指定列是否为筛选状态,如果为空则判断所有列
- * @param {String} fieldOrColumn 字段名
- */
- isActiveFilterByColumn(fieldOrColumn) {
- const column = handleFieldOrColumn(this, fieldOrColumn);
- if (column) {
- return column.filters && column.filters.some(option => option.checked);
- }
- return this.getCheckedFilters().length > 0;
- },
- // 已废弃
- isFilter(fieldOrColumn) {
- return this.isActiveFilterByColumn(fieldOrColumn);
- },
- clearFilterByEvent(evnt, fieldOrColumn) {
- const $xeTable = this;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- filterStore
- } = reactData;
- const {
- tableFullColumn
- } = internalData;
- const filterOpts = $xeTable.computeFilterOpts;
- const {
- multiple
- } = filterOpts;
- const filterCols = [];
- let column = null;
- if (fieldOrColumn) {
- column = handleFieldOrColumn($xeTable, fieldOrColumn);
- if (column) {
- $xeTable.handleClearFilter(column);
- }
- } else {
- tableFullColumn.forEach(column => {
- if (column.filters) {
- filterCols.push(column);
- $xeTable.handleClearFilter(column);
- }
- });
- }
- if (!fieldOrColumn || column !== filterStore.column) {
- Object.assign(filterStore, {
- isAllSelected: false,
- isIndeterminate: false,
- style: null,
- options: [],
- column: null,
- multiple: false,
- visible: false
- });
- }
- if (!filterOpts.remote) {
- $xeTable.updateData();
- }
- if (!multiple) {
- column = filterCols[0];
- }
- if (column) {
- const filterList = () => $xeTable.getCheckedFilters();
- const values = [];
- const datas = [];
- column.filters.forEach(item => {
- if (item.checked) {
- values.push(item.value);
- datas.push(item.data);
- }
- });
- const params = {
- $table: $xeTable,
- $event: evnt,
- column,
- field: column.field,
- property: column.field,
- values,
- datas,
- filters: filterList,
- filterList
- };
- $xeTable.dispatchEvent('filter-change', params, evnt);
- $xeTable.dispatchEvent('clear-filter', params, evnt);
- }
- if (multiple && filterCols.length) {
- const params = {
- $table: $xeTable,
- $event: evnt,
- cols: filterCols,
- filterList: []
- };
- $xeTable.dispatchEvent('clear-all-filter', params, evnt);
- }
- return $xeTable.$nextTick();
- },
- /**
- * 判断展开行是否懒加载完成
- * @param {Row} row 行对象
- */
- isRowExpandLoaded(row) {
- const $xeTable = this;
- const {
- fullAllDataRowIdData
- } = this;
- const rowRest = fullAllDataRowIdData[getRowid($xeTable, row)];
- return rowRest && !!rowRest.expandLoaded;
- },
- clearRowExpandLoaded(row) {
- const $xeTable = this;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- fullAllDataRowIdData,
- rowExpandLazyLoadedMaps
- } = internalData;
- const expandOpts = $xeTable.computeExpandOpts;
- const {
- lazy
- } = expandOpts;
- const rowid = getRowid($xeTable, row);
- const rowRest = fullAllDataRowIdData[rowid];
- if (lazy && rowRest) {
- rowRest.expandLoaded = false;
- delete rowExpandLazyLoadedMaps[rowid];
- }
- reactData.rowExpandedFlag++;
- return $xeTable.$nextTick();
- },
- /**
- * 重新懒加载展开行,并展开内容
- * @param {Row} row 行对象
- */
- reloadRowExpand(row) {
- const $xeTable = this;
- const internalData = $xeTable;
- const {
- rowExpandLazyLoadedMaps
- } = internalData;
- const expandOpts = $xeTable.computeExpandOpts;
- const {
- lazy
- } = expandOpts;
- const rowid = getRowid(this, row);
- if (lazy && !rowExpandLazyLoadedMaps[rowid]) {
- $xeTable.clearRowExpandLoaded(row).then(() => handleAsyncRowExpand($xeTable, row));
- }
- return $xeTable.$nextTick();
- },
- reloadExpandContent(row) {
- warnLog('vxe.error.delFunc', ['reloadExpandContent', 'reloadRowExpand']);
- // 即将废弃
- return this.reloadRowExpand(row);
- },
- /**
- * 展开行事件
- */
- triggerRowExpandEvent(evnt, params) {
- const $xeTable = this;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- expandColumn
- } = reactData;
- const {
- rowExpandLazyLoadedMaps
- } = internalData;
- const expandOpts = $xeTable.computeExpandOpts;
- const {
- row
- } = params;
- const {
- lazy,
- trigger
- } = expandOpts;
- if (trigger === 'manual') {
- return;
- }
- evnt.stopPropagation();
- const rowid = getRowid($xeTable, row);
- if (!lazy || !rowExpandLazyLoadedMaps[rowid]) {
- const expanded = !$xeTable.isRowExpandByRow(row);
- const columnIndex = expandColumn ? $xeTable.getColumnIndex(expandColumn) : -1;
- const $columnIndex = expandColumn ? $xeTable.getVMColumnIndex(expandColumn) : -1;
- $xeTable.setRowExpand(row, expanded);
- $xeTable.dispatchEvent('toggle-row-expand', {
- expanded,
- column: expandColumn,
- columnIndex,
- $columnIndex,
- row,
- rowIndex: $xeTable.getRowIndex(row),
- $rowIndex: $xeTable.getVMRowIndex(row)
- }, evnt);
- }
- },
- /**
- * 切换展开行
- */
- toggleRowExpand(row) {
- return this.setRowExpand(row, !this.isRowExpandByRow(row));
- },
- /**
- * 设置所有行的展开与否
- * @param {Boolean} expanded 是否展开
- */
- setAllRowExpand(expanded) {
- const {
- treeConfig,
- treeOpts,
- tableFullData,
- tableFullTreeData
- } = this;
- const childrenField = treeOpts.children || treeOpts.childrenField;
- let expandedRows = [];
- if (treeConfig) {
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(tableFullTreeData, row => {
- expandedRows.push(row);
- }, {
- children: childrenField
- });
- } else {
- expandedRows = tableFullData;
- }
- return this.setRowExpand(expandedRows, expanded);
- },
- /**
- * 设置展开行,二个参数设置这一行展开与否
- * 支持单行
- * 支持多行
- * @param {Array/Row} rows 行数据
- * @param {Boolean} expanded 是否展开
- */
- setRowExpand(rows, expanded) {
- const $xeTable = this;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- expandColumn
- } = reactData;
- let {
- fullAllDataRowIdData,
- rowExpandedMaps,
- rowExpandLazyLoadedMaps
- } = internalData;
- const {
- handleGetRowId
- } = createHandleGetRowId($xeTable);
- const expandOpts = $xeTable.computeExpandOpts;
- const {
- reserve,
- lazy,
- accordion,
- toggleMethod
- } = expandOpts;
- const lazyRests = [];
- const columnIndex = expandColumn ? $xeTable.getColumnIndex(expandColumn) : -1;
- const $columnIndex = expandColumn ? $xeTable.getVMColumnIndex(expandColumn) : -1;
- if (rows) {
- if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(rows)) {
- rows = [rows];
- }
- if (accordion) {
- // 只能同时展开一个
- rowExpandedMaps = {};
- internalData.rowExpandedMaps = rowExpandedMaps;
- rows = rows.slice(rows.length - 1, rows.length);
- }
- const validRows = toggleMethod ? rows.filter(row => toggleMethod({
- $table: $xeTable,
- expanded,
- column: expandColumn,
- columnIndex,
- $columnIndex,
- row,
- rowIndex: $xeTable.getRowIndex(row),
- $rowIndex: $xeTable.getVMRowIndex(row)
- })) : rows;
- if (expanded) {
- validRows.forEach(row => {
- const rowid = handleGetRowId(row);
- if (!rowExpandedMaps[rowid]) {
- const rowRest = fullAllDataRowIdData[rowid];
- const isLoad = lazy && !rowRest.expandLoaded && !rowExpandLazyLoadedMaps[rowid];
- if (isLoad) {
- lazyRests.push(handleAsyncRowExpand($xeTable, row));
- } else {
- rowExpandedMaps[rowid] = row;
- }
- }
- });
- } else {
- validRows.forEach(item => {
- const rowid = handleGetRowId(item);
- if (rowExpandedMaps[rowid]) {
- delete rowExpandedMaps[rowid];
- }
- });
- }
- if (reserve) {
- validRows.forEach(row => handleRowExpandReserve($xeTable, row, expanded));
- }
- }
- reactData.rowExpandedFlag++;
- return Promise.all(lazyRests).then(() => $xeTable.$nextTick()).then(() => handleLazyRecalculate($xeTable, true, true, true)).then(() => {
- updateRowOffsetTop($xeTable);
- updateRowExpandStyle($xeTable);
- handleRowExpandScroll($xeTable);
- return $xeTable.updateCellAreas();
- });
- },
- /**
- * 判断行是否为展开状态
- * @param {Row} row 行对象
- */
- isRowExpandByRow(row) {
- const $xeTable = this;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- rowExpandedFlag
- } = reactData;
- const {
- rowExpandedMaps
- } = internalData;
- const rowid = getRowid(this, row);
- return !!rowExpandedFlag && !!rowExpandedMaps[rowid];
- },
- isExpandByRow(row) {
- warnLog('vxe.error.delFunc', ['isExpandByRow', 'isRowExpandByRow']);
- // 即将废弃
- return this.isRowExpandByRow(row);
- },
- /**
- * 手动清空展开行状态,数据会恢复成未展开的状态
- */
- clearRowExpand() {
- const $xeTable = this;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- tableFullData,
- scrollYStore
- } = internalData;
- const expandOpts = $xeTable.computeExpandOpts;
- const {
- reserve
- } = expandOpts;
- const expList = $xeTable.getRowExpandRecords();
- internalData.rowExpandedMaps = {};
- if (reserve) {
- tableFullData.forEach(row => handleRowExpandReserve($xeTable, row, false));
- }
- reactData.rowExpandedFlag++;
- scrollYStore.startIndex = 0;
- scrollYStore.endIndex = 1;
- return $xeTable.$nextTick().then(() => {
- if (expList.length) {
- return handleLazyRecalculate($xeTable, true, true, true);
- }
- }).then(() => {
- updateRowOffsetTop($xeTable);
- updateRowExpandStyle($xeTable);
- handleRowExpandScroll($xeTable);
- return $xeTable.updateCellAreas();
- });
- },
- clearRowExpandReserve() {
- this.rowExpandedReserveRowMap = {};
- return this.$nextTick();
- },
- getRowExpandRecords() {
- const $xeTable = this;
- const internalData = $xeTable;
- const rest = [];
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(internalData.rowExpandedMaps, item => {
- if (item) {
- rest.push(item);
- }
- });
- return rest;
- },
- setRowGroups(fieldOrColumns) {
- const $xeTable = this;
- const props = $xeTable;
- const internalData = $xeTable;
- const {
- aggregateConfig,
- rowGroupConfig
- } = props;
- const aggregateOpts = $xeTable.computeAggregateOpts;
- const {
- maxGroupSize
- } = aggregateOpts;
- if (!(aggregateConfig || rowGroupConfig)) {
- errLog('vxe.error.reqProp', ['aggregate-config']);
- return $xeTable.$nextTick();
- }
- const confList = fieldOrColumns ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(fieldOrColumns) ? fieldOrColumns : [fieldOrColumns] : [];
- if (maxGroupSize && confList.length > maxGroupSize) {
- if (core_.VxeUI.modal) {
- core_.VxeUI.modal.message({
- status: 'error',
- content: methods_getI18n('vxe.table.maxGroupCol', [maxGroupSize])
- });
- }
- return $xeTable.$nextTick();
- }
- if (confList.length) {
- handleUpdateRowGroup($xeTable, confList.map(fieldOrColumn => {
- return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(fieldOrColumn) ? fieldOrColumn : fieldOrColumn.field;
- }));
- return loadTableData($xeTable, internalData.tableSynchData, true);
- }
- return $xeTable.$nextTick();
- },
- getRowGroups() {
- const $xeTable = this;
- const props = $xeTable;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- aggregateConfig,
- rowGroupConfig
- } = props;
- const {
- fullColumnFieldData
- } = internalData;
- if (aggregateConfig || rowGroupConfig) {
- const {
- rowGroupList
- } = reactData;
- return rowGroupList.map(({
- field
- }) => {
- const colRet = fullColumnFieldData[field];
- if (colRet) {
- return colRet.column;
- }
- return {
- field
- };
- });
- }
- return [];
- },
- getRowGroupFields() {
- const $xeTable = this;
- return $xeTable.getRowGroups().map(item => item.field);
- },
- clearRowGroups() {
- const $xeTable = this;
- const props = $xeTable;
- const internalData = $xeTable;
- const {
- aggregateConfig,
- rowGroupConfig
- } = props;
- if (!(aggregateConfig || rowGroupConfig)) {
- errLog('vxe.error.reqProp', ['aggregate-config']);
- return $xeTable.$nextTick();
- }
- handleUpdateRowGroup($xeTable, []);
- return loadTableData($xeTable, internalData.tableSynchData, true);
- },
- isRowGroupRecord(row) {
- const $xeTable = this;
- warnLog('vxe.error.delFunc', ['isRowGroupRecord', 'isAggregateRecord']);
- return $xeTable.isAggregateRecord(row);
- },
- isRowGroupExpandByRow(row) {
- const $xeTable = this;
- warnLog('vxe.error.delFunc', ['isRowGroupExpandByRow', 'isAggregateExpandByRow']);
- return $xeTable.isAggregateExpandByRow(row);
- },
- isAggregateRecord(row) {
- const $xeTable = this;
- const reactData = $xeTable;
- const {
- isRowGroupStatus
- } = reactData;
- return isRowGroupStatus && row.isAggregate;
- },
- getAggregateContentByRow(row) {
- const $xeTable = this;
- const reactData = $xeTable;
- const {
- isRowGroupStatus
- } = reactData;
- return isRowGroupStatus && row && row.isAggregate ? row.groupContent : '';
- },
- getAggregateRowChildren(row) {
- const $xeTable = this;
- const reactData = $xeTable;
- const aggregateOpts = $xeTable.computeAggregateOpts;
- const {
- childrenField,
- mapChildrenField
- } = aggregateOpts;
- const {
- isRowGroupStatus
- } = reactData;
- return isRowGroupStatus && row && row.isAggregate && childrenField && mapChildrenField ? row[mapChildrenField] || [] : [];
- },
- isAggregateExpandByRow(row) {
- const $xeTable = this;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- rowGroupExpandedFlag
- } = reactData;
- const {
- rowGroupExpandedMaps
- } = internalData;
- return !!rowGroupExpandedFlag && !!rowGroupExpandedMaps[getRowid($xeTable, row)];
- },
- setRowGroupExpand(rows, expanded) {
- const $xeTable = this;
- if (rows) {
- if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(rows)) {
- rows = [rows];
- }
- return handleRowGroupVirtualExpand($xeTable, rows, expanded);
- }
- return $xeTable.$nextTick();
- },
- setRowGroupExpandByField(groupFields, expanded) {
- const $xeTable = this;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- isRowGroupStatus
- } = reactData;
- const aggregateOpts = $xeTable.computeAggregateOpts;
- const {
- childrenField
- } = aggregateOpts;
- if (groupFields) {
- if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(groupFields)) {
- groupFields = [groupFields];
- }
- if (isRowGroupStatus) {
- const rows = [];
- const gfKeys = {};
- groupFields.forEach(groupField => {
- gfKeys[groupField] = true;
- });
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(internalData.afterGroupFullData, row => {
- if (row.isAggregate && gfKeys[row.groupField]) {
- rows.push(row);
- }
- }, {
- children: childrenField
- });
- if (rows.length) {
- return handleRowGroupVirtualExpand($xeTable, rows, expanded);
- }
- }
- }
- return $xeTable.$nextTick();
- },
- setAllRowGroupExpand(expanded) {
- const $xeTable = this;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- tableFullGroupData
- } = internalData;
- const aggregateOpts = $xeTable.computeAggregateOpts;
- const {
- mapChildrenField
- } = aggregateOpts;
- const rgExpandedMaps = {};
- if (expanded && mapChildrenField) {
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(tableFullGroupData, row => {
- if (row[mapChildrenField] && row[mapChildrenField].length) {
- rgExpandedMaps[getRowid($xeTable, row)] = row;
- }
- }, {
- children: mapChildrenField
- });
- }
- internalData.rowGroupExpandedMaps = rgExpandedMaps;
- handleVirtualTreeToList($xeTable);
- $xeTable.handleTableData();
- updateAfterDataIndex($xeTable);
- reactData.rowGroupExpandedFlag++;
- return handleLazyRecalculate($xeTable, true, true, true);
- },
- clearRowGroupExpand() {
- const $xeTable = this;
- const reactData = $xeTable;
- const internalData = $xeTable;
- internalData.rowGroupExpandedMaps = {};
- handleVirtualTreeToList($xeTable);
- $xeTable.handleTableData();
- updateAfterDataIndex($xeTable);
- reactData.rowGroupExpandedFlag++;
- return handleLazyRecalculate($xeTable, true, true, true);
- },
- getTreeExpandRecords() {
- const $xeTable = this;
- const internalData = $xeTable;
- const rest = [];
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(internalData.treeExpandedMaps, item => {
- if (item) {
- rest.push(item);
- }
- });
- return rest;
- },
- /**
- * 内部方法、获取树表格状态
- * @deprecated
- * @private
- */
- getTreeStatus() {
- if (this.treeConfig) {
- return {
- config: this.treeOpts,
- rowExpandeds: this.getTreeExpandRecords()
- };
- }
- return null;
- },
- /**
- * 判断树节点是否懒加载完成
- * @param {Row} row 行对象
- */
- isTreeExpandLoaded(row) {
- const $xeTable = this;
- const {
- fullAllDataRowIdData
- } = this;
- const rowRest = fullAllDataRowIdData[getRowid($xeTable, row)];
- return rowRest && !!rowRest.treeLoaded;
- },
- clearTreeExpandLoaded(rows) {
- const $xeTable = this;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- fullAllDataRowIdData,
- treeExpandedMaps
- } = internalData;
- const treeOpts = $xeTable.computeTreeOpts;
- const {
- transform
- } = treeOpts;
- if (rows) {
- if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(rows)) {
- rows = [rows];
- }
- rows.forEach(row => {
- const rowid = getRowid($xeTable, row);
- const rowRest = fullAllDataRowIdData[rowid];
- if (rowRest) {
- rowRest.treeLoaded = false;
- if (treeExpandedMaps[rowid]) {
- delete treeExpandedMaps[rowid];
- }
- }
- });
- } else {
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(fullAllDataRowIdData, rowRest => {
- rowRest.treeLoaded = false;
- });
- }
- internalData.treeExpandedMaps = {};
- if (transform) {
- handleVirtualTreeToList($xeTable);
- $xeTable.handleTableData();
- }
- reactData.treeExpandedFlag++;
- return $xeTable.$nextTick();
- },
- /**
- * 重新懒加载树节点,并展开该节点
- * @param {Row} row 行对象
- */
- reloadTreeExpand(row) {
- const $xeTable = this;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- treeExpandLazyLoadedMaps
- } = internalData;
- const treeOpts = $xeTable.computeTreeOpts;
- const {
- transform,
- lazy
- } = treeOpts;
- const hasChildField = treeOpts.hasChild || treeOpts.hasChildField;
- const rowid = getRowid($xeTable, row);
- if (lazy && row[hasChildField] && !treeExpandLazyLoadedMaps[rowid]) {
- return $xeTable.clearTreeExpandLoaded(row).then(() => {
- return handleAsyncTreeExpandChilds($xeTable, row);
- }).then(() => {
- if (transform) {
- handleVirtualTreeToList($xeTable);
- $xeTable.handleTableData();
- }
- reactData.treeExpandedFlag++;
- }).then(() => {
- return $xeTable.recalculate();
- });
- }
- return $xeTable.$nextTick();
- },
- reloadTreeChilds(row) {
- const $xeTable = this;
- warnLog('vxe.error.delFunc', ['reloadTreeChilds', 'reloadTreeExpand']);
- // 即将废弃
- return $xeTable.reloadTreeExpand(row);
- },
- /**
- * 行分组事件
- */
- triggerRowGroupExpandEvent(evnt, params) {
- const $xeTable = this;
- const internalData = $xeTable;
- const {
- rowGroupExpandedMaps
- } = internalData;
- const aggregateOpts = $xeTable.computeAggregateOpts;
- const {
- row,
- column
- } = params;
- const {
- trigger
- } = aggregateOpts;
- if (trigger === 'manual') {
- return;
- }
- evnt.stopPropagation();
- const rowid = getRowid($xeTable, row);
- const expanded = !rowGroupExpandedMaps[rowid];
- const columnIndex = $xeTable.getColumnIndex(column);
- const $columnIndex = $xeTable.getVMColumnIndex(column);
- $xeTable.setRowGroupExpand(row, expanded);
- $xeTable.dispatchEvent('toggle-row-group-expand', {
- expanded,
- column,
- columnIndex,
- $columnIndex,
- row
- }, evnt);
- },
- /**
- * 展开树节点事件
- */
- triggerTreeExpandEvent(evnt, params) {
- const $xeTable = this;
- const internalData = $xeTable;
- const {
- treeExpandLazyLoadedMaps,
- treeEATime
- } = internalData;
- const treeOpts = $xeTable.computeTreeOpts;
- const {
- row,
- column
- } = params;
- const {
- lazy,
- trigger,
- accordion
- } = treeOpts;
- if (trigger === 'manual') {
- return;
- }
- evnt.stopPropagation();
- const rowid = getRowid(this, row);
- if (!lazy || !treeExpandLazyLoadedMaps[rowid]) {
- const expanded = !$xeTable.isTreeExpandByRow(row);
- const columnIndex = $xeTable.getColumnIndex(column);
- const $columnIndex = $xeTable.getVMColumnIndex(column);
- if (treeEATime) {
- clearTimeout(treeEATime);
- }
- $xeTable.setTreeExpand(row, expanded).then(() => {
- if (accordion) {
- internalData.treeEATime = setTimeout(() => {
- internalData.treeEATime = undefined;
- $xeTable.scrollToRow(row);
- }, 30);
- }
- });
- $xeTable.dispatchEvent('toggle-tree-expand', {
- expanded,
- column,
- columnIndex,
- $columnIndex,
- row
- }, evnt);
- }
- },
- /**
- * 切换/展开树节点
- */
- toggleTreeExpand(row) {
- return this.setTreeExpand(row, !this.isTreeExpandByRow(row));
- },
- /**
- * 设置所有树节点的展开与否
- * @param {Boolean} expanded 是否展开
- */
- setAllTreeExpand(expanded) {
- const $xeTable = this;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- tableFullData
- } = internalData;
- const treeOpts = $xeTable.computeTreeOpts;
- const {
- transform,
- lazy
- } = treeOpts;
- const childrenField = treeOpts.children || treeOpts.childrenField;
- const expandeds = [];
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(tableFullData, row => {
- const rowChildren = row[childrenField];
- if (lazy || rowChildren && rowChildren.length) {
- expandeds.push(row);
- }
- }, {
- children: childrenField
- });
- return $xeTable.setTreeExpand(expandeds, expanded).then(() => {
- if (transform) {
- handleVirtualTreeToList($xeTable);
- reactData.treeExpandedFlag++;
- return $xeTable.recalculate();
- }
- });
- },
- /**
- * 设置展开树形节点,二个参数设置这一行展开与否
- * 支持单行
- * 支持多行
- * @param {Array/Row} rows 行数据
- * @param {Boolean} expanded 是否展开
- */
- setTreeExpand(rows, expanded) {
- const $xeTable = this;
- const {
- treeOpts
- } = this;
- const {
- transform
- } = treeOpts;
- if (rows) {
- if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(rows)) {
- rows = [rows];
- }
- if (rows.length) {
- // 如果为虚拟树
- if (transform) {
- return handleVirtualTreeExpand($xeTable, rows, expanded);
- } else {
- return handleBaseTreeExpand($xeTable, rows, expanded);
- }
- }
- }
- return this.$nextTick();
- },
- /**
- * 判断行是否为树形节点展开状态
- * @param {Row} row 行对象
- */
- isTreeExpandByRow(row) {
- const $xeTable = this;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- treeExpandedFlag
- } = reactData;
- const {
- treeExpandedMaps
- } = internalData;
- return !!treeExpandedFlag && !!treeExpandedMaps[getRowid($xeTable, row)];
- },
- /**
- * 手动清空树形节点的展开状态,数据会恢复成未展开的状态
- */
- clearTreeExpand() {
- const $xeTable = this;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- tableFullTreeData
- } = internalData;
- const treeOpts = $xeTable.computeTreeOpts;
- const childrenField = treeOpts.children || treeOpts.childrenField;
- const {
- transform,
- reserve
- } = treeOpts;
- const expList = $xeTable.getTreeExpandRecords();
- internalData.treeExpandedMaps = {};
- if (reserve) {
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(tableFullTreeData, row => handleTreeExpandReserve($xeTable, row, false), {
- children: childrenField
- });
- }
- return $xeTable.handleTableData().then(() => {
- if (transform) {
- handleVirtualTreeToList($xeTable);
- $xeTable.handleTableData();
- }
- reactData.treeExpandedFlag++;
- }).then(() => {
- if (expList.length) {
- $xeTable.recalculate();
- }
- });
- },
- clearTreeExpandReserve() {
- this.treeExpandedReserveRowMap = {};
- return this.$nextTick();
- },
- /**
- * 获取表格的滚动状态
- */
- getScroll() {
- const $xeTable = this;
- return $xeTable.getScrollData();
- },
- /**
- * 获取表格的滚动数据
- */
- getScrollData() {
- const $xeTable = this;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- scrollXLoad,
- scrollYLoad,
- scrollbarHeight,
- scrollbarWidth
- } = reactData;
- const {
- elemStore
- } = internalData;
- const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
- const scrollTop = bodyScrollElem ? bodyScrollElem.scrollTop : 0;
- const scrollLeft = bodyScrollElem ? bodyScrollElem.scrollLeft : 0;
- const clientHeight = bodyScrollElem ? bodyScrollElem.clientHeight : 0;
- const clientWidth = bodyScrollElem ? bodyScrollElem.clientWidth : 0;
- const scrollHeight = bodyScrollElem ? bodyScrollElem.scrollHeight : 0;
- const scrollWidth = bodyScrollElem ? bodyScrollElem.scrollWidth : 0;
- const isTop = scrollTop <= 0;
- const isBottom = scrollTop + clientHeight >= scrollHeight;
- const isLeft = scrollLeft <= 0;
- const isRight = scrollLeft + clientWidth >= scrollWidth;
- return {
- virtualX: scrollXLoad,
- virtualY: scrollYLoad,
- isTop,
- isBottom,
- isLeft,
- isRight,
- scrollbarHeight,
- scrollbarWidth,
- scrollTop,
- scrollLeft,
- scrollHeight,
- scrollWidth,
- clientHeight,
- clientWidth
- };
- },
- handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, params) {
- const $xeTable = this;
- const props = $xeTable;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- highlightHoverRow
- } = props;
- const {
- lastScrollLeft,
- lastScrollTop
- } = internalData;
- const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
- const yHandleEl = $xeTable.$refs.refScrollYHandleElem;
- if (!xHandleEl || !yHandleEl) {
- return;
- }
- const rowOpts = $xeTable.computeRowOpts;
- const validTip = $xeTable.$refs.refValidTooltip;
- const tooltip = $xeTable.$refs.refTooltip;
- const bodyHeight = yHandleEl.clientHeight;
- const bodyWidth = xHandleEl.clientWidth;
- const scrollHeight = yHandleEl.scrollHeight;
- const scrollWidth = xHandleEl.scrollWidth;
- let isTop = false;
- let isBottom = false;
- let isLeft = false;
- let isRight = false;
- let direction = '';
- let isTopBoundary = false;
- let isBottomBoundary = false;
- let isLeftBoundary = false;
- let isRightBoundary = false;
- if (isRollX) {
- const xThreshold = $xeTable.computeScrollXThreshold;
- isLeft = scrollLeft <= 0;
- if (!isLeft) {
- isRight = scrollLeft + bodyWidth >= scrollWidth - 1;
- }
- if (scrollLeft > lastScrollLeft) {
- direction = 'right';
- if (scrollLeft + bodyWidth >= scrollWidth - xThreshold) {
- isRightBoundary = true;
- }
- } else {
- direction = 'left';
- if (scrollLeft <= xThreshold) {
- isLeftBoundary = true;
- }
- }
- $xeTable.checkScrolling();
- internalData.lastScrollLeft = scrollLeft;
- }
- if (isRollY) {
- const yThreshold = $xeTable.computeScrollYThreshold;
- isTop = scrollTop <= 0;
- if (!isTop) {
- isBottom = scrollTop + bodyHeight >= scrollHeight - 1;
- }
- if (scrollTop > lastScrollTop) {
- direction = 'bottom';
- if (scrollTop + bodyHeight >= scrollHeight - yThreshold) {
- isBottomBoundary = true;
- }
- } else {
- direction = 'top';
- if (scrollTop <= yThreshold) {
- isTopBoundary = true;
- }
- }
- internalData.lastScrollTop = scrollTop;
- }
- reactData.lastScrollTime = Date.now();
- const evntParams = {
- scrollTop,
- scrollLeft,
- bodyHeight,
- bodyWidth,
- scrollHeight,
- scrollWidth,
- isX: isRollX,
- isY: isRollY,
- isTop,
- isBottom,
- isLeft,
- isRight,
- direction,
- ...params
- };
- updateRowExpandStyle($xeTable);
- checkLastSyncScroll($xeTable, isRollX, isRollY);
- if (isRollX) {
- $xeTable.closeFilter();
- }
- if (rowOpts.isHover || highlightHoverRow) {
- $xeTable.clearHoverRow();
- }
- if (validTip && validTip.reactData.visible) {
- validTip.close();
- }
- if (tooltip && tooltip.reactData.visible) {
- tooltip.close();
- }
- if (isBottomBoundary || isTopBoundary || isRightBoundary || isLeftBoundary) {
- $xeTable.dispatchEvent('scroll-boundary', evntParams, evnt);
- }
- $xeTable.dispatchEvent('scroll', evntParams, evnt);
- },
- /**
- * 横向 X 可视渲染事件处理
- */
- triggerScrollXEvent() {
- const $xeTable = this;
- const virtualXOpts = $xeTable.computeVirtualXOpts;
- if (virtualXOpts.immediate) {
- loadScrollXData($xeTable);
- } else {
- lazyScrollXData($xeTable);
- }
- },
- /**
- * 纵向 Y 可视渲染事件处理
- */
- triggerScrollYEvent() {
- const $xeTable = this;
- const virtualYOpts = $xeTable.computeVirtualYOpts;
- if (virtualYOpts.immediate) {
- loadScrollYData($xeTable);
- } else {
- lazyScrollYData($xeTable);
- }
- },
- triggerBodyScrollEvent(evnt, fixedType) {
- const $xeTable = this;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- scrollYLoad,
- scrollXLoad
- } = reactData;
- const {
- elemStore,
- intoRunScroll,
- lastScrollTop,
- lastScrollLeft,
- inWheelScroll,
- inVirtualScroll,
- inHeaderScroll,
- inBodyScroll,
- scrollRenderType,
- inFooterScroll
- } = internalData;
- if (inWheelScroll || inVirtualScroll || inHeaderScroll || inFooterScroll) {
- return;
- }
- const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
- const yHandleEl = $xeTable.$refs.refScrollYHandleElem;
- const leftScrollElem = getRefElem(elemStore['left-body-scroll']);
- const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
- const rightScrollElem = getRefElem(elemStore['right-body-scroll']);
- const headerScrollElem = getRefElem(elemStore['main-header-scroll']);
- const footerScrollElem = getRefElem(elemStore['main-footer-scroll']);
- const rowExpandEl = $xeTable.$refs.refRowExpandElem;
- if (intoRunScroll) {
- return;
- }
- if (!bodyScrollElem) {
- return;
- }
- if (!xHandleEl) {
- return;
- }
- if (!yHandleEl) {
- return;
- }
- if (inBodyScroll) {
- if (scrollRenderType !== fixedType) {
- return;
- }
- }
- let scrollTop = yHandleEl.scrollTop;
- let scrollLeft = xHandleEl.scrollLeft;
- if (leftScrollElem && fixedType === 'left') {
- scrollTop = leftScrollElem.scrollTop;
- } else if (rightScrollElem && fixedType === 'right') {
- scrollTop = rightScrollElem.scrollTop;
- } else {
- scrollTop = bodyScrollElem.scrollTop;
- scrollLeft = bodyScrollElem.scrollLeft;
- }
- const isRollX = scrollLeft !== lastScrollLeft;
- const isRollY = scrollTop !== lastScrollTop;
- internalData.inBodyScroll = true;
- internalData.scrollRenderType = fixedType;
- if (isRollY) {
- if (fixedType === 'left') {
- setScrollTop(bodyScrollElem, scrollTop);
- setScrollTop(rightScrollElem, scrollTop);
- } else if (fixedType === 'right') {
- setScrollTop(bodyScrollElem, scrollTop);
- setScrollTop(leftScrollElem, scrollTop);
- } else {
- setScrollTop(leftScrollElem, scrollTop);
- setScrollTop(rightScrollElem, scrollTop);
- }
- setScrollTop(yHandleEl, scrollTop);
- setScrollTop(rowExpandEl, scrollTop);
- syncGanttScrollTop($xeTable, scrollTop);
- if (scrollYLoad) {
- $xeTable.triggerScrollYEvent(evnt);
- }
- }
- if (isRollX) {
- setScrollLeft(xHandleEl, scrollLeft);
- setScrollLeft(headerScrollElem, scrollLeft);
- setScrollLeft(footerScrollElem, scrollLeft);
- if (scrollXLoad) {
- $xeTable.triggerScrollXEvent(evnt);
- }
- }
- $xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
- type: 'body',
- fixed: fixedType
- });
- },
- triggerHeaderScrollEvent(evnt, fixedType) {
- const $xeTable = this;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- scrollXLoad
- } = reactData;
- const {
- elemStore,
- intoRunScroll,
- inWheelScroll,
- inVirtualScroll,
- inBodyScroll,
- inFooterScroll
- } = internalData;
- if (inWheelScroll || inVirtualScroll || inBodyScroll || inFooterScroll) {
- return;
- }
- if (intoRunScroll) {
- return;
- }
- const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
- const yHandleEl = $xeTable.$refs.refScrollYHandleElem;
- const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
- const headerScrollElem = getRefElem(elemStore['main-header-scroll']);
- const footerScrollElem = getRefElem(elemStore['main-footer-scroll']);
- if (!headerScrollElem) {
- return;
- }
- if (!xHandleEl) {
- return;
- }
- if (!yHandleEl) {
- return;
- }
- const scrollTop = yHandleEl.scrollTop;
- const scrollLeft = headerScrollElem.scrollLeft;
- const isRollX = true;
- const isRollY = false;
- internalData.inHeaderScroll = true;
- setScrollLeft(xHandleEl, scrollLeft);
- setScrollLeft(footerScrollElem, scrollLeft);
- setScrollLeft(bodyScrollElem, scrollLeft);
- if (scrollXLoad) {
- $xeTable.triggerScrollXEvent(evnt);
- }
- $xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
- type: 'header',
- fixed: fixedType
- });
- },
- triggerFooterScrollEvent(evnt, fixedType) {
- const $xeTable = this;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- scrollXLoad
- } = reactData;
- const {
- elemStore,
- intoRunScroll,
- inWheelScroll,
- inVirtualScroll,
- inHeaderScroll,
- inBodyScroll
- } = internalData;
- if (inWheelScroll || inVirtualScroll || inHeaderScroll || inBodyScroll) {
- return;
- }
- const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
- const yHandleEl = $xeTable.$refs.refScrollYHandleElem;
- const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
- const headerScrollElem = getRefElem(elemStore['main-header-scroll']);
- const footerScrollElem = getRefElem(elemStore['main-footer-scroll']);
- if (intoRunScroll) {
- return;
- }
- if (!footerScrollElem) {
- return;
- }
- if (!xHandleEl) {
- return;
- }
- if (!yHandleEl) {
- return;
- }
- const scrollTop = yHandleEl.scrollTop;
- const scrollLeft = footerScrollElem.scrollLeft;
- const isRollX = true;
- const isRollY = false;
- internalData.inFooterScroll = true;
- setScrollLeft(xHandleEl, scrollLeft);
- setScrollLeft(headerScrollElem, scrollLeft);
- setScrollLeft(bodyScrollElem, scrollLeft);
- if (scrollXLoad) {
- $xeTable.triggerScrollXEvent(evnt);
- }
- $xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
- type: 'footer',
- fixed: fixedType
- });
- },
- triggerBodyWheelEvent(evnt) {
- const $xeTable = this;
- const tableProps = $xeTable;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- target,
- deltaY,
- deltaX,
- shiftKey
- } = evnt;
- if (target && /^textarea$/i.test(target.tagName)) {
- return;
- }
- // 如果滚轮未移动或者触摸板未变化位置
- if (!deltaY && !deltaX) {
- return;
- }
- const {
- highlightHoverRow
- } = tableProps;
- const {
- scrollXLoad,
- scrollYLoad,
- expandColumn
- } = reactData;
- const leftFixedWidth = $xeTable.computeLeftFixedWidth;
- const rightFixedWidth = $xeTable.computeRightFixedWidth;
- const {
- elemStore,
- lastScrollTop,
- lastScrollLeft
- } = internalData;
- const rowOpts = $xeTable.computeRowOpts;
- const scrollbarXOpts = $xeTable.computeScrollbarXOpts;
- const scrollbarYOpts = $xeTable.computeScrollbarYOpts;
- const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
- const yHandleEl = $xeTable.$refs.refScrollYHandleElem;
- const leftScrollElem = getRefElem(elemStore['left-body-scroll']);
- const headerScrollElem = getRefElem(elemStore['main-header-scroll']);
- const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
- const footerScrollElem = getRefElem(elemStore['main-footer-scroll']);
- const rightScrollElem = getRefElem(elemStore['right-body-scroll']);
- const rowExpandEl = $xeTable.$refs.refRowExpandElem;
- if (!bodyScrollElem) {
- return;
- }
- const wheelSpeed = getWheelSpeed(reactData.lastScrollTime);
- const deltaTop = shiftKey ? 0 : deltaY * wheelSpeed;
- const deltaLeft = (shiftKey ? deltaX || deltaY : deltaX) * wheelSpeed;
- const currScrollTop = bodyScrollElem.scrollTop;
- const currScrollLeft = bodyScrollElem.scrollLeft;
- const scrollTop = currScrollTop + deltaTop;
- const scrollLeft = currScrollLeft + deltaLeft;
- const isRollX = scrollLeft !== lastScrollLeft;
- const isRollY = scrollTop !== lastScrollTop;
- if (isRollX) {
- // 如果禁用滚动
- if (scrollbarXOpts.visible === 'hidden') {
- evnt.preventDefault();
- return;
- }
- }
- if (isRollY) {
- // 如果禁用滚动
- if (scrollbarYOpts.visible === 'hidden') {
- evnt.preventDefault();
- return;
- }
- const isTopWheel = deltaTop < 0;
- // 如果滚动位置已经是顶部或底部,则不需要触发
- if (isTopWheel ? currScrollTop <= 0 : currScrollTop >= bodyScrollElem.scrollHeight - bodyScrollElem.clientHeight) {
- return;
- }
- }
- if (!(leftFixedWidth || rightFixedWidth || expandColumn)) {
- return;
- }
- if (rowOpts.isHover || highlightHoverRow) {
- $xeTable.clearHoverRow();
- }
- // 用于鼠标纵向滚轮处理
- if (isRollX) {
- evnt.preventDefault();
- internalData.inWheelScroll = true;
- if (browseObj.firefox || browseObj.safari) {
- const currLeftNum = scrollLeft;
- setScrollLeft(xHandleEl, currLeftNum);
- setScrollLeft(bodyScrollElem, currLeftNum);
- setScrollLeft(headerScrollElem, currLeftNum);
- setScrollLeft(footerScrollElem, currLeftNum);
- if (scrollXLoad) {
- $xeTable.triggerScrollXEvent(evnt);
- }
- $xeTable.handleScrollEvent(evnt, isRollY, isRollX, bodyScrollElem.scrollTop, currLeftNum, {
- type: 'table',
- fixed: ''
- });
- } else {
- wheelScrollLeftTo(scrollLeft, offsetLeft => {
- const currLeftNum = offsetLeft;
- setScrollLeft(xHandleEl, currLeftNum);
- setScrollLeft(bodyScrollElem, currLeftNum);
- setScrollLeft(headerScrollElem, currLeftNum);
- setScrollLeft(footerScrollElem, currLeftNum);
- if (scrollXLoad) {
- $xeTable.triggerScrollXEvent(evnt);
- }
- $xeTable.handleScrollEvent(evnt, isRollY, isRollX, bodyScrollElem.scrollTop, currLeftNum, {
- type: 'table',
- fixed: ''
- });
- });
- }
- }
- if (isRollY) {
- evnt.preventDefault();
- if (browseObj.firefox || browseObj.safari) {
- const currTopNum = scrollTop;
- setScrollTop(yHandleEl, currTopNum);
- setScrollTop(bodyScrollElem, currTopNum);
- setScrollTop(leftScrollElem, currTopNum);
- setScrollTop(rightScrollElem, currTopNum);
- setScrollTop(rowExpandEl, currTopNum);
- syncGanttScrollTop($xeTable, currTopNum);
- if (scrollYLoad) {
- $xeTable.triggerScrollYEvent(evnt);
- }
- $xeTable.handleScrollEvent(evnt, isRollY, isRollX, currTopNum, bodyScrollElem.scrollLeft, {
- type: 'table',
- fixed: ''
- });
- } else {
- wheelScrollTopTo(scrollTop - currScrollTop, offsetTop => {
- const currTopNum = bodyScrollElem.scrollTop + offsetTop;
- internalData.inWheelScroll = true;
- setScrollTop(yHandleEl, currTopNum);
- setScrollTop(bodyScrollElem, currTopNum);
- setScrollTop(leftScrollElem, currTopNum);
- setScrollTop(rightScrollElem, currTopNum);
- setScrollTop(rowExpandEl, currTopNum);
- syncGanttScrollTop($xeTable, currTopNum);
- if (scrollYLoad) {
- $xeTable.triggerScrollYEvent(evnt);
- }
- $xeTable.handleScrollEvent(evnt, isRollY, isRollX, currTopNum, bodyScrollElem.scrollLeft, {
- type: 'table',
- fixed: ''
- });
- });
- }
- }
- },
- triggerVirtualScrollXEvent(evnt) {
- const $xeTable = this;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- scrollXLoad
- } = reactData;
- const {
- elemStore,
- inWheelScroll,
- lastScrollTop,
- inHeaderScroll,
- inBodyScroll,
- inFooterScroll
- } = internalData;
- if (inHeaderScroll || inBodyScroll || inFooterScroll) {
- return;
- }
- if (inWheelScroll) {
- return;
- }
- const headerScrollElem = getRefElem(elemStore['main-header-scroll']);
- const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
- const footerScrollElem = getRefElem(elemStore['main-footer-scroll']);
- const yHandleEl = $xeTable.$refs.refScrollYHandleElem;
- const wrapperEl = evnt.currentTarget;
- const {
- scrollLeft
- } = wrapperEl;
- const yBodyEl = yHandleEl || bodyScrollElem;
- let scrollTop = 0;
- if (yBodyEl) {
- scrollTop = yBodyEl.scrollTop;
- }
- const isRollX = true;
- const isRollY = scrollTop !== lastScrollTop;
- internalData.inVirtualScroll = true;
- setScrollLeft(bodyScrollElem, scrollLeft);
- setScrollLeft(headerScrollElem, scrollLeft);
- setScrollLeft(footerScrollElem, scrollLeft);
- if (scrollXLoad) {
- $xeTable.triggerScrollXEvent(evnt);
- }
- $xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
- type: 'table',
- fixed: ''
- });
- },
- triggerVirtualScrollYEvent(evnt) {
- const $xeTable = this;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- scrollYLoad
- } = reactData;
- const {
- elemStore,
- inWheelScroll,
- lastScrollLeft,
- inHeaderScroll,
- inBodyScroll,
- inFooterScroll
- } = internalData;
- if (inHeaderScroll || inBodyScroll || inFooterScroll) {
- return;
- }
- if (inWheelScroll) {
- return;
- }
- const leftScrollElem = getRefElem(elemStore['left-body-scroll']);
- const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
- const rightScrollElem = getRefElem(elemStore['right-body-scroll']);
- const rowExpandEl = $xeTable.$refs.refRowExpandElem;
- const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
- const wrapperEl = evnt.currentTarget;
- const {
- scrollTop
- } = wrapperEl;
- const xBodyEl = xHandleEl || bodyScrollElem;
- let scrollLeft = 0;
- if (xBodyEl) {
- scrollLeft = xBodyEl.scrollLeft;
- }
- const isRollX = scrollLeft !== lastScrollLeft;
- const isRollY = true;
- internalData.inVirtualScroll = true;
- setScrollTop(bodyScrollElem, scrollTop);
- setScrollTop(leftScrollElem, scrollTop);
- setScrollTop(rightScrollElem, scrollTop);
- setScrollTop(rowExpandEl, scrollTop);
- syncGanttScrollTop($xeTable, scrollTop);
- if (scrollYLoad) {
- $xeTable.triggerScrollYEvent(evnt);
- }
- $xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
- type: 'table',
- fixed: ''
- });
- },
- updateScrollXData() {
- const $xeTable = this;
- const reactData = $xeTable;
- const {
- isAllOverflow
- } = reactData;
- handleTableColumn($xeTable);
- $xeTable.updateScrollXSpace();
- return $xeTable.$nextTick().then(() => {
- handleTableColumn($xeTable);
- $xeTable.updateScrollXSpace();
- if (!isAllOverflow) {
- $xeTable.updateScrollYSpace();
- }
- });
- },
- // 更新横向 X 可视渲染上下剩余空间大小
- updateScrollXSpace() {
- const $xeTable = this;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- scrollXLoad,
- overflowX,
- scrollXWidth
- } = reactData;
- const {
- visibleColumn,
- scrollXStore,
- elemStore,
- fullColumnIdData
- } = internalData;
- const $xeGanttView = internalData.xeGanttView;
- const mouseOpts = $xeTable.computeMouseOpts;
- const tableBody = $xeTable.$refs.refTableBody;
- const tableBodyElem = tableBody ? tableBody.$el : null;
- if (tableBodyElem) {
- const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
- const bodyTableElem = getRefElem(elemStore['main-body-table']);
- const headerTableElem = getRefElem(elemStore['main-header-table']);
- const footerTableElem = getRefElem(elemStore['main-footer-table']);
- let xSpaceLeft = 0;
- const firstColumn = visibleColumn[scrollXStore.startIndex];
- if (firstColumn) {
- const colRest = fullColumnIdData[firstColumn.id] || {};
- xSpaceLeft = colRest.oLeft;
- }
- let clientWidth = 0;
- if (bodyScrollElem) {
- clientWidth = bodyScrollElem.clientWidth;
- }
- // 虚拟渲染
- let isScrollXBig = false;
- let ySpaceWidth = scrollXWidth;
- if (scrollXWidth > maxXWidth) {
- // 触右
- if (bodyScrollElem && bodyTableElem && bodyScrollElem.scrollLeft + clientWidth >= maxXWidth) {
- xSpaceLeft = maxXWidth - bodyTableElem.clientWidth;
- } else {
- xSpaceLeft = (maxXWidth - clientWidth) * (xSpaceLeft / (scrollXWidth - clientWidth));
- }
- ySpaceWidth = maxXWidth;
- isScrollXBig = true;
- }
- if (!(scrollXLoad && overflowX)) {
- xSpaceLeft = 0;
- }
- if (headerTableElem) {
- headerTableElem.style.transform = headerTableElem.getAttribute('xvm') ? `translate(${xSpaceLeft}px, 0px)` : '';
- }
- if (bodyTableElem) {
- bodyTableElem.style.transform = `translate(${xSpaceLeft}px, ${reactData.scrollYTop || 0}px)`;
- }
- if (footerTableElem) {
- footerTableElem.style.transform = footerTableElem.getAttribute('xvm') ? `translate(${xSpaceLeft}px, 0px)` : '';
- }
- const containerList = ['main'];
- containerList.forEach(name => {
- const layoutList = ['header', 'body', 'footer'];
- layoutList.forEach(layout => {
- const xSpaceElem = getRefElem(elemStore[`${name}-${layout}-xSpace`]);
- if (xSpaceElem) {
- xSpaceElem.style.width = scrollXLoad ? `${ySpaceWidth}px` : '';
- }
- });
- });
- reactData.scrollXLeft = xSpaceLeft;
- reactData.scrollXWidth = ySpaceWidth;
- reactData.isScrollXBig = isScrollXBig;
- const scrollXSpaceEl = $xeTable.$refs.refScrollXSpaceElem;
- if (scrollXSpaceEl) {
- scrollXSpaceEl.style.width = `${ySpaceWidth}px`;
- }
- calcScrollbar($xeTable);
- if (isScrollXBig && mouseOpts.area) {
- errLog('vxe.error.notProp', ['mouse-config.area']);
- }
- if ($xeGanttView && $xeGanttView.handleUpdateSXSpace) {
- $xeGanttView.handleUpdateSXSpace();
- }
- return $xeTable.$nextTick(() => {
- updateStyle($xeTable);
- });
- }
- },
- updateScrollYData() {
- const $xeTable = this;
- $xeTable.handleTableData();
- $xeTable.updateScrollYSpace();
- return $xeTable.$nextTick().then(() => {
- $xeTable.handleTableData();
- $xeTable.updateScrollYSpace();
- });
- },
- // 更新纵向 Y 可视渲染上下剩余空间大小
- updateScrollYSpace() {
- const $xeTable = this;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- isAllOverflow,
- scrollYLoad,
- expandColumn
- } = reactData;
- const {
- scrollYStore,
- elemStore,
- isResizeCellHeight,
- afterFullData,
- fullAllDataRowIdData,
- rowExpandedMaps
- } = internalData;
- const $xeGanttView = internalData.xeGanttView;
- const {
- startIndex
- } = scrollYStore;
- const mouseOpts = $xeTable.computeMouseOpts;
- const expandOpts = $xeTable.computeExpandOpts;
- const rowOpts = $xeTable.computeRowOpts;
- const cellOpts = $xeTable.computeCellOpts;
- const defaultRowHeight = $xeTable.computeDefaultRowHeight;
- const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
- const bodyTableElem = getRefElem(elemStore['main-body-table']);
- const leftBodyTableElem = getRefElem(elemStore['left-body-table']);
- const rightbodyTableElem = getRefElem(elemStore['right-body-table']);
- const containerList = ['main', 'left', 'right'];
- let ySpaceTop = 0;
- let scrollYHeight = 0;
- let isScrollYBig = false;
- if (scrollYLoad) {
- const isCustomCellHeight = isResizeCellHeight || cellOpts.height || rowOpts.height;
- if (!isCustomCellHeight && !expandColumn && isAllOverflow) {
- scrollYHeight = afterFullData.length * defaultRowHeight;
- if (scrollYHeight > maxYHeight) {
- isScrollYBig = true;
- }
- ySpaceTop = Math.max(0, startIndex * defaultRowHeight);
- } else {
- const firstRow = afterFullData[startIndex];
- let rowid = getRowid($xeTable, firstRow);
- let rowRest = fullAllDataRowIdData[rowid] || {};
- ySpaceTop = rowRest.oTop || 0;
- const lastRow = afterFullData[afterFullData.length - 1];
- rowid = getRowid($xeTable, lastRow);
- rowRest = fullAllDataRowIdData[rowid] || {};
- scrollYHeight = (rowRest.oTop || 0) + (rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight);
- // 是否展开行
- if (expandColumn && rowExpandedMaps[rowid]) {
- scrollYHeight += rowRest.expandHeight || expandOpts.height || 0;
- }
- if (scrollYHeight > maxYHeight) {
- isScrollYBig = true;
- }
- }
- } else {
- if (bodyTableElem) {
- scrollYHeight = bodyTableElem.clientHeight;
- }
- }
- let clientHeight = 0;
- if (bodyScrollElem) {
- clientHeight = bodyScrollElem.clientHeight;
- }
- // 虚拟渲染
- let ySpaceHeight = scrollYHeight;
- let scrollYTop = ySpaceTop;
- if (isScrollYBig) {
- // 触底
- if (bodyScrollElem && bodyTableElem && bodyScrollElem.scrollTop + clientHeight >= maxYHeight) {
- scrollYTop = maxYHeight - bodyTableElem.clientHeight;
- } else {
- scrollYTop = (maxYHeight - clientHeight) * (ySpaceTop / (scrollYHeight - clientHeight));
- }
- ySpaceHeight = maxYHeight;
- }
- if (leftBodyTableElem) {
- leftBodyTableElem.style.transform = `translate(0px, ${scrollYTop}px)`;
- }
- if (bodyTableElem) {
- bodyTableElem.style.transform = `translate(${reactData.scrollXLeft || 0}px, ${scrollYTop}px)`;
- }
- if (rightbodyTableElem) {
- rightbodyTableElem.style.transform = `translate(0px, ${scrollYTop}px)`;
- }
- containerList.forEach(name => {
- const layoutList = ['header', 'body', 'footer'];
- layoutList.forEach(layout => {
- const ySpaceElem = getRefElem(elemStore[`${name}-${layout}-ySpace`]);
- if (ySpaceElem) {
- ySpaceElem.style.height = ySpaceHeight ? `${ySpaceHeight}px` : '';
- }
- });
- });
- const scrollYSpaceEl = $xeTable.$refs.refScrollYSpaceElem;
- if (scrollYSpaceEl) {
- scrollYSpaceEl.style.height = ySpaceHeight ? `${ySpaceHeight}px` : '';
- }
- const rowExpandYSpaceEl = $xeTable.$refs.refRowExpandYSpaceElem;
- if (rowExpandYSpaceEl) {
- rowExpandYSpaceEl.style.height = ySpaceHeight ? `${ySpaceHeight}px` : '';
- }
- reactData.scrollYTop = scrollYTop;
- reactData.scrollYHeight = scrollYHeight;
- reactData.isScrollYBig = isScrollYBig;
- calcScrollbar($xeTable);
- if (isScrollYBig && mouseOpts.area) {
- errLog('vxe.error.notProp', ['mouse-config.area']);
- }
- if ($xeGanttView && $xeGanttView.handleUpdateSYSpace) {
- $xeGanttView.handleUpdateSYSpace();
- }
- return $xeTable.$nextTick().then(() => {
- updateStyle($xeTable);
- });
- },
- updateScrollYStatus() {
- const $xeTable = this;
- return updateScrollYStatus($xeTable);
- },
- /**
- * 如果有滚动条,则滚动到对应的位置
- */
- scrollTo(scrollLeft, scrollTop) {
- const $xeTable = this;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- elemStore
- } = internalData;
- const headerScrollElem = getRefElem(elemStore['main-header-scroll']);
- const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
- const footerScrollElem = getRefElem(elemStore['main-footer-scroll']);
- const leftScrollElem = getRefElem(elemStore['left-body-scroll']);
- const rightScrollElem = getRefElem(elemStore['right-body-scroll']);
- const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
- const yHandleEl = $xeTable.$refs.refScrollYHandleElem;
- internalData.intoRunScroll = true;
- if (scrollLeft) {
- if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(scrollLeft)) {
- scrollTop = scrollLeft.top;
- scrollLeft = scrollLeft.left;
- }
- }
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(scrollLeft)) {
- setScrollLeft(xHandleEl, scrollLeft);
- setScrollLeft(bodyScrollElem, scrollLeft);
- setScrollLeft(headerScrollElem, scrollLeft);
- setScrollLeft(footerScrollElem, scrollLeft);
- loadScrollXData($xeTable);
- }
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(scrollTop)) {
- setScrollTop(yHandleEl, scrollTop);
- setScrollTop(bodyScrollElem, scrollTop);
- setScrollTop(leftScrollElem, scrollTop);
- setScrollTop(rightScrollElem, scrollTop);
- loadScrollYData($xeTable);
- }
- if (reactData.scrollXLoad || reactData.scrollYLoad) {
- return new Promise(resolve => {
- setTimeout(() => {
- $xeTable.$nextTick(() => {
- internalData.intoRunScroll = false;
- resolve();
- });
- }, 30);
- });
- }
- return $xeTable.$nextTick().then(() => {
- internalData.intoRunScroll = false;
- });
- },
- /**
- * 如果有滚动条,则滚动到对应的行
- * @param {Row} row 行对象
- * @param {ColumnInfo} column 列配置
- */
- scrollToRow(row, fieldOrColumn) {
- const $xeTable = this;
- const props = $xeTable;
- const reactData = $xeTable;
- const {
- isAllOverflow,
- scrollYLoad,
- scrollXLoad
- } = reactData;
- const rest = [];
- if (row) {
- if (props.treeConfig) {
- rest.push($xeTable.scrollToTreeRow(row));
- } else {
- rest.push(rowToVisible($xeTable, row));
- }
- }
- if (fieldOrColumn) {
- rest.push(handleScrollToRowColumn($xeTable, fieldOrColumn, row));
- }
- return Promise.all(rest).then(() => {
- if (row) {
- if (!isAllOverflow && (scrollYLoad || scrollXLoad)) {
- calcCellHeight($xeTable);
- calcCellWidth($xeTable);
- }
- return $xeTable.$nextTick();
- }
- });
- },
- /**
- * 如果有滚动条,则滚动到对应的列
- * @param {ColumnInfo} column 列配置
- */
- scrollToColumn(fieldOrColumn) {
- const $xeTable = this;
- return handleScrollToRowColumn($xeTable, fieldOrColumn);
- },
- /**
- * 对于树形结构中,可以直接滚动到指定深层节点中
- * 对于某些特定的场景可能会用到,比如定位到某一节点
- * @param {Row} row 行对象
- */
- scrollToTreeRow(row) {
- const $xeTable = this;
- const props = $xeTable;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- treeConfig
- } = props;
- const {
- isRowGroupStatus
- } = reactData;
- const {
- tableFullData
- } = internalData;
- const rests = [];
- if (treeConfig || isRowGroupStatus) {
- const aggregateOpts = $xeTable.computeAggregateOpts;
- const treeOpts = $xeTable.computeTreeOpts;
- const childrenField = treeOpts.children || treeOpts.childrenField;
- const matchObj = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findTree(tableFullData, item => $xeTable.eqRow(item, row), {
- children: isRowGroupStatus ? aggregateOpts.mapChildrenField : childrenField
- });
- if (matchObj) {
- const nodes = matchObj.nodes;
- nodes.forEach((row, index) => {
- if (index < nodes.length - 1 && !$xeTable.isTreeExpandByRow(row)) {
- rests.push($xeTable.setTreeExpand(row, true));
- }
- });
- }
- }
- return Promise.all(rests).then(() => rowToVisible($xeTable, row));
- },
- /**
- * 手动清除滚动相关信息,还原到初始状态
- */
- clearScroll() {
- const $xeTable = this;
- const internalData = $xeTable;
- const {
- elemStore,
- scrollXStore,
- scrollYStore
- } = internalData;
- const headerScrollElem = getRefElem(elemStore['main-header-scroll']);
- const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
- const footerScrollElem = getRefElem(elemStore['main-footer-scroll']);
- const leftScrollElem = getRefElem(elemStore['left-body-scroll']);
- const rightScrollElem = getRefElem(elemStore['right-body-scroll']);
- const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
- const yHandleEl = $xeTable.$refs.refScrollYHandleElem;
- internalData.intoRunScroll = true;
- setScrollLeft(xHandleEl, 0);
- setScrollLeft(bodyScrollElem, 0);
- setScrollLeft(headerScrollElem, 0);
- setScrollLeft(footerScrollElem, 0);
- setScrollTop(yHandleEl, 0);
- setScrollTop(bodyScrollElem, 0);
- setScrollTop(leftScrollElem, 0);
- setScrollTop(rightScrollElem, 0);
- scrollXStore.startIndex = 0;
- scrollXStore.visibleStartIndex = 0;
- scrollXStore.endIndex = scrollXStore.visibleSize;
- scrollXStore.visibleEndIndex = scrollXStore.visibleSize;
- scrollYStore.startIndex = 0;
- scrollYStore.visibleStartIndex = 0;
- scrollYStore.endIndex = scrollYStore.visibleSize;
- scrollYStore.visibleEndIndex = scrollYStore.visibleSize;
- return $xeTable.$nextTick().then(() => {
- internalData.lastScrollLeft = 0;
- internalData.lastScrollTop = 0;
- internalData.intoRunScroll = false;
- });
- },
- /**
- * 更新表尾合计
- */
- updateFooter() {
- const $xeTable = this;
- const props = $xeTable;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const $xeGrid = $xeTable.$xeGrid;
- const $xeGantt = $xeTable.$xeGantt;
- const {
- showFooter,
- footerData,
- footerMethod
- } = props;
- const {
- visibleColumn,
- afterFullData
- } = internalData;
- let footData = [];
- if (showFooter && footerData && footerData.length) {
- footData = footerData.slice(0);
- } else if (showFooter && footerMethod) {
- footData = visibleColumn.length ? footerMethod({
- columns: visibleColumn,
- data: afterFullData,
- $table: $xeTable,
- $grid: $xeGrid,
- $gantt: $xeGantt
- }) : [];
- }
- reactData.footerTableData = footData;
- $xeTable.handleUpdateFooterMerge();
- $xeTable.dispatchEvent('footer-data-change', {
- visibleColumn: internalData.visibleColumn,
- footData
- }, null);
- return $xeTable.$nextTick();
- },
- /**
- * 更新列状态 updateStatus({ row, column }, cellValue)
- * 如果组件值 v-model 发生 change 时,调用改函数用于更新某一列编辑状态
- * 如果单元格配置了校验规则,则会进行校验
- */
- updateStatus(slotParams, cellValue) {
- const $xeTable = this;
- const props = $xeTable;
- return this.$nextTick().then(() => {
- const {
- editRules
- } = props;
- if (slotParams && editRules) {
- return $xeTable.handleCellRuleUpdateStatus('change', slotParams, cellValue);
- }
- });
- },
- /**
- * 设置合并单元格 [{ row: Row|number, column: ColumnInfo|number, rowspan: number, colspan: number }]
- */
- setMergeCells(merges) {
- const $xeTable = this;
- const props = $xeTable;
- const reactData = $xeTable;
- const internalData = $xeTable;
- if (props.spanMethod) {
- errLog('vxe.error.errConflicts', ['merge-cells', 'span-method']);
- }
- handleBodyMerge($xeTable, merges);
- $xeTable.handleUpdateBodyMerge();
- return $xeTable.$nextTick().then(() => {
- const {
- expandColumn
- } = reactData;
- const {
- mergeBodyList
- } = internalData;
- if (expandColumn && mergeBodyList.length) {
- warnLog('vxe.error.errConflicts', ['type=expand', 'merge-cells | span-method']);
- }
- $xeTable.updateCellAreas();
- return updateStyle($xeTable);
- });
- },
- /**
- * 移除单元格合并 [{row:Row|number, col:ColumnInfo|number}]
- */
- removeMergeCells(merges) {
- const $xeTable = this;
- const props = $xeTable;
- if (props.spanMethod) {
- errLog('vxe.error.errConflicts', ['merge-cells', 'span-method']);
- }
- const rest = removeBodyMerges($xeTable, merges);
- $xeTable.handleUpdateBodyMerge();
- return $xeTable.$nextTick().then(() => {
- $xeTable.updateCellAreas();
- updateStyle($xeTable);
- return rest;
- });
- },
- /**
- * 获取所有被合并的单元格
- */
- getMergeCells() {
- const $xeTable = this;
- const internalData = $xeTable;
- return internalData.mergeBodyList.slice(0);
- },
- /**
- * 清除所有单元格合并
- */
- clearMergeCells() {
- const $xeTable = this;
- const reactData = $xeTable;
- const internalData = $xeTable;
- internalData.mergeBodyList = [];
- internalData.mergeBodyMaps = {};
- internalData.mergeBodyCellMaps = {};
- reactData.mergeBodyFlag++;
- return $xeTable.$nextTick().then(() => {
- return updateStyle($xeTable);
- });
- },
- setMergeHeaderCells(merges) {
- const $xeTable = this;
- handleHeaderMerge($xeTable, merges);
- $xeTable.handleUpdateHeaderMerge();
- return $xeTable.$nextTick().then(() => {
- return updateStyle($xeTable);
- });
- },
- /**
- * 移除表头单元格合并 [{row:Row|number, col:ColumnInfo|number}]
- */
- removeMergeHeaderCells(merges) {
- const $xeTable = this;
- const rest = removeHeaderMerges($xeTable, merges);
- $xeTable.handleUpdateHeaderMerge();
- return $xeTable.$nextTick().then(() => {
- updateStyle($xeTable);
- return rest;
- });
- },
- /**
- * 获取所有被合并的表头单元格
- */
- getMergeHeaderCells() {
- const $xeTable = this;
- const internalData = $xeTable;
- return internalData.mergeHeaderList.slice(0);
- },
- /**
- * 清除所有表头单元格合并
- */
- clearMergeHeaderCells() {
- const $xeTable = this;
- const reactData = $xeTable;
- const internalData = $xeTable;
- internalData.mergeHeaderList = [];
- internalData.mergeHeaderMaps = {};
- internalData.mergeHeaderCellMaps = {};
- reactData.mergeHeadFlag++;
- return $xeTable.$nextTick().then(() => {
- return updateStyle($xeTable);
- });
- },
- setMergeFooterCells(merges) {
- const $xeTable = this;
- const props = $xeTable;
- if (props.footerSpanMethod) {
- errLog('vxe.error.errConflicts', ['merge-footer-cells | merge-footer-items', 'footer-span-method']);
- }
- handleFooterMerge($xeTable, merges);
- $xeTable.handleUpdateFooterMerge();
- return $xeTable.$nextTick().then(() => {
- return updateStyle($xeTable);
- });
- },
- setMergeFooterItems(merges) {
- const $xeTable = this;
- // errLog('vxe.error.delFunc', ['setMergeFooterItems', 'setMergeFooterCells'])
- return $xeTable.setMergeFooterCells(merges);
- },
- removeMergeFooterCells(merges) {
- const $xeTable = this;
- const props = $xeTable;
- if (props.footerSpanMethod) {
- errLog('vxe.error.errConflicts', ['merge-footer-cells | merge-footer-items', 'footer-span-method']);
- }
- const rest = removeFooterMerges($xeTable, merges);
- $xeTable.handleUpdateFooterMerge();
- return $xeTable.$nextTick().then(() => {
- updateStyle($xeTable);
- return rest;
- });
- },
- removeMergeFooterItems(merges) {
- const $xeTable = this;
- // errLog('vxe.error.delFunc', ['removeMergeFooterItems', 'removeMergeFooterCells'])
- return $xeTable.removeMergeFooterCells(merges);
- },
- /**
- * 获取所有被合并的表尾
- */
- getMergeFooterCells() {
- const $xeTable = this;
- const internalData = $xeTable;
- return internalData.mergeFooterList.slice(0);
- },
- getMergeFooterItems() {
- const $xeTable = this;
- // errLog('vxe.error.delFunc', ['getMergeFooterItems', 'getMergeFooterCells'])
- return $xeTable.getMergeFooterCells();
- },
- /**
- * 清除所有表尾合并
- */
- clearMergeFooterCells() {
- const $xeTable = this;
- const reactData = $xeTable;
- const internalData = $xeTable;
- internalData.mergeFooterList = [];
- internalData.mergeFooterMaps = {};
- internalData.mergeFooterCellMaps = {};
- reactData.mergeFootFlag++;
- return $xeTable.$nextTick().then(() => {
- return updateStyle($xeTable);
- });
- },
- clearMergeFooterItems() {
- const $xeTable = this;
- // errLog('vxe.error.delFunc', ['clearMergeFooterItems', 'clearMergeFooterCells'])
- return $xeTable.clearMergeFooterCells();
- },
- handleUpdateAggData() {
- const $xeTable = this;
- const internalData = $xeTable;
- return loadTableData($xeTable, internalData.tableSynchData, true);
- },
- updateZindex() {
- if (this.zIndex) {
- this.tZindex = this.zIndex;
- } else if (this.tZindex < getLastZIndex()) {
- this.tZindex = nextZIndex();
- }
- },
- updateCellAreas() {
- const $xeTable = this;
- const props = $xeTable;
- const {
- mouseConfig
- } = props;
- const mouseOpts = $xeTable.computeMouseOpts;
- if (mouseConfig && mouseOpts.area && $xeTable.handleRecalculateCellAreaEvent) {
- return $xeTable.handleRecalculateCellAreaEvent();
- }
- return $xeTable.$nextTick();
- },
- dispatchEvent(type, params, evnt) {
- const $xeTable = this;
- const $xeGrid = $xeTable.$xeGrid;
- const $xeGantt = $xeTable.$xeGantt;
- $xeTable.$emit(type, createEvent(evnt, {
- $table: $xeTable,
- $grid: $xeGrid,
- $gantt: $xeGantt
- }, params));
- },
- // 已废弃,使用 dispatchEvent
- emitEvent(type, params, evnt) {
- const $xeTable = this;
- $xeTable.dispatchEvent(type, params, evnt);
- },
- focus() {
- this.isActivated = true;
- return this.$nextTick();
- },
- blur() {
- this.isActivated = false;
- return this.$nextTick();
- },
- /**
- * 已废弃,被 connectToolbar 替换
- * @deprecated
- */
- connect($toolbar) {
- return this.connectToolbar($toolbar);
- },
- /**
- * 连接工具栏
- * @param $toolbar
- */
- connectToolbar($toolbar) {
- const $xeTable = this;
- if ($toolbar && $toolbar.syncUpdate) {
- $toolbar.syncUpdate({
- collectColumn: this.collectColumn,
- $table: $xeTable
- });
- this.$toolbar = $toolbar;
- } else {
- errLog('vxe.error.barUnableLink');
- }
- return this.$nextTick();
- },
- handleConnectGanttView($ganttView) {
- const $xeTable = this;
- const internalData = $xeTable;
- if ($ganttView && $ganttView.connectUpdate) {
- $ganttView.connectUpdate({
- $table: $xeTable
- });
- internalData.xeGanttView = $ganttView;
- }
- return $xeTable.$nextTick();
- },
- /*************************
- * Publish methods
- *************************/
- /**
- * 已废弃,被 getCellElement 替换
- * @deprecated
- */
- getCell(row, column) {
- return this.getCellElement(row, column);
- },
- findRowIndexOf(list, row) {
- return row ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findIndexOf(list, item => this.eqRow(item, row)) : -1;
- },
- eqRow(row1, row2) {
- if (row1 && row2) {
- if (row1 === row2) {
- return true;
- }
- return getRowid(this, row1) === getRowid(this, row2);
- }
- return false;
- },
- /*************************
- * Publish methods
- *************************/
- getSetupOptions() {
- return methods_getConfig();
- }
- };
- // Module methods
- 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(',');
- funcs.forEach(name => {
- Methods[name] = function (...args) {
- // if (!this[`_${name}`]) {
- // if ('openExport,openPrint,exportData,openImport,importData,saveFile,readFile,importByFile,print'.split(',').includes(name)) {
- // errLog('vxe.error.reqModule', ['Export'])
- // } else if ('fullValidate,validate'.split(',').includes(name)) {
- // errLog('vxe.error.reqModule', ['Validator'])
- // } else if ('setFilter,openFilter,clearFilter,getCheckedFilters'.split(',').includes(name)) {
- // errLog('vxe.error.reqModule', ['Filter'])
- // } 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)) {
- // errLog('vxe.error.reqModule', ['Edit'])
- // } else if ('openCustom'.split(',').includes(name)) {
- // errLog('vxe.error.reqModule', ['Custom'])
- // }
- // }
- return this[`_${name}`] ? this[`_${name}`](...args) : null;
- };
- });
- /* harmony default export */ var methods = (Methods);
- ;// CONCATENATED MODULE: ./packages/table/src/body.ts
- const {
- getI18n: body_getI18n,
- renderer: body_renderer,
- renderEmptyElement: body_renderEmptyElement
- } = core_.VxeUI;
- const sourceType = 'table';
- const renderType = 'body';
- // 滚动、拖动过程中不需要触发
- const isVMScrollProcess = $xeTable => {
- const tableProps = $xeTable;
- const tableReactData = $xeTable;
- const {
- delayHover
- } = tableProps;
- const {
- lastScrollTime,
- isDragResize
- } = tableReactData;
- return !!(isDragResize || lastScrollTime && Date.now() < lastScrollTime + delayHover);
- };
- function renderLine(h, $xeTable, rowid, params, cellHeight) {
- const tableProps = $xeTable;
- const tableInternalData = $xeTable;
- const {
- column
- } = params;
- const {
- afterFullData
- } = tableInternalData;
- const {
- treeConfig
- } = tableProps;
- const treeOpts = $xeTable.computeTreeOpts;
- const {
- slots,
- treeNode
- } = column;
- const {
- fullAllDataRowIdData
- } = tableInternalData;
- if (slots && slots.line) {
- return $xeTable.callSlot(slots.line, params, h);
- }
- const rowRest = fullAllDataRowIdData[rowid];
- let rLevel = 0;
- let prevRow = null;
- if (rowRest) {
- rLevel = rowRest.level;
- prevRow = rowRest.items[rowRest.treeIndex - 1];
- }
- if (treeConfig && treeNode && (treeOpts.showLine || treeOpts.line)) {
- return [h('div', {
- key: 'tl',
- class: 'vxe-tree--line-wrapper'
- }, [h('div', {
- class: 'vxe-tree--line',
- style: {
- height: `${getRowid($xeTable, afterFullData[0]) === rowid ? 1 : calcTreeLine(params, prevRow)}px`,
- bottom: `-${Math.floor(cellHeight / 2)}px`,
- left: `${rLevel * treeOpts.indent + (rLevel ? 2 - getOffsetSize($xeTable) : 0) + 16}px`
- }
- })])];
- }
- return [];
- }
- /**
- * 渲染列
- */
- function renderTdColumn(h, $xeTable, seq, rowid, fixedType, isOptimizeMode, rowLevel, row, rowIndex, $rowIndex, _rowIndex, column, $columnIndex, columns, items) {
- const tableProps = $xeTable;
- const tableReactData = $xeTable;
- const tableInternalData = $xeTable;
- const $xeGrid = $xeTable.$xeGrid;
- const $xeGantt = $xeTable.$xeGantt;
- const {
- columnKey,
- resizable: allResizable,
- showOverflow: allShowOverflow,
- border,
- height,
- treeConfig,
- cellClassName: allCellClassName,
- cellStyle,
- align: allAlign,
- spanMethod,
- mouseConfig,
- editConfig,
- editRules,
- tooltipConfig,
- padding: allPadding
- } = tableProps;
- const {
- tableData,
- tableColumn,
- dragRow,
- overflowX,
- overflowY,
- currentColumn,
- scrollXLoad,
- scrollYLoad,
- mergeBodyFlag,
- calcCellHeightFlag,
- resizeHeightFlag,
- resizeWidthFlag,
- editStore,
- isAllOverflow,
- validErrorMaps
- } = tableReactData;
- const {
- fullAllDataRowIdData,
- fullColumnIdData,
- mergeBodyCellMaps,
- visibleColumn,
- afterFullData,
- mergeBodyList,
- scrollXStore,
- scrollYStore
- } = tableInternalData;
- const cellOpts = $xeTable.computeCellOpts;
- const validOpts = $xeTable.computeValidOpts;
- const checkboxOpts = $xeTable.computeCheckboxOpts;
- const editOpts = $xeTable.computeEditOpts;
- const tooltipOpts = $xeTable.computeTooltipOpts;
- const virtualXOpts = $xeTable.computeVirtualXOpts;
- const virtualYOpts = $xeTable.computeVirtualYOpts;
- const {
- isAllColumnDrag,
- isAllRowDrag
- } = $xeTable.resizableOpts;
- const rowOpts = $xeTable.computeRowOpts;
- const rowDragOpts = $xeTable.computeRowDragOpts;
- const defaultRowHeight = $xeTable.computeDefaultRowHeight;
- const customCellHeight = calcCellHeightFlag ? cellOpts.height || rowOpts.height : 0;
- const {
- disabledMethod: dragDisabledMethod,
- isCrossDrag,
- isPeerDrag
- } = rowDragOpts;
- const columnOpts = $xeTable.computeColumnOpts;
- const mouseOpts = $xeTable.computeMouseOpts;
- const areaOpts = $xeTable.computeAreaOpts;
- const cellOffsetWidth = $xeTable.computeCellOffsetWidth;
- const {
- selectCellToRow
- } = areaOpts;
- const {
- type,
- cellRender,
- editRender,
- align,
- showOverflow,
- className,
- treeNode,
- rowResize,
- padding,
- verticalAlign,
- slots
- } = column;
- const {
- verticalAlign: allVerticalAlign
- } = cellOpts;
- const {
- actived
- } = editStore;
- const rowRest = fullAllDataRowIdData[rowid] || {};
- const colid = column.id;
- const colRest = fullColumnIdData[colid] || {};
- const renderOpts = editRender || cellRender;
- const compConf = renderOpts ? body_renderer.get(renderOpts.name) : null;
- const compCellClassName = compConf ? compConf.tableCellClassName || compConf.cellClassName : null;
- const compCellStyle = compConf ? compConf.tableCellStyle || compConf.cellStyle : '';
- const showAllTip = tooltipOpts.showAll;
- const columnIndex = colRest.index;
- const _columnIndex = colRest._index;
- const isEdit = isEnableConf(editRender);
- const resizeHeight = resizeHeightFlag ? rowRest.resizeHeight : 0;
- let fixedHiddenColumn = overflowX && (fixedType ? column.fixed !== fixedType : !!column.fixed);
- const isCellPadding = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(padding) ? allPadding === null ? cellOpts.padding : allPadding : padding;
- const cellOverflow = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(showOverflow) ? allShowOverflow : showOverflow;
- const showEllipsis = cellOverflow === 'ellipsis';
- const showTitle = cellOverflow === 'title';
- const showTooltip = cellOverflow === true || cellOverflow === 'tooltip';
- const hasEllipsis = isAllOverflow || showTitle || showTooltip || showEllipsis;
- const showResizable = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isBoolean(column.resizable) ? column.resizable : columnOpts.resizable || allResizable;
- const isCsHeight = !!customCellHeight;
- const isRsHeight = resizeHeight > 0;
- let isDirty;
- const tdOns = {};
- const cellAlign = align || (compConf ? compConf.tableCellAlign : '') || allAlign;
- const cellVerticalAlign = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(verticalAlign) ? allVerticalAlign : verticalAlign;
- const errorValidItem = validErrorMaps[`${rowid}:${colid}`];
- const showValidTip = editRules && validOpts.showMessage && (validOpts.message === 'default' ? height || tableData.length > 1 : validOpts.message === 'inline');
- const tdAttrs = {
- colid
- };
- const cellParams = {
- $table: $xeTable,
- $grid: $xeGrid,
- $gantt: $xeGantt,
- isEdit: false,
- seq,
- rowid,
- row,
- rowIndex,
- $rowIndex,
- _rowIndex,
- column,
- columnIndex,
- $columnIndex,
- _columnIndex,
- fixed: fixedType,
- source: sourceType,
- type: renderType,
- isHidden: !!fixedHiddenColumn,
- level: rowLevel,
- visibleData: afterFullData,
- data: tableData,
- items
- };
- let isRowDragCell = false;
- let isDisabledDrag = false;
- if (rowOpts.drag) {
- isRowDragCell = rowDragOpts.trigger === 'row' || column.dragSort && rowDragOpts.trigger === 'cell';
- }
- if (isRowDragCell) {
- isDisabledDrag = !!(dragDisabledMethod && dragDisabledMethod(cellParams));
- }
- // hover 进入事件
- if (showTitle || showTooltip || showAllTip || tooltipConfig) {
- tdOns.mouseover = evnt => {
- if (!isVMScrollProcess($xeTable)) {
- if (showTitle) {
- updateCellTitle(evnt.currentTarget, column);
- } else if (showTooltip || showAllTip) {
- // 如果配置了显示 tooltip
- $xeTable.triggerBodyTooltipEvent(evnt, cellParams);
- }
- }
- $xeTable.dispatchEvent('cell-mouseenter', Object.assign({
- cell: evnt.currentTarget
- }, cellParams), evnt);
- };
- }
- // hover 退出事件
- if (showTooltip || showAllTip || tooltipConfig) {
- tdOns.mouseleave = evnt => {
- if (!isVMScrollProcess($xeTable)) {
- if (showTooltip || showAllTip) {
- $xeTable.handleTargetLeaveEvent(evnt);
- }
- }
- $xeTable.dispatchEvent('cell-mouseleave', Object.assign({
- cell: evnt.currentTarget
- }, cellParams), evnt);
- };
- }
- // 按下事件处理
- if (isRowDragCell || checkboxOpts.range || mouseConfig) {
- tdOns.mousedown = evnt => {
- $xeTable.triggerCellMousedownEvent(evnt, cellParams);
- };
- }
- // 拖拽列事件
- if (isRowDragCell) {
- tdOns.mouseup = $xeTable.triggerCellMouseupEvent;
- }
- // 点击事件处理
- tdOns.click = evnt => {
- $xeTable.triggerCellClickEvent(evnt, cellParams);
- };
- // 双击事件处理
- tdOns.dblclick = evnt => {
- $xeTable.triggerCellDblclickEvent(evnt, cellParams);
- };
- let isMergeCell = false;
- let mergeColspan = 1;
- let mergeRowspan = 1;
- // 合并行或列
- if (mergeBodyFlag && mergeBodyList.length) {
- const spanRest = mergeBodyCellMaps[`${_rowIndex}:${_columnIndex}`];
- if (spanRest) {
- const {
- rowspan,
- colspan
- } = spanRest;
- if (!rowspan || !colspan) {
- return body_renderEmptyElement($xeTable);
- }
- if (rowspan > 1) {
- isMergeCell = true;
- mergeRowspan = rowspan;
- tdAttrs.rowspan = rowspan;
- }
- if (colspan > 1) {
- isMergeCell = true;
- mergeColspan = colspan;
- tdAttrs.colspan = colspan;
- }
- }
- } else if (spanMethod) {
- // 自定义合并行或列的方法
- const {
- rowspan = 1,
- colspan = 1
- } = spanMethod(cellParams) || {};
- if (!rowspan || !colspan) {
- return body_renderEmptyElement($xeTable);
- }
- if (rowspan > 1) {
- isMergeCell = true;
- mergeRowspan = rowspan;
- tdAttrs.rowspan = rowspan;
- }
- if (colspan > 1) {
- isMergeCell = true;
- mergeColspan = colspan;
- tdAttrs.colspan = colspan;
- }
- }
- // 如果被合并不可隐藏
- if (fixedHiddenColumn && isMergeCell) {
- if (tdAttrs.colspan > 1 || tdAttrs.rowspan > 1) {
- fixedHiddenColumn = false;
- }
- }
- // 如果编辑列开启显示状态
- if (!fixedHiddenColumn && editConfig && (editRender || cellRender) && (editOpts.showStatus || editOpts.showUpdateStatus)) {
- isDirty = $xeTable.isUpdateByRow(row, column.field);
- }
- const isVNAutoHeight = !hasEllipsis && (scrollYLoad || scrollXLoad);
- let cellHeight = getCellRestHeight(rowRest, cellOpts, rowOpts, defaultRowHeight);
- const isLastColumn = $columnIndex === columns.length - 1;
- const isAutoCellWidth = !column.resizeWidth && (column.minWidth === 'auto' || column.width === 'auto');
- let isVNPreEmptyStatus = false;
- if (!isMergeCell) {
- if (!dragRow || getRowid($xeTable, dragRow) !== rowid) {
- if (overflowY && scrollYLoad && !treeConfig && tableData.length > 16 && !virtualYOpts.immediate && (_rowIndex < scrollYStore.visibleStartIndex - scrollYStore.preloadSize || _rowIndex > scrollYStore.visibleEndIndex + scrollYStore.preloadSize)) {
- isVNPreEmptyStatus = true;
- } else if (overflowX && scrollXLoad && tableColumn.length > 10 && !virtualXOpts.immediate && !column.fixed && (_columnIndex < scrollXStore.visibleStartIndex - scrollXStore.preloadSize || _columnIndex > scrollXStore.visibleEndIndex + scrollXStore.preloadSize)) {
- isVNPreEmptyStatus = true;
- }
- }
- }
- if (mergeRowspan > 1) {
- const mEndRow = afterFullData[_rowIndex + mergeRowspan - 1];
- if (mEndRow) {
- const meRowRest = fullAllDataRowIdData[getRowid($xeTable, mEndRow)];
- if (meRowRest) {
- cellHeight += meRowRest.oTop + getCellRestHeight(meRowRest, cellOpts, rowOpts, defaultRowHeight) - rowRest.oTop - getCellRestHeight(rowRest, cellOpts, rowOpts, defaultRowHeight);
- }
- }
- }
- const tcStyle = {};
- if (hasEllipsis && resizeWidthFlag) {
- let mergeColWidth = 0;
- if (mergeColspan > 1) {
- for (let index = 1; index < mergeColspan; index++) {
- const nextColumn = visibleColumn[columnIndex + index];
- if (nextColumn) {
- mergeColWidth += nextColumn.renderWidth;
- }
- }
- }
- tcStyle.width = `${column.renderWidth + mergeColWidth - cellOffsetWidth}px`;
- }
- if (scrollYLoad || scrollXLoad || hasEllipsis || isCsHeight || isRsHeight) {
- tcStyle.height = `${cellHeight}px`;
- } else {
- tcStyle.minHeight = `${cellHeight}px`;
- }
- const tdVNs = [];
- if (fixedHiddenColumn && isAllOverflow) {
- tdVNs.push(h('div', {
- key: 'tc',
- class: ['vxe-cell', {
- 'c--title': showTitle,
- 'c--tooltip': showTooltip,
- 'c--ellipsis': showEllipsis
- }],
- style: tcStyle
- }));
- } else {
- // 渲染单元格
- if (treeConfig) {
- tdVNs.push(...renderLine(h, $xeTable, rowid, cellParams, cellHeight));
- }
- tdVNs.push(h('div', {
- key: 'tc',
- class: ['vxe-cell', {
- 'c--title': showTitle,
- 'c--tooltip': showTooltip,
- 'c--ellipsis': showEllipsis
- }],
- style: tcStyle,
- attrs: {
- title: showTitle ? $xeTable.getCellLabel(row, column) : null
- }
- }, isVNPreEmptyStatus ? [] : [h('div', {
- attrs: {
- colid,
- rowid
- },
- class: 'vxe-cell--wrapper vxe-body-cell--wrapper'
- }, column.renderCell(h, cellParams))]));
- if (showValidTip && errorValidItem) {
- const errRule = errorValidItem.rule;
- const validSlot = slots ? slots.valid : null;
- const validParams = {
- ...cellParams,
- ...errorValidItem,
- rule: errorValidItem
- };
- tdVNs.push(h('div', {
- key: 'tcv',
- class: ['vxe-cell--valid-error-tip', getClass(validOpts.className, errorValidItem)],
- style: errRule && errRule.maxWidth ? {
- width: `${errRule.maxWidth}px`
- } : undefined
- }, [h('div', {
- class: `vxe-cell--valid-error-wrapper vxe-cell--valid-error-theme-${validOpts.theme || 'normal'}`
- }, [validSlot ? $xeTable.callSlot(validSlot, validParams, h) : [h('span', {
- class: 'vxe-cell--valid-error-msg'
- }, errorValidItem.content)]])]));
- }
- }
- let showAreaRowStatus = false;
- if (mouseConfig && mouseOpts.area && !_columnIndex && selectCellToRow) {
- showAreaRowStatus = true;
- }
- if (!fixedHiddenColumn && showResizable && isAllColumnDrag) {
- tdVNs.push(h('div', {
- key: 'tcc',
- class: ['vxe-cell--col-resizable', {
- 'is--line': !border || border === 'none'
- }],
- on: {
- mousedown: evnt => $xeTable.handleColResizeMousedownEvent(evnt, fixedType, cellParams),
- dblclick: evnt => $xeTable.handleColResizeDblclickEvent(evnt, cellParams)
- }
- }));
- }
- if ((rowResize || isAllRowDrag) && rowOpts.resizable) {
- tdVNs.push(h('div', {
- key: 'tcr',
- class: 'vxe-cell--row-resizable',
- on: {
- mousedown: evnt => $xeTable.handleRowResizeMousedownEvent(evnt, cellParams),
- dblclick: evnt => $xeTable.handleRowResizeDblclickEvent(evnt, cellParams)
- }
- }));
- }
- return h('td', {
- class: ['vxe-table--column vxe-body--column', colid, cellVerticalAlign ? `col--vertical-${cellVerticalAlign}` : '', cellAlign ? `col--${cellAlign}` : '', type ? `col--${type}` : '', {
- 'col--last': isLastColumn,
- 'col--tree-node': treeNode,
- 'col--edit': isEdit,
- 'col--ellipsis': hasEllipsis,
- 'col--cs-height': isCsHeight,
- 'col--rs-height': isRsHeight,
- 'col--to-row': showAreaRowStatus,
- 'col--auto-height': isVNAutoHeight,
- 'fixed--width': !isAutoCellWidth,
- 'fixed--hidden': fixedHiddenColumn,
- 'is--padding': isCellPadding,
- 'is--progress': fixedHiddenColumn && isAllOverflow || isVNPreEmptyStatus,
- 'is--drag-cell': isRowDragCell && (isCrossDrag || isPeerDrag || !rowLevel),
- 'is--drag-disabled': isDisabledDrag,
- 'col--dirty': isDirty,
- 'col--active': editConfig && isEdit && actived.row === row && (actived.column === column || editOpts.mode === 'row'),
- 'col--valid-error': !!errorValidItem,
- 'col--current': currentColumn === column
- }, getClass(compCellClassName, cellParams), getClass(className, cellParams), getClass(allCellClassName, cellParams)],
- key: columnKey || scrollXLoad || scrollYLoad || columnOpts.useKey || rowOpts.useKey || columnOpts.drag ? column.id : $columnIndex,
- attrs: tdAttrs,
- 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),
- on: tdOns
- }, isOptimizeMode && fixedHiddenColumn ? [] : tdVNs);
- }
- function renderRows(h, _vm, fixedType, isOptimizeMode, tableData, tableColumn) {
- const $xeTable = _vm.$parent;
- const tableProps = $xeTable;
- const tableReactData = $xeTable;
- const tableInternalData = $xeTable;
- const $xeGrid = $xeTable.$xeGrid;
- const $xeGantt = $xeTable.$xeGantt;
- const {
- stripe,
- rowKey,
- highlightHoverRow,
- rowClassName,
- rowStyle,
- editConfig,
- treeConfig
- } = tableProps;
- const {
- hasFixedColumn,
- treeExpandedFlag,
- scrollXLoad,
- scrollYLoad,
- isAllOverflow,
- rowExpandedFlag,
- expandColumn,
- selectRadioRow,
- pendingRowFlag,
- rowExpandHeightFlag,
- isRowGroupStatus
- } = tableReactData;
- const {
- fullAllDataRowIdData,
- fullColumnIdData,
- treeExpandedMaps,
- pendingRowMaps,
- rowExpandedMaps
- } = tableInternalData;
- const checkboxOpts = $xeTable.computeCheckboxOpts;
- const radioOpts = $xeTable.computeRadioOpts;
- const treeOpts = $xeTable.computeTreeOpts;
- const editOpts = $xeTable.computeEditOpts;
- const rowOpts = $xeTable.computeRowOpts;
- const columnOpts = $xeTable.computeColumnOpts;
- const {
- transform,
- seqMode
- } = treeOpts;
- const childrenField = treeOpts.children || treeOpts.childrenField;
- const rows = [];
- const {
- handleGetRowId
- } = createHandleGetRowId($xeTable);
- const isDeepRow = treeConfig || isRowGroupStatus;
- tableData.forEach((row, $rowIndex) => {
- const trOn = {};
- const rowid = handleGetRowId(row);
- const rowRest = fullAllDataRowIdData[rowid] || {};
- let rowIndex = $rowIndex;
- let rowLevel = 0;
- let seq = -1;
- let _rowIndex = -1;
- const hasRowGroupAggregate = isRowGroupStatus && row.isAggregate;
- // 当前行事件
- if (rowOpts.isHover || highlightHoverRow) {
- trOn.mouseover = evnt => {
- if (isVMScrollProcess($xeTable)) {
- return;
- }
- $xeTable.triggerHoverEvent(evnt, {
- row,
- rowIndex
- });
- };
- trOn.mouseleave = () => {
- if (isVMScrollProcess($xeTable)) {
- return;
- }
- $xeTable.clearHoverRow();
- };
- }
- if (rowRest) {
- rowIndex = rowRest.index;
- _rowIndex = rowRest._index;
- rowLevel = rowRest.level;
- seq = rowRest.seq;
- if (hasRowGroupAggregate || treeConfig && transform && seqMode === 'increasing') {
- seq = rowRest._index + 1;
- } else if (treeConfig && seqMode === 'fixed') {
- seq = rowRest._tIndex + 1;
- }
- }
- const params = {
- $table: $xeTable,
- seq,
- rowid,
- fixed: fixedType,
- type: renderType,
- level: rowLevel,
- row,
- rowIndex,
- $rowIndex,
- _rowIndex
- };
- // 行是否被展开
- const isExpandRow = expandColumn && !!rowExpandedFlag && !!rowExpandedMaps[rowid];
- // 树节点是否被展开
- let isExpandTree = false;
- let rowChildren = [];
- // 是否新增行
- let isNewRow = false;
- if (editConfig) {
- isNewRow = $xeTable.isInsertByRow(row);
- }
- if (treeConfig && !scrollYLoad && !transform) {
- rowChildren = row[childrenField];
- isExpandTree = !!treeExpandedFlag && rowChildren && rowChildren.length > 0 && !!treeExpandedMaps[rowid];
- }
- // 拖拽行事件
- if (rowOpts.drag && !isRowGroupStatus && (!treeConfig || transform)) {
- trOn.dragstart = $xeTable.handleRowDragDragstartEvent;
- trOn.dragend = $xeTable.handleRowDragDragendEvent;
- trOn.dragover = $xeTable.handleRowDragDragoverEvent;
- }
- const trClass = ['vxe-body--row', isDeepRow ? `row--level-${rowLevel}` : '', {
- 'row--stripe': stripe && (_rowIndex + 1) % 2 === 0,
- 'is--new': isNewRow,
- 'is--expand-row': isExpandRow,
- 'is--expand-tree': isExpandTree,
- 'row--new': isNewRow && (editOpts.showStatus || editOpts.showInsertStatus),
- 'row--radio': radioOpts.highlight && selectRadioRow === row,
- 'row--checked': checkboxOpts.highlight && $xeTable.isCheckedByCheckboxRow(row),
- 'row--pending': !!pendingRowFlag && !!pendingRowMaps[rowid],
- 'row--group': hasRowGroupAggregate
- }, rowClassName ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(rowClassName) ? rowClassName(params) : rowClassName : ''];
- const tdVNs = tableColumn.map((column, $columnIndex) => {
- return renderTdColumn(h, $xeTable, seq, rowid, fixedType, isOptimizeMode, rowLevel, row, rowIndex, $rowIndex, _rowIndex, column, $columnIndex, tableColumn, tableData);
- });
- rows.push(h('tr', {
- class: trClass,
- attrs: {
- rowid
- },
- style: rowStyle ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(rowStyle) ? rowStyle(params) : rowStyle : undefined,
- key: rowKey || scrollXLoad || scrollYLoad || rowOpts.useKey || rowOpts.drag || columnOpts.drag || isRowGroupStatus || treeConfig ? rowid : $rowIndex,
- on: trOn
- }, tdVNs));
- // 如果行被展开了
- if (isExpandRow) {
- const expandOpts = $xeTable.computeExpandOpts;
- const {
- height: expandHeight,
- padding,
- mode: expandMode
- } = expandOpts;
- if (expandMode === 'fixed') {
- rows.push(h('tr', {
- class: 'vxe-body--row-expanded-place',
- key: `expand_${rowid}`,
- attrs: {
- rowid
- }
- }, [h('td', {
- class: 'vxe-body--row-expanded-place-column',
- attrs: {
- colspan: tableColumn.length
- },
- style: {
- height: `${rowExpandHeightFlag ? rowRest.expandHeight || expandHeight : 0}px`
- }
- })]));
- } else {
- const cellStyle = {};
- if (expandHeight) {
- cellStyle.height = `${expandHeight}px`;
- }
- if (treeConfig) {
- cellStyle.paddingLeft = `${rowLevel * treeOpts.indent + 30}px`;
- }
- const {
- showOverflow
- } = expandColumn || {};
- const colid = expandColumn.id;
- const colRest = fullColumnIdData[colid] || {};
- const hasEllipsis = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(showOverflow) ? isAllOverflow : showOverflow;
- let columnIndex = -1;
- let $columnIndex = -1;
- let _columnIndex = -1;
- if (colRest) {
- columnIndex = colRest.index;
- $columnIndex = colRest.$index;
- _columnIndex = colRest._index;
- }
- const expandParams = {
- $grid: $xeGrid,
- $table: $xeTable,
- $gantt: $xeGantt,
- seq,
- column: expandColumn,
- columnIndex,
- $columnIndex,
- _columnIndex,
- fixed: fixedType,
- source: sourceType,
- type: renderType,
- level: rowLevel,
- row,
- rowid,
- rowIndex,
- $rowIndex,
- _rowIndex,
- isHidden: false,
- isEdit: false,
- visibleData: [],
- data: [],
- items: []
- };
- rows.push(h('tr', {
- class: ['vxe-body--expanded-row', {
- 'is--padding': padding
- }],
- key: `expand_${rowid}`
- }, [h('td', {
- class: ['vxe-body--expanded-column', {
- 'fixed--hidden': fixedType && !hasFixedColumn,
- 'col--ellipsis': hasEllipsis
- }],
- attrs: {
- colspan: tableColumn.length
- }
- }, [h('div', {
- class: ['vxe-body--expanded-cell', {
- 'is--ellipsis': expandHeight
- }],
- style: cellStyle
- }, [expandColumn.renderData(h, expandParams)])])]));
- }
- }
- // 如果是树形表格
- if (isExpandTree) {
- rows.push(...renderRows(h, _vm, fixedType, isOptimizeMode, rowChildren, tableColumn));
- }
- });
- return rows;
- }
- /* harmony default export */ var body = ({
- name: 'VxeTableBody',
- props: {
- tableData: Array,
- tableColumn: Array,
- fixedColumn: Array,
- fixedType: {
- type: String,
- default: ''
- }
- },
- mounted() {
- const _vm = this;
- const props = _vm;
- const $xeTable = _vm.$parent;
- const tableInternalData = $xeTable;
- const {
- fixedType
- } = props;
- const {
- elemStore
- } = tableInternalData;
- const prefix = `${fixedType || 'main'}-body-`;
- elemStore[`${prefix}wrapper`] = _vm.$refs.refElem;
- elemStore[`${prefix}scroll`] = _vm.$refs.refBodyScroll;
- elemStore[`${prefix}table`] = _vm.$refs.refBodyTable;
- elemStore[`${prefix}colgroup`] = _vm.$refs.refBodyColgroup;
- elemStore[`${prefix}list`] = _vm.$refs.refBodyTBody;
- elemStore[`${prefix}xSpace`] = _vm.$refs.refBodyXSpace;
- elemStore[`${prefix}ySpace`] = _vm.$refs.refBodyYSpace;
- elemStore[`${prefix}emptyBlock`] = _vm.$refs.refBodyEmptyBlock;
- },
- destroyed() {
- const props = this;
- const $xeTable = this.$parent;
- const tableInternalData = $xeTable;
- const {
- fixedType
- } = props;
- const {
- elemStore
- } = tableInternalData;
- const prefix = `${fixedType || 'main'}-body-`;
- elemStore[`${prefix}wrapper`] = null;
- elemStore[`${prefix}scroll`] = null;
- elemStore[`${prefix}table`] = null;
- elemStore[`${prefix}colgroup`] = null;
- elemStore[`${prefix}list`] = null;
- elemStore[`${prefix}xSpace`] = null;
- elemStore[`${prefix}ySpace`] = null;
- elemStore[`${prefix}emptyBlock`] = null;
- },
- render(h) {
- const props = this;
- const $xeTable = this.$parent;
- const tableProps = $xeTable;
- const tableReactData = $xeTable;
- const tableInternalData = $xeTable;
- const $xeGrid = $xeTable.$xeGrid;
- const $xeGantt = $xeTable.$xeGantt;
- const slots = $xeTable.$scopedSlots;
- const {
- xID
- } = $xeTable;
- const {
- fixedColumn,
- fixedType,
- tableColumn
- } = props;
- const {
- spanMethod,
- footerSpanMethod,
- mouseConfig
- } = tableProps;
- const {
- isGroup,
- tableData,
- isColLoading,
- overflowX,
- scrollXLoad,
- scrollYLoad,
- isAllOverflow,
- expandColumn,
- dragRow,
- dragCol
- } = tableReactData;
- const {
- visibleColumn,
- fullAllDataRowIdData,
- fullColumnIdData
- } = tableInternalData;
- const emptyOpts = $xeTable.computeEmptyOpts;
- const mouseOpts = $xeTable.computeMouseOpts;
- const expandOpts = $xeTable.computeExpandOpts;
- let renderDataList = tableData;
- let renderColumnList = tableColumn;
- let isOptimizeMode = false;
- // 如果是使用优化模式
- if (scrollXLoad || scrollYLoad || isAllOverflow) {
- if (expandColumn && expandOpts.mode !== 'fixed' || spanMethod || footerSpanMethod) {
- // 如果不支持优化模式
- } else {
- isOptimizeMode = true;
- }
- }
- if (!isColLoading && (fixedType || !overflowX)) {
- renderColumnList = visibleColumn;
- }
- if (fixedType) {
- if (isOptimizeMode) {
- renderColumnList = fixedColumn || [];
- }
- }
- // 行拖拽
- if (scrollYLoad && dragRow) {
- if (renderDataList.length > 2) {
- const dRowRest = fullAllDataRowIdData[getRowid($xeTable, dragRow)];
- if (dRowRest) {
- const drIndex = dRowRest._index;
- const firstRow = renderDataList[0];
- const lastRow = renderDataList[renderDataList.length - 1];
- const firstRowRest = fullAllDataRowIdData[getRowid($xeTable, firstRow)];
- const lastRowRest = fullAllDataRowIdData[getRowid($xeTable, lastRow)];
- if (firstRowRest && lastRowRest) {
- const frIndex = firstRowRest._index;
- const lrIndex = lastRowRest._index;
- if (drIndex < frIndex) {
- renderDataList = [dragRow].concat(renderDataList);
- } else if (drIndex > lrIndex) {
- renderDataList = renderDataList.concat([dragRow]);
- }
- }
- }
- }
- }
- if (!fixedType && !isGroup) {
- // 列拖拽
- if (scrollXLoad && dragCol) {
- if (renderColumnList.length > 2) {
- const dCowRest = fullColumnIdData[dragCol.id];
- if (dCowRest) {
- const dcIndex = dCowRest._index;
- const firstCol = renderColumnList[0];
- const lastCol = renderColumnList[renderColumnList.length - 1];
- const firstColRest = fullColumnIdData[firstCol.id];
- const lastColRest = fullColumnIdData[lastCol.id];
- if (firstColRest && lastColRest) {
- const fcIndex = firstColRest._index;
- const lcIndex = lastColRest._index;
- if (dcIndex < fcIndex) {
- renderColumnList = [dragCol].concat(renderColumnList);
- } else if (dcIndex > lcIndex) {
- renderColumnList = renderColumnList.concat([dragCol]);
- }
- }
- }
- }
- }
- }
- let emptyContent;
- const emptySlot = slots ? slots.empty : null;
- const emptyParams = {
- $table: $xeTable,
- $grid: $xeGrid,
- $gantt: $xeGantt
- };
- if (emptySlot) {
- emptyContent = emptySlot.call($xeTable, emptyParams);
- } else {
- const compConf = emptyOpts.name ? body_renderer.get(emptyOpts.name) : null;
- const rtEmptyView = compConf ? compConf.renderTableEmpty || compConf.renderTableEmptyView || compConf.renderEmpty : null;
- if (rtEmptyView) {
- emptyContent = getSlotVNs(rtEmptyView.call($xeTable, h, emptyOpts, emptyParams));
- } else {
- emptyContent = tableProps.emptyText || body_getI18n('vxe.table.emptyText');
- }
- }
- const ons = {
- scroll(evnt) {
- $xeTable.triggerBodyScrollEvent(evnt, fixedType);
- }
- };
- return h('div', {
- ref: 'refElem',
- class: ['vxe-table--body-wrapper', fixedType ? `fixed-${fixedType}--wrapper` : 'body--wrapper'],
- attrs: {
- xid: xID
- }
- }, [h('div', {
- ref: 'refBodyScroll',
- class: 'vxe-table--body-inner-wrapper',
- on: ons
- }, [fixedType ? body_renderEmptyElement($xeTable) : h('div', {
- ref: 'refBodyXSpace',
- class: 'vxe-body--x-space'
- }), h('div', {
- ref: 'refBodyYSpace',
- class: 'vxe-body--y-space'
- }), h('table', {
- ref: 'refBodyTable',
- class: 'vxe-table--body',
- attrs: {
- xid: xID,
- cellspacing: 0,
- cellpadding: 0,
- border: 0,
- xvm: isOptimizeMode ? '1' : null
- }
- }, [
- /**
- * 列宽
- */
- h('colgroup', {
- ref: 'refBodyColgroup'
- }, renderColumnList.map((column, $columnIndex) => {
- return h('col', {
- attrs: {
- name: column.id
- },
- key: $columnIndex,
- style: {
- width: `${column.renderWidth}px`
- }
- });
- })),
- /**
- * 内容
- */
- h('tbody', {
- ref: 'refBodyTBody'
- }, renderRows(h, this, fixedType, isOptimizeMode, renderDataList, renderColumnList))]), h('div', {
- class: 'vxe-table--checkbox-range'
- }), mouseConfig && mouseOpts.area ? h('div', {
- class: 'vxe-table--cell-area',
- attrs: {
- xid: xID
- }
- }, [h('span', {
- class: 'vxe-table--cell-main-area'
- }, mouseOpts.extension ? [h('span', {
- class: 'vxe-table--cell-main-area-btn',
- on: {
- mousedown(evnt) {
- if ($xeTable.triggerCellAreaExtendMousedownEvent) {
- $xeTable.triggerCellAreaExtendMousedownEvent(evnt, {
- $table: $xeTable,
- fixed: fixedType,
- type: renderType
- });
- }
- }
- }
- })] : null), h('span', {
- class: 'vxe-table--cell-clip-area'
- }), h('span', {
- class: 'vxe-table--cell-extend-area'
- }), h('span', {
- class: 'vxe-table--cell-multi-area'
- }), h('span', {
- class: 'vxe-table--cell-active-area'
- }), h('span', {
- class: 'vxe-table--cell-row-status-area'
- })]) : body_renderEmptyElement($xeTable), !fixedType ? h('div', {
- class: 'vxe-table--empty-block',
- ref: 'emptyBlock'
- }, [h('div', {
- class: 'vxe-table--empty-content'
- }, emptyContent)]) : body_renderEmptyElement($xeTable)])]);
- }
- });
- ;// CONCATENATED MODULE: ./packages/table/src/header.ts
- const {
- renderer: header_renderer,
- renderEmptyElement: header_renderEmptyElement
- } = core_.VxeUI;
- const header_sourceType = 'table';
- const header_renderType = 'header';
- function getColumnFirstChild(column) {
- const {
- children
- } = column;
- if (children && children.length) {
- return getColumnFirstChild(children[0]);
- }
- return column;
- }
- function getColumnLastChild(column) {
- const {
- children
- } = column;
- if (children && children.length) {
- return getColumnLastChild(children[children.length - 1]);
- }
- return column;
- }
- function header_renderRows(h, _vm, isGroup, isOptimizeMode, headerGroups, $rowIndex, cols) {
- const props = _vm;
- const $xeTable = _vm.$parent;
- const $xeGrid = $xeTable.$xeGrid;
- const $xeGantt = $xeTable.$xeGantt;
- const tableProps = $xeTable;
- const tableReactData = $xeTable;
- const tableInternalData = $xeTable;
- const {
- fixedType
- } = props;
- const {
- resizable: allResizable,
- columnKey,
- showCustomHeader,
- headerCellClassName,
- headerCellStyle,
- showHeaderOverflow: allColumnHeaderOverflow,
- headerAlign: allHeaderAlign,
- align: allAlign,
- mouseConfig
- } = tableProps;
- const {
- currentColumn,
- dragCol,
- scrollXLoad,
- scrollYLoad,
- overflowX,
- mergeHeadFlag,
- tableColumn
- } = tableReactData;
- const {
- fullColumnIdData,
- scrollXStore,
- mergeHeaderList,
- mergeHeaderCellMaps
- } = tableInternalData;
- const virtualXOpts = $xeTable.computeVirtualXOpts;
- const columnOpts = $xeTable.computeColumnOpts;
- const columnDragOpts = $xeTable.computeColumnDragOpts;
- const cellOpts = $xeTable.computeCellOpts;
- const defaultRowHeight = $xeTable.computeDefaultRowHeight;
- const headerCellOpts = $xeTable.computeHeaderCellOpts;
- const currCellHeight = getCalcHeight(headerCellOpts.height) || defaultRowHeight;
- const {
- disabledMethod: dragDisabledMethod,
- isCrossDrag,
- isPeerDrag
- } = columnDragOpts;
- const isLastRow = $rowIndex === headerGroups.length - 1;
- return cols.map((column, $columnIndex) => {
- const {
- type,
- showHeaderOverflow,
- headerAlign,
- align,
- filters,
- headerClassName,
- editRender,
- cellRender
- } = column;
- // const { enabled } = tooltipOpts
- const colid = column.id;
- const colRest = fullColumnIdData[colid] || {};
- const renderOpts = editRender || cellRender;
- const compConf = renderOpts ? header_renderer.get(renderOpts.name) : null;
- const isColGroup = column.children && column.children.length;
- const fixedHiddenColumn = overflowX && !isColGroup && (fixedType ? column.fixed !== fixedType : !!column.fixed);
- const isPadding = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isBoolean(headerCellOpts.padding) ? headerCellOpts.padding : cellOpts.padding;
- 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;
- const headAlign = headerAlign || (compConf ? compConf.tableHeaderCellAlign : '') || allHeaderAlign || align || (compConf ? compConf.tableCellAlign : '') || allAlign;
- const showEllipsis = headOverflow === 'ellipsis';
- const showTitle = headOverflow === 'title';
- const showTooltip = headOverflow === true || headOverflow === 'tooltip';
- const hasEllipsis = showTitle || showTooltip || showEllipsis;
- let hasFilter = false;
- let firstFilterOption = null;
- if (filters) {
- firstFilterOption = filters[0];
- hasFilter = filters.some(item => item.checked);
- }
- const columnIndex = colRest.index;
- const _columnIndex = showCustomHeader ? $columnIndex : colRest._index;
- const cellParams = {
- $table: $xeTable,
- $grid: $xeGrid,
- $gantt: $xeGantt,
- $rowIndex,
- column,
- columnIndex,
- $columnIndex,
- _columnIndex,
- firstFilterOption: firstFilterOption,
- fixed: fixedType,
- source: header_sourceType,
- type: header_renderType,
- isHidden: fixedHiddenColumn,
- hasFilter
- };
- const thAttrs = {
- colid
- };
- let isMergeCell = false;
- // 合并行或列
- if (!showCustomHeader) {
- thAttrs.colspan = column.colSpan > 1 ? column.colSpan : null;
- thAttrs.rowspan = column.rowSpan > 1 ? column.rowSpan : null;
- }
- if (mergeHeadFlag && mergeHeaderList.length && (showCustomHeader || isLastRow)) {
- const spanRest = mergeHeaderCellMaps[`${$rowIndex}:${showCustomHeader ? $columnIndex : _columnIndex}`];
- if (spanRest) {
- const {
- rowspan,
- colspan
- } = spanRest;
- if (!rowspan || !colspan) {
- return null;
- }
- if (rowspan > 1) {
- isMergeCell = true;
- thAttrs.rowspan = rowspan;
- }
- if (colspan > 1) {
- isMergeCell = true;
- thAttrs.colspan = colspan;
- }
- }
- }
- const thOns = {
- click: evnt => $xeTable.triggerHeaderCellClickEvent(evnt, cellParams),
- dblclick: evnt => $xeTable.triggerHeaderCellDblclickEvent(evnt, cellParams)
- };
- const isColDragCell = columnOpts.drag && columnDragOpts.trigger === 'cell';
- let isDisabledDrag = false;
- if (isColDragCell) {
- isDisabledDrag = !!(dragDisabledMethod && dragDisabledMethod(cellParams));
- }
- // 按下事件处理
- if (mouseConfig || isColDragCell) {
- thOns.mousedown = evnt => $xeTable.triggerHeaderCellMousedownEvent(evnt, cellParams);
- }
- // 拖拽列事件
- if (columnOpts.drag) {
- thOns.dragstart = $xeTable.handleHeaderCellDragDragstartEvent;
- thOns.dragend = $xeTable.handleHeaderCellDragDragendEvent;
- thOns.dragover = $xeTable.handleHeaderCellDragDragoverEvent;
- if (isColDragCell) {
- thOns.mouseup = $xeTable.handleHeaderCellDragMouseupEvent;
- }
- }
- const isLastColumn = $columnIndex === cols.length - 1;
- const showResizable = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isBoolean(column.resizable) ? column.resizable : columnOpts.resizable || allResizable;
- const isAutoCellWidth = !column.resizeWidth && (column.minWidth === 'auto' || column.width === 'auto');
- let isVNPreEmptyStatus = false;
- if (isOptimizeMode && overflowX && !isGroup && !isMergeCell) {
- if (!dragCol || dragCol.id !== colid) {
- if (scrollXLoad && tableColumn.length > 10 && !column.fixed && !virtualXOpts.immediate && (_columnIndex < scrollXStore.visibleStartIndex - scrollXStore.preloadSize || _columnIndex > scrollXStore.visibleEndIndex + scrollXStore.preloadSize)) {
- isVNPreEmptyStatus = true;
- }
- }
- }
- const tcStyle = {};
- if (hasEllipsis) {
- tcStyle.height = `${currCellHeight}px`;
- } else {
- tcStyle.minHeight = `${currCellHeight}px`;
- }
- if (showCustomHeader) {
- // custom
- } else if (isColGroup && !isLastRow) {
- const firstCol = getColumnFirstChild(column);
- const lastCol = getColumnLastChild(column);
- if (firstCol && lastCol && firstCol.id !== lastCol.id) {
- const firstColRest = fullColumnIdData[firstCol.id];
- const lastColRest = fullColumnIdData[lastCol.id];
- if (firstColRest && lastColRest) {
- tcStyle.width = `${lastColRest.oLeft - firstColRest.oLeft + lastCol.renderWidth}px`;
- }
- }
- }
- return h('th', {
- class: ['vxe-table--column vxe-header--column', colid, fixedHiddenColumn ? 'fixed--hidden' : 'fixed--visible', {
- [`col--${headAlign}`]: headAlign,
- [`col--${type}`]: type,
- 'col--last': isLastColumn,
- 'col--fixed': column.fixed,
- 'col--group': isColGroup,
- 'col--ellipsis': hasEllipsis,
- 'fixed--width': !isAutoCellWidth,
- 'is--padding': isPadding,
- 'is--sortable': column.sortable,
- 'col--filter': !!filters,
- 'is--filter-active': hasFilter,
- 'is--drag-active': columnOpts.drag && !column.fixed && !isDisabledDrag && (isCrossDrag || isPeerDrag || !column.parentId),
- 'is--drag-disabled': columnOpts.drag && isDisabledDrag,
- 'col--current': currentColumn === column
- }, getClass(headerClassName, cellParams), getClass(headerCellClassName, cellParams)],
- attrs: thAttrs,
- style: headerCellStyle ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(headerCellStyle) ? headerCellStyle(cellParams) : headerCellStyle : undefined,
- on: thOns,
- key: showCustomHeader ? `${colid}${$columnIndex}` : columnKey || scrollXLoad || scrollYLoad || columnOpts.useKey || columnOpts.drag || isColGroup ? colid : $columnIndex
- }, [h('div', {
- class: ['vxe-cell', {
- 'c--title': showTitle,
- 'c--tooltip': showTooltip,
- 'c--ellipsis': showEllipsis
- }],
- style: tcStyle
- }, isVNPreEmptyStatus || isOptimizeMode && fixedHiddenColumn ? [] : [h('div', {
- attrs: {
- colid
- },
- class: 'vxe-cell--wrapper vxe-header-cell--wrapper'
- }, column.renderHeader(h, cellParams))]),
- /**
- * 列宽拖动
- */
- !fixedHiddenColumn && showResizable && (!showCustomHeader || isLastRow) ? h('div', {
- class: 'vxe-cell--col-resizable',
- on: {
- mousedown: evnt => $xeTable.handleColResizeMousedownEvent(evnt, fixedType, cellParams),
- dblclick: evnt => $xeTable.handleColResizeDblclickEvent(evnt, cellParams)
- }
- }) : header_renderEmptyElement($xeTable)]);
- });
- }
- function renderFilterRows(h, _vm, isOptimizeMode, cols) {
- const props = _vm;
- const $xeTable = _vm.$parent;
- const $xeGrid = $xeTable.$xeGrid;
- const $xeGantt = $xeTable.$xeGantt;
- const tableProps = $xeTable;
- const tableReactData = $xeTable;
- const tableInternalData = $xeTable;
- const {
- fixedType
- } = props;
- const {
- showHeaderOverflow: allColumnHeaderOverflow,
- headerAlign: allHeaderAlign,
- align: allAlign
- } = tableProps;
- const {
- currentColumn,
- overflowX
- } = tableReactData;
- const {
- fullColumnIdData
- } = tableInternalData;
- const cellOpts = $xeTable.computeCellOpts;
- const defaultRowHeight = $xeTable.computeDefaultRowHeight;
- const headerCellOpts = $xeTable.computeHeaderCellOpts;
- const currCellHeight = getCalcHeight(headerCellOpts.height) || defaultRowHeight;
- return cols.map((column, $columnIndex) => {
- const {
- type,
- showHeaderOverflow,
- headerAlign,
- align,
- filters,
- editRender,
- cellRender,
- floatingFilters,
- filterRender,
- slots
- } = column;
- const colid = column.id;
- const colRest = fullColumnIdData[colid] || {};
- const renderOpts = editRender || cellRender;
- const compConf = renderOpts ? header_renderer.get(renderOpts.name) : null;
- const flCompConf = isEnableConf(filterRender) ? header_renderer.get(filterRender.name) : null;
- const rtFloatingFilter = flCompConf ? flCompConf.renderTableFloatingFilter : null;
- const flSlot = slots ? slots.floatingFilter || slots['floating-filter'] : null;
- const fixedHiddenColumn = overflowX && (fixedType ? column.fixed !== fixedType : !!column.fixed);
- const isPadding = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isBoolean(headerCellOpts.padding) ? headerCellOpts.padding : cellOpts.padding;
- const headOverflow = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(showHeaderOverflow) ? allColumnHeaderOverflow : showHeaderOverflow;
- const headAlign = headerAlign || (compConf ? compConf.tableHeaderCellAlign : '') || allHeaderAlign || align || (compConf ? compConf.tableCellAlign : '') || allAlign;
- const showEllipsis = headOverflow === 'ellipsis';
- const showTitle = headOverflow === 'title';
- const showTooltip = headOverflow === true || headOverflow === 'tooltip';
- const hasEllipsis = showTitle || showTooltip || showEllipsis;
- let hasFilter = false;
- let firstFilterOption = null;
- if (filters) {
- firstFilterOption = filters[0];
- hasFilter = filters.some(item => item.checked);
- }
- const columnIndex = colRest.index;
- const _columnIndex = colRest._index;
- const cellParams = {
- $table: $xeTable,
- $grid: $xeGrid,
- $gantt: $xeGantt,
- column: column,
- columnIndex,
- $columnIndex,
- _columnIndex,
- option: firstFilterOption,
- fixed: fixedType,
- source: header_sourceType,
- type: header_renderType,
- isHidden: fixedHiddenColumn,
- hasFilter
- };
- const thAttrs = {
- colid
- };
- const isLastColumn = $columnIndex === cols.length - 1;
- const isAutoCellWidth = !column.resizeWidth && (column.minWidth === 'auto' || column.width === 'auto');
- const tcStyle = {};
- if (hasEllipsis) {
- tcStyle.height = `${currCellHeight}px`;
- } else {
- tcStyle.minHeight = `${currCellHeight}px`;
- }
- return h('th', {
- class: ['vxe-table--column vxe-header--column', colid, fixedHiddenColumn ? 'fixed--hidden' : 'fixed--visible', {
- [`col--${headAlign}`]: headAlign,
- [`col--${type}`]: type,
- 'col--last': isLastColumn,
- 'col--fixed': column.fixed,
- 'col--ellipsis': hasEllipsis,
- 'fixed--width': !isAutoCellWidth,
- 'is--padding': isPadding,
- 'is--sortable': column.sortable,
- 'col--current': currentColumn === column
- }],
- key: colid,
- attrs: thAttrs
- }, [h('div', {
- class: ['vxe-cell', {
- 'c--title': showTitle,
- 'c--tooltip': showTooltip,
- 'c--ellipsis': showEllipsis
- }],
- style: tcStyle
- }, isOptimizeMode && fixedHiddenColumn && !floatingFilters ? [] : [h('div', {
- attrs: {
- colid
- },
- class: 'vxe-cell--wrapper vxe-header-cell--wrapper'
- }, flSlot ? $xeTable.callSlot(flSlot, cellParams, h) : rtFloatingFilter && firstFilterOption ? getSlotVNs(rtFloatingFilter.call($xeTable, h, filterRender, {
- $table: $xeTable,
- option: firstFilterOption,
- column: column,
- columnIndex,
- $columnIndex
- })) : [])])]);
- });
- }
- function renderHeads(h, _vm, isGroup, isOptimizeMode, headerGroups) {
- const props = _vm;
- const $xeTable = _vm.$parent;
- const tableProps = $xeTable;
- const tableInternalData = $xeTable;
- const {
- fixedType,
- fixedColumn
- } = props;
- const {
- headerRowClassName,
- headerRowStyle
- } = tableProps;
- const {
- visibleColumn
- } = tableInternalData;
- const floatingFilterOpts = $xeTable.computeFloatingFilterOpts;
- const rowVNs = headerGroups.map((cols, $rowIndex) => {
- const params = {
- $table: $xeTable,
- $rowIndex,
- fixed: fixedType,
- type: header_renderType
- };
- return h('tr', {
- key: $rowIndex,
- class: ['vxe-header--row', headerRowClassName ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(headerRowClassName) ? headerRowClassName(params) : headerRowClassName : ''],
- style: headerRowStyle ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(headerRowStyle) ? headerRowStyle(params) : headerRowStyle : undefined
- }, header_renderRows(h, _vm, isGroup, isOptimizeMode, headerGroups, $rowIndex, cols));
- });
- if (floatingFilterOpts.enabled) {
- rowVNs.push(h('tr', {
- key: 'ff',
- class: ['vxe-header--row']
- }, renderFilterRows(h, _vm, isOptimizeMode, isOptimizeMode && fixedType ? fixedColumn : visibleColumn)));
- }
- return rowVNs;
- }
- /* harmony default export */ var header = ({
- name: 'VxeTableHeader',
- props: {
- tableData: Array,
- tableColumn: Array,
- tableGroupColumn: Array,
- fixedColumn: Array,
- fixedType: {
- type: String,
- default: null
- }
- },
- data() {
- return {
- headerColumn: []
- };
- },
- watch: {
- tableColumn() {
- const _vm = this;
- _vm.uploadColumn();
- }
- },
- created() {
- const _vm = this;
- _vm.uploadColumn();
- },
- mounted() {
- const _vm = this;
- const props = _vm;
- const $xeTable = _vm.$parent;
- const internalData = $xeTable;
- const {
- fixedType
- } = props;
- const {
- elemStore
- } = internalData;
- const prefix = `${fixedType || 'main'}-header-`;
- elemStore[`${prefix}wrapper`] = _vm.$refs.refElem;
- elemStore[`${prefix}scroll`] = _vm.$refs.refHeaderScroll;
- elemStore[`${prefix}table`] = _vm.$refs.refHeaderTable;
- elemStore[`${prefix}colgroup`] = _vm.$refs.refHeaderColgroup;
- elemStore[`${prefix}list`] = _vm.$refs.refHeaderTHead;
- elemStore[`${prefix}xSpace`] = _vm.$refs.refHeaderXSpace;
- elemStore[`${prefix}repair`] = _vm.$refs.refHeaderBorderRepair;
- },
- destroyed() {
- const _vm = this;
- const props = _vm;
- const $xeTable = _vm.$parent;
- const internalData = $xeTable;
- const {
- fixedType
- } = props;
- const {
- elemStore
- } = internalData;
- const prefix = `${fixedType || 'main'}-header-`;
- elemStore[`${prefix}wrapper`] = null;
- elemStore[`${prefix}scroll`] = null;
- elemStore[`${prefix}table`] = null;
- elemStore[`${prefix}colgroup`] = null;
- elemStore[`${prefix}list`] = null;
- elemStore[`${prefix}xSpace`] = null;
- elemStore[`${prefix}repair`] = null;
- },
- render(h) {
- const _vm = this;
- const props = _vm;
- const $xeTable = _vm.$parent;
- const tableProps = $xeTable;
- const tableReactData = $xeTable;
- const tableInternalData = $xeTable;
- const {
- xID
- } = $xeTable;
- const {
- fixedType,
- fixedColumn,
- tableColumn
- } = props;
- const {
- headerColumn
- } = _vm;
- const {
- mouseConfig,
- showHeaderOverflow: allColumnHeaderOverflow,
- spanMethod,
- footerSpanMethod
- } = tableProps;
- const {
- isGroup,
- isColLoading,
- overflowX,
- scrollXLoad,
- dragCol
- } = tableReactData;
- const {
- visibleColumn,
- fullColumnIdData
- } = tableInternalData;
- const mouseOpts = $xeTable.computeMouseOpts;
- let renderHeaderList = headerColumn;
- let renderColumnList = tableColumn;
- let isOptimizeMode = false;
- if (isGroup) {
- renderColumnList = visibleColumn;
- } else {
- // 如果是使用优化模式
- if (scrollXLoad && allColumnHeaderOverflow) {
- if (spanMethod || footerSpanMethod) {
- // 如果不支持优化模式
- } else {
- isOptimizeMode = true;
- }
- }
- if (!isOptimizeMode || !isColLoading && (fixedType || !overflowX)) {
- renderColumnList = visibleColumn;
- }
- if (fixedType) {
- // 如果是使用优化模式
- if (isOptimizeMode) {
- renderColumnList = fixedColumn || [];
- }
- }
- renderHeaderList = [renderColumnList];
- }
- if (!fixedType && !isGroup) {
- // 列拖拽
- if (scrollXLoad && dragCol) {
- if (renderColumnList.length > 2) {
- const dCowRest = fullColumnIdData[dragCol.id];
- if (dCowRest) {
- const dcIndex = dCowRest._index;
- const firstCol = renderColumnList[0];
- const lastCol = renderColumnList[renderColumnList.length - 1];
- const firstColRest = fullColumnIdData[firstCol.id];
- const lastColRest = fullColumnIdData[lastCol.id];
- if (firstColRest && lastColRest) {
- const fcIndex = firstColRest._index;
- const lcIndex = lastColRest._index;
- if (dcIndex < fcIndex) {
- renderColumnList = [dragCol].concat(renderColumnList);
- renderHeaderList = [[dragCol].concat(renderHeaderList[0])].concat(renderHeaderList.slice(1));
- } else if (dcIndex > lcIndex) {
- renderColumnList = renderColumnList.concat([dragCol]);
- renderHeaderList = [renderHeaderList[0].concat([dragCol])].concat(renderHeaderList.slice(1));
- }
- }
- }
- }
- }
- }
- return h('div', {
- ref: 'refElem',
- class: ['vxe-table--header-wrapper', fixedType ? `fixed-${fixedType}--wrapper` : 'body--wrapper'],
- attrs: {
- xid: xID
- }
- }, [h('div', {
- ref: 'refHeaderScroll',
- class: 'vxe-table--header-inner-wrapper',
- on: {
- scroll(evnt) {
- $xeTable.triggerHeaderScrollEvent(evnt, fixedType);
- }
- }
- }, [fixedType ? header_renderEmptyElement($xeTable) : h('div', {
- ref: 'refHeaderXSpace',
- class: 'vxe-body--x-space'
- }), h('table', {
- ref: 'refHeaderTable',
- class: 'vxe-table--header',
- attrs: {
- xid: xID,
- cellspacing: 0,
- cellpadding: 0,
- border: 0,
- xvm: isOptimizeMode ? '1' : null
- }
- }, [
- /**
- * 列宽
- */
- h('colgroup', {
- ref: 'refHeaderColgroup'
- }, renderColumnList.map((column, $columnIndex) => {
- return h('col', {
- attrs: {
- name: column.id
- },
- key: $columnIndex,
- style: {
- width: `${column.renderWidth}px`
- }
- });
- })),
- /**
- * 头部
- */
- h('thead', {
- ref: 'refHeaderTHead'
- }, renderHeads(h, _vm, isGroup, isOptimizeMode, renderHeaderList))]), mouseConfig && mouseOpts.area ? h('div', {
- class: 'vxe-table--cell-area',
- attrs: {
- xid: xID
- }
- }, [h('span', {
- class: 'vxe-table--cell-main-area'
- }), h('span', {
- class: 'vxe-table--cell-clip-area'
- }), h('span', {
- class: 'vxe-table--cell-extend-area'
- }), h('span', {
- class: 'vxe-table--cell-multi-area'
- }), h('span', {
- class: 'vxe-table--cell-active-area'
- }), h('span', {
- class: 'vxe-table--cell-col-status-area'
- })]) : header_renderEmptyElement($xeTable)])]);
- },
- methods: {
- uploadColumn() {
- const _vm = this;
- const $xeTable = _vm.$parent;
- const tableProps = $xeTable;
- const tableReactData = $xeTable;
- const tableInternalData = $xeTable;
- const props = _vm;
- const {
- showCustomHeader
- } = tableProps;
- const {
- collectColumn,
- visibleColumn
- } = tableInternalData;
- const {
- tableGroupColumn
- } = props;
- const {
- isGroup
- } = tableReactData;
- let spanColumns = isGroup ? convertHeaderColumnToRows(tableGroupColumn) : [];
- let visibleColgroups = [];
- if (showCustomHeader && spanColumns.length > 1) {
- visibleColgroups = convertHeaderToGridRows(spanColumns);
- spanColumns = visibleColgroups;
- }
- _vm.headerColumn = spanColumns;
- $xeTable.dispatchEvent('columns-change', {
- visibleColgroups,
- collectColumn,
- visibleColumn
- }, null);
- }
- }
- });
- ;// CONCATENATED MODULE: ./packages/table/src/footer.ts
- const footer_sourceType = 'table';
- const footer_renderType = 'footer';
- const {
- renderer: footer_renderer,
- renderEmptyElement: footer_renderEmptyElement
- } = core_.VxeUI;
- function footer_renderRows(h, _vm, isOptimizeMode, tableColumn, footerTableData, row, $rowIndex, _rowIndex) {
- const props = _vm;
- const $xeTable = _vm.$parent;
- const tableProps = $xeTable;
- const tableReactData = $xeTable;
- const tableInternalData = $xeTable;
- const $xeGrid = $xeTable.$xeGrid;
- const $xeGantt = $xeTable.$xeGantt;
- const {
- fixedType
- } = props;
- const {
- resizable: allResizable,
- border,
- footerCellClassName,
- footerCellStyle,
- footerAlign: allFooterAlign,
- footerSpanMethod,
- align: allAlign,
- columnKey,
- showFooterOverflow: allColumnFooterOverflow
- } = tableProps;
- const {
- scrollXLoad,
- scrollYLoad,
- overflowX,
- currentColumn,
- mergeFootFlag
- } = tableReactData;
- const {
- fullColumnIdData,
- mergeFooterList,
- mergeFooterCellMaps,
- scrollXStore
- } = tableInternalData;
- const virtualXOpts = $xeTable.computeVirtualXOpts;
- const footerTooltipOpts = $xeTable.computeFooterTooltipOpts;
- const resizableOpts = $xeTable.resizableOpts;
- const {
- isAllColumnDrag
- } = resizableOpts;
- const columnOpts = $xeTable.computeColumnOpts;
- const defaultRowHeight = $xeTable.computeDefaultRowHeight;
- const cellOpts = $xeTable.computeCellOpts;
- const footerCellOpts = $xeTable.computeFooterCellOpts;
- const currCellHeight = getCalcHeight(footerCellOpts.height) || defaultRowHeight;
- return tableColumn.map((column, $columnIndex) => {
- const {
- type,
- showFooterOverflow,
- footerAlign,
- align,
- footerClassName,
- editRender,
- cellRender
- } = column;
- const colid = column.id;
- const colRest = fullColumnIdData[colid] || {};
- const renderOpts = editRender || cellRender;
- const compConf = renderOpts ? footer_renderer.get(renderOpts.name) : null;
- const showAllTip = footerTooltipOpts.showAll;
- const fixedHiddenColumn = overflowX && (fixedType ? column.fixed !== fixedType : !!column.fixed);
- const isPadding = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isBoolean(footerCellOpts.padding) ? footerCellOpts.padding : cellOpts.padding;
- const footOverflow = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(showFooterOverflow) ? allColumnFooterOverflow : showFooterOverflow;
- const footAlign = footerAlign || (compConf ? compConf.tableFooterCellAlign : '') || allFooterAlign || align || (compConf ? compConf.tableCellAlign : '') || allAlign;
- const showEllipsis = footOverflow === 'ellipsis';
- const showTitle = footOverflow === 'title';
- const showTooltip = footOverflow === true || footOverflow === 'tooltip';
- const hasEllipsis = showTitle || showTooltip || showEllipsis;
- const showResizable = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isBoolean(column.resizable) ? column.resizable : columnOpts.resizable || allResizable;
- const attrs = {
- colid
- };
- const tfOns = {};
- const columnIndex = colRest.index;
- const _columnIndex = colRest._index;
- const itemIndex = _columnIndex;
- const cellParams = {
- source: footer_sourceType,
- $table: $xeTable,
- $grid: $xeGrid,
- $gantt: $xeGantt,
- row,
- rowIndex: _rowIndex,
- _rowIndex,
- $rowIndex,
- column,
- columnIndex,
- $columnIndex,
- _columnIndex,
- itemIndex,
- items: row,
- fixed: fixedType,
- type: footer_renderType,
- data: footerTableData
- };
- if (showTitle || showTooltip || showAllTip) {
- tfOns.mouseenter = evnt => {
- if (showTitle) {
- updateCellTitle(evnt.currentTarget, column);
- } else if (showTooltip || showAllTip) {
- $xeTable.triggerFooterTooltipEvent(evnt, cellParams);
- }
- };
- }
- if (showTooltip || showAllTip) {
- tfOns.mouseleave = evnt => {
- if (showTooltip || showAllTip) {
- $xeTable.handleTargetLeaveEvent(evnt);
- }
- };
- }
- tfOns.click = evnt => {
- $xeTable.dispatchEvent('footer-cell-click', Object.assign({
- cell: evnt.currentTarget
- }, cellParams), evnt);
- };
- tfOns.dblclick = evnt => {
- $xeTable.dispatchEvent('footer-cell-dblclick', Object.assign({
- cell: evnt.currentTarget
- }, cellParams), evnt);
- };
- let isMergeCell = false;
- // 合并行或列
- if (mergeFootFlag && mergeFooterList.length) {
- const spanRest = mergeFooterCellMaps[`${_rowIndex}:${_columnIndex}`];
- if (spanRest) {
- const {
- rowspan,
- colspan
- } = spanRest;
- if (!rowspan || !colspan) {
- return null;
- }
- if (rowspan > 1) {
- isMergeCell = true;
- attrs.rowspan = rowspan;
- }
- if (colspan > 1) {
- isMergeCell = true;
- attrs.colspan = colspan;
- }
- }
- } else if (footerSpanMethod) {
- // 自定义合并方法
- const {
- rowspan = 1,
- colspan = 1
- } = footerSpanMethod(cellParams) || {};
- if (!rowspan || !colspan) {
- return null;
- }
- if (rowspan > 1) {
- attrs.rowspan = rowspan;
- }
- if (colspan > 1) {
- attrs.colspan = colspan;
- }
- }
- const isLastColumn = $columnIndex === tableColumn.length - 1;
- const isAutoCellWidth = !column.resizeWidth && (column.minWidth === 'auto' || column.width === 'auto');
- let isVNPreEmptyStatus = false;
- if (isOptimizeMode && overflowX && !isMergeCell) {
- if (scrollXLoad && tableColumn.length > 10 && !column.fixed && !virtualXOpts.immediate && (_columnIndex < scrollXStore.visibleStartIndex - scrollXStore.preloadSize || _columnIndex > scrollXStore.visibleEndIndex + scrollXStore.preloadSize)) {
- isVNPreEmptyStatus = true;
- }
- }
- const tcStyle = {};
- if (hasEllipsis) {
- tcStyle.height = `${currCellHeight}px`;
- } else {
- tcStyle.minHeight = `${currCellHeight}px`;
- }
- return h('td', {
- class: ['vxe-table--column vxe-footer--column', column.id, {
- [`col--${footAlign}`]: footAlign,
- [`col--${type}`]: type,
- 'col--last': isLastColumn,
- 'fixed--width': !isAutoCellWidth,
- 'fixed--hidden': fixedHiddenColumn,
- 'is--padding': isPadding,
- 'col--ellipsis': hasEllipsis,
- 'col--current': currentColumn === column
- }, getClass(footerClassName, cellParams), getClass(footerCellClassName, cellParams)],
- attrs,
- style: footerCellStyle ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(footerCellStyle) ? footerCellStyle(cellParams) : footerCellStyle : undefined,
- on: tfOns,
- key: columnKey || scrollXLoad || scrollYLoad || columnOpts.useKey || columnOpts.drag ? column.id : $columnIndex
- }, [h('div', {
- class: ['vxe-cell', {
- 'c--title': showTitle,
- 'c--tooltip': showTooltip,
- 'c--ellipsis': showEllipsis
- }],
- style: tcStyle
- }, isVNPreEmptyStatus ? [] : [h('div', {
- attrs: {
- colid
- },
- class: 'vxe-cell--wrapper vxe-footer-cell--wrapper'
- }, column.renderFooter(h, cellParams))]),
- /**
- * 列宽拖动
- */
- !fixedHiddenColumn && showResizable && isAllColumnDrag ? h('div', {
- class: ['vxe-cell--col-resizable', {
- 'is--line': !border || border === 'none'
- }],
- on: {
- mousedown: evnt => $xeTable.handleColResizeMousedownEvent(evnt, fixedType, cellParams),
- dblclick: evnt => $xeTable.handleColResizeDblclickEvent(evnt, cellParams)
- }
- }) : footer_renderEmptyElement($xeTable)]);
- });
- }
- function footer_renderHeads(h, _vm, isOptimizeMode, renderColumnList) {
- const props = _vm;
- const $xeTable = _vm.$parent;
- const tableProps = $xeTable;
- const {
- fixedType,
- footerTableData
- } = props;
- const {
- footerRowClassName,
- footerRowStyle
- } = tableProps;
- return footerTableData.map((row, $rowIndex) => {
- const _rowIndex = $rowIndex;
- const rowParams = {
- $table: $xeTable,
- row,
- _rowIndex,
- $rowIndex,
- fixed: fixedType,
- type: footer_renderType
- };
- return h('tr', {
- key: $rowIndex,
- class: ['vxe-footer--row', footerRowClassName ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(footerRowClassName) ? footerRowClassName(rowParams) : footerRowClassName : ''],
- style: footerRowStyle ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(footerRowStyle) ? footerRowStyle(rowParams) : footerRowStyle : undefined
- }, footer_renderRows(h, _vm, isOptimizeMode, renderColumnList, footerTableData, row, $rowIndex, _rowIndex));
- });
- }
- /* harmony default export */ var footer = ({
- name: 'VxeTableFooter',
- props: {
- footerTableData: {
- type: Array,
- default: () => []
- },
- tableColumn: {
- type: Array,
- default: () => []
- },
- fixedColumn: {
- type: Array,
- default: () => []
- },
- fixedType: {
- type: String,
- default: null
- }
- },
- mounted() {
- const _vm = this;
- const props = _vm;
- const $xeTable = _vm.$parent;
- const tableInternalData = $xeTable;
- const {
- fixedType
- } = props;
- const {
- elemStore
- } = tableInternalData;
- const prefix = `${fixedType || 'main'}-footer-`;
- elemStore[`${prefix}wrapper`] = _vm.$refs.refElem;
- elemStore[`${prefix}scroll`] = _vm.$refs.refFooterScroll;
- elemStore[`${prefix}table`] = _vm.$refs.refFooterTable;
- elemStore[`${prefix}colgroup`] = _vm.$refs.refFooterColgroup;
- elemStore[`${prefix}list`] = _vm.$refs.refFooterTFoot;
- elemStore[`${prefix}xSpace`] = _vm.$refs.refFooterXSpace;
- },
- destroyed() {
- const _vm = this;
- const props = _vm;
- const $xeTable = _vm.$parent;
- const tableInternalData = $xeTable;
- const {
- fixedType
- } = props;
- const {
- elemStore
- } = tableInternalData;
- const prefix = `${fixedType || 'main'}-footer-`;
- elemStore[`${prefix}wrapper`] = null;
- elemStore[`${prefix}scroll`] = null;
- elemStore[`${prefix}table`] = null;
- elemStore[`${prefix}colgroup`] = null;
- elemStore[`${prefix}list`] = null;
- elemStore[`${prefix}xSpace`] = null;
- },
- render(h) {
- const _vm = this;
- const props = _vm;
- const $xeTable = _vm.$parent;
- const tableProps = $xeTable;
- const tableReactData = $xeTable;
- const tableInternalData = $xeTable;
- const {
- xID
- } = $xeTable;
- const {
- fixedType,
- fixedColumn,
- tableColumn
- } = props;
- const {
- spanMethod,
- footerSpanMethod,
- showFooterOverflow: allColumnFooterOverflow
- } = tableProps;
- const {
- visibleColumn,
- fullColumnIdData
- } = tableInternalData;
- const {
- isGroup,
- isColLoading,
- overflowX,
- scrollXLoad,
- dragCol
- } = tableReactData;
- let renderColumnList = tableColumn;
- let isOptimizeMode = false;
- // 如果是使用优化模式
- if (scrollXLoad && allColumnFooterOverflow) {
- if (spanMethod || footerSpanMethod) {
- // 如果不支持优化模式
- } else {
- isOptimizeMode = true;
- }
- }
- if (!isOptimizeMode || !isColLoading && (fixedType || !overflowX)) {
- renderColumnList = visibleColumn;
- }
- if (fixedType) {
- if (isOptimizeMode) {
- renderColumnList = fixedColumn || [];
- }
- }
- if (!fixedType && !isGroup) {
- // 列拖拽
- if (scrollXLoad && dragCol) {
- if (renderColumnList.length > 2) {
- const dCowRest = fullColumnIdData[dragCol.id];
- if (dCowRest) {
- const dcIndex = dCowRest._index;
- const firstCol = renderColumnList[0];
- const lastCol = renderColumnList[renderColumnList.length - 1];
- const firstColRest = fullColumnIdData[firstCol.id];
- const lastColRest = fullColumnIdData[lastCol.id];
- if (firstColRest && lastColRest) {
- const fcIndex = firstColRest._index;
- const lcIndex = lastColRest._index;
- if (dcIndex < fcIndex) {
- renderColumnList = [dragCol].concat(renderColumnList);
- } else if (dcIndex > lcIndex) {
- renderColumnList = renderColumnList.concat([dragCol]);
- }
- }
- }
- }
- }
- }
- return h('div', {
- ref: 'refElem',
- class: ['vxe-table--footer-wrapper', fixedType ? `fixed-${fixedType}--wrapper` : 'body--wrapper'],
- attrs: {
- xid: xID
- }
- }, [h('div', {
- ref: 'refFooterScroll',
- class: 'vxe-table--footer-inner-wrapper',
- on: {
- scroll(evnt) {
- $xeTable.triggerFooterScrollEvent(evnt, fixedType);
- }
- }
- }, [fixedType ? footer_renderEmptyElement($xeTable) : h('div', {
- ref: 'refFooterXSpace',
- class: 'vxe-body--x-space'
- }), h('table', {
- ref: 'refFooterTable',
- class: 'vxe-table--footer',
- attrs: {
- xid: xID,
- cellspacing: 0,
- cellpadding: 0,
- border: 0,
- xvm: isOptimizeMode ? '1' : null
- }
- }, [
- /**
- * 列宽
- */
- h('colgroup', {
- ref: 'refFooterColgroup'
- }, renderColumnList.map((column, $columnIndex) => {
- return h('col', {
- attrs: {
- name: column.id
- },
- key: $columnIndex,
- style: {
- width: `${column.renderWidth}px`
- }
- });
- })),
- /**
- * 底部
- */
- h('tfoot', {
- ref: 'refFooterTFoot'
- }, footer_renderHeads(h, _vm, isOptimizeMode, renderColumnList))])])]);
- }
- });
- ;// CONCATENATED MODULE: ./packages/table/module/custom/panel.ts
- const {
- getI18n: panel_getI18n,
- getIcon: panel_getIcon,
- renderEmptyElement: panel_renderEmptyElement
- } = core_.VxeUI;
- function panel_showDropTip($xeTableCustomPanel, evnt, optEl, showLine, dragPos) {
- const customPanelInternalData = $xeTableCustomPanel.internalData;
- const bodyWrapperElem = $xeTableCustomPanel.$refs.refBodyWrapperElem;
- if (!bodyWrapperElem) {
- return;
- }
- const customBodyElem = $xeTableCustomPanel.$refs.refCustomBodyElem;
- if (!customBodyElem) {
- return;
- }
- const {
- prevDragToChild
- } = customPanelInternalData;
- const bodyWrapperRect = bodyWrapperElem.getBoundingClientRect();
- const customBodyRect = customBodyElem.getBoundingClientRect();
- const dragLineEl = $xeTableCustomPanel.$refs.refDragLineElem;
- if (optEl) {
- if (dragLineEl) {
- if (showLine) {
- const optRect = optEl.getBoundingClientRect();
- dragLineEl.style.display = 'block';
- dragLineEl.style.left = `${Math.max(0, customBodyRect.x - bodyWrapperRect.x)}px`;
- dragLineEl.style.top = `${Math.max(1, optRect.y + bodyWrapperElem.scrollTop - bodyWrapperRect.y)}px`;
- dragLineEl.style.height = `${optRect.height}px`;
- dragLineEl.style.width = `${optRect.width}px`;
- dragLineEl.setAttribute('drag-pos', dragPos);
- dragLineEl.setAttribute('drag-to-child', prevDragToChild ? 'y' : 'n');
- } else {
- dragLineEl.style.display = '';
- }
- }
- } else {
- if (dragLineEl) {
- dragLineEl.style.display = 'node';
- }
- }
- const dragTipEl = $xeTableCustomPanel.$refs.refDragTipElem;
- if (dragTipEl) {
- dragTipEl.style.display = 'block';
- dragTipEl.style.top = `${Math.min(bodyWrapperElem.clientHeight + bodyWrapperElem.scrollTop - dragTipEl.clientHeight, evnt.clientY + bodyWrapperElem.scrollTop - bodyWrapperRect.y)}px`;
- dragTipEl.style.left = `${Math.min(bodyWrapperElem.clientWidth + bodyWrapperElem.scrollLeft - dragTipEl.clientWidth, evnt.clientX + bodyWrapperElem.scrollLeft - bodyWrapperRect.x)}px`;
- dragTipEl.setAttribute('drag-status', showLine ? prevDragToChild ? 'sub' : 'normal' : 'disabled');
- }
- }
- function panel_hideDropTip($xeTableCustomPanel) {
- const dragTipEl = $xeTableCustomPanel.$refs.refDragTipElem;
- const dragLineEl = $xeTableCustomPanel.$refs.refDragLineElem;
- if (dragTipEl) {
- dragTipEl.style.display = '';
- }
- if (dragLineEl) {
- dragLineEl.style.display = '';
- }
- }
- const renderDragTip = (h, $xeTableCustomPanel) => {
- const $xeTable = $xeTableCustomPanel.$xeTable;
- const customPanelReactData = $xeTableCustomPanel.reactData;
- const {
- dragTipText
- } = customPanelReactData;
- const columnDragOpts = $xeTable.computeColumnDragOpts;
- return h('div', {}, [h('div', {
- ref: 'refDragLineElem',
- class: ['vxe-table-custom-popup--drag-line', {
- 'is--guides': columnDragOpts.showGuidesStatus
- }]
- }), h('div', {
- ref: 'refDragTipElem',
- class: 'vxe-table-custom-popup--drag-tip'
- }, [h('div', {
- class: 'vxe-table-custom-popup--drag-tip-wrapper'
- }, [h('div', {
- class: 'vxe-table-custom-popup--drag-tip-status'
- }, [h('span', {
- class: ['vxe-table-custom-popup--drag-tip-normal-status', panel_getIcon().TABLE_DRAG_STATUS_ROW]
- }), h('span', {
- class: ['vxe-table-custom-popup--drag-tip-sub-status', panel_getIcon().TABLE_DRAG_STATUS_SUB_ROW]
- }), h('span', {
- class: ['vxe-table-custom-popup--drag-tip-group-status', panel_getIcon().TABLE_DRAG_STATUS_AGG_GROUP]
- }), h('span', {
- class: ['vxe-table-custom-popup--drag-tip-values-status', panel_getIcon().TABLE_DRAG_STATUS_AGG_VALUES]
- }), h('span', {
- class: ['vxe-table-custom-popup--drag-tip-disabled-status', panel_getIcon().TABLE_DRAG_DISABLED]
- })]), h('div', {
- class: 'vxe-table-custom-popup--drag-tip-content'
- }, `${dragTipText || ''}`)])])]);
- };
- const renderSimplePanel = (h, _vm) => {
- const VxeUIButtonComponent = core_.VxeUI.getComponent('VxeButton');
- const props = _vm;
- const $xeTable = _vm.$xeTable;
- const tableProps = $xeTable;
- const tableReactData = $xeTable;
- const $xeGrid = $xeTable.$xeGrid;
- const $xeGantt = $xeTable.$xeGantt;
- const {
- customStore
- } = props;
- const {
- treeConfig,
- rowGroupConfig,
- aggregateConfig
- } = tableProps;
- const {
- isCustomStatus,
- customColumnList
- } = tableReactData;
- const customOpts = $xeTable.computeCustomOpts;
- const {
- immediate
- } = customOpts;
- const columnDragOpts = $xeTable.computeColumnDragOpts;
- const {
- maxHeight
- } = customStore;
- const {
- checkMethod,
- visibleMethod,
- allowVisible,
- allowSort,
- allowFixed,
- trigger,
- placement
- } = customOpts;
- const isMaxFixedColumn = $xeTable.computeIsMaxFixedColumn;
- const {
- isCrossDrag
- } = columnDragOpts;
- const slots = customOpts.slots || {};
- const headerSlot = slots.header;
- const topSlot = slots.top;
- const bottomSlot = slots.bottom;
- const defaultSlot = slots.default;
- const footerSlot = slots.footer;
- const colVNs = [];
- const customWrapperOns = {};
- const isAllChecked = customStore.isAll;
- const isAllIndeterminate = customStore.isIndeterminate;
- // hover 触发
- if (trigger === 'hover') {
- customWrapperOns.mouseenter = _vm.handleWrapperMouseenterEvent;
- customWrapperOns.mouseleave = _vm.handleWrapperMouseleaveEvent;
- }
- const params = {
- $table: $xeTable,
- $grid: $xeGrid,
- $gantt: $xeGantt,
- columns: customColumnList,
- isAllChecked,
- isAllIndeterminate,
- isCustomStatus
- };
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(customColumnList, (column, index, items, path, parent) => {
- const isVisible = visibleMethod ? visibleMethod({
- $table: $xeTable,
- column
- }) : true;
- if (isVisible) {
- const isChecked = column.renderVisible;
- const isIndeterminate = column.halfVisible;
- const isColGroup = column.children && column.children.length;
- const colTitle = formatText(column.getTitle(), 1);
- const isDisabled = checkMethod ? !checkMethod({
- $table: $xeTable,
- column
- }) : false;
- const isHidden = !isChecked;
- colVNs.push(h('li', {
- key: column.id,
- attrs: {
- colid: column.id
- },
- class: ['vxe-table-custom--option', `level--${column.level}`, {
- 'is--hidden': isDisabled || isHidden,
- 'is--group': isColGroup
- }],
- on: {
- dragstart: _vm.sortDragstartEvent,
- dragend: _vm.sortDragendEvent,
- dragover: _vm.sortDragoverEvent
- }
- }, [allowVisible ? h('div', {
- class: ['vxe-table-custom--checkbox-option', {
- 'is--checked': isChecked,
- 'is--indeterminate': isIndeterminate,
- 'is--disabled': isDisabled
- }],
- attrs: {
- title: panel_getI18n('vxe.custom.setting.colVisible')
- },
- on: {
- click: evnt => {
- if (!isDisabled) {
- _vm.changeCheckboxOption(column, evnt);
- }
- }
- }
- }, [h('span', {
- class: ['vxe-checkbox--icon', isIndeterminate ? panel_getIcon().TABLE_CHECKBOX_INDETERMINATE : isChecked ? panel_getIcon().TABLE_CHECKBOX_CHECKED : panel_getIcon().TABLE_CHECKBOX_UNCHECKED]
- })]) : panel_renderEmptyElement($xeTable), h('div', {
- class: 'vxe-table-custom--name-option'
- }, [allowSort && ((isCrossDrag ? immediate : false) || column.level === 1) ? h('div', {
- class: 'vxe-table-custom--sort-option'
- }, [h('span', {
- class: ['vxe-table-custom--sort-btn', {
- 'is--disabled': isDisabled || isHidden
- }],
- attrs: {
- title: panel_getI18n('vxe.custom.setting.sortHelpTip')
- },
- on: isDisabled || isHidden ? {} : {
- mousedown: _vm.sortMousedownEvent,
- mouseup: _vm.sortMouseupEvent
- }
- }, [h('i', {
- class: panel_getIcon().TABLE_CUSTOM_SORT
- })])]) : panel_renderEmptyElement($xeTable), column.type === 'html' ? h('div', {
- key: '1',
- class: 'vxe-table-custom--checkbox-label',
- domProps: {
- innerHTML: colTitle
- }
- }) : h('div', {
- key: '0',
- class: 'vxe-table-custom--checkbox-label',
- attrs: {
- title: colTitle
- }
- }, colTitle)]), !parent && allowFixed ? h('div', {
- class: 'vxe-table-custom--fixed-option'
- }, [h(VxeUIButtonComponent, {
- props: {
- mode: 'text',
- icon: column.renderFixed === 'left' ? panel_getIcon().TOOLBAR_TOOLS_FIXED_LEFT_ACTIVE : panel_getIcon().TOOLBAR_TOOLS_FIXED_LEFT,
- status: column.renderFixed === 'left' ? 'primary' : '',
- disabled: isDisabled || isHidden || isMaxFixedColumn && !column.renderFixed,
- title: panel_getI18n(column.renderFixed === 'left' ? 'vxe.toolbar.cancelFixed' : 'vxe.toolbar.fixedLeft')
- },
- on: {
- click: ({
- $event
- }) => {
- _vm.changeFixedOption(column, 'left', $event);
- }
- }
- }), h(VxeUIButtonComponent, {
- props: {
- mode: 'text',
- icon: column.renderFixed === 'right' ? panel_getIcon().TOOLBAR_TOOLS_FIXED_RIGHT_ACTIVE : panel_getIcon().TOOLBAR_TOOLS_FIXED_RIGHT,
- status: column.renderFixed === 'right' ? 'primary' : '',
- disabled: isDisabled || isHidden || isMaxFixedColumn && !column.renderFixed,
- title: panel_getI18n(column.renderFixed === 'right' ? 'vxe.toolbar.cancelFixed' : 'vxe.toolbar.fixedRight')
- },
- on: {
- click: ({
- $event
- }) => {
- _vm.changeFixedOption(column, 'right', $event);
- }
- }
- })]) : panel_renderEmptyElement($xeTable)]));
- }
- });
- return h('div', {
- ref: 'refElem',
- key: 'simple',
- class: ['vxe-table-custom-wrapper', `placement--${placement}`, {
- 'is--active': customStore.visible
- }],
- style: maxHeight && !['left', 'right'].includes(placement || '') ? {
- maxHeight: `${maxHeight}px`
- } : {}
- }, customStore.visible ? [h('div', {
- ref: 'refBodyWrapperElem',
- class: 'vxe-table-custom-simple--body-wrapper'
- }, [!treeConfig && (aggregateConfig || rowGroupConfig) && $xeTable.getPivotTableAggregateSimplePanel ? h($xeTable.getPivotTableAggregateSimplePanel(), {
- props: {
- customStore
- }
- }) : panel_renderEmptyElement($xeTable), h('div', {
- ref: 'refCustomBodyElem',
- class: 'vxe-table-custom--handle-wrapper'
- }, [h('div', {
- class: 'vxe-table-custom--header'
- }, headerSlot ? $xeTable.callSlot(headerSlot, params, h) : [h('ul', {
- class: 'vxe-table-custom--panel-list'
- }, [h('li', {
- class: 'vxe-table-custom--option'
- }, [allowVisible ? h('div', {
- class: ['vxe-table-custom--checkbox-option', {
- 'is--checked': isAllChecked,
- 'is--indeterminate': isAllIndeterminate
- }],
- attrs: {
- title: panel_getI18n('vxe.table.allTitle')
- },
- on: {
- click: _vm.allOptionEvent
- }
- }, [h('span', {
- class: ['vxe-checkbox--icon', isAllIndeterminate ? panel_getIcon().TABLE_CHECKBOX_INDETERMINATE : isAllChecked ? panel_getIcon().TABLE_CHECKBOX_CHECKED : panel_getIcon().TABLE_CHECKBOX_UNCHECKED]
- }), h('span', {
- class: 'vxe-checkbox--label'
- }, panel_getI18n('vxe.toolbar.customAll'))]) : h('span', {
- class: 'vxe-checkbox--label'
- }, panel_getI18n('vxe.table.customTitle'))])])]), h('div', {
- class: 'vxe-table-custom--body'
- }, [topSlot ? h('div', {
- class: 'vxe-table-custom--panel-top'
- }, $xeTable.callSlot(topSlot, params, h)) : panel_renderEmptyElement($xeTable), defaultSlot ? h('div', {
- class: 'vxe-table-custom--panel-body'
- }, $xeTable.callSlot(defaultSlot, params, h)) : h('transition-group', {
- class: 'vxe-table-custom--panel-list',
- props: {
- name: 'vxe-table-custom--list',
- tag: 'ul'
- },
- on: customWrapperOns
- }, colVNs), bottomSlot ? h('div', {
- class: 'vxe-table-custom--panel-bottom'
- }, $xeTable.callSlot(bottomSlot, params, h)) : panel_renderEmptyElement($xeTable)]), customOpts.showFooter ? h('div', {
- class: 'vxe-table-custom--footer'
- }, footerSlot ? $xeTable.callSlot(footerSlot, params, h) : [h('div', {
- class: 'vxe-table-custom--footer-buttons'
- }, [h(VxeUIButtonComponent, {
- props: {
- mode: 'text',
- content: customOpts.resetButtonText || panel_getI18n('vxe.table.customRestore'),
- disabled: !isCustomStatus
- },
- on: {
- click: _vm.resetCustomEvent
- }
- }), immediate ? h(VxeUIButtonComponent, {
- props: {
- mode: 'text',
- content: customOpts.closeButtonText || panel_getI18n('vxe.table.customClose')
- },
- on: {
- click: _vm.cancelCloseEvent
- }
- }) : h(VxeUIButtonComponent, {
- props: {
- mode: 'text',
- content: customOpts.resetButtonText || panel_getI18n('vxe.table.customCancel')
- },
- on: {
- click: _vm.cancelCustomEvent
- }
- }), immediate ? panel_renderEmptyElement($xeTable) : h(VxeUIButtonComponent, {
- props: {
- mode: 'text',
- status: 'primary',
- content: customOpts.confirmButtonText || panel_getI18n('vxe.table.customConfirm')
- },
- on: {
- click: _vm.confirmCustomEvent
- }
- })])]) : null]), renderDragTip(h, _vm)])] : []);
- };
- const renderPopupPanel = (h, $xeTableCustomPanel) => {
- const VxeUIModalComponent = core_.VxeUI.getComponent('VxeModal');
- const VxeUIDrawerComponent = core_.VxeUI.getComponent('VxeDrawer');
- const VxeUIButtonComponent = core_.VxeUI.getComponent('VxeButton');
- const VxeUINumberInputComponent = core_.VxeUI.getComponent('VxeNumberInput');
- const _vm = $xeTableCustomPanel;
- const props = $xeTableCustomPanel;
- const $xeTable = $xeTableCustomPanel.$xeTable;
- const tableProps = $xeTable;
- const tableReactData = $xeTable;
- const $xeGrid = $xeTable.$xeGrid;
- const $xeGantt = $xeTable.$xeGantt;
- const {
- customStore
- } = props;
- const {
- treeConfig,
- rowGroupConfig,
- aggregateConfig,
- resizable: allResizable
- } = tableProps;
- const {
- isCustomStatus,
- customColumnList
- } = tableReactData;
- const customOpts = $xeTable.computeCustomOpts;
- const {
- immediate
- } = customOpts;
- const columnDragOpts = $xeTable.computeColumnDragOpts;
- const {
- mode,
- modalOptions,
- drawerOptions,
- allowVisible,
- allowSort,
- allowFixed,
- allowResizable,
- checkMethod,
- visibleMethod
- } = customOpts;
- const columnOpts = $xeTable.computeColumnOpts;
- const {
- maxFixedSize
- } = columnOpts;
- const resizableOpts = $xeTable.computeResizableOpts;
- const {
- minWidth: reMinWidth,
- maxWidth: reMaxWidth
- } = resizableOpts;
- const modalOpts = Object.assign({}, modalOptions);
- const drawerOpts = Object.assign({}, drawerOptions);
- const isMaxFixedColumn = $xeTable.computeIsMaxFixedColumn;
- const {
- isCrossDrag
- } = columnDragOpts;
- const slots = customOpts.slots || {};
- const headerSlot = slots.header;
- const topSlot = slots.top;
- const bottomSlot = slots.bottom;
- const defaultSlot = slots.default;
- const footerSlot = slots.footer;
- const trVNs = [];
- const isAllChecked = customStore.isAll;
- const isAllIndeterminate = customStore.isIndeterminate;
- const params = {
- $table: $xeTable,
- $grid: $xeGrid,
- $gantt: $xeGantt,
- columns: customColumnList,
- isAllChecked,
- isAllIndeterminate,
- isCustomStatus
- };
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(customColumnList, (column, index, items, path, parent) => {
- const isVisible = visibleMethod ? visibleMethod({
- $table: $xeTable,
- column
- }) : true;
- if (isVisible) {
- // 默认继承调整宽度
- let customMinWidth = 0;
- let customMaxWidth = 0;
- if (allowResizable) {
- const resizeParams = {
- $table: $xeTable,
- column,
- columnIndex: index,
- $columnIndex: index,
- $rowIndex: -1
- };
- if (reMinWidth) {
- 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);
- }
- if (reMaxWidth) {
- 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);
- }
- }
- const isChecked = column.renderVisible;
- const isIndeterminate = column.halfVisible;
- const colTitle = formatText(column.getTitle(), 1);
- const isColGroup = column.children && column.children.length;
- const isDisabled = checkMethod ? !checkMethod({
- $table: $xeTable,
- column
- }) : false;
- const isHidden = !isChecked;
- trVNs.push(h('tr', {
- key: column.id,
- attrs: {
- colid: column.id
- },
- class: [`vxe-table-custom-popup--row level--${column.level}`, {
- 'is--group': isColGroup
- }],
- on: {
- dragstart: _vm.sortDragstartEvent,
- dragend: _vm.sortDragendEvent,
- dragover: _vm.sortDragoverEvent
- }
- }, [allowVisible ? h('td', {
- class: 'vxe-table-custom-popup--column-item col--visible'
- }, [h('div', {
- class: ['vxe-table-custom--checkbox-option', {
- 'is--checked': isChecked,
- 'is--indeterminate': isIndeterminate,
- 'is--disabled': isDisabled
- }],
- attrs: {
- title: panel_getI18n('vxe.custom.setting.colVisible')
- },
- on: {
- click: evnt => {
- if (!isDisabled) {
- _vm.changeCheckboxOption(column, evnt);
- }
- }
- }
- }, [h('span', {
- class: ['vxe-checkbox--icon', isIndeterminate ? panel_getIcon().TABLE_CHECKBOX_INDETERMINATE : isChecked ? panel_getIcon().TABLE_CHECKBOX_CHECKED : panel_getIcon().TABLE_CHECKBOX_UNCHECKED]
- })])]) : panel_renderEmptyElement($xeTable), h('td', {
- class: 'vxe-table-custom-popup--column-item col--name'
- }, [h('div', {
- class: 'vxe-table-custom-popup--name'
- }, [allowSort ? (isCrossDrag ? immediate : false) || column.level === 1 ? h('div', {
- class: ['vxe-table-custom-popup--column-sort-btn', {
- 'is--disabled': isDisabled || isHidden
- }],
- attrs: {
- title: panel_getI18n('vxe.custom.setting.sortHelpTip')
- },
- on: isDisabled || isHidden ? {} : {
- mousedown: _vm.sortMousedownEvent,
- mouseup: _vm.sortMouseupEvent
- }
- }, [h('i', {
- class: panel_getIcon().TABLE_CUSTOM_SORT
- })]) : h('div', {
- class: 'vxe-table-custom-popup--column-sort-placeholder'
- }) : panel_renderEmptyElement($xeTable), column.type === 'html' ? h('div', {
- key: '1',
- class: 'vxe-table-custom-popup--title',
- domProps: {
- innerHTML: colTitle
- }
- }) : h('div', {
- key: '0',
- class: 'vxe-table-custom-popup--title',
- attrs: {
- title: colTitle
- }
- }, colTitle)])]), allowResizable ? h('td', {
- class: 'vxe-table-custom-popup--column-item col--resizable'
- }, [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, {
- props: {
- type: 'integer',
- immediate: false,
- disabled: isDisabled || isHidden,
- value: column.renderResizeWidth,
- min: customMinWidth || undefined,
- max: customMaxWidth || undefined
- },
- on: {
- modelValue(value) {
- column.renderResizeWidth = Math.max(0, Number(value));
- },
- change() {
- _vm.changeColumnWidth(column);
- }
- }
- }) : panel_renderEmptyElement($xeTableCustomPanel)]) : panel_renderEmptyElement($xeTable), allowFixed ? h('td', {
- class: 'vxe-table-custom-popup--column-item col--fixed'
- }, [parent ? h('span', '-') : h('vxe-radio-group', {
- props: {
- value: column.renderFixed || '',
- type: 'button',
- size: 'mini',
- disabled: isDisabled || isHidden,
- options: [{
- label: panel_getI18n('vxe.custom.setting.fixedLeft'),
- value: 'left',
- disabled: isDisabled || isHidden || isMaxFixedColumn
- }, {
- label: panel_getI18n('vxe.custom.setting.fixedUnset'),
- value: '',
- disabled: isDisabled || isHidden
- }, {
- label: panel_getI18n('vxe.custom.setting.fixedRight'),
- value: 'right',
- disabled: isDisabled || isHidden || isMaxFixedColumn
- }]
- },
- on: {
- change({
- label,
- $event
- }) {
- _vm.changeFixedOption(column, label, $event);
- }
- }
- })]) : panel_renderEmptyElement($xeTable)]));
- }
- });
- const scopedSlots = {
- default: () => {
- return h('div', {
- ref: 'refBodyWrapperElem',
- class: 'vxe-table-custom-popup--body-wrapper'
- }, defaultSlot ? $xeTable.callSlot(defaultSlot, params, h) : [h('div', {
- ref: 'refCustomBodyElem',
- class: 'vxe-table-custom-popup--handle-wrapper'
- }, [topSlot ? h('div', {
- class: 'vxe-table-custom-popup--table-top'
- }, $xeTable.callSlot(topSlot, params, h)) : panel_renderEmptyElement($xeTable), h('div', {
- class: 'vxe-table-custom-popup--table-wrapper'
- }, [h('table', {}, [h('colgroup', {}, [allowVisible ? h('col', {
- class: 'vxe-table-custom-popup--table-col-seq'
- }) : panel_renderEmptyElement($xeTable), h('col', {
- class: 'vxe-table-custom-popup--table-col-title'
- }), allowResizable ? h('col', {
- class: 'vxe-table-custom-popup--table-col-width'
- }) : panel_renderEmptyElement($xeTable), allowFixed ? h('col', {
- class: 'vxe-table-custom-popup--table-col-fixed'
- }) : panel_renderEmptyElement($xeTable)]), h('thead', {}, [h('tr', {}, [allowVisible ? h('th', {}, [h('div', {
- class: ['vxe-table-custom--checkbox-option', {
- 'is--checked': isAllChecked,
- 'is--indeterminate': isAllIndeterminate
- }],
- attrs: {
- title: panel_getI18n('vxe.table.allTitle')
- },
- on: {
- click: _vm.allOptionEvent
- }
- }, [h('span', {
- class: ['vxe-checkbox--icon', isAllIndeterminate ? panel_getIcon().TABLE_CHECKBOX_INDETERMINATE : isAllChecked ? panel_getIcon().TABLE_CHECKBOX_CHECKED : panel_getIcon().TABLE_CHECKBOX_UNCHECKED]
- }), h('span', {
- class: 'vxe-checkbox--label'
- }, 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', {
- class: 'vxe-table-custom--panel-list',
- props: {
- tag: 'tbody',
- name: 'vxe-table-custom--list'
- }
- }, trVNs)])]), bottomSlot ? h('div', {
- class: 'vxe-table-custom-popup--table-bottom'
- }, $xeTable.callSlot(bottomSlot, params, h)) : panel_renderEmptyElement($xeTable), renderDragTip(h, _vm)]), !treeConfig && (aggregateConfig || rowGroupConfig) && $xeTable.getPivotTableAggregatePopupPanel ? h($xeTable.getPivotTableAggregatePopupPanel(), {
- props: {
- customStore
- }
- }) : panel_renderEmptyElement($xeTable)]);
- },
- footer: () => {
- if (footerSlot) {
- return $xeTable.callSlot(footerSlot, params, h);
- }
- return h('div', {
- class: 'vxe-table-custom-popup--footer'
- }, [h(VxeUIButtonComponent, {
- props: {
- content: customOpts.resetButtonText || panel_getI18n('vxe.custom.cstmRestore'),
- disabled: !isCustomStatus
- },
- on: {
- click: _vm.resetCustomEvent
- }
- }), immediate ? h(VxeUIButtonComponent, {
- props: {
- content: customOpts.resetButtonText || panel_getI18n('vxe.table.customClose')
- },
- on: {
- click: _vm.cancelCloseEvent
- }
- }) : h(VxeUIButtonComponent, {
- props: {
- content: customOpts.resetButtonText || panel_getI18n('vxe.custom.cstmCancel')
- },
- on: {
- click: _vm.cancelCustomEvent
- }
- }), immediate ? panel_renderEmptyElement($xeTable) : h(VxeUIButtonComponent, {
- props: {
- status: 'primary',
- content: customOpts.confirmButtonText || panel_getI18n('vxe.custom.cstmConfirm')
- },
- on: {
- click: _vm.confirmCustomEvent
- }
- })]);
- }
- };
- if (headerSlot) {
- scopedSlots.header = () => $xeTable.callSlot(headerSlot, params, h);
- }
- if (mode === 'drawer') {
- return VxeUIDrawerComponent ? h(VxeUIDrawerComponent, {
- key: 'drawer',
- props: {
- className: ['vxe-table-custom-drawer-wrapper', 'vxe-table--ignore-clear', drawerOpts.className || ''].join(' '),
- value: customStore.visible,
- title: drawerOpts.title || panel_getI18n('vxe.custom.cstmTitle'),
- width: drawerOpts.width || Math.min(880, Math.floor(document.documentElement.clientWidth * 0.6)),
- position: drawerOpts.position,
- resize: !!drawerOpts.resize,
- escClosable: !!drawerOpts.escClosable,
- maskClosable: !!drawerOpts.maskClosable,
- destroyOnClose: true,
- showFooter: true
- },
- on: {
- input(value) {
- customStore.visible = value;
- }
- },
- scopedSlots
- }) : panel_renderEmptyElement($xeTableCustomPanel);
- }
- return VxeUIModalComponent ? h(VxeUIModalComponent, {
- key: 'modal',
- props: {
- className: ['vxe-table-custom-popup-wrapper', 'vxe-table--ignore-clear', modalOpts.className || ''].join(' '),
- value: customStore.visible,
- title: modalOpts.title || panel_getI18n('vxe.custom.cstmTitle'),
- width: modalOpts.width || Math.min(880, document.documentElement.clientWidth),
- minWidth: modalOpts.minWidth || 700,
- height: modalOpts.height || Math.min(680, document.documentElement.clientHeight),
- minHeight: modalOpts.minHeight || 400,
- showZoom: modalOpts.showZoom,
- showMaximize: modalOpts.showMaximize,
- showMinimize: modalOpts.showMinimize,
- mask: modalOpts.mask,
- lockView: modalOpts.lockView,
- resize: modalOpts.resize,
- escClosable: !!modalOpts.escClosable,
- maskClosable: !!modalOpts.maskClosable,
- destroyOnClose: true,
- showFooter: true
- },
- on: {
- input(value) {
- customStore.visible = value;
- }
- },
- scopedSlots
- }) : panel_renderEmptyElement($xeTableCustomPanel);
- };
- /* harmony default export */ var panel = ({
- name: 'VxeTableCustomPanel',
- props: {
- customStore: {
- type: Object,
- default: () => ({})
- }
- },
- provide() {
- const $xeTableCustomPanel = this;
- return {
- $xeTableCustomPanel
- };
- },
- inject: {
- $xeTable: {
- default: null
- }
- },
- data() {
- const reactData = {
- dragCol: null,
- dragGroupField: null,
- dragAggFnCol: null,
- dragTipText: ''
- };
- const internalData = {
- // prevDragCol: undefined,
- // prevDragGroupField: undefined,
- // prevDragAggFnColid: undefined,
- // prevDragToChild: false,
- // prevDragPos: null
- };
- return {
- reactData,
- internalData
- };
- },
- computed: {},
- created() {
- const $xeTableCustomPanel = this;
- const VxeUIModalComponent = core_.VxeUI.getComponent('VxeModal');
- const VxeUIDrawerComponent = core_.VxeUI.getComponent('VxeDrawer');
- const VxeUIButtonComponent = core_.VxeUI.getComponent('VxeButton');
- const VxeUINumberInputComponent = core_.VxeUI.getComponent('VxeNumberInput');
- const VxeUIRadioGroupComponent = core_.VxeUI.getComponent('VxeRadioGroup');
- $xeTableCustomPanel.$nextTick(() => {
- const $xeTable = $xeTableCustomPanel.$xeTable;
- const {
- customOpts
- } = $xeTable;
- const {
- mode
- } = customOpts;
- if (!VxeUIModalComponent && mode === 'modal') {
- errLog('vxe.error.reqComp', ['vxe-modal']);
- }
- if (!VxeUIDrawerComponent && mode === 'drawer') {
- errLog('vxe.error.reqComp', ['vxe-drawer']);
- }
- if (!VxeUIButtonComponent) {
- errLog('vxe.error.reqComp', ['vxe-button']);
- }
- if (!VxeUINumberInputComponent) {
- errLog('vxe.error.reqComp', ['vxe-number-input']);
- }
- if (!VxeUIRadioGroupComponent) {
- errLog('vxe.error.reqComp', ['vxe-radio-group']);
- }
- });
- },
- render(h) {
- const $xeTableCustomPanel = this;
- const $xeTable = $xeTableCustomPanel.$xeTable;
- const customOpts = $xeTable.computeCustomOpts;
- if (['modal', 'drawer', 'popup'].includes(`${customOpts.mode}`)) {
- return renderPopupPanel(h, $xeTableCustomPanel);
- }
- return renderSimplePanel(h, $xeTableCustomPanel);
- },
- methods: {
- handleWrapperMouseenterEvent(evnt) {
- const $xeTableCustomPanel = this;
- const $xeTable = $xeTableCustomPanel.$xeTable;
- const {
- customStore
- } = this;
- customStore.activeWrapper = true;
- $xeTable.customOpenEvent(evnt);
- },
- handleWrapperMouseleaveEvent(evnt) {
- const $xeTableCustomPanel = this;
- const $xeTable = $xeTableCustomPanel.$xeTable;
- const props = $xeTableCustomPanel;
- const {
- customStore
- } = props;
- customStore.activeWrapper = false;
- setTimeout(() => {
- if (!customStore.activeBtn && !customStore.activeWrapper) {
- $xeTable.customCloseEvent(evnt);
- }
- }, 300);
- },
- getStoreData() {
- return {};
- },
- confirmCustomEvent({
- $event
- }) {
- const $xeTableCustomPanel = this;
- const $xeTable = $xeTableCustomPanel.$xeTable;
- const tableReactData = $xeTable;
- tableReactData.isCustomStatus = true;
- $xeTable.saveCustom();
- $xeTable.closeCustom();
- $xeTable.emitCustomEvent('confirm', $event);
- },
- cancelCloseEvent({
- $event
- }) {
- const $xeTableCustomPanel = this;
- const $xeTable = $xeTableCustomPanel.$xeTable;
- $xeTable.closeCustom();
- $xeTable.emitCustomEvent('close', $event);
- },
- cancelCustomEvent({
- $event
- }) {
- const $xeTableCustomPanel = this;
- const $xeTable = $xeTableCustomPanel.$xeTable;
- $xeTable.cancelCustom();
- $xeTable.closeCustom();
- $xeTable.emitCustomEvent('cancel', $event);
- },
- handleResetCustomEvent(evnt) {
- const $xeTableCustomPanel = this;
- const $xeTable = $xeTableCustomPanel.$xeTable;
- $xeTable.resetCustom(true);
- $xeTable.closeCustom();
- $xeTable.emitCustomEvent('reset', evnt);
- },
- resetCustomEvent(evnt) {
- if (core_.VxeUI.modal) {
- core_.VxeUI.modal.confirm({
- content: panel_getI18n('vxe.custom.cstmConfirmRestore'),
- className: 'vxe-table--ignore-clear',
- escClosable: true
- }).then(type => {
- if (type === 'confirm') {
- this.handleResetCustomEvent(evnt);
- }
- });
- } else {
- this.handleResetCustomEvent(evnt);
- }
- },
- handleOptionCheck(column) {
- const $xeTableCustomPanel = this;
- const $xeTable = $xeTableCustomPanel.$xeTable;
- const tableReactData = $xeTable;
- const {
- customColumnList
- } = tableReactData;
- const matchObj = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findTree(customColumnList, item => item === column);
- if (matchObj && matchObj.parent) {
- const {
- parent
- } = matchObj;
- if (parent.children && parent.children.length) {
- parent.renderVisible = parent.children.every(column => column.renderVisible);
- parent.halfVisible = !parent.renderVisible && parent.children.some(column => column.renderVisible || column.halfVisible);
- this.handleOptionCheck(parent);
- }
- }
- },
- changeCheckboxOption(column, evnt) {
- const $xeTableCustomPanel = this;
- const $xeTable = $xeTableCustomPanel.$xeTable;
- const tableReactData = $xeTable;
- const isChecked = !column.renderVisible;
- const customOpts = $xeTable.computeCustomOpts;
- if (customOpts.immediate) {
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree([column], item => {
- item.visible = isChecked;
- item.renderVisible = isChecked;
- item.halfVisible = false;
- });
- tableReactData.isCustomStatus = true;
- $xeTable.handleCustom();
- $xeTable.saveCustomStore('update:visible');
- } else {
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree([column], item => {
- item.renderVisible = isChecked;
- item.halfVisible = false;
- });
- }
- this.handleOptionCheck(column);
- $xeTable.checkCustomStatus();
- $xeTable.dispatchEvent('custom-visible-change', {
- column,
- checked: isChecked
- }, evnt);
- },
- changeColumnWidth(column) {
- const $xeTableCustomPanel = this;
- const $xeTable = $xeTableCustomPanel.$xeTable;
- const tableReactData = $xeTable;
- const customOpts = $xeTable.computeCustomOpts;
- if (customOpts.immediate) {
- if (column.renderResizeWidth !== column.renderWidth) {
- column.resizeWidth = column.renderResizeWidth;
- column.renderWidth = column.renderResizeWidth;
- tableReactData.isCustomStatus = true;
- $xeTable.handleCustom();
- $xeTable.saveCustomStore('update:width');
- }
- }
- },
- changeFixedOption(column, colFixed, evnt) {
- const $xeTableCustomPanel = this;
- const $xeTable = $xeTableCustomPanel.$xeTable;
- const tableReactData = $xeTable;
- const isMaxFixedColumn = $xeTable.computeIsMaxFixedColumn;
- const customOpts = $xeTable.computeCustomOpts;
- let targetFixed = null;
- if (customOpts.immediate) {
- if (column.renderFixed === colFixed) {
- targetFixed = '';
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree([column], col => {
- col.fixed = '';
- col.renderFixed = '';
- });
- } else {
- if (!isMaxFixedColumn || column.renderFixed) {
- targetFixed = colFixed;
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree([column], col => {
- col.fixed = colFixed;
- col.renderFixed = colFixed;
- });
- }
- }
- tableReactData.isCustomStatus = true;
- $xeTable.handleCustom();
- $xeTable.saveCustomStore('update:fixed');
- } else {
- if (column.renderFixed === colFixed) {
- targetFixed = '';
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree([column], col => {
- col.renderFixed = '';
- });
- } else {
- if (!isMaxFixedColumn || column.renderFixed) {
- targetFixed = colFixed;
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree([column], col => {
- col.renderFixed = colFixed;
- });
- }
- }
- }
- if (targetFixed !== null) {
- $xeTable.dispatchEvent('custom-fixed-change', {
- column,
- fixed: targetFixed
- }, evnt);
- }
- },
- allOptionEvent(evnt) {
- const $xeTableCustomPanel = this;
- const $xeTable = $xeTableCustomPanel.$xeTable;
- const tableReactData = $xeTable;
- const {
- customStore
- } = tableReactData;
- const isAll = !customStore.isAll;
- $xeTable.toggleCustomAllCheckbox();
- $xeTable.dispatchEvent('custom-visible-all', {
- checked: isAll
- }, evnt);
- },
- updateColDropTipContent() {
- const $xeTableCustomPanel = this;
- const $xeTable = $xeTableCustomPanel.$xeTable;
- const customPanelReactData = $xeTableCustomPanel.reactData;
- const {
- dragCol
- } = customPanelReactData;
- const columnDragOpts = $xeTable.computeColumnDragOpts;
- const {
- tooltipMethod
- } = columnDragOpts;
- let tipContent = '';
- if (tooltipMethod) {
- const dtParams = {
- $table: $xeTable,
- column: dragCol
- };
- tipContent = `${tooltipMethod(dtParams) || ''}`;
- } else {
- tipContent = panel_getI18n('vxe.custom.cstmDragTarget', [dragCol && dragCol.type !== 'html' ? dragCol.getTitle() : '']);
- }
- customPanelReactData.dragTipText = tipContent;
- },
- sortMousedownEvent(evnt) {
- const $xeTableCustomPanel = this;
- const $xeTable = $xeTableCustomPanel.$xeTable;
- const customPanelReactData = $xeTableCustomPanel.reactData;
- const btnEl = evnt.currentTarget;
- const cellEl = btnEl.parentElement;
- const tdEl = cellEl.parentElement;
- const trEl = tdEl.parentElement;
- const colid = trEl.getAttribute('colid');
- const column = $xeTable.getColumnById(colid);
- trEl.draggable = true;
- customPanelReactData.dragCol = column;
- customPanelReactData.dragGroupField = null;
- customPanelReactData.dragAggFnCol = null;
- this.updateColDropTipContent();
- addClass(trEl, 'active--drag-origin');
- },
- sortMouseupEvent(evnt) {
- const $xeTableCustomPanel = this;
- const customPanelReactData = $xeTableCustomPanel.reactData;
- const btnEl = evnt.currentTarget;
- const cellEl = btnEl.parentElement;
- const tdEl = cellEl.parentElement;
- const trEl = tdEl.parentElement;
- panel_hideDropTip($xeTableCustomPanel);
- trEl.draggable = false;
- customPanelReactData.dragCol = null;
- customPanelReactData.dragGroupField = null;
- customPanelReactData.dragAggFnCol = null;
- removeClass(trEl, 'active--drag-origin');
- },
- sortDragstartEvent(evnt) {
- const $xeTableCustomPanel = this;
- const customPanelInternalData = $xeTableCustomPanel.internalData;
- if (evnt.dataTransfer) {
- evnt.dataTransfer.setDragImage(getTpImg(), 0, 0);
- }
- customPanelInternalData.prevDragGroupField = null;
- customPanelInternalData.prevDragAggFnColid = null;
- },
- sortDragendEvent(evnt) {
- const $xeTableCustomPanel = this;
- const $xeTable = $xeTableCustomPanel.$xeTable;
- const tableProps = $xeTable;
- const tableReactData = $xeTable;
- const tableInternalData = $xeTable;
- const customPanelReactData = $xeTableCustomPanel.reactData;
- const customPanelInternalData = $xeTableCustomPanel.internalData;
- const {
- mouseConfig
- } = tableProps;
- const {
- customColumnList
- } = tableReactData;
- const {
- collectColumn
- } = tableInternalData;
- const customOpts = $xeTable.computeCustomOpts;
- const {
- immediate
- } = customOpts;
- const trEl = evnt.currentTarget;
- const columnDragOpts = $xeTable.computeColumnDragOpts;
- const {
- isCrossDrag,
- isSelfToChildDrag,
- isToChildDrag,
- dragEndMethod
- } = columnDragOpts;
- const {
- dragCol
- } = customPanelReactData;
- const {
- prevDragCol,
- prevDragGroupField,
- prevDragAggFnColid,
- prevDragPos,
- prevDragToChild
- } = customPanelInternalData;
- const dragOffsetIndex = prevDragPos === 'bottom' ? 1 : 0;
- if (prevDragGroupField || prevDragAggFnColid) {
- if ($xeTable.handlePivotTableAggregatePanelDragendEvent) {
- $xeTable.handlePivotTableAggregatePanelDragendEvent(evnt);
- }
- } else if (prevDragCol && dragCol) {
- // 判断是否有拖动
- if (prevDragCol !== dragCol) {
- const dragColumn = dragCol;
- const newColumn = prevDragCol;
- Promise.resolve(dragEndMethod ? dragEndMethod({
- oldColumn: dragColumn,
- newColumn,
- dragColumn,
- dragPos: prevDragPos,
- dragToChild: !!prevDragToChild,
- offsetIndex: dragOffsetIndex
- }) : true).then(status => {
- if (!status) {
- return;
- }
- let oafIndex = -1;
- let nafIndex = -1;
- const oldAllMaps = {};
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree([dragColumn], column => {
- oldAllMaps[column.id] = column;
- });
- let isSelfToChildStatus = false;
- // 只有实时拖拽支持跨层级
- if (immediate) {
- if (dragColumn.parentId && newColumn.parentId) {
- // 子到子
- if (!isCrossDrag) {
- return;
- }
- if (oldAllMaps[newColumn.id]) {
- isSelfToChildStatus = true;
- if (!(isCrossDrag && isSelfToChildDrag)) {
- if (core_.VxeUI.modal) {
- core_.VxeUI.modal.message({
- status: 'error',
- content: panel_getI18n('vxe.error.treeDragChild')
- });
- }
- return;
- }
- }
- } else if (dragColumn.parentId) {
- // 子到根
- if (!isCrossDrag) {
- return;
- }
- } else if (newColumn.parentId) {
- // 根到子
- if (!isCrossDrag) {
- return;
- }
- if (oldAllMaps[newColumn.id]) {
- isSelfToChildStatus = true;
- if (!(isCrossDrag && isSelfToChildDrag)) {
- if (core_.VxeUI.modal) {
- core_.VxeUI.modal.message({
- status: 'error',
- content: panel_getI18n('vxe.error.treeDragChild')
- });
- }
- return;
- }
- }
- } else {
- // 根到根
- }
- const oldewMatchRest = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findTree(collectColumn, item => item.id === dragColumn.id);
- // 改变层级
- if (isSelfToChildStatus && isCrossDrag && isSelfToChildDrag) {
- if (oldewMatchRest) {
- const {
- items: oCols,
- index: oIndex
- } = oldewMatchRest;
- const childList = dragColumn.children || [];
- childList.forEach(column => {
- column.parentId = dragColumn.parentId;
- });
- oCols.splice(oIndex, 1, ...childList);
- dragColumn.children = [];
- }
- } else {
- if (oldewMatchRest) {
- const {
- items: oCols,
- index: oIndex,
- parent: oParent
- } = oldewMatchRest;
- oCols.splice(oIndex, 1);
- if (!oParent) {
- oafIndex = oIndex;
- }
- }
- }
- const newMatchRest = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findTree(collectColumn, item => item.id === newColumn.id);
- if (newMatchRest) {
- const {
- items: nCols,
- index: nIndex,
- parent: nParent
- } = newMatchRest;
- // 转子级
- if (isCrossDrag && isToChildDrag && prevDragToChild) {
- dragColumn.parentId = newColumn.id;
- newColumn.children = (newColumn.children || []).concat([dragColumn]);
- } else {
- dragColumn.parentId = newColumn.parentId;
- nCols.splice(nIndex + dragOffsetIndex, 0, dragColumn);
- }
- if (!nParent) {
- nafIndex = nIndex;
- }
- }
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(collectColumn, (column, index, items, path, parent) => {
- if (!parent) {
- const sortIndex = index + 1;
- column.renderSortNumber = sortIndex;
- }
- });
- } else {
- oafIndex = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findIndexOf(customColumnList, item => item.id === dragColumn.id);
- customColumnList.splice(oafIndex, 1);
- nafIndex = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findIndexOf(customColumnList, item => item.id === newColumn.id);
- customColumnList.splice(nafIndex + dragOffsetIndex, 0, dragColumn);
- }
- if (mouseConfig) {
- if ($xeTable.clearSelected) {
- $xeTable.clearSelected();
- }
- if ($xeTable.clearCellAreas) {
- $xeTable.clearCellAreas();
- $xeTable.clearCopyCellArea();
- }
- }
- const csParams = {
- oldColumn: dragColumn,
- newColumn,
- dragColumn,
- dragPos: prevDragPos,
- offsetIndex: dragOffsetIndex,
- _index: {
- newIndex: nafIndex,
- oldIndex: oafIndex
- }
- };
- $xeTable.dispatchEvent('custom-sort-change', csParams, evnt);
- $xeTable.dispatchEvent('column-dragend', csParams, evnt);
- if (immediate) {
- tableReactData.customColumnList = collectColumn.slice(0);
- $xeTable.handleColDragSwapColumn();
- }
- }).catch(() => {});
- }
- }
- panel_hideDropTip($xeTableCustomPanel);
- customPanelReactData.dragCol = null;
- customPanelReactData.dragGroupField = null;
- customPanelReactData.dragAggFnCol = null;
- customPanelInternalData.prevDragGroupField = null;
- customPanelInternalData.prevDragAggFnColid = null;
- trEl.draggable = false;
- trEl.removeAttribute('drag-pos');
- removeClass(trEl, 'active--drag-target');
- removeClass(trEl, 'active--drag-origin');
- },
- sortDragoverEvent(evnt) {
- const $xeTableCustomPanel = this;
- const $xeTable = $xeTableCustomPanel.$xeTable;
- const customPanelReactData = $xeTableCustomPanel.reactData;
- const customPanelInternalData = $xeTableCustomPanel.internalData;
- const {
- dragCol
- } = customPanelReactData;
- const customOpts = $xeTable.computeCustomOpts;
- const {
- immediate
- } = customOpts;
- const columnDragOpts = $xeTable.computeColumnDragOpts;
- const {
- isCrossDrag,
- isToChildDrag
- } = columnDragOpts;
- const optEl = evnt.currentTarget;
- const isControlKey = hasControlKey(evnt);
- const colid = optEl.getAttribute('colid');
- const column = $xeTable.getColumnById(colid);
- customPanelInternalData.prevDragGroupField = null;
- customPanelInternalData.prevDragAggFnColid = null;
- // 是否移入有效列
- if (column && (isCrossDrag || column.level === 1)) {
- evnt.preventDefault();
- const offsetY = evnt.clientY - optEl.getBoundingClientRect().y;
- const dragPos = offsetY < optEl.clientHeight / 2 ? 'top' : 'bottom';
- if (!dragCol || dragCol && dragCol.id === column.id || !isCrossDrag && column.level > 1 || !immediate && column.level > 1) {
- panel_showDropTip($xeTableCustomPanel, evnt, optEl, false, dragPos);
- return;
- }
- customPanelInternalData.prevDragToChild = !!(isCrossDrag && isToChildDrag && isControlKey && immediate);
- customPanelInternalData.prevDragCol = column;
- customPanelInternalData.prevDragPos = dragPos;
- panel_showDropTip($xeTableCustomPanel, evnt, optEl, true, dragPos);
- }
- }
- }
- });
- ;// CONCATENATED MODULE: ./packages/table/module/filter/panel.ts
- const {
- getI18n: filter_panel_getI18n,
- getIcon: filter_panel_getIcon,
- renderer: panel_renderer,
- globalMixins,
- renderEmptyElement: filter_panel_renderEmptyElement
- } = core_.VxeUI;
- // 全部筛选事件
- function filterCheckAllEvent($xeFilterPanel, evnt, value) {
- const props = $xeFilterPanel;
- const {
- filterStore
- } = props;
- const {
- column
- } = filterStore;
- if (column && column.filters) {
- column.filters.forEach(option => {
- option._checked = value;
- option.checked = value;
- });
- }
- filterStore.isAllSelected = value;
- filterStore.isIndeterminate = false;
- }
- /* harmony default export */ var filter_panel = (/* define-vxe-component start */defineVxeComponent({
- name: 'VxeTableFilterPanel',
- mixins: [globalMixins.sizeMixin],
- props: {
- filterStore: {
- type: Object,
- default: () => ({})
- }
- },
- inject: {
- $xeTable: {
- default: null
- }
- },
- computed: {
- ...{},
- computeHasCheckOption() {
- const $xeFilterPanel = this;
- const props = $xeFilterPanel;
- const {
- filterStore
- } = props;
- const {
- column
- } = filterStore;
- return column && column.filters && column.filters.some(option => option.checked);
- }
- },
- mounted() {
- const $xeFilterPanel = this;
- const $xeTable = $xeFilterPanel.$xeTable;
- const filterOpts = $xeTable.computeFilterOpts;
- const {
- transfer
- } = filterOpts;
- const el = $xeFilterPanel.$refs.refElem;
- if (transfer && el) {
- document.body.appendChild(el);
- }
- },
- beforeDestroy() {
- const $xeFilterPanel = this;
- const el = $xeFilterPanel.$refs.refElem;
- if (el && el.parentNode) {
- el.parentNode.removeChild(el);
- }
- },
- methods: {
- /*************************
- * Publish methods
- *************************/
- // (单选)筛选发生改变
- changeRadioOption(evnt, checked, item) {
- const $xeFilterPanel = this;
- const $xeTable = $xeFilterPanel.$xeTable;
- $xeTable.handleFilterChangeRadioOption(evnt, checked, item);
- },
- // (多选)筛选发生改变
- changeMultipleOption(evnt, checked, item) {
- const $xeFilterPanel = this;
- const $xeTable = $xeFilterPanel.$xeTable;
- item._checked = checked;
- $xeTable.checkFilterOptions();
- },
- changeAllOption(evnt, checked) {
- const $xeFilterPanel = this;
- const props = $xeFilterPanel;
- const {
- filterStore
- } = props;
- const {
- column
- } = filterStore;
- if (column && column.filterMultiple) {
- filterCheckAllEvent($xeFilterPanel, evnt, checked);
- } else {
- $xeFilterPanel.resetFilter(evnt);
- }
- },
- // 筛选发生改变
- changeOption(evnt, checked, item) {
- const $xeFilterPanel = this;
- const $xeTable = $xeFilterPanel.$xeTable;
- $xeTable.handleFilterChangeOption(evnt, checked, item);
- },
- // 确认筛选
- confirmFilter(evnt) {
- const $xeFilterPanel = this;
- const props = $xeFilterPanel;
- const $xeTable = $xeFilterPanel.$xeTable;
- const {
- filterStore
- } = props;
- if (!evnt) {
- warnLog('vxe.error.delFunc', ['confirmFilter', 'saveFilterPanelByEvent']);
- }
- $xeTable.handleFilterConfirmFilter(evnt || new Event('click'), filterStore.column || null);
- },
- // 重置筛选
- resetFilter(evnt) {
- const $xeFilterPanel = this;
- const props = $xeFilterPanel;
- const $xeTable = $xeFilterPanel.$xeTable;
- const {
- filterStore
- } = props;
- $xeTable.handleFilterResetFilter(evnt, filterStore.column || null);
- },
- /*************************
- * Publish methods
- *************************/
- renderOptions(h, filterRender, compConf) {
- const $xeFilterPanel = this;
- const props = $xeFilterPanel;
- const $xeTable = $xeFilterPanel.$xeTable;
- const tableInternalData = $xeTable;
- const {
- filterStore
- } = props;
- const {
- column,
- maxHeight
- } = filterStore;
- if (!column) {
- return [];
- }
- const {
- filterMultiple,
- filters,
- slots
- } = column;
- const filterOptions = filters || [];
- const filterSlot = slots ? slots.filter : null;
- const params = Object.assign({}, tableInternalData._currFilterParams, {
- option: filterOptions[0],
- $panel: $xeFilterPanel,
- $table: $xeTable
- });
- const rtFilter = compConf ? compConf.renderTableFilter || compConf.renderFilter : null;
- if (filterSlot) {
- return [h('div', {
- class: 'vxe-table--filter-template',
- style: maxHeight ? {
- maxHeight: toCssUnit(maxHeight)
- } : {}
- }, $xeTable.callSlot(filterSlot, params, h))];
- } else if (filterRender && rtFilter) {
- return [h('div', {
- class: 'vxe-table--filter-template',
- style: maxHeight ? {
- maxHeight: toCssUnit(maxHeight)
- } : {}
- }, getSlotVNs(rtFilter.call($xeTable, h, filterRender, params)))];
- }
- const isAllChecked = filterMultiple ? filterStore.isAllSelected : !filterOptions.some(item => item._checked);
- const isAllIndeterminate = filterMultiple && filterStore.isIndeterminate;
- return [h('ul', {
- class: 'vxe-table--filter-header'
- }, [h('li', {
- class: ['vxe-table--filter-option', {
- 'is--checked': isAllChecked,
- 'is--indeterminate': isAllIndeterminate
- }],
- attrs: {
- title: filter_panel_getI18n(filterMultiple ? 'vxe.table.allTitle' : 'vxe.table.allFilter')
- },
- on: {
- click: evnt => {
- $xeFilterPanel.changeAllOption(evnt, !filterStore.isAllSelected);
- }
- }
- }, (filterMultiple ? [h('span', {
- class: ['vxe-checkbox--icon', isAllIndeterminate ? filter_panel_getIcon().TABLE_CHECKBOX_INDETERMINATE : isAllChecked ? filter_panel_getIcon().TABLE_CHECKBOX_CHECKED : filter_panel_getIcon().TABLE_CHECKBOX_UNCHECKED]
- })] : []).concat([h('span', {
- class: 'vxe-checkbox--label'
- }, filter_panel_getI18n('vxe.table.allFilter'))]))]), h('ul', {
- class: 'vxe-table--filter-body',
- style: maxHeight ? {
- maxHeight: toCssUnit(maxHeight)
- } : {}
- }, filterOptions.map(item => {
- const isChecked = item._checked;
- const isIndeterminate = false;
- return h('li', {
- class: ['vxe-table--filter-option', {
- 'is--checked': isChecked
- }],
- attrs: {
- title: item.label
- },
- on: {
- click: evnt => {
- $xeFilterPanel.changeOption(evnt, !item._checked, item);
- }
- }
- }, (filterMultiple ? [h('span', {
- class: ['vxe-checkbox--icon', isIndeterminate ? filter_panel_getIcon().TABLE_CHECKBOX_INDETERMINATE : isChecked ? filter_panel_getIcon().TABLE_CHECKBOX_CHECKED : filter_panel_getIcon().TABLE_CHECKBOX_UNCHECKED]
- })] : []).concat([h('span', {
- class: 'vxe-checkbox--label'
- }, formatText(item.label, 1))]));
- }))];
- },
- renderFooter(h) {
- const $xeFilterPanel = this;
- const props = $xeFilterPanel;
- const $xeTable = $xeFilterPanel.$xeTable;
- const {
- filterStore
- } = props;
- const {
- column
- } = filterStore;
- if (!column) {
- return [];
- }
- const filterOpts = $xeTable.computeFilterOpts;
- const hasCheckOption = $xeFilterPanel.computeHasCheckOption;
- const {
- filterRender,
- filterMultiple
- } = column;
- const compConf = isEnableConf(filterRender) ? panel_renderer.get(filterRender.name) : null;
- const isDisabled = !hasCheckOption && !filterStore.isAllSelected && !filterStore.isIndeterminate;
- return filterMultiple && (compConf ? !(compConf.showTableFilterFooter === false || compConf.showFilterFooter === false || compConf.isFooter === false) : true) ? [h('div', {
- class: 'vxe-table--filter-footer'
- }, [h('button', {
- class: {
- 'is--disabled': isDisabled
- },
- attrs: {
- disabled: isDisabled
- },
- on: {
- click: $xeFilterPanel.confirmFilter
- }
- }, filterOpts.confirmButtonText || filter_panel_getI18n('vxe.table.confirmFilter')), h('button', {
- on: {
- click: $xeFilterPanel.resetFilter
- }
- }, filterOpts.resetButtonText || filter_panel_getI18n('vxe.table.resetFilter'))])] : [];
- },
- renderVN(h) {
- const $xeFilterPanel = this;
- const props = $xeFilterPanel;
- const $xeTable = $xeFilterPanel.$xeTable;
- const tableInternalData = $xeTable;
- const {
- filterStore
- } = props;
- const {
- visible,
- column
- } = filterStore;
- if (!column) {
- return filter_panel_renderEmptyElement($xeFilterPanel);
- }
- const filterRender = column ? column.filterRender : null;
- const compConf = filterRender && isEnableConf(filterRender) ? panel_renderer.get(filterRender.name) : null;
- const filterClassName = compConf ? compConf.tableFilterClassName || compConf.filterClassName : '';
- const params = Object.assign({}, tableInternalData._currFilterParams, {
- $panel: $xeFilterPanel,
- $table: $xeTable
- });
- const tableProps = $xeTable;
- const vSize = $xeFilterPanel.computeSize;
- const filterOpts = $xeTable.computeFilterOpts;
- const {
- destroyOnClose,
- className
- } = filterOpts;
- return h('div', {
- ref: 'refElem',
- class: ['vxe-table--filter-wrapper', 'filter--prevent-default', className, compConf && compConf.className ? compConf.className : '', getPropClass(filterClassName, params), {
- [`size--${vSize}`]: vSize,
- 'is--animat': tableProps.animat,
- 'is--multiple': column.filterMultiple,
- 'is--active': visible
- }],
- style: filterStore.style
- }, filterStore.visible && (destroyOnClose ? visible : true) && column ? $xeFilterPanel.renderOptions(h, filterRender, compConf).concat($xeFilterPanel.renderFooter(h)) : []);
- }
- },
- render(h) {
- return this.renderVN(h);
- }
- })); /* define-vxe-component end */
- ;// CONCATENATED MODULE: ./packages/table/module/export/import-panel.ts
- const {
- getI18n: import_panel_getI18n,
- getIcon: import_panel_getIcon,
- globalMixins: import_panel_globalMixins,
- renderEmptyElement: import_panel_renderEmptyElement
- } = core_.VxeUI;
- /* harmony default export */ var import_panel = ({
- name: 'VxeTableImportPanel',
- mixins: [import_panel_globalMixins.sizeMixin],
- props: {
- defaultOptions: Object,
- storeData: Object
- },
- components: {
- // VxeModal,
- // VxeRadio
- },
- inject: {
- $xeTable: {
- default: null
- }
- },
- data() {
- return {
- loading: false
- };
- },
- computed: {
- selectName() {
- return `${this.storeData.filename}.${this.storeData.type}`;
- },
- hasFile() {
- return this.storeData.file && this.storeData.type;
- },
- parseTypeLabel() {
- const {
- storeData
- } = this;
- const {
- type,
- typeList
- } = storeData;
- if (type) {
- const selectItem = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().find(typeList, item => type === item.value);
- return selectItem ? selectItem.label : '*.*';
- }
- return `*.${typeList.map(item => item.value).join(', *.')}`;
- }
- },
- created() {
- const $xeTableImportPanel = this;
- const VxeUIModalComponent = core_.VxeUI.getComponent('VxeModal');
- const VxeUIButtonComponent = core_.VxeUI.getComponent('VxeButton');
- const VxeUISelectComponent = core_.VxeUI.getComponent('VxeSelect');
- $xeTableImportPanel.$nextTick(() => {
- if (!VxeUIModalComponent) {
- errLog('vxe.error.reqComp', ['vxe-modal']);
- }
- if (!VxeUIButtonComponent) {
- errLog('vxe.error.reqComp', ['vxe-button']);
- }
- if (!VxeUISelectComponent) {
- errLog('vxe.error.reqComp', ['vxe-select']);
- }
- });
- },
- render(h) {
- const $xeTable = this.$parent;
- const $xeGrid = $xeTable.$xeGrid;
- const $xeGantt = $xeTable.$xeGantt;
- const {
- hasFile,
- loading,
- parseTypeLabel,
- defaultOptions,
- storeData,
- selectName
- } = this;
- const slots = defaultOptions.slots || {};
- const topSlot = slots.top;
- const bottomSlot = slots.bottom;
- const defaultSlot = slots.default;
- const footerSlot = slots.footer;
- return h('vxe-modal', {
- ref: 'modal',
- props: {
- id: 'VXE_IMPORT_MODAL',
- value: storeData.visible,
- title: import_panel_getI18n('vxe.import.impTitle'),
- width: 540,
- minWidth: 360,
- minHeight: 240,
- mask: true,
- lockView: true,
- showFooter: true,
- escClosable: true,
- maskClosable: true,
- showMaximize: true,
- resize: true,
- loading
- },
- on: {
- input(value) {
- storeData.visible = value;
- },
- show: this.showEvent
- },
- scopedSlots: {
- default: () => {
- const params = {
- $table: $xeTable,
- $grid: $xeGrid,
- $gantt: $xeGantt,
- options: defaultOptions,
- params: defaultOptions.params
- };
- return h('div', {
- class: 'vxe-table-export--panel'
- }, [topSlot ? h('div', {
- class: 'vxe-table-export--panel-top'
- }, $xeTable.callSlot(topSlot, params, h)) : import_panel_renderEmptyElement(this), h('div', {
- class: 'vxe-table-export--panel-body'
- }, defaultSlot ? $xeTable.callSlot(defaultSlot, params, h) : [h('table', {
- class: 'vxe-table-export--panel-table',
- attrs: {
- cellspacing: 0,
- cellpadding: 0,
- border: 0
- }
- }, [h('tbody', [h('tr', [h('td', import_panel_getI18n('vxe.import.impFile')), h('td', [hasFile ? h('div', {
- class: 'vxe-table-export--selected--file',
- attrs: {
- title: selectName
- }
- }, [h('span', selectName), h('i', {
- class: import_panel_getIcon().INPUT_CLEAR,
- on: {
- click: this.clearFileEvent
- }
- })]) : h('button', {
- ref: 'fileBtn',
- class: 'vxe-table-export--select--file',
- attrs: {
- type: 'button'
- },
- on: {
- click: this.selectFileEvent
- }
- }, 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', {
- props: {
- value: defaultOptions.mode,
- options: storeData.modeList
- },
- on: {
- modelValue(value) {
- defaultOptions.mode = value;
- }
- }
- })])])])])]), bottomSlot ? h('div', {
- class: 'vxe-table-export--panel-bottom'
- }, $xeTable.callSlot(bottomSlot, params, h)) : import_panel_renderEmptyElement(this)]);
- },
- footer: () => {
- const params = {
- $table: $xeTable,
- $grid: $xeGrid,
- $gantt: $xeGantt,
- options: defaultOptions,
- params: defaultOptions.params
- };
- return h('div', {
- class: 'vxe-table-export--panel-footer'
- }, footerSlot ? $xeTable.callSlot(footerSlot, params, h) : [h('div', {
- class: 'vxe-table-export--panel-btns'
- }, [h('vxe-button', {
- on: {
- click: this.cancelEvent
- }
- }, import_panel_getI18n('vxe.import.impCancel')), h('vxe-button', {
- props: {
- status: 'primary',
- disabled: !hasFile || loading
- },
- on: {
- click: this.importEvent
- }
- }, import_panel_getI18n('vxe.import.impConfirm'))])]);
- }
- }
- });
- },
- methods: {
- clearFileEvent() {
- Object.assign(this.storeData, {
- filename: '',
- sheetName: '',
- type: ''
- });
- },
- selectFileEvent() {
- const $xeTable = this.$parent;
- $xeTable.readFile(this.defaultOptions).then(params => {
- const {
- file
- } = params;
- Object.assign(this.storeData, parseFile(file), {
- file
- });
- }).catch(e => e);
- },
- showEvent() {
- this.$nextTick(() => {
- const {
- $refs
- } = this;
- const targetElem = $refs.fileBtn;
- if (targetElem) {
- targetElem.focus();
- }
- });
- },
- cancelEvent() {
- this.storeData.visible = false;
- },
- importEvent() {
- const $xeTable = this.$parent;
- this.loading = true;
- $xeTable.importByFile(this.storeData.file, Object.assign({}, $xeTable.importOpts, this.defaultOptions)).then(() => {
- this.loading = false;
- this.storeData.visible = false;
- }).catch(() => {
- this.loading = false;
- });
- }
- }
- });
- ;// CONCATENATED MODULE: ./packages/table/module/export/export-panel.ts
- const {
- getI18n: export_panel_getI18n,
- getIcon: export_panel_getIcon,
- globalMixins: export_panel_globalMixins,
- renderEmptyElement: export_panel_renderEmptyElement
- } = core_.VxeUI;
- /* harmony default export */ var export_panel = ({
- name: 'VxeTableExportPanel',
- mixins: [export_panel_globalMixins.sizeMixin],
- props: {
- defaultOptions: Object,
- storeData: Object
- },
- components: {
- // VxeModal,
- // VxeInput,
- // VxeCheckbox,
- // VxeSelect,
- // VxeOption
- },
- inject: {
- $xeTable: {
- default: null
- }
- },
- data() {
- return {
- isAll: false,
- isIndeterminate: false,
- loading: false
- };
- },
- computed: {
- checkedAll() {
- return this.storeData.columns.every(column => column.checked);
- },
- showSheet() {
- return ['html', 'xml', 'xlsx', 'pdf'].indexOf(this.defaultOptions.type) > -1;
- },
- supportMerge() {
- const {
- storeData,
- defaultOptions
- } = this;
- return !defaultOptions.original && defaultOptions.mode === 'current' && (storeData.isPrint || ['html', 'xlsx'].indexOf(defaultOptions.type) > -1);
- },
- // computeSupportGroup () {
- // const { defaultOptions } = this
- // return ['html', 'xlsx', 'csv', 'txt'].indexOf(defaultOptions.type) > -1
- // },
- supportStyle() {
- const {
- defaultOptions
- } = this;
- return !defaultOptions.original && ['xlsx'].indexOf(defaultOptions.type) > -1;
- }
- },
- created() {
- const $xeTableExportPanel = this;
- const VxeUIModalComponent = core_.VxeUI.getComponent('VxeModal');
- const VxeUIButtonComponent = core_.VxeUI.getComponent('VxeButton');
- const VxeUISelectComponent = core_.VxeUI.getComponent('VxeSelect');
- const VxeUIInputComponent = core_.VxeUI.getComponent('VxeInput');
- const VxeUICheckboxComponent = core_.VxeUI.getComponent('VxeCheckbox');
- $xeTableExportPanel.$nextTick(() => {
- if (!VxeUIModalComponent) {
- errLog('vxe.error.reqComp', ['vxe-modal']);
- }
- if (!VxeUIButtonComponent) {
- errLog('vxe.error.reqComp', ['vxe-button']);
- }
- if (!VxeUISelectComponent) {
- errLog('vxe.error.reqComp', ['vxe-select']);
- }
- if (!VxeUIInputComponent) {
- errLog('vxe.error.reqComp', ['vxe-input']);
- }
- if (!VxeUICheckboxComponent) {
- errLog('vxe.error.reqComp', ['vxe-checkbox']);
- }
- });
- },
- render(h) {
- const $xeTable = this.$xeTable;
- const $xeGrid = $xeTable.$xeGrid;
- const $xeGantt = $xeTable.$xeGantt;
- const {
- _e,
- checkedAll,
- isAll: isAllChecked,
- isIndeterminate: isAllIndeterminate,
- showSheet,
- supportMerge,
- supportStyle,
- defaultOptions,
- storeData
- } = this;
- const {
- hasTree,
- hasMerge,
- isPrint,
- hasColgroup,
- columns
- } = storeData;
- const {
- isHeader
- } = defaultOptions;
- // const supportGroup = this.computeSupportGroup
- const slots = defaultOptions.slots || {};
- const topSlot = slots.top;
- const bottomSlot = slots.bottom;
- const defaultSlot = slots.default;
- const footerSlot = slots.footer;
- const parameterSlot = slots.parameter;
- const cols = [];
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(columns, column => {
- const colTitle = formatText(column.getTitle(), 1);
- const isColGroup = column.children && column.children.length;
- const isChecked = column.checked;
- const indeterminate = column.halfChecked;
- const isHtml = column.type === 'html';
- cols.push(h('li', {
- class: ['vxe-table-export--panel-column-option', `level--${column.level}`, {
- 'is--group': isColGroup,
- 'is--checked': isChecked,
- 'is--indeterminate': indeterminate,
- 'is--disabled': column.disabled
- }],
- attrs: {
- title: colTitle
- },
- on: {
- click: () => {
- if (!column.disabled) {
- this.changeOption(column);
- }
- }
- }
- }, [h('span', {
- class: ['vxe-checkbox--icon', indeterminate ? export_panel_getIcon().TABLE_CHECKBOX_INDETERMINATE : isChecked ? export_panel_getIcon().TABLE_CHECKBOX_CHECKED : export_panel_getIcon().TABLE_CHECKBOX_UNCHECKED]
- }), isHtml ? h('span', {
- key: '1',
- class: 'vxe-checkbox--label',
- domProps: {
- innerHTML: colTitle
- }
- }) : h('span', {
- key: '0',
- class: 'vxe-checkbox--label'
- }, colTitle)]));
- });
- return h('vxe-modal', {
- ref: 'modal',
- props: {
- id: 'VXE_EXPORT_MODAL',
- value: storeData.visible,
- title: export_panel_getI18n(isPrint ? 'vxe.export.printTitle' : 'vxe.export.expTitle'),
- width: 660,
- minWidth: 500,
- minHeight: 400,
- mask: true,
- lockView: true,
- showFooter: true,
- escClosable: true,
- maskClosable: true,
- showMaximize: true,
- resize: true,
- loading: this.loading
- },
- on: {
- input(value) {
- storeData.visible = value;
- },
- show: this.showEvent
- },
- scopedSlots: {
- default: () => {
- const params = {
- $table: $xeTable,
- $grid: $xeGrid,
- $gantt: $xeGantt,
- options: defaultOptions,
- columns,
- params: defaultOptions.params
- };
- const hasEmptyData = defaultOptions.mode === 'empty';
- return h('div', {
- class: 'vxe-table-export--panel'
- }, [topSlot ? h('div', {
- class: 'vxe-table-export--panel-top'
- }, $xeTable.callSlot(topSlot, params, h)) : export_panel_renderEmptyElement(this), h('div', {
- class: 'vxe-table-export--panel-body'
- }, defaultSlot ? $xeTable.callSlot(defaultSlot, params, h) : [h('table', {
- attrs: {
- class: 'vxe-table-export--panel-table',
- cellspacing: 0,
- cellpadding: 0,
- border: 0
- }
- }, [h('tbody', [[isPrint ? _e() : h('tr', [h('td', export_panel_getI18n('vxe.export.expName')), h('td', [h('vxe-input', {
- ref: 'filename',
- props: {
- value: defaultOptions.filename,
- type: 'text',
- clearable: true,
- placeholder: export_panel_getI18n('vxe.export.expNamePlaceholder')
- },
- on: {
- modelValue(value) {
- defaultOptions.filename = value;
- }
- }
- })])]), isPrint ? _e() : h('tr', [h('td', export_panel_getI18n('vxe.export.expType')), h('td', [h('vxe-select', {
- props: {
- value: defaultOptions.type,
- options: storeData.typeList
- },
- on: {
- modelValue(value) {
- defaultOptions.type = value;
- }
- }
- })])]), isPrint || showSheet ? h('tr', [h('td', export_panel_getI18n('vxe.export.expSheetName')), h('td', [h('vxe-input', {
- ref: 'sheetname',
- props: {
- value: defaultOptions.sheetName,
- type: 'text',
- clearable: true,
- placeholder: export_panel_getI18n('vxe.export.expSheetNamePlaceholder')
- },
- on: {
- modelValue(value) {
- defaultOptions.sheetName = value;
- }
- }
- })])]) : _e(), h('tr', [h('td', export_panel_getI18n('vxe.export.expMode')), h('td', [h('vxe-select', {
- props: {
- value: defaultOptions.mode,
- options: storeData.modeList
- },
- on: {
- modelValue(value) {
- defaultOptions.mode = value;
- }
- }
- })])]), h('tr', [h('td', [export_panel_getI18n('vxe.export.expColumn')]), h('td', [h('div', {
- class: 'vxe-table-export--panel-column'
- }, [h('ul', {
- class: 'vxe-table-export--panel-column-header'
- }, [h('li', {
- class: ['vxe-table-export--panel-column-option', {
- 'is--checked': isAllChecked,
- 'is--indeterminate': isAllIndeterminate
- }],
- attrs: {
- title: export_panel_getI18n('vxe.table.allTitle')
- },
- on: {
- click: this.allColumnEvent
- }
- }, [h('span', {
- class: ['vxe-checkbox--icon', isAllIndeterminate ? export_panel_getIcon().TABLE_CHECKBOX_INDETERMINATE : isAllChecked ? export_panel_getIcon().TABLE_CHECKBOX_CHECKED : export_panel_getIcon().TABLE_CHECKBOX_UNCHECKED]
- }), h('span', {
- class: 'vxe-checkbox--label'
- }, export_panel_getI18n('vxe.export.expCurrentColumn'))])]), h('ul', {
- class: 'vxe-table-export--panel-column-body'
- }, cols)])])]), h('tr', [h('td', export_panel_getI18n('vxe.export.expOpts')), parameterSlot ? h('td', [h('div', {
- class: 'vxe-table-export--panel-option-row'
- }, $xeTable.callSlot(parameterSlot, params, h))]) : h('td', [h('div', {
- class: 'vxe-table-export--panel-option-row'
- }, [h('vxe-checkbox', {
- props: {
- value: hasEmptyData || isHeader,
- disabled: hasEmptyData,
- title: export_panel_getI18n('vxe.export.expHeaderTitle'),
- content: export_panel_getI18n('vxe.export.expOptHeader')
- },
- on: {
- input(value) {
- defaultOptions.isHeader = value;
- }
- }
- }), h('vxe-checkbox', {
- props: {
- value: isHeader ? defaultOptions.isTitle : false,
- disabled: !isHeader,
- title: export_panel_getI18n('vxe.export.expTitleTitle'),
- content: export_panel_getI18n('vxe.export.expOptTitle')
- },
- on: {
- input(value) {
- defaultOptions.isTitle = value;
- }
- }
- }), h('vxe-checkbox', {
- props: {
- value: isHeader && hasColgroup && supportMerge ? defaultOptions.isColgroup : false,
- disabled: !isHeader || !hasColgroup || !supportMerge,
- title: export_panel_getI18n('vxe.export.expColgroupTitle'),
- content: export_panel_getI18n('vxe.export.expOptColgroup')
- },
- on: {
- input(value) {
- defaultOptions.isColgroup = value;
- }
- }
- })]), h('div', {
- class: 'vxe-table-export--panel-option-row'
- }, [h('vxe-checkbox', {
- props: {
- value: hasEmptyData ? false : defaultOptions.original,
- disabled: hasEmptyData,
- title: export_panel_getI18n('vxe.export.expOriginalTitle'),
- content: export_panel_getI18n('vxe.export.expOptOriginal')
- },
- on: {
- input(value) {
- defaultOptions.original = value;
- }
- }
- }), h('vxe-checkbox', {
- props: {
- value: hasMerge && supportMerge && checkedAll ? defaultOptions.isMerge : false,
- disabled: hasEmptyData || !hasMerge || !supportMerge || !checkedAll,
- title: export_panel_getI18n('vxe.export.expMergeTitle'),
- content: export_panel_getI18n('vxe.export.expOptMerge')
- },
- on: {
- input(value) {
- defaultOptions.isMerge = value;
- }
- }
- }), isPrint ? _e() : h('vxe-checkbox', {
- props: {
- value: supportStyle ? defaultOptions.useStyle : false,
- disabled: !supportStyle,
- title: export_panel_getI18n('vxe.export.expUseStyleTitle'),
- content: export_panel_getI18n('vxe.export.expOptUseStyle')
- },
- on: {
- input(value) {
- defaultOptions.useStyle = value;
- }
- }
- }), h('vxe-checkbox', {
- props: {
- value: hasTree ? defaultOptions.isAllExpand : false,
- disabled: hasEmptyData || !hasTree,
- title: export_panel_getI18n('vxe.export.expAllExpandTitle'),
- content: export_panel_getI18n('vxe.export.expOptAllExpand')
- },
- on: {
- input(value) {
- defaultOptions.isAllExpand = value;
- }
- }
- })]), h('div', {
- class: 'vxe-table-export--panel-option-row'
- }, [h('vxe-checkbox', {
- props: {
- value: defaultOptions.isFooter,
- disabled: !storeData.hasFooter,
- title: export_panel_getI18n('vxe.export.expFooterTitle'),
- content: export_panel_getI18n('vxe.export.expOptFooter')
- },
- on: {
- input(value) {
- defaultOptions.isFooter = value;
- }
- }
- })])])])]])])]), bottomSlot ? h('div', {
- class: 'vxe-table-export--panel-bottom'
- }, $xeTable.callSlot(bottomSlot, params, h)) : export_panel_renderEmptyElement(this)]);
- },
- footer: () => {
- const params = {
- $table: $xeTable,
- $grid: $xeGrid,
- $gantt: $xeGantt,
- options: defaultOptions,
- columns,
- params: defaultOptions.params
- };
- return h('div', {
- class: 'vxe-table-export--panel-footer'
- }, footerSlot ? $xeTable.callSlot(footerSlot, params, h) : [h('div', {
- class: 'vxe-table-export--panel-btns'
- }, [h('vxe-button', {
- props: {
- content: export_panel_getI18n('vxe.export.expCancel')
- },
- on: {
- click: this.cancelEvent
- }
- }), h('vxe-button', {
- ref: 'confirmBtn',
- props: {
- status: 'primary',
- content: export_panel_getI18n(isPrint ? 'vxe.export.expPrint' : 'vxe.export.expConfirm')
- },
- on: {
- click: this.confirmEvent
- }
- })])]);
- }
- }
- });
- },
- methods: {
- changeOption(column) {
- const isChecked = !column.checked;
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree([column], item => {
- item.checked = isChecked;
- item.halfChecked = false;
- });
- this.handleOptionCheck(column);
- this.checkStatus();
- },
- handleOptionCheck(column) {
- const matchObj = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findTree(this.storeData.columns, item => item === column);
- if (matchObj && matchObj.parent) {
- const {
- parent
- } = matchObj;
- if (parent.children && parent.children.length) {
- parent.checked = parent.children.every(column => column.checked);
- parent.halfChecked = !parent.checked && parent.children.some(column => column.checked || column.halfChecked);
- this.handleOptionCheck(parent);
- }
- }
- },
- checkStatus() {
- const columns = this.storeData.columns;
- this.isAll = columns.every(column => column.disabled || column.checked);
- this.isIndeterminate = !this.isAll && columns.some(column => !column.disabled && (column.checked || column.halfChecked));
- },
- allColumnEvent() {
- const isAll = !this.isAll;
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(this.storeData.columns, column => {
- if (!column.disabled) {
- column.checked = isAll;
- column.halfChecked = false;
- }
- });
- this.isAll = isAll;
- this.checkStatus();
- },
- showEvent() {
- this.$nextTick(() => {
- const {
- $refs
- } = this;
- const targetElem = $refs.filename || $refs.sheetname || $refs.confirmBtn;
- if (targetElem) {
- targetElem.focus();
- }
- });
- this.checkStatus();
- },
- getExportOption() {
- const {
- checkedAll,
- storeData,
- defaultOptions,
- supportMerge
- } = this;
- const {
- hasMerge,
- columns
- } = storeData;
- const expColumns = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().searchTree(columns, column => column.checked, {
- children: 'children',
- mapChildren: 'childNodes',
- original: true
- });
- return Object.assign({}, defaultOptions, {
- columns: expColumns,
- isMerge: hasMerge && supportMerge && checkedAll ? defaultOptions.isMerge : false
- });
- },
- cancelEvent() {
- this.storeData.visible = false;
- },
- confirmEvent(evnt) {
- if (this.storeData.isPrint) {
- this.printEvent(evnt);
- } else {
- this.exportEvent(evnt);
- }
- },
- printEvent() {
- const $xeTable = this.$parent;
- this.storeData.visible = false;
- $xeTable.print(Object.assign({}, $xeTable.printOpts, this.getExportOption()));
- },
- exportEvent() {
- const $xeTable = this.$xeTable;
- const exportOpts = $xeTable.exportOpts;
- this.loading = true;
- $xeTable.exportData(Object.assign({}, exportOpts, this.getExportOption())).then(() => {
- this.loading = false;
- this.storeData.visible = false;
- }).catch(() => {
- this.loading = false;
- });
- }
- }
- });
- ;// CONCATENATED MODULE: ./packages/table/module/menu/panel.ts
- const {
- getIcon: menu_panel_getIcon,
- renderEmptyElement: menu_panel_renderEmptyElement
- } = core_.VxeUI;
- /* harmony default export */ var menu_panel = ({
- name: 'VxeTableMenuPanel',
- props: {
- ctxMenuStore: Object,
- ctxMenuOpts: Object
- },
- inject: {
- $xeTable: {
- default: null
- }
- },
- mounted() {
- const $xeMenuPanel = this;
- const $xeTable = $xeMenuPanel.$xeTable;
- const menuOpts = $xeTable.computeMenuOpts;
- const {
- transfer
- } = menuOpts;
- const el = this.$refs.refElem;
- if (transfer && el) {
- document.body.appendChild(el);
- }
- },
- beforeDestroy() {
- const el = this.$refs.refElem;
- if (el && el.parentNode) {
- el.parentNode.removeChild(el);
- }
- },
- render(h) {
- const $xeMenuPanel = this;
- const $xeTable = $xeMenuPanel.$xeTable;
- const tableReactData = $xeTable;
- const {
- ctxMenuStore
- } = tableReactData;
- const menuOpts = $xeTable.computeMenuOpts;
- const {
- destroyOnClose
- } = menuOpts;
- const {
- visible,
- list,
- className
- } = ctxMenuStore;
- return h('div', {
- ref: 'refElem',
- class: ['vxe-table--context-menu-wrapper', className, {
- 'is--visible': visible
- }],
- style: ctxMenuStore.style
- }, (destroyOnClose ? visible : true) ? list.map((options, gIndex) => {
- return options.every(item => item.visible === false) ? menu_panel_renderEmptyElement($xeTable) : h('ul', {
- class: 'vxe-context-menu--option-wrapper',
- key: gIndex
- }, options.map((item, index) => {
- const hasChildMenus = item.children && item.children.some(child => child.visible !== false);
- const prefixOpts = Object.assign({}, item.prefixConfig);
- const prefixIcon = prefixOpts.icon || item.prefixIcon;
- const suffixOpts = Object.assign({}, item.suffixConfig);
- const suffixIcon = suffixOpts.icon || item.suffixIcon;
- const menuContent = getFuncText(item.name);
- return item.visible === false ? menu_panel_renderEmptyElement($xeTable) : h('li', {
- class: [item.className, {
- 'link--disabled': item.disabled,
- 'link--active': item === ctxMenuStore.selected
- }],
- key: `${gIndex}_${index}`
- }, [h('a', {
- class: 'vxe-context-menu--link',
- on: {
- click(evnt) {
- $xeTable.ctxMenuLinkEvent(evnt, item);
- },
- mouseover(evnt) {
- $xeTable.ctxMenuMouseoverEvent(evnt, item);
- },
- mouseout(evnt) {
- $xeTable.ctxMenuMouseoutEvent(evnt, item);
- }
- }
- }, [h('div', {
- class: ['vxe-context-menu--link-prefix', prefixOpts.className || '']
- }, [prefixIcon && external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(prefixIcon) ? h('span', {}, getSlotVNs(prefixIcon.call($xeTable, {}))) : h('i', {
- class: prefixIcon
- }), prefixOpts.content ? h('span', {}, `${prefixOpts.content}`) : menu_panel_renderEmptyElement($xeTable)]), h('span', {
- class: 'vxe-context-menu--link-content',
- attrs: {
- title: menuContent
- }
- }, menuContent), h('div', {
- class: ['vxe-context-menu--link-suffix', suffixOpts.className || '']
- }, [suffixIcon && external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(suffixIcon) ? h('span', {}, getSlotVNs(suffixIcon.call($xeTable, {}))) : h('i', {
- class: suffixIcon || (hasChildMenus ? menu_panel_getIcon().TABLE_MENU_OPTIONS : '')
- }), suffixOpts.content ? h('span', `${suffixOpts.content}`) : menu_panel_renderEmptyElement($xeTable)])]), hasChildMenus && item.children ? h('ul', {
- class: ['vxe-table--context-menu-clild-wrapper', {
- 'is--show': item === ctxMenuStore.selected && ctxMenuStore.showChild
- }]
- }, item.children.map((child, cIndex) => {
- const childPrefixOpts = Object.assign({}, child.prefixConfig);
- const childPrefixIcon = childPrefixOpts.icon || child.prefixIcon;
- const childSuffixOpts = Object.assign({}, child.suffixConfig);
- const childSuffixIcon = childSuffixOpts.icon || child.suffixIcon;
- const childMenuContent = getFuncText(child.name);
- return child.visible === false ? null : h('li', {
- class: [child.className, {
- 'link--disabled': child.disabled,
- 'link--active': child === ctxMenuStore.selectChild
- }],
- key: `${gIndex}_${index}_${cIndex}`
- }, [h('a', {
- class: 'vxe-context-menu--link',
- on: {
- click(evnt) {
- $xeTable.ctxMenuLinkEvent(evnt, child);
- },
- mouseover(evnt) {
- $xeTable.ctxMenuMouseoverEvent(evnt, item, child);
- },
- mouseout(evnt) {
- $xeTable.ctxMenuMouseoutEvent(evnt, item);
- }
- }
- }, [h('div', {
- class: ['vxe-context-menu--link-prefix', childPrefixOpts.className || '']
- }, [childPrefixIcon && external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(childPrefixIcon) ? h('span', {}, getSlotVNs(childPrefixIcon.call($xeTable, {}))) : h('i', {
- class: childPrefixIcon
- }), childPrefixOpts.content ? h('span', `${childPrefixOpts.content}`) : menu_panel_renderEmptyElement($xeTable)]), h('span', {
- class: 'vxe-context-menu--link-content',
- attrs: {
- title: childMenuContent
- }
- }, childMenuContent), h('div', {
- class: ['vxe-context-menu--link-suffix', childSuffixOpts.className || '']
- }, [childSuffixIcon && external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(childSuffixIcon) ? h('span', {}, getSlotVNs(childSuffixIcon.call($xeTable, {}))) : h('i', {
- class: childSuffixIcon
- }), childSuffixOpts.content ? h('span', `${childSuffixOpts.content}`) : menu_panel_renderEmptyElement($xeTable)])])]);
- })) : null]);
- }));
- }) : []);
- }
- });
- ;// CONCATENATED MODULE: ./packages/table/module/filter/mixin.ts
- const {
- renderer: mixin_renderer
- } = core_.VxeUI;
- /* harmony default export */ var mixin = ({
- methods: {
- /**
- * 手动弹出筛选面板
- * @param column
- */
- _openFilter(fieldOrColumn) {
- const $xeTable = this;
- const column = handleFieldOrColumn(this, fieldOrColumn);
- if (column && column.filters) {
- const {
- elemStore
- } = this;
- const {
- fixed
- } = column;
- return $xeTable.scrollToColumn(column).then(() => {
- const headerWrapperElem = elemStore[`${fixed || 'main'}-header-wrapper`] || elemStore['main-header-wrapper'];
- if (headerWrapperElem) {
- const filterBtnElem = headerWrapperElem.querySelector(`.vxe-header--column.${column.id} .vxe-cell--filter`);
- triggerEvent(filterBtnElem, 'click');
- }
- });
- }
- return $xeTable.$nextTick();
- },
- /**
- * 修改筛选条件列表
- * @param {ColumnInfo} fieldOrColumn 列
- * @param {Array} options 选项
- */
- _setFilter(fieldOrColumn, options, isUpdate) {
- const $xeTable = this;
- const reactData = $xeTable;
- const {
- filterStore
- } = reactData;
- const column = handleFieldOrColumn($xeTable, fieldOrColumn);
- if (column && column.filters) {
- column.filters = toFilters(options || [], column.id);
- if (isUpdate) {
- return $xeTable.handleColumnConfirmFilter(column, null);
- } else {
- if (filterStore.visible) {
- $xeTable.handleFilterOptions(column);
- }
- }
- }
- return $xeTable.$nextTick();
- },
- checkFilterOptions() {
- const $xeTable = this;
- const reactData = $xeTable;
- const {
- filterStore
- } = reactData;
- const {
- column
- } = filterStore;
- if (column) {
- const filterOptions = column.filters || [];
- filterStore.isAllSelected = filterOptions.every(item => item._checked);
- filterStore.isIndeterminate = !filterStore.isAllSelected && filterOptions.some(item => item._checked);
- }
- },
- /**
- * 点击筛选事件
- * 当筛选图标被点击时触发
- * 更新选项是否全部状态
- * 打开筛选面板
- * @param {Event} evnt 事件
- * @param {ColumnInfo} column 列配置
- * @param {Object} params 参数
- */
- triggerFilterEvent(evnt, column, params) {
- const $xeTable = this;
- const $xeGrid = $xeTable.$xeGrid;
- const $xeGantt = $xeTable.$xeGantt;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const $xeGGWrapper = $xeGrid || $xeGantt;
- const {
- initStore,
- filterStore
- } = reactData;
- const {
- elemStore
- } = internalData;
- if (filterStore.column === column && filterStore.visible) {
- filterStore.visible = false;
- } else {
- const tableEl = $xeTable.$refs.refElem;
- const {
- scrollTop,
- scrollLeft,
- visibleHeight,
- visibleWidth
- } = getDomNode();
- const filterOpts = $xeTable.computeFilterOpts;
- const {
- transfer
- } = filterOpts;
- const tableRect = tableEl.getBoundingClientRect();
- const btnElem = evnt.currentTarget;
- const filterRender = column ? column.filterRender : null;
- const compConf = filterRender && isEnableConf(filterRender) ? mixin_renderer.get(filterRender.name) : null;
- $xeTable.handleFilterOptions(column);
- internalData._currFilterParams = params;
- filterStore.style = null;
- filterStore.visible = true;
- initStore.filter = true;
- $xeTable.$nextTick(() => {
- const headerScrollElem = getRefElem(elemStore['main-header-scroll']);
- if (!headerScrollElem) {
- return;
- }
- const tableFilter = $xeTable.$refs.refTableFilter;
- const filterWrapperElem = tableFilter ? tableFilter.$el : null;
- if (!filterWrapperElem) {
- return;
- }
- const btnRect = btnElem.getBoundingClientRect();
- const filterHeadElem = filterWrapperElem.querySelector('.vxe-table--filter-header');
- const filterFootElem = filterWrapperElem.querySelector('.vxe-table--filter-footer');
- const filterWidth = filterWrapperElem.offsetWidth;
- const centerWidth = filterWidth / 2;
- let left = 0;
- let top = 0;
- let maxHeight = 0;
- if (transfer) {
- left = btnRect.left - centerWidth + scrollLeft;
- top = btnRect.top + btnElem.clientHeight + scrollTop;
- 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));
- if (left < 16) {
- left = 16;
- } else if (left > visibleWidth - filterWidth - 16) {
- left = visibleWidth - filterWidth - 16;
- }
- } else {
- left = btnRect.left - tableRect.left - centerWidth;
- top = btnRect.top - tableRect.top + btnElem.clientHeight;
- maxHeight = Math.max(40, tableEl.clientHeight - top - (filterHeadElem ? filterHeadElem.clientHeight : 0) - (filterFootElem ? filterFootElem.clientHeight : 0) - 14);
- if (left < 1) {
- left = 1;
- } else if (left > tableEl.clientWidth - filterWidth - 1) {
- left = tableEl.clientWidth - filterWidth - 1;
- }
- if ($xeGGWrapper) {
- const wrapperEl = $xeGGWrapper.$refs.refElem;
- if (wrapperEl) {
- const wrapperRect = wrapperEl.getBoundingClientRect();
- top += tableRect.top - wrapperRect.top;
- }
- }
- }
- filterStore.style = {
- top: toCssUnit(top),
- left: toCssUnit(left)
- };
- // 筛选面板是自适应表格高度
- if (compConf ? !compConf.tableFilterAutoHeight : false) {
- maxHeight = 0;
- }
- // 判断面板不能大于表格高度
- filterStore.maxHeight = maxHeight;
- });
- }
- $xeTable.dispatchEvent('filter-visible', {
- column,
- field: column.field,
- property: column.field,
- filterList: $xeTable.getCheckedFilters(),
- visible: filterStore.visible
- }, evnt);
- },
- // (单选)筛选发生改变
- handleFilterChangeRadioOption(evnt, checked, item) {
- const $xeTable = this;
- const reactData = $xeTable;
- const {
- filterStore
- } = reactData;
- const {
- column
- } = filterStore;
- if (column) {
- const filterOptions = column.filters || [];
- filterOptions.forEach(option => {
- option._checked = false;
- });
- item._checked = checked;
- $xeTable.checkFilterOptions();
- $xeTable.handleFilterConfirmFilter(evnt, column);
- }
- },
- // (多选)筛选发生改变
- handleFilterChangeMultipleOption(evnt, checked, item) {
- const $xeTable = this;
- item._checked = checked;
- $xeTable.checkFilterOptions();
- },
- // 筛选发生改变
- handleFilterChangeOption(evnt, checked, item) {
- const $xeTable = this;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- filterStore
- } = reactData;
- const {
- fullColumnIdData
- } = internalData;
- let column = filterStore.column;
- if (!column) {
- const colRest = fullColumnIdData[item._colId];
- if (colRest) {
- column = colRest.column;
- filterStore.column = column;
- }
- }
- if (column) {
- if (column.filterMultiple) {
- $xeTable.handleFilterChangeMultipleOption(evnt, checked, item);
- } else {
- $xeTable.handleFilterChangeRadioOption(evnt, checked, item);
- }
- }
- },
- // 确认筛选
- handleFilterConfirmFilter(evnt, column) {
- const $xeTable = this;
- if (column) {
- const filterOptions = column.filters || [];
- filterOptions.forEach(option => {
- option.checked = option._checked;
- });
- $xeTable.confirmFilterEvent(evnt, column);
- }
- },
- _saveFilter(fieldOrColumn) {
- const $xeTable = this;
- if (fieldOrColumn) {
- const column = handleFieldOrColumn($xeTable, fieldOrColumn);
- $xeTable.handleFilterConfirmFilter(null, column);
- }
- return $xeTable.$nextTick();
- },
- _saveFilterByEvent(evnt, fieldOrColumn) {
- const $xeTable = this;
- if (fieldOrColumn) {
- const column = handleFieldOrColumn($xeTable, fieldOrColumn);
- $xeTable.handleFilterConfirmFilter(evnt, column);
- }
- return $xeTable.$nextTick();
- },
- _resetFilter(fieldOrColumn) {
- const $xeTable = this;
- if (fieldOrColumn) {
- const column = handleFieldOrColumn($xeTable, fieldOrColumn);
- $xeTable.handleFilterResetFilter(null, column);
- }
- return $xeTable.$nextTick();
- },
- _resetFilterByEvent(evnt, fieldOrColumn) {
- const $xeTable = this;
- if (fieldOrColumn) {
- const column = handleFieldOrColumn($xeTable, fieldOrColumn);
- $xeTable.handleFilterResetFilter(evnt, column);
- }
- return $xeTable.$nextTick();
- },
- _saveFilterPanel() {
- const $xeTable = this;
- const reactData = $xeTable;
- const {
- filterStore
- } = reactData;
- $xeTable.handleFilterConfirmFilter(null, filterStore.column || null);
- return $xeTable.$nextTick();
- },
- _saveFilterPanelByEvent(evnt) {
- const $xeTable = this;
- const reactData = $xeTable;
- const {
- filterStore
- } = reactData;
- $xeTable.handleFilterConfirmFilter(evnt, filterStore.column || null);
- return $xeTable.$nextTick();
- },
- _resetFilterPanel() {
- const $xeTable = this;
- const reactData = $xeTable;
- const {
- filterStore
- } = reactData;
- $xeTable.handleFilterResetFilter(null, filterStore.column || null);
- return $xeTable.$nextTick();
- },
- _resetFilterPanelByEvent(evnt) {
- const $xeTable = this;
- const reactData = $xeTable;
- const {
- filterStore
- } = reactData;
- $xeTable.handleFilterResetFilter(evnt, filterStore.column || null);
- return $xeTable.$nextTick();
- },
- _getCheckedFilters() {
- const $xeTable = this;
- const internalData = $xeTable;
- const {
- tableFullColumn
- } = internalData;
- const filterList = [];
- tableFullColumn.forEach(column => {
- const {
- field,
- filters
- } = column;
- const filterOptions = filters || [];
- const valueList = [];
- const dataList = [];
- if (filterOptions) {
- filterOptions.forEach(item => {
- if (item.checked) {
- valueList.push(item.value);
- dataList.push(item.data);
- }
- });
- if (valueList.length) {
- filterList.push({
- column,
- field,
- property: field,
- values: valueList,
- datas: dataList
- });
- }
- }
- });
- return filterList;
- },
- handleColumnConfirmFilter(column, evnt) {
- const $xeTable = this;
- const props = $xeTable;
- const reactData = $xeTable;
- const {
- mouseConfig
- } = props;
- const {
- scrollXLoad: oldScrollXLoad,
- scrollYLoad: oldScrollYLoad
- } = reactData;
- const filterOpts = $xeTable.computeFilterOpts;
- const mouseOpts = $xeTable.computeMouseOpts;
- const {
- field,
- filters
- } = column;
- const filterOptions = filters || [];
- const values = [];
- const datas = [];
- filterOptions.forEach(item => {
- if (item.checked) {
- values.push(item.value);
- datas.push(item.data);
- }
- });
- const filterList = $xeTable.getCheckedFilters();
- const params = {
- $table: $xeTable,
- $event: evnt,
- column,
- field,
- property: field,
- values,
- datas,
- filters: filterList,
- filterList
- };
- // 如果是服务端筛选,则跳过本地筛选处理
- if (!filterOpts.remote) {
- $xeTable.handleTableData(true);
- $xeTable.checkSelectionStatus();
- }
- if (mouseConfig && mouseOpts.area && $xeTable.handleFilterEvent) {
- $xeTable.handleFilterEvent(evnt, params);
- }
- if (evnt) {
- $xeTable.dispatchEvent('filter-change', params, evnt);
- }
- $xeTable.closeFilter();
- return $xeTable.updateFooter().then(() => {
- const {
- scrollXLoad,
- scrollYLoad
- } = reactData;
- if (oldScrollXLoad || scrollXLoad || oldScrollYLoad || scrollYLoad) {
- if (oldScrollXLoad || scrollXLoad) {
- $xeTable.updateScrollXSpace();
- }
- if (oldScrollYLoad || scrollYLoad) {
- $xeTable.updateScrollYSpace();
- }
- return $xeTable.refreshScroll();
- }
- }).then(() => {
- $xeTable.updateCellAreas();
- return $xeTable.recalculate(true);
- }).then(() => {
- // 存在滚动行为未结束情况
- setTimeout(() => $xeTable.recalculate(), 50);
- });
- },
- /**
- * 确认筛选
- * 当筛选面板中的确定按钮被按下时触发
- */
- confirmFilterEvent(evnt, column) {
- const $xeTable = this;
- if (column) {
- $xeTable.handleColumnConfirmFilter(column, evnt);
- }
- },
- handleClearFilter(column) {
- const $xeTable = this;
- if (column) {
- const {
- filters,
- filterRender
- } = column;
- if (filters) {
- const compConf = isEnableConf(filterRender) ? mixin_renderer.get(filterRender.name) : null;
- const filterResetMethod = column.filterResetMethod || (compConf ? compConf.tableFilterResetMethod || compConf.filterResetMethod : null);
- filters.forEach(item => {
- item._checked = false;
- item.checked = false;
- if (!filterResetMethod) {
- item.data = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().clone(item.resetValue, true);
- }
- });
- if (filterResetMethod) {
- filterResetMethod({
- options: filters,
- column,
- $table: $xeTable
- });
- }
- }
- }
- },
- /**
- * 重置筛选
- * 当筛选面板中的重置按钮被按下时触发
- * @param {Event} evnt 事件
- */
- handleFilterResetFilter(evnt, column) {
- const $xeTable = this;
- if (column) {
- $xeTable.handleClearFilter(column);
- $xeTable.confirmFilterEvent(evnt, column);
- if (evnt) {
- $xeTable.dispatchEvent('clear-filter', {
- filterList: []
- }, evnt);
- }
- }
- },
- /**
- * 清空指定列的筛选条件
- * 如果为空则清空所有列的筛选条件
- * @param {String} fieldOrColumn 列
- */
- _clearFilter(fieldOrColumn) {
- const $xeTable = this;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- filterStore
- } = reactData;
- const {
- tableFullColumn
- } = internalData;
- let column;
- if (fieldOrColumn) {
- column = handleFieldOrColumn($xeTable, fieldOrColumn);
- if (column) {
- $xeTable.handleClearFilter(column);
- }
- } else {
- tableFullColumn.forEach($xeTable.handleClearFilter);
- }
- if (!fieldOrColumn || column !== filterStore.column) {
- Object.assign(filterStore, {
- isAllSelected: false,
- isIndeterminate: false,
- style: null,
- options: [],
- column: null,
- multiple: false,
- visible: false
- });
- }
- return $xeTable.updateData();
- },
- _updateFilterOptionStatus(item, checked) {
- const $xeTable = this;
- item._checked = checked;
- item.checked = checked;
- return $xeTable.$nextTick();
- }
- }
- });
- ;// CONCATENATED MODULE: ./packages/table/module/menu/mixin.ts
- const {
- menus: mixin_menus,
- globalEvents: mixin_globalEvents,
- GLOBAL_EVENT_KEYS
- } = core_.VxeUI;
- /* harmony default export */ var menu_mixin = ({
- methods: {
- /**
- * 关闭快捷菜单
- */
- _closeMenu() {
- const $xeTable = this;
- const reactData = $xeTable;
- Object.assign(reactData.ctxMenuStore, {
- visible: false,
- selected: null,
- selectChild: null,
- showChild: false
- });
- return $xeTable.$nextTick();
- },
- // 处理菜单的移动
- moveCtxMenu(evnt, ctxMenuStore, property, hasOper, operRest, menuList) {
- const $xeTable = this;
- let selectItem;
- const selectIndex = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findIndexOf(menuList, item => ctxMenuStore[property] === item);
- if (hasOper) {
- if (operRest && hasChildrenList(ctxMenuStore.selected)) {
- ctxMenuStore.showChild = true;
- } else {
- ctxMenuStore.showChild = false;
- ctxMenuStore.selectChild = null;
- }
- } else if (mixin_globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ARROW_UP)) {
- for (let len = selectIndex - 1; len >= 0; len--) {
- if (menuList[len].visible !== false) {
- selectItem = menuList[len];
- break;
- }
- }
- ctxMenuStore[property] = selectItem || menuList[menuList.length - 1];
- } else if (mixin_globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ARROW_DOWN)) {
- for (let index = selectIndex + 1; index < menuList.length; index++) {
- if (menuList[index].visible !== false) {
- selectItem = menuList[index];
- break;
- }
- }
- ctxMenuStore[property] = selectItem || menuList[0];
- } else if (ctxMenuStore[property] && (mixin_globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ENTER) || mixin_globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.SPACEBAR))) {
- $xeTable.ctxMenuLinkEvent(evnt, ctxMenuStore[property]);
- }
- },
- /**
- * 快捷菜单事件处理
- */
- handleGlobalContextmenuEvent(evnt) {
- const $xeTable = this;
- const $xeGrid = $xeTable.$xeGrid;
- const $xeGantt = $xeTable.$xeGantt;
- const props = $xeTable;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- xID
- } = $xeTable;
- const {
- mouseConfig,
- menuConfig
- } = props;
- const {
- editStore,
- ctxMenuStore
- } = reactData;
- const {
- visibleColumn
- } = internalData;
- const tableFilter = $xeTable.$refs.refTableFilter;
- const tableMenu = $xeTable.$refs.refTableMenu;
- const mouseOpts = $xeTable.computeMouseOpts;
- const menuOpts = $xeTable.computeMenuOpts;
- const el = $xeTable.$refs.refElem;
- const {
- selected
- } = editStore;
- const layoutList = ['header', 'body', 'footer'];
- if (isEnableConf(menuConfig)) {
- if (ctxMenuStore.visible && tableMenu && getEventTargetNode(evnt, tableMenu.$el).flag) {
- evnt.preventDefault();
- return;
- }
- if (internalData._keyCtx) {
- const type = 'body';
- const params = {
- source: 'table',
- type,
- $table: $xeTable,
- $grid: $xeGrid,
- $gantt: $xeGantt,
- keyboard: true,
- columns: visibleColumn.slice(0),
- $event: evnt
- };
- // 如果开启单元格区域
- if (mouseConfig && mouseOpts.area) {
- const activeArea = $xeTable.getActiveCellArea();
- if (activeArea && activeArea.row && activeArea.column) {
- params.row = activeArea.row;
- params.column = activeArea.column;
- $xeTable.handleOpenMenuEvent(evnt, type, params);
- return;
- }
- } else if (mouseConfig && mouseOpts.selected) {
- // 如果启用键盘导航且已选中单元格
- if (selected.row && selected.column) {
- params.row = selected.row;
- params.column = selected.column;
- $xeTable.handleOpenMenuEvent(evnt, type, params);
- return;
- }
- }
- }
- // 分别匹配表尾、内容、表尾的快捷菜单
- for (let index = 0; index < layoutList.length; index++) {
- const layout = layoutList[index];
- const columnTargetNode = getEventTargetNode(evnt, el, `vxe-${layout}--column`, target => {
- // target=td|th,直接向上找 table 去匹配即可
- return target.parentNode.parentNode.parentNode.getAttribute('xid') === xID;
- });
- const params = {
- source: 'table',
- type: layout,
- $table: $xeTable,
- $grid: $xeGrid,
- $gantt: $xeGantt,
- columns: visibleColumn.slice(0),
- $event: evnt
- };
- if (columnTargetNode.flag) {
- const cell = columnTargetNode.targetElem;
- const columnNodeRest = $xeTable.getColumnNode(cell);
- const column = columnNodeRest ? columnNodeRest.item : null;
- let typePrefix = `${layout}-`;
- if (column) {
- Object.assign(params, {
- column,
- columnIndex: $xeTable.getColumnIndex(column),
- cell
- });
- }
- if (layout === 'body') {
- const rowNodeRest = $xeTable.getRowNode(cell.parentNode);
- const row = rowNodeRest ? rowNodeRest.item : null;
- typePrefix = '';
- if (row) {
- params.row = row;
- params.rowIndex = $xeTable.getRowIndex(row);
- }
- }
- const eventType = `${typePrefix}cell-menu`;
- $xeTable.handleOpenMenuEvent(evnt, layout, params);
- // 在 v4 中废弃事件 cell-context-menu、header-cell-context-menu、footer-cell-context-menu
- if ($xeTable.$listeners[`${typePrefix}cell-context-menu`]) {
- warnLog('vxe.error.delEvent', [`${typePrefix}cell-context-menu`, `${typePrefix}cell-menu`]);
- $xeTable.dispatchEvent(`${typePrefix}cell-context-menu`, params, evnt);
- } else {
- $xeTable.dispatchEvent(eventType, params, evnt);
- }
- return;
- } else if (getEventTargetNode(evnt, $xeTable.$el, `vxe-table--${layout}-wrapper`, target => target.getAttribute('xid') === xID).flag) {
- if (menuOpts.trigger === 'cell') {
- evnt.preventDefault();
- } else {
- $xeTable.handleOpenMenuEvent(evnt, layout, params);
- }
- return;
- }
- }
- }
- if (tableFilter && !getEventTargetNode(evnt, tableFilter.$el).flag) {
- $xeTable.closeFilter();
- }
- $xeTable.closeMenu();
- },
- /**
- * 显示快捷菜单
- */
- handleOpenMenuEvent(evnt, type, params) {
- const $xeTable = this;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- ctxMenuStore
- } = reactData;
- const isContentMenu = $xeTable.computeIsContentMenu;
- const menuOpts = $xeTable.computeMenuOpts;
- const config = menuOpts[type];
- const {
- transfer,
- visibleMethod
- } = menuOpts;
- if (config) {
- const {
- options,
- disabled
- } = config;
- if (disabled) {
- evnt.preventDefault();
- } else if (isContentMenu && options && options.length) {
- params.options = options;
- $xeTable.preventEvent(evnt, 'event.showMenu', params, () => {
- if (!visibleMethod || visibleMethod(params)) {
- evnt.preventDefault();
- $xeTable.updateZindex();
- const el = $xeTable.$refs.refElem;
- const tableRect = el.getBoundingClientRect();
- const {
- scrollTop,
- scrollLeft,
- visibleHeight,
- visibleWidth
- } = getDomNode();
- let top = evnt.clientY - tableRect.y;
- let left = evnt.clientX - tableRect.x;
- if (transfer) {
- top = evnt.clientY + scrollTop;
- left = evnt.clientX + scrollLeft;
- }
- const handleVisible = () => {
- internalData._currMenuParams = params;
- Object.assign(ctxMenuStore, {
- visible: true,
- list: options,
- selected: null,
- selectChild: null,
- showChild: false,
- style: {
- zIndex: internalData.tZindex,
- top: `${top}px`,
- left: `${left}px`
- }
- });
- $xeTable.$nextTick(() => {
- const tableMenu = $xeTable.$refs.refTableMenu;
- const ctxElem = tableMenu.$el;
- const clientHeight = ctxElem.clientHeight;
- const clientWidth = ctxElem.clientWidth;
- const {
- boundingTop,
- boundingLeft
- } = getAbsolutePos(ctxElem);
- const offsetTop = boundingTop + clientHeight - visibleHeight;
- const offsetLeft = boundingLeft + clientWidth - visibleWidth;
- if (offsetTop > -10) {
- ctxMenuStore.style.top = `${Math.max(scrollTop + 2, top - clientHeight - 2)}px`;
- }
- if (offsetLeft > -10) {
- ctxMenuStore.style.left = `${Math.max(scrollLeft + 2, left - clientWidth - 2)}px`;
- }
- });
- };
- const {
- keyboard,
- row,
- column
- } = params;
- if (keyboard && row && column) {
- $xeTable.scrollToRow(row, column).then(() => {
- const cell = $xeTable.getCellElement(row, column);
- if (cell) {
- const {
- boundingTop,
- boundingLeft
- } = getAbsolutePos(cell);
- top = boundingTop + scrollTop + Math.floor(cell.offsetHeight / 2);
- left = boundingLeft + scrollLeft + Math.floor(cell.offsetWidth / 2);
- }
- handleVisible();
- });
- } else {
- handleVisible();
- }
- } else {
- $xeTable.closeMenu();
- }
- });
- }
- }
- $xeTable.closeFilter();
- },
- ctxMenuMouseoverEvent(evnt, item, child) {
- const $xeTable = this;
- const reactData = $xeTable;
- const menuElem = evnt.currentTarget;
- const {
- ctxMenuStore
- } = reactData;
- evnt.preventDefault();
- evnt.stopPropagation();
- ctxMenuStore.selected = item;
- ctxMenuStore.selectChild = child;
- if (!child) {
- ctxMenuStore.showChild = hasChildrenList(item);
- if (ctxMenuStore.showChild) {
- $xeTable.$nextTick(() => {
- const childWrapperElem = menuElem.nextElementSibling;
- if (childWrapperElem) {
- const {
- boundingTop,
- boundingLeft,
- visibleHeight,
- visibleWidth
- } = getAbsolutePos(menuElem);
- const posTop = boundingTop + menuElem.offsetHeight;
- const posLeft = boundingLeft + menuElem.offsetWidth;
- let left = '';
- let right = '';
- // 是否超出右侧
- if (posLeft + childWrapperElem.offsetWidth > visibleWidth - 10) {
- left = 'auto';
- right = `${menuElem.offsetWidth}px`;
- }
- // 是否超出底部
- let top = '';
- let bottom = '';
- if (posTop + childWrapperElem.offsetHeight > visibleHeight - 10) {
- top = 'auto';
- bottom = '0';
- }
- childWrapperElem.style.left = left;
- childWrapperElem.style.right = right;
- childWrapperElem.style.top = top;
- childWrapperElem.style.bottom = bottom;
- }
- });
- }
- }
- },
- ctxMenuMouseoutEvent(evnt, item) {
- const $xeTable = this;
- const reactData = $xeTable;
- const {
- ctxMenuStore
- } = reactData;
- if (!item.children) {
- ctxMenuStore.selected = null;
- }
- ctxMenuStore.selectChild = null;
- },
- /**
- * 快捷菜单点击事件
- */
- ctxMenuLinkEvent(evnt, menu) {
- const $xeTable = this;
- const $xeGrid = $xeTable.$xeGrid;
- const $xeGantt = $xeTable.$xeGantt;
- const internalData = $xeTable;
- // 如果一级菜单有配置 code 则允许点击,否则不能点击
- if (!menu.disabled && (menu.code || !menu.children || !menu.children.length)) {
- const gMenuOpts = mixin_menus.get(menu.code);
- const params = Object.assign({}, internalData._currMenuParams, {
- menu,
- $table: $xeTable,
- $grid: $xeGrid,
- $gantt: $xeGantt,
- $event: evnt
- });
- if (gMenuOpts && gMenuOpts.menuMethod) {
- gMenuOpts.menuMethod(params, evnt);
- }
- // 在 v4 中废弃事件 context-menu-click
- if ($xeTable.$listeners['context-menu-click']) {
- warnLog('vxe.error.delEvent', ['context-menu-click', 'menu-click']);
- $xeTable.dispatchEvent('context-menu-click', params, evnt);
- } else {
- $xeTable.dispatchEvent('menu-click', params, evnt);
- }
- $xeTable.closeMenu();
- }
- }
- }
- });
- ;// CONCATENATED MODULE: ./packages/table/module/edit/mixin.ts
- const {
- getConfig: mixin_getConfig,
- renderer: edit_mixin_renderer,
- getI18n: mixin_getI18n
- } = core_.VxeUI;
- const mixin_browseObj = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().browse();
- function getEditColumnModel(row, column) {
- const {
- model,
- editRender
- } = column;
- if (editRender) {
- model.value = getCellValue(row, column);
- model.update = false;
- }
- }
- function setEditColumnModel(row, column) {
- const {
- model,
- editRender
- } = column;
- if (editRender && model.update) {
- setCellValue(row, column, model.value);
- model.update = false;
- model.value = null;
- }
- }
- function removeCellSelectedClass($xeTable) {
- const el = $xeTable.$refs.refElem;
- if (el) {
- const cell = el.querySelector('.col--selected');
- if (cell) {
- removeClass(cell, 'col--selected');
- }
- }
- }
- function syncActivedCell($xeTable) {
- const reactData = $xeTable;
- const {
- editStore,
- tableColumn
- } = reactData;
- const editOpts = $xeTable.computeEditOpts;
- const {
- actived
- } = editStore;
- const {
- row,
- column
- } = actived;
- if (row || column) {
- if (editOpts.mode === 'row') {
- tableColumn.forEach(column => setEditColumnModel(row, column));
- } else {
- setEditColumnModel(row, column);
- }
- }
- }
- function insertTreeRow($xeTable, newRecords, isAppend) {
- const internalData = $xeTable;
- const {
- tableFullTreeData,
- afterFullData,
- fullDataRowIdData,
- fullAllDataRowIdData
- } = internalData;
- const treeOpts = $xeTable.computeTreeOpts;
- const {
- rowField,
- parentField,
- mapChildrenField
- } = treeOpts;
- const childrenField = treeOpts.children || treeOpts.childrenField;
- const funcName = isAppend ? 'push' : 'unshift';
- newRecords.forEach(item => {
- const parentRowId = item[parentField];
- const rowid = getRowid($xeTable, item);
- const matchObj = parentRowId ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findTree(tableFullTreeData, item => parentRowId === item[rowField], {
- children: mapChildrenField
- }) : null;
- if (matchObj) {
- const {
- item: parentRow
- } = matchObj;
- const parentRest = fullAllDataRowIdData[getRowid($xeTable, parentRow)];
- const parentLevel = parentRest ? parentRest.level : 0;
- let parentChilds = parentRow[childrenField];
- let mapChilds = parentRow[mapChildrenField];
- if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(parentChilds)) {
- parentChilds = parentRow[childrenField] = [];
- }
- if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(mapChilds)) {
- mapChilds = parentRow[childrenField] = [];
- }
- parentChilds[funcName](item);
- mapChilds[funcName](item);
- const rest = {
- row: item,
- rowid,
- seq: -1,
- index: -1,
- _index: -1,
- $index: -1,
- treeIndex: -1,
- _tIndex: -1,
- items: parentChilds,
- parent: parentRow,
- level: parentLevel + 1,
- height: 0,
- resizeHeight: 0,
- oTop: 0,
- expandHeight: 0
- };
- fullDataRowIdData[rowid] = rest;
- fullAllDataRowIdData[rowid] = rest;
- } else {
- if (parentRowId) {
- warnLog('vxe.error.unableInsert');
- }
- afterFullData[funcName](item);
- tableFullTreeData[funcName](item);
- const rest = {
- row: item,
- rowid,
- seq: -1,
- index: -1,
- _index: -1,
- $index: -1,
- treeIndex: -1,
- _tIndex: -1,
- items: tableFullTreeData,
- parent: null,
- level: 0,
- height: 0,
- resizeHeight: 0,
- oTop: 0,
- expandHeight: 0
- };
- fullDataRowIdData[rowid] = rest;
- fullAllDataRowIdData[rowid] = rest;
- }
- });
- }
- // function insertGroupRow ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, newRecords: any[], isAppend: boolean) {
- // }
- function handleInsertRowAt($xeTable, records, targetRow, isInsertNextRow) {
- const props = $xeTable;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- treeConfig
- } = props;
- const {
- isRowGroupStatus
- } = reactData;
- const {
- tableFullTreeData,
- afterFullData,
- mergeBodyList,
- tableFullData,
- fullDataRowIdData,
- fullAllDataRowIdData,
- insertRowMaps,
- removeRowMaps
- } = internalData;
- const treeOpts = $xeTable.computeTreeOpts;
- const {
- transform,
- parentField,
- rowField,
- mapChildrenField
- } = treeOpts;
- const childrenField = treeOpts.children || treeOpts.childrenField;
- if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(records)) {
- records = [records];
- }
- const newRecords = $xeTable.defineField(records.map(record => Object.assign(treeConfig && transform ? {
- [mapChildrenField]: [],
- [childrenField]: []
- } : {}, record)));
- let treeRecords = [];
- if (treeConfig && transform) {
- treeRecords = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toArrayTree(newRecords, {
- key: rowField,
- parentKey: parentField,
- children: childrenField
- });
- }
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(targetRow)) {
- // 如果为虚拟树
- if (treeConfig && transform) {
- insertTreeRow($xeTable, newRecords, false);
- } else if (isRowGroupStatus) {
- // 如果分组
- if (treeConfig) {
- throw new Error(mixin_getI18n('vxe.error.noTree', ['insert']));
- }
- warnLog(mixin_getI18n('vxe.error.noGroup', ['remove']));
- // insertGroupRow($xeTable, newRecords, false)
- } else {
- newRecords.forEach(item => {
- const rowid = getRowid($xeTable, item);
- const rest = {
- row: item,
- rowid,
- seq: -1,
- index: -1,
- _index: -1,
- $index: -1,
- treeIndex: -1,
- _tIndex: -1,
- items: afterFullData,
- parent: null,
- level: 0,
- height: 0,
- resizeHeight: 0,
- oTop: 0,
- expandHeight: 0
- };
- fullDataRowIdData[rowid] = rest;
- fullAllDataRowIdData[rowid] = rest;
- afterFullData.unshift(item);
- tableFullData.unshift(item);
- });
- // 刷新单元格合并
- mergeBodyList.forEach(mergeItem => {
- const {
- row: mergeRowIndex
- } = mergeItem;
- if (mergeRowIndex >= 0) {
- mergeItem.row = mergeRowIndex + newRecords.length;
- }
- });
- }
- } else {
- if (targetRow === -1) {
- // 如果为虚拟树
- if (treeConfig && transform) {
- insertTreeRow($xeTable, newRecords, true);
- } else if (isRowGroupStatus) {
- // 如果分组
- if (treeConfig) {
- throw new Error(mixin_getI18n('vxe.error.noTree', ['insert']));
- }
- warnLog(mixin_getI18n('vxe.error.noGroup', ['remove']));
- // insertGroupRow($xeTable, newRecords, true)
- } else {
- newRecords.forEach(item => {
- const rowid = getRowid($xeTable, item);
- const rest = {
- row: item,
- rowid,
- seq: -1,
- index: -1,
- _index: -1,
- $index: -1,
- treeIndex: -1,
- _tIndex: -1,
- items: afterFullData,
- parent: null,
- level: 0,
- height: 0,
- resizeHeight: 0,
- oTop: 0,
- expandHeight: 0
- };
- fullDataRowIdData[rowid] = rest;
- fullAllDataRowIdData[rowid] = rest;
- afterFullData.push(item);
- tableFullData.push(item);
- });
- }
- } else {
- // 如果为虚拟树
- if (treeConfig && transform) {
- const matchMapObj = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findTree(tableFullTreeData, item => targetRow[rowField] === item[rowField], {
- children: mapChildrenField
- });
- if (matchMapObj) {
- const {
- parent: parentRow
- } = matchMapObj;
- const parentMapChilds = parentRow ? parentRow[mapChildrenField] : tableFullTreeData;
- const parentRest = fullAllDataRowIdData[getRowid($xeTable, parentRow)];
- const parentLevel = parentRest ? parentRest.level : 0;
- treeRecords.forEach((row, i) => {
- if (parentRow) {
- if (row[parentField] !== parentRow[rowField]) {
- row[parentField] = parentRow[rowField];
- errLog('vxe.error.errProp', [`${parentField}=${row[parentField]}`, `${parentField}=${parentRow[rowField]}`]);
- }
- } else {
- if (row[parentField] !== null) {
- row[parentField] = null;
- errLog('vxe.error.errProp', [`${parentField}=${row[parentField]}`, 'null']);
- }
- }
- let targetIndex = matchMapObj.index + i;
- if (isInsertNextRow) {
- targetIndex = targetIndex + 1;
- }
- parentMapChilds.splice(targetIndex, 0, row);
- });
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(treeRecords, item => {
- const rowid = getRowid($xeTable, item);
- const rest = {
- row: item,
- rowid,
- seq: -1,
- index: -1,
- _index: -1,
- $index: -1,
- treeIndex: -1,
- _tIndex: -1,
- items: parentMapChilds,
- parent: parentRow,
- level: parentLevel + 1,
- height: 0,
- resizeHeight: 0,
- oTop: 0,
- expandHeight: 0
- };
- if (item[childrenField]) {
- item[mapChildrenField] = item[childrenField];
- }
- fullDataRowIdData[rowid] = rest;
- fullAllDataRowIdData[rowid] = rest;
- }, {
- children: childrenField
- });
- // 源
- if (parentRow) {
- const matchObj = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findTree(tableFullTreeData, item => targetRow[rowField] === item[rowField], {
- children: childrenField
- });
- if (matchObj) {
- const parentChilds = matchObj.items;
- let targetIndex = matchObj.index;
- if (isInsertNextRow) {
- targetIndex = targetIndex + 1;
- }
- parentChilds.splice(targetIndex, 0, ...treeRecords);
- }
- }
- } else {
- warnLog('vxe.error.unableInsert');
- insertTreeRow($xeTable, newRecords, true);
- }
- } else if (isRowGroupStatus) {
- // 如果分组
- if (treeConfig) {
- throw new Error(mixin_getI18n('vxe.error.noTree', ['insert']));
- }
- warnLog(mixin_getI18n('vxe.error.noGroup', ['remove']));
- } else {
- if (treeConfig) {
- throw new Error(mixin_getI18n('vxe.error.noTree', ['insert']));
- }
- let afIndex = -1;
- // 如果是可视索引
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(targetRow)) {
- if (targetRow < afterFullData.length) {
- afIndex = targetRow;
- }
- } else {
- afIndex = $xeTable.findRowIndexOf(afterFullData, targetRow);
- }
- // 如果是插入指定行的下一行
- if (isInsertNextRow) {
- afIndex = Math.min(afterFullData.length, afIndex + 1);
- }
- if (afIndex === -1) {
- throw new Error(mixin_getI18n('vxe.error.unableInsert'));
- }
- afterFullData.splice(afIndex, 0, ...newRecords);
- const tfIndex = $xeTable.findRowIndexOf(tableFullData, targetRow);
- if (tfIndex > -1) {
- tableFullData.splice(tfIndex + (isInsertNextRow ? 1 : 0), 0, ...newRecords);
- } else {
- tableFullData.push(...newRecords);
- }
- // 刷新单元格合并
- mergeBodyList.forEach(mergeItem => {
- const {
- row: mergeRowIndex,
- rowspan: mergeRowspan
- } = mergeItem;
- if (mergeRowIndex >= afIndex) {
- mergeItem.row = mergeRowIndex + newRecords.length;
- } else if (isInsertNextRow ? mergeRowIndex + mergeRowspan >= afIndex : mergeRowIndex + mergeRowspan > afIndex) {
- mergeItem.rowspan = mergeRowspan + newRecords.length;
- }
- });
- }
- }
- }
- const handleStatus = newRow => {
- const rowid = getRowid($xeTable, newRow);
- // 如果是被删除的数据,则还原状态
- if (removeRowMaps[rowid]) {
- delete removeRowMaps[rowid];
- if (insertRowMaps[rowid]) {
- delete insertRowMaps[rowid];
- }
- } else {
- insertRowMaps[rowid] = newRow;
- }
- };
- // 如果为虚拟树
- if (treeConfig && transform) {
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(treeRecords, handleStatus, {
- children: mapChildrenField
- });
- } else {
- newRecords.forEach(handleStatus);
- }
- reactData.removeRowFlag++;
- reactData.insertRowFlag++;
- $xeTable.cacheRowMap(false);
- $xeTable.updateScrollYStatus();
- $xeTable.handleTableData(treeConfig && transform);
- if (!(treeConfig && transform)) {
- $xeTable.updateAfterDataIndex();
- }
- $xeTable.updateFooter();
- $xeTable.handleUpdateBodyMerge();
- $xeTable.checkSelectionStatus();
- if (reactData.scrollYLoad) {
- $xeTable.updateScrollYSpace();
- }
- return $xeTable.$nextTick().then(() => {
- $xeTable.updateCellAreas();
- return $xeTable.recalculate(true);
- }).then(() => {
- return {
- row: newRecords.length ? newRecords[newRecords.length - 1] : null,
- rows: newRecords
- };
- });
- }
- function handleInsertChildRowAt($xeTable, records, parentRow, targetRow, isInsertNextRow) {
- const props = $xeTable;
- const {
- treeConfig
- } = props;
- const treeOpts = $xeTable.computeTreeOpts;
- const {
- transform,
- rowField,
- parentField
- } = treeOpts;
- if (treeConfig && transform) {
- if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(records)) {
- records = [records];
- }
- return handleInsertRowAt($xeTable, records.map(item => Object.assign({}, item, {
- [parentField]: parentRow[rowField]
- })), targetRow, isInsertNextRow);
- } else {
- errLog('vxe.error.errProp', ['tree-config.transform=false', 'tree-config.transform=true']);
- }
- return Promise.resolve({
- row: null,
- rows: []
- });
- }
- function handleClearEdit($xeTable, evnt, targetRow) {
- const reactData = $xeTable;
- const {
- editStore
- } = reactData;
- const {
- actived,
- focused
- } = editStore;
- const {
- row,
- column
- } = actived;
- const validOpts = $xeTable.computeValidOpts;
- if (row || column) {
- if (targetRow && getRowid($xeTable, targetRow) !== getRowid($xeTable, row)) {
- return $xeTable.$nextTick();
- }
- syncActivedCell($xeTable);
- actived.args = null;
- actived.row = null;
- actived.column = null;
- $xeTable.updateFooter();
- $xeTable.dispatchEvent('edit-closed', {
- row,
- rowIndex: $xeTable.getRowIndex(row),
- $rowIndex: $xeTable.getVMRowIndex(row),
- column,
- columnIndex: $xeTable.getColumnIndex(column),
- $columnIndex: $xeTable.getVMColumnIndex(column)
- }, evnt || null);
- }
- focused.row = null;
- focused.column = null;
- if (validOpts.autoClear) {
- if (validOpts.msgMode !== 'full' || mixin_getConfig().cellVaildMode === 'obsolete') {
- if ($xeTable.clearValidate) {
- return $xeTable.clearValidate();
- }
- }
- }
- return $xeTable.$nextTick().then(() => $xeTable.updateCellAreas());
- }
- function handleEditActive($xeTable, params, evnt, isFocus, isPos) {
- const props = $xeTable;
- const reactData = $xeTable;
- const $xeGrid = $xeTable.$xeGrid;
- const {
- editConfig,
- mouseConfig
- } = props;
- const {
- editStore,
- tableColumn
- } = reactData;
- const editOpts = $xeTable.computeEditOpts;
- const {
- mode
- } = editOpts;
- const {
- actived,
- focused
- } = editStore;
- const {
- row,
- column
- } = params;
- const {
- editRender
- } = column;
- const cell = params.cell || $xeTable.getCellElement(row, column);
- const beforeEditMethod = editOpts.beforeEditMethod || editOpts.activeMethod;
- params.cell = cell;
- if (cell && isEnableConf(editConfig) && isEnableConf(editRender)) {
- // 激活编辑
- if (!$xeTable.isPendingByRow(row) && !$xeTable.isAggregateRecord(row)) {
- if (actived.row !== row || (mode === 'cell' ? actived.column !== column : false)) {
- // 判断是否禁用编辑
- let type = 'edit-disabled';
- if (!beforeEditMethod || beforeEditMethod({
- ...params,
- $table: $xeTable,
- $grid: $xeGrid
- })) {
- if (mouseConfig) {
- $xeTable.clearSelected();
- if ($xeTable.clearCellAreas) {
- $xeTable.clearCellAreas();
- $xeTable.clearCopyCellArea();
- }
- }
- $xeTable.closeTooltip();
- if (actived.column) {
- handleClearEdit($xeTable, evnt);
- }
- type = 'edit-activated';
- column.renderHeight = cell.offsetHeight;
- actived.args = params;
- actived.row = row;
- actived.column = column;
- if (mode === 'row') {
- tableColumn.forEach(column => getEditColumnModel(row, column));
- } else {
- getEditColumnModel(row, column);
- }
- const afterEditMethod = editOpts.afterEditMethod;
- $xeTable.$nextTick(() => {
- if (isFocus) {
- $xeTable.handleFocus(params, evnt);
- }
- if (afterEditMethod) {
- afterEditMethod({
- ...params,
- $table: $xeTable,
- $grid: $xeGrid
- });
- }
- });
- }
- $xeTable.dispatchEvent(type, {
- row,
- rowIndex: $xeTable.getRowIndex(row),
- $rowIndex: $xeTable.getVMRowIndex(row),
- column,
- columnIndex: $xeTable.getColumnIndex(column),
- $columnIndex: $xeTable.getVMColumnIndex(column)
- }, evnt);
- // v4已废弃
- if (type === 'edit-activated') {
- $xeTable.dispatchEvent('edit-actived', {
- row,
- rowIndex: $xeTable.getRowIndex(row),
- $rowIndex: $xeTable.getVMRowIndex(row),
- column,
- columnIndex: $xeTable.getColumnIndex(column),
- $columnIndex: $xeTable.getVMColumnIndex(column)
- }, evnt);
- }
- } else {
- const {
- column: oldColumn
- } = actived;
- if (mouseConfig) {
- $xeTable.clearSelected();
- if ($xeTable.clearCellAreas) {
- $xeTable.clearCellAreas();
- $xeTable.clearCopyCellArea();
- }
- }
- if (oldColumn !== column) {
- const {
- model: oldModel
- } = oldColumn;
- if (oldModel.update) {
- setCellValue(row, oldColumn, oldModel.value);
- }
- if ($xeTable.clearValidate) {
- $xeTable.clearValidate(row, column);
- }
- }
- column.renderHeight = cell.offsetHeight;
- actived.args = params;
- actived.column = column;
- if (isPos) {
- setTimeout(() => {
- $xeTable.handleFocus(params, evnt);
- });
- }
- }
- focused.column = null;
- focused.row = null;
- $xeTable.focus();
- }
- }
- return $xeTable.$nextTick();
- }
- function handleEditCell($xeTable, row, fieldOrColumn, isPos) {
- const props = $xeTable;
- const internalData = $xeTable;
- const {
- editConfig
- } = props;
- const column = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(fieldOrColumn) ? $xeTable.getColumnByField(fieldOrColumn) : fieldOrColumn;
- if (row && column && isEnableConf(editConfig) && isEnableConf(column.editRender) && !$xeTable.isAggregateRecord(row)) {
- return Promise.resolve(isPos ? $xeTable.scrollToRow(row, column) : null).then(() => {
- const cell = $xeTable.getCellElement(row, column);
- if (cell) {
- handleEditActive($xeTable, {
- row,
- rowIndex: $xeTable.getRowIndex(row),
- column,
- columnIndex: $xeTable.getColumnIndex(column),
- cell,
- $table: $xeTable
- }, null, isPos, isPos);
- internalData._lastCallTime = Date.now();
- }
- return $xeTable.$nextTick();
- });
- }
- return $xeTable.$nextTick();
- }
- /* harmony default export */ var edit_mixin = ({
- methods: {
- /**
- * 往表格中插入临时数据
- *
- * @param {*} records
- */
- _insert(records) {
- return handleInsertRowAt(this, records, null);
- },
- /**
- * 往表格指定行中插入临时数据
- * 如果 row 为空则从插入到顶部
- * 如果 row 为 -1 则从插入到底部
- * 如果 row 为有效行则插入到该行的位置
- * @param {Object/Array} records 新的数据
- * @param {Row} targetRow 指定行
- * @returns
- */
- _insertAt(records, targetRow) {
- return handleInsertRowAt(this, records, targetRow);
- },
- _insertNextAt(records, targetRow) {
- return handleInsertRowAt(this, records, targetRow, true);
- },
- _insertChild(records, parentRow) {
- return handleInsertChildRowAt(this, records, parentRow, null);
- },
- _insertChildAt(records, parentRow, targetRow) {
- return handleInsertChildRowAt(this, records, parentRow, targetRow);
- },
- _insertChildNextAt(records, parentRow, targetRow) {
- return handleInsertChildRowAt(this, records, parentRow, targetRow, true);
- },
- /**
- * 删除指定行数据
- * 如果传 row 则删除一行
- * 如果传 rows 则删除多行
- * 如果为空则删除所有
- */
- _remove(rows) {
- const $xeTable = this;
- const props = $xeTable;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- treeConfig
- } = props;
- const {
- editStore,
- isRowGroupStatus
- } = reactData;
- const {
- tableFullTreeData,
- selectCheckboxMaps,
- afterFullData,
- mergeBodyList,
- tableFullData,
- pendingRowMaps,
- insertRowMaps,
- removeRowMaps
- } = internalData;
- const checkboxOpts = $xeTable.computeCheckboxOpts;
- const treeOpts = $xeTable.computeTreeOpts;
- const {
- transform,
- mapChildrenField
- } = treeOpts;
- const childrenField = treeOpts.children || treeOpts.childrenField;
- const {
- actived
- } = editStore;
- const {
- checkField
- } = checkboxOpts;
- let delList = [];
- if (!rows) {
- rows = tableFullData;
- } else if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(rows)) {
- rows = [rows];
- }
- // 如果是新增,则保存记录
- rows.forEach(row => {
- if (!$xeTable.isInsertByRow(row)) {
- const rowid = getRowid($xeTable, row);
- removeRowMaps[rowid] = row;
- }
- });
- // 如果绑定了多选属性,则更新状态
- if (!checkField) {
- rows.forEach(row => {
- const rowid = getRowid(this, row);
- if (selectCheckboxMaps[rowid]) {
- delete selectCheckboxMaps[rowid];
- }
- });
- reactData.updateCheckboxFlag++;
- }
- // 从数据源中移除
- if (tableFullData === rows) {
- rows = delList = tableFullData.slice(0);
- this.tableFullData = [];
- this.afterFullData = [];
- this.clearMergeCells();
- } else {
- // 如果为虚拟树
- if (treeConfig && transform) {
- rows.forEach(row => {
- const rowid = getRowid(this, row);
- const matchMapObj = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findTree(tableFullTreeData, item => rowid === getRowid(this, item), {
- children: mapChildrenField
- });
- if (matchMapObj) {
- const rItems = matchMapObj.items.splice(matchMapObj.index, 1);
- delList.push(rItems[0]);
- }
- const matchObj = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findTree(tableFullTreeData, item => rowid === getRowid(this, item), {
- children: childrenField
- });
- if (matchObj) {
- matchObj.items.splice(matchObj.index, 1);
- }
- const afIndex = this.findRowIndexOf(afterFullData, row);
- if (afIndex > -1) {
- afterFullData.splice(afIndex, 1);
- }
- });
- } else if (isRowGroupStatus) {
- // 如果分组
- warnLog(mixin_getI18n('vxe.error.noGroup', ['remove']));
- } else {
- rows.forEach(row => {
- const tfIndex = this.findRowIndexOf(tableFullData, row);
- if (tfIndex > -1) {
- const rItems = tableFullData.splice(tfIndex, 1);
- delList.push(rItems[0]);
- }
- const afIndex = this.findRowIndexOf(afterFullData, row);
- if (afIndex > -1) {
- // 刷新单元格合并
- mergeBodyList.forEach(mergeItem => {
- const {
- row: mergeRowIndex,
- rowspan: mergeRowspan
- } = mergeItem;
- if (mergeRowIndex > afIndex) {
- mergeItem.row = mergeRowIndex - 1;
- } else if (mergeRowIndex + mergeRowspan > afIndex) {
- mergeItem.rowspan = mergeRowspan - 1;
- }
- });
- afterFullData.splice(afIndex, 1);
- }
- });
- }
- }
- // 如果当前行被激活编辑,则清除激活状态
- if (actived.row && $xeTable.findRowIndexOf(rows, actived.row) > -1) {
- $xeTable.clearEdit();
- }
- // 从新增中移除已删除的数据
- rows.forEach(row => {
- const rowid = getRowid($xeTable, row);
- if (insertRowMaps[rowid]) {
- delete insertRowMaps[rowid];
- }
- if (pendingRowMaps[rowid]) {
- delete pendingRowMaps[rowid];
- }
- });
- reactData.removeRowFlag++;
- reactData.insertRowFlag++;
- reactData.pendingRowFlag++;
- $xeTable.cacheRowMap(false);
- $xeTable.handleTableData(treeConfig && transform);
- $xeTable.updateFooter();
- $xeTable.handleUpdateBodyMerge();
- if (!(treeConfig && transform)) {
- $xeTable.updateAfterDataIndex();
- }
- $xeTable.checkSelectionStatus();
- if (reactData.scrollYLoad) {
- $xeTable.updateScrollYSpace();
- }
- return this.$nextTick().then(() => {
- this.updateCellAreas();
- return this.recalculate(true);
- }).then(() => {
- return {
- row: delList.length ? delList[delList.length - 1] : null,
- rows: delList
- };
- });
- },
- /**
- * 删除复选框选中的数据
- */
- _removeCheckboxRow() {
- return this.remove(this.getCheckboxRecords()).then(params => {
- this.clearCheckboxRow();
- return params;
- });
- },
- /**
- * 删除单选框选中的数据
- */
- _removeRadioRow() {
- const radioRecord = this.getRadioRecord();
- return this.remove(radioRecord || []).then(params => {
- this.clearRadioRow();
- return params;
- });
- },
- /**
- * 删除当前行选中的数据
- */
- _removeCurrentRow() {
- const currentRecord = this.getCurrentRecord();
- return this.remove(currentRecord || []).then(params => {
- this.clearCurrentRow();
- return params;
- });
- },
- /**
- * 获取表格数据集,包含新增、删除、修改
- */
- _getRecordset() {
- const removeRecords = this.getRemoveRecords();
- const pendingRecords = this.getPendingRecords();
- const delRecords = removeRecords.concat(pendingRecords);
- // 如果已经被删除,则无需放到更新数组
- const updateRecords = this.getUpdateRecords().filter(row => {
- return !delRecords.some(item => this.eqRow(item, row));
- });
- return {
- insertRecords: this.getInsertRecords(),
- removeRecords,
- updateRecords,
- pendingRecords
- };
- },
- /**
- * 获取新增的临时数据
- */
- _getInsertRecords() {
- const $xeTable = this;
- const internalData = $xeTable;
- const {
- fullAllDataRowIdData,
- insertRowMaps
- } = internalData;
- const insertRecords = [];
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(insertRowMaps, (row, rowid) => {
- if (fullAllDataRowIdData[rowid]) {
- insertRecords.push(row);
- }
- });
- return insertRecords;
- },
- /**
- * 获取已删除的数据
- */
- _getRemoveRecords() {
- const $xeTable = this;
- const internalData = $xeTable;
- const {
- removeRowMaps
- } = internalData;
- const removeRecords = [];
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(removeRowMaps, row => {
- removeRecords.push(row);
- });
- return removeRecords;
- },
- /**
- * 获取更新数据
- * 只精准匹配 row 的更改
- * 如果是树表格,子节点更改状态不会影响父节点的更新状态
- */
- _getUpdateRecords() {
- const $xeTable = this;
- const props = $xeTable;
- const internalData = $xeTable;
- const {
- keepSource,
- treeConfig
- } = props;
- const {
- tableFullData
- } = internalData;
- const treeOpts = $xeTable.computeTreeOpts;
- if (keepSource) {
- syncActivedCell($xeTable);
- if (treeConfig) {
- return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().filterTree(tableFullData, row => $xeTable.isUpdateByRow(row), treeOpts);
- }
- return tableFullData.filter(row => $xeTable.isUpdateByRow(row));
- }
- return [];
- },
- /**
- * 处理激活编辑
- */
- handleEdit(params, evnt) {
- const $xeTable = this;
- return handleEditActive($xeTable, params, evnt, true, true);
- },
- /**
- * @deprecated
- */
- handleActived(params, evnt) {
- return this.handleEdit(params, evnt);
- },
- _getColumnModel(row, column) {
- getEditColumnModel(row, column);
- },
- _setColumnModel(row, column) {
- setEditColumnModel(row, column);
- },
- _syncActivedCell() {
- const $xeTable = this;
- syncActivedCell($xeTable);
- },
- _clearActived(row) {
- warnLog('vxe.error.delFunc', ['clearActived', 'clearEdit']);
- // 即将废弃
- return this.clearEdit(row);
- },
- /**
- * 清除激活的编辑
- */
- _clearEdit(row) {
- const $xeTable = this;
- return handleClearEdit($xeTable, null, row);
- },
- /**
- * 取消编辑
- */
- handleClearEdit(evnt, targetRow) {
- const $xeTable = this;
- return handleClearEdit($xeTable, evnt, targetRow);
- },
- _getActiveRecord() {
- const $xeTable = this;
- const reactData = $xeTable;
- const internalData = $xeTable;
- warnLog('vxe.error.delFunc', ['getActiveRecord', 'getEditCell']);
- const {
- editStore
- } = reactData;
- const {
- fullAllDataRowIdData
- } = internalData;
- const {
- args,
- row
- } = editStore.actived;
- if (args && row && fullAllDataRowIdData[getRowid($xeTable, row)]) {
- return Object.assign({}, args, {
- row
- });
- }
- return null;
- },
- _getEditRecord() {
- const $xeTable = this;
- const reactData = $xeTable;
- const internalData = $xeTable;
- warnLog('vxe.error.delFunc', ['getEditRecord', 'getEditCell']);
- const {
- editStore
- } = reactData;
- const {
- fullAllDataRowIdData
- } = internalData;
- const {
- args,
- row
- } = editStore.actived;
- if (args && row && fullAllDataRowIdData[getRowid($xeTable, row)]) {
- return Object.assign({}, args, {
- row
- });
- }
- return null;
- },
- _getEditCell() {
- const $xeTable = this;
- const reactData = $xeTable;
- const {
- editStore
- } = reactData;
- const {
- row,
- column
- } = editStore.actived;
- if (column && row) {
- return {
- row,
- rowIndex: $xeTable.getRowIndex(row),
- column,
- columnIndex: $xeTable.getColumnIndex(column)
- };
- }
- return null;
- },
- _isActiveByRow(row) {
- const $xeTable = this;
- warnLog('vxe.error.delFunc', ['isActiveByRow', 'isEditByRow']);
- // 即将废弃
- return $xeTable.isEditByRow(row);
- },
- /**
- * 判断行是否为激活编辑状态
- * @param {Row} row 行对象
- */
- _isEditByRow(row) {
- const $xeTable = this;
- const reactData = $xeTable;
- const {
- editStore
- } = reactData;
- return editStore.actived.row === row;
- },
- /**
- * 处理聚焦
- */
- handleFocus(params) {
- const $xeTable = this;
- const {
- row,
- column,
- cell
- } = params;
- const {
- editRender
- } = column;
- const editOpts = $xeTable.computeEditOpts;
- if (isEnableConf(editRender)) {
- const compRender = edit_mixin_renderer.get(editRender.name);
- let autoFocus = editRender.autofocus || editRender.autoFocus;
- let autoSelect = editRender.autoSelect || editRender.autoselect;
- let inputElem;
- // 是否启用聚焦
- if (editOpts.autoFocus) {
- if (!autoFocus && compRender) {
- autoFocus = compRender.tableAutoFocus || compRender.tableAutofocus || compRender.autoFocus || compRender.autofocus;
- }
- if (!autoSelect && compRender) {
- autoSelect = compRender.tableAutoSelect || compRender.autoSelect || compRender.autoselect;
- }
- // 如果指定了聚焦 class
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(autoFocus)) {
- inputElem = autoFocus.call($xeTable, params);
- } else if (autoFocus) {
- if (autoFocus === true) {
- // 自动匹配模式,会自动匹配第一个可输入元素
- inputElem = cell.querySelector('input,textarea');
- } else {
- inputElem = cell.querySelector(autoFocus);
- }
- if (inputElem) {
- inputElem.focus();
- }
- }
- }
- if (inputElem) {
- if (autoSelect) {
- inputElem.select();
- } else {
- // 保持一致行为,光标移到末端
- if (mixin_browseObj.msie) {
- const textRange = inputElem.createTextRange();
- textRange.collapse(false);
- textRange.select();
- }
- }
- } else {
- // 是否自动定位
- if (editOpts.autoPos) {
- if (!column.fixed) {
- // 显示到可视区中
- $xeTable.scrollToRow(row, column);
- }
- }
- }
- }
- },
- _setActiveRow(row) {
- const $xeTable = this;
- warnLog('vxe.error.delFunc', ['setActiveRow', 'setEditRow']);
- // 即将废弃
- return $xeTable.setEditRow(row);
- },
- /**
- * 激活行编辑
- */
- _setEditRow(row, fieldOrColumn) {
- const $xeTable = this;
- let column = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().find(this.visibleColumn, column => isEnableConf(column.editRender));
- let isPos = false;
- if (fieldOrColumn) {
- isPos = true;
- if (fieldOrColumn !== true) {
- column = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(fieldOrColumn) ? $xeTable.getColumnByField(fieldOrColumn) : fieldOrColumn;
- }
- }
- return handleEditCell($xeTable, row, column, isPos);
- },
- _setActiveCell(row, fieldOrColumn) {
- warnLog('vxe.error.delFunc', ['setActiveCell', 'setEditCell']);
- // 即将废弃
- return this.setEditCell(row, fieldOrColumn);
- },
- /**
- * 激活单元格编辑
- */
- _setEditCell(row, fieldOrColumn) {
- const $xeTable = this;
- return handleEditCell($xeTable, row, fieldOrColumn, true);
- },
- /**
- * 只对 trigger=dblclick 有效,选中单元格
- */
- _setSelectCell(row, fieldOrColumn) {
- const $xeTable = this;
- const reactData = $xeTable;
- const {
- tableData
- } = reactData;
- const editOpts = $xeTable.computeEditOpts;
- const column = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(fieldOrColumn) ? $xeTable.getColumnByField(fieldOrColumn) : fieldOrColumn;
- if (row && column && editOpts.trigger !== 'manual') {
- const rowIndex = $xeTable.findRowIndexOf(tableData, row);
- if (rowIndex > -1) {
- const cell = $xeTable.getCellElement(row, column);
- const params = {
- row,
- rowIndex,
- column,
- columnIndex: $xeTable.getColumnIndex(column),
- cell
- };
- $xeTable.handleSelected(params, {});
- }
- }
- return $xeTable.$nextTick();
- },
- /**
- * 处理选中源
- */
- handleSelected(params, evnt) {
- const $xeTable = this;
- const props = $xeTable;
- const reactData = $xeTable;
- const {
- mouseConfig
- } = props;
- const {
- editStore
- } = reactData;
- const mouseOpts = $xeTable.computeMouseOpts;
- const editOpts = $xeTable.computeEditOpts;
- const {
- actived,
- selected
- } = editStore;
- const {
- row,
- column
- } = params;
- const isMouseSelected = mouseConfig && mouseOpts.selected;
- const selectMethod = () => {
- if (isMouseSelected && (selected.row !== row || selected.column !== column)) {
- if (actived.row !== row || (editOpts.mode === 'cell' ? actived.column !== column : false)) {
- handleClearEdit($xeTable, evnt);
- $xeTable.clearSelected();
- if ($xeTable.clearCellAreas) {
- $xeTable.clearCellAreas();
- $xeTable.clearCopyCellArea();
- }
- selected.args = params;
- selected.row = row;
- selected.column = column;
- if (isMouseSelected) {
- this.addCellSelectedClass();
- }
- $xeTable.focus();
- if (evnt) {
- $xeTable.dispatchEvent('cell-selected', params, evnt);
- }
- }
- }
- return $xeTable.$nextTick();
- };
- return selectMethod();
- },
- /**
- * 获取选中的单元格
- */
- _getSelectedCell() {
- const $xeTable = this;
- const reactData = $xeTable;
- const {
- editStore
- } = reactData;
- const {
- row,
- column
- } = editStore.selected;
- if (row && column) {
- return {
- row,
- column
- };
- }
- return null;
- },
- /**
- * 清除所选中源状态
- */
- _clearSelected() {
- const $xeTable = this;
- const reactData = $xeTable;
- const {
- editStore
- } = reactData;
- const {
- selected
- } = editStore;
- selected.row = null;
- selected.column = null;
- removeCellSelectedClass($xeTable);
- return $xeTable.$nextTick();
- },
- reColTitleSdCls() {
- const headerElem = this.elemStore['main-header-list'];
- if (headerElem) {
- 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'));
- }
- },
- addCellSelectedClass() {
- const $xeTable = this;
- const reactData = $xeTable;
- const {
- editStore
- } = reactData;
- const {
- selected
- } = editStore;
- const {
- row,
- column
- } = selected;
- removeCellSelectedClass($xeTable);
- if (row && column) {
- const cell = $xeTable.getCellElement(row, column);
- if (cell) {
- addClass(cell, 'col--selected');
- }
- }
- }
- }
- });
- ;// CONCATENATED MODULE: ./packages/table/module/export/util.ts
- // 默认导出或打印的 HTML 样式
- 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}';
- function getExportBlobByContent(content, options) {
- return new Blob([content], {
- type: `text/${options.type};charset=utf-8;`
- });
- }
- function createHtmlPage(opts, content) {
- const {
- style
- } = opts;
- 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('');
- }
- ;// CONCATENATED MODULE: ./packages/table/module/export/mixin.ts
- const {
- getI18n: export_mixin_getI18n,
- renderer: export_mixin_renderer
- } = core_.VxeUI;
- let htmlCellElem;
- const csvBOM = '\ufeff';
- const enterSymbol = '\r\n';
- function hasTreeChildren($xeTable, row) {
- const treeOpts = $xeTable.computeTreeOpts;
- const childrenField = treeOpts.children || treeOpts.childrenField;
- return row[childrenField] && row[childrenField].length;
- }
- function getSeq($xeTable, cellValue, row, $rowIndex, column, $columnIndex) {
- const seqOpts = $xeTable.computeSeqOpts;
- const seqMethod = seqOpts.seqMethod || column.seqMethod;
- if (seqMethod) {
- return seqMethod({
- $table: $xeTable,
- row,
- rowIndex: $xeTable.getRowIndex(row),
- $rowIndex,
- column,
- columnIndex: $xeTable.getColumnIndex(column),
- $columnIndex
- });
- }
- return cellValue;
- }
- function defaultFilterExportColumn(column) {
- return !!column.field || ['seq', 'checkbox', 'radio'].indexOf(column.type || '') === -1;
- }
- function toTableBorder(border) {
- if (border === true) {
- return 'full';
- }
- if (border) {
- return border;
- }
- return 'default';
- }
- function toBooleanValue(cellValue) {
- return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isBoolean(cellValue) ? cellValue ? 'TRUE' : 'FALSE' : cellValue;
- }
- const toStringValue = cellValue => {
- return eqEmptyValue(cellValue) ? '' : `${cellValue}`;
- };
- function getBodyLabelData($xeTable, opts, columns, datas) {
- const props = $xeTable;
- const {
- isAllExpand,
- mode
- } = opts;
- const {
- treeConfig
- } = props;
- const radioOpts = $xeTable.computeRadioOpts;
- const checkboxOpts = $xeTable.computeCheckboxOpts;
- const treeOpts = $xeTable.computeTreeOpts;
- const columnOpts = $xeTable.computeColumnOpts;
- if (!htmlCellElem) {
- htmlCellElem = document.createElement('div');
- }
- if (treeConfig) {
- const childrenField = treeOpts.children || treeOpts.childrenField;
- // 如果是树表格只允许导出数据源
- const rest = [];
- const expandMaps = {};
- const useMaps = {};
- const {
- handleGetRowId
- } = createHandleGetRowId($xeTable);
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(datas, (item, $rowIndex, items, path, parent, nodes) => {
- const row = item._row || item;
- const rowid = handleGetRowId(row);
- if (useMaps[rowid]) {
- return;
- }
- const parentRow = parent && parent._row ? parent._row : parent;
- const pRowid = parentRow ? handleGetRowId(parentRow) : '';
- if (isAllExpand || !parentRow || expandMaps[pRowid] && $xeTable.isTreeExpandByRow(parentRow)) {
- const hasRowChild = hasTreeChildren($xeTable, row);
- const item = {
- _row: row,
- _level: nodes.length - 1,
- _hasChild: hasRowChild,
- _expand: hasRowChild && $xeTable.isTreeExpandByRow(row)
- };
- columns.forEach((column, $columnIndex) => {
- let cellValue = '';
- const renderOpts = column.editRender || column.cellRender;
- let bodyExportMethod = column.exportMethod || columnOpts.exportMethod;
- if (!bodyExportMethod && renderOpts && renderOpts.name) {
- const compConf = export_mixin_renderer.get(renderOpts.name);
- if (compConf) {
- bodyExportMethod = compConf.tableExportMethod || compConf.exportMethod;
- }
- }
- if (!bodyExportMethod) {
- bodyExportMethod = columnOpts.exportMethod;
- }
- if (bodyExportMethod) {
- cellValue = bodyExportMethod({
- $table: $xeTable,
- row,
- column,
- options: opts
- });
- } else {
- switch (column.type) {
- case 'seq':
- {
- const seqVal = path.map((num, i) => i % 2 === 0 ? Number(num) + 1 : '.').join('');
- cellValue = mode === 'all' ? seqVal : getSeq($xeTable, seqVal, row, $rowIndex, column, $columnIndex);
- break;
- }
- case 'checkbox':
- cellValue = toBooleanValue($xeTable.isCheckedByCheckboxRow(row));
- item._checkboxLabel = checkboxOpts.labelField ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, checkboxOpts.labelField) : '';
- item._checkboxDisabled = checkboxOpts.checkMethod && !checkboxOpts.checkMethod({
- $table: $xeTable,
- row
- });
- break;
- case 'radio':
- cellValue = toBooleanValue($xeTable.isCheckedByRadioRow(row));
- item._radioLabel = radioOpts.labelField ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, radioOpts.labelField) : '';
- item._radioDisabled = radioOpts.checkMethod && !radioOpts.checkMethod({
- $table: $xeTable,
- row
- });
- break;
- default:
- if (opts.original) {
- cellValue = getCellValue(row, column);
- } else {
- cellValue = $xeTable.getCellLabel(row, column);
- if (column.type === 'html') {
- htmlCellElem.innerHTML = cellValue;
- cellValue = htmlCellElem.innerText.trim();
- } else {
- const cell = $xeTable.getCellElement(row, column);
- if (cell && !hasClass(cell, 'is--progress')) {
- cellValue = cell.innerText.trim();
- }
- }
- }
- }
- }
- item[column.id] = toStringValue(cellValue);
- });
- useMaps[rowid] = true;
- if (pRowid) {
- expandMaps[pRowid] = true;
- }
- rest.push(Object.assign(item, row));
- }
- }, {
- children: childrenField
- });
- return rest;
- }
- return datas.map((row, $rowIndex) => {
- const item = {
- _row: row
- };
- columns.forEach((column, $columnIndex) => {
- let cellValue = '';
- const renderOpts = column.editRender || column.cellRender;
- let bodyExportMethod = column.exportMethod || columnOpts.exportMethod;
- if (!bodyExportMethod && renderOpts && renderOpts.name) {
- const compConf = export_mixin_renderer.get(renderOpts.name);
- if (compConf) {
- bodyExportMethod = compConf.tableExportMethod || compConf.exportMethod;
- }
- }
- if (bodyExportMethod) {
- cellValue = bodyExportMethod({
- $table: $xeTable,
- row,
- column,
- options: opts
- });
- } else {
- switch (column.type) {
- case 'seq':
- {
- const seqValue = $rowIndex + 1;
- cellValue = mode === 'all' ? seqValue : getSeq($xeTable, seqValue, row, $rowIndex, column, $columnIndex);
- break;
- }
- case 'checkbox':
- cellValue = toBooleanValue($xeTable.isCheckedByCheckboxRow(row));
- item._checkboxLabel = checkboxOpts.labelField ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, checkboxOpts.labelField) : '';
- item._checkboxDisabled = checkboxOpts.checkMethod && !checkboxOpts.checkMethod({
- $table: $xeTable,
- row
- });
- break;
- case 'radio':
- cellValue = toBooleanValue($xeTable.isCheckedByRadioRow(row));
- item._radioLabel = radioOpts.labelField ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, radioOpts.labelField) : '';
- item._radioDisabled = radioOpts.checkMethod && !radioOpts.checkMethod({
- $table: $xeTable,
- row
- });
- break;
- default:
- if (opts.original) {
- cellValue = getCellValue(row, column);
- } else {
- cellValue = $xeTable.getCellLabel(row, column);
- if (column.type === 'html') {
- htmlCellElem.innerHTML = cellValue;
- cellValue = htmlCellElem.innerText.trim();
- } else {
- const cell = $xeTable.getCellElement(row, column);
- if (cell && !hasClass(cell, 'is--progress')) {
- cellValue = cell.innerText.trim();
- }
- }
- }
- }
- }
- item[column.id] = toStringValue(cellValue);
- });
- return item;
- });
- }
- function getExportData($xeTable, opts) {
- const $xeGrid = $xeTable.$xeGrid;
- const $xeGantt = $xeTable.$xeGantt;
- const {
- columns,
- dataFilterMethod
- } = opts;
- let datas = opts.data;
- if (dataFilterMethod) {
- datas = datas.filter((row, index) => dataFilterMethod({
- $table: $xeTable,
- $grid: $xeGrid,
- $gantt: $xeGantt,
- row,
- $rowIndex: index
- }));
- }
- return getBodyLabelData($xeTable, opts, columns, datas);
- }
- function getBooleanValue(cellValue) {
- return cellValue === 'TRUE' || cellValue === 'true' || cellValue === true;
- }
- function getHeaderTitle($xeTable, opts, column) {
- const columnOpts = $xeTable.computeColumnOpts;
- const headExportMethod = column.headerExportMethod || columnOpts.headerExportMethod;
- return headExportMethod ? headExportMethod({
- column,
- options: opts,
- $table: $xeTable
- }) : (opts.isTitle ? column.getTitle() : column.field) || '';
- }
- function getFooterCellValue($xeTable, opts, row, column) {
- const columnOpts = $xeTable.computeColumnOpts;
- const renderOpts = column.editRender || column.cellRender;
- let footLabelMethod = column.footerExportMethod;
- if (!footLabelMethod && renderOpts && renderOpts.name) {
- const compConf = export_mixin_renderer.get(renderOpts.name);
- if (compConf) {
- footLabelMethod = compConf.tableFooterExportMethod || compConf.footerExportMethod || compConf.footerCellExportMethod;
- }
- }
- if (!footLabelMethod) {
- footLabelMethod = columnOpts.footerExportMethod;
- }
- const _columnIndex = $xeTable.getVTColumnIndex(column);
- if (footLabelMethod) {
- return footLabelMethod({
- $table: $xeTable,
- items: row,
- itemIndex: _columnIndex,
- row,
- _columnIndex,
- column,
- options: opts
- });
- }
- // 兼容老模式
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(row)) {
- return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toValueString(row[_columnIndex]);
- }
- return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, column.field);
- }
- function getFooterData($xeTable, opts, footerTableData) {
- const $xeGrid = $xeTable.$xeGrid;
- const $xeGantt = $xeTable.$xeGantt;
- const {
- footerFilterMethod
- } = opts;
- return footerFilterMethod ? footerTableData.filter((items, index) => footerFilterMethod({
- $table: $xeTable,
- $grid: $xeGrid,
- $gantt: $xeGantt,
- items,
- $rowIndex: index
- })) : footerTableData;
- }
- function getCsvCellTypeLabel(column, cellValue) {
- if (cellValue) {
- if (column.type === 'seq') {
- return `\t${cellValue}`;
- }
- switch (column.cellType) {
- case 'string':
- if (!isNaN(cellValue)) {
- return `\t${cellValue}`;
- }
- break;
- case 'number':
- break;
- default:
- if (cellValue.length >= 12 && !isNaN(cellValue)) {
- return `\t${cellValue}`;
- }
- break;
- }
- }
- return cellValue;
- }
- function toTxtCellLabel(val) {
- if (/[",\s\n]/.test(val)) {
- return `"${val.replace(/"/g, '""')}"`;
- }
- return val;
- }
- function toCsv($xeTable, opts, columns, datas) {
- const reactData = $xeTable;
- let content = csvBOM;
- if (opts.isHeader) {
- content += columns.map(column => toTxtCellLabel(getHeaderTitle($xeTable, opts, column))).join(',') + enterSymbol;
- }
- datas.forEach(row => {
- content += columns.map(column => toTxtCellLabel(getCsvCellTypeLabel(column, row[column.id]))).join(',') + enterSymbol;
- });
- if (opts.isFooter) {
- const {
- footerTableData
- } = reactData;
- const footers = getFooterData($xeTable, opts, footerTableData);
- footers.forEach(row => {
- content += columns.map(column => toTxtCellLabel(getFooterCellValue($xeTable, opts, row, column))).join(',') + enterSymbol;
- });
- }
- return content;
- }
- function toTxt($xeTable, opts, columns, datas) {
- const reactData = $xeTable;
- let content = '';
- if (opts.isHeader) {
- content += columns.map(column => toTxtCellLabel(getHeaderTitle($xeTable, opts, column))).join('\t') + enterSymbol;
- }
- datas.forEach(row => {
- content += columns.map(column => toTxtCellLabel(row[column.id])).join('\t') + enterSymbol;
- });
- if (opts.isFooter) {
- const {
- footerTableData
- } = reactData;
- const footers = getFooterData($xeTable, opts, footerTableData);
- footers.forEach(row => {
- content += columns.map(column => toTxtCellLabel(getFooterCellValue($xeTable, opts, row, column))).join('\t') + enterSymbol;
- });
- }
- return content;
- }
- function hasEllipsis($xeTable, column, property, allColumnOverflow) {
- const reactData = $xeTable;
- const columnOverflow = column[property];
- 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;
- const showEllipsis = headOverflow === 'ellipsis';
- const showTitle = headOverflow === 'title';
- const showTooltip = headOverflow === true || headOverflow === 'tooltip';
- let isEllipsis = showTitle || showTooltip || showEllipsis;
- // 虚拟滚动不支持动态高度
- const {
- scrollXLoad,
- scrollYLoad
- } = reactData;
- if ((scrollXLoad || scrollYLoad) && !isEllipsis) {
- isEllipsis = true;
- }
- return isEllipsis;
- }
- function toHtml($xeTable, opts, columns, datas) {
- const props = $xeTable;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- id,
- border,
- treeConfig,
- headerAlign: allHeaderAlign,
- align: allAlign,
- footerAlign: allFooterAlign,
- showOverflow: allColumnOverflow,
- showHeaderOverflow: allColumnHeaderOverflow
- } = props;
- const {
- isAllSelected,
- isIndeterminate
- } = reactData;
- const {
- mergeBodyCellMaps
- } = internalData;
- const treeOpts = $xeTable.computeTreeOpts;
- const {
- print: isPrint,
- isHeader,
- isFooter,
- isColgroup,
- isMerge,
- colgroups,
- original
- } = opts;
- const allCls = 'check-all';
- const clss = ['vxe-table', `border--${toTableBorder(border)}`, isPrint ? 'is--print' : '', isHeader ? 'is--header' : ''].filter(cls => cls);
- const tables = [`<table class="${clss.join(' ')}" border="0" cellspacing="0" cellpadding="0">`, `<colgroup>${columns.map(column => `<col style="width:${column.renderWidth}px">`).join('')}</colgroup>`];
- if (isHeader) {
- tables.push('<thead>');
- if (isColgroup && !original) {
- colgroups.forEach(cols => {
- tables.push(`<tr>${cols.map(column => {
- const headAlign = column.headerAlign || column.align || allHeaderAlign || allAlign;
- const classNames = hasEllipsis($xeTable, column, 'showHeaderOverflow', allColumnHeaderOverflow) ? ['col--ellipsis'] : [];
- const cellTitle = getHeaderTitle($xeTable, opts, column);
- let childWidth = 0;
- let countChild = 0;
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree([column], item => {
- if (!item.childNodes || !column.childNodes.length) {
- countChild++;
- }
- childWidth += item.renderWidth;
- }, {
- children: 'childNodes'
- });
- const cellWidth = childWidth - countChild;
- if (headAlign) {
- classNames.push(`col--${headAlign}`);
- }
- if (column.type === 'checkbox') {
- 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>`;
- }
- 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>`;
- }).join('')}</tr>`);
- });
- } else {
- tables.push(`<tr>${columns.map(column => {
- const headAlign = column.headerAlign || column.align || allHeaderAlign || allAlign;
- const classNames = hasEllipsis($xeTable, column, 'showHeaderOverflow', allColumnHeaderOverflow) ? ['col--ellipsis'] : [];
- const cellTitle = getHeaderTitle($xeTable, opts, column);
- if (headAlign) {
- classNames.push(`col--${headAlign}`);
- }
- if (column.type === 'checkbox') {
- return `<th class="${classNames.join(' ')}"><div ${isPrint ? '' : `style="width: ${column.renderWidth}px"`}><input type="checkbox" class="${allCls}" ${isAllSelected ? 'checked' : ''}><span>${cellTitle}</span></div></th>`;
- }
- return `<th class="${classNames.join(' ')}" title="${cellTitle}"><div ${isPrint ? '' : `style="width: ${column.renderWidth}px"`}><span>${formatText(cellTitle, true)}</span></div></th>`;
- }).join('')}</tr>`);
- }
- tables.push('</thead>');
- }
- if (datas.length) {
- tables.push('<tbody>');
- if (treeConfig) {
- datas.forEach(item => {
- tables.push('<tr>' + columns.map(column => {
- const cellAlign = column.align || allAlign;
- const classNames = hasEllipsis($xeTable, column, 'showOverflow', allColumnOverflow) ? ['col--ellipsis'] : [];
- const cellValue = item[column.id];
- if (cellAlign) {
- classNames.push(`col--${cellAlign}`);
- }
- if (column.treeNode) {
- let treeIcon = '';
- if (item._hasChild) {
- treeIcon = `<i class="${item._expand ? 'vxe-table--tree-fold-icon' : 'vxe-table--tree-unfold-icon'}"></i>`;
- }
- classNames.push('vxe-table--tree-node');
- if (column.type === 'radio') {
- 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>`;
- } else if (column.type === 'checkbox') {
- 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>`;
- }
- 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>`;
- }
- if (column.type === 'radio') {
- 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>`;
- } else if (column.type === 'checkbox') {
- 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>`;
- }
- return `<td class="${classNames.join(' ')}" title="${cellValue}"><div ${isPrint ? '' : `style="width: ${column.renderWidth}px"`}>${formatText(cellValue, true)}</div></td>`;
- }).join('') + '</tr>');
- });
- } else {
- datas.forEach(item => {
- tables.push('<tr>' + columns.map(column => {
- const colid = column.id;
- const cellAlign = column.align || allAlign;
- const classNames = hasEllipsis($xeTable, column, 'showOverflow', allColumnOverflow) ? ['col--ellipsis'] : [];
- const cellValue = item[colid];
- let rowSpan = 1;
- let colSpan = 1;
- if (isMerge) {
- const _rowIndex = $xeTable.getVTRowIndex(item._row);
- const _columnIndex = $xeTable.getVTColumnIndex(column);
- const spanRest = mergeBodyCellMaps[`${_rowIndex}:${_columnIndex}`];
- if (spanRest) {
- const {
- rowspan,
- colspan
- } = spanRest;
- if (!rowspan || !colspan) {
- return '';
- }
- if (rowspan > 1) {
- rowSpan = rowspan;
- }
- if (colspan > 1) {
- colSpan = colspan;
- }
- }
- }
- if (cellAlign) {
- classNames.push(`col--${cellAlign}`);
- }
- if (column.type === 'radio') {
- 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>`;
- } else if (column.type === 'checkbox') {
- 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>`;
- }
- return `<td class="${classNames.join(' ')}" rowspan="${rowSpan}" colspan="${colSpan}" title="${cellValue}"><div ${isPrint ? '' : `style="width: ${column.renderWidth}px"`}>${formatText(cellValue, true)}</div></td>`;
- }).join('') + '</tr>');
- });
- }
- tables.push('</tbody>');
- }
- if (isFooter) {
- const {
- footerTableData
- } = reactData;
- const footers = getFooterData($xeTable, opts, footerTableData);
- if (footers.length) {
- tables.push('<tfoot>');
- footers.forEach(row => {
- tables.push(`<tr>${columns.map(column => {
- const footAlign = column.footerAlign || column.align || allFooterAlign || allAlign;
- const classNames = hasEllipsis($xeTable, column, 'showOverflow', allColumnOverflow) ? ['col--ellipsis'] : [];
- const cellValue = getFooterCellValue($xeTable, opts, row, column);
- if (footAlign) {
- classNames.push(`col--${footAlign}`);
- }
- return `<td class="${classNames.join(' ')}" title="${cellValue}"><div ${isPrint ? '' : `style="width: ${column.renderWidth}px"`}>${formatText(cellValue, true)}</div></td>`;
- }).join('')}</tr>`);
- });
- tables.push('</tfoot>');
- }
- }
- // 是否半选状态
- const script = !isAllSelected && isIndeterminate ? `<script>(function(){var a=document.querySelector(".${allCls}");if(a){a.indeterminate=true}})()</script>` : '';
- tables.push('</table>', script);
- return isPrint ? tables.join('') : createHtmlPage(opts, tables.join(''));
- }
- function toXML($xeTable, opts, columns, datas) {
- const reactData = $xeTable;
- 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('');
- if (opts.isHeader) {
- xml += `<Row>${columns.map(column => `<Cell><Data ss:Type="String">${getHeaderTitle($xeTable, opts, column)}</Data></Cell>`).join('')}</Row>`;
- }
- datas.forEach(row => {
- xml += '<Row>' + columns.map(column => `<Cell><Data ss:Type="String">${row[column.id]}</Data></Cell>`).join('') + '</Row>';
- });
- if (opts.isFooter) {
- const {
- footerTableData
- } = reactData;
- const footers = getFooterData($xeTable, opts, footerTableData);
- footers.forEach(row => {
- xml += `<Row>${columns.map(column => `<Cell><Data ss:Type="String">${getFooterCellValue($xeTable, opts, row, column)}</Data></Cell>`).join('')}</Row>`;
- });
- }
- return `${xml}</Table></Worksheet></Workbook>`;
- }
- function getContent($xeTable, opts, columns, datas) {
- if (columns.length) {
- switch (opts.type) {
- case 'csv':
- return toCsv($xeTable, opts, columns, datas);
- case 'txt':
- return toTxt($xeTable, opts, columns, datas);
- case 'html':
- return toHtml($xeTable, opts, columns, datas);
- case 'xml':
- return toXML($xeTable, opts, columns, datas);
- }
- }
- return '';
- }
- function downloadFile($xeTable, opts, content) {
- const {
- filename,
- type,
- download
- } = opts;
- if (!download) {
- const blob = getExportBlobByContent(content, opts);
- return Promise.resolve({
- type,
- content,
- blob
- });
- }
- if (core_.VxeUI.saveFile) {
- core_.VxeUI.saveFile({
- filename,
- type,
- content
- }).then(() => {
- if (opts.message !== false) {
- if (core_.VxeUI.modal) {
- core_.VxeUI.modal.message({
- content: export_mixin_getI18n('vxe.table.expSuccess'),
- status: 'success'
- });
- }
- }
- });
- }
- }
- function clearColumnConvert(columns) {
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(columns, column => {
- delete column._level;
- delete column._colSpan;
- delete column._rowSpan;
- delete column._children;
- delete column.childNodes;
- }, {
- children: 'children'
- });
- }
- function handleExport($xeTable, opts) {
- const $xeGrid = $xeTable.$xeGrid;
- const $xeGantt = $xeTable.$xeGantt;
- const {
- remote,
- columns,
- colgroups,
- exportMethod,
- afterExportMethod
- } = opts;
- return new Promise(resolve => {
- if (remote) {
- const params = {
- options: opts,
- $table: $xeTable,
- $grid: $xeGrid,
- $gantt: $xeGantt
- };
- resolve(exportMethod ? exportMethod(params) : params);
- } else {
- const datas = getExportData($xeTable, opts);
- resolve($xeTable.preventEvent(null, 'event.export', {
- options: opts,
- columns,
- colgroups,
- datas
- }, () => {
- return downloadFile($xeTable, opts, getContent($xeTable, opts, columns, datas));
- }));
- }
- }).then(params => {
- clearColumnConvert(columns);
- if (!opts.print) {
- if (afterExportMethod) {
- afterExportMethod({
- status: true,
- options: opts,
- $table: $xeTable,
- $grid: $xeGrid,
- $gantt: $xeGantt
- });
- }
- }
- return Object.assign({
- status: true
- }, params);
- }).catch(() => {
- clearColumnConvert(columns);
- if (!opts.print) {
- if (afterExportMethod) {
- afterExportMethod({
- status: false,
- options: opts,
- $table: $xeTable,
- $grid: $xeGrid,
- $gantt: $xeGantt
- });
- }
- }
- const params = {
- status: false
- };
- return Promise.reject(params);
- });
- }
- function getElementsByTagName(elem, qualifiedName) {
- return elem.getElementsByTagName(qualifiedName);
- }
- function getTxtCellKey(now) {
- return `#${now}@${external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().uniqueId()}`;
- }
- function replaceTxtCell(cell, vMaps) {
- 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);
- }
- function getTxtCellValue(val, vMaps) {
- const rest = replaceTxtCell(val, vMaps);
- return rest.replace(/^"+$/g, qVal => '"'.repeat(Math.ceil(qVal.length / 2)));
- }
- function toExportField(tableConf, field) {
- const {
- fieldMaps,
- titleMaps
- } = tableConf;
- // title 转 field
- if (!fieldMaps[field]) {
- const teCol = titleMaps[field];
- if (teCol && teCol.field) {
- field = teCol.field;
- }
- }
- return field;
- }
- function parseCsvAndTxt(tableConf, content, cellSeparator) {
- const list = content.split(enterSymbol);
- const rows = [];
- let fields = [];
- if (list.length) {
- const vMaps = {};
- const now = Date.now();
- list.forEach(rVal => {
- if (rVal) {
- const item = {};
- rVal = rVal.replace(/("")|(\n)/g, (text, dVal) => {
- const key = getTxtCellKey(now);
- vMaps[key] = dVal ? '"' : '\n';
- return key;
- }).replace(/"(.*?)"/g, (text, cVal) => {
- const key = getTxtCellKey(now);
- vMaps[key] = replaceTxtCell(cVal, vMaps);
- return key;
- });
- const cells = rVal.split(cellSeparator);
- if (!fields.length) {
- fields = cells.map(val => toExportField(tableConf, getTxtCellValue(val.trim(), vMaps)));
- } else {
- cells.forEach((val, colIndex) => {
- if (colIndex < fields.length) {
- item[fields[colIndex]] = getTxtCellValue(val.trim(), vMaps);
- }
- });
- rows.push(item);
- }
- }
- });
- }
- return {
- fields,
- rows
- };
- }
- function parseCsv(tableConf, content) {
- return parseCsvAndTxt(tableConf, content, ',');
- }
- function parseTxt(tableConf, content) {
- return parseCsvAndTxt(tableConf, content, '\t');
- }
- function parseHTML(tableConf, content) {
- const domParser = new DOMParser();
- const xmlDoc = domParser.parseFromString(content, 'text/html');
- const bodyNodes = getElementsByTagName(xmlDoc, 'body');
- const rows = [];
- const fields = [];
- if (bodyNodes.length) {
- const tableNodes = getElementsByTagName(bodyNodes[0], 'table');
- if (tableNodes.length) {
- const theadNodes = getElementsByTagName(tableNodes[0], 'thead');
- if (theadNodes.length) {
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayEach(getElementsByTagName(theadNodes[0], 'tr'), rowNode => {
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayEach(getElementsByTagName(rowNode, 'th'), cellNode => {
- fields.push(toExportField(tableConf, cellNode.textContent || ''));
- });
- });
- const tbodyNodes = getElementsByTagName(tableNodes[0], 'tbody');
- if (tbodyNodes.length) {
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayEach(getElementsByTagName(tbodyNodes[0], 'tr'), rowNode => {
- const item = {};
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayEach(getElementsByTagName(rowNode, 'td'), (cellNode, colIndex) => {
- if (fields[colIndex]) {
- item[fields[colIndex]] = cellNode.textContent || '';
- }
- });
- rows.push(item);
- });
- }
- }
- }
- }
- return {
- fields,
- rows
- };
- }
- function parseXML(tableConf, content) {
- const domParser = new DOMParser();
- const xmlDoc = domParser.parseFromString(content, 'application/xml');
- const sheetNodes = getElementsByTagName(xmlDoc, 'Worksheet');
- const rows = [];
- const fields = [];
- if (sheetNodes.length) {
- const tableNodes = getElementsByTagName(sheetNodes[0], 'Table');
- if (tableNodes.length) {
- const rowNodes = getElementsByTagName(tableNodes[0], 'Row');
- if (rowNodes.length) {
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayEach(getElementsByTagName(rowNodes[0], 'Cell'), cellNode => {
- fields.push(toExportField(tableConf, cellNode.textContent || ''));
- });
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayEach(rowNodes, (rowNode, index) => {
- if (index) {
- const item = {};
- const cellNodes = getElementsByTagName(rowNode, 'Cell');
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayEach(cellNodes, (cellNode, colIndex) => {
- if (fields[colIndex]) {
- item[fields[colIndex]] = cellNode.textContent;
- }
- });
- rows.push(item);
- }
- });
- }
- }
- }
- return {
- fields,
- rows
- };
- }
- function handleImport($xeTable, content, opts) {
- const internalData = $xeTable;
- const {
- tableFullColumn,
- _importResolve,
- _importReject
- } = internalData;
- let rest = {
- fields: [],
- rows: []
- };
- const tableFieldMaps = {};
- const tableTitleMaps = {};
- tableFullColumn.forEach(column => {
- const field = column.field;
- const title = column.getTitle();
- if (field) {
- tableFieldMaps[field] = column;
- }
- if (title) {
- tableTitleMaps[column.getTitle()] = column;
- }
- });
- const tableConf = {
- fieldMaps: tableFieldMaps,
- titleMaps: tableTitleMaps
- };
- switch (opts.type) {
- case 'csv':
- rest = parseCsv(tableConf, content);
- break;
- case 'txt':
- rest = parseTxt(tableConf, content);
- break;
- case 'html':
- rest = parseHTML(tableConf, content);
- break;
- case 'xml':
- rest = parseXML(tableConf, content);
- break;
- }
- const {
- fields,
- rows
- } = rest;
- const status = fields.some(field => tableFieldMaps[field] || tableTitleMaps[field]);
- if (status) {
- $xeTable.createData(rows).then(data => {
- let loadRest;
- if (opts.mode === 'insert' || opts.mode === 'insertBottom') {
- loadRest = $xeTable.insertAt(data, -1);
- }
- if (opts.mode === 'insertTop') {
- loadRest = $xeTable.insert(data);
- } else {
- loadRest = $xeTable.reloadData(data);
- }
- if (opts.message !== false) {
- // 检测弹窗模块
- if (!core_.VxeUI.modal) {
- errLog('vxe.error.reqModule', ['Modal']);
- }
- core_.VxeUI.modal.message({
- content: export_mixin_getI18n('vxe.table.impSuccess', [rows.length]),
- status: 'success'
- });
- }
- return loadRest.then(() => {
- if (_importResolve) {
- _importResolve({
- status: true
- });
- }
- });
- });
- } else if (opts.message !== false) {
- // 检测弹窗模块
- if (!core_.VxeUI.modal) {
- errLog('vxe.error.reqModule', ['Modal']);
- }
- core_.VxeUI.modal.message({
- content: export_mixin_getI18n('vxe.error.impFields'),
- status: 'error'
- });
- if (_importReject) {
- _importReject({
- status: false
- });
- }
- }
- }
- function handleFileImport($xeTable, file, opts) {
- const internalData = $xeTable;
- const importOpts = $xeTable.computeImportOpts;
- const {
- importMethod,
- afterImportMethod
- } = opts;
- const {
- type,
- filename
- } = parseFile(file);
- // 检查类型,如果为自定义导出,则不需要校验类型
- 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)) {
- if (opts.message !== false) {
- // 检测弹窗模块
- if (!core_.VxeUI.modal) {
- errLog('vxe.error.reqModule', ['Modal']);
- }
- core_.VxeUI.modal.message({
- content: export_mixin_getI18n('vxe.error.notType', [type]),
- status: 'error'
- });
- }
- const params = {
- status: false
- };
- return Promise.reject(params);
- }
- const rest = new Promise((resolve, reject) => {
- const _importResolve = params => {
- resolve(params);
- $xeTable._importResolve = null;
- $xeTable._importReject = null;
- };
- const _importReject = params => {
- reject(params);
- $xeTable._importResolve = null;
- $xeTable._importReject = null;
- };
- $xeTable._importResolve = _importResolve;
- $xeTable._importReject = _importReject;
- if (window.FileReader) {
- const options = Object.assign({
- mode: 'insertTop'
- }, opts, {
- type,
- filename
- });
- if (options.remote) {
- if (importMethod) {
- Promise.resolve(importMethod({
- file,
- options,
- $table: $xeTable
- })).then(() => {
- _importResolve({
- status: true
- });
- }).catch(() => {
- _importResolve({
- status: true
- });
- });
- } else {
- _importResolve({
- status: true
- });
- }
- } else {
- const {
- tableFullColumn
- } = internalData;
- $xeTable.preventEvent(null, 'event.import', {
- file,
- options,
- columns: tableFullColumn
- }, () => {
- const reader = new FileReader();
- reader.onerror = () => {
- errLog('vxe.error.notType', [type]);
- _importReject({
- status: false
- });
- };
- reader.onload = e => {
- handleImport($xeTable, e.target.result, options);
- };
- reader.readAsText(file, options.encoding || 'UTF-8');
- });
- }
- } else {
- // 不支持的浏览器
- errLog('vxe.error.notExp');
- _importResolve({
- status: true
- });
- }
- });
- return rest.then(() => {
- if (afterImportMethod) {
- afterImportMethod({
- status: true,
- options: opts,
- $table: $xeTable
- });
- }
- }).catch(e => {
- if (afterImportMethod) {
- afterImportMethod({
- status: false,
- options: opts,
- $table: $xeTable
- });
- }
- return Promise.reject(e);
- });
- }
- function handleCloseExport() {
- if (core_.VxeUI.modal) {
- return core_.VxeUI.modal.close('VXE_EXPORT_MODAL');
- }
- return Promise.resolve();
- }
- function handleFilterColumns(exportOpts, column, columns) {
- return columns.some(item => {
- if (isColumnInfo(item)) {
- return column.id === item.id;
- } else if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(item)) {
- return column.field === item;
- } else {
- const colid = item.id || item.colId;
- const type = item.type;
- const field = item.field;
- if (colid) {
- return column.id === colid;
- } else if (field && type) {
- return column.field === field && column.type === type;
- } else if (field) {
- return column.field === field;
- } else if (type) {
- return column.type === type;
- }
- }
- return false;
- });
- }
- function handleFilterFields(exportOpts, column, includeFields, excludeFields) {
- if (excludeFields) {
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().includes(excludeFields, column.field)) {
- return false;
- }
- }
- if (includeFields) {
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().includes(includeFields, column.field)) {
- return true;
- }
- return false;
- }
- return exportOpts.original ? !!column.field : defaultFilterExportColumn(column);
- }
- function handleExportAndPrint($xeTable, options, isPrint) {
- const props = $xeTable;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const $xeGrid = $xeTable.$xeGrid;
- const $xeGantt = $xeTable.$xeGantt;
- const $xeGGWrapper = $xeGrid || $xeGantt;
- const {
- treeConfig,
- showHeader,
- showFooter
- } = props;
- const {
- initStore,
- isGroup,
- footerTableData,
- exportStore,
- exportParams
- } = reactData;
- const {
- collectColumn,
- mergeBodyList,
- mergeFooterList
- } = internalData;
- const exportOpts = $xeTable.computeExportOpts;
- const hasTree = treeConfig;
- const customOpts = $xeTable.computeCustomOpts;
- const selectRecords = $xeTable.getCheckboxRecords();
- const proxyOpts = $xeGGWrapper ? $xeGGWrapper.computeProxyOpts : {};
- const hasFooter = !!footerTableData.length;
- const hasMerge = !!(mergeBodyList.length || mergeFooterList.length);
- const defOpts = Object.assign({
- message: true,
- isHeader: showHeader,
- isTitle: showHeader,
- isFooter: showFooter,
- isColgroup: isGroup,
- isMerge: hasMerge,
- useStyle: true,
- current: 'current',
- modes: (proxyOpts.ajax && proxyOpts.ajax.queryAll ? ['all'] : []).concat(['current', 'selected', 'empty'])
- }, options);
- const types = defOpts.types || external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().keys(exportOpts._typeMaps);
- const modes = defOpts.modes || [];
- const checkMethod = customOpts.checkMethod;
- const exportColumns = collectColumn.slice(0);
- const {
- columns,
- excludeFields,
- includeFields
- } = defOpts;
- // 处理类型
- const typeList = types.map(value => {
- return {
- value,
- label: export_mixin_getI18n(`vxe.export.types.${value}`)
- };
- });
- const modeList = modes.map(item => {
- if (item && item.value) {
- return {
- value: item.value,
- label: item.label || item.value
- };
- }
- return {
- value: item,
- label: export_mixin_getI18n(`vxe.export.modes.${item}`)
- };
- });
- // 默认选中
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(exportColumns, (column, index, items, path, parent) => {
- const isColGroup = column.children && column.children.length > 0;
- let isChecked = false;
- if (columns && columns.length) {
- isChecked = handleFilterColumns(defOpts, column, columns);
- } else if (excludeFields || includeFields) {
- isChecked = handleFilterFields(defOpts, column, includeFields, excludeFields);
- } else {
- isChecked = column.visible && (isColGroup || defaultFilterExportColumn(column));
- }
- column.checked = isChecked;
- column.halfChecked = false;
- column.disabled = parent && parent.disabled || (checkMethod ? !checkMethod({
- $table: $xeTable,
- column
- }) : false);
- });
- // 更新条件
- Object.assign(exportStore, {
- columns: exportColumns,
- typeList,
- modeList,
- hasFooter,
- hasMerge,
- hasTree,
- isPrint,
- hasColgroup: isGroup,
- visible: true
- });
- // 默认参数
- Object.assign(exportParams, {
- mode: selectRecords.length ? 'selected' : 'current'
- }, defOpts);
- const {
- filename,
- sheetName,
- mode,
- type
- } = exportParams;
- if (filename) {
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(filename)) {
- exportParams.filename = filename({
- options: defOpts,
- $table: $xeTable,
- $grid: $xeGrid,
- $gantt: $xeGantt
- });
- } else {
- exportParams.filename = `${filename}`;
- }
- }
- if (sheetName) {
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(sheetName)) {
- exportParams.sheetName = sheetName({
- options: defOpts,
- $table: $xeTable,
- $grid: $xeGrid,
- $gantt: $xeGantt
- });
- } else {
- exportParams.sheetName = `${sheetName}`;
- }
- }
- if (!modeList.some(item => item.value === mode)) {
- exportParams.mode = modeList[0].value;
- }
- if (!typeList.some(item => item.value === type)) {
- exportParams.type = typeList[0].value;
- }
- initStore.export = true;
- return $xeTable.$nextTick();
- }
- const getConvertColumns = columns => {
- const result = [];
- columns.forEach(column => {
- if (column.childNodes && column.childNodes.length) {
- result.push(column);
- result.push(...getConvertColumns(column.childNodes));
- } else {
- result.push(column);
- }
- });
- return result;
- };
- const convertToRows = originColumns => {
- let maxLevel = 1;
- const traverse = (column, parent) => {
- if (parent) {
- column._level = parent._level + 1;
- if (maxLevel < column._level) {
- maxLevel = column._level;
- }
- }
- if (column.childNodes && column.childNodes.length) {
- let colSpan = 0;
- column.childNodes.forEach(subColumn => {
- traverse(subColumn, column);
- colSpan += subColumn._colSpan;
- });
- column._colSpan = colSpan;
- } else {
- column._colSpan = 1;
- }
- };
- originColumns.forEach(column => {
- column._level = 1;
- traverse(column);
- });
- const rows = [];
- for (let i = 0; i < maxLevel; i++) {
- rows.push([]);
- }
- const allColumns = getConvertColumns(originColumns);
- allColumns.forEach(column => {
- if (column.childNodes && column.childNodes.length) {
- column._rowSpan = 1;
- } else {
- column._rowSpan = maxLevel - column._level + 1;
- }
- rows[column._level - 1].push(column);
- });
- return rows;
- };
- /* harmony default export */ var export_mixin = ({
- methods: {
- /**
- * 导出文件,支持 csv/html/xml/txt
- * 如果是树表格,则默认是导出所有节点
- * 如果是启用了虚拟滚动,则只能导出数据源,可以配合 dataFilterMethod 函数转换数据
- * @param {Object} options 参数
- */
- _exportData(options) {
- const $xeTable = this;
- const props = $xeTable;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const $xeGrid = $xeTable.$xeGrid;
- const $xeGantt = $xeTable.$xeGantt;
- const $xeGGWrapper = $xeGrid || $xeGantt;
- const {
- treeConfig,
- showHeader,
- showFooter
- } = props;
- const {
- isGroup
- } = reactData;
- const {
- tableFullColumn,
- afterFullData,
- afterTreeFullData,
- collectColumn,
- mergeBodyList,
- mergeFooterList
- } = internalData;
- const exportOpts = $xeTable.computeExportOpts;
- const treeOpts = $xeTable.computeTreeOpts;
- const proxyOpts = $xeGGWrapper ? $xeGGWrapper.computeProxyOpts : {};
- const hasMerge = !!(mergeBodyList.length || mergeFooterList.length);
- const opts = Object.assign({
- message: true,
- isHeader: showHeader,
- isTitle: showHeader,
- isFooter: showFooter,
- isColgroup: isGroup,
- isMerge: hasMerge,
- useStyle: true,
- current: 'current',
- modes: (proxyOpts.ajax && proxyOpts.ajax.queryAll ? ['all'] : []).concat(['current', 'selected', 'empty']),
- download: true,
- type: 'csv'
- // filename: '',
- // sheetName: '',
- // original: false,
- // isAllExpand: false,
- // data: null,
- // remote: false,
- // dataFilterMethod: null,
- // footerFilterMethod: null,
- // exportMethod: null,
- // columnFilterMethod: null,
- // beforeExportMethod: null,
- // afterExportMethod: null
- }, exportOpts, options);
- let {
- filename,
- sheetName,
- type,
- mode,
- columns,
- original,
- columnFilterMethod,
- beforeExportMethod,
- includeFields,
- excludeFields
- } = opts;
- let groups = [];
- const selectRecords = $xeTable.getCheckboxRecords();
- if (!mode) {
- mode = selectRecords.length ? 'selected' : 'current';
- }
- let isCustomCol = false;
- let customCols = [];
- if (columns && columns.length) {
- isCustomCol = true;
- customCols = columns;
- } else {
- customCols = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().searchTree(collectColumn, column => {
- const isColGroup = column.children && column.children.length > 0;
- let isChecked = false;
- if (columns && columns.length) {
- isChecked = handleFilterColumns(opts, column, columns);
- } else if (excludeFields || includeFields) {
- isChecked = handleFilterFields(opts, column, includeFields, excludeFields);
- } else {
- isChecked = column.visible && (isColGroup || defaultFilterExportColumn(column));
- }
- return isChecked;
- }, {
- children: 'children',
- mapChildren: 'childNodes',
- original: true
- });
- }
- const handleOptions = Object.assign({}, opts, {
- filename: '',
- sheetName: ''
- });
- // 如果设置源数据,则默认导出设置了字段的列
- if (!isCustomCol && !columnFilterMethod) {
- columnFilterMethod = ({
- column
- }) => {
- if (excludeFields) {
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().includes(excludeFields, column.field)) {
- return false;
- }
- }
- if (includeFields) {
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().includes(includeFields, column.field)) {
- return true;
- }
- return false;
- }
- return original ? !!column.field : defaultFilterExportColumn(column);
- };
- handleOptions.columnFilterMethod = columnFilterMethod;
- }
- if (customCols) {
- handleOptions._isCustomColumn = true;
- 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 => {
- let targetColumn;
- if (item) {
- if (isColumnInfo(item)) {
- targetColumn = item;
- } else if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(item)) {
- targetColumn = $xeTable.getColumnByField(item);
- } else {
- const colid = item.id || item.colId;
- const type = item.type;
- const field = item.field;
- if (colid) {
- targetColumn = $xeTable.getColumnById(colid);
- } else if (field && type) {
- targetColumn = tableFullColumn.find(column => column.field === field && column.type === type);
- } else if (field) {
- targetColumn = $xeTable.getColumnByField(field);
- } else if (type) {
- targetColumn = tableFullColumn.find(column => column.type === type);
- }
- }
- return targetColumn || {};
- }
- }, {
- children: 'childNodes',
- mapChildren: '_children'
- }), (column, index) => isColumnInfo(column) && (!columnFilterMethod || columnFilterMethod({
- $table: $xeTable,
- $grid: $xeGrid,
- $gantt: $xeGantt,
- column: column,
- $columnIndex: index
- })), {
- children: '_children',
- mapChildren: 'childNodes',
- original: true
- });
- } else {
- groups = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().searchTree(isGroup ? collectColumn : tableFullColumn, (column, index) => column.visible && (!columnFilterMethod || columnFilterMethod({
- $table: $xeTable,
- $grid: $xeGrid,
- $gantt: $xeGantt,
- column,
- $columnIndex: index
- })), {
- children: 'children',
- mapChildren: 'childNodes',
- original: true
- });
- }
- // 获取所有列
- const cols = [];
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(groups, column => {
- const isColGroup = column.children && column.children.length;
- if (!isColGroup) {
- cols.push(column);
- }
- }, {
- children: 'childNodes'
- });
- // 构建分组层级
- handleOptions.columns = cols;
- handleOptions.colgroups = convertToRows(groups);
- if (filename) {
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(filename)) {
- handleOptions.filename = filename({
- options: opts,
- $table: $xeTable,
- $grid: $xeGrid,
- $gantt: $xeGantt
- });
- } else {
- handleOptions.filename = `${filename}`;
- }
- }
- if (!handleOptions.filename) {
- 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')]);
- }
- if (sheetName) {
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(sheetName)) {
- handleOptions.sheetName = sheetName({
- options: opts,
- $table: $xeTable,
- $grid: $xeGrid,
- $gantt: $xeGantt
- });
- } else {
- handleOptions.sheetName = `${sheetName}`;
- }
- }
- if (!handleOptions.sheetName) {
- handleOptions.sheetName = document.title || '';
- }
- // 检查类型,如果为自定义导出,则不需要校验类型
- 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)) {
- errLog('vxe.error.notType', [type]);
- if (['xlsx', 'pdf'].includes(type)) {
- warnLog('vxe.error.reqPlugin', [4, 'plugin-export-xlsx']);
- }
- const params = {
- status: false
- };
- return Promise.reject(params);
- }
- if (!handleOptions.print) {
- if (beforeExportMethod) {
- beforeExportMethod({
- options: handleOptions,
- $table: $xeTable,
- $grid: $xeGrid,
- $gantt: $xeGantt
- });
- }
- }
- if (!handleOptions.data) {
- handleOptions.data = [];
- if (mode === 'selected') {
- if (['html', 'pdf'].indexOf(type) > -1 && treeConfig) {
- 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, {
- data: '_row'
- }));
- } else {
- handleOptions.data = selectRecords;
- }
- } else if (mode === 'all') {
- if (!$xeGGWrapper) {
- errLog('vxe.error.errProp', ['all', 'mode=current,selected']);
- }
- if ($xeGGWrapper && !handleOptions.remote) {
- const gridReactData = $xeGGWrapper;
- const proxyOpts = $xeGGWrapper.computeProxyOpts;
- const {
- sortData
- } = gridReactData;
- const {
- beforeQueryAll,
- afterQueryAll,
- ajax = {}
- } = proxyOpts;
- const resConfigs = proxyOpts.response || proxyOpts.props || {};
- const ajaxMethods = ajax.queryAll;
- const queryAllSuccessMethods = ajax.queryAllSuccess;
- const queryAllErrorMethods = ajax.queryAllError;
- if (!ajaxMethods) {
- errLog('vxe.error.notFunc', ['proxy-config.ajax.queryAll']);
- }
- if (ajaxMethods) {
- const params = {
- $table: $xeTable,
- $grid: $xeGrid,
- $gantt: $xeGantt,
- sort: sortData.length ? sortData[0] : {},
- sorts: sortData,
- filters: gridReactData.filterData,
- form: gridReactData.formData,
- options: handleOptions
- };
- return Promise.resolve((beforeQueryAll || ajaxMethods)(params)).then(rest => {
- const listProp = resConfigs.list;
- handleOptions.data = (listProp ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(listProp) ? listProp({
- data: rest,
- $table: $xeTable,
- $grid: $xeGrid,
- $gantt: $xeGantt
- }) : external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(rest, listProp) : rest) || [];
- if (afterQueryAll) {
- afterQueryAll(params);
- }
- if (queryAllSuccessMethods) {
- queryAllSuccessMethods({
- ...params,
- response: rest
- });
- }
- return handleExport($xeTable, handleOptions);
- }).catch(rest => {
- if (queryAllErrorMethods) {
- queryAllErrorMethods({
- ...params,
- response: rest
- });
- }
- });
- }
- }
- } else if (mode === 'current') {
- handleOptions.data = treeConfig ? afterTreeFullData : afterFullData;
- }
- } else {
- handleOptions._isCustomData = true;
- }
- return handleExport($xeTable, handleOptions);
- },
- _importByFile(file, options) {
- const $xeTable = this;
- const opts = Object.assign({}, options);
- const {
- beforeImportMethod
- } = opts;
- if (beforeImportMethod) {
- beforeImportMethod({
- options: opts,
- $table: $xeTable
- });
- }
- return handleFileImport($xeTable, file, opts);
- },
- _importData(options) {
- const $xeTable = this;
- const {
- importOpts
- } = this;
- const opts = Object.assign({
- types: external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().keys(importOpts._typeMaps)
- // beforeImportMethod: null,
- // afterImportMethod: null
- }, importOpts, options);
- const {
- beforeImportMethod,
- afterImportMethod
- } = opts;
- if (beforeImportMethod) {
- beforeImportMethod({
- options: opts,
- $table: this
- });
- }
- return core_.VxeUI.readFile(opts).catch(e => {
- if (afterImportMethod) {
- afterImportMethod({
- status: false,
- options: opts,
- $table: $xeTable
- });
- }
- return Promise.reject(e);
- }).then(params => {
- const {
- file
- } = params;
- return handleFileImport($xeTable, file, opts);
- });
- },
- _saveFile(options) {
- return core_.VxeUI.saveFile(options);
- },
- _readFile(options) {
- return core_.VxeUI.readFile(options);
- },
- _print(options) {
- const $xeTable = this;
- const $xeGrid = $xeTable.$xeGrid;
- const $xeGantt = $xeTable.$xeGantt;
- const printOpts = $xeTable.computePrintOpts;
- const opts = Object.assign({
- original: false
- // beforePrintMethod
- }, printOpts, options, {
- type: 'html',
- download: false,
- remote: false,
- print: true
- });
- const {
- sheetName
- } = opts;
- let printTitle = '';
- if (sheetName) {
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(sheetName)) {
- printTitle = sheetName({
- options: opts,
- $table: $xeTable,
- $grid: $xeGrid,
- $gantt: $xeGantt
- });
- } else {
- printTitle = `${sheetName}`;
- }
- }
- if (!printTitle) {
- printTitle = document.title || '';
- }
- const beforePrintMethod = opts.beforePrintMethod;
- const tableHtml = opts.html || opts.content;
- return new Promise((resolve, reject) => {
- if (core_.VxeUI.print) {
- if (tableHtml) {
- resolve(core_.VxeUI.print({
- title: printTitle,
- html: tableHtml,
- customStyle: opts.style,
- beforeMethod: beforePrintMethod ? ({
- html
- }) => {
- return beforePrintMethod({
- html,
- content: html,
- options: opts,
- $table: $xeTable,
- $grid: $xeGrid,
- $gantt: $xeGantt
- });
- } : undefined
- }));
- } else {
- resolve($xeTable.exportData(opts).then(({
- content
- }) => {
- return core_.VxeUI.print({
- title: printTitle,
- html: content,
- customStyle: opts.style,
- beforeMethod: beforePrintMethod ? ({
- html
- }) => {
- return beforePrintMethod({
- html,
- content: html,
- options: opts,
- $table: $xeTable,
- $grid: $xeGrid,
- $gantt: $xeGantt
- });
- } : undefined
- });
- }));
- }
- } else {
- const e = {
- status: false
- };
- reject(e);
- }
- });
- },
- _getPrintHtml(options) {
- const $xeTable = this;
- const printOpts = $xeTable.computePrintOpts;
- const opts = Object.assign({
- original: false
- // beforePrintMethod
- }, printOpts, options, {
- type: 'html',
- download: false,
- remote: false,
- print: true
- });
- return $xeTable.exportData(opts).then(({
- content
- }) => {
- return {
- html: content
- };
- });
- },
- _closeImport() {
- if (core_.VxeUI.modal) {
- return core_.VxeUI.modal.close('VXE_IMPORT_MODAL');
- }
- return Promise.resolve();
- },
- _openImport(options) {
- const $xeTable = this;
- const props = $xeTable;
- const reactData = $xeTable;
- const {
- treeConfig,
- importConfig
- } = props;
- const {
- initStore,
- importStore,
- importParams
- } = reactData;
- const importOpts = $xeTable.computeImportOpts;
- const defOpts = Object.assign({
- mode: 'insertTop',
- message: true,
- types: external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().keys(importOpts._typeMaps),
- modes: ['insertTop', 'covering']
- }, importOpts, options);
- const types = defOpts.types || [];
- const modes = defOpts.modes || [];
- const isTree = !!treeConfig;
- if (isTree) {
- if (defOpts.message) {
- core_.VxeUI.modal.message({
- content: export_mixin_getI18n('vxe.error.treeNotImp'),
- status: 'error'
- });
- }
- return;
- }
- if (!importConfig) {
- errLog('vxe.error.reqProp', ['import-config']);
- }
- // 处理类型
- const typeList = types.map(value => {
- return {
- value,
- label: export_mixin_getI18n(`vxe.export.types.${value}`)
- };
- });
- const modeList = modes.map(item => {
- if (item && item.value) {
- return {
- value: item.value,
- label: item.label || item.value
- };
- }
- return {
- value: item,
- label: export_mixin_getI18n(`vxe.import.modes.${item}`)
- };
- });
- Object.assign(importStore, {
- file: null,
- type: '',
- filename: '',
- modeList,
- typeList,
- visible: true
- });
- Object.assign(importParams, defOpts);
- if (!modeList.some(item => item.value === importParams.mode)) {
- importParams.mode = modeList[0].value;
- }
- initStore.import = true;
- },
- _closeExport: handleCloseExport,
- _openExport(options) {
- const $xeTable = this;
- const props = $xeTable;
- const exportOpts = $xeTable.computeExportOpts;
- const defOpts = Object.assign({
- message: true,
- types: external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().keys(exportOpts._typeMaps)
- }, exportOpts, options);
- if (!props.exportConfig) {
- errLog('vxe.error.reqProp', ['export-config']);
- }
- return handleExportAndPrint($xeTable, defOpts);
- },
- _closePrint: handleCloseExport,
- _openPrint(options) {
- const $xeTable = this;
- const props = $xeTable;
- const printOpts = $xeTable.computePrintOpts;
- const defOpts = Object.assign({
- message: true
- }, printOpts, options);
- if (!props.printConfig) {
- errLog('vxe.error.reqProp', ['print-config']);
- }
- return handleExportAndPrint($xeTable, defOpts, true);
- }
- }
- });
- ;// CONCATENATED MODULE: ./packages/table/module/keyboard/mixin.ts
- function getCheckboxRangeRows($xeTable, evnt, params, targetTrElem, trRect, offsetClientTop, moveRange) {
- const props = $xeTable;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- showOverflow
- } = props;
- const {
- fullAllDataRowIdData,
- isResizeCellHeight
- } = internalData;
- const rowOpts = $xeTable.computeRowOpts;
- const cellOpts = $xeTable.computeCellOpts;
- const defaultRowHeight = $xeTable.computeDefaultRowHeight;
- const {
- row
- } = params;
- let countHeight = 0;
- let rangeRows = [];
- let moveSize = 0;
- const isDown = moveRange > 0;
- const {
- scrollYLoad
- } = reactData;
- const {
- afterFullData
- } = internalData;
- if (isDown) {
- moveSize = offsetClientTop + moveRange;
- } else {
- moveSize = trRect.height - offsetClientTop + Math.abs(moveRange);
- }
- if (scrollYLoad) {
- const _rowIndex = $xeTable.getVTRowIndex(row);
- const isCustomCellHeight = isResizeCellHeight || cellOpts.height || rowOpts.height;
- if (!isCustomCellHeight && showOverflow) {
- if (isDown) {
- rangeRows = afterFullData.slice(_rowIndex, _rowIndex + Math.ceil(moveSize / defaultRowHeight));
- } else {
- rangeRows = afterFullData.slice(_rowIndex - Math.floor(moveSize / defaultRowHeight), _rowIndex + 1);
- }
- } else {
- if (isDown) {
- for (let i = _rowIndex; i < afterFullData.length; i++) {
- const item = afterFullData[i];
- const rowid = $xeTable.getRowid(item);
- const rowRest = fullAllDataRowIdData[rowid] || {};
- countHeight += rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight;
- rangeRows.push(item);
- if (countHeight > moveSize) {
- return rangeRows;
- }
- }
- } else {
- for (let len = _rowIndex; len >= 0; len--) {
- const item = afterFullData[len];
- const rowid = $xeTable.getRowid(item);
- const rowRest = fullAllDataRowIdData[rowid] || {};
- countHeight += rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight;
- rangeRows.push(item);
- if (countHeight > moveSize) {
- return rangeRows;
- }
- }
- }
- }
- } else {
- const siblingProp = isDown ? 'next' : 'previous';
- while (targetTrElem && countHeight < moveSize) {
- const rowNodeRest = $xeTable.getRowNode(targetTrElem);
- if (rowNodeRest) {
- rangeRows.push(rowNodeRest.item);
- countHeight += targetTrElem.offsetHeight;
- targetTrElem = targetTrElem[`${siblingProp}ElementSibling`];
- }
- }
- }
- return rangeRows;
- }
- function handleMoveSelected($xeTable, evnt, args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow) {
- const internalData = $xeTable;
- const {
- afterFullData,
- visibleColumn
- } = internalData;
- const params = Object.assign({}, args);
- const _rowIndex = $xeTable.getVTRowIndex(params.row);
- const _columnIndex = $xeTable.getVTColumnIndex(params.column);
- evnt.preventDefault();
- if (isUpArrow && _rowIndex > 0) {
- // 移动到上一行
- params.rowIndex = _rowIndex - 1;
- params.row = afterFullData[params.rowIndex];
- } else if (isDwArrow && _rowIndex < afterFullData.length - 1) {
- // 移动到下一行
- params.rowIndex = _rowIndex + 1;
- params.row = afterFullData[params.rowIndex];
- } else if (isLeftArrow && _columnIndex) {
- // 移动到左侧单元格
- params.columnIndex = _columnIndex - 1;
- params.column = visibleColumn[params.columnIndex];
- } else if (isRightArrow && _columnIndex < visibleColumn.length - 1) {
- // 移动到右侧单元格
- params.columnIndex = _columnIndex + 1;
- params.column = visibleColumn[params.columnIndex];
- }
- $xeTable.scrollToRow(params.row, params.column).then(() => {
- params.cell = $xeTable.getCellElement(params.row, params.column);
- $xeTable.handleSelected(params, evnt);
- });
- return params;
- }
- function handleCheckboxRangeEvent($xeTable, evnt, params) {
- const internalData = $xeTable;
- const {
- elemStore
- } = internalData;
- const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
- const leftScrollElem = getRefElem(elemStore['left-body-scroll']);
- const rightScrollElem = getRefElem(elemStore['right-body-scroll']);
- const {
- column,
- cell
- } = params;
- if (column.type === 'checkbox') {
- let bodyWrapperElem = bodyScrollElem;
- if (leftScrollElem && column.fixed === 'left') {
- bodyWrapperElem = leftScrollElem;
- } else if (rightScrollElem && column.fixed === 'right') {
- bodyWrapperElem = rightScrollElem;
- }
- if (!bodyWrapperElem) {
- return;
- }
- const bodyRect = bodyWrapperElem.getBoundingClientRect();
- const el = $xeTable.$refs.refElem;
- const disX = evnt.clientX;
- const disY = evnt.clientY;
- const checkboxRangeElem = bodyWrapperElem.querySelector('.vxe-table--checkbox-range');
- const trElem = cell.parentNode;
- const selectRecords = $xeTable.getCheckboxRecords();
- let lastRangeRows = [];
- const marginSize = 1;
- const startTop = evnt.clientY - bodyRect.y + bodyWrapperElem.scrollTop;
- const startLeft = evnt.clientX - bodyRect.x + bodyWrapperElem.scrollLeft;
- const startScrollTop = bodyWrapperElem.scrollTop;
- const rowHeight = trElem.offsetHeight;
- const trRect = trElem.getBoundingClientRect();
- const offsetClientTop = disY - trRect.y;
- let mouseScrollTimeout = null;
- let isMouseScrollDown = false;
- let mouseScrollSpaceSize = 1;
- const triggerEvent = (type, evnt) => {
- $xeTable.dispatchEvent(`checkbox-range-${type}`, {
- records: () => $xeTable.getCheckboxRecords(),
- reserves: () => $xeTable.getCheckboxReserveRecords()
- }, evnt);
- };
- const handleChecked = evnt => {
- const {
- clientX,
- clientY
- } = evnt;
- const offsetLeft = clientX - disX;
- const offsetTop = clientY - disY + (bodyWrapperElem.scrollTop - startScrollTop);
- let rangeHeight = Math.abs(offsetTop);
- let rangeWidth = Math.abs(offsetLeft);
- let rangeTop = startTop;
- let rangeLeft = startLeft;
- if (offsetTop < marginSize) {
- // 向上
- rangeTop += offsetTop;
- if (rangeTop < marginSize) {
- rangeTop = marginSize;
- rangeHeight = startTop;
- }
- } else {
- // 向下
- rangeHeight = Math.min(rangeHeight, bodyWrapperElem.scrollHeight - startTop - marginSize);
- }
- if (offsetLeft < marginSize) {
- // 向左
- rangeLeft += offsetLeft;
- if (rangeWidth > startLeft) {
- rangeLeft = marginSize;
- rangeWidth = startLeft;
- }
- } else {
- // 向右
- rangeWidth = Math.min(rangeWidth, bodyWrapperElem.clientWidth - startLeft - marginSize);
- }
- checkboxRangeElem.style.height = `${rangeHeight}px`;
- checkboxRangeElem.style.width = `${rangeWidth}px`;
- checkboxRangeElem.style.left = `${rangeLeft}px`;
- checkboxRangeElem.style.top = `${rangeTop}px`;
- checkboxRangeElem.style.display = 'block';
- const rangeRows = getCheckboxRangeRows($xeTable, evnt, params, trElem, trRect, offsetClientTop, offsetTop < marginSize ? -rangeHeight : rangeHeight);
- // 至少滑动 10px 才能有效匹配
- if (rangeHeight > 10 && rangeRows.length !== lastRangeRows.length) {
- const isControlKey = hasControlKey(evnt);
- lastRangeRows = rangeRows;
- if (isControlKey) {
- rangeRows.forEach(row => {
- $xeTable.handleBatchSelectRows([row], selectRecords.indexOf(row) === -1);
- });
- } else {
- $xeTable.setAllCheckboxRow(false);
- $xeTable.handleCheckedCheckboxRow(rangeRows, true, false);
- }
- triggerEvent('change', evnt);
- }
- };
- // 停止鼠标滚动
- const stopMouseScroll = () => {
- clearTimeout(mouseScrollTimeout);
- mouseScrollTimeout = null;
- };
- // 开始鼠标滚动
- const startMouseScroll = evnt => {
- stopMouseScroll();
- mouseScrollTimeout = setTimeout(() => {
- if (mouseScrollTimeout) {
- const {
- scrollLeft,
- scrollTop,
- clientHeight,
- scrollHeight
- } = bodyWrapperElem;
- const topSize = Math.ceil(mouseScrollSpaceSize * 50 / rowHeight);
- if (isMouseScrollDown) {
- if (scrollTop + clientHeight < scrollHeight) {
- $xeTable.scrollTo(scrollLeft, scrollTop + topSize);
- startMouseScroll(evnt);
- handleChecked(evnt);
- } else {
- stopMouseScroll();
- }
- } else {
- if (scrollTop) {
- $xeTable.scrollTo(scrollLeft, scrollTop - topSize);
- startMouseScroll(evnt);
- handleChecked(evnt);
- } else {
- stopMouseScroll();
- }
- }
- }
- }, 50);
- };
- addClass(el, 'drag--range');
- document.onmousemove = evnt => {
- evnt.preventDefault();
- evnt.stopPropagation();
- const {
- clientY
- } = evnt;
- const {
- boundingTop
- } = getAbsolutePos(bodyWrapperElem);
- // 如果超过可视区,触发滚动
- if (clientY < boundingTop) {
- isMouseScrollDown = false;
- mouseScrollSpaceSize = boundingTop - clientY;
- if (!mouseScrollTimeout) {
- startMouseScroll(evnt);
- }
- } else if (clientY > boundingTop + bodyWrapperElem.clientHeight) {
- isMouseScrollDown = true;
- mouseScrollSpaceSize = clientY - boundingTop - bodyWrapperElem.clientHeight;
- if (!mouseScrollTimeout) {
- startMouseScroll(evnt);
- }
- } else if (mouseScrollTimeout) {
- stopMouseScroll();
- }
- handleChecked(evnt);
- };
- document.onmouseup = evnt => {
- stopMouseScroll();
- removeClass(el, 'drag--range');
- checkboxRangeElem.removeAttribute('style');
- document.onmousemove = null;
- document.onmouseup = null;
- triggerEvent('end', evnt);
- };
- triggerEvent('start', evnt);
- }
- }
- /* harmony default export */ var keyboard_mixin = ({
- methods: {
- // 处理 Tab 键移动
- moveTabSelected(args, isLeft, evnt) {
- const $xeTable = this;
- const props = $xeTable;
- const internalData = $xeTable;
- const {
- editConfig
- } = props;
- const {
- afterFullData,
- visibleColumn
- } = internalData;
- const editOpts = $xeTable.computeEditOpts;
- const rowOpts = $xeTable.computeRowOpts;
- const currentRowOpts = $xeTable.computeCurrentRowOpts;
- const columnOpts = $xeTable.computeColumnOpts;
- const currentColumnOpts = $xeTable.computeCurrentColumnOpts;
- let targetRow;
- let targetRowIndex;
- let targetColumnIndex;
- const params = Object.assign({}, args);
- const _rowIndex = $xeTable.getVTRowIndex(params.row);
- const _columnIndex = $xeTable.getVTColumnIndex(params.column);
- evnt.preventDefault();
- if (isLeft) {
- // 向左
- if (_columnIndex <= 0) {
- // 如果已经是第一列,则移动到上一行
- if (_rowIndex > 0) {
- targetRowIndex = _rowIndex - 1;
- targetRow = afterFullData[targetRowIndex];
- targetColumnIndex = visibleColumn.length - 1;
- }
- } else {
- targetColumnIndex = _columnIndex - 1;
- }
- } else {
- if (_columnIndex >= visibleColumn.length - 1) {
- // 如果已经是第一列,则移动到上一行
- if (_rowIndex < afterFullData.length - 1) {
- targetRowIndex = _rowIndex + 1;
- targetRow = afterFullData[targetRowIndex];
- targetColumnIndex = 0;
- }
- } else {
- targetColumnIndex = _columnIndex + 1;
- }
- }
- const targetColumn = visibleColumn[targetColumnIndex];
- if (targetColumn) {
- if (targetRow) {
- params.rowIndex = targetRowIndex;
- params.row = targetRow;
- } else {
- params.rowIndex = _rowIndex;
- }
- params.columnIndex = targetColumnIndex;
- params.column = targetColumn;
- params.cell = $xeTable.getCellElement(params.row, params.column);
- if (rowOpts.isCurrent && currentRowOpts.isFollowSelected) {
- $xeTable.triggerCurrentRowEvent(evnt, params);
- }
- if (columnOpts.isCurrent && currentColumnOpts.isFollowSelected) {
- $xeTable.triggerCurrentColumnEvent(evnt, params);
- }
- if (editConfig) {
- if (editOpts.trigger === 'click' || editOpts.trigger === 'dblclick') {
- if (editOpts.mode === 'row') {
- $xeTable.handleEdit(params, evnt);
- } else {
- $xeTable.scrollToRow(params.row, params.column).then(() => {
- $xeTable.handleSelected(params, evnt);
- });
- }
- }
- } else {
- $xeTable.scrollToRow(params.row, params.column).then(() => {
- $xeTable.handleSelected(params, evnt);
- });
- }
- }
- },
- // 处理当前行方向键移动
- moveCurrentRow(isUpArrow, isDwArrow, evnt) {
- const $xeTable = this;
- const props = $xeTable;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- treeConfig
- } = props;
- const {
- currentRow
- } = reactData;
- const {
- afterFullData
- } = internalData;
- const treeOpts = $xeTable.computeTreeOpts;
- const childrenField = treeOpts.children || treeOpts.childrenField;
- let targetRow;
- if (currentRow) {
- if (treeConfig) {
- const {
- index,
- items
- } = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findTree(afterFullData, item => item === currentRow, {
- children: childrenField
- });
- if (isUpArrow && index > 0) {
- targetRow = items[index - 1];
- } else if (isDwArrow && index < items.length - 1) {
- targetRow = items[index + 1];
- }
- } else {
- const _rowIndex = $xeTable.getVTRowIndex(currentRow);
- if (isUpArrow && _rowIndex > 0) {
- targetRow = afterFullData[_rowIndex - 1];
- } else if (isDwArrow && _rowIndex < afterFullData.length - 1) {
- targetRow = afterFullData[_rowIndex + 1];
- }
- }
- } else {
- targetRow = afterFullData[0];
- }
- if (targetRow) {
- evnt.preventDefault();
- const params = {
- $table: $xeTable,
- row: targetRow,
- rowIndex: $xeTable.getRowIndex(targetRow),
- $rowIndex: $xeTable.getVMRowIndex(targetRow)
- };
- $xeTable.scrollToRow(targetRow).then(() => $xeTable.triggerCurrentRowEvent(evnt, params));
- }
- },
- // 处理当前列方向键移动
- moveCurrentColumn(isLeftArrow, isRightArrow, evnt) {
- const $xeTable = this;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- currentColumn
- } = reactData;
- const {
- visibleColumn
- } = internalData;
- let targetCol = null;
- if (currentColumn) {
- const _columnIndex = $xeTable.getVTColumnIndex(currentColumn);
- if (isLeftArrow && _columnIndex > 0) {
- targetCol = visibleColumn[_columnIndex - 1];
- } else if (isRightArrow && _columnIndex < visibleColumn.length - 1) {
- targetCol = visibleColumn[_columnIndex + 1];
- }
- } else {
- targetCol = visibleColumn[0];
- }
- if (targetCol) {
- evnt.preventDefault();
- const params = {
- $table: $xeTable,
- column: targetCol,
- columnIndex: $xeTable.getColumnIndex(targetCol),
- $columnIndex: $xeTable.getVMColumnIndex(targetCol)
- };
- $xeTable.scrollToColumn(targetCol).then(() => $xeTable.triggerCurrentColumnEvent(evnt, params));
- }
- },
- // 处理可编辑方向键移动
- moveArrowSelected(args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow, evnt) {
- const $xeTable = this;
- const props = $xeTable;
- const {
- highlightCurrentRow,
- highlightCurrentColumn
- } = props;
- const rowOpts = $xeTable.computeRowOpts;
- const currentRowOpts = $xeTable.computeCurrentRowOpts;
- const columnOpts = $xeTable.computeColumnOpts;
- const currentColumnOpts = $xeTable.computeCurrentColumnOpts;
- const params = handleMoveSelected($xeTable, evnt, args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow);
- if (rowOpts.isCurrent || highlightCurrentRow) {
- if (currentRowOpts.isFollowSelected) {
- $xeTable.triggerCurrentRowEvent(evnt, params);
- } else {
- // 当前行按键上下移动
- if ((isUpArrow || isDwArrow) && (rowOpts.isCurrent || highlightCurrentRow)) {
- $xeTable.moveCurrentRow(isUpArrow, isDwArrow, evnt);
- }
- }
- }
- if (columnOpts.isCurrent || highlightCurrentColumn) {
- if (currentColumnOpts.isFollowSelected) {
- $xeTable.triggerCurrentColumnEvent(evnt, params);
- } else {
- // 当前行按键左右移动
- if ((isLeftArrow || isRightArrow) && (columnOpts.isCurrent || highlightCurrentColumn)) {
- $xeTable.moveCurrentColumn(isLeftArrow, isRightArrow, evnt);
- }
- }
- }
- },
- moveEnterSelected(args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow, evnt) {
- const $xeTable = this;
- const props = $xeTable;
- const {
- highlightCurrentRow,
- highlightCurrentColumn
- } = props;
- const rowOpts = $xeTable.computeRowOpts;
- const currentRowOpts = $xeTable.computeCurrentRowOpts;
- const columnOpts = $xeTable.computeColumnOpts;
- const currentColumnOpts = $xeTable.computeCurrentColumnOpts;
- const params = handleMoveSelected($xeTable, evnt, args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow);
- if ((rowOpts.isCurrent || highlightCurrentRow) && currentRowOpts.isFollowSelected) {
- $xeTable.triggerCurrentRowEvent(evnt, params);
- }
- if ((columnOpts.isCurrent || highlightCurrentColumn) && currentColumnOpts.isFollowSelected) {
- $xeTable.triggerCurrentColumnEvent(evnt, params);
- }
- },
- // 处理可编辑方向键移动
- moveSelected(args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow, evnt) {
- const $xeTable = this;
- handleMoveSelected($xeTable, evnt, args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow);
- },
- handleCellMousedownEvent(evnt, params) {
- const $xeTable = this;
- const props = $xeTable;
- const {
- editConfig,
- checkboxConfig,
- mouseConfig
- } = props;
- const checkboxOpts = $xeTable.computeCheckboxOpts;
- const mouseOpts = $xeTable.computeMouseOpts;
- const editOpts = $xeTable.computeEditOpts;
- if (mouseConfig && mouseOpts.area && $xeTable.triggerCellAreaModnEvent) {
- return $xeTable.triggerCellAreaModnEvent(evnt, params);
- } else {
- if (checkboxConfig && checkboxOpts.range) {
- handleCheckboxRangeEvent($xeTable, evnt, params);
- }
- if (mouseConfig && mouseOpts.selected) {
- if (!editConfig || editOpts.mode === 'cell') {
- $xeTable.handleSelected(params, evnt);
- }
- }
- }
- }
- }
- });
- ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/typeof.js
- function _typeof(o) {
- "@babel/helpers - typeof";
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
- return typeof o;
- } : function (o) {
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
- }, _typeof(o);
- }
- ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toPrimitive.js
- function toPrimitive(t, r) {
- if ("object" != _typeof(t) || !t) return t;
- var e = t[Symbol.toPrimitive];
- if (void 0 !== e) {
- var i = e.call(t, r || "default");
- if ("object" != _typeof(i)) return i;
- throw new TypeError("@@toPrimitive must return a primitive value.");
- }
- return ("string" === r ? String : Number)(t);
- }
- ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
- function toPropertyKey(t) {
- var i = toPrimitive(t, "string");
- return "symbol" == _typeof(i) ? i : i + "";
- }
- ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
- function _defineProperty(e, r, t) {
- return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
- value: t,
- enumerable: !0,
- configurable: !0,
- writable: !0
- }) : e[r] = t, e;
- }
- ;// CONCATENATED MODULE: ./packages/table/module/validator/mixin.ts
- const {
- getConfig: validator_mixin_getConfig,
- validators: mixin_validators
- } = core_.VxeUI;
- /**
- * 校验规则
- */
- class Rule {
- constructor(rule) {
- _defineProperty(this, "$options", void 0);
- Object.assign(this, {
- $options: rule,
- required: rule.required,
- min: rule.min,
- max: rule.max,
- type: rule.type,
- pattern: rule.pattern,
- validator: rule.validator,
- trigger: rule.trigger,
- maxWidth: rule.maxWidth
- });
- }
- /**
- * 获取校验不通过的消息
- * 支持国际化翻译
- */
- get content() {
- return getFuncText(this.$options.content || this.$options.message);
- }
- get message() {
- return this.content;
- }
- }
- // 如果存在 pattern,判断正则
- function validREValue(pattern, val) {
- if (pattern && !(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isRegExp(pattern) ? pattern : new RegExp(pattern)).test(val)) {
- return false;
- }
- return true;
- }
- // 如果存在 max,判断最大值
- function validMaxValue(max, num) {
- 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)) {
- return false;
- }
- return true;
- }
- // 如果存在 min,判断最小值
- function validMinValue(min, num) {
- 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)) {
- return false;
- }
- return true;
- }
- function validRuleValue(rule, val, required) {
- const {
- type,
- min,
- max,
- pattern
- } = rule;
- const isArrType = type === 'array';
- const isNumType = type === 'number';
- const isStrType = type === 'string';
- const strVal = `${val}`;
- if (!validREValue(pattern, strVal)) {
- return false;
- }
- if (isArrType) {
- if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(val)) {
- return false;
- }
- if (required) {
- if (!val.length) {
- return false;
- }
- }
- if (!validMinValue(min, val.length)) {
- return false;
- }
- if (!validMaxValue(max, val.length)) {
- return false;
- }
- } else if (isNumType) {
- const numVal = Number(val);
- if (isNaN(numVal)) {
- return false;
- }
- if (!validMinValue(min, numVal)) {
- return false;
- }
- if (!validMaxValue(max, numVal)) {
- return false;
- }
- } else {
- if (isStrType) {
- if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(val)) {
- return false;
- }
- }
- if (required) {
- if (!strVal) {
- return false;
- }
- }
- if (!validMinValue(min, strVal.length)) {
- return false;
- }
- if (!validMaxValue(max, strVal.length)) {
- return false;
- }
- }
- return true;
- }
- function checkRuleStatus(rule, val) {
- const {
- required
- } = rule;
- const isEmptyVal = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(val) ? !val.length : eqEmptyValue(val);
- if (required) {
- if (isEmptyVal) {
- return false;
- }
- if (!validRuleValue(rule, val, required)) {
- return false;
- }
- } else {
- if (!isEmptyVal) {
- if (!validRuleValue(rule, val, required)) {
- return false;
- }
- }
- }
- return true;
- }
- /* harmony default export */ var validator_mixin = ({
- methods: {
- /**
- * 完整校验,和 validate 的区别就是会给有效数据中的每一行进行校验
- */
- _fullValidate(rows, cb) {
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(cb)) {
- warnLog('vxe.error.notValidators', ['fullValidate(rows, callback)', 'fullValidate(rows)']);
- }
- return this.beginValidate(rows, null, cb, true);
- },
- /**
- * 快速校验,如果存在记录不通过的记录,则返回不再继续校验(异步校验除外)
- */
- _validate(rows, cb) {
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(cb)) {
- warnLog('vxe.error.notValidators', ['validate(rows, callback)', 'validate(rows)']);
- }
- return this.beginValidate(rows, null, cb);
- },
- /**
- * 完整校验单元格,和 validateField 的区别就是会给有效数据中的每一行进行校验
- */
- _fullValidateField(rows, fieldOrColumn) {
- 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));
- if (colList.length) {
- return this.beginValidate(rows, colList, null, true);
- }
- return this.$nextTick();
- },
- /**
- * 快速校验单元格,如果存在记录不通过的记录,则返回不再继续校验(异步校验除外)
- */
- _validateField(rows, fieldOrColumn) {
- 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));
- if (colList.length) {
- return this.beginValidate(rows, colList, null);
- }
- return this.$nextTick();
- },
- /**
- * 聚焦到校验通过的单元格并弹出校验错误提示
- */
- handleValidError(params) {
- const $xeTable = this;
- const {
- validOpts
- } = this;
- return new Promise(resolve => {
- if (validOpts.autoPos === false) {
- $xeTable.dispatchEvent('valid-error', params, null);
- resolve();
- } else {
- this.handleEdit(params, {
- type: 'valid-error',
- trigger: 'call'
- }).then(() => {
- setTimeout(() => {
- resolve(this.showValidTooltip(params));
- }, 10);
- });
- }
- });
- },
- handleErrMsgMode(validErrMaps) {
- const {
- validOpts
- } = this;
- if (validOpts.msgMode === 'single') {
- const keys = Object.keys(validErrMaps);
- const resMaps = {};
- if (keys.length) {
- const firstKey = keys[0];
- resMaps[firstKey] = validErrMaps[firstKey];
- }
- return resMaps;
- }
- return validErrMaps;
- },
- /**
- * 对表格数据进行校验
- * 如果不指定数据,则默认只校验临时变动的数据,例如新增或修改
- * 如果传 true 则校验当前表格数据
- * 如果传 row 指定行记录,则只验证传入的行
- * 如果传 rows 为多行记录,则只验证传入的行
- * 如果只传 callback 否则默认验证整个表格数据
- * 返回 Promise 对象,或者使用回调方式
- */
- beginValidate(rows, cols, cb, isFull) {
- const $xeTable = this;
- const props = $xeTable;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const validRest = {};
- const {
- editRules,
- treeConfig
- } = props;
- const {
- isRowGroupStatus
- } = reactData;
- const {
- afterFullData,
- pendingRowMaps,
- removeRowMaps
- } = internalData;
- const treeOpts = $xeTable.computeTreeOpts;
- const aggregateOpts = $xeTable.computeAggregateOpts;
- let validList;
- if (rows === true) {
- validList = afterFullData;
- } else if (rows) {
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(rows)) {
- cb = rows;
- } else {
- validList = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(rows) ? rows : [rows];
- }
- }
- if (!validList) {
- validList = this.getInsertRecords().concat(this.getUpdateRecords());
- }
- const rowValidErrs = [];
- this.lastCallTime = Date.now();
- this.validRuleErr = false; // 如果为快速校验,当存在某列校验不通过时将终止执行
- this.clearValidate();
- const validErrMaps = {};
- if (editRules) {
- const columns = cols && cols.length ? cols : this.getColumns();
- const handleVaild = row => {
- const rowid = getRowid($xeTable, row);
- // 是否删除
- if (removeRowMaps[rowid]) {
- return;
- }
- // 是否标记删除
- if (pendingRowMaps[rowid]) {
- return;
- }
- if ($xeTable.isAggregateRecord(row)) {
- return;
- }
- if (isFull || !this.validRuleErr) {
- const colVailds = [];
- columns.forEach(column => {
- const field = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(column) ? column : column.field;
- if ((isFull || !this.validRuleErr) && external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().has(editRules, field)) {
- colVailds.push(this.validCellRules('all', row, column).catch(({
- rule,
- rules
- }) => {
- const rest = {
- rule,
- rules,
- rowIndex: this.getRowIndex(row),
- row,
- columnIndex: this.getColumnIndex(column),
- column,
- field,
- $table: this
- };
- if (!validRest[field]) {
- validRest[field] = [];
- }
- validErrMaps[`${getRowid(this, row)}:${column.id}`] = {
- column,
- row,
- rule,
- content: rule.content
- };
- validRest[field].push(rest);
- if (!isFull) {
- this.validRuleErr = true;
- return Promise.reject(rest);
- }
- }));
- }
- });
- rowValidErrs.push(Promise.all(colVailds));
- }
- };
- if (isRowGroupStatus) {
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(validList, handleVaild, {
- children: aggregateOpts.mapChildrenField
- });
- } else if (treeConfig) {
- const childrenField = treeOpts.children || treeOpts.childrenField;
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(validList, handleVaild, {
- children: childrenField
- });
- } else {
- validList.forEach(handleVaild);
- }
- return Promise.all(rowValidErrs).then(() => {
- const ruleProps = Object.keys(validRest);
- this.validErrorMaps = this.handleErrMsgMode(validErrMaps);
- return this.$nextTick().then(() => {
- if (ruleProps.length) {
- return Promise.reject(validRest[ruleProps[0]][0]);
- }
- if (cb) {
- cb();
- }
- });
- }).catch(firstErrParams => {
- return new Promise((resolve, reject) => {
- const finish = () => {
- this.$nextTick(() => {
- if (cb) {
- cb(validRest);
- resolve();
- } else {
- if (validator_mixin_getConfig().validToReject === 'obsolete') {
- // 已废弃,校验失败将不会执行catch
- reject(validRest);
- } else {
- resolve(validRest);
- }
- }
- });
- };
- const posAndFinish = () => {
- firstErrParams.cell = this.getCellElement(firstErrParams.row, firstErrParams.column);
- scrollToView(firstErrParams.cell);
- this.handleValidError(firstErrParams).then(finish);
- };
- /**
- * 当校验不通过时
- * 将表格滚动到可视区
- * 由于提示信息至少需要占一行,定位向上偏移一行
- */
- if (this.validOpts.autoPos === false) {
- finish();
- } else {
- const row = firstErrParams.row;
- const column = firstErrParams.column;
- this.scrollToRow(row, column).then(posAndFinish);
- }
- });
- });
- } else {
- this.validErrorMaps = {};
- }
- return this.$nextTick().then(() => {
- if (cb) {
- cb();
- }
- });
- },
- hasCellRules(type, row, column) {
- const {
- editRules
- } = this;
- const {
- property
- } = column;
- if (property && editRules) {
- const rules = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(editRules, property);
- 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);
- }
- return false;
- },
- /**
- * 校验数据
- * 按表格行、列顺序依次校验(同步或异步)
- * 校验规则根据索引顺序依次校验,如果是异步则会等待校验完成才会继续校验下一列
- * 如果校验失败则,触发回调或者Promise<不通过列的错误消息>
- * 如果是传回调方式这返回一个校验不通过列的错误消息
- *
- * rule 配置:
- * required=Boolean 是否必填
- * min=Number 最小长度
- * max=Number 最大长度
- * validator=Function({ cellValue, rule, rules, row, column, rowIndex, columnIndex }) 自定义校验,接收一个 Promise
- * trigger=blur|change 触发方式(除非特殊场景,否则默认为空就行)
- */
- validCellRules(validType, row, column, val) {
- const {
- editRules
- } = this;
- const {
- property
- } = column;
- const errorRules = [];
- const syncValidList = [];
- if (property && editRules) {
- const rules = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(editRules, property);
- if (rules) {
- 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;
- rules.forEach(rule => {
- const {
- trigger,
- validator
- } = rule;
- if (validType === 'all' || !trigger || validType === trigger) {
- if (validator) {
- const validParams = {
- cellValue,
- rule,
- rules,
- row,
- rowIndex: this.getRowIndex(row),
- column,
- columnIndex: this.getColumnIndex(column),
- field: column.property,
- $table: this
- };
- let customValid;
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(validator)) {
- const gvItem = mixin_validators.get(validator);
- if (gvItem) {
- const tcvMethod = gvItem.tableCellValidatorMethod || gvItem.cellValidatorMethod;
- if (tcvMethod) {
- customValid = tcvMethod(validParams);
- } else {
- errLog('vxe.error.notValidators', [validator]);
- }
- } else {
- errLog('vxe.error.notValidators', [validator]);
- }
- } else {
- customValid = validator(validParams);
- }
- if (customValid) {
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isError(customValid)) {
- this.validRuleErr = true;
- errorRules.push(new Rule({
- type: 'custom',
- trigger,
- content: customValid.message,
- rule: new Rule(rule)
- }));
- } else if (customValid.catch) {
- // 如果为异步校验(注:异步校验是并发无序的)
- syncValidList.push(customValid.catch(e => {
- this.validRuleErr = true;
- errorRules.push(new Rule({
- type: 'custom',
- trigger,
- content: e && e.message ? e.message : rule.content || rule.message,
- rule: new Rule(rule)
- }));
- }));
- }
- }
- } else {
- if (!checkRuleStatus(rule, cellValue)) {
- this.validRuleErr = true;
- errorRules.push(new Rule(rule));
- }
- }
- }
- });
- }
- }
- return Promise.all(syncValidList).then(() => {
- if (errorRules.length) {
- const rest = {
- rules: errorRules,
- rule: errorRules[0]
- };
- return Promise.reject(rest);
- }
- });
- },
- _clearValidate(rows, fieldOrColumn) {
- const {
- validOpts,
- validErrorMaps
- } = this;
- const validTip = this.$refs.refValidTooltip;
- const rowList = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(rows) ? rows : rows ? [rows] : [];
- 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));
- let validErrMaps = {};
- if (validTip && validTip.visible) {
- validTip.close();
- }
- // 如果是单个提示模式
- if (validOpts.msgMode === 'single') {
- this.validErrorMaps = {};
- return this.$nextTick();
- }
- if (rowList.length && colList.length) {
- validErrMaps = Object.assign({}, validErrorMaps);
- rowList.forEach(row => {
- colList.forEach(column => {
- const validKey = `${getRowid(this, row)}:${column.id}`;
- if (validErrMaps[validKey]) {
- delete validErrMaps[validKey];
- }
- });
- });
- } else if (rowList.length) {
- const rowIdList = rowList.map(row => `${getRowid(this, row)}`);
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(validErrorMaps, (item, key) => {
- if (rowIdList.indexOf(key.split(':')[0]) > -1) {
- validErrMaps[key] = item;
- }
- });
- } else if (colList.length) {
- const colidList = colList.map(column => `${column.id}`);
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(validErrorMaps, (item, key) => {
- if (colidList.indexOf(key.split(':')[1]) > -1) {
- validErrMaps[key] = item;
- }
- });
- }
- this.validErrorMaps = validErrMaps;
- return this.$nextTick();
- },
- /**
- * 触发校验
- */
- triggerValidate(type) {
- const {
- editConfig,
- editStore,
- editRules,
- editOpts,
- validOpts
- } = this;
- const {
- actived
- } = editStore;
- // 检查清除校验消息
- if (editRules && validOpts.msgMode === 'single') {
- this.validErrorMaps = {};
- }
- // 校验单元格
- if (editConfig && editRules && actived.row) {
- const {
- row,
- column,
- cell
- } = actived.args;
- if (this.hasCellRules(type, row, column)) {
- return this.validCellRules(type, row, column).then(() => {
- if (editOpts.mode === 'row') {
- this.clearValidate(row, column);
- }
- }).catch(({
- rule
- }) => {
- // 如果校验不通过与触发方式一致,则聚焦提示错误,否则跳过并不作任何处理
- if (!rule.trigger || type === rule.trigger) {
- const rest = {
- rule,
- row,
- column,
- cell
- };
- this.showValidTooltip(rest);
- return Promise.reject(rest);
- }
- return Promise.resolve();
- });
- }
- }
- return Promise.resolve();
- },
- /**
- * 弹出校验错误提示
- */
- showValidTooltip(params) {
- const $xeTable = this;
- const {
- $refs,
- height,
- validStore,
- validErrorMaps,
- tableData,
- validOpts
- } = this;
- const {
- rule,
- row,
- column,
- cell
- } = params;
- const validTip = $refs.refValidTooltip;
- const content = rule.content;
- validStore.visible = true;
- if (validOpts.msgMode === 'single') {
- this.validErrorMaps = {
- [`${getRowid(this, row)}:${column.id}`]: {
- column,
- row,
- rule,
- content
- }
- };
- } else {
- this.validErrorMaps = Object.assign({}, validErrorMaps, {
- [`${getRowid(this, row)}:${column.id}`]: {
- column,
- row,
- rule,
- content
- }
- });
- }
- $xeTable.dispatchEvent('valid-error', params, null);
- if (validTip) {
- if (validTip && (validOpts.message === 'tooltip' || validOpts.message === 'default' && !height && tableData.length < 2)) {
- return validTip.open(cell, content);
- }
- }
- return this.$nextTick();
- }
- }
- });
- ;// CONCATENATED MODULE: ./packages/table/module/custom/mixin.ts
- function calcMaxHeight($xeTable) {
- const $xeGantt = $xeTable.$xeGantt;
- const reactData = $xeTable;
- const {
- customStore
- } = reactData;
- let wrapperEl = $xeTable.$refs.refElem;
- // 判断面板不能大于表格高度
- let tableHeight = 0;
- if ($xeGantt) {
- const ganttContainerElem = $xeGantt.$refs.refGanttContainerElem;
- if (ganttContainerElem) {
- wrapperEl = ganttContainerElem;
- }
- }
- if (wrapperEl) {
- tableHeight = wrapperEl.clientHeight - 28;
- }
- customStore.maxHeight = Math.max(88, tableHeight);
- }
- function emitCustomEvent($xeTable, type, evnt) {
- const $xeGrid = $xeTable.$xeGrid;
- const $xeGantt = $xeTable.$xeGantt;
- const comp = $xeGrid || $xeGantt || $xeTable;
- comp.dispatchEvent('custom', {
- type
- }, evnt);
- }
- /* harmony default export */ var custom_mixin = ({
- methods: {
- _getCustomVisible() {
- const $xeTable = this;
- const reactData = $xeTable;
- const {
- customStore
- } = reactData;
- return customStore.visible;
- },
- _openCustom() {
- const $xeTable = this;
- const reactData = $xeTable;
- const {
- initStore,
- customStore
- } = reactData;
- customStore.visible = true;
- initStore.custom = true;
- $xeTable.handleUpdateCustomColumn();
- $xeTable.checkCustomStatus();
- calcMaxHeight($xeTable);
- return $xeTable.$nextTick().then(() => calcMaxHeight($xeTable));
- },
- _closeCustom() {
- const $xeTable = this;
- const reactData = $xeTable;
- const {
- customStore
- } = reactData;
- const customOpts = $xeTable.computeCustomOpts;
- if (customStore.visible) {
- customStore.visible = false;
- if (!customOpts.immediate) {
- $xeTable.handleCustom();
- }
- }
- return $xeTable.$nextTick();
- },
- _toggleCustom() {
- const $xeTable = this;
- const reactData = $xeTable;
- const {
- customStore
- } = reactData;
- if (customStore.visible) {
- return $xeTable.closeCustom();
- }
- return $xeTable.openCustom();
- },
- _saveCustom() {
- const $xeTable = this;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- customColumnList,
- aggHandleFields,
- rowGroupList
- } = reactData;
- const customOpts = $xeTable.computeCustomOpts;
- const {
- allowVisible,
- allowSort,
- allowFixed,
- allowResizable,
- allowGroup,
- allowValues
- } = customOpts;
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(customColumnList, (column, index, items, path, parentColumn) => {
- if (parentColumn) {
- // 更新子列信息
- column.fixed = parentColumn.fixed;
- } else {
- if (allowSort) {
- const sortIndex = index + 1;
- column.renderSortNumber = sortIndex;
- }
- if (allowFixed) {
- column.fixed = column.renderFixed;
- }
- }
- if (allowResizable) {
- if (column.renderVisible && (!column.children || column.children.length)) {
- if (column.renderResizeWidth !== column.renderWidth) {
- column.resizeWidth = column.renderResizeWidth;
- column.renderWidth = column.renderResizeWidth;
- }
- }
- }
- if (allowVisible) {
- column.visible = column.renderVisible;
- }
- if (allowGroup && allowValues) {
- column.aggFunc = column.renderAggFn;
- }
- });
- reactData.isCustomStatus = true;
- if (allowGroup && allowValues && !!$xeTable.handlePivotTableAggregateData) {
- if (rowGroupList.length !== aggHandleFields.length || rowGroupList.some((conf, i) => conf.field !== aggHandleFields[i])) {
- // 更新数据分组
- if (aggHandleFields.length) {
- $xeTable.setRowGroups(aggHandleFields);
- } else {
- $xeTable.clearRowGroups();
- }
- } else if (allowValues) {
- // 更新聚合函数
- $xeTable.handleUpdateAggData();
- }
- }
- if (allowSort) {
- internalData.collectColumn = customColumnList;
- }
- return $xeTable.saveCustomStore('confirm');
- },
- _cancelCustom() {
- const $xeTable = this;
- const reactData = $xeTable;
- const {
- customColumnList,
- customStore
- } = reactData;
- const {
- oldSortMaps,
- oldFixedMaps,
- oldVisibleMaps
- } = customStore;
- const customOpts = $xeTable.computeCustomOpts;
- const {
- allowVisible,
- allowSort,
- allowFixed,
- allowResizable
- } = customOpts;
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(customColumnList, column => {
- const colid = column.getKey();
- const visible = !!oldVisibleMaps[colid];
- const fixed = oldFixedMaps[colid] || '';
- if (allowVisible) {
- column.renderVisible = visible;
- column.visible = visible;
- }
- if (allowFixed) {
- column.renderFixed = fixed;
- column.fixed = fixed;
- }
- if (allowSort) {
- column.renderSortNumber = oldSortMaps[colid] || 0;
- }
- if (allowResizable) {
- column.renderResizeWidth = column.renderWidth;
- }
- }, {
- children: 'children'
- });
- return $xeTable.$nextTick();
- },
- _resetCustom(options) {
- const $xeTable = this;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- rowGroupList
- } = reactData;
- const {
- collectColumn
- } = internalData;
- const customOpts = $xeTable.computeCustomOpts;
- const {
- checkMethod
- } = customOpts;
- const opts = Object.assign({
- visible: true,
- resizable: options === true,
- fixed: options === true,
- sort: options === true,
- aggFunc: options === true
- }, options);
- const allCols = [];
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(collectColumn, column => {
- if (opts.resizable) {
- column.resizeWidth = 0;
- }
- if (opts.fixed) {
- column.fixed = column.defaultFixed;
- }
- if (opts.sort) {
- column.renderSortNumber = column.sortNumber;
- column.parentId = column.defaultParentId;
- }
- if (!checkMethod || checkMethod({
- $table: $xeTable,
- column
- })) {
- column.visible = column.defaultVisible;
- }
- if (opts.aggFunc) {
- column.aggFunc = column.defaultAggFunc;
- column.renderAggFn = column.defaultAggFunc;
- }
- column.renderResizeWidth = column.renderWidth;
- allCols.push(column);
- });
- if (opts.sort) {
- 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'), {
- key: 'id',
- parentKey: 'parentId',
- children: 'children'
- });
- internalData.collectColumn = newCollectCols;
- internalData.tableFullColumn = getColumnList(newCollectCols);
- }
- reactData.isCustomStatus = false;
- return $xeTable.handleCustom().then(() => {
- if (opts.aggFunc && $xeTable.handlePivotTableAggregateData) {
- const rowGroupFields = $xeTable.computeRowGroupFields;
- if (rowGroupFields ? rowGroupFields.length : rowGroupList.length) {
- if (rowGroupFields && rowGroupFields.length) {
- $xeTable.setRowGroups(rowGroupFields);
- } else {
- $xeTable.clearRowGroups();
- }
- } else {
- $xeTable.handleUpdateAggData();
- }
- }
- $xeTable.saveCustomStore('reset');
- });
- },
- _toggleCustomAllCheckbox() {
- const {
- customStore
- } = this;
- const isAll = !customStore.isAll;
- return this.setCustomAllCheckbox(isAll);
- },
- _setCustomAllCheckbox(checked) {
- const $xeTable = this;
- const reactData = $xeTable;
- const {
- customStore
- } = reactData;
- const {
- customColumnList
- } = reactData;
- const customOpts = $xeTable.computeCustomOpts;
- const {
- checkMethod,
- visibleMethod
- } = customOpts;
- const isAll = !!checked;
- if (customOpts.immediate) {
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(customColumnList, column => {
- if (visibleMethod && !visibleMethod({
- $table: $xeTable,
- column
- })) {
- return;
- }
- if (checkMethod && !checkMethod({
- $table: $xeTable,
- column
- })) {
- return;
- }
- column.visible = isAll;
- column.renderVisible = isAll;
- column.halfVisible = false;
- });
- customStore.isAll = isAll;
- reactData.isCustomStatus = true;
- $xeTable.handleCustom();
- $xeTable.saveCustomStore('update:visible');
- } else {
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(customColumnList, column => {
- if (visibleMethod && !visibleMethod({
- $table: $xeTable,
- column
- })) {
- return;
- }
- if (checkMethod && !checkMethod({
- $table: $xeTable,
- column
- })) {
- return;
- }
- column.renderVisible = isAll;
- column.halfVisible = false;
- });
- customStore.isAll = isAll;
- }
- $xeTable.checkCustomStatus();
- },
- checkCustomStatus() {
- const $xeTable = this;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- customStore
- } = reactData;
- const {
- collectColumn
- } = internalData;
- const customOpts = $xeTable.computeCustomOpts;
- const {
- checkMethod
- } = customOpts;
- customStore.isAll = collectColumn.every(column => (checkMethod ? !checkMethod({
- $table: $xeTable,
- column
- }) : false) || column.renderVisible);
- customStore.isIndeterminate = !customStore.isAll && collectColumn.some(column => (!checkMethod || checkMethod({
- $table: $xeTable,
- column
- })) && (column.renderVisible || column.halfVisible));
- },
- emitCustomEvent(type, evnt) {
- const $xeTable = this;
- const $xeGrid = $xeTable.$xeGrid;
- const $xeGantt = $xeTable.$xeGantt;
- const comp = $xeGrid || $xeGantt || $xeTable;
- comp.dispatchEvent('custom', {
- type
- }, evnt);
- },
- triggerCustomEvent(evnt) {
- const $xeTable = this;
- const reactData = $xeTable;
- const {
- customStore
- } = reactData;
- if (customStore.visible) {
- this.closeCustom();
- emitCustomEvent($xeTable, 'close', evnt);
- } else {
- customStore.btnEl = evnt.target;
- this.openCustom();
- emitCustomEvent($xeTable, 'open', evnt);
- }
- },
- customOpenEvent(evnt) {
- const $xeTable = this;
- const reactData = $xeTable;
- const {
- customStore
- } = reactData;
- if (customStore.visible) {
- customStore.activeBtn = true;
- customStore.btnEl = evnt.target;
- $xeTable.openCustom();
- emitCustomEvent($xeTable, 'open', evnt);
- }
- },
- customCloseEvent(evnt) {
- const $xeTable = this;
- const reactData = $xeTable;
- const {
- customStore
- } = reactData;
- if (customStore.visible) {
- customStore.activeBtn = false;
- $xeTable.closeCustom();
- emitCustomEvent($xeTable, 'close', evnt);
- }
- },
- handleUpdateCustomColumn() {
- const $xeTable = this;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- customStore
- } = reactData;
- const {
- collectColumn
- } = internalData;
- if (customStore.visible) {
- const sortMaps = {};
- const fixedMaps = {};
- const visibleMaps = {};
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(collectColumn, column => {
- const colid = column.getKey();
- column.renderFixed = column.fixed;
- column.renderVisible = column.visible;
- column.renderResizeWidth = column.renderWidth;
- sortMaps[colid] = column.renderSortNumber;
- fixedMaps[colid] = column.fixed;
- visibleMaps[colid] = column.visible;
- });
- customStore.oldSortMaps = sortMaps;
- customStore.oldFixedMaps = fixedMaps;
- customStore.oldVisibleMaps = visibleMaps;
- reactData.customColumnList = collectColumn.slice(0);
- }
- }
- }
- });
- ;// CONCATENATED MODULE: ./packages/table/src/table.ts
- const {
- getConfig: table_getConfig,
- getIcon: table_getIcon,
- getI18n: table_getI18n,
- renderer: table_renderer,
- globalResize: table_globalResize,
- globalEvents: table_globalEvents,
- globalMixins: table_globalMixins,
- renderEmptyElement: table_renderEmptyElement
- } = core_.VxeUI;
- function handleUpdateMergeBodyCells($xeTable, merges) {
- const internalData = $xeTable;
- internalData.mergeBodyList = [];
- internalData.mergeBodyMaps = {};
- internalData.mergeBodyCellMaps = {};
- $xeTable.setMergeCells(merges);
- }
- function handleUpdateMergeHeaderCells($xeTable, merges) {
- const internalData = $xeTable;
- internalData.mergeHeaderList = [];
- internalData.mergeHeaderMaps = {};
- internalData.mergeHeaderCellMaps = {};
- $xeTable.setMergeHeaderCells(merges);
- }
- function handleUpdateMergeFooterCells($xeTable, merges) {
- const internalData = $xeTable;
- internalData.mergeFooterList = [];
- internalData.mergeFooterMaps = {};
- internalData.mergeFooterCellMaps = {};
- $xeTable.setMergeFooterCells(merges);
- }
- function handleKeyField($xeTable) {
- const internalData = $xeTable;
- const keyField = $xeTable.computeRowField;
- internalData.currKeyField = keyField;
- internalData.isCurrDeepKey = hasDeepKey(keyField);
- }
- /**
- * 渲染浮固定列
- * 分别渲染左边固定列和右边固定列
- * 如果宽度足够情况下,则不需要渲染固定列
- */
- function renderViewFixed(h, $xeTable, fixedType) {
- const props = $xeTable;
- const reactData = $xeTable;
- const {
- showHeader,
- showFooter
- } = props;
- const {
- tableData,
- tableColumn,
- tableGroupColumn,
- columnStore,
- footerTableData
- } = reactData;
- const scrollbarOpts = $xeTable.computeScrollbarOpts;
- const scrollbarXOpts = $xeTable.computeScrollbarXOpts;
- const scrollbarYOpts = $xeTable.computeScrollbarYOpts;
- const {
- overscrollBehavior: overscrollXBehavior
- } = scrollbarXOpts;
- const {
- overscrollBehavior: overscrollYBehavior
- } = scrollbarYOpts;
- const isFixedLeft = fixedType === 'left';
- const fixedColumn = isFixedLeft ? columnStore.leftList : columnStore.rightList;
- const osXBehavior = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(overscrollXBehavior) ? scrollbarOpts.overscrollBehavior : overscrollXBehavior;
- const osYBehavior = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(overscrollYBehavior) ? scrollbarOpts.overscrollBehavior : overscrollYBehavior;
- return h('div', {
- ref: isFixedLeft ? 'refLeftContainer' : 'refRightContainer',
- class: [`vxe-table--fixed-${fixedType}-wrapper`, `sx--${scrollbarXOpts.visible}`, `sy--${scrollbarYOpts.visible}`, {
- [`x-ob--${osXBehavior}`]: osXBehavior,
- [`y-ob--${osYBehavior}`]: osYBehavior
- }]
- }, [showHeader ? h(header, {
- props: {
- fixedType,
- tableData,
- tableColumn,
- tableGroupColumn,
- fixedColumn
- },
- ref: `${fixedType}Header`
- }) : table_renderEmptyElement($xeTable), h(body, {
- props: {
- fixedType,
- tableData,
- tableColumn,
- fixedColumn
- },
- ref: `${fixedType}Body`
- }), showFooter ? h(footer, {
- props: {
- footerTableData,
- tableColumn,
- fixedColumn,
- fixedType
- },
- ref: `${fixedType}Footer`
- }) : table_renderEmptyElement($xeTable)]);
- }
- function renderEmptyBody(h, $xeTable) {
- const slots = $xeTable.$scopedSlots;
- const $xeGrid = $xeTable.$xeGrid;
- const $xeGantt = $xeTable.$xeGantt;
- const emptyOpts = $xeTable.computeEmptyOpts;
- const emptySlot = slots.empty;
- let emptyContent = '';
- const emptyParams = {
- $table: $xeTable,
- $grid: $xeGrid,
- $gantt: $xeGantt
- };
- if (emptySlot) {
- emptyContent = emptySlot.call($xeTable, emptyParams);
- } else {
- const compConf = emptyOpts.name ? table_renderer.get(emptyOpts.name) : null;
- const rtEmptyView = compConf ? compConf.renderTableEmpty || compConf.renderTableEmptyView || compConf.renderEmpty : null;
- if (rtEmptyView) {
- emptyContent = getSlotVNs(rtEmptyView.call($xeTable, h, emptyOpts, emptyParams));
- } else {
- emptyContent = getFuncText($xeTable.emptyText) || table_getI18n('vxe.table.emptyText');
- }
- }
- return emptyContent;
- }
- const renderDragTipContents = (h, $xeTable) => {
- const props = $xeTable;
- const reactData = $xeTable;
- const crossTableDragRowInfo = getCrossTableDragRowInfo($xeTable);
- const {
- dragConfig
- } = props;
- const {
- dragRow,
- dragCol,
- dragTipText
- } = reactData;
- const columnDragOpts = $xeTable.computeColumnDragOpts;
- const rowDragOpts = $xeTable.computeRowDragOpts;
- const rowDragSlots = rowDragOpts.slots || {};
- const rTipSlot = rowDragSlots.tip || (dragConfig && dragConfig.slots ? dragConfig.slots.rowTip : null);
- const columnDragSlots = columnDragOpts.slots || {};
- const cTipSlot = columnDragSlots.tip;
- const dRow = dragRow || (rowDragOpts.isCrossTableDrag ? crossTableDragRowInfo.row : null);
- if (dRow && rTipSlot) {
- return $xeTable.callSlot(rTipSlot, {
- row: dRow
- }, h);
- }
- if (dragCol && cTipSlot) {
- return $xeTable.callSlot(cTipSlot, {
- column: dragCol
- }, h);
- }
- return [h('span', dragTipText)];
- };
- const table_renderDragTip = (h, $xeTable) => {
- const reactData = $xeTable;
- const crossTableDragRowInfo = getCrossTableDragRowInfo($xeTable);
- const {
- dragRow,
- dragCol
- } = reactData;
- const rowOpts = $xeTable.computeRowOpts;
- const columnOpts = $xeTable.computeColumnOpts;
- const rowDragOpts = $xeTable.computeRowDragOpts;
- const columnDragOpts = $xeTable.computeColumnDragOpts;
- const dRow = dragRow || (rowDragOpts.isCrossTableDrag ? crossTableDragRowInfo.row : null);
- if (rowOpts.drag || columnOpts.drag) {
- return h('div', {
- class: 'vxe-table--drag-wrapper'
- }, [h('div', {
- ref: 'refDragRowLineElem',
- class: ['vxe-table--drag-row-line', {
- 'is--guides': rowDragOpts.showGuidesStatus
- }]
- }), h('div', {
- ref: 'refDragColLineElem',
- class: ['vxe-table--drag-col-line', {
- 'is--guides': columnDragOpts.showGuidesStatus
- }]
- }), dRow && rowDragOpts.showDragTip || dragCol && columnDragOpts.showDragTip ? h('div', {
- ref: 'refDragTipElem',
- class: 'vxe-table--drag-sort-tip'
- }, [h('div', {
- class: 'vxe-table--drag-sort-tip-wrapper'
- }, [h('div', {
- class: 'vxe-table--drag-sort-tip-status'
- }, [h('span', {
- class: ['vxe-table--drag-sort-tip-normal-status', dRow ? table_getIcon().TABLE_DRAG_STATUS_ROW : table_getIcon().TABLE_DRAG_STATUS_COLUMN]
- }), h('span', {
- class: ['vxe-table--drag-sort-tip-sub-status', table_getIcon().TABLE_DRAG_STATUS_SUB_ROW]
- }), h('span', {
- class: ['vxe-table--drag-sort-tip-disabled-status', table_getIcon().TABLE_DRAG_DISABLED]
- })]), h('div', {
- class: 'vxe-table--drag-sort-tip-content'
- }, renderDragTipContents(h, $xeTable))])]) : table_renderEmptyElement($xeTable)]);
- }
- return table_renderEmptyElement($xeTable);
- };
- function handleUpdateResize($xeTable) {
- const el = $xeTable.$refs.refElem;
- if (el && el.clientWidth && el.clientHeight) {
- $xeTable.recalculate();
- }
- }
- function renderRowExpandedVNs(h, $xeTable) {
- const props = $xeTable;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const $xeGrid = $xeTable.$xeGrid;
- const $xeGantt = $xeTable.$xeGantt;
- const {
- treeConfig
- } = props;
- const {
- expandColumn,
- isRowGroupStatus
- } = reactData;
- const tableRowExpandedList = $xeTable.computeTableRowExpandedList;
- const expandOpts = $xeTable.computeExpandOpts;
- const {
- mode
- } = expandOpts;
- if (mode !== 'fixed') {
- return table_renderEmptyElement($xeTable);
- }
- const expandVNs = [h('div', {
- key: 'repY',
- ref: 'refRowExpandYSpaceElem'
- })];
- if (expandColumn) {
- const {
- handleGetRowId
- } = createHandleGetRowId($xeTable);
- tableRowExpandedList.forEach(row => {
- const expandOpts = $xeTable.computeExpandOpts;
- const {
- height: expandHeight,
- padding,
- indent
- } = expandOpts;
- const {
- fullAllDataRowIdData,
- fullColumnIdData
- } = internalData;
- const treeOpts = $xeTable.computeTreeOpts;
- const {
- transform,
- seqMode
- } = treeOpts;
- const cellStyle = {};
- const rowid = handleGetRowId(row);
- const rowRest = fullAllDataRowIdData[rowid];
- const colid = expandColumn.id;
- const colRest = fullColumnIdData[colid] || {};
- let rowLevel = 0;
- let seq = -1;
- let _rowIndex = -1;
- let rowIndex = -1;
- let $rowIndex = -1;
- if (rowRest) {
- rowIndex = rowRest.index;
- $rowIndex = rowRest.$index;
- _rowIndex = rowRest._index;
- rowLevel = rowRest.level;
- seq = rowRest.seq;
- if (isRowGroupStatus || treeConfig && transform && seqMode === 'increasing') {
- seq = rowRest._index + 1;
- } else if (treeConfig && seqMode === 'fixed') {
- seq = rowRest._tIndex + 1;
- }
- }
- if (expandHeight) {
- cellStyle.height = `${expandHeight}px`;
- }
- if (isRowGroupStatus || treeConfig) {
- cellStyle.paddingLeft = `${rowLevel * (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(indent) ? indent : treeOpts.indent) + 30}px`;
- }
- let columnIndex = -1;
- let $columnIndex = -1;
- let _columnIndex = -1;
- if (colRest) {
- columnIndex = colRest.index;
- $columnIndex = colRest.$index;
- _columnIndex = colRest._index;
- }
- const expandParams = {
- $table: $xeTable,
- $grid: $xeGrid,
- $gantt: $xeGantt,
- seq,
- column: expandColumn,
- columnIndex,
- $columnIndex,
- _columnIndex,
- fixed: '',
- source: 'table',
- type: 'body',
- level: rowLevel,
- rowid,
- row,
- rowIndex,
- $rowIndex,
- _rowIndex,
- isHidden: false,
- isEdit: false,
- visibleData: [],
- data: [],
- items: []
- };
- expandVNs.push(h('div', {
- key: rowid,
- class: ['vxe-body--row-expanded-cell', {
- 'is--padding': padding,
- 'is--ellipsis': expandHeight
- }],
- attrs: {
- rowid
- },
- style: cellStyle
- }, expandColumn.renderData(h, expandParams)));
- });
- }
- return h('div', {
- ref: 'refRowExpandElem',
- class: 'vxe-table--row-expanded-wrapper'
- }, expandVNs);
- }
- function renderScrollX(h, $xeTable) {
- return h('div', {
- key: 'vsx',
- ref: 'refScrollXVirtualElem',
- class: 'vxe-table--scroll-x-virtual'
- }, [h('div', {
- ref: 'refScrollXLeftCornerElem',
- class: 'vxe-table--scroll-x-left-corner'
- }), h('div', {
- ref: 'refScrollXWrapperElem',
- class: 'vxe-table--scroll-x-wrapper'
- }, [h('div', {
- ref: 'refScrollXHandleElem',
- class: 'vxe-table--scroll-x-handle',
- on: {
- scroll: $xeTable.triggerVirtualScrollXEvent
- }
- }, [h('div', {
- ref: 'refScrollXSpaceElem',
- class: 'vxe-table--scroll-x-space'
- })]), h('div', {
- class: 'vxe-table--scroll-x-handle-appearance'
- })]), h('div', {
- ref: 'refScrollXRightCornerElem',
- class: 'vxe-table--scroll-x-right-corner'
- })]);
- }
- function renderScrollY(h, $xeTable) {
- return h('div', {
- ref: 'refScrollYVirtualElem',
- class: 'vxe-table--scroll-y-virtual'
- }, [h('div', {
- ref: 'refScrollYTopCornerElem',
- class: 'vxe-table--scroll-y-top-corner'
- }), h('div', {
- ref: 'refScrollYWrapperElem',
- class: 'vxe-table--scroll-y-wrapper'
- }, [h('div', {
- ref: 'refScrollYHandleElem',
- class: 'vxe-table--scroll-y-handle',
- on: {
- scroll: $xeTable.triggerVirtualScrollYEvent
- }
- }, [h('div', {
- ref: 'refScrollYSpaceElem',
- class: 'vxe-table--scroll-y-space'
- })])]), h('div', {
- ref: 'refScrollYBottomCornerElem',
- class: 'vxe-table--scroll-y-bottom-corner'
- })]);
- }
- function renderViewport(h, $xeTable) {
- const props = $xeTable;
- const reactData = $xeTable;
- const {
- showHeader,
- showFooter
- } = props;
- const {
- overflowX,
- tableData,
- tableColumn,
- tableGroupColumn,
- footerTableData,
- columnStore
- } = reactData;
- const scrollbarOpts = $xeTable.computeScrollbarOpts;
- const scrollbarXOpts = $xeTable.computeScrollbarXOpts;
- const scrollbarYOpts = $xeTable.computeScrollbarYOpts;
- const {
- overscrollBehavior: overscrollXBehavior
- } = scrollbarXOpts;
- const {
- overscrollBehavior: overscrollYBehavior
- } = scrollbarYOpts;
- const {
- leftList,
- rightList
- } = columnStore;
- const osXBehavior = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(overscrollXBehavior) ? scrollbarOpts.overscrollBehavior : overscrollXBehavior;
- const osYBehavior = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(overscrollYBehavior) ? scrollbarOpts.overscrollBehavior : overscrollYBehavior;
- return h('div', {
- ref: 'refTableViewportElem',
- class: ['vxe-table--viewport-wrapper', {
- [`x-ob--${osXBehavior}`]: osXBehavior,
- [`y-ob--${osYBehavior}`]: osYBehavior
- }]
- }, [h('div', {
- class: ['vxe-table--main-wrapper', `sx--${scrollbarXOpts.visible}`, `sy--${scrollbarYOpts.visible}`]
- }, [
- /**
- * 表头
- */
- showHeader ? h(header, {
- ref: 'refTableHeader',
- props: {
- tableData,
- tableColumn,
- tableGroupColumn
- }
- }) : table_renderEmptyElement($xeTable),
- /**
- * 表体
- */
- h(body, {
- ref: 'refTableBody',
- props: {
- tableData,
- tableColumn
- }
- }),
- /**
- * 表尾
- */
- showFooter ? h(footer, {
- ref: 'refTableFooter',
- props: {
- footerTableData,
- tableColumn
- }
- }) : table_renderEmptyElement($xeTable)]), h('div', {
- class: 'vxe-table--fixed-wrapper'
- }, [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)]);
- }
- function renderBody(h, $xeTable) {
- const scrollbarYToLeft = $xeTable.computeScrollbarYToLeft;
- return h('div', {
- class: 'vxe-table--layout-wrapper'
- }, scrollbarYToLeft ? [renderScrollY(h, $xeTable), renderViewport(h, $xeTable)] : [renderViewport(h, $xeTable), renderScrollY(h, $xeTable)]);
- }
- /* harmony default export */ var table = ({
- name: 'VxeTable',
- mixins: [table_globalMixins.sizeMixin, mixin, menu_mixin, edit_mixin, export_mixin, keyboard_mixin, validator_mixin, custom_mixin],
- props: tableProps,
- provide() {
- return {
- $xeTable: this,
- xecolgroup: null
- };
- },
- inject: {
- $xeTabs: {
- default: null
- },
- $xeGrid: {
- default: null
- },
- $xeGantt: {
- default: null
- }
- },
- data() {
- const xID = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().uniqueId();
- const reactData = {
- // 低性能的静态列
- staticColumns: [],
- // 渲染的列分组
- tableGroupColumn: [],
- // 可视区渲染的列
- tableColumn: [],
- // 渲染中的数据
- tableData: [],
- // 是否启用了横向 X 可视渲染方式加载
- scrollXLoad: false,
- // 是否启用了纵向 Y 可视渲染方式加载
- scrollYLoad: false,
- // 是否存在纵向滚动条
- overflowY: true,
- // 是否存在横向滚动条
- overflowX: false,
- // 纵向滚动条的宽度
- scrollbarWidth: 0,
- // 横向滚动条的高度
- scrollbarHeight: 0,
- // 最后滚动时间戳
- lastScrollTime: 0,
- // 行高
- rowHeight: 0,
- // 表格父容器的高度
- parentHeight: 0,
- // 是否使用分组表头
- isGroup: false,
- isAllOverflow: false,
- // 复选框属性,是否全选
- isAllSelected: false,
- // 复选框属性,有选中且非全选状态
- isIndeterminate: false,
- // 当前行
- currentRow: null,
- // 单选框属性,选中列
- currentColumn: null,
- // 单选框属性,选中行
- selectRadioRow: null,
- // 表尾合计数据
- footerTableData: [],
- // 行分组列信息
- rowGroupColumn: null,
- // 展开列信息
- expandColumn: null,
- checkboxColumn: null,
- radioColumn: null,
- // 树节点列信息
- treeNodeColumn: null,
- hasFixedColumn: false,
- // 刷新列标识,当列筛选被改变时,触发表格刷新数据
- upDataFlag: 0,
- // 刷新列标识,当列的特定属性被改变时,触发表格刷新列
- reColumnFlag: 0,
- // 初始化标识
- initStore: {
- filter: false,
- import: false,
- export: false,
- custom: false
- },
- // 自定义列相关的信息
- customStore: {
- btnEl: null,
- isAll: false,
- isIndeterminate: false,
- activeBtn: false,
- activeWrapper: false,
- visible: false,
- maxHeight: 0,
- oldSortMaps: {},
- oldFixedMaps: {},
- oldVisibleMaps: {}
- },
- customColumnList: [],
- // 当前选中的筛选列
- filterStore: {
- isAllSelected: false,
- isIndeterminate: false,
- style: null,
- column: null,
- visible: false,
- maxHeight: null
- },
- // 存放列相关的信息
- columnStore: {
- leftList: [],
- centerList: [],
- rightList: [],
- resizeList: [],
- pxList: [],
- pxMinList: [],
- autoMinList: [],
- scaleList: [],
- scaleMinList: [],
- autoList: [],
- remainList: []
- },
- // 存放快捷菜单的信息
- ctxMenuStore: {
- selected: null,
- visible: false,
- showChild: false,
- selectChild: null,
- list: [],
- style: null
- },
- // 存放可编辑相关信息
- editStore: {
- indexs: {
- columns: []
- },
- titles: {
- columns: []
- },
- // 选中源
- selected: {
- row: null,
- column: null
- },
- // 已复制源
- copyed: {
- cut: false,
- rows: [],
- columns: []
- },
- // 激活
- actived: {
- row: null,
- column: null
- },
- // 当前被强制聚焦单元格,只会在鼠标点击后算聚焦
- focused: {
- row: null,
- column: null
- }
- },
- // 存放 tooltip 相关信息
- tooltipStore: {
- row: null,
- column: null,
- content: null,
- visible: false,
- type: null,
- currOpts: {}
- },
- // 存放数据校验相关信息
- validStore: {
- visible: false
- },
- validErrorMaps: {},
- // 导入相关信息
- importStore: {
- inited: false,
- file: null,
- type: '',
- modeList: [],
- typeList: [],
- filename: '',
- visible: false
- },
- importParams: {
- mode: '',
- types: null,
- message: true
- },
- // 导出相关信息
- exportStore: {
- inited: false,
- name: '',
- modeList: [],
- typeList: [],
- columns: [],
- isPrint: false,
- hasFooter: false,
- hasMerge: false,
- hasTree: false,
- hasColgroup: false,
- visible: false
- },
- exportParams: {
- filename: '',
- sheetName: '',
- mode: '',
- type: '',
- isColgroup: false,
- isMerge: false,
- isAllExpand: false,
- useStyle: false,
- original: false,
- message: true,
- isHeader: false,
- isTitle: false,
- isFooter: false
- },
- visiblwRowsFlag: 1,
- isRowGroupStatus: false,
- rowGroupList: [],
- aggHandleFields: [],
- aggHandleAggColumns: [],
- rowGroupExpandedFlag: 1,
- rowExpandedFlag: 1,
- treeExpandedFlag: 1,
- updateCheckboxFlag: 1,
- pendingRowFlag: 1,
- insertRowFlag: 1,
- removeRowFlag: 1,
- mergeHeadFlag: 1,
- mergeBodyFlag: 1,
- mergeFootFlag: 1,
- rowHeightStore: {
- large: 52,
- default: 48,
- medium: 44,
- small: 40,
- mini: 36
- },
- scrollVMLoading: false,
- scrollYHeight: 0,
- scrollYTop: 0,
- isScrollYBig: false,
- scrollXLeft: 0,
- scrollXWidth: 0,
- isScrollXBig: false,
- lazScrollLoading: false,
- rowExpandHeightFlag: 1,
- calcCellHeightFlag: 1,
- resizeHeightFlag: 1,
- resizeWidthFlag: 1,
- isCustomStatus: false,
- isCrossDragRow: false,
- dragRow: null,
- isCrossDragCol: false,
- dragCol: null,
- dragTipText: '',
- isDragResize: false,
- isRowLoading: false,
- isColLoading: false
- };
- return {
- xID,
- ...reactData,
- // 私有属性
- reScrollFlag: 0,
- reLayoutFlag: 0,
- footFlag: 0,
- mergeFooteCellFlag: 0,
- crossTableDragRowInfo: crossTableDragRowGlobal
- };
- },
- computed: {
- ...{},
- tableId() {
- return this.computeTableId;
- },
- computeTableId() {
- const $xeTable = this;
- const props = $xeTable;
- const $xeGrid = $xeTable.$xeGrid;
- const $xeGantt = $xeTable.$xeGantt;
- const {
- id
- } = props;
- if (id) {
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(id)) {
- return `${id({
- $table: $xeTable,
- $grid: $xeGrid,
- $gantt: $xeGantt
- }) || ''}`;
- }
- return `${id}`;
- }
- return '';
- },
- computeRowField() {
- const $xeTable = this;
- const props = $xeTable;
- const rowOpts = $xeTable.computeRowOpts;
- return `${props.rowId || rowOpts.keyField || '_X_ROW_KEY'}`;
- },
- validOpts() {
- return this.computeValidOpts;
- },
- computeValidOpts() {
- const $xeTable = this;
- const props = $xeTable;
- return Object.assign({}, table_getConfig().table.validConfig, props.validConfig);
- },
- sXOpts() {
- return this.computeVirtualXOpts;
- },
- computeSXOpts() {
- return this.computeVirtualXOpts;
- },
- computeScrollXThreshold() {
- const $xeTable = this;
- const virtualXOpts = $xeTable.computeVirtualXOpts;
- const {
- threshold
- } = virtualXOpts;
- if (threshold) {
- return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(threshold);
- }
- return 0;
- },
- sYOpts() {
- return this.computeVirtualYOpts;
- },
- computeSYOpts() {
- return this.computeVirtualYOpts;
- },
- computeVirtualXOpts() {
- const $xeTable = this;
- const props = $xeTable;
- const {
- virtualXConfig,
- scrollX
- } = props;
- const globalVirtualXConfig = table_getConfig().table.virtualXConfig;
- const globalScrollX = table_getConfig().table.scrollX;
- if (virtualXConfig) {
- return Object.assign({}, globalVirtualXConfig, virtualXConfig);
- }
- if (scrollX) {
- // 已废弃,保留兼容
- return Object.assign({}, globalScrollX, scrollX);
- }
- if (globalVirtualXConfig) {
- return Object.assign({}, globalVirtualXConfig, virtualXConfig);
- }
- // 已废弃,保留兼容
- return Object.assign({}, globalScrollX, scrollX);
- },
- computeVirtualYOpts() {
- const $xeTable = this;
- const props = $xeTable;
- const {
- virtualYConfig,
- scrollY
- } = props;
- const globalVirtualYConfig = table_getConfig().table.virtualYConfig;
- const globalScrollY = table_getConfig().table.scrollY;
- if (virtualYConfig) {
- return Object.assign({}, globalVirtualYConfig, virtualYConfig);
- }
- if (scrollY) {
- // 已废弃,保留兼容
- return Object.assign({}, globalScrollY, scrollY);
- }
- if (globalVirtualYConfig) {
- return Object.assign({}, globalVirtualYConfig, virtualYConfig);
- }
- // 已废弃,保留兼容
- return Object.assign({}, globalScrollY, scrollY);
- },
- computeScrollbarOpts() {
- const $xeTable = this;
- const props = $xeTable;
- return Object.assign({}, table_getConfig().table.scrollbarConfig, props.scrollbarConfig);
- },
- computeScrollbarXOpts() {
- const $xeTable = this;
- const props = $xeTable;
- const scrollbarOpts = $xeTable.computeScrollbarOpts;
- return Object.assign({}, scrollbarOpts.x, props.scrollbarConfig?.x || {});
- },
- computeScrollbarYOpts() {
- const $xeTable = this;
- const props = $xeTable;
- const scrollbarOpts = $xeTable.computeScrollbarOpts;
- return Object.assign({}, scrollbarOpts.y, props.scrollbarConfig?.y || {});
- },
- computeScrollbarXToTop() {
- const $xeTable = this;
- const scrollbarXOpts = $xeTable.computeScrollbarXOpts;
- return scrollbarXOpts.position === 'top';
- },
- computeScrollbarYToLeft() {
- const $xeTable = this;
- const scrollbarYOpts = $xeTable.computeScrollbarYOpts;
- return scrollbarYOpts.position === 'left';
- },
- computeScrollYThreshold() {
- const $xeTable = this;
- const virtualYOpts = $xeTable.computeVirtualYOpts;
- const {
- threshold
- } = virtualYOpts;
- if (threshold) {
- return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(threshold);
- }
- return 0;
- },
- rowHeightMaps() {
- return this.computeRowHeightMaps;
- },
- computeRowHeightMaps() {
- const $xeTable = this;
- const reactData = $xeTable;
- return reactData.rowHeightStore;
- },
- computeDefaultRowHeight() {
- const $xeTable = this;
- const vSize = $xeTable.computeSize;
- const rowHeightMaps = $xeTable.computeRowHeightMaps;
- return rowHeightMaps[vSize || 'default'] || 18;
- },
- columnOpts() {
- return this.computeColumnOpts;
- },
- computeColumnOpts() {
- const $xeTable = this;
- const props = $xeTable;
- return Object.assign({}, table_getConfig().table.columnConfig, props.columnConfig);
- },
- computeCurrentColumnOpts() {
- const $xeTable = this;
- const props = $xeTable;
- return Object.assign({}, table_getConfig().table.currentColumnConfig, props.currentColumnConfig);
- },
- computeCellOpts() {
- const $xeTable = this;
- const props = $xeTable;
- const cellOpts = Object.assign({}, table_getConfig().table.cellConfig, props.cellConfig);
- if (cellOpts.height) {
- cellOpts.height = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(cellOpts.height);
- }
- return cellOpts;
- },
- computeHeaderCellOpts() {
- const $xeTable = this;
- const $xeGantt = $xeTable.$xeGantt;
- const props = $xeTable;
- const headerCellOpts = Object.assign({}, table_getConfig().table.headerCellConfig, props.headerCellConfig);
- const defaultRowHeight = $xeTable.computeDefaultRowHeight;
- const cellOpts = $xeTable.computeCellOpts;
- let headCellHeight = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(getCalcHeight(headerCellOpts.height || cellOpts.height));
- if ($xeGantt) {
- const taskScaleConfs = $xeGantt.computeTaskScaleConfs;
- if (taskScaleConfs && taskScaleConfs.length > 2) {
- const ganttMinHeadCellHeight = defaultRowHeight / 2 * taskScaleConfs.length;
- headCellHeight = Math.max(ganttMinHeadCellHeight, headCellHeight);
- }
- }
- headerCellOpts.height = headCellHeight;
- return headerCellOpts;
- },
- computeFooterCellOpts() {
- const $xeTable = this;
- const props = $xeTable;
- const footerCellOpts = Object.assign({}, table_getConfig().table.footerCellConfig, props.footerCellConfig);
- const cellOpts = $xeTable.computeCellOpts;
- footerCellOpts.height = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(getCalcHeight(footerCellOpts.height || cellOpts.height));
- return footerCellOpts;
- },
- rowOpts() {
- return this.computeRowOpts;
- },
- computeRowOpts() {
- const $xeTable = this;
- const props = $xeTable;
- return Object.assign({}, table_getConfig().table.rowConfig, props.rowConfig);
- },
- computeAggregateOpts() {
- const $xeTable = this;
- const props = $xeTable;
- return Object.assign({}, table_getConfig().table.aggregateConfig || table_getConfig().table.rowGroupConfig, props.aggregateConfig || props.rowGroupConfig);
- },
- computeRowGroupOpts() {
- const $xeTable = this;
- return $xeTable.computeAggregateOpts;
- },
- computeCurrentRowOpts() {
- const $xeTable = this;
- const props = $xeTable;
- return Object.assign({}, table_getConfig().table.currentRowConfig, props.currentRowConfig);
- },
- computeRowDragOpts() {
- const $xeTable = this;
- const props = $xeTable;
- return Object.assign({}, table_getConfig().table.rowDragConfig, props.rowDragConfig);
- },
- computeColumnDragOpts() {
- const $xeTable = this;
- const props = $xeTable;
- return Object.assign({}, table_getConfig().table.columnDragConfig, props.columnDragConfig);
- },
- resizeOpts() {
- return this.computeResizeOpts;
- },
- computeResizeOpts() {
- const $xeTable = this;
- const props = $xeTable;
- return Object.assign({}, table_getConfig().table.resizeConfig, props.resizeConfig);
- },
- resizableOpts() {
- return this.computeResizableOpts;
- },
- computeResizableOpts() {
- const $xeTable = this;
- const props = $xeTable;
- return Object.assign({}, table_getConfig().table.resizableConfig, props.resizableConfig);
- },
- seqOpts() {
- return this.computeSeqOpts;
- },
- computeSeqOpts() {
- const $xeTable = this;
- const props = $xeTable;
- return Object.assign({
- startIndex: 0
- }, table_getConfig().table.seqConfig, props.seqConfig);
- },
- radioOpts() {
- return this.computeRadioOpts;
- },
- computeRadioOpts() {
- const $xeTable = this;
- const props = $xeTable;
- return Object.assign({}, table_getConfig().table.radioConfig, props.radioConfig);
- },
- checkboxOpts() {
- return this.computeCheckboxOpts;
- },
- computeCheckboxOpts() {
- const $xeTable = this;
- const props = $xeTable;
- return Object.assign({}, table_getConfig().table.checkboxConfig, props.checkboxConfig);
- },
- tooltipOpts() {
- return this.computeTooltipOpts;
- },
- computeTooltipOpts() {
- const $xeTable = this;
- const props = $xeTable;
- return Object.assign({}, table_getConfig().tooltip, table_getConfig().table.tooltipConfig, props.tooltipConfig);
- },
- tipConfig() {
- return {
- ...this.tooltipOpts
- };
- },
- computeHeaderTooltipOpts() {
- const $xeTable = this;
- const props = $xeTable;
- return Object.assign({}, table_getConfig().tooltip, table_getConfig().table.headerTooltipConfig, props.headerTooltipConfig);
- },
- computeFooterTooltipOpts() {
- const $xeTable = this;
- const props = $xeTable;
- return Object.assign({}, table_getConfig().tooltip, table_getConfig().table.footerTooltipConfig, props.footerTooltipConfig);
- },
- computeTableTipConfig() {
- const $xeTable = this;
- const reactData = $xeTable;
- const {
- tooltipStore
- } = reactData;
- const tooltipOpts = $xeTable.computeTooltipOpts;
- return Object.assign({}, tooltipOpts, tooltipStore.currOpts);
- },
- computeValidTipConfig() {
- const $xeTable = this;
- const tooltipOpts = $xeTable.computeTooltipOpts;
- return Object.assign({}, tooltipOpts);
- },
- validTipOpts() {
- return Object.assign({
- isArrow: false
- }, this.tooltipOpts);
- },
- editOpts() {
- return this.computeEditOpts;
- },
- computeEditOpts() {
- return Object.assign({}, table_getConfig().table.editConfig, this.editConfig);
- },
- sortOpts() {
- return this.computeSortOpts;
- },
- computeSortOpts() {
- return Object.assign({
- orders: ['asc', 'desc', null]
- }, table_getConfig().table.sortConfig, this.sortConfig);
- },
- filterOpts() {
- return this.computeFilterOpts;
- },
- computeFilterOpts() {
- const $xeTable = this;
- const props = $xeTable;
- return Object.assign({}, table_getConfig().table.filterConfig, props.filterConfig);
- },
- computeFloatingFilterOpts() {
- const $xeTable = this;
- const props = $xeTable;
- return Object.assign({}, table_getConfig().table.floatingFilterConfig, props.floatingFilterConfig);
- },
- mouseOpts() {
- return this.computeMouseOpts;
- },
- computeMouseOpts() {
- return Object.assign({}, table_getConfig().table.mouseConfig, this.mouseConfig);
- },
- areaOpts() {
- return this.computeAreaOpts;
- },
- computeAreaOpts() {
- return Object.assign({}, table_getConfig().table.areaConfig, this.areaConfig);
- },
- keyboardOpts() {
- return this.computeKeyboardOpts;
- },
- computeKeyboardOpts() {
- return Object.assign({}, table_getConfig().table.keyboardConfig, this.keyboardConfig);
- },
- clipOpts() {
- return this.computeClipOpts;
- },
- computeClipOpts() {
- return Object.assign({}, table_getConfig().table.clipConfig, this.clipConfig);
- },
- fnrOpts() {
- return this.computeFnrOpts;
- },
- computeFNROpts() {
- return this.computeFnrOpts;
- },
- computeFnrOpts() {
- return Object.assign({}, table_getConfig().table.fnrConfig, this.fnrConfig);
- },
- headerCtxMenu() {
- return this.computeHeaderMenu;
- },
- computeHeaderMenu() {
- const $xeTable = this;
- const menuOpts = $xeTable.computeMenuOpts;
- const headerOpts = menuOpts.header;
- return headerOpts && headerOpts.options ? headerOpts.options : [];
- },
- bodyCtxMenu() {
- return this.computeBodyMenu;
- },
- computeBodyMenu() {
- const $xeTable = this;
- const menuOpts = $xeTable.computeMenuOpts;
- const bodyOpts = menuOpts.body;
- return bodyOpts && bodyOpts.options ? bodyOpts.options : [];
- },
- footerCtxMenu() {
- return this.computeFooterMenu;
- },
- computeFooterMenu() {
- const $xeTable = this;
- const menuOpts = $xeTable.computeMenuOpts;
- const footerOpts = menuOpts.footer;
- return footerOpts && footerOpts.options ? footerOpts.options : [];
- },
- isCtxMenu() {
- return this.computeIsContentMenu;
- },
- computeIsMenu() {
- return this.computeIsContentMenu;
- },
- computeIsContentMenu() {
- const $xeTable = this;
- const props = $xeTable;
- const menuOpts = $xeTable.computeMenuOpts;
- const headerMenu = $xeTable.computeHeaderMenu;
- const bodyMenu = $xeTable.computeBodyMenu;
- const footerMenu = $xeTable.computeFooterMenu;
- return !!((props.contextMenu || props.menuConfig) && isEnableConf(menuOpts) && (headerMenu.length || bodyMenu.length || footerMenu.length));
- },
- ctxMenuList() {
- return this.computeMenuList;
- },
- computeMenuList() {
- const $xeTable = this;
- const reactData = $xeTable;
- const {
- ctxMenuStore
- } = reactData;
- const rest = [];
- ctxMenuStore.list.forEach(list => {
- list.forEach(item => {
- rest.push(item);
- });
- });
- return rest;
- },
- ctxMenuOpts() {
- return this.computeMenuOpts;
- },
- computeMenuOpts() {
- return Object.assign({}, table_getConfig().table.menuConfig, this.contextMenu, this.menuConfig);
- },
- computeLeftFixedWidth() {
- const $xeTable = this;
- const reactData = $xeTable;
- const {
- columnStore
- } = reactData;
- const {
- leftList
- } = columnStore;
- let leftWidth = 0;
- for (let i = 0; i < leftList.length; i++) {
- const column = leftList[i];
- leftWidth += column.renderWidth;
- }
- return leftWidth;
- },
- computeRightFixedWidth() {
- const $xeTable = this;
- const reactData = $xeTable;
- const {
- columnStore
- } = reactData;
- const {
- rightList
- } = columnStore;
- let leftWidth = 0;
- for (let i = 0; i < rightList.length; i++) {
- const column = rightList[i];
- leftWidth += column.renderWidth;
- }
- return leftWidth;
- },
- exportOpts() {
- return this.computeExportOpts;
- },
- computeExportOpts() {
- return Object.assign({}, table_getConfig().table.exportConfig, this.exportConfig);
- },
- importOpts() {
- return this.computeImportOpts;
- },
- computeImportOpts() {
- return Object.assign({}, table_getConfig().table.importConfig, this.importConfig);
- },
- printOpts() {
- return this.computePrintOpts;
- },
- computePrintOpts() {
- return Object.assign({}, table_getConfig().table.printConfig, this.printConfig);
- },
- expandOpts() {
- return this.computeExpandOpts;
- },
- computeExpandOpts() {
- return Object.assign({}, table_getConfig().table.expandConfig, this.expandConfig);
- },
- treeOpts() {
- return this.computeTreeOpts;
- },
- computeTreeOpts() {
- return Object.assign({}, table_getConfig().table.treeConfig, this.treeConfig);
- },
- emptyOpts() {
- return this.computeEmptyOpts;
- },
- computeEmptyOpts() {
- return Object.assign({}, table_getConfig().table.emptyRender, this.emptyRender);
- },
- loadingOpts() {
- return this.computeLoadingOpts;
- },
- computeLoadingOpts() {
- return Object.assign({}, table_getConfig().table.loadingConfig, this.loadingConfig);
- },
- computeCellOffsetWidth() {
- return this.border ? Math.max(2, Math.ceil(this.scrollbarWidth / this.tableColumn.length)) : 1;
- },
- customOpts() {
- return this.computeCustomOpts;
- },
- computeCustomOpts() {
- return Object.assign({}, table_getConfig().table.customConfig, this.customConfig);
- },
- computeTableRowExpandedList() {
- const $xeTable = this;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- tableData,
- rowExpandedFlag,
- expandColumn,
- rowGroupExpandedFlag,
- treeExpandedFlag
- } = reactData;
- const {
- visibleDataRowIdData,
- rowExpandedMaps
- } = internalData;
- const expandList = [];
- if (tableData.length && expandColumn && rowExpandedFlag && rowGroupExpandedFlag && treeExpandedFlag) {
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(rowExpandedMaps, (row, rowid) => {
- if (visibleDataRowIdData[rowid]) {
- expandList.push(row);
- }
- });
- }
- return expandList;
- },
- computeAutoWidthColumnList() {
- const {
- tableColumn,
- visibleColumn
- } = this;
- return tableColumn.length || visibleColumn.length ? visibleColumn.filter(column => column.width === 'auto' || column.minWidth === 'auto') : [];
- },
- computeFixedColumnSize() {
- const $xeTable = this;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- tableColumn
- } = reactData;
- const {
- collectColumn
- } = internalData;
- let fixedSize = 0;
- // 只判断第一层
- if (tableColumn.length && collectColumn.length) {
- collectColumn.forEach(column => {
- if (column.renderFixed) {
- fixedSize++;
- }
- });
- }
- return fixedSize;
- },
- fixedColumnSize() {
- const $xeTable = this;
- return $xeTable.computeFixedColumnSize;
- },
- computeIsMaxFixedColumn() {
- const $xeTable = this;
- const fixedColumnSize = $xeTable.computeFixedColumnSize;
- const columnOpts = $xeTable.columnOpts;
- const {
- maxFixedSize
- } = columnOpts;
- if (maxFixedSize) {
- return fixedColumnSize >= maxFixedSize;
- }
- return false;
- },
- computeTableBorder() {
- const $xeTable = this;
- const props = $xeTable;
- const {
- border
- } = props;
- if (border === true) {
- return 'full';
- }
- if (border) {
- return border;
- }
- return 'default';
- },
- /**
- * 判断列全选的复选框是否禁用
- */
- isAllCheckboxDisabled() {
- const {
- tableFullData,
- tableData,
- treeConfig,
- checkboxOpts
- } = this;
- const {
- strict,
- checkMethod
- } = checkboxOpts;
- if (strict) {
- if (tableData.length || tableFullData.length) {
- if (checkMethod) {
- if (treeConfig) {
- // 暂时不支持树形结构
- }
- // 如果所有行都被禁用
- return tableFullData.every(row => !checkMethod({
- row
- }));
- }
- return false;
- }
- return true;
- }
- return false;
- },
- computeVirtualScrollBars() {
- const $xeTable = this;
- const reactData = $xeTable;
- const {
- overflowX,
- scrollXLoad,
- overflowY,
- scrollYLoad
- } = reactData;
- return {
- x: overflowX && scrollXLoad,
- y: overflowY && scrollYLoad
- };
- },
- computeRowGroupFields() {
- const $xeTable = this;
- const aggregateOpts = $xeTable.computeAggregateOpts;
- return aggregateOpts.groupFields;
- },
- computeRowGroupColumns() {
- const $xeTable = this;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- rowGroupList
- } = reactData;
- const {
- fullColumnFieldData
- } = internalData;
- const rgColumns = [];
- rowGroupList.forEach(aggConf => {
- const colRest = fullColumnFieldData[aggConf.field];
- if (colRest) {
- rgColumns.push(colRest.column);
- }
- });
- return rgColumns;
- },
- tabsResizeFlag() {
- const $xeTable = this;
- const $xeTabs = $xeTable.$xeTabs;
- return $xeTabs ? $xeTabs.reactData.resizeFlag : null;
- },
- computeVxeLanguage() {
- return core_.VxeUI.getLanguage();
- },
- computeScrollbarVisible() {
- const $xeTable = this;
- const scrollbarXOpts = $xeTable.computeScrollbarXOpts;
- const scrollbarYOpts = $xeTable.computeScrollbarYOpts;
- return `${scrollbarXOpts.visible}${scrollbarYOpts.visible}`;
- }
- },
- watch: {
- data(value) {
- const $xeTable = this;
- const reactData = $xeTable;
- const {
- initStatus
- } = this;
- if (value && value.length >= 50000) {
- warnLog('vxe.error.errLargeData', ['loadData(data), reloadData(data)']);
- }
- this.loadTableData(value || [], true).then(() => {
- const {
- scrollXLoad,
- scrollYLoad,
- expandColumn
- } = reactData;
- const expandOpts = $xeTable.computeExpandOpts;
- this.inited = true;
- this.initStatus = true;
- if (!initStatus) {
- this.handleLoadDefaults();
- }
- // const checkboxColumn = this.tableFullColumn.find(column => column.type === 'checkbox')
- // if (checkboxColumn && this.tableFullData.length > 300 && !this.checkboxOpts.checkField) {
- // warnLog('vxe.error.checkProp', ['checkbox-config.checkField'])
- // }
- if ((scrollXLoad || scrollYLoad) && expandColumn && expandOpts.mode !== 'fixed') {
- warnLog('vxe.error.scrollErrProp', ['column.type=expand']);
- }
- this.recalculate();
- });
- },
- staticColumns(value) {
- this.$nextTick(() => this.handleInitColumn(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().clone(value)));
- },
- tableColumn() {
- this.analyColumnWidth();
- },
- upDataFlag() {
- this.$nextTick().then(() => this.updateData());
- },
- reColumnFlag() {
- this.$nextTick().then(() => this.refreshColumn());
- },
- computeSize() {
- this.reLayoutFlag++;
- },
- showHeader() {
- this.reLayoutFlag++;
- },
- showFooter() {
- this.reLayoutFlag++;
- },
- overflowX() {
- this.reLayoutFlag++;
- },
- overflowY() {
- this.reLayoutFlag++;
- },
- height() {
- this.reLayoutFlag++;
- },
- maxHeight() {
- this.reLayoutFlag++;
- },
- computeScrollbarXToTop() {
- this.reLayoutFlag++;
- },
- computeScrollbarYToLeft() {
- this.reLayoutFlag++;
- },
- computeVxeLanguage() {
- this.reLayoutFlag++;
- },
- computeScrollbarVisible() {
- this.reLayoutFlag++;
- },
- reLayoutFlag() {
- const $xeTable = this;
- $xeTable.$nextTick(() => $xeTable.recalculate(true));
- },
- footerData() {
- this.footFlag++;
- },
- footFlag() {
- const $xeTable = this;
- $xeTable.updateFooter();
- },
- syncResize(value) {
- const $xeTable = this;
- if (value) {
- handleUpdateResize($xeTable);
- $xeTable.$nextTick(() => {
- handleUpdateResize($xeTable);
- setTimeout(() => handleUpdateResize($xeTable));
- });
- }
- },
- tabsResizeFlag() {
- this.handleGlobalResizeEvent();
- },
- mergeCells(value) {
- const $xeTable = this;
- handleUpdateMergeBodyCells($xeTable, value);
- },
- mergeHeaderCells(value) {
- const $xeTable = this;
- handleUpdateMergeHeaderCells($xeTable, value);
- },
- mergeFooterCells() {
- this.mergeFooteCellFlag++;
- },
- mergeFooterItems() {
- this.mergeFooteCellFlag++;
- },
- mergeFooteCellFlag() {
- const $xeTable = this;
- const props = $xeTable;
- const mFooterCells = props.mergeFooterCells || props.mergeFooterItems;
- handleUpdateMergeFooterCells($xeTable, mFooterCells || []);
- },
- computeRowGroupFields(val) {
- const $xeTable = this;
- $xeTable.handleUpdateRowGroup(val);
- },
- computeRowField() {
- const $xeTable = this;
- const reactData = $xeTable;
- const internalData = $xeTable;
- // 行主键被改变,重载表格
- const {
- inited,
- tableFullData
- } = internalData;
- if (inited) {
- handleKeyField($xeTable);
- reactData.tableData = [];
- $xeTable.$nextTick(() => {
- $xeTable.reloadData(tableFullData);
- });
- }
- }
- },
- created() {
- const $xeTable = this;
- const props = $xeTable;
- const internalData = $xeTable;
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().assign(internalData, createInternalData());
- handleKeyField($xeTable);
- const {
- data,
- exportConfig,
- importConfig,
- treeConfig,
- showOverflow,
- highlightCurrentRow,
- highlightCurrentColumn
- } = props;
- const {
- scrollXStore,
- scrollYStore
- } = internalData;
- const columnOpts = $xeTable.computeColumnOpts;
- const editOpts = $xeTable.computeEditOpts;
- const treeOpts = $xeTable.computeTreeOpts;
- const radioOpts = $xeTable.computeRadioOpts;
- const checkboxOpts = $xeTable.computeCheckboxOpts;
- const expandOpts = $xeTable.computeExpandOpts;
- const rowOpts = $xeTable.computeRowOpts;
- const customOpts = $xeTable.computeCustomOpts;
- const mouseOpts = $xeTable.computeMouseOpts;
- const exportOpts = $xeTable.computeExportOpts;
- const importOpts = $xeTable.computeImportOpts;
- const currentRowOpts = $xeTable.computeCurrentRowOpts;
- const currentColumnOpts = $xeTable.computeCurrentColumnOpts;
- const keyboardOpts = $xeTable.computeKeyboardOpts;
- const aggregateOpts = $xeTable.computeAggregateOpts;
- const rowDragOpts = $xeTable.computeRowDragOpts;
- const {
- groupFields
- } = aggregateOpts;
- if (props.rowId) {
- warnLog('vxe.error.delProp', ['row-id', 'row-config.keyField']);
- }
- if (props.rowKey) {
- warnLog('vxe.error.delProp', ['row-key', 'row-config.useKey']);
- }
- if (props.columnKey) {
- warnLog('vxe.error.delProp', ['column-id', 'column-config.useKey']);
- }
- if (!(props.rowId || rowOpts.keyField) && (checkboxOpts.reserve || checkboxOpts.checkRowKeys || radioOpts.reserve || radioOpts.checkRowKey || expandOpts.expandRowKeys || treeOpts.expandRowKeys)) {
- warnLog('vxe.error.reqProp', ['row-config.keyField']);
- }
- if (props.editConfig && editOpts.showStatus && !props.keepSource) {
- warnLog('vxe.error.reqProp', ['keep-source']);
- }
- if (treeConfig && (treeOpts.showLine || treeOpts.line) && !showOverflow) {
- warnLog('vxe.error.reqProp', ['show-overflow']);
- }
- if (treeConfig && !treeOpts.transform && props.stripe) {
- warnLog('vxe.error.noTree', ['stripe']);
- }
- if (props.showFooter && !(props.footerMethod || props.footerData)) {
- warnLog('vxe.error.reqProp', ['footer-data | footer-method']);
- }
- if (rowOpts.height) {
- warnLog('vxe.error.delProp', ['row-config.height', 'cell-config.height']);
- }
- if (this.tooltipOpts.enabled) {
- warnLog('vxe.error.delProp', ['tooltip-config.enabled', 'tooltip-config.showAll']);
- }
- if (this.highlightCurrentRow) {
- warnLog('vxe.error.delProp', ['highlight-current-row', 'row-config.isCurrent']);
- }
- if (this.highlightHoverRow) {
- warnLog('vxe.error.delProp', ['highlight-hover-row', 'row-config.isHover']);
- }
- if (this.highlightCurrentColumn) {
- warnLog('vxe.error.delProp', ['highlight-current-column', 'column-config.isCurrent']);
- }
- if (this.highlightHoverColumn) {
- warnLog('vxe.error.delProp', ['highlight-hover-column', 'column-config.isHover']);
- }
- if (props.resizable) {
- warnLog('vxe.error.delProp', ['resizable', 'column-config.resizable']);
- }
- if (props.virtualXConfig && props.scrollX) {
- warnLog('vxe.error.notSupportProp', ['virtual-x-config', 'scroll-x', 'scroll-x=null']);
- }
- if (props.virtualYConfig && props.scrollY) {
- warnLog('vxe.error.notSupportProp', ['virtual-y-config', 'scroll-y', 'scroll-y=null']);
- }
- if (props.aggregateConfig && props.rowGroupConfig) {
- warnLog('vxe.error.notSupportProp', ['aggregate-config', 'row-group-config', 'row-group-config=null']);
- }
- // if (props.scrollY) {
- // warnLog('vxe.error.delProp', ['scroll-y', 'virtual-y-config'])
- // }
- // if (props.scrollX) {
- // warnLog('vxe.error.delProp', ['scroll-x', 'virtual-x-config'])
- // }
- // 检查导入导出类型,如果自定义导入导出方法,则不校验类型
- 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)) {
- 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(',')]);
- }
- 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)) {
- 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(',')]);
- }
- if (!props.id) {
- if ((props.customConfig ? isEnableConf(customOpts) : customOpts.enabled) && customOpts.storage) {
- errLog('vxe.error.reqProp', ['id']);
- }
- }
- if (treeConfig && checkboxOpts.range) {
- errLog('vxe.error.noTree', ['checkbox-config.range']);
- }
- if (rowOpts.height && !this.showOverflow) {
- warnLog('vxe.error.notProp', ['table.show-overflow']);
- }
- if (!$xeTable.triggerCellAreaModnEvent) {
- if (props.areaConfig) {
- warnLog('vxe.error.notProp', ['area-config']);
- }
- if (props.clipConfig) {
- warnLog('vxe.error.notProp', ['clip-config']);
- }
- if (props.fnrConfig) {
- warnLog('vxe.error.notProp', ['fnr-config']);
- }
- if (mouseOpts.area) {
- errLog('vxe.error.notProp', ['mouse-config.area']);
- return;
- }
- }
- if (!$xeTable.handlePivotTableAggregateData) {
- if (customOpts.allowGroup) {
- errLog('vxe.error.notProp', ['custom-config.allowGroup']);
- return;
- }
- if (customOpts.allowValues) {
- errLog('vxe.error.notProp', ['custom-config.allowValues']);
- return;
- }
- }
- if (treeConfig && rowOpts.drag && !treeOpts.transform) {
- warnLog('vxe.error.notSupportProp', ['row-config.drag', 'tree-config.transform=false', 'tree-config.transform=true']);
- }
- if (treeConfig && rowDragOpts.isCrossTableDrag && !rowDragOpts.isCrossDrag) {
- errLog('vxe.error.reqSupportProp', ['tree-config & row-drag-config.isCrossTableDrag', 'row-drag-config.isCrossDrag']);
- }
- if (props.dragConfig) {
- warnLog('vxe.error.delProp', ['drag-config', 'row-drag-config']);
- }
- if (props.rowGroupConfig) {
- warnLog('vxe.error.delProp', ['row-group-config', 'aggregate-config']);
- }
- if (aggregateOpts.countFields) {
- warnLog('vxe.error.delProp', ['row-group-config.countFields', 'column.agg-func']);
- }
- if (aggregateOpts.aggregateMethod) {
- warnLog('vxe.error.delProp', ['row-group-config.aggregateMethod', 'aggregate-config.calcValuesMethod']);
- }
- if (aggregateOpts.countMethod) {
- warnLog('vxe.error.delProp', ['aggregate-config.countMethod', 'aggregate-config.calcValuesMethod']);
- }
- if (props.treeConfig && treeOpts.children) {
- warnLog('vxe.error.delProp', ['tree-config.children', 'tree-config.childrenField']);
- }
- if (props.treeConfig && treeOpts.line) {
- warnLog('vxe.error.delProp', ['tree-config.line', 'tree-config.showLine']);
- }
- if (mouseOpts.area && mouseOpts.selected) {
- warnLog('vxe.error.errConflicts', ['mouse-config.area', 'mouse-config.selected']);
- }
- if (mouseOpts.area && props.treeConfig && !treeOpts.transform) {
- errLog('vxe.error.noTree', ['mouse-config.area']);
- }
- if (props.editConfig && editOpts.activeMethod) {
- warnLog('vxe.error.delProp', ['table.edit-config.activeMethod', 'table.edit-config.beforeEditMethod']);
- }
- if (props.treeConfig && checkboxOpts.isShiftKey) {
- errLog('vxe.error.errConflicts', ['tree-config', 'checkbox-config.isShiftKey']);
- }
- if (checkboxOpts.halfField) {
- warnLog('vxe.error.delProp', ['checkbox-config.halfField', 'checkbox-config.indeterminateField']);
- }
- if (treeConfig) {
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayEach(['rowField', 'parentField', 'childrenField', 'hasChildField', 'mapChildrenField'], key => {
- const val = treeOpts[key];
- if (val && val.indexOf('.') > -1) {
- errLog('vxe.error.errProp', [`${key}=${val}`, `${key}=${val.split('.')[0]}`]);
- }
- });
- }
- // 在 v3.0 中废弃 context-menu
- if (this.contextMenu) {
- warnLog('vxe.error.delProp', ['context-menu', 'menu-config']);
- if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isObject(this.contextMenu)) {
- warnLog('vxe.error.errProp', [`table.context-menu=${this.contextMenu}`, 'table.context-menu={}']);
- }
- }
- if (props.menuConfig && !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isObject(props.menuConfig)) {
- warnLog('vxe.error.errProp', [`table.menu-config=${props.menuConfig}`, 'table.menu-config={}']);
- }
- if (props.exportConfig && !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isObject(props.exportConfig)) {
- warnLog('vxe.error.errProp', [`table.export-config=${props.exportConfig}`, 'table.export-config={}']);
- }
- if (props.importConfig && !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isObject(props.importConfig)) {
- warnLog('vxe.error.errProp', [`table.import-config=${props.importConfig}`, 'table.import-config={}']);
- }
- if (props.printConfig && !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isObject(props.printConfig)) {
- warnLog('vxe.error.errProp', [`table.print-config=${props.printConfig}`, 'table.print-config={}']);
- }
- if (props.treeConfig && !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isObject(props.treeConfig)) {
- warnLog('vxe.error.errProp', [`table.tree-config=${props.treeConfig}`, 'table.tree-config={}']);
- }
- if (props.customConfig && !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isObject(props.customConfig)) {
- warnLog('vxe.error.errProp', [`table.custom-config=${props.customConfig}`, 'table.custom-config={}']);
- }
- if (props.editConfig && !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isObject(props.editConfig)) {
- warnLog('vxe.error.errProp', [`table.edit-config=${props.editConfig}`, 'table.edit-config={}']);
- }
- if (props.emptyRender && !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isObject(props.emptyRender)) {
- warnLog('vxe.error.errProp', [`table.empty-render=${props.emptyRender}`, 'table.empty-render={}']);
- }
- if (rowOpts.currentMethod) {
- warnLog('vxe.error.delProp', ['row-config.currentMethod', 'current-row-config.beforeSelectMethod']);
- }
- if (columnOpts.currentMethod) {
- warnLog('vxe.error.delProp', ['row-config.currentMethod', 'current-column-config.beforeSelectMethod']);
- }
- if ((rowOpts.isCurrent || highlightCurrentRow) && props.keyboardConfig && keyboardOpts.isArrow && !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isBoolean(currentRowOpts.isFollowSelected)) {
- warnLog('vxe.error.notConflictProp', ['row-config.isCurrent', 'current-row-config.isFollowSelected']);
- }
- if ((columnOpts.isCurrent || highlightCurrentColumn) && props.keyboardConfig && keyboardOpts.isArrow && !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isBoolean(currentColumnOpts.isFollowSelected)) {
- warnLog('vxe.error.notConflictProp', ['column-config.isCurrent', 'current-column-config.isFollowSelected']);
- }
- // 如果不支持虚拟滚动
- // if (props.spanMethod) {
- // if (virtualXOpts.enabled) {
- // warnLog('vxe.error.notConflictProp', ['span-method', 'virtual-x-config.enabled=false'])
- // }
- // if (virtualYOpts.enabled) {
- // warnLog('vxe.error.notConflictProp', ['span-method', 'virtual-y-config.enabled=false'])
- // }
- // }
- // if (props.footerSpanMethod) {
- // if (virtualXOpts.enabled) {
- // warnLog('vxe.error.notConflictProp', ['footer-span-method', 'virtual-x-config.enabled=false'])
- // }
- // }
- // 检查是否有安装需要的模块
- if (props.editConfig && !$xeTable.insert) {
- errLog('vxe.error.reqModule', ['Edit']);
- }
- if (props.editRules && !$xeTable.validate) {
- errLog('vxe.error.reqModule', ['Validator']);
- }
- if ((checkboxOpts.range || props.keyboardConfig || props.mouseConfig) && !$xeTable.handleCellMousedownEvent) {
- errLog('vxe.error.reqModule', ['Keyboard']);
- }
- if ((props.printConfig || props.importConfig || props.exportConfig) && !$xeTable.exportData) {
- errLog('vxe.error.reqModule', ['Export']);
- }
- Object.assign(scrollYStore, {
- startIndex: 0,
- endIndex: 1,
- visibleSize: 0
- });
- Object.assign(scrollXStore, {
- startIndex: 0,
- endIndex: 1,
- visibleSize: 0
- });
- this.handleUpdateRowGroup(groupFields);
- this.loadTableData(data, true).then(() => {
- if (data && data.length) {
- this.inited = true;
- this.initStatus = true;
- this.handleLoadDefaults();
- }
- this.handleInitDefaults();
- this.updateStyle();
- });
- table_globalEvents.on($xeTable, 'paste', this.handleGlobalPasteEvent);
- table_globalEvents.on($xeTable, 'copy', this.handleGlobalCopyEvent);
- table_globalEvents.on($xeTable, 'cut', this.handleGlobalCutEvent);
- table_globalEvents.on($xeTable, 'mousedown', this.handleGlobalMousedownEvent);
- table_globalEvents.on($xeTable, 'blur', this.handleGlobalBlurEvent);
- table_globalEvents.on($xeTable, 'mousewheel', this.handleGlobalMousewheelEvent);
- table_globalEvents.on($xeTable, 'keydown', this.handleGlobalKeydownEvent);
- table_globalEvents.on($xeTable, 'resize', this.handleGlobalResizeEvent);
- table_globalEvents.on($xeTable, 'contextmenu', this.handleGlobalContextmenuEvent);
- $xeTable.preventEvent(null, 'created');
- },
- mounted() {
- const $xeTable = this;
- const props = $xeTable;
- const internalData = $xeTable;
- const $xeGrid = $xeTable.$xeGrid;
- const $xeGantt = $xeTable.$xeGantt;
- const $xeGGWrapper = $xeGrid || $xeGantt;
- const columnOpts = $xeTable.computeColumnOpts;
- const rowOpts = $xeTable.computeRowOpts;
- const customOpts = $xeTable.computeCustomOpts;
- const virtualYOpts = $xeTable.computeVirtualYOpts;
- if ($xeGantt) {
- const classifyWrapperEl = $xeGantt.$refs.refClassifyWrapperElem;
- const teleportWrapperEl = $xeTable.$refs.refTeleportWrapper;
- if (classifyWrapperEl) {
- if (teleportWrapperEl) {
- classifyWrapperEl.appendChild(teleportWrapperEl);
- }
- internalData.teleportToWrapperElem = classifyWrapperEl;
- }
- }
- if ($xeGGWrapper) {
- const popupContainerElem = $xeGGWrapper.$refs.refPopupContainerElem;
- const popupWrapperEl = $xeTable.$refs.refPopupWrapperElem;
- if (popupContainerElem) {
- if (popupWrapperEl) {
- popupContainerElem.appendChild(popupWrapperEl);
- }
- internalData.popupToWrapperElem = popupContainerElem;
- }
- }
- if (columnOpts.drag || rowOpts.drag || customOpts.allowSort) {
- initTpImg();
- }
- const {
- $listeners
- } = this;
- if (!this.menuConfig && ($listeners['menu-click'] || $listeners['cell-menu'] || $listeners['header-cell-menu'] || $listeners['footer-cell-menu'])) {
- warnLog('vxe.error.reqProp', ['menu-config']);
- }
- if (!this.tooltipConfig && ($listeners['cell-mouseenter'] || $listeners['cell-mouseleave'])) {
- warnLog('vxe.error.reqProp', ['tooltip-config']);
- }
- $xeTable.$nextTick(() => {
- // 使用已安装的组件,如果未安装则不渲染
- const VxeUILoadingComponent = core_.VxeUI.getComponent('VxeLoading');
- const VxeUITooltipComponent = core_.VxeUI.getComponent('VxeTooltip');
- if (props.loading) {
- if (!VxeUILoadingComponent && !this.$scopedSlots.loading) {
- errLog('vxe.error.errProp', ['loading=true', 'loading=false | <template #loading>...</template>']);
- errLog('vxe.error.reqComp', ['vxe-loading']);
- }
- }
- if (props.showOverflow === true || props.showOverflow === 'tooltip' || props.showHeaderOverflow === true || props.showHeaderOverflow === 'tooltip' || props.showFooterOverflow === true || props.showFooterOverflow === 'tooltip' || props.tooltipConfig || props.editRules) {
- if (!VxeUITooltipComponent) {
- if (props.showOverflow === true) {
- errLog('vxe.error.errProp', ['show-overflow=true', 'show-overflow=title']);
- }
- if (props.showOverflow === 'tooltip') {
- errLog('vxe.error.errProp', ['show-overflow=tooltip', 'show-overflow=title']);
- }
- if (props.showHeaderOverflow === true) {
- errLog('vxe.error.errProp', ['show-header-overflow=true', 'show-header-overflow=title']);
- }
- if (props.showHeaderOverflow === 'tooltip') {
- errLog('vxe.error.errProp', ['show-header-overflow=tooltip', 'show-header-overflow=title']);
- }
- if (props.showFooterOverflow === true) {
- errLog('vxe.error.errProp', ['show-footer-overflow=true', 'show-footer-overflow=title']);
- }
- if (props.showFooterOverflow === 'tooltip') {
- errLog('vxe.error.errProp', ['show-footer-overflow=tooltip', 'show-footer-overflow=title']);
- }
- errLog('vxe.error.reqComp', ['vxe-tooltip']);
- }
- }
- if (this.autoResize) {
- const resizeObserver = table_globalResize.create(() => {
- if (this.autoResize) {
- this.handleResizeEvent();
- }
- });
- resizeObserver.observe(this.$el);
- resizeObserver.observe(this.getParentElem());
- this.$resize = resizeObserver;
- }
- });
- if (virtualYOpts.mode !== 'scroll') {
- const tableViewportEl = $xeTable.$refs.refTableViewportElem;
- if (tableViewportEl) {
- tableViewportEl.addEventListener('wheel', $xeTable.triggerBodyWheelEvent, {
- passive: false
- });
- }
- }
- $xeTable.preventEvent(null, 'mounted');
- },
- activated() {
- this.recalculate().then(() => this.refreshScroll());
- this.preventEvent(null, 'activated');
- },
- deactivated() {
- const $xeTable = this;
- const reactData = $xeTable;
- const internalData = $xeTable;
- const {
- filterStore
- } = reactData;
- if (filterStore.visible) {
- $xeTable.clearFilter();
- }
- $xeTable.closeTooltip();
- internalData.isActivated = false;
- this.preventEvent(null, 'deactivated');
- },
- beforeDestroy() {
- const $xeTable = this;
- const teleportWrapperEl = $xeTable.$refs.refTeleportWrapper;
- if (teleportWrapperEl && teleportWrapperEl.parentElement) {
- teleportWrapperEl.parentElement.removeChild(teleportWrapperEl);
- }
- const popupWrapperEl = $xeTable.$refs.refPopupWrapperElem;
- if (popupWrapperEl && popupWrapperEl.parentElement) {
- popupWrapperEl.parentElement.removeChild(popupWrapperEl);
- }
- const tableViewportEl = $xeTable.$refs.refTableViewportElem;
- if (tableViewportEl) {
- tableViewportEl.removeEventListener('wheel', $xeTable.triggerBodyWheelEvent);
- }
- if (this.$resize) {
- this.$resize.disconnect();
- }
- this.closeFilter();
- this.closeMenu();
- table_globalEvents.off($xeTable, 'paste');
- table_globalEvents.off($xeTable, 'copy');
- table_globalEvents.off($xeTable, 'cut');
- table_globalEvents.off($xeTable, 'mousedown');
- table_globalEvents.off($xeTable, 'blur');
- table_globalEvents.off($xeTable, 'mousewheel');
- table_globalEvents.off($xeTable, 'keydown');
- table_globalEvents.off($xeTable, 'resize');
- table_globalEvents.off($xeTable, 'contextmenu');
- this.preventEvent(null, 'beforeDestroy');
- },
- destroyed() {
- const $xeTable = this;
- const internalData = $xeTable;
- this.preventEvent(null, 'destroyed');
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().assign(internalData, createInternalData());
- },
- render(h) {
- // 使用已安装的组件,如果未安装则不渲染
- const VxeUILoadingComponent = core_.VxeUI.getComponent('VxeLoading');
- const VxeUITooltipComponent = core_.VxeUI.getComponent('VxeTooltip');
- const $xeTable = this;
- const $xeGrid = $xeTable.$xeGrid;
- const $xeGantt = $xeTable.$xeGantt;
- const props = $xeTable;
- const slots = $xeTable.$scopedSlots;
- const reactData = $xeTable;
- const {
- xID
- } = $xeTable;
- const {
- loading,
- stripe,
- showHeader,
- height,
- treeConfig,
- mouseConfig,
- showFooter,
- highlightCell,
- highlightHoverRow,
- highlightHoverColumn,
- editConfig,
- editRules
- } = props;
- const {
- isGroup,
- overflowX,
- overflowY,
- scrollXLoad,
- scrollYLoad,
- tableData,
- initStore,
- isRowGroupStatus,
- columnStore,
- filterStore,
- customStore,
- tooltipStore
- } = reactData;
- const {
- leftList,
- rightList
- } = columnStore;
- const loadingSlot = slots.loading;
- const tipSlots = {
- header: slots.headerTooltip || slots['header-tooltip'],
- body: slots.tooltip,
- footer: slots.footerTooltip || slots['footer-tooltip']
- };
- const currTooltipSlot = tooltipStore.visible && tooltipStore.type ? tipSlots[tooltipStore.type] : null;
- const rowDragOpts = $xeTable.computeRowDragOpts;
- const tableTipConfig = $xeTable.computeTableTipConfig;
- const validTipConfig = $xeTable.computeValidTipConfig;
- const validOpts = $xeTable.computeValidOpts;
- const checkboxOpts = $xeTable.computeCheckboxOpts;
- const treeOpts = $xeTable.computeTreeOpts;
- const rowOpts = $xeTable.computeRowOpts;
- const columnOpts = $xeTable.computeColumnOpts;
- const vSize = $xeTable.computeSize;
- const tableBorder = $xeTable.computeTableBorder;
- const mouseOpts = $xeTable.computeMouseOpts;
- const areaOpts = $xeTable.computeAreaOpts;
- const loadingOpts = $xeTable.computeLoadingOpts;
- const isContentMenu = $xeTable.computeIsContentMenu;
- const currLoading = reactData.isColLoading || reactData.isRowLoading || loading;
- const resizableOpts = $xeTable.computeResizableOpts;
- const isArea = mouseConfig && mouseOpts.area;
- const columnDragOpts = $xeTable.computeColumnDragOpts;
- const scrollbarXToTop = $xeTable.computeScrollbarXToTop;
- const scrollbarYToLeft = $xeTable.computeScrollbarYToLeft;
- const {
- isCrossTableDrag
- } = rowDragOpts;
- const tbOns = {
- keydown: this.keydownEvent
- };
- if (isCrossTableDrag && !tableData.length) {
- tbOns.dragover = $xeTable.handleCrossTableRowDragoverEmptyEvent;
- }
- return h('div', {
- ref: 'refElem',
- class: ['vxe-table', 'vxe-table--render-default', `tid_${xID}`, `border--${tableBorder}`, `sx-pos--${scrollbarXToTop ? 'top' : 'bottom'}`, `sy-pos--${scrollbarYToLeft ? 'left' : 'right'}`, {
- [`size--${vSize}`]: vSize,
- [`valid-msg--${validOpts.msgMode}`]: !!editRules,
- 'vxe-editable': !!editConfig,
- 'old-cell-valid': editRules && table_getConfig().cellVaildMode === 'obsolete',
- 'cell--highlight': highlightCell,
- 'cell--selected': mouseConfig && mouseOpts.selected,
- 'cell--area': isArea,
- 'header-cell--area': isArea && areaOpts.selectCellByHeader,
- 'body-cell--area': isArea && areaOpts.selectCellByBody,
- 'row--highlight': rowOpts.isHover || highlightHoverRow,
- 'column--highlight': columnOpts.isHover || highlightHoverColumn,
- 'checkbox--range': checkboxOpts.range,
- 'col--drag-cell': columnOpts.drag && columnDragOpts.trigger === 'cell',
- 'is--header': showHeader,
- 'is--footer': showFooter,
- 'is--group': isGroup,
- 'is-row-group': isRowGroupStatus,
- 'is--tree-line': treeConfig && (treeOpts.showLine || treeOpts.line),
- 'is--fixed-left': leftList.length,
- 'is--fixed-right': rightList.length,
- 'is--animat': !!props.animat,
- 'is--round': props.round,
- 'is--stripe': !treeConfig && stripe,
- 'is--loading': currLoading,
- 'is--empty': !currLoading && !tableData.length,
- 'is--scroll-y': overflowY,
- 'is--scroll-x': overflowX,
- 'is--virtual-x': scrollXLoad,
- 'is--virtual-y': scrollYLoad
- }],
- attrs: {
- spellcheck: false
- },
- on: tbOns
- }, [
- /**
- * 隐藏列
- */
- h('div', {
- class: 'vxe-table-slots',
- ref: 'hideColumn'
- }, this.$slots.default), h('div', {
- ref: 'refVarElem',
- class: 'vxe-table-vars'
- }, [h('div', {
- class: 'vxe-table-var-default'
- }), h('div', {
- class: 'vxe-table-var-medium'
- }), h('div', {
- class: 'vxe-table-var-small'
- }), h('div', {
- class: 'vxe-table-var-mini'
- })]), h('div', {
- key: 'tw',
- class: 'vxe-table--render-wrapper'
- }, scrollbarXToTop ? [renderScrollX(h, $xeTable), renderBody(h, $xeTable)] : [renderBody(h, $xeTable), renderScrollX(h, $xeTable)]),
- /**
- * 空数据
- */
- h('div', {
- key: 'tn',
- ref: 'refEmptyPlaceholder',
- class: 'vxe-table--empty-place-wrapper'
- }, [h('div', {
- class: 'vxe-table--empty-placeholder'
- }, [h('div', {
- class: 'vxe-table--empty-content'
- }, renderEmptyBody(h, $xeTable))])]),
- /**
- * 边框线
- */
- h('div', {
- key: 'tl',
- class: 'vxe-table--border-line'
- }),
- /**
- * 列宽线
- */
- h('div', {
- key: 'tcl',
- ref: 'refColResizeBar',
- class: 'vxe-table--resizable-col-bar'
- }, resizableOpts.showDragTip ? [h('div', {
- ref: 'refColResizeTip',
- class: 'vxe-table--resizable-number-tip'
- })] : []), h('div', {
- key: 'ttw'
- }, [h('div', {
- ref: 'refTeleportWrapper'
- }, [
- /**
- * 行高线
- */
- h('div', {
- key: 'trl',
- ref: 'refRowResizeBar',
- class: 'vxe-table--resizable-row-bar'
- }, resizableOpts.showDragTip ? [h('div', {
- class: 'vxe-table--resizable-number-tip'
- })] : []),
- /**
- * 自定义列
- */
- initStore.custom ? h(panel, {
- key: 'cs',
- ref: 'refTableCustom',
- props: {
- customStore
- }
- }) : table_renderEmptyElement($xeTable),
- /**
- * 加载中
- */
- VxeUILoadingComponent ? h(VxeUILoadingComponent, {
- key: 'lg',
- class: 'vxe-table--loading',
- props: {
- value: currLoading,
- icon: loadingOpts.icon,
- text: loadingOpts.text
- },
- scopedSlots: loadingSlot ? {
- default: () => $xeTable.callSlot(loadingSlot, {
- $table: $xeTable,
- $grid: $xeGrid,
- $gantt: $xeGantt,
- loading: currLoading
- }, h)
- } : {}
- }) : loadingSlot ? h('div', {
- class: ['vxe-loading--custom-wrapper', {
- 'is--visible': currLoading
- }]
- }, $xeTable.callSlot(loadingSlot, {
- $table: $xeTable,
- $grid: $xeGrid,
- $gantt: $xeGantt,
- loading: currLoading
- }, h)) : table_renderEmptyElement($xeTable),
- /**
- * 拖拽提示
- */
- table_renderDragTip(h, this)])]), h('div', {
- key: 'tpw'
- }, [h('div', {
- ref: 'refPopupWrapperElem'
- }, [
- /**
- * 筛选
- */
- initStore.filter ? h(filter_panel, {
- key: 'tf',
- ref: 'refTableFilter',
- props: {
- filterStore
- }
- }) : table_renderEmptyElement($xeTable),
- /**
- * 快捷菜单
- */
- isContentMenu ? h(menu_panel, {
- key: 'tm',
- ref: 'refTableMenu',
- props: {
- ctxMenuStore: this.ctxMenuStore,
- ctxMenuOpts: this.ctxMenuOpts
- }
- }) : table_renderEmptyElement($xeTable)])]),
- /**
- * 导入
- */
- initStore.import && this.importConfig ? h(import_panel, {
- key: 'it',
- props: {
- defaultOptions: this.importParams,
- storeData: this.importStore
- }
- }) : table_renderEmptyElement($xeTable),
- /**
- * 导出
- */
- initStore.export && (this.exportConfig || this.printConfig) ? h(export_panel, {
- key: 'et',
- props: {
- defaultOptions: this.exportParams,
- storeData: this.exportStore
- }
- }) : table_renderEmptyElement($xeTable), h('div', {}, [
- /**
- * 提示相关
- */
- VxeUITooltipComponent ? h(VxeUITooltipComponent, {
- key: 'ctp',
- ref: 'refCommTooltip',
- props: {
- isArrow: false,
- enterable: false
- }
- }) : table_renderEmptyElement($xeTable),
- /**
- * 工具提示
- */
- VxeUITooltipComponent ? h(VxeUITooltipComponent, {
- key: 'btp',
- ref: 'refTooltip',
- props: {
- theme: tableTipConfig.theme,
- enterable: tableTipConfig.enterable,
- enterDelay: tableTipConfig.enterDelay,
- leaveDelay: tableTipConfig.leaveDelay,
- useHTML: tableTipConfig.useHTML,
- width: tableTipConfig.width,
- height: tableTipConfig.height,
- minWidth: tableTipConfig.minWidth,
- minHeight: tableTipConfig.minHeight,
- maxWidth: tableTipConfig.maxWidth,
- maxHeight: tableTipConfig.maxHeight
- },
- scopedSlots: currTooltipSlot ? {
- content: () => {
- const {
- type,
- row,
- column,
- content: tooltipContent
- } = tooltipStore;
- if (currTooltipSlot) {
- if (column && type === 'header') {
- return h('div', {
- key: type
- }, currTooltipSlot({
- column,
- tooltipContent,
- $table: $xeTable,
- $grid: $xeGrid,
- $gantt: $xeGantt
- }));
- }
- if (row && column && type === 'body') {
- return h('div', {
- key: type
- }, currTooltipSlot({
- row,
- column,
- tooltipContent,
- $table: $xeTable,
- $grid: $xeGrid,
- $gantt: $xeGantt
- }));
- }
- if (row && column && type === 'footer') {
- return h('div', {
- key: type
- }, currTooltipSlot({
- row,
- column,
- tooltipContent,
- $table: $xeTable,
- $grid: $xeGrid,
- $gantt: $xeGantt
- }));
- }
- }
- return table_renderEmptyElement($xeTable);
- }
- } : {}
- }) : table_renderEmptyElement($xeTable),
- /**
- * 校验提示
- */
- VxeUITooltipComponent && this.editRules && validOpts.showMessage && (validOpts.message === 'default' ? !height : validOpts.message === 'tooltip') ? h(VxeUITooltipComponent, {
- key: 'vtp',
- ref: 'refValidTooltip',
- class: [{
- 'old-cell-valid': editRules && table_getConfig().cellVaildMode === 'obsolete'
- }, 'vxe-table--valid-error'],
- props: {
- theme: validTipConfig.theme,
- enterable: validTipConfig.enterable,
- enterDelay: validTipConfig.enterDelay,
- leaveDelay: validTipConfig.leaveDelay
- }
- }) : table_renderEmptyElement($xeTable)])]);
- },
- methods: methods
- });
- ;// CONCATENATED MODULE: ./packages/toolbar/src/toolbar.ts
- const {
- getConfig: toolbar_getConfig,
- getIcon: toolbar_getIcon,
- getI18n: toolbar_getI18n,
- renderer: toolbar_renderer,
- commands: toolbar_commands,
- createEvent: toolbar_createEvent,
- globalMixins: toolbar_globalMixins,
- renderEmptyElement: toolbar_renderEmptyElement
- } = core_.VxeUI;
- function toolbar_createInternalData() {
- return {
- connectTable: null
- };
- }
- /* harmony default export */ var toolbar = (/* define-vxe-component start */defineVxeComponent({
- name: 'VxeToolbar',
- mixins: [toolbar_globalMixins.sizeMixin],
- props: {
- loading: Boolean,
- refresh: [Boolean, Object],
- refreshOptions: Object,
- import: [Boolean, Object],
- importOptions: Object,
- export: [Boolean, Object],
- exportOptions: Object,
- print: [Boolean, Object],
- printOptions: Object,
- zoom: [Boolean, Object],
- zoomOptions: Object,
- custom: [Boolean, Object],
- customOptions: Object,
- buttons: {
- type: Array,
- default: () => toolbar_getConfig().toolbar.buttons
- },
- tools: {
- type: Array,
- default: () => toolbar_getConfig().toolbar.tools
- },
- perfect: {
- type: Boolean,
- default: () => toolbar_getConfig().toolbar.perfect
- },
- size: {
- type: String,
- default: () => toolbar_getConfig().toolbar.size || toolbar_getConfig().size
- },
- className: [String, Function]
- },
- inject: {
- $xeGrid: {
- default: null
- },
- $xeGantt: {
- default: null
- }
- },
- data() {
- const xID = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().uniqueId();
- const reactData = {
- isRefresh: false,
- connectFlag: 0,
- columns: []
- };
- const internalData = toolbar_createInternalData();
- return {
- xID,
- reactData,
- internalData
- };
- },
- computed: {
- ...{},
- computeRefreshOpts() {
- const $xeToolbar = this;
- const props = $xeToolbar;
- 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);
- },
- computeImportOpts() {
- const $xeToolbar = this;
- const props = $xeToolbar;
- 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);
- },
- computeExportOpts() {
- const $xeToolbar = this;
- const props = $xeToolbar;
- 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);
- },
- computePrintOpts() {
- const $xeToolbar = this;
- const props = $xeToolbar;
- 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);
- },
- computeZoomOpts() {
- const $xeToolbar = this;
- const props = $xeToolbar;
- 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);
- },
- computeCustomOpts() {
- const $xeToolbar = this;
- const props = $xeToolbar;
- 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);
- },
- computeTableCustomOpts() {
- const $xeToolbar = this;
- const reactData = $xeToolbar.reactData;
- const internalData = $xeToolbar.internalData;
- const {
- connectTable
- } = internalData;
- const $table = connectTable;
- if (reactData.connectFlag || $table) {
- if ($table) {
- return $table.computeCustomOpts;
- }
- }
- return {
- trigger: ''
- };
- },
- computeTrigger() {
- const $xeToolbar = this;
- const tableCustomOpts = $xeToolbar.computeTableCustomOpts;
- return tableCustomOpts.trigger;
- }
- },
- methods: {
- //
- // Method
- //
- dispatchEvent(type, params, evnt) {
- const $xeToolbar = this;
- $xeToolbar.$emit(type, toolbar_createEvent(evnt, {
- $toolbar: $xeToolbar
- }, params));
- },
- fintTable() {
- const {
- $children
- } = this.$parent;
- const selfIndex = $children.indexOf(this);
- 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');
- },
- syncUpdate(params) {
- const $xeToolbar = this;
- const reactData = $xeToolbar.reactData;
- const internalData = $xeToolbar.internalData;
- internalData.connectTable = params.$table;
- reactData.columns = params.collectColumn;
- reactData.connectFlag++;
- },
- checkTable() {
- const $xeToolbar = this;
- const internalData = $xeToolbar.internalData;
- const {
- connectTable
- } = internalData;
- const $table = connectTable;
- if ($table) {
- return true;
- }
- errLog('vxe.error.barUnableLink');
- },
- handleClickSettingEvent({
- $event
- }) {
- const $xeToolbar = this;
- const internalData = $xeToolbar.internalData;
- const {
- connectTable
- } = internalData;
- const $table = connectTable;
- if ($table) {
- if ($table.triggerCustomEvent) {
- $table.triggerCustomEvent($event);
- }
- }
- },
- handleMouseenterSettingEvent({
- $event
- }) {
- const $xeToolbar = this;
- const internalData = $xeToolbar.internalData;
- const {
- connectTable
- } = internalData;
- const $table = connectTable;
- if ($table) {
- $table.customOpenEvent($event);
- }
- },
- handleMouseleaveSettingEvent({
- $event
- }) {
- const $xeToolbar = this;
- const internalData = $xeToolbar.internalData;
- const {
- connectTable
- } = internalData;
- const $table = connectTable;
- if ($table) {
- const {
- customStore
- } = $table.reactData;
- customStore.activeBtn = false;
- setTimeout(() => {
- if (!customStore.activeBtn && !customStore.activeWrapper) {
- $table.customCloseEvent($event);
- }
- }, 350);
- }
- },
- refreshEvent({
- $event
- }) {
- const $xeToolbar = this;
- const reactData = $xeToolbar.reactData;
- const $xeGrid = $xeToolbar.$xeGrid;
- const $xeGantt = $xeToolbar.$xeGantt;
- const $xeGGWrapper = $xeGrid || $xeGantt;
- const {
- isRefresh
- } = reactData;
- const refreshOpts = $xeToolbar.computeRefreshOpts;
- if (!isRefresh) {
- const queryMethod = refreshOpts.queryMethod || refreshOpts.query;
- if (queryMethod) {
- reactData.isRefresh = true;
- try {
- Promise.resolve(queryMethod({})).catch(e => e).then(() => {
- reactData.isRefresh = false;
- });
- } catch (e) {
- reactData.isRefresh = false;
- }
- } else if ($xeGGWrapper) {
- reactData.isRefresh = true;
- $xeGGWrapper.triggerToolbarCommitEvent({
- code: refreshOpts.code || 'reload'
- }, $event).catch(() => {}).then(() => {
- reactData.isRefresh = false;
- });
- }
- }
- },
- zoomEvent({
- $event
- }) {
- const $xeToolbar = this;
- const $xeGrid = $xeToolbar.$xeGrid;
- const $xeGantt = $xeToolbar.$xeGantt;
- const $xeGGWrapper = $xeGrid || $xeGantt;
- if ($xeGGWrapper) {
- $xeGGWrapper.triggerZoomEvent($event);
- } else {
- warnLog('vxe.error.notProp', ['[toolbar] zoom']);
- }
- },
- importEvent() {
- const $xeToolbar = this;
- const internalData = $xeToolbar.internalData;
- if ($xeToolbar.checkTable()) {
- const {
- connectTable
- } = internalData;
- const $table = connectTable;
- if ($table) {
- $table.importData();
- }
- }
- },
- openImportEvent() {
- const $xeToolbar = this;
- const internalData = $xeToolbar.internalData;
- if ($xeToolbar.checkTable()) {
- const {
- connectTable
- } = internalData;
- const $table = connectTable;
- if ($table) {
- $table.openImport();
- }
- }
- },
- exportEvent() {
- const $xeToolbar = this;
- const internalData = $xeToolbar.internalData;
- if ($xeToolbar.checkTable()) {
- const {
- connectTable
- } = internalData;
- const $table = connectTable;
- if ($table) {
- $table.exportData();
- }
- }
- },
- openExportEvent() {
- const $xeToolbar = this;
- const internalData = $xeToolbar.internalData;
- if ($xeToolbar.checkTable()) {
- const {
- connectTable
- } = internalData;
- const $table = connectTable;
- if ($table) {
- $table.openExport();
- }
- }
- },
- printEvent() {
- const $xeToolbar = this;
- const internalData = $xeToolbar.internalData;
- if ($xeToolbar.checkTable()) {
- const {
- connectTable
- } = internalData;
- const $table = connectTable;
- if ($table) {
- $table.print();
- }
- }
- },
- openPrintEvent() {
- const $xeToolbar = this;
- const internalData = $xeToolbar.internalData;
- if ($xeToolbar.checkTable()) {
- const {
- connectTable
- } = internalData;
- const $table = connectTable;
- if ($table) {
- $table.openPrint();
- }
- }
- },
- handleDefaultCodeEvent(eventParams, item, cb) {
- const $xeToolbar = this;
- switch (item.code) {
- case 'print':
- $xeToolbar.printEvent();
- break;
- case 'open_print':
- $xeToolbar.openPrintEvent();
- break;
- case 'custom':
- $xeToolbar.handleClickSettingEvent(eventParams);
- break;
- case 'export':
- $xeToolbar.exportEvent();
- break;
- case 'open_export':
- $xeToolbar.openExportEvent();
- break;
- case 'import':
- $xeToolbar.importEvent();
- break;
- case 'open_import':
- $xeToolbar.openImportEvent();
- break;
- case 'zoom':
- $xeToolbar.zoomEvent(eventParams);
- break;
- case 'refresh':
- $xeToolbar.refreshEvent(eventParams);
- break;
- default:
- cb();
- break;
- }
- },
- btnEvent(eventParams, item) {
- const $xeToolbar = this;
- const internalData = $xeToolbar.internalData;
- const $xeGrid = $xeToolbar.$xeGrid;
- const $xeGantt = $xeToolbar.$xeGantt;
- const $xeGGWrapper = $xeGrid || $xeGantt;
- const {
- $event
- } = eventParams;
- const {
- connectTable
- } = internalData;
- const $table = connectTable;
- const {
- code
- } = item;
- if (code) {
- $xeToolbar.handleDefaultCodeEvent(eventParams, item, () => {
- if ($xeGGWrapper) {
- $xeGGWrapper.triggerToolbarBtnEvent(item, $event);
- } else {
- const gCommandOpts = toolbar_commands.get(code);
- const params = {
- code,
- button: item,
- $table: $table,
- $grid: $xeGrid,
- $gantt: $xeGantt,
- $event
- };
- if (gCommandOpts) {
- const tCommandMethod = gCommandOpts.tableCommandMethod || gCommandOpts.commandMethod;
- if (tCommandMethod) {
- tCommandMethod(params);
- } else {
- errLog('vxe.error.notCommands', [`[toolbar] ${code}`]);
- }
- }
- $xeToolbar.dispatchEvent('button-click', params, $event);
- }
- });
- }
- },
- tolEvent(eventParams, item) {
- const $xeToolbar = this;
- const internalData = $xeToolbar.internalData;
- const $xeGrid = $xeToolbar.$xeGrid;
- const $xeGantt = $xeToolbar.$xeGantt;
- const $xeGGWrapper = $xeGrid || $xeGantt;
- const {
- $event
- } = eventParams;
- const {
- connectTable
- } = internalData;
- const $table = connectTable;
- const {
- code
- } = item;
- if (code) {
- $xeToolbar.handleDefaultCodeEvent(eventParams, item, () => {
- if ($xeGGWrapper) {
- $xeGGWrapper.triggerToolbarTolEvent(item, $event);
- } else {
- const gCommandOpts = toolbar_commands.get(code);
- const params = {
- code,
- button: null,
- tool: item,
- $table: $table,
- $grid: $xeGrid,
- $gantt: $xeGantt,
- $event
- };
- if (gCommandOpts) {
- const tCommandMethod = gCommandOpts.tableCommandMethod || gCommandOpts.commandMethod;
- if (tCommandMethod) {
- tCommandMethod(params);
- } else {
- errLog('vxe.error.notCommands', [`[toolbar] ${code}`]);
- }
- }
- $xeToolbar.dispatchEvent('tool-click', params, $event);
- }
- });
- }
- },
- //
- // Render
- //
- renderDropdowns(h, item, isBtn) {
- // 使用已安装的组件,如果未安装则不渲染
- const VxeUIButtonComponent = core_.VxeUI.getComponent('VxeButton');
- const $xeToolbar = this;
- const {
- dropdowns
- } = item;
- const downVNs = [];
- if (dropdowns) {
- return dropdowns.map((child, index) => {
- if (child.visible === false) {
- return toolbar_renderEmptyElement($xeToolbar);
- }
- return VxeUIButtonComponent ? h(VxeUIButtonComponent, {
- key: index,
- props: Object.assign({}, child, {
- content: child.name,
- options: undefined
- }),
- on: {
- click: eventParams => isBtn ? $xeToolbar.btnEvent(eventParams, child) : $xeToolbar.tolEvent(eventParams, child)
- }
- }) : toolbar_renderEmptyElement($xeToolbar);
- });
- }
- return downVNs;
- },
- /**
- * 渲染按钮
- */
- renderLeftBtns(h) {
- // 使用已安装的组件,如果未安装则不渲染
- const VxeUIButtonComponent = core_.VxeUI.getComponent('VxeButton');
- const $xeToolbar = this;
- const props = $xeToolbar;
- const slots = $xeToolbar.$scopedSlots;
- const internalData = $xeToolbar.internalData;
- const $xeGrid = $xeToolbar.$xeGrid;
- const $xeGantt = $xeToolbar.$xeGantt;
- const {
- buttons
- } = props;
- const {
- connectTable
- } = internalData;
- const $table = connectTable;
- const buttonPrefixSlot = slots.buttonPrefix || slots['button-prefix'];
- const buttonSuffixSlot = slots.buttonSuffix || slots['button-suffix'];
- const btnVNs = [];
- if (buttonPrefixSlot) {
- btnVNs.push(...getSlotVNs(buttonPrefixSlot.call($xeToolbar, {
- buttons: buttons || [],
- $grid: $xeGrid,
- $gantt: $xeGantt,
- $table: $table
- })));
- }
- if (buttons) {
- buttons.forEach(item => {
- const {
- dropdowns,
- buttonRender
- } = item;
- if (item.visible !== false) {
- const compConf = buttonRender ? toolbar_renderer.get(buttonRender.name) : null;
- if (buttonRender && compConf && compConf.renderToolbarButton) {
- const toolbarButtonClassName = compConf.toolbarButtonClassName;
- const params = {
- $grid: $xeGrid,
- $gantt: $xeGantt,
- $table: $table,
- button: item
- };
- btnVNs.push(h('span', {
- class: ['vxe-button--item', toolbarButtonClassName ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(toolbarButtonClassName) ? toolbarButtonClassName(params) : toolbarButtonClassName : '']
- }, getSlotVNs(compConf.renderToolbarButton(h, buttonRender, params))));
- } else {
- if (VxeUIButtonComponent) {
- btnVNs.push(h(VxeUIButtonComponent, {
- props: Object.assign({}, item, {
- content: item.name,
- options: undefined
- }),
- on: {
- click: eventParams => $xeToolbar.btnEvent(eventParams, item)
- },
- scopedSlots: dropdowns && dropdowns.length ? {
- dropdowns: () => $xeToolbar.renderDropdowns(h, item, true)
- } : {}
- }));
- }
- }
- }
- });
- }
- if (buttonSuffixSlot) {
- btnVNs.push(...getSlotVNs(buttonSuffixSlot.call($xeToolbar, {
- buttons: buttons || [],
- $grid: $xeGrid,
- $gantt: $xeGantt,
- $table: $table
- })));
- }
- return btnVNs;
- },
- /**
- * 渲染右侧工具
- */
- renderRightTools(h) {
- // 使用已安装的组件,如果未安装则不渲染
- const VxeUIButtonComponent = core_.VxeUI.getComponent('VxeButton');
- const $xeToolbar = this;
- const props = $xeToolbar;
- const slots = $xeToolbar.$scopedSlots;
- const internalData = $xeToolbar.internalData;
- const $xeGrid = $xeToolbar.$xeGrid;
- const $xeGantt = $xeToolbar.$xeGantt;
- const {
- tools
- } = props;
- const {
- connectTable
- } = internalData;
- const $table = connectTable;
- const toolPrefixSlot = slots.toolPrefix || slots['tool-prefix'];
- const toolSuffixSlot = slots.toolSuffix || slots['tool-suffix'];
- const btnVNs = [];
- if (toolPrefixSlot) {
- btnVNs.push(...getSlotVNs(toolPrefixSlot.call($xeToolbar, {
- tools: tools || [],
- $grid: $xeGrid,
- $gantt: $xeGantt,
- $table: $table
- })));
- }
- if (tools) {
- tools.forEach((item, tIndex) => {
- const {
- dropdowns,
- toolRender
- } = item;
- if (item.visible !== false) {
- const rdName = toolRender ? toolRender.name : null;
- const compConf = toolRender ? toolbar_renderer.get(rdName) : null;
- if (toolRender && compConf && compConf.renderToolbarTool) {
- const toolbarToolClassName = compConf.toolbarToolClassName;
- const params = {
- $grid: $xeGrid,
- $gantt: $xeGantt,
- $table: $table,
- tool: item
- };
- btnVNs.push(h('span', {
- key: rdName,
- class: ['vxe-tool--item', toolbarToolClassName ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(toolbarToolClassName) ? toolbarToolClassName(params) : toolbarToolClassName : '']
- }, getSlotVNs(compConf.renderToolbarTool(h, toolRender, params))));
- } else {
- if (VxeUIButtonComponent) {
- btnVNs.push(h(VxeUIButtonComponent, {
- key: tIndex,
- props: Object.assign({}, item, {
- content: item.name,
- options: undefined
- }),
- on: {
- click: eventParams => $xeToolbar.tolEvent(eventParams, item)
- },
- scopedSlots: dropdowns && dropdowns.length ? {
- dropdowns: () => $xeToolbar.renderDropdowns(h, item, false)
- } : {}
- }));
- }
- }
- }
- });
- }
- if (toolSuffixSlot) {
- btnVNs.push(...getSlotVNs(toolSuffixSlot.call($xeToolbar, {
- tools: tools || [],
- $grid: $xeGrid,
- $gantt: $xeGantt,
- $table: $table
- })));
- }
- return btnVNs;
- },
- renderToolImport(h) {
- // 使用已安装的组件,如果未安装则不渲染
- const VxeUIButtonComponent = core_.VxeUI.getComponent('VxeButton');
- const $xeToolbar = this;
- const importOpts = $xeToolbar.computeImportOpts;
- return VxeUIButtonComponent ? h(VxeUIButtonComponent, {
- key: 'import',
- props: {
- circle: true,
- icon: importOpts.icon || toolbar_getIcon().TOOLBAR_TOOLS_IMPORT,
- title: toolbar_getI18n('vxe.toolbar.import')
- },
- on: {
- click: $xeToolbar.openImportEvent
- }
- }) : toolbar_renderEmptyElement($xeToolbar);
- },
- renderToolExport(h) {
- // 使用已安装的组件,如果未安装则不渲染
- const VxeUIButtonComponent = core_.VxeUI.getComponent('VxeButton');
- const $xeToolbar = this;
- const exportOpts = $xeToolbar.computeExportOpts;
- return VxeUIButtonComponent ? h(VxeUIButtonComponent, {
- key: 'export',
- props: {
- circle: true,
- icon: exportOpts.icon || toolbar_getIcon().TOOLBAR_TOOLS_EXPORT,
- title: toolbar_getI18n('vxe.toolbar.export')
- },
- on: {
- click: $xeToolbar.openExportEvent
- }
- }) : toolbar_renderEmptyElement($xeToolbar);
- },
- renderToolPrint(h) {
- // 使用已安装的组件,如果未安装则不渲染
- const VxeUIButtonComponent = core_.VxeUI.getComponent('VxeButton');
- const $xeToolbar = this;
- const printOpts = $xeToolbar.computePrintOpts;
- return VxeUIButtonComponent ? h(VxeUIButtonComponent, {
- key: 'print',
- props: {
- circle: true,
- icon: printOpts.icon || toolbar_getIcon().TOOLBAR_TOOLS_PRINT,
- title: toolbar_getI18n('vxe.toolbar.print')
- },
- on: {
- click: $xeToolbar.openPrintEvent
- }
- }) : toolbar_renderEmptyElement($xeToolbar);
- },
- renderToolRefresh(h) {
- // 使用已安装的组件,如果未安装则不渲染
- const VxeUIButtonComponent = core_.VxeUI.getComponent('VxeButton');
- const $xeToolbar = this;
- const reactData = $xeToolbar.reactData;
- const refreshOpts = $xeToolbar.computeRefreshOpts;
- return VxeUIButtonComponent ? h(VxeUIButtonComponent, {
- key: 'refresh',
- props: {
- circle: true,
- icon: reactData.isRefresh ? refreshOpts.iconLoading || toolbar_getIcon().TOOLBAR_TOOLS_REFRESH_LOADING : refreshOpts.icon || toolbar_getIcon().TOOLBAR_TOOLS_REFRESH,
- title: toolbar_getI18n('vxe.toolbar.refresh')
- },
- on: {
- click: $xeToolbar.refreshEvent
- }
- }) : toolbar_renderEmptyElement($xeToolbar);
- },
- renderToolZoom(h) {
- // 使用已安装的组件,如果未安装则不渲染
- const VxeUIButtonComponent = core_.VxeUI.getComponent('VxeButton');
- const $xeToolbar = this;
- const $xeGrid = $xeToolbar.$xeGrid;
- const $xeGantt = $xeToolbar.$xeGantt;
- const $xeGGWrapper = $xeGrid || $xeGantt;
- const zoomOpts = $xeToolbar.computeZoomOpts;
- return $xeGGWrapper && VxeUIButtonComponent ? h(VxeUIButtonComponent, {
- key: 'zoom',
- props: {
- circle: true,
- icon: $xeGGWrapper.isMaximized() ? zoomOpts.iconOut || toolbar_getIcon().TOOLBAR_TOOLS_MINIMIZE : zoomOpts.iconIn || toolbar_getIcon().TOOLBAR_TOOLS_FULLSCREEN,
- title: toolbar_getI18n(`vxe.toolbar.zoom${$xeGGWrapper.isMaximized() ? 'Out' : 'In'}`)
- },
- on: {
- click: $xeToolbar.zoomEvent
- }
- }) : toolbar_renderEmptyElement($xeToolbar);
- },
- renderToolCustom(h) {
- // 使用已安装的组件,如果未安装则不渲染
- const VxeUIButtonComponent = core_.VxeUI.getComponent('VxeButton');
- const $xeToolbar = this;
- const customOpts = $xeToolbar.computeCustomOpts;
- const btnTrigger = $xeToolbar.computeTrigger;
- const customBtnOns = {};
- if (btnTrigger === 'manual') {
- // 手动触发
- } else if (btnTrigger === 'hover') {
- // hover 触发
- customBtnOns.mouseenter = $xeToolbar.handleMouseenterSettingEvent;
- customBtnOns.mouseleave = $xeToolbar.handleMouseleaveSettingEvent;
- } else {
- // 点击触发
- customBtnOns.click = $xeToolbar.handleClickSettingEvent;
- }
- return VxeUIButtonComponent ? h(VxeUIButtonComponent, {
- key: 'custom',
- props: {
- circle: true,
- icon: customOpts.icon || toolbar_getIcon().TOOLBAR_TOOLS_CUSTOM,
- title: toolbar_getI18n('vxe.toolbar.custom'),
- className: 'vxe-toolbar-custom-target'
- },
- on: customBtnOns
- }) : toolbar_renderEmptyElement($xeToolbar);
- },
- renderVN(h) {
- const $xeToolbar = this;
- const props = $xeToolbar;
- const slots = $xeToolbar.$scopedSlots;
- const internalData = $xeToolbar.internalData;
- const $xeGrid = $xeToolbar.$xeGrid;
- const $xeGantt = $xeToolbar.$xeGantt;
- const $xeGGWrapper = $xeGrid || $xeGantt;
- const {
- perfect,
- loading,
- refresh,
- zoom,
- custom,
- className
- } = props;
- const {
- connectTable
- } = internalData;
- const $table = connectTable;
- const toolsSlot = slots.tools;
- const buttonsSlot = slots.buttons;
- const vSize = $xeToolbar.computeSize;
- return h('div', {
- ref: 'refElem',
- class: ['vxe-toolbar', className ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(className) ? className({
- $toolbar: $xeToolbar
- }) : className : '', {
- [`size--${vSize}`]: vSize,
- 'is--perfect': perfect,
- 'is--loading': loading
- }]
- }, [h('div', {
- class: 'vxe-buttons--wrapper'
- }, buttonsSlot ? buttonsSlot({
- $grid: $xeGrid,
- $gantt: $xeGantt,
- $table: $table
- }) : $xeToolbar.renderLeftBtns(h)), h('div', {
- class: 'vxe-tools--wrapper'
- }, toolsSlot ? toolsSlot({
- $grid: $xeGrid,
- $gantt: $xeGantt,
- $table: $table
- }) : $xeToolbar.renderRightTools(h)), h('div', {
- class: 'vxe-tools--operate'
- }, [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)])]);
- }
- },
- created() {
- const $xeToolbar = this;
- const props = $xeToolbar;
- const $xeGrid = $xeToolbar.$xeGrid;
- const $xeGantt = $xeToolbar.$xeGantt;
- const $xeGGWrapper = $xeGrid || $xeGantt;
- $xeToolbar.$nextTick(() => {
- const refreshOpts = $xeToolbar.computeRefreshOpts;
- const $xeTable = $xeToolbar.fintTable();
- const queryMethod = refreshOpts.queryMethod || refreshOpts.query;
- if (props.refresh && !$xeGGWrapper && !queryMethod) {
- warnLog('vxe.error.notFunc', ['[toolbar] queryMethod']);
- }
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isPlainObject(props.custom)) {
- warnLog('vxe.error.delProp', ['[toolbar] custom={...}', 'custom=boolean & custom-options={...}']);
- }
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isPlainObject(props.print)) {
- warnLog('vxe.error.delProp', ['[toolbar] print={...}', 'print=boolean & print-options={...}']);
- }
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isPlainObject(props.export)) {
- warnLog('vxe.error.delProp', ['[toolbar] export={...}', 'export=boolean & export-options={...}']);
- }
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isPlainObject(props.import)) {
- warnLog('vxe.error.delProp', ['[toolbar] import={...}', 'import=boolean & import-options={...}']);
- }
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isPlainObject(props.refresh)) {
- warnLog('vxe.error.delProp', ['[toolbar] refresh={...}', 'refresh=boolean & refresh-options={...}']);
- }
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isPlainObject(props.refresh)) {
- warnLog('vxe.error.delProp', ['[toolbar] zoom={...}', 'zoom=boolean & zoom-options={...}']);
- }
- if ($xeTable) {
- $xeTable.connect(this);
- }
- const customOpts = $xeToolbar.computeCustomOpts;
- if (customOpts.isFooter) {
- warnLog('vxe.error.delProp', ['[toolbar] toolbar.custom.isFooter', 'table.custom-config.showFooter']);
- }
- if (customOpts.showFooter) {
- warnLog('vxe.error.delProp', ['[toolbar] toolbar.custom.showFooter', 'table.custom-config.showFooter']);
- }
- if (customOpts.immediate) {
- warnLog('vxe.error.delProp', ['[toolbar] toolbar.custom.immediate', 'table.custom-config.immediate']);
- }
- if (customOpts.trigger) {
- warnLog('vxe.error.delProp', ['[toolbar] toolbar.custom.trigger', 'table.custom-config.trigger']);
- }
- });
- // 使用已安装的组件,如果未安装则不渲染
- const VxeUIButtonComponent = core_.VxeUI.getComponent('VxeButton');
- if (props.refresh || props.import || props.export || props.print || props.zoom) {
- if (!VxeUIButtonComponent) {
- errLog('vxe.error.reqComp', ['vxe-button']);
- }
- }
- },
- destroyed() {
- const $xeToolbar = this;
- const internalData = $xeToolbar.internalData;
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().assign(internalData, toolbar_createInternalData());
- },
- render(h) {
- return this.renderVN(h);
- }
- })); /* define-vxe-component end */
- ;// CONCATENATED MODULE: ./packages/grid/src/grid.ts
- const {
- getConfig: grid_getConfig,
- getI18n: grid_getI18n,
- commands: grid_commands,
- globalEvents: grid_globalEvents,
- globalMixins: grid_globalMixins,
- createEvent: grid_createEvent,
- GLOBAL_EVENT_KEYS: grid_GLOBAL_EVENT_KEYS,
- renderEmptyElement: grid_renderEmptyElement
- } = core_.VxeUI;
- const tableMethods = {};
- const propKeys = Object.keys(tableProps);
- const defaultLayouts = [['Form'], ['Toolbar', 'Top', 'Table', 'Bottom', 'Pager']];
- function getTableOns(_vm) {
- const {
- $listeners,
- proxyConfig,
- proxyOpts
- } = _vm;
- const ons = {};
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each($listeners, (cb, type) => {
- ons[type] = (...args) => {
- _vm.$emit(type, ...args);
- };
- });
- if (proxyConfig) {
- if (proxyOpts.sort) {
- ons['sort-change'] = _vm.sortChangeEvent;
- ons['clear-all-sort'] = _vm.clearAllSortEvent;
- }
- if (proxyOpts.filter) {
- ons['filter-change'] = _vm.filterChangeEvent;
- ons['clear-all-filter'] = _vm.clearAllFilterEvent;
- }
- }
- return ons;
- }
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(table.methods, (fn, name) => {
- tableMethods[name] = function (...args) {
- const $xeGrid = this;
- const $xeTable = $xeGrid.$refs.refTable;
- return $xeTable && $xeTable[name](...args);
- };
- });
- function grid_createInternalData() {
- return {};
- }
- /* harmony default export */ var grid = (/* define-vxe-component start */defineVxeComponent({
- name: 'VxeGrid',
- mixins: [grid_globalMixins.sizeMixin],
- props: {
- ...tableProps,
- layouts: Array,
- columns: Array,
- pagerConfig: Object,
- proxyConfig: Object,
- toolbarConfig: Object,
- formConfig: Object,
- zoomConfig: Object,
- size: {
- type: String,
- default: () => grid_getConfig().grid.size || grid_getConfig().size
- }
- },
- provide() {
- const $xeGrid = this;
- const $xeGantt = null;
- return {
- $xeGrid,
- $xeGantt
- };
- },
- data() {
- const xID = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().uniqueId();
- const reactData = {
- tableLoading: false,
- proxyInited: false,
- isZMax: false,
- tableData: [],
- filterData: [],
- formData: {},
- sortData: [],
- tZindex: 0,
- tablePage: {
- total: 0,
- pageSize: grid_getConfig().pager?.pageSize || 10,
- currentPage: 1
- }
- };
- const internalData = grid_createInternalData();
- return {
- xID,
- reactData,
- internalData
- };
- },
- computed: {
- ...{},
- isRespMsg() {
- const $xeGrid = this;
- return $xeGrid.computeIsRespMsg;
- },
- computeIsRespMsg() {
- const $xeGrid = this;
- const proxyOpts = $xeGrid.computeProxyOpts;
- return !!(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isBoolean(proxyOpts.message) ? proxyOpts.message : proxyOpts.showResponseMsg);
- },
- isActiveMsg() {
- const $xeGrid = this;
- return $xeGrid.computeIsActiveMsg;
- },
- computeIsActiveMsg() {
- const $xeGrid = this;
- const proxyOpts = $xeGrid.computeProxyOpts;
- return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isBoolean(proxyOpts.showActionMsg) ? proxyOpts.showActionMsg : !!proxyOpts.showActiveMsg;
- },
- proxyOpts() {
- const $xeGrid = this;
- return $xeGrid.computeProxyOpts;
- },
- computeProxyOpts() {
- const $xeGrid = this;
- const props = $xeGrid;
- 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);
- },
- pagerOpts() {
- const $xeGrid = this;
- return $xeGrid.computePagerOpts;
- },
- computePagerOpts() {
- const $xeGrid = this;
- const props = $xeGrid;
- return Object.assign({}, grid_getConfig().grid.pagerConfig, props.pagerConfig);
- },
- formOpts() {
- const $xeGrid = this;
- return $xeGrid.computeFormOpts;
- },
- computeFormOpts() {
- const $xeGrid = this;
- const props = $xeGrid;
- return Object.assign({}, grid_getConfig().grid.formConfig, props.formConfig);
- },
- toolbarOpts() {
- const $xeGrid = this;
- return $xeGrid.computeToolbarOpts;
- },
- computeToolbarOpts() {
- const $xeGrid = this;
- const props = $xeGrid;
- return Object.assign({}, grid_getConfig().grid.toolbarConfig, props.toolbarConfig);
- },
- zoomOpts() {
- const $xeGrid = this;
- return $xeGrid.computeZoomOpts;
- },
- computeZoomOpts() {
- const $xeGrid = this;
- const props = $xeGrid;
- return Object.assign({}, grid_getConfig().grid.zoomConfig, props.zoomConfig);
- },
- computeStyles() {
- const $xeGrid = this;
- const props = $xeGrid;
- const reactData = $xeGrid.reactData;
- const {
- height,
- maxHeight
- } = props;
- const {
- isZMax,
- tZindex
- } = reactData;
- const stys = {};
- if (isZMax) {
- stys.zIndex = tZindex;
- } else {
- if (height) {
- stys.height = height === 'auto' || height === '100%' ? '100%' : toCssUnit(height);
- }
- if (maxHeight) {
- stys.maxHeight = maxHeight === 'auto' || maxHeight === '100%' ? '100%' : toCssUnit(maxHeight);
- }
- }
- return stys;
- },
- computeTableExtendProps() {
- const $xeGrid = this;
- const props = $xeGrid;
- const rest = {};
- const gridProps = props;
- propKeys.forEach(key => {
- rest[key] = gridProps[key];
- });
- return rest;
- },
- computeTableProps() {
- const $xeGrid = this;
- const props = $xeGrid;
- const reactData = $xeGrid.reactData;
- const {
- seqConfig,
- pagerConfig,
- editConfig,
- proxyConfig
- } = props;
- const {
- isZMax,
- tablePage
- } = reactData;
- const tableExtendProps = $xeGrid.computeTableExtendProps;
- const proxyOpts = $xeGrid.computeProxyOpts;
- const pagerOpts = $xeGrid.computePagerOpts;
- const isLoading = $xeGrid.computeIsLoading;
- const tProps = Object.assign({}, tableExtendProps);
- if (isZMax) {
- if (tableExtendProps.maxHeight) {
- tProps.maxHeight = '100%';
- } else {
- tProps.height = '100%';
- }
- }
- if (proxyConfig && isEnableConf(proxyOpts)) {
- tProps.loading = isLoading;
- if (pagerConfig && proxyOpts.seq && isEnableConf(pagerOpts)) {
- tProps.seqConfig = Object.assign({}, seqConfig, {
- startIndex: (tablePage.currentPage - 1) * tablePage.pageSize
- });
- }
- }
- if (editConfig) {
- tProps.editConfig = Object.assign({}, editConfig);
- }
- return tProps;
- },
- tableProps() {
- const $xeGrid = this;
- return $xeGrid.computeTableProps;
- },
- computeCurrLayoutConf() {
- const $xeGrid = this;
- const props = $xeGrid;
- const {
- layouts
- } = props;
- let confs = [];
- if (layouts && layouts.length) {
- confs = layouts;
- } else {
- confs = grid_getConfig().grid.layouts || defaultLayouts;
- }
- let headKeys = [];
- let bodyKeys = [];
- let footKeys = [];
- if (confs.length) {
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(confs[0])) {
- headKeys = confs[0];
- bodyKeys = confs[1] || [];
- footKeys = confs[2] || [];
- } else {
- bodyKeys = confs;
- }
- }
- return {
- headKeys,
- bodyKeys,
- footKeys
- };
- },
- computeCustomCurrentPageFlag() {
- const $xeGrid = this;
- const pagerOpts = $xeGrid.computePagerOpts;
- return pagerOpts.currentPage;
- },
- computeCustomPageSizeFlag() {
- const $xeGrid = this;
- const pagerOpts = $xeGrid.computePagerOpts;
- return pagerOpts.pageSize;
- },
- computeCustomTotalFlag() {
- const $xeGrid = this;
- const pagerOpts = $xeGrid.computePagerOpts;
- return pagerOpts.total;
- },
- computePageCount() {
- const $xeGrid = this;
- const reactData = $xeGrid.reactData;
- const {
- tablePage
- } = reactData;
- return Math.max(Math.ceil(tablePage.total / tablePage.pageSize), 1);
- },
- computeIsLoading() {
- const $xeGrid = this;
- const props = $xeGrid;
- const reactData = $xeGrid.reactData;
- const {
- loading,
- proxyConfig
- } = props;
- const {
- tableLoading
- } = reactData;
- const proxyOpts = $xeGrid.computeProxyOpts;
- const {
- showLoading
- } = proxyOpts;
- return loading || tableLoading && showLoading && proxyConfig && isEnableConf(proxyOpts);
- }
- },
- watch: {
- columns(value) {
- const $xeGrid = this;
- $xeGrid.$nextTick(() => $xeGrid.loadColumn(value));
- },
- toolbar(value) {
- const $xeGrid = this;
- if (value) {
- $xeGrid.initToolbar();
- }
- },
- toolbarConfig(value) {
- const $xeGrid = this;
- if (value) {
- $xeGrid.initToolbar();
- }
- },
- proxyConfig() {
- const $xeGrid = this;
- $xeGrid.initProxy();
- },
- computeCustomCurrentPageFlag() {
- const $xeGrid = this;
- $xeGrid.initPages('currentPage');
- },
- computeCustomPageSizeFlag() {
- const $xeGrid = this;
- $xeGrid.initPages('pageSize');
- },
- computeCustomTotalFlag() {
- const $xeGrid = this;
- $xeGrid.initPages('total');
- }
- },
- methods: {
- ...tableMethods,
- dispatchEvent(type, params, evnt) {
- const $xeGrid = this;
- $xeGrid.$emit(type, grid_createEvent(evnt, {
- $grid: $xeGrid,
- $gantt: null
- }, params));
- },
- initPages(propKey) {
- const $xeGrid = this;
- const props = $xeGrid;
- const reactData = $xeGrid.reactData;
- const {
- tablePage
- } = reactData;
- const {
- pagerConfig
- } = props;
- const pagerOpts = $xeGrid.computePagerOpts;
- if (pagerConfig && isEnableConf(pagerOpts)) {
- if (propKey) {
- if (pagerOpts[propKey]) {
- tablePage[propKey] = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(pagerOpts[propKey]);
- }
- } else {
- const {
- currentPage,
- pageSize,
- total
- } = pagerOpts;
- if (currentPage) {
- tablePage.currentPage = currentPage;
- }
- if (pageSize) {
- tablePage.pageSize = pageSize;
- }
- if (total) {
- tablePage.total = total;
- }
- }
- }
- },
- callSlot(slotFunc, params, h) {
- const $xeGrid = this;
- const slots = $xeGrid.$scopedSlots;
- if (slotFunc) {
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(slotFunc)) {
- slotFunc = slots[slotFunc] || null;
- }
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(slotFunc)) {
- return getSlotVNs(slotFunc.call(this, params, h));
- }
- }
- return [];
- },
- getEl() {
- const $xeGrid = this;
- return $xeGrid.$refs.refElem;
- },
- /**
- * 获取需要排除的高度
- */
- getExcludeHeight() {
- const $xeGrid = this;
- const props = $xeGrid;
- const reactData = $xeGrid.reactData;
- const {
- height
- } = props;
- const {
- isZMax
- } = reactData;
- const el = $xeGrid.$refs.refElem;
- if (el) {
- const formWrapper = $xeGrid.$refs.refFormWrapper;
- const toolbarWrapper = $xeGrid.$refs.refToolbarWrapper;
- const topWrapper = $xeGrid.$refs.refTopWrapper;
- const bottomWrapper = $xeGrid.$refs.refBottomWrapper;
- const pagerWrapper = $xeGrid.$refs.refPagerWrapper;
- const parentEl = el.parentElement;
- let parentPaddingSize = 0;
- if (parentEl && (height === '100%' || height === 'auto')) {
- parentPaddingSize = isZMax ? 0 : getPaddingTopBottomSize(parentEl);
- }
- return parentPaddingSize + getPaddingTopBottomSize(el) + getOffsetHeight(formWrapper) + getOffsetHeight(toolbarWrapper) + getOffsetHeight(topWrapper) + getOffsetHeight(bottomWrapper) + getOffsetHeight(pagerWrapper);
- }
- return 0;
- },
- getParentHeight() {
- const $xeGrid = this;
- const reactData = $xeGrid.reactData;
- const el = $xeGrid.$refs.refElem;
- if (el) {
- const parentEl = el.parentElement;
- 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();
- }
- return 0;
- },
- initToolbar() {
- const $xeGrid = this;
- $xeGrid.$nextTick(() => {
- const $xeTable = $xeGrid.$refs.refTable;
- const $xeToolbar = $xeGrid.$refs.refToolbar;
- if ($xeTable && $xeToolbar) {
- $xeTable.connectToolbar($xeToolbar);
- }
- });
- },
- getDefaultFormData() {
- const $xeGrid = this;
- const formOpts = $xeGrid.computeFormOpts;
- if (formOpts.items) {
- const fData = {};
- formOpts.items.forEach(item => {
- const {
- field,
- itemRender
- } = item;
- if (field) {
- let itemValue = null;
- if (itemRender) {
- const {
- startField,
- endField,
- defaultValue
- } = itemRender;
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(defaultValue)) {
- itemValue = defaultValue({
- item
- });
- } else if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isUndefined(defaultValue)) {
- itemValue = defaultValue;
- }
- if (startField && endField) {
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(fData, startField, null);
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(fData, endField, null);
- }
- }
- fData[field] = itemValue;
- }
- });
- return fData;
- }
- return {};
- },
- initProxy() {
- const $xeGrid = this;
- const props = $xeGrid;
- const reactData = $xeGrid.reactData;
- const {
- proxyConfig,
- formConfig
- } = props;
- const {
- proxyInited
- } = reactData;
- const proxyOpts = $xeGrid.computeProxyOpts;
- const formOpts = $xeGrid.computeFormOpts;
- if (proxyConfig) {
- if (isEnableConf(formConfig) && proxyOpts.form && formOpts.items) {
- reactData.formData = $xeGrid.getDefaultFormData();
- }
- if (!proxyInited && proxyOpts.autoLoad !== false) {
- reactData.proxyInited = true;
- $xeGrid.$nextTick().then(() => $xeGrid.commitProxy('initial')).then(rest => {
- $xeGrid.dispatchEvent('proxy-query', {
- ...rest,
- isInited: true
- }, new Event('initial'));
- });
- }
- }
- },
- handleGlobalKeydownEvent(evnt) {
- const $xeGrid = this;
- const reactData = $xeGrid.reactData;
- const zoomOpts = $xeGrid.computeZoomOpts;
- const isEsc = grid_globalEvents.hasKey(evnt, grid_GLOBAL_EVENT_KEYS.ESCAPE);
- if (isEsc && reactData.isZMax && zoomOpts.escRestore !== false) {
- $xeGrid.triggerZoomEvent(evnt);
- }
- },
- getRespMsg(rest, defaultMsg) {
- const $xeGrid = this;
- const proxyOpts = $xeGrid.computeProxyOpts;
- const resConfigs = proxyOpts.response || proxyOpts.props || {};
- const messageProp = resConfigs.message;
- const $xeTable = $xeGrid.$refs.refTable;
- let msg;
- if (rest && messageProp) {
- msg = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(messageProp) ? messageProp({
- data: rest,
- $table: $xeTable,
- $grid: $xeGrid,
- $gantt: null
- }) : external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(rest, messageProp);
- }
- return msg || grid_getI18n(defaultMsg);
- },
- handleDeleteRow(code, alertKey, callback) {
- const $xeGrid = this;
- const isActiveMsg = $xeGrid.computeIsActiveMsg;
- const selectRecords = $xeGrid.getCheckboxRecords();
- if (isActiveMsg) {
- if (selectRecords.length) {
- if (core_.VxeUI.modal) {
- return core_.VxeUI.modal.confirm({
- id: `cfm_${code}`,
- content: grid_getI18n(alertKey),
- escClosable: true
- }).then(type => {
- if (type === 'confirm') {
- return callback();
- }
- });
- }
- } else {
- if (core_.VxeUI.modal) {
- core_.VxeUI.modal.message({
- id: `msg_${code}`,
- content: grid_getI18n('vxe.grid.selectOneRecord'),
- status: 'warning'
- });
- }
- }
- } else {
- if (selectRecords.length) {
- callback();
- }
- }
- return Promise.resolve();
- },
- triggerPendingEvent(code) {
- const $xeGrid = this;
- const isActiveMsg = $xeGrid.computeIsActiveMsg;
- const $xeTable = $xeGrid.$refs.refTable;
- const selectRecords = $xeTable.getCheckboxRecords();
- if (selectRecords.length) {
- $xeTable.togglePendingRow(selectRecords);
- $xeGrid.clearCheckboxRow();
- } else {
- if (isActiveMsg) {
- if (core_.VxeUI.modal) {
- core_.VxeUI.modal.message({
- id: code,
- content: grid_getI18n('vxe.grid.selectOneRecord'),
- status: 'warning'
- });
- }
- }
- }
- },
- /**
- * 提交指令,支持 code 或 button
- * @param {String/Object} code 字符串或对象
- */
- commitProxy(proxyTarget, ...args) {
- const $xeGrid = this;
- const props = $xeGrid;
- const reactData = $xeGrid.reactData;
- /**
- * 已废弃
- * @deprecated
- */
- const toolbar = props.toolbar;
- const {
- proxyConfig,
- toolbarConfig,
- pagerConfig,
- editRules,
- validConfig
- } = props;
- const {
- tablePage
- } = reactData;
- const isActiveMsg = $xeGrid.computeIsActiveMsg;
- const isRespMsg = $xeGrid.computeIsRespMsg;
- const proxyOpts = $xeGrid.computeProxyOpts;
- const pagerOpts = $xeGrid.computePagerOpts;
- const toolbarOpts = $xeGrid.computeToolbarOpts;
- const {
- beforeQuery,
- afterQuery,
- beforeDelete,
- afterDelete,
- beforeSave,
- afterSave,
- ajax = {}
- } = proxyOpts;
- const resConfigs = proxyOpts.response || proxyOpts.props || {};
- const $xeTable = $xeGrid.$refs.refTable;
- let formData = $xeGrid.getFormData();
- let button = null;
- let code = null;
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(proxyTarget)) {
- const {
- buttons
- } = toolbarOpts;
- 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, {
- children: 'dropdowns'
- }) : null;
- button = matchObj ? matchObj.item : null;
- code = proxyTarget;
- } else {
- button = proxyTarget;
- code = button.code;
- }
- const btnParams = button ? button.params : null;
- switch (code) {
- case 'insert':
- return $xeTable.insert({});
- case 'insert_edit':
- return $xeTable.insert({}).then(({
- row
- }) => $xeTable.setEditRow(row, true));
- // 已废弃
- case 'insert_actived':
- return $xeTable.insert({}).then(({
- row
- }) => $xeTable.setEditRow(row, true));
- // 已废弃
- case 'mark_cancel':
- $xeGrid.triggerPendingEvent(code);
- break;
- case 'remove':
- return $xeGrid.handleDeleteRow(code, 'vxe.grid.removeSelectRecord', () => $xeTable.removeCheckboxRow());
- case 'import':
- $xeTable.importData(btnParams);
- break;
- case 'open_import':
- $xeTable.openImport(btnParams);
- break;
- case 'export':
- $xeTable.exportData(btnParams);
- break;
- case 'open_export':
- $xeTable.openExport(btnParams);
- break;
- case 'reset_custom':
- $xeTable.resetCustom(true);
- break;
- case 'initial':
- case 'reload':
- case 'query':
- {
- const ajaxMethods = ajax.query;
- const querySuccessMethods = ajax.querySuccess;
- const queryErrorMethods = ajax.queryError;
- if (ajaxMethods) {
- const isInited = code === 'initial';
- const isReload = code === 'reload';
- if (!isInited && reactData.tableLoading) {
- return $xeGrid.$nextTick();
- }
- let operPromise = null;
- let sortList = [];
- let filterList = [];
- let pageParams = {};
- if (pagerConfig) {
- if (isInited || isReload) {
- tablePage.currentPage = 1;
- }
- if (isEnableConf(pagerConfig)) {
- pageParams = {
- ...tablePage
- };
- }
- }
- if (isInited) {
- // 重置代理表单数据
- if (proxyConfig && isEnableConf(proxyOpts) && proxyOpts.form) {
- formData = $xeGrid.getDefaultFormData();
- reactData.formData = formData;
- }
- if ($xeTable) {
- const tableInternalData = $xeTable;
- const {
- tableFullColumn,
- fullColumnFieldData
- } = tableInternalData;
- const sortOpts = $xeTable.computeSortOpts;
- let defaultSort = sortOpts.defaultSort;
- tableFullColumn.forEach(column => {
- column.order = null;
- });
- // 如果使用默认排序
- if (defaultSort) {
- if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(defaultSort)) {
- defaultSort = [defaultSort];
- }
- sortList = defaultSort.map(item => {
- const {
- field,
- order
- } = item;
- const colRest = fullColumnFieldData[field];
- if (colRest) {
- const column = colRest.column;
- if (column) {
- column.order = order;
- }
- }
- return {
- field,
- property: field,
- order
- };
- });
- }
- filterList = $xeTable.getCheckedFilters();
- }
- } else {
- if ($xeTable) {
- if (isReload) {
- operPromise = $xeTable.clearAll();
- } else {
- sortList = $xeTable.getSortColumns();
- filterList = $xeTable.getCheckedFilters();
- }
- }
- }
- const commitParams = {
- $table: $xeTable,
- $grid: $xeGrid,
- $gantt: null,
- code,
- button,
- isInited,
- isReload,
- page: pageParams,
- sort: sortList.length ? sortList[0] : {},
- sorts: sortList,
- filters: filterList,
- form: formData,
- options: ajaxMethods
- };
- reactData.sortData = sortList;
- reactData.filterData = filterList;
- reactData.tableLoading = true;
- return Promise.all([Promise.resolve((beforeQuery || ajaxMethods)(commitParams, ...args)), operPromise]).then(([rest]) => {
- let tableData = [];
- reactData.tableLoading = false;
- if (rest) {
- if (pagerConfig && isEnableConf(pagerOpts)) {
- const totalProp = resConfigs.total;
- const total = (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(totalProp) ? totalProp({
- data: rest,
- $table: $xeTable,
- $grid: $xeGrid,
- $gantt: null
- }) : external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(rest, totalProp || 'page.total')) || 0;
- tablePage.total = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(total);
- const resultProp = resConfigs.result;
- tableData = (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(resultProp) ? resultProp({
- data: rest,
- $table: $xeTable,
- $grid: $xeGrid,
- $gantt: null
- }) : external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(rest, resultProp || 'result')) || [];
- // 检验当前页码,不能超出当前最大页数
- const pageCount = Math.max(Math.ceil(total / tablePage.pageSize), 1);
- if (tablePage.currentPage > pageCount) {
- tablePage.currentPage = pageCount;
- }
- } else {
- const listProp = resConfigs.list;
- tableData = (listProp ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(listProp) ? listProp({
- data: rest,
- $table: $xeTable,
- $grid: $xeGrid,
- $gantt: null
- }) : external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(rest, listProp) : rest) || [];
- }
- }
- if ($xeTable) {
- $xeTable.loadData(tableData);
- } else {
- $xeGrid.$nextTick(() => {
- const $xeTable = $xeGrid.$refs.refTable;
- if ($xeTable) {
- $xeTable.loadData(tableData);
- }
- });
- }
- if (afterQuery) {
- afterQuery(commitParams, ...args);
- }
- if (querySuccessMethods) {
- querySuccessMethods({
- ...commitParams,
- response: rest
- });
- }
- return {
- status: true
- };
- }).catch(rest => {
- reactData.tableLoading = false;
- if (queryErrorMethods) {
- queryErrorMethods({
- ...commitParams,
- response: rest
- });
- }
- return {
- status: false
- };
- });
- } else {
- errLog('vxe.error.notFunc', ['[grid] proxy-config.ajax.query']);
- }
- break;
- }
- case 'delete':
- {
- const ajaxMethods = ajax.delete;
- const deleteSuccessMethods = ajax.deleteSuccess;
- const deleteErrorMethods = ajax.deleteError;
- if (ajaxMethods) {
- const selectRecords = $xeTable.getCheckboxRecords();
- const removeRecords = selectRecords.filter(row => !$xeTable.isInsertByRow(row));
- const body = {
- removeRecords
- };
- const commitParams = {
- $table: $xeTable,
- $grid: $xeGrid,
- $gantt: null,
- code,
- button,
- body,
- form: formData,
- options: ajaxMethods
- };
- const applyArgs = [commitParams].concat(args);
- if (selectRecords.length) {
- return $xeGrid.handleDeleteRow(code, 'vxe.grid.deleteSelectRecord', () => {
- if (!removeRecords.length) {
- return $xeTable.remove(selectRecords);
- }
- reactData.tableLoading = true;
- return Promise.resolve((beforeDelete || ajaxMethods)(...applyArgs)).then(rest => {
- reactData.tableLoading = false;
- $xeTable.setPendingRow(removeRecords, false);
- if (isRespMsg) {
- if (core_.VxeUI.modal) {
- core_.VxeUI.modal.message({
- content: $xeGrid.getRespMsg(rest, 'vxe.grid.delSuccess'),
- status: 'success'
- });
- }
- }
- if (afterDelete) {
- afterDelete(...applyArgs);
- } else {
- $xeGrid.commitProxy('query');
- }
- if (deleteSuccessMethods) {
- deleteSuccessMethods({
- ...commitParams,
- response: rest
- });
- }
- return {
- status: true
- };
- }).catch(rest => {
- reactData.tableLoading = false;
- if (isRespMsg) {
- if (core_.VxeUI.modal) {
- core_.VxeUI.modal.message({
- id: code,
- content: $xeGrid.getRespMsg(rest, 'vxe.grid.operError'),
- status: 'error'
- });
- }
- }
- if (deleteErrorMethods) {
- deleteErrorMethods({
- ...commitParams,
- response: rest
- });
- }
- return {
- status: false
- };
- });
- });
- } else {
- if (isActiveMsg) {
- if (core_.VxeUI.modal) {
- core_.VxeUI.modal.message({
- id: code,
- content: grid_getI18n('vxe.grid.selectOneRecord'),
- status: 'warning'
- });
- }
- }
- }
- } else {
- errLog('vxe.error.notFunc', ['[grid] proxy-config.ajax.delete']);
- }
- break;
- }
- case 'save':
- {
- const ajaxMethods = ajax.save;
- const saveSuccessMethods = ajax.saveSuccess;
- const saveErrorMethods = ajax.saveError;
- if (ajaxMethods) {
- const body = $xeGrid.getRecordset();
- const {
- insertRecords,
- removeRecords,
- updateRecords,
- pendingRecords
- } = body;
- const commitParams = {
- $table: $xeTable,
- $grid: $xeGrid,
- $gantt: null,
- code,
- button,
- body,
- form: formData,
- options: ajaxMethods
- };
- const applyArgs = [commitParams].concat(args);
- // 排除掉新增且标记为删除的数据
- if (insertRecords.length) {
- body.pendingRecords = pendingRecords.filter(row => insertRecords.indexOf(row) === -1);
- }
- // 排除已标记为删除的数据
- if (pendingRecords.length) {
- body.insertRecords = insertRecords.filter(row => pendingRecords.indexOf(row) === -1);
- }
- let restPromise = Promise.resolve();
- if (editRules) {
- // 只校验新增和修改的数据
- restPromise = $xeGrid[validConfig && validConfig.msgMode === 'full' ? 'fullValidate' : 'validate'](body.insertRecords.concat(updateRecords));
- }
- return restPromise.then(errMap => {
- if (errMap) {
- // 如果校验不通过
- return;
- }
- if (body.insertRecords.length || removeRecords.length || updateRecords.length || body.pendingRecords.length) {
- reactData.tableLoading = true;
- return Promise.resolve((beforeSave || ajaxMethods)(...applyArgs)).then(rest => {
- reactData.tableLoading = false;
- $xeTable.clearPendingRow();
- if (isRespMsg) {
- if (core_.VxeUI.modal) {
- core_.VxeUI.modal.message({
- content: $xeGrid.getRespMsg(rest, 'vxe.grid.saveSuccess'),
- status: 'success'
- });
- }
- }
- if (afterSave) {
- afterSave(...applyArgs);
- } else {
- $xeGrid.commitProxy('query');
- }
- if (saveSuccessMethods) {
- saveSuccessMethods({
- ...commitParams,
- response: rest
- });
- }
- return {
- status: true
- };
- }).catch(rest => {
- reactData.tableLoading = false;
- if (isRespMsg) {
- if (core_.VxeUI.modal) {
- core_.VxeUI.modal.message({
- id: code,
- content: $xeGrid.getRespMsg(rest, 'vxe.grid.operError'),
- status: 'error'
- });
- }
- }
- if (saveErrorMethods) {
- saveErrorMethods({
- ...commitParams,
- response: rest
- });
- }
- return {
- status: false
- };
- });
- } else {
- if (isActiveMsg) {
- if (core_.VxeUI.modal) {
- core_.VxeUI.modal.message({
- id: code,
- content: grid_getI18n('vxe.grid.dataUnchanged'),
- status: 'info'
- });
- }
- }
- }
- });
- } else {
- errLog('vxe.error.notFunc', ['[grid] proxy-config.ajax.save']);
- }
- break;
- }
- default:
- {
- const gCommandOpts = grid_commands.get(code);
- if (gCommandOpts) {
- const tCommandMethod = gCommandOpts.tableCommandMethod || gCommandOpts.commandMethod;
- if (tCommandMethod) {
- tCommandMethod({
- code,
- button,
- $grid: $xeGrid,
- $table: $xeTable,
- $gantt: null
- }, ...args);
- } else {
- errLog('vxe.error.notCommands', [`[grid] ${code}`]);
- }
- }
- }
- }
- return $xeGrid.$nextTick();
- },
- getFormData() {
- const $xeGrid = this;
- const props = $xeGrid;
- const reactData = $xeGrid.reactData;
- const {
- proxyConfig
- } = props;
- const {
- formData
- } = reactData;
- const proxyOpts = $xeGrid.computeProxyOpts;
- const formOpts = $xeGrid.computeFormOpts;
- return proxyConfig && isEnableConf(proxyOpts) && proxyOpts.form ? formData : formOpts.data;
- },
- getFormItems(itemIndex) {
- const $xeGrid = this;
- const props = $xeGrid;
- const formOpts = $xeGrid.computeFormOpts;
- const {
- formConfig
- } = props;
- const {
- items
- } = formOpts;
- const itemList = [];
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(formConfig && isEnableConf(formOpts) && items ? items : [], item => {
- itemList.push(item);
- }, {
- children: 'children'
- });
- return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isUndefined(itemIndex) ? itemList : itemList[itemIndex];
- },
- resetForm() {
- const $xeGrid = this;
- const $form = $xeGrid.$refs.refForm;
- if ($form) {
- return $form.reset();
- }
- return $xeGrid.$nextTick();
- },
- validateForm() {
- const $xeGrid = this;
- const $form = $xeGrid.$refs.refForm;
- if ($form) {
- return $form.validate();
- }
- return $xeGrid.$nextTick();
- },
- validateFormField(field) {
- const $xeGrid = this;
- const $form = $xeGrid.$refs.refForm;
- if ($form) {
- return $form.validateField(field);
- }
- return $xeGrid.$nextTick();
- },
- clearFormValidate(field) {
- const $xeGrid = this;
- const $form = $xeGrid.$refs.refForm;
- if ($form) {
- return $form.clearValidate(field);
- }
- return $xeGrid.$nextTick();
- },
- homePage() {
- const $xeGrid = this;
- const reactData = $xeGrid.reactData;
- const {
- tablePage
- } = reactData;
- tablePage.currentPage = 1;
- return $xeGrid.$nextTick();
- },
- homePageByEvent(evnt) {
- const $xeGrid = this;
- const $pager = $xeGrid.$refs.refPager;
- if ($pager) {
- $pager.homePageByEvent(evnt);
- }
- },
- endPage() {
- const $xeGrid = this;
- const reactData = $xeGrid.reactData;
- const {
- tablePage
- } = reactData;
- const pageCount = $xeGrid.computePageCount;
- tablePage.currentPage = pageCount;
- return $xeGrid.$nextTick();
- },
- endPageByEvent(evnt) {
- const $xeGrid = this;
- const $pager = $xeGrid.$refs.refPager;
- if ($pager) {
- $pager.endPageByEvent(evnt);
- }
- },
- getCurrentPage() {
- const $xeGrid = this;
- const reactData = $xeGrid.reactData;
- const {
- tablePage
- } = reactData;
- return tablePage.currentPage;
- },
- setCurrentPage(currentPage) {
- const $xeGrid = this;
- const reactData = $xeGrid.reactData;
- const {
- tablePage
- } = reactData;
- const pageCount = $xeGrid.computePageCount;
- tablePage.currentPage = Math.min(pageCount, Math.max(1, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(currentPage)));
- return $xeGrid.$nextTick();
- },
- setCurrentPageByEvent(evnt, currentPage) {
- const $xeGrid = this;
- const $pager = $xeGrid.$refs.refPager;
- if ($pager) {
- $pager.setCurrentPageByEvent(evnt, currentPage);
- }
- },
- getPageSize() {
- const $xeGrid = this;
- const reactData = $xeGrid.reactData;
- const {
- tablePage
- } = reactData;
- return tablePage.pageSize;
- },
- setPageSize(pageSize) {
- const $xeGrid = this;
- const reactData = $xeGrid.reactData;
- const {
- tablePage
- } = reactData;
- tablePage.pageSize = Math.max(1, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(pageSize));
- return $xeGrid.$nextTick();
- },
- setPageSizeByEvent(evnt, pageSize) {
- const $xeGrid = this;
- const $pager = $xeGrid.$refs.refPager;
- if ($pager) {
- $pager.setPageSizeByEvent(evnt, pageSize);
- }
- },
- triggerToolbarCommitEvent(params, evnt) {
- const $xeGrid = this;
- const {
- code
- } = params;
- return $xeGrid.commitProxy(params, evnt).then(rest => {
- if (code && rest && rest.status && ['query', 'reload', 'delete', 'save'].includes(code)) {
- $xeGrid.dispatchEvent(code === 'delete' || code === 'save' ? `proxy-${code}` : 'proxy-query', {
- ...rest,
- isReload: code === 'reload'
- }, evnt);
- }
- });
- },
- triggerToolbarBtnEvent(button, evnt) {
- const $xeGrid = this;
- $xeGrid.triggerToolbarCommitEvent(button, evnt);
- $xeGrid.dispatchEvent('toolbar-button-click', {
- code: button.code,
- button
- }, evnt);
- },
- triggerToolbarTolEvent(tool, evnt) {
- const $xeGrid = this;
- $xeGrid.triggerToolbarCommitEvent(tool, evnt);
- $xeGrid.dispatchEvent('toolbar-tool-click', {
- code: tool.code,
- tool
- }, evnt);
- },
- pageChangeEvent(params) {
- const $xeGrid = this;
- const props = $xeGrid;
- const reactData = $xeGrid.reactData;
- const {
- proxyConfig
- } = props;
- const {
- tablePage
- } = reactData;
- const {
- $event,
- currentPage,
- pageSize
- } = params;
- const proxyOpts = $xeGrid.computeProxyOpts;
- tablePage.currentPage = currentPage;
- tablePage.pageSize = pageSize;
- $xeGrid.dispatchEvent('page-change', params, $event);
- if (proxyConfig && isEnableConf(proxyOpts)) {
- $xeGrid.commitProxy('query').then(rest => {
- $xeGrid.dispatchEvent('proxy-query', rest, $event);
- });
- }
- },
- handleSortEvent(params) {
- const $xeGrid = this;
- const props = $xeGrid;
- const reactData = $xeGrid.reactData;
- const $xeTable = $xeGrid.$refs.refTable;
- const {
- proxyConfig
- } = props;
- const proxyOpts = $xeGrid.computeProxyOpts;
- const sortOpts = $xeTable.computeSortOpts;
- // 如果是服务端排序
- if (sortOpts.remote) {
- reactData.sortData = params.sortList;
- if (proxyConfig && isEnableConf(proxyOpts)) {
- reactData.tablePage.currentPage = 1;
- $xeGrid.commitProxy('query').then(rest => {
- $xeGrid.dispatchEvent('proxy-query', rest, params.$event);
- });
- }
- }
- },
- sortChangeEvent(params) {
- const $xeGrid = this;
- $xeGrid.handleSortEvent(params);
- $xeGrid.dispatchEvent('sort-change', params, params.$event);
- },
- clearAllSortEvent(params) {
- const $xeGrid = this;
- $xeGrid.handleSortEvent(params);
- $xeGrid.dispatchEvent('clear-all-sort', params, params.$event);
- },
- handleFilterEvent(params) {
- const $xeGrid = this;
- const props = $xeGrid;
- const reactData = $xeGrid.reactData;
- const $xeTable = $xeGrid.$refs.refTable;
- const {
- proxyConfig
- } = props;
- const proxyOpts = $xeGrid.computeProxyOpts;
- const filterOpts = $xeTable.computeFilterOpts;
- // 如果是服务端过滤
- if (filterOpts.remote) {
- reactData.filterData = params.filterList;
- if (proxyConfig && isEnableConf(proxyOpts)) {
- reactData.tablePage.currentPage = 1;
- $xeGrid.commitProxy('query').then(rest => {
- $xeGrid.dispatchEvent('proxy-query', rest, params.$event);
- });
- }
- }
- },
- filterChangeEvent(params) {
- const $xeGrid = this;
- $xeGrid.handleFilterEvent(params);
- $xeGrid.dispatchEvent('filter-change', params, params.$event);
- },
- clearAllFilterEvent(params) {
- const $xeGrid = this;
- $xeGrid.handleFilterEvent(params);
- $xeGrid.dispatchEvent('clear-all-filter', params, params.$event);
- },
- submitFormEvent(params) {
- const $xeGrid = this;
- const props = $xeGrid;
- const reactData = $xeGrid.reactData;
- const {
- proxyConfig
- } = props;
- const proxyOpts = $xeGrid.computeProxyOpts;
- if (reactData.tableLoading) {
- return;
- }
- if (proxyConfig && isEnableConf(proxyOpts)) {
- $xeGrid.commitProxy('reload').then(rest => {
- $xeGrid.dispatchEvent('proxy-query', {
- ...rest,
- isReload: true
- }, params.$event);
- });
- }
- $xeGrid.dispatchEvent('form-submit', params, params.$event);
- },
- resetFormEvent(params) {
- const $xeGrid = this;
- const props = $xeGrid;
- const $xeTable = $xeGrid.$refs.refTable;
- const {
- proxyConfig
- } = props;
- const {
- $event
- } = params;
- const proxyOpts = $xeGrid.computeProxyOpts;
- if (proxyConfig && isEnableConf(proxyOpts)) {
- $xeTable.clearScroll();
- $xeGrid.commitProxy('reload').then(rest => {
- $xeGrid.dispatchEvent('proxy-query', {
- ...rest,
- isReload: true
- }, $event);
- });
- }
- $xeGrid.dispatchEvent('form-reset', params, $event);
- },
- submitInvalidEvent(params) {
- const $xeGrid = this;
- $xeGrid.dispatchEvent('form-submit-invalid', params, params.$event);
- },
- collapseEvent(params) {
- const $xeGrid = this;
- const {
- $event
- } = params;
- $xeGrid.dispatchEvent('form-toggle-collapse', params, $event);
- $xeGrid.dispatchEvent('form-collapse', params, $event);
- },
- triggerZoomEvent(evnt) {
- const $xeGrid = this;
- const reactData = $xeGrid.reactData;
- $xeGrid.zoom();
- $xeGrid.dispatchEvent('zoom', {
- type: reactData.isZMax ? 'max' : 'revert'
- }, evnt);
- },
- getParams() {
- const $xeGrid = this;
- const props = $xeGrid;
- return props.params;
- },
- zoom() {
- const $xeGrid = this;
- const reactData = $xeGrid.reactData;
- if (reactData.isZMax) {
- return $xeGrid.revert();
- }
- return $xeGrid.maximize();
- },
- isMaximized() {
- const $xeGrid = this;
- const reactData = $xeGrid.reactData;
- return reactData.isZMax;
- },
- maximize() {
- const $xeGrid = this;
- return $xeGrid.handleZoom(true);
- },
- revert() {
- const $xeGrid = this;
- return $xeGrid.handleZoom();
- },
- handleZoom(isMax) {
- const $xeGrid = this;
- const reactData = $xeGrid.reactData;
- const {
- isZMax
- } = reactData;
- if (isMax ? !isZMax : isZMax) {
- reactData.isZMax = !isZMax;
- if (reactData.tZindex < getLastZIndex()) {
- reactData.tZindex = nextZIndex();
- }
- }
- return $xeGrid.$nextTick().then(() => $xeGrid.recalculate(true)).then(() => {
- setTimeout(() => $xeGrid.recalculate(true), 15);
- return reactData.isZMax;
- });
- },
- getProxyInfo() {
- const $xeGrid = this;
- const props = $xeGrid;
- const $xeTable = $xeGrid.$refs.refTable;
- const reactData = $xeGrid.reactData;
- if (props.proxyConfig) {
- const {
- sortData
- } = reactData;
- return {
- data: $xeTable ? $xeTable.getFullData() : [],
- filter: reactData.filterData,
- form: $xeGrid.getFormData(),
- sort: sortData.length ? sortData[0] : {},
- sorts: sortData,
- pager: reactData.tablePage,
- pendingRecords: $xeTable ? $xeTable.getPendingRecords() : []
- };
- }
- return null;
- },
- loadColumn(columns) {
- const $xeGrid = this;
- const slots = $xeGrid.$scopedSlots;
- const $xeTable = $xeGrid.$refs.refTable;
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(columns, column => {
- if (column.slots) {
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(column.slots, func => {
- if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(func)) {
- if (!slots[func]) {
- errLog('vxe.error.notSlot', [`[grid] ${func}`]);
- }
- }
- });
- }
- });
- return $xeTable.loadColumn(columns);
- },
- reloadColumn(columns) {
- const $xeGrid = this;
- $xeGrid.clearAll();
- return $xeGrid.loadColumn(columns);
- },
- getConfigSlot(slotConfigs) {
- const $xeGrid = this;
- const slots = $xeGrid.$scopedSlots;
- const slotConf = {};
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().objectMap(slotConfigs, (slotFunc, slotKey) => {
- if (slotFunc) {
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(slotFunc)) {
- if (slots[slotFunc]) {
- slotConf[slotKey] = slots[slotFunc];
- } else {
- errLog('vxe.error.notSlot', [`[grid] ${slotFunc}`]);
- }
- } else {
- slotConf[slotKey] = slotFunc;
- }
- }
- });
- return slotConf;
- },
- getToolbarSlots() {
- const $xeGrid = this;
- const slots = $xeGrid.$scopedSlots;
- const toolbarOpts = $xeGrid.computeToolbarOpts;
- const toolbarOptSlots = toolbarOpts.slots;
- const toolbarSlots = {};
- if (slots.buttons && (!toolbarOptSlots || toolbarOptSlots.buttons !== 'buttons')) {
- warnLog('vxe.error.reqProp', ['[grid] toolbar-config.slots.buttons']);
- }
- if (slots.tools && (!toolbarOptSlots || toolbarOptSlots.tools !== 'tools')) {
- warnLog('vxe.error.reqProp', ['[grid] toolbar-config.slots.tools']);
- }
- if (toolbarOptSlots) {
- const buttonsSlot = $xeGrid.getFuncSlot(toolbarOptSlots, 'buttons');
- const buttonPrefixSlot = $xeGrid.getFuncSlot(toolbarOptSlots, 'buttonPrefix');
- const buttonSuffixSlot = $xeGrid.getFuncSlot(toolbarOptSlots, 'buttonSuffix');
- const toolsSlot = $xeGrid.getFuncSlot(toolbarOptSlots, 'tools');
- const toolPrefixSlot = $xeGrid.getFuncSlot(toolbarOptSlots, 'toolPrefix');
- const toolSuffixSlot = $xeGrid.getFuncSlot(toolbarOptSlots, 'toolSuffix');
- if (buttonsSlot) {
- toolbarSlots.buttons = buttonsSlot;
- }
- if (buttonPrefixSlot) {
- toolbarSlots.buttonPrefix = buttonPrefixSlot;
- }
- if (buttonSuffixSlot) {
- toolbarSlots.buttonSuffix = buttonSuffixSlot;
- }
- if (toolsSlot) {
- toolbarSlots.tools = toolsSlot;
- }
- if (toolPrefixSlot) {
- toolbarSlots.toolPrefix = toolPrefixSlot;
- }
- if (toolSuffixSlot) {
- toolbarSlots.toolSuffix = toolSuffixSlot;
- }
- }
- return toolbarSlots;
- },
- getFuncSlot(optSlots, slotKey) {
- const $xeGrid = this;
- const slots = $xeGrid.$scopedSlots;
- const funcSlot = optSlots[slotKey];
- if (funcSlot) {
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(funcSlot)) {
- if (slots[funcSlot]) {
- return slots[funcSlot];
- } else {
- errLog('vxe.error.notSlot', [`[grid] ${funcSlot}`]);
- }
- } else {
- return funcSlot;
- }
- }
- return null;
- },
- //
- // Render
- //
- renderDefaultForm(h) {
- const VxeUIFormComponent = core_.VxeUI.getComponent('VxeForm');
- const $xeGrid = this;
- const props = $xeGrid;
- const slots = $xeGrid.$scopedSlots;
- const reactData = $xeGrid.reactData;
- const {
- proxyConfig,
- formConfig
- } = props;
- const {
- formData
- } = reactData;
- const proxyOpts = $xeGrid.computeProxyOpts;
- const formOpts = $xeGrid.computeFormOpts;
- if (isEnableConf(formConfig) && formOpts.items && formOpts.items.length) {
- const formSlots = {};
- if (!formOpts.inited) {
- formOpts.inited = true;
- const beforeItem = proxyOpts.beforeItem;
- if (proxyOpts && beforeItem) {
- formOpts.items.forEach(item => {
- beforeItem.call($xeGrid, {
- $grid: $xeGrid,
- $gantt: null,
- item
- });
- });
- }
- }
- // 处理插槽
- formOpts.items.forEach(item => {
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(item.slots, func => {
- if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(func)) {
- if (slots[func]) {
- formSlots[func] = slots[func];
- }
- }
- });
- });
- return [VxeUIFormComponent ? h(VxeUIFormComponent, {
- props: Object.assign({}, formOpts, {
- data: proxyConfig && proxyOpts.form ? formData : formOpts.data
- }),
- on: {
- submit: $xeGrid.submitFormEvent,
- reset: $xeGrid.resetFormEvent,
- collapse: $xeGrid.collapseEvent,
- 'submit-invalid': $xeGrid.submitInvalidEvent
- },
- scopedSlots: formSlots
- }) : grid_renderEmptyElement($xeGrid)];
- }
- return [];
- },
- renderForm(h) {
- const $xeGrid = this;
- const props = $xeGrid;
- const slots = $xeGrid.$scopedSlots;
- const {
- formConfig
- } = props;
- const formSlot = slots.form;
- const hasForm = !!(formSlot || isEnableConf(formConfig));
- if (hasForm) {
- return h('div', {
- key: 'form',
- ref: 'refFormWrapper',
- class: 'vxe-grid--form-wrapper'
- }, formSlot ? formSlot.call($xeGrid, {
- $grid: $xeGrid,
- $gantt: null
- }) : $xeGrid.renderDefaultForm(h));
- }
- return grid_renderEmptyElement($xeGrid);
- },
- renderToolbar(h) {
- const $xeGrid = this;
- const props = $xeGrid;
- const slots = $xeGrid.$scopedSlots;
- const {
- toolbarConfig
- } = props;
- const toolbarSlot = slots.toolbar;
- const toolbarOpts = $xeGrid.computeToolbarOpts;
- if (toolbarConfig && isEnableConf(toolbarOpts) || toolbarSlot) {
- return h('div', {
- key: 'toolbar',
- ref: 'refToolbarWrapper',
- class: 'vxe-grid--toolbar-wrapper'
- }, toolbarSlot ? toolbarSlot.call($xeGrid, {
- $grid: $xeGrid,
- $gantt: null
- }) : [h(toolbar, {
- props: Object.assign({}, toolbarOpts, {
- slots: undefined
- }),
- ref: 'refToolbar',
- scopedSlots: $xeGrid.getToolbarSlots()
- })]);
- }
- return grid_renderEmptyElement($xeGrid);
- },
- renderTop(h) {
- const $xeGrid = this;
- const slots = $xeGrid.$scopedSlots;
- const topSlot = slots.top;
- return topSlot ? h('div', {
- key: 'top',
- ref: 'refTopWrapper',
- class: 'vxe-grid--top-wrapper'
- }, topSlot.call($xeGrid, {
- $grid: $xeGrid,
- $gantt: null
- })) : grid_renderEmptyElement($xeGrid);
- },
- renderTableLeft(h) {
- const $xeGrid = this;
- const slots = $xeGrid.$scopedSlots;
- const leftSlot = slots.left;
- if (leftSlot) {
- return h('div', {
- class: 'vxe-grid--left-wrapper'
- }, leftSlot({
- $grid: $xeGrid,
- $gantt: null
- }));
- }
- return grid_renderEmptyElement($xeGrid);
- },
- renderTableRight(h) {
- const $xeGrid = this;
- const slots = $xeGrid.$scopedSlots;
- const rightSlot = slots.right;
- if (rightSlot) {
- return h('div', {
- class: 'vxe-grid--right-wrapper'
- }, rightSlot({
- $grid: $xeGrid,
- $gantt: null
- }));
- }
- return grid_renderEmptyElement($xeGrid);
- },
- renderTable(h) {
- const $xeGrid = this;
- const slots = $xeGrid.$scopedSlots;
- const tableProps = $xeGrid.computeTableProps;
- return h('div', {
- class: 'vxe-grid--table-wrapper'
- }, [h(table, {
- key: 'table',
- props: tableProps,
- on: getTableOns($xeGrid),
- scopedSlots: slots,
- ref: 'refTable'
- })]);
- },
- renderBottom(h) {
- const $xeGrid = this;
- const slots = $xeGrid.$scopedSlots;
- const bottomSlot = slots.bottom;
- return bottomSlot ? h('div', {
- key: 'bottom',
- ref: 'refBottomWrapper',
- class: 'vxe-grid--bottom-wrapper'
- }, bottomSlot.call($xeGrid, {
- $grid: $xeGrid,
- $gantt: null
- })) : grid_renderEmptyElement($xeGrid);
- },
- renderPager(h) {
- const VxeUIPagerComponent = core_.VxeUI.getComponent('VxePager');
- const $xeGrid = this;
- const props = $xeGrid;
- const slots = $xeGrid.$scopedSlots;
- const reactData = $xeGrid.reactData;
- const {
- proxyConfig,
- pagerConfig
- } = props;
- const proxyOpts = $xeGrid.computeProxyOpts;
- const pagerOpts = $xeGrid.computePagerOpts;
- const pagerSlot = slots.pager;
- if (pagerConfig && isEnableConf(pagerOpts) || slots.pager) {
- return h('div', {
- ref: 'refPagerWrapper',
- key: 'pager',
- class: 'vxe-grid--pager-wrapper'
- }, pagerSlot ? pagerSlot.call($xeGrid, {
- $grid: $xeGrid,
- $gantt: null
- }) : [VxeUIPagerComponent ? h(VxeUIPagerComponent, {
- ref: 'refPager',
- props: {
- ...pagerOpts,
- ...(proxyConfig && isEnableConf(proxyOpts) ? reactData.tablePage : {})
- },
- on: {
- 'page-change': $xeGrid.pageChangeEvent
- },
- scopedSlots: $xeGrid.getConfigSlot(pagerOpts.slots)
- }) : grid_renderEmptyElement($xeGrid)]);
- }
- return grid_renderEmptyElement($xeGrid);
- },
- renderChildLayout(h, layoutKeys) {
- const $xeGrid = this;
- const childVNs = [];
- layoutKeys.forEach(key => {
- switch (key) {
- case 'Form':
- childVNs.push($xeGrid.renderForm(h));
- break;
- case 'Toolbar':
- childVNs.push($xeGrid.renderToolbar(h));
- break;
- case 'Top':
- childVNs.push($xeGrid.renderTop(h));
- break;
- case 'Table':
- childVNs.push(h('div', {
- key: 'table',
- class: 'vxe-grid--table-container'
- }, [$xeGrid.renderTableLeft(h), $xeGrid.renderTable(h), $xeGrid.renderTableRight(h)]));
- break;
- case 'Bottom':
- childVNs.push($xeGrid.renderBottom(h));
- break;
- case 'Pager':
- childVNs.push($xeGrid.renderPager(h));
- break;
- default:
- errLog('vxe.error.notProp', [`[grid] layouts -> ${key}`]);
- break;
- }
- });
- return childVNs;
- },
- renderLayout(h) {
- const $xeGrid = this;
- const slots = $xeGrid.$scopedSlots;
- const currLayoutConf = $xeGrid.computeCurrLayoutConf;
- const {
- headKeys,
- bodyKeys,
- footKeys
- } = currLayoutConf;
- const asideLeftSlot = slots.asideLeft || slots['aside-left'];
- const asideRightSlot = slots.asideRight || slots['aside-right'];
- return [h('div', {
- class: 'vxe-grid--layout-header-wrapper'
- }, $xeGrid.renderChildLayout(h, headKeys)), h('div', {
- class: 'vxe-grid--layout-body-wrapper'
- }, [asideLeftSlot ? h('div', {
- class: 'vxe-grid--layout-aside-left-wrapper'
- }, asideLeftSlot({})) : grid_renderEmptyElement($xeGrid), h('div', {
- class: 'vxe-grid--layout-body-content-wrapper'
- }, $xeGrid.renderChildLayout(h, bodyKeys)), asideRightSlot ? h('div', {
- class: 'vxe-grid--layout-aside-right-wrapper'
- }, asideRightSlot({})) : grid_renderEmptyElement($xeGrid)]), h('div', {
- class: 'vxe-grid--layout-footer-wrapper'
- }, $xeGrid.renderChildLayout(h, footKeys)), h('div', {
- ref: 'refPopupContainerElem'
- })];
- },
- renderVN(h) {
- const $xeGrid = this;
- const props = $xeGrid;
- const reactData = $xeGrid.reactData;
- const vSize = $xeGrid.computeSize;
- const styles = $xeGrid.computeStyles;
- const isLoading = $xeGrid.computeIsLoading;
- return h('div', {
- ref: 'refElem',
- class: ['vxe-grid', {
- [`size--${vSize}`]: vSize,
- 'is--animat': !!props.animat,
- 'is--round': props.round,
- 'is--maximize': reactData.isZMax,
- 'is--loading': isLoading
- }],
- style: styles
- }, $xeGrid.renderLayout(h));
- }
- },
- created() {
- // 使用已安装的组件,如果未安装则不渲染
- const VxeUIFormComponent = core_.VxeUI.getComponent('VxeForm');
- const VxeUIPagerComponent = core_.VxeUI.getComponent('VxePager');
- const $xeGrid = this;
- const props = $xeGrid;
- const proxyOpts = $xeGrid.computeProxyOpts;
- // const { data, formOpts, proxyOpts, proxyConfig } = this
- // if (proxyConfig && (data || (proxyOpts.form && formOpts.data))) {
- // errLog('vxe.error.errConflicts', ['[grid] data', 'proxy-config'])
- // }
- if (props.toolbar) {
- errLog('vxe.error.delProp', ['[grid] toolbar', 'toolbar-config']);
- }
- if (props.toolbarConfig && !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isObject(props.toolbarConfig)) {
- errLog('vxe.error.errProp', [`[grid] toolbar-config=${props.toolbarConfig}`, 'toolbar-config={}']);
- }
- if (proxyOpts.props) {
- warnLog('vxe.error.delProp', ['[grid] proxy-config.props', 'proxy-config.response']);
- }
- $xeGrid.$nextTick(() => {
- if (props.formConfig) {
- if (!VxeUIFormComponent) {
- errLog('vxe.error.reqComp', ['vxe-form']);
- }
- }
- if (props.pagerConfig) {
- if (!VxeUIPagerComponent) {
- errLog('vxe.error.reqComp', ['vxe-pager']);
- }
- }
- });
- $xeGrid.initPages();
- grid_globalEvents.on($xeGrid, 'keydown', $xeGrid.handleGlobalKeydownEvent);
- },
- mounted() {
- const $xeGrid = this;
- const props = $xeGrid;
- const {
- columns
- } = props;
- if (columns && columns.length) {
- $xeGrid.loadColumn(columns);
- }
- $xeGrid.initToolbar();
- $xeGrid.initProxy();
- },
- destroyed() {
- const $xeGrid = this;
- const internalData = $xeGrid.internalData;
- grid_globalEvents.off($xeGrid, 'keydown');
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().assign(internalData, grid_createInternalData());
- },
- render(h) {
- return this.renderVN(h);
- }
- })); /* define-vxe-component end */
- ;// CONCATENATED MODULE: ./packages/grid/index.ts
- let isReg = false;
- const VxeGrid = Object.assign({}, grid, {
- install(app) {
- if (!isReg) {
- isReg = true;
- if (core_.VxeUI.dynamicApp) {
- core_.VxeUI.dynamicApp.component(grid.name, grid);
- }
- }
- app.component(grid.name, grid);
- }
- });
- core_.VxeUI.component(grid);
- const Grid = VxeGrid;
- /* harmony default export */ var packages_grid = ((/* unused pure expression or super */ null && (VxeGrid)));
- // EXTERNAL MODULE: external {"commonjs":"vue","commonjs2":"vue","root":"Vue"}
- var external_commonjs_vue_commonjs2_vue_root_Vue_ = __webpack_require__(9274);
- var external_commonjs_vue_commonjs2_vue_root_Vue_default = /*#__PURE__*/__webpack_require__.n(external_commonjs_vue_commonjs2_vue_root_Vue_);
- ;// CONCATENATED MODULE: ./packages/table/render/index.ts
- const {
- getConfig: render_getConfig,
- renderer: render_renderer,
- getI18n: render_getI18n,
- getComponent
- } = core_.VxeUI;
- const componentDefaultModelProp = 'value';
- const defaultCompProps = {};
- function handleDefaultValue(value, defaultVal, initVal) {
- 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;
- }
- function parseDate(value, props) {
- return value && props.valueFormat ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toStringDate(value, props.valueFormat) : value;
- }
- function getFormatDate(value, props, defaultFormat) {
- const {
- dateConfig = {}
- } = props;
- return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toDateString(parseDate(value, props), dateConfig.labelFormat || defaultFormat);
- }
- function getLabelFormatDate(value, props) {
- return getFormatDate(value, props, render_getI18n(`vxe.input.date.labelFormat.${props.type || 'date'}`));
- }
- /**
- * 已废弃
- * @deprecated
- */
- function getOldComponentName(name) {
- return `vxe-${name.replace('$', '')}`;
- }
- /**
- * 已废弃
- * @deprecated
- */
- function getOldComponent({
- name
- }) {
- return getOldComponentName(name);
- }
- function getDefaultComponent({
- name
- }) {
- return getComponent(name) || name;
- }
- function updateFilterChangeOption(params, checked, option) {
- const {
- $table
- } = params;
- $table.updateFilterOptionStatus(option, checked);
- }
- function saveFilterEvent(params) {
- const {
- $table,
- column
- } = params;
- $table.saveFilterByEvent(new Event('change'), column);
- }
- function getNativeAttrs(renderOpts) {
- let {
- name,
- attrs
- } = renderOpts;
- if (name === 'input') {
- attrs = Object.assign({
- type: 'text'
- }, attrs);
- }
- return attrs;
- }
- function getInputImmediateModel(renderOpts) {
- const {
- name,
- immediate,
- props
- } = renderOpts;
- if (!immediate) {
- if (name === 'VxeInput' || name === '$input') {
- const {
- type
- } = props || {};
- return !(!type || type === 'text' || type === 'number' || type === 'integer' || type === 'float');
- }
- if (name === 'input' || name === 'textarea' || name === '$textarea') {
- return false;
- }
- return true;
- }
- return immediate;
- }
- function getCellEditProps(renderOpts, params, value, defaultProps) {
- return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().assign({
- immediate: getInputImmediateModel(renderOpts)
- }, defaultCompProps, defaultProps, renderOpts.props, {
- [componentDefaultModelProp]: value
- });
- }
- function getCellEditFilterProps(renderOpts, params, value, defaultProps) {
- return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().assign({}, defaultCompProps, defaultProps, renderOpts.props, {
- [componentDefaultModelProp]: value
- });
- }
- function isImmediateCell(renderOpts, params) {
- return params.$type === 'cell' || getInputImmediateModel(renderOpts);
- }
- function getCellLabelVNs(h, renderOpts, params, cellLabel, opts) {
- const {
- placeholder
- } = renderOpts;
- return [h('span', {
- class: ['vxe-cell--label', opts ? opts.class : '']
- }, placeholder && isEmptyValue(cellLabel) ? [h('span', {
- class: 'vxe-cell--placeholder'
- }, formatText(getFuncText(placeholder), 1))] : formatText(cellLabel, 1))];
- }
- /**
- * 原生事件处理
- * @param renderOpts
- * @param params
- * @param modelFunc
- * @param changeFunc
- */
- function getNativeElementOns(renderOpts, params, eFns) {
- const {
- events
- } = renderOpts;
- const modelEvent = getModelEvent(renderOpts);
- const changeEvent = getChangeEvent(renderOpts);
- const {
- model: modelFunc,
- change: changeFunc,
- blur: blurFunc
- } = eFns || {};
- const isSameEvent = changeEvent === modelEvent;
- const ons = {};
- if (events) {
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().objectEach(events, (func, key) => {
- ons[getOnName(key)] = function (...args) {
- func(params, ...args);
- };
- });
- }
- if (modelFunc) {
- ons[getOnName(modelEvent)] = function (targetEvnt) {
- modelFunc(targetEvnt);
- if (isSameEvent && changeFunc) {
- changeFunc(targetEvnt);
- }
- if (events && events[modelEvent]) {
- events[modelEvent](params, targetEvnt);
- }
- };
- }
- if (!isSameEvent && changeFunc) {
- ons[getOnName(changeEvent)] = function (evnt) {
- changeFunc(evnt);
- if (events && events[changeEvent]) {
- events[changeEvent](params, evnt);
- }
- };
- }
- if (blurFunc) {
- ons[getOnName(blurEvent)] = function (evnt) {
- blurFunc(evnt);
- if (events && events[blurEvent]) {
- events[blurEvent](params, evnt);
- }
- };
- }
- return ons;
- }
- const blurEvent = 'blur';
- const clearEvent = 'clear';
- /**
- * 组件事件处理
- * @param renderOpts
- * @param params
- * @param modelFunc
- * @param changeFunc
- */
- function getComponentOns(renderOpts, params, eFns, eventOns) {
- const {
- events
- } = renderOpts;
- const modelEvent = getModelEvent(renderOpts);
- const changeEvent = getChangeEvent(renderOpts);
- const {
- model: modelFunc,
- change: changeFunc,
- blur: blurFunc,
- clear: clearFunc
- } = eFns || {};
- const ons = {};
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().objectEach(events, (func, key) => {
- ons[getOnName(key)] = function (...args) {
- if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(func)) {
- errLog('vxe.error.errFunc', [func]);
- }
- func(params, ...args);
- };
- });
- if (modelFunc) {
- ons[getOnName(modelEvent)] = function (targetEvnt) {
- modelFunc(targetEvnt);
- if (events && events[modelEvent]) {
- events[modelEvent](params, targetEvnt);
- }
- };
- }
- if (changeFunc) {
- ons[getOnName(changeEvent)] = function (...args) {
- changeFunc(...args);
- if (events && events[changeEvent]) {
- events[changeEvent](params, ...args);
- }
- };
- }
- if (blurFunc) {
- ons[getOnName(blurEvent)] = function (...args) {
- blurFunc(...args);
- if (events && events[blurEvent]) {
- events[blurEvent](params, ...args);
- }
- };
- }
- if (clearFunc) {
- ons[getOnName(clearEvent)] = function (...args) {
- clearFunc(...args);
- if (events && events[clearEvent]) {
- events[clearEvent](params, ...args);
- }
- };
- }
- return eventOns ? Object.assign(ons, eventOns) : ons;
- }
- function getEditOns(renderOpts, params) {
- const {
- $table,
- row,
- column
- } = params;
- const {
- name
- } = renderOpts;
- const {
- model
- } = column;
- const isImmediate = isImmediateCell(renderOpts, params);
- return getComponentOns(renderOpts, params, {
- model(cellValue) {
- // 处理 model 值双向绑定
- model.update = true;
- model.value = cellValue;
- if (isImmediate) {
- setCellValue(row, column, cellValue);
- }
- },
- change(eventParams) {
- // 处理 change 事件相关逻辑
- if (!isImmediate && name && ['VxeInput', 'VxeNumberInput', 'VxeTextarea', '$input', '$textarea'].includes(name)) {
- const cellValue = eventParams.value;
- model.update = true;
- model.value = cellValue;
- $table.updateStatus(params, cellValue);
- } else {
- $table.updateStatus(params);
- }
- },
- blur() {
- if (isImmediate) {
- $table.handleCellRuleUpdateStatus('blur', params);
- } else {
- $table.handleCellRuleUpdateStatus('blur', params, model.value);
- }
- }
- });
- }
- function getFilterOns(renderOpts, params, option) {
- return getComponentOns(renderOpts, params, {
- model(value) {
- // 处理 model 值双向绑定
- option.data = value;
- },
- change() {
- updateFilterChangeOption(params, !isEmptyValue(option.data), option);
- },
- blur() {
- updateFilterChangeOption(params, !isEmptyValue(option.data), option);
- }
- });
- }
- function getFloatingFilterOns(renderOpts, params, option) {
- const {
- $table,
- column
- } = params;
- if (hasInputType(renderOpts)) {
- return getComponentOns(renderOpts, params, {
- model(value) {
- // 处理 model 值双向绑定
- option.data = value;
- },
- change() {
- updateFilterChangeOption(params, !isEmptyValue(option.data), option);
- },
- clear() {
- updateFilterChangeOption(params, !isEmptyValue(option.data), option);
- saveFilterEvent(params);
- },
- blur() {
- $table.saveFilterByEvent(new Event('change'), column);
- }
- }, renderOpts.name === 'VxeNumberInput' ? {
- [getOnName('plus-number')]() {
- updateFilterChangeOption(params, !isEmptyValue(option.data), option);
- saveFilterEvent(params);
- },
- [getOnName('minus-number')]() {
- updateFilterChangeOption(params, !isEmptyValue(option.data), option);
- saveFilterEvent(params);
- }
- } : {});
- }
- return getComponentOns(renderOpts, params, {
- model(value) {
- // 处理 model 值双向绑定
- option.data = value;
- },
- clear() {
- updateFilterChangeOption(params, !isEmptyValue(option.data), option);
- $table.saveFilterByEvent(new Event('change'), column);
- },
- change() {
- updateFilterChangeOption(params, !isEmptyValue(option.data), option);
- $table.saveFilterByEvent(new Event('change'), column);
- }
- });
- }
- function getNativeEditOns(renderOpts, params) {
- const {
- $table,
- row,
- column
- } = params;
- const {
- model
- } = column;
- return getNativeElementOns(renderOpts, params, {
- model(evnt) {
- // 处理 model 值双向绑定
- const targetEl = evnt.target;
- if (targetEl) {
- const cellValue = targetEl.value;
- if (isImmediateCell(renderOpts, params)) {
- setCellValue(row, column, cellValue);
- } else {
- model.update = true;
- model.value = cellValue;
- }
- }
- },
- change(evnt) {
- // 处理 change 事件相关逻辑
- const targetEl = evnt.target;
- if (targetEl) {
- const cellValue = targetEl.value;
- $table.updateStatus(params, cellValue);
- }
- },
- blur(evnt) {
- const targetEl = evnt.target;
- if (targetEl) {
- const cellValue = targetEl.value;
- $table.updateStatus(params, cellValue);
- }
- }
- });
- }
- function getNativeFilterOns(renderOpts, params, option) {
- return getNativeElementOns(renderOpts, params, {
- model(evnt) {
- // 处理 model 值双向绑定
- const targetEl = evnt.target;
- if (targetEl) {
- option.data = targetEl.value;
- }
- },
- change() {
- updateFilterChangeOption(params, !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(option.data), option);
- },
- blur() {
- updateFilterChangeOption(params, !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(option.data), option);
- }
- });
- }
- /**
- * 单元格可编辑渲染-原生的标签
- * input、textarea、select
- */
- function nativeEditRender(h, renderOpts, params) {
- const {
- row,
- column
- } = params;
- const {
- name
- } = renderOpts;
- const cellValue = isImmediateCell(renderOpts, params) ? getCellValue(row, column) : column.model.value;
- return [h(`${name}`, {
- class: `vxe-default-${name}`,
- attrs: getNativeAttrs(renderOpts),
- domProps: {
- value: cellValue
- },
- on: getNativeEditOns(renderOpts, params)
- })];
- }
- function buttonCellRender(h, renderOpts, params) {
- return [h(getDefaultComponent(renderOpts), {
- props: getCellEditProps(renderOpts, params, null),
- on: getComponentOns(renderOpts, params)
- })];
- }
- function defaultEditRender(h, renderOpts, params) {
- const {
- row,
- column
- } = params;
- const cellValue = getCellValue(row, column);
- return [h(getDefaultComponent(renderOpts), {
- props: getCellEditProps(renderOpts, params, cellValue),
- on: getEditOns(renderOpts, params)
- })];
- }
- function checkboxEditRender(h, renderOpts, params) {
- const {
- row,
- column
- } = params;
- const cellValue = getCellValue(row, column);
- return [h(getDefaultComponent(renderOpts), {
- props: getCellEditProps(renderOpts, params, cellValue),
- on: getEditOns(renderOpts, params)
- })];
- }
- function radioAndCheckboxGroupEditRender(h, renderOpts, params) {
- const {
- options
- } = renderOpts;
- const {
- row,
- column
- } = params;
- const cellValue = getCellValue(row, column);
- return [h(getDefaultComponent(renderOpts), {
- props: {
- options,
- ...getCellEditProps(renderOpts, params, cellValue)
- },
- on: getEditOns(renderOpts, params)
- })];
- }
- /**
- * 已废弃
- * @deprecated
- */
- function oldEditRender(h, renderOpts, params) {
- const {
- row,
- column
- } = params;
- const cellValue = getCellValue(row, column);
- return [h(getOldComponent(renderOpts), {
- props: getCellEditProps(renderOpts, params, cellValue),
- on: getEditOns(renderOpts, params)
- })];
- }
- /**
- * 已废弃
- * @deprecated
- */
- function oldButtonEditRender(h, renderOpts, params) {
- return [h('vxe-button', {
- props: getCellEditProps(renderOpts, params, null),
- on: getComponentOns(renderOpts, params)
- })];
- }
- /**
- * 已废弃
- * @deprecated
- */
- function oldButtonsEditRender(h, renderOpts, params) {
- const {
- children
- } = renderOpts;
- return children ? children.map(childRenderOpts => oldButtonEditRender(h, childRenderOpts, params)[0]) : [];
- }
- function renderNativeOptgroups(h, renderOpts, params, renderOptionsMethods) {
- const {
- optionGroups,
- optionGroupProps = {}
- } = renderOpts;
- const groupOptions = optionGroupProps.options || 'options';
- const groupLabel = optionGroupProps.label || 'label';
- if (optionGroups) {
- return optionGroups.map((group, gIndex) => {
- return h('optgroup', {
- key: gIndex,
- attrs: {
- label: group[groupLabel]
- }
- }, renderOptionsMethods(h, group[groupOptions], renderOpts, params));
- });
- }
- return [];
- }
- /**
- * 渲染原生的 option 标签
- */
- function renderNativeOptions(h, options, renderOpts, params) {
- const {
- optionProps = {}
- } = renderOpts;
- const {
- row,
- column
- } = params;
- const labelProp = optionProps.label || 'label';
- const valueProp = optionProps.value || 'value';
- const disabledProp = optionProps.disabled || 'disabled';
- const cellValue = isImmediateCell(renderOpts, params) ? getCellValue(row, column) : column.model.value;
- if (options) {
- return options.map((option, oIndex) => {
- return h('option', {
- key: oIndex,
- attrs: {
- value: option[valueProp],
- disabled: option[disabledProp]
- },
- domProps: {
- /* eslint-disable eqeqeq */
- selected: option[valueProp] == cellValue
- }
- }, option[labelProp]);
- });
- }
- return [];
- }
- function nativeFilterRender(h, renderOpts, params) {
- const {
- column
- } = params;
- const {
- name
- } = renderOpts;
- const attrs = getNativeAttrs(renderOpts);
- return column.filters.map((option, oIndex) => {
- return h(`${name}`, {
- key: oIndex,
- class: `vxe-default-${name}`,
- attrs,
- domProps: {
- value: option.data
- },
- on: getNativeFilterOns(renderOpts, params, option)
- });
- });
- }
- function defaultFilterRender(h, renderOpts, params) {
- const {
- column
- } = params;
- return column.filters.map((option, oIndex) => {
- const optionValue = option.data;
- return h(getDefaultComponent(renderOpts), {
- key: oIndex,
- props: getCellEditFilterProps(renderOpts, renderOpts, optionValue),
- on: getFilterOns(renderOpts, params, option)
- });
- });
- }
- function defaultFloatingFilterRender(h, renderOpts, params) {
- const {
- option
- } = params;
- const optionValue = option.data;
- return [h(getDefaultComponent(renderOpts), {
- props: getCellEditFilterProps(renderOpts, renderOpts, optionValue),
- on: getFloatingFilterOns(renderOpts, params, option)
- })];
- }
- function defaultFilterOptions() {
- return [{
- data: null
- }];
- }
- /**
- * 已废弃
- * @deprecated
- */
- function oldFilterRender(h, renderOpts, params) {
- const {
- column
- } = params;
- return column.filters.map((option, oIndex) => {
- const optionValue = option.data;
- return h(getOldComponent(renderOpts), {
- key: oIndex,
- props: getCellEditFilterProps(renderOpts, renderOpts, optionValue),
- on: getFilterOns(renderOpts, params, option)
- });
- });
- }
- function handleFilterMethod({
- option,
- row,
- column
- }) {
- const {
- data
- } = option;
- const cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, column.field);
- /* eslint-disable eqeqeq */
- return cellValue == data;
- }
- function handleInputFilterMethod({
- option,
- row,
- column
- }) {
- const {
- data
- } = option;
- const cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, column.field);
- /* eslint-disable eqeqeq */
- return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toValueString(cellValue).indexOf(data) > -1;
- }
- function nativeSelectEditRender(h, renderOpts, params) {
- return [h('select', {
- class: 'vxe-default-select',
- attrs: getNativeAttrs(renderOpts),
- on: getNativeEditOns(renderOpts, params)
- }, renderOpts.optionGroups ? renderNativeOptgroups(h, renderOpts, params, renderNativeOptions) : renderNativeOptions(h, renderOpts.options, renderOpts, params))];
- }
- function defaultSelectEditRender(h, renderOpts, params) {
- const {
- row,
- column
- } = params;
- const {
- options,
- optionProps,
- optionGroups,
- optionGroupProps
- } = renderOpts;
- const cellValue = getCellValue(row, column);
- return [h(getDefaultComponent(renderOpts), {
- props: getCellEditProps(renderOpts, params, cellValue, {
- options,
- optionProps,
- optionGroups,
- optionGroupProps
- }),
- on: getEditOns(renderOpts, params)
- })];
- }
- function defaultTableOrTreeSelectEditRender(h, renderOpts, params) {
- const {
- row,
- column
- } = params;
- const {
- options,
- optionProps
- } = renderOpts;
- const cellValue = getCellValue(row, column);
- return [h(getDefaultComponent(renderOpts), {
- props: getCellEditProps(renderOpts, params, cellValue, {
- options,
- optionProps
- }),
- on: getEditOns(renderOpts, params)
- })];
- }
- /**
- * 已废弃
- * @deprecated
- */
- function oldSelectEditRender(h, renderOpts, params) {
- const {
- row,
- column
- } = params;
- const {
- options,
- optionProps,
- optionGroups,
- optionGroupProps
- } = renderOpts;
- const cellValue = getCellValue(row, column);
- return [h(getOldComponent(renderOpts), {
- props: getCellEditProps(renderOpts, params, cellValue, {
- options,
- optionProps,
- optionGroups,
- optionGroupProps
- }),
- on: getEditOns(renderOpts, params)
- })];
- }
- function getSelectCellValue(renderOpts, {
- row,
- column
- }) {
- const {
- options,
- optionGroups,
- optionProps = {},
- optionGroupProps = {},
- props = {}
- } = renderOpts;
- const cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, column.field);
- let selectItem;
- const labelProp = optionProps.label || 'label';
- const valueProp = optionProps.value || 'value';
- if (!(cellValue === null || cellValue === undefined)) {
- let vals = [];
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(cellValue)) {
- vals = cellValue;
- } else {
- if (props.multiple && `${cellValue}`.indexOf(',') > -1) {
- vals = `${cellValue}`.split(',');
- } else {
- vals = [cellValue];
- }
- }
- return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().map(vals, optionGroups ? value => {
- const groupOptions = optionGroupProps.options || 'options';
- for (let index = 0; index < optionGroups.length; index++) {
- /* eslint-disable eqeqeq */
- selectItem = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().find(optionGroups[index][groupOptions], item => item[valueProp] == value);
- if (selectItem) {
- break;
- }
- }
- return selectItem ? selectItem[labelProp] : value;
- } : value => {
- /* eslint-disable eqeqeq */
- selectItem = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().find(options, item => item[valueProp] == value);
- return selectItem ? selectItem[labelProp] : value;
- }).join(', ');
- }
- return '';
- }
- function handleExportSelectMethod(params) {
- const {
- row,
- column,
- options
- } = params;
- return options.original ? getCellValue(row, column) : getSelectCellValue(column.editRender || column.cellRender, params);
- }
- function getTreeSelectCellValue(renderOpts, {
- row,
- column
- }) {
- const {
- options,
- optionProps = {}
- } = renderOpts;
- const cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, column.field);
- const labelProp = optionProps.label || 'label';
- const valueProp = optionProps.value || 'value';
- const childrenProp = optionProps.children || 'children';
- if (!(cellValue === null || cellValue === undefined)) {
- const keyMaps = {};
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(options, item => {
- keyMaps[external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(item, valueProp)] = item;
- }, {
- children: childrenProp
- });
- 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 => {
- const item = keyMaps[value];
- return item ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(item, labelProp) : item;
- }).join(', ');
- }
- return '';
- }
- function handleExportTreeSelectMethod(params) {
- const {
- row,
- column,
- options
- } = params;
- return options.original ? getCellValue(row, column) : getTreeSelectCellValue(column.editRender || column.cellRender, params);
- }
- function handleNumberCell(h, renderOpts, params) {
- const {
- props = {},
- showNegativeStatus
- } = renderOpts;
- const {
- row,
- column
- } = params;
- const {
- type
- } = props;
- let cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, column.field);
- let isNegative = false;
- if (!isEmptyValue(cellValue)) {
- const numberInputConfig = render_getConfig().numberInput || {};
- if (type === 'float') {
- const autoFill = handleDefaultValue(props.autoFill, numberInputConfig.autoFill, true);
- const digits = handleDefaultValue(props.digits, numberInputConfig.digits, 1);
- 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);
- if (!autoFill) {
- cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(cellValue);
- }
- if (showNegativeStatus) {
- if (cellValue < 0) {
- isNegative = true;
- }
- }
- } else if (type === 'amount') {
- const autoFill = handleDefaultValue(props.autoFill, numberInputConfig.autoFill, true);
- const digits = handleDefaultValue(props.digits, numberInputConfig.digits, 2);
- const showCurrency = handleDefaultValue(props.showCurrency, numberInputConfig.showCurrency, false);
- cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(cellValue);
- if (showNegativeStatus) {
- if (cellValue < 0) {
- isNegative = true;
- }
- }
- cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().commafy(cellValue, {
- digits
- });
- if (!autoFill) {
- const [iStr, dStr] = cellValue.split('.');
- if (dStr) {
- const dRest = dStr.replace(/0+$/, '');
- cellValue = dRest ? [iStr, '.', dRest].join('') : iStr;
- }
- }
- if (showCurrency) {
- cellValue = `${props.currencySymbol || numberInputConfig.currencySymbol || render_getI18n('vxe.numberInput.currencySymbol') || ''}${cellValue}`;
- }
- } else {
- if (showNegativeStatus) {
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(cellValue) < 0) {
- isNegative = true;
- }
- }
- }
- }
- return getCellLabelVNs(h, renderOpts, params, cellValue, isNegative ? {
- class: 'is--negative'
- } : {});
- }
- /**
- * 表格 - 渲染器
- */
- render_renderer.mixin({
- input: {
- tableAutoFocus: 'input',
- renderTableEdit: nativeEditRender,
- renderTableDefault: nativeEditRender,
- renderTableFilter: nativeFilterRender,
- tableFilterDefaultMethod: handleInputFilterMethod
- },
- textarea: {
- tableAutoFocus: 'textarea',
- renderTableEdit: nativeEditRender
- },
- select: {
- renderTableEdit: nativeSelectEditRender,
- renderTableDefault: nativeSelectEditRender,
- renderTableCell(h, renderOpts, params) {
- return getCellLabelVNs(h, renderOpts, params, getSelectCellValue(renderOpts, params));
- },
- renderTableFilter(h, renderOpts, params) {
- const {
- column
- } = params;
- return column.filters.map((option, oIndex) => {
- return h('select', {
- key: oIndex,
- class: 'vxe-default-select',
- attrs: getNativeAttrs(renderOpts),
- on: getNativeFilterOns(renderOpts, params, option)
- }, renderOpts.optionGroups ? renderNativeOptgroups(h, renderOpts, params, renderNativeOptions) : renderNativeOptions(h, renderOpts.options, renderOpts, params));
- });
- },
- tableFilterDefaultMethod: handleFilterMethod,
- tableExportMethod: handleExportSelectMethod
- },
- VxeInput: {
- tableAutoFocus: 'input',
- renderTableEdit: defaultEditRender,
- renderTableCell(h, renderOpts, params) {
- const {
- props = {}
- } = renderOpts;
- const {
- row,
- column
- } = params;
- const inputConfig = render_getConfig().input || {};
- const digits = props.digits || inputConfig.digits || 2;
- let cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, column.field);
- if (cellValue) {
- switch (props.type) {
- case 'date':
- case 'week':
- case 'month':
- case 'quarter':
- case 'year':
- cellValue = getLabelFormatDate(cellValue, props);
- break;
- case 'float':
- 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);
- break;
- }
- }
- return getCellLabelVNs(h, renderOpts, params, cellValue);
- },
- renderTableDefault: defaultEditRender,
- createTableFilterOptions: defaultFilterOptions,
- renderTableFilter: defaultFilterRender,
- renderTableFloatingFilter: defaultFloatingFilterRender,
- tableFilterDefaultMethod: handleInputFilterMethod
- },
- FormatNumberInput: {
- renderTableDefault: handleNumberCell,
- tableFilterDefaultMethod: handleInputFilterMethod,
- tableExportMethod(params) {
- const {
- row,
- column
- } = params;
- const cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, column.field);
- return cellValue;
- }
- },
- VxeNumberInput: {
- tableAutoFocus: 'input',
- renderTableEdit: defaultEditRender,
- renderTableCell: handleNumberCell,
- renderTableFooter(h, renderOpts, params) {
- const {
- props = {}
- } = renderOpts;
- const {
- row,
- column,
- _columnIndex
- } = params;
- const {
- type
- } = props;
- // 兼容老模式
- 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);
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(itemValue)) {
- const numberInputConfig = render_getConfig().numberInput || {};
- if (type === 'float') {
- const autoFill = handleDefaultValue(props.autoFill, numberInputConfig.autoFill, true);
- const digits = handleDefaultValue(props.digits, numberInputConfig.digits, 1);
- 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);
- if (!autoFill) {
- amountLabel = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(amountLabel);
- }
- return amountLabel;
- } else if (type === 'amount') {
- const autoFill = handleDefaultValue(props.autoFill, numberInputConfig.autoFill, true);
- const digits = handleDefaultValue(props.digits, numberInputConfig.digits, 2);
- const showCurrency = handleDefaultValue(props.showCurrency, numberInputConfig.showCurrency, false);
- 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), {
- digits
- });
- if (!autoFill) {
- const [iStr, dStr] = amountLabel.split('.');
- if (dStr) {
- const dRest = dStr.replace(/0+$/, '');
- amountLabel = dRest ? [iStr, '.', dRest].join('') : iStr;
- }
- }
- if (showCurrency) {
- amountLabel = `${props.currencySymbol || numberInputConfig.currencySymbol || render_getI18n('vxe.numberInput.currencySymbol') || ''}${amountLabel}`;
- }
- return amountLabel;
- }
- }
- return getFuncText(itemValue, 1);
- },
- renderTableDefault: defaultEditRender,
- createTableFilterOptions: defaultFilterOptions,
- renderTableFilter: defaultFilterRender,
- renderTableFloatingFilter: defaultFloatingFilterRender,
- tableFilterDefaultMethod: handleInputFilterMethod,
- tableExportMethod(params) {
- const {
- row,
- column
- } = params;
- const cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, column.field);
- return cellValue;
- }
- },
- VxeDatePicker: {
- tableAutoFocus: 'input',
- renderTableEdit: defaultEditRender,
- renderTableCell(h, renderOpts, params) {
- const {
- props = {}
- } = renderOpts;
- const {
- row,
- column
- } = params;
- let cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, column.field);
- if (cellValue) {
- if (props.type !== 'time') {
- cellValue = getLabelFormatDate(cellValue, props);
- }
- }
- return getCellLabelVNs(h, renderOpts, params, cellValue);
- },
- renderTableDefault: defaultEditRender,
- createTableFilterOptions: defaultFilterOptions,
- renderTableFilter: defaultFilterRender,
- renderTableFloatingFilter: defaultFloatingFilterRender,
- tableFilterDefaultMethod: handleFilterMethod
- },
- VxeDateRangePicker: {
- tableAutoFocus: 'input',
- renderTableEdit(h, renderOpts, params) {
- const {
- startField,
- endField
- } = renderOpts;
- const {
- $table,
- row,
- column
- } = params;
- const {
- model
- } = column;
- const cellValue = getCellValue(row, column);
- const seProps = {};
- const seOs = {};
- if (startField && endField) {
- seProps.startValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, startField);
- seProps.endValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, endField);
- seOs['update:startValue'] = value => {
- if (startField) {
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(row, startField, value);
- }
- };
- seOs['update:endValue'] = value => {
- if (endField) {
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(row, endField, value);
- }
- };
- }
- return [h(getDefaultComponent(renderOpts), {
- props: getCellEditProps(renderOpts, params, cellValue, seProps),
- on: getComponentOns(renderOpts, params, {
- model(cellValue) {
- model.update = true;
- model.value = cellValue;
- setCellValue(row, column, cellValue);
- },
- change() {
- $table.updateStatus(params);
- },
- blur() {
- $table.handleCellRuleUpdateStatus('blur', params);
- }
- }, seOs)
- })];
- },
- renderTableCell(h, renderOpts, params) {
- const {
- startField,
- endField
- } = renderOpts;
- const {
- row,
- column
- } = params;
- let startValue = '';
- let endValue = '';
- if (startField && endField) {
- startValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, startField);
- endValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, endField);
- } else {
- const cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, column.field);
- if (cellValue) {
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(cellValue)) {
- startValue = cellValue[0];
- endValue = cellValue[1];
- } else {
- const strs = `${cellValue}`.split(',');
- startValue = strs[0];
- endValue = strs[1];
- }
- }
- }
- let cellLabel = '';
- if (startValue && endValue) {
- cellLabel = `${startValue} ~ ${endValue}`;
- }
- return getCellLabelVNs(h, renderOpts, params, cellLabel);
- }
- },
- VxeTextarea: {
- tableAutoFocus: 'textarea',
- renderTableEdit: defaultEditRender
- },
- VxeButton: {
- renderTableDefault: buttonCellRender
- },
- VxeButtonGroup: {
- renderTableDefault(h, renderOpts, params) {
- const {
- options
- } = renderOpts;
- return [h(getDefaultComponent(renderOpts), {
- props: {
- options,
- ...getCellEditProps(renderOpts, params, null)
- },
- on: getComponentOns(renderOpts, params)
- })];
- }
- },
- VxeSelect: {
- tableAutoFocus: 'input',
- renderTableEdit: defaultSelectEditRender,
- renderTableDefault: defaultSelectEditRender,
- renderTableCell(h, renderOpts, params) {
- return getCellLabelVNs(h, renderOpts, params, getSelectCellValue(renderOpts, params));
- },
- createTableFilterOptions: defaultFilterOptions,
- renderTableFilter(h, renderOpts, params) {
- const {
- column
- } = params;
- const {
- options,
- optionProps,
- optionGroups,
- optionGroupProps
- } = renderOpts;
- return column.filters.map((option, oIndex) => {
- const optionValue = option.data;
- return h(getDefaultComponent(renderOpts), {
- key: oIndex,
- props: getCellEditFilterProps(renderOpts, params, optionValue, {
- options,
- optionProps,
- optionGroups,
- optionGroupProps
- }),
- on: getFilterOns(renderOpts, params, option)
- });
- });
- },
- renderTableFloatingFilter(h, renderOpts, params) {
- const {
- option
- } = params;
- const {
- options,
- optionProps,
- optionGroups,
- optionGroupProps
- } = renderOpts;
- const optionValue = option.data;
- return h(getDefaultComponent(renderOpts), {
- props: getCellEditFilterProps(renderOpts, params, optionValue, {
- options,
- optionProps,
- optionGroups,
- optionGroupProps
- }),
- on: getFloatingFilterOns(renderOpts, params, option)
- });
- },
- tableFilterDefaultMethod: handleFilterMethod,
- tableExportMethod: handleExportSelectMethod
- },
- VxeText: {
- renderTableDefault(h, renderOpts, params) {
- const {
- $table,
- row,
- column
- } = params;
- const {
- props
- } = renderOpts;
- const cellLabel = $table.getCellLabel(row, column);
- return [h(getDefaultComponent(renderOpts), {
- props: {
- ...(props || {}),
- content: cellLabel
- },
- on: getComponentOns(renderOpts, params)
- })];
- }
- },
- VxeLink: {
- renderTableDefault(h, renderOpts, params) {
- const {
- $table,
- row,
- column
- } = params;
- const {
- props
- } = renderOpts;
- const {
- href
- } = props || {};
- const cellLabel = $table.getCellLabel(row, column);
- return [h(getDefaultComponent(renderOpts), {
- props: {
- ...(props || {}),
- content: cellLabel,
- href: external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toFormatString(href, params)
- },
- on: getComponentOns(renderOpts, params)
- })];
- }
- },
- /**
- * 已废弃,被 FormatSelect 替换
- * @deprecated
- */
- formatOption: {
- renderTableDefault(h, renderOpts, params) {
- return getCellLabelVNs(h, renderOpts, params, getSelectCellValue(renderOpts, params));
- }
- },
- FormatSelect: {
- renderTableDefault(h, renderOpts, params) {
- return getCellLabelVNs(h, renderOpts, params, getSelectCellValue(renderOpts, params));
- },
- tableFilterDefaultMethod: handleFilterMethod,
- tableExportMethod: handleExportSelectMethod
- },
- VxeTreeSelect: {
- tableAutoFocus: 'input',
- renderTableEdit: defaultTableOrTreeSelectEditRender,
- renderTableCell(h, renderOpts, params) {
- return getCellLabelVNs(h, renderOpts, params, getTreeSelectCellValue(renderOpts, params));
- },
- tableExportMethod: handleExportTreeSelectMethod
- },
- VxeTableSelect: {
- tableAutoFocus: 'input',
- renderTableEdit: defaultTableOrTreeSelectEditRender,
- renderTableCell(h, renderOpts, params) {
- return getCellLabelVNs(h, renderOpts, params, getTreeSelectCellValue(renderOpts, params));
- },
- tableExportMethod: handleExportTreeSelectMethod
- },
- /**
- * 已废弃,被 FormatTreeSelect 替换
- * @deprecated
- */
- formatTree: {
- renderTableDefault(h, renderOpts, params) {
- return getCellLabelVNs(h, renderOpts, params, getTreeSelectCellValue(renderOpts, params));
- }
- },
- FormatTreeSelect: {
- renderTableDefault(h, renderOpts, params) {
- return getCellLabelVNs(h, renderOpts, params, getTreeSelectCellValue(renderOpts, params));
- },
- tableExportMethod: handleExportTreeSelectMethod
- },
- VxeColorPicker: {
- tableAutoFocus: 'input',
- renderTableEdit(h, renderOpts, params) {
- const {
- row,
- column
- } = params;
- const {
- options
- } = renderOpts;
- const cellValue = getCellValue(row, column);
- return [h(getDefaultComponent(renderOpts), {
- props: getCellEditProps(renderOpts, params, cellValue, {
- colors: options
- }),
- on: getEditOns(renderOpts, params)
- })];
- },
- renderTableCell(h, renderOpts, params) {
- const {
- row,
- column
- } = params;
- const cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, column.field);
- return h('span', {
- class: 'vxe-color-picker--readonly'
- }, [h('div', {
- class: 'vxe-color-picker--readonly-color',
- style: {
- backgroundColor: cellValue
- }
- })]);
- }
- },
- VxeIconPicker: {
- tableAutoFocus: 'input',
- renderTableEdit(h, renderOpts, params) {
- const {
- row,
- column
- } = params;
- const {
- options
- } = renderOpts;
- const cellValue = getCellValue(row, column);
- return [h(getDefaultComponent(renderOpts), {
- props: getCellEditProps(renderOpts, params, cellValue, {
- icons: options
- }),
- on: getEditOns(renderOpts, params)
- })];
- },
- renderTableCell(h, renderOpts, params) {
- const {
- row,
- column
- } = params;
- const cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, column.field);
- return h('i', {
- class: cellValue
- });
- }
- },
- VxeRadioGroup: {
- renderTableDefault: radioAndCheckboxGroupEditRender
- },
- VxeCheckbox: {
- renderTableDefault: checkboxEditRender
- },
- VxeCheckboxGroup: {
- renderTableDefault: radioAndCheckboxGroupEditRender
- },
- VxeSwitch: {
- tableAutoFocus: 'button',
- renderTableEdit: defaultEditRender,
- renderTableDefault: defaultEditRender
- },
- VxeUpload: {
- renderTableEdit: defaultEditRender,
- renderTableCell: defaultEditRender,
- renderTableDefault: defaultEditRender
- },
- VxeImage: {
- renderTableDefault(h, renderOpts, params) {
- const {
- row,
- column
- } = params;
- const {
- props
- } = renderOpts;
- const cellValue = getCellValue(row, column);
- return [h(getDefaultComponent(renderOpts), {
- props: {
- ...props,
- src: cellValue
- },
- on: getEditOns(renderOpts, params)
- })];
- }
- },
- VxeImageGroup: {
- renderTableDefault(h, renderOpts, params) {
- const {
- row,
- column
- } = params;
- const {
- props
- } = renderOpts;
- const cellValue = getCellValue(row, column);
- return [h(getDefaultComponent(renderOpts), {
- props: {
- ...props,
- urlList: cellValue
- },
- on: getEditOns(renderOpts, params)
- })];
- }
- },
- VxeTextEllipsis: {
- renderTableDefault(h, renderOpts, params) {
- const {
- row,
- column
- } = params;
- const {
- props
- } = renderOpts;
- const cellValue = getCellValue(row, column);
- return [h(getDefaultComponent(renderOpts), {
- props: {
- ...props,
- content: cellValue
- },
- on: getEditOns(renderOpts, params)
- })];
- }
- },
- VxeRate: {
- renderTableDefault: defaultEditRender
- },
- VxeSlider: {
- renderTableDefault: defaultEditRender
- },
- // 以下已废弃
- $input: {
- tableAutoFocus: '.vxe-input--inner',
- renderTableEdit: oldEditRender,
- renderTableCell(h, renderOpts, params) {
- const {
- props = {}
- } = renderOpts;
- const {
- row,
- column
- } = params;
- const digits = props.digits || render_getConfig().input?.digits || 2;
- let cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, column.field);
- if (cellValue) {
- switch (props.type) {
- case 'date':
- case 'week':
- case 'month':
- case 'year':
- cellValue = getLabelFormatDate(cellValue, props);
- break;
- case 'float':
- 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);
- break;
- }
- }
- return getCellLabelVNs(h, renderOpts, params, cellValue);
- },
- renderTableDefault: oldEditRender,
- renderTableFilter: oldFilterRender,
- tableFilterDefaultMethod: handleInputFilterMethod
- },
- $textarea: {
- tableAutoFocus: '.vxe-textarea--inner'
- },
- $button: {
- renderTableDefault: oldButtonEditRender
- },
- $buttons: {
- renderTableDefault: oldButtonsEditRender
- },
- $select: {
- tableAutoFocus: '.vxe-input--inner',
- renderTableEdit: oldSelectEditRender,
- renderTableDefault: oldSelectEditRender,
- renderTableCell(h, renderOpts, params) {
- return getCellLabelVNs(h, renderOpts, params, getSelectCellValue(renderOpts, params));
- },
- renderTableFilter(h, renderOpts, params) {
- const {
- column
- } = params;
- const {
- options,
- optionProps,
- optionGroups,
- optionGroupProps
- } = renderOpts;
- return column.filters.map((option, oIndex) => {
- const optionValue = option.data;
- return h(getOldComponent(renderOpts), {
- key: oIndex,
- props: getCellEditFilterProps(renderOpts, params, optionValue, {
- options,
- optionProps,
- optionGroups,
- optionGroupProps
- }),
- on: getFilterOns(renderOpts, params, option)
- });
- });
- },
- tableFilterDefaultMethod: handleFilterMethod,
- tableExportMethod: handleExportSelectMethod
- },
- $radio: {
- tableAutoFocus: '.vxe-radio--input'
- },
- $checkbox: {
- tableAutoFocus: '.vxe-checkbox--input'
- },
- $switch: {
- tableAutoFocus: '.vxe-switch--button',
- renderTableEdit: oldEditRender,
- renderTableDefault: oldEditRender
- }
- // 以上已废弃
- });
- ;// CONCATENATED MODULE: ./packages/table/index.ts
- let table_isReg = false;
- const VxeTable = Object.assign({}, table, {
- install(app) {
- if (typeof window !== 'undefined') {
- if (window.VxeTableExtendCellArea && window.VxeTableExtendCellArea.use) {
- window.VxeTableExtendCellArea.use(core_.VxeUI);
- } else if (window.VXETableMixin) {
- table.mixins.push(window.VXETableMixin);
- delete window.VXETableMixin;
- }
- if (window.VxeTableExtendPivotTable && window.VxeTableExtendPivotTable.use) {
- window.VxeTableExtendPivotTable.use(core_.VxeUI);
- }
- }
- // 兼容老版本
- if (typeof window !== 'undefined' && window.VxeTableExtendCellArea && window.VxeTableExtendCellArea.init) {
- window.VxeTableExtendCellArea.init(core_.VxeUI);
- delete window.VxeTableExtendCellArea;
- delete window.VXETablePro;
- } else if (typeof window !== 'undefined' && window.VXETablePro && window.VXETablePro.init) {
- window.VXETablePro.init(core_.VxeUI);
- delete window.VXETablePro;
- }
- if (!(external_commonjs_vue_commonjs2_vue_root_Vue_default()).prototype.$vxe) {
- (external_commonjs_vue_commonjs2_vue_root_Vue_default()).prototype.$vxe = {
- t: core_.VxeUI.t,
- _t: core_.VxeUI._t
- };
- } else {
- (external_commonjs_vue_commonjs2_vue_root_Vue_default()).prototype.$vxe.t = core_.VxeUI.t;
- (external_commonjs_vue_commonjs2_vue_root_Vue_default()).prototype.$vxe._t = core_.VxeUI._t;
- }
- if (!table_isReg) {
- table_isReg = true;
- if (core_.VxeUI.dynamicApp) {
- core_.VxeUI.dynamicApp.component(table.name, table);
- }
- }
- app.component(table.name, table);
- }
- });
- core_.VxeUI.component(table);
- const Table = VxeTable;
- /* harmony default export */ var packages_table = ((/* unused pure expression or super */ null && (VxeTable)));
- ;// CONCATENATED MODULE: ./packages/toolbar/index.ts
- const VxeToolbar = Object.assign({}, toolbar, {
- install(app) {
- app.component(toolbar.name, toolbar);
- }
- });
- if (core_.VxeUI.dynamicApp) {
- core_.VxeUI.dynamicApp.component(toolbar.name, toolbar);
- }
- core_.VxeUI.component(toolbar);
- const Toolbar = VxeToolbar;
- /* harmony default export */ var packages_toolbar = ((/* unused pure expression or super */ null && (VxeToolbar)));
- ;// CONCATENATED MODULE: ./packages/locale/lang/zh-CN.ts
- /* harmony default export */ var zh_CN = ({
- vxe: {
- base: {
- pleaseInput: '请输入',
- pleaseSelect: '请选择',
- comma: ',',
- fullStop: '。'
- },
- loading: {
- text: '加载中...'
- },
- error: {
- downErr: '下载失败',
- errLargeData: '当绑定的数据量过大时,应该请使用 {0},否则可能会出现卡顿',
- groupFixed: '如果使用分组表头,冻结列必须按组设置',
- groupMouseRange: '分组表头与 "{0}" 不能同时使用,这可能会出现错误',
- groupTag: '分组列头应该使用 "{0}" 而不是 "{1}",这可能会出现错误',
- scrollErrProp: '启用虚拟滚动后不支持该参数 "{0}"',
- errConflicts: '参数 "{0}" 与 "{1}" 有冲突',
- modelConflicts: '绑定的字段值 "{0}" 与 "{1}" 存在冲突,将会出现错误',
- notSupportProp: '当启用参数 "{0}" 时不支持 "{1}",应该为 "{2}",否则将会出现错误',
- reqSupportProp: '当使用 "{0}" 时,应该设置 "{1}",否则可能会出现错误',
- notConflictProp: '当使用 "{0}" 时,应该设置 "{1}",否则可能会存在功能冲突',
- unableInsert: '无法插入到指定位置,请检查参数是否正确',
- useErr: '安装 "{0}" 模块时发生错误,可能顺序不正确,依赖的模块需要在 Table 之前安装',
- barUnableLink: '工具栏无法关联表格',
- expandContent: '展开行的插槽应该是 "content",请检查是否正确',
- reqComp: '缺少 "{0}" 组件,请检查是否正确安装。 https://vxeui.com/#/start/useGlobal',
- reqModule: '缺少 "{0}" 模块',
- reqProp: '缺少必要的 "{0}" 参数,这可能会导致出现错误',
- emptyProp: '参数 "{0}" 不允许为空',
- errProp: '不支持的参数 "{0}",可能为 "{1}"',
- colRepet: 'column.{0}="{1}" 重复了,这可能会导致某些功能无法使用',
- notFunc: '方法 "{0}" 不存在',
- errFunc: '参数 "{0}" 不是一个方法',
- notValidators: '全局校验 "{0}" 不存在',
- notFormats: '全局格式化 "{0}" 不存在',
- notCommands: '全局指令 "{0}" 不存在',
- notSlot: '插槽 "{0}" 不存在',
- noTree: '树结构不支持 "{0}"',
- noGroup: '数据分组后不支持 "{0}"',
- notProp: '不支持的参数 "{0}"',
- checkProp: '当数据量过大时可能会导致复选框卡顿,建议设置参数 "{0}" 提升渲染速度',
- coverProp: '"{0}" 的参数 "{1}" 重复定义,这可能会出现错误',
- uniField: '字段名 "{0}" 重复定义,这可能会出现错误',
- repeatKey: '主键重复 {0}="{1}",这可能会出现错误',
- repeatProp: '参数重复 {0}="{1}",这可能会出现错误',
- delFunc: '方法 "{0}" 已废弃,请使用 "{1}"',
- delProp: '参数 "{0}" 已废弃,请使用 "{1}"',
- delEvent: '事件 "{0}" 已废弃,请使用 "{1}"',
- removeProp: '参数 "{0}" 已废弃,不建议使用,这可能会导致出现错误',
- errFormat: '全局的格式化内容应该使用 "VXETable.formats" 定义,挂载 "formatter={0}" 的方式已不建议使用',
- notType: '不支持的文件类型 "{0}"',
- notExp: '该浏览器不支持导入/导出功能',
- impFields: '导入失败,请检查字段名和数据格式是否正确',
- treeNotImp: '树表格不支持导入',
- treeCrossDrag: '只能拖拽第一层级',
- treeDragChild: '父级不能拖拽到自己的子级中',
- reqPlugin: '扩展插件未安装 "{1}" https://vxeui.com/other{0}/#/{1}/install',
- errMaxRow: '超过支持的最大数据量 {0} 行,这可能会导致出现错误',
- useNew: '不建议使用 {0},请使用 {1}',
- errorVersion: '版本不匹配,当前版本 {0},最低支持版本为 {1}'
- },
- table: {
- emptyText: '暂无数据',
- allTitle: '全选/取消',
- seqTitle: '序号',
- actionTitle: '操作',
- confirmFilter: '筛选',
- resetFilter: '重置',
- allFilter: '全部',
- sortAsc: '升序:最低到最高',
- sortDesc: '降序:最高到最低',
- filter: '对所选的列启用筛选',
- impSuccess: '成功导入 {0} 条记录',
- expLoading: '正在导出中',
- expSuccess: '导出成功',
- expError: '导出失败',
- expFilename: '导出_{0}',
- expOriginFilename: '导出_源_{0}',
- customTitle: '列设置',
- customAll: '全部',
- customConfirm: '确认',
- customClose: '关闭',
- customCancel: '取消',
- customRestore: '恢复默认',
- maxFixedCol: '最大冻结列的数量不能超过 {0} 个',
- maxGroupCol: '最大分组字段的数量不能超过 {0} 个',
- dragTip: '移动:{0}',
- resizeColTip: '宽:{0} 像素',
- resizeRowTip: '高:{0} 像素',
- rowGroupContentTotal: '{0}({1})'
- },
- grid: {
- selectOneRecord: '请至少选择一条记录!',
- deleteSelectRecord: '您确定要删除所选记录吗?',
- removeSelectRecord: '您确定要移除所选记录吗?',
- dataUnchanged: '数据未改动!',
- delSuccess: '成功删除所选记录!',
- saveSuccess: '保存成功!',
- operError: '发生错误,操作失败!'
- },
- select: {
- clear: '清除',
- allChecked: '全选',
- total: '{0} / {1}',
- search: '搜索',
- loadingText: '加载中',
- emptyText: '暂无数据',
- maxSize: '最大可选择的数量不能超过 {0} 个',
- overSizeErr: '已超出最大可选数量 {0} 个,超出部分将被忽略!',
- searchEmpty: '未匹配到数据!'
- },
- tree: {
- searchEmpty: '未匹配到数据!'
- },
- treeSelect: {
- clearChecked: '清除',
- allChecked: '全选',
- allExpand: '全部展开',
- clearExpand: '全部收起',
- total: '已选 {0}',
- search: '搜索',
- emptyText: '暂无数据'
- },
- pager: {
- goto: '前往',
- gotoTitle: '页数',
- pagesize: '{0}条/页',
- total: '共 {0} 条记录',
- pageClassifier: '页',
- homePage: '首页',
- homePageTitle: '首页',
- prevPage: '上一页',
- prevPageTitle: '上一页',
- nextPage: '下一页',
- nextPageTitle: '下一页',
- prevJump: '向上跳页',
- prevJumpTitle: '向上跳页',
- nextJump: '向下跳页',
- nextJumpTitle: '向下跳页',
- endPage: '末页',
- endPageTitle: '末页'
- },
- alert: {
- title: '系统提示'
- },
- button: {
- confirm: '确认',
- cancel: '取消',
- clear: '清除'
- },
- filter: {
- search: '搜索'
- },
- custom: {
- cstmTitle: '列设置',
- cstmRestore: '恢复默认',
- cstmCancel: '取消',
- cstmConfirm: '确定',
- cstmConfirmRestore: '请确认是否恢复成默认列配置?',
- cstmDragTarget: '移动:{0}',
- setting: {
- colSort: '排序',
- sortHelpTip: '点击并拖动图标可以调整顺序',
- colTitle: '列标题',
- colResizable: '列宽(像素)',
- colVisible: '是否显示',
- colFixed: '冻结列',
- colFixedMax: '冻结列(最多 {0} 列)',
- fixedLeft: '左侧',
- fixedUnset: '不设置',
- fixedRight: '右侧'
- }
- },
- import: {
- modes: {
- covering: '覆盖方式(直接覆盖表格数据)',
- insert: '底部追加(在表格的底部追加新数据)',
- insertTop: '顶部追加(在表格的顶部追加新数据)',
- insertBottom: '底部追加(在表格的底部追加新数据)'
- },
- impTitle: '导入数据',
- impFile: '文件名',
- impSelect: '选择文件',
- impType: '文件类型',
- impOpts: '参数设置',
- impMode: '导入模式',
- impConfirm: '导入',
- impCancel: '取消'
- },
- export: {
- types: {
- csv: 'CSV (逗号分隔)(*.csv)',
- html: '网页(*.html)',
- xml: 'XML 数据(*.xml)',
- txt: '文本文件(制表符分隔)(*.txt)',
- xls: 'Excel 97-2003 工作簿(*.xls)',
- xlsx: 'Excel 工作簿(*.xlsx)',
- pdf: 'PDF (*.pdf)'
- },
- modes: {
- empty: '空数据',
- current: '当前数据(当前页的数据)',
- selected: '选中数据(当前页选中的数据)',
- all: '全量数据(包括所有分页的数据)'
- },
- printTitle: '打印数据',
- expTitle: '导出数据',
- expName: '文件名',
- expNamePlaceholder: '请输入文件名',
- expSheetName: '标题',
- expSheetNamePlaceholder: '请输入标题',
- expType: '保存类型',
- expMode: '选择数据',
- expCurrentColumn: '全部字段',
- expColumn: '选择字段',
- expOpts: '参数设置',
- expOptHeader: '表头',
- expHeaderTitle: '是否需要表头',
- expOptFooter: '表尾',
- expFooterTitle: '是否需要表尾',
- expOptColgroup: '分组表头',
- expOptTitle: '列标题',
- expTitleTitle: '是否为列标题,否则显示为列的字段名',
- expColgroupTitle: '如果存在,则支持带有分组结构的表头',
- expOptMerge: '合并',
- expMergeTitle: '如果存在,则支持带有合并结构的单元格',
- expOptAllExpand: '展开树',
- expAllExpandTitle: '如果存在,则支持将带有层级结构的数据全部展开',
- expOptUseStyle: '样式',
- expUseStyleTitle: '如果存在,则支持带样式的单元格',
- expOptOriginal: '源数据',
- expOriginalTitle: '如果为源数据,则支持导入到表格中',
- expPrint: '打印',
- expConfirm: '导出',
- expCancel: '取消'
- },
- modal: {
- errTitle: '错误提示',
- zoomMin: '最小化',
- zoomIn: '最大化',
- zoomOut: '还原',
- close: '关闭',
- miniMaxSize: '最小化窗口的数量不能超过 {0} 个',
- footPropErr: 'show-footer 仅用于启用表尾,需配合 show-confirm-button | show-cancel-button | 插槽使用'
- },
- drawer: {
- close: '关闭'
- },
- form: {
- folding: '收起',
- unfolding: '展开'
- },
- toolbar: {
- import: '导入',
- export: '导出',
- print: '打印',
- refresh: '刷新',
- zoomIn: '全屏',
- zoomOut: '还原',
- custom: '列设置',
- customAll: '全部',
- customConfirm: '确认',
- customRestore: '重置',
- fixedLeft: '冻结在左侧',
- fixedRight: '冻结在右侧',
- cancelFixed: '取消冻结列'
- },
- datePicker: {
- yearTitle: '{0} 年'
- },
- dateRangePicker: {
- pleaseRange: '请选择开始日期与结束日期'
- },
- input: {
- date: {
- m1: '01 月',
- m2: '02 月',
- m3: '03 月',
- m4: '04 月',
- m5: '05 月',
- m6: '06 月',
- m7: '07 月',
- m8: '08 月',
- m9: '09 月',
- m10: '10 月',
- m11: '11 月',
- m12: '12 月',
- quarterLabel: '{0} 年',
- monthLabel: '{0} 年',
- dayLabel: '{0} 年 {1}',
- labelFormat: {
- date: 'yyyy-MM-dd',
- time: 'HH:mm:ss',
- datetime: 'yyyy-MM-dd HH:mm:ss',
- week: 'yyyy 年第 WW 周',
- month: 'yyyy-MM',
- quarter: 'yyyy 年第 q 季度',
- year: 'yyyy'
- },
- weeks: {
- w: '',
- w0: '周日',
- w1: '周一',
- w2: '周二',
- w3: '周三',
- w4: '周四',
- w5: '周五',
- w6: '周六'
- },
- months: {
- m0: '一月',
- m1: '二月',
- m2: '三月',
- m3: '四月',
- m4: '五月',
- m5: '六月',
- m6: '七月',
- m7: '八月',
- m8: '九月',
- m9: '十月',
- m10: '十一月',
- m11: '十二月'
- },
- quarters: {
- q1: '第一季度',
- q2: '第二季度',
- q3: '第三季度',
- q4: '第四季度'
- }
- }
- },
- numberInput: {
- currencySymbol: '¥'
- },
- imagePreview: {
- popupTitle: '预览',
- operBtn: {
- zoomOut: '缩小',
- zoomIn: '放大',
- pctFull: '等比例缩放',
- pct11: '显示原始尺寸',
- rotateLeft: '向左旋转',
- rotateRight: '向右旋转',
- print: '点击打印图片',
- download: '点击下载图片'
- }
- },
- upload: {
- fileBtnText: '点击或拖拽上传',
- imgBtnText: '点击或拖拽上传',
- dragPlaceholder: '请把文件拖放到这个区域即可上传',
- imgSizeHint: '单张{0}',
- imgCountHint: '最多{0}张',
- fileTypeHint: '支持 {0} 文件类型',
- fileSizeHint: '单个文件大小不超过{0}',
- fileCountHint: '最多可上传{0}个文件',
- uploadTypeErr: '文件类型不匹配!',
- overCountErr: '最多只能选择{0}个文件!',
- overCountExtraErr: '已超出最大数量{0}个,超出的{1}个文件将被忽略!',
- overSizeErr: '文件大小最大不能超过{0}!',
- manualUpload: '点击上传',
- reUpload: '重新上传',
- uploadProgress: '上传中 {0}%',
- uploadErr: '上传失败',
- uploadSuccess: '上传成功',
- moreBtnText: '更多({0})',
- viewItemTitle: '点击查看',
- morePopup: {
- readTitle: '查看列表',
- imageTitle: '上传图片',
- fileTitle: '上传文件'
- }
- },
- empty: {
- defText: '暂无数据'
- },
- colorPicker: {
- clear: '清除',
- confirm: '确认',
- copySuccess: '已复制到剪贴板:{0}',
- hex: '十六进制'
- },
- formDesign: {
- formName: '表单名称',
- defFormTitle: '未命名的表单',
- widgetPropTab: '控件属性',
- widgetFormTab: '表单属性',
- error: {
- wdFormUni: '该类型的控件在表单中只允许添加一个',
- wdSubUni: '该类型的控件在子表中只允许添加一个'
- },
- styleSetting: {
- btn: '样式设置',
- title: '表单的样式设置',
- layoutTitle: '控件布局',
- verticalLayout: '上下布局',
- horizontalLayout: '横向布局',
- styleTitle: '标题样式',
- boldTitle: '标题加粗',
- fontBold: '加粗',
- fontNormal: '常规',
- colonTitle: '显示冒号',
- colonVisible: '显示',
- colonHidden: '隐藏',
- alignTitle: '对齐方式',
- widthTitle: '标题宽度',
- alignLeft: '居左',
- alignRight: '居右',
- unitPx: '像素',
- unitPct: '百分比'
- },
- widget: {
- group: {
- base: '基础控件',
- layout: '布局控件',
- system: '系统控件',
- module: '模块控件',
- chart: '图表控件',
- advanced: '高级控件'
- },
- copyTitle: '副本_{0}',
- component: {
- input: '输入框',
- textarea: '文本域',
- select: '下拉选择',
- row: '一行多列',
- title: '标题',
- text: '文本',
- subtable: '子表',
- VxeSwitch: '是/否',
- VxeInput: '输入框',
- VxeNumberInput: '数字',
- VxeDatePicker: '日期',
- VxeTextarea: '文本域',
- VxeSelect: '下拉选择',
- VxeTreeSelect: '树形选择',
- VxeRadioGroup: '单选框',
- VxeCheckboxGroup: '复选框',
- VxeUploadFile: '文件',
- VxeUploadImage: '图片',
- VxeRate: '评分',
- VxeSlider: '滑块'
- }
- },
- widgetProp: {
- name: '控件名称',
- placeholder: '提示语',
- required: '必填校验',
- multiple: '允许多选',
- displaySetting: {
- name: '显示设置',
- pc: '电脑端',
- mobile: '手机端',
- visible: '显示',
- hidden: '隐藏'
- },
- dataSource: {
- name: '数据源',
- defValue: '选项{0}',
- addOption: '添加选项',
- batchEditOption: '批量编辑',
- batchEditTip: '每行对应一个选项,支持从表格、Excel、WPS 中直接复制粘贴。',
- batchEditSubTip: '每行对应一个选项,如果是分组,子项可以是空格或制表键开头,支持从表格、Excel、WPS 中直接复制粘贴。',
- buildOption: '生成选项'
- },
- rowProp: {
- colSize: '列数',
- col2: '两列',
- col3: '三列',
- col4: '四列',
- col6: '六列',
- layout: '布局'
- },
- textProp: {
- name: '内容',
- alignTitle: '对齐方式',
- alignLeft: '居左',
- alignCenter: '居中',
- alignRight: '居右',
- colorTitle: '字体颜色',
- sizeTitle: '字体大小',
- boldTitle: '字体加粗',
- fontNormal: '常规',
- fontBold: '加粗'
- },
- subtableProp: {
- seqTitle: '序号',
- showSeq: '显示序号',
- showCheckbox: '允许多选',
- errSubDrag: '子表不支持该控件,请使用其他控件',
- colPlace: '将控件拖拽进来'
- },
- uploadProp: {
- limitFileCount: '文件数量限制',
- limitFileSize: '文件大小限制',
- multiFile: '允许上传多个文件',
- limitImgCount: '图片数量限制',
- limitImgSize: '图片大小限制',
- multiImg: '允许上传多张图片'
- }
- }
- },
- listDesign: {
- fieldSettingTab: '字段设置',
- listSettingTab: '参数设置',
- searchTitle: '查询条件',
- listTitle: '列表字段',
- searchField: '查询字段',
- listField: '列表字段',
- activeBtn: {
- ActionButtonUpdate: '编辑',
- ActionButtonDelete: '删除'
- },
- search: {
- addBtn: '编辑',
- emptyText: '未配置查询条件',
- editPopupTitle: '编辑查询字段'
- },
- searchPopup: {
- colTitle: '标题',
- saveBtn: '保存'
- }
- },
- text: {
- copySuccess: '已复制到剪贴板',
- copyError: '当前环境不支持该操作'
- },
- countdown: {
- formats: {
- yyyy: '年',
- MM: '月',
- dd: '天',
- HH: '时',
- mm: '分',
- ss: '秒'
- }
- },
- gantt: {
- tFullFormat: {
- year: '{yy}年',
- quarter: '{yy}年第{q}季度',
- month: '{yy}年{M}月',
- week: '{yy}年第{W}周',
- day: '{yy}年{M}月{E}日',
- date: '{yy}年{M}月{d}日',
- hour: '{yy}年 {M}月{d}日{H}时',
- minute: '{yy}年{M}月{d}日{H}时{m}分'
- },
- tSimpleFormat: {
- year: '{yy}年',
- quarter: '{q}季度',
- month: '{M}月',
- week: '{W}周',
- day: '{d}',
- date: '{d}',
- hour: '{H}时',
- minute: '{m}分'
- },
- dayss: {
- w0: '日',
- w1: '一',
- w2: '二',
- w3: '三',
- w4: '四',
- w5: '五',
- w6: '六'
- }
- },
- plugins: {
- extendCellArea: {
- area: {
- mergeErr: '无法对合并单元格进行该操作',
- multiErr: '无法对多重选择区域进行该操作',
- selectErr: '无法操作指定区域的单元格',
- extendErr: '如果延伸的区域包含被合并的单元格,所有合并的单元格需大小相同',
- pasteMultiErr: '无法粘贴,需要相同大小的复制的区域和粘贴的区域才能执行此操作',
- cpInvalidErr: '该操作无法进行,您选择的区域中存在被禁止的列({0})'
- },
- fnr: {
- title: '查找和替换',
- findLabel: '查找',
- replaceLabel: '替换',
- findTitle: '查找内容:',
- replaceTitle: '替换为:',
- tabs: {
- find: '查找',
- replace: '替换'
- },
- filter: {
- re: '正则表达式',
- whole: '全词匹配',
- sensitive: '区分大小写'
- },
- btns: {
- findNext: '查找下一个',
- findAll: '查找全部',
- replace: '替换',
- replaceAll: '替换全部',
- cancel: '取消'
- },
- header: {
- seq: '#',
- cell: '单元格',
- value: '值'
- },
- body: {
- row: '行:{0}',
- col: '列:{0}'
- },
- empty: '(空值)',
- reError: '无效的正则表达式',
- recordCount: '已找到 {0} 个单元格',
- notCell: '找不到匹配的单元格',
- replaceSuccess: '成功替换 {0} 个单元格'
- }
- },
- extendPivotTable: {
- aggregation: {
- grouping: '分组',
- values: '值',
- groupPlaceholder: '拖至此处进行分组',
- valuesPlaceholder: '拖至此处进行聚合',
- dragExistCol: '该列已存在',
- sortHelpTip: '点击并拖动图标可以调整顺序'
- },
- aggFuncs: {
- sum: '求和',
- count: '计数',
- avg: '平均值',
- min: '最小值',
- max: '最大值',
- first: '首个值',
- last: '末尾值'
- }
- },
- filterComplexInput: {
- menus: {
- fixedColumn: '冻结列',
- fixedGroup: '冻结分组',
- cancelFixed: '取消冻结',
- fixedLeft: '冻结左侧',
- fixedRight: '冻结右侧'
- },
- cases: {
- equal: '等于',
- gt: '大于',
- lt: '小于',
- begin: '开头是',
- endin: '结尾是',
- include: '包含',
- isSensitive: '区分大小写'
- }
- },
- filterCombination: {
- menus: {
- sort: '排序',
- clearSort: '清除排序',
- sortAsc: '升序',
- sortDesc: '降序',
- fixedColumn: '冻结列',
- fixedGroup: '冻结分组',
- cancelFixed: '取消冻结',
- fixedLeft: '冻结左侧',
- fixedRight: '冻结右侧',
- clearFilter: '清除筛选',
- textOption: '文本筛选',
- numberOption: '数值筛选'
- },
- popup: {
- title: '自定义筛选的方式',
- currColumnTitle: '当前列:',
- and: '与',
- or: '或',
- describeHtml: '可用 ? 代表单个字符<br/>用 * 代表任意多个字符'
- },
- cases: {
- equal: '等于',
- unequal: '不等于',
- gt: '大于',
- ge: '大于或等于',
- lt: '小于',
- le: '小于或等于',
- begin: '开头是',
- notbegin: '开头不是',
- endin: '结尾是',
- notendin: '结尾不是',
- include: '包含',
- exclude: '不包含',
- between: '介于',
- custom: '自定义筛选',
- insensitive: '不区分大小写',
- isSensitive: '区分大小写'
- },
- empty: '(空白)',
- notData: '无匹配项'
- }
- },
- pro: {
- area: {
- mergeErr: '无法对合并单元格进行该操作',
- multiErr: '无法对多重选择区域进行该操作',
- extendErr: '如果延伸的区域包含被合并的单元格,所有合并的单元格需大小相同',
- pasteMultiErr: '无法粘贴,需要相同大小的复制的区域和粘贴的区域才能执行此操作'
- },
- fnr: {
- title: '查找和替换',
- findLabel: '查找',
- replaceLabel: '替换',
- findTitle: '查找内容:',
- replaceTitle: '替换为:',
- tabs: {
- find: '查找',
- replace: '替换'
- },
- filter: {
- re: '正则表达式',
- whole: '全词匹配',
- sensitive: '区分大小写'
- },
- btns: {
- findNext: '查找下一个',
- findAll: '查找全部',
- replace: '替换',
- replaceAll: '替换全部',
- cancel: '取消'
- },
- header: {
- seq: '#',
- cell: '单元格',
- value: '值'
- },
- empty: '(空值)',
- reError: '无效的正则表达式',
- recordCount: '已找到 {0} 个单元格',
- notCell: '找不到匹配的单元格',
- replaceSuccess: '成功替换 {0} 个单元格'
- }
- },
- renderer: {
- search: '搜索',
- cases: {
- equal: '等于',
- unequal: '不等于',
- gt: '大于',
- ge: '大于或等于',
- lt: '小于',
- le: '小于或等于',
- begin: '开头是',
- notbegin: '开头不是',
- endin: '结尾是',
- notendin: '结尾不是',
- include: '包含',
- exclude: '不包含',
- between: '介于',
- custom: '自定义筛选',
- insensitive: '不区分大小写',
- isSensitive: '区分大小写'
- },
- combination: {
- menus: {
- sort: '排序',
- clearSort: '清除排序',
- sortAsc: '升序',
- sortDesc: '降序',
- fixedColumn: '冻结列',
- fixedGroup: '冻结分组',
- cancelFixed: '取消冻结',
- fixedLeft: '冻结到左侧',
- fixedRight: '冻结到右侧',
- clearFilter: '清除筛选',
- textOption: '文本筛选',
- numberOption: '数值筛选'
- },
- popup: {
- title: '自定义筛选的方式',
- currColumnTitle: '当前列:',
- and: '与',
- or: '或',
- describeHtml: '可用 ? 代表单个字符<br/>用 * 代表任意多个字符'
- },
- empty: '(空白)',
- notData: '无匹配项'
- }
- }
- }
- });
- ;// CONCATENATED MODULE: ./packages/components.ts
- const components = [VxeColumn, VxeColgroup, VxeGrid, VxeTable, VxeToolbar];
- // 默认安装
- function install(app, options) {
- core_.VxeUI.setConfig(options);
- components.forEach(component => component.install(app));
- }
- // 保留兼容老版本
- if (!core_.VxeUI.hasLanguage('zh-CN')) {
- const defaultLanguage = 'zh-CN';
- core_.VxeUI.setI18n(defaultLanguage, zh_CN);
- core_.VxeUI.setLanguage(defaultLanguage);
- }
- core_.VxeUI.setTheme('light');
- // Components
- ;// CONCATENATED MODULE: ./index.ts
- if (typeof window !== 'undefined' && window.Vue) {
- if (window.VXETable) {
- if (!window.VXETable) {
- window.VXETable = components_namespaceObject;
- }
- }
- window.Vue.use(components_namespaceObject);
- }
- /* harmony default export */ var index = (components_namespaceObject);
- ;// CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/entry-lib.js
- /* harmony default export */ var entry_lib = (index);
- /******/ return __webpack_exports__;
- /******/ })()
- ;
- });
|