mirror of
https://gitee.com/xuliangzhan_admin/vxe-table.git
synced 2026-01-21 05:27:57 +08:00
1 line
75 KiB
JavaScript
1 line
75 KiB
JavaScript
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _xeUtils=_interopRequireDefault(require("xe-utils")),_conf=_interopRequireDefault(require("../../conf")),_cell=_interopRequireDefault(require("../../cell")),_vXETable=require("../../v-x-e-table"),_tools=require("../../tools");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _defineProperty(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}var rowUniqueId=0,browse=_tools.DomTools.browse,isWebkit=browse["-webkit"]&&!browse["-ms"],debounceScrollYDuration=browse.msie?40:20;function getRowUniqueId(){return"row_".concat(++rowUniqueId)}function renderFixed(e,t,o){var l=t.tableData,i=t.tableColumn,n=t.visibleColumn,r=t.collectColumn,s=t.isGroup,a=t.vSize,c=t.showHeader,u=t.showFooter,h=t.columnStore,d=t.footerData,f=h["".concat(o,"List")];return e("div",{class:"vxe-table--fixed-".concat(o,"-wrapper"),ref:"".concat(o,"Container")},[c?e("vxe-table-header",{props:{fixedType:o,tableData:l,tableColumn:i,visibleColumn:n,collectColumn:r,size:a,fixedColumn:f,isGroup:s},ref:"".concat(o,"Header")}):null,e("vxe-table-body",{props:{fixedType:o,tableData:l,tableColumn:i,visibleColumn:n,collectColumn:r,fixedColumn:f,size:a,isGroup:s},ref:"".concat(o,"Body")}),u?e("vxe-table-footer",{props:{fixedType:o,footerData:d,tableColumn:i,visibleColumn:n,size:a,fixedColumn:f},ref:"".concat(o,"Footer")}):null])}var headerProps={children:"children"},_default2={name:"VxeTable",props:{data:Array,customs:Array,height:[Number,String],maxHeight:[Number,String],resizable:{type:Boolean,default:function(){return _conf.default.resizable}},stripe:{type:Boolean,default:function(){return _conf.default.stripe}},border:{type:Boolean,default:function(){return _conf.default.border}},size:{type:String,default:function(){return _conf.default.size}},fit:{type:Boolean,default:function(){return _conf.default.fit}},loading:Boolean,align:{type:String,default:function(){return _conf.default.align}},headerAlign:{type:String,default:function(){return _conf.default.headerAlign}},showHeader:{type:Boolean,default:function(){return _conf.default.showHeader}},startIndex:{type:Number,default:0},highlightCurrentRow:{type:Boolean,default:function(){return _conf.default.highlightCurrentRow}},highlightHoverRow:{type:Boolean,default:function(){return _conf.default.highlightHoverRow}},highlightCurrentColumn:{type:Boolean,default:function(){return _conf.default.highlightCurrentColumn}},highlightHoverColumn:{type:Boolean,default:function(){return _conf.default.highlightHoverColumn}},highlightCell:Boolean,showFooter:Boolean,footerMethod:Function,rowClassName:[String,Function],cellClassName:[String,Function],headerRowClassName:[String,Function],headerCellClassName:[String,Function],footerRowClassName:[String,Function],footerCellClassName:[String,Function],spanMethod:Function,showOverflow:{type:[Boolean,String],default:function(){return _conf.default.showOverflow}},showHeaderOverflow:{type:[Boolean,String],default:function(){return _conf.default.showHeaderOverflow}},remoteFilter:Boolean,remoteSort:Boolean,columnKey:Boolean,rowKey:Boolean,rowId:{type:String,default:function(){return _conf.default.rowId}},autoResize:Boolean,sortConfig:Object,radioConfig:Object,selectConfig:Object,tooltipConfig:Object,expandConfig:Object,treeConfig:Object,contextMenu:Object,mouseConfig:Object,keyboardConfig:Object,editConfig:Object,validConfig:Object,editRules:Object,optimization:Object},provide:function(){return{$table:this}},data:function(){return{id:_xeUtils.default.uniqueId(),collectColumn:[],tableFullColumn:[],tableColumn:[],tableData:[],scrollXLoad:!1,scrollYLoad:!1,overflowY:!0,overflowX:!1,scrollbarWidth:0,scrollbarHeight:0,isAllSelected:!1,isIndeterminate:!1,selection:[],currentRow:null,selectRow:null,footerData:[],expandeds:[],treeExpandeds:[],treeIndeterminates:[],filterStore:{isAllSelected:!1,isIndeterminate:!1,style:null,options:[],column:null,multiple:!1,visible:!1},columnStore:{leftList:[],centerList:[],rightList:[],resizeList:[],pxList:[],pxMinList:[],scaleList:[],scaleMinList:[],autoList:[]},ctxMenuStore:{selected:null,visible:!1,showChild:!1,selectChild:null,list:[],style:null},editStore:{indexs:{columns:[]},titles:{columns:[]},checked:{rows:[],columns:[],tRows:[],tColumns:[]},selected:{row:null,column:null},copyed:{cut:!1,rows:[],columns:[]},actived:{row:null,column:null},insertList:[],removeList:[]},validStore:{visible:!1,row:null,column:null,content:"",rule:null,isArrow:!1}}},computed:{vSize:function(){return this.size||this.$parent.size||this.$parent.vSize},validOpts:function(){return Object.assign({message:"default"},_conf.default.validConfig,this.validConfig)},optimizeOpts:function(){return Object.assign({},_conf.default.optimization,this.optimization)},vaildTipOpts:function(){return Object.assign({isArrow:!1},this.tooltipConfig)},sortOpts:function(){return Object.assign({},_conf.default.sortConfig,this.sortConfig)},isGroup:function(){return this.collectColumn.some(function(e){return _tools.UtilTools.hasChildrenList(e)})},hasTip:function(){return _conf.default._tip},visibleColumn:function(){return this.tableFullColumn?this.tableFullColumn.filter(function(e){return e.visible}):[]},isResizable:function(){return this.resizable||this.tableFullColumn.some(function(e){return e.resizable})},hasFilter:function(){return this.tableColumn.some(function(e){return e.filters&&e.filters.length})},headerCtxMenu:function(){return this.ctxMenuOpts.header&&this.ctxMenuOpts.header.options?this.ctxMenuOpts.header.options:[]},bodyCtxMenu:function(){return this.ctxMenuOpts.body&&this.ctxMenuOpts.body.options?this.ctxMenuOpts.body.options:[]},isCtxMenu:function(){return this.headerCtxMenu.length||this.bodyCtxMenu.length},ctxMenuOpts:function(){return Object.assign({},_conf.default.menu,this.contextMenu)},ctxMenuList:function(){var t=[];return this.ctxMenuStore.list.forEach(function(e){e.forEach(function(e){t.push(e)})}),t}},watch:{data:function(e){this._isUpdateData||this.loadData(e,!0).then(this.handleDefault),this._isUpdateData=!1},customs:function(e){this.isUpdateCustoms||this.mergeCustomColumn(e),this.isUpdateCustoms=!1},collectColumn:function(e){var t=_tools.UtilTools.getColumnList(e);if(this.tableFullColumn=t,this.cacheColumnMap(),this.customs&&this.mergeCustomColumn(this.customs),this.refreshColumn(),this._toolbar&&this._toolbar.updateColumn(t),t.length){var o=Math.floor((t.length-1)/2);t[o].prop&&console.warn("[vxe-table] The property prop is deprecated, please use field"),t[o].label&&console.warn("[vxe-table] The property label is deprecated, please use title")}},tableColumn:function(){this.analyColumnWidth()},height:function(){this.$nextTick(this.recalculate)},loading:function(){this._isLoading||(this._isLoading=!0)}},created:function(){var e=this,t=Object.assign(this,{elemStore:{},scrollXStore:{},scrollYStore:{},tooltipStore:{},parentHeight:0,tableWidth:0,tableHeight:0,headerHeight:0,footerHeight:0,lastScrollLeft:0,lastScrollTop:0,tableFullData:[],afterFullData:[],fullAllDataRowMap:new Map,fullAllDataRowIdData:{},fullDataRowMap:new Map,fullDataRowIdData:{},fullColumnMap:new Map,fullColumnIdData:{}}),o=t.scrollYStore,l=t.optimizeOpts,i=t.data,n=t.loading,r=l.scrollY;this._isLoading=n,r&&Object.assign(o,{startIndex:0,visibleIndex:0,adaptive:!_xeUtils.default.isBoolean(r.adaptive)||r.adaptive,renderSize:r.rSize,offsetSize:r.oSize}),this.loadData(i,!0).then(function(){e.handleDefault(),e.updateStyle()}),_tools.GlobalEvent.on(this,"mousedown",this.handleGlobalMousedownEvent),_tools.GlobalEvent.on(this,"blur",this.handleGlobalBlurEvent),_tools.GlobalEvent.on(this,"contextmenu",this.handleGlobalContextmenuEvent),_tools.GlobalEvent.on(this,"mousewheel",this.handleGlobalMousewheelEvent),_tools.GlobalEvent.on(this,"keydown",this.handleGlobalKeydownEvent),_tools.GlobalEvent.on(this,"resize",this.handleGlobalResizeEvent)},mounted:function(){this.autoResize&&_tools.ResizeEvent.on(this,this.$el.parentNode,this.recalculate),document.body.appendChild(this.$refs.tableWrapper)},activated:function(){this.scrollTo(this.lastScrollLeft,this.lastScrollTop)},beforeDestroy:function(){var e=this.$refs.tableWrapper;e&&e.parentNode&&e.parentNode.removeChild(e),_tools.ResizeEvent.off&&_tools.ResizeEvent.off(this,this.$el.parentNode),this.afterFullData.length=0,this.fullAllDataRowMap.clear(),this.fullDataRowMap.clear(),this.fullColumnMap.clear(),this.closeFilter(),this.closeMenu()},destroyed:function(){_tools.GlobalEvent.off(this,"mousedown"),_tools.GlobalEvent.off(this,"blur"),_tools.GlobalEvent.off(this,"contextmenu"),_tools.GlobalEvent.off(this,"mousewheel"),_tools.GlobalEvent.off(this,"keydown"),_tools.GlobalEvent.off(this,"resize")},render:function(e){var t,o=this._e,l=this.id,i=this.tableData,n=this.tableColumn,r=this.visibleColumn,s=this.collectColumn,a=this.isGroup,c=this.hasFilter,u=this.isResizable,h=this.isCtxMenu,d=this.loading,f=this._isLoading,g=this.showHeader,v=this.border,m=this.stripe,p=this.height,x=this.highlightHoverRow,b=this.highlightHoverColumn,w=this.highlightCell,C=this.vSize,_=this.showOverflow,T=this.showHeaderOverflow,S=this.editConfig,y=this.validOpts,D=this.mouseConfig,E=void 0===D?{}:D,R=this.editRules,k=this.showFooter,U=this.footerMethod,I=this.overflowX,$=this.overflowY,O=this.scrollbarHeight,M=this.optimizeOpts,N=this.vaildTipOpts,F=this.tooltipConfig,A=this.columnStore,L=this.filterStore,H=this.ctxMenuStore,z=this.footerData,W=this.hasTip,j=A.leftList,B=A.rightList;return e("div",{class:(t={"vxe-table":1},_defineProperty(t,"size--".concat(C),C),_defineProperty(t,"vxe-editable",S),_defineProperty(t,"show--head",g),_defineProperty(t,"show--foot",k),_defineProperty(t,"scroll--y",$),_defineProperty(t,"scroll--x",I),_defineProperty(t,"fixed--left",j.length),_defineProperty(t,"fixed--right",B.length),_defineProperty(t,"all-overflow",_),_defineProperty(t,"all-head-overflow",T),_defineProperty(t,"c--highlight",w),_defineProperty(t,"t--animat",M.animat),_defineProperty(t,"t--stripe",m),_defineProperty(t,"t--border",v),_defineProperty(t,"t--checked",E.checked),_defineProperty(t,"is--loading",d),_defineProperty(t,"row--highlight",x),_defineProperty(t,"column--highlight",b),t)},[e("div",{class:"vxe-table-hidden-column",ref:"hideColumn"},this.$slots.default),g?e("vxe-table-header",{ref:"tableHeader",props:{tableData:i,tableColumn:n,visibleColumn:r,collectColumn:s,size:C,isGroup:a}}):o(),e("vxe-table-body",{ref:"tableBody",props:{tableData:i,tableColumn:n,visibleColumn:r,collectColumn:s,size:C,isGroup:a}}),k?e("vxe-table-footer",{props:{footerData:z,footerMethod:U,tableColumn:n,visibleColumn:r,size:C},ref:"tableFooter"}):o(),j&&j.length&&I?renderFixed(e,this,"left"):o(),B&&B.length&&I?renderFixed(e,this,"right"):o(),u?e("div",{class:"vxe-table--resizable-bar",style:I?{"padding-bottom":"".concat(O,"px")}:null,ref:"resizeBar"}):o(),f?e("vxe-table-loading",{props:{visible:d}}):o(),e("div",{class:"vxe-table".concat(l,"-wrapper ").concat(this.$vnode.data.staticClass||""),ref:"tableWrapper"},[c?e("vxe-table-filter",{props:{optimizeOpts:M,filterStore:L},ref:"filterWrapper"}):o(),h?e("vxe-table-context-menu",{props:{ctxMenuStore:H},ref:"ctxWrapper"}):o(),W?e("vxe-tooltip",{ref:"tooltip",props:F}):o(),W&&R&&("default"===y.message?!p:"tooltip"===y.message)?e("vxe-tooltip",{class:"vxe-table--valid-error",props:"tooltip"===y.message||1===i.length?N:null,ref:"validTip"}):o()])])},methods:{clearAll:function(){return this.clearScroll(),this.clearSort(),this.clearFilter(),this.clearCurrentRow(),this.clearCurrentColumn(),this.clearSelection(),this.clearRowExpand(),this.clearTreeExpand(),this.clearIndexChecked(),this.clearHeaderChecked(),this.clearChecked(),this.clearSelected(),this.clearCopyed(),this.clearActived()},refreshData:function(){var e=this;return this.$nextTick().then(function(){return e.tableData=[],e.$nextTick().then(function(){return e.loadData(e.tableFullData)})})},loadData:function(e,t){var o=this,l=this.height,i=this.maxHeight,n=this.editStore,r=this.optimizeOpts,s=this.recalculate,a=r.scrollY,c=e?e.slice(0):[],u=a&&a.gt&&a.gt<c.length;if(n.insertList=[],n.removeList=[],this.tableFullData=c,this.updateCache(!0),this.tableSourceData=_xeUtils.default.clone(c,!0),(this.scrollYLoad=u)&&!l&&!i)throw new Error("[vxe-table] The height/max-height must be set for the scroll load.");this.tableData=this.getTableData(!0).tableData,this.reserveCheckSelection(),this.checkSelectionStatus();var h=this.$nextTick();return t||(h=h.then(s)),h.then(function(){(o.scrollXLoad||o.scrollYLoad)&&o.clearScroll()})},reloadData:function(e){return this.clearAll(),this.loadData(e).then(this.handleDefault)},loadColumn:function(e){var t=this;return this.collectColumn=_xeUtils.default.mapTree(e,function(e){return _cell.default.createColumn(t,e)},headerProps),this.$nextTick()},reloadColumn:function(e){return this.clearAll(),this.loadColumn(e)},updateCache:function(i){var n=this,e=this.treeConfig,t=this.tableFullData,r=this.fullDataRowIdData,s=this.fullDataRowMap,a=this.fullAllDataRowMap,c=this.fullAllDataRowIdData,u=_tools.UtilTools.getRowkey(this),o=function(e,t){var o=_tools.UtilTools.getRowid(n,e);o||(o=getRowUniqueId(),_xeUtils.default.set(e,u,o));var l={row:e,rowid:o,index:t};i&&(r[o]=l,s.set(e,l)),c[o]=l,a.set(e,l)};i&&(r=this.fullDataRowIdData={},s.clear()),c=this.fullAllDataRowIdData={},a.clear(),e?_xeUtils.default.eachTree(t,o,e):t.forEach(o)},cacheColumnMap:function(){var e=this.tableFullColumn,l=this.fullColumnMap,i=this.fullColumnIdData={};l.clear(),e.forEach(function(e,t){var o={column:e,colid:e.id,index:t};i[e.id]=o,l.set(e,o)})},getRowNode:function(e){var t=this;if(e){var o=this.treeConfig,l=this.tableFullData,i=this.fullAllDataRowIdData,n=e.getAttribute("data-rowid");if(o){var r=_xeUtils.default.findTree(l,function(e){return _tools.UtilTools.getRowid(t,e)===n},o);if(r)return r}else if(i[n]){var s=i[n];return{item:s.row,index:s.index,items:l}}}return null},getColumnNode:function(e){if(e){var t=this.isGroup,o=this.fullColumnIdData,l=this.tableFullColumn,i=e.getAttribute("data-colid");if(!t){var n=o[i];return{item:n.column,index:n.index,items:l}}var r=_xeUtils.default.findTree(l,function(e){return e.id===i},headerProps);if(r)return r}return null},getRowIndex:function(e){return this.fullDataRowMap.has(e)?this.fullDataRowMap.get(e).index:-1},getColumnIndex:function(e){return this.fullColumnMap.has(e)?this.fullColumnMap.get(e).index:-1},insert:function(e){return this.insertAt(e)},insertAt:function(e,t){var o=this,l=this.tableData,i=this.editStore,n=this.scrollYLoad,r=this.tableFullData,s=this.treeConfig,a=arguments;_xeUtils.default.isArray(e)||(e=[e]);var c=e.map(this.createRow);return new Promise(function(e){if(1===a.length)l.unshift.apply(l,c),r.unshift.apply(r,c),n&&o.updateAfterFullData();else{if(n)throw new Error("[vxe-table] Virtual scroller does not support this operation.");if(t&&-1!==t){if(s)throw new Error("[vxe-table] The tree table does not support this operation.");l.splice.apply(l,[l.indexOf(t),0].concat(c)),r.splice.apply(r,[r.indexOf(t),0].concat(c))}else l.push.apply(l,c),r.push.apply(r,c)}[].unshift.apply(i.insertList,c),o.updateCache(),o.checkSelectionStatus(),o.$nextTick(function(){o.recalculate(),e({row:c.length?c[c.length-1]:null,rows:c})})})},createRow:function(e){var t=Object.assign({},e),o=_tools.UtilTools.getRowkey(this);return this.visibleColumn.forEach(function(e){e.property&&!_xeUtils.default.has(t,e.property)&&_xeUtils.default.set(t,e.property,null)}),o&&!_xeUtils.default.get(t,o)&&_xeUtils.default.set(t,o,getRowUniqueId()),t},remove:function(r){var e=this,t=this.tableData,s=this.tableFullData,o=this.editStore,a=this.treeConfig,l=this.selectConfig,i=void 0===l?{}:l,c=this.selection,u=this.hasRowInsert,h=o.removeList,n=o.insertList,d=i.checkField,f=[];return r&&(_xeUtils.default.isArray(r)||(r=[r]),a?r.forEach(function(t){var e=_xeUtils.default.findTree(s,function(e){return e===t},a);if(e){var o=e.item,l=e.items,i=e.index;u(o)||h.push(o);var n=l.splice(i,1)[0];d||_xeUtils.default.remove(c,function(e){return-1<r.indexOf(e)}),f.push(n)}}):(r.forEach(function(e){u(e)||h.push(e)}),f=_xeUtils.default.remove(s,function(e){return-1<r.indexOf(e)}),d||_xeUtils.default.remove(c,function(e){return-1<r.indexOf(e)}),_xeUtils.default.remove(t,function(e){return-1<r.indexOf(e)})),_xeUtils.default.remove(n,function(e){return-1<r.indexOf(e)})),this.updateCache(),this.checkSelectionStatus(),this.$nextTick().then(function(){return e.recalculate(),{row:r&&r.length?r[r.length-1]:null,rows:f}})},removeSelecteds:function(){var t=this;return this.remove(this.getSelectRecords()).then(function(e){return t.clearSelection(),e})},revert:function(e,l){var i=this.tableSourceData,n=this.getRowIndex;return arguments.length?(e&&!_xeUtils.default.isArray(e)&&(e=[e]),e.forEach(function(e){var t=n(e),o=i[t];o&&e&&(l?_xeUtils.default.set(e,l,_xeUtils.default.get(o,l)):_xeUtils.default.destructuring(e,o))}),this.$nextTick()):this.reloadData(i)},clearData:function(e,t){var o=this.tableFullData,l=this.visibleColumn;return arguments.length?e&&!_xeUtils.default.isArray(e)&&(e=[e]):e=o,t?e.forEach(function(e){return _xeUtils.default.set(e,t,null)}):e.forEach(function(t){l.forEach(function(e){e.property&&_tools.UtilTools.setCellValue(t,e,null)})}),this.$nextTick()},hasRowInsert:function(e){return-1<this.editStore.insertList.indexOf(e)},hasRowChange:function(e,t){var o,l=this,i=this.treeConfig,n=this.tableSourceData,r=this.fullDataRowIdData,s=_tools.UtilTools.getRowid(this,e);if(!r[s])return!1;if(i){var a=i.children,c=_xeUtils.default.findTree(n,function(e){return s===_tools.UtilTools.getRowid(l,e)},i);e=Object.assign({},e,_defineProperty({},a,null)),c&&(o=Object.assign({},c.item,_defineProperty({},a,null)))}else{o=n[r[s].index]}return 1<arguments.length?o&&!_xeUtils.default.isEqual(_xeUtils.default.get(o,t),_xeUtils.default.get(e,t)):o&&!_xeUtils.default.isEqual(o,e)},getColumns:function(e){var t=this.visibleColumn;return arguments.length?t[e]:t.slice(0)},getColumnById:function(e){var t=this.fullColumnIdData;return t[e]?t[e].column:null},getTableColumn:function(){return{fullColumn:this.tableFullColumn.slice(0),visibleColumn:this.visibleColumn.slice(0),tableColumn:this.tableColumn.slice(0)}},getRecords:function(){return console.warn("[vxe-table] The function getRecords is deprecated, please use getData"),this.getData.apply(this,arguments)},getData:function(e){var t=this.tableFullData;return arguments.length?t[e]:t.slice(0)},getAllRecords:function(){return console.warn("[vxe-table] The function getAllRecords is deprecated, please use getRecordset"),this.getRecordset()},getRecordset:function(){return{insertRecords:this.getInsertRecords(),removeRecords:this.getRemoveRecords(),updateRecords:this.getUpdateRecords()}},getInsertRecords:function(){return this.editStore.insertList},getRemoveRecords:function(){return this.editStore.removeList},getSelectRecords:function(){var e=this.tableFullData,t=this.editStore,o=this.treeConfig,l=this.selectConfig,i=(void 0===l?{}:l).checkField,n=[],r=[];if(i)n=o?_xeUtils.default.filterTree(e,function(e){return _xeUtils.default.get(e,i)},o):e.filter(function(e){return _xeUtils.default.get(e,i)}),r=t.insertList.filter(function(e){return _xeUtils.default.get(e,i)});else{var s=this.selection;n=o?_xeUtils.default.filterTree(e,function(e){return-1<s.indexOf(e)},o):e.filter(function(e){return-1<s.indexOf(e)}),r=t.insertList.filter(function(e){return-1<s.indexOf(e)})}return n.concat(r)},getUpdateRecords:function(){var e=this.tableFullData,t=this.hasRowChange,o=this.treeConfig;return o?_xeUtils.default.filterTree(e,function(e){return t(e)},o):e.filter(function(e){return t(e)})},updateAfterFullData:function(){var e=this.visibleColumn,t=this.tableFullData,o=this.remoteSort,c=this.remoteFilter,l=e.find(function(e){return e.order}),i=t,n=e.filter(function(e){var t=e.filters;return t&&t.length});if((i=i.filter(function(a){return n.every(function(t){var e=t.filters,o=t.filterRender,l=o?_vXETable.Renderer.get(o.name):null,i=[],n=[];if(e&&e.length&&(e.forEach(function(e){e.checked&&(n.push(e),i.push(e.value))}),i.length&&!c)){var r=t.property,s=t.filterMethod;return!s&&l&&l.renderFilter&&(s=l.filterMethod),s?n.some(function(e){return s({value:e.value,option:e,row:a,column:t})}):-1<i.indexOf(_xeUtils.default.get(a,r))}return!0})}),l&&l.order)&&!(_xeUtils.default.isBoolean(l.remoteSort)?l.remoteSort:o)){var r=_xeUtils.default.sortBy(i,l.property);i="desc"===l.order?r.reverse():r}return this.afterFullData=i},getRowById:function(e){var t=this.fullDataRowIdData;return t[e]?t[e].row:null},getTableData:function(e){var t=this.tableFullData,o=this.scrollYLoad,l=this.scrollYStore,i=e?this.updateAfterFullData():this.afterFullData;return{fullData:t.slice(0),visibleData:i,tableData:o?i.slice(l.startIndex,l.startIndex+l.renderSize):i.slice(0)}},handleDefault:function(){this.selectConfig&&this.handleSelectionDefChecked(),this.radioConfig&&this.handleRadioDefChecked(),this.expandConfig&&this.handleDefaultRowExpand(),this.treeConfig&&this.handleDefaultTreeExpand(),this.updateFooter(),this.$nextTick(this.recalculate)},mergeCustomColumn:function(o){var e=this.tableFullColumn;this.isUpdateCustoms=!0,o.length&&e.forEach(function(t){var e=o.find(function(e){return t.property&&(e.field||e.prop)===t.property});e&&(_xeUtils.default.isNumber(e.resizeWidth)&&(t.resizeWidth=e.resizeWidth),_xeUtils.default.isBoolean(e.visible)&&(t.visible=e.visible))}),this.$emit("update:customs",e)},resetAll:function(){this.resetCustoms(),this.resetResizable()},hideColumn:function(e){return this.handleVisibleColumn(e,!1)},showColumn:function(e){return this.handleVisibleColumn(e,!0)},resetCustoms:function(){return this.handleVisibleColumn()},handleVisibleColumn:function(e,t){return arguments.length?e.visible=t:this.tableFullColumn.forEach(function(e){e.visible=!0}),this._toolbar&&this._toolbar.updateSetting(),this.$nextTick()},reloadCustoms:function(e){var t=this;return this.$nextTick().then(function(){return t.mergeCustomColumn(e),t.refreshColumn().then(function(){return t.tableFullColumn})})},refreshColumn:function(){var o,e=this,l=0,i=[],n=0,r=[],s=[],t=this.tableFullColumn,a=this.isGroup,c=this.columnStore,u=this.scrollXStore,h=this.optimizeOpts.scrollX;a&&_xeUtils.default.eachTree(this.collectColumn,function(e){e.children&&e.children.length&&(e.visible=!!_xeUtils.default.findTree(e.children,function(e){return e.children&&e.children.length?0:e.visible},headerProps))},headerProps),t.filter(function(e){return e.visible}).forEach(function(e,t){"left"===e.fixed?(o||(t-l!=0?o=!0:l++),i.push(e)):"right"===e.fixed?(o||(n||(n=t),t-n!=0?o=!0:n++),s.push(e)):r.push(e)});var d=i.concat(r).concat(s),f=h&&h.gt&&h.gt<t.length;if(Object.assign(c,{leftList:i,centerList:r,rightList:s}),o&&a||n&&n!==d.length)throw new Error("[vxe-table] Fixed column must to the left and right sides.");return f&&(Object.assign(u,{startIndex:0,visibleIndex:0,adaptive:!_xeUtils.default.isBoolean(h.adaptive)||h.adaptive,renderSize:h.rSize,offsetSize:h.oSize}),d=d.slice(u.startIndex,u.startIndex+u.renderSize)),this.scrollXLoad=f,this.tableColumn=d,this.$nextTick().then(function(){e.updateFooter(),e.recalculate(!0)})},analyColumnWidth:function(){var t=[],o=[],l=[],i=[],n=[],r=[];this.tableFullColumn.forEach(function(e){e.visible&&(e.resizeWidth?t.push(e):_tools.DomTools.isPx(e.width)?o.push(e):_tools.DomTools.isScale(e.width)?i.push(e):_tools.DomTools.isPx(e.minWidth)?l.push(e):_tools.DomTools.isScale(e.minWidth)?n.push(e):r.push(e))}),Object.assign(this.columnStore,{resizeList:t,pxList:o,pxMinList:l,scaleList:i,scaleMinList:n,autoList:r})},recalculate:function(e){var t=this,o=this.$refs,l=o.tableBody,i=o.tableHeader,n=o.tableFooter,r=l?l.$el:null,s=i?i.$el:null,a=n?n.$el:null;return r&&(this.autoCellWidth(s,r,a),!0===e)?this.computeScrollLoad().then(function(){t.autoCellWidth(s,r,a),t.computeScrollLoad()}):this.computeScrollLoad()},autoCellWidth:function(e,t,o){var l,i=0,n=t.clientWidth,r=n,s=this.$el,a=this.fit,c=this.columnStore,u=c.resizeList,h=c.pxMinList,d=c.pxList,f=c.scaleList,g=c.scaleMinList,v=c.autoList;h.forEach(function(e){var t=parseInt(e.minWidth);i+=t,e.renderWidth=t}),l=r/100,g.forEach(function(e){var t=Math.floor(parseInt(e.minWidth)*l);i+=t,e.renderWidth=t}),f.forEach(function(e){var t=Math.floor(parseInt(e.width)*l);i+=t,e.renderWidth=t}),d.forEach(function(e){var t=parseInt(e.width);i+=t,e.renderWidth=t}),u.forEach(function(e){var t=parseInt(e.resizeWidth);i+=t,e.renderWidth=t}),l=0<(r-=i)?Math.max(Math.floor(r/(g.length+h.length+v.length)),40):40,a?0<r&&g.concat(h).forEach(function(e){i+=l,e.renderWidth+=l}):l=40,v.forEach(function(e,t){if(e.renderWidth=l,i+=l,a&&t===v.length-1){var o=n-i;0<o&&(e.renderWidth+=o,i=n)}});var m=t.offsetHeight,p=t.scrollHeight>t.clientHeight;if(this.scrollbarWidth=p?t.offsetWidth-n:0,this.overflowY=p,this.tableWidth=i,this.tableHeight=m,this.parentHeight=s.parentNode.clientHeight,e&&(this.headerHeight=e.offsetHeight),o){var x=o.offsetHeight;this.scrollbarHeight=Math.max(x-o.clientHeight,0),this.overflowX=i>o.clientWidth,this.footerHeight=x}else this.scrollbarHeight=Math.max(m-t.clientHeight,0),this.overflowX=n<i;this.overflowX&&this.checkScrolling()},resetResizable:function(){return this.visibleColumn.forEach(function(e){e.resizeWidth=0}),this._toolbar&&this._toolbar.resetResizable(),this.analyColumnWidth(),this.recalculate(!0)},updateStyle:function(){var t=this.$refs,m=this.fullColumnIdData,p=this.maxHeight,e=this.height,x=this.parentHeight,b=this.border,w=this.tableColumn,C=this.headerHeight,_=this.showHeaderOverflow,T=this.showFooter,S=this.showOverflow,y=this.footerHeight,D=this.tableHeight,E=this.tableWidth,R=this.overflowY,k=this.scrollbarHeight,U=this.scrollbarWidth,I=this.scrollXLoad,$=this.columnStore,O=this.elemStore,o=this.currentRow,M="auto"===e?x:_tools.DomTools.isScale(e)?Math.floor(parseInt(e)/100*x):_xeUtils.default.toNumber(e);return["main","left","right"].forEach(function(d,e){var f=0<e?d:"",g=$["".concat(f,"List")],v=t["".concat(f,"Container")];["header","body","footer"].forEach(function(c){var e=O["".concat(d,"-").concat(c,"-wrapper")],t=O["".concat(d,"-").concat(c,"-table")];if("header"===c){var o=E;I&&(f&&(w=g),o=w.reduce(function(e,t){return e+t.renderWidth},0)),t&&(t.style.width=null===o?o:"".concat(o+U,"px"));var l=O["".concat(d,"-").concat(c,"-repair")];l&&(l.style.width="".concat(E,"px"));var i=O["".concat(d,"-").concat(c,"-list")];i&&_xeUtils.default.arrayEach(i.querySelectorAll(".col--gutter"),function(e){e.style.width="".concat(U,"px")})}else if("body"===c){var n=O["".concat(d,"-").concat(c,"-emptyBlock")];if(e&&(0<M?e.style.height="".concat(f?(0<M?M-C-y:D)-(T?0:k):M-C-y,"px"):p&&(p=_tools.DomTools.isScale(p)?Math.floor(parseInt(p)/100*x):_xeUtils.default.toNumber(p),e.style.maxHeight="".concat(f?p-C-(T?0:k):p-C,"px"))),v){var r="right"===f,s=$["".concat(f,"List")];e.style.top="".concat(C,"px"),v.style.height="".concat((0<M?M-C-y:D)+C+y-k*(T?2:1),"px"),v.style.width="".concat(s.reduce(function(e,t){return e+t.renderWidth},r?U:0),"px")}var a=E;f&&S?a=(w=g).reduce(function(e,t){return e+t.renderWidth},0):I&&(f&&(w=g),a=w.reduce(function(e,t){return e+t.renderWidth},0)),t&&(t.style.width=a?"".concat(a,"px"):a,R&&f&&(browse["-moz"]||browse.safari)&&(t.style.paddingRight="".concat(U,"px"))),n&&(n.style.width=a?"".concat(a,"px"):a)}else if("footer"===c){var u=E;f&&S?u=(w=g).reduce(function(e,t){return e+t.renderWidth},0):I&&(f&&(w=g),u=w.reduce(function(e,t){return e+t.renderWidth},0)),e&&(v&&(e.style.top="".concat(M?M-y:D+C,"px")),e.style.marginTop="".concat(-k-1,"px")),t&&(t.style.width=null===u?u:"".concat(u+U,"px"))}var h=O["".concat(d,"-").concat(c,"-colgroup")];h&&_xeUtils.default.arrayEach(h.children,function(e){var t=e.getAttribute("name");if("col-gutter"===t&&(e.width="".concat(U||"")),m[t]){var o,l=m[t].column,i=l.showHeaderOverflow,n=l.showOverflow,r=l.renderWidth;e.width="".concat(l.renderWidth||"");var s="title"===(o="header"===c?_xeUtils.default.isUndefined(i)||_xeUtils.default.isNull(i)?_:i:_xeUtils.default.isUndefined(n)||_xeUtils.default.isNull(n)?S:n)||(!0===o||"tooltip"===o)||"ellipsis"===o,a=O["".concat(d,"-").concat(c,"-list")];a&&s&&_xeUtils.default.arrayEach(a.querySelectorAll(".".concat(l.id)),function(e){var t=e.querySelector(".vxe-cell");t&&(t.style.width="".concat(b?r-1:r,"px"))})}})})}),o&&this.setCurrentRow(o),this.$nextTick()},checkScrolling:function(){var e=this.$refs,t=e.tableBody,o=e.leftContainer,l=e.rightContainer,i=t?t.$el:null;i&&(o&&_tools.DomTools[0<i.scrollLeft?"addClass":"removeClass"](o,"scrolling--middle"),l&&_tools.DomTools[i.clientWidth<i.scrollWidth-i.scrollLeft?"addClass":"removeClass"](l,"scrolling--middle"))},preventEvent:function(t,e,o,l){var i=this;_vXETable.Interceptor.get(e).some(function(e){return!1===e(o,t,i)})||l()},handleGlobalMousedownEvent:function(i){var n=this,r=this.$el,e=this.$refs,t=this.editStore,o=this.ctxMenuStore,l=this.editConfig,s=void 0===l?{}:l,a=this.filterStore,c=t.actived,u=e.filterWrapper,h=e.validTip;u&&(this.getEventTargetNode(i,r,"vxe-filter-wrapper").flag||this.getEventTargetNode(i,u.$el).flag||this.preventEvent(i,"event.clear_filter",a.args,this.closeFilter)),c.row&&!1!==s.autoClear&&(h&&this.getEventTargetNode(i,h.$el).flag||(!this.lastCallTime||this.lastCallTime+50<Date.now())&&this.preventEvent(i,"event.clear_actived",c.args,function(){var e,t=!n.getEventTargetNode(i,r,"col--edit").flag;if("row"===s.mode){var o=n.getEventTargetNode(i,r,"vxe-body--row"),l=o.flag?o.targetElem!==c.args.cell.parentNode:0;e="manual"===s.trigger?l:l&&t}else e=t;!e&&n.getEventTargetNode(i,r).flag||setTimeout(function(){return n.clearActived(i)})})),o.visible&&this.$refs.ctxWrapper&&!this.getEventTargetNode(i,this.$refs.ctxWrapper.$el).flag&&this.closeMenu()},handleGlobalBlurEvent:function(e){this.closeFilter(),this.closeMenu()},handleGlobalMousewheelEvent:function(e){this.clostTooltip(),this.closeMenu()},handleGlobalKeydownEvent:function(e){var t,o=this,l=this.isCtxMenu,i=this.ctxMenuStore,n=this.editStore,r=this.mouseConfig,s=void 0===r?{}:r,a=this.keyboardConfig,c=void 0===a?{}:a,u=this.treeConfig,h=this.highlightCurrentRow,d=this.currentRow,f=n.selected,g=n.actived,v=e.keyCode,m=8===v,p=9===v,x=13===v,b=27===v,w=32===v,C=37===v,_=38===v,T=39===v,S=40===v,y=46===v,D=65===v,E=67===v,R=86===v,k=88===v,U=113===v,I=e.ctrlKey,$=C||_||T||S,O=l&&i.visible&&(x||w||$);if(b)this.closeMenu(),this.closeFilter(),g.row&&(t=g.args,this.clearActived(e),s.selected&&this.handleSelected(t,e));else if(x&&(c.isArrow||c.isTab)&&(f.row||g.row||u&&h&&d)){if(f.row||g.row)this.moveSelected(f.row?f.args:g.args,C,_,T,!0,e);else if(u&&h&&d){var M=d[u.children];if(M&&M.length){var N=M[0];t={$table:this,row:N},this.setTreeExpansion(d,!0).then(function(){return o.scrollToRow(N)}).then(function(){return o.triggerCurrentRowEvent(e,t)})}}}else if(O)e.preventDefault(),i.showChild&&_tools.UtilTools.hasChildrenList(i.selected)?this.moveCtxMenu(e,v,i,"selectChild",37,!1,i.selected.children):this.moveCtxMenu(e,v,i,"selected",39,!0,this.ctxMenuList);else if(U)f.row&&f.column&&this.handleActived(f.args,e);else if($&&c.isArrow)f.row&&f.column?(e.preventDefault(),this.moveSelected(f.args,C,_,T,S,e)):(_||S)&&h&&d&&this.moveCurrentRow(_,S,e);else if(p&&c.isTab)f.row||f.column?(e.preventDefault(),this.moveTabSelected(f.args,e)):(g.row||g.column)&&(e.preventDefault(),this.moveTabSelected(g.args,e));else if(y||(u&&h&&d?m&&c.isArrow:m)){if(c.isDel&&(f.row||f.column))_tools.UtilTools.setCellValue(f.row,f.column,null),m&&this.handleActived(f.args,e);else if(m&&c.isArrow&&u&&h&&d){var F=_xeUtils.default.findTree(this.afterFullData,function(e){return e===d},u).parent;F&&(t={$table:this,row:F},this.setTreeExpansion(F,!1).then(function(){return o.scrollToRow(F)}).then(function(){return o.triggerCurrentRowEvent(e,t)}))}}else c.isCut&&I&&(D||k||E||R)?D?this.handleAllChecked(e):k||E?this.handleCopyed(k,e):this.handlePaste(e):c.isEdit&&!I&&(48<=v&&v<=57||65<=v&&v<=90||96<=v&&v<=111||186<=v&&v<=192||219<=v&&v<=222||32===v)&&f.column&&f.row&&f.column.editRender&&(c.editMethod&&!1===c.editMethod(f.args,e)||(_tools.UtilTools.setCellValue(f.row,f.column,null),this.handleActived(f.args,e)))},moveTabSelected:function(e,t){for(var o,l,i,n,r=this.tableData,s=this.visibleColumn,a=this.editConfig,c=Object.assign({},e),u=r.indexOf(c.row),h=s.indexOf(c.column)+1;h<s.length;h++)if(s[h]){i=s[n=h];break}if(!i&&u<r.length-1){o=r[l=u+1];for(var d=0;d<s.length;d++)if(s[d]){i=s[n=d];break}}i&&(o?(c.rowIndex=l,c.row=o):c.rowIndex=u,c.columnIndex=n,c.column=i,c.cell=_tools.DomTools.getCell(this,c),a&&("click"!==a.trigger&&"dblclick"!==a.trigger||("row"===a.mode?this.handleActived(c,t):(this.handleSelected(c,t),this.scrollToRow(c.row,c.column)))))},moveCurrentRow:function(e,t,o){var l,i=this,n=this.currentRow,r=this.treeConfig,s=this.afterFullData;if(o.preventDefault(),r){var a=_xeUtils.default.findTree(s,function(e){return e===n},r),c=a.index,u=a.items;e&&0<c?l=u[c-1]:t&&c<u.length-1&&(l=u[c+1])}else{var h=s.indexOf(n);e&&0<h?l=s[h-1]:t&&h<s.length-1&&(l=s[h+1])}if(l){var d={$table:this,row:l};this.scrollToRow(l).then(function(){return i.triggerCurrentRowEvent(o,d)})}},moveSelected:function(e,t,o,l,i,n){var r=this.tableData,s=this.visibleColumn,a=Object.assign({},e);if(o&&a.rowIndex)a.rowIndex-=1,a.row=r[a.rowIndex];else if(i&&a.rowIndex<r.length-1)a.rowIndex+=1,a.row=r[a.rowIndex];else if(t&&a.columnIndex){for(var c=a.columnIndex-1;0<=c;c--)if(s[c]){a.columnIndex=c,a.column=s[c];break}}else if(l)for(var u=a.columnIndex+1;u<s.length;u++)if(s[u]){a.columnIndex=u,a.column=s[u];break}a.cell=_tools.DomTools.getCell(this,a),this.handleSelected(a,n),this.scrollToRow(a.row,a.column)},moveCtxMenu:function(e,t,o,l,i,n,r){var s=_xeUtils.default.findIndexOf(r,function(e){return o[l]===e});t===i?n&&_tools.UtilTools.hasChildrenList(o.selected)?o.showChild=!0:(o.showChild=!1,o.selectChild=null):38===t?o[l]=r[s-1]||r[r.length-1]:40===t?o[l]=r[s+1]||r[0]:!o[l]||13!==t&&32!==t||this.ctxMenuLinkEvent(e,o[l])},handleGlobalResizeEvent:function(){this.recalculate()},handleGlobalContextmenuEvent:function(e){var t=this.isCtxMenu,o=this.ctxMenuStore,l=this.ctxMenuOpts,i=["header","body","footer"];if(t){if(o.visible&&o.visible&&this.$refs.ctxWrapper&&this.getEventTargetNode(e,this.$refs.ctxWrapper.$el).flag)return void e.preventDefault();for(var n=0;n<i.length;n++){var r=i[n],s=this.getEventTargetNode(e,this.$el,"vxe-".concat(r,"--column")),a={type:r,$table:this};if(s.flag){var c=s.targetElem,u=this.getColumnNode(c).item,h="".concat(r,"-");if(Object.assign(a,{column:u,columnIndex:this.getColumnIndex(u),cell:c}),"body"===r){var d=this.getRowNode(c.parentNode).item;h="",a.row=d,a.rowIndex=this.getRowIndex(d)}return this.openContextMenu(e,r,a),void _tools.UtilTools.emitEvent(this,"".concat(h,"cell-context-menu"),[a,e])}if(this.getEventTargetNode(e,this.$el,"vxe-table--".concat(r,"-wrapper")).flag)return void("cell"===l.trigger?e.preventDefault():this.openContextMenu(e,r,a))}}this.closeMenu(),this.closeFilter()},openContextMenu:function(n,e,t){var r=this,s=this.ctxMenuStore,o=this.ctxMenuOpts,l=o[e],i=o.visibleMethod;if(l){var a=l.options;if(l.disabled)n.preventDefault();else if(a&&a.length)if(!i||i(t,n)){n.preventDefault();var c=_tools.DomTools.getDomNode(),u=c.scrollTop,h=c.scrollLeft,d=c.visibleHeight,f=c.visibleWidth,g=n.clientY+u,v=n.clientX+h;Object.assign(s,{args:t,visible:!0,list:a,selected:null,selectChild:null,showChild:!1,style:{top:"".concat(g,"px"),left:"".concat(v,"px")}}),this.$nextTick(function(){var e=r.$refs.ctxWrapper.$el,t=e.clientHeight,o=e.clientWidth,l=n.clientY+t-d,i=n.clientX+o-f;-10<l&&(s.style.top="".concat(g-t,"px")),-10<i&&(s.style.left="".concat(v-o,"px"))})}else this.closeMenu()}this.closeFilter()},closeMenu:function(){return Object.assign(this.ctxMenuStore,{visible:!1,selected:null,selectChild:null,showChild:!1}),this.$nextTick()},ctxMenuMouseoverEvent:function(e,t,o){var l=this.ctxMenuStore;e.preventDefault(),e.stopPropagation(),l.selected=t,(l.selectChild=o)||(l.showChild=_tools.UtilTools.hasChildrenList(t))},ctxMenuMouseoutEvent:function(e,t,o){var l=this.ctxMenuStore;t.children||(l.selected=null),l.selectChild=null},ctxMenuLinkEvent:function(e,t){t.disabled||t.children&&t.children.length||(_tools.UtilTools.emitEvent(this,"context-menu-click",[Object.assign({menu:t},this.ctxMenuStore.args),e]),this.closeMenu())},triggerHeaderTooltipEvent:function(e,t){var o=t.column,l=this.tooltipStore,i=o.own;l.column===o&&l.visible||this.showTooltip(e,_tools.UtilTools.getFuncText(i.title||i.label),o)},triggerFooterTooltipEvent:function(e,t){var o=t.$rowIndex,l=t.column,i=this.tooltipStore;i.column===l&&i.visible||this.showTooltip(e,this.footerData[o][this.tableColumn.indexOf(l)],l)},triggerTooltipEvent:function(e,t){var o=this.editConfig,l=this.editStore,i=this.tooltipStore,n=l.actived,r=t.row,s=t.column;o&&("row"===o.mode&&n.row===r||n.row===r&&n.column===s)||i.column===s&&i.row===r&&i.visible||this.showTooltip(e,_tools.UtilTools.getCellLabel(r,s,t),s,r)},showTooltip:function(e,t,o,l){var i=e.currentTarget,n=this.$refs.tooltip,r=i.children[0];return t&&r.scrollWidth>r.clientWidth&&(Object.assign(this.tooltipStore,{row:l,column:o,visible:!0}),n&&n.toVisible(i,_tools.UtilTools.formatText(t))),this.$nextTick()},clostTooltip:function(){var e=this.$refs.tooltip;return Object.assign(this.tooltipStore,{row:null,column:null,content:null,visible:!1}),e&&e.close(),this.$nextTick()},handleSelectionDefChecked:function(){var e=this.selectConfig,t=void 0===e?{}:e,o=this.fullDataRowIdData,l=t.checkAll,i=t.checkRowKeys;if(l)this.setAllSelection(!0);else if(i){var n=[];i.forEach(function(e){o[e]&&n.push(o[e].row)}),this.setSelection(n,!0)}},setSelection:function(e,t){var o=this;return e&&!_xeUtils.default.isArray(e)&&(e=[e]),e.forEach(function(e){return o.handleSelectRow({row:e},!!t)}),this.$nextTick()},handleSelectRow:function(e,o){var l=e.row,i=this.selection,t=this.tableFullData,n=this.selectConfig,r=void 0===n?{}:n,s=this.treeConfig,a=this.treeIndeterminates,c=r.checkField,u=r.checkStrictly,h=r.checkMethod;if(c)if(s&&!u){-1===o?(a.push(l),_xeUtils.default.set(l,c,!1)):(_xeUtils.default.eachTree([l],function(e,t){l!==e&&h&&!h({row:e,$rowIndex:t})||_xeUtils.default.set(e,c,o)},s),_xeUtils.default.remove(a,function(e){return e===l}));var d=_xeUtils.default.findTree(t,function(e){return e===l},s);if(d&&d.parent){var f,g=h?d.items.filter(function(e,t){return h({row:e,$rowIndex:t})}):d.items;if(d.items.find(function(e){return-1<a.indexOf(e)}))f=-1;else{var v=d.items.filter(function(e){return _xeUtils.default.get(e,c)});f=v.filter(function(e){return-1<g.indexOf(e)}).length===g.length||!(!v.length&&-1!==o)&&-1}return this.handleSelectRow({row:d.parent},f)}}else _xeUtils.default.set(l,c,o);else if(s&&!u){-1===o?(a.push(l),_xeUtils.default.remove(i,function(e){return e===l})):(_xeUtils.default.eachTree([l],function(t,e){l!==t&&h&&!h({row:t,$rowIndex:e})||(o?i.push(t):_xeUtils.default.remove(i,function(e){return e===t}))},s),_xeUtils.default.remove(a,function(e){return e===l}));var m=_xeUtils.default.findTree(t,function(e){return e===l},s);if(m&&m.parent){var p,x=h?m.items.filter(function(e,t){return h({row:e,$rowIndex:t})}):m.items;if(m.items.find(function(e){return-1<a.indexOf(e)}))p=-1;else{var b=m.items.filter(function(e){return-1<i.indexOf(e)});p=b.filter(function(e){return-1<x.indexOf(e)}).length===x.length||!(!b.length&&-1!==o)&&-1}return this.handleSelectRow({row:m.parent},p)}}else o?-1===i.indexOf(l)&&i.push(l):_xeUtils.default.remove(i,function(e){return e===l});this.checkSelectionStatus()},handleToggleCheckRowEvent:function(e,t){var o=this.selectConfig,l=void 0===o?{}:o,i=this.selection,n=l.checkField,r=e.row,s=n?!_xeUtils.default.get(r,n):-1===i.indexOf(r);t?this.triggerCheckRowEvent(t,e,s):this.handleSelectRow(e,s)},triggerCheckRowEvent:function(e,t,o){this.handleSelectRow(t,o),_tools.UtilTools.emitEvent(this,"select-change",[Object.assign({selection:this.getSelectRecords(),checked:o},t),e])},toggleRowSelection:function(e){return this.handleToggleCheckRowEvent({row:e}),this.$nextTick()},setAllSelection:function(o){var e=this.tableFullData,t=this.editStore,l=this.selectConfig,i=void 0===l?{}:l,n=this.treeConfig,r=this.selection,s=i.checkField,a=i.reserve,c=i.checkStrictly,u=i.checkMethod,h=t.insertList,d=[];if(h.length&&(e=e.concat(h)),!c){if(s){var f="".concat(n?"$":"","rowIndex"),g=function(e,t){u&&!u(_defineProperty({row:e},f,t))||_xeUtils.default.set(e,s,o)},v=function(e,t){(!u||!u(_defineProperty({row:e},f,t))&&-1<r.indexOf(e))&&_xeUtils.default.set(e,s,o)};n?_xeUtils.default.eachTree(e,o?g:v,n):e.forEach(o?g:v)}else n?o?_xeUtils.default.eachTree(e,function(e,t){u&&!u({row:e,$rowIndex:t})||d.push(e)},n):u&&_xeUtils.default.eachTree(e,function(e,t){!u({row:e,$rowIndex:t})&&-1<r.indexOf(e)&&d.push(e)},n):o?d=u?e.filter(function(e,t){return-1<r.indexOf(e)||u({row:e,rowIndex:t})}):e.slice(0):u&&(d=e.filter(function(e,t){return u({row:e,rowIndex:t})?0:-1<r.indexOf(e)}));this.selection=o&&a?r.concat(d.filter(function(e){return-1===r.indexOf(e)})):d}this.treeIndeterminates=[],this.checkSelectionStatus()},checkSelectionStatus:function(){var e=this.tableFullData,t=this.editStore,o=this.selectConfig,l=void 0===o?{}:o,i=this.selection,n=this.treeIndeterminates,r=l.checkField,s=l.checkStrictly,a=l.checkMethod,c=t.insertList;c.length&&(e=e.concat(c)),s||(r?(this.isAllSelected=e.length&&e.every(a?function(e,t){return!a({row:e,rowIndex:t})||_xeUtils.default.get(e,r)}:function(e){return _xeUtils.default.get(e,r)}),this.isIndeterminate=!this.isAllSelected&&e.some(function(e){return _xeUtils.default.get(e,r)||-1<n.indexOf(e)})):(this.isAllSelected=e.length&&e.every(a?function(e,t){return!a({row:e,rowIndex:t})||-1<i.indexOf(e)}:function(e){return-1<i.indexOf(e)}),this.isIndeterminate=!this.isAllSelected&&e.some(function(e){return-1<n.indexOf(e)||-1<i.indexOf(e)})))},reserveCheckSelection:function(){var e=this.selectConfig,t=void 0===e?{}:e,o=this.selection,l=this.fullDataRowIdData,i=t.reserve,n=_tools.UtilTools.getRowkey(this);i&&o.length&&(this.selection=o.map(function(e){var t=""+_xeUtils.default.get(e,n);return l[t]?l[t].row:e}))},triggerCheckAllEvent:function(e,t){this.setAllSelection(t),_tools.UtilTools.emitEvent(this,"select-all",[{selection:this.getSelectRecords(),checked:t},e])},toggleAllSelection:function(){return this.triggerCheckAllEvent(null,!this.isAllSelected),this.$nextTick()},clearSelection:function(){var e=this.tableFullData,t=this.selectConfig,o=void 0===t?{}:t,l=this.treeConfig,i=o.checkField;return i&&(l?_xeUtils.default.eachTree(e,function(e){return _xeUtils.default.set(e,i,!1)},l):e.forEach(function(e){return _xeUtils.default.set(e,i,!1)})),this.isAllSelected=!1,this.isIndeterminate=!1,this.selection=[],this.treeIndeterminates=[],this.$nextTick()},handleRadioDefChecked:function(){var e=this.radioConfig,t=void 0===e?{}:e,o=this.fullDataRowIdData,l=t.checkRowKey;l&&o[l]&&this.setRadioRow(o[l].row)},triggerRadioRowEvent:function(e,t){var o=this.selectRow!==t.row;this.setRadioRow(t.row),o&&_tools.UtilTools.emitEvent(this,"radio-change",[t,e])},triggerCurrentRowEvent:function(e,t){var o=this.currentRow!==t.row;this.setCurrentRow(t.row),o&&_tools.UtilTools.emitEvent(this,"current-change",[t,e])},setCurrentRow:function(e){return this.clearCurrentRow(),this.clearCurrentColumn(),this.currentRow=e,this.highlightCurrentRow&&_xeUtils.default.arrayEach(this.$el.querySelectorAll('[data-rowid="'.concat(_tools.UtilTools.getRowid(this,e),'"]')),function(e){return _tools.DomTools.addClass(e,"row--current")}),this.$nextTick()},setRadioRow:function(e){return this.selectRow!==e&&this.clearRadioRow(),this.selectRow=e,this.$nextTick()},clearCurrentRow:function(){return this.currentRow=null,this.hoverRow=null,_xeUtils.default.arrayEach(this.$el.querySelectorAll(".row--current"),function(e){return _tools.DomTools.removeClass(e,"row--current")}),this.$nextTick()},clearRadioRow:function(){return this.selectRow=null,this.$nextTick()},getCurrentRow:function(){return this.currentRow},getRadioRow:function(){return this.selectRow},triggerHoverEvent:function(e,t){var o=t.row;this.setHoverRow(o)},setHoverRow:function(e){var t=_tools.UtilTools.getRowid(this,e);this.clearHoverRow(),_xeUtils.default.arrayEach(this.$el.querySelectorAll('[data-rowid="'.concat(t,'"]')),function(e){return _tools.DomTools.addClass(e,"row--hover")}),this.hoverRow=e},clearHoverRow:function(){_xeUtils.default.arrayEach(this.$el.querySelectorAll(".vxe-body--row.row--hover"),function(e){return _tools.DomTools.removeClass(e,"row--hover")}),this.hoverRow=null},triggerHeaderCellMousedownEvent:function(e,t){var a=this.$el,o=this.tableData,l=this.mouseConfig,i=void 0===l?{}:l,n=this.elemStore,c=this.handleChecked,u=this.handleHeaderChecked,r=e.button,s=t.column,h=t.cell,d=0===r,f="index"===s.type;if(d&&i.checked){var g=n["main-header-list"].children,v=n["main-body-list"].children;if(f)this.handleAllChecked(e);else{e.preventDefault(),e.stopPropagation(),this.clearSelected(e),this.clearHeaderChecked(),this.clearIndexChecked();var m=document.onmousemove,p=document.onmouseup,x=v[0].querySelector(".".concat(s.id)),b=_xeUtils.default.throttle(function(e){e.preventDefault();var t=_tools.DomTools.getEventTargetNode(e,a,"vxe-header--column"),o=t.flag,l=t.targetElem;if(!o){var i=_tools.DomTools.getEventTargetNode(e,a,"vxe-body--column");o=i.flag,l=i.targetElem}if(o&&!_tools.DomTools.hasClass(l,"col--index")){var n=[].indexOf.call(l.parentNode.children,l),r=v[v.length-1].children[n],s=g[0].children[n];u(_tools.DomTools.getRowNodes(g,_tools.DomTools.getCellNodeIndex(s),_tools.DomTools.getCellNodeIndex(h))),c(_tools.DomTools.getRowNodes(v,_tools.DomTools.getCellNodeIndex(x),_tools.DomTools.getCellNodeIndex(r)))}},80,{leading:!0,trailing:!0});if(_tools.DomTools.addClass(a,"c--checked"),document.onmousemove=b,document.onmouseup=function(){_tools.DomTools.removeClass(a,"c--checked"),document.onmousemove=m,document.onmouseup=p},u([[h]]),v.length){var w=v[v.length-1].querySelector(".".concat(s.id)),C=v[0],_=v[v.length-1],T=C.querySelector(".col--index");t.rowIndex=0,t.row=o[0],t.cell=_tools.DomTools.getCell(this,t),this.handleSelected(t,e),this.handleIndexChecked(_tools.DomTools.getRowNodes(v,_tools.DomTools.getCellNodeIndex(T),_tools.DomTools.getCellNodeIndex(_.querySelector(".col--index")))),this.handleChecked(_tools.DomTools.getRowNodes(v,_tools.DomTools.getCellNodeIndex(x),_tools.DomTools.getCellNodeIndex(w)))}}this.closeMenu()}},triggerCellMousedownEvent:function(e,t){var a=this.$el,o=this.tableData,l=this.visibleColumn,i=this.editStore,n=this.editConfig,r=this.handleSelected,s=this.mouseConfig,c=void 0===s?{}:s,u=this.handleChecked,h=this.handleIndexChecked,d=this.handleHeaderChecked,f=this.elemStore,g=i.checked,v=i.actived,m=t.row,p=t.column,x=t.cell,b=0===e.button;if(n){if(v.row!==m||"cell"!==n.mode||v.column!==p)if(b&&c.checked){e.preventDefault(),e.stopPropagation(),this.clearHeaderChecked(),this.clearIndexChecked();var w=document.onmousemove,C=document.onmouseup,_=_tools.DomTools.getCellNodeIndex(x),T="index"===p.type,S=f["main-body-list"].children,y=f["main-header-list"].children,D=x.parentNode.lastElementChild,E=x.parentNode.firstElementChild,R=[].indexOf.call(x.parentNode.children,x),k=y[0].children[R],U=_xeUtils.default.throttle(function(e){e.preventDefault();var t=_tools.DomTools.getEventTargetNode(e,a,"vxe-body--column"),o=t.flag,l=t.targetElem;if(o)if(T){var i=l.parentNode.firstElementChild;u(_tools.DomTools.getRowNodes(S,_tools.DomTools.getCellNodeIndex(i.nextElementSibling),_tools.DomTools.getCellNodeIndex(D))),h(_tools.DomTools.getRowNodes(S,_tools.DomTools.getCellNodeIndex(i),_tools.DomTools.getCellNodeIndex(x)))}else if(!_tools.DomTools.hasClass(l,"col--index")){var n=l.parentNode.firstElementChild,r=[].indexOf.call(l.parentNode.children,l),s=y[0].children[r];d(_tools.DomTools.getRowNodes(y,_tools.DomTools.getCellNodeIndex(s),_tools.DomTools.getCellNodeIndex(k))),h(_tools.DomTools.getRowNodes(S,_tools.DomTools.getCellNodeIndex(n),_tools.DomTools.getCellNodeIndex(E))),u(_tools.DomTools.getRowNodes(S,_,_tools.DomTools.getCellNodeIndex(l)))}},80,{leading:!0,trailing:!0});if(document.onmousemove=U,document.onmouseup=function(e){document.onmousemove=w,document.onmouseup=C},T){var I=x.parentNode.firstElementChild;t.columnIndex++,t.column=l[t.columnIndex],t.cell=x.nextElementSibling,r(t,e),u(_tools.DomTools.getRowNodes(S,_tools.DomTools.getCellNodeIndex(I.nextElementSibling),_tools.DomTools.getCellNodeIndex(D))),d([y[0].querySelectorAll(".vxe-header--column:not(.col--index)")]),h(_tools.DomTools.getRowNodes(S,_tools.DomTools.getCellNodeIndex(I),_tools.DomTools.getCellNodeIndex(x)))}else r(t,e);this.closeFilter(),this.closeMenu()}else if(c.selected&&"dblclick"===n.trigger){var $=_tools.DomTools.getCellIndexs(x);-1!==g.rows.indexOf(o[$.rowIndex])&&-1!==g.columns.indexOf(l[$.columnIndex])||r(t,e)}}else c.selected&&r(t,e)},triggerHeaderCellClickEvent:function(e,t){var o=this._lastResizeTime,l=this.sortOpts,i=t.column,n=t.cell,r=o&&o>Date.now()-300,s=this.getEventTargetNode(e,n,"vxe-sort-wrapper").flag,a=this.getEventTargetNode(e,n,"vxe-filter-wrapper").flag;return"cell"!==l.trigger||r||s||a||this.sort(i.property),_tools.UtilTools.emitEvent(this,"header-cell-click",[Object.assign({triggerResizable:r,triggerSort:s,triggerFilter:a},t),e]),this.highlightCurrentColumn?this.setCurrentColumn(i,!0):this.$nextTick()},setCurrentColumn:function(e){return this.clearCurrentRow(),this.clearCurrentColumn(),this.currentColumn=e,_xeUtils.default.arrayEach(this.$el.querySelectorAll(".".concat(e.id)),function(e){return _tools.DomTools.addClass(e,"col--current")}),this.$nextTick()},clearCurrentColumn:function(){return this.currentColumn=null,_xeUtils.default.arrayEach(this.$el.querySelectorAll(".col--current"),function(e){return _tools.DomTools.removeClass(e,"col--current")}),this.$nextTick()},triggerCellClickEvent:function(e,t){var o=this,l=this.$el,i=this.highlightCurrentRow,n=this.editStore,r=this.radioConfig,s=void 0===r?{}:r,a=this.selectConfig,c=void 0===a?{}:a,u=this.treeConfig,h=void 0===u?{}:u,d=this.editConfig,f=this.mouseConfig,g=void 0===f?{}:f,v=n.actived,m=t.column,p=t.columnIndex,x=t.cell;("row"===h.trigger||m.treeNode&&"cell"===h.trigger)&&this.triggerTreeExpandEvent(e,t),m.treeNode&&this.getEventTargetNode(e,l,"vxe-tree-wrapper").flag||(i&&("row"!==s.trigger&&(this.getEventTargetNode(e,l,"vxe-checkbox").flag||this.getEventTargetNode(e,l,"vxe-radio").flag)||this.triggerCurrentRowEvent(e,t)),"row"!==s.trigger&&("radio"!==m.type||"cell"!==s.trigger)||this.getEventTargetNode(e,l,"vxe-radio").flag||this.triggerRadioRowEvent(e,t),"row"!==c.trigger&&("selection"!==m.type||"cell"!==c.trigger)||this.getEventTargetNode(e,t.cell,"vxe-checkbox").flag||this.handleToggleCheckRowEvent(t,e),g.checked||d&&(v.args&&x===v.args.cell||("row"===d.mode&&v.args&&(Object.assign(v.args,{cell:x,columnIndex:p,column:m}),v.column=m),"click"===d.trigger?this.triggerValidate("blur").catch(function(e){return e}).then(function(){o.handleActived(t,e).then(function(){return o.triggerValidate("change")}).catch(function(e){return e})}):"dblclick"===d.trigger&&this.handleSelected(t,e)))),_tools.UtilTools.emitEvent(this,"cell-click",[t,e])},triggerCellDBLClickEvent:function(e,t){var o=this,l=this.editStore,i=this.editConfig,n=l.actived;i&&"dblclick"===i.trigger&&(n.args&&e.currentTarget===n.args.cell||("row"===i.mode?this.triggerValidate("blur").catch(function(e){return e}).then(function(){o.handleActived(t,e).then(function(){return o.triggerValidate("change")}).catch(function(e){return e})}):"cell"===i.mode&&this.handleActived(t,e).then(function(){return o.triggerValidate("change")}).catch(function(e){return e}))),_tools.UtilTools.emitEvent(this,"cell-dblclick",[t,e])},handleActived:function(e,t){var o=this,l=this.editStore,i=this.editConfig,n=this.tableColumn,r=i.activeMethod,s=l.actived,a=e.row,c=e.column,u=e.cell,h=c.model;if(c.editRender&&u){var d="row"===i.mode;if(s.row!==a||"cell"!==i.mode||s.column!==c){var f="edit-disabled";r&&!r(e)||(this.clostTooltip(),this.clearCopyed(t),this.clearChecked(),this.clearSelected(t),this.clearActived(t),f="edit-actived",c.renderHeight=u.offsetHeight,s.args=e,s.row=a,s.column=c,d?n.forEach(function(e){e.editRender&&(e.model.value=_tools.UtilTools.getCellValue(a,e),e.model.update=!1)}):(h.value=_tools.UtilTools.getCellValue(a,c),h.update=!1),this.$nextTick(function(){o.handleFocus(e,t)})),_tools.UtilTools.emitEvent(this,f,[e,t])}else{var g=s.column;if(g!==c){var v=g.model;v.update&&_tools.UtilTools.setCellValue(a,g,v.value),this.clearValidate()}c.renderHeight=u.offsetHeight,s.args=e,s.column=c,setTimeout(function(){o.handleFocus(e,t)})}}return this.$nextTick()},clearActived:function(e){var t=this.editStore.actived,o=t.args,l=t.row,i=t.column;if(l||i){var n=i.model;n.update&&(_tools.UtilTools.setCellValue(l,i,n.value),n.update=!1,n.value=null,this.updateFooter()),_tools.UtilTools.emitEvent(this,"edit-closed",[o,e])}return t.args=null,t.row=null,t.column=null,this.clearValidate().then(this.recalculate)},getActiveRow:function(){var e=this.$el,t=this.editStore,o=this.tableData,l=t.actived,i=l.args,n=l.row;return i&&-1<o.indexOf(n)&&e.querySelectorAll(".vxe-body--column.col--actived").length?Object.assign({},i):null},hasActiveRow:function(e){return this.editStore.actived.row===e},clearSelected:function(e){var t=this.editStore,o=this.elemStore,l=t.selected;l.row=null,l.column=null;var i=o["main-header-list"],n=o["main-body-list"];return _xeUtils.default.arrayEach(i.querySelectorAll(".col--title-selected"),function(e){return _tools.DomTools.removeClass(e,"col--title-selected")}),_xeUtils.default.arrayEach([n.querySelector(".col--selected")],function(e){return _tools.DomTools.removeClass(e,"col--selected")}),this.$nextTick()},handleSelected:function(i,n){var r=this,e=this.mouseConfig,s=void 0===e?{}:e,t=this.editStore,a=this.elemStore,c=t.selected,u=i.row,h=i.column,d=i.cell;return function(){if((c.row!==u||c.column!==h)&&(r.clearChecked(n),r.clearIndexChecked(),r.clearHeaderChecked(),r.clearSelected(n),r.clearActived(n),c.args=i,c.row=u,c.column=h,s.selected)){var e=a["main-body-list"],t=_tools.UtilTools.getRowid(r,u),o=e.querySelector('[data-rowid="'.concat(t,'"]')).querySelector(".".concat(h.id));_tools.DomTools.addClass(o,"col--selected")}if(s.checked){var l=a["main-header-list"];r.handleChecked([[d]]),r.handleHeaderChecked([[l.querySelector(".".concat(h.id))]]),r.handleIndexChecked([[d.parentNode.querySelector(".col--index")]])}return r.$nextTick()}()},clearChecked:function(e){var t=this.$refs,o=this.editStore,l=this.mouseConfig,i=o.checked;if(l&&l.checked){var n=t.tableBody;i.rows=[],i.columns=[],i.tRows=[],i.tColumns=[],n.$refs.checkBorders.style.display="none",_xeUtils.default.arrayEach(n.$el.querySelectorAll(".col--checked"),function(e){return _tools.DomTools.removeClass(e,"col--checked")})}return this.$nextTick()},handleChecked:function(e){var t=this.editStore.checked;this.clearChecked();var i=-2,n=-2,r=0,s=0;_xeUtils.default.arrayEach(e,function(e,t){var l=0===t;_xeUtils.default.arrayEach(e,function(e,t){var o=0===t;o&&l&&(r=e.offsetTop,s=e.offsetLeft),l&&(i+=e.offsetWidth),o&&(n+=e.offsetHeight),_tools.DomTools.addClass(e,"col--checked")})});var o=this.$refs.tableBody.$refs,l=o.checkBorders,a=o.checkTop,c=o.checkRight,u=o.checkBottom,h=o.checkLeft;l.style.display="block",Object.assign(a.style,{top:"".concat(r,"px"),left:"".concat(s,"px"),width:"".concat(i,"px")}),Object.assign(c.style,{top:"".concat(r,"px"),left:"".concat(s+i,"px"),height:"".concat(n,"px")}),Object.assign(u.style,{top:"".concat(r+n,"px"),left:"".concat(s,"px"),width:"".concat(i,"px")}),Object.assign(h.style,{top:"".concat(r,"px"),left:"".concat(s,"px"),height:"".concat(n,"px")}),t.rowNodes=e},handleAllChecked:function(e){var t=this.tableData,o=this.visibleColumn,l=this.mouseConfig,i=void 0===l?{}:l,n=this.elemStore;if(i.checked){e.preventDefault();var r=n["main-header-list"],s=r.children,a=n["main-body-list"].children,c=o.find(function(e){return"index"===e.type})||o[0],u=r.querySelector(".".concat(c.id)),h=a[0],d=a[a.length-1],f=h.querySelector(".".concat(c.id)),g={$table:this,rowIndex:0,row:t[0],column:o.find(function(e){return e.property})};g.columnIndex=this.getColumnIndex(g.column),g.cell=_tools.DomTools.getCell(this,g),this.handleSelected(g,e),this.handleHeaderChecked(_tools.DomTools.getRowNodes(s,_tools.DomTools.getCellNodeIndex(u.nextElementSibling),_tools.DomTools.getCellNodeIndex(u.parentNode.lastElementChild))),this.handleIndexChecked(_tools.DomTools.getRowNodes(a,_tools.DomTools.getCellNodeIndex(f),_tools.DomTools.getCellNodeIndex(d.querySelector(".".concat(c.id))))),this.handleChecked(_tools.DomTools.getRowNodes(a,_tools.DomTools.getCellNodeIndex(f.nextElementSibling),_tools.DomTools.getCellNodeIndex(d.lastElementChild)))}},handleIndexChecked:function(e){var t=this.editStore.indexs;this.clearIndexChecked(),_xeUtils.default.arrayEach(e,function(e){_xeUtils.default.arrayEach(e,function(e){_tools.DomTools.addClass(e,"col--index-checked")})}),t.rowNodes=e},clearIndexChecked:function(){var e=this.elemStore["main-body-list"];return _xeUtils.default.arrayEach(e.querySelectorAll(".col--index-checked"),function(e){return _tools.DomTools.removeClass(e,"col--index-checked")}),this.$nextTick()},handleHeaderChecked:function(e){var t=this.editStore.titles;this.clearHeaderChecked(),_xeUtils.default.arrayEach(e,function(e){_xeUtils.default.arrayEach(e,function(e){_tools.DomTools.addClass(e,"col--title-checked")})}),t.rowNodes=e},clearHeaderChecked:function(){var e=this.elemStore["main-header-list"];return _xeUtils.default.arrayEach(e.querySelectorAll(".col--title-checked"),function(e){return _tools.DomTools.removeClass(e,"col--title-checked")}),this.$nextTick()},clearCopyed:function(){var e=this.$refs,t=this.editStore,o=this.keyboardConfig,l=t.copyed;if(o&&o.isCut){var i=e.tableBody,n=e.tableBody.$refs.copyBorders;l.cut=!1,l.rows=[],l.columns=[],n.style.display="none",_xeUtils.default.arrayEach(i.$el.querySelectorAll(".col--copyed"),function(e){return _tools.DomTools.removeClass(e,"col--copyed")})}return this.$nextTick()},handleCopyed:function(e,t){var o=this.tableData,l=this.tableColumn,i=this.editStore,n=i.copyed,r=i.checked.rowNodes;this.clearCopyed();var s=-3,a=-3,c=0,u=0,h=[],d=[];if(r.length){var f=r[0],g=_tools.DomTools.getCellNodeIndex(f[0]),v=g.rowIndex,m=g.columnIndex;h=l.slice(m,m+f.length),d=o.slice(v,v+r.length)}_xeUtils.default.arrayEach(r,function(e,t){var l=0===t;_xeUtils.default.arrayEach(e,function(e,t){var o=0===t;o&&l&&(c=e.offsetTop,u=e.offsetLeft),l&&(s+=e.offsetWidth),o&&(a+=e.offsetHeight),_tools.DomTools.addClass(e,"col--copyed")})});var p=this.$refs.tableBody.$refs,x=p.copyBorders,b=p.copyTop,w=p.copyRight,C=p.copyBottom,_=p.copyLeft;x.style.display="block",Object.assign(b.style,{top:"".concat(c,"px"),left:"".concat(u,"px"),width:"".concat(s,"px")}),Object.assign(w.style,{top:"".concat(c,"px"),left:"".concat(u+s,"px"),height:"".concat(a,"px")}),Object.assign(C.style,{top:"".concat(c+a,"px"),left:"".concat(u,"px"),width:"".concat(s,"px")}),Object.assign(_.style,{top:"".concat(c,"px"),left:"".concat(u,"px"),height:"".concat(a,"px")}),n.cut=e,n.rows=d,n.columns=h,n.rowNodes=r},handlePaste:function(e){var t=this.tableData,n=this.visibleColumn,o=this.editStore,l=this.elemStore,i=o.copyed,r=o.selected,s=i.cut,a=i.rows,c=i.columns;if(a.length&&c.length&&r.row&&r.column){var u=r.args,h=u.rowIndex,d=u.columnIndex;_xeUtils.default.arrayEach(a,function(l,e){var i=t[h+e];i&&_xeUtils.default.arrayEach(c,function(e,t){var o=n[d+t];o&&_tools.UtilTools.setCellValue(i,o,_tools.UtilTools.getCellValue(l,e)),s&&_tools.UtilTools.setCellValue(l,e,null)})}),s&&this.clearCopyed();var f=l["main-body-list"].children,g=r.args.cell,v=g.parentNode,m=_xeUtils.default.arrayIndexOf(v.children,g),p=f[_xeUtils.default.arrayIndexOf(f,v)+a.length-1].children[m+c.length-1];this.handleChecked(_tools.DomTools.getRowNodes(f,_tools.DomTools.getCellNodeIndex(g),_tools.DomTools.getCellNodeIndex(p)))}},handleFocus:function(e,t){var o=e.column,l=e.cell,i=o.editRender;if(i){var n,r=_vXETable.Renderer.get(i.name),s=i.autofocus,a=i.autoselect;if(s&&(n=l.querySelector(s)),!n&&r&&r.autofocus&&(n=l.querySelector(r.autofocus)),n&&(n[a?"select":"focus"](),browse.msie)){var c=n.createTextRange();c.collapse(!1),c.select()}}},setActiveRow:function(e){return this.setActiveCell(e,this.visibleColumn.find(function(e){return e.editRender}).property)},setActiveCell:function(l,i){var n=this;return new Promise(function(o){setTimeout(function(){if(l&&i){var e=n.visibleColumn.find(function(e){return e.property===i});if(e&&e.editRender){var t=_tools.DomTools.getCell(n,{row:l,column:e});t&&(n.handleActived({row:l,column:e,cell:t}),n.lastCallTime=Date.now())}}o(n.$nextTick())})})},setSelectCell:function(e,t){var o=this.tableData,l=this.editConfig,i=this.visibleColumn;if(e&&t&&"manual"!==l.trigger){var n=i.find(function(e){return e.property===t}),r=o.indexOf(e);if(-1<r&&n){var s=_tools.DomTools.getCell(this,{row:e,rowIndex:r,column:n}),a={row:e,rowIndex:r,column:n,columnIndex:i.indexOf(n),cell:s};this.handleSelected(a,{})}}return this.$nextTick()},triggerSortEvent:function(e,t,o,l){this.sort(t.property,l)},sort:function(t,e){var o=this.visibleColumn,l=this.tableFullColumn,i=this.remoteSort,n=o.find(function(e){return e.property===t}),r=_xeUtils.default.isBoolean(n.remoteSort)?n.remoteSort:i;return n.sortable||n.remoteSort?(e||(e="desc"===n.order?"asc":"desc"),n.order!==e&&(l.forEach(function(e){e.order=null}),n.order=e,r||(this.tableData=this.getTableData(!0).tableData),_tools.UtilTools.emitEvent(this,"sort-change",[{column:n,property:t,prop:t,field:t,order:e}])),this.$nextTick().then(this.updateStyle)):this.$nextTick()},clearSort:function(){return this.tableFullColumn.forEach(function(e){e.order=null}),this.tableFullData=this.data?this.data.slice(0):[],this.tableData=this.getTableData(!0).tableData,this.$nextTick()},triggerFilterEvent:function(e,t,o){var l=this.$refs,i=this.filterStore,n=this.overflowX;if(i.column===t&&i.visible)i.visible=!1;else{var r=e.target,s=l.tableBody.$el,a=l.filterWrapper,c=_tools.DomTools.getOffsetPos(r),u=c.top,h=c.left;n&&(h-=s.scrollLeft),Object.assign(i,{args:o,multiple:t.filterMultiple,options:t.filters,column:t,style:{zIndex:_conf.default.tooltip.zIndex,top:"".concat(u+r.clientHeight+6,"px"),left:"".concat(h,"px")},visible:!0}),i.isAllSelected=i.options.every(function(e){return e.checked}),i.isIndeterminate=!this.isAllSelected&&i.options.some(function(e){return e.checked}),this.$nextTick(function(){var e=a.$el;i.style.top="".concat(u+r.clientHeight+6,"px"),i.style.left="".concat(h-e.clientWidth/2+10,"px")})}},confirmFilterEvent:function(e){var t=this.visibleColumn,o=this.filterStore,l=this.remoteFilter,i=this.scrollXLoad,n=this.scrollYLoad,r=o.column,s=r.property,a=[],c=[];r.filters.forEach(function(e){e.checked&&(a.push(e.value),c.push(e.data))}),o.visible=!1,l||(this.tableData=this.getTableData(!0).tableData);var u=[];t.filter(function(e){var t=e.property,o=e.filters,l=[],i=[];o&&o.length&&(o.forEach(function(e){e.checked&&(l.push(e.value),i.push(e.data))}),u.push({column:e,property:t,field:t,prop:t,values:l,datas:i}))}),_tools.UtilTools.emitEvent(this,"filter-change",[{column:r,property:s,field:s,prop:s,values:a,datas:c,filters:u}]),(i||n)&&(this.clearScroll(),n&&this.updateScrollYSpace()),this.closeFilter(),this.$nextTick(this.recalculate)},closeFilter:function(e){return Object.assign(this.filterStore,{isAllSelected:!1,isIndeterminate:!1,options:[],visible:!1}),this.$nextTick()},resetFilterEvent:function(e){this.filterStore.options.forEach(function(e){e.checked=!1,e.data=e._data}),this.confirmFilterEvent(e)},clearFilter:function(){return this.visibleColumn.forEach(function(e){var t=e.filters;t&&t.length&&t.forEach(function(e){e.checked=!1})}),Object.assign(this.filterStore,{isAllSelected:!1,isIndeterminate:!1,style:null,options:[],column:null,multiple:!1,visible:!1}),this.tableData=this.getTableData(!0).tableData,this.$nextTick()},triggerRowExpandEvent:function(e,t){var o=t.row,l=this.toggleRowExpansion(o);return _tools.UtilTools.emitEvent(this,"toggle-expand-change",[{row:o,rowIndex:this.getRowIndex(o),$table:this},e]),l},toggleRowExpansion:function(e){return this.setRowExpansion(e)},handleDefaultRowExpand:function(){var e=this.expandConfig,t=void 0===e?{}:e,o=this.tableFullData,l=this.fullDataRowIdData,i=t.expandAll,n=t.expandRowKeys;if(i)this.expandeds=o.slice(0);else if(n){var r=[];n.forEach(function(e){l[e]&&r.push(l[e].row)}),this.expandeds=r}},setAllRowExpansion:function(e){return this.expandeds=e?this.tableFullData.slice(0):[],this.$nextTick()},setRowExpansion:function(e,o){var l=this.expandeds,t=this.expandConfig,i=void 0===t?{}:t,n=1===arguments.length;return e&&(_xeUtils.default.isArray(e)||(e=[e]),i.accordion&&(l.length=0,e=e.slice(e.length-1,e.length)),e.forEach(function(e){var t=l.indexOf(e);-1<t?!n&&o||l.splice(t,1):(n||o)&&l.push(e)})),this.$nextTick()},hasRowExpand:function(e){return-1<this.expandeds.indexOf(e)},clearRowExpand:function(){return this.expandeds=[],this.$nextTick()},triggerTreeExpandEvent:function(e,t){var o=this,l=t.row,i=this.currentRow,n=this.currentColumn,r=this.toggleTreeExpansion(l);return _tools.UtilTools.emitEvent(this,"toggle-tree-change",[{row:l,rowIndex:this.getRowIndex(l),$table:this},e]),i?this.$nextTick(function(){return o.setCurrentRow(i)}):n&&this.$nextTick(function(){return o.setCurrentColumn(n)}),r},toggleTreeExpansion:function(e){return this.setTreeExpansion(e)},handleDefaultTreeExpand:function(){var l=this.treeConfig,i=this.tableFullData;if(l){var e=l.expandAll,t=l.expandRowKeys,n=l.children,r=[];if(e)_xeUtils.default.filterTree(i,function(e){var t=e[n];t&&t.length&&r.push(e)},l),this.treeExpandeds=r;else if(t){var s=_tools.UtilTools.getRowkey(this);t.forEach(function(t){var e=_xeUtils.default.findTree(i,function(e){return t===_xeUtils.default.get(e,s)},l),o=e?e.item[n]:0;o&&o.length&&r.push(e.item)}),this.treeExpandeds=r}}},setAllTreeExpansion:function(e){var t=this.tableFullData,o=this.treeConfig,l=o.children,i=[];return e&&_xeUtils.default.eachTree(t,function(e){var t=e[l];t&&t.length&&i.push(e)},o),this.treeExpandeds=i,this.$nextTick()},setTreeExpansion:function(e,i){var n=this.tableFullData,r=this.treeExpandeds,s=this.treeConfig,a=s.children,c=1===arguments.length;return e&&(_xeUtils.default.isArray(e)||(e=[e]),s.accordion&&(e=e.slice(e.length-1,e.length)),e.forEach(function(t){var e=t[a];if(e&&e.length){var o=r.indexOf(t);if(s.accordion){var l=_xeUtils.default.findTree(n,function(e){return e===t},s);_xeUtils.default.remove(r,function(e){return-1<l.items.indexOf(e)})}-1<o?!c&&i||r.splice(o,1):(c||i)&&r.push(t)}})),this.$nextTick()},hasTreeExpand:function(e){return-1<this.treeExpandeds.indexOf(e)},clearTreeExpand:function(){return this.treeExpandeds=[],this.$nextTick()},getVirtualScroller:function(){var e=this.$refs,t=this.scrollXLoad,o=this.scrollYLoad,l=e.tableBody.$el;return{scrollX:t,scrollY:o,scrollTop:l.scrollTop,scrollLeft:l.scrollLeft}},triggerScrollXEvent:function(e){for(var t=this,o=this.$refs,l=this.visibleColumn,i=this.scrollXStore,n=i.startIndex,r=i.renderSize,s=i.offsetSize,a=i.visibleSize,c=o.tableBody.$el.scrollLeft,u=0,h=0,d=0;d<l.length;d++)if(c<(h+=l[d].renderWidth)){u=d;break}if(i.visibleIndex!==u){var f=0,g=r<3*a,v=r-a;(i.visibleIndex>u?(f=v-(g?Math.floor(v/2):Math.floor(6*a<r?3*a:1.5*a)),u-s<=n):(f=g?Math.floor(v/2):Math.floor(6*a<r?3*a:1.5*a),n+r<=u+a+s))&&(i.visibleIndex=u,i.startIndex=Math.min(Math.max(u-f,0),l.length-r),this.updateScrollXData(),this.$nextTick(function(){t.updateStyle()}))}this.clostTooltip()},triggerScrollYEvent:function(e){var t=this.scrollYStore;isWebkit&&t.adaptive?this.loadScrollYData(e):this.debounceScrollY(e)},debounceScrollY:_xeUtils.default.debounce(function(e){this.loadScrollYData(e)},debounceScrollYDuration,{leading:!1,trailing:!0}),loadScrollYData:function(e){var t=this,o=this.tableFullData,l=this.scrollYStore,i=l.startIndex,n=l.renderSize,r=l.offsetSize,s=l.visibleSize,a=l.rowHeight,c=e.target.scrollTop,u=Math.ceil(c/a);if(l.visibleIndex!==u){var h=0,d=n<3*s,f=n-s;(l.visibleIndex>u?(h=f-(d?Math.floor(f/2):Math.floor(6*s<n?3*s:1.5*s)),u-r<=i):(h=d?Math.floor(f/2):Math.floor(6*s<n?3*s:1.5*s),i+n<=u+s+r))&&(l.visibleIndex=u,l.startIndex=Math.min(Math.max(u-h,0),o.length-n),this.updateScrollYData(),this.$nextTick(function(){t.clearHoverRow(),t.updateStyle()}))}},computeScrollLoad:function(){var g=this;return this.$nextTick().then(function(){var e=g.scrollXLoad,t=g.scrollYLoad,o=g.scrollYStore,l=g.scrollXStore,i=g.visibleColumn,n=g.optimizeOpts,r=n.scrollX,s=n.scrollY,a=g.$refs.tableBody,c=a?a.$el:null,u=g.$refs.tableHeader;if(c){if(e){var h=r.vSize||Math.ceil(c.clientWidth/(i.slice(0,10).reduce(function(e,t){return e+t.renderWidth},0)/10));l.visibleSize=h,l.adaptive&&(l.offsetSize=h,l.renderSize=h+2),g.updateScrollXData()}else g.updateScrollXSpace();if(t){if(s.rHeight)o.rowHeight=s.rHeight;else{var d=c.querySelector("tbody>tr");!d&&u&&(d=u.$el.querySelector("thead>tr")),d&&(o.rowHeight=d.clientHeight)}var f=s.vSize||Math.ceil(c.clientHeight/o.rowHeight);o.visibleSize=f,isWebkit&&o.adaptive&&(o.offsetSize=f,o.renderSize=f+2),g.updateScrollYData()}else g.updateScrollYSpace()}g.$nextTick(g.updateStyle)})},updateScrollXData:function(){var e=this.visibleColumn,t=this.scrollXStore;this.tableColumn=e.slice(t.startIndex,t.startIndex+t.renderSize),this.updateScrollXSpace()},updateScrollXSpace:function(){var e=this.$refs,l=this.elemStore,t=this.visibleColumn,o=this.scrollXStore,i=this.scrollXLoad,n=this.tableWidth,r=this.scrollbarWidth,s=e.tableHeader,a=e.tableBody,c=e.tableFooter,u=s?s.$el.querySelector(".vxe-table--header"):null,h=a.$el.querySelector(".vxe-table--body"),d=c?c.$el.querySelector(".vxe-table--footer"):null,f=t.slice(0,o.startIndex).reduce(function(e,t){return e+t.renderWidth},0),g="";i&&(g="".concat(f,"px")),u&&(u.style.marginLeft=g),h.style.marginLeft=g,d&&(d.style.marginLeft=g);["main"].forEach(function(o){["header","body","footer"].forEach(function(e){var t=l["".concat(o,"-").concat(e,"-xSpace")];t&&(t.style.width=i?"".concat(n+("header"===e?r:0),"px"):"")})})},updateScrollYData:function(){var e=this.getTableData().tableData;this.tableData=e,this.updateScrollYSpace()},updateScrollYSpace:function(){var l=this.elemStore,e=this.scrollYStore,t=this.scrollYLoad,o=this.afterFullData.length*e.rowHeight,i=Math.max(e.startIndex*e.rowHeight,0),n="",r="";t&&(n="".concat(i,"px"),r="".concat(o,"px")),["main","left","right"].forEach(function(o){var e=l["".concat(o,"-body-table")];e&&(e.style.marginTop=n),["header","body","footer"].forEach(function(e){var t=l["".concat(o,"-").concat(e,"-ySpace")];t&&(t.style.height=r)})})},scrollTo:function(e,t){var o=this.$refs.tableBody.$el;if(_xeUtils.default.isNumber(e)){var l=this.$refs.tableFooter;l?l.$el.scrollLeft=e:o.scrollLeft=e}if(_xeUtils.default.isNumber(t)){var i=this.$refs.rightBody;i&&(i.$el.scrollTop=t),o.scrollTop=t}return this.$nextTick()},scrollToRow:function(e,t){return e&&this.fullDataRowMap.has(e)&&_tools.DomTools.rowToVisible(this,e),this.scrollToColumn(t)},scrollToColumn:function(e){return e&&this.fullColumnMap.has(e)&&_tools.DomTools.colToVisible(this,e),this.$nextTick()},clearScroll:function(){var i=this;return Object.assign(this.scrollXStore,{startIndex:0}),Object.assign(this.scrollYStore,{startIndex:0}),this.$nextTick(function(){var e=i.$refs.tableBody,t=e?e.$el:null,o=i.$refs.tableFooter,l=o?o.$el:null;t&&(t.scrollTop=0,t.scrollLeft=0),l&&(l.scrollLeft=0)}),this.$nextTick()},updateFooter:function(){var e=this.showFooter,t=this.tableColumn,o=this.footerMethod;return e&&o&&(this.footerData=t.length?o({columns:t,data:this.tableFullData}):[]),this.$nextTick()},updateStatus:function(a,c){var u=this,h=!_xeUtils.default.isUndefined(c);return this.$nextTick().then(function(){var e=u.$refs,t=u.tableData,o=u.editRules,l=u.validStore;if(a&&e.tableBody&&o){var i=a.row,n=a.column;if(u.hasCellRules("change",i,n)){var r=t.indexOf(i),s=_tools.DomTools.getCell(u,{row:i,rowIndex:r,column:n});if(s)return u.validCellRules("change",i,n,c).then(function(){h&&l.visible&&_tools.UtilTools.setCellValue(i,n,c),u.clearValidate()}).catch(function(e){var t=e.rule;h&&_tools.UtilTools.setCellValue(i,n,c),u.showValidTooltip({rule:t,row:i,column:n,cell:s})})}}})},triggerValidate:function(l){var i=this,e=this.editConfig,t=this.editStore,o=this.editRules,n=this.validStore,r=t.actived;if(r.row&&o){var s=r.args,a=s.row,c=s.column,u=s.cell;if(this.hasCellRules(l,a,c))return this.validCellRules(l,a,c).then(function(){"row"===e.mode&&n.visible&&n.row===a&&n.column===c&&i.clearValidate()}).catch(function(e){var t=e.rule;if(t.trigger&&l!==t.trigger)return Promise.resolve();var o={rule:t,row:a,column:c,cell:u};return i.showValidTooltip(o),Promise.reject(o)})}return Promise.resolve()},fullValidate:function(e,t){return this.beginValidate(e,t,!0)},validate:function(e,t){return this.beginValidate(e,t)},beginValidate:function(e,c,u){var h=this,d={},f=!0,t=this.editRules,o=this.tableData,l=this.tableFullData,g=this.scrollYLoad,v=this.scrollYStore,i=g?l:o;e&&(_xeUtils.default.isFunction(e)?c=e:i=_xeUtils.default.isArray(e)?e:[e]);var n=[];if(this.lastCallTime=Date.now(),this.clearValidate(),t){var s=this.getColumns();return i.forEach(function(r){var e=[];s.forEach(function(i,n){_xeUtils.default.has(t,i.property)&&e.push(new Promise(function(o,l){h.validCellRules("all",r,i).then(o).catch(function(e){var t={rule:e.rule,rules:e.rules,rowIndex:h.getRowIndex(r),row:r,columnIndex:n,column:i};return u?(d[i.property]||(d[i.property]=[]),d[i.property].push(t),o()):l(t)})}))}),n.push(Promise.all(e))}),Promise.all(n).then(function(){var e=Object.keys(d);if(e.length)return Promise.reject(d[e[0]][0]);c&&c(f)}).catch(function(s){var a=u?d:_defineProperty({},s.column.property,s);return new Promise(function(e,t){var o=s.rowIndex,l=function(){s.cell=_tools.DomTools.getCell(h,s),h.handleValidError(s),c?e(c(f=!1,a)):t(a)};if(g){var i=v.startIndex,n=v.renderSize,r=v.rowHeight;if(o<i||i+n<o)return h.$refs.tableBody.$el.scrollTop=(o-1)*r,setTimeout(l,2*debounceScrollYDuration)}l()})})}return c&&c(f),Promise.resolve(!0)},hasCellRules:function(t,e,o){var l=this.editRules,i=o.property;if(i&&l){var n=_xeUtils.default.get(l,i);return n&&n.find(function(e){return"all"===t||!e.trigger||t===e.trigger})}return!1},validCellRules:function(s,a,c,e){var u=this,t=this.editRules,o=c.property,h=[],l=[];if(o&&t){var d=_xeUtils.default.get(t,o),f=_xeUtils.default.isUndefined(e)?_xeUtils.default.get(a,o):e;d&&d.forEach(function(r){l.push(new Promise(function(o){var e=!0===r.required;if("all"!==s&&r.trigger&&s!==r.trigger)o();else if(_xeUtils.default.isFunction(r.validator))r.validator(r,f,function(e){if(_xeUtils.default.isError(e)){var t={type:"custom",trigger:r.trigger,message:e.message,rule:r};h.push(t)}return o()},{rules:d,row:a,column:c,rowIndex:u.getRowIndex(a),columnIndex:u.getColumnIndex(c)});else{var t,l=f,i="number"===r.type,n=null==f||""===f;i?l=_xeUtils.default.toNumber(f):t=_xeUtils.default.getSize(l),e&&n?h.push(r):(i&&isNaN(f)||_xeUtils.default.isRegExp(r.pattern)&&!r.pattern.test(f)||_xeUtils.default.isNumber(r.min)&&(i?l<r.min:t<r.min)||_xeUtils.default.isNumber(r.max)&&(i?l>r.max:t>r.max))&&h.push(r),o()}}))})}return Promise.all(l).then(function(){if(h.length){var e={rules:h,rule:h[0]};return Promise.reject(e)}})},clearValidate:function(){var e=this.$refs.validTip;return Object.assign(this.validStore,{visible:!1,row:null,column:null,content:"",rule:null}),e&&e.visible&&e.close(),this.$nextTick()},handleValidError:function(e){var t=this;this.handleActived(e,{type:"valid-error",trigger:"call"}).then(function(){return t.showValidTooltip(e)})},showValidTooltip:function(e){var t=this,o=this.$refs,l=this.height,i=this.tableData,n=this.validOpts,r=e.rule,s=e.row,a=e.column,c=e.cell,u=o.validTip,h=r.message;this.$nextTick(function(){Object.assign(t.validStore,{row:s,column:a,rule:r,content:h,visible:!0}),u&&("tooltip"===n.message||"default"===n.message&&!l&&i.length<2)&&u.toVisible(c,h),_tools.UtilTools.emitEvent(t,"valid-error",[e])})},exportCsv:function(e){var t=this.visibleColumn,o=this.scrollXLoad,l=this.scrollYLoad,i=this.treeConfig,n=Object.assign({filename:"table.csv",original:!!i,isHeader:!0,isFooter:!0,download:!0,data:null,columns:null,columnFilterMethod:function(e){return-1===["index","selection","radio"].indexOf(e.type)&&e.property},dataFilterMethod:null},e);-1===n.filename.indexOf(".csv")&&(n.filename+=".csv"),n.original||(o||l)&&(n.original=!0,console.warn("[vxe-table] Virtual scrolling can only export source data, please set original=true."));var r=t,s=this.getTableData().fullData;return i&&(s=_xeUtils.default.toTreeArray(s,i)),_tools.ExportTools.downloadCsc(n,_tools.ExportTools.getCsvContent(this,n,r,s))},connect:function(e){var t=e.toolbar;this._toolbar=t},getEventTargetNode:_tools.DomTools.getEventTargetNode}};exports.default=_default2; |