vxe-table 4.7.10 → 4.7.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.umd.js CHANGED
@@ -1791,8 +1791,8 @@ var external_root_VxeUI_commonjs_vxe_pc_ui_commonjs2_vxe_pc_ui_amd_vxe_pc_ui_ =
1791
1791
  var external_root_VxeUI_commonjs_vxe_pc_ui_commonjs2_vxe_pc_ui_amd_vxe_pc_ui_default = /*#__PURE__*/__webpack_require__.n(external_root_VxeUI_commonjs_vxe_pc_ui_commonjs2_vxe_pc_ui_amd_vxe_pc_ui_);
1792
1792
  ;// CONCATENATED MODULE: ./packages/ui/index.ts
1793
1793
 
1794
- external_root_VxeUI_commonjs_vxe_pc_ui_commonjs2_vxe_pc_ui_amd_vxe_pc_ui_.VxeUI.version = "4.7.10";
1795
- external_root_VxeUI_commonjs_vxe_pc_ui_commonjs2_vxe_pc_ui_amd_vxe_pc_ui_.VxeUI.tableVersion = "4.7.10";
1794
+ external_root_VxeUI_commonjs_vxe_pc_ui_commonjs2_vxe_pc_ui_amd_vxe_pc_ui_.VxeUI.version = "4.7.12";
1795
+ external_root_VxeUI_commonjs_vxe_pc_ui_commonjs2_vxe_pc_ui_amd_vxe_pc_ui_.VxeUI.tableVersion = "4.7.12";
1796
1796
  external_root_VxeUI_commonjs_vxe_pc_ui_commonjs2_vxe_pc_ui_amd_vxe_pc_ui_.VxeUI.setConfig({
1797
1797
  emptyCell: ' ',
1798
1798
  table: {
@@ -2241,7 +2241,7 @@ function eqEmptyValue(cellValue) {
2241
2241
  const {
2242
2242
  log: log_log
2243
2243
  } = external_root_VxeUI_commonjs_vxe_pc_ui_commonjs2_vxe_pc_ui_amd_vxe_pc_ui_.VxeUI;
2244
- const version = `table v${"4.7.10"}`;
2244
+ const version = `table v${"4.7.12"}`;
2245
2245
  const warnLog = log_log.create('warn', version);
2246
2246
  const errLog = log_log.create('error', version);
2247
2247
  ;// CONCATENATED MODULE: ./packages/table/src/columnInfo.ts
@@ -5542,7 +5542,7 @@ const header_renderType = 'header';
5542
5542
  tableInternalData._lastResizeTime = Date.now();
5543
5543
  $xeTable.analyColumnWidth();
5544
5544
  $xeTable.recalculate(true).then(() => {
5545
- $xeTable.saveCustomResizable();
5545
+ $xeTable.saveCustomStore('update:visible');
5546
5546
  $xeTable.updateCellAreas();
5547
5547
  $xeTable.dispatchEvent('resizable-change', {
5548
5548
  ...params,
@@ -6418,7 +6418,6 @@ const {
6418
6418
  setup(props) {
6419
6419
  const $xeTable = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.inject)('$xeTable', {});
6420
6420
  const {
6421
- props: tableProps,
6422
6421
  reactData
6423
6422
  } = $xeTable;
6424
6423
  const {
@@ -6449,23 +6448,6 @@ const {
6449
6448
  }
6450
6449
  }, 300);
6451
6450
  };
6452
- const handleSaveStore = type => {
6453
- const {
6454
- id
6455
- } = tableProps;
6456
- const customOpts = computeCustomOpts.value;
6457
- const {
6458
- storage,
6459
- updateStore
6460
- } = customOpts;
6461
- if (storage && id && updateStore) {
6462
- updateStore({
6463
- id,
6464
- type,
6465
- storeData: $xeTable.getCustomStoreData()
6466
- });
6467
- }
6468
- };
6469
6451
  const confirmCustomEvent = evnt => {
6470
6452
  const {
6471
6453
  customColumnList
@@ -6491,6 +6473,7 @@ const {
6491
6473
  if (column.renderVisible && (!column.children || column.children.length)) {
6492
6474
  if (column.renderResizeWidth !== column.renderWidth) {
6493
6475
  column.resizeWidth = column.renderResizeWidth;
6476
+ column.renderWidth = column.renderResizeWidth;
6494
6477
  }
6495
6478
  }
6496
6479
  }
@@ -6500,7 +6483,7 @@ const {
6500
6483
  });
6501
6484
  $xeTable.closeCustom();
6502
6485
  $xeTable.emitCustomEvent('confirm', evnt);
6503
- handleSaveStore('confirm');
6486
+ $xeTable.saveCustomStore('confirm');
6504
6487
  };
6505
6488
  const cancelCustomEvent = evnt => {
6506
6489
  const {
@@ -6549,7 +6532,6 @@ const {
6549
6532
  $xeTable.resetColumn(true);
6550
6533
  $xeTable.closeCustom();
6551
6534
  $xeTable.emitCustomEvent('reset', evnt);
6552
- handleSaveStore('reset');
6553
6535
  };
6554
6536
  const resetCustomEvent = evnt => {
6555
6537
  if (external_root_VxeUI_commonjs_vxe_pc_ui_commonjs2_vxe_pc_ui_amd_vxe_pc_ui_.VxeUI.modal) {
@@ -6592,6 +6574,7 @@ const {
6592
6574
  handleOptionCheck(column);
6593
6575
  if (customOpts.immediate) {
6594
6576
  $xeTable.handleCustom();
6577
+ $xeTable.saveCustomStore('update:visible');
6595
6578
  }
6596
6579
  $xeTable.checkCustomStatus();
6597
6580
  };
@@ -6897,6 +6880,7 @@ const {
6897
6880
  } = reactData;
6898
6881
  const customOpts = computeCustomOpts.value;
6899
6882
  const {
6883
+ modalOptions,
6900
6884
  allowVisible,
6901
6885
  allowSort,
6902
6886
  allowFixed,
@@ -6905,6 +6889,7 @@ const {
6905
6889
  visibleMethod
6906
6890
  } = customOpts;
6907
6891
  const columnOpts = computeColumnOpts.value;
6892
+ const modalOpts = Object.assign({}, modalOptions);
6908
6893
  const isMaxFixedColumn = computeIsMaxFixedColumn.value;
6909
6894
  const trVNs = [];
6910
6895
  external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(customColumnList, (column, index, items, path, parent) => {
@@ -6998,13 +6983,13 @@ const {
6998
6983
  const isAllIndeterminate = customStore.isIndeterminate;
6999
6984
  return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)((0,external_commonjs_vue_commonjs2_vue_root_Vue_.resolveComponent)('vxe-modal'), {
7000
6985
  key: 'popup',
7001
- className: 'vxe-table-custom-popup-wrapper vxe-table--ignore-clear',
6986
+ className: ['vxe-table-custom-popup-wrapper', 'vxe-table--ignore-clear', modalOpts.className || ''].join(' '),
7002
6987
  modelValue: customStore.visible,
7003
- title: panel_getI18n('vxe.custom.cstmTitle'),
7004
- width: 700,
7005
- minWidth: 700,
7006
- height: 400,
7007
- minHeight: 400,
6988
+ title: modalOpts.title || panel_getI18n('vxe.custom.cstmTitle'),
6989
+ width: modalOpts.width || '50vw',
6990
+ minWidth: modalOpts.minWidth || 700,
6991
+ height: modalOpts.height || '50vh',
6992
+ minHeight: modalOpts.minHeight || 400,
7008
6993
  mask: true,
7009
6994
  lockView: true,
7010
6995
  showFooter: true,
@@ -8024,10 +8009,7 @@ const {
8024
8009
  useFns
8025
8010
  } = external_root_VxeUI_commonjs_vxe_pc_ui_commonjs2_vxe_pc_ui_amd_vxe_pc_ui_.VxeUI;
8026
8011
  const isWebkit = browse['-webkit'] && !browse.edge;
8027
- const resizableStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_WIDTH';
8028
- const visibleStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_VISIBLE';
8029
- const fixedStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_FIXED';
8030
- const sortStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_SORT';
8012
+ const customStorageKey = 'VXE_CUSTOM_STORE';
8031
8013
  /* harmony default export */ var table = ((0,external_commonjs_vue_commonjs2_vue_root_Vue_.defineComponent)({
8032
8014
  name: 'VxeTable',
8033
8015
  props: props,
@@ -8253,7 +8235,8 @@ const sortStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_SORT';
8253
8235
  isFooter: false
8254
8236
  },
8255
8237
  scrollVMLoading: false,
8256
- _isResize: false
8238
+ _isResize: false,
8239
+ _isLoading: false
8257
8240
  });
8258
8241
  const internalData = {
8259
8242
  tZindex: 0,
@@ -8653,12 +8636,20 @@ const sortStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_SORT';
8653
8636
  const oIndex = orders.indexOf(currOrder) + 1;
8654
8637
  return orders[oIndex < orders.length ? oIndex : 0];
8655
8638
  };
8656
- const getCustomStorageMap = key => {
8639
+ const getCustomStorageMap = id => {
8657
8640
  const version = table_getConfig().version;
8658
- const rest = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toStringJSON(localStorage.getItem(key) || '');
8659
- return rest && rest._v === version ? rest : {
8641
+ const rest = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toStringJSON(localStorage.getItem(customStorageKey) || '');
8642
+ const maps = rest && rest._v === version ? rest : {
8660
8643
  _v: version
8661
8644
  };
8645
+ return (id ? maps[id] : maps) || {};
8646
+ };
8647
+ const setCustomStorageMap = (id, data) => {
8648
+ const version = table_getConfig().version;
8649
+ const maps = getCustomStorageMap();
8650
+ maps[id] = data || undefined;
8651
+ maps._v = version;
8652
+ localStorage.setItem(customStorageKey, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toJSONString(maps));
8662
8653
  };
8663
8654
  const getRecoverRowMaps = keyMaps => {
8664
8655
  const {
@@ -8897,11 +8888,14 @@ const sortStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_SORT';
8897
8888
  /**
8898
8889
  * 还原自定义列操作状态
8899
8890
  */
8900
- const restoreCustomStorage = () => {
8891
+ const restoreCustomStorage = async () => {
8901
8892
  const {
8902
8893
  id,
8903
8894
  customConfig
8904
8895
  } = props;
8896
+ const {
8897
+ tableFullColumn
8898
+ } = internalData;
8905
8899
  const customOpts = computeCustomOpts.value;
8906
8900
  const {
8907
8901
  storage,
@@ -8913,128 +8907,56 @@ const sortStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_SORT';
8913
8907
  const isCustomVisible = isAllCustom || storageOpts.visible;
8914
8908
  const isCustomFixed = isAllCustom || storageOpts.fixed;
8915
8909
  const isCustomSort = isAllCustom || storageOpts.sort;
8916
- if (storage && id && restoreStore) {
8917
- restoreStore({
8918
- id
8919
- });
8920
- }
8921
8910
  if (customConfig && (isCustomResizable || isCustomVisible || isCustomFixed || isCustomSort)) {
8922
- const customMap = {};
8923
8911
  if (!id) {
8924
8912
  errLog('vxe.error.reqProp', ['id']);
8925
8913
  return;
8926
8914
  }
8927
- // 自定义列宽
8928
- if (isCustomResizable) {
8929
- const columnWidthStorage = getCustomStorageMap(resizableStorageKey)[id];
8930
- if (columnWidthStorage) {
8931
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(columnWidthStorage, (resizeWidth, colKey) => {
8932
- customMap[colKey] = {
8933
- resizeWidth
8934
- };
8935
- });
8936
- }
8937
- }
8938
- // 自定义固定列
8939
- if (isCustomFixed) {
8940
- const columnFixedStorage = getCustomStorageMap(fixedStorageKey)[id];
8941
- if (columnFixedStorage) {
8942
- const colFixeds = columnFixedStorage.split(',');
8943
- colFixeds.forEach(fixConf => {
8944
- const [colKey, fixed] = fixConf.split('|');
8945
- if (customMap[colKey]) {
8946
- customMap[colKey].fixed = fixed;
8947
- } else {
8948
- customMap[colKey] = {
8949
- fixed
8950
- };
8951
- }
8952
- });
8953
- }
8954
- }
8955
- // 自定义顺序
8956
- let hasCustomSort = false;
8957
- if (isCustomSort) {
8958
- const columnSortStorage = getCustomStorageMap(sortStorageKey)[id];
8959
- if (columnSortStorage) {
8960
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(columnSortStorage, (renderSortNumber, colKey) => {
8961
- if (customMap[colKey]) {
8962
- customMap[colKey].renderSortNumber = renderSortNumber;
8963
- } else {
8964
- customMap[colKey] = {
8965
- renderSortNumber
8966
- };
8967
- }
8968
- if (!hasCustomSort) {
8969
- hasCustomSort = true;
8970
- }
8971
- });
8972
- }
8915
+ let storeData = getCustomStorageMap(id);
8916
+ if (restoreStore) {
8917
+ storeData = await restoreStore({
8918
+ id,
8919
+ type: 'restore',
8920
+ storeData
8921
+ });
8973
8922
  }
8974
- // 自定义隐藏列
8975
- if (isCustomVisible) {
8976
- const columnVisibleStorage = getCustomStorageMap(visibleStorageKey)[id];
8977
- if (columnVisibleStorage) {
8978
- const colVisibles = columnVisibleStorage.split('|');
8979
- const colHides = colVisibles[0] ? colVisibles[0].split(',') : [];
8980
- const colShows = colVisibles[1] ? colVisibles[1].split(',') : [];
8981
- colHides.forEach(colKey => {
8982
- if (customMap[colKey]) {
8983
- customMap[colKey].visible = false;
8984
- } else {
8985
- customMap[colKey] = {
8986
- visible: false
8987
- };
8988
- }
8989
- });
8990
- colShows.forEach(colKey => {
8991
- if (customMap[colKey]) {
8992
- customMap[colKey].visible = true;
8993
- } else {
8994
- customMap[colKey] = {
8995
- visible: true
8996
- };
8997
- }
8998
- });
8999
- }
8923
+ if (!storeData) {
8924
+ return;
9000
8925
  }
9001
8926
  let {
9002
8927
  collectColumn
9003
8928
  } = internalData;
9004
- const keyMap = {};
9005
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(collectColumn, column => {
9006
- const colKey = column.getKey();
9007
- if (colKey) {
9008
- keyMap[colKey] = column;
9009
- }
9010
- });
9011
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(customMap, ({
9012
- visible,
9013
- resizeWidth,
9014
- fixed,
9015
- renderSortNumber
9016
- }, colKey) => {
9017
- const column = keyMap[colKey];
9018
- if (column) {
9019
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(resizeWidth)) {
9020
- column.resizeWidth = resizeWidth;
8929
+ const {
8930
+ resizableData,
8931
+ sortData,
8932
+ visibleData,
8933
+ fixedData
8934
+ } = storeData;
8935
+ let hasCustomSort = false;
8936
+ // 处理还原
8937
+ if (resizableData || sortData || visibleData || fixedData) {
8938
+ tableFullColumn.forEach(column => {
8939
+ const colKey = column.getKey();
8940
+ if (resizableData && external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(resizableData[colKey])) {
8941
+ column.resizeWidth = resizableData[colKey];
9021
8942
  }
9022
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isBoolean(visible)) {
9023
- column.visible = visible;
8943
+ if (visibleData && external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isBoolean(visibleData[colKey])) {
8944
+ column.visible = visibleData[colKey];
9024
8945
  }
9025
- if (fixed) {
9026
- column.fixed = fixed;
8946
+ if (fixedData && fixedData[colKey]) {
8947
+ column.fixed = fixedData[colKey];
9027
8948
  }
9028
- if (renderSortNumber) {
9029
- column.renderSortNumber = Number(renderSortNumber);
8949
+ if (sortData && external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(sortData[colKey])) {
8950
+ hasCustomSort = true;
8951
+ column.renderSortNumber = sortData[colKey];
9030
8952
  }
8953
+ });
8954
+ // 如果自定义了顺序
8955
+ if (hasCustomSort) {
8956
+ collectColumn = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().orderBy(collectColumn, 'renderSortNumber');
8957
+ internalData.collectColumn = collectColumn;
8958
+ internalData.tableFullColumn = getColumnList(collectColumn);
9031
8959
  }
9032
- });
9033
- // 如果自定义了顺序
9034
- if (hasCustomSort) {
9035
- collectColumn = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().orderBy(collectColumn, 'renderSortNumber');
9036
- internalData.collectColumn = collectColumn;
9037
- internalData.tableFullColumn = getColumnList(collectColumn);
9038
8960
  }
9039
8961
  }
9040
8962
  };
@@ -10903,30 +10825,33 @@ const sortStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_SORT';
10903
10825
  internalData.collectColumn = collectColumn;
10904
10826
  const tableFullColumn = getColumnList(collectColumn);
10905
10827
  internalData.tableFullColumn = tableFullColumn;
10828
+ reactData._isLoading = true;
10906
10829
  initColumnSort();
10907
- restoreCustomStorage();
10908
- cacheColumnMap();
10909
- parseColumns().then(() => {
10910
- if (reactData.scrollXLoad) {
10911
- loadScrollXData();
10912
- }
10913
- });
10914
- tableMethods.clearMergeCells();
10915
- tableMethods.clearMergeFooterItems();
10916
- tablePrivateMethods.handleTableData(true);
10917
- if (true) {
10918
- if ((reactData.scrollXLoad || reactData.scrollYLoad) && reactData.expandColumn) {
10919
- warnLog('vxe.error.scrollErrProp', ['column.type=expand']);
10920
- }
10921
- }
10922
- return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)().then(() => {
10923
- if ($xeToolbar) {
10924
- $xeToolbar.syncUpdate({
10925
- collectColumn,
10926
- $table: $xeTable
10927
- });
10830
+ return restoreCustomStorage().then(() => {
10831
+ reactData._isLoading = false;
10832
+ cacheColumnMap();
10833
+ parseColumns().then(() => {
10834
+ if (reactData.scrollXLoad) {
10835
+ loadScrollXData();
10836
+ }
10837
+ });
10838
+ tableMethods.clearMergeCells();
10839
+ tableMethods.clearMergeFooterItems();
10840
+ tablePrivateMethods.handleTableData(true);
10841
+ if (true) {
10842
+ if ((reactData.scrollXLoad || reactData.scrollYLoad) && reactData.expandColumn) {
10843
+ warnLog('vxe.error.scrollErrProp', ['column.type=expand']);
10844
+ }
10928
10845
  }
10929
- return tableMethods.recalculate();
10846
+ return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)().then(() => {
10847
+ if ($xeToolbar) {
10848
+ $xeToolbar.syncUpdate({
10849
+ collectColumn,
10850
+ $table: $xeTable
10851
+ });
10852
+ }
10853
+ return tableMethods.recalculate();
10854
+ });
10930
10855
  });
10931
10856
  };
10932
10857
  const updateScrollYStatus = fullData => {
@@ -11776,7 +11701,7 @@ const sortStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_SORT';
11776
11701
  external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree([targetColumn], column => {
11777
11702
  column.fixed = fixed;
11778
11703
  });
11779
- tablePrivateMethods.saveCustomFixed();
11704
+ tablePrivateMethods.saveCustomStore('update:fixed');
11780
11705
  return tableMethods.refreshColumn();
11781
11706
  }
11782
11707
  return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();
@@ -11791,7 +11716,7 @@ const sortStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_SORT';
11791
11716
  external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree([targetColumn], column => {
11792
11717
  column.fixed = null;
11793
11718
  });
11794
- tablePrivateMethods.saveCustomFixed();
11719
+ tablePrivateMethods.saveCustomStore('update:fixed');
11795
11720
  return tableMethods.refreshColumn();
11796
11721
  }
11797
11722
  return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();
@@ -11876,15 +11801,7 @@ const sortStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_SORT';
11876
11801
  }
11877
11802
  column.renderResizeWidth = column.renderWidth;
11878
11803
  });
11879
- if (opts.resizable) {
11880
- tablePrivateMethods.saveCustomResizable(true);
11881
- }
11882
- if (opts.sort) {
11883
- tablePrivateMethods.saveCustomSort(true);
11884
- }
11885
- if (opts.fixed) {
11886
- tablePrivateMethods.saveCustomFixed();
11887
- }
11804
+ $xeTable.saveCustomStore('reset');
11888
11805
  return tablePrivateMethods.handleCustom();
11889
11806
  },
11890
11807
  /**
@@ -13245,21 +13162,26 @@ const sortStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_SORT';
13245
13162
  const visibleData = {};
13246
13163
  const fixedData = {};
13247
13164
  const storeData = {
13248
- resizableData,
13249
- sortData,
13250
- visibleData,
13251
- fixedData
13165
+ resizableData: undefined,
13166
+ sortData: undefined,
13167
+ visibleData: undefined,
13168
+ fixedData: undefined
13252
13169
  };
13253
13170
  if (!id) {
13254
13171
  errLog('vxe.error.reqProp', ['id']);
13255
13172
  return storeData;
13256
13173
  }
13174
+ let hasResizable = 0;
13175
+ let hasSort = 0;
13176
+ let hasFixedt = 0;
13177
+ let hasVisible = 0;
13257
13178
  external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(collectColumn, (column, index, items, path, parent) => {
13258
13179
  // 排序只支持一级
13259
13180
  if (!parent) {
13260
13181
  collectColumn.forEach(column => {
13261
13182
  const colKey = column.getKey();
13262
13183
  if (colKey) {
13184
+ hasSort = 1;
13263
13185
  sortData[colKey] = column.renderSortNumber;
13264
13186
  }
13265
13187
  });
@@ -13267,12 +13189,14 @@ const sortStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_SORT';
13267
13189
  if (column.resizeWidth) {
13268
13190
  const colKey = column.getKey();
13269
13191
  if (colKey) {
13192
+ hasResizable = 1;
13270
13193
  resizableData[colKey] = column.renderWidth;
13271
13194
  }
13272
13195
  }
13273
13196
  if (column.fixed && column.fixed !== column.defaultFixed) {
13274
13197
  const colKey = column.getKey();
13275
13198
  if (colKey) {
13199
+ hasFixedt = 1;
13276
13200
  fixedData[colKey] = column.fixed;
13277
13201
  }
13278
13202
  }
@@ -13282,16 +13206,30 @@ const sortStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_SORT';
13282
13206
  if (!column.visible && column.defaultVisible) {
13283
13207
  const colKey = column.getKey();
13284
13208
  if (colKey) {
13209
+ hasVisible = 1;
13285
13210
  visibleData[colKey] = false;
13286
13211
  }
13287
13212
  } else if (column.visible && !column.defaultVisible) {
13288
13213
  const colKey = column.getKey();
13289
13214
  if (colKey) {
13215
+ hasVisible = 1;
13290
13216
  visibleData[colKey] = true;
13291
13217
  }
13292
13218
  }
13293
13219
  }
13294
13220
  });
13221
+ if (hasResizable) {
13222
+ storeData.resizableData = resizableData;
13223
+ }
13224
+ if (hasSort) {
13225
+ storeData.sortData = sortData;
13226
+ }
13227
+ if (hasFixedt) {
13228
+ storeData.fixedData = fixedData;
13229
+ }
13230
+ if (hasVisible) {
13231
+ storeData.visibleData = visibleData;
13232
+ }
13295
13233
  return storeData;
13296
13234
  },
13297
13235
  focus() {
@@ -14196,157 +14134,43 @@ const sortStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_SORT';
14196
14134
  autoList
14197
14135
  });
14198
14136
  },
14199
- saveCustomResizable(isReset) {
14200
- const {
14201
- id,
14202
- customConfig
14203
- } = props;
14204
- const customOpts = computeCustomOpts.value;
14137
+ saveCustomStore(type) {
14205
14138
  const {
14206
- collectColumn
14207
- } = internalData;
14208
- const {
14209
- storage
14210
- } = customOpts;
14211
- const isAllStorage = storage === true;
14212
- const storageOpts = isAllStorage ? {} : Object.assign({}, storage || {});
14213
- const isResizable = isAllStorage || storageOpts.resizable;
14214
- if (customConfig && isResizable) {
14215
- const columnWidthStorageMap = getCustomStorageMap(resizableStorageKey);
14216
- let columnWidthStorage;
14217
- if (!id) {
14218
- errLog('vxe.error.reqProp', ['id']);
14219
- return;
14220
- }
14221
- if (!isReset) {
14222
- columnWidthStorage = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isPlainObject(columnWidthStorageMap[id]) ? columnWidthStorageMap[id] : {};
14223
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(collectColumn, column => {
14224
- if (column.resizeWidth) {
14225
- const colKey = column.getKey();
14226
- if (colKey) {
14227
- columnWidthStorage[colKey] = column.renderWidth;
14228
- }
14229
- }
14230
- });
14231
- }
14232
- columnWidthStorageMap[id] = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isEmpty(columnWidthStorage) ? undefined : columnWidthStorage;
14233
- localStorage.setItem(resizableStorageKey, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toJSONString(columnWidthStorageMap));
14234
- }
14235
- },
14236
- saveCustomSort(isReset) {
14237
- const {
14238
- id,
14239
- customConfig
14139
+ id
14240
14140
  } = props;
14241
14141
  const customOpts = computeCustomOpts.value;
14242
14142
  const {
14243
- collectColumn
14244
- } = internalData;
14245
- const {
14143
+ updateStore,
14246
14144
  storage
14247
14145
  } = customOpts;
14248
- const isAllStorage = storage === true;
14249
- const storageOpts = isAllStorage ? {} : Object.assign({}, storage || {});
14250
- const isSort = isAllStorage || storageOpts.sort;
14251
- if (customConfig && isSort) {
14252
- const columnSortStorageMap = getCustomStorageMap(sortStorageKey);
14253
- let columnWidthStorage;
14146
+ const isAllCustom = storage === true;
14147
+ const storageOpts = isAllCustom ? {} : Object.assign({}, storage || {});
14148
+ const isCustomResizable = isAllCustom || storageOpts.resizable;
14149
+ const isCustomVisible = isAllCustom || storageOpts.visible;
14150
+ const isCustomFixed = isAllCustom || storageOpts.fixed;
14151
+ const isCustomSort = isAllCustom || storageOpts.sort;
14152
+ if (isCustomResizable || isCustomVisible || isCustomFixed || isCustomSort) {
14254
14153
  if (!id) {
14255
14154
  errLog('vxe.error.reqProp', ['id']);
14256
- return;
14155
+ return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();
14257
14156
  }
14258
- if (!isReset) {
14259
- columnWidthStorage = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isPlainObject(columnSortStorageMap[id]) ? columnSortStorageMap[id] : {};
14260
- // 排序只支持一级
14261
- collectColumn.forEach(column => {
14262
- const colKey = column.getKey();
14263
- if (colKey) {
14264
- columnWidthStorage[colKey] = column.renderSortNumber;
14265
- }
14157
+ const storeData = type === 'reset' ? {
14158
+ resizableData: {},
14159
+ sortData: {},
14160
+ visibleData: {},
14161
+ fixedData: {}
14162
+ } : tableMethods.getCustomStoreData();
14163
+ if (updateStore) {
14164
+ return updateStore({
14165
+ id,
14166
+ type,
14167
+ storeData
14266
14168
  });
14169
+ } else {
14170
+ setCustomStorageMap(id, type === 'reset' ? null : storeData);
14267
14171
  }
14268
- columnSortStorageMap[id] = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isEmpty(columnWidthStorage) ? undefined : columnWidthStorage;
14269
- localStorage.setItem(sortStorageKey, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toJSONString(columnSortStorageMap));
14270
- }
14271
- },
14272
- saveCustomFixed() {
14273
- const {
14274
- id,
14275
- customConfig
14276
- } = props;
14277
- const {
14278
- collectColumn
14279
- } = internalData;
14280
- const customOpts = computeCustomOpts.value;
14281
- const {
14282
- storage
14283
- } = customOpts;
14284
- const isAllStorage = storage === true;
14285
- const storageOpts = isAllStorage ? {} : Object.assign({}, storage || {});
14286
- const isCustomFixed = isAllStorage || storageOpts.fixed;
14287
- if (customConfig && isCustomFixed) {
14288
- const columnFixedStorageMap = getCustomStorageMap(fixedStorageKey);
14289
- const colFixeds = [];
14290
- if (!id) {
14291
- errLog('vxe.error.reqProp', ['id']);
14292
- return;
14293
- }
14294
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(collectColumn, column => {
14295
- if (column.fixed && column.fixed !== column.defaultFixed) {
14296
- const colKey = column.getKey();
14297
- if (colKey) {
14298
- colFixeds.push(`${colKey}|${column.fixed}`);
14299
- }
14300
- }
14301
- });
14302
- columnFixedStorageMap[id] = colFixeds.join(',') || undefined;
14303
- localStorage.setItem(fixedStorageKey, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toJSONString(columnFixedStorageMap));
14304
- }
14305
- },
14306
- saveCustomVisible() {
14307
- const {
14308
- id,
14309
- customConfig
14310
- } = props;
14311
- const {
14312
- collectColumn
14313
- } = internalData;
14314
- const customOpts = computeCustomOpts.value;
14315
- const {
14316
- checkMethod,
14317
- storage
14318
- } = customOpts;
14319
- const isAllStorage = storage === true;
14320
- const storageOpts = isAllStorage ? {} : Object.assign({}, storage || {});
14321
- const isCustomVisible = isAllStorage || storageOpts.visible;
14322
- if (customConfig && isCustomVisible) {
14323
- const columnVisibleStorageMap = getCustomStorageMap(visibleStorageKey);
14324
- const colHides = [];
14325
- const colShows = [];
14326
- if (!id) {
14327
- errLog('vxe.error.reqProp', ['id']);
14328
- return;
14329
- }
14330
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(collectColumn, column => {
14331
- if (!checkMethod || checkMethod({
14332
- column
14333
- })) {
14334
- if (!column.visible && column.defaultVisible) {
14335
- const colKey = column.getKey();
14336
- if (colKey) {
14337
- colHides.push(colKey);
14338
- }
14339
- } else if (column.visible && !column.defaultVisible) {
14340
- const colKey = column.getKey();
14341
- if (colKey) {
14342
- colShows.push(colKey);
14343
- }
14344
- }
14345
- }
14346
- });
14347
- columnVisibleStorageMap[id] = [colHides.join(',')].concat(colShows.length ? [colShows.join(',')] : []).join('|') || undefined;
14348
- localStorage.setItem(visibleStorageKey, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toJSONString(columnVisibleStorageMap));
14349
14172
  }
14173
+ return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();
14350
14174
  },
14351
14175
  handleCustom() {
14352
14176
  const {
@@ -14361,8 +14185,6 @@ const sortStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_SORT';
14361
14185
  $xeTable.clearCopyCellArea();
14362
14186
  }
14363
14187
  }
14364
- tablePrivateMethods.saveCustomVisible();
14365
- tablePrivateMethods.saveCustomSort();
14366
14188
  tablePrivateMethods.analyColumnWidth();
14367
14189
  return tableMethods.refreshColumn(true);
14368
14190
  },
@@ -16006,6 +15828,7 @@ const sortStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_SORT';
16006
15828
  const validTipOpts = computeValidTipOpts.value;
16007
15829
  const loadingOpts = computeLoadingOpts.value;
16008
15830
  const isMenu = computeIsMenu.value;
15831
+ const currLoading = reactData._isLoading || loading;
16009
15832
  return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {
16010
15833
  ref: refElem,
16011
15834
  class: ['vxe-table', 'vxe-table--render-default', `tid_${xID}`, `border--${tableBorder}`, {
@@ -16027,8 +15850,8 @@ const sortStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_SORT';
16027
15850
  'is--animat': !!props.animat,
16028
15851
  'is--round': props.round,
16029
15852
  'is--stripe': !treeConfig && stripe,
16030
- 'is--loading': loading,
16031
- 'is--empty': !loading && !tableData.length,
15853
+ 'is--loading': currLoading,
15854
+ 'is--empty': !currLoading && !tableData.length,
16032
15855
  'is--scroll-y': overflowY,
16033
15856
  'is--scroll-x': overflowX,
16034
15857
  'is--virtual-x': scrollXLoad,
@@ -16111,7 +15934,7 @@ const sortStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_SORT';
16111
15934
  */
16112
15935
  (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)((0,external_commonjs_vue_commonjs2_vue_root_Vue_.resolveComponent)('vxe-loading'), {
16113
15936
  class: 'vxe-table--loading',
16114
- modelValue: loading,
15937
+ modelValue: currLoading,
16115
15938
  icon: loadingOpts.icon,
16116
15939
  text: loadingOpts.text
16117
15940
  }, loadingSlot ? {