mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-12 17:04:57 +00:00
AAE-29269 Conditional dropdown does not populate after selecting value in a parent dropdown (#10484)
* AAE-29269 Conditional dropdown does not populate after selecting value in a parent dropdown * update * update v2 * validate form * update units
This commit is contained in:
parent
e38daa3e08
commit
cb56c76d1a
@ -66,11 +66,13 @@ describe('FormFieldComponent', () => {
|
||||
|
||||
const widgetInstance = component.componentRef.instance;
|
||||
const updateFormControlState = spyOn(widgetInstance, 'updateReactiveFormControl');
|
||||
const instanceFormValidation = spyOn(widgetInstance.field.form, 'validateForm');
|
||||
|
||||
widgetInstance.formService.formRulesEvent.next();
|
||||
fixture.detectChanges();
|
||||
|
||||
expect(updateFormControlState).toHaveBeenCalled();
|
||||
expect(instanceFormValidation).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should create custom component instance', () => {
|
||||
|
@ -87,8 +87,10 @@ export class FormFieldComponent implements OnInit, OnDestroy {
|
||||
const componentType = this.formRenderingService.resolveComponentType(originalField);
|
||||
if (componentType) {
|
||||
this.componentRef = this.container.createComponent(componentType);
|
||||
|
||||
const instance = this.componentRef.instance;
|
||||
instance.field = this.field;
|
||||
|
||||
instance.fieldChanged.subscribe((field) => {
|
||||
if (field && this.field.form) {
|
||||
this.visibilityService.refreshVisibility(field.form);
|
||||
@ -107,7 +109,7 @@ export class FormFieldComponent implements OnInit, OnDestroy {
|
||||
private updateReactiveFormControlOnFormRulesEvent(instance: any): void {
|
||||
instance?.formService.formRulesEvent.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(() => {
|
||||
instance?.updateReactiveFormControl();
|
||||
this.triggerFormFieldChanged(instance.field);
|
||||
instance?.field?.form.validateForm(instance?.field);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -199,6 +199,7 @@ export class DropdownCloudWidgetComponent extends WidgetComponent implements OnI
|
||||
|
||||
private updateFormControlState(): void {
|
||||
this.dropdownControl.setValidators(this.isRequired() ? [Validators.required] : []);
|
||||
|
||||
this.field?.readOnly || this.readOnly
|
||||
? this.dropdownControl.disable({ emitEvent: false })
|
||||
: this.dropdownControl.enable({ emitEvent: false });
|
||||
|
Loading…
x
Reference in New Issue
Block a user