@nocobase/client-v2 2.1.0-beta.36 → 2.1.0-beta.38

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 (154) hide show
  1. package/es/Application.d.ts +1 -0
  2. package/es/BaseApplication.d.ts +4 -0
  3. package/es/RouterManager.d.ts +1 -0
  4. package/es/components/KeepAlive.d.ts +22 -0
  5. package/es/components/RouterBridge.d.ts +9 -0
  6. package/es/components/form/DialogFormLayout.d.ts +5 -29
  7. package/es/components/form/filter/CollectionFilter.d.ts +41 -0
  8. package/es/components/form/filter/CollectionFilterItem.d.ts +41 -0
  9. package/es/components/form/filter/DateFilterDynamicComponent.d.ts +57 -0
  10. package/es/components/form/filter/FilterValueInput.d.ts +29 -0
  11. package/es/components/form/filter/index.d.ts +11 -0
  12. package/es/components/form/filter/useFilterActionProps.d.ts +96 -0
  13. package/es/components/form/index.d.ts +1 -0
  14. package/es/data-source/ExtendCollectionsProvider.d.ts +50 -0
  15. package/es/data-source/index.d.ts +9 -0
  16. package/es/flow/FlowPage.d.ts +2 -1
  17. package/es/flow/admin-shell/AdminLayoutRouteCoordinator.d.ts +8 -40
  18. package/es/flow/admin-shell/BaseLayoutModel.d.ts +89 -0
  19. package/es/flow/admin-shell/BaseLayoutRouteCoordinator.d.ts +74 -0
  20. package/es/flow/admin-shell/admin-layout/AdminLayoutEntryGuard.d.ts +12 -0
  21. package/es/flow/admin-shell/admin-layout/AdminLayoutModel.d.ts +7 -92
  22. package/es/flow/admin-shell/admin-layout/index.d.ts +2 -0
  23. package/es/flow/admin-shell/useAdminLayoutRoutePage.d.ts +2 -2
  24. package/es/flow/admin-shell/useLayoutRoutePage.d.ts +23 -0
  25. package/es/flow/components/FlowRoute.d.ts +10 -1
  26. package/es/flow/components/filter/index.d.ts +2 -0
  27. package/es/flow/components/filter/useFilterOptions.d.ts +54 -0
  28. package/es/flow/index.d.ts +4 -0
  29. package/es/flow/models/base/PageModel/PageModel.d.ts +3 -1
  30. package/es/flow/models/blocks/form/FormActionGroupModel.d.ts +1 -0
  31. package/es/flow/models/blocks/table/TableBlockModel.d.ts +10 -0
  32. package/es/flow/models/fields/AssociationFieldModel/SubTableFieldModel/index.d.ts +1 -1
  33. package/es/flow-compat/passwordUtils.d.ts +1 -1
  34. package/es/index.d.ts +2 -0
  35. package/es/index.mjs +491 -439
  36. package/es/layout-manager/LayoutContentRoute.d.ts +14 -0
  37. package/es/layout-manager/LayoutManager.d.ts +22 -0
  38. package/es/layout-manager/LayoutRoute.d.ts +14 -0
  39. package/es/layout-manager/index.d.ts +13 -0
  40. package/es/layout-manager/types.d.ts +20 -0
  41. package/es/layout-manager/utils.d.ts +14 -0
  42. package/es/nocobase-buildin-plugin/index.d.ts +3 -10
  43. package/es/settings-center/index.d.ts +1 -1
  44. package/es/settings-center/plugin-manager/BulkEnableButton.d.ts +15 -0
  45. package/es/settings-center/plugin-manager/PluginCard.d.ts +15 -0
  46. package/es/settings-center/plugin-manager/PluginDetail.d.ts +16 -0
  47. package/es/settings-center/{PluginManagerPage.d.ts → plugin-manager/index.d.ts} +1 -7
  48. package/es/settings-center/plugin-manager/types.d.ts +34 -0
  49. package/lib/index.js +491 -439
  50. package/package.json +8 -7
  51. package/src/Application.tsx +27 -12
  52. package/src/BaseApplication.tsx +19 -0
  53. package/src/PluginSettingsManager.ts +1 -1
  54. package/src/RouterManager.tsx +17 -1
  55. package/src/__tests__/PluginSettingsManager.test.ts +41 -2
  56. package/src/__tests__/app.test.tsx +17 -1
  57. package/src/__tests__/globalDeps.test.ts +1 -0
  58. package/src/__tests__/nocobase-buildin-plugin-auth.test.tsx +45 -2
  59. package/src/__tests__/plugin-manager.test.tsx +177 -0
  60. package/src/__tests__/settings-center.test.tsx +24 -2
  61. package/src/components/KeepAlive.tsx +131 -0
  62. package/src/components/README.md +89 -6
  63. package/src/components/README.zh-CN.md +89 -7
  64. package/src/components/RouterBridge.tsx +28 -4
  65. package/src/components/__tests__/KeepAlive.test.tsx +63 -0
  66. package/src/components/__tests__/RouterBridge.test.tsx +27 -0
  67. package/src/components/form/DialogFormLayout.tsx +5 -29
  68. package/src/components/form/filter/CollectionFilter.tsx +101 -0
  69. package/src/components/form/filter/CollectionFilterItem.tsx +176 -0
  70. package/src/components/form/filter/DateFilterDynamicComponent.tsx +283 -0
  71. package/src/components/form/filter/FilterValueInput.tsx +198 -0
  72. package/src/components/form/filter/__tests__/CollectionFilterItem.test.tsx +205 -0
  73. package/src/components/form/filter/__tests__/DateFilterDynamicComponent.test.tsx +148 -0
  74. package/src/components/form/filter/__tests__/FilterValueInput.test.tsx +243 -0
  75. package/src/components/form/filter/__tests__/compileFilterGroup.test.ts +146 -0
  76. package/src/components/form/filter/index.ts +13 -0
  77. package/src/components/form/filter/useFilterActionProps.ts +200 -0
  78. package/src/components/form/index.tsx +1 -0
  79. package/src/data-source/ExtendCollectionsProvider.tsx +144 -0
  80. package/src/data-source/__tests__/ExtendCollectionsProvider.test.tsx +264 -0
  81. package/src/data-source/index.ts +10 -0
  82. package/src/flow/FlowPage.tsx +35 -7
  83. package/src/flow/__tests__/FlowPage.test.tsx +79 -0
  84. package/src/flow/__tests__/FlowRoute.test.tsx +529 -2
  85. package/src/flow/actions/__tests__/linkageRules.subFormSetFieldProps.test.ts +191 -0
  86. package/src/flow/actions/__tests__/openView.subModelKey.test.tsx +33 -0
  87. package/src/flow/actions/aclCheck.tsx +4 -0
  88. package/src/flow/actions/aclCheckRefresh.tsx +4 -0
  89. package/src/flow/actions/dateTimeFormat.tsx +12 -8
  90. package/src/flow/actions/linkageRules.tsx +122 -0
  91. package/src/flow/actions/openView.tsx +28 -4
  92. package/src/flow/admin-shell/AdminLayoutRouteCoordinator.ts +11 -329
  93. package/src/flow/admin-shell/BaseLayoutModel.tsx +455 -0
  94. package/src/flow/admin-shell/BaseLayoutRouteCoordinator.ts +502 -0
  95. package/src/flow/admin-shell/__tests__/AdminLayoutRouteCoordinator.test.ts +547 -3
  96. package/src/flow/admin-shell/admin-layout/AdminLayoutComponent.tsx +4 -4
  97. package/src/flow/admin-shell/admin-layout/AdminLayoutEntryGuard.tsx +160 -0
  98. package/src/flow/admin-shell/admin-layout/AdminLayoutMenuModels.tsx +0 -12
  99. package/src/flow/admin-shell/admin-layout/AdminLayoutModel.tsx +28 -201
  100. package/src/flow/admin-shell/admin-layout/AdminLayoutSlotModels.tsx +11 -2
  101. package/src/flow/admin-shell/admin-layout/__tests__/AdminLayoutMenuModels.test.ts +1 -26
  102. package/src/flow/admin-shell/admin-layout/__tests__/AdminLayoutModel.test.tsx +149 -27
  103. package/src/flow/admin-shell/admin-layout/index.ts +2 -0
  104. package/src/flow/admin-shell/useAdminLayoutRoutePage.ts +10 -26
  105. package/src/flow/admin-shell/useLayoutRoutePage.ts +61 -0
  106. package/src/flow/components/AdminLayout.tsx +4 -154
  107. package/src/flow/components/FlowRoute.tsx +105 -15
  108. package/src/flow/components/filter/index.ts +3 -0
  109. package/src/flow/components/filter/useFilterOptions.ts +80 -0
  110. package/src/flow/index.ts +4 -0
  111. package/src/flow/models/base/ActionModel.tsx +8 -1
  112. package/src/flow/models/base/PageModel/PageModel.tsx +51 -18
  113. package/src/flow/models/base/PageModel/RootPageModel.tsx +6 -13
  114. package/src/flow/models/base/PageModel/__tests__/PageModel.test.ts +102 -1
  115. package/src/flow/models/base/RouteModel.tsx +1 -1
  116. package/src/flow/models/blocks/form/FormActionGroupModel.tsx +14 -0
  117. package/src/flow/models/blocks/form/FormItemModel.tsx +8 -1
  118. package/src/flow/models/blocks/form/__tests__/FormActionGroupModel.test.ts +46 -0
  119. package/src/flow/models/blocks/form/submitValues.ts +4 -1
  120. package/src/flow/models/blocks/table/TableBlockModel.tsx +118 -16
  121. package/src/flow/models/blocks/table/__tests__/TableBlockModel.rowSelection.test.tsx +114 -0
  122. package/src/flow/models/fields/AssociationFieldModel/SubFormFieldModel.tsx +7 -1
  123. package/src/flow/models/fields/AssociationFieldModel/SubTableFieldModel/SubTableField.tsx +1 -1
  124. package/src/flow/models/fields/AssociationFieldModel/SubTableFieldModel/index.tsx +6 -5
  125. package/src/flow/models/fields/ClickableFieldModel.tsx +9 -1
  126. package/src/flow/models/fields/DisplayTimeFieldModel.tsx +1 -1
  127. package/src/flow/models/fields/TimeFieldModel.tsx +1 -1
  128. package/src/flow/models/fields/__tests__/TimeFieldModel.test.tsx +61 -0
  129. package/src/flow/models/fields/mobile-components/MobileDatePicker.tsx +19 -3
  130. package/src/flow/models/fields/mobile-components/__tests__/MobileDatePicker.test.tsx +94 -0
  131. package/src/flow/models/topbar/TopbarActionModel.tsx +1 -1
  132. package/src/flow/utils/__tests__/dateTimeFormat.test.ts +91 -0
  133. package/src/index.ts +2 -0
  134. package/src/layout-manager/LayoutContentRoute.tsx +90 -0
  135. package/src/layout-manager/LayoutManager.tsx +185 -0
  136. package/src/layout-manager/LayoutRoute.tsx +138 -0
  137. package/src/layout-manager/__tests__/LayoutManager.test.tsx +335 -0
  138. package/src/layout-manager/__tests__/LayoutRoute.test.tsx +473 -0
  139. package/src/layout-manager/index.ts +14 -0
  140. package/src/layout-manager/types.ts +22 -0
  141. package/src/layout-manager/utils.ts +37 -0
  142. package/src/nocobase-buildin-plugin/index.tsx +69 -67
  143. package/src/nocobase-buildin-plugin/plugins/LocalePlugin.ts +1 -0
  144. package/src/settings-center/index.ts +1 -1
  145. package/src/settings-center/plugin-manager/BulkEnableButton.tsx +111 -0
  146. package/src/settings-center/plugin-manager/PluginCard.tsx +270 -0
  147. package/src/settings-center/plugin-manager/PluginDetail.tsx +195 -0
  148. package/src/settings-center/plugin-manager/index.tsx +254 -0
  149. package/src/settings-center/plugin-manager/types.ts +35 -0
  150. package/src/settings-center/utils.tsx +8 -1
  151. package/src/theme/__tests__/globalStyles.test.ts +24 -0
  152. package/src/theme/globalStyles.ts +10 -0
  153. package/src/utils/globalDeps.ts +2 -0
  154. package/src/settings-center/PluginManagerPage.tsx +0 -162
@@ -0,0 +1,89 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import { type FlowEngine, FlowModel, type ViewParam } from '@nocobase/flow-engine';
10
+ import { BaseLayoutRouteCoordinator, type BaseLayoutRouteCoordinatorOptions, type RoutePageMeta } from './BaseLayoutRouteCoordinator';
11
+ import type { LayoutDefinition } from '../../layout-manager/types';
12
+ export type BaseLayoutStructure = {
13
+ subModels?: Record<string, FlowModel[]>;
14
+ };
15
+ export type GetLayoutModelOptions<TModel extends FlowModel = BaseLayoutModel> = {
16
+ required?: boolean;
17
+ create?: boolean;
18
+ props?: any;
19
+ use?: new (...args: any[]) => TModel;
20
+ };
21
+ export type LayoutRouteMatch = {
22
+ type: 'root';
23
+ pathname: string;
24
+ basePathname: string;
25
+ relativePath: string;
26
+ } | {
27
+ type: 'page';
28
+ pathname: string;
29
+ basePathname: string;
30
+ relativePath: string;
31
+ pageUid: string;
32
+ tabUid?: string;
33
+ viewStack: ViewParam[];
34
+ } | {
35
+ type: 'notFound';
36
+ pathname: string;
37
+ basePathname: string;
38
+ relativePath: string;
39
+ };
40
+ export interface LayoutRouteLike {
41
+ id?: string;
42
+ name?: string;
43
+ pathname?: string;
44
+ params?: Record<string, string | undefined>;
45
+ layoutRouteName?: string;
46
+ layoutBasePathname?: string;
47
+ }
48
+ /**
49
+ * 通用 Layout 运行时模型。
50
+ *
51
+ * 该模型封装页面路由桥接、弹窗路由、page tab 路由、布局容器和移动端状态,
52
+ * Admin、Embed 等具体 Layout 只需要继承并实现各自的渲染和专属业务能力。
53
+ */
54
+ export declare class BaseLayoutModel<TStructure extends BaseLayoutStructure = BaseLayoutStructure> extends FlowModel<TStructure> {
55
+ isMobileLayout: boolean;
56
+ currentLayoutRoute: LayoutRouteMatch | null;
57
+ protected routeCoordinator?: BaseLayoutRouteCoordinator;
58
+ private activePageUid;
59
+ private layoutContentElement;
60
+ private readonly routePageMetaMap;
61
+ private contextBindingsActive;
62
+ constructor(options: any);
63
+ registerRoutePage(pageUid: string, meta: RoutePageMeta): import("..").RouteModel<import("@nocobase/flow-engine").DefaultStructure>;
64
+ updateRoutePage(pageUid: string, meta: Partial<RoutePageMeta>): void;
65
+ unregisterRoutePage(pageUid: string): void;
66
+ setLayoutContentElement(element: HTMLElement | null): void;
67
+ setIsMobileLayout(isMobileLayout: boolean): void;
68
+ getCurrentRouteByPageUid(pageUid: string): any;
69
+ get layout(): LayoutDefinition;
70
+ getCoordinator(): BaseLayoutRouteCoordinator;
71
+ protected createRouteCoordinator(): BaseLayoutRouteCoordinator;
72
+ protected getRouteCoordinatorOptions(): BaseLayoutRouteCoordinatorOptions;
73
+ protected getPageUidFromRoute(route: any): any;
74
+ isLayoutContentRoute(routeLike: LayoutRouteLike): boolean;
75
+ resolveLayoutRoute(routeLike: LayoutRouteLike): LayoutRouteMatch;
76
+ getPageUidFromLayoutRoute(match: LayoutRouteMatch | null | undefined): string;
77
+ syncLayoutRoute(routeLike: LayoutRouteLike): LayoutRouteMatch;
78
+ clearLayoutRoute(routeLike?: LayoutRouteLike): void;
79
+ protected onMount(): void;
80
+ protected onUnmount(): void;
81
+ private setupContextBindings;
82
+ private teardownRuntime;
83
+ private getCurrentRouteByActivePage;
84
+ private getCurrentCoordinatorRouteLike;
85
+ }
86
+ /**
87
+ * 按固定 UID 获取或创建 Layout host model。
88
+ */
89
+ export declare function getLayoutModel<TModel extends FlowModel = BaseLayoutModel>(flowEngine: FlowEngine, uid: string, options?: GetLayoutModelOptions<TModel>): TModel;
@@ -0,0 +1,74 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import { FlowEngine, type FlowContext, type ViewParam } from '@nocobase/flow-engine';
10
+ import { RouteModel } from '../models/base/RouteModel';
11
+ import type { LayoutDefinition } from '../../layout-manager/types';
12
+ export interface RoutePageMeta {
13
+ active: boolean;
14
+ refreshDesktopRoutes?: () => Promise<unknown>;
15
+ layoutContentElement?: HTMLElement | null;
16
+ }
17
+ export interface BaseLayoutRouteCoordinatorOptions {
18
+ layout?: LayoutDefinition;
19
+ layoutContext?: FlowContext;
20
+ basePathname?: string;
21
+ }
22
+ interface RouteLike {
23
+ layoutRouteName?: string;
24
+ params?: {
25
+ name?: string;
26
+ };
27
+ pathname?: string;
28
+ pageUid?: string;
29
+ layoutBasePathname?: string;
30
+ layoutRoute?: {
31
+ type: string;
32
+ pageUid?: string;
33
+ basePathname?: string;
34
+ } | null;
35
+ }
36
+ /**
37
+ * 通用 Layout 路由协调器。
38
+ *
39
+ * 负责把当前路由路径解析为 v2 view stack,并驱动 RouteModel 上的弹窗、抽屉和 page tab 状态。
40
+ * Admin、Embed 等布局只需要提供当前 Layout 的基准路径,即可复用同一套 view 编排逻辑。
41
+ */
42
+ export declare class BaseLayoutRouteCoordinator {
43
+ protected readonly flowEngine: FlowEngine;
44
+ protected readonly layout: LayoutDefinition | undefined;
45
+ private readonly layoutContext?;
46
+ private basePathname;
47
+ private readonly runtimes;
48
+ private layoutContentElement;
49
+ constructor(flowEngine: FlowEngine, options?: BaseLayoutRouteCoordinatorOptions);
50
+ setLayoutContentElement(element: HTMLElement | null): void;
51
+ registerPage(pageUid: string, meta: RoutePageMeta): RouteModel<import("@nocobase/flow-engine").DefaultStructure>;
52
+ syncPageMeta(pageUid: string, meta: Partial<RoutePageMeta>): void;
53
+ unregisterPage(pageUid: string): void;
54
+ syncRoute(routeLike: RouteLike): void;
55
+ cleanupPage(pageUid: string): void;
56
+ destroy(): void;
57
+ protected getCurrentRouteByPageUid(pageUid: string): any;
58
+ private setRuntimeActive;
59
+ private notifyRuntimeActiveChange;
60
+ private syncRuntimeWithPathname;
61
+ private syncViewListVisibility;
62
+ private shouldStepNavigate;
63
+ private scheduleInitialDeepLinkReplay;
64
+ private stepNavigate;
65
+ private handleOpenViews;
66
+ private openViews;
67
+ private ensureRouteModelContext;
68
+ private getOrCreateRouteModel;
69
+ }
70
+ /**
71
+ * 将 pathname 解析结果和 pageUid 对齐,便于测试里复用。
72
+ */
73
+ export declare function toViewStack(pathname: string, options?: BaseLayoutRouteCoordinatorOptions): ViewParam[];
74
+ export {};
@@ -0,0 +1,12 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import React, { type FC } from 'react';
10
+ export declare const AdminLayoutEntryGuard: FC<{
11
+ children: React.ReactNode;
12
+ }>;
@@ -7,22 +7,18 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
  import { type FlowEngine, FlowModel } from '@nocobase/flow-engine';
10
+ import React from 'react';
10
11
  import type { NocoBaseDesktopRoute } from '../../../flow-compat';
11
- import { type RoutePageMeta } from '../AdminLayoutRouteCoordinator';
12
+ import { AdminLayoutRouteCoordinator } from '../AdminLayoutRouteCoordinator';
13
+ import { BaseLayoutModel, type BaseLayoutStructure, type GetLayoutModelOptions } from '../BaseLayoutModel';
12
14
  import { type AdminLayoutMenuItemModel } from './AdminLayoutMenuModels';
13
15
  import { type AdminLayoutMenuRouteOptions } from './AdminLayoutMenuUtils';
14
- import React from 'react';
15
- export type AdminLayoutStructure = {
16
+ export type AdminLayoutStructure = BaseLayoutStructure & {
16
17
  subModels: {
17
18
  menuItems?: AdminLayoutMenuItemModel[];
18
19
  };
19
20
  };
20
- type GetAdminLayoutModelOptions<TModel extends FlowModel = AdminLayoutModel> = {
21
- required?: boolean;
22
- create?: boolean;
23
- props?: any;
24
- use?: new (...args: any[]) => TModel;
25
- };
21
+ type GetAdminLayoutModelOptions<TModel extends FlowModel = AdminLayoutModel> = GetLayoutModelOptions<TModel>;
26
22
  /**
27
23
  * Admin Layout 的纯运行时 host model。
28
24
  *
@@ -35,14 +31,8 @@ type GetAdminLayoutModelOptions<TModel extends FlowModel = AdminLayoutModel> = {
35
31
  * model.syncMenuRoutes(routes);
36
32
  * ```
37
33
  */
38
- export declare class AdminLayoutModel extends FlowModel<AdminLayoutStructure> {
39
- isMobileLayout: boolean;
34
+ export declare class AdminLayoutModel extends BaseLayoutModel<AdminLayoutStructure> {
40
35
  menuRouteRefreshVersion: number;
41
- private routeCoordinator?;
42
- private routeDisposer?;
43
- private activePageUid;
44
- private layoutContentElement;
45
- private readonly routePageMetaMap;
46
36
  constructor(options: any);
47
37
  /**
48
38
  * 通知 Layout 重新生成 ProLayout 菜单路由。
@@ -50,29 +40,6 @@ export declare class AdminLayoutModel extends FlowModel<AdminLayoutStructure> {
50
40
  * @returns {void}
51
41
  */
52
42
  refreshMenuRouteTree(): void;
53
- /**
54
- * 注册页面运行时信息。
55
- *
56
- * @param {string} pageUid 页面 UID
57
- * @param {RoutePageMeta} meta 页面运行时元数据
58
- * @returns {FlowModel} 对应的页面模型
59
- */
60
- registerRoutePage(pageUid: string, meta: RoutePageMeta): FlowModel<import("@nocobase/flow-engine").DefaultStructure>;
61
- /**
62
- * 更新页面运行时信息。
63
- *
64
- * @param {string} pageUid 页面 UID
65
- * @param {Partial<RoutePageMeta>} meta 待更新的页面元数据
66
- * @returns {void}
67
- */
68
- updateRoutePage(pageUid: string, meta: Partial<RoutePageMeta>): void;
69
- /**
70
- * 注销页面运行时信息。
71
- *
72
- * @param {string} pageUid 页面 UID
73
- * @returns {void}
74
- */
75
- unregisterRoutePage(pageUid: string): void;
76
43
  /**
77
44
  * 使用当前可访问菜单路由刷新 Layout 菜单树。
78
45
  *
@@ -90,59 +57,7 @@ export declare class AdminLayoutModel extends FlowModel<AdminLayoutStructure> {
90
57
  path: string;
91
58
  children: import("./AdminLayoutMenuUtils").AdminLayoutMenuNode[];
92
59
  };
93
- /**
94
- * 设置布局内容容器元素。
95
- *
96
- * @param {HTMLElement | null} element 布局内容容器
97
- * @returns {void}
98
- */
99
- setLayoutContentElement(element: HTMLElement | null): void;
100
- /**
101
- * 设置是否为移动端布局。
102
- *
103
- * @param {boolean} isMobileLayout 是否为移动端布局
104
- * @returns {void}
105
- */
106
- setIsMobileLayout(isMobileLayout: boolean): void;
107
- protected onMount(): void;
108
- protected onUnmount(): void;
109
- /**
110
- * 安装运行时上下文属性。
111
- *
112
- * @returns {void}
113
- */
114
- private setupContextBindings;
115
- /**
116
- * 安装路由同步 reaction。
117
- *
118
- * @returns {void}
119
- */
120
- private setupRouteReaction;
121
- /**
122
- * 释放运行时状态。
123
- *
124
- * @returns {void}
125
- */
126
- private teardownRuntime;
127
- /**
128
- * 获取当前激活页面对应的路由对象。
129
- *
130
- * @returns {any} 当前激活页面对应的路由对象
131
- */
132
- private getCurrentRouteByActivePage;
133
- /**
134
- * 根据页面 UID 获取路由对象。
135
- *
136
- * @param {string} pageUid 页面 UID
137
- * @returns {any} 路由对象
138
- */
139
- private getCurrentRouteByPageUid;
140
- /**
141
- * 懒加载页面路由协调器。
142
- *
143
- * @returns {AdminLayoutRouteCoordinator} 路由协调器实例
144
- */
145
- private getCoordinator;
60
+ protected createRouteCoordinator(): AdminLayoutRouteCoordinator;
146
61
  render(): React.JSX.Element;
147
62
  }
148
63
  /**
@@ -8,6 +8,8 @@
8
8
  */
9
9
  export * from './AdminLayoutComponent';
10
10
  export * from './AdminLayoutModel';
11
+ export * from '../BaseLayoutModel';
12
+ export * from '../BaseLayoutRouteCoordinator';
11
13
  export * from './AdminLayoutSlotModels';
12
14
  export * from './AdminLayoutMenuModels';
13
15
  export * from './AdminLayoutMenuFlowUtils';
@@ -6,14 +6,14 @@
6
6
  * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
- /// <reference types="react" />
10
9
  import type { FlowEngine } from '@nocobase/flow-engine';
10
+ import type { RefObject } from 'react';
11
11
  import { type AdminLayoutModel } from './admin-layout/AdminLayoutModel';
12
12
  type UseAdminLayoutRoutePageOptions = {
13
13
  flowEngine: FlowEngine;
14
14
  pageUid: string;
15
15
  refreshDesktopRoutes?: () => Promise<unknown>;
16
- layoutContentRef: React.RefObject<HTMLDivElement>;
16
+ layoutContentRef: RefObject<HTMLDivElement>;
17
17
  };
18
18
  /**
19
19
  * 把 FlowRoute 页面的生命周期桥接到 AdminLayout host model。
@@ -0,0 +1,23 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import type { FlowEngine } from '@nocobase/flow-engine';
10
+ import { type RefObject } from 'react';
11
+ import type { BaseLayoutModel } from './BaseLayoutModel';
12
+ export type UseLayoutRoutePageOptions<TModel extends BaseLayoutModel = BaseLayoutModel> = {
13
+ flowEngine: FlowEngine;
14
+ pageUid: string;
15
+ active?: boolean;
16
+ refreshDesktopRoutes?: () => Promise<unknown>;
17
+ layoutContentRef: RefObject<HTMLElement>;
18
+ getLayoutModel: (flowEngine: FlowEngine) => TModel | undefined;
19
+ };
20
+ /**
21
+ * 把 FlowRoute 页面的生命周期桥接到指定 Layout host model。
22
+ */
23
+ export declare function useLayoutRoutePage<TModel extends BaseLayoutModel = BaseLayoutModel>(options: UseLayoutRoutePageOptions<TModel>): TModel;
@@ -6,7 +6,16 @@
6
6
  * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
+ import { type FlowEngine } from '@nocobase/flow-engine';
9
10
  import React from 'react';
11
+ import { type BaseLayoutModel } from '../admin-shell/BaseLayoutModel';
12
+ export type LegacyPageBehavior = 'redirect' | 'notFound' | 'bridge';
13
+ export type FlowRouteProps = {
14
+ pageUid?: string;
15
+ active?: boolean;
16
+ getLayoutModel?: (flowEngine: FlowEngine) => BaseLayoutModel | undefined;
17
+ legacyPageBehavior?: LegacyPageBehavior;
18
+ };
10
19
  /**
11
20
  * 管理后台动态页面路由组件。
12
21
  *
@@ -22,7 +31,7 @@ import React from 'react';
22
31
  * @throws {Error} 当缺少 `route.params.name` 时抛出异常
23
32
  */
24
33
  declare const FlowRoute: {
25
- (): React.JSX.Element;
34
+ (props?: FlowRouteProps): React.JSX.Element;
26
35
  displayName: string;
27
36
  };
28
37
  export default FlowRoute;
@@ -14,3 +14,5 @@ export { VariableFilterItem } from './VariableFilterItem';
14
14
  export type { VariableFilterItemProps, VariableFilterItemValue } from './VariableFilterItem';
15
15
  export { LinkageFilterItem } from './LinkageFilterItem';
16
16
  export type { LinkageFilterItemProps, LinkageFilterItemValue } from './LinkageFilterItem';
17
+ export { useFilterOptions } from './useFilterOptions';
18
+ export type { FilterOption, UseFilterOptionsArgs } from './useFilterOptions';
@@ -0,0 +1,54 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import type { Collection } from '@nocobase/flow-engine';
10
+ /**
11
+ * One operator entry on a `FilterOption`. Mirrors v1's interface-defined operator shape so the v2 filter value renderer can pick up the same per-operator value-side schema (e.g. datetime operators wanting the smart date picker, array/enum operators wanting a tag-mode Select).
12
+ */
13
+ export type FilterOperator = {
14
+ value: string;
15
+ label: string;
16
+ /**
17
+ * Per-operator override for the value-side renderer. Wins over the field's own `uiSchema` when set. The `x-component` string is looked up against the v2 filter component registry.
18
+ */
19
+ schema?: {
20
+ 'x-component'?: string;
21
+ 'x-component-props'?: Record<string, any>;
22
+ } & Record<string, any>;
23
+ /** Operator takes no right-hand value (e.g. `$empty`, `$notEmpty`). */
24
+ noValue?: boolean;
25
+ [key: string]: any;
26
+ };
27
+ /** Single field-tree node returned by `useFilterOptions`. */
28
+ export type FilterOption = {
29
+ name: string;
30
+ type?: string;
31
+ target?: string;
32
+ title: string;
33
+ schema?: Record<string, any>;
34
+ operators?: FilterOperator[];
35
+ children?: FilterOption[];
36
+ };
37
+ export interface UseFilterOptionsArgs {
38
+ /**
39
+ * Whitelist of root-level field names to expose. Empty/undefined means "all filterable fields". The whitelist applies only at depth 1 — nested fields under an allowed association field are always included, matching the legacy v1 `Filter.Action` behaviour.
40
+ */
41
+ filterableFieldNames?: string[];
42
+ /** Bypass the `filterableFieldNames` whitelist (mirrors v1 `noIgnore`). */
43
+ noIgnore?: boolean;
44
+ /** Translator used for field/operator labels. Defaults to identity. */
45
+ t?: (key: string) => string;
46
+ }
47
+ /**
48
+ * v2 equivalent of v1's `useFilterOptions`/`useFilterFieldOptions`. Walks a `Collection`'s fields and returns the nested option tree consumed by antd `Cascader` in `CollectionFilterItem` (and any other v2 filter surface that wants the same field picker).
49
+ *
50
+ * Mirrors v1 in two ways that matter:
51
+ * - association fields (belongsTo / hasMany / m2m / etc.) are kept and recursed into via `fieldsToOptions`'s `nested` branch — so picking `user.username` is a first-class action, just like the legacy cascader.
52
+ * - the whitelist applies at depth 1 only, so capping the root field list (e.g. to `['lockedTs', 'unlockTs', 'user']`) doesn't accidentally hide the nested `user.username` / `user.nickname` leaves.
53
+ */
54
+ export declare function useFilterOptions(collection: Collection | undefined, args?: UseFilterOptionsArgs): FilterOption[];
@@ -23,7 +23,11 @@ export * from './utils';
23
23
  export * from './actions';
24
24
  export * from './system-settings';
25
25
  export * from './admin-shell/admin-layout';
26
+ export * from './admin-shell/BaseLayoutModel';
27
+ export * from './admin-shell/BaseLayoutRouteCoordinator';
26
28
  export * from './admin-shell/AdminLayoutRouteCoordinator';
29
+ export * from './admin-shell/useLayoutRoutePage';
30
+ export * from './admin-shell/useAdminLayoutRoutePage';
27
31
  export * from '../settings-center';
28
32
  export { openViewFlow } from './flows/openViewFlow';
29
33
  export { editMarkdownFlow } from './flows/editMarkdownFlow';
@@ -32,9 +32,11 @@ export declare class PageModel extends FlowModel<PageModelStructure> {
32
32
  private getEnableTabs;
33
33
  private getActiveTabKey;
34
34
  private scheduleActiveLifecycleRefresh;
35
+ activateCurrentTab(forceRefresh?: boolean): void;
36
+ deactivateCurrentTab(): void;
35
37
  onMount(): void;
36
38
  protected onUnmount(): void;
37
- invokeTabModelLifecycleMethod(tabActiveKey: string, method: 'onActive' | 'onInactive', forceRefresh?: boolean): void;
39
+ invokeTabModelLifecycleMethod(tabActiveKey: string | undefined, method: 'onActive' | 'onInactive', forceRefresh?: boolean): void;
38
40
  /**
39
41
  * Resolve configured document title template and update browser tab title.
40
42
  * Priority:
@@ -10,4 +10,5 @@ import { ActionGroupModel } from '../../base/ActionGroupModel';
10
10
  import { FormActionModel } from './FormActionModel';
11
11
  export declare class FormActionGroupModel extends ActionGroupModel {
12
12
  static baseClass: typeof FormActionModel;
13
+ static defineChildren(ctx: any): Promise<any[]>;
13
14
  }
@@ -61,8 +61,18 @@ export declare class TableBlockModel extends CollectionBlockModel<TableBlockMode
61
61
  cell: React.MemoExoticComponent<import("@formily/reactive-react").ReactFC<Omit<any, "ref">>>;
62
62
  };
63
63
  };
64
+ isRowSelectionEnabled(): boolean;
65
+ isShowIndexEnabled(): boolean;
66
+ getRecordIndex(record: Record<string, unknown>, index: number): string | number;
67
+ getLeftAuxiliaryColumn(): {
68
+ key: string;
69
+ width: number;
70
+ align: "center";
71
+ render: (_value: unknown, record: Record<string, unknown>, index: number) => React.JSX.Element;
72
+ };
64
73
  renderCell: (checked: any, record: any, index: any, originNode: any) => any;
65
74
  renderConfigureActions(): React.JSX.Element;
75
+ shouldRenderAction(action: ActionModel, isConfigMode: boolean): boolean;
66
76
  pagination(): import("antd").PaginationProps;
67
77
  renderComponent(): React.JSX.Element;
68
78
  }
@@ -8,7 +8,7 @@ export declare class SubTableFieldModel extends AssociationFieldModel {
8
8
  updateAssociation: boolean;
9
9
  setCurrentPage: any;
10
10
  currentPageSize: any;
11
- getCurrentValue: () => any[];
11
+ getCurrentValue(): any[];
12
12
  get collection(): any;
13
13
  getColumns(): any;
14
14
  render(): React.JSX.Element;
@@ -6,4 +6,4 @@
6
6
  * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
- export declare const getStrength: (val: any) => 60 | 0 | 20 | 100 | 80 | 40;
9
+ export declare const getStrength: (val: any) => 60 | 0 | 100 | 80 | 40 | 20;
package/es/index.d.ts CHANGED
@@ -24,12 +24,14 @@ export * from './WebSocketClient';
24
24
  export * from './RouterManager';
25
25
  export * from './PluginManager';
26
26
  export * from './PluginSettingsManager';
27
+ export * from './layout-manager';
27
28
  export * from './hooks';
28
29
  export { default as languageCodes } from './locale/languageCodes';
29
30
  export * from './nocobase-buildin-plugin';
30
31
  export * from './collection-field-interface/CollectionFieldInterface';
31
32
  export * from './collection-field-interface/CollectionFieldInterfaceManager';
32
33
  export * from './collection-manager/interfaces';
34
+ export * from './data-source';
33
35
  export * from './flow';
34
36
  export { DEFAULT_DATA_SOURCE_KEY, isTitleField, isTitleFieldInterface } from './flow-compat';
35
37
  export { default as AntdAppProvider } from './theme/AntdAppProvider';