table.js 141 KB

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