@fuentis/phoenix-ui 0.0.9-alpha.535 → 0.0.9-alpha.536

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.
@@ -9345,13 +9345,13 @@ class MetaFormV2Component {
9345
9345
  }
9346
9346
  });
9347
9347
  }
9348
- // set initial expanded groups (when grouped)
9349
- if (configChanged || metaChanged) {
9348
+ // init expanded only when meta (structure) changed
9349
+ if (metaChanged) {
9350
9350
  if (this.isGrouped) {
9351
9351
  const groups = this.groupedControls ?? [];
9352
9352
  this.expandedGroupIds = groups
9353
9353
  .filter((g) => !g?.collapsed)
9354
- .map((g) => String(g?.id ?? ''))
9354
+ .map((g) => this.panelValue(g))
9355
9355
  .filter((id) => !!id);
9356
9356
  }
9357
9357
  else {
@@ -9372,6 +9372,10 @@ class MetaFormV2Component {
9372
9372
  if (typeof maybeCleanup === 'function')
9373
9373
  this.depCleanup = maybeCleanup;
9374
9374
  }
9375
+ // ✅ auto-expand invalid groups when entering edit
9376
+ if (changes['readOnly'] && changes['readOnly'].previousValue === true && changes['readOnly'].currentValue === false) {
9377
+ this.expandInvalidGroups();
9378
+ }
9375
9379
  this.lastSignature = signature;
9376
9380
  }
9377
9381
  // Template handler (typed exactly for our template usage)
@@ -9416,6 +9420,19 @@ class MetaFormV2Component {
9416
9420
  .filter(Boolean);
9417
9421
  return keys.some((k) => this.form.get(k)?.invalid);
9418
9422
  }
9423
+ expandInvalidGroups() {
9424
+ if (!this.isGrouped)
9425
+ return;
9426
+ const groups = this.groupedControls ?? [];
9427
+ const invalidIds = groups
9428
+ .filter((g) => this.groupHasInvalid(g))
9429
+ .map((g) => this.panelValue(g))
9430
+ .filter(Boolean);
9431
+ if (invalidIds.length) {
9432
+ // keep already opened + open invalid
9433
+ this.expandedGroupIds = Array.from(new Set([...this.expandedGroupIds, ...invalidIds]));
9434
+ }
9435
+ }
9419
9436
  ngOnDestroy() {
9420
9437
  this.depCleanup?.();
9421
9438
  }