mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-12 17:04:57 +00:00
AAE-22944 Disable form rules form read only form (#9775)
This commit is contained in:
parent
ad0d2c80a5
commit
00b714a57a
@ -710,6 +710,17 @@ describe('Form Renderer Component', () => {
|
||||
expect(rulesManager.initialize).toHaveBeenCalledWith(formModel);
|
||||
});
|
||||
|
||||
it('should NOT call the Form Rules Manager init when the form is read only', () => {
|
||||
spyOn(rulesManager, 'initialize');
|
||||
const formModel = formService.parseForm(customWidgetFormWithVisibility.formRepresentation.formDefinition);
|
||||
|
||||
formRendererComponent.formDefinition = formModel;
|
||||
formRendererComponent.readOnly = true;
|
||||
formRendererComponent.ngOnInit();
|
||||
|
||||
expect(rulesManager.initialize).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should call the Form Rules Manager destroy on component destruction', () => {
|
||||
spyOn(rulesManager, 'destroy');
|
||||
|
||||
|
@ -66,6 +66,9 @@ export class FormRendererComponent<T> implements OnInit, OnDestroy {
|
||||
@Input()
|
||||
formDefinition: FormModel;
|
||||
|
||||
@Input()
|
||||
readOnly = false;
|
||||
|
||||
debugMode: boolean;
|
||||
|
||||
fields: FormFieldModel[];
|
||||
@ -79,7 +82,9 @@ export class FormRendererComponent<T> implements OnInit, OnDestroy {
|
||||
|
||||
ngOnInit(): void {
|
||||
this.runMiddlewareServices();
|
||||
this.formRulesManager.initialize(this.formDefinition);
|
||||
if (!this.readOnly) {
|
||||
this.formRulesManager.initialize(this.formDefinition);
|
||||
}
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
|
@ -63,7 +63,10 @@
|
||||
</mat-card-title>
|
||||
</mat-card-header>
|
||||
<mat-card-content class="adf-form-container-card-content">
|
||||
<adf-form-renderer [formDefinition]="form">
|
||||
<adf-form-renderer
|
||||
[formDefinition]="form"
|
||||
[readOnly]="readOnly"
|
||||
>
|
||||
</adf-form-renderer>
|
||||
</mat-card-content>
|
||||
<mat-card-actions *ngIf="form.hasOutcomes()" class="adf-form-mat-card-actions">
|
||||
|
Loading…
x
Reference in New Issue
Block a user