vxe-table 3.21.5 → 3.21.7
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/body.js +13 -13
- package/es/table/src/group.js +3 -0
- package/es/table/src/methods.js +107 -32
- package/es/table/src/util.js +46 -2
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/lib/index.umd.js +94 -39
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/table/src/body.js +13 -13
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/group.js +3 -0
- package/lib/table/src/group.min.js +1 -1
- package/lib/table/src/methods.js +21 -18
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/util.js +56 -6
- package/lib/table/src/util.min.js +1 -1
- package/lib/ui/index.js +1 -1
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/package.json +2 -2
- package/packages/table/src/body.ts +15 -15
- package/packages/table/src/group.ts +4 -0
- package/packages/table/src/methods.ts +113 -32
- package/packages/table/src/util.ts +62 -4
- /package/es/{iconfont.1780200130470.ttf → iconfont.1780638727189.ttf} +0 -0
- /package/es/{iconfont.1780200130470.woff → iconfont.1780638727189.woff} +0 -0
- /package/es/{iconfont.1780200130470.woff2 → iconfont.1780638727189.woff2} +0 -0
- /package/lib/{iconfont.1780200130470.ttf → iconfont.1780638727189.ttf} +0 -0
- /package/lib/{iconfont.1780200130470.woff → iconfont.1780638727189.woff} +0 -0
- /package/lib/{iconfont.1780200130470.woff2 → iconfont.1780638727189.woff2} +0 -0
package/lib/index.umd.js
CHANGED
|
@@ -3311,7 +3311,7 @@ function getClass(property, params) {
|
|
|
3311
3311
|
/* unused harmony import specifier */ var VxeUI;
|
|
3312
3312
|
|
|
3313
3313
|
|
|
3314
|
-
const version = "3.21.
|
|
3314
|
+
const version = "3.21.7";
|
|
3315
3315
|
core_.VxeUI.version = version;
|
|
3316
3316
|
core_.VxeUI.tableVersion = version;
|
|
3317
3317
|
core_.VxeUI.setConfig({
|
|
@@ -3842,7 +3842,7 @@ var es_iterator_some = __webpack_require__(3579);
|
|
|
3842
3842
|
const {
|
|
3843
3843
|
log: log_log
|
|
3844
3844
|
} = core_.VxeUI;
|
|
3845
|
-
const log_version = `table v${"3.21.
|
|
3845
|
+
const log_version = `table v${"3.21.7"}`;
|
|
3846
3846
|
const warnLog = log_log.create('warn', log_version);
|
|
3847
3847
|
const errLog = log_log.create('error', log_version);
|
|
3848
3848
|
;// ./packages/table/src/columnInfo.ts
|
|
@@ -5063,7 +5063,10 @@ function toFilters(filters, colid) {
|
|
|
5063
5063
|
}
|
|
5064
5064
|
return filters;
|
|
5065
5065
|
}
|
|
5066
|
-
|
|
5066
|
+
/**
|
|
5067
|
+
* 列宽拖动最大宽度
|
|
5068
|
+
*/
|
|
5069
|
+
function getColReMaxWidth(params) {
|
|
5067
5070
|
const {
|
|
5068
5071
|
$table,
|
|
5069
5072
|
column,
|
|
@@ -5071,9 +5074,52 @@ function getColReMinWidth(params) {
|
|
|
5071
5074
|
} = params;
|
|
5072
5075
|
const internalData = $table;
|
|
5073
5076
|
const {
|
|
5074
|
-
|
|
5075
|
-
|
|
5076
|
-
|
|
5077
|
+
elemStore
|
|
5078
|
+
} = internalData;
|
|
5079
|
+
const resizableOpts = $table.computeResizableOpts;
|
|
5080
|
+
const columnOpts = $table.computeColumnOpts;
|
|
5081
|
+
const {
|
|
5082
|
+
maxWidth: reMaxWidth
|
|
5083
|
+
} = resizableOpts;
|
|
5084
|
+
const colMaxWidth = column.maxWidth || columnOpts.maxWidth;
|
|
5085
|
+
// 如果自定义调整宽度逻辑
|
|
5086
|
+
if (reMaxWidth) {
|
|
5087
|
+
const customMaxWidth = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(reMaxWidth) ? reMaxWidth(params) : reMaxWidth;
|
|
5088
|
+
if (customMaxWidth !== 'auto') {
|
|
5089
|
+
return Math.max(1, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(customMaxWidth));
|
|
5090
|
+
}
|
|
5091
|
+
}
|
|
5092
|
+
const minTitleWidth = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().floor((external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(getComputedStyle(cell).fontSize) || 14) * 1.8);
|
|
5093
|
+
const paddingLeftRight = getPaddingLeftRightSize(cell) + getPaddingLeftRightSize(queryElement(cell, '.vxe-cell'));
|
|
5094
|
+
const mWidth = minTitleWidth + paddingLeftRight;
|
|
5095
|
+
// 如果设置最小宽
|
|
5096
|
+
if (colMaxWidth) {
|
|
5097
|
+
const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
|
|
5098
|
+
if (bodyScrollElem) {
|
|
5099
|
+
if (isScale(colMaxWidth)) {
|
|
5100
|
+
const bodyWidth = bodyScrollElem.clientWidth - 1;
|
|
5101
|
+
const meanWidth = bodyWidth / 100;
|
|
5102
|
+
return Math.max(mWidth, Math.floor(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(colMaxWidth) * meanWidth));
|
|
5103
|
+
} else if (isPx(colMaxWidth)) {
|
|
5104
|
+
return Math.max(mWidth, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(colMaxWidth));
|
|
5105
|
+
}
|
|
5106
|
+
}
|
|
5107
|
+
}
|
|
5108
|
+
return -1;
|
|
5109
|
+
}
|
|
5110
|
+
/**
|
|
5111
|
+
* 列宽拖动最小宽度
|
|
5112
|
+
*/
|
|
5113
|
+
function getColReMinWidth(params) {
|
|
5114
|
+
const {
|
|
5115
|
+
$table,
|
|
5116
|
+
column,
|
|
5117
|
+
cell
|
|
5118
|
+
} = params;
|
|
5119
|
+
const tableProps = $table;
|
|
5120
|
+
const internalData = $table;
|
|
5121
|
+
const resizableOpts = $table.computeResizableOpts;
|
|
5122
|
+
const columnOpts = $table.computeColumnOpts;
|
|
5077
5123
|
const {
|
|
5078
5124
|
minWidth
|
|
5079
5125
|
} = resizableOpts;
|
|
@@ -5088,9 +5134,12 @@ function getColReMinWidth(params) {
|
|
|
5088
5134
|
elemStore
|
|
5089
5135
|
} = internalData;
|
|
5090
5136
|
const {
|
|
5091
|
-
showHeaderOverflow
|
|
5092
|
-
|
|
5137
|
+
showHeaderOverflow: allColumnHeaderOverflow
|
|
5138
|
+
} = tableProps;
|
|
5139
|
+
const {
|
|
5140
|
+
showHeaderOverflow
|
|
5093
5141
|
} = column;
|
|
5142
|
+
const colMinWidth = column.minWidth || columnOpts.minWidth;
|
|
5094
5143
|
const headOverflow = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isUndefined(showHeaderOverflow) || external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNull(showHeaderOverflow) ? allColumnHeaderOverflow : showHeaderOverflow;
|
|
5095
5144
|
const showEllipsis = headOverflow === 'ellipsis';
|
|
5096
5145
|
const showTitle = headOverflow === 'title';
|
|
@@ -7197,6 +7246,9 @@ const Column = VxeColumn;
|
|
|
7197
7246
|
if ($scopedSlots.header) {
|
|
7198
7247
|
columnSlots.header = $scopedSlots.header;
|
|
7199
7248
|
}
|
|
7249
|
+
if ($scopedSlots.title) {
|
|
7250
|
+
columnSlots.title = $scopedSlots.title;
|
|
7251
|
+
}
|
|
7200
7252
|
this.columnConfig.slots = columnSlots;
|
|
7201
7253
|
assembleColumn($xeColgroup);
|
|
7202
7254
|
},
|
|
@@ -7628,8 +7680,8 @@ if(isCustomSort&&sortData){allCols.forEach(column=>{const colKey=column.getKey()
|
|
|
7628
7680
|
* 更新数据列的 Map
|
|
7629
7681
|
* 牺牲数据组装的耗时,用来换取使用过程中的流畅
|
|
7630
7682
|
*/function cacheColumnMap($xeTable){const props=$xeTable;const reactData=$xeTable;const internalData=$xeTable;const{treeConfig,showOverflow}=props;const{tableFullColumn,collectColumn}=internalData;const fullColIdData=internalData.fullColumnIdData={};const fullColFieldData=internalData.fullColumnFieldData={};const mouseOpts=$xeTable.computeMouseOpts;const expandOpts=$xeTable.computeExpandOpts;const columnOpts=$xeTable.computeColumnOpts;const columnDragOpts=$xeTable.computeColumnDragOpts;const virtualYOpts=$xeTable.computeVirtualYOpts;const{isCrossDrag,isSelfToChildDrag}=columnDragOpts;const customOpts=$xeTable.computeCustomOpts;const treeOpts=$xeTable.computeTreeOpts;const{storage}=customOpts;const rowOpts=$xeTable.computeRowOpts;const isGroup=collectColumn.some(hasChildrenList);let isAllOverflow=!!showOverflow;let rowGroupColumn;let expandColumn;let treeNodeColumn;let checkboxColumn;let radioColumn;let htmlColumn;let hasFixed;const handleFunc=(column,index,items,path,parentColumn)=>{const{id:colid,field,fixed,type,treeNode,rowGroupNode}=column;const rest={$index:-1,_index:-1,column,colid,index,items,parent:parentColumn||null,width:0,oLeft:0};if(field){if(fullColFieldData[field]){errLog('vxe.error.colRepet',['field',field]);}fullColFieldData[field]=rest;}else{if(storage&&!type){errLog('vxe.error.reqSupportProp',['storage',`[${type?`type=${type}`:`title=${column.getTitle()}`}]field=?`]);}if(columnOpts.drag&&(isCrossDrag||isSelfToChildDrag)){errLog('vxe.error.reqSupportProp',['column-drag-config.isCrossDrag | column-drag-config.isSelfToChildDrag',`${column.getTitle()||type||''} -> field=?`]);}}if(!hasFixed&&fixed){hasFixed=fixed;}if(!htmlColumn&&type==='html'){htmlColumn=column;}if(treeNode){if(treeNodeColumn){warnLog('vxe.error.colRepet',['tree-node',treeNode]);}if(!treeNodeColumn){treeNodeColumn=column;}}if(rowGroupNode){if(treeNodeColumn){warnLog('vxe.error.colRepet',['row-group-node',rowGroupNode]);}if(!rowGroupColumn){rowGroupColumn=column;}}if(type==='expand'){if(expandColumn){warnLog('vxe.error.colRepet',['type',type]);}if(!expandColumn){expandColumn=column;}}if(type==='checkbox'){if(checkboxColumn){warnLog('vxe.error.colRepet',['type',type]);}if(!checkboxColumn){checkboxColumn=column;}}else if(type==='radio'){if(radioColumn){warnLog('vxe.error.colRepet',['type',type]);}if(!radioColumn){radioColumn=column;}}if(isAllOverflow&&column.showOverflow===false){isAllOverflow=false;}if(fullColIdData[colid]){errLog('vxe.error.colRepet',['colId',colid]);}fullColIdData[colid]=rest;};if(isGroup){external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(collectColumn,(column,index,items,path,parentColumn,nodes)=>{column.level=nodes.length;handleFunc(column,index,items,path,parentColumn);});}else{tableFullColumn.forEach(handleFunc);}if(expandColumn){if(expandOpts.mode!=='fixed'&&virtualYOpts.enabled){warnLog('vxe.error.notConflictProp',['column.type="expand','virtual-y-config.enabled=false']);}if(expandOpts.mode!=='fixed'&&mouseOpts.area){errLog('vxe.error.errConflicts',['mouse-config.area','column.type=expand']);}if(expandOpts.mode!=='inside'&&treeConfig&&!treeOpts.transform){errLog('vxe.error.notConflictProp',['tree-config.transform=false','expand-config.mode=inside']);}if(props.spanMethod){warnLog('vxe.error.notSupportProp',['column.type=expand','span-method','span-method=null']);}}if(htmlColumn){if(!columnOpts.useKey){errLog('vxe.error.notSupportProp',['column.type=html','column-config.useKey=false','column-config.useKey=true']);}if(!rowOpts.useKey){errLog('vxe.error.notSupportProp',['column.type=html','row-config.useKey=false','row-config.useKey=true']);}}reactData.isGroup=isGroup;reactData.rowGroupColumn=rowGroupColumn;reactData.treeNodeColumn=treeNodeColumn;reactData.expandColumn=expandColumn;reactData.checkboxColumn=checkboxColumn;reactData.radioColumn=radioColumn;reactData.isAllOverflow=isAllOverflow;}function updateScrollXStatus($xeTable,fullColumn){const reactData=$xeTable;const internalData=$xeTable;const virtualXOpts=$xeTable.computeVirtualXOpts;const allCols=fullColumn||internalData.tableFullColumn;// 如果gt为0,则总是启用
|
|
7631
|
-
const scrollXLoad=!!virtualXOpts.enabled&&virtualXOpts.gt>-1&&(virtualXOpts.gt===0||virtualXOpts.gt<allCols.length);reactData.scrollXLoad=scrollXLoad;return scrollXLoad;}function updateScrollYStatus($xeTable,fullData){const props=$xeTable;const reactData=$xeTable;const internalData=$xeTable;const{treeConfig}=props;const
|
|
7632
|
-
const scrollYLoad=(transform||!treeConfig)&&!!virtualYOpts.enabled&&virtualYOpts.gt>-1&&(virtualYOpts.gt===0||virtualYOpts.gt<allList.length);reactData.scrollYLoad=scrollYLoad;
|
|
7683
|
+
const scrollXLoad=!!virtualXOpts.enabled&&virtualXOpts.gt>-1&&(virtualXOpts.gt===0||virtualXOpts.gt<allCols.length);reactData.scrollXLoad=scrollXLoad;return scrollXLoad;}function syncGanttScrollYStatus($xeTable){const reactData=$xeTable;const internalData=$xeTable;const $xeGanttView=internalData.xeGanttView;if($xeGanttView&&$xeGanttView.handleUpdateSYStatus){$xeGanttView.handleUpdateSYStatus(reactData.scrollYLoad);}}function updateScrollYStatus($xeTable,fullData){const props=$xeTable;const reactData=$xeTable;const internalData=$xeTable;const{treeConfig}=props;const virtualYOpts=$xeTable.computeVirtualYOpts;const treeOpts=$xeTable.computeTreeOpts;const{transform}=treeOpts;const allList=fullData||internalData.tableFullData;// 如果gt为0,则总是启用
|
|
7684
|
+
const scrollYLoad=(transform||!treeConfig)&&!!virtualYOpts.enabled&&virtualYOpts.gt>-1&&(virtualYOpts.gt===0||virtualYOpts.gt<allList.length);reactData.scrollYLoad=scrollYLoad;syncGanttScrollYStatus($xeTable);return scrollYLoad;}/**
|
|
7633
7685
|
* 展开与收起树节点
|
|
7634
7686
|
* @param rows
|
|
7635
7687
|
* @param expanded
|
|
@@ -7679,7 +7731,7 @@ if(sortMultiple){tableData=external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_
|
|
|
7679
7731
|
if(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(firstOrderColumn.sortBy)){sortByConfs=firstOrderColumn.sortBy.map(item=>[item,firstOrderColumn.order]);}tableData=external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().orderBy(tableData,sortByConfs||[firstOrderColumn].map(({column,order})=>[getOrderField($xeTable,column),order]));}tableData=external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().orderBy(tableData,orderColumns.map(({column,order})=>[getOrderField($xeTable,column),order]));}tableTree=tableData;}}}else{if(isRowGroupStatus){// 还原行分组
|
|
7680
7732
|
// 还原虚拟树
|
|
7681
7733
|
tableTree=external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().searchTree(tableFullGroupData,()=>true,{original:true,isEvery:true,children:aggregateOpts.mapChildrenField,mapChildren:aggregateOpts.childrenField});tableData=tableTree;}else if(treeConfig&&transform&&isSortDeep!==false){// 还原虚拟树
|
|
7682
|
-
tableTree=external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().searchTree(tableFullTreeData,()=>true,{original:true,isEvery,children:mapChildrenField,mapChildren:childrenField});tableData=tableTree;}else{tableData=treeConfig?tableFullTreeData.slice(0):tableFullData.slice(0);tableTree=tableData;}}internalData.afterFullData=tableData;internalData.afterTreeFullData=tableTree;internalData.afterGroupFullData=tableTree;updateAfterDataIndex($xeTable);}function updateStyle($xeTable){const props=$xeTable;const reactData=$xeTable;const internalData=$xeTable;const{mouseConfig}=props;const{isGroup,tableColumn,overflowX,scrollbarWidth,overflowY,scrollbarHeight,scrollXWidth,columnStore,editStore,isColLoading}=reactData;const{visibleColumn,tableHeight,elemStore,currentRow,customHeight,customMinHeight,customMaxHeight,tHeaderHeight,tFooterHeight}=internalData;const $xeGanttView=internalData.xeGanttView;const el=$xeTable.$refs.refElem;if(!el||internalData.tBodyHeight&&!el.clientHeight){return;}const containerList=['main','left','right'];const{leftList,rightList}=columnStore;let osbWidth=overflowY?scrollbarWidth:0;let osbHeight=overflowX?scrollbarHeight:0;const emptyPlaceholderElem=$xeTable.$refs.refEmptyPlaceholder;const isHeaderRenderOptimize=$xeTable.computeIsHeaderRenderOptimize;const isBodyRenderOptimize=$xeTable.computeIsBodyRenderOptimize;const isFooterRenderOptimize=$xeTable.computeIsFooterRenderOptimize;const scrollbarOpts=$xeTable.computeScrollbarOpts;const mouseOpts=$xeTable.computeMouseOpts;const bodyWrapperElem=getRefElem(elemStore['main-body-wrapper']);const bodyTableElem=getRefElem(elemStore['main-body-table']);if(emptyPlaceholderElem){emptyPlaceholderElem.style.top=`${tHeaderHeight}px`;emptyPlaceholderElem.style.height=bodyWrapperElem?`${bodyWrapperElem.offsetHeight-osbHeight}px`:'';}const scrollbarXConf=scrollbarOpts.x||{};const scrollbarYConf=scrollbarOpts.y||{};const scrollbarYToLeft=$xeTable.computeScrollbarYToLeft;let xScrollbarVisible=overflowX?'visible':'hidden';if(scrollbarXConf.visible==='visible'||$xeGanttView){osbHeight=scrollbarHeight;xScrollbarVisible='visible';}else if(scrollbarXConf.visible==='hidden'||scrollbarXConf.visible===false){osbHeight=0;xScrollbarVisible='hidden';}let yScrollbarVisible=overflowY?'visible':'hidden';if(scrollbarYConf.visible==='hidden'||scrollbarYConf.visible===false||$xeGanttView&&!scrollbarYToLeft){osbWidth=0;yScrollbarVisible='hidden';}else if(scrollbarYConf.visible==='visible'){osbWidth=scrollbarWidth;yScrollbarVisible='visible';}let tbHeight=0;let bodyMaxHeight=0;const bodyMinHeight=customMinHeight-tHeaderHeight-tFooterHeight-osbHeight;if(customMaxHeight){bodyMaxHeight=Math.max(bodyMinHeight,customMaxHeight-tHeaderHeight-tFooterHeight-osbHeight);}if(customHeight){tbHeight=customHeight-tHeaderHeight-tFooterHeight-osbHeight;}if(!tbHeight){if(bodyTableElem){tbHeight=bodyTableElem.clientHeight;}}if(tbHeight){if(bodyMaxHeight){tbHeight=Math.min(bodyMaxHeight,tbHeight);}tbHeight=Math.max(bodyMinHeight,tbHeight);}const xLeftCornerEl=$xeTable.$refs.refScrollXLeftCornerElem;const xRightCornerEl=$xeTable.$refs.refScrollXRightCornerElem;const scrollXVirtualEl=$xeTable.$refs.refScrollXVirtualElem;if(scrollXVirtualEl){scrollXVirtualEl.style.height=`${osbHeight}px`;scrollXVirtualEl.style.visibility=xScrollbarVisible;}const xWrapperEl=$xeTable.$refs.refScrollXWrapperElem;if(xWrapperEl){xWrapperEl.style.width=`${el.clientWidth-osbWidth}px`;if(scrollbarYToLeft){xWrapperEl.style.left=`${osbWidth}px`;}else{xWrapperEl.style.left='';}}if(xLeftCornerEl){if(scrollbarYToLeft){xLeftCornerEl.style.width=`${osbWidth}px`;xLeftCornerEl.style.display=overflowY&&osbWidth?'block':'';}else{xLeftCornerEl.style.display='';}}if(xRightCornerEl){if(scrollbarYToLeft){xRightCornerEl.style.display='';}else{xRightCornerEl.style.width=`${osbWidth}px`;xRightCornerEl.style.display=xScrollbarVisible==='visible'?'block':'';}}const scrollYVirtualEl=$xeTable.$refs.refScrollYVirtualElem;if(scrollYVirtualEl){scrollYVirtualEl.style.width=`${osbWidth}px`;scrollYVirtualEl.style.height=`${tbHeight+tHeaderHeight+tFooterHeight}px`;scrollYVirtualEl.style.visibility=yScrollbarVisible;}const yTopCornerEl=$xeTable.$refs.refScrollYTopCornerElem;if(yTopCornerEl){yTopCornerEl.style.height=`${tHeaderHeight}px`;yTopCornerEl.style.display=tHeaderHeight&&yScrollbarVisible==='visible'?'block':'';}const yWrapperEl=$xeTable.$refs.refScrollYWrapperElem;if(yWrapperEl){yWrapperEl.style.height=`${tbHeight}px`;yWrapperEl.style.top=`${tHeaderHeight}px`;}const yBottomCornerEl=$xeTable.$refs.refScrollYBottomCornerElem;if(yBottomCornerEl){yBottomCornerEl.style.height=`${tFooterHeight}px`;yBottomCornerEl.style.top=`${tHeaderHeight+tbHeight}px`;yBottomCornerEl.style.display=tFooterHeight&&yScrollbarVisible==='visible'?'block':'';}const rowExpandEl=$xeTable.$refs.refRowExpandElem;if(rowExpandEl){rowExpandEl.style.height=`${tbHeight}px`;rowExpandEl.style.top=`${tHeaderHeight}px`;}internalData.tBodyHeight=tbHeight;containerList.forEach((name,index)=>{const fixedType=index>0?name:'';const layoutList=['header','body','footer'];const isFixedLeft=fixedType==='left';let fixedColumn=[];let fixedWrapperElem;if(fixedType){fixedColumn=isFixedLeft?leftList:rightList;fixedWrapperElem=isFixedLeft?$xeTable.$refs.refLeftContainer:$xeTable.$refs.refRightContainer;}layoutList.forEach(layout=>{const wrapperElem=getRefElem(elemStore[`${name}-${layout}-wrapper`]);const currScrollElem=getRefElem(elemStore[`${name}-${layout}-scroll`]);const tableElem=getRefElem(elemStore[`${name}-${layout}-table`]);if(layout==='header'){// 表头体样式处理
|
|
7734
|
+
tableTree=external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().searchTree(tableFullTreeData,()=>true,{original:true,isEvery,children:mapChildrenField,mapChildren:childrenField});tableData=tableTree;}else{tableData=treeConfig?tableFullTreeData.slice(0):tableFullData.slice(0);tableTree=tableData;}}internalData.afterFullData=tableData;internalData.afterTreeFullData=tableTree;internalData.afterGroupFullData=tableTree;updateAfterDataIndex($xeTable);}function updateStyle($xeTable){const props=$xeTable;const reactData=$xeTable;const internalData=$xeTable;const $xeGantt=$xeTable.$xeGantt;const{mouseConfig}=props;const{isGroup,tableColumn,overflowX,scrollbarWidth,overflowY,scrollbarHeight,scrollXWidth,columnStore,editStore,isColLoading}=reactData;const{visibleColumn,tableHeight,elemStore,currentRow,customHeight,customMinHeight,customMaxHeight,tHeaderHeight,tFooterHeight}=internalData;const $xeGanttView=internalData.xeGanttView;const el=$xeTable.$refs.refElem;if(!el||internalData.tBodyHeight&&!el.clientHeight){return;}const containerList=['main','left','right'];const{leftList,rightList}=columnStore;let osbWidth=overflowY?scrollbarWidth:0;let osbHeight=overflowX?scrollbarHeight:0;const emptyPlaceholderElem=$xeTable.$refs.refEmptyPlaceholder;const isHeaderRenderOptimize=$xeTable.computeIsHeaderRenderOptimize;const isBodyRenderOptimize=$xeTable.computeIsBodyRenderOptimize;const isFooterRenderOptimize=$xeTable.computeIsFooterRenderOptimize;const scrollbarOpts=$xeTable.computeScrollbarOpts;const mouseOpts=$xeTable.computeMouseOpts;const bodyWrapperElem=getRefElem(elemStore['main-body-wrapper']);const bodyTableElem=getRefElem(elemStore['main-body-table']);if(emptyPlaceholderElem){emptyPlaceholderElem.style.top=`${tHeaderHeight}px`;emptyPlaceholderElem.style.height=bodyWrapperElem?`${bodyWrapperElem.offsetHeight-osbHeight}px`:'';}const scrollbarXConf=scrollbarOpts.x||{};const scrollbarYConf=scrollbarOpts.y||{};const scrollbarYToLeft=$xeTable.computeScrollbarYToLeft;let xScrollbarVisible=overflowX?'visible':'hidden';if(scrollbarXConf.visible==='visible'||$xeGanttView){osbHeight=scrollbarHeight;xScrollbarVisible='visible';}else if(scrollbarXConf.visible==='hidden'||scrollbarXConf.visible===false){osbHeight=0;xScrollbarVisible='hidden';}let yScrollbarVisible=overflowY?'visible':'hidden';if(scrollbarYConf.visible==='hidden'||scrollbarYConf.visible===false||$xeGantt&&$xeGanttView&&$xeGantt.reactData.showRightView&&!scrollbarYToLeft){osbWidth=0;yScrollbarVisible='hidden';}else if(scrollbarYConf.visible==='visible'){osbWidth=scrollbarWidth;yScrollbarVisible='visible';}let tbHeight=0;let bodyMaxHeight=0;const bodyMinHeight=customMinHeight-tHeaderHeight-tFooterHeight-osbHeight;if(customMaxHeight){bodyMaxHeight=Math.max(bodyMinHeight,customMaxHeight-tHeaderHeight-tFooterHeight-osbHeight);}if(customHeight){tbHeight=customHeight-tHeaderHeight-tFooterHeight-osbHeight;}if(!tbHeight){if(bodyTableElem){tbHeight=bodyTableElem.clientHeight;}}if(tbHeight){if(bodyMaxHeight){tbHeight=Math.min(bodyMaxHeight,tbHeight);}tbHeight=Math.max(bodyMinHeight,tbHeight);}const xLeftCornerEl=$xeTable.$refs.refScrollXLeftCornerElem;const xRightCornerEl=$xeTable.$refs.refScrollXRightCornerElem;const scrollXVirtualEl=$xeTable.$refs.refScrollXVirtualElem;if(scrollXVirtualEl){scrollXVirtualEl.style.height=`${osbHeight}px`;scrollXVirtualEl.style.visibility=xScrollbarVisible;}const xWrapperEl=$xeTable.$refs.refScrollXWrapperElem;if(xWrapperEl){xWrapperEl.style.width=`${el.clientWidth-osbWidth}px`;if(scrollbarYToLeft){xWrapperEl.style.left=`${osbWidth}px`;}else{xWrapperEl.style.left='';}}if(xLeftCornerEl){if(scrollbarYToLeft){xLeftCornerEl.style.width=`${osbWidth}px`;xLeftCornerEl.style.display=overflowY&&osbWidth?'block':'';}else{xLeftCornerEl.style.display='';}}if(xRightCornerEl){if(scrollbarYToLeft){xRightCornerEl.style.display='';}else{xRightCornerEl.style.width=`${osbWidth}px`;xRightCornerEl.style.display=xScrollbarVisible==='visible'?'block':'';}}const scrollYVirtualEl=$xeTable.$refs.refScrollYVirtualElem;if(scrollYVirtualEl){scrollYVirtualEl.style.width=`${osbWidth}px`;scrollYVirtualEl.style.height=`${tbHeight+tHeaderHeight+tFooterHeight}px`;scrollYVirtualEl.style.visibility=yScrollbarVisible;}const yTopCornerEl=$xeTable.$refs.refScrollYTopCornerElem;if(yTopCornerEl){yTopCornerEl.style.height=`${tHeaderHeight}px`;yTopCornerEl.style.display=tHeaderHeight&&yScrollbarVisible==='visible'?'block':'';}const yWrapperEl=$xeTable.$refs.refScrollYWrapperElem;if(yWrapperEl){yWrapperEl.style.height=`${tbHeight}px`;yWrapperEl.style.top=`${tHeaderHeight}px`;}const yBottomCornerEl=$xeTable.$refs.refScrollYBottomCornerElem;if(yBottomCornerEl){yBottomCornerEl.style.height=`${tFooterHeight}px`;yBottomCornerEl.style.top=`${tHeaderHeight+tbHeight}px`;yBottomCornerEl.style.display=tFooterHeight&&yScrollbarVisible==='visible'?'block':'';}const rowExpandEl=$xeTable.$refs.refRowExpandElem;if(rowExpandEl){rowExpandEl.style.height=`${tbHeight}px`;rowExpandEl.style.top=`${tHeaderHeight}px`;}internalData.tBodyHeight=tbHeight;containerList.forEach((name,index)=>{const fixedType=index>0?name:'';const layoutList=['header','body','footer'];const isFixedLeft=fixedType==='left';let fixedColumn=[];let fixedWrapperElem;if(fixedType){fixedColumn=isFixedLeft?leftList:rightList;fixedWrapperElem=isFixedLeft?$xeTable.$refs.refLeftContainer:$xeTable.$refs.refRightContainer;}layoutList.forEach(layout=>{const wrapperElem=getRefElem(elemStore[`${name}-${layout}-wrapper`]);const currScrollElem=getRefElem(elemStore[`${name}-${layout}-scroll`]);const tableElem=getRefElem(elemStore[`${name}-${layout}-table`]);if(layout==='header'){// 表头体样式处理
|
|
7683
7735
|
// 横向滚动渲染
|
|
7684
7736
|
let renderColumnList=tableColumn;const isOptimizeMode=isHeaderRenderOptimize;if(isGroup){renderColumnList=visibleColumn;}else{if(!isOptimizeMode||!isColLoading&&(fixedType||!overflowX)){renderColumnList=visibleColumn;}if(fixedType){// 如果是使用优化模式
|
|
7685
7737
|
if(isOptimizeMode){renderColumnList=fixedColumn||[];}}}const tWidth=renderColumnList.reduce((previous,column)=>previous+column.renderWidth,0);if(fixedType){if(isGroup){if(wrapperElem){wrapperElem.style.width=scrollXWidth?`${scrollXWidth}px`:'';}}else{if(isOptimizeMode){if(wrapperElem){wrapperElem.style.width=tWidth?`${tWidth}px`:'';}}else{if(wrapperElem){wrapperElem.style.width=scrollXWidth?`${scrollXWidth}px`:'';}}}}if(currScrollElem){currScrollElem.style.height=`${tHeaderHeight}px`;}if(tableElem){tableElem.style.width=tWidth?`${tWidth}px`:'';}}else if(layout==='body'){if(currScrollElem){currScrollElem.style.maxHeight=customMaxHeight?`${bodyMaxHeight}px`:'';currScrollElem.style.height=customHeight?`${tbHeight}px`:'';currScrollElem.style.minHeight=`${bodyMinHeight}px`;}// 如果是固定列
|
|
@@ -7749,19 +7801,20 @@ val=144;}}else{val=defMinHeight;}}}let num=0;if(val){if(val==='100%'||val==='aut
|
|
|
7749
7801
|
* 支持动态列表调整分配
|
|
7750
7802
|
* 支持自动分配偏移量
|
|
7751
7803
|
* 支持 width=60 width=60px width=10% min-width=60 min-width=60px min-width=10%
|
|
7752
|
-
*/function autoCellWidth($xeTable){const props=$xeTable;const reactData=$xeTable;const internalData=$xeTable;const{elemStore}=internalData;const bodyWrapperElem=getRefElem(elemStore['main-body-wrapper']);if(!bodyWrapperElem){return;}const yHandleEl=$xeTable.$refs.refScrollYHandleElem;if(!yHandleEl){return;}const xHandleEl=$xeTable.$refs.refScrollXHandleElem;if(!xHandleEl){return;}let tWidth=0;const minCellWidth=40;// 列宽最少限制 40px
|
|
7753
|
-
const bodyWidth=bodyWrapperElem.clientWidth;let remainWidth=bodyWidth;let meanWidth=remainWidth/100;const{fit}=props;const{columnStore}=reactData;const{resizeList,pxMinList,autoMinList,pxList,scaleList,scaleMinList,autoList,remainList}=columnStore;// 最小宽
|
|
7754
|
-
pxMinList.forEach(column=>{
|
|
7755
|
-
autoMinList.forEach(column=>{
|
|
7756
|
-
scaleMinList.forEach(column=>{
|
|
7757
|
-
scaleList.forEach(column=>{
|
|
7758
|
-
pxList.forEach(column=>{
|
|
7759
|
-
autoList.forEach(column=>{
|
|
7760
|
-
resizeList.forEach(column=>{const width=external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(column.resizeWidth);tWidth+=width;column.renderWidth=width;});remainWidth-=tWidth;meanWidth=remainWidth>0?Math.floor(remainWidth/(
|
|
7804
|
+
*/function autoCellWidth($xeTable){const props=$xeTable;const reactData=$xeTable;const internalData=$xeTable;const{elemStore}=internalData;const bodyWrapperElem=getRefElem(elemStore['main-body-wrapper']);if(!bodyWrapperElem){return;}const yHandleEl=$xeTable.$refs.refScrollYHandleElem;if(!yHandleEl){return;}const xHandleEl=$xeTable.$refs.refScrollXHandleElem;if(!xHandleEl){return;}const columnOpts=$xeTable.computeColumnOpts;let tWidth=0;const minCellWidth=40;// 列宽最少限制 40px
|
|
7805
|
+
const bodyWidth=bodyWrapperElem.clientWidth;let remainWidth=bodyWidth;let meanWidth=remainWidth/100;const{fit}=props;const{columnStore}=reactData;const{resizeList,pxMinList,autoMinList,pxList,scaleList,scaleMinList,autoList,remainList}=columnStore;const parseColumnMaxWidth=column=>{const maxWidth=column.maxWidth||columnOpts.maxWidth;if(maxWidth&&maxWidth!=='auto'){if(isScale(maxWidth)){return Math.floor(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(maxWidth)*meanWidth);}return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(maxWidth);}return 0;};// 最小宽
|
|
7806
|
+
pxMinList.forEach(column=>{let miWidth=external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(column.minWidth);const mxWidth=parseColumnMaxWidth(column);if(mxWidth){miWidth=Math.min(miWidth,mxWidth);}tWidth+=miWidth;column.renderWidth=miWidth;});// 最小自适应
|
|
7807
|
+
autoMinList.forEach(column=>{let caWidth=Math.max(60,external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(column.renderAutoWidth));const mxWidth=parseColumnMaxWidth(column);if(mxWidth){caWidth=Math.min(caWidth,mxWidth);}tWidth+=caWidth;column.renderWidth=caWidth;});// 最小百分比
|
|
7808
|
+
scaleMinList.forEach(column=>{let smWidth=Math.floor(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(column.minWidth)*meanWidth);const mxWidth=parseColumnMaxWidth(column);if(mxWidth){smWidth=Math.min(smWidth,mxWidth);}tWidth+=smWidth;column.renderWidth=smWidth;});// 固定百分比
|
|
7809
|
+
scaleList.forEach(column=>{let sfWidth=Math.floor(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(column.width)*meanWidth);const mxWidth=parseColumnMaxWidth(column);if(mxWidth){sfWidth=Math.min(sfWidth,mxWidth);}tWidth+=sfWidth;column.renderWidth=sfWidth;});// 固定宽
|
|
7810
|
+
pxList.forEach(column=>{let pWidth=external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(column.width);const mxWidth=parseColumnMaxWidth(column);if(mxWidth){pWidth=Math.min(pWidth,mxWidth);}tWidth+=pWidth;column.renderWidth=pWidth;});// 自适应宽
|
|
7811
|
+
autoList.forEach(column=>{let aWidth=Math.max(60,external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(column.renderAutoWidth));const mxWidth=parseColumnMaxWidth(column);if(mxWidth){aWidth=Math.min(aWidth,mxWidth);}tWidth+=aWidth;column.renderWidth=aWidth;});// 调整了列宽
|
|
7812
|
+
resizeList.forEach(column=>{const width=external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(column.resizeWidth);tWidth+=width;column.renderWidth=width;});const zoomColumnList=scaleMinList.concat(pxMinList).concat(autoMinList).filter(column=>!parseColumnMaxWidth(column));remainWidth-=tWidth;meanWidth=remainWidth>0?Math.floor(remainWidth/(zoomColumnList.length+remainList.length)):0;if(fit){if(remainWidth>0){zoomColumnList.forEach(column=>{tWidth+=meanWidth;column.renderWidth+=meanWidth;});}}else{meanWidth=minCellWidth;}// 剩余均分
|
|
7761
7813
|
remainList.forEach(column=>{const width=Math.max(meanWidth,minCellWidth);column.renderWidth=width;tWidth+=width;});if(fit){/**
|
|
7762
7814
|
* 偏移量算法
|
|
7763
7815
|
* 如果所有列足够放的情况下,从最后动态列开始分配
|
|
7764
|
-
|
|
7816
|
+
* 排除已设置 max-width
|
|
7817
|
+
*/const dynamicList=scaleList.concat(scaleMinList).concat(pxMinList).concat(autoMinList).concat(remainList).filter(column=>!parseColumnMaxWidth(column));let dynamicSize=dynamicList.length-1;if(dynamicSize>0){let i=bodyWidth-tWidth;if(i>0){while(i>0&&dynamicSize>=0){i--;dynamicList[dynamicSize--].renderWidth++;}tWidth=bodyWidth;}}}reactData.scrollXWidth=tWidth;reactData.resizeWidthFlag++;updateColumnOffsetLeft($xeTable);updateHeight($xeTable);}/**
|
|
7765
7818
|
* 计算自适应行高
|
|
7766
7819
|
*/const calcCellAutoHeight=($xeTable,rowRest,wrapperEl)=>{const reactData=$xeTable;const{scrollXLoad}=reactData;const wrapperElemList=wrapperEl.querySelectorAll(`.vxe-cell--wrapper[rowid="${rowRest.rowid}"]`);let colHeight=0;let firstCellStyle=null;let topBottomPadding=0;for(let i=0;i<wrapperElemList.length;i++){const wrapperElem=wrapperElemList[i];const cellElem=wrapperElem.parentElement;const cellStyle=cellElem.style;const orHeight=cellStyle.height;if(!scrollXLoad){cellStyle.height='';}if(!firstCellStyle){firstCellStyle=getComputedStyle(cellElem);topBottomPadding=firstCellStyle?Math.ceil(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(firstCellStyle.paddingTop)+external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(firstCellStyle.paddingBottom)):0;}if(!scrollXLoad){cellStyle.height=orHeight;}const cellHeight=wrapperElem?wrapperElem.clientHeight:0;colHeight=Math.max(colHeight,Math.ceil(cellHeight+topBottomPadding));}if(scrollXLoad){colHeight=Math.max(colHeight,rowRest.height);}return colHeight;};/**
|
|
7767
7820
|
* 自适应行高
|
|
@@ -7795,7 +7848,7 @@ treeData=external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils
|
|
|
7795
7848
|
internalData.tableFullData=fullData;internalData.tableFullTreeData=isRGroup?[]:treeData;internalData.tableFullGroupData=isRGroup?treeData:[];// 缓存数据
|
|
7796
7849
|
$xeTable.cacheRowMap(isReset);// 原始数据
|
|
7797
7850
|
internalData.tableSynchData=datas;if(isReset){internalData.isResizeCellHeight=false;}// 克隆原数据,用于显示编辑状态,与编辑值做对比
|
|
7798
|
-
if(keepSource){$xeTable.cacheSourceMap(fullData);}if($xeTable.clearCellAreas&&props.mouseConfig){$xeTable.clearCellAreas();$xeTable.clearCopyCellArea();}$xeTable.clearMergeCells();$xeTable.clearMergeFooterItems();$xeTable.clearHistory();$xeTable.handleTableData(true);$xeTable.updateFooter();$xeTable.handleUpdateBodyMerge();return $xeTable.$nextTick().then(()=>{updateHeight($xeTable);updateStyle($xeTable);}).then(()=>{computeScrollLoad($xeTable);}).then(()=>{const virtualYOpts=$xeTable.computeVirtualYOpts;// 是否启用了虚拟滚动
|
|
7851
|
+
if(keepSource){$xeTable.cacheSourceMap(fullData);}if($xeTable.clearCellAreas&&props.mouseConfig){$xeTable.clearCellAreas();$xeTable.clearCopyCellArea();}$xeTable.clearMergeCells();$xeTable.clearMergeFooterItems();$xeTable.clearHistory();$xeTable.handleTableData(true);$xeTable.updateFooter();$xeTable.handleUpdateBodyMerge();return $xeTable.$nextTick().then(()=>{updateHeight($xeTable);updateStyle($xeTable);}).then(()=>{computeScrollLoad($xeTable);syncGanttScrollYStatus($xeTable);}).then(()=>{const virtualYOpts=$xeTable.computeVirtualYOpts;// 是否启用了虚拟滚动
|
|
7799
7852
|
if(sYLoad){scrollYStore.endIndex=scrollYStore.visibleSize;}if(sYLoad){if(reactData.expandColumn&&expandOpts.mode!=='fixed'){errLog('vxe.error.notConflictProp',['column.type="expand','expand-config.mode="fixed"']);}if(virtualYOpts.mode==='scroll'&&reactData.expandColumn&&expandOpts.mode==='fixed'){warnLog('vxe.error.notConflictProp',['virtual-y-config.mode=scroll','expand-config.mode=inside']);}// if (showOverflow) {
|
|
7800
7853
|
// if (!rowOpts.height) {
|
|
7801
7854
|
// const errColumn = internalData.tableFullColumn.find(column => column.showOverflow === false)
|
|
@@ -7811,7 +7864,7 @@ if(!(props.height||props.maxHeight)){errLog('vxe.error.reqSupportProp',['virtual
|
|
|
7811
7864
|
// warnLog('vxe.error.scrollErrProp', ['span-method'])
|
|
7812
7865
|
// }
|
|
7813
7866
|
}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;// 是否在更新数据之后自动滚动重置滚动条
|
|
7814
|
-
if(virtualXOpts.scrollToLeftOnChange){targetScrollLeft=0;}if(virtualYOpts.scrollToTopOnChange){targetScrollTop=0;}reactData.isRowLoading=false;handleRecalculateStyle($xeTable,false,false,false);updateTreeLineStyle($xeTable);// 如果是自动行高,特殊情况需调用 recalculate 手动刷新
|
|
7867
|
+
if(virtualXOpts.scrollToLeftOnChange){targetScrollLeft=0;}if(virtualYOpts.scrollToTopOnChange){targetScrollTop=0;}reactData.isRowLoading=false;handleRecalculateStyle($xeTable,false,false,false);updateTreeLineStyle($xeTable);syncGanttScrollYStatus($xeTable);// 如果是自动行高,特殊情况需调用 recalculate 手动刷新
|
|
7815
7868
|
if(!props.showOverflow){setTimeout(()=>{handleLazyRecalculate($xeTable,false,true,true);setTimeout(()=>handleLazyRecalculate($xeTable,false,true,true),3000);},2000);}// 是否变更虚拟滚动
|
|
7816
7869
|
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);}});});}/**
|
|
7817
7870
|
* 处理数据加载默认行为
|
|
@@ -8062,8 +8115,10 @@ filterOptions.forEach(option=>{const{_checked,checked}=option;option._checked=ch
|
|
|
8062
8115
|
*/refreshColumn(initSort){const $xeTable=this;if(initSort){handleUpdateColumn($xeTable);}return parseColumns($xeTable,true).then(()=>{return this.refreshScroll();}).then(()=>{return handleLazyRecalculate($xeTable,false,true,true);});},/**
|
|
8063
8116
|
* 指定列宽的列进行拆分
|
|
8064
8117
|
*/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;// 列之间的最小间距
|
|
8118
|
+
const maxInterval=getColReMaxWidth(cellParams);// 列之间的最大间距
|
|
8065
8119
|
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;}}}}// 处理拖动事件
|
|
8066
|
-
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)
|
|
8120
|
+
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);// 最大宽
|
|
8121
|
+
if(maxInterval>1){dragLeft=Math.min(dragLeft,maxInterval+dragMinLeft-minInterval);}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);const colMaxWidth=getColReMaxWidth(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);if(colMaxWidth>1){resizeWidth=Math.min(colMaxWidth,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;// 处理拖动事件
|
|
8067
8122
|
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;},/**
|
|
8068
8123
|
* 刷新滚动操作,手动同步滚动相关位置(对于某些特殊的操作,比如滚动条错位、固定列不同步)
|
|
8069
8124
|
*/refreshScroll(){const $xeTable=this;const internalData=$xeTable;const{elemStore,lastScrollLeft,lastScrollTop}=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=$xeTable.$refs.refScrollXHandleElem;const yHandleEl=$xeTable.$refs.refScrollYHandleElem;return new Promise(resolve=>{// 还原滚动条位置
|
|
@@ -8144,7 +8199,7 @@ evnt.preventDefault();$xeTable.handleUndoStackEvent(evnt);}}else if(keyboardConf
|
|
|
8144
8199
|
// }
|
|
8145
8200
|
// 如果是按下非功能键之外允许直接编辑
|
|
8146
8201
|
if(selectColumn&&selected.row&&isEnableConf(selectColumn.editRender)){const beforeEditMethod=editOpts.beforeEditMethod||editOpts.activeMethod;const params={row:selected.row,rowIndex:$xeTable.getRowIndex(selected.row),column:selectColumn,columnIndex:$xeTable.getColumnIndex(selectColumn),$table:$xeTable,$grid:$xeGrid,$gantt:$xeGantt};if(!beforeEditMethod||beforeEditMethod(params)){if(editMethod){editMethod(params);}else{let isClearValue=false;// 追加方式与覆盖式
|
|
8147
|
-
if(editMode!=='insert'){isClearValue=true;}$xeTable.handleEdit(params,evnt,{isClear:isClearValue});}}}}$xeTable.dispatchEvent('keydown',{},evnt);});}},handleGlobalPasteEvent(evnt){const $xeTable=this;const{
|
|
8202
|
+
if(editMode!=='insert'){isClearValue=true;}$xeTable.handleEdit(params,evnt,{isClear:isClearValue});}}}}$xeTable.dispatchEvent('keydown',{},evnt);});}},handleGlobalPasteEvent(evnt){const $xeTable=this;const props=$xeTable;const internalData=$xeTable;const reactData=$xeTable;const{keyboardConfig,mouseConfig}=props;const{editStore,filterStore}=reactData;const{isActivated}=internalData;const mouseOpts=$xeTable.computeMouseOpts;const keyboardOpts=$xeTable.computeKeyboardOpts;const{actived}=editStore;if(isActivated&&!filterStore.visible){if(!(actived.row||actived.column)){if(keyboardConfig&&keyboardOpts.isClip&&mouseConfig&&mouseOpts.area&&$xeTable.handlePeClAreaEvent){$xeTable.handlePeClAreaEvent(evnt);}}$xeTable.dispatchEvent('paste',{},evnt);}},handleGlobalCopyEvent(evnt){const $xeTable=this;const props=$xeTable;const internalData=$xeTable;const reactData=$xeTable;const{keyboardConfig,mouseConfig}=props;const{editStore,filterStore}=reactData;const{isActivated}=internalData;const mouseOpts=$xeTable.computeMouseOpts;const keyboardOpts=$xeTable.computeKeyboardOpts;const{actived}=editStore;if(isActivated&&!filterStore.visible){if(!(actived.row||actived.column)){if(keyboardConfig&&keyboardOpts.isClip&&mouseConfig&&mouseOpts.area&&$xeTable.handleCyClAreaEvent){$xeTable.handleCyClAreaEvent(evnt);}}$xeTable.dispatchEvent('copy',{},evnt);}},handleGlobalCutEvent(evnt){const $xeTable=this;const props=$xeTable;const internalData=$xeTable;const reactData=$xeTable;const{keyboardConfig,mouseConfig}=props;const{editStore,filterStore}=reactData;const{isActivated}=internalData;const mouseOpts=$xeTable.computeMouseOpts;const keyboardOpts=$xeTable.computeKeyboardOpts;const{actived}=editStore;if(isActivated&&!filterStore.visible){if(!(actived.row||actived.column)){if(keyboardConfig&&keyboardOpts.isClip&&mouseConfig&&mouseOpts.area&&$xeTable.handleCutCellAreaEvent){$xeTable.handleCutCellAreaEvent(evnt);}}$xeTable.dispatchEvent('cut',{},evnt);}},handleGlobalResizeEvent(){const $xeTable=this;$xeTable.closeMenu();$xeTable.updateCellAreas();handleResizeEvent($xeTable);$xeTable.updateCellAreas();},handleUpdateHeaderMerge(){const $xeTable=this;const reactData=$xeTable;const internalData=$xeTable;const{mergeHeaderList}=internalData;const{mergeMaps,mergeRowMaps,mergeColMaps}=buildMergeData(mergeHeaderList);internalData.mergeHeaderCellMaps=mergeMaps;internalData.mergeHeaderRowMaps=mergeRowMaps;internalData.mergeHeaderColMaps=mergeColMaps;reactData.mergeHeadFlag++;},/**
|
|
8148
8203
|
* 处理合并
|
|
8149
8204
|
*/handleUpdateBodyMerge(){const $xeTable=this;const reactData=$xeTable;const internalData=$xeTable;const{mergeBodyList}=internalData;const{mergeMaps,mergeRowMaps,mergeColMaps}=buildMergeData(mergeBodyList);internalData.mergeBodyCellMaps=mergeMaps;internalData.mergeBodyRowMaps=mergeRowMaps;internalData.mergeBodyColMaps=mergeColMaps;reactData.mergeBodyFlag++;},handleUpdateFooterMerge(){const $xeTable=this;const reactData=$xeTable;const internalData=$xeTable;const{mergeFooterList}=internalData;const{mergeMaps,mergeRowMaps,mergeColMaps}=buildMergeData(mergeFooterList);internalData.mergeFooterCellMaps=mergeMaps;internalData.mergeFooterRowMaps=mergeRowMaps;internalData.mergeFooterColMaps=mergeColMaps;reactData.mergeFootFlag++;},handleAggregateSummaryData(){const $xeTable=this;return $xeTable.refreshAggregateCalcValues();},handleTargetLeaveEvent(){const $xeTable=this;const internalData=$xeTable;const tooltipOpts=$xeTable.computeTooltipOpts;let $tooltip=$xeTable.$refs.refTooltip;if($tooltip&&$tooltip.setActived){$tooltip.setActived(false);}if(tooltipOpts.enterable){internalData.tooltipTimeout=setTimeout(()=>{$tooltip=$xeTable.$refs.refTooltip;if($tooltip&&$tooltip.isActived&&!$tooltip.isActived()){$xeTable.closeTooltip();}},tooltipOpts.leaveDelay);}else{$xeTable.closeTooltip();}},triggerHeaderTitleEvent(evnt,iconParams,params){const $xeTable=this;const reactData=$xeTable;const tipContent=iconParams.content||iconParams.message;if(tipContent){const{tooltipStore}=reactData;const{column}=params;const content=getFuncText(tipContent);handleTargetEnterEvent($xeTable,true);tooltipStore.row=null;tooltipStore.column=column;tooltipStore.visible=true;tooltipStore.currOpts=iconParams;$xeTable.$nextTick(()=>{const $tooltip=$xeTable.$refs.refTooltip;if($tooltip&&$tooltip.open){$tooltip.open(evnt.currentTarget,content);}});}},/**
|
|
8150
8205
|
* 触发表头 tooltip 事件
|
|
@@ -8405,7 +8460,7 @@ updateScrollYSpace(){const $xeTable=this;const reactData=$xeTable;const internal
|
|
|
8405
8460
|
if(rHeight){sYHeight=(rowRest.oTop||0)+rHeight;// 是否展开行
|
|
8406
8461
|
if(expandColumn&&rowExpandedMaps[rowid]){sYHeight+=rowRest.expandHeight||expandOpts.height||0;}}}if(sYHeight>maxYHeight){isScrollYBig=true;}}else{sYHeight=bodyTableElem?bodyTableElem.clientHeight:0;}}}else{if(bodyTableElem){sYHeight=bodyTableElem.clientHeight;}}let clientHeight=0;if(bodyScrollElem){clientHeight=bodyScrollElem.clientHeight;}// 虚拟渲染
|
|
8407
8462
|
let ySpaceHeight=sYHeight;let scrollYTop=ySpaceTop;if(isScrollYBig){// 触底
|
|
8408
|
-
if(bodyScrollElem&&bodyTableElem&&bodyScrollElem.scrollTop+clientHeight>=maxYHeight){scrollYTop=maxYHeight-bodyTableElem.clientHeight;}else{scrollYTop=(maxYHeight-clientHeight)*(ySpaceTop/(scrollYHeight-clientHeight));}ySpaceHeight=maxYHeight;}if(!(scrollYLoad&&overflowY)){scrollYTop=0;}if(methods_getConfig().scrollMarginStyle){if(leftBodyTableElem){leftBodyTableElem.style.marginTop=`${scrollYTop}px`;}if(bodyTableElem){bodyTableElem.style.marginTop=`${scrollYTop}px`;}if(rightbodyTableElem){rightbodyTableElem.style.marginTop=`${scrollYTop}px`;}}else{if(leftBodyTableElem){leftBodyTableElem.style.transform=`translate(0px, ${scrollYTop}px)`;}if(bodyTableElem){bodyTableElem.style.transform=`translate(${reactData.scrollXLeft||0}px, ${scrollYTop}px)`;}if(rightbodyTableElem){rightbodyTableElem.style.transform=`translate(0px, ${scrollYTop}px)`;}}containerList.forEach(name=>{const layoutList=['header','body','footer'];layoutList.forEach(layout=>{const ySpaceElem=getRefElem(elemStore[`${name}-${layout}-ySpace`]);if(ySpaceElem){ySpaceElem.style.height=ySpaceHeight?`${ySpaceHeight}px`:'';}});});const scrollYSpaceEl=$xeTable.$refs.refScrollYSpaceElem;if(scrollYSpaceEl){scrollYSpaceEl.style.height=ySpaceHeight?`${ySpaceHeight}px`:'';}const rowExpandYSpaceEl=$xeTable.$refs.refRowExpandYSpaceElem;if(rowExpandYSpaceEl){rowExpandYSpaceEl.style.height=ySpaceHeight?`${ySpaceHeight}px`:'';}reactData.scrollYTop=scrollYTop;reactData.scrollYHeight=isScrollYBig?sYHeight:ySpaceHeight;reactData.isScrollYBig=isScrollYBig;calcScrollbar($xeTable);if(isScrollYBig&&mouseOpts.area){errLog('vxe.error.notProp',['mouse-config.area']);}if($xeGanttView&&$xeGanttView.handleUpdateSYSpace){$xeGanttView.handleUpdateSYSpace();}return $xeTable.$nextTick().then(()=>{return updateStyle($xeTable);});},updateScrollYStatus(){const $xeTable=this;return updateScrollYStatus($xeTable);},/**
|
|
8463
|
+
if(bodyScrollElem&&bodyTableElem&&bodyScrollElem.scrollTop+clientHeight>=maxYHeight){scrollYTop=maxYHeight-bodyTableElem.clientHeight;}else{scrollYTop=(maxYHeight-clientHeight)*(ySpaceTop/(scrollYHeight-clientHeight));}ySpaceHeight=maxYHeight;}if(!(scrollYLoad&&overflowY)){scrollYTop=0;}if(methods_getConfig().scrollMarginStyle){if(leftBodyTableElem){leftBodyTableElem.style.marginTop=`${scrollYTop}px`;}if(bodyTableElem){bodyTableElem.style.marginTop=`${scrollYTop}px`;}if(rightbodyTableElem){rightbodyTableElem.style.marginTop=`${scrollYTop}px`;}}else{if(leftBodyTableElem){leftBodyTableElem.style.transform=`translate(0px, ${scrollYTop}px)`;}if(bodyTableElem){bodyTableElem.style.transform=`translate(${reactData.scrollXLeft||0}px, ${scrollYTop}px)`;}if(rightbodyTableElem){rightbodyTableElem.style.transform=`translate(0px, ${scrollYTop}px)`;}}containerList.forEach(name=>{const layoutList=['header','body','footer'];layoutList.forEach(layout=>{const ySpaceElem=getRefElem(elemStore[`${name}-${layout}-ySpace`]);if(ySpaceElem){ySpaceElem.style.height=ySpaceHeight?`${ySpaceHeight}px`:'';}});});const scrollYSpaceEl=$xeTable.$refs.refScrollYSpaceElem;if(scrollYSpaceEl){scrollYSpaceEl.style.height=ySpaceHeight?`${ySpaceHeight}px`:'';}const rowExpandYSpaceEl=$xeTable.$refs.refRowExpandYSpaceElem;if(rowExpandYSpaceEl){rowExpandYSpaceEl.style.height=ySpaceHeight?`${ySpaceHeight}px`:'';}reactData.scrollYTop=scrollYTop;reactData.scrollYHeight=isScrollYBig?sYHeight:ySpaceHeight;reactData.isScrollYBig=isScrollYBig;calcScrollbar($xeTable);if(isScrollYBig&&mouseOpts.area){errLog('vxe.error.notProp',['mouse-config.area']);}if($xeGanttView&&$xeGanttView.handleUpdateSYSpace){$xeGanttView.handleUpdateSYSpace();}return $xeTable.$nextTick().then(()=>{return updateStyle($xeTable);});},updateScrollYStatus(fullData){const $xeTable=this;return updateScrollYStatus($xeTable,fullData);},/**
|
|
8409
8464
|
* 如果有滚动条,则滚动到对应的位置
|
|
8410
8465
|
*/scrollTo(scrollLeft,scrollTop){const $xeTable=this;const reactData=$xeTable;const internalData=$xeTable;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=$xeTable.$refs.refScrollXHandleElem;const yHandleEl=$xeTable.$refs.refScrollYHandleElem;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);if(reactData.scrollXLoad){loadScrollXData($xeTable);}}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);if(reactData.scrollYLoad){loadScrollYData($xeTable);}}return new Promise(resolve=>{setTimeout(()=>{$xeTable.$nextTick(()=>{internalData.intoRunScroll=false;resolve();});},reactData.scrollXLoad||reactData.scrollYLoad?30:0);});},/**
|
|
8411
8466
|
* 如果有滚动条,则滚动到对应的行
|
|
@@ -8910,18 +8965,6 @@ function renderTdColumn(h, $xeTable, seq, rowid, fixedType, isOptimizeMode, rowL
|
|
|
8910
8965
|
class: 'vxe-cell--wrapper vxe-body-cell--wrapper'
|
|
8911
8966
|
}, column.renderCell(h, cellParams)));
|
|
8912
8967
|
}
|
|
8913
|
-
tdVNs.push(h('div', {
|
|
8914
|
-
key: 'tc',
|
|
8915
|
-
class: ['vxe-cell', {
|
|
8916
|
-
'c--title': showTitle,
|
|
8917
|
-
'c--tooltip': showTooltip,
|
|
8918
|
-
'c--ellipsis': showEllipsis
|
|
8919
|
-
}],
|
|
8920
|
-
style: tcStyle,
|
|
8921
|
-
attrs: {
|
|
8922
|
-
title: showTitle ? $xeTable.getCellLabel(row, column) : null
|
|
8923
|
-
}
|
|
8924
|
-
}, clVNs));
|
|
8925
8968
|
if (showValidTip && errorValidItem) {
|
|
8926
8969
|
const errRule = errorValidItem.rule;
|
|
8927
8970
|
const validSlot = slots ? slots.valid : null;
|
|
@@ -8930,7 +8973,7 @@ function renderTdColumn(h, $xeTable, seq, rowid, fixedType, isOptimizeMode, rowL
|
|
|
8930
8973
|
...errorValidItem,
|
|
8931
8974
|
rule: errorValidItem
|
|
8932
8975
|
};
|
|
8933
|
-
|
|
8976
|
+
clVNs.push(h('div', {
|
|
8934
8977
|
key: 'tcv',
|
|
8935
8978
|
class: ['vxe-cell--valid-error-tip', getClass(validOpts.className, errorValidItem)],
|
|
8936
8979
|
style: errRule && errRule.maxWidth ? {
|
|
@@ -8942,6 +8985,18 @@ function renderTdColumn(h, $xeTable, seq, rowid, fixedType, isOptimizeMode, rowL
|
|
|
8942
8985
|
class: 'vxe-cell--valid-error-msg'
|
|
8943
8986
|
}, errorValidItem.content)]])]));
|
|
8944
8987
|
}
|
|
8988
|
+
tdVNs.push(h('div', {
|
|
8989
|
+
key: 'tc',
|
|
8990
|
+
class: ['vxe-cell', {
|
|
8991
|
+
'c--title': showTitle,
|
|
8992
|
+
'c--tooltip': showTooltip,
|
|
8993
|
+
'c--ellipsis': showEllipsis
|
|
8994
|
+
}],
|
|
8995
|
+
style: tcStyle,
|
|
8996
|
+
attrs: {
|
|
8997
|
+
title: showTitle ? $xeTable.getCellLabel(row, column) : null
|
|
8998
|
+
}
|
|
8999
|
+
}, clVNs));
|
|
8945
9000
|
}
|
|
8946
9001
|
let showAreaRowStatus = false;
|
|
8947
9002
|
if (mouseConfig && mouseOpts.area && !_columnIndex && selectCellToRow) {
|