1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499 |
- module.exports =
- /******/ (function(modules) { // webpackBootstrap
- /******/ // The module cache
- /******/ var installedModules = {};
- /******/
- /******/ // The require function
- /******/ function __webpack_require__(moduleId) {
- /******/
- /******/ // Check if module is in cache
- /******/ if(installedModules[moduleId]) {
- /******/ return installedModules[moduleId].exports;
- /******/ }
- /******/ // Create a new module (and put it into the cache)
- /******/ var module = installedModules[moduleId] = {
- /******/ i: moduleId,
- /******/ l: false,
- /******/ exports: {}
- /******/ };
- /******/
- /******/ // Execute the module function
- /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
- /******/
- /******/ // Flag the module as loaded
- /******/ module.l = true;
- /******/
- /******/ // Return the exports of the module
- /******/ return module.exports;
- /******/ }
- /******/
- /******/
- /******/ // expose the modules object (__webpack_modules__)
- /******/ __webpack_require__.m = modules;
- /******/
- /******/ // expose the module cache
- /******/ __webpack_require__.c = installedModules;
- /******/
- /******/ // define getter function for harmony exports
- /******/ __webpack_require__.d = function(exports, name, getter) {
- /******/ if(!__webpack_require__.o(exports, name)) {
- /******/ Object.defineProperty(exports, name, {
- /******/ configurable: false,
- /******/ enumerable: true,
- /******/ get: getter
- /******/ });
- /******/ }
- /******/ };
- /******/
- /******/ // getDefaultExport function for compatibility with non-harmony modules
- /******/ __webpack_require__.n = function(module) {
- /******/ var getter = module && module.__esModule ?
- /******/ function getDefault() { return module['default']; } :
- /******/ function getModuleExports() { return module; };
- /******/ __webpack_require__.d(getter, 'a', getter);
- /******/ return getter;
- /******/ };
- /******/
- /******/ // Object.prototype.hasOwnProperty.call
- /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
- /******/
- /******/ // __webpack_public_path__
- /******/ __webpack_require__.p = "/dist/";
- /******/
- /******/ // Load entry module and return exports
- /******/ return __webpack_require__(__webpack_require__.s = 183);
- /******/ })
- /************************************************************************/
- /******/ ({
- /***/ 0:
- /***/ (function(module, exports) {
- /* globals __VUE_SSR_CONTEXT__ */
- // IMPORTANT: Do NOT use ES2015 features in this file.
- // This module is a runtime utility for cleaner component module output and will
- // be included in the final webpack user bundle.
- module.exports = function normalizeComponent (
- rawScriptExports,
- compiledTemplate,
- functionalTemplate,
- injectStyles,
- scopeId,
- moduleIdentifier /* server only */
- ) {
- var esModule
- var scriptExports = rawScriptExports = rawScriptExports || {}
- // ES6 modules interop
- var type = typeof rawScriptExports.default
- if (type === 'object' || type === 'function') {
- esModule = rawScriptExports
- scriptExports = rawScriptExports.default
- }
- // Vue.extend constructor export interop
- var options = typeof scriptExports === 'function'
- ? scriptExports.options
- : scriptExports
- // render functions
- if (compiledTemplate) {
- options.render = compiledTemplate.render
- options.staticRenderFns = compiledTemplate.staticRenderFns
- options._compiled = true
- }
- // functional template
- if (functionalTemplate) {
- options.functional = true
- }
- // scopedId
- if (scopeId) {
- options._scopeId = scopeId
- }
- var hook
- if (moduleIdentifier) { // server build
- hook = function (context) {
- // 2.3 injection
- context =
- context || // cached call
- (this.$vnode && this.$vnode.ssrContext) || // stateful
- (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
- // 2.2 with runInNewContext: true
- if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
- context = __VUE_SSR_CONTEXT__
- }
- // inject component styles
- if (injectStyles) {
- injectStyles.call(this, context)
- }
- // register component module identifier for async chunk inferrence
- if (context && context._registeredComponents) {
- context._registeredComponents.add(moduleIdentifier)
- }
- }
- // used by ssr in case component is cached and beforeCreate
- // never gets called
- options._ssrRegister = hook
- } else if (injectStyles) {
- hook = injectStyles
- }
- if (hook) {
- var functional = options.functional
- var existing = functional
- ? options.render
- : options.beforeCreate
- if (!functional) {
- // inject component registration as beforeCreate hook
- options.beforeCreate = existing
- ? [].concat(existing, hook)
- : [hook]
- } else {
- // for template-only hot-reload because in that case the render fn doesn't
- // go through the normalizer
- options._injectStyles = hook
- // register for functioal component in vue file
- options.render = function renderWithStyleInjection (h, context) {
- hook.call(context)
- return existing(h, context)
- }
- }
- }
- return {
- esModule: esModule,
- exports: scriptExports,
- options: options
- }
- }
- /***/ }),
- /***/ 10:
- /***/ (function(module, exports) {
- module.exports = require("element-ui/lib/utils/clickoutside");
- /***/ }),
- /***/ 12:
- /***/ (function(module, exports) {
- module.exports = require("throttle-debounce/debounce");
- /***/ }),
- /***/ 16:
- /***/ (function(module, exports) {
- module.exports = require("element-ui/lib/checkbox");
- /***/ }),
- /***/ 17:
- /***/ (function(module, exports) {
- module.exports = require("element-ui/lib/utils/popup");
- /***/ }),
- /***/ 183:
- /***/ (function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(184);
- /***/ }),
- /***/ 184:
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- exports.__esModule = true;
- var _table = __webpack_require__(185);
- var _table2 = _interopRequireDefault(_table);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- /* istanbul ignore next */
- _table2.default.install = function (Vue) {
- Vue.component(_table2.default.name, _table2.default);
- };
- exports.default = _table2.default;
- /***/ }),
- /***/ 185:
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_table_vue__ = __webpack_require__(186);
- /* 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__);
- /* 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);
- var normalizeComponent = __webpack_require__(0)
- /* script */
- /* template */
- /* template functional */
- var __vue_template_functional__ = false
- /* styles */
- var __vue_styles__ = null
- /* scopeId */
- var __vue_scopeId__ = null
- /* moduleIdentifier (server only) */
- var __vue_module_identifier__ = null
- var Component = normalizeComponent(
- __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_table_vue___default.a,
- __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 */],
- __vue_template_functional__,
- __vue_styles__,
- __vue_scopeId__,
- __vue_module_identifier__
- )
- /* harmony default export */ __webpack_exports__["default"] = (Component.exports);
- /***/ }),
- /***/ 186:
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- exports.__esModule = true;
- var _checkbox = __webpack_require__(16);
- var _checkbox2 = _interopRequireDefault(_checkbox);
- var _throttle = __webpack_require__(36);
- var _throttle2 = _interopRequireDefault(_throttle);
- var _debounce = __webpack_require__(12);
- var _debounce2 = _interopRequireDefault(_debounce);
- var _resizeEvent = __webpack_require__(19);
- var _locale = __webpack_require__(4);
- var _locale2 = _interopRequireDefault(_locale);
- var _migrating = __webpack_require__(7);
- var _migrating2 = _interopRequireDefault(_migrating);
- var _tableStore = __webpack_require__(187);
- var _tableStore2 = _interopRequireDefault(_tableStore);
- var _tableLayout = __webpack_require__(188);
- var _tableLayout2 = _interopRequireDefault(_tableLayout);
- var _tableBody = __webpack_require__(189);
- var _tableBody2 = _interopRequireDefault(_tableBody);
- var _tableHeader = __webpack_require__(190);
- var _tableHeader2 = _interopRequireDefault(_tableHeader);
- var _tableFooter = __webpack_require__(195);
- var _tableFooter2 = _interopRequireDefault(_tableFooter);
- var _util = __webpack_require__(37);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- var tableIdSeed = 1;
- exports.default = {
- name: 'ElTable',
- mixins: [_locale2.default, _migrating2.default],
- props: {
- data: {
- type: Array,
- default: function _default() {
- return [];
- }
- },
- size: String,
- width: [String, Number],
- height: [String, Number],
- maxHeight: [String, Number],
- fit: {
- type: Boolean,
- default: true
- },
- stripe: Boolean,
- border: Boolean,
- rowKey: [String, Function],
- context: {},
- showHeader: {
- type: Boolean,
- default: true
- },
- showSummary: Boolean,
- sumText: String,
- summaryMethod: Function,
- rowClassName: [String, Function],
- rowStyle: [Object, Function],
- cellClassName: [String, Function],
- cellStyle: [Object, Function],
- headerRowClassName: [String, Function],
- headerRowStyle: [Object, Function],
- headerCellClassName: [String, Function],
- headerCellStyle: [Object, Function],
- highlightCurrentRow: Boolean,
- currentRowKey: [String, Number],
- emptyText: String,
- expandRowKeys: Array,
- defaultExpandAll: Boolean,
- defaultSort: Object,
- tooltipEffect: String,
- spanMethod: Function
- },
- components: {
- TableHeader: _tableHeader2.default,
- TableFooter: _tableFooter2.default,
- TableBody: _tableBody2.default,
- ElCheckbox: _checkbox2.default
- },
- methods: {
- getMigratingConfig: function getMigratingConfig() {
- return {
- events: {
- expand: 'expand is renamed to expand-change'
- }
- };
- },
- setCurrentRow: function setCurrentRow(row) {
- this.store.commit('setCurrentRow', row);
- },
- toggleRowSelection: function toggleRowSelection(row, selected) {
- this.store.toggleRowSelection(row, selected);
- this.store.updateAllSelected();
- },
- toggleRowExpansion: function toggleRowExpansion(row, expanded) {
- this.store.toggleRowExpansion(row, expanded);
- },
- clearSelection: function clearSelection() {
- this.store.clearSelection();
- },
- clearFilter: function clearFilter() {
- this.store.clearFilter();
- },
- clearSort: function clearSort() {
- this.store.clearSort();
- },
- handleMouseLeave: function handleMouseLeave() {
- this.store.commit('setHoverRow', null);
- if (this.hoverState) this.hoverState = null;
- },
- updateScrollY: function updateScrollY() {
- this.layout.updateScrollY();
- },
- bindEvents: function bindEvents() {
- var _this = this;
- var _$refs = this.$refs,
- headerWrapper = _$refs.headerWrapper,
- footerWrapper = _$refs.footerWrapper;
- var refs = this.$refs;
- var self = this;
- this.bodyWrapper.addEventListener('scroll', function () {
- if (headerWrapper) headerWrapper.scrollLeft = this.scrollLeft;
- if (footerWrapper) footerWrapper.scrollLeft = this.scrollLeft;
- if (refs.fixedBodyWrapper) refs.fixedBodyWrapper.scrollTop = this.scrollTop;
- if (refs.rightFixedBodyWrapper) refs.rightFixedBodyWrapper.scrollTop = this.scrollTop;
- var maxScrollLeftPosition = this.scrollWidth - this.offsetWidth - 1;
- var scrollLeft = this.scrollLeft;
- if (scrollLeft >= maxScrollLeftPosition) {
- self.scrollPosition = 'right';
- } else if (scrollLeft === 0) {
- self.scrollPosition = 'left';
- } else {
- self.scrollPosition = 'middle';
- }
- });
- var scrollBodyWrapper = function scrollBodyWrapper(event) {
- var deltaX = event.deltaX,
- deltaY = event.deltaY;
- if (Math.abs(deltaX) < Math.abs(deltaY)) return;
- if (deltaX > 0) {
- _this.bodyWrapper.scrollLeft += 10;
- } else if (deltaX < 0) {
- _this.bodyWrapper.scrollLeft -= 10;
- }
- };
- if (headerWrapper) {
- (0, _util.mousewheel)(headerWrapper, (0, _throttle2.default)(16, scrollBodyWrapper));
- }
- if (footerWrapper) {
- (0, _util.mousewheel)(footerWrapper, (0, _throttle2.default)(16, scrollBodyWrapper));
- }
- if (this.fit) {
- this.windowResizeListener = (0, _throttle2.default)(50, function () {
- if (_this.$ready) _this.doLayout();
- });
- (0, _resizeEvent.addResizeListener)(this.$el, this.windowResizeListener);
- }
- },
- doLayout: function doLayout() {
- var _this2 = this;
- this.store.updateColumns();
- this.updateScrollY();
- this.layout.update();
- this.$nextTick(function () {
- if (_this2.height) {
- _this2.layout.setHeight(_this2.height);
- } else if (_this2.maxHeight) {
- _this2.layout.setMaxHeight(_this2.maxHeight);
- } else if (_this2.shouldUpdateHeight) {
- _this2.layout.updateHeight();
- }
- });
- }
- },
- created: function created() {
- var _this3 = this;
- this.tableId = 'el-table_' + tableIdSeed + '_';
- this.debouncedLayout = (0, _debounce2.default)(50, function () {
- return _this3.doLayout();
- });
- },
- computed: {
- tableSize: function tableSize() {
- return this.size || (this.$ELEMENT || {}).size;
- },
- bodyWrapper: function bodyWrapper() {
- return this.$refs.bodyWrapper;
- },
- shouldUpdateHeight: function shouldUpdateHeight() {
- return typeof this.height === 'number' || this.fixedColumns.length > 0 || this.rightFixedColumns.length > 0;
- },
- selection: function selection() {
- return this.store.states.selection;
- },
- columns: function columns() {
- return this.store.states.columns;
- },
- tableData: function tableData() {
- return this.store.states.data;
- },
- fixedColumns: function fixedColumns() {
- return this.store.states.fixedColumns;
- },
- rightFixedColumns: function rightFixedColumns() {
- return this.store.states.rightFixedColumns;
- },
- bodyHeight: function bodyHeight() {
- var style = {};
- if (this.height) {
- style = {
- height: this.layout.bodyHeight ? this.layout.bodyHeight + 'px' : ''
- };
- } else if (this.maxHeight) {
- style = {
- 'max-height': (this.showHeader ? this.maxHeight - this.layout.headerHeight - this.layout.footerHeight : this.maxHeight - this.layout.footerHeight) + 'px'
- };
- }
- return style;
- },
- bodyWidth: function bodyWidth() {
- var _layout = this.layout,
- bodyWidth = _layout.bodyWidth,
- scrollY = _layout.scrollY,
- gutterWidth = _layout.gutterWidth;
- return bodyWidth ? bodyWidth - (scrollY ? gutterWidth : 0) + 'px' : '';
- },
- fixedBodyHeight: function fixedBodyHeight() {
- var style = {};
- if (this.height) {
- style = {
- height: this.layout.fixedBodyHeight ? this.layout.fixedBodyHeight + 'px' : ''
- };
- } else if (this.maxHeight) {
- var maxHeight = this.layout.scrollX ? this.maxHeight - this.layout.gutterWidth : this.maxHeight;
- if (this.showHeader) {
- maxHeight -= this.layout.headerHeight;
- }
- style = {
- 'max-height': maxHeight + 'px'
- };
- }
- return style;
- },
- fixedHeight: function fixedHeight() {
- var style = {};
- if (this.maxHeight) {
- style = {
- bottom: this.layout.scrollX && this.data.length ? this.layout.gutterWidth + 'px' : ''
- };
- } else {
- style = {
- height: this.layout.viewportHeight ? this.layout.viewportHeight + 'px' : ''
- };
- }
- return style;
- }
- },
- watch: {
- height: function height(value) {
- this.layout.setHeight(value);
- },
- maxHeight: function maxHeight(value) {
- this.layout.setMaxHeight(value);
- },
- currentRowKey: function currentRowKey(newVal) {
- this.store.setCurrentRowKey(newVal);
- },
- data: {
- immediate: true,
- handler: function handler(val) {
- var _this4 = this;
- this.store.commit('setData', val);
- if (this.$ready) {
- this.$nextTick(function () {
- _this4.doLayout();
- });
- }
- }
- },
- expandRowKeys: {
- immediate: true,
- handler: function handler(newVal) {
- if (newVal) {
- this.store.setExpandRowKeys(newVal);
- }
- }
- }
- },
- destroyed: function destroyed() {
- if (this.windowResizeListener) (0, _resizeEvent.removeResizeListener)(this.$el, this.windowResizeListener);
- },
- mounted: function mounted() {
- var _this5 = this;
- this.bindEvents();
- this.doLayout();
- // init filters
- this.store.states.columns.forEach(function (column) {
- if (column.filteredValue && column.filteredValue.length) {
- _this5.store.commit('filterChange', {
- column: column,
- values: column.filteredValue,
- silent: true
- });
- }
- });
- this.$ready = true;
- },
- data: function data() {
- var store = new _tableStore2.default(this, {
- rowKey: this.rowKey,
- defaultExpandAll: this.defaultExpandAll
- });
- var layout = new _tableLayout2.default({
- store: store,
- table: this,
- fit: this.fit,
- showHeader: this.showHeader
- });
- return {
- store: store,
- layout: layout,
- isHidden: false,
- renderExpanded: null,
- resizeProxyVisible: false,
- // 是否拥有多级表头
- isGroup: false,
- scrollPosition: 'left'
- };
- }
- };
- /***/ }),
- /***/ 187:
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- exports.__esModule = true;
- var _vue = __webpack_require__(5);
- var _vue2 = _interopRequireDefault(_vue);
- var _debounce = __webpack_require__(12);
- var _debounce2 = _interopRequireDefault(_debounce);
- var _merge = __webpack_require__(9);
- var _merge2 = _interopRequireDefault(_merge);
- var _util = __webpack_require__(37);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- var sortData = function sortData(data, states) {
- var sortingColumn = states.sortingColumn;
- if (!sortingColumn || typeof sortingColumn.sortable === 'string') {
- return data;
- }
- return (0, _util.orderBy)(data, states.sortProp, states.sortOrder, sortingColumn.sortMethod, sortingColumn.sortBy);
- };
- var getKeysMap = function getKeysMap(array, rowKey) {
- var arrayMap = {};
- (array || []).forEach(function (row, index) {
- arrayMap[(0, _util.getRowIdentity)(row, rowKey)] = { row: row, index: index };
- });
- return arrayMap;
- };
- var toggleRowSelection = function toggleRowSelection(states, row, selected) {
- var changed = false;
- var selection = states.selection;
- var index = selection.indexOf(row);
- if (typeof selected === 'undefined') {
- if (index === -1) {
- selection.push(row);
- changed = true;
- } else {
- selection.splice(index, 1);
- changed = true;
- }
- } else {
- if (selected && index === -1) {
- selection.push(row);
- changed = true;
- } else if (!selected && index > -1) {
- selection.splice(index, 1);
- changed = true;
- }
- }
- return changed;
- };
- var toggleRowExpansion = function toggleRowExpansion(states, row, expanded) {
- var changed = false;
- var expandRows = states.expandRows;
- if (typeof expanded !== 'undefined') {
- var index = expandRows.indexOf(row);
- if (expanded) {
- if (index === -1) {
- expandRows.push(row);
- changed = true;
- }
- } else {
- if (index !== -1) {
- expandRows.splice(index, 1);
- changed = true;
- }
- }
- } else {
- var _index = expandRows.indexOf(row);
- if (_index === -1) {
- expandRows.push(row);
- changed = true;
- } else {
- expandRows.splice(_index, 1);
- changed = true;
- }
- }
- return changed;
- };
- var TableStore = function TableStore(table) {
- var initialState = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- if (!table) {
- throw new Error('Table is required.');
- }
- this.table = table;
- this.states = {
- rowKey: null,
- _columns: [],
- originColumns: [],
- columns: [],
- fixedColumns: [],
- rightFixedColumns: [],
- leafColumns: [],
- fixedLeafColumns: [],
- rightFixedLeafColumns: [],
- isComplex: false,
- _data: null,
- filteredData: null,
- data: null,
- sortingColumn: null,
- sortProp: null,
- sortOrder: null,
- isAllSelected: false,
- selection: [],
- reserveSelection: false,
- selectable: null,
- currentRow: null,
- hoverRow: null,
- filters: {},
- expandRows: [],
- defaultExpandAll: false
- };
- for (var prop in initialState) {
- if (initialState.hasOwnProperty(prop) && this.states.hasOwnProperty(prop)) {
- this.states[prop] = initialState[prop];
- }
- }
- };
- TableStore.prototype.mutations = {
- setData: function setData(states, data) {
- var _this = this;
- var dataInstanceChanged = states._data !== data;
- states._data = data;
- Object.keys(states.filters).forEach(function (columnId) {
- var values = states.filters[columnId];
- if (!values || values.length === 0) return;
- var column = (0, _util.getColumnById)(_this.states, columnId);
- if (column && column.filterMethod) {
- data = data.filter(function (row) {
- return values.some(function (value) {
- return column.filterMethod.call(null, value, row);
- });
- });
- }
- });
- states.filteredData = data;
- states.data = sortData(data || [], states);
- // states.data.forEach((item) => {
- // if (!item.$extra) {
- // Object.defineProperty(item, '$extra', {
- // value: {},
- // enumerable: false
- // });
- // }
- // });
- this.updateCurrentRow();
- if (!states.reserveSelection) {
- if (dataInstanceChanged) {
- this.clearSelection();
- } else {
- this.cleanSelection();
- }
- this.updateAllSelected();
- } else {
- (function () {
- var rowKey = states.rowKey;
- if (rowKey) {
- (function () {
- var selection = states.selection;
- var selectedMap = getKeysMap(selection, rowKey);
- states.data.forEach(function (row) {
- var rowId = (0, _util.getRowIdentity)(row, rowKey);
- var rowInfo = selectedMap[rowId];
- if (rowInfo) {
- selection[rowInfo.index] = row;
- }
- });
- _this.updateAllSelected();
- })();
- } else {
- console.warn('WARN: rowKey is required when reserve-selection is enabled.');
- }
- })();
- }
- var defaultExpandAll = states.defaultExpandAll;
- if (defaultExpandAll) {
- this.states.expandRows = (states.data || []).slice(0);
- }
- _vue2.default.nextTick(function () {
- return _this.table.updateScrollY();
- });
- },
- changeSortCondition: function changeSortCondition(states, options) {
- var _this2 = this;
- states.data = sortData(states.filteredData || states._data || [], states);
- if (!options || !options.silent) {
- this.table.$emit('sort-change', {
- column: this.states.sortingColumn,
- prop: this.states.sortProp,
- order: this.states.sortOrder
- });
- }
- _vue2.default.nextTick(function () {
- return _this2.table.updateScrollY();
- });
- },
- filterChange: function filterChange(states, options) {
- var _this3 = this;
- var column = options.column,
- values = options.values,
- silent = options.silent;
- if (values && !Array.isArray(values)) {
- values = [values];
- }
- var prop = column.property;
- var filters = {};
- if (prop) {
- states.filters[column.id] = values;
- filters[column.columnKey || column.id] = values;
- }
- var data = states._data;
- Object.keys(states.filters).forEach(function (columnId) {
- var values = states.filters[columnId];
- if (!values || values.length === 0) return;
- var column = (0, _util.getColumnById)(_this3.states, columnId);
- if (column && column.filterMethod) {
- data = data.filter(function (row) {
- return values.some(function (value) {
- return column.filterMethod.call(null, value, row);
- });
- });
- }
- });
- states.filteredData = data;
- states.data = sortData(data, states);
- if (!silent) {
- this.table.$emit('filter-change', filters);
- }
- _vue2.default.nextTick(function () {
- return _this3.table.updateScrollY();
- });
- },
- insertColumn: function insertColumn(states, column, index, parent) {
- var array = states._columns;
- if (parent) {
- array = parent.children;
- if (!array) array = parent.children = [];
- }
- if (typeof index !== 'undefined') {
- array.splice(index, 0, column);
- } else {
- array.push(column);
- }
- if (column.type === 'selection') {
- states.selectable = column.selectable;
- states.reserveSelection = column.reserveSelection;
- }
- this.updateColumns(); // hack for dynamics insert column
- this.scheduleLayout();
- },
- removeColumn: function removeColumn(states, column) {
- var _columns = states._columns;
- if (_columns) {
- _columns.splice(_columns.indexOf(column), 1);
- }
- this.updateColumns(); // hack for dynamics remove column
- this.scheduleLayout();
- },
- setHoverRow: function setHoverRow(states, row) {
- states.hoverRow = row;
- },
- setCurrentRow: function setCurrentRow(states, row) {
- var oldCurrentRow = states.currentRow;
- states.currentRow = row;
- if (oldCurrentRow !== row) {
- this.table.$emit('current-change', row, oldCurrentRow);
- }
- },
- rowSelectedChanged: function rowSelectedChanged(states, row) {
- var changed = toggleRowSelection(states, row);
- var selection = states.selection;
- if (changed) {
- var table = this.table;
- table.$emit('selection-change', selection);
- table.$emit('select', selection, row);
- }
- this.updateAllSelected();
- },
- toggleAllSelection: (0, _debounce2.default)(10, function (states) {
- var data = states.data || [];
- var value = !states.isAllSelected;
- var selection = this.states.selection;
- var selectionChanged = false;
- data.forEach(function (item, index) {
- if (states.selectable) {
- if (states.selectable.call(null, item, index) && toggleRowSelection(states, item, value)) {
- selectionChanged = true;
- }
- } else {
- if (toggleRowSelection(states, item, value)) {
- selectionChanged = true;
- }
- }
- });
- var table = this.table;
- if (selectionChanged) {
- table.$emit('selection-change', selection);
- }
- table.$emit('select-all', selection);
- states.isAllSelected = value;
- })
- };
- var doFlattenColumns = function doFlattenColumns(columns) {
- var result = [];
- columns.forEach(function (column) {
- if (column.children) {
- result.push.apply(result, doFlattenColumns(column.children));
- } else {
- result.push(column);
- }
- });
- return result;
- };
- TableStore.prototype.updateColumns = function () {
- var states = this.states;
- var _columns = states._columns || [];
- states.fixedColumns = _columns.filter(function (column) {
- return column.fixed === true || column.fixed === 'left';
- });
- states.rightFixedColumns = _columns.filter(function (column) {
- return column.fixed === 'right';
- });
- if (states.fixedColumns.length > 0 && _columns[0] && _columns[0].type === 'selection' && !_columns[0].fixed) {
- _columns[0].fixed = true;
- states.fixedColumns.unshift(_columns[0]);
- }
- var notFixedColumns = _columns.filter(function (column) {
- return !column.fixed;
- });
- states.originColumns = [].concat(states.fixedColumns).concat(notFixedColumns).concat(states.rightFixedColumns);
- var leafColumns = doFlattenColumns(notFixedColumns);
- var fixedLeafColumns = doFlattenColumns(states.fixedColumns);
- var rightFixedLeafColumns = doFlattenColumns(states.rightFixedColumns);
- states.leafColumnsLength = leafColumns.length;
- states.fixedLeafColumnsLength = fixedLeafColumns.length;
- states.rightFixedLeafColumnsLength = rightFixedLeafColumns.length;
- states.columns = [].concat(fixedLeafColumns).concat(leafColumns).concat(rightFixedLeafColumns);
- states.isComplex = states.fixedColumns.length > 0 || states.rightFixedColumns.length > 0;
- };
- TableStore.prototype.isSelected = function (row) {
- return (this.states.selection || []).indexOf(row) > -1;
- };
- TableStore.prototype.clearSelection = function () {
- var states = this.states;
- states.isAllSelected = false;
- var oldSelection = states.selection;
- states.selection = [];
- if (oldSelection.length > 0) {
- this.table.$emit('selection-change', states.selection);
- }
- };
- TableStore.prototype.setExpandRowKeys = function (rowKeys) {
- var expandRows = [];
- var data = this.states.data;
- var rowKey = this.states.rowKey;
- if (!rowKey) throw new Error('[Table] prop row-key should not be empty.');
- var keysMap = getKeysMap(data, rowKey);
- rowKeys.forEach(function (key) {
- var info = keysMap[key];
- if (info) {
- expandRows.push(info.row);
- }
- });
- this.states.expandRows = expandRows;
- };
- TableStore.prototype.toggleRowSelection = function (row, selected) {
- var changed = toggleRowSelection(this.states, row, selected);
- if (changed) {
- this.table.$emit('selection-change', this.states.selection);
- }
- };
- TableStore.prototype.toggleRowExpansion = function (row, expanded) {
- var changed = toggleRowExpansion(this.states, row, expanded);
- if (changed) {
- this.table.$emit('expand-change', row, this.states.expandRows);
- }
- };
- TableStore.prototype.cleanSelection = function () {
- var selection = this.states.selection || [];
- var data = this.states.data;
- var rowKey = this.states.rowKey;
- var deleted = void 0;
- if (rowKey) {
- deleted = [];
- var selectedMap = getKeysMap(selection, rowKey);
- var dataMap = getKeysMap(data, rowKey);
- for (var key in selectedMap) {
- if (selectedMap.hasOwnProperty(key) && !dataMap[key]) {
- deleted.push(selectedMap[key].row);
- }
- }
- } else {
- deleted = selection.filter(function (item) {
- return data.indexOf(item) === -1;
- });
- }
- deleted.forEach(function (deletedItem) {
- selection.splice(selection.indexOf(deletedItem), 1);
- });
- if (deleted.length) {
- this.table.$emit('selection-change', selection);
- }
- };
- TableStore.prototype.clearFilter = function () {
- var states = this.states;
- var _table$$refs = this.table.$refs,
- tableHeader = _table$$refs.tableHeader,
- fixedTableHeader = _table$$refs.fixedTableHeader,
- rightFixedTableHeader = _table$$refs.rightFixedTableHeader;
- var panels = {};
- if (tableHeader) panels = (0, _merge2.default)(panels, tableHeader.filterPanels);
- if (fixedTableHeader) panels = (0, _merge2.default)(panels, fixedTableHeader.filterPanels);
- if (rightFixedTableHeader) panels = (0, _merge2.default)(panels, rightFixedTableHeader.filterPanels);
- var keys = Object.keys(panels);
- if (!keys.length) return;
- keys.forEach(function (key) {
- panels[key].filteredValue = [];
- });
- states.filters = {};
- this.commit('filterChange', {
- column: {},
- values: [],
- silent: true
- });
- };
- TableStore.prototype.clearSort = function () {
- var states = this.states;
- if (!states.sortingColumn) return;
- states.sortingColumn.order = null;
- states.sortProp = null;
- states.sortOrder = null;
- this.commit('changeSortCondition', {
- silent: true
- });
- };
- TableStore.prototype.updateAllSelected = function () {
- var states = this.states;
- var selection = states.selection,
- rowKey = states.rowKey,
- selectable = states.selectable,
- data = states.data;
- if (!data || data.length === 0) {
- states.isAllSelected = false;
- return;
- }
- var selectedMap = void 0;
- if (rowKey) {
- selectedMap = getKeysMap(states.selection, rowKey);
- }
- var isSelected = function isSelected(row) {
- if (selectedMap) {
- return !!selectedMap[(0, _util.getRowIdentity)(row, rowKey)];
- } else {
- return selection.indexOf(row) !== -1;
- }
- };
- var isAllSelected = true;
- var selectedCount = 0;
- for (var i = 0, j = data.length; i < j; i++) {
- var item = data[i];
- if (selectable) {
- var isRowSelectable = selectable.call(null, item, i);
- if (isRowSelectable) {
- if (!isSelected(item)) {
- isAllSelected = false;
- break;
- } else {
- selectedCount++;
- }
- }
- } else {
- if (!isSelected(item)) {
- isAllSelected = false;
- break;
- } else {
- selectedCount++;
- }
- }
- }
- if (selectedCount === 0) isAllSelected = false;
- states.isAllSelected = isAllSelected;
- };
- TableStore.prototype.scheduleLayout = function () {
- this.table.debouncedLayout();
- };
- TableStore.prototype.setCurrentRowKey = function (key) {
- var states = this.states;
- var rowKey = states.rowKey;
- if (!rowKey) throw new Error('[Table] row-key should not be empty.');
- var data = states.data || [];
- var keysMap = getKeysMap(data, rowKey);
- var info = keysMap[key];
- if (info) {
- states.currentRow = info.row;
- }
- };
- TableStore.prototype.updateCurrentRow = function () {
- var states = this.states;
- var table = this.table;
- var data = states.data || [];
- var oldCurrentRow = states.currentRow;
- if (data.indexOf(oldCurrentRow) === -1) {
- states.currentRow = null;
- if (states.currentRow !== oldCurrentRow) {
- table.$emit('current-change', null, oldCurrentRow);
- }
- }
- };
- TableStore.prototype.commit = function (name) {
- var mutations = this.mutations;
- if (mutations[name]) {
- for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
- args[_key - 1] = arguments[_key];
- }
- mutations[name].apply(this, [this.states].concat(args));
- } else {
- throw new Error('Action not found: ' + name);
- }
- };
- exports.default = TableStore;
- /***/ }),
- /***/ 188:
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- exports.__esModule = true;
- var _scrollbarWidth = __webpack_require__(38);
- var _scrollbarWidth2 = _interopRequireDefault(_scrollbarWidth);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- var TableLayout = function () {
- function TableLayout(options) {
- _classCallCheck(this, TableLayout);
- this.table = null;
- this.store = null;
- this.columns = null;
- this.fit = true;
- this.showHeader = true;
- this.height = null;
- this.scrollX = false;
- this.scrollY = false;
- this.bodyWidth = null;
- this.fixedWidth = null;
- this.rightFixedWidth = null;
- this.tableHeight = null;
- this.headerHeight = 44; // Table Header Height
- this.appendHeight = 0; // Append Slot Height
- this.footerHeight = 44; // Table Footer Height
- this.viewportHeight = null; // Table Height - Scroll Bar Height
- this.bodyHeight = null; // Table Height - Table Header Height
- this.fixedBodyHeight = null; // Table Height - Table Header Height - Scroll Bar Height
- this.gutterWidth = (0, _scrollbarWidth2.default)();
- for (var name in options) {
- if (options.hasOwnProperty(name)) {
- this[name] = options[name];
- }
- }
- if (!this.table) {
- throw new Error('table is required for Table Layout');
- }
- if (!this.store) {
- throw new Error('store is required for Table Layout');
- }
- }
- TableLayout.prototype.updateScrollY = function updateScrollY() {
- var height = this.height;
- if (typeof height !== 'string' && typeof height !== 'number') return;
- var bodyWrapper = this.table.bodyWrapper;
- if (this.table.$el && bodyWrapper) {
- var body = bodyWrapper.querySelector('.el-table__body');
- this.scrollY = body.offsetHeight > bodyWrapper.offsetHeight;
- }
- };
- TableLayout.prototype.setHeight = function setHeight(value) {
- var prop = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'height';
- var el = this.table.$el;
- if (typeof value === 'string' && /^\d+$/.test(value)) {
- value = Number(value);
- }
- this.height = value;
- if (!el) return;
- if (typeof value === 'number') {
- el.style[prop] = value + 'px';
- this.updateHeight();
- } else if (typeof value === 'string') {
- if (value === '') {
- el.style[prop] = '';
- }
- this.updateHeight();
- }
- };
- TableLayout.prototype.setMaxHeight = function setMaxHeight(value) {
- return this.setHeight(value, 'max-height');
- };
- TableLayout.prototype.updateHeight = function updateHeight() {
- var height = this.tableHeight = this.table.$el.clientHeight;
- var noData = !this.table.data || this.table.data.length === 0;
- var _table$$refs = this.table.$refs,
- headerWrapper = _table$$refs.headerWrapper,
- appendWrapper = _table$$refs.appendWrapper,
- footerWrapper = _table$$refs.footerWrapper;
- var footerHeight = this.footerHeight = footerWrapper ? footerWrapper.offsetHeight : 0;
- this.appendHeight = appendWrapper ? appendWrapper.offsetHeight : 0;
- if (this.showHeader && !headerWrapper) return;
- if (!this.showHeader) {
- this.headerHeight = 0;
- if (this.height !== null && (!isNaN(this.height) || typeof this.height === 'string')) {
- this.bodyHeight = height - footerHeight + (footerWrapper ? 1 : 0);
- }
- this.fixedBodyHeight = this.scrollX ? height - this.gutterWidth : height;
- } else {
- var headerHeight = this.headerHeight = headerWrapper.offsetHeight;
- var bodyHeight = height - headerHeight - footerHeight + (footerWrapper ? 1 : 0);
- if (this.height !== null && (!isNaN(this.height) || typeof this.height === 'string')) {
- this.bodyHeight = bodyHeight;
- }
- this.fixedBodyHeight = this.scrollX ? bodyHeight - this.gutterWidth : bodyHeight;
- }
- this.viewportHeight = this.scrollX ? height - (noData ? 0 : this.gutterWidth) : height;
- };
- TableLayout.prototype.update = function update() {
- var fit = this.fit;
- var columns = this.table.columns;
- var bodyWidth = this.table.$el.clientWidth;
- var bodyMinWidth = 0;
- var flattenColumns = [];
- columns.forEach(function (column) {
- if (column.isColumnGroup) {
- flattenColumns.push.apply(flattenColumns, column.columns);
- } else {
- flattenColumns.push(column);
- }
- });
- var flexColumns = flattenColumns.filter(function (column) {
- return typeof column.width !== 'number';
- });
- if (flexColumns.length > 0 && fit) {
- flattenColumns.forEach(function (column) {
- bodyMinWidth += column.width || column.minWidth || 80;
- });
- var scrollYWidth = this.scrollY ? this.gutterWidth : 0;
- if (bodyMinWidth <= bodyWidth - scrollYWidth) {
- // DON'T HAVE SCROLL BAR
- this.scrollX = false;
- var totalFlexWidth = bodyWidth - scrollYWidth - bodyMinWidth;
- if (flexColumns.length === 1) {
- flexColumns[0].realWidth = (flexColumns[0].minWidth || 80) + totalFlexWidth;
- } else {
- (function () {
- var allColumnsWidth = flexColumns.reduce(function (prev, column) {
- return prev + (column.minWidth || 80);
- }, 0);
- var flexWidthPerPixel = totalFlexWidth / allColumnsWidth;
- var noneFirstWidth = 0;
- flexColumns.forEach(function (column, index) {
- if (index === 0) return;
- var flexWidth = Math.floor((column.minWidth || 80) * flexWidthPerPixel);
- noneFirstWidth += flexWidth;
- column.realWidth = (column.minWidth || 80) + flexWidth;
- });
- flexColumns[0].realWidth = (flexColumns[0].minWidth || 80) + totalFlexWidth - noneFirstWidth;
- })();
- }
- } else {
- // HAVE HORIZONTAL SCROLL BAR
- this.scrollX = true;
- flexColumns.forEach(function (column) {
- column.realWidth = column.minWidth;
- });
- }
- this.bodyWidth = Math.max(bodyMinWidth, bodyWidth);
- } else {
- flattenColumns.forEach(function (column) {
- if (!column.width && !column.minWidth) {
- column.realWidth = 80;
- } else {
- column.realWidth = column.width || column.minWidth;
- }
- bodyMinWidth += column.realWidth;
- });
- this.scrollX = bodyMinWidth > bodyWidth;
- this.bodyWidth = bodyMinWidth;
- }
- var fixedColumns = this.store.states.fixedColumns;
- if (fixedColumns.length > 0) {
- var fixedWidth = 0;
- fixedColumns.forEach(function (column) {
- fixedWidth += column.realWidth;
- });
- this.fixedWidth = fixedWidth;
- }
- var rightFixedColumns = this.store.states.rightFixedColumns;
- if (rightFixedColumns.length > 0) {
- var rightFixedWidth = 0;
- rightFixedColumns.forEach(function (column) {
- rightFixedWidth += column.realWidth;
- });
- this.rightFixedWidth = rightFixedWidth;
- }
- };
- return TableLayout;
- }();
- exports.default = TableLayout;
- /***/ }),
- /***/ 189:
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- exports.__esModule = true;
- 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; };
- var _util = __webpack_require__(37);
- var _dom = __webpack_require__(2);
- var _checkbox = __webpack_require__(16);
- var _checkbox2 = _interopRequireDefault(_checkbox);
- var _tooltip = __webpack_require__(22);
- var _tooltip2 = _interopRequireDefault(_tooltip);
- var _debounce = __webpack_require__(12);
- var _debounce2 = _interopRequireDefault(_debounce);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- exports.default = {
- components: {
- ElCheckbox: _checkbox2.default,
- ElTooltip: _tooltip2.default
- },
- props: {
- store: {
- required: true
- },
- stripe: Boolean,
- context: {},
- layout: {
- required: true
- },
- rowClassName: [String, Function],
- rowStyle: [Object, Function],
- fixed: String,
- highlight: Boolean
- },
- render: function render(h) {
- var _this = this;
- var columnsHidden = this.columns.map(function (column, index) {
- return _this.isColumnHidden(index);
- });
- return h(
- 'table',
- {
- 'class': 'el-table__body',
- attrs: { cellspacing: '0',
- cellpadding: '0',
- border: '0' }
- },
- [h(
- 'colgroup',
- null,
- [this._l(this.columns, function (column) {
- return h(
- 'col',
- {
- attrs: {
- name: column.id,
- width: column.realWidth || column.width
- }
- },
- []
- );
- })]
- ), h(
- 'tbody',
- null,
- [this._l(this.data, function (row, $index) {
- return [h(
- 'tr',
- {
- style: _this.rowStyle ? _this.getRowStyle(row, $index) : null,
- key: _this.table.rowKey ? _this.getKeyOfRow(row, $index) : $index,
- on: {
- 'dblclick': function dblclick($event) {
- return _this.handleDoubleClick($event, row);
- },
- 'click': function click($event) {
- return _this.handleClick($event, row);
- },
- 'contextmenu': function contextmenu($event) {
- return _this.handleContextMenu($event, row);
- },
- 'mouseenter': function mouseenter(_) {
- return _this.handleMouseEnter($index);
- },
- 'mouseleave': function mouseleave(_) {
- return _this.handleMouseLeave();
- }
- },
- 'class': [_this.getRowClass(row, $index)] },
- [_this._l(_this.columns, function (column, cellIndex) {
- var _getSpan = _this.getSpan(row, column, $index, cellIndex),
- rowspan = _getSpan.rowspan,
- colspan = _getSpan.colspan;
- if (!rowspan || !colspan) {
- return '';
- } else {
- if (rowspan === 1 && colspan === 1) {
- return h(
- 'td',
- {
- style: _this.getCellStyle($index, cellIndex, row, column),
- 'class': _this.getCellClass($index, cellIndex, row, column),
- on: {
- 'mouseenter': function mouseenter($event) {
- return _this.handleCellMouseEnter($event, row);
- },
- 'mouseleave': _this.handleCellMouseLeave
- }
- },
- [column.renderCell.call(_this._renderProxy, h, {
- row: row,
- column: column,
- $index: $index,
- store: _this.store,
- _self: _this.context || _this.table.$vnode.context
- }, columnsHidden[cellIndex])]
- );
- } else {
- return h(
- 'td',
- {
- style: _this.getCellStyle($index, cellIndex, row, column),
- 'class': _this.getCellClass($index, cellIndex, row, column),
- attrs: { rowspan: rowspan,
- colspan: colspan
- },
- on: {
- 'mouseenter': function mouseenter($event) {
- return _this.handleCellMouseEnter($event, row);
- },
- 'mouseleave': _this.handleCellMouseLeave
- }
- },
- [column.renderCell.call(_this._renderProxy, h, {
- row: row,
- column: column,
- $index: $index,
- store: _this.store,
- _self: _this.context || _this.table.$vnode.context
- }, columnsHidden[cellIndex])]
- );
- }
- }
- }), !_this.fixed && _this.layout.scrollY && _this.layout.gutterWidth ? h(
- 'td',
- { 'class': 'gutter' },
- []
- ) : '']
- ), _this.store.states.expandRows.indexOf(row) > -1 ? h(
- 'tr',
- null,
- [h(
- 'td',
- {
- attrs: { colspan: _this.columns.length },
- 'class': 'el-table__expanded-cell' },
- [_this.table.renderExpanded ? _this.table.renderExpanded(h, { row: row, $index: $index, store: _this.store }) : '']
- )]
- ) : ''];
- }).concat(h(
- 'el-tooltip',
- {
- attrs: { effect: this.table.tooltipEffect, placement: 'top', content: this.tooltipContent },
- ref: 'tooltip' },
- []
- ))]
- )]
- );
- },
- watch: {
- 'store.states.hoverRow': function storeStatesHoverRow(newVal, oldVal) {
- if (!this.store.states.isComplex) return;
- var el = this.$el;
- if (!el) return;
- var tr = el.querySelector('tbody').children;
- var rows = [].filter.call(tr, function (row) {
- return (0, _dom.hasClass)(row, 'el-table__row');
- });
- var oldRow = rows[oldVal];
- var newRow = rows[newVal];
- if (oldRow) {
- (0, _dom.removeClass)(oldRow, 'hover-row');
- }
- if (newRow) {
- (0, _dom.addClass)(newRow, 'hover-row');
- }
- },
- 'store.states.currentRow': function storeStatesCurrentRow(newVal, oldVal) {
- if (!this.highlight) return;
- var el = this.$el;
- if (!el) return;
- var data = this.store.states.data;
- var tr = el.querySelector('tbody').children;
- var rows = [].filter.call(tr, function (row) {
- return (0, _dom.hasClass)(row, 'el-table__row');
- });
- var oldRow = rows[data.indexOf(oldVal)];
- var newRow = rows[data.indexOf(newVal)];
- if (oldRow) {
- (0, _dom.removeClass)(oldRow, 'current-row');
- } else if (rows) {
- [].forEach.call(rows, function (row) {
- return (0, _dom.removeClass)(row, 'current-row');
- });
- }
- if (newRow) {
- (0, _dom.addClass)(newRow, 'current-row');
- }
- }
- },
- computed: {
- table: function table() {
- return this.$parent;
- },
- data: function data() {
- return this.store.states.data;
- },
- columnsCount: function columnsCount() {
- return this.store.states.columns.length;
- },
- leftFixedLeafCount: function leftFixedLeafCount() {
- return this.store.states.fixedLeafColumnsLength;
- },
- rightFixedLeafCount: function rightFixedLeafCount() {
- return this.store.states.rightFixedLeafColumnsLength;
- },
- leftFixedCount: function leftFixedCount() {
- return this.store.states.fixedColumns.length;
- },
- rightFixedCount: function rightFixedCount() {
- return this.store.states.rightFixedColumns.length;
- },
- columns: function columns() {
- return this.store.states.columns;
- }
- },
- data: function data() {
- return {
- tooltipContent: ''
- };
- },
- created: function created() {
- this.activateTooltip = (0, _debounce2.default)(50, function (tooltip) {
- return tooltip.handleShowPopper();
- });
- },
- methods: {
- getKeyOfRow: function getKeyOfRow(row, index) {
- var rowKey = this.table.rowKey;
- if (rowKey) {
- return (0, _util.getRowIdentity)(row, rowKey);
- }
- return index;
- },
- isColumnHidden: function isColumnHidden(index) {
- if (this.fixed === true || this.fixed === 'left') {
- return index >= this.leftFixedLeafCount;
- } else if (this.fixed === 'right') {
- return index < this.columnsCount - this.rightFixedLeafCount;
- } else {
- return index < this.leftFixedLeafCount || index >= this.columnsCount - this.rightFixedLeafCount;
- }
- },
- getSpan: function getSpan(row, column, rowIndex, columnIndex) {
- var rowspan = 1;
- var colspan = 1;
- var fn = this.table.spanMethod;
- if (typeof fn === 'function') {
- var result = fn({
- row: row,
- column: column,
- rowIndex: rowIndex,
- columnIndex: columnIndex
- });
- if (Array.isArray(result)) {
- rowspan = result[0];
- colspan = result[1];
- } else if ((typeof result === 'undefined' ? 'undefined' : _typeof(result)) === 'object') {
- rowspan = result.rowspan;
- colspan = result.colspan;
- }
- }
- return {
- rowspan: rowspan,
- colspan: colspan
- };
- },
- getRowStyle: function getRowStyle(row, rowIndex) {
- var rowStyle = this.table.rowStyle;
- if (typeof rowStyle === 'function') {
- return rowStyle.call(null, {
- row: row,
- rowIndex: rowIndex
- });
- }
- return rowStyle;
- },
- getRowClass: function getRowClass(row, rowIndex) {
- var classes = ['el-table__row'];
- if (this.stripe && rowIndex % 2 === 1) {
- classes.push('el-table__row--striped');
- }
- var rowClassName = this.table.rowClassName;
- if (typeof rowClassName === 'string') {
- classes.push(rowClassName);
- } else if (typeof rowClassName === 'function') {
- classes.push(rowClassName.call(null, {
- row: row,
- rowIndex: rowIndex
- }));
- }
- if (this.store.states.expandRows.indexOf(row) > -1) {
- classes.push('expanded');
- }
- return classes.join(' ');
- },
- getCellStyle: function getCellStyle(rowIndex, columnIndex, row, column) {
- var cellStyle = this.table.cellStyle;
- if (typeof cellStyle === 'function') {
- return cellStyle.call(null, {
- rowIndex: rowIndex,
- columnIndex: columnIndex,
- row: row,
- column: column
- });
- }
- return cellStyle;
- },
- getCellClass: function getCellClass(rowIndex, columnIndex, row, column) {
- var classes = [column.id, column.align, column.className];
- if (this.isColumnHidden(columnIndex)) {
- classes.push('is-hidden');
- }
- var cellClassName = this.table.cellClassName;
- if (typeof cellClassName === 'string') {
- classes.push(cellClassName);
- } else if (typeof cellClassName === 'function') {
- classes.push(cellClassName.call(null, {
- rowIndex: rowIndex,
- columnIndex: columnIndex,
- row: row,
- column: column
- }));
- }
- return classes.join(' ');
- },
- handleCellMouseEnter: function handleCellMouseEnter(event, row) {
- var table = this.table;
- var cell = (0, _util.getCell)(event);
- if (cell) {
- var column = (0, _util.getColumnByCell)(table, cell);
- var hoverState = table.hoverState = { cell: cell, column: column, row: row };
- table.$emit('cell-mouse-enter', hoverState.row, hoverState.column, hoverState.cell, event);
- }
- // 判断是否text-overflow, 如果是就显示tooltip
- var cellChild = event.target.querySelector('.cell');
- if ((0, _dom.hasClass)(cellChild, 'el-tooltip') && cellChild.scrollWidth > cellChild.offsetWidth && this.$refs.tooltip) {
- var tooltip = this.$refs.tooltip;
- this.tooltipContent = cell.textContent || cell.innerText;
- tooltip.referenceElm = cell;
- tooltip.$refs.popper && (tooltip.$refs.popper.style.display = 'none');
- tooltip.doDestroy();
- tooltip.setExpectedState(true);
- this.activateTooltip(tooltip);
- }
- },
- handleCellMouseLeave: function handleCellMouseLeave(event) {
- var tooltip = this.$refs.tooltip;
- if (tooltip) {
- tooltip.setExpectedState(false);
- tooltip.handleClosePopper();
- }
- var cell = (0, _util.getCell)(event);
- if (!cell) return;
- var oldHoverState = this.table.hoverState;
- this.table.$emit('cell-mouse-leave', oldHoverState.row, oldHoverState.column, oldHoverState.cell, event);
- },
- handleMouseEnter: function handleMouseEnter(index) {
- this.store.commit('setHoverRow', index);
- },
- handleMouseLeave: function handleMouseLeave() {
- this.store.commit('setHoverRow', null);
- },
- handleContextMenu: function handleContextMenu(event, row) {
- this.handleEvent(event, row, 'contextmenu');
- },
- handleDoubleClick: function handleDoubleClick(event, row) {
- this.handleEvent(event, row, 'dblclick');
- },
- handleClick: function handleClick(event, row) {
- this.store.commit('setCurrentRow', row);
- this.handleEvent(event, row, 'click');
- },
- handleEvent: function handleEvent(event, row, name) {
- var table = this.table;
- var cell = (0, _util.getCell)(event);
- var column = void 0;
- if (cell) {
- column = (0, _util.getColumnByCell)(table, cell);
- if (column) {
- table.$emit('cell-' + name, row, column, cell, event);
- }
- }
- table.$emit('row-' + name, row, event, column);
- },
- handleExpandClick: function handleExpandClick(row) {
- this.store.toggleRowExpansion(row);
- }
- }
- };
- /***/ }),
- /***/ 19:
- /***/ (function(module, exports) {
- module.exports = require("element-ui/lib/utils/resize-event");
- /***/ }),
- /***/ 190:
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- exports.__esModule = true;
- var _dom = __webpack_require__(2);
- var _checkbox = __webpack_require__(16);
- var _checkbox2 = _interopRequireDefault(_checkbox);
- var _tag = __webpack_require__(24);
- var _tag2 = _interopRequireDefault(_tag);
- var _vue = __webpack_require__(5);
- var _vue2 = _interopRequireDefault(_vue);
- var _filterPanel = __webpack_require__(191);
- var _filterPanel2 = _interopRequireDefault(_filterPanel);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- var getAllColumns = function getAllColumns(columns) {
- var result = [];
- columns.forEach(function (column) {
- if (column.children) {
- result.push(column);
- result.push.apply(result, getAllColumns(column.children));
- } else {
- result.push(column);
- }
- });
- return result;
- };
- var convertToRows = function convertToRows(originColumns) {
- var maxLevel = 1;
- var traverse = function traverse(column, parent) {
- if (parent) {
- column.level = parent.level + 1;
- if (maxLevel < column.level) {
- maxLevel = column.level;
- }
- }
- if (column.children) {
- var colSpan = 0;
- column.children.forEach(function (subColumn) {
- traverse(subColumn, column);
- colSpan += subColumn.colSpan;
- });
- column.colSpan = colSpan;
- } else {
- column.colSpan = 1;
- }
- };
- originColumns.forEach(function (column) {
- column.level = 1;
- traverse(column);
- });
- var rows = [];
- for (var i = 0; i < maxLevel; i++) {
- rows.push([]);
- }
- var allColumns = getAllColumns(originColumns);
- allColumns.forEach(function (column) {
- if (!column.children) {
- column.rowSpan = maxLevel - column.level + 1;
- } else {
- column.rowSpan = 1;
- }
- rows[column.level - 1].push(column);
- });
- return rows;
- };
- exports.default = {
- name: 'ElTableHeader',
- render: function render(h) {
- var _this = this;
- var originColumns = this.store.states.originColumns;
- var columnRows = convertToRows(originColumns, this.columns);
- // 是否拥有多级表头
- var isGroup = columnRows.length > 1;
- if (isGroup) this.$parent.isGroup = true;
- return h(
- 'table',
- {
- 'class': 'el-table__header',
- attrs: { cellspacing: '0',
- cellpadding: '0',
- border: '0' }
- },
- [h(
- 'colgroup',
- null,
- [this._l(this.columns, function (column) {
- return h(
- 'col',
- {
- attrs: {
- name: column.id,
- width: column.realWidth || column.width
- }
- },
- []
- );
- }), !this.fixed && this.layout.gutterWidth ? h(
- 'col',
- {
- attrs: { name: 'gutter', width: this.layout.scrollY ? this.layout.gutterWidth : '' }
- },
- []
- ) : '']
- ), h(
- 'thead',
- { 'class': [{ 'is-group': isGroup, 'has-gutter': this.hasGutter }] },
- [this._l(columnRows, function (columns, rowIndex) {
- return h(
- 'tr',
- {
- style: _this.getHeaderRowStyle(rowIndex),
- 'class': _this.getHeaderRowClass(rowIndex)
- },
- [_this._l(columns, function (column, cellIndex) {
- return h(
- 'th',
- {
- attrs: {
- colspan: column.colSpan,
- rowspan: column.rowSpan
- },
- on: {
- 'mousemove': function mousemove($event) {
- return _this.handleMouseMove($event, column);
- },
- 'mouseout': _this.handleMouseOut,
- 'mousedown': function mousedown($event) {
- return _this.handleMouseDown($event, column);
- },
- 'click': function click($event) {
- return _this.handleHeaderClick($event, column);
- }
- },
- style: _this.getHeaderCellStyle(rowIndex, cellIndex, columns, column),
- 'class': _this.getHeaderCellClass(rowIndex, cellIndex, columns, column) },
- [h(
- 'div',
- { 'class': ['cell', column.filteredValue && column.filteredValue.length > 0 ? 'highlight' : '', column.labelClassName] },
- [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(
- 'span',
- { 'class': 'caret-wrapper', on: {
- 'click': function click($event) {
- return _this.handleSortClick($event, column);
- }
- }
- },
- [h(
- 'i',
- { 'class': 'sort-caret ascending el-icon-caret-top', on: {
- 'click': function click($event) {
- return _this.handleSortClick($event, column, 'ascending');
- }
- }
- },
- []
- ), h(
- 'i',
- { 'class': 'sort-caret descending el-icon-caret-bottom', on: {
- 'click': function click($event) {
- return _this.handleSortClick($event, column, 'descending');
- }
- }
- },
- []
- )]
- ) : '', column.filterable ? h(
- 'span',
- { 'class': 'el-table__column-filter-trigger', on: {
- 'click': function click($event) {
- return _this.handleFilterClick($event, column);
- }
- }
- },
- [h(
- 'i',
- { 'class': ['el-icon-arrow-down', column.filterOpened ? 'el-icon-arrow-up' : ''] },
- []
- )]
- ) : '']
- )]
- );
- }), _this.hasGutter ? h(
- 'th',
- { 'class': 'gutter', style: { width: _this.layout.scrollY ? _this.layout.gutterWidth + 'px' : '0' } },
- []
- ) : '']
- );
- })]
- )]
- );
- },
- props: {
- fixed: String,
- store: {
- required: true
- },
- layout: {
- required: true
- },
- border: Boolean,
- defaultSort: {
- type: Object,
- default: function _default() {
- return {
- prop: '',
- order: ''
- };
- }
- }
- },
- components: {
- ElCheckbox: _checkbox2.default,
- ElTag: _tag2.default
- },
- computed: {
- table: function table() {
- return this.$parent;
- },
- isAllSelected: function isAllSelected() {
- return this.store.states.isAllSelected;
- },
- columnsCount: function columnsCount() {
- return this.store.states.columns.length;
- },
- leftFixedCount: function leftFixedCount() {
- return this.store.states.fixedColumns.length;
- },
- rightFixedCount: function rightFixedCount() {
- return this.store.states.rightFixedColumns.length;
- },
- leftFixedLeafCount: function leftFixedLeafCount() {
- return this.store.states.fixedLeafColumnsLength;
- },
- rightFixedLeafCount: function rightFixedLeafCount() {
- return this.store.states.rightFixedLeafColumnsLength;
- },
- columns: function columns() {
- return this.store.states.columns;
- },
- hasGutter: function hasGutter() {
- return !this.fixed && this.layout.gutterWidth;
- }
- },
- created: function created() {
- this.filterPanels = {};
- },
- mounted: function mounted() {
- var _this2 = this;
- if (this.defaultSort.prop) {
- (function () {
- var states = _this2.store.states;
- states.sortProp = _this2.defaultSort.prop;
- states.sortOrder = _this2.defaultSort.order || 'ascending';
- _this2.$nextTick(function (_) {
- for (var i = 0, length = _this2.columns.length; i < length; i++) {
- var column = _this2.columns[i];
- if (column.property === states.sortProp) {
- column.order = states.sortOrder;
- states.sortingColumn = column;
- break;
- }
- }
- if (states.sortingColumn) {
- _this2.store.commit('changeSortCondition');
- }
- });
- })();
- }
- },
- beforeDestroy: function beforeDestroy() {
- var panels = this.filterPanels;
- for (var prop in panels) {
- if (panels.hasOwnProperty(prop) && panels[prop]) {
- panels[prop].$destroy(true);
- }
- }
- },
- methods: {
- isCellHidden: function isCellHidden(index, columns) {
- var start = 0;
- for (var i = 0; i < index; i++) {
- start += columns[i].colSpan;
- }
- var after = start + columns[index].colSpan - 1;
- if (this.fixed === true || this.fixed === 'left') {
- return after >= this.leftFixedLeafCount;
- } else if (this.fixed === 'right') {
- return start < this.columnsCount - this.rightFixedLeafCount;
- } else {
- return after < this.leftFixedLeafCount || start >= this.columnsCount - this.rightFixedLeafCount;
- }
- },
- getHeaderRowStyle: function getHeaderRowStyle(rowIndex) {
- var headerRowStyle = this.table.headerRowStyle;
- if (typeof headerRowStyle === 'function') {
- return headerRowStyle.call(null, { rowIndex: rowIndex });
- }
- return headerRowStyle;
- },
- getHeaderRowClass: function getHeaderRowClass(rowIndex) {
- var classes = [];
- var headerRowClassName = this.table.headerRowClassName;
- if (typeof headerRowClassName === 'string') {
- classes.push(headerRowClassName);
- } else if (typeof headerRowClassName === 'function') {
- classes.push(headerRowClassName.call(null, { rowIndex: rowIndex }));
- }
- return classes.join(' ');
- },
- getHeaderCellStyle: function getHeaderCellStyle(rowIndex, columnIndex, row, column) {
- var headerCellStyle = this.table.headerCellStyle;
- if (typeof headerCellStyle === 'function') {
- return headerCellStyle.call(null, {
- rowIndex: rowIndex,
- columnIndex: columnIndex,
- row: row,
- column: column
- });
- }
- return headerCellStyle;
- },
- getHeaderCellClass: function getHeaderCellClass(rowIndex, columnIndex, row, column) {
- var classes = [column.id, column.order, column.headerAlign, column.className, column.labelClassName];
- if (rowIndex === 0 && this.isCellHidden(columnIndex, row)) {
- classes.push('is-hidden');
- }
- if (!column.children) {
- classes.push('is-leaf');
- }
- if (column.sortable) {
- classes.push('is-sortable');
- }
- var headerCellClassName = this.table.headerCellClassName;
- if (typeof headerCellClassName === 'string') {
- classes.push(headerCellClassName);
- } else if (typeof headerCellClassName === 'function') {
- classes.push(headerCellClassName.call(null, {
- rowIndex: rowIndex,
- columnIndex: columnIndex,
- row: row,
- column: column
- }));
- }
- return classes.join(' ');
- },
- toggleAllSelection: function toggleAllSelection() {
- this.store.commit('toggleAllSelection');
- },
- handleFilterClick: function handleFilterClick(event, column) {
- event.stopPropagation();
- var target = event.target;
- var cell = target.parentNode;
- var table = this.$parent;
- var filterPanel = this.filterPanels[column.id];
- if (filterPanel && column.filterOpened) {
- filterPanel.showPopper = false;
- return;
- }
- if (!filterPanel) {
- filterPanel = new _vue2.default(_filterPanel2.default);
- this.filterPanels[column.id] = filterPanel;
- if (column.filterPlacement) {
- filterPanel.placement = column.filterPlacement;
- }
- filterPanel.table = table;
- filterPanel.cell = cell;
- filterPanel.column = column;
- !this.$isServer && filterPanel.$mount(document.createElement('div'));
- }
- setTimeout(function () {
- filterPanel.showPopper = true;
- }, 16);
- },
- handleHeaderClick: function handleHeaderClick(event, column) {
- if (!column.filters && column.sortable) {
- this.handleSortClick(event, column);
- } else if (column.filters && !column.sortable) {
- this.handleFilterClick(event, column);
- }
- this.$parent.$emit('header-click', column, event);
- },
- handleMouseDown: function handleMouseDown(event, column) {
- var _this3 = this;
- if (this.$isServer) return;
- if (column.children && column.children.length > 0) return;
- /* istanbul ignore if */
- if (this.draggingColumn && this.border) {
- (function () {
- _this3.dragging = true;
- _this3.$parent.resizeProxyVisible = true;
- var table = _this3.$parent;
- var tableEl = table.$el;
- var tableLeft = tableEl.getBoundingClientRect().left;
- var columnEl = _this3.$el.querySelector('th.' + column.id);
- var columnRect = columnEl.getBoundingClientRect();
- var minLeft = columnRect.left - tableLeft + 30;
- (0, _dom.addClass)(columnEl, 'noclick');
- _this3.dragState = {
- startMouseLeft: event.clientX,
- startLeft: columnRect.right - tableLeft,
- startColumnLeft: columnRect.left - tableLeft,
- tableLeft: tableLeft
- };
- var resizeProxy = table.$refs.resizeProxy;
- resizeProxy.style.left = _this3.dragState.startLeft + 'px';
- document.onselectstart = function () {
- return false;
- };
- document.ondragstart = function () {
- return false;
- };
- var handleMouseMove = function handleMouseMove(event) {
- var deltaLeft = event.clientX - _this3.dragState.startMouseLeft;
- var proxyLeft = _this3.dragState.startLeft + deltaLeft;
- resizeProxy.style.left = Math.max(minLeft, proxyLeft) + 'px';
- };
- var handleMouseUp = function handleMouseUp() {
- if (_this3.dragging) {
- var _dragState = _this3.dragState,
- startColumnLeft = _dragState.startColumnLeft,
- startLeft = _dragState.startLeft;
- var finalLeft = parseInt(resizeProxy.style.left, 10);
- var columnWidth = finalLeft - startColumnLeft;
- column.width = column.realWidth = columnWidth;
- table.$emit('header-dragend', column.width, startLeft - startColumnLeft, column, event);
- _this3.store.scheduleLayout();
- document.body.style.cursor = '';
- _this3.dragging = false;
- _this3.draggingColumn = null;
- _this3.dragState = {};
- table.resizeProxyVisible = false;
- }
- document.removeEventListener('mousemove', handleMouseMove);
- document.removeEventListener('mouseup', handleMouseUp);
- document.onselectstart = null;
- document.ondragstart = null;
- setTimeout(function () {
- (0, _dom.removeClass)(columnEl, 'noclick');
- }, 0);
- };
- document.addEventListener('mousemove', handleMouseMove);
- document.addEventListener('mouseup', handleMouseUp);
- })();
- }
- },
- handleMouseMove: function handleMouseMove(event, column) {
- if (column.children && column.children.length > 0) return;
- var target = event.target;
- while (target && target.tagName !== 'TH') {
- target = target.parentNode;
- }
- if (!column || !column.resizable) return;
- if (!this.dragging && this.border) {
- var rect = target.getBoundingClientRect();
- var bodyStyle = document.body.style;
- if (rect.width > 12 && rect.right - event.pageX < 8) {
- bodyStyle.cursor = 'col-resize';
- if ((0, _dom.hasClass)(target, 'is-sortable')) {
- target.style.cursor = 'col-resize';
- }
- this.draggingColumn = column;
- } else if (!this.dragging) {
- bodyStyle.cursor = '';
- if ((0, _dom.hasClass)(target, 'is-sortable')) {
- target.style.cursor = 'pointer';
- }
- this.draggingColumn = null;
- }
- }
- },
- handleMouseOut: function handleMouseOut() {
- if (this.$isServer) return;
- document.body.style.cursor = '';
- },
- toggleOrder: function toggleOrder(order) {
- return !order ? 'ascending' : order === 'ascending' ? 'descending' : null;
- },
- handleSortClick: function handleSortClick(event, column, givenOrder) {
- event.stopPropagation();
- var order = givenOrder || this.toggleOrder(column.order);
- var target = event.target;
- while (target && target.tagName !== 'TH') {
- target = target.parentNode;
- }
- if (target && target.tagName === 'TH') {
- if ((0, _dom.hasClass)(target, 'noclick')) {
- (0, _dom.removeClass)(target, 'noclick');
- return;
- }
- }
- if (!column.sortable) return;
- var states = this.store.states;
- var sortProp = states.sortProp;
- var sortOrder = void 0;
- var sortingColumn = states.sortingColumn;
- if (sortingColumn !== column) {
- if (sortingColumn) {
- sortingColumn.order = null;
- }
- states.sortingColumn = column;
- sortProp = column.property;
- }
- if (!order) {
- sortOrder = column.order = null;
- states.sortingColumn = null;
- sortProp = null;
- } else {
- sortOrder = column.order = order;
- }
- states.sortProp = sortProp;
- states.sortOrder = sortOrder;
- this.store.commit('changeSortCondition');
- }
- },
- data: function data() {
- return {
- draggingColumn: null,
- dragging: false,
- dragState: {}
- };
- }
- };
- /***/ }),
- /***/ 191:
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
- /* 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);
- /* 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__);
- /* 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);
- var normalizeComponent = __webpack_require__(0)
- /* script */
- /* template */
- /* template functional */
- var __vue_template_functional__ = false
- /* styles */
- var __vue_styles__ = null
- /* scopeId */
- var __vue_scopeId__ = null
- /* moduleIdentifier (server only) */
- var __vue_module_identifier__ = null
- var Component = normalizeComponent(
- __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_filter_panel_vue___default.a,
- __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 */],
- __vue_template_functional__,
- __vue_styles__,
- __vue_scopeId__,
- __vue_module_identifier__
- )
- /* harmony default export */ __webpack_exports__["default"] = (Component.exports);
- /***/ }),
- /***/ 192:
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- exports.__esModule = true;
- var _vuePopper = __webpack_require__(8);
- var _vuePopper2 = _interopRequireDefault(_vuePopper);
- var _popup = __webpack_require__(17);
- var _locale = __webpack_require__(4);
- var _locale2 = _interopRequireDefault(_locale);
- var _clickoutside = __webpack_require__(10);
- var _clickoutside2 = _interopRequireDefault(_clickoutside);
- var _dropdown = __webpack_require__(193);
- var _dropdown2 = _interopRequireDefault(_dropdown);
- var _checkbox = __webpack_require__(16);
- var _checkbox2 = _interopRequireDefault(_checkbox);
- var _checkboxGroup = __webpack_require__(39);
- var _checkboxGroup2 = _interopRequireDefault(_checkboxGroup);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- exports.default = {
- name: 'ElTableFilterPanel',
- mixins: [_vuePopper2.default, _locale2.default],
- directives: {
- Clickoutside: _clickoutside2.default
- },
- components: {
- ElCheckbox: _checkbox2.default,
- ElCheckboxGroup: _checkboxGroup2.default
- },
- props: {
- placement: {
- type: String,
- default: 'bottom-end'
- }
- },
- customRender: function customRender(h) {
- return h(
- 'div',
- { 'class': 'el-table-filter' },
- [h(
- 'div',
- { 'class': 'el-table-filter__content' },
- []
- ), h(
- 'div',
- { 'class': 'el-table-filter__bottom' },
- [h(
- 'button',
- {
- on: {
- 'click': this.handleConfirm
- }
- },
- [this.t('el.table.confirmFilter')]
- ), h(
- 'button',
- {
- on: {
- 'click': this.handleReset
- }
- },
- [this.t('el.table.resetFilter')]
- )]
- )]
- );
- },
- methods: {
- isActive: function isActive(filter) {
- return filter.value === this.filterValue;
- },
- handleOutsideClick: function handleOutsideClick() {
- this.showPopper = false;
- },
- handleConfirm: function handleConfirm() {
- this.confirmFilter(this.filteredValue);
- this.handleOutsideClick();
- },
- handleReset: function handleReset() {
- this.filteredValue = [];
- this.confirmFilter(this.filteredValue);
- this.handleOutsideClick();
- },
- handleSelect: function handleSelect(filterValue) {
- this.filterValue = filterValue;
- if (typeof filterValue !== 'undefined' && filterValue !== null) {
- this.confirmFilter(this.filteredValue);
- } else {
- this.confirmFilter([]);
- }
- this.handleOutsideClick();
- },
- confirmFilter: function confirmFilter(filteredValue) {
- this.table.store.commit('filterChange', {
- column: this.column,
- values: filteredValue
- });
- }
- },
- data: function data() {
- return {
- table: null,
- cell: null,
- column: null
- };
- },
- computed: {
- filters: function filters() {
- return this.column && this.column.filters;
- },
- filterValue: {
- get: function get() {
- return (this.column.filteredValue || [])[0];
- },
- set: function set(value) {
- if (this.filteredValue) {
- if (typeof value !== 'undefined' && value !== null) {
- this.filteredValue.splice(0, 1, value);
- } else {
- this.filteredValue.splice(0, 1);
- }
- }
- }
- },
- filteredValue: {
- get: function get() {
- if (this.column) {
- return this.column.filteredValue || [];
- }
- return [];
- },
- set: function set(value) {
- if (this.column) {
- this.column.filteredValue = value;
- }
- }
- },
- multiple: function multiple() {
- if (this.column) {
- return this.column.filterMultiple;
- }
- return true;
- }
- },
- mounted: function mounted() {
- var _this = this;
- this.popperElm = this.$el;
- this.referenceElm = this.cell;
- this.table.bodyWrapper.addEventListener('scroll', function () {
- _this.updatePopper();
- });
- this.$watch('showPopper', function (value) {
- if (_this.column) _this.column.filterOpened = value;
- if (value) {
- _dropdown2.default.open(_this);
- } else {
- _dropdown2.default.close(_this);
- }
- });
- },
- watch: {
- showPopper: function showPopper(val) {
- if (val === true && parseInt(this.popperJS._popper.style.zIndex, 10) < _popup.PopupManager.zIndex) {
- this.popperJS._popper.style.zIndex = _popup.PopupManager.nextZIndex();
- }
- }
- }
- }; //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- /***/ }),
- /***/ 193:
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- exports.__esModule = true;
- var _vue = __webpack_require__(5);
- var _vue2 = _interopRequireDefault(_vue);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- var dropdowns = [];
- !_vue2.default.prototype.$isServer && document.addEventListener('click', function (event) {
- dropdowns.forEach(function (dropdown) {
- var target = event.target;
- if (!dropdown || !dropdown.$el) return;
- if (target === dropdown.$el || dropdown.$el.contains(target)) {
- return;
- }
- dropdown.handleOutsideClick && dropdown.handleOutsideClick(event);
- });
- });
- exports.default = {
- open: function open(instance) {
- if (instance) {
- dropdowns.push(instance);
- }
- },
- close: function close(instance) {
- var index = dropdowns.indexOf(instance);
- if (index !== -1) {
- dropdowns.splice(instance, 1);
- }
- }
- };
- /***/ }),
- /***/ 194:
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- 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)])])}
- var staticRenderFns = []
- var esExports = { render: render, staticRenderFns: staticRenderFns }
- /* harmony default export */ __webpack_exports__["a"] = (esExports);
- /***/ }),
- /***/ 195:
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- exports.__esModule = true;
- exports.default = {
- name: 'ElTableFooter',
- render: function render(h) {
- var _this = this;
- var sums = [];
- this.columns.forEach(function (column, index) {
- if (index === 0) {
- sums[index] = _this.sumText;
- return;
- }
- var values = _this.store.states.data.map(function (item) {
- return Number(item[column.property]);
- });
- var precisions = [];
- var notNumber = true;
- values.forEach(function (value) {
- if (!isNaN(value)) {
- notNumber = false;
- var decimal = ('' + value).split('.')[1];
- precisions.push(decimal ? decimal.length : 0);
- }
- });
- var precision = Math.max.apply(null, precisions);
- if (!notNumber) {
- sums[index] = values.reduce(function (prev, curr) {
- var value = Number(curr);
- if (!isNaN(value)) {
- return parseFloat((prev + curr).toFixed(Math.min(precision, 20)));
- } else {
- return prev;
- }
- }, 0);
- } else {
- sums[index] = '';
- }
- });
- return h(
- 'table',
- {
- 'class': 'el-table__footer',
- attrs: { cellspacing: '0',
- cellpadding: '0',
- border: '0' }
- },
- [h(
- 'colgroup',
- null,
- [this._l(this.columns, function (column) {
- return h(
- 'col',
- {
- attrs: {
- name: column.id,
- width: column.realWidth || column.width
- }
- },
- []
- );
- }), !this.fixed && this.layout.gutterWidth ? h(
- 'col',
- {
- attrs: { name: 'gutter', width: this.layout.scrollY ? this.layout.gutterWidth : '' }
- },
- []
- ) : '']
- ), h(
- 'tbody',
- { 'class': [{ 'has-gutter': this.hasGutter }] },
- [h(
- 'tr',
- null,
- [this._l(this.columns, function (column, cellIndex) {
- return h(
- 'td',
- {
- attrs: {
- colspan: column.colSpan,
- rowspan: column.rowSpan
- },
- 'class': [column.id, column.headerAlign, column.className || '', _this.isCellHidden(cellIndex, _this.columns) ? 'is-hidden' : '', !column.children ? 'is-leaf' : '', column.labelClassName] },
- [h(
- 'div',
- { 'class': ['cell', column.labelClassName] },
- [_this.summaryMethod ? _this.summaryMethod({ columns: _this.columns, data: _this.store.states.data })[cellIndex] : sums[cellIndex]]
- )]
- );
- }), this.hasGutter ? h(
- 'td',
- { 'class': 'gutter', style: { width: this.layout.scrollY ? this.layout.gutterWidth + 'px' : '0' } },
- []
- ) : '']
- )]
- )]
- );
- },
- props: {
- fixed: String,
- store: {
- required: true
- },
- layout: {
- required: true
- },
- summaryMethod: Function,
- sumText: String,
- border: Boolean,
- defaultSort: {
- type: Object,
- default: function _default() {
- return {
- prop: '',
- order: ''
- };
- }
- }
- },
- computed: {
- isAllSelected: function isAllSelected() {
- return this.store.states.isAllSelected;
- },
- columnsCount: function columnsCount() {
- return this.store.states.columns.length;
- },
- leftFixedCount: function leftFixedCount() {
- return this.store.states.fixedColumns.length;
- },
- rightFixedCount: function rightFixedCount() {
- return this.store.states.rightFixedColumns.length;
- },
- columns: function columns() {
- return this.store.states.columns;
- },
- hasGutter: function hasGutter() {
- return !this.fixed && this.layout.gutterWidth;
- }
- },
- methods: {
- isCellHidden: function isCellHidden(index, columns) {
- if (this.fixed === true || this.fixed === 'left') {
- return index >= this.leftFixedCount;
- } else if (this.fixed === 'right') {
- var before = 0;
- for (var i = 0; i < index; i++) {
- before += columns[i].colSpan;
- }
- return before < this.columnsCount - this.rightFixedCount;
- } else {
- return index < this.leftFixedCount || index >= this.columnsCount - this.rightFixedCount;
- }
- }
- }
- };
- /***/ }),
- /***/ 196:
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"el-table",class:[{
- 'el-table--fit': _vm.fit,
- 'el-table--striped': _vm.stripe,
- 'el-table--border': _vm.border || _vm.isGroup,
- 'el-table--hidden': _vm.isHidden,
- 'el-table--group': _vm.isGroup,
- 'el-table--fluid-height': _vm.maxHeight,
- 'el-table--enable-row-hover': !_vm.store.states.isComplex,
- 'el-table--enable-row-transition': (_vm.store.states.data || []).length !== 0 && (_vm.store.states.data || []).length < 100
- }, _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:([
- { width: _vm.layout.fixedWidth ? _vm.layout.fixedWidth + 'px' : '' },
- _vm.fixedHeight
- ])},[(_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:([
- { top: _vm.layout.headerHeight + 'px' },
- _vm.fixedBodyHeight
- ])},[_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:([
- { width: _vm.layout.rightFixedWidth ? _vm.layout.rightFixedWidth + 'px' : '' },
- { right: _vm.layout.scrollY ? (_vm.border ? _vm.layout.gutterWidth : (_vm.layout.gutterWidth || 0)) + 'px' : '' },
- _vm.fixedHeight
- ])},[(_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:([
- { top: _vm.layout.headerHeight + 'px' },
- _vm.fixedBodyHeight
- ])},[_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"})])}
- var staticRenderFns = []
- var esExports = { render: render, staticRenderFns: staticRenderFns }
- /* harmony default export */ __webpack_exports__["a"] = (esExports);
- /***/ }),
- /***/ 2:
- /***/ (function(module, exports) {
- module.exports = require("element-ui/lib/utils/dom");
- /***/ }),
- /***/ 22:
- /***/ (function(module, exports) {
- module.exports = require("element-ui/lib/tooltip");
- /***/ }),
- /***/ 24:
- /***/ (function(module, exports) {
- module.exports = require("element-ui/lib/tag");
- /***/ }),
- /***/ 3:
- /***/ (function(module, exports) {
- module.exports = require("element-ui/lib/utils/util");
- /***/ }),
- /***/ 36:
- /***/ (function(module, exports) {
- module.exports = require("throttle-debounce/throttle");
- /***/ }),
- /***/ 37:
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- exports.__esModule = true;
- exports.getRowIdentity = exports.mousewheel = exports.getColumnByCell = exports.getColumnById = exports.orderBy = exports.getCell = undefined;
- 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; };
- var _util = __webpack_require__(3);
- var getCell = exports.getCell = function getCell(event) {
- var cell = event.target;
- while (cell && cell.tagName.toUpperCase() !== 'HTML') {
- if (cell.tagName.toUpperCase() === 'TD') {
- return cell;
- }
- cell = cell.parentNode;
- }
- return null;
- };
- var isObject = function isObject(obj) {
- return obj !== null && (typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) === 'object';
- };
- var orderBy = exports.orderBy = function orderBy(array, sortKey, reverse, sortMethod, sortBy) {
- if (!sortKey && !sortMethod && (!sortBy || Array.isArray(sortBy) && !sortBy.length)) {
- return array;
- }
- if (typeof reverse === 'string') {
- reverse = reverse === 'descending' ? -1 : 1;
- } else {
- reverse = reverse && reverse < 0 ? -1 : 1;
- }
- var getKey = sortMethod ? null : function (value, index) {
- if (sortBy) {
- if (!Array.isArray(sortBy)) {
- sortBy = [sortBy];
- }
- return sortBy.map(function (by) {
- if (typeof by === 'string') {
- return (0, _util.getValueByPath)(value, by);
- } else {
- return by(value, index, array);
- }
- });
- }
- if (sortKey !== '$key') {
- if (isObject(value) && '$value' in value) value = value.$value;
- }
- return [isObject(value) ? (0, _util.getValueByPath)(value, sortKey) : value];
- };
- var compare = function compare(a, b) {
- if (sortMethod) {
- return sortMethod(a.value, b.value);
- }
- for (var i = 0, len = a.key.length; i < len; i++) {
- if (a.key[i] < b.key[i]) {
- return -1;
- }
- if (a.key[i] > b.key[i]) {
- return 1;
- }
- }
- return 0;
- };
- return array.map(function (value, index) {
- return {
- value: value,
- index: index,
- key: getKey ? getKey(value, index) : null
- };
- }).sort(function (a, b) {
- var order = compare(a, b);
- if (!order) {
- // make stable https://en.wikipedia.org/wiki/Sorting_algorithm#Stability
- order = a.index - b.index;
- }
- return order * reverse;
- }).map(function (item) {
- return item.value;
- });
- };
- var getColumnById = exports.getColumnById = function getColumnById(table, columnId) {
- var column = null;
- table.columns.forEach(function (item) {
- if (item.id === columnId) {
- column = item;
- }
- });
- return column;
- };
- var getColumnByCell = exports.getColumnByCell = function getColumnByCell(table, cell) {
- var matches = (cell.className || '').match(/el-table_[^\s]+/gm);
- if (matches) {
- return getColumnById(table, matches[0]);
- }
- return null;
- };
- var isFirefox = typeof navigator !== 'undefined' && navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
- var mousewheel = exports.mousewheel = function mousewheel(element, callback) {
- if (element && element.addEventListener) {
- element.addEventListener(isFirefox ? 'DOMMouseScroll' : 'mousewheel', callback);
- }
- };
- var getRowIdentity = exports.getRowIdentity = function getRowIdentity(row, rowKey) {
- if (!row) throw new Error('row is required when get row identity');
- if (typeof rowKey === 'string') {
- if (rowKey.indexOf('.') < 0) {
- return row[rowKey];
- }
- var key = rowKey.split('.');
- var current = row;
- for (var i = 0; i < key.length; i++) {
- current = current[key[i]];
- }
- return current;
- } else if (typeof rowKey === 'function') {
- return rowKey.call(null, row);
- }
- };
- /***/ }),
- /***/ 38:
- /***/ (function(module, exports) {
- module.exports = require("element-ui/lib/utils/scrollbar-width");
- /***/ }),
- /***/ 39:
- /***/ (function(module, exports) {
- module.exports = require("element-ui/lib/checkbox-group");
- /***/ }),
- /***/ 4:
- /***/ (function(module, exports) {
- module.exports = require("element-ui/lib/mixins/locale");
- /***/ }),
- /***/ 5:
- /***/ (function(module, exports) {
- module.exports = require("vue");
- /***/ }),
- /***/ 7:
- /***/ (function(module, exports) {
- module.exports = require("element-ui/lib/mixins/migrating");
- /***/ }),
- /***/ 8:
- /***/ (function(module, exports) {
- module.exports = require("element-ui/lib/utils/vue-popper");
- /***/ }),
- /***/ 9:
- /***/ (function(module, exports) {
- module.exports = require("element-ui/lib/utils/merge");
- /***/ })
- /******/ });
|