@nocobase/client-v2 2.2.0-alpha.2 → 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.
- package/es/RouteRepository.d.ts +8 -0
- package/es/authRedirect.d.ts +1 -0
- package/es/components/form/TypedVariableInput.d.ts +9 -1
- package/es/components/form/filter/CollectionFilter.d.ts +2 -0
- package/es/components/form/filter/CollectionFilterPanel.d.ts +2 -0
- package/es/components/form/filter/useFilterActionProps.d.ts +2 -0
- package/es/flow/models/blocks/form/value-runtime/runtime.d.ts +9 -0
- package/es/flow/models/blocks/js-block/JSBlock.d.ts +1 -0
- package/es/index.d.ts +2 -0
- package/es/index.mjs +148 -116
- package/es/utils/getRouteRuntimeVersion.d.ts +23 -0
- package/es/utils/index.d.ts +1 -0
- package/lib/index.js +149 -117
- package/package.json +7 -7
- package/src/RouteRepository.ts +25 -0
- package/src/__tests__/RouteRepository.test.ts +23 -0
- package/src/__tests__/authRedirect.test.ts +17 -0
- package/src/__tests__/getRouteRuntimeVersion.test.ts +68 -0
- package/src/authRedirect.ts +38 -0
- package/src/components/form/JsonTextArea.tsx +4 -0
- package/src/components/form/TypedVariableInput.tsx +58 -34
- package/src/components/form/__tests__/TypedVariableInput.test.tsx +54 -0
- package/src/components/form/filter/CollectionFilter.tsx +4 -0
- package/src/components/form/filter/CollectionFilterPanel.tsx +4 -0
- package/src/components/form/filter/__tests__/useFilterActionProps.test.tsx +95 -0
- package/src/components/form/filter/useFilterActionProps.ts +37 -6
- package/src/flow/actions/dateTimeFormat.tsx +2 -2
- package/src/flow/admin-shell/BaseLayoutModel.tsx +13 -0
- package/src/flow/admin-shell/admin-layout/AdminLayoutEntryGuard.test.tsx +177 -1
- package/src/flow/admin-shell/admin-layout/AdminLayoutEntryGuard.tsx +20 -0
- package/src/flow/admin-shell/admin-layout/__tests__/AdminLayoutModel.test.tsx +77 -0
- package/src/flow/models/base/ActionModelCore.tsx +6 -4
- package/src/flow/models/base/__tests__/ActionModelCore.render.test.tsx +37 -0
- package/src/flow/models/blocks/form/value-runtime/__tests__/runtime.test.ts +87 -0
- package/src/flow/models/blocks/form/value-runtime/runtime.ts +91 -0
- package/src/flow/models/blocks/js-block/JSBlock.tsx +223 -2
- package/src/flow/models/blocks/js-block/__tests__/JSBlockModel.test.tsx +150 -0
- package/src/flow/models/blocks/table/TableColumnModel.tsx +6 -2
- package/src/flow/models/blocks/table/__tests__/TableColumnModel.test.tsx +51 -0
- package/src/flow/models/fields/AssociationFieldModel/RecordSelectFieldModel.tsx +45 -13
- package/src/flow/utils/__tests__/dateTimeFormat.test.ts +42 -0
- package/src/index.ts +2 -0
- package/src/utils/getRouteRuntimeVersion.ts +185 -0
- package/src/utils/index.tsx +1 -0
package/es/RouteRepository.d.ts
CHANGED
|
@@ -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 {};
|
package/es/authRedirect.d.ts
CHANGED
|
@@ -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
|
*/
|
|
@@ -12,6 +12,10 @@ import type { FormAssignRuleItem, NamePath, Patch, SetOptions } from './types';
|
|
|
12
12
|
type FormBlockModel = FlowModel & {
|
|
13
13
|
getAclActionName?: () => string;
|
|
14
14
|
};
|
|
15
|
+
export type FormValuePatch = {
|
|
16
|
+
path: NamePath;
|
|
17
|
+
value: unknown;
|
|
18
|
+
};
|
|
15
19
|
export declare class FormValueRuntime {
|
|
16
20
|
private readonly model;
|
|
17
21
|
private readonly getForm;
|
|
@@ -50,6 +54,8 @@ export declare class FormValueRuntime {
|
|
|
50
54
|
syncAssignRules(items: FormAssignRuleItem[]): void;
|
|
51
55
|
get formValues(): any;
|
|
52
56
|
getFormValuesSnapshot(): any;
|
|
57
|
+
getUserEditedValuePatches(): FormValuePatch[];
|
|
58
|
+
getUserEditedValuesSnapshot(): Record<string, unknown>;
|
|
53
59
|
private toMirrorSnapshot;
|
|
54
60
|
canApplyDefaultValuePatch(namePath: NamePath, resolved: any): boolean;
|
|
55
61
|
canApplyOverrideValuePatch(namePath: NamePath): boolean;
|
|
@@ -111,6 +117,9 @@ export declare class FormValueRuntime {
|
|
|
111
117
|
private isExplicit;
|
|
112
118
|
private findExplicitHit;
|
|
113
119
|
private findUserEditedHit;
|
|
120
|
+
private findLatestWriteMeta;
|
|
121
|
+
private isCurrentUserEditedPath;
|
|
122
|
+
private omitNonUserDescendantValues;
|
|
114
123
|
private isDescendantPathKey;
|
|
115
124
|
}
|
|
116
125
|
export {};
|
|
@@ -10,6 +10,7 @@ import React from 'react';
|
|
|
10
10
|
import { BlockModel } from '../../base';
|
|
11
11
|
export declare class JSBlockModel extends BlockModel {
|
|
12
12
|
private _mountedOnce;
|
|
13
|
+
get showBlockCard(): boolean;
|
|
13
14
|
renderComponent(): React.ReactNode;
|
|
14
15
|
render(): React.JSX.Element;
|
|
15
16
|
protected onMount(): void;
|
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';
|