@agilemotion/oui-react-js 1.3.2 → 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 +90 -41
- package/dist/BasicAppHome.js +16 -10
- package/dist/BusinessPortalApp.js +25 -50
- package/dist/BusinessPortalAppHome.js +102 -109
- package/dist/RestUtils.js +64 -35
- package/dist/Utils.js +47 -1
- 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/HtmlPanel.js +103 -4
- package/dist/components/Icon.js +52 -0
- package/dist/components/PopupView.js +55 -6
- package/dist/components/SignaturePanel.js +40 -11
- package/dist/components/StepperTitleBar.bck.css +85 -0
- package/dist/components/StepperTitleBar.css +53 -54
- package/dist/components/StepperTitleBar.js +39 -28
- 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/BasicBusinessAppDashboard.js +14 -10
- package/dist/components/dashboard/BusinessPortalAppDashboard.js +79 -34
- package/dist/components/dashboard/components/blackDashboard/sidebar/Sidebar.js +1 -1
- package/dist/components/dashboard/components/portal/Workspace.css +6 -6
- package/dist/components/form/AddressSearch.js +140 -0
- package/dist/components/form/BaseField.js +31 -6
- package/dist/components/form/Checkbox.js +3 -0
- package/dist/components/form/DatePicker.js +12 -7
- package/dist/components/form/FieldSet.js +246 -71
- package/dist/components/form/Form.js +153 -122
- 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 +5 -3
- 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 +93 -42
- 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 +41 -20
- package/dist/components/layout/View.css +43 -0
- package/dist/components/layout/View.js +76 -156
- package/dist/components/layout/ViewPort.js +29 -47
- package/dist/components/navbars/HomeNavbar.js +31 -6
- package/dist/components/navbars/PortalNavbar.css +2 -2
- package/dist/components/navbars/PortalNavbar.js +125 -36
- 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 +186 -77
- 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 +17 -4
- package/dist/event/ServiceCallActionHandler.js +7 -3
- package/dist/js/Addresses.js +16 -9
- package/dist/view/Dashboard.js +10 -6
- package/dist/view/security/LoginBusinessPortal.js +1 -0
- package/package.json +4 -1
|
@@ -50,19 +50,26 @@ const TitleBar = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.f
|
|
|
50
50
|
|
|
51
51
|
let eventHandlingConfig = _Utils.default.isNull(parsedConfig.eventHandlingConfig) ? {} : parsedConfig.eventHandlingConfig;
|
|
52
52
|
eventHandlingConfig.subscriptions = _Utils.default.isNull(eventHandlingConfig.subscriptions) ? [] : eventHandlingConfig.subscriptions;
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
53
|
+
|
|
54
|
+
let titleValue = _Utils.default.getComponentAttribute(props.config, 'title', null);
|
|
55
|
+
|
|
56
|
+
if (_Utils.default.isNull(titleValue)) {
|
|
57
|
+
let subscription = {
|
|
58
|
+
publisher: "applicationContext",
|
|
59
|
+
eventType: _EventType.default.APPLICATION_CONTEXT_CHANGE,
|
|
60
|
+
actions: [{
|
|
61
|
+
actionType: "script",
|
|
62
|
+
script: {
|
|
63
|
+
lines: ["if($event.data.name === 'title'){", " let component = @#{".concat(props.config.id, "};"), " if(component) {", " component.title = $event.data.value", " }", "}"]
|
|
64
|
+
}
|
|
65
|
+
}]
|
|
66
|
+
};
|
|
67
|
+
eventHandlingConfig.subscriptions.push(subscription);
|
|
68
|
+
|
|
69
|
+
_Observable.default.addSubscriptions(eventHandlingConfig, props.handle, props.viewId);
|
|
70
|
+
} else {
|
|
71
|
+
setTitle(titleValue);
|
|
72
|
+
}
|
|
66
73
|
|
|
67
74
|
props.loadCompleteHandler(props.config.id);
|
|
68
75
|
setInitializing(false);
|
|
@@ -90,7 +97,7 @@ const TitleBar = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.f
|
|
|
90
97
|
ref: ref
|
|
91
98
|
}, !_Utils.default.isNull(props.config) ? /*#__PURE__*/_react.default.createElement("div", {
|
|
92
99
|
style: {
|
|
93
|
-
padding: '32px
|
|
100
|
+
padding: '32px 0 4px 0',
|
|
94
101
|
fontSize: '24px',
|
|
95
102
|
color: '#202124'
|
|
96
103
|
}
|
|
@@ -278,7 +278,10 @@ const Toolbar = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
|
278
278
|
}, toolbar.sections.map(section => {
|
|
279
279
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
280
280
|
className: "col-*-*",
|
|
281
|
-
key: ++sectionKeyCounter
|
|
281
|
+
key: ++sectionKeyCounter,
|
|
282
|
+
style: {
|
|
283
|
+
textAlign: section.halign ? section.halign.toLowerCase() : null
|
|
284
|
+
}
|
|
282
285
|
}, renderSection(section, counter++));
|
|
283
286
|
}));
|
|
284
287
|
}
|
|
@@ -295,11 +298,10 @@ const Toolbar = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
|
295
298
|
|
|
296
299
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
297
300
|
ref: ref,
|
|
298
|
-
style: {
|
|
299
|
-
padding: _Utils.default.getComponentAttribute(props.config, 'padding', null),
|
|
301
|
+
style: _Utils.default.mergeStyles({
|
|
300
302
|
borderBottom: getBorderBottom(),
|
|
301
|
-
margin:
|
|
302
|
-
}
|
|
303
|
+
margin: '0'
|
|
304
|
+
}, props.config)
|
|
303
305
|
}, render(props.config));
|
|
304
306
|
});
|
|
305
307
|
|
package/dist/components/Tree.js
CHANGED
|
@@ -179,9 +179,12 @@ const Tree = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
|
179
179
|
if (!_Utils.default.isNull(service)) {
|
|
180
180
|
(0, _RestUtils.invokeRpc)(service, props.handle, props.viewId, result => {
|
|
181
181
|
try {
|
|
182
|
-
expand(result.data);
|
|
183
|
-
setRoot(result.data);
|
|
184
182
|
props.loadCompleteHandler(props.config.id);
|
|
183
|
+
|
|
184
|
+
if (result.data) {
|
|
185
|
+
expand(result.data);
|
|
186
|
+
setRoot(result.data);
|
|
187
|
+
}
|
|
185
188
|
} catch (e) {
|
|
186
189
|
props.console.error(e);
|
|
187
190
|
|
|
@@ -201,6 +201,7 @@ const BasicBusinessAppDashboard = props => {
|
|
|
201
201
|
newRoute.level = 0;
|
|
202
202
|
newRoute.isParent = true;
|
|
203
203
|
newRoutes.push(newRoute);
|
|
204
|
+
console.log(props.settings.systemProfileDto);
|
|
204
205
|
|
|
205
206
|
if (!_Utils.default.isNull(props.settings.systemProfileDto.modules)) {
|
|
206
207
|
for (let i = 0; i < props.settings.systemProfileDto.modules.length; i++) {
|
|
@@ -221,16 +222,19 @@ const BasicBusinessAppDashboard = props => {
|
|
|
221
222
|
}
|
|
222
223
|
}
|
|
223
224
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
225
|
+
if (props.settings.settingsMenu) {
|
|
226
|
+
newRoute = {};
|
|
227
|
+
newRoute.name = "Settings";
|
|
228
|
+
newRoute.icon = "fa fa-cog";
|
|
229
|
+
newRoute.layout = "/admin";
|
|
230
|
+
newRoute.isParent = true;
|
|
231
|
+
newRoute.collapse = true;
|
|
232
|
+
newRoute.level = 0;
|
|
233
|
+
newRoute.state = "settingsMenuCollapse";
|
|
234
|
+
newRoute.views = getViews(props.settings.settingsMenu.menus, 1);
|
|
235
|
+
newRoutes.push(newRoute);
|
|
236
|
+
}
|
|
237
|
+
|
|
234
238
|
setRoutes(newRoutes);
|
|
235
239
|
props.settings.dashboardMenu = createNewMenu.items.length > 0 ? dashboardMenu : null;
|
|
236
240
|
setLoading(false);
|
|
@@ -17,6 +17,8 @@ require("./BusinessPortalAppDashboard.css");
|
|
|
17
17
|
|
|
18
18
|
var _Workspace = _interopRequireDefault(require("./components/portal/Workspace"));
|
|
19
19
|
|
|
20
|
+
var _Observable = _interopRequireDefault(require("../../event/Observable"));
|
|
21
|
+
|
|
20
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
23
|
|
|
22
24
|
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(_e2) { throw _e2; }, 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(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
@@ -35,7 +37,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
35
37
|
|
|
36
38
|
let ps;
|
|
37
39
|
|
|
38
|
-
const BusinessPortalAppDashboard = props => {
|
|
40
|
+
const BusinessPortalAppDashboard = /*#__PURE__*/_react.default.memo(props => {
|
|
39
41
|
const _React$useState = _react.default.useState(true),
|
|
40
42
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
41
43
|
loading = _React$useState2[0],
|
|
@@ -46,15 +48,22 @@ const BusinessPortalAppDashboard = props => {
|
|
|
46
48
|
routes = _React$useState4[0],
|
|
47
49
|
setRoutes = _React$useState4[1];
|
|
48
50
|
|
|
49
|
-
const _React$useState5 = _react.default.useState(
|
|
51
|
+
const _React$useState5 = _react.default.useState(null),
|
|
50
52
|
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
51
|
-
|
|
52
|
-
|
|
53
|
+
currentModuleMenu = _React$useState6[0],
|
|
54
|
+
setCurrentModuleMenu = _React$useState6[1];
|
|
55
|
+
|
|
56
|
+
const _React$useState7 = _react.default.useState("data:image/png;base64," + props.logo),
|
|
57
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
58
|
+
logo = _React$useState8[0],
|
|
59
|
+
setLogo = _React$useState8[1];
|
|
53
60
|
|
|
54
61
|
const getItems = (items, level) => {
|
|
55
62
|
let newItems = [];
|
|
56
63
|
|
|
57
64
|
for (let i = 0; i < items.length; i++) {
|
|
65
|
+
_Observable.default.clearComponentEventListeners(items[i].id);
|
|
66
|
+
|
|
58
67
|
let createItem = {};
|
|
59
68
|
createItem.name = items[i].attributes.label;
|
|
60
69
|
createItem.mini = "SS";
|
|
@@ -78,6 +87,8 @@ const BusinessPortalAppDashboard = props => {
|
|
|
78
87
|
let newViews = [];
|
|
79
88
|
|
|
80
89
|
for (let i = 0; i < menus.length; i++) {
|
|
90
|
+
_Observable.default.clearComponentEventListeners(menus[i].id);
|
|
91
|
+
|
|
81
92
|
let createView = {};
|
|
82
93
|
createView.name = menus[i].attributes.label;
|
|
83
94
|
createView.mini = "SS";
|
|
@@ -98,19 +109,9 @@ const BusinessPortalAppDashboard = props => {
|
|
|
98
109
|
};
|
|
99
110
|
|
|
100
111
|
_react.default.useEffect(() => {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
if (navigator.platform.indexOf("Win") > -1) {
|
|
104
|
-
ps.destroy();
|
|
105
|
-
document.documentElement.className.add("perfect-scrollbar-off");
|
|
106
|
-
document.documentElement.classList.remove("perfect-scrollbar-on");
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
window.removeEventListener("scroll", showNavbarButton); //dispatch(actionCreators.setSecondaryThemeColor(props.settings.systemProfileDto.secondCorporateBrandColor));
|
|
110
|
-
|
|
111
|
-
if (!_Utils.default.isNull(props.settings)) {
|
|
112
|
-
//alert(JSON.stringify(props.settings.menu));
|
|
112
|
+
if (!_Utils.default.isNull(currentModuleMenu) && !_Utils.default.isNull(props.settings.menu) && !_Utils.default.isNull(props.settings.menu.menus)) {
|
|
113
113
|
let newRoutes = [];
|
|
114
|
+
let currentMenu = null;
|
|
114
115
|
|
|
115
116
|
var _iterator = _createForOfIteratorHelper(props.settings.menu.menus),
|
|
116
117
|
_step;
|
|
@@ -118,23 +119,10 @@ const BusinessPortalAppDashboard = props => {
|
|
|
118
119
|
try {
|
|
119
120
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
120
121
|
const menu = _step.value;
|
|
121
|
-
let newRoute = {};
|
|
122
|
-
newRoute.name = menu.attributes.label;
|
|
123
|
-
|
|
124
|
-
if (!_Utils.default.isNull(menu.icon)) {
|
|
125
|
-
newRoute.icon = menu.icon;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
newRoute.layout = "/admin";
|
|
129
|
-
newRoute.level = 0;
|
|
130
|
-
newRoute.isParent = true;
|
|
131
|
-
newRoute.item = menu;
|
|
132
|
-
newRoutes.push(newRoute);
|
|
133
122
|
|
|
134
|
-
if (
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
newRoute.views = getViews(menu.items, 1);
|
|
123
|
+
if (menu.id === currentModuleMenu) {
|
|
124
|
+
currentMenu = menu;
|
|
125
|
+
break;
|
|
138
126
|
}
|
|
139
127
|
}
|
|
140
128
|
} catch (err) {
|
|
@@ -143,8 +131,61 @@ const BusinessPortalAppDashboard = props => {
|
|
|
143
131
|
_iterator.f();
|
|
144
132
|
}
|
|
145
133
|
|
|
134
|
+
if (currentMenu != null) {
|
|
135
|
+
var _iterator2 = _createForOfIteratorHelper(currentMenu.items),
|
|
136
|
+
_step2;
|
|
137
|
+
|
|
138
|
+
try {
|
|
139
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
140
|
+
const item = _step2.value;
|
|
141
|
+
|
|
142
|
+
_Observable.default.clearComponentEventListeners(item.id);
|
|
143
|
+
|
|
144
|
+
let newRoute = {};
|
|
145
|
+
newRoute.name = item.attributes.label;
|
|
146
|
+
|
|
147
|
+
if (!_Utils.default.isNull(item.icon)) {
|
|
148
|
+
newRoute.icon = item.icon;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
newRoute.layout = "/admin";
|
|
152
|
+
newRoute.level = 0;
|
|
153
|
+
newRoute.isParent = false;
|
|
154
|
+
newRoute.item = item;
|
|
155
|
+
newRoutes.push(newRoute);
|
|
156
|
+
|
|
157
|
+
if (!_Utils.default.isNull(item.items) && item.items.length > 0) {
|
|
158
|
+
newRoute.collapse = false;
|
|
159
|
+
newRoute.state = item.name + "Collapse";
|
|
160
|
+
newRoute.views = getViews(item.items, 0);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
} catch (err) {
|
|
164
|
+
_iterator2.e(err);
|
|
165
|
+
} finally {
|
|
166
|
+
_iterator2.f();
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
146
170
|
setRoutes(newRoutes);
|
|
147
|
-
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
setLoading(false);
|
|
174
|
+
}, [currentModuleMenu]);
|
|
175
|
+
|
|
176
|
+
_react.default.useEffect(() => {
|
|
177
|
+
document.body.classList.add("white-content");
|
|
178
|
+
|
|
179
|
+
if (navigator.platform.indexOf("Win") > -1) {
|
|
180
|
+
ps.destroy();
|
|
181
|
+
document.documentElement.className.add("perfect-scrollbar-off");
|
|
182
|
+
document.documentElement.classList.remove("perfect-scrollbar-on");
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
window.removeEventListener("scroll", showNavbarButton); //dispatch(actionCreators.setSecondaryThemeColor(props.settings.systemProfileDto.secondCorporateBrandColor));
|
|
186
|
+
|
|
187
|
+
if (!_Utils.default.isNull(props.settings)) {
|
|
188
|
+
setCurrentModuleMenu("homeMenu");
|
|
148
189
|
}
|
|
149
190
|
}, [props.settings]);
|
|
150
191
|
|
|
@@ -168,6 +209,10 @@ const BusinessPortalAppDashboard = props => {
|
|
|
168
209
|
logoutCallBack: props.logoutCallBack,
|
|
169
210
|
appLogoPath: props.appLogoPath,
|
|
170
211
|
avatar: props.avatar,
|
|
212
|
+
moduleMenus: props.settings.menu.menus,
|
|
213
|
+
moduleChangeHandler: selected => {
|
|
214
|
+
setCurrentModuleMenu(selected);
|
|
215
|
+
},
|
|
171
216
|
logo: {
|
|
172
217
|
outterLink: "",
|
|
173
218
|
text: "",
|
|
@@ -181,7 +226,7 @@ const BusinessPortalAppDashboard = props => {
|
|
|
181
226
|
activeRouteMenu: 'My Work Items',
|
|
182
227
|
secondaryColor: props.settings.secondaryColor
|
|
183
228
|
}))));
|
|
184
|
-
};
|
|
229
|
+
});
|
|
185
230
|
|
|
186
231
|
BusinessPortalAppDashboard.propTypes = {
|
|
187
232
|
children: _propTypes.default.element,
|
|
@@ -128,7 +128,7 @@ class Sidebar extends _react.default.Component {
|
|
|
128
128
|
}, /*#__PURE__*/_react.default.createElement(_MenuLink.default, {
|
|
129
129
|
config: prop.item,
|
|
130
130
|
clickCallback: prop.name === 'Dashboard' ? this.props.dashboardLauncher : null,
|
|
131
|
-
autoClick: prop.name === 'My Work Items',
|
|
131
|
+
autoClick: prop.name === 'My Work Items' || prop.item && prop.item.defaultItem,
|
|
132
132
|
viewId: "menuBar",
|
|
133
133
|
icon: prop.icon,
|
|
134
134
|
iconColor: (prop.name === 'Dashboard' || prop.name === 'My Work Items') && this.activeRoute(prop.name) ? secondaryThemeColor : null,
|
|
@@ -5,21 +5,21 @@
|
|
|
5
5
|
|
|
6
6
|
.workspace-left {
|
|
7
7
|
width: 32%;
|
|
8
|
-
padding-right: 6px
|
|
8
|
+
/*padding-right: 6px*/;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
.workspace-right {
|
|
12
|
-
width:
|
|
13
|
-
margin:
|
|
12
|
+
width: 45%;
|
|
13
|
+
margin: 16px;
|
|
14
14
|
border: 1px solid #e1e1e1;
|
|
15
|
-
height: calc(100vh -
|
|
15
|
+
height: calc(100vh - 96px) !important;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
.sidebar-customizer {
|
|
19
19
|
position: relative !important;
|
|
20
|
-
margin-top:
|
|
20
|
+
margin-top: 16px !important;
|
|
21
21
|
height: auto !important;
|
|
22
|
-
max-height: calc(100vh -
|
|
22
|
+
max-height: calc(100vh - 96px) !important;
|
|
23
23
|
box-shadow: none !important;
|
|
24
24
|
border: 1px solid #e1e1e1;
|
|
25
25
|
}
|
|
@@ -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,11 +297,16 @@ 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;
|
|
@@ -319,7 +337,14 @@ const BaseField = props => {
|
|
|
319
337
|
};
|
|
320
338
|
};
|
|
321
339
|
|
|
322
|
-
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({
|
|
323
348
|
required: required,
|
|
324
349
|
disabled: disabled,
|
|
325
350
|
valueObject: valueObject,
|
|
@@ -333,7 +358,7 @@ const BaseField = props => {
|
|
|
333
358
|
doValidation: doValidation,
|
|
334
359
|
errorMessage: errorMessage,
|
|
335
360
|
loadingRef: loadingRef
|
|
336
|
-
}));
|
|
361
|
+
}))) : null;
|
|
337
362
|
};
|
|
338
363
|
|
|
339
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,
|
|
@@ -77,7 +77,12 @@ const CustomDatePickerComponent = /*#__PURE__*/_react.default.memo( /*#__PURE__*
|
|
|
77
77
|
if (dateAttr.toString().includes('now')) {
|
|
78
78
|
let operator = dateAttr.toString().includes("-") ? '-' : '+';
|
|
79
79
|
let tokens = dateAttr.toString().split(operator);
|
|
80
|
-
let days =
|
|
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
|
+
|
|
81
86
|
let limit = new Date();
|
|
82
87
|
|
|
83
88
|
if ("-" === operator) {
|
|
@@ -90,7 +95,7 @@ const CustomDatePickerComponent = /*#__PURE__*/_react.default.memo( /*#__PURE__*
|
|
|
90
95
|
}
|
|
91
96
|
}
|
|
92
97
|
|
|
93
|
-
return
|
|
98
|
+
return id === "minDate" ? "1970-01-01" : "9000-12-31";
|
|
94
99
|
};
|
|
95
100
|
|
|
96
101
|
_react.default.useEffect(() => {
|
|
@@ -136,19 +141,19 @@ const CustomDatePickerComponent = /*#__PURE__*/_react.default.memo( /*#__PURE__*
|
|
|
136
141
|
error: base.hasError,
|
|
137
142
|
margin: "dense",
|
|
138
143
|
inputVariant: "outlined",
|
|
139
|
-
style: {
|
|
144
|
+
style: _Utils.default.mergeStyles({
|
|
140
145
|
minWidth: minWidth,
|
|
141
146
|
width: width,
|
|
142
147
|
textAlign: 'left'
|
|
143
|
-
},
|
|
148
|
+
}, props.config),
|
|
144
149
|
onChange: handleDateChange,
|
|
145
150
|
size: "small",
|
|
146
151
|
KeyboardButtonProps: {
|
|
147
152
|
'aria-label': 'change date',
|
|
148
153
|
'disabled': props.disabled
|
|
149
154
|
},
|
|
150
|
-
minDate: minDate
|
|
151
|
-
maxDate: maxDate
|
|
155
|
+
minDate: minDate,
|
|
156
|
+
maxDate: maxDate,
|
|
152
157
|
readOnly: props.readOnly
|
|
153
158
|
})));
|
|
154
159
|
}));
|
|
@@ -157,7 +162,7 @@ const DatePicker = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default
|
|
|
157
162
|
return /*#__PURE__*/_react.default.createElement(_BaseField.BaseField, _extends({}, props, {
|
|
158
163
|
handle: props.handle,
|
|
159
164
|
valueParser: (value, inbound) => {
|
|
160
|
-
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;
|
|
161
166
|
}
|
|
162
167
|
}), base => /*#__PURE__*/_react.default.createElement(CustomDatePickerComponent, _extends({
|
|
163
168
|
ref: ref,
|