@agilemotion/oui-react-js 1.8.78 → 2.0.0
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/README.TXT +10 -0
- package/dist/ApplicationManager.js +39 -2
- package/dist/BasicAppHome.js +4 -0
- package/dist/RestService.js +11 -2
- package/dist/RestUtils.js +11 -2
- package/dist/assets/jss/views/loginBasicStyle.js +5 -5
- package/dist/assets/jss/views/loginBasicStyle.jsx +5 -5
- package/dist/components/Button.js +47 -29
- package/dist/components/DocumentViewer.js +32 -19
- package/dist/components/Icon.js +3 -14
- package/dist/components/Toolbar.js +2 -2
- package/dist/components/Tree.js +237 -141
- package/dist/components/WordDocumentViewer.js +35 -7
- package/dist/components/dashboard/FoldingSideTabDashboard.js +10 -1
- package/dist/components/facialRecognition/FacialRegistration.js +15 -1
- package/dist/components/facialRecognition/FacialVerification.js +23 -2
- package/dist/components/form/FieldSet.js +8 -0
- package/dist/components/form/ImageEditor.js +64 -43
- package/dist/components/form/MultiFileUploadField.js +6 -5
- package/dist/components/form/RadioGroup.js +9 -1
- package/dist/components/form/Section.js +8 -2
- package/dist/components/form/TransferList.js +14 -10
- package/dist/components/form/UploadField.js +17 -4
- package/dist/components/layout/Layout.css +49 -1
- package/dist/components/layout/Layout.js +41 -1
- package/dist/components/layout/View.css +1 -1
- package/dist/components/navbars/PortalNavbar.js +5 -0
- package/dist/components/signatures/AgilitySignaturePanel.js +230 -22
- package/dist/components/signatures/DynamicSignatureDocumentContainer.js +487 -0
- package/dist/components/signatures/ImageSignatureInput.js +1 -2
- package/dist/event/EventType.js +3 -1
- package/package.json +2 -1
package/README.TXT
CHANGED
|
@@ -1 +1,11 @@
|
|
|
1
1
|
export NODE_OPTIONS=--openssl-legacy-provider
|
|
2
|
+
To deploy UI
|
|
3
|
+
|
|
4
|
+
1. Update the version in package.json
|
|
5
|
+
2. Push to master
|
|
6
|
+
3. Git lab pipeline will deploy run
|
|
7
|
+
4. When finished, run the manual step to push to NPM
|
|
8
|
+
5. Got to the apps(BA and Portal), and update the version
|
|
9
|
+
6. run npm install locally
|
|
10
|
+
7. Run deployment manual steps for the Apps to deploy
|
|
11
|
+
8. Push the updated package.json and lock file
|
|
@@ -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.SOCKET_VARIABLE = exports.
|
|
6
|
+
exports.default = exports.TEMPLATE_TOKEN_REGEX = exports.SYSTEM_EVENT = exports.SOCKET_VARIABLE = exports.DASHBOARD_STATE = exports.AVATAR_LISTENER_TYPE = exports.APP_VARIABLE = void 0;
|
|
7
7
|
var _Observable = _interopRequireDefault(require("./event/Observable"));
|
|
8
8
|
var _Event = _interopRequireDefault(require("./event/Event"));
|
|
9
9
|
var _EventType = _interopRequireDefault(require("./event/EventType"));
|
|
@@ -12,6 +12,7 @@ var _DynamicJS = _interopRequireWildcard(require("./DynamicJS"));
|
|
|
12
12
|
var _TypedValue = _interopRequireDefault(require("./TypedValue"));
|
|
13
13
|
var _SocketManager = _interopRequireDefault(require("./components/SocketManager"));
|
|
14
14
|
var _ViewContext = require("./ViewContext");
|
|
15
|
+
var _helpers = require("rrule/dist/esm/helpers");
|
|
15
16
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
16
17
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
18
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
@@ -20,9 +21,9 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
20
21
|
const APP_VARIABLE = exports.APP_VARIABLE = '__APPLICATION_OUI_SYS_VAR__';
|
|
21
22
|
const SOCKET_VARIABLE = exports.SOCKET_VARIABLE = '__SOCKET_VARIABLE_OUI_SYS_VAR__';
|
|
22
23
|
const AVATAR_LISTENER_TYPE = exports.AVATAR_LISTENER_TYPE = 'AVATAR_LISTENER';
|
|
24
|
+
const DASHBOARD_STATE = exports.DASHBOARD_STATE = 'DASHBOARD_STATE';
|
|
23
25
|
const SYSTEM_EVENT = exports.SYSTEM_EVENT = 'SYSTEM_EVENT';
|
|
24
26
|
const TEMPLATE_TOKEN_REGEX = exports.TEMPLATE_TOKEN_REGEX = new RegExp('(([$]{1}[{]{1})(([a-zA-Z0-9_$.@#{}[\\]]*)+){1}([}]{1}))+', 'g');
|
|
25
|
-
const LEGEND_ARROW_ICON = exports.LEGEND_ARROW_ICON = " <i class=\"fa fa-arrow-right fa-xs\" aria-hidden=\"true\" style='color:__COLOR__'></i> ";
|
|
26
27
|
const applicationContext = {};
|
|
27
28
|
class ApplicationManager {
|
|
28
29
|
constructor() {
|
|
@@ -395,8 +396,18 @@ class ApplicationManager {
|
|
|
395
396
|
let isEvent = expression.startsWith('$event.data');
|
|
396
397
|
if (isEvent) {
|
|
397
398
|
let value = eventData;
|
|
399
|
+
if (Array.isArray(value) && expression.includes('[')) {
|
|
400
|
+
let valueIndex = expression.substring(expression.indexOf('[') + 1, expression.indexOf(']'));
|
|
401
|
+
value = value[valueIndex];
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
// This checks if there is a reference to some data property
|
|
398
405
|
let expressionClosure = 'data.';
|
|
399
406
|
let index = expression.indexOf(expressionClosure);
|
|
407
|
+
if (index < 0) {
|
|
408
|
+
expressionClosure = "].";
|
|
409
|
+
index = expression.indexOf(expressionClosure);
|
|
410
|
+
}
|
|
400
411
|
if (index > 0) {
|
|
401
412
|
let propertyChain = expression.substring(index + expressionClosure.length);
|
|
402
413
|
let props = propertyChain.split('.');
|
|
@@ -527,6 +538,12 @@ class ApplicationManager {
|
|
|
527
538
|
},
|
|
528
539
|
getUniqueOrgForRole(role) {
|
|
529
540
|
return instance.getUniqueOrgForRole(role);
|
|
541
|
+
},
|
|
542
|
+
setDashboardState(dashboardState) {
|
|
543
|
+
instance.setDashboardState(dashboardState);
|
|
544
|
+
},
|
|
545
|
+
getDashboardState() {
|
|
546
|
+
return instance.getDashboardState();
|
|
530
547
|
}
|
|
531
548
|
};
|
|
532
549
|
if (!Array.isArray) {
|
|
@@ -553,6 +570,15 @@ class ApplicationManager {
|
|
|
553
570
|
setDashboardSettings(dashboardSettings) {
|
|
554
571
|
this.props.dashboardSettings = dashboardSettings;
|
|
555
572
|
}
|
|
573
|
+
setDashboardState(state) {
|
|
574
|
+
this.props.dashboardState = state;
|
|
575
|
+
for (const listener of this.listeners) {
|
|
576
|
+
console.log(listener);
|
|
577
|
+
if (listener.type === DASHBOARD_STATE) {
|
|
578
|
+
listener.handler(state);
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
}
|
|
556
582
|
getDashboardSettings() {
|
|
557
583
|
return this.props.dashboardSettings;
|
|
558
584
|
}
|
|
@@ -604,6 +630,17 @@ class ApplicationManager {
|
|
|
604
630
|
addApplicationListener(listener) {
|
|
605
631
|
this.listeners.push(listener);
|
|
606
632
|
}
|
|
633
|
+
removeApplicationListener(id) {
|
|
634
|
+
if (!this.listeners) return;
|
|
635
|
+
// Reverse-iterate + splice — handles duplicate ids without index
|
|
636
|
+
// drift, and mutates the existing array (the singleton is
|
|
637
|
+
// Object.freeze'd, so we can't reassign this.listeners).
|
|
638
|
+
for (let i = this.listeners.length - 1; i >= 0; i--) {
|
|
639
|
+
if (this.listeners[i].id === id) {
|
|
640
|
+
this.listeners.splice(i, 1);
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
}
|
|
607
644
|
alert(viewId, message, messageType) {
|
|
608
645
|
let event = new _Event.default(this, this.getView(viewId).config.id, {
|
|
609
646
|
messageType: messageType,
|
package/dist/BasicAppHome.js
CHANGED
|
@@ -52,6 +52,9 @@ const BasicAppHome = props => {
|
|
|
52
52
|
console.log("ERROR USER DETAILS");
|
|
53
53
|
console.log(e);
|
|
54
54
|
});
|
|
55
|
+
return () => {
|
|
56
|
+
_ApplicationManager.default.removeApplicationListener('basicAppHomeAvatarListener');
|
|
57
|
+
};
|
|
55
58
|
}, []);
|
|
56
59
|
_react.default.useEffect(() => {
|
|
57
60
|
setDashboardSettings(props.dashboardSettings);
|
|
@@ -64,6 +67,7 @@ const BasicAppHome = props => {
|
|
|
64
67
|
setAvatarUrl(avatarUrl);
|
|
65
68
|
}
|
|
66
69
|
let avatarListener = {};
|
|
70
|
+
avatarListener.id = "basicAppHomeAvatarListener";
|
|
67
71
|
avatarListener.type = _ApplicationManager.AVATAR_LISTENER_TYPE;
|
|
68
72
|
avatarListener.handler = avatar => {
|
|
69
73
|
setAvatarUrl(avatarUrl);
|
package/dist/RestService.js
CHANGED
|
@@ -73,10 +73,19 @@ class RestService {
|
|
|
73
73
|
}
|
|
74
74
|
if (httpParameterType === 'PATH_VARIABLE') {
|
|
75
75
|
if (!_Utils.default.isNull(parameterValue)) {
|
|
76
|
+
let resolvedValue;
|
|
76
77
|
if (parameter.encode) {
|
|
77
|
-
|
|
78
|
+
resolvedValue = typeof parameterValue.value === 'object' ? encodeURIComponent(JSON.stringify(parameterValue.value)) : parameterValue.instanceType === 'TypedValue' ? encodeURIComponent(parameterValue.value) : encodeURIComponent(parameterValue);
|
|
78
79
|
} else {
|
|
79
|
-
|
|
80
|
+
resolvedValue = typeof parameterValue.value === 'object' ? JSON.stringify(parameterValue.value) : parameterValue.instanceType === 'TypedValue' ? parameterValue.value : parameterValue;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// If the parameter has a name and the URL contains {name}, replace the placeholder
|
|
84
|
+
if (!_Utils.default.isNull(parameter.name) && url.indexOf('{' + parameter.name + '}') >= 0) {
|
|
85
|
+
url = url.replace('{' + parameter.name + '}', resolvedValue);
|
|
86
|
+
} else {
|
|
87
|
+
// Backward compatibility: append to end of URL
|
|
88
|
+
pathParameters += '/' + resolvedValue;
|
|
80
89
|
}
|
|
81
90
|
}
|
|
82
91
|
}
|
package/dist/RestUtils.js
CHANGED
|
@@ -70,10 +70,19 @@ class RestUtils {
|
|
|
70
70
|
}
|
|
71
71
|
if (httpParameterType === 'PATH_VARIABLE') {
|
|
72
72
|
if (!_Utils.default.isNull(parameterValue)) {
|
|
73
|
+
let resolvedValue;
|
|
73
74
|
if (parameter.encode) {
|
|
74
|
-
|
|
75
|
+
resolvedValue = typeof parameterValue.value === 'object' ? encodeURIComponent(JSON.stringify(parameterValue.value)) : parameterValue.instanceType === 'TypedValue' ? encodeURIComponent(parameterValue.value) : encodeURIComponent(parameterValue);
|
|
75
76
|
} else {
|
|
76
|
-
|
|
77
|
+
resolvedValue = typeof parameterValue.value === 'object' ? JSON.stringify(parameterValue.value) : parameterValue.instanceType === 'TypedValue' ? parameterValue.value : parameterValue;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// If the parameter has a name and the URL contains {name}, replace the placeholder
|
|
81
|
+
if (!_Utils.default.isNull(parameter.name) && url.indexOf('{' + parameter.name + '}') >= 0) {
|
|
82
|
+
url = url.replace('{' + parameter.name + '}', resolvedValue);
|
|
83
|
+
} else {
|
|
84
|
+
// Backward compatibility: append to end of URL
|
|
85
|
+
pathParameters += '/' + resolvedValue;
|
|
77
86
|
}
|
|
78
87
|
}
|
|
79
88
|
}
|
|
@@ -47,11 +47,11 @@ const styles = {
|
|
|
47
47
|
},
|
|
48
48
|
loginBtn: {
|
|
49
49
|
float: 'right',
|
|
50
|
-
background: '#003A8F',
|
|
51
|
-
color: '#ffffff'
|
|
50
|
+
background: window.location.hostname.includes('csir') ? '#003A8F' : '#FCB614',
|
|
51
|
+
color: window.location.hostname.includes('csir') ? '#ffffff' : '#000000'
|
|
52
52
|
},
|
|
53
53
|
btn: {
|
|
54
|
-
background: '#003A8F',
|
|
54
|
+
background: window.location.hostname.includes('csir') ? '#003A8F' : '#FCB614',
|
|
55
55
|
color: _colors.white,
|
|
56
56
|
padding: 7,
|
|
57
57
|
borderRadius: 2,
|
|
@@ -59,10 +59,10 @@ const styles = {
|
|
|
59
59
|
fontSize: 13
|
|
60
60
|
},
|
|
61
61
|
btnFacebook: {
|
|
62
|
-
background: '#003A8F'
|
|
62
|
+
background: window.location.hostname.includes('csir') ? '#003A8F' : '#FCB614'
|
|
63
63
|
},
|
|
64
64
|
btnGoogle: {
|
|
65
|
-
background: '#
|
|
65
|
+
background: '#003A8F'
|
|
66
66
|
},
|
|
67
67
|
btnSpan: {
|
|
68
68
|
marginLeft: 5
|
|
@@ -42,11 +42,11 @@ const styles = {
|
|
|
42
42
|
},
|
|
43
43
|
loginBtn: {
|
|
44
44
|
float: 'right',
|
|
45
|
-
background: '#003A8F',
|
|
46
|
-
color: '#ffffff'
|
|
45
|
+
background: window.location.hostname.includes('csir') ? '#003A8F' : '#FCB614',
|
|
46
|
+
color: window.location.hostname.includes('csir') ? '#ffffff' : '#000000'
|
|
47
47
|
},
|
|
48
48
|
btn: {
|
|
49
|
-
background: '#003A8F',
|
|
49
|
+
background: window.location.hostname.includes('csir') ? '#003A8F' : '#FCB614',
|
|
50
50
|
color: white,
|
|
51
51
|
padding: 7,
|
|
52
52
|
borderRadius: 2,
|
|
@@ -54,10 +54,10 @@ const styles = {
|
|
|
54
54
|
fontSize: 13
|
|
55
55
|
},
|
|
56
56
|
btnFacebook: {
|
|
57
|
-
background: '#003A8F'
|
|
57
|
+
background: window.location.hostname.includes('csir') ? '#003A8F' : '#FCB614'
|
|
58
58
|
},
|
|
59
59
|
btnGoogle: {
|
|
60
|
-
background: '#
|
|
60
|
+
background: '#003A8F'
|
|
61
61
|
},
|
|
62
62
|
btnSpan: {
|
|
63
63
|
marginLeft: 5
|
|
@@ -10,6 +10,7 @@ var _Observable = _interopRequireDefault(require("../event/Observable"));
|
|
|
10
10
|
var _Utils = _interopRequireDefault(require("../Utils"));
|
|
11
11
|
var _IconButton = _interopRequireDefault(require("@mui/material/IconButton"));
|
|
12
12
|
var _Icon = _interopRequireDefault(require("./Icon"));
|
|
13
|
+
var _Tooltip = _interopRequireDefault(require("@mui/material/Tooltip"));
|
|
13
14
|
var _styles = require("@mui/styles");
|
|
14
15
|
var _Event = _interopRequireDefault(require("../event/Event"));
|
|
15
16
|
var _EventType = _interopRequireDefault(require("../event/EventType"));
|
|
@@ -34,7 +35,7 @@ const useStyles = (0, _styles.makeStyles)(theme => ({
|
|
|
34
35
|
}
|
|
35
36
|
}));
|
|
36
37
|
const Button = props => {
|
|
37
|
-
var _props$attributes
|
|
38
|
+
var _props$attributes;
|
|
38
39
|
const classes = useStyles();
|
|
39
40
|
const [disabled, setDisabled] = _react.default.useState(false);
|
|
40
41
|
const [visible, setVisible] = _react.default.useState(false);
|
|
@@ -101,6 +102,47 @@ const Button = props => {
|
|
|
101
102
|
}
|
|
102
103
|
};
|
|
103
104
|
};
|
|
105
|
+
const tooltipText = _Utils.default.getComponentAttribute(props.config, 'toolTip', '');
|
|
106
|
+
const renderButton = () => {
|
|
107
|
+
var _props$config$attribu5;
|
|
108
|
+
if (!_Utils.default.isNull(props.config.icon) && !_Utils.default.isNull(label)) {
|
|
109
|
+
var _props$config$attribu;
|
|
110
|
+
return /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
111
|
+
variant: color === 'secondary' || color === 'primary' ? 'contained' : 'text',
|
|
112
|
+
size: "large",
|
|
113
|
+
color: !_Utils.default.isNull(color) ? color : null,
|
|
114
|
+
style: (_props$config$attribu = props.config.attributes) === null || _props$config$attribu === void 0 ? void 0 : _props$config$attribu.style,
|
|
115
|
+
disabled: disabled,
|
|
116
|
+
onClick: handleClick,
|
|
117
|
+
startIcon: /*#__PURE__*/_react.default.createElement(_Icon.default, {
|
|
118
|
+
id: props.config.icon
|
|
119
|
+
})
|
|
120
|
+
}, label);
|
|
121
|
+
}
|
|
122
|
+
if (!_Utils.default.isNull(props.config.icon)) {
|
|
123
|
+
var _props$config$attribu2, _props$config$attribu3, _props$config$attribu4;
|
|
124
|
+
return /*#__PURE__*/_react.default.createElement(_IconButton.default, {
|
|
125
|
+
color: !_Utils.default.isNull(color) ? color : null,
|
|
126
|
+
"aria-controls": "menu-list-grow",
|
|
127
|
+
disabled: disabled,
|
|
128
|
+
style: (_props$config$attribu2 = props.config.attributes) === null || _props$config$attribu2 === void 0 ? void 0 : _props$config$attribu2.style,
|
|
129
|
+
"aria-haspopup": "true",
|
|
130
|
+
onClick: handleClick
|
|
131
|
+
}, /*#__PURE__*/_react.default.createElement(_Icon.default, {
|
|
132
|
+
id: props.config.icon,
|
|
133
|
+
color: (_props$config$attribu3 = props.config.attributes) !== null && _props$config$attribu3 !== void 0 && (_props$config$attribu3 = _props$config$attribu3.style) !== null && _props$config$attribu3 !== void 0 && _props$config$attribu3.color ? (_props$config$attribu4 = props.config.attributes) === null || _props$config$attribu4 === void 0 || (_props$config$attribu4 = _props$config$attribu4.style) === null || _props$config$attribu4 === void 0 ? void 0 : _props$config$attribu4.color : _ApplicationManager.default.getApplicationSecondaryColor()
|
|
134
|
+
}));
|
|
135
|
+
}
|
|
136
|
+
return /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
137
|
+
variant: color === 'secondary' || color === 'primary' ? 'contained' : 'text',
|
|
138
|
+
"aria-controls": "menu-list-grow",
|
|
139
|
+
color: color,
|
|
140
|
+
style: (_props$config$attribu5 = props.config.attributes) === null || _props$config$attribu5 === void 0 ? void 0 : _props$config$attribu5.style,
|
|
141
|
+
disabled: disabled,
|
|
142
|
+
onClick: handleClick,
|
|
143
|
+
"aria-haspopup": "true"
|
|
144
|
+
}, label);
|
|
145
|
+
};
|
|
104
146
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
105
147
|
className: "".concat(classes.root, " oui button"),
|
|
106
148
|
style: {
|
|
@@ -109,33 +151,9 @@ const Button = props => {
|
|
|
109
151
|
}
|
|
110
152
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
111
153
|
className: classes.wrapper
|
|
112
|
-
}, !_Utils.default.isNull(
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
style: (_props$config$attribu = props.config.attributes) === null || _props$config$attribu === void 0 ? void 0 : _props$config$attribu.style,
|
|
117
|
-
disabled: disabled,
|
|
118
|
-
onClick: handleClick,
|
|
119
|
-
startIcon: /*#__PURE__*/_react.default.createElement(_Icon.default, {
|
|
120
|
-
id: props.config.icon
|
|
121
|
-
})
|
|
122
|
-
}, label) : !_Utils.default.isNull(props.config.icon) ? /*#__PURE__*/_react.default.createElement(_IconButton.default, {
|
|
123
|
-
"aria-controls": "menu-list-grow",
|
|
124
|
-
disabled: disabled,
|
|
125
|
-
style: (_props$config$attribu2 = props.config.attributes) === null || _props$config$attribu2 === void 0 ? void 0 : _props$config$attribu2.style,
|
|
126
|
-
"aria-haspopup": "true",
|
|
127
|
-
onClick: handleClick
|
|
128
|
-
}, /*#__PURE__*/_react.default.createElement(_Icon.default, {
|
|
129
|
-
id: props.config.icon,
|
|
130
|
-
color: (_props$config$attribu3 = props.config.attributes) !== null && _props$config$attribu3 !== void 0 && (_props$config$attribu3 = _props$config$attribu3.style) !== null && _props$config$attribu3 !== void 0 && _props$config$attribu3.color ? (_props$config$attribu4 = props.config.attributes) === null || _props$config$attribu4 === void 0 || (_props$config$attribu4 = _props$config$attribu4.style) === null || _props$config$attribu4 === void 0 ? void 0 : _props$config$attribu4.color : _ApplicationManager.default.getApplicationSecondaryColor()
|
|
131
|
-
})) : /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
132
|
-
variant: color === 'secondary' || color === 'primary' ? 'contained' : 'text',
|
|
133
|
-
"aria-controls": "menu-list-grow",
|
|
134
|
-
color: color,
|
|
135
|
-
style: (_props$config$attribu5 = props.config.attributes) === null || _props$config$attribu5 === void 0 ? void 0 : _props$config$attribu5.style,
|
|
136
|
-
disabled: disabled,
|
|
137
|
-
onClick: handleClick,
|
|
138
|
-
"aria-haspopup": "true"
|
|
139
|
-
}, label))));
|
|
154
|
+
}, !_Utils.default.isNull(tooltipText) ? /*#__PURE__*/_react.default.createElement(_Tooltip.default, {
|
|
155
|
+
title: tooltipText,
|
|
156
|
+
arrow: true
|
|
157
|
+
}, /*#__PURE__*/_react.default.createElement("span", null, renderButton())) : renderButton())));
|
|
140
158
|
};
|
|
141
159
|
var _default = exports.default = Button;
|
|
@@ -24,6 +24,7 @@ const DocumentViewer = /*#__PURE__*/_react.default.memo(props => {
|
|
|
24
24
|
const [label, setLabel] = _react.default.useState(null);
|
|
25
25
|
const [hasLoadingError, setHasLoadingError] = _react.default.useState(false);
|
|
26
26
|
const [value, setValue] = _react.default.useState(null);
|
|
27
|
+
const [fileType, setFileType] = _react.default.useState(null);
|
|
27
28
|
const [visible, setVisible] = _react.default.useState(false);
|
|
28
29
|
const wordEditorValueHandler = {};
|
|
29
30
|
_react.default.useEffect(() => {
|
|
@@ -41,8 +42,30 @@ const DocumentViewer = /*#__PURE__*/_react.default.memo(props => {
|
|
|
41
42
|
if (((_props$config$attribu = props.config.attributes) === null || _props$config$attribu === void 0 ? void 0 : _props$config$attribu.autoLoadData) === false) {
|
|
42
43
|
setLoading(false);
|
|
43
44
|
}
|
|
45
|
+
let fileTypeFromConfig = _Utils.default.prop(props.config.fileType);
|
|
46
|
+
if (fileTypeFromConfig) {
|
|
47
|
+
setFileType(fileTypeFromConfig);
|
|
48
|
+
}
|
|
44
49
|
refresh();
|
|
45
50
|
}, []);
|
|
51
|
+
function processFileData(data, fileType) {
|
|
52
|
+
let file = {};
|
|
53
|
+
if (data.payloadBase64) {
|
|
54
|
+
file.base64 = data.payloadBase64;
|
|
55
|
+
} else if (data.url) {
|
|
56
|
+
file.base64 = data.url.replace('data:application/pdf;base64,', '').replace('data:application/vnd.openxmlformats-officedocument.wordprocessingml.document;base64,', '');
|
|
57
|
+
} else if (data.payload && typeof data.payload === 'string') {
|
|
58
|
+
file.base64 = data.payload.replace('data:application/pdf;base64,', '').replace('data:application/vnd.openxmlformats-officedocument.wordprocessingml.document;base64,', '');
|
|
59
|
+
}
|
|
60
|
+
file.name = data.name;
|
|
61
|
+
file.type = fileType;
|
|
62
|
+
if (fileType) {
|
|
63
|
+
setFileType(fileType);
|
|
64
|
+
}
|
|
65
|
+
setValue(file);
|
|
66
|
+
setHasLoadingError(false);
|
|
67
|
+
setLoading(false);
|
|
68
|
+
}
|
|
46
69
|
function doLoadData(actionConfig) {
|
|
47
70
|
let parsedConfig = _Utils.default.parseConfig(props.config, props.viewId);
|
|
48
71
|
if (!_Utils.default.isNull(actionConfig) && !_Utils.default.isNull(actionConfig.value)) {
|
|
@@ -64,17 +87,7 @@ const DocumentViewer = /*#__PURE__*/_react.default.memo(props => {
|
|
|
64
87
|
actionConfig.service = service;
|
|
65
88
|
// TODO : Implement the invalid parameter callback
|
|
66
89
|
_ServiceCallActionHandler.default.execute(actionConfig, null, null, props.viewId, data => {
|
|
67
|
-
|
|
68
|
-
if (data.payloadBase64) {
|
|
69
|
-
file.base64 = data.payloadBase64;
|
|
70
|
-
} else if (data.url) {
|
|
71
|
-
file.base64 = data.url.replace('data:application/pdf;base64,', '').replace('data:application/vnd.openxmlformats-officedocument.wordprocessingml.document;base64,', '');
|
|
72
|
-
}
|
|
73
|
-
file.name = data.name;
|
|
74
|
-
file.type = _Utils.default.prop(parsedConfig.fileType);
|
|
75
|
-
setValue(file);
|
|
76
|
-
setHasLoadingError(false);
|
|
77
|
-
setLoading(false);
|
|
90
|
+
processFileData(data, data.type);
|
|
78
91
|
let event = new _Event.default(props.handle, props.viewId, null);
|
|
79
92
|
_Observable.default.fireEvent(_EventType.default.DATA_ARRIVED, event);
|
|
80
93
|
}, e => {
|
|
@@ -122,10 +135,10 @@ const DocumentViewer = /*#__PURE__*/_react.default.memo(props => {
|
|
|
122
135
|
setLabel(label);
|
|
123
136
|
},
|
|
124
137
|
refresh() {
|
|
125
|
-
refresh(
|
|
138
|
+
refresh();
|
|
126
139
|
},
|
|
127
140
|
setValue(newValue) {
|
|
128
|
-
|
|
141
|
+
processFileData(newValue, newValue.type);
|
|
129
142
|
},
|
|
130
143
|
getValue() {
|
|
131
144
|
return value;
|
|
@@ -142,8 +155,8 @@ const DocumentViewer = /*#__PURE__*/_react.default.memo(props => {
|
|
|
142
155
|
* @#{this}.insertReadonlyAnchor(...)
|
|
143
156
|
*/
|
|
144
157
|
insertReadonlyAnchor: (value, dropPosition) => {
|
|
145
|
-
if (
|
|
146
|
-
|
|
158
|
+
if (fileType === 'application/pdf') {
|
|
159
|
+
console.log('Anchor insertion is not yet supported for PDF files');
|
|
147
160
|
} else {
|
|
148
161
|
wordEditorValueHandler.api.insertReadonlyAnchor(value, dropPosition);
|
|
149
162
|
}
|
|
@@ -151,7 +164,7 @@ const DocumentViewer = /*#__PURE__*/_react.default.memo(props => {
|
|
|
151
164
|
};
|
|
152
165
|
};
|
|
153
166
|
let parsedConfig = _Utils.default.parseConfig(props.config, props.viewId);
|
|
154
|
-
return visible && /*#__PURE__*/_react.default.createElement("div", {
|
|
167
|
+
return !_Utils.default.isNull(fileType) && visible && /*#__PURE__*/_react.default.createElement("div", {
|
|
155
168
|
style: _Utils.default.mergeStyles({}, props.config)
|
|
156
169
|
}, ((_props$config$attribu2 = props.config.attributes) === null || _props$config$attribu2 === void 0 ? void 0 : _props$config$attribu2.label) && /*#__PURE__*/_react.default.createElement("div", {
|
|
157
170
|
style: _Utils.default.mergeObjects({
|
|
@@ -167,15 +180,15 @@ const DocumentViewer = /*#__PURE__*/_react.default.memo(props => {
|
|
|
167
180
|
marginTop: '16px',
|
|
168
181
|
color: 'red'
|
|
169
182
|
}
|
|
170
|
-
}, "Error loading document"), !loading && !hasLoadingError &&
|
|
183
|
+
}, "Error loading document"), !loading && !hasLoadingError && fileType === 'application/pdf' && !props.designMode && !_Utils.default.isNull(value) && /*#__PURE__*/_react.default.createElement(_PDFViewer.default, {
|
|
171
184
|
file: value,
|
|
172
185
|
onDocumentLoadSuccess: () => {}
|
|
173
|
-
}), !loading && !hasLoadingError &&
|
|
186
|
+
}), !loading && !hasLoadingError && fileType === 'application/pdf' && props.designMode && /*#__PURE__*/_react.default.createElement(_PDFDesignerComponent.default, {
|
|
174
187
|
file: value,
|
|
175
188
|
onDocumentLoadSuccess: () => {},
|
|
176
189
|
valueHandler: () => {},
|
|
177
190
|
valueChangeHandler: file => {}
|
|
178
|
-
}), !loading && !hasLoadingError &&
|
|
191
|
+
}), !loading && !hasLoadingError && fileType === 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' && (!_Utils.default.isNull(value) || props.config.enableUpload) && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_WordDocumentViewer.default, {
|
|
179
192
|
file: value,
|
|
180
193
|
onDocumentLoadSuccess: () => {},
|
|
181
194
|
valueHandler: wordEditorValueHandler,
|
package/dist/components/Icon.js
CHANGED
|
@@ -163,10 +163,7 @@ class Icon extends _react.Component {
|
|
|
163
163
|
return /*#__PURE__*/_react.default.createElement(_AttachFile.default, null);
|
|
164
164
|
} else if (this.props.id === 'INITIAL') {
|
|
165
165
|
return /*#__PURE__*/_react.default.createElement("i", {
|
|
166
|
-
className: "fas fa-signature"
|
|
167
|
-
style: {
|
|
168
|
-
color: this.props.color
|
|
169
|
-
}
|
|
166
|
+
className: "fas fa-signature"
|
|
170
167
|
});
|
|
171
168
|
} else if (this.props.id === 'FOLDER') {
|
|
172
169
|
return /*#__PURE__*/_react.default.createElement(_Folder.default, null);
|
|
@@ -237,11 +234,7 @@ class Icon extends _react.Component {
|
|
|
237
234
|
}
|
|
238
235
|
});
|
|
239
236
|
} else if (this.props.id === 'VIEW') {
|
|
240
|
-
return /*#__PURE__*/_react.default.createElement(_Visibility.default,
|
|
241
|
-
style: {
|
|
242
|
-
color: this.props.color
|
|
243
|
-
}
|
|
244
|
-
});
|
|
237
|
+
return /*#__PURE__*/_react.default.createElement(_Visibility.default, null);
|
|
245
238
|
} else if (this.props.id === 'DONE') {
|
|
246
239
|
return /*#__PURE__*/_react.default.createElement(_Done.default, {
|
|
247
240
|
style: {
|
|
@@ -261,11 +254,7 @@ class Icon extends _react.Component {
|
|
|
261
254
|
}
|
|
262
255
|
});
|
|
263
256
|
} else if (this.props.id === 'MINUTES') {
|
|
264
|
-
return /*#__PURE__*/_react.default.createElement(_iconsMaterial.EditNote,
|
|
265
|
-
style: {
|
|
266
|
-
color: '#2e7d32'
|
|
267
|
-
}
|
|
268
|
-
});
|
|
257
|
+
return /*#__PURE__*/_react.default.createElement(_iconsMaterial.EditNote, null);
|
|
269
258
|
}
|
|
270
259
|
return null;
|
|
271
260
|
}
|
|
@@ -277,7 +277,7 @@ const Toolbar = props => {
|
|
|
277
277
|
}, renderSection(section, counter++));
|
|
278
278
|
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
279
279
|
style: {
|
|
280
|
-
width: '
|
|
280
|
+
width: '1px',
|
|
281
281
|
height: '44px',
|
|
282
282
|
display: 'flex',
|
|
283
283
|
alignItems: 'center',
|
|
@@ -290,7 +290,7 @@ const Toolbar = props => {
|
|
|
290
290
|
endIcon: /*#__PURE__*/_react.default.createElement(_MoreVert.default, {
|
|
291
291
|
fontSize: "small"
|
|
292
292
|
})
|
|
293
|
-
}
|
|
293
|
+
})), anchorRef.current && /*#__PURE__*/_react.default.createElement(_Popper.default, {
|
|
294
294
|
open: open,
|
|
295
295
|
anchorEl: anchorRef.current,
|
|
296
296
|
placement: "bottom-end",
|