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.esm.js CHANGED
@@ -18591,19 +18591,22 @@ const validateUiElementSchema = (uiElement, isSchemaValid, schemaInvalidMessages
18591
18591
  executeMode: ExecuteMode.ONSUBMIT,
18592
18592
  modifiedViewModel: undefined,
18593
18593
  screenDataField: uiElement.screenDataField,
18594
- validations: uiElement.validations
18594
+ validations: uiElement.validations,
18595
18595
  });
18596
18596
  isSchemaValid = isSchemaValid && isComponentValid;
18597
18597
  schemaInvalidMessages = Object.assign(Object.assign({}, schemaInvalidMessages), { [uiElement.screenDataField]: invalidMessages });
18598
18598
  }
18599
- else if (uiElement.uiElementType === ScreenUIType.LAYOUT) {
18599
+ else if (uiElement.uiElementType === ScreenUIType.LAYOUT &&
18600
+ uiElement.visible !== false) {
18600
18601
  uiElement.cells.forEach((cell) => {
18601
18602
  const result = validateUiElementSchema(cell, isSchemaValid, schemaInvalidMessages, executeValidation);
18602
18603
  isSchemaValid = isSchemaValid && result.isSchemaValid;
18603
18604
  schemaInvalidMessages = Object.assign(Object.assign({}, schemaInvalidMessages), result.schemaInvalidMessages);
18604
18605
  });
18605
18606
  }
18606
- else if (uiElement.children && uiElement.children.length > 0) {
18607
+ else if (uiElement.children &&
18608
+ uiElement.children.length > 0 &&
18609
+ uiElement.visible !== false) {
18607
18610
  uiElement.children.forEach((child) => {
18608
18611
  const result = validateUiElementSchema(child, isSchemaValid, schemaInvalidMessages, executeValidation);
18609
18612
  isSchemaValid = isSchemaValid && result.isSchemaValid;
@@ -19137,7 +19140,7 @@ const Widget = ({ schemaElementProps, viewModel, validation, navigate, eventServ
19137
19140
  if (!WidgetComponent) {
19138
19141
  return (jsx(Skeleton, { className: "", skeletonType: (_j = schemaElementProps.skeletonType) !== null && _j !== void 0 ? _j : "", value: "LOADING..." }));
19139
19142
  }
19140
- return jsx(WidgetComponent, Object.assign({}, widgetProps));
19143
+ return (jsx(WidgetComponent, Object.assign({}, widgetProps, { availableValidations: schemaElementProps.validations })));
19141
19144
  };
19142
19145
 
19143
19146
  const WidgetRenderer = (_a) => {
@@ -19920,6 +19923,27 @@ const RouterElement = ({ NotificationElement, PageNotFoundElement, }) => {
19920
19923
  return (jsxs(Fragment, { children: [jsx(Provider, Object.assign({ store: store }, { children: jsx(ScreenInitializer, { eventService: eventService, NotificationElement: NotificationElement, uiMetaData: uiMetaData }) })), jsx(Outlet, {})] }));
19921
19924
  };
19922
19925
 
19926
+ /**
19927
+ * Resolves a relative app path by prepending the homePage prefix
19928
+ * extracted from the current URL.
19929
+ *
19930
+ * e.g. if env.homePage = "/:appCode" and current URL is "/VARSTAGRxxpPq0ECRMBbnHC/workflows",
19931
+ * resolveAppPath("/workflows") returns "/VARSTAGRxxpPq0ECRMBbnHC/workflows"
19932
+ */
19933
+ const resolveAppPath = (pathname) => {
19934
+ if (!env.homePage || !pathname)
19935
+ return pathname;
19936
+ const homePageSegmentCount = env.homePage.split("/").filter(Boolean).length;
19937
+ const currentSegments = window.location.pathname
19938
+ .split("/")
19939
+ .filter(Boolean);
19940
+ const prefix = "/" + currentSegments.slice(0, homePageSegmentCount).join("/");
19941
+ // Avoid double-prepending
19942
+ if (pathname.startsWith(prefix + "/") || pathname === prefix)
19943
+ return pathname;
19944
+ return prefix + pathname;
19945
+ };
19946
+
19923
19947
  const AppRouter = (appRouterProps) => {
19924
19948
  var _a;
19925
19949
  const loadSchema = (slug, params) => __awaiter(void 0, void 0, void 0, function* () { return yield loader({ commonStore, appRouterProps, slug, params }); });
@@ -19977,6 +20001,21 @@ const AppRouter = (appRouterProps) => {
19977
20001
  children: createParentRoutes(),
19978
20002
  },
19979
20003
  ]);
20004
+ // Middleware: auto-prepend homePage prefix to all navigation paths.
20005
+ // This intercepts useNavigate(), <Link>, <Navigate> — everything goes through router.navigate.
20006
+ const originalNavigate = router.navigate.bind(router);
20007
+ router.navigate = (to, opts) => {
20008
+ if (typeof to === "number" || to === null) {
20009
+ return originalNavigate(to, opts);
20010
+ }
20011
+ if (typeof to === "string") {
20012
+ return originalNavigate(resolveAppPath(to), opts);
20013
+ }
20014
+ if (to === null || to === void 0 ? void 0 : to.pathname) {
20015
+ return originalNavigate(Object.assign(Object.assign({}, to), { pathname: resolveAppPath(to.pathname) }), opts);
20016
+ }
20017
+ return originalNavigate(to, opts);
20018
+ };
19980
20019
  return jsx(RouterProvider, { router: router });
19981
20020
  };
19982
20021
 
@@ -20280,5 +20319,5 @@ const coreStyles = './Assets/styles/index.scss';
20280
20319
  // Utility function to get styles path
20281
20320
  const getCoreStylesPath = () => coreStyles;
20282
20321
 
20283
- export { Core$1 as Core, EventService, coreStyles, Core$1 as default, getCoreStylesPath };
20322
+ export { Core$1 as Core, EventService, coreStyles, Core$1 as default, getCoreStylesPath, resolveAppPath };
20284
20323
  //# sourceMappingURL=index.esm.js.map