@pactor-app/app 1.48.0 → 1.49.0

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.cjs CHANGED
@@ -1010,7 +1010,7 @@ var defaultSitemapActions = {
1010
1010
 
1011
1011
  // src/sitemap/SitemapApp.tsx
1012
1012
  var import_core4 = require("@pactor-app/core");
1013
- var import_router3 = require("@pactor-app/router");
1013
+ var import_router4 = require("@pactor-app/router");
1014
1014
  var import_runtime6 = require("@pactor-app/runtime");
1015
1015
  var import_components2 = require("@pactor-app/ui/components");
1016
1016
  var import_react8 = require("react");
@@ -1278,6 +1278,7 @@ function toSitemapNavItems(menuTree) {
1278
1278
  }
1279
1279
 
1280
1280
  // src/sitemap/route.ts
1281
+ var import_router3 = require("@pactor-app/router");
1281
1282
  function resolveSitemapRoute(sitemap, registry, pathname) {
1282
1283
  const match = registry.findByPath(pathname);
1283
1284
  const menu = match?.menu ?? null;
@@ -1287,6 +1288,8 @@ function resolveSitemapRoute(sitemap, registry, pathname) {
1287
1288
  const layoutName = menu.layout ?? sitemap.layout ?? Object.keys(sitemap.layouts)[0] ?? "";
1288
1289
  const highlightId = menu.activeMenu ?? menu.id;
1289
1290
  const highlightItem = registry.findById(highlightId);
1291
+ const page = sitemap.pages.find((p) => p.id === menu.pageId);
1292
+ const params = page !== void 0 && page.path !== menu.path ? (0, import_router3.match)(page.path, pathname)?.params ?? match.params : match.params;
1290
1293
  return {
1291
1294
  menu,
1292
1295
  route: {
@@ -1294,7 +1297,7 @@ function resolveSitemapRoute(sitemap, registry, pathname) {
1294
1297
  layoutName,
1295
1298
  layoutChain: resolveLayoutChain(sitemap, layoutName),
1296
1299
  highlightKey: highlightItem?.path ?? highlightId,
1297
- params: match.params
1300
+ params
1298
1301
  }
1299
1302
  };
1300
1303
  }
@@ -1397,7 +1400,7 @@ function SitemapAppInner(props) {
1397
1400
  };
1398
1401
  }, [fetcher, baseUrl, props.httpAdapter, JSON.stringify(sources)]);
1399
1402
  const registry = (0, import_react8.useMemo)(
1400
- () => state.status === "ready" ? new import_router3.MenuRegistry(mergeSitemapMenus(state.sitemap)) : null,
1403
+ () => state.status === "ready" ? new import_router4.MenuRegistry(mergeSitemapMenus(state.sitemap)) : null,
1401
1404
  [state]
1402
1405
  );
1403
1406
  const resolution = (0, import_react8.useMemo)(
@@ -1519,6 +1522,7 @@ function SitemapLayout({
1519
1522
  httpAdapter: props.httpAdapter,
1520
1523
  permissions: sitemap.permissions ?? [],
1521
1524
  components: props.components,
1525
+ componentRegistry: props.componentRegistry,
1522
1526
  locale: props.locale,
1523
1527
  defaultLocale: props.defaultLocale,
1524
1528
  messages: props.messages
@@ -1531,6 +1535,7 @@ function SitemapLayout({
1531
1535
  navigate,
1532
1536
  props.httpAdapter,
1533
1537
  props.components,
1538
+ props.componentRegistry,
1534
1539
  sitemap,
1535
1540
  props.locale,
1536
1541
  props.defaultLocale,
@@ -1547,6 +1552,7 @@ function SitemapLayout({
1547
1552
  navigate,
1548
1553
  httpAdapter: props.httpAdapter,
1549
1554
  components: { PageOutlet, SitemapMenu, ...props.components },
1555
+ componentRegistry: props.componentRegistry,
1550
1556
  locale: props.locale,
1551
1557
  defaultLocale: props.defaultLocale,
1552
1558
  messages: props.messages
@@ -1559,6 +1565,7 @@ function SitemapLayout({
1559
1565
  navigate,
1560
1566
  props.httpAdapter,
1561
1567
  props.components,
1568
+ props.componentRegistry,
1562
1569
  props.locale,
1563
1570
  props.defaultLocale,
1564
1571
  messagesSignature
package/dist/index.d.cts CHANGED
@@ -617,6 +617,10 @@ interface SitemapAppProps {
617
617
  actions?: Record<string, ActionHandler>;
618
618
  /** 业务组件(同名覆盖内建;PageOutlet / SitemapMenu 为布局保留名) */
619
619
  components?: Record<string, unknown>;
620
+ /** 组件注册表工厂(缺省 @pactor-app/ui 内置组件;如
621
+ * createChatComponentRegistry 可附加 chat 展示组件族 / Chat / ChatShell),
622
+ * 页面与布局工厂共用 */
623
+ componentRegistry?: PactorPageOptions['componentRegistry'];
620
624
  /** HTTP 钩子:所有 HTTP 出口(sitemap 源 / 页面端点 / 页面运行时)的统一加工(跨域改写 / 拆包) */
621
625
  httpAdapter?: PactorHttpHooks;
622
626
  /** fetch 实现(缺省全局 fetch;SSR / 测试可注入) */
package/dist/index.d.ts CHANGED
@@ -617,6 +617,10 @@ interface SitemapAppProps {
617
617
  actions?: Record<string, ActionHandler>;
618
618
  /** 业务组件(同名覆盖内建;PageOutlet / SitemapMenu 为布局保留名) */
619
619
  components?: Record<string, unknown>;
620
+ /** 组件注册表工厂(缺省 @pactor-app/ui 内置组件;如
621
+ * createChatComponentRegistry 可附加 chat 展示组件族 / Chat / ChatShell),
622
+ * 页面与布局工厂共用 */
623
+ componentRegistry?: PactorPageOptions['componentRegistry'];
620
624
  /** HTTP 钩子:所有 HTTP 出口(sitemap 源 / 页面端点 / 页面运行时)的统一加工(跨域改写 / 拆包) */
621
625
  httpAdapter?: PactorHttpHooks;
622
626
  /** fetch 实现(缺省全局 fetch;SSR / 测试可注入) */
package/dist/index.js CHANGED
@@ -1279,6 +1279,7 @@ function toSitemapNavItems(menuTree) {
1279
1279
  }
1280
1280
 
1281
1281
  // src/sitemap/route.ts
1282
+ import { match as matchPath } from "@pactor-app/router";
1282
1283
  function resolveSitemapRoute(sitemap, registry, pathname) {
1283
1284
  const match = registry.findByPath(pathname);
1284
1285
  const menu = match?.menu ?? null;
@@ -1288,6 +1289,8 @@ function resolveSitemapRoute(sitemap, registry, pathname) {
1288
1289
  const layoutName = menu.layout ?? sitemap.layout ?? Object.keys(sitemap.layouts)[0] ?? "";
1289
1290
  const highlightId = menu.activeMenu ?? menu.id;
1290
1291
  const highlightItem = registry.findById(highlightId);
1292
+ const page = sitemap.pages.find((p) => p.id === menu.pageId);
1293
+ const params = page !== void 0 && page.path !== menu.path ? matchPath(page.path, pathname)?.params ?? match.params : match.params;
1291
1294
  return {
1292
1295
  menu,
1293
1296
  route: {
@@ -1295,7 +1298,7 @@ function resolveSitemapRoute(sitemap, registry, pathname) {
1295
1298
  layoutName,
1296
1299
  layoutChain: resolveLayoutChain(sitemap, layoutName),
1297
1300
  highlightKey: highlightItem?.path ?? highlightId,
1298
- params: match.params
1301
+ params
1299
1302
  }
1300
1303
  };
1301
1304
  }
@@ -1520,6 +1523,7 @@ function SitemapLayout({
1520
1523
  httpAdapter: props.httpAdapter,
1521
1524
  permissions: sitemap.permissions ?? [],
1522
1525
  components: props.components,
1526
+ componentRegistry: props.componentRegistry,
1523
1527
  locale: props.locale,
1524
1528
  defaultLocale: props.defaultLocale,
1525
1529
  messages: props.messages
@@ -1532,6 +1536,7 @@ function SitemapLayout({
1532
1536
  navigate,
1533
1537
  props.httpAdapter,
1534
1538
  props.components,
1539
+ props.componentRegistry,
1535
1540
  sitemap,
1536
1541
  props.locale,
1537
1542
  props.defaultLocale,
@@ -1548,6 +1553,7 @@ function SitemapLayout({
1548
1553
  navigate,
1549
1554
  httpAdapter: props.httpAdapter,
1550
1555
  components: { PageOutlet, SitemapMenu, ...props.components },
1556
+ componentRegistry: props.componentRegistry,
1551
1557
  locale: props.locale,
1552
1558
  defaultLocale: props.defaultLocale,
1553
1559
  messages: props.messages
@@ -1560,6 +1566,7 @@ function SitemapLayout({
1560
1566
  navigate,
1561
1567
  props.httpAdapter,
1562
1568
  props.components,
1569
+ props.componentRegistry,
1563
1570
  props.locale,
1564
1571
  props.defaultLocale,
1565
1572
  messagesSignature
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pactor-app/app",
3
- "version": "1.48.0",
3
+ "version": "1.49.0",
4
4
  "description": "Pactor application: one-stop composition layer (createPactorApplication) wiring loader, bootstrap, registries, router, layout, interaction and page runtimes",
5
5
  "keywords": [
6
6
  "pactor",
@@ -46,14 +46,14 @@
46
46
  "access": "public"
47
47
  },
48
48
  "dependencies": {
49
- "@pactor-app/core": "1.48.0",
50
- "@pactor-app/permission": "1.48.0",
51
- "@pactor-app/expression": "1.48.0",
52
- "@pactor-app/router": "1.48.0",
53
- "@pactor-app/runtime": "1.48.0",
54
- "@pactor-app/resource": "1.48.0",
55
- "@pactor-app/ui": "1.48.0",
56
- "@pactor-app/schema": "1.48.0"
49
+ "@pactor-app/core": "1.49.0",
50
+ "@pactor-app/permission": "1.49.0",
51
+ "@pactor-app/router": "1.49.0",
52
+ "@pactor-app/runtime": "1.49.0",
53
+ "@pactor-app/expression": "1.49.0",
54
+ "@pactor-app/ui": "1.49.0",
55
+ "@pactor-app/schema": "1.49.0",
56
+ "@pactor-app/resource": "1.49.0"
57
57
  },
58
58
  "peerDependencies": {
59
59
  "react": ">=18",