@nocobase/client 2.0.0-alpha.67 → 2.0.0-alpha.69

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.
@@ -16,6 +16,7 @@ export declare class APIClient extends APIClientSDK {
16
16
  /** 该值会在 AntdAppProvider 中被重新赋值 */
17
17
  notification: any;
18
18
  cloneInstance(): APIClient;
19
+ getHostname(): string;
19
20
  getHeaders(): {};
20
21
  service(uid: string): Result<any, any>;
21
22
  interceptors(): void;
@@ -14,6 +14,7 @@ interface Props {
14
14
  onChange: (value: any) => void;
15
15
  metaTree: MetaTreeNode[] | (() => Promise<MetaTreeNode[]>);
16
16
  model: FieldModel;
17
+ flags?: Record<string, any>;
17
18
  }
18
19
  export declare const DefaultValue: React.ForwardRefExoticComponent<Partial<Props> & React.RefAttributes<unknown>>;
19
20
  export {};
@@ -7,7 +7,7 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
  import React from 'react';
10
- import { type Completion } from '@codemirror/autocomplete';
10
+ import { type Completion, type CompletionSource } from '@codemirror/autocomplete';
11
11
  import { EditorView } from '@codemirror/view';
12
12
  export declare const EditorCore: React.FC<{
13
13
  value?: string;
@@ -19,5 +19,6 @@ export declare const EditorCore: React.FC<{
19
19
  readonly?: boolean;
20
20
  enableLinter?: boolean;
21
21
  extraCompletions?: Completion[];
22
+ completionSource?: CompletionSource;
22
23
  viewRef: React.MutableRefObject<EditorView | null>;
23
24
  }>;
@@ -0,0 +1,17 @@
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
+ type DocInfoMode = 'simple' | 'full';
10
+ export declare function formatDocInfo(doc: any, options?: {
11
+ /**
12
+ * - `simple`: description + examples
13
+ * - `full`: description + params/returns/ref/disabled + examples
14
+ */
15
+ mode?: DocInfoMode;
16
+ }): string;
17
+ export {};
@@ -0,0 +1,20 @@
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 { Completion, CompletionSource } from '@codemirror/autocomplete';
10
+ type CreateRunJSCompletionSourceOptions = {
11
+ hostCtx: any;
12
+ staticOptions?: Completion[];
13
+ /**
14
+ * Roots that should use FlowContext meta tree to provide deep completions.
15
+ * When omitted/empty, all `ctx.*` roots are enabled.
16
+ */
17
+ metaRoots?: string[];
18
+ };
19
+ export declare function createRunJSCompletionSource({ hostCtx, staticOptions, metaRoots, }: CreateRunJSCompletionSourceOptions): CompletionSource;
20
+ export {};
@@ -19,6 +19,13 @@ export declare class CollectionBlockModel<T = DefaultStructure> extends DataBloc
19
19
  isManualRefresh: boolean;
20
20
  collectionRequired: boolean;
21
21
  private previousBeforeRenderHash;
22
+ private lastSeenDirtyVersion;
23
+ private dirtyRefreshing;
24
+ /**
25
+ * 记录各筛选来源是否活跃(有有效筛选值)
26
+ * key: filterId (筛选器 uid), value: boolean (是否有有效筛选)
27
+ */
28
+ private activeFilterSources;
22
29
  protected onMount(): void;
23
30
  onActive(): void;
24
31
  /**
@@ -28,62 +35,7 @@ export declare class CollectionBlockModel<T = DefaultStructure> extends DataBloc
28
35
  /**
29
36
  * 定义子菜单选项
30
37
  */
31
- static defineChildren(ctx: FlowModelContext): Promise<{
32
- key: string;
33
- label: any;
34
- searchable: boolean;
35
- searchPlaceholder: string;
36
- children: (ctx: any) => {
37
- key: string;
38
- label: any;
39
- useModel: string;
40
- createModelOptions: any;
41
- }[];
42
- }[] | {
43
- key: string;
44
- label: any;
45
- useModel: string;
46
- createModelOptions: any;
47
- }[] | ({
48
- key: string;
49
- label: string;
50
- useModel: string;
51
- createModelOptions: any;
52
- children?: undefined;
53
- } | {
54
- key: string;
55
- label: string;
56
- children: () => {
57
- key: string;
58
- label: string;
59
- useModel: string;
60
- createModelOptions: any;
61
- }[];
62
- useModel?: undefined;
63
- createModelOptions?: undefined;
64
- } | {
65
- key: string;
66
- label: string;
67
- children: {
68
- key: string;
69
- label: any;
70
- searchable: boolean;
71
- searchPlaceholder: string;
72
- children: (ctx: any) => {
73
- key: string;
74
- label: any;
75
- useModel: string;
76
- createModelOptions: any;
77
- }[];
78
- }[] | {
79
- key: string;
80
- label: any;
81
- useModel: string;
82
- createModelOptions: any;
83
- }[];
84
- useModel?: undefined;
85
- createModelOptions?: undefined;
86
- })[]>;
38
+ static defineChildren(ctx: FlowModelContext): Promise<any[]>;
87
39
  get dataSource(): DataSource;
88
40
  get collection(): Collection;
89
41
  get resource(): BaseRecordResource;
@@ -109,6 +61,27 @@ export declare class CollectionBlockModel<T = DefaultStructure> extends DataBloc
109
61
  }[]>;
110
62
  getResourceSettingsInitParams(): ResourceSettingsInitParams;
111
63
  onInit(options: any): void;
64
+ /**
65
+ * 获取数据加载模式
66
+ * @returns 'auto' | 'manual'
67
+ */
68
+ getDataLoadingMode(): 'auto' | 'manual';
69
+ /**
70
+ * 设置指定筛选来源的活跃状态
71
+ * @param filterId 筛选器 uid
72
+ * @param active 是否有有效筛选值
73
+ */
74
+ setFilterActive(filterId: string, active: boolean): void;
75
+ /**
76
+ * 检查是否有任何活跃的筛选来源
77
+ * @returns boolean
78
+ */
79
+ hasActiveFilters(): boolean;
80
+ /**
81
+ * 移除指定筛选来源
82
+ * @param filterId 筛选器 uid
83
+ */
84
+ removeFilterSource(filterId: string): void;
112
85
  createResource(ctx: any, params: any): SingleRecordResource | MultiRecordResource;
113
86
  refresh(): Promise<void>;
114
87
  protected defaultBlockTitle(): string;
@@ -20,7 +20,15 @@ export declare class PageModel extends FlowModel<PageModelStructure> {
20
20
  left?: ReactNode;
21
21
  right?: ReactNode;
22
22
  };
23
+ private viewActivatedListener?;
24
+ private dataSourceDirtyListener?;
25
+ private lastSeenEmitterViewActivatedVersion;
26
+ private dirtyRefreshScheduled;
27
+ private unmounted;
28
+ private getActiveTabKey;
29
+ private scheduleActiveLifecycleRefresh;
23
30
  onMount(): void;
31
+ protected onUnmount(): void;
24
32
  invokeTabModelLifecycleMethod(tabActiveKey: string, method: 'onActive' | 'onInactive'): void;
25
33
  createPageTabModelOptions: () => CreateModelOptions;
26
34
  mapTabs(): {
@@ -6,6 +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
- import { FlowContext } from '@nocobase/flow-engine';
10
- import { FilterFormFieldModel } from '../../filter-form/fields';
11
- export declare const defaultOperator: import("@nocobase/flow-engine").ActionDefinition<FilterFormFieldModel, FlowContext>;
9
+ export declare const defaultOperator: any;
@@ -15,6 +15,7 @@ export declare class CreateFormModel extends FormBlockModel {
15
15
  private actionExtraToolbarItems;
16
16
  createResource(ctx: any, params: any): SingleRecordResource<unknown>;
17
17
  getAclActionName(): string;
18
- submit(params?: any): Promise<void>;
18
+ submitHandler(ctx: any, params: any, cb?: (values?: any, filterByTk?: any) => void): Promise<void>;
19
+ submit(params?: any, cb?: (values?: any, filterByTk?: any) => void): Promise<void>;
19
20
  renderComponent(): React.JSX.Element;
20
21
  }
@@ -18,6 +18,7 @@ export declare class EditFormModel extends FormBlockModel {
18
18
  getCurrentRecord(): any;
19
19
  getAclActionName(): string;
20
20
  handlePageChange: (page: number) => Promise<void>;
21
- submit(params?: any): Promise<void>;
21
+ submitHandler(ctx: any, params: any, cb?: (values?: any, filterByTk?: any) => void): Promise<void>;
22
+ submit(params?: any, cb?: (values?: any, filterByTk?: any) => void): Promise<void>;
22
23
  renderComponent(): React.JSX.Element;
23
24
  }
@@ -22,6 +22,7 @@ type DefaultCollectionBlockModelStructure = {
22
22
  };
23
23
  type CustomFormBlockModelClassesEnum = {};
24
24
  export declare class FormBlockModel<T extends DefaultCollectionBlockModelStructure = DefaultCollectionBlockModelStructure> extends CollectionBlockModel<T> {
25
+ private userModifiedTopLevelFields;
25
26
  get form(): FormInstance<any>;
26
27
  _defaultCustomModelClasses: {
27
28
  FormActionGroupModel: string;
@@ -31,7 +32,22 @@ export declare class FormBlockModel<T extends DefaultCollectionBlockModelStructu
31
32
  customModelClasses: CustomFormBlockModelClassesEnum;
32
33
  renderConfigureActions(): React.JSX.Element;
33
34
  setFieldsValue(values: any): void;
34
- setFieldValue(fieldName: string, value: any): void;
35
+ setFieldValue(fieldName: any, value: any): void;
36
+ /**
37
+ * @internal
38
+ *
39
+ * 仅用于编辑表单刷新保护:只记录「用户交互」触发的改动(来自 antd Form.onValuesChange)。
40
+ * 程序化 setFieldValue/setFieldsValue 不会触发 onValuesChange(见 linkageRules 的手动 emit),因此不会污染该集合。
41
+ */
42
+ markUserModifiedFields(changedValues: any): void;
43
+ /**
44
+ * @internal
45
+ */
46
+ getUserModifiedFields(): Set<string>;
47
+ /**
48
+ * @internal
49
+ */
50
+ resetUserModifiedFields(): void;
35
51
  onDispatchEventStart(eventName: string, options?: any, inputArgs?: Record<string, any>): Promise<void>;
36
52
  getStepParams(flowKey: string, stepKey: string): any | undefined;
37
53
  getStepParams(flowKey: string): Record<string, any> | undefined;
@@ -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 function submitHandler(ctx: any, params: any): Promise<void>;
9
+ export declare function submitHandler(ctx: any, params: any, cb?: (values?: any, filterByTk?: any) => void): Promise<void>;