Skip to content

Commit d6f1104

Browse files
Update object.renderer.ts
#2480 Dont wrap the object content in a mat-card if a group is used to display it; it has its own mat-card. Still use card when using a plain horizontal layout.
1 parent 6542785 commit d6f1104

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

packages/angular-material/src/library/other/object.renderer.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,20 @@ import cloneDeep from 'lodash/cloneDeep';
4545
@Component({
4646
selector: 'ObjectRenderer',
4747
template: `
48-
<mat-card class="object-layout" appearance="outlined">
48+
<mat-card
49+
*ngIf="!this.containsGroup; else elseTemplate"
50+
class="object-layout" appearance="outlined">
51+
<ng-container *ngTemplateOutlet="elseTemplate"></ng-container>
52+
</mat-card>
53+
54+
<ng-template #elseTemplate>
4955
<jsonforms-outlet
5056
[uischema]="detailUiSchema"
5157
[schema]="scopedSchema"
5258
[path]="propsPath"
5359
>
5460
</jsonforms-outlet>
55-
</mat-card>
61+
</ng-template>
5662
`,
5763
styles: [
5864
`
@@ -66,6 +72,7 @@ import cloneDeep from 'lodash/cloneDeep';
6672
})
6773
export class ObjectControlRenderer extends JsonFormsControlWithDetail {
6874
detailUiSchema: UISchemaElement;
75+
containsGroup: boolean = false;
6976
constructor(jsonformsService: JsonFormsAngularService) {
7077
super(jsonformsService);
7178
}
@@ -95,6 +102,7 @@ export class ObjectControlRenderer extends JsonFormsControlWithDetail {
95102
this.detailUiSchema.type = 'VerticalLayout';
96103
} else {
97104
(this.detailUiSchema as GroupLayout).label = startCase(props.path);
105+
this.containsGroup = true;
98106
}
99107
if (!this.isEnabled()) {
100108
setReadonly(this.detailUiSchema);

0 commit comments

Comments
 (0)