vxe-table 4.5.1 → 4.5.3
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/README.en.md +4 -4
- package/README.md +4 -4
- package/README.zh-TW.md +4 -4
- package/es/edit/src/hook.js +176 -136
- package/es/icon/style.css +1 -1
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/tools/log.js +1 -1
- package/es/v-x-e-table/index.js +1 -1
- package/es/v-x-e-table/src/renderer.js +2 -2
- package/lib/edit/src/hook.js +207 -158
- package/lib/edit/src/hook.min.js +1 -1
- package/lib/icon/style/style.css +1 -1
- package/lib/icon/style/style.min.css +1 -1
- package/lib/index.umd.js +221 -174
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/tools/log.js +1 -1
- package/lib/tools/log.min.js +1 -1
- package/lib/v-x-e-table/index.js +1 -1
- package/lib/v-x-e-table/index.min.js +1 -1
- package/lib/v-x-e-table/src/renderer.js +2 -2
- package/lib/v-x-e-table/src/renderer.min.js +1 -1
- package/package.json +2 -2
- package/packages/edit/src/hook.ts +170 -131
- package/packages/v-x-e-table/src/renderer.ts +2 -2
- package/types/edit.d.ts +9 -0
- package/types/modal.d.ts +1 -1
- /package/es/icon/style/{iconfont.1692232054714.ttf → iconfont.1692445281977.ttf} +0 -0
- /package/es/icon/style/{iconfont.1692232054714.woff → iconfont.1692445281977.woff} +0 -0
- /package/es/icon/style/{iconfont.1692232054714.woff2 → iconfont.1692445281977.woff2} +0 -0
- /package/es/{iconfont.1692232054714.ttf → iconfont.1692445281977.ttf} +0 -0
- /package/es/{iconfont.1692232054714.woff → iconfont.1692445281977.woff} +0 -0
- /package/es/{iconfont.1692232054714.woff2 → iconfont.1692445281977.woff2} +0 -0
- /package/lib/icon/style/{iconfont.1692232054714.ttf → iconfont.1692445281977.ttf} +0 -0
- /package/lib/icon/style/{iconfont.1692232054714.woff → iconfont.1692445281977.woff} +0 -0
- /package/lib/icon/style/{iconfont.1692232054714.woff2 → iconfont.1692445281977.woff2} +0 -0
- /package/lib/{iconfont.1692232054714.ttf → iconfont.1692445281977.ttf} +0 -0
- /package/lib/{iconfont.1692232054714.woff → iconfont.1692445281977.woff} +0 -0
- /package/lib/{iconfont.1692232054714.woff2 → iconfont.1692445281977.woff2} +0 -0
package/lib/index.umd.js
CHANGED
|
@@ -2277,7 +2277,7 @@ const GlobalConfig = {
|
|
|
2277
2277
|
;// CONCATENATED MODULE: ./packages/tools/log.ts
|
|
2278
2278
|
|
|
2279
2279
|
function getLog(message, params) {
|
|
2280
|
-
return `[vxe-table v${"4.5.
|
|
2280
|
+
return `[vxe-table v${"4.5.2"}] ${conf.i18n(message, params)}`;
|
|
2281
2281
|
}
|
|
2282
2282
|
function outLog(type) {
|
|
2283
2283
|
return function (message, params) {
|
|
@@ -3400,8 +3400,8 @@ function getComponentOns(renderOpts, params, modelFunc, changeFunc) {
|
|
|
3400
3400
|
external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().objectEach(events, (func, key) => {
|
|
3401
3401
|
ons[getOnName(key)] = function (...args) {
|
|
3402
3402
|
if (true) {
|
|
3403
|
-
if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(
|
|
3404
|
-
errLog('vxe.error.errFunc', [
|
|
3403
|
+
if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(func)) {
|
|
3404
|
+
errLog('vxe.error.errFunc', [func]);
|
|
3405
3405
|
}
|
|
3406
3406
|
}
|
|
3407
3407
|
func(params, ...args);
|
|
@@ -4271,7 +4271,7 @@ const config = new VXETableConfig();
|
|
|
4271
4271
|
const v = 'v4';
|
|
4272
4272
|
const VXETable = {
|
|
4273
4273
|
v,
|
|
4274
|
-
version: "4.5.
|
|
4274
|
+
version: "4.5.2",
|
|
4275
4275
|
setup: setup,
|
|
4276
4276
|
interceptor: interceptor,
|
|
4277
4277
|
renderer: renderer,
|
|
@@ -5627,10 +5627,15 @@ const editHook = {
|
|
|
5627
5627
|
const parentRest = fullAllDataRowIdData[getRowid($xetable, parentRow)];
|
|
5628
5628
|
const parentLevel = parentRest ? parentRest.level : 0;
|
|
5629
5629
|
let parentChilds = parentRow[childrenField];
|
|
5630
|
+
let mapChilds = parentRow[mapChildrenField];
|
|
5630
5631
|
if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(parentChilds)) {
|
|
5631
5632
|
parentChilds = parentRow[childrenField] = [];
|
|
5632
5633
|
}
|
|
5634
|
+
if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(mapChilds)) {
|
|
5635
|
+
mapChilds = parentRow[childrenField] = [];
|
|
5636
|
+
}
|
|
5633
5637
|
parentChilds[funcName](item);
|
|
5638
|
+
mapChilds[funcName](item);
|
|
5634
5639
|
const rest = {
|
|
5635
5640
|
row: item,
|
|
5636
5641
|
rowid,
|
|
@@ -5668,190 +5673,222 @@ const editHook = {
|
|
|
5668
5673
|
}
|
|
5669
5674
|
});
|
|
5670
5675
|
}
|
|
5671
|
-
|
|
5672
|
-
|
|
5673
|
-
|
|
5674
|
-
|
|
5675
|
-
|
|
5676
|
-
|
|
5677
|
-
|
|
5678
|
-
|
|
5679
|
-
|
|
5680
|
-
|
|
5681
|
-
|
|
5682
|
-
|
|
5683
|
-
|
|
5684
|
-
|
|
5685
|
-
|
|
5686
|
-
|
|
5687
|
-
|
|
5688
|
-
|
|
5689
|
-
|
|
5690
|
-
|
|
5691
|
-
|
|
5692
|
-
|
|
5693
|
-
|
|
5694
|
-
|
|
5695
|
-
|
|
5696
|
-
|
|
5697
|
-
|
|
5698
|
-
|
|
5699
|
-
|
|
5700
|
-
|
|
5701
|
-
|
|
5702
|
-
|
|
5703
|
-
|
|
5704
|
-
|
|
5705
|
-
|
|
5706
|
-
|
|
5707
|
-
|
|
5708
|
-
|
|
5709
|
-
|
|
5710
|
-
|
|
5676
|
+
const handleInsertRowAt = (records, row, isInsertNextRow) => {
|
|
5677
|
+
const {
|
|
5678
|
+
treeConfig
|
|
5679
|
+
} = props;
|
|
5680
|
+
const {
|
|
5681
|
+
mergeList,
|
|
5682
|
+
editStore
|
|
5683
|
+
} = reactData;
|
|
5684
|
+
const {
|
|
5685
|
+
tableFullTreeData,
|
|
5686
|
+
afterFullData,
|
|
5687
|
+
tableFullData,
|
|
5688
|
+
fullDataRowIdData,
|
|
5689
|
+
fullAllDataRowIdData
|
|
5690
|
+
} = internalData;
|
|
5691
|
+
const treeOpts = computeTreeOpts.value;
|
|
5692
|
+
const {
|
|
5693
|
+
transform,
|
|
5694
|
+
rowField,
|
|
5695
|
+
mapChildrenField
|
|
5696
|
+
} = treeOpts;
|
|
5697
|
+
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
5698
|
+
if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(records)) {
|
|
5699
|
+
records = [records];
|
|
5700
|
+
}
|
|
5701
|
+
const newRecords = $xetable.defineField(records.map(record => Object.assign(treeConfig && transform ? {
|
|
5702
|
+
[mapChildrenField]: [],
|
|
5703
|
+
[childrenField]: []
|
|
5704
|
+
} : {}, record)));
|
|
5705
|
+
if (!row) {
|
|
5706
|
+
// 如果为虚拟树
|
|
5707
|
+
if (treeConfig && transform) {
|
|
5708
|
+
insertTreeRow(newRecords, false);
|
|
5709
|
+
} else {
|
|
5710
|
+
afterFullData.unshift(...newRecords);
|
|
5711
|
+
tableFullData.unshift(...newRecords);
|
|
5712
|
+
// 刷新单元格合并
|
|
5713
|
+
mergeList.forEach(mergeItem => {
|
|
5714
|
+
const {
|
|
5715
|
+
row: mergeRowIndex
|
|
5716
|
+
} = mergeItem;
|
|
5717
|
+
if (mergeRowIndex > 0) {
|
|
5718
|
+
mergeItem.row = mergeRowIndex + newRecords.length;
|
|
5719
|
+
}
|
|
5720
|
+
});
|
|
5711
5721
|
}
|
|
5712
|
-
|
|
5713
|
-
if (
|
|
5722
|
+
} else {
|
|
5723
|
+
if (row === -1) {
|
|
5714
5724
|
// 如果为虚拟树
|
|
5715
5725
|
if (treeConfig && transform) {
|
|
5716
|
-
insertTreeRow(newRecords,
|
|
5726
|
+
insertTreeRow(newRecords, true);
|
|
5717
5727
|
} else {
|
|
5718
|
-
afterFullData.
|
|
5719
|
-
tableFullData.
|
|
5728
|
+
afterFullData.push(...newRecords);
|
|
5729
|
+
tableFullData.push(...newRecords);
|
|
5720
5730
|
// 刷新单元格合并
|
|
5721
5731
|
mergeList.forEach(mergeItem => {
|
|
5722
5732
|
const {
|
|
5723
|
-
row: mergeRowIndex
|
|
5733
|
+
row: mergeRowIndex,
|
|
5734
|
+
rowspan: mergeRowspan
|
|
5724
5735
|
} = mergeItem;
|
|
5725
|
-
if (mergeRowIndex >
|
|
5726
|
-
mergeItem.
|
|
5736
|
+
if (mergeRowIndex + mergeRowspan > afterFullData.length) {
|
|
5737
|
+
mergeItem.rowspan = mergeRowspan + newRecords.length;
|
|
5727
5738
|
}
|
|
5728
5739
|
});
|
|
5729
5740
|
}
|
|
5730
5741
|
} else {
|
|
5731
|
-
|
|
5732
|
-
|
|
5733
|
-
|
|
5734
|
-
|
|
5735
|
-
}
|
|
5736
|
-
|
|
5737
|
-
|
|
5738
|
-
|
|
5739
|
-
|
|
5740
|
-
|
|
5741
|
-
|
|
5742
|
-
|
|
5743
|
-
|
|
5744
|
-
|
|
5745
|
-
|
|
5746
|
-
|
|
5747
|
-
|
|
5748
|
-
|
|
5749
|
-
} else {
|
|
5750
|
-
// 如果为虚拟树
|
|
5751
|
-
if (treeConfig && transform) {
|
|
5752
|
-
const matchObj = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findTree(tableFullTreeData, item => row[rowField] === item[rowField], {
|
|
5753
|
-
children: mapChildrenField
|
|
5754
|
-
});
|
|
5755
|
-
if (matchObj) {
|
|
5756
|
-
const {
|
|
5757
|
-
parent: parentRow
|
|
5758
|
-
} = matchObj;
|
|
5759
|
-
const parentChilds = matchObj.items;
|
|
5760
|
-
const parentRest = fullAllDataRowIdData[getRowid($xetable, parentRow)];
|
|
5761
|
-
const parentLevel = parentRest ? parentRest.level : 0;
|
|
5762
|
-
newRecords.forEach((item, i) => {
|
|
5763
|
-
const rowid = getRowid($xetable, item);
|
|
5764
|
-
if (true) {
|
|
5765
|
-
if (item[treeOpts.parentField]) {
|
|
5766
|
-
if (parentRow && item[treeOpts.parentField] !== parentRow[rowField]) {
|
|
5767
|
-
errLog('vxe.error.errProp', [`${treeOpts.parentField}=${item[treeOpts.parentField]}`, `${treeOpts.parentField}=${parentRow[rowField]}`]);
|
|
5768
|
-
}
|
|
5742
|
+
// 如果为虚拟树
|
|
5743
|
+
if (treeConfig && transform) {
|
|
5744
|
+
const matchMapObj = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findTree(tableFullTreeData, item => row[rowField] === item[rowField], {
|
|
5745
|
+
children: mapChildrenField
|
|
5746
|
+
});
|
|
5747
|
+
if (matchMapObj) {
|
|
5748
|
+
const {
|
|
5749
|
+
parent: parentRow
|
|
5750
|
+
} = matchMapObj;
|
|
5751
|
+
const parentMapChilds = parentRow ? parentRow[mapChildrenField] : tableFullTreeData;
|
|
5752
|
+
const parentRest = fullAllDataRowIdData[getRowid($xetable, parentRow)];
|
|
5753
|
+
const parentLevel = parentRest ? parentRest.level : 0;
|
|
5754
|
+
newRecords.forEach((item, i) => {
|
|
5755
|
+
const rowid = getRowid($xetable, item);
|
|
5756
|
+
if (true) {
|
|
5757
|
+
if (item[treeOpts.parentField]) {
|
|
5758
|
+
if (parentRow && item[treeOpts.parentField] !== parentRow[rowField]) {
|
|
5759
|
+
errLog('vxe.error.errProp', [`${treeOpts.parentField}=${item[treeOpts.parentField]}`, `${treeOpts.parentField}=${parentRow[rowField]}`]);
|
|
5769
5760
|
}
|
|
5770
5761
|
}
|
|
5771
|
-
|
|
5772
|
-
|
|
5773
|
-
|
|
5774
|
-
|
|
5775
|
-
|
|
5776
|
-
|
|
5777
|
-
|
|
5778
|
-
|
|
5779
|
-
|
|
5780
|
-
|
|
5781
|
-
|
|
5782
|
-
|
|
5783
|
-
|
|
5784
|
-
|
|
5785
|
-
|
|
5786
|
-
|
|
5787
|
-
|
|
5762
|
+
}
|
|
5763
|
+
if (parentRow) {
|
|
5764
|
+
item[treeOpts.parentField] = parentRow[rowField];
|
|
5765
|
+
}
|
|
5766
|
+
let targetIndex = matchMapObj.index + i;
|
|
5767
|
+
if (isInsertNextRow) {
|
|
5768
|
+
targetIndex = targetIndex + 1;
|
|
5769
|
+
}
|
|
5770
|
+
parentMapChilds.splice(targetIndex, 0, item);
|
|
5771
|
+
const rest = {
|
|
5772
|
+
row: item,
|
|
5773
|
+
rowid,
|
|
5774
|
+
seq: -1,
|
|
5775
|
+
index: -1,
|
|
5776
|
+
_index: -1,
|
|
5777
|
+
$index: -1,
|
|
5778
|
+
items: parentMapChilds,
|
|
5779
|
+
parent: parentRow,
|
|
5780
|
+
level: parentLevel + 1
|
|
5781
|
+
};
|
|
5782
|
+
fullDataRowIdData[rowid] = rest;
|
|
5783
|
+
fullAllDataRowIdData[rowid] = rest;
|
|
5784
|
+
});
|
|
5785
|
+
// 源
|
|
5786
|
+
if (parentRow) {
|
|
5787
|
+
const matchObj = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findTree(tableFullTreeData, item => row[rowField] === item[rowField], {
|
|
5788
|
+
children: childrenField
|
|
5788
5789
|
});
|
|
5789
|
-
|
|
5790
|
-
|
|
5791
|
-
|
|
5790
|
+
if (matchObj) {
|
|
5791
|
+
const parentChilds = matchObj.items;
|
|
5792
|
+
let targetIndex = matchObj.index;
|
|
5793
|
+
if (isInsertNextRow) {
|
|
5794
|
+
targetIndex = targetIndex + 1;
|
|
5795
|
+
}
|
|
5796
|
+
parentChilds.splice(targetIndex, 0, ...newRecords);
|
|
5792
5797
|
}
|
|
5793
|
-
insertTreeRow(newRecords, true);
|
|
5794
5798
|
}
|
|
5795
5799
|
} else {
|
|
5796
|
-
if (
|
|
5797
|
-
|
|
5798
|
-
}
|
|
5799
|
-
let afIndex = -1;
|
|
5800
|
-
// 如果是可视索引
|
|
5801
|
-
if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(row)) {
|
|
5802
|
-
if (row < afterFullData.length) {
|
|
5803
|
-
afIndex = row;
|
|
5804
|
-
}
|
|
5805
|
-
} else {
|
|
5806
|
-
afIndex = $xetable.findRowIndexOf(afterFullData, row);
|
|
5800
|
+
if (true) {
|
|
5801
|
+
warnLog('vxe.error.unableInsert');
|
|
5807
5802
|
}
|
|
5808
|
-
|
|
5809
|
-
|
|
5803
|
+
insertTreeRow(newRecords, true);
|
|
5804
|
+
}
|
|
5805
|
+
} else {
|
|
5806
|
+
if (treeConfig) {
|
|
5807
|
+
throw new Error(getLog('vxe.error.noTree', ['insert']));
|
|
5808
|
+
}
|
|
5809
|
+
let afIndex = -1;
|
|
5810
|
+
// 如果是可视索引
|
|
5811
|
+
if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(row)) {
|
|
5812
|
+
if (row < afterFullData.length) {
|
|
5813
|
+
afIndex = row;
|
|
5810
5814
|
}
|
|
5811
|
-
|
|
5812
|
-
|
|
5813
|
-
|
|
5814
|
-
|
|
5815
|
-
|
|
5816
|
-
|
|
5817
|
-
|
|
5818
|
-
|
|
5819
|
-
|
|
5820
|
-
mergeItem.row = mergeRowIndex + newRecords.length;
|
|
5821
|
-
} else if (mergeRowIndex + mergeRowspan > afIndex) {
|
|
5822
|
-
mergeItem.rowspan = mergeRowspan + newRecords.length;
|
|
5823
|
-
}
|
|
5824
|
-
});
|
|
5815
|
+
} else {
|
|
5816
|
+
afIndex = $xetable.findRowIndexOf(afterFullData, row);
|
|
5817
|
+
}
|
|
5818
|
+
// 如果是插入指定行的下一行
|
|
5819
|
+
if (isInsertNextRow) {
|
|
5820
|
+
afIndex = Math.max(afterFullData.length, afIndex + 1);
|
|
5821
|
+
}
|
|
5822
|
+
if (afIndex === -1) {
|
|
5823
|
+
throw new Error(errLog('vxe.error.unableInsert'));
|
|
5825
5824
|
}
|
|
5825
|
+
afterFullData.splice(afIndex, 0, ...newRecords);
|
|
5826
|
+
tableFullData.splice($xetable.findRowIndexOf(tableFullData, row), 0, ...newRecords);
|
|
5827
|
+
// 刷新单元格合并
|
|
5828
|
+
mergeList.forEach(mergeItem => {
|
|
5829
|
+
const {
|
|
5830
|
+
row: mergeRowIndex,
|
|
5831
|
+
rowspan: mergeRowspan
|
|
5832
|
+
} = mergeItem;
|
|
5833
|
+
if (mergeRowIndex > afIndex) {
|
|
5834
|
+
mergeItem.row = mergeRowIndex + newRecords.length;
|
|
5835
|
+
} else if (mergeRowIndex + mergeRowspan > afIndex) {
|
|
5836
|
+
mergeItem.rowspan = mergeRowspan + newRecords.length;
|
|
5837
|
+
}
|
|
5838
|
+
});
|
|
5826
5839
|
}
|
|
5827
5840
|
}
|
|
5828
|
-
|
|
5829
|
-
|
|
5830
|
-
|
|
5831
|
-
|
|
5832
|
-
|
|
5833
|
-
|
|
5834
|
-
|
|
5835
|
-
|
|
5836
|
-
|
|
5837
|
-
|
|
5838
|
-
|
|
5839
|
-
|
|
5840
|
-
|
|
5841
|
-
|
|
5842
|
-
|
|
5843
|
-
|
|
5844
|
-
|
|
5845
|
-
|
|
5846
|
-
|
|
5847
|
-
|
|
5848
|
-
|
|
5849
|
-
|
|
5850
|
-
|
|
5851
|
-
|
|
5852
|
-
|
|
5853
|
-
|
|
5854
|
-
}
|
|
5841
|
+
}
|
|
5842
|
+
const {
|
|
5843
|
+
insertMaps
|
|
5844
|
+
} = editStore;
|
|
5845
|
+
newRecords.forEach(newRow => {
|
|
5846
|
+
const rowid = getRowid($xetable, newRow);
|
|
5847
|
+
insertMaps[rowid] = newRow;
|
|
5848
|
+
});
|
|
5849
|
+
$xetable.cacheRowMap();
|
|
5850
|
+
$xetable.updateScrollYStatus();
|
|
5851
|
+
$xetable.handleTableData(treeConfig && transform);
|
|
5852
|
+
if (!(treeConfig && transform)) {
|
|
5853
|
+
$xetable.updateAfterDataIndex();
|
|
5854
|
+
}
|
|
5855
|
+
$xetable.updateFooter();
|
|
5856
|
+
$xetable.checkSelectionStatus();
|
|
5857
|
+
if (reactData.scrollYLoad) {
|
|
5858
|
+
$xetable.updateScrollYSpace();
|
|
5859
|
+
}
|
|
5860
|
+
return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)().then(() => {
|
|
5861
|
+
$xetable.updateCellAreas();
|
|
5862
|
+
return $xetable.recalculate();
|
|
5863
|
+
}).then(() => {
|
|
5864
|
+
return {
|
|
5865
|
+
row: newRecords.length ? newRecords[newRecords.length - 1] : null,
|
|
5866
|
+
rows: newRecords
|
|
5867
|
+
};
|
|
5868
|
+
});
|
|
5869
|
+
};
|
|
5870
|
+
editMethods = {
|
|
5871
|
+
/**
|
|
5872
|
+
* 往表格中插入临时数据
|
|
5873
|
+
*
|
|
5874
|
+
* @param {*} records
|
|
5875
|
+
*/
|
|
5876
|
+
insert(records) {
|
|
5877
|
+
return handleInsertRowAt(records, null);
|
|
5878
|
+
},
|
|
5879
|
+
/**
|
|
5880
|
+
* 往表格指定行中插入临时数据
|
|
5881
|
+
* 如果 row 为空则从插入到顶部,如果为树结构,则插入到目标节点顶部
|
|
5882
|
+
* 如果 row 为 -1 则从插入到底部,如果为树结构,则插入到目标节点底部
|
|
5883
|
+
* 如果 row 为有效行则插入到该行的位置,如果为树结构,则有插入到效的目标节点该行的位置
|
|
5884
|
+
* @param {Object/Array} records 新的数据
|
|
5885
|
+
* @param {Row} row 指定行
|
|
5886
|
+
*/
|
|
5887
|
+
insertAt(records, row) {
|
|
5888
|
+
return handleInsertRowAt(records, row);
|
|
5889
|
+
},
|
|
5890
|
+
insertNextAt(records, row) {
|
|
5891
|
+
return handleInsertRowAt(records, row, true);
|
|
5855
5892
|
},
|
|
5856
5893
|
/**
|
|
5857
5894
|
* 删除指定行数据
|
|
@@ -5876,8 +5913,10 @@ const editHook = {
|
|
|
5876
5913
|
const checkboxOpts = computeCheckboxOpts.value;
|
|
5877
5914
|
const treeOpts = computeTreeOpts.value;
|
|
5878
5915
|
const {
|
|
5879
|
-
transform
|
|
5916
|
+
transform,
|
|
5917
|
+
mapChildrenField
|
|
5880
5918
|
} = treeOpts;
|
|
5919
|
+
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
5881
5920
|
const {
|
|
5882
5921
|
actived,
|
|
5883
5922
|
removeMaps,
|
|
@@ -5886,7 +5925,7 @@ const editHook = {
|
|
|
5886
5925
|
const {
|
|
5887
5926
|
checkField
|
|
5888
5927
|
} = checkboxOpts;
|
|
5889
|
-
let
|
|
5928
|
+
let delList = [];
|
|
5890
5929
|
if (!rows) {
|
|
5891
5930
|
rows = tableFullData;
|
|
5892
5931
|
} else if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(rows)) {
|
|
@@ -5914,7 +5953,7 @@ const editHook = {
|
|
|
5914
5953
|
}
|
|
5915
5954
|
// 从数据源中移除
|
|
5916
5955
|
if (tableFullData === rows) {
|
|
5917
|
-
rows =
|
|
5956
|
+
rows = delList = tableFullData.slice(0);
|
|
5918
5957
|
internalData.tableFullData = [];
|
|
5919
5958
|
internalData.afterFullData = [];
|
|
5920
5959
|
$xetable.clearMergeCells();
|
|
@@ -5923,10 +5962,18 @@ const editHook = {
|
|
|
5923
5962
|
if (treeConfig && transform) {
|
|
5924
5963
|
rows.forEach(row => {
|
|
5925
5964
|
const rowid = getRowid($xetable, row);
|
|
5926
|
-
const
|
|
5965
|
+
const matchMapObj = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findTree(tableFullTreeData, item => rowid === getRowid($xetable, item), {
|
|
5966
|
+
children: mapChildrenField
|
|
5967
|
+
});
|
|
5968
|
+
if (matchMapObj) {
|
|
5969
|
+
const rItems = matchMapObj.items.splice(matchMapObj.index, 1);
|
|
5970
|
+
delList.push(rItems[0]);
|
|
5971
|
+
}
|
|
5972
|
+
const matchObj = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findTree(tableFullTreeData, item => rowid === getRowid($xetable, item), {
|
|
5973
|
+
children: childrenField
|
|
5974
|
+
});
|
|
5927
5975
|
if (matchObj) {
|
|
5928
|
-
|
|
5929
|
-
rest.push(rItems[0]);
|
|
5976
|
+
matchObj.items.splice(matchObj.index, 1);
|
|
5930
5977
|
}
|
|
5931
5978
|
const afIndex = $xetable.findRowIndexOf(afterFullData, row);
|
|
5932
5979
|
if (afIndex > -1) {
|
|
@@ -5938,7 +5985,7 @@ const editHook = {
|
|
|
5938
5985
|
const tfIndex = $xetable.findRowIndexOf(tableFullData, row);
|
|
5939
5986
|
if (tfIndex > -1) {
|
|
5940
5987
|
const rItems = tableFullData.splice(tfIndex, 1);
|
|
5941
|
-
|
|
5988
|
+
delList.push(rItems[0]);
|
|
5942
5989
|
}
|
|
5943
5990
|
const afIndex = $xetable.findRowIndexOf(afterFullData, row);
|
|
5944
5991
|
if (afIndex > -1) {
|
|
@@ -5985,8 +6032,8 @@ const editHook = {
|
|
|
5985
6032
|
return $xetable.recalculate();
|
|
5986
6033
|
}).then(() => {
|
|
5987
6034
|
return {
|
|
5988
|
-
row:
|
|
5989
|
-
rows:
|
|
6035
|
+
row: delList.length ? delList[delList.length - 1] : null,
|
|
6036
|
+
rows: delList
|
|
5990
6037
|
};
|
|
5991
6038
|
});
|
|
5992
6039
|
},
|