@agilemotion/oui-react-js 1.3.1 → 1.3.3
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 +148 -39
- package/dist/BasicApp.js +12 -5
- package/dist/BasicAppHome.js +18 -12
- package/dist/BusinessPortalApp.css +37 -0
- package/dist/BusinessPortalApp.js +90 -0
- package/dist/BusinessPortalAppHome.js +160 -0
- package/dist/RestUtils.js +65 -40
- package/dist/Utils.js +47 -1
- 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/AlertBar.js +40 -11
- package/dist/components/ConfirmationDialog.js +54 -8
- package/dist/components/DataGrid.css +3 -1
- package/dist/components/DataGrid.js +149 -82
- package/dist/components/DataGridFilter.js +85 -8
- package/dist/components/Dialog.js +258 -0
- package/dist/components/Graph.js +26 -18
- package/dist/components/GraphNode.js +0 -2
- package/dist/components/HtmlPanel.js +103 -4
- package/dist/components/Icon.js +60 -0
- package/dist/components/PopupView.js +55 -6
- package/dist/components/SignaturePanel.js +147 -0
- package/dist/components/StepperTitleBar.bck.css +85 -0
- package/dist/components/StepperTitleBar.css +53 -54
- package/dist/components/StepperTitleBar.js +42 -29
- package/dist/components/TabPanel.js +10 -11
- package/dist/components/TableCellContent.js +6 -3
- package/dist/components/TemplateDesigner.css +13 -0
- package/dist/components/TemplateDesigner.js +494 -0
- package/dist/components/TemplateItemEventHandler.js +440 -0
- package/dist/components/TemplateTable.js +222 -0
- package/dist/components/TitleBar.js +21 -14
- package/dist/components/Toolbar.js +7 -5
- package/dist/components/Tree.js +5 -2
- package/dist/components/dashboard/{BasicBusinessApp.js → BasicBusinessAppDashboard.js} +30 -25
- package/dist/components/dashboard/BusinessPortalAppDashboard.css +5 -0
- package/dist/components/dashboard/BusinessPortalAppDashboard.js +236 -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/AddressSearch.js +140 -0
- package/dist/components/form/BaseField.js +42 -8
- package/dist/components/form/Checkbox.js +3 -0
- package/dist/components/form/DatePicker.js +70 -4
- package/dist/components/form/FieldSet.js +247 -72
- package/dist/components/form/Form.js +178 -127
- package/dist/components/form/GridField.js +3 -2
- package/dist/components/form/ImageEditor.js +461 -0
- package/dist/components/form/LabelField.js +2 -2
- package/dist/components/form/LookupField.js +16 -4
- package/dist/components/form/RadioGroup.js +107 -0
- package/dist/components/form/Section.js +58 -19
- package/dist/components/form/SelectItem.js +14 -5
- package/dist/components/form/SignatureTemplateDesignerField.js +46 -0
- package/dist/components/form/TextField.js +5 -9
- package/dist/components/form/TransferList.js +7 -7
- package/dist/components/form/UploadField.js +184 -55
- package/dist/components/form/noimage-person.png +0 -0
- package/dist/components/form/noimage.png +0 -0
- package/dist/components/form/transparent.jpeg +0 -0
- package/dist/components/layout/CollapsiblePanel.js +0 -6
- package/dist/components/layout/Layout.js +49 -19
- package/dist/components/layout/View.css +43 -0
- package/dist/components/layout/View.js +76 -156
- package/dist/components/layout/ViewPort.js +32 -49
- package/dist/components/menu/MenuLink.js +7 -0
- package/dist/components/navbars/HomeNavbar.js +29 -14
- package/dist/components/navbars/PortalNavbar.css +75 -0
- package/dist/components/navbars/PortalNavbar.js +227 -0
- package/dist/components/signatures/AgilitySignaturePanel.js +312 -0
- package/dist/components/signatures/DocumentContainer.css +33 -0
- package/dist/components/signatures/DocumentContainer.js +206 -0
- package/dist/components/signatures/ImageSignatureInput.js +265 -0
- package/dist/components/signatures/ResponsiveTable.js +1 -3
- package/dist/components/signatures/SignatureInput.js +303 -0
- package/dist/components/signatures/SignatureInputProps.js +17 -11
- package/dist/components/signatures/SignatureTemplateDesigner.js +192 -81
- package/dist/components/signatures/transparent.jpeg +0 -0
- package/dist/event/LoadDataActionHandler.js +1 -1
- package/dist/event/Observable.js +1 -1
- package/dist/event/RouteActionHandler.js +18 -5
- package/dist/event/ServiceCallActionHandler.js +7 -3
- package/dist/js/Addresses.js +16 -9
- package/dist/view/Dashboard.js +27 -19
- 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 +268 -0
- package/dist/view/security/ResetPasswordBasic.js +1 -0
- package/package.json +25 -21
- package/dist/assets/img/flogo.png +0 -0
|
@@ -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;
|
|
@@ -0,0 +1,140 @@
|
|
|
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 _reactGoogleAutocomplete = _interopRequireDefault(require("react-google-autocomplete"));
|
|
11
|
+
|
|
12
|
+
var _core = require("@material-ui/core");
|
|
13
|
+
|
|
14
|
+
var _BaseField = require("./BaseField");
|
|
15
|
+
|
|
16
|
+
var _Utils = _interopRequireDefault(require("../../Utils"));
|
|
17
|
+
|
|
18
|
+
var _Close = _interopRequireDefault(require("@material-ui/icons/Close"));
|
|
19
|
+
|
|
20
|
+
var _InputAdornment = _interopRequireDefault(require("@material-ui/core/InputAdornment"));
|
|
21
|
+
|
|
22
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
|
+
|
|
24
|
+
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); }
|
|
25
|
+
|
|
26
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
27
|
+
|
|
28
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
29
|
+
|
|
30
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
31
|
+
|
|
32
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
33
|
+
|
|
34
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
35
|
+
|
|
36
|
+
const AddressSearchWrapper = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
37
|
+
const base = props.base;
|
|
38
|
+
|
|
39
|
+
const getAddressProp = (components, id) => {
|
|
40
|
+
var _iterator = _createForOfIteratorHelper(components),
|
|
41
|
+
_step;
|
|
42
|
+
|
|
43
|
+
try {
|
|
44
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
45
|
+
const component = _step.value;
|
|
46
|
+
|
|
47
|
+
var _iterator2 = _createForOfIteratorHelper(component.types),
|
|
48
|
+
_step2;
|
|
49
|
+
|
|
50
|
+
try {
|
|
51
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
52
|
+
const type = _step2.value;
|
|
53
|
+
|
|
54
|
+
if (type === id) {
|
|
55
|
+
return component.long_name;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
} catch (err) {
|
|
59
|
+
_iterator2.e(err);
|
|
60
|
+
} finally {
|
|
61
|
+
_iterator2.f();
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
} catch (err) {
|
|
65
|
+
_iterator.e(err);
|
|
66
|
+
} finally {
|
|
67
|
+
_iterator.f();
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return ' ';
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
return /*#__PURE__*/_react.default.createElement(_core.OutlinedInput, {
|
|
74
|
+
fullWidth: true,
|
|
75
|
+
variant: "outlined",
|
|
76
|
+
id: '__address_search__',
|
|
77
|
+
style: _Utils.default.mergeStyles({}, props.config),
|
|
78
|
+
endAdornment: base.value ? /*#__PURE__*/_react.default.createElement(_InputAdornment.default, {
|
|
79
|
+
position: "start",
|
|
80
|
+
style: {
|
|
81
|
+
cursor: "pointer"
|
|
82
|
+
},
|
|
83
|
+
onClick: () => {
|
|
84
|
+
base.handleValueChange(null);
|
|
85
|
+
document.getElementById("__address_search__").value = null;
|
|
86
|
+
}
|
|
87
|
+
}, /*#__PURE__*/_react.default.createElement(_Close.default, null)) : null,
|
|
88
|
+
inputComponent: (_ref) => {
|
|
89
|
+
let inputRef = _ref.inputRef,
|
|
90
|
+
onFocus = _ref.onFocus,
|
|
91
|
+
onBlur = _ref.onBlur,
|
|
92
|
+
props = _objectWithoutProperties(_ref, ["inputRef", "onFocus", "onBlur"]);
|
|
93
|
+
|
|
94
|
+
return /*#__PURE__*/_react.default.createElement(_reactGoogleAutocomplete.default, _extends({
|
|
95
|
+
apiKey: 'AIzaSyAqXhYU8TvunZtkJ5eAD6SfZyHqFOLLM8w'
|
|
96
|
+
}, props, {
|
|
97
|
+
onPlaceSelected: place => {
|
|
98
|
+
let data = {};
|
|
99
|
+
data.formattedAddress = place.formatted_address;
|
|
100
|
+
data.street = getAddressProp(place.address_components, 'street_number') + " " + getAddressProp(place.address_components, 'route');
|
|
101
|
+
data.suburb = getAddressProp(place.address_components, 'sublocality_level_1');
|
|
102
|
+
data.city = getAddressProp(place.address_components, 'locality');
|
|
103
|
+
data.municipality = getAddressProp(place.address_components, 'administrative_area_level_2');
|
|
104
|
+
data.province = getAddressProp(place.address_components, 'administrative_area_level_1');
|
|
105
|
+
data.country = getAddressProp(place.address_components, 'country');
|
|
106
|
+
data.postalCode = getAddressProp(place.address_components, 'postal_code');
|
|
107
|
+
base.handleValueChange(data);
|
|
108
|
+
document.getElementById("__address_search__").value = data.formattedAddress;
|
|
109
|
+
},
|
|
110
|
+
options: {
|
|
111
|
+
types: ["geocode", "establishment"],
|
|
112
|
+
componentRestrictions: {
|
|
113
|
+
"country": "za"
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}));
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
}));
|
|
120
|
+
|
|
121
|
+
const AddressSearch = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
122
|
+
return /*#__PURE__*/_react.default.createElement(_BaseField.BaseField, _extends({}, props, {
|
|
123
|
+
handle: props.handle,
|
|
124
|
+
valueParser: (value, inbound) => {
|
|
125
|
+
if (!_Utils.default.isNull(value)) {
|
|
126
|
+
if (!inbound) {
|
|
127
|
+
return value.formattedAddress;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
return value;
|
|
132
|
+
}
|
|
133
|
+
}), base => /*#__PURE__*/_react.default.createElement(AddressSearchWrapper, _extends({
|
|
134
|
+
ref: ref,
|
|
135
|
+
base: base
|
|
136
|
+
}, props)));
|
|
137
|
+
}));
|
|
138
|
+
|
|
139
|
+
var _default = AddressSearch;
|
|
140
|
+
exports.default = _default;
|
|
@@ -78,13 +78,20 @@ const BaseField = props => {
|
|
|
78
78
|
disabled = _React$useState16[0],
|
|
79
79
|
setDisabled = _React$useState16[1];
|
|
80
80
|
|
|
81
|
-
const _React$useState17 = _react.default.useState(
|
|
81
|
+
const _React$useState17 = _react.default.useState(false),
|
|
82
82
|
_React$useState18 = _slicedToArray(_React$useState17, 2),
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
visible = _React$useState18[0],
|
|
84
|
+
setVisible = _React$useState18[1];
|
|
85
|
+
|
|
86
|
+
const _React$useState19 = _react.default.useState(null),
|
|
87
|
+
_React$useState20 = _slicedToArray(_React$useState19, 2),
|
|
88
|
+
required = _React$useState20[0],
|
|
89
|
+
setRequired = _React$useState20[1];
|
|
85
90
|
|
|
86
91
|
const validateOnChange = _react.default.useRef();
|
|
87
92
|
|
|
93
|
+
const valid = _react.default.useRef(false);
|
|
94
|
+
|
|
88
95
|
_react.default.useEffect(() => {
|
|
89
96
|
setValue(valueObject[valueProperty]);
|
|
90
97
|
}, [valueObject[valueProperty]]); // Change the required value and re-validate field if necessary
|
|
@@ -118,6 +125,7 @@ const BaseField = props => {
|
|
|
118
125
|
|
|
119
126
|
setErrorMessage(_ApplicationContext.default.isFormMarkersEnabled() ? result.message : "");
|
|
120
127
|
setHasError(!result.valid && _ApplicationContext.default.isFormMarkersEnabled());
|
|
128
|
+
valid.current = result.valid && _ApplicationContext.default.isFormMarkersEnabled();
|
|
121
129
|
props.form().setFieldError(config.id, typeof result.message === 'undefined' ? null : result.message);
|
|
122
130
|
return result.valid;
|
|
123
131
|
};
|
|
@@ -133,6 +141,7 @@ const BaseField = props => {
|
|
|
133
141
|
_Observable.default.addSystemSubscriptions(parsedConfig);
|
|
134
142
|
|
|
135
143
|
setConfig(parsedConfig);
|
|
144
|
+
setVisible(_Utils.default.evaluateBooleanExpression(parsedConfig.visible, parsedConfig.id, true));
|
|
136
145
|
}
|
|
137
146
|
});
|
|
138
147
|
|
|
@@ -249,6 +258,10 @@ const BaseField = props => {
|
|
|
249
258
|
return value;
|
|
250
259
|
},
|
|
251
260
|
|
|
261
|
+
get valid() {
|
|
262
|
+
return valid.current;
|
|
263
|
+
},
|
|
264
|
+
|
|
252
265
|
get id() {
|
|
253
266
|
return props.config.id;
|
|
254
267
|
},
|
|
@@ -266,7 +279,7 @@ const BaseField = props => {
|
|
|
266
279
|
|
|
267
280
|
get value() {
|
|
268
281
|
if (!_Utils.default.isNull(valueObject) && !_Utils.default.isNull(valueProperty)) {
|
|
269
|
-
return valueObject[valueProperty];
|
|
282
|
+
return !_Utils.default.isNull(props.valueParser) ? props.valueParser(valueObject[valueProperty], false) : valueObject[valueProperty];
|
|
270
283
|
}
|
|
271
284
|
|
|
272
285
|
return null;
|
|
@@ -284,20 +297,34 @@ const BaseField = props => {
|
|
|
284
297
|
setDisabled(disabled);
|
|
285
298
|
},
|
|
286
299
|
|
|
300
|
+
set visible(visible) {
|
|
301
|
+
setVisible(visible);
|
|
302
|
+
},
|
|
303
|
+
|
|
287
304
|
handleLoadComplete() {
|
|
288
305
|
loadingRef.current = false;
|
|
289
306
|
},
|
|
290
307
|
|
|
291
308
|
refresh() {
|
|
309
|
+
setVisible(_Utils.default.evaluateBooleanExpression(config.visible, config.id, true));
|
|
292
310
|
setDisabled(_Utils.default.evaluateBooleanExpression(config.disabled, config.id));
|
|
293
311
|
let requiredNewVal = !_Utils.default.isNull(config.validator) ? !_Utils.default.evaluateBooleanExpression(config.validator.nullable, config.id, true) : false;
|
|
294
312
|
validateOnChange.current = required !== null && required !== requiredNewVal && loadingRef.current === false;
|
|
295
313
|
setRequired(requiredNewVal);
|
|
296
314
|
},
|
|
297
315
|
|
|
298
|
-
|
|
316
|
+
get required() {
|
|
317
|
+
return required;
|
|
318
|
+
},
|
|
319
|
+
|
|
320
|
+
setFieldRequired(newVal) {
|
|
299
321
|
validateOnChange.current = true;
|
|
300
|
-
setRequired(
|
|
322
|
+
setRequired(newVal);
|
|
323
|
+
},
|
|
324
|
+
|
|
325
|
+
setFieldRequired(newVal, validate) {
|
|
326
|
+
validateOnChange.current = validate;
|
|
327
|
+
setRequired(newVal);
|
|
301
328
|
},
|
|
302
329
|
|
|
303
330
|
getChildren: () => {
|
|
@@ -310,7 +337,14 @@ const BaseField = props => {
|
|
|
310
337
|
};
|
|
311
338
|
};
|
|
312
339
|
|
|
313
|
-
return /*#__PURE__*/_react.default.createElement("
|
|
340
|
+
return config ? /*#__PURE__*/_react.default.createElement("div", {
|
|
341
|
+
className: "col",
|
|
342
|
+
key: config.id,
|
|
343
|
+
style: {
|
|
344
|
+
textAlign: 'left',
|
|
345
|
+
display: !visible || _Utils.default.getComponentAttribute(config, 'hidden', false) === true ? 'none' : 'block'
|
|
346
|
+
}
|
|
347
|
+
}, /*#__PURE__*/_react.default.createElement("span", null, props.children({
|
|
314
348
|
required: required,
|
|
315
349
|
disabled: disabled,
|
|
316
350
|
valueObject: valueObject,
|
|
@@ -324,7 +358,7 @@ const BaseField = props => {
|
|
|
324
358
|
doValidation: doValidation,
|
|
325
359
|
errorMessage: errorMessage,
|
|
326
360
|
loadingRef: loadingRef
|
|
327
|
-
}));
|
|
361
|
+
}))) : null;
|
|
328
362
|
};
|
|
329
363
|
|
|
330
364
|
exports.BaseField = BaseField;
|
|
@@ -13,6 +13,8 @@ var _FormControlLabel = _interopRequireDefault(require("@material-ui/core/FormCo
|
|
|
13
13
|
|
|
14
14
|
var _BaseField = require("./BaseField");
|
|
15
15
|
|
|
16
|
+
var _Utils = _interopRequireDefault(require("../../Utils"));
|
|
17
|
+
|
|
16
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
19
|
|
|
18
20
|
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); }
|
|
@@ -23,6 +25,7 @@ const CheckboxWrapper = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.de
|
|
|
23
25
|
ref: ref,
|
|
24
26
|
control: /*#__PURE__*/_react.default.createElement(_Checkbox.default, {
|
|
25
27
|
checked: base.value || false,
|
|
28
|
+
style: _Utils.default.mergeStyles({}, props.config),
|
|
26
29
|
key: props.key,
|
|
27
30
|
value: base.value || false,
|
|
28
31
|
disabled: base.disabled,
|
|
@@ -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,48 @@ 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 = 0;
|
|
81
|
+
|
|
82
|
+
if (tokens.length > 0 && !_Utils.default.isNull(tokens[1])) {
|
|
83
|
+
days = parseFloat(tokens[1].replace('d', '').trim());
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
let limit = new Date();
|
|
87
|
+
|
|
88
|
+
if ("-" === operator) {
|
|
89
|
+
limit.setDate(limit.getDate() - days);
|
|
90
|
+
} else {
|
|
91
|
+
limit.setDate(limit.getDate() + days);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return limit.getFullYear() + "-" + formatNumber(limit.getMonth() + 1) + "-" + formatNumber(limit.getDate());
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return id === "minDate" ? "1970-01-01" : "9000-12-31";
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
_react.default.useEffect(() => {
|
|
102
|
+
if (minDate === null) {
|
|
103
|
+
setMinDate(getLimitDate("minDate"));
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (maxDate === null) {
|
|
107
|
+
setMaxDate(getLimitDate("maxDate"));
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
|
|
47
111
|
const secondaryColor = (0, _reactRedux.useSelector)(state => state.dashboard.secondaryThemeColor);
|
|
48
112
|
const ThemedKeyboardDatePicker = (0, _styles.withStyles)({
|
|
49
113
|
root: {
|
|
@@ -72,22 +136,24 @@ const CustomDatePickerComponent = /*#__PURE__*/_react.default.memo( /*#__PURE__*
|
|
|
72
136
|
required: base.required,
|
|
73
137
|
format: "dd/MM/yyyy",
|
|
74
138
|
label: props.config.attributes['label'],
|
|
75
|
-
value: base.value,
|
|
139
|
+
value: base.value ? base.value : null,
|
|
76
140
|
className: props.className,
|
|
77
141
|
error: base.hasError,
|
|
78
142
|
margin: "dense",
|
|
79
143
|
inputVariant: "outlined",
|
|
80
|
-
style: {
|
|
144
|
+
style: _Utils.default.mergeStyles({
|
|
81
145
|
minWidth: minWidth,
|
|
82
146
|
width: width,
|
|
83
147
|
textAlign: 'left'
|
|
84
|
-
},
|
|
148
|
+
}, props.config),
|
|
85
149
|
onChange: handleDateChange,
|
|
86
150
|
size: "small",
|
|
87
151
|
KeyboardButtonProps: {
|
|
88
152
|
'aria-label': 'change date',
|
|
89
153
|
'disabled': props.disabled
|
|
90
154
|
},
|
|
155
|
+
minDate: minDate,
|
|
156
|
+
maxDate: maxDate,
|
|
91
157
|
readOnly: props.readOnly
|
|
92
158
|
})));
|
|
93
159
|
}));
|
|
@@ -96,7 +162,7 @@ const DatePicker = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default
|
|
|
96
162
|
return /*#__PURE__*/_react.default.createElement(_BaseField.BaseField, _extends({}, props, {
|
|
97
163
|
handle: props.handle,
|
|
98
164
|
valueParser: (value, inbound) => {
|
|
99
|
-
return !_Utils.default.isNull(value) ? inbound ? new Date(value) : value.getTime() : null;
|
|
165
|
+
return !_Utils.default.isNull(value) ? inbound ? new Date(parseFloat(value.toString())) : value.getTime() : null;
|
|
100
166
|
}
|
|
101
167
|
}), base => /*#__PURE__*/_react.default.createElement(CustomDatePickerComponent, _extends({
|
|
102
168
|
ref: ref,
|