| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907 |
- 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] = {
- /******/ exports: {},
- /******/ id: moduleId,
- /******/ loaded: false
- /******/ };
- /******/ // Execute the module function
- /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
- /******/ // Flag the module as loaded
- /******/ module.loaded = 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;
- /******/ // __webpack_public_path__
- /******/ __webpack_require__.p = "/dist/";
- /******/ // Load entry module and return exports
- /******/ return __webpack_require__(0);
- /******/ })
- /************************************************************************/
- /******/ ({
- /***/ 0:
- /***/ function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(301);
- /***/ },
- /***/ 3:
- /***/ function(module, exports) {
- module.exports = function normalizeComponent (
- rawScriptExports,
- compiledTemplate,
- scopeId,
- cssModules
- ) {
- 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
- }
- // scopedId
- if (scopeId) {
- options._scopeId = scopeId
- }
- // inject cssModules
- if (cssModules) {
- var computed = options.computed || (options.computed = {})
- Object.keys(cssModules).forEach(function (key) {
- var module = cssModules[key]
- computed[key] = function () { return module }
- })
- }
- return {
- esModule: esModule,
- exports: scriptExports,
- options: options
- }
- }
- /***/ },
- /***/ 10:
- /***/ function(module, exports) {
- module.exports = require("element-ui/lib/utils/clickoutside");
- /***/ },
- /***/ 13:
- /***/ function(module, exports) {
- module.exports = require("element-ui/lib/utils/vue-popper");
- /***/ },
- /***/ 45:
- /***/ function(module, exports) {
- module.exports = require("throttle-debounce/throttle");
- /***/ },
- /***/ 46:
- /***/ function(module, exports) {
- module.exports = require("throttle-debounce/debounce");
- /***/ },
- /***/ 47:
- /***/ function(module, exports) {
- module.exports = require("element-ui/lib/utils/resize-event");
- /***/ },
- /***/ 56:
- /***/ function(module, exports) {
- module.exports = require("vue");
- /***/ },
- /***/ 60:
- /***/ function(module, exports) {
- module.exports = require("element-ui/lib/mixins/locale");
- /***/ },
- /***/ 117:
- /***/ function(module, exports) {
- module.exports = require("element-ui/lib/utils/dom");
- /***/ },
- /***/ 132:
- /***/ function(module, exports) {
- module.exports = require("element-ui/lib/utils/popup");
- /***/ },
- /***/ 256:
- /***/ function(module, exports) {
- module.exports = require("element-ui/lib/utils/scrollbar-width");
- /***/ },
- /***/ 266:
- /***/ function(module, exports) {
- module.exports = require("element-ui/lib/tag");
- /***/ },
- /***/ 274:
- /***/ function(module, exports) {
- module.exports = require("element-ui/lib/tooltip");
- /***/ },
- /***/ 301:
- /***/ function(module, exports, __webpack_require__) {
- 'use strict';
- exports.__esModule = true;
- var _table = __webpack_require__(302);
- 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;
- /***/ },
- /***/ 302:
- /***/ function(module, exports, __webpack_require__) {
- var Component = __webpack_require__(3)(
- /* script */
- __webpack_require__(303),
- /* template */
- __webpack_require__(315),
- /* scopeId */
- null,
- /* cssModules */
- null
- )
- module.exports = Component.exports
- /***/ },
- /***/ 303:
- /***/ function(module, exports, __webpack_require__) {
- 'use strict';
- exports.__esModule = true;
- var _checkbox = __webpack_require__(304);
- var _checkbox2 = _interopRequireDefault(_checkbox);
- var _throttle = __webpack_require__(45);
- var _throttle2 = _interopRequireDefault(_throttle);
- var _debounce = __webpack_require__(46);
- var _debounce2 = _interopRequireDefault(_debounce);
- var _resizeEvent = __webpack_require__(47);
- var _locale = __webpack_require__(60);
- var _locale2 = _interopRequireDefault(_locale);
- var _tableStore = __webpack_require__(305);
- var _tableStore2 = _interopRequireDefault(_tableStore);
- var _tableLayout = __webpack_require__(307);
- var _tableLayout2 = _interopRequireDefault(_tableLayout);
- var _tableBody = __webpack_require__(308);
- var _tableBody2 = _interopRequireDefault(_tableBody);
- var _tableHeader = __webpack_require__(309);
- var _tableHeader2 = _interopRequireDefault(_tableHeader);
- var _util = __webpack_require__(306);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- var tableIdSeed = 1;
- exports.default = {
- name: 'ElTable',
- mixins: [_locale2.default],
- props: {
- data: {
- type: Array,
- default: function _default() {
- return [];
- }
- },
- 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
- },
- rowClassName: [String, Function],
- rowStyle: [Object, Function],
- highlightCurrentRow: Boolean,
- currentRowKey: [String, Number],
- emptyText: String,
- expandRowKeys: Array,
- defaultExpandAll: Boolean,
- defaultSort: Object,
- tooltipEffect: String
- },
- components: {
- TableHeader: _tableHeader2.default,
- TableBody: _tableBody2.default,
- ElCheckbox: _checkbox2.default
- },
- methods: {
- toggleRowSelection: function toggleRowSelection(row, selected) {
- this.store.toggleRowSelection(row, selected);
- this.store.updateAllSelected();
- },
- clearSelection: function clearSelection() {
- this.store.clearSelection();
- },
- 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 headerWrapper = this.$refs.headerWrapper;
- var refs = this.$refs;
- this.bodyWrapper.addEventListener('scroll', function () {
- if (headerWrapper) headerWrapper.scrollLeft = this.scrollLeft;
- if (refs.fixedBodyWrapper) refs.fixedBodyWrapper.scrollTop = this.scrollTop;
- if (refs.rightFixedBodyWrapper) refs.rightFixedBodyWrapper.scrollTop = this.scrollTop;
- });
- if (headerWrapper) {
- (0, _util.mousewheel)(headerWrapper, (0, _throttle2.default)(16, function (event) {
- var deltaX = event.deltaX;
- if (deltaX > 0) {
- _this.bodyWrapper.scrollLeft += 10;
- } else {
- _this.bodyWrapper.scrollLeft -= 10;
- }
- }));
- }
- 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.layout.update();
- this.updateScrollY();
- 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: {
- 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.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.maxHeight) + '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);
- },
- currentRowKey: function currentRowKey(newVal) {
- this.store.setCurrentRowKey(newVal);
- },
- data: {
- immediate: true,
- handler: function handler(val) {
- this.store.commit('setData', val);
- }
- },
- expandRowKeys: function expandRowKeys(newVal) {
- this.store.setExpandRowKeys(newVal);
- }
- },
- destroyed: function destroyed() {
- if (this.windowResizeListener) (0, _resizeEvent.removeResizeListener)(this.$el, this.windowResizeListener);
- },
- mounted: function mounted() {
- var _this4 = this;
- this.bindEvents();
- this.doLayout();
- // init filters
- this.store.states.columns.forEach(function (column) {
- if (column.filteredValue && column.filteredValue.length) {
- _this4.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,
- renderExpanded: null,
- resizeProxyVisible: false
- };
- }
- };
- /***/ },
- /***/ 304:
- /***/ function(module, exports) {
- module.exports = require("element-ui/lib/checkbox");
- /***/ },
- /***/ 305:
- /***/ function(module, exports, __webpack_require__) {
- 'use strict';
- exports.__esModule = true;
- var _vue = __webpack_require__(56);
- var _vue2 = _interopRequireDefault(_vue);
- var _debounce = __webpack_require__(46);
- var _debounce2 = _interopRequireDefault(_debounce);
- var _util = __webpack_require__(306);
- 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);
- };
- 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 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: [],
- 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;
- 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) {
- var _this2 = this;
- states.data = sortData(states.filteredData || states._data || [], states);
- 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();
- },
- toggleRowExpanded: function toggleRowExpanded(states, row, expanded) {
- var expandRows = states.expandRows;
- if (typeof expanded !== 'undefined') {
- var index = expandRows.indexOf(row);
- if (expanded) {
- if (index === -1) expandRows.push(row);
- } else {
- if (index !== -1) expandRows.splice(index, 1);
- }
- } else {
- var _index = expandRows.indexOf(row);
- if (_index === -1) {
- expandRows.push(row);
- } else {
- expandRows.splice(_index, 1);
- }
- }
- this.table.$emit('expand', row, expandRows.indexOf(row) !== -1);
- },
- 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]);
- }
- states.originColumns = [].concat(states.fixedColumns).concat(_columns.filter(function (column) {
- return !column.fixed;
- })).concat(states.rightFixedColumns);
- states.columns = doFlattenColumns(states.originColumns);
- 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.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.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;
- /***/ },
- /***/ 306:
- /***/ function(module, exports) {
- '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 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 getValueByPath = exports.getValueByPath = function getValueByPath(object, prop) {
- prop = prop || '';
- var paths = prop.split('.');
- var current = object;
- var result = null;
- for (var i = 0, j = paths.length; i < j; i++) {
- var path = paths[i];
- if (!current) break;
- if (i === j - 1) {
- result = current[path];
- break;
- }
- current = current[path];
- }
- return result;
- };
- 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) {
- if (typeof reverse === 'string') {
- reverse = reverse === 'descending' ? -1 : 1;
- }
- if (!sortKey) {
- return array;
- }
- var order = reverse && reverse < 0 ? -1 : 1;
- // sort on a copy to avoid mutating original array
- return array.slice().sort(sortMethod ? function (a, b) {
- return sortMethod(a, b) ? order : -order;
- } : function (a, b) {
- if (sortKey !== '$key') {
- if (isObject(a) && '$value' in a) a = a.$value;
- if (isObject(b) && '$value' in b) b = b.$value;
- }
- a = isObject(a) ? getValueByPath(a, sortKey) : a;
- b = isObject(b) ? getValueByPath(b, sortKey) : b;
- return a === b ? 0 : a > b ? order : -order;
- });
- };
- 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') {
- return row[rowKey];
- } else if (typeof rowKey === 'function') {
- return rowKey.call(null, row);
- }
- };
- /***/ },
- /***/ 307:
- /***/ function(module, exports, __webpack_require__) {
- 'use strict';
- exports.__esModule = true;
- var _scrollbarWidth = __webpack_require__(256);
- 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.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 headerWrapper = this.table.$refs.headerWrapper;
- 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;
- }
- this.fixedBodyHeight = this.scrollX ? height - this.gutterWidth : height;
- } else {
- var headerHeight = this.headerHeight = headerWrapper.offsetHeight;
- var bodyHeight = height - headerHeight;
- 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;
- });
- if (bodyMinWidth < bodyWidth - this.gutterWidth) {
- // DON'T HAVE SCROLL BAR
- this.scrollX = false;
- var totalFlexWidth = bodyWidth - this.gutterWidth - 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;
- /***/ },
- /***/ 308:
- /***/ function(module, exports, __webpack_require__) {
- 'use strict';
- exports.__esModule = true;
- var _util = __webpack_require__(306);
- var _dom = __webpack_require__(117);
- var _checkbox = __webpack_require__(304);
- var _checkbox2 = _interopRequireDefault(_checkbox);
- var _tooltip = __webpack_require__(274);
- var _tooltip2 = _interopRequireDefault(_tooltip);
- var _debounce = __webpack_require__(46);
- 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
- },
- 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) {
- return h(
- 'td',
- {
- 'class': [column.id, column.align, column.className || '', columnsHidden[cellIndex] ? 'is-hidden' : ''],
- 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 rows = el.querySelectorAll('tbody > tr');
- var oldRow = rows[oldVal];
- var newRow = rows[newVal];
- if (oldRow) {
- oldRow.classList.remove('hover-row');
- }
- if (newRow) {
- newRow.classList.add('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 rows = el.querySelectorAll('tbody > tr');
- var oldRow = rows[data.indexOf(oldVal)];
- var newRow = rows[data.indexOf(newVal)];
- if (oldRow) {
- oldRow.classList.remove('current-row');
- } else if (rows) {
- [].forEach.call(rows, function (row) {
- return row.classList.remove('current-row');
- });
- }
- if (newRow) {
- newRow.classList.add('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;
- },
- 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.leftFixedCount;
- } else if (this.fixed === 'right') {
- return index < this.columnsCount - this.rightFixedCount;
- } else {
- return index < this.leftFixedCount || index >= this.columnsCount - this.rightFixedCount;
- }
- },
- getRowStyle: function getRowStyle(row, index) {
- var rowStyle = this.rowStyle;
- if (typeof rowStyle === 'function') {
- return rowStyle.call(null, row, index);
- }
- return rowStyle;
- },
- getRowClass: function getRowClass(row, index) {
- var classes = [];
- var rowClassName = this.rowClassName;
- if (typeof rowClassName === 'string') {
- classes.push(rowClassName);
- } else if (typeof rowClassName === 'function') {
- classes.push(rowClassName.call(null, row, index) || '');
- }
- 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) {
- var tooltip = this.$refs.tooltip;
- this.tooltipContent = cell.innerText;
- tooltip.referenceElm = cell;
- tooltip.$refs.popper.style.display = 'none';
- tooltip.doDestroy();
- this.activateTooltip(tooltip);
- }
- },
- handleCellMouseLeave: function handleCellMouseLeave(event) {
- this.$refs.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.commit('toggleRowExpanded', row);
- }
- }
- };
- /***/ },
- /***/ 309:
- /***/ function(module, exports, __webpack_require__) {
- 'use strict';
- exports.__esModule = true;
- var _checkbox = __webpack_require__(304);
- var _checkbox2 = _interopRequireDefault(_checkbox);
- var _tag = __webpack_require__(266);
- var _tag2 = _interopRequireDefault(_tag);
- var _vue = __webpack_require__(56);
- var _vue2 = _interopRequireDefault(_vue);
- var _filterPanel = __webpack_require__(310);
- 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);
- 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',
- null,
- [this._l(columnRows, function (columns, rowIndex) {
- return h(
- 'tr',
- null,
- [_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);
- }
- },
- 'class': [column.id, column.order, column.headerAlign, column.className || '', rowIndex === 0 && _this.isCellHidden(cellIndex, columns) ? 'is-hidden' : '', !column.children ? 'is-leaf' : '', column.labelClassName] },
- [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', on: {
- 'click': function click($event) {
- return _this.handleSortClick($event, column, 'ascending');
- }
- }
- },
- []
- ), h(
- 'i',
- { 'class': 'sort-caret descending', 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.fixed && _this.layout.gutterWidth ? 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: {
- 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;
- }
- },
- 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) {
- 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;
- }
- },
- 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;
- 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;
- columnEl.classList.add('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 () {
- columnEl.classList.remove('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';
- this.draggingColumn = column;
- } else if (!this.dragging) {
- bodyStyle.cursor = '';
- 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 (target.classList.contains('noclick')) {
- target.classList.remove('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: {}
- };
- }
- };
- /***/ },
- /***/ 310:
- /***/ function(module, exports, __webpack_require__) {
- var Component = __webpack_require__(3)(
- /* script */
- __webpack_require__(311),
- /* template */
- __webpack_require__(314),
- /* scopeId */
- null,
- /* cssModules */
- null
- )
- module.exports = Component.exports
- /***/ },
- /***/ 311:
- /***/ function(module, exports, __webpack_require__) {
- 'use strict';
- exports.__esModule = true;
- var _vuePopper = __webpack_require__(13);
- var _vuePopper2 = _interopRequireDefault(_vuePopper);
- var _popup = __webpack_require__(132);
- var _locale = __webpack_require__(60);
- var _locale2 = _interopRequireDefault(_locale);
- var _clickoutside = __webpack_require__(10);
- var _clickoutside2 = _interopRequireDefault(_clickoutside);
- var _dropdown = __webpack_require__(312);
- var _dropdown2 = _interopRequireDefault(_dropdown);
- var _checkbox = __webpack_require__(304);
- var _checkbox2 = _interopRequireDefault(_checkbox);
- var _checkboxGroup = __webpack_require__(313);
- 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();
- }
- }
- }
- }; //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- /***/ },
- /***/ 312:
- /***/ function(module, exports, __webpack_require__) {
- 'use strict';
- exports.__esModule = true;
- var _vue = __webpack_require__(56);
- 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);
- }
- }
- };
- /***/ },
- /***/ 313:
- /***/ function(module, exports) {
- module.exports = require("element-ui/lib/checkbox-group");
- /***/ },
- /***/ 314:
- /***/ function(module, exports) {
- module.exports={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', {
- directives: [{
- name: "model",
- rawName: "v-model",
- value: (_vm.filteredValue),
- expression: "filteredValue"
- }],
- staticClass: "el-table-filter__checkbox-group",
- domProps: {
- "value": (_vm.filteredValue)
- },
- on: {
- "input": function($event) {
- _vm.filteredValue = $event
- }
- }
- }, _vm._l((_vm.filters), function(filter) {
- return _c('el-checkbox', {
- 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
- },
- 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', {
- 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)])])
- },staticRenderFns: []}
- /***/ },
- /***/ 315:
- /***/ function(module, exports) {
- module.exports={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,
- 'el-table--fluid-height': _vm.maxHeight,
- 'el-table--enable-row-hover': !_vm.store.states.isComplex,
- 'el-table--enable-row-transition': true || (_vm.store.states.data || []).length !== 0 && (_vm.store.states.data || []).length < 100
- },
- 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', {
- 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",
- style: ([_vm.bodyHeight])
- }, [_c('table-body', {
- style: ({
- width: _vm.bodyWidth
- }),
- attrs: {
- "context": _vm.context,
- "store": _vm.store,
- "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()], 1), (_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', {
- 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,
- "layout": _vm.layout,
- "highlight": _vm.highlightCurrentRow,
- "row-class-name": _vm.rowClassName,
- "row-style": _vm.rowStyle
- }
- })], 1)]) : _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 || 1)) + 'px' : ''
- },
- _vm.fixedHeight
- ])
- }, [(_vm.showHeader) ? _c('div', {
- ref: "rightFixedHeaderWrapper",
- staticClass: "el-table__fixed-header-wrapper"
- }, [_c('table-header', {
- 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,
- "layout": _vm.layout,
- "row-class-name": _vm.rowClassName,
- "row-style": _vm.rowStyle,
- "highlight": _vm.highlightCurrentRow
- }
- })], 1)]) : _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"
- })])
- },staticRenderFns: []}
- /***/ }
- /******/ });
|