@agilemotion/oui-react-js 1.8.32 → 1.8.34

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.
@@ -61,6 +61,9 @@ class ApplicationManager {
61
61
  getUserDetails() {
62
62
  return instance.getUserDetails();
63
63
  },
64
+ closePopupView() {
65
+ return instance.closePopupView();
66
+ },
64
67
  fireEvent(eventType, event) {
65
68
  return _Observable.default.fireEvent(eventType, new _Event.default(event.source, event.viewId, event.data));
66
69
  },
@@ -195,6 +198,10 @@ class ApplicationManager {
195
198
  openPopupView(view) {
196
199
  this.props.confirmationDialogController.openPopupView(view);
197
200
  }
201
+ closePopupView() {
202
+ this.viewContext.popup.closeAllViews();
203
+ this.props.confirmationDialogController.closePopupView();
204
+ }
198
205
  openWindowView(view) {
199
206
  _Observable.default.emitContextChangeEvent(applicationContext, {
200
207
  windowView: view
@@ -101,7 +101,7 @@ class ViewContext {
101
101
  }
102
102
  }
103
103
  }
104
- if (forward || view.parent) {
104
+ if ((forward || view.parent) && !view.graphId) {
105
105
  let historyElement = {};
106
106
  historyElement.viewId = view.config.id;
107
107
  historyElement.parent = view.parent;
@@ -34,8 +34,8 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
34
34
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
35
35
  const MULTI_SELECT_CHECKBOX_COL_WIDTH = exports.MULTI_SELECT_CHECKBOX_COL_WIDTH = 64;
36
36
  function evaluateTableCellWidth(multiSelect, column, columnCount) {
37
- let width = column.attributes['width'];
38
- return multiSelect === true ? 'calc(' + (typeof width !== 'undefined' ? width : 100 / columnCount + '%') + ' - ' + MULTI_SELECT_CHECKBOX_COL_WIDTH / columnCount + 'px)' : typeof width !== 'undefined' ? width : 100 / columnCount + '%';
37
+ let width = _ApplicationManager.default.isExpression(column.attributes['width']) ? _DynamicJS.default.executeScript(`popupTitle_${column.id}`, column.attributes['width'], column) : column.attributes['width'];
38
+ return multiSelect === true ? 'calc(' + (!_Utils.default.isNull(width) ? width : 100 / columnCount + '%') + ' - ' + MULTI_SELECT_CHECKBOX_COL_WIDTH / columnCount + 'px)' : typeof width !== 'undefined' ? width : 100 / columnCount + '%';
39
39
  }
40
40
  function desc(a, b, orderBy) {
41
41
  if (b[orderBy] < a[orderBy]) {
@@ -137,14 +137,6 @@ const DataGrid = exports.DataGrid = /*#__PURE__*/_react.default.memo(/*#__PURE__
137
137
  const rowsRef = _react.default.useRef([]);
138
138
  let noteKey = 0;
139
139
  const columnWidths = _react.default.useRef({});
140
- function updateColumnWidths() {
141
- for (let col of config.columns) {
142
- if (columnWidths.current[col.id]) {
143
- col.attributes.width = columnWidths.current[col.id];
144
- }
145
- }
146
- setRows([...rows]);
147
- }
148
140
  const api = () => {
149
141
  return {
150
142
  get id() {
@@ -333,25 +325,26 @@ const DataGrid = exports.DataGrid = /*#__PURE__*/_react.default.memo(/*#__PURE__
333
325
  if (_Utils.default.isNull(props.config.disableRowSelection) || props.config.disableRowSelection === false) {
334
326
  _ApplicationManager.default.enableFormMarkers(true);
335
327
  const selectedIndex = -1;
336
- selected.indexOf(id);
337
- let newSelected = [];
338
- if (props.multiSelect === true) {
339
- if (selectedIndex === -1) {
340
- newSelected = newSelected.concat(selected, id);
341
- } else if (selectedIndex === 0) {
342
- newSelected = newSelected.concat(selected.slice(1));
343
- } else if (selectedIndex === selected.length - 1) {
344
- newSelected = newSelected.concat(selected.slice(0, -1));
345
- } else if (selectedIndex > 0) {
346
- newSelected = newSelected.concat(selected.slice(0, selectedIndex), selected.slice(selectedIndex + 1));
328
+ if (selected.indexOf(id) < 0) {
329
+ let newSelected = [];
330
+ if (props.multiSelect === true) {
331
+ if (selectedIndex === -1) {
332
+ newSelected = newSelected.concat(selected, id);
333
+ } else if (selectedIndex === 0) {
334
+ newSelected = newSelected.concat(selected.slice(1));
335
+ } else if (selectedIndex === selected.length - 1) {
336
+ newSelected = newSelected.concat(selected.slice(0, -1));
337
+ } else if (selectedIndex > 0) {
338
+ newSelected = newSelected.concat(selected.slice(0, selectedIndex), selected.slice(selectedIndex + 1));
339
+ }
340
+ } else {
341
+ newSelected.push(id);
342
+ }
343
+ let selectedRows = getSelectedRows(newSelected);
344
+ setSelected(newSelected);
345
+ if (!_Utils.default.isNull(props.onSelectionChange)) {
346
+ props.onSelectionChange(selectedRows);
347
347
  }
348
- } else {
349
- newSelected.push(id);
350
- }
351
- let selectedRows = getSelectedRows(newSelected);
352
- setSelected(newSelected);
353
- if (!_Utils.default.isNull(props.onSelectionChange)) {
354
- props.onSelectionChange(selectedRows);
355
348
  }
356
349
  }
357
350
  }
@@ -480,7 +473,10 @@ const DataGrid = exports.DataGrid = /*#__PURE__*/_react.default.memo(/*#__PURE__
480
473
  isEditable = true;
481
474
  setEditable(true);
482
475
  }
483
- column.width = evaluateTableCellWidth(props.selectionMode === 'MULTIPLE', column, visibleColumnCount);
476
+ if (!column.attributes) {
477
+ column.attributes = {};
478
+ }
479
+ column.attributes.width = evaluateTableCellWidth(props.selectionMode === 'MULTIPLE', column, visibleColumnCount);
484
480
  if (!_Utils.default.isNull(column.attributes) && column.attributes['editable'] === true && _Utils.default.isNull(column.editor)) {
485
481
  let defaultEditor = {};
486
482
  defaultEditor.fieldType = 'TEXT_FIELD';
@@ -85,8 +85,10 @@ const HtmlPanel = /*#__PURE__*/_react.default.memo(/*#__PURE__*/_react.default.f
85
85
  },
86
86
  loadData: (actionConfig, event) => {
87
87
  if (actionConfig && actionConfig.value) {
88
- let data = _ApplicationManager.default.resolveExpressionValue(actionConfig.value, event?.data);
89
- console.log("DATA : ", data);
88
+ let parameterConfig = {
89
+ value: actionConfig.value
90
+ };
91
+ let data = _ApplicationManager.default.resolveParameterConfigValue(parameterConfig, event?.data)?.value;
90
92
  let templateScript = Handlebars.compile(template);
91
93
  setContent(templateScript(data));
92
94
  }
@@ -12,11 +12,12 @@ var _Utils = _interopRequireDefault(require("../Utils"));
12
12
  var _styles = require("@mui/styles");
13
13
  var _View = require("./layout/View");
14
14
  var _DynamicJS = _interopRequireDefault(require("../DynamicJS"));
15
+ var _ApplicationManager = _interopRequireDefault(require("../ApplicationManager"));
15
16
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
16
17
  function PopupViewDialog(props) {
17
- const [title, setTitle] = _react.default.useState("");
18
- const height = _Utils.default.getComponentStyleAttribute(props.view.config, 'height', '28vh');
19
- const width = _Utils.default.getComponentStyleAttribute(props.view.config, 'width', '40vw');
18
+ const [title, setTitle] = _react.default.useState(null);
19
+ const height = _Utils.default.getComponentStyleAttribute(props.view.config, 'height', '38vh');
20
+ const width = _Utils.default.getComponentStyleAttribute(props.view.config, 'width', '60vw');
20
21
  const useStyles = (0, _styles.makeStyles)(theme => ({
21
22
  dialogPaper: {
22
23
  minHeight: height,
@@ -29,6 +30,7 @@ function PopupViewDialog(props) {
29
30
  const handler = result => {
30
31
  props.handler(result);
31
32
  };
33
+ let parsedConfig = _Utils.default.parseConfig(props.view.config, props.view.config.id);
32
34
  return /*#__PURE__*/_react.default.createElement(_Dialog.default, {
33
35
  classes: {
34
36
  paper: classes.dialogPaper
@@ -36,7 +38,7 @@ function PopupViewDialog(props) {
36
38
  open: props.view !== null,
37
39
  "aria-labelledby": "alert-dialog-title",
38
40
  "aria-describedby": "alert-dialog-description"
39
- }, /*#__PURE__*/_react.default.createElement(_DialogTitle.default, {
41
+ }, title && /*#__PURE__*/_react.default.createElement(_DialogTitle.default, {
40
42
  id: "alert-dialog-title"
41
43
  }, title), /*#__PURE__*/_react.default.createElement(_DialogContent.default, {
42
44
  style: {
@@ -49,7 +51,9 @@ function PopupViewDialog(props) {
49
51
  ref: props.view.ref,
50
52
  handle: props.view.handle,
51
53
  loadCallback: () => {
52
- setTitle(_DynamicJS.default.executeScript(`popupTitle_${props.view.id}`, props.view.config.title, props.view.id));
54
+ if (parsedConfig.windowTitle) {
55
+ setTitle(_ApplicationManager.default.isExpression(parsedConfig.windowTitle) ? _DynamicJS.default.executeScript(`popupTitle_${props.view.id}`, parsedConfig.windowTitle, parsedConfig.id) : parsedConfig.windowTitle);
56
+ }
53
57
  }
54
58
  })));
55
59
  }
@@ -28,6 +28,7 @@ const useStyles = (0, _styles.makeStyles)(theme => ({
28
28
  }));
29
29
  const StepperTitleBar = /*#__PURE__*/_react.default.memo(/*#__PURE__*/_react.default.forwardRef((props, ref) => {
30
30
  const [steps, setSteps] = _react.default.useState(null);
31
+ const [visible, setVisible] = _react.default.useState(false);
31
32
  const [activeSegmentPercentage, setActiveSegmentPercentage] = _react.default.useState(null);
32
33
  const currentIndex = _react.default.useRef(null);
33
34
  let keyCounter = 0;
@@ -84,23 +85,36 @@ const StepperTitleBar = /*#__PURE__*/_react.default.memo(/*#__PURE__*/_react.def
84
85
  get id() {
85
86
  return props.config.id;
86
87
  },
88
+ set visible(visible) {
89
+ setVisible(visible);
90
+ },
91
+ refresh() {
92
+ let parsedConfig = _Utils.default.parseConfig(props.config ? props.config : props.config, props.viewId);
93
+ setVisible(_Utils.default.isNull(parsedConfig.visible) || _Utils.default.evaluateBooleanExpression(parsedConfig.visible, parsedConfig.id));
94
+ },
87
95
  getChildren: () => {
88
96
  return [];
89
97
  },
90
98
  show() {
99
+ let graph;
91
100
  let graphs = [];
92
- for (const key of Object.keys(this.viewContext)) {
93
- let viewManager = this.viewContext[key];
94
- for (const graph of viewManager.getGraphs()) {
95
- graphs.push(graph);
101
+ let view = _ApplicationManager.default.getView(props.viewId);
102
+ if (view) {
103
+ for (const key of Object.keys(_ApplicationManager.default.viewContext)) {
104
+ let viewManager = _ApplicationManager.default.viewContext[key];
105
+ for (const viewManagerGraph of viewManager.getGraphs()) {
106
+ if (viewManagerGraph.id === view.graphId) {
107
+ graph = viewManagerGraph;
108
+ }
109
+ }
96
110
  }
97
111
  }
98
-
99
- // TODO : Ensure this picks the graph from the correct view
100
- let steps = graphs[graphs.length - 1].getTitleStack();
101
- setSteps(steps);
102
- currentIndex.current = graphs[graphs.length - 1].getCurrentNodeIndex();
103
- setActiveSegmentPercentage(100 - 10 * (steps.length - 1));
112
+ if (graph) {
113
+ let steps = graph.getTitleStack();
114
+ setSteps(steps);
115
+ currentIndex.current = graph.getCurrentNodeIndex();
116
+ setActiveSegmentPercentage(100 - 10 * (steps.length - 1));
117
+ }
104
118
  }
105
119
  };
106
120
  };
@@ -110,7 +124,7 @@ const StepperTitleBar = /*#__PURE__*/_react.default.memo(/*#__PURE__*/_react.def
110
124
  }, graphicsCounter > 0 ? /*#__PURE__*/_react.default.createElement("div", {
111
125
  className: (graphicsCounter <= currentIndex.current ? `${classes.themeBorder} ` : '') + '' + (graphicsCounter === steps.length - 1 ? ' lastLine' : '')
112
126
  }) : null, /*#__PURE__*/_react.default.createElement("div", {
113
- className: 'row flex' + (graphicsCounter === 0 ? ' firstBox' : ''),
127
+ className: 'row flex-nowrap' + (graphicsCounter === 0 ? ' firstBox' : ''),
114
128
  style: {
115
129
  marginLeft: 'unset',
116
130
  marginRight: 'unset',
@@ -121,7 +135,7 @@ const StepperTitleBar = /*#__PURE__*/_react.default.memo(/*#__PURE__*/_react.def
121
135
  style: {
122
136
  whiteSpace: "nowrap"
123
137
  },
124
- className: (graphicsCounter < currentIndex.current ? `${classes.secondary} box` : graphicsCounter === currentIndex.current ? `${classes.primary} box` : 'box-pending') + ' row no-margin no-padding'
138
+ className: (graphicsCounter < currentIndex.current ? `${classes.secondary} box flex-nowrap` : graphicsCounter === currentIndex.current ? `${classes.primary} box` : 'box-pending') + ' row no-margin no-padding'
125
139
  }, /*#__PURE__*/_react.default.createElement("div", {
126
140
  className: 'dot col-*-*',
127
141
  style: {
@@ -158,11 +172,10 @@ const StepperTitleBar = /*#__PURE__*/_react.default.memo(/*#__PURE__*/_react.def
158
172
  }
159
173
  function render() {
160
174
  return /*#__PURE__*/_react.default.createElement("div", {
161
- className: "w-100",
175
+ className: "w-100 flex-nowrap",
162
176
  style: {
163
177
  display: "flex",
164
- width: "100%",
165
- margin: "0 0 16px 0"
178
+ width: "100%"
166
179
  }
167
180
  }, steps.map(step => /*#__PURE__*/_react.default.createElement("div", {
168
181
  align: graphicsCounter === 0 ? "left" : graphicsCounter === steps.length - 1 ? "right" : "center",
@@ -176,12 +189,14 @@ const StepperTitleBar = /*#__PURE__*/_react.default.memo(/*#__PURE__*/_react.def
176
189
  id: "step-container-" + counter++
177
190
  }, renderStep(step))));
178
191
  }
179
- return /*#__PURE__*/_react.default.createElement("div", null, !_Utils.default.isNull(props.config) ? /*#__PURE__*/_react.default.createElement("div", {
192
+ return /*#__PURE__*/_react.default.createElement("div", null, visible && !_Utils.default.isNull(props.config) ? /*#__PURE__*/_react.default.createElement("div", {
180
193
  style: _Utils.default.mergeStyles({
181
194
  fontSize: '24px',
182
195
  color: '#202124',
183
- padding: "16px 0",
184
- margin: "0"
196
+ padding: "0 0 32px 0",
197
+ display: 'flex',
198
+ justifyContent: 'center',
199
+ margin: "0 0 16px 0"
185
200
  }, props.config)
186
201
  }, !_Utils.default.isNull(steps) && !_Utils.default.isNull(activeSegmentPercentage) && !_Utils.default.isNull(currentIndex.current) ? render() : null) : null);
187
202
  }));
@@ -143,19 +143,38 @@ const TabPanel = /*#__PURE__*/_react.default.memo(/*#__PURE__*/_react.default.fo
143
143
  }, /*#__PURE__*/_react.default.createElement(_Tabs.default, {
144
144
  value: tabValue,
145
145
  onChange: handleTabChange,
146
- indicatorColor: "primary",
146
+ variant: "scrollable" // enables horizontal scroll
147
+ ,
148
+ scrollButtons: "auto" // shows arrows when needed
149
+ ,
150
+ allowScrollButtonsMobile: true // show arrows on mobile too
151
+ ,
147
152
  textColor: "primary",
148
- "aria-label": "tabs"
149
- }, !_Utils.default.isNull(props.config) && !_Utils.default.isNull(props.config.tabPages) && props.config.tabPages.length > 0 ? props.config.tabPages.map((page, index) => {
150
- return /*#__PURE__*/_react.default.createElement(_Tab.default, _extends({
151
- label: page.attributes['label']
152
- }, a11yProps(index), {
153
- key: index,
154
- style: {
155
- color: _ApplicationManager.default.isFormMarkersEnabled() && errors !== null && errors[page.id] === true ? '#ed5249' : null
153
+ indicatorColor: "primary",
154
+ "aria-label": "tabs",
155
+ sx: {
156
+ // optional: reduce default min width so more tabs fit
157
+ '& .MuiTab-root': {
158
+ minWidth: 120
156
159
  }
157
- }));
158
- }) : null)), !_Utils.default.isNull(props.config) && !_Utils.default.isNull(props.config.tabPages) && props.config.tabPages.length > 0 ? props.config.tabPages.map((page, index) => {
160
+ }
161
+ }, props?.config?.tabPages?.length > 0 ? props.config.tabPages.map((page, index) => /*#__PURE__*/_react.default.createElement(_Tab.default, _extends({
162
+ key: index,
163
+ label: page.attributes['label'],
164
+ wrapped: true // allow multi-line label
165
+ }, a11yProps(index), {
166
+ sx: {
167
+ maxWidth: 240,
168
+ // constrain so wrapping can occur
169
+ whiteSpace: 'normal',
170
+ // allow wrap
171
+ wordBreak: 'break-word',
172
+ // break long words
173
+ textTransform: 'uppercase',
174
+ // keep original casing
175
+ color: _ApplicationManager.default.isFormMarkersEnabled() && errors !== null && errors[page.id] === true ? '#ed5249' : undefined
176
+ }
177
+ }))) : null)), !_Utils.default.isNull(props.config) && !_Utils.default.isNull(props.config.tabPages) && props.config.tabPages.length > 0 ? props.config.tabPages.map((page, index) => {
159
178
  if (_Utils.default.isNull(page.id)) {
160
179
  page.id = index + '-tab-page';
161
180
  }
@@ -28,7 +28,7 @@ const json = response => {
28
28
  return response.text();
29
29
  };
30
30
  const location = window.location.protocol + "//" + window.location.hostname;
31
- const AutoCompleteWrapper = /*#__PURE__*/_react.default.memo(/*#__PURE__*/_react.default.forwardRef((props, ref) => {
31
+ const AutoCompleteWrapper = props => {
32
32
  const base = props.base;
33
33
  const value = (0, _react.useRef)([]);
34
34
  const [inputValue, setInputValue] = (0, _react.useState)('');
@@ -139,12 +139,12 @@ const AutoCompleteWrapper = /*#__PURE__*/_react.default.memo(/*#__PURE__*/_react
139
139
  label: _Utils.default.getComponentAttribute(props.config, 'label', '')
140
140
  }))
141
141
  });
142
- }));
143
- const AutoComplete = /*#__PURE__*/_react.default.memo(/*#__PURE__*/_react.default.forwardRef((props, ref) => {
142
+ };
143
+ const AutoComplete = props => {
144
144
  return /*#__PURE__*/_react.default.createElement(_BaseField.BaseField, _extends({}, props, {
145
145
  handle: props.handle
146
146
  }), base => /*#__PURE__*/_react.default.createElement(AutoCompleteWrapper, _extends({
147
147
  base: base
148
148
  }, props)));
149
- }));
149
+ };
150
150
  var _default = exports.default = AutoComplete;
@@ -15,7 +15,7 @@ var _AdapterDayjs = require("@mui/x-date-pickers/AdapterDayjs");
15
15
  var _dayjs = _interopRequireDefault(require("dayjs"));
16
16
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
17
17
  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); }
18
- const CustomDatePickerComponent = /*#__PURE__*/_react.default.memo(/*#__PURE__*/_react.default.forwardRef((props, ref) => {
18
+ const CustomDatePickerComponent = props => {
19
19
  const [minDate, setMinDate] = _react.default.useState(null);
20
20
  const [maxDate, setMaxDate] = _react.default.useState(null);
21
21
  const base = props.base;
@@ -107,7 +107,7 @@ const CustomDatePickerComponent = /*#__PURE__*/_react.default.memo(/*#__PURE__*/
107
107
  minDate: (0, _dayjs.default)(minDate),
108
108
  maxDate: (0, _dayjs.default)(maxDate)
109
109
  }));
110
- }));
110
+ };
111
111
  const DatePicker = props => {
112
112
  return /*#__PURE__*/_react.default.createElement(_BaseField.BaseField, _extends({}, props, {
113
113
  handle: props.handle,