@reltio/components 1.4.1126 → 1.4.1130

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 (71) hide show
  1. package/cjs/components/InternalLink/InternalLink.d.ts +3 -0
  2. package/cjs/components/InternalLink/InternalLink.js +39 -0
  3. package/cjs/components/InternalLink/styles.d.ts +1 -0
  4. package/cjs/components/InternalLink/styles.js +10 -0
  5. package/cjs/components/VerticalHeadingsTable/TableCell/TableCell.js +2 -1
  6. package/cjs/components/VerticalHeadingsTable/TableCellWithDnd/TableCellWithDnd.js +2 -1
  7. package/cjs/components/VerticalHeadingsTable/TableRow/TableRow.js +1 -1
  8. package/cjs/components/VerticalHeadingsTable/TableRowWithDnd/TableRowWithDnd.js +1 -1
  9. package/cjs/components/VerticalHeadingsTable/VerticalHeadingsTable.js +4 -3
  10. package/cjs/components/attributes/editMode/AttributesFactory/AttributesFactory.js +1 -1
  11. package/cjs/components/attributes/editMode/ComplexAttribute/ComplexAttribute.d.ts +3 -1
  12. package/cjs/components/attributes/editMode/ComplexAttribute/ComplexAttribute.js +6 -2
  13. package/cjs/components/attributes/editMode/NestedAttribute/NestedAttribute.d.ts +1 -0
  14. package/cjs/components/attributes/editMode/ReferenceAttribute/ReferenceAttribute.d.ts +1 -0
  15. package/cjs/components/attributes/editMode/ReferenceAttribute/index.d.ts +1 -0
  16. package/cjs/components/attributes/inline/ReferenceAttribute/ReferenceAttribute.js +2 -1
  17. package/cjs/components/attributes/inline/ReferenceAttribute/styles.d.ts +1 -1
  18. package/cjs/components/attributes/inline/ReferenceAttribute/styles.js +0 -4
  19. package/cjs/components/attributes/readMode/AttributeValuesBlock/AttributeValuesBlock.d.ts +5 -1
  20. package/cjs/components/attributes/readMode/AttributeValuesBlock/AttributeValuesBlock.js +2 -2
  21. package/cjs/components/attributes/readMode/AttributesPager/SpecialRenderer.js +1 -1
  22. package/cjs/components/attributes/readMode/ComplexAttribute/ComplexAttribute.d.ts +3 -1
  23. package/cjs/components/attributes/readMode/ComplexAttribute/ComplexAttribute.js +25 -15
  24. package/cjs/components/attributes/readMode/NestedAttribute/NestedAttribute.d.ts +1 -0
  25. package/cjs/components/attributes/readMode/ReferenceAttribute/ReferenceAttribute.d.ts +1 -0
  26. package/cjs/components/attributes/readMode/ReferenceAttribute/ReferenceAttribute.js +2 -2
  27. package/cjs/components/attributes/readMode/ReferenceAttribute/index.d.ts +1 -0
  28. package/cjs/components/attributes/readMode/ReferenceAttribute/styles.d.ts +1 -1
  29. package/cjs/components/attributes/readMode/ReferenceAttribute/styles.js +0 -4
  30. package/cjs/components/attributes/readMode/SpecialAttributes/Tags/Tag.js +2 -2
  31. package/cjs/hooks/useAPI/API.js +3 -3
  32. package/cjs/hooks/useAPI/types.d.ts +3 -1
  33. package/cjs/hooks/useAPI/types.js +1 -0
  34. package/cjs/hooks/useAPI/useAPI.d.ts +2 -1
  35. package/cjs/hooks/useAPI/useAPI.js +27 -16
  36. package/esm/components/InternalLink/InternalLink.d.ts +3 -0
  37. package/esm/components/InternalLink/InternalLink.js +34 -0
  38. package/esm/components/InternalLink/styles.d.ts +1 -0
  39. package/esm/components/InternalLink/styles.js +7 -0
  40. package/esm/components/VerticalHeadingsTable/TableCell/TableCell.js +2 -1
  41. package/esm/components/VerticalHeadingsTable/TableCellWithDnd/TableCellWithDnd.js +2 -1
  42. package/esm/components/VerticalHeadingsTable/TableRow/TableRow.js +1 -1
  43. package/esm/components/VerticalHeadingsTable/TableRowWithDnd/TableRowWithDnd.js +1 -1
  44. package/esm/components/VerticalHeadingsTable/VerticalHeadingsTable.js +4 -3
  45. package/esm/components/attributes/editMode/AttributesFactory/AttributesFactory.js +1 -1
  46. package/esm/components/attributes/editMode/ComplexAttribute/ComplexAttribute.d.ts +3 -1
  47. package/esm/components/attributes/editMode/ComplexAttribute/ComplexAttribute.js +6 -2
  48. package/esm/components/attributes/editMode/NestedAttribute/NestedAttribute.d.ts +1 -0
  49. package/esm/components/attributes/editMode/ReferenceAttribute/ReferenceAttribute.d.ts +1 -0
  50. package/esm/components/attributes/editMode/ReferenceAttribute/index.d.ts +1 -0
  51. package/esm/components/attributes/inline/ReferenceAttribute/ReferenceAttribute.js +2 -1
  52. package/esm/components/attributes/inline/ReferenceAttribute/styles.d.ts +1 -1
  53. package/esm/components/attributes/inline/ReferenceAttribute/styles.js +0 -4
  54. package/esm/components/attributes/readMode/AttributeValuesBlock/AttributeValuesBlock.d.ts +5 -1
  55. package/esm/components/attributes/readMode/AttributeValuesBlock/AttributeValuesBlock.js +2 -2
  56. package/esm/components/attributes/readMode/AttributesPager/SpecialRenderer.js +1 -1
  57. package/esm/components/attributes/readMode/ComplexAttribute/ComplexAttribute.d.ts +3 -1
  58. package/esm/components/attributes/readMode/ComplexAttribute/ComplexAttribute.js +26 -16
  59. package/esm/components/attributes/readMode/NestedAttribute/NestedAttribute.d.ts +1 -0
  60. package/esm/components/attributes/readMode/ReferenceAttribute/ReferenceAttribute.d.ts +1 -0
  61. package/esm/components/attributes/readMode/ReferenceAttribute/ReferenceAttribute.js +2 -2
  62. package/esm/components/attributes/readMode/ReferenceAttribute/index.d.ts +1 -0
  63. package/esm/components/attributes/readMode/ReferenceAttribute/styles.d.ts +1 -1
  64. package/esm/components/attributes/readMode/ReferenceAttribute/styles.js +0 -4
  65. package/esm/components/attributes/readMode/SpecialAttributes/Tags/Tag.js +2 -2
  66. package/esm/hooks/useAPI/API.js +3 -3
  67. package/esm/hooks/useAPI/types.d.ts +3 -1
  68. package/esm/hooks/useAPI/types.js +1 -0
  69. package/esm/hooks/useAPI/useAPI.d.ts +2 -1
  70. package/esm/hooks/useAPI/useAPI.js +29 -18
  71. package/package.json +4 -3
@@ -9,23 +9,23 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
- import { useContext, useEffect, useState } from 'react';
12
+ import { useCallback, useContext, useEffect, useRef, useState } from 'react';
13
13
  import { useDispatch, useSelector } from 'react-redux';
14
14
  import mdmModule, { ui } from '@reltio/mdm-module';
15
- import { initializeWebWorker } from '@reltio/mdm-sdk';
15
+ import { initializeWebWorker, isEmptyValue } from '@reltio/mdm-sdk';
16
16
  import { useWorkflowCheckPermission } from '../../components/workflow';
17
17
  import { SandboxAPIContext } from '../../contexts';
18
18
  import { processRequest } from './API';
19
19
  import { getWorkerURL } from './helpers';
20
20
  import { CustomAction } from './types';
21
21
  export var useAPI = function (config) {
22
- var _a = config.action, files = _a.files, permissions = _a.permissions;
23
- var _b = useState(), html = _b[0], setHtml = _b[1];
24
- var _c = useState([]), listenersToReset = _c[0], setListenersToReset = _c[1];
25
- var _d = useState(true), visible = _d[0], setVisible = _d[1];
26
- var _e = useState(null), tooltip = _e[0], setTooltip = _e[1];
27
- var _f = useState(null), customStyles = _f[0], setCustomStyles = _f[1];
28
- var _g = useState(''), message = _g[0], setMessage = _g[1];
22
+ if (config === void 0) { config = {}; }
23
+ var _a = useState(), html = _a[0], setHtml = _a[1];
24
+ var _b = useState([]), listenersToReset = _b[0], setListenersToReset = _b[1];
25
+ var _c = useState(true), visible = _c[0], setVisible = _c[1];
26
+ var _d = useState(null), tooltip = _d[0], setTooltip = _d[1];
27
+ var _e = useState(null), customStyles = _e[0], setCustomStyles = _e[1];
28
+ var _f = useState(''), message = _f[0], setMessage = _f[1];
29
29
  var dispatch = useDispatch();
30
30
  var metadata = useSelector(mdmModule.selectors.getMetadata) || {};
31
31
  var entity = useSelector(mdmModule.selectors.getEntity) || {};
@@ -39,8 +39,9 @@ export var useAPI = function (config) {
39
39
  var environment = useSelector(mdmModule.selectors.getWorkflowEnvironmentUrl);
40
40
  var qxApi = useContext(SandboxAPIContext);
41
41
  var workflowCheckPermission = useWorkflowCheckPermission();
42
- var _h = useSelector(mdmModule.selectors.getSearchProviderData) || {}, typeSearch = _h.type, search = _h.data;
42
+ var _g = useSelector(mdmModule.selectors.getSearchProviderData) || {}, typeSearch = _g.type, search = _g.data;
43
43
  var openSearch = function (search) { return dispatch(ui.actions.openSearch(search)); };
44
+ var workerRef = useRef();
44
45
  var process = function (task, worker, innerText) {
45
46
  if (task) {
46
47
  var handlersToReset_1 = [];
@@ -134,8 +135,7 @@ export var useAPI = function (config) {
134
135
  break;
135
136
  }
136
137
  case CustomAction.REQUEST: {
137
- processRequest(__assign({ name: task.params.name, paramObject: task, permissions: permissions,
138
- worker: worker,
138
+ processRequest(__assign({ name: task.params.name, paramObject: task, permissions: config.action.permissions, worker: worker,
139
139
  metadata: metadata, config: config, user: user,
140
140
  apiPath: apiPath,
141
141
  tenant: tenant,
@@ -150,20 +150,31 @@ export var useAPI = function (config) {
150
150
  }
151
151
  };
152
152
  useEffect(function () {
153
- var worker = initializeWebWorker(workerUrl, files, process);
154
- return function () {
155
- worker.terminate();
156
- };
157
- }, []);
153
+ if (!isEmptyValue(config.action)) {
154
+ workerRef.current = initializeWebWorker(workerUrl, config.action.files, process);
155
+ return function () {
156
+ workerRef.current.terminate();
157
+ };
158
+ }
159
+ }, [config]);
158
160
  useEffect(function () { return function () {
159
161
  listenersToReset.forEach(function (listener) { return listener(); });
160
162
  }; }, [listenersToReset]);
163
+ var onClick = useCallback(function () {
164
+ var _a;
165
+ (_a = workerRef.current) === null || _a === void 0 ? void 0 : _a.postMessage({
166
+ action: 'event',
167
+ type: 'execute',
168
+ data: null
169
+ });
170
+ }, [config]);
161
171
  return {
162
172
  html: html,
163
173
  visible: visible,
164
174
  tooltip: tooltip,
165
175
  customStyles: customStyles,
166
176
  message: message,
167
- onClosePopup: function () { return setMessage(''); }
177
+ onClosePopup: function () { return setMessage(''); },
178
+ onClick: onClick
168
179
  };
169
180
  };
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@reltio/components",
3
- "version": "1.4.1126",
3
+ "version": "1.4.1130",
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.1126",
11
- "@reltio/mdm-sdk": "^1.4.1126",
10
+ "@reltio/mdm-module": "^1.4.1130",
11
+ "@reltio/mdm-sdk": "^1.4.1130",
12
12
  "classnames": "^2.2.5",
13
13
  "d3-cloud": "^1.2.5",
14
14
  "d3-geo": "^2.0.1",
@@ -29,6 +29,7 @@
29
29
  "react-number-format": "^4.3.0",
30
30
  "react-redux": "^7.2.3",
31
31
  "react-resize-detector": "^4.2.0",
32
+ "react-router-dom": "^6.2.1",
32
33
  "react-select": "^3.0.4",
33
34
  "react-simple-maps": "^2.3.0",
34
35
  "react-split-pane": "^0.1.89",