@zohodesk/library-platform 1.1.7-exp.2 → 1.1.8-exp.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/bc/zfield/FieldApiTypes.js +20 -0
- package/es/bc/zform/Properties.js +9 -0
- package/es/bc/zform/Symbol.js +5 -0
- package/es/bc/zlist/Properties.js +3 -0
- package/es/bc/zrecord/Constants.js +2 -0
- package/es/cc/date/Properties.js +9 -0
- package/es/cc/fields/field/Properties.js +63 -0
- package/es/cc/fields/multi-select/Properties.js +9 -0
- package/es/cc/fields/pick-list/Properties.js +9 -0
- package/es/cc/form/Properties.js +17 -0
- package/es/cc/form-connected/Properties.js +35 -0
- package/es/cc/form-connected/SdkContract.js +61 -0
- package/es/cc/form-connected/index.js +2 -0
- package/es/cc/highlighted-value/Properties.js +10 -0
- package/es/cc/index.js +1 -1
- package/es/cc/multi-select/Properties.js +9 -0
- package/es/cc/select/Properties.js +12 -0
- package/es/cc/textbox/Properties.js +11 -0
- package/es/index.js +2 -1
- package/es/library/behaviours/field-focus/frameworks/ui/EventHandlersFactory.js +26 -0
- package/es/library/behaviours/field-focus/frameworks/ui/FocusFieldBehaviourFactory.js +20 -0
- package/es/library/dot/components/action-location/frameworks/ui/ActionComponentMapping.js +3 -1
- package/es/library/dot/components/form/adapters/presenter/TransformState.js +5 -58
- package/es/library/dot/components/form/frameworks/ui/DefaultComponentRegister.js +0 -4
- package/es/library/dot/components/form/frameworks/ui/FormView.js +18 -42
- package/es/library/dot/components/form/frameworks/ui/css/Form.module.css +29 -1
- package/es/library/dot/components/form/frameworks/ui/sub-components/Footer.js +27 -0
- package/es/library/dot/components/form/frameworks/ui/sub-components/Header.js +24 -0
- package/es/library/dot/components/form/frameworks/ui/sub-components/MiddleSection.js +24 -0
- package/es/library/dot/components/form/frameworks/ui/sub-components/Sections.js +7 -2
- package/es/library/dot/components/form/frameworks/ui/sub-components/SectionsLayout.js +20 -0
- package/es/library/dot/components/form/frameworks/ui/sub-components/SectionsWithRightPanelLayout.js +42 -0
- package/es/library/dot/components/form-fields/checkbox/frameworks/ui/Checkbox.js +4 -3
- package/es/library/dot/components/form-fields/checkbox/frameworks/ui/CheckboxView.js +18 -14
- package/es/library/dot/components/form-fields/currency/frameworks/ui/Currency.js +3 -3
- package/es/library/dot/components/form-fields/currency/frameworks/ui/CurrencyView.js +20 -17
- package/es/library/dot/components/form-fields/date/frameworks/ui/Date.js +2 -3
- package/es/library/dot/components/form-fields/date/frameworks/ui/DateView.js +22 -19
- package/es/library/dot/components/form-fields/datetime/frameworks/ui/DateTime.js +2 -3
- package/es/library/dot/components/form-fields/datetime/frameworks/ui/DateTimeView.js +21 -18
- package/es/library/dot/components/form-fields/decimal/frameworks/ui/Decimal.js +2 -3
- package/es/library/dot/components/form-fields/decimal/frameworks/ui/DecimalView.js +22 -19
- package/es/library/dot/components/form-fields/email/frameworks/ui/Email.js +2 -3
- package/es/library/dot/components/form-fields/email/frameworks/ui/EmailView.js +22 -19
- package/es/library/dot/components/form-fields/field/FieldItem.js +36 -0
- package/es/library/dot/components/form-fields/field/css/FieldItem.module.css +13 -0
- package/es/library/dot/components/form-fields/multi-select/frameworks/ui/MultiSelect.js +2 -3
- package/es/library/dot/components/form-fields/multi-select/frameworks/ui/MultiSelectView.js +21 -18
- package/es/library/dot/components/form-fields/number/frameworks/ui/Number.js +2 -3
- package/es/library/dot/components/form-fields/number/frameworks/ui/NumberView.js +22 -19
- package/es/library/dot/components/form-fields/percentage/frameworks/ui/Percentage.js +2 -3
- package/es/library/dot/components/form-fields/percentage/frameworks/ui/PercentageView.js +22 -19
- package/es/library/dot/components/form-fields/phone/frameworks/ui/Phone.js +2 -3
- package/es/library/dot/components/form-fields/phone/frameworks/ui/PhoneView.js +22 -19
- package/es/library/dot/components/form-fields/pick-list/frameworks/ui/PickList.js +2 -3
- package/es/library/dot/components/form-fields/pick-list/frameworks/ui/PickListView.js +21 -18
- package/es/library/dot/components/form-fields/textarea/frameworks/ui/TextArea.js +4 -3
- package/es/library/dot/components/form-fields/textarea/frameworks/ui/TextAreaView.js +18 -17
- package/es/library/dot/components/form-fields/textbox/frameworks/ui/TextBox.js +2 -3
- package/es/library/dot/components/form-fields/textbox/frameworks/ui/TextBoxView.js +21 -18
- package/es/library/dot/components/form-fields/url/frameworks/ui/Url.js +2 -3
- package/es/library/dot/components/form-fields/url/frameworks/ui/UrlView.js +22 -19
- package/es/library/dot/components/table-list/frameworks/ui/sub-components/ErrorState.js +3 -3
- package/es/library/dot/legacy-to-new-arch/action-icon/frameworks/ui/ActionIconView.js +1 -1
- package/es/library/dot/legacy-to-new-arch/date/frameworks/ui/DateView.js +13 -1
- package/es/library/dot/legacy-to-new-arch/highlighted-value/frameworks/ui/HighlightedValueView.js +6 -1
- package/es/library/dot/{components/form-fields/ephi-tag/frameworks/ui/css/EPHITag.module.css → legacy-to-new-arch/highlighted-value/frameworks/ui/css/HighlightedValue.module.css} +1 -1
- package/es/library/dot/legacy-to-new-arch/label/frameworks/ui/LabelView.js +13 -7
- package/es/library/dot/legacy-to-new-arch/multi-select/frameworks/ui/MultiSelectView.js +12 -2
- package/es/library/dot/legacy-to-new-arch/select/frameworks/ui/SelectView.js +16 -4
- package/es/library/dot/legacy-to-new-arch/text-area/frameworks/ui/TextAreaView.js +1 -1
- package/es/library/dot/legacy-to-new-arch/textbox/frameworks/ui/TextBoxView.js +13 -3
- package/es/platform/client-actions/cc/dynamic-action-component/Properties.js +1 -1
- package/es/platform/components/form-connected/adapters/resources/SmartFormResources.js +88 -6
- package/es/platform/components/form-connected/frameworks/EventHandlersFactory.js +28 -56
- package/es/platform/components/form-connected/frameworks/FormConnectedFactory.js +1 -5
- package/es/platform/components/form-connected/frameworks/FormConnectedView.js +3 -1
- package/es/platform/data-source/http-template/deleteRecords.js +1 -1
- package/es/platform/data-source/http-template/fetchValidationRules.js +2 -1
- package/es/platform/data-source/http-template/moveToTrash.js +28 -0
- package/es/platform/data-source/index.js +2 -0
- package/es/platform/data-source/utils/validation-rules/FieldConditions.js +167 -0
- package/es/platform/data-source/utils/validation-rules/TransFormValidationRules.js +93 -0
- package/es/platform/zdata-source/applications/usecases/SuccessUseCase.js +1 -1
- package/es/platform/zform/adapters/controllers/FieldBlurController.js +26 -0
- package/es/platform/zform/adapters/controllers/MyFromSuccessController.js +8 -2
- package/es/platform/zform/adapters/controllers/SubmitValidationCompletedController.js +21 -0
- package/es/platform/zform/adapters/controllers/ValidateFieldRequestController.js +10 -5
- package/es/platform/zform/adapters/controllers/ValidationRulesExecutionResultController.js +23 -0
- package/es/platform/zform/adapters/controllers/ValidationRulesRequestController.js +2 -4
- package/es/platform/zform/adapters/controllers/ValidationRulesSuccessController.js +2 -4
- package/es/platform/zform/adapters/gateway/Service.js +15 -7
- package/es/platform/zform/adapters/presenter/FormTranslator.js +28 -3
- package/es/platform/zform/adapters/presenter/translators/SectionTranslator.js +54 -3
- package/es/platform/zform/adapters/presenter/translators/fields/BooleanFieldTranslator.js +7 -3
- package/es/platform/zform/adapters/presenter/translators/fields/CurrencyFieldTranslator.js +5 -9
- package/es/platform/zform/adapters/presenter/translators/fields/DateFieldTranslator.js +7 -3
- package/es/platform/zform/adapters/presenter/translators/fields/DateTimeFieldTranslator.js +7 -3
- package/es/platform/zform/adapters/presenter/translators/fields/DecimalFieldTranslator.js +6 -9
- package/es/platform/zform/adapters/presenter/translators/fields/EmailFieldTranslator.js +6 -9
- package/es/platform/zform/adapters/presenter/translators/fields/LookUpFieldTranslator.js +5 -9
- package/es/platform/zform/adapters/presenter/translators/fields/MultiselectFieldTranslator.js +6 -3
- package/es/platform/zform/adapters/presenter/translators/fields/NumberFieldTranslator.js +6 -9
- package/es/platform/zform/adapters/presenter/translators/fields/PercentageFieldTranslator.js +6 -9
- package/es/platform/zform/adapters/presenter/translators/fields/PhoneFieldTranslator.js +6 -9
- package/es/platform/zform/adapters/presenter/translators/fields/PicklistFieldTranslator.js +6 -3
- package/es/platform/zform/adapters/presenter/translators/fields/TextAreaFieldTranslator.js +5 -9
- package/es/platform/zform/adapters/presenter/translators/fields/TextFieldTranslator.js +8 -8
- package/es/platform/zform/adapters/presenter/translators/fields/URLFieldTranslator.js +6 -9
- package/es/platform/zform/adapters/presenter/utils/DefaultClientActions.js +92 -22
- package/es/platform/zform/applications/usecases/AbstractUseCase.js +3 -1
- package/es/platform/zform/applications/usecases/FieldBlurUseCase.js +39 -0
- package/es/platform/zform/applications/usecases/FieldValueChangeRequestUseCase.js +9 -13
- package/es/platform/zform/applications/usecases/FocusFieldUseCase.js +19 -0
- package/es/platform/zform/applications/usecases/FormSubmitUseCase.js +19 -38
- package/es/platform/zform/applications/usecases/GetFieldErrorMessageUseCase.js +16 -0
- package/es/platform/zform/applications/usecases/InsertValidationRuleSuccessUseCase.js +22 -0
- package/es/platform/zform/applications/usecases/MyFormSuccessUseCase.js +63 -13
- package/es/platform/zform/applications/usecases/MyLayoutSuccessUseCase.js +4 -33
- package/es/platform/zform/applications/usecases/SetFieldErrorMessageUseCase.js +4 -4
- package/es/platform/zform/applications/usecases/SetFieldValueUseCase.js +4 -21
- package/es/platform/zform/applications/usecases/SetFieldsValuesUseCase.js +4 -26
- package/es/platform/zform/applications/usecases/SubmitValidationCompletedUseCase.js +62 -0
- package/es/platform/zform/applications/usecases/ValidateFieldUseCase.js +33 -0
- package/es/platform/zform/applications/usecases/ValidationRulesExecutionResultUseCase.js +23 -0
- package/es/platform/zform/domain/ZField.js +20 -1
- package/es/platform/zform/domain/ZForm.js +114 -45
- package/es/platform/zform/domain/interfaces/IZForm.js +5 -1
- package/es/platform/zform/domain/interfaces/ValidationConditions.js +142 -0
- package/es/platform/zform/frameworks/ui/EventHandlerFactory.js +22 -143
- package/es/platform/zform/frameworks/ui/ZFormBehaviourFactory.js +4 -9
- package/es/platform/zform/frameworks/validation-rules/DefaultCustomValidators.js +340 -0
- package/es/platform/zform/frameworks/validation-rules/Validator.js +98 -16
- package/es/platform/zform/frameworks/validation-rules/formUtils.js +7 -0
- package/es/platform/zform/frameworks/validation-rules/localization_utils.js +15 -0
- package/es/platform/zform/frameworks/validation-rules/utils.js +402 -351
- package/es/platform/zform/frameworks/validation-rules/validationRules.js +80 -79
- package/es/platform/zlist/domain/entities/List.js +2 -1
- package/package.json +4 -4
- package/es/bc/field-validation/Constants.js +0 -4
- package/es/bc/field-validation/EventHandlers.js +0 -1
- package/es/bc/field-validation/Events.js +0 -106
- package/es/bc/field-validation/FieldTypes.js +0 -20
- package/es/bc/field-validation/Properties.js +0 -11
- package/es/bc/field-validation/index.js +0 -5
- package/es/cc/ephi-tag/Properties.js +0 -1
- package/es/cc/ephi-tag/index.js +0 -1
- package/es/cc/info-icon/Properties.js +0 -10
- package/es/cc/info-icon/index.js +0 -1
- package/es/library/behaviours/field-validation/adapters/controllers/AbstractController.js +0 -9
- package/es/library/behaviours/field-validation/adapters/controllers/ValidateFieldController.js +0 -32
- package/es/library/behaviours/field-validation/adapters/controllers/ValidateFieldsController.js +0 -31
- package/es/library/behaviours/field-validation/adapters/gateway/Repository.js +0 -23
- package/es/library/behaviours/field-validation/adapters/gateway/Service.js +0 -18
- package/es/library/behaviours/field-validation/applications/interfaces/input/FieldData.js +0 -17
- package/es/library/behaviours/field-validation/applications/usecases/AbstractUseCase.js +0 -15
- package/es/library/behaviours/field-validation/applications/usecases/ValidateField.js +0 -29
- package/es/library/behaviours/field-validation/applications/usecases/ValidateFields.js +0 -28
- package/es/library/behaviours/field-validation/domain/FieldValidation.js +0 -94
- package/es/library/behaviours/field-validation/domain/field-vise-validations/BooleanValidation.js +0 -28
- package/es/library/behaviours/field-validation/domain/field-vise-validations/CurrencyValidation.js +0 -49
- package/es/library/behaviours/field-validation/domain/field-vise-validations/DateTimeValidation.js +0 -24
- package/es/library/behaviours/field-validation/domain/field-vise-validations/DateValidation.js +0 -24
- package/es/library/behaviours/field-validation/domain/field-vise-validations/DecimalValidation.js +0 -49
- package/es/library/behaviours/field-validation/domain/field-vise-validations/EmailValidation.js +0 -28
- package/es/library/behaviours/field-validation/domain/field-vise-validations/IntegerValidation.js +0 -39
- package/es/library/behaviours/field-validation/domain/field-vise-validations/LookUpValidation.js +0 -24
- package/es/library/behaviours/field-validation/domain/field-vise-validations/MultiSelectValidation.js +0 -26
- package/es/library/behaviours/field-validation/domain/field-vise-validations/PercentValidation.js +0 -28
- package/es/library/behaviours/field-validation/domain/field-vise-validations/PhoneValidation.js +0 -39
- package/es/library/behaviours/field-validation/domain/field-vise-validations/PicklistValidation.js +0 -24
- package/es/library/behaviours/field-validation/domain/field-vise-validations/TextAreaValidation.js +0 -39
- package/es/library/behaviours/field-validation/domain/field-vise-validations/TextBoxValidation.js +0 -39
- package/es/library/behaviours/field-validation/domain/field-vise-validations/URLValidation.js +0 -28
- package/es/library/behaviours/field-validation/domain/interfaces/FieldTypes.js +0 -20
- package/es/library/behaviours/field-validation/domain/interfaces/IFieldValidation.js +0 -1
- package/es/library/behaviours/field-validation/domain/interfaces/IFieldViseValidation.js +0 -1
- package/es/library/behaviours/field-validation/domain/interfaces/ValidationResult.js +0 -1
- package/es/library/behaviours/field-validation/domain/interfaces/ValidationsArray.js +0 -1
- package/es/library/behaviours/field-validation/domain/interfaces/ValidationsEnum.js +0 -22
- package/es/library/behaviours/field-validation/domain/interfaces/ValidationsMap.js +0 -1
- package/es/library/behaviours/field-validation/domain/interfaces/fields/IBooleanField.js +0 -0
- package/es/library/behaviours/field-validation/domain/interfaces/fields/ICurrencyField.js +0 -0
- package/es/library/behaviours/field-validation/domain/interfaces/fields/IDateField.js +0 -0
- package/es/library/behaviours/field-validation/domain/interfaces/fields/IDateTimeField.js +0 -0
- package/es/library/behaviours/field-validation/domain/interfaces/fields/IDecimalField.js +0 -0
- package/es/library/behaviours/field-validation/domain/interfaces/fields/IEmailField.js +0 -0
- package/es/library/behaviours/field-validation/domain/interfaces/fields/IIntegerField.js +0 -0
- package/es/library/behaviours/field-validation/domain/interfaces/fields/ILookUpField.js +0 -0
- package/es/library/behaviours/field-validation/domain/interfaces/fields/IMultiSelectField.js +0 -0
- package/es/library/behaviours/field-validation/domain/interfaces/fields/IPercentField.js +0 -0
- package/es/library/behaviours/field-validation/domain/interfaces/fields/IPhoneField.js +0 -0
- package/es/library/behaviours/field-validation/domain/interfaces/fields/IPicklistField.js +0 -0
- package/es/library/behaviours/field-validation/domain/interfaces/fields/ITextAreaField.js +0 -0
- package/es/library/behaviours/field-validation/domain/interfaces/fields/ITextBoxField.js +0 -0
- package/es/library/behaviours/field-validation/domain/interfaces/fields/IURLField.js +0 -0
- package/es/library/behaviours/field-validation/frameworks/ui/EventHandlerFactory.js +0 -23
- package/es/library/behaviours/field-validation/frameworks/ui/FieldValidationBehaviourFactory.js +0 -27
- package/es/library/behaviours/field-validation/frameworks/ui/__tests__/BooleanFieldValidation.test.js +0 -137
- package/es/library/behaviours/field-validation/frameworks/ui/__tests__/CurrencyFieldValidation.test.js +0 -228
- package/es/library/behaviours/field-validation/frameworks/ui/__tests__/DateFieldValidation.test.js +0 -108
- package/es/library/behaviours/field-validation/frameworks/ui/__tests__/DateTimeFieldValidation.test.js +0 -108
- package/es/library/behaviours/field-validation/frameworks/ui/__tests__/DecimalFieldValidation.test.js +0 -257
- package/es/library/behaviours/field-validation/frameworks/ui/__tests__/EmailFieldValidation.test.js +0 -139
- package/es/library/behaviours/field-validation/frameworks/ui/__tests__/FieldValidationBehaviour.test.js +0 -171
- package/es/library/behaviours/field-validation/frameworks/ui/__tests__/IntegerFieldValidation.test.js +0 -168
- package/es/library/behaviours/field-validation/frameworks/ui/__tests__/LookUpFieldValidation.test.js +0 -108
- package/es/library/behaviours/field-validation/frameworks/ui/__tests__/MultiSelectFieldValidation.test.js +0 -79
- package/es/library/behaviours/field-validation/frameworks/ui/__tests__/PercentFieldValidation.test.js +0 -108
- package/es/library/behaviours/field-validation/frameworks/ui/__tests__/PhoneFieldValidation.test.js +0 -168
- package/es/library/behaviours/field-validation/frameworks/ui/__tests__/PicklistFieldValidation.test.js +0 -79
- package/es/library/behaviours/field-validation/frameworks/ui/__tests__/TextAreaFieldValidation.test.js +0 -170
- package/es/library/behaviours/field-validation/frameworks/ui/__tests__/TextBoxFieldValidation.test.js +0 -170
- package/es/library/behaviours/field-validation/frameworks/ui/__tests__/URLFieldValidation.test.js +0 -108
- package/es/library/behaviours/field-validation/frameworks/utils/FormBasicValidationAdaptor.js +0 -228
- package/es/library/behaviours/field-validation/frameworks/utils/__tests__/formValidate.test.js +0 -284
- package/es/library/behaviours/field-validation/frameworks/utils/formValidate.js +0 -334
- package/es/library/dot/components/form-fields/checkbox/adapters/presenter/TransformState.js +0 -22
- package/es/library/dot/components/form-fields/currency/adapters/presenter/TransformState.js +0 -81
- package/es/library/dot/components/form-fields/date/adapters/presenter/TransformState.js +0 -22
- package/es/library/dot/components/form-fields/datetime/adapters/presenter/TransformState.js +0 -22
- package/es/library/dot/components/form-fields/decimal/adapters/presenter/TransformState.js +0 -31
- package/es/library/dot/components/form-fields/email/adapters/presenter/TransformState.js +0 -23
- package/es/library/dot/components/form-fields/ephi-tag/frameworks/ui/EPHITag.js +0 -10
- package/es/library/dot/components/form-fields/ephi-tag/frameworks/ui/EPHITagView.js +0 -21
- package/es/library/dot/components/form-fields/info-icon/frameworks/ui/InfoIcon.js +0 -10
- package/es/library/dot/components/form-fields/info-icon/frameworks/ui/InfoIconView.js +0 -21
- package/es/library/dot/components/form-fields/info-icon/frameworks/ui/css/InfoIcon.module.css +0 -3
- package/es/library/dot/components/form-fields/multi-select/adapters/presenter/TransformState.js +0 -31
- package/es/library/dot/components/form-fields/number/adapters/presenter/TransformState.js +0 -31
- package/es/library/dot/components/form-fields/percentage/adapters/presenter/TransformState.js +0 -31
- package/es/library/dot/components/form-fields/phone/adapters/presenter/TransformState.js +0 -31
- package/es/library/dot/components/form-fields/pick-list/adapters/presenter/TransformState.js +0 -23
- package/es/library/dot/components/form-fields/textarea/adapters/presenter/TransformState.js +0 -23
- package/es/library/dot/components/form-fields/textbox/adapters/presenter/TransformState.js +0 -32
- package/es/library/dot/components/form-fields/url/adapters/presenter/TransformState.js +0 -31
- package/es/platform/zform/adapters/controllers/ValidateErrorMessageController.js +0 -22
- package/es/platform/zform/applications/interfaces/input/ValidateErrorMessageInputModel.js +0 -1
- package/es/platform/zform/applications/usecases/ValidateErrorMessageUseCase.js +0 -33
- package/es/platform/zform/applications/usecases/ValidateFieldRequestUseCase.js +0 -56
- /package/es/{library/behaviours/field-validation/applications/interfaces/UseCaseDependencies.js → platform/zform/applications/interfaces/input/FieldBlurUsecaseInputModel.js} +0 -0
- /package/es/{library/behaviours/field-validation/applications/interfaces/gateways/IRepository.js → platform/zform/applications/interfaces/input/FocusFieldUseCaseInputModel.js} +0 -0
- /package/es/{library/behaviours/field-validation/applications/interfaces/gateways/IService.js → platform/zform/applications/interfaces/input/GetFieldErrorMessageInputModel.js} +0 -0
- /package/es/{library/behaviours/field-validation/applications/interfaces/input/FieldValidationInputModel.js → platform/zform/applications/interfaces/input/InsertValidationRuleInputModel.js} +0 -0
- /package/es/{library/behaviours/field-validation/domain/interfaces/IField.js → platform/zform/applications/interfaces/input/SubmitValidationCompletedUsecaseInputModel.js} +0 -0
- /package/es/{library/behaviours/field-validation/applications/interfaces/input/ValidateFieldsInputModel.js → platform/zform/applications/interfaces/input/ValidateFieldUseCaseInputModel.js} +0 -0
|
@@ -5,7 +5,7 @@ import FormPresenter from "../../adapters/presenter/FormPresenter";
|
|
|
5
5
|
import Service from "../../adapters/gateway/Service";
|
|
6
6
|
import LifeCycleEvents from "../../../../cc/component/LifeCycleEventsEnum";
|
|
7
7
|
import InitializeController from "../../adapters/controllers/IntializeController";
|
|
8
|
-
import { ZFORM_DEPENDENCY_MAPPINGS_REQUEST, ZFORM_DEPENDENCY_MAPPINGS_SUCCESS, ZFORM_FIELD_VALUE_CHANGE_REQUEST, ZFORM_MY_FORM_REQUEST, ZFORM_MY_FORM_SUCCESS, ZFORM_MY_LAYOUTS_SUCCESS, ZFORM_SET_FIELD_ERROR_MESSAGE, ZFORM_SUBMIT_SUCCESS,
|
|
8
|
+
import { ZFORM_DEPENDENCY_MAPPINGS_REQUEST, ZFORM_DEPENDENCY_MAPPINGS_SUCCESS, ZFORM_FIELD_VALUE_CHANGE_REQUEST, ZFORM_MY_FORM_REQUEST, ZFORM_MY_FORM_SUCCESS, ZFORM_MY_LAYOUTS_SUCCESS, ZFORM_SET_FIELD_ERROR_MESSAGE, ZFORM_SUBMIT_SUCCESS, ZFORM_SUBMIT_VALIDATION_COMPLETED, ZFORM_VALIDATE_FIELD_REQUEST, ZFORM_VALIDATION_RULES_REQUEST, ZFORM_VALIDATION_RULES_SUCCESS, ZFORM_VALIDATION_RULES_EXECUTION_RESULT } from "../../../../bc/zform/Symbol";
|
|
9
9
|
import MyLayoutSuccessController from "../../adapters/controllers/MyLayoutSuccessController";
|
|
10
10
|
import MyFormSuccessController from "../../adapters/controllers/MyFromSuccessController";
|
|
11
11
|
import DependenciesController from "../../adapters/controllers/DependenciesController";
|
|
@@ -20,21 +20,19 @@ import FieldValueChangeController from "../../adapters/controllers/FieldValueCha
|
|
|
20
20
|
import FormConstants from "../../../../cc/form/Constants";
|
|
21
21
|
import ValidateFieldRequestController from "../../adapters/controllers/ValidateFieldRequestController";
|
|
22
22
|
import FormValidator from "../validation-rules/Validator";
|
|
23
|
-
import { FIELD_VALIDATION_RESULT, VALIDATE_FIELDS_RESULT } from "../../../../bc/field-validation/Constants";
|
|
24
23
|
import SetFieldErrorMessageController from "../../adapters/controllers/SetFieldErrorMessageController";
|
|
25
24
|
import LayoutRuleApplier from "../layout-rules/LayoutRuleApplier";
|
|
26
|
-
import
|
|
27
|
-
import { CREATE_RECORD, RECORD_EXECUTE_FAIL_CALLBACK, RECORD_EXECUTE_SUCCESS_CALLBACK } from "../../../../bc/zrecord/Constants";
|
|
25
|
+
import { RECORD_EXECUTE_FAIL_CALLBACK, RECORD_EXECUTE_SUCCESS_CALLBACK } from "../../../../bc/zrecord/Constants";
|
|
28
26
|
import SmartFormConstants from "../../../../cc/form-connected/Constants";
|
|
27
|
+
import FieldBlurController from "../../adapters/controllers/FieldBlurController";
|
|
28
|
+
import SubmitValidationCompletedController from "../../adapters/controllers/SubmitValidationCompletedController";
|
|
29
|
+
import ValidationRulesExecutionResultController from "../../adapters/controllers/ValidationRulesExecutionResultController";
|
|
29
30
|
|
|
30
31
|
class EventHandlersFactory {
|
|
31
|
-
static create(
|
|
32
|
-
let {
|
|
33
|
-
customValidators
|
|
34
|
-
} = _ref;
|
|
32
|
+
static create() {
|
|
35
33
|
const presenter = new FormPresenter();
|
|
36
34
|
const repository = new FormRepository();
|
|
37
|
-
const validator = new FormValidator(
|
|
35
|
+
const validator = new FormValidator();
|
|
38
36
|
const layoutRuleApplier = new LayoutRuleApplier();
|
|
39
37
|
const service = new Service({
|
|
40
38
|
presenter,
|
|
@@ -56,25 +54,27 @@ class EventHandlersFactory {
|
|
|
56
54
|
const validateFieldRequestController = new ValidateFieldRequestController(service);
|
|
57
55
|
const formSubmitController = new FormSubmitController(service);
|
|
58
56
|
const setFieldErrorMessageController = new SetFieldErrorMessageController(service);
|
|
59
|
-
const
|
|
57
|
+
const fieldBlurController = new FieldBlurController(service);
|
|
58
|
+
const submitValidationCompletedController = new SubmitValidationCompletedController(service);
|
|
59
|
+
const validationRulesExecutionResultController = new ValidationRulesExecutionResultController(service);
|
|
60
60
|
return {
|
|
61
61
|
[LifeCycleEvents.MOUNT]: initializeController.handle,
|
|
62
62
|
[ZFORM_MY_LAYOUTS_SUCCESS]: myLayoutSuccessController.handle,
|
|
63
|
-
[RECORD_EXECUTE_SUCCESS_CALLBACK]:
|
|
63
|
+
[RECORD_EXECUTE_SUCCESS_CALLBACK]: _ref => {
|
|
64
64
|
let {
|
|
65
65
|
action,
|
|
66
66
|
dispatch
|
|
67
|
-
} =
|
|
67
|
+
} = _ref;
|
|
68
68
|
dispatch({
|
|
69
|
-
type:
|
|
69
|
+
type: ZFORM_SUBMIT_SUCCESS,
|
|
70
70
|
payload: action.payload
|
|
71
71
|
});
|
|
72
72
|
},
|
|
73
|
-
[RECORD_EXECUTE_FAIL_CALLBACK]:
|
|
73
|
+
[RECORD_EXECUTE_FAIL_CALLBACK]: _ref2 => {
|
|
74
74
|
let {
|
|
75
75
|
action,
|
|
76
76
|
dispatch
|
|
77
|
-
} =
|
|
77
|
+
} = _ref2;
|
|
78
78
|
dispatch({
|
|
79
79
|
type: "SMART_FORM#SUBMIT_FAILED",
|
|
80
80
|
payload: action.payload
|
|
@@ -93,144 +93,23 @@ class EventHandlersFactory {
|
|
|
93
93
|
[ZFORM_VALIDATE_FIELD_REQUEST]: validateFieldRequestController.handle,
|
|
94
94
|
[SmartFormConstants.SMART_FORM_SUBMIT_CLICKED]: formSubmitController.handle,
|
|
95
95
|
[ZFORM_SUBMIT]: formSubmitController.handle,
|
|
96
|
-
[
|
|
96
|
+
[FormConstants.FORM_SUBMIT]: _ref3 => {
|
|
97
97
|
let {
|
|
98
98
|
action,
|
|
99
|
-
state,
|
|
100
|
-
updateState,
|
|
101
99
|
dispatch
|
|
102
|
-
} =
|
|
103
|
-
let formData = action.payload.formData;
|
|
104
|
-
let moduleName = state.properties.moduleName;
|
|
105
|
-
let record = {
|
|
106
|
-
cf: {}
|
|
107
|
-
};
|
|
108
|
-
Object.keys(formData).forEach(key => {
|
|
109
|
-
if (key.startsWith("cf_")) {
|
|
110
|
-
record.cf[key] = formData[key];
|
|
111
|
-
} else {
|
|
112
|
-
record[key] = formData[key];
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
dispatch({
|
|
116
|
-
type: CREATE_RECORD,
|
|
117
|
-
payload: {
|
|
118
|
-
record,
|
|
119
|
-
moduleName: moduleName
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
},
|
|
123
|
-
[ZFORM_VALIDATION_ERROR]: _ref5 => {
|
|
124
|
-
let {
|
|
125
|
-
action,
|
|
126
|
-
state,
|
|
127
|
-
updateState,
|
|
128
|
-
dispatch
|
|
129
|
-
} = _ref5;
|
|
130
|
-
let formData = { ...state.behaviours.zform.formData
|
|
131
|
-
};
|
|
132
|
-
Object.keys(action.payload).forEach(key => {
|
|
133
|
-
dispatch({
|
|
134
|
-
type: ZFORM_SET_FIELD_ERROR_MESSAGE,
|
|
135
|
-
payload: {
|
|
136
|
-
fieldApiName: key,
|
|
137
|
-
errorMessage: action.payload[key].errorMessage
|
|
138
|
-
}
|
|
139
|
-
});
|
|
140
|
-
});
|
|
141
|
-
},
|
|
142
|
-
[ZFORM_VALIDATE_SUBMIT_FIELD_HAS_ERROR_MESSAGE]: validateErrorMessageController.handle,
|
|
143
|
-
[FIELD_VALIDATION_RESULT]: _ref6 => {
|
|
144
|
-
let {
|
|
145
|
-
action,
|
|
146
|
-
state,
|
|
147
|
-
updateState,
|
|
148
|
-
dispatch
|
|
149
|
-
} = _ref6;
|
|
150
|
-
let {
|
|
151
|
-
validationResult,
|
|
152
|
-
field
|
|
153
|
-
} = action.payload;
|
|
154
|
-
|
|
155
|
-
if (!validationResult.isValid) {
|
|
156
|
-
dispatch({
|
|
157
|
-
type: ZFORM_SET_FIELD_ERROR_MESSAGE,
|
|
158
|
-
payload: {
|
|
159
|
-
fieldApiName: field.apiName,
|
|
160
|
-
errorMessage: validationResult.message
|
|
161
|
-
}
|
|
162
|
-
});
|
|
163
|
-
} else {
|
|
164
|
-
dispatch({
|
|
165
|
-
type: ZFORM_SET_FIELD_ERROR_MESSAGE,
|
|
166
|
-
payload: {
|
|
167
|
-
fieldApiName: field.apiName,
|
|
168
|
-
errorMessage: ""
|
|
169
|
-
}
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
},
|
|
173
|
-
[VALIDATE_FIELDS_RESULT]: _ref7 => {
|
|
174
|
-
let {
|
|
175
|
-
action,
|
|
176
|
-
state,
|
|
177
|
-
updateState,
|
|
178
|
-
dispatch
|
|
179
|
-
} = _ref7;
|
|
180
|
-
let {
|
|
181
|
-
validationResults,
|
|
182
|
-
fields
|
|
183
|
-
} = action.payload;
|
|
184
|
-
let formData = { ...state.behaviours.zform.formData
|
|
185
|
-
};
|
|
186
|
-
validationResults.forEach((validationResult, index) => {
|
|
187
|
-
let field = fields[index];
|
|
188
|
-
|
|
189
|
-
if (!validationResult.isValid) {
|
|
190
|
-
dispatch({
|
|
191
|
-
type: ZFORM_SET_FIELD_ERROR_MESSAGE,
|
|
192
|
-
payload: {
|
|
193
|
-
fieldApiName: field.apiName,
|
|
194
|
-
errorMessage: validationResult.message
|
|
195
|
-
}
|
|
196
|
-
});
|
|
197
|
-
} else {
|
|
198
|
-
dispatch({
|
|
199
|
-
type: ZFORM_SET_FIELD_ERROR_MESSAGE,
|
|
200
|
-
payload: {
|
|
201
|
-
fieldApiName: field.apiName,
|
|
202
|
-
errorMessage: ""
|
|
203
|
-
}
|
|
204
|
-
});
|
|
205
|
-
}
|
|
206
|
-
});
|
|
207
|
-
},
|
|
208
|
-
[FormConstants.FORM_SUBMIT]: _ref8 => {
|
|
209
|
-
let {
|
|
210
|
-
action,
|
|
211
|
-
dispatch
|
|
212
|
-
} = _ref8;
|
|
100
|
+
} = _ref3;
|
|
213
101
|
dispatch({
|
|
214
102
|
type: ZFORM_SUBMIT
|
|
215
103
|
});
|
|
216
104
|
},
|
|
217
|
-
[FormConstants.FORM_FIELD_BLURRED]:
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
} = _ref9;
|
|
222
|
-
dispatch({
|
|
223
|
-
type: ZFORM_VALIDATE_FIELD_REQUEST,
|
|
224
|
-
payload: {
|
|
225
|
-
fieldName: action.payload.fieldName
|
|
226
|
-
}
|
|
227
|
-
});
|
|
228
|
-
},
|
|
229
|
-
[FormConstants.FORM_FIELD_VALUE_CHANGE_REQUEST]: _ref10 => {
|
|
105
|
+
[FormConstants.FORM_FIELD_BLURRED]: fieldBlurController.handle,
|
|
106
|
+
[ZFORM_VALIDATION_RULES_EXECUTION_RESULT]: validationRulesExecutionResultController.handle,
|
|
107
|
+
[ZFORM_SUBMIT_VALIDATION_COMPLETED]: submitValidationCompletedController.handle,
|
|
108
|
+
[FormConstants.FORM_FIELD_VALUE_CHANGE_REQUEST]: _ref4 => {
|
|
230
109
|
let {
|
|
231
110
|
action,
|
|
232
111
|
dispatch
|
|
233
|
-
} =
|
|
112
|
+
} = _ref4;
|
|
234
113
|
const {
|
|
235
114
|
sectionId,
|
|
236
115
|
fieldName,
|
|
@@ -2,16 +2,13 @@ import Properties from "../../../../bc/zform/Properties";
|
|
|
2
2
|
import EventHandlerFactory from "./EventHandlerFactory";
|
|
3
3
|
|
|
4
4
|
class ZFormBehaviourFactory {
|
|
5
|
-
static create(
|
|
6
|
-
let {
|
|
7
|
-
customValidators
|
|
8
|
-
} = _ref;
|
|
5
|
+
static create() {
|
|
9
6
|
return {
|
|
10
7
|
name: 'zform',
|
|
11
|
-
setInitialState:
|
|
8
|
+
setInitialState: _ref => {
|
|
12
9
|
let {
|
|
13
10
|
properties
|
|
14
|
-
} =
|
|
11
|
+
} = _ref;
|
|
15
12
|
return {
|
|
16
13
|
isMyFormFetching: true,
|
|
17
14
|
isDependencyFetching: true,
|
|
@@ -20,9 +17,7 @@ class ZFormBehaviourFactory {
|
|
|
20
17
|
};
|
|
21
18
|
},
|
|
22
19
|
properties: Properties,
|
|
23
|
-
eventHandlers: EventHandlerFactory.create(
|
|
24
|
-
customValidators
|
|
25
|
-
})
|
|
20
|
+
eventHandlers: EventHandlerFactory.create()
|
|
26
21
|
};
|
|
27
22
|
}
|
|
28
23
|
|
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
import { i18NProviderUtils } from '@zohodesk/i18n';
|
|
2
|
+
export function maxLengthValidation(_ref) {
|
|
3
|
+
let {
|
|
4
|
+
field,
|
|
5
|
+
value
|
|
6
|
+
} = _ref;
|
|
7
|
+
return new Promise(res => {
|
|
8
|
+
const {
|
|
9
|
+
i18NLabel,
|
|
10
|
+
maxLength
|
|
11
|
+
} = field;
|
|
12
|
+
const regexp = new RegExp(`^.{0,${maxLength}}$`);
|
|
13
|
+
|
|
14
|
+
if (!value || regexp.test(value)) {
|
|
15
|
+
res({
|
|
16
|
+
type: 'success'
|
|
17
|
+
});
|
|
18
|
+
} else {
|
|
19
|
+
res({
|
|
20
|
+
type: 'fail',
|
|
21
|
+
action: {
|
|
22
|
+
message: i18NProviderUtils.getI18NValue('support.form.more.than.max.length', [i18NLabel, maxLength])
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
export function emailValidation(_ref2) {
|
|
29
|
+
let {
|
|
30
|
+
field,
|
|
31
|
+
value
|
|
32
|
+
} = _ref2;
|
|
33
|
+
return new Promise(res => {
|
|
34
|
+
const {
|
|
35
|
+
i18NLabel
|
|
36
|
+
} = field;
|
|
37
|
+
const regexp = new RegExp(`^[\\wÀ-ž]([\\wÀ-ž\\-\\.\\+\\'\\&\\/]*)@([\\wÀ-ž\\-\\.]*)(\\.[a-zA-ZÀ-ž]{2,22}(\\.[a-zA-ZÀ-ž]{2}){0,2})$`);
|
|
38
|
+
|
|
39
|
+
if (!value || regexp.test(value)) {
|
|
40
|
+
res({
|
|
41
|
+
type: 'success'
|
|
42
|
+
});
|
|
43
|
+
} else {
|
|
44
|
+
res({
|
|
45
|
+
type: 'fail',
|
|
46
|
+
action: {
|
|
47
|
+
message: i18NProviderUtils.getI18NValue('crm.field.valid.check', [i18NLabel])
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
export function phoneValidation(_ref3) {
|
|
54
|
+
let {
|
|
55
|
+
field,
|
|
56
|
+
value
|
|
57
|
+
} = _ref3;
|
|
58
|
+
return new Promise(res => {
|
|
59
|
+
const {
|
|
60
|
+
i18NLabel
|
|
61
|
+
} = field;
|
|
62
|
+
const regexp = new RegExp(`^[0-9a-zA-Z_()\\+\\-\\.\\$@\\?\\,\\:\\'\\/\\!\\s]*$`);
|
|
63
|
+
|
|
64
|
+
if (!value || regexp.test(value)) {
|
|
65
|
+
res({
|
|
66
|
+
type: 'success'
|
|
67
|
+
});
|
|
68
|
+
} else {
|
|
69
|
+
res({
|
|
70
|
+
type: 'fail',
|
|
71
|
+
action: {
|
|
72
|
+
message: i18NProviderUtils.getI18NValue('crm.field.valid.check', [i18NLabel])
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
export function numberValidation(_ref4) {
|
|
79
|
+
let {
|
|
80
|
+
field,
|
|
81
|
+
value
|
|
82
|
+
} = _ref4;
|
|
83
|
+
return new Promise(res => {
|
|
84
|
+
const {
|
|
85
|
+
i18NLabel
|
|
86
|
+
} = field;
|
|
87
|
+
const regexp = new RegExp(`^-?\\d\\d*$`);
|
|
88
|
+
|
|
89
|
+
if (!value || regexp.test(value)) {
|
|
90
|
+
res({
|
|
91
|
+
type: 'success'
|
|
92
|
+
});
|
|
93
|
+
} else {
|
|
94
|
+
res({
|
|
95
|
+
type: 'fail',
|
|
96
|
+
action: {
|
|
97
|
+
message: i18NProviderUtils.getI18NValue('crm.field.valid.check', [i18NLabel])
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
export function decimalValidation(_ref5) {
|
|
104
|
+
let {
|
|
105
|
+
field,
|
|
106
|
+
value
|
|
107
|
+
} = _ref5;
|
|
108
|
+
return new Promise(res => {
|
|
109
|
+
const {
|
|
110
|
+
i18NLabel
|
|
111
|
+
} = field;
|
|
112
|
+
const regexp = new RegExp(`^-?[0-9]\\d*(|\\.\\d[0-9]*)$`);
|
|
113
|
+
|
|
114
|
+
if (!value || regexp.test(value)) {
|
|
115
|
+
res({
|
|
116
|
+
type: 'success'
|
|
117
|
+
});
|
|
118
|
+
} else {
|
|
119
|
+
res({
|
|
120
|
+
type: 'fail',
|
|
121
|
+
action: {
|
|
122
|
+
message: i18NProviderUtils.getI18NValue('crm.field.valid.check', [i18NLabel])
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
export function decimalPlacesValidation(_ref6) {
|
|
129
|
+
let {
|
|
130
|
+
field,
|
|
131
|
+
value
|
|
132
|
+
} = _ref6;
|
|
133
|
+
return new Promise(res => {
|
|
134
|
+
const {
|
|
135
|
+
decimalPlaces
|
|
136
|
+
} = field;
|
|
137
|
+
const regexp = new RegExp(`^\\d+(\\.\\d{0,${decimalPlaces}})?$`);
|
|
138
|
+
|
|
139
|
+
if (!value || regexp.test(value)) {
|
|
140
|
+
res({
|
|
141
|
+
type: 'success'
|
|
142
|
+
});
|
|
143
|
+
} else {
|
|
144
|
+
res({
|
|
145
|
+
type: 'fail',
|
|
146
|
+
action: {
|
|
147
|
+
message: i18NProviderUtils.getI18NValue('support.form.decimal.places.length.error.message', [decimalPlaces])
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
export function dateValidation(_ref7) {
|
|
154
|
+
let {
|
|
155
|
+
field,
|
|
156
|
+
value
|
|
157
|
+
} = _ref7;
|
|
158
|
+
|
|
159
|
+
function isValidDate(dateObj) {
|
|
160
|
+
if (dateObj == 'Invalid Date') {
|
|
161
|
+
return false;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
if (dateObj || dateObj instanceof Date && dateObj.getFullYear() > 1000) {
|
|
165
|
+
return true;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
return false;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
return new Promise(res => {
|
|
172
|
+
const {
|
|
173
|
+
i18NLabel
|
|
174
|
+
} = field;
|
|
175
|
+
|
|
176
|
+
if (!value || isValidDate(value)) {
|
|
177
|
+
res({
|
|
178
|
+
type: 'success'
|
|
179
|
+
});
|
|
180
|
+
} else {
|
|
181
|
+
res({
|
|
182
|
+
type: 'fail',
|
|
183
|
+
action: {
|
|
184
|
+
message: i18NProviderUtils.getI18NValue('crm.field.valid.check', [i18NLabel])
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
const validator = {
|
|
191
|
+
isEmpty(value) {
|
|
192
|
+
const valueType = typeof value;
|
|
193
|
+
|
|
194
|
+
if (valueType === 'string') {
|
|
195
|
+
return this.isEmptyString(value);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
if (Array.isArray(value)) {
|
|
199
|
+
return this.isEmptyArr(value);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
if (valueType === 'object') {
|
|
203
|
+
return this.isEmptyObj(value);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
if (valueType === 'boolean' || value) {
|
|
207
|
+
return false;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
return true;
|
|
211
|
+
},
|
|
212
|
+
|
|
213
|
+
isEmptyString(value) {
|
|
214
|
+
if (value && typeof value === 'string' && value.trim()) {
|
|
215
|
+
return false;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
return true;
|
|
219
|
+
},
|
|
220
|
+
|
|
221
|
+
isEmptyArr(value) {
|
|
222
|
+
if (Array.isArray(value) && value.length > 0) {
|
|
223
|
+
return false;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
return true;
|
|
227
|
+
},
|
|
228
|
+
|
|
229
|
+
isEmptyMultiSelect(value) {
|
|
230
|
+
if (!this.isEmpty(value) && !(value.length <= 2 && value.every(val => this.isNoneValue(val)))) {
|
|
231
|
+
return false;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
return true;
|
|
235
|
+
},
|
|
236
|
+
|
|
237
|
+
isEmptyPicklist(value) {
|
|
238
|
+
if (!this.isEmpty(value) && !this.isNoneValue(value)) {
|
|
239
|
+
return false;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
return true;
|
|
243
|
+
},
|
|
244
|
+
|
|
245
|
+
isEmptyObj(value) {
|
|
246
|
+
for (const key in value) {
|
|
247
|
+
if (value.hasOwnProperty(key)) {
|
|
248
|
+
return false;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
return true;
|
|
253
|
+
},
|
|
254
|
+
|
|
255
|
+
isNoneValue() {
|
|
256
|
+
let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
257
|
+
const inpVal = value.trim && value.trim();
|
|
258
|
+
const noneText = '-None-';
|
|
259
|
+
const i18nNoneValue = i18NProviderUtils.getI18NValue('-None-');
|
|
260
|
+
|
|
261
|
+
if (typeof inpVal === 'string' && (inpVal === noneText || inpVal === i18nNoneValue)) {
|
|
262
|
+
return true;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
return false;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
};
|
|
269
|
+
export function customMandatoryValidation(_ref8) {
|
|
270
|
+
let {
|
|
271
|
+
field,
|
|
272
|
+
value
|
|
273
|
+
} = _ref8;
|
|
274
|
+
return new Promise(res => {
|
|
275
|
+
const {
|
|
276
|
+
i18NLabel
|
|
277
|
+
} = field;
|
|
278
|
+
|
|
279
|
+
if (!validator.isEmpty(value)) {
|
|
280
|
+
res({
|
|
281
|
+
type: 'success'
|
|
282
|
+
});
|
|
283
|
+
} else {
|
|
284
|
+
res({
|
|
285
|
+
type: 'fail',
|
|
286
|
+
action: {
|
|
287
|
+
message: i18NProviderUtils.getI18NValue('crm.field.empty.check', [i18NLabel])
|
|
288
|
+
}
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
export function picklistMandatoryValidation(_ref9) {
|
|
294
|
+
let {
|
|
295
|
+
field,
|
|
296
|
+
value
|
|
297
|
+
} = _ref9;
|
|
298
|
+
return new Promise(res => {
|
|
299
|
+
const {
|
|
300
|
+
i18NLabel
|
|
301
|
+
} = field;
|
|
302
|
+
|
|
303
|
+
if (!validator.isEmptyPicklist(value)) {
|
|
304
|
+
res({
|
|
305
|
+
type: 'success'
|
|
306
|
+
});
|
|
307
|
+
} else {
|
|
308
|
+
res({
|
|
309
|
+
type: 'fail',
|
|
310
|
+
action: {
|
|
311
|
+
message: i18NProviderUtils.getI18NValue('crm.field.empty.check', [i18NLabel])
|
|
312
|
+
}
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
export function multiSelectMandatoryValidation(_ref10) {
|
|
318
|
+
let {
|
|
319
|
+
field,
|
|
320
|
+
value
|
|
321
|
+
} = _ref10;
|
|
322
|
+
return new Promise(res => {
|
|
323
|
+
const {
|
|
324
|
+
i18NLabel
|
|
325
|
+
} = field;
|
|
326
|
+
|
|
327
|
+
if (!validator.isEmptyMultiSelect(value)) {
|
|
328
|
+
res({
|
|
329
|
+
type: 'success'
|
|
330
|
+
});
|
|
331
|
+
} else {
|
|
332
|
+
res({
|
|
333
|
+
type: 'fail',
|
|
334
|
+
action: {
|
|
335
|
+
message: i18NProviderUtils.getI18NValue('crm.field.empty.check', [i18NLabel])
|
|
336
|
+
}
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
});
|
|
340
|
+
}
|