@openg2p/registry-widgets 1.1.6-dev.5 → 1.1.6-dev.6
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/dist/components/SectionRenderer/utils/diffSectionChangeRecords.d.ts.map +1 -1
- package/dist/components/SectionRenderer/utils/sectionSnapshot.d.ts.map +1 -1
- package/dist/index.esm.js +19 -17
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +19 -17
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2857,14 +2857,10 @@ const buildSectionRecords = (widgets, sourceData, { sectionRegisterId, editActio
|
|
|
2857
2857
|
: fullPath;
|
|
2858
2858
|
cleanedSnapshot[fieldPath] = value;
|
|
2859
2859
|
});
|
|
2860
|
-
const sectionData = sectionRegisterId
|
|
2861
|
-
? sourceData[sectionRegisterId] ?? {}
|
|
2862
|
-
: {};
|
|
2863
2860
|
const includeEditAction = editAction === 'always' ||
|
|
2864
2861
|
(editAction === 'when-register-id' && sectionRegisterId);
|
|
2865
2862
|
return [
|
|
2866
2863
|
{
|
|
2867
|
-
...sectionData,
|
|
2868
2864
|
...cleanedSnapshot,
|
|
2869
2865
|
...(includeEditAction ? { edit_action: 'UPDATE' } : {}),
|
|
2870
2866
|
},
|
|
@@ -2994,32 +2990,38 @@ const diffTableRows = (baselineRecords, currentRecords) => {
|
|
|
2994
2990
|
const baselineById = new Map();
|
|
2995
2991
|
for (const row of baselineRows) {
|
|
2996
2992
|
const id = getRowId(row);
|
|
2997
|
-
if (id)
|
|
2993
|
+
if (id) {
|
|
2998
2994
|
baselineById.set(id, row);
|
|
2995
|
+
}
|
|
2999
2996
|
}
|
|
3000
2997
|
const result = [];
|
|
3001
|
-
currentRows.forEach((row
|
|
2998
|
+
currentRows.forEach((row) => {
|
|
3002
2999
|
const editAction = typeof row.edit_action === 'string' ? row.edit_action : undefined;
|
|
3003
3000
|
const rowId = getRowId(row);
|
|
3001
|
+
// Deleted row
|
|
3004
3002
|
if (editAction === 'DELETE') {
|
|
3005
3003
|
if (!rowId)
|
|
3006
3004
|
return;
|
|
3007
|
-
result.push({
|
|
3005
|
+
result.push({
|
|
3006
|
+
...row,
|
|
3007
|
+
internal_record_id: rowId,
|
|
3008
|
+
edit_action: 'DELETE',
|
|
3009
|
+
});
|
|
3008
3010
|
return;
|
|
3009
3011
|
}
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
+
// New row
|
|
3013
|
+
if (editAction === 'ADD' || !rowId) {
|
|
3014
|
+
result.push({
|
|
3015
|
+
...row,
|
|
3016
|
+
edit_action: 'ADD',
|
|
3017
|
+
});
|
|
3012
3018
|
return;
|
|
3013
3019
|
}
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
const changedFields = pickChangedFields(baseline, row);
|
|
3018
|
-
if (Object.keys(changedFields).length === 0)
|
|
3019
|
-
return;
|
|
3020
|
+
// Existing row:
|
|
3021
|
+
// Always include the complete row with UPDATE action,
|
|
3022
|
+
// whether it was actually modified or not.
|
|
3020
3023
|
result.push({
|
|
3021
|
-
...
|
|
3022
|
-
...(rowId ? { internal_record_id: rowId } : {}),
|
|
3024
|
+
...row,
|
|
3023
3025
|
edit_action: 'UPDATE',
|
|
3024
3026
|
});
|
|
3025
3027
|
});
|