@7365admin1/layer-common 4.97.1-staging.689 → 4.97.1-staging.690

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/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@7365admin1/layer-common",
3
3
  "license": "MIT",
4
4
  "type": "module",
5
- "version": "4.97.1-staging.689",
5
+ "version": "4.97.1-staging.690",
6
6
  "author": "7365admin1",
7
7
  "main": "./nuxt.config.ts",
8
8
  "//files": "What a consumer extending this layer actually loads. Without this npm ships the whole working tree - the changesets, the CI workflows, the render harness in tools/ and any scratch directory that happened to exist at publish time. Nuxt resolves a layer by directory, so every runtime directory below has to stay listed; adding a new top-level runtime directory means adding it here too.",
@@ -153,6 +153,9 @@ export function permissionsDenied(
153
153
  return permissions.every((p) => denied.includes(String(p).split(":")[0]));
154
154
  }
155
155
 
156
+ /** Carved-out pages: shown to anyone, but never the only thing left in a trimmed group. */
157
+ const ROUTES_THAT_DONT_KEEP_A_GROUP = ["org-site-facility-settings"];
158
+
156
159
  type TRouted = { route?: { name?: unknown } | null; children?: TRouted[] };
157
160
 
158
161
  /** A menu without the pages the client was not given; a group left empty goes too. */
@@ -165,7 +168,11 @@ export function withoutDeniedRoutes<T extends TRouted>(
165
168
  if (routeDenied(item.route?.name, denied)) return [];
166
169
  if (!item.children?.length) return [item];
167
170
  const children = withoutDeniedRoutes(item.children as T[], denied);
168
- return children.length ? [{ ...item, children }] : [];
171
+ // A page carved out of its module (Facility Settings) must not keep a group
172
+ // alive on its own once the group's module pages were taken away.
173
+ const lost = children.length < item.children.length;
174
+ const stray = children.every((c) => ROUTES_THAT_DONT_KEEP_A_GROUP.includes(String(c.route?.name)));
175
+ return children.length && !(lost && stray) ? [{ ...item, children }] : [];
169
176
  });
170
177
  }
171
178