@wavemaker/react-runtime 11.14.3-rc.6401 → 11.14.4-rc.647538

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 (73) hide show
  1. package/actions/navigation-action.js +3 -5
  2. package/actions/notification-action.js +3 -6
  3. package/components/basic/anchor/index.js +7 -6
  4. package/components/basic/label/index.js +2 -2
  5. package/components/basic/search/index.js +3 -7
  6. package/components/chart/components/barColumnChart/index.js +4 -2
  7. package/components/chart/components/pieDonutChart/index.js +1 -3
  8. package/components/chart/index.js +39 -72
  9. package/components/chart/utils.js +12 -23
  10. package/components/container/index.js +7 -6
  11. package/components/container/panel/components/panel-header/index.js +2 -3
  12. package/components/container/panel/index.js +9 -13
  13. package/components/container/tabs/index.js +0 -1
  14. package/components/container/tabs/tab-pane/index.js +3 -39
  15. package/components/container/wizard/index.js +57 -187
  16. package/components/container/wizard/utils.js +1 -1
  17. package/components/container/wizard/wizard-action/index.js +4 -9
  18. package/components/container/wizard/wizard-step/index.js +8 -21
  19. package/components/data/form/base-form/index.js +11 -51
  20. package/components/data/form/form-controller/withFormController.js +10 -7
  21. package/components/data/list/components/GroupedListItems.js +1 -5
  22. package/components/data/list/components/ListItemWithTemplate.js +1 -4
  23. package/components/data/list/hooks/useListEffects.js +14 -34
  24. package/components/data/list/hooks/useListEventHandlers.js +2 -18
  25. package/components/data/list/hooks/useListState.js +2 -15
  26. package/components/data/list/index.js +0 -1
  27. package/components/data/list/utils/list-helpers.js +5 -3
  28. package/components/data/list/utils/list-widget-methods.js +1 -1
  29. package/components/data/live-filter/index.js +5 -6
  30. package/components/data/live-form/index.js +14 -24
  31. package/components/data/table/components/TableBody.js +21 -5
  32. package/components/data/table/components/TableHeader.js +1 -5
  33. package/components/data/table/index.js +5 -21
  34. package/components/data/utils/field-data-utils.js +1 -1
  35. package/components/dialogs/index.js +16 -14
  36. package/components/input/currency/index.js +7 -11
  37. package/components/input/default/checkbox/index.js +3 -2
  38. package/components/input/default/checkboxset/index.js +22 -2
  39. package/components/input/default/radioset/index.js +4 -5
  40. package/components/input/epoch/datetime/index.js +2 -6
  41. package/components/input/epoch/time/index.js +1 -2
  42. package/components/input/number/index.js +2 -2
  43. package/components/input/text/util.js +0 -2
  44. package/components/input/textarea/index.js +24 -22
  45. package/components/layout/leftnav/index.js +1 -1
  46. package/components/navbar/nav/index.js +7 -97
  47. package/components/navbar/nav-item/index.js +2 -5
  48. package/components/navigation/menu/index.js +12 -73
  49. package/components/navigation/popover/index.js +0 -2
  50. package/components/page/error-boundary/index.js +0 -1
  51. package/components/prefab/container/index.js +3 -10
  52. package/context/LocalizationProvider.js +0 -1
  53. package/context/PrefabContext.js +13 -138
  54. package/context/WidgetProvider.js +2 -2
  55. package/core/constants/events.js +6 -12
  56. package/core/constants/index.js +11 -6
  57. package/core/formatter/number-formatters.js +1 -1
  58. package/core/proxy-service.js +36 -72
  59. package/core/util/utils.js +4 -23
  60. package/higherOrder/BaseApp.js +18 -60
  61. package/higherOrder/BasePage.js +77 -99
  62. package/higherOrder/BasePrefab.js +5 -13
  63. package/higherOrder/withBaseWrapper.js +3 -3
  64. package/hooks/useDataSourceSubscription.js +1 -1
  65. package/hooks/useHttp.js +13 -20
  66. package/mui-config/theme.js +0 -3
  67. package/package-lock.json +747 -704
  68. package/package.json +3 -3
  69. package/store/index.js +1 -5
  70. package/variables/service-variable.js +14 -17
  71. package/components/chart/hooks/useBarYAxisExtras.js +0 -52
  72. package/components/chart/hooks/useXAxisConfig.js +0 -98
  73. package/utils/lib-error-skipper.js +0 -196
@@ -23,15 +23,11 @@ var _lodash = require("lodash");
23
23
  var _link = _interopRequireDefault(require("next/link"));
24
24
  var _ListItems = require("./components/ListItems");
25
25
  var _utils = require("@wavemaker/react-runtime/core/util/utils");
26
- var _navigation = require("next/navigation");
27
- var _excluded = ["menualign", "menuposition", "menulayout", "menuclass", "linktarget", "iconclass", "type", "animateitems", "disableMenuContext", "showonhover", "panelPosition", "autoclose", "autoopen", "hint", "arialabel", "width", "height", "iconposition", "caption", "shortcutkey", "onClick", "onSelect", "navNodes", "styles", "conditionalstyles", "className", "children", "listener", "name", "resetNavNodes", "nodes$", "dataset", "orderby", "itemlabel", "itemlink", "itemicon", "itemaction", "userrole", "itemchildren", "isactive", "displayValue", "onActionsclick", "dataPath", "isFromNav", "onNavItemActivate"];
26
+ var _excluded = ["menualign", "menuposition", "menulayout", "menuclass", "linktarget", "iconclass", "type", "animateitems", "disableMenuContext", "showonhover", "panelPosition", "autoclose", "autoopen", "hint", "arialabel", "width", "height", "iconposition", "caption", "shortcutkey", "onClick", "onSelect", "navNodes", "styles", "conditionalstyles", "className", "children", "listener", "name", "resetNavNodes", "nodes$", "dataset", "orderby", "itemlabel", "itemlink", "itemicon", "itemaction", "userrole", "itemchildren", "isactive", "displayValue", "onActionsclick", "dataPath"];
28
27
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
29
28
  var __jsx = _react["default"].createElement;
30
29
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
31
30
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
32
- var isPathMatchingLink = function isPathMatchingLink(path, link) {
33
- return new RegExp(link.replace("#", "").replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "i").test(path);
34
- };
35
31
  var hasLinkToCurrentPage = function hasLinkToCurrentPage(nodes, currentPath) {
36
32
  if (!nodes || !Array.isArray(nodes)) return false;
37
33
  return nodes.some(function (node) {
@@ -195,11 +191,8 @@ var WmMenu = /*#__PURE__*/(0, _react.memo)(function (props) {
195
191
  displayValue = props.displayValue,
196
192
  onActionsclick = props.onActionsclick,
197
193
  dataPath = props.dataPath,
198
- _props$isFromNav = props.isFromNav,
199
- isFromNav = _props$isFromNav === void 0 ? false : _props$isFromNav,
200
- onNavItemActivate = props.onNavItemActivate,
201
194
  restProps = (0, _objectWithoutProperties2["default"])(props, _excluded);
202
- var path = (0, _navigation.usePathname)();
195
+
203
196
  // State
204
197
  var _useState2 = (0, _react.useState)(false),
205
198
  open = _useState2[0],
@@ -366,14 +359,9 @@ var WmMenu = /*#__PURE__*/(0, _react.memo)(function (props) {
366
359
  setActiveItem(null);
367
360
  setFocusedIndex(-1);
368
361
  }
369
-
370
- // If menu is from nav, notify nav to activate the nav item when menu button is clicked
371
- if (isFromNav && onNavItemActivate) {
372
- onNavItemActivate();
373
- }
374
- }, [onClick, listener, name, open, isFromNav, onNavItemActivate]);
362
+ }, [onClick, listener, name, open]);
375
363
  var handleMenuItemClick = (0, _react.useCallback)(function (event, item) {
376
- var _item$dataObject, _item$dataObject2, _item$dataObject3;
364
+ var _item$dataObject, _item$dataObject2;
377
365
  var _getNodeProperties = getNodeProperties(item),
378
366
  label = _getNodeProperties.label,
379
367
  icon = _getNodeProperties.icon,
@@ -398,26 +386,20 @@ var WmMenu = /*#__PURE__*/(0, _react.memo)(function (props) {
398
386
  var simplifiedItem = {
399
387
  label: label,
400
388
  dataValue: ((_item$dataObject = item.dataObject) === null || _item$dataObject === void 0 ? void 0 : _item$dataObject.dataValue) || label,
401
- value: ((_item$dataObject2 = item.dataObject) === null || _item$dataObject2 === void 0 ? void 0 : _item$dataObject2.dataValue) || label,
402
389
  icon: icon,
403
390
  link: link,
404
- target: (_item$dataObject3 = item.dataObject) === null || _item$dataObject3 === void 0 ? void 0 : _item$dataObject3.target
391
+ target: (_item$dataObject2 = item.dataObject) === null || _item$dataObject2 === void 0 ? void 0 : _item$dataObject2.target
405
392
  };
406
393
  if (onSelect) {
407
394
  onSelect(event, props, simplifiedItem);
408
395
  }
409
-
410
- // If menu is from nav, notify nav to activate the nav item
411
- if (isFromNav && onNavItemActivate) {
412
- onNavItemActivate();
413
- }
414
396
  if (name && listener !== null && listener !== void 0 && listener.Widgets[name]) {
415
397
  listener.Widgets[name].displayValue = label;
416
398
  }
417
399
  if (listener !== null && listener !== void 0 && listener.onChange) {
418
- listener.onChange(name, {
400
+ listener.onChange(name, _objectSpread(_objectSpread({}, props), {}, {
419
401
  datavalue: label
420
- });
402
+ }));
421
403
  }
422
404
  // Then trigger item action (executes action and/or navigates to link)
423
405
  // Use setTimeout to ensure onSelect navigation completes first, then dataset link navigation happens
@@ -428,8 +410,7 @@ var WmMenu = /*#__PURE__*/(0, _react.memo)(function (props) {
428
410
  setOpen(false);
429
411
  setFocusedIndex(-1);
430
412
  }
431
- onActionsclick === null || onActionsclick === void 0 || onActionsclick(event, item);
432
- }, [flattenedNodes, onSelect, props, name, listener, autoclose, getNodeProperties, isFromNav, onNavItemActivate]);
413
+ }, [flattenedNodes, onSelect, props, name, listener, autoclose, getNodeProperties]);
433
414
 
434
415
  // Keyboard navigation
435
416
  var focusNode = (0, _react.useCallback)(function (index) {
@@ -581,7 +562,6 @@ var WmMenu = /*#__PURE__*/(0, _react.memo)(function (props) {
581
562
  var renderMenuItems = (0, _react.useCallback)(function (nodes) {
582
563
  if (!nodes || !Array.isArray(nodes)) return null;
583
564
  return nodes.map(function (node, index) {
584
- var _value;
585
565
  var _getNodeProperties2 = getNodeProperties(node),
586
566
  label = _getNodeProperties2.label,
587
567
  icon = _getNodeProperties2.icon,
@@ -589,8 +569,6 @@ var WmMenu = /*#__PURE__*/(0, _react.memo)(function (props) {
589
569
  hint = _getNodeProperties2.hint,
590
570
  disabled = _getNodeProperties2.disabled,
591
571
  children = _getNodeProperties2.children;
592
- var nodeValueLink = node === null || node === void 0 || (_value = node.value) === null || _value === void 0 ? void 0 : _value.link;
593
- var isActive = nodeValueLink && typeof nodeValueLink === "string" ? isPathMatchingLink(path, nodeValueLink) : link ? isPathMatchingLink(path, link) : false;
594
572
  var _menuposition$split = menuposition.split(","),
595
573
  _menuposition$split2 = (0, _slicedToArray2["default"])(_menuposition$split, 2),
596
574
  verticalPos = _menuposition$split2[0],
@@ -601,10 +579,7 @@ var WmMenu = /*#__PURE__*/(0, _react.memo)(function (props) {
601
579
  return __jsx(_Box["default"], {
602
580
  component: "li",
603
581
  key: index,
604
- className: (0, _clsx["default"])(children && children.length > 0 && "dropdown-submenu", "app-menu-item", {
605
- active: isActive,
606
- hovered: hoveredNodes.has(node)
607
- }),
582
+ className: (0, _clsx["default"])(children && children.length > 0 && "dropdown-submenu", "app-menu-item", hoveredNodes.has(node) && "hovered"),
608
583
  onMouseEnter: function onMouseEnter() {
609
584
  return handleNodeMouseEnter(node);
610
585
  },
@@ -617,11 +592,10 @@ var WmMenu = /*#__PURE__*/(0, _react.memo)(function (props) {
617
592
  }, __jsx(_link["default"], {
618
593
  title: label,
619
594
  className: disabled ? "disabled" : "",
620
- href: "#",
595
+ href: "javascript:void(0)",
621
596
  onClick: function onClick(event) {
622
597
  handleMenuItemClick(event, node);
623
- },
624
- prefetch: false
598
+ }
625
599
  }, children && children.length > 0 && __jsx("span", {
626
600
  className: (0, _clsx["default"])("pull-right fa caret", _constants.menuAlignClass[menualign] || "fa-caret-right")
627
601
  }), icon && __jsx("i", {
@@ -673,41 +647,6 @@ var WmMenu = /*#__PURE__*/(0, _react.memo)(function (props) {
673
647
  }
674
648
  }
675
649
  }, [transformedDataset, autoopen]);
676
- var notifiedPathRef = (0, _react.useRef)(null);
677
- (0, _react.useEffect)(function () {
678
- if (!isFromNav || !onNavItemActivate || !transformedDataset || transformedDataset.length === 0) {
679
- return;
680
- }
681
-
682
- // Check if any menu item is active using the same logic as renderMenuItems
683
- var checkIfActive = function checkIfActive(nodes) {
684
- if (!nodes || !Array.isArray(nodes)) return false;
685
- return nodes.some(function (node) {
686
- var _value2;
687
- var _getNodeProperties3 = getNodeProperties(node),
688
- link = _getNodeProperties3.link,
689
- children = _getNodeProperties3.children;
690
- var nodeValueLink = node === null || node === void 0 || (_value2 = node.value) === null || _value2 === void 0 ? void 0 : _value2.link;
691
- var isActive = nodeValueLink && typeof nodeValueLink === "string" ? isPathMatchingLink(path, nodeValueLink) : link ? isPathMatchingLink(path, link) : false;
692
- if (isActive) return true;
693
- if (children && children.length > 0) {
694
- return checkIfActive(children);
695
- }
696
- return false;
697
- });
698
- };
699
- var hasActiveItem = checkIfActive(transformedDataset);
700
-
701
- // Notify nav if there's an active item and we haven't notified for this path yet
702
- if (hasActiveItem && notifiedPathRef.current !== path) {
703
- onNavItemActivate();
704
- notifiedPathRef.current = path;
705
- setOpen(true);
706
- } else if (!hasActiveItem) {
707
- // Reset when no active item found
708
- notifiedPathRef.current = null;
709
- }
710
- }, [path, transformedDataset, isFromNav, onNavItemActivate, getNodeProperties]);
711
650
  (0, _react.useEffect)(function () {
712
651
  // Handle outside click for both "outsideClick" and "always" autoclose modes
713
652
  if (!open || autoclose === _constants.AUTO_CLOSE.NEVER) return;
@@ -810,7 +749,7 @@ var WmMenu = /*#__PURE__*/(0, _react.memo)(function (props) {
810
749
  enterDelay: _constants.TOOLTIP_ENTER_DELAY,
811
750
  disableHoverListener: !hint
812
751
  }, type === "anchor" ? __jsx("a", (0, _extends2["default"])({
813
- className: (0, _clsx["default"])("dropdown-toggle app-anchor"),
752
+ className: (0, _clsx["default"])("dropdown-toggle app-anchor", "icon-position-".concat(iconposition)),
814
753
  "icon-position": "left",
815
754
  role: "button",
816
755
  onClick: handleMenuClick,
@@ -65,8 +65,6 @@ var WmPopover = function WmPopover(Props) {
65
65
  }
66
66
  };
67
67
  var handleClick = function handleClick(event) {
68
- event.preventDefault();
69
- event.stopPropagation();
70
68
  if (anchorEl) {
71
69
  if (isDialogOpen) {
72
70
  var _props$onHide;
@@ -1,5 +1,4 @@
1
1
  "use strict";
2
- "use client";
3
2
 
4
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
5
4
  Object.defineProperty(exports, "__esModule", {
@@ -9,23 +9,20 @@ exports["default"] = void 0;
9
9
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
10
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
11
11
  var _react = _interopRequireWildcard(require("react"));
12
- var _excluded = ["styles", "onLoad", "onDestroy", "children", "className"];
12
+ var _excluded = ["styles", "onLoad", "onDestroy", "children"];
13
13
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
14
14
  var __jsx = _react["default"].createElement;
15
- var timeoutId = null;
16
15
  var WmPrefabContainer = function WmPrefabContainer(props) {
17
- var DEFAULT_CLASS = "app-prefab-container full-height";
18
16
  var styles = props.styles,
19
17
  onLoad = props.onLoad,
20
18
  onDestroy = props.onDestroy,
21
19
  children = props.children,
22
- className = props.className,
23
20
  rest = (0, _objectWithoutProperties2["default"])(props, _excluded);
24
21
  var loadedRef = (0, _react.useRef)(false);
25
22
  var ref = (0, _react.useRef)(null);
26
23
  (0, _react.useEffect)(function () {
27
24
  if (onLoad && !loadedRef.current) {
28
- timeoutId = setTimeout(function () {
25
+ setTimeout(function () {
29
26
  onLoad(Event, {
30
27
  ref: ref.current
31
28
  });
@@ -38,16 +35,12 @@ var WmPrefabContainer = function WmPrefabContainer(props) {
38
35
  ref: ref.current
39
36
  });
40
37
  }
41
- if (timeoutId) {
42
- clearTimeout(timeoutId);
43
- }
44
38
  };
45
39
  }, [onLoad, onDestroy]);
46
40
  return __jsx("div", (0, _extends2["default"])({
47
41
  style: styles
48
42
  }, rest, {
49
- ref: ref,
50
- className: className || DEFAULT_CLASS
43
+ ref: ref
51
44
  }), children);
52
45
  };
53
46
  var _default = exports["default"] = WmPrefabContainer;
@@ -1,5 +1,4 @@
1
1
  "use strict";
2
- "use client";
3
2
 
4
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
5
4
  var _typeof = require("@babel/runtime/helpers/typeof");
@@ -5,7 +5,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports["default"] = void 0;
8
+ exports.usePrefabContext = exports["default"] = void 0;
9
9
  var _react = _interopRequireWildcard(require("react"));
10
10
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
11
11
  var _lodash = require("lodash");
@@ -14,9 +14,11 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
14
14
  var __jsx = _react["default"].createElement;
15
15
  var PrefabContext = /*#__PURE__*/(0, _react.createContext)({
16
16
  inbound: {},
17
- outbound: {},
18
- prefabName: ""
17
+ outbound: {}
19
18
  });
19
+ var usePrefabContext = exports.usePrefabContext = function usePrefabContext() {
20
+ return (0, _react.useContext)(PrefabContext);
21
+ };
20
22
  var getChangedKeys = function getChangedKeys(prev, curr) {
21
23
  var changes = [];
22
24
  var keys = new Set([].concat((0, _toConsumableArray2["default"])(Object.keys(prev)), (0, _toConsumableArray2["default"])(Object.keys(curr))));
@@ -25,21 +27,13 @@ var getChangedKeys = function getChangedKeys(prev, curr) {
25
27
  if (ignoredKeys.includes(key)) {
26
28
  return;
27
29
  }
28
- // Handle functions - compare their definitions to avoid unnecessary renders
30
+ // Skip functions - we only want to track value changes
29
31
  var prevValue = prev[key];
30
32
  var currValue = curr[key];
31
- if (typeof prevValue === "function" && typeof currValue === "function") {
32
- // Compare function definitions instead of function instances
33
- if (prevValue.toString() !== currValue.toString() && prevValue === undefined && currValue !== undefined) {
34
- changes.push({
35
- key: key,
36
- oldValue: prevValue,
37
- newValue: currValue
38
- });
39
- }
33
+ if (typeof prevValue === "function" || typeof currValue === "function") {
40
34
  return;
41
35
  }
42
- if (!(0, _lodash.isEqual)(prevValue, currValue) && currValue !== undefined && currValue !== null) {
36
+ if (!(0, _lodash.isEqual)(prevValue, currValue)) {
43
37
  changes.push({
44
38
  key: key,
45
39
  oldValue: prevValue,
@@ -52,138 +46,19 @@ var getChangedKeys = function getChangedKeys(prev, curr) {
52
46
  var PrefabProvider = function PrefabProvider(_ref) {
53
47
  var Context = _ref.value,
54
48
  children = _ref.children;
49
+ var prevInboundRef = (0, _react.useRef)(Context.inbound);
55
50
  var prevOutboundRef = (0, _react.useRef)(Context.outbound);
56
- var pendingChangesRef = (0, _react.useRef)([]);
57
- var retryCountRef = (0, _react.useRef)(0);
58
- var isInitialMountRef = (0, _react.useRef)(true);
59
- var maxRetries = 20;
60
- var initialMountMaxRetries = 30;
61
- var rafIdRef = (0, _react.useRef)(null);
62
51
  (0, _react.useEffect)(function () {
63
52
  var currInbound = Context.inbound;
64
- if ((0, _lodash.isEqual)(prevOutboundRef.current, currInbound)) {
65
- return;
66
- }
67
-
68
- // Fix: Compare prevInboundRef.current with currInbound, not prevOutboundRef
69
53
  var inboundChanges = getChangedKeys(prevOutboundRef.current, currInbound);
70
-
71
- // Update ref for next comparison
72
54
  prevOutboundRef.current = currInbound;
73
55
  if (inboundChanges.length > 0) {
74
- // Merge new changes with pending changes (deduplicate by key)
75
- var changeMap = new Map();
76
-
77
- // Add existing pending changes first
78
- pendingChangesRef.current.forEach(function (change) {
79
- changeMap.set(change.key, change);
80
- });
81
-
82
- // Overwrite with new changes (they're more recent)
83
- inboundChanges.forEach(function (change) {
84
- changeMap.set(change.key, change);
85
- });
86
- pendingChangesRef.current = Array.from(changeMap.values());
87
- retryCountRef.current = 0;
88
-
89
- // Cancel any pending RAF
90
- if (rafIdRef.current !== null) {
91
- cancelAnimationFrame(rafIdRef.current);
92
- }
93
-
94
- // Try to emit with retry mechanism
95
- var tryEmit = function tryEmit() {
96
- // Convert array to object format that BasePage expects: {0: change1, 1: change2, ...}
97
- var changesAsObject = {};
98
- pendingChangesRef.current.forEach(function (change, index) {
99
- changesAsObject[index] = change;
100
- });
101
-
102
- // Emit the event
103
- // Note: EventEmitter.emit returns true if there are listeners, false otherwise
104
- var hasListeners = _events.EVENTEMITTER_METHODS.PREFAB_STATE_SYNC_EMIT(Context.prefabName, changesAsObject);
105
-
106
- // Determine max retries based on whether this is initial mount
107
- var currentMaxRetries = isInitialMountRef.current ? initialMountMaxRetries : maxRetries;
108
-
109
- // If no listeners were registered and we haven't exceeded max retries, retry
110
- if (!hasListeners && retryCountRef.current < currentMaxRetries) {
111
- retryCountRef.current += 1;
112
-
113
- // On initial mount, use more RAF cycles for slower machines
114
- var rafCycles = isInitialMountRef.current ? 10 : 5;
115
- var rafChain = tryEmit;
116
- var _loop = function _loop() {
117
- var next = rafChain;
118
- rafChain = function rafChain() {
119
- rafIdRef.current = requestAnimationFrame(function () {
120
- next();
121
- });
122
- };
123
- };
124
- for (var i = 0; i < rafCycles; i++) {
125
- _loop();
126
- }
127
- rafChain();
128
- } else {
129
- // Successfully emitted (listeners received it) or max retries reached
130
- if (hasListeners) {
131
- // Success! Mark as no longer initial mount after first successful emission
132
- isInitialMountRef.current = false;
133
- } else {
134
- // Max retries reached but no listeners found
135
- // This could happen if BasePage is taking longer than expected
136
- // Reset the flag to allow normal retry behavior for future updates
137
- // This prevents being stuck in initial mount mode indefinitely
138
- isInitialMountRef.current = false;
139
- console.warn("PrefabContext: Max retries reached without finding listeners. " + "BasePage may not be ready yet. Future updates will use normal retry behavior.");
140
- }
141
- pendingChangesRef.current = [];
142
- retryCountRef.current = 0;
143
- rafIdRef.current = null;
144
- }
145
- };
146
-
147
- // Start emission process: wait for React commit, then BasePage initialization
148
- // Use more RAF cycles on initial mount (hard reload scenarios)
149
- var initialRafCycles = isInitialMountRef.current ? 5 : 3;
150
- queueMicrotask(function () {
151
- // Build RAF chain: each cycle waits for the next frame
152
- var rafChain = tryEmit;
153
- var _loop2 = function _loop2() {
154
- var next = rafChain;
155
- rafChain = function rafChain() {
156
- rafIdRef.current = requestAnimationFrame(function () {
157
- next();
158
- });
159
- };
160
- };
161
- for (var i = 0; i < initialRafCycles; i++) {
162
- _loop2();
163
- }
164
-
165
- // Start the chain
166
- rafChain();
167
- });
56
+ setTimeout(function () {
57
+ _events.EVENTEMITTER_METHODS.PREFAB_STATE_SYNC_EMIT(inboundChanges);
58
+ }, 1000);
168
59
  }
60
+ prevInboundRef.current = currInbound;
169
61
  }, [Context.inbound]);
170
-
171
- // Cleanup RAF on unmount and reset state on remount
172
- (0, _react.useEffect)(function () {
173
- return function () {
174
- // Cancel any pending RAF operations
175
- if (rafIdRef.current !== null) {
176
- cancelAnimationFrame(rafIdRef.current);
177
- rafIdRef.current = null;
178
- }
179
- // Reset state for clean remount
180
- pendingChangesRef.current = [];
181
- retryCountRef.current = 0;
182
- // Reset initial mount flag on unmount so next mount starts fresh
183
- // This ensures proper behavior if component unmounts and remounts
184
- isInitialMountRef.current = true;
185
- };
186
- }, []);
187
62
  return __jsx(PrefabContext.Provider, {
188
63
  value: Context
189
64
  }, children);
@@ -120,7 +120,7 @@ var WidgetProvider = exports.WidgetProvider = function WidgetProvider(_ref) {
120
120
  var debouncedEmitRef = (0, _react.useRef)((0, _debounce["default"])(function (partialName, context) {
121
121
  _events.EVENTEMITTER_METHODS.PARTIAL_STATE_SYNC_EMIT({
122
122
  partialName: partialName,
123
- pageContext: context
123
+ pageContext: pageContextRef.current
124
124
  });
125
125
  }, 100));
126
126
 
@@ -148,7 +148,7 @@ var WidgetProvider = exports.WidgetProvider = function WidgetProvider(_ref) {
148
148
  */
149
149
  (0, _react.useEffect)(function () {
150
150
  if (isPage || !partialName) return;
151
- debouncedEmitRef.current(partialName, proxy);
151
+ debouncedEmitRef.current(partialName, pageContext);
152
152
  }, [isPage, partialName, pageContext]);
153
153
  return __jsx(_useHttp.HttpProvider, null, __jsx(WidgetContext.Provider, {
154
154
  value: contextValue
@@ -13,20 +13,14 @@ var EVENTEMITTER = {
13
13
  PREFAB_STATE_SYNC: "prefab-state-sync"
14
14
  };
15
15
  var EVENTEMITTER_METHODS = exports.EVENTEMITTER_METHODS = {
16
- PREFAB_STATE_SYNC_ON: function PREFAB_STATE_SYNC_ON() {
17
- var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
18
- var callback = arguments.length > 1 ? arguments[1] : undefined;
19
- return prefabStateSyncEmitter.on(EVENTEMITTER.PREFAB_STATE_SYNC + (name ? "_" + name : ""), callback);
16
+ PREFAB_STATE_SYNC_ON: function PREFAB_STATE_SYNC_ON(callback) {
17
+ return prefabStateSyncEmitter.on(EVENTEMITTER.PREFAB_STATE_SYNC, callback);
20
18
  },
21
- PREFAB_STATE_SYNC_OFF: function PREFAB_STATE_SYNC_OFF() {
22
- var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
23
- var callback = arguments.length > 1 ? arguments[1] : undefined;
24
- return prefabStateSyncEmitter.off(EVENTEMITTER.PREFAB_STATE_SYNC + (name ? "_" + name : ""), callback);
19
+ PREFAB_STATE_SYNC_OFF: function PREFAB_STATE_SYNC_OFF(callback) {
20
+ return prefabStateSyncEmitter.off(EVENTEMITTER.PREFAB_STATE_SYNC, callback);
25
21
  },
26
- PREFAB_STATE_SYNC_EMIT: function PREFAB_STATE_SYNC_EMIT() {
27
- var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
28
- var data = arguments.length > 1 ? arguments[1] : undefined;
29
- return prefabStateSyncEmitter.emit(EVENTEMITTER.PREFAB_STATE_SYNC + (name ? "_" + name : ""), data);
22
+ PREFAB_STATE_SYNC_EMIT: function PREFAB_STATE_SYNC_EMIT(data) {
23
+ return prefabStateSyncEmitter.emit(EVENTEMITTER.PREFAB_STATE_SYNC, data);
30
24
  },
31
25
  PARTIAL_STATE_SYNC_ON: function PARTIAL_STATE_SYNC_ON(callback) {
32
26
  return partialStateSyncEmitter.on(EVENTEMITTER.PARTIAL_STATE_SYNC, callback);
@@ -8,13 +8,18 @@ var ROUTING_BASEPATH = exports.ROUTING_BASEPATH = "react-pages";
8
8
  var hyperLinkMofify = exports.hyperLinkMofify = function hyperLinkMofify(link) {
9
9
  var hrefLink = "#";
10
10
  if (link) {
11
- var baseRegex = new RegExp("^/".concat(ROUTING_BASEPATH, "(/|$)"));
12
- if (/^#/.test(link)) {
13
- var suffix = link.replace(/^#/, "");
14
- hrefLink = /^\/.*/.test(suffix) ? "/".concat(ROUTING_BASEPATH).concat(suffix) : "/".concat(ROUTING_BASEPATH, "/").concat(suffix);
15
- } else if (/^\//.test(link)) {
16
- hrefLink = baseRegex.test(link) ? link : "/".concat(ROUTING_BASEPATH).concat(link);
11
+ if (link.startsWith("#")) {
12
+ hrefLink = "/".concat(ROUTING_BASEPATH, "/") + link.substring(1);
13
+ } else if (link.startsWith("/")) {
14
+ // Check if basepath is already included to avoid duplication
15
+ if (link.startsWith("/".concat(ROUTING_BASEPATH))) {
16
+ hrefLink = link;
17
+ } else {
18
+ // Add basepath to relative URLs
19
+ hrefLink = "/".concat(ROUTING_BASEPATH).concat(link);
20
+ }
17
21
  } else {
22
+ // Use link as is for absolute URLs
18
23
  hrefLink = link;
19
24
  }
20
25
  }
@@ -36,7 +36,7 @@ var CurrencyFormatter = exports.CurrencyFormatter = /*#__PURE__*/function () {
36
36
  key: "format",
37
37
  value: function format(data, currencySymbol, fracSize) {
38
38
  var _currencySymbol = (_currencyConstant["default"][currencySymbol] || {}).symbol || currencySymbol || "";
39
- var _val = new NumberToStringFormatter().format(data || 0, fracSize);
39
+ var _val = new NumberToStringFormatter().format(data, fracSize);
40
40
  var isNegativeNumber = _val.startsWith("-");
41
41
  if (isNegativeNumber) {
42
42
  _val = _val.replace("-", "");