vxe-table 3.21.13 → 3.21.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/style.css +1 -1
- package/es/table/module/edit/mixin.js +5 -5
- package/es/table/src/methods.js +206 -61
- package/es/table/src/table.js +14 -7
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/lib/index.umd.js +35 -15
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/table/module/edit/mixin.js +5 -0
- package/lib/table/module/edit/mixin.min.js +1 -1
- package/lib/table/src/methods.js +14 -7
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/table.js +14 -6
- package/lib/table/src/table.min.js +1 -1
- package/lib/ui/index.js +1 -1
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/package.json +2 -2
- package/packages/table/module/edit/mixin.ts +5 -5
- package/packages/table/src/methods.ts +210 -60
- package/packages/table/src/table.ts +14 -7
- /package/es/{iconfont.1781229212834.ttf → iconfont.1781257629862.ttf} +0 -0
- /package/es/{iconfont.1781229212834.woff → iconfont.1781257629862.woff} +0 -0
- /package/es/{iconfont.1781229212834.woff2 → iconfont.1781257629862.woff2} +0 -0
- /package/lib/{iconfont.1781229212834.ttf → iconfont.1781257629862.ttf} +0 -0
- /package/lib/{iconfont.1781229212834.woff → iconfont.1781257629862.woff} +0 -0
- /package/lib/{iconfont.1781229212834.woff2 → iconfont.1781257629862.woff2} +0 -0
|
@@ -70,7 +70,7 @@ function insertTreeRow($xeTable, newRecords, isAppend) {
|
|
|
70
70
|
}
|
|
71
71
|
pChilds[funcName](item);
|
|
72
72
|
pMapChilds[funcName](item);
|
|
73
|
-
const rest = { row: item, rowid, seq: -1, index: -1, _index: -1, $index: -1, treeIndex: -1, _tIndex: -1, items: pChilds, parent: parentRow, level: parentLevel + 1, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
|
|
73
|
+
const rest = { row: item, rowid, _seq: -1, seq: -1, index: -1, _index: -1, $index: -1, treeIndex: -1, _tIndex: -1, items: pChilds, parent: parentRow, level: parentLevel + 1, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
|
|
74
74
|
fullDataRowIdData[rowid] = rest;
|
|
75
75
|
fullAllDataRowIdData[rowid] = rest;
|
|
76
76
|
}
|
|
@@ -80,7 +80,7 @@ function insertTreeRow($xeTable, newRecords, isAppend) {
|
|
|
80
80
|
}
|
|
81
81
|
afterFullData[funcName](item);
|
|
82
82
|
tableFullTreeData[funcName](item);
|
|
83
|
-
const rest = { row: item, rowid, seq: -1, index: -1, _index: -1, $index: -1, treeIndex: -1, _tIndex: -1, items: tableFullTreeData, parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
|
|
83
|
+
const rest = { row: item, rowid, _seq: -1, seq: -1, index: -1, _index: -1, $index: -1, treeIndex: -1, _tIndex: -1, items: tableFullTreeData, parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
|
|
84
84
|
fullDataRowIdData[rowid] = rest;
|
|
85
85
|
fullAllDataRowIdData[rowid] = rest;
|
|
86
86
|
}
|
|
@@ -133,7 +133,7 @@ function handleInsertRowAt($xeTable, records, targetRowOrRowid, isInsertNextRow)
|
|
|
133
133
|
else {
|
|
134
134
|
newRecords.forEach(item => {
|
|
135
135
|
const rowid = getRowid($xeTable, item);
|
|
136
|
-
const rest = { row: item, rowid, seq: -1, index: -1, _index: -1, $index: -1, treeIndex: -1, _tIndex: -1, items: afterFullData, parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
|
|
136
|
+
const rest = { row: item, rowid, _seq: -1, seq: -1, index: -1, _index: -1, $index: -1, treeIndex: -1, _tIndex: -1, items: afterFullData, parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
|
|
137
137
|
fullDataRowIdData[rowid] = rest;
|
|
138
138
|
fullAllDataRowIdData[rowid] = rest;
|
|
139
139
|
afterFullData.unshift(item);
|
|
@@ -165,7 +165,7 @@ function handleInsertRowAt($xeTable, records, targetRowOrRowid, isInsertNextRow)
|
|
|
165
165
|
else {
|
|
166
166
|
newRecords.forEach(item => {
|
|
167
167
|
const rowid = getRowid($xeTable, item);
|
|
168
|
-
const rest = { row: item, rowid, seq: -1, index: -1, _index: -1, $index: -1, treeIndex: -1, _tIndex: -1, items: afterFullData, parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
|
|
168
|
+
const rest = { row: item, rowid, _seq: -1, seq: -1, index: -1, _index: -1, $index: -1, treeIndex: -1, _tIndex: -1, items: afterFullData, parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
|
|
169
169
|
fullDataRowIdData[rowid] = rest;
|
|
170
170
|
fullAllDataRowIdData[rowid] = rest;
|
|
171
171
|
afterFullData.push(item);
|
|
@@ -205,7 +205,7 @@ function handleInsertRowAt($xeTable, records, targetRowOrRowid, isInsertNextRow)
|
|
|
205
205
|
});
|
|
206
206
|
XEUtils.eachTree(treeRecords, (item) => {
|
|
207
207
|
const rowid = getRowid($xeTable, item);
|
|
208
|
-
const rest = { row: item, rowid, seq: -1, index: -1, _index: -1, $index: -1, treeIndex: -1, _tIndex: -1, items: parentMapChilds, parent: parentRow, level: parentLevel + 1, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
|
|
208
|
+
const rest = { row: item, rowid, _seq: -1, seq: -1, index: -1, _index: -1, $index: -1, treeIndex: -1, _tIndex: -1, items: parentMapChilds, parent: parentRow, level: parentLevel + 1, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
|
|
209
209
|
if (item[childrenField]) {
|
|
210
210
|
item[mapChildrenField] = item[childrenField];
|
|
211
211
|
}
|
package/es/table/src/methods.js
CHANGED
|
@@ -609,28 +609,65 @@ function handleDefaultRowGroupExpand($xeTable) {
|
|
|
609
609
|
}
|
|
610
610
|
}
|
|
611
611
|
}
|
|
612
|
+
function updateAfterTreeIndex($xeTable) {
|
|
613
|
+
const internalData = $xeTable;
|
|
614
|
+
const { fullDataRowIdData, fullAllDataRowIdData, afterFullData, afterTreeFullData } = internalData;
|
|
615
|
+
const treeOpts = $xeTable.computeTreeOpts;
|
|
616
|
+
const { transform, mapChildrenField } = treeOpts;
|
|
617
|
+
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
618
|
+
const fullMaps = {};
|
|
619
|
+
let rowNum = 0;
|
|
620
|
+
const { handleGetRowId } = createHandleGetRowId($xeTable);
|
|
621
|
+
XEUtils.eachTree(afterTreeFullData, (row, index, items, path) => {
|
|
622
|
+
const rowid = handleGetRowId(row);
|
|
623
|
+
const rowRest = fullAllDataRowIdData[rowid];
|
|
624
|
+
const seq = path.map((num, i) => i % 2 === 0 ? (Number(num) + 1) : '.').join('');
|
|
625
|
+
if (rowRest) {
|
|
626
|
+
rowRest.seq = seq;
|
|
627
|
+
rowRest._seq = rowNum;
|
|
628
|
+
rowRest.treeIndex = index;
|
|
629
|
+
rowRest._tIndex = rowNum;
|
|
630
|
+
}
|
|
631
|
+
else {
|
|
632
|
+
const rest = { row, rowid, _seq: rowNum, seq, index: -1, $index: -1, _index: -1, treeIndex: -1, _tIndex: rowNum, items: [], parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
|
|
633
|
+
fullAllDataRowIdData[rowid] = rest;
|
|
634
|
+
fullDataRowIdData[rowid] = rest;
|
|
635
|
+
}
|
|
636
|
+
rowNum++;
|
|
637
|
+
fullMaps[rowid] = row;
|
|
638
|
+
}, { children: transform ? mapChildrenField : childrenField });
|
|
639
|
+
if (transform) {
|
|
640
|
+
afterFullData.forEach((row, index) => {
|
|
641
|
+
const rowid = handleGetRowId(row);
|
|
642
|
+
const rowRest = fullAllDataRowIdData[rowid];
|
|
643
|
+
if (rowRest) {
|
|
644
|
+
rowRest._index = index;
|
|
645
|
+
}
|
|
646
|
+
});
|
|
647
|
+
}
|
|
648
|
+
internalData.afterFullRowMaps = fullMaps;
|
|
649
|
+
}
|
|
612
650
|
function updateAfterListIndex($xeTable) {
|
|
613
|
-
const props = $xeTable;
|
|
614
651
|
const internalData = $xeTable;
|
|
615
|
-
const { treeConfig } = props;
|
|
616
652
|
const { afterFullData, fullDataRowIdData, fullAllDataRowIdData } = internalData;
|
|
617
653
|
const { handleGetRowId } = createHandleGetRowId($xeTable);
|
|
618
654
|
const fullMaps = {};
|
|
655
|
+
let rowNum = 0;
|
|
619
656
|
afterFullData.forEach((row, index) => {
|
|
620
657
|
const rowid = handleGetRowId(row);
|
|
621
658
|
const rowRest = fullAllDataRowIdData[rowid];
|
|
622
659
|
const seq = index + 1;
|
|
623
660
|
if (rowRest) {
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
}
|
|
661
|
+
rowRest.seq = seq;
|
|
662
|
+
rowRest._seq = rowNum;
|
|
627
663
|
rowRest._index = index;
|
|
628
664
|
}
|
|
629
665
|
else {
|
|
630
|
-
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 };
|
|
666
|
+
const rest = { row, rowid, _seq: rowNum, seq, index: -1, $index: -1, _index: index, treeIndex: -1, _tIndex: -1, items: [], parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
|
|
631
667
|
fullAllDataRowIdData[rowid] = rest;
|
|
632
668
|
fullDataRowIdData[rowid] = rest;
|
|
633
669
|
}
|
|
670
|
+
rowNum++;
|
|
634
671
|
fullMaps[rowid] = row;
|
|
635
672
|
});
|
|
636
673
|
internalData.afterFullRowMaps = fullMaps;
|
|
@@ -641,47 +678,9 @@ function updateAfterListIndex($xeTable) {
|
|
|
641
678
|
*/
|
|
642
679
|
function updateAfterDataIndex($xeTable) {
|
|
643
680
|
const props = $xeTable;
|
|
644
|
-
const internalData = $xeTable;
|
|
645
681
|
const { treeConfig } = props;
|
|
646
|
-
const { fullDataRowIdData, fullAllDataRowIdData, afterFullData, afterTreeFullData } = internalData;
|
|
647
|
-
const treeOpts = $xeTable.computeTreeOpts;
|
|
648
|
-
const { transform } = treeOpts;
|
|
649
|
-
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
650
|
-
const fullMaps = {};
|
|
651
682
|
if (treeConfig) {
|
|
652
|
-
|
|
653
|
-
const { handleGetRowId } = createHandleGetRowId($xeTable);
|
|
654
|
-
XEUtils.eachTree(afterTreeFullData, (row, index, items, path) => {
|
|
655
|
-
const rowid = handleGetRowId(row);
|
|
656
|
-
const rowRest = fullAllDataRowIdData[rowid];
|
|
657
|
-
const seq = path.map((num, i) => i % 2 === 0 ? (Number(num) + 1) : '.').join('');
|
|
658
|
-
if (rowRest) {
|
|
659
|
-
rowRest.seq = seq;
|
|
660
|
-
rowRest.treeIndex = index;
|
|
661
|
-
rowRest._tIndex = _treeIndex;
|
|
662
|
-
}
|
|
663
|
-
else {
|
|
664
|
-
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 };
|
|
665
|
-
fullAllDataRowIdData[rowid] = rest;
|
|
666
|
-
fullDataRowIdData[rowid] = rest;
|
|
667
|
-
}
|
|
668
|
-
_treeIndex++;
|
|
669
|
-
fullMaps[rowid] = row;
|
|
670
|
-
}, { children: transform ? treeOpts.mapChildrenField : childrenField });
|
|
671
|
-
if (transform) {
|
|
672
|
-
afterFullData.forEach((row, index) => {
|
|
673
|
-
const rowid = handleGetRowId(row);
|
|
674
|
-
const rowRest = fullAllDataRowIdData[rowid];
|
|
675
|
-
const seq = index + 1;
|
|
676
|
-
if (rowRest) {
|
|
677
|
-
if (!treeConfig) {
|
|
678
|
-
rowRest.seq = seq;
|
|
679
|
-
}
|
|
680
|
-
rowRest._index = index;
|
|
681
|
-
}
|
|
682
|
-
});
|
|
683
|
-
}
|
|
684
|
-
internalData.afterFullRowMaps = fullMaps;
|
|
683
|
+
updateAfterTreeIndex($xeTable);
|
|
685
684
|
}
|
|
686
685
|
else {
|
|
687
686
|
updateAfterListIndex($xeTable);
|
|
@@ -3072,10 +3071,11 @@ function handleRecalculateStyle($xeTable, reFull, reWidth, reHeight) {
|
|
|
3072
3071
|
}
|
|
3073
3072
|
});
|
|
3074
3073
|
}
|
|
3075
|
-
const
|
|
3076
|
-
function handleLazyRecalculate($xeTable, reFull, reWidth, reHeight) {
|
|
3074
|
+
const defaultMinRunDelay = 50;
|
|
3075
|
+
function handleLazyRecalculate($xeTable, reFull, reWidth, reHeight, options) {
|
|
3077
3076
|
const reactData = $xeTable;
|
|
3078
3077
|
const internalData = $xeTable;
|
|
3078
|
+
const minRunDelay = (options ? options.minRunDelay : defaultMinRunDelay) || defaultMinRunDelay;
|
|
3079
3079
|
return new Promise(resolve => {
|
|
3080
3080
|
const { customStore } = reactData;
|
|
3081
3081
|
const { rceTimeout, rceRunTime } = internalData;
|
|
@@ -3102,6 +3102,7 @@ function handleLazyRecalculate($xeTable, reFull, reWidth, reHeight) {
|
|
|
3102
3102
|
}
|
|
3103
3103
|
if (rceTimeout) {
|
|
3104
3104
|
clearTimeout(rceTimeout);
|
|
3105
|
+
// 多少毫秒内至少执行一次
|
|
3105
3106
|
if (rceRunTime && rceRunTime + minRunDelay < Date.now()) {
|
|
3106
3107
|
resolve(handleRecalculateStyle($xeTable, reFull, reWidth, reHeight));
|
|
3107
3108
|
}
|
|
@@ -3124,7 +3125,18 @@ function handleLazyRecalculate($xeTable, reFull, reWidth, reHeight) {
|
|
|
3124
3125
|
});
|
|
3125
3126
|
}
|
|
3126
3127
|
function handleResizeEvent($xeTable) {
|
|
3127
|
-
|
|
3128
|
+
const internalData = $xeTable;
|
|
3129
|
+
if (internalData.rsePending) {
|
|
3130
|
+
return;
|
|
3131
|
+
}
|
|
3132
|
+
internalData.rsePending = true;
|
|
3133
|
+
handleLazyRecalculate($xeTable, true, true, true, {
|
|
3134
|
+
minRunDelay: 200
|
|
3135
|
+
}).then(() => {
|
|
3136
|
+
internalData.rsePending = false;
|
|
3137
|
+
}).catch(() => {
|
|
3138
|
+
internalData.rsePending = false;
|
|
3139
|
+
});
|
|
3128
3140
|
}
|
|
3129
3141
|
function handleUpdateAggValues($xeTable) {
|
|
3130
3142
|
const reactData = $xeTable;
|
|
@@ -4907,16 +4919,18 @@ const tableMethods = {
|
|
|
4907
4919
|
const fullDataRowIdMaps = {};
|
|
4908
4920
|
const idMaps = {};
|
|
4909
4921
|
const { handleUpdateRowId } = createHandleUpdateRowId($xeTable);
|
|
4922
|
+
let rowNum = 0;
|
|
4910
4923
|
const handleRowCache = (row, index, items, currIndex, parentRow, rowid, level, seq) => {
|
|
4911
4924
|
let rowRest = fullAllDataRowIdMaps[rowid];
|
|
4912
4925
|
if (idMaps[rowid]) {
|
|
4913
4926
|
errLog('vxe.error.repeatKey', [currKeyField, rowid]);
|
|
4914
4927
|
}
|
|
4915
4928
|
if (!rowRest) {
|
|
4916
|
-
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 };
|
|
4929
|
+
rowRest = { row, rowid, _seq: -1, seq, index: -1, _index: -1, $index: -1, treeIndex: index, _tIndex: -1, items, parent: parentRow, level, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
|
|
4917
4930
|
}
|
|
4918
4931
|
rowRest.treeLoaded = false;
|
|
4919
4932
|
rowRest.expandLoaded = false;
|
|
4933
|
+
rowRest._seq = rowNum++;
|
|
4920
4934
|
rowRest.row = row;
|
|
4921
4935
|
rowRest.items = items;
|
|
4922
4936
|
rowRest.parent = parentRow;
|
|
@@ -5026,7 +5040,7 @@ const tableMethods = {
|
|
|
5026
5040
|
XEUtils.eachTree(rows, (childRow, index, items, path, parentItem, nodes) => {
|
|
5027
5041
|
const rowid = getRowid($xeTable, childRow);
|
|
5028
5042
|
const parentRow = parentItem || parentRest.row;
|
|
5029
|
-
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 };
|
|
5043
|
+
const rest = { row: childRow, rowid, _seq: -1, 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 };
|
|
5030
5044
|
fullDataRowIdData[rowid] = rest;
|
|
5031
5045
|
fullAllDataRowIdData[rowid] = rest;
|
|
5032
5046
|
}, { children: childrenField });
|
|
@@ -8464,31 +8478,162 @@ const tableMethods = {
|
|
|
8464
8478
|
const { treeConfig } = props;
|
|
8465
8479
|
const { row } = params;
|
|
8466
8480
|
const { isRowGroupStatus } = reactData;
|
|
8467
|
-
const { afterFullData } = internalData;
|
|
8481
|
+
const { fullAllDataRowIdData, afterFullData, afterTreeFullData, afterGroupFullData } = internalData;
|
|
8468
8482
|
const checkboxOpts = $xeTable.computeCheckboxOpts;
|
|
8469
|
-
const
|
|
8483
|
+
const aggregateOpts = $xeTable.computeAggregateOpts;
|
|
8484
|
+
const treeOpts = $xeTable.computeTreeOpts;
|
|
8485
|
+
const { checkMethod, trigger, checkStrictly } = checkboxOpts;
|
|
8470
8486
|
if (trigger === 'manual') {
|
|
8471
8487
|
return;
|
|
8472
8488
|
}
|
|
8473
8489
|
evnt.stopPropagation();
|
|
8474
|
-
if (checkboxOpts.isShiftKey && evnt.shiftKey
|
|
8490
|
+
if (checkboxOpts.isShiftKey && evnt.shiftKey) {
|
|
8491
|
+
const { handleGetRowId } = createHandleGetRowId($xeTable);
|
|
8475
8492
|
const checkboxRecords = $xeTable.getCheckboxRecords();
|
|
8476
|
-
|
|
8477
|
-
|
|
8478
|
-
|
|
8479
|
-
|
|
8480
|
-
|
|
8493
|
+
let currSeq = -1;
|
|
8494
|
+
let currRow = null;
|
|
8495
|
+
const currRowid = handleGetRowId(row);
|
|
8496
|
+
const rowRest = fullAllDataRowIdData[currRowid];
|
|
8497
|
+
if (rowRest) {
|
|
8498
|
+
currRow = rowRest.row;
|
|
8499
|
+
currSeq = rowRest._seq;
|
|
8500
|
+
}
|
|
8501
|
+
if (currRow && checkboxRecords.length) {
|
|
8502
|
+
let rangeRows = [];
|
|
8503
|
+
let firstSeq = -1;
|
|
8504
|
+
let firstRow = null;
|
|
8505
|
+
let firstRowid = '';
|
|
8506
|
+
let lastSeq = -1;
|
|
8507
|
+
let lastRow = null;
|
|
8508
|
+
let lastRowid = '';
|
|
8509
|
+
// 根据序号取出范围最小/最大的行
|
|
8510
|
+
const selectMaps = {};
|
|
8511
|
+
checkboxRecords.forEach(item => {
|
|
8512
|
+
const rowid = handleGetRowId(item);
|
|
8513
|
+
const rowRest = fullAllDataRowIdData[rowid];
|
|
8514
|
+
if (rowRest) {
|
|
8515
|
+
if (!firstRow || firstSeq > rowRest._seq) {
|
|
8516
|
+
firstRowid = rowRest.rowid;
|
|
8517
|
+
firstRow = rowRest.row;
|
|
8518
|
+
firstSeq = rowRest._seq;
|
|
8519
|
+
}
|
|
8520
|
+
if (!lastRow || lastSeq < rowRest._seq) {
|
|
8521
|
+
lastRowid = rowRest.rowid;
|
|
8522
|
+
lastRow = rowRest.row;
|
|
8523
|
+
lastSeq = rowRest._seq;
|
|
8524
|
+
}
|
|
8525
|
+
}
|
|
8526
|
+
selectMaps[rowid] = item;
|
|
8527
|
+
});
|
|
8528
|
+
// 如果已选只有一条并选择当前则跳过
|
|
8529
|
+
if (firstRow && lastRow && (checkboxRecords.length > 1 || currRowid !== firstRowid) && (Math.abs(firstSeq - lastSeq) > 1 || Math.abs(currSeq - firstSeq) > 1 || Math.abs(currSeq - lastSeq) > 1)) {
|
|
8530
|
+
// 树与分组
|
|
8531
|
+
if (treeConfig || isRowGroupStatus) {
|
|
8532
|
+
const { transform } = treeOpts;
|
|
8533
|
+
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
8534
|
+
const iteratorChildField = treeConfig ? (transform ? treeOpts.mapChildrenField : childrenField) : aggregateOpts.mapChildrenField;
|
|
8535
|
+
let isMatchFirst = false;
|
|
8536
|
+
let matchStartRowid = '';
|
|
8537
|
+
let matchEndRowid = '';
|
|
8538
|
+
const handleGetChildRowid = (rowid, isLast) => {
|
|
8539
|
+
const rowRest = fullAllDataRowIdData[rowid];
|
|
8540
|
+
if (rowRest) {
|
|
8541
|
+
const item = rowRest.row;
|
|
8542
|
+
const childList = item[iteratorChildField];
|
|
8543
|
+
if (childList && childList.length) {
|
|
8544
|
+
const targetRow = isLast ? XEUtils.last(childList) : XEUtils.first(childList);
|
|
8545
|
+
return handleGetChildRowid(handleGetRowId(targetRow), isLast);
|
|
8546
|
+
}
|
|
8547
|
+
}
|
|
8548
|
+
return rowid;
|
|
8549
|
+
};
|
|
8550
|
+
const handleGetSelectParentRowid = (rowid) => {
|
|
8551
|
+
const rowRest = fullAllDataRowIdData[rowid];
|
|
8552
|
+
if (rowRest) {
|
|
8553
|
+
const parentItem = rowRest.parent;
|
|
8554
|
+
if (parentItem) {
|
|
8555
|
+
const parentRowid = handleGetRowId(parentItem);
|
|
8556
|
+
if (selectMaps[parentRowid]) {
|
|
8557
|
+
return handleGetSelectParentRowid(parentRowid);
|
|
8558
|
+
}
|
|
8559
|
+
}
|
|
8560
|
+
}
|
|
8561
|
+
return rowid;
|
|
8562
|
+
};
|
|
8563
|
+
const handleGetRootRow = (row) => {
|
|
8564
|
+
const rowid = handleGetRowId(row);
|
|
8565
|
+
if (rowid) {
|
|
8566
|
+
const rest = fullAllDataRowIdData[rowid];
|
|
8567
|
+
if (rest) {
|
|
8568
|
+
return rest.parent ? handleGetRootRow(rest.parent) : rest;
|
|
8569
|
+
}
|
|
8570
|
+
}
|
|
8571
|
+
return null;
|
|
8572
|
+
};
|
|
8573
|
+
if (currSeq < firstSeq) {
|
|
8574
|
+
matchStartRowid = handleGetChildRowid(currRowid, 0);
|
|
8575
|
+
matchEndRowid = handleGetChildRowid(firstRowid, 1);
|
|
8576
|
+
}
|
|
8577
|
+
else {
|
|
8578
|
+
if (currSeq > lastSeq) {
|
|
8579
|
+
matchStartRowid = handleGetSelectParentRowid(lastRowid);
|
|
8580
|
+
}
|
|
8581
|
+
else {
|
|
8582
|
+
matchStartRowid = handleGetChildRowid(firstRowid, 0);
|
|
8583
|
+
}
|
|
8584
|
+
matchEndRowid = handleGetChildRowid(currRowid, 1);
|
|
8585
|
+
}
|
|
8586
|
+
const handleRangeRow = (item) => {
|
|
8587
|
+
const rowid = handleGetRowId(item);
|
|
8588
|
+
const childList = item[iteratorChildField];
|
|
8589
|
+
if (!isMatchFirst && rowid === matchStartRowid) {
|
|
8590
|
+
isMatchFirst = true;
|
|
8591
|
+
}
|
|
8592
|
+
// 如果是父子关联,则排除父节点
|
|
8593
|
+
if (isMatchFirst && (checkStrictly || !childList || !childList.length)) {
|
|
8594
|
+
rangeRows.push(item);
|
|
8595
|
+
}
|
|
8596
|
+
// break
|
|
8597
|
+
return rowid === matchEndRowid;
|
|
8598
|
+
};
|
|
8599
|
+
if (treeConfig) {
|
|
8600
|
+
const matchStartRowRest = fullAllDataRowIdData[matchStartRowid];
|
|
8601
|
+
const firstRootRowRest = matchStartRowRest ? handleGetRootRow(matchStartRowRest.row) : null;
|
|
8602
|
+
if (firstRootRowRest) {
|
|
8603
|
+
// 优化查找复杂度
|
|
8604
|
+
XEUtils.findTree(afterTreeFullData.slice(firstRootRowRest.treeIndex), handleRangeRow, { children: iteratorChildField });
|
|
8605
|
+
}
|
|
8606
|
+
else {
|
|
8607
|
+
XEUtils.findTree(afterTreeFullData, handleRangeRow, { children: iteratorChildField });
|
|
8608
|
+
}
|
|
8609
|
+
}
|
|
8610
|
+
else {
|
|
8611
|
+
XEUtils.findTree(afterGroupFullData, handleRangeRow, { children: iteratorChildField });
|
|
8612
|
+
}
|
|
8613
|
+
}
|
|
8614
|
+
else {
|
|
8615
|
+
const _currRowIndex = $xeTable.getVTRowIndex(currRow);
|
|
8616
|
+
const _firstRowIndex = $xeTable.getVTRowIndex(firstRow);
|
|
8617
|
+
const _lastRowIndex = $xeTable.getVTRowIndex(lastRow);
|
|
8618
|
+
if (_currRowIndex < _firstRowIndex) {
|
|
8619
|
+
rangeRows = afterFullData.slice(_currRowIndex, _firstRowIndex + 1);
|
|
8620
|
+
}
|
|
8621
|
+
else if (_currRowIndex > _lastRowIndex) {
|
|
8622
|
+
rangeRows = afterFullData.slice(_lastRowIndex, _currRowIndex + 1);
|
|
8623
|
+
}
|
|
8624
|
+
else {
|
|
8625
|
+
rangeRows = afterFullData.slice(_firstRowIndex, _currRowIndex + 1);
|
|
8626
|
+
}
|
|
8627
|
+
}
|
|
8481
8628
|
$xeTable.setAllCheckboxRow(false);
|
|
8482
|
-
const rangeRows = _rowIndex < _firstRowIndex ? afterFullData.slice(_rowIndex, _firstRowIndex + 1) : afterFullData.slice(_firstRowIndex, _rowIndex + 1);
|
|
8483
8629
|
$xeTable.$nextTick(() => {
|
|
8484
8630
|
handleCheckedCheckboxRow($xeTable, rangeRows, true, false);
|
|
8485
8631
|
});
|
|
8486
8632
|
$xeTable.dispatchEvent('checkbox-range-select', Object.assign({ rangeRecords: rangeRows }, params), evnt);
|
|
8487
|
-
return;
|
|
8488
8633
|
}
|
|
8489
8634
|
}
|
|
8490
8635
|
}
|
|
8491
|
-
if (
|
|
8636
|
+
if (!checkMethod || checkMethod({ $table: $xeTable, row })) {
|
|
8492
8637
|
$xeTable.handleBatchSelectRows([row], checked);
|
|
8493
8638
|
$xeTable.checkSelectionStatus();
|
|
8494
8639
|
$xeTable.dispatchEvent('checkbox-change', Object.assign({
|
package/es/table/src/table.js
CHANGED
|
@@ -1245,22 +1245,32 @@ export default {
|
|
|
1245
1245
|
const { tableFullColumn } = internalData;
|
|
1246
1246
|
const { updateColFlag } = reactData;
|
|
1247
1247
|
const editDirtyOpts = $xeTable.computeEditDirtyOpts;
|
|
1248
|
-
const { includeFields, excludeFields } = editDirtyOpts;
|
|
1248
|
+
const { extraFields, includeFields, excludeFields } = editDirtyOpts;
|
|
1249
1249
|
const kpFields = [];
|
|
1250
1250
|
if (updateColFlag) {
|
|
1251
1251
|
if (includeFields && includeFields.length) {
|
|
1252
1252
|
return includeFields;
|
|
1253
1253
|
}
|
|
1254
|
-
const
|
|
1254
|
+
const excludeFdMaps = {};
|
|
1255
1255
|
if (excludeFields && excludeFields.length) {
|
|
1256
1256
|
excludeFields.forEach(field => {
|
|
1257
|
-
|
|
1257
|
+
excludeFdMaps[field] = 1;
|
|
1258
|
+
});
|
|
1259
|
+
}
|
|
1260
|
+
const addFdMaps = {};
|
|
1261
|
+
if (extraFields && extraFields.length) {
|
|
1262
|
+
extraFields.forEach(field => {
|
|
1263
|
+
if (!addFdMaps[field]) {
|
|
1264
|
+
addFdMaps[field] = 1;
|
|
1265
|
+
kpFields.push(field);
|
|
1266
|
+
}
|
|
1258
1267
|
});
|
|
1259
1268
|
}
|
|
1260
1269
|
for (let i = 0; i < tableFullColumn.length; i++) {
|
|
1261
1270
|
const column = tableFullColumn[i];
|
|
1262
1271
|
const { field, type, editRender, cellRender } = column;
|
|
1263
|
-
if (field && !type && (editRender || cellRender) && !
|
|
1272
|
+
if (field && !type && (editRender || cellRender) && !addFdMaps[field] && !excludeFdMaps[field]) {
|
|
1273
|
+
addFdMaps[field] = 1;
|
|
1264
1274
|
kpFields.push(field);
|
|
1265
1275
|
}
|
|
1266
1276
|
}
|
|
@@ -1727,9 +1737,6 @@ export default {
|
|
|
1727
1737
|
if (props.editConfig && editOpts.activeMethod) {
|
|
1728
1738
|
warnLog('vxe.error.delProp', ['table.edit-config.activeMethod', 'table.edit-config.beforeEditMethod']);
|
|
1729
1739
|
}
|
|
1730
|
-
if (props.treeConfig && checkboxOpts.isShiftKey) {
|
|
1731
|
-
errLog('vxe.error.reqSupportProp', ['tree-config', 'checkbox-config.isShiftKey=false']);
|
|
1732
|
-
}
|
|
1733
1740
|
if (checkboxOpts.halfField) {
|
|
1734
1741
|
warnLog('vxe.error.delProp', ['checkbox-config.halfField', 'checkbox-config.indeterminateField']);
|
|
1735
1742
|
}
|
package/es/ui/index.js
CHANGED
package/es/ui/src/log.js
CHANGED