vxe-table 3.19.30 → 3.19.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/style.css +1 -1
- package/es/table/src/methods.js +22 -13
- package/es/table/src/table.js +1 -0
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/lib/index.umd.js +7 -6
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/table/src/methods.js +21 -12
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/table.js +1 -0
- 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/methods.ts +22 -12
- package/packages/table/src/table.ts +2 -0
- /package/es/{iconfont.1765844135646.ttf → iconfont.1766115857940.ttf} +0 -0
- /package/es/{iconfont.1765844135646.woff → iconfont.1766115857940.woff} +0 -0
- /package/es/{iconfont.1765844135646.woff2 → iconfont.1766115857940.woff2} +0 -0
- /package/lib/{iconfont.1765844135646.ttf → iconfont.1766115857940.ttf} +0 -0
- /package/lib/{iconfont.1765844135646.woff → iconfont.1766115857940.woff} +0 -0
- /package/lib/{iconfont.1765844135646.woff2 → iconfont.1766115857940.woff2} +0 -0
package/es/table/src/methods.js
CHANGED
|
@@ -3369,19 +3369,6 @@ function loadTableData($xeTable, datas, isReload, isReset) {
|
|
|
3369
3369
|
}
|
|
3370
3370
|
handleReserveStatus($xeTable);
|
|
3371
3371
|
$xeTable.checkSelectionStatus();
|
|
3372
|
-
if (initStatus) {
|
|
3373
|
-
$xeTable.dispatchEvent('data-rendered', {
|
|
3374
|
-
isReload,
|
|
3375
|
-
visibleColumn: internalData.visibleColumn,
|
|
3376
|
-
visibleData: internalData.afterFullData
|
|
3377
|
-
}, null);
|
|
3378
|
-
}
|
|
3379
|
-
else {
|
|
3380
|
-
$xeTable.dispatchEvent('init-rendered', {
|
|
3381
|
-
visibleColumn: internalData.visibleColumn,
|
|
3382
|
-
visibleData: internalData.afterFullData
|
|
3383
|
-
}, null);
|
|
3384
|
-
}
|
|
3385
3372
|
$xeTable.dispatchEvent('data-change', {
|
|
3386
3373
|
visibleColumn: internalData.visibleColumn,
|
|
3387
3374
|
visibleData: internalData.afterFullData
|
|
@@ -3437,6 +3424,20 @@ function loadTableData($xeTable, datas, isReload, isReset) {
|
|
|
3437
3424
|
});
|
|
3438
3425
|
}
|
|
3439
3426
|
});
|
|
3427
|
+
}).then(() => {
|
|
3428
|
+
if (initStatus) {
|
|
3429
|
+
$xeTable.dispatchEvent('data-rendered', {
|
|
3430
|
+
isReload,
|
|
3431
|
+
visibleColumn: internalData.visibleColumn,
|
|
3432
|
+
visibleData: internalData.afterFullData
|
|
3433
|
+
}, null);
|
|
3434
|
+
}
|
|
3435
|
+
else {
|
|
3436
|
+
$xeTable.dispatchEvent('init-rendered', {
|
|
3437
|
+
visibleColumn: internalData.visibleColumn,
|
|
3438
|
+
visibleData: internalData.afterFullData
|
|
3439
|
+
}, null);
|
|
3440
|
+
}
|
|
3440
3441
|
});
|
|
3441
3442
|
});
|
|
3442
3443
|
}
|
|
@@ -6065,6 +6066,10 @@ const tableMethods = {
|
|
|
6065
6066
|
const $xeTable = this;
|
|
6066
6067
|
const reactData = $xeTable;
|
|
6067
6068
|
const internalData = $xeTable;
|
|
6069
|
+
const isLeftBtn = evnt.button === 0;
|
|
6070
|
+
if (!isLeftBtn) {
|
|
6071
|
+
return;
|
|
6072
|
+
}
|
|
6068
6073
|
evnt.stopPropagation();
|
|
6069
6074
|
evnt.preventDefault();
|
|
6070
6075
|
const { column } = params;
|
|
@@ -6854,6 +6859,10 @@ const tableMethods = {
|
|
|
6854
6859
|
});
|
|
6855
6860
|
}
|
|
6856
6861
|
},
|
|
6862
|
+
contextMenuEvent(evnt) {
|
|
6863
|
+
const $xeTable = this;
|
|
6864
|
+
$xeTable.dispatchEvent('context-menu', {}, evnt);
|
|
6865
|
+
},
|
|
6857
6866
|
/**
|
|
6858
6867
|
* 全局键盘事件
|
|
6859
6868
|
*/
|
package/es/table/src/table.js
CHANGED
|
@@ -2076,6 +2076,7 @@ export default {
|
|
|
2076
2076
|
const scrollbarYToLeft = $xeTable.computeScrollbarYToLeft;
|
|
2077
2077
|
const { isCrossTableDrag } = rowDragOpts;
|
|
2078
2078
|
const tbOns = {
|
|
2079
|
+
contextmenu: this.contextMenuEvent,
|
|
2079
2080
|
keydown: this.keydownEvent
|
|
2080
2081
|
};
|
|
2081
2082
|
if (isCrossTableDrag && !tableData.length) {
|
package/es/ui/index.js
CHANGED
package/es/ui/src/log.js
CHANGED
package/lib/index.umd.js
CHANGED
|
@@ -2005,7 +2005,7 @@ function getClass(property, params) {
|
|
|
2005
2005
|
;// CONCATENATED MODULE: ./packages/ui/index.ts
|
|
2006
2006
|
|
|
2007
2007
|
|
|
2008
|
-
const version = "3.19.
|
|
2008
|
+
const version = "3.19.32";
|
|
2009
2009
|
core_.VxeUI.version = version;
|
|
2010
2010
|
core_.VxeUI.tableVersion = version;
|
|
2011
2011
|
core_.VxeUI.setConfig({
|
|
@@ -2715,7 +2715,7 @@ function isNodeElement(elem) {
|
|
|
2715
2715
|
const {
|
|
2716
2716
|
log: log_log
|
|
2717
2717
|
} = core_.VxeUI;
|
|
2718
|
-
const log_version = `table v${"3.19.
|
|
2718
|
+
const log_version = `table v${"3.19.32"}`;
|
|
2719
2719
|
const warnLog = log_log.create('warn', log_version);
|
|
2720
2720
|
const errLog = log_log.create('error', log_version);
|
|
2721
2721
|
;// CONCATENATED MODULE: ./packages/table/src/columnInfo.ts
|
|
@@ -6074,10 +6074,10 @@ if(!(props.height||props.maxHeight)){errLog('vxe.error.reqProp',['height | max-h
|
|
|
6074
6074
|
// if (props.spanMethod) {
|
|
6075
6075
|
// warnLog('vxe.error.scrollErrProp', ['span-method'])
|
|
6076
6076
|
// }
|
|
6077
|
-
}handleReserveStatus($xeTable);$xeTable.checkSelectionStatus()
|
|
6077
|
+
}handleReserveStatus($xeTable);$xeTable.checkSelectionStatus();$xeTable.dispatchEvent('data-change',{visibleColumn:internalData.visibleColumn,visibleData:internalData.afterFullData},null);return new Promise(resolve=>{$xeTable.$nextTick().then(()=>handleRecalculateStyle($xeTable,false,false,false)).then(()=>{handleRecalculateStyle($xeTable,false,true,true);updateRowOffsetTop($xeTable);}).then(()=>{let targetScrollLeft=lastScrollLeft;let targetScrollTop=lastScrollTop;const virtualXOpts=$xeTable.computeVirtualXOpts;const virtualYOpts=$xeTable.computeVirtualYOpts;// 是否在更新数据之后自动滚动重置滚动条
|
|
6078
6078
|
if(virtualXOpts.scrollToLeftOnChange){targetScrollLeft=0;}if(virtualYOpts.scrollToTopOnChange){targetScrollTop=0;}reactData.isRowLoading=false;handleRecalculateStyle($xeTable,false,false,false);updateTreeLineStyle($xeTable);// 如果是自动行高,特殊情况需调用 recalculate 手动刷新
|
|
6079
6079
|
if(!props.showOverflow){setTimeout(()=>{handleLazyRecalculate($xeTable,false,true,true);setTimeout(()=>handleLazyRecalculate($xeTable,false,true,true),3000);},2000);}// 是否变更虚拟滚动
|
|
6080
|
-
if(oldScrollYLoad===sYLoad){restoreScrollLocation($xeTable,targetScrollLeft,targetScrollTop).then(()=>{handleRecalculateStyle($xeTable,false,true,true);updateRowOffsetTop($xeTable);updateTreeLineStyle($xeTable);$xeTable.$nextTick(()=>resolve());});}else{setTimeout(()=>{restoreScrollLocation($xeTable,targetScrollLeft,targetScrollTop).then(()=>{handleRecalculateStyle($xeTable,false,true,true);updateRowOffsetTop($xeTable);updateTreeLineStyle($xeTable);$xeTable.$nextTick(()=>resolve());});});}});});});}/**
|
|
6080
|
+
if(oldScrollYLoad===sYLoad){restoreScrollLocation($xeTable,targetScrollLeft,targetScrollTop).then(()=>{handleRecalculateStyle($xeTable,false,true,true);updateRowOffsetTop($xeTable);updateTreeLineStyle($xeTable);$xeTable.$nextTick(()=>resolve());});}else{setTimeout(()=>{restoreScrollLocation($xeTable,targetScrollLeft,targetScrollTop).then(()=>{handleRecalculateStyle($xeTable,false,true,true);updateRowOffsetTop($xeTable);updateTreeLineStyle($xeTable);$xeTable.$nextTick(()=>resolve());});});}});}).then(()=>{if(initStatus){$xeTable.dispatchEvent('data-rendered',{isReload,visibleColumn:internalData.visibleColumn,visibleData:internalData.afterFullData},null);}else{$xeTable.dispatchEvent('init-rendered',{visibleColumn:internalData.visibleColumn,visibleData:internalData.afterFullData},null);}});});}/**
|
|
6081
6081
|
* 处理数据加载默认行为
|
|
6082
6082
|
* 默认执行一次,除非被重置
|
|
6083
6083
|
*/function handleLoadDefaults($xeTable){handleDefaultSelectionChecked($xeTable);handleDefaultRadioChecked($xeTable);handleDefaultRowExpand($xeTable);handleDefaultTreeExpand($xeTable);handleDefaultRowGroupExpand($xeTable);handleDefaultMergeCells($xeTable);handleDefaultMergeHeaderItems($xeTable);handleDefaultMergeFooterItems($xeTable);$xeTable.$nextTick(()=>{const internalData=$xeTable;$xeTable.dispatchEvent('init-rendered',{visibleColumn:internalData.visibleColumn,visibleData:internalData.afterFullData},null);setTimeout(()=>$xeTable.recalculate());});}/**
|
|
@@ -6320,7 +6320,7 @@ filterOptions.forEach(option=>{const{_checked,checked}=option;option._checked=ch
|
|
|
6320
6320
|
* 刷新列配置
|
|
6321
6321
|
*/refreshColumn(initSort){const $xeTable=this;if(initSort){handleUpdateColumn($xeTable);}return parseColumns($xeTable,true).then(()=>{return this.refreshScroll();}).then(()=>{return handleLazyRecalculate($xeTable,false,true,true);});},/**
|
|
6322
6322
|
* 指定列宽的列进行拆分
|
|
6323
|
-
*/analyColumnWidth(){const{columnOpts}=this;const{width:defaultWidth,minWidth:defaultMinWidth}=columnOpts;const resizeList=[];const pxList=[];const pxMinList=[];const autoMinList=[];const scaleList=[];const scaleMinList=[];const autoList=[];const remainList=[];this.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(this.columnStore,{resizeList,pxList,pxMinList,autoMinList,scaleList,scaleMinList,autoList,remainList});},handleColResizeMousedownEvent(evnt,fixedType,params){const $xeTable=this;const reactData=$xeTable;const internalData=$xeTable;evnt.stopPropagation();evnt.preventDefault();const{column}=params;const{columnStore,overflowX,scrollbarHeight}=reactData;const{visibleColumn}=internalData;const{leftList,rightList}=columnStore;const resizableOpts=$xeTable.computeResizableOpts;const osbHeight=overflowX?scrollbarHeight:0;const tableEl=$xeTable.$refs.refElem;const leftContainerElem=$xeTable.$refs.refLeftContainer;const rightContainerElem=$xeTable.$refs.refRightContainer;const resizeBarElem=$xeTable.$refs.refColResizeBar;if(!resizeBarElem){return;}const isLeftFixed=fixedType==='left';const isRightFixed=fixedType==='right';const resizeTipElem=resizeBarElem.firstElementChild;const scrollbarXToTop=$xeTable.computeScrollbarXToTop;const{clientX:dragClientX}=evnt;const dragBtnElem=evnt.target;let cell=dragBtnElem.parentElement;let resizeColumn=column;const isDragGroupCol=column.children&&column.children.length;if(isDragGroupCol){resizeColumn=getLastChildColumn(column);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,$table:$xeTable});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;// 列之间的最小间距
|
|
6323
|
+
*/analyColumnWidth(){const{columnOpts}=this;const{width:defaultWidth,minWidth:defaultMinWidth}=columnOpts;const resizeList=[];const pxList=[];const pxMinList=[];const autoMinList=[];const scaleList=[];const scaleMinList=[];const autoList=[];const remainList=[];this.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(this.columnStore,{resizeList,pxList,pxMinList,autoMinList,scaleList,scaleMinList,autoList,remainList});},handleColResizeMousedownEvent(evnt,fixedType,params){const $xeTable=this;const reactData=$xeTable;const internalData=$xeTable;const isLeftBtn=evnt.button===0;if(!isLeftBtn){return;}evnt.stopPropagation();evnt.preventDefault();const{column}=params;const{columnStore,overflowX,scrollbarHeight}=reactData;const{visibleColumn}=internalData;const{leftList,rightList}=columnStore;const resizableOpts=$xeTable.computeResizableOpts;const osbHeight=overflowX?scrollbarHeight:0;const tableEl=$xeTable.$refs.refElem;const leftContainerElem=$xeTable.$refs.refLeftContainer;const rightContainerElem=$xeTable.$refs.refRightContainer;const resizeBarElem=$xeTable.$refs.refColResizeBar;if(!resizeBarElem){return;}const isLeftFixed=fixedType==='left';const isRightFixed=fixedType==='right';const resizeTipElem=resizeBarElem.firstElementChild;const scrollbarXToTop=$xeTable.computeScrollbarXToTop;const{clientX:dragClientX}=evnt;const dragBtnElem=evnt.target;let cell=dragBtnElem.parentElement;let resizeColumn=column;const isDragGroupCol=column.children&&column.children.length;if(isDragGroupCol){resizeColumn=getLastChildColumn(column);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,$table:$xeTable});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;// 列之间的最小间距
|
|
6324
6324
|
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;}}}}// 处理拖动事件
|
|
6325
6325
|
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=methods_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($xeTable,evnt,resizeParams);}removeClass(tableEl,'col-drag--resize');};updateEvent(evnt);if($xeTable.closeMenu){$xeTable.closeMenu();}},handleColResizeDblclickEvent(evnt,params){const $xeTable=this;const reactData=$xeTable;const internalData=$xeTable;const resizableOpts=$xeTable.computeResizableOpts;const{isDblclickAutoWidth}=resizableOpts;const el=$xeTable.$refs.refElem;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,$table:$xeTable});const colMinWidth=getColReMinWidth(cellParams);el.setAttribute('data-calc-col','Y');let resizeWidth=calcColumnAutoWidth($xeTable,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($xeTable,evnt,resizeParams);}}},handleRowResizeMousedownEvent(evnt,params){const $xeTable=this;const props=$xeTable;const reactData=$xeTable;const internalData=$xeTable;evnt.stopPropagation();evnt.preventDefault();const $xeGantt=$xeTable.$xeGantt;const{row}=params;const{showOverflow}=props;const{overflowX,scrollbarWidth,overflowY,scrollbarHeight}=reactData;const{elemStore,fullAllDataRowIdData}=internalData;const osbWidth=overflowY?scrollbarWidth:0;const osbHeight=overflowX?scrollbarHeight:0;const scrollbarYToLeft=$xeTable.computeScrollbarYToLeft;const resizableOpts=$xeTable.computeResizableOpts;const rowOpts=$xeTable.computeRowOpts;const cellOpts=$xeTable.computeCellOpts;let tableEl=$xeTable.$refs.refElem;if($xeGantt){const ganttContainerElem=$xeGantt.$refs.refGanttContainerElem;if(ganttContainerElem){tableEl=ganttContainerElem;}}const resizeBarElem=$xeTable.$refs.refRowResizeBar;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=$xeTable.computeDefaultRowHeight;let currCellHeight=rowRest.resizeHeight||cellOpts.height||rowOpts.height||rowRest.height||defaultRowHeight;if(!showOverflow){currCellHeight=tdEl.clientHeight;}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;// 处理拖动事件
|
|
6326
6326
|
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=methods_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($xeTable,evnt,resizeParams);updateRowOffsetTop($xeTable);}}removeClass(tableEl,'row-drag--resize');};updateEvent(evnt);},handleRowResizeDblclickEvent(evnt,params){const $xeTable=this;const reactData=$xeTable;const internalData=$xeTable;const resizableOpts=$xeTable.computeResizableOpts;const{isDblclickAutoHeight}=resizableOpts;const el=$xeTable.$refs.refElem;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($xeTable,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($xeTable,evnt,resizeParams);}};if(actived.row||actived.column){$xeTable.clearEdit().then(handleRsHeight);}else{handleRsHeight();}}},setRowHeightConf(heightConf){const $xeTable=this;const reactData=$xeTable;const internalData=$xeTable;const{fullAllDataRowIdData}=internalData;let status=false;if(heightConf){external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(heightConf,(height,rowid)=>{const rowRest=fullAllDataRowIdData[rowid];if(rowRest){const rHeight=external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(height);if(rHeight){rowRest.resizeHeight=rHeight;if(!status){status=true;}}}});if(status){internalData.isResizeCellHeight=true;reactData.resizeHeightFlag++;}}return $xeTable.$nextTick().then(()=>{updateRowOffsetTop($xeTable);return{status};});},getRowHeightConf(isFull){const $xeTable=this;const internalData=$xeTable;const{fullAllDataRowIdData,afterFullData}=internalData;const{handleGetRowId}=createHandleGetRowId($xeTable);const rowOpts=$xeTable.computeRowOpts;const cellOpts=$xeTable.computeCellOpts;const defaultRowHeight=$xeTable.computeDefaultRowHeight;const rest={};afterFullData.forEach(row=>{const rowid=handleGetRowId(row);const rowRest=fullAllDataRowIdData[rowid];if(rowRest){const resizeHeight=rowRest.resizeHeight;if(resizeHeight||isFull){const currCellHeight=resizeHeight||cellOpts.height||rowOpts.height||rowRest.height||defaultRowHeight;rest[rowid]=currCellHeight;}}});return rest;},recalcRowHeight(rowOrId){const $xeTable=this;const reactData=$xeTable;const internalData=$xeTable;const{fullAllDataRowIdData}=internalData;const rows=external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(rowOrId)?rowOrId:[rowOrId];const el=$xeTable.$refs.refElem;if(el){const{handleGetRowId}=createHandleGetRowId($xeTable);el.setAttribute('data-calc-row','Y');rows.forEach(row=>{const rowid=external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(row)||external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(row)?row:handleGetRowId(row);const rowRest=fullAllDataRowIdData[rowid];if(rowRest){rowRest.resizeHeight=calcCellAutoHeight($xeTable,rowRest,el);}el.removeAttribute('data-calc-row');});reactData.calcCellHeightFlag++;}return $xeTable.$nextTick();},setRowHeight(rowOrId,height){const $xeTable=this;const reactData=$xeTable;const internalData=$xeTable;const{fullAllDataRowIdData}=internalData;let status=false;const rows=external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(rowOrId)?rowOrId:[rowOrId];let rHeight=external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(height);if(isScale(height)){const tableBody=$xeTable.$refs.refTableBody;const bodyElem=tableBody?tableBody.$el:null;const bodyHeight=bodyElem?bodyElem.clientHeight-1:0;rHeight=Math.floor(rHeight*bodyHeight);}if(rHeight){const{handleGetRowId}=createHandleGetRowId($xeTable);rows.forEach(row=>{const rowid=external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(row)||external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(row)?row:handleGetRowId(row);const rowRest=fullAllDataRowIdData[rowid];if(rowRest){rowRest.resizeHeight=rHeight;if(!status){status=true;}}});if(status){internalData.isResizeCellHeight=true;reactData.resizeHeightFlag++;}}return $xeTable.$nextTick();},getRowHeight(rowOrId){const $xeTable=this;const internalData=$xeTable;const{fullAllDataRowIdData}=internalData;const rowOpts=$xeTable.computeRowOpts;const cellOpts=$xeTable.computeCellOpts;const defaultRowHeight=$xeTable.computeDefaultRowHeight;const rowid=external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(rowOrId)||external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(rowOrId)?rowOrId:getRowid($xeTable,rowOrId);const rowRest=fullAllDataRowIdData[rowid];if(rowRest){return rowRest.resizeHeight||cellOpts.height||rowOpts.height||rowRest.height||defaultRowHeight;}return 0;},/**
|
|
@@ -6367,7 +6367,7 @@ internalData.isActivated=isActivated;},/**
|
|
|
6367
6367
|
*/keydownEvent(evnt){const $xeTable=this;const{filterStore,ctxMenuStore,editStore,keyboardConfig,mouseConfig,mouseOpts,keyboardOpts}=this;const{actived}=editStore;const{keyCode}=evnt;const isEsc=keyCode===27;if(isEsc){this.preventEvent(evnt,'event.keydown',null,()=>{$xeTable.dispatchEvent('keydown-start',{},evnt);if(keyboardConfig&&mouseConfig&&mouseOpts.area&&this.handleKeyboardCellAreaEvent){this.handleKeyboardCellAreaEvent(evnt);}else if(actived.row||filterStore.visible||ctxMenuStore.visible){evnt.stopPropagation();// 如果按下了 Esc 键,关闭快捷菜单、筛选
|
|
6368
6368
|
this.closeFilter();this.closeMenu();if(keyboardConfig&&keyboardOpts.isEsc){// 如果是激活编辑状态,则取消编辑
|
|
6369
6369
|
if(actived.row){const params=actived.args;this.handleClearEdit(evnt);// 如果配置了选中功能,则为选中状态
|
|
6370
|
-
if(mouseConfig&&mouseOpts.selected){this.$nextTick(()=>this.handleSelected(params,evnt));}}}}$xeTable.dispatchEvent('keydown',{},evnt);$xeTable.dispatchEvent('keydown-end',{},evnt);});}},/**
|
|
6370
|
+
if(mouseConfig&&mouseOpts.selected){this.$nextTick(()=>this.handleSelected(params,evnt));}}}}$xeTable.dispatchEvent('keydown',{},evnt);$xeTable.dispatchEvent('keydown-end',{},evnt);});}},contextMenuEvent(evnt){const $xeTable=this;$xeTable.dispatchEvent('context-menu',{},evnt);},/**
|
|
6371
6371
|
* 全局键盘事件
|
|
6372
6372
|
*/handleGlobalKeydownEvent(evnt){const $xeTable=this;const props=$xeTable;const internalData=$xeTable;const reactData=$xeTable;const $xeGrid=$xeTable.$xeGrid;const $xeGantt=$xeTable.$xeGantt;// 该行为只对当前激活的表格有效
|
|
6373
6373
|
if(internalData.isActivated){$xeTable.preventEvent(evnt,'event.keydown',null,()=>{const{mouseConfig,keyboardConfig,treeConfig,editConfig,highlightCurrentRow,highlightCurrentColumn}=props;const{ctxMenuStore,editStore,currentRow}=reactData;const{afterFullData}=internalData;const isContentMenu=$xeTable.computeIsContentMenu;const bodyMenu=$xeTable.computeBodyMenu;const keyboardOpts=$xeTable.computeKeyboardOpts;const mouseOpts=$xeTable.computeMouseOpts;const editOpts=$xeTable.computeEditOpts;const treeOpts=$xeTable.computeTreeOpts;const menuList=$xeTable.computeMenuList;const rowOpts=$xeTable.computeRowOpts;const columnOpts=$xeTable.computeColumnOpts;const{selected,actived}=editStore;const{keyCode}=evnt;const hasBackspaceKey=keyCode===8;const isTab=keyCode===9;const isEnter=keyCode===13;const isEsc=keyCode===27;const isSpacebar=keyCode===32;const isLeftArrow=keyCode===37;const isUpArrow=keyCode===38;const isRightArrow=keyCode===39;const isDwArrow=keyCode===40;const hasDeleteKey=keyCode===46;const isF2=keyCode===113;const isContextMenu=keyCode===93;const isControlKey=hasControlKey(evnt);const hasShiftKey=evnt.shiftKey;const hasAltKey=evnt.altKey;const operArrow=isLeftArrow||isUpArrow||isRightArrow||isDwArrow;const operCtxMenu=isContentMenu&&ctxMenuStore.visible&&(isEnter||isSpacebar||operArrow);const isEditStatus=isEnableConf(editConfig)&&actived.column&&actived.row;const childrenField=treeOpts.children||treeOpts.childrenField;const beforeEditMethod=editOpts.beforeEditMethod||editOpts.activeMethod;if(operCtxMenu){// 如果配置了右键菜单; 支持方向键操作、回车
|
|
@@ -19446,6 +19446,7 @@ function renderBody(h, $xeTable) {
|
|
|
19446
19446
|
isCrossTableDrag
|
|
19447
19447
|
} = rowDragOpts;
|
|
19448
19448
|
const tbOns = {
|
|
19449
|
+
contextmenu: this.contextMenuEvent,
|
|
19449
19450
|
keydown: this.keydownEvent
|
|
19450
19451
|
};
|
|
19451
19452
|
if (isCrossTableDrag && !tableData.length) {
|