orc-shared 1.6.0-dev.2 → 1.6.0-dev.4
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/dist/components/MaterialUI/DataDisplay/PredefinedElements/StepperModal.js +2 -1
- package/dist/components/MaterialUI/DataDisplay/Table.js +2 -2
- package/dist/components/MaterialUI/Inputs/InputBase.js +1 -1
- package/dist/components/MaterialUI/hocs/withDeferredPopper.js +1 -1
- package/dist/components/Routing/SubPage.js +6 -7
- package/dist/hooks/useNotificationRequestState.js +2 -2
- package/dist/selectors/authentication.js +2 -2
- package/dist/selectors/metadata.js +1 -1
- package/dist/utils/buildUrl.js +1 -1
- package/package.json +1 -1
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/StepperModal.js +2 -1
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/StepperModal.test.js +20 -0
- package/src/components/MaterialUI/Inputs/InputBase.js +1 -1
- package/src/components/MaterialUI/Inputs/InputBase.test.js +2 -2
- package/src/components/Routing/SubPage.js +0 -1
- package/src/utils/buildUrl.js +1 -1
|
@@ -119,6 +119,7 @@ var StepperModal = function StepperModal(_ref) {
|
|
|
119
119
|
open = _ref.open,
|
|
120
120
|
closeCallback = _ref.closeCallback,
|
|
121
121
|
confirmCallback = _ref.confirmCallback,
|
|
122
|
+
backdropCallback = _ref.backdropCallback,
|
|
122
123
|
confirmTitle = _ref.confirmTitle,
|
|
123
124
|
_ref$type = _ref.type,
|
|
124
125
|
type = _ref$type === void 0 ? "wide" : _ref$type;
|
|
@@ -150,7 +151,7 @@ var StepperModal = function StepperModal(_ref) {
|
|
|
150
151
|
}, (_steps$currentStep3 = steps[currentStep]) == null ? void 0 : _steps$currentStep3.content);
|
|
151
152
|
modalProps.set(_modalProps.default.propNames.title, titleComponent);
|
|
152
153
|
modalProps.set(_modalProps.default.propNames.open, open);
|
|
153
|
-
modalProps.set(_modalProps.default.propNames.backdropClickCallback, closeCallback);
|
|
154
|
+
modalProps.set(_modalProps.default.propNames.backdropClickCallback, backdropCallback != null ? backdropCallback : closeCallback);
|
|
154
155
|
modalProps.set(_modalProps.default.propNames.type, type);
|
|
155
156
|
var nextClick = (0, _react.useCallback)(function () {
|
|
156
157
|
return changeCurrentStep(function (step) {
|
|
@@ -296,8 +296,8 @@ var buildTableRows = function buildTableRows(rows, classes, customClasses, selec
|
|
|
296
296
|
};
|
|
297
297
|
var mappedRows = rows.map(function (row) {
|
|
298
298
|
var _row$style$show, _row$style, _row$style$customClas, _row$style2;
|
|
299
|
-
var showStyle = (_row$style$show = row == null
|
|
300
|
-
var rowClass = (_row$style$customClas = row == null
|
|
299
|
+
var showStyle = (_row$style$show = row == null || (_row$style = row.style) == null ? void 0 : _row$style.show) != null ? _row$style$show : false;
|
|
300
|
+
var rowClass = (_row$style$customClas = row == null || (_row$style2 = row.style) == null ? void 0 : _row$style2.customClass) != null ? _row$style$customClas : "";
|
|
301
301
|
var customClassName = showStyle ? rowClass : "";
|
|
302
302
|
return /*#__PURE__*/_react.default.createElement(MemoTableRow, {
|
|
303
303
|
className: (0, _classnames.default)(classes.tableRow, customClasses.tableRow, customClasses[row.className], customClasses[customClassName]),
|
|
@@ -204,7 +204,7 @@ var InputBase = function InputBase(_ref) {
|
|
|
204
204
|
multiline: multiline,
|
|
205
205
|
startAdornment: startAdornment,
|
|
206
206
|
endAdornment: endAdornment,
|
|
207
|
-
|
|
207
|
+
minRows: rows,
|
|
208
208
|
title: tooltipText,
|
|
209
209
|
autoComplete: autoComplete
|
|
210
210
|
})), error && /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -116,7 +116,7 @@ var withDeferredPopper = function withDeferredPopper(Comp) {
|
|
|
116
116
|
}, props));
|
|
117
117
|
var togglePopper = function togglePopper(event) {
|
|
118
118
|
var _event$_dispatchInsta;
|
|
119
|
-
var linkParent = event == null
|
|
119
|
+
var linkParent = event == null || (_event$_dispatchInsta = event._dispatchInstances) == null ? void 0 : _event$_dispatchInsta.filter(function (item) {
|
|
120
120
|
return item.elementType === "a";
|
|
121
121
|
});
|
|
122
122
|
if (linkParent) {
|
|
@@ -46,7 +46,7 @@ var useStyles = (0, _styles.makeStyles)(function (theme) {
|
|
|
46
46
|
};
|
|
47
47
|
});
|
|
48
48
|
var SubPage = function SubPage(_ref) {
|
|
49
|
-
var _props$title, _props$title2, _props$title3, _props$componentProps
|
|
49
|
+
var _props$title, _props$title2, _props$title3, _props$componentProps;
|
|
50
50
|
var config = _ref.config,
|
|
51
51
|
match = _ref.match,
|
|
52
52
|
location = _ref.location,
|
|
@@ -78,13 +78,12 @@ var SubPage = function SubPage(_ref) {
|
|
|
78
78
|
}));
|
|
79
79
|
var modalProps = new _modalProps.default();
|
|
80
80
|
var titleComponent = props != null && (_props$title = props.title) != null && _props$title.id ? /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, {
|
|
81
|
-
id: props == null
|
|
82
|
-
defaultMesaage: props == null
|
|
81
|
+
id: props == null || (_props$title2 = props.title) == null ? void 0 : _props$title2.id,
|
|
82
|
+
defaultMesaage: props == null || (_props$title3 = props.title) == null ? void 0 : _props$title3.defaultMessage
|
|
83
83
|
}) : props == null ? void 0 : props.title;
|
|
84
84
|
modalProps.set(_modalProps.default.propNames.title, titleComponent);
|
|
85
85
|
modalProps.set(_modalProps.default.propNames.open, true);
|
|
86
86
|
modalProps.set(_modalProps.default.propNames.type, "fullwidth");
|
|
87
|
-
modalProps.set(_modalProps.default.propNames.backdropClickCallback, closeSubPage);
|
|
88
87
|
var actionPanel = /*#__PURE__*/_react.default.createElement("div", {
|
|
89
88
|
className: classes.actionPanel
|
|
90
89
|
}, /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
@@ -93,11 +92,11 @@ var SubPage = function SubPage(_ref) {
|
|
|
93
92
|
disableElevation: true,
|
|
94
93
|
onClick: closeSubPage
|
|
95
94
|
}, /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, _sharedMessages.default.close)));
|
|
96
|
-
if (((_props$componentProps = props.componentProps) == null
|
|
97
|
-
var _props$
|
|
95
|
+
if (((_props$componentProps = props.componentProps) == null || (_props$componentProps = _props$componentProps.actionPanel()) == null ? void 0 : _props$componentProps.length) > 0) {
|
|
96
|
+
var _props$componentProps2;
|
|
98
97
|
actionPanel = /*#__PURE__*/_react.default.createElement("div", {
|
|
99
98
|
className: classes.actionPanel
|
|
100
|
-
}, (_props$
|
|
99
|
+
}, (_props$componentProps2 = props.componentProps) == null ? void 0 : _props$componentProps2.actionPanel().map(function (action) {
|
|
101
100
|
var _action$label;
|
|
102
101
|
return /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
103
102
|
key: (_action$label = action.label) == null ? void 0 : _action$label.id,
|
|
@@ -68,8 +68,8 @@ var useNotificationRequestState = function useNotificationRequestState(_ref) {
|
|
|
68
68
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
69
69
|
}, [formatMessage, successAction, successMessageId, successMessageValues]);
|
|
70
70
|
var onError = (0, _react.useCallback)(function (errorResponse) {
|
|
71
|
-
var _errorResponse$respon, _errorResponse$respon2
|
|
72
|
-
var errorMessage = (_errorResponse$respon = errorResponse == null
|
|
71
|
+
var _errorResponse$respon, _errorResponse$respon2;
|
|
72
|
+
var errorMessage = (_errorResponse$respon = errorResponse == null || (_errorResponse$respon2 = errorResponse.response) == null || (_errorResponse$respon2 = _errorResponse$respon2.responseStatus) == null ? void 0 : _errorResponse$respon2.message) != null ? _errorResponse$respon : null;
|
|
73
73
|
var message = formatMessage(errorMessageId, _objectSpread(_objectSpread({}, errorMessageValues), {}, {
|
|
74
74
|
errorMessage: errorMessage != null ? errorMessage : formatMessage(_sharedMessages.default.errorUnknown)
|
|
75
75
|
}));
|
|
@@ -41,8 +41,8 @@ var hasRolePermissions = function hasRolePermissions(appRolesClaims, scopeId, ro
|
|
|
41
41
|
if (appRolesClaims != null && scopeId != null) {
|
|
42
42
|
var allowed = !!appRolesClaims.getIn(["*", role]) || !!appRolesClaims.getIn([scopeId, role]);
|
|
43
43
|
if (!allowed) {
|
|
44
|
-
var _scopes$get$toJS$pare, _scopes$get
|
|
45
|
-
var parentScopeId = (_scopes$get$toJS$pare = (_scopes$get = scopes.get(scopeId)) == null
|
|
44
|
+
var _scopes$get$toJS$pare, _scopes$get;
|
|
45
|
+
var parentScopeId = (_scopes$get$toJS$pare = (_scopes$get = scopes.get(scopeId)) == null || (_scopes$get = _scopes$get.toJS()) == null ? void 0 : _scopes$get.parentScopeId) != null ? _scopes$get$toJS$pare : null;
|
|
46
46
|
return hasRolePermissions(appRolesClaims, parentScopeId, role, scopes);
|
|
47
47
|
}
|
|
48
48
|
return allowed;
|
|
@@ -369,7 +369,7 @@ var resolveProductPropertyValue = function resolveProductPropertyValue(property,
|
|
|
369
369
|
case "Lookup":
|
|
370
370
|
var lookupName = (_property$lookupDefin = property.lookupDefinition) == null ? void 0 : _property$lookupDefin.lookupName;
|
|
371
371
|
var lookup = lookups == null ? void 0 : lookups.get(lookupName);
|
|
372
|
-
var lookupValue = lookup == null
|
|
372
|
+
var lookupValue = lookup == null || (_lookup$get = lookup.get("values")) == null ? void 0 : _lookup$get.get(propertyValue);
|
|
373
373
|
return (0, _localizationHelper.getLocalization)(lookupValue == null ? void 0 : lookupValue.get("displayName"), locale, lookupValue == null ? void 0 : lookupValue.get("value"));
|
|
374
374
|
default:
|
|
375
375
|
return propertyValue;
|
package/dist/utils/buildUrl.js
CHANGED
|
@@ -47,7 +47,7 @@ var loadConfig = function loadConfig() {
|
|
|
47
47
|
}).catch(function () {
|
|
48
48
|
console.warn("Failed to load config.json, falling back to dev defaults");
|
|
49
49
|
return {
|
|
50
|
-
serviceApiUrl: "https://
|
|
50
|
+
serviceApiUrl: "https://occ-dev-ocs-cm.develop.orckestra.cloud:443/api"
|
|
51
51
|
};
|
|
52
52
|
}).then(function (config) {
|
|
53
53
|
var host = config.serviceApiUrl;
|
package/package.json
CHANGED
|
@@ -96,6 +96,7 @@ const StepperModal = ({
|
|
|
96
96
|
open,
|
|
97
97
|
closeCallback,
|
|
98
98
|
confirmCallback,
|
|
99
|
+
backdropCallback,
|
|
99
100
|
confirmTitle,
|
|
100
101
|
type = "wide",
|
|
101
102
|
}) => {
|
|
@@ -138,7 +139,7 @@ const StepperModal = ({
|
|
|
138
139
|
|
|
139
140
|
modalProps.set(ModalProps.propNames.title, titleComponent);
|
|
140
141
|
modalProps.set(ModalProps.propNames.open, open);
|
|
141
|
-
modalProps.set(ModalProps.propNames.backdropClickCallback, closeCallback);
|
|
142
|
+
modalProps.set(ModalProps.propNames.backdropClickCallback, backdropCallback ?? closeCallback);
|
|
142
143
|
modalProps.set(ModalProps.propNames.type, type);
|
|
143
144
|
|
|
144
145
|
const nextClick = useCallback(() => changeCurrentStep(step => step + 1), []);
|
|
@@ -3,6 +3,7 @@ import StepperModal from "./StepperModal";
|
|
|
3
3
|
import Modal from "./../Modal";
|
|
4
4
|
import ModalProps from "./../modalProps";
|
|
5
5
|
import Button from "@material-ui/core/Button";
|
|
6
|
+
import ModalMui from "@material-ui/core/Modal";
|
|
6
7
|
import { mount } from "enzyme";
|
|
7
8
|
import sinon from "sinon";
|
|
8
9
|
import { IntlProvider } from "react-intl";
|
|
@@ -163,6 +164,25 @@ describe("StepperModal", () => {
|
|
|
163
164
|
expect(cancelCallbackSpy, "was called");
|
|
164
165
|
});
|
|
165
166
|
|
|
167
|
+
it("Calls backdropCallback when clicking away from component", () => {
|
|
168
|
+
const open = true;
|
|
169
|
+
const backdropCallbackSpy = sinon.spy();
|
|
170
|
+
|
|
171
|
+
const component = (
|
|
172
|
+
<IntlProvider locale="en-US" messages={messages}>
|
|
173
|
+
<StepperModal open={open} backdropCallback={backdropCallbackSpy} />
|
|
174
|
+
</IntlProvider>
|
|
175
|
+
);
|
|
176
|
+
|
|
177
|
+
const mountedComponent = mount(component);
|
|
178
|
+
|
|
179
|
+
const muiModal = mountedComponent.find(ModalMui);
|
|
180
|
+
|
|
181
|
+
muiModal.invoke("onClose")({}, "backdropClick");
|
|
182
|
+
|
|
183
|
+
expect(backdropCallbackSpy, "was called");
|
|
184
|
+
});
|
|
185
|
+
|
|
166
186
|
it("Calls cancelCallback when ok button is pressed", () => {
|
|
167
187
|
const open = true;
|
|
168
188
|
const okCallback = sinon.spy();
|
|
@@ -71,7 +71,7 @@ describe("InputBase Component", () => {
|
|
|
71
71
|
const component = <InputBase inputProps={inputProps} />;
|
|
72
72
|
|
|
73
73
|
const mountedComponent = mount(component);
|
|
74
|
-
const expected = <InputBaseMUI value={aValue} title={aValue}
|
|
74
|
+
const expected = <InputBaseMUI value={aValue} title={aValue} minRows={defaultRows} />;
|
|
75
75
|
|
|
76
76
|
expect(mountedComponent.containsMatchingElement(expected), "to be truthy");
|
|
77
77
|
});
|
|
@@ -91,7 +91,7 @@ describe("InputBase Component", () => {
|
|
|
91
91
|
const component = <InputBase inputProps={inputProps} />;
|
|
92
92
|
|
|
93
93
|
const mountedComponent = mount(component);
|
|
94
|
-
const expected = <InputBaseMUI value={aValue} title={aValue}
|
|
94
|
+
const expected = <InputBaseMUI value={aValue} title={aValue} minRows={desiredNumberOfRows} />;
|
|
95
95
|
|
|
96
96
|
expect(mountedComponent.containsMatchingElement(expected), "to be truthy");
|
|
97
97
|
});
|
|
@@ -56,7 +56,6 @@ export const SubPage = ({ config, match, location, history, root, modulePrependP
|
|
|
56
56
|
modalProps.set(ModalProps.propNames.title, titleComponent);
|
|
57
57
|
modalProps.set(ModalProps.propNames.open, true);
|
|
58
58
|
modalProps.set(ModalProps.propNames.type, "fullwidth");
|
|
59
|
-
modalProps.set(ModalProps.propNames.backdropClickCallback, closeSubPage);
|
|
60
59
|
|
|
61
60
|
let actionPanel = (
|
|
62
61
|
<div className={classes.actionPanel}>
|
package/src/utils/buildUrl.js
CHANGED
|
@@ -21,7 +21,7 @@ export const loadConfig = () =>
|
|
|
21
21
|
.catch(() => {
|
|
22
22
|
console.warn("Failed to load config.json, falling back to dev defaults");
|
|
23
23
|
return {
|
|
24
|
-
serviceApiUrl: "https://
|
|
24
|
+
serviceApiUrl: "https://occ-dev-ocs-cm.develop.orckestra.cloud:443/api",
|
|
25
25
|
};
|
|
26
26
|
})
|
|
27
27
|
.then(config => {
|