vxe-table 4.7.10 → 4.7.11

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.11";
1795
+ external_root_VxeUI_commonjs_vxe_pc_ui_commonjs2_vxe_pc_ui_amd_vxe_pc_ui_.VxeUI.tableVersion = "4.7.11";
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.11"}`;
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,
@@ -8653,12 +8635,20 @@ const sortStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_SORT';
8653
8635
  const oIndex = orders.indexOf(currOrder) + 1;
8654
8636
  return orders[oIndex < orders.length ? oIndex : 0];
8655
8637
  };
8656
- const getCustomStorageMap = key => {
8638
+ const getCustomStorageMap = id => {
8657
8639
  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 : {
8640
+ const rest = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toStringJSON(localStorage.getItem(customStorageKey) || '');
8641
+ const maps = rest && rest._v === version ? rest : {
8660
8642
  _v: version
8661
8643
  };
8644
+ return (id ? maps[id] : maps) || {};
8645
+ };
8646
+ const setCustomStorageMap = (id, data) => {
8647
+ const version = table_getConfig().version;
8648
+ const maps = getCustomStorageMap();
8649
+ maps[id] = data || undefined;
8650
+ maps._v = version;
8651
+ localStorage.setItem(customStorageKey, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toJSONString(maps));
8662
8652
  };
8663
8653
  const getRecoverRowMaps = keyMaps => {
8664
8654
  const {
@@ -8897,11 +8887,14 @@ const sortStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_SORT';
8897
8887
  /**
8898
8888
  * 还原自定义列操作状态
8899
8889
  */
8900
- const restoreCustomStorage = () => {
8890
+ const restoreCustomStorage = async () => {
8901
8891
  const {
8902
8892
  id,
8903
8893
  customConfig
8904
8894
  } = props;
8895
+ const {
8896
+ tableFullColumn
8897
+ } = internalData;
8905
8898
  const customOpts = computeCustomOpts.value;
8906
8899
  const {
8907
8900
  storage,
@@ -8913,128 +8906,56 @@ const sortStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_SORT';
8913
8906
  const isCustomVisible = isAllCustom || storageOpts.visible;
8914
8907
  const isCustomFixed = isAllCustom || storageOpts.fixed;
8915
8908
  const isCustomSort = isAllCustom || storageOpts.sort;
8916
- if (storage && id && restoreStore) {
8917
- restoreStore({
8918
- id
8919
- });
8920
- }
8921
8909
  if (customConfig && (isCustomResizable || isCustomVisible || isCustomFixed || isCustomSort)) {
8922
- const customMap = {};
8923
8910
  if (!id) {
8924
8911
  errLog('vxe.error.reqProp', ['id']);
8925
8912
  return;
8926
8913
  }
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
- }
8914
+ let storeData = getCustomStorageMap(id);
8915
+ if (restoreStore) {
8916
+ storeData = await restoreStore({
8917
+ id,
8918
+ type: 'restore',
8919
+ storeData
8920
+ });
8973
8921
  }
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
- }
8922
+ if (!storeData) {
8923
+ return;
9000
8924
  }
9001
8925
  let {
9002
8926
  collectColumn
9003
8927
  } = 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;
8928
+ const {
8929
+ resizableData,
8930
+ sortData,
8931
+ visibleData,
8932
+ fixedData
8933
+ } = storeData;
8934
+ let hasCustomSort = false;
8935
+ // 处理还原
8936
+ if (resizableData || sortData || visibleData || fixedData) {
8937
+ tableFullColumn.forEach(column => {
8938
+ const colKey = column.getKey();
8939
+ if (resizableData && external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(resizableData[colKey])) {
8940
+ column.resizeWidth = resizableData[colKey];
9021
8941
  }
9022
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isBoolean(visible)) {
9023
- column.visible = visible;
8942
+ if (visibleData && external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isBoolean(visibleData[colKey])) {
8943
+ column.visible = visibleData[colKey];
9024
8944
  }
9025
- if (fixed) {
9026
- column.fixed = fixed;
8945
+ if (fixedData && fixedData[colKey]) {
8946
+ column.fixed = fixedData[colKey];
9027
8947
  }
9028
- if (renderSortNumber) {
9029
- column.renderSortNumber = Number(renderSortNumber);
8948
+ if (sortData && external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(sortData[colKey])) {
8949
+ hasCustomSort = true;
8950
+ column.renderSortNumber = sortData[colKey];
9030
8951
  }
8952
+ });
8953
+ // 如果自定义了顺序
8954
+ if (hasCustomSort) {
8955
+ collectColumn = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().orderBy(collectColumn, 'renderSortNumber');
8956
+ internalData.collectColumn = collectColumn;
8957
+ internalData.tableFullColumn = getColumnList(collectColumn);
9031
8958
  }
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
8959
  }
9039
8960
  }
9040
8961
  };
@@ -10904,29 +10825,30 @@ const sortStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_SORT';
10904
10825
  const tableFullColumn = getColumnList(collectColumn);
10905
10826
  internalData.tableFullColumn = tableFullColumn;
10906
10827
  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
- });
10828
+ return restoreCustomStorage().then(() => {
10829
+ cacheColumnMap();
10830
+ parseColumns().then(() => {
10831
+ if (reactData.scrollXLoad) {
10832
+ loadScrollXData();
10833
+ }
10834
+ });
10835
+ tableMethods.clearMergeCells();
10836
+ tableMethods.clearMergeFooterItems();
10837
+ tablePrivateMethods.handleTableData(true);
10838
+ if (true) {
10839
+ if ((reactData.scrollXLoad || reactData.scrollYLoad) && reactData.expandColumn) {
10840
+ warnLog('vxe.error.scrollErrProp', ['column.type=expand']);
10841
+ }
10928
10842
  }
10929
- return tableMethods.recalculate();
10843
+ return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)().then(() => {
10844
+ if ($xeToolbar) {
10845
+ $xeToolbar.syncUpdate({
10846
+ collectColumn,
10847
+ $table: $xeTable
10848
+ });
10849
+ }
10850
+ return tableMethods.recalculate();
10851
+ });
10930
10852
  });
10931
10853
  };
10932
10854
  const updateScrollYStatus = fullData => {
@@ -11776,7 +11698,7 @@ const sortStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_SORT';
11776
11698
  external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree([targetColumn], column => {
11777
11699
  column.fixed = fixed;
11778
11700
  });
11779
- tablePrivateMethods.saveCustomFixed();
11701
+ tablePrivateMethods.saveCustomStore('update:fixed');
11780
11702
  return tableMethods.refreshColumn();
11781
11703
  }
11782
11704
  return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();
@@ -11791,7 +11713,7 @@ const sortStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_SORT';
11791
11713
  external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree([targetColumn], column => {
11792
11714
  column.fixed = null;
11793
11715
  });
11794
- tablePrivateMethods.saveCustomFixed();
11716
+ tablePrivateMethods.saveCustomStore('update:fixed');
11795
11717
  return tableMethods.refreshColumn();
11796
11718
  }
11797
11719
  return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();
@@ -11876,15 +11798,7 @@ const sortStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_SORT';
11876
11798
  }
11877
11799
  column.renderResizeWidth = column.renderWidth;
11878
11800
  });
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
- }
11801
+ $xeTable.saveCustomStore('reset');
11888
11802
  return tablePrivateMethods.handleCustom();
11889
11803
  },
11890
11804
  /**
@@ -13245,21 +13159,26 @@ const sortStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_SORT';
13245
13159
  const visibleData = {};
13246
13160
  const fixedData = {};
13247
13161
  const storeData = {
13248
- resizableData,
13249
- sortData,
13250
- visibleData,
13251
- fixedData
13162
+ resizableData: undefined,
13163
+ sortData: undefined,
13164
+ visibleData: undefined,
13165
+ fixedData: undefined
13252
13166
  };
13253
13167
  if (!id) {
13254
13168
  errLog('vxe.error.reqProp', ['id']);
13255
13169
  return storeData;
13256
13170
  }
13171
+ let hasResizable = 0;
13172
+ let hasSort = 0;
13173
+ let hasFixedt = 0;
13174
+ let hasVisible = 0;
13257
13175
  external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(collectColumn, (column, index, items, path, parent) => {
13258
13176
  // 排序只支持一级
13259
13177
  if (!parent) {
13260
13178
  collectColumn.forEach(column => {
13261
13179
  const colKey = column.getKey();
13262
13180
  if (colKey) {
13181
+ hasSort = 1;
13263
13182
  sortData[colKey] = column.renderSortNumber;
13264
13183
  }
13265
13184
  });
@@ -13267,12 +13186,14 @@ const sortStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_SORT';
13267
13186
  if (column.resizeWidth) {
13268
13187
  const colKey = column.getKey();
13269
13188
  if (colKey) {
13189
+ hasResizable = 1;
13270
13190
  resizableData[colKey] = column.renderWidth;
13271
13191
  }
13272
13192
  }
13273
13193
  if (column.fixed && column.fixed !== column.defaultFixed) {
13274
13194
  const colKey = column.getKey();
13275
13195
  if (colKey) {
13196
+ hasFixedt = 1;
13276
13197
  fixedData[colKey] = column.fixed;
13277
13198
  }
13278
13199
  }
@@ -13282,16 +13203,30 @@ const sortStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_SORT';
13282
13203
  if (!column.visible && column.defaultVisible) {
13283
13204
  const colKey = column.getKey();
13284
13205
  if (colKey) {
13206
+ hasVisible = 1;
13285
13207
  visibleData[colKey] = false;
13286
13208
  }
13287
13209
  } else if (column.visible && !column.defaultVisible) {
13288
13210
  const colKey = column.getKey();
13289
13211
  if (colKey) {
13212
+ hasVisible = 1;
13290
13213
  visibleData[colKey] = true;
13291
13214
  }
13292
13215
  }
13293
13216
  }
13294
13217
  });
13218
+ if (hasResizable) {
13219
+ storeData.resizableData = resizableData;
13220
+ }
13221
+ if (hasSort) {
13222
+ storeData.sortData = sortData;
13223
+ }
13224
+ if (hasFixedt) {
13225
+ storeData.fixedData = fixedData;
13226
+ }
13227
+ if (hasVisible) {
13228
+ storeData.visibleData = visibleData;
13229
+ }
13295
13230
  return storeData;
13296
13231
  },
13297
13232
  focus() {
@@ -14196,157 +14131,43 @@ const sortStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_SORT';
14196
14131
  autoList
14197
14132
  });
14198
14133
  },
14199
- saveCustomResizable(isReset) {
14200
- const {
14201
- id,
14202
- customConfig
14203
- } = props;
14204
- const customOpts = computeCustomOpts.value;
14134
+ saveCustomStore(type) {
14205
14135
  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
14136
+ id
14240
14137
  } = props;
14241
14138
  const customOpts = computeCustomOpts.value;
14242
14139
  const {
14243
- collectColumn
14244
- } = internalData;
14245
- const {
14140
+ updateStore,
14246
14141
  storage
14247
14142
  } = 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;
14143
+ const isAllCustom = storage === true;
14144
+ const storageOpts = isAllCustom ? {} : Object.assign({}, storage || {});
14145
+ const isCustomResizable = isAllCustom || storageOpts.resizable;
14146
+ const isCustomVisible = isAllCustom || storageOpts.visible;
14147
+ const isCustomFixed = isAllCustom || storageOpts.fixed;
14148
+ const isCustomSort = isAllCustom || storageOpts.sort;
14149
+ if (isCustomResizable || isCustomVisible || isCustomFixed || isCustomSort) {
14254
14150
  if (!id) {
14255
14151
  errLog('vxe.error.reqProp', ['id']);
14256
- return;
14152
+ return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();
14257
14153
  }
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
- }
14154
+ const storeData = type === 'reset' ? {
14155
+ resizableData: {},
14156
+ sortData: {},
14157
+ visibleData: {},
14158
+ fixedData: {}
14159
+ } : tableMethods.getCustomStoreData();
14160
+ if (updateStore) {
14161
+ return updateStore({
14162
+ id,
14163
+ type,
14164
+ storeData
14266
14165
  });
14166
+ } else {
14167
+ setCustomStorageMap(id, type === 'reset' ? null : storeData);
14267
14168
  }
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
14169
  }
14170
+ return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();
14350
14171
  },
14351
14172
  handleCustom() {
14352
14173
  const {
@@ -14361,8 +14182,6 @@ const sortStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_SORT';
14361
14182
  $xeTable.clearCopyCellArea();
14362
14183
  }
14363
14184
  }
14364
- tablePrivateMethods.saveCustomVisible();
14365
- tablePrivateMethods.saveCustomSort();
14366
14185
  tablePrivateMethods.analyColumnWidth();
14367
14186
  return tableMethods.refreshColumn(true);
14368
14187
  },