@zohodesk/library-platform 1.1.0-exp.1 → 1.1.0-exp.2

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 (116) hide show
  1. package/es/bc/zclient-actions/Constants.js +11 -0
  2. package/es/bc/zclient-actions/EventHandlers.js +1 -0
  3. package/es/bc/zlist/Properties.js +3 -0
  4. package/es/bc/zrecord/Constants.js +3 -1
  5. package/es/cc/table-connected/Properties.js +3 -0
  6. package/es/cc/table-list/Properties.js +32 -8
  7. package/es/cc/table-list/data-types/Header.js +8 -7
  8. package/es/cc/table-list/data-types/RowActionsConfig.js +1 -0
  9. package/es/cc/table-list/data-types/RowCursor.js +8 -0
  10. package/es/cc/table-list/row/Properties.js +16 -3
  11. package/es/desk-frameworks/table-connected/frameworks/TableConnectedFactory.js +4 -1
  12. package/es/desk-frameworks/table-connected/frameworks/TableConnectedView.js +4 -2
  13. package/es/desk-frameworks/table-connected/frameworks/__tests__/TableConnectedFactory.spec.js +453 -0
  14. package/es/desk-frameworks/table-connected/frameworks/__tests__/mock/data-broker/http-template/getAvailableFields.js +86 -0
  15. package/es/desk-frameworks/table-connected/frameworks/__tests__/mock/data-broker/http-template/getRecords.js +81 -0
  16. package/es/desk-frameworks/table-connected/frameworks/__tests__/mock/data-broker/http-template/getSelectedFields.js +32 -0
  17. package/es/desk-frameworks/table-connected/frameworks/__tests__/mock/data-broker/index.js +11 -0
  18. package/es/library/behaviours/list-selection/domain/entities/ListItemSelection.js +29 -9
  19. package/es/library/custom-component/domain/entities/Component.js +8 -4
  20. package/es/library/dot/components/table-list/frameworks/ui/TableListView.js +16 -6
  21. package/es/library/dot/components/table-list/frameworks/ui/css/TableList.module.css +10 -0
  22. package/es/library/dot/components/table-list/frameworks/ui/sub-components/Header.js +7 -6
  23. package/es/library/dot/components/table-list/frameworks/ui/sub-components/Rows.js +9 -7
  24. package/es/library/dot/components/table-list/frameworks/ui/sub-components/header/ActionColumn.js +3 -2
  25. package/es/library/dot/components/table-list/frameworks/ui/sub-components/header/HeaderData.js +2 -4
  26. package/es/library/dot/components/table-list/frameworks/ui/sub-components/header/Headers.js +0 -4
  27. package/es/library/dot/components/table-list/frameworks/ui/sub-components/header/SelectAll.js +4 -4
  28. package/es/library/dot/components/table-list/frameworks/ui/sub-components/row/Columns.js +2 -6
  29. package/es/library/dot/components/table-list/frameworks/ui/sub-components/row/Row.js +13 -7
  30. package/es/library/dot/components/table-list/frameworks/ui/sub-components/row/RowActions.js +2 -1
  31. package/es/library/dot/components/table-list/frameworks/ui/sub-components/row/RowData.js +2 -4
  32. package/es/platform/data-broker/http-template/deleteRecord.js +1 -1
  33. package/es/platform/data-broker/http-template/deleteRecords.js +1 -1
  34. package/es/platform/data-broker/http-template/getAvailableFields.js +1 -1
  35. package/es/platform/data-broker/http-template/getClientActions.js +23 -0
  36. package/es/platform/data-broker/http-template/getRecords.js +1 -1
  37. package/es/platform/data-broker/http-template/getSelectedFields.js +1 -1
  38. package/es/platform/data-broker/http-template/updateRecord.js +1 -1
  39. package/es/platform/data-broker/index.js +3 -3
  40. package/es/platform/zclient-actions/Readme.md +38 -0
  41. package/es/platform/zclient-actions/adapters/controllers/AbstractController.js +8 -0
  42. package/es/platform/zclient-actions/adapters/controllers/ClientActionBehaviourExecutorController.js +27 -0
  43. package/es/platform/zclient-actions/adapters/controllers/FailureController.js +28 -0
  44. package/es/platform/zclient-actions/adapters/controllers/FetchStateStopController.js +21 -0
  45. package/es/platform/zclient-actions/adapters/controllers/MountController.js +25 -0
  46. package/es/platform/zclient-actions/adapters/controllers/NoContentController.js +23 -0
  47. package/es/platform/zclient-actions/adapters/controllers/SetClientActionsController.js +24 -0
  48. package/es/platform/zclient-actions/adapters/controllers/SuccessController.js +28 -0
  49. package/es/platform/zclient-actions/adapters/gateways/Repository.js +28 -0
  50. package/es/platform/zclient-actions/adapters/gateways/Service.js +35 -0
  51. package/es/platform/zclient-actions/adapters/presenters/Presenter.js +24 -0
  52. package/es/platform/zclient-actions/applications/entities-factory/ClientActionFactory.js +12 -0
  53. package/es/platform/zclient-actions/applications/entities-factory/ClientActionManagerFactory.js +10 -0
  54. package/es/platform/zclient-actions/applications/interfaces/InputDependencies.js +1 -0
  55. package/es/platform/zclient-actions/applications/interfaces/gateways/IRepository.js +1 -0
  56. package/es/platform/zclient-actions/applications/interfaces/gateways/IService.js +0 -0
  57. package/es/platform/zclient-actions/applications/interfaces/gateways/State.js +1 -0
  58. package/es/platform/zclient-actions/applications/interfaces/input/ExecuteActionBehaviourInputModel.js +1 -0
  59. package/es/platform/zclient-actions/applications/interfaces/input/FailureInputModel.js +1 -0
  60. package/es/platform/zclient-actions/applications/interfaces/input/FetchStateStopInputModel.js +1 -0
  61. package/es/platform/zclient-actions/applications/interfaces/input/InitializeInputModel.js +1 -0
  62. package/es/platform/zclient-actions/applications/interfaces/input/NoContentInputModel.js +1 -0
  63. package/es/platform/zclient-actions/applications/interfaces/input/SetClientActionsInputModel.js +1 -0
  64. package/es/platform/zclient-actions/applications/interfaces/input/SuccessInputModel.js +1 -0
  65. package/es/platform/zclient-actions/applications/interfaces/output/IPresenter.js +1 -0
  66. package/es/platform/zclient-actions/applications/usecases/AbstractUseCase.js +17 -0
  67. package/es/platform/zclient-actions/applications/usecases/ExecuteActionBehaviourUseCase.js +33 -0
  68. package/es/platform/zclient-actions/applications/usecases/FailureUseCase.js +22 -0
  69. package/es/platform/zclient-actions/applications/usecases/FetchStateStopUseCase.js +25 -0
  70. package/es/platform/zclient-actions/applications/usecases/InitializeUseCase.js +17 -0
  71. package/es/platform/zclient-actions/applications/usecases/NoContentUseCase.js +27 -0
  72. package/es/platform/zclient-actions/applications/usecases/SetClientActionsUseCase.js +21 -0
  73. package/es/platform/zclient-actions/applications/usecases/SuccessUseCase.js +22 -0
  74. package/es/platform/zclient-actions/domain/entities/ClientAction.js +57 -0
  75. package/es/platform/zclient-actions/domain/entities/ClientActionManager.js +141 -0
  76. package/es/platform/zclient-actions/domain/entities/ClientActions.js +54 -0
  77. package/es/platform/zclient-actions/domain/entities/EventMapping.js +32 -0
  78. package/es/platform/zclient-actions/domain/entities/EventMappings.js +15 -0
  79. package/es/platform/zclient-actions/domain/entities/GetClientActionsStrategy.js +44 -0
  80. package/es/platform/zclient-actions/domain/entities/UIComponentMapping.js +37 -0
  81. package/es/platform/zclient-actions/domain/entities/interfaces/BehaviourState.js +1 -0
  82. package/es/platform/zclient-actions/domain/entities/interfaces/ClientActionModel.js +1 -0
  83. package/es/platform/zclient-actions/domain/entities/interfaces/ClientActionsModel.js +1 -0
  84. package/es/platform/zclient-actions/domain/entities/interfaces/ComponentPropertiesModel.js +1 -0
  85. package/es/platform/zclient-actions/domain/entities/interfaces/EventMappingModel.js +1 -0
  86. package/es/platform/zclient-actions/domain/entities/interfaces/EventModel.js +1 -0
  87. package/es/platform/zclient-actions/domain/entities/interfaces/IAction.js +1 -0
  88. package/es/platform/zclient-actions/domain/entities/interfaces/IClientAction.js +0 -0
  89. package/es/platform/zclient-actions/domain/entities/interfaces/IClientActionExecuteStrategy.js +0 -0
  90. package/es/platform/zclient-actions/domain/entities/interfaces/IClientActionManager.js +0 -0
  91. package/es/platform/zclient-actions/domain/entities/interfaces/IClientActions.js +0 -0
  92. package/es/platform/zclient-actions/domain/entities/interfaces/IError.js +1 -0
  93. package/es/platform/zclient-actions/domain/entities/interfaces/IEvent.js +1 -0
  94. package/es/platform/zclient-actions/domain/entities/interfaces/IEventMapping.js +0 -0
  95. package/es/platform/zclient-actions/domain/entities/interfaces/IEventMappings.js +0 -0
  96. package/es/platform/zclient-actions/domain/entities/interfaces/IPayload.js +0 -0
  97. package/es/platform/zclient-actions/domain/entities/interfaces/IUIComponentMapping.js +0 -0
  98. package/es/platform/zclient-actions/domain/entities/interfaces/PayloadValueMappingModel.js +1 -0
  99. package/es/platform/zclient-actions/domain/entities/interfaces/PropsMeta.js +1 -0
  100. package/es/platform/zclient-actions/domain/entities/interfaces/StrategyMeta.js +1 -0
  101. package/es/platform/zclient-actions/domain/entities/interfaces/SubMeta.js +1 -0
  102. package/es/platform/zclient-actions/domain/entities/interfaces/UIComponentMappingModel.js +1 -0
  103. package/es/platform/zclient-actions/domain/entities/interfaces/UserDetailsModel.js +1 -0
  104. package/es/platform/zclient-actions/frameworks/ActionsHandlersFactory.js +47 -0
  105. package/es/platform/zclient-actions/frameworks/ClientActionBehaviourFactory.js +12 -0
  106. package/es/platform/zdata-broker/adapters/controllers/{ActionExecutorController.js → DataBrokerExecutorController.js} +1 -1
  107. package/es/platform/zdata-broker/frameworks/EventHandlersFactory.js +3 -3
  108. package/es/platform/zlist/adapters/gateways/Repository.js +3 -1
  109. package/es/platform/zlist/adapters/presenters/TableTranslator.js +31 -2
  110. package/es/platform/zlist/adapters/presenters/translators/ColumnAlignmentTranslator.js +11 -0
  111. package/es/platform/zlist/adapters/presenters/translators/ColumnSizeTranslator.js +23 -0
  112. package/es/platform/zlist/adapters/presenters/translators/Header.js +4 -3
  113. package/es/platform/zlist/applications/entities-factory/ListFactory.js +3 -2
  114. package/es/platform/zlist/domain/entities/List.js +12 -21
  115. package/package.json +21 -20
  116. package/es/platform/data-broker/http-template/getUIActions.js +0 -22
@@ -0,0 +1,27 @@
1
+ import AbstractUseCase from "./AbstractUseCase";
2
+
3
+ class NoContentUseCase extends AbstractUseCase {
4
+ execute(input) {
5
+ const {
6
+ presenter,
7
+ repository
8
+ } = this.dependencies;
9
+ const {
10
+ dispatch,
11
+ metaData
12
+ } = input;
13
+ const recordManager = repository.getClientActionsManagerEntity();
14
+
15
+ if (recordManager.isGetClientActionsApi(metaData.actionName)) {
16
+ presenter.updateClientAction(recordManager.toObject());
17
+ }
18
+
19
+ const events = recordManager.createNoContentEvents(metaData);
20
+ events.forEach(event => {
21
+ dispatch(event);
22
+ });
23
+ }
24
+
25
+ }
26
+
27
+ export default NoContentUseCase;
@@ -0,0 +1,21 @@
1
+ import AbstractUseCase from "./AbstractUseCase";
2
+ import ClientActionFactory from "../entities-factory/ClientActionFactory";
3
+
4
+ class SetClientActionsUseCase extends AbstractUseCase {
5
+ execute(input) {
6
+ const {
7
+ presenter,
8
+ repository
9
+ } = this.dependencies;
10
+ const {
11
+ clientActions
12
+ } = input;
13
+ const recordManager = repository.getClientActionsManagerEntity();
14
+ const recordsEntity = ClientActionFactory.createMultipleClientActions(clientActions);
15
+ recordManager.setClientActions(recordsEntity);
16
+ presenter.updateClientAction(recordManager.toObject());
17
+ }
18
+
19
+ }
20
+
21
+ export default SetClientActionsUseCase;
@@ -0,0 +1,22 @@
1
+ import AbstractUseCase from "./AbstractUseCase";
2
+
3
+ class SuccessUseCase extends AbstractUseCase {
4
+ execute(input) {
5
+ const {
6
+ repository
7
+ } = this.dependencies;
8
+ const {
9
+ response,
10
+ metaData,
11
+ dispatch
12
+ } = input;
13
+ const recordManager = repository.getClientActionsManagerEntity();
14
+ const events = recordManager.createSuccessEvents(response, metaData);
15
+ events.forEach(event => {
16
+ dispatch(event);
17
+ });
18
+ }
19
+
20
+ }
21
+
22
+ export default SuccessUseCase;
@@ -0,0 +1,57 @@
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 UIComponentMapping from "./UIComponentMapping";
4
+ export default class ClientAction {
5
+ constructor(clientActionObj) {
6
+ _defineProperty(this, "id", void 0);
7
+
8
+ _defineProperty(this, "name", void 0);
9
+
10
+ _defineProperty(this, "library", void 0);
11
+
12
+ _defineProperty(this, "location", void 0);
13
+
14
+ _defineProperty(this, "uiComponentMapping", void 0);
15
+
16
+ _defineProperty(this, "modules", void 0);
17
+
18
+ _defineProperty(this, "modifiedTime", void 0);
19
+
20
+ _defineProperty(this, "createdTime", void 0);
21
+
22
+ _defineProperty(this, "modifiedBy", void 0);
23
+
24
+ _defineProperty(this, "createdBy", void 0);
25
+
26
+ this.id = clientActionObj.id;
27
+ this.name = clientActionObj.name;
28
+ this.library = clientActionObj.library;
29
+ this.location = clientActionObj.location;
30
+ this.uiComponentMapping = new UIComponentMapping(clientActionObj.uiComponentMapping);
31
+ this.modules = clientActionObj.modules;
32
+ this.modifiedTime = clientActionObj.modifiedTime;
33
+ this.createdTime = clientActionObj.createdTime;
34
+ this.modifiedBy = clientActionObj.modifiedBy;
35
+ this.createdBy = clientActionObj.createdBy;
36
+ }
37
+
38
+ toObject() {
39
+ return {
40
+ id: this.id,
41
+ name: this.name,
42
+ library: this.library,
43
+ location: this.location,
44
+ uiComponentMapping: this.uiComponentMapping.toObject(),
45
+ modules: this.modules,
46
+ modifiedTime: this.modifiedTime,
47
+ createdTime: this.createdTime,
48
+ modifiedBy: this.modifiedBy,
49
+ createdBy: this.createdBy
50
+ };
51
+ }
52
+
53
+ getId() {
54
+ return this.id;
55
+ }
56
+
57
+ }
@@ -0,0 +1,141 @@
1
+ import { DATA_BROKER_FAILURE, DATA_BROKER_NO_CONTENT, DATA_BROKER_SUCCESS } from "../../../../bc/zdata-broker/Symbols";
2
+ import { DATA_BROKER_EXECUTE } from "../../../../bc/zdata-broker/Constants";
3
+ import { CLIENTACTION_EXECUTE_FAIL_CALLBACK, CLIENTACTION_EXECUTE_SUCCESS_CALLBACK, CLIENTACTION_EXECUTE_SUCCESS_NO_CONTENT_CALLBACK, ClientActionApiActionName } from "../../../../bc/zclient-actions/Constants";
4
+ import GetClientActionsStrategy from "./GetClientActionsStrategy";
5
+ const clientActionExecuteStrategiesMap = {
6
+ [ClientActionApiActionName.GET_CLIENTACTIONS]: new GetClientActionsStrategy()
7
+ };
8
+ export default class ClientActionManager {
9
+ constructor(clientActions) {
10
+ this.clientActions = clientActions;
11
+ }
12
+
13
+ createDataBrokerMeta(_ref) {
14
+ let {
15
+ actionName,
16
+ successMeta,
17
+ successNoContentMeta,
18
+ failureMeta
19
+ } = _ref;
20
+ return {
21
+ actionName,
22
+ [DATA_BROKER_NO_CONTENT]: successNoContentMeta,
23
+ [DATA_BROKER_FAILURE]: failureMeta,
24
+ [DATA_BROKER_SUCCESS]: successMeta
25
+ };
26
+ }
27
+
28
+ createDataBrokerExecuteEvent(props, actionName, metaData) {
29
+ return {
30
+ type: DATA_BROKER_EXECUTE,
31
+ payload: {
32
+ props,
33
+ actionName
34
+ },
35
+ metaData
36
+ };
37
+ }
38
+
39
+ createFetchClientActionMeta(actionName, apiName, props) {
40
+ const clientActionExecuteStrategyMeta = {
41
+ actionName,
42
+ apiName,
43
+ props
44
+ };
45
+
46
+ if (this.isGetClientActionsApi(actionName)) {
47
+ clientActionExecuteStrategyMeta.props.from = 1;
48
+ }
49
+
50
+ const successMeta = {
51
+ type: CLIENTACTION_EXECUTE_SUCCESS_CALLBACK,
52
+ metaData: clientActionExecuteStrategyMeta
53
+ };
54
+ const successNoContentMeta = {
55
+ type: CLIENTACTION_EXECUTE_SUCCESS_NO_CONTENT_CALLBACK,
56
+ metaData: clientActionExecuteStrategyMeta
57
+ };
58
+ const failureMeta = {
59
+ type: CLIENTACTION_EXECUTE_FAIL_CALLBACK,
60
+ metaData: clientActionExecuteStrategyMeta
61
+ };
62
+ return this.createDataBrokerMeta({
63
+ actionName,
64
+ successNoContentMeta,
65
+ failureMeta,
66
+ successMeta
67
+ });
68
+ }
69
+
70
+ createSuccessEvents(response, metaData) {
71
+ const {
72
+ actionName
73
+ } = metaData;
74
+ const strategy = clientActionExecuteStrategiesMap[actionName];
75
+
76
+ if (strategy) {
77
+ return strategy.createSuccessEvents(response, metaData);
78
+ } else {
79
+ return [];
80
+ }
81
+ }
82
+
83
+ createNoContentEvents(metaData) {
84
+ const {
85
+ actionName
86
+ } = metaData;
87
+ const strategy = clientActionExecuteStrategiesMap[actionName];
88
+
89
+ if (strategy) {
90
+ return strategy.createNoContentEvents(metaData);
91
+ } else {
92
+ return [];
93
+ }
94
+ }
95
+
96
+ createFailureEvents(error, metaData) {
97
+ const {
98
+ actionName
99
+ } = metaData;
100
+ const strategy = clientActionExecuteStrategiesMap[actionName];
101
+
102
+ if (strategy) {
103
+ return strategy.createFailureEvents(error, metaData);
104
+ } else {
105
+ return [];
106
+ }
107
+ }
108
+
109
+ fetchingStarted() {
110
+ this.clientActions.setIsFetching(true);
111
+ }
112
+
113
+ fetchingFinished() {
114
+ this.clientActions.setIsFetching(false);
115
+ }
116
+
117
+ setClientActions(clientActions) {
118
+ this.clientActions.setClientActions(clientActions);
119
+ }
120
+
121
+ isGetClientActionsApi(actionName) {
122
+ return ClientActionApiActionName.GET_CLIENTACTIONS === actionName;
123
+ }
124
+
125
+ isClientActionsFetching() {
126
+ return this.clientActions.isClientActionsFetching();
127
+ }
128
+
129
+ isClientActionApiName(apiName) {
130
+ return apiName === 'clientActions';
131
+ }
132
+
133
+ toObject() {
134
+ const clientActionsObj = this.clientActions.toObject();
135
+ return {
136
+ clientActions: clientActionsObj.data,
137
+ isFetching: clientActionsObj.isFetching
138
+ };
139
+ }
140
+
141
+ }
@@ -0,0 +1,54 @@
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 ClientAction from "./ClientAction";
4
+ export default class ClientActions {
5
+ constructor(_ref) {
6
+ let {
7
+ data,
8
+ isFetching
9
+ } = _ref;
10
+ let fetchLimit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 100;
11
+
12
+ _defineProperty(this, "clientActions", void 0);
13
+
14
+ _defineProperty(this, "isFetching", void 0);
15
+
16
+ _defineProperty(this, "fetchLimit", void 0);
17
+
18
+ this.clientActions = data.map(obj => new ClientAction(obj));
19
+ this.fetchLimit = fetchLimit;
20
+ this.isFetching = isFetching;
21
+ }
22
+
23
+ getIsFetching() {
24
+ return this.isFetching;
25
+ }
26
+
27
+ setIsFetching(isFetching) {
28
+ this.isFetching = isFetching;
29
+ }
30
+
31
+ setClientActions(clientActions) {
32
+ this.clientActions = clientActions;
33
+ }
34
+
35
+ isClientActionsFetching() {
36
+ return this.isFetching;
37
+ }
38
+
39
+ getClientActionsLength() {
40
+ return this.clientActions.length;
41
+ }
42
+
43
+ getClientAction(id) {
44
+ return this.clientActions.find(clientAction => clientAction.getId() === id) || null;
45
+ }
46
+
47
+ toObject() {
48
+ return {
49
+ data: this.clientActions.map(action => action.toObject()),
50
+ isFetching: this.isFetching
51
+ };
52
+ }
53
+
54
+ }
@@ -0,0 +1,32 @@
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
+ export default class EventMapping {
4
+ constructor(eventMappingObj) {
5
+ _defineProperty(this, "id", void 0);
6
+
7
+ _defineProperty(this, "sourceEvent", void 0);
8
+
9
+ _defineProperty(this, "targetEvent", void 0);
10
+
11
+ _defineProperty(this, "payloadValueMapping", void 0);
12
+
13
+ this.id = eventMappingObj.id;
14
+ this.sourceEvent = eventMappingObj.sourceEvent;
15
+ this.targetEvent = eventMappingObj.targetEvent;
16
+ this.payloadValueMapping = eventMappingObj.payloadValueMapping;
17
+ }
18
+
19
+ toObject() {
20
+ return {
21
+ id: this.id,
22
+ sourceEvent: this.sourceEvent,
23
+ targetEvent: this.targetEvent,
24
+ payloadValueMapping: this.payloadValueMapping
25
+ };
26
+ }
27
+
28
+ getId() {
29
+ return this.id;
30
+ }
31
+
32
+ }
@@ -0,0 +1,15 @@
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 EventMapping from "./EventMapping";
4
+ export default class EventMappings {
5
+ constructor(eventMappings) {
6
+ _defineProperty(this, "input", void 0);
7
+
8
+ this.input = eventMappings.map(eventMapping => new EventMapping(eventMapping));
9
+ }
10
+
11
+ toArray() {
12
+ return this.input;
13
+ }
14
+
15
+ }
@@ -0,0 +1,44 @@
1
+ import { CLIENTACTION_EXECUTE_FAILED, CLIENTACTION_EXECUTE_SUCCEEDED, CLIENTACTION_EXECUTE_SUCCEEDED_NO_CONTENT, SET_CLIENTACTIONS } from "../../../../bc/zclient-actions/Constants";
2
+ export default class GetClientActionsStrategy {
3
+ createSuccessEvents(response, metaData) {
4
+ const events = [];
5
+ const clientActions = response;
6
+ events.push({
7
+ type: SET_CLIENTACTIONS,
8
+ payload: {
9
+ clientActions
10
+ }
11
+ });
12
+ events.push({
13
+ type: CLIENTACTION_EXECUTE_SUCCEEDED,
14
+ payload: {
15
+ clientActions
16
+ },
17
+ metaData
18
+ });
19
+ return events;
20
+ }
21
+
22
+ createNoContentEvents(metaData) {
23
+ const events = [];
24
+ events.push({
25
+ type: CLIENTACTION_EXECUTE_SUCCEEDED_NO_CONTENT,
26
+ payload: {},
27
+ metaData
28
+ });
29
+ return events;
30
+ }
31
+
32
+ createFailureEvents(error, metaData) {
33
+ const events = [];
34
+ events.push({
35
+ type: CLIENTACTION_EXECUTE_FAILED,
36
+ payload: {
37
+ error
38
+ },
39
+ metaData
40
+ });
41
+ return events;
42
+ }
43
+
44
+ }
@@ -0,0 +1,37 @@
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 EventMappings from "./EventMappings";
4
+ export default class UIComponentMapping {
5
+ constructor(uiComponentMappingObj) {
6
+ _defineProperty(this, "id", void 0);
7
+
8
+ _defineProperty(this, "name", void 0);
9
+
10
+ _defineProperty(this, "component", void 0);
11
+
12
+ _defineProperty(this, "properties", void 0);
13
+
14
+ _defineProperty(this, "eventMappings", void 0);
15
+
16
+ this.id = uiComponentMappingObj.id;
17
+ this.name = uiComponentMappingObj.name;
18
+ this.component = uiComponentMappingObj.component;
19
+ this.properties = uiComponentMappingObj.properties;
20
+ this.eventMappings = new EventMappings(uiComponentMappingObj.eventMappings);
21
+ }
22
+
23
+ toObject() {
24
+ return {
25
+ id: this.id,
26
+ name: this.name,
27
+ component: this.component,
28
+ properties: this.properties,
29
+ eventMappings: this.eventMappings.toArray().map(eventMapping => eventMapping.toObject())
30
+ };
31
+ }
32
+
33
+ getId() {
34
+ return this.id;
35
+ }
36
+
37
+ }
@@ -0,0 +1,47 @@
1
+ import MountController from "../adapters/controllers/MountController";
2
+ import Presenter from "../adapters/presenters/Presenter";
3
+ import Repository from "../adapters/gateways/Repository";
4
+ import Service from "../adapters/gateways/Service";
5
+ import ClientActionBehaviourExecutorController from "../adapters/controllers/ClientActionBehaviourExecutorController";
6
+ import FailureController from "../adapters/controllers/FailureController";
7
+ import SuccessController from "../adapters/controllers/SuccessController";
8
+ import NoContentController from "../adapters/controllers/NoContentController";
9
+ import SetClientActionsController from "../adapters/controllers/SetClientActionsController";
10
+ import FetchStateStopController from "../adapters/controllers/FetchStateStopController";
11
+ import { CLIENTACTION_BEHAVIOUR_EXECUTE, CLIENTACTION_EXECUTE_FAIL_CALLBACK, CLIENTACTION_EXECUTE_FAILED, CLIENTACTION_EXECUTE_SUCCEEDED, CLIENTACTION_EXECUTE_SUCCEEDED_NO_CONTENT, CLIENTACTION_EXECUTE_SUCCESS_CALLBACK, SET_CLIENTACTIONS, CLIENTACTION_EXECUTE_SUCCESS_NO_CONTENT_CALLBACK } from "../../../bc/zclient-actions/Constants";
12
+ export default class ActionsHandlersFactory {
13
+ static getClientActionControllerHandles(service) {
14
+ return {
15
+ executeClientActionBehaviour: new ClientActionBehaviourExecutorController(service).handle,
16
+ failure: new FailureController(service).handle,
17
+ success: new SuccessController(service).handle,
18
+ noContent: new NoContentController(service).handle,
19
+ setClientActions: new SetClientActionsController(service).handle,
20
+ fetchStateStop: new FetchStateStopController(service).handle
21
+ };
22
+ }
23
+
24
+ static create(apiDetails) {
25
+ const presenter = new Presenter();
26
+ const repository = new Repository();
27
+ const dependencies = {
28
+ presenter,
29
+ repository
30
+ };
31
+ const service = new Service(dependencies);
32
+ const mountController = new MountController(apiDetails, service);
33
+ const clientActionControllerHandle = ActionsHandlersFactory.getClientActionControllerHandles(service);
34
+ return {
35
+ MOUNT: mountController.handle,
36
+ [CLIENTACTION_BEHAVIOUR_EXECUTE]: clientActionControllerHandle.executeClientActionBehaviour,
37
+ [CLIENTACTION_EXECUTE_FAIL_CALLBACK]: clientActionControllerHandle.failure,
38
+ [CLIENTACTION_EXECUTE_SUCCESS_CALLBACK]: clientActionControllerHandle.success,
39
+ [CLIENTACTION_EXECUTE_SUCCEEDED]: clientActionControllerHandle.fetchStateStop,
40
+ [CLIENTACTION_EXECUTE_FAILED]: clientActionControllerHandle.fetchStateStop,
41
+ [CLIENTACTION_EXECUTE_SUCCEEDED_NO_CONTENT]: clientActionControllerHandle.fetchStateStop,
42
+ [SET_CLIENTACTIONS]: clientActionControllerHandle.setClientActions,
43
+ [CLIENTACTION_EXECUTE_SUCCESS_NO_CONTENT_CALLBACK]: clientActionControllerHandle.noContent
44
+ };
45
+ }
46
+
47
+ }
@@ -0,0 +1,12 @@
1
+ import ActionsHandlersFactory from "./ActionsHandlersFactory";
2
+ export default class ClientActionBehaviourFactory {
3
+ static create(apiDetails) {
4
+ return {
5
+ name: 'zclientAction',
6
+ eventHandlers: ActionsHandlersFactory.create(apiDetails),
7
+ properties: {},
8
+ setInitialState: () => ({})
9
+ };
10
+ }
11
+
12
+ }
@@ -1,5 +1,5 @@
1
1
  import AbstractController from "./AbstractController";
2
- export default class ActionExecutorController extends AbstractController {
2
+ export default class DataBrokerExecutorController extends AbstractController {
3
3
  handle(event) {
4
4
  const {
5
5
  state,
@@ -3,7 +3,7 @@ import { FETCH_FAILED, FETCH_SUCCESS, FETCH_SUCCESS_NO_CONTENT } from "../../../
3
3
  import Presenter from "../adapters/presenters/Presenter";
4
4
  import Repository from "../adapters/gateways/Repository";
5
5
  import RegisterController from "../adapters/controllers/RegisterController";
6
- import ActionExecutorController from "../adapters/controllers/ActionExecutorController";
6
+ import DataBrokerExecutorController from "../adapters/controllers/DataBrokerExecutorController";
7
7
  import FailureController from "../adapters/controllers/FailureController";
8
8
  import SuccessController from "../adapters/controllers/SuccessController";
9
9
  import NoContentController from "../adapters/controllers/NoContentController";
@@ -26,13 +26,13 @@ export default class EventHandlersFactory {
26
26
  static create() {
27
27
  const service = this.createService();
28
28
  const registerController = new RegisterController(service);
29
- const executeController = new ActionExecutorController(service);
29
+ const dataBrokerExecuteController = new DataBrokerExecutorController(service);
30
30
  const failureController = new FailureController(service);
31
31
  const successController = new SuccessController(service);
32
32
  const noContentController = new NoContentController(service);
33
33
  return {
34
34
  [DATA_BROKER_REGISTER]: registerController.handle,
35
- [DATA_BROKER_EXECUTE]: executeController.handle,
35
+ [DATA_BROKER_EXECUTE]: dataBrokerExecuteController.handle,
36
36
  [FETCH_FAILED]: failureController.handle,
37
37
  [FETCH_SUCCESS]: successController.handle,
38
38
  [FETCH_SUCCESS_NO_CONTENT]: noContentController.handle
@@ -16,9 +16,11 @@ class Repository {
16
16
  limit,
17
17
  sortBy,
18
18
  filter,
19
- moduleName
19
+ moduleName,
20
+ pageContext
20
21
  } = this.state.properties;
21
22
  const list = ListFactory.createList({
23
+ pageContext,
22
24
  filter: { ...filter,
23
25
  departmentId: filter.departmentId,
24
26
  viewId: filter.viewId,