@zohodesk/library-platform 1.1.7-exp.1 → 1.1.7-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.
- package/es/bc/sdk/ResourceNamesEnum.js +1 -0
- package/es/bc/zlist/Constants.js +3 -1
- package/es/bc/zrecord/Constants.js +1 -0
- package/es/cc/table-connected/Properties.js +8 -0
- package/es/cc/table-connected/constants/Events.js +1 -0
- package/es/library/custom-component/adapters/gateways/event-manager/EventManager.js +2 -2
- package/es/library/dot/components/action-location/usecases/interactors/PropertiesChangeUseCase.js +1 -1
- package/es/library/dot/components/section/frameworks/ui/SectionView.js +1 -1
- package/es/platform/client-actions/bc/zclient-actions/SdkContract.js +35 -0
- package/es/platform/client-actions/behaviour/zclient-actions/adapters/resources/ClientActionResource.js +105 -0
- package/es/platform/client-actions/behaviour/zclient-actions/applications/interfaces/IClientActionResource.js +1 -0
- package/es/platform/client-actions/behaviour/zclient-actions/applications/interfaces/input/GetClientActionLocationInputModel.js +1 -0
- package/es/platform/client-actions/behaviour/zclient-actions/applications/interfaces/input/GetClientActionUIComponentPropertiesInputModel.js +1 -0
- package/es/platform/client-actions/behaviour/zclient-actions/applications/interfaces/input/GetClientActionsInputModel.js +1 -0
- package/es/platform/client-actions/behaviour/zclient-actions/applications/interfaces/input/UpdateClientActionUIComponentPropertiesInputModel.js +1 -0
- package/es/platform/client-actions/behaviour/zclient-actions/applications/usecases/GetClientActionLocationUseCase.js +20 -0
- package/es/platform/client-actions/behaviour/zclient-actions/applications/usecases/GetClientActionUIComponentPropertiesUseCase.js +20 -0
- package/es/platform/client-actions/behaviour/zclient-actions/applications/usecases/GetClientActionsUseCase.js +18 -0
- package/es/platform/client-actions/behaviour/zclient-actions/applications/usecases/UpdateClientActionUIComponentPropertiesUseCase.js +32 -0
- package/es/platform/client-actions/behaviour/zclient-actions/domain/entities/ClientAction.js +12 -0
- package/es/platform/client-actions/behaviour/zclient-actions/domain/entities/ClientActionManager.js +45 -0
- package/es/platform/client-actions/behaviour/zclient-actions/domain/entities/UIComponentMapping.js +10 -0
- package/es/platform/client-actions/behaviour/zclient-actions/frameworks/sdk/ClientActionsSDKFactory.js +29 -0
- package/es/platform/client-actions/components/action-event-mediator/applications/usecases/PropertiesChangeUseCase.js +1 -1
- package/es/platform/client-actions/components/action-event-mediator/domain/entities/ActionEventMediatorEntity.js +7 -3
- package/es/platform/client-actions/components/dynamic-component/frameworks/ui/DynamicActionComponentView.js +4 -2
- package/es/platform/components/table-connected/frameworks/EventHandlersFactory.js +16 -5
- package/es/platform/components/table-connected/frameworks/TableConnectedFactory.js +6 -1
- package/es/platform/data-source/http-template/getClientActions.js +2 -2
- package/es/platform/sdk/adapters/gateways/Service.js +0 -4
- package/es/platform/sdk/domain/entities/ResourceManager.js +0 -4
- package/es/platform/sdk/frameworks/Sdk.js +7 -0
- package/es/platform/sdk/frameworks/SdkRegistry.js +0 -9
- package/es/platform/zform/adapters/presenter/translators/SectionTranslator.js +7 -1
- package/es/platform/zform/frameworks/layout-rules/calculateLayoutRulesResult.js +1 -1
- package/es/platform/zform/frameworks/layout-rules/runSingleFieldCondition.js +1 -1
- package/es/platform/zform/frameworks/layout-rules/validator.js +0 -1
- package/es/platform/zlist/adapters/presenters/TableTranslator.js +3 -2
- package/es/platform/zlist/applications/usecases/RecordSuccessCallbackUsecase.js +4 -1
- package/es/platform/zlist/domain/entities/List.js +9 -3
- package/es/platform/zrecord/adapters/controllers/SetRecordsController.js +7 -3
- package/es/platform/zrecord/applications/usecases/SetRecordsUseCase.js +11 -1
- package/package.json +2 -1
- package/es/platform/page/index.js +0 -46
- package/es/platform/sdk/application/usecases/GetResourcesUseCase.js +0 -15
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
var ResourceNamesEnum = /*#__PURE__*/function (ResourceNamesEnum) {
|
|
2
2
|
ResourceNamesEnum["SMART_TABLE"] = "smartTable";
|
|
3
3
|
ResourceNamesEnum["SMART_FORM"] = "smartForm";
|
|
4
|
+
ResourceNamesEnum["CLIENT_ACTION"] = "clientAction";
|
|
4
5
|
return ResourceNamesEnum;
|
|
5
6
|
}(ResourceNamesEnum || {});
|
|
6
7
|
|
package/es/bc/zlist/Constants.js
CHANGED
|
@@ -14,4 +14,6 @@ export const ZLIST_INITIAL_AVAILABLE_FIELDS_FETCH_FAILED = 'ZLIST#INITIAL_AVAILA
|
|
|
14
14
|
export const ZLIST_INITIAL_SELECTED_FIELDS_FETCH_FAILED = 'ZLIST#INITIAL_SELECTED_FIELDS_FETCH_FAILED';
|
|
15
15
|
export const ZLIST_INITIAL_RECORDS_FETCH_FAILED = 'ZLIST#INITIAL_RECORDS_FETCH_FAILED';
|
|
16
16
|
export const ZLIST_INITIAL_CLIENT_ACTIONS_FETCH_FAILED = 'ZLIST#INITIAL_CLIENT_ACTIONS_FETCH_FAILED';
|
|
17
|
-
export const ZLIST_FETCH_MORE_RECORDS_FAILED = 'ZLIST#FETCH_MORE_RECORDS_FAILED';
|
|
17
|
+
export const ZLIST_FETCH_MORE_RECORDS_FAILED = 'ZLIST#FETCH_MORE_RECORDS_FAILED';
|
|
18
|
+
export const ZLIST_RECORD_REORDER_SUCCEEDED = 'ZLIST#RECORD_REORDER_SUCCEEDED';
|
|
19
|
+
export const CLIENT_ACTION_TABLE_LIST_COMPONENT_NAME = 'TableList';
|
|
@@ -14,6 +14,7 @@ export const RECORD_LOCAL_UPDATE = 'RECORD#LOCAL_UPDATE';
|
|
|
14
14
|
export const RECORD_LOCAL_MULTIPLE_DELETE = 'RECORD#LOCAL_MULTIPLE_DELETE';
|
|
15
15
|
export const APPEND_RECORDS = 'RECORD#APPEND_RECORDS';
|
|
16
16
|
export const SET_RECORDS = 'RECORD#SET_RECORDS';
|
|
17
|
+
export const SET_RECORDS_SUCCESS = 'RECORD#SET_RECORDS_SUCCESS';
|
|
17
18
|
export const CREATE_RECORD = 'RECORD#CREATE_RECORD';
|
|
18
19
|
export class RecordApiActionName {}
|
|
19
20
|
|
|
@@ -150,7 +150,7 @@ class EventManager {
|
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
-
dispatchEvent(event
|
|
153
|
+
dispatchEvent(event) {
|
|
154
154
|
let {
|
|
155
155
|
payload,
|
|
156
156
|
metaData,
|
|
@@ -162,7 +162,7 @@ class EventManager {
|
|
|
162
162
|
return;
|
|
163
163
|
}
|
|
164
164
|
|
|
165
|
-
|
|
165
|
+
this._element && this._element.dispatchEvent(new CustomEvent(type, {
|
|
166
166
|
bubbles: true,
|
|
167
167
|
detail: {
|
|
168
168
|
payload,
|
package/es/library/dot/components/action-location/usecases/interactors/PropertiesChangeUseCase.js
CHANGED
|
@@ -10,7 +10,7 @@ export default class PropertiesChangeUseCase extends AbstractUseCase {
|
|
|
10
10
|
currentActions,
|
|
11
11
|
previousActions
|
|
12
12
|
} = input;
|
|
13
|
-
actionLocation.processActionsChange(
|
|
13
|
+
actionLocation.processActionsChange(previousActions, currentActions);
|
|
14
14
|
presenter.updateActionLocation(actionLocation.toObject());
|
|
15
15
|
}
|
|
16
16
|
|
|
@@ -24,7 +24,7 @@ function SectionView(_ref, ref) {
|
|
|
24
24
|
}
|
|
25
25
|
}, !isCollapsed && /*#__PURE__*/React.createElement(FieldsLayout, {
|
|
26
26
|
$flag_topSpace: !!title || !!description
|
|
27
|
-
}, fields.filter(field => field.isVisible).map(
|
|
27
|
+
}, fields.filter(field => field.isVisible).map(field => renderField(field, field.name || field.apiName))));
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
export default SectionView;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export const SdkContracts = {
|
|
2
|
+
getLocationMeta: {
|
|
3
|
+
type: 'object',
|
|
4
|
+
properties: {
|
|
5
|
+
clientActionId: {
|
|
6
|
+
type: 'string',
|
|
7
|
+
minLength: 1
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
required: ['clientActionId']
|
|
11
|
+
},
|
|
12
|
+
getComponentPropertiesMeta: {
|
|
13
|
+
type: 'object',
|
|
14
|
+
properties: {
|
|
15
|
+
clientActionId: {
|
|
16
|
+
type: 'string',
|
|
17
|
+
minLength: 1
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
required: ['clientActionId']
|
|
21
|
+
},
|
|
22
|
+
updateComponentPropertiesMeta: {
|
|
23
|
+
type: 'object',
|
|
24
|
+
properties: {
|
|
25
|
+
clientActionId: {
|
|
26
|
+
type: 'string',
|
|
27
|
+
minLength: 1
|
|
28
|
+
},
|
|
29
|
+
newComponentProperties: {
|
|
30
|
+
type: 'object'
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
required: ['clientActionId', 'newComponentProperties']
|
|
34
|
+
}
|
|
35
|
+
};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { AbstractResource } from "../../../../../sdk/application/interfaces/gateways/AbstractResource";
|
|
2
|
+
import Repository from "../gateways/Repository";
|
|
3
|
+
import Presenter from "../presenters/Presenter";
|
|
4
|
+
import GetClientActionLocationUseCase from "../../applications/usecases/GetClientActionLocationUseCase";
|
|
5
|
+
import GetClientActionUIComponentPropertiesUseCase from "../../applications/usecases/GetClientActionUIComponentPropertiesUseCase";
|
|
6
|
+
import UpdateClientActionUIComponentPropertiesUseCase from "../../applications/usecases/UpdateClientActionUIComponentPropertiesUseCase";
|
|
7
|
+
import GetClientActionsUseCase from "../../applications/usecases/GetClientActionsUseCase";
|
|
8
|
+
import { SdkContracts } from "../../../../bc/zclient-actions/SdkContract";
|
|
9
|
+
export class ClientActionResource extends AbstractResource {
|
|
10
|
+
initialize() {}
|
|
11
|
+
|
|
12
|
+
destroy() {}
|
|
13
|
+
|
|
14
|
+
getClientActionDependencies() {
|
|
15
|
+
const dependencies = {
|
|
16
|
+
repository: new Repository(),
|
|
17
|
+
presenter: new Presenter()
|
|
18
|
+
};
|
|
19
|
+
return dependencies;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
createUseCase(dependencies, UseCaseClass) {
|
|
23
|
+
var _usecase$updateDepend, _usecase$updateDepend2;
|
|
24
|
+
|
|
25
|
+
const {
|
|
26
|
+
state,
|
|
27
|
+
updateState
|
|
28
|
+
} = this.dependencies;
|
|
29
|
+
const usecase = new UseCaseClass(dependencies);
|
|
30
|
+
(_usecase$updateDepend = usecase.updateDependency) === null || _usecase$updateDepend === void 0 ? void 0 : _usecase$updateDepend.call(usecase, state, updateState);
|
|
31
|
+
(_usecase$updateDepend2 = usecase.updateDependencies) === null || _usecase$updateDepend2 === void 0 ? void 0 : _usecase$updateDepend2.call(usecase, state, updateState);
|
|
32
|
+
return usecase;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
getLocation(id) {
|
|
36
|
+
this.validateInput('getLocation', {
|
|
37
|
+
clientActionId: id
|
|
38
|
+
}, SdkContracts.getLocationMeta);
|
|
39
|
+
const {
|
|
40
|
+
getData,
|
|
41
|
+
setData
|
|
42
|
+
} = this.createCallback();
|
|
43
|
+
const dependencies = this.getClientActionDependencies();
|
|
44
|
+
const useCase = this.createUseCase(dependencies, GetClientActionLocationUseCase);
|
|
45
|
+
useCase.execute({
|
|
46
|
+
id,
|
|
47
|
+
callback: setData
|
|
48
|
+
});
|
|
49
|
+
return getData();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
getUIComponentProperties(id) {
|
|
53
|
+
this.validateInput('getUIComponentProperties', {
|
|
54
|
+
clientActionId: id
|
|
55
|
+
}, SdkContracts.getComponentPropertiesMeta);
|
|
56
|
+
const {
|
|
57
|
+
getData,
|
|
58
|
+
setData
|
|
59
|
+
} = this.createCallback();
|
|
60
|
+
const dependencies = this.getClientActionDependencies();
|
|
61
|
+
const useCase = this.createUseCase(dependencies, GetClientActionUIComponentPropertiesUseCase);
|
|
62
|
+
useCase.execute({
|
|
63
|
+
id,
|
|
64
|
+
callback: setData
|
|
65
|
+
});
|
|
66
|
+
return getData();
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
getClientActions() {
|
|
70
|
+
const {
|
|
71
|
+
getData,
|
|
72
|
+
setData
|
|
73
|
+
} = this.createCallback();
|
|
74
|
+
const dependencies = this.getClientActionDependencies();
|
|
75
|
+
const useCase = this.createUseCase(dependencies, GetClientActionsUseCase);
|
|
76
|
+
useCase.execute({
|
|
77
|
+
callback: setData
|
|
78
|
+
});
|
|
79
|
+
return getData();
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
updateUIComponentProperties(id, newComponentProperties) {
|
|
83
|
+
this.validateInput('updateUIComponentProperties', {
|
|
84
|
+
clientActionId: id,
|
|
85
|
+
newComponentProperties
|
|
86
|
+
}, SdkContracts.updateComponentPropertiesMeta);
|
|
87
|
+
const {
|
|
88
|
+
getData,
|
|
89
|
+
setData
|
|
90
|
+
} = this.createCallback();
|
|
91
|
+
const dependencies = this.getClientActionDependencies();
|
|
92
|
+
const {
|
|
93
|
+
dispatch
|
|
94
|
+
} = this.dependencies;
|
|
95
|
+
const useCase = this.createUseCase(dependencies, UpdateClientActionUIComponentPropertiesUseCase);
|
|
96
|
+
useCase.execute({
|
|
97
|
+
id,
|
|
98
|
+
newComponentProperties,
|
|
99
|
+
dispatch,
|
|
100
|
+
callback: setData
|
|
101
|
+
});
|
|
102
|
+
return getData();
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import AbstractUseCase from "./AbstractUseCase";
|
|
2
|
+
|
|
3
|
+
class GetClientActionLocationUseCase extends AbstractUseCase {
|
|
4
|
+
execute(_ref) {
|
|
5
|
+
let {
|
|
6
|
+
id,
|
|
7
|
+
callback
|
|
8
|
+
} = _ref;
|
|
9
|
+
const {
|
|
10
|
+
repository
|
|
11
|
+
} = this.dependencies;
|
|
12
|
+
const clientActionManager = repository.getClientActionsManagerEntity();
|
|
13
|
+
clientActionManager.validateClientActionId(id);
|
|
14
|
+
const clientAction = clientActionManager.getClientAction(id);
|
|
15
|
+
callback === null || callback === void 0 ? void 0 : callback(clientAction.getLocation());
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default GetClientActionLocationUseCase;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import AbstractUseCase from "./AbstractUseCase";
|
|
2
|
+
|
|
3
|
+
class GetClientActionUIComponentPropertiesUseCase extends AbstractUseCase {
|
|
4
|
+
execute(_ref) {
|
|
5
|
+
let {
|
|
6
|
+
id,
|
|
7
|
+
callback
|
|
8
|
+
} = _ref;
|
|
9
|
+
const {
|
|
10
|
+
repository
|
|
11
|
+
} = this.dependencies;
|
|
12
|
+
const clientActionManager = repository.getClientActionsManagerEntity();
|
|
13
|
+
clientActionManager.validateClientActionId(id);
|
|
14
|
+
const clientAction = clientActionManager.getClientAction(id);
|
|
15
|
+
callback === null || callback === void 0 ? void 0 : callback(clientAction.getUIComponentProperties());
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default GetClientActionUIComponentPropertiesUseCase;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import AbstractUseCase from "./AbstractUseCase";
|
|
2
|
+
|
|
3
|
+
class GetClientActionsUseCase extends AbstractUseCase {
|
|
4
|
+
execute(_ref) {
|
|
5
|
+
let {
|
|
6
|
+
callback
|
|
7
|
+
} = _ref;
|
|
8
|
+
const {
|
|
9
|
+
repository
|
|
10
|
+
} = this.dependencies;
|
|
11
|
+
const clientActionManager = repository.getClientActionsManagerEntity();
|
|
12
|
+
const clientActions = clientActionManager.getClientActionModels();
|
|
13
|
+
callback === null || callback === void 0 ? void 0 : callback(clientActions);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default GetClientActionsUseCase;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import AbstractUseCase from "./AbstractUseCase";
|
|
2
|
+
import { SET_CLIENTACTIONS } from "../../../../bc/zclient-actions/Constants";
|
|
3
|
+
|
|
4
|
+
class UpdateClientActionUIComponentPropertiesUseCase extends AbstractUseCase {
|
|
5
|
+
execute(_ref) {
|
|
6
|
+
let {
|
|
7
|
+
id,
|
|
8
|
+
newComponentProperties,
|
|
9
|
+
dispatch,
|
|
10
|
+
callback
|
|
11
|
+
} = _ref;
|
|
12
|
+
const {
|
|
13
|
+
repository
|
|
14
|
+
} = this.dependencies;
|
|
15
|
+
const clientActionManager = repository.getClientActionsManagerEntity();
|
|
16
|
+
clientActionManager.validateClientActionId(id);
|
|
17
|
+
const {
|
|
18
|
+
updatedClientAction,
|
|
19
|
+
updatedClientActions
|
|
20
|
+
} = clientActionManager.updateClientActionComponentProperties(id, newComponentProperties);
|
|
21
|
+
dispatch({
|
|
22
|
+
type: SET_CLIENTACTIONS,
|
|
23
|
+
payload: {
|
|
24
|
+
clientActions: updatedClientActions
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
callback === null || callback === void 0 ? void 0 : callback(updatedClientAction.getUIComponentProperties());
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export default UpdateClientActionUIComponentPropertiesUseCase;
|
package/es/platform/client-actions/behaviour/zclient-actions/domain/entities/ClientAction.js
CHANGED
|
@@ -41,6 +41,18 @@ export default class ClientAction {
|
|
|
41
41
|
this.conditionMeta = clientActionObj.conditions;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
getLocation() {
|
|
45
|
+
return this.location;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
getUIComponentProperties() {
|
|
49
|
+
return this.uiComponentMapping.getPropertiesValueMapping();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
updateUIComponentProperties(newProperties) {
|
|
53
|
+
this.uiComponentMapping.updatePropertiesValueMapping(newProperties);
|
|
54
|
+
}
|
|
55
|
+
|
|
44
56
|
toObject() {
|
|
45
57
|
return {
|
|
46
58
|
id: this.id,
|
package/es/platform/client-actions/behaviour/zclient-actions/domain/entities/ClientActionManager.js
CHANGED
|
@@ -114,6 +114,32 @@ export default class ClientActionManager {
|
|
|
114
114
|
this.clientActions.setIsFetching(false);
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
+
getClientAction(id) {
|
|
118
|
+
return this.clientActions.getClientAction(id);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
getClientActionModels() {
|
|
122
|
+
const clientActionModels = this.clientActions.toObject();
|
|
123
|
+
return clientActionModels.data;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
updateClientActionComponentProperties(id, newComponentProperties) {
|
|
127
|
+
const clientActions = this.getClientActionModels();
|
|
128
|
+
const updatedClientAction = this.getClientAction(id);
|
|
129
|
+
updatedClientAction.updateUIComponentProperties(newComponentProperties);
|
|
130
|
+
const updatedClientActions = clientActions.map(clientAction => {
|
|
131
|
+
if (clientAction.id === updatedClientAction.getId()) {
|
|
132
|
+
return updatedClientAction.toObject();
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
return clientAction;
|
|
136
|
+
});
|
|
137
|
+
return {
|
|
138
|
+
updatedClientAction,
|
|
139
|
+
updatedClientActions
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
|
|
117
143
|
setClientActions(clientActions) {
|
|
118
144
|
this.clientActions.setClientActions(clientActions);
|
|
119
145
|
}
|
|
@@ -130,6 +156,25 @@ export default class ClientActionManager {
|
|
|
130
156
|
return apiName === 'clientActions';
|
|
131
157
|
}
|
|
132
158
|
|
|
159
|
+
validateClientActionId(id) {
|
|
160
|
+
const isValidClientActionIdFormat = id !== '' && id !== null && !isNaN(Number(id)) && typeof id === 'string';
|
|
161
|
+
|
|
162
|
+
if (!isValidClientActionIdFormat) {
|
|
163
|
+
throw new Error(`ClientActionResource: Invalid value '${id}' passed as client action id.`);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
this.doesClientActionExist(id);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
doesClientActionExist(id) {
|
|
170
|
+
const clientActions = this.getClientActionModels();
|
|
171
|
+
const doesClientActionExist = clientActions.find(clientAction => clientAction.id === id);
|
|
172
|
+
|
|
173
|
+
if (doesClientActionExist === undefined) {
|
|
174
|
+
throw new Error(`ClientActionResource: No client action exists for the ID '${id}'.`);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
133
178
|
toObject() {
|
|
134
179
|
const clientActionsObj = this.clientActions.toObject();
|
|
135
180
|
return {
|
package/es/platform/client-actions/behaviour/zclient-actions/domain/entities/UIComponentMapping.js
CHANGED
|
@@ -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
|
+
}
|
|
@@ -10,7 +10,7 @@ export default class PropertiesChangeUseCase extends AbstractUseCase {
|
|
|
10
10
|
currentActions,
|
|
11
11
|
previousActions
|
|
12
12
|
} = input;
|
|
13
|
-
actionLocation.processActionsChange(
|
|
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
|
|
29
|
+
const eventMappingPayload = eventMapping.payload;
|
|
29
30
|
const replacementContext = {
|
|
30
31
|
"@payload": payloadItems
|
|
31
32
|
};
|
|
32
|
-
const resolvedPayload = TemplateResolver.replaceContextVariablesInObject(
|
|
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
|
}
|
|
@@ -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
|
}
|
|
@@ -15,8 +15,8 @@ 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
|
-
import { i18NProviderUtils } from '@zohodesk/i18n';
|
|
20
20
|
const {
|
|
21
21
|
TABLE_LIST_RESIZE_START_REQUESTED,
|
|
22
22
|
TABLE_LIST_RESIZE_MOVE_REQUESTED,
|
|
@@ -35,9 +35,7 @@ function createHandlerWithSdk(handler) {
|
|
|
35
35
|
platformSDK
|
|
36
36
|
}, ListSdkFactory.create({
|
|
37
37
|
instanceName
|
|
38
|
-
})
|
|
39
|
-
i18n: i18NProviderUtils.getI18NValue
|
|
40
|
-
});
|
|
38
|
+
}));
|
|
41
39
|
};
|
|
42
40
|
}
|
|
43
41
|
|
|
@@ -100,7 +98,20 @@ export default class EventHandlersFactory {
|
|
|
100
98
|
payload: action.payload
|
|
101
99
|
});
|
|
102
100
|
},
|
|
103
|
-
[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
|
+
}
|
|
104
115
|
};
|
|
105
116
|
return mergeEventHandlers([defaultEventHandlers, ErrorEventHandlersFactory.create(), wrapped]);
|
|
106
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) {
|
|
@@ -5,7 +5,6 @@ import { DestructResourceInstanceUseCase } from "../../application/usecases/Dest
|
|
|
5
5
|
import { GetResourceInstanceUseCase } from "../../application/usecases/GetResourceInstanceUseCase";
|
|
6
6
|
import { RegisterResourceUseCase } from "../../application/usecases/RegisterResourceUseCase";
|
|
7
7
|
import { SyncStateWithResourceUseCase } from "../../application/usecases/SyncStateWithResourceUseCase";
|
|
8
|
-
import GetResourcesUseCase from "../../application/usecases/GetResourcesUseCase";
|
|
9
8
|
export class Service {
|
|
10
9
|
constructor(dependencies) {
|
|
11
10
|
_defineProperty(this, "createResourceInstanceUseCase", void 0);
|
|
@@ -18,14 +17,11 @@ export class Service {
|
|
|
18
17
|
|
|
19
18
|
_defineProperty(this, "getResourceInstanceUseCase", void 0);
|
|
20
19
|
|
|
21
|
-
_defineProperty(this, "getResourcesUseCase", void 0);
|
|
22
|
-
|
|
23
20
|
this.createResourceInstanceUseCase = new CreateResourceInstanceUseCase(dependencies);
|
|
24
21
|
this.destructResourceInstanceUseCase = new DestructResourceInstanceUseCase(dependencies);
|
|
25
22
|
this.syncStateWithResourceUseCase = new SyncStateWithResourceUseCase(dependencies);
|
|
26
23
|
this.registerResourceUseCase = new RegisterResourceUseCase(dependencies);
|
|
27
24
|
this.getResourceInstanceUseCase = new GetResourceInstanceUseCase(dependencies);
|
|
28
|
-
this.getResourcesUseCase = new GetResourcesUseCase(dependencies);
|
|
29
25
|
}
|
|
30
26
|
|
|
31
27
|
}
|
|
@@ -15,10 +15,6 @@ export class ResourceManager {
|
|
|
15
15
|
return ((_resourceInstances$re = resourceInstances[resourceName]) === null || _resourceInstances$re === void 0 ? void 0 : _resourceInstances$re[instanceName]) || null;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
getResources() {
|
|
19
|
-
return this.resources;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
18
|
createResourceInstance(resourceName, instanceName) {
|
|
23
19
|
const {
|
|
24
20
|
resourceInstances,
|
|
@@ -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
|
};
|
|
@@ -68,14 +68,5 @@ export class SdkManager {
|
|
|
68
68
|
return this.presentedData;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
getResources() {
|
|
72
|
-
const {
|
|
73
|
-
getResourcesUseCase
|
|
74
|
-
} = this.service;
|
|
75
|
-
getResourcesUseCase.updateDependencies(this.state, this.setPresentedData);
|
|
76
|
-
getResourcesUseCase.execute({});
|
|
77
|
-
return this.presentedData;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
71
|
}
|
|
81
72
|
export const sdkRegistry = new SdkManager();
|
|
@@ -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
|
|
|
@@ -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(
|
|
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;
|
|
@@ -18,7 +18,7 @@ const fallbackToDefault = (value, defaultValue) => [undefined, null].includes(va
|
|
|
18
18
|
|
|
19
19
|
export default class TableTranslator {
|
|
20
20
|
static transformState(state) {
|
|
21
|
-
var _localStorageBehaviou, _localStorageBehaviou2;
|
|
21
|
+
var _preferences$rowActio, _localStorageBehaviou, _localStorageBehaviou2;
|
|
22
22
|
|
|
23
23
|
const {
|
|
24
24
|
behaviours,
|
|
@@ -92,6 +92,7 @@ export default class TableTranslator {
|
|
|
92
92
|
} = mapClientActions(newClientActions || EMPTY_ARRAY);
|
|
93
93
|
const isRowClickable = noLocation.some(action => action.uiComponentMapping.eventMappings.some(mapping => mapping.sourceEvent === TableListConstants.TABLE_LIST_ROW_CLICKED));
|
|
94
94
|
const rowCursor = isRowClickable ? RowCursor.Pointer : RowCursor.Default;
|
|
95
|
+
const rowActionsWidth = preferences === null || preferences === void 0 ? void 0 : (_preferences$rowActio = preferences.rowActions) === null || _preferences$rowActio === void 0 ? void 0 : _preferences$rowActio.width;
|
|
95
96
|
const {
|
|
96
97
|
moduleName,
|
|
97
98
|
viewId
|
|
@@ -126,7 +127,7 @@ export default class TableTranslator {
|
|
|
126
127
|
rowActionsConfig: {
|
|
127
128
|
hasActions: Boolean(rowActions === null || rowActions === void 0 ? void 0 : rowActions.length),
|
|
128
129
|
// Boolean(newRowActions?.length),
|
|
129
|
-
columnWidth: ColumnWidth.XSmall
|
|
130
|
+
columnWidth: typeof rowActionsWidth === 'number' ? rowActionsWidth : ColumnWidth.XSmall
|
|
130
131
|
},
|
|
131
132
|
keyboardControlsConfig,
|
|
132
133
|
isLoading,
|
|
@@ -30,8 +30,11 @@ class RecordSuccessCallbackUsecase extends AbstractUseCase {
|
|
|
30
30
|
type: SET_RECORDS,
|
|
31
31
|
payload: {
|
|
32
32
|
records: reordered
|
|
33
|
+
},
|
|
34
|
+
metaData: {
|
|
35
|
+
isReOrder: true
|
|
33
36
|
}
|
|
34
|
-
});
|
|
37
|
+
}); // dispatch({ type: "SMART_TABLE#RECORD_REORDER_SUCCESSED", payload: { records: reordered } });
|
|
35
38
|
}
|
|
36
39
|
|
|
37
40
|
if (list.isAcknowledgeBySortBy(metaData)) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RECORD_EXECUTE, RECORD_FETCH_MORE, RECORD_REFETCH, RecordApiActionName } from "../../../../bc/zrecord/Constants";
|
|
2
2
|
import { FIELD_EXECUTE, FIELD_REFETCH } from "../../../../bc/zfield/Constants";
|
|
3
|
-
import { ZLIST_RECORD_DELETE_SUCCEEDED, ZLIST_RECORD_UPDATE_SUCCEEDED } from "../../../../bc/zlist/Constants";
|
|
3
|
+
import { CLIENT_ACTION_TABLE_LIST_COMPONENT_NAME, ZLIST_RECORD_DELETE_SUCCEEDED, ZLIST_RECORD_UPDATE_SUCCEEDED } from "../../../../bc/zlist/Constants";
|
|
4
4
|
import { CLIENTACTION_BEHAVIOUR_EXECUTE } from "../../../client-actions/bc/zclient-actions/Constants";
|
|
5
5
|
import { SmartTableConstants } from "../../../../cc/table-connected";
|
|
6
6
|
import SortBy from "./SortBy";
|
|
@@ -184,14 +184,18 @@ class List {
|
|
|
184
184
|
getDeleteSuccessAction(recordIds) {
|
|
185
185
|
return {
|
|
186
186
|
type: SmartTableConstants.Events.DELETE_RECORDS_SUCCESS,
|
|
187
|
-
payload:
|
|
187
|
+
payload: {
|
|
188
|
+
recordIds: [recordIds]
|
|
189
|
+
}
|
|
188
190
|
};
|
|
189
191
|
}
|
|
190
192
|
|
|
191
193
|
getUpdateSuccessAction(recordId) {
|
|
192
194
|
return {
|
|
193
195
|
type: SmartTableConstants.Events.UPDATE_RECORDS_SUCCESS,
|
|
194
|
-
payload:
|
|
196
|
+
payload: {
|
|
197
|
+
recordId: recordId
|
|
198
|
+
}
|
|
195
199
|
};
|
|
196
200
|
}
|
|
197
201
|
|
|
@@ -316,6 +320,8 @@ class List {
|
|
|
316
320
|
|
|
317
321
|
createClientActionsFetchAction() {
|
|
318
322
|
const props = this.createApiProps();
|
|
323
|
+
props.components = CLIENT_ACTION_TABLE_LIST_COMPONENT_NAME;
|
|
324
|
+
props.modules = props.moduleName;
|
|
319
325
|
return {
|
|
320
326
|
type: CLIENTACTION_BEHAVIOUR_EXECUTE,
|
|
321
327
|
payload: {
|
|
@@ -8,10 +8,12 @@ export default class SetRecordsController {
|
|
|
8
8
|
const {
|
|
9
9
|
state,
|
|
10
10
|
updateState,
|
|
11
|
-
action
|
|
11
|
+
action,
|
|
12
|
+
dispatch
|
|
12
13
|
} = event;
|
|
13
14
|
const {
|
|
14
|
-
payload
|
|
15
|
+
payload,
|
|
16
|
+
metaData
|
|
15
17
|
} = action;
|
|
16
18
|
const {
|
|
17
19
|
records
|
|
@@ -21,7 +23,9 @@ export default class SetRecordsController {
|
|
|
21
23
|
} = this.service;
|
|
22
24
|
setRecordsUseCase.updateDependency(state, updateState);
|
|
23
25
|
setRecordsUseCase.execute({
|
|
24
|
-
records
|
|
26
|
+
records,
|
|
27
|
+
metaData,
|
|
28
|
+
dispatch
|
|
25
29
|
});
|
|
26
30
|
});
|
|
27
31
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import AbstractUseCase from "./AbstractUseCase";
|
|
2
2
|
import RecordFactory from "../entities-factory/RecordFactory";
|
|
3
|
+
import { SET_RECORDS_SUCCESS } from "../../../../bc/zrecord/Constants";
|
|
3
4
|
|
|
4
5
|
class SetRecordsUseCase extends AbstractUseCase {
|
|
5
6
|
execute(input) {
|
|
@@ -8,12 +9,21 @@ class SetRecordsUseCase extends AbstractUseCase {
|
|
|
8
9
|
repository
|
|
9
10
|
} = this.dependencies;
|
|
10
11
|
const {
|
|
11
|
-
records
|
|
12
|
+
records,
|
|
13
|
+
metaData,
|
|
14
|
+
dispatch
|
|
12
15
|
} = input;
|
|
13
16
|
const recordManager = repository.getRecordsManagerEntity();
|
|
14
17
|
const recordsEntity = RecordFactory.createMultipleRecords(records);
|
|
15
18
|
recordManager.setRecords(recordsEntity);
|
|
16
19
|
presenter.updateRecord(recordManager.toObject());
|
|
20
|
+
dispatch({
|
|
21
|
+
type: SET_RECORDS_SUCCESS,
|
|
22
|
+
metaData,
|
|
23
|
+
payload: {
|
|
24
|
+
records
|
|
25
|
+
}
|
|
26
|
+
});
|
|
17
27
|
}
|
|
18
28
|
|
|
19
29
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zohodesk/library-platform",
|
|
3
|
-
"version": "1.1.7-exp.
|
|
3
|
+
"version": "1.1.7-exp.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "es/index.js",
|
|
6
6
|
"files": [
|
|
@@ -73,6 +73,7 @@
|
|
|
73
73
|
"jsep": "^0.3.5",
|
|
74
74
|
"prettier": "3.3.3",
|
|
75
75
|
"react-sortable-hoc": "1.11.0",
|
|
76
|
+
"stylelint-config-standard": "^38.0.0",
|
|
76
77
|
"ts-jest": "29.2.6",
|
|
77
78
|
"typescript": "4.9.5"
|
|
78
79
|
},
|
|
@@ -1,46 +0,0 @@
|
|
|
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 { sdkRegistry } from "../sdk/frameworks/SdkRegistry";
|
|
4
|
-
|
|
5
|
-
class AbstractPageResource {
|
|
6
|
-
constructor() {
|
|
7
|
-
_defineProperty(this, "dependencies", void 0);
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
initialize() {// Initialization logic for the page resource
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
updateDependencies(dependencies) {
|
|
14
|
-
this.dependencies = dependencies;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
destroy() {// Cleanup logic for the page resource
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
class PageResource extends AbstractPageResource {
|
|
23
|
-
constructor(instanceName) {
|
|
24
|
-
super();
|
|
25
|
-
this.instanceName = instanceName;
|
|
26
|
-
} // Implement methods to interact with the page resource
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
getInstanceName() {
|
|
30
|
-
return this.instanceName;
|
|
31
|
-
} // Add more methods as needed for page resource management
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export function initializePageSdk() {
|
|
37
|
-
sdkRegistry.registerResource({
|
|
38
|
-
resourceName: 'page',
|
|
39
|
-
resource: PageResource
|
|
40
|
-
});
|
|
41
|
-
sdkRegistry.createResourceInstance({
|
|
42
|
-
resourceName: 'page',
|
|
43
|
-
instanceName: 'module'
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
export { PageResource };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { AbstractUseCase } from "./AbstractUseCase";
|
|
2
|
-
|
|
3
|
-
class GetResourcesUseCase extends AbstractUseCase {
|
|
4
|
-
execute() {
|
|
5
|
-
const {
|
|
6
|
-
repository,
|
|
7
|
-
presenter
|
|
8
|
-
} = this.dependencies;
|
|
9
|
-
const resourceManger = repository.getResourceManager();
|
|
10
|
-
presenter.presentData(resourceManger.getResources());
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export default GetResourcesUseCase;
|