@agilemotion/oui-react-js 1.8.3 → 1.8.5
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/ApplicationManager.js +9 -0
- package/dist/DynamicJS.js +32 -8
- package/dist/RestService.js +1 -3
- package/dist/Utils.js +17 -8
- package/dist/components/Button.js +8 -1
- package/dist/components/Calendar.js +30 -23
- package/dist/components/DataGrid.js +44 -10
- package/dist/components/DocumentTemplateDesignerComponent.js +169 -0
- package/dist/components/DocumentTemplateDesignerComponent2.js +585 -0
- package/dist/components/Icon.js +10 -0
- package/dist/components/TableCellContent.js +35 -23
- package/dist/components/Toolbar.js +10 -1
- package/dist/components/form/BaseField.js +50 -27
- package/dist/components/form/Checkbox.js +3 -0
- package/dist/components/form/CurrencyField.js +109 -0
- package/dist/components/form/DatePicker.js +1 -0
- package/dist/components/form/FieldSet.js +18 -3
- package/dist/components/form/Form.js +14 -3
- package/dist/components/form/GridField.js +34 -25
- package/dist/components/form/LookupField.js +5 -4
- package/dist/components/form/RadioGroup.js +22 -9
- package/dist/components/form/SelectItem.js +9 -5
- package/dist/components/form/TransferList.js +2 -2
- package/dist/components/layout/CollapsiblePanel.css +9 -9
- package/dist/components/layout/View.css +68 -68
- package/dist/components/layout/ViewContainer.js +11 -2
- package/dist/components/layout/Window.js +2 -0
- package/dist/components/loader.css +36 -36
- package/dist/components/media/TrainingRoom.js +5 -0
- package/dist/components/media/Video.css +4 -4
- package/dist/components/signatures/ResponsiveTable.css +91 -91
- package/dist/components/signatures/widgets.css +126 -126
- package/dist/js/Validators.js +73 -2
- package/dist/view/Dashboard.js +13 -13
- package/package.json +10 -2
|
@@ -46,6 +46,9 @@ class ApplicationManager {
|
|
|
46
46
|
hasActiveMeeting() {
|
|
47
47
|
return instance.hasActiveMeeting();
|
|
48
48
|
},
|
|
49
|
+
getActiveMeetingKey() {
|
|
50
|
+
return instance.getActiveMeetingKey();
|
|
51
|
+
},
|
|
49
52
|
getUserDetails() {
|
|
50
53
|
return instance.getUserDetails();
|
|
51
54
|
},
|
|
@@ -101,6 +104,12 @@ class ApplicationManager {
|
|
|
101
104
|
setNavigator(navigator) {
|
|
102
105
|
this.props.navigator = navigator;
|
|
103
106
|
}
|
|
107
|
+
setActiveMeetingKey(activeMeetingKey) {
|
|
108
|
+
this.props.activeMeetingKey = activeMeetingKey;
|
|
109
|
+
}
|
|
110
|
+
getActiveMeetingKey() {
|
|
111
|
+
return this.props.activeMeetingKey;
|
|
112
|
+
}
|
|
104
113
|
setHasActiveMeeting(hasActiveMeeting) {
|
|
105
114
|
this.props.hasActiveMeeting = hasActiveMeeting;
|
|
106
115
|
}
|
package/dist/DynamicJS.js
CHANGED
|
@@ -43,7 +43,8 @@ class DynamicJS {
|
|
|
43
43
|
return _ApplicationManager.default.resolveExpressionValue(expression);
|
|
44
44
|
};
|
|
45
45
|
parseScript = (script, componentId, isScriptlet) => {
|
|
46
|
-
let
|
|
46
|
+
let scriptCode = typeof script === 'string' ? script : this.getScriptCode(script);
|
|
47
|
+
let parsedScript = scriptCode.replace(/#this/g, '#' + componentId).replace(/isNull/g, 'this.isNull').replace(/removeKeys/g, 'this.removeKeys').replace(/\$application/g, '@#{' + _ApplicationManager.APP_VARIABLE + "}").replace(/isEmpty/g, 'this.isEmpty');
|
|
47
48
|
let matches = parsedScript.match(TEMPLATE_REGEX);
|
|
48
49
|
if (!_Utils.default.isNull(matches)) {
|
|
49
50
|
let expressions = [];
|
|
@@ -69,6 +70,8 @@ class DynamicJS {
|
|
|
69
70
|
* @param isScriplet
|
|
70
71
|
* @param event
|
|
71
72
|
* @param scriptConfig
|
|
73
|
+
* @param printError
|
|
74
|
+
* @param scriptParam
|
|
72
75
|
*/
|
|
73
76
|
executeScript = (() => {
|
|
74
77
|
var _this2 = this;
|
|
@@ -76,6 +79,8 @@ class DynamicJS {
|
|
|
76
79
|
let isScriplet = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
|
77
80
|
let event = arguments.length > 4 ? arguments[4] : undefined;
|
|
78
81
|
let scriptConfig = arguments.length > 5 ? arguments[5] : undefined;
|
|
82
|
+
let printError = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : true;
|
|
83
|
+
let scriptParam = arguments.length > 7 ? arguments[7] : undefined;
|
|
79
84
|
let parsedScript = _this2.parseScript(scriptCode, componentId, isScriplet);
|
|
80
85
|
let eventParam = null;
|
|
81
86
|
if (!_Utils.default.isNull(event)) {
|
|
@@ -86,13 +91,15 @@ class DynamicJS {
|
|
|
86
91
|
let func = new Function(parsedScript.replace(/\$event/g, JSON.stringify(eventParam)));
|
|
87
92
|
if (!_Utils.default.isNull(name)) {
|
|
88
93
|
DynamicJS.prototype[name] = func;
|
|
89
|
-
let result = instance[name]({});
|
|
94
|
+
let result = instance[name](scriptParam ? scriptParam : {});
|
|
90
95
|
delete DynamicJS.prototype[name];
|
|
91
96
|
return result;
|
|
92
97
|
}
|
|
93
98
|
} catch (e) {
|
|
94
|
-
|
|
95
|
-
|
|
99
|
+
if (printError) {
|
|
100
|
+
console.error(e);
|
|
101
|
+
console.error("Error Executing script : ", scriptConfig?.lines);
|
|
102
|
+
}
|
|
96
103
|
throw new Error(e.message);
|
|
97
104
|
}
|
|
98
105
|
return null;
|
|
@@ -122,6 +129,7 @@ class DynamicJS {
|
|
|
122
129
|
* @param componentId
|
|
123
130
|
* @param valuesMap
|
|
124
131
|
* @param event
|
|
132
|
+
* @param scriptParam
|
|
125
133
|
*/
|
|
126
134
|
executeScriptObject = (() => {
|
|
127
135
|
var _this3 = this;
|
|
@@ -129,11 +137,27 @@ class DynamicJS {
|
|
|
129
137
|
let componentId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
130
138
|
let valuesMap = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
131
139
|
let event = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
|
|
132
|
-
let
|
|
133
|
-
|
|
134
|
-
|
|
140
|
+
let scriptParam = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : null;
|
|
141
|
+
let scriptBody = _this3.getScriptCode(script, valuesMap);
|
|
142
|
+
return _this3.executeScript(name, scriptBody, componentId, false, event, script, true, scriptParam);
|
|
143
|
+
};
|
|
144
|
+
})();
|
|
145
|
+
getScriptCode(script, valuesMap) {
|
|
146
|
+
let scriptBody = '';
|
|
147
|
+
for (const line of script.lines) {
|
|
148
|
+
scriptBody += this.parseScriptLine(line, valuesMap);
|
|
149
|
+
}
|
|
150
|
+
return scriptBody;
|
|
151
|
+
}
|
|
152
|
+
executeScriptFunction = (() => {
|
|
153
|
+
var _this4 = this;
|
|
154
|
+
return function (scriptObject) {
|
|
155
|
+
const fnCode = _this4.parseScript(scriptObject, null, false);
|
|
156
|
+
const dynamicFn = new Function(`return ${fnCode}`)();
|
|
157
|
+
for (var _len = arguments.length, params = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
158
|
+
params[_key - 1] = arguments[_key];
|
|
135
159
|
}
|
|
136
|
-
return
|
|
160
|
+
return dynamicFn(...params);
|
|
137
161
|
};
|
|
138
162
|
})();
|
|
139
163
|
}
|
package/dist/RestService.js
CHANGED
|
@@ -352,9 +352,7 @@ class RestService {
|
|
|
352
352
|
}
|
|
353
353
|
processSuccessfulResponseData(component, data, viewId, successMessage) {
|
|
354
354
|
let response;
|
|
355
|
-
if (
|
|
356
|
-
response = null;
|
|
357
|
-
} else if (typeof data === 'object' || _Utils.default.isNull(data) || data.toString().trim().length === 0) {
|
|
355
|
+
if (typeof data === 'object' || _Utils.default.isNull(data) || data.toString().trim().length === 0) {
|
|
358
356
|
response = data;
|
|
359
357
|
} else {
|
|
360
358
|
try {
|
package/dist/Utils.js
CHANGED
|
@@ -188,14 +188,19 @@ class Utils {
|
|
|
188
188
|
return fieldGrid;
|
|
189
189
|
}
|
|
190
190
|
static evaluateBooleanExpression(expression, id, defaultValue) {
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
191
|
+
try {
|
|
192
|
+
if (expression === "false" || expression === false) {
|
|
193
|
+
return false;
|
|
194
|
+
} else if (expression === "true" || expression === true) {
|
|
195
|
+
return true;
|
|
196
|
+
} else if (!Utils.isNull(expression)) {
|
|
197
|
+
return _DynamicJS.default.executeScript(`${id}UtilsBoolEval`, expression);
|
|
198
|
+
}
|
|
199
|
+
return !this.isNull(defaultValue) ? defaultValue : false;
|
|
200
|
+
} catch (e) {
|
|
201
|
+
console.error("Error evaluation a boolean expression [" + expression + "] for : " + id);
|
|
202
|
+
throw e;
|
|
197
203
|
}
|
|
198
|
-
return !this.isNull(defaultValue) ? defaultValue : false;
|
|
199
204
|
}
|
|
200
205
|
static getEntityViewTitle(queryParameterState, viewName) {
|
|
201
206
|
if (Utils.isNull(queryParameterState) || Utils.isNull(queryParameterState.selection)) {
|
|
@@ -379,8 +384,12 @@ class Utils {
|
|
|
379
384
|
const keys = path.split('.');
|
|
380
385
|
let current = obj;
|
|
381
386
|
for (let i = 0; i < keys.length - 1; i++) {
|
|
382
|
-
if (!current[keys[i]]
|
|
387
|
+
if (!current[keys[i]]) {
|
|
383
388
|
current[keys[i]] = {};
|
|
389
|
+
} else {
|
|
390
|
+
if (typeof current[keys[i]] !== 'object') {
|
|
391
|
+
throw new Error("Invalid property value in property chain [" + path + "] - [" + keys[i] + "]");
|
|
392
|
+
}
|
|
384
393
|
}
|
|
385
394
|
current = current[keys[i]];
|
|
386
395
|
}
|
|
@@ -14,6 +14,7 @@ var _styles = require("@mui/styles");
|
|
|
14
14
|
var _Event = _interopRequireDefault(require("../event/Event"));
|
|
15
15
|
var _EventType = _interopRequireDefault(require("../event/EventType"));
|
|
16
16
|
var _ApplicationManager = _interopRequireDefault(require("../ApplicationManager"));
|
|
17
|
+
var _DynamicJS = _interopRequireDefault(require("../DynamicJS"));
|
|
17
18
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
19
|
const useStyles = (0, _styles.makeStyles)(theme => ({
|
|
19
20
|
root: {
|
|
@@ -30,9 +31,9 @@ const Button = props => {
|
|
|
30
31
|
const classes = useStyles();
|
|
31
32
|
const [disabled, setDisabled] = _react.default.useState(false);
|
|
32
33
|
const [visible, setVisible] = _react.default.useState(false);
|
|
34
|
+
const [label, setLabel] = _react.default.useState(false);
|
|
33
35
|
const [config, setConfig] = _react.default.useState(null);
|
|
34
36
|
let color = _Utils.default.getComponentAttribute(props.config, 'color', 'default');
|
|
35
|
-
let label = _Utils.default.getComponentAttribute(props.config, 'label', null);
|
|
36
37
|
_react.default.useEffect(() => {
|
|
37
38
|
props.handle.api = api();
|
|
38
39
|
});
|
|
@@ -47,6 +48,12 @@ const Button = props => {
|
|
|
47
48
|
}
|
|
48
49
|
}, [config]);
|
|
49
50
|
_react.default.useEffect(() => {
|
|
51
|
+
try {
|
|
52
|
+
let label = _DynamicJS.default.executeScript(props.config.id + 'label', _Utils.default.getComponentAttribute(props.config, 'label', ''), props.config.viewId, true, null, null, false);
|
|
53
|
+
setLabel(label);
|
|
54
|
+
} catch (e) {
|
|
55
|
+
setLabel(_Utils.default.getComponentAttribute(props.config, 'label', ''));
|
|
56
|
+
}
|
|
50
57
|
setConfig(props.tableRow ? {
|
|
51
58
|
...props.config,
|
|
52
59
|
id: props.config.id + '_' + props.tableRow.id?.replaceAll('-', '')
|
|
@@ -28,7 +28,6 @@ var _Calendar = _interopRequireDefault(require("../js/Calendar"));
|
|
|
28
28
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
29
29
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
30
30
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
31
|
-
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
32
31
|
const eventTemplate = {
|
|
33
32
|
id: '',
|
|
34
33
|
title: '',
|
|
@@ -79,9 +78,11 @@ const Calendar = props => {
|
|
|
79
78
|
const [selectedEvent, setSelectedEvent] = (0, _react.useState)(null);
|
|
80
79
|
const calendarRef = (0, _react.useRef)(null);
|
|
81
80
|
const dialogRef = (0, _react.useRef)(null);
|
|
82
|
-
const [dialogTop, setDialogTop] = (0, _react.useState)(null);
|
|
83
|
-
const [dialogLeft, setDialogLeft] = (0, _react.useState)(null);
|
|
84
81
|
const [refresher, setRefresher] = (0, _react.useState)(0);
|
|
82
|
+
const [dialogPosition, setDialogPosition] = (0, _react.useState)({
|
|
83
|
+
bottom: '20px',
|
|
84
|
+
right: '20px'
|
|
85
|
+
});
|
|
85
86
|
const contextChangeHandler = {};
|
|
86
87
|
let counter = 1;
|
|
87
88
|
const StyledDialog = (0, _withStyles.default)({
|
|
@@ -95,14 +96,16 @@ const Calendar = props => {
|
|
|
95
96
|
minWidth: '400px',
|
|
96
97
|
padding: '0',
|
|
97
98
|
overflow: 'hidden',
|
|
98
|
-
position: '
|
|
99
|
-
|
|
100
|
-
|
|
99
|
+
position: 'fixed',
|
|
100
|
+
bottom: dialogPosition.bottom,
|
|
101
|
+
right: dialogPosition.right,
|
|
102
|
+
left: 'auto !important',
|
|
103
|
+
top: 'auto !important',
|
|
104
|
+
transform: 'none !important',
|
|
105
|
+
margin: '0 !important',
|
|
101
106
|
borderRadius: '4px'
|
|
102
107
|
}
|
|
103
|
-
})(
|
|
104
|
-
hideBackdrop: true
|
|
105
|
-
}, props)));
|
|
108
|
+
})(_Dialog.default);
|
|
106
109
|
const loadEvents = function () {
|
|
107
110
|
let track = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
108
111
|
fetch(encodeURI(location + _ApplicationManager.default.getContextRoot() + '/calendar/api/v1/event/list'), {
|
|
@@ -199,20 +202,8 @@ const Calendar = props => {
|
|
|
199
202
|
el: el,
|
|
200
203
|
event: event
|
|
201
204
|
} = _ref2;
|
|
202
|
-
// * Only grab required field otherwise it goes in infinity loop
|
|
203
|
-
// ! Always grab all fields rendered by form (even if it get `undefined`) otherwise due to Vue3/Composition API you might get: "object is not extensible"
|
|
204
|
-
// event.value = grabEventDataFromEventApi(clickedEvent)
|
|
205
|
-
|
|
206
|
-
// eslint-disable-next-line no-use-before-define
|
|
207
|
-
// isAddNewEventSidebarActive.value = true
|
|
208
|
-
|
|
209
|
-
setOpen(true);
|
|
210
|
-
var rect = el.getBoundingClientRect();
|
|
211
|
-
let topOffset = rect.bottom + 250 > document.body.getBoundingClientRect().bottom ? -1 * (rect.bottom + 250 - document.body.getBoundingClientRect().bottom) : 8;
|
|
212
|
-
let leftOffset = rect.right + 400 > document.body.getBoundingClientRect().right ? rect.right + 400 - document.body.getBoundingClientRect().right : 64;
|
|
213
|
-
setDialogTop(rect.top + topOffset + 'px');
|
|
214
|
-
setDialogLeft(rect.left - leftOffset + 'px');
|
|
215
205
|
setSelectedEvent(event);
|
|
206
|
+
setOpen(true);
|
|
216
207
|
let elementsByClassName = document.getElementsByClassName('fc-scroller-liquid-absolute');
|
|
217
208
|
if (elementsByClassName && elementsByClassName.length > 0) {
|
|
218
209
|
elementsByClassName[0].removeEventListener("scroll", calenderScrollListener);
|
|
@@ -399,10 +390,26 @@ const Calendar = props => {
|
|
|
399
390
|
onClose: () => {
|
|
400
391
|
setOpen(false);
|
|
401
392
|
},
|
|
393
|
+
hideBackdrop: true,
|
|
394
|
+
disableEnforceFocus: true,
|
|
395
|
+
disableAutoFocus: true,
|
|
402
396
|
"aria-labelledby": "alert-dialog-title",
|
|
403
397
|
"aria-describedby": "alert-dialog-description",
|
|
404
398
|
"aria-modal": false,
|
|
405
|
-
|
|
399
|
+
style: {
|
|
400
|
+
position: 'fixed',
|
|
401
|
+
left: 'auto',
|
|
402
|
+
top: 'auto'
|
|
403
|
+
},
|
|
404
|
+
PaperProps: {
|
|
405
|
+
style: {
|
|
406
|
+
position: 'fixed',
|
|
407
|
+
bottom: '20px',
|
|
408
|
+
right: '20px',
|
|
409
|
+
margin: 0,
|
|
410
|
+
transform: 'none'
|
|
411
|
+
}
|
|
412
|
+
}
|
|
406
413
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
407
414
|
className: 'w-100 h-100'
|
|
408
415
|
}, createEventPopup())));
|
|
@@ -22,13 +22,11 @@ var _Observable = _interopRequireDefault(require("../event/Observable"));
|
|
|
22
22
|
var _EventType = _interopRequireDefault(require("../event/EventType"));
|
|
23
23
|
var _Grid = _interopRequireDefault(require("@mui/material/Grid"));
|
|
24
24
|
var _Button = _interopRequireDefault(require("@mui/material/Button"));
|
|
25
|
-
var _mobx = require("mobx");
|
|
26
25
|
var $ = _interopRequireWildcard(require("jquery"));
|
|
27
26
|
var _Alert = _interopRequireDefault(require("react-bootstrap/Alert"));
|
|
28
27
|
var _ApplicationManager = _interopRequireDefault(require("../ApplicationManager"));
|
|
29
28
|
var _Layout = require("./layout/Layout");
|
|
30
29
|
var _DynamicJS = _interopRequireDefault(require("../DynamicJS"));
|
|
31
|
-
var _actions = require("npm/lib/install/actions");
|
|
32
30
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
33
31
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
34
32
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -130,6 +128,8 @@ const DataGrid = exports.DataGrid = /*#__PURE__*/_react.default.memo(/*#__PURE__
|
|
|
130
128
|
const [filterHandle] = _react.default.useState({});
|
|
131
129
|
const [columnLayoutHandles] = _react.default.useState({});
|
|
132
130
|
const [editorHandles] = _react.default.useState({});
|
|
131
|
+
const [rowErrorMap] = _react.default.useState({});
|
|
132
|
+
const [visible, setVisible] = _react.default.useState(true);
|
|
133
133
|
const rowCount = _react.default.useRef(-1);
|
|
134
134
|
const rowsRef = _react.default.useRef([]);
|
|
135
135
|
let noteKey = 0;
|
|
@@ -261,6 +261,9 @@ const DataGrid = exports.DataGrid = /*#__PURE__*/_react.default.memo(/*#__PURE__
|
|
|
261
261
|
if (filterHandle && filterHandle.api) {
|
|
262
262
|
filterHandle.api.refresh();
|
|
263
263
|
}
|
|
264
|
+
if (!_Utils.default.isNull(props.config.visible)) {
|
|
265
|
+
setVisible(_Utils.default.evaluateBooleanExpression(props.config.visible, props.config.id));
|
|
266
|
+
}
|
|
264
267
|
}
|
|
265
268
|
};
|
|
266
269
|
};
|
|
@@ -597,15 +600,44 @@ const DataGrid = exports.DataGrid = /*#__PURE__*/_react.default.memo(/*#__PURE__
|
|
|
597
600
|
}
|
|
598
601
|
}
|
|
599
602
|
};
|
|
603
|
+
const removeAllRowErrorsByColumn = (columnName, rowErrors) => {
|
|
604
|
+
if (rowErrors) {
|
|
605
|
+
for (let i = rowErrors.length - 1; i >= 0; i--) {
|
|
606
|
+
if (rowErrors[i].column === columnName) {
|
|
607
|
+
rowErrors.splice(i, 1);
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
};
|
|
612
|
+
const rowErrorHandler = (rowId, error, column) => {
|
|
613
|
+
if (Object.keys(rowErrorMap).length === 0 || !rowErrorMap[rowId]) {
|
|
614
|
+
rowErrorMap[rowId] = [];
|
|
615
|
+
}
|
|
616
|
+
if (error !== null) {
|
|
617
|
+
if (!rowErrorMap[rowId].find(rowError => rowError.column === column)) {
|
|
618
|
+
rowErrorMap[rowId].push(error);
|
|
619
|
+
}
|
|
620
|
+
} else {
|
|
621
|
+
removeAllRowErrorsByColumn(column, rowErrorMap[rowId]);
|
|
622
|
+
}
|
|
623
|
+
};
|
|
624
|
+
const isRowErrorsEmpty = () => {
|
|
625
|
+
if (Object.keys(rowErrorMap).length === 0) {
|
|
626
|
+
return true;
|
|
627
|
+
}
|
|
628
|
+
for (const key of Object.keys(rowErrorMap)) {
|
|
629
|
+
if (rowErrorMap[key].length > 0) {
|
|
630
|
+
return false;
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
return true;
|
|
634
|
+
};
|
|
600
635
|
const valueChangeCallback = valueRows => {
|
|
601
636
|
if (!_Utils.default.isNull(props.valueChangeHandler)) {
|
|
602
|
-
|
|
603
|
-
return !_Utils.default.isNull(row.errors) && row.errors.length > 0;
|
|
604
|
-
});
|
|
605
|
-
if (invalidRows.length > 0) {
|
|
606
|
-
props.valueChangeHandler(null);
|
|
607
|
-
} else {
|
|
637
|
+
if (isRowErrorsEmpty()) {
|
|
608
638
|
props.valueChangeHandler(valueRows);
|
|
639
|
+
} else {
|
|
640
|
+
props.valueChangeHandler(null);
|
|
609
641
|
}
|
|
610
642
|
}
|
|
611
643
|
};
|
|
@@ -658,7 +690,7 @@ const DataGrid = exports.DataGrid = /*#__PURE__*/_react.default.memo(/*#__PURE__
|
|
|
658
690
|
}
|
|
659
691
|
return editorHandles[column.id + "_editor"];
|
|
660
692
|
}
|
|
661
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
|
693
|
+
return visible && /*#__PURE__*/_react.default.createElement("div", {
|
|
662
694
|
style: _Utils.default.isNull(props.hasBorder) || props.hasBorder === true ? _Utils.default.mergeStyles({
|
|
663
695
|
margin: '0',
|
|
664
696
|
border: '1px solid #e2e2e2',
|
|
@@ -799,6 +831,7 @@ const DataGrid = exports.DataGrid = /*#__PURE__*/_react.default.memo(/*#__PURE__
|
|
|
799
831
|
key: index + "_" + column.id,
|
|
800
832
|
onClick: event => handleCellClick(event, row.id, column)
|
|
801
833
|
}, /*#__PURE__*/_react.default.createElement(_TableCellContent.default, {
|
|
834
|
+
onRowError: rowErrorHandler,
|
|
802
835
|
handle: createCellEditorHandle(column),
|
|
803
836
|
viewId: props.viewId,
|
|
804
837
|
editor: column.editor,
|
|
@@ -810,7 +843,8 @@ const DataGrid = exports.DataGrid = /*#__PURE__*/_react.default.memo(/*#__PURE__
|
|
|
810
843
|
columnConfig: column,
|
|
811
844
|
dataBinding: !_Utils.default.isNull(column.dataBinding) ? column.dataBinding : column.id,
|
|
812
845
|
row: row,
|
|
813
|
-
contentType: column.fieldType || column.editor?.fieldType
|
|
846
|
+
contentType: column.fieldType || column.editor?.fieldType,
|
|
847
|
+
cellFormatter: column.cellFormatter
|
|
814
848
|
}))));
|
|
815
849
|
})))), _Utils.default.isNull(props.pagination) || props.pagination === true ? /*#__PURE__*/_react.default.createElement(_TablePagination.default, {
|
|
816
850
|
rowsPerPageOptions: rowsPerPageOptions,
|
|
@@ -157,6 +157,151 @@ const DocumentTemplateDesignerComponent = props => {
|
|
|
157
157
|
function applyChanges() {
|
|
158
158
|
setup();
|
|
159
159
|
}
|
|
160
|
+
const comparePositions = (a, b) => {
|
|
161
|
+
if (a.location.yIn === b.location.yIn && a.location.xIn === b.location.xIn) {
|
|
162
|
+
return 0;
|
|
163
|
+
}
|
|
164
|
+
if (a.location.yIn > b.location.yIn) {
|
|
165
|
+
return 1;
|
|
166
|
+
}
|
|
167
|
+
if (a.location.yIn < b.location.yIn) {
|
|
168
|
+
return -1;
|
|
169
|
+
}
|
|
170
|
+
if (a.location.yIn === b.location.yIn) {
|
|
171
|
+
if (a.location.xIn < b.location.xIn) {
|
|
172
|
+
return -1;
|
|
173
|
+
} else {
|
|
174
|
+
return 1;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
return 0;
|
|
178
|
+
};
|
|
179
|
+
const getSearchStartPosition = (anchorPosition, searchList) => {
|
|
180
|
+
if (!anchorPosition) {
|
|
181
|
+
return searchList[0].startIn;
|
|
182
|
+
}
|
|
183
|
+
for (const searchListElement of searchList) {
|
|
184
|
+
if (comparePositions(searchListElement.startIn, anchorPosition) >= 0) {
|
|
185
|
+
return searchListElement.startIn;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
return anchorPosition;
|
|
189
|
+
};
|
|
190
|
+
const getSearchEndPosition = (anchorPosition, searchList) => {
|
|
191
|
+
if (!anchorPosition) {
|
|
192
|
+
return searchList[0].endIn;
|
|
193
|
+
}
|
|
194
|
+
for (const searchListElement of searchList) {
|
|
195
|
+
if (comparePositions(searchListElement.endIn, anchorPosition) >= 0) {
|
|
196
|
+
return searchListElement.endIn;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
return anchorPosition;
|
|
200
|
+
};
|
|
201
|
+
function generateSubstrings(sentence) {
|
|
202
|
+
let substrings = [];
|
|
203
|
+
for (let i = 0; i < sentence.length; i++) {
|
|
204
|
+
substrings.push(sentence.substring(0, i + 1)); // Add substring from index 0 to i
|
|
205
|
+
}
|
|
206
|
+
return substrings;
|
|
207
|
+
}
|
|
208
|
+
function detectWordWrap(anchorPosition, startPosition, endPosition, editor, sentence, startY) {
|
|
209
|
+
let substrings = generateSubstrings(sentence);
|
|
210
|
+
let wordWrapAnchorPosition = anchorPosition;
|
|
211
|
+
let wordWrapPositions = [];
|
|
212
|
+
if (substrings.length === 1) {
|
|
213
|
+
wordWrapPositions.push({
|
|
214
|
+
startPosition,
|
|
215
|
+
endPosition
|
|
216
|
+
});
|
|
217
|
+
} else {
|
|
218
|
+
let wordWrapTokens = [];
|
|
219
|
+
let currentY = startY;
|
|
220
|
+
let wordWrapIndex = 0;
|
|
221
|
+
let pos = 0;
|
|
222
|
+
for (const substring of substrings) {
|
|
223
|
+
container.documentEditor.search.find(substring);
|
|
224
|
+
let endPosition = getSearchEndPosition(wordWrapAnchorPosition, container.documentEditor.search.searchResults.searchModule.textSearchResults.innerList);
|
|
225
|
+
wordWrapAnchorPosition = endPosition;
|
|
226
|
+
if (endPosition.location.yIn > currentY) {
|
|
227
|
+
wordWrapTokens.push(sentence.substring(wordWrapIndex, pos));
|
|
228
|
+
currentY = endPosition.location.yIn;
|
|
229
|
+
wordWrapIndex = pos;
|
|
230
|
+
}
|
|
231
|
+
pos++;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
//Add last substring
|
|
235
|
+
wordWrapTokens.push(sentence.substring(wordWrapIndex, sentence.length));
|
|
236
|
+
//console.log("\n\n\n\n\nWORD WRAP TOKENS : [" + wordWrapIndex + "]", wordWrapTokens);
|
|
237
|
+
for (const wordWrapToken of wordWrapTokens) {
|
|
238
|
+
container.documentEditor.search.find(wordWrapToken);
|
|
239
|
+
let startPosition = getSearchStartPosition(anchorPosition, container.documentEditor.search.searchResults.searchModule.textSearchResults.innerList);
|
|
240
|
+
let endPosition = getSearchEndPosition(anchorPosition, container.documentEditor.search.searchResults.searchModule.textSearchResults.innerList);
|
|
241
|
+
wordWrapPositions.push({
|
|
242
|
+
startPosition,
|
|
243
|
+
endPosition
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
return wordWrapPositions;
|
|
248
|
+
}
|
|
249
|
+
const setPlaceholderPositions = prop => {
|
|
250
|
+
console.log("SETTING PLACE HOLDER POSITIONS FOR : " + prop.placeHolder);
|
|
251
|
+
container.documentEditor.search.find(prop.originalText);
|
|
252
|
+
let searchResults = container.documentEditor.search.searchResults.searchModule.textSearchResults.innerList;
|
|
253
|
+
prop.positions = [];
|
|
254
|
+
for (const searchResult of searchResults) {
|
|
255
|
+
if (searchResult.endIn.location.yIn > searchResult.startIn.location.yIn) {
|
|
256
|
+
let positions = detectWordWrap(searchResult.startIn, searchResult.startIn, searchResult.endIn, container.documentEditor, prop.originalText, searchResult.startIn.location.yIn);
|
|
257
|
+
for (const position of positions) {
|
|
258
|
+
prop.positions.push({
|
|
259
|
+
start: {
|
|
260
|
+
paragraph: {
|
|
261
|
+
x: position.startPosition.currentWidget.paragraph.x,
|
|
262
|
+
y: position.startPosition.currentWidget.paragraph.y,
|
|
263
|
+
height: position.startPosition.currentWidget.paragraph.height
|
|
264
|
+
},
|
|
265
|
+
x: position.startPosition.location.xIn,
|
|
266
|
+
y: position.startPosition.location.yIn
|
|
267
|
+
},
|
|
268
|
+
end: {
|
|
269
|
+
paragraph: {
|
|
270
|
+
x: position.endPosition.currentWidget.paragraph.x,
|
|
271
|
+
y: position.endPosition.currentWidget.paragraph.y,
|
|
272
|
+
height: position.endPosition.currentWidget.paragraph.height
|
|
273
|
+
},
|
|
274
|
+
x: position.endPosition.location.xIn,
|
|
275
|
+
y: position.endPosition.location.yIn
|
|
276
|
+
}
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
} else {
|
|
280
|
+
prop.positions.push({
|
|
281
|
+
start: {
|
|
282
|
+
paragraph: {
|
|
283
|
+
x: searchResult.startIn.currentWidget.paragraph.x,
|
|
284
|
+
y: searchResult.startIn.currentWidget.paragraph.y,
|
|
285
|
+
height: searchResult.startIn.currentWidget.paragraph.height
|
|
286
|
+
},
|
|
287
|
+
x: searchResult.startIn.location.xIn,
|
|
288
|
+
y: searchResult.startIn.location.yIn
|
|
289
|
+
},
|
|
290
|
+
end: {
|
|
291
|
+
paragraph: {
|
|
292
|
+
x: searchResult.endIn.currentWidget.paragraph.x,
|
|
293
|
+
y: searchResult.endIn.currentWidget.paragraph.y,
|
|
294
|
+
height: searchResult.endIn.currentWidget.paragraph.height
|
|
295
|
+
},
|
|
296
|
+
x: searchResult.endIn.location.xIn,
|
|
297
|
+
y: searchResult.endIn.location.yIn
|
|
298
|
+
}
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
console.log(prop);
|
|
303
|
+
console.log("\n\n");
|
|
304
|
+
};
|
|
160
305
|
function setup() {
|
|
161
306
|
let initialFormValue = {
|
|
162
307
|
properties: []
|
|
@@ -180,6 +325,8 @@ const DocumentTemplateDesignerComponent = props => {
|
|
|
180
325
|
placeHolder: match.text
|
|
181
326
|
};
|
|
182
327
|
}
|
|
328
|
+
prop.originalText = match.originalText;
|
|
329
|
+
setPlaceholderPositions(prop);
|
|
183
330
|
if (!initialFormValue.properties.find(p => p.placeHolder === match.text)) {
|
|
184
331
|
initialFormValue.properties.push(prop);
|
|
185
332
|
}
|
|
@@ -255,6 +402,7 @@ const DocumentTemplateDesignerComponent = props => {
|
|
|
255
402
|
}
|
|
256
403
|
}
|
|
257
404
|
matches.push({
|
|
405
|
+
originalText: find,
|
|
258
406
|
start: startIndex,
|
|
259
407
|
end: endIndex + endTag.length,
|
|
260
408
|
text: find.replace(/(\r\n|\n|\r)/gm, "")
|
|
@@ -270,6 +418,27 @@ const DocumentTemplateDesignerComponent = props => {
|
|
|
270
418
|
if (container) {
|
|
271
419
|
setupContainer();
|
|
272
420
|
//autoSave();
|
|
421
|
+
|
|
422
|
+
const editor = container.documentEditor;
|
|
423
|
+
editor.addEventListener("keyDown", event => {
|
|
424
|
+
const startPosition = container.documentEditor.selection.start;
|
|
425
|
+
let selectedProperty;
|
|
426
|
+
for (const property of model.current.properties) {
|
|
427
|
+
for (const position of property.positions) {
|
|
428
|
+
if (position.start.y === startPosition.location.yIn && position.start.x <= startPosition.location.xIn && position.end.x >= startPosition.location.xIn) {
|
|
429
|
+
selectedProperty = property;
|
|
430
|
+
break;
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
if (selectedProperty) {
|
|
435
|
+
event.event.preventDefault();
|
|
436
|
+
if (event.event.key === "Backspace") {
|
|
437
|
+
// For some reason, preventDefault does not work on the backspace key so we throw this exception as a temporary measure to prevent it
|
|
438
|
+
throw new Error("Backspace pressed on restricted area");
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
});
|
|
273
442
|
}
|
|
274
443
|
}, [container]);
|
|
275
444
|
(0, _react.useEffect)(() => {
|