@zohodesk/library-platform 1.1.6 → 1.1.7-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 (97) hide show
  1. package/es/bc/sdk/ResourceNamesEnum.js +1 -0
  2. package/es/bc/zform/Properties.js +3 -26
  3. package/es/bc/zform/Symbol.js +2 -0
  4. package/es/cc/breadcrumb/Constants.js +7 -0
  5. package/es/cc/breadcrumb/Events.js +14 -0
  6. package/es/cc/breadcrumb/Properties.js +35 -0
  7. package/es/cc/breadcrumb/index.js +3 -0
  8. package/es/cc/fields/field/FormDefaultUIType.js +37 -0
  9. package/es/cc/fields/index.js +2 -1
  10. package/es/cc/form/Properties.js +54 -0
  11. package/es/cc/form-connected/Constants.js +8 -0
  12. package/es/cc/form-connected/Properties.js +95 -1
  13. package/es/cc/form-connected/SdkContract.js +159 -0
  14. package/es/cc/icon-button/Constants.js +7 -0
  15. package/es/cc/icon-button/Events.js +5 -0
  16. package/es/cc/icon-button/Properties.js +86 -0
  17. package/es/cc/icon-button/index.js +3 -0
  18. package/es/cc/index.js +1 -0
  19. package/es/cc/section/Properties.js +25 -0
  20. package/es/index.js +6 -1
  21. package/es/library/custom-component/adapters/gateways/event-manager/EventManager.js +2 -2
  22. package/es/library/dot/components/action-location/frameworks/ui/ActionComponentMapping.js +5 -1
  23. package/es/library/dot/components/form/adapters/presenter/TransformState.js +70 -3
  24. package/es/library/dot/components/form/frameworks/ui/DefaultComponentRegister.js +28 -0
  25. package/es/library/dot/components/form/frameworks/ui/Form.js +2 -0
  26. package/es/library/dot/components/form/frameworks/ui/FormView.js +47 -26
  27. package/es/library/dot/components/form/frameworks/ui/css/Form.module.css +8 -4
  28. package/es/library/dot/components/form/frameworks/ui/sub-components/Sections.js +9 -9
  29. package/es/library/dot/components/section/frameworks/ui/RenderField.js +19 -0
  30. package/es/library/dot/components/section/frameworks/ui/Section.js +13 -4
  31. package/es/library/dot/components/section/frameworks/ui/SectionView.js +7 -28
  32. package/es/library/dot/components/table-list/frameworks/ui/css/TableList.module.css +72 -40
  33. package/es/library/dot/components/table-list/frameworks/ui/sub-components/Header.js +7 -13
  34. package/es/library/dot/components/table-list/frameworks/ui/sub-components/row/Row.js +2 -2
  35. package/es/library/dot/legacy-to-new-arch/breadcrumb/frameworks/ui/Breadcrumb.js +12 -0
  36. package/es/library/dot/legacy-to-new-arch/breadcrumb/frameworks/ui/BreadcrumbView.js +47 -0
  37. package/es/library/dot/legacy-to-new-arch/breadcrumb/frameworks/ui/css/Breadcrumb.module.css +19 -0
  38. package/es/library/dot/legacy-to-new-arch/breadcrumb/frameworks/ui/sub-components/BreadcrumbItem.js +58 -0
  39. package/es/library/dot/legacy-to-new-arch/icon-button/frameworks/ui/IconButton.js +12 -0
  40. package/es/library/dot/legacy-to-new-arch/icon-button/frameworks/ui/IconButtonView.js +43 -0
  41. package/es/platform/client-actions/cc/action-event-mediator/Properties.js +9 -0
  42. package/es/platform/client-actions/components/action-event-mediator/frameworks/ui/ActionEventMediatorView.js +3 -1
  43. package/es/platform/client-actions/components/row-actions-renderer/frameworks/ui/RowActionsRenderer.module.css +4 -0
  44. package/es/platform/client-actions/components/row-actions-renderer/frameworks/ui/RowActionsRendererView.js +5 -2
  45. package/es/platform/components/form-connected/adapters/resources/SmartFormResources.js +210 -0
  46. package/es/platform/components/form-connected/application/interfaces/ISmartFormResources.js +1 -0
  47. package/es/platform/components/form-connected/frameworks/EventHandlersFactory.js +16 -8
  48. package/es/platform/components/form-connected/frameworks/FormConnectedFactory.js +27 -3
  49. package/es/platform/components/form-connected/frameworks/FormConnectedView.js +14 -2
  50. package/es/platform/components/form-connected/frameworks/FormSdkFactory.js +33 -13
  51. package/es/platform/components/table-connected/adapters/resources/SmartTableResource.js +0 -52
  52. package/es/platform/components/table-connected/frameworks/EventHandlersFactory.js +4 -1
  53. package/es/platform/page/index.js +46 -0
  54. package/es/platform/sdk/adapters/gateways/Service.js +4 -0
  55. package/es/platform/sdk/application/interfaces/gateways/AbstractResource.js +52 -1
  56. package/es/platform/sdk/application/usecases/GetResourcesUseCase.js +15 -0
  57. package/es/platform/sdk/domain/entities/ResourceManager.js +4 -0
  58. package/es/platform/sdk/frameworks/Sdk.js +7 -0
  59. package/es/platform/sdk/frameworks/SdkRegistry.js +9 -0
  60. package/es/platform/zform/adapters/presenter/FormTranslator.js +90 -46
  61. package/es/platform/zform/adapters/presenter/translators/SectionTranslator.js +45 -26
  62. package/es/platform/zform/adapters/presenter/translators/interfaces/ComponentMapping.js +1 -0
  63. package/es/platform/zform/adapters/presenter/translators/interfaces/FieldContract.js +1 -0
  64. package/es/platform/zform/adapters/presenter/translators/interfaces/FormTranslatorState.js +1 -0
  65. package/es/platform/zform/adapters/presenter/translators/interfaces/SectionContract.js +1 -0
  66. package/es/platform/zform/adapters/presenter/utils/DefaultClientActions.js +59 -0
  67. package/es/platform/zform/applications/interfaces/input/DeleteFieldUseCaseInput.js +1 -0
  68. package/es/platform/zform/applications/interfaces/input/GetFieldValueUseCaseInput.js +1 -0
  69. package/es/platform/zform/applications/interfaces/input/HideFieldUseCaseInput.js +1 -0
  70. package/es/platform/zform/applications/interfaces/input/HideSectionUseCaseInput.js +1 -0
  71. package/es/platform/zform/applications/interfaces/input/InsertFieldUseCaseInput.js +1 -0
  72. package/es/platform/zform/applications/interfaces/input/SetFieldValueUseCaseInput.js +1 -0
  73. package/es/platform/zform/applications/interfaces/input/SetFieldsValuesUseCaseInput.js +1 -0
  74. package/es/platform/zform/applications/interfaces/input/ShowFieldUseCaseInput.js +1 -0
  75. package/es/platform/zform/applications/interfaces/input/ShowSectionUseCaseInput.js +1 -0
  76. package/es/platform/zform/applications/interfaces/input/SubmitUseCaseInput.js +1 -0
  77. package/es/platform/zform/applications/interfaces/input/UpdateFieldUseCaseInput.js +1 -0
  78. package/es/platform/zform/applications/usecases/DeleteFieldUseCase.js +22 -0
  79. package/es/platform/zform/applications/usecases/GetFieldValueUseCase.js +23 -0
  80. package/es/platform/zform/applications/usecases/HideFieldUseCase.js +19 -0
  81. package/es/platform/zform/applications/usecases/HideSectionUseCase.js +19 -0
  82. package/es/platform/zform/applications/usecases/InitializeUseCase.js +16 -0
  83. package/es/platform/zform/applications/usecases/InsertFieldUseCase.js +28 -0
  84. package/es/platform/zform/applications/usecases/SetFieldValueUseCase.js +44 -0
  85. package/es/platform/zform/applications/usecases/SetFieldsValuesUseCase.js +51 -0
  86. package/es/platform/zform/applications/usecases/ShowFieldUseCase.js +19 -0
  87. package/es/platform/zform/applications/usecases/ShowSectionUseCase.js +19 -0
  88. package/es/platform/zform/applications/usecases/SubmitUseCase.js +29 -0
  89. package/es/platform/zform/applications/usecases/UpdateFieldUseCase.js +22 -0
  90. package/es/platform/zform/domain/ZField.js +14 -0
  91. package/es/platform/zform/domain/ZForm.js +85 -3
  92. package/es/platform/zform/domain/ZSection.js +6 -0
  93. package/es/platform/zform/frameworks/ui/EventHandlerFactory.js +37 -15
  94. package/es/platform/zrecord/adapters/controllers/CreateRecordController.js +5 -1
  95. package/es/platform/zrecord/applications/usecases/CreateRecordUseCase.js +5 -3
  96. package/package.json +7 -6
  97. package/es/library/dot/components/section/adapters/presenter/TransFormState.js +0 -26
@@ -0,0 +1,22 @@
1
+ import AbstractUseCase from "./AbstractUseCase";
2
+
3
+ class DeleteFieldUseCase extends AbstractUseCase {
4
+ execute(input) {
5
+ const {
6
+ fieldName,
7
+ dispatch
8
+ } = input;
9
+ const {
10
+ repository,
11
+ presenter
12
+ } = this.dependencies;
13
+ const zformEntitiy = repository.getFormEntity();
14
+ let fieldId = zformEntitiy.getFieldId(fieldName);
15
+ zformEntitiy.deleteField(fieldId);
16
+ let zform = zformEntitiy.toObject();
17
+ presenter.updateFormResponse(zform);
18
+ }
19
+
20
+ }
21
+
22
+ export default DeleteFieldUseCase;
@@ -0,0 +1,23 @@
1
+ import AbstractUseCase from "./AbstractUseCase";
2
+
3
+ class GetFieldValueUseCase extends AbstractUseCase {
4
+ execute(input) {
5
+ const {
6
+ fieldName,
7
+ callback,
8
+ dispatch
9
+ } = input;
10
+ const {
11
+ repository,
12
+ presenter
13
+ } = this.dependencies;
14
+ const zformEntitiy = repository.getFormEntity();
15
+ let fieldValue = zformEntitiy.getFieldValue(fieldName);
16
+ let zform = zformEntitiy.toObject();
17
+ presenter.updateFormResponse(zform);
18
+ callback === null || callback === void 0 ? void 0 : callback(fieldValue);
19
+ }
20
+
21
+ }
22
+
23
+ export default GetFieldValueUseCase;
@@ -0,0 +1,19 @@
1
+ import AbstractUseCase from "./AbstractUseCase";
2
+
3
+ class HideFieldUseCase extends AbstractUseCase {
4
+ execute(input) {
5
+ const {
6
+ fieldName
7
+ } = input;
8
+ const {
9
+ repository,
10
+ presenter
11
+ } = this.dependencies;
12
+ const form = repository.getFormEntity();
13
+ form.setFieldVisibility(fieldName, false);
14
+ presenter.updateFormResponse(form.toObject());
15
+ }
16
+
17
+ }
18
+
19
+ export default HideFieldUseCase;
@@ -0,0 +1,19 @@
1
+ import AbstractUseCase from "./AbstractUseCase";
2
+
3
+ class HideSectionUseCase extends AbstractUseCase {
4
+ execute(input) {
5
+ const {
6
+ sectionName
7
+ } = input;
8
+ const {
9
+ repository,
10
+ presenter
11
+ } = this.dependencies;
12
+ const form = repository.getFormEntity();
13
+ form.setSectionVisibility(sectionName, false);
14
+ presenter.updateFormResponse(form.toObject());
15
+ }
16
+
17
+ }
18
+
19
+ export default HideSectionUseCase;
@@ -2,6 +2,7 @@ import AbstractUseCase from "./AbstractUseCase";
2
2
  import { ZFORM_MY_LAYOUTS_SUCCESS } from "../../../../bc/zform/Symbol";
3
3
  import { DATA_SOURCE_EXECUTE as DATA_BROKER_EXECUTE } from "../../../../bc/zdata-source/Constants";
4
4
  import { DATA_SOURCE_SUCCESS as DATA_BROKER_SUCCESS, DATA_SOURCE_NO_CONTENT as DATA_BROKER_NO_CONTENT } from "../../../../bc/zdata-source/Symbols";
5
+ import { CLIENTACTION_BEHAVIOUR_EXECUTE } from "../../../client-actions/bc/zclient-actions/Constants";
5
6
 
6
7
  class InitializeUseCase extends AbstractUseCase {
7
8
  execute(input) {
@@ -10,6 +11,21 @@ class InitializeUseCase extends AbstractUseCase {
10
11
  } = input;
11
12
  const zformEntity = this.dependencies.repository.getFormEntity();
12
13
  const context = zformEntity.getContext();
14
+ dispatch({
15
+ type: CLIENTACTION_BEHAVIOUR_EXECUTE,
16
+ payload: {
17
+ actionName: 'getClientActions',
18
+ props: {
19
+ moduleName: 'static_module',
20
+ component: 'smart_form',
21
+ limit: '1',
22
+ from: '12',
23
+ servicePrefix: 'zform',
24
+ orgName: 'orgName'
25
+ },
26
+ apiName: 'clientActions'
27
+ }
28
+ });
13
29
  dispatch({
14
30
  type: DATA_BROKER_EXECUTE,
15
31
  payload: {
@@ -0,0 +1,28 @@
1
+ import AbstractUseCase from "./AbstractUseCase";
2
+ import ZField from "../../domain/ZField";
3
+
4
+ class InsertFieldUseCase extends AbstractUseCase {
5
+ execute(input) {
6
+ const {
7
+ sectionName,
8
+ fieldsObj,
9
+ fieldIndex,
10
+ dispatch
11
+ } = input;
12
+ const {
13
+ repository,
14
+ presenter
15
+ } = this.dependencies;
16
+ const zformEntitiy = repository.getFormEntity();
17
+ let sectionId = zformEntitiy.getSectionId({
18
+ sectionName
19
+ });
20
+ let entity = new ZField(fieldsObj);
21
+ zformEntitiy.insertFieldAtPositionInSection(sectionId, entity, fieldIndex);
22
+ let zform = zformEntitiy.toObject();
23
+ presenter.updateFormResponse(zform);
24
+ }
25
+
26
+ }
27
+
28
+ export default InsertFieldUseCase;
@@ -0,0 +1,44 @@
1
+ import AbstractUseCase from "./AbstractUseCase";
2
+ import { ZFORM_FIELD_VALUE_CHANGE_REQUEST } from "../../../../bc/zform/Symbol";
3
+
4
+ class SetFieldValueUseCase extends AbstractUseCase {
5
+ execute(input) {
6
+ let {
7
+ fieldName,
8
+ newValue,
9
+ dispatch
10
+ } = input; // let { layoutRuleApplier } = this.dependencies
11
+
12
+ let zformEntitiy = this.dependencies.repository.getFormEntity(); // zformEntitiy.setFieldValue(fieldName, newValue, ({ layoutRules, formData }) => {
13
+ // return layoutRuleApplier.applyRules({
14
+ // layoutRules,
15
+ // formData,
16
+ // myForm: zformEntitiy.toObject()
17
+ // })
18
+ // });
19
+ // let zform = zformEntitiy.toObject();
20
+ // // let { fieldResult, sectionResult } = this.dependencies.layoutRuleApplier.applyRules({
21
+ // // layoutRules,
22
+ // // formData: zformEntitiy.getFormData(),
23
+ // // myForm: zform
24
+ // // });
25
+ // // zformEntitiy.applyLayoutRulesResult(sectionResult, fieldResult)
26
+ // // zform = zformEntitiy.toObject();
27
+ // this.dependencies.presenter.updateFormResponse(zform);
28
+
29
+ dispatch({
30
+ type: ZFORM_FIELD_VALUE_CHANGE_REQUEST,
31
+ payload: {
32
+ sectionId: zformEntitiy.getSectionId({
33
+ fieldName
34
+ }),
35
+ fieldName,
36
+ value: newValue
37
+ },
38
+ metaData: {}
39
+ });
40
+ }
41
+
42
+ }
43
+
44
+ export default SetFieldValueUseCase;
@@ -0,0 +1,51 @@
1
+ import AbstractUseCase from "./AbstractUseCase";
2
+ import { ZFORM_FIELD_VALUE_CHANGE_REQUEST } from "../../../../bc/zform/Symbol";
3
+
4
+ class SetFieldsValuesUseCase extends AbstractUseCase {
5
+ execute(input) {
6
+ let {
7
+ fieldsValuesObj,
8
+ dispatch
9
+ } = input; // let { layoutRuleApplier } = this.dependencies
10
+
11
+ let zformEntitiy = this.dependencies.repository.getFormEntity(); // zformEntitiy.setFieldValue(fieldName, newValue, ({ layoutRules, formData }) => {
12
+ // return layoutRuleApplier.applyRules({
13
+ // layoutRules,
14
+ // formData,
15
+ // myForm: zformEntitiy.toObject()
16
+ // })
17
+ // });
18
+ // let zform = zformEntitiy.toObject();
19
+ // // let { fieldResult, sectionResult } = this.dependencies.layoutRuleApplier.applyRules({
20
+ // // layoutRules,
21
+ // // formData: zformEntitiy.getFormData(),
22
+ // // myForm: zform
23
+ // // });
24
+ // // zformEntitiy.applyLayoutRulesResult(sectionResult, fieldResult)
25
+ // // zform = zformEntitiy.toObject();
26
+ // this.dependencies.presenter.updateFormResponse(zform);
27
+ // dispatch({
28
+ // type: ZFORM_FIELD_VALUE_CHANGE_REQUEST,
29
+ // payload: { sectionId: zformEntitiy.getSectionId(sectionName), fieldName: '', value: "" },
30
+ // metaData: {}
31
+ // });
32
+
33
+ Object.entries(fieldsValuesObj).forEach(_ref => {
34
+ let [fieldName, value] = _ref;
35
+ dispatch({
36
+ type: ZFORM_FIELD_VALUE_CHANGE_REQUEST,
37
+ payload: {
38
+ sectionId: zformEntitiy.getSectionId({
39
+ fieldName
40
+ }),
41
+ fieldName,
42
+ value
43
+ },
44
+ metaData: {}
45
+ });
46
+ });
47
+ }
48
+
49
+ }
50
+
51
+ export default SetFieldsValuesUseCase;
@@ -0,0 +1,19 @@
1
+ import AbstractUseCase from "./AbstractUseCase";
2
+
3
+ class ShowFieldUseCase extends AbstractUseCase {
4
+ execute(input) {
5
+ const {
6
+ fieldName
7
+ } = input;
8
+ const {
9
+ repository,
10
+ presenter
11
+ } = this.dependencies;
12
+ const form = repository.getFormEntity();
13
+ form.setFieldVisibility(fieldName, true);
14
+ presenter.updateFormResponse(form.toObject());
15
+ }
16
+
17
+ }
18
+
19
+ export default ShowFieldUseCase;
@@ -0,0 +1,19 @@
1
+ import AbstractUseCase from "./AbstractUseCase";
2
+
3
+ class ShowSectionUseCase extends AbstractUseCase {
4
+ execute(input) {
5
+ const {
6
+ sectionName
7
+ } = input;
8
+ const {
9
+ repository,
10
+ presenter
11
+ } = this.dependencies;
12
+ const form = repository.getFormEntity();
13
+ form.setSectionVisibility(sectionName, true);
14
+ presenter.updateFormResponse(form.toObject());
15
+ }
16
+
17
+ }
18
+
19
+ export default ShowSectionUseCase;
@@ -0,0 +1,29 @@
1
+ import { ZFORM_SUBMIT } from "../../../../bc/zform/Symbol";
2
+ import AbstractUseCase from "./AbstractUseCase";
3
+
4
+ class SubmitUseCase extends AbstractUseCase {
5
+ execute(input) {
6
+ const {
7
+ dispatch
8
+ } = input;
9
+ const {
10
+ repository,
11
+ presenter
12
+ } = this.dependencies;
13
+ const zformEntity = repository.getFormEntity(); // let zform = zformEntitiy.toObject();
14
+ // presenter.updateFormResponse(zform);
15
+
16
+ const context = { ...zformEntity.getContext()
17
+ };
18
+ dispatch({
19
+ type: ZFORM_SUBMIT,
20
+ payload: {
21
+ props: context
22
+ },
23
+ metaData: {}
24
+ });
25
+ }
26
+
27
+ }
28
+
29
+ export default SubmitUseCase;
@@ -0,0 +1,22 @@
1
+ import AbstractUseCase from "./AbstractUseCase";
2
+
3
+ class UpdateFieldUseCase extends AbstractUseCase {
4
+ execute(input) {
5
+ const {
6
+ fieldName,
7
+ fieldProperties,
8
+ dispatch
9
+ } = input;
10
+ const {
11
+ repository,
12
+ presenter
13
+ } = this.dependencies;
14
+ const zformEntitiy = repository.getFormEntity();
15
+ zformEntitiy.updateFieldProperties(fieldName, fieldProperties);
16
+ let zform = zformEntitiy.toObject();
17
+ presenter.updateFormResponse(zform);
18
+ }
19
+
20
+ }
21
+
22
+ export default UpdateFieldUseCase;
@@ -159,6 +159,20 @@ export default class ZField {
159
159
  return this.errorMessage;
160
160
  }
161
161
 
162
+ setProperties(fieldProperties) {
163
+ this.displayLabel = fieldProperties.displayLabel !== undefined ? fieldProperties.displayLabel : this.displayLabel;
164
+ this.i18NLabel = fieldProperties.i18NLabel !== undefined ? fieldProperties.i18NLabel : this.i18NLabel;
165
+ this.isMandatory = fieldProperties.isMandatory !== undefined ? fieldProperties.isMandatory : this.isMandatory;
166
+ this.isReadOnly = fieldProperties.isReadOnly !== undefined ? fieldProperties.isReadOnly : this.isReadOnly;
167
+ this.maxLength = fieldProperties.maxLength !== undefined ? fieldProperties.maxLength : this.maxLength;
168
+ this.isVisible = fieldProperties.isVisible !== undefined ? fieldProperties.isVisible : this.isVisible;
169
+ this.value = fieldProperties.value !== undefined ? fieldProperties.value : this.value;
170
+ this.errorMessage = fieldProperties.errorMessage !== undefined ? fieldProperties.errorMessage : this.errorMessage;
171
+ this.pickListValues = fieldProperties.pickListValues !== undefined ? fieldProperties.pickListValues : this.pickListValues;
172
+ this.defaultPickListValues = fieldProperties.defaultPickListValues !== undefined ? fieldProperties.defaultPickListValues : this.defaultPickListValues;
173
+ this.toolTip = fieldProperties.toolTip !== undefined ? fieldProperties.toolTip : this.toolTip;
174
+ }
175
+
162
176
  setErrorMessage(errorMessage) {
163
177
  this.errorMessage = errorMessage;
164
178
  }
@@ -146,6 +146,29 @@ export default class ZForm {
146
146
  this.isValidationRulesFetching = isValidationRulesFetching;
147
147
  }
148
148
 
149
+ getSectionId(_ref2) {
150
+ let {
151
+ fieldName,
152
+ sectionName
153
+ } = _ref2;
154
+
155
+ if (sectionName) {
156
+ for (let section of this.sections) {
157
+ if (section.getName() === sectionName) {
158
+ return section.getId();
159
+ }
160
+ }
161
+ }
162
+
163
+ for (let section of this.sections) {
164
+ for (let field of section.getFields()) {
165
+ if (field.getApiName() === fieldName) {
166
+ return section.getId();
167
+ }
168
+ }
169
+ }
170
+ }
171
+
149
172
  setSections(sections) {
150
173
  this.sections = sections;
151
174
  }
@@ -164,6 +187,42 @@ export default class ZForm {
164
187
  });
165
188
  }
166
189
 
190
+ getFieldValue(fieldName) {
191
+ let sectionId = this.getSectionId({
192
+ fieldName
193
+ });
194
+ let fieldValue = null;
195
+ this.sections.forEach(s => {
196
+ if (s.getId() === sectionId) {
197
+ s.getFields().forEach(f => {
198
+ if (f.getApiName() === fieldName) {
199
+ fieldValue = f.getValue();
200
+ }
201
+ });
202
+ }
203
+ });
204
+ return fieldValue;
205
+ }
206
+
207
+ updateFieldProperties(fieldName, fieldProperties) {
208
+ let sectionId = this.getSectionId({
209
+ fieldName
210
+ });
211
+ this.sections = this.sections.map(s => {
212
+ if (s.getId() === sectionId) {
213
+ s.getFields().map(f => {
214
+ if (f.getApiName() === fieldName) {
215
+ f.setProperties(fieldProperties);
216
+ }
217
+
218
+ return f;
219
+ });
220
+ }
221
+
222
+ return s;
223
+ });
224
+ }
225
+
167
226
  insertSectionAtPosition(section, position) {
168
227
  this.sections = [...this.sections.slice(0, position), section, ...this.sections.slice(position)];
169
228
  }
@@ -174,16 +233,29 @@ export default class ZForm {
174
233
  });
175
234
  }
176
235
 
177
- toggleSectionVisibility(sectionId) {
236
+ setSectionVisibility(sectionName, isVisible) {
178
237
  this.sections = this.sections.map(s => {
179
- if (s.getId() === sectionId) {
180
- s.toggleVisibility();
238
+ if (s.getName() === sectionName) {
239
+ s.setVisibility(isVisible);
181
240
  }
182
241
 
183
242
  return s;
184
243
  });
185
244
  }
186
245
 
246
+ setFieldVisibility(fieldName, isVisible) {
247
+ this.sections = this.sections.map(s => {
248
+ s.getFields().map(f => {
249
+ if (f.getApiName() === fieldName) {
250
+ f.setVisibility(isVisible);
251
+ }
252
+
253
+ return f;
254
+ });
255
+ return s;
256
+ });
257
+ }
258
+
187
259
  appendFieldInSection(sectionId, field) {
188
260
  this.sections = this.sections.map(s => {
189
261
  if (s.getId() === sectionId) {
@@ -204,6 +276,16 @@ export default class ZForm {
204
276
  });
205
277
  }
206
278
 
279
+ getFieldId(fieldName) {
280
+ for (let section of this.sections) {
281
+ for (let field of section.getFields()) {
282
+ if (field.getApiName() === fieldName) {
283
+ return field.getId();
284
+ }
285
+ }
286
+ }
287
+ }
288
+
207
289
  deleteFields(fieldIds) {
208
290
  this.sections = this.sections.map(s => {
209
291
  s.deleteFields(fieldIds);
@@ -9,6 +9,7 @@ export default class ZSection {
9
9
  i18NLabel,
10
10
  isCustomSection,
11
11
  description,
12
+ isCollapsed,
12
13
  id,
13
14
  fields,
14
15
  // visibility
@@ -23,6 +24,8 @@ export default class ZSection {
23
24
 
24
25
  _defineProperty(this, "description", void 0);
25
26
 
27
+ _defineProperty(this, "isCollapsed", void 0);
28
+
26
29
  _defineProperty(this, "id", void 0);
27
30
 
28
31
  _defineProperty(this, "fields", void 0);
@@ -34,6 +37,8 @@ export default class ZSection {
34
37
  this.isCustomSection = isCustomSection;
35
38
  this.description = description || ''; // Default to empty string if not provided
36
39
 
40
+ this.isCollapsed = isCollapsed || false; // Default to false if not provided
41
+
37
42
  this.id = id;
38
43
  this.fields = fields; // this.visibility=visibility;
39
44
 
@@ -114,6 +119,7 @@ export default class ZSection {
114
119
  i18NLabel: this.i18NLabel,
115
120
  isCustomSection: this.isCustomSection,
116
121
  description: this.description,
122
+ isCollapsed: this.isCollapsed,
117
123
  id: this.id,
118
124
  fields: this.fields.map(field => {
119
125
  return field.toObject();
@@ -24,7 +24,8 @@ import { FIELD_VALIDATION_RESULT, VALIDATE_FIELDS_RESULT } from "../../../../bc/
24
24
  import SetFieldErrorMessageController from "../../adapters/controllers/SetFieldErrorMessageController";
25
25
  import LayoutRuleApplier from "../layout-rules/LayoutRuleApplier";
26
26
  import ValidateErrorMessageController from "../../adapters/controllers/ValidateErrorMessageController";
27
- import { CREATE_RECORD } from "../../../../bc/zrecord/Constants";
27
+ import { CREATE_RECORD, RECORD_EXECUTE_FAIL_CALLBACK, RECORD_EXECUTE_SUCCESS_CALLBACK } from "../../../../bc/zrecord/Constants";
28
+ import SmartFormConstants from "../../../../cc/form-connected/Constants";
28
29
 
29
30
  class EventHandlersFactory {
30
31
  static create(_ref) {
@@ -59,6 +60,26 @@ class EventHandlersFactory {
59
60
  return {
60
61
  [LifeCycleEvents.MOUNT]: initializeController.handle,
61
62
  [ZFORM_MY_LAYOUTS_SUCCESS]: myLayoutSuccessController.handle,
63
+ [RECORD_EXECUTE_SUCCESS_CALLBACK]: _ref2 => {
64
+ let {
65
+ action,
66
+ dispatch
67
+ } = _ref2;
68
+ dispatch({
69
+ type: "SMART_FORM#SUBMIT_SUCCESS",
70
+ payload: action.payload
71
+ });
72
+ },
73
+ [RECORD_EXECUTE_FAIL_CALLBACK]: _ref3 => {
74
+ let {
75
+ action,
76
+ dispatch
77
+ } = _ref3;
78
+ dispatch({
79
+ type: "SMART_FORM#SUBMIT_FAILED",
80
+ payload: action.payload
81
+ });
82
+ },
62
83
  [ZFORM_MY_FORM_REQUEST]: myFormRequestController.handle,
63
84
  [ZFORM_MY_FORM_SUCCESS]: myFormSuccessController.handle,
64
85
  [ZFORM_DEPENDENCY_MAPPINGS_REQUEST]: dependenciesRequestController.handle,
@@ -70,14 +91,15 @@ class EventHandlersFactory {
70
91
  [ZFORM_FIELD_VALUE_CHANGE_REQUEST]: fieldValueChangeController.handle,
71
92
  [ZFORM_SET_FIELD_ERROR_MESSAGE]: setFieldErrorMessageController.handle,
72
93
  [ZFORM_VALIDATE_FIELD_REQUEST]: validateFieldRequestController.handle,
94
+ [SmartFormConstants.SMART_FORM_SUBMIT_CLICKED]: formSubmitController.handle,
73
95
  [ZFORM_SUBMIT]: formSubmitController.handle,
74
- [ZFORM_SUBMIT_SUCCESS]: _ref2 => {
96
+ [ZFORM_SUBMIT_SUCCESS]: _ref4 => {
75
97
  let {
76
98
  action,
77
99
  state,
78
100
  updateState,
79
101
  dispatch
80
- } = _ref2;
102
+ } = _ref4;
81
103
  let formData = action.payload.formData;
82
104
  let moduleName = state.properties.moduleName;
83
105
  let record = {
@@ -98,13 +120,13 @@ class EventHandlersFactory {
98
120
  }
99
121
  });
100
122
  },
101
- [ZFORM_VALIDATION_ERROR]: _ref3 => {
123
+ [ZFORM_VALIDATION_ERROR]: _ref5 => {
102
124
  let {
103
125
  action,
104
126
  state,
105
127
  updateState,
106
128
  dispatch
107
- } = _ref3;
129
+ } = _ref5;
108
130
  let formData = { ...state.behaviours.zform.formData
109
131
  };
110
132
  Object.keys(action.payload).forEach(key => {
@@ -118,13 +140,13 @@ class EventHandlersFactory {
118
140
  });
119
141
  },
120
142
  [ZFORM_VALIDATE_SUBMIT_FIELD_HAS_ERROR_MESSAGE]: validateErrorMessageController.handle,
121
- [FIELD_VALIDATION_RESULT]: _ref4 => {
143
+ [FIELD_VALIDATION_RESULT]: _ref6 => {
122
144
  let {
123
145
  action,
124
146
  state,
125
147
  updateState,
126
148
  dispatch
127
- } = _ref4;
149
+ } = _ref6;
128
150
  let {
129
151
  validationResult,
130
152
  field
@@ -148,13 +170,13 @@ class EventHandlersFactory {
148
170
  });
149
171
  }
150
172
  },
151
- [VALIDATE_FIELDS_RESULT]: _ref5 => {
173
+ [VALIDATE_FIELDS_RESULT]: _ref7 => {
152
174
  let {
153
175
  action,
154
176
  state,
155
177
  updateState,
156
178
  dispatch
157
- } = _ref5;
179
+ } = _ref7;
158
180
  let {
159
181
  validationResults,
160
182
  fields
@@ -183,20 +205,20 @@ class EventHandlersFactory {
183
205
  }
184
206
  });
185
207
  },
186
- [FormConstants.FORM_SUBMIT]: _ref6 => {
208
+ [FormConstants.FORM_SUBMIT]: _ref8 => {
187
209
  let {
188
210
  action,
189
211
  dispatch
190
- } = _ref6;
212
+ } = _ref8;
191
213
  dispatch({
192
214
  type: ZFORM_SUBMIT
193
215
  });
194
216
  },
195
- [FormConstants.FORM_FIELD_BLURRED]: _ref7 => {
217
+ [FormConstants.FORM_FIELD_BLURRED]: _ref9 => {
196
218
  let {
197
219
  action,
198
220
  dispatch
199
- } = _ref7;
221
+ } = _ref9;
200
222
  dispatch({
201
223
  type: ZFORM_VALIDATE_FIELD_REQUEST,
202
224
  payload: {
@@ -204,11 +226,11 @@ class EventHandlersFactory {
204
226
  }
205
227
  });
206
228
  },
207
- [FormConstants.FORM_FIELD_VALUE_CHANGE_REQUEST]: _ref8 => {
229
+ [FormConstants.FORM_FIELD_VALUE_CHANGE_REQUEST]: _ref10 => {
208
230
  let {
209
231
  action,
210
232
  dispatch
211
- } = _ref8;
233
+ } = _ref10;
212
234
  const {
213
235
  sectionId,
214
236
  fieldName,
@@ -7,6 +7,9 @@ export default class CreateRecordController extends AbstractController {
7
7
  action,
8
8
  dispatch
9
9
  } = event;
10
+ const {
11
+ properties
12
+ } = state;
10
13
  const {
11
14
  payload
12
15
  } = action;
@@ -21,7 +24,8 @@ export default class CreateRecordController extends AbstractController {
21
24
  createRecordUseCase.execute({
22
25
  record,
23
26
  moduleName,
24
- dispatch
27
+ dispatch,
28
+ context: properties.context
25
29
  });
26
30
  }
27
31