vxe-table 3.21.12 → 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/index.css +1 -1
- package/es/index.min.css +1 -1
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/table/module/edit/mixin.js +5 -5
- package/es/table/module/menu/panel.js +5 -5
- package/es/table/src/methods.js +212 -63
- package/es/table/src/table.js +14 -7
- package/es/table/style.css +11 -7
- package/es/table/style.min.css +1 -1
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/es/vxe-table/style.css +11 -7
- package/es/vxe-table/style.min.css +1 -1
- package/lib/index.css +1 -1
- package/lib/index.min.css +1 -1
- package/lib/index.umd.js +42 -22
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.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/module/menu/panel.js +5 -5
- package/lib/table/module/menu/panel.min.js +1 -1
- package/lib/table/src/methods.js +16 -9
- 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/table/style/style.css +11 -7
- package/lib/table/style/style.min.css +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/lib/vxe-table/style/style.css +11 -7
- package/lib/vxe-table/style/style.min.css +1 -1
- package/package.json +2 -2
- package/packages/table/module/edit/mixin.ts +5 -5
- package/packages/table/module/menu/panel.ts +5 -5
- package/packages/table/src/methods.ts +216 -62
- package/packages/table/src/table.ts +14 -7
- package/styles/components/table-module/menu.scss +5 -2
- /package/es/{iconfont.1781140842818.ttf → iconfont.1781257629862.ttf} +0 -0
- /package/es/{iconfont.1781140842818.woff → iconfont.1781257629862.woff} +0 -0
- /package/es/{iconfont.1781140842818.woff2 → iconfont.1781257629862.woff2} +0 -0
- /package/lib/{iconfont.1781140842818.ttf → iconfont.1781257629862.ttf} +0 -0
- /package/lib/{iconfont.1781140842818.woff → iconfont.1781257629862.woff} +0 -0
- /package/lib/{iconfont.1781140842818.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
|
}
|
|
@@ -49,7 +49,7 @@ export default {
|
|
|
49
49
|
return options.every((item) => item.visible === false)
|
|
50
50
|
? renderEmptyElement($xeTable)
|
|
51
51
|
: h('ul', {
|
|
52
|
-
class: 'vxe-context-menu
|
|
52
|
+
class: 'vxe-table--context-menu-group-wrapper',
|
|
53
53
|
key: gIndex
|
|
54
54
|
}, options.map((item, index) => {
|
|
55
55
|
const { children, loading } = item;
|
|
@@ -62,7 +62,7 @@ export default {
|
|
|
62
62
|
return item.visible === false
|
|
63
63
|
? renderEmptyElement($xeTable)
|
|
64
64
|
: h('li', {
|
|
65
|
-
class: [item.className, {
|
|
65
|
+
class: ['vxe-table--context-menu--option', item.className, {
|
|
66
66
|
'link--loading': loading,
|
|
67
67
|
'link--disabled': item.disabled,
|
|
68
68
|
'link--active': item === ctxMenuStore.selected
|
|
@@ -116,12 +116,12 @@ export default {
|
|
|
116
116
|
suffixOpts.content ? h('span', `${suffixOpts.content}`) : renderEmptyElement($xeTable)
|
|
117
117
|
])
|
|
118
118
|
]),
|
|
119
|
-
hasChildMenus &&
|
|
119
|
+
hasChildMenus && children
|
|
120
120
|
? h('ul', {
|
|
121
121
|
class: ['vxe-table--context-menu-clild-wrapper', {
|
|
122
122
|
'is--show': item === ctxMenuStore.selected && ctxMenuStore.showChild
|
|
123
123
|
}]
|
|
124
|
-
},
|
|
124
|
+
}, children.map((child, cIndex) => {
|
|
125
125
|
const { loading: childLoading } = child;
|
|
126
126
|
const childPrefixOpts = Object.assign({}, child.prefixConfig);
|
|
127
127
|
const childPrefixIcon = childPrefixOpts.icon || child.prefixIcon;
|
|
@@ -131,7 +131,7 @@ export default {
|
|
|
131
131
|
return child.visible === false
|
|
132
132
|
? null
|
|
133
133
|
: h('li', {
|
|
134
|
-
class: [child.className, {
|
|
134
|
+
class: ['vxe-table--context-menu--option', child.className, {
|
|
135
135
|
'link--loading': childLoading,
|
|
136
136
|
'link--disabled': child.disabled,
|
|
137
137
|
'link--active': child === ctxMenuStore.selectChild
|
package/es/table/src/methods.js
CHANGED
|
@@ -415,7 +415,11 @@ function updateScrollYStatus($xeTable, fullData) {
|
|
|
415
415
|
const { transform } = treeOpts;
|
|
416
416
|
const allList = fullData || internalData.tableFullData;
|
|
417
417
|
// 如果gt为0,则总是启用
|
|
418
|
-
|
|
418
|
+
let scrollYLoad = !!virtualYOpts.enabled && virtualYOpts.gt > -1 && (virtualYOpts.gt === 0 || virtualYOpts.gt < allList.length);
|
|
419
|
+
if (scrollYLoad && (treeConfig && !transform)) {
|
|
420
|
+
errLog('vxe.error.notSupportProp', ['[table] virtual-y-config.enabled=true', 'tree-config.transform=false', 'tree-config.transform=true']);
|
|
421
|
+
scrollYLoad = false;
|
|
422
|
+
}
|
|
419
423
|
reactData.scrollYLoad = scrollYLoad;
|
|
420
424
|
syncGanttScrollYStatus($xeTable);
|
|
421
425
|
return scrollYLoad;
|
|
@@ -605,28 +609,65 @@ function handleDefaultRowGroupExpand($xeTable) {
|
|
|
605
609
|
}
|
|
606
610
|
}
|
|
607
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
|
+
}
|
|
608
650
|
function updateAfterListIndex($xeTable) {
|
|
609
|
-
const props = $xeTable;
|
|
610
651
|
const internalData = $xeTable;
|
|
611
|
-
const { treeConfig } = props;
|
|
612
652
|
const { afterFullData, fullDataRowIdData, fullAllDataRowIdData } = internalData;
|
|
613
653
|
const { handleGetRowId } = createHandleGetRowId($xeTable);
|
|
614
654
|
const fullMaps = {};
|
|
655
|
+
let rowNum = 0;
|
|
615
656
|
afterFullData.forEach((row, index) => {
|
|
616
657
|
const rowid = handleGetRowId(row);
|
|
617
658
|
const rowRest = fullAllDataRowIdData[rowid];
|
|
618
659
|
const seq = index + 1;
|
|
619
660
|
if (rowRest) {
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
}
|
|
661
|
+
rowRest.seq = seq;
|
|
662
|
+
rowRest._seq = rowNum;
|
|
623
663
|
rowRest._index = index;
|
|
624
664
|
}
|
|
625
665
|
else {
|
|
626
|
-
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 };
|
|
627
667
|
fullAllDataRowIdData[rowid] = rest;
|
|
628
668
|
fullDataRowIdData[rowid] = rest;
|
|
629
669
|
}
|
|
670
|
+
rowNum++;
|
|
630
671
|
fullMaps[rowid] = row;
|
|
631
672
|
});
|
|
632
673
|
internalData.afterFullRowMaps = fullMaps;
|
|
@@ -637,47 +678,9 @@ function updateAfterListIndex($xeTable) {
|
|
|
637
678
|
*/
|
|
638
679
|
function updateAfterDataIndex($xeTable) {
|
|
639
680
|
const props = $xeTable;
|
|
640
|
-
const internalData = $xeTable;
|
|
641
681
|
const { treeConfig } = props;
|
|
642
|
-
const { fullDataRowIdData, fullAllDataRowIdData, afterFullData, afterTreeFullData } = internalData;
|
|
643
|
-
const treeOpts = $xeTable.computeTreeOpts;
|
|
644
|
-
const { transform } = treeOpts;
|
|
645
|
-
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
646
|
-
const fullMaps = {};
|
|
647
682
|
if (treeConfig) {
|
|
648
|
-
|
|
649
|
-
const { handleGetRowId } = createHandleGetRowId($xeTable);
|
|
650
|
-
XEUtils.eachTree(afterTreeFullData, (row, index, items, path) => {
|
|
651
|
-
const rowid = handleGetRowId(row);
|
|
652
|
-
const rowRest = fullAllDataRowIdData[rowid];
|
|
653
|
-
const seq = path.map((num, i) => i % 2 === 0 ? (Number(num) + 1) : '.').join('');
|
|
654
|
-
if (rowRest) {
|
|
655
|
-
rowRest.seq = seq;
|
|
656
|
-
rowRest.treeIndex = index;
|
|
657
|
-
rowRest._tIndex = _treeIndex;
|
|
658
|
-
}
|
|
659
|
-
else {
|
|
660
|
-
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 };
|
|
661
|
-
fullAllDataRowIdData[rowid] = rest;
|
|
662
|
-
fullDataRowIdData[rowid] = rest;
|
|
663
|
-
}
|
|
664
|
-
_treeIndex++;
|
|
665
|
-
fullMaps[rowid] = row;
|
|
666
|
-
}, { children: transform ? treeOpts.mapChildrenField : childrenField });
|
|
667
|
-
if (transform) {
|
|
668
|
-
afterFullData.forEach((row, index) => {
|
|
669
|
-
const rowid = handleGetRowId(row);
|
|
670
|
-
const rowRest = fullAllDataRowIdData[rowid];
|
|
671
|
-
const seq = index + 1;
|
|
672
|
-
if (rowRest) {
|
|
673
|
-
if (!treeConfig) {
|
|
674
|
-
rowRest.seq = seq;
|
|
675
|
-
}
|
|
676
|
-
rowRest._index = index;
|
|
677
|
-
}
|
|
678
|
-
});
|
|
679
|
-
}
|
|
680
|
-
internalData.afterFullRowMaps = fullMaps;
|
|
683
|
+
updateAfterTreeIndex($xeTable);
|
|
681
684
|
}
|
|
682
685
|
else {
|
|
683
686
|
updateAfterListIndex($xeTable);
|
|
@@ -3068,10 +3071,11 @@ function handleRecalculateStyle($xeTable, reFull, reWidth, reHeight) {
|
|
|
3068
3071
|
}
|
|
3069
3072
|
});
|
|
3070
3073
|
}
|
|
3071
|
-
const
|
|
3072
|
-
function handleLazyRecalculate($xeTable, reFull, reWidth, reHeight) {
|
|
3074
|
+
const defaultMinRunDelay = 50;
|
|
3075
|
+
function handleLazyRecalculate($xeTable, reFull, reWidth, reHeight, options) {
|
|
3073
3076
|
const reactData = $xeTable;
|
|
3074
3077
|
const internalData = $xeTable;
|
|
3078
|
+
const minRunDelay = (options ? options.minRunDelay : defaultMinRunDelay) || defaultMinRunDelay;
|
|
3075
3079
|
return new Promise(resolve => {
|
|
3076
3080
|
const { customStore } = reactData;
|
|
3077
3081
|
const { rceTimeout, rceRunTime } = internalData;
|
|
@@ -3098,6 +3102,7 @@ function handleLazyRecalculate($xeTable, reFull, reWidth, reHeight) {
|
|
|
3098
3102
|
}
|
|
3099
3103
|
if (rceTimeout) {
|
|
3100
3104
|
clearTimeout(rceTimeout);
|
|
3105
|
+
// 多少毫秒内至少执行一次
|
|
3101
3106
|
if (rceRunTime && rceRunTime + minRunDelay < Date.now()) {
|
|
3102
3107
|
resolve(handleRecalculateStyle($xeTable, reFull, reWidth, reHeight));
|
|
3103
3108
|
}
|
|
@@ -3120,7 +3125,18 @@ function handleLazyRecalculate($xeTable, reFull, reWidth, reHeight) {
|
|
|
3120
3125
|
});
|
|
3121
3126
|
}
|
|
3122
3127
|
function handleResizeEvent($xeTable) {
|
|
3123
|
-
|
|
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
|
+
});
|
|
3124
3140
|
}
|
|
3125
3141
|
function handleUpdateAggValues($xeTable) {
|
|
3126
3142
|
const reactData = $xeTable;
|
|
@@ -4903,16 +4919,18 @@ const tableMethods = {
|
|
|
4903
4919
|
const fullDataRowIdMaps = {};
|
|
4904
4920
|
const idMaps = {};
|
|
4905
4921
|
const { handleUpdateRowId } = createHandleUpdateRowId($xeTable);
|
|
4922
|
+
let rowNum = 0;
|
|
4906
4923
|
const handleRowCache = (row, index, items, currIndex, parentRow, rowid, level, seq) => {
|
|
4907
4924
|
let rowRest = fullAllDataRowIdMaps[rowid];
|
|
4908
4925
|
if (idMaps[rowid]) {
|
|
4909
4926
|
errLog('vxe.error.repeatKey', [currKeyField, rowid]);
|
|
4910
4927
|
}
|
|
4911
4928
|
if (!rowRest) {
|
|
4912
|
-
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 };
|
|
4913
4930
|
}
|
|
4914
4931
|
rowRest.treeLoaded = false;
|
|
4915
4932
|
rowRest.expandLoaded = false;
|
|
4933
|
+
rowRest._seq = rowNum++;
|
|
4916
4934
|
rowRest.row = row;
|
|
4917
4935
|
rowRest.items = items;
|
|
4918
4936
|
rowRest.parent = parentRow;
|
|
@@ -4937,7 +4955,7 @@ const tableMethods = {
|
|
|
4937
4955
|
const hasChildField = treeOpts.hasChild || treeOpts.hasChildField;
|
|
4938
4956
|
XEUtils.eachTree(tableFullTreeData, (row, index, items, path, parentRow, nodes) => {
|
|
4939
4957
|
const rowid = handleUpdateRowId(row);
|
|
4940
|
-
if (
|
|
4958
|
+
if (lazy) {
|
|
4941
4959
|
if (row[hasChildField] && row[childrenField] === undefined) {
|
|
4942
4960
|
row[childrenField] = null;
|
|
4943
4961
|
}
|
|
@@ -5022,7 +5040,7 @@ const tableMethods = {
|
|
|
5022
5040
|
XEUtils.eachTree(rows, (childRow, index, items, path, parentItem, nodes) => {
|
|
5023
5041
|
const rowid = getRowid($xeTable, childRow);
|
|
5024
5042
|
const parentRow = parentItem || parentRest.row;
|
|
5025
|
-
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 };
|
|
5026
5044
|
fullDataRowIdData[rowid] = rest;
|
|
5027
5045
|
fullAllDataRowIdData[rowid] = rest;
|
|
5028
5046
|
}, { children: childrenField });
|
|
@@ -8460,31 +8478,162 @@ const tableMethods = {
|
|
|
8460
8478
|
const { treeConfig } = props;
|
|
8461
8479
|
const { row } = params;
|
|
8462
8480
|
const { isRowGroupStatus } = reactData;
|
|
8463
|
-
const { afterFullData } = internalData;
|
|
8481
|
+
const { fullAllDataRowIdData, afterFullData, afterTreeFullData, afterGroupFullData } = internalData;
|
|
8464
8482
|
const checkboxOpts = $xeTable.computeCheckboxOpts;
|
|
8465
|
-
const
|
|
8483
|
+
const aggregateOpts = $xeTable.computeAggregateOpts;
|
|
8484
|
+
const treeOpts = $xeTable.computeTreeOpts;
|
|
8485
|
+
const { checkMethod, trigger, checkStrictly } = checkboxOpts;
|
|
8466
8486
|
if (trigger === 'manual') {
|
|
8467
8487
|
return;
|
|
8468
8488
|
}
|
|
8469
8489
|
evnt.stopPropagation();
|
|
8470
|
-
if (checkboxOpts.isShiftKey && evnt.shiftKey
|
|
8490
|
+
if (checkboxOpts.isShiftKey && evnt.shiftKey) {
|
|
8491
|
+
const { handleGetRowId } = createHandleGetRowId($xeTable);
|
|
8471
8492
|
const checkboxRecords = $xeTable.getCheckboxRecords();
|
|
8472
|
-
|
|
8473
|
-
|
|
8474
|
-
|
|
8475
|
-
|
|
8476
|
-
|
|
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
|
+
}
|
|
8477
8628
|
$xeTable.setAllCheckboxRow(false);
|
|
8478
|
-
const rangeRows = _rowIndex < _firstRowIndex ? afterFullData.slice(_rowIndex, _firstRowIndex + 1) : afterFullData.slice(_firstRowIndex, _rowIndex + 1);
|
|
8479
8629
|
$xeTable.$nextTick(() => {
|
|
8480
8630
|
handleCheckedCheckboxRow($xeTable, rangeRows, true, false);
|
|
8481
8631
|
});
|
|
8482
8632
|
$xeTable.dispatchEvent('checkbox-range-select', Object.assign({ rangeRecords: rangeRows }, params), evnt);
|
|
8483
|
-
return;
|
|
8484
8633
|
}
|
|
8485
8634
|
}
|
|
8486
8635
|
}
|
|
8487
|
-
if (
|
|
8636
|
+
if (!checkMethod || checkMethod({ $table: $xeTable, row })) {
|
|
8488
8637
|
$xeTable.handleBatchSelectRows([row], checked);
|
|
8489
8638
|
$xeTable.checkSelectionStatus();
|
|
8490
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.errConflicts', ['tree-config', 'checkbox-config.isShiftKey']);
|
|
1732
|
-
}
|
|
1733
1740
|
if (checkboxOpts.halfField) {
|
|
1734
1741
|
warnLog('vxe.error.delProp', ['checkbox-config.halfField', 'checkbox-config.indeterminateField']);
|
|
1735
1742
|
}
|
package/es/table/style.css
CHANGED
|
@@ -1698,13 +1698,17 @@
|
|
|
1698
1698
|
background-color: var(--vxe-ui-layout-background-color);
|
|
1699
1699
|
}
|
|
1700
1700
|
|
|
1701
|
+
.vxe-context-menu--option {
|
|
1702
|
+
color: var(--vxe-ui-font-color);
|
|
1703
|
+
}
|
|
1704
|
+
|
|
1701
1705
|
.vxe-context-menu--link {
|
|
1702
1706
|
display: flex;
|
|
1703
1707
|
flex-direction: row;
|
|
1704
1708
|
width: var(--vxe-ui-table-menu-item-width);
|
|
1705
1709
|
line-height: 26px;
|
|
1706
1710
|
padding: 0 0.8em;
|
|
1707
|
-
color:
|
|
1711
|
+
color: inherit;
|
|
1708
1712
|
cursor: pointer;
|
|
1709
1713
|
}
|
|
1710
1714
|
.vxe-context-menu--link .vxe-context-menu--link-prefix,
|
|
@@ -1722,35 +1726,35 @@
|
|
|
1722
1726
|
white-space: nowrap;
|
|
1723
1727
|
}
|
|
1724
1728
|
|
|
1725
|
-
.vxe-context-menu
|
|
1729
|
+
.vxe-table--context-menu-group-wrapper,
|
|
1726
1730
|
.vxe-table--context-menu-clild-wrapper {
|
|
1727
1731
|
margin: 0;
|
|
1728
1732
|
padding: 0;
|
|
1729
1733
|
list-style-type: none;
|
|
1730
1734
|
border-bottom: 1px solid var(--vxe-ui-base-popup-border-color);
|
|
1731
1735
|
}
|
|
1732
|
-
.vxe-context-menu
|
|
1736
|
+
.vxe-table--context-menu-group-wrapper li,
|
|
1733
1737
|
.vxe-table--context-menu-clild-wrapper li {
|
|
1734
1738
|
position: relative;
|
|
1735
1739
|
margin: 1px 0;
|
|
1736
1740
|
border: 1px solid transparent;
|
|
1737
1741
|
}
|
|
1738
|
-
.vxe-context-menu
|
|
1742
|
+
.vxe-table--context-menu-group-wrapper li:last-child,
|
|
1739
1743
|
.vxe-table--context-menu-clild-wrapper li:last-child {
|
|
1740
1744
|
border: 0;
|
|
1741
1745
|
}
|
|
1742
|
-
.vxe-context-menu
|
|
1746
|
+
.vxe-table--context-menu-group-wrapper li.link--active,
|
|
1743
1747
|
.vxe-table--context-menu-clild-wrapper li.link--active {
|
|
1744
1748
|
background-color: var(--vxe-ui-base-hover-background-color);
|
|
1745
1749
|
border-color: var(--vxe-ui-base-hover-background-color);
|
|
1746
1750
|
}
|
|
1747
|
-
.vxe-context-menu
|
|
1751
|
+
.vxe-table--context-menu-group-wrapper li.link--loading > .vxe-context-menu--link, .vxe-table--context-menu-group-wrapper li.link--disabled > .vxe-context-menu--link,
|
|
1748
1752
|
.vxe-table--context-menu-clild-wrapper li.link--loading > .vxe-context-menu--link,
|
|
1749
1753
|
.vxe-table--context-menu-clild-wrapper li.link--disabled > .vxe-context-menu--link {
|
|
1750
1754
|
color: var(--vxe-ui-font-disabled-color);
|
|
1751
1755
|
cursor: no-drop;
|
|
1752
1756
|
}
|
|
1753
|
-
.vxe-context-menu
|
|
1757
|
+
.vxe-table--context-menu-group-wrapper li.link--loading.link--active:hover, .vxe-table--context-menu-group-wrapper li.link--disabled.link--active:hover,
|
|
1754
1758
|
.vxe-table--context-menu-clild-wrapper li.link--loading.link--active:hover,
|
|
1755
1759
|
.vxe-table--context-menu-clild-wrapper li.link--disabled.link--active:hover {
|
|
1756
1760
|
background-color: inherit;
|