@agilemotion/oui-react-js 1.3.0 → 1.3.2
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 +151 -38
- package/dist/BasicApp.js +16 -9
- package/dist/BasicAppHome.js +6 -4
- package/dist/BusinessPortalApp.css +37 -0
- package/dist/BusinessPortalApp.js +115 -0
- package/dist/BusinessPortalAppHome.js +167 -0
- package/dist/RestUtils.js +12 -9
- package/dist/assets/css/black-dashboard-react.css +1 -2
- package/dist/assets/jss/components/footerStyle.js +7 -4
- package/dist/assets/jss/views/loginBasicStyle.js +0 -1
- package/dist/assets/jss/views/loginBusinessPortalStyle.js +76 -0
- package/dist/assets/scss/black-dashboard-react/bootstrap/_reboot.scss +0 -1
- package/dist/components/DocumentView.css +4 -0
- package/dist/components/DocumentViewer.js +93 -37
- package/dist/components/DocumentViewerComponent.js +93 -0
- package/dist/components/ElementResizeHandler.js +232 -0
- package/dist/components/Graph.js +120 -16
- package/dist/components/GraphNode.js +0 -2
- package/dist/components/HtmlPanel.js +45 -4
- package/dist/components/Icon.js +8 -0
- package/dist/components/SignaturePanel.js +118 -0
- package/dist/components/StepperTitleBar.css +85 -0
- package/dist/components/StepperTitleBar.js +190 -0
- package/dist/components/TitleBar.js +1 -1
- package/dist/components/Toolbar.js +6 -3
- package/dist/components/dashboard/{BasicBusinessApp.js → BasicBusinessAppDashboard.js} +17 -16
- package/dist/components/dashboard/BusinessPortalAppDashboard.css +5 -0
- package/dist/components/dashboard/BusinessPortalAppDashboard.js +191 -0
- package/dist/components/dashboard/components/blackDashboard/sidebar/Sidebar.js +23 -12
- package/dist/components/dashboard/components/portal/Timeline.js +17 -0
- package/dist/components/dashboard/components/portal/Workspace.css +25 -0
- package/dist/components/dashboard/components/portal/Workspace.js +48 -0
- package/dist/components/dashboard/components/portal/portal-dashboard.css +25 -0
- package/dist/components/footer/Footer.js +43 -10
- package/dist/components/form/BaseField.js +11 -2
- package/dist/components/form/DatePicker.js +62 -1
- package/dist/components/form/FieldSet.js +1 -1
- package/dist/components/form/Form.js +28 -8
- package/dist/components/form/SelectItem.js +10 -3
- package/dist/components/form/UploadField.js +122 -44
- package/dist/components/layout/Layout.js +30 -15
- package/dist/components/layout/ViewPort.js +3 -2
- package/dist/components/menu/MenuLink.js +7 -0
- package/dist/components/navbars/HomeNavbar.js +0 -10
- package/dist/components/navbars/PortalNavbar.css +75 -0
- package/dist/components/navbars/PortalNavbar.js +138 -0
- package/dist/components/signatures/AlertItem.js +71 -0
- package/dist/components/signatures/Card.js +39 -0
- package/dist/components/signatures/MenuButton.js +108 -0
- package/dist/components/signatures/Prompt.js +78 -0
- package/dist/components/signatures/ResponsiveTable.css +91 -0
- package/dist/components/signatures/ResponsiveTable.js +568 -0
- package/dist/components/signatures/SearchView.js +236 -0
- package/dist/components/signatures/SignatorySearch.js +115 -0
- package/dist/components/signatures/SignatorySearchForm.js +77 -0
- package/dist/components/signatures/SignatureInputProps.js +336 -0
- package/dist/components/signatures/SignatureTemplateDesigner.js +890 -0
- package/dist/components/signatures/Toolbar.js +208 -0
- package/dist/components/signatures/ViewUtils.js +309 -0
- package/dist/components/signatures/widgets.css +126 -0
- package/dist/event/RouteActionHandler.js +1 -1
- package/dist/view/Dashboard.js +17 -13
- package/dist/view/PortalDashboard.js +33 -0
- package/dist/view/security/ChangePasswordBasic.js +1 -0
- package/dist/view/security/ForgotPasswordBasic.js +1 -0
- package/dist/view/security/LoginBasic.js +6 -1
- package/dist/view/security/LoginBusinessPortal.js +267 -0
- package/dist/view/security/ResetPasswordBasic.js +1 -0
- package/package.json +26 -24
- package/dist/assets/img/flogo.png +0 -0
- package/dist/components/SignatureTemplateDesigner.js +0 -168
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
|
|
10
|
+
var _reactRedux = require("react-redux");
|
|
11
|
+
|
|
12
|
+
var _reactRouterDom = require("react-router-dom");
|
|
13
|
+
|
|
14
|
+
var _redux = require("redux");
|
|
15
|
+
|
|
16
|
+
var _DashboardStore = require("./redux/store/DashboardStore");
|
|
17
|
+
|
|
18
|
+
var _LoadingIndicator = _interopRequireDefault(require("./components/LoadingIndicator"));
|
|
19
|
+
|
|
20
|
+
var _BusinessPortalAppDashboard = _interopRequireDefault(require("./components/dashboard/BusinessPortalAppDashboard"));
|
|
21
|
+
|
|
22
|
+
var _ApplicationContext = _interopRequireWildcard(require("./ApplicationContext"));
|
|
23
|
+
|
|
24
|
+
var _TokenManager = _interopRequireDefault(require("./security/TokenManager"));
|
|
25
|
+
|
|
26
|
+
var _Utils = _interopRequireDefault(require("./Utils"));
|
|
27
|
+
|
|
28
|
+
var _core = require("@material-ui/core");
|
|
29
|
+
|
|
30
|
+
var _ThemeProvider = _interopRequireDefault(require("@material-ui/styles/ThemeProvider"));
|
|
31
|
+
|
|
32
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
33
|
+
|
|
34
|
+
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
35
|
+
|
|
36
|
+
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
37
|
+
|
|
38
|
+
const location = window.location.protocol + "//" + window.location.hostname;
|
|
39
|
+
|
|
40
|
+
const propHandler = state => {
|
|
41
|
+
let isLoading = state.dashboard.isLoading;
|
|
42
|
+
let dashboardSettings = state.dashboard.dashboardSettings;
|
|
43
|
+
return {
|
|
44
|
+
isLoading: isLoading,
|
|
45
|
+
error: state.error,
|
|
46
|
+
dashboardSettings: dashboardSettings
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
class BusinessPortalAppHome extends _react.Component {
|
|
51
|
+
constructor(props) {
|
|
52
|
+
super(props);
|
|
53
|
+
this.state = {
|
|
54
|
+
dashboardSettings: null,
|
|
55
|
+
message: "",
|
|
56
|
+
open: false,
|
|
57
|
+
avatarUrl: null,
|
|
58
|
+
tokenRefreshMonitorStarted: false
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
componentDidMount() {
|
|
63
|
+
_ApplicationContext.default.setApplicationHistory(this.props.history);
|
|
64
|
+
|
|
65
|
+
_ApplicationContext.default.setServiceApiPath(this.props.serviceApiPath);
|
|
66
|
+
|
|
67
|
+
_ApplicationContext.default.setUIConfigPath(this.props.uiConfigPath);
|
|
68
|
+
|
|
69
|
+
_ApplicationContext.default.setContextRoot(this.props.contextRoot);
|
|
70
|
+
|
|
71
|
+
_ApplicationContext.default.setBaseApiUrl(this.props.baseApiUrl);
|
|
72
|
+
|
|
73
|
+
_ApplicationContext.default.setFilesApiPath(this.props.filesApiPath);
|
|
74
|
+
|
|
75
|
+
this.props.getDashboardSettings(location + this.props.contextRoot + this.props.baseApiUrl + "/ui/setup");
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
componentDidUpdate(prevProps) {
|
|
79
|
+
if (JSON.stringify(prevProps.dashboardSettings) !== JSON.stringify(this.props.dashboardSettings) && !this.props.error) {
|
|
80
|
+
this.setState({
|
|
81
|
+
dashboardSettings: this.props.dashboardSettings
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
if (!this.state.tokenRefreshMonitorStarted && !_Utils.default.isNull(this.props.dashboardSettings)) {
|
|
85
|
+
_TokenManager.default.startTokenRefreshMonitor(location + this.props.contextRoot + this.props.authUrl + "/refresh", this.props.dashboardSettings.userName);
|
|
86
|
+
|
|
87
|
+
this.setState({
|
|
88
|
+
tokenRefreshMonitorStarted: true
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
if (!_Utils.default.isNull(this.props.dashboardSettings.userAvatar)) {
|
|
92
|
+
this.setState({
|
|
93
|
+
avatarUrl: this.props.dashboardSettings.userAvatar.url
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
let avatarListener = {};
|
|
98
|
+
avatarListener.type = _ApplicationContext.AVATAR_LISTENER_TYPE;
|
|
99
|
+
|
|
100
|
+
avatarListener.handler = avatar => {
|
|
101
|
+
this.setState({
|
|
102
|
+
avatarUrl: avatar.url
|
|
103
|
+
});
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
_ApplicationContext.default.addApplicationListener(avatarListener);
|
|
107
|
+
|
|
108
|
+
_ApplicationContext.default.setApplicationThemeColors(this.props.dashboardSettings.primaryColor, this.props.dashboardSettings.secondaryColor);
|
|
109
|
+
|
|
110
|
+
this.setState({
|
|
111
|
+
loadingColor: this.props.dashboardSettings.primaryColor
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (prevProps.error !== this.props.error && this.props.error) {
|
|
117
|
+
this.setState({
|
|
118
|
+
message: "A system error has accured"
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
logout() {
|
|
124
|
+
sessionStorage.removeItem("accessToken");
|
|
125
|
+
sessionStorage.removeItem("refreshToken");
|
|
126
|
+
sessionStorage.removeItem("idToken");
|
|
127
|
+
sessionStorage.removeItem("lastLogin");
|
|
128
|
+
|
|
129
|
+
_ApplicationContext.default.clear();
|
|
130
|
+
|
|
131
|
+
this.props.history.push('/login');
|
|
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));
|
|
166
|
+
|
|
167
|
+
exports.default = _default;
|
package/dist/RestUtils.js
CHANGED
|
@@ -43,7 +43,7 @@ const json = response => {
|
|
|
43
43
|
|
|
44
44
|
class RestUtils {
|
|
45
45
|
invokeRest(service, component, viewId, successCallback, errorCallback, invalidParamCallback, returnValueBinding, successMessage) {
|
|
46
|
-
let url = service.url.startsWith('http://') || service.url.startsWith('https://') ? service.url : location + "
|
|
46
|
+
let url = service.url.startsWith('http://') || service.url.startsWith('https://') ? service.url : location + "".concat(_ApplicationContext.default.getContextRoot() + service.url);
|
|
47
47
|
let requestBody = null;
|
|
48
48
|
|
|
49
49
|
if (!_Utils.default.isNull(service.parameters)) {
|
|
@@ -97,9 +97,7 @@ class RestUtils {
|
|
|
97
97
|
|
|
98
98
|
if (httpParameterType === 'PATH_VARIABLE') {
|
|
99
99
|
if (!_Utils.default.isNull(parameterValue)) {
|
|
100
|
-
|
|
101
|
-
pathParameters += '/' + JSON.stringify(parameterValue.value);
|
|
102
|
-
}
|
|
100
|
+
pathParameters += '/' + (typeof parameterValue.value === 'object' ? JSON.stringify(parameterValue.value) : parameterValue.value);
|
|
103
101
|
}
|
|
104
102
|
}
|
|
105
103
|
|
|
@@ -114,7 +112,9 @@ class RestUtils {
|
|
|
114
112
|
if (parameterValue.type === 'MapObject') {
|
|
115
113
|
requestBody.type = 'MapEntityDto';
|
|
116
114
|
} else {
|
|
117
|
-
requestBody
|
|
115
|
+
if (typeof requestBody === 'object') {
|
|
116
|
+
requestBody.type = parameterValue.type;
|
|
117
|
+
}
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
}
|
|
@@ -143,7 +143,12 @@ class RestUtils {
|
|
|
143
143
|
contentType = headers['Content-Type'];
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
-
if (requestBody !== null) {
|
|
146
|
+
if (requestBody !== null && service.method === 'GET') {
|
|
147
|
+
console.error("A request body parameter cannot be specified for a GET request");
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if (requestBody !== null || service.method === 'POST') {
|
|
147
152
|
postData(url, response => {
|
|
148
153
|
let responseData = !_Utils.default.isNull(response) ? response.data : null;
|
|
149
154
|
|
|
@@ -250,8 +255,6 @@ class RestUtils {
|
|
|
250
255
|
}
|
|
251
256
|
}
|
|
252
257
|
}, e => {
|
|
253
|
-
console.error(e);
|
|
254
|
-
|
|
255
258
|
if (errorCallback !== null) {
|
|
256
259
|
errorCallback(e);
|
|
257
260
|
}
|
|
@@ -413,7 +416,7 @@ const postData = (url, successCallback, errorCallback, secure, data) => {
|
|
|
413
416
|
exports.postData = postData;
|
|
414
417
|
|
|
415
418
|
const sendRequest = (url, successCallback, errorCallback, secure, track) => {
|
|
416
|
-
instance.doFetch(url, successCallback, errorCallback, secure, null, null, null, null, null,
|
|
419
|
+
instance.doFetch(url, successCallback, errorCallback, secure, null, null, null, null, null, track);
|
|
417
420
|
};
|
|
418
421
|
|
|
419
422
|
exports.sendRequest = sendRequest;
|
|
@@ -16,23 +16,26 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
16
16
|
const footerStyle = {
|
|
17
17
|
block: {},
|
|
18
18
|
left: {
|
|
19
|
-
float: "left!important"
|
|
20
|
-
display: "block"
|
|
19
|
+
float: "left !important"
|
|
21
20
|
},
|
|
22
21
|
right: {
|
|
23
22
|
margin: "0",
|
|
24
23
|
fontSize: "14px",
|
|
25
|
-
float: "right!important",
|
|
24
|
+
float: "right !important",
|
|
26
25
|
padding: "15px",
|
|
27
26
|
paddingRight: "70px"
|
|
28
27
|
},
|
|
29
28
|
footer: _objectSpread(_objectSpread({
|
|
30
29
|
bottom: "0",
|
|
31
|
-
borderTop: "1px solid " + _rootStyle.grayColor[15],
|
|
32
30
|
padding: "15px 0"
|
|
33
31
|
}, _rootStyle.defaultFont), {}, {
|
|
34
32
|
zIndex: 4
|
|
35
33
|
}),
|
|
34
|
+
wrapper: {
|
|
35
|
+
display: "inline-block",
|
|
36
|
+
textAlign: '-webkit-center',
|
|
37
|
+
width: '100%'
|
|
38
|
+
},
|
|
36
39
|
container: _objectSpread(_objectSpread({
|
|
37
40
|
zIndex: 3
|
|
38
41
|
}, _rootStyle.container), {}, {
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _colors = require("material-ui/styles/colors");
|
|
9
|
+
|
|
10
|
+
const styles = {
|
|
11
|
+
title: {
|
|
12
|
+
minWidth: 320,
|
|
13
|
+
maxWidth: 400,
|
|
14
|
+
height: 'auto',
|
|
15
|
+
fontSize: '30px'
|
|
16
|
+
},
|
|
17
|
+
loginContainer: {
|
|
18
|
+
minWidth: 320,
|
|
19
|
+
maxWidth: 400,
|
|
20
|
+
padding: '16px',
|
|
21
|
+
height: 'auto'
|
|
22
|
+
},
|
|
23
|
+
paper: {
|
|
24
|
+
padding: 20,
|
|
25
|
+
overflow: 'auto'
|
|
26
|
+
},
|
|
27
|
+
buttonsDiv: {
|
|
28
|
+
display: "inline-block",
|
|
29
|
+
textAlign: "center",
|
|
30
|
+
marginTop: '8px'
|
|
31
|
+
},
|
|
32
|
+
flatButton: {
|
|
33
|
+
color: _colors.grey500
|
|
34
|
+
},
|
|
35
|
+
checkRemember: {
|
|
36
|
+
style: {
|
|
37
|
+
float: 'left',
|
|
38
|
+
maxWidth: 180,
|
|
39
|
+
paddingTop: 5
|
|
40
|
+
},
|
|
41
|
+
labelStyle: {
|
|
42
|
+
color: _colors.grey500
|
|
43
|
+
},
|
|
44
|
+
iconStyle: {
|
|
45
|
+
color: _colors.grey500,
|
|
46
|
+
borderColor: _colors.grey500,
|
|
47
|
+
fill: _colors.grey500
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
componentWrapper: {
|
|
51
|
+
display: "inline",
|
|
52
|
+
textAlign: "center"
|
|
53
|
+
},
|
|
54
|
+
loginBtn: {
|
|
55
|
+
float: 'right'
|
|
56
|
+
},
|
|
57
|
+
btn: {
|
|
58
|
+
background: '#4f81e9',
|
|
59
|
+
color: _colors.white,
|
|
60
|
+
padding: 7,
|
|
61
|
+
borderRadius: 2,
|
|
62
|
+
margin: 2,
|
|
63
|
+
fontSize: 13
|
|
64
|
+
},
|
|
65
|
+
btnFacebook: {
|
|
66
|
+
background: '#4f81e9'
|
|
67
|
+
},
|
|
68
|
+
btnGoogle: {
|
|
69
|
+
background: '#e14441'
|
|
70
|
+
},
|
|
71
|
+
btnSpan: {
|
|
72
|
+
marginLeft: 5
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
var _default = styles;
|
|
76
|
+
exports.default = _default;
|
|
@@ -7,10 +7,22 @@ exports.default = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
|
|
10
|
-
var _reactPdf = require("react-pdf");
|
|
11
|
-
|
|
12
10
|
var _Utils = _interopRequireDefault(require("../Utils"));
|
|
13
11
|
|
|
12
|
+
var _Observable = _interopRequireDefault(require("../event/Observable"));
|
|
13
|
+
|
|
14
|
+
var _ApplicationContext = _interopRequireDefault(require("../ApplicationContext"));
|
|
15
|
+
|
|
16
|
+
var _RestUtils = require("../RestUtils");
|
|
17
|
+
|
|
18
|
+
var _ServiceCallActionHandler = _interopRequireDefault(require("../event/ServiceCallActionHandler"));
|
|
19
|
+
|
|
20
|
+
var _DynamicJS = _interopRequireDefault(require("../DynamicJS"));
|
|
21
|
+
|
|
22
|
+
require("./DocumentView.css");
|
|
23
|
+
|
|
24
|
+
var _DocumentViewerComponent = _interopRequireDefault(require("./DocumentViewerComponent"));
|
|
25
|
+
|
|
14
26
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
27
|
|
|
16
28
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
@@ -25,49 +37,93 @@ function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(
|
|
|
25
37
|
|
|
26
38
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
27
39
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
pageNumber = _React$useState2[0];
|
|
40
|
+
const DocumentViewer = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
41
|
+
const _React$useState = _react.default.useState(true),
|
|
42
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
43
|
+
initializing = _React$useState2[0],
|
|
44
|
+
setInitializing = _React$useState2[1];
|
|
34
45
|
|
|
35
46
|
const _React$useState3 = _react.default.useState(null),
|
|
36
47
|
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
37
|
-
|
|
38
|
-
|
|
48
|
+
value = _React$useState4[0],
|
|
49
|
+
setValue = _React$useState4[1];
|
|
50
|
+
|
|
51
|
+
_react.default.useEffect(() => {
|
|
52
|
+
props.handle.api = api();
|
|
53
|
+
|
|
54
|
+
if (initializing) {
|
|
55
|
+
let parsedConfig = _Utils.default.parseConfig(props.config, props.viewId);
|
|
39
56
|
|
|
40
|
-
|
|
41
|
-
numPages
|
|
42
|
-
}) => {
|
|
43
|
-
setNumPages(numPages);
|
|
57
|
+
_Observable.default.addSubscriptions(parsedConfig.eventHandlingConfig, props.handle, props.viewId);
|
|
44
58
|
|
|
45
|
-
|
|
46
|
-
|
|
59
|
+
_Observable.default.addSystemSubscriptions(parsedConfig);
|
|
60
|
+
|
|
61
|
+
setInitializing(false);
|
|
62
|
+
|
|
63
|
+
if (!_Utils.default.isNull(props.loadCompleteHandler)) {
|
|
64
|
+
props.loadCompleteHandler(props.config.id);
|
|
65
|
+
}
|
|
47
66
|
}
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
const api = () => {
|
|
70
|
+
return {
|
|
71
|
+
get id() {
|
|
72
|
+
return props.config.id;
|
|
73
|
+
},
|
|
74
|
+
|
|
75
|
+
loadData: actionConfig => {
|
|
76
|
+
if (!_Utils.default.isNull(actionConfig) && !_Utils.default.isNull(actionConfig.value)) {
|
|
77
|
+
let value = _ApplicationContext.default.isExpression(actionConfig.value) ? _ApplicationContext.default.resolveExpressionValue(actionConfig.value) : actionConfig.value; // TODO : set value
|
|
78
|
+
} else {
|
|
79
|
+
let service = !_Utils.default.isNull(props.config.dataService) ? props.config.dataService : actionConfig !== null ? actionConfig.dataService : null;
|
|
80
|
+
let componentValue = !_Utils.default.isNull(props.config.value) ? props.config.value : actionConfig !== null ? actionConfig.value : null;
|
|
81
|
+
|
|
82
|
+
if (!_Utils.default.isNull(service)) {
|
|
83
|
+
if (service.type === 'remoteObjectProxy') {
|
|
84
|
+
(0, _RestUtils.invokeRpc)(service, props.handle, props.viewId, result => {}, e => {}, parameter => {});
|
|
85
|
+
} else {
|
|
86
|
+
if (_Utils.default.isNull(actionConfig)) {
|
|
87
|
+
actionConfig = {};
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
actionConfig.service = service; // TODO : Implement the invalid paramenter callback
|
|
91
|
+
|
|
92
|
+
_ServiceCallActionHandler.default.execute(actionConfig, null, null, props.viewId, data => {
|
|
93
|
+
let file = {};
|
|
94
|
+
file.base64 = data.payloadBase64;
|
|
95
|
+
file.type = props.config.fileType;
|
|
96
|
+
setValue(file);
|
|
97
|
+
}, () => {});
|
|
98
|
+
}
|
|
99
|
+
} else {
|
|
100
|
+
if (!_Utils.default.isNull(componentValue)) {
|
|
101
|
+
if (_ApplicationContext.default.isExpression(componentValue)) {
|
|
102
|
+
let path = _Utils.default.getPropertyChainPath(componentValue);
|
|
103
|
+
|
|
104
|
+
if (!_Utils.default.isNull(path.valueObject)) {
|
|
105
|
+
_Observable.default.addSystemGeneratedSubscription(props.viewId, props.config.id, () => {
|
|
106
|
+
let value = _DynamicJS.default.executeScript("".concat(props.config.id, "ValueEvaluator"), componentValue);
|
|
107
|
+
|
|
108
|
+
if (!_Utils.default.isNull(value)) {// TODO : set value
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
};
|
|
48
118
|
};
|
|
49
119
|
|
|
50
|
-
return /*#__PURE__*/_react.default.createElement("div",
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}, props.file.type === "application/pdf" ? /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_reactPdf.Document, {
|
|
58
|
-
width: "100px",
|
|
59
|
-
file: props.file.base64,
|
|
60
|
-
onLoadSuccess: onDocumentLoadSuccess
|
|
61
|
-
}, /*#__PURE__*/_react.default.createElement(_reactPdf.Page, {
|
|
62
|
-
pageNumber: pageNumber
|
|
63
|
-
})), /*#__PURE__*/_react.default.createElement("p", null, "Page ", pageNumber, " of ", numPages)) : /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("img", {
|
|
64
|
-
src: props.file.base64,
|
|
65
|
-
style: {
|
|
66
|
-
width: "98%"
|
|
67
|
-
},
|
|
68
|
-
alt: ''
|
|
69
|
-
}), props.onDocumentLoadSuccess(1))) : null);
|
|
70
|
-
};
|
|
120
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
121
|
+
ref: ref
|
|
122
|
+
}, !_Utils.default.isNull(value) ? /*#__PURE__*/_react.default.createElement(_DocumentViewerComponent.default, {
|
|
123
|
+
file: value,
|
|
124
|
+
onDocumentLoadSuccess: () => {}
|
|
125
|
+
}) : null);
|
|
126
|
+
}));
|
|
71
127
|
|
|
72
128
|
var _default = DocumentViewer;
|
|
73
129
|
exports.default = _default;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _reactPdf = require("react-pdf");
|
|
11
|
+
|
|
12
|
+
var _Utils = _interopRequireDefault(require("../Utils"));
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
|
|
16
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
17
|
+
|
|
18
|
+
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."); }
|
|
19
|
+
|
|
20
|
+
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); }
|
|
21
|
+
|
|
22
|
+
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; }
|
|
23
|
+
|
|
24
|
+
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; }
|
|
25
|
+
|
|
26
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
27
|
+
|
|
28
|
+
_reactPdf.pdfjs.GlobalWorkerOptions.workerSrc = "//cdnjs.cloudflare.com/ajax/libs/pdf.js/".concat(_reactPdf.pdfjs.version, "/pdf.worker.js");
|
|
29
|
+
|
|
30
|
+
const DocumentViewerComponent = props => {
|
|
31
|
+
const _React$useState = _react.default.useState(1),
|
|
32
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
33
|
+
pageNumber = _React$useState2[0],
|
|
34
|
+
setPageNumber = _React$useState2[1];
|
|
35
|
+
|
|
36
|
+
const _React$useState3 = _react.default.useState(null),
|
|
37
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
38
|
+
numPages = _React$useState4[0],
|
|
39
|
+
setNumPages = _React$useState4[1];
|
|
40
|
+
|
|
41
|
+
const onDocumentLoadSuccess = ({
|
|
42
|
+
numPages
|
|
43
|
+
}) => {
|
|
44
|
+
setNumPages(numPages);
|
|
45
|
+
|
|
46
|
+
if (!_Utils.default.isNull(props.onDocumentLoadSuccess)) {
|
|
47
|
+
props.onDocumentLoadSuccess(numPages);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const changePage = offset => {
|
|
52
|
+
setPageNumber(pageNumber + offset);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const previousPage = () => {
|
|
56
|
+
changePage(-1);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const nextPage = () => {
|
|
60
|
+
changePage(1);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
return /*#__PURE__*/_react.default.createElement("div", null, !_Utils.default.isNull(props.file) ? /*#__PURE__*/_react.default.createElement("div", {
|
|
64
|
+
style: {
|
|
65
|
+
borderRadius: "4px",
|
|
66
|
+
padding: "16px",
|
|
67
|
+
margin: "16px",
|
|
68
|
+
width: "calc(100% - 32px)"
|
|
69
|
+
}
|
|
70
|
+
}, props.file.type === "application/pdf" ? /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_reactPdf.Document, {
|
|
71
|
+
file: "data:application/pdf;base64," + props.file.base64,
|
|
72
|
+
onLoadSuccess: onDocumentLoadSuccess
|
|
73
|
+
}, /*#__PURE__*/_react.default.createElement(_reactPdf.Page, {
|
|
74
|
+
pageNumber: pageNumber
|
|
75
|
+
})), /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("p", null, "Page ", pageNumber || (numPages ? 1 : "--"), " of", " ", numPages || "--"), /*#__PURE__*/_react.default.createElement("button", {
|
|
76
|
+
type: "button",
|
|
77
|
+
disabled: pageNumber <= 1,
|
|
78
|
+
onClick: previousPage
|
|
79
|
+
}, "Previous"), /*#__PURE__*/_react.default.createElement("button", {
|
|
80
|
+
type: "button",
|
|
81
|
+
disabled: pageNumber >= numPages,
|
|
82
|
+
onClick: nextPage
|
|
83
|
+
}, "Next"))) : /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("img", {
|
|
84
|
+
src: props.file.base64,
|
|
85
|
+
style: {
|
|
86
|
+
width: "98%"
|
|
87
|
+
},
|
|
88
|
+
alt: ''
|
|
89
|
+
}), props.onDocumentLoadSuccess(1))) : null);
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
var _default = DocumentViewerComponent;
|
|
93
|
+
exports.default = _default;
|