vxe-table 4.18.11 → 4.18.12
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/header.js +3 -1
- package/es/table/src/table.js +27 -4
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/lib/index.umd.js +15 -13
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/table/src/header.js +7 -5
- package/lib/table/src/header.min.js +1 -1
- package/lib/table/src/table.js +6 -6
- 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/header.ts +3 -1
- package/packages/table/src/table.ts +28 -5
- /package/es/{iconfont.1775652066125.ttf → iconfont.1776048383631.ttf} +0 -0
- /package/es/{iconfont.1775652066125.woff → iconfont.1776048383631.woff} +0 -0
- /package/es/{iconfont.1775652066125.woff2 → iconfont.1776048383631.woff2} +0 -0
- /package/lib/{iconfont.1775652066125.ttf → iconfont.1776048383631.ttf} +0 -0
- /package/lib/{iconfont.1775652066125.woff → iconfont.1776048383631.woff} +0 -0
- /package/lib/{iconfont.1775652066125.woff2 → iconfont.1776048383631.woff2} +0 -0
package/es/table/src/header.js
CHANGED
|
@@ -44,7 +44,9 @@ export default defineVxeComponent({
|
|
|
44
44
|
spanColumns = visibleColgroups;
|
|
45
45
|
}
|
|
46
46
|
headerColumn.value = spanColumns;
|
|
47
|
-
|
|
47
|
+
nextTick(() => {
|
|
48
|
+
$xeTable.dispatchEvent('columns-change', { visibleColgroups, collectColumn, visibleColumn }, null);
|
|
49
|
+
});
|
|
48
50
|
};
|
|
49
51
|
const renderRows = (isGroup, isOptimizeMode, headerGroups, $rowIndex, cols) => {
|
|
50
52
|
const $xeGrid = $xeTable.xeGrid;
|
package/es/table/src/table.js
CHANGED
|
@@ -1956,10 +1956,13 @@ export default defineVxeComponent({
|
|
|
1956
1956
|
const { treeConfig } = props;
|
|
1957
1957
|
const { tableData, isAllOverflow, scrollYLoad, scrollXLoad } = reactData;
|
|
1958
1958
|
const { fullAllDataRowIdData } = internalData;
|
|
1959
|
+
const el = refElem.value;
|
|
1960
|
+
if (!el || !el.clientWidth) {
|
|
1961
|
+
return;
|
|
1962
|
+
}
|
|
1959
1963
|
const treeOpts = computeTreeOpts.value;
|
|
1960
1964
|
const defaultRowHeight = computeDefaultRowHeight.value;
|
|
1961
|
-
|
|
1962
|
-
if (el && !isAllOverflow && (scrollYLoad || scrollXLoad || (treeConfig && treeOpts.showLine))) {
|
|
1965
|
+
if (!isAllOverflow && (scrollYLoad || scrollXLoad || (treeConfig && treeOpts.showLine))) {
|
|
1963
1966
|
const { handleGetRowId } = createHandleGetRowId($xeTable);
|
|
1964
1967
|
el.setAttribute('data-calc-row', 'Y');
|
|
1965
1968
|
tableData.forEach(row => {
|
|
@@ -3201,6 +3204,10 @@ export default defineVxeComponent({
|
|
|
3201
3204
|
const { scrollXWidth, scrollYHeight } = reactData;
|
|
3202
3205
|
const { elemStore } = internalData;
|
|
3203
3206
|
const scrollbarOpts = computeScrollbarOpts.value;
|
|
3207
|
+
const el = refElem.value;
|
|
3208
|
+
if (!el || !el.clientWidth) {
|
|
3209
|
+
return;
|
|
3210
|
+
}
|
|
3204
3211
|
const bodyWrapperElem = getRefElem(elemStore['main-body-wrapper']);
|
|
3205
3212
|
const headerTableElem = getRefElem(elemStore['main-header-table']);
|
|
3206
3213
|
const footerTableElem = getRefElem(elemStore['main-footer-table']);
|
|
@@ -4446,6 +4453,10 @@ export default defineVxeComponent({
|
|
|
4446
4453
|
};
|
|
4447
4454
|
const updateColumnOffsetLeft = () => {
|
|
4448
4455
|
const { visibleColumn, fullColumnIdData } = internalData;
|
|
4456
|
+
const el = refElem.value;
|
|
4457
|
+
if (!el || !el.clientWidth) {
|
|
4458
|
+
return;
|
|
4459
|
+
}
|
|
4449
4460
|
let offsetLeft = 0;
|
|
4450
4461
|
for (let cIndex = 0, rLen = visibleColumn.length; cIndex < rLen; cIndex++) {
|
|
4451
4462
|
const column = visibleColumn[cIndex];
|
|
@@ -4460,6 +4471,10 @@ export default defineVxeComponent({
|
|
|
4460
4471
|
const updateRowOffsetTop = () => {
|
|
4461
4472
|
const { expandColumn } = reactData;
|
|
4462
4473
|
const { afterFullData, fullAllDataRowIdData, rowExpandedMaps } = internalData;
|
|
4474
|
+
const el = refElem.value;
|
|
4475
|
+
if (!el || !el.clientWidth) {
|
|
4476
|
+
return;
|
|
4477
|
+
}
|
|
4463
4478
|
const expandOpts = computeExpandOpts.value;
|
|
4464
4479
|
const rowOpts = computeRowOpts.value;
|
|
4465
4480
|
const cellOpts = computeCellOpts.value;
|
|
@@ -4483,6 +4498,10 @@ export default defineVxeComponent({
|
|
|
4483
4498
|
*/
|
|
4484
4499
|
const updateRowExpandStyle = () => {
|
|
4485
4500
|
const { expandColumn, scrollYLoad, scrollYTop, isScrollYBig } = reactData;
|
|
4501
|
+
const el = refElem.value;
|
|
4502
|
+
if (!el || !el.clientWidth) {
|
|
4503
|
+
return;
|
|
4504
|
+
}
|
|
4486
4505
|
const expandOpts = computeExpandOpts.value;
|
|
4487
4506
|
const rowOpts = computeRowOpts.value;
|
|
4488
4507
|
const cellOpts = computeCellOpts.value;
|
|
@@ -4546,6 +4565,10 @@ export default defineVxeComponent({
|
|
|
4546
4565
|
}
|
|
4547
4566
|
const { tableData } = reactData;
|
|
4548
4567
|
const { fullAllDataRowIdData, treeExpandedMaps } = internalData;
|
|
4568
|
+
const el = refElem.value;
|
|
4569
|
+
if (!el || !el.clientWidth) {
|
|
4570
|
+
return;
|
|
4571
|
+
}
|
|
4549
4572
|
const cellOpts = computeCellOpts.value;
|
|
4550
4573
|
const rowOpts = computeRowOpts.value;
|
|
4551
4574
|
const defaultRowHeight = computeDefaultRowHeight.value;
|
|
@@ -10246,7 +10269,7 @@ export default defineVxeComponent({
|
|
|
10246
10269
|
let newValue = row;
|
|
10247
10270
|
let isChange = oldValue !== newValue;
|
|
10248
10271
|
if (strict) {
|
|
10249
|
-
handleCheckedRadioRow(newValue);
|
|
10272
|
+
handleCheckedRadioRow(newValue, false);
|
|
10250
10273
|
}
|
|
10251
10274
|
else {
|
|
10252
10275
|
if (oldValue === newValue) {
|
|
@@ -10254,7 +10277,7 @@ export default defineVxeComponent({
|
|
|
10254
10277
|
}
|
|
10255
10278
|
isChange = oldValue !== newValue;
|
|
10256
10279
|
if (isChange && newValue) {
|
|
10257
|
-
handleCheckedRadioRow(newValue);
|
|
10280
|
+
handleCheckedRadioRow(newValue, false);
|
|
10258
10281
|
}
|
|
10259
10282
|
else {
|
|
10260
10283
|
newValue = null;
|
package/es/ui/index.js
CHANGED
package/es/ui/src/log.js
CHANGED
package/lib/index.umd.js
CHANGED
|
@@ -3144,7 +3144,7 @@ function getDefaultConfig(val1, def1) {
|
|
|
3144
3144
|
;// ./packages/ui/index.ts
|
|
3145
3145
|
|
|
3146
3146
|
|
|
3147
|
-
const version = "4.18.
|
|
3147
|
+
const version = "4.18.12";
|
|
3148
3148
|
core_.VxeUI.version = version;
|
|
3149
3149
|
core_.VxeUI.tableVersion = version;
|
|
3150
3150
|
core_.VxeUI.setConfig({
|
|
@@ -3670,7 +3670,7 @@ var esnext_iterator_some = __webpack_require__(7550);
|
|
|
3670
3670
|
const {
|
|
3671
3671
|
log: log_log
|
|
3672
3672
|
} = core_.VxeUI;
|
|
3673
|
-
const log_version = `table v${"4.18.
|
|
3673
|
+
const log_version = `table v${"4.18.12"}`;
|
|
3674
3674
|
const warnLog = log_log.create('warn', log_version);
|
|
3675
3675
|
const errLog = log_log.create('error', log_version);
|
|
3676
3676
|
;// ./packages/table/src/columnInfo.ts
|
|
@@ -8632,11 +8632,13 @@ const header_renderType = 'header';
|
|
|
8632
8632
|
spanColumns = visibleColgroups;
|
|
8633
8633
|
}
|
|
8634
8634
|
headerColumn.value = spanColumns;
|
|
8635
|
-
|
|
8636
|
-
|
|
8637
|
-
|
|
8638
|
-
|
|
8639
|
-
|
|
8635
|
+
(0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)(() => {
|
|
8636
|
+
$xeTable.dispatchEvent('columns-change', {
|
|
8637
|
+
visibleColgroups,
|
|
8638
|
+
collectColumn,
|
|
8639
|
+
visibleColumn
|
|
8640
|
+
}, null);
|
|
8641
|
+
});
|
|
8640
8642
|
};
|
|
8641
8643
|
const renderRows = (isGroup, isOptimizeMode, headerGroups, $rowIndex, cols) => {
|
|
8642
8644
|
const $xeGrid = $xeTable.xeGrid;
|
|
@@ -19709,7 +19711,7 @@ remainList.forEach(column=>{const width=Math.max(meanWidth,minCellWidth);column.
|
|
|
19709
19711
|
* 计算自适应行高
|
|
19710
19712
|
*/const calcCellAutoHeight=(rowRest,wrapperEl)=>{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;};/**
|
|
19711
19713
|
* 自适应行高
|
|
19712
|
-
*/const calcCellHeight=()=>{const{treeConfig}=props;const{tableData,isAllOverflow,scrollYLoad,scrollXLoad}=reactData;const{fullAllDataRowIdData}=internalData;const
|
|
19714
|
+
*/const calcCellHeight=()=>{const{treeConfig}=props;const{tableData,isAllOverflow,scrollYLoad,scrollXLoad}=reactData;const{fullAllDataRowIdData}=internalData;const el=refElem.value;if(!el||!el.clientWidth){return;}const treeOpts=computeTreeOpts.value;const defaultRowHeight=computeDefaultRowHeight.value;if(!isAllOverflow&&(scrollYLoad||scrollXLoad||treeConfig&&treeOpts.showLine)){const{handleGetRowId}=createHandleGetRowId($xeTable);el.setAttribute('data-calc-row','Y');tableData.forEach(row=>{const rowid=handleGetRowId(row);const rowRest=fullAllDataRowIdData[rowid];if(rowRest){const reHeight=calcCellAutoHeight(rowRest,el);rowRest.height=Math.max(defaultRowHeight,reHeight);}el.removeAttribute('data-calc-row');});reactData.calcCellHeightFlag++;}};const getOrderField=column=>{const{isRowGroupStatus}=reactData;const{sortBy,sortType,aggFunc}=column;return isRowGroupStatus&&aggFunc?row=>{if(row.isAggregate){const aggData=row.aggData;const currAggData=aggData?aggData[column.field]:null;return currAggData?currAggData.value:null;}let cellValue;if(sortBy){cellValue=external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(sortBy)?sortBy({row,column}):external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row,sortBy);}else{cellValue=$xeTable.getCellLabel(row,column);}if(!sortType||sortType==='auto'){return isNaN(cellValue)?cellValue:external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(cellValue);}else if(sortType==='number'){return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(cellValue);}else if(sortType==='string'){return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toValueString(cellValue);}return cellValue;}:row=>{let cellValue;if(sortBy){cellValue=external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(sortBy)?sortBy({row,column}):external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row,sortBy);}else{cellValue=$xeTable.getCellLabel(row,column);}if(!sortType||sortType==='auto'){return isNaN(cellValue)?cellValue:external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(cellValue);}else if(sortType==='number'){return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(cellValue);}else if(sortType==='string'){return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toValueString(cellValue);}return cellValue;};};const updateAfterListIndex=()=>{const{treeConfig}=props;const{afterFullData,fullDataRowIdData,fullAllDataRowIdData}=internalData;const{handleGetRowId}=createHandleGetRowId($xeTable);const fullMaps={};afterFullData.forEach((row,index)=>{const rowid=handleGetRowId(row);const rowRest=fullAllDataRowIdData[rowid];const seq=index+1;if(rowRest){if(!treeConfig){rowRest.seq=seq;}rowRest._index=index;}else{const rest={row,rowid,seq,index:-1,$index:-1,_index:index,treeIndex:-1,_tIndex:-1,items:[],parent:null,level:0,height:0,resizeHeight:0,oTop:0,expandHeight:0};fullAllDataRowIdData[rowid]=rest;fullDataRowIdData[rowid]=rest;}fullMaps[rowid]=row;});internalData.afterFullRowMaps=fullMaps;};/**
|
|
19713
19715
|
* 预编译
|
|
19714
19716
|
* 对渲染中的数据提前解析序号及索引。牺牲提前编译耗时换取渲染中额外损耗,使运行时更加流畅
|
|
19715
19717
|
*/const updateAfterDataIndex=()=>{const{treeConfig}=props;const{fullDataRowIdData,fullAllDataRowIdData,afterFullData,afterTreeFullData}=internalData;const treeOpts=computeTreeOpts.value;const{transform}=treeOpts;const childrenField=treeOpts.children||treeOpts.childrenField;const fullMaps={};if(treeConfig){let _treeIndex=0;const{handleGetRowId}=createHandleGetRowId($xeTable);external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(afterTreeFullData,(row,index,items,path)=>{const rowid=handleGetRowId(row);const rowRest=fullAllDataRowIdData[rowid];const seq=path.map((num,i)=>i%2===0?Number(num)+1:'.').join('');if(rowRest){rowRest.seq=seq;rowRest.treeIndex=index;rowRest._tIndex=_treeIndex;}else{const rest={row,rowid,seq,index:-1,$index:-1,_index:-1,treeIndex:-1,_tIndex:_treeIndex,items:[],parent:null,level:0,height:0,resizeHeight:0,oTop:0,expandHeight:0};fullAllDataRowIdData[rowid]=rest;fullDataRowIdData[rowid]=rest;}_treeIndex++;fullMaps[rowid]=row;},{children:transform?treeOpts.mapChildrenField:childrenField});if(transform){afterFullData.forEach((row,index)=>{const rowid=handleGetRowId(row);const rowRest=fullAllDataRowIdData[rowid];const seq=index+1;if(rowRest){if(!treeConfig){rowRest.seq=seq;}rowRest._index=index;}});}internalData.afterFullRowMaps=fullMaps;}else{updateAfterListIndex();}};/**
|
|
@@ -19796,7 +19798,7 @@ if(!checkStrictly&&$xeTable.isCheckedByCheckboxRow(row)){handleCheckedCheckboxRo
|
|
|
19796
19798
|
const computeScrollLoad=()=>{return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)().then(()=>{const{scrollXLoad,scrollYLoad}=reactData;const{scrollXStore,scrollYStore}=internalData;const virtualYOpts=computeVirtualYOpts.value;const virtualXOpts=computeVirtualXOpts.value;// 计算 X 逻辑
|
|
19797
19799
|
if(scrollXLoad){const{toVisibleIndex:toXVisibleIndex,visibleSize:visibleXSize}=handleVirtualXVisible();const offsetXSize=Math.max(0,virtualXOpts.oSize?external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(virtualXOpts.oSize):0);scrollXStore.preloadSize=external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(virtualXOpts.preSize);scrollXStore.offsetSize=offsetXSize;scrollXStore.visibleSize=visibleXSize;scrollXStore.endIndex=Math.max(scrollXStore.startIndex+scrollXStore.visibleSize+offsetXSize,scrollXStore.endIndex);scrollXStore.visibleStartIndex=Math.max(scrollXStore.startIndex,toXVisibleIndex);scrollXStore.visibleEndIndex=Math.min(scrollXStore.endIndex,toXVisibleIndex+visibleXSize);$xeTable.updateScrollXData().then(()=>{loadScrollXData();});}else{$xeTable.updateScrollXSpace();}// 计算 Y 逻辑
|
|
19798
19800
|
const rowHeight=computeRowHeight();scrollYStore.rowHeight=rowHeight;// 已废弃
|
|
19799
|
-
reactData.rowHeight=rowHeight;const{toVisibleIndex:toYVisibleIndex,visibleSize:visibleYSize}=handleVirtualYVisible();if(scrollYLoad){const offsetYSize=Math.max(0,virtualYOpts.oSize?external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(virtualYOpts.oSize):0);scrollYStore.preloadSize=external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(virtualYOpts.preSize);scrollYStore.offsetSize=offsetYSize;scrollYStore.visibleSize=visibleYSize;scrollYStore.endIndex=Math.max(scrollYStore.startIndex+visibleYSize+offsetYSize,scrollYStore.endIndex);scrollYStore.visibleStartIndex=Math.max(scrollYStore.startIndex,toYVisibleIndex);scrollYStore.visibleEndIndex=Math.min(scrollYStore.endIndex,toYVisibleIndex+visibleYSize);$xeTable.updateScrollYData().then(()=>{loadScrollYData();});}else{$xeTable.updateScrollYSpace();}});};const calcScrollbar=()=>{const{scrollXWidth,scrollYHeight}=reactData;const{elemStore}=internalData;const scrollbarOpts=computeScrollbarOpts.value;const bodyWrapperElem=getRefElem(elemStore['main-body-wrapper']);const headerTableElem=getRefElem(elemStore['main-header-table']);const footerTableElem=getRefElem(elemStore['main-footer-table']);const xHandleEl=refScrollXHandleElem.value;const yHandleEl=refScrollYHandleElem.value;let overflowY=false;let overflowX=false;if(bodyWrapperElem){overflowY=scrollYHeight>bodyWrapperElem.clientHeight;if(yHandleEl){reactData.scrollbarWidth=scrollbarOpts.width||yHandleEl.offsetWidth-yHandleEl.clientWidth||14;}reactData.overflowY=overflowY;overflowX=scrollXWidth>bodyWrapperElem.clientWidth;if(xHandleEl){reactData.scrollbarHeight=scrollbarOpts.height||xHandleEl.offsetHeight-xHandleEl.clientHeight||14;}const hHeight=headerTableElem?headerTableElem.clientHeight:0;const fHeight=footerTableElem?footerTableElem.clientHeight:0;internalData.tableHeight=bodyWrapperElem.offsetHeight;internalData.tHeaderHeight=hHeight;internalData.tFooterHeight=fHeight;reactData.overflowX=overflowX;reactData.parentHeight=Math.max(hHeight+fHeight+20,$xeTable.getParentHeight());}if(overflowX){$xeTable.checkScrolling();}};const handleRecalculateStyle=(reFull,reWidth,reHeight)=>{const el=refElem.value;internalData.rceRunTime=Date.now();if(!el||!el.clientWidth){return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();}const varEl=refVarElem.value;if(varEl){const[defEl,mediumEl,smallEl,miniEl]=varEl.children;calcVarRowHeightConfig('default',defEl);calcVarRowHeightConfig('medium',mediumEl);calcVarRowHeightConfig('small',smallEl);calcVarRowHeightConfig('mini',miniEl);}if(reWidth){calcCellWidth();}if(reFull){autoCellWidth();}calcScrollbar();updateStyle();updateRowExpandStyle();if(reFull){updateTreeLineStyle();}return computeScrollLoad().then(()=>{// 初始化时需要在列计算之后再执行优化运算,达到最优显示效果
|
|
19801
|
+
reactData.rowHeight=rowHeight;const{toVisibleIndex:toYVisibleIndex,visibleSize:visibleYSize}=handleVirtualYVisible();if(scrollYLoad){const offsetYSize=Math.max(0,virtualYOpts.oSize?external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(virtualYOpts.oSize):0);scrollYStore.preloadSize=external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(virtualYOpts.preSize);scrollYStore.offsetSize=offsetYSize;scrollYStore.visibleSize=visibleYSize;scrollYStore.endIndex=Math.max(scrollYStore.startIndex+visibleYSize+offsetYSize,scrollYStore.endIndex);scrollYStore.visibleStartIndex=Math.max(scrollYStore.startIndex,toYVisibleIndex);scrollYStore.visibleEndIndex=Math.min(scrollYStore.endIndex,toYVisibleIndex+visibleYSize);$xeTable.updateScrollYData().then(()=>{loadScrollYData();});}else{$xeTable.updateScrollYSpace();}});};const calcScrollbar=()=>{const{scrollXWidth,scrollYHeight}=reactData;const{elemStore}=internalData;const scrollbarOpts=computeScrollbarOpts.value;const el=refElem.value;if(!el||!el.clientWidth){return;}const bodyWrapperElem=getRefElem(elemStore['main-body-wrapper']);const headerTableElem=getRefElem(elemStore['main-header-table']);const footerTableElem=getRefElem(elemStore['main-footer-table']);const xHandleEl=refScrollXHandleElem.value;const yHandleEl=refScrollYHandleElem.value;let overflowY=false;let overflowX=false;if(bodyWrapperElem){overflowY=scrollYHeight>bodyWrapperElem.clientHeight;if(yHandleEl){reactData.scrollbarWidth=scrollbarOpts.width||yHandleEl.offsetWidth-yHandleEl.clientWidth||14;}reactData.overflowY=overflowY;overflowX=scrollXWidth>bodyWrapperElem.clientWidth;if(xHandleEl){reactData.scrollbarHeight=scrollbarOpts.height||xHandleEl.offsetHeight-xHandleEl.clientHeight||14;}const hHeight=headerTableElem?headerTableElem.clientHeight:0;const fHeight=footerTableElem?footerTableElem.clientHeight:0;internalData.tableHeight=bodyWrapperElem.offsetHeight;internalData.tHeaderHeight=hHeight;internalData.tFooterHeight=fHeight;reactData.overflowX=overflowX;reactData.parentHeight=Math.max(hHeight+fHeight+20,$xeTable.getParentHeight());}if(overflowX){$xeTable.checkScrolling();}};const handleRecalculateStyle=(reFull,reWidth,reHeight)=>{const el=refElem.value;internalData.rceRunTime=Date.now();if(!el||!el.clientWidth){return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();}const varEl=refVarElem.value;if(varEl){const[defEl,mediumEl,smallEl,miniEl]=varEl.children;calcVarRowHeightConfig('default',defEl);calcVarRowHeightConfig('medium',mediumEl);calcVarRowHeightConfig('small',smallEl);calcVarRowHeightConfig('mini',miniEl);}if(reWidth){calcCellWidth();}if(reFull){autoCellWidth();}calcScrollbar();updateStyle();updateRowExpandStyle();if(reFull){updateTreeLineStyle();}return computeScrollLoad().then(()=>{// 初始化时需要在列计算之后再执行优化运算,达到最优显示效果
|
|
19800
19802
|
if(reWidth){calcCellWidth();}if(reFull){autoCellWidth();}if(reHeight){calcCellHeight();}updateStyle();calcScrollbar();if(reFull){updateRowOffsetTop();}updateRowExpandStyle();if(reFull){updateTreeLineStyle();}if(reFull){return computeScrollLoad();}});};const handleLazyRecalculate=(reFull,reWidth,reHeight)=>{return new Promise(resolve=>{const $xeGanttView=internalData.xeGanttView;const{customStore}=reactData;const{rceTimeout,rceRunTime}=internalData;const resizeOpts=computeResizeOpts.value;const refreshDelay=resizeOpts.refreshDelay||20;const el=refElem.value;if(el&&el.clientWidth){autoCellWidth();updateRowExpandStyle();}if(customStore.visible&&$xeTable.handleCustomStyle){$xeTable.handleCustomStyle();}if(rceTimeout){clearTimeout(rceTimeout);if(rceRunTime&&rceRunTime+(refreshDelay-5)<Date.now()){resolve(handleRecalculateStyle(reFull,reWidth,reHeight));}else{(0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)(()=>{resolve();});}}else{resolve(handleRecalculateStyle(reFull,reWidth,reHeight));}if($xeGanttView&&$xeGanttView.handleLazyRecalculate){$xeGanttView.handleLazyRecalculate();}internalData.rceTimeout=setTimeout(()=>{internalData.rceTimeout=undefined;handleRecalculateStyle(reFull,reWidth,reHeight);},refreshDelay);});};const handleResizeEvent=()=>{handleLazyRecalculate(true,true,true);};const handleUpdateAggValues=()=>{const{visibleColumn}=internalData;const aggCols=[];visibleColumn.forEach(column=>{if(column.aggFunc){aggCols.push(column);}});reactData.aggHandleAggColumns=aggCols;};const handleUpdateRowGroup=groupFields=>{const aggGroupFields=[];const aggGroupConfs=[];if(groupFields){(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(groupFields)?groupFields:[groupFields]).forEach(field=>{aggGroupFields.push(field);aggGroupConfs.push({field});});}reactData.rowGroupList=aggGroupConfs;reactData.aggHandleFields=aggGroupFields;handleUpdateAggValues();};const handleeGroupSummary=aggList=>{const{fullColumnFieldData}=internalData;const aggregateOpts=computeAggregateOpts.value;const aggFuncColumns=computeAggFuncColumns.value;const{mapChildrenField}=aggregateOpts;const aggCalcMethod=aggregateOpts.calcValuesMethod||aggregateOpts.countMethod||aggregateOpts.aggregateMethod;if(mapChildrenField){external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().lastEach(aggList,aggRow=>{let count=0;external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(aggRow[mapChildrenField],row=>{if(row.isAggregate){count+=row.childCount||0;}else{count++;}});aggRow.childCount=count;});if($xeTable.handlePivotTableAggregateData){$xeTable.handlePivotTableAggregateData(aggList);}else{if(aggFuncColumns.length){external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().lastEach(aggList,aggRow=>{const aggDtObj={};const aggData=aggRow.aggData;const groupField=aggRow.groupField;const groupContent=aggRow.groupContent;const childList=mapChildrenField?aggRow[mapChildrenField]||[]:[];const childCount=aggRow.childCount;const colRest=fullColumnFieldData[groupField]||{};aggFuncColumns.forEach(column=>{const{field}=column;const currAggData=aggData?aggData[field]:null;const ctParams={$table:$xeTable,groupField,groupColumn:colRest?colRest.column:null,column,groupValue:groupContent,childList,childCount,aggValue:currAggData?currAggData.value:0,/**
|
|
19801
19803
|
* 已废弃
|
|
19802
19804
|
* @deprecated
|
|
@@ -19893,12 +19895,12 @@ const matchObj=external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe
|
|
|
19893
19895
|
*/const handleDefaultRowGroupExpand=()=>{const{isRowGroupStatus}=reactData;if(isRowGroupStatus){const aggregateOpts=computeAggregateOpts.value;const{expandAll,expandGroupFields}=aggregateOpts;if(expandAll){$xeTable.setAllRowGroupExpand(true);}else if(expandGroupFields&&expandGroupFields.length){$xeTable.setRowGroupExpandByField(expandGroupFields,true);}}};const handleCheckAllEvent=(evnt,value)=>{handleCheckedAllCheckboxRow(value);if(evnt){dispatchEvent('checkbox-all',{records:()=>$xeTable.getCheckboxRecords(),reserves:()=>$xeTable.getCheckboxReserveRecords(),indeterminates:()=>$xeTable.getCheckboxIndeterminateRecords(),checked:value},evnt);}};/**
|
|
19894
19896
|
* 纵向 Y 可视渲染处理
|
|
19895
19897
|
*/const loadScrollYData=()=>{const{isAllOverflow,isScrollYBig}=reactData;const{mergeBodyList,mergeBodyColMaps,scrollYStore}=internalData;const{preloadSize,startIndex,endIndex,offsetSize}=scrollYStore;const autoOffsetYSize=isAllOverflow?offsetSize:offsetSize+1;const{toVisibleIndex,visibleSize}=handleVirtualYVisible();const offsetItem={startIndex:Math.max(0,isScrollYBig?toVisibleIndex-1:toVisibleIndex-1-offsetSize-preloadSize),endIndex:isScrollYBig?toVisibleIndex+visibleSize:toVisibleIndex+visibleSize+autoOffsetYSize+preloadSize};scrollYStore.visibleStartIndex=toVisibleIndex-1;scrollYStore.visibleEndIndex=toVisibleIndex+visibleSize+1;calculateMergerOffsetIndex(mergeBodyList,mergeBodyColMaps,offsetItem,'row');const{startIndex:offsetStartIndex,endIndex:offsetEndIndex}=offsetItem;if(toVisibleIndex<=startIndex||toVisibleIndex>=endIndex-visibleSize-1){if(startIndex!==offsetStartIndex||endIndex!==offsetEndIndex){scrollYStore.startIndex=offsetStartIndex;scrollYStore.endIndex=offsetEndIndex;$xeTable.updateScrollYData();}}};const createGetRowCacheProp=prop=>{return function(row){const{fullAllDataRowIdData}=internalData;if(row){const rowid=getRowid($xeTable,row);const rowRest=fullAllDataRowIdData[rowid];if(rowRest){return rowRest[prop];}}return-1;};};const createGetColumnCacheProp=prop=>{return function(column){const{fullColumnIdData}=internalData;if(column){const colRest=fullColumnIdData[column.id];if(colRest){return colRest[prop];}}return-1;};};const lazyScrollXData=()=>{const{lxTimeout,lxRunTime,scrollXStore}=internalData;const{visibleSize}=scrollXStore;const fpsTime=visibleSize>26?26:visibleSize>16?14:6;if(lxTimeout){clearTimeout(lxTimeout);}if(!lxRunTime||lxRunTime+fpsTime<Date.now()){internalData.lxRunTime=Date.now();loadScrollXData();}internalData.lxTimeout=setTimeout(()=>{internalData.lxTimeout=undefined;internalData.lxRunTime=undefined;loadScrollXData();},fpsTime);};const lazyScrollYData=()=>{const{lyTimeout,lyRunTime,scrollYStore}=internalData;const{visibleSize}=scrollYStore;const fpsTime=visibleSize>30?32:visibleSize>20?18:8;if(lyTimeout){clearTimeout(lyTimeout);}if(!lyRunTime||lyRunTime+fpsTime<Date.now()){internalData.lyRunTime=Date.now();loadScrollYData();}internalData.lyTimeout=setTimeout(()=>{internalData.lyTimeout=undefined;internalData.lyRunTime=undefined;loadScrollYData();},fpsTime);};const handleSyncScroll=(isRollX,isRollY)=>{const{scrollXLoad,scrollYLoad,isAllOverflow}=reactData;internalData.lcsRunTime=Date.now();internalData.lcsTimeout=undefined;internalData.intoRunScroll=false;internalData.inVirtualScroll=false;internalData.inWheelScroll=false;internalData.inHeaderScroll=false;internalData.inBodyScroll=false;internalData.inFooterScroll=false;reactData.lazScrollLoading=false;internalData.scrollRenderType='';let xRest=null;let yRest=null;if(!isAllOverflow){calcCellHeight();updateRowOffsetTop();}if(isRollX&&scrollXLoad){xRest=$xeTable.updateScrollXData();}if(isRollY&&scrollYLoad){yRest=$xeTable.updateScrollYData().then(()=>{if(!isAllOverflow){calcCellHeight();updateRowOffsetTop();}return $xeTable.updateScrollYSpace();});}updateRowExpandStyle();return Promise.all([xRest,yRest,scrollXLoad||scrollYLoad?$xeTable.updateCellAreas():null]);};const checkLastSyncScroll=(isRollX,isRollY)=>{const{lcsTimeout}=internalData;reactData.lazScrollLoading=true;if(lcsTimeout){clearTimeout(lcsTimeout);}internalData.lcsTimeout=setTimeout(()=>{handleSyncScroll(isRollX,isRollY).then(()=>{if(reactData.scrollXLoad||reactData.scrollYLoad){(0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)(()=>{updateRowExpandStyle();if(!internalData.lcsTimeout){handleSyncScroll(isRollX,isRollY);}});}});},200);};const getWheelSpeed=lastScrollTime=>{let multiple=1;const currTime=Date.now();if(lastScrollTime+25>currTime){multiple=1.18;}else if(lastScrollTime+30>currTime){multiple=1.15;}else if(lastScrollTime+40>currTime){multiple=1.12;}else if(lastScrollTime+55>currTime){multiple=1.09;}else if(lastScrollTime+75>currTime){multiple=1.06;}else if(lastScrollTime+100>currTime){multiple=1.03;}return multiple;};const syncGanttScrollTop=scrollTop=>{const $xeGanttView=internalData.xeGanttView;if($xeGanttView){const ganttInternalData=$xeGanttView.internalData;const{elemStore:ganttElemStore}=ganttInternalData;const ganttBodyScrollElem=getRefElem(ganttElemStore['main-body-scroll']);if(ganttBodyScrollElem){ganttBodyScrollElem.scrollTop=scrollTop;}}};const dispatchEvent=(type,params,evnt)=>{emit(type,createEvent(evnt,{$table:$xeTable,$grid:$xeGrid,$gantt:$xeGantt},params));};const handleScrollToRowColumn=(fieldOrColumn,row,options)=>{const{fullColumnIdData}=internalData;const column=handleFieldOrColumn($xeTable,fieldOrColumn);if(column&&fullColumnIdData[column.id]){return colToVisible($xeTable,options?options.colAlign!==false:true,column,row);}return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();};const handleUpdateResize=()=>{const el=refElem.value;if(el&&el.clientWidth&&el.clientHeight){$xeTable.recalculate();}};const handleUpdateColResize=(evnt,params)=>{$xeTable.analyColumnWidth();$xeTable.recalculate().then(()=>{$xeTable.saveCustomStore('update:width');$xeTable.refreshScroll().then(()=>{$xeTable.updateCellAreas();});$xeTable.dispatchEvent('column-resizable-change',params,evnt);// 已废弃 resizable-change
|
|
19896
|
-
$xeTable.dispatchEvent('resizable-change',params,evnt);setTimeout(()=>{$xeTable.recalculate(true);},300);});};const handleUpdateRowResize=(evnt,params)=>{reactData.resizeHeightFlag++;$xeTable.recalculate().then(()=>{$xeTable.refreshScroll().then(()=>{$xeTable.updateCellAreas();});$xeTable.dispatchEvent('row-resizable-change',params,evnt);setTimeout(()=>{$xeTable.recalculate(true);},300);});};const updateColumnOffsetLeft=()=>{const{visibleColumn,fullColumnIdData}=internalData;let offsetLeft=0;for(let cIndex=0,rLen=visibleColumn.length;cIndex<rLen;cIndex++){const column=visibleColumn[cIndex];const colid=column.id;const colRest=fullColumnIdData[colid];if(colRest){colRest.oLeft=offsetLeft;}offsetLeft+=column.renderWidth;}};const updateRowOffsetTop=()=>{const{expandColumn}=reactData;const{afterFullData,fullAllDataRowIdData,rowExpandedMaps}=internalData;const expandOpts=computeExpandOpts.value;const rowOpts=computeRowOpts.value;const cellOpts=computeCellOpts.value;const defaultRowHeight=computeDefaultRowHeight.value;const{handleGetRowId}=createHandleGetRowId($xeTable);let offsetTop=0;for(let rIndex=0,rLen=afterFullData.length;rIndex<rLen;rIndex++){const row=afterFullData[rIndex];const rowid=handleGetRowId(row);const rowRest=fullAllDataRowIdData[rowid]||{};rowRest.oTop=offsetTop;offsetTop+=rowRest.resizeHeight||cellOpts.height||rowOpts.height||rowRest.height||defaultRowHeight;// 是否展开行
|
|
19898
|
+
$xeTable.dispatchEvent('resizable-change',params,evnt);setTimeout(()=>{$xeTable.recalculate(true);},300);});};const handleUpdateRowResize=(evnt,params)=>{reactData.resizeHeightFlag++;$xeTable.recalculate().then(()=>{$xeTable.refreshScroll().then(()=>{$xeTable.updateCellAreas();});$xeTable.dispatchEvent('row-resizable-change',params,evnt);setTimeout(()=>{$xeTable.recalculate(true);},300);});};const updateColumnOffsetLeft=()=>{const{visibleColumn,fullColumnIdData}=internalData;const el=refElem.value;if(!el||!el.clientWidth){return;}let offsetLeft=0;for(let cIndex=0,rLen=visibleColumn.length;cIndex<rLen;cIndex++){const column=visibleColumn[cIndex];const colid=column.id;const colRest=fullColumnIdData[colid];if(colRest){colRest.oLeft=offsetLeft;}offsetLeft+=column.renderWidth;}};const updateRowOffsetTop=()=>{const{expandColumn}=reactData;const{afterFullData,fullAllDataRowIdData,rowExpandedMaps}=internalData;const el=refElem.value;if(!el||!el.clientWidth){return;}const expandOpts=computeExpandOpts.value;const rowOpts=computeRowOpts.value;const cellOpts=computeCellOpts.value;const defaultRowHeight=computeDefaultRowHeight.value;const{handleGetRowId}=createHandleGetRowId($xeTable);let offsetTop=0;for(let rIndex=0,rLen=afterFullData.length;rIndex<rLen;rIndex++){const row=afterFullData[rIndex];const rowid=handleGetRowId(row);const rowRest=fullAllDataRowIdData[rowid]||{};rowRest.oTop=offsetTop;offsetTop+=rowRest.resizeHeight||cellOpts.height||rowOpts.height||rowRest.height||defaultRowHeight;// 是否展开行
|
|
19897
19899
|
if(expandColumn&&rowExpandedMaps[rowid]){offsetTop+=rowRest.expandHeight||expandOpts.height||0;}}};/**
|
|
19898
19900
|
* 更新展开行样式
|
|
19899
|
-
*/const updateRowExpandStyle=()=>{const{expandColumn,scrollYLoad,scrollYTop,isScrollYBig}=reactData;const expandOpts=computeExpandOpts.value;const rowOpts=computeRowOpts.value;const cellOpts=computeCellOpts.value;const defaultRowHeight=computeDefaultRowHeight.value;const{mode}=expandOpts;if(expandColumn&&mode==='fixed'){const{elemStore,fullAllDataRowIdData}=internalData;const rowExpandEl=refRowExpandElem.value;const bodyScrollElem=getRefElem(elemStore['main-body-scroll']);if(rowExpandEl&&bodyScrollElem){let isUpdateHeight=false;external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayEach(rowExpandEl.children,reEl=>{const expandEl=reEl;const rowid=expandEl.getAttribute('rowid')||'';const rowRest=fullAllDataRowIdData[rowid];if(rowRest){const expandHeight=expandEl.offsetHeight;const trEl=bodyScrollElem.querySelector(`.vxe-body--row[rowid="${rowid}"]`);let offsetTop=0;if(scrollYLoad){if(isScrollYBig&&trEl){offsetTop=trEl.offsetTop+trEl.offsetHeight;}else{offsetTop=rowRest.oTop+(rowRest.resizeHeight||cellOpts.height||rowOpts.height||rowRest.height||defaultRowHeight);}}else{if(trEl){offsetTop=trEl.offsetTop+trEl.offsetHeight;}}if(isScrollYBig){offsetTop+=scrollYTop;}expandEl.style.top=toCssUnit(offsetTop);if(!isUpdateHeight){if(rowRest.expandHeight!==expandHeight){isUpdateHeight=true;}}rowRest.expandHeight=expandHeight;}});if(isUpdateHeight){reactData.rowExpandHeightFlag++;(0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)(()=>{updateRowOffsetTop();});}}}};/**
|
|
19901
|
+
*/const updateRowExpandStyle=()=>{const{expandColumn,scrollYLoad,scrollYTop,isScrollYBig}=reactData;const el=refElem.value;if(!el||!el.clientWidth){return;}const expandOpts=computeExpandOpts.value;const rowOpts=computeRowOpts.value;const cellOpts=computeCellOpts.value;const defaultRowHeight=computeDefaultRowHeight.value;const{mode}=expandOpts;if(expandColumn&&mode==='fixed'){const{elemStore,fullAllDataRowIdData}=internalData;const rowExpandEl=refRowExpandElem.value;const bodyScrollElem=getRefElem(elemStore['main-body-scroll']);if(rowExpandEl&&bodyScrollElem){let isUpdateHeight=false;external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayEach(rowExpandEl.children,reEl=>{const expandEl=reEl;const rowid=expandEl.getAttribute('rowid')||'';const rowRest=fullAllDataRowIdData[rowid];if(rowRest){const expandHeight=expandEl.offsetHeight;const trEl=bodyScrollElem.querySelector(`.vxe-body--row[rowid="${rowid}"]`);let offsetTop=0;if(scrollYLoad){if(isScrollYBig&&trEl){offsetTop=trEl.offsetTop+trEl.offsetHeight;}else{offsetTop=rowRest.oTop+(rowRest.resizeHeight||cellOpts.height||rowOpts.height||rowRest.height||defaultRowHeight);}}else{if(trEl){offsetTop=trEl.offsetTop+trEl.offsetHeight;}}if(isScrollYBig){offsetTop+=scrollYTop;}expandEl.style.top=toCssUnit(offsetTop);if(!isUpdateHeight){if(rowRest.expandHeight!==expandHeight){isUpdateHeight=true;}}rowRest.expandHeight=expandHeight;}});if(isUpdateHeight){reactData.rowExpandHeightFlag++;(0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)(()=>{updateRowOffsetTop();});}}}};/**
|
|
19900
19902
|
* 更新树连接线样式
|
|
19901
|
-
*/const updateTreeLineStyle=()=>{const{treeConfig}=props;if(!treeConfig){return;}const{tableData}=reactData;const{fullAllDataRowIdData,treeExpandedMaps}=internalData;const cellOpts=computeCellOpts.value;const rowOpts=computeRowOpts.value;const defaultRowHeight=computeDefaultRowHeight.value;const treeOpts=computeTreeOpts.value;const{transform,mapChildrenField}=treeOpts;const childrenField=treeOpts.children||treeOpts.childrenField;const{handleGetRowId}=createHandleGetRowId($xeTable);const expParentList=[];const handleNodeRow=(row,rIndex,rows)=>{const rowid=handleGetRowId(row);const rowRest=fullAllDataRowIdData[rowid]||{};const childList=row[transform?mapChildrenField:childrenField];const prevRow=rows[rIndex-1]||null;const nextRow=rows[rIndex+1]||null;if(childList&&childList.length&&treeExpandedMaps[rowid]){expParentList.push({row,prevRow,nextRow});childList.forEach((childRow,crIndex)=>{const childRowid=handleGetRowId(childRow);if(treeExpandedMaps[childRowid]){handleNodeRow(childRow,crIndex,childList);}});}else{if(nextRow){const nextRowid=handleGetRowId(nextRow);const nextRowRest=fullAllDataRowIdData[nextRowid]||{};const currCellHeight=getCellRestHeight(rowRest,cellOpts,rowOpts,defaultRowHeight);const nextCellHeight=getCellRestHeight(nextRowRest,cellOpts,rowOpts,defaultRowHeight);rowRest.oHeight=currCellHeight;rowRest.lineHeight=Math.floor(currCellHeight/2+nextCellHeight/2);}else{rowRest.oHeight=0;rowRest.lineHeight=0;}}};tableData.forEach((row,rIndex)=>{handleNodeRow(row,rIndex,tableData);});external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().lastArrayEach(expParentList,({row,nextRow})=>{const rowid=handleGetRowId(row);const childList=row[transform?mapChildrenField:childrenField];const rowRest=fullAllDataRowIdData[rowid];if(rowRest){const currCellHeight=getCellRestHeight(rowRest,cellOpts,rowOpts,defaultRowHeight);let countOffsetHeight=currCellHeight;let countLineHeight=0;childList.forEach(childRow=>{const childRowid=handleGetRowId(childRow);const childRowRest=fullAllDataRowIdData[childRowid]||{};const childList=childRow[transform?mapChildrenField:childrenField];if(treeExpandedMaps[childRowid]&&childList&&childList.length){countOffsetHeight+=childRowRest.oHeight||0;countLineHeight+=childRowRest.oHeight||0;}else{const cellHeight=getCellRestHeight(childRowRest,cellOpts,rowOpts,defaultRowHeight);childRowRest.oHeight=cellHeight;childRowRest.lineHeight=cellHeight;countOffsetHeight+=cellHeight;countLineHeight+=cellHeight;}});if(nextRow){const nextRowid=handleGetRowId(nextRow);const nextRowRest=fullAllDataRowIdData[nextRowid]||{};const currCellHeight=getCellRestHeight(rowRest,cellOpts,rowOpts,defaultRowHeight);const nextCellHeight=getCellRestHeight(nextRowRest,cellOpts,rowOpts,defaultRowHeight);countOffsetHeight+=currCellHeight;countLineHeight+=Math.floor(currCellHeight/2+nextCellHeight/2);}rowRest.lineHeight=countLineHeight;rowRest.oHeight=countOffsetHeight;}});};const handleRowExpandScroll=()=>{const{elemStore}=internalData;const rowExpandEl=refRowExpandElem.value;const bodyScrollElem=getRefElem(elemStore['main-body-scroll']);if(rowExpandEl&&bodyScrollElem){rowExpandEl.scrollTop=bodyScrollElem.scrollTop;}};const handleColumnVisible=visible=>{return function(fieldOrColumn){let status=false;const cols=external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(fieldOrColumn)?fieldOrColumn:[fieldOrColumn];cols.forEach(item=>{const column=handleFieldOrColumn($xeTable,item);if(column){if(column.children&&column.children.length){external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree([column],item=>{item.visible=visible;item.renderVisible=visible;});}else{column.visible=visible;column.renderVisible=visible;}if(!status){status=true;}}});if(status){return $xeTable.handleCustom();}return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();};};tableMethods={dispatchEvent,getEl(){return refElem.value;},/**
|
|
19903
|
+
*/const updateTreeLineStyle=()=>{const{treeConfig}=props;if(!treeConfig){return;}const{tableData}=reactData;const{fullAllDataRowIdData,treeExpandedMaps}=internalData;const el=refElem.value;if(!el||!el.clientWidth){return;}const cellOpts=computeCellOpts.value;const rowOpts=computeRowOpts.value;const defaultRowHeight=computeDefaultRowHeight.value;const treeOpts=computeTreeOpts.value;const{transform,mapChildrenField}=treeOpts;const childrenField=treeOpts.children||treeOpts.childrenField;const{handleGetRowId}=createHandleGetRowId($xeTable);const expParentList=[];const handleNodeRow=(row,rIndex,rows)=>{const rowid=handleGetRowId(row);const rowRest=fullAllDataRowIdData[rowid]||{};const childList=row[transform?mapChildrenField:childrenField];const prevRow=rows[rIndex-1]||null;const nextRow=rows[rIndex+1]||null;if(childList&&childList.length&&treeExpandedMaps[rowid]){expParentList.push({row,prevRow,nextRow});childList.forEach((childRow,crIndex)=>{const childRowid=handleGetRowId(childRow);if(treeExpandedMaps[childRowid]){handleNodeRow(childRow,crIndex,childList);}});}else{if(nextRow){const nextRowid=handleGetRowId(nextRow);const nextRowRest=fullAllDataRowIdData[nextRowid]||{};const currCellHeight=getCellRestHeight(rowRest,cellOpts,rowOpts,defaultRowHeight);const nextCellHeight=getCellRestHeight(nextRowRest,cellOpts,rowOpts,defaultRowHeight);rowRest.oHeight=currCellHeight;rowRest.lineHeight=Math.floor(currCellHeight/2+nextCellHeight/2);}else{rowRest.oHeight=0;rowRest.lineHeight=0;}}};tableData.forEach((row,rIndex)=>{handleNodeRow(row,rIndex,tableData);});external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().lastArrayEach(expParentList,({row,nextRow})=>{const rowid=handleGetRowId(row);const childList=row[transform?mapChildrenField:childrenField];const rowRest=fullAllDataRowIdData[rowid];if(rowRest){const currCellHeight=getCellRestHeight(rowRest,cellOpts,rowOpts,defaultRowHeight);let countOffsetHeight=currCellHeight;let countLineHeight=0;childList.forEach(childRow=>{const childRowid=handleGetRowId(childRow);const childRowRest=fullAllDataRowIdData[childRowid]||{};const childList=childRow[transform?mapChildrenField:childrenField];if(treeExpandedMaps[childRowid]&&childList&&childList.length){countOffsetHeight+=childRowRest.oHeight||0;countLineHeight+=childRowRest.oHeight||0;}else{const cellHeight=getCellRestHeight(childRowRest,cellOpts,rowOpts,defaultRowHeight);childRowRest.oHeight=cellHeight;childRowRest.lineHeight=cellHeight;countOffsetHeight+=cellHeight;countLineHeight+=cellHeight;}});if(nextRow){const nextRowid=handleGetRowId(nextRow);const nextRowRest=fullAllDataRowIdData[nextRowid]||{};const currCellHeight=getCellRestHeight(rowRest,cellOpts,rowOpts,defaultRowHeight);const nextCellHeight=getCellRestHeight(nextRowRest,cellOpts,rowOpts,defaultRowHeight);countOffsetHeight+=currCellHeight;countLineHeight+=Math.floor(currCellHeight/2+nextCellHeight/2);}rowRest.lineHeight=countLineHeight;rowRest.oHeight=countOffsetHeight;}});};const handleRowExpandScroll=()=>{const{elemStore}=internalData;const rowExpandEl=refRowExpandElem.value;const bodyScrollElem=getRefElem(elemStore['main-body-scroll']);if(rowExpandEl&&bodyScrollElem){rowExpandEl.scrollTop=bodyScrollElem.scrollTop;}};const handleColumnVisible=visible=>{return function(fieldOrColumn){let status=false;const cols=external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(fieldOrColumn)?fieldOrColumn:[fieldOrColumn];cols.forEach(item=>{const column=handleFieldOrColumn($xeTable,item);if(column){if(column.children&&column.children.length){external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree([column],item=>{item.visible=visible;item.renderVisible=visible;});}else{column.visible=visible;column.renderVisible=visible;}if(!status){status=true;}}});if(status){return $xeTable.handleCustom();}return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();};};tableMethods={dispatchEvent,getEl(){return refElem.value;},/**
|
|
19902
19904
|
* 重置表格的一切数据状态
|
|
19903
19905
|
*/clearAll(){return clearTableAllStatus($xeTable);},/**
|
|
19904
19906
|
* 同步 data 数据(即将废弃)
|
|
@@ -20398,7 +20400,7 @@ if(isEnableConf(editConfig)&&editOpts.trigger==='dblclick'){if(actived.row&&acti
|
|
|
20398
20400
|
* 多选,选中所有事件
|
|
20399
20401
|
*/triggerCheckAllEvent(evnt,value){const checkboxOpts=computeCheckboxOpts.value;const{trigger}=checkboxOpts;if(trigger==='manual'){return;}if(evnt){evnt.stopPropagation();}handleCheckAllEvent(evnt,value);},/**
|
|
20400
20402
|
* 单选,行选中事件
|
|
20401
|
-
*/triggerRadioRowEvent(evnt,params){const{selectRadioRow:oldValue}=reactData;const{row}=params;const radioOpts=computeRadioOpts.value;const{trigger,strict,checkMethod}=radioOpts;if(trigger==='manual'){return;}evnt.stopPropagation();if(!checkMethod||checkMethod({$table:$xeTable,row})){let newValue=row;let isChange=oldValue!==newValue;if(strict){handleCheckedRadioRow(newValue);}else{if(oldValue===newValue){newValue=null;}isChange=oldValue!==newValue;if(isChange&&newValue){handleCheckedRadioRow(newValue);}else{newValue=null;$xeTable.clearRadioRow();}}if(isChange){dispatchEvent('radio-change',{oldValue,newValue,selected:!!newValue,...params},evnt);}}},triggerCurrentColumnEvent(evnt,params){const{currentColumn:oldValue}=reactData;const columnOpts=computeColumnOpts.value;const currentColumnOpts=computeCurrentColumnOpts.value;const beforeRowMethod=currentColumnOpts.beforeSelectMethod||columnOpts.currentMethod;let newValue=params.column;const{trigger,strict}=currentColumnOpts;if(trigger==='manual'){return;}let isChange=oldValue!==newValue;if(!beforeRowMethod||beforeRowMethod({column:newValue,$table:$xeTable})){if(strict){$xeTable.setCurrentColumn(newValue);}else{if(oldValue===newValue){newValue=null;}isChange=oldValue!==newValue;if(isChange&&newValue){$xeTable.setCurrentColumn(newValue);}else{newValue=null;$xeTable.clearCurrentColumn();}}if(isChange){dispatchEvent('current-column-change',{oldValue,newValue,selected:!!newValue,...params},evnt);}}else{dispatchEvent('current-column-disabled',params,evnt);}},triggerCurrentRowEvent(evnt,params){const{currentRow:oldValue}=internalData;const rowOpts=computeRowOpts.value;const currentRowOpts=computeCurrentRowOpts.value;const beforeRowMethod=currentRowOpts.beforeSelectMethod||rowOpts.currentMethod;let{row:newValue}=params;const{trigger,strict}=currentRowOpts;if(trigger==='manual'){return;}let isChange=oldValue!==newValue;if(!beforeRowMethod||beforeRowMethod({row:newValue,$table:$xeTable})){if(strict){$xeTable.setCurrentRow(newValue);}else{if(oldValue===newValue){newValue=null;}isChange=oldValue!==newValue;if(isChange&&newValue){$xeTable.setCurrentRow(newValue);}else{newValue=null;$xeTable.clearCurrentRow();}}if(isChange){dispatchEvent('current-row-change',{oldValue,newValue,selected:!!newValue,...params},evnt);// 已废弃
|
|
20403
|
+
*/triggerRadioRowEvent(evnt,params){const{selectRadioRow:oldValue}=reactData;const{row}=params;const radioOpts=computeRadioOpts.value;const{trigger,strict,checkMethod}=radioOpts;if(trigger==='manual'){return;}evnt.stopPropagation();if(!checkMethod||checkMethod({$table:$xeTable,row})){let newValue=row;let isChange=oldValue!==newValue;if(strict){handleCheckedRadioRow(newValue,false);}else{if(oldValue===newValue){newValue=null;}isChange=oldValue!==newValue;if(isChange&&newValue){handleCheckedRadioRow(newValue,false);}else{newValue=null;$xeTable.clearRadioRow();}}if(isChange){dispatchEvent('radio-change',{oldValue,newValue,selected:!!newValue,...params},evnt);}}},triggerCurrentColumnEvent(evnt,params){const{currentColumn:oldValue}=reactData;const columnOpts=computeColumnOpts.value;const currentColumnOpts=computeCurrentColumnOpts.value;const beforeRowMethod=currentColumnOpts.beforeSelectMethod||columnOpts.currentMethod;let newValue=params.column;const{trigger,strict}=currentColumnOpts;if(trigger==='manual'){return;}let isChange=oldValue!==newValue;if(!beforeRowMethod||beforeRowMethod({column:newValue,$table:$xeTable})){if(strict){$xeTable.setCurrentColumn(newValue);}else{if(oldValue===newValue){newValue=null;}isChange=oldValue!==newValue;if(isChange&&newValue){$xeTable.setCurrentColumn(newValue);}else{newValue=null;$xeTable.clearCurrentColumn();}}if(isChange){dispatchEvent('current-column-change',{oldValue,newValue,selected:!!newValue,...params},evnt);}}else{dispatchEvent('current-column-disabled',params,evnt);}},triggerCurrentRowEvent(evnt,params){const{currentRow:oldValue}=internalData;const rowOpts=computeRowOpts.value;const currentRowOpts=computeCurrentRowOpts.value;const beforeRowMethod=currentRowOpts.beforeSelectMethod||rowOpts.currentMethod;let{row:newValue}=params;const{trigger,strict}=currentRowOpts;if(trigger==='manual'){return;}let isChange=oldValue!==newValue;if(!beforeRowMethod||beforeRowMethod({row:newValue,$table:$xeTable})){if(strict){$xeTable.setCurrentRow(newValue);}else{if(oldValue===newValue){newValue=null;}isChange=oldValue!==newValue;if(isChange&&newValue){$xeTable.setCurrentRow(newValue);}else{newValue=null;$xeTable.clearCurrentRow();}}if(isChange){dispatchEvent('current-row-change',{oldValue,newValue,selected:!!newValue,...params},evnt);// 已废弃
|
|
20402
20404
|
dispatchEvent('current-change',{oldValue,newValue,...params},evnt);}}else{dispatchEvent('current-row-disabled',params,evnt);}},/**
|
|
20403
20405
|
* 展开行事件
|
|
20404
20406
|
*/triggerRowExpandEvent(evnt,params){const{expandColumn}=reactData;const{rowExpandLazyLoadedMaps}=internalData;const expandOpts=computeExpandOpts.value;const{row}=params;const{lazy,trigger}=expandOpts;if(trigger==='manual'){return;}evnt.stopPropagation();const rowid=getRowid($xeTable,row);if(!lazy||!rowExpandLazyLoadedMaps[rowid]){const expanded=!$xeTable.isRowExpandByRow(row);const columnIndex=expandColumn?$xeTable.getColumnIndex(expandColumn):-1;const $columnIndex=expandColumn?$xeTable.getVMColumnIndex(expandColumn):-1;$xeTable.setRowExpand(row,expanded);dispatchEvent('toggle-row-expand',{expanded,column:expandColumn,columnIndex,$columnIndex,row,rowIndex:$xeTable.getRowIndex(row),$rowIndex:$xeTable.getVMRowIndex(row)},evnt);}},/**
|