table.js 142 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901
  1. module.exports =
  2. /******/ (function(modules) { // webpackBootstrap
  3. /******/ // The module cache
  4. /******/ var installedModules = {};
  5. /******/
  6. /******/ // The require function
  7. /******/ function __webpack_require__(moduleId) {
  8. /******/
  9. /******/ // Check if module is in cache
  10. /******/ if(installedModules[moduleId]) {
  11. /******/ return installedModules[moduleId].exports;
  12. /******/ }
  13. /******/ // Create a new module (and put it into the cache)
  14. /******/ var module = installedModules[moduleId] = {
  15. /******/ i: moduleId,
  16. /******/ l: false,
  17. /******/ exports: {}
  18. /******/ };
  19. /******/
  20. /******/ // Execute the module function
  21. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  22. /******/
  23. /******/ // Flag the module as loaded
  24. /******/ module.l = true;
  25. /******/
  26. /******/ // Return the exports of the module
  27. /******/ return module.exports;
  28. /******/ }
  29. /******/
  30. /******/
  31. /******/ // expose the modules object (__webpack_modules__)
  32. /******/ __webpack_require__.m = modules;
  33. /******/
  34. /******/ // expose the module cache
  35. /******/ __webpack_require__.c = installedModules;
  36. /******/
  37. /******/ // define getter function for harmony exports
  38. /******/ __webpack_require__.d = function(exports, name, getter) {
  39. /******/ if(!__webpack_require__.o(exports, name)) {
  40. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  41. /******/ }
  42. /******/ };
  43. /******/
  44. /******/ // define __esModule on exports
  45. /******/ __webpack_require__.r = function(exports) {
  46. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  47. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  48. /******/ }
  49. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  50. /******/ };
  51. /******/
  52. /******/ // create a fake namespace object
  53. /******/ // mode & 1: value is a module id, require it
  54. /******/ // mode & 2: merge all properties of value into the ns
  55. /******/ // mode & 4: return value when already ns object
  56. /******/ // mode & 8|1: behave like require
  57. /******/ __webpack_require__.t = function(value, mode) {
  58. /******/ if(mode & 1) value = __webpack_require__(value);
  59. /******/ if(mode & 8) return value;
  60. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  61. /******/ var ns = Object.create(null);
  62. /******/ __webpack_require__.r(ns);
  63. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  64. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  65. /******/ return ns;
  66. /******/ };
  67. /******/
  68. /******/ // getDefaultExport function for compatibility with non-harmony modules
  69. /******/ __webpack_require__.n = function(module) {
  70. /******/ var getter = module && module.__esModule ?
  71. /******/ function getDefault() { return module['default']; } :
  72. /******/ function getModuleExports() { return module; };
  73. /******/ __webpack_require__.d(getter, 'a', getter);
  74. /******/ return getter;
  75. /******/ };
  76. /******/
  77. /******/ // Object.prototype.hasOwnProperty.call
  78. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  79. /******/
  80. /******/ // __webpack_public_path__
  81. /******/ __webpack_require__.p = "/dist/";
  82. /******/
  83. /******/
  84. /******/ // Load entry module and return exports
  85. /******/ return __webpack_require__(__webpack_require__.s = 56);
  86. /******/ })
  87. /************************************************************************/
  88. /******/ ([
  89. /* 0 */
  90. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  91. "use strict";
  92. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return normalizeComponent; });
  93. /* globals __VUE_SSR_CONTEXT__ */
  94. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  95. // This module is a runtime utility for cleaner component module output and will
  96. // be included in the final webpack user bundle.
  97. function normalizeComponent (
  98. scriptExports,
  99. render,
  100. staticRenderFns,
  101. functionalTemplate,
  102. injectStyles,
  103. scopeId,
  104. moduleIdentifier, /* server only */
  105. shadowMode /* vue-cli only */
  106. ) {
  107. // Vue.extend constructor export interop
  108. var options = typeof scriptExports === 'function'
  109. ? scriptExports.options
  110. : scriptExports
  111. // render functions
  112. if (render) {
  113. options.render = render
  114. options.staticRenderFns = staticRenderFns
  115. options._compiled = true
  116. }
  117. // functional template
  118. if (functionalTemplate) {
  119. options.functional = true
  120. }
  121. // scopedId
  122. if (scopeId) {
  123. options._scopeId = 'data-v-' + scopeId
  124. }
  125. var hook
  126. if (moduleIdentifier) { // server build
  127. hook = function (context) {
  128. // 2.3 injection
  129. context =
  130. context || // cached call
  131. (this.$vnode && this.$vnode.ssrContext) || // stateful
  132. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  133. // 2.2 with runInNewContext: true
  134. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  135. context = __VUE_SSR_CONTEXT__
  136. }
  137. // inject component styles
  138. if (injectStyles) {
  139. injectStyles.call(this, context)
  140. }
  141. // register component module identifier for async chunk inferrence
  142. if (context && context._registeredComponents) {
  143. context._registeredComponents.add(moduleIdentifier)
  144. }
  145. }
  146. // used by ssr in case component is cached and beforeCreate
  147. // never gets called
  148. options._ssrRegister = hook
  149. } else if (injectStyles) {
  150. hook = shadowMode
  151. ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
  152. : injectStyles
  153. }
  154. if (hook) {
  155. if (options.functional) {
  156. // for template-only hot-reload because in that case the render fn doesn't
  157. // go through the normalizer
  158. options._injectStyles = hook
  159. // register for functioal component in vue file
  160. var originalRender = options.render
  161. options.render = function renderWithStyleInjection (h, context) {
  162. hook.call(context)
  163. return originalRender(h, context)
  164. }
  165. } else {
  166. // inject component registration as beforeCreate hook
  167. var existing = options.beforeCreate
  168. options.beforeCreate = existing
  169. ? [].concat(existing, hook)
  170. : [hook]
  171. }
  172. }
  173. return {
  174. exports: scriptExports,
  175. options: options
  176. }
  177. }
  178. /***/ }),
  179. /* 1 */,
  180. /* 2 */
  181. /***/ (function(module, exports) {
  182. module.exports = require("element-ui/lib/utils/dom");
  183. /***/ }),
  184. /* 3 */
  185. /***/ (function(module, exports) {
  186. module.exports = require("element-ui/lib/utils/util");
  187. /***/ }),
  188. /* 4 */,
  189. /* 5 */
  190. /***/ (function(module, exports) {
  191. module.exports = require("element-ui/lib/utils/vue-popper");
  192. /***/ }),
  193. /* 6 */
  194. /***/ (function(module, exports) {
  195. module.exports = require("element-ui/lib/mixins/locale");
  196. /***/ }),
  197. /* 7 */
  198. /***/ (function(module, exports) {
  199. module.exports = require("vue");
  200. /***/ }),
  201. /* 8 */
  202. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  203. "use strict";
  204. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return getCell; });
  205. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return orderBy; });
  206. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return getColumnById; });
  207. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return getColumnByKey; });
  208. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return getColumnByCell; });
  209. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return getRowIdentity; });
  210. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return getKeysMap; });
  211. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return mergeOptions; });
  212. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return parseWidth; });
  213. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return parseMinWidth; });
  214. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return parseHeight; });
  215. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return compose; });
  216. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return toggleRowStatus; });
  217. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "n", function() { return walkTreeNode; });
  218. /* harmony import */ var element_ui_src_utils_util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3);
  219. /* harmony import */ var element_ui_src_utils_util__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(element_ui_src_utils_util__WEBPACK_IMPORTED_MODULE_0__);
  220. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  221. var getCell = function getCell(event) {
  222. var cell = event.target;
  223. while (cell && cell.tagName.toUpperCase() !== 'HTML') {
  224. if (cell.tagName.toUpperCase() === 'TD') {
  225. return cell;
  226. }
  227. cell = cell.parentNode;
  228. }
  229. return null;
  230. };
  231. var isObject = function isObject(obj) {
  232. return obj !== null && (typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) === 'object';
  233. };
  234. var orderBy = function orderBy(array, sortKey, reverse, sortMethod, sortBy) {
  235. if (!sortKey && !sortMethod && (!sortBy || Array.isArray(sortBy) && !sortBy.length)) {
  236. return array;
  237. }
  238. if (typeof reverse === 'string') {
  239. reverse = reverse === 'descending' ? -1 : 1;
  240. } else {
  241. reverse = reverse && reverse < 0 ? -1 : 1;
  242. }
  243. var getKey = sortMethod ? null : function (value, index) {
  244. if (sortBy) {
  245. if (!Array.isArray(sortBy)) {
  246. sortBy = [sortBy];
  247. }
  248. return sortBy.map(function (by) {
  249. if (typeof by === 'string') {
  250. return Object(element_ui_src_utils_util__WEBPACK_IMPORTED_MODULE_0__["getValueByPath"])(value, by);
  251. } else {
  252. return by(value, index, array);
  253. }
  254. });
  255. }
  256. if (sortKey !== '$key') {
  257. if (isObject(value) && '$value' in value) value = value.$value;
  258. }
  259. return [isObject(value) ? Object(element_ui_src_utils_util__WEBPACK_IMPORTED_MODULE_0__["getValueByPath"])(value, sortKey) : value];
  260. };
  261. var compare = function compare(a, b) {
  262. if (sortMethod) {
  263. return sortMethod(a.value, b.value);
  264. }
  265. for (var i = 0, len = a.key.length; i < len; i++) {
  266. if (a.key[i] < b.key[i]) {
  267. return -1;
  268. }
  269. if (a.key[i] > b.key[i]) {
  270. return 1;
  271. }
  272. }
  273. return 0;
  274. };
  275. return array.map(function (value, index) {
  276. return {
  277. value: value,
  278. index: index,
  279. key: getKey ? getKey(value, index) : null
  280. };
  281. }).sort(function (a, b) {
  282. var order = compare(a, b);
  283. if (!order) {
  284. // make stable https://en.wikipedia.org/wiki/Sorting_algorithm#Stability
  285. order = a.index - b.index;
  286. }
  287. return order * reverse;
  288. }).map(function (item) {
  289. return item.value;
  290. });
  291. };
  292. var getColumnById = function getColumnById(table, columnId) {
  293. var column = null;
  294. table.columns.forEach(function (item) {
  295. if (item.id === columnId) {
  296. column = item;
  297. }
  298. });
  299. return column;
  300. };
  301. var getColumnByKey = function getColumnByKey(table, columnKey) {
  302. var column = null;
  303. for (var i = 0; i < table.columns.length; i++) {
  304. var item = table.columns[i];
  305. if (item.columnKey === columnKey) {
  306. column = item;
  307. break;
  308. }
  309. }
  310. return column;
  311. };
  312. var getColumnByCell = function getColumnByCell(table, cell) {
  313. var matches = (cell.className || '').match(/el-table_[^\s]+/gm);
  314. if (matches) {
  315. return getColumnById(table, matches[0]);
  316. }
  317. return null;
  318. };
  319. var getRowIdentity = function getRowIdentity(row, rowKey) {
  320. if (!row) throw new Error('row is required when get row identity');
  321. if (typeof rowKey === 'string') {
  322. if (rowKey.indexOf('.') < 0) {
  323. return row[rowKey];
  324. }
  325. var key = rowKey.split('.');
  326. var current = row;
  327. for (var i = 0; i < key.length; i++) {
  328. current = current[key[i]];
  329. }
  330. return current;
  331. } else if (typeof rowKey === 'function') {
  332. return rowKey.call(null, row);
  333. }
  334. };
  335. var getKeysMap = function getKeysMap(array, rowKey) {
  336. var arrayMap = {};
  337. (array || []).forEach(function (row, index) {
  338. arrayMap[getRowIdentity(row, rowKey)] = { row: row, index: index };
  339. });
  340. return arrayMap;
  341. };
  342. function hasOwn(obj, key) {
  343. return Object.prototype.hasOwnProperty.call(obj, key);
  344. }
  345. function mergeOptions(defaults, config) {
  346. var options = {};
  347. var key = void 0;
  348. for (key in defaults) {
  349. options[key] = defaults[key];
  350. }
  351. for (key in config) {
  352. if (hasOwn(config, key)) {
  353. var value = config[key];
  354. if (typeof value !== 'undefined') {
  355. options[key] = value;
  356. }
  357. }
  358. }
  359. return options;
  360. }
  361. function parseWidth(width) {
  362. if (width !== undefined) {
  363. width = parseInt(width, 10);
  364. if (isNaN(width)) {
  365. width = null;
  366. }
  367. }
  368. return width;
  369. }
  370. function parseMinWidth(minWidth) {
  371. if (typeof minWidth !== 'undefined') {
  372. minWidth = parseWidth(minWidth);
  373. if (isNaN(minWidth)) {
  374. minWidth = 80;
  375. }
  376. }
  377. return minWidth;
  378. };
  379. function parseHeight(height) {
  380. if (typeof height === 'number') {
  381. return height;
  382. }
  383. if (typeof height === 'string') {
  384. if (/^\d+(?:px)?$/.test(height)) {
  385. return parseInt(height, 10);
  386. } else {
  387. return height;
  388. }
  389. }
  390. return null;
  391. }
  392. // https://github.com/reduxjs/redux/blob/master/src/compose.js
  393. function compose() {
  394. for (var _len = arguments.length, funcs = Array(_len), _key = 0; _key < _len; _key++) {
  395. funcs[_key] = arguments[_key];
  396. }
  397. if (funcs.length === 0) {
  398. return function (arg) {
  399. return arg;
  400. };
  401. }
  402. if (funcs.length === 1) {
  403. return funcs[0];
  404. }
  405. return funcs.reduce(function (a, b) {
  406. return function () {
  407. return a(b.apply(undefined, arguments));
  408. };
  409. });
  410. }
  411. function toggleRowStatus(statusArr, row, newVal) {
  412. var changed = false;
  413. var index = statusArr.indexOf(row);
  414. var included = index !== -1;
  415. var addRow = function addRow() {
  416. statusArr.push(row);
  417. changed = true;
  418. };
  419. var removeRow = function removeRow() {
  420. statusArr.splice(index, 1);
  421. changed = true;
  422. };
  423. if (typeof newVal === 'boolean') {
  424. if (newVal && !included) {
  425. addRow();
  426. } else if (!newVal && included) {
  427. removeRow();
  428. }
  429. } else {
  430. if (included) {
  431. removeRow();
  432. } else {
  433. addRow();
  434. }
  435. }
  436. return changed;
  437. }
  438. function walkTreeNode(root, cb) {
  439. var childrenKey = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'children';
  440. var lazyKey = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'hasChildren';
  441. var isNil = function isNil(array) {
  442. return !(Array.isArray(array) && array.length);
  443. };
  444. function _walker(parent, children, level) {
  445. cb(parent, children, level);
  446. children.forEach(function (item) {
  447. if (item[lazyKey]) {
  448. cb(item, null, level + 1);
  449. return;
  450. }
  451. var children = item[childrenKey];
  452. if (!isNil(children)) {
  453. _walker(item, children, level + 1);
  454. }
  455. });
  456. }
  457. root.forEach(function (item) {
  458. if (item[lazyKey]) {
  459. cb(item, null, 0);
  460. return;
  461. }
  462. var children = item[childrenKey];
  463. if (!isNil(children)) {
  464. _walker(item, children, 0);
  465. }
  466. });
  467. }
  468. /***/ }),
  469. /* 9 */
  470. /***/ (function(module, exports) {
  471. module.exports = require("element-ui/lib/utils/merge");
  472. /***/ }),
  473. /* 10 */,
  474. /* 11 */
  475. /***/ (function(module, exports) {
  476. module.exports = require("element-ui/lib/mixins/migrating");
  477. /***/ }),
  478. /* 12 */
  479. /***/ (function(module, exports) {
  480. module.exports = require("element-ui/lib/utils/clickoutside");
  481. /***/ }),
  482. /* 13 */,
  483. /* 14 */
  484. /***/ (function(module, exports) {
  485. module.exports = require("element-ui/lib/scrollbar");
  486. /***/ }),
  487. /* 15 */
  488. /***/ (function(module, exports) {
  489. module.exports = require("element-ui/lib/utils/popup");
  490. /***/ }),
  491. /* 16 */
  492. /***/ (function(module, exports) {
  493. module.exports = require("element-ui/lib/utils/resize-event");
  494. /***/ }),
  495. /* 17 */
  496. /***/ (function(module, exports) {
  497. module.exports = require("throttle-debounce/debounce");
  498. /***/ }),
  499. /* 18 */
  500. /***/ (function(module, exports) {
  501. module.exports = require("element-ui/lib/checkbox");
  502. /***/ }),
  503. /* 19 */,
  504. /* 20 */,
  505. /* 21 */,
  506. /* 22 */,
  507. /* 23 */,
  508. /* 24 */,
  509. /* 25 */,
  510. /* 26 */,
  511. /* 27 */,
  512. /* 28 */,
  513. /* 29 */
  514. /***/ (function(module, exports) {
  515. module.exports = require("element-ui/lib/tooltip");
  516. /***/ }),
  517. /* 30 */,
  518. /* 31 */,
  519. /* 32 */,
  520. /* 33 */,
  521. /* 34 */,
  522. /* 35 */,
  523. /* 36 */,
  524. /* 37 */,
  525. /* 38 */,
  526. /* 39 */
  527. /***/ (function(module, exports) {
  528. module.exports = require("element-ui/lib/utils/scrollbar-width");
  529. /***/ }),
  530. /* 40 */
  531. /***/ (function(module, exports) {
  532. module.exports = require("element-ui/lib/checkbox-group");
  533. /***/ }),
  534. /* 41 */,
  535. /* 42 */,
  536. /* 43 */
  537. /***/ (function(module, exports) {
  538. module.exports = require("throttle-debounce");
  539. /***/ }),
  540. /* 44 */,
  541. /* 45 */,
  542. /* 46 */
  543. /***/ (function(module, exports) {
  544. module.exports = require("normalize-wheel");
  545. /***/ }),
  546. /* 47 */,
  547. /* 48 */,
  548. /* 49 */,
  549. /* 50 */,
  550. /* 51 */,
  551. /* 52 */,
  552. /* 53 */,
  553. /* 54 */,
  554. /* 55 */,
  555. /* 56 */
  556. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  557. "use strict";
  558. __webpack_require__.r(__webpack_exports__);
  559. // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/table/src/table.vue?vue&type=template&id=493fe34e&
  560. var render = function() {
  561. var _vm = this
  562. var _h = _vm.$createElement
  563. var _c = _vm._self._c || _h
  564. return _c(
  565. "div",
  566. {
  567. staticClass: "el-table",
  568. class: [
  569. {
  570. "el-table--fit": _vm.fit,
  571. "el-table--striped": _vm.stripe,
  572. "el-table--border": _vm.border || _vm.isGroup,
  573. "el-table--hidden": _vm.isHidden,
  574. "el-table--group": _vm.isGroup,
  575. "el-table--fluid-height": _vm.maxHeight,
  576. "el-table--scrollable-x": _vm.layout.scrollX,
  577. "el-table--scrollable-y": _vm.layout.scrollY,
  578. "el-table--enable-row-hover": !_vm.store.states.isComplex,
  579. "el-table--enable-row-transition":
  580. (_vm.store.states.data || []).length !== 0 &&
  581. (_vm.store.states.data || []).length < 100
  582. },
  583. _vm.tableSize ? "el-table--" + _vm.tableSize : ""
  584. ],
  585. on: {
  586. mouseleave: function($event) {
  587. _vm.handleMouseLeave($event)
  588. }
  589. }
  590. },
  591. [
  592. _c(
  593. "div",
  594. { ref: "hiddenColumns", staticClass: "hidden-columns" },
  595. [_vm._t("default")],
  596. 2
  597. ),
  598. _vm.showHeader
  599. ? _c(
  600. "div",
  601. {
  602. directives: [
  603. {
  604. name: "mousewheel",
  605. rawName: "v-mousewheel",
  606. value: _vm.handleHeaderFooterMousewheel,
  607. expression: "handleHeaderFooterMousewheel"
  608. }
  609. ],
  610. ref: "headerWrapper",
  611. staticClass: "el-table__header-wrapper"
  612. },
  613. [
  614. _c("table-header", {
  615. ref: "tableHeader",
  616. style: {
  617. width: _vm.layout.bodyWidth ? _vm.layout.bodyWidth + "px" : ""
  618. },
  619. attrs: {
  620. store: _vm.store,
  621. border: _vm.border,
  622. "default-sort": _vm.defaultSort
  623. }
  624. })
  625. ],
  626. 1
  627. )
  628. : _vm._e(),
  629. _c(
  630. "div",
  631. {
  632. ref: "bodyWrapper",
  633. staticClass: "el-table__body-wrapper",
  634. class: [
  635. _vm.layout.scrollX
  636. ? "is-scrolling-" + _vm.scrollPosition
  637. : "is-scrolling-none"
  638. ],
  639. style: [_vm.bodyHeight]
  640. },
  641. [
  642. _c("table-body", {
  643. style: {
  644. width: _vm.bodyWidth
  645. },
  646. attrs: {
  647. context: _vm.context,
  648. store: _vm.store,
  649. stripe: _vm.stripe,
  650. "row-class-name": _vm.rowClassName,
  651. "row-style": _vm.rowStyle,
  652. highlight: _vm.highlightCurrentRow
  653. }
  654. }),
  655. !_vm.data || _vm.data.length === 0
  656. ? _c(
  657. "div",
  658. {
  659. ref: "emptyBlock",
  660. staticClass: "el-table__empty-block",
  661. style: _vm.emptyBlockStyle
  662. },
  663. [
  664. _c(
  665. "span",
  666. { staticClass: "el-table__empty-text" },
  667. [
  668. _vm._t("empty", [
  669. _vm._v(
  670. _vm._s(_vm.emptyText || _vm.t("el.table.emptyText"))
  671. )
  672. ])
  673. ],
  674. 2
  675. )
  676. ]
  677. )
  678. : _vm._e(),
  679. _vm.$slots.append
  680. ? _c(
  681. "div",
  682. {
  683. ref: "appendWrapper",
  684. staticClass: "el-table__append-wrapper"
  685. },
  686. [_vm._t("append")],
  687. 2
  688. )
  689. : _vm._e()
  690. ],
  691. 1
  692. ),
  693. _vm.showSummary
  694. ? _c(
  695. "div",
  696. {
  697. directives: [
  698. {
  699. name: "show",
  700. rawName: "v-show",
  701. value: _vm.data && _vm.data.length > 0,
  702. expression: "data && data.length > 0"
  703. },
  704. {
  705. name: "mousewheel",
  706. rawName: "v-mousewheel",
  707. value: _vm.handleHeaderFooterMousewheel,
  708. expression: "handleHeaderFooterMousewheel"
  709. }
  710. ],
  711. ref: "footerWrapper",
  712. staticClass: "el-table__footer-wrapper"
  713. },
  714. [
  715. _c("table-footer", {
  716. style: {
  717. width: _vm.layout.bodyWidth ? _vm.layout.bodyWidth + "px" : ""
  718. },
  719. attrs: {
  720. store: _vm.store,
  721. border: _vm.border,
  722. "sum-text": _vm.sumText || _vm.t("el.table.sumText"),
  723. "summary-method": _vm.summaryMethod,
  724. "default-sort": _vm.defaultSort
  725. }
  726. })
  727. ],
  728. 1
  729. )
  730. : _vm._e(),
  731. _vm.fixedColumns.length > 0
  732. ? _c(
  733. "div",
  734. {
  735. directives: [
  736. {
  737. name: "mousewheel",
  738. rawName: "v-mousewheel",
  739. value: _vm.handleFixedMousewheel,
  740. expression: "handleFixedMousewheel"
  741. }
  742. ],
  743. ref: "fixedWrapper",
  744. staticClass: "el-table__fixed",
  745. style: [
  746. {
  747. width: _vm.layout.fixedWidth
  748. ? _vm.layout.fixedWidth + "px"
  749. : ""
  750. },
  751. _vm.fixedHeight
  752. ]
  753. },
  754. [
  755. _vm.showHeader
  756. ? _c(
  757. "div",
  758. {
  759. ref: "fixedHeaderWrapper",
  760. staticClass: "el-table__fixed-header-wrapper"
  761. },
  762. [
  763. _c("table-header", {
  764. ref: "fixedTableHeader",
  765. style: {
  766. width: _vm.bodyWidth
  767. },
  768. attrs: {
  769. fixed: "left",
  770. border: _vm.border,
  771. store: _vm.store
  772. }
  773. })
  774. ],
  775. 1
  776. )
  777. : _vm._e(),
  778. _c(
  779. "div",
  780. {
  781. ref: "fixedBodyWrapper",
  782. staticClass: "el-table__fixed-body-wrapper",
  783. style: [
  784. {
  785. top: _vm.layout.headerHeight + "px"
  786. },
  787. _vm.fixedBodyHeight
  788. ]
  789. },
  790. [
  791. _c("table-body", {
  792. style: {
  793. width: _vm.bodyWidth
  794. },
  795. attrs: {
  796. fixed: "left",
  797. store: _vm.store,
  798. stripe: _vm.stripe,
  799. highlight: _vm.highlightCurrentRow,
  800. "row-class-name": _vm.rowClassName,
  801. "row-style": _vm.rowStyle
  802. }
  803. }),
  804. _vm.$slots.append
  805. ? _c("div", {
  806. staticClass: "el-table__append-gutter",
  807. style: { height: _vm.layout.appendHeight + "px" }
  808. })
  809. : _vm._e()
  810. ],
  811. 1
  812. ),
  813. _vm.showSummary
  814. ? _c(
  815. "div",
  816. {
  817. directives: [
  818. {
  819. name: "show",
  820. rawName: "v-show",
  821. value: _vm.data && _vm.data.length > 0,
  822. expression: "data && data.length > 0"
  823. }
  824. ],
  825. ref: "fixedFooterWrapper",
  826. staticClass: "el-table__fixed-footer-wrapper"
  827. },
  828. [
  829. _c("table-footer", {
  830. style: {
  831. width: _vm.bodyWidth
  832. },
  833. attrs: {
  834. fixed: "left",
  835. border: _vm.border,
  836. "sum-text": _vm.sumText || _vm.t("el.table.sumText"),
  837. "summary-method": _vm.summaryMethod,
  838. store: _vm.store
  839. }
  840. })
  841. ],
  842. 1
  843. )
  844. : _vm._e()
  845. ]
  846. )
  847. : _vm._e(),
  848. _vm.rightFixedColumns.length > 0
  849. ? _c(
  850. "div",
  851. {
  852. directives: [
  853. {
  854. name: "mousewheel",
  855. rawName: "v-mousewheel",
  856. value: _vm.handleFixedMousewheel,
  857. expression: "handleFixedMousewheel"
  858. }
  859. ],
  860. ref: "rightFixedWrapper",
  861. staticClass: "el-table__fixed-right",
  862. style: [
  863. {
  864. width: _vm.layout.rightFixedWidth
  865. ? _vm.layout.rightFixedWidth + "px"
  866. : "",
  867. right: _vm.layout.scrollY
  868. ? (_vm.border
  869. ? _vm.layout.gutterWidth
  870. : _vm.layout.gutterWidth || 0) + "px"
  871. : ""
  872. },
  873. _vm.fixedHeight
  874. ]
  875. },
  876. [
  877. _vm.showHeader
  878. ? _c(
  879. "div",
  880. {
  881. ref: "rightFixedHeaderWrapper",
  882. staticClass: "el-table__fixed-header-wrapper"
  883. },
  884. [
  885. _c("table-header", {
  886. ref: "rightFixedTableHeader",
  887. style: {
  888. width: _vm.bodyWidth
  889. },
  890. attrs: {
  891. fixed: "right",
  892. border: _vm.border,
  893. store: _vm.store
  894. }
  895. })
  896. ],
  897. 1
  898. )
  899. : _vm._e(),
  900. _c(
  901. "div",
  902. {
  903. ref: "rightFixedBodyWrapper",
  904. staticClass: "el-table__fixed-body-wrapper",
  905. style: [
  906. {
  907. top: _vm.layout.headerHeight + "px"
  908. },
  909. _vm.fixedBodyHeight
  910. ]
  911. },
  912. [
  913. _c("table-body", {
  914. style: {
  915. width: _vm.bodyWidth
  916. },
  917. attrs: {
  918. fixed: "right",
  919. store: _vm.store,
  920. stripe: _vm.stripe,
  921. "row-class-name": _vm.rowClassName,
  922. "row-style": _vm.rowStyle,
  923. highlight: _vm.highlightCurrentRow
  924. }
  925. }),
  926. _vm.$slots.append
  927. ? _c("div", {
  928. staticClass: "el-table__append-gutter",
  929. style: { height: _vm.layout.appendHeight + "px" }
  930. })
  931. : _vm._e()
  932. ],
  933. 1
  934. ),
  935. _vm.showSummary
  936. ? _c(
  937. "div",
  938. {
  939. directives: [
  940. {
  941. name: "show",
  942. rawName: "v-show",
  943. value: _vm.data && _vm.data.length > 0,
  944. expression: "data && data.length > 0"
  945. }
  946. ],
  947. ref: "rightFixedFooterWrapper",
  948. staticClass: "el-table__fixed-footer-wrapper"
  949. },
  950. [
  951. _c("table-footer", {
  952. style: {
  953. width: _vm.bodyWidth
  954. },
  955. attrs: {
  956. fixed: "right",
  957. border: _vm.border,
  958. "sum-text": _vm.sumText || _vm.t("el.table.sumText"),
  959. "summary-method": _vm.summaryMethod,
  960. store: _vm.store
  961. }
  962. })
  963. ],
  964. 1
  965. )
  966. : _vm._e()
  967. ]
  968. )
  969. : _vm._e(),
  970. _vm.rightFixedColumns.length > 0
  971. ? _c("div", {
  972. ref: "rightFixedPatch",
  973. staticClass: "el-table__fixed-right-patch",
  974. style: {
  975. width: _vm.layout.scrollY ? _vm.layout.gutterWidth + "px" : "0",
  976. height: _vm.layout.headerHeight + "px"
  977. }
  978. })
  979. : _vm._e(),
  980. _c("div", {
  981. directives: [
  982. {
  983. name: "show",
  984. rawName: "v-show",
  985. value: _vm.resizeProxyVisible,
  986. expression: "resizeProxyVisible"
  987. }
  988. ],
  989. ref: "resizeProxy",
  990. staticClass: "el-table__column-resize-proxy"
  991. })
  992. ]
  993. )
  994. }
  995. var staticRenderFns = []
  996. render._withStripped = true
  997. // CONCATENATED MODULE: ./packages/table/src/table.vue?vue&type=template&id=493fe34e&
  998. // EXTERNAL MODULE: external "element-ui/lib/checkbox"
  999. var checkbox_ = __webpack_require__(18);
  1000. var checkbox_default = /*#__PURE__*/__webpack_require__.n(checkbox_);
  1001. // EXTERNAL MODULE: external "throttle-debounce"
  1002. var external_throttle_debounce_ = __webpack_require__(43);
  1003. // EXTERNAL MODULE: external "element-ui/lib/utils/resize-event"
  1004. var resize_event_ = __webpack_require__(16);
  1005. // EXTERNAL MODULE: external "normalize-wheel"
  1006. var external_normalize_wheel_ = __webpack_require__(46);
  1007. var external_normalize_wheel_default = /*#__PURE__*/__webpack_require__.n(external_normalize_wheel_);
  1008. // CONCATENATED MODULE: ./src/directives/mousewheel.js
  1009. var isFirefox = typeof navigator !== 'undefined' && navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
  1010. var mousewheel_mousewheel = function mousewheel(element, callback) {
  1011. if (element && element.addEventListener) {
  1012. element.addEventListener(isFirefox ? 'DOMMouseScroll' : 'mousewheel', function (event) {
  1013. var normalized = external_normalize_wheel_default()(event);
  1014. callback && callback.apply(this, [event, normalized]);
  1015. });
  1016. }
  1017. };
  1018. /* harmony default export */ var directives_mousewheel = ({
  1019. bind: function bind(el, binding) {
  1020. mousewheel_mousewheel(el, binding.value);
  1021. }
  1022. });
  1023. // EXTERNAL MODULE: external "element-ui/lib/mixins/locale"
  1024. var locale_ = __webpack_require__(6);
  1025. var locale_default = /*#__PURE__*/__webpack_require__.n(locale_);
  1026. // EXTERNAL MODULE: external "element-ui/lib/mixins/migrating"
  1027. var migrating_ = __webpack_require__(11);
  1028. var migrating_default = /*#__PURE__*/__webpack_require__.n(migrating_);
  1029. // EXTERNAL MODULE: external "vue"
  1030. var external_vue_ = __webpack_require__(7);
  1031. var external_vue_default = /*#__PURE__*/__webpack_require__.n(external_vue_);
  1032. // EXTERNAL MODULE: external "element-ui/lib/utils/merge"
  1033. var merge_ = __webpack_require__(9);
  1034. var merge_default = /*#__PURE__*/__webpack_require__.n(merge_);
  1035. // EXTERNAL MODULE: ./packages/table/src/util.js
  1036. var util = __webpack_require__(8);
  1037. // CONCATENATED MODULE: ./packages/table/src/store/expand.js
  1038. /* harmony default export */ var expand = ({
  1039. data: function data() {
  1040. return {
  1041. states: {
  1042. defaultExpandAll: false,
  1043. expandRows: []
  1044. }
  1045. };
  1046. },
  1047. methods: {
  1048. updateExpandRows: function updateExpandRows() {
  1049. var _states = this.states,
  1050. _states$data = _states.data,
  1051. data = _states$data === undefined ? [] : _states$data,
  1052. rowKey = _states.rowKey,
  1053. defaultExpandAll = _states.defaultExpandAll,
  1054. expandRows = _states.expandRows;
  1055. if (defaultExpandAll) {
  1056. this.states.expandRows = data.slice();
  1057. } else if (rowKey) {
  1058. // TODO:这里的代码可以优化
  1059. var expandRowsMap = Object(util["f" /* getKeysMap */])(expandRows, rowKey);
  1060. this.states.expandRows = data.reduce(function (prev, row) {
  1061. var rowId = Object(util["g" /* getRowIdentity */])(row, rowKey);
  1062. var rowInfo = expandRowsMap[rowId];
  1063. if (rowInfo) {
  1064. prev.push(row);
  1065. }
  1066. return prev;
  1067. }, []);
  1068. } else {
  1069. this.states.expandRows = [];
  1070. }
  1071. },
  1072. toggleRowExpansion: function toggleRowExpansion(row, expanded) {
  1073. var changed = Object(util["m" /* toggleRowStatus */])(this.states.expandRows, row, expanded);
  1074. if (changed) {
  1075. this.table.$emit('expand-change', row, this.states.expandRows.slice());
  1076. this.scheduleLayout();
  1077. }
  1078. },
  1079. setExpandRowKeys: function setExpandRowKeys(rowKeys) {
  1080. this.assertRowKey();
  1081. // TODO:这里的代码可以优化
  1082. var _states2 = this.states,
  1083. data = _states2.data,
  1084. rowKey = _states2.rowKey;
  1085. var keysMap = Object(util["f" /* getKeysMap */])(data, rowKey);
  1086. this.states.expandRows = rowKeys.reduce(function (prev, cur) {
  1087. var info = keysMap[cur];
  1088. if (info) {
  1089. prev.push(info.row);
  1090. }
  1091. return prev;
  1092. }, []);
  1093. },
  1094. isRowExpanded: function isRowExpanded(row) {
  1095. var _states3 = this.states,
  1096. _states3$expandRows = _states3.expandRows,
  1097. expandRows = _states3$expandRows === undefined ? [] : _states3$expandRows,
  1098. rowKey = _states3.rowKey;
  1099. if (rowKey) {
  1100. var expandMap = Object(util["f" /* getKeysMap */])(expandRows, rowKey);
  1101. return !!expandMap[Object(util["g" /* getRowIdentity */])(row, rowKey)];
  1102. }
  1103. return expandRows.indexOf(row) !== -1;
  1104. }
  1105. }
  1106. });
  1107. // EXTERNAL MODULE: external "element-ui/lib/utils/util"
  1108. var util_ = __webpack_require__(3);
  1109. // CONCATENATED MODULE: ./packages/table/src/store/current.js
  1110. /* harmony default export */ var current = ({
  1111. data: function data() {
  1112. return {
  1113. states: {
  1114. // 不可响应的,设置 currentRowKey 时,data 不一定存在,也许无法算出正确的 currentRow
  1115. // 把该值缓存一下,当用户点击修改 currentRow 时,把该值重置为 null
  1116. _currentRowKey: null,
  1117. currentRow: null
  1118. }
  1119. };
  1120. },
  1121. methods: {
  1122. setCurrentRowKey: function setCurrentRowKey(key) {
  1123. this.assertRowKey();
  1124. this.states._currentRowKey = key;
  1125. this.setCurrentRowByKey(key);
  1126. },
  1127. restoreCurrentRowKey: function restoreCurrentRowKey() {
  1128. this.states._currentRowKey = null;
  1129. },
  1130. setCurrentRowByKey: function setCurrentRowByKey(key) {
  1131. var states = this.states;
  1132. var _states$data = states.data,
  1133. data = _states$data === undefined ? [] : _states$data,
  1134. rowKey = states.rowKey;
  1135. var currentRow = null;
  1136. if (rowKey) {
  1137. currentRow = Object(util_["arrayFind"])(data, function (item) {
  1138. return Object(util["g" /* getRowIdentity */])(item, rowKey) === key;
  1139. });
  1140. }
  1141. states.currentRow = currentRow;
  1142. },
  1143. updateCurrentRow: function updateCurrentRow(currentRow) {
  1144. var states = this.states,
  1145. table = this.table;
  1146. var oldCurrentRow = states.currentRow;
  1147. if (currentRow && currentRow !== oldCurrentRow) {
  1148. states.currentRow = currentRow;
  1149. table.$emit('current-change', currentRow, oldCurrentRow);
  1150. return;
  1151. }
  1152. if (!currentRow && oldCurrentRow) {
  1153. states.currentRow = null;
  1154. table.$emit('current-change', null, oldCurrentRow);
  1155. }
  1156. },
  1157. updateCurrentRowData: function updateCurrentRowData() {
  1158. var states = this.states,
  1159. table = this.table;
  1160. var rowKey = states.rowKey,
  1161. _currentRowKey = states._currentRowKey;
  1162. // data 为 null 时,解构时的默认值会被忽略
  1163. var data = states.data || [];
  1164. var oldCurrentRow = states.currentRow;
  1165. // 当 currentRow 不在 data 中时尝试更新数据
  1166. if (data.indexOf(oldCurrentRow) === -1 && oldCurrentRow) {
  1167. if (rowKey) {
  1168. var currentRowKey = Object(util["g" /* getRowIdentity */])(oldCurrentRow, rowKey);
  1169. this.setCurrentRowByKey(currentRowKey);
  1170. } else {
  1171. states.currentRow = null;
  1172. }
  1173. if (states.currentRow === null) {
  1174. table.$emit('current-change', null, oldCurrentRow);
  1175. }
  1176. } else if (_currentRowKey) {
  1177. // 把初始时下设置的 rowKey 转化成 rowData
  1178. this.setCurrentRowByKey(_currentRowKey);
  1179. this.restoreCurrentRowKey();
  1180. }
  1181. }
  1182. }
  1183. });
  1184. // CONCATENATED MODULE: ./packages/table/src/store/tree.js
  1185. var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
  1186. /* harmony default export */ var tree = ({
  1187. data: function data() {
  1188. return {
  1189. states: {
  1190. // defaultExpandAll 存在于 expand.js 中,这里不重复添加
  1191. // 在展开行中,expandRowKeys 会被转化成 expandRows,expandRowKeys 这个属性只是记录了 TreeTable 行的展开
  1192. // TODO: 拆分为独立的 TreeTable,统一用法
  1193. expandRowKeys: [],
  1194. treeData: {},
  1195. indent: 16,
  1196. lazy: false,
  1197. lazyTreeNodeMap: {},
  1198. lazyColumnIdentifier: 'hasChildren',
  1199. childrenColumnName: 'children'
  1200. }
  1201. };
  1202. },
  1203. computed: {
  1204. // 嵌入型的数据,watch 无法是检测到变化 https://github.com/ElemeFE/element/issues/14998
  1205. // TODO: 使用 computed 解决该问题,是否会造成性能问题?
  1206. // @return { id: { level, children } }
  1207. normalizedData: function normalizedData() {
  1208. if (!this.states.rowKey) return {};
  1209. var data = this.states.data || [];
  1210. return this.normalize(data);
  1211. },
  1212. // @return { id: { children } }
  1213. // 针对懒加载的情形,不处理嵌套数据
  1214. normalizedLazyNode: function normalizedLazyNode() {
  1215. var _states = this.states,
  1216. rowKey = _states.rowKey,
  1217. lazyTreeNodeMap = _states.lazyTreeNodeMap,
  1218. lazyColumnIdentifier = _states.lazyColumnIdentifier;
  1219. var keys = Object.keys(lazyTreeNodeMap);
  1220. var res = {};
  1221. if (!keys.length) return res;
  1222. keys.forEach(function (key) {
  1223. if (lazyTreeNodeMap[key].length) {
  1224. var item = { children: [] };
  1225. lazyTreeNodeMap[key].forEach(function (row) {
  1226. var currentRowKey = Object(util["g" /* getRowIdentity */])(row, rowKey);
  1227. item.children.push(currentRowKey);
  1228. if (row[lazyColumnIdentifier] && !res[currentRowKey]) {
  1229. res[currentRowKey] = { children: [] };
  1230. }
  1231. });
  1232. res[key] = item;
  1233. }
  1234. });
  1235. return res;
  1236. }
  1237. },
  1238. watch: {
  1239. normalizedData: 'updateTreeData',
  1240. normalizedLazyNode: 'updateTreeData'
  1241. },
  1242. methods: {
  1243. normalize: function normalize(data) {
  1244. var _states2 = this.states,
  1245. childrenColumnName = _states2.childrenColumnName,
  1246. lazyColumnIdentifier = _states2.lazyColumnIdentifier,
  1247. rowKey = _states2.rowKey,
  1248. lazy = _states2.lazy;
  1249. var res = {};
  1250. Object(util["n" /* walkTreeNode */])(data, function (parent, children, level) {
  1251. var parentId = Object(util["g" /* getRowIdentity */])(parent, rowKey);
  1252. if (Array.isArray(children)) {
  1253. res[parentId] = {
  1254. children: children.map(function (row) {
  1255. return Object(util["g" /* getRowIdentity */])(row, rowKey);
  1256. }),
  1257. level: level
  1258. };
  1259. } else if (lazy) {
  1260. // 当 children 不存在且 lazy 为 true,该节点即为懒加载的节点
  1261. res[parentId] = {
  1262. children: [],
  1263. lazy: true,
  1264. level: level
  1265. };
  1266. }
  1267. }, childrenColumnName, lazyColumnIdentifier);
  1268. return res;
  1269. },
  1270. updateTreeData: function updateTreeData() {
  1271. var nested = this.normalizedData;
  1272. var normalizedLazyNode = this.normalizedLazyNode;
  1273. var keys = Object.keys(nested);
  1274. var newTreeData = {};
  1275. if (keys.length) {
  1276. var _states3 = this.states,
  1277. oldTreeData = _states3.treeData,
  1278. defaultExpandAll = _states3.defaultExpandAll,
  1279. expandRowKeys = _states3.expandRowKeys,
  1280. lazy = _states3.lazy;
  1281. var rootLazyRowKeys = [];
  1282. var getExpanded = function getExpanded(oldValue, key) {
  1283. var included = defaultExpandAll || expandRowKeys && expandRowKeys.indexOf(key) !== -1;
  1284. return !!(oldValue && oldValue.expanded || included);
  1285. };
  1286. // 合并 expanded 与 display,确保数据刷新后,状态不变
  1287. keys.forEach(function (key) {
  1288. var oldValue = oldTreeData[key];
  1289. var newValue = _extends({}, nested[key]);
  1290. newValue.expanded = getExpanded(oldValue, key);
  1291. if (newValue.lazy) {
  1292. var _ref = oldValue || {},
  1293. _ref$loaded = _ref.loaded,
  1294. loaded = _ref$loaded === undefined ? false : _ref$loaded,
  1295. _ref$loading = _ref.loading,
  1296. loading = _ref$loading === undefined ? false : _ref$loading;
  1297. newValue.loaded = !!loaded;
  1298. newValue.loading = !!loading;
  1299. rootLazyRowKeys.push(key);
  1300. }
  1301. newTreeData[key] = newValue;
  1302. });
  1303. // 根据懒加载数据更新 treeData
  1304. var lazyKeys = Object.keys(normalizedLazyNode);
  1305. if (lazy && lazyKeys.length && rootLazyRowKeys.length) {
  1306. lazyKeys.forEach(function (key) {
  1307. var oldValue = oldTreeData[key];
  1308. var lazyNodeChildren = normalizedLazyNode[key].children;
  1309. if (rootLazyRowKeys.indexOf(key) !== -1) {
  1310. // 懒加载的 root 节点,更新一下原有的数据,原来的 children 一定是空数组
  1311. if (newTreeData[key].children.length !== 0) {
  1312. throw new Error('[ElTable]children must be an empty array.');
  1313. }
  1314. newTreeData[key].children = lazyNodeChildren;
  1315. } else {
  1316. var _ref2 = oldValue || {},
  1317. _ref2$loaded = _ref2.loaded,
  1318. loaded = _ref2$loaded === undefined ? false : _ref2$loaded,
  1319. _ref2$loading = _ref2.loading,
  1320. loading = _ref2$loading === undefined ? false : _ref2$loading;
  1321. newTreeData[key] = {
  1322. lazy: true,
  1323. loaded: !!loaded,
  1324. loading: !!loading,
  1325. expanded: getExpanded(oldValue, key),
  1326. children: lazyNodeChildren,
  1327. level: ''
  1328. };
  1329. }
  1330. });
  1331. }
  1332. }
  1333. this.states.treeData = newTreeData;
  1334. this.updateTableScrollY();
  1335. },
  1336. updateTreeExpandKeys: function updateTreeExpandKeys(value) {
  1337. this.states.expandRowKeys = value;
  1338. this.updateTreeData();
  1339. },
  1340. toggleTreeExpansion: function toggleTreeExpansion(row, expanded) {
  1341. this.assertRowKey();
  1342. var _states4 = this.states,
  1343. rowKey = _states4.rowKey,
  1344. treeData = _states4.treeData;
  1345. var id = Object(util["g" /* getRowIdentity */])(row, rowKey);
  1346. var data = id && treeData[id];
  1347. if (id && data && 'expanded' in data) {
  1348. var oldExpanded = data.expanded;
  1349. expanded = typeof expanded === 'undefined' ? !data.expanded : expanded;
  1350. treeData[id].expanded = expanded;
  1351. if (oldExpanded !== expanded) {
  1352. this.table.$emit('expand-change', row, expanded);
  1353. }
  1354. this.updateTableScrollY();
  1355. }
  1356. },
  1357. loadOrToggle: function loadOrToggle(row) {
  1358. this.assertRowKey();
  1359. var _states5 = this.states,
  1360. lazy = _states5.lazy,
  1361. treeData = _states5.treeData,
  1362. rowKey = _states5.rowKey;
  1363. var id = Object(util["g" /* getRowIdentity */])(row, rowKey);
  1364. var data = treeData[id];
  1365. if (lazy && data && 'loaded' in data && !data.loaded) {
  1366. this.loadData(row, id, data);
  1367. } else {
  1368. this.toggleTreeExpansion(row);
  1369. }
  1370. },
  1371. loadData: function loadData(row, key, treeNode) {
  1372. var _this = this;
  1373. var load = this.table.load;
  1374. var _states6 = this.states,
  1375. lazyTreeNodeMap = _states6.lazyTreeNodeMap,
  1376. treeData = _states6.treeData;
  1377. if (load && !treeData[key].loaded) {
  1378. treeData[key].loading = true;
  1379. load(row, treeNode, function (data) {
  1380. if (!Array.isArray(data)) {
  1381. throw new Error('[ElTable] data must be an array');
  1382. }
  1383. treeData[key].loading = false;
  1384. treeData[key].loaded = true;
  1385. treeData[key].expanded = true;
  1386. if (data.length) {
  1387. _this.$set(lazyTreeNodeMap, key, data);
  1388. }
  1389. _this.table.$emit('expand-change', row, true);
  1390. });
  1391. }
  1392. }
  1393. }
  1394. });
  1395. // CONCATENATED MODULE: ./packages/table/src/store/watcher.js
  1396. var watcher_sortData = function sortData(data, states) {
  1397. var sortingColumn = states.sortingColumn;
  1398. if (!sortingColumn || typeof sortingColumn.sortable === 'string') {
  1399. return data;
  1400. }
  1401. return Object(util["i" /* orderBy */])(data, states.sortProp, states.sortOrder, sortingColumn.sortMethod, sortingColumn.sortBy);
  1402. };
  1403. var doFlattenColumns = function doFlattenColumns(columns) {
  1404. var result = [];
  1405. columns.forEach(function (column) {
  1406. if (column.children) {
  1407. result.push.apply(result, doFlattenColumns(column.children));
  1408. } else {
  1409. result.push(column);
  1410. }
  1411. });
  1412. return result;
  1413. };
  1414. /* harmony default export */ var watcher = (external_vue_default.a.extend({
  1415. data: function data() {
  1416. return {
  1417. states: {
  1418. // 3.0 版本后要求必须设置该属性
  1419. rowKey: null,
  1420. // 渲染的数据来源,是对 table 中的 data 过滤排序后的结果
  1421. data: [],
  1422. // 是否包含固定列
  1423. isComplex: false,
  1424. // 列
  1425. _columns: [], // 不可响应的
  1426. originColumns: [],
  1427. columns: [],
  1428. fixedColumns: [],
  1429. rightFixedColumns: [],
  1430. leafColumns: [],
  1431. fixedLeafColumns: [],
  1432. rightFixedLeafColumns: [],
  1433. leafColumnsLength: 0,
  1434. fixedLeafColumnsLength: 0,
  1435. rightFixedLeafColumnsLength: 0,
  1436. // 选择
  1437. isAllSelected: false,
  1438. selection: [],
  1439. reserveSelection: false,
  1440. selectOnIndeterminate: false,
  1441. selectable: null,
  1442. // 过滤
  1443. filters: {}, // 不可响应的
  1444. filteredData: null,
  1445. // 排序
  1446. sortingColumn: null,
  1447. sortProp: null,
  1448. sortOrder: null,
  1449. hoverRow: null
  1450. }
  1451. };
  1452. },
  1453. mixins: [expand, current, tree],
  1454. methods: {
  1455. // 检查 rowKey 是否存在
  1456. assertRowKey: function assertRowKey() {
  1457. var rowKey = this.states.rowKey;
  1458. if (!rowKey) throw new Error('[ElTable] prop row-key is required');
  1459. },
  1460. // 更新列
  1461. updateColumns: function updateColumns() {
  1462. var states = this.states;
  1463. var _columns = states._columns || [];
  1464. states.fixedColumns = _columns.filter(function (column) {
  1465. return column.fixed === true || column.fixed === 'left';
  1466. });
  1467. states.rightFixedColumns = _columns.filter(function (column) {
  1468. return column.fixed === 'right';
  1469. });
  1470. if (states.fixedColumns.length > 0 && _columns[0] && _columns[0].type === 'selection' && !_columns[0].fixed) {
  1471. _columns[0].fixed = true;
  1472. states.fixedColumns.unshift(_columns[0]);
  1473. }
  1474. var notFixedColumns = _columns.filter(function (column) {
  1475. return !column.fixed;
  1476. });
  1477. states.originColumns = [].concat(states.fixedColumns).concat(notFixedColumns).concat(states.rightFixedColumns);
  1478. var leafColumns = doFlattenColumns(notFixedColumns);
  1479. var fixedLeafColumns = doFlattenColumns(states.fixedColumns);
  1480. var rightFixedLeafColumns = doFlattenColumns(states.rightFixedColumns);
  1481. states.leafColumnsLength = leafColumns.length;
  1482. states.fixedLeafColumnsLength = fixedLeafColumns.length;
  1483. states.rightFixedLeafColumnsLength = rightFixedLeafColumns.length;
  1484. states.columns = [].concat(fixedLeafColumns).concat(leafColumns).concat(rightFixedLeafColumns);
  1485. states.isComplex = states.fixedColumns.length > 0 || states.rightFixedColumns.length > 0;
  1486. },
  1487. // 更新 DOM
  1488. scheduleLayout: function scheduleLayout(needUpdateColumns) {
  1489. if (needUpdateColumns) {
  1490. this.updateColumns();
  1491. }
  1492. this.table.debouncedUpdateLayout();
  1493. },
  1494. // 选择
  1495. isSelected: function isSelected(row) {
  1496. var _states$selection = this.states.selection,
  1497. selection = _states$selection === undefined ? [] : _states$selection;
  1498. return selection.indexOf(row) > -1;
  1499. },
  1500. clearSelection: function clearSelection() {
  1501. var states = this.states;
  1502. states.isAllSelected = false;
  1503. var oldSelection = states.selection;
  1504. if (oldSelection.length) {
  1505. states.selection = [];
  1506. this.table.$emit('selection-change', []);
  1507. }
  1508. },
  1509. cleanSelection: function cleanSelection() {
  1510. var states = this.states;
  1511. var data = states.data,
  1512. rowKey = states.rowKey,
  1513. selection = states.selection;
  1514. var deleted = void 0;
  1515. if (rowKey) {
  1516. deleted = [];
  1517. var selectedMap = Object(util["f" /* getKeysMap */])(selection, rowKey);
  1518. var dataMap = Object(util["f" /* getKeysMap */])(data, rowKey);
  1519. for (var key in selectedMap) {
  1520. if (selectedMap.hasOwnProperty(key) && !dataMap[key]) {
  1521. deleted.push(selectedMap[key].row);
  1522. }
  1523. }
  1524. } else {
  1525. deleted = selection.filter(function (item) {
  1526. return data.indexOf(item) === -1;
  1527. });
  1528. }
  1529. if (deleted.length) {
  1530. var newSelection = selection.filter(function (item) {
  1531. return deleted.indexOf(item) === -1;
  1532. });
  1533. states.selection = newSelection;
  1534. this.table.$emit('selection-change', newSelection.slice());
  1535. }
  1536. },
  1537. toggleRowSelection: function toggleRowSelection(row, selected) {
  1538. var emitChange = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
  1539. var changed = Object(util["m" /* toggleRowStatus */])(this.states.selection, row, selected);
  1540. if (changed) {
  1541. var newSelection = (this.states.selection || []).slice();
  1542. // 调用 API 修改选中值,不触发 select 事件
  1543. if (emitChange) {
  1544. this.table.$emit('select', newSelection, row);
  1545. }
  1546. this.table.$emit('selection-change', newSelection);
  1547. }
  1548. },
  1549. _toggleAllSelection: function _toggleAllSelection() {
  1550. var states = this.states;
  1551. var _states$data = states.data,
  1552. data = _states$data === undefined ? [] : _states$data,
  1553. selection = states.selection;
  1554. // when only some rows are selected (but not all), select or deselect all of them
  1555. // depending on the value of selectOnIndeterminate
  1556. var value = states.selectOnIndeterminate ? !states.isAllSelected : !(states.isAllSelected || selection.length);
  1557. states.isAllSelected = value;
  1558. var selectionChanged = false;
  1559. data.forEach(function (row, index) {
  1560. if (states.selectable) {
  1561. if (states.selectable.call(null, row, index) && Object(util["m" /* toggleRowStatus */])(selection, row, value)) {
  1562. selectionChanged = true;
  1563. }
  1564. } else {
  1565. if (Object(util["m" /* toggleRowStatus */])(selection, row, value)) {
  1566. selectionChanged = true;
  1567. }
  1568. }
  1569. });
  1570. if (selectionChanged) {
  1571. this.table.$emit('selection-change', selection ? selection.slice() : []);
  1572. }
  1573. this.table.$emit('select-all', selection);
  1574. },
  1575. updateSelectionByRowKey: function updateSelectionByRowKey() {
  1576. var states = this.states;
  1577. var selection = states.selection,
  1578. rowKey = states.rowKey,
  1579. data = states.data;
  1580. var selectedMap = Object(util["f" /* getKeysMap */])(selection, rowKey);
  1581. data.forEach(function (row) {
  1582. var rowId = Object(util["g" /* getRowIdentity */])(row, rowKey);
  1583. var rowInfo = selectedMap[rowId];
  1584. if (rowInfo) {
  1585. selection[rowInfo.index] = row;
  1586. }
  1587. });
  1588. },
  1589. updateAllSelected: function updateAllSelected() {
  1590. var states = this.states;
  1591. var selection = states.selection,
  1592. rowKey = states.rowKey,
  1593. selectable = states.selectable;
  1594. // data 为 null 时,解构时的默认值会被忽略
  1595. var data = states.data || [];
  1596. if (data.length === 0) {
  1597. states.isAllSelected = false;
  1598. return;
  1599. }
  1600. var selectedMap = void 0;
  1601. if (rowKey) {
  1602. selectedMap = Object(util["f" /* getKeysMap */])(selection, rowKey);
  1603. }
  1604. var isSelected = function isSelected(row) {
  1605. if (selectedMap) {
  1606. return !!selectedMap[Object(util["g" /* getRowIdentity */])(row, rowKey)];
  1607. } else {
  1608. return selection.indexOf(row) !== -1;
  1609. }
  1610. };
  1611. var isAllSelected = true;
  1612. var selectedCount = 0;
  1613. for (var i = 0, j = data.length; i < j; i++) {
  1614. var item = data[i];
  1615. var isRowSelectable = selectable && selectable.call(null, item, i);
  1616. if (!isSelected(item)) {
  1617. if (!selectable || isRowSelectable) {
  1618. isAllSelected = false;
  1619. break;
  1620. }
  1621. } else {
  1622. selectedCount++;
  1623. }
  1624. }
  1625. if (selectedCount === 0) isAllSelected = false;
  1626. states.isAllSelected = isAllSelected;
  1627. },
  1628. // 过滤与排序
  1629. updateFilters: function updateFilters(columns, values) {
  1630. if (!Array.isArray(columns)) {
  1631. columns = [columns];
  1632. }
  1633. var states = this.states;
  1634. var filters = {};
  1635. columns.forEach(function (col) {
  1636. states.filters[col.id] = values;
  1637. filters[col.columnKey || col.id] = values;
  1638. });
  1639. return filters;
  1640. },
  1641. updateSort: function updateSort(column, prop, order) {
  1642. if (this.states.sortingColumn && this.states.sortingColumn !== column) {
  1643. this.states.sortingColumn.order = null;
  1644. }
  1645. this.states.sortingColumn = column;
  1646. this.states.sortProp = prop;
  1647. this.states.sortOrder = order;
  1648. },
  1649. execFilter: function execFilter() {
  1650. var _this = this;
  1651. var states = this.states;
  1652. var _data = states._data,
  1653. filters = states.filters;
  1654. var data = _data;
  1655. Object.keys(filters).forEach(function (columnId) {
  1656. var values = states.filters[columnId];
  1657. if (!values || values.length === 0) return;
  1658. var column = Object(util["d" /* getColumnById */])(_this.states, columnId);
  1659. if (column && column.filterMethod) {
  1660. data = data.filter(function (row) {
  1661. return values.some(function (value) {
  1662. return column.filterMethod.call(null, value, row, column);
  1663. });
  1664. });
  1665. }
  1666. });
  1667. states.filteredData = data;
  1668. },
  1669. execSort: function execSort() {
  1670. var states = this.states;
  1671. states.data = watcher_sortData(states.filteredData, states);
  1672. },
  1673. // 根据 filters 与 sort 去过滤 data
  1674. execQuery: function execQuery(ignore) {
  1675. if (!(ignore && ignore.filter)) {
  1676. this.execFilter();
  1677. }
  1678. this.execSort();
  1679. },
  1680. clearFilter: function clearFilter(columnKeys) {
  1681. var states = this.states;
  1682. var _table$$refs = this.table.$refs,
  1683. tableHeader = _table$$refs.tableHeader,
  1684. fixedTableHeader = _table$$refs.fixedTableHeader,
  1685. rightFixedTableHeader = _table$$refs.rightFixedTableHeader;
  1686. var panels = {};
  1687. if (tableHeader) panels = merge_default()(panels, tableHeader.filterPanels);
  1688. if (fixedTableHeader) panels = merge_default()(panels, fixedTableHeader.filterPanels);
  1689. if (rightFixedTableHeader) panels = merge_default()(panels, rightFixedTableHeader.filterPanels);
  1690. var keys = Object.keys(panels);
  1691. if (!keys.length) return;
  1692. if (typeof columnKeys === 'string') {
  1693. columnKeys = [columnKeys];
  1694. }
  1695. if (Array.isArray(columnKeys)) {
  1696. var columns = columnKeys.map(function (key) {
  1697. return Object(util["e" /* getColumnByKey */])(states, key);
  1698. });
  1699. keys.forEach(function (key) {
  1700. var column = columns.find(function (col) {
  1701. return col.id === key;
  1702. });
  1703. if (column) {
  1704. // TODO: 优化这里的代码
  1705. panels[key].filteredValue = [];
  1706. }
  1707. });
  1708. this.commit('filterChange', {
  1709. column: columns,
  1710. values: [],
  1711. silent: true,
  1712. multi: true
  1713. });
  1714. } else {
  1715. keys.forEach(function (key) {
  1716. // TODO: 优化这里的代码
  1717. panels[key].filteredValue = [];
  1718. });
  1719. states.filters = {};
  1720. this.commit('filterChange', {
  1721. column: {},
  1722. values: [],
  1723. silent: true
  1724. });
  1725. }
  1726. },
  1727. clearSort: function clearSort() {
  1728. var states = this.states;
  1729. if (!states.sortingColumn) return;
  1730. this.updateSort(null, null, null);
  1731. this.commit('changeSortCondition', {
  1732. silent: true
  1733. });
  1734. },
  1735. // 适配层,expand-row-keys 在 Expand 与 TreeTable 中都有使用
  1736. setExpandRowKeysAdapter: function setExpandRowKeysAdapter(val) {
  1737. // 这里会触发额外的计算,但为了兼容性,暂时这么做
  1738. this.setExpandRowKeys(val);
  1739. this.updateTreeExpandKeys(val);
  1740. },
  1741. // 展开行与 TreeTable 都要使用
  1742. toggleRowExpansionAdapter: function toggleRowExpansionAdapter(row, expanded) {
  1743. var hasExpandColumn = this.states.columns.some(function (_ref) {
  1744. var type = _ref.type;
  1745. return type === 'expand';
  1746. });
  1747. if (hasExpandColumn) {
  1748. this.toggleRowExpansion(row, expanded);
  1749. } else {
  1750. this.toggleTreeExpansion(row, expanded);
  1751. }
  1752. }
  1753. }
  1754. }));
  1755. // CONCATENATED MODULE: ./packages/table/src/store/index.js
  1756. watcher.prototype.mutations = {
  1757. setData: function setData(states, data) {
  1758. var dataInstanceChanged = states._data !== data;
  1759. states._data = data;
  1760. this.execQuery();
  1761. // 数据变化,更新部分数据。
  1762. // 没有使用 computed,而是手动更新部分数据 https://github.com/vuejs/vue/issues/6660#issuecomment-331417140
  1763. this.updateCurrentRowData();
  1764. this.updateExpandRows();
  1765. if (states.reserveSelection) {
  1766. this.assertRowKey();
  1767. this.updateSelectionByRowKey();
  1768. } else {
  1769. if (dataInstanceChanged) {
  1770. this.clearSelection();
  1771. } else {
  1772. this.cleanSelection();
  1773. }
  1774. }
  1775. this.updateAllSelected();
  1776. this.updateTableScrollY();
  1777. },
  1778. insertColumn: function insertColumn(states, column, index, parent) {
  1779. var array = states._columns;
  1780. if (parent) {
  1781. array = parent.children;
  1782. if (!array) array = parent.children = [];
  1783. }
  1784. if (typeof index !== 'undefined') {
  1785. array.splice(index, 0, column);
  1786. } else {
  1787. array.push(column);
  1788. }
  1789. if (column.type === 'selection') {
  1790. states.selectable = column.selectable;
  1791. states.reserveSelection = column.reserveSelection;
  1792. }
  1793. if (this.table.$ready) {
  1794. this.updateColumns(); // hack for dynamics insert column
  1795. this.scheduleLayout();
  1796. }
  1797. },
  1798. removeColumn: function removeColumn(states, column, parent) {
  1799. var array = states._columns;
  1800. if (parent) {
  1801. array = parent.children;
  1802. if (!array) array = parent.children = [];
  1803. }
  1804. if (array) {
  1805. array.splice(array.indexOf(column), 1);
  1806. }
  1807. if (this.table.$ready) {
  1808. this.updateColumns(); // hack for dynamics remove column
  1809. this.scheduleLayout();
  1810. }
  1811. },
  1812. sort: function sort(states, options) {
  1813. var prop = options.prop,
  1814. order = options.order,
  1815. init = options.init;
  1816. if (prop) {
  1817. var column = Object(util_["arrayFind"])(states.columns, function (column) {
  1818. return column.property === prop;
  1819. });
  1820. if (column) {
  1821. column.order = order;
  1822. this.updateSort(column, prop, order);
  1823. this.commit('changeSortCondition', { init: init });
  1824. }
  1825. }
  1826. },
  1827. changeSortCondition: function changeSortCondition(states, options) {
  1828. // 修复 pr https://github.com/ElemeFE/element/pull/15012 导致的 bug
  1829. var column = states.sortingColumn,
  1830. prop = states.sortProp,
  1831. order = states.sortOrder;
  1832. if (order === null) {
  1833. states.sortingColumn = null;
  1834. states.sortProp = null;
  1835. }
  1836. var ingore = { filter: true };
  1837. this.execQuery(ingore);
  1838. if (!options || !(options.silent || options.init)) {
  1839. this.table.$emit('sort-change', {
  1840. column: column,
  1841. prop: prop,
  1842. order: order
  1843. });
  1844. }
  1845. this.updateTableScrollY();
  1846. },
  1847. filterChange: function filterChange(states, options) {
  1848. var column = options.column,
  1849. values = options.values,
  1850. silent = options.silent;
  1851. var newFilters = this.updateFilters(column, values);
  1852. this.execQuery();
  1853. if (!silent) {
  1854. this.table.$emit('filter-change', newFilters);
  1855. }
  1856. this.updateTableScrollY();
  1857. },
  1858. toggleAllSelection: function toggleAllSelection() {
  1859. this.toggleAllSelection();
  1860. },
  1861. rowSelectedChanged: function rowSelectedChanged(states, row) {
  1862. this.toggleRowSelection(row);
  1863. this.updateAllSelected();
  1864. },
  1865. setHoverRow: function setHoverRow(states, row) {
  1866. states.hoverRow = row;
  1867. },
  1868. setCurrentRow: function setCurrentRow(states, row) {
  1869. this.updateCurrentRow(row);
  1870. }
  1871. };
  1872. watcher.prototype.commit = function (name) {
  1873. var mutations = this.mutations;
  1874. if (mutations[name]) {
  1875. for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  1876. args[_key - 1] = arguments[_key];
  1877. }
  1878. mutations[name].apply(this, [this.states].concat(args));
  1879. } else {
  1880. throw new Error('Action not found: ' + name);
  1881. }
  1882. };
  1883. watcher.prototype.updateTableScrollY = function () {
  1884. external_vue_default.a.nextTick(this.table.updateScrollY);
  1885. };
  1886. /* harmony default export */ var src_store = (watcher);
  1887. // EXTERNAL MODULE: external "throttle-debounce/debounce"
  1888. var debounce_ = __webpack_require__(17);
  1889. var debounce_default = /*#__PURE__*/__webpack_require__.n(debounce_);
  1890. // CONCATENATED MODULE: ./packages/table/src/store/helper.js
  1891. function createStore(table) {
  1892. var initialState = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  1893. if (!table) {
  1894. throw new Error('Table is required.');
  1895. }
  1896. var store = new src_store();
  1897. store.table = table;
  1898. // fix https://github.com/ElemeFE/element/issues/14075
  1899. // related pr https://github.com/ElemeFE/element/pull/14146
  1900. store.toggleAllSelection = debounce_default()(10, store._toggleAllSelection);
  1901. Object.keys(initialState).forEach(function (key) {
  1902. store.states[key] = initialState[key];
  1903. });
  1904. return store;
  1905. }
  1906. function mapStates(mapper) {
  1907. var res = {};
  1908. Object.keys(mapper).forEach(function (key) {
  1909. var value = mapper[key];
  1910. var fn = void 0;
  1911. if (typeof value === 'string') {
  1912. fn = function fn() {
  1913. return this.store.states[value];
  1914. };
  1915. } else if (typeof value === 'function') {
  1916. fn = function fn() {
  1917. return value.call(this, this.store.states);
  1918. };
  1919. } else {
  1920. console.error('invalid value type');
  1921. }
  1922. if (fn) {
  1923. res[key] = fn;
  1924. }
  1925. });
  1926. return res;
  1927. };
  1928. // EXTERNAL MODULE: external "element-ui/lib/utils/scrollbar-width"
  1929. var scrollbar_width_ = __webpack_require__(39);
  1930. var scrollbar_width_default = /*#__PURE__*/__webpack_require__.n(scrollbar_width_);
  1931. // CONCATENATED MODULE: ./packages/table/src/table-layout.js
  1932. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1933. var table_layout_TableLayout = function () {
  1934. function TableLayout(options) {
  1935. _classCallCheck(this, TableLayout);
  1936. this.observers = [];
  1937. this.table = null;
  1938. this.store = null;
  1939. this.columns = null;
  1940. this.fit = true;
  1941. this.showHeader = true;
  1942. this.height = null;
  1943. this.scrollX = false;
  1944. this.scrollY = false;
  1945. this.bodyWidth = null;
  1946. this.fixedWidth = null;
  1947. this.rightFixedWidth = null;
  1948. this.tableHeight = null;
  1949. this.headerHeight = 44; // Table Header Height
  1950. this.appendHeight = 0; // Append Slot Height
  1951. this.footerHeight = 44; // Table Footer Height
  1952. this.viewportHeight = null; // Table Height - Scroll Bar Height
  1953. this.bodyHeight = null; // Table Height - Table Header Height
  1954. this.fixedBodyHeight = null; // Table Height - Table Header Height - Scroll Bar Height
  1955. this.gutterWidth = scrollbar_width_default()();
  1956. for (var name in options) {
  1957. if (options.hasOwnProperty(name)) {
  1958. this[name] = options[name];
  1959. }
  1960. }
  1961. if (!this.table) {
  1962. throw new Error('table is required for Table Layout');
  1963. }
  1964. if (!this.store) {
  1965. throw new Error('store is required for Table Layout');
  1966. }
  1967. }
  1968. TableLayout.prototype.updateScrollY = function updateScrollY() {
  1969. var height = this.height;
  1970. if (height === null) return false;
  1971. var bodyWrapper = this.table.bodyWrapper;
  1972. if (this.table.$el && bodyWrapper) {
  1973. var body = bodyWrapper.querySelector('.el-table__body');
  1974. var prevScrollY = this.scrollY;
  1975. var scrollY = body.offsetHeight > this.bodyHeight;
  1976. this.scrollY = scrollY;
  1977. return prevScrollY !== scrollY;
  1978. }
  1979. return false;
  1980. };
  1981. TableLayout.prototype.setHeight = function setHeight(value) {
  1982. var _this = this;
  1983. var prop = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'height';
  1984. if (external_vue_default.a.prototype.$isServer) return;
  1985. var el = this.table.$el;
  1986. value = Object(util["j" /* parseHeight */])(value);
  1987. this.height = value;
  1988. if (!el && (value || value === 0)) return external_vue_default.a.nextTick(function () {
  1989. return _this.setHeight(value, prop);
  1990. });
  1991. if (typeof value === 'number') {
  1992. el.style[prop] = value + 'px';
  1993. this.updateElsHeight();
  1994. } else if (typeof value === 'string') {
  1995. el.style[prop] = value;
  1996. this.updateElsHeight();
  1997. }
  1998. };
  1999. TableLayout.prototype.setMaxHeight = function setMaxHeight(value) {
  2000. this.setHeight(value, 'max-height');
  2001. };
  2002. TableLayout.prototype.getFlattenColumns = function getFlattenColumns() {
  2003. var flattenColumns = [];
  2004. var columns = this.table.columns;
  2005. columns.forEach(function (column) {
  2006. if (column.isColumnGroup) {
  2007. flattenColumns.push.apply(flattenColumns, column.columns);
  2008. } else {
  2009. flattenColumns.push(column);
  2010. }
  2011. });
  2012. return flattenColumns;
  2013. };
  2014. TableLayout.prototype.updateElsHeight = function updateElsHeight() {
  2015. var _this2 = this;
  2016. if (!this.table.$ready) return external_vue_default.a.nextTick(function () {
  2017. return _this2.updateElsHeight();
  2018. });
  2019. var _table$$refs = this.table.$refs,
  2020. headerWrapper = _table$$refs.headerWrapper,
  2021. appendWrapper = _table$$refs.appendWrapper,
  2022. footerWrapper = _table$$refs.footerWrapper;
  2023. this.appendHeight = appendWrapper ? appendWrapper.offsetHeight : 0;
  2024. if (this.showHeader && !headerWrapper) return;
  2025. // fix issue (https://github.com/ElemeFE/element/pull/16956)
  2026. var headerTrElm = headerWrapper ? headerWrapper.querySelector('.el-table__header tr') : null;
  2027. var noneHeader = this.headerDisplayNone(headerTrElm);
  2028. var headerHeight = this.headerHeight = !this.showHeader ? 0 : headerWrapper.offsetHeight;
  2029. if (this.showHeader && !noneHeader && headerWrapper.offsetWidth > 0 && (this.table.columns || []).length > 0 && headerHeight < 2) {
  2030. return external_vue_default.a.nextTick(function () {
  2031. return _this2.updateElsHeight();
  2032. });
  2033. }
  2034. var tableHeight = this.tableHeight = this.table.$el.clientHeight;
  2035. var footerHeight = this.footerHeight = footerWrapper ? footerWrapper.offsetHeight : 0;
  2036. if (this.height !== null) {
  2037. this.bodyHeight = tableHeight - headerHeight - footerHeight + (footerWrapper ? 1 : 0);
  2038. }
  2039. this.fixedBodyHeight = this.scrollX ? this.bodyHeight - this.gutterWidth : this.bodyHeight;
  2040. var noData = !(this.store.states.data && this.store.states.data.length);
  2041. this.viewportHeight = this.scrollX ? tableHeight - (noData ? 0 : this.gutterWidth) : tableHeight;
  2042. this.updateScrollY();
  2043. this.notifyObservers('scrollable');
  2044. };
  2045. TableLayout.prototype.headerDisplayNone = function headerDisplayNone(elm) {
  2046. if (!elm) return true;
  2047. var headerChild = elm;
  2048. while (headerChild.tagName !== 'DIV') {
  2049. if (getComputedStyle(headerChild).display === 'none') {
  2050. return true;
  2051. }
  2052. headerChild = headerChild.parentElement;
  2053. }
  2054. return false;
  2055. };
  2056. TableLayout.prototype.updateColumnsWidth = function updateColumnsWidth() {
  2057. if (external_vue_default.a.prototype.$isServer) return;
  2058. var fit = this.fit;
  2059. var bodyWidth = this.table.$el.clientWidth;
  2060. var bodyMinWidth = 0;
  2061. var flattenColumns = this.getFlattenColumns();
  2062. var flexColumns = flattenColumns.filter(function (column) {
  2063. return typeof column.width !== 'number';
  2064. });
  2065. flattenColumns.forEach(function (column) {
  2066. // Clean those columns whose width changed from flex to unflex
  2067. if (typeof column.width === 'number' && column.realWidth) column.realWidth = null;
  2068. });
  2069. if (flexColumns.length > 0 && fit) {
  2070. flattenColumns.forEach(function (column) {
  2071. bodyMinWidth += column.width || column.minWidth || 80;
  2072. });
  2073. var scrollYWidth = this.scrollY ? this.gutterWidth : 0;
  2074. if (bodyMinWidth <= bodyWidth - scrollYWidth) {
  2075. // DON'T HAVE SCROLL BAR
  2076. this.scrollX = false;
  2077. var totalFlexWidth = bodyWidth - scrollYWidth - bodyMinWidth;
  2078. if (flexColumns.length === 1) {
  2079. flexColumns[0].realWidth = (flexColumns[0].minWidth || 80) + totalFlexWidth;
  2080. } else {
  2081. var allColumnsWidth = flexColumns.reduce(function (prev, column) {
  2082. return prev + (column.minWidth || 80);
  2083. }, 0);
  2084. var flexWidthPerPixel = totalFlexWidth / allColumnsWidth;
  2085. var noneFirstWidth = 0;
  2086. flexColumns.forEach(function (column, index) {
  2087. if (index === 0) return;
  2088. var flexWidth = Math.floor((column.minWidth || 80) * flexWidthPerPixel);
  2089. noneFirstWidth += flexWidth;
  2090. column.realWidth = (column.minWidth || 80) + flexWidth;
  2091. });
  2092. flexColumns[0].realWidth = (flexColumns[0].minWidth || 80) + totalFlexWidth - noneFirstWidth;
  2093. }
  2094. } else {
  2095. // HAVE HORIZONTAL SCROLL BAR
  2096. this.scrollX = true;
  2097. flexColumns.forEach(function (column) {
  2098. column.realWidth = column.minWidth;
  2099. });
  2100. }
  2101. this.bodyWidth = Math.max(bodyMinWidth, bodyWidth);
  2102. this.table.resizeState.width = this.bodyWidth;
  2103. } else {
  2104. flattenColumns.forEach(function (column) {
  2105. if (!column.width && !column.minWidth) {
  2106. column.realWidth = 80;
  2107. } else {
  2108. column.realWidth = column.width || column.minWidth;
  2109. }
  2110. bodyMinWidth += column.realWidth;
  2111. });
  2112. this.scrollX = bodyMinWidth > bodyWidth;
  2113. this.bodyWidth = bodyMinWidth;
  2114. }
  2115. var fixedColumns = this.store.states.fixedColumns;
  2116. if (fixedColumns.length > 0) {
  2117. var fixedWidth = 0;
  2118. fixedColumns.forEach(function (column) {
  2119. fixedWidth += column.realWidth || column.width;
  2120. });
  2121. this.fixedWidth = fixedWidth;
  2122. }
  2123. var rightFixedColumns = this.store.states.rightFixedColumns;
  2124. if (rightFixedColumns.length > 0) {
  2125. var rightFixedWidth = 0;
  2126. rightFixedColumns.forEach(function (column) {
  2127. rightFixedWidth += column.realWidth || column.width;
  2128. });
  2129. this.rightFixedWidth = rightFixedWidth;
  2130. }
  2131. this.notifyObservers('columns');
  2132. };
  2133. TableLayout.prototype.addObserver = function addObserver(observer) {
  2134. this.observers.push(observer);
  2135. };
  2136. TableLayout.prototype.removeObserver = function removeObserver(observer) {
  2137. var index = this.observers.indexOf(observer);
  2138. if (index !== -1) {
  2139. this.observers.splice(index, 1);
  2140. }
  2141. };
  2142. TableLayout.prototype.notifyObservers = function notifyObservers(event) {
  2143. var _this3 = this;
  2144. var observers = this.observers;
  2145. observers.forEach(function (observer) {
  2146. switch (event) {
  2147. case 'columns':
  2148. observer.onColumnsChange(_this3);
  2149. break;
  2150. case 'scrollable':
  2151. observer.onScrollableChange(_this3);
  2152. break;
  2153. default:
  2154. throw new Error('Table Layout don\'t have event ' + event + '.');
  2155. }
  2156. });
  2157. };
  2158. return TableLayout;
  2159. }();
  2160. /* harmony default export */ var table_layout = (table_layout_TableLayout);
  2161. // EXTERNAL MODULE: external "element-ui/lib/utils/dom"
  2162. var dom_ = __webpack_require__(2);
  2163. // EXTERNAL MODULE: external "element-ui/lib/tooltip"
  2164. var tooltip_ = __webpack_require__(29);
  2165. var tooltip_default = /*#__PURE__*/__webpack_require__.n(tooltip_);
  2166. // CONCATENATED MODULE: ./packages/table/src/layout-observer.js
  2167. /* harmony default export */ var layout_observer = ({
  2168. created: function created() {
  2169. this.tableLayout.addObserver(this);
  2170. },
  2171. destroyed: function destroyed() {
  2172. this.tableLayout.removeObserver(this);
  2173. },
  2174. computed: {
  2175. tableLayout: function tableLayout() {
  2176. var layout = this.layout;
  2177. if (!layout && this.table) {
  2178. layout = this.table.layout;
  2179. }
  2180. if (!layout) {
  2181. throw new Error('Can not find table layout.');
  2182. }
  2183. return layout;
  2184. }
  2185. },
  2186. mounted: function mounted() {
  2187. this.onColumnsChange(this.tableLayout);
  2188. this.onScrollableChange(this.tableLayout);
  2189. },
  2190. updated: function updated() {
  2191. if (this.__updated__) return;
  2192. this.onColumnsChange(this.tableLayout);
  2193. this.onScrollableChange(this.tableLayout);
  2194. this.__updated__ = true;
  2195. },
  2196. methods: {
  2197. onColumnsChange: function onColumnsChange(layout) {
  2198. var cols = this.$el.querySelectorAll('colgroup > col');
  2199. if (!cols.length) return;
  2200. var flattenColumns = layout.getFlattenColumns();
  2201. var columnsMap = {};
  2202. flattenColumns.forEach(function (column) {
  2203. columnsMap[column.id] = column;
  2204. });
  2205. for (var i = 0, j = cols.length; i < j; i++) {
  2206. var col = cols[i];
  2207. var name = col.getAttribute('name');
  2208. var column = columnsMap[name];
  2209. if (column) {
  2210. col.setAttribute('width', column.realWidth || column.width);
  2211. }
  2212. }
  2213. },
  2214. onScrollableChange: function onScrollableChange(layout) {
  2215. var cols = this.$el.querySelectorAll('colgroup > col[name=gutter]');
  2216. for (var i = 0, j = cols.length; i < j; i++) {
  2217. var col = cols[i];
  2218. col.setAttribute('width', layout.scrollY ? layout.gutterWidth : '0');
  2219. }
  2220. var ths = this.$el.querySelectorAll('th.gutter');
  2221. for (var _i = 0, _j = ths.length; _i < _j; _i++) {
  2222. var th = ths[_i];
  2223. th.style.width = layout.scrollY ? layout.gutterWidth + 'px' : '0';
  2224. th.style.display = layout.scrollY ? '' : 'none';
  2225. }
  2226. }
  2227. }
  2228. });
  2229. // CONCATENATED MODULE: ./packages/table/src/table-body.js
  2230. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  2231. var table_body_extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
  2232. /* harmony default export */ var table_body = ({
  2233. name: 'ElTableBody',
  2234. mixins: [layout_observer],
  2235. components: {
  2236. ElCheckbox: checkbox_default.a,
  2237. ElTooltip: tooltip_default.a
  2238. },
  2239. props: {
  2240. store: {
  2241. required: true
  2242. },
  2243. stripe: Boolean,
  2244. context: {},
  2245. rowClassName: [String, Function],
  2246. rowStyle: [Object, Function],
  2247. fixed: String,
  2248. highlight: Boolean
  2249. },
  2250. render: function render(h) {
  2251. var _this = this;
  2252. var data = this.data || [];
  2253. return h(
  2254. 'table',
  2255. {
  2256. 'class': 'el-table__body',
  2257. attrs: { cellspacing: '0',
  2258. cellpadding: '0',
  2259. border: '0' }
  2260. },
  2261. [h('colgroup', [this.columns.map(function (column) {
  2262. return h('col', {
  2263. attrs: { name: column.id },
  2264. key: column.id });
  2265. })]), h('tbody', [data.reduce(function (acc, row) {
  2266. return acc.concat(_this.wrappedRowRender(row, acc.length));
  2267. }, []), h('el-tooltip', {
  2268. attrs: { effect: this.table.tooltipEffect, placement: 'top', content: this.tooltipContent },
  2269. ref: 'tooltip' })])]
  2270. );
  2271. },
  2272. computed: table_body_extends({
  2273. table: function table() {
  2274. return this.$parent;
  2275. }
  2276. }, mapStates({
  2277. data: 'data',
  2278. columns: 'columns',
  2279. treeIndent: 'indent',
  2280. leftFixedLeafCount: 'fixedLeafColumnsLength',
  2281. rightFixedLeafCount: 'rightFixedLeafColumnsLength',
  2282. columnsCount: function columnsCount(states) {
  2283. return states.columns.length;
  2284. },
  2285. leftFixedCount: function leftFixedCount(states) {
  2286. return states.fixedColumns.length;
  2287. },
  2288. rightFixedCount: function rightFixedCount(states) {
  2289. return states.rightFixedColumns.length;
  2290. },
  2291. hasExpandColumn: function hasExpandColumn(states) {
  2292. return states.columns.some(function (_ref) {
  2293. var type = _ref.type;
  2294. return type === 'expand';
  2295. });
  2296. }
  2297. }), {
  2298. firstDefaultColumnIndex: function firstDefaultColumnIndex() {
  2299. return Object(util_["arrayFindIndex"])(this.columns, function (_ref2) {
  2300. var type = _ref2.type;
  2301. return type === 'default';
  2302. });
  2303. }
  2304. }),
  2305. watch: {
  2306. // don't trigger getter of currentRow in getCellClass. see https://jsfiddle.net/oe2b4hqt/
  2307. // update DOM manually. see https://github.com/ElemeFE/element/pull/13954/files#diff-9b450c00d0a9dec0ffad5a3176972e40
  2308. 'store.states.hoverRow': function storeStatesHoverRow(newVal, oldVal) {
  2309. var _this2 = this;
  2310. if (!this.store.states.isComplex || this.$isServer) return;
  2311. var raf = window.requestAnimationFrame;
  2312. if (!raf) {
  2313. raf = function raf(fn) {
  2314. return setTimeout(fn, 16);
  2315. };
  2316. }
  2317. raf(function () {
  2318. var rows = _this2.$el.querySelectorAll('.el-table__row');
  2319. var oldRow = rows[oldVal];
  2320. var newRow = rows[newVal];
  2321. if (oldRow) {
  2322. Object(dom_["removeClass"])(oldRow, 'hover-row');
  2323. }
  2324. if (newRow) {
  2325. Object(dom_["addClass"])(newRow, 'hover-row');
  2326. }
  2327. });
  2328. }
  2329. },
  2330. data: function data() {
  2331. return {
  2332. tooltipContent: ''
  2333. };
  2334. },
  2335. created: function created() {
  2336. this.activateTooltip = debounce_default()(50, function (tooltip) {
  2337. return tooltip.handleShowPopper();
  2338. });
  2339. },
  2340. methods: {
  2341. getKeyOfRow: function getKeyOfRow(row, index) {
  2342. var rowKey = this.table.rowKey;
  2343. if (rowKey) {
  2344. return Object(util["g" /* getRowIdentity */])(row, rowKey);
  2345. }
  2346. return index;
  2347. },
  2348. isColumnHidden: function isColumnHidden(index) {
  2349. if (this.fixed === true || this.fixed === 'left') {
  2350. return index >= this.leftFixedLeafCount;
  2351. } else if (this.fixed === 'right') {
  2352. return index < this.columnsCount - this.rightFixedLeafCount;
  2353. } else {
  2354. return index < this.leftFixedLeafCount || index >= this.columnsCount - this.rightFixedLeafCount;
  2355. }
  2356. },
  2357. getSpan: function getSpan(row, column, rowIndex, columnIndex) {
  2358. var rowspan = 1;
  2359. var colspan = 1;
  2360. var fn = this.table.spanMethod;
  2361. if (typeof fn === 'function') {
  2362. var result = fn({
  2363. row: row,
  2364. column: column,
  2365. rowIndex: rowIndex,
  2366. columnIndex: columnIndex
  2367. });
  2368. if (Array.isArray(result)) {
  2369. rowspan = result[0];
  2370. colspan = result[1];
  2371. } else if ((typeof result === 'undefined' ? 'undefined' : _typeof(result)) === 'object') {
  2372. rowspan = result.rowspan;
  2373. colspan = result.colspan;
  2374. }
  2375. }
  2376. return { rowspan: rowspan, colspan: colspan };
  2377. },
  2378. getRowStyle: function getRowStyle(row, rowIndex) {
  2379. var rowStyle = this.table.rowStyle;
  2380. if (typeof rowStyle === 'function') {
  2381. return rowStyle.call(null, {
  2382. row: row,
  2383. rowIndex: rowIndex
  2384. });
  2385. }
  2386. return rowStyle || null;
  2387. },
  2388. getRowClass: function getRowClass(row, rowIndex) {
  2389. var classes = ['el-table__row'];
  2390. if (this.table.highlightCurrentRow && row === this.store.states.currentRow) {
  2391. classes.push('current-row');
  2392. }
  2393. if (this.stripe && rowIndex % 2 === 1) {
  2394. classes.push('el-table__row--striped');
  2395. }
  2396. var rowClassName = this.table.rowClassName;
  2397. if (typeof rowClassName === 'string') {
  2398. classes.push(rowClassName);
  2399. } else if (typeof rowClassName === 'function') {
  2400. classes.push(rowClassName.call(null, {
  2401. row: row,
  2402. rowIndex: rowIndex
  2403. }));
  2404. }
  2405. if (this.store.states.expandRows.indexOf(row) > -1) {
  2406. classes.push('expanded');
  2407. }
  2408. return classes;
  2409. },
  2410. getCellStyle: function getCellStyle(rowIndex, columnIndex, row, column) {
  2411. var cellStyle = this.table.cellStyle;
  2412. if (typeof cellStyle === 'function') {
  2413. return cellStyle.call(null, {
  2414. rowIndex: rowIndex,
  2415. columnIndex: columnIndex,
  2416. row: row,
  2417. column: column
  2418. });
  2419. }
  2420. return cellStyle;
  2421. },
  2422. getCellClass: function getCellClass(rowIndex, columnIndex, row, column) {
  2423. var classes = [column.id, column.align, column.className];
  2424. if (this.isColumnHidden(columnIndex)) {
  2425. classes.push('is-hidden');
  2426. }
  2427. var cellClassName = this.table.cellClassName;
  2428. if (typeof cellClassName === 'string') {
  2429. classes.push(cellClassName);
  2430. } else if (typeof cellClassName === 'function') {
  2431. classes.push(cellClassName.call(null, {
  2432. rowIndex: rowIndex,
  2433. columnIndex: columnIndex,
  2434. row: row,
  2435. column: column
  2436. }));
  2437. }
  2438. return classes.join(' ');
  2439. },
  2440. getColspanRealWidth: function getColspanRealWidth(columns, colspan, index) {
  2441. if (colspan < 1) {
  2442. return columns[index].realWidth;
  2443. }
  2444. var widthArr = columns.map(function (_ref3) {
  2445. var realWidth = _ref3.realWidth;
  2446. return realWidth;
  2447. }).slice(index, index + colspan);
  2448. return widthArr.reduce(function (acc, width) {
  2449. return acc + width;
  2450. }, -1);
  2451. },
  2452. handleCellMouseEnter: function handleCellMouseEnter(event, row) {
  2453. var table = this.table;
  2454. var cell = Object(util["b" /* getCell */])(event);
  2455. if (cell) {
  2456. var column = Object(util["c" /* getColumnByCell */])(table, cell);
  2457. var hoverState = table.hoverState = { cell: cell, column: column, row: row };
  2458. table.$emit('cell-mouse-enter', hoverState.row, hoverState.column, hoverState.cell, event);
  2459. }
  2460. // 判断是否text-overflow, 如果是就显示tooltip
  2461. var cellChild = event.target.querySelector('.cell');
  2462. if (!(Object(dom_["hasClass"])(cellChild, 'el-tooltip') && cellChild.childNodes.length)) {
  2463. return;
  2464. }
  2465. // use range width instead of scrollWidth to determine whether the text is overflowing
  2466. // to address a potential FireFox bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1074543#c3
  2467. var range = document.createRange();
  2468. range.setStart(cellChild, 0);
  2469. range.setEnd(cellChild, cellChild.childNodes.length);
  2470. var rangeWidth = range.getBoundingClientRect().width;
  2471. var padding = (parseInt(Object(dom_["getStyle"])(cellChild, 'paddingLeft'), 10) || 0) + (parseInt(Object(dom_["getStyle"])(cellChild, 'paddingRight'), 10) || 0);
  2472. if ((rangeWidth + padding > cellChild.offsetWidth || cellChild.scrollWidth > cellChild.offsetWidth) && this.$refs.tooltip) {
  2473. var tooltip = this.$refs.tooltip;
  2474. // TODO 会引起整个 Table 的重新渲染,需要优化
  2475. this.tooltipContent = cell.innerText || cell.textContent;
  2476. tooltip.referenceElm = cell;
  2477. tooltip.$refs.popper && (tooltip.$refs.popper.style.display = 'none');
  2478. tooltip.doDestroy();
  2479. tooltip.setExpectedState(true);
  2480. this.activateTooltip(tooltip);
  2481. }
  2482. },
  2483. handleCellMouseLeave: function handleCellMouseLeave(event) {
  2484. var tooltip = this.$refs.tooltip;
  2485. if (tooltip) {
  2486. tooltip.setExpectedState(false);
  2487. tooltip.handleClosePopper();
  2488. }
  2489. var cell = Object(util["b" /* getCell */])(event);
  2490. if (!cell) return;
  2491. var oldHoverState = this.table.hoverState || {};
  2492. this.table.$emit('cell-mouse-leave', oldHoverState.row, oldHoverState.column, oldHoverState.cell, event);
  2493. },
  2494. handleMouseEnter: debounce_default()(30, function (index) {
  2495. this.store.commit('setHoverRow', index);
  2496. }),
  2497. handleMouseLeave: debounce_default()(30, function () {
  2498. this.store.commit('setHoverRow', null);
  2499. }),
  2500. handleContextMenu: function handleContextMenu(event, row) {
  2501. this.handleEvent(event, row, 'contextmenu');
  2502. },
  2503. handleDoubleClick: function handleDoubleClick(event, row) {
  2504. this.handleEvent(event, row, 'dblclick');
  2505. },
  2506. handleClick: function handleClick(event, row) {
  2507. this.store.commit('setCurrentRow', row);
  2508. this.handleEvent(event, row, 'click');
  2509. },
  2510. handleEvent: function handleEvent(event, row, name) {
  2511. var table = this.table;
  2512. var cell = Object(util["b" /* getCell */])(event);
  2513. var column = void 0;
  2514. if (cell) {
  2515. column = Object(util["c" /* getColumnByCell */])(table, cell);
  2516. if (column) {
  2517. table.$emit('cell-' + name, row, column, cell, event);
  2518. }
  2519. }
  2520. table.$emit('row-' + name, row, column, event);
  2521. },
  2522. rowRender: function rowRender(row, $index, treeRowData) {
  2523. var _this3 = this;
  2524. var h = this.$createElement;
  2525. var treeIndent = this.treeIndent,
  2526. columns = this.columns,
  2527. firstDefaultColumnIndex = this.firstDefaultColumnIndex;
  2528. var columnsHidden = columns.map(function (column, index) {
  2529. return _this3.isColumnHidden(index);
  2530. });
  2531. var rowClasses = this.getRowClass(row, $index);
  2532. var display = true;
  2533. if (treeRowData) {
  2534. rowClasses.push('el-table__row--level-' + treeRowData.level);
  2535. display = treeRowData.display;
  2536. }
  2537. // 指令 v-show 会覆盖 row-style 中 display
  2538. // 使用 :style 代替 v-show https://github.com/ElemeFE/element/issues/16995
  2539. var displayStyle = display ? null : {
  2540. display: 'none'
  2541. };
  2542. return h(
  2543. 'tr',
  2544. {
  2545. style: [displayStyle, this.getRowStyle(row, $index)],
  2546. 'class': rowClasses,
  2547. key: this.getKeyOfRow(row, $index),
  2548. on: {
  2549. 'dblclick': function dblclick($event) {
  2550. return _this3.handleDoubleClick($event, row);
  2551. },
  2552. 'click': function click($event) {
  2553. return _this3.handleClick($event, row);
  2554. },
  2555. 'contextmenu': function contextmenu($event) {
  2556. return _this3.handleContextMenu($event, row);
  2557. },
  2558. 'mouseenter': function mouseenter(_) {
  2559. return _this3.handleMouseEnter($index);
  2560. },
  2561. 'mouseleave': this.handleMouseLeave
  2562. }
  2563. },
  2564. [columns.map(function (column, cellIndex) {
  2565. var _getSpan = _this3.getSpan(row, column, $index, cellIndex),
  2566. rowspan = _getSpan.rowspan,
  2567. colspan = _getSpan.colspan;
  2568. if (!rowspan || !colspan) {
  2569. return null;
  2570. }
  2571. var columnData = table_body_extends({}, column);
  2572. columnData.realWidth = _this3.getColspanRealWidth(columns, colspan, cellIndex);
  2573. var data = {
  2574. store: _this3.store,
  2575. _self: _this3.context || _this3.table.$vnode.context,
  2576. column: columnData,
  2577. row: row,
  2578. $index: $index
  2579. };
  2580. if (cellIndex === firstDefaultColumnIndex && treeRowData) {
  2581. data.treeNode = {
  2582. indent: treeRowData.level * treeIndent,
  2583. level: treeRowData.level
  2584. };
  2585. if (typeof treeRowData.expanded === 'boolean') {
  2586. data.treeNode.expanded = treeRowData.expanded;
  2587. // 表明是懒加载
  2588. if ('loading' in treeRowData) {
  2589. data.treeNode.loading = treeRowData.loading;
  2590. }
  2591. if ('noLazyChildren' in treeRowData) {
  2592. data.treeNode.noLazyChildren = treeRowData.noLazyChildren;
  2593. }
  2594. }
  2595. }
  2596. return h(
  2597. 'td',
  2598. {
  2599. style: _this3.getCellStyle($index, cellIndex, row, column),
  2600. 'class': _this3.getCellClass($index, cellIndex, row, column),
  2601. attrs: { rowspan: rowspan,
  2602. colspan: colspan
  2603. },
  2604. on: {
  2605. 'mouseenter': function mouseenter($event) {
  2606. return _this3.handleCellMouseEnter($event, row);
  2607. },
  2608. 'mouseleave': _this3.handleCellMouseLeave
  2609. }
  2610. },
  2611. [column.renderCell.call(_this3._renderProxy, _this3.$createElement, data, columnsHidden[cellIndex])]
  2612. );
  2613. })]
  2614. );
  2615. },
  2616. wrappedRowRender: function wrappedRowRender(row, $index) {
  2617. var _this4 = this;
  2618. var h = this.$createElement;
  2619. var store = this.store;
  2620. var isRowExpanded = store.isRowExpanded,
  2621. assertRowKey = store.assertRowKey;
  2622. var _store$states = store.states,
  2623. treeData = _store$states.treeData,
  2624. lazyTreeNodeMap = _store$states.lazyTreeNodeMap,
  2625. childrenColumnName = _store$states.childrenColumnName,
  2626. rowKey = _store$states.rowKey;
  2627. if (this.hasExpandColumn && isRowExpanded(row)) {
  2628. var renderExpanded = this.table.renderExpanded;
  2629. var tr = this.rowRender(row, $index);
  2630. if (!renderExpanded) {
  2631. console.error('[Element Error]renderExpanded is required.');
  2632. return tr;
  2633. }
  2634. // 使用二维数组,避免修改 $index
  2635. return [[tr, h(
  2636. 'tr',
  2637. { key: 'expanded-row__' + tr.key },
  2638. [h(
  2639. 'td',
  2640. {
  2641. attrs: { colspan: this.columnsCount },
  2642. 'class': 'el-table__expanded-cell' },
  2643. [renderExpanded(this.$createElement, { row: row, $index: $index, store: this.store })]
  2644. )]
  2645. )]];
  2646. } else if (Object.keys(treeData).length) {
  2647. assertRowKey();
  2648. // TreeTable 时,rowKey 必须由用户设定,不使用 getKeyOfRow 计算
  2649. // 在调用 rowRender 函数时,仍然会计算 rowKey,不太好的操作
  2650. var key = Object(util["g" /* getRowIdentity */])(row, rowKey);
  2651. var cur = treeData[key];
  2652. var treeRowData = null;
  2653. if (cur) {
  2654. treeRowData = {
  2655. expanded: cur.expanded,
  2656. level: cur.level,
  2657. display: true
  2658. };
  2659. if (typeof cur.lazy === 'boolean') {
  2660. if (typeof cur.loaded === 'boolean' && cur.loaded) {
  2661. treeRowData.noLazyChildren = !(cur.children && cur.children.length);
  2662. }
  2663. treeRowData.loading = cur.loading;
  2664. }
  2665. }
  2666. var tmp = [this.rowRender(row, $index, treeRowData)];
  2667. // 渲染嵌套数据
  2668. if (cur) {
  2669. // currentRow 记录的是 index,所以还需主动增加 TreeTable 的 index
  2670. var i = 0;
  2671. var traverse = function traverse(children, parent) {
  2672. if (!(children && children.length && parent)) return;
  2673. children.forEach(function (node) {
  2674. // 父节点的 display 状态影响子节点的显示状态
  2675. var innerTreeRowData = {
  2676. display: parent.display && parent.expanded,
  2677. level: parent.level + 1
  2678. };
  2679. var childKey = Object(util["g" /* getRowIdentity */])(node, rowKey);
  2680. if (childKey === undefined || childKey === null) {
  2681. throw new Error('for nested data item, row-key is required.');
  2682. }
  2683. cur = table_body_extends({}, treeData[childKey]);
  2684. // 对于当前节点,分成有无子节点两种情况。
  2685. // 如果包含子节点的,设置 expanded 属性。
  2686. // 对于它子节点的 display 属性由它本身的 expanded 与 display 共同决定。
  2687. if (cur) {
  2688. innerTreeRowData.expanded = cur.expanded;
  2689. // 懒加载的某些节点,level 未知
  2690. cur.level = cur.level || innerTreeRowData.level;
  2691. cur.display = !!(cur.expanded && innerTreeRowData.display);
  2692. if (typeof cur.lazy === 'boolean') {
  2693. if (typeof cur.loaded === 'boolean' && cur.loaded) {
  2694. innerTreeRowData.noLazyChildren = !(cur.children && cur.children.length);
  2695. }
  2696. innerTreeRowData.loading = cur.loading;
  2697. }
  2698. }
  2699. i++;
  2700. tmp.push(_this4.rowRender(node, $index + i, innerTreeRowData));
  2701. if (cur) {
  2702. var _nodes = lazyTreeNodeMap[childKey] || node[childrenColumnName];
  2703. traverse(_nodes, cur);
  2704. }
  2705. });
  2706. };
  2707. // 对于 root 节点,display 一定为 true
  2708. cur.display = true;
  2709. var nodes = lazyTreeNodeMap[key] || row[childrenColumnName];
  2710. traverse(nodes, cur);
  2711. }
  2712. return tmp;
  2713. } else {
  2714. return this.rowRender(row, $index);
  2715. }
  2716. }
  2717. }
  2718. });
  2719. // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/table/src/filter-panel.vue?vue&type=template&id=7f2c919f&
  2720. var filter_panelvue_type_template_id_7f2c919f_render = function() {
  2721. var _vm = this
  2722. var _h = _vm.$createElement
  2723. var _c = _vm._self._c || _h
  2724. return _c("transition", { attrs: { name: "el-zoom-in-top" } }, [
  2725. _vm.multiple
  2726. ? _c(
  2727. "div",
  2728. {
  2729. directives: [
  2730. {
  2731. name: "clickoutside",
  2732. rawName: "v-clickoutside",
  2733. value: _vm.handleOutsideClick,
  2734. expression: "handleOutsideClick"
  2735. },
  2736. {
  2737. name: "show",
  2738. rawName: "v-show",
  2739. value: _vm.showPopper,
  2740. expression: "showPopper"
  2741. }
  2742. ],
  2743. staticClass: "el-table-filter"
  2744. },
  2745. [
  2746. _c(
  2747. "div",
  2748. { staticClass: "el-table-filter__content" },
  2749. [
  2750. _c(
  2751. "el-scrollbar",
  2752. { attrs: { "wrap-class": "el-table-filter__wrap" } },
  2753. [
  2754. _c(
  2755. "el-checkbox-group",
  2756. {
  2757. staticClass: "el-table-filter__checkbox-group",
  2758. model: {
  2759. value: _vm.filteredValue,
  2760. callback: function($$v) {
  2761. _vm.filteredValue = $$v
  2762. },
  2763. expression: "filteredValue"
  2764. }
  2765. },
  2766. _vm._l(_vm.filters, function(filter) {
  2767. return _c(
  2768. "el-checkbox",
  2769. { key: filter.value, attrs: { label: filter.value } },
  2770. [_vm._v(_vm._s(filter.text))]
  2771. )
  2772. }),
  2773. 1
  2774. )
  2775. ],
  2776. 1
  2777. )
  2778. ],
  2779. 1
  2780. ),
  2781. _c("div", { staticClass: "el-table-filter__bottom" }, [
  2782. _c(
  2783. "button",
  2784. {
  2785. class: { "is-disabled": _vm.filteredValue.length === 0 },
  2786. attrs: { disabled: _vm.filteredValue.length === 0 },
  2787. on: { click: _vm.handleConfirm }
  2788. },
  2789. [_vm._v(_vm._s(_vm.t("el.table.confirmFilter")))]
  2790. ),
  2791. _c("button", { on: { click: _vm.handleReset } }, [
  2792. _vm._v(_vm._s(_vm.t("el.table.resetFilter")))
  2793. ])
  2794. ])
  2795. ]
  2796. )
  2797. : _c(
  2798. "div",
  2799. {
  2800. directives: [
  2801. {
  2802. name: "clickoutside",
  2803. rawName: "v-clickoutside",
  2804. value: _vm.handleOutsideClick,
  2805. expression: "handleOutsideClick"
  2806. },
  2807. {
  2808. name: "show",
  2809. rawName: "v-show",
  2810. value: _vm.showPopper,
  2811. expression: "showPopper"
  2812. }
  2813. ],
  2814. staticClass: "el-table-filter"
  2815. },
  2816. [
  2817. _c(
  2818. "ul",
  2819. { staticClass: "el-table-filter__list" },
  2820. [
  2821. _c(
  2822. "li",
  2823. {
  2824. staticClass: "el-table-filter__list-item",
  2825. class: {
  2826. "is-active":
  2827. _vm.filterValue === undefined ||
  2828. _vm.filterValue === null
  2829. },
  2830. on: {
  2831. click: function($event) {
  2832. _vm.handleSelect(null)
  2833. }
  2834. }
  2835. },
  2836. [_vm._v(_vm._s(_vm.t("el.table.clearFilter")))]
  2837. ),
  2838. _vm._l(_vm.filters, function(filter) {
  2839. return _c(
  2840. "li",
  2841. {
  2842. key: filter.value,
  2843. staticClass: "el-table-filter__list-item",
  2844. class: { "is-active": _vm.isActive(filter) },
  2845. attrs: { label: filter.value },
  2846. on: {
  2847. click: function($event) {
  2848. _vm.handleSelect(filter.value)
  2849. }
  2850. }
  2851. },
  2852. [_vm._v(_vm._s(filter.text))]
  2853. )
  2854. })
  2855. ],
  2856. 2
  2857. )
  2858. ]
  2859. )
  2860. ])
  2861. }
  2862. var filter_panelvue_type_template_id_7f2c919f_staticRenderFns = []
  2863. filter_panelvue_type_template_id_7f2c919f_render._withStripped = true
  2864. // CONCATENATED MODULE: ./packages/table/src/filter-panel.vue?vue&type=template&id=7f2c919f&
  2865. // EXTERNAL MODULE: external "element-ui/lib/utils/vue-popper"
  2866. var vue_popper_ = __webpack_require__(5);
  2867. var vue_popper_default = /*#__PURE__*/__webpack_require__.n(vue_popper_);
  2868. // EXTERNAL MODULE: external "element-ui/lib/utils/popup"
  2869. var popup_ = __webpack_require__(15);
  2870. // EXTERNAL MODULE: external "element-ui/lib/utils/clickoutside"
  2871. var clickoutside_ = __webpack_require__(12);
  2872. var clickoutside_default = /*#__PURE__*/__webpack_require__.n(clickoutside_);
  2873. // CONCATENATED MODULE: ./packages/table/src/dropdown.js
  2874. var dropdowns = [];
  2875. !external_vue_default.a.prototype.$isServer && document.addEventListener('click', function (event) {
  2876. dropdowns.forEach(function (dropdown) {
  2877. var target = event.target;
  2878. if (!dropdown || !dropdown.$el) return;
  2879. if (target === dropdown.$el || dropdown.$el.contains(target)) {
  2880. return;
  2881. }
  2882. dropdown.handleOutsideClick && dropdown.handleOutsideClick(event);
  2883. });
  2884. });
  2885. /* harmony default export */ var dropdown = ({
  2886. open: function open(instance) {
  2887. if (instance) {
  2888. dropdowns.push(instance);
  2889. }
  2890. },
  2891. close: function close(instance) {
  2892. var index = dropdowns.indexOf(instance);
  2893. if (index !== -1) {
  2894. dropdowns.splice(instance, 1);
  2895. }
  2896. }
  2897. });
  2898. // EXTERNAL MODULE: external "element-ui/lib/checkbox-group"
  2899. var checkbox_group_ = __webpack_require__(40);
  2900. var checkbox_group_default = /*#__PURE__*/__webpack_require__.n(checkbox_group_);
  2901. // EXTERNAL MODULE: external "element-ui/lib/scrollbar"
  2902. var scrollbar_ = __webpack_require__(14);
  2903. var scrollbar_default = /*#__PURE__*/__webpack_require__.n(scrollbar_);
  2904. // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/table/src/filter-panel.vue?vue&type=script&lang=js&
  2905. //
  2906. //
  2907. //
  2908. //
  2909. //
  2910. //
  2911. //
  2912. //
  2913. //
  2914. //
  2915. //
  2916. //
  2917. //
  2918. //
  2919. //
  2920. //
  2921. //
  2922. //
  2923. //
  2924. //
  2925. //
  2926. //
  2927. //
  2928. //
  2929. //
  2930. //
  2931. //
  2932. //
  2933. //
  2934. //
  2935. //
  2936. //
  2937. //
  2938. //
  2939. //
  2940. //
  2941. //
  2942. //
  2943. //
  2944. //
  2945. //
  2946. //
  2947. //
  2948. //
  2949. /* harmony default export */ var filter_panelvue_type_script_lang_js_ = ({
  2950. name: 'ElTableFilterPanel',
  2951. mixins: [vue_popper_default.a, locale_default.a],
  2952. directives: {
  2953. Clickoutside: clickoutside_default.a
  2954. },
  2955. components: {
  2956. ElCheckbox: checkbox_default.a,
  2957. ElCheckboxGroup: checkbox_group_default.a,
  2958. ElScrollbar: scrollbar_default.a
  2959. },
  2960. props: {
  2961. placement: {
  2962. type: String,
  2963. default: 'bottom-end'
  2964. }
  2965. },
  2966. methods: {
  2967. isActive: function isActive(filter) {
  2968. return filter.value === this.filterValue;
  2969. },
  2970. handleOutsideClick: function handleOutsideClick() {
  2971. var _this = this;
  2972. setTimeout(function () {
  2973. _this.showPopper = false;
  2974. }, 16);
  2975. },
  2976. handleConfirm: function handleConfirm() {
  2977. this.confirmFilter(this.filteredValue);
  2978. this.handleOutsideClick();
  2979. },
  2980. handleReset: function handleReset() {
  2981. this.filteredValue = [];
  2982. this.confirmFilter(this.filteredValue);
  2983. this.handleOutsideClick();
  2984. },
  2985. handleSelect: function handleSelect(filterValue) {
  2986. this.filterValue = filterValue;
  2987. if (typeof filterValue !== 'undefined' && filterValue !== null) {
  2988. this.confirmFilter(this.filteredValue);
  2989. } else {
  2990. this.confirmFilter([]);
  2991. }
  2992. this.handleOutsideClick();
  2993. },
  2994. confirmFilter: function confirmFilter(filteredValue) {
  2995. this.table.store.commit('filterChange', {
  2996. column: this.column,
  2997. values: filteredValue
  2998. });
  2999. this.table.store.updateAllSelected();
  3000. }
  3001. },
  3002. data: function data() {
  3003. return {
  3004. table: null,
  3005. cell: null,
  3006. column: null
  3007. };
  3008. },
  3009. computed: {
  3010. filters: function filters() {
  3011. return this.column && this.column.filters;
  3012. },
  3013. filterValue: {
  3014. get: function get() {
  3015. return (this.column.filteredValue || [])[0];
  3016. },
  3017. set: function set(value) {
  3018. if (this.filteredValue) {
  3019. if (typeof value !== 'undefined' && value !== null) {
  3020. this.filteredValue.splice(0, 1, value);
  3021. } else {
  3022. this.filteredValue.splice(0, 1);
  3023. }
  3024. }
  3025. }
  3026. },
  3027. filteredValue: {
  3028. get: function get() {
  3029. if (this.column) {
  3030. return this.column.filteredValue || [];
  3031. }
  3032. return [];
  3033. },
  3034. set: function set(value) {
  3035. if (this.column) {
  3036. this.column.filteredValue = value;
  3037. }
  3038. }
  3039. },
  3040. multiple: function multiple() {
  3041. if (this.column) {
  3042. return this.column.filterMultiple;
  3043. }
  3044. return true;
  3045. }
  3046. },
  3047. mounted: function mounted() {
  3048. var _this2 = this;
  3049. this.popperElm = this.$el;
  3050. this.referenceElm = this.cell;
  3051. this.table.bodyWrapper.addEventListener('scroll', function () {
  3052. _this2.updatePopper();
  3053. });
  3054. this.$watch('showPopper', function (value) {
  3055. if (_this2.column) _this2.column.filterOpened = value;
  3056. if (value) {
  3057. dropdown.open(_this2);
  3058. } else {
  3059. dropdown.close(_this2);
  3060. }
  3061. });
  3062. },
  3063. watch: {
  3064. showPopper: function showPopper(val) {
  3065. if (val === true && parseInt(this.popperJS._popper.style.zIndex, 10) < popup_["PopupManager"].zIndex) {
  3066. this.popperJS._popper.style.zIndex = popup_["PopupManager"].nextZIndex();
  3067. }
  3068. }
  3069. }
  3070. });
  3071. // CONCATENATED MODULE: ./packages/table/src/filter-panel.vue?vue&type=script&lang=js&
  3072. /* harmony default export */ var src_filter_panelvue_type_script_lang_js_ = (filter_panelvue_type_script_lang_js_);
  3073. // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
  3074. var componentNormalizer = __webpack_require__(0);
  3075. // CONCATENATED MODULE: ./packages/table/src/filter-panel.vue
  3076. /* normalize component */
  3077. var component = Object(componentNormalizer["a" /* default */])(
  3078. src_filter_panelvue_type_script_lang_js_,
  3079. filter_panelvue_type_template_id_7f2c919f_render,
  3080. filter_panelvue_type_template_id_7f2c919f_staticRenderFns,
  3081. false,
  3082. null,
  3083. null,
  3084. null
  3085. )
  3086. /* hot reload */
  3087. if (false) { var api; }
  3088. component.options.__file = "packages/table/src/filter-panel.vue"
  3089. /* harmony default export */ var filter_panel = (component.exports);
  3090. // CONCATENATED MODULE: ./packages/table/src/table-header.js
  3091. var table_header_extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
  3092. var getAllColumns = function getAllColumns(columns) {
  3093. var result = [];
  3094. columns.forEach(function (column) {
  3095. if (column.children) {
  3096. result.push(column);
  3097. result.push.apply(result, getAllColumns(column.children));
  3098. } else {
  3099. result.push(column);
  3100. }
  3101. });
  3102. return result;
  3103. };
  3104. var convertToRows = function convertToRows(originColumns) {
  3105. var maxLevel = 1;
  3106. var traverse = function traverse(column, parent) {
  3107. if (parent) {
  3108. column.level = parent.level + 1;
  3109. if (maxLevel < column.level) {
  3110. maxLevel = column.level;
  3111. }
  3112. }
  3113. if (column.children) {
  3114. var colSpan = 0;
  3115. column.children.forEach(function (subColumn) {
  3116. traverse(subColumn, column);
  3117. colSpan += subColumn.colSpan;
  3118. });
  3119. column.colSpan = colSpan;
  3120. } else {
  3121. column.colSpan = 1;
  3122. }
  3123. };
  3124. originColumns.forEach(function (column) {
  3125. column.level = 1;
  3126. traverse(column);
  3127. });
  3128. var rows = [];
  3129. for (var i = 0; i < maxLevel; i++) {
  3130. rows.push([]);
  3131. }
  3132. var allColumns = getAllColumns(originColumns);
  3133. allColumns.forEach(function (column) {
  3134. if (!column.children) {
  3135. column.rowSpan = maxLevel - column.level + 1;
  3136. } else {
  3137. column.rowSpan = 1;
  3138. }
  3139. rows[column.level - 1].push(column);
  3140. });
  3141. return rows;
  3142. };
  3143. /* harmony default export */ var table_header = ({
  3144. name: 'ElTableHeader',
  3145. mixins: [layout_observer],
  3146. render: function render(h) {
  3147. var _this = this;
  3148. var originColumns = this.store.states.originColumns;
  3149. var columnRows = convertToRows(originColumns, this.columns);
  3150. // 是否拥有多级表头
  3151. var isGroup = columnRows.length > 1;
  3152. if (isGroup) this.$parent.isGroup = true;
  3153. return h(
  3154. 'table',
  3155. {
  3156. 'class': 'el-table__header',
  3157. attrs: { cellspacing: '0',
  3158. cellpadding: '0',
  3159. border: '0' }
  3160. },
  3161. [h('colgroup', [this.columns.map(function (column) {
  3162. return h('col', {
  3163. attrs: { name: column.id },
  3164. key: column.id });
  3165. }), this.hasGutter ? h('col', {
  3166. attrs: { name: 'gutter' }
  3167. }) : '']), h(
  3168. 'thead',
  3169. { 'class': [{ 'is-group': isGroup, 'has-gutter': this.hasGutter }] },
  3170. [this._l(columnRows, function (columns, rowIndex) {
  3171. return h(
  3172. 'tr',
  3173. {
  3174. style: _this.getHeaderRowStyle(rowIndex),
  3175. 'class': _this.getHeaderRowClass(rowIndex)
  3176. },
  3177. [columns.map(function (column, cellIndex) {
  3178. return h(
  3179. 'th',
  3180. {
  3181. attrs: {
  3182. colspan: column.colSpan,
  3183. rowspan: column.rowSpan
  3184. },
  3185. on: {
  3186. 'mousemove': function mousemove($event) {
  3187. return _this.handleMouseMove($event, column);
  3188. },
  3189. 'mouseout': _this.handleMouseOut,
  3190. 'mousedown': function mousedown($event) {
  3191. return _this.handleMouseDown($event, column);
  3192. },
  3193. 'click': function click($event) {
  3194. return _this.handleHeaderClick($event, column);
  3195. },
  3196. 'contextmenu': function contextmenu($event) {
  3197. return _this.handleHeaderContextMenu($event, column);
  3198. }
  3199. },
  3200. style: _this.getHeaderCellStyle(rowIndex, cellIndex, columns, column),
  3201. 'class': _this.getHeaderCellClass(rowIndex, cellIndex, columns, column),
  3202. key: column.id },
  3203. [h(
  3204. 'div',
  3205. { 'class': ['cell', column.filteredValue && column.filteredValue.length > 0 ? 'highlight' : '', column.labelClassName] },
  3206. [column.renderHeader ? column.renderHeader.call(_this._renderProxy, h, { column: column, $index: cellIndex, store: _this.store, _self: _this.$parent.$vnode.context }) : column.label, column.sortable ? h(
  3207. 'span',
  3208. {
  3209. 'class': 'caret-wrapper',
  3210. on: {
  3211. 'click': function click($event) {
  3212. return _this.handleSortClick($event, column);
  3213. }
  3214. }
  3215. },
  3216. [h('i', { 'class': 'sort-caret ascending',
  3217. on: {
  3218. 'click': function click($event) {
  3219. return _this.handleSortClick($event, column, 'ascending');
  3220. }
  3221. }
  3222. }), h('i', { 'class': 'sort-caret descending',
  3223. on: {
  3224. 'click': function click($event) {
  3225. return _this.handleSortClick($event, column, 'descending');
  3226. }
  3227. }
  3228. })]
  3229. ) : '', column.filterable ? h(
  3230. 'span',
  3231. {
  3232. 'class': 'el-table__column-filter-trigger',
  3233. on: {
  3234. 'click': function click($event) {
  3235. return _this.handleFilterClick($event, column);
  3236. }
  3237. }
  3238. },
  3239. [h('i', { 'class': ['el-icon-arrow-down', column.filterOpened ? 'el-icon-arrow-up' : ''] })]
  3240. ) : '']
  3241. )]
  3242. );
  3243. }), _this.hasGutter ? h('th', { 'class': 'gutter' }) : '']
  3244. );
  3245. })]
  3246. )]
  3247. );
  3248. },
  3249. props: {
  3250. fixed: String,
  3251. store: {
  3252. required: true
  3253. },
  3254. border: Boolean,
  3255. defaultSort: {
  3256. type: Object,
  3257. default: function _default() {
  3258. return {
  3259. prop: '',
  3260. order: ''
  3261. };
  3262. }
  3263. }
  3264. },
  3265. components: {
  3266. ElCheckbox: checkbox_default.a
  3267. },
  3268. computed: table_header_extends({
  3269. table: function table() {
  3270. return this.$parent;
  3271. },
  3272. hasGutter: function hasGutter() {
  3273. return !this.fixed && this.tableLayout.gutterWidth;
  3274. }
  3275. }, mapStates({
  3276. columns: 'columns',
  3277. isAllSelected: 'isAllSelected',
  3278. leftFixedLeafCount: 'fixedLeafColumnsLength',
  3279. rightFixedLeafCount: 'rightFixedLeafColumnsLength',
  3280. columnsCount: function columnsCount(states) {
  3281. return states.columns.length;
  3282. },
  3283. leftFixedCount: function leftFixedCount(states) {
  3284. return states.fixedColumns.length;
  3285. },
  3286. rightFixedCount: function rightFixedCount(states) {
  3287. return states.rightFixedColumns.length;
  3288. }
  3289. })),
  3290. created: function created() {
  3291. this.filterPanels = {};
  3292. },
  3293. mounted: function mounted() {
  3294. var _this2 = this;
  3295. // nextTick 是有必要的 https://github.com/ElemeFE/element/pull/11311
  3296. this.$nextTick(function () {
  3297. var _defaultSort = _this2.defaultSort,
  3298. prop = _defaultSort.prop,
  3299. order = _defaultSort.order;
  3300. var init = true;
  3301. _this2.store.commit('sort', { prop: prop, order: order, init: init });
  3302. });
  3303. },
  3304. beforeDestroy: function beforeDestroy() {
  3305. var panels = this.filterPanels;
  3306. for (var prop in panels) {
  3307. if (panels.hasOwnProperty(prop) && panels[prop]) {
  3308. panels[prop].$destroy(true);
  3309. }
  3310. }
  3311. },
  3312. methods: {
  3313. isCellHidden: function isCellHidden(index, columns) {
  3314. var start = 0;
  3315. for (var i = 0; i < index; i++) {
  3316. start += columns[i].colSpan;
  3317. }
  3318. var after = start + columns[index].colSpan - 1;
  3319. if (this.fixed === true || this.fixed === 'left') {
  3320. return after >= this.leftFixedLeafCount;
  3321. } else if (this.fixed === 'right') {
  3322. return start < this.columnsCount - this.rightFixedLeafCount;
  3323. } else {
  3324. return after < this.leftFixedLeafCount || start >= this.columnsCount - this.rightFixedLeafCount;
  3325. }
  3326. },
  3327. getHeaderRowStyle: function getHeaderRowStyle(rowIndex) {
  3328. var headerRowStyle = this.table.headerRowStyle;
  3329. if (typeof headerRowStyle === 'function') {
  3330. return headerRowStyle.call(null, { rowIndex: rowIndex });
  3331. }
  3332. return headerRowStyle;
  3333. },
  3334. getHeaderRowClass: function getHeaderRowClass(rowIndex) {
  3335. var classes = [];
  3336. var headerRowClassName = this.table.headerRowClassName;
  3337. if (typeof headerRowClassName === 'string') {
  3338. classes.push(headerRowClassName);
  3339. } else if (typeof headerRowClassName === 'function') {
  3340. classes.push(headerRowClassName.call(null, { rowIndex: rowIndex }));
  3341. }
  3342. return classes.join(' ');
  3343. },
  3344. getHeaderCellStyle: function getHeaderCellStyle(rowIndex, columnIndex, row, column) {
  3345. var headerCellStyle = this.table.headerCellStyle;
  3346. if (typeof headerCellStyle === 'function') {
  3347. return headerCellStyle.call(null, {
  3348. rowIndex: rowIndex,
  3349. columnIndex: columnIndex,
  3350. row: row,
  3351. column: column
  3352. });
  3353. }
  3354. return headerCellStyle;
  3355. },
  3356. getHeaderCellClass: function getHeaderCellClass(rowIndex, columnIndex, row, column) {
  3357. var classes = [column.id, column.order, column.headerAlign, column.className, column.labelClassName];
  3358. if (rowIndex === 0 && this.isCellHidden(columnIndex, row)) {
  3359. classes.push('is-hidden');
  3360. }
  3361. if (!column.children) {
  3362. classes.push('is-leaf');
  3363. }
  3364. if (column.sortable) {
  3365. classes.push('is-sortable');
  3366. }
  3367. var headerCellClassName = this.table.headerCellClassName;
  3368. if (typeof headerCellClassName === 'string') {
  3369. classes.push(headerCellClassName);
  3370. } else if (typeof headerCellClassName === 'function') {
  3371. classes.push(headerCellClassName.call(null, {
  3372. rowIndex: rowIndex,
  3373. columnIndex: columnIndex,
  3374. row: row,
  3375. column: column
  3376. }));
  3377. }
  3378. return classes.join(' ');
  3379. },
  3380. toggleAllSelection: function toggleAllSelection(event) {
  3381. event.stopPropagation();
  3382. this.store.commit('toggleAllSelection');
  3383. },
  3384. handleFilterClick: function handleFilterClick(event, column) {
  3385. event.stopPropagation();
  3386. var target = event.target;
  3387. var cell = target.tagName === 'TH' ? target : target.parentNode;
  3388. if (Object(dom_["hasClass"])(cell, 'noclick')) return;
  3389. cell = cell.querySelector('.el-table__column-filter-trigger') || cell;
  3390. var table = this.$parent;
  3391. var filterPanel = this.filterPanels[column.id];
  3392. if (filterPanel && column.filterOpened) {
  3393. filterPanel.showPopper = false;
  3394. return;
  3395. }
  3396. if (!filterPanel) {
  3397. filterPanel = new external_vue_default.a(filter_panel);
  3398. this.filterPanels[column.id] = filterPanel;
  3399. if (column.filterPlacement) {
  3400. filterPanel.placement = column.filterPlacement;
  3401. }
  3402. filterPanel.table = table;
  3403. filterPanel.cell = cell;
  3404. filterPanel.column = column;
  3405. !this.$isServer && filterPanel.$mount(document.createElement('div'));
  3406. }
  3407. setTimeout(function () {
  3408. filterPanel.showPopper = true;
  3409. }, 16);
  3410. },
  3411. handleHeaderClick: function handleHeaderClick(event, column) {
  3412. if (!column.filters && column.sortable) {
  3413. this.handleSortClick(event, column);
  3414. } else if (column.filterable && !column.sortable) {
  3415. this.handleFilterClick(event, column);
  3416. }
  3417. this.$parent.$emit('header-click', column, event);
  3418. },
  3419. handleHeaderContextMenu: function handleHeaderContextMenu(event, column) {
  3420. this.$parent.$emit('header-contextmenu', column, event);
  3421. },
  3422. handleMouseDown: function handleMouseDown(event, column) {
  3423. var _this3 = this;
  3424. if (this.$isServer) return;
  3425. if (column.children && column.children.length > 0) return;
  3426. /* istanbul ignore if */
  3427. if (this.draggingColumn && this.border) {
  3428. this.dragging = true;
  3429. this.$parent.resizeProxyVisible = true;
  3430. var table = this.$parent;
  3431. var tableEl = table.$el;
  3432. var tableLeft = tableEl.getBoundingClientRect().left;
  3433. var columnEl = this.$el.querySelector('th.' + column.id);
  3434. var columnRect = columnEl.getBoundingClientRect();
  3435. var minLeft = columnRect.left - tableLeft + 30;
  3436. Object(dom_["addClass"])(columnEl, 'noclick');
  3437. this.dragState = {
  3438. startMouseLeft: event.clientX,
  3439. startLeft: columnRect.right - tableLeft,
  3440. startColumnLeft: columnRect.left - tableLeft,
  3441. tableLeft: tableLeft
  3442. };
  3443. var resizeProxy = table.$refs.resizeProxy;
  3444. resizeProxy.style.left = this.dragState.startLeft + 'px';
  3445. document.onselectstart = function () {
  3446. return false;
  3447. };
  3448. document.ondragstart = function () {
  3449. return false;
  3450. };
  3451. var handleMouseMove = function handleMouseMove(event) {
  3452. var deltaLeft = event.clientX - _this3.dragState.startMouseLeft;
  3453. var proxyLeft = _this3.dragState.startLeft + deltaLeft;
  3454. resizeProxy.style.left = Math.max(minLeft, proxyLeft) + 'px';
  3455. };
  3456. var handleMouseUp = function handleMouseUp() {
  3457. if (_this3.dragging) {
  3458. var _dragState = _this3.dragState,
  3459. startColumnLeft = _dragState.startColumnLeft,
  3460. startLeft = _dragState.startLeft;
  3461. var finalLeft = parseInt(resizeProxy.style.left, 10);
  3462. var columnWidth = finalLeft - startColumnLeft;
  3463. column.width = column.realWidth = columnWidth;
  3464. table.$emit('header-dragend', column.width, startLeft - startColumnLeft, column, event);
  3465. _this3.store.scheduleLayout();
  3466. document.body.style.cursor = '';
  3467. _this3.dragging = false;
  3468. _this3.draggingColumn = null;
  3469. _this3.dragState = {};
  3470. table.resizeProxyVisible = false;
  3471. }
  3472. document.removeEventListener('mousemove', handleMouseMove);
  3473. document.removeEventListener('mouseup', handleMouseUp);
  3474. document.onselectstart = null;
  3475. document.ondragstart = null;
  3476. setTimeout(function () {
  3477. Object(dom_["removeClass"])(columnEl, 'noclick');
  3478. }, 0);
  3479. };
  3480. document.addEventListener('mousemove', handleMouseMove);
  3481. document.addEventListener('mouseup', handleMouseUp);
  3482. }
  3483. },
  3484. handleMouseMove: function handleMouseMove(event, column) {
  3485. if (column.children && column.children.length > 0) return;
  3486. var target = event.target;
  3487. while (target && target.tagName !== 'TH') {
  3488. target = target.parentNode;
  3489. }
  3490. if (!column || !column.resizable) return;
  3491. if (!this.dragging && this.border) {
  3492. var rect = target.getBoundingClientRect();
  3493. var bodyStyle = document.body.style;
  3494. if (rect.width > 12 && rect.right - event.pageX < 8) {
  3495. bodyStyle.cursor = 'col-resize';
  3496. if (Object(dom_["hasClass"])(target, 'is-sortable')) {
  3497. target.style.cursor = 'col-resize';
  3498. }
  3499. this.draggingColumn = column;
  3500. } else if (!this.dragging) {
  3501. bodyStyle.cursor = '';
  3502. if (Object(dom_["hasClass"])(target, 'is-sortable')) {
  3503. target.style.cursor = 'pointer';
  3504. }
  3505. this.draggingColumn = null;
  3506. }
  3507. }
  3508. },
  3509. handleMouseOut: function handleMouseOut() {
  3510. if (this.$isServer) return;
  3511. document.body.style.cursor = '';
  3512. },
  3513. toggleOrder: function toggleOrder(_ref) {
  3514. var order = _ref.order,
  3515. sortOrders = _ref.sortOrders;
  3516. if (order === '') return sortOrders[0];
  3517. var index = sortOrders.indexOf(order || null);
  3518. return sortOrders[index > sortOrders.length - 2 ? 0 : index + 1];
  3519. },
  3520. handleSortClick: function handleSortClick(event, column, givenOrder) {
  3521. event.stopPropagation();
  3522. var order = column.order === givenOrder ? null : givenOrder || this.toggleOrder(column);
  3523. var target = event.target;
  3524. while (target && target.tagName !== 'TH') {
  3525. target = target.parentNode;
  3526. }
  3527. if (target && target.tagName === 'TH') {
  3528. if (Object(dom_["hasClass"])(target, 'noclick')) {
  3529. Object(dom_["removeClass"])(target, 'noclick');
  3530. return;
  3531. }
  3532. }
  3533. if (!column.sortable) return;
  3534. var states = this.store.states;
  3535. var sortProp = states.sortProp;
  3536. var sortOrder = void 0;
  3537. var sortingColumn = states.sortingColumn;
  3538. if (sortingColumn !== column || sortingColumn === column && sortingColumn.order === null) {
  3539. if (sortingColumn) {
  3540. sortingColumn.order = null;
  3541. }
  3542. states.sortingColumn = column;
  3543. sortProp = column.property;
  3544. }
  3545. if (!order) {
  3546. sortOrder = column.order = null;
  3547. } else {
  3548. sortOrder = column.order = order;
  3549. }
  3550. states.sortProp = sortProp;
  3551. states.sortOrder = sortOrder;
  3552. this.store.commit('changeSortCondition');
  3553. }
  3554. },
  3555. data: function data() {
  3556. return {
  3557. draggingColumn: null,
  3558. dragging: false,
  3559. dragState: {}
  3560. };
  3561. }
  3562. });
  3563. // CONCATENATED MODULE: ./packages/table/src/table-footer.js
  3564. var table_footer_extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
  3565. /* harmony default export */ var table_footer = ({
  3566. name: 'ElTableFooter',
  3567. mixins: [layout_observer],
  3568. render: function render(h) {
  3569. var _this = this;
  3570. var sums = [];
  3571. if (this.summaryMethod) {
  3572. sums = this.summaryMethod({ columns: this.columns, data: this.store.states.data });
  3573. } else {
  3574. this.columns.forEach(function (column, index) {
  3575. if (index === 0) {
  3576. sums[index] = _this.sumText;
  3577. return;
  3578. }
  3579. var values = _this.store.states.data.map(function (item) {
  3580. return Number(item[column.property]);
  3581. });
  3582. var precisions = [];
  3583. var notNumber = true;
  3584. values.forEach(function (value) {
  3585. if (!isNaN(value)) {
  3586. notNumber = false;
  3587. var decimal = ('' + value).split('.')[1];
  3588. precisions.push(decimal ? decimal.length : 0);
  3589. }
  3590. });
  3591. var precision = Math.max.apply(null, precisions);
  3592. if (!notNumber) {
  3593. sums[index] = values.reduce(function (prev, curr) {
  3594. var value = Number(curr);
  3595. if (!isNaN(value)) {
  3596. return parseFloat((prev + curr).toFixed(Math.min(precision, 20)));
  3597. } else {
  3598. return prev;
  3599. }
  3600. }, 0);
  3601. } else {
  3602. sums[index] = '';
  3603. }
  3604. });
  3605. }
  3606. return h(
  3607. 'table',
  3608. {
  3609. 'class': 'el-table__footer',
  3610. attrs: { cellspacing: '0',
  3611. cellpadding: '0',
  3612. border: '0' }
  3613. },
  3614. [h('colgroup', [this.columns.map(function (column) {
  3615. return h('col', {
  3616. attrs: { name: column.id },
  3617. key: column.id });
  3618. }), this.hasGutter ? h('col', {
  3619. attrs: { name: 'gutter' }
  3620. }) : '']), h(
  3621. 'tbody',
  3622. { 'class': [{ 'has-gutter': this.hasGutter }] },
  3623. [h('tr', [this.columns.map(function (column, cellIndex) {
  3624. return h(
  3625. 'td',
  3626. {
  3627. key: cellIndex,
  3628. attrs: { colspan: column.colSpan,
  3629. rowspan: column.rowSpan
  3630. },
  3631. 'class': _this.getRowClasses(column, cellIndex) },
  3632. [h(
  3633. 'div',
  3634. { 'class': ['cell', column.labelClassName] },
  3635. [sums[cellIndex]]
  3636. )]
  3637. );
  3638. }), this.hasGutter ? h('th', { 'class': 'gutter' }) : ''])]
  3639. )]
  3640. );
  3641. },
  3642. props: {
  3643. fixed: String,
  3644. store: {
  3645. required: true
  3646. },
  3647. summaryMethod: Function,
  3648. sumText: String,
  3649. border: Boolean,
  3650. defaultSort: {
  3651. type: Object,
  3652. default: function _default() {
  3653. return {
  3654. prop: '',
  3655. order: ''
  3656. };
  3657. }
  3658. }
  3659. },
  3660. computed: table_footer_extends({
  3661. table: function table() {
  3662. return this.$parent;
  3663. },
  3664. hasGutter: function hasGutter() {
  3665. return !this.fixed && this.tableLayout.gutterWidth;
  3666. }
  3667. }, mapStates({
  3668. columns: 'columns',
  3669. isAllSelected: 'isAllSelected',
  3670. leftFixedLeafCount: 'fixedLeafColumnsLength',
  3671. rightFixedLeafCount: 'rightFixedLeafColumnsLength',
  3672. columnsCount: function columnsCount(states) {
  3673. return states.columns.length;
  3674. },
  3675. leftFixedCount: function leftFixedCount(states) {
  3676. return states.fixedColumns.length;
  3677. },
  3678. rightFixedCount: function rightFixedCount(states) {
  3679. return states.rightFixedColumns.length;
  3680. }
  3681. })),
  3682. methods: {
  3683. isCellHidden: function isCellHidden(index, columns, column) {
  3684. if (this.fixed === true || this.fixed === 'left') {
  3685. return index >= this.leftFixedLeafCount;
  3686. } else if (this.fixed === 'right') {
  3687. var before = 0;
  3688. for (var i = 0; i < index; i++) {
  3689. before += columns[i].colSpan;
  3690. }
  3691. return before < this.columnsCount - this.rightFixedLeafCount;
  3692. } else if (!this.fixed && column.fixed) {
  3693. // hide cell when footer instance is not fixed and column is fixed
  3694. return true;
  3695. } else {
  3696. return index < this.leftFixedCount || index >= this.columnsCount - this.rightFixedCount;
  3697. }
  3698. },
  3699. getRowClasses: function getRowClasses(column, cellIndex) {
  3700. var classes = [column.id, column.align, column.labelClassName];
  3701. if (column.className) {
  3702. classes.push(column.className);
  3703. }
  3704. if (this.isCellHidden(cellIndex, this.columns, column)) {
  3705. classes.push('is-hidden');
  3706. }
  3707. if (!column.children) {
  3708. classes.push('is-leaf');
  3709. }
  3710. return classes;
  3711. }
  3712. }
  3713. });
  3714. // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/table/src/table.vue?vue&type=script&lang=js&
  3715. var tablevue_type_script_lang_js_extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
  3716. //
  3717. //
  3718. //
  3719. //
  3720. //
  3721. //
  3722. //
  3723. //
  3724. //
  3725. //
  3726. //
  3727. //
  3728. //
  3729. //
  3730. //
  3731. //
  3732. //
  3733. //
  3734. //
  3735. //
  3736. //
  3737. //
  3738. //
  3739. //
  3740. //
  3741. //
  3742. //
  3743. //
  3744. //
  3745. //
  3746. //
  3747. //
  3748. //
  3749. //
  3750. //
  3751. //
  3752. //
  3753. //
  3754. //
  3755. //
  3756. //
  3757. //
  3758. //
  3759. //
  3760. //
  3761. //
  3762. //
  3763. //
  3764. //
  3765. //
  3766. //
  3767. //
  3768. //
  3769. //
  3770. //
  3771. //
  3772. //
  3773. //
  3774. //
  3775. //
  3776. //
  3777. //
  3778. //
  3779. //
  3780. //
  3781. //
  3782. //
  3783. //
  3784. //
  3785. //
  3786. //
  3787. //
  3788. //
  3789. //
  3790. //
  3791. //
  3792. //
  3793. //
  3794. //
  3795. //
  3796. //
  3797. //
  3798. //
  3799. //
  3800. //
  3801. //
  3802. //
  3803. //
  3804. //
  3805. //
  3806. //
  3807. //
  3808. //
  3809. //
  3810. //
  3811. //
  3812. //
  3813. //
  3814. //
  3815. //
  3816. //
  3817. //
  3818. //
  3819. //
  3820. //
  3821. //
  3822. //
  3823. //
  3824. //
  3825. //
  3826. //
  3827. //
  3828. //
  3829. //
  3830. //
  3831. //
  3832. //
  3833. //
  3834. //
  3835. //
  3836. //
  3837. //
  3838. //
  3839. //
  3840. //
  3841. //
  3842. //
  3843. //
  3844. //
  3845. //
  3846. //
  3847. //
  3848. //
  3849. //
  3850. //
  3851. //
  3852. //
  3853. //
  3854. //
  3855. //
  3856. //
  3857. //
  3858. //
  3859. //
  3860. //
  3861. //
  3862. //
  3863. //
  3864. //
  3865. //
  3866. //
  3867. //
  3868. //
  3869. //
  3870. //
  3871. //
  3872. //
  3873. //
  3874. //
  3875. //
  3876. //
  3877. //
  3878. //
  3879. //
  3880. //
  3881. //
  3882. //
  3883. //
  3884. //
  3885. //
  3886. //
  3887. //
  3888. //
  3889. //
  3890. //
  3891. //
  3892. //
  3893. //
  3894. //
  3895. //
  3896. //
  3897. //
  3898. //
  3899. //
  3900. //
  3901. //
  3902. //
  3903. //
  3904. //
  3905. //
  3906. //
  3907. //
  3908. //
  3909. //
  3910. //
  3911. //
  3912. //
  3913. //
  3914. //
  3915. //
  3916. //
  3917. //
  3918. //
  3919. //
  3920. //
  3921. //
  3922. //
  3923. //
  3924. //
  3925. //
  3926. //
  3927. //
  3928. //
  3929. //
  3930. var tableIdSeed = 1;
  3931. /* harmony default export */ var tablevue_type_script_lang_js_ = ({
  3932. name: 'ElTable',
  3933. mixins: [locale_default.a, migrating_default.a],
  3934. directives: {
  3935. Mousewheel: directives_mousewheel
  3936. },
  3937. props: {
  3938. data: {
  3939. type: Array,
  3940. default: function _default() {
  3941. return [];
  3942. }
  3943. },
  3944. size: String,
  3945. width: [String, Number],
  3946. height: [String, Number],
  3947. maxHeight: [String, Number],
  3948. fit: {
  3949. type: Boolean,
  3950. default: true
  3951. },
  3952. stripe: Boolean,
  3953. border: Boolean,
  3954. rowKey: [String, Function],
  3955. context: {},
  3956. showHeader: {
  3957. type: Boolean,
  3958. default: true
  3959. },
  3960. showSummary: Boolean,
  3961. sumText: String,
  3962. summaryMethod: Function,
  3963. rowClassName: [String, Function],
  3964. rowStyle: [Object, Function],
  3965. cellClassName: [String, Function],
  3966. cellStyle: [Object, Function],
  3967. headerRowClassName: [String, Function],
  3968. headerRowStyle: [Object, Function],
  3969. headerCellClassName: [String, Function],
  3970. headerCellStyle: [Object, Function],
  3971. highlightCurrentRow: Boolean,
  3972. currentRowKey: [String, Number],
  3973. emptyText: String,
  3974. expandRowKeys: Array,
  3975. defaultExpandAll: Boolean,
  3976. defaultSort: Object,
  3977. tooltipEffect: String,
  3978. spanMethod: Function,
  3979. selectOnIndeterminate: {
  3980. type: Boolean,
  3981. default: true
  3982. },
  3983. indent: {
  3984. type: Number,
  3985. default: 16
  3986. },
  3987. treeProps: {
  3988. type: Object,
  3989. default: function _default() {
  3990. return {
  3991. hasChildren: 'hasChildren',
  3992. children: 'children'
  3993. };
  3994. }
  3995. },
  3996. lazy: Boolean,
  3997. load: Function
  3998. },
  3999. components: {
  4000. TableHeader: table_header,
  4001. TableFooter: table_footer,
  4002. TableBody: table_body,
  4003. ElCheckbox: checkbox_default.a
  4004. },
  4005. methods: {
  4006. getMigratingConfig: function getMigratingConfig() {
  4007. return {
  4008. events: {
  4009. expand: 'expand is renamed to expand-change'
  4010. }
  4011. };
  4012. },
  4013. setCurrentRow: function setCurrentRow(row) {
  4014. this.store.commit('setCurrentRow', row);
  4015. },
  4016. toggleRowSelection: function toggleRowSelection(row, selected) {
  4017. this.store.toggleRowSelection(row, selected, false);
  4018. this.store.updateAllSelected();
  4019. },
  4020. toggleRowExpansion: function toggleRowExpansion(row, expanded) {
  4021. this.store.toggleRowExpansionAdapter(row, expanded);
  4022. },
  4023. clearSelection: function clearSelection() {
  4024. this.store.clearSelection();
  4025. },
  4026. clearFilter: function clearFilter(columnKeys) {
  4027. this.store.clearFilter(columnKeys);
  4028. },
  4029. clearSort: function clearSort() {
  4030. this.store.clearSort();
  4031. },
  4032. handleMouseLeave: function handleMouseLeave() {
  4033. this.store.commit('setHoverRow', null);
  4034. if (this.hoverState) this.hoverState = null;
  4035. },
  4036. updateScrollY: function updateScrollY() {
  4037. var changed = this.layout.updateScrollY();
  4038. if (changed) {
  4039. this.layout.notifyObservers('scrollable');
  4040. this.layout.updateColumnsWidth();
  4041. }
  4042. },
  4043. handleFixedMousewheel: function handleFixedMousewheel(event, data) {
  4044. var bodyWrapper = this.bodyWrapper;
  4045. if (Math.abs(data.spinY) > 0) {
  4046. var currentScrollTop = bodyWrapper.scrollTop;
  4047. if (data.pixelY < 0 && currentScrollTop !== 0) {
  4048. event.preventDefault();
  4049. }
  4050. if (data.pixelY > 0 && bodyWrapper.scrollHeight - bodyWrapper.clientHeight > currentScrollTop) {
  4051. event.preventDefault();
  4052. }
  4053. bodyWrapper.scrollTop += Math.ceil(data.pixelY / 5);
  4054. } else {
  4055. bodyWrapper.scrollLeft += Math.ceil(data.pixelX / 5);
  4056. }
  4057. },
  4058. handleHeaderFooterMousewheel: function handleHeaderFooterMousewheel(event, data) {
  4059. var pixelX = data.pixelX,
  4060. pixelY = data.pixelY;
  4061. if (Math.abs(pixelX) >= Math.abs(pixelY)) {
  4062. this.bodyWrapper.scrollLeft += data.pixelX / 5;
  4063. }
  4064. },
  4065. // TODO 使用 CSS transform
  4066. syncPostion: Object(external_throttle_debounce_["throttle"])(20, function () {
  4067. var _bodyWrapper = this.bodyWrapper,
  4068. scrollLeft = _bodyWrapper.scrollLeft,
  4069. scrollTop = _bodyWrapper.scrollTop,
  4070. offsetWidth = _bodyWrapper.offsetWidth,
  4071. scrollWidth = _bodyWrapper.scrollWidth;
  4072. var _$refs = this.$refs,
  4073. headerWrapper = _$refs.headerWrapper,
  4074. footerWrapper = _$refs.footerWrapper,
  4075. fixedBodyWrapper = _$refs.fixedBodyWrapper,
  4076. rightFixedBodyWrapper = _$refs.rightFixedBodyWrapper;
  4077. if (headerWrapper) headerWrapper.scrollLeft = scrollLeft;
  4078. if (footerWrapper) footerWrapper.scrollLeft = scrollLeft;
  4079. if (fixedBodyWrapper) fixedBodyWrapper.scrollTop = scrollTop;
  4080. if (rightFixedBodyWrapper) rightFixedBodyWrapper.scrollTop = scrollTop;
  4081. var maxScrollLeftPosition = scrollWidth - offsetWidth - 1;
  4082. if (scrollLeft >= maxScrollLeftPosition) {
  4083. this.scrollPosition = 'right';
  4084. } else if (scrollLeft === 0) {
  4085. this.scrollPosition = 'left';
  4086. } else {
  4087. this.scrollPosition = 'middle';
  4088. }
  4089. }),
  4090. bindEvents: function bindEvents() {
  4091. this.bodyWrapper.addEventListener('scroll', this.syncPostion, { passive: true });
  4092. if (this.fit) {
  4093. Object(resize_event_["addResizeListener"])(this.$el, this.resizeListener);
  4094. }
  4095. },
  4096. unbindEvents: function unbindEvents() {
  4097. this.bodyWrapper.removeEventListener('scroll', this.syncPostion, { passive: true });
  4098. if (this.fit) {
  4099. Object(resize_event_["removeResizeListener"])(this.$el, this.resizeListener);
  4100. }
  4101. },
  4102. resizeListener: function resizeListener() {
  4103. if (!this.$ready) return;
  4104. var shouldUpdateLayout = false;
  4105. var el = this.$el;
  4106. var _resizeState = this.resizeState,
  4107. oldWidth = _resizeState.width,
  4108. oldHeight = _resizeState.height;
  4109. var width = el.offsetWidth;
  4110. if (oldWidth !== width) {
  4111. shouldUpdateLayout = true;
  4112. }
  4113. var height = el.offsetHeight;
  4114. if ((this.height || this.shouldUpdateHeight) && oldHeight !== height) {
  4115. shouldUpdateLayout = true;
  4116. }
  4117. if (shouldUpdateLayout) {
  4118. this.resizeState.width = width;
  4119. this.resizeState.height = height;
  4120. this.doLayout();
  4121. }
  4122. },
  4123. doLayout: function doLayout() {
  4124. if (this.shouldUpdateHeight) {
  4125. this.layout.updateElsHeight();
  4126. }
  4127. this.layout.updateColumnsWidth();
  4128. },
  4129. sort: function sort(prop, order) {
  4130. this.store.commit('sort', { prop: prop, order: order });
  4131. },
  4132. toggleAllSelection: function toggleAllSelection() {
  4133. this.store.commit('toggleAllSelection');
  4134. }
  4135. },
  4136. computed: tablevue_type_script_lang_js_extends({
  4137. tableSize: function tableSize() {
  4138. return this.size || (this.$ELEMENT || {}).size;
  4139. },
  4140. bodyWrapper: function bodyWrapper() {
  4141. return this.$refs.bodyWrapper;
  4142. },
  4143. shouldUpdateHeight: function shouldUpdateHeight() {
  4144. return this.height || this.maxHeight || this.fixedColumns.length > 0 || this.rightFixedColumns.length > 0;
  4145. },
  4146. bodyWidth: function bodyWidth() {
  4147. var _layout = this.layout,
  4148. bodyWidth = _layout.bodyWidth,
  4149. scrollY = _layout.scrollY,
  4150. gutterWidth = _layout.gutterWidth;
  4151. return bodyWidth ? bodyWidth - (scrollY ? gutterWidth : 0) + 'px' : '';
  4152. },
  4153. bodyHeight: function bodyHeight() {
  4154. var _layout2 = this.layout,
  4155. _layout2$headerHeight = _layout2.headerHeight,
  4156. headerHeight = _layout2$headerHeight === undefined ? 0 : _layout2$headerHeight,
  4157. bodyHeight = _layout2.bodyHeight,
  4158. _layout2$footerHeight = _layout2.footerHeight,
  4159. footerHeight = _layout2$footerHeight === undefined ? 0 : _layout2$footerHeight;
  4160. if (this.height) {
  4161. return {
  4162. height: bodyHeight ? bodyHeight + 'px' : ''
  4163. };
  4164. } else if (this.maxHeight) {
  4165. var maxHeight = Object(util["j" /* parseHeight */])(this.maxHeight);
  4166. if (typeof maxHeight === 'number') {
  4167. return {
  4168. 'max-height': maxHeight - footerHeight - (this.showHeader ? headerHeight : 0) + 'px'
  4169. };
  4170. }
  4171. }
  4172. return {};
  4173. },
  4174. fixedBodyHeight: function fixedBodyHeight() {
  4175. if (this.height) {
  4176. return {
  4177. height: this.layout.fixedBodyHeight ? this.layout.fixedBodyHeight + 'px' : ''
  4178. };
  4179. } else if (this.maxHeight) {
  4180. var maxHeight = Object(util["j" /* parseHeight */])(this.maxHeight);
  4181. if (typeof maxHeight === 'number') {
  4182. maxHeight = this.layout.scrollX ? maxHeight - this.layout.gutterWidth : maxHeight;
  4183. if (this.showHeader) {
  4184. maxHeight -= this.layout.headerHeight;
  4185. }
  4186. maxHeight -= this.layout.footerHeight;
  4187. return {
  4188. 'max-height': maxHeight + 'px'
  4189. };
  4190. }
  4191. }
  4192. return {};
  4193. },
  4194. fixedHeight: function fixedHeight() {
  4195. if (this.maxHeight) {
  4196. if (this.showSummary) {
  4197. return {
  4198. bottom: 0
  4199. };
  4200. }
  4201. return {
  4202. bottom: this.layout.scrollX && this.data.length ? this.layout.gutterWidth + 'px' : ''
  4203. };
  4204. } else {
  4205. if (this.showSummary) {
  4206. return {
  4207. height: this.layout.tableHeight ? this.layout.tableHeight + 'px' : ''
  4208. };
  4209. }
  4210. return {
  4211. height: this.layout.viewportHeight ? this.layout.viewportHeight + 'px' : ''
  4212. };
  4213. }
  4214. },
  4215. emptyBlockStyle: function emptyBlockStyle() {
  4216. if (this.data && this.data.length) return null;
  4217. var height = '100%';
  4218. if (this.layout.appendHeight) {
  4219. height = 'calc(100% - ' + this.layout.appendHeight + 'px)';
  4220. }
  4221. return {
  4222. width: this.bodyWidth,
  4223. height: height
  4224. };
  4225. }
  4226. }, mapStates({
  4227. selection: 'selection',
  4228. columns: 'columns',
  4229. tableData: 'data',
  4230. fixedColumns: 'fixedColumns',
  4231. rightFixedColumns: 'rightFixedColumns'
  4232. })),
  4233. watch: {
  4234. height: {
  4235. immediate: true,
  4236. handler: function handler(value) {
  4237. this.layout.setHeight(value);
  4238. }
  4239. },
  4240. maxHeight: {
  4241. immediate: true,
  4242. handler: function handler(value) {
  4243. this.layout.setMaxHeight(value);
  4244. }
  4245. },
  4246. currentRowKey: {
  4247. immediate: true,
  4248. handler: function handler(value) {
  4249. if (!this.rowKey) return;
  4250. this.store.setCurrentRowKey(value);
  4251. }
  4252. },
  4253. data: {
  4254. immediate: true,
  4255. handler: function handler(value) {
  4256. this.store.commit('setData', value);
  4257. }
  4258. },
  4259. expandRowKeys: {
  4260. immediate: true,
  4261. handler: function handler(newVal) {
  4262. if (newVal) {
  4263. this.store.setExpandRowKeysAdapter(newVal);
  4264. }
  4265. }
  4266. }
  4267. },
  4268. created: function created() {
  4269. var _this = this;
  4270. this.tableId = 'el-table_' + tableIdSeed++;
  4271. this.debouncedUpdateLayout = Object(external_throttle_debounce_["debounce"])(50, function () {
  4272. return _this.doLayout();
  4273. });
  4274. },
  4275. mounted: function mounted() {
  4276. var _this2 = this;
  4277. this.bindEvents();
  4278. this.store.updateColumns();
  4279. this.doLayout();
  4280. this.resizeState = {
  4281. width: this.$el.offsetWidth,
  4282. height: this.$el.offsetHeight
  4283. };
  4284. // init filters
  4285. this.store.states.columns.forEach(function (column) {
  4286. if (column.filteredValue && column.filteredValue.length) {
  4287. _this2.store.commit('filterChange', {
  4288. column: column,
  4289. values: column.filteredValue,
  4290. silent: true
  4291. });
  4292. }
  4293. });
  4294. this.$ready = true;
  4295. },
  4296. destroyed: function destroyed() {
  4297. this.unbindEvents();
  4298. },
  4299. data: function data() {
  4300. var _treeProps = this.treeProps,
  4301. _treeProps$hasChildre = _treeProps.hasChildren,
  4302. hasChildren = _treeProps$hasChildre === undefined ? 'hasChildren' : _treeProps$hasChildre,
  4303. _treeProps$children = _treeProps.children,
  4304. children = _treeProps$children === undefined ? 'children' : _treeProps$children;
  4305. this.store = createStore(this, {
  4306. rowKey: this.rowKey,
  4307. defaultExpandAll: this.defaultExpandAll,
  4308. selectOnIndeterminate: this.selectOnIndeterminate,
  4309. // TreeTable 的相关配置
  4310. indent: this.indent,
  4311. lazy: this.lazy,
  4312. lazyColumnIdentifier: hasChildren,
  4313. childrenColumnName: children
  4314. });
  4315. var layout = new table_layout({
  4316. store: this.store,
  4317. table: this,
  4318. fit: this.fit,
  4319. showHeader: this.showHeader
  4320. });
  4321. return {
  4322. layout: layout,
  4323. isHidden: false,
  4324. renderExpanded: null,
  4325. resizeProxyVisible: false,
  4326. resizeState: {
  4327. width: null,
  4328. height: null
  4329. },
  4330. // 是否拥有多级表头
  4331. isGroup: false,
  4332. scrollPosition: 'left'
  4333. };
  4334. }
  4335. });
  4336. // CONCATENATED MODULE: ./packages/table/src/table.vue?vue&type=script&lang=js&
  4337. /* harmony default export */ var src_tablevue_type_script_lang_js_ = (tablevue_type_script_lang_js_);
  4338. // CONCATENATED MODULE: ./packages/table/src/table.vue
  4339. /* normalize component */
  4340. var table_component = Object(componentNormalizer["a" /* default */])(
  4341. src_tablevue_type_script_lang_js_,
  4342. render,
  4343. staticRenderFns,
  4344. false,
  4345. null,
  4346. null,
  4347. null
  4348. )
  4349. /* hot reload */
  4350. if (false) { var table_api; }
  4351. table_component.options.__file = "packages/table/src/table.vue"
  4352. /* harmony default export */ var src_table = (table_component.exports);
  4353. // CONCATENATED MODULE: ./packages/table/index.js
  4354. /* istanbul ignore next */
  4355. src_table.install = function (Vue) {
  4356. Vue.component(src_table.name, src_table);
  4357. };
  4358. /* harmony default export */ var packages_table = __webpack_exports__["default"] = (src_table);
  4359. /***/ })
  4360. /******/ ]);