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/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/table/module/custom/panel.js +12 -22
- package/es/table/src/header.js +1 -1
- package/es/table/src/table.js +125 -256
- package/es/ui/index.js +2 -2
- package/es/ui/src/log.js +1 -1
- package/lib/index.umd.js +150 -327
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/table/module/custom/panel.js +11 -26
- package/lib/table/module/custom/panel.min.js +1 -1
- package/lib/table/src/header.js +1 -1
- package/lib/table/src/header.min.js +1 -1
- package/lib/table/src/table.js +137 -298
- package/lib/table/src/table.min.js +1 -1
- package/lib/ui/index.js +2 -2
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/package.json +2 -2
- package/packages/table/module/custom/panel.ts +12 -23
- package/packages/table/src/header.ts +1 -1
- package/packages/table/src/table.ts +124 -261
package/es/table/src/table.js
CHANGED
|
@@ -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
|
|
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,
|
|
@@ -243,7 +241,8 @@ export default defineComponent({
|
|
|
243
241
|
isFooter: false
|
|
244
242
|
},
|
|
245
243
|
scrollVMLoading: false,
|
|
246
|
-
_isResize: false
|
|
244
|
+
_isResize: false,
|
|
245
|
+
_isLoading: false
|
|
247
246
|
});
|
|
248
247
|
const internalData = {
|
|
249
248
|
tZindex: 0,
|
|
@@ -614,10 +613,18 @@ export default defineComponent({
|
|
|
614
613
|
const oIndex = orders.indexOf(currOrder) + 1;
|
|
615
614
|
return orders[oIndex < orders.length ? oIndex : 0];
|
|
616
615
|
};
|
|
617
|
-
const getCustomStorageMap = (
|
|
616
|
+
const getCustomStorageMap = (id) => {
|
|
618
617
|
const version = getConfig().version;
|
|
619
|
-
const rest = XEUtils.toStringJSON(localStorage.getItem(
|
|
620
|
-
|
|
618
|
+
const rest = XEUtils.toStringJSON(localStorage.getItem(customStorageKey) || '');
|
|
619
|
+
const maps = rest && rest._v === version ? rest : { _v: version };
|
|
620
|
+
return (id ? maps[id] : maps) || {};
|
|
621
|
+
};
|
|
622
|
+
const setCustomStorageMap = (id, data) => {
|
|
623
|
+
const version = getConfig().version;
|
|
624
|
+
const maps = getCustomStorageMap();
|
|
625
|
+
maps[id] = data || undefined;
|
|
626
|
+
maps._v = version;
|
|
627
|
+
localStorage.setItem(customStorageKey, XEUtils.toJSONString(maps));
|
|
621
628
|
};
|
|
622
629
|
const getRecoverRowMaps = (keyMaps) => {
|
|
623
630
|
const { fullAllDataRowIdData } = internalData;
|
|
@@ -815,8 +822,9 @@ export default defineComponent({
|
|
|
815
822
|
/**
|
|
816
823
|
* 还原自定义列操作状态
|
|
817
824
|
*/
|
|
818
|
-
const restoreCustomStorage = () => {
|
|
825
|
+
const restoreCustomStorage = () => __awaiter(this, void 0, void 0, function* () {
|
|
819
826
|
const { id, customConfig } = props;
|
|
827
|
+
const { tableFullColumn } = internalData;
|
|
820
828
|
const customOpts = computeCustomOpts.value;
|
|
821
829
|
const { storage, restoreStore } = customOpts;
|
|
822
830
|
const isAllCustom = storage === true;
|
|
@@ -825,116 +833,48 @@ export default defineComponent({
|
|
|
825
833
|
const isCustomVisible = isAllCustom || storageOpts.visible;
|
|
826
834
|
const isCustomFixed = isAllCustom || storageOpts.fixed;
|
|
827
835
|
const isCustomSort = isAllCustom || storageOpts.sort;
|
|
828
|
-
if (storage && id && restoreStore) {
|
|
829
|
-
restoreStore({ id });
|
|
830
|
-
}
|
|
831
836
|
if (customConfig && (isCustomResizable || isCustomVisible || isCustomFixed || isCustomSort)) {
|
|
832
|
-
const customMap = {};
|
|
833
837
|
if (!id) {
|
|
834
838
|
errLog('vxe.error.reqProp', ['id']);
|
|
835
839
|
return;
|
|
836
840
|
}
|
|
837
|
-
|
|
838
|
-
if (
|
|
839
|
-
|
|
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
|
-
}
|
|
841
|
+
let storeData = getCustomStorageMap(id);
|
|
842
|
+
if (restoreStore) {
|
|
843
|
+
storeData = yield restoreStore({ id, type: 'restore', storeData });
|
|
879
844
|
}
|
|
880
|
-
|
|
881
|
-
|
|
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
|
-
}
|
|
845
|
+
if (!storeData) {
|
|
846
|
+
return;
|
|
904
847
|
}
|
|
905
848
|
let { collectColumn } = internalData;
|
|
906
|
-
const
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
const column = keyMap[colKey];
|
|
915
|
-
if (column) {
|
|
916
|
-
if (XEUtils.isNumber(resizeWidth)) {
|
|
917
|
-
column.resizeWidth = resizeWidth;
|
|
849
|
+
const { resizableData, sortData, visibleData, fixedData } = storeData;
|
|
850
|
+
let hasCustomSort = false;
|
|
851
|
+
// 处理还原
|
|
852
|
+
if (resizableData || sortData || visibleData || fixedData) {
|
|
853
|
+
tableFullColumn.forEach(column => {
|
|
854
|
+
const colKey = column.getKey();
|
|
855
|
+
if (resizableData && XEUtils.isNumber(resizableData[colKey])) {
|
|
856
|
+
column.resizeWidth = resizableData[colKey];
|
|
918
857
|
}
|
|
919
|
-
if (XEUtils.isBoolean(
|
|
920
|
-
column.visible =
|
|
858
|
+
if (visibleData && XEUtils.isBoolean(visibleData[colKey])) {
|
|
859
|
+
column.visible = visibleData[colKey];
|
|
921
860
|
}
|
|
922
|
-
if (
|
|
923
|
-
column.fixed =
|
|
861
|
+
if (fixedData && fixedData[colKey]) {
|
|
862
|
+
column.fixed = fixedData[colKey];
|
|
924
863
|
}
|
|
925
|
-
if (
|
|
926
|
-
|
|
864
|
+
if (sortData && XEUtils.isNumber(sortData[colKey])) {
|
|
865
|
+
hasCustomSort = true;
|
|
866
|
+
column.renderSortNumber = sortData[colKey];
|
|
927
867
|
}
|
|
868
|
+
});
|
|
869
|
+
// 如果自定义了顺序
|
|
870
|
+
if (hasCustomSort) {
|
|
871
|
+
collectColumn = XEUtils.orderBy(collectColumn, 'renderSortNumber');
|
|
872
|
+
internalData.collectColumn = collectColumn;
|
|
873
|
+
internalData.tableFullColumn = getColumnList(collectColumn);
|
|
928
874
|
}
|
|
929
|
-
});
|
|
930
|
-
// 如果自定义了顺序
|
|
931
|
-
if (hasCustomSort) {
|
|
932
|
-
collectColumn = XEUtils.orderBy(collectColumn, 'renderSortNumber');
|
|
933
|
-
internalData.collectColumn = collectColumn;
|
|
934
|
-
internalData.tableFullColumn = getColumnList(collectColumn);
|
|
935
875
|
}
|
|
936
876
|
}
|
|
937
|
-
};
|
|
877
|
+
});
|
|
938
878
|
/**
|
|
939
879
|
* 更新数据列的 Map
|
|
940
880
|
* 牺牲数据组装的耗时,用来换取使用过程中的流畅
|
|
@@ -2479,27 +2419,30 @@ export default defineComponent({
|
|
|
2479
2419
|
internalData.collectColumn = collectColumn;
|
|
2480
2420
|
const tableFullColumn = getColumnList(collectColumn);
|
|
2481
2421
|
internalData.tableFullColumn = tableFullColumn;
|
|
2422
|
+
reactData._isLoading = true;
|
|
2482
2423
|
initColumnSort();
|
|
2483
|
-
restoreCustomStorage()
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
if (
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
return nextTick().then(() => {
|
|
2499
|
-
if ($xeToolbar) {
|
|
2500
|
-
$xeToolbar.syncUpdate({ collectColumn, $table: $xeTable });
|
|
2424
|
+
return restoreCustomStorage().then(() => {
|
|
2425
|
+
reactData._isLoading = false;
|
|
2426
|
+
cacheColumnMap();
|
|
2427
|
+
parseColumns().then(() => {
|
|
2428
|
+
if (reactData.scrollXLoad) {
|
|
2429
|
+
loadScrollXData();
|
|
2430
|
+
}
|
|
2431
|
+
});
|
|
2432
|
+
tableMethods.clearMergeCells();
|
|
2433
|
+
tableMethods.clearMergeFooterItems();
|
|
2434
|
+
tablePrivateMethods.handleTableData(true);
|
|
2435
|
+
if (process.env.NODE_ENV === 'development') {
|
|
2436
|
+
if ((reactData.scrollXLoad || reactData.scrollYLoad) && reactData.expandColumn) {
|
|
2437
|
+
warnLog('vxe.error.scrollErrProp', ['column.type=expand']);
|
|
2438
|
+
}
|
|
2501
2439
|
}
|
|
2502
|
-
return
|
|
2440
|
+
return nextTick().then(() => {
|
|
2441
|
+
if ($xeToolbar) {
|
|
2442
|
+
$xeToolbar.syncUpdate({ collectColumn, $table: $xeTable });
|
|
2443
|
+
}
|
|
2444
|
+
return tableMethods.recalculate();
|
|
2445
|
+
});
|
|
2503
2446
|
});
|
|
2504
2447
|
};
|
|
2505
2448
|
const updateScrollYStatus = (fullData) => {
|
|
@@ -3206,7 +3149,7 @@ export default defineComponent({
|
|
|
3206
3149
|
XEUtils.eachTree([targetColumn], (column) => {
|
|
3207
3150
|
column.fixed = fixed;
|
|
3208
3151
|
});
|
|
3209
|
-
tablePrivateMethods.
|
|
3152
|
+
tablePrivateMethods.saveCustomStore('update:fixed');
|
|
3210
3153
|
return tableMethods.refreshColumn();
|
|
3211
3154
|
}
|
|
3212
3155
|
return nextTick();
|
|
@@ -3221,7 +3164,7 @@ export default defineComponent({
|
|
|
3221
3164
|
XEUtils.eachTree([targetColumn], (column) => {
|
|
3222
3165
|
column.fixed = null;
|
|
3223
3166
|
});
|
|
3224
|
-
tablePrivateMethods.
|
|
3167
|
+
tablePrivateMethods.saveCustomStore('update:fixed');
|
|
3225
3168
|
return tableMethods.refreshColumn();
|
|
3226
3169
|
}
|
|
3227
3170
|
return nextTick();
|
|
@@ -3300,15 +3243,7 @@ export default defineComponent({
|
|
|
3300
3243
|
}
|
|
3301
3244
|
column.renderResizeWidth = column.renderWidth;
|
|
3302
3245
|
});
|
|
3303
|
-
|
|
3304
|
-
tablePrivateMethods.saveCustomResizable(true);
|
|
3305
|
-
}
|
|
3306
|
-
if (opts.sort) {
|
|
3307
|
-
tablePrivateMethods.saveCustomSort(true);
|
|
3308
|
-
}
|
|
3309
|
-
if (opts.fixed) {
|
|
3310
|
-
tablePrivateMethods.saveCustomFixed();
|
|
3311
|
-
}
|
|
3246
|
+
$xeTable.saveCustomStore('reset');
|
|
3312
3247
|
return tablePrivateMethods.handleCustom();
|
|
3313
3248
|
},
|
|
3314
3249
|
/**
|
|
@@ -4474,21 +4409,26 @@ export default defineComponent({
|
|
|
4474
4409
|
const visibleData = {};
|
|
4475
4410
|
const fixedData = {};
|
|
4476
4411
|
const storeData = {
|
|
4477
|
-
resizableData,
|
|
4478
|
-
sortData,
|
|
4479
|
-
visibleData,
|
|
4480
|
-
fixedData
|
|
4412
|
+
resizableData: undefined,
|
|
4413
|
+
sortData: undefined,
|
|
4414
|
+
visibleData: undefined,
|
|
4415
|
+
fixedData: undefined
|
|
4481
4416
|
};
|
|
4482
4417
|
if (!id) {
|
|
4483
4418
|
errLog('vxe.error.reqProp', ['id']);
|
|
4484
4419
|
return storeData;
|
|
4485
4420
|
}
|
|
4421
|
+
let hasResizable = 0;
|
|
4422
|
+
let hasSort = 0;
|
|
4423
|
+
let hasFixedt = 0;
|
|
4424
|
+
let hasVisible = 0;
|
|
4486
4425
|
XEUtils.eachTree(collectColumn, (column, index, items, path, parent) => {
|
|
4487
4426
|
// 排序只支持一级
|
|
4488
4427
|
if (!parent) {
|
|
4489
4428
|
collectColumn.forEach((column) => {
|
|
4490
4429
|
const colKey = column.getKey();
|
|
4491
4430
|
if (colKey) {
|
|
4431
|
+
hasSort = 1;
|
|
4492
4432
|
sortData[colKey] = column.renderSortNumber;
|
|
4493
4433
|
}
|
|
4494
4434
|
});
|
|
@@ -4496,12 +4436,14 @@ export default defineComponent({
|
|
|
4496
4436
|
if (column.resizeWidth) {
|
|
4497
4437
|
const colKey = column.getKey();
|
|
4498
4438
|
if (colKey) {
|
|
4439
|
+
hasResizable = 1;
|
|
4499
4440
|
resizableData[colKey] = column.renderWidth;
|
|
4500
4441
|
}
|
|
4501
4442
|
}
|
|
4502
4443
|
if (column.fixed && column.fixed !== column.defaultFixed) {
|
|
4503
4444
|
const colKey = column.getKey();
|
|
4504
4445
|
if (colKey) {
|
|
4446
|
+
hasFixedt = 1;
|
|
4505
4447
|
fixedData[colKey] = column.fixed;
|
|
4506
4448
|
}
|
|
4507
4449
|
}
|
|
@@ -4509,17 +4451,31 @@ export default defineComponent({
|
|
|
4509
4451
|
if (!column.visible && column.defaultVisible) {
|
|
4510
4452
|
const colKey = column.getKey();
|
|
4511
4453
|
if (colKey) {
|
|
4454
|
+
hasVisible = 1;
|
|
4512
4455
|
visibleData[colKey] = false;
|
|
4513
4456
|
}
|
|
4514
4457
|
}
|
|
4515
4458
|
else if (column.visible && !column.defaultVisible) {
|
|
4516
4459
|
const colKey = column.getKey();
|
|
4517
4460
|
if (colKey) {
|
|
4461
|
+
hasVisible = 1;
|
|
4518
4462
|
visibleData[colKey] = true;
|
|
4519
4463
|
}
|
|
4520
4464
|
}
|
|
4521
4465
|
}
|
|
4522
4466
|
});
|
|
4467
|
+
if (hasResizable) {
|
|
4468
|
+
storeData.resizableData = resizableData;
|
|
4469
|
+
}
|
|
4470
|
+
if (hasSort) {
|
|
4471
|
+
storeData.sortData = sortData;
|
|
4472
|
+
}
|
|
4473
|
+
if (hasFixedt) {
|
|
4474
|
+
storeData.fixedData = fixedData;
|
|
4475
|
+
}
|
|
4476
|
+
if (hasVisible) {
|
|
4477
|
+
storeData.visibleData = visibleData;
|
|
4478
|
+
}
|
|
4523
4479
|
return storeData;
|
|
4524
4480
|
},
|
|
4525
4481
|
focus() {
|
|
@@ -5331,127 +5287,41 @@ export default defineComponent({
|
|
|
5331
5287
|
});
|
|
5332
5288
|
Object.assign(reactData.columnStore, { resizeList, pxList, pxMinList, scaleList, scaleMinList, autoList });
|
|
5333
5289
|
},
|
|
5334
|
-
|
|
5335
|
-
const { id
|
|
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;
|
|
5290
|
+
saveCustomStore(type) {
|
|
5291
|
+
const { id } = props;
|
|
5366
5292
|
const customOpts = computeCustomOpts.value;
|
|
5367
|
-
const {
|
|
5368
|
-
const
|
|
5369
|
-
const
|
|
5370
|
-
const
|
|
5371
|
-
const
|
|
5372
|
-
|
|
5373
|
-
|
|
5374
|
-
|
|
5293
|
+
const { updateStore, storage } = customOpts;
|
|
5294
|
+
const isAllCustom = storage === true;
|
|
5295
|
+
const storageOpts = isAllCustom ? {} : Object.assign({}, storage || {});
|
|
5296
|
+
const isCustomResizable = isAllCustom || storageOpts.resizable;
|
|
5297
|
+
const isCustomVisible = isAllCustom || storageOpts.visible;
|
|
5298
|
+
const isCustomFixed = isAllCustom || storageOpts.fixed;
|
|
5299
|
+
const isCustomSort = isAllCustom || storageOpts.sort;
|
|
5300
|
+
if (isCustomResizable || isCustomVisible || isCustomFixed || isCustomSort) {
|
|
5375
5301
|
if (!id) {
|
|
5376
5302
|
errLog('vxe.error.reqProp', ['id']);
|
|
5377
|
-
return;
|
|
5303
|
+
return nextTick();
|
|
5378
5304
|
}
|
|
5379
|
-
|
|
5380
|
-
|
|
5381
|
-
|
|
5382
|
-
|
|
5383
|
-
|
|
5384
|
-
|
|
5385
|
-
|
|
5386
|
-
|
|
5305
|
+
const storeData = type === 'reset'
|
|
5306
|
+
? {
|
|
5307
|
+
resizableData: {},
|
|
5308
|
+
sortData: {},
|
|
5309
|
+
visibleData: {},
|
|
5310
|
+
fixedData: {}
|
|
5311
|
+
}
|
|
5312
|
+
: tableMethods.getCustomStoreData();
|
|
5313
|
+
if (updateStore) {
|
|
5314
|
+
return updateStore({
|
|
5315
|
+
id,
|
|
5316
|
+
type,
|
|
5317
|
+
storeData
|
|
5387
5318
|
});
|
|
5388
5319
|
}
|
|
5389
|
-
|
|
5390
|
-
|
|
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;
|
|
5320
|
+
else {
|
|
5321
|
+
setCustomStorageMap(id, type === 'reset' ? null : storeData);
|
|
5435
5322
|
}
|
|
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
5323
|
}
|
|
5324
|
+
return nextTick();
|
|
5455
5325
|
},
|
|
5456
5326
|
handleCustom() {
|
|
5457
5327
|
const { mouseConfig } = props;
|
|
@@ -5464,8 +5334,6 @@ export default defineComponent({
|
|
|
5464
5334
|
$xeTable.clearCopyCellArea();
|
|
5465
5335
|
}
|
|
5466
5336
|
}
|
|
5467
|
-
tablePrivateMethods.saveCustomVisible();
|
|
5468
|
-
tablePrivateMethods.saveCustomSort();
|
|
5469
5337
|
tablePrivateMethods.analyColumnWidth();
|
|
5470
5338
|
return tableMethods.refreshColumn(true);
|
|
5471
5339
|
},
|
|
@@ -6852,6 +6720,7 @@ export default defineComponent({
|
|
|
6852
6720
|
const validTipOpts = computeValidTipOpts.value;
|
|
6853
6721
|
const loadingOpts = computeLoadingOpts.value;
|
|
6854
6722
|
const isMenu = computeIsMenu.value;
|
|
6723
|
+
const currLoading = reactData._isLoading || loading;
|
|
6855
6724
|
return h('div', {
|
|
6856
6725
|
ref: refElem,
|
|
6857
6726
|
class: ['vxe-table', 'vxe-table--render-default', `tid_${xID}`, `border--${tableBorder}`, {
|
|
@@ -6873,8 +6742,8 @@ export default defineComponent({
|
|
|
6873
6742
|
'is--animat': !!props.animat,
|
|
6874
6743
|
'is--round': props.round,
|
|
6875
6744
|
'is--stripe': !treeConfig && stripe,
|
|
6876
|
-
'is--loading':
|
|
6877
|
-
'is--empty': !
|
|
6745
|
+
'is--loading': currLoading,
|
|
6746
|
+
'is--empty': !currLoading && !tableData.length,
|
|
6878
6747
|
'is--scroll-y': overflowY,
|
|
6879
6748
|
'is--scroll-x': overflowX,
|
|
6880
6749
|
'is--virtual-x': scrollXLoad,
|
|
@@ -6971,7 +6840,7 @@ export default defineComponent({
|
|
|
6971
6840
|
*/
|
|
6972
6841
|
h(resolveComponent('vxe-loading'), {
|
|
6973
6842
|
class: 'vxe-table--loading',
|
|
6974
|
-
modelValue:
|
|
6843
|
+
modelValue: currLoading,
|
|
6975
6844
|
icon: loadingOpts.icon,
|
|
6976
6845
|
text: loadingOpts.text
|
|
6977
6846
|
}, loadingSlot
|
package/es/ui/index.js
CHANGED
package/es/ui/src/log.js
CHANGED