vxe-table 3.21.7 → 3.21.9
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/render/index.js +166 -24
- package/es/table/src/methods.js +205 -56
- package/es/table/src/util.js +19 -1
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/lib/index.umd.js +324 -40
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/table/render/index.js +272 -25
- package/lib/table/render/index.min.js +1 -1
- package/lib/table/src/methods.js +31 -12
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/util.js +20 -1
- package/lib/table/src/util.min.js +1 -1
- package/lib/ui/index.js +1 -1
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/package.json +2 -2
- package/packages/table/render/index.ts +166 -24
- package/packages/table/src/methods.ts +214 -58
- package/packages/table/src/util.ts +23 -1
- /package/es/{iconfont.1780638727189.ttf → iconfont.1780878069088.ttf} +0 -0
- /package/es/{iconfont.1780638727189.woff → iconfont.1780878069088.woff} +0 -0
- /package/es/{iconfont.1780638727189.woff2 → iconfont.1780878069088.woff2} +0 -0
- /package/lib/{iconfont.1780638727189.ttf → iconfont.1780878069088.ttf} +0 -0
- /package/lib/{iconfont.1780638727189.woff → iconfont.1780878069088.woff} +0 -0
- /package/lib/{iconfont.1780638727189.woff2 → iconfont.1780878069088.woff2} +0 -0
package/es/table/render/index.js
CHANGED
|
@@ -839,7 +839,24 @@ renderer.mixin({
|
|
|
839
839
|
renderTableEdit: nativeSelectEditRender,
|
|
840
840
|
renderTableDefault: nativeSelectEditRender,
|
|
841
841
|
renderTableCell(h, renderOpts, params) {
|
|
842
|
-
|
|
842
|
+
const { options, optionGroups } = renderOpts;
|
|
843
|
+
const { $table, row, column } = params;
|
|
844
|
+
const opSize = options ? options.length : null;
|
|
845
|
+
const ogSize = optionGroups ? optionGroups.length : null;
|
|
846
|
+
const { cellResult } = $table.effectCellData(row, column, {
|
|
847
|
+
key: 'render_table_cell',
|
|
848
|
+
isChanged({ oldValue, cellValue }) {
|
|
849
|
+
return oldValue && oldValue[0] === cellValue && oldValue[1] === opSize && oldValue[2] === ogSize;
|
|
850
|
+
},
|
|
851
|
+
setValue({ cellValue }) {
|
|
852
|
+
return [cellValue, opSize, ogSize];
|
|
853
|
+
},
|
|
854
|
+
getResult({ cellValue }) {
|
|
855
|
+
return handleSelectCellValue(cellValue, renderOpts);
|
|
856
|
+
}
|
|
857
|
+
});
|
|
858
|
+
// const cellResult = getSelectCellValue(renderOpts, params)
|
|
859
|
+
return getCellLabelVNs(h, renderOpts, params, cellResult);
|
|
843
860
|
},
|
|
844
861
|
renderTableFilter(h, renderOpts, params) {
|
|
845
862
|
const { column } = params;
|
|
@@ -954,15 +971,20 @@ renderer.mixin({
|
|
|
954
971
|
tableAutoFocus: 'input',
|
|
955
972
|
renderTableEdit: defaultEditRender,
|
|
956
973
|
renderTableCell(h, renderOpts, params) {
|
|
957
|
-
const
|
|
958
|
-
const { row, column } = params;
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
974
|
+
const props = renderOpts.props || {};
|
|
975
|
+
const { $table, row, column } = params;
|
|
976
|
+
const { cellResult } = $table.effectCellData(row, column, {
|
|
977
|
+
key: 'render_table_cell',
|
|
978
|
+
getResult({ cellValue }) {
|
|
979
|
+
if (cellValue) {
|
|
980
|
+
if (props.type !== 'time') {
|
|
981
|
+
return getLabelFormatDate(cellValue, props);
|
|
982
|
+
}
|
|
983
|
+
}
|
|
984
|
+
return cellValue;
|
|
963
985
|
}
|
|
964
|
-
}
|
|
965
|
-
return getCellLabelVNs(h, renderOpts, params,
|
|
986
|
+
});
|
|
987
|
+
return getCellLabelVNs(h, renderOpts, params, cellResult);
|
|
966
988
|
},
|
|
967
989
|
tableCellFormatter: handleFormatDatePicker,
|
|
968
990
|
renderTableDefault: defaultEditRender,
|
|
@@ -1013,6 +1035,40 @@ renderer.mixin({
|
|
|
1013
1035
|
})
|
|
1014
1036
|
];
|
|
1015
1037
|
},
|
|
1038
|
+
renderTableDefault(h, renderOpts, params) {
|
|
1039
|
+
const { startField, endField } = renderOpts;
|
|
1040
|
+
const { row, column } = params;
|
|
1041
|
+
const { model } = column;
|
|
1042
|
+
const cellValue = getCellValue(row, column);
|
|
1043
|
+
const seProps = {};
|
|
1044
|
+
const seOs = {};
|
|
1045
|
+
if (startField && endField) {
|
|
1046
|
+
seProps.startValue = XEUtils.get(row, startField);
|
|
1047
|
+
seProps.endValue = XEUtils.get(row, endField);
|
|
1048
|
+
seOs['update:startValue'] = (value) => {
|
|
1049
|
+
if (startField) {
|
|
1050
|
+
XEUtils.set(row, startField, value);
|
|
1051
|
+
}
|
|
1052
|
+
};
|
|
1053
|
+
seOs['update:endValue'] = (value) => {
|
|
1054
|
+
if (endField) {
|
|
1055
|
+
XEUtils.set(row, endField, value);
|
|
1056
|
+
}
|
|
1057
|
+
};
|
|
1058
|
+
}
|
|
1059
|
+
return [
|
|
1060
|
+
h(getDefaultComponent(renderOpts), {
|
|
1061
|
+
props: getCellEditProps(renderOpts, params, cellValue, seProps),
|
|
1062
|
+
on: getComponentOns(renderOpts, params, {
|
|
1063
|
+
model(cellValue) {
|
|
1064
|
+
model.update = true;
|
|
1065
|
+
model.value = cellValue;
|
|
1066
|
+
setCellValue(row, column, cellValue);
|
|
1067
|
+
}
|
|
1068
|
+
}, seOs)
|
|
1069
|
+
})
|
|
1070
|
+
];
|
|
1071
|
+
},
|
|
1016
1072
|
renderTableCell(h, renderOpts, params) {
|
|
1017
1073
|
const { startField, endField } = renderOpts;
|
|
1018
1074
|
const { row, column } = params;
|
|
@@ -1045,6 +1101,7 @@ renderer.mixin({
|
|
|
1045
1101
|
},
|
|
1046
1102
|
VxeTextarea: {
|
|
1047
1103
|
tableAutoFocus: 'textarea',
|
|
1104
|
+
renderTableDefault: defaultEditRender,
|
|
1048
1105
|
renderTableEdit: defaultEditRender
|
|
1049
1106
|
},
|
|
1050
1107
|
VxeButton: {
|
|
@@ -1066,7 +1123,24 @@ renderer.mixin({
|
|
|
1066
1123
|
renderTableEdit: defaultSelectEditRender,
|
|
1067
1124
|
renderTableDefault: defaultSelectEditRender,
|
|
1068
1125
|
renderTableCell(h, renderOpts, params) {
|
|
1069
|
-
|
|
1126
|
+
const { options, optionGroups } = renderOpts;
|
|
1127
|
+
const { $table, row, column } = params;
|
|
1128
|
+
const opSize = options ? options.length : null;
|
|
1129
|
+
const ogSize = optionGroups ? optionGroups.length : null;
|
|
1130
|
+
const { cellResult } = $table.effectCellData(row, column, {
|
|
1131
|
+
key: 'render_table_cell',
|
|
1132
|
+
isChanged({ oldValue, cellValue }) {
|
|
1133
|
+
return oldValue && oldValue[0] === cellValue && oldValue[1] === opSize && oldValue[2] === ogSize;
|
|
1134
|
+
},
|
|
1135
|
+
setValue({ cellValue }) {
|
|
1136
|
+
return [cellValue, opSize, ogSize];
|
|
1137
|
+
},
|
|
1138
|
+
getResult({ cellValue }) {
|
|
1139
|
+
return handleSelectCellValue(cellValue, renderOpts);
|
|
1140
|
+
}
|
|
1141
|
+
});
|
|
1142
|
+
// const cellResult = getSelectCellValue(renderOpts, params)
|
|
1143
|
+
return getCellLabelVNs(h, renderOpts, params, cellResult);
|
|
1070
1144
|
},
|
|
1071
1145
|
createTableFilterOptions: defaultFilterOptions,
|
|
1072
1146
|
renderTableFilter(h, renderOpts, params) {
|
|
@@ -1134,7 +1208,24 @@ renderer.mixin({
|
|
|
1134
1208
|
},
|
|
1135
1209
|
FormatSelect: {
|
|
1136
1210
|
renderTableDefault(h, renderOpts, params) {
|
|
1137
|
-
|
|
1211
|
+
const { options, optionGroups } = renderOpts;
|
|
1212
|
+
const { $table, row, column } = params;
|
|
1213
|
+
const opSize = options ? options.length : null;
|
|
1214
|
+
const ogSize = optionGroups ? optionGroups.length : null;
|
|
1215
|
+
const { cellResult } = $table.effectCellData(row, column, {
|
|
1216
|
+
key: 'render_table_cell',
|
|
1217
|
+
isChanged({ oldValue, cellValue }) {
|
|
1218
|
+
return oldValue && oldValue[0] === cellValue && oldValue[1] === opSize && oldValue[2] === ogSize;
|
|
1219
|
+
},
|
|
1220
|
+
setValue({ cellValue }) {
|
|
1221
|
+
return [cellValue, opSize, ogSize];
|
|
1222
|
+
},
|
|
1223
|
+
getResult({ cellValue }) {
|
|
1224
|
+
return handleSelectCellValue(cellValue, renderOpts);
|
|
1225
|
+
}
|
|
1226
|
+
});
|
|
1227
|
+
// const cellResult = getSelectCellValue(renderOpts, params)
|
|
1228
|
+
return getCellLabelVNs(h, renderOpts, params, cellResult);
|
|
1138
1229
|
},
|
|
1139
1230
|
tableCellFormatter: handleFormatSelect,
|
|
1140
1231
|
tableCellCopyMethod: handleFormatSelect,
|
|
@@ -1146,18 +1237,24 @@ renderer.mixin({
|
|
|
1146
1237
|
tableAutoFocus: 'input',
|
|
1147
1238
|
renderTableEdit: defaultTableOrTreeSelectEditRender,
|
|
1148
1239
|
renderTableCell(h, renderOpts, params) {
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1240
|
+
const { options, optionGroups } = renderOpts;
|
|
1241
|
+
const { $table, row, column } = params;
|
|
1242
|
+
const opSize = options ? options.length : null;
|
|
1243
|
+
const ogSize = optionGroups ? optionGroups.length : null;
|
|
1244
|
+
const { cellResult } = $table.effectCellData(row, column, {
|
|
1245
|
+
key: 'render_table_cell',
|
|
1246
|
+
isChanged({ oldValue, cellValue }) {
|
|
1247
|
+
return oldValue && oldValue[0] === cellValue && oldValue[1] === opSize && oldValue[2] === ogSize;
|
|
1248
|
+
},
|
|
1249
|
+
setValue({ cellValue }) {
|
|
1250
|
+
return [cellValue, opSize, ogSize];
|
|
1251
|
+
},
|
|
1252
|
+
getResult({ cellValue }) {
|
|
1253
|
+
return handleTreeSelectCellValue(cellValue, renderOpts);
|
|
1254
|
+
}
|
|
1255
|
+
});
|
|
1256
|
+
// const cellResult = getTreeSelectCellValue(renderOpts, params)
|
|
1257
|
+
return getCellLabelVNs(h, renderOpts, params, cellResult);
|
|
1161
1258
|
},
|
|
1162
1259
|
tableCellFormatter: handleFormatTreeSelect,
|
|
1163
1260
|
tableCellCopyMethod: handleFormatTreeSelect,
|
|
@@ -1175,7 +1272,52 @@ renderer.mixin({
|
|
|
1175
1272
|
},
|
|
1176
1273
|
FormatTreeSelect: {
|
|
1177
1274
|
renderTableDefault(h, renderOpts, params) {
|
|
1178
|
-
|
|
1275
|
+
const { options, optionGroups } = renderOpts;
|
|
1276
|
+
const { $table, row, column } = params;
|
|
1277
|
+
const opSize = options ? options.length : null;
|
|
1278
|
+
const ogSize = optionGroups ? optionGroups.length : null;
|
|
1279
|
+
const { cellResult } = $table.effectCellData(row, column, {
|
|
1280
|
+
key: 'render_table_cell',
|
|
1281
|
+
isChanged({ oldValue, cellValue }) {
|
|
1282
|
+
return oldValue && oldValue[0] === cellValue && oldValue[1] === opSize && oldValue[2] === ogSize;
|
|
1283
|
+
},
|
|
1284
|
+
setValue({ cellValue }) {
|
|
1285
|
+
return [cellValue, opSize, ogSize];
|
|
1286
|
+
},
|
|
1287
|
+
getResult({ cellValue }) {
|
|
1288
|
+
return handleTreeSelectCellValue(cellValue, renderOpts);
|
|
1289
|
+
}
|
|
1290
|
+
});
|
|
1291
|
+
// const cellResult = getTreeSelectCellValue(renderOpts, params)
|
|
1292
|
+
return getCellLabelVNs(h, renderOpts, params, cellResult);
|
|
1293
|
+
},
|
|
1294
|
+
tableCellFormatter: handleFormatTreeSelect,
|
|
1295
|
+
tableCellCopyMethod: handleFormatTreeSelect,
|
|
1296
|
+
tableCellPasteMethod: handleSetTreeSelectValue,
|
|
1297
|
+
tableExportMethod: handleExportTreeSelectMethod
|
|
1298
|
+
},
|
|
1299
|
+
VxeTableSelect: {
|
|
1300
|
+
tableAutoFocus: 'input',
|
|
1301
|
+
renderTableEdit: defaultTableOrTreeSelectEditRender,
|
|
1302
|
+
renderTableCell(h, renderOpts, params) {
|
|
1303
|
+
const { options, optionGroups } = renderOpts;
|
|
1304
|
+
const { $table, row, column } = params;
|
|
1305
|
+
const opSize = options ? options.length : null;
|
|
1306
|
+
const ogSize = optionGroups ? optionGroups.length : null;
|
|
1307
|
+
const { cellResult } = $table.effectCellData(row, column, {
|
|
1308
|
+
key: 'render_table_cell',
|
|
1309
|
+
isChanged({ oldValue, cellValue }) {
|
|
1310
|
+
return oldValue && oldValue[0] === cellValue && oldValue[1] === opSize && oldValue[2] === ogSize;
|
|
1311
|
+
},
|
|
1312
|
+
setValue({ cellValue }) {
|
|
1313
|
+
return [cellValue, opSize, ogSize];
|
|
1314
|
+
},
|
|
1315
|
+
getResult({ cellValue }) {
|
|
1316
|
+
return handleTreeSelectCellValue(cellValue, renderOpts);
|
|
1317
|
+
}
|
|
1318
|
+
});
|
|
1319
|
+
// const cellResult = getTreeSelectCellValue(renderOpts, params)
|
|
1320
|
+
return getCellLabelVNs(h, renderOpts, params, cellResult);
|
|
1179
1321
|
},
|
|
1180
1322
|
tableCellFormatter: handleFormatTreeSelect,
|
|
1181
1323
|
tableCellCopyMethod: handleFormatTreeSelect,
|
package/es/table/src/methods.js
CHANGED
|
@@ -3,7 +3,7 @@ import { getTpImg, isPx, isScale, hasClass, addClass, removeClass, wheelScrollLe
|
|
|
3
3
|
import { getLastZIndex, nextZIndex, hasChildrenList, getFuncText, isEnableConf, formatText, eqEmptyValue } from '../../ui/src/utils';
|
|
4
4
|
import { VxeUI } from '../../ui';
|
|
5
5
|
import Cell from './cell';
|
|
6
|
-
import { getRowUniqueId, createRowId, clearTableAllStatus, getColumnList, toFilters, getRowkey, getRowid, rowToVisible, colToVisible, getCellValue, setCellValue, handleRowidOrRow, handleFieldOrColumn, toTreePathSeq, restoreScrollLocation, getRootColumn, getColReMinWidth, getColReMaxWidth, createHandleUpdateRowId, createHandleGetRowId, getRefElem, getCellRestHeight, getLastChildColumn } from './util';
|
|
6
|
+
import { getRowUniqueId, createRowId, clearTableAllStatus, getColumnList, toFilters, getRowkey, getRowid, rowToVisible, colToVisible, getCellValue, setCellValue, handleRowidOrRow, handleFieldOrColumn, toTreePathSeq, restoreScrollLocation, getRootColumn, getColReMinWidth, getColReMaxWidth, createHandleUpdateRowId, createHandleGetRowId, getRefElem, getCellRestHeight, getLastChildColumn, getRowMaxHeight } from './util';
|
|
7
7
|
import { getSlotVNs } from '../../ui/src/vn';
|
|
8
8
|
import { moveRowAnimateToTb, clearRowAnimate, moveColAnimateToLr, clearColAnimate } from '../../ui/src/anime';
|
|
9
9
|
import { warnLog, errLog } from '../../ui/src/log';
|
|
@@ -2470,35 +2470,39 @@ function autoCellWidth($xeTable) {
|
|
|
2470
2470
|
/**
|
|
2471
2471
|
* 计算自适应行高
|
|
2472
2472
|
*/
|
|
2473
|
-
const calcCellAutoHeight = ($xeTable, rowRest, wrapperEl) => {
|
|
2474
|
-
const
|
|
2475
|
-
const {
|
|
2473
|
+
const calcCellAutoHeight = ($xeTable, rowid, rowRest, wrapperEl) => {
|
|
2474
|
+
const internalData = $xeTable;
|
|
2475
|
+
const { fullCellHeightMaps } = internalData;
|
|
2476
|
+
let chRest = fullCellHeightMaps[rowid];
|
|
2477
|
+
if (!chRest) {
|
|
2478
|
+
chRest = {};
|
|
2479
|
+
fullCellHeightMaps[rowid] = chRest;
|
|
2480
|
+
}
|
|
2476
2481
|
const wrapperElemList = wrapperEl.querySelectorAll(`.vxe-cell--wrapper[rowid="${rowRest.rowid}"]`);
|
|
2477
|
-
let colHeight = 0;
|
|
2478
2482
|
let firstCellStyle = null;
|
|
2479
2483
|
let topBottomPadding = 0;
|
|
2484
|
+
let changeCH = false;
|
|
2480
2485
|
for (let i = 0; i < wrapperElemList.length; i++) {
|
|
2481
2486
|
const wrapperElem = wrapperElemList[i];
|
|
2482
2487
|
const cellElem = wrapperElem.parentElement;
|
|
2483
2488
|
const cellStyle = cellElem.style;
|
|
2484
2489
|
const orHeight = cellStyle.height;
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
}
|
|
2490
|
+
const colid = wrapperElem.getAttribute('colid') || '';
|
|
2491
|
+
cellStyle.height = '';
|
|
2488
2492
|
if (!firstCellStyle) {
|
|
2489
2493
|
firstCellStyle = getComputedStyle(cellElem);
|
|
2490
2494
|
topBottomPadding = firstCellStyle ? Math.ceil(XEUtils.toNumber(firstCellStyle.paddingTop) + XEUtils.toNumber(firstCellStyle.paddingBottom)) : 0;
|
|
2491
2495
|
}
|
|
2492
|
-
if (!scrollXLoad) {
|
|
2493
|
-
cellStyle.height = orHeight;
|
|
2494
|
-
}
|
|
2495
2496
|
const cellHeight = wrapperElem ? wrapperElem.clientHeight : 0;
|
|
2496
|
-
colHeight = Math.
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2497
|
+
const colHeight = Math.ceil(cellHeight + topBottomPadding);
|
|
2498
|
+
if (chRest[colid] !== colHeight) {
|
|
2499
|
+
changeCH = true;
|
|
2500
|
+
chRest[colid] = colHeight;
|
|
2501
|
+
}
|
|
2502
|
+
cellStyle.height = orHeight;
|
|
2500
2503
|
}
|
|
2501
|
-
|
|
2504
|
+
const cellMaxHeight = getRowMaxHeight(chRest, changeCH);
|
|
2505
|
+
return cellMaxHeight;
|
|
2502
2506
|
};
|
|
2503
2507
|
/**
|
|
2504
2508
|
* 自适应行高
|
|
@@ -2523,7 +2527,7 @@ const calcCellHeight = ($xeTable) => {
|
|
|
2523
2527
|
const rowid = handleGetRowId(row);
|
|
2524
2528
|
const rowRest = fullAllDataRowIdData[rowid];
|
|
2525
2529
|
if (rowRest) {
|
|
2526
|
-
const height = calcCellAutoHeight($xeTable, rowRest, el);
|
|
2530
|
+
const height = calcCellAutoHeight($xeTable, rowid, rowRest, el);
|
|
2527
2531
|
rowRest.height = Math.max(defaultRowHeight, height);
|
|
2528
2532
|
}
|
|
2529
2533
|
el.removeAttribute('data-calc-row');
|
|
@@ -3014,7 +3018,6 @@ function calcScrollbar($xeTable) {
|
|
|
3014
3018
|
function handleRecalculateStyle($xeTable, reFull, reWidth, reHeight) {
|
|
3015
3019
|
const internalData = $xeTable;
|
|
3016
3020
|
const el = $xeTable.$refs.refElem;
|
|
3017
|
-
internalData.rceRunTime = Date.now();
|
|
3018
3021
|
if (!el || !el.clientWidth) {
|
|
3019
3022
|
return $xeTable.$nextTick();
|
|
3020
3023
|
}
|
|
@@ -3038,6 +3041,7 @@ function handleRecalculateStyle($xeTable, reFull, reWidth, reHeight) {
|
|
|
3038
3041
|
if (reFull) {
|
|
3039
3042
|
updateTreeLineStyle($xeTable);
|
|
3040
3043
|
}
|
|
3044
|
+
internalData.rceRunTime = Date.now();
|
|
3041
3045
|
return computeScrollLoad($xeTable).then(() => {
|
|
3042
3046
|
// 初始化时需要在列计算之后再执行优化运算,达到最优显示效果
|
|
3043
3047
|
if (reWidth) {
|
|
@@ -3058,11 +3062,13 @@ function handleRecalculateStyle($xeTable, reFull, reWidth, reHeight) {
|
|
|
3058
3062
|
if (reFull) {
|
|
3059
3063
|
updateTreeLineStyle($xeTable);
|
|
3060
3064
|
}
|
|
3065
|
+
internalData.rceRunTime = Date.now();
|
|
3061
3066
|
if (reFull) {
|
|
3062
3067
|
return computeScrollLoad($xeTable);
|
|
3063
3068
|
}
|
|
3064
3069
|
});
|
|
3065
3070
|
}
|
|
3071
|
+
const minRunDelay = 50;
|
|
3066
3072
|
function handleLazyRecalculate($xeTable, reFull, reWidth, reHeight) {
|
|
3067
3073
|
const reactData = $xeTable;
|
|
3068
3074
|
const internalData = $xeTable;
|
|
@@ -3071,7 +3077,17 @@ function handleLazyRecalculate($xeTable, reFull, reWidth, reHeight) {
|
|
|
3071
3077
|
const { rceTimeout, rceRunTime } = internalData;
|
|
3072
3078
|
const $xeGanttView = internalData.xeGanttView;
|
|
3073
3079
|
const resizeOpts = $xeTable.computeResizeOpts;
|
|
3074
|
-
|
|
3080
|
+
let rceDelay = internalData.rceDelay;
|
|
3081
|
+
// 如果在500毫秒内频繁执行,则执行次数减缓
|
|
3082
|
+
if (rceRunTime && rceRunTime > Date.now() - 500) {
|
|
3083
|
+
rceDelay += 50;
|
|
3084
|
+
}
|
|
3085
|
+
else {
|
|
3086
|
+
rceDelay = 0;
|
|
3087
|
+
}
|
|
3088
|
+
internalData.rceDelay = rceDelay;
|
|
3089
|
+
const refreshDelay = resizeOpts.refreshDelay || 30;
|
|
3090
|
+
const reDelay = rceDelay + refreshDelay;
|
|
3075
3091
|
const el = $xeTable.$refs.refElem;
|
|
3076
3092
|
if (el && el.clientWidth) {
|
|
3077
3093
|
autoCellWidth($xeTable);
|
|
@@ -3082,7 +3098,7 @@ function handleLazyRecalculate($xeTable, reFull, reWidth, reHeight) {
|
|
|
3082
3098
|
}
|
|
3083
3099
|
if (rceTimeout) {
|
|
3084
3100
|
clearTimeout(rceTimeout);
|
|
3085
|
-
if (rceRunTime && rceRunTime +
|
|
3101
|
+
if (rceRunTime && rceRunTime + minRunDelay < Date.now()) {
|
|
3086
3102
|
resolve(handleRecalculateStyle($xeTable, reFull, reWidth, reHeight));
|
|
3087
3103
|
}
|
|
3088
3104
|
else {
|
|
@@ -3100,7 +3116,7 @@ function handleLazyRecalculate($xeTable, reFull, reWidth, reHeight) {
|
|
|
3100
3116
|
internalData.rceTimeout = setTimeout(() => {
|
|
3101
3117
|
internalData.rceTimeout = undefined;
|
|
3102
3118
|
handleRecalculateStyle($xeTable, reFull, reWidth, reHeight);
|
|
3103
|
-
},
|
|
3119
|
+
}, reDelay);
|
|
3104
3120
|
});
|
|
3105
3121
|
}
|
|
3106
3122
|
function handleResizeEvent($xeTable) {
|
|
@@ -3437,6 +3453,8 @@ function loadTableData($xeTable, datas, isReload, isReset) {
|
|
|
3437
3453
|
reactData.insertRowFlag++;
|
|
3438
3454
|
internalData.removeRowMaps = {};
|
|
3439
3455
|
reactData.removeRowFlag++;
|
|
3456
|
+
internalData.fullCellHeightMaps = {};
|
|
3457
|
+
internalData.fullCellStoreMaps = {};
|
|
3440
3458
|
const sYLoad = updateScrollYStatus($xeTable, fullData);
|
|
3441
3459
|
// 全量数据
|
|
3442
3460
|
internalData.tableFullData = fullData;
|
|
@@ -3811,12 +3829,48 @@ function initColumnHierarchy($xeTable) {
|
|
|
3811
3829
|
internalData.fullColumnIdData = fullColIdData;
|
|
3812
3830
|
internalData.fullColumnFieldData = fullColFieldData;
|
|
3813
3831
|
}
|
|
3814
|
-
function
|
|
3832
|
+
function buildColumnInfo($xeTable) {
|
|
3815
3833
|
const props = $xeTable;
|
|
3816
3834
|
const $xeToolbar = $xeTable.$refs.$xeToolbar;
|
|
3817
3835
|
const reactData = $xeTable;
|
|
3818
3836
|
const internalData = $xeTable;
|
|
3837
|
+
const { scrollXLoad, scrollYLoad, expandColumn } = reactData;
|
|
3819
3838
|
const expandOpts = $xeTable.computeExpandOpts;
|
|
3839
|
+
cacheColumnMap($xeTable);
|
|
3840
|
+
parseColumns($xeTable, true).then(() => {
|
|
3841
|
+
if (reactData.scrollXLoad) {
|
|
3842
|
+
loadScrollXData($xeTable);
|
|
3843
|
+
}
|
|
3844
|
+
});
|
|
3845
|
+
$xeTable.clearHeaderFormatterCache();
|
|
3846
|
+
$xeTable.clearMergeCells();
|
|
3847
|
+
$xeTable.clearMergeFooterItems();
|
|
3848
|
+
$xeTable.handleTableData(true);
|
|
3849
|
+
$xeTable.handleAggregateSummaryData();
|
|
3850
|
+
if ((scrollXLoad || scrollYLoad) && (expandColumn && expandOpts.mode !== 'fixed')) {
|
|
3851
|
+
warnLog('vxe.error.scrollErrProp', ['column.type=expand']);
|
|
3852
|
+
}
|
|
3853
|
+
return $xeTable.$nextTick().then(() => {
|
|
3854
|
+
if ($xeToolbar) {
|
|
3855
|
+
$xeToolbar.syncUpdate({
|
|
3856
|
+
collectColumn: internalData.collectColumn,
|
|
3857
|
+
$table: $xeTable
|
|
3858
|
+
});
|
|
3859
|
+
}
|
|
3860
|
+
if ($xeTable.handleUpdateCustomColumn) {
|
|
3861
|
+
$xeTable.handleUpdateCustomColumn();
|
|
3862
|
+
}
|
|
3863
|
+
const columnOpts = $xeTable.computeColumnOpts;
|
|
3864
|
+
if (props.showCustomHeader && reactData.isGroup && (columnOpts.resizable || props.resizable)) {
|
|
3865
|
+
warnLog('vxe.error.notConflictProp', ['show-custom-header & colgroup', 'column-config.resizable=false']);
|
|
3866
|
+
}
|
|
3867
|
+
reactData.isColLoading = false;
|
|
3868
|
+
return handleLazyRecalculate($xeTable, false, true, true);
|
|
3869
|
+
});
|
|
3870
|
+
}
|
|
3871
|
+
function handleInitColumn($xeTable, collectColumn) {
|
|
3872
|
+
const reactData = $xeTable;
|
|
3873
|
+
const internalData = $xeTable;
|
|
3820
3874
|
internalData.collectColumn = collectColumn;
|
|
3821
3875
|
const tFullColumn = getColumnList(collectColumn);
|
|
3822
3876
|
internalData.tableFullColumn = tFullColumn;
|
|
@@ -3824,38 +3878,7 @@ function handleInitColumn($xeTable, collectColumn) {
|
|
|
3824
3878
|
reactData.isColLoading = true;
|
|
3825
3879
|
initColumnHierarchy($xeTable);
|
|
3826
3880
|
return Promise.resolve(restoreCustomStorage($xeTable)).then(() => {
|
|
3827
|
-
|
|
3828
|
-
cacheColumnMap($xeTable);
|
|
3829
|
-
parseColumns($xeTable, true).then(() => {
|
|
3830
|
-
if (reactData.scrollXLoad) {
|
|
3831
|
-
loadScrollXData($xeTable);
|
|
3832
|
-
}
|
|
3833
|
-
});
|
|
3834
|
-
$xeTable.clearHeaderFormatterCache();
|
|
3835
|
-
$xeTable.clearMergeCells();
|
|
3836
|
-
$xeTable.clearMergeFooterItems();
|
|
3837
|
-
$xeTable.handleTableData(true);
|
|
3838
|
-
$xeTable.handleAggregateSummaryData();
|
|
3839
|
-
if ((scrollXLoad || scrollYLoad) && (expandColumn && expandOpts.mode !== 'fixed')) {
|
|
3840
|
-
warnLog('vxe.error.scrollErrProp', ['column.type=expand']);
|
|
3841
|
-
}
|
|
3842
|
-
return $xeTable.$nextTick().then(() => {
|
|
3843
|
-
if ($xeToolbar) {
|
|
3844
|
-
$xeToolbar.syncUpdate({
|
|
3845
|
-
collectColumn: internalData.collectColumn,
|
|
3846
|
-
$table: $xeTable
|
|
3847
|
-
});
|
|
3848
|
-
}
|
|
3849
|
-
if ($xeTable.handleUpdateCustomColumn) {
|
|
3850
|
-
$xeTable.handleUpdateCustomColumn();
|
|
3851
|
-
}
|
|
3852
|
-
const columnOpts = $xeTable.computeColumnOpts;
|
|
3853
|
-
if (props.showCustomHeader && reactData.isGroup && (columnOpts.resizable || props.resizable)) {
|
|
3854
|
-
warnLog('vxe.error.notConflictProp', ['show-custom-header & colgroup', 'column-config.resizable=false']);
|
|
3855
|
-
}
|
|
3856
|
-
reactData.isColLoading = false;
|
|
3857
|
-
return handleLazyRecalculate($xeTable, false, true, true);
|
|
3858
|
-
});
|
|
3881
|
+
return buildColumnInfo($xeTable);
|
|
3859
3882
|
});
|
|
3860
3883
|
}
|
|
3861
3884
|
/**
|
|
@@ -5312,6 +5335,58 @@ const tableMethods = {
|
|
|
5312
5335
|
}
|
|
5313
5336
|
return $xeTable.$nextTick();
|
|
5314
5337
|
},
|
|
5338
|
+
effectCellData(row, column, options) {
|
|
5339
|
+
const $xeTable = this;
|
|
5340
|
+
const internalData = $xeTable;
|
|
5341
|
+
const { fullCellStoreMaps } = internalData;
|
|
5342
|
+
const editOpts = $xeTable.computeEditOpts;
|
|
5343
|
+
const { key, isChanged, setValue, getResult } = options;
|
|
5344
|
+
const rowid = getRowid($xeTable, row);
|
|
5345
|
+
const colid = column.id;
|
|
5346
|
+
let rowStore = fullCellStoreMaps[rowid];
|
|
5347
|
+
const cellValue = XEUtils.get(row, column.field);
|
|
5348
|
+
const restParams = {
|
|
5349
|
+
$table: $xeTable,
|
|
5350
|
+
row,
|
|
5351
|
+
rowid,
|
|
5352
|
+
column,
|
|
5353
|
+
colid,
|
|
5354
|
+
cellValue,
|
|
5355
|
+
oldValue: null
|
|
5356
|
+
};
|
|
5357
|
+
if (editOpts.cache === false && key === 'render_table_cell') {
|
|
5358
|
+
const rest = restParams;
|
|
5359
|
+
rest.cellResult = getResult ? getResult(restParams) : cellValue;
|
|
5360
|
+
return rest;
|
|
5361
|
+
}
|
|
5362
|
+
if (!rowStore) {
|
|
5363
|
+
rowStore = {};
|
|
5364
|
+
fullCellStoreMaps[rowid] = rowStore;
|
|
5365
|
+
}
|
|
5366
|
+
let cellStore = rowStore[colid];
|
|
5367
|
+
if (!cellStore) {
|
|
5368
|
+
cellStore = {
|
|
5369
|
+
value: undefined,
|
|
5370
|
+
result: {}
|
|
5371
|
+
};
|
|
5372
|
+
rowStore[colid] = cellStore;
|
|
5373
|
+
}
|
|
5374
|
+
const restData = rowStore[colid];
|
|
5375
|
+
const oldValue = restData.value;
|
|
5376
|
+
restParams.oldValue = oldValue;
|
|
5377
|
+
if (isChanged ? !isChanged(restParams) : oldValue !== cellValue) {
|
|
5378
|
+
restData.value = setValue ? setValue(restParams) : cellValue;
|
|
5379
|
+
restData.result = {};
|
|
5380
|
+
}
|
|
5381
|
+
const storeData = restData.result;
|
|
5382
|
+
if (XEUtils.isUndefined(storeData[key])) {
|
|
5383
|
+
storeData[key] = getResult ? getResult(restParams) : cellValue;
|
|
5384
|
+
}
|
|
5385
|
+
const cellResult = storeData[key];
|
|
5386
|
+
const rest = restParams;
|
|
5387
|
+
rest.cellResult = cellResult;
|
|
5388
|
+
return rest;
|
|
5389
|
+
},
|
|
5315
5390
|
getCellElement(row, fieldOrColumn) {
|
|
5316
5391
|
const $xeTable = this;
|
|
5317
5392
|
const internalData = $xeTable;
|
|
@@ -6197,6 +6272,9 @@ const tableMethods = {
|
|
|
6197
6272
|
warnLog('vxe.error.delFunc', ['resetColumn', 'resetCustom']);
|
|
6198
6273
|
return this.resetCustom(options);
|
|
6199
6274
|
},
|
|
6275
|
+
/**
|
|
6276
|
+
* @private
|
|
6277
|
+
*/
|
|
6200
6278
|
handleCustom() {
|
|
6201
6279
|
const $xeTable = this;
|
|
6202
6280
|
const props = $xeTable;
|
|
@@ -6249,6 +6327,68 @@ const tableMethods = {
|
|
|
6249
6327
|
}
|
|
6250
6328
|
}
|
|
6251
6329
|
},
|
|
6330
|
+
/**
|
|
6331
|
+
* 用于 custom-config,用于手动恢复自定义列设置信息,恢复表格重置为初始状态
|
|
6332
|
+
* @param storeData
|
|
6333
|
+
* @returns
|
|
6334
|
+
*/
|
|
6335
|
+
setCustomStoreData(storeData) {
|
|
6336
|
+
const $xeTable = this;
|
|
6337
|
+
const reactData = $xeTable;
|
|
6338
|
+
const internalData = $xeTable;
|
|
6339
|
+
if (!storeData) {
|
|
6340
|
+
return $xeTable.$nextTick();
|
|
6341
|
+
}
|
|
6342
|
+
const customOpts = $xeTable.computeCustomOpts;
|
|
6343
|
+
const { checkMethod } = customOpts;
|
|
6344
|
+
// 重置状态
|
|
6345
|
+
clearTableAllStatus($xeTable);
|
|
6346
|
+
// 恢复列
|
|
6347
|
+
const allCols = [];
|
|
6348
|
+
XEUtils.eachTree(internalData.collectColumn, (column) => {
|
|
6349
|
+
column.resizeWidth = 0;
|
|
6350
|
+
column.fixed = column.defaultFixed;
|
|
6351
|
+
column.renderSortNumber = column.sortNumber;
|
|
6352
|
+
column.parentId = column.defaultParentId;
|
|
6353
|
+
if (!checkMethod || checkMethod({ $table: $xeTable, column })) {
|
|
6354
|
+
column.visible = column.defaultVisible;
|
|
6355
|
+
}
|
|
6356
|
+
column.aggFunc = column.defaultAggFunc;
|
|
6357
|
+
column.renderAggFn = column.defaultAggFunc;
|
|
6358
|
+
column.renderResizeWidth = column.renderWidth;
|
|
6359
|
+
allCols.push(column);
|
|
6360
|
+
});
|
|
6361
|
+
const newCollectCols = XEUtils.toArrayTree(XEUtils.orderBy(allCols, 'renderSortNumber'), { key: 'id', parentKey: 'parentId', children: 'children' });
|
|
6362
|
+
internalData.collectColumn = newCollectCols;
|
|
6363
|
+
internalData.tableFullColumn = getColumnList(newCollectCols);
|
|
6364
|
+
reactData.updateColFlag++;
|
|
6365
|
+
reactData.isColLoading = true;
|
|
6366
|
+
initColumnHierarchy($xeTable);
|
|
6367
|
+
return Promise.resolve(handleCustomRestore($xeTable, storeData)).then(() => {
|
|
6368
|
+
return buildColumnInfo($xeTable);
|
|
6369
|
+
}).then(() => {
|
|
6370
|
+
// 恢复数据聚合分组
|
|
6371
|
+
const { isRowGroupStatus, rowGroupList } = reactData;
|
|
6372
|
+
if (isRowGroupStatus && !!$xeTable.handlePivotTableAggData) {
|
|
6373
|
+
const rowGroupFields = $xeTable.computeRowGroupFields;
|
|
6374
|
+
if (rowGroupFields ? rowGroupFields.length : rowGroupList.length) {
|
|
6375
|
+
if (rowGroupFields && rowGroupFields.length) {
|
|
6376
|
+
$xeTable.setRowGroups(rowGroupFields);
|
|
6377
|
+
}
|
|
6378
|
+
else {
|
|
6379
|
+
$xeTable.clearRowGroups();
|
|
6380
|
+
}
|
|
6381
|
+
}
|
|
6382
|
+
else {
|
|
6383
|
+
$xeTable.handleUpdateAggData();
|
|
6384
|
+
}
|
|
6385
|
+
}
|
|
6386
|
+
});
|
|
6387
|
+
},
|
|
6388
|
+
/**
|
|
6389
|
+
* 用于 custom-config,用于获取自定义列设置信息,用于自定义保持
|
|
6390
|
+
* @returns
|
|
6391
|
+
*/
|
|
6252
6392
|
getCustomStoreData() {
|
|
6253
6393
|
const $xeTable = this;
|
|
6254
6394
|
const props = $xeTable;
|
|
@@ -6372,6 +6512,9 @@ const tableMethods = {
|
|
|
6372
6512
|
}
|
|
6373
6513
|
return storeData;
|
|
6374
6514
|
},
|
|
6515
|
+
/**
|
|
6516
|
+
* @private
|
|
6517
|
+
*/
|
|
6375
6518
|
saveCustomStore(type) {
|
|
6376
6519
|
const $xeTable = this;
|
|
6377
6520
|
const props = $xeTable;
|
|
@@ -6716,6 +6859,9 @@ const tableMethods = {
|
|
|
6716
6859
|
}
|
|
6717
6860
|
}
|
|
6718
6861
|
},
|
|
6862
|
+
/**
|
|
6863
|
+
* @private
|
|
6864
|
+
*/
|
|
6719
6865
|
handleRowResizeMousedownEvent(evnt, params) {
|
|
6720
6866
|
const $xeTable = this;
|
|
6721
6867
|
const props = $xeTable;
|
|
@@ -6836,6 +6982,9 @@ const tableMethods = {
|
|
|
6836
6982
|
};
|
|
6837
6983
|
updateEvent(evnt);
|
|
6838
6984
|
},
|
|
6985
|
+
/**
|
|
6986
|
+
* @private
|
|
6987
|
+
*/
|
|
6839
6988
|
handleRowResizeDblclickEvent(evnt, params) {
|
|
6840
6989
|
const $xeTable = this;
|
|
6841
6990
|
const reactData = $xeTable;
|
|
@@ -6857,7 +7006,7 @@ const tableMethods = {
|
|
|
6857
7006
|
}
|
|
6858
7007
|
const handleRsHeight = () => {
|
|
6859
7008
|
el.setAttribute('data-calc-row', 'Y');
|
|
6860
|
-
const resizeHeight = calcCellAutoHeight($xeTable, rowRest, el);
|
|
7009
|
+
const resizeHeight = calcCellAutoHeight($xeTable, rowid, rowRest, el);
|
|
6861
7010
|
el.removeAttribute('data-calc-row');
|
|
6862
7011
|
const resizeParams = Object.assign(Object.assign({}, params), { resizeHeight, resizeRow: row });
|
|
6863
7012
|
reactData.isDragResize = false;
|
|
@@ -6943,7 +7092,7 @@ const tableMethods = {
|
|
|
6943
7092
|
const rowid = XEUtils.isString(row) || XEUtils.isNumber(row) ? row : handleGetRowId(row);
|
|
6944
7093
|
const rowRest = fullAllDataRowIdData[rowid];
|
|
6945
7094
|
if (rowRest) {
|
|
6946
|
-
rowRest.resizeHeight = calcCellAutoHeight($xeTable, rowRest, el);
|
|
7095
|
+
rowRest.resizeHeight = calcCellAutoHeight($xeTable, rowid, rowRest, el);
|
|
6947
7096
|
}
|
|
6948
7097
|
el.removeAttribute('data-calc-row');
|
|
6949
7098
|
});
|