vxe-table 4.15.0-beta.9 → 4.15.1
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/grid/src/grid.js +57 -9
- package/es/style.css +1 -1
- package/es/table/module/custom/hook.js +29 -14
- package/es/table/module/custom/panel.js +1 -1
- package/es/table/module/edit/hook.js +5 -5
- package/es/table/src/body.js +7 -6
- package/es/table/src/columnInfo.js +2 -0
- package/es/table/src/table.js +235 -90
- package/es/table/src/util.js +9 -0
- package/es/ui/index.js +3 -1
- package/es/ui/src/log.js +1 -1
- package/lib/grid/src/grid.js +67 -9
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/index.umd.js +156 -57
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/table/module/custom/hook.js +34 -13
- package/lib/table/module/custom/hook.min.js +1 -1
- package/lib/table/module/custom/panel.js +1 -1
- package/lib/table/module/custom/panel.min.js +1 -1
- package/lib/table/module/edit/hook.js +5 -0
- package/lib/table/module/edit/hook.min.js +1 -1
- package/lib/table/src/body.js +7 -6
- package/lib/table/src/body.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 +26 -26
- 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 +3 -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 +2 -2
- package/packages/grid/src/grid.ts +62 -9
- package/packages/table/module/custom/hook.ts +28 -13
- package/packages/table/module/custom/panel.ts +1 -1
- package/packages/table/module/edit/hook.ts +5 -5
- package/packages/table/src/body.ts +7 -6
- package/packages/table/src/columnInfo.ts +3 -0
- package/packages/table/src/table.ts +248 -90
- package/packages/table/src/util.ts +10 -0
- package/packages/ui/index.ts +2 -0
- /package/es/{iconfont.1753497319436.ttf → iconfont.1754358078563.ttf} +0 -0
- /package/es/{iconfont.1753497319436.woff → iconfont.1754358078563.woff} +0 -0
- /package/es/{iconfont.1753497319436.woff2 → iconfont.1754358078563.woff2} +0 -0
- /package/lib/{iconfont.1753497319436.ttf → iconfont.1754358078563.ttf} +0 -0
- /package/lib/{iconfont.1753497319436.woff → iconfont.1754358078563.woff} +0 -0
- /package/lib/{iconfont.1753497319436.woff2 → iconfont.1754358078563.woff2} +0 -0
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';
|
|
@@ -473,10 +473,18 @@ export default defineVxeComponent({
|
|
|
473
473
|
return virtualYOpts;
|
|
474
474
|
});
|
|
475
475
|
const computeVirtualXOpts = computed(() => {
|
|
476
|
-
|
|
476
|
+
const { virtualXConfig } = props;
|
|
477
|
+
if (virtualXConfig) {
|
|
478
|
+
return Object.assign({}, getConfig().table.virtualXConfig, virtualXConfig);
|
|
479
|
+
}
|
|
480
|
+
return Object.assign({}, getConfig().table.virtualXConfig, getConfig().table.scrollX, props.scrollX);
|
|
477
481
|
});
|
|
478
482
|
const computeVirtualYOpts = computed(() => {
|
|
479
|
-
|
|
483
|
+
const { virtualYConfig } = props;
|
|
484
|
+
if (virtualYConfig) {
|
|
485
|
+
return Object.assign({}, getConfig().table.virtualYConfig, virtualYConfig);
|
|
486
|
+
}
|
|
487
|
+
return Object.assign({}, getConfig().table.virtualYConfig, getConfig().table.scrollY, props.scrollY);
|
|
480
488
|
});
|
|
481
489
|
const computeScrollbarOpts = computed(() => {
|
|
482
490
|
return Object.assign({}, getConfig().table.scrollbarConfig, props.scrollbarConfig);
|
|
@@ -1327,16 +1335,23 @@ export default defineVxeComponent({
|
|
|
1327
1335
|
return rest;
|
|
1328
1336
|
};
|
|
1329
1337
|
const handleSortEvent = (evnt, sortConfs, isUpdate) => {
|
|
1338
|
+
const { tableFullColumn } = internalData;
|
|
1330
1339
|
const sortOpts = computeSortOpts.value;
|
|
1331
1340
|
const { multiple, remote, orders } = sortOpts;
|
|
1332
1341
|
if (!XEUtils.isArray(sortConfs)) {
|
|
1333
1342
|
sortConfs = [sortConfs];
|
|
1334
1343
|
}
|
|
1335
1344
|
if (sortConfs && sortConfs.length) {
|
|
1345
|
+
const orderActiveMaps = {};
|
|
1336
1346
|
if (!multiple) {
|
|
1337
1347
|
sortConfs = [sortConfs[0]];
|
|
1338
|
-
|
|
1348
|
+
tableFullColumn.forEach((column) => {
|
|
1349
|
+
if (column.order) {
|
|
1350
|
+
orderActiveMaps[column.id] = column;
|
|
1351
|
+
}
|
|
1352
|
+
});
|
|
1339
1353
|
}
|
|
1354
|
+
const sortColMpps = {};
|
|
1340
1355
|
let firstColumn = null;
|
|
1341
1356
|
sortConfs.forEach((confs, index) => {
|
|
1342
1357
|
let { field, order } = confs;
|
|
@@ -1355,8 +1370,16 @@ export default defineVxeComponent({
|
|
|
1355
1370
|
column.order = order;
|
|
1356
1371
|
}
|
|
1357
1372
|
column.sortTime = Date.now() + index;
|
|
1373
|
+
sortColMpps[column.id] = column;
|
|
1358
1374
|
}
|
|
1359
1375
|
});
|
|
1376
|
+
if (!multiple) {
|
|
1377
|
+
XEUtils.each(orderActiveMaps, (oaCol, oaId) => {
|
|
1378
|
+
if (!sortColMpps[oaId]) {
|
|
1379
|
+
oaCol.order = null;
|
|
1380
|
+
}
|
|
1381
|
+
});
|
|
1382
|
+
}
|
|
1360
1383
|
if (isUpdate) {
|
|
1361
1384
|
if (!remote) {
|
|
1362
1385
|
$xeTable.handleTableData(true);
|
|
@@ -1401,35 +1424,88 @@ export default defineVxeComponent({
|
|
|
1401
1424
|
return num;
|
|
1402
1425
|
};
|
|
1403
1426
|
const handleCustomRestore = (storeData) => {
|
|
1404
|
-
|
|
1405
|
-
const {
|
|
1406
|
-
|
|
1427
|
+
const { aggregateConfig, rowGroupConfig } = props;
|
|
1428
|
+
const { collectColumn } = internalData;
|
|
1429
|
+
const customOpts = computeCustomOpts.value;
|
|
1430
|
+
const { storage, storeOptions } = customOpts;
|
|
1431
|
+
const isAllCustom = storage === true;
|
|
1432
|
+
const storageOpts = isAllCustom ? {} : Object.assign({}, storage || {}, storeOptions);
|
|
1433
|
+
const isCustomResizable = hangleStorageDefaultValue(storageOpts.resizable, isAllCustom);
|
|
1434
|
+
const isCustomVisible = hangleStorageDefaultValue(storageOpts.visible, isAllCustom);
|
|
1435
|
+
const isCustomFixed = hangleStorageDefaultValue(storageOpts.fixed, isAllCustom);
|
|
1436
|
+
const isCustomSort = hangleStorageDefaultValue(storageOpts.sort, isAllCustom);
|
|
1437
|
+
const isCustomAggGroup = hangleStorageDefaultValue(storageOpts.aggGroup, isAllCustom);
|
|
1438
|
+
const isCustomAggFunc = hangleStorageDefaultValue(storageOpts.aggFunc, isAllCustom);
|
|
1439
|
+
let { resizableData, sortData, visibleData, fixedData, aggGroupData, aggFuncData } = storeData;
|
|
1407
1440
|
// 处理还原
|
|
1408
|
-
if (resizableData || sortData || visibleData || fixedData) {
|
|
1441
|
+
if ((isCustomResizable && resizableData) || (isCustomSort && sortData) || (isCustomVisible && visibleData) || (isCustomFixed && fixedData) || (isCustomAggGroup && aggGroupData) || (isCustomAggFunc && aggFuncData)) {
|
|
1442
|
+
const sortColMaps = {};
|
|
1443
|
+
if (isCustomSort && sortData) {
|
|
1444
|
+
// 转换兼容老版本数据,即将废弃兼容
|
|
1445
|
+
if (!XEUtils.isArray(sortData)) {
|
|
1446
|
+
const sortRests = [];
|
|
1447
|
+
XEUtils.each(sortData, (index, colKey) => {
|
|
1448
|
+
sortRests.push({ key: colKey, index });
|
|
1449
|
+
});
|
|
1450
|
+
sortData = XEUtils.orderBy(sortRests, { field: 'index', order: 'asc' }).map(item => ({ k: item.key }));
|
|
1451
|
+
}
|
|
1452
|
+
let colNum = 1;
|
|
1453
|
+
XEUtils.eachTree(sortData, (sObj, index, sOjs, path, pSObj) => {
|
|
1454
|
+
sortColMaps[sObj.k] = {
|
|
1455
|
+
key: sObj.k,
|
|
1456
|
+
sNum: colNum++,
|
|
1457
|
+
pKey: pSObj ? pSObj.k : null
|
|
1458
|
+
};
|
|
1459
|
+
}, { children: 'c' });
|
|
1460
|
+
}
|
|
1461
|
+
const colKeyMaps = {};
|
|
1462
|
+
const allCols = [];
|
|
1463
|
+
const aggGroupConfs = [];
|
|
1409
1464
|
XEUtils.eachTree(collectColumn, (column, index, items, path, parentColumn) => {
|
|
1410
1465
|
const colKey = column.getKey();
|
|
1411
1466
|
// 支持一级
|
|
1412
1467
|
if (!parentColumn) {
|
|
1413
|
-
if (fixedData && fixedData[colKey] !== undefined) {
|
|
1468
|
+
if (isCustomFixed && fixedData && fixedData[colKey] !== undefined) {
|
|
1414
1469
|
column.fixed = fixedData[colKey];
|
|
1415
1470
|
}
|
|
1416
|
-
if (sortData && XEUtils.isNumber(sortData[colKey])) {
|
|
1417
|
-
hasCustomSort = true;
|
|
1418
|
-
column.renderSortNumber = sortData[colKey];
|
|
1419
|
-
}
|
|
1420
1471
|
}
|
|
1421
|
-
if (resizableData && XEUtils.isNumber(resizableData[colKey])) {
|
|
1472
|
+
if (isCustomResizable && resizableData && XEUtils.isNumber(resizableData[colKey])) {
|
|
1422
1473
|
column.resizeWidth = resizableData[colKey];
|
|
1423
1474
|
}
|
|
1424
|
-
if (visibleData && XEUtils.isBoolean(visibleData[colKey])) {
|
|
1475
|
+
if (isCustomVisible && visibleData && XEUtils.isBoolean(visibleData[colKey])) {
|
|
1425
1476
|
column.visible = visibleData[colKey];
|
|
1426
1477
|
}
|
|
1478
|
+
if (isCustomAggFunc && aggFuncData && (aggregateConfig || rowGroupConfig) && aggFuncData[colKey]) {
|
|
1479
|
+
column.aggFunc = aggFuncData[colKey];
|
|
1480
|
+
}
|
|
1481
|
+
if (isCustomAggGroup && aggGroupData && aggGroupData[colKey]) {
|
|
1482
|
+
aggGroupConfs.push({ field: column.field });
|
|
1483
|
+
}
|
|
1484
|
+
colKeyMaps[colKey] = column;
|
|
1485
|
+
allCols.push(column);
|
|
1427
1486
|
});
|
|
1487
|
+
if ((aggregateConfig || rowGroupConfig) && aggGroupConfs.length) {
|
|
1488
|
+
const groupRest = handleGroupData(internalData.tableFullData, aggGroupConfs);
|
|
1489
|
+
internalData.tableFullTreeData = [];
|
|
1490
|
+
internalData.tableFullGroupData = groupRest.treeData;
|
|
1491
|
+
reactData.isRowGroupStatus = true;
|
|
1492
|
+
reactData.rowGroupList = aggGroupConfs;
|
|
1493
|
+
$xeTable.cacheRowMap(false);
|
|
1494
|
+
}
|
|
1428
1495
|
// 如果自定义了顺序
|
|
1429
|
-
if (
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1496
|
+
if (isCustomSort && sortData) {
|
|
1497
|
+
allCols.forEach(column => {
|
|
1498
|
+
const colKey = column.getKey();
|
|
1499
|
+
const scItem = sortColMaps[colKey];
|
|
1500
|
+
if (scItem) {
|
|
1501
|
+
const parentColumn = scItem.pKey ? colKeyMaps[scItem.pKey] : null;
|
|
1502
|
+
column.parentId = parentColumn ? parentColumn.id : null;
|
|
1503
|
+
column.renderSortNumber = scItem.sNum;
|
|
1504
|
+
}
|
|
1505
|
+
});
|
|
1506
|
+
const newCollectCols = XEUtils.toArrayTree(XEUtils.orderBy(allCols, 'renderSortNumber'), { key: 'id', parentKey: 'parentId', children: 'children' });
|
|
1507
|
+
internalData.collectColumn = newCollectCols;
|
|
1508
|
+
internalData.tableFullColumn = getColumnList(newCollectCols);
|
|
1433
1509
|
}
|
|
1434
1510
|
reactData.isCustomStatus = true;
|
|
1435
1511
|
}
|
|
@@ -1451,8 +1527,9 @@ export default defineVxeComponent({
|
|
|
1451
1527
|
const isCustomVisible = hangleStorageDefaultValue(storageOpts.visible, isAllCustom);
|
|
1452
1528
|
const isCustomFixed = hangleStorageDefaultValue(storageOpts.fixed, isAllCustom);
|
|
1453
1529
|
const isCustomSort = hangleStorageDefaultValue(storageOpts.sort, isAllCustom);
|
|
1530
|
+
const isCustomAggGroup = hangleStorageDefaultValue(storageOpts.aggGroup, isAllCustom);
|
|
1454
1531
|
const isCustomAggFunc = hangleStorageDefaultValue(storageOpts.aggFunc, isAllCustom);
|
|
1455
|
-
if (storage && (customConfig ? isEnableConf(customOpts) : customOpts.enabled) && (isCustomResizable || isCustomVisible || isCustomFixed || isCustomSort || isCustomAggFunc)) {
|
|
1532
|
+
if (storage && (customConfig ? isEnableConf(customOpts) : customOpts.enabled) && (isCustomResizable || isCustomVisible || isCustomFixed || isCustomSort || isCustomAggGroup || isCustomAggFunc)) {
|
|
1456
1533
|
if (!tableId) {
|
|
1457
1534
|
errLog('vxe.error.reqProp', ['id']);
|
|
1458
1535
|
return;
|
|
@@ -1477,8 +1554,8 @@ export default defineVxeComponent({
|
|
|
1477
1554
|
*/
|
|
1478
1555
|
const cacheColumnMap = () => {
|
|
1479
1556
|
const { tableFullColumn, collectColumn } = internalData;
|
|
1480
|
-
const
|
|
1481
|
-
const
|
|
1557
|
+
const fullColIdData = internalData.fullColumnIdData = {};
|
|
1558
|
+
const fullColFieldData = internalData.fullColumnFieldData = {};
|
|
1482
1559
|
const mouseOpts = computeMouseOpts.value;
|
|
1483
1560
|
const expandOpts = computeExpandOpts.value;
|
|
1484
1561
|
const columnOpts = computeColumnOpts.value;
|
|
@@ -1501,10 +1578,10 @@ export default defineVxeComponent({
|
|
|
1501
1578
|
const { id: colid, field, fixed, type, treeNode, rowGroupNode } = column;
|
|
1502
1579
|
const rest = { $index: -1, _index: -1, column, colid, index, items, parent: parentColumn || null, width: 0, oLeft: 0 };
|
|
1503
1580
|
if (field) {
|
|
1504
|
-
if (
|
|
1581
|
+
if (fullColFieldData[field]) {
|
|
1505
1582
|
errLog('vxe.error.colRepet', ['field', field]);
|
|
1506
1583
|
}
|
|
1507
|
-
|
|
1584
|
+
fullColFieldData[field] = rest;
|
|
1508
1585
|
}
|
|
1509
1586
|
else {
|
|
1510
1587
|
if ((storage && !type) || (columnOpts.drag && (isCrossDrag || isSelfToChildDrag))) {
|
|
@@ -1560,10 +1637,10 @@ export default defineVxeComponent({
|
|
|
1560
1637
|
if (isAllOverflow && column.showOverflow === false) {
|
|
1561
1638
|
isAllOverflow = false;
|
|
1562
1639
|
}
|
|
1563
|
-
if (
|
|
1640
|
+
if (fullColIdData[colid]) {
|
|
1564
1641
|
errLog('vxe.error.colRepet', ['colId', colid]);
|
|
1565
1642
|
}
|
|
1566
|
-
|
|
1643
|
+
fullColIdData[colid] = rest;
|
|
1567
1644
|
};
|
|
1568
1645
|
if (isGroup) {
|
|
1569
1646
|
XEUtils.eachTree(collectColumn, (column, index, items, path, parentColumn, nodes) => {
|
|
@@ -1582,10 +1659,10 @@ export default defineVxeComponent({
|
|
|
1582
1659
|
}
|
|
1583
1660
|
if (htmlColumn) {
|
|
1584
1661
|
if (!columnOpts.useKey) {
|
|
1585
|
-
errLog('vxe.error.
|
|
1662
|
+
errLog('vxe.error.notSupportProp', ['column.type=html', 'column-config.useKey=false', 'column-config.useKey=true']);
|
|
1586
1663
|
}
|
|
1587
1664
|
if (!rowOpts.useKey) {
|
|
1588
|
-
errLog('vxe.error.
|
|
1665
|
+
errLog('vxe.error.notSupportProp', ['column.type=html', 'row-config.useKey=false', 'row-config.useKey=true']);
|
|
1589
1666
|
}
|
|
1590
1667
|
}
|
|
1591
1668
|
reactData.isGroup = isGroup;
|
|
@@ -1780,7 +1857,7 @@ export default defineVxeComponent({
|
|
|
1780
1857
|
const { fullAllDataRowIdData } = internalData;
|
|
1781
1858
|
const defaultRowHeight = computeDefaultRowHeight.value;
|
|
1782
1859
|
const el = refElem.value;
|
|
1783
|
-
if (!isAllOverflow && scrollYLoad && el) {
|
|
1860
|
+
if (!isAllOverflow && (scrollYLoad || scrollXLoad) && el) {
|
|
1784
1861
|
const { handleGetRowId } = createHandleGetRowId($xeTable);
|
|
1785
1862
|
el.setAttribute('data-calc-row', 'Y');
|
|
1786
1863
|
tableData.forEach(row => {
|
|
@@ -1833,7 +1910,7 @@ export default defineVxeComponent({
|
|
|
1833
1910
|
rowRest._index = index;
|
|
1834
1911
|
}
|
|
1835
1912
|
else {
|
|
1836
|
-
const rest = { row, rowid, seq, index: -1, $index: -1, _index: index, treeIndex: -1, items: [], parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
|
|
1913
|
+
const rest = { row, rowid, seq, index: -1, $index: -1, _index: index, treeIndex: -1, _tIndex: -1, items: [], parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
|
|
1837
1914
|
fullAllDataRowIdData[rowid] = rest;
|
|
1838
1915
|
fullDataRowIdData[rowid] = rest;
|
|
1839
1916
|
}
|
|
@@ -1853,6 +1930,7 @@ export default defineVxeComponent({
|
|
|
1853
1930
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
1854
1931
|
const fullMaps = {};
|
|
1855
1932
|
if (treeConfig) {
|
|
1933
|
+
let _treeIndex = 0;
|
|
1856
1934
|
const { handleGetRowId } = createHandleGetRowId($xeTable);
|
|
1857
1935
|
XEUtils.eachTree(afterTreeFullData, (row, index, items, path) => {
|
|
1858
1936
|
const rowid = handleGetRowId(row);
|
|
@@ -1861,12 +1939,14 @@ export default defineVxeComponent({
|
|
|
1861
1939
|
if (rowRest) {
|
|
1862
1940
|
rowRest.seq = seq;
|
|
1863
1941
|
rowRest.treeIndex = index;
|
|
1942
|
+
rowRest._tIndex = _treeIndex;
|
|
1864
1943
|
}
|
|
1865
1944
|
else {
|
|
1866
|
-
const rest = { row, rowid, seq, index: -1, $index: -1, _index: -1, treeIndex: -1, items: [], parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
|
|
1945
|
+
const rest = { row, rowid, seq, index: -1, $index: -1, _index: -1, treeIndex: -1, _tIndex: _treeIndex, items: [], parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
|
|
1867
1946
|
fullAllDataRowIdData[rowid] = rest;
|
|
1868
1947
|
fullDataRowIdData[rowid] = rest;
|
|
1869
1948
|
}
|
|
1949
|
+
_treeIndex++;
|
|
1870
1950
|
fullMaps[rowid] = row;
|
|
1871
1951
|
}, { children: transform ? treeOpts.mapChildrenField : childrenField });
|
|
1872
1952
|
if (transform) {
|
|
@@ -3084,18 +3164,18 @@ export default defineVxeComponent({
|
|
|
3084
3164
|
reactData.aggHandleAggColumns = aggCols;
|
|
3085
3165
|
};
|
|
3086
3166
|
const handleUpdateRowGroup = (groupFields) => {
|
|
3087
|
-
const
|
|
3088
|
-
const
|
|
3167
|
+
const aggGroupFields = [];
|
|
3168
|
+
const aggGroupConfs = [];
|
|
3089
3169
|
if (groupFields) {
|
|
3090
3170
|
(XEUtils.isArray(groupFields) ? groupFields : [groupFields]).forEach(field => {
|
|
3091
|
-
|
|
3092
|
-
|
|
3171
|
+
aggGroupFields.push(field);
|
|
3172
|
+
aggGroupConfs.push({
|
|
3093
3173
|
field
|
|
3094
3174
|
});
|
|
3095
3175
|
});
|
|
3096
3176
|
}
|
|
3097
|
-
reactData.rowGroupList =
|
|
3098
|
-
reactData.aggHandleFields =
|
|
3177
|
+
reactData.rowGroupList = aggGroupConfs;
|
|
3178
|
+
reactData.aggHandleFields = aggGroupFields;
|
|
3099
3179
|
handleUpdateAggValues();
|
|
3100
3180
|
};
|
|
3101
3181
|
const handleeGroupSummary = (aggList) => {
|
|
@@ -3458,14 +3538,6 @@ export default defineVxeComponent({
|
|
|
3458
3538
|
}
|
|
3459
3539
|
$xeTable.closeTooltip();
|
|
3460
3540
|
};
|
|
3461
|
-
// 获取所有的列,排除分组
|
|
3462
|
-
const getColumnList = (columns) => {
|
|
3463
|
-
const result = [];
|
|
3464
|
-
columns.forEach((column) => {
|
|
3465
|
-
result.push(...(column.children && column.children.length ? getColumnList(column.children) : [column]));
|
|
3466
|
-
});
|
|
3467
|
-
return result;
|
|
3468
|
-
};
|
|
3469
3541
|
const parseColumns = (isReset) => {
|
|
3470
3542
|
// const { showOverflow } = props
|
|
3471
3543
|
// const rowOpts = computeRowOpts.value
|
|
@@ -3485,7 +3557,7 @@ export default defineVxeComponent({
|
|
|
3485
3557
|
if (parentColumn && parentColumn.fixed) {
|
|
3486
3558
|
column.fixed = parentColumn.fixed;
|
|
3487
3559
|
}
|
|
3488
|
-
if (parentColumn && column.fixed !== parentColumn.fixed) {
|
|
3560
|
+
if (parentColumn && (column.fixed || '') !== (parentColumn.fixed || '')) {
|
|
3489
3561
|
errLog('vxe.error.groupFixed');
|
|
3490
3562
|
}
|
|
3491
3563
|
if (isColGroup) {
|
|
@@ -3596,21 +3668,38 @@ export default defineVxeComponent({
|
|
|
3596
3668
|
}
|
|
3597
3669
|
return $xeTable.updateFooter();
|
|
3598
3670
|
};
|
|
3599
|
-
const
|
|
3671
|
+
const initColumnHierarchy = () => {
|
|
3600
3672
|
const { collectColumn } = internalData;
|
|
3601
|
-
|
|
3602
|
-
|
|
3673
|
+
const fullColIdData = {};
|
|
3674
|
+
const fullColFieldData = {};
|
|
3675
|
+
let sortIndex = 1;
|
|
3676
|
+
XEUtils.eachTree(collectColumn, (column, index, items, path, parentColumn) => {
|
|
3677
|
+
const { id: colid, field } = column;
|
|
3678
|
+
const parentId = parentColumn ? parentColumn.id : null;
|
|
3679
|
+
const rest = { $index: -1, _index: -1, column, colid, index, items, parent: parentColumn || null, width: 0, oLeft: 0 };
|
|
3680
|
+
column.parentId = parentId;
|
|
3681
|
+
column.defaultParentId = parentId;
|
|
3603
3682
|
column.sortNumber = sortIndex;
|
|
3604
3683
|
column.renderSortNumber = sortIndex;
|
|
3684
|
+
sortIndex++;
|
|
3685
|
+
if (field) {
|
|
3686
|
+
if (fullColFieldData[field]) {
|
|
3687
|
+
errLog('vxe.error.colRepet', ['field', field]);
|
|
3688
|
+
}
|
|
3689
|
+
fullColFieldData[field] = rest;
|
|
3690
|
+
}
|
|
3691
|
+
fullColIdData[colid] = rest;
|
|
3605
3692
|
});
|
|
3693
|
+
internalData.fullColumnIdData = fullColIdData;
|
|
3694
|
+
internalData.fullColumnFieldData = fullColFieldData;
|
|
3606
3695
|
};
|
|
3607
|
-
const
|
|
3696
|
+
const handleInitColumn = (collectColumn) => {
|
|
3608
3697
|
const expandOpts = computeExpandOpts.value;
|
|
3609
3698
|
internalData.collectColumn = collectColumn;
|
|
3610
3699
|
const tableFullColumn = getColumnList(collectColumn);
|
|
3611
3700
|
internalData.tableFullColumn = tableFullColumn;
|
|
3612
3701
|
reactData.isColLoading = true;
|
|
3613
|
-
|
|
3702
|
+
initColumnHierarchy();
|
|
3614
3703
|
return Promise.resolve(restoreCustomStorage()).then(() => {
|
|
3615
3704
|
const { scrollXLoad, scrollYLoad, expandColumn } = reactData;
|
|
3616
3705
|
cacheColumnMap();
|
|
@@ -4313,7 +4402,7 @@ export default defineVxeComponent({
|
|
|
4313
4402
|
XEUtils.eachTree(rows, (childRow, index, items, path, parentItem, nodes) => {
|
|
4314
4403
|
const rowid = getRowid($xeTable, childRow);
|
|
4315
4404
|
const parentRow = parentItem || parentRest.row;
|
|
4316
|
-
const rest = { row: childRow, rowid, seq: -1, index, _index: -1, $index: -1, treeIndex: -1, items, parent: parentRow, level: parentLevel + nodes.length, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
|
|
4405
|
+
const rest = { row: childRow, rowid, seq: -1, index, _index: -1, $index: -1, treeIndex: -1, _tIndex: -1, items, parent: parentRow, level: parentLevel + nodes.length, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
|
|
4317
4406
|
fullDataRowIdData[rowid] = rest;
|
|
4318
4407
|
fullAllDataRowIdData[rowid] = rest;
|
|
4319
4408
|
}, { children: childrenField });
|
|
@@ -4333,7 +4422,7 @@ export default defineVxeComponent({
|
|
|
4333
4422
|
loadColumn(columns) {
|
|
4334
4423
|
const { lastScrollLeft, lastScrollTop } = internalData;
|
|
4335
4424
|
const collectColumn = XEUtils.mapTree(columns, column => reactive(Cell.createColumn($xeTable, column)));
|
|
4336
|
-
return
|
|
4425
|
+
return handleInitColumn(collectColumn).then(() => {
|
|
4337
4426
|
let targetScrollLeft = lastScrollLeft;
|
|
4338
4427
|
let targetScrollTop = lastScrollTop;
|
|
4339
4428
|
const virtualXOpts = computeVirtualXOpts.value;
|
|
@@ -5796,8 +5885,8 @@ export default defineVxeComponent({
|
|
|
5796
5885
|
setSort(sortConfs, isUpdate) {
|
|
5797
5886
|
return handleSortEvent(null, sortConfs, isUpdate);
|
|
5798
5887
|
},
|
|
5799
|
-
setSortByEvent(evnt, sortConfs
|
|
5800
|
-
return handleSortEvent(evnt, sortConfs,
|
|
5888
|
+
setSortByEvent(evnt, sortConfs) {
|
|
5889
|
+
return handleSortEvent(evnt, sortConfs, true);
|
|
5801
5890
|
},
|
|
5802
5891
|
/**
|
|
5803
5892
|
* 清空指定列的排序条件
|
|
@@ -5826,6 +5915,7 @@ export default defineVxeComponent({
|
|
|
5826
5915
|
clearSortByEvent(evnt, fieldOrColumn) {
|
|
5827
5916
|
const { tableFullColumn } = internalData;
|
|
5828
5917
|
const sortOpts = computeSortOpts.value;
|
|
5918
|
+
const { multiple } = sortOpts;
|
|
5829
5919
|
const sortCols = [];
|
|
5830
5920
|
let column = null;
|
|
5831
5921
|
if (evnt) {
|
|
@@ -5846,13 +5936,16 @@ export default defineVxeComponent({
|
|
|
5846
5936
|
if (!sortOpts.remote) {
|
|
5847
5937
|
$xeTable.handleTableData(true);
|
|
5848
5938
|
}
|
|
5849
|
-
if (
|
|
5850
|
-
|
|
5851
|
-
dispatchEvent('clear-all-sort', params, evnt);
|
|
5939
|
+
if (!multiple) {
|
|
5940
|
+
column = sortCols[0];
|
|
5852
5941
|
}
|
|
5853
|
-
|
|
5942
|
+
if (column) {
|
|
5854
5943
|
$xeTable.handleColumnSortEvent(evnt, column);
|
|
5855
5944
|
}
|
|
5945
|
+
if (multiple && sortCols.length) {
|
|
5946
|
+
const params = { $table: $xeTable, $event: evnt, cols: sortCols, sortList: [] };
|
|
5947
|
+
dispatchEvent('clear-all-sort', params, evnt);
|
|
5948
|
+
}
|
|
5856
5949
|
}
|
|
5857
5950
|
return nextTick().then(() => {
|
|
5858
5951
|
updateRowOffsetTop();
|
|
@@ -5882,19 +5975,11 @@ export default defineVxeComponent({
|
|
|
5882
5975
|
}
|
|
5883
5976
|
return sortList;
|
|
5884
5977
|
},
|
|
5885
|
-
setFilterByEvent(evnt, fieldOrColumn, options
|
|
5886
|
-
const { filterStore } = reactData;
|
|
5978
|
+
setFilterByEvent(evnt, fieldOrColumn, options) {
|
|
5887
5979
|
const column = handleFieldOrColumn($xeTable, fieldOrColumn);
|
|
5888
5980
|
if (column && column.filters) {
|
|
5889
5981
|
column.filters = toFilters(options || []);
|
|
5890
|
-
|
|
5891
|
-
return $xeTable.handleColumnConfirmFilter(column, evnt);
|
|
5892
|
-
}
|
|
5893
|
-
else {
|
|
5894
|
-
if (filterStore.visible) {
|
|
5895
|
-
$xeTable.handleFilterOptions(column);
|
|
5896
|
-
}
|
|
5897
|
-
}
|
|
5982
|
+
return $xeTable.handleColumnConfirmFilter(column, evnt);
|
|
5898
5983
|
}
|
|
5899
5984
|
return nextTick();
|
|
5900
5985
|
},
|
|
@@ -5938,6 +6023,7 @@ export default defineVxeComponent({
|
|
|
5938
6023
|
const { filterStore } = reactData;
|
|
5939
6024
|
const { tableFullColumn } = internalData;
|
|
5940
6025
|
const filterOpts = computeFilterOpts.value;
|
|
6026
|
+
const { multiple } = filterOpts;
|
|
5941
6027
|
const filterCols = [];
|
|
5942
6028
|
let column = null;
|
|
5943
6029
|
if (fieldOrColumn) {
|
|
@@ -5968,13 +6054,37 @@ export default defineVxeComponent({
|
|
|
5968
6054
|
if (!filterOpts.remote) {
|
|
5969
6055
|
$xeTable.updateData();
|
|
5970
6056
|
}
|
|
5971
|
-
if (
|
|
6057
|
+
if (!multiple) {
|
|
6058
|
+
column = filterCols[0];
|
|
6059
|
+
}
|
|
6060
|
+
if (column) {
|
|
6061
|
+
const filterList = () => $xeTable.getCheckedFilters();
|
|
6062
|
+
const values = [];
|
|
6063
|
+
const datas = [];
|
|
6064
|
+
column.filters.forEach((item) => {
|
|
6065
|
+
if (item.checked) {
|
|
6066
|
+
values.push(item.value);
|
|
6067
|
+
datas.push(item.data);
|
|
6068
|
+
}
|
|
6069
|
+
});
|
|
6070
|
+
const params = {
|
|
6071
|
+
$table: $xeTable,
|
|
6072
|
+
$event: evnt,
|
|
6073
|
+
column,
|
|
6074
|
+
field: column.field,
|
|
6075
|
+
property: column.field,
|
|
6076
|
+
values,
|
|
6077
|
+
datas,
|
|
6078
|
+
filters: filterList,
|
|
6079
|
+
filterList
|
|
6080
|
+
};
|
|
6081
|
+
$xeTable.dispatchEvent('filter-change', params, evnt);
|
|
6082
|
+
$xeTable.dispatchEvent('clear-filter', params, evnt);
|
|
6083
|
+
}
|
|
6084
|
+
if (multiple && filterCols.length) {
|
|
5972
6085
|
const params = { $table: $xeTable, $event: evnt, cols: filterCols, filterList: [] };
|
|
5973
6086
|
dispatchEvent('clear-all-filter', params, evnt);
|
|
5974
6087
|
}
|
|
5975
|
-
else if (column) {
|
|
5976
|
-
$xeTable.dispatchEvent('clear-filter', { filterList: () => $xeTable.getCheckedFilters() }, evnt);
|
|
5977
|
-
}
|
|
5978
6088
|
return nextTick();
|
|
5979
6089
|
},
|
|
5980
6090
|
/**
|
|
@@ -6729,7 +6839,8 @@ export default defineVxeComponent({
|
|
|
6729
6839
|
getCustomStoreData() {
|
|
6730
6840
|
const { id } = props;
|
|
6731
6841
|
const customOpts = computeCustomOpts.value;
|
|
6732
|
-
const {
|
|
6842
|
+
const { isRowGroupStatus, rowGroupList } = reactData;
|
|
6843
|
+
const { fullColumnFieldData, collectColumn } = internalData;
|
|
6733
6844
|
const { storage, checkMethod, storeOptions } = customOpts;
|
|
6734
6845
|
const isAllCustom = storage === true;
|
|
6735
6846
|
const storageOpts = isAllCustom ? {} : Object.assign({}, storage || {}, storeOptions);
|
|
@@ -6737,17 +6848,20 @@ export default defineVxeComponent({
|
|
|
6737
6848
|
const isCustomVisible = hangleStorageDefaultValue(storageOpts.visible, isAllCustom);
|
|
6738
6849
|
const isCustomFixed = hangleStorageDefaultValue(storageOpts.fixed, isAllCustom);
|
|
6739
6850
|
const isCustomSort = hangleStorageDefaultValue(storageOpts.sort, isAllCustom);
|
|
6851
|
+
const isCustomAggGroup = hangleStorageDefaultValue(storageOpts.aggGroup, isAllCustom);
|
|
6740
6852
|
const isCustomAggFunc = hangleStorageDefaultValue(storageOpts.aggFunc, isAllCustom);
|
|
6741
6853
|
const resizableData = {};
|
|
6742
|
-
const sortData =
|
|
6854
|
+
const sortData = [];
|
|
6743
6855
|
const visibleData = {};
|
|
6744
6856
|
const fixedData = {};
|
|
6857
|
+
const aggGroupData = {};
|
|
6745
6858
|
const aggFuncData = {};
|
|
6746
6859
|
const storeData = {
|
|
6747
6860
|
resizableData: undefined,
|
|
6748
6861
|
sortData: undefined,
|
|
6749
6862
|
visibleData: undefined,
|
|
6750
6863
|
fixedData: undefined,
|
|
6864
|
+
aggGroupData: undefined,
|
|
6751
6865
|
aggFuncData: undefined
|
|
6752
6866
|
};
|
|
6753
6867
|
if (!id) {
|
|
@@ -6761,19 +6875,37 @@ export default defineVxeComponent({
|
|
|
6761
6875
|
let hasFixed = 0;
|
|
6762
6876
|
let hasVisible = 0;
|
|
6763
6877
|
let hasAggFunc = 0;
|
|
6878
|
+
const sortMaps = {};
|
|
6764
6879
|
XEUtils.eachTree(collectColumn, (column, index, items, path, parentColumn) => {
|
|
6765
6880
|
const colKey = column.getKey();
|
|
6766
6881
|
if (!colKey) {
|
|
6767
6882
|
errLog('vxe.error.reqProp', [`${column.getTitle() || column.type || ''} -> column.field=?`]);
|
|
6768
6883
|
return;
|
|
6769
6884
|
}
|
|
6770
|
-
|
|
6771
|
-
|
|
6885
|
+
if (parentColumn) {
|
|
6886
|
+
if (isCustomSort) {
|
|
6887
|
+
const pColKey = parentColumn.getKey();
|
|
6888
|
+
const psObj = sortMaps[pColKey];
|
|
6889
|
+
hasSort = 1;
|
|
6890
|
+
if (psObj) {
|
|
6891
|
+
const sObj = { k: colKey };
|
|
6892
|
+
sortMaps[colKey] = sObj;
|
|
6893
|
+
if (!psObj.c) {
|
|
6894
|
+
psObj.c = [];
|
|
6895
|
+
}
|
|
6896
|
+
psObj.c.push(sObj);
|
|
6897
|
+
}
|
|
6898
|
+
}
|
|
6899
|
+
}
|
|
6900
|
+
else {
|
|
6772
6901
|
if (isCustomSort) {
|
|
6773
6902
|
hasSort = 1;
|
|
6774
|
-
|
|
6903
|
+
const sObj = { k: colKey };
|
|
6904
|
+
sortMaps[colKey] = sObj;
|
|
6905
|
+
sortData.push(sObj);
|
|
6775
6906
|
}
|
|
6776
|
-
|
|
6907
|
+
// 只支持一级
|
|
6908
|
+
if (isCustomFixed && (column.fixed || '') !== (column.defaultFixed || '')) {
|
|
6777
6909
|
hasFixed = 1;
|
|
6778
6910
|
fixedData[colKey] = column.fixed;
|
|
6779
6911
|
}
|
|
@@ -6792,7 +6924,7 @@ export default defineVxeComponent({
|
|
|
6792
6924
|
visibleData[colKey] = true;
|
|
6793
6925
|
}
|
|
6794
6926
|
}
|
|
6795
|
-
if (isCustomAggFunc && column.aggFunc !== column.defaultAggFunc) {
|
|
6927
|
+
if (isCustomAggFunc && (column.aggFunc || '') !== (column.defaultAggFunc || '')) {
|
|
6796
6928
|
hasAggFunc = 1;
|
|
6797
6929
|
aggFuncData[colKey] = column.aggFunc;
|
|
6798
6930
|
}
|
|
@@ -6809,6 +6941,15 @@ export default defineVxeComponent({
|
|
|
6809
6941
|
if (hasVisible) {
|
|
6810
6942
|
storeData.visibleData = visibleData;
|
|
6811
6943
|
}
|
|
6944
|
+
if (isCustomAggGroup && isRowGroupStatus) {
|
|
6945
|
+
rowGroupList.forEach(aggConf => {
|
|
6946
|
+
const colRest = fullColumnFieldData[aggConf.field];
|
|
6947
|
+
if (colRest) {
|
|
6948
|
+
aggGroupData[colRest.column.getKey()] = true;
|
|
6949
|
+
}
|
|
6950
|
+
});
|
|
6951
|
+
storeData.aggGroupData = aggGroupData;
|
|
6952
|
+
}
|
|
6812
6953
|
if (hasAggFunc) {
|
|
6813
6954
|
storeData.aggFuncData = aggFuncData;
|
|
6814
6955
|
}
|
|
@@ -7793,7 +7934,7 @@ export default defineVxeComponent({
|
|
|
7793
7934
|
const handleRowCache = (row, index, items, currIndex, parentRow, rowid, level, seq) => {
|
|
7794
7935
|
let rowRest = fullAllDataRowIdMaps[rowid];
|
|
7795
7936
|
if (!rowRest) {
|
|
7796
|
-
rowRest = { row, rowid, seq, index: -1, _index: -1, $index: -1, treeIndex: index, items, parent: parentRow, level, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
|
|
7937
|
+
rowRest = { row, rowid, seq, index: -1, _index: -1, $index: -1, treeIndex: index, _tIndex: -1, items, parent: parentRow, level, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
|
|
7797
7938
|
fullDataRowIdMaps[rowid] = rowRest;
|
|
7798
7939
|
fullAllDataRowIdMaps[rowid] = rowRest;
|
|
7799
7940
|
}
|
|
@@ -8258,12 +8399,13 @@ export default defineVxeComponent({
|
|
|
8258
8399
|
const isCustomVisible = hangleStorageDefaultValue(storageOpts.visible, isAllCustom);
|
|
8259
8400
|
const isCustomFixed = hangleStorageDefaultValue(storageOpts.fixed, isAllCustom);
|
|
8260
8401
|
const isCustomSort = hangleStorageDefaultValue(storageOpts.sort, isAllCustom);
|
|
8402
|
+
const isCustomAggGroup = hangleStorageDefaultValue(storageOpts.aggGroup, isAllCustom);
|
|
8261
8403
|
const isCustomAggFunc = hangleStorageDefaultValue(storageOpts.aggFunc, isAllCustom);
|
|
8262
8404
|
if (type !== 'reset') {
|
|
8263
8405
|
// fix:修复拖动列宽,重置按钮无法点击的问题
|
|
8264
8406
|
reactData.isCustomStatus = true;
|
|
8265
8407
|
}
|
|
8266
|
-
if (storage && (customConfig ? isEnableConf(customOpts) : customOpts.enabled) && (isCustomResizable || isCustomVisible || isCustomFixed || isCustomSort || isCustomAggFunc)) {
|
|
8408
|
+
if (storage && (customConfig ? isEnableConf(customOpts) : customOpts.enabled) && (isCustomResizable || isCustomVisible || isCustomFixed || isCustomSort || isCustomAggGroup || isCustomAggFunc)) {
|
|
8267
8409
|
if (!tableId) {
|
|
8268
8410
|
errLog('vxe.error.reqProp', ['id']);
|
|
8269
8411
|
return nextTick();
|
|
@@ -8271,9 +8413,11 @@ export default defineVxeComponent({
|
|
|
8271
8413
|
const storeData = type === 'reset'
|
|
8272
8414
|
? {
|
|
8273
8415
|
resizableData: {},
|
|
8274
|
-
sortData:
|
|
8416
|
+
sortData: [],
|
|
8275
8417
|
visibleData: {},
|
|
8276
|
-
fixedData: {}
|
|
8418
|
+
fixedData: {},
|
|
8419
|
+
aggGroupData: {},
|
|
8420
|
+
aggFuncData: {}
|
|
8277
8421
|
}
|
|
8278
8422
|
: tableMethods.getCustomStoreData();
|
|
8279
8423
|
if (updateStore) {
|
|
@@ -11054,16 +11198,17 @@ export default defineVxeComponent({
|
|
|
11054
11198
|
let rowIndex = -1;
|
|
11055
11199
|
let $rowIndex = -1;
|
|
11056
11200
|
if (rowRest) {
|
|
11201
|
+
rowIndex = rowRest.index;
|
|
11202
|
+
$rowIndex = rowRest.$index;
|
|
11203
|
+
_rowIndex = rowRest._index;
|
|
11057
11204
|
rowLevel = rowRest.level;
|
|
11205
|
+
seq = rowRest.seq;
|
|
11058
11206
|
if (isRowGroupStatus || (treeConfig && transform && seqMode === 'increasing')) {
|
|
11059
11207
|
seq = rowRest._index + 1;
|
|
11060
11208
|
}
|
|
11061
|
-
else {
|
|
11062
|
-
seq = rowRest.
|
|
11209
|
+
else if ((treeConfig && seqMode === 'fixed')) {
|
|
11210
|
+
seq = rowRest._tIndex + 1;
|
|
11063
11211
|
}
|
|
11064
|
-
rowIndex = rowRest.index;
|
|
11065
|
-
$rowIndex = rowRest.$index;
|
|
11066
|
-
_rowIndex = rowRest._index;
|
|
11067
11212
|
}
|
|
11068
11213
|
if (expandHeight) {
|
|
11069
11214
|
cellStyle.height = `${expandHeight}px`;
|
|
@@ -11545,7 +11690,7 @@ export default defineVxeComponent({
|
|
|
11545
11690
|
staticColumnFlag.value++;
|
|
11546
11691
|
});
|
|
11547
11692
|
watch(staticColumnFlag, () => {
|
|
11548
|
-
|
|
11693
|
+
nextTick(() => handleInitColumn(XEUtils.clone(reactData.staticColumns)));
|
|
11549
11694
|
});
|
|
11550
11695
|
const tableColumnFlag = ref(0);
|
|
11551
11696
|
watch(() => reactData.tableColumn.length, () => {
|