el-table-prepend 1.2.2 → 1.2.3

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