@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.
Files changed (307) hide show
  1. package/es/bc/sdk/ResourceNamesEnum.js +1 -0
  2. package/es/bc/zfield/FieldApiTypes.js +20 -0
  3. package/es/bc/zform/Properties.js +9 -0
  4. package/es/bc/zform/Symbol.js +7 -0
  5. package/es/bc/zlist/Constants.js +3 -1
  6. package/es/bc/zlist/Properties.js +3 -0
  7. package/es/bc/zrecord/Constants.js +3 -0
  8. package/es/cc/date/Properties.js +9 -0
  9. package/es/cc/fields/field/FormDefaultUIType.js +1 -1
  10. package/es/cc/fields/field/Properties.js +63 -0
  11. package/es/cc/fields/multi-select/Properties.js +9 -0
  12. package/es/cc/fields/pick-list/Properties.js +9 -0
  13. package/es/cc/fields/text/Properties.js +9 -0
  14. package/es/cc/form/Properties.js +71 -0
  15. package/es/cc/form-connected/Constants.js +8 -0
  16. package/es/cc/form-connected/Properties.js +87 -0
  17. package/es/cc/form-connected/SdkContract.js +61 -0
  18. package/es/cc/form-connected/index.js +2 -0
  19. package/es/cc/highlighted-value/Properties.js +10 -0
  20. package/es/cc/index.js +1 -1
  21. package/es/cc/multi-select/Properties.js +9 -0
  22. package/es/cc/select/Properties.js +12 -0
  23. package/es/cc/table-connected/Properties.js +8 -0
  24. package/es/cc/table-connected/constants/Events.js +1 -0
  25. package/es/cc/textarea/Properties.js +11 -0
  26. package/es/cc/textbox/Properties.js +11 -0
  27. package/es/index.js +4 -2
  28. package/es/library/behaviours/field-focus/frameworks/ui/EventHandlersFactory.js +26 -0
  29. package/es/library/behaviours/field-focus/frameworks/ui/FocusFieldBehaviourFactory.js +20 -0
  30. package/es/library/dot/components/action-location/frameworks/ui/ActionComponentMapping.js +3 -1
  31. package/es/library/dot/components/action-location/usecases/interactors/PropertiesChangeUseCase.js +1 -1
  32. package/es/library/dot/components/form/adapters/presenter/TransformState.js +14 -54
  33. package/es/library/dot/components/form/frameworks/ui/DefaultComponentRegister.js +2 -5
  34. package/es/library/dot/components/form/frameworks/ui/FormView.js +21 -39
  35. package/es/library/dot/components/form/frameworks/ui/css/Form.module.css +29 -4
  36. package/es/library/dot/components/form/frameworks/ui/sub-components/Footer.js +27 -0
  37. package/es/library/dot/components/form/frameworks/ui/sub-components/Header.js +24 -0
  38. package/es/library/dot/components/form/frameworks/ui/sub-components/MiddleSection.js +24 -0
  39. package/es/library/dot/components/form/frameworks/ui/sub-components/Sections.js +7 -2
  40. package/es/library/dot/components/form/frameworks/ui/sub-components/SectionsLayout.js +20 -0
  41. package/es/library/dot/components/form/frameworks/ui/sub-components/SectionsWithRightPanelLayout.js +42 -0
  42. package/es/library/dot/components/form-fields/checkbox/frameworks/ui/Checkbox.js +4 -3
  43. package/es/library/dot/components/form-fields/checkbox/frameworks/ui/CheckboxView.js +19 -17
  44. package/es/library/dot/components/form-fields/currency/frameworks/ui/Currency.js +3 -3
  45. package/es/library/dot/components/form-fields/currency/frameworks/ui/CurrencyView.js +20 -17
  46. package/es/library/dot/components/form-fields/date/frameworks/ui/Date.js +2 -3
  47. package/es/library/dot/components/form-fields/date/frameworks/ui/DateView.js +22 -19
  48. package/es/library/dot/components/form-fields/datetime/frameworks/ui/DateTime.js +2 -3
  49. package/es/library/dot/components/form-fields/datetime/frameworks/ui/DateTimeView.js +21 -18
  50. package/es/library/dot/components/form-fields/decimal/frameworks/ui/Decimal.js +2 -3
  51. package/es/library/dot/components/form-fields/decimal/frameworks/ui/DecimalView.js +22 -19
  52. package/es/library/dot/components/form-fields/email/frameworks/ui/Email.js +2 -3
  53. package/es/library/dot/components/form-fields/email/frameworks/ui/EmailView.js +22 -19
  54. package/es/library/dot/components/form-fields/field/FieldItem.js +36 -0
  55. package/es/library/dot/components/form-fields/field/css/FieldItem.module.css +13 -0
  56. package/es/library/dot/components/form-fields/index.js +2 -1
  57. package/es/library/dot/components/form-fields/lookup/frameworks/ui/EventHandlerFactory.js +70 -0
  58. package/es/library/dot/components/form-fields/lookup/frameworks/ui/Lookup.js +13 -0
  59. package/es/library/dot/components/form-fields/lookup/frameworks/ui/LookupView.js +51 -0
  60. package/es/library/dot/components/form-fields/multi-select/frameworks/ui/MultiSelect.js +2 -3
  61. package/es/library/dot/components/form-fields/multi-select/frameworks/ui/MultiSelectView.js +21 -18
  62. package/es/library/dot/components/form-fields/number/frameworks/ui/Number.js +2 -3
  63. package/es/library/dot/components/form-fields/number/frameworks/ui/NumberView.js +22 -19
  64. package/es/library/dot/components/form-fields/percentage/frameworks/ui/Percentage.js +2 -3
  65. package/es/library/dot/components/form-fields/percentage/frameworks/ui/PercentageView.js +22 -19
  66. package/es/library/dot/components/form-fields/phone/frameworks/ui/Phone.js +2 -3
  67. package/es/library/dot/components/form-fields/phone/frameworks/ui/PhoneView.js +22 -19
  68. package/es/library/dot/components/form-fields/pick-list/frameworks/ui/PickList.js +2 -3
  69. package/es/library/dot/components/form-fields/pick-list/frameworks/ui/PickListView.js +21 -18
  70. package/es/library/dot/components/form-fields/textarea/frameworks/ui/TextArea.js +4 -3
  71. package/es/library/dot/components/form-fields/textarea/frameworks/ui/TextAreaView.js +21 -18
  72. package/es/library/dot/components/form-fields/textbox/frameworks/ui/TextBox.js +2 -3
  73. package/es/library/dot/components/form-fields/textbox/frameworks/ui/TextBoxView.js +21 -18
  74. package/es/library/dot/components/form-fields/url/frameworks/ui/Url.js +2 -3
  75. package/es/library/dot/components/form-fields/url/frameworks/ui/UrlView.js +22 -19
  76. package/es/library/dot/components/section/frameworks/ui/SectionView.js +1 -1
  77. package/es/library/dot/components/table-list/frameworks/ui/sub-components/ErrorState.js +3 -3
  78. package/es/library/dot/legacy-to-new-arch/action-icon/frameworks/ui/ActionIconView.js +1 -1
  79. package/es/library/dot/legacy-to-new-arch/date/frameworks/ui/DateView.js +18 -1
  80. package/es/library/dot/legacy-to-new-arch/date/frameworks/ui/css/DateView.module.css +3 -0
  81. package/es/library/dot/legacy-to-new-arch/highlighted-value/frameworks/ui/HighlightedValueView.js +6 -1
  82. 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
  83. package/es/library/dot/legacy-to-new-arch/label/frameworks/ui/LabelView.js +16 -12
  84. package/es/library/dot/legacy-to-new-arch/label/frameworks/ui/css/Label.module.css +3 -5
  85. package/es/library/dot/legacy-to-new-arch/multi-select/frameworks/ui/MultiSelectView.js +23 -3
  86. package/es/library/dot/legacy-to-new-arch/multi-select/frameworks/ui/css/MultiSelectView.module.css +37 -0
  87. package/es/library/dot/legacy-to-new-arch/select/frameworks/ui/SelectView.js +16 -4
  88. package/es/library/dot/legacy-to-new-arch/text-area/frameworks/ui/TextAreaView.js +23 -5
  89. package/es/library/dot/legacy-to-new-arch/text-area/frameworks/ui/css/TextAreaView.module.css +40 -0
  90. package/es/library/dot/legacy-to-new-arch/textbox/frameworks/ui/TextBoxView.js +13 -3
  91. package/es/platform/client-actions/bc/zclient-actions/SdkContract.js +35 -0
  92. package/es/platform/client-actions/behaviour/zclient-actions/adapters/resources/ClientActionResource.js +105 -0
  93. package/es/platform/client-actions/behaviour/zclient-actions/applications/usecases/GetClientActionLocationUseCase.js +20 -0
  94. package/es/platform/client-actions/behaviour/zclient-actions/applications/usecases/GetClientActionUIComponentPropertiesUseCase.js +20 -0
  95. package/es/platform/client-actions/behaviour/zclient-actions/applications/usecases/GetClientActionsUseCase.js +18 -0
  96. package/es/platform/client-actions/behaviour/zclient-actions/applications/usecases/UpdateClientActionUIComponentPropertiesUseCase.js +32 -0
  97. package/es/platform/client-actions/behaviour/zclient-actions/domain/entities/ClientAction.js +12 -0
  98. package/es/platform/client-actions/behaviour/zclient-actions/domain/entities/ClientActionManager.js +45 -0
  99. package/es/platform/client-actions/behaviour/zclient-actions/domain/entities/UIComponentMapping.js +10 -0
  100. package/es/platform/client-actions/behaviour/zclient-actions/frameworks/sdk/ClientActionsSDKFactory.js +29 -0
  101. package/es/platform/client-actions/cc/action-event-mediator/Properties.js +9 -0
  102. package/es/platform/client-actions/cc/dynamic-action-component/Properties.js +1 -1
  103. package/es/platform/client-actions/components/action-event-mediator/applications/usecases/PropertiesChangeUseCase.js +1 -1
  104. package/es/platform/client-actions/components/action-event-mediator/domain/entities/ActionEventMediatorEntity.js +7 -3
  105. package/es/platform/client-actions/components/action-event-mediator/frameworks/ui/ActionEventMediatorView.js +3 -1
  106. package/es/platform/client-actions/components/dynamic-component/frameworks/ui/DynamicActionComponentView.js +4 -2
  107. package/es/platform/client-actions/components/interfaces/ActionViewModel.js +1 -0
  108. package/es/platform/client-actions/components/row-actions-renderer/frameworks/ui/RowActionsRenderer.module.css +5 -1
  109. package/es/platform/client-actions/components/row-actions-renderer/frameworks/ui/RowActionsRendererView.js +4 -1
  110. package/es/platform/components/app/adapters/resources/AppResource.js +13 -0
  111. package/es/platform/components/form-connected/adapters/resources/SmartFormResources.js +88 -6
  112. package/es/platform/components/form-connected/frameworks/EventHandlersFactory.js +31 -58
  113. package/es/platform/components/form-connected/frameworks/FormConnectedFactory.js +6 -9
  114. package/es/platform/components/form-connected/frameworks/FormConnectedView.js +16 -2
  115. package/es/platform/components/form-connected/frameworks/FormSdkFactory.js +2 -2
  116. package/es/platform/components/table-connected/frameworks/EventHandlersFactory.js +17 -3
  117. package/es/platform/components/table-connected/frameworks/ListSdkFactory.js +2 -2
  118. package/es/platform/components/table-connected/frameworks/TableConnectedFactory.js +6 -1
  119. package/es/platform/data-source/http-template/deleteRecords.js +1 -1
  120. package/es/platform/data-source/http-template/fetchLookupFields.js +24 -0
  121. package/es/platform/data-source/http-template/fetchValidationRules.js +2 -1
  122. package/es/platform/data-source/http-template/getClientActions.js +2 -2
  123. package/es/platform/data-source/http-template/moveToTrash.js +28 -0
  124. package/es/platform/data-source/index.js +5 -1
  125. package/es/platform/data-source/utils/validation-rules/FieldConditions.js +167 -0
  126. package/es/platform/data-source/utils/validation-rules/TransFormValidationRules.js +98 -0
  127. package/es/platform/sdk/adapters/gateways/Service.js +4 -0
  128. package/es/platform/sdk/application/usecases/GetResourcesUseCase.js +12 -0
  129. package/es/platform/sdk/domain/entities/ResourceManager.js +21 -11
  130. package/es/platform/sdk/frameworks/Sdk.js +20 -2
  131. package/es/platform/sdk/frameworks/SdkRegistry.js +9 -0
  132. package/es/platform/zdata-source/applications/usecases/SuccessUseCase.js +1 -1
  133. package/es/platform/zform/adapters/controllers/FieldBlurController.js +26 -0
  134. package/es/platform/zform/adapters/controllers/LookupFieldController.js +23 -0
  135. package/es/platform/zform/adapters/controllers/MyFromSuccessController.js +8 -2
  136. package/es/platform/zform/adapters/controllers/SubmitValidationCompletedController.js +21 -0
  137. package/es/platform/zform/adapters/controllers/ValidateFieldRequestController.js +10 -5
  138. package/es/platform/zform/adapters/controllers/ValidationRulesExecutionResultController.js +23 -0
  139. package/es/platform/zform/adapters/controllers/ValidationRulesRequestController.js +2 -4
  140. package/es/platform/zform/adapters/controllers/ValidationRulesSuccessController.js +2 -4
  141. package/es/platform/zform/adapters/gateway/Service.js +19 -7
  142. package/es/platform/zform/adapters/presenter/FormTranslator.js +87 -5
  143. package/es/platform/zform/adapters/presenter/translators/SectionTranslator.js +61 -4
  144. package/es/platform/zform/adapters/presenter/translators/fields/BooleanFieldTranslator.js +7 -3
  145. package/es/platform/zform/adapters/presenter/translators/fields/CurrencyFieldTranslator.js +5 -9
  146. package/es/platform/zform/adapters/presenter/translators/fields/DateFieldTranslator.js +7 -3
  147. package/es/platform/zform/adapters/presenter/translators/fields/DateTimeFieldTranslator.js +7 -3
  148. package/es/platform/zform/adapters/presenter/translators/fields/DecimalFieldTranslator.js +6 -9
  149. package/es/platform/zform/adapters/presenter/translators/fields/EmailFieldTranslator.js +6 -9
  150. package/es/platform/zform/adapters/presenter/translators/fields/LookUpFieldTranslator.js +7 -10
  151. package/es/platform/zform/adapters/presenter/translators/fields/MultiselectFieldTranslator.js +6 -3
  152. package/es/platform/zform/adapters/presenter/translators/fields/NumberFieldTranslator.js +6 -9
  153. package/es/platform/zform/adapters/presenter/translators/fields/PercentageFieldTranslator.js +6 -9
  154. package/es/platform/zform/adapters/presenter/translators/fields/PhoneFieldTranslator.js +6 -9
  155. package/es/platform/zform/adapters/presenter/translators/fields/PicklistFieldTranslator.js +6 -3
  156. package/es/platform/zform/adapters/presenter/translators/fields/TextAreaFieldTranslator.js +5 -9
  157. package/es/platform/zform/adapters/presenter/translators/fields/TextFieldTranslator.js +8 -8
  158. package/es/platform/zform/adapters/presenter/translators/fields/URLFieldTranslator.js +6 -9
  159. package/es/platform/zform/adapters/presenter/utils/DefaultClientActions.js +130 -0
  160. package/es/platform/zform/applications/usecases/AbstractUseCase.js +3 -1
  161. package/es/platform/zform/applications/usecases/FieldBlurUseCase.js +39 -0
  162. package/es/platform/zform/applications/usecases/FieldValueChangeRequestUseCase.js +9 -13
  163. package/es/platform/zform/applications/usecases/FocusFieldUseCase.js +19 -0
  164. package/es/platform/zform/applications/usecases/FormSubmitUseCase.js +19 -38
  165. package/es/platform/zform/applications/usecases/GetFieldErrorMessageUseCase.js +16 -0
  166. package/es/platform/zform/applications/usecases/InitializeUseCase.js +16 -0
  167. package/es/platform/zform/applications/usecases/InsertValidationRuleSuccessUseCase.js +22 -0
  168. package/es/platform/zform/applications/usecases/LookupFieldSuccessUseCase.js +40 -0
  169. package/es/platform/zform/applications/usecases/MyFormSuccessUseCase.js +97 -13
  170. package/es/platform/zform/applications/usecases/MyLayoutSuccessUseCase.js +4 -33
  171. package/es/platform/zform/applications/usecases/SetFieldErrorMessageUseCase.js +4 -4
  172. package/es/platform/zform/applications/usecases/SetFieldValueUseCase.js +4 -21
  173. package/es/platform/zform/applications/usecases/SetFieldsValuesUseCase.js +4 -26
  174. package/es/platform/zform/applications/usecases/SubmitValidationCompletedUseCase.js +62 -0
  175. package/es/platform/zform/applications/usecases/ValidateFieldUseCase.js +33 -0
  176. package/es/platform/zform/applications/usecases/ValidationRulesExecutionResultUseCase.js +23 -0
  177. package/es/platform/zform/domain/ZField.js +32 -7
  178. package/es/platform/zform/domain/ZForm.js +114 -45
  179. package/es/platform/zform/domain/interfaces/IZForm.js +5 -1
  180. package/es/platform/zform/domain/interfaces/ValidationConditions.js +142 -0
  181. package/es/platform/zform/frameworks/layout-rules/calculateLayoutRulesResult.js +1 -1
  182. package/es/platform/zform/frameworks/layout-rules/runSingleFieldCondition.js +1 -1
  183. package/es/platform/zform/frameworks/layout-rules/validator.js +0 -1
  184. package/es/platform/zform/frameworks/ui/EventHandlerFactory.js +42 -138
  185. package/es/platform/zform/frameworks/ui/ZFormBehaviourFactory.js +4 -9
  186. package/es/platform/zform/frameworks/validation-rules/DefaultCustomValidators.js +340 -0
  187. package/es/platform/zform/frameworks/validation-rules/Validator.js +98 -16
  188. package/es/platform/zform/frameworks/validation-rules/formUtils.js +7 -0
  189. package/es/platform/zform/frameworks/validation-rules/localization_utils.js +15 -0
  190. package/es/platform/zform/frameworks/validation-rules/utils.js +402 -351
  191. package/es/platform/zform/frameworks/validation-rules/validationRules.js +80 -79
  192. package/es/platform/zlist/adapters/presenters/TableTranslator.js +3 -2
  193. package/es/platform/zlist/applications/usecases/RecordSuccessCallbackUsecase.js +4 -1
  194. package/es/platform/zlist/domain/entities/List.js +11 -4
  195. package/es/platform/zrecord/adapters/controllers/SetRecordsController.js +7 -3
  196. package/es/platform/zrecord/applications/usecases/SetRecordsUseCase.js +11 -1
  197. package/package.json +11 -12
  198. package/es/bc/field-validation/Constants.js +0 -4
  199. package/es/bc/field-validation/EventHandlers.js +0 -1
  200. package/es/bc/field-validation/Events.js +0 -106
  201. package/es/bc/field-validation/FieldTypes.js +0 -20
  202. package/es/bc/field-validation/Properties.js +0 -11
  203. package/es/bc/field-validation/index.js +0 -5
  204. package/es/cc/ephi-tag/Properties.js +0 -1
  205. package/es/cc/ephi-tag/index.js +0 -1
  206. package/es/cc/info-icon/Properties.js +0 -10
  207. package/es/cc/info-icon/index.js +0 -1
  208. package/es/library/behaviours/field-validation/adapters/controllers/AbstractController.js +0 -9
  209. package/es/library/behaviours/field-validation/adapters/controllers/ValidateFieldController.js +0 -32
  210. package/es/library/behaviours/field-validation/adapters/controllers/ValidateFieldsController.js +0 -31
  211. package/es/library/behaviours/field-validation/adapters/gateway/Repository.js +0 -23
  212. package/es/library/behaviours/field-validation/adapters/gateway/Service.js +0 -18
  213. package/es/library/behaviours/field-validation/applications/interfaces/input/FieldData.js +0 -17
  214. package/es/library/behaviours/field-validation/applications/usecases/AbstractUseCase.js +0 -15
  215. package/es/library/behaviours/field-validation/applications/usecases/ValidateField.js +0 -29
  216. package/es/library/behaviours/field-validation/applications/usecases/ValidateFields.js +0 -28
  217. package/es/library/behaviours/field-validation/domain/FieldValidation.js +0 -94
  218. package/es/library/behaviours/field-validation/domain/field-vise-validations/BooleanValidation.js +0 -28
  219. package/es/library/behaviours/field-validation/domain/field-vise-validations/CurrencyValidation.js +0 -49
  220. package/es/library/behaviours/field-validation/domain/field-vise-validations/DateTimeValidation.js +0 -24
  221. package/es/library/behaviours/field-validation/domain/field-vise-validations/DateValidation.js +0 -24
  222. package/es/library/behaviours/field-validation/domain/field-vise-validations/DecimalValidation.js +0 -49
  223. package/es/library/behaviours/field-validation/domain/field-vise-validations/EmailValidation.js +0 -28
  224. package/es/library/behaviours/field-validation/domain/field-vise-validations/IntegerValidation.js +0 -39
  225. package/es/library/behaviours/field-validation/domain/field-vise-validations/LookUpValidation.js +0 -24
  226. package/es/library/behaviours/field-validation/domain/field-vise-validations/MultiSelectValidation.js +0 -26
  227. package/es/library/behaviours/field-validation/domain/field-vise-validations/PercentValidation.js +0 -28
  228. package/es/library/behaviours/field-validation/domain/field-vise-validations/PhoneValidation.js +0 -39
  229. package/es/library/behaviours/field-validation/domain/field-vise-validations/PicklistValidation.js +0 -24
  230. package/es/library/behaviours/field-validation/domain/field-vise-validations/TextAreaValidation.js +0 -39
  231. package/es/library/behaviours/field-validation/domain/field-vise-validations/TextBoxValidation.js +0 -39
  232. package/es/library/behaviours/field-validation/domain/field-vise-validations/URLValidation.js +0 -28
  233. package/es/library/behaviours/field-validation/domain/interfaces/FieldTypes.js +0 -20
  234. package/es/library/behaviours/field-validation/domain/interfaces/ValidationsEnum.js +0 -22
  235. package/es/library/behaviours/field-validation/domain/interfaces/fields/IBooleanField.js +0 -0
  236. package/es/library/behaviours/field-validation/domain/interfaces/fields/ICurrencyField.js +0 -0
  237. package/es/library/behaviours/field-validation/domain/interfaces/fields/IDateField.js +0 -0
  238. package/es/library/behaviours/field-validation/domain/interfaces/fields/IDateTimeField.js +0 -0
  239. package/es/library/behaviours/field-validation/domain/interfaces/fields/IDecimalField.js +0 -0
  240. package/es/library/behaviours/field-validation/domain/interfaces/fields/IEmailField.js +0 -0
  241. package/es/library/behaviours/field-validation/domain/interfaces/fields/IIntegerField.js +0 -0
  242. package/es/library/behaviours/field-validation/domain/interfaces/fields/ILookUpField.js +0 -0
  243. package/es/library/behaviours/field-validation/domain/interfaces/fields/IMultiSelectField.js +0 -0
  244. package/es/library/behaviours/field-validation/domain/interfaces/fields/IPercentField.js +0 -0
  245. package/es/library/behaviours/field-validation/domain/interfaces/fields/IPhoneField.js +0 -0
  246. package/es/library/behaviours/field-validation/domain/interfaces/fields/IPicklistField.js +0 -0
  247. package/es/library/behaviours/field-validation/domain/interfaces/fields/ITextAreaField.js +0 -0
  248. package/es/library/behaviours/field-validation/domain/interfaces/fields/ITextBoxField.js +0 -0
  249. package/es/library/behaviours/field-validation/domain/interfaces/fields/IURLField.js +0 -0
  250. package/es/library/behaviours/field-validation/frameworks/ui/EventHandlerFactory.js +0 -23
  251. package/es/library/behaviours/field-validation/frameworks/ui/FieldValidationBehaviourFactory.js +0 -27
  252. package/es/library/behaviours/field-validation/frameworks/ui/__tests__/BooleanFieldValidation.test.js +0 -137
  253. package/es/library/behaviours/field-validation/frameworks/ui/__tests__/CurrencyFieldValidation.test.js +0 -228
  254. package/es/library/behaviours/field-validation/frameworks/ui/__tests__/DateFieldValidation.test.js +0 -108
  255. package/es/library/behaviours/field-validation/frameworks/ui/__tests__/DateTimeFieldValidation.test.js +0 -108
  256. package/es/library/behaviours/field-validation/frameworks/ui/__tests__/DecimalFieldValidation.test.js +0 -257
  257. package/es/library/behaviours/field-validation/frameworks/ui/__tests__/EmailFieldValidation.test.js +0 -139
  258. package/es/library/behaviours/field-validation/frameworks/ui/__tests__/FieldValidationBehaviour.test.js +0 -171
  259. package/es/library/behaviours/field-validation/frameworks/ui/__tests__/IntegerFieldValidation.test.js +0 -168
  260. package/es/library/behaviours/field-validation/frameworks/ui/__tests__/LookUpFieldValidation.test.js +0 -108
  261. package/es/library/behaviours/field-validation/frameworks/ui/__tests__/MultiSelectFieldValidation.test.js +0 -79
  262. package/es/library/behaviours/field-validation/frameworks/ui/__tests__/PercentFieldValidation.test.js +0 -108
  263. package/es/library/behaviours/field-validation/frameworks/ui/__tests__/PhoneFieldValidation.test.js +0 -168
  264. package/es/library/behaviours/field-validation/frameworks/ui/__tests__/PicklistFieldValidation.test.js +0 -79
  265. package/es/library/behaviours/field-validation/frameworks/ui/__tests__/TextAreaFieldValidation.test.js +0 -170
  266. package/es/library/behaviours/field-validation/frameworks/ui/__tests__/TextBoxFieldValidation.test.js +0 -170
  267. package/es/library/behaviours/field-validation/frameworks/ui/__tests__/URLFieldValidation.test.js +0 -108
  268. package/es/library/behaviours/field-validation/frameworks/utils/FormBasicValidationAdaptor.js +0 -228
  269. package/es/library/behaviours/field-validation/frameworks/utils/__tests__/formValidate.test.js +0 -284
  270. package/es/library/behaviours/field-validation/frameworks/utils/formValidate.js +0 -334
  271. package/es/library/dot/components/form-fields/checkbox/adapters/presenter/TransformState.js +0 -22
  272. package/es/library/dot/components/form-fields/currency/adapters/presenter/TransformState.js +0 -81
  273. package/es/library/dot/components/form-fields/date/adapters/presenter/TransformState.js +0 -22
  274. package/es/library/dot/components/form-fields/datetime/adapters/presenter/TransformState.js +0 -22
  275. package/es/library/dot/components/form-fields/decimal/adapters/presenter/TransformState.js +0 -31
  276. package/es/library/dot/components/form-fields/email/adapters/presenter/TransformState.js +0 -23
  277. package/es/library/dot/components/form-fields/ephi-tag/frameworks/ui/EPHITag.js +0 -10
  278. package/es/library/dot/components/form-fields/ephi-tag/frameworks/ui/EPHITagView.js +0 -21
  279. package/es/library/dot/components/form-fields/info-icon/frameworks/ui/InfoIcon.js +0 -10
  280. package/es/library/dot/components/form-fields/info-icon/frameworks/ui/InfoIconView.js +0 -21
  281. package/es/library/dot/components/form-fields/info-icon/frameworks/ui/css/InfoIcon.module.css +0 -3
  282. package/es/library/dot/components/form-fields/multi-select/adapters/presenter/TransformState.js +0 -31
  283. package/es/library/dot/components/form-fields/number/adapters/presenter/TransformState.js +0 -31
  284. package/es/library/dot/components/form-fields/percentage/adapters/presenter/TransformState.js +0 -31
  285. package/es/library/dot/components/form-fields/phone/adapters/presenter/TransformState.js +0 -31
  286. package/es/library/dot/components/form-fields/pick-list/adapters/presenter/TransformState.js +0 -23
  287. package/es/library/dot/components/form-fields/textarea/adapters/presenter/TransformState.js +0 -23
  288. package/es/library/dot/components/form-fields/textbox/adapters/presenter/TransformState.js +0 -32
  289. package/es/library/dot/components/form-fields/url/adapters/presenter/TransformState.js +0 -31
  290. package/es/library/dot/legacy-to-new-arch/label/frameworks/ui/sub-components/ui/LabelAction.js +0 -9
  291. package/es/library/dot/legacy-to-new-arch/label/frameworks/ui/sub-components/ui/LabelActionView.js +0 -38
  292. package/es/library/dot/legacy-to-new-arch/label/frameworks/ui/sub-components/ui/css/LabelAction.module.css +0 -4
  293. package/es/platform/zform/adapters/controllers/ValidateErrorMessageController.js +0 -22
  294. package/es/platform/zform/applications/usecases/ValidateErrorMessageUseCase.js +0 -33
  295. package/es/platform/zform/applications/usecases/ValidateFieldRequestUseCase.js +0 -56
  296. /package/es/{library/behaviours/field-validation/applications/interfaces/UseCaseDependencies.js → platform/client-actions/behaviour/zclient-actions/applications/interfaces/IClientActionResource.js} +0 -0
  297. /package/es/{library/behaviours/field-validation/applications/interfaces/gateways/IRepository.js → platform/client-actions/behaviour/zclient-actions/applications/interfaces/input/GetClientActionLocationInputModel.js} +0 -0
  298. /package/es/{library/behaviours/field-validation/applications/interfaces/gateways/IService.js → platform/client-actions/behaviour/zclient-actions/applications/interfaces/input/GetClientActionUIComponentPropertiesInputModel.js} +0 -0
  299. /package/es/{library/behaviours/field-validation/applications/interfaces/input/FieldValidationInputModel.js → platform/client-actions/behaviour/zclient-actions/applications/interfaces/input/GetClientActionsInputModel.js} +0 -0
  300. /package/es/{library/behaviours/field-validation/applications/interfaces/input/ValidateFieldsInputModel.js → platform/client-actions/behaviour/zclient-actions/applications/interfaces/input/UpdateClientActionUIComponentPropertiesInputModel.js} +0 -0
  301. /package/es/{library/behaviours/field-validation/domain/interfaces/IFieldValidation.js → platform/zform/applications/interfaces/input/FieldBlurUsecaseInputModel.js} +0 -0
  302. /package/es/{library/behaviours/field-validation/domain/interfaces/IFieldViseValidation.js → platform/zform/applications/interfaces/input/FocusFieldUseCaseInputModel.js} +0 -0
  303. /package/es/{library/behaviours/field-validation/domain/interfaces/ValidationResult.js → platform/zform/applications/interfaces/input/GetFieldErrorMessageInputModel.js} +0 -0
  304. /package/es/{library/behaviours/field-validation/domain/interfaces/ValidationsArray.js → platform/zform/applications/interfaces/input/InsertValidationRuleInputModel.js} +0 -0
  305. /package/es/{library/behaviours/field-validation/domain/interfaces/ValidationsMap.js → platform/zform/applications/interfaces/input/LookUpFieldSuccessUseCaseInputModel.js} +0 -0
  306. /package/es/{library/behaviours/field-validation/domain/interfaces/IField.js → platform/zform/applications/interfaces/input/SubmitValidationCompletedUsecaseInputModel.js} +0 -0
  307. /package/es/platform/zform/applications/interfaces/input/{ValidateErrorMessageInputModel.js → ValidateFieldUseCaseInputModel.js} +0 -0
@@ -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(_ref) {
6
- let {
7
- customValidators
8
- } = _ref;
5
+ static create() {
9
6
  return {
10
7
  name: 'zform',
11
- setInitialState: _ref2 => {
8
+ setInitialState: _ref => {
12
9
  let {
13
10
  properties
14
- } = _ref2;
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
+ }
@@ -1,23 +1,89 @@
1
- import getValidationRuleActionsData from "./validationRules"; //need to move to gateway in adapter
1
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
+
3
+ import getValidationRuleActionsData from "./validationRules";
4
+ import * as defaultCustomValidators from "./DefaultCustomValidators"; //need to move to gateway in adapter
2
5
 
3
6
  export default class Validator {
4
- constructor(customValidators) {
5
- this.customValidators = customValidators;
7
+ constructor() {
8
+ _defineProperty(this, "customValidators", defaultCustomValidators);
9
+ }
10
+
11
+ init(state) {
12
+ this.customValidators = { ...defaultCustomValidators,
13
+ ...state.properties.customValidators
14
+ };
15
+ }
16
+
17
+ customValidationRunner(_ref) {
18
+ let {
19
+ fieldCondition,
20
+ fieldName,
21
+ formValues,
22
+ fieldDetails,
23
+ fieldNameMap2Field
24
+ } = _ref;
25
+ const {
26
+ customValidators
27
+ } = this;
28
+ const {
29
+ validator
30
+ } = fieldCondition;
31
+ const {
32
+ scriptId
33
+ } = validator;
34
+ const field = fieldNameMap2Field[fieldName];
35
+
36
+ if (scriptId && customValidators[scriptId]) {
37
+ const script = customValidators[scriptId];
38
+
39
+ function handleResult(result) {
40
+ if (result && result.type === 'fail') {
41
+ var _result$action;
42
+
43
+ const errorMessage = typeof result.message === 'string' ? result.message : (_result$action = result.action) === null || _result$action === void 0 ? void 0 : _result$action.message;
44
+ return {
45
+ fieldName,
46
+ actions: {
47
+ alert: errorMessage
48
+ }
49
+ };
50
+ }
51
+
52
+ return null;
53
+ }
54
+
55
+ const arg = {
56
+ value: formValues[fieldName],
57
+ fieldId: field.id,
58
+ fieldCondition,
59
+ fieldName,
60
+ field
61
+ };
62
+ return script(arg).then(handleResult).catch(handleResult);
63
+ } else {
64
+ console.warn(`Custom validator "${scriptId}" not found in customValidators`, customValidators);
65
+ }
66
+
67
+ return null;
6
68
  }
7
69
 
8
- validateAsync(_ref) {
70
+ validateAsync(_ref2) {
9
71
  let {
10
72
  formData,
11
73
  myForm,
12
74
  validationRules
13
- } = _ref;
14
- let fieldDetails = {};
15
- let fieldMapper = {};
75
+ } = _ref2;
76
+ const fieldDetails = {};
77
+ const fieldMapper = {};
78
+ const fieldNameMap2Field = {};
16
79
  const formUIData = {};
80
+ const formValues = {};
17
81
  myForm.sections.forEach(section => {
18
82
  section.fields.forEach(field => {
19
83
  fieldDetails[field.id] = field;
84
+ fieldNameMap2Field[field.apiName] = field;
20
85
  fieldMapper[field.apiName] = field.id;
86
+ formValues[field.apiName] = formData[field.apiName].value;
21
87
  formUIData[field.id] = { ...field,
22
88
  value: formData[field.apiName].value || null,
23
89
  isShowOnLayoutRuleApplied: true //hack
@@ -29,16 +95,32 @@ export default class Validator {
29
95
  fieldDetails,
30
96
  fieldMapper
31
97
  };
32
- let result = getValidationRuleActionsData(validationRules, formUIData, formFields, this.customValidators);
33
- let output = {};
34
- Object.keys(result.data).forEach(key => {
35
- if (!output[fieldDetails[key].apiName]) {
36
- output[fieldDetails[key].apiName] = {};
37
- }
38
98
 
39
- output[fieldDetails[key].apiName].errorMessage = result.data[key].validationRuleMessage;
40
- });
41
- return Promise.resolve(output); // throw new Error("Method not implemented.");
99
+ const customValidationRunnerWrapper = _ref3 => {
100
+ let {
101
+ fieldCondition,
102
+ fieldName
103
+ } = _ref3;
104
+ return this.customValidationRunner({
105
+ fieldCondition,
106
+ fieldName,
107
+ formValues,
108
+ fieldDetails,
109
+ fieldNameMap2Field
110
+ });
111
+ };
112
+
113
+ return getValidationRuleActionsData(validationRules, formUIData, formFields, customValidationRunnerWrapper).then(result => {
114
+ const output = {};
115
+ Object.keys(result.data).forEach(key => {
116
+ if (!output[fieldDetails[key].apiName]) {
117
+ output[fieldDetails[key].apiName] = {};
118
+ }
119
+
120
+ output[fieldDetails[key].apiName].errorMessage = result.data[key].validationRuleMessage;
121
+ });
122
+ return Promise.resolve(output);
123
+ }); // throw new Error("Method not implemented.");
42
124
  }
43
125
 
44
126
  }
@@ -0,0 +1,7 @@
1
+ import { i18NProviderUtils } from '@zohodesk/i18n';
2
+ export function getNoneText() {
3
+ const valueNoneText = i18NProviderUtils.getI18NValue('-None-');
4
+ return {
5
+ valueNoneText
6
+ };
7
+ }
@@ -0,0 +1,15 @@
1
+ export function getLocalizedFunction() {
2
+ let initialArg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
3
+ return function () {
4
+ let args = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
5
+ return getLocalizedValue({ ...args,
6
+ ...initialArg
7
+ });
8
+ };
9
+ }
10
+ export function getLocalizedValue() {
11
+ let {
12
+ fieldValue
13
+ } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
14
+ return fieldValue;
15
+ }