table.js 100 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499
  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, {
  41. /******/ configurable: false,
  42. /******/ enumerable: true,
  43. /******/ get: getter
  44. /******/ });
  45. /******/ }
  46. /******/ };
  47. /******/
  48. /******/ // getDefaultExport function for compatibility with non-harmony modules
  49. /******/ __webpack_require__.n = function(module) {
  50. /******/ var getter = module && module.__esModule ?
  51. /******/ function getDefault() { return module['default']; } :
  52. /******/ function getModuleExports() { return module; };
  53. /******/ __webpack_require__.d(getter, 'a', getter);
  54. /******/ return getter;
  55. /******/ };
  56. /******/
  57. /******/ // Object.prototype.hasOwnProperty.call
  58. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  59. /******/
  60. /******/ // __webpack_public_path__
  61. /******/ __webpack_require__.p = "/dist/";
  62. /******/
  63. /******/ // Load entry module and return exports
  64. /******/ return __webpack_require__(__webpack_require__.s = 183);
  65. /******/ })
  66. /************************************************************************/
  67. /******/ ({
  68. /***/ 0:
  69. /***/ (function(module, exports) {
  70. /* globals __VUE_SSR_CONTEXT__ */
  71. // IMPORTANT: Do NOT use ES2015 features in this file.
  72. // This module is a runtime utility for cleaner component module output and will
  73. // be included in the final webpack user bundle.
  74. module.exports = function normalizeComponent (
  75. rawScriptExports,
  76. compiledTemplate,
  77. functionalTemplate,
  78. injectStyles,
  79. scopeId,
  80. moduleIdentifier /* server only */
  81. ) {
  82. var esModule
  83. var scriptExports = rawScriptExports = rawScriptExports || {}
  84. // ES6 modules interop
  85. var type = typeof rawScriptExports.default
  86. if (type === 'object' || type === 'function') {
  87. esModule = rawScriptExports
  88. scriptExports = rawScriptExports.default
  89. }
  90. // Vue.extend constructor export interop
  91. var options = typeof scriptExports === 'function'
  92. ? scriptExports.options
  93. : scriptExports
  94. // render functions
  95. if (compiledTemplate) {
  96. options.render = compiledTemplate.render
  97. options.staticRenderFns = compiledTemplate.staticRenderFns
  98. options._compiled = true
  99. }
  100. // functional template
  101. if (functionalTemplate) {
  102. options.functional = true
  103. }
  104. // scopedId
  105. if (scopeId) {
  106. options._scopeId = scopeId
  107. }
  108. var hook
  109. if (moduleIdentifier) { // server build
  110. hook = function (context) {
  111. // 2.3 injection
  112. context =
  113. context || // cached call
  114. (this.$vnode && this.$vnode.ssrContext) || // stateful
  115. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  116. // 2.2 with runInNewContext: true
  117. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  118. context = __VUE_SSR_CONTEXT__
  119. }
  120. // inject component styles
  121. if (injectStyles) {
  122. injectStyles.call(this, context)
  123. }
  124. // register component module identifier for async chunk inferrence
  125. if (context && context._registeredComponents) {
  126. context._registeredComponents.add(moduleIdentifier)
  127. }
  128. }
  129. // used by ssr in case component is cached and beforeCreate
  130. // never gets called
  131. options._ssrRegister = hook
  132. } else if (injectStyles) {
  133. hook = injectStyles
  134. }
  135. if (hook) {
  136. var functional = options.functional
  137. var existing = functional
  138. ? options.render
  139. : options.beforeCreate
  140. if (!functional) {
  141. // inject component registration as beforeCreate hook
  142. options.beforeCreate = existing
  143. ? [].concat(existing, hook)
  144. : [hook]
  145. } else {
  146. // for template-only hot-reload because in that case the render fn doesn't
  147. // go through the normalizer
  148. options._injectStyles = hook
  149. // register for functioal component in vue file
  150. options.render = function renderWithStyleInjection (h, context) {
  151. hook.call(context)
  152. return existing(h, context)
  153. }
  154. }
  155. }
  156. return {
  157. esModule: esModule,
  158. exports: scriptExports,
  159. options: options
  160. }
  161. }
  162. /***/ }),
  163. /***/ 10:
  164. /***/ (function(module, exports) {
  165. module.exports = require("element-ui/lib/utils/clickoutside");
  166. /***/ }),
  167. /***/ 12:
  168. /***/ (function(module, exports) {
  169. module.exports = require("throttle-debounce/debounce");
  170. /***/ }),
  171. /***/ 16:
  172. /***/ (function(module, exports) {
  173. module.exports = require("element-ui/lib/checkbox");
  174. /***/ }),
  175. /***/ 17:
  176. /***/ (function(module, exports) {
  177. module.exports = require("element-ui/lib/utils/popup");
  178. /***/ }),
  179. /***/ 183:
  180. /***/ (function(module, exports, __webpack_require__) {
  181. module.exports = __webpack_require__(184);
  182. /***/ }),
  183. /***/ 184:
  184. /***/ (function(module, exports, __webpack_require__) {
  185. "use strict";
  186. exports.__esModule = true;
  187. var _table = __webpack_require__(185);
  188. var _table2 = _interopRequireDefault(_table);
  189. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  190. /* istanbul ignore next */
  191. _table2.default.install = function (Vue) {
  192. Vue.component(_table2.default.name, _table2.default);
  193. };
  194. exports.default = _table2.default;
  195. /***/ }),
  196. /***/ 185:
  197. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  198. "use strict";
  199. Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
  200. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_table_vue__ = __webpack_require__(186);
  201. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_table_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_table_vue__);
  202. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_271dac46_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_table_vue__ = __webpack_require__(196);
  203. var normalizeComponent = __webpack_require__(0)
  204. /* script */
  205. /* template */
  206. /* template functional */
  207. var __vue_template_functional__ = false
  208. /* styles */
  209. var __vue_styles__ = null
  210. /* scopeId */
  211. var __vue_scopeId__ = null
  212. /* moduleIdentifier (server only) */
  213. var __vue_module_identifier__ = null
  214. var Component = normalizeComponent(
  215. __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_table_vue___default.a,
  216. __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_271dac46_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_table_vue__["a" /* default */],
  217. __vue_template_functional__,
  218. __vue_styles__,
  219. __vue_scopeId__,
  220. __vue_module_identifier__
  221. )
  222. /* harmony default export */ __webpack_exports__["default"] = (Component.exports);
  223. /***/ }),
  224. /***/ 186:
  225. /***/ (function(module, exports, __webpack_require__) {
  226. "use strict";
  227. exports.__esModule = true;
  228. var _checkbox = __webpack_require__(16);
  229. var _checkbox2 = _interopRequireDefault(_checkbox);
  230. var _throttle = __webpack_require__(36);
  231. var _throttle2 = _interopRequireDefault(_throttle);
  232. var _debounce = __webpack_require__(12);
  233. var _debounce2 = _interopRequireDefault(_debounce);
  234. var _resizeEvent = __webpack_require__(19);
  235. var _locale = __webpack_require__(4);
  236. var _locale2 = _interopRequireDefault(_locale);
  237. var _migrating = __webpack_require__(7);
  238. var _migrating2 = _interopRequireDefault(_migrating);
  239. var _tableStore = __webpack_require__(187);
  240. var _tableStore2 = _interopRequireDefault(_tableStore);
  241. var _tableLayout = __webpack_require__(188);
  242. var _tableLayout2 = _interopRequireDefault(_tableLayout);
  243. var _tableBody = __webpack_require__(189);
  244. var _tableBody2 = _interopRequireDefault(_tableBody);
  245. var _tableHeader = __webpack_require__(190);
  246. var _tableHeader2 = _interopRequireDefault(_tableHeader);
  247. var _tableFooter = __webpack_require__(195);
  248. var _tableFooter2 = _interopRequireDefault(_tableFooter);
  249. var _util = __webpack_require__(37);
  250. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  251. //
  252. //
  253. //
  254. //
  255. //
  256. //
  257. //
  258. //
  259. //
  260. //
  261. //
  262. //
  263. //
  264. //
  265. //
  266. //
  267. //
  268. //
  269. //
  270. //
  271. //
  272. //
  273. //
  274. //
  275. //
  276. //
  277. //
  278. //
  279. //
  280. //
  281. //
  282. //
  283. //
  284. //
  285. //
  286. //
  287. //
  288. //
  289. //
  290. //
  291. //
  292. //
  293. //
  294. //
  295. //
  296. //
  297. //
  298. //
  299. //
  300. //
  301. //
  302. //
  303. //
  304. //
  305. //
  306. //
  307. //
  308. //
  309. //
  310. //
  311. //
  312. //
  313. //
  314. //
  315. //
  316. //
  317. //
  318. //
  319. //
  320. //
  321. //
  322. //
  323. //
  324. //
  325. //
  326. //
  327. //
  328. //
  329. //
  330. //
  331. //
  332. //
  333. //
  334. //
  335. //
  336. //
  337. //
  338. //
  339. //
  340. //
  341. //
  342. //
  343. //
  344. //
  345. //
  346. //
  347. //
  348. //
  349. //
  350. //
  351. //
  352. //
  353. //
  354. //
  355. //
  356. //
  357. //
  358. //
  359. //
  360. //
  361. //
  362. //
  363. //
  364. //
  365. //
  366. //
  367. //
  368. //
  369. //
  370. //
  371. //
  372. //
  373. //
  374. //
  375. //
  376. //
  377. //
  378. //
  379. //
  380. //
  381. //
  382. //
  383. //
  384. //
  385. //
  386. //
  387. //
  388. //
  389. //
  390. //
  391. //
  392. //
  393. //
  394. //
  395. //
  396. //
  397. //
  398. //
  399. //
  400. //
  401. //
  402. //
  403. var tableIdSeed = 1;
  404. exports.default = {
  405. name: 'ElTable',
  406. mixins: [_locale2.default, _migrating2.default],
  407. props: {
  408. data: {
  409. type: Array,
  410. default: function _default() {
  411. return [];
  412. }
  413. },
  414. size: String,
  415. width: [String, Number],
  416. height: [String, Number],
  417. maxHeight: [String, Number],
  418. fit: {
  419. type: Boolean,
  420. default: true
  421. },
  422. stripe: Boolean,
  423. border: Boolean,
  424. rowKey: [String, Function],
  425. context: {},
  426. showHeader: {
  427. type: Boolean,
  428. default: true
  429. },
  430. showSummary: Boolean,
  431. sumText: String,
  432. summaryMethod: Function,
  433. rowClassName: [String, Function],
  434. rowStyle: [Object, Function],
  435. cellClassName: [String, Function],
  436. cellStyle: [Object, Function],
  437. headerRowClassName: [String, Function],
  438. headerRowStyle: [Object, Function],
  439. headerCellClassName: [String, Function],
  440. headerCellStyle: [Object, Function],
  441. highlightCurrentRow: Boolean,
  442. currentRowKey: [String, Number],
  443. emptyText: String,
  444. expandRowKeys: Array,
  445. defaultExpandAll: Boolean,
  446. defaultSort: Object,
  447. tooltipEffect: String,
  448. spanMethod: Function
  449. },
  450. components: {
  451. TableHeader: _tableHeader2.default,
  452. TableFooter: _tableFooter2.default,
  453. TableBody: _tableBody2.default,
  454. ElCheckbox: _checkbox2.default
  455. },
  456. methods: {
  457. getMigratingConfig: function getMigratingConfig() {
  458. return {
  459. events: {
  460. expand: 'expand is renamed to expand-change'
  461. }
  462. };
  463. },
  464. setCurrentRow: function setCurrentRow(row) {
  465. this.store.commit('setCurrentRow', row);
  466. },
  467. toggleRowSelection: function toggleRowSelection(row, selected) {
  468. this.store.toggleRowSelection(row, selected);
  469. this.store.updateAllSelected();
  470. },
  471. toggleRowExpansion: function toggleRowExpansion(row, expanded) {
  472. this.store.toggleRowExpansion(row, expanded);
  473. },
  474. clearSelection: function clearSelection() {
  475. this.store.clearSelection();
  476. },
  477. clearFilter: function clearFilter() {
  478. this.store.clearFilter();
  479. },
  480. clearSort: function clearSort() {
  481. this.store.clearSort();
  482. },
  483. handleMouseLeave: function handleMouseLeave() {
  484. this.store.commit('setHoverRow', null);
  485. if (this.hoverState) this.hoverState = null;
  486. },
  487. updateScrollY: function updateScrollY() {
  488. this.layout.updateScrollY();
  489. },
  490. bindEvents: function bindEvents() {
  491. var _this = this;
  492. var _$refs = this.$refs,
  493. headerWrapper = _$refs.headerWrapper,
  494. footerWrapper = _$refs.footerWrapper;
  495. var refs = this.$refs;
  496. var self = this;
  497. this.bodyWrapper.addEventListener('scroll', function () {
  498. if (headerWrapper) headerWrapper.scrollLeft = this.scrollLeft;
  499. if (footerWrapper) footerWrapper.scrollLeft = this.scrollLeft;
  500. if (refs.fixedBodyWrapper) refs.fixedBodyWrapper.scrollTop = this.scrollTop;
  501. if (refs.rightFixedBodyWrapper) refs.rightFixedBodyWrapper.scrollTop = this.scrollTop;
  502. var maxScrollLeftPosition = this.scrollWidth - this.offsetWidth - 1;
  503. var scrollLeft = this.scrollLeft;
  504. if (scrollLeft >= maxScrollLeftPosition) {
  505. self.scrollPosition = 'right';
  506. } else if (scrollLeft === 0) {
  507. self.scrollPosition = 'left';
  508. } else {
  509. self.scrollPosition = 'middle';
  510. }
  511. });
  512. var scrollBodyWrapper = function scrollBodyWrapper(event) {
  513. var deltaX = event.deltaX,
  514. deltaY = event.deltaY;
  515. if (Math.abs(deltaX) < Math.abs(deltaY)) return;
  516. if (deltaX > 0) {
  517. _this.bodyWrapper.scrollLeft += 10;
  518. } else if (deltaX < 0) {
  519. _this.bodyWrapper.scrollLeft -= 10;
  520. }
  521. };
  522. if (headerWrapper) {
  523. (0, _util.mousewheel)(headerWrapper, (0, _throttle2.default)(16, scrollBodyWrapper));
  524. }
  525. if (footerWrapper) {
  526. (0, _util.mousewheel)(footerWrapper, (0, _throttle2.default)(16, scrollBodyWrapper));
  527. }
  528. if (this.fit) {
  529. this.windowResizeListener = (0, _throttle2.default)(50, function () {
  530. if (_this.$ready) _this.doLayout();
  531. });
  532. (0, _resizeEvent.addResizeListener)(this.$el, this.windowResizeListener);
  533. }
  534. },
  535. doLayout: function doLayout() {
  536. var _this2 = this;
  537. this.store.updateColumns();
  538. this.updateScrollY();
  539. this.layout.update();
  540. this.$nextTick(function () {
  541. if (_this2.height) {
  542. _this2.layout.setHeight(_this2.height);
  543. } else if (_this2.maxHeight) {
  544. _this2.layout.setMaxHeight(_this2.maxHeight);
  545. } else if (_this2.shouldUpdateHeight) {
  546. _this2.layout.updateHeight();
  547. }
  548. });
  549. }
  550. },
  551. created: function created() {
  552. var _this3 = this;
  553. this.tableId = 'el-table_' + tableIdSeed + '_';
  554. this.debouncedLayout = (0, _debounce2.default)(50, function () {
  555. return _this3.doLayout();
  556. });
  557. },
  558. computed: {
  559. tableSize: function tableSize() {
  560. return this.size || (this.$ELEMENT || {}).size;
  561. },
  562. bodyWrapper: function bodyWrapper() {
  563. return this.$refs.bodyWrapper;
  564. },
  565. shouldUpdateHeight: function shouldUpdateHeight() {
  566. return typeof this.height === 'number' || this.fixedColumns.length > 0 || this.rightFixedColumns.length > 0;
  567. },
  568. selection: function selection() {
  569. return this.store.states.selection;
  570. },
  571. columns: function columns() {
  572. return this.store.states.columns;
  573. },
  574. tableData: function tableData() {
  575. return this.store.states.data;
  576. },
  577. fixedColumns: function fixedColumns() {
  578. return this.store.states.fixedColumns;
  579. },
  580. rightFixedColumns: function rightFixedColumns() {
  581. return this.store.states.rightFixedColumns;
  582. },
  583. bodyHeight: function bodyHeight() {
  584. var style = {};
  585. if (this.height) {
  586. style = {
  587. height: this.layout.bodyHeight ? this.layout.bodyHeight + 'px' : ''
  588. };
  589. } else if (this.maxHeight) {
  590. style = {
  591. 'max-height': (this.showHeader ? this.maxHeight - this.layout.headerHeight - this.layout.footerHeight : this.maxHeight - this.layout.footerHeight) + 'px'
  592. };
  593. }
  594. return style;
  595. },
  596. bodyWidth: function bodyWidth() {
  597. var _layout = this.layout,
  598. bodyWidth = _layout.bodyWidth,
  599. scrollY = _layout.scrollY,
  600. gutterWidth = _layout.gutterWidth;
  601. return bodyWidth ? bodyWidth - (scrollY ? gutterWidth : 0) + 'px' : '';
  602. },
  603. fixedBodyHeight: function fixedBodyHeight() {
  604. var style = {};
  605. if (this.height) {
  606. style = {
  607. height: this.layout.fixedBodyHeight ? this.layout.fixedBodyHeight + 'px' : ''
  608. };
  609. } else if (this.maxHeight) {
  610. var maxHeight = this.layout.scrollX ? this.maxHeight - this.layout.gutterWidth : this.maxHeight;
  611. if (this.showHeader) {
  612. maxHeight -= this.layout.headerHeight;
  613. }
  614. style = {
  615. 'max-height': maxHeight + 'px'
  616. };
  617. }
  618. return style;
  619. },
  620. fixedHeight: function fixedHeight() {
  621. var style = {};
  622. if (this.maxHeight) {
  623. style = {
  624. bottom: this.layout.scrollX && this.data.length ? this.layout.gutterWidth + 'px' : ''
  625. };
  626. } else {
  627. style = {
  628. height: this.layout.viewportHeight ? this.layout.viewportHeight + 'px' : ''
  629. };
  630. }
  631. return style;
  632. }
  633. },
  634. watch: {
  635. height: function height(value) {
  636. this.layout.setHeight(value);
  637. },
  638. maxHeight: function maxHeight(value) {
  639. this.layout.setMaxHeight(value);
  640. },
  641. currentRowKey: function currentRowKey(newVal) {
  642. this.store.setCurrentRowKey(newVal);
  643. },
  644. data: {
  645. immediate: true,
  646. handler: function handler(val) {
  647. var _this4 = this;
  648. this.store.commit('setData', val);
  649. if (this.$ready) {
  650. this.$nextTick(function () {
  651. _this4.doLayout();
  652. });
  653. }
  654. }
  655. },
  656. expandRowKeys: {
  657. immediate: true,
  658. handler: function handler(newVal) {
  659. if (newVal) {
  660. this.store.setExpandRowKeys(newVal);
  661. }
  662. }
  663. }
  664. },
  665. destroyed: function destroyed() {
  666. if (this.windowResizeListener) (0, _resizeEvent.removeResizeListener)(this.$el, this.windowResizeListener);
  667. },
  668. mounted: function mounted() {
  669. var _this5 = this;
  670. this.bindEvents();
  671. this.doLayout();
  672. // init filters
  673. this.store.states.columns.forEach(function (column) {
  674. if (column.filteredValue && column.filteredValue.length) {
  675. _this5.store.commit('filterChange', {
  676. column: column,
  677. values: column.filteredValue,
  678. silent: true
  679. });
  680. }
  681. });
  682. this.$ready = true;
  683. },
  684. data: function data() {
  685. var store = new _tableStore2.default(this, {
  686. rowKey: this.rowKey,
  687. defaultExpandAll: this.defaultExpandAll
  688. });
  689. var layout = new _tableLayout2.default({
  690. store: store,
  691. table: this,
  692. fit: this.fit,
  693. showHeader: this.showHeader
  694. });
  695. return {
  696. store: store,
  697. layout: layout,
  698. isHidden: false,
  699. renderExpanded: null,
  700. resizeProxyVisible: false,
  701. // 是否拥有多级表头
  702. isGroup: false,
  703. scrollPosition: 'left'
  704. };
  705. }
  706. };
  707. /***/ }),
  708. /***/ 187:
  709. /***/ (function(module, exports, __webpack_require__) {
  710. "use strict";
  711. exports.__esModule = true;
  712. var _vue = __webpack_require__(5);
  713. var _vue2 = _interopRequireDefault(_vue);
  714. var _debounce = __webpack_require__(12);
  715. var _debounce2 = _interopRequireDefault(_debounce);
  716. var _merge = __webpack_require__(9);
  717. var _merge2 = _interopRequireDefault(_merge);
  718. var _util = __webpack_require__(37);
  719. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  720. var sortData = function sortData(data, states) {
  721. var sortingColumn = states.sortingColumn;
  722. if (!sortingColumn || typeof sortingColumn.sortable === 'string') {
  723. return data;
  724. }
  725. return (0, _util.orderBy)(data, states.sortProp, states.sortOrder, sortingColumn.sortMethod, sortingColumn.sortBy);
  726. };
  727. var getKeysMap = function getKeysMap(array, rowKey) {
  728. var arrayMap = {};
  729. (array || []).forEach(function (row, index) {
  730. arrayMap[(0, _util.getRowIdentity)(row, rowKey)] = { row: row, index: index };
  731. });
  732. return arrayMap;
  733. };
  734. var toggleRowSelection = function toggleRowSelection(states, row, selected) {
  735. var changed = false;
  736. var selection = states.selection;
  737. var index = selection.indexOf(row);
  738. if (typeof selected === 'undefined') {
  739. if (index === -1) {
  740. selection.push(row);
  741. changed = true;
  742. } else {
  743. selection.splice(index, 1);
  744. changed = true;
  745. }
  746. } else {
  747. if (selected && index === -1) {
  748. selection.push(row);
  749. changed = true;
  750. } else if (!selected && index > -1) {
  751. selection.splice(index, 1);
  752. changed = true;
  753. }
  754. }
  755. return changed;
  756. };
  757. var toggleRowExpansion = function toggleRowExpansion(states, row, expanded) {
  758. var changed = false;
  759. var expandRows = states.expandRows;
  760. if (typeof expanded !== 'undefined') {
  761. var index = expandRows.indexOf(row);
  762. if (expanded) {
  763. if (index === -1) {
  764. expandRows.push(row);
  765. changed = true;
  766. }
  767. } else {
  768. if (index !== -1) {
  769. expandRows.splice(index, 1);
  770. changed = true;
  771. }
  772. }
  773. } else {
  774. var _index = expandRows.indexOf(row);
  775. if (_index === -1) {
  776. expandRows.push(row);
  777. changed = true;
  778. } else {
  779. expandRows.splice(_index, 1);
  780. changed = true;
  781. }
  782. }
  783. return changed;
  784. };
  785. var TableStore = function TableStore(table) {
  786. var initialState = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  787. if (!table) {
  788. throw new Error('Table is required.');
  789. }
  790. this.table = table;
  791. this.states = {
  792. rowKey: null,
  793. _columns: [],
  794. originColumns: [],
  795. columns: [],
  796. fixedColumns: [],
  797. rightFixedColumns: [],
  798. leafColumns: [],
  799. fixedLeafColumns: [],
  800. rightFixedLeafColumns: [],
  801. isComplex: false,
  802. _data: null,
  803. filteredData: null,
  804. data: null,
  805. sortingColumn: null,
  806. sortProp: null,
  807. sortOrder: null,
  808. isAllSelected: false,
  809. selection: [],
  810. reserveSelection: false,
  811. selectable: null,
  812. currentRow: null,
  813. hoverRow: null,
  814. filters: {},
  815. expandRows: [],
  816. defaultExpandAll: false
  817. };
  818. for (var prop in initialState) {
  819. if (initialState.hasOwnProperty(prop) && this.states.hasOwnProperty(prop)) {
  820. this.states[prop] = initialState[prop];
  821. }
  822. }
  823. };
  824. TableStore.prototype.mutations = {
  825. setData: function setData(states, data) {
  826. var _this = this;
  827. var dataInstanceChanged = states._data !== data;
  828. states._data = data;
  829. Object.keys(states.filters).forEach(function (columnId) {
  830. var values = states.filters[columnId];
  831. if (!values || values.length === 0) return;
  832. var column = (0, _util.getColumnById)(_this.states, columnId);
  833. if (column && column.filterMethod) {
  834. data = data.filter(function (row) {
  835. return values.some(function (value) {
  836. return column.filterMethod.call(null, value, row);
  837. });
  838. });
  839. }
  840. });
  841. states.filteredData = data;
  842. states.data = sortData(data || [], states);
  843. // states.data.forEach((item) => {
  844. // if (!item.$extra) {
  845. // Object.defineProperty(item, '$extra', {
  846. // value: {},
  847. // enumerable: false
  848. // });
  849. // }
  850. // });
  851. this.updateCurrentRow();
  852. if (!states.reserveSelection) {
  853. if (dataInstanceChanged) {
  854. this.clearSelection();
  855. } else {
  856. this.cleanSelection();
  857. }
  858. this.updateAllSelected();
  859. } else {
  860. (function () {
  861. var rowKey = states.rowKey;
  862. if (rowKey) {
  863. (function () {
  864. var selection = states.selection;
  865. var selectedMap = getKeysMap(selection, rowKey);
  866. states.data.forEach(function (row) {
  867. var rowId = (0, _util.getRowIdentity)(row, rowKey);
  868. var rowInfo = selectedMap[rowId];
  869. if (rowInfo) {
  870. selection[rowInfo.index] = row;
  871. }
  872. });
  873. _this.updateAllSelected();
  874. })();
  875. } else {
  876. console.warn('WARN: rowKey is required when reserve-selection is enabled.');
  877. }
  878. })();
  879. }
  880. var defaultExpandAll = states.defaultExpandAll;
  881. if (defaultExpandAll) {
  882. this.states.expandRows = (states.data || []).slice(0);
  883. }
  884. _vue2.default.nextTick(function () {
  885. return _this.table.updateScrollY();
  886. });
  887. },
  888. changeSortCondition: function changeSortCondition(states, options) {
  889. var _this2 = this;
  890. states.data = sortData(states.filteredData || states._data || [], states);
  891. if (!options || !options.silent) {
  892. this.table.$emit('sort-change', {
  893. column: this.states.sortingColumn,
  894. prop: this.states.sortProp,
  895. order: this.states.sortOrder
  896. });
  897. }
  898. _vue2.default.nextTick(function () {
  899. return _this2.table.updateScrollY();
  900. });
  901. },
  902. filterChange: function filterChange(states, options) {
  903. var _this3 = this;
  904. var column = options.column,
  905. values = options.values,
  906. silent = options.silent;
  907. if (values && !Array.isArray(values)) {
  908. values = [values];
  909. }
  910. var prop = column.property;
  911. var filters = {};
  912. if (prop) {
  913. states.filters[column.id] = values;
  914. filters[column.columnKey || column.id] = values;
  915. }
  916. var data = states._data;
  917. Object.keys(states.filters).forEach(function (columnId) {
  918. var values = states.filters[columnId];
  919. if (!values || values.length === 0) return;
  920. var column = (0, _util.getColumnById)(_this3.states, columnId);
  921. if (column && column.filterMethod) {
  922. data = data.filter(function (row) {
  923. return values.some(function (value) {
  924. return column.filterMethod.call(null, value, row);
  925. });
  926. });
  927. }
  928. });
  929. states.filteredData = data;
  930. states.data = sortData(data, states);
  931. if (!silent) {
  932. this.table.$emit('filter-change', filters);
  933. }
  934. _vue2.default.nextTick(function () {
  935. return _this3.table.updateScrollY();
  936. });
  937. },
  938. insertColumn: function insertColumn(states, column, index, parent) {
  939. var array = states._columns;
  940. if (parent) {
  941. array = parent.children;
  942. if (!array) array = parent.children = [];
  943. }
  944. if (typeof index !== 'undefined') {
  945. array.splice(index, 0, column);
  946. } else {
  947. array.push(column);
  948. }
  949. if (column.type === 'selection') {
  950. states.selectable = column.selectable;
  951. states.reserveSelection = column.reserveSelection;
  952. }
  953. this.updateColumns(); // hack for dynamics insert column
  954. this.scheduleLayout();
  955. },
  956. removeColumn: function removeColumn(states, column) {
  957. var _columns = states._columns;
  958. if (_columns) {
  959. _columns.splice(_columns.indexOf(column), 1);
  960. }
  961. this.updateColumns(); // hack for dynamics remove column
  962. this.scheduleLayout();
  963. },
  964. setHoverRow: function setHoverRow(states, row) {
  965. states.hoverRow = row;
  966. },
  967. setCurrentRow: function setCurrentRow(states, row) {
  968. var oldCurrentRow = states.currentRow;
  969. states.currentRow = row;
  970. if (oldCurrentRow !== row) {
  971. this.table.$emit('current-change', row, oldCurrentRow);
  972. }
  973. },
  974. rowSelectedChanged: function rowSelectedChanged(states, row) {
  975. var changed = toggleRowSelection(states, row);
  976. var selection = states.selection;
  977. if (changed) {
  978. var table = this.table;
  979. table.$emit('selection-change', selection);
  980. table.$emit('select', selection, row);
  981. }
  982. this.updateAllSelected();
  983. },
  984. toggleAllSelection: (0, _debounce2.default)(10, function (states) {
  985. var data = states.data || [];
  986. var value = !states.isAllSelected;
  987. var selection = this.states.selection;
  988. var selectionChanged = false;
  989. data.forEach(function (item, index) {
  990. if (states.selectable) {
  991. if (states.selectable.call(null, item, index) && toggleRowSelection(states, item, value)) {
  992. selectionChanged = true;
  993. }
  994. } else {
  995. if (toggleRowSelection(states, item, value)) {
  996. selectionChanged = true;
  997. }
  998. }
  999. });
  1000. var table = this.table;
  1001. if (selectionChanged) {
  1002. table.$emit('selection-change', selection);
  1003. }
  1004. table.$emit('select-all', selection);
  1005. states.isAllSelected = value;
  1006. })
  1007. };
  1008. var doFlattenColumns = function doFlattenColumns(columns) {
  1009. var result = [];
  1010. columns.forEach(function (column) {
  1011. if (column.children) {
  1012. result.push.apply(result, doFlattenColumns(column.children));
  1013. } else {
  1014. result.push(column);
  1015. }
  1016. });
  1017. return result;
  1018. };
  1019. TableStore.prototype.updateColumns = function () {
  1020. var states = this.states;
  1021. var _columns = states._columns || [];
  1022. states.fixedColumns = _columns.filter(function (column) {
  1023. return column.fixed === true || column.fixed === 'left';
  1024. });
  1025. states.rightFixedColumns = _columns.filter(function (column) {
  1026. return column.fixed === 'right';
  1027. });
  1028. if (states.fixedColumns.length > 0 && _columns[0] && _columns[0].type === 'selection' && !_columns[0].fixed) {
  1029. _columns[0].fixed = true;
  1030. states.fixedColumns.unshift(_columns[0]);
  1031. }
  1032. var notFixedColumns = _columns.filter(function (column) {
  1033. return !column.fixed;
  1034. });
  1035. states.originColumns = [].concat(states.fixedColumns).concat(notFixedColumns).concat(states.rightFixedColumns);
  1036. var leafColumns = doFlattenColumns(notFixedColumns);
  1037. var fixedLeafColumns = doFlattenColumns(states.fixedColumns);
  1038. var rightFixedLeafColumns = doFlattenColumns(states.rightFixedColumns);
  1039. states.leafColumnsLength = leafColumns.length;
  1040. states.fixedLeafColumnsLength = fixedLeafColumns.length;
  1041. states.rightFixedLeafColumnsLength = rightFixedLeafColumns.length;
  1042. states.columns = [].concat(fixedLeafColumns).concat(leafColumns).concat(rightFixedLeafColumns);
  1043. states.isComplex = states.fixedColumns.length > 0 || states.rightFixedColumns.length > 0;
  1044. };
  1045. TableStore.prototype.isSelected = function (row) {
  1046. return (this.states.selection || []).indexOf(row) > -1;
  1047. };
  1048. TableStore.prototype.clearSelection = function () {
  1049. var states = this.states;
  1050. states.isAllSelected = false;
  1051. var oldSelection = states.selection;
  1052. states.selection = [];
  1053. if (oldSelection.length > 0) {
  1054. this.table.$emit('selection-change', states.selection);
  1055. }
  1056. };
  1057. TableStore.prototype.setExpandRowKeys = function (rowKeys) {
  1058. var expandRows = [];
  1059. var data = this.states.data;
  1060. var rowKey = this.states.rowKey;
  1061. if (!rowKey) throw new Error('[Table] prop row-key should not be empty.');
  1062. var keysMap = getKeysMap(data, rowKey);
  1063. rowKeys.forEach(function (key) {
  1064. var info = keysMap[key];
  1065. if (info) {
  1066. expandRows.push(info.row);
  1067. }
  1068. });
  1069. this.states.expandRows = expandRows;
  1070. };
  1071. TableStore.prototype.toggleRowSelection = function (row, selected) {
  1072. var changed = toggleRowSelection(this.states, row, selected);
  1073. if (changed) {
  1074. this.table.$emit('selection-change', this.states.selection);
  1075. }
  1076. };
  1077. TableStore.prototype.toggleRowExpansion = function (row, expanded) {
  1078. var changed = toggleRowExpansion(this.states, row, expanded);
  1079. if (changed) {
  1080. this.table.$emit('expand-change', row, this.states.expandRows);
  1081. }
  1082. };
  1083. TableStore.prototype.cleanSelection = function () {
  1084. var selection = this.states.selection || [];
  1085. var data = this.states.data;
  1086. var rowKey = this.states.rowKey;
  1087. var deleted = void 0;
  1088. if (rowKey) {
  1089. deleted = [];
  1090. var selectedMap = getKeysMap(selection, rowKey);
  1091. var dataMap = getKeysMap(data, rowKey);
  1092. for (var key in selectedMap) {
  1093. if (selectedMap.hasOwnProperty(key) && !dataMap[key]) {
  1094. deleted.push(selectedMap[key].row);
  1095. }
  1096. }
  1097. } else {
  1098. deleted = selection.filter(function (item) {
  1099. return data.indexOf(item) === -1;
  1100. });
  1101. }
  1102. deleted.forEach(function (deletedItem) {
  1103. selection.splice(selection.indexOf(deletedItem), 1);
  1104. });
  1105. if (deleted.length) {
  1106. this.table.$emit('selection-change', selection);
  1107. }
  1108. };
  1109. TableStore.prototype.clearFilter = function () {
  1110. var states = this.states;
  1111. var _table$$refs = this.table.$refs,
  1112. tableHeader = _table$$refs.tableHeader,
  1113. fixedTableHeader = _table$$refs.fixedTableHeader,
  1114. rightFixedTableHeader = _table$$refs.rightFixedTableHeader;
  1115. var panels = {};
  1116. if (tableHeader) panels = (0, _merge2.default)(panels, tableHeader.filterPanels);
  1117. if (fixedTableHeader) panels = (0, _merge2.default)(panels, fixedTableHeader.filterPanels);
  1118. if (rightFixedTableHeader) panels = (0, _merge2.default)(panels, rightFixedTableHeader.filterPanels);
  1119. var keys = Object.keys(panels);
  1120. if (!keys.length) return;
  1121. keys.forEach(function (key) {
  1122. panels[key].filteredValue = [];
  1123. });
  1124. states.filters = {};
  1125. this.commit('filterChange', {
  1126. column: {},
  1127. values: [],
  1128. silent: true
  1129. });
  1130. };
  1131. TableStore.prototype.clearSort = function () {
  1132. var states = this.states;
  1133. if (!states.sortingColumn) return;
  1134. states.sortingColumn.order = null;
  1135. states.sortProp = null;
  1136. states.sortOrder = null;
  1137. this.commit('changeSortCondition', {
  1138. silent: true
  1139. });
  1140. };
  1141. TableStore.prototype.updateAllSelected = function () {
  1142. var states = this.states;
  1143. var selection = states.selection,
  1144. rowKey = states.rowKey,
  1145. selectable = states.selectable,
  1146. data = states.data;
  1147. if (!data || data.length === 0) {
  1148. states.isAllSelected = false;
  1149. return;
  1150. }
  1151. var selectedMap = void 0;
  1152. if (rowKey) {
  1153. selectedMap = getKeysMap(states.selection, rowKey);
  1154. }
  1155. var isSelected = function isSelected(row) {
  1156. if (selectedMap) {
  1157. return !!selectedMap[(0, _util.getRowIdentity)(row, rowKey)];
  1158. } else {
  1159. return selection.indexOf(row) !== -1;
  1160. }
  1161. };
  1162. var isAllSelected = true;
  1163. var selectedCount = 0;
  1164. for (var i = 0, j = data.length; i < j; i++) {
  1165. var item = data[i];
  1166. if (selectable) {
  1167. var isRowSelectable = selectable.call(null, item, i);
  1168. if (isRowSelectable) {
  1169. if (!isSelected(item)) {
  1170. isAllSelected = false;
  1171. break;
  1172. } else {
  1173. selectedCount++;
  1174. }
  1175. }
  1176. } else {
  1177. if (!isSelected(item)) {
  1178. isAllSelected = false;
  1179. break;
  1180. } else {
  1181. selectedCount++;
  1182. }
  1183. }
  1184. }
  1185. if (selectedCount === 0) isAllSelected = false;
  1186. states.isAllSelected = isAllSelected;
  1187. };
  1188. TableStore.prototype.scheduleLayout = function () {
  1189. this.table.debouncedLayout();
  1190. };
  1191. TableStore.prototype.setCurrentRowKey = function (key) {
  1192. var states = this.states;
  1193. var rowKey = states.rowKey;
  1194. if (!rowKey) throw new Error('[Table] row-key should not be empty.');
  1195. var data = states.data || [];
  1196. var keysMap = getKeysMap(data, rowKey);
  1197. var info = keysMap[key];
  1198. if (info) {
  1199. states.currentRow = info.row;
  1200. }
  1201. };
  1202. TableStore.prototype.updateCurrentRow = function () {
  1203. var states = this.states;
  1204. var table = this.table;
  1205. var data = states.data || [];
  1206. var oldCurrentRow = states.currentRow;
  1207. if (data.indexOf(oldCurrentRow) === -1) {
  1208. states.currentRow = null;
  1209. if (states.currentRow !== oldCurrentRow) {
  1210. table.$emit('current-change', null, oldCurrentRow);
  1211. }
  1212. }
  1213. };
  1214. TableStore.prototype.commit = function (name) {
  1215. var mutations = this.mutations;
  1216. if (mutations[name]) {
  1217. for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  1218. args[_key - 1] = arguments[_key];
  1219. }
  1220. mutations[name].apply(this, [this.states].concat(args));
  1221. } else {
  1222. throw new Error('Action not found: ' + name);
  1223. }
  1224. };
  1225. exports.default = TableStore;
  1226. /***/ }),
  1227. /***/ 188:
  1228. /***/ (function(module, exports, __webpack_require__) {
  1229. "use strict";
  1230. exports.__esModule = true;
  1231. var _scrollbarWidth = __webpack_require__(38);
  1232. var _scrollbarWidth2 = _interopRequireDefault(_scrollbarWidth);
  1233. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1234. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1235. var TableLayout = function () {
  1236. function TableLayout(options) {
  1237. _classCallCheck(this, TableLayout);
  1238. this.table = null;
  1239. this.store = null;
  1240. this.columns = null;
  1241. this.fit = true;
  1242. this.showHeader = true;
  1243. this.height = null;
  1244. this.scrollX = false;
  1245. this.scrollY = false;
  1246. this.bodyWidth = null;
  1247. this.fixedWidth = null;
  1248. this.rightFixedWidth = null;
  1249. this.tableHeight = null;
  1250. this.headerHeight = 44; // Table Header Height
  1251. this.appendHeight = 0; // Append Slot Height
  1252. this.footerHeight = 44; // Table Footer Height
  1253. this.viewportHeight = null; // Table Height - Scroll Bar Height
  1254. this.bodyHeight = null; // Table Height - Table Header Height
  1255. this.fixedBodyHeight = null; // Table Height - Table Header Height - Scroll Bar Height
  1256. this.gutterWidth = (0, _scrollbarWidth2.default)();
  1257. for (var name in options) {
  1258. if (options.hasOwnProperty(name)) {
  1259. this[name] = options[name];
  1260. }
  1261. }
  1262. if (!this.table) {
  1263. throw new Error('table is required for Table Layout');
  1264. }
  1265. if (!this.store) {
  1266. throw new Error('store is required for Table Layout');
  1267. }
  1268. }
  1269. TableLayout.prototype.updateScrollY = function updateScrollY() {
  1270. var height = this.height;
  1271. if (typeof height !== 'string' && typeof height !== 'number') return;
  1272. var bodyWrapper = this.table.bodyWrapper;
  1273. if (this.table.$el && bodyWrapper) {
  1274. var body = bodyWrapper.querySelector('.el-table__body');
  1275. this.scrollY = body.offsetHeight > bodyWrapper.offsetHeight;
  1276. }
  1277. };
  1278. TableLayout.prototype.setHeight = function setHeight(value) {
  1279. var prop = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'height';
  1280. var el = this.table.$el;
  1281. if (typeof value === 'string' && /^\d+$/.test(value)) {
  1282. value = Number(value);
  1283. }
  1284. this.height = value;
  1285. if (!el) return;
  1286. if (typeof value === 'number') {
  1287. el.style[prop] = value + 'px';
  1288. this.updateHeight();
  1289. } else if (typeof value === 'string') {
  1290. if (value === '') {
  1291. el.style[prop] = '';
  1292. }
  1293. this.updateHeight();
  1294. }
  1295. };
  1296. TableLayout.prototype.setMaxHeight = function setMaxHeight(value) {
  1297. return this.setHeight(value, 'max-height');
  1298. };
  1299. TableLayout.prototype.updateHeight = function updateHeight() {
  1300. var height = this.tableHeight = this.table.$el.clientHeight;
  1301. var noData = !this.table.data || this.table.data.length === 0;
  1302. var _table$$refs = this.table.$refs,
  1303. headerWrapper = _table$$refs.headerWrapper,
  1304. appendWrapper = _table$$refs.appendWrapper,
  1305. footerWrapper = _table$$refs.footerWrapper;
  1306. var footerHeight = this.footerHeight = footerWrapper ? footerWrapper.offsetHeight : 0;
  1307. this.appendHeight = appendWrapper ? appendWrapper.offsetHeight : 0;
  1308. if (this.showHeader && !headerWrapper) return;
  1309. if (!this.showHeader) {
  1310. this.headerHeight = 0;
  1311. if (this.height !== null && (!isNaN(this.height) || typeof this.height === 'string')) {
  1312. this.bodyHeight = height - footerHeight + (footerWrapper ? 1 : 0);
  1313. }
  1314. this.fixedBodyHeight = this.scrollX ? height - this.gutterWidth : height;
  1315. } else {
  1316. var headerHeight = this.headerHeight = headerWrapper.offsetHeight;
  1317. var bodyHeight = height - headerHeight - footerHeight + (footerWrapper ? 1 : 0);
  1318. if (this.height !== null && (!isNaN(this.height) || typeof this.height === 'string')) {
  1319. this.bodyHeight = bodyHeight;
  1320. }
  1321. this.fixedBodyHeight = this.scrollX ? bodyHeight - this.gutterWidth : bodyHeight;
  1322. }
  1323. this.viewportHeight = this.scrollX ? height - (noData ? 0 : this.gutterWidth) : height;
  1324. };
  1325. TableLayout.prototype.update = function update() {
  1326. var fit = this.fit;
  1327. var columns = this.table.columns;
  1328. var bodyWidth = this.table.$el.clientWidth;
  1329. var bodyMinWidth = 0;
  1330. var flattenColumns = [];
  1331. columns.forEach(function (column) {
  1332. if (column.isColumnGroup) {
  1333. flattenColumns.push.apply(flattenColumns, column.columns);
  1334. } else {
  1335. flattenColumns.push(column);
  1336. }
  1337. });
  1338. var flexColumns = flattenColumns.filter(function (column) {
  1339. return typeof column.width !== 'number';
  1340. });
  1341. if (flexColumns.length > 0 && fit) {
  1342. flattenColumns.forEach(function (column) {
  1343. bodyMinWidth += column.width || column.minWidth || 80;
  1344. });
  1345. var scrollYWidth = this.scrollY ? this.gutterWidth : 0;
  1346. if (bodyMinWidth <= bodyWidth - scrollYWidth) {
  1347. // DON'T HAVE SCROLL BAR
  1348. this.scrollX = false;
  1349. var totalFlexWidth = bodyWidth - scrollYWidth - bodyMinWidth;
  1350. if (flexColumns.length === 1) {
  1351. flexColumns[0].realWidth = (flexColumns[0].minWidth || 80) + totalFlexWidth;
  1352. } else {
  1353. (function () {
  1354. var allColumnsWidth = flexColumns.reduce(function (prev, column) {
  1355. return prev + (column.minWidth || 80);
  1356. }, 0);
  1357. var flexWidthPerPixel = totalFlexWidth / allColumnsWidth;
  1358. var noneFirstWidth = 0;
  1359. flexColumns.forEach(function (column, index) {
  1360. if (index === 0) return;
  1361. var flexWidth = Math.floor((column.minWidth || 80) * flexWidthPerPixel);
  1362. noneFirstWidth += flexWidth;
  1363. column.realWidth = (column.minWidth || 80) + flexWidth;
  1364. });
  1365. flexColumns[0].realWidth = (flexColumns[0].minWidth || 80) + totalFlexWidth - noneFirstWidth;
  1366. })();
  1367. }
  1368. } else {
  1369. // HAVE HORIZONTAL SCROLL BAR
  1370. this.scrollX = true;
  1371. flexColumns.forEach(function (column) {
  1372. column.realWidth = column.minWidth;
  1373. });
  1374. }
  1375. this.bodyWidth = Math.max(bodyMinWidth, bodyWidth);
  1376. } else {
  1377. flattenColumns.forEach(function (column) {
  1378. if (!column.width && !column.minWidth) {
  1379. column.realWidth = 80;
  1380. } else {
  1381. column.realWidth = column.width || column.minWidth;
  1382. }
  1383. bodyMinWidth += column.realWidth;
  1384. });
  1385. this.scrollX = bodyMinWidth > bodyWidth;
  1386. this.bodyWidth = bodyMinWidth;
  1387. }
  1388. var fixedColumns = this.store.states.fixedColumns;
  1389. if (fixedColumns.length > 0) {
  1390. var fixedWidth = 0;
  1391. fixedColumns.forEach(function (column) {
  1392. fixedWidth += column.realWidth;
  1393. });
  1394. this.fixedWidth = fixedWidth;
  1395. }
  1396. var rightFixedColumns = this.store.states.rightFixedColumns;
  1397. if (rightFixedColumns.length > 0) {
  1398. var rightFixedWidth = 0;
  1399. rightFixedColumns.forEach(function (column) {
  1400. rightFixedWidth += column.realWidth;
  1401. });
  1402. this.rightFixedWidth = rightFixedWidth;
  1403. }
  1404. };
  1405. return TableLayout;
  1406. }();
  1407. exports.default = TableLayout;
  1408. /***/ }),
  1409. /***/ 189:
  1410. /***/ (function(module, exports, __webpack_require__) {
  1411. "use strict";
  1412. exports.__esModule = true;
  1413. 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; };
  1414. var _util = __webpack_require__(37);
  1415. var _dom = __webpack_require__(2);
  1416. var _checkbox = __webpack_require__(16);
  1417. var _checkbox2 = _interopRequireDefault(_checkbox);
  1418. var _tooltip = __webpack_require__(22);
  1419. var _tooltip2 = _interopRequireDefault(_tooltip);
  1420. var _debounce = __webpack_require__(12);
  1421. var _debounce2 = _interopRequireDefault(_debounce);
  1422. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1423. exports.default = {
  1424. components: {
  1425. ElCheckbox: _checkbox2.default,
  1426. ElTooltip: _tooltip2.default
  1427. },
  1428. props: {
  1429. store: {
  1430. required: true
  1431. },
  1432. stripe: Boolean,
  1433. context: {},
  1434. layout: {
  1435. required: true
  1436. },
  1437. rowClassName: [String, Function],
  1438. rowStyle: [Object, Function],
  1439. fixed: String,
  1440. highlight: Boolean
  1441. },
  1442. render: function render(h) {
  1443. var _this = this;
  1444. var columnsHidden = this.columns.map(function (column, index) {
  1445. return _this.isColumnHidden(index);
  1446. });
  1447. return h(
  1448. 'table',
  1449. {
  1450. 'class': 'el-table__body',
  1451. attrs: { cellspacing: '0',
  1452. cellpadding: '0',
  1453. border: '0' }
  1454. },
  1455. [h(
  1456. 'colgroup',
  1457. null,
  1458. [this._l(this.columns, function (column) {
  1459. return h(
  1460. 'col',
  1461. {
  1462. attrs: {
  1463. name: column.id,
  1464. width: column.realWidth || column.width
  1465. }
  1466. },
  1467. []
  1468. );
  1469. })]
  1470. ), h(
  1471. 'tbody',
  1472. null,
  1473. [this._l(this.data, function (row, $index) {
  1474. return [h(
  1475. 'tr',
  1476. {
  1477. style: _this.rowStyle ? _this.getRowStyle(row, $index) : null,
  1478. key: _this.table.rowKey ? _this.getKeyOfRow(row, $index) : $index,
  1479. on: {
  1480. 'dblclick': function dblclick($event) {
  1481. return _this.handleDoubleClick($event, row);
  1482. },
  1483. 'click': function click($event) {
  1484. return _this.handleClick($event, row);
  1485. },
  1486. 'contextmenu': function contextmenu($event) {
  1487. return _this.handleContextMenu($event, row);
  1488. },
  1489. 'mouseenter': function mouseenter(_) {
  1490. return _this.handleMouseEnter($index);
  1491. },
  1492. 'mouseleave': function mouseleave(_) {
  1493. return _this.handleMouseLeave();
  1494. }
  1495. },
  1496. 'class': [_this.getRowClass(row, $index)] },
  1497. [_this._l(_this.columns, function (column, cellIndex) {
  1498. var _getSpan = _this.getSpan(row, column, $index, cellIndex),
  1499. rowspan = _getSpan.rowspan,
  1500. colspan = _getSpan.colspan;
  1501. if (!rowspan || !colspan) {
  1502. return '';
  1503. } else {
  1504. if (rowspan === 1 && colspan === 1) {
  1505. return h(
  1506. 'td',
  1507. {
  1508. style: _this.getCellStyle($index, cellIndex, row, column),
  1509. 'class': _this.getCellClass($index, cellIndex, row, column),
  1510. on: {
  1511. 'mouseenter': function mouseenter($event) {
  1512. return _this.handleCellMouseEnter($event, row);
  1513. },
  1514. 'mouseleave': _this.handleCellMouseLeave
  1515. }
  1516. },
  1517. [column.renderCell.call(_this._renderProxy, h, {
  1518. row: row,
  1519. column: column,
  1520. $index: $index,
  1521. store: _this.store,
  1522. _self: _this.context || _this.table.$vnode.context
  1523. }, columnsHidden[cellIndex])]
  1524. );
  1525. } else {
  1526. return h(
  1527. 'td',
  1528. {
  1529. style: _this.getCellStyle($index, cellIndex, row, column),
  1530. 'class': _this.getCellClass($index, cellIndex, row, column),
  1531. attrs: { rowspan: rowspan,
  1532. colspan: colspan
  1533. },
  1534. on: {
  1535. 'mouseenter': function mouseenter($event) {
  1536. return _this.handleCellMouseEnter($event, row);
  1537. },
  1538. 'mouseleave': _this.handleCellMouseLeave
  1539. }
  1540. },
  1541. [column.renderCell.call(_this._renderProxy, h, {
  1542. row: row,
  1543. column: column,
  1544. $index: $index,
  1545. store: _this.store,
  1546. _self: _this.context || _this.table.$vnode.context
  1547. }, columnsHidden[cellIndex])]
  1548. );
  1549. }
  1550. }
  1551. }), !_this.fixed && _this.layout.scrollY && _this.layout.gutterWidth ? h(
  1552. 'td',
  1553. { 'class': 'gutter' },
  1554. []
  1555. ) : '']
  1556. ), _this.store.states.expandRows.indexOf(row) > -1 ? h(
  1557. 'tr',
  1558. null,
  1559. [h(
  1560. 'td',
  1561. {
  1562. attrs: { colspan: _this.columns.length },
  1563. 'class': 'el-table__expanded-cell' },
  1564. [_this.table.renderExpanded ? _this.table.renderExpanded(h, { row: row, $index: $index, store: _this.store }) : '']
  1565. )]
  1566. ) : ''];
  1567. }).concat(h(
  1568. 'el-tooltip',
  1569. {
  1570. attrs: { effect: this.table.tooltipEffect, placement: 'top', content: this.tooltipContent },
  1571. ref: 'tooltip' },
  1572. []
  1573. ))]
  1574. )]
  1575. );
  1576. },
  1577. watch: {
  1578. 'store.states.hoverRow': function storeStatesHoverRow(newVal, oldVal) {
  1579. if (!this.store.states.isComplex) return;
  1580. var el = this.$el;
  1581. if (!el) return;
  1582. var tr = el.querySelector('tbody').children;
  1583. var rows = [].filter.call(tr, function (row) {
  1584. return (0, _dom.hasClass)(row, 'el-table__row');
  1585. });
  1586. var oldRow = rows[oldVal];
  1587. var newRow = rows[newVal];
  1588. if (oldRow) {
  1589. (0, _dom.removeClass)(oldRow, 'hover-row');
  1590. }
  1591. if (newRow) {
  1592. (0, _dom.addClass)(newRow, 'hover-row');
  1593. }
  1594. },
  1595. 'store.states.currentRow': function storeStatesCurrentRow(newVal, oldVal) {
  1596. if (!this.highlight) return;
  1597. var el = this.$el;
  1598. if (!el) return;
  1599. var data = this.store.states.data;
  1600. var tr = el.querySelector('tbody').children;
  1601. var rows = [].filter.call(tr, function (row) {
  1602. return (0, _dom.hasClass)(row, 'el-table__row');
  1603. });
  1604. var oldRow = rows[data.indexOf(oldVal)];
  1605. var newRow = rows[data.indexOf(newVal)];
  1606. if (oldRow) {
  1607. (0, _dom.removeClass)(oldRow, 'current-row');
  1608. } else if (rows) {
  1609. [].forEach.call(rows, function (row) {
  1610. return (0, _dom.removeClass)(row, 'current-row');
  1611. });
  1612. }
  1613. if (newRow) {
  1614. (0, _dom.addClass)(newRow, 'current-row');
  1615. }
  1616. }
  1617. },
  1618. computed: {
  1619. table: function table() {
  1620. return this.$parent;
  1621. },
  1622. data: function data() {
  1623. return this.store.states.data;
  1624. },
  1625. columnsCount: function columnsCount() {
  1626. return this.store.states.columns.length;
  1627. },
  1628. leftFixedLeafCount: function leftFixedLeafCount() {
  1629. return this.store.states.fixedLeafColumnsLength;
  1630. },
  1631. rightFixedLeafCount: function rightFixedLeafCount() {
  1632. return this.store.states.rightFixedLeafColumnsLength;
  1633. },
  1634. leftFixedCount: function leftFixedCount() {
  1635. return this.store.states.fixedColumns.length;
  1636. },
  1637. rightFixedCount: function rightFixedCount() {
  1638. return this.store.states.rightFixedColumns.length;
  1639. },
  1640. columns: function columns() {
  1641. return this.store.states.columns;
  1642. }
  1643. },
  1644. data: function data() {
  1645. return {
  1646. tooltipContent: ''
  1647. };
  1648. },
  1649. created: function created() {
  1650. this.activateTooltip = (0, _debounce2.default)(50, function (tooltip) {
  1651. return tooltip.handleShowPopper();
  1652. });
  1653. },
  1654. methods: {
  1655. getKeyOfRow: function getKeyOfRow(row, index) {
  1656. var rowKey = this.table.rowKey;
  1657. if (rowKey) {
  1658. return (0, _util.getRowIdentity)(row, rowKey);
  1659. }
  1660. return index;
  1661. },
  1662. isColumnHidden: function isColumnHidden(index) {
  1663. if (this.fixed === true || this.fixed === 'left') {
  1664. return index >= this.leftFixedLeafCount;
  1665. } else if (this.fixed === 'right') {
  1666. return index < this.columnsCount - this.rightFixedLeafCount;
  1667. } else {
  1668. return index < this.leftFixedLeafCount || index >= this.columnsCount - this.rightFixedLeafCount;
  1669. }
  1670. },
  1671. getSpan: function getSpan(row, column, rowIndex, columnIndex) {
  1672. var rowspan = 1;
  1673. var colspan = 1;
  1674. var fn = this.table.spanMethod;
  1675. if (typeof fn === 'function') {
  1676. var result = fn({
  1677. row: row,
  1678. column: column,
  1679. rowIndex: rowIndex,
  1680. columnIndex: columnIndex
  1681. });
  1682. if (Array.isArray(result)) {
  1683. rowspan = result[0];
  1684. colspan = result[1];
  1685. } else if ((typeof result === 'undefined' ? 'undefined' : _typeof(result)) === 'object') {
  1686. rowspan = result.rowspan;
  1687. colspan = result.colspan;
  1688. }
  1689. }
  1690. return {
  1691. rowspan: rowspan,
  1692. colspan: colspan
  1693. };
  1694. },
  1695. getRowStyle: function getRowStyle(row, rowIndex) {
  1696. var rowStyle = this.table.rowStyle;
  1697. if (typeof rowStyle === 'function') {
  1698. return rowStyle.call(null, {
  1699. row: row,
  1700. rowIndex: rowIndex
  1701. });
  1702. }
  1703. return rowStyle;
  1704. },
  1705. getRowClass: function getRowClass(row, rowIndex) {
  1706. var classes = ['el-table__row'];
  1707. if (this.stripe && rowIndex % 2 === 1) {
  1708. classes.push('el-table__row--striped');
  1709. }
  1710. var rowClassName = this.table.rowClassName;
  1711. if (typeof rowClassName === 'string') {
  1712. classes.push(rowClassName);
  1713. } else if (typeof rowClassName === 'function') {
  1714. classes.push(rowClassName.call(null, {
  1715. row: row,
  1716. rowIndex: rowIndex
  1717. }));
  1718. }
  1719. if (this.store.states.expandRows.indexOf(row) > -1) {
  1720. classes.push('expanded');
  1721. }
  1722. return classes.join(' ');
  1723. },
  1724. getCellStyle: function getCellStyle(rowIndex, columnIndex, row, column) {
  1725. var cellStyle = this.table.cellStyle;
  1726. if (typeof cellStyle === 'function') {
  1727. return cellStyle.call(null, {
  1728. rowIndex: rowIndex,
  1729. columnIndex: columnIndex,
  1730. row: row,
  1731. column: column
  1732. });
  1733. }
  1734. return cellStyle;
  1735. },
  1736. getCellClass: function getCellClass(rowIndex, columnIndex, row, column) {
  1737. var classes = [column.id, column.align, column.className];
  1738. if (this.isColumnHidden(columnIndex)) {
  1739. classes.push('is-hidden');
  1740. }
  1741. var cellClassName = this.table.cellClassName;
  1742. if (typeof cellClassName === 'string') {
  1743. classes.push(cellClassName);
  1744. } else if (typeof cellClassName === 'function') {
  1745. classes.push(cellClassName.call(null, {
  1746. rowIndex: rowIndex,
  1747. columnIndex: columnIndex,
  1748. row: row,
  1749. column: column
  1750. }));
  1751. }
  1752. return classes.join(' ');
  1753. },
  1754. handleCellMouseEnter: function handleCellMouseEnter(event, row) {
  1755. var table = this.table;
  1756. var cell = (0, _util.getCell)(event);
  1757. if (cell) {
  1758. var column = (0, _util.getColumnByCell)(table, cell);
  1759. var hoverState = table.hoverState = { cell: cell, column: column, row: row };
  1760. table.$emit('cell-mouse-enter', hoverState.row, hoverState.column, hoverState.cell, event);
  1761. }
  1762. // 判断是否text-overflow, 如果是就显示tooltip
  1763. var cellChild = event.target.querySelector('.cell');
  1764. if ((0, _dom.hasClass)(cellChild, 'el-tooltip') && cellChild.scrollWidth > cellChild.offsetWidth && this.$refs.tooltip) {
  1765. var tooltip = this.$refs.tooltip;
  1766. this.tooltipContent = cell.textContent || cell.innerText;
  1767. tooltip.referenceElm = cell;
  1768. tooltip.$refs.popper && (tooltip.$refs.popper.style.display = 'none');
  1769. tooltip.doDestroy();
  1770. tooltip.setExpectedState(true);
  1771. this.activateTooltip(tooltip);
  1772. }
  1773. },
  1774. handleCellMouseLeave: function handleCellMouseLeave(event) {
  1775. var tooltip = this.$refs.tooltip;
  1776. if (tooltip) {
  1777. tooltip.setExpectedState(false);
  1778. tooltip.handleClosePopper();
  1779. }
  1780. var cell = (0, _util.getCell)(event);
  1781. if (!cell) return;
  1782. var oldHoverState = this.table.hoverState;
  1783. this.table.$emit('cell-mouse-leave', oldHoverState.row, oldHoverState.column, oldHoverState.cell, event);
  1784. },
  1785. handleMouseEnter: function handleMouseEnter(index) {
  1786. this.store.commit('setHoverRow', index);
  1787. },
  1788. handleMouseLeave: function handleMouseLeave() {
  1789. this.store.commit('setHoverRow', null);
  1790. },
  1791. handleContextMenu: function handleContextMenu(event, row) {
  1792. this.handleEvent(event, row, 'contextmenu');
  1793. },
  1794. handleDoubleClick: function handleDoubleClick(event, row) {
  1795. this.handleEvent(event, row, 'dblclick');
  1796. },
  1797. handleClick: function handleClick(event, row) {
  1798. this.store.commit('setCurrentRow', row);
  1799. this.handleEvent(event, row, 'click');
  1800. },
  1801. handleEvent: function handleEvent(event, row, name) {
  1802. var table = this.table;
  1803. var cell = (0, _util.getCell)(event);
  1804. var column = void 0;
  1805. if (cell) {
  1806. column = (0, _util.getColumnByCell)(table, cell);
  1807. if (column) {
  1808. table.$emit('cell-' + name, row, column, cell, event);
  1809. }
  1810. }
  1811. table.$emit('row-' + name, row, event, column);
  1812. },
  1813. handleExpandClick: function handleExpandClick(row) {
  1814. this.store.toggleRowExpansion(row);
  1815. }
  1816. }
  1817. };
  1818. /***/ }),
  1819. /***/ 19:
  1820. /***/ (function(module, exports) {
  1821. module.exports = require("element-ui/lib/utils/resize-event");
  1822. /***/ }),
  1823. /***/ 190:
  1824. /***/ (function(module, exports, __webpack_require__) {
  1825. "use strict";
  1826. exports.__esModule = true;
  1827. var _dom = __webpack_require__(2);
  1828. var _checkbox = __webpack_require__(16);
  1829. var _checkbox2 = _interopRequireDefault(_checkbox);
  1830. var _tag = __webpack_require__(24);
  1831. var _tag2 = _interopRequireDefault(_tag);
  1832. var _vue = __webpack_require__(5);
  1833. var _vue2 = _interopRequireDefault(_vue);
  1834. var _filterPanel = __webpack_require__(191);
  1835. var _filterPanel2 = _interopRequireDefault(_filterPanel);
  1836. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1837. var getAllColumns = function getAllColumns(columns) {
  1838. var result = [];
  1839. columns.forEach(function (column) {
  1840. if (column.children) {
  1841. result.push(column);
  1842. result.push.apply(result, getAllColumns(column.children));
  1843. } else {
  1844. result.push(column);
  1845. }
  1846. });
  1847. return result;
  1848. };
  1849. var convertToRows = function convertToRows(originColumns) {
  1850. var maxLevel = 1;
  1851. var traverse = function traverse(column, parent) {
  1852. if (parent) {
  1853. column.level = parent.level + 1;
  1854. if (maxLevel < column.level) {
  1855. maxLevel = column.level;
  1856. }
  1857. }
  1858. if (column.children) {
  1859. var colSpan = 0;
  1860. column.children.forEach(function (subColumn) {
  1861. traverse(subColumn, column);
  1862. colSpan += subColumn.colSpan;
  1863. });
  1864. column.colSpan = colSpan;
  1865. } else {
  1866. column.colSpan = 1;
  1867. }
  1868. };
  1869. originColumns.forEach(function (column) {
  1870. column.level = 1;
  1871. traverse(column);
  1872. });
  1873. var rows = [];
  1874. for (var i = 0; i < maxLevel; i++) {
  1875. rows.push([]);
  1876. }
  1877. var allColumns = getAllColumns(originColumns);
  1878. allColumns.forEach(function (column) {
  1879. if (!column.children) {
  1880. column.rowSpan = maxLevel - column.level + 1;
  1881. } else {
  1882. column.rowSpan = 1;
  1883. }
  1884. rows[column.level - 1].push(column);
  1885. });
  1886. return rows;
  1887. };
  1888. exports.default = {
  1889. name: 'ElTableHeader',
  1890. render: function render(h) {
  1891. var _this = this;
  1892. var originColumns = this.store.states.originColumns;
  1893. var columnRows = convertToRows(originColumns, this.columns);
  1894. // 是否拥有多级表头
  1895. var isGroup = columnRows.length > 1;
  1896. if (isGroup) this.$parent.isGroup = true;
  1897. return h(
  1898. 'table',
  1899. {
  1900. 'class': 'el-table__header',
  1901. attrs: { cellspacing: '0',
  1902. cellpadding: '0',
  1903. border: '0' }
  1904. },
  1905. [h(
  1906. 'colgroup',
  1907. null,
  1908. [this._l(this.columns, function (column) {
  1909. return h(
  1910. 'col',
  1911. {
  1912. attrs: {
  1913. name: column.id,
  1914. width: column.realWidth || column.width
  1915. }
  1916. },
  1917. []
  1918. );
  1919. }), !this.fixed && this.layout.gutterWidth ? h(
  1920. 'col',
  1921. {
  1922. attrs: { name: 'gutter', width: this.layout.scrollY ? this.layout.gutterWidth : '' }
  1923. },
  1924. []
  1925. ) : '']
  1926. ), h(
  1927. 'thead',
  1928. { 'class': [{ 'is-group': isGroup, 'has-gutter': this.hasGutter }] },
  1929. [this._l(columnRows, function (columns, rowIndex) {
  1930. return h(
  1931. 'tr',
  1932. {
  1933. style: _this.getHeaderRowStyle(rowIndex),
  1934. 'class': _this.getHeaderRowClass(rowIndex)
  1935. },
  1936. [_this._l(columns, function (column, cellIndex) {
  1937. return h(
  1938. 'th',
  1939. {
  1940. attrs: {
  1941. colspan: column.colSpan,
  1942. rowspan: column.rowSpan
  1943. },
  1944. on: {
  1945. 'mousemove': function mousemove($event) {
  1946. return _this.handleMouseMove($event, column);
  1947. },
  1948. 'mouseout': _this.handleMouseOut,
  1949. 'mousedown': function mousedown($event) {
  1950. return _this.handleMouseDown($event, column);
  1951. },
  1952. 'click': function click($event) {
  1953. return _this.handleHeaderClick($event, column);
  1954. }
  1955. },
  1956. style: _this.getHeaderCellStyle(rowIndex, cellIndex, columns, column),
  1957. 'class': _this.getHeaderCellClass(rowIndex, cellIndex, columns, column) },
  1958. [h(
  1959. 'div',
  1960. { 'class': ['cell', column.filteredValue && column.filteredValue.length > 0 ? 'highlight' : '', column.labelClassName] },
  1961. [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(
  1962. 'span',
  1963. { 'class': 'caret-wrapper', on: {
  1964. 'click': function click($event) {
  1965. return _this.handleSortClick($event, column);
  1966. }
  1967. }
  1968. },
  1969. [h(
  1970. 'i',
  1971. { 'class': 'sort-caret ascending el-icon-caret-top', on: {
  1972. 'click': function click($event) {
  1973. return _this.handleSortClick($event, column, 'ascending');
  1974. }
  1975. }
  1976. },
  1977. []
  1978. ), h(
  1979. 'i',
  1980. { 'class': 'sort-caret descending el-icon-caret-bottom', on: {
  1981. 'click': function click($event) {
  1982. return _this.handleSortClick($event, column, 'descending');
  1983. }
  1984. }
  1985. },
  1986. []
  1987. )]
  1988. ) : '', column.filterable ? h(
  1989. 'span',
  1990. { 'class': 'el-table__column-filter-trigger', on: {
  1991. 'click': function click($event) {
  1992. return _this.handleFilterClick($event, column);
  1993. }
  1994. }
  1995. },
  1996. [h(
  1997. 'i',
  1998. { 'class': ['el-icon-arrow-down', column.filterOpened ? 'el-icon-arrow-up' : ''] },
  1999. []
  2000. )]
  2001. ) : '']
  2002. )]
  2003. );
  2004. }), _this.hasGutter ? h(
  2005. 'th',
  2006. { 'class': 'gutter', style: { width: _this.layout.scrollY ? _this.layout.gutterWidth + 'px' : '0' } },
  2007. []
  2008. ) : '']
  2009. );
  2010. })]
  2011. )]
  2012. );
  2013. },
  2014. props: {
  2015. fixed: String,
  2016. store: {
  2017. required: true
  2018. },
  2019. layout: {
  2020. required: true
  2021. },
  2022. border: Boolean,
  2023. defaultSort: {
  2024. type: Object,
  2025. default: function _default() {
  2026. return {
  2027. prop: '',
  2028. order: ''
  2029. };
  2030. }
  2031. }
  2032. },
  2033. components: {
  2034. ElCheckbox: _checkbox2.default,
  2035. ElTag: _tag2.default
  2036. },
  2037. computed: {
  2038. table: function table() {
  2039. return this.$parent;
  2040. },
  2041. isAllSelected: function isAllSelected() {
  2042. return this.store.states.isAllSelected;
  2043. },
  2044. columnsCount: function columnsCount() {
  2045. return this.store.states.columns.length;
  2046. },
  2047. leftFixedCount: function leftFixedCount() {
  2048. return this.store.states.fixedColumns.length;
  2049. },
  2050. rightFixedCount: function rightFixedCount() {
  2051. return this.store.states.rightFixedColumns.length;
  2052. },
  2053. leftFixedLeafCount: function leftFixedLeafCount() {
  2054. return this.store.states.fixedLeafColumnsLength;
  2055. },
  2056. rightFixedLeafCount: function rightFixedLeafCount() {
  2057. return this.store.states.rightFixedLeafColumnsLength;
  2058. },
  2059. columns: function columns() {
  2060. return this.store.states.columns;
  2061. },
  2062. hasGutter: function hasGutter() {
  2063. return !this.fixed && this.layout.gutterWidth;
  2064. }
  2065. },
  2066. created: function created() {
  2067. this.filterPanels = {};
  2068. },
  2069. mounted: function mounted() {
  2070. var _this2 = this;
  2071. if (this.defaultSort.prop) {
  2072. (function () {
  2073. var states = _this2.store.states;
  2074. states.sortProp = _this2.defaultSort.prop;
  2075. states.sortOrder = _this2.defaultSort.order || 'ascending';
  2076. _this2.$nextTick(function (_) {
  2077. for (var i = 0, length = _this2.columns.length; i < length; i++) {
  2078. var column = _this2.columns[i];
  2079. if (column.property === states.sortProp) {
  2080. column.order = states.sortOrder;
  2081. states.sortingColumn = column;
  2082. break;
  2083. }
  2084. }
  2085. if (states.sortingColumn) {
  2086. _this2.store.commit('changeSortCondition');
  2087. }
  2088. });
  2089. })();
  2090. }
  2091. },
  2092. beforeDestroy: function beforeDestroy() {
  2093. var panels = this.filterPanels;
  2094. for (var prop in panels) {
  2095. if (panels.hasOwnProperty(prop) && panels[prop]) {
  2096. panels[prop].$destroy(true);
  2097. }
  2098. }
  2099. },
  2100. methods: {
  2101. isCellHidden: function isCellHidden(index, columns) {
  2102. var start = 0;
  2103. for (var i = 0; i < index; i++) {
  2104. start += columns[i].colSpan;
  2105. }
  2106. var after = start + columns[index].colSpan - 1;
  2107. if (this.fixed === true || this.fixed === 'left') {
  2108. return after >= this.leftFixedLeafCount;
  2109. } else if (this.fixed === 'right') {
  2110. return start < this.columnsCount - this.rightFixedLeafCount;
  2111. } else {
  2112. return after < this.leftFixedLeafCount || start >= this.columnsCount - this.rightFixedLeafCount;
  2113. }
  2114. },
  2115. getHeaderRowStyle: function getHeaderRowStyle(rowIndex) {
  2116. var headerRowStyle = this.table.headerRowStyle;
  2117. if (typeof headerRowStyle === 'function') {
  2118. return headerRowStyle.call(null, { rowIndex: rowIndex });
  2119. }
  2120. return headerRowStyle;
  2121. },
  2122. getHeaderRowClass: function getHeaderRowClass(rowIndex) {
  2123. var classes = [];
  2124. var headerRowClassName = this.table.headerRowClassName;
  2125. if (typeof headerRowClassName === 'string') {
  2126. classes.push(headerRowClassName);
  2127. } else if (typeof headerRowClassName === 'function') {
  2128. classes.push(headerRowClassName.call(null, { rowIndex: rowIndex }));
  2129. }
  2130. return classes.join(' ');
  2131. },
  2132. getHeaderCellStyle: function getHeaderCellStyle(rowIndex, columnIndex, row, column) {
  2133. var headerCellStyle = this.table.headerCellStyle;
  2134. if (typeof headerCellStyle === 'function') {
  2135. return headerCellStyle.call(null, {
  2136. rowIndex: rowIndex,
  2137. columnIndex: columnIndex,
  2138. row: row,
  2139. column: column
  2140. });
  2141. }
  2142. return headerCellStyle;
  2143. },
  2144. getHeaderCellClass: function getHeaderCellClass(rowIndex, columnIndex, row, column) {
  2145. var classes = [column.id, column.order, column.headerAlign, column.className, column.labelClassName];
  2146. if (rowIndex === 0 && this.isCellHidden(columnIndex, row)) {
  2147. classes.push('is-hidden');
  2148. }
  2149. if (!column.children) {
  2150. classes.push('is-leaf');
  2151. }
  2152. if (column.sortable) {
  2153. classes.push('is-sortable');
  2154. }
  2155. var headerCellClassName = this.table.headerCellClassName;
  2156. if (typeof headerCellClassName === 'string') {
  2157. classes.push(headerCellClassName);
  2158. } else if (typeof headerCellClassName === 'function') {
  2159. classes.push(headerCellClassName.call(null, {
  2160. rowIndex: rowIndex,
  2161. columnIndex: columnIndex,
  2162. row: row,
  2163. column: column
  2164. }));
  2165. }
  2166. return classes.join(' ');
  2167. },
  2168. toggleAllSelection: function toggleAllSelection() {
  2169. this.store.commit('toggleAllSelection');
  2170. },
  2171. handleFilterClick: function handleFilterClick(event, column) {
  2172. event.stopPropagation();
  2173. var target = event.target;
  2174. var cell = target.parentNode;
  2175. var table = this.$parent;
  2176. var filterPanel = this.filterPanels[column.id];
  2177. if (filterPanel && column.filterOpened) {
  2178. filterPanel.showPopper = false;
  2179. return;
  2180. }
  2181. if (!filterPanel) {
  2182. filterPanel = new _vue2.default(_filterPanel2.default);
  2183. this.filterPanels[column.id] = filterPanel;
  2184. if (column.filterPlacement) {
  2185. filterPanel.placement = column.filterPlacement;
  2186. }
  2187. filterPanel.table = table;
  2188. filterPanel.cell = cell;
  2189. filterPanel.column = column;
  2190. !this.$isServer && filterPanel.$mount(document.createElement('div'));
  2191. }
  2192. setTimeout(function () {
  2193. filterPanel.showPopper = true;
  2194. }, 16);
  2195. },
  2196. handleHeaderClick: function handleHeaderClick(event, column) {
  2197. if (!column.filters && column.sortable) {
  2198. this.handleSortClick(event, column);
  2199. } else if (column.filters && !column.sortable) {
  2200. this.handleFilterClick(event, column);
  2201. }
  2202. this.$parent.$emit('header-click', column, event);
  2203. },
  2204. handleMouseDown: function handleMouseDown(event, column) {
  2205. var _this3 = this;
  2206. if (this.$isServer) return;
  2207. if (column.children && column.children.length > 0) return;
  2208. /* istanbul ignore if */
  2209. if (this.draggingColumn && this.border) {
  2210. (function () {
  2211. _this3.dragging = true;
  2212. _this3.$parent.resizeProxyVisible = true;
  2213. var table = _this3.$parent;
  2214. var tableEl = table.$el;
  2215. var tableLeft = tableEl.getBoundingClientRect().left;
  2216. var columnEl = _this3.$el.querySelector('th.' + column.id);
  2217. var columnRect = columnEl.getBoundingClientRect();
  2218. var minLeft = columnRect.left - tableLeft + 30;
  2219. (0, _dom.addClass)(columnEl, 'noclick');
  2220. _this3.dragState = {
  2221. startMouseLeft: event.clientX,
  2222. startLeft: columnRect.right - tableLeft,
  2223. startColumnLeft: columnRect.left - tableLeft,
  2224. tableLeft: tableLeft
  2225. };
  2226. var resizeProxy = table.$refs.resizeProxy;
  2227. resizeProxy.style.left = _this3.dragState.startLeft + 'px';
  2228. document.onselectstart = function () {
  2229. return false;
  2230. };
  2231. document.ondragstart = function () {
  2232. return false;
  2233. };
  2234. var handleMouseMove = function handleMouseMove(event) {
  2235. var deltaLeft = event.clientX - _this3.dragState.startMouseLeft;
  2236. var proxyLeft = _this3.dragState.startLeft + deltaLeft;
  2237. resizeProxy.style.left = Math.max(minLeft, proxyLeft) + 'px';
  2238. };
  2239. var handleMouseUp = function handleMouseUp() {
  2240. if (_this3.dragging) {
  2241. var _dragState = _this3.dragState,
  2242. startColumnLeft = _dragState.startColumnLeft,
  2243. startLeft = _dragState.startLeft;
  2244. var finalLeft = parseInt(resizeProxy.style.left, 10);
  2245. var columnWidth = finalLeft - startColumnLeft;
  2246. column.width = column.realWidth = columnWidth;
  2247. table.$emit('header-dragend', column.width, startLeft - startColumnLeft, column, event);
  2248. _this3.store.scheduleLayout();
  2249. document.body.style.cursor = '';
  2250. _this3.dragging = false;
  2251. _this3.draggingColumn = null;
  2252. _this3.dragState = {};
  2253. table.resizeProxyVisible = false;
  2254. }
  2255. document.removeEventListener('mousemove', handleMouseMove);
  2256. document.removeEventListener('mouseup', handleMouseUp);
  2257. document.onselectstart = null;
  2258. document.ondragstart = null;
  2259. setTimeout(function () {
  2260. (0, _dom.removeClass)(columnEl, 'noclick');
  2261. }, 0);
  2262. };
  2263. document.addEventListener('mousemove', handleMouseMove);
  2264. document.addEventListener('mouseup', handleMouseUp);
  2265. })();
  2266. }
  2267. },
  2268. handleMouseMove: function handleMouseMove(event, column) {
  2269. if (column.children && column.children.length > 0) return;
  2270. var target = event.target;
  2271. while (target && target.tagName !== 'TH') {
  2272. target = target.parentNode;
  2273. }
  2274. if (!column || !column.resizable) return;
  2275. if (!this.dragging && this.border) {
  2276. var rect = target.getBoundingClientRect();
  2277. var bodyStyle = document.body.style;
  2278. if (rect.width > 12 && rect.right - event.pageX < 8) {
  2279. bodyStyle.cursor = 'col-resize';
  2280. if ((0, _dom.hasClass)(target, 'is-sortable')) {
  2281. target.style.cursor = 'col-resize';
  2282. }
  2283. this.draggingColumn = column;
  2284. } else if (!this.dragging) {
  2285. bodyStyle.cursor = '';
  2286. if ((0, _dom.hasClass)(target, 'is-sortable')) {
  2287. target.style.cursor = 'pointer';
  2288. }
  2289. this.draggingColumn = null;
  2290. }
  2291. }
  2292. },
  2293. handleMouseOut: function handleMouseOut() {
  2294. if (this.$isServer) return;
  2295. document.body.style.cursor = '';
  2296. },
  2297. toggleOrder: function toggleOrder(order) {
  2298. return !order ? 'ascending' : order === 'ascending' ? 'descending' : null;
  2299. },
  2300. handleSortClick: function handleSortClick(event, column, givenOrder) {
  2301. event.stopPropagation();
  2302. var order = givenOrder || this.toggleOrder(column.order);
  2303. var target = event.target;
  2304. while (target && target.tagName !== 'TH') {
  2305. target = target.parentNode;
  2306. }
  2307. if (target && target.tagName === 'TH') {
  2308. if ((0, _dom.hasClass)(target, 'noclick')) {
  2309. (0, _dom.removeClass)(target, 'noclick');
  2310. return;
  2311. }
  2312. }
  2313. if (!column.sortable) return;
  2314. var states = this.store.states;
  2315. var sortProp = states.sortProp;
  2316. var sortOrder = void 0;
  2317. var sortingColumn = states.sortingColumn;
  2318. if (sortingColumn !== column) {
  2319. if (sortingColumn) {
  2320. sortingColumn.order = null;
  2321. }
  2322. states.sortingColumn = column;
  2323. sortProp = column.property;
  2324. }
  2325. if (!order) {
  2326. sortOrder = column.order = null;
  2327. states.sortingColumn = null;
  2328. sortProp = null;
  2329. } else {
  2330. sortOrder = column.order = order;
  2331. }
  2332. states.sortProp = sortProp;
  2333. states.sortOrder = sortOrder;
  2334. this.store.commit('changeSortCondition');
  2335. }
  2336. },
  2337. data: function data() {
  2338. return {
  2339. draggingColumn: null,
  2340. dragging: false,
  2341. dragState: {}
  2342. };
  2343. }
  2344. };
  2345. /***/ }),
  2346. /***/ 191:
  2347. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2348. "use strict";
  2349. Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
  2350. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_filter_panel_vue__ = __webpack_require__(192);
  2351. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_filter_panel_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_filter_panel_vue__);
  2352. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_a82ec7a0_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_filter_panel_vue__ = __webpack_require__(194);
  2353. var normalizeComponent = __webpack_require__(0)
  2354. /* script */
  2355. /* template */
  2356. /* template functional */
  2357. var __vue_template_functional__ = false
  2358. /* styles */
  2359. var __vue_styles__ = null
  2360. /* scopeId */
  2361. var __vue_scopeId__ = null
  2362. /* moduleIdentifier (server only) */
  2363. var __vue_module_identifier__ = null
  2364. var Component = normalizeComponent(
  2365. __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_filter_panel_vue___default.a,
  2366. __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_a82ec7a0_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_filter_panel_vue__["a" /* default */],
  2367. __vue_template_functional__,
  2368. __vue_styles__,
  2369. __vue_scopeId__,
  2370. __vue_module_identifier__
  2371. )
  2372. /* harmony default export */ __webpack_exports__["default"] = (Component.exports);
  2373. /***/ }),
  2374. /***/ 192:
  2375. /***/ (function(module, exports, __webpack_require__) {
  2376. "use strict";
  2377. exports.__esModule = true;
  2378. var _vuePopper = __webpack_require__(8);
  2379. var _vuePopper2 = _interopRequireDefault(_vuePopper);
  2380. var _popup = __webpack_require__(17);
  2381. var _locale = __webpack_require__(4);
  2382. var _locale2 = _interopRequireDefault(_locale);
  2383. var _clickoutside = __webpack_require__(10);
  2384. var _clickoutside2 = _interopRequireDefault(_clickoutside);
  2385. var _dropdown = __webpack_require__(193);
  2386. var _dropdown2 = _interopRequireDefault(_dropdown);
  2387. var _checkbox = __webpack_require__(16);
  2388. var _checkbox2 = _interopRequireDefault(_checkbox);
  2389. var _checkboxGroup = __webpack_require__(39);
  2390. var _checkboxGroup2 = _interopRequireDefault(_checkboxGroup);
  2391. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  2392. exports.default = {
  2393. name: 'ElTableFilterPanel',
  2394. mixins: [_vuePopper2.default, _locale2.default],
  2395. directives: {
  2396. Clickoutside: _clickoutside2.default
  2397. },
  2398. components: {
  2399. ElCheckbox: _checkbox2.default,
  2400. ElCheckboxGroup: _checkboxGroup2.default
  2401. },
  2402. props: {
  2403. placement: {
  2404. type: String,
  2405. default: 'bottom-end'
  2406. }
  2407. },
  2408. customRender: function customRender(h) {
  2409. return h(
  2410. 'div',
  2411. { 'class': 'el-table-filter' },
  2412. [h(
  2413. 'div',
  2414. { 'class': 'el-table-filter__content' },
  2415. []
  2416. ), h(
  2417. 'div',
  2418. { 'class': 'el-table-filter__bottom' },
  2419. [h(
  2420. 'button',
  2421. {
  2422. on: {
  2423. 'click': this.handleConfirm
  2424. }
  2425. },
  2426. [this.t('el.table.confirmFilter')]
  2427. ), h(
  2428. 'button',
  2429. {
  2430. on: {
  2431. 'click': this.handleReset
  2432. }
  2433. },
  2434. [this.t('el.table.resetFilter')]
  2435. )]
  2436. )]
  2437. );
  2438. },
  2439. methods: {
  2440. isActive: function isActive(filter) {
  2441. return filter.value === this.filterValue;
  2442. },
  2443. handleOutsideClick: function handleOutsideClick() {
  2444. this.showPopper = false;
  2445. },
  2446. handleConfirm: function handleConfirm() {
  2447. this.confirmFilter(this.filteredValue);
  2448. this.handleOutsideClick();
  2449. },
  2450. handleReset: function handleReset() {
  2451. this.filteredValue = [];
  2452. this.confirmFilter(this.filteredValue);
  2453. this.handleOutsideClick();
  2454. },
  2455. handleSelect: function handleSelect(filterValue) {
  2456. this.filterValue = filterValue;
  2457. if (typeof filterValue !== 'undefined' && filterValue !== null) {
  2458. this.confirmFilter(this.filteredValue);
  2459. } else {
  2460. this.confirmFilter([]);
  2461. }
  2462. this.handleOutsideClick();
  2463. },
  2464. confirmFilter: function confirmFilter(filteredValue) {
  2465. this.table.store.commit('filterChange', {
  2466. column: this.column,
  2467. values: filteredValue
  2468. });
  2469. }
  2470. },
  2471. data: function data() {
  2472. return {
  2473. table: null,
  2474. cell: null,
  2475. column: null
  2476. };
  2477. },
  2478. computed: {
  2479. filters: function filters() {
  2480. return this.column && this.column.filters;
  2481. },
  2482. filterValue: {
  2483. get: function get() {
  2484. return (this.column.filteredValue || [])[0];
  2485. },
  2486. set: function set(value) {
  2487. if (this.filteredValue) {
  2488. if (typeof value !== 'undefined' && value !== null) {
  2489. this.filteredValue.splice(0, 1, value);
  2490. } else {
  2491. this.filteredValue.splice(0, 1);
  2492. }
  2493. }
  2494. }
  2495. },
  2496. filteredValue: {
  2497. get: function get() {
  2498. if (this.column) {
  2499. return this.column.filteredValue || [];
  2500. }
  2501. return [];
  2502. },
  2503. set: function set(value) {
  2504. if (this.column) {
  2505. this.column.filteredValue = value;
  2506. }
  2507. }
  2508. },
  2509. multiple: function multiple() {
  2510. if (this.column) {
  2511. return this.column.filterMultiple;
  2512. }
  2513. return true;
  2514. }
  2515. },
  2516. mounted: function mounted() {
  2517. var _this = this;
  2518. this.popperElm = this.$el;
  2519. this.referenceElm = this.cell;
  2520. this.table.bodyWrapper.addEventListener('scroll', function () {
  2521. _this.updatePopper();
  2522. });
  2523. this.$watch('showPopper', function (value) {
  2524. if (_this.column) _this.column.filterOpened = value;
  2525. if (value) {
  2526. _dropdown2.default.open(_this);
  2527. } else {
  2528. _dropdown2.default.close(_this);
  2529. }
  2530. });
  2531. },
  2532. watch: {
  2533. showPopper: function showPopper(val) {
  2534. if (val === true && parseInt(this.popperJS._popper.style.zIndex, 10) < _popup.PopupManager.zIndex) {
  2535. this.popperJS._popper.style.zIndex = _popup.PopupManager.nextZIndex();
  2536. }
  2537. }
  2538. }
  2539. }; //
  2540. //
  2541. //
  2542. //
  2543. //
  2544. //
  2545. //
  2546. //
  2547. //
  2548. //
  2549. //
  2550. //
  2551. //
  2552. //
  2553. //
  2554. //
  2555. //
  2556. //
  2557. //
  2558. //
  2559. //
  2560. //
  2561. //
  2562. //
  2563. //
  2564. //
  2565. //
  2566. //
  2567. //
  2568. //
  2569. //
  2570. //
  2571. //
  2572. //
  2573. /***/ }),
  2574. /***/ 193:
  2575. /***/ (function(module, exports, __webpack_require__) {
  2576. "use strict";
  2577. exports.__esModule = true;
  2578. var _vue = __webpack_require__(5);
  2579. var _vue2 = _interopRequireDefault(_vue);
  2580. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  2581. var dropdowns = [];
  2582. !_vue2.default.prototype.$isServer && document.addEventListener('click', function (event) {
  2583. dropdowns.forEach(function (dropdown) {
  2584. var target = event.target;
  2585. if (!dropdown || !dropdown.$el) return;
  2586. if (target === dropdown.$el || dropdown.$el.contains(target)) {
  2587. return;
  2588. }
  2589. dropdown.handleOutsideClick && dropdown.handleOutsideClick(event);
  2590. });
  2591. });
  2592. exports.default = {
  2593. open: function open(instance) {
  2594. if (instance) {
  2595. dropdowns.push(instance);
  2596. }
  2597. },
  2598. close: function close(instance) {
  2599. var index = dropdowns.indexOf(instance);
  2600. if (index !== -1) {
  2601. dropdowns.splice(instance, 1);
  2602. }
  2603. }
  2604. };
  2605. /***/ }),
  2606. /***/ 194:
  2607. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2608. "use strict";
  2609. var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('transition',{attrs:{"name":"el-zoom-in-top"}},[(_vm.multiple)?_c('div',{directives:[{name:"show",rawName:"v-show",value:(_vm.showPopper),expression:"showPopper"}],staticClass:"el-table-filter"},[_c('div',{staticClass:"el-table-filter__content"},[_c('el-checkbox-group',{staticClass:"el-table-filter__checkbox-group",model:{value:(_vm.filteredValue),callback:function ($$v) {_vm.filteredValue=$$v},expression:"filteredValue"}},_vm._l((_vm.filters),function(filter){return _c('el-checkbox',{key:filter.value,attrs:{"label":filter.value}},[_vm._v(_vm._s(filter.text))])}))],1),_c('div',{staticClass:"el-table-filter__bottom"},[_c('button',{class:{ 'is-disabled': _vm.filteredValue.length === 0 },attrs:{"disabled":_vm.filteredValue.length === 0},on:{"click":_vm.handleConfirm}},[_vm._v(_vm._s(_vm.t('el.table.confirmFilter')))]),_c('button',{on:{"click":_vm.handleReset}},[_vm._v(_vm._s(_vm.t('el.table.resetFilter')))])])]):_c('div',{directives:[{name:"show",rawName:"v-show",value:(_vm.showPopper),expression:"showPopper"}],staticClass:"el-table-filter"},[_c('ul',{staticClass:"el-table-filter__list"},[_c('li',{staticClass:"el-table-filter__list-item",class:{ 'is-active': _vm.filterValue === undefined || _vm.filterValue === null },on:{"click":function($event){_vm.handleSelect(null)}}},[_vm._v(_vm._s(_vm.t('el.table.clearFilter')))]),_vm._l((_vm.filters),function(filter){return _c('li',{key:filter.value,staticClass:"el-table-filter__list-item",class:{ 'is-active': _vm.isActive(filter) },attrs:{"label":filter.value},on:{"click":function($event){_vm.handleSelect(filter.value)}}},[_vm._v(_vm._s(filter.text))])})],2)])])}
  2610. var staticRenderFns = []
  2611. var esExports = { render: render, staticRenderFns: staticRenderFns }
  2612. /* harmony default export */ __webpack_exports__["a"] = (esExports);
  2613. /***/ }),
  2614. /***/ 195:
  2615. /***/ (function(module, exports, __webpack_require__) {
  2616. "use strict";
  2617. exports.__esModule = true;
  2618. exports.default = {
  2619. name: 'ElTableFooter',
  2620. render: function render(h) {
  2621. var _this = this;
  2622. var sums = [];
  2623. this.columns.forEach(function (column, index) {
  2624. if (index === 0) {
  2625. sums[index] = _this.sumText;
  2626. return;
  2627. }
  2628. var values = _this.store.states.data.map(function (item) {
  2629. return Number(item[column.property]);
  2630. });
  2631. var precisions = [];
  2632. var notNumber = true;
  2633. values.forEach(function (value) {
  2634. if (!isNaN(value)) {
  2635. notNumber = false;
  2636. var decimal = ('' + value).split('.')[1];
  2637. precisions.push(decimal ? decimal.length : 0);
  2638. }
  2639. });
  2640. var precision = Math.max.apply(null, precisions);
  2641. if (!notNumber) {
  2642. sums[index] = values.reduce(function (prev, curr) {
  2643. var value = Number(curr);
  2644. if (!isNaN(value)) {
  2645. return parseFloat((prev + curr).toFixed(Math.min(precision, 20)));
  2646. } else {
  2647. return prev;
  2648. }
  2649. }, 0);
  2650. } else {
  2651. sums[index] = '';
  2652. }
  2653. });
  2654. return h(
  2655. 'table',
  2656. {
  2657. 'class': 'el-table__footer',
  2658. attrs: { cellspacing: '0',
  2659. cellpadding: '0',
  2660. border: '0' }
  2661. },
  2662. [h(
  2663. 'colgroup',
  2664. null,
  2665. [this._l(this.columns, function (column) {
  2666. return h(
  2667. 'col',
  2668. {
  2669. attrs: {
  2670. name: column.id,
  2671. width: column.realWidth || column.width
  2672. }
  2673. },
  2674. []
  2675. );
  2676. }), !this.fixed && this.layout.gutterWidth ? h(
  2677. 'col',
  2678. {
  2679. attrs: { name: 'gutter', width: this.layout.scrollY ? this.layout.gutterWidth : '' }
  2680. },
  2681. []
  2682. ) : '']
  2683. ), h(
  2684. 'tbody',
  2685. { 'class': [{ 'has-gutter': this.hasGutter }] },
  2686. [h(
  2687. 'tr',
  2688. null,
  2689. [this._l(this.columns, function (column, cellIndex) {
  2690. return h(
  2691. 'td',
  2692. {
  2693. attrs: {
  2694. colspan: column.colSpan,
  2695. rowspan: column.rowSpan
  2696. },
  2697. 'class': [column.id, column.headerAlign, column.className || '', _this.isCellHidden(cellIndex, _this.columns) ? 'is-hidden' : '', !column.children ? 'is-leaf' : '', column.labelClassName] },
  2698. [h(
  2699. 'div',
  2700. { 'class': ['cell', column.labelClassName] },
  2701. [_this.summaryMethod ? _this.summaryMethod({ columns: _this.columns, data: _this.store.states.data })[cellIndex] : sums[cellIndex]]
  2702. )]
  2703. );
  2704. }), this.hasGutter ? h(
  2705. 'td',
  2706. { 'class': 'gutter', style: { width: this.layout.scrollY ? this.layout.gutterWidth + 'px' : '0' } },
  2707. []
  2708. ) : '']
  2709. )]
  2710. )]
  2711. );
  2712. },
  2713. props: {
  2714. fixed: String,
  2715. store: {
  2716. required: true
  2717. },
  2718. layout: {
  2719. required: true
  2720. },
  2721. summaryMethod: Function,
  2722. sumText: String,
  2723. border: Boolean,
  2724. defaultSort: {
  2725. type: Object,
  2726. default: function _default() {
  2727. return {
  2728. prop: '',
  2729. order: ''
  2730. };
  2731. }
  2732. }
  2733. },
  2734. computed: {
  2735. isAllSelected: function isAllSelected() {
  2736. return this.store.states.isAllSelected;
  2737. },
  2738. columnsCount: function columnsCount() {
  2739. return this.store.states.columns.length;
  2740. },
  2741. leftFixedCount: function leftFixedCount() {
  2742. return this.store.states.fixedColumns.length;
  2743. },
  2744. rightFixedCount: function rightFixedCount() {
  2745. return this.store.states.rightFixedColumns.length;
  2746. },
  2747. columns: function columns() {
  2748. return this.store.states.columns;
  2749. },
  2750. hasGutter: function hasGutter() {
  2751. return !this.fixed && this.layout.gutterWidth;
  2752. }
  2753. },
  2754. methods: {
  2755. isCellHidden: function isCellHidden(index, columns) {
  2756. if (this.fixed === true || this.fixed === 'left') {
  2757. return index >= this.leftFixedCount;
  2758. } else if (this.fixed === 'right') {
  2759. var before = 0;
  2760. for (var i = 0; i < index; i++) {
  2761. before += columns[i].colSpan;
  2762. }
  2763. return before < this.columnsCount - this.rightFixedCount;
  2764. } else {
  2765. return index < this.leftFixedCount || index >= this.columnsCount - this.rightFixedCount;
  2766. }
  2767. }
  2768. }
  2769. };
  2770. /***/ }),
  2771. /***/ 196:
  2772. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2773. "use strict";
  2774. var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"el-table",class:[{
  2775. 'el-table--fit': _vm.fit,
  2776. 'el-table--striped': _vm.stripe,
  2777. 'el-table--border': _vm.border || _vm.isGroup,
  2778. 'el-table--hidden': _vm.isHidden,
  2779. 'el-table--group': _vm.isGroup,
  2780. 'el-table--fluid-height': _vm.maxHeight,
  2781. 'el-table--enable-row-hover': !_vm.store.states.isComplex,
  2782. 'el-table--enable-row-transition': (_vm.store.states.data || []).length !== 0 && (_vm.store.states.data || []).length < 100
  2783. }, _vm.tableSize ? ("el-table--" + _vm.tableSize) : ''],on:{"mouseleave":function($event){_vm.handleMouseLeave($event)}}},[_c('div',{ref:"hiddenColumns",staticClass:"hidden-columns"},[_vm._t("default")],2),(_vm.showHeader)?_c('div',{ref:"headerWrapper",staticClass:"el-table__header-wrapper"},[_c('table-header',{ref:"tableHeader",style:({ width: _vm.layout.bodyWidth ? _vm.layout.bodyWidth + 'px' : '' }),attrs:{"store":_vm.store,"layout":_vm.layout,"border":_vm.border,"default-sort":_vm.defaultSort}})],1):_vm._e(),_c('div',{ref:"bodyWrapper",staticClass:"el-table__body-wrapper",class:[("is-scroll-" + _vm.scrollPosition)],style:([_vm.bodyHeight])},[_c('table-body',{style:({ width: _vm.bodyWidth }),attrs:{"context":_vm.context,"store":_vm.store,"stripe":_vm.stripe,"layout":_vm.layout,"row-class-name":_vm.rowClassName,"row-style":_vm.rowStyle,"highlight":_vm.highlightCurrentRow}}),(!_vm.data || _vm.data.length === 0)?_c('div',{staticClass:"el-table__empty-block",style:({ width: _vm.bodyWidth })},[_c('span',{staticClass:"el-table__empty-text"},[_vm._t("empty",[_vm._v(_vm._s(_vm.emptyText || _vm.t('el.table.emptyText')))])],2)]):_vm._e(),(_vm.$slots.append)?_c('div',{ref:"appendWrapper",staticClass:"el-table__append-wrapper"},[_vm._t("append")],2):_vm._e()],1),(_vm.showSummary)?_c('div',{directives:[{name:"show",rawName:"v-show",value:(_vm.data && _vm.data.length > 0),expression:"data && data.length > 0"}],ref:"footerWrapper",staticClass:"el-table__footer-wrapper"},[_c('table-footer',{style:({ width: _vm.layout.bodyWidth ? _vm.layout.bodyWidth + 'px' : '' }),attrs:{"store":_vm.store,"layout":_vm.layout,"border":_vm.border,"sum-text":_vm.sumText || _vm.t('el.table.sumText'),"summary-method":_vm.summaryMethod,"default-sort":_vm.defaultSort}})],1):_vm._e(),(_vm.fixedColumns.length > 0)?_c('div',{ref:"fixedWrapper",staticClass:"el-table__fixed",style:([
  2784. { width: _vm.layout.fixedWidth ? _vm.layout.fixedWidth + 'px' : '' },
  2785. _vm.fixedHeight
  2786. ])},[(_vm.showHeader)?_c('div',{ref:"fixedHeaderWrapper",staticClass:"el-table__fixed-header-wrapper"},[_c('table-header',{ref:"fixedTableHeader",style:({ width: _vm.layout.fixedWidth ? _vm.layout.fixedWidth + 'px' : '' }),attrs:{"fixed":"left","border":_vm.border,"store":_vm.store,"layout":_vm.layout}})],1):_vm._e(),_c('div',{ref:"fixedBodyWrapper",staticClass:"el-table__fixed-body-wrapper",style:([
  2787. { top: _vm.layout.headerHeight + 'px' },
  2788. _vm.fixedBodyHeight
  2789. ])},[_c('table-body',{style:({ width: _vm.layout.fixedWidth ? _vm.layout.fixedWidth + 'px' : '' }),attrs:{"fixed":"left","store":_vm.store,"stripe":_vm.stripe,"layout":_vm.layout,"highlight":_vm.highlightCurrentRow,"row-class-name":_vm.rowClassName,"row-style":_vm.rowStyle}}),(_vm.$slots.append)?_c('div',{staticClass:"el-table__append-gutter",style:({ height: _vm.layout.appendHeight + 'px' })}):_vm._e()],1),(_vm.showSummary)?_c('div',{directives:[{name:"show",rawName:"v-show",value:(_vm.data && _vm.data.length > 0),expression:"data && data.length > 0"}],ref:"fixedFooterWrapper",staticClass:"el-table__fixed-footer-wrapper"},[_c('table-footer',{style:({ width: _vm.layout.fixedWidth ? _vm.layout.fixedWidth + 'px' : '' }),attrs:{"fixed":"left","border":_vm.border,"sum-text":_vm.sumText || _vm.t('el.table.sumText'),"summary-method":_vm.summaryMethod,"store":_vm.store,"layout":_vm.layout}})],1):_vm._e()]):_vm._e(),(_vm.rightFixedColumns.length > 0)?_c('div',{ref:"rightFixedWrapper",staticClass:"el-table__fixed-right",style:([
  2790. { width: _vm.layout.rightFixedWidth ? _vm.layout.rightFixedWidth + 'px' : '' },
  2791. { right: _vm.layout.scrollY ? (_vm.border ? _vm.layout.gutterWidth : (_vm.layout.gutterWidth || 0)) + 'px' : '' },
  2792. _vm.fixedHeight
  2793. ])},[(_vm.showHeader)?_c('div',{ref:"rightFixedHeaderWrapper",staticClass:"el-table__fixed-header-wrapper"},[_c('table-header',{ref:"rightFixedTableHeader",style:({ width: _vm.layout.rightFixedWidth ? _vm.layout.rightFixedWidth + 'px' : '' }),attrs:{"fixed":"right","border":_vm.border,"store":_vm.store,"layout":_vm.layout}})],1):_vm._e(),_c('div',{ref:"rightFixedBodyWrapper",staticClass:"el-table__fixed-body-wrapper",style:([
  2794. { top: _vm.layout.headerHeight + 'px' },
  2795. _vm.fixedBodyHeight
  2796. ])},[_c('table-body',{style:({ width: _vm.layout.rightFixedWidth ? _vm.layout.rightFixedWidth + 'px' : '' }),attrs:{"fixed":"right","store":_vm.store,"stripe":_vm.stripe,"layout":_vm.layout,"row-class-name":_vm.rowClassName,"row-style":_vm.rowStyle,"highlight":_vm.highlightCurrentRow}})],1),(_vm.showSummary)?_c('div',{directives:[{name:"show",rawName:"v-show",value:(_vm.data && _vm.data.length > 0),expression:"data && data.length > 0"}],ref:"rightFixedFooterWrapper",staticClass:"el-table__fixed-footer-wrapper"},[_c('table-footer',{style:({ width: _vm.layout.rightFixedWidth ? _vm.layout.rightFixedWidth + 'px' : '' }),attrs:{"fixed":"right","border":_vm.border,"sum-text":_vm.sumText || _vm.t('el.table.sumText'),"summary-method":_vm.summaryMethod,"store":_vm.store,"layout":_vm.layout}})],1):_vm._e()]):_vm._e(),(_vm.rightFixedColumns.length > 0)?_c('div',{staticClass:"el-table__fixed-right-patch",style:({ width: _vm.layout.scrollY ? _vm.layout.gutterWidth + 'px' : '0', height: _vm.layout.headerHeight + 'px' })}):_vm._e(),_c('div',{directives:[{name:"show",rawName:"v-show",value:(_vm.resizeProxyVisible),expression:"resizeProxyVisible"}],ref:"resizeProxy",staticClass:"el-table__column-resize-proxy"})])}
  2797. var staticRenderFns = []
  2798. var esExports = { render: render, staticRenderFns: staticRenderFns }
  2799. /* harmony default export */ __webpack_exports__["a"] = (esExports);
  2800. /***/ }),
  2801. /***/ 2:
  2802. /***/ (function(module, exports) {
  2803. module.exports = require("element-ui/lib/utils/dom");
  2804. /***/ }),
  2805. /***/ 22:
  2806. /***/ (function(module, exports) {
  2807. module.exports = require("element-ui/lib/tooltip");
  2808. /***/ }),
  2809. /***/ 24:
  2810. /***/ (function(module, exports) {
  2811. module.exports = require("element-ui/lib/tag");
  2812. /***/ }),
  2813. /***/ 3:
  2814. /***/ (function(module, exports) {
  2815. module.exports = require("element-ui/lib/utils/util");
  2816. /***/ }),
  2817. /***/ 36:
  2818. /***/ (function(module, exports) {
  2819. module.exports = require("throttle-debounce/throttle");
  2820. /***/ }),
  2821. /***/ 37:
  2822. /***/ (function(module, exports, __webpack_require__) {
  2823. "use strict";
  2824. exports.__esModule = true;
  2825. exports.getRowIdentity = exports.mousewheel = exports.getColumnByCell = exports.getColumnById = exports.orderBy = exports.getCell = undefined;
  2826. 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; };
  2827. var _util = __webpack_require__(3);
  2828. var getCell = exports.getCell = function getCell(event) {
  2829. var cell = event.target;
  2830. while (cell && cell.tagName.toUpperCase() !== 'HTML') {
  2831. if (cell.tagName.toUpperCase() === 'TD') {
  2832. return cell;
  2833. }
  2834. cell = cell.parentNode;
  2835. }
  2836. return null;
  2837. };
  2838. var isObject = function isObject(obj) {
  2839. return obj !== null && (typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) === 'object';
  2840. };
  2841. var orderBy = exports.orderBy = function orderBy(array, sortKey, reverse, sortMethod, sortBy) {
  2842. if (!sortKey && !sortMethod && (!sortBy || Array.isArray(sortBy) && !sortBy.length)) {
  2843. return array;
  2844. }
  2845. if (typeof reverse === 'string') {
  2846. reverse = reverse === 'descending' ? -1 : 1;
  2847. } else {
  2848. reverse = reverse && reverse < 0 ? -1 : 1;
  2849. }
  2850. var getKey = sortMethod ? null : function (value, index) {
  2851. if (sortBy) {
  2852. if (!Array.isArray(sortBy)) {
  2853. sortBy = [sortBy];
  2854. }
  2855. return sortBy.map(function (by) {
  2856. if (typeof by === 'string') {
  2857. return (0, _util.getValueByPath)(value, by);
  2858. } else {
  2859. return by(value, index, array);
  2860. }
  2861. });
  2862. }
  2863. if (sortKey !== '$key') {
  2864. if (isObject(value) && '$value' in value) value = value.$value;
  2865. }
  2866. return [isObject(value) ? (0, _util.getValueByPath)(value, sortKey) : value];
  2867. };
  2868. var compare = function compare(a, b) {
  2869. if (sortMethod) {
  2870. return sortMethod(a.value, b.value);
  2871. }
  2872. for (var i = 0, len = a.key.length; i < len; i++) {
  2873. if (a.key[i] < b.key[i]) {
  2874. return -1;
  2875. }
  2876. if (a.key[i] > b.key[i]) {
  2877. return 1;
  2878. }
  2879. }
  2880. return 0;
  2881. };
  2882. return array.map(function (value, index) {
  2883. return {
  2884. value: value,
  2885. index: index,
  2886. key: getKey ? getKey(value, index) : null
  2887. };
  2888. }).sort(function (a, b) {
  2889. var order = compare(a, b);
  2890. if (!order) {
  2891. // make stable https://en.wikipedia.org/wiki/Sorting_algorithm#Stability
  2892. order = a.index - b.index;
  2893. }
  2894. return order * reverse;
  2895. }).map(function (item) {
  2896. return item.value;
  2897. });
  2898. };
  2899. var getColumnById = exports.getColumnById = function getColumnById(table, columnId) {
  2900. var column = null;
  2901. table.columns.forEach(function (item) {
  2902. if (item.id === columnId) {
  2903. column = item;
  2904. }
  2905. });
  2906. return column;
  2907. };
  2908. var getColumnByCell = exports.getColumnByCell = function getColumnByCell(table, cell) {
  2909. var matches = (cell.className || '').match(/el-table_[^\s]+/gm);
  2910. if (matches) {
  2911. return getColumnById(table, matches[0]);
  2912. }
  2913. return null;
  2914. };
  2915. var isFirefox = typeof navigator !== 'undefined' && navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
  2916. var mousewheel = exports.mousewheel = function mousewheel(element, callback) {
  2917. if (element && element.addEventListener) {
  2918. element.addEventListener(isFirefox ? 'DOMMouseScroll' : 'mousewheel', callback);
  2919. }
  2920. };
  2921. var getRowIdentity = exports.getRowIdentity = function getRowIdentity(row, rowKey) {
  2922. if (!row) throw new Error('row is required when get row identity');
  2923. if (typeof rowKey === 'string') {
  2924. if (rowKey.indexOf('.') < 0) {
  2925. return row[rowKey];
  2926. }
  2927. var key = rowKey.split('.');
  2928. var current = row;
  2929. for (var i = 0; i < key.length; i++) {
  2930. current = current[key[i]];
  2931. }
  2932. return current;
  2933. } else if (typeof rowKey === 'function') {
  2934. return rowKey.call(null, row);
  2935. }
  2936. };
  2937. /***/ }),
  2938. /***/ 38:
  2939. /***/ (function(module, exports) {
  2940. module.exports = require("element-ui/lib/utils/scrollbar-width");
  2941. /***/ }),
  2942. /***/ 39:
  2943. /***/ (function(module, exports) {
  2944. module.exports = require("element-ui/lib/checkbox-group");
  2945. /***/ }),
  2946. /***/ 4:
  2947. /***/ (function(module, exports) {
  2948. module.exports = require("element-ui/lib/mixins/locale");
  2949. /***/ }),
  2950. /***/ 5:
  2951. /***/ (function(module, exports) {
  2952. module.exports = require("vue");
  2953. /***/ }),
  2954. /***/ 7:
  2955. /***/ (function(module, exports) {
  2956. module.exports = require("element-ui/lib/mixins/migrating");
  2957. /***/ }),
  2958. /***/ 8:
  2959. /***/ (function(module, exports) {
  2960. module.exports = require("element-ui/lib/utils/vue-popper");
  2961. /***/ }),
  2962. /***/ 9:
  2963. /***/ (function(module, exports) {
  2964. module.exports = require("element-ui/lib/utils/merge");
  2965. /***/ })
  2966. /******/ });