@agilemotion/oui-react-js 1.2.9 → 1.3.1
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 -36
- package/dist/BasicApp.js +4 -4
- package/dist/BasicAppHome.js +4 -2
- package/dist/RestUtils.js +11 -4
- package/dist/assets/css/black-dashboard-react.css +1 -2
- 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 +102 -6
- package/dist/components/GraphNode.js +1 -1
- package/dist/components/HtmlPanel.js +45 -4
- package/dist/components/StepperTitleBar.css +85 -0
- package/dist/components/StepperTitleBar.js +188 -0
- package/dist/components/TitleBar.js +1 -1
- package/dist/components/Toolbar.js +6 -3
- package/dist/components/form/Form.js +2 -2
- package/dist/components/form/UploadField.js +1 -1
- package/dist/components/layout/Layout.js +28 -14
- 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 +888 -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/package.json +5 -4
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default = exports.TEMPLATE_TOKEN_REGEX = exports.SYSTEM_EVENT = exports.AVATAR_LISTENER_TYPE = exports.APP_VARIABLE = void 0;
|
|
6
|
+
exports.default = exports.LEGEND_ARROW_ICON = exports.TEMPLATE_TOKEN_REGEX = exports.SYSTEM_EVENT = exports.AVATAR_LISTENER_TYPE = exports.APP_VARIABLE = void 0;
|
|
7
7
|
|
|
8
8
|
var _Observable = _interopRequireDefault(require("./event/Observable"));
|
|
9
9
|
|
|
@@ -41,6 +41,8 @@ const SYSTEM_EVENT = 'SYSTEM_EVENT';
|
|
|
41
41
|
exports.SYSTEM_EVENT = SYSTEM_EVENT;
|
|
42
42
|
const TEMPLATE_TOKEN_REGEX = new RegExp('(([$]{1}[{]{1})(([a-zA-Z0-9_$.@#{}[\\]]*)+){1}([}]{1}))+', 'g');
|
|
43
43
|
exports.TEMPLATE_TOKEN_REGEX = TEMPLATE_TOKEN_REGEX;
|
|
44
|
+
const LEGEND_ARROW_ICON = " <i class=\"fa fa-arrow-right fa-xs\" aria-hidden=\"true\" style='color:__COLOR__'></i> ";
|
|
45
|
+
exports.LEGEND_ARROW_ICON = LEGEND_ARROW_ICON;
|
|
44
46
|
|
|
45
47
|
class ApplicationContext {
|
|
46
48
|
constructor() {
|
|
@@ -70,16 +72,16 @@ class ApplicationContext {
|
|
|
70
72
|
|
|
71
73
|
_defineProperty(this, "updateAppBarTitle", (viewId, title) => {
|
|
72
74
|
let view = this.getView(viewId);
|
|
75
|
+
let legendIconArrow = LEGEND_ARROW_ICON.replace('__COLOR__', this.props.secondaryColor);
|
|
76
|
+
let titleValue = '';
|
|
73
77
|
|
|
74
|
-
if (!
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
} else {
|
|
80
|
-
titleValue = _DynamicJS.default.executeScript(viewId + 'Title', title, viewId);
|
|
81
|
-
}
|
|
78
|
+
if (!title.match(_DynamicJS.TEMPLATE_REGEX)) {
|
|
79
|
+
titleValue = title;
|
|
80
|
+
} else {
|
|
81
|
+
titleValue = _DynamicJS.default.executeScript(viewId + 'Title', title, viewId);
|
|
82
|
+
}
|
|
82
83
|
|
|
84
|
+
if (!view.popUp && this.graphs.length === 0) {
|
|
83
85
|
var _iterator = _createForOfIteratorHelper(this.navHistory),
|
|
84
86
|
_step;
|
|
85
87
|
|
|
@@ -109,7 +111,7 @@ class ApplicationContext {
|
|
|
109
111
|
legendValue += "".concat(navHistoryElement.title);
|
|
110
112
|
|
|
111
113
|
if (counter++ < this.navHistory.length - 1) {
|
|
112
|
-
legendValue +=
|
|
114
|
+
legendValue += legendIconArrow;
|
|
113
115
|
}
|
|
114
116
|
}
|
|
115
117
|
} catch (err) {
|
|
@@ -120,9 +122,21 @@ class ApplicationContext {
|
|
|
120
122
|
|
|
121
123
|
legendValue += "</span>";
|
|
122
124
|
this.props.appBarTitle = legendValue;
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
125
|
+
} else if (!view.popUp) {
|
|
126
|
+
this.props.appBarTitle = "".concat(this.navHistory[0].title).concat(legendIconArrow, "<span>").concat(this.graphs[0].title, "</span>");
|
|
127
|
+
this.graphs[0].setCurrentNodeTitle(titleValue);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
let property = {};
|
|
131
|
+
property.name = 'title';
|
|
132
|
+
property.value = this.props.appBarTitle;
|
|
133
|
+
let event = new _Event.default(this, SYSTEM_EVENT, property);
|
|
134
|
+
|
|
135
|
+
_Observable.default.fireEvent(_EventType.default.APPLICATION_CONTEXT_CHANGE, event);
|
|
136
|
+
|
|
137
|
+
if (!view.popUp && this.graphs.length > 0) {
|
|
138
|
+
property = {};
|
|
139
|
+
property.name = 'stepperTitle';
|
|
126
140
|
let event = new _Event.default(this, SYSTEM_EVENT, property);
|
|
127
141
|
|
|
128
142
|
_Observable.default.fireEvent(_EventType.default.APPLICATION_CONTEXT_CHANGE, event);
|
|
@@ -420,7 +434,38 @@ class ApplicationContext {
|
|
|
420
434
|
let idToken = tokens[0];
|
|
421
435
|
|
|
422
436
|
if (isComponent) {
|
|
423
|
-
|
|
437
|
+
let value = this.resolveComponentApi(expresionContent);
|
|
438
|
+
let index = expression.indexOf('}.');
|
|
439
|
+
|
|
440
|
+
if (index > 0) {
|
|
441
|
+
let propertyChain = expression.substring(index + 2);
|
|
442
|
+
let props = propertyChain.split(".");
|
|
443
|
+
|
|
444
|
+
var _iterator11 = _createForOfIteratorHelper(props),
|
|
445
|
+
_step11;
|
|
446
|
+
|
|
447
|
+
try {
|
|
448
|
+
for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
|
|
449
|
+
const prop = _step11.value;
|
|
450
|
+
|
|
451
|
+
if (_Utils.default.isNull(value)) {
|
|
452
|
+
return null;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
value = value[prop];
|
|
456
|
+
|
|
457
|
+
if (typeof value === 'function') {
|
|
458
|
+
value = value();
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
} catch (err) {
|
|
462
|
+
_iterator11.e(err);
|
|
463
|
+
} finally {
|
|
464
|
+
_iterator11.f();
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
return value;
|
|
424
469
|
} else if (isLib) {
|
|
425
470
|
if (idToken === 'view') {
|
|
426
471
|
idToken = this.getCurrentView().config.id + '_lib';
|
|
@@ -569,7 +614,7 @@ class ApplicationContext {
|
|
|
569
614
|
}
|
|
570
615
|
|
|
571
616
|
getBaseApiUrl() {
|
|
572
|
-
return this.props.baseApiUrl;
|
|
617
|
+
return this.props.contextRoot + this.props.baseApiUrl;
|
|
573
618
|
}
|
|
574
619
|
|
|
575
620
|
setServiceApiPath(serviceApiPath) {
|
|
@@ -584,6 +629,14 @@ class ApplicationContext {
|
|
|
584
629
|
this.props.uiConfigPath = uiConfigPath;
|
|
585
630
|
}
|
|
586
631
|
|
|
632
|
+
setContextRoot(contextRoot) {
|
|
633
|
+
this.props.contextRoot = contextRoot;
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
getContextRoot() {
|
|
637
|
+
return this.props.contextRoot;
|
|
638
|
+
}
|
|
639
|
+
|
|
587
640
|
getUIConfigPath() {
|
|
588
641
|
return this.props.uiConfigPath;
|
|
589
642
|
}
|
|
@@ -601,21 +654,21 @@ class ApplicationContext {
|
|
|
601
654
|
}
|
|
602
655
|
|
|
603
656
|
refreshUserAvatar(avatar) {
|
|
604
|
-
var
|
|
605
|
-
|
|
657
|
+
var _iterator12 = _createForOfIteratorHelper(this.listeners),
|
|
658
|
+
_step12;
|
|
606
659
|
|
|
607
660
|
try {
|
|
608
|
-
for (
|
|
609
|
-
const listener =
|
|
661
|
+
for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
|
|
662
|
+
const listener = _step12.value;
|
|
610
663
|
|
|
611
664
|
if (listener.type === AVATAR_LISTENER_TYPE) {
|
|
612
665
|
listener.handler(avatar);
|
|
613
666
|
}
|
|
614
667
|
}
|
|
615
668
|
} catch (err) {
|
|
616
|
-
|
|
669
|
+
_iterator12.e(err);
|
|
617
670
|
} finally {
|
|
618
|
-
|
|
671
|
+
_iterator12.f();
|
|
619
672
|
}
|
|
620
673
|
}
|
|
621
674
|
|
|
@@ -650,37 +703,38 @@ class ApplicationContext {
|
|
|
650
703
|
if (isParent && !isPopup) {
|
|
651
704
|
this.navHistory.splice(0, this.navHistory.length);
|
|
652
705
|
|
|
653
|
-
var
|
|
654
|
-
|
|
706
|
+
var _iterator13 = _createForOfIteratorHelper(this.views),
|
|
707
|
+
_step13;
|
|
655
708
|
|
|
656
709
|
try {
|
|
657
|
-
for (
|
|
658
|
-
const contextView =
|
|
710
|
+
for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
|
|
711
|
+
const contextView = _step13.value;
|
|
659
712
|
this.closeView(contextView.handle.api.id, false);
|
|
660
713
|
}
|
|
661
714
|
} catch (err) {
|
|
662
|
-
|
|
715
|
+
_iterator13.e(err);
|
|
663
716
|
} finally {
|
|
664
|
-
|
|
717
|
+
_iterator13.f();
|
|
665
718
|
}
|
|
666
719
|
|
|
667
720
|
this.getViewPortHistory().push("/switch");
|
|
668
|
-
let graph = new _Graph.default(_Utils.default.parseConfig(config));
|
|
669
|
-
graph.init();
|
|
670
|
-
this.graphs.push(graph);
|
|
671
721
|
}
|
|
722
|
+
|
|
723
|
+
let graph = new _Graph.default(_Utils.default.parseConfig(config));
|
|
724
|
+
graph.init();
|
|
725
|
+
this.graphs.push(graph);
|
|
672
726
|
}
|
|
673
727
|
|
|
674
728
|
signalGraph(id, event) {
|
|
675
729
|
if (this.graphs.length > 0) {
|
|
676
730
|
let graphToSignal = this.graphs[0];
|
|
677
731
|
|
|
678
|
-
var
|
|
679
|
-
|
|
732
|
+
var _iterator14 = _createForOfIteratorHelper(this.graphs),
|
|
733
|
+
_step14;
|
|
680
734
|
|
|
681
735
|
try {
|
|
682
|
-
for (
|
|
683
|
-
const graph =
|
|
736
|
+
for (_iterator14.s(); !(_step14 = _iterator14.n()).done;) {
|
|
737
|
+
const graph = _step14.value;
|
|
684
738
|
|
|
685
739
|
if (id === graph.id) {
|
|
686
740
|
graphToSignal = graph;
|
|
@@ -688,9 +742,9 @@ class ApplicationContext {
|
|
|
688
742
|
}
|
|
689
743
|
}
|
|
690
744
|
} catch (err) {
|
|
691
|
-
|
|
745
|
+
_iterator14.e(err);
|
|
692
746
|
} finally {
|
|
693
|
-
|
|
747
|
+
_iterator14.f();
|
|
694
748
|
}
|
|
695
749
|
|
|
696
750
|
graphToSignal.signal(event);
|
package/dist/BasicApp.js
CHANGED
|
@@ -66,7 +66,7 @@ class BasicApp extends _react.Component {
|
|
|
66
66
|
}), /*#__PURE__*/_react.default.createElement(_reactRouterDom.Route, {
|
|
67
67
|
path: "/login",
|
|
68
68
|
render: props => /*#__PURE__*/_react.default.createElement(_LoginBasic.default, {
|
|
69
|
-
url: location + this.props.authUrl + "/login",
|
|
69
|
+
url: location + this.props.contextRoot + this.props.authUrl + "/login",
|
|
70
70
|
background: 'rgba(0, 0, 0, 0.65)',
|
|
71
71
|
title: 'Business Agility',
|
|
72
72
|
logo: this.props.logoUrl
|
|
@@ -74,7 +74,7 @@ class BasicApp extends _react.Component {
|
|
|
74
74
|
}), /*#__PURE__*/_react.default.createElement(_reactRouterDom.Route, {
|
|
75
75
|
path: "/forgot-password",
|
|
76
76
|
render: () => /*#__PURE__*/_react.default.createElement(_ForgotPasswordBasic.default, {
|
|
77
|
-
url: location + this.props.authUrl + "/password/forgot",
|
|
77
|
+
url: location + this.props.contextRoot + this.props.authUrl + "/password/forgot",
|
|
78
78
|
background: 'rgba(0, 0, 0, 0.65)',
|
|
79
79
|
title: 'Business Agility',
|
|
80
80
|
logo: this.props.logoUrl
|
|
@@ -82,7 +82,7 @@ class BasicApp extends _react.Component {
|
|
|
82
82
|
}), /*#__PURE__*/_react.default.createElement(_reactRouterDom.Route, {
|
|
83
83
|
path: "/reset-password",
|
|
84
84
|
render: () => /*#__PURE__*/_react.default.createElement(_ResetPasswordBasic.default, {
|
|
85
|
-
url: location + this.props.authUrl + "/password/confirmForgot",
|
|
85
|
+
url: location + this.props.contextRoot + this.props.authUrl + "/password/confirmForgot",
|
|
86
86
|
background: 'rgba(0, 0, 0, 0.65)',
|
|
87
87
|
title: 'Business Agility',
|
|
88
88
|
logo: this.props.logoUrl
|
|
@@ -90,7 +90,7 @@ class BasicApp extends _react.Component {
|
|
|
90
90
|
}), /*#__PURE__*/_react.default.createElement(_reactRouterDom.Route, {
|
|
91
91
|
path: "/change-password",
|
|
92
92
|
render: () => /*#__PURE__*/_react.default.createElement(_ChangePasswordBasic.default, {
|
|
93
|
-
url: location + this.props.authUrl + "/password/challenge",
|
|
93
|
+
url: location + this.props.contextRoot + this.props.authUrl + "/password/challenge",
|
|
94
94
|
background: 'rgba(0, 0, 0, 0.65)',
|
|
95
95
|
title: 'Business Agility',
|
|
96
96
|
logo: this.props.logoUrl
|
package/dist/BasicAppHome.js
CHANGED
|
@@ -66,11 +66,13 @@ class BasicAppHome extends _react.Component {
|
|
|
66
66
|
|
|
67
67
|
_ApplicationContext.default.setUIConfigPath(this.props.uiConfigPath);
|
|
68
68
|
|
|
69
|
+
_ApplicationContext.default.setContextRoot(this.props.contextRoot);
|
|
70
|
+
|
|
69
71
|
_ApplicationContext.default.setBaseApiUrl(this.props.baseApiUrl);
|
|
70
72
|
|
|
71
73
|
_ApplicationContext.default.setFilesApiPath(this.props.filesApiPath);
|
|
72
74
|
|
|
73
|
-
this.props.getDashboardSettings(location + this.props.baseApiUrl + "/ui/setup");
|
|
75
|
+
this.props.getDashboardSettings(location + this.props.contextRoot + this.props.baseApiUrl + "/ui/setup");
|
|
74
76
|
}
|
|
75
77
|
|
|
76
78
|
componentDidUpdate(prevProps) {
|
|
@@ -80,7 +82,7 @@ class BasicAppHome extends _react.Component {
|
|
|
80
82
|
});
|
|
81
83
|
|
|
82
84
|
if (!this.state.tokenRefreshMonitorStarted && !_Utils.default.isNull(this.props.dashboardSettings)) {
|
|
83
|
-
_TokenManager.default.startTokenRefreshMonitor(location + this.props.authUrl + "/refresh", this.props.dashboardSettings.userName);
|
|
85
|
+
_TokenManager.default.startTokenRefreshMonitor(location + this.props.contextRoot + this.props.authUrl + "/refresh", this.props.dashboardSettings.userName);
|
|
84
86
|
|
|
85
87
|
this.setState({
|
|
86
88
|
tokenRefreshMonitorStarted: true
|
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)) {
|
|
@@ -114,7 +114,9 @@ class RestUtils {
|
|
|
114
114
|
if (parameterValue.type === 'MapObject') {
|
|
115
115
|
requestBody.type = 'MapEntityDto';
|
|
116
116
|
} else {
|
|
117
|
-
requestBody
|
|
117
|
+
if (typeof requestBody === 'object') {
|
|
118
|
+
requestBody.type = parameterValue.type;
|
|
119
|
+
}
|
|
118
120
|
}
|
|
119
121
|
}
|
|
120
122
|
}
|
|
@@ -143,7 +145,12 @@ class RestUtils {
|
|
|
143
145
|
contentType = headers['Content-Type'];
|
|
144
146
|
}
|
|
145
147
|
|
|
146
|
-
if (requestBody !== null) {
|
|
148
|
+
if (requestBody !== null && service.method === 'GET') {
|
|
149
|
+
console.error("A request body parameter cannot be specified for a GET request");
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if (requestBody !== null || service.method === 'POST') {
|
|
147
154
|
postData(url, response => {
|
|
148
155
|
let responseData = !_Utils.default.isNull(response) ? response.data : null;
|
|
149
156
|
|
|
@@ -413,7 +420,7 @@ const postData = (url, successCallback, errorCallback, secure, data) => {
|
|
|
413
420
|
exports.postData = postData;
|
|
414
421
|
|
|
415
422
|
const sendRequest = (url, successCallback, errorCallback, secure, track) => {
|
|
416
|
-
instance.doFetch(url, successCallback, errorCallback, secure, null, null, null, null, null,
|
|
423
|
+
instance.doFetch(url, successCallback, errorCallback, secure, null, null, null, null, null, track);
|
|
417
424
|
};
|
|
418
425
|
|
|
419
426
|
exports.sendRequest = sendRequest;
|
|
@@ -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;
|