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.
@@ -14,7 +14,7 @@ export default defineComponent({
14
14
  },
15
15
  setup(props) {
16
16
  const $xeTable = inject('$xeTable', {});
17
- const { props: tableProps, reactData } = $xeTable;
17
+ const { reactData } = $xeTable;
18
18
  const { computeCustomOpts, computeColumnOpts, computeIsMaxFixedColumn } = $xeTable.getComputeMaps();
19
19
  const refElem = ref();
20
20
  const bodyElemRef = ref();
@@ -35,18 +35,6 @@ export default defineComponent({
35
35
  }
36
36
  }, 300);
37
37
  };
38
- const handleSaveStore = (type) => {
39
- const { id } = tableProps;
40
- const customOpts = computeCustomOpts.value;
41
- const { storage, updateStore } = customOpts;
42
- if (storage && id && updateStore) {
43
- updateStore({
44
- id,
45
- type,
46
- storeData: $xeTable.getCustomStoreData()
47
- });
48
- }
49
- };
50
38
  const confirmCustomEvent = (evnt) => {
51
39
  const { customColumnList } = reactData;
52
40
  const customOpts = computeCustomOpts.value;
@@ -65,6 +53,7 @@ export default defineComponent({
65
53
  if (column.renderVisible && (!column.children || column.children.length)) {
66
54
  if (column.renderResizeWidth !== column.renderWidth) {
67
55
  column.resizeWidth = column.renderResizeWidth;
56
+ column.renderWidth = column.renderResizeWidth;
68
57
  }
69
58
  }
70
59
  }
@@ -74,7 +63,7 @@ export default defineComponent({
74
63
  });
75
64
  $xeTable.closeCustom();
76
65
  $xeTable.emitCustomEvent('confirm', evnt);
77
- handleSaveStore('confirm');
66
+ $xeTable.saveCustomStore('confirm');
78
67
  };
79
68
  const cancelCustomEvent = (evnt) => {
80
69
  const { customStore } = props;
@@ -108,7 +97,6 @@ export default defineComponent({
108
97
  $xeTable.resetColumn(true);
109
98
  $xeTable.closeCustom();
110
99
  $xeTable.emitCustomEvent('reset', evnt);
111
- handleSaveStore('reset');
112
100
  };
113
101
  const resetCustomEvent = (evnt) => {
114
102
  if (VxeUI.modal) {
@@ -148,6 +136,7 @@ export default defineComponent({
148
136
  handleOptionCheck(column);
149
137
  if (customOpts.immediate) {
150
138
  $xeTable.handleCustom();
139
+ $xeTable.saveCustomStore('update:visible');
151
140
  }
152
141
  $xeTable.checkCustomStatus();
153
142
  };
@@ -464,8 +453,9 @@ export default defineComponent({
464
453
  const { customStore } = props;
465
454
  const { customColumnList } = reactData;
466
455
  const customOpts = computeCustomOpts.value;
467
- const { allowVisible, allowSort, allowFixed, allowResizable, checkMethod, visibleMethod } = customOpts;
456
+ const { modalOptions, allowVisible, allowSort, allowFixed, allowResizable, checkMethod, visibleMethod } = customOpts;
468
457
  const columnOpts = computeColumnOpts.value;
458
+ const modalOpts = Object.assign({}, modalOptions);
469
459
  const isMaxFixedColumn = computeIsMaxFixedColumn.value;
470
460
  const trVNs = [];
471
461
  XEUtils.eachTree(customColumnList, (column, index, items, path, parent) => {
@@ -582,13 +572,13 @@ export default defineComponent({
582
572
  const isAllIndeterminate = customStore.isIndeterminate;
583
573
  return h(resolveComponent('vxe-modal'), {
584
574
  key: 'popup',
585
- className: 'vxe-table-custom-popup-wrapper vxe-table--ignore-clear',
575
+ className: ['vxe-table-custom-popup-wrapper', 'vxe-table--ignore-clear', modalOpts.className || ''].join(' '),
586
576
  modelValue: customStore.visible,
587
- title: getI18n('vxe.custom.cstmTitle'),
588
- width: 700,
589
- minWidth: 700,
590
- height: 400,
591
- minHeight: 400,
577
+ title: modalOpts.title || getI18n('vxe.custom.cstmTitle'),
578
+ width: modalOpts.width || '50vw',
579
+ minWidth: modalOpts.minWidth || 700,
580
+ height: modalOpts.height || '50vh',
581
+ minHeight: modalOpts.minHeight || 400,
592
582
  mask: true,
593
583
  lockView: true,
594
584
  showFooter: true,
@@ -107,7 +107,7 @@ export default defineComponent({
107
107
  tableInternalData._lastResizeTime = Date.now();
108
108
  $xeTable.analyColumnWidth();
109
109
  $xeTable.recalculate(true).then(() => {
110
- $xeTable.saveCustomResizable();
110
+ $xeTable.saveCustomStore('update:visible');
111
111
  $xeTable.updateCellAreas();
112
112
  $xeTable.dispatchEvent('resizable-change', Object.assign(Object.assign({}, params), { resizeWidth }), evnt);
113
113
  });
@@ -1,3 +1,4 @@
1
+ import { __awaiter } from "tslib";
1
2
  import { defineComponent, h, createCommentVNode, resolveComponent, reactive, ref, provide, inject, nextTick, onActivated, onDeactivated, onBeforeUnmount, onUnmounted, watch, computed, onMounted } from 'vue';
2
3
  import XEUtils from 'xe-utils';
3
4
  import { browse, isPx, isScale, hasClass, addClass, removeClass, getEventTargetNode, getPaddingTopBottomSize, setScrollTop, setScrollLeft, isNodeElement } from '../../ui/src/dom';
@@ -19,10 +20,7 @@ import TableExportPanelComponent from '../module/export/export-panel';
19
20
  import TableMenuPanelComponent from '../module/menu/panel';
20
21
  const { getConfig, getI18n, renderer, formats, createEvent, globalResize, interceptor, hooks, globalEvents, GLOBAL_EVENT_KEYS, useFns } = VxeUI;
21
22
  const isWebkit = browse['-webkit'] && !browse.edge;
22
- const resizableStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_WIDTH';
23
- const visibleStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_VISIBLE';
24
- const fixedStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_FIXED';
25
- const sortStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_SORT';
23
+ const customStorageKey = 'VXE_CUSTOM_STORE';
26
24
  export default defineComponent({
27
25
  name: 'VxeTable',
28
26
  props: tableProps,
@@ -614,10 +612,18 @@ export default defineComponent({
614
612
  const oIndex = orders.indexOf(currOrder) + 1;
615
613
  return orders[oIndex < orders.length ? oIndex : 0];
616
614
  };
617
- const getCustomStorageMap = (key) => {
615
+ const getCustomStorageMap = (id) => {
618
616
  const version = getConfig().version;
619
- const rest = XEUtils.toStringJSON(localStorage.getItem(key) || '');
620
- return rest && rest._v === version ? rest : { _v: version };
617
+ const rest = XEUtils.toStringJSON(localStorage.getItem(customStorageKey) || '');
618
+ const maps = rest && rest._v === version ? rest : { _v: version };
619
+ return (id ? maps[id] : maps) || {};
620
+ };
621
+ const setCustomStorageMap = (id, data) => {
622
+ const version = getConfig().version;
623
+ const maps = getCustomStorageMap();
624
+ maps[id] = data || undefined;
625
+ maps._v = version;
626
+ localStorage.setItem(customStorageKey, XEUtils.toJSONString(maps));
621
627
  };
622
628
  const getRecoverRowMaps = (keyMaps) => {
623
629
  const { fullAllDataRowIdData } = internalData;
@@ -815,8 +821,9 @@ export default defineComponent({
815
821
  /**
816
822
  * 还原自定义列操作状态
817
823
  */
818
- const restoreCustomStorage = () => {
824
+ const restoreCustomStorage = () => __awaiter(this, void 0, void 0, function* () {
819
825
  const { id, customConfig } = props;
826
+ const { tableFullColumn } = internalData;
820
827
  const customOpts = computeCustomOpts.value;
821
828
  const { storage, restoreStore } = customOpts;
822
829
  const isAllCustom = storage === true;
@@ -825,116 +832,48 @@ export default defineComponent({
825
832
  const isCustomVisible = isAllCustom || storageOpts.visible;
826
833
  const isCustomFixed = isAllCustom || storageOpts.fixed;
827
834
  const isCustomSort = isAllCustom || storageOpts.sort;
828
- if (storage && id && restoreStore) {
829
- restoreStore({ id });
830
- }
831
835
  if (customConfig && (isCustomResizable || isCustomVisible || isCustomFixed || isCustomSort)) {
832
- const customMap = {};
833
836
  if (!id) {
834
837
  errLog('vxe.error.reqProp', ['id']);
835
838
  return;
836
839
  }
837
- // 自定义列宽
838
- if (isCustomResizable) {
839
- const columnWidthStorage = getCustomStorageMap(resizableStorageKey)[id];
840
- if (columnWidthStorage) {
841
- XEUtils.each(columnWidthStorage, (resizeWidth, colKey) => {
842
- customMap[colKey] = { resizeWidth };
843
- });
844
- }
845
- }
846
- // 自定义固定列
847
- if (isCustomFixed) {
848
- const columnFixedStorage = getCustomStorageMap(fixedStorageKey)[id];
849
- if (columnFixedStorage) {
850
- const colFixeds = columnFixedStorage.split(',');
851
- colFixeds.forEach((fixConf) => {
852
- const [colKey, fixed] = fixConf.split('|');
853
- if (customMap[colKey]) {
854
- customMap[colKey].fixed = fixed;
855
- }
856
- else {
857
- customMap[colKey] = { fixed };
858
- }
859
- });
860
- }
861
- }
862
- // 自定义顺序
863
- let hasCustomSort = false;
864
- if (isCustomSort) {
865
- const columnSortStorage = getCustomStorageMap(sortStorageKey)[id];
866
- if (columnSortStorage) {
867
- XEUtils.each(columnSortStorage, (renderSortNumber, colKey) => {
868
- if (customMap[colKey]) {
869
- customMap[colKey].renderSortNumber = renderSortNumber;
870
- }
871
- else {
872
- customMap[colKey] = { renderSortNumber };
873
- }
874
- if (!hasCustomSort) {
875
- hasCustomSort = true;
876
- }
877
- });
878
- }
840
+ let storeData = getCustomStorageMap(id);
841
+ if (restoreStore) {
842
+ storeData = yield restoreStore({ id, type: 'restore', storeData });
879
843
  }
880
- // 自定义隐藏列
881
- if (isCustomVisible) {
882
- const columnVisibleStorage = getCustomStorageMap(visibleStorageKey)[id];
883
- if (columnVisibleStorage) {
884
- const colVisibles = columnVisibleStorage.split('|');
885
- const colHides = colVisibles[0] ? colVisibles[0].split(',') : [];
886
- const colShows = colVisibles[1] ? colVisibles[1].split(',') : [];
887
- colHides.forEach((colKey) => {
888
- if (customMap[colKey]) {
889
- customMap[colKey].visible = false;
890
- }
891
- else {
892
- customMap[colKey] = { visible: false };
893
- }
894
- });
895
- colShows.forEach((colKey) => {
896
- if (customMap[colKey]) {
897
- customMap[colKey].visible = true;
898
- }
899
- else {
900
- customMap[colKey] = { visible: true };
901
- }
902
- });
903
- }
844
+ if (!storeData) {
845
+ return;
904
846
  }
905
847
  let { collectColumn } = internalData;
906
- const keyMap = {};
907
- XEUtils.eachTree(collectColumn, (column) => {
908
- const colKey = column.getKey();
909
- if (colKey) {
910
- keyMap[colKey] = column;
911
- }
912
- });
913
- XEUtils.each(customMap, ({ visible, resizeWidth, fixed, renderSortNumber }, colKey) => {
914
- const column = keyMap[colKey];
915
- if (column) {
916
- if (XEUtils.isNumber(resizeWidth)) {
917
- column.resizeWidth = resizeWidth;
848
+ const { resizableData, sortData, visibleData, fixedData } = storeData;
849
+ let hasCustomSort = false;
850
+ // 处理还原
851
+ if (resizableData || sortData || visibleData || fixedData) {
852
+ tableFullColumn.forEach(column => {
853
+ const colKey = column.getKey();
854
+ if (resizableData && XEUtils.isNumber(resizableData[colKey])) {
855
+ column.resizeWidth = resizableData[colKey];
918
856
  }
919
- if (XEUtils.isBoolean(visible)) {
920
- column.visible = visible;
857
+ if (visibleData && XEUtils.isBoolean(visibleData[colKey])) {
858
+ column.visible = visibleData[colKey];
921
859
  }
922
- if (fixed) {
923
- column.fixed = fixed;
860
+ if (fixedData && fixedData[colKey]) {
861
+ column.fixed = fixedData[colKey];
924
862
  }
925
- if (renderSortNumber) {
926
- column.renderSortNumber = Number(renderSortNumber);
863
+ if (sortData && XEUtils.isNumber(sortData[colKey])) {
864
+ hasCustomSort = true;
865
+ column.renderSortNumber = sortData[colKey];
927
866
  }
867
+ });
868
+ // 如果自定义了顺序
869
+ if (hasCustomSort) {
870
+ collectColumn = XEUtils.orderBy(collectColumn, 'renderSortNumber');
871
+ internalData.collectColumn = collectColumn;
872
+ internalData.tableFullColumn = getColumnList(collectColumn);
928
873
  }
929
- });
930
- // 如果自定义了顺序
931
- if (hasCustomSort) {
932
- collectColumn = XEUtils.orderBy(collectColumn, 'renderSortNumber');
933
- internalData.collectColumn = collectColumn;
934
- internalData.tableFullColumn = getColumnList(collectColumn);
935
874
  }
936
875
  }
937
- };
876
+ });
938
877
  /**
939
878
  * 更新数据列的 Map
940
879
  * 牺牲数据组装的耗时,用来换取使用过程中的流畅
@@ -2480,26 +2419,27 @@ export default defineComponent({
2480
2419
  const tableFullColumn = getColumnList(collectColumn);
2481
2420
  internalData.tableFullColumn = tableFullColumn;
2482
2421
  initColumnSort();
2483
- restoreCustomStorage();
2484
- cacheColumnMap();
2485
- parseColumns().then(() => {
2486
- if (reactData.scrollXLoad) {
2487
- loadScrollXData();
2488
- }
2489
- });
2490
- tableMethods.clearMergeCells();
2491
- tableMethods.clearMergeFooterItems();
2492
- tablePrivateMethods.handleTableData(true);
2493
- if (process.env.NODE_ENV === 'development') {
2494
- if ((reactData.scrollXLoad || reactData.scrollYLoad) && reactData.expandColumn) {
2495
- warnLog('vxe.error.scrollErrProp', ['column.type=expand']);
2496
- }
2497
- }
2498
- return nextTick().then(() => {
2499
- if ($xeToolbar) {
2500
- $xeToolbar.syncUpdate({ collectColumn, $table: $xeTable });
2422
+ return restoreCustomStorage().then(() => {
2423
+ cacheColumnMap();
2424
+ parseColumns().then(() => {
2425
+ if (reactData.scrollXLoad) {
2426
+ loadScrollXData();
2427
+ }
2428
+ });
2429
+ tableMethods.clearMergeCells();
2430
+ tableMethods.clearMergeFooterItems();
2431
+ tablePrivateMethods.handleTableData(true);
2432
+ if (process.env.NODE_ENV === 'development') {
2433
+ if ((reactData.scrollXLoad || reactData.scrollYLoad) && reactData.expandColumn) {
2434
+ warnLog('vxe.error.scrollErrProp', ['column.type=expand']);
2435
+ }
2501
2436
  }
2502
- return tableMethods.recalculate();
2437
+ return nextTick().then(() => {
2438
+ if ($xeToolbar) {
2439
+ $xeToolbar.syncUpdate({ collectColumn, $table: $xeTable });
2440
+ }
2441
+ return tableMethods.recalculate();
2442
+ });
2503
2443
  });
2504
2444
  };
2505
2445
  const updateScrollYStatus = (fullData) => {
@@ -3206,7 +3146,7 @@ export default defineComponent({
3206
3146
  XEUtils.eachTree([targetColumn], (column) => {
3207
3147
  column.fixed = fixed;
3208
3148
  });
3209
- tablePrivateMethods.saveCustomFixed();
3149
+ tablePrivateMethods.saveCustomStore('update:fixed');
3210
3150
  return tableMethods.refreshColumn();
3211
3151
  }
3212
3152
  return nextTick();
@@ -3221,7 +3161,7 @@ export default defineComponent({
3221
3161
  XEUtils.eachTree([targetColumn], (column) => {
3222
3162
  column.fixed = null;
3223
3163
  });
3224
- tablePrivateMethods.saveCustomFixed();
3164
+ tablePrivateMethods.saveCustomStore('update:fixed');
3225
3165
  return tableMethods.refreshColumn();
3226
3166
  }
3227
3167
  return nextTick();
@@ -3300,15 +3240,7 @@ export default defineComponent({
3300
3240
  }
3301
3241
  column.renderResizeWidth = column.renderWidth;
3302
3242
  });
3303
- if (opts.resizable) {
3304
- tablePrivateMethods.saveCustomResizable(true);
3305
- }
3306
- if (opts.sort) {
3307
- tablePrivateMethods.saveCustomSort(true);
3308
- }
3309
- if (opts.fixed) {
3310
- tablePrivateMethods.saveCustomFixed();
3311
- }
3243
+ $xeTable.saveCustomStore('reset');
3312
3244
  return tablePrivateMethods.handleCustom();
3313
3245
  },
3314
3246
  /**
@@ -4474,21 +4406,26 @@ export default defineComponent({
4474
4406
  const visibleData = {};
4475
4407
  const fixedData = {};
4476
4408
  const storeData = {
4477
- resizableData,
4478
- sortData,
4479
- visibleData,
4480
- fixedData
4409
+ resizableData: undefined,
4410
+ sortData: undefined,
4411
+ visibleData: undefined,
4412
+ fixedData: undefined
4481
4413
  };
4482
4414
  if (!id) {
4483
4415
  errLog('vxe.error.reqProp', ['id']);
4484
4416
  return storeData;
4485
4417
  }
4418
+ let hasResizable = 0;
4419
+ let hasSort = 0;
4420
+ let hasFixedt = 0;
4421
+ let hasVisible = 0;
4486
4422
  XEUtils.eachTree(collectColumn, (column, index, items, path, parent) => {
4487
4423
  // 排序只支持一级
4488
4424
  if (!parent) {
4489
4425
  collectColumn.forEach((column) => {
4490
4426
  const colKey = column.getKey();
4491
4427
  if (colKey) {
4428
+ hasSort = 1;
4492
4429
  sortData[colKey] = column.renderSortNumber;
4493
4430
  }
4494
4431
  });
@@ -4496,12 +4433,14 @@ export default defineComponent({
4496
4433
  if (column.resizeWidth) {
4497
4434
  const colKey = column.getKey();
4498
4435
  if (colKey) {
4436
+ hasResizable = 1;
4499
4437
  resizableData[colKey] = column.renderWidth;
4500
4438
  }
4501
4439
  }
4502
4440
  if (column.fixed && column.fixed !== column.defaultFixed) {
4503
4441
  const colKey = column.getKey();
4504
4442
  if (colKey) {
4443
+ hasFixedt = 1;
4505
4444
  fixedData[colKey] = column.fixed;
4506
4445
  }
4507
4446
  }
@@ -4509,17 +4448,31 @@ export default defineComponent({
4509
4448
  if (!column.visible && column.defaultVisible) {
4510
4449
  const colKey = column.getKey();
4511
4450
  if (colKey) {
4451
+ hasVisible = 1;
4512
4452
  visibleData[colKey] = false;
4513
4453
  }
4514
4454
  }
4515
4455
  else if (column.visible && !column.defaultVisible) {
4516
4456
  const colKey = column.getKey();
4517
4457
  if (colKey) {
4458
+ hasVisible = 1;
4518
4459
  visibleData[colKey] = true;
4519
4460
  }
4520
4461
  }
4521
4462
  }
4522
4463
  });
4464
+ if (hasResizable) {
4465
+ storeData.resizableData = resizableData;
4466
+ }
4467
+ if (hasSort) {
4468
+ storeData.sortData = sortData;
4469
+ }
4470
+ if (hasFixedt) {
4471
+ storeData.fixedData = fixedData;
4472
+ }
4473
+ if (hasVisible) {
4474
+ storeData.visibleData = visibleData;
4475
+ }
4523
4476
  return storeData;
4524
4477
  },
4525
4478
  focus() {
@@ -5331,127 +5284,41 @@ export default defineComponent({
5331
5284
  });
5332
5285
  Object.assign(reactData.columnStore, { resizeList, pxList, pxMinList, scaleList, scaleMinList, autoList });
5333
5286
  },
5334
- saveCustomResizable(isReset) {
5335
- const { id, customConfig } = props;
5336
- const customOpts = computeCustomOpts.value;
5337
- const { collectColumn } = internalData;
5338
- const { storage } = customOpts;
5339
- const isAllStorage = storage === true;
5340
- const storageOpts = isAllStorage ? {} : Object.assign({}, storage || {});
5341
- const isResizable = isAllStorage || storageOpts.resizable;
5342
- if (customConfig && isResizable) {
5343
- const columnWidthStorageMap = getCustomStorageMap(resizableStorageKey);
5344
- let columnWidthStorage;
5345
- if (!id) {
5346
- errLog('vxe.error.reqProp', ['id']);
5347
- return;
5348
- }
5349
- if (!isReset) {
5350
- columnWidthStorage = XEUtils.isPlainObject(columnWidthStorageMap[id]) ? columnWidthStorageMap[id] : {};
5351
- XEUtils.eachTree(collectColumn, (column) => {
5352
- if (column.resizeWidth) {
5353
- const colKey = column.getKey();
5354
- if (colKey) {
5355
- columnWidthStorage[colKey] = column.renderWidth;
5356
- }
5357
- }
5358
- });
5359
- }
5360
- columnWidthStorageMap[id] = XEUtils.isEmpty(columnWidthStorage) ? undefined : columnWidthStorage;
5361
- localStorage.setItem(resizableStorageKey, XEUtils.toJSONString(columnWidthStorageMap));
5362
- }
5363
- },
5364
- saveCustomSort(isReset) {
5365
- const { id, customConfig } = props;
5287
+ saveCustomStore(type) {
5288
+ const { id } = props;
5366
5289
  const customOpts = computeCustomOpts.value;
5367
- const { collectColumn } = internalData;
5368
- const { storage } = customOpts;
5369
- const isAllStorage = storage === true;
5370
- const storageOpts = isAllStorage ? {} : Object.assign({}, storage || {});
5371
- const isSort = isAllStorage || storageOpts.sort;
5372
- if (customConfig && isSort) {
5373
- const columnSortStorageMap = getCustomStorageMap(sortStorageKey);
5374
- let columnWidthStorage;
5290
+ const { updateStore, storage } = customOpts;
5291
+ const isAllCustom = storage === true;
5292
+ const storageOpts = isAllCustom ? {} : Object.assign({}, storage || {});
5293
+ const isCustomResizable = isAllCustom || storageOpts.resizable;
5294
+ const isCustomVisible = isAllCustom || storageOpts.visible;
5295
+ const isCustomFixed = isAllCustom || storageOpts.fixed;
5296
+ const isCustomSort = isAllCustom || storageOpts.sort;
5297
+ if (isCustomResizable || isCustomVisible || isCustomFixed || isCustomSort) {
5375
5298
  if (!id) {
5376
5299
  errLog('vxe.error.reqProp', ['id']);
5377
- return;
5300
+ return nextTick();
5378
5301
  }
5379
- if (!isReset) {
5380
- columnWidthStorage = XEUtils.isPlainObject(columnSortStorageMap[id]) ? columnSortStorageMap[id] : {};
5381
- // 排序只支持一级
5382
- collectColumn.forEach((column) => {
5383
- const colKey = column.getKey();
5384
- if (colKey) {
5385
- columnWidthStorage[colKey] = column.renderSortNumber;
5386
- }
5302
+ const storeData = type === 'reset'
5303
+ ? {
5304
+ resizableData: {},
5305
+ sortData: {},
5306
+ visibleData: {},
5307
+ fixedData: {}
5308
+ }
5309
+ : tableMethods.getCustomStoreData();
5310
+ if (updateStore) {
5311
+ return updateStore({
5312
+ id,
5313
+ type,
5314
+ storeData
5387
5315
  });
5388
5316
  }
5389
- columnSortStorageMap[id] = XEUtils.isEmpty(columnWidthStorage) ? undefined : columnWidthStorage;
5390
- localStorage.setItem(sortStorageKey, XEUtils.toJSONString(columnSortStorageMap));
5391
- }
5392
- },
5393
- saveCustomFixed() {
5394
- const { id, customConfig } = props;
5395
- const { collectColumn } = internalData;
5396
- const customOpts = computeCustomOpts.value;
5397
- const { storage } = customOpts;
5398
- const isAllStorage = storage === true;
5399
- const storageOpts = isAllStorage ? {} : Object.assign({}, storage || {});
5400
- const isCustomFixed = isAllStorage || storageOpts.fixed;
5401
- if (customConfig && isCustomFixed) {
5402
- const columnFixedStorageMap = getCustomStorageMap(fixedStorageKey);
5403
- const colFixeds = [];
5404
- if (!id) {
5405
- errLog('vxe.error.reqProp', ['id']);
5406
- return;
5407
- }
5408
- XEUtils.eachTree(collectColumn, (column) => {
5409
- if (column.fixed && column.fixed !== column.defaultFixed) {
5410
- const colKey = column.getKey();
5411
- if (colKey) {
5412
- colFixeds.push(`${colKey}|${column.fixed}`);
5413
- }
5414
- }
5415
- });
5416
- columnFixedStorageMap[id] = colFixeds.join(',') || undefined;
5417
- localStorage.setItem(fixedStorageKey, XEUtils.toJSONString(columnFixedStorageMap));
5418
- }
5419
- },
5420
- saveCustomVisible() {
5421
- const { id, customConfig } = props;
5422
- const { collectColumn } = internalData;
5423
- const customOpts = computeCustomOpts.value;
5424
- const { checkMethod, storage } = customOpts;
5425
- const isAllStorage = storage === true;
5426
- const storageOpts = isAllStorage ? {} : Object.assign({}, storage || {});
5427
- const isCustomVisible = isAllStorage || storageOpts.visible;
5428
- if (customConfig && isCustomVisible) {
5429
- const columnVisibleStorageMap = getCustomStorageMap(visibleStorageKey);
5430
- const colHides = [];
5431
- const colShows = [];
5432
- if (!id) {
5433
- errLog('vxe.error.reqProp', ['id']);
5434
- return;
5317
+ else {
5318
+ setCustomStorageMap(id, type === 'reset' ? null : storeData);
5435
5319
  }
5436
- XEUtils.eachTree(collectColumn, (column) => {
5437
- if (!checkMethod || checkMethod({ column })) {
5438
- if (!column.visible && column.defaultVisible) {
5439
- const colKey = column.getKey();
5440
- if (colKey) {
5441
- colHides.push(colKey);
5442
- }
5443
- }
5444
- else if (column.visible && !column.defaultVisible) {
5445
- const colKey = column.getKey();
5446
- if (colKey) {
5447
- colShows.push(colKey);
5448
- }
5449
- }
5450
- }
5451
- });
5452
- columnVisibleStorageMap[id] = [colHides.join(',')].concat(colShows.length ? [colShows.join(',')] : []).join('|') || undefined;
5453
- localStorage.setItem(visibleStorageKey, XEUtils.toJSONString(columnVisibleStorageMap));
5454
5320
  }
5321
+ return nextTick();
5455
5322
  },
5456
5323
  handleCustom() {
5457
5324
  const { mouseConfig } = props;
@@ -5464,8 +5331,6 @@ export default defineComponent({
5464
5331
  $xeTable.clearCopyCellArea();
5465
5332
  }
5466
5333
  }
5467
- tablePrivateMethods.saveCustomVisible();
5468
- tablePrivateMethods.saveCustomSort();
5469
5334
  tablePrivateMethods.analyColumnWidth();
5470
5335
  return tableMethods.refreshColumn(true);
5471
5336
  },
package/es/ui/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { VxeUI } from 'vxe-pc-ui';
2
- VxeUI.version = "4.7.10";
3
- VxeUI.tableVersion = "4.7.10";
2
+ VxeUI.version = "4.7.11";
3
+ VxeUI.tableVersion = "4.7.11";
4
4
  VxeUI.setConfig({
5
5
  emptyCell: ' ',
6
6
  table: {
package/es/ui/src/log.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { VxeUI } from 'vxe-pc-ui';
2
2
  const { log } = VxeUI;
3
- const version = `table v${"4.7.10"}`;
3
+ const version = `table v${"4.7.11"}`;
4
4
  export const warnLog = log.create('warn', version);
5
5
  export const errLog = log.create('error', version);