procode-lowcode-core 1.0.8 → 1.0.10

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/dist/index.js CHANGED
@@ -18595,19 +18595,22 @@ const validateUiElementSchema = (uiElement, isSchemaValid, schemaInvalidMessages
18595
18595
  executeMode: ExecuteMode.ONSUBMIT,
18596
18596
  modifiedViewModel: undefined,
18597
18597
  screenDataField: uiElement.screenDataField,
18598
- validations: uiElement.validations
18598
+ validations: uiElement.validations,
18599
18599
  });
18600
18600
  isSchemaValid = isSchemaValid && isComponentValid;
18601
18601
  schemaInvalidMessages = Object.assign(Object.assign({}, schemaInvalidMessages), { [uiElement.screenDataField]: invalidMessages });
18602
18602
  }
18603
- else if (uiElement.uiElementType === ScreenUIType.LAYOUT) {
18603
+ else if (uiElement.uiElementType === ScreenUIType.LAYOUT &&
18604
+ uiElement.visible !== false) {
18604
18605
  uiElement.cells.forEach((cell) => {
18605
18606
  const result = validateUiElementSchema(cell, isSchemaValid, schemaInvalidMessages, executeValidation);
18606
18607
  isSchemaValid = isSchemaValid && result.isSchemaValid;
18607
18608
  schemaInvalidMessages = Object.assign(Object.assign({}, schemaInvalidMessages), result.schemaInvalidMessages);
18608
18609
  });
18609
18610
  }
18610
- else if (uiElement.children && uiElement.children.length > 0) {
18611
+ else if (uiElement.children &&
18612
+ uiElement.children.length > 0 &&
18613
+ uiElement.visible !== false) {
18611
18614
  uiElement.children.forEach((child) => {
18612
18615
  const result = validateUiElementSchema(child, isSchemaValid, schemaInvalidMessages, executeValidation);
18613
18616
  isSchemaValid = isSchemaValid && result.isSchemaValid;
@@ -19141,7 +19144,7 @@ const Widget = ({ schemaElementProps, viewModel, validation, navigate, eventServ
19141
19144
  if (!WidgetComponent) {
19142
19145
  return (jsxRuntime.jsx(Skeleton, { className: "", skeletonType: (_j = schemaElementProps.skeletonType) !== null && _j !== void 0 ? _j : "", value: "LOADING..." }));
19143
19146
  }
19144
- return jsxRuntime.jsx(WidgetComponent, Object.assign({}, widgetProps));
19147
+ return (jsxRuntime.jsx(WidgetComponent, Object.assign({}, widgetProps, { availableValidations: schemaElementProps.validations })));
19145
19148
  };
19146
19149
 
19147
19150
  const WidgetRenderer = (_a) => {
@@ -19924,6 +19927,27 @@ const RouterElement = ({ NotificationElement, PageNotFoundElement, }) => {
19924
19927
  return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(reactRedux.Provider, Object.assign({ store: store }, { children: jsxRuntime.jsx(ScreenInitializer, { eventService: eventService, NotificationElement: NotificationElement, uiMetaData: uiMetaData }) })), jsxRuntime.jsx(reactRouterDom.Outlet, {})] }));
19925
19928
  };
19926
19929
 
19930
+ /**
19931
+ * Resolves a relative app path by prepending the homePage prefix
19932
+ * extracted from the current URL.
19933
+ *
19934
+ * e.g. if env.homePage = "/:appCode" and current URL is "/VARSTAGRxxpPq0ECRMBbnHC/workflows",
19935
+ * resolveAppPath("/workflows") returns "/VARSTAGRxxpPq0ECRMBbnHC/workflows"
19936
+ */
19937
+ const resolveAppPath = (pathname) => {
19938
+ if (!env.homePage || !pathname)
19939
+ return pathname;
19940
+ const homePageSegmentCount = env.homePage.split("/").filter(Boolean).length;
19941
+ const currentSegments = window.location.pathname
19942
+ .split("/")
19943
+ .filter(Boolean);
19944
+ const prefix = "/" + currentSegments.slice(0, homePageSegmentCount).join("/");
19945
+ // Avoid double-prepending
19946
+ if (pathname.startsWith(prefix + "/") || pathname === prefix)
19947
+ return pathname;
19948
+ return prefix + pathname;
19949
+ };
19950
+
19927
19951
  const AppRouter = (appRouterProps) => {
19928
19952
  var _a;
19929
19953
  const loadSchema = (slug, params) => __awaiter(void 0, void 0, void 0, function* () { return yield loader({ commonStore, appRouterProps, slug, params }); });
@@ -19981,6 +20005,21 @@ const AppRouter = (appRouterProps) => {
19981
20005
  children: createParentRoutes(),
19982
20006
  },
19983
20007
  ]);
20008
+ // Middleware: auto-prepend homePage prefix to all navigation paths.
20009
+ // This intercepts useNavigate(), <Link>, <Navigate> — everything goes through router.navigate.
20010
+ const originalNavigate = router.navigate.bind(router);
20011
+ router.navigate = (to, opts) => {
20012
+ if (typeof to === "number" || to === null) {
20013
+ return originalNavigate(to, opts);
20014
+ }
20015
+ if (typeof to === "string") {
20016
+ return originalNavigate(resolveAppPath(to), opts);
20017
+ }
20018
+ if (to === null || to === void 0 ? void 0 : to.pathname) {
20019
+ return originalNavigate(Object.assign(Object.assign({}, to), { pathname: resolveAppPath(to.pathname) }), opts);
20020
+ }
20021
+ return originalNavigate(to, opts);
20022
+ };
19984
20023
  return jsxRuntime.jsx(reactRouterDom.RouterProvider, { router: router });
19985
20024
  };
19986
20025
 
@@ -20289,4 +20328,5 @@ exports.EventService = EventService;
20289
20328
  exports.coreStyles = coreStyles;
20290
20329
  exports.default = Core$1;
20291
20330
  exports.getCoreStylesPath = getCoreStylesPath;
20331
+ exports.resolveAppPath = resolveAppPath;
20292
20332
  //# sourceMappingURL=index.js.map