vxe-table 3.19.21 → 3.19.22
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/cell.js +7 -5
- package/es/table/src/methods.js +140 -58
- package/es/table/src/table.js +12 -2
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/lib/index.umd.js +41 -18
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/table/src/cell.js +7 -4
- package/lib/table/src/cell.min.js +1 -1
- package/lib/table/src/methods.js +125 -41
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/table.js +15 -2
- 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/cell.ts +7 -5
- package/packages/table/src/methods.ts +141 -58
- package/packages/table/src/table.ts +13 -2
- /package/es/{iconfont.1764298141619.ttf → iconfont.1764380622607.ttf} +0 -0
- /package/es/{iconfont.1764298141619.woff → iconfont.1764380622607.woff} +0 -0
- /package/es/{iconfont.1764298141619.woff2 → iconfont.1764380622607.woff2} +0 -0
- /package/lib/{iconfont.1764298141619.ttf → iconfont.1764380622607.ttf} +0 -0
- /package/lib/{iconfont.1764298141619.woff → iconfont.1764380622607.woff} +0 -0
- /package/lib/{iconfont.1764298141619.woff2 → iconfont.1764380622607.woff2} +0 -0
package/es/table/src/cell.js
CHANGED
|
@@ -364,8 +364,9 @@ export const Cell = {
|
|
|
364
364
|
const aggRow = row;
|
|
365
365
|
const { fullColumnFieldData } = tableInternalData;
|
|
366
366
|
const aggregateOpts = $table.computeAggregateOpts;
|
|
367
|
-
const { mode, showTotal, totalMethod, countFields, contentMethod, mapChildrenField } = aggregateOpts;
|
|
368
|
-
const
|
|
367
|
+
const { mode, showTotal, totalMethod, countFields, contentMethod, formatValuesMethod, mapChildrenField } = aggregateOpts;
|
|
368
|
+
const aggData = aggRow.aggData;
|
|
369
|
+
const currAggData = aggData ? aggData[field] : null;
|
|
369
370
|
const groupField = aggRow.groupField;
|
|
370
371
|
const groupContent = aggRow.groupContent;
|
|
371
372
|
const childList = mapChildrenField ? (aggRow[mapChildrenField] || []) : [];
|
|
@@ -407,9 +408,10 @@ export const Cell = {
|
|
|
407
408
|
cellValue = $table.getPivotTableAggregateCellAggValue(params);
|
|
408
409
|
}
|
|
409
410
|
else if (aggFunc === true || (countFields && countFields.includes(field))) {
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
411
|
+
cellValue = currAggData ? currAggData.value : childCount;
|
|
412
|
+
ctParams.aggValue = cellValue;
|
|
413
|
+
if (formatValuesMethod) {
|
|
414
|
+
cellValue = formatValuesMethod(ctParams);
|
|
413
415
|
}
|
|
414
416
|
}
|
|
415
417
|
}
|
package/es/table/src/methods.js
CHANGED
|
@@ -2462,26 +2462,53 @@ const calcCellHeight = ($xeTable) => {
|
|
|
2462
2462
|
}
|
|
2463
2463
|
};
|
|
2464
2464
|
function getOrderField($xeTable, column) {
|
|
2465
|
-
const
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2465
|
+
const reactData = $xeTable;
|
|
2466
|
+
const { isRowGroupStatus } = reactData;
|
|
2467
|
+
const { sortBy, sortType, aggFunc } = column;
|
|
2468
|
+
return isRowGroupStatus && aggFunc
|
|
2469
|
+
? (row) => {
|
|
2470
|
+
if (row.isAggregate) {
|
|
2471
|
+
const aggData = row.aggData;
|
|
2472
|
+
const currAggData = aggData ? aggData[column.field] : null;
|
|
2473
|
+
return currAggData ? currAggData.value : null;
|
|
2474
|
+
}
|
|
2475
|
+
let cellValue;
|
|
2476
|
+
if (sortBy) {
|
|
2477
|
+
cellValue = XEUtils.isFunction(sortBy) ? sortBy({ row, column }) : XEUtils.get(row, sortBy);
|
|
2478
|
+
}
|
|
2479
|
+
else {
|
|
2480
|
+
cellValue = $xeTable.getCellLabel(row, column);
|
|
2481
|
+
}
|
|
2482
|
+
if (!sortType || sortType === 'auto') {
|
|
2483
|
+
return isNaN(cellValue) ? cellValue : XEUtils.toNumber(cellValue);
|
|
2484
|
+
}
|
|
2485
|
+
else if (sortType === 'number') {
|
|
2486
|
+
return XEUtils.toNumber(cellValue);
|
|
2487
|
+
}
|
|
2488
|
+
else if (sortType === 'string') {
|
|
2489
|
+
return XEUtils.toValueString(cellValue);
|
|
2490
|
+
}
|
|
2491
|
+
return cellValue;
|
|
2482
2492
|
}
|
|
2483
|
-
|
|
2484
|
-
|
|
2493
|
+
: (row) => {
|
|
2494
|
+
let cellValue;
|
|
2495
|
+
if (sortBy) {
|
|
2496
|
+
cellValue = XEUtils.isFunction(sortBy) ? sortBy({ row, column }) : XEUtils.get(row, sortBy);
|
|
2497
|
+
}
|
|
2498
|
+
else {
|
|
2499
|
+
cellValue = $xeTable.getCellLabel(row, column);
|
|
2500
|
+
}
|
|
2501
|
+
if (!sortType || sortType === 'auto') {
|
|
2502
|
+
return isNaN(cellValue) ? cellValue : XEUtils.toNumber(cellValue);
|
|
2503
|
+
}
|
|
2504
|
+
else if (sortType === 'number') {
|
|
2505
|
+
return XEUtils.toNumber(cellValue);
|
|
2506
|
+
}
|
|
2507
|
+
else if (sortType === 'string') {
|
|
2508
|
+
return XEUtils.toValueString(cellValue);
|
|
2509
|
+
}
|
|
2510
|
+
return cellValue;
|
|
2511
|
+
};
|
|
2485
2512
|
}
|
|
2486
2513
|
function handleTargetEnterEvent($xeTable, isClear) {
|
|
2487
2514
|
const internalData = $xeTable;
|
|
@@ -3019,8 +3046,12 @@ function handleUpdateRowGroup($xeTable, groupFields) {
|
|
|
3019
3046
|
handleUpdateAggValues($xeTable);
|
|
3020
3047
|
}
|
|
3021
3048
|
function handleeGroupSummary($xeTable, aggList) {
|
|
3049
|
+
const internalData = $xeTable;
|
|
3050
|
+
const { fullColumnFieldData } = internalData;
|
|
3022
3051
|
const aggregateOpts = $xeTable.computeAggregateOpts;
|
|
3052
|
+
const aggFuncColumns = $xeTable.computeAggFuncColumns;
|
|
3023
3053
|
const { mapChildrenField } = aggregateOpts;
|
|
3054
|
+
const aggCalcMethod = aggregateOpts.calcValuesMethod || aggregateOpts.countMethod || aggregateOpts.aggregateMethod;
|
|
3024
3055
|
if (mapChildrenField) {
|
|
3025
3056
|
XEUtils.lastEach(aggList, aggRow => {
|
|
3026
3057
|
let count = 0;
|
|
@@ -3037,6 +3068,62 @@ function handleeGroupSummary($xeTable, aggList) {
|
|
|
3037
3068
|
if ($xeTable.handlePivotTableAggregateData) {
|
|
3038
3069
|
$xeTable.handlePivotTableAggregateData(aggList);
|
|
3039
3070
|
}
|
|
3071
|
+
else {
|
|
3072
|
+
XEUtils.lastEach(aggList, aggRow => {
|
|
3073
|
+
const aggDtObj = {};
|
|
3074
|
+
const aggData = aggRow.aggData;
|
|
3075
|
+
const groupField = aggRow.groupField;
|
|
3076
|
+
const groupContent = aggRow.groupContent;
|
|
3077
|
+
const childList = mapChildrenField ? (aggRow[mapChildrenField] || []) : [];
|
|
3078
|
+
const childCount = aggRow.childCount;
|
|
3079
|
+
const colRest = fullColumnFieldData[groupField] || {};
|
|
3080
|
+
aggFuncColumns.forEach(column => {
|
|
3081
|
+
const { field } = column;
|
|
3082
|
+
const currAggData = aggData ? aggData[field] : null;
|
|
3083
|
+
const ctParams = {
|
|
3084
|
+
$table: $xeTable,
|
|
3085
|
+
groupField,
|
|
3086
|
+
groupColumn: (colRest ? colRest.column : null),
|
|
3087
|
+
column,
|
|
3088
|
+
groupValue: groupContent,
|
|
3089
|
+
childList,
|
|
3090
|
+
childCount,
|
|
3091
|
+
aggValue: currAggData ? currAggData.value : 0,
|
|
3092
|
+
/**
|
|
3093
|
+
* 已废弃
|
|
3094
|
+
* @deprecated
|
|
3095
|
+
*/
|
|
3096
|
+
children: childList,
|
|
3097
|
+
/**
|
|
3098
|
+
* 已废弃
|
|
3099
|
+
* @deprecated
|
|
3100
|
+
*/
|
|
3101
|
+
totalValue: childCount
|
|
3102
|
+
};
|
|
3103
|
+
let aggVal = 0;
|
|
3104
|
+
// 如果下层同时也是分组
|
|
3105
|
+
if (childList.length && childList[0].isAggregate) {
|
|
3106
|
+
XEUtils.each(childList, (row) => {
|
|
3107
|
+
if (row.isAggregate) {
|
|
3108
|
+
const currAggData = row.aggData[field];
|
|
3109
|
+
if (currAggData) {
|
|
3110
|
+
aggVal += currAggData.value;
|
|
3111
|
+
}
|
|
3112
|
+
}
|
|
3113
|
+
});
|
|
3114
|
+
}
|
|
3115
|
+
else {
|
|
3116
|
+
aggVal = aggCalcMethod ? aggCalcMethod(ctParams) : aggRow.childCount;
|
|
3117
|
+
}
|
|
3118
|
+
aggDtObj[field] = {
|
|
3119
|
+
type: 'count',
|
|
3120
|
+
value: aggVal,
|
|
3121
|
+
label: aggVal
|
|
3122
|
+
};
|
|
3123
|
+
});
|
|
3124
|
+
aggRow.aggData = aggDtObj;
|
|
3125
|
+
});
|
|
3126
|
+
}
|
|
3040
3127
|
}
|
|
3041
3128
|
}
|
|
3042
3129
|
function updateGroupData($xeTable) {
|
|
@@ -4098,7 +4185,36 @@ function handleRowExpandScroll($xeTable) {
|
|
|
4098
4185
|
rowExpandEl.scrollTop = bodyScrollElem.scrollTop;
|
|
4099
4186
|
}
|
|
4100
4187
|
}
|
|
4101
|
-
|
|
4188
|
+
function handleColumnVisible(visible) {
|
|
4189
|
+
const $xeTable = this;
|
|
4190
|
+
return function (fieldOrColumn) {
|
|
4191
|
+
let status = false;
|
|
4192
|
+
const cols = XEUtils.isArray(fieldOrColumn) ? fieldOrColumn : [fieldOrColumn];
|
|
4193
|
+
cols.forEach(item => {
|
|
4194
|
+
const column = handleFieldOrColumn($xeTable, item);
|
|
4195
|
+
if (column) {
|
|
4196
|
+
if (column.children && column.children.length) {
|
|
4197
|
+
XEUtils.eachTree([column], (item) => {
|
|
4198
|
+
item.visible = visible;
|
|
4199
|
+
item.renderVisible = visible;
|
|
4200
|
+
});
|
|
4201
|
+
}
|
|
4202
|
+
else {
|
|
4203
|
+
column.visible = visible;
|
|
4204
|
+
column.renderVisible = visible;
|
|
4205
|
+
}
|
|
4206
|
+
if (!status) {
|
|
4207
|
+
status = true;
|
|
4208
|
+
}
|
|
4209
|
+
}
|
|
4210
|
+
});
|
|
4211
|
+
if (status) {
|
|
4212
|
+
return $xeTable.handleCustom();
|
|
4213
|
+
}
|
|
4214
|
+
return $xeTable.$nextTick();
|
|
4215
|
+
};
|
|
4216
|
+
}
|
|
4217
|
+
const tableMethods = {
|
|
4102
4218
|
callSlot(slotFunc, params, h, vNodes) {
|
|
4103
4219
|
const $xeTable = this;
|
|
4104
4220
|
// const slots = $xeTable.$scopedSlots
|
|
@@ -5538,45 +5654,11 @@ const Methods = {
|
|
|
5538
5654
|
/**
|
|
5539
5655
|
* 隐藏指定列
|
|
5540
5656
|
*/
|
|
5541
|
-
hideColumn(
|
|
5542
|
-
const $xeTable = this;
|
|
5543
|
-
let status = false;
|
|
5544
|
-
const cols = XEUtils.isArray(fieldOrColumn) ? fieldOrColumn : [fieldOrColumn];
|
|
5545
|
-
cols.forEach(item => {
|
|
5546
|
-
const column = handleFieldOrColumn($xeTable, item);
|
|
5547
|
-
if (column && column.visible) {
|
|
5548
|
-
column.visible = false;
|
|
5549
|
-
if (!status) {
|
|
5550
|
-
status = true;
|
|
5551
|
-
}
|
|
5552
|
-
}
|
|
5553
|
-
});
|
|
5554
|
-
if (status) {
|
|
5555
|
-
return $xeTable.handleCustom();
|
|
5556
|
-
}
|
|
5557
|
-
return $xeTable.$nextTick();
|
|
5558
|
-
},
|
|
5657
|
+
hideColumn: handleColumnVisible(false),
|
|
5559
5658
|
/**
|
|
5560
5659
|
* 显示指定列
|
|
5561
5660
|
*/
|
|
5562
|
-
showColumn(
|
|
5563
|
-
const $xeTable = this;
|
|
5564
|
-
let status = false;
|
|
5565
|
-
const cols = XEUtils.isArray(fieldOrColumn) ? fieldOrColumn : [fieldOrColumn];
|
|
5566
|
-
cols.forEach(item => {
|
|
5567
|
-
const column = handleFieldOrColumn($xeTable, item);
|
|
5568
|
-
if (column && !column.visible) {
|
|
5569
|
-
column.visible = true;
|
|
5570
|
-
if (!status) {
|
|
5571
|
-
status = true;
|
|
5572
|
-
}
|
|
5573
|
-
}
|
|
5574
|
-
});
|
|
5575
|
-
if (status) {
|
|
5576
|
-
return $xeTable.handleCustom();
|
|
5577
|
-
}
|
|
5578
|
-
return $xeTable.$nextTick();
|
|
5579
|
-
},
|
|
5661
|
+
showColumn: handleColumnVisible(true),
|
|
5580
5662
|
setColumnWidth(fieldOrColumn, width) {
|
|
5581
5663
|
const $xeTable = this;
|
|
5582
5664
|
const internalData = $xeTable;
|
|
@@ -12055,7 +12137,7 @@ const Methods = {
|
|
|
12055
12137
|
// Module methods
|
|
12056
12138
|
const funcs = 'setFilter,openFilter,clearFilter,saveFilter,saveFilterByEvent,resetFilter,resetFilterByEvent,saveFilterPanel,saveFilterPanelByEvent,resetFilterPanel,resetFilterPanelByEvent,getCheckedFilters,updateFilterOptionStatus,closeMenu,setActiveCellArea,getActiveCellArea,getCellAreas,clearCellAreas,copyCellArea,cutCellArea,pasteCellArea,getCopyCellArea,getCopyCellAreas,clearCopyCellArea,setCellAreas,openFNR,openFind,openReplace,closeFNR,getSelectedCell,clearSelected,insert,insertAt,insertNextAt,insertChild,insertChildAt,insertChildNextAt,remove,removeCheckboxRow,removeRadioRow,removeCurrentRow,getRecordset,getInsertRecords,getRemoveRecords,getUpdateRecords,clearEdit,clearActived,getEditRecord,getEditCell,getActiveRecord,isEditByRow,isActiveByRow,setEditRow,setActiveRow,setEditCell,setActiveCell,setSelectCell,clearValidate,fullValidate,validate,fullValidateField,validateField,openExport,closeExport,openPrint,closePrint,getPrintHtml,exportData,openImport,closeImport,importData,saveFile,readFile,importByFile,print,getCustomVisible,openCustom,closeCustom,toggleCustom,saveCustom,cancelCustom,resetCustom,toggleCustomAllCheckbox,setCustomAllCheckbox'.split(',');
|
|
12057
12139
|
funcs.forEach(name => {
|
|
12058
|
-
|
|
12140
|
+
tableMethods[name] = function (...args) {
|
|
12059
12141
|
// if (!this[`_${name}`]) {
|
|
12060
12142
|
// if ('openExport,openPrint,exportData,openImport,importData,saveFile,readFile,importByFile,print'.split(',').includes(name)) {
|
|
12061
12143
|
// errLog('vxe.error.reqModule', ['Export'])
|
|
@@ -12072,4 +12154,4 @@ funcs.forEach(name => {
|
|
|
12072
12154
|
return this[`_${name}`] ? this[`_${name}`](...args) : null;
|
|
12073
12155
|
};
|
|
12074
12156
|
});
|
|
12075
|
-
export default
|
|
12157
|
+
export default tableMethods;
|
package/es/table/src/table.js
CHANGED
|
@@ -1444,6 +1444,15 @@ export default {
|
|
|
1444
1444
|
});
|
|
1445
1445
|
return rgColumns;
|
|
1446
1446
|
},
|
|
1447
|
+
computeAggFuncColumns() {
|
|
1448
|
+
const $xeTable = this;
|
|
1449
|
+
const reactData = $xeTable;
|
|
1450
|
+
const { rowGroupList, tableColumn } = reactData;
|
|
1451
|
+
if (rowGroupList.length) {
|
|
1452
|
+
return tableColumn.filter(column => column.field && column.aggFunc);
|
|
1453
|
+
}
|
|
1454
|
+
return [];
|
|
1455
|
+
},
|
|
1447
1456
|
tabsResizeFlag() {
|
|
1448
1457
|
const $xeTable = this;
|
|
1449
1458
|
const $xeTabs = $xeTable.$xeTabs;
|
|
@@ -1994,8 +2003,9 @@ export default {
|
|
|
1994
2003
|
if (this.$resize) {
|
|
1995
2004
|
this.$resize.disconnect();
|
|
1996
2005
|
}
|
|
1997
|
-
|
|
1998
|
-
|
|
2006
|
+
$xeTable.closeTooltip();
|
|
2007
|
+
$xeTable.closeFilter();
|
|
2008
|
+
$xeTable.closeMenu();
|
|
1999
2009
|
globalEvents.off($xeTable, 'paste');
|
|
2000
2010
|
globalEvents.off($xeTable, 'copy');
|
|
2001
2011
|
globalEvents.off($xeTable, 'cut');
|
package/es/ui/index.js
CHANGED
package/es/ui/src/log.js
CHANGED
package/lib/index.umd.js
CHANGED
|
@@ -2005,7 +2005,7 @@ function getClass(property, params) {
|
|
|
2005
2005
|
;// CONCATENATED MODULE: ./packages/ui/index.ts
|
|
2006
2006
|
|
|
2007
2007
|
|
|
2008
|
-
const version = "3.19.
|
|
2008
|
+
const version = "3.19.22";
|
|
2009
2009
|
core_.VxeUI.version = version;
|
|
2010
2010
|
core_.VxeUI.tableVersion = version;
|
|
2011
2011
|
core_.VxeUI.setConfig({
|
|
@@ -2715,7 +2715,7 @@ function isNodeElement(elem) {
|
|
|
2715
2715
|
const {
|
|
2716
2716
|
log: log_log
|
|
2717
2717
|
} = core_.VxeUI;
|
|
2718
|
-
const log_version = `table v${"3.19.
|
|
2718
|
+
const log_version = `table v${"3.19.22"}`;
|
|
2719
2719
|
const warnLog = log_log.create('warn', log_version);
|
|
2720
2720
|
const errLog = log_log.create('error', log_version);
|
|
2721
2721
|
;// CONCATENATED MODULE: ./packages/table/src/columnInfo.ts
|
|
@@ -4197,9 +4197,11 @@ const Cell = {
|
|
|
4197
4197
|
totalMethod,
|
|
4198
4198
|
countFields,
|
|
4199
4199
|
contentMethod,
|
|
4200
|
+
formatValuesMethod,
|
|
4200
4201
|
mapChildrenField
|
|
4201
4202
|
} = aggregateOpts;
|
|
4202
|
-
const
|
|
4203
|
+
const aggData = aggRow.aggData;
|
|
4204
|
+
const currAggData = aggData ? aggData[field] : null;
|
|
4203
4205
|
const groupField = aggRow.groupField;
|
|
4204
4206
|
const groupContent = aggRow.groupContent;
|
|
4205
4207
|
const childList = mapChildrenField ? aggRow[mapChildrenField] || [] : [];
|
|
@@ -4244,9 +4246,10 @@ const Cell = {
|
|
|
4244
4246
|
} else if ($table.getPivotTableAggregateCellAggValue) {
|
|
4245
4247
|
cellValue = $table.getPivotTableAggregateCellAggValue(params);
|
|
4246
4248
|
} else if (aggFunc === true || countFields && countFields.includes(field)) {
|
|
4247
|
-
|
|
4248
|
-
|
|
4249
|
-
|
|
4249
|
+
cellValue = currAggData ? currAggData.value : childCount;
|
|
4250
|
+
ctParams.aggValue = cellValue;
|
|
4251
|
+
if (formatValuesMethod) {
|
|
4252
|
+
cellValue = formatValuesMethod(ctParams);
|
|
4250
4253
|
}
|
|
4251
4254
|
}
|
|
4252
4255
|
} else {
|
|
@@ -6026,7 +6029,7 @@ remainList.forEach(column=>{const width=Math.max(meanWidth,minCellWidth);column.
|
|
|
6026
6029
|
* 计算自适应行高
|
|
6027
6030
|
*/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;};/**
|
|
6028
6031
|
* 自适应行高
|
|
6029
|
-
*/const calcCellHeight=$xeTable=>{const props=$xeTable;const reactData=$xeTable;const internalData=$xeTable;const{treeConfig}=props;const{tableData,isAllOverflow,scrollYLoad,scrollXLoad}=reactData;const{fullAllDataRowIdData}=internalData;const treeOpts=$xeTable.computeTreeOpts;const defaultRowHeight=$xeTable.computeDefaultRowHeight;const el=$xeTable.$refs.refElem;if(el&&!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 height=calcCellAutoHeight($xeTable,rowRest,el);rowRest.height=Math.max(defaultRowHeight,height);}el.removeAttribute('data-calc-row');});reactData.calcCellHeightFlag++;}};function getOrderField($xeTable,column){const{sortBy,sortType}=column;return 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;};}function handleTargetEnterEvent($xeTable,isClear){const internalData=$xeTable;const $tooltip=$xeTable.$refs.refTooltip;clearTimeout(internalData.tooltipTimeout);if(isClear){$xeTable.closeTooltip();}else{if($tooltip&&$tooltip.setActived){$tooltip.setActived(true);}}}function clearCrossTableDragStatus($xeTable){const crossTableDragRowInfo=getCrossTableDragRowInfo($xeTable);crossTableDragRowObj=null;crossTableDragRowInfo.row=null;}function clearDragStatus($xeTable){const reactData=$xeTable;const{dragRow,dragCol}=reactData;if(dragRow||dragCol){clearColDropOrigin($xeTable);clearRowDropOrigin($xeTable);hideDropTip($xeTable);clearCrossTableDragStatus($xeTable);reactData.dragRow=null;reactData.dragCol=null;}}function clearRowDropOrigin($xeTable){const el=$xeTable.$el;if(el){const clss='row--drag-origin';external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayEach(el.querySelectorAll(`.${clss}`),elem=>{elem.draggable=false;removeClass(elem,clss);});}}function updateRowDropOrigin($xeTable,row){const el=$xeTable.$el;if(el){const clss='row--drag-origin';const rowid=getRowid($xeTable,row);external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayEach(el.querySelectorAll(`[rowid="${rowid}"]`),elem=>{addClass(elem,clss);});}}function updateRowDropTipContent($xeTable,tdEl){const reactData=$xeTable;const props=$xeTable;const{dragConfig}=props;const{dragRow}=reactData;const rowDragOpts=$xeTable.computeRowDragOpts;const{tooltipMethod}=rowDragOpts;const rTooltipMethod=tooltipMethod||(dragConfig?dragConfig.rowTooltipMethod:null);let tipContent='';if(rTooltipMethod){const rtParams={$table:$xeTable,row:dragRow};tipContent=`${rTooltipMethod(rtParams)||''}`;}else{tipContent=methods_getI18n('vxe.table.dragTip',[tdEl.textContent||'']);}reactData.dragTipText=tipContent;}function updateColDropOrigin($xeTable,column){const el=$xeTable.$el;if(el){const colQuerys=[];external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree([column],item=>{colQuerys.push(`[colid="${item.id}"]`);});const clss='col--drag-origin';external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayEach(el.querySelectorAll(colQuerys.join(',')),elem=>{addClass(elem,clss);});}}function clearColDropOrigin($xeTable){const el=$xeTable.$el;if(el){const clss='col--drag-origin';external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayEach(el.querySelectorAll(`.${clss}`),elem=>{elem.draggable=false;removeClass(elem,clss);});}}function updateColDropTipContent($xeTable,tdEl){const reactData=$xeTable;const{dragCol}=reactData;const columnDragOpts=$xeTable.computeColumnDragOpts;const{tooltipMethod}=columnDragOpts;let tipContent='';if(tooltipMethod){const dtParams={$table:$xeTable,column:dragCol};tipContent=`${tooltipMethod(dtParams)||''}`;}else{tipContent=methods_getI18n('vxe.table.dragTip',[tdEl.textContent||'']);}reactData.dragTipText=tipContent;}function showDropTip($xeTable,evnt,trEl,thEl,showLine,dragPos){const $xeGantt=$xeTable.$xeGantt;const reactData=$xeTable;const internalData=$xeTable;let wrapperEl=$xeTable.$refs.refElem;if($xeGantt&&trEl){const ganttContainerElem=$xeGantt.$refs.refGanttContainerElem;if(ganttContainerElem){wrapperEl=ganttContainerElem;}}if(!wrapperEl){return;}const{overflowX,scrollbarWidth,overflowY,scrollbarHeight}=reactData;const{prevDragToChild}=internalData;const wrapperRect=wrapperEl.getBoundingClientRect();const osbWidth=overflowY?scrollbarWidth:0;const osbHeight=overflowX?scrollbarHeight:0;const tableWrapperWidth=wrapperEl.clientWidth;const tableWrapperHeight=wrapperEl.clientHeight;if(trEl){const rdLineEl=$xeTable.$refs.refDragRowLineElem;if(rdLineEl){if(showLine){const scrollbarYToLeft=$xeTable.computeScrollbarYToLeft;const trRect=trEl.getBoundingClientRect();let trHeight=trEl.clientHeight;const offsetTop=Math.max(1,trRect.y-wrapperRect.y);if(offsetTop+trHeight>tableWrapperHeight-osbHeight){trHeight=tableWrapperHeight-offsetTop-osbHeight;}rdLineEl.style.display='block';rdLineEl.style.left=`${scrollbarYToLeft?osbWidth:0}px`;rdLineEl.style.top=`${offsetTop}px`;rdLineEl.style.height=`${trHeight}px`;rdLineEl.style.width=`${tableWrapperWidth-osbWidth}px`;rdLineEl.setAttribute('drag-pos',dragPos);rdLineEl.setAttribute('drag-to-child',prevDragToChild?'y':'n');}else{rdLineEl.style.display='';}}}else if(thEl){const cdLineEl=$xeTable.$refs.refDragColLineElem;if(cdLineEl){if(showLine){const scrollbarXToTop=$xeTable.computeScrollbarXToTop;const leftContainerElem=$xeTable.$refs.refLeftContainer;const leftContainerWidth=leftContainerElem?leftContainerElem.clientWidth:0;const rightContainerElem=$xeTable.$refs.refRightContainer;const rightContainerWidth=rightContainerElem?rightContainerElem.clientWidth:0;const thRect=thEl.getBoundingClientRect();let thWidth=thEl.clientWidth;const offsetTop=Math.max(0,thRect.y-wrapperRect.y);const startX=leftContainerWidth;let offsetLeft=thRect.x-wrapperRect.x;if(offsetLeft<startX){thWidth-=startX-offsetLeft;offsetLeft=startX;}const endX=tableWrapperWidth-rightContainerWidth-(rightContainerWidth?0:osbWidth);if(offsetLeft+thWidth>endX){thWidth=endX-offsetLeft;}cdLineEl.style.display='block';cdLineEl.style.top=`${offsetTop}px`;cdLineEl.style.left=`${offsetLeft}px`;cdLineEl.style.width=`${thWidth}px`;if(prevDragToChild){cdLineEl.style.height=`${thRect.height}px`;}else{cdLineEl.style.height=`${tableWrapperHeight-offsetTop-(scrollbarXToTop?0:osbHeight)}px`;}cdLineEl.setAttribute('drag-pos',dragPos);cdLineEl.setAttribute('drag-to-child',prevDragToChild?'y':'n');}else{cdLineEl.style.display='';}}}const rdTipEl=$xeTable.$refs.refDragTipElem;if(rdTipEl){rdTipEl.style.display='block';rdTipEl.style.top=`${Math.min(wrapperEl.clientHeight-wrapperEl.scrollTop-rdTipEl.clientHeight,evnt.clientY-wrapperRect.y)}px`;rdTipEl.style.left=`${Math.min(wrapperEl.clientWidth-wrapperEl.scrollLeft-rdTipEl.clientWidth-16,evnt.clientX-wrapperRect.x)}px`;rdTipEl.setAttribute('drag-status',showLine?prevDragToChild?'sub':'normal':'disabled');}}function hideDropTip($xeTable){const rdTipEl=$xeTable.$refs.refDragTipElem;const rdLineEl=$xeTable.$refs.refDragRowLineElem;const cdLineEl=$xeTable.$refs.refDragColLineElem;if(rdTipEl){rdTipEl.style.display='';}if(rdLineEl){rdLineEl.style.display='';}if(cdLineEl){cdLineEl.style.display='';}}function clearRowDragData($xeTable){const $xeGantt=$xeTable.$xeGantt;const reactData=$xeTable;const internalData=$xeTable;let wrapperEl=$xeTable.$refs.refElem;const dtClss=['.vxe-body--row'];if($xeGantt){const ganttContainerElem=$xeGantt.$refs.refGanttContainerElem;if(ganttContainerElem){wrapperEl=ganttContainerElem;}dtClss.push('.vxe-gantt-view--body-row','.vxe-gantt-view--chart-row');}hideDropTip($xeTable);clearRowDropOrigin($xeTable);clearRowAnimate(wrapperEl,dtClss);internalData.prevDragToChild=false;reactData.dragRow=null;reactData.dragCol=null;}function clearColDragData($xeTable){const reactData=$xeTable;const internalData=$xeTable;const el=$xeTable.$refs.refElem;hideDropTip($xeTable);clearColDropOrigin($xeTable);clearColAnimate(el,['.vxe-table--column']);internalData.prevDragToChild=false;reactData.dragRow=null;reactData.dragCol=null;}/**
|
|
6032
|
+
*/const calcCellHeight=$xeTable=>{const props=$xeTable;const reactData=$xeTable;const internalData=$xeTable;const{treeConfig}=props;const{tableData,isAllOverflow,scrollYLoad,scrollXLoad}=reactData;const{fullAllDataRowIdData}=internalData;const treeOpts=$xeTable.computeTreeOpts;const defaultRowHeight=$xeTable.computeDefaultRowHeight;const el=$xeTable.$refs.refElem;if(el&&!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 height=calcCellAutoHeight($xeTable,rowRest,el);rowRest.height=Math.max(defaultRowHeight,height);}el.removeAttribute('data-calc-row');});reactData.calcCellHeightFlag++;}};function getOrderField($xeTable,column){const reactData=$xeTable;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;};}function handleTargetEnterEvent($xeTable,isClear){const internalData=$xeTable;const $tooltip=$xeTable.$refs.refTooltip;clearTimeout(internalData.tooltipTimeout);if(isClear){$xeTable.closeTooltip();}else{if($tooltip&&$tooltip.setActived){$tooltip.setActived(true);}}}function clearCrossTableDragStatus($xeTable){const crossTableDragRowInfo=getCrossTableDragRowInfo($xeTable);crossTableDragRowObj=null;crossTableDragRowInfo.row=null;}function clearDragStatus($xeTable){const reactData=$xeTable;const{dragRow,dragCol}=reactData;if(dragRow||dragCol){clearColDropOrigin($xeTable);clearRowDropOrigin($xeTable);hideDropTip($xeTable);clearCrossTableDragStatus($xeTable);reactData.dragRow=null;reactData.dragCol=null;}}function clearRowDropOrigin($xeTable){const el=$xeTable.$el;if(el){const clss='row--drag-origin';external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayEach(el.querySelectorAll(`.${clss}`),elem=>{elem.draggable=false;removeClass(elem,clss);});}}function updateRowDropOrigin($xeTable,row){const el=$xeTable.$el;if(el){const clss='row--drag-origin';const rowid=getRowid($xeTable,row);external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayEach(el.querySelectorAll(`[rowid="${rowid}"]`),elem=>{addClass(elem,clss);});}}function updateRowDropTipContent($xeTable,tdEl){const reactData=$xeTable;const props=$xeTable;const{dragConfig}=props;const{dragRow}=reactData;const rowDragOpts=$xeTable.computeRowDragOpts;const{tooltipMethod}=rowDragOpts;const rTooltipMethod=tooltipMethod||(dragConfig?dragConfig.rowTooltipMethod:null);let tipContent='';if(rTooltipMethod){const rtParams={$table:$xeTable,row:dragRow};tipContent=`${rTooltipMethod(rtParams)||''}`;}else{tipContent=methods_getI18n('vxe.table.dragTip',[tdEl.textContent||'']);}reactData.dragTipText=tipContent;}function updateColDropOrigin($xeTable,column){const el=$xeTable.$el;if(el){const colQuerys=[];external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree([column],item=>{colQuerys.push(`[colid="${item.id}"]`);});const clss='col--drag-origin';external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayEach(el.querySelectorAll(colQuerys.join(',')),elem=>{addClass(elem,clss);});}}function clearColDropOrigin($xeTable){const el=$xeTable.$el;if(el){const clss='col--drag-origin';external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayEach(el.querySelectorAll(`.${clss}`),elem=>{elem.draggable=false;removeClass(elem,clss);});}}function updateColDropTipContent($xeTable,tdEl){const reactData=$xeTable;const{dragCol}=reactData;const columnDragOpts=$xeTable.computeColumnDragOpts;const{tooltipMethod}=columnDragOpts;let tipContent='';if(tooltipMethod){const dtParams={$table:$xeTable,column:dragCol};tipContent=`${tooltipMethod(dtParams)||''}`;}else{tipContent=methods_getI18n('vxe.table.dragTip',[tdEl.textContent||'']);}reactData.dragTipText=tipContent;}function showDropTip($xeTable,evnt,trEl,thEl,showLine,dragPos){const $xeGantt=$xeTable.$xeGantt;const reactData=$xeTable;const internalData=$xeTable;let wrapperEl=$xeTable.$refs.refElem;if($xeGantt&&trEl){const ganttContainerElem=$xeGantt.$refs.refGanttContainerElem;if(ganttContainerElem){wrapperEl=ganttContainerElem;}}if(!wrapperEl){return;}const{overflowX,scrollbarWidth,overflowY,scrollbarHeight}=reactData;const{prevDragToChild}=internalData;const wrapperRect=wrapperEl.getBoundingClientRect();const osbWidth=overflowY?scrollbarWidth:0;const osbHeight=overflowX?scrollbarHeight:0;const tableWrapperWidth=wrapperEl.clientWidth;const tableWrapperHeight=wrapperEl.clientHeight;if(trEl){const rdLineEl=$xeTable.$refs.refDragRowLineElem;if(rdLineEl){if(showLine){const scrollbarYToLeft=$xeTable.computeScrollbarYToLeft;const trRect=trEl.getBoundingClientRect();let trHeight=trEl.clientHeight;const offsetTop=Math.max(1,trRect.y-wrapperRect.y);if(offsetTop+trHeight>tableWrapperHeight-osbHeight){trHeight=tableWrapperHeight-offsetTop-osbHeight;}rdLineEl.style.display='block';rdLineEl.style.left=`${scrollbarYToLeft?osbWidth:0}px`;rdLineEl.style.top=`${offsetTop}px`;rdLineEl.style.height=`${trHeight}px`;rdLineEl.style.width=`${tableWrapperWidth-osbWidth}px`;rdLineEl.setAttribute('drag-pos',dragPos);rdLineEl.setAttribute('drag-to-child',prevDragToChild?'y':'n');}else{rdLineEl.style.display='';}}}else if(thEl){const cdLineEl=$xeTable.$refs.refDragColLineElem;if(cdLineEl){if(showLine){const scrollbarXToTop=$xeTable.computeScrollbarXToTop;const leftContainerElem=$xeTable.$refs.refLeftContainer;const leftContainerWidth=leftContainerElem?leftContainerElem.clientWidth:0;const rightContainerElem=$xeTable.$refs.refRightContainer;const rightContainerWidth=rightContainerElem?rightContainerElem.clientWidth:0;const thRect=thEl.getBoundingClientRect();let thWidth=thEl.clientWidth;const offsetTop=Math.max(0,thRect.y-wrapperRect.y);const startX=leftContainerWidth;let offsetLeft=thRect.x-wrapperRect.x;if(offsetLeft<startX){thWidth-=startX-offsetLeft;offsetLeft=startX;}const endX=tableWrapperWidth-rightContainerWidth-(rightContainerWidth?0:osbWidth);if(offsetLeft+thWidth>endX){thWidth=endX-offsetLeft;}cdLineEl.style.display='block';cdLineEl.style.top=`${offsetTop}px`;cdLineEl.style.left=`${offsetLeft}px`;cdLineEl.style.width=`${thWidth}px`;if(prevDragToChild){cdLineEl.style.height=`${thRect.height}px`;}else{cdLineEl.style.height=`${tableWrapperHeight-offsetTop-(scrollbarXToTop?0:osbHeight)}px`;}cdLineEl.setAttribute('drag-pos',dragPos);cdLineEl.setAttribute('drag-to-child',prevDragToChild?'y':'n');}else{cdLineEl.style.display='';}}}const rdTipEl=$xeTable.$refs.refDragTipElem;if(rdTipEl){rdTipEl.style.display='block';rdTipEl.style.top=`${Math.min(wrapperEl.clientHeight-wrapperEl.scrollTop-rdTipEl.clientHeight,evnt.clientY-wrapperRect.y)}px`;rdTipEl.style.left=`${Math.min(wrapperEl.clientWidth-wrapperEl.scrollLeft-rdTipEl.clientWidth-16,evnt.clientX-wrapperRect.x)}px`;rdTipEl.setAttribute('drag-status',showLine?prevDragToChild?'sub':'normal':'disabled');}}function hideDropTip($xeTable){const rdTipEl=$xeTable.$refs.refDragTipElem;const rdLineEl=$xeTable.$refs.refDragRowLineElem;const cdLineEl=$xeTable.$refs.refDragColLineElem;if(rdTipEl){rdTipEl.style.display='';}if(rdLineEl){rdLineEl.style.display='';}if(cdLineEl){cdLineEl.style.display='';}}function clearRowDragData($xeTable){const $xeGantt=$xeTable.$xeGantt;const reactData=$xeTable;const internalData=$xeTable;let wrapperEl=$xeTable.$refs.refElem;const dtClss=['.vxe-body--row'];if($xeGantt){const ganttContainerElem=$xeGantt.$refs.refGanttContainerElem;if(ganttContainerElem){wrapperEl=ganttContainerElem;}dtClss.push('.vxe-gantt-view--body-row','.vxe-gantt-view--chart-row');}hideDropTip($xeTable);clearRowDropOrigin($xeTable);clearRowAnimate(wrapperEl,dtClss);internalData.prevDragToChild=false;reactData.dragRow=null;reactData.dragCol=null;}function clearColDragData($xeTable){const reactData=$xeTable;const internalData=$xeTable;const el=$xeTable.$refs.refElem;hideDropTip($xeTable);clearColDropOrigin($xeTable);clearColAnimate(el,['.vxe-table--column']);internalData.prevDragToChild=false;reactData.dragRow=null;reactData.dragCol=null;}/**
|
|
6030
6033
|
* 处理显示 tooltip
|
|
6031
6034
|
* @param {Event} evnt 事件
|
|
6032
6035
|
* @param {Row} row 行对象
|
|
@@ -6035,7 +6038,14 @@ function computeScrollLoad($xeTable){const reactData=$xeTable;const internalData
|
|
|
6035
6038
|
if(scrollXLoad){const{toVisibleIndex:toXVisibleIndex,visibleSize:visibleXSize}=handleVirtualXVisible($xeTable);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($xeTable);});}else{$xeTable.updateScrollXSpace();}// 计算 Y 逻辑
|
|
6036
6039
|
const rowHeight=computeRowHeight($xeTable);scrollYStore.rowHeight=rowHeight;// 已废弃
|
|
6037
6040
|
reactData.rowHeight=rowHeight;const{toVisibleIndex:toYVisibleIndex,visibleSize:visibleYSize}=handleVirtualYVisible($xeTable);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($xeTable);});}else{$xeTable.updateScrollYSpace();}});}function calcScrollbar($xeTable){const reactData=$xeTable;const internalData=$xeTable;const{scrollXWidth,scrollYHeight}=reactData;const{elemStore}=internalData;const scrollbarOpts=$xeTable.computeScrollbarOpts;const bodyWrapperElem=getRefElem(elemStore['main-body-wrapper']);const headerTableElem=getRefElem(elemStore['main-header-table']);const footerTableElem=getRefElem(elemStore['main-footer-table']);const xHandleEl=$xeTable.$refs.refScrollXHandleElem;const yHandleEl=$xeTable.$refs.refScrollYHandleElem;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;}reactData.overflowX=overflowX;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();}}function handleRecalculateStyle($xeTable,reFull,reWidth,reHeight){const internalData=$xeTable;const el=$xeTable.$refs.refElem;internalData.rceRunTime=Date.now();if(!el||!el.clientWidth){return $xeTable.$nextTick();}const varEl=$xeTable.$refs.refVarElem;if(varEl){const[defEl,mediumEl,smallEl,miniEl]=varEl.children;calcVarRowHeightConfig($xeTable,'default',defEl);calcVarRowHeightConfig($xeTable,'medium',mediumEl);calcVarRowHeightConfig($xeTable,'small',smallEl);calcVarRowHeightConfig($xeTable,'mini',miniEl);}if(reWidth){calcCellWidth($xeTable);}if(reFull){autoCellWidth($xeTable);}calcScrollbar($xeTable);updateStyle($xeTable);updateRowExpandStyle($xeTable);if(reFull){updateTreeLineStyle($xeTable);}return computeScrollLoad($xeTable).then(()=>{// 初始化时需要在列计算之后再执行优化运算,达到最优显示效果
|
|
6038
|
-
if(reWidth){calcCellWidth($xeTable);}if(reFull){autoCellWidth($xeTable);}if(reHeight){calcCellHeight($xeTable);}updateStyle($xeTable);calcScrollbar($xeTable);if(reFull){updateRowOffsetTop($xeTable);}updateRowExpandStyle($xeTable);if(reFull){updateTreeLineStyle($xeTable);}if(reFull){return computeScrollLoad($xeTable);}});}function handleLazyRecalculate($xeTable,reFull,reWidth,reHeight){const internalData=$xeTable;return new Promise(resolve=>{const{rceTimeout,rceRunTime}=internalData;const $xeGanttView=internalData.xeGanttView;const resizeOpts=$xeTable.computeResizeOpts;const refreshDelay=resizeOpts.refreshDelay||20;const el=$xeTable.$refs.refElem;if(el&&el.clientWidth){autoCellWidth($xeTable);updateRowExpandStyle($xeTable);}if(rceTimeout){clearTimeout(rceTimeout);if(rceRunTime&&rceRunTime+(refreshDelay-5)<Date.now()){resolve(handleRecalculateStyle($xeTable,reFull,reWidth,reHeight));}else{$xeTable.$nextTick(()=>{resolve();});}}else{resolve(handleRecalculateStyle($xeTable,reFull,reWidth,reHeight));}if($xeGanttView&&$xeGanttView.handleLazyRecalculate){$xeGanttView.handleLazyRecalculate();}internalData.rceTimeout=setTimeout(()=>{internalData.rceTimeout=undefined;handleRecalculateStyle($xeTable,reFull,reWidth,reHeight);},refreshDelay);});}function handleResizeEvent($xeTable){handleLazyRecalculate($xeTable,true,true,true);}function handleUpdateAggValues($xeTable){const reactData=$xeTable;const internalData=$xeTable;const{visibleColumn}=internalData;const aggCols=[];visibleColumn.forEach(column=>{if(column.aggFunc){aggCols.push(column);}});reactData.aggHandleAggColumns=aggCols;}function handleUpdateRowGroup($xeTable,groupFields){const reactData=$xeTable;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($xeTable);}function handleeGroupSummary($xeTable,aggList){const aggregateOpts=$xeTable.computeAggregateOpts;const{mapChildrenField}=aggregateOpts;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);}
|
|
6041
|
+
if(reWidth){calcCellWidth($xeTable);}if(reFull){autoCellWidth($xeTable);}if(reHeight){calcCellHeight($xeTable);}updateStyle($xeTable);calcScrollbar($xeTable);if(reFull){updateRowOffsetTop($xeTable);}updateRowExpandStyle($xeTable);if(reFull){updateTreeLineStyle($xeTable);}if(reFull){return computeScrollLoad($xeTable);}});}function handleLazyRecalculate($xeTable,reFull,reWidth,reHeight){const internalData=$xeTable;return new Promise(resolve=>{const{rceTimeout,rceRunTime}=internalData;const $xeGanttView=internalData.xeGanttView;const resizeOpts=$xeTable.computeResizeOpts;const refreshDelay=resizeOpts.refreshDelay||20;const el=$xeTable.$refs.refElem;if(el&&el.clientWidth){autoCellWidth($xeTable);updateRowExpandStyle($xeTable);}if(rceTimeout){clearTimeout(rceTimeout);if(rceRunTime&&rceRunTime+(refreshDelay-5)<Date.now()){resolve(handleRecalculateStyle($xeTable,reFull,reWidth,reHeight));}else{$xeTable.$nextTick(()=>{resolve();});}}else{resolve(handleRecalculateStyle($xeTable,reFull,reWidth,reHeight));}if($xeGanttView&&$xeGanttView.handleLazyRecalculate){$xeGanttView.handleLazyRecalculate();}internalData.rceTimeout=setTimeout(()=>{internalData.rceTimeout=undefined;handleRecalculateStyle($xeTable,reFull,reWidth,reHeight);},refreshDelay);});}function handleResizeEvent($xeTable){handleLazyRecalculate($xeTable,true,true,true);}function handleUpdateAggValues($xeTable){const reactData=$xeTable;const internalData=$xeTable;const{visibleColumn}=internalData;const aggCols=[];visibleColumn.forEach(column=>{if(column.aggFunc){aggCols.push(column);}});reactData.aggHandleAggColumns=aggCols;}function handleUpdateRowGroup($xeTable,groupFields){const reactData=$xeTable;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($xeTable);}function handleeGroupSummary($xeTable,aggList){const internalData=$xeTable;const{fullColumnFieldData}=internalData;const aggregateOpts=$xeTable.computeAggregateOpts;const aggFuncColumns=$xeTable.computeAggFuncColumns;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{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,/**
|
|
6042
|
+
* 已废弃
|
|
6043
|
+
* @deprecated
|
|
6044
|
+
*/children:childList,/**
|
|
6045
|
+
* 已废弃
|
|
6046
|
+
* @deprecated
|
|
6047
|
+
*/totalValue:childCount};let aggVal=0;// 如果下层同时也是分组
|
|
6048
|
+
if(childList.length&&childList[0].isAggregate){external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(childList,row=>{if(row.isAggregate){const currAggData=row.aggData[field];if(currAggData){aggVal+=currAggData.value;}}});}else{aggVal=aggCalcMethod?aggCalcMethod(ctParams):aggRow.childCount;}aggDtObj[field]={type:'count',value:aggVal,label:aggVal};});aggRow.aggData=aggDtObj;});}}}function updateGroupData($xeTable){const props=$xeTable;const reactData=$xeTable;const internalData=$xeTable;const{aggregateConfig,rowGroupConfig}=props;const{isRowGroupStatus}=reactData;const{tableFullGroupData}=internalData;const aggregateOpts=$xeTable.computeAggregateOpts;const{mapChildrenField}=aggregateOpts;if((aggregateConfig||rowGroupConfig)&&isRowGroupStatus){const aggList=[];external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(tableFullGroupData,row=>{if(row.isAggregate){aggList.push(row);}},{children:mapChildrenField});handleeGroupSummary($xeTable,aggList);}}function handleGroupData($xeTable,list,rowGroups){let fullData=list;let treeData=list;if(rowGroups){const aggregateOpts=$xeTable.computeAggregateOpts;const{rowField,parentField,childrenField,mapChildrenField}=aggregateOpts;const checkboxOpts=$xeTable.computeCheckboxOpts;const{checkField}=checkboxOpts;const indeterminateField=checkboxOpts.indeterminateField||checkboxOpts.halfField;const rgItem=rowGroups[0];if(rgItem&&rowField&&parentField&&childrenField&&mapChildrenField){fullData=[];treeData=[];const groupField=rgItem.field;const groupColumn=$xeTable.getColumnByField(groupField);const groupMaps={};const aggList=[];const rowkey=getRowkey($xeTable);list.forEach(row=>{const cellValue=groupColumn?$xeTable.getCellLabel(row,groupColumn):external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row,groupField);const groupValue=external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(cellValue)?'':cellValue;let childList=groupMaps[groupValue];if(!childList){childList=[];groupMaps[groupValue]=childList;}if(row.isAggregate){row.isAggregate=undefined;}childList.push(row);});external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().objectEach(groupMaps,(childList,groupValue)=>{const{fullData:childFullData,treeData:childTreeData}=handleGroupData($xeTable,childList,rowGroups.slice(1));const aggRow={isAggregate:true,aggData:{},groupContent:groupValue,groupField,childCount:0,[rowField]:getRowUniqueId(),[parentField]:null,[rowkey]:getRowUniqueId(),[childrenField]:childTreeData,[mapChildrenField]:childTreeData};if(checkField){aggRow[checkField]=false;}if(indeterminateField){aggRow[indeterminateField]=false;}aggList.push(aggRow);treeData.push(aggRow);fullData.push(aggRow);if(childFullData.length){fullData.push(...childFullData);}});handleeGroupSummary($xeTable,aggList);}}return{treeData,fullData};}/**
|
|
6039
6049
|
* 加载表格数据
|
|
6040
6050
|
* @param {Array} datas 数据
|
|
6041
6051
|
*/function loadTableData($xeTable,datas,isReset){const props=$xeTable;const reactData=$xeTable;const internalData=$xeTable;const{keepSource,treeConfig,aggregateConfig,rowGroupConfig}=props;const{rowGroupList,scrollYLoad:oldScrollYLoad}=reactData;const{scrollYStore,scrollXStore,lastScrollLeft,lastScrollTop}=internalData;const rowOpts=$xeTable.computeRowOpts;const treeOpts=$xeTable.computeTreeOpts;const expandOpts=$xeTable.computeExpandOpts;const{transform}=treeOpts;const childrenField=treeOpts.children||treeOpts.childrenField;let treeData=[];let fullData=datas?datas.slice(0):[];// 转为响应式数据
|
|
@@ -6107,7 +6117,7 @@ if(expandColumn&&rowExpandedMaps[rowid]){offsetTop+=rowRest.expandHeight||expand
|
|
|
6107
6117
|
* 更新展开行样式
|
|
6108
6118
|
*/function updateRowExpandStyle($xeTable){const reactData=$xeTable;const internalData=$xeTable;const{expandColumn,scrollYLoad,scrollYTop,isScrollYBig}=reactData;const expandOpts=$xeTable.computeExpandOpts;const rowOpts=$xeTable.computeRowOpts;const cellOpts=$xeTable.computeCellOpts;const defaultRowHeight=$xeTable.computeDefaultRowHeight;const{mode}=expandOpts;if(expandColumn&&mode==='fixed'){const{elemStore,fullAllDataRowIdData}=internalData;const rowExpandEl=$xeTable.$refs.refRowExpandElem;const bodyScrollElem=getRefElem(elemStore['main-body-scroll']);if(rowExpandEl&&bodyScrollElem){let isUpdateHeight=false;external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayEach(rowExpandEl.children,reEl=>{const expandEl=reEl;const rowid=expandEl.getAttribute('rowid')||'';const rowRest=fullAllDataRowIdData[rowid];if(rowRest){const expandHeight=expandEl.offsetHeight+1;const trEl=bodyScrollElem.querySelector(`.vxe-body--row[rowid="${rowid}"]`);let offsetTop=0;if(scrollYLoad){if(isScrollYBig&&trEl){offsetTop=trEl.offsetTop+trEl.offsetHeight;}else{offsetTop=rowRest.oTop+(rowRest.resizeHeight||cellOpts.height||rowOpts.height||rowRest.height||defaultRowHeight);}}else{if(trEl){offsetTop=trEl.offsetTop+trEl.offsetHeight;}}if(isScrollYBig){offsetTop+=scrollYTop;}expandEl.style.top=toCssUnit(offsetTop);if(!isUpdateHeight){if(rowRest.expandHeight!==expandHeight){isUpdateHeight=true;}}rowRest.expandHeight=expandHeight;}});if(isUpdateHeight){reactData.rowExpandHeightFlag++;$xeTable.$nextTick(()=>{updateRowOffsetTop($xeTable);});}}}}/**
|
|
6109
6119
|
* 更新树连接线样式
|
|
6110
|
-
*/function updateTreeLineStyle($xeTable){const props=$xeTable;const reactData=$xeTable;const internalData=$xeTable;const{treeConfig}=props;if(!treeConfig){return;}const{tableData}=reactData;const{fullAllDataRowIdData,treeExpandedMaps}=internalData;const cellOpts=$xeTable.computeCellOpts;const rowOpts=$xeTable.computeRowOpts;const defaultRowHeight=$xeTable.computeDefaultRowHeight;const treeOpts=$xeTable.computeTreeOpts;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;}});}function handleRowExpandScroll($xeTable){const internalData=$xeTable;const{elemStore}=internalData;const rowExpandEl=$xeTable.$refs.refRowExpandElem;const bodyScrollElem=getRefElem(elemStore['main-body-scroll']);if(rowExpandEl&&bodyScrollElem){rowExpandEl.scrollTop=bodyScrollElem.scrollTop;}}const
|
|
6120
|
+
*/function updateTreeLineStyle($xeTable){const props=$xeTable;const reactData=$xeTable;const internalData=$xeTable;const{treeConfig}=props;if(!treeConfig){return;}const{tableData}=reactData;const{fullAllDataRowIdData,treeExpandedMaps}=internalData;const cellOpts=$xeTable.computeCellOpts;const rowOpts=$xeTable.computeRowOpts;const defaultRowHeight=$xeTable.computeDefaultRowHeight;const treeOpts=$xeTable.computeTreeOpts;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;}});}function handleRowExpandScroll($xeTable){const internalData=$xeTable;const{elemStore}=internalData;const rowExpandEl=$xeTable.$refs.refRowExpandElem;const bodyScrollElem=getRefElem(elemStore['main-body-scroll']);if(rowExpandEl&&bodyScrollElem){rowExpandEl.scrollTop=bodyScrollElem.scrollTop;}}function handleColumnVisible(visible){const $xeTable=this;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 $xeTable.$nextTick();};}const tableMethods={callSlot(slotFunc,params,h,vNodes){const $xeTable=this;// const slots = $xeTable.$scopedSlots
|
|
6111
6121
|
const $xeGrid=$xeTable.$xeGrid;const $xeGantt=$xeTable.$xeGantt;const $xeGGWrapper=$xeGrid||$xeGantt;if(slotFunc){if($xeGGWrapper){return $xeGGWrapper.callSlot(slotFunc,params,h);}// if (XEUtils.isString(slotFunc)) {
|
|
6112
6122
|
// slotFunc = slots[slotFunc] || null
|
|
6113
6123
|
// }
|
|
@@ -6296,9 +6306,9 @@ if(!targetColumn.fixed&&isMaxFixedColumn){if(core_.VxeUI.modal){core_.VxeUI.moda
|
|
|
6296
6306
|
* 取消指定固定列
|
|
6297
6307
|
*/clearColumnFixed(fieldOrColumn){const $xeTable=this;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);const targetColumn=getRootColumn($xeTable,column);if(targetColumn&&targetColumn.fixed){external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree([targetColumn],column=>{column.fixed=null;column.renderFixed=null;});$xeTable.saveCustomStore('update:fixed');if(!status){status=true;}}});if(status){return $xeTable.refreshColumn();}return $xeTable.$nextTick();},/**
|
|
6298
6308
|
* 隐藏指定列
|
|
6299
|
-
*/hideColumn
|
|
6309
|
+
*/hideColumn:handleColumnVisible(false),/**
|
|
6300
6310
|
* 显示指定列
|
|
6301
|
-
*/showColumn
|
|
6311
|
+
*/showColumn:handleColumnVisible(true),setColumnWidth(fieldOrColumn,width){const $xeTable=this;const internalData=$xeTable;const{elemStore}=internalData;let status=false;const cols=external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(fieldOrColumn)?fieldOrColumn:[fieldOrColumn];let cWidth=external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(width);if(isScale(width)){const bodyScrollElem=getRefElem(elemStore['main-body-scroll']);const bodyWidth=bodyScrollElem?bodyScrollElem.clientWidth-1:0;cWidth=Math.floor(cWidth*bodyWidth);}if(cWidth){cols.forEach(item=>{const column=handleFieldOrColumn($xeTable,item);if(column){column.resizeWidth=cWidth;if(!status){status=true;}}});if(status){return $xeTable.refreshColumn().then(()=>{return{status};});}}return $xeTable.$nextTick().then(()=>{return{status};});},getColumnWidth(fieldOrColumn){const column=handleFieldOrColumn(this,fieldOrColumn);if(column){return column.renderWidth;}return 0;},/**
|
|
6302
6312
|
* 手动重置列的显示隐藏、列宽拖动的状态;
|
|
6303
6313
|
* 如果为 true 则重置所有状态
|
|
6304
6314
|
* 如果已关联工具栏,则会同步更新
|
|
@@ -6707,7 +6717,7 @@ emitEvent(type,params,evnt){const $xeTable=this;$xeTable.dispatchEvent(type,para
|
|
|
6707
6717
|
*/getCell(row,column){return this.getCellElement(row,column);},findRowIndexOf(list,row){return row?external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findIndexOf(list,item=>this.eqRow(item,row)):-1;},eqRow(row1,row2){if(row1&&row2){if(row1===row2){return true;}return getRowid(this,row1)===getRowid(this,row2);}return false;},/*************************
|
|
6708
6718
|
* Publish methods
|
|
6709
6719
|
*************************/getSetupOptions(){return methods_getConfig();}};// Module methods
|
|
6710
|
-
const funcs='setFilter,openFilter,clearFilter,saveFilter,saveFilterByEvent,resetFilter,resetFilterByEvent,saveFilterPanel,saveFilterPanelByEvent,resetFilterPanel,resetFilterPanelByEvent,getCheckedFilters,updateFilterOptionStatus,closeMenu,setActiveCellArea,getActiveCellArea,getCellAreas,clearCellAreas,copyCellArea,cutCellArea,pasteCellArea,getCopyCellArea,getCopyCellAreas,clearCopyCellArea,setCellAreas,openFNR,openFind,openReplace,closeFNR,getSelectedCell,clearSelected,insert,insertAt,insertNextAt,insertChild,insertChildAt,insertChildNextAt,remove,removeCheckboxRow,removeRadioRow,removeCurrentRow,getRecordset,getInsertRecords,getRemoveRecords,getUpdateRecords,clearEdit,clearActived,getEditRecord,getEditCell,getActiveRecord,isEditByRow,isActiveByRow,setEditRow,setActiveRow,setEditCell,setActiveCell,setSelectCell,clearValidate,fullValidate,validate,fullValidateField,validateField,openExport,closeExport,openPrint,closePrint,getPrintHtml,exportData,openImport,closeImport,importData,saveFile,readFile,importByFile,print,getCustomVisible,openCustom,closeCustom,toggleCustom,saveCustom,cancelCustom,resetCustom,toggleCustomAllCheckbox,setCustomAllCheckbox'.split(',');funcs.forEach(name=>{
|
|
6720
|
+
const funcs='setFilter,openFilter,clearFilter,saveFilter,saveFilterByEvent,resetFilter,resetFilterByEvent,saveFilterPanel,saveFilterPanelByEvent,resetFilterPanel,resetFilterPanelByEvent,getCheckedFilters,updateFilterOptionStatus,closeMenu,setActiveCellArea,getActiveCellArea,getCellAreas,clearCellAreas,copyCellArea,cutCellArea,pasteCellArea,getCopyCellArea,getCopyCellAreas,clearCopyCellArea,setCellAreas,openFNR,openFind,openReplace,closeFNR,getSelectedCell,clearSelected,insert,insertAt,insertNextAt,insertChild,insertChildAt,insertChildNextAt,remove,removeCheckboxRow,removeRadioRow,removeCurrentRow,getRecordset,getInsertRecords,getRemoveRecords,getUpdateRecords,clearEdit,clearActived,getEditRecord,getEditCell,getActiveRecord,isEditByRow,isActiveByRow,setEditRow,setActiveRow,setEditCell,setActiveCell,setSelectCell,clearValidate,fullValidate,validate,fullValidateField,validateField,openExport,closeExport,openPrint,closePrint,getPrintHtml,exportData,openImport,closeImport,importData,saveFile,readFile,importByFile,print,getCustomVisible,openCustom,closeCustom,toggleCustom,saveCustom,cancelCustom,resetCustom,toggleCustomAllCheckbox,setCustomAllCheckbox'.split(',');funcs.forEach(name=>{tableMethods[name]=function(...args){// if (!this[`_${name}`]) {
|
|
6711
6721
|
// if ('openExport,openPrint,exportData,openImport,importData,saveFile,readFile,importByFile,print'.split(',').includes(name)) {
|
|
6712
6722
|
// errLog('vxe.error.reqModule', ['Export'])
|
|
6713
6723
|
// } else if ('fullValidate,validate'.split(',').includes(name)) {
|
|
@@ -6720,7 +6730,7 @@ const funcs='setFilter,openFilter,clearFilter,saveFilter,saveFilterByEvent,reset
|
|
|
6720
6730
|
// errLog('vxe.error.reqModule', ['Custom'])
|
|
6721
6731
|
// }
|
|
6722
6732
|
// }
|
|
6723
|
-
return this[`_${name}`]?this[`_${name}`](...args):null;};});/* harmony default export */ var methods = (
|
|
6733
|
+
return this[`_${name}`]?this[`_${name}`](...args):null;};});/* harmony default export */ var methods = (tableMethods);
|
|
6724
6734
|
;// CONCATENATED MODULE: ./packages/table/src/body.ts
|
|
6725
6735
|
|
|
6726
6736
|
|
|
@@ -18743,6 +18753,18 @@ function renderBody(h, $xeTable) {
|
|
|
18743
18753
|
});
|
|
18744
18754
|
return rgColumns;
|
|
18745
18755
|
},
|
|
18756
|
+
computeAggFuncColumns() {
|
|
18757
|
+
const $xeTable = this;
|
|
18758
|
+
const reactData = $xeTable;
|
|
18759
|
+
const {
|
|
18760
|
+
rowGroupList,
|
|
18761
|
+
tableColumn
|
|
18762
|
+
} = reactData;
|
|
18763
|
+
if (rowGroupList.length) {
|
|
18764
|
+
return tableColumn.filter(column => column.field && column.aggFunc);
|
|
18765
|
+
}
|
|
18766
|
+
return [];
|
|
18767
|
+
},
|
|
18746
18768
|
tabsResizeFlag() {
|
|
18747
18769
|
const $xeTable = this;
|
|
18748
18770
|
const $xeTabs = $xeTable.$xeTabs;
|
|
@@ -19315,8 +19337,9 @@ function renderBody(h, $xeTable) {
|
|
|
19315
19337
|
if (this.$resize) {
|
|
19316
19338
|
this.$resize.disconnect();
|
|
19317
19339
|
}
|
|
19318
|
-
|
|
19319
|
-
|
|
19340
|
+
$xeTable.closeTooltip();
|
|
19341
|
+
$xeTable.closeFilter();
|
|
19342
|
+
$xeTable.closeMenu();
|
|
19320
19343
|
table_globalEvents.off($xeTable, 'paste');
|
|
19321
19344
|
table_globalEvents.off($xeTable, 'copy');
|
|
19322
19345
|
table_globalEvents.off($xeTable, 'cut');
|
|
@@ -20615,7 +20638,7 @@ const {
|
|
|
20615
20638
|
GLOBAL_EVENT_KEYS: grid_GLOBAL_EVENT_KEYS,
|
|
20616
20639
|
renderEmptyElement: grid_renderEmptyElement
|
|
20617
20640
|
} = core_.VxeUI;
|
|
20618
|
-
const
|
|
20641
|
+
const grid_tableMethods = {};
|
|
20619
20642
|
const propKeys = Object.keys(tableProps);
|
|
20620
20643
|
const defaultLayouts = [['Form'], ['Toolbar', 'Top', 'Table', 'Bottom', 'Pager']];
|
|
20621
20644
|
function getTableOns(_vm) {
|
|
@@ -20643,7 +20666,7 @@ function getTableOns(_vm) {
|
|
|
20643
20666
|
return ons;
|
|
20644
20667
|
}
|
|
20645
20668
|
external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(table.methods, (fn, name) => {
|
|
20646
|
-
|
|
20669
|
+
grid_tableMethods[name] = function (...args) {
|
|
20647
20670
|
const $xeGrid = this;
|
|
20648
20671
|
const $xeTable = $xeGrid.$refs.refTable;
|
|
20649
20672
|
return $xeTable && $xeTable[name](...args);
|
|
@@ -20964,7 +20987,7 @@ function grid_createInternalData() {
|
|
|
20964
20987
|
}
|
|
20965
20988
|
},
|
|
20966
20989
|
methods: {
|
|
20967
|
-
...
|
|
20990
|
+
...grid_tableMethods,
|
|
20968
20991
|
dispatchEvent(type, params, evnt) {
|
|
20969
20992
|
const $xeGrid = this;
|
|
20970
20993
|
$xeGrid.$emit(type, grid_createEvent(evnt, {
|