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.

Potentially problematic release.


This version of el-table-prepend might be problematic. Click here for more details.

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