vxe-table 4.15.0-beta.1 → 4.15.0-beta.3
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/table.js +70 -12
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/lib/index.umd.js +12 -12
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/table/src/table.js +10 -10
- 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 +1 -1
- package/packages/table/src/table.ts +70 -12
- /package/es/{iconfont.1753080055966.ttf → iconfont.1753246478170.ttf} +0 -0
- /package/es/{iconfont.1753080055966.woff → iconfont.1753246478170.woff} +0 -0
- /package/es/{iconfont.1753080055966.woff2 → iconfont.1753246478170.woff2} +0 -0
- /package/lib/{iconfont.1753080055966.ttf → iconfont.1753246478170.ttf} +0 -0
- /package/lib/{iconfont.1753080055966.woff → iconfont.1753246478170.woff} +0 -0
- /package/lib/{iconfont.1753080055966.woff2 → iconfont.1753246478170.woff2} +0 -0
package/es/table/src/table.js
CHANGED
|
@@ -3367,6 +3367,13 @@ export default defineVxeComponent({
|
|
|
3367
3367
|
}
|
|
3368
3368
|
reactData.isRowLoading = false;
|
|
3369
3369
|
handleRecalculateStyle(false, false, false);
|
|
3370
|
+
// 如果是自动行高,特殊情况需调用 recalculate 手动刷新
|
|
3371
|
+
if (!props.showOverflow) {
|
|
3372
|
+
setTimeout(() => {
|
|
3373
|
+
handleLazyRecalculate(false, true, true);
|
|
3374
|
+
setTimeout(() => handleLazyRecalculate(false, true, true), 3000);
|
|
3375
|
+
}, 2000);
|
|
3376
|
+
}
|
|
3370
3377
|
// 是否变更虚拟滚动
|
|
3371
3378
|
if (oldScrollYLoad === sYLoad) {
|
|
3372
3379
|
restoreScrollLocation($xeTable, targetScrollLeft, targetScrollTop)
|
|
@@ -3399,6 +3406,7 @@ export default defineVxeComponent({
|
|
|
3399
3406
|
handleDefaultRadioChecked();
|
|
3400
3407
|
handleDefaultRowExpand();
|
|
3401
3408
|
handleDefaultTreeExpand();
|
|
3409
|
+
handleDefaultRowGroupExpand();
|
|
3402
3410
|
handleDefaultMergeCells();
|
|
3403
3411
|
handleDefaultMergeFooterItems();
|
|
3404
3412
|
nextTick(() => setTimeout(() => $xeTable.recalculate()));
|
|
@@ -3814,6 +3822,22 @@ export default defineVxeComponent({
|
|
|
3814
3822
|
}, 30);
|
|
3815
3823
|
});
|
|
3816
3824
|
};
|
|
3825
|
+
/**
|
|
3826
|
+
* 处理默认展开分组行
|
|
3827
|
+
*/
|
|
3828
|
+
const handleDefaultRowGroupExpand = () => {
|
|
3829
|
+
const { isRowGroupStatus } = reactData;
|
|
3830
|
+
if (isRowGroupStatus) {
|
|
3831
|
+
const aggregateOpts = computeAggregateOpts.value;
|
|
3832
|
+
const { expandAll, expandGroupFields } = aggregateOpts;
|
|
3833
|
+
if (expandAll) {
|
|
3834
|
+
$xeTable.setAllRowGroupExpand(true);
|
|
3835
|
+
}
|
|
3836
|
+
else if (expandGroupFields && expandGroupFields.length) {
|
|
3837
|
+
$xeTable.setRowGroupExpandByField(expandGroupFields, true);
|
|
3838
|
+
}
|
|
3839
|
+
}
|
|
3840
|
+
};
|
|
3817
3841
|
const handleCheckAllEvent = (evnt, value) => {
|
|
3818
3842
|
handleCheckedAllCheckboxRow(value);
|
|
3819
3843
|
if (evnt) {
|
|
@@ -5772,8 +5796,7 @@ export default defineVxeComponent({
|
|
|
5772
5796
|
return nextTick();
|
|
5773
5797
|
},
|
|
5774
5798
|
setSort(sortConfs, isUpdate) {
|
|
5775
|
-
|
|
5776
|
-
return handleSortEvent(new Event('click'), sortConfs, isUpdate);
|
|
5799
|
+
return handleSortEvent(null, sortConfs, isUpdate);
|
|
5777
5800
|
},
|
|
5778
5801
|
setSortByEvent(evnt, sortConfs, isUpdate) {
|
|
5779
5802
|
return handleSortEvent(evnt, sortConfs, isUpdate);
|
|
@@ -6207,6 +6230,32 @@ export default defineVxeComponent({
|
|
|
6207
6230
|
}
|
|
6208
6231
|
return nextTick();
|
|
6209
6232
|
},
|
|
6233
|
+
setRowGroupExpandByField(groupFields, expanded) {
|
|
6234
|
+
const { isRowGroupStatus } = reactData;
|
|
6235
|
+
const aggregateOpts = computeAggregateOpts.value;
|
|
6236
|
+
const { childrenField } = aggregateOpts;
|
|
6237
|
+
if (groupFields) {
|
|
6238
|
+
if (!XEUtils.isArray(groupFields)) {
|
|
6239
|
+
groupFields = [groupFields];
|
|
6240
|
+
}
|
|
6241
|
+
if (isRowGroupStatus) {
|
|
6242
|
+
const rows = [];
|
|
6243
|
+
const gfKeys = {};
|
|
6244
|
+
groupFields.forEach(groupField => {
|
|
6245
|
+
gfKeys[groupField] = true;
|
|
6246
|
+
});
|
|
6247
|
+
XEUtils.eachTree(internalData.afterGroupFullData, (row) => {
|
|
6248
|
+
if (row.isAggregate && gfKeys[row.groupField]) {
|
|
6249
|
+
rows.push(row);
|
|
6250
|
+
}
|
|
6251
|
+
}, { children: childrenField });
|
|
6252
|
+
if (rows.length) {
|
|
6253
|
+
return handleRowGroupVirtualExpand(rows, expanded);
|
|
6254
|
+
}
|
|
6255
|
+
}
|
|
6256
|
+
}
|
|
6257
|
+
return nextTick();
|
|
6258
|
+
},
|
|
6210
6259
|
setAllRowGroupExpand(expanded) {
|
|
6211
6260
|
const { tableFullGroupData } = internalData;
|
|
6212
6261
|
const aggregateOpts = computeAggregateOpts.value;
|
|
@@ -6424,8 +6473,6 @@ export default defineVxeComponent({
|
|
|
6424
6473
|
},
|
|
6425
6474
|
/**
|
|
6426
6475
|
* 如果有滚动条,则滚动到对应的位置
|
|
6427
|
-
* @param {Number} scrollLeft 左距离
|
|
6428
|
-
* @param {Number} scrollTop 上距离
|
|
6429
6476
|
*/
|
|
6430
6477
|
scrollTo(scrollLeft, scrollTop) {
|
|
6431
6478
|
const { elemStore } = internalData;
|
|
@@ -6437,6 +6484,12 @@ export default defineVxeComponent({
|
|
|
6437
6484
|
const xHandleEl = refScrollXHandleElem.value;
|
|
6438
6485
|
const yHandleEl = refScrollYHandleElem.value;
|
|
6439
6486
|
internalData.intoRunScroll = true;
|
|
6487
|
+
if (scrollLeft) {
|
|
6488
|
+
if (!XEUtils.isNumber(scrollLeft)) {
|
|
6489
|
+
scrollTop = scrollLeft.top;
|
|
6490
|
+
scrollLeft = scrollLeft.left;
|
|
6491
|
+
}
|
|
6492
|
+
}
|
|
6440
6493
|
if (XEUtils.isNumber(scrollLeft)) {
|
|
6441
6494
|
setScrollLeft(xHandleEl, scrollLeft);
|
|
6442
6495
|
setScrollLeft(bodyScrollElem, scrollLeft);
|
|
@@ -7865,7 +7918,7 @@ export default defineVxeComponent({
|
|
|
7865
7918
|
evnt.preventDefault();
|
|
7866
7919
|
const { column } = params;
|
|
7867
7920
|
const { columnStore, overflowX, scrollbarHeight } = reactData;
|
|
7868
|
-
const {
|
|
7921
|
+
const { visibleColumn } = internalData;
|
|
7869
7922
|
const { leftList, rightList } = columnStore;
|
|
7870
7923
|
const resizableOpts = computeResizableOpts.value;
|
|
7871
7924
|
const osbHeight = overflowX ? scrollbarHeight : 0;
|
|
@@ -7883,24 +7936,29 @@ export default defineVxeComponent({
|
|
|
7883
7936
|
const { clientX: dragClientX } = evnt;
|
|
7884
7937
|
const dragBtnElem = evnt.target;
|
|
7885
7938
|
let resizeColumn = column;
|
|
7886
|
-
|
|
7939
|
+
const isDragGroupCol = column.children && column.children.length;
|
|
7940
|
+
if (isDragGroupCol) {
|
|
7887
7941
|
XEUtils.eachTree(column.children, childColumn => {
|
|
7888
7942
|
resizeColumn = childColumn;
|
|
7889
7943
|
});
|
|
7890
7944
|
}
|
|
7891
|
-
|
|
7892
|
-
|
|
7893
|
-
|
|
7894
|
-
|
|
7895
|
-
|
|
7945
|
+
let cell = dragBtnElem.parentElement;
|
|
7946
|
+
if (isDragGroupCol) {
|
|
7947
|
+
const trEl = cell ? cell.parentElement : null;
|
|
7948
|
+
const theadEl = trEl ? trEl.parentElement : null;
|
|
7949
|
+
cell = theadEl ? theadEl.querySelector(`.vxe-header--column[colid="${resizeColumn.id}"]`) : null;
|
|
7950
|
+
}
|
|
7951
|
+
if (!cell) {
|
|
7896
7952
|
return;
|
|
7897
7953
|
}
|
|
7954
|
+
const cellParams = XEUtils.assign(params, { cell });
|
|
7955
|
+
let dragLeft = 0;
|
|
7898
7956
|
const tableRect = tableEl.getBoundingClientRect();
|
|
7899
7957
|
const rightContainerRect = rightContainerElem ? rightContainerElem.getBoundingClientRect() : null;
|
|
7900
7958
|
const cellRect = cell.getBoundingClientRect();
|
|
7901
7959
|
const dragBtnRect = dragBtnElem.getBoundingClientRect();
|
|
7902
7960
|
const dragBtnWidth = dragBtnElem.clientWidth;
|
|
7903
|
-
const dragBtnOffsetWidth =
|
|
7961
|
+
const dragBtnOffsetWidth = XEUtils.floor(dragBtnWidth / 2);
|
|
7904
7962
|
const dragPosLeft = dragBtnRect.x - tableRect.x + dragBtnOffsetWidth;
|
|
7905
7963
|
const minInterval = getColReMinWidth(cellParams) - dragBtnOffsetWidth; // 列之间的最小间距
|
|
7906
7964
|
const dragMinLeft = isRightFixed ? 0 : (cellRect.x - tableRect.x + dragBtnWidth + minInterval);
|
package/es/ui/index.js
CHANGED
package/es/ui/src/log.js
CHANGED
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.15.0-beta.
|
|
3141
|
+
const version = "4.15.0-beta.3";
|
|
3142
3142
|
core_.VxeUI.version = version;
|
|
3143
3143
|
core_.VxeUI.tableVersion = version;
|
|
3144
3144
|
core_.VxeUI.setConfig({
|
|
@@ -3628,7 +3628,7 @@ var esnext_iterator_some = __webpack_require__(7550);
|
|
|
3628
3628
|
const {
|
|
3629
3629
|
log: log_log
|
|
3630
3630
|
} = core_.VxeUI;
|
|
3631
|
-
const log_version = `table v${"4.15.0-beta.
|
|
3631
|
+
const log_version = `table v${"4.15.0-beta.3"}`;
|
|
3632
3632
|
const warnLog = log_log.create('warn', log_version);
|
|
3633
3633
|
const errLog = log_log.create('error', log_version);
|
|
3634
3634
|
;// ./packages/table/src/columnInfo.ts
|
|
@@ -11163,11 +11163,12 @@ if(!(props.height||props.maxHeight)){errLog('vxe.error.reqProp',['height | max-h
|
|
|
11163
11163
|
// warnLog('vxe.error.reqProp', ['table.show-overflow'])
|
|
11164
11164
|
// }
|
|
11165
11165
|
if(props.spanMethod){errLog('vxe.error.scrollErrProp',['table.span-method']);}}handleReserveStatus();$xeTable.checkSelectionStatus();return new Promise(resolve=>{(0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)().then(()=>handleRecalculateStyle(false,false,false)).then(()=>{handleRecalculateStyle(false,true,true);updateRowOffsetTop();}).then(()=>{let targetScrollLeft=lastScrollLeft;let targetScrollTop=lastScrollTop;const virtualXOpts=computeVirtualXOpts.value;const virtualYOpts=computeVirtualYOpts.value;// 是否在更新数据之后自动滚动重置滚动条
|
|
11166
|
-
if(virtualXOpts.scrollToLeftOnChange){targetScrollLeft=0;}if(virtualYOpts.scrollToTopOnChange){targetScrollTop=0;}reactData.isRowLoading=false;handleRecalculateStyle(false,false,false);//
|
|
11166
|
+
if(virtualXOpts.scrollToLeftOnChange){targetScrollLeft=0;}if(virtualYOpts.scrollToTopOnChange){targetScrollTop=0;}reactData.isRowLoading=false;handleRecalculateStyle(false,false,false);// 如果是自动行高,特殊情况需调用 recalculate 手动刷新
|
|
11167
|
+
if(!props.showOverflow){setTimeout(()=>{handleLazyRecalculate(false,true,true);setTimeout(()=>handleLazyRecalculate(false,true,true),3000);},2000);}// 是否变更虚拟滚动
|
|
11167
11168
|
if(oldScrollYLoad===sYLoad){restoreScrollLocation($xeTable,targetScrollLeft,targetScrollTop).then(()=>{handleRecalculateStyle(false,true,true);updateRowOffsetTop();resolve();});}else{setTimeout(()=>{restoreScrollLocation($xeTable,targetScrollLeft,targetScrollTop).then(()=>{handleRecalculateStyle(false,true,true);updateRowOffsetTop();resolve();});});}});});});};/**
|
|
11168
11169
|
* 处理数据加载默认行为
|
|
11169
11170
|
* 默认执行一次,除非被重置
|
|
11170
|
-
*/const handleLoadDefaults=()=>{handleDefaultSelectionChecked();handleDefaultRadioChecked();handleDefaultRowExpand();handleDefaultTreeExpand();handleDefaultMergeCells();handleDefaultMergeFooterItems();(0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)(()=>setTimeout(()=>$xeTable.recalculate()));};/**
|
|
11171
|
+
*/const handleLoadDefaults=()=>{handleDefaultSelectionChecked();handleDefaultRadioChecked();handleDefaultRowExpand();handleDefaultTreeExpand();handleDefaultRowGroupExpand();handleDefaultMergeCells();handleDefaultMergeFooterItems();(0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)(()=>setTimeout(()=>$xeTable.recalculate()));};/**
|
|
11171
11172
|
* 处理初始化的默认行为
|
|
11172
11173
|
* 只会执行一次
|
|
11173
11174
|
*/const handleInitDefaults=()=>{handleDefaultSort();};const handleTableColumn=()=>{const{scrollXLoad}=reactData;const{visibleColumn,scrollXStore,fullColumnIdData}=internalData;const tableColumn=scrollXLoad?visibleColumn.slice(scrollXStore.startIndex,scrollXStore.endIndex):visibleColumn.slice(0);tableColumn.forEach((column,$index)=>{const colid=column.id;const colRest=fullColumnIdData[colid];if(colRest){colRest.$index=$index;}});reactData.tableColumn=tableColumn;};const handleUpdateColumn=()=>{const columnList=external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().orderBy(internalData.collectColumn,'renderSortNumber');internalData.collectColumn=columnList;const tableFullColumn=getColumnList(columnList);internalData.tableFullColumn=tableFullColumn;cacheColumnMap();};const loadScrollXData=()=>{const{isScrollXBig}=reactData;const{mergeBodyList,mergeFooterList,scrollXStore}=internalData;const{preloadSize,startIndex,endIndex,offsetSize}=scrollXStore;const{toVisibleIndex,visibleSize}=handleVirtualXVisible();const offsetItem={startIndex:Math.max(0,isScrollXBig?toVisibleIndex-1:toVisibleIndex-1-offsetSize-preloadSize),endIndex:isScrollXBig?toVisibleIndex+visibleSize:toVisibleIndex+visibleSize+offsetSize+preloadSize};scrollXStore.visibleStartIndex=toVisibleIndex-1;scrollXStore.visibleEndIndex=toVisibleIndex+visibleSize+1;calculateMergerOffsetIndex(mergeBodyList.concat(mergeFooterList),offsetItem,'col');const{startIndex:offsetStartIndex,endIndex:offsetEndIndex}=offsetItem;if(toVisibleIndex<=startIndex||toVisibleIndex>=endIndex-visibleSize-1){if(startIndex!==offsetStartIndex||endIndex!==offsetEndIndex){scrollXStore.startIndex=offsetStartIndex;scrollXStore.endIndex=offsetEndIndex;$xeTable.updateScrollXData();}}$xeTable.closeTooltip();};// 获取所有的列,排除分组
|
|
@@ -11217,7 +11218,9 @@ const matchObj=external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe
|
|
|
11217
11218
|
* @param rows
|
|
11218
11219
|
* @param expanded
|
|
11219
11220
|
* @returns
|
|
11220
|
-
*/const handleRowGroupVirtualExpand=(rows,expanded)=>{return handleRowGroupBaseExpand(rows,expanded).then(()=>{handleVirtualTreeToList();$xeTable.handleTableData();reactData.rowGroupExpandedFlag++;updateAfterDataIndex();return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();}).then(()=>{return handleLazyRecalculate(true,true,true);}).then(()=>{setTimeout(()=>{$xeTable.updateCellAreas();},30);});}
|
|
11221
|
+
*/const handleRowGroupVirtualExpand=(rows,expanded)=>{return handleRowGroupBaseExpand(rows,expanded).then(()=>{handleVirtualTreeToList();$xeTable.handleTableData();reactData.rowGroupExpandedFlag++;updateAfterDataIndex();return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();}).then(()=>{return handleLazyRecalculate(true,true,true);}).then(()=>{setTimeout(()=>{$xeTable.updateCellAreas();},30);});};/**
|
|
11222
|
+
* 处理默认展开分组行
|
|
11223
|
+
*/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);}};/**
|
|
11221
11224
|
* 纵向 Y 可视渲染处理
|
|
11222
11225
|
*/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{scrollXLoad,scrollYLoad,isAllOverflow}=reactData;const{lcsTimeout}=internalData;reactData.lazScrollLoading=true;if(lcsTimeout){clearTimeout(lcsTimeout);}internalData.lcsTimeout=setTimeout(()=>{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 dispatchEvent=(type,params,evnt)=>{emit(type,createEvent(evnt,{$table:$xeTable,$grid:$xeGrid},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
|
|
11223
11226
|
$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;// 是否展开行
|
|
@@ -11436,8 +11439,7 @@ reactData.currentRow=row;if(rowOpts.isCurrent||props.highlightCurrentRow){if(el)
|
|
|
11436
11439
|
if(isMouseSelected){$xeTable.addCellSelectedClass();}});},/**
|
|
11437
11440
|
* 用于当前列,手动清空当前高亮的状态
|
|
11438
11441
|
*/clearCurrentColumn(){reactData.currentColumn=null;return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();},setPendingRow(rows,status){const{handleGetRowId}=createHandleGetRowId($xeTable);const{pendingRowMaps}=internalData;if(rows&&!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(rows)){rows=[rows];}if(status){rows.forEach(row=>{const rowid=handleGetRowId(row);if(rowid&&!pendingRowMaps[rowid]){pendingRowMaps[rowid]=row;}});}else{rows.forEach(row=>{const rowid=handleGetRowId(row);if(rowid&&pendingRowMaps[rowid]){delete pendingRowMaps[rowid];}});}reactData.pendingRowFlag++;return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();},togglePendingRow(rows){const{handleGetRowId}=createHandleGetRowId($xeTable);const{pendingRowMaps}=internalData;if(rows&&!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(rows)){rows=[rows];}rows.forEach(row=>{const rowid=handleGetRowId(row);if(rowid){if(pendingRowMaps[rowid]){delete pendingRowMaps[rowid];}else{pendingRowMaps[rowid]=row;}}});reactData.pendingRowFlag++;return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();},hasPendingByRow(row){return tableMethods.isPendingByRow(row);},isPendingByRow(row){const{pendingRowMaps}=internalData;const rowid=getRowid($xeTable,row);return!!pendingRowMaps[rowid];},getPendingRecords(){const{fullAllDataRowIdData,pendingRowMaps}=internalData;const insertRecords=[];external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(pendingRowMaps,(row,rowid)=>{if(fullAllDataRowIdData[rowid]){insertRecords.push(row);}});return insertRecords;},clearPendingRow(){internalData.pendingRowMaps={};reactData.pendingRowFlag++;return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();},sort(sortConfs,sortOrder){const sortOpts=computeSortOpts.value;const{multiple,remote,orders}=sortOpts;if(sortConfs){if(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(sortConfs)){sortConfs=[{field:sortConfs,order:sortOrder}];}}if(!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(sortConfs)){sortConfs=[sortConfs];}if(sortConfs.length){if(!multiple){clearAllSort();}(multiple?sortConfs:[sortConfs[0]]).forEach((confs,index)=>{let{field,order}=confs;let column=field;if(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(field)){column=tableMethods.getColumnByField(field);}if(column&&column.sortable){if(orders&&orders.indexOf(order)===-1){order=getNextSortOrder(column);}if(column.order!==order){column.order=order;}column.sortTime=Date.now()+index;}});// 如果是服务端排序,则跳过本地排序处理
|
|
11439
|
-
if(!remote){tablePrivateMethods.handleTableData(true);}return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)().then(()=>{updateRowOffsetTop();tableMethods.updateCellAreas();return updateStyle();});}return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();},setSort(sortConfs,isUpdate){
|
|
11440
|
-
return handleSortEvent(new Event('click'),sortConfs,isUpdate);},setSortByEvent(evnt,sortConfs,isUpdate){return handleSortEvent(evnt,sortConfs,isUpdate);},/**
|
|
11442
|
+
if(!remote){tablePrivateMethods.handleTableData(true);}return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)().then(()=>{updateRowOffsetTop();tableMethods.updateCellAreas();return updateStyle();});}return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();},setSort(sortConfs,isUpdate){return handleSortEvent(null,sortConfs,isUpdate);},setSortByEvent(evnt,sortConfs,isUpdate){return handleSortEvent(evnt,sortConfs,isUpdate);},/**
|
|
11441
11443
|
* 清空指定列的排序条件
|
|
11442
11444
|
* 如果为空则清空所有列的排序条件
|
|
11443
11445
|
* @param {String} fieldOrColumn 列或字段名
|
|
@@ -11472,7 +11474,7 @@ rowExpandedMaps={};internalData.rowExpandedMaps=rowExpandedMaps;rows=rows.slice(
|
|
|
11472
11474
|
*/isRowExpandByRow(row){const{rowExpandedFlag}=reactData;const{rowExpandedMaps}=internalData;const rowid=getRowid($xeTable,row);return!!rowExpandedFlag&&!!rowExpandedMaps[rowid];},isExpandByRow(row){// 已废弃
|
|
11473
11475
|
warnLog('vxe.error.delFunc',['isExpandByRow','isRowExpandByRow']);return tableMethods.isRowExpandByRow(row);},/**
|
|
11474
11476
|
* 手动清空展开行状态,数据会恢复成未展开的状态
|
|
11475
|
-
*/clearRowExpand(){const{tableFullData,scrollYStore}=internalData;const expandOpts=computeExpandOpts.value;const{reserve}=expandOpts;const expList=$xeTable.getRowExpandRecords();internalData.rowExpandedMaps={};if(reserve){tableFullData.forEach(row=>handleRowExpandReserve(row,false));}reactData.rowExpandedFlag++;scrollYStore.startIndex=0;scrollYStore.endIndex=1;return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)().then(()=>{if(expList.length){return handleLazyRecalculate(true,true,true);}}).then(()=>{updateRowOffsetTop();updateRowExpandStyle();handleRowExpandScroll();return $xeTable.updateCellAreas();});},clearRowExpandReserve(){internalData.rowExpandedReserveRowMap={};return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();},getRowExpandRecords(){const rest=[];external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(internalData.rowExpandedMaps,item=>{if(item){rest.push(item);}});return rest;},setRowGroups(fieldOrColumns){const{aggregateConfig,rowGroupConfig}=props;const aggregateOpts=computeAggregateOpts.value;const{maxGroupSize}=aggregateOpts;if(!(aggregateConfig||rowGroupConfig)){errLog('vxe.error.reqProp',['aggregate-config']);return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();}const confList=fieldOrColumns?external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(fieldOrColumns)?fieldOrColumns:[fieldOrColumns]:[];if(maxGroupSize&&confList.length>maxGroupSize){if(core_.VxeUI.modal){core_.VxeUI.modal.message({status:'error',content:table_getI18n('vxe.table.maxGroupCol',[maxGroupSize])});}return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();}if(confList.length){handleUpdateRowGroup(confList.map(fieldOrColumn=>{return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(fieldOrColumn)?fieldOrColumn:fieldOrColumn.field;}));return loadTableData(internalData.tableSynchData,true);}return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();},clearRowGroups(){const{aggregateConfig,rowGroupConfig}=props;if(!(aggregateConfig||rowGroupConfig)){errLog('vxe.error.reqProp',['aggregate-config']);return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();}handleUpdateRowGroup([]);return loadTableData(internalData.tableSynchData,true);},isRowGroupRecord(row){warnLog('vxe.error.delFunc',['isRowGroupRecord','isAggregateRecord']);return $xeTable.isAggregateRecord(row);},isRowGroupExpandByRow(row){warnLog('vxe.error.delFunc',['isRowGroupExpandByRow','isAggregateExpandByRow']);return $xeTable.isAggregateExpandByRow(row);},isAggregateRecord(row){const{isRowGroupStatus}=reactData;return isRowGroupStatus&&row.isAggregate;},getAggregateContentByRow(row){const{isRowGroupStatus}=reactData;return isRowGroupStatus&&row&&row.isAggregate?row.groupContent:'';},getAggregateRowChildren(row){const aggregateOpts=computeAggregateOpts.value;const{childrenField,mapChildrenField}=aggregateOpts;const{isRowGroupStatus}=reactData;return isRowGroupStatus&&row&&row.isAggregate&&childrenField&&mapChildrenField?row[mapChildrenField]||[]:[];},isAggregateExpandByRow(row){const{rowGroupExpandedFlag}=reactData;const{rowGroupExpandedMaps}=internalData;return!!rowGroupExpandedFlag&&!!rowGroupExpandedMaps[getRowid($xeTable,row)];},setRowGroupExpand(rows,expanded){if(rows){if(!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(rows)){rows=[rows];}return handleRowGroupVirtualExpand(rows,expanded);}return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();},setAllRowGroupExpand(expanded){const{tableFullGroupData}=internalData;const aggregateOpts=computeAggregateOpts.value;const{mapChildrenField}=aggregateOpts;const rgExpandedMaps={};if(expanded&&mapChildrenField){external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(tableFullGroupData,row=>{if(row[mapChildrenField]&&row[mapChildrenField].length){rgExpandedMaps[getRowid($xeTable,row)]=row;}},{children:mapChildrenField});}internalData.rowGroupExpandedMaps=rgExpandedMaps;handleVirtualTreeToList();$xeTable.handleTableData();updateAfterDataIndex();reactData.rowGroupExpandedFlag++;return handleLazyRecalculate(true,true,true);},clearRowGroupExpand(){internalData.rowGroupExpandedMaps={};handleVirtualTreeToList();$xeTable.handleTableData();updateAfterDataIndex();reactData.rowGroupExpandedFlag++;return handleLazyRecalculate(true,true,true);},getTreeExpandRecords(){const rest=[];external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(internalData.treeExpandedMaps,item=>{if(item){rest.push(item);}});return rest;},/**
|
|
11477
|
+
*/clearRowExpand(){const{tableFullData,scrollYStore}=internalData;const expandOpts=computeExpandOpts.value;const{reserve}=expandOpts;const expList=$xeTable.getRowExpandRecords();internalData.rowExpandedMaps={};if(reserve){tableFullData.forEach(row=>handleRowExpandReserve(row,false));}reactData.rowExpandedFlag++;scrollYStore.startIndex=0;scrollYStore.endIndex=1;return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)().then(()=>{if(expList.length){return handleLazyRecalculate(true,true,true);}}).then(()=>{updateRowOffsetTop();updateRowExpandStyle();handleRowExpandScroll();return $xeTable.updateCellAreas();});},clearRowExpandReserve(){internalData.rowExpandedReserveRowMap={};return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();},getRowExpandRecords(){const rest=[];external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(internalData.rowExpandedMaps,item=>{if(item){rest.push(item);}});return rest;},setRowGroups(fieldOrColumns){const{aggregateConfig,rowGroupConfig}=props;const aggregateOpts=computeAggregateOpts.value;const{maxGroupSize}=aggregateOpts;if(!(aggregateConfig||rowGroupConfig)){errLog('vxe.error.reqProp',['aggregate-config']);return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();}const confList=fieldOrColumns?external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(fieldOrColumns)?fieldOrColumns:[fieldOrColumns]:[];if(maxGroupSize&&confList.length>maxGroupSize){if(core_.VxeUI.modal){core_.VxeUI.modal.message({status:'error',content:table_getI18n('vxe.table.maxGroupCol',[maxGroupSize])});}return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();}if(confList.length){handleUpdateRowGroup(confList.map(fieldOrColumn=>{return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(fieldOrColumn)?fieldOrColumn:fieldOrColumn.field;}));return loadTableData(internalData.tableSynchData,true);}return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();},clearRowGroups(){const{aggregateConfig,rowGroupConfig}=props;if(!(aggregateConfig||rowGroupConfig)){errLog('vxe.error.reqProp',['aggregate-config']);return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();}handleUpdateRowGroup([]);return loadTableData(internalData.tableSynchData,true);},isRowGroupRecord(row){warnLog('vxe.error.delFunc',['isRowGroupRecord','isAggregateRecord']);return $xeTable.isAggregateRecord(row);},isRowGroupExpandByRow(row){warnLog('vxe.error.delFunc',['isRowGroupExpandByRow','isAggregateExpandByRow']);return $xeTable.isAggregateExpandByRow(row);},isAggregateRecord(row){const{isRowGroupStatus}=reactData;return isRowGroupStatus&&row.isAggregate;},getAggregateContentByRow(row){const{isRowGroupStatus}=reactData;return isRowGroupStatus&&row&&row.isAggregate?row.groupContent:'';},getAggregateRowChildren(row){const aggregateOpts=computeAggregateOpts.value;const{childrenField,mapChildrenField}=aggregateOpts;const{isRowGroupStatus}=reactData;return isRowGroupStatus&&row&&row.isAggregate&&childrenField&&mapChildrenField?row[mapChildrenField]||[]:[];},isAggregateExpandByRow(row){const{rowGroupExpandedFlag}=reactData;const{rowGroupExpandedMaps}=internalData;return!!rowGroupExpandedFlag&&!!rowGroupExpandedMaps[getRowid($xeTable,row)];},setRowGroupExpand(rows,expanded){if(rows){if(!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(rows)){rows=[rows];}return handleRowGroupVirtualExpand(rows,expanded);}return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();},setRowGroupExpandByField(groupFields,expanded){const{isRowGroupStatus}=reactData;const aggregateOpts=computeAggregateOpts.value;const{childrenField}=aggregateOpts;if(groupFields){if(!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(groupFields)){groupFields=[groupFields];}if(isRowGroupStatus){const rows=[];const gfKeys={};groupFields.forEach(groupField=>{gfKeys[groupField]=true;});external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(internalData.afterGroupFullData,row=>{if(row.isAggregate&&gfKeys[row.groupField]){rows.push(row);}},{children:childrenField});if(rows.length){return handleRowGroupVirtualExpand(rows,expanded);}}}return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();},setAllRowGroupExpand(expanded){const{tableFullGroupData}=internalData;const aggregateOpts=computeAggregateOpts.value;const{mapChildrenField}=aggregateOpts;const rgExpandedMaps={};if(expanded&&mapChildrenField){external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(tableFullGroupData,row=>{if(row[mapChildrenField]&&row[mapChildrenField].length){rgExpandedMaps[getRowid($xeTable,row)]=row;}},{children:mapChildrenField});}internalData.rowGroupExpandedMaps=rgExpandedMaps;handleVirtualTreeToList();$xeTable.handleTableData();updateAfterDataIndex();reactData.rowGroupExpandedFlag++;return handleLazyRecalculate(true,true,true);},clearRowGroupExpand(){internalData.rowGroupExpandedMaps={};handleVirtualTreeToList();$xeTable.handleTableData();updateAfterDataIndex();reactData.rowGroupExpandedFlag++;return handleLazyRecalculate(true,true,true);},getTreeExpandRecords(){const rest=[];external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(internalData.treeExpandedMaps,item=>{if(item){rest.push(item);}});return rest;},/**
|
|
11476
11478
|
* 判断树节点是否懒加载完成
|
|
11477
11479
|
* @param {Row} row 行对象
|
|
11478
11480
|
*/isTreeExpandLoaded(row){const{fullAllDataRowIdData}=internalData;const rowRest=fullAllDataRowIdData[getRowid($xeTable,row)];return rowRest&&!!rowRest.treeLoaded;},clearTreeExpandLoaded(rows){const{fullAllDataRowIdData,treeExpandedMaps}=internalData;const treeOpts=computeTreeOpts.value;const{transform}=treeOpts;if(rows){if(!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(rows)){rows=[rows];}rows.forEach(row=>{const rowid=getRowid($xeTable,row);const rowRest=fullAllDataRowIdData[rowid];if(rowRest){rowRest.treeLoaded=false;if(treeExpandedMaps[rowid]){delete treeExpandedMaps[rowid];}}});}else{external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(fullAllDataRowIdData,rowRest=>{rowRest.treeLoaded=false;});}internalData.treeExpandedMaps={};if(transform){handleVirtualTreeToList();$xeTable.handleTableData();}reactData.treeExpandedFlag++;return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();},/**
|
|
@@ -11500,9 +11502,7 @@ if(transform){return handleVirtualTreeExpand(rows,expanded);}else{return handleB
|
|
|
11500
11502
|
* 获取表格的滚动状态
|
|
11501
11503
|
*/getScroll(){const{scrollXLoad,scrollYLoad}=reactData;const{elemStore}=internalData;const bodyScrollElem=getRefElem(elemStore['main-body-scroll']);return{virtualX:scrollXLoad,virtualY:scrollYLoad,scrollTop:bodyScrollElem?bodyScrollElem.scrollTop:0,scrollLeft:bodyScrollElem?bodyScrollElem.scrollLeft:0};},/**
|
|
11502
11504
|
* 如果有滚动条,则滚动到对应的位置
|
|
11503
|
-
|
|
11504
|
-
* @param {Number} scrollTop 上距离
|
|
11505
|
-
*/scrollTo(scrollLeft,scrollTop){const{elemStore}=internalData;const headerScrollElem=getRefElem(elemStore['main-header-scroll']);const bodyScrollElem=getRefElem(elemStore['main-body-scroll']);const footerScrollElem=getRefElem(elemStore['main-footer-scroll']);const leftScrollElem=getRefElem(elemStore['left-body-scroll']);const rightScrollElem=getRefElem(elemStore['right-body-scroll']);const xHandleEl=refScrollXHandleElem.value;const yHandleEl=refScrollYHandleElem.value;internalData.intoRunScroll=true;if(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(scrollLeft)){setScrollLeft(xHandleEl,scrollLeft);setScrollLeft(bodyScrollElem,scrollLeft);setScrollLeft(headerScrollElem,scrollLeft);setScrollLeft(footerScrollElem,scrollLeft);loadScrollXData();}if(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(scrollTop)){setScrollTop(yHandleEl,scrollTop);setScrollTop(bodyScrollElem,scrollTop);setScrollTop(leftScrollElem,scrollTop);setScrollTop(rightScrollElem,scrollTop);loadScrollYData();}if(reactData.scrollXLoad||reactData.scrollYLoad){return new Promise(resolve=>{setTimeout(()=>{(0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)(()=>{internalData.intoRunScroll=false;resolve();});},30);});}return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)().then(()=>{internalData.intoRunScroll=false;});},/**
|
|
11505
|
+
*/scrollTo(scrollLeft,scrollTop){const{elemStore}=internalData;const headerScrollElem=getRefElem(elemStore['main-header-scroll']);const bodyScrollElem=getRefElem(elemStore['main-body-scroll']);const footerScrollElem=getRefElem(elemStore['main-footer-scroll']);const leftScrollElem=getRefElem(elemStore['left-body-scroll']);const rightScrollElem=getRefElem(elemStore['right-body-scroll']);const xHandleEl=refScrollXHandleElem.value;const yHandleEl=refScrollYHandleElem.value;internalData.intoRunScroll=true;if(scrollLeft){if(!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(scrollLeft)){scrollTop=scrollLeft.top;scrollLeft=scrollLeft.left;}}if(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(scrollLeft)){setScrollLeft(xHandleEl,scrollLeft);setScrollLeft(bodyScrollElem,scrollLeft);setScrollLeft(headerScrollElem,scrollLeft);setScrollLeft(footerScrollElem,scrollLeft);loadScrollXData();}if(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(scrollTop)){setScrollTop(yHandleEl,scrollTop);setScrollTop(bodyScrollElem,scrollTop);setScrollTop(leftScrollElem,scrollTop);setScrollTop(rightScrollElem,scrollTop);loadScrollYData();}if(reactData.scrollXLoad||reactData.scrollYLoad){return new Promise(resolve=>{setTimeout(()=>{(0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)(()=>{internalData.intoRunScroll=false;resolve();});},30);});}return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)().then(()=>{internalData.intoRunScroll=false;});},/**
|
|
11506
11506
|
* 如果有滚动条,则滚动到对应的行
|
|
11507
11507
|
* @param {Row} row 行对象
|
|
11508
11508
|
* @param {ColumnInfo} fieldOrColumn 列配置
|
|
@@ -11626,7 +11626,7 @@ fullList=handleVirtualTreeToList();}const tableData=scrollYLoad?fullList.slice(s
|
|
|
11626
11626
|
const fullDataRowIdMaps={};const{handleUpdateRowId}=createHandleUpdateRowId($xeTable);const handleRowCache=(row,index,items,currIndex,parentRow,rowid,level,seq)=>{let rowRest=fullAllDataRowIdMaps[rowid];if(!rowRest){rowRest={row,rowid,seq,index:-1,_index:-1,$index:-1,treeIndex:index,items,parent:parentRow,level,height:0,resizeHeight:0,oTop:0,expandHeight:0};fullDataRowIdMaps[rowid]=rowRest;fullAllDataRowIdMaps[rowid]=rowRest;}rowRest.treeLoaded=false;rowRest.expandLoaded=false;rowRest.row=row;rowRest.items=items;rowRest.parent=parentRow;rowRest.level=level;rowRest.index=currIndex;rowRest.treeIndex=index;fullDataRowIdMaps[rowid]=rowRest;fullAllDataRowIdMaps[rowid]=rowRest;};if(treeConfig){const treeOpts=computeTreeOpts.value;const{lazy}=treeOpts;const childrenField=treeOpts.children||treeOpts.childrenField;const hasChildField=treeOpts.hasChild||treeOpts.hasChildField;external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(tableFullTreeData,(row,index,items,path,parentRow,nodes)=>{const rowid=handleUpdateRowId(row);if(treeConfig&&lazy){if(row[hasChildField]&&row[childrenField]===undefined){row[childrenField]=null;}if(treeExpandedMaps[rowid]){if(!row[childrenField]||!row[childrenField].length){delete treeExpandedMaps[rowid];}}}handleRowCache(row,index,items,parentRow?-1:index,parentRow,rowid,nodes.length-1,toTreePathSeq(path));},{children:childrenField});}else if(isRowGroupStatus){const aggregateOpts=computeAggregateOpts.value;const{mapChildrenField}=aggregateOpts;external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(tableFullGroupData,(row,index,items,path,parentRow,nodes)=>{const rowid=handleUpdateRowId(row);handleRowCache(row,index,items,parentRow?-1:index,parentRow,rowid,nodes.length-1,toTreePathSeq(path));},{children:mapChildrenField});}else{tableFullData.forEach((row,index,items)=>{handleRowCache(row,index,items,index,null,handleUpdateRowId(row),0,index+1);});}internalData.fullDataRowIdData=fullDataRowIdMaps;internalData.fullAllDataRowIdData=fullAllDataRowIdMaps;reactData.treeExpandedFlag++;},cacheSourceMap(fullData){const{treeConfig}=props;const treeOpts=computeTreeOpts.value;const sourceData=external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().clone(fullData,true);const{handleUpdateRowId}=createHandleUpdateRowId($xeTable);const sourceRowIdData={};const handleSourceRow=row=>{const rowid=handleUpdateRowId(row);sourceRowIdData[rowid]=row;};// 源数据缓存
|
|
11627
11627
|
if(treeConfig){const childrenField=treeOpts.children||treeOpts.childrenField;external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(sourceData,handleSourceRow,{children:treeOpts.transform?treeOpts.mapChildrenField:childrenField});}else{sourceData.forEach(handleSourceRow);}internalData.sourceDataRowIdData=sourceRowIdData;internalData.tableSourceData=sourceData;},/**
|
|
11628
11628
|
* 指定列宽的列进行拆分
|
|
11629
|
-
*/analyColumnWidth(){const{tableFullColumn}=internalData;const columnOpts=computeColumnOpts.value;const{width:defaultWidth,minWidth:defaultMinWidth}=columnOpts;const resizeList=[];const pxList=[];const pxMinList=[];const autoMinList=[];const scaleList=[];const scaleMinList=[];const autoList=[];const remainList=[];tableFullColumn.forEach(column=>{if(defaultWidth&&!column.width){column.width=defaultWidth;}if(defaultMinWidth&&!column.minWidth){column.minWidth=defaultMinWidth;}if(column.visible){if(column.resizeWidth){resizeList.push(column);}else if(column.width==='auto'){autoList.push(column);}else if(isPx(column.width)){pxList.push(column);}else if(isScale(column.width)){scaleList.push(column);}else if(isPx(column.minWidth)){pxMinList.push(column);}else if(column.minWidth==='auto'){autoMinList.push(column);}else if(isScale(column.minWidth)){scaleMinList.push(column);}else{remainList.push(column);}}});Object.assign(reactData.columnStore,{resizeList,pxList,pxMinList,autoMinList,scaleList,scaleMinList,autoList,remainList});},handleColResizeMousedownEvent(evnt,fixedType,params){evnt.stopPropagation();evnt.preventDefault();const{column}=params;const{columnStore,overflowX,scrollbarHeight}=reactData;const{
|
|
11629
|
+
*/analyColumnWidth(){const{tableFullColumn}=internalData;const columnOpts=computeColumnOpts.value;const{width:defaultWidth,minWidth:defaultMinWidth}=columnOpts;const resizeList=[];const pxList=[];const pxMinList=[];const autoMinList=[];const scaleList=[];const scaleMinList=[];const autoList=[];const remainList=[];tableFullColumn.forEach(column=>{if(defaultWidth&&!column.width){column.width=defaultWidth;}if(defaultMinWidth&&!column.minWidth){column.minWidth=defaultMinWidth;}if(column.visible){if(column.resizeWidth){resizeList.push(column);}else if(column.width==='auto'){autoList.push(column);}else if(isPx(column.width)){pxList.push(column);}else if(isScale(column.width)){scaleList.push(column);}else if(isPx(column.minWidth)){pxMinList.push(column);}else if(column.minWidth==='auto'){autoMinList.push(column);}else if(isScale(column.minWidth)){scaleMinList.push(column);}else{remainList.push(column);}}});Object.assign(reactData.columnStore,{resizeList,pxList,pxMinList,autoMinList,scaleList,scaleMinList,autoList,remainList});},handleColResizeMousedownEvent(evnt,fixedType,params){evnt.stopPropagation();evnt.preventDefault();const{column}=params;const{columnStore,overflowX,scrollbarHeight}=reactData;const{visibleColumn}=internalData;const{leftList,rightList}=columnStore;const resizableOpts=computeResizableOpts.value;const osbHeight=overflowX?scrollbarHeight:0;const tableEl=refElem.value;const leftContainerElem=refLeftContainer.value;const rightContainerElem=refRightContainer.value;const resizeBarElem=refColResizeBar.value;if(!resizeBarElem){return;}const isLeftFixed=fixedType==='left';const isRightFixed=fixedType==='right';const resizeTipElem=resizeBarElem.firstElementChild;const scrollbarXToTop=computeScrollbarXToTop.value;const{clientX:dragClientX}=evnt;const dragBtnElem=evnt.target;let resizeColumn=column;const isDragGroupCol=column.children&&column.children.length;if(isDragGroupCol){external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(column.children,childColumn=>{resizeColumn=childColumn;});}let cell=dragBtnElem.parentElement;if(isDragGroupCol){const trEl=cell?cell.parentElement:null;const theadEl=trEl?trEl.parentElement:null;cell=theadEl?theadEl.querySelector(`.vxe-header--column[colid="${resizeColumn.id}"]`):null;}if(!cell){return;}const cellParams=external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().assign(params,{cell});let dragLeft=0;const tableRect=tableEl.getBoundingClientRect();const rightContainerRect=rightContainerElem?rightContainerElem.getBoundingClientRect():null;const cellRect=cell.getBoundingClientRect();const dragBtnRect=dragBtnElem.getBoundingClientRect();const dragBtnWidth=dragBtnElem.clientWidth;const dragBtnOffsetWidth=external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().floor(dragBtnWidth/2);const dragPosLeft=dragBtnRect.x-tableRect.x+dragBtnOffsetWidth;const minInterval=getColReMinWidth(cellParams)-dragBtnOffsetWidth;// 列之间的最小间距
|
|
11630
11630
|
const dragMinLeft=isRightFixed?0:cellRect.x-tableRect.x+dragBtnWidth+minInterval;const dragMaxLeft=cellRect.x-tableRect.x+cell.clientWidth-minInterval;let fixedLeftRemainWidth=0;let fixedRightRemainWidth=0;if(isLeftFixed||isRightFixed){let isMach=false;const fixedColumn=isLeftFixed?leftList:rightList;for(let i=0;i<fixedColumn.length;i++){const item=fixedColumn[i];if(isMach){fixedLeftRemainWidth+=item.renderWidth;}else{isMach=item.id===resizeColumn.id;if(!isMach){fixedRightRemainWidth+=item.renderWidth;}}}}// 处理拖动事件
|
|
11631
11631
|
const updateEvent=evnt=>{evnt.stopPropagation();evnt.preventDefault();const tableHeight=tableEl.clientHeight;const offsetX=evnt.clientX-dragClientX;let left=dragPosLeft+offsetX;if(isLeftFixed){if(rightContainerRect){left=Math.min(left,rightContainerRect.x-tableRect.x-fixedLeftRemainWidth-minInterval);}}else if(isRightFixed){if(leftContainerElem){left=Math.max(left,leftContainerElem.clientWidth+fixedRightRemainWidth+minInterval);}left=Math.min(left,dragMaxLeft);}dragLeft=Math.max(left,dragMinLeft);const resizeBarLeft=Math.max(1,dragLeft);resizeBarElem.style.left=`${resizeBarLeft}px`;resizeBarElem.style.top=`${scrollbarXToTop?osbHeight:0}px`;resizeBarElem.style.height=`${scrollbarXToTop?tableHeight-osbHeight:tableHeight}px`;if(resizableOpts.showDragTip&&resizeTipElem){resizeTipElem.textContent=table_getI18n('vxe.table.resizeColTip',[Math.floor(resizeColumn.renderWidth+(isRightFixed?dragPosLeft-dragLeft:dragLeft-dragPosLeft))]);const tableWrapperWidth=tableEl.clientWidth;const resizeBarWidth=resizeBarElem.clientWidth;const resizeTipWidth=resizeTipElem.clientWidth;const resizeTipHeight=resizeTipElem.clientHeight;let resizeTipLeft=-resizeTipWidth;if(resizeBarLeft<resizeTipWidth+resizeBarWidth){resizeTipLeft=0;}else if(resizeBarLeft>tableWrapperWidth){resizeTipLeft+=tableWrapperWidth-resizeBarLeft;}resizeTipElem.style.left=`${resizeTipLeft}px`;resizeTipElem.style.top=`${Math.min(tableHeight-resizeTipHeight,Math.max(0,evnt.clientY-tableRect.y-resizeTipHeight/2))}px`;}reactData.isDragResize=true;};reactData.isDragResize=true;addClass(tableEl,'col-drag--resize');resizeBarElem.style.display='block';document.onmousemove=updateEvent;document.onmouseup=function(evnt){document.onmousemove=null;document.onmouseup=null;resizeBarElem.style.display='none';internalData._lastResizeTime=Date.now();setTimeout(()=>{reactData.isDragResize=false;},50);const resizeWidth=resizeColumn.renderWidth+(isRightFixed?dragPosLeft-dragLeft:dragLeft-dragPosLeft);const resizeParams={...params,resizeWidth,resizeColumn};if(resizableOpts.dragMode==='fixed'){visibleColumn.forEach(item=>{if(item.id!==resizeColumn.id){if(!item.resizeWidth){item.resizeWidth=item.renderWidth;}}});}if($xeTable.handleColResizeCellAreaEvent){$xeTable.handleColResizeCellAreaEvent(evnt,resizeParams);}else{resizeColumn.resizeWidth=resizeWidth;handleUpdateColResize(evnt,resizeParams);}removeClass(tableEl,'col-drag--resize');};updateEvent(evnt);if($xeTable.closeMenu){$xeTable.closeMenu();}},handleColResizeDblclickEvent(evnt,params){const resizableOpts=computeResizableOpts.value;const{isDblclickAutoWidth}=resizableOpts;const el=refElem.value;if(isDblclickAutoWidth&&el){evnt.stopPropagation();evnt.preventDefault();const{fullColumnIdData}=internalData;const{column}=params;let resizeColumn=column;if(column.children&&column.children.length){external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(column.children,childColumn=>{resizeColumn=childColumn;});}const colid=resizeColumn.id;const colRest=fullColumnIdData[colid];const dragBtnElem=evnt.target;const cell=dragBtnElem.parentNode;const cellParams=Object.assign(params,{cell});const colMinWidth=getColReMinWidth(cellParams);el.setAttribute('data-calc-col','Y');let resizeWidth=calcColumnAutoWidth(resizeColumn,el);el.removeAttribute('data-calc-col');if(colRest){resizeWidth=Math.max(resizeWidth,colRest.width);}resizeWidth=Math.max(colMinWidth,resizeWidth);const resizeParams={...params,resizeWidth,resizeColumn};reactData.isDragResize=false;internalData._lastResizeTime=Date.now();if($xeTable.handleColResizeDblclickCellAreaEvent){$xeTable.handleColResizeDblclickCellAreaEvent(evnt,resizeParams);}else{resizeColumn.resizeWidth=resizeWidth;handleUpdateColResize(evnt,resizeParams);}}},handleRowResizeMousedownEvent(evnt,params){evnt.stopPropagation();evnt.preventDefault();const{row}=params;const{overflowX,scrollbarWidth,overflowY,scrollbarHeight}=reactData;const{elemStore,fullAllDataRowIdData}=internalData;const osbWidth=overflowY?scrollbarWidth:0;const osbHeight=overflowX?scrollbarHeight:0;const scrollbarYToLeft=computeScrollbarYToLeft.value;const resizableOpts=computeResizableOpts.value;const rowOpts=computeRowOpts.value;const cellOpts=computeCellOpts.value;const tableEl=refElem.value;const resizeBarElem=refRowResizeBar.value;if(!resizeBarElem){return;}const{clientY:dragClientY}=evnt;const resizeTipElem=resizeBarElem.firstElementChild;const dragBtnElem=evnt.currentTarget;const tdEl=dragBtnElem.parentNode;const trEl=tdEl.parentNode;const bodyScrollElem=getRefElem(elemStore['main-body-scroll']);if(!bodyScrollElem){return;}const rowid=getRowid($xeTable,row);const rowRest=fullAllDataRowIdData[rowid];if(!rowRest){return;}const defaultRowHeight=computeDefaultRowHeight.value;const currCellHeight=rowRest.resizeHeight||cellOpts.height||rowOpts.height||rowRest.height||defaultRowHeight;const tableRect=tableEl.getBoundingClientRect();const trRect=trEl.getBoundingClientRect();const targetOffsetY=dragClientY-trRect.y-trEl.clientHeight;let resizeHeight=currCellHeight;const cellEl=tdEl.querySelector('.vxe-cell');let cellMinHeight=0;if(cellEl){const cellStyle=getComputedStyle(cellEl);cellMinHeight=Math.max(1,Math.ceil(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(cellStyle.paddingTop)+external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(cellStyle.paddingBottom)));}const minTop=trRect.y-tableRect.y+cellMinHeight;// 处理拖动事件
|
|
11632
11632
|
const updateEvent=evnt=>{evnt.stopPropagation();evnt.preventDefault();const rtWidth=tableEl.clientWidth-osbWidth;const tableHeight=tableEl.clientHeight-osbHeight;let dragTop=evnt.clientY-tableRect.y-targetOffsetY;if(dragTop<minTop){dragTop=minTop;}else{resizeHeight=Math.max(cellMinHeight,currCellHeight+evnt.clientY-dragClientY);}resizeBarElem.style.left=`${scrollbarYToLeft?osbWidth:0}px`;resizeBarElem.style.top=`${dragTop}px`;resizeBarElem.style.width=`${rtWidth}px`;if(resizableOpts.showDragTip&&resizeTipElem){resizeTipElem.textContent=table_getI18n('vxe.table.resizeRowTip',[resizeHeight]);const resizeTipWidth=resizeTipElem.clientWidth;const resizeTipHeight=resizeTipElem.clientHeight;let resizeBarLeft=Math.max(2,evnt.clientX-tableRect.x);let resizeBarTop=0;if(resizeBarLeft+resizeTipWidth>=rtWidth-2){resizeBarLeft=rtWidth-resizeTipWidth-2;}if(dragTop+resizeTipHeight>=tableHeight){resizeBarTop=tableHeight-(dragTop+resizeTipHeight);}resizeTipElem.style.left=`${resizeBarLeft}px`;resizeTipElem.style.top=`${resizeBarTop}px`;}reactData.isDragResize=true;};reactData.isDragResize=true;addClass(tableEl,'row-drag--resize');resizeBarElem.style.display='block';document.onmousemove=updateEvent;document.onmouseup=function(evnt){document.onmousemove=null;document.onmouseup=null;resizeBarElem.style.display='none';internalData._lastResizeTime=Date.now();setTimeout(()=>{reactData.isDragResize=false;},50);if(resizeHeight!==currCellHeight){const resizeParams={...params,resizeHeight,resizeRow:row};internalData.isResizeCellHeight=true;if($xeTable.handleRowResizeCellAreaEvent){$xeTable.handleRowResizeCellAreaEvent(evnt,resizeParams);}else{rowRest.resizeHeight=resizeHeight;handleUpdateRowResize(evnt,resizeParams);updateRowOffsetTop();}}removeClass(tableEl,'row-drag--resize');};updateEvent(evnt);},handleRowResizeDblclickEvent(evnt,params){const resizableOpts=computeResizableOpts.value;const{isDblclickAutoHeight}=resizableOpts;const el=refElem.value;if(isDblclickAutoHeight&&el){evnt.stopPropagation();evnt.preventDefault();const{editStore}=reactData;const{fullAllDataRowIdData}=internalData;const{actived}=editStore;const{row}=params;const rowid=getRowid($xeTable,row);const rowRest=fullAllDataRowIdData[rowid];if(!rowRest){return;}const handleRsHeight=()=>{el.setAttribute('data-calc-row','Y');const resizeHeight=calcCellAutoHeight(rowRest,el);el.removeAttribute('data-calc-row');const resizeParams={...params,resizeHeight,resizeRow:row};reactData.isDragResize=false;internalData._lastResizeTime=Date.now();if($xeTable.handleRowResizeDblclickCellAreaEvent){$xeTable.handleRowResizeDblclickCellAreaEvent(evnt,resizeParams);}else{rowRest.resizeHeight=resizeHeight;handleUpdateRowResize(evnt,resizeParams);}};if(actived.row||actived.column){$xeTable.clearEdit().then(handleRsHeight);}else{handleRsHeight();}}},saveCustomStore(type){const{customConfig}=props;const tableId=computeTableId.value;const customOpts=computeCustomOpts.value;const{updateStore,storage,storeOptions}=customOpts;const isAllCustom=storage===true;const storageOpts=isAllCustom?{}:Object.assign({},storage||{},storeOptions);const isCustomResizable=hangleStorageDefaultValue(storageOpts.resizable,isAllCustom);const isCustomVisible=hangleStorageDefaultValue(storageOpts.visible,isAllCustom);const isCustomFixed=hangleStorageDefaultValue(storageOpts.fixed,isAllCustom);const isCustomSort=hangleStorageDefaultValue(storageOpts.sort,isAllCustom);const isCustomAggFunc=hangleStorageDefaultValue(storageOpts.aggFunc,isAllCustom);if(type!=='reset'){// fix:修复拖动列宽,重置按钮无法点击的问题
|