@reltio/components 1.4.1128 → 1.4.1131
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/components/attributes/editMode/AttributesFactory/AttributesFactory.js +1 -1
- package/cjs/components/attributes/editMode/ComplexAttribute/ComplexAttribute.d.ts +3 -1
- package/cjs/components/attributes/editMode/ComplexAttribute/ComplexAttribute.js +6 -2
- package/cjs/components/attributes/editMode/NestedAttribute/NestedAttribute.d.ts +1 -0
- package/cjs/components/attributes/editMode/ReferenceAttribute/ReferenceAttribute.d.ts +1 -0
- package/cjs/components/attributes/editMode/ReferenceAttribute/index.d.ts +1 -0
- package/cjs/components/attributes/readMode/NestedAttribute/NestedAttribute.d.ts +1 -0
- package/cjs/components/attributes/readMode/ReferenceAttribute/ReferenceAttribute.d.ts +1 -0
- package/cjs/components/attributes/readMode/ReferenceAttribute/index.d.ts +1 -0
- package/cjs/hooks/useAPI/API.js +3 -3
- package/cjs/hooks/useAPI/types.d.ts +3 -1
- package/cjs/hooks/useAPI/types.js +1 -0
- package/cjs/hooks/useAPI/useAPI.d.ts +2 -1
- package/cjs/hooks/useAPI/useAPI.js +27 -16
- package/esm/components/attributes/editMode/AttributesFactory/AttributesFactory.js +1 -1
- package/esm/components/attributes/editMode/ComplexAttribute/ComplexAttribute.d.ts +3 -1
- package/esm/components/attributes/editMode/ComplexAttribute/ComplexAttribute.js +6 -2
- package/esm/components/attributes/editMode/NestedAttribute/NestedAttribute.d.ts +1 -0
- package/esm/components/attributes/editMode/ReferenceAttribute/ReferenceAttribute.d.ts +1 -0
- package/esm/components/attributes/editMode/ReferenceAttribute/index.d.ts +1 -0
- package/esm/components/attributes/readMode/NestedAttribute/NestedAttribute.d.ts +1 -0
- package/esm/components/attributes/readMode/ReferenceAttribute/ReferenceAttribute.d.ts +1 -0
- package/esm/components/attributes/readMode/ReferenceAttribute/index.d.ts +1 -0
- package/esm/hooks/useAPI/API.js +3 -3
- package/esm/hooks/useAPI/types.d.ts +3 -1
- package/esm/hooks/useAPI/types.js +1 -0
- package/esm/hooks/useAPI/useAPI.d.ts +2 -1
- package/esm/hooks/useAPI/useAPI.js +29 -18
- package/package.json +3 -3
|
@@ -36,7 +36,7 @@ var EditModeAttributesFactory = /** @class */ (function () {
|
|
|
36
36
|
EditModeAttributesFactory.build = function (attributeType, props) {
|
|
37
37
|
if (props === void 0) { props = {}; }
|
|
38
38
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
39
|
-
var showEmptyEditors = props.showEmptyEditors, onAddAttributes = props.onAddAttributes, lazy = props.lazy, errors = props.errors, crosswalks = props.crosswalks, showNonOv = props.showNonOv, propsForSimpleAttribute = __rest(props, ["showEmptyEditors", "onAddAttributes", "lazy", "errors", "crosswalks", "showNonOv"]);
|
|
39
|
+
var showEmptyEditors = props.showEmptyEditors, onAddAttributes = props.onAddAttributes, lazy = props.lazy, errors = props.errors, crosswalks = props.crosswalks, showNonOv = props.showNonOv, expanded = props.expanded, propsForSimpleAttribute = __rest(props, ["showEmptyEditors", "onAddAttributes", "lazy", "errors", "crosswalks", "showNonOv", "expanded"]);
|
|
40
40
|
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
41
41
|
switch (attributeType.type) {
|
|
42
42
|
case mdm_sdk_1.DataTypes.TYPE_NESTED:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export default ComplexAttribute;
|
|
2
|
-
declare function ComplexAttribute({ label, attributeTypesList, attributeType, attributeValue, children, errors, ownError, mode, metadata, crosswalks, lazy, showEmptyEditors, onAddOneMore, onAddAttributes, onDeleteAttribute, onChangeAttribute, additionalControlsRenderer, hideDeleteButton, state, showNonOv }: {
|
|
2
|
+
declare function ComplexAttribute({ label, attributeTypesList, attributeType, attributeValue, children, errors, ownError, mode, metadata, crosswalks, lazy, showEmptyEditors, onAddOneMore, onAddAttributes, onDeleteAttribute, onChangeAttribute, additionalControlsRenderer, hideDeleteButton, state, showNonOv, expanded: expandedProp }: {
|
|
3
3
|
label: any;
|
|
4
4
|
attributeTypesList: any;
|
|
5
5
|
attributeType: any;
|
|
@@ -20,6 +20,7 @@ declare function ComplexAttribute({ label, attributeTypesList, attributeType, at
|
|
|
20
20
|
hideDeleteButton: any;
|
|
21
21
|
state: any;
|
|
22
22
|
showNonOv: any;
|
|
23
|
+
expanded?: boolean;
|
|
23
24
|
}): JSX.Element;
|
|
24
25
|
declare namespace ComplexAttribute {
|
|
25
26
|
const propTypes: {
|
|
@@ -130,6 +131,7 @@ declare namespace ComplexAttribute {
|
|
|
130
131
|
hideDeleteButton: PropTypes.Requireable<boolean>;
|
|
131
132
|
showNonOv: PropTypes.Requireable<boolean>;
|
|
132
133
|
state: PropTypes.Requireable<string>;
|
|
134
|
+
expanded: PropTypes.Requireable<boolean>;
|
|
133
135
|
label: PropTypes.Requireable<string>;
|
|
134
136
|
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
135
137
|
attributeTypesList: PropTypes.Requireable<PropTypes.InferProps<{
|
|
@@ -48,13 +48,17 @@ var AttributesList_1 = __importDefault(require("../AttributesList/AttributesList
|
|
|
48
48
|
var ArrowExpandButton_1 = __importDefault(require("../../../ArrowExpandButton/ArrowExpandButton"));
|
|
49
49
|
var ComplexAttribute = function (_a) {
|
|
50
50
|
var _b;
|
|
51
|
-
var label = _a.label, attributeTypesList = _a.attributeTypesList, attributeType = _a.attributeType, attributeValue = _a.attributeValue, children = _a.children, errors = _a.errors, ownError = _a.ownError, mode = _a.mode, metadata = _a.metadata, crosswalks = _a.crosswalks, lazy = _a.lazy, showEmptyEditors = _a.showEmptyEditors, onAddOneMore = _a.onAddOneMore, onAddAttributes = _a.onAddAttributes, onDeleteAttribute = _a.onDeleteAttribute, onChangeAttribute = _a.onChangeAttribute, additionalControlsRenderer = _a.additionalControlsRenderer, hideDeleteButton = _a.hideDeleteButton, state = _a.state, showNonOv = _a.showNonOv;
|
|
51
|
+
var label = _a.label, attributeTypesList = _a.attributeTypesList, attributeType = _a.attributeType, attributeValue = _a.attributeValue, children = _a.children, errors = _a.errors, ownError = _a.ownError, mode = _a.mode, metadata = _a.metadata, crosswalks = _a.crosswalks, lazy = _a.lazy, showEmptyEditors = _a.showEmptyEditors, onAddOneMore = _a.onAddOneMore, onAddAttributes = _a.onAddAttributes, onDeleteAttribute = _a.onDeleteAttribute, onChangeAttribute = _a.onChangeAttribute, additionalControlsRenderer = _a.additionalControlsRenderer, hideDeleteButton = _a.hideDeleteButton, state = _a.state, showNonOv = _a.showNonOv, _c = _a.expanded, expandedProp = _c === void 0 ? false : _c;
|
|
52
52
|
var styles = styles_1.useStyles();
|
|
53
53
|
var deleted = state === 'deleted';
|
|
54
54
|
var edited = state === 'edited';
|
|
55
55
|
var uri = attributeValue.uri;
|
|
56
56
|
var isNew = mdm_sdk_1.isTempUri(uri);
|
|
57
|
-
var
|
|
57
|
+
var defaultExpand = isNew || expandedProp;
|
|
58
|
+
var _d = react_1.useState(defaultExpand), expanded = _d[0], setExpanded = _d[1];
|
|
59
|
+
react_1.useEffect(function () {
|
|
60
|
+
setExpanded(defaultExpand);
|
|
61
|
+
}, [defaultExpand]);
|
|
58
62
|
var canDelete = react_1.useMemo(function () {
|
|
59
63
|
return mdm_sdk_1.checkCanDeleteAttribute({
|
|
60
64
|
attributeType: attributeType,
|
|
@@ -108,6 +108,7 @@ declare var _default: React.MemoExoticComponent<{
|
|
|
108
108
|
hideDeleteButton: import("prop-types").Requireable<boolean>;
|
|
109
109
|
showNonOv: import("prop-types").Requireable<boolean>;
|
|
110
110
|
state: import("prop-types").Requireable<string>;
|
|
111
|
+
expanded: import("prop-types").Requireable<boolean>;
|
|
111
112
|
attributeValue: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
112
113
|
value: import("prop-types").Requireable<object>;
|
|
113
114
|
ov: import("prop-types").Requireable<boolean>;
|
|
@@ -116,6 +116,7 @@ declare var _default: React.MemoExoticComponent<{
|
|
|
116
116
|
hideDeleteButton: PropTypes.Requireable<boolean>;
|
|
117
117
|
showNonOv: PropTypes.Requireable<boolean>;
|
|
118
118
|
state: PropTypes.Requireable<string>;
|
|
119
|
+
expanded: PropTypes.Requireable<boolean>;
|
|
119
120
|
attributeValue: PropTypes.Requireable<PropTypes.InferProps<{
|
|
120
121
|
refEntity: PropTypes.Requireable<object>;
|
|
121
122
|
refRelation: PropTypes.Requireable<object>;
|
|
@@ -117,6 +117,7 @@ declare var _default: import("react-redux").ConnectedComponent<import("react").M
|
|
|
117
117
|
hideDeleteButton: import("prop-types").Requireable<boolean>;
|
|
118
118
|
showNonOv: import("prop-types").Requireable<boolean>;
|
|
119
119
|
state: import("prop-types").Requireable<string>;
|
|
120
|
+
expanded: import("prop-types").Requireable<boolean>;
|
|
120
121
|
attributeValue: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
121
122
|
refEntity: import("prop-types").Requireable<object>;
|
|
122
123
|
refRelation: import("prop-types").Requireable<object>;
|
|
@@ -112,6 +112,7 @@ declare var _default: React.MemoExoticComponent<{
|
|
|
112
112
|
hideDeleteButton: import("prop-types").Requireable<boolean>;
|
|
113
113
|
showNonOv: import("prop-types").Requireable<boolean>;
|
|
114
114
|
state: import("prop-types").Requireable<string>;
|
|
115
|
+
expanded: import("prop-types").Requireable<boolean>;
|
|
115
116
|
attributeValue: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
116
117
|
value: import("prop-types").Requireable<object>;
|
|
117
118
|
ov: import("prop-types").Requireable<boolean>;
|
|
@@ -114,6 +114,7 @@ declare var _default: React.MemoExoticComponent<{
|
|
|
114
114
|
hideDeleteButton: import("prop-types").Requireable<boolean>;
|
|
115
115
|
showNonOv: import("prop-types").Requireable<boolean>;
|
|
116
116
|
state: import("prop-types").Requireable<string>;
|
|
117
|
+
expanded: import("prop-types").Requireable<boolean>;
|
|
117
118
|
attributeValue: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
118
119
|
refEntity: import("prop-types").Requireable<object>;
|
|
119
120
|
refRelation: import("prop-types").Requireable<object>;
|
|
@@ -115,6 +115,7 @@ declare var _default: import("react-redux").ConnectedComponent<import("react").M
|
|
|
115
115
|
hideDeleteButton: import("prop-types").Requireable<boolean>;
|
|
116
116
|
showNonOv: import("prop-types").Requireable<boolean>;
|
|
117
117
|
state: import("prop-types").Requireable<string>;
|
|
118
|
+
expanded: import("prop-types").Requireable<boolean>;
|
|
118
119
|
attributeValue: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
119
120
|
refEntity: import("prop-types").Requireable<object>;
|
|
120
121
|
refRelation: import("prop-types").Requireable<object>;
|
package/cjs/hooks/useAPI/API.js
CHANGED
|
@@ -181,15 +181,15 @@ var processRequest = function (_a) {
|
|
|
181
181
|
break;
|
|
182
182
|
}
|
|
183
183
|
case types_1.RequestAction.ALERT: {
|
|
184
|
-
window.alert(paramObject.params.text);
|
|
184
|
+
worker.postMessage(__assign({ action: 'response', result: window.alert(paramObject.params.text) }, paramObject.params));
|
|
185
185
|
break;
|
|
186
186
|
}
|
|
187
187
|
case types_1.RequestAction.CONFIRM: {
|
|
188
|
-
window.confirm(paramObject.params.text);
|
|
188
|
+
worker.postMessage(__assign({ action: 'response', result: window.confirm(paramObject.params.text) }, paramObject.params));
|
|
189
189
|
break;
|
|
190
190
|
}
|
|
191
191
|
case types_1.RequestAction.PROMPT: {
|
|
192
|
-
window.prompt(paramObject.params.text, paramObject.params.defaultText || '');
|
|
192
|
+
worker.postMessage(__assign({ action: 'response', result: window.prompt(paramObject.params.text, paramObject.params.defaultText || '') }, paramObject.params));
|
|
193
193
|
break;
|
|
194
194
|
}
|
|
195
195
|
case types_1.RequestAction.OPEN_WINDOW: {
|
|
@@ -41,6 +41,7 @@ export declare type Params = {
|
|
|
41
41
|
defaultText?: string;
|
|
42
42
|
text?: string;
|
|
43
43
|
html?: string;
|
|
44
|
+
type?: string;
|
|
44
45
|
};
|
|
45
46
|
export declare type ProcessRequestParams = {
|
|
46
47
|
name: RequestAction;
|
|
@@ -79,7 +80,8 @@ export declare enum CustomAction {
|
|
|
79
80
|
SET_WIDTH = "setWidth",
|
|
80
81
|
RETURN_PROCESSED_API_RESPONSE = "returnProcessedApiResponse",
|
|
81
82
|
RETURN_PROCESSED_API_REQUEST = "returnProcessedApiRequest",
|
|
82
|
-
REQUEST = "request"
|
|
83
|
+
REQUEST = "request",
|
|
84
|
+
EVENT = "event"
|
|
83
85
|
}
|
|
84
86
|
export declare type CustomActionTask = {
|
|
85
87
|
action: CustomAction;
|
|
@@ -39,4 +39,5 @@ var CustomAction;
|
|
|
39
39
|
CustomAction["RETURN_PROCESSED_API_RESPONSE"] = "returnProcessedApiResponse";
|
|
40
40
|
CustomAction["RETURN_PROCESSED_API_REQUEST"] = "returnProcessedApiRequest";
|
|
41
41
|
CustomAction["REQUEST"] = "request";
|
|
42
|
+
CustomAction["EVENT"] = "event";
|
|
42
43
|
})(CustomAction = exports.CustomAction || (exports.CustomAction = {}));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CustomViewConfig } from '@reltio/mdm-sdk';
|
|
2
|
-
export declare const useAPI: (config
|
|
2
|
+
export declare const useAPI: (config?: CustomViewConfig) => {
|
|
3
3
|
html: HTMLElement;
|
|
4
4
|
visible: boolean;
|
|
5
5
|
tooltip: string;
|
|
@@ -10,4 +10,5 @@ export declare const useAPI: (config: CustomViewConfig) => {
|
|
|
10
10
|
};
|
|
11
11
|
message: string;
|
|
12
12
|
onClosePopup: () => void;
|
|
13
|
+
onClick: () => void;
|
|
13
14
|
};
|
|
@@ -41,13 +41,13 @@ var API_1 = require("./API");
|
|
|
41
41
|
var helpers_1 = require("./helpers");
|
|
42
42
|
var types_1 = require("./types");
|
|
43
43
|
var useAPI = function (config) {
|
|
44
|
-
|
|
45
|
-
var
|
|
46
|
-
var
|
|
47
|
-
var
|
|
48
|
-
var
|
|
49
|
-
var
|
|
50
|
-
var
|
|
44
|
+
if (config === void 0) { config = {}; }
|
|
45
|
+
var _a = react_1.useState(), html = _a[0], setHtml = _a[1];
|
|
46
|
+
var _b = react_1.useState([]), listenersToReset = _b[0], setListenersToReset = _b[1];
|
|
47
|
+
var _c = react_1.useState(true), visible = _c[0], setVisible = _c[1];
|
|
48
|
+
var _d = react_1.useState(null), tooltip = _d[0], setTooltip = _d[1];
|
|
49
|
+
var _e = react_1.useState(null), customStyles = _e[0], setCustomStyles = _e[1];
|
|
50
|
+
var _f = react_1.useState(''), message = _f[0], setMessage = _f[1];
|
|
51
51
|
var dispatch = react_redux_1.useDispatch();
|
|
52
52
|
var metadata = react_redux_1.useSelector(mdm_module_1.default.selectors.getMetadata) || {};
|
|
53
53
|
var entity = react_redux_1.useSelector(mdm_module_1.default.selectors.getEntity) || {};
|
|
@@ -61,8 +61,9 @@ var useAPI = function (config) {
|
|
|
61
61
|
var environment = react_redux_1.useSelector(mdm_module_1.default.selectors.getWorkflowEnvironmentUrl);
|
|
62
62
|
var qxApi = react_1.useContext(contexts_1.SandboxAPIContext);
|
|
63
63
|
var workflowCheckPermission = workflow_1.useWorkflowCheckPermission();
|
|
64
|
-
var
|
|
64
|
+
var _g = react_redux_1.useSelector(mdm_module_1.default.selectors.getSearchProviderData) || {}, typeSearch = _g.type, search = _g.data;
|
|
65
65
|
var openSearch = function (search) { return dispatch(mdm_module_1.ui.actions.openSearch(search)); };
|
|
66
|
+
var workerRef = react_1.useRef();
|
|
66
67
|
var process = function (task, worker, innerText) {
|
|
67
68
|
if (task) {
|
|
68
69
|
var handlersToReset_1 = [];
|
|
@@ -156,8 +157,7 @@ var useAPI = function (config) {
|
|
|
156
157
|
break;
|
|
157
158
|
}
|
|
158
159
|
case types_1.CustomAction.REQUEST: {
|
|
159
|
-
API_1.processRequest(__assign({ name: task.params.name, paramObject: task, permissions: permissions,
|
|
160
|
-
worker: worker,
|
|
160
|
+
API_1.processRequest(__assign({ name: task.params.name, paramObject: task, permissions: config.action.permissions, worker: worker,
|
|
161
161
|
metadata: metadata, config: config, user: user,
|
|
162
162
|
apiPath: apiPath,
|
|
163
163
|
tenant: tenant,
|
|
@@ -172,21 +172,32 @@ var useAPI = function (config) {
|
|
|
172
172
|
}
|
|
173
173
|
};
|
|
174
174
|
react_1.useEffect(function () {
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
175
|
+
if (!mdm_sdk_1.isEmptyValue(config.action)) {
|
|
176
|
+
workerRef.current = mdm_sdk_1.initializeWebWorker(workerUrl, config.action.files, process);
|
|
177
|
+
return function () {
|
|
178
|
+
workerRef.current.terminate();
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
}, [config]);
|
|
180
182
|
react_1.useEffect(function () { return function () {
|
|
181
183
|
listenersToReset.forEach(function (listener) { return listener(); });
|
|
182
184
|
}; }, [listenersToReset]);
|
|
185
|
+
var onClick = react_1.useCallback(function () {
|
|
186
|
+
var _a;
|
|
187
|
+
(_a = workerRef.current) === null || _a === void 0 ? void 0 : _a.postMessage({
|
|
188
|
+
action: 'event',
|
|
189
|
+
type: 'execute',
|
|
190
|
+
data: null
|
|
191
|
+
});
|
|
192
|
+
}, [config]);
|
|
183
193
|
return {
|
|
184
194
|
html: html,
|
|
185
195
|
visible: visible,
|
|
186
196
|
tooltip: tooltip,
|
|
187
197
|
customStyles: customStyles,
|
|
188
198
|
message: message,
|
|
189
|
-
onClosePopup: function () { return setMessage(''); }
|
|
199
|
+
onClosePopup: function () { return setMessage(''); },
|
|
200
|
+
onClick: onClick
|
|
190
201
|
};
|
|
191
202
|
};
|
|
192
203
|
exports.useAPI = useAPI;
|
|
@@ -31,7 +31,7 @@ var EditModeAttributesFactory = /** @class */ (function () {
|
|
|
31
31
|
EditModeAttributesFactory.build = function (attributeType, props) {
|
|
32
32
|
if (props === void 0) { props = {}; }
|
|
33
33
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
34
|
-
var showEmptyEditors = props.showEmptyEditors, onAddAttributes = props.onAddAttributes, lazy = props.lazy, errors = props.errors, crosswalks = props.crosswalks, showNonOv = props.showNonOv, propsForSimpleAttribute = __rest(props, ["showEmptyEditors", "onAddAttributes", "lazy", "errors", "crosswalks", "showNonOv"]);
|
|
34
|
+
var showEmptyEditors = props.showEmptyEditors, onAddAttributes = props.onAddAttributes, lazy = props.lazy, errors = props.errors, crosswalks = props.crosswalks, showNonOv = props.showNonOv, expanded = props.expanded, propsForSimpleAttribute = __rest(props, ["showEmptyEditors", "onAddAttributes", "lazy", "errors", "crosswalks", "showNonOv", "expanded"]);
|
|
35
35
|
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
36
36
|
switch (attributeType.type) {
|
|
37
37
|
case DataTypes.TYPE_NESTED:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export default ComplexAttribute;
|
|
2
|
-
declare function ComplexAttribute({ label, attributeTypesList, attributeType, attributeValue, children, errors, ownError, mode, metadata, crosswalks, lazy, showEmptyEditors, onAddOneMore, onAddAttributes, onDeleteAttribute, onChangeAttribute, additionalControlsRenderer, hideDeleteButton, state, showNonOv }: {
|
|
2
|
+
declare function ComplexAttribute({ label, attributeTypesList, attributeType, attributeValue, children, errors, ownError, mode, metadata, crosswalks, lazy, showEmptyEditors, onAddOneMore, onAddAttributes, onDeleteAttribute, onChangeAttribute, additionalControlsRenderer, hideDeleteButton, state, showNonOv, expanded: expandedProp }: {
|
|
3
3
|
label: any;
|
|
4
4
|
attributeTypesList: any;
|
|
5
5
|
attributeType: any;
|
|
@@ -20,6 +20,7 @@ declare function ComplexAttribute({ label, attributeTypesList, attributeType, at
|
|
|
20
20
|
hideDeleteButton: any;
|
|
21
21
|
state: any;
|
|
22
22
|
showNonOv: any;
|
|
23
|
+
expanded?: boolean;
|
|
23
24
|
}): JSX.Element;
|
|
24
25
|
declare namespace ComplexAttribute {
|
|
25
26
|
const propTypes: {
|
|
@@ -130,6 +131,7 @@ declare namespace ComplexAttribute {
|
|
|
130
131
|
hideDeleteButton: PropTypes.Requireable<boolean>;
|
|
131
132
|
showNonOv: PropTypes.Requireable<boolean>;
|
|
132
133
|
state: PropTypes.Requireable<string>;
|
|
134
|
+
expanded: PropTypes.Requireable<boolean>;
|
|
133
135
|
label: PropTypes.Requireable<string>;
|
|
134
136
|
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
135
137
|
attributeTypesList: PropTypes.Requireable<PropTypes.InferProps<{
|
|
@@ -24,13 +24,17 @@ import AttributesList from '../AttributesList/AttributesList';
|
|
|
24
24
|
import ArrowExpandButton from '../../../ArrowExpandButton/ArrowExpandButton';
|
|
25
25
|
var ComplexAttribute = function (_a) {
|
|
26
26
|
var _b;
|
|
27
|
-
var label = _a.label, attributeTypesList = _a.attributeTypesList, attributeType = _a.attributeType, attributeValue = _a.attributeValue, children = _a.children, errors = _a.errors, ownError = _a.ownError, mode = _a.mode, metadata = _a.metadata, crosswalks = _a.crosswalks, lazy = _a.lazy, showEmptyEditors = _a.showEmptyEditors, onAddOneMore = _a.onAddOneMore, onAddAttributes = _a.onAddAttributes, onDeleteAttribute = _a.onDeleteAttribute, onChangeAttribute = _a.onChangeAttribute, additionalControlsRenderer = _a.additionalControlsRenderer, hideDeleteButton = _a.hideDeleteButton, state = _a.state, showNonOv = _a.showNonOv;
|
|
27
|
+
var label = _a.label, attributeTypesList = _a.attributeTypesList, attributeType = _a.attributeType, attributeValue = _a.attributeValue, children = _a.children, errors = _a.errors, ownError = _a.ownError, mode = _a.mode, metadata = _a.metadata, crosswalks = _a.crosswalks, lazy = _a.lazy, showEmptyEditors = _a.showEmptyEditors, onAddOneMore = _a.onAddOneMore, onAddAttributes = _a.onAddAttributes, onDeleteAttribute = _a.onDeleteAttribute, onChangeAttribute = _a.onChangeAttribute, additionalControlsRenderer = _a.additionalControlsRenderer, hideDeleteButton = _a.hideDeleteButton, state = _a.state, showNonOv = _a.showNonOv, _c = _a.expanded, expandedProp = _c === void 0 ? false : _c;
|
|
28
28
|
var styles = useStyles();
|
|
29
29
|
var deleted = state === 'deleted';
|
|
30
30
|
var edited = state === 'edited';
|
|
31
31
|
var uri = attributeValue.uri;
|
|
32
32
|
var isNew = isTempUri(uri);
|
|
33
|
-
var
|
|
33
|
+
var defaultExpand = isNew || expandedProp;
|
|
34
|
+
var _d = useState(defaultExpand), expanded = _d[0], setExpanded = _d[1];
|
|
35
|
+
useEffect(function () {
|
|
36
|
+
setExpanded(defaultExpand);
|
|
37
|
+
}, [defaultExpand]);
|
|
34
38
|
var canDelete = useMemo(function () {
|
|
35
39
|
return checkCanDeleteAttribute({
|
|
36
40
|
attributeType: attributeType,
|
|
@@ -108,6 +108,7 @@ declare var _default: React.MemoExoticComponent<{
|
|
|
108
108
|
hideDeleteButton: import("prop-types").Requireable<boolean>;
|
|
109
109
|
showNonOv: import("prop-types").Requireable<boolean>;
|
|
110
110
|
state: import("prop-types").Requireable<string>;
|
|
111
|
+
expanded: import("prop-types").Requireable<boolean>;
|
|
111
112
|
attributeValue: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
112
113
|
value: import("prop-types").Requireable<object>;
|
|
113
114
|
ov: import("prop-types").Requireable<boolean>;
|
|
@@ -116,6 +116,7 @@ declare var _default: React.MemoExoticComponent<{
|
|
|
116
116
|
hideDeleteButton: PropTypes.Requireable<boolean>;
|
|
117
117
|
showNonOv: PropTypes.Requireable<boolean>;
|
|
118
118
|
state: PropTypes.Requireable<string>;
|
|
119
|
+
expanded: PropTypes.Requireable<boolean>;
|
|
119
120
|
attributeValue: PropTypes.Requireable<PropTypes.InferProps<{
|
|
120
121
|
refEntity: PropTypes.Requireable<object>;
|
|
121
122
|
refRelation: PropTypes.Requireable<object>;
|
|
@@ -117,6 +117,7 @@ declare var _default: import("react-redux").ConnectedComponent<import("react").M
|
|
|
117
117
|
hideDeleteButton: import("prop-types").Requireable<boolean>;
|
|
118
118
|
showNonOv: import("prop-types").Requireable<boolean>;
|
|
119
119
|
state: import("prop-types").Requireable<string>;
|
|
120
|
+
expanded: import("prop-types").Requireable<boolean>;
|
|
120
121
|
attributeValue: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
121
122
|
refEntity: import("prop-types").Requireable<object>;
|
|
122
123
|
refRelation: import("prop-types").Requireable<object>;
|
|
@@ -112,6 +112,7 @@ declare var _default: React.MemoExoticComponent<{
|
|
|
112
112
|
hideDeleteButton: import("prop-types").Requireable<boolean>;
|
|
113
113
|
showNonOv: import("prop-types").Requireable<boolean>;
|
|
114
114
|
state: import("prop-types").Requireable<string>;
|
|
115
|
+
expanded: import("prop-types").Requireable<boolean>;
|
|
115
116
|
attributeValue: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
116
117
|
value: import("prop-types").Requireable<object>;
|
|
117
118
|
ov: import("prop-types").Requireable<boolean>;
|
|
@@ -114,6 +114,7 @@ declare var _default: React.MemoExoticComponent<{
|
|
|
114
114
|
hideDeleteButton: import("prop-types").Requireable<boolean>;
|
|
115
115
|
showNonOv: import("prop-types").Requireable<boolean>;
|
|
116
116
|
state: import("prop-types").Requireable<string>;
|
|
117
|
+
expanded: import("prop-types").Requireable<boolean>;
|
|
117
118
|
attributeValue: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
118
119
|
refEntity: import("prop-types").Requireable<object>;
|
|
119
120
|
refRelation: import("prop-types").Requireable<object>;
|
|
@@ -115,6 +115,7 @@ declare var _default: import("react-redux").ConnectedComponent<import("react").M
|
|
|
115
115
|
hideDeleteButton: import("prop-types").Requireable<boolean>;
|
|
116
116
|
showNonOv: import("prop-types").Requireable<boolean>;
|
|
117
117
|
state: import("prop-types").Requireable<string>;
|
|
118
|
+
expanded: import("prop-types").Requireable<boolean>;
|
|
118
119
|
attributeValue: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
119
120
|
refEntity: import("prop-types").Requireable<object>;
|
|
120
121
|
refRelation: import("prop-types").Requireable<object>;
|
package/esm/hooks/useAPI/API.js
CHANGED
|
@@ -178,15 +178,15 @@ export var processRequest = function (_a) {
|
|
|
178
178
|
break;
|
|
179
179
|
}
|
|
180
180
|
case RequestAction.ALERT: {
|
|
181
|
-
window.alert(paramObject.params.text);
|
|
181
|
+
worker.postMessage(__assign({ action: 'response', result: window.alert(paramObject.params.text) }, paramObject.params));
|
|
182
182
|
break;
|
|
183
183
|
}
|
|
184
184
|
case RequestAction.CONFIRM: {
|
|
185
|
-
window.confirm(paramObject.params.text);
|
|
185
|
+
worker.postMessage(__assign({ action: 'response', result: window.confirm(paramObject.params.text) }, paramObject.params));
|
|
186
186
|
break;
|
|
187
187
|
}
|
|
188
188
|
case RequestAction.PROMPT: {
|
|
189
|
-
window.prompt(paramObject.params.text, paramObject.params.defaultText || '');
|
|
189
|
+
worker.postMessage(__assign({ action: 'response', result: window.prompt(paramObject.params.text, paramObject.params.defaultText || '') }, paramObject.params));
|
|
190
190
|
break;
|
|
191
191
|
}
|
|
192
192
|
case RequestAction.OPEN_WINDOW: {
|
|
@@ -41,6 +41,7 @@ export declare type Params = {
|
|
|
41
41
|
defaultText?: string;
|
|
42
42
|
text?: string;
|
|
43
43
|
html?: string;
|
|
44
|
+
type?: string;
|
|
44
45
|
};
|
|
45
46
|
export declare type ProcessRequestParams = {
|
|
46
47
|
name: RequestAction;
|
|
@@ -79,7 +80,8 @@ export declare enum CustomAction {
|
|
|
79
80
|
SET_WIDTH = "setWidth",
|
|
80
81
|
RETURN_PROCESSED_API_RESPONSE = "returnProcessedApiResponse",
|
|
81
82
|
RETURN_PROCESSED_API_REQUEST = "returnProcessedApiRequest",
|
|
82
|
-
REQUEST = "request"
|
|
83
|
+
REQUEST = "request",
|
|
84
|
+
EVENT = "event"
|
|
83
85
|
}
|
|
84
86
|
export declare type CustomActionTask = {
|
|
85
87
|
action: CustomAction;
|
|
@@ -36,4 +36,5 @@ export var CustomAction;
|
|
|
36
36
|
CustomAction["RETURN_PROCESSED_API_RESPONSE"] = "returnProcessedApiResponse";
|
|
37
37
|
CustomAction["RETURN_PROCESSED_API_REQUEST"] = "returnProcessedApiRequest";
|
|
38
38
|
CustomAction["REQUEST"] = "request";
|
|
39
|
+
CustomAction["EVENT"] = "event";
|
|
39
40
|
})(CustomAction || (CustomAction = {}));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CustomViewConfig } from '@reltio/mdm-sdk';
|
|
2
|
-
export declare const useAPI: (config
|
|
2
|
+
export declare const useAPI: (config?: CustomViewConfig) => {
|
|
3
3
|
html: HTMLElement;
|
|
4
4
|
visible: boolean;
|
|
5
5
|
tooltip: string;
|
|
@@ -10,4 +10,5 @@ export declare const useAPI: (config: CustomViewConfig) => {
|
|
|
10
10
|
};
|
|
11
11
|
message: string;
|
|
12
12
|
onClosePopup: () => void;
|
|
13
|
+
onClick: () => void;
|
|
13
14
|
};
|
|
@@ -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
|
-
|
|
23
|
-
var
|
|
24
|
-
var
|
|
25
|
-
var
|
|
26
|
-
var
|
|
27
|
-
var
|
|
28
|
-
var
|
|
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
|
|
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
|
-
|
|
154
|
-
|
|
155
|
-
|
|
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.
|
|
3
|
+
"version": "1.4.1131",
|
|
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.1131",
|
|
11
|
+
"@reltio/mdm-sdk": "^1.4.1131",
|
|
12
12
|
"classnames": "^2.2.5",
|
|
13
13
|
"d3-cloud": "^1.2.5",
|
|
14
14
|
"d3-geo": "^2.0.1",
|