@reltio/components 1.4.1306 → 1.4.1308
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/cjs/hooks/useAPI/useAPI.js +19 -8
- package/esm/hooks/useAPI/useAPI.js +19 -8
- package/package.json +3 -3
|
@@ -71,8 +71,10 @@ var useAPI = function (config) {
|
|
|
71
71
|
var workflowPath = react_redux_1.useSelector(mdm_module_1.default.selectors.getWorkflowPath);
|
|
72
72
|
var user = react_redux_1.useSelector(mdm_module_1.default.selectors.getUser);
|
|
73
73
|
var entityUri = react_redux_1.useSelector(mdm_module_1.default.selectors.getEntityUri);
|
|
74
|
+
var isEditableMode = react_redux_1.useSelector(mdm_module_1.default.selectors.getIsEditableMode);
|
|
74
75
|
var environment = react_redux_1.useSelector(mdm_module_1.default.selectors.getWorkflowEnvironmentUrl);
|
|
75
76
|
var _k = react_redux_1.useSelector(mdm_module_1.default.selectors.getSearchProviderData) || {}, typeSearch = _k.type, search = _k.data;
|
|
77
|
+
var searchQuery = typeSearch === 'search' ? search === null || search === void 0 ? void 0 : search.query : null;
|
|
76
78
|
var isOldUI = !helpers_1.isNewUI(servicesPath);
|
|
77
79
|
var supportedInterceptHandlers = isOldUI ? qxApi.interceptors : interceptHandlers;
|
|
78
80
|
var openSearch = function (search) { return dispatch(mdm_module_1.ui.actions.openSearch(search)); };
|
|
@@ -170,7 +172,7 @@ var useAPI = function (config) {
|
|
|
170
172
|
workflowPath: workflowPath,
|
|
171
173
|
entity: entity,
|
|
172
174
|
entityUri: entityUri,
|
|
173
|
-
environment: environment, query:
|
|
175
|
+
environment: environment, query: searchQuery, openSearch: openSearch,
|
|
174
176
|
workflowCheckPermission: workflowCheckPermission }, qxApi));
|
|
175
177
|
}
|
|
176
178
|
else {
|
|
@@ -226,11 +228,25 @@ var useAPI = function (config) {
|
|
|
226
228
|
workerRef: workerRef,
|
|
227
229
|
setResponseListeners: setResponseListeners
|
|
228
230
|
});
|
|
231
|
+
var postEventMessage = function (type, data) {
|
|
232
|
+
var _a;
|
|
233
|
+
(_a = workerRef.current) === null || _a === void 0 ? void 0 : _a.postMessage({ action: 'event', type: type, data: data });
|
|
234
|
+
};
|
|
229
235
|
react_1.useEffect(function () {
|
|
230
236
|
if (!mdm_sdk_1.isEmptyValue(config.action) && config.action.platform !== mdm_sdk_1.CustomScriptPlatform.CLASSIC) {
|
|
231
237
|
workerRef.current = mdm_sdk_1.initializeWebWorker(workerUrl, process, config);
|
|
238
|
+
postEventMessage('updateEntity', entity);
|
|
232
239
|
}
|
|
233
|
-
}, [entity]);
|
|
240
|
+
}, [entity, config]);
|
|
241
|
+
react_1.useEffect(function () {
|
|
242
|
+
postEventMessage('editMode', isEditableMode);
|
|
243
|
+
}, [isEditableMode]);
|
|
244
|
+
react_1.useEffect(function () {
|
|
245
|
+
postEventMessage('changeSearchQuery', searchQuery);
|
|
246
|
+
}, [searchQuery]);
|
|
247
|
+
react_1.useEffect(function () {
|
|
248
|
+
postEventMessage('changeVisibility', visible);
|
|
249
|
+
}, [visible]);
|
|
234
250
|
react_1.useEffect(function () { return function () {
|
|
235
251
|
listenersToReset.forEach(function (listener) { return listener(); });
|
|
236
252
|
}; }, [listenersToReset]);
|
|
@@ -239,12 +255,7 @@ var useAPI = function (config) {
|
|
|
239
255
|
popupListenersToReset.forEach(function (listener) { return listener(); });
|
|
240
256
|
}; }, [popupListenersToReset, listenersToReset]);
|
|
241
257
|
var onClick = react_1.useCallback(function () {
|
|
242
|
-
|
|
243
|
-
(_a = workerRef.current) === null || _a === void 0 ? void 0 : _a.postMessage({
|
|
244
|
-
action: 'event',
|
|
245
|
-
type: 'execute',
|
|
246
|
-
data: null
|
|
247
|
-
});
|
|
258
|
+
postEventMessage('execute', null);
|
|
248
259
|
}, [config]);
|
|
249
260
|
react_1.useEffect(function () {
|
|
250
261
|
var _a, _b, _c, _d;
|
|
@@ -49,8 +49,10 @@ export var useAPI = function (config) {
|
|
|
49
49
|
var workflowPath = useSelector(mdmModule.selectors.getWorkflowPath);
|
|
50
50
|
var user = useSelector(mdmModule.selectors.getUser);
|
|
51
51
|
var entityUri = useSelector(mdmModule.selectors.getEntityUri);
|
|
52
|
+
var isEditableMode = useSelector(mdmModule.selectors.getIsEditableMode);
|
|
52
53
|
var environment = useSelector(mdmModule.selectors.getWorkflowEnvironmentUrl);
|
|
53
54
|
var _k = useSelector(mdmModule.selectors.getSearchProviderData) || {}, typeSearch = _k.type, search = _k.data;
|
|
55
|
+
var searchQuery = typeSearch === 'search' ? search === null || search === void 0 ? void 0 : search.query : null;
|
|
54
56
|
var isOldUI = !isNewUI(servicesPath);
|
|
55
57
|
var supportedInterceptHandlers = isOldUI ? qxApi.interceptors : interceptHandlers;
|
|
56
58
|
var openSearch = function (search) { return dispatch(ui.actions.openSearch(search)); };
|
|
@@ -148,7 +150,7 @@ export var useAPI = function (config) {
|
|
|
148
150
|
workflowPath: workflowPath,
|
|
149
151
|
entity: entity,
|
|
150
152
|
entityUri: entityUri,
|
|
151
|
-
environment: environment, query:
|
|
153
|
+
environment: environment, query: searchQuery, openSearch: openSearch,
|
|
152
154
|
workflowCheckPermission: workflowCheckPermission }, qxApi));
|
|
153
155
|
}
|
|
154
156
|
else {
|
|
@@ -204,11 +206,25 @@ export var useAPI = function (config) {
|
|
|
204
206
|
workerRef: workerRef,
|
|
205
207
|
setResponseListeners: setResponseListeners
|
|
206
208
|
});
|
|
209
|
+
var postEventMessage = function (type, data) {
|
|
210
|
+
var _a;
|
|
211
|
+
(_a = workerRef.current) === null || _a === void 0 ? void 0 : _a.postMessage({ action: 'event', type: type, data: data });
|
|
212
|
+
};
|
|
207
213
|
useEffect(function () {
|
|
208
214
|
if (!isEmptyValue(config.action) && config.action.platform !== CustomScriptPlatform.CLASSIC) {
|
|
209
215
|
workerRef.current = initializeWebWorker(workerUrl, process, config);
|
|
216
|
+
postEventMessage('updateEntity', entity);
|
|
210
217
|
}
|
|
211
|
-
}, [entity]);
|
|
218
|
+
}, [entity, config]);
|
|
219
|
+
useEffect(function () {
|
|
220
|
+
postEventMessage('editMode', isEditableMode);
|
|
221
|
+
}, [isEditableMode]);
|
|
222
|
+
useEffect(function () {
|
|
223
|
+
postEventMessage('changeSearchQuery', searchQuery);
|
|
224
|
+
}, [searchQuery]);
|
|
225
|
+
useEffect(function () {
|
|
226
|
+
postEventMessage('changeVisibility', visible);
|
|
227
|
+
}, [visible]);
|
|
212
228
|
useEffect(function () { return function () {
|
|
213
229
|
listenersToReset.forEach(function (listener) { return listener(); });
|
|
214
230
|
}; }, [listenersToReset]);
|
|
@@ -217,12 +233,7 @@ export var useAPI = function (config) {
|
|
|
217
233
|
popupListenersToReset.forEach(function (listener) { return listener(); });
|
|
218
234
|
}; }, [popupListenersToReset, listenersToReset]);
|
|
219
235
|
var onClick = useCallback(function () {
|
|
220
|
-
|
|
221
|
-
(_a = workerRef.current) === null || _a === void 0 ? void 0 : _a.postMessage({
|
|
222
|
-
action: 'event',
|
|
223
|
-
type: 'execute',
|
|
224
|
-
data: null
|
|
225
|
-
});
|
|
236
|
+
postEventMessage('execute', null);
|
|
226
237
|
}, [config]);
|
|
227
238
|
useEffect(function () {
|
|
228
239
|
var _a, _b, _c, _d;
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reltio/components",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.1308",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE FILE",
|
|
5
5
|
"main": "./cjs/index.js",
|
|
6
6
|
"module": "./esm/index.js",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@date-io/moment": "^1.3.5",
|
|
9
9
|
"@react-google-maps/api": "2.7.0",
|
|
10
|
-
"@reltio/mdm-module": "^1.4.
|
|
11
|
-
"@reltio/mdm-sdk": "^1.4.
|
|
10
|
+
"@reltio/mdm-module": "^1.4.1308",
|
|
11
|
+
"@reltio/mdm-sdk": "^1.4.1308",
|
|
12
12
|
"classnames": "^2.2.5",
|
|
13
13
|
"d3-cloud": "^1.2.5",
|
|
14
14
|
"d3-geo": "^2.0.1",
|