@zohodesk/library-platform 1.1.7 → 1.1.8

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 (55) hide show
  1. package/es/bc/sdk/ResourceNamesEnum.js +1 -0
  2. package/es/bc/zform/Symbol.js +1 -0
  3. package/es/bc/zlist/Constants.js +3 -1
  4. package/es/bc/zrecord/Constants.js +1 -0
  5. package/es/cc/form/Properties.js +54 -0
  6. package/es/cc/form-connected/Constants.js +8 -0
  7. package/es/cc/form-connected/Properties.js +52 -0
  8. package/es/cc/table-connected/Properties.js +8 -0
  9. package/es/cc/table-connected/constants/Events.js +1 -0
  10. package/es/library/dot/components/action-location/usecases/interactors/PropertiesChangeUseCase.js +1 -1
  11. package/es/library/dot/components/form/adapters/presenter/TransformState.js +38 -25
  12. package/es/library/dot/components/form/frameworks/ui/FormView.js +11 -5
  13. package/es/library/dot/components/section/frameworks/ui/SectionView.js +1 -1
  14. package/es/platform/client-actions/bc/zclient-actions/SdkContract.js +35 -0
  15. package/es/platform/client-actions/behaviour/zclient-actions/adapters/resources/ClientActionResource.js +105 -0
  16. package/es/platform/client-actions/behaviour/zclient-actions/applications/interfaces/IClientActionResource.js +1 -0
  17. package/es/platform/client-actions/behaviour/zclient-actions/applications/interfaces/input/GetClientActionLocationInputModel.js +1 -0
  18. package/es/platform/client-actions/behaviour/zclient-actions/applications/interfaces/input/GetClientActionUIComponentPropertiesInputModel.js +1 -0
  19. package/es/platform/client-actions/behaviour/zclient-actions/applications/interfaces/input/GetClientActionsInputModel.js +1 -0
  20. package/es/platform/client-actions/behaviour/zclient-actions/applications/interfaces/input/UpdateClientActionUIComponentPropertiesInputModel.js +1 -0
  21. package/es/platform/client-actions/behaviour/zclient-actions/applications/usecases/GetClientActionLocationUseCase.js +20 -0
  22. package/es/platform/client-actions/behaviour/zclient-actions/applications/usecases/GetClientActionUIComponentPropertiesUseCase.js +20 -0
  23. package/es/platform/client-actions/behaviour/zclient-actions/applications/usecases/GetClientActionsUseCase.js +18 -0
  24. package/es/platform/client-actions/behaviour/zclient-actions/applications/usecases/UpdateClientActionUIComponentPropertiesUseCase.js +32 -0
  25. package/es/platform/client-actions/behaviour/zclient-actions/domain/entities/ClientAction.js +12 -0
  26. package/es/platform/client-actions/behaviour/zclient-actions/domain/entities/ClientActionManager.js +45 -0
  27. package/es/platform/client-actions/behaviour/zclient-actions/domain/entities/UIComponentMapping.js +10 -0
  28. package/es/platform/client-actions/behaviour/zclient-actions/frameworks/sdk/ClientActionsSDKFactory.js +29 -0
  29. package/es/platform/client-actions/cc/action-event-mediator/Properties.js +9 -0
  30. package/es/platform/client-actions/components/action-event-mediator/applications/usecases/PropertiesChangeUseCase.js +1 -1
  31. package/es/platform/client-actions/components/action-event-mediator/domain/entities/ActionEventMediatorEntity.js +7 -3
  32. package/es/platform/client-actions/components/action-event-mediator/frameworks/ui/ActionEventMediatorView.js +3 -1
  33. package/es/platform/client-actions/components/dynamic-component/frameworks/ui/DynamicActionComponentView.js +4 -2
  34. package/es/platform/client-actions/components/row-actions-renderer/frameworks/ui/RowActionsRendererView.js +4 -1
  35. package/es/platform/components/form-connected/frameworks/EventHandlersFactory.js +3 -2
  36. package/es/platform/components/form-connected/frameworks/FormConnectedFactory.js +6 -5
  37. package/es/platform/components/form-connected/frameworks/FormConnectedView.js +14 -2
  38. package/es/platform/components/table-connected/frameworks/EventHandlersFactory.js +15 -1
  39. package/es/platform/components/table-connected/frameworks/TableConnectedFactory.js +6 -1
  40. package/es/platform/data-source/http-template/getClientActions.js +2 -2
  41. package/es/platform/sdk/frameworks/Sdk.js +7 -0
  42. package/es/platform/zform/adapters/presenter/FormTranslator.js +60 -3
  43. package/es/platform/zform/adapters/presenter/translators/SectionTranslator.js +7 -1
  44. package/es/platform/zform/adapters/presenter/utils/DefaultClientActions.js +59 -0
  45. package/es/platform/zform/applications/usecases/InitializeUseCase.js +16 -0
  46. package/es/platform/zform/frameworks/layout-rules/calculateLayoutRulesResult.js +1 -1
  47. package/es/platform/zform/frameworks/layout-rules/runSingleFieldCondition.js +1 -1
  48. package/es/platform/zform/frameworks/layout-rules/validator.js +0 -1
  49. package/es/platform/zform/frameworks/ui/EventHandlerFactory.js +37 -15
  50. package/es/platform/zlist/adapters/presenters/TableTranslator.js +3 -2
  51. package/es/platform/zlist/applications/usecases/RecordSuccessCallbackUsecase.js +4 -1
  52. package/es/platform/zlist/domain/entities/List.js +9 -3
  53. package/es/platform/zrecord/adapters/controllers/SetRecordsController.js +7 -3
  54. package/es/platform/zrecord/applications/usecases/SetRecordsUseCase.js +11 -1
  55. package/package.json +2 -1
@@ -23,6 +23,16 @@ export default class UIComponentMapping {
23
23
  this.eventMappings = new EventMappings(uiComponentMappingObj.eventMappings);
24
24
  }
25
25
 
26
+ getPropertiesValueMapping() {
27
+ return this.propertiesValueMapping;
28
+ }
29
+
30
+ updatePropertiesValueMapping(newProperties) {
31
+ this.propertiesValueMapping = { ...this.propertiesValueMapping,
32
+ ...newProperties
33
+ };
34
+ }
35
+
26
36
  toObject() {
27
37
  return {
28
38
  id: this.id,
@@ -0,0 +1,29 @@
1
+ import ResourceNamesEnum from "../../../../../../bc/sdk/ResourceNamesEnum";
2
+ import { platformSDK } from "../../../../../sdk/frameworks/Sdk";
3
+ export default class ClientActionsSDKFactory {
4
+ static getClientActionSDK(clientActionResource) {
5
+ return {
6
+ getLocation: id => clientActionResource.getLocation(id),
7
+ getUIComponentProperties: id => clientActionResource.getUIComponentProperties(id),
8
+ getClientActions: () => clientActionResource.getClientActions(),
9
+ updateUIComponentProperties: (id, newComponentProperties) => clientActionResource.updateUIComponentProperties(id, newComponentProperties)
10
+ };
11
+ }
12
+
13
+ static create(_ref) {
14
+ let {
15
+ instanceName
16
+ } = _ref;
17
+ const clientActionResource = platformSDK[ResourceNamesEnum.CLIENT_ACTION](instanceName);
18
+ const clientActionSDK = ClientActionsSDKFactory.getClientActionSDK(clientActionResource);
19
+ return {
20
+ clientAction: {
21
+ getLocation: clientActionSDK.getLocation,
22
+ getUIComponentProperties: clientActionSDK.getUIComponentProperties,
23
+ getClientActions: clientActionSDK.getClientActions,
24
+ updateUIComponentProperties: clientActionSDK.updateUIComponentProperties
25
+ }
26
+ };
27
+ }
28
+
29
+ }
@@ -6,6 +6,15 @@ export const actionsSchema = {
6
6
  items: actionSchema
7
7
  };
8
8
  export default {
9
+ testId: {
10
+ required: false,
11
+ typeMetadata: {
12
+ schema: {
13
+ type: 'string'
14
+ }
15
+ },
16
+ defaultValue: ''
17
+ },
9
18
  actions: {
10
19
  required: true,
11
20
  typeMetadata: {
@@ -10,7 +10,7 @@ export default class PropertiesChangeUseCase extends AbstractUseCase {
10
10
  currentActions,
11
11
  previousActions
12
12
  } = input;
13
- actionLocation.processActionsChange(currentActions, previousActions);
13
+ actionLocation.processActionsChange(previousActions, currentActions);
14
14
  presenter.updateActionEventMediator(actionLocation.toObject());
15
15
  }
16
16
 
@@ -16,6 +16,7 @@ export default class ActionEventMediatorEntity {
16
16
  return e => {
17
17
  const {
18
18
  eventMappings,
19
+ actionId,
19
20
  ...payloadItems
20
21
  } = e.detail.payload;
21
22
  const eventMapping = eventMappings.find(eventMapping => eventMapping.sourceEvent === event);
@@ -25,14 +26,17 @@ export default class ActionEventMediatorEntity {
25
26
  }
26
27
 
27
28
  const dispatchEvent = eventMapping.targetEvent;
28
- const payload = eventMapping.payload;
29
+ const eventMappingPayload = eventMapping.payload;
29
30
  const replacementContext = {
30
31
  "@payload": payloadItems
31
32
  };
32
- const resolvedPayload = TemplateResolver.replaceContextVariablesInObject(payload, replacementContext);
33
+ const resolvedPayload = TemplateResolver.replaceContextVariablesInObject(eventMappingPayload, replacementContext);
33
34
  this.dispatch({
34
35
  type: dispatchEvent,
35
- payload: resolvedPayload
36
+ payload: resolvedPayload,
37
+ metaData: {
38
+ clientActionId: actionId
39
+ }
36
40
  });
37
41
  };
38
42
  }
@@ -8,10 +8,12 @@ export default function ActionEventMediatorView(_ref, ref) {
8
8
  const {
9
9
  actions,
10
10
  renderComponentType,
11
- gap
11
+ gap,
12
+ testId
12
13
  } = state.properties;
13
14
  const ActionRenderComponent = ComponentRegistry.get(renderComponentType) || RowActionsRenderer;
14
15
  return /*#__PURE__*/React.createElement(ActionRenderComponent, {
16
+ testId: testId,
15
17
  actions: actions,
16
18
  gap: gap,
17
19
  getRef: ref
@@ -12,7 +12,8 @@ function DynamicComponentView(_ref, ref) {
12
12
  const {
13
13
  component,
14
14
  properties,
15
- eventMappings
15
+ eventMappings,
16
+ id: actionId
16
17
  } = action;
17
18
  const Component = ComponentRegistry.get(component) || ActionComponentMapping[component];
18
19
 
@@ -26,7 +27,8 @@ function DynamicComponentView(_ref, ref) {
26
27
  getRef: ref,
27
28
  ...properties,
28
29
  appendToActionPayload: {
29
- eventMappings
30
+ eventMappings,
31
+ actionId
30
32
  }
31
33
  });
32
34
  }
@@ -11,10 +11,13 @@ function RowActionsRendererView(_ref, ref) {
11
11
  } = _ref;
12
12
  const {
13
13
  actions,
14
- gap
14
+ gap,
15
+ testId
15
16
  } = state.properties;
16
17
  return /*#__PURE__*/React.createElement(Flex, {
17
18
  ref: ref,
19
+ testId: testId,
20
+ customId: testId,
18
21
  $ui_displayMode: "inline",
19
22
  $ui_alignItems: "center",
20
23
  $ui_className: `${style.wrapper} ${gap !== ActionViewGap.NONE ? style[`gap_${gap}`] : ''}`
@@ -38,7 +38,7 @@ export default class EventHandlersFactory {
38
38
 
39
39
  static create(eventHandlers) {
40
40
  const wrapped = EventHandlersFactory.createWrapped(eventHandlers);
41
- return { ...wrapped,
41
+ return {
42
42
  [FormConstants.FORM_FIELD_FOCUSED]: _ref => {
43
43
  let {
44
44
  action,
@@ -91,7 +91,8 @@ export default class EventHandlersFactory {
91
91
  value
92
92
  }
93
93
  });
94
- }
94
+ },
95
+ ...wrapped
95
96
  };
96
97
  }
97
98
 
@@ -2,8 +2,7 @@ import Properties from "../../../../cc/form-connected/Properties";
2
2
  import { createCustomComponent } from "../../../../library/custom-component";
3
3
  import ZHttpBehaviourFactory from "../../../zhttp/frameworks/ZHttpBehaviourFactory";
4
4
  import RecordBehaviourFactory from "../../../zrecord/frameworks/RecordBehaviourFactory";
5
- import FormConnectedView from "./FormConnectedView"; // import defaultDataBroker from '@platform/data-source';
6
-
5
+ import FormConnectedView from "./FormConnectedView";
7
6
  import defaultDataSource from "../../../data-source";
8
7
  import DataBrokerBehaviourFactory from "../../../zdata-source/frameworks/DataBrokerBehaviourFactory";
9
8
  import FormTranslator from "../../../zform/adapters/presenter/FormTranslator";
@@ -14,6 +13,7 @@ import SdkBehaviourFactory from "../../../sdk-behaviour/frameworks/SdkBehaviourF
14
13
  import ResourceNamesEnum from "../../../../bc/sdk/ResourceNamesEnum";
15
14
  import { sdkRegistry } from "../../../sdk/frameworks/SdkRegistry";
16
15
  import { SmartFormResources } from "../adapters/resources/SmartFormResources";
16
+ import ClientActionsBehaviourFactory from "../../../client-actions/behaviour/zclient-actions/frameworks/ClientActionsBehaviourFactory";
17
17
  sdkRegistry.registerResource({
18
18
  resourceName: ResourceNamesEnum.SMART_FORM,
19
19
  resource: SmartFormResources
@@ -33,13 +33,12 @@ export default class FormConnectedFactory {
33
33
  let {
34
34
  name,
35
35
  customValidators,
36
- dataBroker = defaultDataSource,
37
36
  dataSource,
38
37
  eventHandlers = {},
39
38
  View = FormConnectedView
40
39
  } = _ref;
41
40
 
42
- const _dataSource = combineDataSourceWithDefault(dataBroker ? dataBroker : dataSource);
41
+ const _dataSource = combineDataSourceWithDefault(dataSource);
43
42
 
44
43
  return createCustomComponent({
45
44
  name: name,
@@ -47,7 +46,9 @@ export default class FormConnectedFactory {
47
46
  properties: Properties,
48
47
  eventHandlers: EventHandlersfactory.create(eventHandlers),
49
48
  transformState: FormTranslator.transformState,
50
- behaviours: [SdkBehaviourFactory.create([ResourceNamesEnum.SMART_FORM]), ZHttpBehaviourFactory.create(), DataBrokerBehaviourFactory.create(), RecordBehaviourFactory.create(_dataSource.httpTemplates), FieldValidationBehaviourFactory.create(), ZFormBehaviourFactory.create({
49
+ behaviours: [SdkBehaviourFactory.create([ResourceNamesEnum.SMART_FORM]), ClientActionsBehaviourFactory.create({
50
+ getClientActions: _dataSource.httpTemplates.getClientActions
51
+ }), ZHttpBehaviourFactory.create(), DataBrokerBehaviourFactory.create(), RecordBehaviourFactory.create(_dataSource.httpTemplates), FieldValidationBehaviourFactory.create(), ZFormBehaviourFactory.create({
51
52
  customValidators
52
53
  })]
53
54
  });
@@ -8,12 +8,24 @@ function View(_ref, ref) {
8
8
  } = _ref;
9
9
  const {
10
10
  isLoading,
11
- sections = []
11
+ sections = [],
12
+ isHeaderEnabled,
13
+ isFooterEnabled,
14
+ headerLeftActions,
15
+ headerRightActions,
16
+ footerLeftActions,
17
+ footerRightActions
12
18
  } = state.viewModel;
13
19
  return /*#__PURE__*/React.createElement(Form, {
14
20
  getRef: ref,
15
21
  isLoading: isLoading,
16
- sections: sections
22
+ sections: sections,
23
+ isHeaderEnabled: isHeaderEnabled,
24
+ isFooterEnabled: isFooterEnabled,
25
+ headerLeftActions: headerLeftActions,
26
+ headerRightActions: headerRightActions,
27
+ footerLeftActions: footerLeftActions,
28
+ footerRightActions: footerRightActions
17
29
  });
18
30
  }
19
31
 
@@ -15,6 +15,7 @@ import ScrollController from "../adapters/controllers/ScrollController";
15
15
  import ColumnChooserUpdateController from "../adapters/controllers/ColumnChooserUpdateController";
16
16
  import ColumnChooserOpenedController from "../adapters/controllers/ColumnChooserOpenedController";
17
17
  import { platformSDK } from "../../../sdk/frameworks/Sdk";
18
+ import { SET_RECORDS_SUCCESS } from "../../../../bc/zrecord/Constants";
18
19
  import ErrorEventHandlersFactory from "./ErrorEventHandlersFactory";
19
20
  const {
20
21
  TABLE_LIST_RESIZE_START_REQUESTED,
@@ -97,7 +98,20 @@ export default class EventHandlersFactory {
97
98
  payload: action.payload
98
99
  });
99
100
  },
100
- [TABLE_LIST_ROW_DRAG_END]: new ReOrderFinishController().handle
101
+ [TABLE_LIST_ROW_DRAG_END]: new ReOrderFinishController().handle,
102
+ [SET_RECORDS_SUCCESS]: _ref5 => {
103
+ let {
104
+ action,
105
+ dispatch
106
+ } = _ref5;
107
+
108
+ if (action.metaData && action.metaData.isReOrder) {
109
+ dispatch({
110
+ type: SmartTableConstants.Events.REORDER_SUCCESS,
111
+ payload: action.payload
112
+ });
113
+ }
114
+ }
101
115
  };
102
116
  return mergeEventHandlers([defaultEventHandlers, ErrorEventHandlersFactory.create(), wrapped]);
103
117
  }
@@ -18,10 +18,15 @@ import SdkBehaviourFactory from "../../../sdk-behaviour/frameworks/SdkBehaviourF
18
18
  import ResourceNamesEnum from "../../../../bc/sdk/ResourceNamesEnum";
19
19
  import { sdkRegistry } from "../../../sdk/frameworks/SdkRegistry";
20
20
  import { SmartTableResource } from "../adapters/resources/SmartTableResource";
21
+ import { ClientActionResource } from "../../../client-actions/behaviour/zclient-actions/adapters/resources/ClientActionResource";
21
22
  sdkRegistry.registerResource({
22
23
  resourceName: ResourceNamesEnum.SMART_TABLE,
23
24
  resource: SmartTableResource
24
25
  });
26
+ sdkRegistry.registerResource({
27
+ resourceName: ResourceNamesEnum.CLIENT_ACTION,
28
+ resource: ClientActionResource
29
+ });
25
30
  import KeyboardControlBehaviourFactory from "../../../../library/behaviours/keyboard-controls/frameworks/KeyboardControlBehaviourFactory";
26
31
 
27
32
  function combineDataSourceWithDefault(dataSource) {
@@ -62,7 +67,7 @@ export default class TableConnectedFactory {
62
67
  }
63
68
 
64
69
  static getBehaviours(_dataSource) {
65
- return [SdkBehaviourFactory.create([ResourceNamesEnum.SMART_TABLE]), TableColumnResizerBehaviorFactory.create(), KeyboardControlBehaviourFactory.create(), LocalStorageBehaviourFactory.create(), ZHttpBehaviourFactory.create(), DataSourceBehaviourFactory.create(), ...TableConnectedFactory.getPlatformBehaviours(_dataSource), ColumnChooserBehaviourFactory.create(), ListItemSelectionBehaviourFactory.create()];
70
+ return [SdkBehaviourFactory.create([ResourceNamesEnum.SMART_TABLE, ResourceNamesEnum.CLIENT_ACTION]), TableColumnResizerBehaviorFactory.create(), KeyboardControlBehaviourFactory.create(), LocalStorageBehaviourFactory.create(), ZHttpBehaviourFactory.create(), DataSourceBehaviourFactory.create(), ...TableConnectedFactory.getPlatformBehaviours(_dataSource), ColumnChooserBehaviourFactory.create(), ListItemSelectionBehaviourFactory.create()];
66
71
  }
67
72
 
68
73
  static getPlatformBehaviours(_dataSource) {
@@ -4,8 +4,8 @@ let getClientActions = {
4
4
  parameters: `{
5
5
  "from":{{from}},
6
6
  "limit":{{limit}},
7
- "component": "{{component}}",
8
- "module": "{{moduleName}}"
7
+ "components": "{{components}}",
8
+ "modules": "{{modules}}"
9
9
  }`,
10
10
  type: 'GET',
11
11
  transformer: data => data,
@@ -13,6 +13,13 @@ export const platformSDK = {
13
13
  resourceName: ResourceNamesEnum.SMART_FORM,
14
14
  instanceName: instanceName
15
15
  });
16
+ },
17
+
18
+ [ResourceNamesEnum.CLIENT_ACTION](instanceName) {
19
+ return sdkRegistry.getResourceInstance({
20
+ resourceName: ResourceNamesEnum.CLIENT_ACTION,
21
+ instanceName
22
+ });
16
23
  }
17
24
 
18
25
  };
@@ -1,13 +1,56 @@
1
+ import ClientActionsTranslator from "../../../client-actions/translators/client-actions-translator";
1
2
  import SectionTranslator from "./translators/SectionTranslator";
3
+ import DefaultFormClientActions from "./utils/DefaultClientActions";
2
4
  export default class FormTranslator {
3
5
  static transformState(state) {
4
6
  const {
5
7
  componentMapping,
6
- context
8
+ context,
9
+ isHeaderEnabled = true,
10
+ isFooterEnabled = true,
11
+ submitConfig = {
12
+ text: "Submit",
13
+ isEnabled: true
14
+ },
15
+ cancelConfig = {
16
+ text: "Cancel",
17
+ isEnabled: true
18
+ }
7
19
  } = state.properties;
8
20
  const {
9
- zform
21
+ zform,
22
+ zclientAction
10
23
  } = state.behaviours;
24
+ const {
25
+ clientActions,
26
+ isFetching: isClientActionsFetching
27
+ } = zclientAction || {};
28
+ let combinedClientActions = DefaultFormClientActions({
29
+ clientActions,
30
+ submitConfig,
31
+ cancelConfig
32
+ });
33
+ const mappedClientActions = mapper(combinedClientActions || []);
34
+ const transformedClientActions = {};
35
+ Object.entries(mappedClientActions).forEach(_ref => {
36
+ let [key, value] = _ref;
37
+
38
+ if (isFooterEnabled && (key === 'footerRightActions' || key === 'footerLeftActions')) {
39
+ let footerActions = ClientActionsTranslator.transform(value, context);
40
+ transformedClientActions[key] = footerActions;
41
+ }
42
+
43
+ if (isHeaderEnabled && (key === 'headerLeftActions' || key === 'headerRightActions')) {
44
+ let headerActions = ClientActionsTranslator.transform(value, context);
45
+ transformedClientActions[key] = headerActions;
46
+ }
47
+ });
48
+ const {
49
+ headerLeftActions,
50
+ headerRightActions,
51
+ footerLeftActions,
52
+ footerRightActions
53
+ } = transformedClientActions;
11
54
  const {
12
55
  isMyFormFetching,
13
56
  isDependencyFetching,
@@ -33,6 +76,7 @@ export default class FormTranslator {
33
76
  };
34
77
  } else {
35
78
  return { ...state,
79
+ ...zclientAction,
36
80
  viewModel: {
37
81
  sections: sections.map(section => {
38
82
  const sectionViewModel = SectionTranslator({
@@ -42,10 +86,23 @@ export default class FormTranslator {
42
86
  });
43
87
  return sectionViewModel;
44
88
  }),
89
+ isHeaderEnabled,
90
+ isFooterEnabled,
91
+ headerLeftActions,
92
+ headerRightActions,
93
+ footerLeftActions,
94
+ footerRightActions,
45
95
  isLoading: false
46
96
  }
47
97
  };
48
98
  }
49
99
  }
50
100
 
51
- }
101
+ }
102
+
103
+ const mapper = clientAction => ({
104
+ headerLeftActions: clientAction.filter(action => action.location === 'header_left_actions'),
105
+ headerRightActions: clientAction.filter(action => action.location === 'header_right_actions'),
106
+ footerLeftActions: clientAction.filter(action => action.location === 'footer_left_actions'),
107
+ footerRightActions: clientAction.filter(action => action.location === 'footer_right_actions')
108
+ });
@@ -10,6 +10,12 @@ function SectionTranslator(_ref) {
10
10
  context
11
11
  } = _ref;
12
12
  const mapping = componentMapping === null || componentMapping === void 0 ? void 0 : (_componentMapping$sec = componentMapping.sections) === null || _componentMapping$sec === void 0 ? void 0 : _componentMapping$sec[section.name];
13
+
14
+ const sectionVisibility = section => {
15
+ let allFieldHidden = section.fields.every(field => !field.isVisible);
16
+ return !allFieldHidden;
17
+ };
18
+
13
19
  const defaultViewModel = {
14
20
  type: mapping !== null && mapping !== void 0 && mapping.UIComponentName ? mapping.UIComponentName : DefaultFormSectionUIType,
15
21
  id: section.id + '',
@@ -17,7 +23,7 @@ function SectionTranslator(_ref) {
17
23
  title: section.i18NLabel,
18
24
  description: section.description,
19
25
  isCollapsed: section.isCollapsed,
20
- isVisible: section.isVisible,
26
+ isVisible: section.isVisible && sectionVisibility(section),
21
27
  fields: section.fields.map(field => {
22
28
  var _componentMapping$fie;
23
29
 
@@ -0,0 +1,59 @@
1
+ function getDefaultFormAction(_ref) {
2
+ let {
3
+ type,
4
+ text,
5
+ isEnabled
6
+ } = _ref;
7
+ const isSubmit = type === "submit";
8
+ return {
9
+ id: isSubmit ? "4000000080010" : "4000000080013",
10
+ name: "FORM ACTION",
11
+ component: "form",
12
+ location: "footer_left_actions",
13
+ uiComponentMapping: {
14
+ id: isSubmit ? "4000000080011" : "4000000080014",
15
+ name: isSubmit ? "Submit Button" : "Cancel Button",
16
+ component: "Button",
17
+ propertiesValueMapping: {
18
+ text: text || (isSubmit ? "Submit" : "Cancel"),
19
+ palette: isSubmit ? "primaryFilled" : "secondary"
20
+ },
21
+ eventMappings: [{
22
+ id: isSubmit ? "4000000080012" : "4000000080015",
23
+ sourceEvent: "BUTTON#CLICKED",
24
+ targetEvent: isSubmit ? "SMART_FORM#SUBMIT_CLICKED" : "SMART_FORM#CANCEL_CLICKED",
25
+ payloadValueMapping: {}
26
+ }]
27
+ },
28
+ modules: ["static_module"],
29
+ conditions: {
30
+ fields: [],
31
+ pattern: ""
32
+ }
33
+ };
34
+ }
35
+
36
+ export default function DefaultFormClientActions(props) {
37
+ const {
38
+ submitConfig,
39
+ cancelConfig,
40
+ clientActions = []
41
+ } = props;
42
+ const finalClientActions = [];
43
+
44
+ if (submitConfig !== null && submitConfig !== void 0 && submitConfig.isEnabled) {
45
+ finalClientActions.push(getDefaultFormAction({
46
+ type: "submit",
47
+ ...submitConfig
48
+ }));
49
+ }
50
+
51
+ if (cancelConfig !== null && cancelConfig !== void 0 && cancelConfig.isEnabled) {
52
+ finalClientActions.push(getDefaultFormAction({
53
+ type: "cancel",
54
+ ...cancelConfig
55
+ }));
56
+ }
57
+
58
+ return [...finalClientActions, ...clientActions];
59
+ }
@@ -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: {
@@ -191,7 +191,7 @@ export function calculateLayoutRulesResult(state, formValues) {
191
191
  clearNotExistingData(hideFieldIds, isFieldExists);
192
192
  clearNotExistingData(showFieldIds, isFieldExists);
193
193
  clearNotExistingData(hideSectionIds, isSectionExists);
194
- clearNotExistingData(hideSectionIds, isSectionExists);
194
+ clearNotExistingData(showSectionIds, isSectionExists);
195
195
  clearNotExistingData(removeMandatoryFieldIds, isFieldExists);
196
196
  clearNotExistingData(setMandatoryFieldIds, isFieldExists);
197
197
  return {
@@ -29,9 +29,9 @@ export function runSingleFieldCondition(_ref) {
29
29
  conditions.forEach((conditionObj, i) => {
30
30
  const {
31
31
  condition,
32
- value,
33
32
  fieldName
34
33
  } = conditionObj;
34
+ const value = 'value' in conditionObj ? conditionObj.value : undefined;
35
35
 
36
36
  if (!fields[fieldName]) {
37
37
  isSomeFiledMissing = true;
@@ -312,7 +312,6 @@ export function validateCondition() {
312
312
  value[0] = getRelatedDateISOString(value[0], false);
313
313
  value[1] = getRelatedDateISOString(value[1], false);
314
314
  } else {
315
- resultConditions;
316
315
  value = getRelatedDateISOString(value, false);
317
316
  }
318
317
  }