@agilemotion/oui-react-js 1.3.2 → 1.3.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/ApplicationContext.js +90 -41
- package/dist/BasicAppHome.js +16 -10
- package/dist/BusinessPortalApp.js +25 -50
- package/dist/BusinessPortalAppHome.js +102 -109
- package/dist/RestUtils.js +64 -35
- package/dist/Utils.js +47 -1
- package/dist/components/AlertBar.js +40 -11
- package/dist/components/ConfirmationDialog.js +54 -8
- package/dist/components/DataGrid.css +3 -1
- package/dist/components/DataGrid.js +149 -82
- package/dist/components/DataGridFilter.js +85 -8
- package/dist/components/Dialog.js +258 -0
- package/dist/components/HtmlPanel.js +103 -4
- package/dist/components/Icon.js +52 -0
- package/dist/components/PopupView.js +55 -6
- package/dist/components/SignaturePanel.js +40 -11
- package/dist/components/StepperTitleBar.bck.css +85 -0
- package/dist/components/StepperTitleBar.css +53 -54
- package/dist/components/StepperTitleBar.js +39 -28
- package/dist/components/TabPanel.js +10 -11
- package/dist/components/TableCellContent.js +6 -3
- package/dist/components/TemplateDesigner.css +13 -0
- package/dist/components/TemplateDesigner.js +494 -0
- package/dist/components/TemplateItemEventHandler.js +440 -0
- package/dist/components/TemplateTable.js +222 -0
- package/dist/components/TitleBar.js +21 -14
- package/dist/components/Toolbar.js +7 -5
- package/dist/components/Tree.js +5 -2
- package/dist/components/dashboard/BasicBusinessAppDashboard.js +14 -10
- package/dist/components/dashboard/BusinessPortalAppDashboard.js +79 -34
- package/dist/components/dashboard/components/blackDashboard/sidebar/Sidebar.js +1 -1
- package/dist/components/dashboard/components/portal/Workspace.css +6 -6
- package/dist/components/form/AddressSearch.js +140 -0
- package/dist/components/form/BaseField.js +31 -6
- package/dist/components/form/Checkbox.js +3 -0
- package/dist/components/form/DatePicker.js +12 -7
- package/dist/components/form/FieldSet.js +246 -71
- package/dist/components/form/Form.js +153 -122
- package/dist/components/form/GridField.js +3 -2
- package/dist/components/form/ImageEditor.js +461 -0
- package/dist/components/form/LabelField.js +2 -2
- package/dist/components/form/LookupField.js +16 -4
- package/dist/components/form/RadioGroup.js +107 -0
- package/dist/components/form/Section.js +58 -19
- package/dist/components/form/SelectItem.js +5 -3
- package/dist/components/form/SignatureTemplateDesignerField.js +46 -0
- package/dist/components/form/TextField.js +5 -9
- package/dist/components/form/TransferList.js +7 -7
- package/dist/components/form/UploadField.js +93 -42
- package/dist/components/form/noimage-person.png +0 -0
- package/dist/components/form/noimage.png +0 -0
- package/dist/components/form/transparent.jpeg +0 -0
- package/dist/components/layout/CollapsiblePanel.js +0 -6
- package/dist/components/layout/Layout.js +41 -20
- package/dist/components/layout/View.css +43 -0
- package/dist/components/layout/View.js +76 -156
- package/dist/components/layout/ViewPort.js +29 -47
- package/dist/components/navbars/HomeNavbar.js +31 -6
- package/dist/components/navbars/PortalNavbar.css +2 -2
- package/dist/components/navbars/PortalNavbar.js +125 -36
- package/dist/components/signatures/AgilitySignaturePanel.js +312 -0
- package/dist/components/signatures/DocumentContainer.css +33 -0
- package/dist/components/signatures/DocumentContainer.js +206 -0
- package/dist/components/signatures/ImageSignatureInput.js +265 -0
- package/dist/components/signatures/ResponsiveTable.js +1 -3
- package/dist/components/signatures/SignatureInput.js +303 -0
- package/dist/components/signatures/SignatureInputProps.js +17 -11
- package/dist/components/signatures/SignatureTemplateDesigner.js +186 -77
- package/dist/components/signatures/transparent.jpeg +0 -0
- package/dist/event/LoadDataActionHandler.js +1 -1
- package/dist/event/Observable.js +1 -1
- package/dist/event/RouteActionHandler.js +17 -4
- package/dist/event/ServiceCallActionHandler.js +7 -3
- package/dist/js/Addresses.js +16 -9
- package/dist/view/Dashboard.js +10 -6
- package/dist/view/security/LoginBusinessPortal.js +1 -0
- package/package.json +4 -1
|
@@ -5,122 +5,130 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
|
|
8
|
-
var _react =
|
|
9
|
-
|
|
10
|
-
var _reactRedux = require("react-redux");
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
9
|
|
|
12
10
|
var _reactRouterDom = require("react-router-dom");
|
|
13
11
|
|
|
14
|
-
var _redux = require("redux");
|
|
15
|
-
|
|
16
|
-
var _DashboardStore = require("./redux/store/DashboardStore");
|
|
17
|
-
|
|
18
12
|
var _LoadingIndicator = _interopRequireDefault(require("./components/LoadingIndicator"));
|
|
19
13
|
|
|
20
14
|
var _BusinessPortalAppDashboard = _interopRequireDefault(require("./components/dashboard/BusinessPortalAppDashboard"));
|
|
21
15
|
|
|
22
|
-
var _ApplicationContext =
|
|
16
|
+
var _ApplicationContext = _interopRequireDefault(require("./ApplicationContext"));
|
|
23
17
|
|
|
24
18
|
var _TokenManager = _interopRequireDefault(require("./security/TokenManager"));
|
|
25
19
|
|
|
26
20
|
var _Utils = _interopRequireDefault(require("./Utils"));
|
|
27
21
|
|
|
28
|
-
var
|
|
22
|
+
var _reactPromiseTracker = require("react-promise-tracker");
|
|
29
23
|
|
|
30
|
-
var
|
|
24
|
+
var _reactRouter = require("react-router");
|
|
31
25
|
|
|
32
26
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
33
27
|
|
|
34
|
-
function
|
|
28
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
29
|
+
|
|
30
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
31
|
+
|
|
32
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
33
|
+
|
|
34
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
35
|
+
|
|
36
|
+
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
35
37
|
|
|
36
|
-
function
|
|
38
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
37
39
|
|
|
38
40
|
const location = window.location.protocol + "//" + window.location.hostname;
|
|
39
41
|
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
error
|
|
46
|
-
|
|
47
|
-
}
|
|
42
|
+
const status = response => {
|
|
43
|
+
if (response.ok) {
|
|
44
|
+
return Promise.resolve(response);
|
|
45
|
+
} else {
|
|
46
|
+
let error = new Error(response.statusText);
|
|
47
|
+
error.code = response.status;
|
|
48
|
+
return Promise.reject(error);
|
|
49
|
+
}
|
|
48
50
|
};
|
|
49
51
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
this.state = {
|
|
54
|
-
dashboardSettings: null,
|
|
55
|
-
message: "",
|
|
56
|
-
open: false,
|
|
57
|
-
avatarUrl: null,
|
|
58
|
-
tokenRefreshMonitorStarted: false
|
|
59
|
-
};
|
|
60
|
-
}
|
|
52
|
+
const json = response => {
|
|
53
|
+
return response.text();
|
|
54
|
+
};
|
|
61
55
|
|
|
62
|
-
|
|
63
|
-
|
|
56
|
+
const BusinessPortalAppHome = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
57
|
+
const _React$useState = _react.default.useState(null),
|
|
58
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
59
|
+
dashboardSettings = _React$useState2[0],
|
|
60
|
+
setDashboardSettings = _React$useState2[1];
|
|
64
61
|
|
|
65
|
-
|
|
62
|
+
const _React$useState3 = _react.default.useState(null),
|
|
63
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
64
|
+
tokenRefreshMonitorStarted = _React$useState4[0],
|
|
65
|
+
setTokenRefreshMonitorStarted = _React$useState4[1];
|
|
66
66
|
|
|
67
|
-
|
|
67
|
+
const _React$useState5 = _react.default.useState(null),
|
|
68
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
69
|
+
loadingColor = _React$useState6[0],
|
|
70
|
+
setLoadingColor = _React$useState6[1];
|
|
68
71
|
|
|
69
|
-
|
|
72
|
+
const _React$useState7 = _react.default.useState(location + props.contextRoot + props.implConfig.authUrl + "/user/avatar?" + "access_token=" + sessionStorage.getItem("accessToken") + "&idToken=" + sessionStorage.getItem("idToken")),
|
|
73
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
74
|
+
avatarUrl = _React$useState8[0],
|
|
75
|
+
setAvatarUrl = _React$useState8[1];
|
|
70
76
|
|
|
71
|
-
|
|
77
|
+
const history = (0, _reactRouter.useHistory)();
|
|
72
78
|
|
|
73
|
-
|
|
79
|
+
_react.default.useEffect(() => {
|
|
80
|
+
if (dashboardSettings === null) {
|
|
81
|
+
_ApplicationContext.default.setApplicationHistory(history);
|
|
74
82
|
|
|
75
|
-
|
|
76
|
-
}
|
|
83
|
+
_ApplicationContext.default.setServiceApiPath(props.implConfig.serviceApiPath);
|
|
77
84
|
|
|
78
|
-
|
|
79
|
-
if (JSON.stringify(prevProps.dashboardSettings) !== JSON.stringify(this.props.dashboardSettings) && !this.props.error) {
|
|
80
|
-
this.setState({
|
|
81
|
-
dashboardSettings: this.props.dashboardSettings
|
|
82
|
-
});
|
|
85
|
+
_ApplicationContext.default.setUIConfigPath(props.implConfig.uiConfigPath);
|
|
83
86
|
|
|
84
|
-
|
|
85
|
-
_TokenManager.default.startTokenRefreshMonitor(location + this.props.contextRoot + this.props.authUrl + "/refresh", this.props.dashboardSettings.userName);
|
|
87
|
+
_ApplicationContext.default.setContextRoot(props.contextRoot);
|
|
86
88
|
|
|
87
|
-
|
|
88
|
-
tokenRefreshMonitorStarted: true
|
|
89
|
-
});
|
|
89
|
+
_ApplicationContext.default.setBaseApiUrl(props.implConfig.baseApiUrl);
|
|
90
90
|
|
|
91
|
-
|
|
92
|
-
this.setState({
|
|
93
|
-
avatarUrl: this.props.dashboardSettings.userAvatar.url
|
|
94
|
-
});
|
|
95
|
-
}
|
|
91
|
+
_ApplicationContext.default.setFilesApiPath(props.implConfig.filesApiPath);
|
|
96
92
|
|
|
97
|
-
|
|
98
|
-
|
|
93
|
+
let implId = sessionStorage.getItem("implId");
|
|
94
|
+
(0, _reactPromiseTracker.trackPromise)(fetch(encodeURI(location + props.contextRoot + props.implConfig.baseApiUrl + "/ui/setup/" + (implId ? implId : "default")), {
|
|
95
|
+
method: 'GET',
|
|
96
|
+
headers: {
|
|
97
|
+
'Accept': 'application/json',
|
|
98
|
+
'Authorization': 'Bearer ' + sessionStorage.getItem("accessToken"),
|
|
99
|
+
'idToken': sessionStorage.getItem("idToken")
|
|
100
|
+
}
|
|
101
|
+
}).then(status).then(json).then(data => {
|
|
102
|
+
setDashboardSettings(JSON.parse(data));
|
|
103
|
+
}).catch(e => {
|
|
104
|
+
if (e.code === 401) {
|
|
105
|
+
_ApplicationContext.default.clear();
|
|
99
106
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
107
|
+
_ApplicationContext.default.getApplicationHistory().push('/login');
|
|
108
|
+
}
|
|
109
|
+
}));
|
|
110
|
+
}
|
|
111
|
+
});
|
|
105
112
|
|
|
106
|
-
|
|
113
|
+
_react.default.useEffect(() => {
|
|
114
|
+
if (dashboardSettings !== null) {
|
|
115
|
+
if (!tokenRefreshMonitorStarted) {
|
|
116
|
+
_TokenManager.default.startTokenRefreshMonitor(location + props.contextRoot + props.implConfig.authUrl + "/refresh", dashboardSettings.userName);
|
|
107
117
|
|
|
108
|
-
|
|
118
|
+
setTokenRefreshMonitorStarted(true);
|
|
119
|
+
}
|
|
109
120
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
});
|
|
121
|
+
if (!_Utils.default.isNull(dashboardSettings.userAvatar)) {
|
|
122
|
+
setAvatarUrl(dashboardSettings.userAvatar.url);
|
|
113
123
|
}
|
|
114
|
-
}
|
|
115
124
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
});
|
|
125
|
+
_ApplicationContext.default.setApplicationThemeColors(dashboardSettings.primaryColor, dashboardSettings.secondaryColor);
|
|
126
|
+
|
|
127
|
+
setLoadingColor(dashboardSettings.primaryColor);
|
|
120
128
|
}
|
|
121
|
-
}
|
|
129
|
+
}, [dashboardSettings]);
|
|
122
130
|
|
|
123
|
-
logout() {
|
|
131
|
+
const logout = () => {
|
|
124
132
|
sessionStorage.removeItem("accessToken");
|
|
125
133
|
sessionStorage.removeItem("refreshToken");
|
|
126
134
|
sessionStorage.removeItem("idToken");
|
|
@@ -128,40 +136,25 @@ class BusinessPortalAppHome extends _react.Component {
|
|
|
128
136
|
|
|
129
137
|
_ApplicationContext.default.clear();
|
|
130
138
|
|
|
131
|
-
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
render() {
|
|
135
|
-
return /*#__PURE__*/_react.default.createElement(_reactRouterDom.BrowserRouter, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
136
|
-
className: "main w-100 h-100 d-inline-block"
|
|
137
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
138
|
-
className: "w-100 h-100"
|
|
139
|
-
}, this.state.dashboardSettings !== null ? /*#__PURE__*/_react.default.createElement(_ThemeProvider.default, {
|
|
140
|
-
theme: (0, _core.createMuiTheme)({
|
|
141
|
-
palette: {
|
|
142
|
-
primary: {
|
|
143
|
-
main: this.state.dashboardSettings.primaryColor
|
|
144
|
-
},
|
|
145
|
-
secondary: {
|
|
146
|
-
main: this.state.dashboardSettings.secondaryColor
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
})
|
|
150
|
-
}, /*#__PURE__*/_react.default.createElement(_BusinessPortalAppDashboard.default, {
|
|
151
|
-
logoutCallBack: () => {
|
|
152
|
-
this.logout();
|
|
153
|
-
},
|
|
154
|
-
settings: this.state.dashboardSettings,
|
|
155
|
-
avatar: !_Utils.default.isNull(this.state.avatarUrl) ? this.state.avatarUrl : null,
|
|
156
|
-
logo: this.state.dashboardSettings.logo,
|
|
157
|
-
appLogoPath: this.props.appLogoPath
|
|
158
|
-
})) : null), /*#__PURE__*/_react.default.createElement(_LoadingIndicator.default, {
|
|
159
|
-
color: this.state.loadingColor
|
|
160
|
-
})));
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
var _default = (0, _reactRouterDom.withRouter)((0, _reactRedux.connect)(propHandler, dispatch => (0, _redux.bindActionCreators)(_DashboardStore.actionCreators, dispatch))(BusinessPortalAppHome));
|
|
139
|
+
history.push('/login');
|
|
140
|
+
};
|
|
166
141
|
|
|
142
|
+
return /*#__PURE__*/_react.default.createElement(_reactRouterDom.BrowserRouter, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
143
|
+
className: "main w-100 h-100 d-inline-block"
|
|
144
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
145
|
+
className: "w-100 h-100"
|
|
146
|
+
}, dashboardSettings !== null ? /*#__PURE__*/_react.default.createElement(_BusinessPortalAppDashboard.default, {
|
|
147
|
+
logoutCallBack: () => {
|
|
148
|
+
logout();
|
|
149
|
+
},
|
|
150
|
+
settings: dashboardSettings,
|
|
151
|
+
avatar: !_Utils.default.isNull(avatarUrl) ? avatarUrl : null,
|
|
152
|
+
logo: dashboardSettings.logo,
|
|
153
|
+
appLogoPath: props.implConfig.appLogo
|
|
154
|
+
}) : null), /*#__PURE__*/_react.default.createElement(_LoadingIndicator.default, {
|
|
155
|
+
color: loadingColor
|
|
156
|
+
})));
|
|
157
|
+
}));
|
|
158
|
+
|
|
159
|
+
var _default = BusinessPortalAppHome;
|
|
167
160
|
exports.default = _default;
|
package/dist/RestUtils.js
CHANGED
|
@@ -156,7 +156,13 @@ class RestUtils {
|
|
|
156
156
|
this.fireEvent(viewId, component, _EventType.default.SERVICE_CALL_FAILURE);
|
|
157
157
|
} else {
|
|
158
158
|
if (!_Utils.default.isNull(successCallback)) {
|
|
159
|
-
this.processSuccessfulResponseData(response, successCallback, viewId, successMessage);
|
|
159
|
+
this.processSuccessfulResponseData(component, response, successCallback, viewId, successMessage);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
let path = _Utils.default.getPropertyChainPath(returnValueBinding);
|
|
163
|
+
|
|
164
|
+
if (!_Utils.default.isNull(path.valueObject) && !_Utils.default.isNull(path.property)) {
|
|
165
|
+
path.valueObject[path.property] = response;
|
|
160
166
|
}
|
|
161
167
|
|
|
162
168
|
this.fireEvent(viewId, component, _EventType.default.SERVICE_CALL_SUCCESS, response);
|
|
@@ -176,10 +182,20 @@ class RestUtils {
|
|
|
176
182
|
});
|
|
177
183
|
} else {
|
|
178
184
|
sendRequest(url, data => {
|
|
185
|
+
let path = _Utils.default.getPropertyChainPath(returnValueBinding);
|
|
186
|
+
|
|
187
|
+
if (!_Utils.default.isNull(path.valueObject) && !_Utils.default.isNull(path.property)) {
|
|
188
|
+
path.valueObject[path.property] = data;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
this.fireEvent(viewId, component, _EventType.default.SERVICE_CALL_SUCCESS, data);
|
|
192
|
+
|
|
179
193
|
if (!_Utils.default.isNull(successCallback)) {
|
|
180
194
|
successCallback(data);
|
|
181
195
|
}
|
|
182
196
|
}, e => {
|
|
197
|
+
this.fireEvent(viewId, component, _EventType.default.SERVICE_CALL_FAILURE);
|
|
198
|
+
|
|
183
199
|
if (!_Utils.default.isNull(errorCallback)) {
|
|
184
200
|
errorCallback(e);
|
|
185
201
|
}
|
|
@@ -276,40 +292,27 @@ class RestUtils {
|
|
|
276
292
|
fetchWithCustomConfig(url, successCallback, errorCallback, secure, config, method, download, body, serviceType, viewId, successMessage, track) {
|
|
277
293
|
const accessToken = sessionStorage.getItem("accessToken");
|
|
278
294
|
const idToken = sessionStorage.getItem("idToken");
|
|
279
|
-
let data = null;
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
data = JSON.stringify(body);
|
|
295
|
+
/*let data = null;
|
|
296
|
+
if(serviceType === 'rest') {
|
|
297
|
+
data = JSON.stringify(body);
|
|
283
298
|
} else {
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
_step2;
|
|
297
|
-
|
|
298
|
-
try {
|
|
299
|
-
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
300
|
-
const file = _step2.value;
|
|
301
|
-
data.append(file.correlationId, file.content);
|
|
302
|
-
}
|
|
303
|
-
} catch (err) {
|
|
304
|
-
_iterator2.e(err);
|
|
305
|
-
} finally {
|
|
306
|
-
_iterator2.f();
|
|
299
|
+
if (!Utils.isNull(body)) {
|
|
300
|
+
data = new FormData();
|
|
301
|
+
const json = JSON.stringify(body);
|
|
302
|
+
data.append("requestDto", json);
|
|
303
|
+
let currentView = applicationContext.getCurrentView();
|
|
304
|
+
if (!Utils.isNull(currentView)) {
|
|
305
|
+
let domainCache = applicationContext.getFileDomainCache(currentView.config.id);
|
|
306
|
+
if (!Utils.isNull(domainCache)) {
|
|
307
|
+
for (const file of domainCache.files) {
|
|
308
|
+
data.append(file.correlationId, file.content);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
307
311
|
}
|
|
308
|
-
}
|
|
309
312
|
}
|
|
310
|
-
|
|
311
|
-
}
|
|
313
|
+
}*/
|
|
312
314
|
|
|
315
|
+
let data = body ? JSON.stringify(body) : null;
|
|
313
316
|
let fetchConfig = config;
|
|
314
317
|
|
|
315
318
|
if (_Utils.default.isNull(fetchConfig)) {
|
|
@@ -317,6 +320,7 @@ class RestUtils {
|
|
|
317
320
|
fetchConfig = {
|
|
318
321
|
method: _Utils.default.isNull(method) ? 'GET' : method,
|
|
319
322
|
headers: {
|
|
323
|
+
'Content-Type': 'application/json',
|
|
320
324
|
'Accept': 'application/json',
|
|
321
325
|
'Authorization': 'Bearer ' + accessToken,
|
|
322
326
|
'idToken': idToken
|
|
@@ -327,6 +331,7 @@ class RestUtils {
|
|
|
327
331
|
fetchConfig = {
|
|
328
332
|
method: _Utils.default.isNull(method) ? 'GET' : method,
|
|
329
333
|
headers: {
|
|
334
|
+
'Content-Type': 'application/json',
|
|
330
335
|
'Accept': 'application/json'
|
|
331
336
|
},
|
|
332
337
|
body: data
|
|
@@ -359,9 +364,11 @@ class RestUtils {
|
|
|
359
364
|
|
|
360
365
|
exeuteFetch(url, fetchConfig, successCallback, viewId, successMessage, errorCallback) {
|
|
361
366
|
return fetch(encodeURI(url), fetchConfig).then(status).then(json).then(data => {
|
|
362
|
-
this.processSuccessfulResponseData(data, successCallback, viewId, successMessage);
|
|
367
|
+
this.processSuccessfulResponseData(null, data, successCallback, viewId, successMessage);
|
|
363
368
|
}).catch(e => {
|
|
364
|
-
|
|
369
|
+
console.error(e);
|
|
370
|
+
|
|
371
|
+
if (e.code === 401 && !url.endsWith("/logout")) {
|
|
365
372
|
errorCallback(e);
|
|
366
373
|
|
|
367
374
|
_ApplicationContext.default.clear();
|
|
@@ -375,8 +382,18 @@ class RestUtils {
|
|
|
375
382
|
});
|
|
376
383
|
}
|
|
377
384
|
|
|
378
|
-
processSuccessfulResponseData(data, successCallback, viewId, successMessage) {
|
|
379
|
-
let response
|
|
385
|
+
processSuccessfulResponseData(component, data, successCallback, viewId, successMessage) {
|
|
386
|
+
let response;
|
|
387
|
+
|
|
388
|
+
if (typeof data === "object" || _Utils.default.isNull(data) || data.toString().trim().length === 0) {
|
|
389
|
+
response = data;
|
|
390
|
+
} else {
|
|
391
|
+
try {
|
|
392
|
+
response = JSON.parse(data);
|
|
393
|
+
} catch (ignored) {
|
|
394
|
+
response = data;
|
|
395
|
+
}
|
|
396
|
+
}
|
|
380
397
|
|
|
381
398
|
if (successCallback !== null) {
|
|
382
399
|
let responseData = !_Utils.default.isNull(response) ? response.data : null;
|
|
@@ -385,6 +402,12 @@ class RestUtils {
|
|
|
385
402
|
let event = new _Event.default(_ApplicationContext.default, viewId, responseData);
|
|
386
403
|
|
|
387
404
|
_Observable.default.fireEvent(_EventType.default.MESSAGE_ARRIVED, event);
|
|
405
|
+
|
|
406
|
+
if (component !== null) {
|
|
407
|
+
event = new _Event.default(component, viewId, responseData);
|
|
408
|
+
|
|
409
|
+
_Observable.default.fireEvent(_EventType.default.MESSAGE_ARRIVED, event);
|
|
410
|
+
}
|
|
388
411
|
} else if (!_Utils.default.isNull(successMessage)) {
|
|
389
412
|
let message = {
|
|
390
413
|
messageType: 'SUCCESS',
|
|
@@ -393,6 +416,12 @@ class RestUtils {
|
|
|
393
416
|
let event = new _Event.default(_ApplicationContext.default, viewId, message);
|
|
394
417
|
|
|
395
418
|
_Observable.default.fireEvent(_EventType.default.MESSAGE_ARRIVED, event);
|
|
419
|
+
|
|
420
|
+
if (component !== null) {
|
|
421
|
+
event = new _Event.default(component, viewId, message);
|
|
422
|
+
|
|
423
|
+
_Observable.default.fireEvent(_EventType.default.MESSAGE_ARRIVED, event);
|
|
424
|
+
}
|
|
396
425
|
}
|
|
397
426
|
|
|
398
427
|
successCallback(response);
|
package/dist/Utils.js
CHANGED
|
@@ -17,6 +17,12 @@ var _EventType = _interopRequireDefault(require("./event/EventType"));
|
|
|
17
17
|
|
|
18
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
19
|
|
|
20
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
21
|
+
|
|
22
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
23
|
+
|
|
24
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
25
|
+
|
|
20
26
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
21
27
|
|
|
22
28
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
@@ -165,6 +171,14 @@ class Utils {
|
|
|
165
171
|
return this.isNull(field.attributes[attribute]) ? defaultValue : field.attributes[attribute];
|
|
166
172
|
}
|
|
167
173
|
|
|
174
|
+
static getComponentStyleAttribute(field, attribute, defaultValue) {
|
|
175
|
+
if (this.isNull(field.attributes) || this.isNull(field.attributes.style)) {
|
|
176
|
+
return defaultValue;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
return this.isNull(field.attributes.style[attribute]) ? defaultValue : field.attributes.style[attribute];
|
|
180
|
+
}
|
|
181
|
+
|
|
168
182
|
static doGetRequestJson(currentPage, curretRowsPerPage, currentSearchParameters, paged) {
|
|
169
183
|
var request = {};
|
|
170
184
|
request.pageSize = curretRowsPerPage;
|
|
@@ -358,7 +372,33 @@ _defineProperty(Utils, "getPropertyChainPath", expression => {
|
|
|
358
372
|
return path;
|
|
359
373
|
});
|
|
360
374
|
|
|
361
|
-
_defineProperty(Utils, "
|
|
375
|
+
_defineProperty(Utils, "mergeStyles", (defaultStyle, config) => {
|
|
376
|
+
let configStyle = Utils.getComponentAttribute(config, 'style', null);
|
|
377
|
+
console.log(config.id);
|
|
378
|
+
console.log(configStyle);
|
|
379
|
+
|
|
380
|
+
if (configStyle) {
|
|
381
|
+
let properties = Object.getOwnPropertyNames(configStyle);
|
|
382
|
+
|
|
383
|
+
var _iterator = _createForOfIteratorHelper(properties),
|
|
384
|
+
_step;
|
|
385
|
+
|
|
386
|
+
try {
|
|
387
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
388
|
+
const property = _step.value;
|
|
389
|
+
defaultStyle[property] = configStyle[property];
|
|
390
|
+
}
|
|
391
|
+
} catch (err) {
|
|
392
|
+
_iterator.e(err);
|
|
393
|
+
} finally {
|
|
394
|
+
_iterator.f();
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
return defaultStyle;
|
|
399
|
+
});
|
|
400
|
+
|
|
401
|
+
_defineProperty(Utils, "publishSystemErrorMessage", (viewId, component = null) => {
|
|
362
402
|
let message = {
|
|
363
403
|
messageType: 'ERROR',
|
|
364
404
|
message: 'A system error has accured. Please try again later'
|
|
@@ -366,4 +406,10 @@ _defineProperty(Utils, "publishSystemErrorMessage", viewId => {
|
|
|
366
406
|
let event = new _Event.default(_ApplicationContext.default, viewId, message);
|
|
367
407
|
|
|
368
408
|
_Observable.default.fireEvent(_EventType.default.MESSAGE_ARRIVED, event);
|
|
409
|
+
|
|
410
|
+
if (component !== null) {
|
|
411
|
+
event = new _Event.default(component, viewId, message);
|
|
412
|
+
|
|
413
|
+
_Observable.default.fireEvent(_EventType.default.MESSAGE_ARRIVED, event);
|
|
414
|
+
}
|
|
369
415
|
});
|
|
@@ -17,6 +17,8 @@ var _Observable = _interopRequireDefault(require("../event/Observable"));
|
|
|
17
17
|
|
|
18
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
19
|
|
|
20
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
21
|
+
|
|
20
22
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
21
23
|
|
|
22
24
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -52,22 +54,49 @@ const AlertBar = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.f
|
|
|
52
54
|
let parsedConfig = _Utils.default.parseConfig(props.config, props.viewId);
|
|
53
55
|
|
|
54
56
|
let eventHandlingConfig = _Utils.default.isNull(parsedConfig.eventHandlingConfig) ? {} : parsedConfig.eventHandlingConfig;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
actionType: "script",
|
|
61
|
-
script: {
|
|
62
|
-
lines: ["@#{".concat(props.config.id, "}.message = $event.data.message"), "@#{".concat(props.config.id, "}.variant = $event.data.messageType === 'ERROR' ? 'danger' : $event.data.messageType === 'WARN' ? 'warning' : $event.data.messageType === 'SUCCESS' ? 'success' : 'info' ")]
|
|
63
|
-
}
|
|
64
|
-
}]
|
|
57
|
+
let defaultAction = {
|
|
58
|
+
actionType: "script",
|
|
59
|
+
script: {
|
|
60
|
+
lines: ["@#{".concat(props.config.id, "}.message = $event.data.message"), "@#{".concat(props.config.id, "}.variant = $event.data.messageType === 'ERROR' ? 'danger' : $event.data.messageType === 'WARN' ? 'warning' : $event.data.messageType === 'SUCCESS' ? 'success' : 'info' ")]
|
|
61
|
+
}
|
|
65
62
|
};
|
|
66
|
-
|
|
63
|
+
|
|
64
|
+
if (_Utils.default.isNull(eventHandlingConfig.subscriptions)) {
|
|
65
|
+
// Add default subscription
|
|
66
|
+
eventHandlingConfig.subscriptions = [];
|
|
67
|
+
let subscription = {
|
|
68
|
+
publisher: "applicationContext",
|
|
69
|
+
eventType: _EventType.default.MESSAGE_ARRIVED,
|
|
70
|
+
actions: [defaultAction]
|
|
71
|
+
};
|
|
72
|
+
eventHandlingConfig.subscriptions.push(subscription);
|
|
73
|
+
} else {
|
|
74
|
+
var _iterator = _createForOfIteratorHelper(eventHandlingConfig.subscriptions),
|
|
75
|
+
_step;
|
|
76
|
+
|
|
77
|
+
try {
|
|
78
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
79
|
+
const subscription = _step.value;
|
|
80
|
+
|
|
81
|
+
if (_Utils.default.isNull(subscription.actions)) {
|
|
82
|
+
subscription.actions = [];
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (subscription.actions.length === 0) {
|
|
86
|
+
subscription.actions.push(defaultAction);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
} catch (err) {
|
|
90
|
+
_iterator.e(err);
|
|
91
|
+
} finally {
|
|
92
|
+
_iterator.f();
|
|
93
|
+
}
|
|
94
|
+
}
|
|
67
95
|
|
|
68
96
|
_Observable.default.addSubscriptions(eventHandlingConfig, props.handle, props.viewId);
|
|
69
97
|
|
|
70
98
|
props.loadCompleteHandler(props.config.id);
|
|
99
|
+
setInitializing(false);
|
|
71
100
|
}
|
|
72
101
|
});
|
|
73
102
|
|