vxe-table 3.7.0-beta.12 → 3.7.0-beta.13
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/lib/edit/src/mixin.js +252 -207
- package/lib/edit/src/mixin.min.js +1 -1
- package/lib/icon/style/style.css +1 -1
- package/lib/icon/style/style.min.css +1 -1
- package/lib/index.css +1 -1
- package/lib/index.umd.js +245 -199
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/table/src/methods.js +1 -1
- package/lib/table/src/methods.min.js +1 -1
- package/package.json +1 -1
- package/packages/edit/src/mixin.js +169 -134
- package/packages/table/src/methods.js +1 -1
- package/types/table.d.ts +9 -0
- /package/lib/icon/style/{iconfont.1692433325378.ttf → iconfont.1692439110338.ttf} +0 -0
- /package/lib/icon/style/{iconfont.1692433325378.woff → iconfont.1692439110338.woff} +0 -0
- /package/lib/icon/style/{iconfont.1692433325378.woff2 → iconfont.1692439110338.woff2} +0 -0
- /package/lib/{iconfont.1692433325378.ttf → iconfont.1692439110338.ttf} +0 -0
- /package/lib/{iconfont.1692433325378.woff → iconfont.1692439110338.woff} +0 -0
- /package/lib/{iconfont.1692433325378.woff2 → iconfont.1692439110338.woff2} +0 -0
package/lib/index.umd.js
CHANGED
|
@@ -21425,7 +21425,7 @@ var Methods = {
|
|
|
21425
21425
|
};
|
|
21426
21426
|
|
|
21427
21427
|
// Module methods
|
|
21428
|
-
var funcs = 'setFilter,openFilter,clearFilter,getCheckedFilters,closeMenu,setActiveCellArea,getActiveCellArea,getCellAreas,clearCellAreas,copyCellArea,cutCellArea,pasteCellArea,getCopyCellArea,getCopyCellAreas,clearCopyCellArea,setCellAreas,openFind,openReplace,closeFNR,getSelectedCell,clearSelected,insert,insertAt,remove,removeCheckboxRow,removeRadioRow,removeCurrentRow,getRecordset,getInsertRecords,getRemoveRecords,getUpdateRecords,clearEdit,clearActived,getEditRecord,getActiveRecord,isEditByRow,isActiveByRow,setEditRow,setActiveRow,setEditCell,setActiveCell,setSelectCell,clearValidate,fullValidate,validate,openExport,openPrint,exportData,openImport,importData,saveFile,readFile,importByFile,print'.split(',');
|
|
21428
|
+
var funcs = 'setFilter,openFilter,clearFilter,getCheckedFilters,closeMenu,setActiveCellArea,getActiveCellArea,getCellAreas,clearCellAreas,copyCellArea,cutCellArea,pasteCellArea,getCopyCellArea,getCopyCellAreas,clearCopyCellArea,setCellAreas,openFind,openReplace,closeFNR,getSelectedCell,clearSelected,insert,insertAt,insertNextAt,remove,removeCheckboxRow,removeRadioRow,removeCurrentRow,getRecordset,getInsertRecords,getRemoveRecords,getUpdateRecords,clearEdit,clearActived,getEditRecord,getActiveRecord,isEditByRow,isActiveByRow,setEditRow,setActiveRow,setEditCell,setActiveCell,setSelectCell,clearValidate,fullValidate,validate,openExport,openPrint,exportData,openImport,importData,saveFile,readFile,importByFile,print'.split(',');
|
|
21429
21429
|
funcs.forEach(function (name) {
|
|
21430
21430
|
Methods[name] = function () {
|
|
21431
21431
|
if (false) {}
|
|
@@ -23785,6 +23785,7 @@ var es_array_unshift = __webpack_require__(541);
|
|
|
23785
23785
|
|
|
23786
23786
|
|
|
23787
23787
|
|
|
23788
|
+
|
|
23788
23789
|
|
|
23789
23790
|
|
|
23790
23791
|
function insertTreeRow(_vm, newRecords, isAppend) {
|
|
@@ -23853,6 +23854,181 @@ function insertTreeRow(_vm, newRecords, isAppend) {
|
|
|
23853
23854
|
}
|
|
23854
23855
|
});
|
|
23855
23856
|
}
|
|
23857
|
+
function handleInsertRowAt(_vm, records, row, isInsertNextRow) {
|
|
23858
|
+
var tableFullTreeData = _vm.tableFullTreeData,
|
|
23859
|
+
mergeList = _vm.mergeList,
|
|
23860
|
+
afterFullData = _vm.afterFullData,
|
|
23861
|
+
editStore = _vm.editStore,
|
|
23862
|
+
tableFullData = _vm.tableFullData,
|
|
23863
|
+
treeConfig = _vm.treeConfig,
|
|
23864
|
+
fullDataRowIdData = _vm.fullDataRowIdData,
|
|
23865
|
+
fullAllDataRowIdData = _vm.fullAllDataRowIdData,
|
|
23866
|
+
treeOpts = _vm.treeOpts;
|
|
23867
|
+
var transform = treeOpts.transform,
|
|
23868
|
+
rowField = treeOpts.rowField,
|
|
23869
|
+
mapChildrenField = treeOpts.mapChildrenField;
|
|
23870
|
+
var childrenField = treeOpts.children || treeOpts.childrenField;
|
|
23871
|
+
if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(records)) {
|
|
23872
|
+
records = [records];
|
|
23873
|
+
}
|
|
23874
|
+
var newRecords = _vm.defineField(records.map(function (record) {
|
|
23875
|
+
var _ref;
|
|
23876
|
+
return Object.assign(treeConfig && transform ? (_ref = {}, _defineProperty(_ref, mapChildrenField, []), _defineProperty(_ref, childrenField, []), _ref) : {}, record);
|
|
23877
|
+
}));
|
|
23878
|
+
if (!row) {
|
|
23879
|
+
// 如果为虚拟树
|
|
23880
|
+
if (treeConfig && transform) {
|
|
23881
|
+
insertTreeRow(_vm, newRecords, false);
|
|
23882
|
+
} else {
|
|
23883
|
+
afterFullData.unshift.apply(afterFullData, _toConsumableArray(newRecords));
|
|
23884
|
+
tableFullData.unshift.apply(tableFullData, _toConsumableArray(newRecords));
|
|
23885
|
+
// 刷新单元格合并
|
|
23886
|
+
mergeList.forEach(function (mergeItem) {
|
|
23887
|
+
var mergeRowIndex = mergeItem.row;
|
|
23888
|
+
if (mergeRowIndex > 0) {
|
|
23889
|
+
mergeItem.row = mergeRowIndex + newRecords.length;
|
|
23890
|
+
}
|
|
23891
|
+
});
|
|
23892
|
+
}
|
|
23893
|
+
} else {
|
|
23894
|
+
if (row === -1) {
|
|
23895
|
+
// 如果为虚拟树
|
|
23896
|
+
if (treeConfig && transform) {
|
|
23897
|
+
insertTreeRow(_vm, newRecords, true);
|
|
23898
|
+
} else {
|
|
23899
|
+
afterFullData.push.apply(afterFullData, _toConsumableArray(newRecords));
|
|
23900
|
+
tableFullData.push.apply(tableFullData, _toConsumableArray(newRecords));
|
|
23901
|
+
// 刷新单元格合并
|
|
23902
|
+
mergeList.forEach(function (mergeItem) {
|
|
23903
|
+
var mergeRowIndex = mergeItem.row,
|
|
23904
|
+
mergeRowspan = mergeItem.rowspan;
|
|
23905
|
+
if (mergeRowIndex + mergeRowspan > afterFullData.length) {
|
|
23906
|
+
mergeItem.rowspan = mergeRowspan + newRecords.length;
|
|
23907
|
+
}
|
|
23908
|
+
});
|
|
23909
|
+
}
|
|
23910
|
+
} else {
|
|
23911
|
+
// 如果为虚拟树
|
|
23912
|
+
if (treeConfig && transform) {
|
|
23913
|
+
var matchMapObj = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findTree(tableFullTreeData, function (item) {
|
|
23914
|
+
return row[rowField] === item[rowField];
|
|
23915
|
+
}, {
|
|
23916
|
+
children: mapChildrenField
|
|
23917
|
+
});
|
|
23918
|
+
if (matchMapObj) {
|
|
23919
|
+
var parentRow = matchMapObj.parent;
|
|
23920
|
+
var parentMapChilds = parentRow ? parentRow[mapChildrenField] : tableFullTreeData;
|
|
23921
|
+
var parentRest = fullAllDataRowIdData[getRowid(_vm, parentRow)];
|
|
23922
|
+
var parentLevel = parentRest ? parentRest.level : 0;
|
|
23923
|
+
newRecords.forEach(function (item, i) {
|
|
23924
|
+
var rowid = getRowid(_vm, item);
|
|
23925
|
+
if (false) {}
|
|
23926
|
+
if (parentRow) {
|
|
23927
|
+
item[treeOpts.parentField] = parentRow[rowField];
|
|
23928
|
+
}
|
|
23929
|
+
var targetIndex = matchMapObj.index + i;
|
|
23930
|
+
if (isInsertNextRow) {
|
|
23931
|
+
targetIndex = targetIndex + 1;
|
|
23932
|
+
}
|
|
23933
|
+
parentMapChilds.splice(targetIndex, 0, item);
|
|
23934
|
+
var rest = {
|
|
23935
|
+
row: item,
|
|
23936
|
+
rowid: rowid,
|
|
23937
|
+
seq: -1,
|
|
23938
|
+
index: -1,
|
|
23939
|
+
_index: -1,
|
|
23940
|
+
$index: -1,
|
|
23941
|
+
items: parentMapChilds,
|
|
23942
|
+
parent: parentRow,
|
|
23943
|
+
level: parentLevel + 1
|
|
23944
|
+
};
|
|
23945
|
+
fullDataRowIdData[rowid] = rest;
|
|
23946
|
+
fullAllDataRowIdData[rowid] = rest;
|
|
23947
|
+
});
|
|
23948
|
+
|
|
23949
|
+
// 源
|
|
23950
|
+
if (parentRow) {
|
|
23951
|
+
var matchObj = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findTree(tableFullTreeData, function (item) {
|
|
23952
|
+
return row[rowField] === item[rowField];
|
|
23953
|
+
}, {
|
|
23954
|
+
children: childrenField
|
|
23955
|
+
});
|
|
23956
|
+
if (matchObj) {
|
|
23957
|
+
var parentChilds = matchObj.items;
|
|
23958
|
+
var targetIndex = matchObj.index;
|
|
23959
|
+
if (isInsertNextRow) {
|
|
23960
|
+
targetIndex = targetIndex + 1;
|
|
23961
|
+
}
|
|
23962
|
+
parentChilds.splice.apply(parentChilds, [targetIndex, 0].concat(_toConsumableArray(newRecords)));
|
|
23963
|
+
}
|
|
23964
|
+
}
|
|
23965
|
+
} else {
|
|
23966
|
+
if (false) {}
|
|
23967
|
+
insertTreeRow(_vm, newRecords, true);
|
|
23968
|
+
}
|
|
23969
|
+
} else {
|
|
23970
|
+
if (treeConfig) {
|
|
23971
|
+
throw new Error(getLog('vxe.error.noTree', ['insert']));
|
|
23972
|
+
}
|
|
23973
|
+
var afIndex = -1;
|
|
23974
|
+
// 如果是可视索引
|
|
23975
|
+
if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(row)) {
|
|
23976
|
+
if (row < afterFullData.length) {
|
|
23977
|
+
afIndex = row;
|
|
23978
|
+
}
|
|
23979
|
+
} else {
|
|
23980
|
+
afIndex = _vm.findRowIndexOf(afterFullData, row);
|
|
23981
|
+
}
|
|
23982
|
+
// 如果是插入指定行的下一行
|
|
23983
|
+
if (isInsertNextRow) {
|
|
23984
|
+
afIndex = Math.max(afterFullData.length, afIndex + 1);
|
|
23985
|
+
}
|
|
23986
|
+
if (afIndex === -1) {
|
|
23987
|
+
throw new Error(errLog('vxe.error.unableInsert'));
|
|
23988
|
+
}
|
|
23989
|
+
afterFullData.splice.apply(afterFullData, [afIndex, 0].concat(_toConsumableArray(newRecords)));
|
|
23990
|
+
tableFullData.splice.apply(tableFullData, [_vm.findRowIndexOf(tableFullData, row), 0].concat(_toConsumableArray(newRecords)));
|
|
23991
|
+
// 刷新单元格合并
|
|
23992
|
+
mergeList.forEach(function (mergeItem) {
|
|
23993
|
+
var mergeRowIndex = mergeItem.row,
|
|
23994
|
+
mergeRowspan = mergeItem.rowspan;
|
|
23995
|
+
if (mergeRowIndex > afIndex) {
|
|
23996
|
+
mergeItem.row = mergeRowIndex + newRecords.length;
|
|
23997
|
+
} else if (mergeRowIndex + mergeRowspan > afIndex) {
|
|
23998
|
+
mergeItem.rowspan = mergeRowspan + newRecords.length;
|
|
23999
|
+
}
|
|
24000
|
+
});
|
|
24001
|
+
}
|
|
24002
|
+
}
|
|
24003
|
+
}
|
|
24004
|
+
var insertList = editStore.insertList,
|
|
24005
|
+
insertMaps = editStore.insertMaps;
|
|
24006
|
+
newRecords.forEach(function (newRow) {
|
|
24007
|
+
var rowid = getRowid(_vm, newRow);
|
|
24008
|
+
insertMaps[rowid] = newRow;
|
|
24009
|
+
});
|
|
24010
|
+
insertList.unshift.apply(insertList, _toConsumableArray(newRecords));
|
|
24011
|
+
_vm.cacheRowMap();
|
|
24012
|
+
_vm.updateScrollYStatus();
|
|
24013
|
+
_vm.handleTableData(treeConfig && transform);
|
|
24014
|
+
if (!(treeConfig && transform)) {
|
|
24015
|
+
_vm.updateAfterDataIndex();
|
|
24016
|
+
}
|
|
24017
|
+
_vm.updateFooter();
|
|
24018
|
+
_vm.checkSelectionStatus();
|
|
24019
|
+
if (_vm.scrollYLoad) {
|
|
24020
|
+
_vm.updateScrollYSpace();
|
|
24021
|
+
}
|
|
24022
|
+
return _vm.$nextTick().then(function () {
|
|
24023
|
+
_vm.updateCellAreas();
|
|
24024
|
+
return _vm.recalculate();
|
|
24025
|
+
}).then(function () {
|
|
24026
|
+
return {
|
|
24027
|
+
row: newRecords.length ? newRecords[newRecords.length - 1] : null,
|
|
24028
|
+
rows: newRecords
|
|
24029
|
+
};
|
|
24030
|
+
});
|
|
24031
|
+
}
|
|
23856
24032
|
/* harmony default export */ const edit_src_mixin = ({
|
|
23857
24033
|
methods: {
|
|
23858
24034
|
/**
|
|
@@ -23861,7 +24037,7 @@ function insertTreeRow(_vm, newRecords, isAppend) {
|
|
|
23861
24037
|
* @param {*} records
|
|
23862
24038
|
*/
|
|
23863
24039
|
_insert: function _insert(records) {
|
|
23864
|
-
return this
|
|
24040
|
+
return handleInsertRowAt(this, records, null);
|
|
23865
24041
|
},
|
|
23866
24042
|
/**
|
|
23867
24043
|
* 往表格指定行中插入临时数据
|
|
@@ -23870,155 +24046,13 @@ function insertTreeRow(_vm, newRecords, isAppend) {
|
|
|
23870
24046
|
* 如果 row 为有效行则插入到该行的位置
|
|
23871
24047
|
* @param {Object/Array} records 新的数据
|
|
23872
24048
|
* @param {Row} row 指定行
|
|
24049
|
+
* @returns
|
|
23873
24050
|
*/
|
|
23874
24051
|
_insertAt: function _insertAt(records, row) {
|
|
23875
|
-
|
|
23876
|
-
|
|
23877
|
-
|
|
23878
|
-
|
|
23879
|
-
editStore = this.editStore,
|
|
23880
|
-
tableFullData = this.tableFullData,
|
|
23881
|
-
treeConfig = this.treeConfig,
|
|
23882
|
-
fullDataRowIdData = this.fullDataRowIdData,
|
|
23883
|
-
fullAllDataRowIdData = this.fullAllDataRowIdData,
|
|
23884
|
-
treeOpts = this.treeOpts;
|
|
23885
|
-
var transform = treeOpts.transform,
|
|
23886
|
-
rowField = treeOpts.rowField,
|
|
23887
|
-
mapChildrenField = treeOpts.mapChildrenField;
|
|
23888
|
-
if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(records)) {
|
|
23889
|
-
records = [records];
|
|
23890
|
-
}
|
|
23891
|
-
var newRecords = this.defineField(records.map(function (record) {
|
|
23892
|
-
return Object.assign({}, record);
|
|
23893
|
-
}));
|
|
23894
|
-
if (!row) {
|
|
23895
|
-
// 如果为虚拟树
|
|
23896
|
-
if (treeConfig && transform) {
|
|
23897
|
-
insertTreeRow(this, newRecords, false);
|
|
23898
|
-
} else {
|
|
23899
|
-
afterFullData.unshift.apply(afterFullData, _toConsumableArray(newRecords));
|
|
23900
|
-
tableFullData.unshift.apply(tableFullData, _toConsumableArray(newRecords));
|
|
23901
|
-
// 刷新单元格合并
|
|
23902
|
-
mergeList.forEach(function (mergeItem) {
|
|
23903
|
-
var mergeRowIndex = mergeItem.row;
|
|
23904
|
-
if (mergeRowIndex > 0) {
|
|
23905
|
-
mergeItem.row = mergeRowIndex + newRecords.length;
|
|
23906
|
-
}
|
|
23907
|
-
});
|
|
23908
|
-
}
|
|
23909
|
-
} else {
|
|
23910
|
-
if (row === -1) {
|
|
23911
|
-
// 如果为虚拟树
|
|
23912
|
-
if (treeConfig && transform) {
|
|
23913
|
-
insertTreeRow(this, newRecords, true);
|
|
23914
|
-
} else {
|
|
23915
|
-
afterFullData.push.apply(afterFullData, _toConsumableArray(newRecords));
|
|
23916
|
-
tableFullData.push.apply(tableFullData, _toConsumableArray(newRecords));
|
|
23917
|
-
// 刷新单元格合并
|
|
23918
|
-
mergeList.forEach(function (mergeItem) {
|
|
23919
|
-
var mergeRowIndex = mergeItem.row,
|
|
23920
|
-
mergeRowspan = mergeItem.rowspan;
|
|
23921
|
-
if (mergeRowIndex + mergeRowspan > afterFullData.length) {
|
|
23922
|
-
mergeItem.rowspan = mergeRowspan + newRecords.length;
|
|
23923
|
-
}
|
|
23924
|
-
});
|
|
23925
|
-
}
|
|
23926
|
-
} else {
|
|
23927
|
-
// 如果为虚拟树
|
|
23928
|
-
if (treeConfig && transform) {
|
|
23929
|
-
var matchObj = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findTree(tableFullTreeData, function (item) {
|
|
23930
|
-
return row[rowField] === item[rowField];
|
|
23931
|
-
}, {
|
|
23932
|
-
children: mapChildrenField
|
|
23933
|
-
});
|
|
23934
|
-
if (matchObj) {
|
|
23935
|
-
var parentRow = matchObj.parent;
|
|
23936
|
-
var parentChilds = matchObj.items;
|
|
23937
|
-
var parentRest = fullAllDataRowIdData[getRowid(this, parentRow)];
|
|
23938
|
-
var parentLevel = parentRest ? parentRest.level : 0;
|
|
23939
|
-
newRecords.forEach(function (item, i) {
|
|
23940
|
-
var rowid = getRowid(_this, item);
|
|
23941
|
-
if (false) {}
|
|
23942
|
-
if (parentRow) {
|
|
23943
|
-
item[treeOpts.parentField] = parentRow[rowField];
|
|
23944
|
-
}
|
|
23945
|
-
parentChilds.splice(matchObj.index + i, 0, item);
|
|
23946
|
-
var rest = {
|
|
23947
|
-
row: item,
|
|
23948
|
-
rowid: rowid,
|
|
23949
|
-
seq: -1,
|
|
23950
|
-
index: -1,
|
|
23951
|
-
_index: -1,
|
|
23952
|
-
$index: -1,
|
|
23953
|
-
items: parentChilds,
|
|
23954
|
-
parent: parentRow,
|
|
23955
|
-
level: parentLevel + 1
|
|
23956
|
-
};
|
|
23957
|
-
fullDataRowIdData[rowid] = rest;
|
|
23958
|
-
fullAllDataRowIdData[rowid] = rest;
|
|
23959
|
-
});
|
|
23960
|
-
} else {
|
|
23961
|
-
if (false) {}
|
|
23962
|
-
insertTreeRow(this, newRecords, true);
|
|
23963
|
-
}
|
|
23964
|
-
} else {
|
|
23965
|
-
if (treeConfig) {
|
|
23966
|
-
throw new Error(getLog('vxe.error.noTree', ['insert']));
|
|
23967
|
-
}
|
|
23968
|
-
var afIndex = -1;
|
|
23969
|
-
// 如果是可视索引
|
|
23970
|
-
if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(row)) {
|
|
23971
|
-
if (row < afterFullData.length) {
|
|
23972
|
-
afIndex = row;
|
|
23973
|
-
}
|
|
23974
|
-
} else {
|
|
23975
|
-
afIndex = this.findRowIndexOf(afterFullData, row);
|
|
23976
|
-
}
|
|
23977
|
-
if (afIndex === -1) {
|
|
23978
|
-
throw new Error(errLog('vxe.error.unableInsert'));
|
|
23979
|
-
}
|
|
23980
|
-
afterFullData.splice.apply(afterFullData, [afIndex, 0].concat(_toConsumableArray(newRecords)));
|
|
23981
|
-
tableFullData.splice.apply(tableFullData, [this.findRowIndexOf(tableFullData, row), 0].concat(_toConsumableArray(newRecords)));
|
|
23982
|
-
// 刷新单元格合并
|
|
23983
|
-
mergeList.forEach(function (mergeItem) {
|
|
23984
|
-
var mergeRowIndex = mergeItem.row,
|
|
23985
|
-
mergeRowspan = mergeItem.rowspan;
|
|
23986
|
-
if (mergeRowIndex > afIndex) {
|
|
23987
|
-
mergeItem.row = mergeRowIndex + newRecords.length;
|
|
23988
|
-
} else if (mergeRowIndex + mergeRowspan > afIndex) {
|
|
23989
|
-
mergeItem.rowspan = mergeRowspan + newRecords.length;
|
|
23990
|
-
}
|
|
23991
|
-
});
|
|
23992
|
-
}
|
|
23993
|
-
}
|
|
23994
|
-
}
|
|
23995
|
-
var insertList = editStore.insertList,
|
|
23996
|
-
insertMaps = editStore.insertMaps;
|
|
23997
|
-
newRecords.forEach(function (newRow) {
|
|
23998
|
-
var rowid = getRowid(_this, newRow);
|
|
23999
|
-
insertMaps[rowid] = newRow;
|
|
24000
|
-
});
|
|
24001
|
-
insertList.unshift.apply(insertList, _toConsumableArray(newRecords));
|
|
24002
|
-
this.cacheRowMap();
|
|
24003
|
-
this.updateScrollYStatus();
|
|
24004
|
-
this.handleTableData(treeConfig && transform);
|
|
24005
|
-
if (!(treeConfig && transform)) {
|
|
24006
|
-
this.updateAfterDataIndex();
|
|
24007
|
-
}
|
|
24008
|
-
this.updateFooter();
|
|
24009
|
-
this.checkSelectionStatus();
|
|
24010
|
-
if (this.scrollYLoad) {
|
|
24011
|
-
this.updateScrollYSpace();
|
|
24012
|
-
}
|
|
24013
|
-
return this.$nextTick().then(function () {
|
|
24014
|
-
_this.updateCellAreas();
|
|
24015
|
-
return _this.recalculate();
|
|
24016
|
-
}).then(function () {
|
|
24017
|
-
return {
|
|
24018
|
-
row: newRecords.length ? newRecords[newRecords.length - 1] : null,
|
|
24019
|
-
rows: newRecords
|
|
24020
|
-
};
|
|
24021
|
-
});
|
|
24052
|
+
return handleInsertRowAt(this, records, row);
|
|
24053
|
+
},
|
|
24054
|
+
_insertNextAt: function _insertNextAt(records, row) {
|
|
24055
|
+
return handleInsertRowAt(this, records, row, true);
|
|
24022
24056
|
},
|
|
24023
24057
|
/**
|
|
24024
24058
|
* 删除指定行数据
|
|
@@ -24027,7 +24061,7 @@ function insertTreeRow(_vm, newRecords, isAppend) {
|
|
|
24027
24061
|
* 如果为空则删除所有
|
|
24028
24062
|
*/
|
|
24029
24063
|
_remove: function _remove(rows) {
|
|
24030
|
-
var
|
|
24064
|
+
var _this = this;
|
|
24031
24065
|
var afterFullData = this.afterFullData,
|
|
24032
24066
|
tableFullData = this.tableFullData,
|
|
24033
24067
|
tableFullTreeData = this.tableFullTreeData,
|
|
@@ -24038,13 +24072,15 @@ function insertTreeRow(_vm, newRecords, isAppend) {
|
|
|
24038
24072
|
selectCheckboxRows = this.selectCheckboxRows,
|
|
24039
24073
|
isInsertByRow = this.isInsertByRow,
|
|
24040
24074
|
treeOpts = this.treeOpts;
|
|
24041
|
-
var transform = treeOpts.transform
|
|
24075
|
+
var transform = treeOpts.transform,
|
|
24076
|
+
mapChildrenField = treeOpts.mapChildrenField;
|
|
24077
|
+
var childrenField = treeOpts.children || treeOpts.childrenField;
|
|
24042
24078
|
var actived = editStore.actived,
|
|
24043
24079
|
removeList = editStore.removeList,
|
|
24044
24080
|
insertList = editStore.insertList,
|
|
24045
24081
|
insertMaps = editStore.insertMaps;
|
|
24046
24082
|
var checkField = checkboxOpts.checkField;
|
|
24047
|
-
var
|
|
24083
|
+
var delList = [];
|
|
24048
24084
|
if (!rows) {
|
|
24049
24085
|
rows = tableFullData;
|
|
24050
24086
|
} else if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(rows)) {
|
|
@@ -24059,7 +24095,7 @@ function insertTreeRow(_vm, newRecords, isAppend) {
|
|
|
24059
24095
|
// 如果绑定了多选属性,则更新状态
|
|
24060
24096
|
if (!checkField) {
|
|
24061
24097
|
rows.forEach(function (row) {
|
|
24062
|
-
var sIndex =
|
|
24098
|
+
var sIndex = _this.findRowIndexOf(selectCheckboxRows, row);
|
|
24063
24099
|
if (sIndex > -1) {
|
|
24064
24100
|
selectCheckboxRows.splice(sIndex, 1);
|
|
24065
24101
|
}
|
|
@@ -24067,7 +24103,7 @@ function insertTreeRow(_vm, newRecords, isAppend) {
|
|
|
24067
24103
|
}
|
|
24068
24104
|
// 从数据源中移除
|
|
24069
24105
|
if (tableFullData === rows) {
|
|
24070
|
-
rows =
|
|
24106
|
+
rows = delList = tableFullData.slice(0);
|
|
24071
24107
|
this.tableFullData = [];
|
|
24072
24108
|
this.afterFullData = [];
|
|
24073
24109
|
this.clearMergeCells();
|
|
@@ -24075,27 +24111,37 @@ function insertTreeRow(_vm, newRecords, isAppend) {
|
|
|
24075
24111
|
// 如果为虚拟树
|
|
24076
24112
|
if (treeConfig && transform) {
|
|
24077
24113
|
rows.forEach(function (row) {
|
|
24078
|
-
var rowid = getRowid(
|
|
24114
|
+
var rowid = getRowid(_this, row);
|
|
24115
|
+
var matchMapObj = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findTree(tableFullTreeData, function (item) {
|
|
24116
|
+
return rowid === getRowid(_this, item);
|
|
24117
|
+
}, {
|
|
24118
|
+
children: mapChildrenField
|
|
24119
|
+
});
|
|
24120
|
+
if (matchMapObj) {
|
|
24121
|
+
var rItems = matchMapObj.items.splice(matchMapObj.index, 1);
|
|
24122
|
+
delList.push(rItems[0]);
|
|
24123
|
+
}
|
|
24079
24124
|
var matchObj = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findTree(tableFullTreeData, function (item) {
|
|
24080
|
-
return rowid === getRowid(
|
|
24081
|
-
},
|
|
24125
|
+
return rowid === getRowid(_this, item);
|
|
24126
|
+
}, {
|
|
24127
|
+
children: childrenField
|
|
24128
|
+
});
|
|
24082
24129
|
if (matchObj) {
|
|
24083
|
-
|
|
24084
|
-
rest.push(rItems[0]);
|
|
24130
|
+
matchObj.items.splice(matchObj.index, 1);
|
|
24085
24131
|
}
|
|
24086
|
-
var afIndex =
|
|
24132
|
+
var afIndex = _this.findRowIndexOf(afterFullData, row);
|
|
24087
24133
|
if (afIndex > -1) {
|
|
24088
24134
|
afterFullData.splice(afIndex, 1);
|
|
24089
24135
|
}
|
|
24090
24136
|
});
|
|
24091
24137
|
} else {
|
|
24092
24138
|
rows.forEach(function (row) {
|
|
24093
|
-
var tfIndex =
|
|
24139
|
+
var tfIndex = _this.findRowIndexOf(tableFullData, row);
|
|
24094
24140
|
if (tfIndex > -1) {
|
|
24095
24141
|
var rItems = tableFullData.splice(tfIndex, 1);
|
|
24096
|
-
|
|
24142
|
+
delList.push(rItems[0]);
|
|
24097
24143
|
}
|
|
24098
|
-
var afIndex =
|
|
24144
|
+
var afIndex = _this.findRowIndexOf(afterFullData, row);
|
|
24099
24145
|
if (afIndex > -1) {
|
|
24100
24146
|
// 刷新单元格合并
|
|
24101
24147
|
mergeList.forEach(function (mergeItem) {
|
|
@@ -24118,8 +24164,8 @@ function insertTreeRow(_vm, newRecords, isAppend) {
|
|
|
24118
24164
|
}
|
|
24119
24165
|
// 从新增中移除已删除的数据
|
|
24120
24166
|
rows.forEach(function (row) {
|
|
24121
|
-
var rowid = getRowid(
|
|
24122
|
-
var iIndex =
|
|
24167
|
+
var rowid = getRowid(_this, row);
|
|
24168
|
+
var iIndex = _this.findRowIndexOf(insertList, row);
|
|
24123
24169
|
if (iIndex > -1) {
|
|
24124
24170
|
insertList.splice(iIndex, 1);
|
|
24125
24171
|
}
|
|
@@ -24136,12 +24182,12 @@ function insertTreeRow(_vm, newRecords, isAppend) {
|
|
|
24136
24182
|
this.updateScrollYSpace();
|
|
24137
24183
|
}
|
|
24138
24184
|
return this.$nextTick().then(function () {
|
|
24139
|
-
|
|
24140
|
-
return
|
|
24185
|
+
_this.updateCellAreas();
|
|
24186
|
+
return _this.recalculate();
|
|
24141
24187
|
}).then(function () {
|
|
24142
24188
|
return {
|
|
24143
|
-
row:
|
|
24144
|
-
rows:
|
|
24189
|
+
row: delList.length ? delList[delList.length - 1] : null,
|
|
24190
|
+
rows: delList
|
|
24145
24191
|
};
|
|
24146
24192
|
});
|
|
24147
24193
|
},
|
|
@@ -24149,9 +24195,9 @@ function insertTreeRow(_vm, newRecords, isAppend) {
|
|
|
24149
24195
|
* 删除复选框选中的数据
|
|
24150
24196
|
*/
|
|
24151
24197
|
_removeCheckboxRow: function _removeCheckboxRow() {
|
|
24152
|
-
var
|
|
24198
|
+
var _this2 = this;
|
|
24153
24199
|
return this.remove(this.getCheckboxRecords()).then(function (params) {
|
|
24154
|
-
|
|
24200
|
+
_this2.clearCheckboxRow();
|
|
24155
24201
|
return params;
|
|
24156
24202
|
});
|
|
24157
24203
|
},
|
|
@@ -24159,10 +24205,10 @@ function insertTreeRow(_vm, newRecords, isAppend) {
|
|
|
24159
24205
|
* 删除单选框选中的数据
|
|
24160
24206
|
*/
|
|
24161
24207
|
_removeRadioRow: function _removeRadioRow() {
|
|
24162
|
-
var
|
|
24208
|
+
var _this3 = this;
|
|
24163
24209
|
var radioRecord = this.getRadioRecord();
|
|
24164
24210
|
return this.remove(radioRecord || []).then(function (params) {
|
|
24165
|
-
|
|
24211
|
+
_this3.clearRadioRow();
|
|
24166
24212
|
return params;
|
|
24167
24213
|
});
|
|
24168
24214
|
},
|
|
@@ -24170,10 +24216,10 @@ function insertTreeRow(_vm, newRecords, isAppend) {
|
|
|
24170
24216
|
* 删除当前行选中的数据
|
|
24171
24217
|
*/
|
|
24172
24218
|
_removeCurrentRow: function _removeCurrentRow() {
|
|
24173
|
-
var
|
|
24219
|
+
var _this4 = this;
|
|
24174
24220
|
var currentRecord = this.getCurrentRecord();
|
|
24175
24221
|
return this.remove(currentRecord || []).then(function (params) {
|
|
24176
|
-
|
|
24222
|
+
_this4.clearCurrentRow();
|
|
24177
24223
|
return params;
|
|
24178
24224
|
});
|
|
24179
24225
|
},
|
|
@@ -24191,12 +24237,12 @@ function insertTreeRow(_vm, newRecords, isAppend) {
|
|
|
24191
24237
|
* 获取新增的临时数据
|
|
24192
24238
|
*/
|
|
24193
24239
|
_getInsertRecords: function _getInsertRecords() {
|
|
24194
|
-
var
|
|
24240
|
+
var _this5 = this;
|
|
24195
24241
|
var fullAllDataRowIdData = this.fullAllDataRowIdData;
|
|
24196
24242
|
var insertList = this.editStore.insertList;
|
|
24197
24243
|
var insertRecords = [];
|
|
24198
24244
|
insertList.forEach(function (row) {
|
|
24199
|
-
var rowid = getRowid(
|
|
24245
|
+
var rowid = getRowid(_this5, row);
|
|
24200
24246
|
if (fullAllDataRowIdData[rowid]) {
|
|
24201
24247
|
insertRecords.push(row);
|
|
24202
24248
|
}
|
|
@@ -24243,7 +24289,7 @@ function insertTreeRow(_vm, newRecords, isAppend) {
|
|
|
24243
24289
|
* 处理激活编辑
|
|
24244
24290
|
*/
|
|
24245
24291
|
handleActived: function handleActived(params, evnt) {
|
|
24246
|
-
var
|
|
24292
|
+
var _this6 = this;
|
|
24247
24293
|
var editStore = this.editStore,
|
|
24248
24294
|
editOpts = this.editOpts,
|
|
24249
24295
|
tableColumn = this.tableColumn,
|
|
@@ -24279,13 +24325,13 @@ function insertTreeRow(_vm, newRecords, isAppend) {
|
|
|
24279
24325
|
actived.column = column;
|
|
24280
24326
|
if (mode === 'row') {
|
|
24281
24327
|
tableColumn.forEach(function (column) {
|
|
24282
|
-
return
|
|
24328
|
+
return _this6._getColumnModel(row, column);
|
|
24283
24329
|
});
|
|
24284
24330
|
} else {
|
|
24285
24331
|
this._getColumnModel(row, column);
|
|
24286
24332
|
}
|
|
24287
24333
|
this.$nextTick(function () {
|
|
24288
|
-
|
|
24334
|
+
_this6.handleFocus(params, evnt);
|
|
24289
24335
|
});
|
|
24290
24336
|
}
|
|
24291
24337
|
this.emitEvent(type, {
|
|
@@ -24314,7 +24360,7 @@ function insertTreeRow(_vm, newRecords, isAppend) {
|
|
|
24314
24360
|
actived.args = params;
|
|
24315
24361
|
actived.column = column;
|
|
24316
24362
|
setTimeout(function () {
|
|
24317
|
-
|
|
24363
|
+
_this6.handleFocus(params, evnt);
|
|
24318
24364
|
});
|
|
24319
24365
|
}
|
|
24320
24366
|
this.focus();
|
|
@@ -24339,7 +24385,7 @@ function insertTreeRow(_vm, newRecords, isAppend) {
|
|
|
24339
24385
|
}
|
|
24340
24386
|
},
|
|
24341
24387
|
_syncActivedCell: function _syncActivedCell() {
|
|
24342
|
-
var
|
|
24388
|
+
var _this7 = this;
|
|
24343
24389
|
var tableColumn = this.tableColumn,
|
|
24344
24390
|
editStore = this.editStore,
|
|
24345
24391
|
editOpts = this.editOpts;
|
|
@@ -24349,7 +24395,7 @@ function insertTreeRow(_vm, newRecords, isAppend) {
|
|
|
24349
24395
|
if (row || column) {
|
|
24350
24396
|
if (editOpts.mode === 'row') {
|
|
24351
24397
|
tableColumn.forEach(function (column) {
|
|
24352
|
-
return
|
|
24398
|
+
return _this7._setColumnModel(row, column);
|
|
24353
24399
|
});
|
|
24354
24400
|
} else {
|
|
24355
24401
|
this._setColumnModel(row, column);
|
|
@@ -24492,22 +24538,22 @@ function insertTreeRow(_vm, newRecords, isAppend) {
|
|
|
24492
24538
|
* 激活单元格编辑
|
|
24493
24539
|
*/
|
|
24494
24540
|
_setEditCell: function _setEditCell(row, fieldOrColumn) {
|
|
24495
|
-
var
|
|
24541
|
+
var _this8 = this;
|
|
24496
24542
|
var editConfig = this.editConfig;
|
|
24497
24543
|
var column = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(fieldOrColumn) ? this.getColumnByField(fieldOrColumn) : fieldOrColumn;
|
|
24498
24544
|
if (row && column && isEnableConf(editConfig) && isEnableConf(column.editRender)) {
|
|
24499
24545
|
return this.scrollToRow(row, true).then(function () {
|
|
24500
|
-
var cell =
|
|
24546
|
+
var cell = _this8.getCell(row, column);
|
|
24501
24547
|
if (cell) {
|
|
24502
|
-
|
|
24548
|
+
_this8.handleActived({
|
|
24503
24549
|
row: row,
|
|
24504
|
-
rowIndex:
|
|
24550
|
+
rowIndex: _this8.getRowIndex(row),
|
|
24505
24551
|
column: column,
|
|
24506
|
-
columnIndex:
|
|
24552
|
+
columnIndex: _this8.getColumnIndex(column),
|
|
24507
24553
|
cell: cell,
|
|
24508
|
-
$table:
|
|
24554
|
+
$table: _this8
|
|
24509
24555
|
});
|
|
24510
|
-
|
|
24556
|
+
_this8.lastCallTime = Date.now();
|
|
24511
24557
|
}
|
|
24512
24558
|
});
|
|
24513
24559
|
}
|
|
@@ -24541,7 +24587,7 @@ function insertTreeRow(_vm, newRecords, isAppend) {
|
|
|
24541
24587
|
* 处理选中源
|
|
24542
24588
|
*/
|
|
24543
24589
|
handleSelected: function handleSelected(params, evnt) {
|
|
24544
|
-
var
|
|
24590
|
+
var _this9 = this;
|
|
24545
24591
|
var mouseConfig = this.mouseConfig,
|
|
24546
24592
|
mouseOpts = this.mouseOpts,
|
|
24547
24593
|
editOpts = this.editOpts,
|
|
@@ -24554,23 +24600,23 @@ function insertTreeRow(_vm, newRecords, isAppend) {
|
|
|
24554
24600
|
var selectMethod = function selectMethod() {
|
|
24555
24601
|
if (isMouseSelected && (selected.row !== row || selected.column !== column)) {
|
|
24556
24602
|
if (actived.row !== row || (editOpts.mode === 'cell' ? actived.column !== column : false)) {
|
|
24557
|
-
|
|
24558
|
-
|
|
24559
|
-
|
|
24560
|
-
|
|
24603
|
+
_this9.clearActived(evnt);
|
|
24604
|
+
_this9.clearSelected(evnt);
|
|
24605
|
+
_this9.clearCellAreas(evnt);
|
|
24606
|
+
_this9.clearCopyCellArea(evnt);
|
|
24561
24607
|
selected.args = params;
|
|
24562
24608
|
selected.row = row;
|
|
24563
24609
|
selected.column = column;
|
|
24564
24610
|
if (isMouseSelected) {
|
|
24565
|
-
|
|
24611
|
+
_this9.addColSdCls();
|
|
24566
24612
|
}
|
|
24567
|
-
|
|
24613
|
+
_this9.focus();
|
|
24568
24614
|
if (evnt) {
|
|
24569
|
-
|
|
24615
|
+
_this9.emitEvent('cell-selected', params, evnt);
|
|
24570
24616
|
}
|
|
24571
24617
|
}
|
|
24572
24618
|
}
|
|
24573
|
-
return
|
|
24619
|
+
return _this9.$nextTick();
|
|
24574
24620
|
};
|
|
24575
24621
|
return selectMethod();
|
|
24576
24622
|
},
|