tomtaw-vxe-table 3.25.11 → 3.25.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/style.css +1 -1
- package/es/table/src/methods.js +400 -1
- package/es/table/src/table.js +17 -2
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/lib/index.umd.js +27 -6
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/table/src/methods.js +15 -3
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/table.js +10 -1
- package/lib/table/src/table.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/table/src/methods.ts +429 -1
- package/packages/table/src/table.ts +22 -8
- package/types/all.d.ts +9 -0
- /package/es/{iconfont.1792397764735.ttf → iconfont.1792648484860.ttf} +0 -0
- /package/es/{iconfont.1792397764735.woff → iconfont.1792648484860.woff} +0 -0
- /package/es/{iconfont.1792397764735.woff2 → iconfont.1792648484860.woff2} +0 -0
- /package/lib/{iconfont.1792397764735.ttf → iconfont.1792648484860.ttf} +0 -0
- /package/lib/{iconfont.1792397764735.woff → iconfont.1792648484860.woff} +0 -0
- /package/lib/{iconfont.1792397764735.woff2 → iconfont.1792648484860.woff2} +0 -0
package/lib/table/src/methods.js
CHANGED
|
@@ -70,7 +70,17 @@ let renderColumnList=tableColumn;const isOptimizeMode=isHeaderRenderOptimize;if(
|
|
|
70
70
|
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`;}// 如果是固定列
|
|
71
71
|
if(fixedWrapperElem){if(wrapperElem){wrapperElem.style.top=`${tHeaderHeight}px`;}fixedWrapperElem.style.height=`${customHeight>0?customHeight:tableHeight+tHeaderHeight+tFooterHeight+osbHeight}px`;fixedWrapperElem.style.width=`${fixedColumn.reduce((previous,column)=>previous+column.renderWidth,0)}px`;}let renderColumnList=tableColumn;const isOptimizeMode=isBodyRenderOptimize;if(fixedType){renderColumnList=visibleColumn;if(isOptimizeMode){renderColumnList=fixedColumn||[];}}const tWidth=renderColumnList.reduce((previous,column)=>previous+column.renderWidth,0);if(fixedType){if(isOptimizeMode){if(wrapperElem){wrapperElem.style.width=tWidth?`${tWidth}px`:'';}}else{if(wrapperElem){wrapperElem.style.width=scrollXWidth?`${scrollXWidth}px`:'';}}}if(tableElem){tableElem.style.width=tWidth?`${tWidth}px`:'';// 兼容性处理
|
|
72
72
|
tableElem.style.paddingRight=osbWidth&&fixedType&&(browseObj.firefox||browseObj.safari)?`${osbWidth}px`:'';}const emptyBlockElem=(0,_util.getRefElem)(elemStore[`${name}-${layout}-emptyBlock`]);if(emptyBlockElem){emptyBlockElem.style.width=tWidth?`${tWidth}px`:'';}}else if(layout==='footer'){let renderColumnList=tableColumn;const isOptimizeMode=isFooterRenderOptimize;if(!isOptimizeMode||!isColLoading&&(fixedType||!overflowX)){renderColumnList=visibleColumn;}if(fixedType){if(isOptimizeMode){renderColumnList=fixedColumn||[];}}const tWidth=renderColumnList.reduce((previous,column)=>previous+column.renderWidth,0);if(fixedType){if(isOptimizeMode){if(wrapperElem){wrapperElem.style.width=tWidth?`${tWidth}px`:'';}}else{if(wrapperElem){wrapperElem.style.width=scrollXWidth?`${scrollXWidth}px`:'';}}}if(currScrollElem){currScrollElem.style.height=`${tFooterHeight}px`;// 如果是固定列
|
|
73
|
-
if(fixedWrapperElem){if(wrapperElem){wrapperElem.style.top=`${customHeight>0?customHeight-tFooterHeight-osbHeight:tableHeight+tHeaderHeight}px`;}}}if(tableElem){tableElem.style.width=tWidth?`${tWidth}px`:'';}}});});if(currentRow){$xeTable.setCurrentRow(currentRow);}if((0,_utils.hasEnableConf)(mouseConfig,mouseOpts)&&mouseOpts.selected&&editStore.selected.row&&editStore.selected.column){$xeTable.addCellSelectedClass();}if($xeGanttView&&$xeGanttView.handleUpdateStyle){$xeGanttView.handleUpdateStyle();}return $xeTable.$nextTick();}function
|
|
73
|
+
if(fixedWrapperElem){if(wrapperElem){wrapperElem.style.top=`${customHeight>0?customHeight-tFooterHeight-osbHeight:tableHeight+tHeaderHeight}px`;}}}if(tableElem){tableElem.style.width=tWidth?`${tWidth}px`:'';}}});});if(currentRow){$xeTable.setCurrentRow(currentRow);}if((0,_utils.hasEnableConf)(mouseConfig,mouseOpts)&&mouseOpts.selected&&editStore.selected.row&&editStore.selected.column){$xeTable.addCellSelectedClass();}if($xeGanttView&&$xeGanttView.handleUpdateStyle){$xeGanttView.handleUpdateStyle();}return $xeTable.$nextTick();}/** 仅供显式开启的独立路径使用;不缓存尺寸或延迟写入。 */function setLayoutStyle(element,name,value){const style=element.style;if(style[name]===value){// 原 setter 会清除 !important;值相同但优先级不同时仍必须写入。
|
|
74
|
+
const cssName=name.replace(/[A-Z]/g,word=>`-${word.toLowerCase()}`);if(!style.getPropertyPriority(cssName))return;}style[name]=value;}function updateStyleWithDedupe($xeTable){const props=$xeTable;const reactData=$xeTable;const internalData=$xeTable;const $xeGantt=$xeTable.$xeGantt;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=$xeTable.$refs.refElem;if(!el||internalData.tBodyHeight&&!el.clientHeight){return;}const browseObj=_xeUtils.default.browse();const containerList=['main','left','right'];const{leftList,rightList}=columnStore;let osbWidth=overflowY?scrollbarWidth:0;let osbHeight=overflowX?scrollbarHeight:0;const emptyPlaceholderElem=$xeTable.$refs.refEmptyPlaceholder;const isHeaderRenderOptimize=$xeTable.computeIsHeaderRenderOptimize;const isBodyRenderOptimize=$xeTable.computeIsBodyRenderOptimize;const isFooterRenderOptimize=$xeTable.computeIsFooterRenderOptimize;const mouseOpts=$xeTable.computeMouseOpts;const bodyWrapperElem=(0,_util.getRefElem)(elemStore['main-body-wrapper']);const bodyTableElem=(0,_util.getRefElem)(elemStore['main-body-table']);if(emptyPlaceholderElem){setLayoutStyle(emptyPlaceholderElem,'top',`${tHeaderHeight}px`);setLayoutStyle(emptyPlaceholderElem,'height',bodyWrapperElem?`${bodyWrapperElem.offsetHeight-osbHeight}px`:'');}const scrollXVisible=$xeTable.computeScrollXVisible;const scrollYVisible=$xeTable.computeScrollYVisible;const scrollbarYToLeft=$xeTable.computeScrollbarYToLeft;let xScrollbarVisible=overflowX?'visible':'hidden';const hideXScroll=scrollXVisible===false||scrollXVisible==='hidden';if(scrollXVisible==='visible'||$xeGanttView){osbHeight=scrollbarHeight;xScrollbarVisible='visible';}else if(hideXScroll){osbHeight=0;xScrollbarVisible='hidden';}let yScrollbarVisible=overflowY?'visible':'hidden';const hideYScroll=scrollYVisible===false||scrollYVisible==='hidden';if(hideYScroll||$xeGantt&&$xeGanttView&&$xeGantt.reactData.showRightView&&!scrollbarYToLeft){osbWidth=0;yScrollbarVisible='hidden';}else if(scrollYVisible==='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=$xeTable.$refs.refScrollXLeftCornerElem;const xRightCornerEl=$xeTable.$refs.refScrollXRightCornerElem;const scrollXVirtualEl=$xeTable.$refs.refScrollXVirtualElem;if(scrollXVirtualEl){setLayoutStyle(scrollXVirtualEl,'height',`${osbHeight}px`);setLayoutStyle(scrollXVirtualEl,'visibility',xScrollbarVisible);}const xWrapperEl=$xeTable.$refs.refScrollXWrapperElem;if(xWrapperEl){setLayoutStyle(xWrapperEl,'width',`${el.clientWidth-osbWidth}px`);if(scrollbarYToLeft){setLayoutStyle(xWrapperEl,'left',`${osbWidth}px`);}else{setLayoutStyle(xWrapperEl,'left','');}}if(xLeftCornerEl){if(scrollbarYToLeft){setLayoutStyle(xLeftCornerEl,'width',`${osbWidth}px`);setLayoutStyle(xLeftCornerEl,'display',overflowY&&osbWidth?'block':'');}else{setLayoutStyle(xLeftCornerEl,'display','');}}if(xRightCornerEl){if(scrollbarYToLeft){setLayoutStyle(xRightCornerEl,'display','');}else{setLayoutStyle(xRightCornerEl,'width',`${osbWidth}px`);setLayoutStyle(xRightCornerEl,'display',xScrollbarVisible==='visible'?'block':'');}}const scrollYVirtualEl=$xeTable.$refs.refScrollYVirtualElem;if(scrollYVirtualEl){setLayoutStyle(scrollYVirtualEl,'width',`${osbWidth}px`);setLayoutStyle(scrollYVirtualEl,'height',`${tbHeight+tHeaderHeight+tFooterHeight}px`);setLayoutStyle(scrollYVirtualEl,'visibility',yScrollbarVisible);}const yTopCornerEl=$xeTable.$refs.refScrollYTopCornerElem;if(yTopCornerEl){setLayoutStyle(yTopCornerEl,'height',`${tHeaderHeight}px`);setLayoutStyle(yTopCornerEl,'display',tHeaderHeight&&yScrollbarVisible==='visible'?'block':'');}const yWrapperEl=$xeTable.$refs.refScrollYWrapperElem;if(yWrapperEl){setLayoutStyle(yWrapperEl,'height',`${tbHeight}px`);setLayoutStyle(yWrapperEl,'top',`${tHeaderHeight}px`);}const yBottomCornerEl=$xeTable.$refs.refScrollYBottomCornerElem;if(yBottomCornerEl){setLayoutStyle(yBottomCornerEl,'height',`${tFooterHeight}px`);setLayoutStyle(yBottomCornerEl,'top',`${tHeaderHeight+tbHeight}px`);setLayoutStyle(yBottomCornerEl,'display',tFooterHeight&&yScrollbarVisible==='visible'?'block':'');}const rowExpandEl=$xeTable.$refs.refRowExpandElem;if(rowExpandEl){setLayoutStyle(rowExpandEl,'height',`${tbHeight}px`);setLayoutStyle(rowExpandEl,'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?$xeTable.$refs.refLeftContainer:$xeTable.$refs.refRightContainer;}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'){// 表头体样式处理
|
|
75
|
+
// 横向滚动渲染
|
|
76
|
+
let renderColumnList=tableColumn;const isOptimizeMode=isHeaderRenderOptimize;if(isGroup){renderColumnList=visibleColumn;}else{if(!isOptimizeMode||!isColLoading&&(fixedType||!overflowX)){renderColumnList=visibleColumn;}if(fixedType){// 如果是使用优化模式
|
|
77
|
+
if(isOptimizeMode){renderColumnList=fixedColumn||[];}}}const tWidth=renderColumnList.reduce((previous,column)=>previous+column.renderWidth,0);if(fixedType){if(isGroup){if(wrapperElem){setLayoutStyle(wrapperElem,'width',scrollXWidth?`${scrollXWidth}px`:'');}}else{if(isOptimizeMode){if(wrapperElem){setLayoutStyle(wrapperElem,'width',tWidth?`${tWidth}px`:'');}}else{if(wrapperElem){setLayoutStyle(wrapperElem,'width',scrollXWidth?`${scrollXWidth}px`:'');}}}}if(currScrollElem){setLayoutStyle(currScrollElem,'height',`${tHeaderHeight}px`);}if(tableElem){setLayoutStyle(tableElem,'width',tWidth?`${tWidth}px`:'');}}else if(layout==='body'){if(currScrollElem){setLayoutStyle(currScrollElem,'maxHeight',customMaxHeight?`${bodyMaxHeight}px`:'');setLayoutStyle(currScrollElem,'height',customHeight?`${tbHeight}px`:'');setLayoutStyle(currScrollElem,'minHeight',`${bodyMinHeight}px`);}// 如果是固定列
|
|
78
|
+
if(fixedWrapperElem){if(wrapperElem){setLayoutStyle(wrapperElem,'top',`${tHeaderHeight}px`);}setLayoutStyle(fixedWrapperElem,'height',`${customHeight>0?customHeight:tableHeight+tHeaderHeight+tFooterHeight+osbHeight}px`);setLayoutStyle(fixedWrapperElem,'width',`${fixedColumn.reduce((previous,column)=>previous+column.renderWidth,0)}px`);}let renderColumnList=tableColumn;const isOptimizeMode=isBodyRenderOptimize;if(fixedType){renderColumnList=visibleColumn;if(isOptimizeMode){renderColumnList=fixedColumn||[];}}const tWidth=renderColumnList.reduce((previous,column)=>previous+column.renderWidth,0);if(fixedType){if(isOptimizeMode){if(wrapperElem){setLayoutStyle(wrapperElem,'width',tWidth?`${tWidth}px`:'');}}else{if(wrapperElem){setLayoutStyle(wrapperElem,'width',scrollXWidth?`${scrollXWidth}px`:'');}}}if(tableElem){setLayoutStyle(tableElem,'width',tWidth?`${tWidth}px`:'');// 兼容性处理
|
|
79
|
+
setLayoutStyle(tableElem,'paddingRight',osbWidth&&fixedType&&(browseObj.firefox||browseObj.safari)?`${osbWidth}px`:'');}const emptyBlockElem=(0,_util.getRefElem)(elemStore[`${name}-${layout}-emptyBlock`]);if(emptyBlockElem){setLayoutStyle(emptyBlockElem,'width',tWidth?`${tWidth}px`:'');}}else if(layout==='footer'){let renderColumnList=tableColumn;const isOptimizeMode=isFooterRenderOptimize;if(!isOptimizeMode||!isColLoading&&(fixedType||!overflowX)){renderColumnList=visibleColumn;}if(fixedType){if(isOptimizeMode){renderColumnList=fixedColumn||[];}}const tWidth=renderColumnList.reduce((previous,column)=>previous+column.renderWidth,0);if(fixedType){if(isOptimizeMode){if(wrapperElem){setLayoutStyle(wrapperElem,'width',tWidth?`${tWidth}px`:'');}}else{if(wrapperElem){setLayoutStyle(wrapperElem,'width',scrollXWidth?`${scrollXWidth}px`:'');}}}if(currScrollElem){setLayoutStyle(currScrollElem,'height',`${tFooterHeight}px`);// 如果是固定列
|
|
80
|
+
if(fixedWrapperElem){if(wrapperElem){setLayoutStyle(wrapperElem,'top',`${customHeight>0?customHeight-tFooterHeight-osbHeight:tableHeight+tHeaderHeight}px`);}}}if(tableElem){setLayoutStyle(tableElem,'width',tWidth?`${tWidth}px`:'');}}});});if(currentRow){$xeTable.setCurrentRow(currentRow);}if((0,_utils.hasEnableConf)(mouseConfig,mouseOpts)&&mouseOpts.selected&&editStore.selected.row&&editStore.selected.column){$xeTable.addCellSelectedClass();}if($xeGanttView&&$xeGanttView.handleUpdateStyle){$xeGanttView.handleUpdateStyle();}return $xeTable.$nextTick();}function updateScrollXSpaceWithDedupe($xeTable){const reactData=$xeTable;const internalData=$xeTable;const{scrollXLoad,overflowX,scrollXWidth}=reactData;const{visibleColumn,scrollXStore,elemStore,fullColumnIdData}=internalData;const $xeGanttView=internalData.xeGanttView;const mouseOpts=$xeTable.computeMouseOpts;const tableBody=$xeTable.$refs.refTableBody;const tableBodyElem=tableBody?tableBody.$el:null;if(tableBodyElem){const bodyScrollElem=(0,_util.getRefElem)(elemStore['main-body-scroll']);const bodyTableElem=(0,_util.getRefElem)(elemStore['main-body-table']);const headerTableElem=(0,_util.getRefElem)(elemStore['main-header-table']);const footerTableElem=(0,_util.getRefElem)(elemStore['main-footer-table']);let xSpaceLeft=0;const firstColumn=visibleColumn[scrollXStore.startIndex];if(firstColumn){const colRest=fullColumnIdData[firstColumn.id]||{};xSpaceLeft=colRest.oLeft;}let clientWidth=0;if(bodyScrollElem){clientWidth=bodyScrollElem.clientWidth;}// 虚拟渲染
|
|
81
|
+
let isScrollXBig=false;let ySpaceWidth=scrollXWidth;if(scrollXWidth>maxXWidth){// 触右
|
|
82
|
+
if(bodyScrollElem&&bodyTableElem&&bodyScrollElem.scrollLeft+clientWidth>=maxXWidth){xSpaceLeft=maxXWidth-bodyTableElem.clientWidth;}else{xSpaceLeft=(maxXWidth-clientWidth)*(xSpaceLeft/(scrollXWidth-clientWidth));}ySpaceWidth=maxXWidth;isScrollXBig=true;}if(!(scrollXLoad&&overflowX)){xSpaceLeft=0;}if(getConfig().scrollMarginStyle){// 已废弃方式
|
|
83
|
+
if(headerTableElem){setLayoutStyle(headerTableElem,'marginLeft',headerTableElem.getAttribute('xvm')?`${xSpaceLeft}px`:'');}if(bodyTableElem){setLayoutStyle(bodyTableElem,'marginLeft',`${xSpaceLeft}px`);}if(footerTableElem){setLayoutStyle(footerTableElem,'marginLeft',footerTableElem.getAttribute('xvm')?`${xSpaceLeft}px`:'');}}else{if(headerTableElem){setLayoutStyle(headerTableElem,'transform',headerTableElem.getAttribute('xvm')?`translate(${xSpaceLeft}px, 0px)`:'');}if(bodyTableElem){setLayoutStyle(bodyTableElem,'transform',`translate(${xSpaceLeft}px, ${reactData.scrollYTop||0}px)`);}if(footerTableElem){setLayoutStyle(footerTableElem,'transform',footerTableElem.getAttribute('xvm')?`translate(${xSpaceLeft}px, 0px)`:'');}}const containerList=['main'];containerList.forEach(name=>{const layoutList=['header','body','footer'];layoutList.forEach(layout=>{const xSpaceElem=(0,_util.getRefElem)(elemStore[`${name}-${layout}-xSpace`]);if(xSpaceElem){setLayoutStyle(xSpaceElem,'width',scrollXLoad?`${ySpaceWidth}px`:'');}});});reactData.scrollXLeft=xSpaceLeft;reactData.scrollXWidth=ySpaceWidth;reactData.isScrollXBig=isScrollXBig;const scrollXSpaceEl=$xeTable.$refs.refScrollXSpaceElem;if(scrollXSpaceEl){setLayoutStyle(scrollXSpaceEl,'width',`${ySpaceWidth}px`);}calcScrollbar($xeTable);if(isScrollXBig&&mouseOpts.area){errLog('vxe.error.notProp',['mouse-config.area']);}if($xeGanttView&&$xeGanttView.handleUpdateSXSpace){$xeGanttView.handleUpdateSXSpace();}return $xeTable.$nextTick(()=>{updateStyleWithDedupe($xeTable);});}}function checkValidate($xeTable,type){if($xeTable.triggerValidate){return $xeTable.triggerValidate(type);}return $xeTable.$nextTick();}/**
|
|
74
84
|
* 当单元格发生改变时
|
|
75
85
|
* 如果存在规则,则校验
|
|
76
86
|
*/function handleChangeCell($xeTable,evnt,params){checkValidate($xeTable,'blur').catch(e=>e).then(()=>{$xeTable.handleEdit(params,evnt).then(()=>checkValidate($xeTable,'change')).catch(e=>e);});}function handleDefaultSort($xeTable){const props=$xeTable;const{sortConfig}=props;if(sortConfig){const sortOpts=$xeTable.computeSortOpts;let{defaultSort}=sortOpts;if(defaultSort){if(!_xeUtils.default.isArray(defaultSort)){defaultSort=[defaultSort];}if(defaultSort.length){(sortConfig.multiple?defaultSort:defaultSort.slice(0,1)).forEach((item,index)=>{const{field,order}=item;if(field&&order){const column=$xeTable.getColumnByField(field);if(column&&column.sortable){column.order=order;column.sortTime=Date.now()+index;}}});if(!sortOpts.remote){$xeTable.handleTableData(true).then(updateStyle);}}}}}/**
|
|
@@ -242,7 +252,8 @@ if(props.spanMethod){warnLog('vxe.error.scrollErrProp',['span-method']);}if(prop
|
|
|
242
252
|
// 如果列被设置为固定,则清除合并状态
|
|
243
253
|
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($xeTable);handleUpdateAggValues($xeTable);if(isReset){return $xeTable.updateFooter().then(()=>{return $xeTable.recalculate();}).then(()=>{$xeTable.updateCellAreas();return $xeTable.recalculate();});}return $xeTable.updateFooter();}function initColumnHierarchy($xeTable){const internalData=$xeTable;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]){errLog('vxe.error.colRepet',['field',field]);}fullColFieldData[field]=rest;}fullColIdData[colid]=rest;});internalData.fullColumnIdData=fullColIdData;internalData.fullColumnFieldData=fullColFieldData;}function buildColumnInfo($xeTable){const props=$xeTable;const $xeToolbar=$xeTable.$refs.$xeToolbar;const reactData=$xeTable;const internalData=$xeTable;const{scrollXLoad,scrollYLoad,expandColumn}=reactData;const expandOpts=$xeTable.computeExpandOpts;cacheColumnMap($xeTable);parseColumns($xeTable,true).then(()=>{if(reactData.scrollXLoad){loadScrollXData($xeTable);}});$xeTable.clearHeaderFormatterCache();$xeTable.clearMergeCells();$xeTable.clearMergeFooterItems();$xeTable.handleTableData(true);$xeTable.handleAggregateSummaryData();if((scrollXLoad||scrollYLoad)&&expandColumn&&expandOpts.mode!=='fixed'){warnLog('vxe.error.scrollErrProp',['column.type=expand']);}return $xeTable.$nextTick().then(()=>{if($xeToolbar){$xeToolbar.syncUpdate({collectColumn:internalData.collectColumn,$table:$xeTable});}if($xeTable.handleUpdateCustomColumn){$xeTable.handleUpdateCustomColumn();}const columnOpts=$xeTable.computeColumnOpts;if(props.showCustomHeader&&reactData.isGroup&&(columnOpts.resizable||props.resizable)){warnLog('vxe.error.notConflictProp',['show-custom-header & colgroup','column-config.resizable=false']);}reactData.isColLoading=false;return handleLazyRecalculate($xeTable,false,true,true);});}function handleInitColumn($xeTable,collectColumn){const reactData=$xeTable;const internalData=$xeTable;internalData.collectColumn=collectColumn;const tFullColumn=(0,_util.getColumnList)(collectColumn);internalData.tableFullColumn=tFullColumn;reactData.updateColFlag++;reactData.isColLoading=true;initColumnHierarchy($xeTable);return Promise.resolve(restoreCustomStorage($xeTable)).then(()=>{return buildColumnInfo($xeTable);});}/**
|
|
244
254
|
* 纵向 Y 可视渲染处理
|
|
245
|
-
*/function loadScrollYData($xeTable){const reactData=$xeTable;const internalData=$xeTable;const{isAllOverflow,isScrollYBig}=reactData;const{mergeBodyList,mergeBodyRowMaps,scrollYStore}=internalData;const{preloadSize,startIndex,endIndex,offsetSize}=scrollYStore;const autoOffsetYSize=isAllOverflow?offsetSize:offsetSize+1;const{toVisibleIndex,visibleSize}=handleVirtualYVisible($xeTable);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,mergeBodyRowMaps,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 $xeTable=this;const internalData=$xeTable;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 $xeTable=this;const internalData=$xeTable;const{fullColumnIdData}=internalData;if(column){const colRest=fullColumnIdData[column.id];if(colRest){return colRest[prop];}}return-1;};};function lazyScrollXData($xeTable){const internalData=$xeTable;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($xeTable);}internalData.lxTimeout=setTimeout(()=>{internalData.lxTimeout=undefined;internalData.lxRunTime=undefined;loadScrollXData($xeTable);},fpsTime);}function lazyScrollYData($xeTable){const internalData=$xeTable;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($xeTable);}internalData.lyTimeout=setTimeout(()=>{internalData.lyTimeout=undefined;internalData.lyRunTime=undefined;loadScrollYData($xeTable);},fpsTime);}function handleSyncScroll($xeTable,isRollX,isRollY,syncGuard){const reactData=$xeTable;const internalData=$xeTable;const{scrollXLoad,scrollYLoad,isAllOverflow}=reactData;const autoWidthColumnList=$xeTable.computeAutoWidthColumnList;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;internalData.isSyncGanttScrollTop=false;reactData.lazScrollLoading=false;internalData.scrollRenderType='';const $xeGanttView=internalData.xeGanttView;if($xeGanttView){const ganttInternalData=$xeGanttView.internalData;ganttInternalData.isSyncTableScrollTop=false;}let xRest=null;let yRest=null;if(!isAllOverflow){calcCellHeight($xeTable);updateRowOffsetTop($xeTable);}if(syncGuard)syncGuard.markMeasured();if(isRollX&&scrollXLoad){xRest=$xeTable.updateScrollXData();}if(isRollY&&scrollYLoad){if(autoWidthColumnList.length){calcCellWidth($xeTable);}yRest=$xeTable.updateScrollYData().then(()=>{if(syncGuard&&isTableDestroyed($xeTable))return;if(autoWidthColumnList.length){calcCellWidth($xeTable);autoCellWidth($xeTable);}if(!isAllOverflow){calcCellHeight($xeTable);updateRowOffsetTop($xeTable);}if(syncGuard)syncGuard.markMeasured();return $xeTable.updateScrollYSpace();});}updateRowExpandStyle($xeTable);return Promise.all([xRest,yRest,scrollXLoad||scrollYLoad?$xeTable.updateCellAreas():null]);}/** 不读取单元格尺寸,只比较窗口、布局版本和当前滚动几何。 */function getScrollSyncState($xeTable){const reactData=$xeTable;const internalData=$xeTable;const{scrollXStore,scrollYStore,elemStore,fullAllDataRowIdData}=internalData;const bodyScrollElem=(0,_util.getRefElem)(elemStore['main-body-scroll']);const state=[
|
|
255
|
+
*/function loadScrollYData($xeTable){const reactData=$xeTable;const internalData=$xeTable;const{isAllOverflow,isScrollYBig}=reactData;const{mergeBodyList,mergeBodyRowMaps,scrollYStore}=internalData;const{preloadSize,startIndex,endIndex,offsetSize}=scrollYStore;const autoOffsetYSize=isAllOverflow?offsetSize:offsetSize+1;const{toVisibleIndex,visibleSize}=handleVirtualYVisible($xeTable);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,mergeBodyRowMaps,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 $xeTable=this;const internalData=$xeTable;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 $xeTable=this;const internalData=$xeTable;const{fullColumnIdData}=internalData;if(column){const colRest=fullColumnIdData[column.id];if(colRest){return colRest[prop];}}return-1;};};function lazyScrollXData($xeTable){const internalData=$xeTable;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($xeTable);}internalData.lxTimeout=setTimeout(()=>{internalData.lxTimeout=undefined;internalData.lxRunTime=undefined;loadScrollXData($xeTable);},fpsTime);}function lazyScrollYData($xeTable){const internalData=$xeTable;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($xeTable);}internalData.lyTimeout=setTimeout(()=>{internalData.lyTimeout=undefined;internalData.lyRunTime=undefined;loadScrollYData($xeTable);},fpsTime);}function handleSyncScroll($xeTable,isRollX,isRollY,syncGuard){const reactData=$xeTable;const internalData=$xeTable;const{scrollXLoad,scrollYLoad,isAllOverflow}=reactData;const autoWidthColumnList=$xeTable.computeAutoWidthColumnList;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;internalData.isSyncGanttScrollTop=false;reactData.lazScrollLoading=false;internalData.scrollRenderType='';const $xeGanttView=internalData.xeGanttView;if($xeGanttView){const ganttInternalData=$xeGanttView.internalData;ganttInternalData.isSyncTableScrollTop=false;}let xRest=null;let yRest=null;if(!isAllOverflow){calcCellHeight($xeTable);updateRowOffsetTop($xeTable);}if(syncGuard)syncGuard.markMeasured();if(isRollX&&scrollXLoad){xRest=$xeTable.updateScrollXData();}if(isRollY&&scrollYLoad){if(autoWidthColumnList.length){calcCellWidth($xeTable);}yRest=$xeTable.updateScrollYData().then(()=>{if(syncGuard&&isTableDestroyed($xeTable))return;if(autoWidthColumnList.length){calcCellWidth($xeTable);autoCellWidth($xeTable);}if(!isAllOverflow){calcCellHeight($xeTable);updateRowOffsetTop($xeTable);}if(syncGuard)syncGuard.markMeasured();return $xeTable.updateScrollYSpace();});}updateRowExpandStyle($xeTable);return Promise.all([xRest,yRest,scrollXLoad||scrollYLoad?$xeTable.updateCellAreas():null]);}/** 不读取单元格尺寸,只比较窗口、布局版本和当前滚动几何。 */function getScrollSyncState($xeTable){const reactData=$xeTable;const internalData=$xeTable;const{scrollXStore,scrollYStore,elemStore,fullAllDataRowIdData}=internalData;const bodyScrollElem=(0,_util.getRefElem)(elemStore['main-body-scroll']);const state=[// 同一窗口可能被重新 slice;下方逐行快照仍校验对象、顺序、主键及高度。
|
|
256
|
+
reactData.tableData.length,reactData.tableColumn,internalData.afterFullData,internalData.afterFullData.length,fullAllDataRowIdData,internalData.fullCellHeightMaps,$xeTable.computeRowOpts,$xeTable.computeCellOpts,$xeTable.computeExpandOpts,$xeTable.computeVirtualXOpts,$xeTable.computeVirtualYOpts,$xeTable.computeDefaultRowHeight,reactData.isAllOverflow,reactData.scrollXLoad,reactData.scrollYLoad,reactData.upDataFlag,reactData.updateColFlag,reactData.calcCellHeightFlag,reactData.rowExpandHeightFlag,reactData.resizeHeightFlag,reactData.resizeWidthFlag,reactData.rowExpandedFlag,reactData.treeExpandedFlag,reactData.mergeHeadFlag,reactData.mergeBodyFlag,reactData.mergeFootFlag,reactData.scrollYHeight,reactData.scrollYTop,reactData.isScrollYBig,reactData.scrollXWidth,reactData.scrollXLeft,reactData.isScrollXBig,scrollXStore.startIndex,scrollXStore.endIndex,scrollYStore.startIndex,scrollYStore.endIndex,internalData.lastSTime,pendingExpandOffsetUpdates.has($xeTable),bodyScrollElem,bodyScrollElem?bodyScrollElem.scrollLeft:0,bodyScrollElem?bodyScrollElem.scrollTop:0,bodyScrollElem?bodyScrollElem.clientWidth:0,bodyScrollElem?bodyScrollElem.clientHeight:0,bodyScrollElem?bodyScrollElem.scrollWidth:0,bodyScrollElem?bodyScrollElem.scrollHeight:0];reactData.tableColumn.forEach(column=>state.push(column,column.renderWidth));const{handleGetRowId}=(0,_util.createHandleGetRowId)($xeTable);reactData.tableData.forEach(row=>{const rowid=handleGetRowId(row);const rest=fullAllDataRowIdData[rowid];state.push(row,rowid,rest,rest&&rest.height,rest&&rest.resizeHeight,rest&&rest.expandHeight,rest&&rest.oTop);});return state;}function handleStableScrollSync($xeTable,isRollX,isRollY,syncGuard){return(0,_tslib.__awaiter)(this,void 0,void 0,function*(){const reactData=$xeTable;const internalData=$xeTable;try{// 第一轮以及原有的 DOM 提交等待不变,动态高度仍先完整测量。
|
|
246
257
|
yield handleSyncScroll($xeTable,isRollX,isRollY,syncGuard);if(isTableDestroyed($xeTable))return;if(reactData.scrollXLoad||reactData.scrollYLoad){yield $xeTable.$nextTick();if(isTableDestroyed($xeTable))return;updateRowExpandStyle($xeTable);if(!internalData.lcsTimeout&&!syncGuard.isStable()){syncGuard.dispose();yield handleSyncScroll($xeTable,isRollX,isRollY);}}}finally{syncGuard.dispose();}});}function checkLastSyncScroll($xeTable,isRollX,isRollY){const reactData=$xeTable;const internalData=$xeTable;const{lcsTimeout}=internalData;reactData.lazScrollLoading=true;if(lcsTimeout){clearTimeout(lcsTimeout);}internalData.lcsTimeout=setTimeout(()=>{if($xeTable.computeVirtualYOpts.experimentalSkipStableScrollSync===true){if(isTableDestroyed($xeTable))return;const el=$xeTable.$refs.refElem;// 自动列宽、树和跨行合并仍完整保留原来的两轮修正。
|
|
247
258
|
if(el&&!$xeTable.computeAutoWidthColumnList.length&&!$xeTable.treeConfig&&!$xeTable.spanMethod&&!internalData.mergeBodyList.length){const syncGuard=(0,_scrollSync.createScrollSyncGuard)(el,()=>getScrollSyncState($xeTable));if(syncGuard){handleStableScrollSync($xeTable,isRollX,isRollY,syncGuard);return;}}}handleSyncScroll($xeTable,isRollX,isRollY).then(()=>{if(reactData.scrollXLoad||reactData.scrollYLoad){$xeTable.$nextTick(()=>{updateRowExpandStyle($xeTable);if(!internalData.lcsTimeout){handleSyncScroll($xeTable,isRollX,isRollY);}});}});},240);}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=($xeTable,scrollTop)=>{const internalData=$xeTable;const{isSyncGanttScrollTop}=internalData;if(isSyncGanttScrollTop){return;}const $xeGanttView=internalData.xeGanttView;if($xeGanttView){const ganttInternalData=$xeGanttView.internalData;ganttInternalData.isSyncTableScrollTop=true;$xeGanttView.handleSyncScrollTop({scrollTop});}};function updateHeight($xeTable){const reactData=$xeTable;const internalData=$xeTable;internalData.customHeight=calcTableHeight($xeTable,'height');internalData.customMinHeight=calcTableHeight($xeTable,'minHeight');internalData.customMaxHeight=calcTableHeight($xeTable,'maxHeight');// 如果启用虚拟滚动,纠正高度
|
|
248
259
|
if(reactData.scrollYLoad&&!(internalData.customHeight||internalData.customMinHeight||internalData.customMaxHeight)){internalData.customHeight=300;}}/**
|
|
@@ -844,7 +855,8 @@ if(scrollYVisible===false||scrollYVisible==='hidden'){evnt.preventDefault();retu
|
|
|
844
855
|
if($xeParentTable){if(isRollY){if((0,_dom.checkTargetElement)(evnt.target,[leftScrollElem,bodyScrollElem,rightScrollElem],evnt.currentTarget)){evnt.stopPropagation();return;}}if(isRollX){if((0,_dom.checkTargetElement)(evnt.target,[headerScrollElem,bodyScrollElem,footerScrollElem],evnt.currentTarget)){evnt.stopPropagation();return;}}}if(!(isRollX||leftFixedWidth||rightFixedWidth||expandColumn)){return;}if(rowOpts.isHover||highlightHoverRow){$xeTable.clearHoverRow();}// 用于鼠标纵向滚轮处理
|
|
845
856
|
if(isRollX){evnt.preventDefault();internalData.inWheelScroll=true;(0,_dom.wheelScrollLeftTo)(scrollLeft,offsetLeft=>{(0,_dom.setScrollLeft)(bodyScrollElem,offsetLeft);// 等待动画帧期间范围可能变化,使用浏览器最终接受的位置同步。
|
|
846
857
|
const currLeftNum=bodyScrollElem.scrollLeft;(0,_dom.setScrollLeft)(xHandleEl,currLeftNum);(0,_dom.setScrollLeft)(headerScrollElem,currLeftNum);(0,_dom.setScrollLeft)(footerScrollElem,currLeftNum);if(scrollXLoad){$xeTable.triggerScrollXEvent(evnt);}$xeTable.handleScrollEvent(evnt,isRollY,isRollX,bodyScrollElem.scrollTop,currLeftNum,{type:'table',fixed:''});},$xeTable);}if(isRollY){evnt.preventDefault();(0,_dom.wheelScrollTopTo)(scrollTop,offsetTop=>{internalData.inWheelScroll=true;(0,_dom.setScrollTop)(bodyScrollElem,offsetTop);const currTopNum=bodyScrollElem.scrollTop;(0,_dom.setScrollTop)(yHandleEl,currTopNum);(0,_dom.setScrollTop)(leftScrollElem,currTopNum);(0,_dom.setScrollTop)(rightScrollElem,currTopNum);(0,_dom.setScrollTop)(rowExpandEl,currTopNum);syncGanttScrollTop($xeTable,currTopNum);if(scrollYLoad){$xeTable.triggerScrollYEvent(evnt);}$xeTable.handleScrollEvent(evnt,isRollY,isRollX,currTopNum,bodyScrollElem.scrollLeft,{type:'table',fixed:''});},$xeTable);}},triggerVirtualScrollXEvent(evnt){const $xeTable=this;const reactData=$xeTable;const internalData=$xeTable;const{scrollXLoad}=reactData;const{elemStore,inWheelScroll,lastScrollTop,inHeaderScroll,inBodyScroll,inFooterScroll}=internalData;if(inHeaderScroll||inBodyScroll||inFooterScroll){return;}if(inWheelScroll){return;}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 yHandleEl=$xeTable.$refs.refScrollYHandleElem;const wrapperEl=evnt.currentTarget;const{scrollLeft}=wrapperEl;const yBodyEl=yHandleEl||bodyScrollElem;let scrollTop=0;if(yBodyEl){scrollTop=yBodyEl.scrollTop;}const isRollX=true;const isRollY=scrollTop!==lastScrollTop;internalData.inVirtualScroll=true;(0,_dom.setScrollLeft)(bodyScrollElem,scrollLeft);(0,_dom.setScrollLeft)(headerScrollElem,scrollLeft);(0,_dom.setScrollLeft)(footerScrollElem,scrollLeft);if(scrollXLoad){$xeTable.triggerScrollXEvent(evnt);}$xeTable.handleScrollEvent(evnt,isRollY,isRollX,scrollTop,scrollLeft,{type:'table',fixed:''});},triggerVirtualScrollYEvent(evnt){const $xeTable=this;const reactData=$xeTable;const internalData=$xeTable;const{scrollYLoad}=reactData;const{elemStore,inWheelScroll,lastScrollLeft,inHeaderScroll,inBodyScroll,inFooterScroll}=internalData;if(inHeaderScroll||inBodyScroll||inFooterScroll){return;}if(inWheelScroll){return;}const leftScrollElem=(0,_util.getRefElem)(elemStore['left-body-scroll']);const bodyScrollElem=(0,_util.getRefElem)(elemStore['main-body-scroll']);const rightScrollElem=(0,_util.getRefElem)(elemStore['right-body-scroll']);const rowExpandEl=$xeTable.$refs.refRowExpandElem;const xHandleEl=$xeTable.$refs.refScrollXHandleElem;const wrapperEl=evnt.currentTarget;const{scrollTop}=wrapperEl;const xBodyEl=xHandleEl||bodyScrollElem;let scrollLeft=0;if(xBodyEl){scrollLeft=xBodyEl.scrollLeft;}const isRollX=scrollLeft!==lastScrollLeft;const isRollY=true;internalData.inVirtualScroll=true;(0,_dom.setScrollTop)(bodyScrollElem,scrollTop);(0,_dom.setScrollTop)(leftScrollElem,scrollTop);(0,_dom.setScrollTop)(rightScrollElem,scrollTop);(0,_dom.setScrollTop)(rowExpandEl,scrollTop);syncGanttScrollTop($xeTable,scrollTop);if(scrollYLoad){$xeTable.triggerScrollYEvent(evnt);}$xeTable.handleScrollEvent(evnt,isRollY,isRollX,scrollTop,scrollLeft,{type:'table',fixed:''});},updateScrollXData(){const $xeTable=this;const reactData=$xeTable;const{isAllOverflow}=reactData;handleTableColumn($xeTable);$xeTable.updateScrollXSpace();return $xeTable.$nextTick().then(()=>{handleTableColumn($xeTable,true);$xeTable.updateScrollXSpace();if(!isAllOverflow){$xeTable.updateScrollYSpace();}});},// 更新横向 X 可视渲染上下剩余空间大小
|
|
847
|
-
updateScrollXSpace(){
|
|
858
|
+
updateScrollXSpace(){// 入口只分流一次;关闭时不经过去重函数或逐项样式比较。
|
|
859
|
+
if(this.computeVirtualXOpts.experimentalSkipUnchangedStyle===true){return updateScrollXSpaceWithDedupe(this);}const $xeTable=this;const reactData=$xeTable;const internalData=$xeTable;const{scrollXLoad,overflowX,scrollXWidth}=reactData;const{visibleColumn,scrollXStore,elemStore,fullColumnIdData}=internalData;const $xeGanttView=internalData.xeGanttView;const mouseOpts=$xeTable.computeMouseOpts;const tableBody=$xeTable.$refs.refTableBody;const tableBodyElem=tableBody?tableBody.$el:null;if(tableBodyElem){const bodyScrollElem=(0,_util.getRefElem)(elemStore['main-body-scroll']);const bodyTableElem=(0,_util.getRefElem)(elemStore['main-body-table']);const headerTableElem=(0,_util.getRefElem)(elemStore['main-header-table']);const footerTableElem=(0,_util.getRefElem)(elemStore['main-footer-table']);let xSpaceLeft=0;const firstColumn=visibleColumn[scrollXStore.startIndex];if(firstColumn){const colRest=fullColumnIdData[firstColumn.id]||{};xSpaceLeft=colRest.oLeft;}let clientWidth=0;if(bodyScrollElem){clientWidth=bodyScrollElem.clientWidth;}// 虚拟渲染
|
|
848
860
|
let isScrollXBig=false;let ySpaceWidth=scrollXWidth;if(scrollXWidth>maxXWidth){// 触右
|
|
849
861
|
if(bodyScrollElem&&bodyTableElem&&bodyScrollElem.scrollLeft+clientWidth>=maxXWidth){xSpaceLeft=maxXWidth-bodyTableElem.clientWidth;}else{xSpaceLeft=(maxXWidth-clientWidth)*(xSpaceLeft/(scrollXWidth-clientWidth));}ySpaceWidth=maxXWidth;isScrollXBig=true;}if(!(scrollXLoad&&overflowX)){xSpaceLeft=0;}if(getConfig().scrollMarginStyle){// 已废弃方式
|
|
850
862
|
if(headerTableElem){headerTableElem.style.marginLeft=headerTableElem.getAttribute('xvm')?`${xSpaceLeft}px`:'';}if(bodyTableElem){bodyTableElem.style.marginLeft=`${xSpaceLeft}px`;}if(footerTableElem){footerTableElem.style.marginLeft=footerTableElem.getAttribute('xvm')?`${xSpaceLeft}px`:'';}}else{if(headerTableElem){headerTableElem.style.transform=headerTableElem.getAttribute('xvm')?`translate(${xSpaceLeft}px, 0px)`:'';}if(bodyTableElem){bodyTableElem.style.transform=`translate(${xSpaceLeft}px, ${reactData.scrollYTop||0}px)`;}if(footerTableElem){footerTableElem.style.transform=footerTableElem.getAttribute('xvm')?`translate(${xSpaceLeft}px, 0px)`:'';}}const containerList=['main'];containerList.forEach(name=>{const layoutList=['header','body','footer'];layoutList.forEach(layout=>{const xSpaceElem=(0,_util.getRefElem)(elemStore[`${name}-${layout}-xSpace`]);if(xSpaceElem){xSpaceElem.style.width=scrollXLoad?`${ySpaceWidth}px`:'';}});});reactData.scrollXLeft=xSpaceLeft;reactData.scrollXWidth=ySpaceWidth;reactData.isScrollXBig=isScrollXBig;const scrollXSpaceEl=$xeTable.$refs.refScrollXSpaceElem;if(scrollXSpaceEl){scrollXSpaceEl.style.width=`${ySpaceWidth}px`;}calcScrollbar($xeTable);if(isScrollXBig&&mouseOpts.area){errLog('vxe.error.notProp',['mouse-config.area']);}if($xeGanttView&&$xeGanttView.handleUpdateSXSpace){$xeGanttView.handleUpdateSXSpace();}return $xeTable.$nextTick(()=>{updateStyle($xeTable);});}},updateScrollYData(){const $xeTable=this;$xeTable.handleTableData();$xeTable.updateScrollYSpace();return $xeTable.$nextTick().then(()=>{$xeTable.handleTableData(false,true);$xeTable.updateScrollYSpace();});},handleSyncScrollTop(params){const $xeTable=this;const internalData=$xeTable;const{scrollTop}=params;const{elemStore}=internalData;const bodyScrollElem=(0,_util.getRefElem)(elemStore['main-body-scroll']);if(bodyScrollElem){bodyScrollElem.scrollTop=scrollTop;}},// 更新纵向 Y 可视渲染上下剩余空间大小
|