@nocobase/client-v2 2.2.0-alpha.3 → 2.2.0-alpha.4

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 (36) hide show
  1. package/es/RouteRepository.d.ts +8 -0
  2. package/es/authRedirect.d.ts +1 -0
  3. package/es/components/form/TypedVariableInput.d.ts +9 -1
  4. package/es/components/form/filter/CollectionFilter.d.ts +2 -0
  5. package/es/components/form/filter/CollectionFilterPanel.d.ts +2 -0
  6. package/es/components/form/filter/useFilterActionProps.d.ts +2 -0
  7. package/es/index.d.ts +2 -0
  8. package/es/index.mjs +146 -114
  9. package/es/utils/getRouteRuntimeVersion.d.ts +23 -0
  10. package/es/utils/index.d.ts +1 -0
  11. package/lib/index.js +147 -115
  12. package/package.json +7 -7
  13. package/src/RouteRepository.ts +25 -0
  14. package/src/__tests__/RouteRepository.test.ts +23 -0
  15. package/src/__tests__/authRedirect.test.ts +17 -0
  16. package/src/__tests__/getRouteRuntimeVersion.test.ts +68 -0
  17. package/src/authRedirect.ts +38 -0
  18. package/src/components/form/JsonTextArea.tsx +4 -0
  19. package/src/components/form/TypedVariableInput.tsx +58 -34
  20. package/src/components/form/__tests__/TypedVariableInput.test.tsx +52 -0
  21. package/src/components/form/filter/CollectionFilter.tsx +4 -0
  22. package/src/components/form/filter/CollectionFilterPanel.tsx +4 -0
  23. package/src/components/form/filter/__tests__/useFilterActionProps.test.tsx +95 -0
  24. package/src/components/form/filter/useFilterActionProps.ts +37 -6
  25. package/src/flow/actions/dateTimeFormat.tsx +2 -2
  26. package/src/flow/admin-shell/BaseLayoutModel.tsx +13 -0
  27. package/src/flow/admin-shell/admin-layout/AdminLayoutEntryGuard.test.tsx +177 -1
  28. package/src/flow/admin-shell/admin-layout/AdminLayoutEntryGuard.tsx +20 -0
  29. package/src/flow/admin-shell/admin-layout/__tests__/AdminLayoutModel.test.tsx +77 -0
  30. package/src/flow/models/blocks/table/TableColumnModel.tsx +6 -2
  31. package/src/flow/models/blocks/table/__tests__/TableColumnModel.test.tsx +51 -0
  32. package/src/flow/models/fields/AssociationFieldModel/RecordSelectFieldModel.tsx +45 -13
  33. package/src/flow/utils/__tests__/dateTimeFormat.test.ts +42 -0
  34. package/src/index.ts +2 -0
  35. package/src/utils/getRouteRuntimeVersion.ts +185 -0
  36. package/src/utils/index.tsx +1 -0
@@ -124,6 +124,13 @@ export declare class RouteRepository {
124
124
  * @returns 匹配到的路由节点
125
125
  */
126
126
  getRouteBySchemaUid(schemaUid: string): NocoBaseDesktopRoute | undefined;
127
+ /**
128
+ * 通过路由 id 反查对应路由节点。
129
+ *
130
+ * @param routeId 桌面路由主键
131
+ * @returns 匹配到的路由节点
132
+ */
133
+ getRouteById(routeId: string | number): NocoBaseDesktopRoute | undefined;
127
134
  protected getAPIClient(): APIClient;
128
135
  protected getResource(collectionName: string): import("@nocobase/sdk").IResource;
129
136
  protected emitChange(layoutUid?: string): void;
@@ -135,5 +142,6 @@ export declare class RouteRepository {
135
142
  private nextRefreshRequestId;
136
143
  private getRefreshRequestId;
137
144
  private findRoute;
145
+ private findRouteById;
138
146
  }
139
147
  export {};
@@ -31,6 +31,7 @@ export declare function getModernClientPrefix(): string;
31
31
  export declare function stripModernClientPrefix(publicPath?: string): string;
32
32
  export declare function getV2EffectiveBasePath(app: AppLike): string;
33
33
  declare function getDefaultV2AdminRedirectPath(app: AppLike): string;
34
+ export declare function normalizeV2RedirectPath(app: AppLike, target?: string | null, fallbackPath?: string): string;
34
35
  /**
35
36
  * 将当前 v2 页面地址转换为根相对 redirect 路径。
36
37
  *
@@ -33,7 +33,9 @@ export interface TypedVariableInputProps {
33
33
  * Allowed constant types. The `Constant` switcher entry always exposes a
34
34
  * typed submenu (matching v1 `Variable.Input`) so users can see what type
35
35
  * the constant is, even when only one type is permitted. Default: all four
36
- * supported types.
36
+ * supported types. Passing `[]` switches the component into a variable-only
37
+ * mode: constants/null are hidden, the empty state becomes a readonly
38
+ * placeholder, and clearing a selected variable resets to `null`.
37
39
  */
38
40
  types?: TypedConstantSpec[];
39
41
  /**
@@ -70,6 +72,12 @@ export interface TypedVariableInputProps {
70
72
  defaultToFirstConstantTypeWhenUndefined?: boolean;
71
73
  /** Variable-token delimiters. Default `['{{', '}}']` — see `VariableInput`. */
72
74
  delimiters?: VariableDelimiters;
75
+ /**
76
+ * Hide variable choices from the switcher. In variable-only mode this hides
77
+ * the selector button entirely; in mixed constant/variable mode it keeps the
78
+ * null/constant choices but removes variable entries.
79
+ */
80
+ hideVariable?: boolean;
73
81
  disabled?: boolean;
74
82
  placeholder?: string;
75
83
  style?: React.CSSProperties;
@@ -15,6 +15,8 @@ export interface CollectionFilterProps {
15
15
  collection: Collection | undefined;
16
16
  /** Previously compiled filter param used to seed the editable filter group. */
17
17
  initialValue?: CompiledFilter;
18
+ /** Default compiled filter used both for initial empty state and Reset. */
19
+ defaultValue?: CompiledFilter;
18
20
  /** Called on Submit or Reset with the compiled NocoBase filter param (`undefined` when cleared). */
19
21
  onChange: (filter: CompiledFilter) => void;
20
22
  /** Translator. Defaults to identity. */
@@ -18,6 +18,8 @@ export interface CollectionFilterPanelProps {
18
18
  collection: Collection | undefined;
19
19
  /** Previously compiled filter param used to seed the editable filter group. */
20
20
  initialValue?: CompiledFilter;
21
+ /** Default compiled filter used both for initial empty state and Reset. */
22
+ defaultValue?: CompiledFilter;
21
23
  /** Called when the condition group structure changes or `reset()` is invoked. */
22
24
  onChange?: (filter: CompiledFilter) => void;
23
25
  /** Translator. Defaults to identity. */
@@ -46,6 +46,8 @@ export interface UseFilterActionPropsArgs extends UseFilterOptionsArgs {
46
46
  collection: Collection | undefined;
47
47
  /** Previously compiled filter param used to seed the editable filter group. */
48
48
  initialValue?: CompiledFilter;
49
+ /** Default compiled filter used both for initial empty state and Reset. */
50
+ defaultValue?: CompiledFilter;
49
51
  /**
50
52
  * Called when the user submits or resets the filter popover. Receives the compiled filter param (`undefined` when cleared) and which footer button triggered the call. Typical implementation: `(filter, action) => { listRequest.run(filter); if (action === 'submit') closePopover(); }`.
51
53
  */
package/es/index.d.ts CHANGED
@@ -28,6 +28,8 @@ export * from './layout-manager';
28
28
  export * from './hooks';
29
29
  export { default as languageCodes } from './locale/languageCodes';
30
30
  export * from './nocobase-buildin-plugin';
31
+ export { getRouteRuntimeVersion } from './utils/getRouteRuntimeVersion';
32
+ export type { RouteRuntimeVersion } from './utils/getRouteRuntimeVersion';
31
33
  export * from './collection-field-interface/CollectionFieldInterface';
32
34
  export * from './collection-field-interface/CollectionFieldInterfaceManager';
33
35
  export * from './collection-manager/field-configure';