Skip to content

Commit

Permalink
Propagate read only in Angular Material master detail
Browse files Browse the repository at this point in the history
When an Angular Material master detail control is set to read only, it
will now also render its detail as read only with the same mechanism
used in the other Angular Material renderers.

Closes #1479
  • Loading branch information
LukasBoll authored Jan 5, 2023
1 parent 5a84cd3 commit 3b32c9b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/angular-material/src/other/master-detail/master.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import {
mapStateToArrayControlProps,
RankedTester,
rankWith,
setReadonly,
StatePropsOfArrayControl,
uiTypeIs
} from '@jsonforms/core';
Expand Down Expand Up @@ -183,6 +184,10 @@ export class MasterListComponent extends JsonFormsArrayControl {
props.rootSchema
);

if (!this.isEnabled()) {
setReadonly(detailUISchema);
}

const masterItems = (data || []).map((d: any, index: number) => {
const labelRefInstancePath = controlElement.options?.labelRef && removeSchemaKeywords(
controlElement.options.labelRef
Expand Down

0 comments on commit 3b32c9b

Please sign in to comment.