vxe-table 4.19.7 → 4.19.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.
Files changed (35) hide show
  1. package/dist/all.esm.js +384 -73
  2. package/dist/style.css +1 -1
  3. package/es/grid/src/grid.js +1 -1
  4. package/es/style.css +1 -1
  5. package/es/table/render/index.js +153 -14
  6. package/es/table/src/table.js +210 -56
  7. package/es/table/src/util.js +19 -1
  8. package/es/ui/index.js +1 -1
  9. package/es/ui/src/log.js +1 -1
  10. package/lib/grid/src/grid.js +1 -1
  11. package/lib/grid/src/grid.min.js +1 -1
  12. package/lib/index.umd.js +315 -31
  13. package/lib/index.umd.min.js +1 -1
  14. package/lib/style.css +1 -1
  15. package/lib/table/render/index.js +259 -15
  16. package/lib/table/render/index.min.js +1 -1
  17. package/lib/table/src/table.js +31 -12
  18. package/lib/table/src/table.min.js +1 -1
  19. package/lib/table/src/util.js +20 -1
  20. package/lib/table/src/util.min.js +1 -1
  21. package/lib/ui/index.js +1 -1
  22. package/lib/ui/index.min.js +1 -1
  23. package/lib/ui/src/log.js +1 -1
  24. package/lib/ui/src/log.min.js +1 -1
  25. package/package.json +2 -2
  26. package/packages/grid/src/grid.ts +1 -1
  27. package/packages/table/render/index.ts +156 -15
  28. package/packages/table/src/table.ts +217 -58
  29. package/packages/table/src/util.ts +23 -1
  30. /package/es/{iconfont.1780638747281.ttf → iconfont.1780878117167.ttf} +0 -0
  31. /package/es/{iconfont.1780638747281.woff → iconfont.1780878117167.woff} +0 -0
  32. /package/es/{iconfont.1780638747281.woff2 → iconfont.1780878117167.woff2} +0 -0
  33. /package/lib/{iconfont.1780638747281.ttf → iconfont.1780878117167.ttf} +0 -0
  34. /package/lib/{iconfont.1780638747281.woff → iconfont.1780878117167.woff} +0 -0
  35. /package/lib/{iconfont.1780638747281.woff2 → iconfont.1780878117167.woff2} +0 -0
@@ -778,7 +778,24 @@ renderer.mixin({
778
778
  renderTableEdit: nativeSelectEditRender,
779
779
  renderTableDefault: nativeSelectEditRender,
780
780
  renderTableCell(renderOpts, params) {
781
- return getCellLabelVNs(renderOpts, params, getSelectCellValue(renderOpts, params));
781
+ const { options, optionGroups } = renderOpts;
782
+ const { $table, row, column } = params;
783
+ const opSize = options ? options.length : null;
784
+ const ogSize = optionGroups ? optionGroups.length : null;
785
+ const { cellResult } = $table.effectCellData(row, column, {
786
+ key: 'render_table_cell',
787
+ isChanged({ oldValue, cellValue }) {
788
+ return oldValue && oldValue[0] === cellValue && oldValue[1] === opSize && oldValue[2] === ogSize;
789
+ },
790
+ setValue({ cellValue }) {
791
+ return [cellValue, opSize, ogSize];
792
+ },
793
+ getResult({ cellValue }) {
794
+ return handleSelectCellValue(cellValue, renderOpts);
795
+ }
796
+ });
797
+ // const cellResult = getSelectCellValue(renderOpts, params)
798
+ return getCellLabelVNs(renderOpts, params, cellResult);
782
799
  },
783
800
  createTableFilterOptions: defaultFilterOptions,
784
801
  renderTableFilter(renderOpts, params) {
@@ -889,15 +906,20 @@ renderer.mixin({
889
906
  tableAutoFocus: 'input',
890
907
  renderTableEdit: defaultEditRender,
891
908
  renderTableCell(renderOpts, params) {
892
- const { props = {} } = renderOpts;
893
- const { row, column } = params;
894
- let cellValue = XEUtils.get(row, column.field);
895
- if (cellValue) {
896
- if (props.type !== 'time') {
897
- cellValue = getLabelFormatDate(cellValue, props);
909
+ const props = renderOpts.props || {};
910
+ const { $table, row, column } = params;
911
+ const { cellResult } = $table.effectCellData(row, column, {
912
+ key: 'render_table_cell',
913
+ getResult({ cellValue }) {
914
+ if (cellValue) {
915
+ if (props.type !== 'time') {
916
+ return getLabelFormatDate(cellValue, props);
917
+ }
918
+ }
919
+ return cellValue;
898
920
  }
899
- }
900
- return getCellLabelVNs(renderOpts, params, cellValue);
921
+ });
922
+ return getCellLabelVNs(renderOpts, params, cellResult);
901
923
  },
902
924
  tableCellFormatter: handleFormatDatePicker,
903
925
  renderTableDefault: defaultEditRender,
@@ -945,6 +967,37 @@ renderer.mixin({
945
967
  }, seOs)))
946
968
  ];
947
969
  },
970
+ renderTableDefault(renderOpts, params) {
971
+ const { startField, endField } = renderOpts;
972
+ const { row, column } = params;
973
+ const { model } = column;
974
+ const cellValue = getCellValue(row, column);
975
+ const seProps = {};
976
+ const seOs = {};
977
+ if (startField && endField) {
978
+ seProps.startValue = XEUtils.get(row, startField);
979
+ seProps.endValue = XEUtils.get(row, endField);
980
+ seOs['onUpdate:startValue'] = (value) => {
981
+ if (startField) {
982
+ XEUtils.set(row, startField, value);
983
+ }
984
+ };
985
+ seOs['onUpdate:endValue'] = (value) => {
986
+ if (endField) {
987
+ XEUtils.set(row, endField, value);
988
+ }
989
+ };
990
+ }
991
+ return [
992
+ h(getDefaultComponent(renderOpts), Object.assign(Object.assign({}, getCellEditProps(renderOpts, params, cellValue, seProps)), getComponentOns(renderOpts, params, {
993
+ model(cellValue) {
994
+ model.update = true;
995
+ model.value = cellValue;
996
+ setCellValue(row, column, cellValue);
997
+ }
998
+ }, seOs)))
999
+ ];
1000
+ },
948
1001
  renderTableCell(renderOpts, params) {
949
1002
  const { startField, endField } = renderOpts;
950
1003
  const { row, column } = params;
@@ -977,6 +1030,7 @@ renderer.mixin({
977
1030
  },
978
1031
  VxeTextarea: {
979
1032
  tableAutoFocus: 'textarea',
1033
+ renderTableDefault: defaultEditRender,
980
1034
  renderTableEdit: defaultEditRender,
981
1035
  renderTableCell(renderOpts, params) {
982
1036
  const { row, column } = params;
@@ -1000,7 +1054,24 @@ renderer.mixin({
1000
1054
  renderTableEdit: defaultSelectEditRender,
1001
1055
  renderTableDefault: defaultSelectEditRender,
1002
1056
  renderTableCell(renderOpts, params) {
1003
- return getCellLabelVNs(renderOpts, params, getSelectCellValue(renderOpts, params));
1057
+ const { options, optionGroups } = renderOpts;
1058
+ const { $table, row, column } = params;
1059
+ const opSize = options ? options.length : null;
1060
+ const ogSize = optionGroups ? optionGroups.length : null;
1061
+ const { cellResult } = $table.effectCellData(row, column, {
1062
+ key: 'render_table_cell',
1063
+ isChanged({ oldValue, cellValue }) {
1064
+ return oldValue && oldValue[0] === cellValue && oldValue[1] === opSize && oldValue[2] === ogSize;
1065
+ },
1066
+ setValue({ cellValue }) {
1067
+ return [cellValue, opSize, ogSize];
1068
+ },
1069
+ getResult({ cellValue }) {
1070
+ return handleSelectCellValue(cellValue, renderOpts);
1071
+ }
1072
+ });
1073
+ // const cellResult = getSelectCellValue(renderOpts, params)
1074
+ return getCellLabelVNs(renderOpts, params, cellResult);
1004
1075
  },
1005
1076
  createTableFilterOptions: defaultFilterOptions,
1006
1077
  renderTableFilter(renderOpts, params) {
@@ -1055,7 +1126,24 @@ renderer.mixin({
1055
1126
  },
1056
1127
  FormatSelect: {
1057
1128
  renderTableDefault(renderOpts, params) {
1058
- return getCellLabelVNs(renderOpts, params, getSelectCellValue(renderOpts, params));
1129
+ const { options, optionGroups } = renderOpts;
1130
+ const { $table, row, column } = params;
1131
+ const opSize = options ? options.length : null;
1132
+ const ogSize = optionGroups ? optionGroups.length : null;
1133
+ const { cellResult } = $table.effectCellData(row, column, {
1134
+ key: 'render_table_cell',
1135
+ isChanged({ oldValue, cellValue }) {
1136
+ return oldValue && oldValue[0] === cellValue && oldValue[1] === opSize && oldValue[2] === ogSize;
1137
+ },
1138
+ setValue({ cellValue }) {
1139
+ return [cellValue, opSize, ogSize];
1140
+ },
1141
+ getResult({ cellValue }) {
1142
+ return handleSelectCellValue(cellValue, renderOpts);
1143
+ }
1144
+ });
1145
+ // const cellResult = getSelectCellValue(renderOpts, params)
1146
+ return getCellLabelVNs(renderOpts, params, cellResult);
1059
1147
  },
1060
1148
  tableCellFormatter: handleFormatSelect,
1061
1149
  tableCellCopyMethod: handleFormatSelect,
@@ -1067,7 +1155,24 @@ renderer.mixin({
1067
1155
  tableAutoFocus: 'input',
1068
1156
  renderTableEdit: defaultTableOrTreeSelectEditRender,
1069
1157
  renderTableCell(renderOpts, params) {
1070
- return getCellLabelVNs(renderOpts, params, getTreeSelectCellValue(renderOpts, params));
1158
+ const { options, optionGroups } = renderOpts;
1159
+ const { $table, row, column } = params;
1160
+ const opSize = options ? options.length : null;
1161
+ const ogSize = optionGroups ? optionGroups.length : null;
1162
+ const { cellResult } = $table.effectCellData(row, column, {
1163
+ key: 'render_table_cell',
1164
+ isChanged({ oldValue, cellValue }) {
1165
+ return oldValue && oldValue[0] === cellValue && oldValue[1] === opSize && oldValue[2] === ogSize;
1166
+ },
1167
+ setValue({ cellValue }) {
1168
+ return [cellValue, opSize, ogSize];
1169
+ },
1170
+ getResult({ cellValue }) {
1171
+ return handleTreeSelectCellValue(cellValue, renderOpts);
1172
+ }
1173
+ });
1174
+ // const cellResult = getTreeSelectCellValue(renderOpts, params)
1175
+ return getCellLabelVNs(renderOpts, params, cellResult);
1071
1176
  },
1072
1177
  tableCellFormatter: handleFormatTreeSelect,
1073
1178
  tableCellCopyMethod: handleFormatTreeSelect,
@@ -1085,7 +1190,24 @@ renderer.mixin({
1085
1190
  },
1086
1191
  FormatTreeSelect: {
1087
1192
  renderTableDefault(renderOpts, params) {
1088
- return getCellLabelVNs(renderOpts, params, getTreeSelectCellValue(renderOpts, params));
1193
+ const { options, optionGroups } = renderOpts;
1194
+ const { $table, row, column } = params;
1195
+ const opSize = options ? options.length : null;
1196
+ const ogSize = optionGroups ? optionGroups.length : null;
1197
+ const { cellResult } = $table.effectCellData(row, column, {
1198
+ key: 'render_table_cell',
1199
+ isChanged({ oldValue, cellValue }) {
1200
+ return oldValue && oldValue[0] === cellValue && oldValue[1] === opSize && oldValue[2] === ogSize;
1201
+ },
1202
+ setValue({ cellValue }) {
1203
+ return [cellValue, opSize, ogSize];
1204
+ },
1205
+ getResult({ cellValue }) {
1206
+ return handleTreeSelectCellValue(cellValue, renderOpts);
1207
+ }
1208
+ });
1209
+ // const cellResult = getTreeSelectCellValue(renderOpts, params)
1210
+ return getCellLabelVNs(renderOpts, params, cellResult);
1089
1211
  },
1090
1212
  tableCellFormatter: handleFormatTreeSelect,
1091
1213
  tableCellCopyMethod: handleFormatTreeSelect,
@@ -1096,7 +1218,24 @@ renderer.mixin({
1096
1218
  tableAutoFocus: 'input',
1097
1219
  renderTableEdit: defaultTableOrTreeSelectEditRender,
1098
1220
  renderTableCell(renderOpts, params) {
1099
- return getCellLabelVNs(renderOpts, params, getTreeSelectCellValue(renderOpts, params));
1221
+ const { options, optionGroups } = renderOpts;
1222
+ const { $table, row, column } = params;
1223
+ const opSize = options ? options.length : null;
1224
+ const ogSize = optionGroups ? optionGroups.length : null;
1225
+ const { cellResult } = $table.effectCellData(row, column, {
1226
+ key: 'render_table_cell',
1227
+ isChanged({ oldValue, cellValue }) {
1228
+ return oldValue && oldValue[0] === cellValue && oldValue[1] === opSize && oldValue[2] === ogSize;
1229
+ },
1230
+ setValue({ cellValue }) {
1231
+ return [cellValue, opSize, ogSize];
1232
+ },
1233
+ getResult({ cellValue }) {
1234
+ return handleTreeSelectCellValue(cellValue, renderOpts);
1235
+ }
1236
+ });
1237
+ // const cellResult = getTreeSelectCellValue(renderOpts, params)
1238
+ return getCellLabelVNs(renderOpts, params, cellResult);
1100
1239
  },
1101
1240
  tableCellFormatter: handleFormatTreeSelect,
1102
1241
  tableCellCopyMethod: handleFormatTreeSelect,
@@ -4,7 +4,7 @@ import XEUtils from 'xe-utils';
4
4
  import { initTpImg, getTpImg, isPx, isScale, hasClass, addClass, removeClass, wheelScrollTopTo, wheelScrollLeftTo, getEventTargetNode, getPaddingTopBottomSize, setScrollTop, setScrollLeft, toCssUnit, hasControlKey, checkTargetElement, hasEventInputTarget } from '../../ui/src/dom';
5
5
  import { getLastZIndex, nextZIndex, hasChildrenList, getFuncText, isEnableConf, formatText, eqEmptyValue } from '../../ui/src/utils';
6
6
  import { VxeUI } from '../../ui';
7
- import { createReactData, createInternalData, getRowUniqueId, createRowId, clearTableAllStatus, getColumnList, toFilters, hasDeepKey, getRowkey, getRowid, rowToVisible, colToVisible, getCellValue, setCellValue, handleRowidOrRow, handleFieldOrColumn, toTreePathSeq, restoreScrollLocation, getRootColumn, getRefElem, getColReMinWidth, getColReMaxWidth, createHandleUpdateRowId, createHandleGetRowId, getCalcHeight, getCellRestHeight, getLastChildColumn } from './util';
7
+ import { createReactData, createInternalData, getRowUniqueId, createRowId, clearTableAllStatus, getColumnList, toFilters, hasDeepKey, getRowkey, getRowid, rowToVisible, colToVisible, getCellValue, setCellValue, handleRowidOrRow, handleFieldOrColumn, toTreePathSeq, restoreScrollLocation, getRootColumn, getRefElem, getColReMinWidth, getColReMaxWidth, createHandleUpdateRowId, createHandleGetRowId, getCalcHeight, getCellRestHeight, getLastChildColumn, getRowMaxHeight } from './util';
8
8
  import { getSlotVNs } from '../../ui/src/vn';
9
9
  import { moveRowAnimateToTb, clearRowAnimate, moveColAnimateToLr, clearColAnimate } from '../../ui/src/anime';
10
10
  import { warnLog, errLog } from '../../ui/src/log';
@@ -1962,34 +1962,38 @@ export default defineVxeComponent({
1962
1962
  /**
1963
1963
  * 计算自适应行高
1964
1964
  */
1965
- const calcCellAutoHeight = (rowRest, wrapperEl) => {
1966
- const { scrollXLoad } = reactData;
1965
+ const calcCellAutoHeight = (rowid, rowRest, wrapperEl) => {
1966
+ const { fullCellHeightMaps } = internalData;
1967
+ let chRest = fullCellHeightMaps[rowid];
1968
+ if (!chRest) {
1969
+ chRest = {};
1970
+ fullCellHeightMaps[rowid] = chRest;
1971
+ }
1967
1972
  const wrapperElemList = wrapperEl.querySelectorAll(`.vxe-cell--wrapper[rowid="${rowRest.rowid}"]`);
1968
- let colHeight = 0;
1969
1973
  let firstCellStyle = null;
1970
1974
  let topBottomPadding = 0;
1975
+ let changeCH = false;
1971
1976
  for (let i = 0; i < wrapperElemList.length; i++) {
1972
1977
  const wrapperElem = wrapperElemList[i];
1973
1978
  const cellElem = wrapperElem.parentElement;
1974
1979
  const cellStyle = cellElem.style;
1975
1980
  const orHeight = cellStyle.height;
1976
- if (!scrollXLoad) {
1977
- cellStyle.height = '';
1978
- }
1981
+ const colid = wrapperElem.getAttribute('colid') || '';
1982
+ cellStyle.height = '';
1979
1983
  if (!firstCellStyle) {
1980
1984
  firstCellStyle = getComputedStyle(cellElem);
1981
1985
  topBottomPadding = firstCellStyle ? Math.ceil(XEUtils.toNumber(firstCellStyle.paddingTop) + XEUtils.toNumber(firstCellStyle.paddingBottom)) : 0;
1982
1986
  }
1983
- if (!scrollXLoad) {
1984
- cellStyle.height = orHeight;
1985
- }
1986
1987
  const cellHeight = wrapperElem ? wrapperElem.clientHeight : 0;
1987
- colHeight = Math.max(colHeight, Math.ceil(cellHeight + topBottomPadding));
1988
- }
1989
- if (scrollXLoad) {
1990
- colHeight = Math.max(colHeight, rowRest.height);
1988
+ const colHeight = Math.ceil(cellHeight + topBottomPadding);
1989
+ if (chRest[colid] !== colHeight) {
1990
+ changeCH = true;
1991
+ chRest[colid] = colHeight;
1992
+ }
1993
+ cellStyle.height = orHeight;
1991
1994
  }
1992
- return colHeight;
1995
+ const cellMaxHeight = getRowMaxHeight(chRest, changeCH);
1996
+ return cellMaxHeight;
1993
1997
  };
1994
1998
  /**
1995
1999
  * 自适应行高
@@ -2011,7 +2015,7 @@ export default defineVxeComponent({
2011
2015
  const rowid = handleGetRowId(row);
2012
2016
  const rowRest = fullAllDataRowIdData[rowid];
2013
2017
  if (rowRest) {
2014
- const reHeight = calcCellAutoHeight(rowRest, el);
2018
+ const reHeight = calcCellAutoHeight(rowid, rowRest, el);
2015
2019
  rowRest.height = Math.max(defaultRowHeight, reHeight);
2016
2020
  }
2017
2021
  el.removeAttribute('data-calc-row');
@@ -3281,7 +3285,6 @@ export default defineVxeComponent({
3281
3285
  };
3282
3286
  const handleRecalculateStyle = (reFull, reWidth, reHeight) => {
3283
3287
  const el = refElem.value;
3284
- internalData.rceRunTime = Date.now();
3285
3288
  if (!el || !el.clientWidth) {
3286
3289
  return nextTick();
3287
3290
  }
@@ -3305,6 +3308,7 @@ export default defineVxeComponent({
3305
3308
  if (reFull) {
3306
3309
  updateTreeLineStyle();
3307
3310
  }
3311
+ internalData.rceRunTime = Date.now();
3308
3312
  return computeScrollLoad().then(() => {
3309
3313
  // 初始化时需要在列计算之后再执行优化运算,达到最优显示效果
3310
3314
  if (reWidth) {
@@ -3325,18 +3329,30 @@ export default defineVxeComponent({
3325
3329
  if (reFull) {
3326
3330
  updateTreeLineStyle();
3327
3331
  }
3332
+ internalData.rceRunTime = Date.now();
3328
3333
  if (reFull) {
3329
3334
  return computeScrollLoad();
3330
3335
  }
3331
3336
  });
3332
3337
  };
3338
+ const minRunDelay = 50;
3333
3339
  const handleLazyRecalculate = (reFull, reWidth, reHeight) => {
3334
3340
  return new Promise(resolve => {
3335
3341
  const $xeGanttView = internalData.xeGanttView;
3336
3342
  const { customStore } = reactData;
3337
3343
  const { rceTimeout, rceRunTime } = internalData;
3338
3344
  const resizeOpts = computeResizeOpts.value;
3339
- const refreshDelay = resizeOpts.refreshDelay || 20;
3345
+ let rceDelay = internalData.rceDelay;
3346
+ // 如果在500毫秒内频繁执行,则执行次数减缓
3347
+ if (rceRunTime && rceRunTime > Date.now() - 500) {
3348
+ rceDelay += 50;
3349
+ }
3350
+ else {
3351
+ rceDelay = 0;
3352
+ }
3353
+ internalData.rceDelay = rceDelay;
3354
+ const refreshDelay = resizeOpts.refreshDelay || 30;
3355
+ const reDelay = rceDelay + refreshDelay;
3340
3356
  const el = refElem.value;
3341
3357
  if (el && el.clientWidth) {
3342
3358
  autoCellWidth();
@@ -3347,7 +3363,7 @@ export default defineVxeComponent({
3347
3363
  }
3348
3364
  if (rceTimeout) {
3349
3365
  clearTimeout(rceTimeout);
3350
- if (rceRunTime && rceRunTime + (refreshDelay - 5) < Date.now()) {
3366
+ if (rceRunTime && rceRunTime + minRunDelay < Date.now()) {
3351
3367
  resolve(handleRecalculateStyle(reFull, reWidth, reHeight));
3352
3368
  }
3353
3369
  else {
@@ -3365,11 +3381,23 @@ export default defineVxeComponent({
3365
3381
  internalData.rceTimeout = setTimeout(() => {
3366
3382
  internalData.rceTimeout = undefined;
3367
3383
  handleRecalculateStyle(reFull, reWidth, reHeight);
3368
- }, refreshDelay);
3384
+ if ($xeGanttView && $xeGanttView.handleLazyRecalculate) {
3385
+ $xeGanttView.handleLazyRecalculate();
3386
+ }
3387
+ }, reDelay);
3369
3388
  });
3370
3389
  };
3390
+ let resizePending = false;
3371
3391
  const handleResizeEvent = () => {
3372
- handleLazyRecalculate(true, true, true);
3392
+ if (resizePending) {
3393
+ return;
3394
+ }
3395
+ resizePending = true;
3396
+ handleLazyRecalculate(true, true, true).then(() => {
3397
+ resizePending = false;
3398
+ }).catch(() => {
3399
+ resizePending = false;
3400
+ });
3373
3401
  };
3374
3402
  const handleUpdateAggValues = () => {
3375
3403
  const { visibleColumn } = internalData;
@@ -3713,6 +3741,8 @@ export default defineVxeComponent({
3713
3741
  reactData.insertRowFlag++;
3714
3742
  internalData.removeRowMaps = {};
3715
3743
  reactData.removeRowFlag++;
3744
+ internalData.fullCellHeightMaps = {};
3745
+ internalData.fullCellStoreMaps = {};
3716
3746
  const sYLoad = updateScrollYStatus(fullData);
3717
3747
  // 全量数据
3718
3748
  internalData.tableFullData = fullData;
@@ -4073,8 +4103,42 @@ export default defineVxeComponent({
4073
4103
  internalData.fullColumnIdData = fullColIdData;
4074
4104
  internalData.fullColumnFieldData = fullColFieldData;
4075
4105
  };
4076
- const handleInitColumn = (collectColumn) => {
4106
+ const buildColumnInfo = () => {
4107
+ const { scrollXLoad, scrollYLoad, expandColumn } = reactData;
4077
4108
  const expandOpts = computeExpandOpts.value;
4109
+ cacheColumnMap();
4110
+ parseColumns(true).then(() => {
4111
+ if (reactData.scrollXLoad) {
4112
+ loadScrollXData();
4113
+ }
4114
+ });
4115
+ $xeTable.clearHeaderFormatterCache();
4116
+ $xeTable.clearMergeCells();
4117
+ $xeTable.clearMergeFooterItems();
4118
+ $xeTable.handleTableData(true);
4119
+ $xeTable.handleAggregateSummaryData();
4120
+ if ((scrollXLoad || scrollYLoad) && (expandColumn && expandOpts.mode !== 'fixed')) {
4121
+ warnLog('vxe.error.scrollErrProp', ['column.type=expand']);
4122
+ }
4123
+ return nextTick().then(() => {
4124
+ if ($xeToolbar) {
4125
+ $xeToolbar.syncUpdate({
4126
+ collectColumn: internalData.collectColumn,
4127
+ $table: $xeTable
4128
+ });
4129
+ }
4130
+ if ($xeTable.handleUpdateCustomColumn) {
4131
+ $xeTable.handleUpdateCustomColumn();
4132
+ }
4133
+ const columnOpts = computeColumnOpts.value;
4134
+ if (props.showCustomHeader && reactData.isGroup && (columnOpts.resizable || props.resizable)) {
4135
+ warnLog('vxe.error.notConflictProp', ['show-custom-header & colgroup', 'column-config.resizable=false']);
4136
+ }
4137
+ reactData.isColLoading = false;
4138
+ return handleLazyRecalculate(false, true, true);
4139
+ });
4140
+ };
4141
+ const handleInitColumn = (collectColumn) => {
4078
4142
  internalData.collectColumn = collectColumn;
4079
4143
  const tFullColumn = getColumnList(collectColumn);
4080
4144
  internalData.tableFullColumn = tFullColumn;
@@ -4082,38 +4146,7 @@ export default defineVxeComponent({
4082
4146
  reactData.isColLoading = true;
4083
4147
  initColumnHierarchy();
4084
4148
  return Promise.resolve(restoreCustomStorage()).then(() => {
4085
- const { scrollXLoad, scrollYLoad, expandColumn } = reactData;
4086
- cacheColumnMap();
4087
- parseColumns(true).then(() => {
4088
- if (reactData.scrollXLoad) {
4089
- loadScrollXData();
4090
- }
4091
- });
4092
- $xeTable.clearHeaderFormatterCache();
4093
- $xeTable.clearMergeCells();
4094
- $xeTable.clearMergeFooterItems();
4095
- $xeTable.handleTableData(true);
4096
- $xeTable.handleAggregateSummaryData();
4097
- if ((scrollXLoad || scrollYLoad) && (expandColumn && expandOpts.mode !== 'fixed')) {
4098
- warnLog('vxe.error.scrollErrProp', ['column.type=expand']);
4099
- }
4100
- return nextTick().then(() => {
4101
- if ($xeToolbar) {
4102
- $xeToolbar.syncUpdate({
4103
- collectColumn: internalData.collectColumn,
4104
- $table: $xeTable
4105
- });
4106
- }
4107
- if ($xeTable.handleUpdateCustomColumn) {
4108
- $xeTable.handleUpdateCustomColumn();
4109
- }
4110
- const columnOpts = computeColumnOpts.value;
4111
- if (props.showCustomHeader && reactData.isGroup && (columnOpts.resizable || props.resizable)) {
4112
- warnLog('vxe.error.notConflictProp', ['show-custom-header & colgroup', 'column-config.resizable=false']);
4113
- }
4114
- reactData.isColLoading = false;
4115
- return handleLazyRecalculate(false, true, true);
4116
- });
4149
+ return buildColumnInfo();
4117
4150
  });
4118
4151
  };
4119
4152
  const updateScrollXStatus = (fullColumn) => {
@@ -5202,6 +5235,56 @@ export default defineVxeComponent({
5202
5235
  }
5203
5236
  return nextTick();
5204
5237
  },
5238
+ effectCellData(row, column, options) {
5239
+ const { fullCellStoreMaps } = internalData;
5240
+ const editOpts = computeEditOpts.value;
5241
+ const { key, isChanged, setValue, getResult } = options;
5242
+ const rowid = getRowid($xeTable, row);
5243
+ const colid = column.id;
5244
+ let rowStore = fullCellStoreMaps[rowid];
5245
+ const cellValue = XEUtils.get(row, column.field);
5246
+ const restParams = {
5247
+ $table: $xeTable,
5248
+ row,
5249
+ rowid,
5250
+ column,
5251
+ colid,
5252
+ cellValue,
5253
+ oldValue: null
5254
+ };
5255
+ if (editOpts.cache === false && key === 'render_table_cell') {
5256
+ const rest = restParams;
5257
+ rest.cellResult = getResult ? getResult(restParams) : cellValue;
5258
+ return rest;
5259
+ }
5260
+ if (!rowStore) {
5261
+ rowStore = {};
5262
+ fullCellStoreMaps[rowid] = rowStore;
5263
+ }
5264
+ let cellStore = rowStore[colid];
5265
+ if (!cellStore) {
5266
+ cellStore = {
5267
+ value: undefined,
5268
+ result: {}
5269
+ };
5270
+ rowStore[colid] = cellStore;
5271
+ }
5272
+ const restData = rowStore[colid];
5273
+ const oldValue = restData.value;
5274
+ restParams.oldValue = oldValue;
5275
+ if (isChanged ? !isChanged(restParams) : oldValue !== cellValue) {
5276
+ restData.value = setValue ? setValue(restParams) : cellValue;
5277
+ restData.result = {};
5278
+ }
5279
+ const storeData = restData.result;
5280
+ if (XEUtils.isUndefined(storeData[key])) {
5281
+ storeData[key] = getResult ? getResult(restParams) : cellValue;
5282
+ }
5283
+ const cellResult = storeData[key];
5284
+ const rest = restParams;
5285
+ rest.cellResult = cellResult;
5286
+ return rest;
5287
+ },
5205
5288
  getCellElement(row, fieldOrColumn) {
5206
5289
  const { elemStore } = internalData;
5207
5290
  const column = handleFieldOrColumn($xeTable, fieldOrColumn);
@@ -6054,7 +6137,7 @@ export default defineVxeComponent({
6054
6137
  const rowid = XEUtils.isString(row) || XEUtils.isNumber(row) ? row : handleGetRowId(row);
6055
6138
  const rowRest = fullAllDataRowIdData[rowid];
6056
6139
  if (rowRest) {
6057
- rowRest.resizeHeight = calcCellAutoHeight(rowRest, el);
6140
+ rowRest.resizeHeight = calcCellAutoHeight(rowid, rowRest, el);
6058
6141
  }
6059
6142
  el.removeAttribute('data-calc-row');
6060
6143
  });
@@ -7808,6 +7891,65 @@ export default defineVxeComponent({
7808
7891
  clearHistory() {
7809
7892
  return $xeTable.handleClearStack();
7810
7893
  },
7894
+ /**
7895
+ * 用于 custom-config,用于手动恢复自定义列设置信息,恢复表格重置为初始状态
7896
+ * @param storeData
7897
+ * @returns
7898
+ */
7899
+ setCustomStoreData(storeData) {
7900
+ if (!storeData) {
7901
+ return nextTick();
7902
+ }
7903
+ const customOpts = computeCustomOpts.value;
7904
+ const { checkMethod } = customOpts;
7905
+ // 重置状态
7906
+ clearTableAllStatus($xeTable);
7907
+ // 恢复列
7908
+ const allCols = [];
7909
+ XEUtils.eachTree(internalData.collectColumn, (column) => {
7910
+ column.resizeWidth = 0;
7911
+ column.fixed = column.defaultFixed;
7912
+ column.renderSortNumber = column.sortNumber;
7913
+ column.parentId = column.defaultParentId;
7914
+ if (!checkMethod || checkMethod({ $table: $xeTable, column })) {
7915
+ column.visible = column.defaultVisible;
7916
+ }
7917
+ column.aggFunc = column.defaultAggFunc;
7918
+ column.renderAggFn = column.defaultAggFunc;
7919
+ column.renderResizeWidth = column.renderWidth;
7920
+ allCols.push(column);
7921
+ });
7922
+ const newCollectCols = XEUtils.toArrayTree(XEUtils.orderBy(allCols, 'renderSortNumber'), { key: 'id', parentKey: 'parentId', children: 'children' });
7923
+ internalData.collectColumn = newCollectCols;
7924
+ internalData.tableFullColumn = getColumnList(newCollectCols);
7925
+ reactData.updateColFlag++;
7926
+ reactData.isColLoading = true;
7927
+ initColumnHierarchy();
7928
+ return Promise.resolve(handleCustomRestore(storeData)).then(() => {
7929
+ return buildColumnInfo();
7930
+ }).then(() => {
7931
+ // 恢复数据聚合分组
7932
+ const { isRowGroupStatus, rowGroupList } = reactData;
7933
+ if (isRowGroupStatus && !!$xeTable.handlePivotTableAggData) {
7934
+ const rowGroupFields = computeRowGroupFields.value;
7935
+ if (rowGroupFields ? rowGroupFields.length : rowGroupList.length) {
7936
+ if (rowGroupFields && rowGroupFields.length) {
7937
+ $xeTable.setRowGroups(rowGroupFields);
7938
+ }
7939
+ else {
7940
+ $xeTable.clearRowGroups();
7941
+ }
7942
+ }
7943
+ else {
7944
+ $xeTable.handleUpdateAggData();
7945
+ }
7946
+ }
7947
+ });
7948
+ },
7949
+ /**
7950
+ * 用于 custom-config,用于获取自定义列设置信息,用于自定义保持
7951
+ * @returns
7952
+ */
7811
7953
  getCustomStoreData() {
7812
7954
  const { id } = props;
7813
7955
  const customOpts = computeCustomOpts.value;
@@ -9587,6 +9729,9 @@ export default defineVxeComponent({
9587
9729
  }
9588
9730
  }
9589
9731
  },
9732
+ /**
9733
+ * @private
9734
+ */
9590
9735
  handleRowResizeMousedownEvent(evnt, params) {
9591
9736
  evnt.stopPropagation();
9592
9737
  evnt.preventDefault();
@@ -9703,6 +9848,9 @@ export default defineVxeComponent({
9703
9848
  };
9704
9849
  updateEvent(evnt);
9705
9850
  },
9851
+ /**
9852
+ * @private
9853
+ */
9706
9854
  handleRowResizeDblclickEvent(evnt, params) {
9707
9855
  const resizableOpts = computeResizableOpts.value;
9708
9856
  const { isDblclickAutoHeight } = resizableOpts;
@@ -9721,7 +9869,7 @@ export default defineVxeComponent({
9721
9869
  }
9722
9870
  const handleRsHeight = () => {
9723
9871
  el.setAttribute('data-calc-row', 'Y');
9724
- const resizeHeight = calcCellAutoHeight(rowRest, el);
9872
+ const resizeHeight = calcCellAutoHeight(rowid, rowRest, el);
9725
9873
  el.removeAttribute('data-calc-row');
9726
9874
  const resizeParams = Object.assign(Object.assign({}, params), { resizeHeight, resizeRow: row });
9727
9875
  reactData.isDragResize = false;
@@ -9742,6 +9890,9 @@ export default defineVxeComponent({
9742
9890
  }
9743
9891
  }
9744
9892
  },
9893
+ /**
9894
+ * @private
9895
+ */
9745
9896
  saveCustomStore(type) {
9746
9897
  const { customConfig } = props;
9747
9898
  const tableId = computeTableId.value;
@@ -9788,6 +9939,9 @@ export default defineVxeComponent({
9788
9939
  }
9789
9940
  return nextTick();
9790
9941
  },
9942
+ /**
9943
+ * @private
9944
+ */
9791
9945
  handleCustom() {
9792
9946
  const { mouseConfig } = props;
9793
9947
  if (mouseConfig) {