vxe-table 4.15.0-beta.8 → 4.15.0
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 +22 -14
- package/es/table/module/edit/hook.js +5 -5
- package/es/table/src/body.js +7 -6
- package/es/table/src/cell.js +5 -5
- package/es/table/src/columnInfo.js +2 -0
- package/es/table/src/table.js +204 -80
- package/es/table/src/util.js +9 -0
- package/es/ui/index.js +2 -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 +148 -58
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/table/module/custom/hook.js +25 -13
- package/lib/table/module/custom/hook.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/cell.js +5 -4
- package/lib/table/src/cell.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 +24 -24
- 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 +2 -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 +21 -13
- package/packages/table/module/edit/hook.ts +5 -5
- package/packages/table/src/body.ts +7 -6
- package/packages/table/src/cell.ts +5 -5
- package/packages/table/src/columnInfo.ts +3 -0
- package/packages/table/src/table.ts +217 -80
- package/packages/table/src/util.ts +10 -0
- package/packages/ui/index.ts +1 -0
- /package/es/{iconfont.1753445535983.ttf → iconfont.1753928735749.ttf} +0 -0
- /package/es/{iconfont.1753445535983.woff → iconfont.1753928735749.woff} +0 -0
- /package/es/{iconfont.1753445535983.woff2 → iconfont.1753928735749.woff2} +0 -0
- /package/lib/{iconfont.1753445535983.ttf → iconfont.1753928735749.ttf} +0 -0
- /package/lib/{iconfont.1753445535983.woff → iconfont.1753928735749.woff} +0 -0
- /package/lib/{iconfont.1753445535983.woff2 → iconfont.1753928735749.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';
|
|
@@ -1327,16 +1327,23 @@ export default defineVxeComponent({
|
|
|
1327
1327
|
return rest;
|
|
1328
1328
|
};
|
|
1329
1329
|
const handleSortEvent = (evnt, sortConfs, isUpdate) => {
|
|
1330
|
+
const { tableFullColumn } = internalData;
|
|
1330
1331
|
const sortOpts = computeSortOpts.value;
|
|
1331
1332
|
const { multiple, remote, orders } = sortOpts;
|
|
1332
1333
|
if (!XEUtils.isArray(sortConfs)) {
|
|
1333
1334
|
sortConfs = [sortConfs];
|
|
1334
1335
|
}
|
|
1335
1336
|
if (sortConfs && sortConfs.length) {
|
|
1337
|
+
const orderActiveMaps = {};
|
|
1336
1338
|
if (!multiple) {
|
|
1337
1339
|
sortConfs = [sortConfs[0]];
|
|
1338
|
-
|
|
1340
|
+
tableFullColumn.forEach((column) => {
|
|
1341
|
+
if (column.order) {
|
|
1342
|
+
orderActiveMaps[column.id] = column;
|
|
1343
|
+
}
|
|
1344
|
+
});
|
|
1339
1345
|
}
|
|
1346
|
+
const sortColMpps = {};
|
|
1340
1347
|
let firstColumn = null;
|
|
1341
1348
|
sortConfs.forEach((confs, index) => {
|
|
1342
1349
|
let { field, order } = confs;
|
|
@@ -1355,8 +1362,16 @@ export default defineVxeComponent({
|
|
|
1355
1362
|
column.order = order;
|
|
1356
1363
|
}
|
|
1357
1364
|
column.sortTime = Date.now() + index;
|
|
1365
|
+
sortColMpps[column.id] = column;
|
|
1358
1366
|
}
|
|
1359
1367
|
});
|
|
1368
|
+
if (!multiple) {
|
|
1369
|
+
XEUtils.each(orderActiveMaps, (oaCol, oaId) => {
|
|
1370
|
+
if (!sortColMpps[oaId]) {
|
|
1371
|
+
oaCol.order = null;
|
|
1372
|
+
}
|
|
1373
|
+
});
|
|
1374
|
+
}
|
|
1360
1375
|
if (isUpdate) {
|
|
1361
1376
|
if (!remote) {
|
|
1362
1377
|
$xeTable.handleTableData(true);
|
|
@@ -1401,35 +1416,88 @@ export default defineVxeComponent({
|
|
|
1401
1416
|
return num;
|
|
1402
1417
|
};
|
|
1403
1418
|
const handleCustomRestore = (storeData) => {
|
|
1404
|
-
|
|
1405
|
-
const {
|
|
1406
|
-
|
|
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;
|
|
1407
1432
|
// 处理还原
|
|
1408
|
-
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 = [];
|
|
1409
1456
|
XEUtils.eachTree(collectColumn, (column, index, items, path, parentColumn) => {
|
|
1410
1457
|
const colKey = column.getKey();
|
|
1411
1458
|
// 支持一级
|
|
1412
1459
|
if (!parentColumn) {
|
|
1413
|
-
if (fixedData && fixedData[colKey] !== undefined) {
|
|
1460
|
+
if (isCustomFixed && fixedData && fixedData[colKey] !== undefined) {
|
|
1414
1461
|
column.fixed = fixedData[colKey];
|
|
1415
1462
|
}
|
|
1416
|
-
if (sortData && XEUtils.isNumber(sortData[colKey])) {
|
|
1417
|
-
hasCustomSort = true;
|
|
1418
|
-
column.renderSortNumber = sortData[colKey];
|
|
1419
|
-
}
|
|
1420
1463
|
}
|
|
1421
|
-
if (resizableData && XEUtils.isNumber(resizableData[colKey])) {
|
|
1464
|
+
if (isCustomResizable && resizableData && XEUtils.isNumber(resizableData[colKey])) {
|
|
1422
1465
|
column.resizeWidth = resizableData[colKey];
|
|
1423
1466
|
}
|
|
1424
|
-
if (visibleData && XEUtils.isBoolean(visibleData[colKey])) {
|
|
1467
|
+
if (isCustomVisible && visibleData && XEUtils.isBoolean(visibleData[colKey])) {
|
|
1425
1468
|
column.visible = visibleData[colKey];
|
|
1426
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);
|
|
1427
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
|
+
}
|
|
1428
1487
|
// 如果自定义了顺序
|
|
1429
|
-
if (
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
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);
|
|
1433
1501
|
}
|
|
1434
1502
|
reactData.isCustomStatus = true;
|
|
1435
1503
|
}
|
|
@@ -1451,8 +1519,9 @@ export default defineVxeComponent({
|
|
|
1451
1519
|
const isCustomVisible = hangleStorageDefaultValue(storageOpts.visible, isAllCustom);
|
|
1452
1520
|
const isCustomFixed = hangleStorageDefaultValue(storageOpts.fixed, isAllCustom);
|
|
1453
1521
|
const isCustomSort = hangleStorageDefaultValue(storageOpts.sort, isAllCustom);
|
|
1522
|
+
const isCustomAggGroup = hangleStorageDefaultValue(storageOpts.aggGroup, isAllCustom);
|
|
1454
1523
|
const isCustomAggFunc = hangleStorageDefaultValue(storageOpts.aggFunc, isAllCustom);
|
|
1455
|
-
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)) {
|
|
1456
1525
|
if (!tableId) {
|
|
1457
1526
|
errLog('vxe.error.reqProp', ['id']);
|
|
1458
1527
|
return;
|
|
@@ -1780,7 +1849,7 @@ export default defineVxeComponent({
|
|
|
1780
1849
|
const { fullAllDataRowIdData } = internalData;
|
|
1781
1850
|
const defaultRowHeight = computeDefaultRowHeight.value;
|
|
1782
1851
|
const el = refElem.value;
|
|
1783
|
-
if (!isAllOverflow && scrollYLoad && el) {
|
|
1852
|
+
if (!isAllOverflow && (scrollYLoad || scrollXLoad) && el) {
|
|
1784
1853
|
const { handleGetRowId } = createHandleGetRowId($xeTable);
|
|
1785
1854
|
el.setAttribute('data-calc-row', 'Y');
|
|
1786
1855
|
tableData.forEach(row => {
|
|
@@ -1833,7 +1902,7 @@ export default defineVxeComponent({
|
|
|
1833
1902
|
rowRest._index = index;
|
|
1834
1903
|
}
|
|
1835
1904
|
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 };
|
|
1905
|
+
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
1906
|
fullAllDataRowIdData[rowid] = rest;
|
|
1838
1907
|
fullDataRowIdData[rowid] = rest;
|
|
1839
1908
|
}
|
|
@@ -1853,6 +1922,7 @@ export default defineVxeComponent({
|
|
|
1853
1922
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
1854
1923
|
const fullMaps = {};
|
|
1855
1924
|
if (treeConfig) {
|
|
1925
|
+
let _treeIndex = 0;
|
|
1856
1926
|
const { handleGetRowId } = createHandleGetRowId($xeTable);
|
|
1857
1927
|
XEUtils.eachTree(afterTreeFullData, (row, index, items, path) => {
|
|
1858
1928
|
const rowid = handleGetRowId(row);
|
|
@@ -1861,12 +1931,14 @@ export default defineVxeComponent({
|
|
|
1861
1931
|
if (rowRest) {
|
|
1862
1932
|
rowRest.seq = seq;
|
|
1863
1933
|
rowRest.treeIndex = index;
|
|
1934
|
+
rowRest._tIndex = _treeIndex;
|
|
1864
1935
|
}
|
|
1865
1936
|
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 };
|
|
1937
|
+
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
1938
|
fullAllDataRowIdData[rowid] = rest;
|
|
1868
1939
|
fullDataRowIdData[rowid] = rest;
|
|
1869
1940
|
}
|
|
1941
|
+
_treeIndex++;
|
|
1870
1942
|
fullMaps[rowid] = row;
|
|
1871
1943
|
}, { children: transform ? treeOpts.mapChildrenField : childrenField });
|
|
1872
1944
|
if (transform) {
|
|
@@ -3084,18 +3156,18 @@ export default defineVxeComponent({
|
|
|
3084
3156
|
reactData.aggHandleAggColumns = aggCols;
|
|
3085
3157
|
};
|
|
3086
3158
|
const handleUpdateRowGroup = (groupFields) => {
|
|
3087
|
-
const
|
|
3088
|
-
const
|
|
3159
|
+
const aggGroupFields = [];
|
|
3160
|
+
const aggGroupConfs = [];
|
|
3089
3161
|
if (groupFields) {
|
|
3090
3162
|
(XEUtils.isArray(groupFields) ? groupFields : [groupFields]).forEach(field => {
|
|
3091
|
-
|
|
3092
|
-
|
|
3163
|
+
aggGroupFields.push(field);
|
|
3164
|
+
aggGroupConfs.push({
|
|
3093
3165
|
field
|
|
3094
3166
|
});
|
|
3095
3167
|
});
|
|
3096
3168
|
}
|
|
3097
|
-
reactData.rowGroupList =
|
|
3098
|
-
reactData.aggHandleFields =
|
|
3169
|
+
reactData.rowGroupList = aggGroupConfs;
|
|
3170
|
+
reactData.aggHandleFields = aggGroupFields;
|
|
3099
3171
|
handleUpdateAggValues();
|
|
3100
3172
|
};
|
|
3101
3173
|
const handleeGroupSummary = (aggList) => {
|
|
@@ -3458,14 +3530,6 @@ export default defineVxeComponent({
|
|
|
3458
3530
|
}
|
|
3459
3531
|
$xeTable.closeTooltip();
|
|
3460
3532
|
};
|
|
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
3533
|
const parseColumns = (isReset) => {
|
|
3470
3534
|
// const { showOverflow } = props
|
|
3471
3535
|
// const rowOpts = computeRowOpts.value
|
|
@@ -3485,7 +3549,7 @@ export default defineVxeComponent({
|
|
|
3485
3549
|
if (parentColumn && parentColumn.fixed) {
|
|
3486
3550
|
column.fixed = parentColumn.fixed;
|
|
3487
3551
|
}
|
|
3488
|
-
if (parentColumn && column.fixed !== parentColumn.fixed) {
|
|
3552
|
+
if (parentColumn && (column.fixed || '') !== (parentColumn.fixed || '')) {
|
|
3489
3553
|
errLog('vxe.error.groupFixed');
|
|
3490
3554
|
}
|
|
3491
3555
|
if (isColGroup) {
|
|
@@ -3596,21 +3660,25 @@ export default defineVxeComponent({
|
|
|
3596
3660
|
}
|
|
3597
3661
|
return $xeTable.updateFooter();
|
|
3598
3662
|
};
|
|
3599
|
-
const
|
|
3663
|
+
const initColumnHierarchy = () => {
|
|
3600
3664
|
const { collectColumn } = internalData;
|
|
3601
|
-
|
|
3602
|
-
|
|
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;
|
|
3603
3670
|
column.sortNumber = sortIndex;
|
|
3604
3671
|
column.renderSortNumber = sortIndex;
|
|
3672
|
+
sortIndex++;
|
|
3605
3673
|
});
|
|
3606
3674
|
};
|
|
3607
|
-
const
|
|
3675
|
+
const handleInitColumn = (collectColumn) => {
|
|
3608
3676
|
const expandOpts = computeExpandOpts.value;
|
|
3609
3677
|
internalData.collectColumn = collectColumn;
|
|
3610
3678
|
const tableFullColumn = getColumnList(collectColumn);
|
|
3611
3679
|
internalData.tableFullColumn = tableFullColumn;
|
|
3612
3680
|
reactData.isColLoading = true;
|
|
3613
|
-
|
|
3681
|
+
initColumnHierarchy();
|
|
3614
3682
|
return Promise.resolve(restoreCustomStorage()).then(() => {
|
|
3615
3683
|
const { scrollXLoad, scrollYLoad, expandColumn } = reactData;
|
|
3616
3684
|
cacheColumnMap();
|
|
@@ -4313,7 +4381,7 @@ export default defineVxeComponent({
|
|
|
4313
4381
|
XEUtils.eachTree(rows, (childRow, index, items, path, parentItem, nodes) => {
|
|
4314
4382
|
const rowid = getRowid($xeTable, childRow);
|
|
4315
4383
|
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 };
|
|
4384
|
+
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
4385
|
fullDataRowIdData[rowid] = rest;
|
|
4318
4386
|
fullAllDataRowIdData[rowid] = rest;
|
|
4319
4387
|
}, { children: childrenField });
|
|
@@ -4333,7 +4401,7 @@ export default defineVxeComponent({
|
|
|
4333
4401
|
loadColumn(columns) {
|
|
4334
4402
|
const { lastScrollLeft, lastScrollTop } = internalData;
|
|
4335
4403
|
const collectColumn = XEUtils.mapTree(columns, column => reactive(Cell.createColumn($xeTable, column)));
|
|
4336
|
-
return
|
|
4404
|
+
return handleInitColumn(collectColumn).then(() => {
|
|
4337
4405
|
let targetScrollLeft = lastScrollLeft;
|
|
4338
4406
|
let targetScrollTop = lastScrollTop;
|
|
4339
4407
|
const virtualXOpts = computeVirtualXOpts.value;
|
|
@@ -5796,8 +5864,8 @@ export default defineVxeComponent({
|
|
|
5796
5864
|
setSort(sortConfs, isUpdate) {
|
|
5797
5865
|
return handleSortEvent(null, sortConfs, isUpdate);
|
|
5798
5866
|
},
|
|
5799
|
-
setSortByEvent(evnt, sortConfs
|
|
5800
|
-
return handleSortEvent(evnt, sortConfs,
|
|
5867
|
+
setSortByEvent(evnt, sortConfs) {
|
|
5868
|
+
return handleSortEvent(evnt, sortConfs, true);
|
|
5801
5869
|
},
|
|
5802
5870
|
/**
|
|
5803
5871
|
* 清空指定列的排序条件
|
|
@@ -5826,6 +5894,7 @@ export default defineVxeComponent({
|
|
|
5826
5894
|
clearSortByEvent(evnt, fieldOrColumn) {
|
|
5827
5895
|
const { tableFullColumn } = internalData;
|
|
5828
5896
|
const sortOpts = computeSortOpts.value;
|
|
5897
|
+
const { multiple } = sortOpts;
|
|
5829
5898
|
const sortCols = [];
|
|
5830
5899
|
let column = null;
|
|
5831
5900
|
if (evnt) {
|
|
@@ -5846,13 +5915,16 @@ export default defineVxeComponent({
|
|
|
5846
5915
|
if (!sortOpts.remote) {
|
|
5847
5916
|
$xeTable.handleTableData(true);
|
|
5848
5917
|
}
|
|
5849
|
-
if (
|
|
5850
|
-
|
|
5851
|
-
dispatchEvent('clear-all-sort', params, evnt);
|
|
5918
|
+
if (!multiple) {
|
|
5919
|
+
column = sortCols[0];
|
|
5852
5920
|
}
|
|
5853
|
-
|
|
5921
|
+
if (column) {
|
|
5854
5922
|
$xeTable.handleColumnSortEvent(evnt, column);
|
|
5855
5923
|
}
|
|
5924
|
+
if (multiple && sortCols.length) {
|
|
5925
|
+
const params = { $table: $xeTable, $event: evnt, cols: sortCols, sortList: [] };
|
|
5926
|
+
dispatchEvent('clear-all-sort', params, evnt);
|
|
5927
|
+
}
|
|
5856
5928
|
}
|
|
5857
5929
|
return nextTick().then(() => {
|
|
5858
5930
|
updateRowOffsetTop();
|
|
@@ -5882,19 +5954,11 @@ export default defineVxeComponent({
|
|
|
5882
5954
|
}
|
|
5883
5955
|
return sortList;
|
|
5884
5956
|
},
|
|
5885
|
-
setFilterByEvent(evnt, fieldOrColumn, options
|
|
5886
|
-
const { filterStore } = reactData;
|
|
5957
|
+
setFilterByEvent(evnt, fieldOrColumn, options) {
|
|
5887
5958
|
const column = handleFieldOrColumn($xeTable, fieldOrColumn);
|
|
5888
5959
|
if (column && column.filters) {
|
|
5889
5960
|
column.filters = toFilters(options || []);
|
|
5890
|
-
|
|
5891
|
-
return $xeTable.handleColumnConfirmFilter(column, evnt);
|
|
5892
|
-
}
|
|
5893
|
-
else {
|
|
5894
|
-
if (filterStore.visible) {
|
|
5895
|
-
$xeTable.handleFilterOptions(column);
|
|
5896
|
-
}
|
|
5897
|
-
}
|
|
5961
|
+
return $xeTable.handleColumnConfirmFilter(column, evnt);
|
|
5898
5962
|
}
|
|
5899
5963
|
return nextTick();
|
|
5900
5964
|
},
|
|
@@ -5938,6 +6002,7 @@ export default defineVxeComponent({
|
|
|
5938
6002
|
const { filterStore } = reactData;
|
|
5939
6003
|
const { tableFullColumn } = internalData;
|
|
5940
6004
|
const filterOpts = computeFilterOpts.value;
|
|
6005
|
+
const { multiple } = filterOpts;
|
|
5941
6006
|
const filterCols = [];
|
|
5942
6007
|
let column = null;
|
|
5943
6008
|
if (fieldOrColumn) {
|
|
@@ -5968,13 +6033,37 @@ export default defineVxeComponent({
|
|
|
5968
6033
|
if (!filterOpts.remote) {
|
|
5969
6034
|
$xeTable.updateData();
|
|
5970
6035
|
}
|
|
5971
|
-
if (
|
|
6036
|
+
if (!multiple) {
|
|
6037
|
+
column = filterCols[0];
|
|
6038
|
+
}
|
|
6039
|
+
if (column) {
|
|
6040
|
+
const filterList = () => $xeTable.getCheckedFilters();
|
|
6041
|
+
const values = [];
|
|
6042
|
+
const datas = [];
|
|
6043
|
+
column.filters.forEach((item) => {
|
|
6044
|
+
if (item.checked) {
|
|
6045
|
+
values.push(item.value);
|
|
6046
|
+
datas.push(item.data);
|
|
6047
|
+
}
|
|
6048
|
+
});
|
|
6049
|
+
const params = {
|
|
6050
|
+
$table: $xeTable,
|
|
6051
|
+
$event: evnt,
|
|
6052
|
+
column,
|
|
6053
|
+
field: column.field,
|
|
6054
|
+
property: column.field,
|
|
6055
|
+
values,
|
|
6056
|
+
datas,
|
|
6057
|
+
filters: filterList,
|
|
6058
|
+
filterList
|
|
6059
|
+
};
|
|
6060
|
+
$xeTable.dispatchEvent('filter-change', params, evnt);
|
|
6061
|
+
$xeTable.dispatchEvent('clear-filter', params, evnt);
|
|
6062
|
+
}
|
|
6063
|
+
if (multiple && filterCols.length) {
|
|
5972
6064
|
const params = { $table: $xeTable, $event: evnt, cols: filterCols, filterList: [] };
|
|
5973
6065
|
dispatchEvent('clear-all-filter', params, evnt);
|
|
5974
6066
|
}
|
|
5975
|
-
else if (column) {
|
|
5976
|
-
$xeTable.dispatchEvent('clear-filter', { filterList: () => $xeTable.getCheckedFilters() }, evnt);
|
|
5977
|
-
}
|
|
5978
6067
|
return nextTick();
|
|
5979
6068
|
},
|
|
5980
6069
|
/**
|
|
@@ -6729,7 +6818,8 @@ export default defineVxeComponent({
|
|
|
6729
6818
|
getCustomStoreData() {
|
|
6730
6819
|
const { id } = props;
|
|
6731
6820
|
const customOpts = computeCustomOpts.value;
|
|
6732
|
-
const {
|
|
6821
|
+
const { isRowGroupStatus, rowGroupList } = reactData;
|
|
6822
|
+
const { fullColumnFieldData, collectColumn } = internalData;
|
|
6733
6823
|
const { storage, checkMethod, storeOptions } = customOpts;
|
|
6734
6824
|
const isAllCustom = storage === true;
|
|
6735
6825
|
const storageOpts = isAllCustom ? {} : Object.assign({}, storage || {}, storeOptions);
|
|
@@ -6737,17 +6827,20 @@ export default defineVxeComponent({
|
|
|
6737
6827
|
const isCustomVisible = hangleStorageDefaultValue(storageOpts.visible, isAllCustom);
|
|
6738
6828
|
const isCustomFixed = hangleStorageDefaultValue(storageOpts.fixed, isAllCustom);
|
|
6739
6829
|
const isCustomSort = hangleStorageDefaultValue(storageOpts.sort, isAllCustom);
|
|
6830
|
+
const isCustomAggGroup = hangleStorageDefaultValue(storageOpts.aggGroup, isAllCustom);
|
|
6740
6831
|
const isCustomAggFunc = hangleStorageDefaultValue(storageOpts.aggFunc, isAllCustom);
|
|
6741
6832
|
const resizableData = {};
|
|
6742
|
-
const sortData =
|
|
6833
|
+
const sortData = [];
|
|
6743
6834
|
const visibleData = {};
|
|
6744
6835
|
const fixedData = {};
|
|
6836
|
+
const aggGroupData = {};
|
|
6745
6837
|
const aggFuncData = {};
|
|
6746
6838
|
const storeData = {
|
|
6747
6839
|
resizableData: undefined,
|
|
6748
6840
|
sortData: undefined,
|
|
6749
6841
|
visibleData: undefined,
|
|
6750
6842
|
fixedData: undefined,
|
|
6843
|
+
aggGroupData: undefined,
|
|
6751
6844
|
aggFuncData: undefined
|
|
6752
6845
|
};
|
|
6753
6846
|
if (!id) {
|
|
@@ -6761,19 +6854,37 @@ export default defineVxeComponent({
|
|
|
6761
6854
|
let hasFixed = 0;
|
|
6762
6855
|
let hasVisible = 0;
|
|
6763
6856
|
let hasAggFunc = 0;
|
|
6857
|
+
const sortMaps = {};
|
|
6764
6858
|
XEUtils.eachTree(collectColumn, (column, index, items, path, parentColumn) => {
|
|
6765
6859
|
const colKey = column.getKey();
|
|
6766
6860
|
if (!colKey) {
|
|
6767
6861
|
errLog('vxe.error.reqProp', [`${column.getTitle() || column.type || ''} -> column.field=?`]);
|
|
6768
6862
|
return;
|
|
6769
6863
|
}
|
|
6770
|
-
|
|
6771
|
-
if (!parentColumn) {
|
|
6864
|
+
if (parentColumn) {
|
|
6772
6865
|
if (isCustomSort) {
|
|
6866
|
+
const pColKey = parentColumn.getKey();
|
|
6867
|
+
const psObj = sortMaps[pColKey];
|
|
6773
6868
|
hasSort = 1;
|
|
6774
|
-
|
|
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
|
+
}
|
|
6775
6877
|
}
|
|
6776
|
-
|
|
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 || '')) {
|
|
6777
6888
|
hasFixed = 1;
|
|
6778
6889
|
fixedData[colKey] = column.fixed;
|
|
6779
6890
|
}
|
|
@@ -6792,7 +6903,7 @@ export default defineVxeComponent({
|
|
|
6792
6903
|
visibleData[colKey] = true;
|
|
6793
6904
|
}
|
|
6794
6905
|
}
|
|
6795
|
-
if (isCustomAggFunc && column.aggFunc !== column.defaultAggFunc) {
|
|
6906
|
+
if (isCustomAggFunc && (column.aggFunc || '') !== (column.defaultAggFunc || '')) {
|
|
6796
6907
|
hasAggFunc = 1;
|
|
6797
6908
|
aggFuncData[colKey] = column.aggFunc;
|
|
6798
6909
|
}
|
|
@@ -6809,6 +6920,15 @@ export default defineVxeComponent({
|
|
|
6809
6920
|
if (hasVisible) {
|
|
6810
6921
|
storeData.visibleData = visibleData;
|
|
6811
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
|
+
}
|
|
6812
6932
|
if (hasAggFunc) {
|
|
6813
6933
|
storeData.aggFuncData = aggFuncData;
|
|
6814
6934
|
}
|
|
@@ -7793,7 +7913,7 @@ export default defineVxeComponent({
|
|
|
7793
7913
|
const handleRowCache = (row, index, items, currIndex, parentRow, rowid, level, seq) => {
|
|
7794
7914
|
let rowRest = fullAllDataRowIdMaps[rowid];
|
|
7795
7915
|
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 };
|
|
7916
|
+
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
7917
|
fullDataRowIdMaps[rowid] = rowRest;
|
|
7798
7918
|
fullAllDataRowIdMaps[rowid] = rowRest;
|
|
7799
7919
|
}
|
|
@@ -8258,12 +8378,13 @@ export default defineVxeComponent({
|
|
|
8258
8378
|
const isCustomVisible = hangleStorageDefaultValue(storageOpts.visible, isAllCustom);
|
|
8259
8379
|
const isCustomFixed = hangleStorageDefaultValue(storageOpts.fixed, isAllCustom);
|
|
8260
8380
|
const isCustomSort = hangleStorageDefaultValue(storageOpts.sort, isAllCustom);
|
|
8381
|
+
const isCustomAggGroup = hangleStorageDefaultValue(storageOpts.aggGroup, isAllCustom);
|
|
8261
8382
|
const isCustomAggFunc = hangleStorageDefaultValue(storageOpts.aggFunc, isAllCustom);
|
|
8262
8383
|
if (type !== 'reset') {
|
|
8263
8384
|
// fix:修复拖动列宽,重置按钮无法点击的问题
|
|
8264
8385
|
reactData.isCustomStatus = true;
|
|
8265
8386
|
}
|
|
8266
|
-
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)) {
|
|
8267
8388
|
if (!tableId) {
|
|
8268
8389
|
errLog('vxe.error.reqProp', ['id']);
|
|
8269
8390
|
return nextTick();
|
|
@@ -8271,9 +8392,11 @@ export default defineVxeComponent({
|
|
|
8271
8392
|
const storeData = type === 'reset'
|
|
8272
8393
|
? {
|
|
8273
8394
|
resizableData: {},
|
|
8274
|
-
sortData:
|
|
8395
|
+
sortData: [],
|
|
8275
8396
|
visibleData: {},
|
|
8276
|
-
fixedData: {}
|
|
8397
|
+
fixedData: {},
|
|
8398
|
+
aggGroupData: {},
|
|
8399
|
+
aggFuncData: {}
|
|
8277
8400
|
}
|
|
8278
8401
|
: tableMethods.getCustomStoreData();
|
|
8279
8402
|
if (updateStore) {
|
|
@@ -11054,16 +11177,17 @@ export default defineVxeComponent({
|
|
|
11054
11177
|
let rowIndex = -1;
|
|
11055
11178
|
let $rowIndex = -1;
|
|
11056
11179
|
if (rowRest) {
|
|
11180
|
+
rowIndex = rowRest.index;
|
|
11181
|
+
$rowIndex = rowRest.$index;
|
|
11182
|
+
_rowIndex = rowRest._index;
|
|
11057
11183
|
rowLevel = rowRest.level;
|
|
11184
|
+
seq = rowRest.seq;
|
|
11058
11185
|
if (isRowGroupStatus || (treeConfig && transform && seqMode === 'increasing')) {
|
|
11059
11186
|
seq = rowRest._index + 1;
|
|
11060
11187
|
}
|
|
11061
|
-
else {
|
|
11062
|
-
seq = rowRest.
|
|
11188
|
+
else if ((treeConfig && seqMode === 'fixed')) {
|
|
11189
|
+
seq = rowRest._tIndex + 1;
|
|
11063
11190
|
}
|
|
11064
|
-
rowIndex = rowRest.index;
|
|
11065
|
-
$rowIndex = rowRest.$index;
|
|
11066
|
-
_rowIndex = rowRest._index;
|
|
11067
11191
|
}
|
|
11068
11192
|
if (expandHeight) {
|
|
11069
11193
|
cellStyle.height = `${expandHeight}px`;
|
|
@@ -11545,7 +11669,7 @@ export default defineVxeComponent({
|
|
|
11545
11669
|
staticColumnFlag.value++;
|
|
11546
11670
|
});
|
|
11547
11671
|
watch(staticColumnFlag, () => {
|
|
11548
|
-
|
|
11672
|
+
nextTick(() => handleInitColumn(XEUtils.clone(reactData.staticColumns)));
|
|
11549
11673
|
});
|
|
11550
11674
|
const tableColumnFlag = ref(0);
|
|
11551
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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { VxeUI } from '@vxe-ui/core';
|
|
2
2
|
import { getFuncText } from './src/utils';
|
|
3
|
-
export const version = "4.15.0
|
|
3
|
+
export const version = "4.15.0";
|
|
4
4
|
VxeUI.version = version;
|
|
5
5
|
VxeUI.tableVersion = version;
|
|
6
6
|
VxeUI.setConfig({
|
|
@@ -138,6 +138,7 @@ VxeUI.setConfig({
|
|
|
138
138
|
// filterMethod: null,
|
|
139
139
|
// destroyOnClose: false,
|
|
140
140
|
// isEvery: false,
|
|
141
|
+
multiple: true,
|
|
141
142
|
showIcon: true
|
|
142
143
|
},
|
|
143
144
|
aggregateConfig: {
|
package/es/ui/src/log.js
CHANGED