vxe-table 4.19.6 → 4.19.8
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.
- package/dist/all.esm.js +203 -75
- package/dist/style.css +1 -1
- package/es/grid/src/grid.js +1 -1
- package/es/style.css +1 -1
- package/es/table/src/body.js +11 -11
- package/es/table/src/group.js +3 -0
- package/es/table/src/table.js +169 -61
- package/es/table/src/util.js +18 -1
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/lib/grid/src/grid.js +1 -1
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/index.umd.js +70 -31
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/table/src/body.js +11 -11
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/group.js +3 -0
- package/lib/table/src/group.min.js +1 -1
- package/lib/table/src/table.js +35 -16
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +19 -1
- package/lib/table/src/util.min.js +1 -1
- package/lib/ui/index.js +1 -1
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/package.json +2 -2
- package/packages/grid/src/grid.ts +1 -1
- package/packages/table/src/body.ts +13 -13
- package/packages/table/src/group.ts +4 -0
- package/packages/table/src/table.ts +175 -63
- package/packages/table/src/util.ts +21 -1
- /package/es/{iconfont.1780293024194.ttf → iconfont.1780726776354.ttf} +0 -0
- /package/es/{iconfont.1780293024194.woff → iconfont.1780726776354.woff} +0 -0
- /package/es/{iconfont.1780293024194.woff2 → iconfont.1780726776354.woff2} +0 -0
- /package/lib/{iconfont.1780293024194.ttf → iconfont.1780726776354.ttf} +0 -0
- /package/lib/{iconfont.1780293024194.woff → iconfont.1780726776354.woff} +0 -0
- /package/lib/{iconfont.1780293024194.woff2 → iconfont.1780726776354.woff2} +0 -0
package/lib/table/src/body.js
CHANGED
|
@@ -468,23 +468,13 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
468
468
|
class: 'vxe-cell--wrapper vxe-body-cell--wrapper'
|
|
469
469
|
}, column.renderCell(cellParams)));
|
|
470
470
|
}
|
|
471
|
-
tdVNs.push((0, _vue.h)('div', {
|
|
472
|
-
key: 'tc',
|
|
473
|
-
class: ['vxe-cell', {
|
|
474
|
-
'c--title': showTitle,
|
|
475
|
-
'c--tooltip': showTooltip,
|
|
476
|
-
'c--ellipsis': showEllipsis
|
|
477
|
-
}],
|
|
478
|
-
style: tcStyle,
|
|
479
|
-
title: showTitle ? $xeTable.getCellLabel(row, column) : null
|
|
480
|
-
}, clVNs));
|
|
481
471
|
if (showValidTip && errorValidItem) {
|
|
482
472
|
const errRule = errorValidItem.rule;
|
|
483
473
|
const validSlot = slots ? slots.valid : null;
|
|
484
474
|
const validParams = Object.assign(Object.assign(Object.assign({}, cellParams), errorValidItem), {
|
|
485
475
|
rule: errorValidItem
|
|
486
476
|
});
|
|
487
|
-
|
|
477
|
+
clVNs.push((0, _vue.h)('div', {
|
|
488
478
|
key: 'tcv',
|
|
489
479
|
class: ['vxe-cell--valid-error-tip', (0, _dom.getPropClass)(validOpts.className, validParams)],
|
|
490
480
|
style: errRule && errRule.maxWidth ? {
|
|
@@ -496,6 +486,16 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
496
486
|
class: 'vxe-cell--valid-error-msg'
|
|
497
487
|
}, errorValidItem.content)]])]));
|
|
498
488
|
}
|
|
489
|
+
tdVNs.push((0, _vue.h)('div', {
|
|
490
|
+
key: 'tc',
|
|
491
|
+
class: ['vxe-cell', {
|
|
492
|
+
'c--title': showTitle,
|
|
493
|
+
'c--tooltip': showTooltip,
|
|
494
|
+
'c--ellipsis': showEllipsis
|
|
495
|
+
}],
|
|
496
|
+
style: tcStyle,
|
|
497
|
+
title: showTitle ? $xeTable.getCellLabel(row, column) : null
|
|
498
|
+
}, clVNs));
|
|
499
499
|
}
|
|
500
500
|
let showAreaRowStatus = false;
|
|
501
501
|
if (mouseConfig && mouseOpts.area && !_columnIndex && selectCellToRow) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _vue=require("vue"),_comp=require("../../ui/src/comp"),_xeUtils=_interopRequireDefault(require("xe-utils")),_ui=require("../../ui"),_util=require("./util"),_dom=require("../../ui/src/dom"),_utils=require("../../ui/src/utils"),_vn=require("../../ui/src/vn");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}let{getI18n,renderer,renderEmptyElement}=_ui.VxeUI,sourceType="table",renderType="body";var _default=exports.default=(0,_comp.defineVxeComponent)({name:"VxeTableBody",props:{tableData:Array,tableColumn:Array,fixedColumn:Array,fixedType:{type:String,default:""}},setup(C){let Qe=(0,_vue.inject)("$xeTable",{}),{xID:R,props:Ze,context:E,reactData:el,internalData:ll}=Qe,{computeEditOpts:tl,computeMouseOpts:al,computeCellOffsetWidth:rl,computeAreaOpts:ol,computeDefaultRowHeight:il,computeEmptyOpts:D,computeTooltipOpts:nl,computeRadioOpts:e,computeExpandOpts:ae,computeTreeOpts:l,computeCheckboxOpts:sl,computeCellOpts:dl,computeValidOpts:ul,computeRowOpts:cl,computeColumnOpts:pl,computeRowDragOpts:vl,computeResizableOpts:gl,computeVirtualXOpts:xl,computeVirtualYOpts:hl,computeIsBodyRenderOptimize:q}=Qe.getComputeMaps(),I=(0,_vue.ref)(),O=(0,_vue.ref)(),S=(0,_vue.ref)(),M=(0,_vue.ref)(),T=(0,_vue.ref)(),k=(0,_vue.ref)(),$=(0,_vue.ref)(),z=(0,_vue.ref)(),ml=()=>{var e=Ze.delayHover,l=el.isDragResize,t=ll.lastSTime;return!!(l||t&&Date.now()<t+e)},wl=(r,o,i)=>{var n=o.column,s=Ze.treeConfig,d=dl.value,u=cl.value,c=il.value,p=l.value,{slots:n,treeNode:v}=n,g=ll.fullAllDataRowIdData;if(s&&v&&(p.showLine||p.line)){if(n&&n.line)return Qe.callSlot(n.line,o);s=g[r];let e=0,l=null,t=null,a="";return(s&&(e=s.level,l=s.items[s.treeIndex-1],t=s.parent),e||p.showRootLine)?(l?(v=g[(0,_util.getRowid)(Qe,l)]||{},a=`${v.lineHeight||0}px`):e&&t&&(n=g[(0,_util.getRowid)(Qe,t)]||{},a=`calc(-1em + ${Math.floor(i/2+(0,_util.getCellRestHeight)(n,d,u,c)/2)}px)`),[(0,_vue.h)("div",{key:"tl",class:"vxe-tree--line-wrapper"},[(0,_vue.h)("div",{class:"vxe-tree--line",style:{height:a,bottom:`-${Math.floor(i/2)}px`,left:`calc(${e*p.indent}px + 1em)`}})])]):[]}return[]},oe=(H,e,l,A,F,t,B,U,a,r,N,j,o)=>{var i=Qe.xeGrid,L=Qe.xeGantt,{columnKey:G,resizable:n,showOverflow:s,border:W,height:d,treeConfig:V,cellClassName:P,cellStyle:X,align:Y,spanMethod:K,mouseConfig:J,editConfig:Q,editRules:u,tooltipConfig:c,padding:p}=Ze,{tableData:Z,tableColumn:ee,dragRow:le,overflowX:te,overflowY:ae,currentColumn:re,scrollXLoad:v,scrollYLoad:oe,mergeBodyFlag:ie,calcCellHeightFlag:g,resizeHeightFlag:ne,resizeWidthFlag:se,editStore:de,isAllOverflow:ue,validErrorMaps:x}=el,{fullAllDataRowIdData:ce,fullColumnIdData:h,mergeBodyCellMaps:pe,visibleColumn:ve,afterFullData:ge,mergeBodyList:xe,scrollXStore:he,scrollYStore:me,keepUpdateFieldMaps:we}=ll,m=dl.value,w=ul.value,_=sl.value,_e=tl.value,b=nl.value,be=gl.value,fe=xl.value,ye=hl.value,{isAllColumnDrag:be,isAllRowDrag:Ce}=be,f=cl.value,y=vl.value,Re=il.value,g=g?m.height||f.height:0,{disabledMethod:C,isCrossDrag:Ee,isPeerDrag:De}=y,Ie=pl.value,Oe=al.value,Se=ol.value,Me=rl.value,Se=Se.selectCellToRow,{field:Te,type:ke,cellRender:R,editRender:E,align:$e,showOverflow:ze,className:qe,treeNode:He,rowResize:Ae,padding:D,verticalAlign:I,slots:Fe}=r,O=m.verticalAlign,de=de.actived,Be=ce[e]||{},S=r.id,h=h[S]||{},R=E||R,R=R?renderer.get(R.name):null,Ue=R?R.tableCellClassName||R.cellClassName:null,Ne=R?R.tableCellStyle||R.cellStyle:"";let je=b.showAll;var Le=h.index,b=h._index,h=(0,_utils.isEnableConf)(E),E=ne?Be.resizeHeight:0;let M=te&&(l?r.fixed!==l:!!r.fixed);ne=_xeUtils.default.eqNull(D)?null===p?m.padding:p:D,p=_xeUtils.default.eqNull(ze)?s:ze,D="ellipsis"===p;let T="title"===p,k=!0===p||"tooltip"===p;s=ue||T||k||D,ze=_xeUtils.default.isBoolean(r.resizable)?r.resizable:Ie.resizable||n,p=!!g,n=0<E;let Ge;g={},E=$e||(R?R.tableCellAlign:"")||Y,$e=_xeUtils.default.eqNull(I)?O:I,R=x[e+":"+S],Y=u&&w.showErrorMessage&&("default"===w.message?d||1<Z.length:"inline"===w.message),O={colid:S};let $={$table:Qe,$grid:i,$gantt:L,isEdit:!1,seq:H,rowid:e,row:t,rowIndex:B,$rowIndex:U,_rowIndex:a,column:r,columnIndex:Le,$columnIndex:N,_columnIndex:b,fixed:l,source:sourceType,type:renderType,isHidden:!!M,level:F,visibleData:ge,data:Z,items:o},z=!1,We=!1,q=((z=f.drag?"row"===y.trigger||r.dragSort&&"cell"===y.trigger:z)&&(We=!(!C||!C($))),(T||k||je||c)&&(g.onMouseover=e=>{ml()||(T?(0,_dom.updateCellTitle)(e.currentTarget,r):(k||je)&&Qe.triggerBodyTooltipEvent(e,$)),Qe.dispatchEvent("cell-mouseenter",Object.assign({cell:e.currentTarget},$),e)}),(k||je||c)&&(g.onMouseleave=e=>{ml()||(k||je)&&Qe.handleTargetLeaveEvent(e),Qe.dispatchEvent("cell-mouseleave",Object.assign({cell:e.currentTarget},$),e)}),(z||_.range||J)&&(g.onMousedown=e=>{Qe.triggerCellMousedownEvent(e,$)}),z&&(g.onMouseup=Qe.triggerCellMouseupEvent),g.onClick=e=>{Qe.triggerCellClickEvent(e,$)},!(g.onDblclick=e=>{Qe.triggerCellDblclickEvent(e,$)})),Ve=1,Pe=1;if(ie&&xe.length){I=pe[a+":"+b];if(I){var{rowspan:x,colspan:u}=I;if(!x||!u)return renderEmptyElement(Qe);1<x&&(q=!0,Pe=x,O.rowspan=x),1<u&&(q=!0,Ve=u,O.colspan=u)}}else if(K){var{rowspan:d=1,colspan:i=1}=K($)||{};if(!d||!i)return renderEmptyElement(Qe);1<d&&(q=!0,Pe=d,O.rowspan=d),1<i&&(q=!0,Ve=i,O.colspan=i)}!(M=M&&q&&(1<O.colspan||1<O.rowspan)?!1:M)&&Q&&(_e.showStatus||_e.showUpdateStatus)&&we[Te]&&(Ge=Qe.isUpdateByRow(t,Te));L=!s&&(oe||v);let Xe=(0,_util.getCellRestHeight)(Be,m,f,Re);H=N===j.length-1,B=!r.resizeWidth&&("auto"===r.minWidth||"auto"===r.width);let Ye=!1;q||le&&(0,_util.getRowid)(Qe,le)===e||(ae&&oe&&16<Z.length&&!V&&!ye.immediate&&(a<me.visibleStartIndex-me.preloadSize||a>me.visibleEndIndex+me.preloadSize)||te&&v&&10<ee.length&&!fe.immediate&&!r.fixed&&(b<he.visibleStartIndex-he.preloadSize||b>he.visibleEndIndex+he.preloadSize))&&(Ye=!0),1<Pe&&(U=ge[a+Pe-1])&&(o=ce[(0,_util.getRowid)(Qe,U)])&&(Xe+=o.oTop+(0,_util.getCellRestHeight)(o,m,f,Re)-Be.oTop-(0,_util.getCellRestHeight)(Be,m,f,Re));y={};if(s&&se){let l=0;if(1<Ve)for(let e=1;e<Ve;e++){var Ke=ve[Le+e];Ke&&(l+=Ke.renderWidth)}y.width=r.renderWidth+l-Me+"px"}oe||v||s||p||n?y.height=Xe+"px":y.minHeight=Xe+"px";C=[];M&&ue?C.push((0,_vue.h)("div",{key:"tc",class:["vxe-cell",{"c--title":T,"c--tooltip":k,"c--ellipsis":D}],style:y})):(V&&C.push(...wl(e,$,Xe)),c=[],Ye||c.push((0,_vue.h)("div",{colid:S,rowid:e,class:"vxe-cell--wrapper vxe-body-cell--wrapper"},r.renderCell($))),C.push((0,_vue.h)("div",{key:"tc",class:["vxe-cell",{"c--title":T,"c--tooltip":k,"c--ellipsis":D}],style:y,title:T?Qe.getCellLabel(t,r):null},c)),Y&&R&&(_=R.rule,ie=Fe?Fe.valid:null,xe=Object.assign(Object.assign(Object.assign({},$),R),{rule:R}),C.push((0,_vue.h)("div",{key:"tcv",class:["vxe-cell--valid-error-tip",(0,_dom.getPropClass)(w.className,xe)],style:_&&_.maxWidth?{width:_.maxWidth+"px"}:null},[(0,_vue.h)("div",{class:"vxe-cell--valid-error-wrapper vxe-cell--valid-error-theme-"+(w.theme||"normal")},[ie?Qe.callSlot(ie,xe):[(0,_vue.h)("span",{class:"vxe-cell--valid-error-msg"},R.content)]])]))));let Je=!1;return J&&Oe.area&&!b&&Se&&(Je=!0),!M&&ze&&be&&C.push((0,_vue.h)("div",{key:"tcc",class:["vxe-cell--col-resizable",{"is--line":!W||"none"===W}],onMousedown:e=>Qe.handleColResizeMousedownEvent(e,l,$),onDblclick:e=>Qe.handleColResizeDblclickEvent(e,$)})),(Ae||Ce)&&f.resizable&&C.push((0,_vue.h)("div",{key:"tcr",class:"vxe-cell--row-resizable",onMousedown:e=>Qe.handleRowResizeMousedownEvent(e,$),onDblclick:e=>Qe.handleRowResizeDblclickEvent(e,$)})),(0,_vue.h)("td",Object.assign(Object.assign(Object.assign({class:["vxe-table--column vxe-body--column",S,$e?"col--vertical-"+$e:"",E?"col--"+E:"",ke?"col--"+ke:"",{"col--last":H,"col--tree-node":He,"col--edit":h,"col--ellipsis":s,"col--cs-height":p,"col--rs-height":n,"col--to-row":Je,"col--auto-height":L,"fixed--width":!B,"fixed--hidden":M,"is--padding":ne,"is--progress":M&&ue||Ye,"is--drag-cell":z&&(Ee||De||!F),"is--drag-disabled":We,"col--dirty":Ge,"col--active":Q&&h&&de.row===t&&(de.column===r||"row"===_e.mode),"col--valid-error":!!R,"show--valid-bg":R&&w.showErrorBackground,"col--current":re===r},(0,_dom.getPropClass)(Ue,$),(0,_dom.getPropClass)(qe,$),(0,_dom.getPropClass)(P,$)],key:G||v||oe||Ie.useKey||f.useKey||Ie.drag?S:N},O),{style:Object.assign({},_xeUtils.default.isFunction(Ne)?Ne($):Ne,_xeUtils.default.isFunction(X)?X($):X)}),g),A&&M?[]:C)},re=(h,m,w,_)=>{let b=Qe.xeGrid,f=Qe.xeGantt,{stripe:y,rowKey:C,highlightHoverRow:R,rowClassName:E,rowStyle:D,editConfig:I,treeConfig:O}=Ze,{hasFixedColumn:S,treeExpandedFlag:M,scrollYLoad:T,isAllOverflow:k,rowExpandedFlag:$,expandColumn:z,selectRadioRow:q,pendingRowFlag:H,rowExpandHeightFlag:A,isRowGroupStatus:F}=el,{fullAllDataRowIdData:B,fullColumnIdData:U,treeExpandedMaps:N,pendingRowMaps:j,rowExpandedMaps:L,currentRow:G}=ll,W=sl.value,Q=e.value,V=l.value,P=tl.value,X=cl.value,Z=pl.value,{transform:Y,seqMode:K}=V,ee=V.children||V.childrenField,J=[],le=(0,_util.createHandleGetRowId)(Qe).handleGetRowId,te=O||F;return w.forEach((a,r)=>{let o=le(a);var i=B[o]||{};let n=r,s=0,d=-1,u=-1;var c=F&&a.isAggregate,p={},v=((X.isHover||R)&&(p.onMouseover=e=>{ml()||Qe.triggerHoverEvent(e,{row:a,rowIndex:n})},p.onMouseleave=()=>{ml()||Qe.clearHoverRow()}),i&&(n=i.index,u=i._index,s=i.level,d=i.seq,c||O&&Y&&"increasing"===K?d=i._index+1:O&&"fixed"===K&&(d=i._tIndex+1)),{$table:Qe,seq:d,rowid:o,fixed:h,type:renderType,level:s,row:a,rowIndex:n,$rowIndex:r,_rowIndex:u}),g=z&&!!$&&!!L[o];let e=!1,l=[],t=!1;I&&(t=Qe.isInsertByRow(a)),!O||T||Y||(l=a[ee],e=!!M&&l&&0<l.length&&!!N[o]),!X.drag||F||O&&!Y||(p.onDragstart=Qe.handleRowDragDragstartEvent,p.onDragend=Qe.handleRowDragDragendEvent,p.onDragover=Qe.handleRowDragDragoverEvent);var c=["vxe-body--row",te?"row--level-"+s:"",{"row--stripe":y&&(u+1)%2==0,"is--new":t,"is--expand-row":g,"is--expand-tree":e,"row--new":t&&(P.showStatus||P.showInsertStatus),"row--radio":Q.highlight&&Qe.eqRow(q,a),"row--checked":W.highlight&&Qe.isCheckedByCheckboxRow(a),"row--pending":!!H&&!!j[o],"row--group":c,"row--current":G&&o===(0,_util.getRowid)(Qe,G)},(0,_dom.getPropClass)(E,v)],x=_.map((e,l)=>oe(d,o,h,m,s,a,n,r,u,e,l,_,w));if(J.push((0,_vue.h)("tr",Object.assign({class:c,rowid:o,style:D?_xeUtils.default.isFunction(D)?D(v):D:null,key:C||X.useKey||X.drag||Z.drag||F||O?o:r},p),x)),g){var{height:c,padding:v,mode:p}=ae.value;if("fixed"===p){x=i.expandHeight;let e=0;A&&(x||c)&&(e=(x||c||0)+1),J.push((0,_vue.h)("tr",{class:"vxe-body--row-expanded-place",key:"expand_"+o,rowid:o},[(0,_vue.h)("td",{class:"vxe-body--row-expanded-place-column",colspan:_.length,style:{height:e+"px"}})]))}else{g={},p=(c&&(g.height=c+"px"),O&&(g.paddingLeft=s*V.indent+30+"px"),z||{}).showOverflow,i=z.id,x=U[i]||{},i=_xeUtils.default.eqNull(p)?k:p;let e=-1,l=-1,t=-1;x&&(e=x.index,l=x.$index,t=x._index);p={$table:Qe,$grid:b,$gantt:f,seq:d,column:z,columnIndex:e,$columnIndex:l,_columnIndex:t,fixed:h,source:sourceType,type:renderType,level:s,row:a,rowid:o,rowIndex:n,$rowIndex:r,_rowIndex:u,isHidden:!1,isEdit:!1,visibleData:[],data:[],items:[]};J.push((0,_vue.h)("tr",{class:["vxe-body--expanded-row",{"is--padding":v}],key:"expand_"+o},[(0,_vue.h)("td",{class:["vxe-body--expanded-column",{"fixed--hidden":h&&!S,"col--ellipsis":i}],colspan:_.length},[(0,_vue.h)("div",{class:["vxe-body--expanded-cell",{"is--ellipsis":c}],style:g},[z.renderData(p)])])]))}}e&&J.push(...re(h,m,l,_))}),J};(0,_vue.onMounted)(()=>{(0,_vue.nextTick)(()=>{var e=C.fixedType,l=ll.elemStore,e=`${e||"main"}-body-`;l[e+"wrapper"]=I,l[e+"scroll"]=O,l[e+"table"]=S,l[e+"colgroup"]=M,l[e+"list"]=T,l[e+"xSpace"]=k,l[e+"ySpace"]=$,l[e+"emptyBlock"]=z})}),(0,_vue.onUnmounted)(()=>{var e=C.fixedType,l=ll.elemStore,e=`${e||"main"}-body-`;l[e+"wrapper"]=null,l[e+"scroll"]=null,l[e+"table"]=null,l[e+"colgroup"]=null,l[e+"list"]=null,l[e+"xSpace"]=null,l[e+"ySpace"]=null,l[e+"emptyBlock"]=null});return()=>{var e=E.slots,l=Qe.xeGrid,t=Qe.xeGantt;let{fixedColumn:a,fixedType:r,tableColumn:o}=C;var i=Ze.mouseConfig,{isGroup:n,tableData:s,isColLoading:d,overflowX:u,scrollXLoad:c,scrollYLoad:p,dragRow:v,dragCol:g}=el,{visibleColumn:x,fullAllDataRowIdData:h,fullColumnIdData:m}=ll,w=D.value,_=al.value;let b=s,f=o;s=q.value;d||!r&&u||(f=x),r&&s&&(f=a||[]),p&&v&&2<b.length&&(d=h[(0,_util.getRowid)(Qe,v)])&&(u=d._index,x=b[0],p=b[b.length-1],d=h[(0,_util.getRowid)(Qe,x)],x=h[(0,_util.getRowid)(Qe,p)],d)&&x&&(h=d._index,p=x._index,u<h?b=[v].concat(b):p<u&&(b=b.concat([v]))),r||n||c&&g&&2<f.length&&(d=m[g.id])&&(x=d._index,h=f[0],p=f[f.length-1],u=m[h.id],v=m[p.id],u)&&v&&(n=u._index,c=v._index,x<n?f=[g].concat(f):c<x&&(f=f.concat([g])));let y;d=e?e.empty:null,h={$table:Qe,$grid:l,$gantt:t};return y=d?Qe.callSlot(d,h):(p=(m=w.name?renderer.get(w.name):null)?m.renderTableEmpty||m.renderTableEmptyView||m.renderEmpty:null)?(0,_vn.getSlotVNs)(p(w,h)):Ze.emptyText||getI18n("vxe.table.emptyText"),(0,_vue.h)("div",{ref:I,class:["vxe-table--body-wrapper",r?`fixed-${r}--wrapper`:"body--wrapper"],xid:R},[(0,_vue.h)("div",{ref:O,class:"vxe-table--body-inner-wrapper",onScroll(e){Qe.triggerBodyScrollEvent(e,r)}},[r?renderEmptyElement(Qe):(0,_vue.h)("div",{ref:k,class:"vxe-body--x-space"}),(0,_vue.h)("div",{ref:$,class:"vxe-body--y-space"}),(0,_vue.h)("table",{ref:S,class:"vxe-table--body",xid:R,cellspacing:0,cellpadding:0,border:0,xvm:s?"1":null},[(0,_vue.h)("colgroup",{ref:M},f.map((e,l)=>(0,_vue.h)("col",{name:e.id,key:l,style:{width:e.renderWidth+"px"}}))),(0,_vue.h)("tbody",{ref:T},re(r,s,b,f))]),(0,_vue.h)("div",{class:"vxe-table--checkbox-range"}),i&&_.area?(0,_vue.h)("div",{class:"vxe-table--cell-area",xid:R},[(0,_vue.h)("span",{class:"vxe-table--cell-main-area"},_.extension?[(0,_vue.h)("span",{class:"vxe-table--cell-main-area-btn",onMousedown(e){Qe.triggerCellAreaExtendMousedownEvent&&Qe.triggerCellAreaExtendMousedownEvent(e,{$table:Qe,fixed:r,type:renderType})}})]:[]),(0,_vue.h)("span",{class:"vxe-table--cell-clip-area"}),(0,_vue.h)("span",{class:"vxe-table--cell-extend-area"}),(0,_vue.h)("span",{class:"vxe-table--cell-multi-area"}),(0,_vue.h)("span",{class:"vxe-table--cell-active-area"}),(0,_vue.h)("span",{class:"vxe-table--cell-row-status-area"})]):renderEmptyElement(Qe),r?renderEmptyElement(Qe):(0,_vue.h)("div",{class:"vxe-table--empty-block",ref:z},[(0,_vue.h)("div",{class:"vxe-table--empty-content"},y)])])])}}});
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _vue=require("vue"),_comp=require("../../ui/src/comp"),_xeUtils=_interopRequireDefault(require("xe-utils")),_ui=require("../../ui"),_util=require("./util"),_dom=require("../../ui/src/dom"),_utils=require("../../ui/src/utils"),_vn=require("../../ui/src/vn");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}let{getI18n,renderer,renderEmptyElement}=_ui.VxeUI,sourceType="table",renderType="body";var _default=exports.default=(0,_comp.defineVxeComponent)({name:"VxeTableBody",props:{tableData:Array,tableColumn:Array,fixedColumn:Array,fixedType:{type:String,default:""}},setup(C){let Qe=(0,_vue.inject)("$xeTable",{}),{xID:R,props:Ze,context:E,reactData:el,internalData:ll}=Qe,{computeEditOpts:tl,computeMouseOpts:al,computeCellOffsetWidth:rl,computeAreaOpts:ol,computeDefaultRowHeight:il,computeEmptyOpts:D,computeTooltipOpts:nl,computeRadioOpts:e,computeExpandOpts:ae,computeTreeOpts:l,computeCheckboxOpts:sl,computeCellOpts:dl,computeValidOpts:ul,computeRowOpts:cl,computeColumnOpts:pl,computeRowDragOpts:vl,computeResizableOpts:gl,computeVirtualXOpts:xl,computeVirtualYOpts:hl,computeIsBodyRenderOptimize:q}=Qe.getComputeMaps(),I=(0,_vue.ref)(),O=(0,_vue.ref)(),S=(0,_vue.ref)(),M=(0,_vue.ref)(),T=(0,_vue.ref)(),k=(0,_vue.ref)(),$=(0,_vue.ref)(),z=(0,_vue.ref)(),ml=()=>{var e=Ze.delayHover,l=el.isDragResize,t=ll.lastSTime;return!!(l||t&&Date.now()<t+e)},wl=(r,o,i)=>{var n=o.column,s=Ze.treeConfig,d=dl.value,u=cl.value,c=il.value,p=l.value,{slots:n,treeNode:v}=n,g=ll.fullAllDataRowIdData;if(s&&v&&(p.showLine||p.line)){if(n&&n.line)return Qe.callSlot(n.line,o);s=g[r];let e=0,l=null,t=null,a="";return(s&&(e=s.level,l=s.items[s.treeIndex-1],t=s.parent),e||p.showRootLine)?(l?(v=g[(0,_util.getRowid)(Qe,l)]||{},a=`${v.lineHeight||0}px`):e&&t&&(n=g[(0,_util.getRowid)(Qe,t)]||{},a=`calc(-1em + ${Math.floor(i/2+(0,_util.getCellRestHeight)(n,d,u,c)/2)}px)`),[(0,_vue.h)("div",{key:"tl",class:"vxe-tree--line-wrapper"},[(0,_vue.h)("div",{class:"vxe-tree--line",style:{height:a,bottom:`-${Math.floor(i/2)}px`,left:`calc(${e*p.indent}px + 1em)`}})])]):[]}return[]},oe=(H,e,l,A,F,t,B,U,a,r,N,j,o)=>{var i=Qe.xeGrid,L=Qe.xeGantt,{columnKey:G,resizable:n,showOverflow:s,border:W,height:d,treeConfig:V,cellClassName:P,cellStyle:X,align:Y,spanMethod:K,mouseConfig:J,editConfig:Q,editRules:u,tooltipConfig:c,padding:p}=Ze,{tableData:Z,tableColumn:ee,dragRow:le,overflowX:te,overflowY:ae,currentColumn:re,scrollXLoad:v,scrollYLoad:oe,mergeBodyFlag:ie,calcCellHeightFlag:g,resizeHeightFlag:ne,resizeWidthFlag:se,editStore:de,isAllOverflow:ue,validErrorMaps:x}=el,{fullAllDataRowIdData:ce,fullColumnIdData:h,mergeBodyCellMaps:pe,visibleColumn:ve,afterFullData:ge,mergeBodyList:xe,scrollXStore:he,scrollYStore:me,keepUpdateFieldMaps:we}=ll,m=dl.value,w=ul.value,_=sl.value,_e=tl.value,b=nl.value,be=gl.value,fe=xl.value,ye=hl.value,{isAllColumnDrag:be,isAllRowDrag:Ce}=be,f=cl.value,y=vl.value,Re=il.value,g=g?m.height||f.height:0,{disabledMethod:C,isCrossDrag:Ee,isPeerDrag:De}=y,Ie=pl.value,Oe=al.value,Se=ol.value,Me=rl.value,Se=Se.selectCellToRow,{field:Te,type:ke,cellRender:R,editRender:E,align:$e,showOverflow:ze,className:qe,treeNode:He,rowResize:Ae,padding:D,verticalAlign:I,slots:Fe}=r,O=m.verticalAlign,de=de.actived,Be=ce[e]||{},S=r.id,h=h[S]||{},R=E||R,R=R?renderer.get(R.name):null,Ue=R?R.tableCellClassName||R.cellClassName:null,Ne=R?R.tableCellStyle||R.cellStyle:"";let je=b.showAll;var Le=h.index,b=h._index,h=(0,_utils.isEnableConf)(E),E=ne?Be.resizeHeight:0;let M=te&&(l?r.fixed!==l:!!r.fixed);ne=_xeUtils.default.eqNull(D)?null===p?m.padding:p:D,p=_xeUtils.default.eqNull(ze)?s:ze,D="ellipsis"===p;let T="title"===p,k=!0===p||"tooltip"===p;s=ue||T||k||D,ze=_xeUtils.default.isBoolean(r.resizable)?r.resizable:Ie.resizable||n,p=!!g,n=0<E;let Ge;g={},E=$e||(R?R.tableCellAlign:"")||Y,$e=_xeUtils.default.eqNull(I)?O:I,R=x[e+":"+S],Y=u&&w.showErrorMessage&&("default"===w.message?d||1<Z.length:"inline"===w.message),O={colid:S};let $={$table:Qe,$grid:i,$gantt:L,isEdit:!1,seq:H,rowid:e,row:t,rowIndex:B,$rowIndex:U,_rowIndex:a,column:r,columnIndex:Le,$columnIndex:N,_columnIndex:b,fixed:l,source:sourceType,type:renderType,isHidden:!!M,level:F,visibleData:ge,data:Z,items:o},z=!1,We=!1,q=((z=f.drag?"row"===y.trigger||r.dragSort&&"cell"===y.trigger:z)&&(We=!(!C||!C($))),(T||k||je||c)&&(g.onMouseover=e=>{ml()||(T?(0,_dom.updateCellTitle)(e.currentTarget,r):(k||je)&&Qe.triggerBodyTooltipEvent(e,$)),Qe.dispatchEvent("cell-mouseenter",Object.assign({cell:e.currentTarget},$),e)}),(k||je||c)&&(g.onMouseleave=e=>{ml()||(k||je)&&Qe.handleTargetLeaveEvent(e),Qe.dispatchEvent("cell-mouseleave",Object.assign({cell:e.currentTarget},$),e)}),(z||_.range||J)&&(g.onMousedown=e=>{Qe.triggerCellMousedownEvent(e,$)}),z&&(g.onMouseup=Qe.triggerCellMouseupEvent),g.onClick=e=>{Qe.triggerCellClickEvent(e,$)},!(g.onDblclick=e=>{Qe.triggerCellDblclickEvent(e,$)})),Ve=1,Pe=1;if(ie&&xe.length){I=pe[a+":"+b];if(I){var{rowspan:x,colspan:u}=I;if(!x||!u)return renderEmptyElement(Qe);1<x&&(q=!0,Pe=x,O.rowspan=x),1<u&&(q=!0,Ve=u,O.colspan=u)}}else if(K){var{rowspan:d=1,colspan:i=1}=K($)||{};if(!d||!i)return renderEmptyElement(Qe);1<d&&(q=!0,Pe=d,O.rowspan=d),1<i&&(q=!0,Ve=i,O.colspan=i)}!(M=M&&q&&(1<O.colspan||1<O.rowspan)?!1:M)&&Q&&(_e.showStatus||_e.showUpdateStatus)&&we[Te]&&(Ge=Qe.isUpdateByRow(t,Te));L=!s&&(oe||v);let Xe=(0,_util.getCellRestHeight)(Be,m,f,Re);H=N===j.length-1,B=!r.resizeWidth&&("auto"===r.minWidth||"auto"===r.width);let Ye=!1;q||le&&(0,_util.getRowid)(Qe,le)===e||(ae&&oe&&16<Z.length&&!V&&!ye.immediate&&(a<me.visibleStartIndex-me.preloadSize||a>me.visibleEndIndex+me.preloadSize)||te&&v&&10<ee.length&&!fe.immediate&&!r.fixed&&(b<he.visibleStartIndex-he.preloadSize||b>he.visibleEndIndex+he.preloadSize))&&(Ye=!0),1<Pe&&(U=ge[a+Pe-1])&&(o=ce[(0,_util.getRowid)(Qe,U)])&&(Xe+=o.oTop+(0,_util.getCellRestHeight)(o,m,f,Re)-Be.oTop-(0,_util.getCellRestHeight)(Be,m,f,Re));y={};if(s&&se){let l=0;if(1<Ve)for(let e=1;e<Ve;e++){var Ke=ve[Le+e];Ke&&(l+=Ke.renderWidth)}y.width=r.renderWidth+l-Me+"px"}oe||v||s||p||n?y.height=Xe+"px":y.minHeight=Xe+"px";C=[];M&&ue?C.push((0,_vue.h)("div",{key:"tc",class:["vxe-cell",{"c--title":T,"c--tooltip":k,"c--ellipsis":D}],style:y})):(V&&C.push(...wl(e,$,Xe)),c=[],Ye||c.push((0,_vue.h)("div",{colid:S,rowid:e,class:"vxe-cell--wrapper vxe-body-cell--wrapper"},r.renderCell($))),Y&&R&&(_=R.rule,ie=Fe?Fe.valid:null,xe=Object.assign(Object.assign(Object.assign({},$),R),{rule:R}),c.push((0,_vue.h)("div",{key:"tcv",class:["vxe-cell--valid-error-tip",(0,_dom.getPropClass)(w.className,xe)],style:_&&_.maxWidth?{width:_.maxWidth+"px"}:null},[(0,_vue.h)("div",{class:"vxe-cell--valid-error-wrapper vxe-cell--valid-error-theme-"+(w.theme||"normal")},[ie?Qe.callSlot(ie,xe):[(0,_vue.h)("span",{class:"vxe-cell--valid-error-msg"},R.content)]])]))),C.push((0,_vue.h)("div",{key:"tc",class:["vxe-cell",{"c--title":T,"c--tooltip":k,"c--ellipsis":D}],style:y,title:T?Qe.getCellLabel(t,r):null},c)));let Je=!1;return J&&Oe.area&&!b&&Se&&(Je=!0),!M&&ze&&be&&C.push((0,_vue.h)("div",{key:"tcc",class:["vxe-cell--col-resizable",{"is--line":!W||"none"===W}],onMousedown:e=>Qe.handleColResizeMousedownEvent(e,l,$),onDblclick:e=>Qe.handleColResizeDblclickEvent(e,$)})),(Ae||Ce)&&f.resizable&&C.push((0,_vue.h)("div",{key:"tcr",class:"vxe-cell--row-resizable",onMousedown:e=>Qe.handleRowResizeMousedownEvent(e,$),onDblclick:e=>Qe.handleRowResizeDblclickEvent(e,$)})),(0,_vue.h)("td",Object.assign(Object.assign(Object.assign({class:["vxe-table--column vxe-body--column",S,$e?"col--vertical-"+$e:"",E?"col--"+E:"",ke?"col--"+ke:"",{"col--last":H,"col--tree-node":He,"col--edit":h,"col--ellipsis":s,"col--cs-height":p,"col--rs-height":n,"col--to-row":Je,"col--auto-height":L,"fixed--width":!B,"fixed--hidden":M,"is--padding":ne,"is--progress":M&&ue||Ye,"is--drag-cell":z&&(Ee||De||!F),"is--drag-disabled":We,"col--dirty":Ge,"col--active":Q&&h&&de.row===t&&(de.column===r||"row"===_e.mode),"col--valid-error":!!R,"show--valid-bg":R&&w.showErrorBackground,"col--current":re===r},(0,_dom.getPropClass)(Ue,$),(0,_dom.getPropClass)(qe,$),(0,_dom.getPropClass)(P,$)],key:G||v||oe||Ie.useKey||f.useKey||Ie.drag?S:N},O),{style:Object.assign({},_xeUtils.default.isFunction(Ne)?Ne($):Ne,_xeUtils.default.isFunction(X)?X($):X)}),g),A&&M?[]:C)},re=(h,m,w,_)=>{let b=Qe.xeGrid,f=Qe.xeGantt,{stripe:y,rowKey:C,highlightHoverRow:R,rowClassName:E,rowStyle:D,editConfig:I,treeConfig:O}=Ze,{hasFixedColumn:S,treeExpandedFlag:M,scrollYLoad:T,isAllOverflow:k,rowExpandedFlag:$,expandColumn:z,selectRadioRow:q,pendingRowFlag:H,rowExpandHeightFlag:A,isRowGroupStatus:F}=el,{fullAllDataRowIdData:B,fullColumnIdData:U,treeExpandedMaps:N,pendingRowMaps:j,rowExpandedMaps:L,currentRow:G}=ll,W=sl.value,Q=e.value,V=l.value,P=tl.value,X=cl.value,Z=pl.value,{transform:Y,seqMode:K}=V,ee=V.children||V.childrenField,J=[],le=(0,_util.createHandleGetRowId)(Qe).handleGetRowId,te=O||F;return w.forEach((a,r)=>{let o=le(a);var i=B[o]||{};let n=r,s=0,d=-1,u=-1;var c=F&&a.isAggregate,p={},v=((X.isHover||R)&&(p.onMouseover=e=>{ml()||Qe.triggerHoverEvent(e,{row:a,rowIndex:n})},p.onMouseleave=()=>{ml()||Qe.clearHoverRow()}),i&&(n=i.index,u=i._index,s=i.level,d=i.seq,c||O&&Y&&"increasing"===K?d=i._index+1:O&&"fixed"===K&&(d=i._tIndex+1)),{$table:Qe,seq:d,rowid:o,fixed:h,type:renderType,level:s,row:a,rowIndex:n,$rowIndex:r,_rowIndex:u}),g=z&&!!$&&!!L[o];let e=!1,l=[],t=!1;I&&(t=Qe.isInsertByRow(a)),!O||T||Y||(l=a[ee],e=!!M&&l&&0<l.length&&!!N[o]),!X.drag||F||O&&!Y||(p.onDragstart=Qe.handleRowDragDragstartEvent,p.onDragend=Qe.handleRowDragDragendEvent,p.onDragover=Qe.handleRowDragDragoverEvent);var c=["vxe-body--row",te?"row--level-"+s:"",{"row--stripe":y&&(u+1)%2==0,"is--new":t,"is--expand-row":g,"is--expand-tree":e,"row--new":t&&(P.showStatus||P.showInsertStatus),"row--radio":Q.highlight&&Qe.eqRow(q,a),"row--checked":W.highlight&&Qe.isCheckedByCheckboxRow(a),"row--pending":!!H&&!!j[o],"row--group":c,"row--current":G&&o===(0,_util.getRowid)(Qe,G)},(0,_dom.getPropClass)(E,v)],x=_.map((e,l)=>oe(d,o,h,m,s,a,n,r,u,e,l,_,w));if(J.push((0,_vue.h)("tr",Object.assign({class:c,rowid:o,style:D?_xeUtils.default.isFunction(D)?D(v):D:null,key:C||X.useKey||X.drag||Z.drag||F||O?o:r},p),x)),g){var{height:c,padding:v,mode:p}=ae.value;if("fixed"===p){x=i.expandHeight;let e=0;A&&(x||c)&&(e=(x||c||0)+1),J.push((0,_vue.h)("tr",{class:"vxe-body--row-expanded-place",key:"expand_"+o,rowid:o},[(0,_vue.h)("td",{class:"vxe-body--row-expanded-place-column",colspan:_.length,style:{height:e+"px"}})]))}else{g={},p=(c&&(g.height=c+"px"),O&&(g.paddingLeft=s*V.indent+30+"px"),z||{}).showOverflow,i=z.id,x=U[i]||{},i=_xeUtils.default.eqNull(p)?k:p;let e=-1,l=-1,t=-1;x&&(e=x.index,l=x.$index,t=x._index);p={$table:Qe,$grid:b,$gantt:f,seq:d,column:z,columnIndex:e,$columnIndex:l,_columnIndex:t,fixed:h,source:sourceType,type:renderType,level:s,row:a,rowid:o,rowIndex:n,$rowIndex:r,_rowIndex:u,isHidden:!1,isEdit:!1,visibleData:[],data:[],items:[]};J.push((0,_vue.h)("tr",{class:["vxe-body--expanded-row",{"is--padding":v}],key:"expand_"+o},[(0,_vue.h)("td",{class:["vxe-body--expanded-column",{"fixed--hidden":h&&!S,"col--ellipsis":i}],colspan:_.length},[(0,_vue.h)("div",{class:["vxe-body--expanded-cell",{"is--ellipsis":c}],style:g},[z.renderData(p)])])]))}}e&&J.push(...re(h,m,l,_))}),J};(0,_vue.onMounted)(()=>{(0,_vue.nextTick)(()=>{var e=C.fixedType,l=ll.elemStore,e=`${e||"main"}-body-`;l[e+"wrapper"]=I,l[e+"scroll"]=O,l[e+"table"]=S,l[e+"colgroup"]=M,l[e+"list"]=T,l[e+"xSpace"]=k,l[e+"ySpace"]=$,l[e+"emptyBlock"]=z})}),(0,_vue.onUnmounted)(()=>{var e=C.fixedType,l=ll.elemStore,e=`${e||"main"}-body-`;l[e+"wrapper"]=null,l[e+"scroll"]=null,l[e+"table"]=null,l[e+"colgroup"]=null,l[e+"list"]=null,l[e+"xSpace"]=null,l[e+"ySpace"]=null,l[e+"emptyBlock"]=null});return()=>{var e=E.slots,l=Qe.xeGrid,t=Qe.xeGantt;let{fixedColumn:a,fixedType:r,tableColumn:o}=C;var i=Ze.mouseConfig,{isGroup:n,tableData:s,isColLoading:d,overflowX:u,scrollXLoad:c,scrollYLoad:p,dragRow:v,dragCol:g}=el,{visibleColumn:x,fullAllDataRowIdData:h,fullColumnIdData:m}=ll,w=D.value,_=al.value;let b=s,f=o;s=q.value;d||!r&&u||(f=x),r&&s&&(f=a||[]),p&&v&&2<b.length&&(d=h[(0,_util.getRowid)(Qe,v)])&&(u=d._index,x=b[0],p=b[b.length-1],d=h[(0,_util.getRowid)(Qe,x)],x=h[(0,_util.getRowid)(Qe,p)],d)&&x&&(h=d._index,p=x._index,u<h?b=[v].concat(b):p<u&&(b=b.concat([v]))),r||n||c&&g&&2<f.length&&(d=m[g.id])&&(x=d._index,h=f[0],p=f[f.length-1],u=m[h.id],v=m[p.id],u)&&v&&(n=u._index,c=v._index,x<n?f=[g].concat(f):c<x&&(f=f.concat([g])));let y;d=e?e.empty:null,h={$table:Qe,$grid:l,$gantt:t};return y=d?Qe.callSlot(d,h):(p=(m=w.name?renderer.get(w.name):null)?m.renderTableEmpty||m.renderTableEmptyView||m.renderEmpty:null)?(0,_vn.getSlotVNs)(p(w,h)):Ze.emptyText||getI18n("vxe.table.emptyText"),(0,_vue.h)("div",{ref:I,class:["vxe-table--body-wrapper",r?`fixed-${r}--wrapper`:"body--wrapper"],xid:R},[(0,_vue.h)("div",{ref:O,class:"vxe-table--body-inner-wrapper",onScroll(e){Qe.triggerBodyScrollEvent(e,r)}},[r?renderEmptyElement(Qe):(0,_vue.h)("div",{ref:k,class:"vxe-body--x-space"}),(0,_vue.h)("div",{ref:$,class:"vxe-body--y-space"}),(0,_vue.h)("table",{ref:S,class:"vxe-table--body",xid:R,cellspacing:0,cellpadding:0,border:0,xvm:s?"1":null},[(0,_vue.h)("colgroup",{ref:M},f.map((e,l)=>(0,_vue.h)("col",{name:e.id,key:l,style:{width:e.renderWidth+"px"}}))),(0,_vue.h)("tbody",{ref:T},re(r,s,b,f))]),(0,_vue.h)("div",{class:"vxe-table--checkbox-range"}),i&&_.area?(0,_vue.h)("div",{class:"vxe-table--cell-area",xid:R},[(0,_vue.h)("span",{class:"vxe-table--cell-main-area"},_.extension?[(0,_vue.h)("span",{class:"vxe-table--cell-main-area-btn",onMousedown(e){Qe.triggerCellAreaExtendMousedownEvent&&Qe.triggerCellAreaExtendMousedownEvent(e,{$table:Qe,fixed:r,type:renderType})}})]:[]),(0,_vue.h)("span",{class:"vxe-table--cell-clip-area"}),(0,_vue.h)("span",{class:"vxe-table--cell-extend-area"}),(0,_vue.h)("span",{class:"vxe-table--cell-multi-area"}),(0,_vue.h)("span",{class:"vxe-table--cell-active-area"}),(0,_vue.h)("span",{class:"vxe-table--cell-row-status-area"})]):renderEmptyElement(Qe),r?renderEmptyElement(Qe):(0,_vue.h)("div",{class:"vxe-table--empty-block",ref:z},[(0,_vue.h)("div",{class:"vxe-table--empty-content"},y)])])])}}});
|
package/lib/table/src/group.js
CHANGED
|
@@ -27,6 +27,9 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
27
27
|
if (slots.header) {
|
|
28
28
|
columnSlots.header = slots.header;
|
|
29
29
|
}
|
|
30
|
+
if (slots.title) {
|
|
31
|
+
columnSlots.title = slots.title;
|
|
32
|
+
}
|
|
30
33
|
columnConfig.slots = columnSlots;
|
|
31
34
|
columnConfig.children = [];
|
|
32
35
|
(0, _util.watchColumn)($xeTable, props, columnConfig);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _vue=require("vue"),_comp=require("../../ui/src/comp"),_column=require("./column"),_util=require("./util"),_cell=_interopRequireDefault(require("./cell"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}var _default=exports.default=(0,_comp.defineVxeComponent)({name:"VxeColgroup",props:_column.columnProps,setup(e,{slots:u}){let
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _vue=require("vue"),_comp=require("../../ui/src/comp"),_column=require("./column"),_util=require("./util"),_cell=_interopRequireDefault(require("./cell"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}var _default=exports.default=(0,_comp.defineVxeComponent)({name:"VxeColgroup",props:_column.columnProps,setup(e,{slots:u}){let l=(0,_vue.ref)(),r=(0,_vue.inject)("$xeTable",null),t=(0,_vue.inject)("$xeColgroup",null);if(!r)return()=>(0,_vue.createCommentVNode)();let o=_cell.default.createColumn(r,e);var n={},n=(u.header&&(n.header=u.header),u.title&&(n.title=u.title),o.slots=n,o.children=[],(0,_util.watchColumn)(r,e,o),(0,_vue.onMounted)(()=>{var e=l.value;e&&(0,_util.assembleColumn)(r,e,o,t)}),(0,_vue.onUnmounted)(()=>{(0,_util.destroyColumn)(r,o)}),{columnConfig:o});return(0,_vue.provide)("$xeColgroup",n),(0,_vue.provide)("$xeGrid",null),(0,_vue.provide)("$xeGantt",null),()=>{var e=u.default;return(0,_vue.h)("div",{ref:l},e?e():[])}}});
|
package/lib/table/src/table.js
CHANGED
|
@@ -62,9 +62,9 @@ remainList.forEach(column=>{const width=Math.max(meanWidth,minCellWidth);column.
|
|
|
62
62
|
* 排除已设置 max-width
|
|
63
63
|
*/const dynamicList=scaleList.concat(scaleMinList).concat(pxMinList).concat(autoMinList).concat(remainList).filter(column=>!parseColumnMaxWidth(column));let dynamicSize=dynamicList.length-1;if(dynamicSize>0){let i=bodyWidth-tWidth;if(i>0){while(i>0&&dynamicSize>=0){i--;dynamicList[dynamicSize--].renderWidth++;}tWidth=bodyWidth;}}}reactData.scrollXWidth=tWidth;reactData.resizeWidthFlag++;updateColumnOffsetLeft();updateHeight();};/**
|
|
64
64
|
* 计算自适应行高
|
|
65
|
-
*/const calcCellAutoHeight=(rowRest,wrapperEl)=>{const{
|
|
65
|
+
*/const calcCellAutoHeight=(rowid,rowRest,wrapperEl)=>{const{fullCellHeightMaps}=internalData;let chRest=fullCellHeightMaps[rowid];if(!chRest){chRest={};fullCellHeightMaps[rowid]=chRest;}const wrapperElemList=wrapperEl.querySelectorAll(`.vxe-cell--wrapper[rowid="${rowRest.rowid}"]`);let firstCellStyle=null;let topBottomPadding=0;let changeCH=false;for(let i=0;i<wrapperElemList.length;i++){const wrapperElem=wrapperElemList[i];const cellElem=wrapperElem.parentElement;const cellStyle=cellElem.style;const orHeight=cellStyle.height;const colid=wrapperElem.getAttribute('colid')||'';cellStyle.height='';if(!firstCellStyle){firstCellStyle=getComputedStyle(cellElem);topBottomPadding=firstCellStyle?Math.ceil(_xeUtils.default.toNumber(firstCellStyle.paddingTop)+_xeUtils.default.toNumber(firstCellStyle.paddingBottom)):0;}const cellHeight=wrapperElem?wrapperElem.clientHeight:0;const colHeight=Math.ceil(cellHeight+topBottomPadding);if(chRest[colid]!==colHeight){changeCH=true;chRest[colid]=colHeight;}cellStyle.height=orHeight;}const cellMaxHeight=(0,_util.getRowMaxHeight)(chRest,changeCH);return cellMaxHeight;};/**
|
|
66
66
|
* 自适应行高
|
|
67
|
-
*/const calcCellHeight=()=>{const{treeConfig}=props;const{tableData,isAllOverflow,scrollYLoad,scrollXLoad}=reactData;const{fullAllDataRowIdData}=internalData;const el=refElem.value;if(!el||!el.clientWidth){return;}const treeOpts=computeTreeOpts.value;const defaultRowHeight=computeDefaultRowHeight.value;if(!isAllOverflow&&(scrollYLoad||scrollXLoad||treeConfig&&treeOpts.showLine)){const{handleGetRowId}=(0,_util.createHandleGetRowId)($xeTable);el.setAttribute('data-calc-row','Y');tableData.forEach(row=>{const rowid=handleGetRowId(row);const rowRest=fullAllDataRowIdData[rowid];if(rowRest){const reHeight=calcCellAutoHeight(rowRest,el);rowRest.height=Math.max(defaultRowHeight,reHeight);}el.removeAttribute('data-calc-row');});reactData.calcCellHeightFlag++;}};const getOrderField=column=>{const{isRowGroupStatus}=reactData;const{sortBy,sortType,aggFunc}=column;return isRowGroupStatus&&aggFunc?row=>{if(row.isAggregate){const aggData=row.aggData;const currAggData=aggData?aggData[column.field]:null;return currAggData?currAggData.value:null;}let cellValue;if(sortBy){cellValue=_xeUtils.default.isFunction(sortBy)?sortBy({row,column}):_xeUtils.default.get(row,sortBy);}else{cellValue=$xeTable.getCellLabel(row,column);}if(!sortType||sortType==='auto'){return isNaN(cellValue)?cellValue:_xeUtils.default.toNumber(cellValue);}else if(sortType==='number'){return _xeUtils.default.toNumber(cellValue);}else if(sortType==='string'){return _xeUtils.default.toValueString(cellValue);}return cellValue;}:row=>{let cellValue;if(sortBy){cellValue=_xeUtils.default.isFunction(sortBy)?sortBy({row,column}):_xeUtils.default.get(row,sortBy);}else{cellValue=$xeTable.getCellLabel(row,column);}if(!sortType||sortType==='auto'){return isNaN(cellValue)?cellValue:_xeUtils.default.toNumber(cellValue);}else if(sortType==='number'){return _xeUtils.default.toNumber(cellValue);}else if(sortType==='string'){return _xeUtils.default.toValueString(cellValue);}return cellValue;};};const updateAfterListIndex=()=>{const{treeConfig}=props;const{afterFullData,fullDataRowIdData,fullAllDataRowIdData}=internalData;const{handleGetRowId}=(0,_util.createHandleGetRowId)($xeTable);const fullMaps={};afterFullData.forEach((row,index)=>{const rowid=handleGetRowId(row);const rowRest=fullAllDataRowIdData[rowid];const seq=index+1;if(rowRest){if(!treeConfig){rowRest.seq=seq;}rowRest._index=index;}else{const rest={row,rowid,seq,index:-1,$index:-1,_index:index,treeIndex:-1,_tIndex:-1,items:[],parent:null,level:0,height:0,resizeHeight:0,oTop:0,expandHeight:0};fullAllDataRowIdData[rowid]=rest;fullDataRowIdData[rowid]=rest;}fullMaps[rowid]=row;});internalData.afterFullRowMaps=fullMaps;};/**
|
|
67
|
+
*/const calcCellHeight=()=>{const{treeConfig}=props;const{tableData,isAllOverflow,scrollYLoad,scrollXLoad}=reactData;const{fullAllDataRowIdData}=internalData;const el=refElem.value;if(!el||!el.clientWidth){return;}const treeOpts=computeTreeOpts.value;const defaultRowHeight=computeDefaultRowHeight.value;if(!isAllOverflow&&(scrollYLoad||scrollXLoad||treeConfig&&treeOpts.showLine)){const{handleGetRowId}=(0,_util.createHandleGetRowId)($xeTable);el.setAttribute('data-calc-row','Y');tableData.forEach(row=>{const rowid=handleGetRowId(row);const rowRest=fullAllDataRowIdData[rowid];if(rowRest){const reHeight=calcCellAutoHeight(rowid,rowRest,el);rowRest.height=Math.max(defaultRowHeight,reHeight);}el.removeAttribute('data-calc-row');});reactData.calcCellHeightFlag++;}};const getOrderField=column=>{const{isRowGroupStatus}=reactData;const{sortBy,sortType,aggFunc}=column;return isRowGroupStatus&&aggFunc?row=>{if(row.isAggregate){const aggData=row.aggData;const currAggData=aggData?aggData[column.field]:null;return currAggData?currAggData.value:null;}let cellValue;if(sortBy){cellValue=_xeUtils.default.isFunction(sortBy)?sortBy({row,column}):_xeUtils.default.get(row,sortBy);}else{cellValue=$xeTable.getCellLabel(row,column);}if(!sortType||sortType==='auto'){return isNaN(cellValue)?cellValue:_xeUtils.default.toNumber(cellValue);}else if(sortType==='number'){return _xeUtils.default.toNumber(cellValue);}else if(sortType==='string'){return _xeUtils.default.toValueString(cellValue);}return cellValue;}:row=>{let cellValue;if(sortBy){cellValue=_xeUtils.default.isFunction(sortBy)?sortBy({row,column}):_xeUtils.default.get(row,sortBy);}else{cellValue=$xeTable.getCellLabel(row,column);}if(!sortType||sortType==='auto'){return isNaN(cellValue)?cellValue:_xeUtils.default.toNumber(cellValue);}else if(sortType==='number'){return _xeUtils.default.toNumber(cellValue);}else if(sortType==='string'){return _xeUtils.default.toValueString(cellValue);}return cellValue;};};const updateAfterListIndex=()=>{const{treeConfig}=props;const{afterFullData,fullDataRowIdData,fullAllDataRowIdData}=internalData;const{handleGetRowId}=(0,_util.createHandleGetRowId)($xeTable);const fullMaps={};afterFullData.forEach((row,index)=>{const rowid=handleGetRowId(row);const rowRest=fullAllDataRowIdData[rowid];const seq=index+1;if(rowRest){if(!treeConfig){rowRest.seq=seq;}rowRest._index=index;}else{const rest={row,rowid,seq,index:-1,$index:-1,_index:index,treeIndex:-1,_tIndex:-1,items:[],parent:null,level:0,height:0,resizeHeight:0,oTop:0,expandHeight:0};fullAllDataRowIdData[rowid]=rest;fullDataRowIdData[rowid]=rest;}fullMaps[rowid]=row;});internalData.afterFullRowMaps=fullMaps;};/**
|
|
68
68
|
* 预编译
|
|
69
69
|
* 对渲染中的数据提前解析序号及索引。牺牲提前编译耗时换取渲染中额外损耗,使运行时更加流畅
|
|
70
70
|
*/const updateAfterDataIndex=()=>{const{treeConfig}=props;const{fullDataRowIdData,fullAllDataRowIdData,afterFullData,afterTreeFullData}=internalData;const treeOpts=computeTreeOpts.value;const{transform}=treeOpts;const childrenField=treeOpts.children||treeOpts.childrenField;const fullMaps={};if(treeConfig){let _treeIndex=0;const{handleGetRowId}=(0,_util.createHandleGetRowId)($xeTable);_xeUtils.default.eachTree(afterTreeFullData,(row,index,items,path)=>{const rowid=handleGetRowId(row);const rowRest=fullAllDataRowIdData[rowid];const seq=path.map((num,i)=>i%2===0?Number(num)+1:'.').join('');if(rowRest){rowRest.seq=seq;rowRest.treeIndex=index;rowRest._tIndex=_treeIndex;}else{const rest={row,rowid,seq,index:-1,$index:-1,_index:-1,treeIndex:-1,_tIndex:_treeIndex,items:[],parent:null,level:0,height:0,resizeHeight:0,oTop:0,expandHeight:0};fullAllDataRowIdData[rowid]=rest;fullDataRowIdData[rowid]=rest;}_treeIndex++;fullMaps[rowid]=row;},{children:transform?treeOpts.mapChildrenField:childrenField});if(transform){afterFullData.forEach((row,index)=>{const rowid=handleGetRowId(row);const rowRest=fullAllDataRowIdData[rowid];const seq=index+1;if(rowRest){if(!treeConfig){rowRest.seq=seq;}rowRest._index=index;}});}internalData.afterFullRowMaps=fullMaps;}else{updateAfterListIndex();}};/**
|
|
@@ -87,7 +87,7 @@ if(allSortMethod){const sortRests=allSortMethod({data:tableTree,sortList:orderCo
|
|
|
87
87
|
if(allSortMethod){const sortRests=allSortMethod({data:tableTree,sortList:orderColumns,$table:$xeTable});tableTree=_xeUtils.default.isArray(sortRests)?sortRests:tableTree;}else{const treeList=_xeUtils.default.toTreeArray(tableTree,{children:mapChildrenField});tableTree=_xeUtils.default.toArrayTree(_xeUtils.default.orderBy(treeList,orderColumns.map(({column,order})=>[getOrderField(column),order])),{key:rowField,parentKey:parentField,children:childrenField,mapChildren:mapChildrenField});}tableData=tableTree;}else{if(allSortMethod){const sortRests=allSortMethod({data:tableData,sortList:orderColumns,$table:$xeTable});tableData=_xeUtils.default.isArray(sortRests)?sortRests:tableData;}else{tableData=_xeUtils.default.orderBy(tableData,orderColumns.map(({column,order})=>[getOrderField(column),order]));}tableTree=tableData;}}}else{if(isRowGroupStatus){// 还原行分组
|
|
88
88
|
// 还原虚拟树
|
|
89
89
|
tableTree=_xeUtils.default.searchTree(tableFullGroupData,()=>true,{original:true,isEvery:true,children:aggregateOpts.mapChildrenField,mapChildren:aggregateOpts.childrenField});tableData=tableTree;}else if(treeConfig&&transform&&isSortDeep!==false){// 还原虚拟树
|
|
90
|
-
tableTree=_xeUtils.default.searchTree(tableFullTreeData,()=>true,{original:true,isEvery,children:mapChildrenField,mapChildren:childrenField});tableData=tableTree;}else{tableData=treeConfig?tableFullTreeData.slice(0):tableFullData.slice(0);tableTree=tableData;}}internalData.afterFullData=tableData;internalData.afterTreeFullData=tableTree;internalData.afterGroupFullData=tableTree;updateAfterDataIndex();};const updateStyle=()=>{const{mouseConfig}=props;const{isGroup,tableColumn,overflowX,scrollbarWidth,overflowY,scrollbarHeight,scrollXWidth,columnStore,editStore,isColLoading}=reactData;const{visibleColumn,tableHeight,elemStore,currentRow,customHeight,customMinHeight,customMaxHeight,tHeaderHeight,tFooterHeight}=internalData;const $xeGanttView=internalData.xeGanttView;const el=refElem.value;if(!el||internalData.tBodyHeight&&!el.clientHeight){return;}const containerList=['main','left','right'];const{leftList,rightList}=columnStore;let osbWidth=overflowY?scrollbarWidth:0;let osbHeight=overflowX?scrollbarHeight:0;const emptyPlaceholderElem=refEmptyPlaceholder.value;const isHeaderRenderOptimize=computeIsHeaderRenderOptimize.value;const isBodyRenderOptimize=computeIsBodyRenderOptimize.value;const isFooterRenderOptimize=computeIsFooterRenderOptimize.value;const scrollbarOpts=computeScrollbarOpts.value;const mouseOpts=computeMouseOpts.value;const bodyWrapperElem=(0,_util.getRefElem)(elemStore['main-body-wrapper']);const bodyTableElem=(0,_util.getRefElem)(elemStore['main-body-table']);if(emptyPlaceholderElem){emptyPlaceholderElem.style.top=`${tHeaderHeight}px`;emptyPlaceholderElem.style.height=bodyWrapperElem?`${bodyWrapperElem.offsetHeight-osbHeight}px`:'';}const scrollbarXConf=scrollbarOpts.x||{};const scrollbarYConf=scrollbarOpts.y||{};const scrollbarYToLeft=computeScrollbarYToLeft.value;let xScrollbarVisible=overflowX?'visible':'hidden';if(scrollbarXConf.visible==='visible'||$xeGanttView){osbHeight=scrollbarHeight;xScrollbarVisible='visible';}else if(scrollbarXConf.visible==='hidden'||scrollbarXConf.visible===false){osbHeight=0;xScrollbarVisible='hidden';}let yScrollbarVisible=overflowY?'visible':'hidden';if(scrollbarYConf.visible==='hidden'||scrollbarYConf.visible===false||$xeGanttView&&!scrollbarYToLeft){osbWidth=0;yScrollbarVisible='hidden';}else if(scrollbarYConf.visible==='visible'){osbWidth=scrollbarWidth;yScrollbarVisible='visible';}let tbHeight=0;let bodyMaxHeight=0;const bodyMinHeight=customMinHeight-tHeaderHeight-tFooterHeight-osbHeight;if(customMaxHeight){bodyMaxHeight=Math.max(bodyMinHeight,customMaxHeight-tHeaderHeight-tFooterHeight-osbHeight);}if(customHeight){tbHeight=customHeight-tHeaderHeight-tFooterHeight-osbHeight;}if(!tbHeight){if(bodyTableElem){tbHeight=bodyTableElem.clientHeight;}}if(tbHeight){if(bodyMaxHeight){tbHeight=Math.min(bodyMaxHeight,tbHeight);}tbHeight=Math.max(bodyMinHeight,tbHeight);}const xLeftCornerEl=refScrollXLeftCornerElem.value;const xRightCornerEl=refScrollXRightCornerElem.value;const scrollXVirtualEl=refScrollXVirtualElem.value;if(scrollXVirtualEl){scrollXVirtualEl.style.height=`${osbHeight}px`;scrollXVirtualEl.style.visibility=xScrollbarVisible;}const xWrapperEl=refScrollXWrapperElem.value;if(xWrapperEl){xWrapperEl.style.width=`${el.clientWidth-osbWidth}px`;if(scrollbarYToLeft){xWrapperEl.style.left=`${osbWidth}px`;}else{xWrapperEl.style.left='';}}if(xLeftCornerEl){if(scrollbarYToLeft){xLeftCornerEl.style.width=`${osbWidth}px`;xLeftCornerEl.style.display=overflowY&&osbWidth?'block':'';}else{xLeftCornerEl.style.display='';}}if(xRightCornerEl){if(scrollbarYToLeft){xRightCornerEl.style.display='';}else{xRightCornerEl.style.width=`${osbWidth}px`;xRightCornerEl.style.display=xScrollbarVisible==='visible'?'block':'';}}const scrollYVirtualEl=refScrollYVirtualElem.value;if(scrollYVirtualEl){scrollYVirtualEl.style.width=`${osbWidth}px`;scrollYVirtualEl.style.height=`${tbHeight+tHeaderHeight+tFooterHeight}px`;scrollYVirtualEl.style.visibility=yScrollbarVisible;}const yTopCornerEl=refScrollYTopCornerElem.value;if(yTopCornerEl){yTopCornerEl.style.height=`${tHeaderHeight}px`;yTopCornerEl.style.display=tHeaderHeight&&yScrollbarVisible==='visible'?'block':'';}const yWrapperEl=refScrollYWrapperElem.value;if(yWrapperEl){yWrapperEl.style.height=`${tbHeight}px`;yWrapperEl.style.top=`${tHeaderHeight}px`;}const yBottomCornerEl=refScrollYBottomCornerElem.value;if(yBottomCornerEl){yBottomCornerEl.style.height=`${tFooterHeight}px`;yBottomCornerEl.style.top=`${tHeaderHeight+tbHeight}px`;yBottomCornerEl.style.display=tFooterHeight&&yScrollbarVisible==='visible'?'block':'';}const rowExpandEl=refRowExpandElem.value;if(rowExpandEl){rowExpandEl.style.height=`${tbHeight}px`;rowExpandEl.style.top=`${tHeaderHeight}px`;}internalData.tBodyHeight=tbHeight;containerList.forEach((name,index)=>{const fixedType=index>0?name:'';const layoutList=['header','body','footer'];const isFixedLeft=fixedType==='left';let fixedColumn=[];let fixedWrapperElem;if(fixedType){fixedColumn=isFixedLeft?leftList:rightList;fixedWrapperElem=isFixedLeft?refLeftContainer.value:refRightContainer.value;}layoutList.forEach(layout=>{const wrapperElem=(0,_util.getRefElem)(elemStore[`${name}-${layout}-wrapper`]);const currScrollElem=(0,_util.getRefElem)(elemStore[`${name}-${layout}-scroll`]);const tableElem=(0,_util.getRefElem)(elemStore[`${name}-${layout}-table`]);if(layout==='header'){// 表头体样式处理
|
|
90
|
+
tableTree=_xeUtils.default.searchTree(tableFullTreeData,()=>true,{original:true,isEvery,children:mapChildrenField,mapChildren:childrenField});tableData=tableTree;}else{tableData=treeConfig?tableFullTreeData.slice(0):tableFullData.slice(0);tableTree=tableData;}}internalData.afterFullData=tableData;internalData.afterTreeFullData=tableTree;internalData.afterGroupFullData=tableTree;updateAfterDataIndex();};const updateStyle=()=>{const{mouseConfig}=props;const{isGroup,tableColumn,overflowX,scrollbarWidth,overflowY,scrollbarHeight,scrollXWidth,columnStore,editStore,isColLoading}=reactData;const{visibleColumn,tableHeight,elemStore,currentRow,customHeight,customMinHeight,customMaxHeight,tHeaderHeight,tFooterHeight}=internalData;const $xeGanttView=internalData.xeGanttView;const el=refElem.value;if(!el||internalData.tBodyHeight&&!el.clientHeight){return;}const containerList=['main','left','right'];const{leftList,rightList}=columnStore;let osbWidth=overflowY?scrollbarWidth:0;let osbHeight=overflowX?scrollbarHeight:0;const emptyPlaceholderElem=refEmptyPlaceholder.value;const isHeaderRenderOptimize=computeIsHeaderRenderOptimize.value;const isBodyRenderOptimize=computeIsBodyRenderOptimize.value;const isFooterRenderOptimize=computeIsFooterRenderOptimize.value;const scrollbarOpts=computeScrollbarOpts.value;const mouseOpts=computeMouseOpts.value;const bodyWrapperElem=(0,_util.getRefElem)(elemStore['main-body-wrapper']);const bodyTableElem=(0,_util.getRefElem)(elemStore['main-body-table']);if(emptyPlaceholderElem){emptyPlaceholderElem.style.top=`${tHeaderHeight}px`;emptyPlaceholderElem.style.height=bodyWrapperElem?`${bodyWrapperElem.offsetHeight-osbHeight}px`:'';}const scrollbarXConf=scrollbarOpts.x||{};const scrollbarYConf=scrollbarOpts.y||{};const scrollbarYToLeft=computeScrollbarYToLeft.value;let xScrollbarVisible=overflowX?'visible':'hidden';if(scrollbarXConf.visible==='visible'||$xeGanttView){osbHeight=scrollbarHeight;xScrollbarVisible='visible';}else if(scrollbarXConf.visible==='hidden'||scrollbarXConf.visible===false){osbHeight=0;xScrollbarVisible='hidden';}let yScrollbarVisible=overflowY?'visible':'hidden';if(scrollbarYConf.visible==='hidden'||scrollbarYConf.visible===false||$xeGantt&&$xeGanttView&&$xeGantt.reactData.showRightView&&!scrollbarYToLeft){osbWidth=0;yScrollbarVisible='hidden';}else if(scrollbarYConf.visible==='visible'){osbWidth=scrollbarWidth;yScrollbarVisible='visible';}let tbHeight=0;let bodyMaxHeight=0;const bodyMinHeight=customMinHeight-tHeaderHeight-tFooterHeight-osbHeight;if(customMaxHeight){bodyMaxHeight=Math.max(bodyMinHeight,customMaxHeight-tHeaderHeight-tFooterHeight-osbHeight);}if(customHeight){tbHeight=customHeight-tHeaderHeight-tFooterHeight-osbHeight;}if(!tbHeight){if(bodyTableElem){tbHeight=bodyTableElem.clientHeight;}}if(tbHeight){if(bodyMaxHeight){tbHeight=Math.min(bodyMaxHeight,tbHeight);}tbHeight=Math.max(bodyMinHeight,tbHeight);}const xLeftCornerEl=refScrollXLeftCornerElem.value;const xRightCornerEl=refScrollXRightCornerElem.value;const scrollXVirtualEl=refScrollXVirtualElem.value;if(scrollXVirtualEl){scrollXVirtualEl.style.height=`${osbHeight}px`;scrollXVirtualEl.style.visibility=xScrollbarVisible;}const xWrapperEl=refScrollXWrapperElem.value;if(xWrapperEl){xWrapperEl.style.width=`${el.clientWidth-osbWidth}px`;if(scrollbarYToLeft){xWrapperEl.style.left=`${osbWidth}px`;}else{xWrapperEl.style.left='';}}if(xLeftCornerEl){if(scrollbarYToLeft){xLeftCornerEl.style.width=`${osbWidth}px`;xLeftCornerEl.style.display=overflowY&&osbWidth?'block':'';}else{xLeftCornerEl.style.display='';}}if(xRightCornerEl){if(scrollbarYToLeft){xRightCornerEl.style.display='';}else{xRightCornerEl.style.width=`${osbWidth}px`;xRightCornerEl.style.display=xScrollbarVisible==='visible'?'block':'';}}const scrollYVirtualEl=refScrollYVirtualElem.value;if(scrollYVirtualEl){scrollYVirtualEl.style.width=`${osbWidth}px`;scrollYVirtualEl.style.height=`${tbHeight+tHeaderHeight+tFooterHeight}px`;scrollYVirtualEl.style.visibility=yScrollbarVisible;}const yTopCornerEl=refScrollYTopCornerElem.value;if(yTopCornerEl){yTopCornerEl.style.height=`${tHeaderHeight}px`;yTopCornerEl.style.display=tHeaderHeight&&yScrollbarVisible==='visible'?'block':'';}const yWrapperEl=refScrollYWrapperElem.value;if(yWrapperEl){yWrapperEl.style.height=`${tbHeight}px`;yWrapperEl.style.top=`${tHeaderHeight}px`;}const yBottomCornerEl=refScrollYBottomCornerElem.value;if(yBottomCornerEl){yBottomCornerEl.style.height=`${tFooterHeight}px`;yBottomCornerEl.style.top=`${tHeaderHeight+tbHeight}px`;yBottomCornerEl.style.display=tFooterHeight&&yScrollbarVisible==='visible'?'block':'';}const rowExpandEl=refRowExpandElem.value;if(rowExpandEl){rowExpandEl.style.height=`${tbHeight}px`;rowExpandEl.style.top=`${tHeaderHeight}px`;}internalData.tBodyHeight=tbHeight;containerList.forEach((name,index)=>{const fixedType=index>0?name:'';const layoutList=['header','body','footer'];const isFixedLeft=fixedType==='left';let fixedColumn=[];let fixedWrapperElem;if(fixedType){fixedColumn=isFixedLeft?leftList:rightList;fixedWrapperElem=isFixedLeft?refLeftContainer.value:refRightContainer.value;}layoutList.forEach(layout=>{const wrapperElem=(0,_util.getRefElem)(elemStore[`${name}-${layout}-wrapper`]);const currScrollElem=(0,_util.getRefElem)(elemStore[`${name}-${layout}-scroll`]);const tableElem=(0,_util.getRefElem)(elemStore[`${name}-${layout}-table`]);if(layout==='header'){// 表头体样式处理
|
|
91
91
|
// 横向滚动渲染
|
|
92
92
|
let renderColumnList=tableColumn;const isOptimizeMode=isHeaderRenderOptimize;if(isGroup){renderColumnList=visibleColumn;}else{if(!isOptimizeMode||!isColLoading&&(fixedType||!overflowX)){renderColumnList=visibleColumn;}if(fixedType){// 如果是使用优化模式
|
|
93
93
|
if(isOptimizeMode){renderColumnList=fixedColumn||[];}}}const tWidth=renderColumnList.reduce((previous,column)=>previous+column.renderWidth,0);if(fixedType){if(isGroup){if(wrapperElem){wrapperElem.style.width=scrollXWidth?`${scrollXWidth}px`:'';}}else{if(isOptimizeMode){if(wrapperElem){wrapperElem.style.width=tWidth?`${tWidth}px`:'';}}else{if(wrapperElem){wrapperElem.style.width=scrollXWidth?`${scrollXWidth}px`:'';}}}}if(currScrollElem){currScrollElem.style.height=`${tHeaderHeight}px`;}if(tableElem){tableElem.style.width=tWidth?`${tWidth}px`:'';}}else if(layout==='body'){if(currScrollElem){currScrollElem.style.maxHeight=customMaxHeight?`${bodyMaxHeight}px`:'';currScrollElem.style.height=customHeight?`${tbHeight}px`:'';currScrollElem.style.minHeight=`${bodyMinHeight}px`;}// 如果是固定列
|
|
@@ -151,8 +151,9 @@ if(!checkStrictly&&$xeTable.isCheckedByCheckboxRow(row)){handleCheckedCheckboxRo
|
|
|
151
151
|
const computeScrollLoad=()=>{return(0,_vue.nextTick)().then(()=>{const{scrollXLoad,scrollYLoad}=reactData;const{scrollXStore,scrollYStore}=internalData;const virtualYOpts=computeVirtualYOpts.value;const virtualXOpts=computeVirtualXOpts.value;// 计算 X 逻辑
|
|
152
152
|
if(scrollXLoad){const{toVisibleIndex:toXVisibleIndex,visibleSize:visibleXSize}=handleVirtualXVisible();const offsetXSize=Math.max(0,virtualXOpts.oSize?_xeUtils.default.toNumber(virtualXOpts.oSize):0);scrollXStore.preloadSize=_xeUtils.default.toNumber(virtualXOpts.preSize);scrollXStore.offsetSize=offsetXSize;scrollXStore.visibleSize=visibleXSize;scrollXStore.endIndex=Math.max(scrollXStore.startIndex+scrollXStore.visibleSize+offsetXSize,scrollXStore.endIndex);scrollXStore.visibleStartIndex=Math.max(scrollXStore.startIndex,toXVisibleIndex);scrollXStore.visibleEndIndex=Math.min(scrollXStore.endIndex,toXVisibleIndex+visibleXSize);$xeTable.updateScrollXData().then(()=>{loadScrollXData();});}else{$xeTable.updateScrollXSpace();}// 计算 Y 逻辑
|
|
153
153
|
const rowHeight=computeRowHeight();scrollYStore.rowHeight=rowHeight;// 已废弃
|
|
154
|
-
reactData.rowHeight=rowHeight;const{toVisibleIndex:toYVisibleIndex,visibleSize:visibleYSize}=handleVirtualYVisible();if(scrollYLoad){const offsetYSize=Math.max(0,virtualYOpts.oSize?_xeUtils.default.toNumber(virtualYOpts.oSize):0);scrollYStore.preloadSize=_xeUtils.default.toNumber(virtualYOpts.preSize);scrollYStore.offsetSize=offsetYSize;scrollYStore.visibleSize=visibleYSize;scrollYStore.endIndex=Math.max(scrollYStore.startIndex+visibleYSize+offsetYSize,scrollYStore.endIndex);scrollYStore.visibleStartIndex=Math.max(scrollYStore.startIndex,toYVisibleIndex);scrollYStore.visibleEndIndex=Math.min(scrollYStore.endIndex,toYVisibleIndex+visibleYSize);$xeTable.updateScrollYData().then(()=>{loadScrollYData();});}else{$xeTable.updateScrollYSpace();}});};const calcScrollbar=()=>{const{scrollXWidth,scrollYHeight}=reactData;const{elemStore}=internalData;const scrollbarOpts=computeScrollbarOpts.value;const el=refElem.value;if(!el||!el.clientWidth){return;}const bodyWrapperElem=(0,_util.getRefElem)(elemStore['main-body-wrapper']);const headerTableElem=(0,_util.getRefElem)(elemStore['main-header-table']);const footerTableElem=(0,_util.getRefElem)(elemStore['main-footer-table']);const xHandleEl=refScrollXHandleElem.value;const yHandleEl=refScrollYHandleElem.value;let overflowY=false;let overflowX=false;if(bodyWrapperElem){overflowY=scrollYHeight>bodyWrapperElem.clientHeight;if(yHandleEl){reactData.scrollbarWidth=scrollbarOpts.width||yHandleEl.offsetWidth-yHandleEl.clientWidth||14;}reactData.overflowY=overflowY;overflowX=scrollXWidth>bodyWrapperElem.clientWidth;if(xHandleEl){reactData.scrollbarHeight=scrollbarOpts.height||xHandleEl.offsetHeight-xHandleEl.clientHeight||14;}const hHeight=headerTableElem?headerTableElem.clientHeight:0;const fHeight=footerTableElem?footerTableElem.clientHeight:0;internalData.tableHeight=bodyWrapperElem.offsetHeight;internalData.tHeaderHeight=hHeight;internalData.tFooterHeight=fHeight;reactData.overflowX=overflowX;reactData.parentHeight=Math.max(hHeight+fHeight+20,$xeTable.getParentHeight());}if(overflowX){$xeTable.checkScrolling();}};const handleRecalculateStyle=(reFull,reWidth,reHeight)=>{const el=refElem.value;
|
|
155
|
-
if(reWidth){calcCellWidth();}if(reFull){autoCellWidth();}if(reHeight){calcCellHeight();}updateStyle();calcScrollbar();if(reFull){updateRowOffsetTop();}updateRowExpandStyle();if(reFull){updateTreeLineStyle();}if(reFull){return computeScrollLoad();}});};const handleLazyRecalculate=(reFull,reWidth,reHeight)=>{return new Promise(resolve=>{const $xeGanttView=internalData.xeGanttView;const{customStore}=reactData;const{rceTimeout,rceRunTime}=internalData;const resizeOpts=computeResizeOpts.value;
|
|
154
|
+
reactData.rowHeight=rowHeight;const{toVisibleIndex:toYVisibleIndex,visibleSize:visibleYSize}=handleVirtualYVisible();if(scrollYLoad){const offsetYSize=Math.max(0,virtualYOpts.oSize?_xeUtils.default.toNumber(virtualYOpts.oSize):0);scrollYStore.preloadSize=_xeUtils.default.toNumber(virtualYOpts.preSize);scrollYStore.offsetSize=offsetYSize;scrollYStore.visibleSize=visibleYSize;scrollYStore.endIndex=Math.max(scrollYStore.startIndex+visibleYSize+offsetYSize,scrollYStore.endIndex);scrollYStore.visibleStartIndex=Math.max(scrollYStore.startIndex,toYVisibleIndex);scrollYStore.visibleEndIndex=Math.min(scrollYStore.endIndex,toYVisibleIndex+visibleYSize);$xeTable.updateScrollYData().then(()=>{loadScrollYData();});}else{$xeTable.updateScrollYSpace();}});};const calcScrollbar=()=>{const{scrollXWidth,scrollYHeight}=reactData;const{elemStore}=internalData;const scrollbarOpts=computeScrollbarOpts.value;const el=refElem.value;if(!el||!el.clientWidth){return;}const bodyWrapperElem=(0,_util.getRefElem)(elemStore['main-body-wrapper']);const headerTableElem=(0,_util.getRefElem)(elemStore['main-header-table']);const footerTableElem=(0,_util.getRefElem)(elemStore['main-footer-table']);const xHandleEl=refScrollXHandleElem.value;const yHandleEl=refScrollYHandleElem.value;let overflowY=false;let overflowX=false;if(bodyWrapperElem){overflowY=scrollYHeight>bodyWrapperElem.clientHeight;if(yHandleEl){reactData.scrollbarWidth=scrollbarOpts.width||yHandleEl.offsetWidth-yHandleEl.clientWidth||14;}reactData.overflowY=overflowY;overflowX=scrollXWidth>bodyWrapperElem.clientWidth;if(xHandleEl){reactData.scrollbarHeight=scrollbarOpts.height||xHandleEl.offsetHeight-xHandleEl.clientHeight||14;}const hHeight=headerTableElem?headerTableElem.clientHeight:0;const fHeight=footerTableElem?footerTableElem.clientHeight:0;internalData.tableHeight=bodyWrapperElem.offsetHeight;internalData.tHeaderHeight=hHeight;internalData.tFooterHeight=fHeight;reactData.overflowX=overflowX;reactData.parentHeight=Math.max(hHeight+fHeight+20,$xeTable.getParentHeight());}if(overflowX){$xeTable.checkScrolling();}};const handleRecalculateStyle=(reFull,reWidth,reHeight)=>{const el=refElem.value;if(!el||!el.clientWidth){return(0,_vue.nextTick)();}const varEl=refVarElem.value;if(varEl){const[defEl,mediumEl,smallEl,miniEl]=varEl.children;calcVarRowHeightConfig('default',defEl);calcVarRowHeightConfig('medium',mediumEl);calcVarRowHeightConfig('small',smallEl);calcVarRowHeightConfig('mini',miniEl);}if(reWidth){calcCellWidth();}if(reFull){autoCellWidth();}calcScrollbar();updateStyle();updateRowExpandStyle();if(reFull){updateTreeLineStyle();}internalData.rceRunTime=Date.now();return computeScrollLoad().then(()=>{// 初始化时需要在列计算之后再执行优化运算,达到最优显示效果
|
|
155
|
+
if(reWidth){calcCellWidth();}if(reFull){autoCellWidth();}if(reHeight){calcCellHeight();}updateStyle();calcScrollbar();if(reFull){updateRowOffsetTop();}updateRowExpandStyle();if(reFull){updateTreeLineStyle();}internalData.rceRunTime=Date.now();if(reFull){return computeScrollLoad();}});};const minRunDelay=50;const handleLazyRecalculate=(reFull,reWidth,reHeight)=>{return new Promise(resolve=>{const $xeGanttView=internalData.xeGanttView;const{customStore}=reactData;const{rceTimeout,rceRunTime}=internalData;const resizeOpts=computeResizeOpts.value;let rceDelay=internalData.rceDelay;// 如果在500毫秒内频繁执行,则执行次数减缓
|
|
156
|
+
if(rceRunTime&&rceRunTime>Date.now()-500){rceDelay+=50;}else{rceDelay=0;}internalData.rceDelay=rceDelay;const refreshDelay=resizeOpts.refreshDelay||30;const reDelay=rceDelay+refreshDelay;const el=refElem.value;if(el&&el.clientWidth){autoCellWidth();updateRowExpandStyle();}if(customStore.visible&&$xeTable.handleCustomStyle){$xeTable.handleCustomStyle();}if(rceTimeout){clearTimeout(rceTimeout);if(rceRunTime&&rceRunTime+minRunDelay<Date.now()){resolve(handleRecalculateStyle(reFull,reWidth,reHeight));}else{(0,_vue.nextTick)(()=>{resolve();});}}else{resolve(handleRecalculateStyle(reFull,reWidth,reHeight));}if($xeGanttView&&$xeGanttView.handleLazyRecalculate){$xeGanttView.handleLazyRecalculate();}internalData.rceTimeout=setTimeout(()=>{internalData.rceTimeout=undefined;handleRecalculateStyle(reFull,reWidth,reHeight);if($xeGanttView&&$xeGanttView.handleLazyRecalculate){$xeGanttView.handleLazyRecalculate();}},reDelay);});};let resizePending=false;const handleResizeEvent=()=>{if(resizePending){return;}resizePending=true;handleLazyRecalculate(true,true,true).then(()=>{resizePending=false;}).catch(()=>{resizePending=false;});};const handleUpdateAggValues=()=>{const{visibleColumn}=internalData;const aggCols=[];visibleColumn.forEach(column=>{if(column.aggFunc){aggCols.push(column);}});reactData.aggHandleAggColumns=aggCols;};const handleUpdateRowGroup=groupFields=>{const aggGroupFields=[];const aggGroupConfs=[];if(groupFields){(_xeUtils.default.isArray(groupFields)?groupFields:[groupFields]).forEach(field=>{aggGroupFields.push(field);aggGroupConfs.push({field});});}reactData.rowGroupList=aggGroupConfs;reactData.aggHandleFields=aggGroupFields;handleUpdateAggValues();};const handleeGroupSummary=aggList=>{const{fullColumnFieldData}=internalData;const aggregateOpts=computeAggregateOpts.value;const aggFuncColumns=computeAggFuncColumns.value;const{mapChildrenField}=aggregateOpts;const aggCalcMethod=aggregateOpts.calcValuesMethod||aggregateOpts.countMethod||aggregateOpts.aggregateMethod;if(mapChildrenField){_xeUtils.default.lastEach(aggList,aggRow=>{let count=0;_xeUtils.default.each(aggRow[mapChildrenField],row=>{if(row.isAggregate){count+=row.childCount||0;}else{count++;}});aggRow.childCount=count;});if($xeTable.handlePivotTableAggData){$xeTable.handlePivotTableAggData(aggList);}else{if(aggFuncColumns.length){_xeUtils.default.lastEach(aggList,aggRow=>{const aggDtObj={};const aggData=aggRow.aggData;const groupField=aggRow.groupField;const groupContent=aggRow.groupContent;const childList=mapChildrenField?aggRow[mapChildrenField]||[]:[];const childCount=aggRow.childCount;const colRest=fullColumnFieldData[groupField]||{};aggFuncColumns.forEach(column=>{const{field}=column;const currAggData=aggData?aggData[field]:null;const ctParams={$table:$xeTable,groupField,groupColumn:colRest?colRest.column:null,column,groupValue:groupContent,childList,childCount,aggValue:currAggData?currAggData.value:0,/**
|
|
156
157
|
* 已废弃
|
|
157
158
|
* @deprecated
|
|
158
159
|
*/children:childList,/**
|
|
@@ -169,11 +170,11 @@ if(!treeOpts.rowField){(0,_log.errLog)('vxe.error.reqProp',['tree-config.rowFiel
|
|
|
169
170
|
// warnLog('vxe.error.errConflicts', ['tree-config.transform', `row.${treeOpts.children}`])
|
|
170
171
|
// }
|
|
171
172
|
// })
|
|
172
|
-
treeData=_xeUtils.default.toArrayTree(fullData,{key:treeOpts.rowField,parentKey:treeOpts.parentField,children:childrenField,mapChildren:treeOpts.mapChildrenField});fullData=treeData.slice(0);}else{treeData=fullData.slice(0);}}else if((aggregateConfig||rowGroupConfig)&&rowGroupList.length){const groupRest=initGroupData(fullData,rowGroupList);treeData=groupRest.treeData;fullData=groupRest.fullData;isRGroup=true;}reactData.isRowGroupStatus=isRGroup;scrollYStore.startIndex=0;scrollYStore.endIndex=1;scrollXStore.startIndex=0;scrollXStore.endIndex=1;internalData.cvCacheMaps={};reactData.isRowLoading=true;reactData.scrollVMLoading=false;reactData.treeExpandedFlag++;reactData.rowExpandedFlag++;internalData.insertRowMaps={};reactData.insertRowFlag++;internalData.removeRowMaps={};reactData.removeRowFlag++;const sYLoad=updateScrollYStatus(fullData);// 全量数据
|
|
173
|
+
treeData=_xeUtils.default.toArrayTree(fullData,{key:treeOpts.rowField,parentKey:treeOpts.parentField,children:childrenField,mapChildren:treeOpts.mapChildrenField});fullData=treeData.slice(0);}else{treeData=fullData.slice(0);}}else if((aggregateConfig||rowGroupConfig)&&rowGroupList.length){const groupRest=initGroupData(fullData,rowGroupList);treeData=groupRest.treeData;fullData=groupRest.fullData;isRGroup=true;}reactData.isRowGroupStatus=isRGroup;scrollYStore.startIndex=0;scrollYStore.endIndex=1;scrollXStore.startIndex=0;scrollXStore.endIndex=1;internalData.cvCacheMaps={};reactData.isRowLoading=true;reactData.scrollVMLoading=false;reactData.treeExpandedFlag++;reactData.rowExpandedFlag++;internalData.insertRowMaps={};reactData.insertRowFlag++;internalData.removeRowMaps={};reactData.removeRowFlag++;internalData.fullCellHeightMaps={};const sYLoad=updateScrollYStatus(fullData);// 全量数据
|
|
173
174
|
internalData.tableFullData=fullData;internalData.tableFullTreeData=isRGroup?[]:treeData;internalData.tableFullGroupData=isRGroup?treeData:[];// 缓存数据
|
|
174
175
|
$xeTable.cacheRowMap(isReset);// 原始数据
|
|
175
176
|
internalData.tableSynchData=datas;if(isReset){internalData.isResizeCellHeight=false;}// 克隆原数据,用于显示编辑状态,与编辑值做对比
|
|
176
|
-
if(keepSource){$xeTable.cacheSourceMap(fullData);}if($xeTable.clearCellAreas&&props.mouseConfig){$xeTable.clearCellAreas();$xeTable.clearCopyCellArea();}$xeTable.clearMergeCells();$xeTable.clearMergeFooterItems();$xeTable.clearHistory();$xeTable.handleTableData(true);$xeTable.updateFooter();$xeTable.handleUpdateBodyMerge();return(0,_vue.nextTick)().then(()=>{updateHeight();updateStyle();}).then(()=>{computeScrollLoad();}).then(()=>{const virtualYOpts=computeVirtualYOpts.value;// 是否启用了虚拟滚动
|
|
177
|
+
if(keepSource){$xeTable.cacheSourceMap(fullData);}if($xeTable.clearCellAreas&&props.mouseConfig){$xeTable.clearCellAreas();$xeTable.clearCopyCellArea();}$xeTable.clearMergeCells();$xeTable.clearMergeFooterItems();$xeTable.clearHistory();$xeTable.handleTableData(true);$xeTable.updateFooter();$xeTable.handleUpdateBodyMerge();return(0,_vue.nextTick)().then(()=>{updateHeight();updateStyle();}).then(()=>{computeScrollLoad();syncGanttScrollYStatus();}).then(()=>{const virtualYOpts=computeVirtualYOpts.value;// 是否启用了虚拟滚动
|
|
177
178
|
if(sYLoad){scrollYStore.endIndex=scrollYStore.visibleSize;}if(sYLoad){if(reactData.expandColumn&&expandOpts.mode!=='fixed'){(0,_log.errLog)('vxe.error.notConflictProp',['column.type="expand','expand-config.mode="fixed"']);}if(virtualYOpts.mode==='scroll'&&reactData.expandColumn&&expandOpts.mode==='fixed'){(0,_log.warnLog)('vxe.error.notConflictProp',['virtual-y-config.mode=scroll','expand-config.mode=inside']);}// if (showOverflow) {
|
|
178
179
|
// if (!rowOpts.height) {
|
|
179
180
|
// const errColumn = internalData.tableFullColumn.find(column => column.showOverflow === false)
|
|
@@ -189,7 +190,7 @@ if(!(props.height||props.maxHeight)){(0,_log.errLog)('vxe.error.reqSupportProp',
|
|
|
189
190
|
// warnLog('vxe.error.scrollErrProp', ['span-method'])
|
|
190
191
|
// }
|
|
191
192
|
}handleReserveStatus();$xeTable.checkSelectionStatus();$xeTable.dispatchEvent('data-change',{visibleColumn:internalData.visibleColumn,visibleData:internalData.afterFullData},null);return new Promise(resolve=>{(0,_vue.nextTick)().then(()=>handleRecalculateStyle(false,false,false)).then(()=>{handleRecalculateStyle(false,true,true);updateRowOffsetTop();}).then(()=>{let targetScrollLeft=lastScrollLeft;let targetScrollTop=lastScrollTop;const virtualXOpts=computeVirtualXOpts.value;const virtualYOpts=computeVirtualYOpts.value;// 是否在更新数据之后自动滚动重置滚动条
|
|
192
|
-
if(virtualXOpts.scrollToLeftOnChange){targetScrollLeft=0;}if(virtualYOpts.scrollToTopOnChange){targetScrollTop=0;}reactData.isRowLoading=false;handleRecalculateStyle(false,false,false);updateTreeLineStyle();// 如果是自动行高,特殊情况需调用 recalculate 手动刷新
|
|
193
|
+
if(virtualXOpts.scrollToLeftOnChange){targetScrollLeft=0;}if(virtualYOpts.scrollToTopOnChange){targetScrollTop=0;}reactData.isRowLoading=false;handleRecalculateStyle(false,false,false);updateTreeLineStyle();syncGanttScrollYStatus();// 如果是自动行高,特殊情况需调用 recalculate 手动刷新
|
|
193
194
|
if(!props.showOverflow){setTimeout(()=>{handleLazyRecalculate(false,true,true);setTimeout(()=>handleLazyRecalculate(false,true,true),3000);},2000);}// 是否变更虚拟滚动
|
|
194
195
|
if(oldScrollYLoad===sYLoad){(0,_util.restoreScrollLocation)($xeTable,targetScrollLeft,targetScrollTop).then(()=>{handleRecalculateStyle(false,true,true);updateRowOffsetTop();updateTreeLineStyle();(0,_vue.nextTick)(()=>resolve());});}else{setTimeout(()=>{(0,_util.restoreScrollLocation)($xeTable,targetScrollLeft,targetScrollTop).then(()=>{handleRecalculateStyle(false,true,true);updateRowOffsetTop();updateTreeLineStyle();(0,_vue.nextTick)(()=>resolve());});});}});}).then(()=>{if(initStatus){dispatchEvent('data-rendered',{isReload,visibleColumn:internalData.visibleColumn,visibleData:internalData.afterFullData},null);}else{dispatchEvent('init-rendered',{visibleColumn:internalData.visibleColumn,visibleData:internalData.afterFullData},null);}});});};/**
|
|
195
196
|
* 处理数据加载默认行为
|
|
@@ -218,9 +219,9 @@ tableFullColumn.forEach(column=>{if(column.visible){if(column.fixed==='left'){le
|
|
|
218
219
|
// }
|
|
219
220
|
if(props.spanMethod){(0,_log.warnLog)('vxe.error.scrollErrProp',['span-method']);}if(props.footerSpanMethod){(0,_log.warnLog)('vxe.error.scrollErrProp',['footer-span-method']);}if(isReset){const{visibleSize}=handleVirtualXVisible();scrollXStore.startIndex=0;scrollXStore.endIndex=visibleSize;scrollXStore.visibleSize=visibleSize;scrollXStore.visibleStartIndex=0;scrollXStore.visibleEndIndex=visibleSize;}}// 如果列被显示/隐藏,则清除合并状态
|
|
220
221
|
// 如果列被设置为固定,则清除合并状态
|
|
221
|
-
if(visibleColumn.length!==internalData.visibleColumn.length||!internalData.visibleColumn.every((column,index)=>column===visibleColumn[index])){$xeTable.clearMergeCells();$xeTable.clearMergeFooterItems();}visibleColumn.forEach((column,index)=>{const colid=column.id;const colRest=fullColumnIdData[colid];if(colRest){colRest._index=index;}});handleTableColumn();handleUpdateAggValues();if(isReset){updateColumnOffsetLeft();return $xeTable.updateFooter().then(()=>{return $xeTable.recalculate();}).then(()=>{$xeTable.updateCellAreas();return $xeTable.recalculate();});}return $xeTable.updateFooter();};const initColumnHierarchy=()=>{const{collectColumn}=internalData;const fullColIdData={};const fullColFieldData={};let sortIndex=1;_xeUtils.default.eachTree(collectColumn,(column,index,items,path,parentColumn)=>{const{id:colid,field}=column;const parentId=parentColumn?parentColumn.id:null;const rest={$index:-1,_index:-1,column,colid,index,items,parent:parentColumn||null,width:0,oLeft:0};column.parentId=parentId;column.defaultParentId=parentId;column.sortNumber=sortIndex;column.renderSortNumber=sortIndex;sortIndex++;if(field){if(fullColFieldData[field]){(0,_log.errLog)('vxe.error.colRepet',['field',field]);}fullColFieldData[field]=rest;}fullColIdData[colid]=rest;});internalData.fullColumnIdData=fullColIdData;internalData.fullColumnFieldData=fullColFieldData;};const
|
|
222
|
-
const scrollXLoad=!!virtualXOpts.enabled&&virtualXOpts.gt>-1&&(virtualXOpts.gt===0||virtualXOpts.gt<allCols.length);reactData.scrollXLoad=scrollXLoad;return scrollXLoad;};const updateScrollYStatus=fullData=>{const{treeConfig}=props;const
|
|
223
|
-
const scrollYLoad=(transform||!treeConfig)&&!!virtualYOpts.enabled&&virtualYOpts.gt>-1&&(virtualYOpts.gt===0||virtualYOpts.gt<allList.length);reactData.scrollYLoad=scrollYLoad;
|
|
222
|
+
if(visibleColumn.length!==internalData.visibleColumn.length||!internalData.visibleColumn.every((column,index)=>column===visibleColumn[index])){$xeTable.clearMergeCells();$xeTable.clearMergeFooterItems();}visibleColumn.forEach((column,index)=>{const colid=column.id;const colRest=fullColumnIdData[colid];if(colRest){colRest._index=index;}});handleTableColumn();handleUpdateAggValues();if(isReset){updateColumnOffsetLeft();return $xeTable.updateFooter().then(()=>{return $xeTable.recalculate();}).then(()=>{$xeTable.updateCellAreas();return $xeTable.recalculate();});}return $xeTable.updateFooter();};const initColumnHierarchy=()=>{const{collectColumn}=internalData;const fullColIdData={};const fullColFieldData={};let sortIndex=1;_xeUtils.default.eachTree(collectColumn,(column,index,items,path,parentColumn)=>{const{id:colid,field}=column;const parentId=parentColumn?parentColumn.id:null;const rest={$index:-1,_index:-1,column,colid,index,items,parent:parentColumn||null,width:0,oLeft:0};column.parentId=parentId;column.defaultParentId=parentId;column.sortNumber=sortIndex;column.renderSortNumber=sortIndex;sortIndex++;if(field){if(fullColFieldData[field]){(0,_log.errLog)('vxe.error.colRepet',['field',field]);}fullColFieldData[field]=rest;}fullColIdData[colid]=rest;});internalData.fullColumnIdData=fullColIdData;internalData.fullColumnFieldData=fullColFieldData;};const buildColumnInfo=()=>{const{scrollXLoad,scrollYLoad,expandColumn}=reactData;const expandOpts=computeExpandOpts.value;cacheColumnMap();parseColumns(true).then(()=>{if(reactData.scrollXLoad){loadScrollXData();}});$xeTable.clearHeaderFormatterCache();$xeTable.clearMergeCells();$xeTable.clearMergeFooterItems();$xeTable.handleTableData(true);$xeTable.handleAggregateSummaryData();if((scrollXLoad||scrollYLoad)&&expandColumn&&expandOpts.mode!=='fixed'){(0,_log.warnLog)('vxe.error.scrollErrProp',['column.type=expand']);}return(0,_vue.nextTick)().then(()=>{if($xeToolbar){$xeToolbar.syncUpdate({collectColumn:internalData.collectColumn,$table:$xeTable});}if($xeTable.handleUpdateCustomColumn){$xeTable.handleUpdateCustomColumn();}const columnOpts=computeColumnOpts.value;if(props.showCustomHeader&&reactData.isGroup&&(columnOpts.resizable||props.resizable)){(0,_log.warnLog)('vxe.error.notConflictProp',['show-custom-header & colgroup','column-config.resizable=false']);}reactData.isColLoading=false;return handleLazyRecalculate(false,true,true);});};const handleInitColumn=collectColumn=>{internalData.collectColumn=collectColumn;const tFullColumn=(0,_util.getColumnList)(collectColumn);internalData.tableFullColumn=tFullColumn;reactData.updateColFlag++;reactData.isColLoading=true;initColumnHierarchy();return Promise.resolve(restoreCustomStorage()).then(()=>{return buildColumnInfo();});};const updateScrollXStatus=fullColumn=>{const virtualXOpts=computeVirtualXOpts.value;const allCols=fullColumn||internalData.tableFullColumn;// 如果gt为0,则总是启用
|
|
223
|
+
const scrollXLoad=!!virtualXOpts.enabled&&virtualXOpts.gt>-1&&(virtualXOpts.gt===0||virtualXOpts.gt<allCols.length);reactData.scrollXLoad=scrollXLoad;return scrollXLoad;};const syncGanttScrollYStatus=()=>{const $xeGanttView=internalData.xeGanttView;if($xeGanttView&&$xeGanttView.handleUpdateSYStatus){$xeGanttView.handleUpdateSYStatus(reactData.scrollYLoad);}};const updateScrollYStatus=fullData=>{const{treeConfig}=props;const virtualYOpts=computeVirtualYOpts.value;const treeOpts=computeTreeOpts.value;const{transform}=treeOpts;const allList=fullData||internalData.tableFullData;// 如果gt为0,则总是启用
|
|
224
|
+
const scrollYLoad=(transform||!treeConfig)&&!!virtualYOpts.enabled&&virtualYOpts.gt>-1&&(virtualYOpts.gt===0||virtualYOpts.gt<allList.length);reactData.scrollYLoad=scrollYLoad;syncGanttScrollYStatus();return scrollYLoad;};/**
|
|
224
225
|
* 展开与收起树节点
|
|
225
226
|
* @param rows
|
|
226
227
|
* @param expanded
|
|
@@ -412,7 +413,7 @@ if(!targetColumn.fixed&&isMaxFixedColumn){if(_ui.VxeUI.modal){_ui.VxeUI.modal.me
|
|
|
412
413
|
* 刷新列信息
|
|
413
414
|
* 将固定的列左边、右边分别靠边
|
|
414
415
|
* 如果传 true 则会检查列顺序并排序
|
|
415
|
-
*/refreshColumn(initSort){if(initSort){handleUpdateColumn();}return parseColumns(true).then(()=>{return $xeTable.refreshScroll();}).then(()=>{return handleLazyRecalculate(false,true,true);});},setRowHeightConf(heightConf){const{fullAllDataRowIdData}=internalData;let status=false;if(heightConf){_xeUtils.default.each(heightConf,(height,rowid)=>{const rowRest=fullAllDataRowIdData[rowid];if(rowRest){const rHeight=_xeUtils.default.toInteger(height);if(rHeight){rowRest.resizeHeight=rHeight;if(!status){status=true;}}}});if(status){internalData.isResizeCellHeight=true;reactData.resizeHeightFlag++;}}return(0,_vue.nextTick)().then(()=>{updateRowOffsetTop();return{status};});},getRowHeightConf(isFull){const{fullAllDataRowIdData,afterFullData}=internalData;const{handleGetRowId}=(0,_util.createHandleGetRowId)($xeTable);const rowOpts=computeRowOpts.value;const cellOpts=computeCellOpts.value;const defaultRowHeight=computeDefaultRowHeight.value;const rest={};afterFullData.forEach(row=>{const rowid=handleGetRowId(row);const rowRest=fullAllDataRowIdData[rowid];if(rowRest){const resizeHeight=rowRest.resizeHeight;if(resizeHeight||isFull){const currCellHeight=resizeHeight||cellOpts.height||rowOpts.height||rowRest.height||defaultRowHeight;rest[rowid]=currCellHeight;}}});return rest;},recalcRowHeight(rowOrId){const{fullAllDataRowIdData}=internalData;const rows=_xeUtils.default.isArray(rowOrId)?rowOrId:[rowOrId];const el=refElem.value;if(el){const{handleGetRowId}=(0,_util.createHandleGetRowId)($xeTable);el.setAttribute('data-calc-row','Y');rows.forEach(row=>{const rowid=_xeUtils.default.isString(row)||_xeUtils.default.isNumber(row)?row:handleGetRowId(row);const rowRest=fullAllDataRowIdData[rowid];if(rowRest){rowRest.resizeHeight=calcCellAutoHeight(rowRest,el);}el.removeAttribute('data-calc-row');});reactData.calcCellHeightFlag++;}return(0,_vue.nextTick)();},setRowHeight(rowOrId,height){const{fullAllDataRowIdData}=internalData;let status=false;const rows=_xeUtils.default.isArray(rowOrId)?rowOrId:[rowOrId];let rHeight=_xeUtils.default.toInteger(height);if((0,_dom.isScale)(height)){const tableBody=refTableBody.value;const bodyElem=tableBody?tableBody.$el:null;const bodyHeight=bodyElem?bodyElem.clientHeight-1:0;rHeight=Math.floor(rHeight*bodyHeight);}if(rHeight){const{handleGetRowId}=(0,_util.createHandleGetRowId)($xeTable);rows.forEach(row=>{const rowid=_xeUtils.default.isString(row)||_xeUtils.default.isNumber(row)?row:handleGetRowId(row);const rowRest=fullAllDataRowIdData[rowid];if(rowRest){rowRest.resizeHeight=rHeight;if(!status){status=true;}}});if(status){internalData.isResizeCellHeight=true;reactData.resizeHeightFlag++;}}return(0,_vue.nextTick)().then(()=>{return{status};});},getRowHeight(rowOrId){const{fullAllDataRowIdData}=internalData;const rowOpts=computeRowOpts.value;const cellOpts=computeCellOpts.value;const defaultRowHeight=computeDefaultRowHeight.value;const rowid=_xeUtils.default.isString(rowOrId)||_xeUtils.default.isNumber(rowOrId)?rowOrId:(0,_util.getRowid)($xeTable,rowOrId);const rowRest=fullAllDataRowIdData[rowid];if(rowRest){return rowRest.resizeHeight||cellOpts.height||rowOpts.height||rowRest.height||defaultRowHeight;}return 0;},/**
|
|
416
|
+
*/refreshColumn(initSort){if(initSort){handleUpdateColumn();}return parseColumns(true).then(()=>{return $xeTable.refreshScroll();}).then(()=>{return handleLazyRecalculate(false,true,true);});},setRowHeightConf(heightConf){const{fullAllDataRowIdData}=internalData;let status=false;if(heightConf){_xeUtils.default.each(heightConf,(height,rowid)=>{const rowRest=fullAllDataRowIdData[rowid];if(rowRest){const rHeight=_xeUtils.default.toInteger(height);if(rHeight){rowRest.resizeHeight=rHeight;if(!status){status=true;}}}});if(status){internalData.isResizeCellHeight=true;reactData.resizeHeightFlag++;}}return(0,_vue.nextTick)().then(()=>{updateRowOffsetTop();return{status};});},getRowHeightConf(isFull){const{fullAllDataRowIdData,afterFullData}=internalData;const{handleGetRowId}=(0,_util.createHandleGetRowId)($xeTable);const rowOpts=computeRowOpts.value;const cellOpts=computeCellOpts.value;const defaultRowHeight=computeDefaultRowHeight.value;const rest={};afterFullData.forEach(row=>{const rowid=handleGetRowId(row);const rowRest=fullAllDataRowIdData[rowid];if(rowRest){const resizeHeight=rowRest.resizeHeight;if(resizeHeight||isFull){const currCellHeight=resizeHeight||cellOpts.height||rowOpts.height||rowRest.height||defaultRowHeight;rest[rowid]=currCellHeight;}}});return rest;},recalcRowHeight(rowOrId){const{fullAllDataRowIdData}=internalData;const rows=_xeUtils.default.isArray(rowOrId)?rowOrId:[rowOrId];const el=refElem.value;if(el){const{handleGetRowId}=(0,_util.createHandleGetRowId)($xeTable);el.setAttribute('data-calc-row','Y');rows.forEach(row=>{const rowid=_xeUtils.default.isString(row)||_xeUtils.default.isNumber(row)?row:handleGetRowId(row);const rowRest=fullAllDataRowIdData[rowid];if(rowRest){rowRest.resizeHeight=calcCellAutoHeight(rowid,rowRest,el);}el.removeAttribute('data-calc-row');});reactData.calcCellHeightFlag++;}return(0,_vue.nextTick)();},setRowHeight(rowOrId,height){const{fullAllDataRowIdData}=internalData;let status=false;const rows=_xeUtils.default.isArray(rowOrId)?rowOrId:[rowOrId];let rHeight=_xeUtils.default.toInteger(height);if((0,_dom.isScale)(height)){const tableBody=refTableBody.value;const bodyElem=tableBody?tableBody.$el:null;const bodyHeight=bodyElem?bodyElem.clientHeight-1:0;rHeight=Math.floor(rHeight*bodyHeight);}if(rHeight){const{handleGetRowId}=(0,_util.createHandleGetRowId)($xeTable);rows.forEach(row=>{const rowid=_xeUtils.default.isString(row)||_xeUtils.default.isNumber(row)?row:handleGetRowId(row);const rowRest=fullAllDataRowIdData[rowid];if(rowRest){rowRest.resizeHeight=rHeight;if(!status){status=true;}}});if(status){internalData.isResizeCellHeight=true;reactData.resizeHeightFlag++;}}return(0,_vue.nextTick)().then(()=>{return{status};});},getRowHeight(rowOrId){const{fullAllDataRowIdData}=internalData;const rowOpts=computeRowOpts.value;const cellOpts=computeCellOpts.value;const defaultRowHeight=computeDefaultRowHeight.value;const rowid=_xeUtils.default.isString(rowOrId)||_xeUtils.default.isNumber(rowOrId)?rowOrId:(0,_util.getRowid)($xeTable,rowOrId);const rowRest=fullAllDataRowIdData[rowid];if(rowRest){return rowRest.resizeHeight||cellOpts.height||rowOpts.height||rowRest.height||defaultRowHeight;}return 0;},/**
|
|
416
417
|
* 刷新滚动操作,手动同步滚动相关位置(对于某些特殊的操作,比如滚动条错位、固定列不同步)
|
|
417
418
|
*/refreshScroll(){const{elemStore,lastScrollLeft,lastScrollTop}=internalData;const headerScrollElem=(0,_util.getRefElem)(elemStore['main-header-scroll']);const bodyScrollElem=(0,_util.getRefElem)(elemStore['main-body-scroll']);const footerScrollElem=(0,_util.getRefElem)(elemStore['main-footer-scroll']);const leftScrollElem=(0,_util.getRefElem)(elemStore['left-body-scroll']);const rightScrollElem=(0,_util.getRefElem)(elemStore['right-body-scroll']);const xHandleEl=refScrollXHandleElem.value;const yHandleEl=refScrollYHandleElem.value;return new Promise(resolve=>{// 还原滚动条位置
|
|
418
419
|
if(lastScrollLeft||lastScrollTop){return(0,_util.restoreScrollLocation)($xeTable,lastScrollLeft,lastScrollTop).then(()=>{// 存在滚动行为未结束情况
|
|
@@ -580,7 +581,17 @@ return $xeTable.removeMergeFooterCells(merges);},/**
|
|
|
580
581
|
return $xeTable.getMergeFooterCells();},/**
|
|
581
582
|
* 清除所有表尾合并
|
|
582
583
|
*/clearMergeFooterCells(){internalData.mergeFooterList=[];internalData.mergeFooterMaps={};internalData.mergeFooterCellMaps={};internalData.mergeFooterRowMaps={};internalData.mergeFooterColMaps={};reactData.mergeFootFlag++;return(0,_vue.nextTick)().then(()=>{return updateStyle();});},clearMergeFooterItems(){// errLog('vxe.error.delFunc', ['clearMergeFooterItems', 'clearMergeFooterCells'])
|
|
583
|
-
return $xeTable.clearMergeFooterCells();},updateCellAreas(){const{mouseConfig}=props;const mouseOpts=computeMouseOpts.value;if(mouseConfig&&mouseOpts.area&&$xeTable.handleRecalculateCellAreaEvent){return $xeTable.handleRecalculateCellAreaEvent();}return(0,_vue.nextTick)();},undo(){return $xeTable.handleUndoStackEvent(null);},redo(){return $xeTable.handleRedoStackEvent(null);},clearHistory(){return $xeTable.handleClearStack();}
|
|
584
|
+
return $xeTable.clearMergeFooterCells();},updateCellAreas(){const{mouseConfig}=props;const mouseOpts=computeMouseOpts.value;if(mouseConfig&&mouseOpts.area&&$xeTable.handleRecalculateCellAreaEvent){return $xeTable.handleRecalculateCellAreaEvent();}return(0,_vue.nextTick)();},undo(){return $xeTable.handleUndoStackEvent(null);},redo(){return $xeTable.handleRedoStackEvent(null);},clearHistory(){return $xeTable.handleClearStack();},/**
|
|
585
|
+
* 用于 custom-config,用于手动恢复自定义列设置信息,恢复表格重置为初始状态
|
|
586
|
+
* @param storeData
|
|
587
|
+
* @returns
|
|
588
|
+
*/setCustomStoreData(storeData){if(!storeData){return(0,_vue.nextTick)();}const customOpts=computeCustomOpts.value;const{checkMethod}=customOpts;// 重置状态
|
|
589
|
+
(0,_util.clearTableAllStatus)($xeTable);// 恢复列
|
|
590
|
+
const allCols=[];_xeUtils.default.eachTree(internalData.collectColumn,column=>{column.resizeWidth=0;column.fixed=column.defaultFixed;column.renderSortNumber=column.sortNumber;column.parentId=column.defaultParentId;if(!checkMethod||checkMethod({$table:$xeTable,column})){column.visible=column.defaultVisible;}column.aggFunc=column.defaultAggFunc;column.renderAggFn=column.defaultAggFunc;column.renderResizeWidth=column.renderWidth;allCols.push(column);});const newCollectCols=_xeUtils.default.toArrayTree(_xeUtils.default.orderBy(allCols,'renderSortNumber'),{key:'id',parentKey:'parentId',children:'children'});internalData.collectColumn=newCollectCols;internalData.tableFullColumn=(0,_util.getColumnList)(newCollectCols);reactData.updateColFlag++;reactData.isColLoading=true;initColumnHierarchy();return Promise.resolve(handleCustomRestore(storeData)).then(()=>{return buildColumnInfo();}).then(()=>{// 恢复数据聚合分组
|
|
591
|
+
const{isRowGroupStatus,rowGroupList}=reactData;if(isRowGroupStatus&&!!$xeTable.handlePivotTableAggData){const rowGroupFields=computeRowGroupFields.value;if(rowGroupFields?rowGroupFields.length:rowGroupList.length){if(rowGroupFields&&rowGroupFields.length){$xeTable.setRowGroups(rowGroupFields);}else{$xeTable.clearRowGroups();}}else{$xeTable.handleUpdateAggData();}}});},/**
|
|
592
|
+
* 用于 custom-config,用于获取自定义列设置信息,用于自定义保持
|
|
593
|
+
* @returns
|
|
594
|
+
*/getCustomStoreData(){const{id}=props;const customOpts=computeCustomOpts.value;const{isRowGroupStatus,rowGroupList}=reactData;const{fullColumnFieldData,collectColumn}=internalData;const{storage,checkMethod,storeOptions}=customOpts;const isAllCustom=storage===true;const storageOpts=Object.assign({},isAllCustom?{}:storage||{},storeOptions);const isCustomResizable=hangleStorageDefaultValue(storageOpts.resizable,isAllCustom);const isCustomVisible=hangleStorageDefaultValue(storageOpts.visible,isAllCustom);const isCustomFixed=hangleStorageDefaultValue(storageOpts.fixed,isAllCustom);const isCustomSort=hangleStorageDefaultValue(storageOpts.sort,isAllCustom);const isCustomAggGroup=hangleStorageDefaultValue(storageOpts.aggGroup,isAllCustom);const isCustomAggFunc=hangleStorageDefaultValue(storageOpts.aggFunc,isAllCustom);const resizableData={};const sortData=[];const visibleData={};const fixedData={};const aggGroupData={};const aggFuncData={};const storeData={resizableData:undefined,sortData:undefined,visibleData:undefined,fixedData:undefined,aggGroupData:undefined,aggFuncData:undefined};if(!id){if(storage){(0,_log.errLog)('vxe.error.reqProp',['id']);}return storeData;}let hasResizable=0;let hasSort=0;let hasFixed=0;let hasVisible=0;let hasAggFunc=0;const sortMaps={};_xeUtils.default.eachTree(collectColumn,(column,index,items,path,parentColumn)=>{const colKey=column.getKey();if(!colKey){(0,_log.errLog)('vxe.error.reqProp',[`${column.getTitle()||column.type||''} -> column.field=?`]);return;}if(parentColumn){if(isCustomSort){const pColKey=parentColumn.getKey();const psObj=sortMaps[pColKey];hasSort=1;if(psObj){const sObj={k:colKey};sortMaps[colKey]=sObj;if(!psObj.c){psObj.c=[];}psObj.c.push(sObj);}}}else{if(isCustomSort){hasSort=1;const sObj={k:colKey};sortMaps[colKey]=sObj;sortData.push(sObj);}// 只支持一级
|
|
584
595
|
if(isCustomFixed&&(column.fixed||'')!==(column.defaultFixed||'')){hasFixed=1;fixedData[colKey]=column.fixed;}}if(isCustomResizable&&column.resizeWidth){hasResizable=1;resizableData[colKey]=column.renderWidth;}if(isCustomVisible&&(!checkMethod||checkMethod({$table:$xeTable,column}))){if(!column.visible&&column.defaultVisible){hasVisible=1;visibleData[colKey]=false;}else if(column.visible&&!column.defaultVisible){hasVisible=1;visibleData[colKey]=true;}}if(isCustomAggFunc&&(column.aggFunc||'')!==(column.defaultAggFunc||'')){hasAggFunc=1;aggFuncData[colKey]=column.aggFunc;}});if(hasResizable){storeData.resizableData=resizableData;}if(hasSort){storeData.sortData=sortData;}if(hasFixed){storeData.fixedData=fixedData;}if(hasVisible){storeData.visibleData=visibleData;}if(isCustomAggGroup&&isRowGroupStatus){rowGroupList.forEach(aggConf=>{const colRest=fullColumnFieldData[aggConf.field];if(colRest){aggGroupData[colRest.column.getKey()]=true;}});storeData.aggGroupData=aggGroupData;}if(hasAggFunc){storeData.aggFuncData=aggFuncData;}return storeData;},focus(){internalData.isActivated=true;return(0,_vue.nextTick)();},blur(){internalData.isActivated=false;return(0,_vue.nextTick)();},/**
|
|
585
596
|
* 已废弃,被 connectToolbar 替换
|
|
586
597
|
* @deprecated
|
|
@@ -695,9 +706,17 @@ if(treeConfig){const childrenField=treeOpts.children||treeOpts.childrenField;_xe
|
|
|
695
706
|
const maxInterval=(0,_util.getColReMaxWidth)(cellParams);// 列之间的最大间距
|
|
696
707
|
const dragMinLeft=isRightFixed?0:cellRect.x-tableRect.x+dragBtnWidth+minInterval;const dragMaxLeft=cellRect.x-tableRect.x+cell.clientWidth-minInterval;let fixedLeftRemainWidth=0;let fixedRightRemainWidth=0;if(isLeftFixed||isRightFixed){let isMach=false;const fixedColumn=isLeftFixed?leftList:rightList;for(let i=0;i<fixedColumn.length;i++){const item=fixedColumn[i];if(isMach){fixedLeftRemainWidth+=item.renderWidth;}else{isMach=item.id===resizeColumn.id;if(!isMach){fixedRightRemainWidth+=item.renderWidth;}}}}// 处理拖动事件
|
|
697
708
|
const updateEvent=evnt=>{evnt.stopPropagation();evnt.preventDefault();const tableHeight=tableEl.clientHeight;const offsetX=evnt.clientX-dragClientX;let left=dragPosLeft+offsetX;if(isLeftFixed){if(rightContainerRect){left=Math.min(left,rightContainerRect.x-tableRect.x-fixedLeftRemainWidth-minInterval);}}else if(isRightFixed){if(leftContainerElem){left=Math.max(left,leftContainerElem.clientWidth+fixedRightRemainWidth+minInterval);}left=Math.min(left,dragMaxLeft);}dragLeft=Math.max(left,dragMinLeft);// 最大宽
|
|
698
|
-
if(maxInterval>1){dragLeft=Math.min(dragLeft,maxInterval+dragMinLeft-minInterval);}const resizeBarLeft=Math.max(1,dragLeft);resizeBarElem.style.left=`${resizeBarLeft}px`;resizeBarElem.style.top=`${scrollbarXToTop?osbHeight:0}px`;resizeBarElem.style.height=`${scrollbarXToTop?tableHeight-osbHeight:tableHeight}px`;if(resizableOpts.showDragTip&&resizeTipElem){resizeTipElem.textContent=getI18n('vxe.table.resizeColTip',[Math.floor(resizeColumn.renderWidth+(isRightFixed?dragPosLeft-dragLeft:dragLeft-dragPosLeft))]);const tableWrapperWidth=tableEl.clientWidth;const resizeBarWidth=resizeBarElem.clientWidth;const resizeTipWidth=resizeTipElem.clientWidth;const resizeTipHeight=resizeTipElem.clientHeight;let resizeTipLeft=-resizeTipWidth;if(resizeBarLeft<resizeTipWidth+resizeBarWidth){resizeTipLeft=0;}else if(resizeBarLeft>tableWrapperWidth){resizeTipLeft+=tableWrapperWidth-resizeBarLeft;}resizeTipElem.style.left=`${resizeTipLeft}px`;resizeTipElem.style.top=`${Math.min(tableHeight-resizeTipHeight,Math.max(0,evnt.clientY-tableRect.y-resizeTipHeight/2))}px`;}reactData.isDragResize=true;};reactData.isDragResize=true;(0,_dom.addClass)(tableEl,'col-drag--resize');resizeBarElem.style.display='block';document.onmousemove=updateEvent;document.onmouseup=function(evnt){document.onmousemove=null;document.onmouseup=null;resizeBarElem.style.display='none';internalData._lastResizeTime=Date.now();setTimeout(()=>{reactData.isDragResize=false;},50);const resizeWidth=resizeColumn.renderWidth+(isRightFixed?dragPosLeft-dragLeft:dragLeft-dragPosLeft);const resizeParams=Object.assign(Object.assign({},params),{resizeWidth,resizeColumn});if(resizableOpts.dragMode==='fixed'){visibleColumn.forEach(item=>{if(item.id!==resizeColumn.id){if(!item.resizeWidth){item.resizeWidth=item.renderWidth;}}});}if($xeTable.handleColResizeCellAreaEvent){$xeTable.handleColResizeCellAreaEvent(evnt,resizeParams);}else{resizeColumn.resizeWidth=resizeWidth;handleUpdateColResize(evnt,resizeParams);}(0,_dom.removeClass)(tableEl,'col-drag--resize');};updateEvent(evnt);if($xeTable.closeMenu){$xeTable.closeMenu();}},handleColResizeDblclickEvent(evnt,params){const resizableOpts=computeResizableOpts.value;const{isDblclickAutoWidth}=resizableOpts;const el=refElem.value;if(isDblclickAutoWidth&&el){evnt.stopPropagation();evnt.preventDefault();const{fullColumnIdData}=internalData;const{column}=params;let resizeColumn=column;if(column.children&&column.children.length){_xeUtils.default.eachTree(column.children,childColumn=>{resizeColumn=childColumn;});}const colid=resizeColumn.id;const colRest=fullColumnIdData[colid];const dragBtnElem=evnt.target;const cell=dragBtnElem.parentNode;const cellParams=Object.assign(params,{cell,$table:$xeTable});const colMinWidth=(0,_util.getColReMinWidth)(cellParams);const colMaxWidth=(0,_util.getColReMaxWidth)(cellParams);el.setAttribute('data-calc-col','Y');let resizeWidth=calcColumnAutoWidth(resizeColumn,el);el.removeAttribute('data-calc-col');if(colRest){resizeWidth=Math.max(resizeWidth,colRest.width);}resizeWidth=Math.max(colMinWidth,resizeWidth);if(colMaxWidth>1){resizeWidth=Math.min(colMaxWidth,resizeWidth);}const resizeParams=Object.assign(Object.assign({},params),{resizeWidth,resizeColumn});reactData.isDragResize=false;internalData._lastResizeTime=Date.now();if($xeTable.handleColResizeDblclickCellAreaEvent){$xeTable.handleColResizeDblclickCellAreaEvent(evnt,resizeParams);}else{resizeColumn.resizeWidth=resizeWidth;handleUpdateColResize(evnt,resizeParams);}}}
|
|
699
|
-
|
|
700
|
-
|
|
709
|
+
if(maxInterval>1){dragLeft=Math.min(dragLeft,maxInterval+dragMinLeft-minInterval);}const resizeBarLeft=Math.max(1,dragLeft);resizeBarElem.style.left=`${resizeBarLeft}px`;resizeBarElem.style.top=`${scrollbarXToTop?osbHeight:0}px`;resizeBarElem.style.height=`${scrollbarXToTop?tableHeight-osbHeight:tableHeight}px`;if(resizableOpts.showDragTip&&resizeTipElem){resizeTipElem.textContent=getI18n('vxe.table.resizeColTip',[Math.floor(resizeColumn.renderWidth+(isRightFixed?dragPosLeft-dragLeft:dragLeft-dragPosLeft))]);const tableWrapperWidth=tableEl.clientWidth;const resizeBarWidth=resizeBarElem.clientWidth;const resizeTipWidth=resizeTipElem.clientWidth;const resizeTipHeight=resizeTipElem.clientHeight;let resizeTipLeft=-resizeTipWidth;if(resizeBarLeft<resizeTipWidth+resizeBarWidth){resizeTipLeft=0;}else if(resizeBarLeft>tableWrapperWidth){resizeTipLeft+=tableWrapperWidth-resizeBarLeft;}resizeTipElem.style.left=`${resizeTipLeft}px`;resizeTipElem.style.top=`${Math.min(tableHeight-resizeTipHeight,Math.max(0,evnt.clientY-tableRect.y-resizeTipHeight/2))}px`;}reactData.isDragResize=true;};reactData.isDragResize=true;(0,_dom.addClass)(tableEl,'col-drag--resize');resizeBarElem.style.display='block';document.onmousemove=updateEvent;document.onmouseup=function(evnt){document.onmousemove=null;document.onmouseup=null;resizeBarElem.style.display='none';internalData._lastResizeTime=Date.now();setTimeout(()=>{reactData.isDragResize=false;},50);const resizeWidth=resizeColumn.renderWidth+(isRightFixed?dragPosLeft-dragLeft:dragLeft-dragPosLeft);const resizeParams=Object.assign(Object.assign({},params),{resizeWidth,resizeColumn});if(resizableOpts.dragMode==='fixed'){visibleColumn.forEach(item=>{if(item.id!==resizeColumn.id){if(!item.resizeWidth){item.resizeWidth=item.renderWidth;}}});}if($xeTable.handleColResizeCellAreaEvent){$xeTable.handleColResizeCellAreaEvent(evnt,resizeParams);}else{resizeColumn.resizeWidth=resizeWidth;handleUpdateColResize(evnt,resizeParams);}(0,_dom.removeClass)(tableEl,'col-drag--resize');};updateEvent(evnt);if($xeTable.closeMenu){$xeTable.closeMenu();}},handleColResizeDblclickEvent(evnt,params){const resizableOpts=computeResizableOpts.value;const{isDblclickAutoWidth}=resizableOpts;const el=refElem.value;if(isDblclickAutoWidth&&el){evnt.stopPropagation();evnt.preventDefault();const{fullColumnIdData}=internalData;const{column}=params;let resizeColumn=column;if(column.children&&column.children.length){_xeUtils.default.eachTree(column.children,childColumn=>{resizeColumn=childColumn;});}const colid=resizeColumn.id;const colRest=fullColumnIdData[colid];const dragBtnElem=evnt.target;const cell=dragBtnElem.parentNode;const cellParams=Object.assign(params,{cell,$table:$xeTable});const colMinWidth=(0,_util.getColReMinWidth)(cellParams);const colMaxWidth=(0,_util.getColReMaxWidth)(cellParams);el.setAttribute('data-calc-col','Y');let resizeWidth=calcColumnAutoWidth(resizeColumn,el);el.removeAttribute('data-calc-col');if(colRest){resizeWidth=Math.max(resizeWidth,colRest.width);}resizeWidth=Math.max(colMinWidth,resizeWidth);if(colMaxWidth>1){resizeWidth=Math.min(colMaxWidth,resizeWidth);}const resizeParams=Object.assign(Object.assign({},params),{resizeWidth,resizeColumn});reactData.isDragResize=false;internalData._lastResizeTime=Date.now();if($xeTable.handleColResizeDblclickCellAreaEvent){$xeTable.handleColResizeDblclickCellAreaEvent(evnt,resizeParams);}else{resizeColumn.resizeWidth=resizeWidth;handleUpdateColResize(evnt,resizeParams);}}},/**
|
|
710
|
+
* @private
|
|
711
|
+
*/handleRowResizeMousedownEvent(evnt,params){evnt.stopPropagation();evnt.preventDefault();const{row}=params;const{showOverflow}=props;const{overflowX,scrollbarWidth,overflowY,scrollbarHeight}=reactData;const{elemStore,fullAllDataRowIdData}=internalData;const osbWidth=overflowY?scrollbarWidth:0;const osbHeight=overflowX?scrollbarHeight:0;const scrollbarYToLeft=computeScrollbarYToLeft.value;const resizableOpts=computeResizableOpts.value;const rowOpts=computeRowOpts.value;const cellOpts=computeCellOpts.value;let tableEl=refElem.value;if($xeGantt){const{refGanttContainerElem}=$xeGantt.getRefMaps();const ganttContainerElem=refGanttContainerElem.value;if(ganttContainerElem){tableEl=ganttContainerElem;}}const resizeBarElem=refRowResizeBar.value;if(!resizeBarElem){return;}const{clientY:dragClientY}=evnt;const resizeTipElem=resizeBarElem.firstElementChild;const dragBtnElem=evnt.currentTarget;const tdEl=dragBtnElem.parentNode;const trEl=tdEl.parentNode;const bodyScrollElem=(0,_util.getRefElem)(elemStore['main-body-scroll']);if(!bodyScrollElem){return;}const rowid=(0,_util.getRowid)($xeTable,row);const rowRest=fullAllDataRowIdData[rowid];if(!rowRest){return;}const defaultRowHeight=computeDefaultRowHeight.value;let currCellHeight=rowRest.resizeHeight||cellOpts.height||rowOpts.height||rowRest.height||defaultRowHeight;if(!showOverflow){currCellHeight=tdEl.clientHeight;}const tableRect=tableEl.getBoundingClientRect();const trRect=trEl.getBoundingClientRect();const targetOffsetY=dragClientY-trRect.y-trEl.clientHeight;let resizeHeight=currCellHeight;const cellEl=tdEl.querySelector('.vxe-cell');let cellMinHeight=0;if(cellEl){const cellStyle=getComputedStyle(cellEl);cellMinHeight=Math.max(1,Math.ceil(_xeUtils.default.toNumber(cellStyle.paddingTop)+_xeUtils.default.toNumber(cellStyle.paddingBottom)));}const minTop=trRect.y-tableRect.y+cellMinHeight;// 处理拖动事件
|
|
712
|
+
const updateEvent=evnt=>{evnt.stopPropagation();evnt.preventDefault();const rtWidth=tableEl.clientWidth-osbWidth;const tableHeight=tableEl.clientHeight-osbHeight;let dragTop=evnt.clientY-tableRect.y-targetOffsetY;if(dragTop<minTop){dragTop=minTop;}else{resizeHeight=Math.max(cellMinHeight,currCellHeight+evnt.clientY-dragClientY);}resizeBarElem.style.left=`${scrollbarYToLeft?osbWidth:0}px`;resizeBarElem.style.top=`${dragTop}px`;resizeBarElem.style.width=`${rtWidth}px`;if(resizableOpts.showDragTip&&resizeTipElem){resizeTipElem.textContent=getI18n('vxe.table.resizeRowTip',[resizeHeight]);const resizeTipWidth=resizeTipElem.clientWidth;const resizeTipHeight=resizeTipElem.clientHeight;let resizeBarLeft=Math.max(2,evnt.clientX-tableRect.x);let resizeBarTop=0;if(resizeBarLeft+resizeTipWidth>=rtWidth-2){resizeBarLeft=rtWidth-resizeTipWidth-2;}if(dragTop+resizeTipHeight>=tableHeight){resizeBarTop=tableHeight-(dragTop+resizeTipHeight);}resizeTipElem.style.left=`${resizeBarLeft}px`;resizeTipElem.style.top=`${resizeBarTop}px`;}reactData.isDragResize=true;};reactData.isDragResize=true;(0,_dom.addClass)(tableEl,'row-drag--resize');resizeBarElem.style.display='block';document.onmousemove=updateEvent;document.onmouseup=function(evnt){document.onmousemove=null;document.onmouseup=null;resizeBarElem.style.display='none';internalData._lastResizeTime=Date.now();setTimeout(()=>{reactData.isDragResize=false;},50);if(resizeHeight!==currCellHeight){const resizeParams=Object.assign(Object.assign({},params),{resizeHeight,resizeRow:row});internalData.isResizeCellHeight=true;if($xeTable.handleRowResizeCellAreaEvent){$xeTable.handleRowResizeCellAreaEvent(evnt,resizeParams);}else{rowRest.resizeHeight=resizeHeight;handleUpdateRowResize(evnt,resizeParams);updateRowOffsetTop();}}(0,_dom.removeClass)(tableEl,'row-drag--resize');};updateEvent(evnt);},/**
|
|
713
|
+
* @private
|
|
714
|
+
*/handleRowResizeDblclickEvent(evnt,params){const resizableOpts=computeResizableOpts.value;const{isDblclickAutoHeight}=resizableOpts;const el=refElem.value;if(isDblclickAutoHeight&&el){evnt.stopPropagation();evnt.preventDefault();const{editStore}=reactData;const{fullAllDataRowIdData}=internalData;const{actived}=editStore;const{row}=params;const rowid=(0,_util.getRowid)($xeTable,row);const rowRest=fullAllDataRowIdData[rowid];if(!rowRest){return;}const handleRsHeight=()=>{el.setAttribute('data-calc-row','Y');const resizeHeight=calcCellAutoHeight(rowid,rowRest,el);el.removeAttribute('data-calc-row');const resizeParams=Object.assign(Object.assign({},params),{resizeHeight,resizeRow:row});reactData.isDragResize=false;internalData._lastResizeTime=Date.now();if($xeTable.handleRowResizeDblclickCellAreaEvent){$xeTable.handleRowResizeDblclickCellAreaEvent(evnt,resizeParams);}else{rowRest.resizeHeight=resizeHeight;handleUpdateRowResize(evnt,resizeParams);}};if(actived.row||actived.column){$xeTable.clearEdit().then(handleRsHeight);}else{handleRsHeight();}}},/**
|
|
715
|
+
* @private
|
|
716
|
+
*/saveCustomStore(type){const{customConfig}=props;const tableId=computeTableId.value;const customOpts=computeCustomOpts.value;const{updateStore,storage,storeOptions}=customOpts;const isAllCustom=storage===true;const storageOpts=Object.assign({},isAllCustom?{}:storage||{},storeOptions);const isCustomResizable=hangleStorageDefaultValue(storageOpts.resizable,isAllCustom);const isCustomVisible=hangleStorageDefaultValue(storageOpts.visible,isAllCustom);const isCustomFixed=hangleStorageDefaultValue(storageOpts.fixed,isAllCustom);const isCustomSort=hangleStorageDefaultValue(storageOpts.sort,isAllCustom);const isCustomAggGroup=hangleStorageDefaultValue(storageOpts.aggGroup,isAllCustom);const isCustomAggFunc=hangleStorageDefaultValue(storageOpts.aggFunc,isAllCustom);if(type!=='reset'){// fix:修复拖动列宽,重置按钮无法点击的问题
|
|
717
|
+
reactData.isCustomStatus=true;}if(storage&&(customConfig?(0,_utils.isEnableConf)(customOpts):customOpts.enabled)&&(isCustomResizable||isCustomVisible||isCustomFixed||isCustomSort||isCustomAggGroup||isCustomAggFunc)){if(!tableId){(0,_log.errLog)('vxe.error.reqProp',['id']);return(0,_vue.nextTick)();}const storeData=type==='reset'?{resizableData:{},sortData:[],visibleData:{},fixedData:{},aggGroupData:{},aggFuncData:{}}:$xeTable.getCustomStoreData();if(updateStore){return updateStore({$table:$xeTable,id:tableId,type,storeData});}else{setCustomStorageMap(tableId,type==='reset'?null:storeData);}}return(0,_vue.nextTick)();},/**
|
|
718
|
+
* @private
|
|
719
|
+
*/handleCustom(){const{mouseConfig}=props;if(mouseConfig){if($xeTable.clearSelected){$xeTable.clearSelected();}if($xeTable.clearCellAreas){$xeTable.clearCellAreas();$xeTable.clearCopyCellArea();}}$xeTable.analyColumnWidth();return $xeTable.refreshColumn(true);},handleUpdateDataQueue(){reactData.upDataFlag++;},handleRefreshColumnQueue(){reactData.reColumnFlag++;},handleFilterOptions(column){if(column){const{filterStore}=reactData;const{filterRender,filters}=column;const filterOptions=filters||[];const compConf=(0,_utils.isEnableConf)(filterRender)?renderer.get(filterRender.name):null;const frMethod=column.filterRecoverMethod||(compConf?compConf.tableFilterRecoverMethod||compConf.filterRecoverMethod:null);filterStore.column=column;// 复原状态
|
|
701
720
|
filterOptions.forEach(option=>{const{_checked,checked}=option;option._checked=checked;if(!checked&&_checked!==checked){if(frMethod){frMethod({option,column,$table:$xeTable});}}});$xeTable.checkFilterOptions();}},preventEvent(evnt,type,args,next,end){let evntList=interceptor.get(type);// 兼容老版本
|
|
702
721
|
if(!evntList.length&&type==='event.clearEdit'){evntList=interceptor.get('event.clearActived');if(evntList.length){(0,_log.warnLog)('vxe.error.delEvent',['event.clearActived','event.clearEdit']);}}// 兼容老版本
|
|
703
722
|
let rest=null;let isStop=false;for(let i=0;i<evntList.length;i++){const func=evntList[i];const fnRest=func(Object.assign({$table:$xeTable,$grid:$xeGrid,gantt:$xeGantt,$event:evnt},args));if(fnRest===false){isStop=true;break;}else if(fnRest&&fnRest.status===false){rest=fnRest.result;isStop=true;break;}}if(!isStop){if(next){rest=next();}}if(end){end();}return rest;},updateCheckboxStatus(){const{treeConfig}=props;const{isRowGroupStatus}=reactData;const{afterTreeFullData,afterGroupFullData,selectCheckboxMaps,treeIndeterminateRowMaps}=internalData;const aggregateOpts=computeAggregateOpts.value;const treeOpts=computeTreeOpts.value;const childrenField=treeOpts.children||treeOpts.childrenField;const checkboxOpts=computeCheckboxOpts.value;const{checkField,indeterminateField,checkStrictly,checkMethod}=checkboxOpts;if(checkStrictly){return;}if(isRowGroupStatus||treeConfig){const{handleGetRowId}=(0,_util.createHandleGetRowId)($xeTable);const childRowMaps={};const childRowList=[];if(isRowGroupStatus){// 行分组
|