@wavemaker/react-runtime 11.14.1-rc.241 → 11.14.2-1.6423
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/actions/navigation-action.js +5 -3
- package/actions/notification-action.js +6 -3
- package/components/basic/anchor/index.js +6 -7
- package/components/basic/label/index.js +2 -2
- package/components/basic/search/index.js +7 -3
- package/components/chart/components/barColumnChart/index.js +2 -4
- package/components/chart/components/pieDonutChart/index.js +3 -1
- package/components/chart/hooks/useBarYAxisExtras.js +52 -0
- package/components/chart/hooks/useXAxisConfig.js +98 -0
- package/components/chart/index.js +72 -39
- package/components/chart/utils.js +23 -12
- package/components/container/index.js +6 -7
- package/components/container/panel/components/panel-header/index.js +3 -2
- package/components/container/panel/index.js +13 -9
- package/components/container/tabs/index.js +1 -0
- package/components/container/tabs/tab-pane/index.js +39 -3
- package/components/container/wizard/index.js +187 -57
- package/components/container/wizard/utils.js +1 -1
- package/components/container/wizard/wizard-action/index.js +9 -4
- package/components/container/wizard/wizard-step/index.js +21 -8
- package/components/data/form/base-form/index.js +51 -11
- package/components/data/form/form-controller/withFormController.js +7 -10
- package/components/data/list/components/GroupedListItems.js +5 -1
- package/components/data/list/components/ListItemWithTemplate.js +4 -1
- package/components/data/list/hooks/useListEffects.js +34 -14
- package/components/data/list/hooks/useListEventHandlers.js +18 -2
- package/components/data/list/hooks/useListState.js +15 -2
- package/components/data/list/index.js +1 -0
- package/components/data/list/utils/list-helpers.js +3 -5
- package/components/data/list/utils/list-widget-methods.js +1 -1
- package/components/data/live-filter/index.js +6 -5
- package/components/data/live-form/index.js +24 -14
- package/components/data/table/components/TableBody.js +5 -21
- package/components/data/table/components/TableHeader.js +5 -1
- package/components/data/table/index.js +21 -5
- package/components/data/utils/field-data-utils.js +1 -1
- package/components/dialogs/index.js +14 -16
- package/components/input/currency/index.js +11 -7
- package/components/input/default/checkbox/index.js +2 -3
- package/components/input/default/checkboxset/index.js +2 -22
- package/components/input/default/radioset/index.js +5 -4
- package/components/input/epoch/datetime/index.js +6 -2
- package/components/input/epoch/time/index.js +2 -1
- package/components/input/number/index.js +2 -2
- package/components/input/text/util.js +2 -0
- package/components/input/textarea/index.js +22 -24
- package/components/layout/leftnav/index.js +1 -1
- package/components/navbar/nav/index.js +97 -7
- package/components/navbar/nav-item/index.js +5 -2
- package/components/navigation/menu/index.js +73 -12
- package/components/navigation/popover/index.js +2 -0
- package/components/page/error-boundary/index.js +1 -0
- package/components/prefab/container/index.js +10 -3
- package/context/LocalizationProvider.js +1 -0
- package/context/PrefabContext.js +138 -13
- package/context/WidgetProvider.js +2 -2
- package/core/constants/events.js +12 -6
- package/core/constants/index.js +6 -11
- package/core/formatter/number-formatters.js +1 -1
- package/core/proxy-service.js +72 -36
- package/core/util/utils.js +23 -4
- package/higherOrder/BaseApp.js +60 -18
- package/higherOrder/BasePage.js +99 -77
- package/higherOrder/BasePrefab.js +13 -5
- package/higherOrder/withBaseWrapper.js +3 -3
- package/hooks/useDataSourceSubscription.js +1 -1
- package/hooks/useHttp.js +20 -13
- package/mui-config/theme.js +3 -0
- package/package-lock.json +781 -669
- package/package.json +3 -3
- package/store/index.js +5 -1
- package/utils/lib-error-skipper.js +196 -0
- package/variables/service-variable.js +17 -14
package/core/proxy-service.js
CHANGED
|
@@ -28,8 +28,8 @@ var createArrayProxy = function createArrayProxy(array, widgetName, propName, se
|
|
|
28
28
|
return array;
|
|
29
29
|
}
|
|
30
30
|
var arrayProxy = new Proxy(array, {
|
|
31
|
-
get: function get(target, prop) {
|
|
32
|
-
var value = target
|
|
31
|
+
get: function get(target, prop, receiver) {
|
|
32
|
+
var value = Reflect.get(target, prop, receiver);
|
|
33
33
|
|
|
34
34
|
// If it's a mutating method, wrap it to trigger updates
|
|
35
35
|
if (typeof prop === "string" && MUTATING_ARRAY_METHODS.includes(prop) && typeof value === "function") {
|
|
@@ -50,8 +50,8 @@ var createArrayProxy = function createArrayProxy(array, widgetName, propName, se
|
|
|
50
50
|
}
|
|
51
51
|
return value;
|
|
52
52
|
},
|
|
53
|
-
set: function set(target, prop, value) {
|
|
54
|
-
var result = Reflect.set(target, prop, value);
|
|
53
|
+
set: function set(target, prop, value, receiver) {
|
|
54
|
+
var result = Reflect.set(target, prop, value, receiver);
|
|
55
55
|
|
|
56
56
|
// Trigger update for index assignments (arr[0] = value)
|
|
57
57
|
if (typeof prop === "string" && /^\d+$/.test(prop)) {
|
|
@@ -74,8 +74,8 @@ var createStateArrayProxy = function createStateArrayProxy(array, path, propName
|
|
|
74
74
|
return array;
|
|
75
75
|
}
|
|
76
76
|
var arrayProxy = new Proxy(array, {
|
|
77
|
-
get: function get(target, prop) {
|
|
78
|
-
var value = target
|
|
77
|
+
get: function get(target, prop, receiver) {
|
|
78
|
+
var value = Reflect.get(target, prop, receiver);
|
|
79
79
|
|
|
80
80
|
// If it's a mutating method, wrap it to trigger updates
|
|
81
81
|
if (typeof prop === "string" && MUTATING_ARRAY_METHODS.includes(prop) && typeof value === "function") {
|
|
@@ -104,8 +104,8 @@ var createStateArrayProxy = function createStateArrayProxy(array, path, propName
|
|
|
104
104
|
}
|
|
105
105
|
return value;
|
|
106
106
|
},
|
|
107
|
-
set: function set(target, prop, value) {
|
|
108
|
-
var result = Reflect.set(target, prop, value);
|
|
107
|
+
set: function set(target, prop, value, receiver) {
|
|
108
|
+
var result = Reflect.set(target, prop, value, receiver);
|
|
109
109
|
|
|
110
110
|
// Trigger update for index assignments (arr[0] = value)
|
|
111
111
|
if (typeof prop === "string" && /^\d+$/.test(prop)) {
|
|
@@ -135,14 +135,15 @@ var createWidgetProxy = exports.createWidgetProxy = function createWidgetProxy(w
|
|
|
135
135
|
return widget;
|
|
136
136
|
}
|
|
137
137
|
var proxy = new Proxy(widget, {
|
|
138
|
-
set: function set(target, prop, value) {
|
|
138
|
+
set: function set(target, prop, value, receiver) {
|
|
139
139
|
// Ignore internal properties
|
|
140
140
|
if ((0, _typeof2["default"])(prop) === "symbol" || prop === "prototype") {
|
|
141
|
-
return
|
|
141
|
+
return Reflect.set(target, prop, value, receiver);
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
// Skip if value hasn't changed
|
|
145
|
-
|
|
145
|
+
var currentVal = Reflect.get(target, prop, receiver);
|
|
146
|
+
if (currentVal === value) {
|
|
146
147
|
return true;
|
|
147
148
|
}
|
|
148
149
|
|
|
@@ -151,7 +152,7 @@ var createWidgetProxy = exports.createWidgetProxy = function createWidgetProxy(w
|
|
|
151
152
|
var widgetId = widget["data-widget-id"];
|
|
152
153
|
(0, _scriptRegistry.trackOverriddenProps)(widgetName, prop, value, widgetId);
|
|
153
154
|
}
|
|
154
|
-
target
|
|
155
|
+
Reflect.set(target, prop, value, receiver);
|
|
155
156
|
setPageContext(function (prevContext) {
|
|
156
157
|
// Check if widget-id matches before updating context
|
|
157
158
|
var currentWidget = prevContext.Widgets[widgetName];
|
|
@@ -173,9 +174,9 @@ var createWidgetProxy = exports.createWidgetProxy = function createWidgetProxy(w
|
|
|
173
174
|
});
|
|
174
175
|
return true;
|
|
175
176
|
},
|
|
176
|
-
get: function get(target, prop) {
|
|
177
|
+
get: function get(target, prop, receiver) {
|
|
177
178
|
if ((0, _typeof2["default"])(prop) === "symbol" || prop === "prototype") {
|
|
178
|
-
return
|
|
179
|
+
return Reflect.get(target, prop, receiver);
|
|
179
180
|
}
|
|
180
181
|
|
|
181
182
|
// setProperty method to set properties dynamically
|
|
@@ -188,7 +189,7 @@ var createWidgetProxy = exports.createWidgetProxy = function createWidgetProxy(w
|
|
|
188
189
|
|
|
189
190
|
// Special getter for $element - return jQuery-like wrapped element
|
|
190
191
|
if (prop === "$element") {
|
|
191
|
-
var rawElement = target
|
|
192
|
+
var rawElement = Reflect.get(target, prop, receiver);
|
|
192
193
|
if (rawElement) {
|
|
193
194
|
// If already wrapped, return as-is
|
|
194
195
|
if (rawElement.length === 1 && (0, _dom.isDOMElement)(rawElement[0])) {
|
|
@@ -201,17 +202,22 @@ var createWidgetProxy = exports.createWidgetProxy = function createWidgetProxy(w
|
|
|
201
202
|
}
|
|
202
203
|
|
|
203
204
|
// Try to find element in DOM directly
|
|
204
|
-
var
|
|
205
|
-
var element = (0, _widgetObserver.findWidgetElement)(widgetName,
|
|
205
|
+
var _widgetId = widget["data-widget-id"];
|
|
206
|
+
var element = (0, _widgetObserver.findWidgetElement)(widgetName, _widgetId);
|
|
206
207
|
if (element) {
|
|
207
208
|
var wrappedElement = (0, _dom.wrapWithNativeDOM)(element);
|
|
208
|
-
target
|
|
209
|
+
Reflect.defineProperty(target, prop, {
|
|
210
|
+
value: wrappedElement,
|
|
211
|
+
writable: true,
|
|
212
|
+
configurable: true,
|
|
213
|
+
enumerable: false
|
|
214
|
+
});
|
|
209
215
|
return wrappedElement;
|
|
210
216
|
}
|
|
211
217
|
|
|
212
218
|
// Register for future element updates if not found
|
|
213
219
|
if (!target._elementCallbackRegistered) {
|
|
214
|
-
var key =
|
|
220
|
+
var key = _widgetId ? "".concat(widgetName, ":").concat(_widgetId) : widgetName;
|
|
215
221
|
var callbacks = _widgetObserver.widgetElementCallbacks.get(key);
|
|
216
222
|
if (!callbacks) {
|
|
217
223
|
callbacks = new Set();
|
|
@@ -219,14 +225,30 @@ var createWidgetProxy = exports.createWidgetProxy = function createWidgetProxy(w
|
|
|
219
225
|
}
|
|
220
226
|
callbacks.add(function (element) {
|
|
221
227
|
if (element) {
|
|
222
|
-
|
|
228
|
+
var wrapped = (0, _dom.wrapWithNativeDOM)(element);
|
|
229
|
+
Reflect.defineProperty(target, prop, {
|
|
230
|
+
value: wrapped,
|
|
231
|
+
writable: true,
|
|
232
|
+
configurable: true,
|
|
233
|
+
enumerable: false
|
|
234
|
+
});
|
|
223
235
|
}
|
|
224
236
|
});
|
|
225
|
-
target
|
|
237
|
+
Reflect.defineProperty(target, "_elementCallbackRegistered", {
|
|
238
|
+
value: true,
|
|
239
|
+
writable: true,
|
|
240
|
+
configurable: true,
|
|
241
|
+
enumerable: false
|
|
242
|
+
});
|
|
226
243
|
}
|
|
227
244
|
return null;
|
|
228
245
|
}
|
|
229
|
-
var value = target
|
|
246
|
+
var value = Reflect.get(target, prop, receiver);
|
|
247
|
+
var widgetId = widget["data-widget-id"];
|
|
248
|
+
var widgetOverrides = (0, _scriptRegistry.getWidgetOverrides)(widgetName, widgetId);
|
|
249
|
+
if (prop in widgetOverrides) {
|
|
250
|
+
return widgetOverrides[prop];
|
|
251
|
+
}
|
|
230
252
|
|
|
231
253
|
// Return DOM elements directly to preserve their context
|
|
232
254
|
if ((0, _dom.isDOMElement)(value)) {
|
|
@@ -278,7 +300,12 @@ var createPageProxy = exports.createPageProxy = function createPageProxy(target,
|
|
|
278
300
|
if (widget !== originalTarget || Object.keys(widget).length > Object.keys(originalTarget).length) {
|
|
279
301
|
// Copy all properties from widget to originalTarget
|
|
280
302
|
for (var key in widget) {
|
|
281
|
-
originalTarget
|
|
303
|
+
Reflect.defineProperty(originalTarget, key, {
|
|
304
|
+
value: widget[key],
|
|
305
|
+
writable: true,
|
|
306
|
+
configurable: true,
|
|
307
|
+
enumerable: true
|
|
308
|
+
});
|
|
282
309
|
}
|
|
283
310
|
}
|
|
284
311
|
return _proxy;
|
|
@@ -304,9 +331,18 @@ var createPageProxy = exports.createPageProxy = function createPageProxy(target,
|
|
|
304
331
|
var originalTarget = originalTargets.get(proxy);
|
|
305
332
|
|
|
306
333
|
// Only copy changed properties
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
334
|
+
if (widgetValue && (0, _typeof2["default"])(widgetValue) === "object") {
|
|
335
|
+
for (var key in widgetValue) {
|
|
336
|
+
var newVal = widgetValue[key];
|
|
337
|
+
var oldVal = originalTarget[key];
|
|
338
|
+
if (oldVal !== newVal) {
|
|
339
|
+
Reflect.defineProperty(originalTarget, key, {
|
|
340
|
+
value: newVal,
|
|
341
|
+
writable: true,
|
|
342
|
+
configurable: true,
|
|
343
|
+
enumerable: true
|
|
344
|
+
});
|
|
345
|
+
}
|
|
310
346
|
}
|
|
311
347
|
}
|
|
312
348
|
} else if (widgetValue && (0, _typeof2["default"])(widgetValue) === "object") {
|
|
@@ -314,11 +350,6 @@ var createPageProxy = exports.createPageProxy = function createPageProxy(target,
|
|
|
314
350
|
var _proxy2 = createWidgetProxy(widgetValue, widgetName, setPageContext);
|
|
315
351
|
widgetProxies.set(widgetName, _proxy2);
|
|
316
352
|
}
|
|
317
|
-
setPageContext(function (prev) {
|
|
318
|
-
return _objectSpread(_objectSpread({}, prev), {}, {
|
|
319
|
-
Widgets: widgetsTarget
|
|
320
|
-
});
|
|
321
|
-
});
|
|
322
353
|
return true;
|
|
323
354
|
}
|
|
324
355
|
});
|
|
@@ -329,7 +360,8 @@ var createStateProxy = exports.createStateProxy = function createStateProxy(obj)
|
|
|
329
360
|
// Cache for nested proxies
|
|
330
361
|
var nestedProxies = new Map();
|
|
331
362
|
return new Proxy(obj, {
|
|
332
|
-
get: function get(target, prop) {
|
|
363
|
+
get: function get(target, prop, receiver) {
|
|
364
|
+
var _value$constructor;
|
|
333
365
|
if (prop === "eval") {
|
|
334
366
|
return function (fn) {
|
|
335
367
|
var failOnError = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
@@ -352,12 +384,15 @@ var createStateProxy = exports.createStateProxy = function createStateProxy(obj)
|
|
|
352
384
|
if (!(prop in target)) {
|
|
353
385
|
return undefined;
|
|
354
386
|
}
|
|
355
|
-
var value = target
|
|
387
|
+
var value = Reflect.get(target, prop, receiver);
|
|
356
388
|
|
|
357
389
|
// Return primitives directly
|
|
358
390
|
if ((0, _typeof2["default"])(value) !== "object" || value === null) {
|
|
359
391
|
return value;
|
|
360
392
|
}
|
|
393
|
+
if ((value === null || value === void 0 || (_value$constructor = value.constructor) === null || _value$constructor === void 0 ? void 0 : _value$constructor.name) === "ServiceVariable") {
|
|
394
|
+
return value;
|
|
395
|
+
}
|
|
361
396
|
|
|
362
397
|
// Return DOM elements directly without proxying
|
|
363
398
|
if ((0, _dom.isDOMElement)(value)) {
|
|
@@ -379,14 +414,15 @@ var createStateProxy = exports.createStateProxy = function createStateProxy(obj)
|
|
|
379
414
|
nestedProxies.set(prop, nestedProxy);
|
|
380
415
|
return nestedProxy;
|
|
381
416
|
},
|
|
382
|
-
set: function set(target, prop, value) {
|
|
417
|
+
set: function set(target, prop, value, receiver) {
|
|
383
418
|
// Skip if value hasn't changed
|
|
384
|
-
|
|
419
|
+
var currentVal = Reflect.get(target, prop, receiver);
|
|
420
|
+
if (currentVal === value) {
|
|
385
421
|
return true;
|
|
386
422
|
}
|
|
387
423
|
|
|
388
424
|
// Update target directly
|
|
389
|
-
target
|
|
425
|
+
Reflect.set(target, prop, value, receiver);
|
|
390
426
|
|
|
391
427
|
// Clear cached proxy if value is an object (but not an array)
|
|
392
428
|
if ((0, _typeof2["default"])(value) === "object" && value !== null && !Array.isArray(value) && nestedProxies.has(prop)) {
|
package/core/util/utils.js
CHANGED
|
@@ -4,10 +4,11 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.triggerItemAction = exports.openLink = exports.isJQueryError = exports.isInsecureContentRequest = exports.getUrlParams = exports.getRouteNameFromLink = exports.Utils = void 0;
|
|
7
|
+
exports.triggerItemAction = exports.openLink = exports.isJQueryError = exports.isInsecureContentRequest = exports.getUrlParams = exports.getRouteNameFromLink = exports.getItemLink = exports.getCurrentPath = exports.Utils = void 0;
|
|
8
8
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
9
|
var _navigationMiddleware = require("@wavemaker/react-runtime/store/middleware/navigationMiddleware");
|
|
10
10
|
var _constants = require("../constants");
|
|
11
|
+
var _navigation = require("next/navigation");
|
|
11
12
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
12
13
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
13
14
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
@@ -171,13 +172,23 @@ var triggerItemAction = exports.triggerItemAction = function triggerItemAction(i
|
|
|
171
172
|
var routeName = getRouteNameFromLink(originalLink);
|
|
172
173
|
routeName = (0, _constants.hyperLinkMofify)(routeName);
|
|
173
174
|
if (Object.keys(queryParams).length > 0) {
|
|
174
|
-
|
|
175
|
+
// Filter out undefined/null/empty values like Angular router does
|
|
176
|
+
var queryString = Object.entries(queryParams).filter(function (_ref) {
|
|
175
177
|
var _ref2 = (0, _slicedToArray2["default"])(_ref, 2),
|
|
176
|
-
|
|
178
|
+
_ = _ref2[0],
|
|
177
179
|
value = _ref2[1];
|
|
180
|
+
return value !== undefined && value !== null && value !== "";
|
|
181
|
+
}).map(function (_ref3) {
|
|
182
|
+
var _ref4 = (0, _slicedToArray2["default"])(_ref3, 2),
|
|
183
|
+
key = _ref4[0],
|
|
184
|
+
value = _ref4[1];
|
|
178
185
|
return "".concat(key, "=").concat(encodeURIComponent(value));
|
|
179
186
|
}).join("&");
|
|
180
|
-
|
|
187
|
+
if (queryString) {
|
|
188
|
+
router === null || router === void 0 || router.push("".concat(routeName, "?").concat(queryString));
|
|
189
|
+
} else {
|
|
190
|
+
router === null || router === void 0 || router.push(routeName);
|
|
191
|
+
}
|
|
181
192
|
} else {
|
|
182
193
|
router === null || router === void 0 || router.push(routeName);
|
|
183
194
|
}
|
|
@@ -186,4 +197,12 @@ var triggerItemAction = exports.triggerItemAction = function triggerItemAction(i
|
|
|
186
197
|
// For external links, use as-is (don't apply hyperLinkMofify)
|
|
187
198
|
openLink(originalLink, linkTarget);
|
|
188
199
|
}
|
|
200
|
+
};
|
|
201
|
+
var getCurrentPath = exports.getCurrentPath = function getCurrentPath() {
|
|
202
|
+
var path = (0, _navigation.usePathname)();
|
|
203
|
+
return path;
|
|
204
|
+
};
|
|
205
|
+
var getItemLink = exports.getItemLink = function getItemLink(item, props) {
|
|
206
|
+
var linkProperty = props.itemlink || "link";
|
|
207
|
+
return item[linkProperty];
|
|
189
208
|
};
|
package/higherOrder/BaseApp.js
CHANGED
|
@@ -57,12 +57,14 @@ var BaseApp = exports.BaseApp = function BaseApp(WrappedComponent, addAppScript,
|
|
|
57
57
|
}),
|
|
58
58
|
serviceDefinitions: (0, _cloneDeep["default"])((info === null || info === void 0 ? void 0 : info.serviceDefs) || {}),
|
|
59
59
|
notifyApp: notifyApp,
|
|
60
|
+
notify: notify,
|
|
60
61
|
eval: evaluateExpression,
|
|
61
62
|
openActionDialog: openActionDialog,
|
|
62
63
|
executeStartAppOperations: executeStartAppOperations,
|
|
63
64
|
importModule: _helper.importModule,
|
|
64
|
-
Widgets: {}
|
|
65
|
-
|
|
65
|
+
Widgets: {},
|
|
66
|
+
subscribe: subscribe
|
|
67
|
+
}, appInfo)),
|
|
66
68
|
appContext = _useState[0],
|
|
67
69
|
setAppContext = _useState[1];
|
|
68
70
|
var appProxyRef = (0, _react.useRef)(null);
|
|
@@ -71,6 +73,7 @@ var BaseApp = exports.BaseApp = function BaseApp(WrappedComponent, addAppScript,
|
|
|
71
73
|
var isVariablesExecutedRef = (0, _react.useRef)(false);
|
|
72
74
|
var registrationTimeoutRef = (0, _react.useRef)(null);
|
|
73
75
|
var pendingWidgetRegistrations = (0, _react.useRef)({});
|
|
76
|
+
var subscribersRef = (0, _react.useRef)(new Map());
|
|
74
77
|
|
|
75
78
|
// Set up service error listener using EventNotifier (outside useEffect)
|
|
76
79
|
(0, _react.useEffect)(function () {
|
|
@@ -188,21 +191,24 @@ var BaseApp = exports.BaseApp = function BaseApp(WrappedComponent, addAppScript,
|
|
|
188
191
|
_context4.next = 9;
|
|
189
192
|
return Promise.allSettled(variablePromises);
|
|
190
193
|
case 9:
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
+
if (!(appProxyRef.current.onAppVariablesReady && typeof appProxyRef.current.onAppVariablesReady === "function")) {
|
|
195
|
+
_context4.next = 12;
|
|
196
|
+
break;
|
|
194
197
|
}
|
|
195
|
-
_context4.next =
|
|
196
|
-
|
|
198
|
+
_context4.next = 12;
|
|
199
|
+
return appProxyRef.current.onAppVariablesReady();
|
|
197
200
|
case 12:
|
|
198
|
-
_context4.
|
|
201
|
+
_context4.next = 17;
|
|
202
|
+
break;
|
|
203
|
+
case 14:
|
|
204
|
+
_context4.prev = 14;
|
|
199
205
|
_context4.t0 = _context4["catch"](6);
|
|
200
206
|
console.error("Error during app startup operations:", _context4.t0);
|
|
201
|
-
case
|
|
207
|
+
case 17:
|
|
202
208
|
case "end":
|
|
203
209
|
return _context4.stop();
|
|
204
210
|
}
|
|
205
|
-
}, _callee4, null, [[6,
|
|
211
|
+
}, _callee4, null, [[6, 14]]);
|
|
206
212
|
}));
|
|
207
213
|
return _executeStartAppOperations.apply(this, arguments);
|
|
208
214
|
}
|
|
@@ -275,10 +281,13 @@ var BaseApp = exports.BaseApp = function BaseApp(WrappedComponent, addAppScript,
|
|
|
275
281
|
return function executeAppStartup() {
|
|
276
282
|
return _ref2.apply(this, arguments);
|
|
277
283
|
};
|
|
278
|
-
}();
|
|
284
|
+
}();
|
|
279
285
|
_context2.next = 11;
|
|
280
|
-
return
|
|
286
|
+
return executeStartAppOperations();
|
|
281
287
|
case 11:
|
|
288
|
+
_context2.next = 13;
|
|
289
|
+
return executeAppStartup();
|
|
290
|
+
case 13:
|
|
282
291
|
// Initialize DialogService in appstore
|
|
283
292
|
_appstore["default"].DialogService.set(_dialog["default"]);
|
|
284
293
|
|
|
@@ -291,10 +300,10 @@ var BaseApp = exports.BaseApp = function BaseApp(WrappedComponent, addAppScript,
|
|
|
291
300
|
isAppReady: true
|
|
292
301
|
});
|
|
293
302
|
});
|
|
294
|
-
_context2.next =
|
|
303
|
+
_context2.next = 21;
|
|
295
304
|
break;
|
|
296
|
-
case
|
|
297
|
-
_context2.prev =
|
|
305
|
+
case 17:
|
|
306
|
+
_context2.prev = 17;
|
|
298
307
|
_context2.t0 = _context2["catch"](0);
|
|
299
308
|
console.error("Error initializing app:", _context2.t0);
|
|
300
309
|
setAppContext(function (prev) {
|
|
@@ -302,11 +311,11 @@ var BaseApp = exports.BaseApp = function BaseApp(WrappedComponent, addAppScript,
|
|
|
302
311
|
isAppReady: true
|
|
303
312
|
});
|
|
304
313
|
});
|
|
305
|
-
case
|
|
314
|
+
case 21:
|
|
306
315
|
case "end":
|
|
307
316
|
return _context2.stop();
|
|
308
317
|
}
|
|
309
|
-
}, _callee2, null, [[0,
|
|
318
|
+
}, _callee2, null, [[0, 17]]);
|
|
310
319
|
}));
|
|
311
320
|
return function initializeApp() {
|
|
312
321
|
return _ref.apply(this, arguments);
|
|
@@ -329,7 +338,40 @@ var BaseApp = exports.BaseApp = function BaseApp(WrappedComponent, addAppScript,
|
|
|
329
338
|
var _appProxyRef$current2;
|
|
330
339
|
appProxyRef.current.lastActivePage = (_appProxyRef$current2 = appProxyRef.current) === null || _appProxyRef$current2 === void 0 ? void 0 : _appProxyRef$current2.activePageName;
|
|
331
340
|
appProxyRef.current.activePageName = pageName;
|
|
332
|
-
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
function subscribe(eventName, callback) {
|
|
344
|
+
if (!eventName || typeof callback !== "function") {
|
|
345
|
+
return function () {};
|
|
346
|
+
}
|
|
347
|
+
if (!subscribersRef.current.has(eventName)) {
|
|
348
|
+
subscribersRef.current.set(eventName, new Set());
|
|
349
|
+
}
|
|
350
|
+
var subscribers = subscribersRef.current.get(eventName);
|
|
351
|
+
subscribers.add(callback);
|
|
352
|
+
return function () {
|
|
353
|
+
var subs = subscribersRef.current.get(eventName);
|
|
354
|
+
if (subs) {
|
|
355
|
+
subs["delete"](callback);
|
|
356
|
+
if (subs.size === 0) {
|
|
357
|
+
subscribersRef.current["delete"](eventName);
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
function notify(eventName, value) {
|
|
363
|
+
if (!eventName) {
|
|
364
|
+
return;
|
|
365
|
+
}
|
|
366
|
+
var subscribers = subscribersRef.current.get(eventName);
|
|
367
|
+
if (subscribers && subscribers.size > 0) {
|
|
368
|
+
subscribers.forEach(function (callback) {
|
|
369
|
+
try {
|
|
370
|
+
callback(value);
|
|
371
|
+
} catch (error) {
|
|
372
|
+
console.error("Error in subscriber callback for ".concat(eventName, ":"), error);
|
|
373
|
+
}
|
|
374
|
+
});
|
|
333
375
|
}
|
|
334
376
|
}
|
|
335
377
|
// Change locale function
|