@agilemotion/oui-react-js 1.3.9 → 1.4.0

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.
Files changed (94) hide show
  1. package/dist/{ApplicationContext.js → ApplicationManager.js} +196 -74
  2. package/dist/BasicApp.js +66 -63
  3. package/dist/BasicAppHome.js +85 -118
  4. package/dist/BusinessPortalAppHome.js +9 -15
  5. package/dist/DynamicJS.js +7 -3
  6. package/dist/RestUtils.js +13 -14
  7. package/dist/Utils.js +15 -9
  8. package/dist/WithRouter.js +34 -0
  9. package/dist/assets/scss/black-dashboard-react/custom/_sidebar-and-main-panel.scss +1 -1
  10. package/dist/components/AlertBar.js +1 -1
  11. package/dist/components/Button.js +34 -25
  12. package/dist/components/Calendar.js +9 -45
  13. package/dist/components/DataGrid.js +49 -18
  14. package/dist/components/DataGridColumn.js +1 -1
  15. package/dist/components/DataGridFilter.js +2 -2
  16. package/dist/components/Dialog.js +1 -1
  17. package/dist/components/DocumentViewer.js +5 -5
  18. package/dist/components/FileThumb.js +30 -19
  19. package/dist/components/Graph.js +10 -2
  20. package/dist/components/GraphNode.js +1 -1
  21. package/dist/components/HtmlPanel.js +10 -5
  22. package/dist/components/Icon.js +8 -0
  23. package/dist/components/PopupView.js +1 -1
  24. package/dist/components/Portlet.js +100 -0
  25. package/dist/components/SignaturePanel.js +1 -1
  26. package/dist/components/SocketManager.js +2 -2
  27. package/dist/components/StepperTitleBar.js +4 -4
  28. package/dist/components/TabPanel.js +11 -3
  29. package/dist/components/TableCellContent.js +1 -1
  30. package/dist/components/TemplateDesigner.js +11 -11
  31. package/dist/components/TitleBar.js +4 -3
  32. package/dist/components/Toolbar.js +42 -11
  33. package/dist/components/Tree.js +3 -3
  34. package/dist/components/dashboard/BasicBusinessAppDashboard.js +9 -7
  35. package/dist/components/dashboard/components/Header.js +1 -1
  36. package/dist/components/dashboard/components/blackDashboard/sidebar/Sidebar.css +7 -0
  37. package/dist/components/dashboard/components/blackDashboard/sidebar/Sidebar.js +74 -72
  38. package/dist/components/form/AutoComplete.js +31 -30
  39. package/dist/components/form/BaseField.js +38 -26
  40. package/dist/components/form/DatePicker.js +5 -2
  41. package/dist/components/form/FieldSet.js +11 -19
  42. package/dist/components/form/Form.js +24 -16
  43. package/dist/components/form/ImageEditor.js +4 -4
  44. package/dist/components/form/MultiFileUploadField.js +15 -14
  45. package/dist/components/form/RadioGroup.js +10 -11
  46. package/dist/components/form/Section.js +10 -0
  47. package/dist/components/form/TimePicker.js +1 -0
  48. package/dist/components/form/UploadField.js +115 -108
  49. package/dist/components/layout/Layout.js +65 -12
  50. package/dist/components/layout/View.css +1 -0
  51. package/dist/components/layout/View.js +20 -23
  52. package/dist/components/layout/ViewContainer.css +3 -0
  53. package/dist/components/layout/ViewContainer.js +59 -0
  54. package/dist/components/layout/ViewPort.js +50 -80
  55. package/dist/components/layout/Window.css +18 -0
  56. package/dist/components/layout/Window.js +287 -0
  57. package/dist/components/layout/WindowViewPort.js +71 -0
  58. package/dist/components/media/MediaSoupHelper.js +1 -1
  59. package/dist/components/media/Toolbar.css +18 -3
  60. package/dist/components/media/Toolbar.js +80 -56
  61. package/dist/components/media/TrainingRoom.js +97 -20
  62. package/dist/components/media/VCRoom.js +1 -1
  63. package/dist/components/media/VCRoomParticipant.js +17 -15
  64. package/dist/components/media/VCRoomRecorder.js +223 -0
  65. package/dist/components/media/VCRoomWorkspace.js +169 -156
  66. package/dist/components/media/VideoPlayer.css +10 -0
  67. package/dist/components/media/VideoPlayer.js +86 -0
  68. package/dist/components/menu/MenuButton.js +22 -6
  69. package/dist/components/menu/MenuLink.js +13 -10
  70. package/dist/components/navbars/HomeNavbar.js +2 -2
  71. package/dist/components/navbars/PortalNavbar.js +3 -3
  72. package/dist/components/signatures/AgilitySignaturePanel.js +4 -4
  73. package/dist/components/signatures/ImageSignatureInput.js +4 -4
  74. package/dist/components/signatures/SignatureInput.js +4 -4
  75. package/dist/components/signatures/SignatureTemplateDesigner.js +6 -6
  76. package/dist/event/ActionHandlers.js +3 -3
  77. package/dist/event/Observable.js +33 -15
  78. package/dist/event/RouteActionHandler.js +38 -29
  79. package/dist/event/ServiceCallActionHandler.js +4 -2
  80. package/dist/event/SignalGraphActionHandler.js +2 -2
  81. package/dist/js/Calendar.js +220 -0
  82. package/dist/js/Media.js +2 -2
  83. package/dist/view/Dashboard.js +34 -28
  84. package/dist/view/Views.js +30 -0
  85. package/dist/view/security/ChangePasswordBasic.js +6 -4
  86. package/dist/view/security/ForgotPassword.js +4 -4
  87. package/dist/view/security/ForgotPasswordBasic.js +4 -4
  88. package/dist/view/security/Login.js +4 -4
  89. package/dist/view/security/LoginBasic.js +5 -5
  90. package/dist/view/security/LoginBusinessPortal.js +4 -4
  91. package/dist/view/security/ResetPassword.js +4 -4
  92. package/dist/view/security/ResetPasswordBasic.js +6 -4
  93. package/package.json +6 -16
  94. package/gulpfile.js +0 -77
@@ -39,10 +39,13 @@ const MenuLink = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
39
39
  _Observable.default.addSubscriptions(parsedConfig.eventHandlingConfig, handle, props.viewId);
40
40
 
41
41
  if (props.autoClick) {
42
- dispatch(_DashboardStore.actionCreators.setActiveRoute({
43
- id: props.id,
44
- name: props.name
45
- }));
42
+ if (!_Utils.default.isNull(props.clickCallback)) {
43
+ props.clickCallback({
44
+ id: props.id,
45
+ name: props.name
46
+ });
47
+ }
48
+
46
49
  let event = new _Event.default(handle, props.viewId);
47
50
 
48
51
  _Observable.default.fireEvent(_EventType.default.CLICK, event);
@@ -52,16 +55,15 @@ const MenuLink = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
52
55
 
53
56
  const handleClick = e => {
54
57
  e.preventDefault();
55
- dispatch(_DashboardStore.actionCreators.setActiveRoute({
56
- id: props.id,
57
- name: props.name
58
- }));
59
58
  let event = new _Event.default(handle, props.viewId);
60
59
 
61
60
  _Observable.default.fireEvent(_EventType.default.CLICK, event);
62
61
 
63
62
  if (!_Utils.default.isNull(props.clickCallback)) {
64
- props.clickCallback();
63
+ props.clickCallback({
64
+ id: props.id,
65
+ name: props.name
66
+ });
65
67
  }
66
68
  };
67
69
 
@@ -80,7 +82,8 @@ const MenuLink = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
80
82
  ref: ref,
81
83
  style: {
82
84
  color: 'inherit',
83
- marginLeft: (props.level + 1) * props.tab + 'px'
85
+ marginLeft: (props.level + 1) * props.tab + 'px',
86
+ backgroundColor: props.backgroundColor
84
87
  }
85
88
  }, ((_props$config = props.config) === null || _props$config === void 0 ? void 0 : _props$config.icon) !== undefined ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Icon.default, {
86
89
  id: props.config.icon
@@ -11,7 +11,7 @@ var _classnames = _interopRequireDefault(require("classnames"));
11
11
 
12
12
  var _reactstrap = require("reactstrap");
13
13
 
14
- var _reactRouterDom = require("react-router-dom");
14
+ var _WithRouter = _interopRequireDefault(require("../../WithRouter"));
15
15
 
16
16
  var _reactRedux = require("react-redux");
17
17
 
@@ -266,6 +266,6 @@ class HomeNavbar extends _react.default.Component {
266
266
 
267
267
  }
268
268
 
269
- var _default = (0, _reactRouterDom.withRouter)((0, _reactRedux.connect)(propHandler, dispatch => (0, _redux.bindActionCreators)(_DashboardStore.actionCreators, dispatch))(HomeNavbar));
269
+ var _default = (0, _WithRouter.default)((0, _reactRedux.connect)(propHandler, dispatch => (0, _redux.bindActionCreators)(_DashboardStore.actionCreators, dispatch))(HomeNavbar));
270
270
 
271
271
  exports.default = _default;
@@ -21,7 +21,7 @@ var _reactstrap = require("reactstrap");
21
21
 
22
22
  var _ActionHandlers = _interopRequireDefault(require("../../event/ActionHandlers"));
23
23
 
24
- var _ApplicationContext = _interopRequireWildcard(require("./../../ApplicationContext"));
24
+ var _ApplicationManager = _interopRequireWildcard(require("../../ApplicationManager"));
25
25
 
26
26
  var _Utils = _interopRequireDefault(require("../../Utils"));
27
27
 
@@ -52,13 +52,13 @@ const PortalNavbar = /*#__PURE__*/_react.default.memo(props => {
52
52
  _react.default.useEffect(() => {
53
53
  if (initializing.current) {
54
54
  let avatarListener = {};
55
- avatarListener.type = _ApplicationContext.AVATAR_LISTENER_TYPE;
55
+ avatarListener.type = _ApplicationManager.AVATAR_LISTENER_TYPE;
56
56
 
57
57
  avatarListener.handler = avatar => {
58
58
  setAvatarUrl(avatar.url);
59
59
  };
60
60
 
61
- _ApplicationContext.default.addApplicationListener(avatarListener);
61
+ _ApplicationManager.default.addApplicationListener(avatarListener);
62
62
 
63
63
  initializing.current = false;
64
64
  }
@@ -25,7 +25,7 @@ var _htmlToImage = require("html-to-image");
25
25
 
26
26
  var _DocumentContainer = _interopRequireDefault(require("./DocumentContainer"));
27
27
 
28
- var _ApplicationContext = _interopRequireDefault(require("../../ApplicationContext"));
28
+ var _ApplicationManager = _interopRequireDefault(require("../../ApplicationManager"));
29
29
 
30
30
  var _reactPromiseTracker = require("react-promise-tracker");
31
31
 
@@ -134,7 +134,7 @@ const AgilitySignaturePanel = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_re
134
134
 
135
135
  function fetchImages() {
136
136
  let fetchConfig = getFetchConfig();
137
- let url = location + _ApplicationContext.default.getContextRoot() + props.signatureImageUrl + '/find';
137
+ let url = location + _ApplicationManager.default.getContextRoot() + props.signatureImageUrl + '/find';
138
138
  (0, _reactPromiseTracker.trackPromise)(fetch(encodeURI(url), fetchConfig).then(status).then(json).then(data => {
139
139
  if (data && data.length > 0) {
140
140
  let images = JSON.parse(data);
@@ -142,9 +142,9 @@ const AgilitySignaturePanel = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_re
142
142
  }
143
143
  }).catch(e => {
144
144
  if (e.code === 401) {
145
- _ApplicationContext.default.clear();
145
+ _ApplicationManager.default.clear();
146
146
 
147
- _ApplicationContext.default.getApplicationHistory().push('/login');
147
+ _ApplicationManager.default.getApplicationHistory().push('/login');
148
148
  }
149
149
  }));
150
150
  }
@@ -13,7 +13,7 @@ var _styles = require("@material-ui/core/styles");
13
13
 
14
14
  var _Utils = _interopRequireDefault(require("../../Utils"));
15
15
 
16
- var _ApplicationContext = _interopRequireDefault(require("./../../ApplicationContext"));
16
+ var _ApplicationManager = _interopRequireDefault(require("../../ApplicationManager"));
17
17
 
18
18
  var _Icon = _interopRequireDefault(require("../Icon"));
19
19
 
@@ -90,14 +90,14 @@ const ImageSignatureInput = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_reac
90
90
 
91
91
  function process(callback, data, action) {
92
92
  let fetchConfig = getFetchConfig(data);
93
- let url = location + _ApplicationContext.default.getContextRoot() + props.imageProcessingUrl + "/" + action + "/TEXT";
93
+ let url = location + _ApplicationManager.default.getContextRoot() + props.imageProcessingUrl + "/" + action + "/TEXT";
94
94
  (0, _reactPromiseTracker.trackPromise)(fetch(encodeURI(url), fetchConfig).then(status).then(json).then(data => {
95
95
  callback(data);
96
96
  }).catch(e => {
97
97
  if (e.code === 401) {
98
- _ApplicationContext.default.clear();
98
+ _ApplicationManager.default.clear();
99
99
 
100
- _ApplicationContext.default.getApplicationHistory().push('/login');
100
+ _ApplicationManager.default.getApplicationHistory().push('/login');
101
101
  }
102
102
  }));
103
103
  }
@@ -27,7 +27,7 @@ var _ImageSignatureInput = _interopRequireDefault(require("./ImageSignatureInput
27
27
 
28
28
  var _Utils = _interopRequireDefault(require("../../Utils"));
29
29
 
30
- var _ApplicationContext = _interopRequireDefault(require("../../ApplicationContext"));
30
+ var _ApplicationManager = _interopRequireDefault(require("../../ApplicationManager"));
31
31
 
32
32
  var _reactPromiseTracker = require("react-promise-tracker");
33
33
 
@@ -71,16 +71,16 @@ const SignatureInput = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.def
71
71
  data.signature = props.mode === 'SIGN' ? value : systemImage ? systemImage.signature : null;
72
72
  data.initial = props.mode === 'INITIAL' ? value : systemImage ? systemImage.initial : null;
73
73
  let fetchConfig = getFetchConfig(JSON.stringify(data));
74
- let url = location + _ApplicationContext.default.getContextRoot() + props.signatureImageUrl + "/save";
74
+ let url = location + _ApplicationManager.default.getContextRoot() + props.signatureImageUrl + "/save";
75
75
  (0, _reactPromiseTracker.trackPromise)(fetch(encodeURI(url), fetchConfig).then(status).then(json).then(result => {
76
76
  setSystemImage(data);
77
77
  props.systemSignaturesChangeHandler(data);
78
78
  }).catch(e => {
79
79
  // TODO : Display error message
80
80
  if (e.code === 401) {
81
- _ApplicationContext.default.clear();
81
+ _ApplicationManager.default.clear();
82
82
 
83
- _ApplicationContext.default.getApplicationHistory().push('/login');
83
+ _ApplicationManager.default.getApplicationHistory().push('/login');
84
84
  }
85
85
  }));
86
86
  }
@@ -15,7 +15,7 @@ var _core = require("@material-ui/core");
15
15
 
16
16
  var _Button = _interopRequireDefault(require("@material-ui/core/Button"));
17
17
 
18
- var _ApplicationContext = _interopRequireDefault(require("../../ApplicationContext"));
18
+ var _ApplicationManager = _interopRequireDefault(require("../../ApplicationManager"));
19
19
 
20
20
  var _reactPromiseTracker = require("react-promise-tracker");
21
21
 
@@ -157,7 +157,7 @@ const SignatureTemplateDesigner = /*#__PURE__*/_react.default.memo( /*#__PURE__*
157
157
 
158
158
  _Observable.default.addSubscriptions(parsedConfig.eventHandlingConfig, props.handle, props.viewId);
159
159
 
160
- _Observable.default.addSystemSubscriptions(parsedConfig);
160
+ _Observable.default.addSystemSubscriptions(props.viewId, parsedConfig);
161
161
  }, []);
162
162
 
163
163
  const setup = () => {
@@ -219,7 +219,7 @@ const SignatureTemplateDesigner = /*#__PURE__*/_react.default.memo( /*#__PURE__*
219
219
  return true;
220
220
  } else {
221
221
  if (!_Utils.default.isNull(actionConfig) && !_Utils.default.isNull(actionConfig.value)) {
222
- let value = _ApplicationContext.default.isExpression(actionConfig.value) ? _ApplicationContext.default.resolveExpressionValue(actionConfig.value) : actionConfig.value;
222
+ let value = _ApplicationManager.default.isExpression(actionConfig.value) ? _ApplicationManager.default.resolveExpressionValue(actionConfig.value) : actionConfig.value;
223
223
  setValue(value);
224
224
 
225
225
  if (!_Utils.default.isNull(value)) {
@@ -325,15 +325,15 @@ const SignatureTemplateDesigner = /*#__PURE__*/_react.default.memo( /*#__PURE__*
325
325
  },
326
326
  body: data
327
327
  };
328
- let url = location + _ApplicationContext.default.getContextRoot() + props.config.documentConverterUrl;
328
+ let url = location + _ApplicationManager.default.getContextRoot() + props.config.documentConverterUrl;
329
329
  (0, _reactPromiseTracker.trackPromise)(fetch(encodeURI(url), fetchConfig).then(status).then(json).then(data => {
330
330
  setTemplateDoc(data);
331
331
  setFile(null);
332
332
  }).catch(e => {
333
333
  if (e.code === 401) {
334
- _ApplicationContext.default.clear();
334
+ _ApplicationManager.default.clear();
335
335
 
336
- _ApplicationContext.default.getApplicationHistory().push('/login');
336
+ _ApplicationManager.default.getApplicationHistory().push('/login');
337
337
  }
338
338
  }));
339
339
  };
@@ -19,7 +19,7 @@ var _SignalGraphActionHandler = _interopRequireDefault(require("./SignalGraphAct
19
19
 
20
20
  var _Utils = _interopRequireDefault(require("../Utils"));
21
21
 
22
- var _ApplicationContext = _interopRequireDefault(require("../ApplicationContext"));
22
+ var _ApplicationManager = _interopRequireDefault(require("../ApplicationManager"));
23
23
 
24
24
  var _DynamicJS = _interopRequireDefault(require("../DynamicJS"));
25
25
 
@@ -31,7 +31,7 @@ class ActionHandlers {
31
31
  constructor() {
32
32
  _defineProperty(this, "confirmAction", message => {
33
33
  if (!_Utils.default.isNull(message)) {
34
- _ApplicationContext.default.openConfirmDialog(message);
34
+ _ApplicationManager.default.openConfirmDialog(message);
35
35
 
36
36
  return false;
37
37
  }
@@ -79,7 +79,7 @@ class ActionHandlers {
79
79
 
80
80
  if (shouldRun) {
81
81
  if (!_Utils.default.isNull(message)) {
82
- _ApplicationContext.default.openConfirmDialog(message, result => {
82
+ _ApplicationManager.default.openConfirmDialog(message, result => {
83
83
  if (result === true) {
84
84
  actionHandler.execute(action, be, component, viewId);
85
85
  }
@@ -11,7 +11,7 @@ var _Utils = _interopRequireDefault(require("../Utils"));
11
11
 
12
12
  var _EventListener = _interopRequireDefault(require("./EventListener"));
13
13
 
14
- var _ApplicationContext = _interopRequireWildcard(require("../ApplicationContext"));
14
+ var _ApplicationManager = _interopRequireWildcard(require("../ApplicationManager"));
15
15
 
16
16
  var _DynamicJS = require("../DynamicJS");
17
17
 
@@ -27,6 +27,8 @@ class Observable {
27
27
  constructor() {
28
28
  _defineProperty(this, "addSubscription", subscription => this.subscriptions.push(subscription));
29
29
 
30
+ _defineProperty(this, "addApplicationContextSubscription", subscription => this.applicationContextSubscription.push(subscription));
31
+
30
32
  _defineProperty(this, "addSubscriptions", (eventHandlingConfig, componentHandle, viewId) => {
31
33
  if (!_Utils.default.isNull(eventHandlingConfig)) {
32
34
  let subscriptions = eventHandlingConfig.subscriptions;
@@ -37,14 +39,14 @@ class Observable {
37
39
  }
38
40
  });
39
41
 
40
- _defineProperty(this, "addSystemSubscriptions", config => {
42
+ _defineProperty(this, "addSystemSubscriptions", (viewId, config) => {
41
43
  if (!_Utils.default.isNull(config.disabled) && typeof config.disabled === 'string') {
42
44
  let matches = config.disabled.match(_DynamicJS.TEMPLATE_REGEX);
43
45
 
44
46
  if (!_Utils.default.isNull(matches)) {
45
47
  for (const match of matches) {
46
- let component = match.replace("@#{", "").replace("}", "");
47
- this.addSystemGeneratedSubscription(component, config.id);
48
+ let component = match.replace('@#{', '').replace('}', '');
49
+ this.addSystemGeneratedSubscription(viewId, component, config.id);
48
50
  }
49
51
  }
50
52
  }
@@ -54,8 +56,8 @@ class Observable {
54
56
 
55
57
  if (!_Utils.default.isNull(matches)) {
56
58
  for (const match of matches) {
57
- let component = match.replace("@#{", "").replace("}", "");
58
- this.addSystemGeneratedSubscription(component, config.id);
59
+ let component = match.replace('@#{', '').replace('}', '');
60
+ this.addSystemGeneratedSubscription(viewId, component, config.id);
59
61
  }
60
62
  }
61
63
  }
@@ -65,20 +67,28 @@ class Observable {
65
67
 
66
68
  if (!_Utils.default.isNull(matches)) {
67
69
  for (const match of matches) {
68
- let component = match.replace("@#{", "").replace("}", "");
69
- this.addSystemGeneratedSubscription(component, config.id);
70
+ let component = match.replace('@#{', '').replace('}', '');
71
+ this.addSystemGeneratedSubscription(viewId, component, config.id);
70
72
  }
71
73
  }
72
74
  }
73
75
  });
74
76
 
77
+ _defineProperty(this, "removeApplicationContextSubscriptions", id => {
78
+ let index = this.applicationContextSubscription.findIndex(sub => sub.handler.id === id);
79
+
80
+ if (index >= 0) {
81
+ this.applicationContextSubscription.splice(index, 1);
82
+ }
83
+ });
84
+
75
85
  _defineProperty(this, "processSystemGeneratedSubscriptions", componentId => {
76
- let component = _ApplicationContext.default.resolveComponentApi(componentId);
86
+ let component = _ApplicationManager.default.resolveComponentApi(componentId);
77
87
 
78
88
  if (!_Utils.default.isNull(component)) {
79
89
  for (const subscription of this.systemGeneratedSubscriptions) {
80
90
  if (subscription.publisher === componentId) {
81
- let component = _ApplicationContext.default.resolveComponentApi(subscription.subscriber);
91
+ let component = _ApplicationManager.default.resolveComponentApi(subscription.subscriber);
82
92
 
83
93
  if (!_Utils.default.isNull(component)) {
84
94
  if (!_Utils.default.isNull(subscription.callback)) {
@@ -92,13 +102,13 @@ class Observable {
92
102
  }
93
103
  });
94
104
 
95
- _defineProperty(this, "addSystemGeneratedSubscription", (publisher, subscriber, callback) => {
105
+ _defineProperty(this, "addSystemGeneratedSubscription", (viewId, publisher, subscriber, callback) => {
96
106
  let found = false;
97
107
 
98
- let currentViewid = _ApplicationContext.default.getCurrentView().config.id;
108
+ let currentViewId = _ApplicationManager.default.getView(viewId).config.id;
99
109
 
100
110
  for (const systemGeneratedSubscription of this.systemGeneratedSubscriptions) {
101
- if (publisher === systemGeneratedSubscription.publisher && subscriber === systemGeneratedSubscription.subscriber && currentViewid === systemGeneratedSubscription.viewId) {
111
+ if (publisher === systemGeneratedSubscription.publisher && subscriber === systemGeneratedSubscription.subscriber && currentViewId === systemGeneratedSubscription.viewId) {
102
112
  found = true;
103
113
  }
104
114
  }
@@ -108,13 +118,14 @@ class Observable {
108
118
  subscription.publisher = publisher;
109
119
  subscription.subscriber = subscriber;
110
120
  subscription.callback = callback;
111
- subscription.viewId = currentViewid;
121
+ subscription.viewId = currentViewId;
112
122
  this.systemGeneratedSubscriptions.push(subscription);
113
123
  }
114
124
  });
115
125
 
116
126
  if (!Observable.instance) {
117
127
  this.subscriptions = [];
128
+ this.applicationContextSubscription = [];
118
129
  this.systemGeneratedSubscriptions = [];
119
130
  Observable.instance = this;
120
131
  }
@@ -128,6 +139,11 @@ class Observable {
128
139
  */
129
140
 
130
141
 
142
+ async emitContextChangeEvent(context, newValues) {
143
+ for (const applicationContextSubscription of this.applicationContextSubscription) {
144
+ applicationContextSubscription.handler.onContextChange(context, newValues);
145
+ }
146
+ }
131
147
  /**
132
148
  * Fires an event.
133
149
  *
@@ -135,6 +151,8 @@ class Observable {
135
151
  * @param be the base event
136
152
  * @return false if any subscriptions cancel the event.
137
153
  */
154
+
155
+
138
156
  async fireEvent(eventType, be) {
139
157
  // Components could be unloading on the cases where screens are busy closing,
140
158
  // meaning the "current" object may be nullified, so we need the null check
@@ -147,7 +165,7 @@ class Observable {
147
165
 
148
166
  if (!_Utils.default.isNull(sourceId)) {
149
167
  for (const subscription of this.subscriptions) {
150
- if ((subscription.getViewId() === viewId || _ApplicationContext.SYSTEM_EVENT === viewId) && subscription.getPublisher() === sourceId && subscription.getEventType() === eventType) {
168
+ if ((subscription.getViewId() === viewId || _ApplicationManager.SYSTEM_EVENT === viewId) && subscription.getPublisher() === sourceId && subscription.getEventType() === eventType) {
151
169
  if (!_Utils.default.isNull(subscription.getActions())) {
152
170
  for (let j = 0; j < subscription.getActions().length; j++) {
153
171
  let action = subscription.getActions()[j];
@@ -9,7 +9,7 @@ var _react = _interopRequireDefault(require("react"));
9
9
 
10
10
  var _RestUtils = require("../RestUtils");
11
11
 
12
- var _ApplicationContext = _interopRequireDefault(require("../ApplicationContext"));
12
+ var _ApplicationManager = _interopRequireDefault(require("../ApplicationManager"));
13
13
 
14
14
  var _Utils = _interopRequireDefault(require("../Utils"));
15
15
 
@@ -39,7 +39,7 @@ class RouteActionHandler {
39
39
  //String url = webUrl + "?version=1.0" + (viewPath != null ? "&id=" + URL.encodeQueryString(viewPath) : "")
40
40
  // + (viewPathRequestDto != null ? "&serviceRequest=" + URL.encodeQueryString(requestDtoWriter.write(viewPathRequestDto)) : "")
41
41
  // + (portalCurrentOrg != null ? "&profile=" + portalCurrentOrg : "");
42
- _ApplicationContext.default.enableFormMarkers(false);
42
+ _ApplicationManager.default.enableFormMarkers(false);
43
43
 
44
44
  let forward = true;
45
45
  let path = null;
@@ -50,17 +50,18 @@ class RouteActionHandler {
50
50
  if (!_Utils.default.isNull(actionConfig.pathEvaluator)) {
51
51
  path = _DynamicJS.default.executeScriptObject(currentViewId + 'ViewEvaluator_' + event.source.id, actionConfig.pathEvaluator);
52
52
  } else {
53
- path = _ApplicationContext.default.isExpression(actionConfig.path) ? _ApplicationContext.default.resolveExpressionValue(actionConfig.path, event.data) : actionConfig.path;
53
+ path = _ApplicationManager.default.isExpression(actionConfig.path) ? _ApplicationManager.default.resolveExpressionValue(actionConfig.path, event.data) : actionConfig.path;
54
54
 
55
- if ('@#{history.back}' === actionConfig.path && _ApplicationContext.default.graphs.length === 0) {
56
- let historyElement = _ApplicationContext.default.getPreviousHistoryElement();
55
+ if ('@#{history.back}' === actionConfig.path && _ApplicationManager.default.graphs.length === 0) {
56
+ let historyElement = _ApplicationManager.default.getPreviousHistoryElement();
57
57
 
58
58
  if (historyElement === null) {
59
- console.error('Invalid path. Cannot got back in history');
59
+ console.error('Invalid path. Cannot go back in history');
60
60
  return;
61
61
  }
62
62
 
63
63
  path = historyElement.path;
64
+ isParent = historyElement.parent;
64
65
  forward = false;
65
66
  }
66
67
  }
@@ -71,7 +72,7 @@ class RouteActionHandler {
71
72
  for (let i = 0; i < actionConfig.parameters.length; i++) {
72
73
  let parameter = actionConfig.parameters[i];
73
74
 
74
- let parameterValue = _ApplicationContext.default.resolveParameterValue(parameter, event.data);
75
+ let parameterValue = _ApplicationManager.default.resolveParameterValue(parameter, event.data);
75
76
 
76
77
  let validator = parameter.validator;
77
78
 
@@ -88,17 +89,27 @@ class RouteActionHandler {
88
89
  }
89
90
  }
90
91
 
91
- if ('@#{history.back}' === actionConfig.path && _ApplicationContext.default.graphs.length > 0) {
92
- _ApplicationContext.default.removeLoadedGraph(true);
92
+ let currentGraph = _ApplicationManager.default.graphs.length > 0 ? _ApplicationManager.default.graphs[_ApplicationManager.default.graphs.length - 1] : null;
93
+
94
+ if ('@#{home}' === actionConfig.path) {
95
+ _ApplicationManager.default.navigate('/view/unload');
96
+
97
+ _ApplicationManager.default.navigate('/view/dashboard');
98
+ } else if ('@#{history.back}' === actionConfig.path && currentGraph) {
99
+ if (isWindow && currentGraph.config.isWindow || !isWindow && !currentGraph.config.isWindow) {
100
+ _ApplicationManager.default.removeLoadedGraph(true);
101
+ }
93
102
  } else {
94
- let url = location + _ApplicationContext.default.getContextRoot() + _ApplicationContext.default.getUIConfigPath() + '/view/get?version=1.0&id=' + path;
103
+ let url = location + _ApplicationManager.default.getContextRoot() + _ApplicationManager.default.getUIConfigPath() + '/view/get?version=1.0&id=' + path;
95
104
  (0, _RestUtils.sendRequest)(url, data => {
96
- if (isParent) {
97
- _ApplicationContext.default.removeLoadedGraph(false);
105
+ if (isParent && currentGraph) {
106
+ if (isWindow && currentGraph.config.isWindow || !isWindow && !currentGraph.config.isWindow) {
107
+ _ApplicationManager.default.removeLoadedGraph(false);
108
+ }
98
109
  }
99
110
 
100
111
  if (data.type === 'view') {
101
- let currentView = _ApplicationContext.default.getCurrentView();
112
+ let currentView = isWindow ? _ApplicationManager.default.getTopWindowView() : _ApplicationManager.default.getTopAnchorView();
102
113
 
103
114
  if (_Utils.default.isNull(currentView) || !currentView.popUp) {
104
115
  let view = {};
@@ -111,6 +122,7 @@ class RouteActionHandler {
111
122
  view.parent = isParent;
112
123
  view.popUp = isPopup;
113
124
  view.window = isWindow;
125
+ view.config.window = isWindow;
114
126
  view.handle = {
115
127
  api: {
116
128
  get id() {
@@ -139,30 +151,27 @@ class RouteActionHandler {
139
151
  }
140
152
  };
141
153
 
142
- _ApplicationContext.default.addView(view, path, forward); // None-existing route to ensure that the current view unloads
154
+ _ApplicationManager.default.addView(view, path, forward); // None-existing route to ensure that the current view unloads
143
155
 
144
156
 
145
157
  if (_Utils.default.isNull(actionConfig.popUp) || actionConfig.popUp === false) {
146
- console.log("\n\n\n\n\nLOADED VIEW, ", view);
147
-
148
- _ApplicationContext.default.getViewPortHistory().push('/switch');
158
+ if (!isWindow) {
159
+ _ApplicationManager.default.navigate('/view/unload');
149
160
 
150
- _ApplicationContext.default.getViewPortHistory().push('/view/' + data.id);
161
+ _ApplicationManager.default.navigate('/view/' + data.id);
162
+ }
151
163
  }
152
164
  } else {
153
- _ApplicationContext.default.closeCurrentView(false);
154
-
155
- currentView = _ApplicationContext.default.getCurrentView();
156
-
157
- if (currentView) {
158
- currentView.handle.api.updateModel(parameterValues);
159
- let event = new _Event.default(currentView.handle, currentView.config.id, null);
160
-
161
- _Observable.default.fireEvent(_EventType.default.COMPONENT_LOAD, event);
162
- }
165
+ /*applicationManager.closeCurrentView(false);
166
+ currentView = applicationManager.getCurrentView();
167
+ if (currentView) {
168
+ currentView.handle.api.updateModel(parameterValues);
169
+ let event = new Event(currentView.handle, currentView.config.id, null);
170
+ eventManager.fireEvent(EventType.COMPONENT_LOAD, event);
171
+ }*/
163
172
  }
164
173
  } else if (data.type === 'graph') {
165
- _ApplicationContext.default.loadGraph(isParent, isPopup, data, parameterValues);
174
+ _ApplicationManager.default.loadGraph(isParent, isPopup, isWindow, data, parameterValues);
166
175
  }
167
176
  }, e => {
168
177
  console.error(e);
@@ -33,9 +33,11 @@ class ServiceCallActionHandler {
33
33
  if (!_Utils.default.isNull(actionConfig.postScript)) {
34
34
  try {
35
35
  let valuesMap = {};
36
- valuesMap.response = result.data;
36
+ valuesMap.response = result.data ? result.data : result;
37
37
 
38
- _DynamicJS.default.executeScriptObject('postScript_' + currentViewId + '_' + handle.getId(), actionConfig.postScript, handle.getId(), valuesMap);
38
+ _DynamicJS.default.executeScriptObject('postScript_' + currentViewId + '_' + handle.api.id, actionConfig.postScript, handle.api.id, valuesMap, {
39
+ data: result.data ? result.data : result
40
+ });
39
41
  } catch (e) {
40
42
  console.error(e);
41
43
  }
@@ -9,7 +9,7 @@ var _react = _interopRequireDefault(require("react"));
9
9
 
10
10
  var _Utils = _interopRequireDefault(require("./../Utils"));
11
11
 
12
- var _ApplicationContext = _interopRequireDefault(require("../ApplicationContext"));
12
+ var _ApplicationManager = _interopRequireDefault(require("../ApplicationManager"));
13
13
 
14
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
15
 
@@ -23,7 +23,7 @@ class SignalGraphActionHandler {
23
23
  }
24
24
 
25
25
  execute(actionConfig, event, component, currentViewId) {
26
- _ApplicationContext.default.signalGraph(actionConfig.graphId, event);
26
+ _ApplicationManager.default.signalGraph(actionConfig.graphId, event);
27
27
  }
28
28
 
29
29
  }