@wavemaker-ai/react-runtime 1.0.0-rc.314 → 1.0.0-rc.317

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 (63) hide show
  1. package/actions/navigation-action.d.ts +1 -0
  2. package/actions/navigation-action.js +34 -9
  3. package/components/auth/RoleAuthGuard.d.ts +6 -0
  4. package/components/auth/RoleAuthGuard.js +65 -0
  5. package/components/basic/search/index.js +2 -1
  6. package/components/basic/search/providers.js +2 -2
  7. package/components/basic/tree/Components/TreeNodeComponent.d.ts +1 -1
  8. package/components/basic/tree/Components/TreeNodeComponent.js +14 -8
  9. package/components/basic/tree/hooks/useTreePersistedState.d.ts +3 -0
  10. package/components/basic/tree/hooks/useTreePersistedState.js +38 -0
  11. package/components/basic/tree/index.d.ts +1 -0
  12. package/components/basic/tree/index.js +105 -30
  13. package/components/basic/tree/props.d.ts +18 -1
  14. package/components/basic/tree/utils.d.ts +16 -1
  15. package/components/basic/tree/utils.js +111 -0
  16. package/components/chart/src/dataUtils.js +1 -1
  17. package/components/common/customTemplate/useCustomTemplate.js +1 -1
  18. package/components/container/layout-grid/grid-column/index.js +2 -1
  19. package/components/data/form/base-form/index.js +3 -1
  20. package/components/data/form/form-controller/withFormController.js +3 -7
  21. package/components/data/pagination/hooks/usePagination.js +0 -1
  22. package/components/data/table/index.js +5 -2
  23. package/components/data/table/utils/columnBuilder.d.ts +1 -1
  24. package/components/data/table/utils/columnBuilder.js +7 -4
  25. package/components/data/table/utils/crud-handlers.js +10 -10
  26. package/components/data/table/utils/index.d.ts +9 -8
  27. package/components/data/table/utils/index.js +73 -9
  28. package/components/layout/leftnav/index.js +21 -2
  29. package/components/layout/leftnav/props.d.ts +9 -0
  30. package/components/layout/leftnav/utils/page-class-util.d.ts +9 -0
  31. package/components/layout/leftnav/utils/page-class-util.js +28 -0
  32. package/components/navigation/popover/index.js +1 -0
  33. package/components/page/index.js +22 -6
  34. package/components/page/page-context.d.ts +4 -0
  35. package/components/page/page-context.js +5 -0
  36. package/components/page/partial-container/index.js +1 -4
  37. package/higherOrder/BaseApp.js +4 -3
  38. package/higherOrder/BaseAppProps.d.ts +1 -0
  39. package/higherOrder/BasePage.js +0 -10
  40. package/hooks/useDataSourceSubscription.js +1 -1
  41. package/hooks/useHttp.js +0 -4
  42. package/package-lock.json +103 -103
  43. package/package.json +3 -3
  44. package/runtime-dynamic/app-initializer.js +1 -1
  45. package/runtime-dynamic/components/use-dynamic-component.js +17 -31
  46. package/runtime-dynamic/factories/build-base-page-like-component.d.ts +1 -1
  47. package/runtime-dynamic/factories/dynamic-component.js +9 -1
  48. package/runtime-dynamic/factories/prefab-factory.d.ts +1 -1
  49. package/runtime-dynamic/factories/utils.d.ts +1 -1
  50. package/runtime-dynamic/services/component-ref-provider.d.ts +18 -3
  51. package/runtime-dynamic/services/component-ref-provider.js +15 -38
  52. package/runtime-dynamic/services/index.d.ts +2 -3
  53. package/runtime-dynamic/services/index.js +1 -18
  54. package/runtime-dynamic/services/resource-manager.d.ts +2 -3
  55. package/runtime-dynamic/services/resource-manager.js +5 -15
  56. package/runtime-dynamic/services/script-executor.js +1 -7
  57. package/runtime-dynamic/services/variable-registry.js +0 -4
  58. package/utils/attr.js +2 -9
  59. package/utils/custom-expression/index.js +4 -1
  60. package/utils/custom-expression/parser.js +4 -2
  61. package/utils/state-persistance.d.ts +1 -1
  62. package/runtime-dynamic/services/cache.d.ts +0 -29
  63. package/runtime-dynamic/services/cache.js +0 -51
@@ -266,6 +266,7 @@ const WmPopover = (Props) => {
266
266
  },
267
267
  className: clsx(
268
268
  placement,
269
+ props.className,
269
270
  "app-popover in popover",
270
271
  props.contentanimation && `animated ${props.contentanimation}`,
271
272
  `popover-${placement}`,
@@ -36,6 +36,7 @@ import clsx from "clsx";
36
36
  import Container from "@mui/material/Container";
37
37
  import React from "react";
38
38
  import { removeInvalidAttributes } from "../../utils/attr";
39
+ import { PageLayoutContext } from "./page-context";
39
40
  import { getCurrentPath } from "../../core/util/utils";
40
41
  const getDefaultClass = (pageName) => clsx("app-page", pageName ? `app-page-${pageName.toLowerCase()}` : "", "container");
41
42
  function WmPage(props) {
@@ -48,9 +49,13 @@ function WmPage(props) {
48
49
  height: window.innerHeight
49
50
  }));
50
51
  const [hasFullNavHeight, setHasFullNavHeight] = useState(false);
52
+ const [leftPanelPageClasses, setLeftPanelPageClasses] = useState();
51
53
  const handleNavHeightChange = useCallback((isFull) => {
52
54
  setHasFullNavHeight(isFull);
53
55
  }, []);
56
+ const handleLeftPanelPageClassesChange = useCallback((pageClasses) => {
57
+ setLeftPanelPageClasses(pageClasses);
58
+ }, []);
54
59
  const handleResize = useCallback(() => {
55
60
  const newSize = {
56
61
  width: window.innerWidth,
@@ -118,12 +123,23 @@ function WmPage(props) {
118
123
  });
119
124
  }, [children, handleNavHeightChange]);
120
125
  return /* @__PURE__ */ jsx(
121
- Container,
122
- __spreadProps(__spreadValues({}, removeInvalidAttributes(restProps)), {
123
- className: clsx(getDefaultClass(pageName), { "app-nav-full": hasFullNavHeight }, className),
124
- sx: __spreadValues({}, styles),
125
- children: childrenWithCallback
126
- })
126
+ PageLayoutContext.Provider,
127
+ {
128
+ value: { onLeftPanelPageClassesChange: handleLeftPanelPageClassesChange },
129
+ children: /* @__PURE__ */ jsx(
130
+ Container,
131
+ __spreadProps(__spreadValues({}, removeInvalidAttributes(restProps)), {
132
+ className: clsx(
133
+ getDefaultClass(pageName),
134
+ { "app-nav-full": hasFullNavHeight },
135
+ leftPanelPageClasses,
136
+ className
137
+ ),
138
+ sx: __spreadValues({}, styles),
139
+ children: childrenWithCallback
140
+ })
141
+ )
142
+ }
127
143
  );
128
144
  }
129
145
  WmPage.displayName = "WmPage";
@@ -0,0 +1,4 @@
1
+ export interface PageLayoutContextValue {
2
+ onLeftPanelPageClassesChange?: (pageClasses?: string) => void;
3
+ }
4
+ export declare const PageLayoutContext: import("react").Context<PageLayoutContextValue>;
@@ -0,0 +1,5 @@
1
+ import { createContext } from "react";
2
+ const PageLayoutContext = createContext({});
3
+ export {
4
+ PageLayoutContext
5
+ };
@@ -44,13 +44,10 @@ const MEMO_KEYS = [
44
44
  "params"
45
45
  ];
46
46
  const arePropsEqual = (prevProps, nextProps) => {
47
- const staticEqual = MEMO_KEYS.every((key) => {
47
+ return MEMO_KEYS.every((key) => {
48
48
  if (key === "styles") return isEqual(prevProps[key], nextProps[key]);
49
49
  return prevProps[key] === nextProps[key];
50
50
  });
51
- if (!staticEqual) return false;
52
- const paramNames = nextProps.params || [];
53
- return paramNames.every((p) => prevProps[p] === nextProps[p]);
54
51
  };
55
52
  const CodegenPartialContainer = memo((props) => {
56
53
  const { prefab, content, prefabName, onLoad } = props;
@@ -44,6 +44,7 @@ import { metadataService } from "../variables/metadata.service";
44
44
  import { i18nService as i18nServiceActions } from "../store/bindActions/i18nActions";
45
45
  import { WmContainer } from "../components/container";
46
46
  import WmPartialContainer from "../components/page/partial-container";
47
+ import RoleAuthGuard from "../components/auth/RoleAuthGuard";
47
48
  (_a = global.wm) != null ? _a : global.wm = {};
48
49
  const BaseApp = (WrappedComponent, addAppScript, getAppVariables, appInfo = {}) => {
49
50
  const AppContextComponent = (props) => {
@@ -340,7 +341,7 @@ const BaseApp = (WrappedComponent, addAppScript, getAppVariables, appInfo = {})
340
341
  );
341
342
  }
342
343
  function notifyApp(message, type, showTypeLabel) {
343
- const notificationAction = get(appContext, "Actions.appNotification");
344
+ const notificationAction = get(appProxyRef.current, "Actions.appNotification");
344
345
  if (notificationAction) {
345
346
  const appNotification = notificationAction.config.paramProvider();
346
347
  const newParams = () => ({
@@ -424,10 +425,10 @@ const BaseApp = (WrappedComponent, addAppScript, getAppVariables, appInfo = {})
424
425
  state: appContext,
425
426
  proxy: appProxyRef.current
426
427
  },
427
- children: /* @__PURE__ */ jsx(AppSpinnerProvider, { children: /* @__PURE__ */ jsxs(LayoutProvider, { children: [
428
+ children: /* @__PURE__ */ jsx(AppSpinnerProvider, { children: /* @__PURE__ */ jsx(LayoutProvider, { children: /* @__PURE__ */ jsxs(RoleAuthGuard, { children: [
428
429
  /* @__PURE__ */ jsx(WrappedComponent, __spreadValues({}, props)),
429
430
  renderCommonComponents()
430
- ] }) })
431
+ ] }) }) })
431
432
  }
432
433
  );
433
434
  };
@@ -12,6 +12,7 @@ export interface BaseAppProps {
12
12
  isAppReady: boolean;
13
13
  changeLocale: (locale: string) => void;
14
14
  selectedLocale: string;
15
+ appLocale?: any;
15
16
  /** Locale bundle–style formats; synced from Redux `i18n`. */
16
17
  localeFormats: LocaleFormatsProxy;
17
18
  getDependency: (name: string) => any;
@@ -224,22 +224,12 @@ const withPageContext = (WrappedComponent, addPageScript, getVariables, componen
224
224
  securityConfig
225
225
  ]);
226
226
  const shouldInitialize = useMemo(() => {
227
- var _a2, _b2;
228
227
  if (appContext && !appContext.isAppReady) {
229
228
  return false;
230
229
  }
231
230
  if (accessLoading) {
232
231
  return false;
233
232
  }
234
- if (!hasAccess && isSecurityEnabled) {
235
- if (isAuthenticated) {
236
- appContext == null ? void 0 : appContext.notifyApp(
237
- ((_b2 = (_a2 = pageContext == null ? void 0 : pageContext.appLocale) == null ? void 0 : _a2.LABELS) == null ? void 0 : _b2.ACCESS_DENIED) || "Access Denied",
238
- "Error"
239
- );
240
- }
241
- return false;
242
- }
243
233
  return true;
244
234
  }, [appContext == null ? void 0 : appContext.isAppReady, accessLoading, hasAccess, isSecurityEnabled, isAuthenticated]);
245
235
  useEffect(() => {
@@ -53,7 +53,7 @@ const applyPersistedState = (invokeOptions, ctx) => {
53
53
  }
54
54
  };
55
55
  const matchesDatasource = (eventVariable, datasource) => {
56
- return eventVariable.execute(DataSource.Operation.GET_UNIQUE_IDENTIFIER) === datasource.execute(DataSource.Operation.GET_UNIQUE_IDENTIFIER);
56
+ return (eventVariable == null ? void 0 : eventVariable.execute(DataSource.Operation.GET_UNIQUE_IDENTIFIER)) === (datasource == null ? void 0 : datasource.execute(DataSource.Operation.GET_UNIQUE_IDENTIFIER));
57
57
  };
58
58
  const useDataSourceSubscription = ({
59
59
  datasource,
package/hooks/useHttp.js CHANGED
@@ -105,7 +105,6 @@ class ModernHttpService {
105
105
  config = modifiedReq;
106
106
  }
107
107
  } catch (error) {
108
- console.error("Error in onBeforeServiceCall:", error);
109
108
  }
110
109
  }
111
110
  return config;
@@ -130,7 +129,6 @@ class ModernHttpService {
130
129
  modifiedResponse = __spreadValues(__spreadValues({}, modifiedResponse), modifiedResp);
131
130
  }
132
131
  } catch (err) {
133
- console.error("Error in onServiceSuccess:", err);
134
132
  }
135
133
  }
136
134
  return modifiedResponse;
@@ -148,7 +146,6 @@ class ModernHttpService {
148
146
  errorResponse = __spreadValues(__spreadValues({}, errorResponse), modifiedResp);
149
147
  }
150
148
  } catch (err) {
151
- console.error("Error in onServiceError:", err);
152
149
  }
153
150
  }
154
151
  const sessionRetry = this.handleSessionFailure(error);
@@ -296,7 +293,6 @@ class ModernHttpService {
296
293
  });
297
294
  });
298
295
  } catch (error) {
299
- console.error("Unexpected error in uploadFile:", error);
300
296
  throw error;
301
297
  }
302
298
  }