vxe-table 3.25.0-beta.5 → 3.25.0-beta.6
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 +26 -6
- package/es/table/src/util.js +25 -0
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/lib/index.umd.js +30 -5
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/table/src/methods.js +3 -3
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/util.js +25 -0
- 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 +30 -6
- package/packages/table/src/util.ts +34 -0
- /package/es/{iconfont.1792220310836.ttf → iconfont.1792226787838.ttf} +0 -0
- /package/es/{iconfont.1792220310836.woff → iconfont.1792226787838.woff} +0 -0
- /package/es/{iconfont.1792220310836.woff2 → iconfont.1792226787838.woff2} +0 -0
- /package/lib/{iconfont.1792220310836.ttf → iconfont.1792226787838.ttf} +0 -0
- /package/lib/{iconfont.1792220310836.woff → iconfont.1792226787838.woff} +0 -0
- /package/lib/{iconfont.1792220310836.woff2 → iconfont.1792226787838.woff2} +0 -0
package/es/table/src/methods.js
CHANGED
|
@@ -4072,8 +4072,14 @@ function handleSyncScroll($xeTable, isRollX, isRollY) {
|
|
|
4072
4072
|
internalData.inHeaderScroll = false;
|
|
4073
4073
|
internalData.inBodyScroll = false;
|
|
4074
4074
|
internalData.inFooterScroll = false;
|
|
4075
|
+
internalData.isSyncGanttScrollTop = false;
|
|
4075
4076
|
reactData.lazScrollLoading = false;
|
|
4076
4077
|
internalData.scrollRenderType = '';
|
|
4078
|
+
const $xeGanttView = internalData.xeGanttView;
|
|
4079
|
+
if ($xeGanttView) {
|
|
4080
|
+
const ganttInternalData = $xeGanttView.internalData;
|
|
4081
|
+
ganttInternalData.isSyncTableScrollTop = false;
|
|
4082
|
+
}
|
|
4077
4083
|
let xRest = null;
|
|
4078
4084
|
let yRest = null;
|
|
4079
4085
|
if (!isAllOverflow) {
|
|
@@ -4152,14 +4158,15 @@ const getWheelSpeed = (lastScrollTime) => {
|
|
|
4152
4158
|
};
|
|
4153
4159
|
const syncGanttScrollTop = ($xeTable, scrollTop) => {
|
|
4154
4160
|
const internalData = $xeTable;
|
|
4161
|
+
const { isSyncGanttScrollTop } = internalData;
|
|
4162
|
+
if (isSyncGanttScrollTop) {
|
|
4163
|
+
return;
|
|
4164
|
+
}
|
|
4155
4165
|
const $xeGanttView = internalData.xeGanttView;
|
|
4156
4166
|
if ($xeGanttView) {
|
|
4157
4167
|
const ganttInternalData = $xeGanttView.internalData;
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
if (ganttBodyScrollElem) {
|
|
4161
|
-
ganttBodyScrollElem.scrollTop = scrollTop;
|
|
4162
|
-
}
|
|
4168
|
+
ganttInternalData.isSyncTableScrollTop = true;
|
|
4169
|
+
$xeGanttView.handleSyncScrollTop({ scrollTop });
|
|
4163
4170
|
}
|
|
4164
4171
|
};
|
|
4165
4172
|
function updateHeight($xeTable) {
|
|
@@ -12349,7 +12356,10 @@ const tableMethods = {
|
|
|
12349
12356
|
isLeft,
|
|
12350
12357
|
isRight,
|
|
12351
12358
|
direction }, params);
|
|
12352
|
-
$xeTable.
|
|
12359
|
+
const isVScrollbar = $xeTable.computeIsVScrollbar;
|
|
12360
|
+
if (isVScrollbar) {
|
|
12361
|
+
$xeTable.updateThumbOffset();
|
|
12362
|
+
}
|
|
12353
12363
|
updateRowExpandStyle($xeTable);
|
|
12354
12364
|
checkLastSyncScroll($xeTable, isRollX, isRollY);
|
|
12355
12365
|
if (isRollX) {
|
|
@@ -12882,6 +12892,16 @@ const tableMethods = {
|
|
|
12882
12892
|
$xeTable.updateScrollYSpace();
|
|
12883
12893
|
});
|
|
12884
12894
|
},
|
|
12895
|
+
handleSyncScrollTop(params) {
|
|
12896
|
+
const $xeTable = this;
|
|
12897
|
+
const internalData = $xeTable;
|
|
12898
|
+
const { scrollTop } = params;
|
|
12899
|
+
const { elemStore } = internalData;
|
|
12900
|
+
const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
|
|
12901
|
+
if (bodyScrollElem) {
|
|
12902
|
+
bodyScrollElem.scrollTop = scrollTop;
|
|
12903
|
+
}
|
|
12904
|
+
},
|
|
12885
12905
|
// 更新纵向 Y 可视渲染上下剩余空间大小
|
|
12886
12906
|
updateScrollYSpace() {
|
|
12887
12907
|
const $xeTable = this;
|
package/es/table/src/util.js
CHANGED
|
@@ -154,9 +154,34 @@ export function createInternalData() {
|
|
|
154
154
|
tooltipTimeout: null,
|
|
155
155
|
initStatus: false,
|
|
156
156
|
isActivated: false,
|
|
157
|
+
// keyCtxTimeout: undefined,
|
|
158
|
+
// 刷新布局
|
|
157
159
|
// rceTimeout: undefined,
|
|
158
160
|
// rceRunTime: undefined,
|
|
159
161
|
rceDelay: 0
|
|
162
|
+
// rsePending: false,
|
|
163
|
+
// 滚动属性
|
|
164
|
+
// intoRunScroll: false,
|
|
165
|
+
// inVirtualScroll: false,
|
|
166
|
+
// inWheelScroll: false,
|
|
167
|
+
// inHeaderScroll: false,
|
|
168
|
+
// inBodyScroll: false,
|
|
169
|
+
// inFooterScroll: false,
|
|
170
|
+
// scrollRenderType?: '',
|
|
171
|
+
// isSyncGanttScrollTop: false,
|
|
172
|
+
// 同步滚动
|
|
173
|
+
// lcsTimeout: undefined,
|
|
174
|
+
// lcsRunTime: undefined,
|
|
175
|
+
// 横向虚拟
|
|
176
|
+
// lxRunTime: undefined,
|
|
177
|
+
// lxTimeout: undefined,
|
|
178
|
+
// 纵向虚拟
|
|
179
|
+
// lyRunTime: undefined,
|
|
180
|
+
// lyTimeout: undefined,
|
|
181
|
+
// 动态高度
|
|
182
|
+
// chRunTime: undefined,
|
|
183
|
+
// chTimeout: undefined,
|
|
184
|
+
// isResizeCellHeight: false,
|
|
160
185
|
// _sToTime: null
|
|
161
186
|
};
|
|
162
187
|
}
|
package/es/ui/index.js
CHANGED
package/es/ui/src/log.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { VxeUI } from '@vxe-ui/core';
|
|
2
2
|
const { log } = VxeUI;
|
|
3
|
-
const tableVersion = `table v${"3.25.0-beta.
|
|
3
|
+
const tableVersion = `table v${"3.25.0-beta.6"}`;
|
|
4
4
|
export function createComponentLog(name) {
|
|
5
5
|
const uiVersion = VxeUI.uiVersion ? `ui v${VxeUI.uiVersion}` : '';
|
|
6
6
|
const ganttVersion = VxeUI.ganttVersion ? `gantt v${VxeUI.ganttVersion}` : '';
|
package/lib/index.umd.js
CHANGED
|
@@ -3323,7 +3323,7 @@ function getDefaultConfig(val1, def1) {
|
|
|
3323
3323
|
/* unused harmony import specifier */ var VxeUI;
|
|
3324
3324
|
|
|
3325
3325
|
|
|
3326
|
-
const version = "3.25.0-beta.
|
|
3326
|
+
const version = "3.25.0-beta.6";
|
|
3327
3327
|
core_.VxeUI.version = version;
|
|
3328
3328
|
core_.VxeUI.tableVersion = version;
|
|
3329
3329
|
core_.VxeUI.setConfig({
|
|
@@ -4286,7 +4286,7 @@ function getPopupAppendElement(appendTo) {
|
|
|
4286
4286
|
const {
|
|
4287
4287
|
log: log_log
|
|
4288
4288
|
} = core_.VxeUI;
|
|
4289
|
-
const tableVersion = `table v${"3.25.0-beta.
|
|
4289
|
+
const tableVersion = `table v${"3.25.0-beta.6"}`;
|
|
4290
4290
|
function createComponentLog(name) {
|
|
4291
4291
|
const uiVersion = core_.VxeUI.uiVersion ? `ui v${core_.VxeUI.uiVersion}` : '';
|
|
4292
4292
|
const ganttVersion = core_.VxeUI.ganttVersion ? `gantt v${core_.VxeUI.ganttVersion}` : '';
|
|
@@ -4724,9 +4724,34 @@ function createInternalData() {
|
|
|
4724
4724
|
tooltipTimeout: null,
|
|
4725
4725
|
initStatus: false,
|
|
4726
4726
|
isActivated: false,
|
|
4727
|
+
// keyCtxTimeout: undefined,
|
|
4728
|
+
// 刷新布局
|
|
4727
4729
|
// rceTimeout: undefined,
|
|
4728
4730
|
// rceRunTime: undefined,
|
|
4729
4731
|
rceDelay: 0
|
|
4732
|
+
// rsePending: false,
|
|
4733
|
+
// 滚动属性
|
|
4734
|
+
// intoRunScroll: false,
|
|
4735
|
+
// inVirtualScroll: false,
|
|
4736
|
+
// inWheelScroll: false,
|
|
4737
|
+
// inHeaderScroll: false,
|
|
4738
|
+
// inBodyScroll: false,
|
|
4739
|
+
// inFooterScroll: false,
|
|
4740
|
+
// scrollRenderType?: '',
|
|
4741
|
+
// isSyncGanttScrollTop: false,
|
|
4742
|
+
// 同步滚动
|
|
4743
|
+
// lcsTimeout: undefined,
|
|
4744
|
+
// lcsRunTime: undefined,
|
|
4745
|
+
// 横向虚拟
|
|
4746
|
+
// lxRunTime: undefined,
|
|
4747
|
+
// lxTimeout: undefined,
|
|
4748
|
+
// 纵向虚拟
|
|
4749
|
+
// lyRunTime: undefined,
|
|
4750
|
+
// lyTimeout: undefined,
|
|
4751
|
+
// 动态高度
|
|
4752
|
+
// chRunTime: undefined,
|
|
4753
|
+
// chTimeout: undefined,
|
|
4754
|
+
// isResizeCellHeight: false,
|
|
4730
4755
|
// _sToTime: null
|
|
4731
4756
|
};
|
|
4732
4757
|
}
|
|
@@ -8304,7 +8329,7 @@ if(props.spanMethod){methods_warnLog('vxe.error.scrollErrProp',['span-method']);
|
|
|
8304
8329
|
// 如果列被设置为固定,则清除合并状态
|
|
8305
8330
|
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;external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_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]){methods_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'){methods_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)){methods_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=getColumnList(collectColumn);internalData.tableFullColumn=tFullColumn;reactData.updateColFlag++;reactData.isColLoading=true;initColumnHierarchy($xeTable);return Promise.resolve(restoreCustomStorage($xeTable)).then(()=>{return buildColumnInfo($xeTable);});}/**
|
|
8306
8331
|
* 纵向 Y 可视渲染处理
|
|
8307
|
-
*/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=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){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;reactData.lazScrollLoading=false;internalData.scrollRenderType='';let xRest=null;let yRest=null;if(!isAllOverflow){calcCellHeight($xeTable);updateRowOffsetTop($xeTable);}if(isRollX&&scrollXLoad){xRest=$xeTable.updateScrollXData();}if(isRollY&&scrollYLoad){if(autoWidthColumnList.length){calcCellWidth($xeTable);}yRest=$xeTable.updateScrollYData().then(()=>{if(autoWidthColumnList.length){calcCellWidth($xeTable);autoCellWidth($xeTable);}if(!isAllOverflow){calcCellHeight($xeTable);updateRowOffsetTop($xeTable);}return $xeTable.updateScrollYSpace();});}updateRowExpandStyle($xeTable);return Promise.all([xRest,yRest,scrollXLoad||scrollYLoad?$xeTable.updateCellAreas():null]);}function checkLastSyncScroll($xeTable,isRollX,isRollY){const reactData=$xeTable;const internalData=$xeTable;const{lcsTimeout}=internalData;reactData.lazScrollLoading=true;if(lcsTimeout){clearTimeout(lcsTimeout);}internalData.lcsTimeout=setTimeout(()=>{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 $xeGanttView=internalData.xeGanttView;if($xeGanttView){const ganttInternalData=$xeGanttView.internalData;
|
|
8332
|
+
*/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=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){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(isRollX&&scrollXLoad){xRest=$xeTable.updateScrollXData();}if(isRollY&&scrollYLoad){if(autoWidthColumnList.length){calcCellWidth($xeTable);}yRest=$xeTable.updateScrollYData().then(()=>{if(autoWidthColumnList.length){calcCellWidth($xeTable);autoCellWidth($xeTable);}if(!isAllOverflow){calcCellHeight($xeTable);updateRowOffsetTop($xeTable);}return $xeTable.updateScrollYSpace();});}updateRowExpandStyle($xeTable);return Promise.all([xRest,yRest,scrollXLoad||scrollYLoad?$xeTable.updateCellAreas():null]);}function checkLastSyncScroll($xeTable,isRollX,isRollY){const reactData=$xeTable;const internalData=$xeTable;const{lcsTimeout}=internalData;reactData.lazScrollLoading=true;if(lcsTimeout){clearTimeout(lcsTimeout);}internalData.lcsTimeout=setTimeout(()=>{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');// 如果启用虚拟滚动,纠正高度
|
|
8308
8333
|
if(reactData.scrollYLoad&&!(internalData.customHeight||internalData.customMinHeight||internalData.customMaxHeight)){internalData.customHeight=300;}}/**
|
|
8309
8334
|
* 计算自适应列宽
|
|
8310
8335
|
*/function calcColumnAutoWidth($xeTable,column,wrapperEl){const reactData=$xeTable;const{scrollYLoad}=reactData;const columnOpts=$xeTable.computeColumnOpts;const{autoOptions}=columnOpts;const{isCalcHeader,isCalcBody,isCalcFooter}=autoOptions||{};const querySelections=[];if(isCalcHeader){querySelections.push(`.vxe-header-cell--wrapper[colid="${column.id}"]`);}if(isCalcBody){querySelections.push(`.vxe-body-cell--wrapper[colid="${column.id}"]`);}if(isCalcFooter){querySelections.push(`.vxe-footer-cell--wrapper[colid="${column.id}"]`);}const cellElemList=querySelections.length?wrapperEl.querySelectorAll(querySelections.join(',')):[];let leftRightPadding=0;const firstCellEl=cellElemList[0];if(firstCellEl&&firstCellEl.parentElement){const cellStyle=getComputedStyle(firstCellEl.parentElement);leftRightPadding=Math.ceil(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(cellStyle.paddingLeft)+external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(cellStyle.paddingRight));}let colWidth=(scrollYLoad?column.renderAutoWidth:0)-leftRightPadding;for(let i=0;i<cellElemList.length;i++){const celEl=cellElemList[i];colWidth=Math.max(colWidth,celEl?Math.ceil(celEl.scrollWidth)+4:0);}return colWidth+leftRightPadding;}/**
|
|
@@ -8883,7 +8908,7 @@ if(transform){return handleVirtualTreeExpand($xeTable,rows,expanded);}else{retur
|
|
|
8883
8908
|
* 获取表格的滚动状态
|
|
8884
8909
|
*/getScroll(){const $xeTable=this;return $xeTable.getScrollData();},/**
|
|
8885
8910
|
* 获取表格的滚动数据
|
|
8886
|
-
*/getScrollData(){const $xeTable=this;const reactData=$xeTable;const internalData=$xeTable;const{scrollXLoad,scrollYLoad,scrollbarHeight,scrollbarWidth}=reactData;const{elemStore}=internalData;const bodyScrollElem=getRefElem(elemStore['main-body-scroll']);const scrollTop=bodyScrollElem?bodyScrollElem.scrollTop:0;const scrollLeft=bodyScrollElem?bodyScrollElem.scrollLeft:0;const clientHeight=bodyScrollElem?bodyScrollElem.clientHeight:0;const clientWidth=bodyScrollElem?bodyScrollElem.clientWidth:0;const scrollHeight=bodyScrollElem?bodyScrollElem.scrollHeight:0;const scrollWidth=bodyScrollElem?bodyScrollElem.scrollWidth:0;const isTop=scrollTop<=0;const isBottom=scrollTop+clientHeight>=scrollHeight;const isLeft=scrollLeft<=0;const isRight=scrollLeft+clientWidth>=scrollWidth;return{virtualX:scrollXLoad,virtualY:scrollYLoad,isTop,isBottom,isLeft,isRight,scrollbarHeight,scrollbarWidth,scrollTop,scrollLeft,scrollHeight,scrollWidth,clientHeight,clientWidth};},handleScrollEvent(evnt,isRollY,isRollX,scrollTop,scrollLeft,params){const $xeTable=this;const props=$xeTable;const internalData=$xeTable;const{highlightHoverRow}=props;const{elemStore,lastScrollLeft,lastScrollTop}=internalData;const bodyScrollElem=getRefElem(elemStore['main-body-scroll']);if(!bodyScrollElem){return;}const rowOpts=$xeTable.computeRowOpts;const validTip=$xeTable.$refs.refValidTooltip;const tooltip=$xeTable.$refs.refTooltip;const bodyHeight=bodyScrollElem.clientHeight;const bodyWidth=bodyScrollElem.clientWidth;const scrollHeight=bodyScrollElem.scrollHeight;const scrollWidth=bodyScrollElem.scrollWidth;let isTop=false;let isBottom=false;let isLeft=false;let isRight=false;let direction='';let isTopBoundary=false;let isBottomBoundary=false;let isLeftBoundary=false;let isRightBoundary=false;if(isRollX){const xThreshold=$xeTable.computeScrollXThreshold;isLeft=scrollLeft<=0;if(!isLeft){isRight=scrollLeft+bodyWidth>=scrollWidth-1;}if(scrollLeft>lastScrollLeft){direction='right';if(scrollLeft+bodyWidth>=scrollWidth-xThreshold){isRightBoundary=true;}}else{direction='left';if(scrollLeft<=xThreshold){isLeftBoundary=true;}}$xeTable.checkScrolling();internalData.lastScrollLeft=scrollLeft;}if(isRollY){const yThreshold=$xeTable.computeScrollYThreshold;isTop=scrollTop<=0;if(!isTop){isBottom=scrollTop+bodyHeight>=scrollHeight-1;}if(scrollTop>lastScrollTop){direction='bottom';if(scrollTop+bodyHeight>=scrollHeight-yThreshold){isBottomBoundary=true;}}else{direction='top';if(scrollTop<=yThreshold){isTopBoundary=true;}}internalData.lastScrollTop=scrollTop;}internalData.lastSTime=Date.now();const evntParams={source:sourceType,scrollTop,scrollLeft,bodyHeight,bodyWidth,scrollHeight,scrollWidth,isX:isRollX,isY:isRollY,isTop,isBottom,isLeft,isRight,direction,...params}
|
|
8911
|
+
*/getScrollData(){const $xeTable=this;const reactData=$xeTable;const internalData=$xeTable;const{scrollXLoad,scrollYLoad,scrollbarHeight,scrollbarWidth}=reactData;const{elemStore}=internalData;const bodyScrollElem=getRefElem(elemStore['main-body-scroll']);const scrollTop=bodyScrollElem?bodyScrollElem.scrollTop:0;const scrollLeft=bodyScrollElem?bodyScrollElem.scrollLeft:0;const clientHeight=bodyScrollElem?bodyScrollElem.clientHeight:0;const clientWidth=bodyScrollElem?bodyScrollElem.clientWidth:0;const scrollHeight=bodyScrollElem?bodyScrollElem.scrollHeight:0;const scrollWidth=bodyScrollElem?bodyScrollElem.scrollWidth:0;const isTop=scrollTop<=0;const isBottom=scrollTop+clientHeight>=scrollHeight;const isLeft=scrollLeft<=0;const isRight=scrollLeft+clientWidth>=scrollWidth;return{virtualX:scrollXLoad,virtualY:scrollYLoad,isTop,isBottom,isLeft,isRight,scrollbarHeight,scrollbarWidth,scrollTop,scrollLeft,scrollHeight,scrollWidth,clientHeight,clientWidth};},handleScrollEvent(evnt,isRollY,isRollX,scrollTop,scrollLeft,params){const $xeTable=this;const props=$xeTable;const internalData=$xeTable;const{highlightHoverRow}=props;const{elemStore,lastScrollLeft,lastScrollTop}=internalData;const bodyScrollElem=getRefElem(elemStore['main-body-scroll']);if(!bodyScrollElem){return;}const rowOpts=$xeTable.computeRowOpts;const validTip=$xeTable.$refs.refValidTooltip;const tooltip=$xeTable.$refs.refTooltip;const bodyHeight=bodyScrollElem.clientHeight;const bodyWidth=bodyScrollElem.clientWidth;const scrollHeight=bodyScrollElem.scrollHeight;const scrollWidth=bodyScrollElem.scrollWidth;let isTop=false;let isBottom=false;let isLeft=false;let isRight=false;let direction='';let isTopBoundary=false;let isBottomBoundary=false;let isLeftBoundary=false;let isRightBoundary=false;if(isRollX){const xThreshold=$xeTable.computeScrollXThreshold;isLeft=scrollLeft<=0;if(!isLeft){isRight=scrollLeft+bodyWidth>=scrollWidth-1;}if(scrollLeft>lastScrollLeft){direction='right';if(scrollLeft+bodyWidth>=scrollWidth-xThreshold){isRightBoundary=true;}}else{direction='left';if(scrollLeft<=xThreshold){isLeftBoundary=true;}}$xeTable.checkScrolling();internalData.lastScrollLeft=scrollLeft;}if(isRollY){const yThreshold=$xeTable.computeScrollYThreshold;isTop=scrollTop<=0;if(!isTop){isBottom=scrollTop+bodyHeight>=scrollHeight-1;}if(scrollTop>lastScrollTop){direction='bottom';if(scrollTop+bodyHeight>=scrollHeight-yThreshold){isBottomBoundary=true;}}else{direction='top';if(scrollTop<=yThreshold){isTopBoundary=true;}}internalData.lastScrollTop=scrollTop;}internalData.lastSTime=Date.now();const evntParams={source:sourceType,scrollTop,scrollLeft,bodyHeight,bodyWidth,scrollHeight,scrollWidth,isX:isRollX,isY:isRollY,isTop,isBottom,isLeft,isRight,direction,...params};const isVScrollbar=$xeTable.computeIsVScrollbar;if(isVScrollbar){$xeTable.updateThumbOffset();}updateRowExpandStyle($xeTable);checkLastSyncScroll($xeTable,isRollX,isRollY);if(isRollX){$xeTable.closeFilter();}if(rowOpts.isHover||highlightHoverRow){$xeTable.clearHoverRow();}if(validTip&&validTip.reactData.visible){validTip.close();}if(tooltip&&tooltip.reactData.visible){tooltip.close();}if(isBottomBoundary||isTopBoundary||isRightBoundary||isLeftBoundary){$xeTable.dispatchEvent('scroll-boundary',evntParams,evnt);}$xeTable.dispatchEvent('scroll',evntParams,evnt);},/**
|
|
8887
8912
|
* 横向 X 可视渲染事件处理
|
|
8888
8913
|
*/triggerScrollXEvent(){const $xeTable=this;const virtualXOpts=$xeTable.computeVirtualXOpts;if(virtualXOpts.immediate){loadScrollXData($xeTable);}else{lazyScrollXData($xeTable);}},/**
|
|
8889
8914
|
* 纵向 Y 可视渲染事件处理
|
|
@@ -8897,7 +8922,7 @@ if(isRollX){evnt.preventDefault();internalData.inWheelScroll=true;wheelScrollLef
|
|
|
8897
8922
|
updateScrollXSpace(){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=getRefElem(elemStore['main-body-scroll']);const bodyTableElem=getRefElem(elemStore['main-body-table']);const headerTableElem=getRefElem(elemStore['main-header-table']);const footerTableElem=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;}// 虚拟渲染
|
|
8898
8923
|
let isScrollXBig=false;let ySpaceWidth=scrollXWidth;if(scrollXWidth>maxXWidth){// 触右
|
|
8899
8924
|
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(methods_getConfig().scrollMarginStyle){// 已废弃方式
|
|
8900
|
-
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=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){methods_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();$xeTable.updateScrollYSpace();});},// 更新纵向 Y 可视渲染上下剩余空间大小
|
|
8925
|
+
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=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){methods_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();$xeTable.updateScrollYSpace();});},handleSyncScrollTop(params){const $xeTable=this;const internalData=$xeTable;const{scrollTop}=params;const{elemStore}=internalData;const bodyScrollElem=getRefElem(elemStore['main-body-scroll']);if(bodyScrollElem){bodyScrollElem.scrollTop=scrollTop;}},// 更新纵向 Y 可视渲染上下剩余空间大小
|
|
8901
8926
|
updateScrollYSpace(){const $xeTable=this;const reactData=$xeTable;const internalData=$xeTable;const{isAllOverflow,overflowY,scrollYLoad,scrollYHeight,expandColumn}=reactData;const{scrollYStore,elemStore,isResizeCellHeight,afterFullData,fullAllDataRowIdData,rowExpandedMaps}=internalData;const $xeGanttView=internalData.xeGanttView;const{startIndex}=scrollYStore;const mouseOpts=$xeTable.computeMouseOpts;const expandOpts=$xeTable.computeExpandOpts;const rowOpts=$xeTable.computeRowOpts;const cellOpts=$xeTable.computeCellOpts;const defaultRowHeight=$xeTable.computeDefaultRowHeight;const bodyScrollElem=getRefElem(elemStore['main-body-scroll']);const bodyTableElem=getRefElem(elemStore['main-body-table']);const leftBodyTableElem=getRefElem(elemStore['left-body-table']);const rightbodyTableElem=getRefElem(elemStore['right-body-table']);const containerList=['main','left','right'];let ySpaceTop=0;let sYHeight=scrollYHeight;let isScrollYBig=false;if(scrollYLoad){const isCustomCellHeight=isResizeCellHeight||cellOpts.height||rowOpts.height;if(!isCustomCellHeight&&!expandColumn&&isAllOverflow){sYHeight=afterFullData.length*defaultRowHeight;if(sYHeight>maxYHeight){isScrollYBig=true;}ySpaceTop=Math.max(0,startIndex*defaultRowHeight);}else{const firstRow=afterFullData[startIndex];if(firstRow){let rowid=getRowid($xeTable,firstRow);let rowRest=fullAllDataRowIdData[rowid]||{};ySpaceTop=rowRest.oTop||0;const lastRow=afterFullData[afterFullData.length-1];rowid=getRowid($xeTable,lastRow);rowRest=fullAllDataRowIdData[rowid]||{};if(rowRest){const rHeight=getCellRestHeight(rowRest,cellOpts,rowOpts,defaultRowHeight);// 如果为空时还没计算完数据,保持原高度不变
|
|
8902
8927
|
if(rHeight){sYHeight=(rowRest.oTop||0)+rHeight;// 是否展开行
|
|
8903
8928
|
if(expandColumn&&rowExpandedMaps[rowid]){sYHeight+=rowRest.expandHeight||expandOpts.height||0;}}}if(sYHeight>maxYHeight){isScrollYBig=true;}}else{sYHeight=bodyTableElem?bodyTableElem.clientHeight:0;}}}else{if(bodyTableElem){sYHeight=bodyTableElem.clientHeight;}}let clientHeight=0;if(bodyScrollElem){clientHeight=bodyScrollElem.clientHeight;}// 虚拟渲染
|