@acorex/platform 20.9.1 → 20.9.2

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.
@@ -1725,6 +1725,10 @@ class AXPWidgetContainerComponent {
1725
1725
  return;
1726
1726
  }
1727
1727
  if (this.contextService.isSavedCommitted() && this.isFormDirty()) {
1728
+ const identityPatch = extractPersistedRootIdentityPatch(current, next);
1729
+ if (identityPatch) {
1730
+ this.contextService.patch(identityPatch, { updateSaved: true });
1731
+ }
1728
1732
  return;
1729
1733
  }
1730
1734
  if (this.contextService.isSavedCommitted()) {
@@ -1863,6 +1867,22 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
1863
1867
  }], functions: [{
1864
1868
  type: Input
1865
1869
  }] } });
1870
+ function hasPersistedRootIdentity(value) {
1871
+ return ((typeof value === 'string' && value.length > 0) || (typeof value === 'number' && !Number.isNaN(value)));
1872
+ }
1873
+ /** Injects `id` / `_id` from an external context sync when the live form is dirty but lacks a persisted root id. */
1874
+ function extractPersistedRootIdentityPatch(current, next) {
1875
+ const nextId = next['id'] ?? next['_id'];
1876
+ const currentId = current['id'] ?? current['_id'];
1877
+ if (!hasPersistedRootIdentity(nextId) || hasPersistedRootIdentity(currentId)) {
1878
+ return null;
1879
+ }
1880
+ const patch = { id: nextId };
1881
+ if (next['_id'] !== undefined) {
1882
+ patch['_id'] = next['_id'];
1883
+ }
1884
+ return patch;
1885
+ }
1866
1886
 
1867
1887
  class AXPWidgetPlaceholderComponent {
1868
1888
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPWidgetPlaceholderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }