vxe-table 4.15.0-beta.14 → 4.15.0-beta.16
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/table/module/custom/hook.js +23 -15
- package/es/table/src/columnInfo.js +2 -0
- package/es/table/src/table.js +133 -49
- package/es/table/src/util.js +9 -0
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/lib/index.umd.js +56 -32
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/table/module/custom/hook.js +26 -14
- package/lib/table/module/custom/hook.min.js +1 -1
- package/lib/table/src/columnInfo.js +2 -0
- package/lib/table/src/columnInfo.min.js +1 -1
- package/lib/table/src/table.js +16 -16
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +10 -0
- package/lib/table/src/util.min.js +1 -1
- package/lib/ui/index.js +1 -1
- 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 +1 -1
- package/packages/table/module/custom/hook.ts +22 -14
- package/packages/table/src/columnInfo.ts +3 -0
- package/packages/table/src/table.ts +137 -51
- package/packages/table/src/util.ts +10 -0
- /package/es/{iconfont.1753785070937.ttf → iconfont.1753864741935.ttf} +0 -0
- /package/es/{iconfont.1753785070937.woff → iconfont.1753864741935.woff} +0 -0
- /package/es/{iconfont.1753785070937.woff2 → iconfont.1753864741935.woff2} +0 -0
- /package/lib/{iconfont.1753785070937.ttf → iconfont.1753864741935.ttf} +0 -0
- /package/lib/{iconfont.1753785070937.woff → iconfont.1753864741935.woff} +0 -0
- /package/lib/{iconfont.1753785070937.woff2 → iconfont.1753864741935.woff2} +0 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { nextTick } from 'vue';
|
|
2
2
|
import { VxeUI } from '../../../ui';
|
|
3
3
|
import XEUtils from 'xe-utils';
|
|
4
|
+
import { getColumnList } from '../../src/util';
|
|
4
5
|
const tableCustomMethodKeys = ['openCustom', 'closeCustom', 'toggleCustom', 'saveCustom', 'cancelCustom', 'resetCustom', 'toggleCustomAllCheckbox', 'setCustomAllCheckbox'];
|
|
5
6
|
VxeUI.hooks.add('tableCustomModule', {
|
|
6
7
|
setupTable($xeTable) {
|
|
@@ -101,23 +102,22 @@ VxeUI.hooks.add('tableCustomModule', {
|
|
|
101
102
|
}
|
|
102
103
|
});
|
|
103
104
|
reactData.isCustomStatus = true;
|
|
104
|
-
|
|
105
|
-
if (
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
$xeTable.setRowGroups(aggHandleFields);
|
|
110
|
-
}
|
|
111
|
-
else {
|
|
112
|
-
$xeTable.clearRowGroups();
|
|
113
|
-
}
|
|
105
|
+
if (allowGroup && !!$xeTable.handlePivotTableAggregateData) {
|
|
106
|
+
if (rowGroupList.length !== aggHandleFields.length || rowGroupList.some((conf, i) => conf.field !== aggHandleFields[i])) {
|
|
107
|
+
// 更新数据分组
|
|
108
|
+
if (aggHandleFields.length) {
|
|
109
|
+
$xeTable.setRowGroups(aggHandleFields);
|
|
114
110
|
}
|
|
115
|
-
else
|
|
116
|
-
|
|
117
|
-
$xeTable.handleUpdateAggData();
|
|
111
|
+
else {
|
|
112
|
+
$xeTable.clearRowGroups();
|
|
118
113
|
}
|
|
119
114
|
}
|
|
120
|
-
|
|
115
|
+
else if (allowValues) {
|
|
116
|
+
// 更新聚合函数
|
|
117
|
+
$xeTable.handleUpdateAggData();
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return $xeTable.saveCustomStore('confirm');
|
|
121
121
|
};
|
|
122
122
|
const cancelCustom = () => {
|
|
123
123
|
const { customColumnList, customStore } = reactData;
|
|
@@ -202,6 +202,7 @@ VxeUI.hooks.add('tableCustomModule', {
|
|
|
202
202
|
sort: options === true,
|
|
203
203
|
aggFunc: options === true
|
|
204
204
|
}, options);
|
|
205
|
+
const allCols = [];
|
|
205
206
|
XEUtils.eachTree(collectColumn, (column) => {
|
|
206
207
|
if (opts.resizable) {
|
|
207
208
|
column.resizeWidth = 0;
|
|
@@ -211,6 +212,7 @@ VxeUI.hooks.add('tableCustomModule', {
|
|
|
211
212
|
}
|
|
212
213
|
if (opts.sort) {
|
|
213
214
|
column.renderSortNumber = column.sortNumber;
|
|
215
|
+
column.parentId = column.defaultParentId;
|
|
214
216
|
}
|
|
215
217
|
if (!checkMethod || checkMethod({ $table: $xeTable, column })) {
|
|
216
218
|
column.visible = column.defaultVisible;
|
|
@@ -220,9 +222,14 @@ VxeUI.hooks.add('tableCustomModule', {
|
|
|
220
222
|
column.renderAggFn = column.defaultAggFunc;
|
|
221
223
|
}
|
|
222
224
|
column.renderResizeWidth = column.renderWidth;
|
|
225
|
+
allCols.push(column);
|
|
223
226
|
});
|
|
227
|
+
if (opts.sort) {
|
|
228
|
+
const newCollectCols = XEUtils.toArrayTree(XEUtils.orderBy(allCols, 'renderSortNumber'), { key: 'id', parentKey: 'parentId', children: 'children' });
|
|
229
|
+
internalData.collectColumn = newCollectCols;
|
|
230
|
+
internalData.tableFullColumn = getColumnList(newCollectCols);
|
|
231
|
+
}
|
|
224
232
|
reactData.isCustomStatus = false;
|
|
225
|
-
$xeTable.saveCustomStore('reset');
|
|
226
233
|
return $xeTable.handleCustom().then(() => {
|
|
227
234
|
if (opts.aggFunc && $xeTable.handlePivotTableAggregateData) {
|
|
228
235
|
const rowGroupFields = computeRowGroupFields.value;
|
|
@@ -238,6 +245,7 @@ VxeUI.hooks.add('tableCustomModule', {
|
|
|
238
245
|
$xeTable.handleUpdateAggData();
|
|
239
246
|
}
|
|
240
247
|
}
|
|
248
|
+
$xeTable.saveCustomStore('reset');
|
|
241
249
|
});
|
|
242
250
|
},
|
|
243
251
|
toggleCustomAllCheckbox() {
|
|
@@ -112,9 +112,11 @@ export class ColumnInfo {
|
|
|
112
112
|
parentId: null,
|
|
113
113
|
visible,
|
|
114
114
|
// 内部属性(一旦被使用,将导致不可升级版本)
|
|
115
|
+
defaultParentId: null,
|
|
115
116
|
halfVisible: false,
|
|
116
117
|
defaultVisible: visible,
|
|
117
118
|
defaultFixed: _vm.fixed,
|
|
119
|
+
defaultAggGroup: _vm.aggGroup,
|
|
118
120
|
defaultAggFunc: _vm.aggFunc,
|
|
119
121
|
checked: false,
|
|
120
122
|
halfChecked: false,
|
package/es/table/src/table.js
CHANGED
|
@@ -4,7 +4,7 @@ import XEUtils from 'xe-utils';
|
|
|
4
4
|
import { initTpImg, getTpImg, isPx, isScale, hasClass, addClass, removeClass, getEventTargetNode, getPaddingTopBottomSize, setScrollTop, setScrollLeft, toCssUnit, hasControlKey } from '../../ui/src/dom';
|
|
5
5
|
import { getLastZIndex, nextZIndex, hasChildrenList, getFuncText, isEnableConf, formatText, eqEmptyValue } from '../../ui/src/utils';
|
|
6
6
|
import { VxeUI } from '../../ui';
|
|
7
|
-
import { getRowUniqueId, clearTableAllStatus, toFilters, hasDeepKey, getRowkey, getRowid, rowToVisible, colToVisible, getCellValue, setCellValue, handleRowidOrRow, handleFieldOrColumn, toTreePathSeq, restoreScrollLocation, getRootColumn, getRefElem, getColReMinWidth, createHandleUpdateRowId, createHandleGetRowId, getCalcHeight, getCellRestHeight } from './util';
|
|
7
|
+
import { getRowUniqueId, clearTableAllStatus, getColumnList, toFilters, hasDeepKey, getRowkey, getRowid, rowToVisible, colToVisible, getCellValue, setCellValue, handleRowidOrRow, handleFieldOrColumn, toTreePathSeq, restoreScrollLocation, getRootColumn, getRefElem, getColReMinWidth, createHandleUpdateRowId, createHandleGetRowId, getCalcHeight, getCellRestHeight } from './util';
|
|
8
8
|
import { getSlotVNs } from '../../ui/src/vn';
|
|
9
9
|
import { moveRowAnimateToTb, clearRowAnimate, moveColAnimateToLr, clearColAnimate } from './anime';
|
|
10
10
|
import { warnLog, errLog } from '../../ui/src/log';
|
|
@@ -1416,35 +1416,88 @@ export default defineVxeComponent({
|
|
|
1416
1416
|
return num;
|
|
1417
1417
|
};
|
|
1418
1418
|
const handleCustomRestore = (storeData) => {
|
|
1419
|
-
|
|
1420
|
-
const {
|
|
1421
|
-
|
|
1419
|
+
const { aggregateConfig, rowGroupConfig } = props;
|
|
1420
|
+
const { collectColumn } = internalData;
|
|
1421
|
+
const customOpts = computeCustomOpts.value;
|
|
1422
|
+
const { storage, storeOptions } = customOpts;
|
|
1423
|
+
const isAllCustom = storage === true;
|
|
1424
|
+
const storageOpts = isAllCustom ? {} : Object.assign({}, storage || {}, storeOptions);
|
|
1425
|
+
const isCustomResizable = hangleStorageDefaultValue(storageOpts.resizable, isAllCustom);
|
|
1426
|
+
const isCustomVisible = hangleStorageDefaultValue(storageOpts.visible, isAllCustom);
|
|
1427
|
+
const isCustomFixed = hangleStorageDefaultValue(storageOpts.fixed, isAllCustom);
|
|
1428
|
+
const isCustomSort = hangleStorageDefaultValue(storageOpts.sort, isAllCustom);
|
|
1429
|
+
const isCustomAggGroup = hangleStorageDefaultValue(storageOpts.aggGroup, isAllCustom);
|
|
1430
|
+
const isCustomAggFunc = hangleStorageDefaultValue(storageOpts.aggFunc, isAllCustom);
|
|
1431
|
+
let { resizableData, sortData, visibleData, fixedData, aggGroupData, aggFuncData } = storeData;
|
|
1422
1432
|
// 处理还原
|
|
1423
|
-
if (resizableData || sortData || visibleData || fixedData) {
|
|
1433
|
+
if ((isCustomResizable && resizableData) || (isCustomSort && sortData) || (isCustomVisible && visibleData) || (isCustomFixed && fixedData) || (isCustomAggGroup && aggGroupData) || (isCustomAggFunc && aggFuncData)) {
|
|
1434
|
+
const sortColMaps = {};
|
|
1435
|
+
if (isCustomSort && sortData) {
|
|
1436
|
+
// 转换兼容老版本数据,即将废弃兼容
|
|
1437
|
+
if (!XEUtils.isArray(sortData)) {
|
|
1438
|
+
const sortRests = [];
|
|
1439
|
+
XEUtils.each(sortData, (index, colKey) => {
|
|
1440
|
+
sortRests.push({ key: colKey, index });
|
|
1441
|
+
});
|
|
1442
|
+
sortData = XEUtils.orderBy(sortRests, { field: 'index', order: 'asc' }).map(item => ({ k: item.key }));
|
|
1443
|
+
}
|
|
1444
|
+
let colNum = 1;
|
|
1445
|
+
XEUtils.eachTree(sortData, (sObj, index, sOjs, path, pSObj) => {
|
|
1446
|
+
sortColMaps[sObj.k] = {
|
|
1447
|
+
key: sObj.k,
|
|
1448
|
+
sNum: colNum++,
|
|
1449
|
+
pKey: pSObj ? pSObj.k : null
|
|
1450
|
+
};
|
|
1451
|
+
}, { children: 'c' });
|
|
1452
|
+
}
|
|
1453
|
+
const colKeyMaps = {};
|
|
1454
|
+
const allCols = [];
|
|
1455
|
+
const aggGroupConfs = [];
|
|
1424
1456
|
XEUtils.eachTree(collectColumn, (column, index, items, path, parentColumn) => {
|
|
1425
1457
|
const colKey = column.getKey();
|
|
1426
1458
|
// 支持一级
|
|
1427
1459
|
if (!parentColumn) {
|
|
1428
|
-
if (fixedData && fixedData[colKey] !== undefined) {
|
|
1460
|
+
if (isCustomFixed && fixedData && fixedData[colKey] !== undefined) {
|
|
1429
1461
|
column.fixed = fixedData[colKey];
|
|
1430
1462
|
}
|
|
1431
|
-
if (sortData && XEUtils.isNumber(sortData[colKey])) {
|
|
1432
|
-
hasCustomSort = true;
|
|
1433
|
-
column.renderSortNumber = sortData[colKey];
|
|
1434
|
-
}
|
|
1435
1463
|
}
|
|
1436
|
-
if (resizableData && XEUtils.isNumber(resizableData[colKey])) {
|
|
1464
|
+
if (isCustomResizable && resizableData && XEUtils.isNumber(resizableData[colKey])) {
|
|
1437
1465
|
column.resizeWidth = resizableData[colKey];
|
|
1438
1466
|
}
|
|
1439
|
-
if (visibleData && XEUtils.isBoolean(visibleData[colKey])) {
|
|
1467
|
+
if (isCustomVisible && visibleData && XEUtils.isBoolean(visibleData[colKey])) {
|
|
1440
1468
|
column.visible = visibleData[colKey];
|
|
1441
1469
|
}
|
|
1470
|
+
if (isCustomAggFunc && aggFuncData && (aggregateConfig || rowGroupConfig) && aggFuncData[colKey]) {
|
|
1471
|
+
column.aggFunc = aggFuncData[colKey];
|
|
1472
|
+
}
|
|
1473
|
+
if (isCustomAggGroup && aggGroupData && aggGroupData[colKey]) {
|
|
1474
|
+
aggGroupConfs.push({ field: column.field });
|
|
1475
|
+
}
|
|
1476
|
+
colKeyMaps[colKey] = column;
|
|
1477
|
+
allCols.push(column);
|
|
1442
1478
|
});
|
|
1479
|
+
if ((aggregateConfig || rowGroupConfig) && aggGroupConfs.length) {
|
|
1480
|
+
const groupRest = handleGroupData(internalData.tableFullData, aggGroupConfs);
|
|
1481
|
+
internalData.tableFullTreeData = [];
|
|
1482
|
+
internalData.tableFullGroupData = groupRest.treeData;
|
|
1483
|
+
reactData.isRowGroupStatus = true;
|
|
1484
|
+
reactData.rowGroupList = aggGroupConfs;
|
|
1485
|
+
$xeTable.cacheRowMap(false);
|
|
1486
|
+
}
|
|
1443
1487
|
// 如果自定义了顺序
|
|
1444
|
-
if (
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1488
|
+
if (isCustomSort && sortData) {
|
|
1489
|
+
allCols.forEach(column => {
|
|
1490
|
+
const colKey = column.getKey();
|
|
1491
|
+
const scItem = sortColMaps[colKey];
|
|
1492
|
+
if (scItem) {
|
|
1493
|
+
const parentColumn = scItem.pKey ? colKeyMaps[scItem.pKey] : null;
|
|
1494
|
+
column.parentId = parentColumn ? parentColumn.id : null;
|
|
1495
|
+
column.renderSortNumber = scItem.sNum;
|
|
1496
|
+
}
|
|
1497
|
+
});
|
|
1498
|
+
const newCollectCols = XEUtils.toArrayTree(XEUtils.orderBy(allCols, 'renderSortNumber'), { key: 'id', parentKey: 'parentId', children: 'children' });
|
|
1499
|
+
internalData.collectColumn = newCollectCols;
|
|
1500
|
+
internalData.tableFullColumn = getColumnList(newCollectCols);
|
|
1448
1501
|
}
|
|
1449
1502
|
reactData.isCustomStatus = true;
|
|
1450
1503
|
}
|
|
@@ -1466,8 +1519,9 @@ export default defineVxeComponent({
|
|
|
1466
1519
|
const isCustomVisible = hangleStorageDefaultValue(storageOpts.visible, isAllCustom);
|
|
1467
1520
|
const isCustomFixed = hangleStorageDefaultValue(storageOpts.fixed, isAllCustom);
|
|
1468
1521
|
const isCustomSort = hangleStorageDefaultValue(storageOpts.sort, isAllCustom);
|
|
1522
|
+
const isCustomAggGroup = hangleStorageDefaultValue(storageOpts.aggGroup, isAllCustom);
|
|
1469
1523
|
const isCustomAggFunc = hangleStorageDefaultValue(storageOpts.aggFunc, isAllCustom);
|
|
1470
|
-
if (storage && (customConfig ? isEnableConf(customOpts) : customOpts.enabled) && (isCustomResizable || isCustomVisible || isCustomFixed || isCustomSort || isCustomAggFunc)) {
|
|
1524
|
+
if (storage && (customConfig ? isEnableConf(customOpts) : customOpts.enabled) && (isCustomResizable || isCustomVisible || isCustomFixed || isCustomSort || isCustomAggGroup || isCustomAggFunc)) {
|
|
1471
1525
|
if (!tableId) {
|
|
1472
1526
|
errLog('vxe.error.reqProp', ['id']);
|
|
1473
1527
|
return;
|
|
@@ -3102,18 +3156,18 @@ export default defineVxeComponent({
|
|
|
3102
3156
|
reactData.aggHandleAggColumns = aggCols;
|
|
3103
3157
|
};
|
|
3104
3158
|
const handleUpdateRowGroup = (groupFields) => {
|
|
3105
|
-
const
|
|
3106
|
-
const
|
|
3159
|
+
const aggGroupFields = [];
|
|
3160
|
+
const aggGroupConfs = [];
|
|
3107
3161
|
if (groupFields) {
|
|
3108
3162
|
(XEUtils.isArray(groupFields) ? groupFields : [groupFields]).forEach(field => {
|
|
3109
|
-
|
|
3110
|
-
|
|
3163
|
+
aggGroupFields.push(field);
|
|
3164
|
+
aggGroupConfs.push({
|
|
3111
3165
|
field
|
|
3112
3166
|
});
|
|
3113
3167
|
});
|
|
3114
3168
|
}
|
|
3115
|
-
reactData.rowGroupList =
|
|
3116
|
-
reactData.aggHandleFields =
|
|
3169
|
+
reactData.rowGroupList = aggGroupConfs;
|
|
3170
|
+
reactData.aggHandleFields = aggGroupFields;
|
|
3117
3171
|
handleUpdateAggValues();
|
|
3118
3172
|
};
|
|
3119
3173
|
const handleeGroupSummary = (aggList) => {
|
|
@@ -3476,14 +3530,6 @@ export default defineVxeComponent({
|
|
|
3476
3530
|
}
|
|
3477
3531
|
$xeTable.closeTooltip();
|
|
3478
3532
|
};
|
|
3479
|
-
// 获取所有的列,排除分组
|
|
3480
|
-
const getColumnList = (columns) => {
|
|
3481
|
-
const result = [];
|
|
3482
|
-
columns.forEach((column) => {
|
|
3483
|
-
result.push(...(column.children && column.children.length ? getColumnList(column.children) : [column]));
|
|
3484
|
-
});
|
|
3485
|
-
return result;
|
|
3486
|
-
};
|
|
3487
3533
|
const parseColumns = (isReset) => {
|
|
3488
3534
|
// const { showOverflow } = props
|
|
3489
3535
|
// const rowOpts = computeRowOpts.value
|
|
@@ -3503,7 +3549,7 @@ export default defineVxeComponent({
|
|
|
3503
3549
|
if (parentColumn && parentColumn.fixed) {
|
|
3504
3550
|
column.fixed = parentColumn.fixed;
|
|
3505
3551
|
}
|
|
3506
|
-
if (parentColumn && column.fixed !== parentColumn.fixed) {
|
|
3552
|
+
if (parentColumn && (column.fixed || '') !== (parentColumn.fixed || '')) {
|
|
3507
3553
|
errLog('vxe.error.groupFixed');
|
|
3508
3554
|
}
|
|
3509
3555
|
if (isColGroup) {
|
|
@@ -3614,21 +3660,25 @@ export default defineVxeComponent({
|
|
|
3614
3660
|
}
|
|
3615
3661
|
return $xeTable.updateFooter();
|
|
3616
3662
|
};
|
|
3617
|
-
const
|
|
3663
|
+
const initColumnHierarchy = () => {
|
|
3618
3664
|
const { collectColumn } = internalData;
|
|
3619
|
-
|
|
3620
|
-
|
|
3665
|
+
let sortIndex = 1;
|
|
3666
|
+
XEUtils.eachTree(collectColumn, (column, index, items, path, parentColumn) => {
|
|
3667
|
+
const parentId = parentColumn ? parentColumn.id : null;
|
|
3668
|
+
column.parentId = parentId;
|
|
3669
|
+
column.defaultParentId = parentId;
|
|
3621
3670
|
column.sortNumber = sortIndex;
|
|
3622
3671
|
column.renderSortNumber = sortIndex;
|
|
3672
|
+
sortIndex++;
|
|
3623
3673
|
});
|
|
3624
3674
|
};
|
|
3625
|
-
const
|
|
3675
|
+
const handleInitColumn = (collectColumn) => {
|
|
3626
3676
|
const expandOpts = computeExpandOpts.value;
|
|
3627
3677
|
internalData.collectColumn = collectColumn;
|
|
3628
3678
|
const tableFullColumn = getColumnList(collectColumn);
|
|
3629
3679
|
internalData.tableFullColumn = tableFullColumn;
|
|
3630
3680
|
reactData.isColLoading = true;
|
|
3631
|
-
|
|
3681
|
+
initColumnHierarchy();
|
|
3632
3682
|
return Promise.resolve(restoreCustomStorage()).then(() => {
|
|
3633
3683
|
const { scrollXLoad, scrollYLoad, expandColumn } = reactData;
|
|
3634
3684
|
cacheColumnMap();
|
|
@@ -4351,7 +4401,7 @@ export default defineVxeComponent({
|
|
|
4351
4401
|
loadColumn(columns) {
|
|
4352
4402
|
const { lastScrollLeft, lastScrollTop } = internalData;
|
|
4353
4403
|
const collectColumn = XEUtils.mapTree(columns, column => reactive(Cell.createColumn($xeTable, column)));
|
|
4354
|
-
return
|
|
4404
|
+
return handleInitColumn(collectColumn).then(() => {
|
|
4355
4405
|
let targetScrollLeft = lastScrollLeft;
|
|
4356
4406
|
let targetScrollTop = lastScrollTop;
|
|
4357
4407
|
const virtualXOpts = computeVirtualXOpts.value;
|
|
@@ -6768,7 +6818,8 @@ export default defineVxeComponent({
|
|
|
6768
6818
|
getCustomStoreData() {
|
|
6769
6819
|
const { id } = props;
|
|
6770
6820
|
const customOpts = computeCustomOpts.value;
|
|
6771
|
-
const {
|
|
6821
|
+
const { isRowGroupStatus, rowGroupList } = reactData;
|
|
6822
|
+
const { fullColumnFieldData, collectColumn } = internalData;
|
|
6772
6823
|
const { storage, checkMethod, storeOptions } = customOpts;
|
|
6773
6824
|
const isAllCustom = storage === true;
|
|
6774
6825
|
const storageOpts = isAllCustom ? {} : Object.assign({}, storage || {}, storeOptions);
|
|
@@ -6776,17 +6827,20 @@ export default defineVxeComponent({
|
|
|
6776
6827
|
const isCustomVisible = hangleStorageDefaultValue(storageOpts.visible, isAllCustom);
|
|
6777
6828
|
const isCustomFixed = hangleStorageDefaultValue(storageOpts.fixed, isAllCustom);
|
|
6778
6829
|
const isCustomSort = hangleStorageDefaultValue(storageOpts.sort, isAllCustom);
|
|
6830
|
+
const isCustomAggGroup = hangleStorageDefaultValue(storageOpts.aggGroup, isAllCustom);
|
|
6779
6831
|
const isCustomAggFunc = hangleStorageDefaultValue(storageOpts.aggFunc, isAllCustom);
|
|
6780
6832
|
const resizableData = {};
|
|
6781
|
-
const sortData =
|
|
6833
|
+
const sortData = [];
|
|
6782
6834
|
const visibleData = {};
|
|
6783
6835
|
const fixedData = {};
|
|
6836
|
+
const aggGroupData = {};
|
|
6784
6837
|
const aggFuncData = {};
|
|
6785
6838
|
const storeData = {
|
|
6786
6839
|
resizableData: undefined,
|
|
6787
6840
|
sortData: undefined,
|
|
6788
6841
|
visibleData: undefined,
|
|
6789
6842
|
fixedData: undefined,
|
|
6843
|
+
aggGroupData: undefined,
|
|
6790
6844
|
aggFuncData: undefined
|
|
6791
6845
|
};
|
|
6792
6846
|
if (!id) {
|
|
@@ -6800,19 +6854,37 @@ export default defineVxeComponent({
|
|
|
6800
6854
|
let hasFixed = 0;
|
|
6801
6855
|
let hasVisible = 0;
|
|
6802
6856
|
let hasAggFunc = 0;
|
|
6857
|
+
const sortMaps = {};
|
|
6803
6858
|
XEUtils.eachTree(collectColumn, (column, index, items, path, parentColumn) => {
|
|
6804
6859
|
const colKey = column.getKey();
|
|
6805
6860
|
if (!colKey) {
|
|
6806
6861
|
errLog('vxe.error.reqProp', [`${column.getTitle() || column.type || ''} -> column.field=?`]);
|
|
6807
6862
|
return;
|
|
6808
6863
|
}
|
|
6809
|
-
|
|
6810
|
-
if (!parentColumn) {
|
|
6864
|
+
if (parentColumn) {
|
|
6811
6865
|
if (isCustomSort) {
|
|
6866
|
+
const pColKey = parentColumn.getKey();
|
|
6867
|
+
const psObj = sortMaps[pColKey];
|
|
6812
6868
|
hasSort = 1;
|
|
6813
|
-
|
|
6869
|
+
if (psObj) {
|
|
6870
|
+
const sObj = { k: colKey };
|
|
6871
|
+
sortMaps[colKey] = sObj;
|
|
6872
|
+
if (!psObj.c) {
|
|
6873
|
+
psObj.c = [];
|
|
6874
|
+
}
|
|
6875
|
+
psObj.c.push(sObj);
|
|
6876
|
+
}
|
|
6814
6877
|
}
|
|
6815
|
-
|
|
6878
|
+
}
|
|
6879
|
+
else {
|
|
6880
|
+
if (isCustomSort) {
|
|
6881
|
+
hasSort = 1;
|
|
6882
|
+
const sObj = { k: colKey };
|
|
6883
|
+
sortMaps[colKey] = sObj;
|
|
6884
|
+
sortData.push(sObj);
|
|
6885
|
+
}
|
|
6886
|
+
// 只支持一级
|
|
6887
|
+
if (isCustomFixed && (column.fixed || '') !== (column.defaultFixed || '')) {
|
|
6816
6888
|
hasFixed = 1;
|
|
6817
6889
|
fixedData[colKey] = column.fixed;
|
|
6818
6890
|
}
|
|
@@ -6831,7 +6903,7 @@ export default defineVxeComponent({
|
|
|
6831
6903
|
visibleData[colKey] = true;
|
|
6832
6904
|
}
|
|
6833
6905
|
}
|
|
6834
|
-
if (isCustomAggFunc && column.aggFunc !== column.defaultAggFunc) {
|
|
6906
|
+
if (isCustomAggFunc && (column.aggFunc || '') !== (column.defaultAggFunc || '')) {
|
|
6835
6907
|
hasAggFunc = 1;
|
|
6836
6908
|
aggFuncData[colKey] = column.aggFunc;
|
|
6837
6909
|
}
|
|
@@ -6848,6 +6920,15 @@ export default defineVxeComponent({
|
|
|
6848
6920
|
if (hasVisible) {
|
|
6849
6921
|
storeData.visibleData = visibleData;
|
|
6850
6922
|
}
|
|
6923
|
+
if (isCustomAggGroup && isRowGroupStatus) {
|
|
6924
|
+
rowGroupList.forEach(aggConf => {
|
|
6925
|
+
const colRest = fullColumnFieldData[aggConf.field];
|
|
6926
|
+
if (colRest) {
|
|
6927
|
+
aggGroupData[colRest.column.getKey()] = true;
|
|
6928
|
+
}
|
|
6929
|
+
});
|
|
6930
|
+
storeData.aggGroupData = aggGroupData;
|
|
6931
|
+
}
|
|
6851
6932
|
if (hasAggFunc) {
|
|
6852
6933
|
storeData.aggFuncData = aggFuncData;
|
|
6853
6934
|
}
|
|
@@ -8297,12 +8378,13 @@ export default defineVxeComponent({
|
|
|
8297
8378
|
const isCustomVisible = hangleStorageDefaultValue(storageOpts.visible, isAllCustom);
|
|
8298
8379
|
const isCustomFixed = hangleStorageDefaultValue(storageOpts.fixed, isAllCustom);
|
|
8299
8380
|
const isCustomSort = hangleStorageDefaultValue(storageOpts.sort, isAllCustom);
|
|
8381
|
+
const isCustomAggGroup = hangleStorageDefaultValue(storageOpts.aggGroup, isAllCustom);
|
|
8300
8382
|
const isCustomAggFunc = hangleStorageDefaultValue(storageOpts.aggFunc, isAllCustom);
|
|
8301
8383
|
if (type !== 'reset') {
|
|
8302
8384
|
// fix:修复拖动列宽,重置按钮无法点击的问题
|
|
8303
8385
|
reactData.isCustomStatus = true;
|
|
8304
8386
|
}
|
|
8305
|
-
if (storage && (customConfig ? isEnableConf(customOpts) : customOpts.enabled) && (isCustomResizable || isCustomVisible || isCustomFixed || isCustomSort || isCustomAggFunc)) {
|
|
8387
|
+
if (storage && (customConfig ? isEnableConf(customOpts) : customOpts.enabled) && (isCustomResizable || isCustomVisible || isCustomFixed || isCustomSort || isCustomAggGroup || isCustomAggFunc)) {
|
|
8306
8388
|
if (!tableId) {
|
|
8307
8389
|
errLog('vxe.error.reqProp', ['id']);
|
|
8308
8390
|
return nextTick();
|
|
@@ -8310,9 +8392,11 @@ export default defineVxeComponent({
|
|
|
8310
8392
|
const storeData = type === 'reset'
|
|
8311
8393
|
? {
|
|
8312
8394
|
resizableData: {},
|
|
8313
|
-
sortData:
|
|
8395
|
+
sortData: [],
|
|
8314
8396
|
visibleData: {},
|
|
8315
|
-
fixedData: {}
|
|
8397
|
+
fixedData: {},
|
|
8398
|
+
aggGroupData: {},
|
|
8399
|
+
aggFuncData: {}
|
|
8316
8400
|
}
|
|
8317
8401
|
: tableMethods.getCustomStoreData();
|
|
8318
8402
|
if (updateStore) {
|
|
@@ -11585,7 +11669,7 @@ export default defineVxeComponent({
|
|
|
11585
11669
|
staticColumnFlag.value++;
|
|
11586
11670
|
});
|
|
11587
11671
|
watch(staticColumnFlag, () => {
|
|
11588
|
-
|
|
11672
|
+
nextTick(() => handleInitColumn(XEUtils.clone(reactData.staticColumns)));
|
|
11589
11673
|
});
|
|
11590
11674
|
const tableColumnFlag = ref(0);
|
|
11591
11675
|
watch(() => reactData.tableColumn.length, () => {
|
package/es/table/src/util.js
CHANGED
|
@@ -291,6 +291,14 @@ export function getColReMinWidth(params) {
|
|
|
291
291
|
export function isColumnInfo(column) {
|
|
292
292
|
return column && (column.constructor === ColumnInfo || column instanceof ColumnInfo);
|
|
293
293
|
}
|
|
294
|
+
// 获取所有的列,排除分组
|
|
295
|
+
export function getColumnList(columns) {
|
|
296
|
+
const result = [];
|
|
297
|
+
columns.forEach((column) => {
|
|
298
|
+
result.push(...(column.children && column.children.length ? getColumnList(column.children) : [column]));
|
|
299
|
+
});
|
|
300
|
+
return result;
|
|
301
|
+
}
|
|
294
302
|
export function createColumn($xeTable, options, renderOptions) {
|
|
295
303
|
return isColumnInfo(options) ? options : reactive(new ColumnInfo($xeTable, options, renderOptions));
|
|
296
304
|
}
|
|
@@ -317,6 +325,7 @@ export function assembleColumn($xeTable, elem, column, colgroup) {
|
|
|
317
325
|
const parentColumn = colgroup ? colgroup.columnConfig : null;
|
|
318
326
|
const parentCols = parentColumn ? parentColumn.children : staticColumns;
|
|
319
327
|
if (parentElem && parentCols) {
|
|
328
|
+
column.defaultParentId = parentColumn ? parentColumn.id : null;
|
|
320
329
|
parentCols.splice(XEUtils.arrayIndexOf(parentElem.children, elem), 0, column);
|
|
321
330
|
reactData.staticColumns = staticColumns.slice(0);
|
|
322
331
|
}
|
package/es/ui/index.js
CHANGED
package/es/ui/src/log.js
CHANGED