@zohodesk/library-platform 1.1.13 → 1.2.0-exp.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (165) hide show
  1. package/es/bc/column-chooser/EventHandlers.js +1 -2
  2. package/es/bc/sdk/ResourceNamesEnum.js +1 -0
  3. package/es/bc/zform/Properties.js +20 -0
  4. package/es/bc/zform/Symbol.js +3 -0
  5. package/es/bc/zrecord/Constants.js +2 -0
  6. package/es/cc/action-band/Properties.js +37 -0
  7. package/es/cc/action-band/constants/ExternalConstants.js +3 -1
  8. package/es/cc/component/Dispatch.js +1 -0
  9. package/es/cc/component/LifeCycleEventsEnum.js +1 -0
  10. package/es/cc/component/index.js +3 -0
  11. package/es/cc/fields/currency/Properties.js +9 -0
  12. package/es/cc/fields/decimal/Properties.js +9 -0
  13. package/es/cc/fields/email/Properties.js +9 -0
  14. package/es/cc/fields/lookup/Properties.js +10 -26
  15. package/es/cc/fields/multi-line/Properties.js +1 -0
  16. package/es/cc/fields/number/Properties.js +10 -1
  17. package/es/cc/fields/phone/Properties.js +9 -0
  18. package/es/cc/fields/text/Properties.js +2 -2
  19. package/es/cc/fields/url/Properties.js +9 -0
  20. package/es/cc/one-unification/Constants.js +24 -0
  21. package/es/cc/one-unification/unified-navigation/ActionTypes.js +1 -0
  22. package/es/cc/one-unification/unified-navigation/CommonTypes.js +1 -0
  23. package/es/cc/one-unification/unified-navigation/ConfigTypes.js +1 -0
  24. package/es/cc/one-unification/unified-navigation/HandlerTypes.js +1 -0
  25. package/es/cc/one-unification/unified-navigation/Types.js +1 -0
  26. package/es/cc/one-unification/unified-navigation/UnifiedNavigation.d.js +0 -0
  27. package/es/cc/one-unification/unified-navigation/index.js +1 -0
  28. package/es/cc/smart-navigation/Constants.js +8 -0
  29. package/es/cc/smart-navigation/Events.js +107 -0
  30. package/es/cc/smart-navigation/Properties.js +87 -0
  31. package/es/cc/smart-navigation/index.js +4 -0
  32. package/es/cc/table-column-chooser/Constants.js +2 -1
  33. package/es/cc/table-connected/SdkContract.js +22 -0
  34. package/es/cc/text/Properties.js +100 -0
  35. package/es/cc/textbox/Properties.js +1 -1
  36. package/es/index.js +8 -3
  37. package/es/library/behaviours/clip-wrap/applications/usecases/ClipWrapUpdateUseCase.js +19 -0
  38. package/es/library/behaviours/library-loader/adapters/controllers/LibraryLoaderController.js +17 -0
  39. package/es/library/behaviours/library-loader/adapters/gateways/LibraryLoaderAdapter.js +29 -0
  40. package/es/library/behaviours/library-loader/applications/usecases/LoadLibraryUseCase.js +42 -0
  41. package/es/library/behaviours/library-loader/domain/entities/interfaces/ILibraryLoader.js +1 -0
  42. package/es/library/behaviours/library-loader/frameworks/LibraryLoaderBehaviour.js +26 -0
  43. package/es/library/behaviours/search/adapters/controllers/UpdatePropertiesController.js +9 -4
  44. package/es/library/custom-component/adapters/gateways/event-manager/EventManager.js +4 -3
  45. package/es/library/custom-component/applications/usecases/DispatchUseCase.js +1 -0
  46. package/es/library/custom-component/applications/usecases/InitializeUseCase.js +1 -0
  47. package/es/library/custom-component/applications/usecases/MountUseCase.js +1 -0
  48. package/es/library/custom-component/applications/usecases/SetRefUseCase.js +7 -0
  49. package/es/library/custom-component/applications/usecases/UnmountUseCase.js +1 -0
  50. package/es/library/custom-component/applications/usecases/UpdatePropertyUseCase.js +1 -0
  51. package/es/library/custom-component/domain/entities/Component.js +1 -0
  52. package/es/library/custom-component/domain/entities/Logger.js +4 -9
  53. package/es/library/dot/components/form-fields/currency/frameworks/ui/CurrencyView.js +2 -0
  54. package/es/library/dot/components/form-fields/decimal/frameworks/ui/DecimalView.js +2 -0
  55. package/es/library/dot/components/form-fields/email/frameworks/ui/Email.js +1 -1
  56. package/es/library/dot/components/form-fields/email/frameworks/ui/EmailView.js +2 -0
  57. package/es/library/dot/components/form-fields/number/frameworks/ui/NumberView.js +2 -0
  58. package/es/library/dot/components/form-fields/phone/frameworks/ui/PhoneView.js +2 -0
  59. package/es/library/dot/components/form-fields/textarea/frameworks/ui/TextArea.js +1 -1
  60. package/es/library/dot/components/form-fields/textarea/frameworks/ui/TextAreaView.js +4 -2
  61. package/es/library/dot/components/form-fields/textbox/frameworks/ui/TextBoxView.js +2 -0
  62. package/es/library/dot/components/form-fields/url/frameworks/ui/UrlView.js +2 -0
  63. package/es/library/dot/components/table-list/frameworks/ui/sub-components/header/HeaderData.js +1 -1
  64. package/es/library/dot/legacy-to-new-arch/table-field-components/text-field/frameworks/ui/TextFieldView.js +20 -0
  65. package/es/library/dot/legacy-to-new-arch/text/frameworks/ui/Text.js +2 -2
  66. package/es/library/dot/legacy-to-new-arch/text/frameworks/ui/TextView.js +22 -1
  67. package/es/platform/app-context-behaviour/adapters/controllers/AbstractController.js +9 -0
  68. package/es/platform/app-context-behaviour/adapters/controllers/UpdatePropertiesController.js +32 -0
  69. package/es/platform/app-context-behaviour/adapters/gateway/Repository.js +22 -0
  70. package/es/platform/app-context-behaviour/adapters/gateway/Service.js +10 -0
  71. package/es/platform/app-context-behaviour/adapters/presenter/Presenter.js +16 -0
  72. package/es/platform/app-context-behaviour/applications/interfaces/UseCaseDependencies.js +1 -0
  73. package/es/platform/app-context-behaviour/applications/interfaces/gateways/IRepository.js +1 -0
  74. package/es/platform/app-context-behaviour/applications/interfaces/gateways/IService.js +1 -0
  75. package/es/platform/app-context-behaviour/applications/interfaces/input/UpdatePropertiesInputModel.js +1 -0
  76. package/es/platform/app-context-behaviour/applications/interfaces/output/BehaviourOutputModel.js +1 -0
  77. package/es/platform/app-context-behaviour/applications/interfaces/output/IPresenter.js +1 -0
  78. package/es/platform/app-context-behaviour/applications/usecases/AbstractUseCase.js +17 -0
  79. package/es/platform/app-context-behaviour/applications/usecases/UpdatePropertiesUsecase.js +25 -0
  80. package/es/platform/app-context-behaviour/domain/entities/AppContext.js +44 -0
  81. package/es/platform/app-context-behaviour/domain/entities/interfaces/IAppContext.js +1 -0
  82. package/es/platform/app-context-behaviour/frameworks/AppContextBehaviourFactory.js +2 -2
  83. package/es/platform/app-context-behaviour/frameworks/EventHandlerFactory.js +22 -0
  84. package/es/platform/client-actions/behaviour/zclient-actions/adapters/presenters/FilterUtils.js +11 -0
  85. package/es/platform/client-actions/behaviour/zclient-actions/adapters/resources/ClientActionsFetchSDK.js +76 -0
  86. package/es/platform/client-actions/behaviour/zclient-actions/applications/interfaces/ClientActionsAPIGatewayParams.js +1 -0
  87. package/es/platform/client-actions/behaviour/zclient-actions/applications/interfaces/ClientActionsFetchSDKParams.js +10 -0
  88. package/es/platform/client-actions/behaviour/zclient-actions/applications/interfaces/IClientActionsFetchSDK.js +0 -0
  89. package/es/platform/client-scripts/behaviour/zclient-scripts-fetch/adapters/resources/ClientScriptsFetchSDK.js +43 -0
  90. package/es/platform/client-scripts/behaviour/zclient-scripts-fetch/applications/interfaces/ClientScriptsAPIGatewayParams.js +1 -0
  91. package/es/platform/client-scripts/behaviour/zclient-scripts-fetch/applications/interfaces/ClientScriptsSDKFetchParams.js +1 -0
  92. package/es/platform/client-scripts/behaviour/zclient-scripts-fetch/applications/interfaces/IClientScriptsFetchSDK.js +0 -0
  93. package/es/platform/column-chooser/adapters/controllers/ColumnChooserOpenController.js +14 -6
  94. package/es/platform/column-chooser/adapters/controllers/ColumnChooserUpdateController.js +22 -0
  95. package/es/platform/column-chooser/adapters/gateways/Repository.js +12 -1
  96. package/es/platform/column-chooser/adapters/gateways/Service.js +2 -0
  97. package/es/platform/column-chooser/applications/interfaces/input/ColumnChooserUpdateInput.js +1 -0
  98. package/es/platform/column-chooser/applications/usecases/ColumnChooserSaveUseCase.js +8 -1
  99. package/es/platform/column-chooser/applications/usecases/ColumnChooserUpdateUseCase.js +35 -0
  100. package/es/platform/column-chooser/domain/entities/ColumnChooserImp.js +6 -0
  101. package/es/platform/column-chooser/frameworks/EventHandlersFactory.js +6 -4
  102. package/es/platform/components/index.js +1 -0
  103. package/es/platform/components/smart-action-band/adapters/presenters/ActionBandTranslator.js +70 -8
  104. package/es/platform/components/smart-action-band/adapters/presenters/utils/DefaultClientActions.js +32 -0
  105. package/es/platform/components/smart-action-band/frameworks/EventHandlersFactory.js +42 -1
  106. package/es/platform/components/smart-action-band/frameworks/SmartActionBandFactory.js +4 -1
  107. package/es/platform/components/smart-navigation/adapters/controllers/LoadScriptController.js +0 -0
  108. package/es/platform/components/smart-navigation/adapters/controllers/UiModelInitializeController.js +0 -0
  109. package/es/platform/components/smart-navigation/adapters/presenters/OneUnifiedNavigationTranslator.js +248 -0
  110. package/es/platform/components/smart-navigation/adapters/presenters/Present.js +77 -0
  111. package/es/platform/components/smart-navigation/adapters/presenters/SampleModel.js +356 -0
  112. package/es/platform/components/smart-navigation/adapters/resources/SmartNavigationResource.js +96 -0
  113. package/es/platform/components/smart-navigation/applications/usecases/NavigateModuleUseCase.js +0 -0
  114. package/es/platform/components/smart-navigation/frameworks/CustomElementRenderer.js +22 -0
  115. package/es/platform/components/smart-navigation/frameworks/SmartNavigation.js +12 -0
  116. package/es/platform/components/smart-navigation/frameworks/one-unification/OneUnificationEventHandlers.js +156 -0
  117. package/es/platform/components/smart-navigation/frameworks/one-unification/SmartNavigation.js +83 -0
  118. package/es/platform/components/smart-navigation/frameworks/one-unification/SmartNavigation.module.css +3 -0
  119. package/es/platform/components/smart-navigation/frameworks/one-unification/SmartNavigationEventHandlers.js +173 -0
  120. package/es/platform/components/smart-navigation/frameworks/one-unification/UnifiedNavigation.js +48 -0
  121. package/es/platform/components/smart-navigation/frameworks/one-unification/UnifiedNavigationActions.js +144 -0
  122. package/es/platform/components/table-connected/adapters/resources/SmartTableResource.js +52 -0
  123. package/es/platform/components/table-connected/frameworks/EventHandlersFactory.js +1 -7
  124. package/es/platform/components/table-connected/frameworks/ListSdkFactory.js +4 -2
  125. package/es/platform/data-source/http-template/fetchLookupFields.js +0 -6
  126. package/es/platform/data-source/http-template/getPageClientActions.js +23 -0
  127. package/es/platform/data-source/http-template/getSingleRecord.js +51 -0
  128. package/es/platform/data-source/index.js +2 -0
  129. package/es/platform/data-source/utils/validation-rules/FieldConditions.js +1 -1
  130. package/es/platform/sdk-behaviour/adapters/controllers/InitializeController.js +7 -2
  131. package/es/platform/sdk-behaviour/applications/usecases/CreateResourceInstanceUseCase.js +10 -1
  132. package/es/platform/zform/adapters/controllers/GetInitialRecordSuccessController.js +31 -0
  133. package/es/platform/zform/adapters/gateway/FormRepository.js +10 -2
  134. package/es/platform/zform/adapters/gateway/Service.js +2 -0
  135. package/es/platform/zform/adapters/presenter/FormTranslator.js +27 -15
  136. package/es/platform/zform/adapters/presenter/translators/SectionTranslator.js +1 -1
  137. package/es/platform/zform/adapters/presenter/translators/fields/CurrencyFieldTranslator.js +1 -0
  138. package/es/platform/zform/adapters/presenter/translators/fields/DecimalFieldTranslator.js +1 -0
  139. package/es/platform/zform/adapters/presenter/translators/fields/EmailFieldTranslator.js +1 -0
  140. package/es/platform/zform/adapters/presenter/translators/fields/LookUpFieldTranslator.js +11 -7
  141. package/es/platform/zform/adapters/presenter/translators/fields/NumberFieldTranslator.js +1 -0
  142. package/es/platform/zform/adapters/presenter/translators/fields/PhoneFieldTranslator.js +1 -0
  143. package/es/platform/zform/adapters/presenter/translators/fields/TextAreaFieldTranslator.js +1 -0
  144. package/es/platform/zform/adapters/presenter/translators/fields/TextFieldTranslator.js +1 -0
  145. package/es/platform/zform/adapters/presenter/translators/fields/URLFieldTranslator.js +1 -0
  146. package/es/platform/zform/adapters/presenter/utils/sanitizeHtmlString.js +2 -2
  147. package/es/platform/zform/applications/interfaces/input/GetInitialRecordSuccessUseCaseInputModel.js +1 -0
  148. package/es/platform/zform/applications/usecases/GetInitialRecordSuccessUseCase.js +132 -0
  149. package/es/platform/zform/applications/usecases/InitializeUseCase.js +54 -30
  150. package/es/platform/zform/applications/usecases/LookupFieldSuccessUseCase.js +5 -0
  151. package/es/platform/zform/applications/usecases/MyFormSuccessUseCase.js +12 -11
  152. package/es/platform/zform/applications/usecases/SubmitValidationCompletedUseCase.js +21 -8
  153. package/es/platform/zform/domain/ZField.js +7 -5
  154. package/es/platform/zform/domain/ZForm.js +97 -20
  155. package/es/platform/zform/frameworks/ui/EventHandlerFactory.js +23 -5
  156. package/es/platform/zform/frameworks/ui/ZFormBehaviourFactory.js +2 -0
  157. package/es/platform/zlist/adapters/presenters/TableTranslator.js +5 -4
  158. package/es/platform/zrecord/adapters/controllers/UpdateRecordController.js +30 -0
  159. package/es/platform/zrecord/adapters/gateways/Service.js +2 -0
  160. package/es/platform/zrecord/applications/interfaces/input/UpdateRecordInputModel.js +0 -0
  161. package/es/platform/zrecord/applications/usecases/UpdateRecordUseCase.js +30 -0
  162. package/es/platform/zrecord/frameworks/ActionsHandlersFactory.js +4 -1
  163. package/package.json +9 -11
  164. package/es/platform/components/table-connected/adapters/controllers/ColumnChooserOpenedController.js +0 -28
  165. package/es/platform/components/table-connected/adapters/controllers/ColumnChooserUpdateController.js +0 -31
@@ -57,7 +57,7 @@ export function MaxLengthCondition(field) {
57
57
  conditions: [{
58
58
  condition: TextValidationConditions.IsNot,
59
59
  fieldName: apiName,
60
- value: [`maxLength:/(${btoa(`.{0,${maxLength}}`)})/`]
60
+ value: [`maxLength:/(${btoa(`[\\w\\W]{0,${maxLength}}`)})/`]
61
61
  }],
62
62
  actions: {
63
63
  alert: i18NProviderUtils.getI18NValue('support.form.more.than.max.length', [i18NLabel, maxLength])
@@ -2,7 +2,9 @@ import { AbstractController } from "./AbstractController";
2
2
  export class InitializeController extends AbstractController {
3
3
  handle(_ref) {
4
4
  let {
5
- state
5
+ state,
6
+ dispatch,
7
+ updateState
6
8
  } = _ref;
7
9
  const {
8
10
  service
@@ -12,7 +14,10 @@ export class InitializeController extends AbstractController {
12
14
  createResourceInstanceUseCase
13
15
  } = service;
14
16
  createResourceInstanceUseCase.execute({
15
- instanceName
17
+ instanceName,
18
+ state,
19
+ dispatch,
20
+ updateState
16
21
  });
17
22
  }
18
23
 
@@ -2,13 +2,22 @@ import AbstractUseCase from "../AbstractUseCase";
2
2
  export class CreateResourceInstanceUseCase extends AbstractUseCase {
3
3
  execute(_ref) {
4
4
  let {
5
- instanceName
5
+ instanceName,
6
+ state,
7
+ dispatch,
8
+ updateState
6
9
  } = _ref;
7
10
  const {
8
11
  repository
9
12
  } = this.dependencies;
10
13
  const behaviourResourceConnector = repository.getBehaviourResourceConnector();
11
14
  behaviourResourceConnector.createResourceInstances(instanceName);
15
+ behaviourResourceConnector.syncStateWithResources({
16
+ instanceName,
17
+ state,
18
+ dispatch,
19
+ updateState
20
+ });
12
21
  }
13
22
 
14
23
  }
@@ -0,0 +1,31 @@
1
+ import AbstractController from "./AbstractController";
2
+
3
+ class GetInitialRecordSuccessController extends AbstractController {
4
+ handle(event) {
5
+ const {
6
+ getInitialRecordSuccessUseCase
7
+ } = this.service;
8
+ let {
9
+ state,
10
+ updateState,
11
+ action,
12
+ dispatch
13
+ } = event;
14
+ const {
15
+ disableValidationRule,
16
+ disableLayoutRule,
17
+ disableDependencyMapping
18
+ } = state.properties;
19
+ getInitialRecordSuccessUseCase.updateDependency(state, updateState);
20
+ getInitialRecordSuccessUseCase.execute({
21
+ dispatch,
22
+ record: action.payload.response,
23
+ disableValidationRule,
24
+ disableLayoutRule,
25
+ disableDependencyMapping
26
+ });
27
+ }
28
+
29
+ }
30
+
31
+ export default GetInitialRecordSuccessController;
@@ -13,7 +13,8 @@ class FormRepository {
13
13
  getFormEntity() {
14
14
  const {
15
15
  moduleName,
16
- departmentId
16
+ departmentId,
17
+ recordId
17
18
  } = this.state.properties;
18
19
  const {
19
20
  context
@@ -25,7 +26,10 @@ class FormRepository {
25
26
  validationRules = [],
26
27
  sections = [],
27
28
  layoutRules = [],
28
- dependencyMappings = []
29
+ dependencyMappings = [],
30
+ layoutId,
31
+ mode,
32
+ initialRecordData
29
33
  } = zform;
30
34
  let validationRuleEntities = validationRules.map(rule => {
31
35
  return new ZValidationRule(rule);
@@ -59,6 +63,10 @@ class FormRepository {
59
63
  dependencyMappings: dependencyMappingsEntities,
60
64
  layoutRules: layoutRulesEntities,
61
65
  context,
66
+ layoutId: layoutId,
67
+ recordId,
68
+ mode,
69
+ initialRecordData,
62
70
  isMyFormFetching: zform.isMyFormFetching,
63
71
  isDependencyFetching: zform.isDependencyFetching,
64
72
  isLayoutRulesFetching: zform.isLayoutRulesFetching,
@@ -3,6 +3,7 @@ import CreateRecordSuccessUseCase from "../../applications/usecases/CreateRecord
3
3
  import CreateRecordFailedUseCase from "../../applications/usecases/CreateRecordFailedUseCase";
4
4
  import InitializeUseCase from "../../applications/usecases/InitializeUseCase";
5
5
  import MyLayoutSuccessUseCase from "../../applications/usecases/MyLayoutSuccessUseCase";
6
+ import GetInitialRecordSuccessUseCase from "../../applications/usecases/GetInitialRecordSuccessUseCase";
6
7
  import MyFormSuccessUseCase from "../../applications/usecases/MyFormSuccessUseCase";
7
8
  import DependenciesSuccessUseCase from "../../applications/usecases/DependenciesSuccessUseCase";
8
9
  import MyFormRequestUseCase from "../../applications/usecases/MyFormRequestUseCase";
@@ -26,6 +27,7 @@ class Service {
26
27
  this.formSubmitUseCase = new FormSubmitUseCase(dependencies);
27
28
  this.initializeUseCase = new InitializeUseCase(dependencies);
28
29
  this.myLayoutSuccessUseCase = new MyLayoutSuccessUseCase(dependencies);
30
+ this.getInitialRecordSuccessUseCase = new GetInitialRecordSuccessUseCase(dependencies);
29
31
  this.myFormSuccessUseCase = new MyFormSuccessUseCase(dependencies);
30
32
  this.dependenciesSuccessUseCase = new DependenciesSuccessUseCase(dependencies);
31
33
  this.myFormRequestUseCase = new MyFormRequestUseCase(dependencies);
@@ -1,6 +1,7 @@
1
1
  import ClientActionsTranslator from "../../../client-actions/translators/client-actions-translator";
2
2
  import SectionTranslator from "./translators/SectionTranslator";
3
3
  import DefaultFormClientActions from "./utils/DefaultClientActions";
4
+ import { filterClientActionsByLocation } from "../../../client-actions/behaviour/zclient-actions/adapters/presenters/FilterUtils";
4
5
  export default class FormTranslator {
5
6
  static transformState(state) {
6
7
  const {
@@ -40,14 +41,23 @@ export default class FormTranslator {
40
41
  });
41
42
  const mappedClientActions = mapper(combinedClientActions || []);
42
43
  const transformedClientActions = {};
44
+ const formValues = zform.formValues ? zform.formValues : {
45
+ cf: {}
46
+ };
47
+ const initialRecordData = zform.initialRecordData ? zform.initialRecordData : {
48
+ cf: {}
49
+ };
43
50
  const actionContext = { ...context,
51
+ mode: zform.mode,
52
+ formValues,
53
+ record: initialRecordData,
44
54
  isSubmitFetching,
45
55
  submitStatus: isSubmitFetching ? 'loading' : 'none'
46
56
  };
47
57
  Object.entries(mappedClientActions).forEach(_ref => {
48
58
  let [key, value] = _ref;
49
59
 
50
- if (isFooterEnabled && (key === 'footerRightActions' || key === 'footerLeftActions')) {
60
+ if (isFooterEnabled && (key === 'footerLeftActions' || key === 'footerRightActions')) {
51
61
  let footerActions = ClientActionsTranslator.transform(value, instanceName, moduleName, actionContext);
52
62
  transformedClientActions[key] = footerActions;
53
63
  }
@@ -143,17 +153,19 @@ export default class FormTranslator {
143
153
 
144
154
  }
145
155
 
146
- const mapper = clientAction => ({
147
- headerLeftActions: clientAction.filter(action => action.location === 'header_left_actions'),
148
- headerRightActions: clientAction.filter(action => action.location === 'header_right_actions'),
149
- footerLeftActions: clientAction.filter(action => action.location === 'footer_left_actions'),
150
- footerRightActions: clientAction.filter(action => action.location === 'footer_right_actions'),
151
- fieldLabelActions: clientAction.filter(action => action.location === 'field_label_actions'),
152
- fieldActions: clientAction.filter(action => action.location === 'field_actions'),
153
- sectionHeaderLeftActions: clientAction.filter(action => action.location === 'section_header_left_actions'),
154
- sectionHeaderRightActions: clientAction.filter(action => action.location === 'section_header_right_actions'),
155
- sectionTitleLeftActions: clientAction.filter(action => action.location === 'section_title_left_actions'),
156
- sectionTitleRightActions: clientAction.filter(action => action.location === 'section_title_right_actions'),
157
- fieldOptionLeftActions: clientAction.filter(action => action.location === 'field_options_left_actions'),
158
- fieldOptionRightActions: clientAction.filter(action => action.location === 'field_options_right_actions')
159
- });
156
+ const mapper = clientActions => {
157
+ return {
158
+ headerLeftActions: filterClientActionsByLocation(clientActions, 'header_left_actions'),
159
+ headerRightActions: filterClientActionsByLocation(clientActions, 'header_right_actions'),
160
+ footerLeftActions: filterClientActionsByLocation(clientActions, 'footer_left_actions'),
161
+ footerRightActions: filterClientActionsByLocation(clientActions, 'footer_right_actions'),
162
+ fieldLabelActions: filterClientActionsByLocation(clientActions, 'field_label_actions'),
163
+ fieldActions: filterClientActionsByLocation(clientActions, 'field_actions'),
164
+ sectionHeaderLeftActions: filterClientActionsByLocation(clientActions, 'section_header_left_actions'),
165
+ sectionHeaderRightActions: filterClientActionsByLocation(clientActions, 'section_header_right_actions'),
166
+ sectionTitleLeftActions: filterClientActionsByLocation(clientActions, 'section_title_left_actions'),
167
+ sectionTitleRightActions: filterClientActionsByLocation(clientActions, 'section_title_right_actions'),
168
+ fieldOptionLeftActions: filterClientActionsByLocation(clientActions, 'field_options_left_actions'),
169
+ fieldOptionRightActions: filterClientActionsByLocation(clientActions, 'field_options_right_actions')
170
+ };
171
+ };
@@ -109,7 +109,7 @@ function SectionTranslator(_ref) {
109
109
  fieldPreModified['actions'] = transformedDefaultActions.fieldActions.concat(transformedActions.fieldActions);
110
110
  const noPlaceHolderSupport = ['Boolean', 'Date', 'DateTime']; // Placeholder check
111
111
 
112
- if (field.toolTip && field.toolTipType === "placeholder" && !noPlaceHolderSupport.includes(field.type)) {
112
+ if (field.toolTip && field.toolTipType === "placeHolder" && !noPlaceHolderSupport.includes(field.type)) {
113
113
  fieldPreModified["placeholder"] = field.toolTip;
114
114
  } // const optionActionAvailArray = ['Picklist', 'Multiselect'];
115
115
  // // Option Actions check
@@ -21,6 +21,7 @@ const CurrencyFieldTranslator = _ref => {
21
21
  id: field.id,
22
22
  label: field.i18NLabel,
23
23
  required: field.isMandatory,
24
+ maxLength: field.maxLength,
24
25
  readonly: field.isReadOnly,
25
26
  isVisible: field.isVisible,
26
27
  currencyLocale: prefCurrencyLocale || contextCurrencyLocale,
@@ -16,6 +16,7 @@ const DecimalFieldTranslator = _ref => {
16
16
  label: field.i18NLabel,
17
17
  // ePHI: field.isPHI, //field.ePHI,
18
18
  required: field.isMandatory,
19
+ maxLength: field.maxLength,
19
20
  readonly: field.isReadOnly,
20
21
  isVisible: field.isVisible,
21
22
  errorMessage: field.errorMessage || ''
@@ -16,6 +16,7 @@ const EmailFieldTranslator = _ref => {
16
16
  label: field.i18NLabel,
17
17
  // ePHI: field.isPHI, //field.ePHI,
18
18
  required: field.isMandatory,
19
+ maxLength: field.maxLength,
19
20
  readonly: field.isReadOnly,
20
21
  // visibility: field.isVisible,
21
22
  isVisible: field.isVisible,
@@ -6,19 +6,23 @@ const LookUpFieldTranslator = _ref => {
6
6
  uiConfig
7
7
  } = _ref;
8
8
  const fieldModified = {
9
- type,
10
- uiConfig,
11
- value: field.value || '',
9
+ // Need to check if value is an object or string (ID)
10
+ value: field.value ? field.value instanceof Object ? field.value.id : field.value : '',
12
11
  //state.behaviours.zform.values[field.apiName],
13
12
  name: field.apiName,
14
13
  ...fieldPreModified,
14
+ uiConfig: uiConfig,
15
+ type: type,
16
+ fieldType: field.type,
15
17
  id: field.id,
16
18
  label: field.i18NLabel,
17
- required: field.isMandatory,
18
- readonly: field.isReadOnly,
19
- // visibility: field.isVisible,
19
+ apiName: field.apiName,
20
+ errorMessage: field.errorMessage,
20
21
  isVisible: field.isVisible,
21
- errorMessage: field.errorMessage || '',
22
+ readonly: field.isReadOnly,
23
+ required: field.isMandatory,
24
+ isCustomField: field.isCustomField,
25
+ maxLength: field.maxLength,
22
26
  lookup: field.lookup
23
27
  };
24
28
  return fieldModified;
@@ -16,6 +16,7 @@ const NumberFieldTranslator = _ref => {
16
16
  label: field.i18NLabel,
17
17
  // ePHI: field.isPHI, //field.ePHI,
18
18
  required: field.isMandatory,
19
+ maxLength: field.maxLength,
19
20
  readonly: field.isReadOnly,
20
21
  // visibility: field.isVisible,
21
22
  isVisible: field.isVisible,
@@ -16,6 +16,7 @@ const PhoneFieldTranslator = _ref => {
16
16
  label: field.i18NLabel,
17
17
  // ePHI: field.isPHI, //field.ePHI,
18
18
  required: field.isMandatory,
19
+ maxLength: field.maxLength,
19
20
  readonly: field.isReadOnly,
20
21
  isVisible: field.isVisible,
21
22
  errorMessage: field.errorMessage || ''
@@ -16,6 +16,7 @@ const TextAreaFieldTranslator = _ref => {
16
16
  label: field.i18NLabel,
17
17
  required: field.isMandatory,
18
18
  readonly: field.isReadOnly,
19
+ maxLength: field.maxLength,
19
20
  // visibility: field.isVisible,
20
21
  isVisible: field.isVisible,
21
22
  errorMessage: field.errorMessage || ''
@@ -17,6 +17,7 @@ const TextFieldTranslator = _ref => {
17
17
  // ePHI: field.isPHI, //field.ePHI,
18
18
  required: field.isMandatory,
19
19
  readonly: field.isReadOnly,
20
+ maxLength: field.maxLength,
20
21
  // visibility: field.isVisible,
21
22
  isVisible: field.isVisible,
22
23
  errorMessage: field.errorMessage || ''
@@ -16,6 +16,7 @@ const URLFieldTranslator = _ref => {
16
16
  label: field.i18NLabel,
17
17
  // ePHI: field.isPHI, //field.ePHI,
18
18
  required: field.isMandatory,
19
+ maxLength: field.maxLength,
19
20
  readonly: field.isReadOnly,
20
21
  // visibility: field.isVisible,
21
22
  isVisible: field.isVisible,
@@ -1,5 +1,5 @@
1
- import ZSEC from '@zoho/SecurityJS';
2
- const currentZSEC = ZSEC['7.2.4'];
1
+ import ZWAF from '@zoho/SecurityJS';
2
+ const currentZSEC = ZWAF['7.4.2'];
3
3
  const {
4
4
  HTMLPurifier
5
5
  } = currentZSEC;
@@ -0,0 +1,132 @@
1
+ import AbstractUseCase from "./AbstractUseCase";
2
+ import { ZFORM_API_FAILURE, ZFORM_DEPENDENCY_MAPPINGS_SUCCESS, ZFORM_LAYOUT_RULES_SUCCESS, ZFORM_MY_FORM_SUCCESS } from "../../../../bc/zform/Symbol";
3
+ import { DATA_SOURCE_EXECUTE as DATA_BROKER_EXECUTE } from "../../../../bc/zdata-source/Constants";
4
+ import { DATA_SOURCE_SUCCESS, DATA_SOURCE_NO_CONTENT, DATA_SOURCE_FAILURE } from "../../../../bc/zdata-source/Symbols";
5
+
6
+ class GetInitialRecordSuccessUseCase extends AbstractUseCase {
7
+ execute(input) {
8
+ const {
9
+ disableValidationRule,
10
+ disableLayoutRule,
11
+ disableDependencyMapping
12
+ } = input;
13
+ const {
14
+ dispatch,
15
+ record
16
+ } = input;
17
+ const zformEntity = this.dependencies.repository.getFormEntity();
18
+ zformEntity.setInitialRecord(record);
19
+ const context = { ...zformEntity.getContext(),
20
+ layoutId: zformEntity.getLayoutId()
21
+ };
22
+ dispatch({
23
+ type: DATA_BROKER_EXECUTE,
24
+ payload: {
25
+ actionName: "getMyForm",
26
+ props: context
27
+ },
28
+ metaData: {
29
+ actionName: "getMyForm",
30
+ //hack
31
+ initialRecordData: record,
32
+ // Store record data here for later use
33
+ [DATA_SOURCE_NO_CONTENT]: {
34
+ type: ZFORM_MY_FORM_SUCCESS,
35
+ metaData: {
36
+ actionName: "getMyForm",
37
+ initialRecordData: record
38
+ }
39
+ },
40
+ //hack
41
+ [DATA_SOURCE_FAILURE]: {
42
+ type: ZFORM_API_FAILURE,
43
+ metaData: {
44
+ actionName: 'getMyForm'
45
+ }
46
+ },
47
+ [DATA_SOURCE_SUCCESS]: {
48
+ type: ZFORM_MY_FORM_SUCCESS,
49
+ metaData: {
50
+ actionName: "getMyForm",
51
+ initialRecordData: record
52
+ }
53
+ }
54
+ }
55
+ });
56
+
57
+ if (!disableDependencyMapping) {
58
+ dispatch({
59
+ type: DATA_BROKER_EXECUTE,
60
+ payload: {
61
+ actionName: "getDependencyMappings",
62
+ props: context
63
+ },
64
+ metaData: {
65
+ actionName: "getDependencyMappings",
66
+ //hack
67
+ [DATA_SOURCE_SUCCESS]: {
68
+ type: ZFORM_DEPENDENCY_MAPPINGS_SUCCESS,
69
+ metaData: {
70
+ actionName: "getDependencyMappings"
71
+ }
72
+ },
73
+ [DATA_SOURCE_FAILURE]: {
74
+ type: ZFORM_API_FAILURE,
75
+ metaData: {
76
+ actionName: 'getDependencyMappings'
77
+ }
78
+ },
79
+ [DATA_SOURCE_NO_CONTENT]: {
80
+ type: ZFORM_DEPENDENCY_MAPPINGS_SUCCESS,
81
+ metaData: {
82
+ actionName: "getDependencyMappings"
83
+ }
84
+ }
85
+ }
86
+ });
87
+ } else {
88
+ zformEntity.setDependencyFetching(false);
89
+ }
90
+
91
+ if (!disableLayoutRule) {
92
+ dispatch({
93
+ type: DATA_BROKER_EXECUTE,
94
+ payload: {
95
+ actionName: "getLayoutRules",
96
+ props: { ...context,
97
+ activeRulesOnly: true
98
+ }
99
+ },
100
+ metaData: {
101
+ actionName: "getLayoutRules",
102
+ //hack
103
+ [DATA_SOURCE_NO_CONTENT]: {
104
+ type: ZFORM_LAYOUT_RULES_SUCCESS,
105
+ metaData: {
106
+ actionName: "getLayoutRules"
107
+ }
108
+ },
109
+ [DATA_SOURCE_FAILURE]: {
110
+ type: ZFORM_API_FAILURE,
111
+ metaData: {
112
+ actionName: 'getLayoutRules'
113
+ }
114
+ },
115
+ [DATA_SOURCE_SUCCESS]: {
116
+ type: ZFORM_LAYOUT_RULES_SUCCESS,
117
+ metaData: {
118
+ actionName: "getLayoutRules"
119
+ }
120
+ }
121
+ }
122
+ });
123
+ } else {
124
+ zformEntity.setLayoutRulesFetching(false);
125
+ }
126
+
127
+ this.dependencies.presenter.updateFormResponse(zformEntity.toObject());
128
+ }
129
+
130
+ }
131
+
132
+ export default GetInitialRecordSuccessUseCase;
@@ -1,10 +1,11 @@
1
1
  import AbstractUseCase from "./AbstractUseCase";
2
- import { ZFORM_API_FAILURE, ZFORM_MY_LAYOUTS_SUCCESS } from "../../../../bc/zform/Symbol";
2
+ import { ZFORM_API_FAILURE, ZFORM_INITIAL_RECORD_SUCCESS, ZFORM_MY_LAYOUTS_SUCCESS } from "../../../../bc/zform/Symbol";
3
3
  import { DATA_SOURCE_EXECUTE } from "../../../../bc/zdata-source/Constants";
4
- import { DATA_SOURCE_SUCCESS, DATA_SOURCE_NO_CONTENT, DATA_SOURCE_FAILURE } from "../../../../bc/zdata-source/Symbols";
5
4
  import { CLIENTACTION_BEHAVIOUR_EXECUTE } from "../../../client-actions/bc/zclient-actions/Constants";
6
5
  import { ZFormApiActionName } from "../../../../bc/zform/Constants";
7
6
  import { CLIENTSCRIPT_FETCH } from "../../../client-scripts/bc/zclient-scripts-fetch/Constants";
7
+ import { RecordApiActionName } from "../../../../bc/zrecord/Constants";
8
+ import { ACA_ERROR_OCCURRED, ErrorCodes } from "../../../../cc/component/ErrorStructure";
8
9
 
9
10
  class InitializeUseCase extends AbstractUseCase {
10
11
  execute(input) {
@@ -48,38 +49,61 @@ class InitializeUseCase extends AbstractUseCase {
48
49
  });
49
50
  }
50
51
 
51
- dispatch({
52
- type: DATA_SOURCE_EXECUTE,
53
- payload: {
54
- actionName: ZFormApiActionName.getMyLayouts,
55
- props: { ...context,
56
- from: 1,
57
- limit: 50
58
- }
59
- },
60
- metaData: {
61
- actionName: ZFormApiActionName.getMyLayouts,
62
- //hack
63
- [DATA_SOURCE_NO_CONTENT]: {
64
- type: ZFORM_MY_LAYOUTS_SUCCESS,
65
- metaData: {
66
- actionName: ZFormApiActionName.getMyLayouts
52
+ if (zformEntity.isEditMode()) {
53
+ const recordId = zformEntity.getRecordId();
54
+
55
+ if (!recordId) {
56
+ const errorStructure = {
57
+ code: ErrorCodes.PROPERTY_VALIDATION_FAILED,
58
+ message: 'Record ID is required for Edit Mode',
59
+ errorDetails: {
60
+ validationResults: [{
61
+ key: 'recordId',
62
+ errors: [{
63
+ message: 'Record ID is required for Edit Mode'
64
+ }],
65
+ value: recordId
66
+ }],
67
+ isBreaking: true
67
68
  }
69
+ };
70
+ dispatch({
71
+ type: ACA_ERROR_OCCURRED,
72
+ payload: errorStructure
73
+ });
74
+ return;
75
+ }
76
+
77
+ dispatch({
78
+ type: DATA_SOURCE_EXECUTE,
79
+ payload: {
80
+ actionName: RecordApiActionName.GET_SINGLE_RECORD,
81
+ props: context
68
82
  },
69
- [DATA_SOURCE_FAILURE]: {
70
- type: ZFORM_API_FAILURE,
71
- metaData: {
72
- actionName: ZFormApiActionName.getMyLayouts
83
+ metaData: zformEntity.getDataSourceMetaData({
84
+ actionName: RecordApiActionName.GET_SINGLE_RECORD,
85
+ successEvent: ZFORM_INITIAL_RECORD_SUCCESS,
86
+ failureEvent: ZFORM_API_FAILURE
87
+ })
88
+ });
89
+ } else {
90
+ dispatch({
91
+ type: DATA_SOURCE_EXECUTE,
92
+ payload: {
93
+ actionName: ZFormApiActionName.getMyLayouts,
94
+ props: { ...context,
95
+ from: 1,
96
+ limit: 50
73
97
  }
74
98
  },
75
- [DATA_SOURCE_SUCCESS]: {
76
- type: ZFORM_MY_LAYOUTS_SUCCESS,
77
- metaData: {
78
- actionName: ZFormApiActionName.getMyLayouts
79
- }
80
- }
81
- }
82
- });
99
+ metaData: zformEntity.getDataSourceMetaData({
100
+ actionName: ZFormApiActionName.getMyLayouts,
101
+ //hack
102
+ successEvent: ZFORM_MY_LAYOUTS_SUCCESS,
103
+ failureEvent: ZFORM_API_FAILURE
104
+ })
105
+ });
106
+ }
83
107
  }
84
108
 
85
109
  }
@@ -11,6 +11,11 @@ class LookUpFieldSuccessUseCase extends AbstractUseCase {
11
11
  dispatch,
12
12
  fieldMetadataResponse
13
13
  } = input;
14
+
15
+ if (!fieldMetadataResponse || !fieldMetadataResponse.data || fieldMetadataResponse.data.length === 0) {
16
+ return;
17
+ }
18
+
14
19
  const {
15
20
  data
16
21
  } = fieldMetadataResponse;
@@ -21,14 +21,17 @@ class MyFormSuccessUseCase extends AbstractUseCase {
21
21
  sections
22
22
  } = myForm;
23
23
  const zFormEntity = repository.getFormEntity();
24
+ const layoutId = zFormEntity.getLayoutId();
25
+ const initialRecord = zFormEntity.getInitialRecord();
24
26
  const context = { ...zFormEntity.getContext(),
25
- layoutId: zFormEntity.getLayoutId()
27
+ layoutId: layoutId
26
28
  };
27
29
  const lookupFields = sections.flatMap(section => section.fields.filter(field => field.type === 'LookUp'));
28
30
  const sectionEntities = sections.map(section => {
29
31
  const fields = section.fields.map(field => {
32
+ const recordValue = initialRecord ? field.isCustomField ? initialRecord.cf[field.apiName] : initialRecord[field.apiName] : undefined;
30
33
  const entity = new ZField(field);
31
- entity.decideDefaultValue();
34
+ entity.decideDefaultValue(recordValue);
32
35
  return entity;
33
36
  });
34
37
  const sectionWithFields = { ...section,
@@ -63,24 +66,22 @@ class MyFormSuccessUseCase extends AbstractUseCase {
63
66
  type: DATA_SOURCE_EXECUTE,
64
67
  payload: {
65
68
  actionName: 'fetchLookupFields',
66
- props: { ...context
67
- }
69
+ props: context
68
70
  },
69
71
  metaData: {
70
72
  actionName: 'fetchLookupFields',
71
- //hack
72
73
  [DATA_SOURCE_NO_CONTENT]: {
73
74
  type: ZFORM_LOOKUP_FIELD_SUCCESS,
74
75
  metaData: {
75
76
  actionName: 'fetchLookupFields'
76
77
  }
77
78
  },
78
- // [DATA_SOURCE_FAILURE]: {
79
- // type: ZFORM_LOOKUP_FIELD_SUCCESS,
80
- // metaData: {
81
- // actionName: 'fetchValidationRules'
82
- // }
83
- // },
79
+ [DATA_SOURCE_FAILURE]: {
80
+ type: ZFORM_API_FAILURE,
81
+ metaData: {
82
+ actionName: 'fetchLookupFields'
83
+ }
84
+ },
84
85
  [DATA_SOURCE_SUCCESS]: {
85
86
  type: ZFORM_LOOKUP_FIELD_SUCCESS,
86
87
  metaData: {