text: "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var scrollProcessTimeout,_xeUtils=_interopRequireDefault(require("xe-utils/methods/xe-utils")),_conf=_interopRequireDefault(require("../../conf")),_tools=require("../../tools");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _defineProperty(e,l,o){return l in e?Object.defineProperty(e,l,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[l]=o,e}function isOperateMouse(e){return e._isResize||e.lastScrollTime&&Date.now()<e.lastScrollTime+e.optimizeOpts.delayHover}function renderBorder(e,l){return e("div",{class:"vxe-table-".concat(l,"ed-borders"),ref:"".concat(l,"Borders")},[e("span",{class:"vxe-table-border-top",ref:"".concat(l,"Top")}),e("span",{class:"vxe-table-border-right",ref:"".concat(l,"Right")}),e("span",{class:"vxe-table-border-bottom",ref:"".concat(l,"Bottom")}),e("span",{class:"vxe-table-border-left",ref:"".concat(l,"Left")})])}function renderColumn(e,l,o,t,r,n,i,c,s,d,a,u,f){var p,x,v=o._e,g=o.$listeners,m=o.tableData,y=o.height,b=o.columnKey,w=o.overflowX,h=o.scrollXLoad,_=o.scrollYLoad,$=o.highlightCurrentRow,T=o.showOverflow,C=o.align,I=o.cellClassName,S=o.spanMethod,L=o.radioConfig,k=void 0===L?{}:L,B=o.expandConfig,P=void 0===B?{}:B,R=o.selectConfig,q=void 0===R?{}:R,E=o.treeConfig,O=void 0===E?{}:E,D=o.mouseConfig,H=void 0===D?{}:D,U=o.editConfig,M=o.editRules,X=o.validOpts,Y=o.editStore,A=o.validStore,N=a.editRender,z=a.align,j=a.showOverflow,F=a.className,K=Y.actived,W=n?a.fixed!==n:a.fixed&&w,G=_xeUtils.default.isUndefined(j)||_xeUtils.default.isNull(j)?T:j,V="ellipsis"===G,J="title"===G,Q=!0===G||"tooltip"===G,Z=J||Q||V,ee={},le=z||C,oe=A.row===c&&A.column===a,te=M&&("default"===X.message?y||1<m.length:"inline"===X.message),re={"data-colid":a.id},ne=N&&U&&"dblclick"===U.trigger,ie={$table:o,$seq:t,seq:r,row:c,rowIndex:s,$rowIndex:d,column:a,columnIndex:u,$columnIndex:f,fixed:n,isHidden:W,level:i,data:m};if(!h&&!_||Z||(V=!0),(J||Q||g["cell-mouseenter"])&&(ee.mouseenter=function(e){if(!isOperateMouse(o)){var l={$table:o,seq:r,row:c,rowIndex:s,$rowIndex:d,column:a,columnIndex:u,$columnIndex:f,fixed:n,isHidden:W,level:i,cell:e.currentTarget};J?_tools.DomTools.updateCellTitle(e):Q&&o.triggerTooltipEvent(e,l),_tools.UtilTools.emitEvent(o,"cell-mouseenter",[l,e])}}),(Q||g["cell-mouseleave"])&&(ee.mouseleave=function(e){isOperateMouse(o)||(Q&&o.clostTooltip(),_tools.UtilTools.emitEvent(o,"cell-mouseleave",[{$table:o,seq:r,row:c,rowIndex:s,$rowIndex:d,column:a,columnIndex:u,$columnIndex:f,fixed:n,isHidden:W,level:i,cell:e.currentTarget},e]))}),(H.checked||H.selected)&&(ee.mousedown=function(e){o.triggerCellMousedownEvent(e,{$table:o,seq:r,row:c,rowIndex:s,$rowIndex:d,column:a,columnIndex:u,$columnIndex:f,fixed:n,isHidden:W,level:i,cell:e.currentTarget})}),($||g["cell-click"]||H.checked||N&&U||"row"===P.trigger||"cell"===P.trigger||"row"===k.trigger||"radio"===a.type&&"cell"===k.trigger||"row"===q.trigger||"selection"===a.type&&"cell"===q.trigger||"row"===O.trigger||a.treeNode&&"cell"===O.trigger)&&(ee.click=function(e){o.triggerCellClickEvent(e,{$table:o,row:c,rowIndex:s,$rowIndex:d,column:a,columnIndex:u,$columnIndex:f,fixed:n,isHidden:W,level:i,cell:e.currentTarget})}),(ne||g["cell-dblclick"])&&(ee.dblclick=function(e){o.triggerCellDBLClickEvent(e,{$table:o,seq:r,row:c,rowIndex:s,$rowIndex:d,column:a,columnIndex:u,$columnIndex:f,fixed:n,isHidden:W,level:i,cell:e.currentTarget})}),S){var ce=S(ie)||{},se=ce.rowspan,de=void 0===se?1:se,ae=ce.colspan,ue=void 0===ae?1:ae;if(!de||!ue)return null;re.rowspan=de,re.colspan=ue}return!W&&U&&U.showStatus&&(x=o.hasRowChange(c,a.property)),e("td",{class:["vxe-body--column",a.id,(p={},_defineProperty(p,"col--".concat(le),le),_defineProperty(p,"col--edit",N),_defineProperty(p,"col--index","index"===a.type),_defineProperty(p,"col--ellipsis",Z),_defineProperty(p,"edit--visible",N&&"visible"===N.type),_defineProperty(p,"fixed--hidden",W),_defineProperty(p,"col--dirty",x),_defineProperty(p,"col--actived",U&&N&&K.row===c&&(K.column===a||"row"===U.mode)),_defineProperty(p,"col--valid-error",oe),p),_tools.UtilTools.getClass(F,ie),_tools.UtilTools.getClass(I,ie)],key:b?a.id:u,attrs:re,on:ee},T&&W?[]:[e("div",{class:["vxe-cell",{"c--title":J,"c--tooltip":Q,"c--ellipsis":V}],attrs:{title:J?_tools.UtilTools.getCellLabel(c,a,ie):null}},a.renderCell(e,ie)),te?oe?e("div",{class:"vxe-cell--valid",style:A.rule&&A.rule.width?{width:"".concat(A.rule.width,"px")}:null},[e("span",{class:"vxe-cell--valid-msg"},A.content)]):v():null])}function renderRows(u,f,p,x,v,g,e,m){var y=p.rowKey,b=p.highlightHoverRow,w=p.rowClassName,h=p.treeConfig,_=p.treeExpandeds,$=p.scrollYLoad,T=p.scrollYStore,C=p.editStore,I=p.expandeds,S=p.getColumnIndex,L=[];return e.forEach(function(t,r){var e,l={},n=r,i=n+1;$&&(i+=T.startIndex),n=p.getRowIndex(t),b&&(l.mouseenter=function(e){isOperateMouse(p)||p.triggerHoverEvent(e,{row:t,rowIndex:n})});var o=_tools.UtilTools.getRowid(p,t);if(L.push(u("tr",{class:["vxe-body--row",(e={},_defineProperty(e,"row--level-".concat(v),h),_defineProperty(e,"row--new",-1<C.insertList.indexOf(t)),e),w?_xeUtils.default.isFunction(w)?w({$table:p,$seq:x,seq:i,fixedType:g,rowLevel:v,row:t,rowIndex:n,$rowIndex:r}):w:""],attrs:{"data-rowid":o},key:y||h?o:r,on:l},m.map(function(e,l){var o=S(e);return renderColumn(u,f,p,x,i,g,v,t,n,r,e,o,l)}))),I.length&&-1<I.indexOf(t)){var c,s=m.find(function(e){return"expand"===e.type}),d=S(s);h&&(c={paddingLeft:"".concat(v*(h.indent||16)+30,"px")}),s&&L.push(u("tr",{class:"vxe-body--expanded-row",key:"expand_".concat(o),on:l},[u("td",{class:"vxe-body--expanded-column",attrs:{colspan:m.length}},[u("div",{class:["vxe-body--expanded-cell",{"fixed--hidden":g}],style:c},[s.renderData(u,{$table:p,seq:i,row:t,rowIndex:n,column:s,columnIndex:d,fixed:g,level:v})])])]))}if(h&&_.length){var a=t[h.children];a&&a.length&&-1<_.indexOf(t)&&L.push.apply(L,renderRows(u,f,p,x?"".concat(x,".").concat(i):"".concat(i),v+1,g,a,m))}}),L}function syncBodyScroll(e,l,o){(l||o)&&(l&&(l.onscroll=null,l.scrollTop=e),o&&(o.onscroll=null,o.scrollTop=e),clearTimeout(scrollProcessTimeout),scrollProcessTimeout=setTimeout(function(){l&&(l.onscroll=l._onscroll),o&&(o.onscroll=o._onscroll)},100))}var _default={name:"VxeTableBody",props:{tableData:Array,tableColumn:Array,visibleColumn:Array,collectColumn:Array,fixedColumn:Array,size:String,fixedType:String,isGroup:Boolean},mounted:function(){var e=this.$parent,l=this.$el,o=this.$refs,t=this.fixedType,r=e.elemStore,n="".concat(t||"main","-body-");r["".concat(n,"wrapper")]=l,r["".concat(n,"table")]=o.table,r["".concat(n,"colgroup")]=o.colgroup,r["".concat(n,"list")]=o.tbody,r["".concat(n,"xSpace")]=o.xSpace,r["".concat(n,"ySpace")]=o.ySpace,r["".concat(n,"emptyBlock")]=o.emptyBlock,this.$el.onscroll=this.scrollEvent,this.$el._onscroll=this.scrollEvent},beforeDestroy:function(){this.$el._onscroll=null,this.$el.onscroll=null},render:function(o){var e=this._e,l=this.$parent,t=this.fixedColumn,r=this.fixedType,n=l.$scopedSlots,i=l.tableData,c=l.tableColumn,s=l.showOverflow,d=l.scrollXLoad,a=l.mouseConfig,u=void 0===a?{}:a,f=l.keyboardConfig,p=void 0===f?{}:f;return r&&s?c=t:d&&r&&(c=t),o("div",{class:["vxe-table--body-wrapper",r?"fixed-".concat(r,"--wrapper"):"body--wrapper"]},[r?e():o("div",{class:"vxe-body--x-space",ref:"xSpace"}),o("div",{class:"vxe-body--y-space",ref:"ySpace"}),o("table",{class:"vxe-table--body",attrs:{cellspacing:0,cellpadding:0,border:0},ref:"table"},[o("colgroup",{ref:"colgroup"},c.map(function(e,l){return o("col",{attrs:{name:e.id},key:l})})),o("tbody",{ref:"tbody"},renderRows(o,this,l,"",0,r,i,c))]),r||!u.checked&&!p.isCut?null:o("div",{class:"vxe-table--borders"},[u.checked?renderBorder(o,"check"):null,p.isCut?renderBorder(o,"copy"):null]),r?null:o("div",{class:"vxe-table--empty-block".concat(i.length?"":" is--visible"),ref:"emptyBlock"},[o("span",{class:"vxe-table--empty-text"},n.empty?n.empty.call(this,{$table:l},o):_conf.default.i18n("vxe.table.emptyText"))])])},methods:{scrollEvent:function(e){var l=this.$parent,o=this.fixedType,t=l.$refs,r=l.highlightHoverRow,n=l.scrollXLoad,i=l.scrollYLoad,c=l.lastScrollTop,s=l.lastScrollLeft,d=t.tableHeader,a=t.tableBody,u=t.leftBody,f=t.rightBody,p=t.tableFooter,x=d?d.$el:null,v=p?p.$el:null,g=a.$el,m=u?u.$el:null,y=f?f.$el:null,b=g.scrollTop,w=g.scrollLeft,h=w!==s,_=b!==c;l.lastScrollTop=b,l.lastScrollLeft=w,l.lastScrollTime=Date.now(),r&&l.clearHoverRow(),m&&"left"===o?syncBodyScroll(b=m.scrollTop,g,y):y&&"right"===o?syncBodyScroll(b=y.scrollTop,g,m):(h&&(x&&(x.scrollLeft=g.scrollLeft),v&&(v.scrollLeft=g.scrollLeft)),(m||y)&&(l.checkScrolling(),_&&syncBodyScroll(b,m,y))),n&&h&&(l.triggerScrollXEvent(e),x&&w+g.clientWidth>=g.scrollWidth&&this.$nextTick(function(){g.scrollLeft!==x.scrollLeft&&(x.scrollLeft=g.scrollLeft)})),i&&_&&l.triggerScrollYEvent(e),_tools.UtilTools.emitEvent(l,"scroll",[{type:"body",fixed:o,scrollTop:b,scrollLeft:w,isX:h,isY:_,$table:l},e])}}};exports.default=_default;