@agilemotion/oui-react-js 1.2.6 → 1.2.8
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 +244 -250
- package/dist/BasicApp.js +53 -97
- package/dist/BasicAppHome.js +86 -122
- package/dist/DynamicJS.js +65 -88
- package/dist/RestUtils.js +284 -315
- package/dist/TypedValue.js +15 -18
- package/dist/Utils.js +224 -262
- package/dist/assets/jss/components/authNavbarStyle.js +162 -164
- package/dist/assets/jss/components/buttonStyle.js +1 -1
- package/dist/assets/jss/components/cardAvatarStyle.js +1 -1
- package/dist/assets/jss/components/cardBodyStyle.js +1 -1
- package/dist/assets/jss/components/cardFooterStyle.js +1 -1
- package/dist/assets/jss/components/cardHeaderStyle.js +1 -1
- package/dist/assets/jss/components/cardIconStyle.js +1 -1
- package/dist/assets/jss/components/cardStyle.js +1 -1
- package/dist/assets/jss/components/cardTextStyle.js +1 -1
- package/dist/assets/jss/components/customDropdownStyle.js +192 -194
- package/dist/assets/jss/components/customInputStyle.js +1 -1
- package/dist/assets/jss/components/dropdownStyle.js +107 -109
- package/dist/assets/jss/components/footerStyle.js +1 -1
- package/dist/assets/jss/components/headerLinksStyle.js +95 -97
- package/dist/assets/jss/components/headerStyle.js +60 -62
- package/dist/assets/jss/components/navbarLinksStyle.js +137 -139
- package/dist/assets/jss/components/navbarStyle.js +71 -73
- package/dist/assets/jss/components/sidebarStyle.js +453 -455
- package/dist/assets/jss/components/typographyStyle.js +1 -1
- package/dist/assets/jss/rootStyle.js +57 -57
- package/dist/assets/jss/views/layoutStyle.js +42 -44
- package/dist/assets/jss/views/loginBasicStyle.js +1 -1
- package/dist/assets/jss/views/loginStyle.js +87 -89
- package/dist/components/AlertBar.js +21 -23
- package/dist/components/AlertItem.js +23 -25
- package/dist/components/AlertTemplate.js +29 -30
- package/dist/components/Button.js +35 -37
- package/dist/components/ConfirmationDialog.js +3 -3
- package/dist/components/DataGrid.js +250 -276
- package/dist/components/DataGridColumn.js +34 -36
- package/dist/components/DataGridFilter.js +92 -94
- package/dist/components/DataGridHeading.js +32 -38
- package/dist/components/DocumentViewer.js +12 -11
- package/dist/components/Graph.js +34 -50
- package/dist/components/GraphNode.js +53 -56
- package/dist/components/HtmlPanel.js +6 -8
- package/dist/components/Icon.js +28 -58
- package/dist/components/LoadingIndicator.js +2 -2
- package/dist/components/PopupView.js +15 -17
- package/dist/components/RegularButton.js +20 -20
- package/dist/components/TabPage.js +23 -25
- package/dist/components/TabPanel.js +34 -34
- package/dist/components/TableCellContent.js +34 -34
- package/dist/components/TitleBar.js +16 -16
- package/dist/components/Toolbar.js +112 -118
- package/dist/components/Tooltip.js +35 -43
- package/dist/components/Tree.js +54 -60
- package/dist/components/card/Card.js +17 -17
- package/dist/components/card/CardAvatar.js +10 -10
- package/dist/components/card/CardBody.js +14 -14
- package/dist/components/card/CardFooter.js +13 -13
- package/dist/components/card/CardHeader.js +14 -14
- package/dist/components/card/CardIcon.js +7 -7
- package/dist/components/card/CardText.js +7 -7
- package/dist/components/customInput/CustomInput.js +17 -17
- package/dist/components/dashboard/BasicApp.js +25 -25
- package/dist/components/dashboard/BasicBusinessApp.js +116 -119
- package/dist/components/dashboard/components/Header.js +11 -11
- package/dist/components/dashboard/components/LeftDrawer.js +3 -3
- package/dist/components/dashboard/components/UserIdentity.js +2 -2
- package/dist/components/dashboard/components/blackDashboard/fixedPlugin/FixedPlugin.js +85 -127
- package/dist/components/dashboard/components/blackDashboard/sidebar/Sidebar.js +151 -191
- package/dist/components/footer/Footer.js +8 -8
- package/dist/components/footer/HomeFooter.js +34 -66
- package/dist/components/form/BaseField.js +78 -78
- package/dist/components/form/Checkbox.js +8 -10
- package/dist/components/form/DatePicker.js +15 -19
- package/dist/components/form/FieldSet.js +62 -88
- package/dist/components/form/Form.js +317 -318
- package/dist/components/form/GridField.js +81 -86
- package/dist/components/form/LabelField.js +10 -12
- package/dist/components/form/LookupField.js +40 -42
- package/dist/components/form/Section.js +37 -39
- package/dist/components/form/SelectItem.js +35 -39
- package/dist/components/form/TextField.js +18 -22
- package/dist/components/form/TimePicker.js +15 -19
- package/dist/components/form/TransferList.js +83 -91
- package/dist/components/form/UploadField.js +135 -145
- package/dist/components/grid/GridContainer.js +6 -6
- package/dist/components/grid/GridItem.js +6 -6
- package/dist/components/layout/CollapsiblePanel.js +18 -20
- package/dist/components/layout/Layout.js +70 -72
- package/dist/components/layout/View.js +134 -136
- package/dist/components/layout/ViewPort.js +56 -98
- package/dist/components/menu/CollapsibleMenu.js +26 -28
- package/dist/components/menu/MenuBars.js +53 -59
- package/dist/components/menu/MenuButton.js +70 -77
- package/dist/components/menu/MenuItem.js +15 -17
- package/dist/components/menu/MenuLink.js +9 -11
- package/dist/components/menu/PopupMenu.js +12 -16
- package/dist/components/navbars/AuthNavbar.js +12 -12
- package/dist/components/navbars/HomeNavbar.js +175 -222
- package/dist/components/navbars/NavbarLinks.js +45 -46
- package/dist/components/typography/Danger.js +3 -3
- package/dist/components/typography/Info.js +3 -3
- package/dist/components/typography/Link.js +3 -3
- package/dist/event/ActionHandlers.js +43 -57
- package/dist/event/Event.js +13 -16
- package/dist/event/EventListener.js +36 -39
- package/dist/event/EventType.js +1 -5
- package/dist/event/LoadDataActionHandler.js +8 -20
- package/dist/event/Observable.js +162 -198
- package/dist/event/RouteActionHandler.js +76 -88
- package/dist/event/ScriptActionHandler.js +8 -20
- package/dist/event/ServiceCallActionHandler.js +28 -40
- package/dist/event/SignalGraphActionHandler.js +7 -19
- package/dist/js/Addresses.js +15 -27
- package/dist/js/DynamicLib.js +11 -14
- package/dist/js/Validators.js +5 -6
- package/dist/redux/store/ConfigureStore.js +6 -6
- package/dist/redux/store/DashboardStore.js +83 -95
- package/dist/redux/store/History.js +1 -1
- package/dist/redux/store/SecurityStore.js +41 -45
- package/dist/security/TokenManager.js +30 -44
- package/dist/theme-default.js +1 -1
- package/dist/view/Dashboard.js +108 -114
- package/dist/view/Settings.js +2 -4
- package/dist/view/security/ChangePasswordBasic.js +96 -100
- package/dist/view/security/ForgotPassword.js +52 -56
- package/dist/view/security/ForgotPasswordBasic.js +48 -54
- package/dist/view/security/Login.js +58 -62
- package/dist/view/security/LoginBasic.js +50 -54
- package/dist/view/security/ResetPassword.js +58 -62
- package/dist/view/security/ResetPasswordBasic.js +89 -93
- package/dist/view/security/Security.js +12 -12
- package/package.json +1 -1
package/dist/TypedValue.js
CHANGED
|
@@ -5,30 +5,27 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
|
|
8
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
9
|
-
|
|
10
8
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
11
9
|
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
class TypedValue {
|
|
11
|
+
constructor(type, value) {
|
|
12
|
+
_defineProperty(this, "getValue", () => {
|
|
13
|
+
return this.value;
|
|
14
|
+
});
|
|
14
15
|
|
|
15
|
-
|
|
16
|
+
_defineProperty(this, "getType", () => {
|
|
17
|
+
return this.type;
|
|
18
|
+
});
|
|
16
19
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
this.type = type;
|
|
21
|
+
this.value = value;
|
|
22
|
+
this.instanceType = 'TypedValue';
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* getter
|
|
26
|
+
*/
|
|
20
27
|
|
|
21
|
-
_defineProperty(this, "getType", function () {
|
|
22
|
-
return _this.type;
|
|
23
|
-
});
|
|
24
28
|
|
|
25
|
-
this.type = type;
|
|
26
|
-
this.value = value;
|
|
27
|
-
this.instanceType = 'TypedValue';
|
|
28
29
|
}
|
|
29
|
-
/**
|
|
30
|
-
* getter
|
|
31
|
-
*/
|
|
32
|
-
;
|
|
33
30
|
|
|
34
31
|
exports.default = TypedValue;
|
package/dist/Utils.js
CHANGED
|
@@ -21,26 +21,18 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
21
21
|
|
|
22
22
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
23
23
|
|
|
24
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
25
|
-
|
|
26
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
27
|
-
|
|
28
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
29
|
-
|
|
30
24
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
31
25
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
_classCallCheck(this, Utils);
|
|
35
|
-
|
|
26
|
+
class Utils {
|
|
27
|
+
constructor() {
|
|
36
28
|
_defineProperty(this, "SYSTEM_ERROR_MESSAGE", "A system error has accured. Please contact your system administrator");
|
|
37
29
|
|
|
38
|
-
_defineProperty(this, "showMessage",
|
|
30
|
+
_defineProperty(this, "showMessage", (viewRef, message, type) => {
|
|
39
31
|
if (Utils.isNull(message)) {
|
|
40
32
|
message = "";
|
|
41
33
|
}
|
|
42
34
|
|
|
43
|
-
|
|
35
|
+
let messageType = type === "ERROR" ? "danger" : Utils.isNull(type) ? "message" : type;
|
|
44
36
|
viewRef.setState({
|
|
45
37
|
message: message,
|
|
46
38
|
messageStyle: messageType
|
|
@@ -48,337 +40,307 @@ var Utils = /*#__PURE__*/function () {
|
|
|
48
40
|
});
|
|
49
41
|
}
|
|
50
42
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
this.saveForm(viewRef, formRef, url, null, null, null);
|
|
55
|
-
}
|
|
56
|
-
}, {
|
|
57
|
-
key: "saveForm",
|
|
58
|
-
value: function saveForm(viewRef, formRef, url, successCallback, errorCallback) {
|
|
59
|
-
this.saveForm(viewRef, formRef, url, successCallback, errorCallback, null);
|
|
60
|
-
}
|
|
61
|
-
}, {
|
|
62
|
-
key: "autoSetDate",
|
|
63
|
-
value: function autoSetDate(viewRef, formRef, newDate, yearOffset, monthOffset, dayOffset, autoFillDateName, refDateName) {
|
|
64
|
-
var stateDate = viewRef.state[refDateName];
|
|
65
|
-
var tempDate = stateDate;
|
|
66
|
-
|
|
67
|
-
if (Utils.isNull(stateDate) || stateDate.getTime() !== newDate.getTime()) {
|
|
68
|
-
viewRef.setState(_objectSpread(_objectSpread({}, viewRef.state), {}, {
|
|
69
|
-
[refDateName]: newDate
|
|
70
|
-
}), function () {
|
|
71
|
-
if (!Utils.isNull(tempDate) && !Utils.isNull(viewRef.state.id)) {
|
|
72
|
-
var autoFillDate = Utils.offsetDate(newDate, yearOffset, monthOffset, dayOffset);
|
|
73
|
-
formRef.current.setValue(autoFillDateName, autoFillDate);
|
|
74
|
-
} else if (Utils.isNull(viewRef.state.id)) {
|
|
75
|
-
var _autoFillDate = Utils.offsetDate(newDate, yearOffset, monthOffset, dayOffset);
|
|
76
|
-
|
|
77
|
-
formRef.current.setValue(autoFillDateName, _autoFillDate);
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}], [{
|
|
83
|
-
key: "isNull",
|
|
84
|
-
value: function isNull(value) {
|
|
85
|
-
return value === null || typeof value === 'undefined';
|
|
86
|
-
}
|
|
87
|
-
}, {
|
|
88
|
-
key: "joinScript",
|
|
89
|
-
value: function joinScript(lines) {
|
|
90
|
-
var script = '';
|
|
43
|
+
static isNull(value) {
|
|
44
|
+
return value === null || typeof value === 'undefined';
|
|
45
|
+
}
|
|
91
46
|
|
|
92
|
-
|
|
93
|
-
|
|
47
|
+
static joinScript(lines) {
|
|
48
|
+
let script = '';
|
|
94
49
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
50
|
+
for (let i = 0; i < lines.length; i++) {
|
|
51
|
+
let line = lines[i].trim();
|
|
98
52
|
|
|
99
|
-
|
|
100
|
-
|
|
53
|
+
if (!line.endsWith(';') && !line.endsWith(':')) {
|
|
54
|
+
line += ';';
|
|
101
55
|
}
|
|
102
56
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}, {
|
|
106
|
-
key: "sleep",
|
|
107
|
-
value: function sleep(milliseconds) {
|
|
108
|
-
var date = Date.now();
|
|
109
|
-
var currentDate = null;
|
|
110
|
-
|
|
111
|
-
do {
|
|
112
|
-
currentDate = Date.now();
|
|
113
|
-
} while (currentDate - date < milliseconds);
|
|
57
|
+
line += '\n';
|
|
58
|
+
script += line;
|
|
114
59
|
}
|
|
115
|
-
}, {
|
|
116
|
-
key: "parseConfig",
|
|
117
|
-
value: function parseConfig(config, currentViewId) {
|
|
118
|
-
var index = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
119
60
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
var replace = configJson.replace(/#{this}/g, '#{' + config.id + '}').replace(/#{view}/g, '#{' + currentViewId + '}');
|
|
61
|
+
return script;
|
|
62
|
+
}
|
|
123
63
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
64
|
+
static sleep(milliseconds) {
|
|
65
|
+
const date = Date.now();
|
|
66
|
+
let currentDate = null;
|
|
127
67
|
|
|
128
|
-
|
|
129
|
-
|
|
68
|
+
do {
|
|
69
|
+
currentDate = Date.now();
|
|
70
|
+
} while (currentDate - date < milliseconds);
|
|
71
|
+
}
|
|
130
72
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
if (
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
for (var i = 0; i < fields.length; i++) {
|
|
140
|
-
if (fields[i].id === id) {
|
|
141
|
-
return fields[i].required;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
73
|
+
static parseConfig(config, currentViewId, index = null) {
|
|
74
|
+
if (!this.isNull(config) && !this.isNull(config.id)) {
|
|
75
|
+
let configJson = JSON.stringify(config);
|
|
76
|
+
let replace = configJson.replace(/#{this}/g, '#{' + config.id + '}').replace(/#{view}/g, '#{' + currentViewId + '}');
|
|
77
|
+
|
|
78
|
+
if (index !== null) {
|
|
79
|
+
replace = replace.replace(/\[#i]/g, "[".concat(index, "]"));
|
|
144
80
|
}
|
|
145
81
|
|
|
146
|
-
return
|
|
82
|
+
return JSON.parse(replace);
|
|
147
83
|
}
|
|
148
|
-
}, {
|
|
149
|
-
key: "isStringEmpty",
|
|
150
|
-
value: function isStringEmpty(val) {
|
|
151
|
-
return typeof val === 'undefined' || val === null || val.trim().length === 0;
|
|
152
|
-
}
|
|
153
|
-
}, {
|
|
154
|
-
key: "getFields",
|
|
155
|
-
value: function getFields(formId, className) {
|
|
156
|
-
var inputFields = [];
|
|
157
|
-
var form = document.getElementById(formId);
|
|
158
84
|
|
|
159
|
-
|
|
160
|
-
|
|
85
|
+
return config;
|
|
86
|
+
}
|
|
161
87
|
|
|
162
|
-
|
|
163
|
-
|
|
88
|
+
static isFieldRequired(id, formId) {
|
|
89
|
+
if (!Utils.isStringEmpty(formId)) {
|
|
90
|
+
let fields = Utils.getFields(formId, 'validate');
|
|
164
91
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
92
|
+
for (var i = 0; i < fields.length; i++) {
|
|
93
|
+
if (fields[i].id === id) {
|
|
94
|
+
return fields[i].required;
|
|
168
95
|
}
|
|
169
96
|
}
|
|
170
|
-
|
|
171
|
-
return inputFields;
|
|
172
97
|
}
|
|
173
|
-
}, {
|
|
174
|
-
key: "validateField",
|
|
175
|
-
value: function validateField(id, required, values, currentValue, validator) {
|
|
176
|
-
var message = !this.isNull(validator) ? validator.errorMessage : null;
|
|
177
|
-
var regex = !this.isNull(validator) ? validator.regex : null;
|
|
178
|
-
var result = {};
|
|
179
|
-
result.valid = true;
|
|
180
|
-
result.message = "";
|
|
181
|
-
var value;
|
|
182
98
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
} else {
|
|
186
|
-
value = values[id];
|
|
187
|
-
}
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
188
101
|
|
|
189
|
-
|
|
102
|
+
static isStringEmpty(val) {
|
|
103
|
+
return typeof val === 'undefined' || val === null || val.trim().length === 0;
|
|
104
|
+
}
|
|
190
105
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
106
|
+
static getFields(formId, className) {
|
|
107
|
+
let inputFields = [];
|
|
108
|
+
let form = document.getElementById(formId);
|
|
109
|
+
|
|
110
|
+
if (!Utils.isNull(form)) {
|
|
111
|
+
let inputDivs = form.getElementsByClassName(className);
|
|
197
112
|
|
|
198
|
-
|
|
199
|
-
|
|
113
|
+
for (let i = 0; i < inputDivs.length; i++) {
|
|
114
|
+
let inputs = inputDivs[i].getElementsByTagName("input");
|
|
200
115
|
|
|
201
|
-
|
|
202
|
-
|
|
116
|
+
for (let j = 0; j < inputs.length; j++) {
|
|
117
|
+
inputFields.push(inputs[j]);
|
|
203
118
|
}
|
|
204
119
|
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return inputFields;
|
|
123
|
+
}
|
|
205
124
|
|
|
206
|
-
|
|
207
|
-
|
|
125
|
+
static validateField(id, required, values, currentValue, validator) {
|
|
126
|
+
let message = !this.isNull(validator) ? validator.errorMessage : null;
|
|
127
|
+
let regex = !this.isNull(validator) ? validator.regex : null;
|
|
128
|
+
let result = {};
|
|
129
|
+
result.valid = true;
|
|
130
|
+
result.message = "";
|
|
131
|
+
let value;
|
|
132
|
+
|
|
133
|
+
if (currentValue !== null) {
|
|
134
|
+
value = currentValue;
|
|
135
|
+
} else {
|
|
136
|
+
value = values[id];
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
let hasErrors = false;
|
|
140
|
+
|
|
141
|
+
if (required && (Utils.isNull(value) || Utils.isStringEmpty(value.toString()))) {
|
|
142
|
+
result.message = !Utils.isNull(message) ? message : "This field is required";
|
|
143
|
+
hasErrors = true;
|
|
144
|
+
} else {
|
|
145
|
+
result.message = "";
|
|
208
146
|
}
|
|
209
|
-
}, {
|
|
210
|
-
key: "getComponentAttribute",
|
|
211
|
-
value: function getComponentAttribute(field, attribute, defaultValue) {
|
|
212
|
-
if (this.isNull(field.attributes)) {
|
|
213
|
-
return defaultValue;
|
|
214
|
-
}
|
|
215
147
|
|
|
216
|
-
|
|
148
|
+
if (!hasErrors && !Utils.isNull(regex) && !Utils.isNull(value)) {
|
|
149
|
+
hasErrors = Utils.isNull(value.toString().match(regex));
|
|
150
|
+
|
|
151
|
+
if (hasErrors) {
|
|
152
|
+
result.message = !Utils.isNull(message) ? message : "This field is invalid";
|
|
153
|
+
}
|
|
217
154
|
}
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
return JSON.stringify(request);
|
|
155
|
+
|
|
156
|
+
result.valid = !hasErrors;
|
|
157
|
+
return result;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
static getComponentAttribute(field, attribute, defaultValue) {
|
|
161
|
+
if (this.isNull(field.attributes)) {
|
|
162
|
+
return defaultValue;
|
|
227
163
|
}
|
|
228
|
-
}, {
|
|
229
|
-
key: "getFieldGrid",
|
|
230
|
-
value: function getFieldGrid(attributes, fields) {
|
|
231
|
-
var fieldGrid = {};
|
|
232
|
-
var maxColspan = !Utils.isNull(attributes) ? attributes.layoutColumns : 1;
|
|
233
|
-
fieldGrid.maxColPerRow = maxColspan;
|
|
234
|
-
fieldGrid.rows = [];
|
|
235
|
-
var currRow = this.createRow();
|
|
236
164
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
var colspan = this.getFieldColspan(field);
|
|
165
|
+
return this.isNull(field.attributes[attribute]) ? defaultValue : field.attributes[attribute];
|
|
166
|
+
}
|
|
240
167
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
168
|
+
static doGetRequestJson(currentPage, curretRowsPerPage, currentSearchParameters, paged) {
|
|
169
|
+
var request = {};
|
|
170
|
+
request.pageSize = curretRowsPerPage;
|
|
171
|
+
request.currentPage = currentPage;
|
|
172
|
+
request.searchParameters = currentSearchParameters;
|
|
173
|
+
request.paged = typeof paged === 'undefined' || paged === null || paged;
|
|
174
|
+
return JSON.stringify(request);
|
|
175
|
+
}
|
|
245
176
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
177
|
+
static getFieldGrid(attributes, fields) {
|
|
178
|
+
let fieldGrid = {};
|
|
179
|
+
let maxColspan = !Utils.isNull(attributes) ? attributes.layoutColumns : 1;
|
|
180
|
+
fieldGrid.maxColPerRow = maxColspan;
|
|
181
|
+
fieldGrid.rows = [];
|
|
182
|
+
let currRow = this.createRow();
|
|
183
|
+
|
|
184
|
+
for (let i = 0; i < fields.length; i++) {
|
|
185
|
+
let field = fields[i];
|
|
186
|
+
let colspan = this.getFieldColspan(field);
|
|
249
187
|
|
|
250
|
-
|
|
251
|
-
currRow
|
|
188
|
+
if (!this.rowHasSpaceForNewField(currRow, colspan, maxColspan)) {
|
|
189
|
+
this.fillRowWithSpacers(currRow, maxColspan);
|
|
190
|
+
currRow = this.createRow();
|
|
252
191
|
}
|
|
253
192
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
}, {
|
|
257
|
-
key: "evaluateBooleanExpression",
|
|
258
|
-
value: function evaluateBooleanExpression(expression, id, defaultValue) {
|
|
259
|
-
if (expression === "false") {
|
|
260
|
-
return false;
|
|
261
|
-
} else if (expression === "true") {
|
|
262
|
-
return true;
|
|
263
|
-
} else if (!Utils.isNull(expression)) {
|
|
264
|
-
return _DynamicJS.default.executeScript("".concat(id, "UtilsBoolEval"), expression);
|
|
193
|
+
if (currRow.fields.length === 0) {
|
|
194
|
+
fieldGrid.rows.push(currRow);
|
|
265
195
|
}
|
|
266
196
|
|
|
267
|
-
|
|
197
|
+
currRow.fields.push(field);
|
|
198
|
+
currRow.usedSlots += colspan;
|
|
268
199
|
}
|
|
269
|
-
}, {
|
|
270
|
-
key: "getEntityViewTitle",
|
|
271
|
-
value: function getEntityViewTitle(queryParameterState, viewName) {
|
|
272
|
-
if (Utils.isNull(queryParameterState) || Utils.isNull(queryParameterState.selection)) {
|
|
273
|
-
return !Utils.isNull(viewName) ? viewName + " > Add" : "Add";
|
|
274
|
-
}
|
|
275
200
|
|
|
276
|
-
|
|
201
|
+
return fieldGrid;
|
|
202
|
+
}
|
|
277
203
|
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
204
|
+
static evaluateBooleanExpression(expression, id, defaultValue) {
|
|
205
|
+
if (expression === "false") {
|
|
206
|
+
return false;
|
|
207
|
+
} else if (expression === "true") {
|
|
208
|
+
return true;
|
|
209
|
+
} else if (!Utils.isNull(expression)) {
|
|
210
|
+
return _DynamicJS.default.executeScript("".concat(id, "UtilsBoolEval"), expression);
|
|
211
|
+
}
|
|
281
212
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
props += fields[i].trim();
|
|
285
|
-
props += " ";
|
|
286
|
-
}
|
|
287
|
-
}
|
|
213
|
+
return !this.isNull(defaultValue) ? defaultValue : false;
|
|
214
|
+
}
|
|
288
215
|
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
return
|
|
216
|
+
static getEntityViewTitle(queryParameterState, viewName, ...fields) {
|
|
217
|
+
if (Utils.isNull(queryParameterState) || Utils.isNull(queryParameterState.selection)) {
|
|
218
|
+
return !Utils.isNull(viewName) ? viewName + " > Add" : "Add";
|
|
292
219
|
}
|
|
293
|
-
}, {
|
|
294
|
-
key: "setLegendColor",
|
|
295
|
-
value: function setLegendColor(color) {
|
|
296
|
-
var legends = document.getElementsByClassName("legend");
|
|
297
220
|
|
|
298
|
-
|
|
299
|
-
|
|
221
|
+
let props = "";
|
|
222
|
+
|
|
223
|
+
for (let i = 0; i < fields.length; i++) {
|
|
224
|
+
if (!Utils.isNull(fields[i])) {
|
|
225
|
+
props += fields[i].trim();
|
|
226
|
+
props += " ";
|
|
300
227
|
}
|
|
301
228
|
}
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
229
|
+
|
|
230
|
+
props = props.trim();
|
|
231
|
+
let prefix = Utils.isNull(viewName) ? "" : " > ";
|
|
232
|
+
return (Utils.isNull(viewName) ? "" : viewName) + (props.length > 0 ? prefix + props : "");
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
static setLegendColor(color) {
|
|
236
|
+
let legends = document.getElementsByClassName("legend");
|
|
237
|
+
|
|
238
|
+
for (let i = 0; i < legends.length; i++) {
|
|
239
|
+
legends[i].style.color = color;
|
|
309
240
|
}
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
return new Date(year, month, day);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
static setLegend(text) {
|
|
244
|
+
if (!Utils.isNull(text)) {
|
|
245
|
+
let legend = document.getElementById("globalLegend");
|
|
246
|
+
legend.innerHTML = text;
|
|
317
247
|
}
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
saveForm(viewRef, formRef, url) {
|
|
251
|
+
this.saveForm(viewRef, formRef, url, null, null, null);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
saveForm(viewRef, formRef, url, successCallback, errorCallback) {
|
|
255
|
+
this.saveForm(viewRef, formRef, url, successCallback, errorCallback, null);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
static offsetDate(date, yearOffset, monthOffset, dayOffset) {
|
|
259
|
+
let year = date.getFullYear() + yearOffset;
|
|
260
|
+
let day = date.getDate() + dayOffset;
|
|
261
|
+
let month = date.getMonth() + monthOffset;
|
|
262
|
+
return new Date(year, month, day);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
autoSetDate(viewRef, formRef, newDate, yearOffset, monthOffset, dayOffset, autoFillDateName, refDateName) {
|
|
266
|
+
let stateDate = viewRef.state[refDateName];
|
|
267
|
+
let tempDate = stateDate;
|
|
268
|
+
|
|
269
|
+
if (Utils.isNull(stateDate) || stateDate.getTime() !== newDate.getTime()) {
|
|
270
|
+
viewRef.setState(_objectSpread(_objectSpread({}, viewRef.state), {}, {
|
|
271
|
+
[refDateName]: newDate
|
|
272
|
+
}), () => {
|
|
273
|
+
if (!Utils.isNull(tempDate) && !Utils.isNull(viewRef.state.id)) {
|
|
274
|
+
let autoFillDate = Utils.offsetDate(newDate, yearOffset, monthOffset, dayOffset);
|
|
275
|
+
formRef.current.setValue(autoFillDateName, autoFillDate);
|
|
276
|
+
} else if (Utils.isNull(viewRef.state.id)) {
|
|
277
|
+
let autoFillDate = Utils.offsetDate(newDate, yearOffset, monthOffset, dayOffset);
|
|
278
|
+
formRef.current.setValue(autoFillDateName, autoFillDate);
|
|
279
|
+
}
|
|
330
280
|
});
|
|
331
281
|
}
|
|
332
|
-
}
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
static getArgs(func) {
|
|
285
|
+
// First match everything inside the function argument parens.
|
|
286
|
+
var args = func.toString().match(/function\s.*?\(([^)]*)\)/)[1]; // Split the arguments string into an array comma delimited.
|
|
287
|
+
|
|
288
|
+
return args.split(',').map(function (arg) {
|
|
289
|
+
// Ensure no inline comments are parsed and trim the whitespace.
|
|
290
|
+
return arg.replace(/\/\*.*\*\//, '').trim();
|
|
291
|
+
}).filter(function (arg) {
|
|
292
|
+
// Ensure no undefined values are added.
|
|
293
|
+
return arg;
|
|
294
|
+
});
|
|
295
|
+
}
|
|
333
296
|
|
|
334
|
-
|
|
335
|
-
}();
|
|
297
|
+
}
|
|
336
298
|
|
|
337
299
|
exports.default = Utils;
|
|
338
300
|
|
|
339
|
-
_defineProperty(Utils, "capitalize",
|
|
301
|
+
_defineProperty(Utils, "capitalize", s => {
|
|
340
302
|
if (typeof s !== 'string') return '';
|
|
341
303
|
return s.charAt(0).toUpperCase() + s.slice(1);
|
|
342
304
|
});
|
|
343
305
|
|
|
344
|
-
_defineProperty(Utils, "getFieldColspan",
|
|
306
|
+
_defineProperty(Utils, "getFieldColspan", field => {
|
|
345
307
|
return !Utils.isNull(field.attributes) && !Utils.isNull(field.attributes['colspan']) ? parseFloat(field.attributes['colspan']) : 1;
|
|
346
308
|
});
|
|
347
309
|
|
|
348
|
-
_defineProperty(Utils, "createRow",
|
|
349
|
-
|
|
310
|
+
_defineProperty(Utils, "createRow", () => {
|
|
311
|
+
let row = {};
|
|
350
312
|
row.fields = [];
|
|
351
313
|
row.usedSlots = 0;
|
|
352
314
|
return row;
|
|
353
315
|
});
|
|
354
316
|
|
|
355
|
-
_defineProperty(Utils, "fillRowWithSpacers",
|
|
356
|
-
for (
|
|
357
|
-
|
|
317
|
+
_defineProperty(Utils, "fillRowWithSpacers", (row, max) => {
|
|
318
|
+
for (let i = row.usedSlots; i < max; i++) {
|
|
319
|
+
let field = {};
|
|
358
320
|
field.fieldType = 'LABEL';
|
|
359
321
|
field.id = 'system_col_span_spacer_' + i;
|
|
360
322
|
row.fields.push(field);
|
|
361
323
|
}
|
|
362
324
|
});
|
|
363
325
|
|
|
364
|
-
_defineProperty(Utils, "rowHasSpaceForNewField",
|
|
326
|
+
_defineProperty(Utils, "rowHasSpaceForNewField", (row, colspan, max) => {
|
|
365
327
|
return colspan <= max - row.usedSlots;
|
|
366
328
|
});
|
|
367
329
|
|
|
368
|
-
_defineProperty(Utils, "getPropertyChainPath",
|
|
369
|
-
|
|
330
|
+
_defineProperty(Utils, "getPropertyChainPath", expression => {
|
|
331
|
+
let path = {};
|
|
370
332
|
|
|
371
333
|
if (!Utils.isNull(expression)) {
|
|
372
|
-
|
|
334
|
+
let tokens = expression.split('.');
|
|
373
335
|
path.property = tokens[tokens.length - 1];
|
|
374
|
-
|
|
336
|
+
let voExpression = expression.substring(0, expression.indexOf('.'));
|
|
375
337
|
path.valueObject = _DynamicJS.default.executeScript("".concat(Math.random(), "_PropertyChainUtilsEval"), voExpression);
|
|
376
338
|
|
|
377
|
-
for (
|
|
378
|
-
|
|
339
|
+
for (let i = 1; i < tokens.length - 1; i++) {
|
|
340
|
+
let token = tokens[i];
|
|
379
341
|
|
|
380
342
|
if (!Utils.isNull(path.valueObject)) {
|
|
381
|
-
|
|
343
|
+
let getter = path.valueObject[token];
|
|
382
344
|
|
|
383
345
|
if (!Utils.isNull(getter)) {
|
|
384
346
|
if (typeof getter === 'function') {
|
|
@@ -396,12 +358,12 @@ _defineProperty(Utils, "getPropertyChainPath", function (expression) {
|
|
|
396
358
|
return path;
|
|
397
359
|
});
|
|
398
360
|
|
|
399
|
-
_defineProperty(Utils, "publishSystemErrorMessage",
|
|
400
|
-
|
|
361
|
+
_defineProperty(Utils, "publishSystemErrorMessage", viewId => {
|
|
362
|
+
let message = {
|
|
401
363
|
messageType: 'ERROR',
|
|
402
364
|
message: 'A system error has accured. Please try again later'
|
|
403
365
|
};
|
|
404
|
-
|
|
366
|
+
let event = new _Event.default(_ApplicationContext.default, viewId, message);
|
|
405
367
|
|
|
406
368
|
_Observable.default.fireEvent(_EventType.default.MESSAGE_ARRIVED, event);
|
|
407
369
|
});
|