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);
|
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', () => {
|
it('should call the Form Rules Manager destroy on component destruction', () => {
|
||||||
spyOn(rulesManager, 'destroy');
|
spyOn(rulesManager, 'destroy');
|
||||||
|
|
||||||
|
@ -66,6 +66,9 @@ export class FormRendererComponent<T> implements OnInit, OnDestroy {
|
|||||||
@Input()
|
@Input()
|
||||||
formDefinition: FormModel;
|
formDefinition: FormModel;
|
||||||
|
|
||||||
|
@Input()
|
||||||
|
readOnly = false;
|
||||||
|
|
||||||
debugMode: boolean;
|
debugMode: boolean;
|
||||||
|
|
||||||
fields: FormFieldModel[];
|
fields: FormFieldModel[];
|
||||||
@ -79,8 +82,10 @@ export class FormRendererComponent<T> implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.runMiddlewareServices();
|
this.runMiddlewareServices();
|
||||||
|
if (!this.readOnly) {
|
||||||
this.formRulesManager.initialize(this.formDefinition);
|
this.formRulesManager.initialize(this.formDefinition);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
ngOnDestroy() {
|
||||||
this.formRulesManager.destroy();
|
this.formRulesManager.destroy();
|
||||||
|
@ -63,7 +63,10 @@
|
|||||||
</mat-card-title>
|
</mat-card-title>
|
||||||
</mat-card-header>
|
</mat-card-header>
|
||||||
<mat-card-content class="adf-form-container-card-content">
|
<mat-card-content class="adf-form-container-card-content">
|
||||||
<adf-form-renderer [formDefinition]="form">
|
<adf-form-renderer
|
||||||
|
[formDefinition]="form"
|
||||||
|
[readOnly]="readOnly"
|
||||||
|
>
|
||||||
</adf-form-renderer>
|
</adf-form-renderer>
|
||||||
</mat-card-content>
|
</mat-card-content>
|
||||||
<mat-card-actions *ngIf="form.hasOutcomes()" class="adf-form-mat-card-actions">
|
<mat-card-actions *ngIf="form.hasOutcomes()" class="adf-form-mat-card-actions">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user