vxe-table 4.13.5 → 4.13.7
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 +1 -1
- package/es/index.css +1 -1
- package/es/index.min.css +1 -1
- package/es/locale/lang/ar-EG.js +3 -2
- package/es/locale/lang/de-DE.js +3 -2
- package/es/locale/lang/en-US.js +2 -1
- package/es/locale/lang/es-ES.js +3 -2
- package/es/locale/lang/fr-FR.js +2 -1
- package/es/locale/lang/hu-HU.js +2 -1
- package/es/locale/lang/hy-AM.js +2 -1
- package/es/locale/lang/id-ID.js +2 -1
- package/es/locale/lang/it-IT.js +2 -1
- package/es/locale/lang/ja-JP.js +2 -1
- package/es/locale/lang/ko-KR.js +2 -1
- package/es/locale/lang/nb-NO.js +2 -1
- package/es/locale/lang/pt-BR.js +2 -1
- package/es/locale/lang/ru-RU.js +2 -1
- package/es/locale/lang/th-TH.js +2 -1
- package/es/locale/lang/ug-CN.js +2 -1
- package/es/locale/lang/uk-UA.js +2 -1
- package/es/locale/lang/vi-VN.js +2 -1
- package/es/locale/lang/zh-CHT.js +2 -1
- package/es/locale/lang/zh-CN.js +2 -1
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/table/module/custom/hook.js +11 -8
- package/es/table/module/custom/panel.js +7 -7
- package/es/table/module/export/hook.js +21 -20
- package/es/table/module/keyboard/hook.js +3 -2
- package/es/table/src/body.js +45 -10
- package/es/table/src/cell.js +159 -69
- package/es/table/src/column.js +2 -0
- package/es/table/src/columnInfo.js +1 -0
- package/es/table/src/emits.js +1 -0
- package/es/table/src/props.js +9 -7
- package/es/table/src/table.js +659 -171
- package/es/table/style.css +70 -40
- package/es/table/style.min.css +1 -1
- package/es/ui/index.js +13 -1
- package/es/ui/src/dom.js +3 -0
- package/es/ui/src/log.js +1 -1
- package/es/vxe-table/style.css +70 -40
- package/es/vxe-table/style.min.css +1 -1
- package/lib/grid/src/grid.js +1 -1
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/index.css +1 -1
- package/lib/index.min.css +1 -1
- package/lib/index.umd.js +419 -179
- package/lib/index.umd.min.js +1 -1
- package/lib/locale/lang/ar-EG.js +3 -2
- package/lib/locale/lang/ar-EG.min.js +1 -1
- package/lib/locale/lang/de-DE.js +3 -2
- package/lib/locale/lang/de-DE.min.js +1 -1
- package/lib/locale/lang/en-US.js +2 -1
- package/lib/locale/lang/en-US.min.js +1 -1
- package/lib/locale/lang/en-US.umd.js +2 -1
- package/lib/locale/lang/es-ES.js +3 -2
- package/lib/locale/lang/es-ES.min.js +1 -1
- package/lib/locale/lang/es-ES.umd.js +3 -2
- package/lib/locale/lang/fr-FR.js +2 -1
- package/lib/locale/lang/fr-FR.min.js +1 -1
- package/lib/locale/lang/hu-HU.js +2 -1
- package/lib/locale/lang/hu-HU.min.js +1 -1
- package/lib/locale/lang/hu-HU.umd.js +2 -1
- package/lib/locale/lang/hy-AM.js +2 -1
- package/lib/locale/lang/hy-AM.min.js +1 -1
- package/lib/locale/lang/id-ID.js +2 -1
- package/lib/locale/lang/id-ID.min.js +1 -1
- package/lib/locale/lang/it-IT.js +2 -1
- package/lib/locale/lang/it-IT.min.js +1 -1
- package/lib/locale/lang/ja-JP.js +2 -1
- package/lib/locale/lang/ja-JP.min.js +1 -1
- package/lib/locale/lang/ja-JP.umd.js +2 -1
- package/lib/locale/lang/ko-KR.js +2 -1
- package/lib/locale/lang/ko-KR.min.js +1 -1
- package/lib/locale/lang/ko-KR.umd.js +2 -1
- package/lib/locale/lang/nb-NO.js +2 -1
- package/lib/locale/lang/nb-NO.min.js +1 -1
- package/lib/locale/lang/pt-BR.js +2 -1
- package/lib/locale/lang/pt-BR.min.js +1 -1
- package/lib/locale/lang/pt-BR.umd.js +2 -1
- package/lib/locale/lang/ru-RU.js +2 -1
- package/lib/locale/lang/ru-RU.min.js +1 -1
- package/lib/locale/lang/ru-RU.umd.js +2 -1
- package/lib/locale/lang/th-TH.js +2 -1
- package/lib/locale/lang/th-TH.min.js +1 -1
- package/lib/locale/lang/ug-CN.js +2 -1
- package/lib/locale/lang/ug-CN.min.js +1 -1
- package/lib/locale/lang/uk-UA.js +2 -1
- package/lib/locale/lang/uk-UA.min.js +1 -1
- package/lib/locale/lang/uk-UA.umd.js +2 -1
- package/lib/locale/lang/vi-VN.js +2 -1
- package/lib/locale/lang/vi-VN.min.js +1 -1
- package/lib/locale/lang/zh-CHT.js +2 -1
- package/lib/locale/lang/zh-CHT.min.js +1 -1
- package/lib/locale/lang/zh-CN.js +2 -1
- package/lib/locale/lang/zh-CN.min.js +1 -1
- package/lib/locale/lang/zh-CN.umd.js +2 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/table/module/custom/hook.js +11 -1
- package/lib/table/module/custom/hook.min.js +1 -1
- package/lib/table/module/custom/panel.js +6 -2
- package/lib/table/module/custom/panel.min.js +1 -1
- package/lib/table/module/export/hook.js +21 -11
- package/lib/table/module/export/hook.min.js +1 -1
- package/lib/table/module/keyboard/hook.js +2 -1
- package/lib/table/module/keyboard/hook.min.js +1 -1
- package/lib/table/src/body.js +35 -9
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/cell.js +177 -52
- package/lib/table/src/cell.min.js +1 -1
- package/lib/table/src/column.js +2 -0
- package/lib/table/src/column.min.js +1 -1
- package/lib/table/src/columnInfo.js +1 -0
- package/lib/table/src/columnInfo.min.js +1 -1
- package/lib/table/src/emits.js +1 -1
- package/lib/table/src/emits.min.js +1 -1
- package/lib/table/src/props.js +9 -7
- package/lib/table/src/props.min.js +1 -1
- package/lib/table/src/table.js +134 -91
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/style/style.css +70 -40
- package/lib/table/style/style.min.css +1 -1
- package/lib/ui/index.js +13 -1
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/dom.js +4 -0
- package/lib/ui/src/dom.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/lib/vxe-table/style/style.css +70 -40
- package/lib/vxe-table/style/style.min.css +1 -1
- package/package.json +2 -2
- package/packages/grid/src/grid.ts +1 -1
- package/packages/locale/lang/ar-EG.ts +3 -2
- package/packages/locale/lang/de-DE.ts +3 -2
- package/packages/locale/lang/en-US.ts +2 -1
- package/packages/locale/lang/es-ES.ts +3 -2
- package/packages/locale/lang/fr-FR.ts +2 -1
- package/packages/locale/lang/hu-HU.ts +2 -1
- package/packages/locale/lang/hy-AM.ts +2 -1
- package/packages/locale/lang/id-ID.ts +2 -1
- package/packages/locale/lang/it-IT.ts +2 -1
- package/packages/locale/lang/ja-JP.ts +2 -1
- package/packages/locale/lang/ko-KR.ts +2 -1
- package/packages/locale/lang/nb-NO.ts +2 -1
- package/packages/locale/lang/pt-BR.ts +2 -1
- package/packages/locale/lang/ru-RU.ts +2 -1
- package/packages/locale/lang/th-TH.ts +2 -1
- package/packages/locale/lang/ug-CN.ts +2 -1
- package/packages/locale/lang/uk-UA.ts +2 -1
- package/packages/locale/lang/vi-VN.ts +2 -1
- package/packages/locale/lang/zh-CHT.ts +2 -1
- package/packages/locale/lang/zh-CN.ts +2 -1
- package/packages/table/module/custom/hook.ts +14 -8
- package/packages/table/module/custom/panel.ts +7 -7
- package/packages/table/module/export/hook.ts +28 -27
- package/packages/table/module/keyboard/hook.ts +3 -2
- package/packages/table/src/body.ts +46 -10
- package/packages/table/src/cell.ts +162 -73
- package/packages/table/src/column.ts +2 -0
- package/packages/table/src/columnInfo.ts +1 -0
- package/packages/table/src/emits.ts +1 -0
- package/packages/table/src/props.ts +9 -7
- package/packages/table/src/table.ts +664 -176
- package/packages/ui/index.ts +12 -0
- package/packages/ui/src/dom.ts +4 -0
- package/styles/components/table.scss +131 -92
- /package/es/{iconfont.1744880866629.ttf → iconfont.1745290253213.ttf} +0 -0
- /package/es/{iconfont.1744880866629.woff → iconfont.1745290253213.woff} +0 -0
- /package/es/{iconfont.1744880866629.woff2 → iconfont.1745290253213.woff2} +0 -0
- /package/lib/{iconfont.1744880866629.ttf → iconfont.1745290253213.ttf} +0 -0
- /package/lib/{iconfont.1744880866629.woff → iconfont.1745290253213.woff} +0 -0
- /package/lib/{iconfont.1744880866629.woff2 → iconfont.1745290253213.woff2} +0 -0
package/es/table/src/table.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent, h, reactive, ref, provide, inject, nextTick, onActivated, onDeactivated, onBeforeUnmount, onUnmounted, watch, computed, onMounted } from 'vue';
|
|
2
2
|
import XEUtils from 'xe-utils';
|
|
3
|
-
import { initTpImg, getTpImg, isPx, isScale, hasClass, addClass, removeClass, getEventTargetNode, getPaddingTopBottomSize, getOffsetPos, setScrollTop, setScrollLeft, toCssUnit } from '../../ui/src/dom';
|
|
3
|
+
import { initTpImg, getTpImg, isPx, isScale, hasClass, addClass, removeClass, getEventTargetNode, getPaddingTopBottomSize, getOffsetPos, setScrollTop, setScrollLeft, toCssUnit, hasControlKey } from '../../ui/src/dom';
|
|
4
4
|
import { getLastZIndex, nextZIndex, hasChildrenList, getFuncText, isEnableConf, formatText, eqEmptyValue } from '../../ui/src/utils';
|
|
5
5
|
import { VxeUI } from '../../ui';
|
|
6
6
|
import Cell from './cell';
|
|
@@ -77,6 +77,8 @@ export default defineComponent({
|
|
|
77
77
|
selectRadioRow: null,
|
|
78
78
|
// 表尾合计数据
|
|
79
79
|
footerTableData: [],
|
|
80
|
+
// 行分组列信息
|
|
81
|
+
rowGroupColumn: null,
|
|
80
82
|
// 展开列信息
|
|
81
83
|
expandColumn: null,
|
|
82
84
|
// 树节点列信息
|
|
@@ -228,6 +230,10 @@ export default defineComponent({
|
|
|
228
230
|
isTitle: false,
|
|
229
231
|
isFooter: false
|
|
230
232
|
},
|
|
233
|
+
visiblwRowsFlag: 1,
|
|
234
|
+
isRowGroupStatus: false,
|
|
235
|
+
rowGroupList: [],
|
|
236
|
+
rowGroupExpandedFlag: 1,
|
|
231
237
|
rowExpandedFlag: 1,
|
|
232
238
|
treeExpandedFlag: 1,
|
|
233
239
|
updateCheckboxFlag: 1,
|
|
@@ -317,10 +323,13 @@ export default defineComponent({
|
|
|
317
323
|
tableFullData: [],
|
|
318
324
|
afterFullData: [],
|
|
319
325
|
afterTreeFullData: [],
|
|
326
|
+
afterGroupFullData: [],
|
|
320
327
|
// 列表条件处理后数据集合
|
|
321
328
|
afterFullRowMaps: {},
|
|
322
329
|
// 树结构完整数据、条件处理后
|
|
323
330
|
tableFullTreeData: [],
|
|
331
|
+
// 行分组全量数据、条件处理后
|
|
332
|
+
tableFullGroupData: [],
|
|
324
333
|
tableSynchData: [],
|
|
325
334
|
tableSourceData: [],
|
|
326
335
|
// 收集的列配置(带分组)
|
|
@@ -353,6 +362,8 @@ export default defineComponent({
|
|
|
353
362
|
rowExpandedMaps: {},
|
|
354
363
|
// 懒加载中的展开行的集合
|
|
355
364
|
rowExpandLazyLoadedMaps: {},
|
|
365
|
+
// 已展开的分组行
|
|
366
|
+
rowGroupExpandedMaps: {},
|
|
356
367
|
// 已展开树节点集合
|
|
357
368
|
treeExpandedMaps: {},
|
|
358
369
|
// 懒加载中的树节点的集合
|
|
@@ -512,6 +523,9 @@ export default defineComponent({
|
|
|
512
523
|
const computeRowOpts = computed(() => {
|
|
513
524
|
return Object.assign({}, getConfig().table.rowConfig, props.rowConfig);
|
|
514
525
|
});
|
|
526
|
+
const computeRowGroupOpts = computed(() => {
|
|
527
|
+
return Object.assign({}, getConfig().table.rowGroupConfig, props.rowGroupConfig);
|
|
528
|
+
});
|
|
515
529
|
const computeCurrentRowOpts = computed(() => {
|
|
516
530
|
return Object.assign({}, getConfig().table.currentRowConfig, props.currentRowConfig);
|
|
517
531
|
});
|
|
@@ -656,20 +670,22 @@ export default defineComponent({
|
|
|
656
670
|
});
|
|
657
671
|
const computeTableRowExpandedList = computed(() => {
|
|
658
672
|
const { treeConfig } = props;
|
|
659
|
-
const { rowExpandedFlag, expandColumn } = reactData;
|
|
673
|
+
const { rowExpandedFlag, expandColumn, rowGroupExpandedFlag, treeExpandedFlag, isRowGroupStatus } = reactData;
|
|
660
674
|
const { visibleDataRowIdData, rowExpandedMaps } = internalData;
|
|
661
675
|
const treeOpts = computeTreeOpts.value;
|
|
662
676
|
const { transform } = treeOpts;
|
|
663
677
|
const expandList = [];
|
|
664
|
-
if (expandColumn && rowExpandedFlag) {
|
|
665
|
-
if (treeConfig &&
|
|
678
|
+
if (expandColumn && rowExpandedFlag && rowGroupExpandedFlag && treeExpandedFlag) {
|
|
679
|
+
if (isRowGroupStatus || (treeConfig && transform)) {
|
|
680
|
+
XEUtils.each(rowExpandedMaps, (row, rowid) => {
|
|
681
|
+
if (visibleDataRowIdData[rowid]) {
|
|
682
|
+
expandList.push(row);
|
|
683
|
+
}
|
|
684
|
+
});
|
|
685
|
+
}
|
|
686
|
+
else {
|
|
666
687
|
return XEUtils.values(rowExpandedMaps);
|
|
667
688
|
}
|
|
668
|
-
XEUtils.each(rowExpandedMaps, (row, rowid) => {
|
|
669
|
-
if (visibleDataRowIdData[rowid]) {
|
|
670
|
-
expandList.push(row);
|
|
671
|
-
}
|
|
672
|
-
});
|
|
673
689
|
}
|
|
674
690
|
return expandList;
|
|
675
691
|
});
|
|
@@ -724,7 +740,7 @@ export default defineComponent({
|
|
|
724
740
|
// 暂时不支持树形结构
|
|
725
741
|
}
|
|
726
742
|
// 如果所有行都被禁用
|
|
727
|
-
return tableFullData.every((row) => !checkMethod({ row }));
|
|
743
|
+
return tableFullData.every((row) => !checkMethod({ $table: $xeTable, row }));
|
|
728
744
|
}
|
|
729
745
|
return false;
|
|
730
746
|
}
|
|
@@ -739,6 +755,10 @@ export default defineComponent({
|
|
|
739
755
|
y: overflowY && scrollYLoad
|
|
740
756
|
};
|
|
741
757
|
});
|
|
758
|
+
const computeRowGroupFields = computed(() => {
|
|
759
|
+
const rowGroupOpts = computeRowGroupOpts.value;
|
|
760
|
+
return rowGroupOpts.groupFields;
|
|
761
|
+
});
|
|
742
762
|
const refMaps = {
|
|
743
763
|
refElem,
|
|
744
764
|
refTooltip,
|
|
@@ -785,6 +805,7 @@ export default defineComponent({
|
|
|
785
805
|
computeHeaderCellOpts,
|
|
786
806
|
computeFooterCellOpts,
|
|
787
807
|
computeRowOpts,
|
|
808
|
+
computeRowGroupOpts,
|
|
788
809
|
computeCurrentRowOpts,
|
|
789
810
|
computeRowDragOpts,
|
|
790
811
|
computeColumnDragOpts,
|
|
@@ -1282,7 +1303,7 @@ export default defineComponent({
|
|
|
1282
1303
|
}
|
|
1283
1304
|
const storeData = getCustomStorageMap(tableId);
|
|
1284
1305
|
if (restoreStore) {
|
|
1285
|
-
return Promise.resolve(restoreStore({ id: tableId, type: 'restore', storeData })).then(storeData => {
|
|
1306
|
+
return Promise.resolve(restoreStore({ $table: $xeTable, id: tableId, type: 'restore', storeData })).then(storeData => {
|
|
1286
1307
|
if (!storeData) {
|
|
1287
1308
|
return;
|
|
1288
1309
|
}
|
|
@@ -1313,6 +1334,7 @@ export default defineComponent({
|
|
|
1313
1334
|
const rowOpts = computeRowOpts.value;
|
|
1314
1335
|
const isGroup = collectColumn.some(hasChildrenList);
|
|
1315
1336
|
let isAllOverflow = !!props.showOverflow;
|
|
1337
|
+
let rowGroupColumn;
|
|
1316
1338
|
let expandColumn;
|
|
1317
1339
|
let treeNodeColumn;
|
|
1318
1340
|
let checkboxColumn;
|
|
@@ -1320,7 +1342,7 @@ export default defineComponent({
|
|
|
1320
1342
|
let htmlColumn;
|
|
1321
1343
|
let hasFixed;
|
|
1322
1344
|
const handleFunc = (column, index, items, path, parentColumn) => {
|
|
1323
|
-
const { id: colid, field, fixed, type, treeNode } = column;
|
|
1345
|
+
const { id: colid, field, fixed, type, treeNode, rowGroupNode } = column;
|
|
1324
1346
|
const rest = { $index: -1, _index: -1, column, colid, index, items, parent: parentColumn || null, width: 0, oLeft: 0 };
|
|
1325
1347
|
if (field) {
|
|
1326
1348
|
if (fullColumnFieldData[field]) {
|
|
@@ -1347,7 +1369,15 @@ export default defineComponent({
|
|
|
1347
1369
|
treeNodeColumn = column;
|
|
1348
1370
|
}
|
|
1349
1371
|
}
|
|
1350
|
-
|
|
1372
|
+
if (rowGroupNode) {
|
|
1373
|
+
if (treeNodeColumn) {
|
|
1374
|
+
warnLog('vxe.error.colRepet', ['row-group-node', rowGroupNode]);
|
|
1375
|
+
}
|
|
1376
|
+
if (!rowGroupColumn) {
|
|
1377
|
+
rowGroupColumn = column;
|
|
1378
|
+
}
|
|
1379
|
+
}
|
|
1380
|
+
if (type === 'expand') {
|
|
1351
1381
|
if (expandColumn) {
|
|
1352
1382
|
warnLog('vxe.error.colRepet', ['type', type]);
|
|
1353
1383
|
}
|
|
@@ -1403,6 +1433,7 @@ export default defineComponent({
|
|
|
1403
1433
|
}
|
|
1404
1434
|
}
|
|
1405
1435
|
reactData.isGroup = isGroup;
|
|
1436
|
+
reactData.rowGroupColumn = rowGroupColumn;
|
|
1406
1437
|
reactData.treeNodeColumn = treeNodeColumn;
|
|
1407
1438
|
reactData.expandColumn = expandColumn;
|
|
1408
1439
|
reactData.isAllOverflow = isAllOverflow;
|
|
@@ -1673,18 +1704,20 @@ export default defineComponent({
|
|
|
1673
1704
|
}
|
|
1674
1705
|
};
|
|
1675
1706
|
/**
|
|
1676
|
-
*
|
|
1707
|
+
* 如果为虚拟树、行分组、则将树结构拍平
|
|
1677
1708
|
* @returns
|
|
1678
1709
|
*/
|
|
1679
1710
|
const handleVirtualTreeToList = () => {
|
|
1680
1711
|
const { treeConfig } = props;
|
|
1681
|
-
const {
|
|
1712
|
+
const { isRowGroupStatus } = reactData;
|
|
1713
|
+
const { fullAllDataRowIdData, treeExpandedMaps, rowGroupExpandedMaps } = internalData;
|
|
1714
|
+
const rowGroupOpts = computeRowGroupOpts.value;
|
|
1682
1715
|
const treeOpts = computeTreeOpts.value;
|
|
1683
|
-
const
|
|
1716
|
+
const { handleGetRowId } = createHandleGetRowId($xeTable);
|
|
1717
|
+
const fullData = [];
|
|
1718
|
+
const expandMaps = {};
|
|
1684
1719
|
if (treeConfig && treeOpts.transform) {
|
|
1685
|
-
const
|
|
1686
|
-
const fullData = [];
|
|
1687
|
-
const expandMaps = {};
|
|
1720
|
+
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
1688
1721
|
XEUtils.eachTree(internalData.afterTreeFullData, (row, index, items, path, parentRow) => {
|
|
1689
1722
|
const rowid = handleGetRowId(row);
|
|
1690
1723
|
const parentRowid = handleGetRowId(parentRow);
|
|
@@ -1701,17 +1734,37 @@ export default defineComponent({
|
|
|
1701
1734
|
updateScrollYStatus(fullData);
|
|
1702
1735
|
return fullData;
|
|
1703
1736
|
}
|
|
1737
|
+
else if (isRowGroupStatus) {
|
|
1738
|
+
const { childrenField } = rowGroupOpts;
|
|
1739
|
+
XEUtils.eachTree(internalData.afterGroupFullData, (row, index, items, path, parentRow) => {
|
|
1740
|
+
const rowid = handleGetRowId(row);
|
|
1741
|
+
const parentRowid = handleGetRowId(parentRow);
|
|
1742
|
+
if (!parentRow || (expandMaps[parentRowid] && rowGroupExpandedMaps[parentRowid])) {
|
|
1743
|
+
const rowRest = fullAllDataRowIdData[rowid];
|
|
1744
|
+
if (rowRest) {
|
|
1745
|
+
rowRest._index = fullData.length;
|
|
1746
|
+
}
|
|
1747
|
+
expandMaps[rowid] = 1;
|
|
1748
|
+
fullData.push(row);
|
|
1749
|
+
}
|
|
1750
|
+
}, { children: childrenField });
|
|
1751
|
+
internalData.afterFullData = fullData;
|
|
1752
|
+
updateScrollYStatus(fullData);
|
|
1753
|
+
return fullData;
|
|
1754
|
+
}
|
|
1704
1755
|
return internalData.afterFullData;
|
|
1705
1756
|
};
|
|
1706
1757
|
/**
|
|
1707
|
-
*
|
|
1758
|
+
* 编译处理后全量的表格数据
|
|
1708
1759
|
* 如果存在筛选条件,继续处理
|
|
1709
1760
|
*/
|
|
1710
1761
|
const updateAfterFullData = () => {
|
|
1711
1762
|
const { treeConfig } = props;
|
|
1712
|
-
const {
|
|
1763
|
+
const { isRowGroupStatus } = reactData;
|
|
1764
|
+
const { tableFullColumn, tableFullData, tableFullTreeData, tableFullGroupData } = internalData;
|
|
1713
1765
|
const filterOpts = computeFilterOpts.value;
|
|
1714
1766
|
const sortOpts = computeSortOpts.value;
|
|
1767
|
+
const rowGroupOpts = computeRowGroupOpts.value;
|
|
1715
1768
|
const treeOpts = computeTreeOpts.value;
|
|
1716
1769
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
1717
1770
|
const { transform, rowField, parentField, mapChildrenField } = treeOpts;
|
|
@@ -1762,7 +1815,7 @@ export default defineComponent({
|
|
|
1762
1815
|
return itemList.some((item) => compFilterMethod({ value: item.value, option: item, cellValue, row, column, $table: $xeTable }));
|
|
1763
1816
|
}
|
|
1764
1817
|
else if (allFilterMethod) {
|
|
1765
|
-
return allFilterMethod({ options: itemList, values: valueList, cellValue, row, column });
|
|
1818
|
+
return allFilterMethod({ $table: $xeTable, options: itemList, values: valueList, cellValue, row, column });
|
|
1766
1819
|
}
|
|
1767
1820
|
else if (tdFilterMethod) {
|
|
1768
1821
|
return itemList.some((item) => tdFilterMethod({ value: item.value, option: item, cellValue, row, column, $table: $xeTable }));
|
|
@@ -1770,7 +1823,17 @@ export default defineComponent({
|
|
|
1770
1823
|
return valueList.indexOf(XEUtils.get(row, column.field)) > -1;
|
|
1771
1824
|
});
|
|
1772
1825
|
};
|
|
1773
|
-
if (
|
|
1826
|
+
if (isRowGroupStatus) {
|
|
1827
|
+
// 行分组
|
|
1828
|
+
tableTree = XEUtils.searchTree(tableFullGroupData, handleFilter, {
|
|
1829
|
+
original: true,
|
|
1830
|
+
isEvery: true,
|
|
1831
|
+
children: rowGroupOpts.mapChildrenField,
|
|
1832
|
+
mapChildren: rowGroupOpts.childrenField
|
|
1833
|
+
});
|
|
1834
|
+
tableData = tableTree;
|
|
1835
|
+
}
|
|
1836
|
+
else if (treeConfig && transform) {
|
|
1774
1837
|
// 筛选虚拟树
|
|
1775
1838
|
tableTree = XEUtils.searchTree(tableFullTreeData, handleFilter, {
|
|
1776
1839
|
original: true,
|
|
@@ -1786,7 +1849,17 @@ export default defineComponent({
|
|
|
1786
1849
|
}
|
|
1787
1850
|
}
|
|
1788
1851
|
else {
|
|
1789
|
-
if (
|
|
1852
|
+
if (isRowGroupStatus) {
|
|
1853
|
+
// 还原行分组
|
|
1854
|
+
tableTree = XEUtils.searchTree(tableFullGroupData, () => true, {
|
|
1855
|
+
original: true,
|
|
1856
|
+
isEvery: true,
|
|
1857
|
+
children: rowGroupOpts.mapChildrenField,
|
|
1858
|
+
mapChildren: rowGroupOpts.childrenField
|
|
1859
|
+
});
|
|
1860
|
+
tableData = tableTree;
|
|
1861
|
+
}
|
|
1862
|
+
else if (treeConfig && transform) {
|
|
1790
1863
|
// 还原虚拟树
|
|
1791
1864
|
tableTree = XEUtils.searchTree(tableFullTreeData, () => true, {
|
|
1792
1865
|
original: true,
|
|
@@ -1801,11 +1874,32 @@ export default defineComponent({
|
|
|
1801
1874
|
tableTree = tableData;
|
|
1802
1875
|
}
|
|
1803
1876
|
}
|
|
1804
|
-
//
|
|
1877
|
+
// 处理排序
|
|
1805
1878
|
// 支持单列、多列、组合排序
|
|
1806
1879
|
if (!allRemoteSort && orderColumns.length) {
|
|
1807
|
-
if (
|
|
1808
|
-
//
|
|
1880
|
+
if (isRowGroupStatus) {
|
|
1881
|
+
// 行分组的排序
|
|
1882
|
+
if (allSortMethod) {
|
|
1883
|
+
const sortRests = allSortMethod({ data: tableTree, sortList: orderColumns, $table: $xeTable });
|
|
1884
|
+
tableTree = XEUtils.isArray(sortRests) ? sortRests : tableTree;
|
|
1885
|
+
}
|
|
1886
|
+
else {
|
|
1887
|
+
const treeList = XEUtils.toTreeArray(tableTree, {
|
|
1888
|
+
key: rowGroupOpts.rowField,
|
|
1889
|
+
parentKey: rowGroupOpts.parentField,
|
|
1890
|
+
children: rowGroupOpts.mapChildrenField
|
|
1891
|
+
});
|
|
1892
|
+
tableTree = XEUtils.toArrayTree(XEUtils.orderBy(treeList, orderColumns.map(({ column, order }) => [getOrderField(column), order])), {
|
|
1893
|
+
key: rowGroupOpts.rowField,
|
|
1894
|
+
parentKey: rowGroupOpts.parentField,
|
|
1895
|
+
children: rowGroupOpts.childrenField,
|
|
1896
|
+
mapChildren: rowGroupOpts.mapChildrenField
|
|
1897
|
+
});
|
|
1898
|
+
}
|
|
1899
|
+
tableData = tableTree;
|
|
1900
|
+
}
|
|
1901
|
+
else if (treeConfig && transform) {
|
|
1902
|
+
// 虚拟树的排序
|
|
1809
1903
|
if (allSortMethod) {
|
|
1810
1904
|
const sortRests = allSortMethod({ data: tableTree, sortList: orderColumns, $table: $xeTable });
|
|
1811
1905
|
tableTree = XEUtils.isArray(sortRests) ? sortRests : tableTree;
|
|
@@ -1836,12 +1930,23 @@ export default defineComponent({
|
|
|
1836
1930
|
}
|
|
1837
1931
|
}
|
|
1838
1932
|
else {
|
|
1839
|
-
if (
|
|
1933
|
+
if (isRowGroupStatus) {
|
|
1934
|
+
// 还原行分组
|
|
1935
|
+
// 还原虚拟树
|
|
1936
|
+
tableTree = XEUtils.searchTree(tableFullGroupData, () => true, {
|
|
1937
|
+
original: true,
|
|
1938
|
+
isEvery: true,
|
|
1939
|
+
children: rowGroupOpts.mapChildrenField,
|
|
1940
|
+
mapChildren: rowGroupOpts.childrenField
|
|
1941
|
+
});
|
|
1942
|
+
tableData = tableTree;
|
|
1943
|
+
}
|
|
1944
|
+
else if (treeConfig && transform) {
|
|
1840
1945
|
// 还原虚拟树
|
|
1841
1946
|
tableTree = XEUtils.searchTree(tableFullTreeData, () => true, {
|
|
1842
1947
|
original: true,
|
|
1843
1948
|
isEvery,
|
|
1844
|
-
children:
|
|
1949
|
+
children: mapChildrenField,
|
|
1845
1950
|
mapChildren: childrenField
|
|
1846
1951
|
});
|
|
1847
1952
|
tableData = tableTree;
|
|
@@ -1853,6 +1958,7 @@ export default defineComponent({
|
|
|
1853
1958
|
}
|
|
1854
1959
|
internalData.afterFullData = tableData;
|
|
1855
1960
|
internalData.afterTreeFullData = tableTree;
|
|
1961
|
+
internalData.afterGroupFullData = tableTree;
|
|
1856
1962
|
updateAfterDataIndex();
|
|
1857
1963
|
};
|
|
1858
1964
|
const updateStyle = () => {
|
|
@@ -2252,7 +2358,7 @@ export default defineComponent({
|
|
|
2252
2358
|
const handleCheckedRadioRow = (row, isForce) => {
|
|
2253
2359
|
const radioOpts = computeRadioOpts.value;
|
|
2254
2360
|
const { checkMethod } = radioOpts;
|
|
2255
|
-
if (row && (isForce || (!checkMethod || checkMethod({ row })))) {
|
|
2361
|
+
if (row && (isForce || (!checkMethod || checkMethod({ $table: $xeTable, row })))) {
|
|
2256
2362
|
reactData.selectRadioRow = row;
|
|
2257
2363
|
handleRadioReserveRow(row);
|
|
2258
2364
|
}
|
|
@@ -2268,8 +2374,10 @@ export default defineComponent({
|
|
|
2268
2374
|
};
|
|
2269
2375
|
const handleCheckedAllCheckboxRow = (checked, isForce) => {
|
|
2270
2376
|
const { treeConfig } = props;
|
|
2271
|
-
const {
|
|
2377
|
+
const { isRowGroupStatus } = reactData;
|
|
2378
|
+
const { afterFullData, afterTreeFullData, afterGroupFullData, checkboxReserveRowMap, selectCheckboxMaps } = internalData;
|
|
2272
2379
|
const treeOpts = computeTreeOpts.value;
|
|
2380
|
+
const rowGroupOpts = computeRowGroupOpts.value;
|
|
2273
2381
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
2274
2382
|
const checkboxOpts = computeCheckboxOpts.value;
|
|
2275
2383
|
const { checkField, reserve, checkMethod } = checkboxOpts;
|
|
@@ -2278,24 +2386,24 @@ export default defineComponent({
|
|
|
2278
2386
|
const indeterminateField = checkboxOpts.indeterminateField || checkboxOpts.halfField;
|
|
2279
2387
|
const selectRowMaps = {};
|
|
2280
2388
|
/**
|
|
2281
|
-
*
|
|
2389
|
+
* 绑定属性方式(有污染)
|
|
2282
2390
|
* 必须在行数据存在对应的属性,否则将不响应
|
|
2283
2391
|
*/
|
|
2284
2392
|
if (checkField) {
|
|
2285
2393
|
const checkValFn = (row) => {
|
|
2286
|
-
if (isForce || (!checkMethod || checkMethod({ row }))) {
|
|
2394
|
+
if (isForce || (!checkMethod || checkMethod({ $table: $xeTable, row }))) {
|
|
2287
2395
|
if (checked) {
|
|
2288
2396
|
selectRowMaps[handleGetRowId(row)] = row;
|
|
2289
2397
|
}
|
|
2290
2398
|
XEUtils.set(row, checkField, checked);
|
|
2291
2399
|
}
|
|
2292
|
-
if (treeConfig && indeterminateField) {
|
|
2400
|
+
if ((treeConfig || isRowGroupStatus) && indeterminateField) {
|
|
2293
2401
|
XEUtils.set(row, indeterminateField, false);
|
|
2294
2402
|
}
|
|
2295
2403
|
};
|
|
2296
2404
|
// 如果存在选中方法
|
|
2297
2405
|
// 如果方法成立,则更新值,否则忽略该数据
|
|
2298
|
-
if (treeConfig) {
|
|
2406
|
+
if ((treeConfig || isRowGroupStatus)) {
|
|
2299
2407
|
XEUtils.eachTree(afterFullData, checkValFn, { children: childrenField });
|
|
2300
2408
|
}
|
|
2301
2409
|
else {
|
|
@@ -2304,17 +2412,45 @@ export default defineComponent({
|
|
|
2304
2412
|
}
|
|
2305
2413
|
else {
|
|
2306
2414
|
/**
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
if (
|
|
2415
|
+
* 默认方式(无污染)
|
|
2416
|
+
* 无需任何属性,直接绑定
|
|
2417
|
+
*/
|
|
2418
|
+
if (isRowGroupStatus) {
|
|
2419
|
+
if (checked) {
|
|
2420
|
+
/**
|
|
2421
|
+
* 如果是行分组勾选
|
|
2422
|
+
* 如果方法成立,则添加到临时集合中
|
|
2423
|
+
*/
|
|
2424
|
+
XEUtils.eachTree(afterGroupFullData, (row) => {
|
|
2425
|
+
if (isForce || (!checkMethod || checkMethod({ $table: $xeTable, row }))) {
|
|
2426
|
+
const rowid = handleGetRowId(row);
|
|
2427
|
+
selectRowMaps[rowid] = row;
|
|
2428
|
+
}
|
|
2429
|
+
}, { children: rowGroupOpts.mapChildrenField });
|
|
2430
|
+
}
|
|
2431
|
+
else {
|
|
2432
|
+
/**
|
|
2433
|
+
* 如果是树取消
|
|
2434
|
+
* 如果方法成立,则不添加到临时集合中
|
|
2435
|
+
*/
|
|
2436
|
+
if (!isForce && checkMethod) {
|
|
2437
|
+
XEUtils.eachTree(afterGroupFullData, (row) => {
|
|
2438
|
+
const rowid = handleGetRowId(row);
|
|
2439
|
+
if (checkMethod({ $table: $xeTable, row }) ? false : selectCheckboxMaps[rowid]) {
|
|
2440
|
+
selectRowMaps[rowid] = row;
|
|
2441
|
+
}
|
|
2442
|
+
}, { children: rowGroupOpts.mapChildrenField });
|
|
2443
|
+
}
|
|
2444
|
+
}
|
|
2445
|
+
}
|
|
2446
|
+
else if (treeConfig) {
|
|
2311
2447
|
if (checked) {
|
|
2312
2448
|
/**
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
XEUtils.eachTree(
|
|
2317
|
-
if (isForce || (!checkMethod || checkMethod({ row }))) {
|
|
2449
|
+
* 如果是树勾选
|
|
2450
|
+
* 如果方法成立,则添加到临时集合中
|
|
2451
|
+
*/
|
|
2452
|
+
XEUtils.eachTree(afterTreeFullData, (row) => {
|
|
2453
|
+
if (isForce || (!checkMethod || checkMethod({ $table: $xeTable, row }))) {
|
|
2318
2454
|
const rowid = handleGetRowId(row);
|
|
2319
2455
|
selectRowMaps[rowid] = row;
|
|
2320
2456
|
}
|
|
@@ -2322,13 +2458,13 @@ export default defineComponent({
|
|
|
2322
2458
|
}
|
|
2323
2459
|
else {
|
|
2324
2460
|
/**
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2461
|
+
* 如果是树取消
|
|
2462
|
+
* 如果方法成立,则不添加到临时集合中
|
|
2463
|
+
*/
|
|
2328
2464
|
if (!isForce && checkMethod) {
|
|
2329
|
-
XEUtils.eachTree(
|
|
2465
|
+
XEUtils.eachTree(afterTreeFullData, (row) => {
|
|
2330
2466
|
const rowid = handleGetRowId(row);
|
|
2331
|
-
if (checkMethod({ row }) ?
|
|
2467
|
+
if (checkMethod({ $table: $xeTable, row }) ? false : selectCheckboxMaps[rowid]) {
|
|
2332
2468
|
selectRowMaps[rowid] = row;
|
|
2333
2469
|
}
|
|
2334
2470
|
}, { children: childrenField });
|
|
@@ -2338,14 +2474,14 @@ export default defineComponent({
|
|
|
2338
2474
|
else {
|
|
2339
2475
|
if (checked) {
|
|
2340
2476
|
/**
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2477
|
+
* 如果是行勾选
|
|
2478
|
+
* 如果存在选中方法且成立或者本身已勾选,则添加到临时集合中
|
|
2479
|
+
* 如果不存在选中方法,则添加所有数据到临时集合中
|
|
2480
|
+
*/
|
|
2345
2481
|
if (!isForce && checkMethod) {
|
|
2346
2482
|
afterFullData.forEach((row) => {
|
|
2347
2483
|
const rowid = handleGetRowId(row);
|
|
2348
|
-
if (selectCheckboxMaps[rowid] || checkMethod({ row })) {
|
|
2484
|
+
if (selectCheckboxMaps[rowid] || checkMethod({ $table: $xeTable, row })) {
|
|
2349
2485
|
selectRowMaps[rowid] = row;
|
|
2350
2486
|
}
|
|
2351
2487
|
});
|
|
@@ -2359,14 +2495,14 @@ export default defineComponent({
|
|
|
2359
2495
|
}
|
|
2360
2496
|
else {
|
|
2361
2497
|
/**
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2498
|
+
* 如果是行取消
|
|
2499
|
+
* 如果方法成立,则不添加到临时集合中;如果方法不成立则判断当前是否已勾选,如果已被勾选则添加到新集合中
|
|
2500
|
+
* 如果不存在选中方法,无需处理,临时集合默认为空
|
|
2501
|
+
*/
|
|
2366
2502
|
if (!isForce && checkMethod) {
|
|
2367
2503
|
afterFullData.forEach((row) => {
|
|
2368
2504
|
const rowid = handleGetRowId(row);
|
|
2369
|
-
if (checkMethod({ row }) ?
|
|
2505
|
+
if (checkMethod({ $table: $xeTable, row }) ? false : selectCheckboxMaps[rowid]) {
|
|
2370
2506
|
selectRowMaps[rowid] = row;
|
|
2371
2507
|
}
|
|
2372
2508
|
});
|
|
@@ -2711,14 +2847,85 @@ export default defineComponent({
|
|
|
2711
2847
|
}
|
|
2712
2848
|
});
|
|
2713
2849
|
};
|
|
2850
|
+
const handleUpdateRowGroup = (groupFields) => {
|
|
2851
|
+
reactData.rowGroupList = groupFields
|
|
2852
|
+
? (XEUtils.isArray(groupFields) ? groupFields : [groupFields]).map(field => {
|
|
2853
|
+
return {
|
|
2854
|
+
field
|
|
2855
|
+
};
|
|
2856
|
+
})
|
|
2857
|
+
: [];
|
|
2858
|
+
};
|
|
2859
|
+
const handleGroupData = (list, rowGroups) => {
|
|
2860
|
+
let fullData = list;
|
|
2861
|
+
let treeData = list;
|
|
2862
|
+
if (rowGroups) {
|
|
2863
|
+
const rowGroupOpts = computeRowGroupOpts.value;
|
|
2864
|
+
const { rowField, parentField, childrenField, mapChildrenField } = rowGroupOpts;
|
|
2865
|
+
const checkboxOpts = computeCheckboxOpts.value;
|
|
2866
|
+
const { checkField } = checkboxOpts;
|
|
2867
|
+
const indeterminateField = checkboxOpts.indeterminateField || checkboxOpts.halfField;
|
|
2868
|
+
const rgItem = rowGroups[0];
|
|
2869
|
+
if (rgItem && rowField && parentField && childrenField && mapChildrenField) {
|
|
2870
|
+
fullData = [];
|
|
2871
|
+
treeData = [];
|
|
2872
|
+
const groupField = rgItem.field;
|
|
2873
|
+
const groupColumn = $xeTable.getColumnByField(groupField);
|
|
2874
|
+
const groupMaps = {};
|
|
2875
|
+
const rowkey = getRowkey($xeTable);
|
|
2876
|
+
list.forEach((row) => {
|
|
2877
|
+
const cellValue = groupColumn ? $xeTable.getCellLabel(row, groupColumn) : XEUtils.get(row, groupField);
|
|
2878
|
+
const groupValue = XEUtils.eqNull(cellValue) ? '' : cellValue;
|
|
2879
|
+
let childList = groupMaps[groupValue];
|
|
2880
|
+
if (!childList) {
|
|
2881
|
+
childList = [];
|
|
2882
|
+
groupMaps[groupValue] = childList;
|
|
2883
|
+
}
|
|
2884
|
+
if (row.isAggregate) {
|
|
2885
|
+
row.isAggregate = undefined;
|
|
2886
|
+
}
|
|
2887
|
+
childList.push(row);
|
|
2888
|
+
});
|
|
2889
|
+
XEUtils.objectEach(groupMaps, (childList, groupValue) => {
|
|
2890
|
+
const { fullData: childFullData, treeData: childTreeData } = handleGroupData(childList, rowGroups.slice(1));
|
|
2891
|
+
const groupRow = {
|
|
2892
|
+
isAggregate: true,
|
|
2893
|
+
groupContent: groupValue,
|
|
2894
|
+
groupField,
|
|
2895
|
+
[rowField]: getRowUniqueId(),
|
|
2896
|
+
[parentField]: null,
|
|
2897
|
+
[rowkey]: getRowUniqueId(),
|
|
2898
|
+
[childrenField]: childTreeData,
|
|
2899
|
+
[mapChildrenField]: childTreeData
|
|
2900
|
+
};
|
|
2901
|
+
if (checkField) {
|
|
2902
|
+
groupRow[checkField] = false;
|
|
2903
|
+
}
|
|
2904
|
+
if (indeterminateField) {
|
|
2905
|
+
groupRow[indeterminateField] = false;
|
|
2906
|
+
}
|
|
2907
|
+
treeData.push(groupRow);
|
|
2908
|
+
fullData.push(groupRow);
|
|
2909
|
+
if (childFullData.length) {
|
|
2910
|
+
fullData.push(...childFullData);
|
|
2911
|
+
}
|
|
2912
|
+
});
|
|
2913
|
+
}
|
|
2914
|
+
}
|
|
2915
|
+
return {
|
|
2916
|
+
treeData,
|
|
2917
|
+
fullData
|
|
2918
|
+
};
|
|
2919
|
+
};
|
|
2714
2920
|
/**
|
|
2715
2921
|
* 加载表格数据
|
|
2716
2922
|
* @param {Array} datas 数据
|
|
2717
2923
|
*/
|
|
2718
2924
|
const loadTableData = (datas, isReset) => {
|
|
2719
|
-
const { keepSource, treeConfig } = props;
|
|
2720
|
-
const { scrollYLoad: oldScrollYLoad } = reactData;
|
|
2925
|
+
const { keepSource, treeConfig, rowGroupConfig } = props;
|
|
2926
|
+
const { rowGroupList, scrollYLoad: oldScrollYLoad } = reactData;
|
|
2721
2927
|
const { scrollYStore, scrollXStore, lastScrollLeft, lastScrollTop } = internalData;
|
|
2928
|
+
const rowOpts = computeRowOpts.value;
|
|
2722
2929
|
const treeOpts = computeTreeOpts.value;
|
|
2723
2930
|
const expandOpts = computeExpandOpts.value;
|
|
2724
2931
|
const { transform } = treeOpts;
|
|
@@ -2728,6 +2935,15 @@ export default defineComponent({
|
|
|
2728
2935
|
if (fullData.length > supportMaxRow) {
|
|
2729
2936
|
errLog('vxe.error.errMaxRow', [supportMaxRow]);
|
|
2730
2937
|
}
|
|
2938
|
+
if (treeConfig && rowGroupList.length) {
|
|
2939
|
+
errLog('vxe.error.noTree', ['row-group-config']);
|
|
2940
|
+
return nextTick();
|
|
2941
|
+
}
|
|
2942
|
+
if (rowOpts.drag && rowGroupList.length) {
|
|
2943
|
+
errLog('vxe.error.errConflicts', ['row-config.drag', 'row-group-config']);
|
|
2944
|
+
return nextTick();
|
|
2945
|
+
}
|
|
2946
|
+
let isRGroup = false;
|
|
2731
2947
|
if (treeConfig) {
|
|
2732
2948
|
if (transform) {
|
|
2733
2949
|
// 树结构自动转换
|
|
@@ -2763,20 +2979,34 @@ export default defineComponent({
|
|
|
2763
2979
|
treeData = fullData.slice(0);
|
|
2764
2980
|
}
|
|
2765
2981
|
}
|
|
2982
|
+
else if (rowGroupConfig && rowGroupList.length) {
|
|
2983
|
+
const groupRest = handleGroupData(fullData, rowGroupList);
|
|
2984
|
+
treeData = groupRest.treeData;
|
|
2985
|
+
fullData = groupRest.fullData;
|
|
2986
|
+
isRGroup = true;
|
|
2987
|
+
}
|
|
2988
|
+
reactData.isRowGroupStatus = isRGroup;
|
|
2766
2989
|
scrollYStore.startIndex = 0;
|
|
2767
2990
|
scrollYStore.endIndex = 1;
|
|
2768
2991
|
scrollXStore.startIndex = 0;
|
|
2769
2992
|
scrollXStore.endIndex = 1;
|
|
2770
2993
|
reactData.isRowLoading = true;
|
|
2771
2994
|
reactData.scrollVMLoading = false;
|
|
2995
|
+
internalData.treeExpandedMaps = {};
|
|
2996
|
+
reactData.treeExpandedFlag++;
|
|
2997
|
+
internalData.rowExpandedMaps = {};
|
|
2998
|
+
reactData.rowExpandedFlag++;
|
|
2772
2999
|
internalData.insertRowMaps = {};
|
|
3000
|
+
reactData.insertRowFlag++;
|
|
2773
3001
|
internalData.removeRowMaps = {};
|
|
3002
|
+
reactData.removeRowFlag++;
|
|
2774
3003
|
const sYLoad = updateScrollYStatus(fullData);
|
|
2775
3004
|
reactData.isDragColMove = false;
|
|
2776
3005
|
reactData.isDragRowMove = false;
|
|
2777
3006
|
// 全量数据
|
|
2778
3007
|
internalData.tableFullData = fullData;
|
|
2779
|
-
internalData.tableFullTreeData = treeData;
|
|
3008
|
+
internalData.tableFullTreeData = isRGroup ? [] : treeData;
|
|
3009
|
+
internalData.tableFullGroupData = isRGroup ? treeData : [];
|
|
2780
3010
|
// 缓存数据
|
|
2781
3011
|
$xeTable.cacheRowMap(isReset);
|
|
2782
3012
|
// 原始数据
|
|
@@ -3139,7 +3369,7 @@ export default defineComponent({
|
|
|
3139
3369
|
*/
|
|
3140
3370
|
const handleBaseTreeExpand = (rows, expanded) => {
|
|
3141
3371
|
const { treeNodeColumn } = reactData;
|
|
3142
|
-
const { fullAllDataRowIdData,
|
|
3372
|
+
const { fullAllDataRowIdData, tableFullTreeData, treeExpandedMaps, treeExpandLazyLoadedMaps } = internalData;
|
|
3143
3373
|
const treeOpts = computeTreeOpts.value;
|
|
3144
3374
|
const { reserve, lazy, accordion, toggleMethod } = treeOpts;
|
|
3145
3375
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
@@ -3152,7 +3382,7 @@ export default defineComponent({
|
|
|
3152
3382
|
if (accordion) {
|
|
3153
3383
|
validRows = validRows.length ? [validRows[validRows.length - 1]] : [];
|
|
3154
3384
|
// 同一级只能展开一个
|
|
3155
|
-
const matchObj = XEUtils.findTree(
|
|
3385
|
+
const matchObj = XEUtils.findTree(tableFullTreeData, item => item === validRows[0], { children: childrenField });
|
|
3156
3386
|
if (matchObj) {
|
|
3157
3387
|
matchObj.items.forEach(item => {
|
|
3158
3388
|
const rowid = handleGetRowId(item);
|
|
@@ -3208,6 +3438,79 @@ export default defineComponent({
|
|
|
3208
3438
|
return handleBaseTreeExpand(rows, expanded).then(() => {
|
|
3209
3439
|
handleVirtualTreeToList();
|
|
3210
3440
|
$xeTable.handleTableData();
|
|
3441
|
+
reactData.treeExpandedFlag++;
|
|
3442
|
+
updateAfterDataIndex();
|
|
3443
|
+
return nextTick();
|
|
3444
|
+
}).then(() => {
|
|
3445
|
+
return $xeTable.recalculate(true);
|
|
3446
|
+
}).then(() => {
|
|
3447
|
+
setTimeout(() => {
|
|
3448
|
+
$xeTable.updateCellAreas();
|
|
3449
|
+
}, 30);
|
|
3450
|
+
});
|
|
3451
|
+
};
|
|
3452
|
+
/**
|
|
3453
|
+
* 展开与收起行分组节点
|
|
3454
|
+
* @param rows
|
|
3455
|
+
* @param expanded
|
|
3456
|
+
* @returns
|
|
3457
|
+
*/
|
|
3458
|
+
const handleRowGroupBaseExpand = (rows, expanded) => {
|
|
3459
|
+
const { fullAllDataRowIdData, tableFullGroupData, rowGroupExpandedMaps } = internalData;
|
|
3460
|
+
const rowGroupOpts = computeRowGroupOpts.value;
|
|
3461
|
+
const { mapChildrenField, accordion } = rowGroupOpts;
|
|
3462
|
+
const { handleGetRowId } = createHandleGetRowId($xeTable);
|
|
3463
|
+
let validRows = rows;
|
|
3464
|
+
if (mapChildrenField) {
|
|
3465
|
+
if (accordion) {
|
|
3466
|
+
validRows = validRows.length ? [validRows[validRows.length - 1]] : [];
|
|
3467
|
+
// 同一级只能展开一个
|
|
3468
|
+
const matchObj = XEUtils.findTree(tableFullGroupData, item => getRowid($xeTable, item) === getRowid($xeTable, validRows[0]), { children: mapChildrenField });
|
|
3469
|
+
if (matchObj) {
|
|
3470
|
+
matchObj.items.forEach(item => {
|
|
3471
|
+
const rowid = handleGetRowId(item);
|
|
3472
|
+
if (rowGroupExpandedMaps[rowid]) {
|
|
3473
|
+
delete rowGroupExpandedMaps[rowid];
|
|
3474
|
+
}
|
|
3475
|
+
});
|
|
3476
|
+
}
|
|
3477
|
+
}
|
|
3478
|
+
if (expanded) {
|
|
3479
|
+
validRows.forEach((row) => {
|
|
3480
|
+
const rowid = handleGetRowId(row);
|
|
3481
|
+
if (!rowGroupExpandedMaps[rowid]) {
|
|
3482
|
+
const rowRest = fullAllDataRowIdData[rowid];
|
|
3483
|
+
if (rowRest) {
|
|
3484
|
+
if (row[mapChildrenField] && row[mapChildrenField].length) {
|
|
3485
|
+
rowGroupExpandedMaps[rowid] = row;
|
|
3486
|
+
}
|
|
3487
|
+
}
|
|
3488
|
+
}
|
|
3489
|
+
});
|
|
3490
|
+
}
|
|
3491
|
+
else {
|
|
3492
|
+
validRows.forEach(item => {
|
|
3493
|
+
const rowid = handleGetRowId(item);
|
|
3494
|
+
if (rowGroupExpandedMaps[rowid]) {
|
|
3495
|
+
delete rowGroupExpandedMaps[rowid];
|
|
3496
|
+
}
|
|
3497
|
+
});
|
|
3498
|
+
}
|
|
3499
|
+
}
|
|
3500
|
+
reactData.rowGroupExpandedFlag++;
|
|
3501
|
+
return $xeTable.recalculate();
|
|
3502
|
+
};
|
|
3503
|
+
/**
|
|
3504
|
+
* 行分组的展开与收起
|
|
3505
|
+
* @param rows
|
|
3506
|
+
* @param expanded
|
|
3507
|
+
* @returns
|
|
3508
|
+
*/
|
|
3509
|
+
const handleRowGroupVirtualExpand = (rows, expanded) => {
|
|
3510
|
+
return handleRowGroupBaseExpand(rows, expanded).then(() => {
|
|
3511
|
+
handleVirtualTreeToList();
|
|
3512
|
+
$xeTable.handleTableData();
|
|
3513
|
+
reactData.rowGroupExpandedFlag++;
|
|
3211
3514
|
updateAfterDataIndex();
|
|
3212
3515
|
return nextTick();
|
|
3213
3516
|
}).then(() => {
|
|
@@ -3967,7 +4270,7 @@ export default defineComponent({
|
|
|
3967
4270
|
if (!column) {
|
|
3968
4271
|
return null;
|
|
3969
4272
|
}
|
|
3970
|
-
const formatter = column
|
|
4273
|
+
const { formatter } = column;
|
|
3971
4274
|
const cellValue = getCellValue(row, column);
|
|
3972
4275
|
let cellLabel = cellValue;
|
|
3973
4276
|
if (formatter) {
|
|
@@ -5220,7 +5523,7 @@ export default defineComponent({
|
|
|
5220
5523
|
});
|
|
5221
5524
|
if (isUpdate) {
|
|
5222
5525
|
if (!remote) {
|
|
5223
|
-
|
|
5526
|
+
$xeTable.handleTableData(true);
|
|
5224
5527
|
}
|
|
5225
5528
|
$xeTable.handleColumnSortEvent(new Event('click'), firstColumn);
|
|
5226
5529
|
}
|
|
@@ -5248,7 +5551,7 @@ export default defineComponent({
|
|
|
5248
5551
|
clearAllSort();
|
|
5249
5552
|
}
|
|
5250
5553
|
if (!sortOpts.remote) {
|
|
5251
|
-
|
|
5554
|
+
$xeTable.handleTableData(true);
|
|
5252
5555
|
}
|
|
5253
5556
|
return nextTick().then(updateStyle);
|
|
5254
5557
|
},
|
|
@@ -5394,8 +5697,8 @@ export default defineComponent({
|
|
|
5394
5697
|
const expandOpts = computeExpandOpts.value;
|
|
5395
5698
|
const { reserve, lazy, accordion, toggleMethod } = expandOpts;
|
|
5396
5699
|
const lazyRests = [];
|
|
5397
|
-
const columnIndex = $xeTable.getColumnIndex(expandColumn);
|
|
5398
|
-
const $columnIndex = $xeTable.getVMColumnIndex(expandColumn);
|
|
5700
|
+
const columnIndex = expandColumn ? $xeTable.getColumnIndex(expandColumn) : -1;
|
|
5701
|
+
const $columnIndex = expandColumn ? $xeTable.getVMColumnIndex(expandColumn) : -1;
|
|
5399
5702
|
if (rows) {
|
|
5400
5703
|
if (!XEUtils.isArray(rows)) {
|
|
5401
5704
|
rows = [rows];
|
|
@@ -5499,6 +5802,70 @@ export default defineComponent({
|
|
|
5499
5802
|
});
|
|
5500
5803
|
return rest;
|
|
5501
5804
|
},
|
|
5805
|
+
setRowGroups(fieldOrColumns) {
|
|
5806
|
+
const { rowGroupConfig } = props;
|
|
5807
|
+
if (!rowGroupConfig) {
|
|
5808
|
+
errLog('vxe.error.reqProp', ['row-group-config']);
|
|
5809
|
+
return nextTick();
|
|
5810
|
+
}
|
|
5811
|
+
if (fieldOrColumns) {
|
|
5812
|
+
handleUpdateRowGroup((XEUtils.isArray(fieldOrColumns) ? fieldOrColumns : [fieldOrColumns]).map(fieldOrColumn => {
|
|
5813
|
+
return XEUtils.isString(fieldOrColumn) ? fieldOrColumn : fieldOrColumn.field;
|
|
5814
|
+
}));
|
|
5815
|
+
return loadTableData(internalData.tableSynchData, true);
|
|
5816
|
+
}
|
|
5817
|
+
return nextTick();
|
|
5818
|
+
},
|
|
5819
|
+
clearRowGroups() {
|
|
5820
|
+
const { rowGroupConfig } = props;
|
|
5821
|
+
if (!rowGroupConfig) {
|
|
5822
|
+
errLog('vxe.error.reqProp', ['row-group-config']);
|
|
5823
|
+
return nextTick();
|
|
5824
|
+
}
|
|
5825
|
+
handleUpdateRowGroup([]);
|
|
5826
|
+
return loadTableData(internalData.tableSynchData, true);
|
|
5827
|
+
},
|
|
5828
|
+
isRowGroupRecord(row) {
|
|
5829
|
+
const { isRowGroupStatus } = reactData;
|
|
5830
|
+
return isRowGroupStatus && row.isAggregate;
|
|
5831
|
+
},
|
|
5832
|
+
isRowGroupExpandByRow(row) {
|
|
5833
|
+
const { rowGroupExpandedFlag } = reactData;
|
|
5834
|
+
const { rowGroupExpandedMaps } = internalData;
|
|
5835
|
+
return !!rowGroupExpandedFlag && !!rowGroupExpandedMaps[getRowid($xeTable, row)];
|
|
5836
|
+
},
|
|
5837
|
+
setRowGroupExpand(rows, expanded) {
|
|
5838
|
+
if (rows) {
|
|
5839
|
+
if (!XEUtils.isArray(rows)) {
|
|
5840
|
+
rows = [rows];
|
|
5841
|
+
}
|
|
5842
|
+
return handleRowGroupVirtualExpand(rows, expanded);
|
|
5843
|
+
}
|
|
5844
|
+
return nextTick();
|
|
5845
|
+
},
|
|
5846
|
+
setAllRowGroupExpand(expanded) {
|
|
5847
|
+
const { tableFullGroupData } = internalData;
|
|
5848
|
+
const rowGroupOpts = computeRowGroupOpts.value;
|
|
5849
|
+
const { mapChildrenField } = rowGroupOpts;
|
|
5850
|
+
const rgExpandedMaps = {};
|
|
5851
|
+
if (expanded && mapChildrenField) {
|
|
5852
|
+
XEUtils.eachTree(tableFullGroupData, (row) => {
|
|
5853
|
+
if (row[mapChildrenField] && row[mapChildrenField].length) {
|
|
5854
|
+
rgExpandedMaps[getRowid($xeTable, row)] = row;
|
|
5855
|
+
}
|
|
5856
|
+
}, { children: mapChildrenField });
|
|
5857
|
+
}
|
|
5858
|
+
internalData.rowGroupExpandedMaps = rgExpandedMaps;
|
|
5859
|
+
handleVirtualTreeToList();
|
|
5860
|
+
reactData.rowGroupExpandedFlag++;
|
|
5861
|
+
return $xeTable.handleTableData();
|
|
5862
|
+
},
|
|
5863
|
+
clearRowGroupExpand() {
|
|
5864
|
+
internalData.rowGroupExpandedMaps = {};
|
|
5865
|
+
handleVirtualTreeToList();
|
|
5866
|
+
reactData.rowGroupExpandedFlag++;
|
|
5867
|
+
return $xeTable.handleTableData();
|
|
5868
|
+
},
|
|
5502
5869
|
getTreeExpandRecords() {
|
|
5503
5870
|
const rest = [];
|
|
5504
5871
|
XEUtils.each(internalData.treeExpandedMaps, item => {
|
|
@@ -5542,11 +5909,11 @@ export default defineComponent({
|
|
|
5542
5909
|
});
|
|
5543
5910
|
}
|
|
5544
5911
|
internalData.treeExpandedMaps = {};
|
|
5545
|
-
reactData.treeExpandedFlag++;
|
|
5546
5912
|
if (transform) {
|
|
5547
5913
|
handleVirtualTreeToList();
|
|
5548
|
-
|
|
5914
|
+
$xeTable.handleTableData();
|
|
5549
5915
|
}
|
|
5916
|
+
reactData.treeExpandedFlag++;
|
|
5550
5917
|
return nextTick();
|
|
5551
5918
|
},
|
|
5552
5919
|
/**
|
|
@@ -5560,15 +5927,16 @@ export default defineComponent({
|
|
|
5560
5927
|
const { transform, lazy } = treeOpts;
|
|
5561
5928
|
const rowid = getRowid($xeTable, row);
|
|
5562
5929
|
if (lazy && row[hasChildField] && !treeExpandLazyLoadedMaps[rowid]) {
|
|
5563
|
-
return
|
|
5930
|
+
return $xeTable.clearTreeExpandLoaded(row).then(() => {
|
|
5564
5931
|
return handleAsyncTreeExpandChilds(row);
|
|
5565
5932
|
}).then(() => {
|
|
5566
5933
|
if (transform) {
|
|
5567
5934
|
handleVirtualTreeToList();
|
|
5568
|
-
|
|
5935
|
+
$xeTable.handleTableData();
|
|
5569
5936
|
}
|
|
5937
|
+
reactData.treeExpandedFlag++;
|
|
5570
5938
|
}).then(() => {
|
|
5571
|
-
return
|
|
5939
|
+
return $xeTable.recalculate();
|
|
5572
5940
|
});
|
|
5573
5941
|
}
|
|
5574
5942
|
return nextTick();
|
|
@@ -5578,13 +5946,13 @@ export default defineComponent({
|
|
|
5578
5946
|
warnLog('vxe.error.delFunc', ['reloadTreeChilds', 'reloadTreeExpand']);
|
|
5579
5947
|
}
|
|
5580
5948
|
// 即将废弃
|
|
5581
|
-
return
|
|
5949
|
+
return $xeTable.reloadTreeExpand(row);
|
|
5582
5950
|
},
|
|
5583
5951
|
/**
|
|
5584
5952
|
* 切换/展开树节点
|
|
5585
5953
|
*/
|
|
5586
5954
|
toggleTreeExpand(row) {
|
|
5587
|
-
return
|
|
5955
|
+
return $xeTable.setTreeExpand(row, !$xeTable.isTreeExpandByRow(row));
|
|
5588
5956
|
},
|
|
5589
5957
|
/**
|
|
5590
5958
|
* 设置所有树节点的展开与否
|
|
@@ -5602,10 +5970,11 @@ export default defineComponent({
|
|
|
5602
5970
|
expandeds.push(row);
|
|
5603
5971
|
}
|
|
5604
5972
|
}, { children: childrenField });
|
|
5605
|
-
return
|
|
5973
|
+
return $xeTable.setTreeExpand(expandeds, expanded).then(() => {
|
|
5606
5974
|
if (transform) {
|
|
5607
5975
|
handleVirtualTreeToList();
|
|
5608
|
-
|
|
5976
|
+
reactData.treeExpandedFlag++;
|
|
5977
|
+
return $xeTable.recalculate();
|
|
5609
5978
|
}
|
|
5610
5979
|
});
|
|
5611
5980
|
},
|
|
@@ -5654,15 +6023,15 @@ export default defineComponent({
|
|
|
5654
6023
|
const { transform, reserve } = treeOpts;
|
|
5655
6024
|
const expList = $xeTable.getTreeExpandRecords();
|
|
5656
6025
|
internalData.treeExpandedMaps = {};
|
|
5657
|
-
reactData.treeExpandedFlag++;
|
|
5658
6026
|
if (reserve) {
|
|
5659
6027
|
XEUtils.eachTree(tableFullTreeData, row => handleTreeExpandReserve(row, false), { children: childrenField });
|
|
5660
6028
|
}
|
|
5661
6029
|
return $xeTable.handleTableData().then(() => {
|
|
5662
6030
|
if (transform) {
|
|
5663
6031
|
handleVirtualTreeToList();
|
|
5664
|
-
|
|
6032
|
+
$xeTable.handleTableData();
|
|
5665
6033
|
}
|
|
6034
|
+
reactData.treeExpandedFlag++;
|
|
5666
6035
|
}).then(() => {
|
|
5667
6036
|
if (expList.length) {
|
|
5668
6037
|
return $xeTable.recalculate();
|
|
@@ -5973,7 +6342,7 @@ export default defineComponent({
|
|
|
5973
6342
|
hasResizable = 1;
|
|
5974
6343
|
resizableData[colKey] = column.renderWidth;
|
|
5975
6344
|
}
|
|
5976
|
-
if (isCustomVisible && (!checkMethod || checkMethod({ column }))) {
|
|
6345
|
+
if (isCustomVisible && (!checkMethod || checkMethod({ $table: $xeTable, column }))) {
|
|
5977
6346
|
if (!column.visible && column.defaultVisible) {
|
|
5978
6347
|
hasVisible = 1;
|
|
5979
6348
|
visibleData[colKey] = false;
|
|
@@ -6251,8 +6620,7 @@ export default defineComponent({
|
|
|
6251
6620
|
const hasDeleteKey = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.DELETE);
|
|
6252
6621
|
const isF2 = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.F2);
|
|
6253
6622
|
const isContextMenu = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.CONTEXT_MENU);
|
|
6254
|
-
const
|
|
6255
|
-
const hasCtrlKey = evnt.ctrlKey;
|
|
6623
|
+
const isControlKey = hasControlKey(evnt);
|
|
6256
6624
|
const hasShiftKey = evnt.shiftKey;
|
|
6257
6625
|
const isAltKey = evnt.altKey;
|
|
6258
6626
|
const operArrow = isLeftArrow || isUpArrow || isRightArrow || isDwArrow;
|
|
@@ -6320,7 +6688,7 @@ export default defineComponent({
|
|
|
6320
6688
|
else if (isEnter && !isAltKey && keyboardConfig && keyboardOpts.isEnter && (selected.row || actived.row || (treeConfig && (rowOpts.isCurrent || highlightCurrentRow) && currentRow))) {
|
|
6321
6689
|
const { isLastEnterAppendRow, beforeEnterMethod, enterMethod } = keyboardOpts;
|
|
6322
6690
|
// 退出选中
|
|
6323
|
-
if (
|
|
6691
|
+
if (isControlKey) {
|
|
6324
6692
|
// 如果是激活编辑状态,则取消编辑
|
|
6325
6693
|
if (actived.row) {
|
|
6326
6694
|
const params = actived.args;
|
|
@@ -6500,7 +6868,7 @@ export default defineComponent({
|
|
|
6500
6868
|
.then(() => $xeTable.triggerCurrentRowEvent(evnt, params));
|
|
6501
6869
|
}
|
|
6502
6870
|
}
|
|
6503
|
-
else if (keyboardConfig && isEnableConf(editConfig) && keyboardOpts.isEdit && !
|
|
6871
|
+
else if (keyboardConfig && isEnableConf(editConfig) && keyboardOpts.isEdit && !isControlKey && (isSpacebar || (keyCode >= 48 && keyCode <= 57) || (keyCode >= 65 && keyCode <= 90) || (keyCode >= 96 && keyCode <= 111) || (keyCode >= 186 && keyCode <= 192) || (keyCode >= 219 && keyCode <= 222))) {
|
|
6504
6872
|
const { editMode, editMethod } = keyboardOpts;
|
|
6505
6873
|
// 启用编辑后,空格键功能将失效
|
|
6506
6874
|
// if (isSpacebar) {
|
|
@@ -6646,9 +7014,11 @@ export default defineComponent({
|
|
|
6646
7014
|
const rTooltipMethod = tooltipMethod || (dragConfig ? dragConfig.rowTooltipMethod : null);
|
|
6647
7015
|
let tipContent = '';
|
|
6648
7016
|
if (rTooltipMethod) {
|
|
6649
|
-
|
|
7017
|
+
const rtParams = {
|
|
7018
|
+
$table: $xeTable,
|
|
6650
7019
|
row: dragRow
|
|
6651
|
-
}
|
|
7020
|
+
};
|
|
7021
|
+
tipContent = `${rTooltipMethod(rtParams) || ''}`;
|
|
6652
7022
|
}
|
|
6653
7023
|
else {
|
|
6654
7024
|
tipContent = getI18n('vxe.table.dragTip', [tdEl.textContent || '']);
|
|
@@ -6684,9 +7054,11 @@ export default defineComponent({
|
|
|
6684
7054
|
const { tooltipMethod } = columnDragOpts;
|
|
6685
7055
|
let tipContent = '';
|
|
6686
7056
|
if (tooltipMethod) {
|
|
6687
|
-
|
|
7057
|
+
const dtParams = {
|
|
7058
|
+
$table: $xeTable,
|
|
6688
7059
|
column: dragCol
|
|
6689
|
-
}
|
|
7060
|
+
};
|
|
7061
|
+
tipContent = `${tooltipMethod(dtParams) || ''}`;
|
|
6690
7062
|
}
|
|
6691
7063
|
else {
|
|
6692
7064
|
tipContent = getI18n('vxe.table.dragTip', [tdEl.textContent || '']);
|
|
@@ -6968,11 +7340,8 @@ export default defineComponent({
|
|
|
6968
7340
|
*/
|
|
6969
7341
|
cacheRowMap(isReset) {
|
|
6970
7342
|
const { treeConfig } = props;
|
|
6971
|
-
const {
|
|
6972
|
-
const
|
|
6973
|
-
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
6974
|
-
const hasChildField = treeOpts.hasChild || treeOpts.hasChildField;
|
|
6975
|
-
const { lazy } = treeOpts;
|
|
7343
|
+
const { isRowGroupStatus } = reactData;
|
|
7344
|
+
const { fullAllDataRowIdData, tableFullData, tableFullTreeData, tableFullGroupData, treeExpandedMaps } = internalData;
|
|
6976
7345
|
const fullAllDataRowIdMaps = isReset ? {} : Object.assign({}, fullAllDataRowIdData); // 存在已删除数据
|
|
6977
7346
|
const fullDataRowIdMaps = {};
|
|
6978
7347
|
const { handleUpdateRowId } = createHandleUpdateRowId($xeTable);
|
|
@@ -6995,6 +7364,10 @@ export default defineComponent({
|
|
|
6995
7364
|
fullAllDataRowIdMaps[rowid] = rowRest;
|
|
6996
7365
|
};
|
|
6997
7366
|
if (treeConfig) {
|
|
7367
|
+
const treeOpts = computeTreeOpts.value;
|
|
7368
|
+
const { lazy } = treeOpts;
|
|
7369
|
+
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
7370
|
+
const hasChildField = treeOpts.hasChild || treeOpts.hasChildField;
|
|
6998
7371
|
XEUtils.eachTree(tableFullTreeData, (row, index, items, path, parentRow, nodes) => {
|
|
6999
7372
|
const rowid = handleUpdateRowId(row);
|
|
7000
7373
|
if (treeConfig && lazy) {
|
|
@@ -7010,6 +7383,14 @@ export default defineComponent({
|
|
|
7010
7383
|
handleRowCache(row, index, items, parentRow ? -1 : index, parentRow, rowid, nodes.length - 1, toTreePathSeq(path));
|
|
7011
7384
|
}, { children: childrenField });
|
|
7012
7385
|
}
|
|
7386
|
+
else if (isRowGroupStatus) {
|
|
7387
|
+
const rowGroupOpts = computeRowGroupOpts.value;
|
|
7388
|
+
const { mapChildrenField } = rowGroupOpts;
|
|
7389
|
+
XEUtils.eachTree(tableFullGroupData, (row, index, items, path, parentRow, nodes) => {
|
|
7390
|
+
const rowid = handleUpdateRowId(row);
|
|
7391
|
+
handleRowCache(row, index, items, parentRow ? -1 : index, parentRow, rowid, nodes.length - 1, toTreePathSeq(path));
|
|
7392
|
+
}, { children: mapChildrenField });
|
|
7393
|
+
}
|
|
7013
7394
|
else {
|
|
7014
7395
|
tableFullData.forEach((row, index, items) => {
|
|
7015
7396
|
handleRowCache(row, index, items, index, null, handleUpdateRowId(row), 0, index + 1);
|
|
@@ -7446,6 +7827,7 @@ export default defineComponent({
|
|
|
7446
7827
|
: tableMethods.getCustomStoreData();
|
|
7447
7828
|
if (updateStore) {
|
|
7448
7829
|
return updateStore({
|
|
7830
|
+
$table: $xeTable,
|
|
7449
7831
|
id: tableId,
|
|
7450
7832
|
type,
|
|
7451
7833
|
storeData
|
|
@@ -7516,29 +7898,46 @@ export default defineComponent({
|
|
|
7516
7898
|
},
|
|
7517
7899
|
updateCheckboxStatus() {
|
|
7518
7900
|
const { treeConfig } = props;
|
|
7519
|
-
const {
|
|
7901
|
+
const { isRowGroupStatus } = reactData;
|
|
7902
|
+
const { afterTreeFullData, afterGroupFullData, selectCheckboxMaps, treeIndeterminateRowMaps } = internalData;
|
|
7903
|
+
const rowGroupOpts = computeRowGroupOpts.value;
|
|
7520
7904
|
const treeOpts = computeTreeOpts.value;
|
|
7521
|
-
const { transform, mapChildrenField } = treeOpts;
|
|
7522
7905
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
7523
7906
|
const checkboxOpts = computeCheckboxOpts.value;
|
|
7524
7907
|
const { checkField, checkStrictly, checkMethod } = checkboxOpts;
|
|
7525
|
-
const { afterTreeFullData } = internalData;
|
|
7526
7908
|
if (checkStrictly) {
|
|
7527
7909
|
return;
|
|
7528
7910
|
}
|
|
7529
|
-
|
|
7530
|
-
if (treeConfig) {
|
|
7911
|
+
if (isRowGroupStatus || treeConfig) {
|
|
7531
7912
|
const { handleGetRowId } = createHandleGetRowId($xeTable);
|
|
7532
7913
|
const childRowMaps = {};
|
|
7533
7914
|
const childRowList = [];
|
|
7534
|
-
|
|
7535
|
-
|
|
7536
|
-
const
|
|
7537
|
-
if (
|
|
7538
|
-
|
|
7539
|
-
|
|
7915
|
+
if (isRowGroupStatus) {
|
|
7916
|
+
// 行分组
|
|
7917
|
+
const mapChildrenField = rowGroupOpts.mapChildrenField;
|
|
7918
|
+
if (mapChildrenField) {
|
|
7919
|
+
XEUtils.eachTree(afterGroupFullData, (row) => {
|
|
7920
|
+
const rowid = handleGetRowId(row);
|
|
7921
|
+
const childList = row[mapChildrenField];
|
|
7922
|
+
if (childList && childList.length && !childRowMaps[rowid]) {
|
|
7923
|
+
childRowMaps[rowid] = 1;
|
|
7924
|
+
childRowList.unshift([row, rowid, childList]);
|
|
7925
|
+
}
|
|
7926
|
+
}, { children: mapChildrenField });
|
|
7540
7927
|
}
|
|
7541
|
-
}
|
|
7928
|
+
}
|
|
7929
|
+
else if (treeConfig) {
|
|
7930
|
+
// 树结构
|
|
7931
|
+
const { transform, mapChildrenField } = treeOpts;
|
|
7932
|
+
XEUtils.eachTree(afterTreeFullData, (row) => {
|
|
7933
|
+
const rowid = handleGetRowId(row);
|
|
7934
|
+
const childList = row[transform ? mapChildrenField : childrenField];
|
|
7935
|
+
if (childList && childList.length && !childRowMaps[rowid]) {
|
|
7936
|
+
childRowMaps[rowid] = 1;
|
|
7937
|
+
childRowList.unshift([row, rowid, childList]);
|
|
7938
|
+
}
|
|
7939
|
+
}, { children: transform ? mapChildrenField : childrenField });
|
|
7940
|
+
}
|
|
7542
7941
|
childRowList.forEach(vals => {
|
|
7543
7942
|
const row = vals[0];
|
|
7544
7943
|
const rowid = vals[1];
|
|
@@ -7550,7 +7949,7 @@ export default defineComponent({
|
|
|
7550
7949
|
? (item) => {
|
|
7551
7950
|
const childRowid = handleGetRowId(item);
|
|
7552
7951
|
const isSelect = checkField ? XEUtils.get(item, checkField) : selectCheckboxMaps[childRowid];
|
|
7553
|
-
if (checkMethod({ row: item })) {
|
|
7952
|
+
if (checkMethod({ $table: $xeTable, row: item })) {
|
|
7554
7953
|
if (isSelect) {
|
|
7555
7954
|
sLen++;
|
|
7556
7955
|
}
|
|
@@ -7613,19 +8012,20 @@ export default defineComponent({
|
|
|
7613
8012
|
},
|
|
7614
8013
|
updateAllCheckboxStatus() {
|
|
7615
8014
|
const { treeConfig } = props;
|
|
7616
|
-
const {
|
|
8015
|
+
const { isRowGroupStatus } = reactData;
|
|
8016
|
+
const { afterFullData, afterTreeFullData, afterGroupFullData, checkboxReserveRowMap, selectCheckboxMaps, treeIndeterminateRowMaps } = internalData;
|
|
7617
8017
|
const checkboxOpts = computeCheckboxOpts.value;
|
|
7618
8018
|
const { checkField, checkMethod, showReserveStatus } = checkboxOpts;
|
|
7619
8019
|
const { handleGetRowId } = createHandleGetRowId($xeTable);
|
|
7620
8020
|
let sLen = 0; // 已选
|
|
7621
8021
|
let hLen = 0; // 半选
|
|
7622
8022
|
let vLen = 0; // 有效行
|
|
7623
|
-
const rootList = (treeConfig ? afterTreeFullData : afterFullData);
|
|
8023
|
+
const rootList = (treeConfig ? afterTreeFullData : (isRowGroupStatus ? afterGroupFullData : afterFullData));
|
|
7624
8024
|
rootList.forEach(checkMethod
|
|
7625
8025
|
? row => {
|
|
7626
8026
|
const childRowid = handleGetRowId(row);
|
|
7627
8027
|
const selected = checkField ? XEUtils.get(row, checkField) : selectCheckboxMaps[childRowid];
|
|
7628
|
-
if (checkMethod({ row })) {
|
|
8028
|
+
if (checkMethod({ $table: $xeTable, row })) {
|
|
7629
8029
|
if (selected) {
|
|
7630
8030
|
sLen++;
|
|
7631
8031
|
}
|
|
@@ -7673,7 +8073,9 @@ export default defineComponent({
|
|
|
7673
8073
|
*/
|
|
7674
8074
|
handleBatchSelectRows(rows, checked, isForce) {
|
|
7675
8075
|
const { treeConfig } = props;
|
|
8076
|
+
const { isRowGroupStatus } = reactData;
|
|
7676
8077
|
const { selectCheckboxMaps } = internalData;
|
|
8078
|
+
const rowGroupOpts = computeRowGroupOpts.value;
|
|
7677
8079
|
const treeOpts = computeTreeOpts.value;
|
|
7678
8080
|
const { transform, mapChildrenField } = treeOpts;
|
|
7679
8081
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
@@ -7684,10 +8086,10 @@ export default defineComponent({
|
|
|
7684
8086
|
const indeterminateField = checkboxOpts.indeterminateField || checkboxOpts.halfField;
|
|
7685
8087
|
if (checkField) {
|
|
7686
8088
|
// 树结构
|
|
7687
|
-
if (treeConfig && !checkStrictly) {
|
|
8089
|
+
if ((treeConfig || isRowGroupStatus) && !checkStrictly) {
|
|
7688
8090
|
// 更新子节点状态
|
|
7689
8091
|
XEUtils.eachTree(rows, (row) => {
|
|
7690
|
-
if (isForce || (!checkMethod || checkMethod({ row }))) {
|
|
8092
|
+
if (isForce || (!checkMethod || checkMethod({ $table: $xeTable, row }))) {
|
|
7691
8093
|
XEUtils.set(row, checkField, checked);
|
|
7692
8094
|
if (indeterminateField) {
|
|
7693
8095
|
XEUtils.set(row, indeterminateField, false);
|
|
@@ -7700,7 +8102,7 @@ export default defineComponent({
|
|
|
7700
8102
|
}
|
|
7701
8103
|
// 列表
|
|
7702
8104
|
rows.forEach(row => {
|
|
7703
|
-
if (isForce || (!checkMethod || checkMethod({ row }))) {
|
|
8105
|
+
if (isForce || (!checkMethod || checkMethod({ $table: $xeTable, row }))) {
|
|
7704
8106
|
XEUtils.set(row, checkField, checked);
|
|
7705
8107
|
handleCheckboxReserveRow(row, checked);
|
|
7706
8108
|
}
|
|
@@ -7709,29 +8111,50 @@ export default defineComponent({
|
|
|
7709
8111
|
return;
|
|
7710
8112
|
}
|
|
7711
8113
|
// 树结构
|
|
7712
|
-
if (
|
|
7713
|
-
|
|
7714
|
-
|
|
7715
|
-
|
|
7716
|
-
|
|
7717
|
-
if (
|
|
7718
|
-
|
|
8114
|
+
if (!checkStrictly) {
|
|
8115
|
+
if (isRowGroupStatus) {
|
|
8116
|
+
// 更新行分组节点状态
|
|
8117
|
+
XEUtils.eachTree(rows, (row) => {
|
|
8118
|
+
const rowid = handleGetRowId(row);
|
|
8119
|
+
if (isForce || (!checkMethod || checkMethod({ $table: $xeTable, row }))) {
|
|
8120
|
+
if (checked) {
|
|
8121
|
+
selectCheckboxMaps[rowid] = row;
|
|
8122
|
+
}
|
|
8123
|
+
else {
|
|
8124
|
+
if (selectCheckboxMaps[rowid]) {
|
|
8125
|
+
delete selectCheckboxMaps[rowid];
|
|
8126
|
+
}
|
|
8127
|
+
}
|
|
8128
|
+
handleCheckboxReserveRow(row, checked);
|
|
7719
8129
|
}
|
|
7720
|
-
|
|
7721
|
-
|
|
7722
|
-
|
|
8130
|
+
}, { children: rowGroupOpts.mapChildrenField });
|
|
8131
|
+
reactData.updateCheckboxFlag++;
|
|
8132
|
+
return;
|
|
8133
|
+
}
|
|
8134
|
+
else if (treeConfig) {
|
|
8135
|
+
// 更新子节点状态
|
|
8136
|
+
XEUtils.eachTree(rows, (row) => {
|
|
8137
|
+
const rowid = handleGetRowId(row);
|
|
8138
|
+
if (isForce || (!checkMethod || checkMethod({ $table: $xeTable, row }))) {
|
|
8139
|
+
if (checked) {
|
|
8140
|
+
selectCheckboxMaps[rowid] = row;
|
|
8141
|
+
}
|
|
8142
|
+
else {
|
|
8143
|
+
if (selectCheckboxMaps[rowid]) {
|
|
8144
|
+
delete selectCheckboxMaps[rowid];
|
|
8145
|
+
}
|
|
7723
8146
|
}
|
|
8147
|
+
handleCheckboxReserveRow(row, checked);
|
|
7724
8148
|
}
|
|
7725
|
-
|
|
7726
|
-
|
|
7727
|
-
|
|
7728
|
-
|
|
7729
|
-
return;
|
|
8149
|
+
}, { children: transform ? mapChildrenField : childrenField });
|
|
8150
|
+
reactData.updateCheckboxFlag++;
|
|
8151
|
+
return;
|
|
8152
|
+
}
|
|
7730
8153
|
}
|
|
7731
8154
|
// 列表
|
|
7732
8155
|
rows.forEach(row => {
|
|
7733
8156
|
const rowid = handleGetRowId(row);
|
|
7734
|
-
if (isForce || (!checkMethod || checkMethod({ row }))) {
|
|
8157
|
+
if (isForce || (!checkMethod || checkMethod({ $table: $xeTable, row }))) {
|
|
7735
8158
|
if (checked) {
|
|
7736
8159
|
if (!selectCheckboxMaps[rowid]) {
|
|
7737
8160
|
selectCheckboxMaps[rowid] = row;
|
|
@@ -7904,20 +8327,22 @@ export default defineComponent({
|
|
|
7904
8327
|
const radioOpts = computeRadioOpts.value;
|
|
7905
8328
|
const checkboxOpts = computeCheckboxOpts.value;
|
|
7906
8329
|
const keyboardOpts = computeKeyboardOpts.value;
|
|
8330
|
+
const rowGroupOpts = computeRowGroupOpts.value;
|
|
7907
8331
|
const rowOpts = computeRowOpts.value;
|
|
7908
8332
|
const columnOpts = computeColumnOpts.value;
|
|
7909
8333
|
const currentColumnOpts = computeCurrentColumnOpts.value;
|
|
7910
8334
|
const { actived, focused } = editStore;
|
|
7911
8335
|
const { row, column } = params;
|
|
7912
|
-
const { type, treeNode } = column;
|
|
8336
|
+
const { type, treeNode, rowGroupNode } = column;
|
|
7913
8337
|
const isRadioType = type === 'radio';
|
|
7914
8338
|
const isCheckboxType = type === 'checkbox';
|
|
7915
8339
|
const isExpandType = type === 'expand';
|
|
7916
8340
|
const cell = evnt.currentTarget;
|
|
7917
8341
|
const triggerRadio = isRadioType && getEventTargetNode(evnt, cell, 'vxe-cell--radio').flag;
|
|
7918
8342
|
const triggerCheckbox = isCheckboxType && getEventTargetNode(evnt, cell, 'vxe-cell--checkbox').flag;
|
|
7919
|
-
const triggerTreeNode = treeNode && getEventTargetNode(evnt, cell, 'vxe-tree
|
|
8343
|
+
const triggerTreeNode = treeNode && getEventTargetNode(evnt, cell, 'vxe-cell--tree-btn').flag;
|
|
7920
8344
|
const triggerExpandNode = isExpandType && getEventTargetNode(evnt, cell, 'vxe-table--expanded').flag;
|
|
8345
|
+
const triggerRowGroupNode = isExpandType && getEventTargetNode(evnt, cell, 'vxe-row-group--node-btn').flag;
|
|
7921
8346
|
params = Object.assign({ cell, triggerRadio, triggerCheckbox, triggerTreeNode, triggerExpandNode }, params);
|
|
7922
8347
|
if (!triggerCheckbox && !triggerRadio) {
|
|
7923
8348
|
// 如果是展开行
|
|
@@ -7928,10 +8353,14 @@ export default defineComponent({
|
|
|
7928
8353
|
if ((treeOpts.trigger === 'row' || (treeNode && treeOpts.trigger === 'cell'))) {
|
|
7929
8354
|
$xeTable.triggerTreeExpandEvent(evnt, params);
|
|
7930
8355
|
}
|
|
8356
|
+
// 如果是行分组
|
|
8357
|
+
if ((rowGroupOpts.trigger === 'row' || (rowGroupNode && rowGroupOpts.trigger === 'cell'))) {
|
|
8358
|
+
$xeTable.triggerRowGroupExpandEvent(evnt, params);
|
|
8359
|
+
}
|
|
7931
8360
|
}
|
|
7932
8361
|
// 如果点击了树节点
|
|
7933
8362
|
if (!triggerTreeNode) {
|
|
7934
|
-
if (!triggerExpandNode) {
|
|
8363
|
+
if (!triggerExpandNode && !triggerRowGroupNode) {
|
|
7935
8364
|
// 如果是当前行
|
|
7936
8365
|
if (rowOpts.isCurrent || highlightCurrentRow) {
|
|
7937
8366
|
if (!triggerCheckbox && !triggerRadio) {
|
|
@@ -8052,7 +8481,9 @@ export default defineComponent({
|
|
|
8052
8481
|
}
|
|
8053
8482
|
},
|
|
8054
8483
|
triggerCheckRowEvent(evnt, params, checked) {
|
|
8484
|
+
const { treeConfig } = props;
|
|
8055
8485
|
const { row } = params;
|
|
8486
|
+
const { isRowGroupStatus } = reactData;
|
|
8056
8487
|
const { afterFullData } = internalData;
|
|
8057
8488
|
const checkboxOpts = computeCheckboxOpts.value;
|
|
8058
8489
|
const { checkMethod, trigger } = checkboxOpts;
|
|
@@ -8060,7 +8491,7 @@ export default defineComponent({
|
|
|
8060
8491
|
return;
|
|
8061
8492
|
}
|
|
8062
8493
|
evnt.stopPropagation();
|
|
8063
|
-
if (checkboxOpts.isShiftKey && evnt.shiftKey && !
|
|
8494
|
+
if (checkboxOpts.isShiftKey && evnt.shiftKey && !(treeConfig || isRowGroupStatus)) {
|
|
8064
8495
|
const checkboxRecords = $xeTable.getCheckboxRecords();
|
|
8065
8496
|
if (checkboxRecords.length) {
|
|
8066
8497
|
const firstRow = checkboxRecords[0];
|
|
@@ -8077,7 +8508,7 @@ export default defineComponent({
|
|
|
8077
8508
|
}
|
|
8078
8509
|
}
|
|
8079
8510
|
}
|
|
8080
|
-
if (!checkMethod || checkMethod({ row })) {
|
|
8511
|
+
if (!checkMethod || checkMethod({ $table: $xeTable, row })) {
|
|
8081
8512
|
$xeTable.handleBatchSelectRows([row], checked);
|
|
8082
8513
|
$xeTable.checkSelectionStatus();
|
|
8083
8514
|
dispatchEvent('checkbox-change', Object.assign({
|
|
@@ -8178,7 +8609,7 @@ export default defineComponent({
|
|
|
8178
8609
|
* 展开行事件
|
|
8179
8610
|
*/
|
|
8180
8611
|
triggerRowExpandEvent(evnt, params) {
|
|
8181
|
-
const { expandColumn
|
|
8612
|
+
const { expandColumn } = reactData;
|
|
8182
8613
|
const { rowExpandLazyLoadedMaps } = internalData;
|
|
8183
8614
|
const expandOpts = computeExpandOpts.value;
|
|
8184
8615
|
const { row } = params;
|
|
@@ -8190,12 +8621,12 @@ export default defineComponent({
|
|
|
8190
8621
|
const rowid = getRowid($xeTable, row);
|
|
8191
8622
|
if (!lazy || !rowExpandLazyLoadedMaps[rowid]) {
|
|
8192
8623
|
const expanded = !$xeTable.isRowExpandByRow(row);
|
|
8193
|
-
const columnIndex = $xeTable.getColumnIndex(
|
|
8194
|
-
const $columnIndex = $xeTable.getVMColumnIndex(
|
|
8624
|
+
const columnIndex = expandColumn ? $xeTable.getColumnIndex(expandColumn) : -1;
|
|
8625
|
+
const $columnIndex = expandColumn ? $xeTable.getVMColumnIndex(expandColumn) : -1;
|
|
8195
8626
|
$xeTable.setRowExpand(row, expanded);
|
|
8196
8627
|
dispatchEvent('toggle-row-expand', {
|
|
8197
8628
|
expanded,
|
|
8198
|
-
column,
|
|
8629
|
+
column: expandColumn,
|
|
8199
8630
|
columnIndex,
|
|
8200
8631
|
$columnIndex,
|
|
8201
8632
|
row,
|
|
@@ -8204,6 +8635,25 @@ export default defineComponent({
|
|
|
8204
8635
|
}, evnt);
|
|
8205
8636
|
}
|
|
8206
8637
|
},
|
|
8638
|
+
/**
|
|
8639
|
+
* 行分组事件
|
|
8640
|
+
*/
|
|
8641
|
+
triggerRowGroupExpandEvent(evnt, params) {
|
|
8642
|
+
const { rowGroupExpandedMaps } = internalData;
|
|
8643
|
+
const rowGroupOpts = computeRowGroupOpts.value;
|
|
8644
|
+
const { row, column } = params;
|
|
8645
|
+
const { trigger } = rowGroupOpts;
|
|
8646
|
+
if (trigger === 'manual') {
|
|
8647
|
+
return;
|
|
8648
|
+
}
|
|
8649
|
+
evnt.stopPropagation();
|
|
8650
|
+
const rowid = getRowid($xeTable, row);
|
|
8651
|
+
const expanded = !rowGroupExpandedMaps[rowid];
|
|
8652
|
+
const columnIndex = $xeTable.getColumnIndex(column);
|
|
8653
|
+
const $columnIndex = $xeTable.getVMColumnIndex(column);
|
|
8654
|
+
$xeTable.setRowGroupExpand(row, expanded);
|
|
8655
|
+
dispatchEvent('toggle-row-group-expand', { expanded, column, columnIndex, $columnIndex, row }, evnt);
|
|
8656
|
+
},
|
|
8207
8657
|
/**
|
|
8208
8658
|
* 展开树节点事件
|
|
8209
8659
|
*/
|
|
@@ -8340,7 +8790,7 @@ export default defineComponent({
|
|
|
8340
8790
|
const triggerInput = cell && cell.tagName && cell.tagName.toLowerCase() === 'input';
|
|
8341
8791
|
const triggerRadio = isRadioType && getEventTargetNode(evnt, cell, 'vxe-cell--radio').flag;
|
|
8342
8792
|
const triggerCheckbox = isCheckboxType && getEventTargetNode(evnt, cell, 'vxe-cell--checkbox').flag;
|
|
8343
|
-
const triggerTreeNode = treeNode && getEventTargetNode(evnt, cell, 'vxe-tree
|
|
8793
|
+
const triggerTreeNode = treeNode && getEventTargetNode(evnt, cell, 'vxe-cell--tree-btn').flag;
|
|
8344
8794
|
const triggerExpandNode = isExpandType && getEventTargetNode(evnt, cell, 'vxe-table--expanded').flag;
|
|
8345
8795
|
let isColDragCell = false;
|
|
8346
8796
|
if (rowOpts.drag) {
|
|
@@ -8601,7 +9051,7 @@ export default defineComponent({
|
|
|
8601
9051
|
evnt.preventDefault();
|
|
8602
9052
|
return;
|
|
8603
9053
|
}
|
|
8604
|
-
const
|
|
9054
|
+
const isControlKey = hasControlKey(evnt);
|
|
8605
9055
|
const trEl = evnt.currentTarget;
|
|
8606
9056
|
const rowid = trEl.getAttribute('rowid') || '';
|
|
8607
9057
|
const rest = fullAllDataRowIdData[rowid];
|
|
@@ -8613,11 +9063,11 @@ export default defineComponent({
|
|
|
8613
9063
|
const { dragRow } = reactData;
|
|
8614
9064
|
const offsetY = evnt.clientY - trEl.getBoundingClientRect().y;
|
|
8615
9065
|
const dragPos = offsetY < trEl.clientHeight / 2 ? 'top' : 'bottom';
|
|
8616
|
-
internalData.prevDragToChild = !!(treeConfig && transform && (isCrossDrag && isToChildDrag) &&
|
|
9066
|
+
internalData.prevDragToChild = !!(treeConfig && transform && (isCrossDrag && isToChildDrag) && isControlKey);
|
|
8617
9067
|
internalData.prevDragRow = row;
|
|
8618
9068
|
internalData.prevDragPos = dragPos;
|
|
8619
9069
|
if ($xeTable.eqRow(dragRow, row) ||
|
|
8620
|
-
(
|
|
9070
|
+
(isControlKey && treeConfig && lazy && row[hasChildField] && rowRest && !rowRest.treeLoaded) ||
|
|
8621
9071
|
(!isCrossDrag && treeConfig && transform && (isPeerDrag ? dragRow[parentField] !== row[parentField] : rest.level))) {
|
|
8622
9072
|
showDropTip(evnt, trEl, null, false, dragPos);
|
|
8623
9073
|
return;
|
|
@@ -8866,7 +9316,7 @@ export default defineComponent({
|
|
|
8866
9316
|
evnt.preventDefault();
|
|
8867
9317
|
return;
|
|
8868
9318
|
}
|
|
8869
|
-
const
|
|
9319
|
+
const isControlKey = hasControlKey(evnt);
|
|
8870
9320
|
const thEl = evnt.currentTarget;
|
|
8871
9321
|
const colid = thEl.getAttribute('colid');
|
|
8872
9322
|
const column = $xeTable.getColumnById(colid);
|
|
@@ -8875,7 +9325,7 @@ export default defineComponent({
|
|
|
8875
9325
|
const { clientX } = evnt;
|
|
8876
9326
|
const offsetX = clientX - thEl.getBoundingClientRect().x;
|
|
8877
9327
|
const dragPos = offsetX < thEl.clientWidth / 2 ? 'left' : 'right';
|
|
8878
|
-
internalData.prevDragToChild = !!((isCrossDrag && isToChildDrag) &&
|
|
9328
|
+
internalData.prevDragToChild = !!((isCrossDrag && isToChildDrag) && isControlKey);
|
|
8879
9329
|
internalData.prevDragCol = column;
|
|
8880
9330
|
internalData.prevDragPos = dragPos;
|
|
8881
9331
|
if (column.fixed ||
|
|
@@ -9396,17 +9846,19 @@ export default defineComponent({
|
|
|
9396
9846
|
*/
|
|
9397
9847
|
scrollToTreeRow(row) {
|
|
9398
9848
|
const { treeConfig } = props;
|
|
9849
|
+
const { isRowGroupStatus } = reactData;
|
|
9399
9850
|
const { tableFullData } = internalData;
|
|
9400
9851
|
const rests = [];
|
|
9401
|
-
if (treeConfig) {
|
|
9852
|
+
if (treeConfig || isRowGroupStatus) {
|
|
9853
|
+
const rowGroupOpts = computeRowGroupOpts.value;
|
|
9402
9854
|
const treeOpts = computeTreeOpts.value;
|
|
9403
9855
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
9404
|
-
const matchObj = XEUtils.findTree(tableFullData, item => $xeTable.eqRow(item, row), { children: childrenField });
|
|
9856
|
+
const matchObj = XEUtils.findTree(tableFullData, item => $xeTable.eqRow(item, row), { children: isRowGroupStatus ? rowGroupOpts.mapChildrenField : childrenField });
|
|
9405
9857
|
if (matchObj) {
|
|
9406
9858
|
const nodes = matchObj.nodes;
|
|
9407
9859
|
nodes.forEach((row, index) => {
|
|
9408
|
-
if (index < nodes.length - 1 &&
|
|
9409
|
-
rests.push(
|
|
9860
|
+
if (index < nodes.length - 1 && !$xeTable.isTreeExpandByRow(row)) {
|
|
9861
|
+
rests.push($xeTable.setTreeExpand(row, true));
|
|
9410
9862
|
}
|
|
9411
9863
|
});
|
|
9412
9864
|
}
|
|
@@ -9826,7 +10278,7 @@ export default defineComponent({
|
|
|
9826
10278
|
};
|
|
9827
10279
|
const renderRowExpandedVNs = () => {
|
|
9828
10280
|
const { treeConfig } = props;
|
|
9829
|
-
const { expandColumn } = reactData;
|
|
10281
|
+
const { expandColumn, isRowGroupStatus } = reactData;
|
|
9830
10282
|
const tableRowExpandedList = computeTableRowExpandedList.value;
|
|
9831
10283
|
const expandOpts = computeExpandOpts.value;
|
|
9832
10284
|
const { mode } = expandOpts;
|
|
@@ -9843,13 +10295,15 @@ export default defineComponent({
|
|
|
9843
10295
|
const { handleGetRowId } = createHandleGetRowId($xeTable);
|
|
9844
10296
|
tableRowExpandedList.forEach((row) => {
|
|
9845
10297
|
const expandOpts = computeExpandOpts.value;
|
|
9846
|
-
const { height: expandHeight, padding } = expandOpts;
|
|
9847
|
-
const { fullAllDataRowIdData } = internalData;
|
|
10298
|
+
const { height: expandHeight, padding, indent } = expandOpts;
|
|
10299
|
+
const { fullAllDataRowIdData, fullColumnIdData } = internalData;
|
|
9848
10300
|
const treeOpts = computeTreeOpts.value;
|
|
9849
10301
|
const { transform, seqMode } = treeOpts;
|
|
9850
10302
|
const cellStyle = {};
|
|
9851
10303
|
const rowid = handleGetRowId(row);
|
|
9852
10304
|
const rowRest = fullAllDataRowIdData[rowid];
|
|
10305
|
+
const colid = expandColumn.id;
|
|
10306
|
+
const colRest = fullColumnIdData[colid] || {};
|
|
9853
10307
|
let rowLevel = 0;
|
|
9854
10308
|
let seq = -1;
|
|
9855
10309
|
let _rowIndex = -1;
|
|
@@ -9857,7 +10311,7 @@ export default defineComponent({
|
|
|
9857
10311
|
let $rowIndex = -1;
|
|
9858
10312
|
if (rowRest) {
|
|
9859
10313
|
rowLevel = rowRest.level;
|
|
9860
|
-
if (treeConfig && transform && seqMode === 'increasing') {
|
|
10314
|
+
if (isRowGroupStatus || (treeConfig && transform && seqMode === 'increasing')) {
|
|
9861
10315
|
seq = rowRest._index + 1;
|
|
9862
10316
|
}
|
|
9863
10317
|
else {
|
|
@@ -9870,10 +10324,39 @@ export default defineComponent({
|
|
|
9870
10324
|
if (expandHeight) {
|
|
9871
10325
|
cellStyle.height = `${expandHeight}px`;
|
|
9872
10326
|
}
|
|
9873
|
-
if (treeConfig) {
|
|
9874
|
-
cellStyle.paddingLeft = `${(rowLevel * treeOpts.indent) + 30}px`;
|
|
10327
|
+
if (isRowGroupStatus || treeConfig) {
|
|
10328
|
+
cellStyle.paddingLeft = `${(rowLevel * (XEUtils.isNumber(indent) ? indent : treeOpts.indent)) + 30}px`;
|
|
9875
10329
|
}
|
|
9876
|
-
|
|
10330
|
+
let columnIndex = -1;
|
|
10331
|
+
let $columnIndex = -1;
|
|
10332
|
+
let _columnIndex = -1;
|
|
10333
|
+
if (colRest) {
|
|
10334
|
+
columnIndex = colRest.index;
|
|
10335
|
+
$columnIndex = colRest.$index;
|
|
10336
|
+
_columnIndex = colRest._index;
|
|
10337
|
+
}
|
|
10338
|
+
const expandParams = {
|
|
10339
|
+
$grid: $xeGrid,
|
|
10340
|
+
$table: $xeTable,
|
|
10341
|
+
seq,
|
|
10342
|
+
column: expandColumn,
|
|
10343
|
+
columnIndex,
|
|
10344
|
+
$columnIndex,
|
|
10345
|
+
_columnIndex,
|
|
10346
|
+
fixed: '',
|
|
10347
|
+
type: 'body',
|
|
10348
|
+
level: rowLevel,
|
|
10349
|
+
rowid,
|
|
10350
|
+
row,
|
|
10351
|
+
rowIndex,
|
|
10352
|
+
$rowIndex,
|
|
10353
|
+
_rowIndex,
|
|
10354
|
+
isHidden: false,
|
|
10355
|
+
isEdit: false,
|
|
10356
|
+
visibleData: [],
|
|
10357
|
+
data: [],
|
|
10358
|
+
items: []
|
|
10359
|
+
};
|
|
9877
10360
|
expandVNs.push(h('div', {
|
|
9878
10361
|
key: rowid,
|
|
9879
10362
|
class: ['vxe-body--row-expanded-cell', {
|
|
@@ -10017,7 +10500,7 @@ export default defineComponent({
|
|
|
10017
10500
|
};
|
|
10018
10501
|
const renderVN = () => {
|
|
10019
10502
|
const { loading, stripe, showHeader, height, treeConfig, mouseConfig, showFooter, highlightCell, highlightHoverRow, highlightHoverColumn, editConfig, editRules } = props;
|
|
10020
|
-
const { isGroup, overflowX, overflowY, scrollXLoad, scrollYLoad, tableData, initStore, columnStore, filterStore, customStore } = reactData;
|
|
10503
|
+
const { isGroup, overflowX, overflowY, scrollXLoad, scrollYLoad, tableData, initStore, isRowGroupStatus, columnStore, filterStore, customStore } = reactData;
|
|
10021
10504
|
const { leftList, rightList } = columnStore;
|
|
10022
10505
|
const loadingSlot = slots.loading;
|
|
10023
10506
|
const tableTipConfig = computeTableTipConfig.value;
|
|
@@ -10058,6 +10541,7 @@ export default defineComponent({
|
|
|
10058
10541
|
'is--header': showHeader,
|
|
10059
10542
|
'is--footer': showFooter,
|
|
10060
10543
|
'is--group': isGroup,
|
|
10544
|
+
'is-row-group': isRowGroupStatus,
|
|
10061
10545
|
'is--tree-line': treeConfig && (treeOpts.showLine || treeOpts.line),
|
|
10062
10546
|
'is--fixed-left': leftList.length,
|
|
10063
10547
|
'is--fixed-right': rightList.length,
|
|
@@ -10428,6 +10912,9 @@ export default defineComponent({
|
|
|
10428
10912
|
}
|
|
10429
10913
|
});
|
|
10430
10914
|
});
|
|
10915
|
+
watch(computeRowGroupFields, (val) => {
|
|
10916
|
+
handleUpdateRowGroup(val);
|
|
10917
|
+
});
|
|
10431
10918
|
if ($xeTabs) {
|
|
10432
10919
|
watch(() => $xeTabs ? $xeTabs.reactData.resizeFlag : null, () => {
|
|
10433
10920
|
handleGlobalResizeEvent();
|
|
@@ -10456,9 +10943,12 @@ export default defineComponent({
|
|
|
10456
10943
|
const columnOpts = computeColumnOpts.value;
|
|
10457
10944
|
const rowOpts = computeRowOpts.value;
|
|
10458
10945
|
const customOpts = computeCustomOpts.value;
|
|
10946
|
+
const rowGroupOpts = computeRowGroupOpts.value;
|
|
10947
|
+
const { groupFields } = rowGroupOpts;
|
|
10459
10948
|
if (columnOpts.drag || rowOpts.drag || customOpts.allowSort) {
|
|
10460
10949
|
initTpImg();
|
|
10461
10950
|
}
|
|
10951
|
+
handleUpdateRowGroup(groupFields);
|
|
10462
10952
|
nextTick(() => {
|
|
10463
10953
|
const { data, exportConfig, importConfig, treeConfig, showOverflow, highlightCurrentRow, highlightCurrentColumn } = props;
|
|
10464
10954
|
const { scrollXStore, scrollYStore } = internalData;
|
|
@@ -10474,8 +10964,6 @@ export default defineComponent({
|
|
|
10474
10964
|
const importOpts = computeImportOpts.value;
|
|
10475
10965
|
const currentRowOpts = computeCurrentRowOpts.value;
|
|
10476
10966
|
const currentColumnOpts = computeCurrentColumnOpts.value;
|
|
10477
|
-
const virtualXOpts = computeVirtualXOpts.value;
|
|
10478
|
-
const virtualYOpts = computeVirtualYOpts.value;
|
|
10479
10967
|
const keyboardOpts = computeKeyboardOpts.value;
|
|
10480
10968
|
if (props.rowId) {
|
|
10481
10969
|
warnLog('vxe.error.delProp', ['row-id', 'row-config.keyField']);
|
|
@@ -10598,19 +11086,19 @@ export default defineComponent({
|
|
|
10598
11086
|
warnLog('vxe.error.notConflictProp', ['column-config.isCurrent', 'current-column-config.isFollowSelected']);
|
|
10599
11087
|
}
|
|
10600
11088
|
// 如果不支持虚拟滚动
|
|
10601
|
-
if (props.spanMethod) {
|
|
10602
|
-
|
|
10603
|
-
|
|
10604
|
-
|
|
10605
|
-
|
|
10606
|
-
|
|
10607
|
-
|
|
10608
|
-
}
|
|
10609
|
-
if (props.footerSpanMethod) {
|
|
10610
|
-
|
|
10611
|
-
|
|
10612
|
-
|
|
10613
|
-
}
|
|
11089
|
+
// if (props.spanMethod) {
|
|
11090
|
+
// if (virtualXOpts.enabled) {
|
|
11091
|
+
// warnLog('vxe.error.notConflictProp', ['span-method', 'virtual-x-config.enabled=false'])
|
|
11092
|
+
// }
|
|
11093
|
+
// if (virtualYOpts.enabled) {
|
|
11094
|
+
// warnLog('vxe.error.notConflictProp', ['span-method', 'virtual-y-config.enabled=false'])
|
|
11095
|
+
// }
|
|
11096
|
+
// }
|
|
11097
|
+
// if (props.footerSpanMethod) {
|
|
11098
|
+
// if (virtualXOpts.enabled) {
|
|
11099
|
+
// warnLog('vxe.error.notConflictProp', ['footer-span-method', 'virtual-x-config.enabled=false'])
|
|
11100
|
+
// }
|
|
11101
|
+
// }
|
|
10614
11102
|
// 检查是否有安装需要的模块
|
|
10615
11103
|
if (props.editConfig && !$xeTable.insert) {
|
|
10616
11104
|
errLog('vxe.error.reqModule', ['Edit']);
|