@agilemotion/oui-react-js 1.3.1 → 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 +72 -12
- package/dist/BasicApp.js +12 -5
- package/dist/BasicAppHome.js +2 -2
- package/dist/BusinessPortalApp.css +37 -0
- package/dist/BusinessPortalApp.js +115 -0
- package/dist/BusinessPortalAppHome.js +167 -0
- package/dist/RestUtils.js +1 -5
- 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/components/Graph.js +26 -18
- package/dist/components/GraphNode.js +0 -2
- package/dist/components/Icon.js +8 -0
- package/dist/components/SignaturePanel.js +118 -0
- package/dist/components/StepperTitleBar.js +4 -2
- 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 +26 -6
- package/dist/components/form/SelectItem.js +10 -3
- package/dist/components/form/UploadField.js +122 -44
- package/dist/components/layout/Layout.js +9 -0
- 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/SignatureTemplateDesigner.js +6 -4
- 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 +22 -21
- package/dist/assets/img/flogo.png +0 -0
|
@@ -0,0 +1,48 @@
|
|
|
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
|
+
require("./Workspace.css");
|
|
11
|
+
|
|
12
|
+
var _Sidebar = _interopRequireDefault(require("./../../components/blackDashboard/sidebar/Sidebar"));
|
|
13
|
+
|
|
14
|
+
var _ViewPort = _interopRequireDefault(require("../../../layout/ViewPort"));
|
|
15
|
+
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
|
|
18
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
19
|
+
|
|
20
|
+
const Workspace = props => {
|
|
21
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
22
|
+
className: "row workspace-container"
|
|
23
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
24
|
+
className: "col-*-* workspace-left"
|
|
25
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
26
|
+
style: {
|
|
27
|
+
float: 'right'
|
|
28
|
+
}
|
|
29
|
+
}, /*#__PURE__*/_react.default.createElement(_Sidebar.default, _extends({}, props, {
|
|
30
|
+
routes: props.routes,
|
|
31
|
+
activeColor: "agility",
|
|
32
|
+
className: "sidebar sidebar-customizer",
|
|
33
|
+
secondaryThemeColor: props.secondaryColor,
|
|
34
|
+
activeRouteMenu: props.activeRouteMenu,
|
|
35
|
+
dashboardLauncher: () => {},
|
|
36
|
+
heading: props.heading,
|
|
37
|
+
closeSidebar: () => {}
|
|
38
|
+
})))), /*#__PURE__*/_react.default.createElement("div", {
|
|
39
|
+
className: "col-*-* workspace-right"
|
|
40
|
+
}, /*#__PURE__*/_react.default.createElement(_ViewPort.default, {
|
|
41
|
+
settings: props.settings,
|
|
42
|
+
defaultView: "",
|
|
43
|
+
height: 'inherit'
|
|
44
|
+
}))));
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
var _default = Workspace;
|
|
48
|
+
exports.default = _default;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
|
|
2
|
+
/* Smartphones (landscape); */
|
|
3
|
+
@media only screen and (min-device-width : 361px) and (max-device-width : 480px) {
|
|
4
|
+
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
/* Smartphones (portrait); */
|
|
8
|
+
@media only screen and (min-device-width : 280px) and (max-device-width : 360px) {
|
|
9
|
+
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/* iPads (portrait and landscape); */
|
|
13
|
+
@media only screen and (min-device-width : 768px) and (max-device-width : 1024px) {
|
|
14
|
+
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/* iPad 3 */
|
|
18
|
+
@media only screen and (min-device-width : 768px) and (max-device-width : 1024px) and (orientation : landscape) and (-webkit-min-device-pixel-ratio : 2) {
|
|
19
|
+
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@media only screen and (min-device-width : 768px) and (max-device-width : 1024px) and (orientation : portrait) and (-webkit-min-device-pixel-ratio : 2) {
|
|
23
|
+
|
|
24
|
+
}
|
|
25
|
+
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default =
|
|
6
|
+
exports.default = void 0;
|
|
7
7
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
|
|
@@ -23,10 +23,27 @@ var _CardAvatar = _interopRequireDefault(require("../card/CardAvatar"));
|
|
|
23
23
|
|
|
24
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
25
|
|
|
26
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
27
|
+
|
|
28
|
+
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."); }
|
|
29
|
+
|
|
30
|
+
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); }
|
|
31
|
+
|
|
32
|
+
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; }
|
|
33
|
+
|
|
34
|
+
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
|
+
|
|
36
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
37
|
+
|
|
26
38
|
const useStyles = (0, _styles.makeStyles)(_footerStyle.default);
|
|
27
39
|
|
|
28
|
-
|
|
40
|
+
const Footer = props => {
|
|
29
41
|
const classes = useStyles();
|
|
42
|
+
|
|
43
|
+
const _React$useState = _react.default.useState(props.width ? props.width : null),
|
|
44
|
+
_React$useState2 = _slicedToArray(_React$useState, 1),
|
|
45
|
+
width = _React$useState2[0];
|
|
46
|
+
|
|
30
47
|
const fluid = props.fluid,
|
|
31
48
|
white = props.white,
|
|
32
49
|
rtlActive = props.rtlActive;
|
|
@@ -42,8 +59,16 @@ function Footer(props) {
|
|
|
42
59
|
[classes.block]: true,
|
|
43
60
|
[classes.whiteColor]: white
|
|
44
61
|
});
|
|
45
|
-
return /*#__PURE__*/_react.default.createElement("
|
|
46
|
-
className: classes.
|
|
62
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
63
|
+
className: classes.wrapper,
|
|
64
|
+
style: {
|
|
65
|
+
borderTop: '1px solid ' + props.splitterColor
|
|
66
|
+
}
|
|
67
|
+
}, /*#__PURE__*/_react.default.createElement("footer", {
|
|
68
|
+
className: classes.footer,
|
|
69
|
+
style: {
|
|
70
|
+
width: width
|
|
71
|
+
}
|
|
47
72
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
48
73
|
className: container,
|
|
49
74
|
style: {
|
|
@@ -56,21 +81,29 @@ function Footer(props) {
|
|
|
56
81
|
}, /*#__PURE__*/_react.default.createElement(_ListItem.default, {
|
|
57
82
|
className: classes.inlineBlock
|
|
58
83
|
}))), /*#__PURE__*/_react.default.createElement("div", {
|
|
59
|
-
className: classes.right + " row
|
|
84
|
+
className: classes.right + " row"
|
|
60
85
|
}, "\xA9 ", 1900 + new Date().getYear(), " ", " ", /*#__PURE__*/_react.default.createElement("div", {
|
|
61
86
|
style: {
|
|
62
87
|
paddingLeft: 10
|
|
63
88
|
}
|
|
64
89
|
}, /*#__PURE__*/_react.default.createElement(_CardAvatar.default, {
|
|
65
90
|
plain: true
|
|
66
|
-
}, /*#__PURE__*/_react.default.createElement("
|
|
67
|
-
|
|
91
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
92
|
+
className: "row"
|
|
93
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
94
|
+
className: "col-*-*"
|
|
95
|
+
}, props.logo ? /*#__PURE__*/_react.default.createElement("img", {
|
|
96
|
+
src: props.logo,
|
|
68
97
|
alt: "..."
|
|
69
|
-
}))
|
|
70
|
-
|
|
98
|
+
}) : null), /*#__PURE__*/_react.default.createElement("div", {
|
|
99
|
+
className: "col-*-*"
|
|
100
|
+
}, props.text ? /*#__PURE__*/_react.default.createElement("div", null, "\xA0\xA0", props.text) : null))))))));
|
|
101
|
+
};
|
|
71
102
|
|
|
72
103
|
Footer.propTypes = {
|
|
73
104
|
fluid: _propTypes.default.bool,
|
|
74
105
|
white: _propTypes.default.bool,
|
|
75
106
|
rtlActive: _propTypes.default.bool
|
|
76
|
-
};
|
|
107
|
+
};
|
|
108
|
+
var _default = Footer;
|
|
109
|
+
exports.default = _default;
|
|
@@ -295,9 +295,18 @@ const BaseField = props => {
|
|
|
295
295
|
setRequired(requiredNewVal);
|
|
296
296
|
},
|
|
297
297
|
|
|
298
|
-
|
|
298
|
+
get required() {
|
|
299
|
+
return required;
|
|
300
|
+
},
|
|
301
|
+
|
|
302
|
+
setFieldRequired(newVal) {
|
|
299
303
|
validateOnChange.current = true;
|
|
300
|
-
setRequired(
|
|
304
|
+
setRequired(newVal);
|
|
305
|
+
},
|
|
306
|
+
|
|
307
|
+
setFieldRequired(newVal, validate) {
|
|
308
|
+
validateOnChange.current = validate;
|
|
309
|
+
setRequired(newVal);
|
|
301
310
|
},
|
|
302
311
|
|
|
303
312
|
getChildren: () => {
|
|
@@ -27,7 +27,29 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
27
27
|
|
|
28
28
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
29
29
|
|
|
30
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
31
|
+
|
|
32
|
+
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."); }
|
|
33
|
+
|
|
34
|
+
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); }
|
|
35
|
+
|
|
36
|
+
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; }
|
|
37
|
+
|
|
38
|
+
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; }
|
|
39
|
+
|
|
40
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
41
|
+
|
|
30
42
|
const CustomDatePickerComponent = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
43
|
+
const _React$useState = _react.default.useState(null),
|
|
44
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
45
|
+
minDate = _React$useState2[0],
|
|
46
|
+
setMinDate = _React$useState2[1];
|
|
47
|
+
|
|
48
|
+
const _React$useState3 = _react.default.useState(null),
|
|
49
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
50
|
+
maxDate = _React$useState4[0],
|
|
51
|
+
setMaxDate = _React$useState4[1];
|
|
52
|
+
|
|
31
53
|
const base = props.base;
|
|
32
54
|
const defaultDate = !_Utils.default.isNull(base.valueObject[base.valueProperty]) ? new Date(base.valueObject[base.valueProperty]) : null;
|
|
33
55
|
|
|
@@ -44,6 +66,43 @@ const CustomDatePickerComponent = /*#__PURE__*/_react.default.memo( /*#__PURE__*
|
|
|
44
66
|
base.setValue(defaultDate);
|
|
45
67
|
}, [props.base.valueObject[props.base.valueProperty]]);
|
|
46
68
|
|
|
69
|
+
const formatNumber = n => {
|
|
70
|
+
return n < 10 ? '0' + n : n;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const getLimitDate = id => {
|
|
74
|
+
let dateAttr = _Utils.default.getComponentAttribute(props.config, id, null);
|
|
75
|
+
|
|
76
|
+
if (dateAttr) {
|
|
77
|
+
if (dateAttr.toString().includes('now')) {
|
|
78
|
+
let operator = dateAttr.toString().includes("-") ? '-' : '+';
|
|
79
|
+
let tokens = dateAttr.toString().split(operator);
|
|
80
|
+
let days = parseFloat(tokens[1].replace('d', '').trim());
|
|
81
|
+
let limit = new Date();
|
|
82
|
+
|
|
83
|
+
if ("-" === operator) {
|
|
84
|
+
limit.setDate(limit.getDate() - days);
|
|
85
|
+
} else {
|
|
86
|
+
limit.setDate(limit.getDate() + days);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return limit.getFullYear() + "-" + formatNumber(limit.getMonth() + 1) + "-" + formatNumber(limit.getDate());
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return null;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
_react.default.useEffect(() => {
|
|
97
|
+
if (minDate === null) {
|
|
98
|
+
setMinDate(getLimitDate("minDate"));
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (maxDate === null) {
|
|
102
|
+
setMaxDate(getLimitDate("maxDate"));
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
|
|
47
106
|
const secondaryColor = (0, _reactRedux.useSelector)(state => state.dashboard.secondaryThemeColor);
|
|
48
107
|
const ThemedKeyboardDatePicker = (0, _styles.withStyles)({
|
|
49
108
|
root: {
|
|
@@ -72,7 +131,7 @@ const CustomDatePickerComponent = /*#__PURE__*/_react.default.memo( /*#__PURE__*
|
|
|
72
131
|
required: base.required,
|
|
73
132
|
format: "dd/MM/yyyy",
|
|
74
133
|
label: props.config.attributes['label'],
|
|
75
|
-
value: base.value,
|
|
134
|
+
value: base.value ? base.value : null,
|
|
76
135
|
className: props.className,
|
|
77
136
|
error: base.hasError,
|
|
78
137
|
margin: "dense",
|
|
@@ -88,6 +147,8 @@ const CustomDatePickerComponent = /*#__PURE__*/_react.default.memo( /*#__PURE__*
|
|
|
88
147
|
'aria-label': 'change date',
|
|
89
148
|
'disabled': props.disabled
|
|
90
149
|
},
|
|
150
|
+
minDate: minDate !== null ? minDate : null,
|
|
151
|
+
maxDate: maxDate !== null ? maxDate : null,
|
|
91
152
|
readOnly: props.readOnly
|
|
92
153
|
})));
|
|
93
154
|
}));
|
|
@@ -412,14 +412,28 @@ const Form = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.forwa
|
|
|
412
412
|
let value = _DynamicJS.default.executeScript("".concat(props.config.id, "ValueEvaluator"), componentValue);
|
|
413
413
|
|
|
414
414
|
if (!_Utils.default.isNull(value)) {
|
|
415
|
-
|
|
416
|
-
|
|
415
|
+
let val = value;
|
|
416
|
+
|
|
417
|
+
if (binder === 'MAP_OBJECT' && _Utils.default.isNull(value.map)) {
|
|
418
|
+
val = {};
|
|
419
|
+
val.map = value;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
parseValues(transformDataObject(val));
|
|
423
|
+
setMasterValues(val);
|
|
417
424
|
}
|
|
418
425
|
});
|
|
419
426
|
}
|
|
420
427
|
} else {
|
|
421
|
-
|
|
422
|
-
|
|
428
|
+
let val = componentValue;
|
|
429
|
+
|
|
430
|
+
if (binder === 'MAP_OBJECT' && _Utils.default.isNull(componentValue.map)) {
|
|
431
|
+
val = {};
|
|
432
|
+
val.map = componentValue;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
parseValues(transformDataObject(val));
|
|
436
|
+
setMasterValues(val);
|
|
423
437
|
}
|
|
424
438
|
} else {
|
|
425
439
|
updateViewTitle();
|
|
@@ -864,7 +878,7 @@ const Form = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.forwa
|
|
|
864
878
|
fieldParentErrors[field.parentId] = isParentInvalid;
|
|
865
879
|
}
|
|
866
880
|
|
|
867
|
-
if (!_Utils.default.isNull(containerErrorCallback.current) &&
|
|
881
|
+
if (!_Utils.default.isNull(containerErrorCallback.current) && _ApplicationContext.default.isFormMarkersEnabled()) {
|
|
868
882
|
containerErrorCallback.current(fieldParentErrors);
|
|
869
883
|
}
|
|
870
884
|
}
|
|
@@ -935,7 +949,7 @@ const Form = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.forwa
|
|
|
935
949
|
|
|
936
950
|
if (!_Utils.default.isNull(validationGroup)) {
|
|
937
951
|
if (field !== groupField && validationGroup === field.handle.api.getValidationGroup()) {
|
|
938
|
-
let groupFieldId = groupField.handle.api.
|
|
952
|
+
let groupFieldId = groupField.handle.api.id;
|
|
939
953
|
|
|
940
954
|
let gridFieldPath = _getValuePath(groupFieldId, null);
|
|
941
955
|
|
|
@@ -953,7 +967,13 @@ const Form = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.forwa
|
|
|
953
967
|
}
|
|
954
968
|
}
|
|
955
969
|
|
|
970
|
+
let isMarkersEnabled = _ApplicationContext.default.isFormMarkersEnabled();
|
|
971
|
+
|
|
972
|
+
_ApplicationContext.default.enableFormMarkers(false);
|
|
973
|
+
|
|
956
974
|
_Observable.default.processSystemGeneratedSubscriptions(props.config.id);
|
|
975
|
+
|
|
976
|
+
_ApplicationContext.default.enableFormMarkers(isMarkersEnabled);
|
|
957
977
|
};
|
|
958
978
|
|
|
959
979
|
const _setFieldError = (id, error) => {
|
|
@@ -67,6 +67,12 @@ const SelectItemComponent = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_reac
|
|
|
67
67
|
let data = result.data;
|
|
68
68
|
let options = [];
|
|
69
69
|
|
|
70
|
+
if (_Utils.default.isNull(props.validator) || props.validator.nullable) {
|
|
71
|
+
options.push({
|
|
72
|
+
id: "_EMPTY_VALUE"
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
70
76
|
for (let i = 0; i < data.records.length; i++) {
|
|
71
77
|
let record = data.records[i];
|
|
72
78
|
options.push(record.map.objectReference);
|
|
@@ -99,8 +105,7 @@ const SelectItemComponent = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_reac
|
|
|
99
105
|
if (!loadFullOptionList) {
|
|
100
106
|
setLoadFullOptionList(true);
|
|
101
107
|
}
|
|
102
|
-
}
|
|
103
|
-
displayEmpty: props.allowEmptyValue || false
|
|
108
|
+
}
|
|
104
109
|
},
|
|
105
110
|
value: !_Utils.default.isNull(base.value) ? base.value.id : defaultValue,
|
|
106
111
|
className: props.className,
|
|
@@ -112,7 +117,9 @@ const SelectItemComponent = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_reac
|
|
|
112
117
|
margin: "dense",
|
|
113
118
|
size: "small",
|
|
114
119
|
variant: "outlined"
|
|
115
|
-
}, base.selectOptions.map(option => /*#__PURE__*/_react.default.createElement(_MenuItem.default, {
|
|
120
|
+
}, base.selectOptions.map(option => option.id === '_EMPTY_VALUE' ? /*#__PURE__*/_react.default.createElement(_MenuItem.default, {
|
|
121
|
+
value: ""
|
|
122
|
+
}, /*#__PURE__*/_react.default.createElement("em", null, "\xA0")) : /*#__PURE__*/_react.default.createElement(_MenuItem.default, {
|
|
116
123
|
key: option.id,
|
|
117
124
|
value: option.id
|
|
118
125
|
}, _Utils.default.isNull(option.label) ? "" : option.label.trim())));
|
|
@@ -19,9 +19,11 @@ var _Utils = _interopRequireDefault(require("../../Utils"));
|
|
|
19
19
|
|
|
20
20
|
var _ApplicationContext = _interopRequireDefault(require("./../../ApplicationContext"));
|
|
21
21
|
|
|
22
|
-
var
|
|
22
|
+
var _IconButton = _interopRequireDefault(require("@material-ui/core/IconButton"));
|
|
23
23
|
|
|
24
|
-
var
|
|
24
|
+
var _Icon = _interopRequireDefault(require("../Icon"));
|
|
25
|
+
|
|
26
|
+
var _reactPromiseTracker = require("react-promise-tracker");
|
|
25
27
|
|
|
26
28
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
29
|
|
|
@@ -50,6 +52,21 @@ const useStyles = (0, _styles.makeStyles)(theme => ({
|
|
|
50
52
|
color: 'red'
|
|
51
53
|
}
|
|
52
54
|
}));
|
|
55
|
+
|
|
56
|
+
const status = response => {
|
|
57
|
+
if (response.ok) {
|
|
58
|
+
return Promise.resolve(response);
|
|
59
|
+
} else {
|
|
60
|
+
let error = new Error(response.statusText);
|
|
61
|
+
error.code = response.status;
|
|
62
|
+
return Promise.reject(error);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const json = response => {
|
|
67
|
+
return response.text();
|
|
68
|
+
};
|
|
69
|
+
|
|
53
70
|
const location = window.location.protocol + "//" + window.location.hostname;
|
|
54
71
|
|
|
55
72
|
const DocumentUpload = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
@@ -68,46 +85,55 @@ const DocumentUpload = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.def
|
|
|
68
85
|
files = _React$useState6[0],
|
|
69
86
|
setFiles = _React$useState6[1];
|
|
70
87
|
|
|
71
|
-
const _React$useState7 = _react.default.useState(
|
|
88
|
+
const _React$useState7 = _react.default.useState(!_Utils.default.isNull(props.base.value) ? props.base.value.documentRepositoryCacheId : null),
|
|
72
89
|
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
73
|
-
|
|
74
|
-
|
|
90
|
+
cacheId = _React$useState8[0],
|
|
91
|
+
setCacheId = _React$useState8[1];
|
|
92
|
+
|
|
93
|
+
const _React$useState9 = _react.default.useState(true),
|
|
94
|
+
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
|
95
|
+
loading = _React$useState10[0],
|
|
96
|
+
setLoading = _React$useState10[1];
|
|
75
97
|
|
|
76
|
-
const _React$
|
|
77
|
-
_React$
|
|
78
|
-
|
|
98
|
+
const _React$useState11 = _react.default.useState(_Utils.default.isNull(props.config.validator) || props.config.validator.nullable === true),
|
|
99
|
+
_React$useState12 = _slicedToArray(_React$useState11, 1),
|
|
100
|
+
nullable = _React$useState12[0];
|
|
79
101
|
|
|
80
|
-
const _React$
|
|
81
|
-
_React$
|
|
82
|
-
|
|
83
|
-
|
|
102
|
+
const _React$useState13 = _react.default.useState(props.multiple === true),
|
|
103
|
+
_React$useState14 = _slicedToArray(_React$useState13, 1),
|
|
104
|
+
multiple = _React$useState14[0];
|
|
105
|
+
|
|
106
|
+
const _React$useState15 = _react.default.useState(false),
|
|
107
|
+
_React$useState16 = _slicedToArray(_React$useState15, 2),
|
|
108
|
+
show = _React$useState16[0],
|
|
109
|
+
setShow = _React$useState16[1];
|
|
84
110
|
|
|
85
111
|
const classes = useStyles();
|
|
86
112
|
|
|
87
|
-
const _React$
|
|
88
|
-
_React$
|
|
89
|
-
reference = _React$
|
|
90
|
-
setReference = _React$
|
|
113
|
+
const _React$useState17 = _react.default.useState(ref ? ref : /*#__PURE__*/_react.default.createRef()),
|
|
114
|
+
_React$useState18 = _slicedToArray(_React$useState17, 2),
|
|
115
|
+
reference = _React$useState18[0],
|
|
116
|
+
setReference = _React$useState18[1];
|
|
91
117
|
|
|
92
|
-
const _React$
|
|
93
|
-
_React$
|
|
94
|
-
hasError = _React$
|
|
95
|
-
setHasError = _React$
|
|
118
|
+
const _React$useState19 = _react.default.useState(null),
|
|
119
|
+
_React$useState20 = _slicedToArray(_React$useState19, 2),
|
|
120
|
+
hasError = _React$useState20[0],
|
|
121
|
+
setHasError = _React$useState20[1];
|
|
96
122
|
|
|
97
123
|
const width = _Utils.default.getComponentAttribute(props.config, 'width', '200px');
|
|
98
124
|
|
|
99
125
|
const height = _Utils.default.getComponentAttribute(props.config, 'height', '200px');
|
|
100
126
|
|
|
101
|
-
const _React$
|
|
102
|
-
_React$
|
|
103
|
-
errorMessage = _React$
|
|
104
|
-
setErrorMessage = _React$
|
|
127
|
+
const _React$useState21 = _react.default.useState(""),
|
|
128
|
+
_React$useState22 = _slicedToArray(_React$useState21, 2),
|
|
129
|
+
errorMessage = _React$useState22[0],
|
|
130
|
+
setErrorMessage = _React$useState22[1];
|
|
105
131
|
|
|
106
132
|
const base = props.base;
|
|
107
133
|
|
|
108
134
|
_react.default.useEffect(() => {
|
|
109
|
-
|
|
110
|
-
}
|
|
135
|
+
setCacheId();
|
|
136
|
+
});
|
|
111
137
|
|
|
112
138
|
_react.default.useEffect(() => {
|
|
113
139
|
if (!_Utils.default.isNull(props.valueMode)) {
|
|
@@ -132,7 +158,7 @@ const DocumentUpload = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.def
|
|
|
132
158
|
let fileInfo = {
|
|
133
159
|
name: file.name,
|
|
134
160
|
type: file.type,
|
|
135
|
-
size:
|
|
161
|
+
size: file.size,
|
|
136
162
|
base64: reader.result,
|
|
137
163
|
file: file
|
|
138
164
|
};
|
|
@@ -156,6 +182,37 @@ const DocumentUpload = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.def
|
|
|
156
182
|
}
|
|
157
183
|
};
|
|
158
184
|
|
|
185
|
+
const upload = (metadata, file, uploadUrl) => {
|
|
186
|
+
const accessToken = sessionStorage.getItem("accessToken");
|
|
187
|
+
const idToken = sessionStorage.getItem("idToken");
|
|
188
|
+
let data = new FormData();
|
|
189
|
+
metadata.correlationId = props.viewId + "." + props.config.id;
|
|
190
|
+
data.append("metadata", JSON.stringify(metadata));
|
|
191
|
+
data.append("file", file);
|
|
192
|
+
let fetchConfig = {
|
|
193
|
+
method: 'POST',
|
|
194
|
+
headers: {
|
|
195
|
+
'Accept': 'application/json',
|
|
196
|
+
'Authorization': 'Bearer ' + accessToken,
|
|
197
|
+
'idToken': idToken
|
|
198
|
+
},
|
|
199
|
+
body: data
|
|
200
|
+
};
|
|
201
|
+
let url = location + _ApplicationContext.default.getBaseApiUrl() + uploadUrl;
|
|
202
|
+
(0, _reactPromiseTracker.trackPromise)(fetch(encodeURI(url), fetchConfig).then(status).then(json).then(data => {
|
|
203
|
+
metadata.documentRepositoryId = !_Utils.default.isNull(base.value) ? base.value.documentRepositoryId : null;
|
|
204
|
+
metadata.documentRepositoryCacheId = data;
|
|
205
|
+
setCacheId(data);
|
|
206
|
+
base.handleValueChange(metadata);
|
|
207
|
+
}).catch(e => {
|
|
208
|
+
if (e.code === 401) {
|
|
209
|
+
_ApplicationContext.default.clear();
|
|
210
|
+
|
|
211
|
+
_ApplicationContext.default.getApplicationHistory().push('/login');
|
|
212
|
+
}
|
|
213
|
+
}));
|
|
214
|
+
};
|
|
215
|
+
|
|
159
216
|
reader.onloadend = () => {
|
|
160
217
|
if (!_Utils.default.isNull(props.form)) {
|
|
161
218
|
let fileMetaData = {};
|
|
@@ -169,14 +226,17 @@ const DocumentUpload = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.def
|
|
|
169
226
|
} else {
|
|
170
227
|
fileMetaData.correlationId = props.config.id;
|
|
171
228
|
fileMetaData.domain = props.viewId;
|
|
172
|
-
fileMetaData.cachedFile = true;
|
|
173
229
|
let file = {};
|
|
174
230
|
file.correlationId = fileMetaData.correlationId;
|
|
175
231
|
file.content = allFiles[0].file;
|
|
176
232
|
|
|
177
|
-
|
|
233
|
+
let uploadUrl = _Utils.default.getComponentAttribute(props.config, 'uploadUrl', null);
|
|
178
234
|
|
|
179
|
-
|
|
235
|
+
if (uploadUrl === null) {
|
|
236
|
+
uploadUrl = "/docs/manager/upload/save";
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
upload(fileMetaData, allFiles[0].file, uploadUrl);
|
|
180
240
|
}
|
|
181
241
|
}
|
|
182
242
|
};
|
|
@@ -223,7 +283,17 @@ const DocumentUpload = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.def
|
|
|
223
283
|
}, props.config.attributes['label'] ? props.config.attributes['label'] : "Upload File")), /*#__PURE__*/_react.default.createElement("label", null, !_Utils.default.isNull(base.value) ? _Utils.default.isNull(base.value.id) || _Utils.default.isNull(props.config.dataService) ? base.value.name : /*#__PURE__*/_react.default.createElement("a", {
|
|
224
284
|
href: location + _ApplicationContext.default.getBaseApiUrl() + _ApplicationContext.default.getFilesApiPath() + '/get/file?fileId=' + base.value.id + '&fileService=' + props.config.dataService.serviceId + '&access_token=' + sessionStorage.getItem("accessToken") + '&idToken=' + sessionStorage.getItem("idToken"),
|
|
225
285
|
target: '_blank'
|
|
226
|
-
}, base.value.name) : null)
|
|
286
|
+
}, base.value.name) : null), nullable && base.value ? /*#__PURE__*/_react.default.createElement(_IconButton.default, {
|
|
287
|
+
"aria-controls": "menu-list-grow",
|
|
288
|
+
ref: ref,
|
|
289
|
+
"aria-haspopup": "true",
|
|
290
|
+
onClick: () => {
|
|
291
|
+
base.handleValueChange(null);
|
|
292
|
+
document.getElementById('contained-button-file').value = null;
|
|
293
|
+
}
|
|
294
|
+
}, /*#__PURE__*/_react.default.createElement(_Icon.default, {
|
|
295
|
+
id: 'DELETE'
|
|
296
|
+
})) : null)), props.showViewer && !multiple || show ? /*#__PURE__*/_react.default.createElement(_DocumentViewer.default, {
|
|
227
297
|
file: viewerFile,
|
|
228
298
|
onDocumentLoadSuccess: handleViewerLoad
|
|
229
299
|
}) : "", hasError ? /*#__PURE__*/_react.default.createElement("span", {
|
|
@@ -234,15 +304,15 @@ const DocumentUpload = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.def
|
|
|
234
304
|
exports.DocumentUpload = DocumentUpload;
|
|
235
305
|
|
|
236
306
|
const UploadField = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
237
|
-
const _React$
|
|
238
|
-
_React$
|
|
239
|
-
file = _React$
|
|
240
|
-
setFile = _React$
|
|
307
|
+
const _React$useState23 = _react.default.useState(null),
|
|
308
|
+
_React$useState24 = _slicedToArray(_React$useState23, 2),
|
|
309
|
+
file = _React$useState24[0],
|
|
310
|
+
setFile = _React$useState24[1];
|
|
241
311
|
|
|
242
|
-
const _React$
|
|
243
|
-
_React$
|
|
244
|
-
clearTrigger = _React$
|
|
245
|
-
setClearTrigger = _React$
|
|
312
|
+
const _React$useState25 = _react.default.useState(false),
|
|
313
|
+
_React$useState26 = _slicedToArray(_React$useState25, 2),
|
|
314
|
+
clearTrigger = _React$useState26[0],
|
|
315
|
+
setClearTrigger = _React$useState26[1];
|
|
246
316
|
|
|
247
317
|
return /*#__PURE__*/_react.default.createElement(_BaseField.BaseField, _extends({}, props, {
|
|
248
318
|
handle: props.handle,
|
|
@@ -251,14 +321,22 @@ const UploadField = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.defaul
|
|
|
251
321
|
setClearTrigger(!clearTrigger);
|
|
252
322
|
|
|
253
323
|
if (!_Utils.default.isNull(value)) {
|
|
254
|
-
let
|
|
324
|
+
let val = value;
|
|
325
|
+
|
|
326
|
+
if (value.map) {
|
|
327
|
+
val = value.map;
|
|
328
|
+
}
|
|
329
|
+
|
|
255
330
|
let fileMetaData = {};
|
|
256
|
-
fileMetaData.name =
|
|
257
|
-
fileMetaData.
|
|
331
|
+
fileMetaData.name = !_Utils.default.isNull(val.label) ? val.label : val.name;
|
|
332
|
+
fileMetaData.type = val.type;
|
|
333
|
+
fileMetaData.size = val.size;
|
|
334
|
+
fileMetaData.documentRepositoryId = !_Utils.default.isNull(val.key) ? val.key : val.documentRepositoryId;
|
|
335
|
+
fileMetaData.documentRepositoryCacheId = val.documentRepositoryCacheId;
|
|
258
336
|
|
|
259
|
-
if (!_Utils.default.isNull(
|
|
337
|
+
if (!_Utils.default.isNull(val.url)) {
|
|
260
338
|
let file = {};
|
|
261
|
-
file.base64 =
|
|
339
|
+
file.base64 = val.url;
|
|
262
340
|
setFile(file);
|
|
263
341
|
}
|
|
264
342
|
|