@zohodesk/library-platform 1.1.7 → 1.1.8-alpha.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/sdk/ResourceNamesEnum.js +1 -0
- package/es/bc/zfield/FieldApiTypes.js +20 -0
- package/es/bc/zform/Properties.js +9 -0
- package/es/bc/zform/Symbol.js +7 -0
- package/es/bc/zlist/Constants.js +3 -1
- package/es/bc/zlist/Properties.js +3 -0
- package/es/bc/zrecord/Constants.js +3 -0
- package/es/cc/date/Properties.js +9 -0
- package/es/cc/fields/field/FormDefaultUIType.js +1 -1
- 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/fields/text/Properties.js +9 -0
- package/es/cc/form/Properties.js +71 -0
- package/es/cc/form-connected/Constants.js +8 -0
- package/es/cc/form-connected/Properties.js +87 -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/table-connected/Properties.js +8 -0
- package/es/cc/table-connected/constants/Events.js +1 -0
- package/es/cc/textarea/Properties.js +11 -0
- package/es/cc/textbox/Properties.js +11 -0
- package/es/index.js +4 -2
- 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/action-location/usecases/interactors/PropertiesChangeUseCase.js +1 -1
- package/es/library/dot/components/form/adapters/presenter/TransformState.js +14 -54
- package/es/library/dot/components/form/frameworks/ui/DefaultComponentRegister.js +2 -5
- package/es/library/dot/components/form/frameworks/ui/FormView.js +21 -39
- package/es/library/dot/components/form/frameworks/ui/css/Form.module.css +29 -4
- 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 +19 -17
- 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/index.js +2 -1
- package/es/library/dot/components/form-fields/lookup/frameworks/ui/EventHandlerFactory.js +70 -0
- package/es/library/dot/components/form-fields/lookup/frameworks/ui/Lookup.js +13 -0
- package/es/library/dot/components/form-fields/lookup/frameworks/ui/LookupView.js +51 -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 +21 -18
- 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/section/frameworks/ui/SectionView.js +1 -1
- 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 +18 -1
- package/es/library/dot/legacy-to-new-arch/date/frameworks/ui/css/DateView.module.css +3 -0
- 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 +16 -12
- package/es/library/dot/legacy-to-new-arch/label/frameworks/ui/css/Label.module.css +3 -5
- package/es/library/dot/legacy-to-new-arch/multi-select/frameworks/ui/MultiSelectView.js +23 -3
- package/es/library/dot/legacy-to-new-arch/multi-select/frameworks/ui/css/MultiSelectView.module.css +37 -0
- 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 +23 -5
- package/es/library/dot/legacy-to-new-arch/text-area/frameworks/ui/css/TextAreaView.module.css +40 -0
- package/es/library/dot/legacy-to-new-arch/textbox/frameworks/ui/TextBoxView.js +13 -3
- package/es/platform/client-actions/bc/zclient-actions/SdkContract.js +35 -0
- package/es/platform/client-actions/behaviour/zclient-actions/adapters/resources/ClientActionResource.js +105 -0
- package/es/platform/client-actions/behaviour/zclient-actions/applications/usecases/GetClientActionLocationUseCase.js +20 -0
- package/es/platform/client-actions/behaviour/zclient-actions/applications/usecases/GetClientActionUIComponentPropertiesUseCase.js +20 -0
- package/es/platform/client-actions/behaviour/zclient-actions/applications/usecases/GetClientActionsUseCase.js +18 -0
- package/es/platform/client-actions/behaviour/zclient-actions/applications/usecases/UpdateClientActionUIComponentPropertiesUseCase.js +32 -0
- package/es/platform/client-actions/behaviour/zclient-actions/domain/entities/ClientAction.js +12 -0
- package/es/platform/client-actions/behaviour/zclient-actions/domain/entities/ClientActionManager.js +45 -0
- package/es/platform/client-actions/behaviour/zclient-actions/domain/entities/UIComponentMapping.js +10 -0
- package/es/platform/client-actions/behaviour/zclient-actions/frameworks/sdk/ClientActionsSDKFactory.js +29 -0
- package/es/platform/client-actions/cc/action-event-mediator/Properties.js +9 -0
- package/es/platform/client-actions/cc/dynamic-action-component/Properties.js +1 -1
- package/es/platform/client-actions/components/action-event-mediator/applications/usecases/PropertiesChangeUseCase.js +1 -1
- package/es/platform/client-actions/components/action-event-mediator/domain/entities/ActionEventMediatorEntity.js +7 -3
- package/es/platform/client-actions/components/action-event-mediator/frameworks/ui/ActionEventMediatorView.js +3 -1
- package/es/platform/client-actions/components/dynamic-component/frameworks/ui/DynamicActionComponentView.js +4 -2
- package/es/platform/client-actions/components/interfaces/ActionViewModel.js +1 -0
- package/es/platform/client-actions/components/row-actions-renderer/frameworks/ui/RowActionsRenderer.module.css +5 -1
- package/es/platform/client-actions/components/row-actions-renderer/frameworks/ui/RowActionsRendererView.js +4 -1
- package/es/platform/components/app/adapters/resources/AppResource.js +13 -0
- package/es/platform/components/form-connected/adapters/resources/SmartFormResources.js +88 -6
- package/es/platform/components/form-connected/frameworks/EventHandlersFactory.js +31 -58
- package/es/platform/components/form-connected/frameworks/FormConnectedFactory.js +6 -9
- package/es/platform/components/form-connected/frameworks/FormConnectedView.js +16 -2
- package/es/platform/components/form-connected/frameworks/FormSdkFactory.js +2 -2
- package/es/platform/components/table-connected/frameworks/EventHandlersFactory.js +17 -3
- package/es/platform/components/table-connected/frameworks/ListSdkFactory.js +2 -2
- package/es/platform/components/table-connected/frameworks/TableConnectedFactory.js +6 -1
- package/es/platform/data-source/http-template/deleteRecords.js +1 -1
- package/es/platform/data-source/http-template/fetchLookupFields.js +24 -0
- package/es/platform/data-source/http-template/fetchValidationRules.js +2 -1
- package/es/platform/data-source/http-template/getClientActions.js +2 -2
- package/es/platform/data-source/http-template/moveToTrash.js +28 -0
- package/es/platform/data-source/index.js +5 -1
- package/es/platform/data-source/utils/validation-rules/FieldConditions.js +167 -0
- package/es/platform/data-source/utils/validation-rules/TransFormValidationRules.js +98 -0
- package/es/platform/sdk/adapters/gateways/Service.js +4 -0
- package/es/platform/sdk/application/usecases/GetResourcesUseCase.js +12 -0
- package/es/platform/sdk/domain/entities/ResourceManager.js +21 -11
- package/es/platform/sdk/frameworks/Sdk.js +20 -2
- package/es/platform/sdk/frameworks/SdkRegistry.js +9 -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/LookupFieldController.js +23 -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 +19 -7
- package/es/platform/zform/adapters/presenter/FormTranslator.js +87 -5
- package/es/platform/zform/adapters/presenter/translators/SectionTranslator.js +61 -4
- 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 +7 -10
- 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 +130 -0
- 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/InitializeUseCase.js +16 -0
- package/es/platform/zform/applications/usecases/InsertValidationRuleSuccessUseCase.js +22 -0
- package/es/platform/zform/applications/usecases/LookupFieldSuccessUseCase.js +40 -0
- package/es/platform/zform/applications/usecases/MyFormSuccessUseCase.js +97 -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 +32 -7
- 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/layout-rules/calculateLayoutRulesResult.js +1 -1
- package/es/platform/zform/frameworks/layout-rules/runSingleFieldCondition.js +1 -1
- package/es/platform/zform/frameworks/layout-rules/validator.js +0 -1
- package/es/platform/zform/frameworks/ui/EventHandlerFactory.js +42 -138
- 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/adapters/presenters/TableTranslator.js +3 -2
- package/es/platform/zlist/applications/usecases/RecordSuccessCallbackUsecase.js +4 -1
- package/es/platform/zlist/domain/entities/List.js +11 -4
- package/es/platform/zrecord/adapters/controllers/SetRecordsController.js +7 -3
- package/es/platform/zrecord/applications/usecases/SetRecordsUseCase.js +11 -1
- package/package.json +11 -12
- 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/ValidationsEnum.js +0 -22
- 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/library/dot/legacy-to-new-arch/label/frameworks/ui/sub-components/ui/LabelAction.js +0 -9
- package/es/library/dot/legacy-to-new-arch/label/frameworks/ui/sub-components/ui/LabelActionView.js +0 -38
- package/es/library/dot/legacy-to-new-arch/label/frameworks/ui/sub-components/ui/css/LabelAction.module.css +0 -4
- package/es/platform/zform/adapters/controllers/ValidateErrorMessageController.js +0 -22
- 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/client-actions/behaviour/zclient-actions/applications/interfaces/IClientActionResource.js} +0 -0
- /package/es/{library/behaviours/field-validation/applications/interfaces/gateways/IRepository.js → platform/client-actions/behaviour/zclient-actions/applications/interfaces/input/GetClientActionLocationInputModel.js} +0 -0
- /package/es/{library/behaviours/field-validation/applications/interfaces/gateways/IService.js → platform/client-actions/behaviour/zclient-actions/applications/interfaces/input/GetClientActionUIComponentPropertiesInputModel.js} +0 -0
- /package/es/{library/behaviours/field-validation/applications/interfaces/input/FieldValidationInputModel.js → platform/client-actions/behaviour/zclient-actions/applications/interfaces/input/GetClientActionsInputModel.js} +0 -0
- /package/es/{library/behaviours/field-validation/applications/interfaces/input/ValidateFieldsInputModel.js → platform/client-actions/behaviour/zclient-actions/applications/interfaces/input/UpdateClientActionUIComponentPropertiesInputModel.js} +0 -0
- /package/es/{library/behaviours/field-validation/domain/interfaces/IFieldValidation.js → platform/zform/applications/interfaces/input/FieldBlurUsecaseInputModel.js} +0 -0
- /package/es/{library/behaviours/field-validation/domain/interfaces/IFieldViseValidation.js → platform/zform/applications/interfaces/input/FocusFieldUseCaseInputModel.js} +0 -0
- /package/es/{library/behaviours/field-validation/domain/interfaces/ValidationResult.js → platform/zform/applications/interfaces/input/GetFieldErrorMessageInputModel.js} +0 -0
- /package/es/{library/behaviours/field-validation/domain/interfaces/ValidationsArray.js → platform/zform/applications/interfaces/input/InsertValidationRuleInputModel.js} +0 -0
- /package/es/{library/behaviours/field-validation/domain/interfaces/ValidationsMap.js → platform/zform/applications/interfaces/input/LookUpFieldSuccessUseCaseInputModel.js} +0 -0
- /package/es/{library/behaviours/field-validation/domain/interfaces/IField.js → platform/zform/applications/interfaces/input/SubmitValidationCompletedUsecaseInputModel.js} +0 -0
- /package/es/platform/zform/applications/interfaces/input/{ValidateErrorMessageInputModel.js → ValidateFieldUseCaseInputModel.js} +0 -0
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { getLocalizedFunction } from "./localization_utils";
|
|
2
|
+
import { getNoneText } from "./formUtils";
|
|
3
|
+
import { parse, evaluateExpression } from "./expressionEval";
|
|
4
4
|
export function getMissedFields() {
|
|
5
5
|
let rules = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
6
6
|
let fieldMapper = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
7
|
-
|
|
7
|
+
const missedFields = []; // let missedFieldsDetail = {};
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
const allFieldNames = Object.keys(fieldMapper);
|
|
10
10
|
|
|
11
11
|
function pushMissedField(fieldDetails) {
|
|
12
|
-
|
|
12
|
+
const {
|
|
13
13
|
displayLabel,
|
|
14
14
|
fieldName
|
|
15
15
|
} = fieldDetails;
|
|
16
16
|
|
|
17
|
-
if (allFieldNames.indexOf(fieldName) === -1 && missedFields.indexOf(
|
|
17
|
+
if (allFieldNames.indexOf(fieldName) === -1 && missedFields.indexOf(displayLabel) === -1 && displayLabel) {
|
|
18
18
|
missedFields.push(displayLabel);
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
rules.forEach(rule => {
|
|
23
|
-
|
|
23
|
+
const {
|
|
24
24
|
fieldConditions = []
|
|
25
25
|
} = rule;
|
|
26
26
|
fieldConditions.forEach(fieldCondition => {
|
|
27
|
-
|
|
27
|
+
const {
|
|
28
28
|
conditions = [],
|
|
29
29
|
actions = {}
|
|
30
30
|
} = fieldCondition;
|
|
31
|
-
|
|
31
|
+
const {
|
|
32
32
|
setMandatoryFields = []
|
|
33
33
|
} = actions;
|
|
34
34
|
conditions.forEach(condition => {
|
|
@@ -41,27 +41,35 @@ export function getMissedFields() {
|
|
|
41
41
|
});
|
|
42
42
|
return missedFields;
|
|
43
43
|
}
|
|
44
|
-
export function getStatusMappingObj(statusMapping) {
|
|
45
|
-
|
|
44
|
+
export function getStatusMappingObj(statusMapping, moduleName) {
|
|
45
|
+
const mappingObj = {
|
|
46
46
|
open: [],
|
|
47
47
|
closed: [],
|
|
48
48
|
onhold: [],
|
|
49
49
|
completed: []
|
|
50
50
|
};
|
|
51
|
+
const getTranslatedVal = getLocalizedFunction({
|
|
52
|
+
moduleName,
|
|
53
|
+
apiName: 'status',
|
|
54
|
+
type: 'picklist'
|
|
55
|
+
});
|
|
51
56
|
statusMapping.forEach(status => {
|
|
52
|
-
|
|
57
|
+
const {
|
|
53
58
|
statusType,
|
|
54
59
|
name
|
|
55
60
|
} = status;
|
|
61
|
+
const transVal = getTranslatedVal({
|
|
62
|
+
fieldValue: name
|
|
63
|
+
});
|
|
56
64
|
|
|
57
65
|
if (statusType === 'Open') {
|
|
58
|
-
mappingObj.open.push(
|
|
66
|
+
mappingObj.open.push(transVal);
|
|
59
67
|
} else if (statusType === 'On Hold') {
|
|
60
|
-
mappingObj.onhold.push(
|
|
68
|
+
mappingObj.onhold.push(transVal);
|
|
61
69
|
} else if (statusType === 'Closed') {
|
|
62
|
-
mappingObj.closed.push(
|
|
70
|
+
mappingObj.closed.push(transVal);
|
|
63
71
|
} else if (statusType === 'Completed') {
|
|
64
|
-
mappingObj.completed.push(
|
|
72
|
+
mappingObj.completed.push(transVal);
|
|
65
73
|
}
|
|
66
74
|
});
|
|
67
75
|
return mappingObj;
|
|
@@ -71,8 +79,8 @@ function checkFieldsAvailableInForm() {
|
|
|
71
79
|
let conditions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
72
80
|
let fieldMapper = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
73
81
|
return conditions.every(condition => {
|
|
74
|
-
|
|
75
|
-
|
|
82
|
+
const allFieldNames = Object.keys(fieldMapper);
|
|
83
|
+
const {
|
|
76
84
|
fieldName
|
|
77
85
|
} = condition;
|
|
78
86
|
|
|
@@ -82,18 +90,11 @@ function checkFieldsAvailableInForm() {
|
|
|
82
90
|
|
|
83
91
|
return false;
|
|
84
92
|
});
|
|
85
|
-
}
|
|
86
|
-
// moduleEntityObj = {department: {}, contact:{}, account:{}, product:{}}
|
|
87
|
-
|
|
93
|
+
}
|
|
88
94
|
|
|
89
|
-
function getFieldValue(fieldId, fieldUIStates
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
apiName: fieldName
|
|
93
|
-
} = fieldDetails[fieldId];
|
|
94
|
-
let {
|
|
95
|
-
value,
|
|
96
|
-
createNew
|
|
95
|
+
function getFieldValue(fieldId, fieldUIStates) {
|
|
96
|
+
const {
|
|
97
|
+
value
|
|
97
98
|
} = fieldUIStates[fieldId];
|
|
98
99
|
return value;
|
|
99
100
|
}
|
|
@@ -104,322 +105,403 @@ function validateCondition() {
|
|
|
104
105
|
let value = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
|
105
106
|
let formValue = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
|
|
106
107
|
let statusMapping = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
108
|
+
formValue = formValue === null ? '' : formValue;
|
|
109
|
+
const Types = {
|
|
110
|
+
TEXT: 'Text',
|
|
111
|
+
EMAIL: 'Email',
|
|
112
|
+
PHONE: 'Phone',
|
|
113
|
+
URL: 'URL',
|
|
114
|
+
TEXTAREA: 'Textarea',
|
|
115
|
+
LOOKUP: 'LookUp',
|
|
116
|
+
NUMBER: 'Number',
|
|
117
|
+
PERCENT: 'Percent',
|
|
118
|
+
CURRENCY: 'Currency',
|
|
119
|
+
DECIMAL: 'Decimal',
|
|
120
|
+
BOOLEAN: 'Boolean',
|
|
121
|
+
DATETIME: 'DateTime',
|
|
122
|
+
DATE: 'Date',
|
|
123
|
+
PICKLIST: 'Picklist',
|
|
124
|
+
RADIO: 'Radio',
|
|
125
|
+
FAX: 'Fax',
|
|
126
|
+
MULTIPICKLIST: "Multiselect"
|
|
127
|
+
};
|
|
128
|
+
const COMMON_COMPARATORS = {
|
|
129
|
+
ISEMPTY: 'is empty',
|
|
130
|
+
ISNOTEMPTY: 'is not empty'
|
|
131
|
+
};
|
|
132
|
+
const TEXT_COMPARATORS = {
|
|
133
|
+
IS: 'is',
|
|
134
|
+
ISNT: "isn't",
|
|
135
|
+
STARTSWITH: 'starts with',
|
|
136
|
+
ENDSWITH: 'ends with',
|
|
137
|
+
CONTAINS: 'contains',
|
|
138
|
+
DOESNTCONTAIN: "doesn't contain"
|
|
139
|
+
};
|
|
140
|
+
const NUMBER_COMPARATORS = {
|
|
141
|
+
EQUAL: '=',
|
|
142
|
+
NOTEQUAL: '<>',
|
|
143
|
+
LESSTHAN: '<',
|
|
144
|
+
LESSTHANEQUAL: '<=',
|
|
145
|
+
GREATERTHAN: '>',
|
|
146
|
+
GREATERTHANEQUAL: '>='
|
|
147
|
+
};
|
|
148
|
+
const DATE_COMPARATORS = {
|
|
149
|
+
ISAFTER: 'is after',
|
|
150
|
+
ISBEFORE: 'is before',
|
|
151
|
+
BETWEEN: 'between',
|
|
152
|
+
NOTBETWEEN: 'not between'
|
|
153
|
+
};
|
|
154
|
+
const STATUS_COMPARATORS = {
|
|
155
|
+
ISOPEN: 'is OPEN',
|
|
156
|
+
ISONHOLD: 'is ON HOLD',
|
|
157
|
+
ISCLOSED: 'is CLOSED',
|
|
158
|
+
ISCOMPLETED: 'is COMPLETED'
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
function stringToRegex(str) {
|
|
162
|
+
const match = str.match(/^([\/~@;%#'])(.*?)\1([gimsuy]*)$/);
|
|
163
|
+
return match ? new RegExp(match[2], match[3].split('').filter((char, pos, flagArr) => flagArr.indexOf(char) === pos).join('')) : new RegExp(str);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
const getValueFromRegex = value => {
|
|
167
|
+
try {
|
|
168
|
+
const regexpattern = /^(?<regexName>([a-zA-Z0-9\_\-\(\)\[\])\s\.\,]*)):(\/\()(?<regex>[a-zA-Z0-9\!\@\#\$\%\^\&\*\(\)\_\+\-\=\`\~\[\]\{\}\;\:\'\"\,\.\/\<\>\?\\\|]*)(\)\/)$/;
|
|
169
|
+
const match = value.match(regexpattern);
|
|
170
|
+
return match;
|
|
171
|
+
} catch (err) {
|
|
172
|
+
throw err;
|
|
173
|
+
}
|
|
174
|
+
};
|
|
165
175
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
176
|
+
const validateText = function () {
|
|
177
|
+
let condition = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
178
|
+
let value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
179
|
+
let formValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
|
180
|
+
let matched = false;
|
|
181
|
+
let valueFromRegex = '';
|
|
182
|
+
|
|
183
|
+
if (condition === COMMON_COMPARATORS.ISEMPTY) {
|
|
184
|
+
matched = formValue === '';
|
|
185
|
+
} else if (condition === COMMON_COMPARATORS.ISNOTEMPTY) {
|
|
186
|
+
matched = formValue !== '';
|
|
187
|
+
} else {
|
|
188
|
+
valueFromRegex = getValueFromRegex(value);
|
|
189
|
+
|
|
190
|
+
if (valueFromRegex) {
|
|
191
|
+
value = value !== null ? value.trim() : '';
|
|
192
|
+
formValue = formValue !== null ? formValue.trim() : '';
|
|
170
193
|
} else {
|
|
171
194
|
value = value !== null ? value.toLowerCase().trim() : '';
|
|
172
195
|
formValue = formValue !== null ? formValue.toLowerCase().trim() : '';
|
|
196
|
+
}
|
|
173
197
|
|
|
174
|
-
|
|
175
|
-
|
|
198
|
+
if (formValue === '') {
|
|
199
|
+
return false;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
switch (condition) {
|
|
203
|
+
case TEXT_COMPARATORS.IS:
|
|
204
|
+
if (valueFromRegex && valueFromRegex.groups && valueFromRegex.groups.regexName && stringToRegex(`^${atob(valueFromRegex.groups.regex)}$`)) {
|
|
205
|
+
matched = new RegExp(stringToRegex(`^${atob(valueFromRegex.groups.regex)}$`), "u").test(formValue);
|
|
206
|
+
} else {
|
|
176
207
|
matched = formValue === value;
|
|
177
|
-
|
|
208
|
+
}
|
|
178
209
|
|
|
179
|
-
|
|
210
|
+
break;
|
|
211
|
+
|
|
212
|
+
case TEXT_COMPARATORS.ISNT:
|
|
213
|
+
if (valueFromRegex && valueFromRegex.groups && valueFromRegex.groups.regexName && stringToRegex(`^${atob(valueFromRegex.groups.regex)}$`)) {
|
|
214
|
+
matched = !new RegExp(stringToRegex(`^${atob(valueFromRegex.groups.regex)}$`), "u").test(formValue);
|
|
215
|
+
} else {
|
|
180
216
|
matched = formValue !== value;
|
|
181
|
-
|
|
217
|
+
}
|
|
182
218
|
|
|
183
|
-
|
|
184
|
-
matched = formValue.startsWith(value);
|
|
185
|
-
break;
|
|
219
|
+
break;
|
|
186
220
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
221
|
+
case TEXT_COMPARATORS.STARTSWITH:
|
|
222
|
+
matched = formValue.startsWith(value);
|
|
223
|
+
break;
|
|
224
|
+
|
|
225
|
+
case TEXT_COMPARATORS.ENDSWITH:
|
|
226
|
+
matched = formValue.endsWith(value);
|
|
227
|
+
break;
|
|
190
228
|
|
|
191
|
-
|
|
229
|
+
case TEXT_COMPARATORS.CONTAINS:
|
|
230
|
+
if (valueFromRegex && valueFromRegex.groups && valueFromRegex.groups.regexName && stringToRegex(`${atob(valueFromRegex.groups.regex)}`)) {
|
|
231
|
+
matched = new RegExp(stringToRegex(atob(valueFromRegex.groups.regex)), "u").test(formValue);
|
|
232
|
+
} else {
|
|
192
233
|
matched = formValue.indexOf(value) !== -1;
|
|
193
|
-
|
|
234
|
+
}
|
|
194
235
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
236
|
+
break;
|
|
237
|
+
|
|
238
|
+
case TEXT_COMPARATORS.DOESNTCONTAIN:
|
|
239
|
+
matched = formValue.indexOf(value) === -1;
|
|
240
|
+
break;
|
|
199
241
|
}
|
|
242
|
+
}
|
|
200
243
|
|
|
201
|
-
|
|
202
|
-
|
|
244
|
+
return matched;
|
|
245
|
+
};
|
|
203
246
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
247
|
+
const validateNumber = function () {
|
|
248
|
+
let condition = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
249
|
+
let value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
250
|
+
let formValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
|
251
|
+
let matched = false;
|
|
209
252
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
253
|
+
if (condition === COMMON_COMPARATORS.ISEMPTY) {
|
|
254
|
+
matched = formValue === '';
|
|
255
|
+
} else if (condition === COMMON_COMPARATORS.ISNOTEMPTY) {
|
|
256
|
+
matched = formValue !== '';
|
|
257
|
+
} else {
|
|
258
|
+
if (formValue === '') {
|
|
259
|
+
return false;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
value = parseFloat(value);
|
|
263
|
+
formValue = parseFloat(formValue);
|
|
264
|
+
|
|
265
|
+
switch (condition) {
|
|
266
|
+
case NUMBER_COMPARATORS.EQUAL:
|
|
267
|
+
matched = formValue === value;
|
|
268
|
+
break;
|
|
269
|
+
|
|
270
|
+
case NUMBER_COMPARATORS.NOTEQUAL:
|
|
271
|
+
matched = formValue !== value;
|
|
272
|
+
break;
|
|
273
|
+
|
|
274
|
+
case NUMBER_COMPARATORS.LESSTHAN:
|
|
275
|
+
matched = formValue < value;
|
|
276
|
+
break;
|
|
277
|
+
|
|
278
|
+
case NUMBER_COMPARATORS.LESSTHANEQUAL:
|
|
279
|
+
matched = formValue <= value;
|
|
280
|
+
break;
|
|
281
|
+
|
|
282
|
+
case NUMBER_COMPARATORS.GREATERTHAN:
|
|
283
|
+
matched = formValue > value;
|
|
284
|
+
break;
|
|
285
|
+
|
|
286
|
+
case NUMBER_COMPARATORS.GREATERTHANEQUAL:
|
|
287
|
+
matched = formValue >= value;
|
|
288
|
+
break;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
return matched;
|
|
293
|
+
};
|
|
294
|
+
|
|
295
|
+
const validateBoolean = function () {
|
|
296
|
+
let condition = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
297
|
+
let value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
298
|
+
let formValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
|
299
|
+
formValue = String(formValue) || 'false';
|
|
300
|
+
value = String(value) || 'false';
|
|
301
|
+
let matched = false;
|
|
218
302
|
|
|
219
|
-
|
|
220
|
-
|
|
303
|
+
switch (condition) {
|
|
304
|
+
case TEXT_COMPARATORS.IS:
|
|
305
|
+
matched = formValue === value;
|
|
306
|
+
break;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
return matched;
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
const validateDate = function () {
|
|
313
|
+
let condition = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
314
|
+
let value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
315
|
+
let formValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
|
316
|
+
let matched = false;
|
|
317
|
+
|
|
318
|
+
if (condition === COMMON_COMPARATORS.ISEMPTY) {
|
|
319
|
+
matched = formValue === '';
|
|
320
|
+
} else if (condition === COMMON_COMPARATORS.ISNOTEMPTY) {
|
|
321
|
+
matched = formValue !== '';
|
|
322
|
+
} else {
|
|
323
|
+
if (formValue === '') {
|
|
324
|
+
return false;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
formValue = new Date(formValue);
|
|
328
|
+
|
|
329
|
+
if (condition === DATE_COMPARATORS.BETWEEN || condition === DATE_COMPARATORS.NOTBETWEEN) {
|
|
330
|
+
const beforeVal = new Date(value[0]);
|
|
331
|
+
const afterVal = new Date(value[1]);
|
|
221
332
|
|
|
222
333
|
switch (condition) {
|
|
223
|
-
case
|
|
224
|
-
matched = formValue
|
|
334
|
+
case DATE_COMPARATORS.BETWEEN:
|
|
335
|
+
matched = formValue.getTime() - beforeVal.getTime() >= 0 && formValue.getTime() - afterVal.getTime() <= 0;
|
|
225
336
|
break;
|
|
226
337
|
|
|
227
|
-
case
|
|
228
|
-
matched = formValue
|
|
338
|
+
case DATE_COMPARATORS.NOTBETWEEN:
|
|
339
|
+
matched = !(formValue.getTime() - beforeVal.getTime() >= 0 && formValue.getTime() - afterVal.getTime() <= 0);
|
|
229
340
|
break;
|
|
341
|
+
}
|
|
342
|
+
} else {
|
|
343
|
+
value = new Date(value);
|
|
230
344
|
|
|
231
|
-
|
|
232
|
-
|
|
345
|
+
switch (condition) {
|
|
346
|
+
case TEXT_COMPARATORS.IS:
|
|
347
|
+
matched = formValue.getTime() - value.getTime() === 0;
|
|
233
348
|
break;
|
|
234
349
|
|
|
235
|
-
case
|
|
236
|
-
matched = formValue
|
|
350
|
+
case TEXT_COMPARATORS.ISNT:
|
|
351
|
+
matched = formValue !== '' && formValue.getTime() - value.getTime() !== 0;
|
|
237
352
|
break;
|
|
238
353
|
|
|
239
|
-
case
|
|
240
|
-
matched = formValue >
|
|
354
|
+
case DATE_COMPARATORS.ISAFTER:
|
|
355
|
+
matched = formValue.getTime() - value.getTime() > 0;
|
|
241
356
|
break;
|
|
242
357
|
|
|
243
|
-
case
|
|
244
|
-
matched = formValue
|
|
358
|
+
case DATE_COMPARATORS.ISBEFORE:
|
|
359
|
+
matched = formValue.getTime() - value.getTime() < 0;
|
|
245
360
|
break;
|
|
246
361
|
}
|
|
247
362
|
}
|
|
363
|
+
}
|
|
248
364
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
const validateBoolean = function () {
|
|
253
|
-
let condition = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
254
|
-
let value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
255
|
-
let formValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
|
256
|
-
formValue = String(formValue) || 'false';
|
|
257
|
-
value = String(value) || 'false';
|
|
258
|
-
let matched = false;
|
|
259
|
-
|
|
260
|
-
switch (condition) {
|
|
261
|
-
case TEXT_COMPARATORS.IS:
|
|
262
|
-
matched = formValue === value;
|
|
263
|
-
break;
|
|
264
|
-
}
|
|
365
|
+
return matched;
|
|
366
|
+
};
|
|
265
367
|
|
|
266
|
-
|
|
267
|
-
|
|
368
|
+
const validatePicklist = function () {
|
|
369
|
+
let condition = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
370
|
+
let value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
371
|
+
let formValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
|
372
|
+
let statusMapping = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
268
373
|
|
|
269
|
-
|
|
270
|
-
let condition = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
271
|
-
let value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
272
|
-
let formValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
|
374
|
+
if ([STATUS_COMPARATORS.ISOPEN, STATUS_COMPARATORS.ISONHOLD, STATUS_COMPARATORS.ISCLOSED, STATUS_COMPARATORS.ISCOMPLETED].indexOf(condition) !== -1) {
|
|
273
375
|
let matched = false;
|
|
274
376
|
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
} else {
|
|
280
|
-
if (formValue === '') {
|
|
281
|
-
return false;
|
|
282
|
-
}
|
|
377
|
+
switch (condition) {
|
|
378
|
+
case STATUS_COMPARATORS.ISOPEN:
|
|
379
|
+
matched = statusMapping.open.indexOf(formValue) !== -1;
|
|
380
|
+
break;
|
|
283
381
|
|
|
284
|
-
|
|
382
|
+
case STATUS_COMPARATORS.ISONHOLD:
|
|
383
|
+
matched = statusMapping.onhold.indexOf(formValue) !== -1;
|
|
384
|
+
break;
|
|
285
385
|
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
386
|
+
case STATUS_COMPARATORS.ISCLOSED:
|
|
387
|
+
matched = statusMapping.closed.indexOf(formValue) !== -1;
|
|
388
|
+
break;
|
|
289
389
|
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
390
|
+
case STATUS_COMPARATORS.ISCOMPLETED:
|
|
391
|
+
matched = statusMapping.completed.indexOf(formValue) !== -1;
|
|
392
|
+
break;
|
|
393
|
+
}
|
|
294
394
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
break;
|
|
298
|
-
}
|
|
299
|
-
} else {
|
|
300
|
-
value = new Date(value);
|
|
395
|
+
return matched;
|
|
396
|
+
}
|
|
301
397
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
398
|
+
const {
|
|
399
|
+
valueNoneText: noneText
|
|
400
|
+
} = getNoneText();
|
|
401
|
+
formValue = formValue === noneText ? '' : formValue;
|
|
402
|
+
return validateText(condition, value, formValue);
|
|
403
|
+
};
|
|
306
404
|
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
405
|
+
const getRelatedDateISOString = (dateValue, isDateField) => {
|
|
406
|
+
if (dateValue === '${CURRENTTIME}') {
|
|
407
|
+
const currentDateObj = new Date();
|
|
408
|
+
dateValue = currentDateObj.toISOString();
|
|
409
|
+
}
|
|
310
410
|
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
411
|
+
if (isDateField) {
|
|
412
|
+
dateValue += 'T00:00:00.000Z';
|
|
413
|
+
} else {
|
|
414
|
+
const dateObj = new Date(dateValue);
|
|
415
|
+
dateObj.setSeconds(0);
|
|
416
|
+
dateObj.setMilliseconds(0);
|
|
417
|
+
dateValue = dateObj.toISOString();
|
|
418
|
+
}
|
|
314
419
|
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
break;
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
}
|
|
420
|
+
return dateValue;
|
|
421
|
+
};
|
|
321
422
|
|
|
322
|
-
|
|
323
|
-
|
|
423
|
+
const validateMultipicklist = function () {
|
|
424
|
+
let condition = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
425
|
+
let value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
426
|
+
let formValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
427
|
+
const indexOfNone = (formValues || []).indexOf("-None-");
|
|
324
428
|
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
let formValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
|
329
|
-
let statusMapping = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
429
|
+
if (indexOfNone > -1) {
|
|
430
|
+
formValues.splice(indexOfNone, 1);
|
|
431
|
+
}
|
|
330
432
|
|
|
331
|
-
|
|
332
|
-
let matched = false;
|
|
433
|
+
let normalizedFormValue = formValues || [];
|
|
333
434
|
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
break;
|
|
435
|
+
if (condition === COMMON_COMPARATORS.ISEMPTY) {
|
|
436
|
+
return normalizedFormValue.length === 0;
|
|
437
|
+
}
|
|
338
438
|
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
439
|
+
if (condition === COMMON_COMPARATORS.ISNOTEMPTY) {
|
|
440
|
+
return normalizedFormValue.length !== 0;
|
|
441
|
+
}
|
|
342
442
|
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
443
|
+
normalizedFormValue = Array.isArray(normalizedFormValue) ? normalizedFormValue : [normalizedFormValue];
|
|
444
|
+
return normalizedFormValue.some(formValue => validateText(condition, value, formValue) === true);
|
|
445
|
+
};
|
|
346
446
|
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
447
|
+
switch (type) {
|
|
448
|
+
case Types.TEXT:
|
|
449
|
+
case Types.EMAIL:
|
|
450
|
+
case Types.PHONE:
|
|
451
|
+
case Types.URL:
|
|
452
|
+
case Types.TEXTAREA:
|
|
453
|
+
case Types.LOOKUP:
|
|
454
|
+
case Types.FAX:
|
|
455
|
+
return validateText(condition, value, formValue);
|
|
351
456
|
|
|
352
|
-
|
|
353
|
-
|
|
457
|
+
case Types.MULTIPICKLIST:
|
|
458
|
+
return validateMultipicklist(condition, value, formValue);
|
|
354
459
|
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
460
|
+
case Types.NUMBER:
|
|
461
|
+
case Types.PERCENT:
|
|
462
|
+
case Types.CURRENCY:
|
|
463
|
+
case Types.DECIMAL:
|
|
464
|
+
return validateNumber(condition, value, formValue);
|
|
358
465
|
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
let currentDateObj = new Date();
|
|
362
|
-
dateValue = currentDateObj.toISOString();
|
|
363
|
-
}
|
|
466
|
+
case Types.BOOLEAN:
|
|
467
|
+
return validateBoolean(condition, value, formValue);
|
|
364
468
|
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
dateObj.setSeconds(0);
|
|
370
|
-
dateObj.setMilliseconds(0);
|
|
371
|
-
dateValue = dateObj.toISOString();
|
|
372
|
-
}
|
|
469
|
+
case Types.DATETIME:
|
|
470
|
+
case Types.DATE:
|
|
471
|
+
if (condition !== COMMON_COMPARATORS.ISNOTEMPTY && condition !== COMMON_COMPARATORS.ISEMPTY) {
|
|
472
|
+
const isDateField = type === Types.DATE;
|
|
373
473
|
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
case Types.EMAIL:
|
|
380
|
-
case Types.PHONE:
|
|
381
|
-
case Types.URL:
|
|
382
|
-
case Types.TEXTAREA:
|
|
383
|
-
case Types.LOOKUP:
|
|
384
|
-
case Types.FAX:
|
|
385
|
-
return validateText(condition, value, formValue);
|
|
386
|
-
|
|
387
|
-
case Types.NUMBER:
|
|
388
|
-
case Types.PERCENT:
|
|
389
|
-
case Types.CURRENCY:
|
|
390
|
-
case Types.DECIMAL:
|
|
391
|
-
return validateNumber(condition, value, formValue);
|
|
392
|
-
|
|
393
|
-
case Types.BOOLEAN:
|
|
394
|
-
return validateBoolean(condition, value, formValue);
|
|
395
|
-
|
|
396
|
-
case Types.DATETIME:
|
|
397
|
-
case Types.DATE:
|
|
398
|
-
if (condition !== COMMON_COMPARATORS.ISNOTEMPTY && condition !== COMMON_COMPARATORS.ISEMPTY) {
|
|
399
|
-
if (type === Types.DATE) {
|
|
400
|
-
value = getRelatedDateISOString(value, true);
|
|
401
|
-
} else {
|
|
402
|
-
if (condition === DATE_COMPARATORS.BETWEEN || condition === DATE_COMPARATORS.NOTBETWEEN) {
|
|
403
|
-
value[0] = getRelatedDateISOString(value[0], false);
|
|
404
|
-
value[1] = getRelatedDateISOString(value[1], false);
|
|
405
|
-
} else {
|
|
406
|
-
value = getRelatedDateISOString(value, false);
|
|
407
|
-
}
|
|
408
|
-
}
|
|
474
|
+
if (condition === DATE_COMPARATORS.BETWEEN || condition === DATE_COMPARATORS.NOTBETWEEN) {
|
|
475
|
+
value[0] = getRelatedDateISOString(value[0], isDateField);
|
|
476
|
+
value[1] = getRelatedDateISOString(value[1], isDateField);
|
|
477
|
+
} else {
|
|
478
|
+
value = getRelatedDateISOString(value, isDateField);
|
|
409
479
|
}
|
|
480
|
+
}
|
|
410
481
|
|
|
411
|
-
|
|
482
|
+
return validateDate(condition, value, formValue);
|
|
412
483
|
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
484
|
+
case Types.PICKLIST:
|
|
485
|
+
case Types.RADIO:
|
|
486
|
+
return validatePicklist(condition, value, formValue, statusMapping);
|
|
416
487
|
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
}
|
|
488
|
+
default:
|
|
489
|
+
return false;
|
|
420
490
|
}
|
|
421
491
|
}
|
|
422
492
|
|
|
493
|
+
function getConditionType(condition, fieldMapper, fieldDetails) {
|
|
494
|
+
const {
|
|
495
|
+
fieldName,
|
|
496
|
+
conditionType
|
|
497
|
+
} = condition;
|
|
498
|
+
const fieldId = fieldMapper[fieldName];
|
|
499
|
+
const {
|
|
500
|
+
type: fieldType
|
|
501
|
+
} = fieldDetails[fieldId];
|
|
502
|
+
return conditionType || fieldType;
|
|
503
|
+
}
|
|
504
|
+
|
|
423
505
|
function getConditionsMatchedResult() {
|
|
424
506
|
let conditions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
425
507
|
let fieldUIStates = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
@@ -427,27 +509,28 @@ function getConditionsMatchedResult() {
|
|
|
427
509
|
let fieldDetails = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
428
510
|
let statusMapping = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : [];
|
|
429
511
|
let moduleEntityObj = arguments.length > 5 ? arguments[5] : undefined;
|
|
430
|
-
|
|
512
|
+
const result = {};
|
|
431
513
|
|
|
432
514
|
if (!checkFieldsAvailableInForm(conditions, fieldMapper)) {
|
|
433
515
|
return result;
|
|
434
516
|
}
|
|
435
517
|
|
|
436
518
|
conditions.forEach((condition, conditionIndex) => {
|
|
437
|
-
|
|
519
|
+
const {
|
|
438
520
|
fieldName,
|
|
439
521
|
condition: conditionName,
|
|
440
522
|
value: values = []
|
|
441
523
|
} = condition;
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
} = fieldDetails[fieldId];
|
|
446
|
-
let formValue = getFieldValue(fieldId, fieldUIStates, fieldDetails, moduleEntityObj);
|
|
524
|
+
const fieldId = fieldMapper[fieldName];
|
|
525
|
+
const fieldType = getConditionType(condition, fieldMapper, fieldDetails);
|
|
526
|
+
const formValue = getFieldValue(fieldId, fieldUIStates);
|
|
447
527
|
let matched = false;
|
|
448
528
|
|
|
449
529
|
if (conditionName === 'between' || conditionName === 'not between') {
|
|
450
|
-
matched = validateCondition(fieldType, conditionName, values, formValue, statusMapping);
|
|
530
|
+
matched = validateCondition(fieldType, conditionName, [...values], formValue, statusMapping);
|
|
531
|
+
} else if (["isn't", "doesn't contain"].indexOf(conditionName) !== -1) {
|
|
532
|
+
const matchedList = values.filter(val => validateCondition(fieldType, conditionName, val, formValue, statusMapping));
|
|
533
|
+
matched = matchedList.length === values.length;
|
|
451
534
|
} else {
|
|
452
535
|
matched = values.some(value => {
|
|
453
536
|
if (validateCondition(fieldType, conditionName, value, formValue, statusMapping)) {
|
|
@@ -463,30 +546,6 @@ function getConditionsMatchedResult() {
|
|
|
463
546
|
return result;
|
|
464
547
|
}
|
|
465
548
|
|
|
466
|
-
function validatePattern() {
|
|
467
|
-
let pattern = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
468
|
-
let matchedResult = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
469
|
-
|
|
470
|
-
let evalExpression = pattern => Function(`return (${pattern})`);
|
|
471
|
-
|
|
472
|
-
pattern = pattern.replace(/and/g, '&&').replace(/or/g, '||');
|
|
473
|
-
let newPattern = '';
|
|
474
|
-
let patternLen = pattern.length;
|
|
475
|
-
|
|
476
|
-
for (let i = 0; i < patternLen; i++) {
|
|
477
|
-
let char = pattern[i];
|
|
478
|
-
|
|
479
|
-
if (char !== '(' && char !== ')' && char !== '&' && char !== '|') {
|
|
480
|
-
char = parseInt(char);
|
|
481
|
-
char = matchedResult[char] || false;
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
newPattern += char;
|
|
485
|
-
}
|
|
486
|
-
|
|
487
|
-
return evalExpression(newPattern)();
|
|
488
|
-
}
|
|
489
|
-
|
|
490
549
|
export function getPassedFormRules() {
|
|
491
550
|
let rules = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
492
551
|
let fieldUIStates = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
@@ -494,55 +553,47 @@ export function getPassedFormRules() {
|
|
|
494
553
|
let fieldDetails = arguments.length > 3 ? arguments[3] : undefined;
|
|
495
554
|
let statusMapping = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : [];
|
|
496
555
|
let moduleEntityObj = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {};
|
|
497
|
-
let
|
|
498
|
-
|
|
556
|
+
let customValidationRunner = arguments.length > 6 ? arguments[6] : undefined;
|
|
557
|
+
const passedRules = [];
|
|
499
558
|
statusMapping = getStatusMappingObj(statusMapping);
|
|
500
559
|
rules.forEach(rule => {
|
|
501
|
-
|
|
502
|
-
|
|
560
|
+
const allFieldNames = Object.keys(fieldMapper);
|
|
561
|
+
const {
|
|
503
562
|
fieldName,
|
|
504
563
|
fieldConditions
|
|
505
564
|
} = rule;
|
|
506
565
|
|
|
507
566
|
if (allFieldNames.indexOf(fieldName) !== -1) {
|
|
508
567
|
fieldConditions.forEach(fieldCondition => {
|
|
568
|
+
if (fieldCondition.validator) {
|
|
569
|
+
const promisedResult = customValidationRunner({
|
|
570
|
+
fieldCondition,
|
|
571
|
+
fieldName
|
|
572
|
+
});
|
|
573
|
+
passedRules.push(promisedResult);
|
|
574
|
+
return;
|
|
575
|
+
}
|
|
576
|
+
|
|
509
577
|
let {
|
|
510
|
-
|
|
511
|
-
|
|
578
|
+
pattern
|
|
579
|
+
} = fieldCondition;
|
|
580
|
+
const {
|
|
512
581
|
actions,
|
|
513
|
-
|
|
582
|
+
conditions
|
|
514
583
|
} = fieldCondition;
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
actions
|
|
529
|
-
};
|
|
530
|
-
passedRules.push(obj);
|
|
531
|
-
}
|
|
532
|
-
}
|
|
533
|
-
} else {
|
|
534
|
-
let matchedResult = getConditionsMatchedResult(conditions, fieldUIStates, fieldMapper, fieldDetails, statusMapping, moduleEntityObj);
|
|
535
|
-
|
|
536
|
-
if (Object.keys(matchedResult).length > 0) {
|
|
537
|
-
let isValid = validatePattern(pattern, matchedResult);
|
|
538
|
-
|
|
539
|
-
if (isValid) {
|
|
540
|
-
let obj = {
|
|
541
|
-
fieldName,
|
|
542
|
-
actions
|
|
543
|
-
};
|
|
544
|
-
passedRules.push(obj);
|
|
545
|
-
}
|
|
584
|
+
const matchedResult = getConditionsMatchedResult(conditions, fieldUIStates, fieldMapper, fieldDetails, statusMapping, moduleEntityObj);
|
|
585
|
+
|
|
586
|
+
if (Object.keys(matchedResult).length > 0) {
|
|
587
|
+
pattern = pattern.replace(/and/g, '&&').replace(/or/g, '||');
|
|
588
|
+
const ast = parse(pattern);
|
|
589
|
+
const isValid = evaluateExpression(ast, matchedResult);
|
|
590
|
+
|
|
591
|
+
if (isValid) {
|
|
592
|
+
const obj = {
|
|
593
|
+
fieldName,
|
|
594
|
+
actions
|
|
595
|
+
};
|
|
596
|
+
passedRules.push(obj);
|
|
546
597
|
}
|
|
547
598
|
}
|
|
548
599
|
});
|