vxe-table 4.18.11 → 4.18.13
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/es/index.css +1 -1
- package/es/index.min.css +1 -1
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/table/src/header.js +3 -1
- package/es/table/src/table.js +29 -6
- package/es/table/style.css +48 -18
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/es/vxe-table/style.css +48 -18
- package/lib/index.common.js +1 -2
- package/lib/index.css +1 -1
- package/lib/index.min.css +1 -1
- package/lib/index.umd.js +373 -187
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/table/src/header.js +7 -5
- package/lib/table/src/header.min.js +1 -1
- package/lib/table/src/table.js +7 -7
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/style/style.css +48 -18
- 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/lib/v-x-e-table/index.js +1 -2
- package/lib/v-x-e-table/index.min.js +1 -1
- package/lib/vxe-colgroup/index.js +1 -2
- package/lib/vxe-colgroup/index.min.js +1 -1
- package/lib/vxe-column/index.js +1 -2
- package/lib/vxe-column/index.min.js +1 -1
- package/lib/vxe-grid/index.js +1 -2
- package/lib/vxe-grid/index.min.js +1 -1
- package/lib/vxe-table/index.js +1 -2
- package/lib/vxe-table/index.min.js +1 -1
- package/lib/vxe-table/style/style.css +48 -18
- package/lib/vxe-toolbar/index.js +1 -2
- package/lib/vxe-toolbar/index.min.js +1 -1
- package/lib/vxe-ui/index.js +1 -2
- package/lib/vxe-ui/index.min.js +1 -1
- package/lib/vxe-v-x-e-table/index.js +1 -2
- package/lib/vxe-v-x-e-table/index.min.js +1 -1
- package/package.json +3 -2
- package/packages/table/src/header.ts +3 -1
- package/packages/table/src/table.ts +30 -7
- /package/es/{iconfont.1775652066125.ttf → iconfont.1776926463538.ttf} +0 -0
- /package/es/{iconfont.1775652066125.woff → iconfont.1776926463538.woff} +0 -0
- /package/es/{iconfont.1775652066125.woff2 → iconfont.1776926463538.woff2} +0 -0
- /package/lib/{iconfont.1775652066125.ttf → iconfont.1776926463538.ttf} +0 -0
- /package/lib/{iconfont.1775652066125.woff → iconfont.1776926463538.woff} +0 -0
- /package/lib/{iconfont.1775652066125.woff2 → iconfont.1776926463538.woff2} +0 -0
package/lib/table/src/header.js
CHANGED
|
@@ -78,11 +78,13 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
78
78
|
spanColumns = visibleColgroups;
|
|
79
79
|
}
|
|
80
80
|
headerColumn.value = spanColumns;
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
81
|
+
(0, _vue.nextTick)(() => {
|
|
82
|
+
$xeTable.dispatchEvent('columns-change', {
|
|
83
|
+
visibleColgroups,
|
|
84
|
+
collectColumn,
|
|
85
|
+
visibleColumn
|
|
86
|
+
}, null);
|
|
87
|
+
});
|
|
86
88
|
};
|
|
87
89
|
const renderRows = (isGroup, isOptimizeMode, headerGroups, $rowIndex, cols) => {
|
|
88
90
|
const $xeGrid = $xeTable.xeGrid;
|
|
@@ -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"),_utils=require("../../ui/src/utils"),_util=require("./util"),_vn=require("../../ui/src/vn");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}let{renderer,renderEmptyElement}=_ui.VxeUI,sourceType="table",renderType="header";var _default=exports.default=(0,_comp.defineVxeComponent)({name:"VxeTableHeader",props:{tableData:Array,tableColumn:Array,tableGroupColumn:Array,fixedColumn:Array,fixedType:{type:String,default:null}},setup(x){let ue=(0,_vue.inject)("$xeTable",{}),{xID:g,props:f,reactData:m,internalData:_}=ue,{computeColumnOpts:a,computeColumnDragOpts:r,computeCellOpts:t,computeMouseOpts:b,computeHeaderCellOpts:i,computeDefaultRowHeight:n,computeVirtualXOpts:d,computeFloatingFilterOpts:C,computeIsHeaderRenderOptimize:w}=ue.getComputeMaps(),y=(0,_vue.ref)([]),H=(0,_vue.ref)(),D=(0,_vue.ref)(),
|
|
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"),_utils=require("../../ui/src/utils"),_util=require("./util"),_vn=require("../../ui/src/vn");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}let{renderer,renderEmptyElement}=_ui.VxeUI,sourceType="table",renderType="header";var _default=exports.default=(0,_comp.defineVxeComponent)({name:"VxeTableHeader",props:{tableData:Array,tableColumn:Array,tableGroupColumn:Array,fixedColumn:Array,fixedType:{type:String,default:null}},setup(x){let ue=(0,_vue.inject)("$xeTable",{}),{xID:g,props:f,reactData:m,internalData:_}=ue,{computeColumnOpts:a,computeColumnDragOpts:r,computeCellOpts:t,computeMouseOpts:b,computeHeaderCellOpts:i,computeDefaultRowHeight:n,computeVirtualXOpts:d,computeFloatingFilterOpts:C,computeIsHeaderRenderOptimize:w}=ue.getComputeMaps(),y=(0,_vue.ref)([]),H=(0,_vue.ref)(),D=(0,_vue.ref)(),T=(0,_vue.ref)(),E=(0,_vue.ref)(),S=(0,_vue.ref)(),O=(0,_vue.ref)(),o=(0,_vue.ref)(),u=()=>{var e=f.showCustomHeader;let{collectColumn:l,visibleColumn:a}=_;var r=x.tableGroupColumn,t=m.isGroup;let i=t?(0,_util.convertHeaderColumnToRows)(r):[],n=[];e&&1<i.length&&(n=(0,_util.convertHeaderToGridRows)(i),i=n),y.value=i,(0,_vue.nextTick)(()=>{ue.dispatchEvent("columns-change",{visibleColgroups:n,collectColumn:l,visibleColumn:a},null)})},I=(T,E,e,S,O)=>{let I=ue.xeGrid,k=ue.xeGantt,F=x.fixedType,{resizable:R,columnKey:$,showCustomHeader:U,headerCellClassName:M,headerCellStyle:z,showHeaderOverflow:A,headerAlign:q,align:G,mouseConfig:X}=f,{currentColumn:j,dragCol:N,scrollXLoad:W,scrollYLoad:L,overflowX:V,mergeHeadFlag:B,tableColumn:K}=m,{fullColumnIdData:P,scrollXStore:Y,mergeHeaderList:J,mergeHeaderCellMaps:Q}=_,Z=d.value,ee=a.value,le=r.value,ae=t.value;var l=n.value;let re=i.value,te=(0,_util.getCalcHeight)(re.height)||l,{disabledMethod:ie,isCrossDrag:de,isPeerDrag:oe}=le,ne=S===e.length-1;return O.map((e,l)=>{var{type:a,showHeaderOverflow:r,headerAlign:t,align:i,filters:n,headerClassName:d,editRender:o,cellRender:u}=e,s=e.id,c=P[s]||{},o=o||u,u=o?renderer.get(o.name):null,o=e.children&&e.children.length,p=V&&!o&&(F?e.fixed!==F:!!e.fixed),v=(_xeUtils.default.isBoolean(re.padding)?re:ae).padding,r=_xeUtils.default.eqNull(r)?A:r,t=t||(u?u.tableHeaderCellAlign:"")||q||i||(u?u.tableCellAlign:"")||G,i="ellipsis"===r,u="title"===r,r=!0===r||"tooltip"===r,h=u||r||i;let x=!1,g=null;n&&(g=n[0],x=n.some(e=>e.checked));var f=c.index,c=c._index;let m={$table:ue,$grid:I,$gantt:k,$rowIndex:S,column:e,columnIndex:f,$columnIndex:l,_columnIndex:c,firstFilterOption:g,fixed:F,source:sourceType,type:renderType,isHidden:p,hasFilter:x};f={colid:s};let _=!1;if(U||(f.colspan=1<e.colSpan?e.colSpan:null,f.rowspan=1<e.rowSpan?e.rowSpan:null),B&&J.length&&(U||ne)){var b=Q[S+":"+(U?l:c)];if(b){var{rowspan:b,colspan:C}=b;if(!b||!C)return null;1<b&&(_=!0,f.rowspan=b),1<C&&(_=!0,f.colspan=C)}}b={onClick:e=>ue.triggerHeaderCellClickEvent(e,m),onDblclick:e=>ue.triggerHeaderCellDblclickEvent(e,m)},C=ee.drag&&"cell"===le.trigger;let w=!1;C&&(w=!(!ie||!ie(m))),(X||C)&&(b.onMousedown=e=>ue.triggerHeaderCellMousedownEvent(e,m)),ee.drag&&(b.onDragstart=ue.handleHeaderCellDragDragstartEvent,b.onDragend=ue.handleHeaderCellDragDragendEvent,b.onDragover=ue.handleHeaderCellDragDragoverEvent,C)&&(b.onMouseup=ue.handleHeaderCellDragMouseupEvent);var C=l===O.length-1,y=_xeUtils.default.isBoolean(e.resizable)?e.resizable:ee.resizable||R,H=!e.resizeWidth&&("auto"===e.minWidth||"auto"===e.width);let D=!1;!E||!V||T||_||N&&N.id===s||W&&10<K.length&&!e.fixed&&!Z.immediate&&(c<Y.visibleStartIndex-Y.preloadSize||c>Y.visibleEndIndex+Y.preloadSize)&&(D=!0);c={};if(h?c.height=te+"px":c.minHeight=te+"px",!U&&o&&!ne){let l=0;_xeUtils.default.eachTree(e.children,e=>{!e.visible||e.children&&e.children.length||(l+=e.renderWidth)}),c.width=l+"px"}return(0,_vue.h)("th",Object.assign(Object.assign(Object.assign({class:["vxe-table--column vxe-header--column",s,p?"fixed--hidden":"fixed--visible",{["col--"+t]:t,["col--"+a]:a,"col--last":C,"col--fixed":e.fixed,"col--group":o,"col--ellipsis":h,"fixed--width":!H,"is--padding":v,"is--sortable":e.sortable,"col--filter":!!n,"is--filter-active":x,"is--drag-active":ee.drag&&!e.fixed&&!w&&(de||oe||!e.parentId),"is--drag-disabled":ee.drag&&w,"col--current":j===e},d?_xeUtils.default.isFunction(d)?d(m):d:"",M?_xeUtils.default.isFunction(M)?M(m):M:""],style:z?_xeUtils.default.isFunction(z)?z(m):z:null},f),b),{key:U?""+s+l:$||W||L||ee.useKey||ee.drag||o?s:l}),[(0,_vue.h)("div",{class:["vxe-cell",{"c--title":u,"c--tooltip":r,"c--ellipsis":i}],style:c},D||E&&p?[]:[(0,_vue.h)("div",{colid:s,class:"vxe-cell--wrapper vxe-header-cell--wrapper"},e.renderHeader(m))]),p||!y||U&&!ne?renderEmptyElement(ue):(0,_vue.h)("div",{class:"vxe-cell--col-resizable",onMousedown:e=>ue.handleColResizeMousedownEvent(e,F,m),onDblclick:e=>ue.handleColResizeDblclickEvent(e,m)})])})},k=(C,w)=>{let y=ue.xeGrid,H=ue.xeGantt,D=x.fixedType,{showHeaderOverflow:T,headerAlign:E,align:S}=f,{currentColumn:O,overflowX:I}=m,k=_.fullColumnIdData,F=t.value;var e=n.value;let R=i.value,$=(0,_util.getCalcHeight)(R.height)||e;return w.map((e,l)=>{var{type:a,showHeaderOverflow:r,headerAlign:t,align:i,filters:n,editRender:d,cellRender:o,floatingFilters:u,filterRender:s,slots:c}=e,p=e.id,v=k[p]||{},d=d||o,o=c?c.floatingFilter||c["floating-filter"]:null,c=d?renderer.get(d.name):null,d=(0,_utils.isEnableConf)(s)?renderer.get(s.name):null,d=d?d.renderTableFloatingFilter:null,h=I&&(D?e.fixed!==D:!!e.fixed),x=(_xeUtils.default.isBoolean(R.padding)?R:F).padding,r=_xeUtils.default.eqNull(r)?T:r,t=t||(c?c.tableHeaderCellAlign:"")||E||i||(c?c.tableCellAlign:"")||S,i="ellipsis"===r,c="title"===r,r=!0===r||"tooltip"===r,g=c||r||i;let f=!1,m=null;n&&(m=n[0],f=n.some(e=>e.checked));var n=v.index,v=v._index,n={$table:ue,$grid:y,$gantt:H,column:e,columnIndex:n,$columnIndex:l,_columnIndex:v,option:m,fixed:D,source:sourceType,type:renderType,isHidden:h,hasFilter:f},v={colid:p},l=l===w.length-1,_=!e.resizeWidth&&("auto"===e.minWidth||"auto"===e.width),b={};return g?b.height=$+"px":b.minHeight=$+"px",(0,_vue.h)("th",Object.assign({class:["vxe-table--column vxe-header--column",p,h?"fixed--hidden":"fixed--visible",{["col--"+t]:t,["col--"+a]:a,"col--last":l,"col--fixed":e.fixed,"col--ellipsis":g,"fixed--width":!_,"is--padding":x,"is--sortable":e.sortable,"col--current":O===e}],key:p},v),[(0,_vue.h)("div",{class:["vxe-cell",{"c--title":c,"c--tooltip":r,"c--ellipsis":i}],style:b},C&&h&&!u?[]:[(0,_vue.h)("div",{colid:p,class:"vxe-cell--wrapper vxe-header-cell--wrapper"},o?ue.callSlot(o,n):d&&m?(0,_vn.getSlotVNs)(d(s,n)):[])])])})};return(0,_vue.watch)(()=>x.tableColumn,u),(0,_vue.onMounted)(()=>{(0,_vue.nextTick)(()=>{var e=x.fixedType,l=ue.internalData,l=l.elemStore,e=`${e||"main"}-header-`;l[e+"wrapper"]=H,l[e+"scroll"]=D,l[e+"table"]=T,l[e+"colgroup"]=E,l[e+"list"]=S,l[e+"xSpace"]=O,l[e+"repair"]=o,u()})}),(0,_vue.onUnmounted)(()=>{var e=x.fixedType,l=ue.internalData,l=l.elemStore,e=`${e||"main"}-header-`;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+"repair"]=null}),()=>{let{fixedType:l,fixedColumn:e,tableColumn:a}=x;var r=f.mouseConfig,{isGroup:t,isColLoading:i,overflowX:n,scrollXLoad:d,dragCol:o}=m,{visibleColumn:u,fullColumnIdData:s}=_,c=b.value,p=w.value;let v=y.value||[],h=a;return t?h=u:(p&&(i||!l&&n)||(h=u),l&&p&&(h=e||[]),v=[h]),l||t||d&&o&&2<h.length&&(i=s[o.id])&&(n=i._index,u=h[0],d=h[h.length-1],i=s[u.id],u=s[d.id],i)&&u&&(s=i._index,d=u._index,n<s?(h=[o].concat(h),v=[[o].concat(v[0])].concat(v.slice(1))):d<n&&(h=h.concat([o]),v=[v[0].concat([o])].concat(v.slice(1)))),(0,_vue.h)("div",{ref:H,class:["vxe-table--header-wrapper",l?`fixed-${l}--wrapper`:"body--wrapper"],xid:g},[(0,_vue.h)("div",{ref:D,class:"vxe-table--header-inner-wrapper",onScroll(e){ue.triggerHeaderScrollEvent(e,l)}},[l?renderEmptyElement(ue):(0,_vue.h)("div",{ref:O,class:"vxe-body--x-space"}),(0,_vue.h)("table",{ref:T,class:"vxe-table--header",xid:g,cellspacing:0,cellpadding:0,border:0,xvm:p?"1":null},[(0,_vue.h)("colgroup",{ref:E},h.map((e,l)=>(0,_vue.h)("col",{name:e.id,key:l,style:{width:e.renderWidth+"px"}}))),(0,_vue.h)("thead",{ref:S},((r,t,i,e)=>{let n=x.fixedType,{headerRowClassName:d,headerRowStyle:o}=f;var l=C.value,a=i.map((e,l)=>{var a={$table:ue,$rowIndex:l,fixed:n,type:renderType};return(0,_vue.h)("tr",{key:l,class:["vxe-header--row",d?_xeUtils.default.isFunction(d)?d(a):d:""],style:o?_xeUtils.default.isFunction(o)?o(a):o:null},I(r,t,i,l,e))});return l.enabled&&a.push((0,_vue.h)("tr",{key:"ff",class:["vxe-header--row"]},k(t,e))),a})(t,p,v,h))]),r&&c.area?(0,_vue.h)("div",{class:"vxe-table--cell-area",xid:g},[(0,_vue.h)("span",{class:"vxe-table--cell-main-area"}),(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-col-status-area"})]):renderEmptyElement(ue)])])}}});
|
package/lib/table/src/table.js
CHANGED
|
@@ -63,7 +63,7 @@ remainList.forEach(column=>{const width=Math.max(meanWidth,minCellWidth);column.
|
|
|
63
63
|
* 计算自适应行高
|
|
64
64
|
*/const calcCellAutoHeight=(rowRest,wrapperEl)=>{const{scrollXLoad}=reactData;const wrapperElemList=wrapperEl.querySelectorAll(`.vxe-cell--wrapper[rowid="${rowRest.rowid}"]`);let colHeight=0;let firstCellStyle=null;let topBottomPadding=0;for(let i=0;i<wrapperElemList.length;i++){const wrapperElem=wrapperElemList[i];const cellElem=wrapperElem.parentElement;const cellStyle=cellElem.style;const orHeight=cellStyle.height;if(!scrollXLoad){cellStyle.height='';}if(!firstCellStyle){firstCellStyle=getComputedStyle(cellElem);topBottomPadding=firstCellStyle?Math.ceil(_xeUtils.default.toNumber(firstCellStyle.paddingTop)+_xeUtils.default.toNumber(firstCellStyle.paddingBottom)):0;}if(!scrollXLoad){cellStyle.height=orHeight;}const cellHeight=wrapperElem?wrapperElem.clientHeight:0;colHeight=Math.max(colHeight,Math.ceil(cellHeight+topBottomPadding));}if(scrollXLoad){colHeight=Math.max(colHeight,rowRest.height);}return colHeight;};/**
|
|
65
65
|
* 自适应行高
|
|
66
|
-
*/const calcCellHeight=()=>{const{treeConfig}=props;const{tableData,isAllOverflow,scrollYLoad,scrollXLoad}=reactData;const{fullAllDataRowIdData}=internalData;const
|
|
66
|
+
*/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
67
|
* 预编译
|
|
68
68
|
* 对渲染中的数据提前解析序号及索引。牺牲提前编译耗时换取渲染中额外损耗,使运行时更加流畅
|
|
69
69
|
*/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();}};/**
|
|
@@ -150,7 +150,7 @@ if(!checkStrictly&&$xeTable.isCheckedByCheckboxRow(row)){handleCheckedCheckboxRo
|
|
|
150
150
|
const computeScrollLoad=()=>{return(0,_vue.nextTick)().then(()=>{const{scrollXLoad,scrollYLoad}=reactData;const{scrollXStore,scrollYStore}=internalData;const virtualYOpts=computeVirtualYOpts.value;const virtualXOpts=computeVirtualXOpts.value;// 计算 X 逻辑
|
|
151
151
|
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 逻辑
|
|
152
152
|
const rowHeight=computeRowHeight();scrollYStore.rowHeight=rowHeight;// 已废弃
|
|
153
|
-
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 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;internalData.rceRunTime=Date.now();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();}return computeScrollLoad().then(()=>{// 初始化时需要在列计算之后再执行优化运算,达到最优显示效果
|
|
153
|
+
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;internalData.rceRunTime=Date.now();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();}return computeScrollLoad().then(()=>{// 初始化时需要在列计算之后再执行优化运算,达到最优显示效果
|
|
154
154
|
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;const refreshDelay=resizeOpts.refreshDelay||20;const el=refElem.value;if(el&&el.clientWidth){autoCellWidth();updateRowExpandStyle();}if(customStore.visible&&$xeTable.handleCustomStyle){$xeTable.handleCustomStyle();}if(rceTimeout){clearTimeout(rceTimeout);if(rceRunTime&&rceRunTime+(refreshDelay-5)<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);},refreshDelay);});};const handleResizeEvent=()=>{handleLazyRecalculate(true,true,true);};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.handlePivotTableAggregateData){$xeTable.handlePivotTableAggregateData(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,/**
|
|
155
155
|
* 已废弃
|
|
156
156
|
* @deprecated
|
|
@@ -247,12 +247,12 @@ const matchObj=_xeUtils.default.findTree(tableFullGroupData,item=>(0,_util.getRo
|
|
|
247
247
|
*/const handleDefaultRowGroupExpand=()=>{const{isRowGroupStatus}=reactData;if(isRowGroupStatus){const aggregateOpts=computeAggregateOpts.value;const{expandAll,expandGroupFields}=aggregateOpts;if(expandAll){$xeTable.setAllRowGroupExpand(true);}else if(expandGroupFields&&expandGroupFields.length){$xeTable.setRowGroupExpandByField(expandGroupFields,true);}}};const handleCheckAllEvent=(evnt,value)=>{handleCheckedAllCheckboxRow(value);if(evnt){dispatchEvent('checkbox-all',{records:()=>$xeTable.getCheckboxRecords(),reserves:()=>$xeTable.getCheckboxReserveRecords(),indeterminates:()=>$xeTable.getCheckboxIndeterminateRecords(),checked:value},evnt);}};/**
|
|
248
248
|
* 纵向 Y 可视渲染处理
|
|
249
249
|
*/const loadScrollYData=()=>{const{isAllOverflow,isScrollYBig}=reactData;const{mergeBodyList,mergeBodyColMaps,scrollYStore}=internalData;const{preloadSize,startIndex,endIndex,offsetSize}=scrollYStore;const autoOffsetYSize=isAllOverflow?offsetSize:offsetSize+1;const{toVisibleIndex,visibleSize}=handleVirtualYVisible();const offsetItem={startIndex:Math.max(0,isScrollYBig?toVisibleIndex-1:toVisibleIndex-1-offsetSize-preloadSize),endIndex:isScrollYBig?toVisibleIndex+visibleSize:toVisibleIndex+visibleSize+autoOffsetYSize+preloadSize};scrollYStore.visibleStartIndex=toVisibleIndex-1;scrollYStore.visibleEndIndex=toVisibleIndex+visibleSize+1;calculateMergerOffsetIndex(mergeBodyList,mergeBodyColMaps,offsetItem,'row');const{startIndex:offsetStartIndex,endIndex:offsetEndIndex}=offsetItem;if(toVisibleIndex<=startIndex||toVisibleIndex>=endIndex-visibleSize-1){if(startIndex!==offsetStartIndex||endIndex!==offsetEndIndex){scrollYStore.startIndex=offsetStartIndex;scrollYStore.endIndex=offsetEndIndex;$xeTable.updateScrollYData();}}};const createGetRowCacheProp=prop=>{return function(row){const{fullAllDataRowIdData}=internalData;if(row){const rowid=(0,_util.getRowid)($xeTable,row);const rowRest=fullAllDataRowIdData[rowid];if(rowRest){return rowRest[prop];}}return-1;};};const createGetColumnCacheProp=prop=>{return function(column){const{fullColumnIdData}=internalData;if(column){const colRest=fullColumnIdData[column.id];if(colRest){return colRest[prop];}}return-1;};};const lazyScrollXData=()=>{const{lxTimeout,lxRunTime,scrollXStore}=internalData;const{visibleSize}=scrollXStore;const fpsTime=visibleSize>26?26:visibleSize>16?14:6;if(lxTimeout){clearTimeout(lxTimeout);}if(!lxRunTime||lxRunTime+fpsTime<Date.now()){internalData.lxRunTime=Date.now();loadScrollXData();}internalData.lxTimeout=setTimeout(()=>{internalData.lxTimeout=undefined;internalData.lxRunTime=undefined;loadScrollXData();},fpsTime);};const lazyScrollYData=()=>{const{lyTimeout,lyRunTime,scrollYStore}=internalData;const{visibleSize}=scrollYStore;const fpsTime=visibleSize>30?32:visibleSize>20?18:8;if(lyTimeout){clearTimeout(lyTimeout);}if(!lyRunTime||lyRunTime+fpsTime<Date.now()){internalData.lyRunTime=Date.now();loadScrollYData();}internalData.lyTimeout=setTimeout(()=>{internalData.lyTimeout=undefined;internalData.lyRunTime=undefined;loadScrollYData();},fpsTime);};const handleSyncScroll=(isRollX,isRollY)=>{const{scrollXLoad,scrollYLoad,isAllOverflow}=reactData;internalData.lcsRunTime=Date.now();internalData.lcsTimeout=undefined;internalData.intoRunScroll=false;internalData.inVirtualScroll=false;internalData.inWheelScroll=false;internalData.inHeaderScroll=false;internalData.inBodyScroll=false;internalData.inFooterScroll=false;reactData.lazScrollLoading=false;internalData.scrollRenderType='';let xRest=null;let yRest=null;if(!isAllOverflow){calcCellHeight();updateRowOffsetTop();}if(isRollX&&scrollXLoad){xRest=$xeTable.updateScrollXData();}if(isRollY&&scrollYLoad){yRest=$xeTable.updateScrollYData().then(()=>{if(!isAllOverflow){calcCellHeight();updateRowOffsetTop();}return $xeTable.updateScrollYSpace();});}updateRowExpandStyle();return Promise.all([xRest,yRest,scrollXLoad||scrollYLoad?$xeTable.updateCellAreas():null]);};const checkLastSyncScroll=(isRollX,isRollY)=>{const{lcsTimeout}=internalData;reactData.lazScrollLoading=true;if(lcsTimeout){clearTimeout(lcsTimeout);}internalData.lcsTimeout=setTimeout(()=>{handleSyncScroll(isRollX,isRollY).then(()=>{if(reactData.scrollXLoad||reactData.scrollYLoad){(0,_vue.nextTick)(()=>{updateRowExpandStyle();if(!internalData.lcsTimeout){handleSyncScroll(isRollX,isRollY);}});}});},200);};const getWheelSpeed=lastScrollTime=>{let multiple=1;const currTime=Date.now();if(lastScrollTime+25>currTime){multiple=1.18;}else if(lastScrollTime+30>currTime){multiple=1.15;}else if(lastScrollTime+40>currTime){multiple=1.12;}else if(lastScrollTime+55>currTime){multiple=1.09;}else if(lastScrollTime+75>currTime){multiple=1.06;}else if(lastScrollTime+100>currTime){multiple=1.03;}return multiple;};const syncGanttScrollTop=scrollTop=>{const $xeGanttView=internalData.xeGanttView;if($xeGanttView){const ganttInternalData=$xeGanttView.internalData;const{elemStore:ganttElemStore}=ganttInternalData;const ganttBodyScrollElem=(0,_util.getRefElem)(ganttElemStore['main-body-scroll']);if(ganttBodyScrollElem){ganttBodyScrollElem.scrollTop=scrollTop;}}};const dispatchEvent=(type,params,evnt)=>{emit(type,createEvent(evnt,{$table:$xeTable,$grid:$xeGrid,$gantt:$xeGantt},params));};const handleScrollToRowColumn=(fieldOrColumn,row,options)=>{const{fullColumnIdData}=internalData;const column=(0,_util.handleFieldOrColumn)($xeTable,fieldOrColumn);if(column&&fullColumnIdData[column.id]){return(0,_util.colToVisible)($xeTable,options?options.colAlign!==false:true,column,row);}return(0,_vue.nextTick)();};const handleUpdateResize=()=>{const el=refElem.value;if(el&&el.clientWidth&&el.clientHeight){$xeTable.recalculate();}};const handleUpdateColResize=(evnt,params)=>{$xeTable.analyColumnWidth();$xeTable.recalculate().then(()=>{$xeTable.saveCustomStore('update:width');$xeTable.refreshScroll().then(()=>{$xeTable.updateCellAreas();});$xeTable.dispatchEvent('column-resizable-change',params,evnt);// 已废弃 resizable-change
|
|
250
|
-
$xeTable.dispatchEvent('resizable-change',params,evnt);setTimeout(()=>{$xeTable.recalculate(true);},300);});};const handleUpdateRowResize=(evnt,params)=>{reactData.resizeHeightFlag++;$xeTable.recalculate().then(()=>{$xeTable.refreshScroll().then(()=>{$xeTable.updateCellAreas();});$xeTable.dispatchEvent('row-resizable-change',params,evnt);setTimeout(()=>{$xeTable.recalculate(true);},300);});};const updateColumnOffsetLeft=()=>{const{visibleColumn,fullColumnIdData}=internalData;let offsetLeft=0;for(let cIndex=0,rLen=visibleColumn.length;cIndex<rLen;cIndex++){const column=visibleColumn[cIndex];const colid=column.id;const colRest=fullColumnIdData[colid];if(colRest){colRest.oLeft=offsetLeft;}offsetLeft+=column.renderWidth;}};const updateRowOffsetTop=()=>{const{expandColumn}=reactData;const{afterFullData,fullAllDataRowIdData,rowExpandedMaps}=internalData;const expandOpts=computeExpandOpts.value;const rowOpts=computeRowOpts.value;const cellOpts=computeCellOpts.value;const defaultRowHeight=computeDefaultRowHeight.value;const{handleGetRowId}=(0,_util.createHandleGetRowId)($xeTable);let offsetTop=0;for(let rIndex=0,rLen=afterFullData.length;rIndex<rLen;rIndex++){const row=afterFullData[rIndex];const rowid=handleGetRowId(row);const rowRest=fullAllDataRowIdData[rowid]||{};rowRest.oTop=offsetTop;offsetTop+=rowRest.resizeHeight||cellOpts.height||rowOpts.height||rowRest.height||defaultRowHeight;// 是否展开行
|
|
250
|
+
$xeTable.dispatchEvent('resizable-change',params,evnt);setTimeout(()=>{$xeTable.recalculate(true);},300);});};const handleUpdateRowResize=(evnt,params)=>{reactData.resizeHeightFlag++;$xeTable.recalculate().then(()=>{$xeTable.refreshScroll().then(()=>{$xeTable.updateCellAreas();});$xeTable.dispatchEvent('row-resizable-change',params,evnt);setTimeout(()=>{$xeTable.recalculate(true);},300);});};const updateColumnOffsetLeft=()=>{const{visibleColumn,fullColumnIdData}=internalData;const el=refElem.value;if(!el||!el.clientWidth){return;}let offsetLeft=0;for(let cIndex=0,rLen=visibleColumn.length;cIndex<rLen;cIndex++){const column=visibleColumn[cIndex];const colid=column.id;const colRest=fullColumnIdData[colid];if(colRest){colRest.oLeft=offsetLeft;}offsetLeft+=column.renderWidth;}};const updateRowOffsetTop=()=>{const{expandColumn}=reactData;const{afterFullData,fullAllDataRowIdData,rowExpandedMaps}=internalData;const el=refElem.value;if(!el||!el.clientWidth){return;}const expandOpts=computeExpandOpts.value;const rowOpts=computeRowOpts.value;const cellOpts=computeCellOpts.value;const defaultRowHeight=computeDefaultRowHeight.value;const{handleGetRowId}=(0,_util.createHandleGetRowId)($xeTable);let offsetTop=0;for(let rIndex=0,rLen=afterFullData.length;rIndex<rLen;rIndex++){const row=afterFullData[rIndex];const rowid=handleGetRowId(row);const rowRest=fullAllDataRowIdData[rowid]||{};rowRest.oTop=offsetTop;offsetTop+=rowRest.resizeHeight||cellOpts.height||rowOpts.height||rowRest.height||defaultRowHeight;// 是否展开行
|
|
251
251
|
if(expandColumn&&rowExpandedMaps[rowid]){offsetTop+=rowRest.expandHeight||expandOpts.height||0;}}};/**
|
|
252
252
|
* 更新展开行样式
|
|
253
|
-
*/const updateRowExpandStyle=()=>{const{expandColumn,scrollYLoad,scrollYTop,isScrollYBig}=reactData;const expandOpts=computeExpandOpts.value;const rowOpts=computeRowOpts.value;const cellOpts=computeCellOpts.value;const defaultRowHeight=computeDefaultRowHeight.value;const{mode}=expandOpts;if(expandColumn&&mode==='fixed'){const{elemStore,fullAllDataRowIdData}=internalData;const rowExpandEl=refRowExpandElem.value;const bodyScrollElem=(0,_util.getRefElem)(elemStore['main-body-scroll']);if(rowExpandEl&&bodyScrollElem){let isUpdateHeight=false;_xeUtils.default.arrayEach(rowExpandEl.children,reEl=>{const expandEl=reEl;const rowid=expandEl.getAttribute('rowid')||'';const rowRest=fullAllDataRowIdData[rowid];if(rowRest){const expandHeight=expandEl.offsetHeight;const trEl=bodyScrollElem.querySelector(`.vxe-body--row[rowid="${rowid}"]`);let offsetTop=0;if(scrollYLoad){if(isScrollYBig&&trEl){offsetTop=trEl.offsetTop+trEl.offsetHeight;}else{offsetTop=rowRest.oTop+(rowRest.resizeHeight||cellOpts.height||rowOpts.height||rowRest.height||defaultRowHeight);}}else{if(trEl){offsetTop=trEl.offsetTop+trEl.offsetHeight;}}if(isScrollYBig){offsetTop+=scrollYTop;}expandEl.style.top=(0,_dom.toCssUnit)(offsetTop);if(!isUpdateHeight){if(rowRest.expandHeight!==expandHeight){isUpdateHeight=true;}}rowRest.expandHeight=expandHeight;}});if(isUpdateHeight){reactData.rowExpandHeightFlag++;(0,_vue.nextTick)(()=>{updateRowOffsetTop();});}}}};/**
|
|
253
|
+
*/const updateRowExpandStyle=()=>{const{expandColumn,scrollYLoad,scrollYTop,isScrollYBig}=reactData;const el=refElem.value;if(!el||!el.clientWidth){return;}const expandOpts=computeExpandOpts.value;const rowOpts=computeRowOpts.value;const cellOpts=computeCellOpts.value;const defaultRowHeight=computeDefaultRowHeight.value;const{mode}=expandOpts;if(expandColumn&&mode==='fixed'){const{elemStore,fullAllDataRowIdData}=internalData;const rowExpandEl=refRowExpandElem.value;const bodyScrollElem=(0,_util.getRefElem)(elemStore['main-body-scroll']);if(rowExpandEl&&bodyScrollElem){let isUpdateHeight=false;_xeUtils.default.arrayEach(rowExpandEl.children,reEl=>{const expandEl=reEl;const rowid=expandEl.getAttribute('rowid')||'';const rowRest=fullAllDataRowIdData[rowid];if(rowRest){const expandHeight=expandEl.offsetHeight;const trEl=bodyScrollElem.querySelector(`.vxe-body--row[rowid="${rowid}"]`);let offsetTop=0;if(scrollYLoad){if(isScrollYBig&&trEl){offsetTop=trEl.offsetTop+trEl.offsetHeight;}else{offsetTop=rowRest.oTop+(rowRest.resizeHeight||cellOpts.height||rowOpts.height||rowRest.height||defaultRowHeight);}}else{if(trEl){offsetTop=trEl.offsetTop+trEl.offsetHeight;}}if(isScrollYBig){offsetTop+=scrollYTop;}expandEl.style.top=(0,_dom.toCssUnit)(offsetTop);if(!isUpdateHeight){if(rowRest.expandHeight!==expandHeight){isUpdateHeight=true;}}rowRest.expandHeight=expandHeight;}});if(isUpdateHeight){reactData.rowExpandHeightFlag++;(0,_vue.nextTick)(()=>{updateRowOffsetTop();});}}}};/**
|
|
254
254
|
* 更新树连接线样式
|
|
255
|
-
*/const updateTreeLineStyle=()=>{const{treeConfig}=props;if(!treeConfig){return;}const{tableData}=reactData;const{fullAllDataRowIdData,treeExpandedMaps}=internalData;const cellOpts=computeCellOpts.value;const rowOpts=computeRowOpts.value;const defaultRowHeight=computeDefaultRowHeight.value;const treeOpts=computeTreeOpts.value;const{transform,mapChildrenField}=treeOpts;const childrenField=treeOpts.children||treeOpts.childrenField;const{handleGetRowId}=(0,_util.createHandleGetRowId)($xeTable);const expParentList=[];const handleNodeRow=(row,rIndex,rows)=>{const rowid=handleGetRowId(row);const rowRest=fullAllDataRowIdData[rowid]||{};const childList=row[transform?mapChildrenField:childrenField];const prevRow=rows[rIndex-1]||null;const nextRow=rows[rIndex+1]||null;if(childList&&childList.length&&treeExpandedMaps[rowid]){expParentList.push({row,prevRow,nextRow});childList.forEach((childRow,crIndex)=>{const childRowid=handleGetRowId(childRow);if(treeExpandedMaps[childRowid]){handleNodeRow(childRow,crIndex,childList);}});}else{if(nextRow){const nextRowid=handleGetRowId(nextRow);const nextRowRest=fullAllDataRowIdData[nextRowid]||{};const currCellHeight=(0,_util.getCellRestHeight)(rowRest,cellOpts,rowOpts,defaultRowHeight);const nextCellHeight=(0,_util.getCellRestHeight)(nextRowRest,cellOpts,rowOpts,defaultRowHeight);rowRest.oHeight=currCellHeight;rowRest.lineHeight=Math.floor(currCellHeight/2+nextCellHeight/2);}else{rowRest.oHeight=0;rowRest.lineHeight=0;}}};tableData.forEach((row,rIndex)=>{handleNodeRow(row,rIndex,tableData);});_xeUtils.default.lastArrayEach(expParentList,({row,nextRow})=>{const rowid=handleGetRowId(row);const childList=row[transform?mapChildrenField:childrenField];const rowRest=fullAllDataRowIdData[rowid];if(rowRest){const currCellHeight=(0,_util.getCellRestHeight)(rowRest,cellOpts,rowOpts,defaultRowHeight);let countOffsetHeight=currCellHeight;let countLineHeight=0;childList.forEach(childRow=>{const childRowid=handleGetRowId(childRow);const childRowRest=fullAllDataRowIdData[childRowid]||{};const childList=childRow[transform?mapChildrenField:childrenField];if(treeExpandedMaps[childRowid]&&childList&&childList.length){countOffsetHeight+=childRowRest.oHeight||0;countLineHeight+=childRowRest.oHeight||0;}else{const cellHeight=(0,_util.getCellRestHeight)(childRowRest,cellOpts,rowOpts,defaultRowHeight);childRowRest.oHeight=cellHeight;childRowRest.lineHeight=cellHeight;countOffsetHeight+=cellHeight;countLineHeight+=cellHeight;}});if(nextRow){const nextRowid=handleGetRowId(nextRow);const nextRowRest=fullAllDataRowIdData[nextRowid]||{};const currCellHeight=(0,_util.getCellRestHeight)(rowRest,cellOpts,rowOpts,defaultRowHeight);const nextCellHeight=(0,_util.getCellRestHeight)(nextRowRest,cellOpts,rowOpts,defaultRowHeight);countOffsetHeight+=currCellHeight;countLineHeight+=Math.floor(currCellHeight/2+nextCellHeight/2);}rowRest.lineHeight=countLineHeight;rowRest.oHeight=countOffsetHeight;}});};const handleRowExpandScroll=()=>{const{elemStore}=internalData;const rowExpandEl=refRowExpandElem.value;const bodyScrollElem=(0,_util.getRefElem)(elemStore['main-body-scroll']);if(rowExpandEl&&bodyScrollElem){rowExpandEl.scrollTop=bodyScrollElem.scrollTop;}};const handleColumnVisible=visible=>{return function(fieldOrColumn){let status=false;const cols=_xeUtils.default.isArray(fieldOrColumn)?fieldOrColumn:[fieldOrColumn];cols.forEach(item=>{const column=(0,_util.handleFieldOrColumn)($xeTable,item);if(column){if(column.children&&column.children.length){_xeUtils.default.eachTree([column],item=>{item.visible=visible;item.renderVisible=visible;});}else{column.visible=visible;column.renderVisible=visible;}if(!status){status=true;}}});if(status){return $xeTable.handleCustom();}return(0,_vue.nextTick)();};};tableMethods={dispatchEvent,getEl(){return refElem.value;},/**
|
|
255
|
+
*/const updateTreeLineStyle=()=>{const{treeConfig}=props;if(!treeConfig){return;}const{tableData}=reactData;const{fullAllDataRowIdData,treeExpandedMaps}=internalData;const el=refElem.value;if(!el||!el.clientWidth){return;}const cellOpts=computeCellOpts.value;const rowOpts=computeRowOpts.value;const defaultRowHeight=computeDefaultRowHeight.value;const treeOpts=computeTreeOpts.value;const{transform,mapChildrenField}=treeOpts;const childrenField=treeOpts.children||treeOpts.childrenField;const{handleGetRowId}=(0,_util.createHandleGetRowId)($xeTable);const expParentList=[];const handleNodeRow=(row,rIndex,rows)=>{const rowid=handleGetRowId(row);const rowRest=fullAllDataRowIdData[rowid]||{};const childList=row[transform?mapChildrenField:childrenField];const prevRow=rows[rIndex-1]||null;const nextRow=rows[rIndex+1]||null;if(childList&&childList.length&&treeExpandedMaps[rowid]){expParentList.push({row,prevRow,nextRow});childList.forEach((childRow,crIndex)=>{const childRowid=handleGetRowId(childRow);if(treeExpandedMaps[childRowid]){handleNodeRow(childRow,crIndex,childList);}});}else{if(nextRow){const nextRowid=handleGetRowId(nextRow);const nextRowRest=fullAllDataRowIdData[nextRowid]||{};const currCellHeight=(0,_util.getCellRestHeight)(rowRest,cellOpts,rowOpts,defaultRowHeight);const nextCellHeight=(0,_util.getCellRestHeight)(nextRowRest,cellOpts,rowOpts,defaultRowHeight);rowRest.oHeight=currCellHeight;rowRest.lineHeight=Math.floor(currCellHeight/2+nextCellHeight/2);}else{rowRest.oHeight=0;rowRest.lineHeight=0;}}};tableData.forEach((row,rIndex)=>{handleNodeRow(row,rIndex,tableData);});_xeUtils.default.lastArrayEach(expParentList,({row,nextRow})=>{const rowid=handleGetRowId(row);const childList=row[transform?mapChildrenField:childrenField];const rowRest=fullAllDataRowIdData[rowid];if(rowRest){const currCellHeight=(0,_util.getCellRestHeight)(rowRest,cellOpts,rowOpts,defaultRowHeight);let countOffsetHeight=currCellHeight;let countLineHeight=0;childList.forEach(childRow=>{const childRowid=handleGetRowId(childRow);const childRowRest=fullAllDataRowIdData[childRowid]||{};const childList=childRow[transform?mapChildrenField:childrenField];if(treeExpandedMaps[childRowid]&&childList&&childList.length){countOffsetHeight+=childRowRest.oHeight||0;countLineHeight+=childRowRest.oHeight||0;}else{const cellHeight=(0,_util.getCellRestHeight)(childRowRest,cellOpts,rowOpts,defaultRowHeight);childRowRest.oHeight=cellHeight;childRowRest.lineHeight=cellHeight;countOffsetHeight+=cellHeight;countLineHeight+=cellHeight;}});if(nextRow){const nextRowid=handleGetRowId(nextRow);const nextRowRest=fullAllDataRowIdData[nextRowid]||{};const currCellHeight=(0,_util.getCellRestHeight)(rowRest,cellOpts,rowOpts,defaultRowHeight);const nextCellHeight=(0,_util.getCellRestHeight)(nextRowRest,cellOpts,rowOpts,defaultRowHeight);countOffsetHeight+=currCellHeight;countLineHeight+=Math.floor(currCellHeight/2+nextCellHeight/2);}rowRest.lineHeight=countLineHeight;rowRest.oHeight=countOffsetHeight;}});};const handleRowExpandScroll=()=>{const{elemStore}=internalData;const rowExpandEl=refRowExpandElem.value;const bodyScrollElem=(0,_util.getRefElem)(elemStore['main-body-scroll']);if(rowExpandEl&&bodyScrollElem){rowExpandEl.scrollTop=bodyScrollElem.scrollTop;}};const handleColumnVisible=visible=>{return function(fieldOrColumn){let status=false;const cols=_xeUtils.default.isArray(fieldOrColumn)?fieldOrColumn:[fieldOrColumn];cols.forEach(item=>{const column=(0,_util.handleFieldOrColumn)($xeTable,item);if(column){if(column.children&&column.children.length){_xeUtils.default.eachTree([column],item=>{item.visible=visible;item.renderVisible=visible;});}else{column.visible=visible;column.renderVisible=visible;}if(!status){status=true;}}});if(status){return $xeTable.handleCustom();}return(0,_vue.nextTick)();};};tableMethods={dispatchEvent,getEl(){return refElem.value;},/**
|
|
256
256
|
* 重置表格的一切数据状态
|
|
257
257
|
*/clearAll(){return(0,_util.clearTableAllStatus)($xeTable);},/**
|
|
258
258
|
* 同步 data 数据(即将废弃)
|
|
@@ -518,7 +518,7 @@ return $xeTable.reloadTreeExpand(row);},/**
|
|
|
518
518
|
*/toggleTreeExpand(row){return $xeTable.setTreeExpand(row,!$xeTable.isTreeExpandByRow(row));},/**
|
|
519
519
|
* 设置所有树节点的展开与否
|
|
520
520
|
* @param {Boolean} expanded 是否展开
|
|
521
|
-
*/setAllTreeExpand(expanded){const{
|
|
521
|
+
*/setAllTreeExpand(expanded){const{tableFullTreeData}=internalData;const treeOpts=computeTreeOpts.value;const{transform,lazy}=treeOpts;const childrenField=treeOpts.children||treeOpts.childrenField;const expandeds=[];_xeUtils.default.eachTree(tableFullTreeData,row=>{const rowChildren=row[childrenField];if(lazy||rowChildren&&rowChildren.length){expandeds.push(row);}},{children:childrenField});return $xeTable.setTreeExpand(expandeds,expanded).then(()=>{if(transform){handleVirtualTreeToList();reactData.treeExpandedFlag++;return $xeTable.recalculate();}});},/**
|
|
522
522
|
* 设置展开树形节点,二个参数设置这一行展开与否
|
|
523
523
|
* 支持单行
|
|
524
524
|
* 支持多行
|
|
@@ -752,7 +752,7 @@ if((0,_utils.isEnableConf)(editConfig)&&editOpts.trigger==='dblclick'){if(active
|
|
|
752
752
|
* 多选,选中所有事件
|
|
753
753
|
*/triggerCheckAllEvent(evnt,value){const checkboxOpts=computeCheckboxOpts.value;const{trigger}=checkboxOpts;if(trigger==='manual'){return;}if(evnt){evnt.stopPropagation();}handleCheckAllEvent(evnt,value);},/**
|
|
754
754
|
* 单选,行选中事件
|
|
755
|
-
*/triggerRadioRowEvent(evnt,params){const{selectRadioRow:oldValue}=reactData;const{row}=params;const radioOpts=computeRadioOpts.value;const{trigger,strict,checkMethod}=radioOpts;if(trigger==='manual'){return;}evnt.stopPropagation();if(!checkMethod||checkMethod({$table:$xeTable,row})){let newValue=row;let isChange=oldValue!==newValue;if(strict){handleCheckedRadioRow(newValue);}else{if(oldValue===newValue){newValue=null;}isChange=oldValue!==newValue;if(isChange&&newValue){handleCheckedRadioRow(newValue);}else{newValue=null;$xeTable.clearRadioRow();}}if(isChange){dispatchEvent('radio-change',Object.assign({oldValue,newValue,selected:!!newValue},params),evnt);}}},triggerCurrentColumnEvent(evnt,params){const{currentColumn:oldValue}=reactData;const columnOpts=computeColumnOpts.value;const currentColumnOpts=computeCurrentColumnOpts.value;const beforeRowMethod=currentColumnOpts.beforeSelectMethod||columnOpts.currentMethod;let newValue=params.column;const{trigger,strict}=currentColumnOpts;if(trigger==='manual'){return;}let isChange=oldValue!==newValue;if(!beforeRowMethod||beforeRowMethod({column:newValue,$table:$xeTable})){if(strict){$xeTable.setCurrentColumn(newValue);}else{if(oldValue===newValue){newValue=null;}isChange=oldValue!==newValue;if(isChange&&newValue){$xeTable.setCurrentColumn(newValue);}else{newValue=null;$xeTable.clearCurrentColumn();}}if(isChange){dispatchEvent('current-column-change',Object.assign({oldValue,newValue,selected:!!newValue},params),evnt);}}else{dispatchEvent('current-column-disabled',params,evnt);}},triggerCurrentRowEvent(evnt,params){const{currentRow:oldValue}=internalData;const rowOpts=computeRowOpts.value;const currentRowOpts=computeCurrentRowOpts.value;const beforeRowMethod=currentRowOpts.beforeSelectMethod||rowOpts.currentMethod;let{row:newValue}=params;const{trigger,strict}=currentRowOpts;if(trigger==='manual'){return;}let isChange=oldValue!==newValue;if(!beforeRowMethod||beforeRowMethod({row:newValue,$table:$xeTable})){if(strict){$xeTable.setCurrentRow(newValue);}else{if(oldValue===newValue){newValue=null;}isChange=oldValue!==newValue;if(isChange&&newValue){$xeTable.setCurrentRow(newValue);}else{newValue=null;$xeTable.clearCurrentRow();}}if(isChange){dispatchEvent('current-row-change',Object.assign({oldValue,newValue,selected:!!newValue},params),evnt);// 已废弃
|
|
755
|
+
*/triggerRadioRowEvent(evnt,params){const{selectRadioRow:oldValue}=reactData;const{row}=params;const radioOpts=computeRadioOpts.value;const{trigger,strict,checkMethod}=radioOpts;if(trigger==='manual'){return;}evnt.stopPropagation();if(!checkMethod||checkMethod({$table:$xeTable,row})){let newValue=row;let isChange=oldValue!==newValue;if(strict){handleCheckedRadioRow(newValue,false);}else{if(oldValue===newValue){newValue=null;}isChange=oldValue!==newValue;if(isChange&&newValue){handleCheckedRadioRow(newValue,false);}else{newValue=null;$xeTable.clearRadioRow();}}if(isChange){dispatchEvent('radio-change',Object.assign({oldValue,newValue,selected:!!newValue},params),evnt);}}},triggerCurrentColumnEvent(evnt,params){const{currentColumn:oldValue}=reactData;const columnOpts=computeColumnOpts.value;const currentColumnOpts=computeCurrentColumnOpts.value;const beforeRowMethod=currentColumnOpts.beforeSelectMethod||columnOpts.currentMethod;let newValue=params.column;const{trigger,strict}=currentColumnOpts;if(trigger==='manual'){return;}let isChange=oldValue!==newValue;if(!beforeRowMethod||beforeRowMethod({column:newValue,$table:$xeTable})){if(strict){$xeTable.setCurrentColumn(newValue);}else{if(oldValue===newValue){newValue=null;}isChange=oldValue!==newValue;if(isChange&&newValue){$xeTable.setCurrentColumn(newValue);}else{newValue=null;$xeTable.clearCurrentColumn();}}if(isChange){dispatchEvent('current-column-change',Object.assign({oldValue,newValue,selected:!!newValue},params),evnt);}}else{dispatchEvent('current-column-disabled',params,evnt);}},triggerCurrentRowEvent(evnt,params){const{currentRow:oldValue}=internalData;const rowOpts=computeRowOpts.value;const currentRowOpts=computeCurrentRowOpts.value;const beforeRowMethod=currentRowOpts.beforeSelectMethod||rowOpts.currentMethod;let{row:newValue}=params;const{trigger,strict}=currentRowOpts;if(trigger==='manual'){return;}let isChange=oldValue!==newValue;if(!beforeRowMethod||beforeRowMethod({row:newValue,$table:$xeTable})){if(strict){$xeTable.setCurrentRow(newValue);}else{if(oldValue===newValue){newValue=null;}isChange=oldValue!==newValue;if(isChange&&newValue){$xeTable.setCurrentRow(newValue);}else{newValue=null;$xeTable.clearCurrentRow();}}if(isChange){dispatchEvent('current-row-change',Object.assign({oldValue,newValue,selected:!!newValue},params),evnt);// 已废弃
|
|
756
756
|
dispatchEvent('current-change',Object.assign({oldValue,newValue},params),evnt);}}else{dispatchEvent('current-row-disabled',params,evnt);}},/**
|
|
757
757
|
* 展开行事件
|
|
758
758
|
*/triggerRowExpandEvent(evnt,params){const{expandColumn}=reactData;const{rowExpandLazyLoadedMaps}=internalData;const expandOpts=computeExpandOpts.value;const{row}=params;const{lazy,trigger}=expandOpts;if(trigger==='manual'){return;}evnt.stopPropagation();const rowid=(0,_util.getRowid)($xeTable,row);if(!lazy||!rowExpandLazyLoadedMaps[rowid]){const expanded=!$xeTable.isRowExpandByRow(row);const columnIndex=expandColumn?$xeTable.getColumnIndex(expandColumn):-1;const $columnIndex=expandColumn?$xeTable.getVMColumnIndex(expandColumn):-1;$xeTable.setRowExpand(row,expanded);dispatchEvent('toggle-row-expand',{expanded,column:expandColumn,columnIndex,$columnIndex,row,rowIndex:$xeTable.getRowIndex(row),$rowIndex:$xeTable.getVMRowIndex(row)},evnt);}},/**
|