@dsivd/prestations-ng 19.0.4 → 19.0.5-beta.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.
@@ -847,4 +847,7 @@ this.address.update((current) => ({
847
847
  ...current,
848
848
  locality: { ...current.locality, name: 'newName' },
849
849
  }));
850
+
851
+ // 🟢 Or, if you're in a component extending `FoehnInputComponent` :
852
+ this.patchModel({ locality: { name: 'newName' } });
850
853
  ```
@@ -831,6 +831,16 @@ class FoehnInputComponent {
831
831
  this.model.set(value);
832
832
  }
833
833
  }
834
+ patchModel(patch) {
835
+ this.model.update((current) => {
836
+ if (current &&
837
+ typeof current === 'object' &&
838
+ !Array.isArray(current)) {
839
+ return { ...current, ...patch };
840
+ }
841
+ throw new Error('patchModel can only be used with object models.');
842
+ });
843
+ }
834
844
  hasErrorsToDisplay() {
835
845
  return (this.hasErrors() &&
836
846
  (!this.disabled() || this.showErrorWhenDisabled()));