@praxisui/dynamic-form 8.0.0-beta.85 → 8.0.0-beta.86

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.
@@ -15048,10 +15048,61 @@ class PraxisDynamicForm {
15048
15048
  inputs: { section, focusTarget, fieldMetadata: this.config.fieldMetadata || [] },
15049
15049
  },
15050
15050
  });
15051
- ref.applied$.pipe(takeUntil(this.destroy$)).subscribe(() => this.cdr.detectChanges());
15052
- ref.saved$.pipe(takeUntil(this.destroy$)).subscribe(() => this.cdr.detectChanges());
15051
+ ref.applied$.pipe(takeUntil(this.destroy$)).subscribe((value) => {
15052
+ this.applySectionEditorValue(section, value);
15053
+ });
15054
+ ref.saved$.pipe(takeUntil(this.destroy$)).subscribe((value) => {
15055
+ this.applySectionEditorValue(section, value);
15056
+ });
15053
15057
  });
15054
15058
  }
15059
+ applySectionEditorValue(section, value) {
15060
+ if (!section || !value || typeof value !== 'object') {
15061
+ this.cdr.detectChanges();
15062
+ return;
15063
+ }
15064
+ const applyPatch = (target) => {
15065
+ for (const [key, patchValue] of Object.entries(value)) {
15066
+ if (patchValue === undefined) {
15067
+ delete target[key];
15068
+ }
15069
+ else {
15070
+ target[key] = patchValue;
15071
+ }
15072
+ }
15073
+ };
15074
+ const sections = this.config?.sections || [];
15075
+ const sectionIndex = sections.findIndex((candidate) => candidate === section ||
15076
+ (!!candidate?.id && !!section?.id && candidate.id === section.id));
15077
+ if (sectionIndex >= 0) {
15078
+ this.config = produce(this.config, (draft) => {
15079
+ const target = (draft.sections || [])[sectionIndex];
15080
+ if (target) {
15081
+ applyPatch(target);
15082
+ }
15083
+ });
15084
+ const updatedSection = this.config.sections?.[sectionIndex];
15085
+ if (updatedSection) {
15086
+ applyPatch(section);
15087
+ if (this.selectedElement?.type === 'section') {
15088
+ const selectedSection = this.selectedElement.data;
15089
+ if (selectedSection === section ||
15090
+ (!!selectedSection?.id && selectedSection.id === section.id)) {
15091
+ this.selectedElement = {
15092
+ ...this.selectedElement,
15093
+ data: updatedSection,
15094
+ };
15095
+ }
15096
+ }
15097
+ }
15098
+ }
15099
+ else {
15100
+ applyPatch(section);
15101
+ }
15102
+ this.configChange.emit(this.config);
15103
+ this.emitConfigPatchChange();
15104
+ this.cdr.detectChanges();
15105
+ }
15055
15106
  resolveControlTypeEditorial(controlType) {
15056
15107
  const rawControlType = String(controlType ?? '').trim();
15057
15108
  if (!rawControlType)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@praxisui/dynamic-form",
3
- "version": "8.0.0-beta.85",
3
+ "version": "8.0.0-beta.86",
4
4
  "description": "Angular dynamic form engine for Praxis UI: metadata-driven forms, hooks, and services integrating @praxisui/* packages.",
5
5
  "peerDependencies": {
6
6
  "@angular/common": "^21.0.0",
@@ -9,13 +9,13 @@
9
9
  "@angular/forms": "^21.0.0",
10
10
  "@angular/material": "^21.0.0",
11
11
  "@angular/router": "^21.0.0",
12
- "@praxisui/ai": "^8.0.0-beta.85",
13
- "@praxisui/dynamic-fields": "^8.0.0-beta.85",
14
- "@praxisui/metadata-editor": "^8.0.0-beta.85",
15
- "@praxisui/rich-content": "^8.0.0-beta.85",
16
- "@praxisui/settings-panel": "^8.0.0-beta.85",
17
- "@praxisui/visual-builder": "^8.0.0-beta.85",
18
- "@praxisui/core": "^8.0.0-beta.85",
12
+ "@praxisui/ai": "^8.0.0-beta.86",
13
+ "@praxisui/dynamic-fields": "^8.0.0-beta.86",
14
+ "@praxisui/metadata-editor": "^8.0.0-beta.86",
15
+ "@praxisui/rich-content": "^8.0.0-beta.86",
16
+ "@praxisui/settings-panel": "^8.0.0-beta.86",
17
+ "@praxisui/visual-builder": "^8.0.0-beta.86",
18
+ "@praxisui/core": "^8.0.0-beta.86",
19
19
  "rxjs": "^7.8.0"
20
20
  },
21
21
  "dependencies": {
@@ -1226,6 +1226,7 @@ declare class PraxisDynamicForm implements OnInit, OnChanges, OnDestroy {
1226
1226
  private openRowEditor;
1227
1227
  private openColumnEditor;
1228
1228
  openSectionEditor(section: any, focusTarget?: 'title' | 'description'): void;
1229
+ private applySectionEditorValue;
1229
1230
  private resolveControlTypeEditorial;
1230
1231
  private getControlTypeIcon;
1231
1232
  /**