@wavemaker-ai/react-runtime 1.0.0-rc.326 → 1.0.0-rc.328

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 (80) hide show
  1. package/components/basic/icon/index.js +36 -5
  2. package/components/basic/iframe/index.js +18 -8
  3. package/components/basic/label/index.js +4 -3
  4. package/components/basic/search/index.d.ts +72 -3
  5. package/components/basic/search/index.js +75 -21
  6. package/components/basic/search/props.d.ts +4 -0
  7. package/components/common/WmAppIcon/index.js +11 -8
  8. package/components/common/WmAppIcon/props.d.ts +2 -0
  9. package/components/container/accordion/accordion-pane/index.d.ts +1 -0
  10. package/components/container/accordion/accordion-pane/index.js +7 -3
  11. package/components/container/accordion/accordion-pane/props.d.ts +1 -0
  12. package/components/container/index.js +13 -5
  13. package/components/container/panel/components/panel-header/index.js +1 -3
  14. package/components/container/tabs/tab-pane/index.d.ts +1 -0
  15. package/components/container/tabs/tab-pane/index.js +2 -2
  16. package/components/container/tabs/tab-pane/props.d.ts +1 -0
  17. package/components/container/wizard/index.js +11 -10
  18. package/components/container/wizard/utils.js +1 -0
  19. package/components/data/form/dynamic-fields/WmxDynamicFormField.d.ts +11 -0
  20. package/components/data/form/dynamic-fields/WmxDynamicFormField.js +77 -0
  21. package/components/data/form/dynamic-fields/index.js +12 -1
  22. package/components/data/form/form-controller/withFormController.js +0 -14
  23. package/components/data/form/form-field/index.js +10 -7
  24. package/components/data/list/index.js +3 -2
  25. package/components/data/table/components/RowCells.js +3 -1
  26. package/components/data/table/components/TableHeader.js +5 -1
  27. package/components/data/table/hooks/useRowHandlers.d.ts +4 -2
  28. package/components/data/table/hooks/useRowHandlers.js +23 -11
  29. package/components/data/table/hooks/useRowSelection.d.ts +1 -1
  30. package/components/data/table/hooks/useRowSelection.js +80 -66
  31. package/components/data/table/hooks/useTableState.js +14 -2
  32. package/components/data/table/index.js +52 -48
  33. package/components/data/table/props.d.ts +4 -0
  34. package/components/data/table/utils/buildSelectionColumns.js +2 -2
  35. package/components/data/table/utils/columnBuilder.js +1 -1
  36. package/components/data/table/utils/index.d.ts +9 -1
  37. package/components/data/table/utils/index.js +15 -1
  38. package/components/data/table/utils/selectionUtils.d.ts +5 -0
  39. package/components/data/table/utils/selectionUtils.js +5 -0
  40. package/components/dialogs/dialog-header/index.js +1 -1
  41. package/components/dialogs/index.js +14 -2
  42. package/components/input/chips/index.js +29 -5
  43. package/components/input/color-picker/index.js +4 -6
  44. package/components/input/epoch/date/index.js +1 -1
  45. package/components/input/select/index.js +3 -4
  46. package/components/input/text/index.js +2 -2
  47. package/components/input/textarea/index.js +41 -16
  48. package/components/navbar/nav/index.js +10 -5
  49. package/components/navigation/breadcrumb/index.js +2 -1
  50. package/components/navigation/popover/index.js +9 -1
  51. package/components/page/page-content/index.js +24 -4
  52. package/components/page/page-content/props.d.ts +1 -0
  53. package/components/page/partial-container/index.js +1 -1
  54. package/components/wmx/WmxRenderer.d.ts +8 -0
  55. package/components/wmx/WmxRenderer.js +57 -0
  56. package/core/appstore.js +1 -1
  57. package/core/util/index.d.ts +0 -2
  58. package/core/util/index.js +0 -29
  59. package/higherOrder/BasePage.js +24 -63
  60. package/higherOrder/DataNav.js +4 -1
  61. package/hooks/useHttp.js +4 -2
  62. package/hooks/useLayoutSize.js +1 -1
  63. package/package-lock.json +196 -552
  64. package/package.json +3 -3
  65. package/runtime-dynamic/app-initializer.js +2 -1
  66. package/runtime-dynamic/components/partial-content.js +2 -1
  67. package/runtime-dynamic/components/wmx-placeholder.d.ts +18 -0
  68. package/runtime-dynamic/components/wmx-placeholder.js +48 -0
  69. package/runtime-dynamic/main.js +6 -0
  70. package/runtime-dynamic/services/compile-render.js +75 -12
  71. package/store/slices/i18nSlice.d.ts +0 -1
  72. package/store/slices/i18nSlice.js +0 -2
  73. package/utils/layoutsize-util.js +12 -7
  74. package/utils/style-utils.d.ts +6 -0
  75. package/utils/style-utils.js +10 -0
  76. package/utils/wmx.utils.d.ts +6 -0
  77. package/utils/wmx.utils.js +41 -0
  78. package/variables/crud-variable.js +1 -1
  79. package/variables/live-variable.js +1 -1
  80. package/variables/service-variable.js +6 -3
@@ -52,7 +52,6 @@ import {
52
52
  } from "../core/script-registry";
53
53
  import formatters from "../core/formatters";
54
54
  import { useAppProxy } from "../context/AppContext";
55
- import { syncLocaleMessages } from "../core/util";
56
55
  import {
57
56
  computeMergedPageParams,
58
57
  computePartialParamKey,
@@ -67,7 +66,7 @@ import { viewportService } from "../store/viewport.service";
67
66
  import { formatMessage } from "../core/util";
68
67
  const withPageContext = (WrappedComponent, addPageScript, getVariables, componentInfo, prefabInfo) => {
69
68
  const PageContextComponent = (props) => {
70
- var _a, _b, _c, _d, _e, _f;
69
+ var _a, _b, _c;
71
70
  const dispatch = useAppDispatch();
72
71
  const { show, hide } = (_a = useAppSpinner()) != null ? _a : {};
73
72
  const i18n = useAppSelector((state) => state.i18n);
@@ -147,8 +146,7 @@ const withPageContext = (WrappedComponent, addPageScript, getVariables, componen
147
146
  date: i18n.dateFormat,
148
147
  time: i18n.timeFormat,
149
148
  currency: i18n.currencyCode
150
- },
151
- i18n
149
+ }
152
150
  }, prefabInfo), props), componentInfo), {
153
151
  executeStartup,
154
152
  formatters,
@@ -312,9 +310,7 @@ const withPageContext = (WrappedComponent, addPageScript, getVariables, componen
312
310
  if (!appProxy.appLocale) {
313
311
  appProxy.appLocale = {};
314
312
  }
315
- if (!syncLocaleMessages(appProxy.appLocale, mergedAppLocale)) {
316
- appProxy.appLocale = __spreadValues({}, mergedAppLocale);
317
- }
313
+ appProxy.appLocale = __spreadValues({}, mergedAppLocale);
318
314
  const localeFormats = {
319
315
  date: i18n.dateFormat,
320
316
  time: i18n.timeFormat,
@@ -579,72 +575,37 @@ const withPageContext = (WrappedComponent, addPageScript, getVariables, componen
579
575
  if (isLocaleSwitch && pageProxyRef.current) {
580
576
  pageProxyRef.current.Widgets = {};
581
577
  }
582
- setPageContext((prev) => {
583
- if (prev.selectedLocale === i18n.selectedLocale) {
584
- return prev;
585
- }
586
- return __spreadValues(__spreadProps(__spreadValues({}, prev), {
587
- selectedLocale: i18n.selectedLocale
588
- }), isLocaleSwitch && { Widgets: {} });
589
- });
590
- }, [i18n.selectedLocale]);
591
- const applyLocaleToProxies = useCallback(
592
- (newAppLocale) => {
593
- var _a2;
594
- if (appProxy) {
595
- if (!appProxy.appLocale) {
596
- appProxy.appLocale = {};
597
- }
598
- if (!syncLocaleMessages(appProxy.appLocale, newAppLocale)) {
599
- appProxy.appLocale = __spreadValues({}, newAppLocale);
600
- }
601
- }
602
- if (pageProxyRef.current) {
603
- if (!pageProxyRef.current.appLocale) {
604
- pageProxyRef.current.appLocale = {};
605
- }
606
- if (!syncLocaleMessages(pageProxyRef.current.appLocale, newAppLocale)) {
607
- pageProxyRef.current.appLocale = __spreadValues({}, newAppLocale);
608
- }
609
- if (pageProxyRef.current.App) {
610
- pageProxyRef.current.App.appLocale = (_a2 = appProxy == null ? void 0 : appProxy.appLocale) != null ? _a2 : newAppLocale;
611
- }
612
- }
613
- },
614
- [appProxy == null ? void 0 : appProxy.appLocale]
615
- );
616
- if (isInitialized && pageProxyRef.current && ((_c = i18n.localeRevision) != null ? _c : 0) !== lastSyncedLocaleRevisionRef.current) {
617
- const isLocaleChange = lastSyncedLocaleRevisionRef.current >= 0;
618
- lastSyncedLocaleRevisionRef.current = (_d = i18n.localeRevision) != null ? _d : 0;
619
- applyLocaleToProxies(i18n.appLocale);
620
- if (isLocaleChange && (componentInfo == null ? void 0 : componentInfo.componentType) === "PAGE") {
621
- addPageScript(appProxy, pageProxyRef.current);
622
- }
623
- }
624
- useEffect(() => {
625
578
  const newAppLocale = merge({}, i18n.appLocale || {}, (prefabInfo == null ? void 0 : prefabInfo.appLocale) || {});
626
- if (!isEqual(pageContext.appLocale, newAppLocale)) {
627
- setPageContext((prev) => __spreadProps(__spreadValues({}, prev), {
628
- appLocale: newAppLocale
629
- }));
630
- }
631
- }, [i18n.appLocale]);
632
- useEffect(() => {
633
579
  const localeFormats = {
634
580
  date: i18n.dateFormat,
635
581
  time: i18n.timeFormat,
636
582
  currency: i18n.currencyCode
637
583
  };
638
- setPageContext((prev) => __spreadProps(__spreadValues({}, prev), {
639
- localeFormats
640
- }));
641
584
  if (pageProxyRef.current) {
585
+ const appLocaleChanged = !isEqual(pageProxyRef.current.appLocale, newAppLocale);
586
+ if (appLocaleChanged) {
587
+ appProxy.appLocale = newAppLocale;
588
+ pageProxyRef.current.appLocale = newAppLocale;
589
+ pageProxyRef.current.App.appLocale = newAppLocale;
590
+ }
642
591
  pageProxyRef.current.localeFormats = localeFormats;
643
592
  if (pageProxyRef.current.App) {
644
593
  pageProxyRef.current.App.localeFormats = localeFormats;
645
594
  }
646
595
  }
647
- }, [i18n.dateFormat, i18n.timeFormat, i18n.currencyCode]);
596
+ setPageContext((prev) => {
597
+ const appLocaleChanged = !isEqual(prev.appLocale, newAppLocale);
598
+ if (prev.selectedLocale === i18n.selectedLocale && !appLocaleChanged) {
599
+ return __spreadProps(__spreadValues({}, prev), { localeFormats });
600
+ }
601
+ return __spreadProps(__spreadValues(__spreadProps(__spreadValues({}, prev), {
602
+ selectedLocale: i18n.selectedLocale
603
+ }), isLocaleSwitch && { Widgets: {} }), {
604
+ appLocale: newAppLocale,
605
+ localeFormats
606
+ });
607
+ });
608
+ }, [i18n.selectedLocale, i18n.appLocale, i18n.dateFormat, i18n.timeFormat, i18n.currencyCode]);
648
609
  const pageName = (appProxy == null ? void 0 : appProxy.activePageName) || "";
649
610
  useEffect(() => {
650
611
  if ((componentInfo == null ? void 0 : componentInfo.componentType) === "PARTIAL" && pageName) {
@@ -702,14 +663,14 @@ const withPageContext = (WrappedComponent, addPageScript, getVariables, componen
702
663
  ((_a2 = appVariables[value]) == null ? void 0 : _a2.invokeOnParamChange) && ((_b2 = appVariables[value]) == null ? void 0 : _b2.invokeOnParamChange());
703
664
  });
704
665
  }
705
- if (((_e = componentInfo == null ? void 0 : componentInfo.autoUpdateVariables) == null ? void 0 : _e.length) && onStartupCompletedRef.current) {
666
+ if (((_c = componentInfo == null ? void 0 : componentInfo.autoUpdateVariables) == null ? void 0 : _c.length) && onStartupCompletedRef.current) {
706
667
  const pageVariables = pageContext.Variables;
707
668
  componentInfo.autoUpdateVariables.forEach((value) => {
708
669
  var _a2, _b2;
709
670
  (_b2 = (_a2 = pageVariables[value]) == null ? void 0 : _a2.invokeOnParamChange) == null ? void 0 : _b2.call(_a2);
710
671
  });
711
672
  }
712
- return /* @__PURE__ */ jsx(WidgetProvider, { value: { value: pageContext, proxy: pageProxyRef.current }, children: /* @__PURE__ */ jsx(WrappedComponent, __spreadValues({}, props), `locale-${(_f = i18n.localeRevision) != null ? _f : 0}`) });
673
+ return /* @__PURE__ */ jsx(WidgetProvider, { value: { value: pageContext, proxy: pageProxyRef.current }, children: /* @__PURE__ */ jsx(WrappedComponent, __spreadValues({}, props)) });
713
674
  };
714
675
  PageContextComponent.displayName = `WithPageContext(${WrappedComponent.displayName || WrappedComponent.name || "Component"})`;
715
676
  return PageContextComponent;
@@ -419,13 +419,16 @@ const withDatasetAwareNavigation = (WrappedComponent) => {
419
419
  if (!navNodes || navNodes.length === 0) {
420
420
  return navNodes;
421
421
  }
422
+ if (!itemid && !binditemid.current) {
423
+ return navNodes;
424
+ }
422
425
  const currentRouteId = getCurrentRouteId();
423
426
  if (!currentRouteId) {
424
427
  return [];
425
428
  }
426
429
  const breadcrumbPath = findPathToNode(navNodes, currentRouteId);
427
430
  return breadcrumbPath.length > 0 ? breadcrumbPath : [];
428
- }, [navNodes]);
431
+ }, [navNodes, itemid]);
429
432
  return /* @__PURE__ */ jsx(
430
433
  WrappedComponent,
431
434
  __spreadProps(__spreadValues({}, props), {
package/hooks/useHttp.js CHANGED
@@ -157,7 +157,7 @@ class ModernHttpService {
157
157
  );
158
158
  }
159
159
  async send(options, variable) {
160
- var _a, _b;
160
+ var _a, _b, _c, _d;
161
161
  const serviceInfo = variable.serviceInfo;
162
162
  let headers = new AxiosHeaders(options.headers);
163
163
  let requestBody = options.data;
@@ -178,8 +178,10 @@ class ModernHttpService {
178
178
  url = variable.config.baseUrl + options.url.replace("./", "/");
179
179
  } else if (url === (serviceInfo == null ? void 0 : serviceInfo.directPath) && options.url.startsWith("http")) {
180
180
  url = options.url;
181
+ } else if (variable.config.baseUrl.includes("/services") && ((_b = options.url) == null ? void 0 : _b.includes("/services"))) {
182
+ url = variable.config.baseUrl + ((_c = options.url.replace("./services", "")) == null ? void 0 : _c.replace("./", "/"));
181
183
  } else {
182
- url = variable.config.baseUrl + ((_b = options.url.replace("./services", "")) == null ? void 0 : _b.replace("./", "/"));
184
+ url = variable.config.baseUrl + ((_d = options.url) == null ? void 0 : _d.replace("./", "/"));
183
185
  }
184
186
  if (!options.isDirectCall) {
185
187
  headers = headers.set("X-Requested-With", "XMLHttpRequest");
@@ -3,7 +3,7 @@ import { layoutSizeUtil } from "../utils/layoutsize-util";
3
3
  function useLayoutSize(ref, layoutWidth, layoutHeight) {
4
4
  useLayoutEffect(() => {
5
5
  if (ref.current && (layoutWidth || layoutHeight)) {
6
- layoutSizeUtil(ref.current, layoutWidth, layoutHeight);
6
+ layoutSizeUtil(ref.current, layoutWidth == null ? void 0 : layoutWidth.trim(), layoutHeight == null ? void 0 : layoutHeight.trim());
7
7
  }
8
8
  }, [layoutWidth, layoutHeight]);
9
9
  }