vxe-table 4.16.0-beta.8 → 4.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/grid/src/grid.js +1 -1
- package/es/locale/lang/en-US.js +12 -12
- package/es/style.css +1 -1
- package/es/table/module/edit/hook.js +55 -17
- package/es/table/src/emits.js +2 -0
- package/es/table/src/store.js +8 -0
- package/es/table/src/table.js +327 -36
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/lib/grid/src/grid.js +1 -1
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/index.umd.js +91 -34
- package/lib/index.umd.min.js +1 -1
- package/lib/locale/lang/en-US.js +12 -12
- package/lib/locale/lang/en-US.min.js +1 -1
- package/lib/locale/lang/en-US.umd.js +12 -12
- package/lib/style.css +1 -1
- package/lib/table/module/edit/hook.js +54 -15
- package/lib/table/module/edit/hook.min.js +1 -1
- package/lib/table/src/emits.js +1 -1
- package/lib/table/src/emits.min.js +1 -1
- package/lib/table/src/store.js +15 -0
- package/lib/table/src/store.min.js +1 -0
- package/lib/table/src/table.js +24 -15
- 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/grid/src/grid.ts +1 -1
- package/packages/locale/lang/en-US.ts +12 -12
- package/packages/table/module/edit/hook.ts +55 -19
- package/packages/table/src/emits.ts +2 -0
- package/packages/table/src/store.ts +14 -0
- package/packages/table/src/table.ts +330 -33
- /package/es/{iconfont.1755775667994.ttf → iconfont.1756272578850.ttf} +0 -0
- /package/es/{iconfont.1755775667994.woff → iconfont.1756272578850.woff} +0 -0
- /package/es/{iconfont.1755775667994.woff2 → iconfont.1756272578850.woff2} +0 -0
- /package/lib/{iconfont.1755775667994.ttf → iconfont.1756272578850.ttf} +0 -0
- /package/lib/{iconfont.1755775667994.woff → iconfont.1756272578850.woff} +0 -0
- /package/lib/{iconfont.1755775667994.woff2 → iconfont.1756272578850.woff2} +0 -0
|
@@ -98,14 +98,18 @@ hooks.add('tableEditModule', {
|
|
|
98
98
|
const handleInsertRowAt = (records, targetRow, isInsertNextRow) => {
|
|
99
99
|
const { treeConfig } = props;
|
|
100
100
|
const { isRowGroupStatus } = reactData;
|
|
101
|
-
const { tableFullTreeData, afterFullData, mergeBodyList, tableFullData, fullDataRowIdData, fullAllDataRowIdData, insertRowMaps } = internalData;
|
|
101
|
+
const { tableFullTreeData, afterFullData, mergeBodyList, tableFullData, fullDataRowIdData, fullAllDataRowIdData, insertRowMaps, removeRowMaps } = internalData;
|
|
102
102
|
const treeOpts = computeTreeOpts.value;
|
|
103
|
-
const { transform, rowField, mapChildrenField } = treeOpts;
|
|
103
|
+
const { transform, parentField, rowField, mapChildrenField } = treeOpts;
|
|
104
104
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
105
105
|
if (!XEUtils.isArray(records)) {
|
|
106
106
|
records = [records];
|
|
107
107
|
}
|
|
108
108
|
const newRecords = reactive($xeTable.defineField(records.map((record) => Object.assign(treeConfig && transform ? { [mapChildrenField]: [], [childrenField]: [] } : {}, record))));
|
|
109
|
+
let treeRecords = [];
|
|
110
|
+
if (treeConfig && transform) {
|
|
111
|
+
treeRecords = XEUtils.toArrayTree(newRecords, { key: rowField, parentKey: parentField, children: childrenField });
|
|
112
|
+
}
|
|
109
113
|
if (XEUtils.eqNull(targetRow)) {
|
|
110
114
|
// 如果为虚拟树
|
|
111
115
|
if (treeConfig && transform) {
|
|
@@ -171,25 +175,34 @@ hooks.add('tableEditModule', {
|
|
|
171
175
|
const parentMapChilds = parentRow ? parentRow[mapChildrenField] : tableFullTreeData;
|
|
172
176
|
const parentRest = fullAllDataRowIdData[getRowid($xeTable, parentRow)];
|
|
173
177
|
const parentLevel = parentRest ? parentRest.level : 0;
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
errLog('vxe.error.errProp', [`${
|
|
178
|
+
treeRecords.forEach((row, i) => {
|
|
179
|
+
if (parentRow) {
|
|
180
|
+
if (row[parentField] !== parentRow[rowField]) {
|
|
181
|
+
row[parentField] = parentRow[rowField];
|
|
182
|
+
errLog('vxe.error.errProp', [`${parentField}=${row[parentField]}`, `${parentField}=${parentRow[rowField]}`]);
|
|
179
183
|
}
|
|
180
184
|
}
|
|
181
|
-
|
|
182
|
-
|
|
185
|
+
else {
|
|
186
|
+
if (row[parentField] !== null) {
|
|
187
|
+
row[parentField] = null;
|
|
188
|
+
errLog('vxe.error.errProp', [`${parentField}=${row[parentField]}`, 'null']);
|
|
189
|
+
}
|
|
183
190
|
}
|
|
184
191
|
let targetIndex = matchMapObj.index + i;
|
|
185
192
|
if (isInsertNextRow) {
|
|
186
193
|
targetIndex = targetIndex + 1;
|
|
187
194
|
}
|
|
188
|
-
parentMapChilds.splice(targetIndex, 0,
|
|
195
|
+
parentMapChilds.splice(targetIndex, 0, row);
|
|
196
|
+
});
|
|
197
|
+
XEUtils.eachTree(treeRecords, (item) => {
|
|
198
|
+
const rowid = getRowid($xeTable, item);
|
|
189
199
|
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 };
|
|
200
|
+
if (item[childrenField]) {
|
|
201
|
+
item[mapChildrenField] = item[childrenField];
|
|
202
|
+
}
|
|
190
203
|
fullDataRowIdData[rowid] = rest;
|
|
191
204
|
fullAllDataRowIdData[rowid] = rest;
|
|
192
|
-
});
|
|
205
|
+
}, { children: childrenField });
|
|
193
206
|
// 源
|
|
194
207
|
if (parentRow) {
|
|
195
208
|
const matchObj = XEUtils.findTree(tableFullTreeData, item => targetRow[rowField] === item[rowField], { children: childrenField });
|
|
@@ -199,7 +212,7 @@ hooks.add('tableEditModule', {
|
|
|
199
212
|
if (isInsertNextRow) {
|
|
200
213
|
targetIndex = targetIndex + 1;
|
|
201
214
|
}
|
|
202
|
-
parentChilds.splice(targetIndex, 0, ...
|
|
215
|
+
parentChilds.splice(targetIndex, 0, ...treeRecords);
|
|
203
216
|
}
|
|
204
217
|
}
|
|
205
218
|
}
|
|
@@ -257,10 +270,27 @@ hooks.add('tableEditModule', {
|
|
|
257
270
|
}
|
|
258
271
|
}
|
|
259
272
|
}
|
|
260
|
-
|
|
273
|
+
const handleStatus = (newRow) => {
|
|
261
274
|
const rowid = getRowid($xeTable, newRow);
|
|
262
|
-
|
|
263
|
-
|
|
275
|
+
// 如果是被删除的数据,则还原状态
|
|
276
|
+
if (removeRowMaps[rowid]) {
|
|
277
|
+
delete removeRowMaps[rowid];
|
|
278
|
+
if (insertRowMaps[rowid]) {
|
|
279
|
+
delete insertRowMaps[rowid];
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
else {
|
|
283
|
+
insertRowMaps[rowid] = newRow;
|
|
284
|
+
}
|
|
285
|
+
};
|
|
286
|
+
// 如果为虚拟树
|
|
287
|
+
if (treeConfig && transform) {
|
|
288
|
+
XEUtils.eachTree(treeRecords, handleStatus, { children: mapChildrenField });
|
|
289
|
+
}
|
|
290
|
+
else {
|
|
291
|
+
newRecords.forEach(handleStatus);
|
|
292
|
+
}
|
|
293
|
+
reactData.removeRowFlag++;
|
|
264
294
|
reactData.insertRowFlag++;
|
|
265
295
|
$xeTable.cacheRowMap(false);
|
|
266
296
|
$xeTable.updateScrollYStatus();
|
|
@@ -736,7 +766,12 @@ hooks.add('tableEditModule', {
|
|
|
736
766
|
const { editStore } = reactData;
|
|
737
767
|
const { row, column } = editStore.actived;
|
|
738
768
|
if (column && row) {
|
|
739
|
-
return {
|
|
769
|
+
return {
|
|
770
|
+
row,
|
|
771
|
+
rowIndex: $xeTable.getRowIndex(row),
|
|
772
|
+
column,
|
|
773
|
+
columnIndex: $xeTable.getColumnIndex(column)
|
|
774
|
+
};
|
|
740
775
|
}
|
|
741
776
|
return null;
|
|
742
777
|
},
|
|
@@ -747,7 +782,10 @@ hooks.add('tableEditModule', {
|
|
|
747
782
|
const { editStore } = reactData;
|
|
748
783
|
const { row, column } = editStore.selected;
|
|
749
784
|
if (row && column) {
|
|
750
|
-
return {
|
|
785
|
+
return {
|
|
786
|
+
row,
|
|
787
|
+
column
|
|
788
|
+
};
|
|
751
789
|
}
|
|
752
790
|
return null;
|
|
753
791
|
},
|
package/es/table/src/emits.js
CHANGED