imm-element-ui 2.9.3 → 2.9.4
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.
|
@@ -8275,17 +8275,69 @@ class GridComponent {
|
|
|
8275
8275
|
this.ajustGridHeight();
|
|
8276
8276
|
}
|
|
8277
8277
|
handleDeletedRows(deletedRows) {
|
|
8278
|
-
|
|
8279
|
-
|
|
8278
|
+
let headerName = '';
|
|
8279
|
+
this.toOptions().columnDefs?.forEach((item) => {
|
|
8280
|
+
if (item.field == this.mainField) {
|
|
8281
|
+
headerName = item.headerName;
|
|
8282
|
+
}
|
|
8283
|
+
});
|
|
8284
|
+
const result = this.grid.api.applyTransaction({ remove: deletedRows });
|
|
8285
|
+
result?.remove.forEach((node) => {
|
|
8286
|
+
const rowIndex = node.sourceRowIndex ?? node.rowIndex;
|
|
8287
|
+
if (rowIndex == null) {
|
|
8288
|
+
return;
|
|
8289
|
+
}
|
|
8280
8290
|
this.upsert()?.subsert[this.subIndex]['maptmp'].delete(rowIndex);
|
|
8281
8291
|
this.upsert()?.subsert[this.subIndex]['logtmp'].delete(rowIndex + this.mainField);
|
|
8292
|
+
Array.from(this.upsert()?.subsert[this.subIndex]['maptmp']?.entries() || []).forEach(([key, value]) => {
|
|
8293
|
+
if (!value.id && key > rowIndex) {
|
|
8294
|
+
this.upsert()?.subsert[this.subIndex]['maptmp'].delete(key);
|
|
8295
|
+
}
|
|
8296
|
+
});
|
|
8297
|
+
Array.from(this.upsert()?.subsert[this.subIndex]['logtmp']?.entries() || []).forEach(([key, value]) => {
|
|
8298
|
+
const index = String(key).match(/^\d+/)?.[0];
|
|
8299
|
+
if (!value.id && index != null && Number(index) > rowIndex) {
|
|
8300
|
+
this.upsert()?.subsert[this.subIndex]['logtmp'].delete(key);
|
|
8301
|
+
}
|
|
8302
|
+
});
|
|
8303
|
+
});
|
|
8304
|
+
this.grid.api.forEachNode((node) => {
|
|
8305
|
+
const rowIndex = node.rowIndex;
|
|
8306
|
+
if (rowIndex == null || !node.data) {
|
|
8307
|
+
return;
|
|
8308
|
+
}
|
|
8309
|
+
if (!node.data.id) {
|
|
8310
|
+
this.upsert()?.subsert[this.subIndex]['maptmp'].set(rowIndex, node.data);
|
|
8311
|
+
this.upsert()?.subsert[this.subIndex]['logtmp'].set(rowIndex + this.mainField, {
|
|
8312
|
+
newValue: node.data[this.mainField],
|
|
8313
|
+
id: 0,
|
|
8314
|
+
label: headerName,
|
|
8315
|
+
});
|
|
8316
|
+
}
|
|
8317
|
+
else {
|
|
8318
|
+
Array.from(this.upsert()?.subsert[this.subIndex]['maptmp']?.entries() || []).forEach(([key, value]) => {
|
|
8319
|
+
if (value.id === node.data.id && key != rowIndex) {
|
|
8320
|
+
this.upsert()?.subsert[this.subIndex]['maptmp'].delete(key);
|
|
8321
|
+
this.upsert()?.subsert[this.subIndex]['maptmp'].set(rowIndex, value);
|
|
8322
|
+
}
|
|
8323
|
+
});
|
|
8324
|
+
Array.from(this.upsert()?.subsert[this.subIndex]['logtmp']?.entries() || []).forEach(([key, value]) => {
|
|
8325
|
+
if (value.id == node.data.id) {
|
|
8326
|
+
const index = String(key).match(/^\d+/)?.[0];
|
|
8327
|
+
if (index != null && Number(index) != rowIndex) {
|
|
8328
|
+
const newKey = String(key).replace(/^\d+/, `${rowIndex}`);
|
|
8329
|
+
this.upsert()?.subsert[this.subIndex]['logtmp'].delete(key);
|
|
8330
|
+
this.upsert()?.subsert[this.subIndex]['logtmp'].set(newKey, value);
|
|
8331
|
+
}
|
|
8332
|
+
}
|
|
8333
|
+
});
|
|
8334
|
+
}
|
|
8282
8335
|
});
|
|
8283
8336
|
let dt = [];
|
|
8284
8337
|
this.upsert()?.subsert[this.subIndex]['maptmp'].forEach((value, key) => {
|
|
8285
8338
|
dt.push(value);
|
|
8286
8339
|
});
|
|
8287
8340
|
this.upsert()['subsert'][this.subIndex]['subData'] = dt;
|
|
8288
|
-
this.grid.api.applyTransaction({ remove: deletedRows });
|
|
8289
8341
|
this.gridDataChanged.emit();
|
|
8290
8342
|
this.ajustGridHeight();
|
|
8291
8343
|
}
|