@fuentis/phoenix-ui 0.0.9-alpha.533 → 0.0.9-alpha.534
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.
|
@@ -9317,7 +9317,8 @@ class MetaFormV2Component {
|
|
|
9317
9317
|
const configChanged = !!changes['config'];
|
|
9318
9318
|
const formChanged = !!changes['form'];
|
|
9319
9319
|
const metaChanged = signature !== this.lastSignature;
|
|
9320
|
-
|
|
9320
|
+
const readOnlyChanged = !!changes['readOnly'];
|
|
9321
|
+
if (!configChanged && !formChanged && !metaChanged && !readOnlyChanged)
|
|
9321
9322
|
return;
|
|
9322
9323
|
// cleanup dependencies
|
|
9323
9324
|
this.depCleanup?.();
|
|
@@ -9328,6 +9329,20 @@ class MetaFormV2Component {
|
|
|
9328
9329
|
// patch initial values (no emit)
|
|
9329
9330
|
this.form.patchValue(initial, { emitEvent: false });
|
|
9330
9331
|
this.form.updateValueAndValidity({ emitEvent: false });
|
|
9332
|
+
if (readOnlyChanged && this.readOnly === false) {
|
|
9333
|
+
queueMicrotask(() => {
|
|
9334
|
+
this.form.markAllAsTouched();
|
|
9335
|
+
Object.values(this.form.controls).forEach((c) => c.updateValueAndValidity({ emitEvent: true }));
|
|
9336
|
+
this.form.updateValueAndValidity({ emitEvent: true });
|
|
9337
|
+
if (this.isGrouped) {
|
|
9338
|
+
const groups = this.groupedControls ?? [];
|
|
9339
|
+
this.expandedGroupIds = groups
|
|
9340
|
+
.filter((g) => this.groupHasInvalid(g))
|
|
9341
|
+
.map((g) => String(g?.id ?? ''))
|
|
9342
|
+
.filter(Boolean);
|
|
9343
|
+
}
|
|
9344
|
+
});
|
|
9345
|
+
}
|
|
9331
9346
|
// set initial expanded groups (when grouped)
|
|
9332
9347
|
if (configChanged || metaChanged) {
|
|
9333
9348
|
if (this.isGrouped) {
|
|
@@ -9393,6 +9408,12 @@ class MetaFormV2Component {
|
|
|
9393
9408
|
const id = g?.id;
|
|
9394
9409
|
return id === null || id === undefined ? '' : `${id}`;
|
|
9395
9410
|
}
|
|
9411
|
+
groupHasInvalid(g) {
|
|
9412
|
+
const keys = (g?.ctrl ?? [])
|
|
9413
|
+
.map((f) => f?.configuration?.key)
|
|
9414
|
+
.filter(Boolean);
|
|
9415
|
+
return keys.some((k) => this.form.get(k)?.invalid);
|
|
9416
|
+
}
|
|
9396
9417
|
ngOnDestroy() {
|
|
9397
9418
|
this.depCleanup?.();
|
|
9398
9419
|
}
|