diff --git a/lib/core/src/lib/form/components/widgets/core/form-field-types.ts b/lib/core/src/lib/form/components/widgets/core/form-field-types.ts index f62cfd6ffea..3bda51016de 100644 --- a/lib/core/src/lib/form/components/widgets/core/form-field-types.ts +++ b/lib/core/src/lib/form/components/widgets/core/form-field-types.ts @@ -54,7 +54,7 @@ export class FormFieldTypes { static VALIDATABLE_TYPES: string[] = [FormFieldTypes.DISPLAY_EXTERNAL_PROPERTY]; - static REACTIVE_TYPES: string[] = [FormFieldTypes.DATE, FormFieldTypes.DATETIME]; + static REACTIVE_TYPES: string[] = [FormFieldTypes.DATE, FormFieldTypes.DATETIME, FormFieldTypes.DROPDOWN]; static CONSTANT_VALUE_TYPES: string[] = [FormFieldTypes.DISPLAY_EXTERNAL_PROPERTY]; diff --git a/lib/core/src/lib/form/components/widgets/core/form-field-validator.spec.ts b/lib/core/src/lib/form/components/widgets/core/form-field-validator.spec.ts index 48513ffdc90..1de609d2d3d 100644 --- a/lib/core/src/lib/form/components/widgets/core/form-field-validator.spec.ts +++ b/lib/core/src/lib/form/components/widgets/core/form-field-validator.spec.ts @@ -59,51 +59,6 @@ describe('FormFieldValidator', () => { expect(validator.validate(field)).toBe(true); }); - it('should fail (display error) for multiple type dropdown with zero selection', () => { - const field = new FormFieldModel(new FormModel(), { - type: FormFieldTypes.DROPDOWN, - value: [{ id: 'id_cat', name: 'Cat' }], - required: true, - selectionType: 'multiple', - hasEmptyValue: false, - options: [ - { id: 'id_cat', name: 'Cat' }, - { id: 'id_dog', name: 'Dog' } - ] - }); - - const validateBeforeUnselect = validator.validate(field); - field.value = []; - const validateAfterUnselect = validator.validate(field); - - expect(validateBeforeUnselect).toBe(true); - expect(validateAfterUnselect).toBe(false); - }); - - it('should fail (display error) for dropdown with null value', () => { - const field = new FormFieldModel(new FormModel(), { - type: FormFieldTypes.DROPDOWN, - value: null, - required: true, - options: [{ id: 'one', name: 'one' }], - selectionType: 'multiple' - }); - - expect(validator.validate(field)).toBe(false); - }); - - it('should fail (display error) for dropdown with empty object', () => { - const field = new FormFieldModel(new FormModel(), { - type: FormFieldTypes.DROPDOWN, - value: {}, - required: true, - options: [{ id: 'one', name: 'one' }], - selectionType: 'multiple' - }); - - expect(validator.validate(field)).toBe(false); - }); - it('should fail (display error) for radio buttons', () => { const field = new FormFieldModel(new FormModel(), { type: FormFieldTypes.RADIO_BUTTONS, diff --git a/lib/core/src/lib/form/components/widgets/core/form-field-validator.ts b/lib/core/src/lib/form/components/widgets/core/form-field-validator.ts index aa28adafdad..01804b25038 100644 --- a/lib/core/src/lib/form/components/widgets/core/form-field-validator.ts +++ b/lib/core/src/lib/form/components/widgets/core/form-field-validator.ts @@ -33,7 +33,6 @@ export class RequiredFieldValidator implements FormFieldValidator { FormFieldTypes.NUMBER, FormFieldTypes.BOOLEAN, FormFieldTypes.TYPEAHEAD, - FormFieldTypes.DROPDOWN, FormFieldTypes.PEOPLE, FormFieldTypes.FUNCTIONAL_GROUP, FormFieldTypes.RADIO_BUTTONS, @@ -51,22 +50,6 @@ export class RequiredFieldValidator implements FormFieldValidator { validate(field: FormFieldModel): boolean { if (this.isSupported(field) && field.isVisible) { - if (field.type === FormFieldTypes.DROPDOWN) { - if (field.hasMultipleValues) { - return Array.isArray(field.value) && !!field.value.length; - } - - if (field.hasEmptyValue && field.emptyOption) { - if (field.value === field.emptyOption.id) { - return false; - } - } - - if (field.required && field.value && typeof field.value === 'object' && !Object.keys(field.value).length) { - return false; - } - } - if (field.type === FormFieldTypes.RADIO_BUTTONS) { const option = field.options.find((opt) => opt.id === field.value); return !!option; diff --git a/lib/core/src/lib/form/components/widgets/error/error.component.scss b/lib/core/src/lib/form/components/widgets/error/error.component.scss index 4687c05c03b..1427d3d9d20 100644 --- a/lib/core/src/lib/form/components/widgets/error/error.component.scss +++ b/lib/core/src/lib/form/components/widgets/error/error.component.scss @@ -1,5 +1,6 @@ .adf-error { display: flex; + align-items: center; &-widget-container { height: auto; diff --git a/lib/process-services-cloud/src/lib/form/components/widgets/dropdown/dropdown-cloud.widget.html b/lib/process-services-cloud/src/lib/form/components/widgets/dropdown/dropdown-cloud.widget.html index 27fe1892fb3..a06b66f5e0e 100644 --- a/lib/process-services-cloud/src/lib/form/components/widgets/dropdown/dropdown-cloud.widget.html +++ b/lib/process-services-cloud/src/lib/form/components/widgets/dropdown/dropdown-cloud.widget.html @@ -1,43 +1,50 @@ -
-
-