mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[AAE-15522] Fix - Dropdown variable error messages are displayed at modeling level (#8730)
This commit is contained in:
@@ -103,6 +103,29 @@ describe('FormFieldComponent', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should set field preview state', () => {
|
||||
const field = new FormFieldModel(form, {
|
||||
type: FormFieldTypes.DROPDOWN,
|
||||
id: 'FAKE-DROPDOWN-WIDGET'
|
||||
});
|
||||
component.field = field;
|
||||
component.preview = true;
|
||||
fixture.detectChanges();
|
||||
|
||||
expect(component.field.preview).toBe(true);
|
||||
});
|
||||
|
||||
it('should field preview state be false as default', () => {
|
||||
const field = new FormFieldModel(form, {
|
||||
type: FormFieldTypes.DROPDOWN,
|
||||
id: 'FAKE-DROPDOWN-WIDGET'
|
||||
});
|
||||
component.field = field;
|
||||
fixture.detectChanges();
|
||||
|
||||
expect(component.field.preview).toBe(false);
|
||||
});
|
||||
|
||||
it('should hide the field when it is not visible', (done) => {
|
||||
const field = new FormFieldModel(form, {
|
||||
type: FormFieldTypes.TEXT,
|
||||
|
@@ -63,6 +63,9 @@ export class FormFieldComponent implements OnInit, OnDestroy {
|
||||
@Input()
|
||||
field: FormFieldModel = null;
|
||||
|
||||
@Input()
|
||||
preview: boolean = false;
|
||||
|
||||
componentRef: ComponentRef<any>;
|
||||
|
||||
focus: boolean = false;
|
||||
@@ -80,6 +83,7 @@ export class FormFieldComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
const originalField = this.getField();
|
||||
if (originalField) {
|
||||
this.setFieldPreviewState();
|
||||
const customTemplate = this.field.form.customFieldTemplates[originalField.type];
|
||||
if (customTemplate && this.hasController(originalField.type)) {
|
||||
const factory = this.getComponentFactorySync(originalField.type, customTemplate);
|
||||
@@ -154,6 +158,10 @@ export class FormFieldComponent implements OnInit, OnDestroy {
|
||||
return module.componentFactories.find((x) => x.componentType === decoratedCmp);
|
||||
}
|
||||
|
||||
private setFieldPreviewState(): void {
|
||||
this.field.preview = this.preview;
|
||||
}
|
||||
|
||||
focusToggle() {
|
||||
setTimeout(() => {
|
||||
this.focus = !this.focus;
|
||||
|
@@ -83,6 +83,7 @@ export class FormFieldModel extends FormWidgetModel {
|
||||
groupsRestriction: string[];
|
||||
leftLabels: boolean = false;
|
||||
variableConfig: VariableConfig;
|
||||
preview: boolean = false;
|
||||
|
||||
// container model members
|
||||
numberOfColumns: number = 1;
|
||||
|
@@ -90,6 +90,7 @@ export class FormModel implements ProcessFormModel {
|
||||
isValid = true;
|
||||
processVariables: ProcessVariableModel[] = [];
|
||||
variables: FormVariableModel[] = [];
|
||||
preview: boolean = false;
|
||||
|
||||
constructor(
|
||||
json?: any,
|
||||
|
Reference in New Issue
Block a user