vxe-table 4.17.0-beta.3 → 4.17.0-beta.5

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.
@@ -4232,7 +4232,10 @@ export default defineVxeComponent({
4232
4232
  let countTop = 0;
4233
4233
  const step = (timestamp) => {
4234
4234
  let progress = (timestamp - startTime) / duration;
4235
- if (progress > 1) {
4235
+ if (progress < 0) {
4236
+ progress = 0;
4237
+ }
4238
+ else if (progress > 1) {
4236
4239
  progress = 1;
4237
4240
  }
4238
4241
  const easedProgress = Math.pow(progress, 2);
@@ -11194,6 +11197,10 @@ export default defineVxeComponent({
11194
11197
  if (target && /^textarea$/i.test(target.tagName)) {
11195
11198
  return;
11196
11199
  }
11200
+ // 如果滚轮未移动或者触摸板未变化位置
11201
+ if (!deltaY && !deltaX) {
11202
+ return;
11203
+ }
11197
11204
  const { highlightHoverRow } = tableProps;
11198
11205
  const { scrollXLoad, scrollYLoad, expandColumn } = reactData;
11199
11206
  const leftFixedWidth = computeLeftFixedWidth.value;
@@ -11221,18 +11228,21 @@ export default defineVxeComponent({
11221
11228
  return;
11222
11229
  }
11223
11230
  const wheelSpeed = getWheelSpeed(reactData.lastScrollTime);
11224
- const deltaTop = shiftKey ? 0 : Math.ceil(deltaY * wheelSpeed);
11225
- const deltaLeft = shiftKey ? Math.ceil((shiftKey ? (deltaY || deltaX) : deltaX) * wheelSpeed) : 0;
11226
- const isTopWheel = deltaTop < 0;
11231
+ const deltaTop = shiftKey ? 0 : (deltaY * wheelSpeed);
11232
+ const deltaLeft = (shiftKey ? (deltaX || deltaY) : deltaX) * wheelSpeed;
11227
11233
  const currScrollTop = bodyScrollElem.scrollTop;
11228
- // 如果滚动位置已经是顶部或底部,则不需要触发
11229
- if (isTopWheel ? currScrollTop <= 0 : currScrollTop >= bodyScrollElem.scrollHeight - bodyScrollElem.clientHeight) {
11230
- return;
11231
- }
11234
+ const currScrollLeft = bodyScrollElem.scrollLeft;
11232
11235
  const scrollTop = currScrollTop + deltaTop;
11233
- const scrollLeft = bodyScrollElem.scrollLeft + deltaLeft;
11236
+ const scrollLeft = currScrollLeft + deltaLeft;
11234
11237
  const isRollX = scrollLeft !== lastScrollLeft;
11235
11238
  const isRollY = scrollTop !== lastScrollTop;
11239
+ if (isRollY) {
11240
+ const isTopWheel = deltaTop < 0;
11241
+ // 如果滚动位置已经是顶部或底部,则不需要触发
11242
+ if (isTopWheel ? currScrollTop <= 0 : currScrollTop >= bodyScrollElem.scrollHeight - bodyScrollElem.clientHeight) {
11243
+ return;
11244
+ }
11245
+ }
11236
11246
  if (rowOpts.isHover || highlightHoverRow) {
11237
11247
  $xeTable.clearHoverRow();
11238
11248
  }
package/es/ui/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { VxeUI } from '@vxe-ui/core';
2
2
  import { getFuncText } from './src/utils';
3
- export const version = "4.17.0-beta.3";
3
+ export const version = "4.17.0-beta.5";
4
4
  VxeUI.version = version;
5
5
  VxeUI.tableVersion = version;
6
6
  VxeUI.setConfig({
package/es/ui/src/log.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { VxeUI } from '@vxe-ui/core';
2
2
  const { log } = VxeUI;
3
- const version = `table v${"4.17.0-beta.3"}`;
3
+ const version = `table v${"4.17.0-beta.5"}`;
4
4
  export const warnLog = log.create('warn', version);
5
5
  export const errLog = log.create('error', version);
package/lib/index.umd.js CHANGED
@@ -3138,7 +3138,7 @@ function eqEmptyValue(cellValue) {
3138
3138
  ;// ./packages/ui/index.ts
3139
3139
 
3140
3140
 
3141
- const version = "4.17.0-beta.3";
3141
+ const version = "4.17.0-beta.5";
3142
3142
  core_.VxeUI.version = version;
3143
3143
  core_.VxeUI.tableVersion = version;
3144
3144
  core_.VxeUI.setConfig({
@@ -3650,7 +3650,7 @@ var esnext_iterator_some = __webpack_require__(7550);
3650
3650
  const {
3651
3651
  log: log_log
3652
3652
  } = core_.VxeUI;
3653
- const log_version = `table v${"4.17.0-beta.3"}`;
3653
+ const log_version = `table v${"4.17.0-beta.5"}`;
3654
3654
  const warnLog = log_log.create('warn', log_version);
3655
3655
  const errLog = log_log.create('error', log_version);
3656
3656
  ;// ./packages/table/src/columnInfo.ts
@@ -19235,7 +19235,7 @@ const matchObj=external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe
19235
19235
  * 处理默认展开分组行
19236
19236
  */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);}};/**
19237
19237
  * 纵向 Y 可视渲染处理
19238
- */const loadScrollYData=()=>{const{isAllOverflow,isScrollYBig}=reactData;const{mergeBodyList,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,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=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 checkLastSyncScroll=(isRollX,isRollY)=>{const{lcsTimeout}=internalData;reactData.lazScrollLoading=true;if(lcsTimeout){clearTimeout(lcsTimeout);}internalData.lcsTimeout=setTimeout(()=>{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='';if(!isAllOverflow){calcCellHeight();updateRowOffsetTop();}if(isRollX&&scrollXLoad){$xeTable.updateScrollXData();}if(isRollY&&scrollYLoad){$xeTable.updateScrollYData().then(()=>{if(!isAllOverflow){calcCellHeight();updateRowOffsetTop();}$xeTable.updateScrollYSpace();});}updateRowExpandStyle();$xeTable.updateCellAreas();},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 wheelScrollLeftTo=(scrollLeft,cb)=>{requestAnimationFrame(()=>{cb(scrollLeft);});};const wheelScrollTopTo=(diffNum,cb)=>{const duration=Math.abs(diffNum);const startTime=performance.now();let countTop=0;const step=timestamp=>{let progress=(timestamp-startTime)/duration;if(progress>1){progress=1;}const easedProgress=Math.pow(progress,2);const offsetTop=Math.floor(diffNum*easedProgress)-countTop;countTop+=offsetTop;cb(offsetTop);if(progress<1){requestAnimationFrame(step);}};requestAnimationFrame(step);};const syncGanttScrollTop=scrollTop=>{const $xeGanttView=internalData.xeGanttView;if($xeGanttView){const ganttInternalData=$xeGanttView.internalData;const{elemStore:ganttElemStore}=ganttInternalData;const ganttBodyScrollElem=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)=>{const{fullColumnIdData}=internalData;const column=handleFieldOrColumn($xeTable,fieldOrColumn);if(column&&fullColumnIdData[column.id]){return colToVisible($xeTable,column,row);}return (0,external_commonjs_vue_commonjs2_vue_root_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.updateCellAreas();$xeTable.dispatchEvent('column-resizable-change',params,evnt);// 已废弃 resizable-change
19238
+ */const loadScrollYData=()=>{const{isAllOverflow,isScrollYBig}=reactData;const{mergeBodyList,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,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=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 checkLastSyncScroll=(isRollX,isRollY)=>{const{lcsTimeout}=internalData;reactData.lazScrollLoading=true;if(lcsTimeout){clearTimeout(lcsTimeout);}internalData.lcsTimeout=setTimeout(()=>{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='';if(!isAllOverflow){calcCellHeight();updateRowOffsetTop();}if(isRollX&&scrollXLoad){$xeTable.updateScrollXData();}if(isRollY&&scrollYLoad){$xeTable.updateScrollYData().then(()=>{if(!isAllOverflow){calcCellHeight();updateRowOffsetTop();}$xeTable.updateScrollYSpace();});}updateRowExpandStyle();$xeTable.updateCellAreas();},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 wheelScrollLeftTo=(scrollLeft,cb)=>{requestAnimationFrame(()=>{cb(scrollLeft);});};const wheelScrollTopTo=(diffNum,cb)=>{const duration=Math.abs(diffNum);const startTime=performance.now();let countTop=0;const step=timestamp=>{let progress=(timestamp-startTime)/duration;if(progress<0){progress=0;}else if(progress>1){progress=1;}const easedProgress=Math.pow(progress,2);const offsetTop=Math.floor(diffNum*easedProgress)-countTop;countTop+=offsetTop;cb(offsetTop);if(progress<1){requestAnimationFrame(step);}};requestAnimationFrame(step);};const syncGanttScrollTop=scrollTop=>{const $xeGanttView=internalData.xeGanttView;if($xeGanttView){const ganttInternalData=$xeGanttView.internalData;const{elemStore:ganttElemStore}=ganttInternalData;const ganttBodyScrollElem=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)=>{const{fullColumnIdData}=internalData;const column=handleFieldOrColumn($xeTable,fieldOrColumn);if(column&&fullColumnIdData[column.id]){return colToVisible($xeTable,column,row);}return (0,external_commonjs_vue_commonjs2_vue_root_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.updateCellAreas();$xeTable.dispatchEvent('column-resizable-change',params,evnt);// 已废弃 resizable-change
19239
19239
  $xeTable.dispatchEvent('resizable-change',params,evnt);setTimeout(()=>$xeTable.recalculate(true),300);});};const handleUpdateRowResize=(evnt,params)=>{reactData.resizeHeightFlag++;$xeTable.recalculate().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}=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;// 是否展开行
19240
19240
  if(expandColumn&&rowExpandedMaps[rowid]){offsetTop+=rowRest.expandHeight||expandOpts.height||0;}}};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=getRefElem(elemStore['main-body-scroll']);if(rowExpandEl&&bodyScrollElem){let isUpdateHeight=false;external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayEach(rowExpandEl.children,reEl=>{const expandEl=reEl;const rowid=expandEl.getAttribute('rowid')||'';const rowRest=fullAllDataRowIdData[rowid];if(rowRest){const expandHeight=expandEl.offsetHeight+1;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=toCssUnit(offsetTop);if(!isUpdateHeight){if(rowRest.expandHeight!==expandHeight){isUpdateHeight=true;}}rowRest.expandHeight=expandHeight;}});if(isUpdateHeight){reactData.rowExpandHeightFlag++;(0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)(()=>{updateRowOffsetTop();});}}}};const handleRowExpandScroll=()=>{const{elemStore}=internalData;const rowExpandEl=refRowExpandElem.value;const bodyScrollElem=getRefElem(elemStore['main-body-scroll']);if(rowExpandEl&&bodyScrollElem){rowExpandEl.scrollTop=bodyScrollElem.scrollTop;}};tableMethods={dispatchEvent,getEl(){return refElem.value;},/**
19241
19241
  * 重置表格的一切数据状态
@@ -19783,8 +19783,9 @@ const el=refElem.value;if(!el){return;}const xHandleEl=refScrollXHandleElem.valu
19783
19783
  * 横向 X 可视渲染事件处理
19784
19784
  */triggerScrollXEvent(){const virtualXOpts=computeVirtualXOpts.value;if(virtualXOpts.immediate){loadScrollXData();}else{lazyScrollXData();}},/**
19785
19785
  * 纵向 Y 可视渲染事件处理
19786
- */triggerScrollYEvent(){const virtualYOpts=computeVirtualYOpts.value;if(virtualYOpts.immediate){loadScrollYData();}else{lazyScrollYData();}},triggerBodyScrollEvent(evnt,fixedType){const{scrollYLoad,scrollXLoad}=reactData;const{elemStore,intoRunScroll,lastScrollTop,lastScrollLeft,inWheelScroll,inVirtualScroll,inHeaderScroll,inBodyScroll,scrollRenderType,inFooterScroll}=internalData;if(inWheelScroll||inVirtualScroll||inHeaderScroll||inFooterScroll){return;}const xHandleEl=refScrollXHandleElem.value;const yHandleEl=refScrollYHandleElem.value;const leftScrollElem=getRefElem(elemStore['left-body-scroll']);const bodyScrollElem=getRefElem(elemStore['main-body-scroll']);const rightScrollElem=getRefElem(elemStore['right-body-scroll']);const headerScrollElem=getRefElem(elemStore['main-header-scroll']);const footerScrollElem=getRefElem(elemStore['main-footer-scroll']);const rowExpandEl=refRowExpandElem.value;if(intoRunScroll){return;}if(!bodyScrollElem){return;}if(!xHandleEl){return;}if(!yHandleEl){return;}if(inBodyScroll){if(scrollRenderType!==fixedType){return;}}let scrollTop=yHandleEl.scrollTop;let scrollLeft=xHandleEl.scrollLeft;if(leftScrollElem&&fixedType==='left'){scrollTop=leftScrollElem.scrollTop;}else if(rightScrollElem&&fixedType==='right'){scrollTop=rightScrollElem.scrollTop;}else{scrollTop=bodyScrollElem.scrollTop;scrollLeft=bodyScrollElem.scrollLeft;}const isRollX=scrollLeft!==lastScrollLeft;const isRollY=scrollTop!==lastScrollTop;internalData.inBodyScroll=true;internalData.scrollRenderType=fixedType;if(isRollY){if(fixedType==='left'){setScrollTop(bodyScrollElem,scrollTop);setScrollTop(rightScrollElem,scrollTop);}else if(fixedType==='right'){setScrollTop(bodyScrollElem,scrollTop);setScrollTop(leftScrollElem,scrollTop);}else{setScrollTop(leftScrollElem,scrollTop);setScrollTop(rightScrollElem,scrollTop);}setScrollTop(yHandleEl,scrollTop);setScrollTop(rowExpandEl,scrollTop);syncGanttScrollTop(scrollTop);if(scrollYLoad){$xeTable.triggerScrollYEvent(evnt);}}if(isRollX){setScrollLeft(xHandleEl,scrollLeft);setScrollLeft(headerScrollElem,scrollLeft);setScrollLeft(footerScrollElem,scrollLeft);if(scrollXLoad){$xeTable.triggerScrollXEvent(evnt);}}$xeTable.handleScrollEvent(evnt,isRollY,isRollX,scrollTop,scrollLeft,{type:'body',fixed:fixedType});},triggerHeaderScrollEvent(evnt,fixedType){const{scrollXLoad}=reactData;const{elemStore,intoRunScroll,inWheelScroll,inVirtualScroll,inBodyScroll,inFooterScroll}=internalData;if(inWheelScroll||inVirtualScroll||inBodyScroll||inFooterScroll){return;}const yHandleEl=refScrollYHandleElem.value;const xHandleEl=refScrollXHandleElem.value;const bodyScrollElem=getRefElem(elemStore['main-body-scroll']);const headerScrollElem=getRefElem(elemStore['main-header-scroll']);const footerScrollElem=getRefElem(elemStore['main-footer-scroll']);if(intoRunScroll){return;}if(!headerScrollElem){return;}if(!xHandleEl){return;}if(!yHandleEl){return;}const scrollTop=yHandleEl.scrollTop;const scrollLeft=headerScrollElem.scrollLeft;const isRollX=true;const isRollY=false;internalData.inHeaderScroll=true;setScrollLeft(xHandleEl,scrollLeft);setScrollLeft(footerScrollElem,scrollLeft);setScrollLeft(bodyScrollElem,scrollLeft);if(scrollXLoad){$xeTable.triggerScrollXEvent(evnt);}$xeTable.handleScrollEvent(evnt,isRollY,isRollX,scrollTop,scrollLeft,{type:'header',fixed:fixedType});},triggerFooterScrollEvent(evnt,fixedType){const{scrollXLoad}=reactData;const{elemStore,intoRunScroll,inWheelScroll,inVirtualScroll,inHeaderScroll,inBodyScroll}=internalData;if(inWheelScroll||inVirtualScroll||inHeaderScroll||inBodyScroll){return;}const yHandleEl=refScrollYHandleElem.value;const xHandleEl=refScrollXHandleElem.value;const bodyScrollElem=getRefElem(elemStore['main-body-scroll']);const headerScrollElem=getRefElem(elemStore['main-header-scroll']);const footerScrollElem=getRefElem(elemStore['main-footer-scroll']);if(intoRunScroll){return;}if(!footerScrollElem){return;}if(!xHandleEl){return;}if(!yHandleEl){return;}const scrollTop=yHandleEl.scrollTop;const scrollLeft=footerScrollElem.scrollLeft;const isRollX=true;const isRollY=false;internalData.inFooterScroll=true;setScrollLeft(xHandleEl,scrollLeft);setScrollLeft(headerScrollElem,scrollLeft);setScrollLeft(bodyScrollElem,scrollLeft);if(scrollXLoad){$xeTable.triggerScrollXEvent(evnt);}$xeTable.handleScrollEvent(evnt,isRollY,isRollX,scrollTop,scrollLeft,{type:'footer',fixed:fixedType});},triggerBodyWheelEvent(evnt){const{target,deltaY,deltaX,shiftKey}=evnt;if(target&&/^textarea$/i.test(target.tagName)){return;}const{highlightHoverRow}=tableProps;const{scrollXLoad,scrollYLoad,expandColumn}=reactData;const leftFixedWidth=computeLeftFixedWidth.value;const rightFixedWidth=computeRightFixedWidth.value;if(!(leftFixedWidth||rightFixedWidth||expandColumn)){return;}const{elemStore,lastScrollTop,lastScrollLeft}=internalData;const rowOpts=computeRowOpts.value;const xHandleEl=refScrollXHandleElem.value;const yHandleEl=refScrollYHandleElem.value;const leftScrollElem=getRefElem(elemStore['left-body-scroll']);const headerScrollElem=getRefElem(elemStore['main-header-scroll']);const bodyScrollElem=getRefElem(elemStore['main-body-scroll']);const footerScrollElem=getRefElem(elemStore['main-footer-scroll']);const rightScrollElem=getRefElem(elemStore['right-body-scroll']);const rowExpandEl=refRowExpandElem.value;if(!xHandleEl){return;}if(!yHandleEl){return;}if(!bodyScrollElem){return;}const wheelSpeed=getWheelSpeed(reactData.lastScrollTime);const deltaTop=shiftKey?0:Math.ceil(deltaY*wheelSpeed);const deltaLeft=shiftKey?Math.ceil((shiftKey?deltaY||deltaX:deltaX)*wheelSpeed):0;const isTopWheel=deltaTop<0;const currScrollTop=bodyScrollElem.scrollTop;// 如果滚动位置已经是顶部或底部,则不需要触发
19787
- if(isTopWheel?currScrollTop<=0:currScrollTop>=bodyScrollElem.scrollHeight-bodyScrollElem.clientHeight){return;}const scrollTop=currScrollTop+deltaTop;const scrollLeft=bodyScrollElem.scrollLeft+deltaLeft;const isRollX=scrollLeft!==lastScrollLeft;const isRollY=scrollTop!==lastScrollTop;if(rowOpts.isHover||highlightHoverRow){$xeTable.clearHoverRow();}// 用于鼠标纵向滚轮处理
19786
+ */triggerScrollYEvent(){const virtualYOpts=computeVirtualYOpts.value;if(virtualYOpts.immediate){loadScrollYData();}else{lazyScrollYData();}},triggerBodyScrollEvent(evnt,fixedType){const{scrollYLoad,scrollXLoad}=reactData;const{elemStore,intoRunScroll,lastScrollTop,lastScrollLeft,inWheelScroll,inVirtualScroll,inHeaderScroll,inBodyScroll,scrollRenderType,inFooterScroll}=internalData;if(inWheelScroll||inVirtualScroll||inHeaderScroll||inFooterScroll){return;}const xHandleEl=refScrollXHandleElem.value;const yHandleEl=refScrollYHandleElem.value;const leftScrollElem=getRefElem(elemStore['left-body-scroll']);const bodyScrollElem=getRefElem(elemStore['main-body-scroll']);const rightScrollElem=getRefElem(elemStore['right-body-scroll']);const headerScrollElem=getRefElem(elemStore['main-header-scroll']);const footerScrollElem=getRefElem(elemStore['main-footer-scroll']);const rowExpandEl=refRowExpandElem.value;if(intoRunScroll){return;}if(!bodyScrollElem){return;}if(!xHandleEl){return;}if(!yHandleEl){return;}if(inBodyScroll){if(scrollRenderType!==fixedType){return;}}let scrollTop=yHandleEl.scrollTop;let scrollLeft=xHandleEl.scrollLeft;if(leftScrollElem&&fixedType==='left'){scrollTop=leftScrollElem.scrollTop;}else if(rightScrollElem&&fixedType==='right'){scrollTop=rightScrollElem.scrollTop;}else{scrollTop=bodyScrollElem.scrollTop;scrollLeft=bodyScrollElem.scrollLeft;}const isRollX=scrollLeft!==lastScrollLeft;const isRollY=scrollTop!==lastScrollTop;internalData.inBodyScroll=true;internalData.scrollRenderType=fixedType;if(isRollY){if(fixedType==='left'){setScrollTop(bodyScrollElem,scrollTop);setScrollTop(rightScrollElem,scrollTop);}else if(fixedType==='right'){setScrollTop(bodyScrollElem,scrollTop);setScrollTop(leftScrollElem,scrollTop);}else{setScrollTop(leftScrollElem,scrollTop);setScrollTop(rightScrollElem,scrollTop);}setScrollTop(yHandleEl,scrollTop);setScrollTop(rowExpandEl,scrollTop);syncGanttScrollTop(scrollTop);if(scrollYLoad){$xeTable.triggerScrollYEvent(evnt);}}if(isRollX){setScrollLeft(xHandleEl,scrollLeft);setScrollLeft(headerScrollElem,scrollLeft);setScrollLeft(footerScrollElem,scrollLeft);if(scrollXLoad){$xeTable.triggerScrollXEvent(evnt);}}$xeTable.handleScrollEvent(evnt,isRollY,isRollX,scrollTop,scrollLeft,{type:'body',fixed:fixedType});},triggerHeaderScrollEvent(evnt,fixedType){const{scrollXLoad}=reactData;const{elemStore,intoRunScroll,inWheelScroll,inVirtualScroll,inBodyScroll,inFooterScroll}=internalData;if(inWheelScroll||inVirtualScroll||inBodyScroll||inFooterScroll){return;}const yHandleEl=refScrollYHandleElem.value;const xHandleEl=refScrollXHandleElem.value;const bodyScrollElem=getRefElem(elemStore['main-body-scroll']);const headerScrollElem=getRefElem(elemStore['main-header-scroll']);const footerScrollElem=getRefElem(elemStore['main-footer-scroll']);if(intoRunScroll){return;}if(!headerScrollElem){return;}if(!xHandleEl){return;}if(!yHandleEl){return;}const scrollTop=yHandleEl.scrollTop;const scrollLeft=headerScrollElem.scrollLeft;const isRollX=true;const isRollY=false;internalData.inHeaderScroll=true;setScrollLeft(xHandleEl,scrollLeft);setScrollLeft(footerScrollElem,scrollLeft);setScrollLeft(bodyScrollElem,scrollLeft);if(scrollXLoad){$xeTable.triggerScrollXEvent(evnt);}$xeTable.handleScrollEvent(evnt,isRollY,isRollX,scrollTop,scrollLeft,{type:'header',fixed:fixedType});},triggerFooterScrollEvent(evnt,fixedType){const{scrollXLoad}=reactData;const{elemStore,intoRunScroll,inWheelScroll,inVirtualScroll,inHeaderScroll,inBodyScroll}=internalData;if(inWheelScroll||inVirtualScroll||inHeaderScroll||inBodyScroll){return;}const yHandleEl=refScrollYHandleElem.value;const xHandleEl=refScrollXHandleElem.value;const bodyScrollElem=getRefElem(elemStore['main-body-scroll']);const headerScrollElem=getRefElem(elemStore['main-header-scroll']);const footerScrollElem=getRefElem(elemStore['main-footer-scroll']);if(intoRunScroll){return;}if(!footerScrollElem){return;}if(!xHandleEl){return;}if(!yHandleEl){return;}const scrollTop=yHandleEl.scrollTop;const scrollLeft=footerScrollElem.scrollLeft;const isRollX=true;const isRollY=false;internalData.inFooterScroll=true;setScrollLeft(xHandleEl,scrollLeft);setScrollLeft(headerScrollElem,scrollLeft);setScrollLeft(bodyScrollElem,scrollLeft);if(scrollXLoad){$xeTable.triggerScrollXEvent(evnt);}$xeTable.handleScrollEvent(evnt,isRollY,isRollX,scrollTop,scrollLeft,{type:'footer',fixed:fixedType});},triggerBodyWheelEvent(evnt){const{target,deltaY,deltaX,shiftKey}=evnt;if(target&&/^textarea$/i.test(target.tagName)){return;}// 如果滚轮未移动或者触摸板未变化位置
19787
+ if(!deltaY&&!deltaX){return;}const{highlightHoverRow}=tableProps;const{scrollXLoad,scrollYLoad,expandColumn}=reactData;const leftFixedWidth=computeLeftFixedWidth.value;const rightFixedWidth=computeRightFixedWidth.value;if(!(leftFixedWidth||rightFixedWidth||expandColumn)){return;}const{elemStore,lastScrollTop,lastScrollLeft}=internalData;const rowOpts=computeRowOpts.value;const xHandleEl=refScrollXHandleElem.value;const yHandleEl=refScrollYHandleElem.value;const leftScrollElem=getRefElem(elemStore['left-body-scroll']);const headerScrollElem=getRefElem(elemStore['main-header-scroll']);const bodyScrollElem=getRefElem(elemStore['main-body-scroll']);const footerScrollElem=getRefElem(elemStore['main-footer-scroll']);const rightScrollElem=getRefElem(elemStore['right-body-scroll']);const rowExpandEl=refRowExpandElem.value;if(!xHandleEl){return;}if(!yHandleEl){return;}if(!bodyScrollElem){return;}const wheelSpeed=getWheelSpeed(reactData.lastScrollTime);const deltaTop=shiftKey?0:deltaY*wheelSpeed;const deltaLeft=(shiftKey?deltaX||deltaY:deltaX)*wheelSpeed;const currScrollTop=bodyScrollElem.scrollTop;const currScrollLeft=bodyScrollElem.scrollLeft;const scrollTop=currScrollTop+deltaTop;const scrollLeft=currScrollLeft+deltaLeft;const isRollX=scrollLeft!==lastScrollLeft;const isRollY=scrollTop!==lastScrollTop;if(isRollY){const isTopWheel=deltaTop<0;// 如果滚动位置已经是顶部或底部,则不需要触发
19788
+ if(isTopWheel?currScrollTop<=0:currScrollTop>=bodyScrollElem.scrollHeight-bodyScrollElem.clientHeight){return;}}if(rowOpts.isHover||highlightHoverRow){$xeTable.clearHoverRow();}// 用于鼠标纵向滚轮处理
19788
19789
  if(isRollX){evnt.preventDefault();internalData.inWheelScroll=true;if(browseObj.firefox||browseObj.safari){const currLeftNum=scrollLeft;setScrollLeft(xHandleEl,currLeftNum);setScrollLeft(bodyScrollElem,currLeftNum);setScrollLeft(headerScrollElem,currLeftNum);setScrollLeft(footerScrollElem,currLeftNum);if(scrollXLoad){$xeTable.triggerScrollXEvent(evnt);}$xeTable.handleScrollEvent(evnt,isRollY,isRollX,bodyScrollElem.scrollTop,currLeftNum,{type:'table',fixed:''});}else{wheelScrollLeftTo(scrollLeft,offsetLeft=>{internalData.inWheelScroll=true;const currLeftNum=offsetLeft;setScrollLeft(xHandleEl,currLeftNum);setScrollLeft(bodyScrollElem,currLeftNum);setScrollLeft(headerScrollElem,currLeftNum);setScrollLeft(footerScrollElem,currLeftNum);if(scrollXLoad){$xeTable.triggerScrollXEvent(evnt);}$xeTable.handleScrollEvent(evnt,isRollY,isRollX,bodyScrollElem.scrollTop,currLeftNum,{type:'table',fixed:''});});}}if(isRollY){evnt.preventDefault();internalData.inWheelScroll=true;if(browseObj.firefox||browseObj.safari){const currTopNum=scrollTop;setScrollTop(yHandleEl,currTopNum);setScrollTop(bodyScrollElem,currTopNum);setScrollTop(leftScrollElem,currTopNum);setScrollTop(rightScrollElem,currTopNum);setScrollTop(rowExpandEl,currTopNum);syncGanttScrollTop(currTopNum);if(scrollYLoad){$xeTable.triggerScrollYEvent(evnt);}$xeTable.handleScrollEvent(evnt,isRollY,isRollX,currTopNum,bodyScrollElem.scrollLeft,{type:'table',fixed:''});}else{wheelScrollTopTo(scrollTop-currScrollTop,offsetTop=>{internalData.inWheelScroll=true;const currTopNum=bodyScrollElem.scrollTop+offsetTop;setScrollTop(yHandleEl,currTopNum);setScrollTop(bodyScrollElem,currTopNum);setScrollTop(leftScrollElem,currTopNum);setScrollTop(rightScrollElem,currTopNum);setScrollTop(rowExpandEl,currTopNum);syncGanttScrollTop(currTopNum);if(scrollYLoad){$xeTable.triggerScrollYEvent(evnt);}$xeTable.handleScrollEvent(evnt,isRollY,isRollX,currTopNum,bodyScrollElem.scrollLeft,{type:'table',fixed:''});});}}},triggerVirtualScrollXEvent(evnt){const{scrollXLoad}=reactData;const{elemStore,inWheelScroll,lastScrollTop,inHeaderScroll,inBodyScroll,inFooterScroll}=internalData;if(inHeaderScroll||inBodyScroll||inFooterScroll){return;}if(inWheelScroll){return;}const headerScrollElem=getRefElem(elemStore['main-header-scroll']);const bodyScrollElem=getRefElem(elemStore['main-body-scroll']);const footerScrollElem=getRefElem(elemStore['main-footer-scroll']);const yHandleEl=refScrollYHandleElem.value;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;setScrollLeft(bodyScrollElem,scrollLeft);setScrollLeft(headerScrollElem,scrollLeft);setScrollLeft(footerScrollElem,scrollLeft);if(scrollXLoad){$xeTable.triggerScrollXEvent(evnt);}$xeTable.handleScrollEvent(evnt,isRollY,isRollX,scrollTop,scrollLeft,{type:'table',fixed:''});},triggerVirtualScrollYEvent(evnt){const{scrollYLoad}=reactData;const{elemStore,inWheelScroll,lastScrollLeft,inHeaderScroll,inBodyScroll,inFooterScroll}=internalData;if(inHeaderScroll||inBodyScroll||inFooterScroll){return;}if(inWheelScroll){return;}const leftScrollElem=getRefElem(elemStore['left-body-scroll']);const bodyScrollElem=getRefElem(elemStore['main-body-scroll']);const rightScrollElem=getRefElem(elemStore['right-body-scroll']);const rowExpandEl=refRowExpandElem.value;const xHandleEl=refScrollXHandleElem.value;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;setScrollTop(bodyScrollElem,scrollTop);setScrollTop(leftScrollElem,scrollTop);setScrollTop(rightScrollElem,scrollTop);setScrollTop(rowExpandEl,scrollTop);syncGanttScrollTop(scrollTop);if(scrollYLoad){$xeTable.triggerScrollYEvent(evnt);}$xeTable.handleScrollEvent(evnt,isRollY,isRollX,scrollTop,scrollLeft,{type:'table',fixed:''});},/**
19789
19790
  * 对于树形结构中,可以直接滚动到指定深层节点中
19790
19791
  * 对于某些特定的场景可能会用到,比如定位到某一节点