@nocobase/client-v2 2.1.0-beta.30 → 2.1.0-beta.32
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/BaseApplication.d.ts +1 -0
- package/es/PluginManager.d.ts +1 -0
- package/es/components/form/DrawerFormLayout.d.ts +49 -0
- package/es/components/form/EnvVariableInput.d.ts +42 -0
- package/es/components/form/FileSizeInput.d.ts +27 -0
- package/es/components/form/createFormRegistry.d.ts +33 -0
- package/es/components/form/index.d.ts +13 -0
- package/es/components/index.d.ts +1 -1
- package/es/flow/components/FieldAssignRulesEditor.d.ts +1 -0
- package/es/flow/internal/utils/enumOptionsUtils.d.ts +5 -0
- package/es/flow/models/actions/AssociationActionUtils.d.ts +5 -0
- package/es/flow/models/blocks/filter-form/FilterFormBlockModel.d.ts +4 -0
- package/es/flow/models/blocks/filter-manager/FilterManager.d.ts +5 -1
- package/es/flow/models/blocks/table/TableSelectModel.d.ts +8 -0
- package/es/flow/models/fields/DisplayTitleFieldModel.d.ts +1 -1
- package/es/flow/models/utils/displayValueUtils.d.ts +12 -0
- package/es/flow-compat/passwordUtils.d.ts +1 -1
- package/es/index.mjs +87 -76
- package/es/utils/remotePlugins.d.ts +0 -4
- package/lib/index.js +97 -86
- package/package.json +6 -5
- package/src/BaseApplication.tsx +14 -8
- package/src/PluginManager.ts +1 -0
- package/src/__tests__/app.test.tsx +28 -1
- package/src/__tests__/remotePlugins.test.ts +29 -18
- package/src/components/form/DrawerFormLayout.tsx +103 -0
- package/src/components/form/EnvVariableInput.tsx +126 -0
- package/src/components/form/FileSizeInput.tsx +105 -0
- package/src/components/form/createFormRegistry.ts +60 -0
- package/src/components/form/index.tsx +14 -0
- package/src/components/index.ts +1 -1
- package/src/flow/actions/__tests__/dataScopeFilter.test.ts +92 -13
- package/src/flow/actions/__tests__/linkageRules.subFormSetFieldProps.test.ts +476 -1
- package/src/flow/actions/linkageRules.tsx +240 -258
- package/src/flow/actions/setTargetDataScope.tsx +32 -3
- package/src/flow/components/FieldAssignRulesEditor.tsx +2 -0
- package/src/flow/components/__tests__/FieldAssignRulesEditor.test.tsx +81 -4
- package/src/flow/components/filter/LinkageFilterItem.tsx +9 -2
- package/src/flow/components/filter/VariableFilterItem.tsx +2 -6
- package/src/flow/components/filter/__tests__/LinkageFilterItem.test.tsx +71 -0
- package/src/flow/components/filter/__tests__/VariableFilterItem.test.tsx +48 -0
- package/src/flow/internal/utils/__tests__/enumOptionsUtils.test.ts +10 -1
- package/src/flow/internal/utils/enumOptionsUtils.ts +29 -0
- package/src/flow/models/actions/AssociateActionModel.tsx +2 -2
- package/src/flow/models/actions/AssociationActionUtils.ts +14 -0
- package/src/flow/models/actions/__tests__/AssociationActionModel.test.ts +63 -0
- package/src/flow/models/base/CollectionBlockModel.tsx +7 -0
- package/src/flow/models/blocks/filter-form/FilterFormBlockModel.tsx +33 -9
- package/src/flow/models/blocks/filter-form/FilterFormItemModel.tsx +53 -13
- package/src/flow/models/blocks/filter-form/__tests__/FilterFormItemModel.getFilterValue.test.ts +63 -3
- package/src/flow/models/blocks/filter-form/__tests__/defaultValues.wiring.test.ts +33 -1
- package/src/flow/models/blocks/filter-manager/FilterManager.ts +66 -2
- package/src/flow/models/blocks/filter-manager/__tests__/FilterManager.test.ts +270 -0
- package/src/flow/models/blocks/form/FormBlockModel.tsx +8 -5
- package/src/flow/models/blocks/form/__tests__/FormBlockModel.test.tsx +30 -0
- package/src/flow/models/blocks/form/value-runtime/rules.ts +6 -1
- package/src/flow/models/blocks/form/value-runtime/runtime.ts +6 -1
- package/src/flow/models/blocks/table/TableBlockModel.tsx +11 -6
- package/src/flow/models/blocks/table/TableColumnModel.tsx +3 -0
- package/src/flow/models/blocks/table/TableSelectModel.tsx +36 -26
- package/src/flow/models/blocks/table/__tests__/TableBlockModel.rowClick.test.ts +69 -0
- package/src/flow/models/blocks/table/__tests__/TableColumnModel.test.tsx +96 -1
- package/src/flow/models/blocks/table/__tests__/TableSelectModel.test.ts +41 -0
- package/src/flow/models/fields/ClickableFieldModel.tsx +9 -4
- package/src/flow/models/fields/DisplayTitleFieldModel.tsx +12 -4
- package/src/flow/models/fields/SelectFieldModel.tsx +31 -1
- package/src/flow/models/fields/__tests__/ClickableFieldModel.test.ts +23 -0
- package/src/flow/models/fields/mobile-components/MobileSelect.tsx +2 -1
- package/src/flow/models/fields/mobile-components/__tests__/MobileSelect.test.tsx +7 -0
- package/src/flow/models/utils/displayValueUtils.ts +57 -0
- package/src/utils/globalDeps.ts +2 -0
- package/src/utils/remotePlugins.ts +7 -27
package/es/BaseApplication.d.ts
CHANGED
|
@@ -171,6 +171,7 @@ export declare class ApplicationModel extends FlowModel {
|
|
|
171
171
|
getRouter(): RouterComponentType;
|
|
172
172
|
render(): React.JSX.Element;
|
|
173
173
|
renderMaintaining(): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
174
|
+
renderMaintainingDialog(): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
174
175
|
renderError(): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
175
176
|
renderContent(): React.JSX.Element;
|
|
176
177
|
}
|
package/es/PluginManager.d.ts
CHANGED
|
@@ -0,0 +1,49 @@
|
|
|
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 from 'react';
|
|
10
|
+
export interface DrawerFormLayoutProps {
|
|
11
|
+
/** Header title rendered next to the close (X) button. */
|
|
12
|
+
title: React.ReactNode;
|
|
13
|
+
/** Form body — typically a `<Form>` wrapping `<Form.Item>` fields. */
|
|
14
|
+
children: React.ReactNode;
|
|
15
|
+
/**
|
|
16
|
+
* Called before the drawer is closed by either the Cancel button or the
|
|
17
|
+
* header's X icon. Use for "discard changes" confirmations.
|
|
18
|
+
*/
|
|
19
|
+
onCancel?: () => void | Promise<void>;
|
|
20
|
+
/**
|
|
21
|
+
* Called when the Submit button is clicked. Caller owns validation + the
|
|
22
|
+
* actual API call; the drawer is closed automatically when `onSubmit`
|
|
23
|
+
* resolves. Throw from `onSubmit` to keep the drawer open (e.g. on a
|
|
24
|
+
* validation error).
|
|
25
|
+
*/
|
|
26
|
+
onSubmit?: () => void | Promise<void>;
|
|
27
|
+
/** Drives the Submit button's loading state. */
|
|
28
|
+
submitting?: boolean;
|
|
29
|
+
/** Override the Submit button label. Defaults to "Submit". */
|
|
30
|
+
submitText?: React.ReactNode;
|
|
31
|
+
/** Override the Cancel button label. Defaults to "Cancel". */
|
|
32
|
+
cancelText?: React.ReactNode;
|
|
33
|
+
/**
|
|
34
|
+
* Full override of the footer content. When provided, the default
|
|
35
|
+
* Cancel + Submit buttons are replaced. Useful for forms that need
|
|
36
|
+
* extra actions (e.g. Preview, Save draft).
|
|
37
|
+
*/
|
|
38
|
+
footer?: React.ReactNode;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Standard layout for drawer-hosted forms: a close-icon + title header on
|
|
42
|
+
* top, the caller-provided form body in the middle, and a Cancel + Submit
|
|
43
|
+
* footer at the bottom. Wraps `useFlowView()`'s `Header` / `Footer` slots
|
|
44
|
+
* so the drawer chrome stays consistent across plugins.
|
|
45
|
+
*
|
|
46
|
+
* Callers own the `<Form>` instance, validation, and the actual API call.
|
|
47
|
+
* This component only handles the chrome and the close behaviour.
|
|
48
|
+
*/
|
|
49
|
+
export declare function DrawerFormLayout(props: DrawerFormLayoutProps): React.JSX.Element;
|
|
@@ -0,0 +1,42 @@
|
|
|
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 MetaTreeNode } from '@nocobase/flow-engine';
|
|
10
|
+
import React from 'react';
|
|
11
|
+
/**
|
|
12
|
+
* Convert a stored value like `"{{ $env.foo.bar }}"` back into the
|
|
13
|
+
* `[$env, foo, bar]` path used by the variable picker.
|
|
14
|
+
*/
|
|
15
|
+
export declare function parseEnvPath(value?: string): string[] | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Format a meta tree node back into a `"{{ $env.x.y }}"` server-compatible
|
|
18
|
+
* expression. Used as the `formatPathToValue` converter so the picker output
|
|
19
|
+
* survives a round trip through the API.
|
|
20
|
+
*/
|
|
21
|
+
export declare function formatEnvPath(meta?: MetaTreeNode): string;
|
|
22
|
+
export interface EnvVariableInputProps {
|
|
23
|
+
value?: string;
|
|
24
|
+
onChange?: (value: string) => void;
|
|
25
|
+
addonBefore?: React.ReactNode;
|
|
26
|
+
disabled?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* When true, plain (non-variable) values are masked via `Input.Password`
|
|
29
|
+
* so secret credentials are not displayed verbatim. Variable expressions
|
|
30
|
+
* remain editable through the variable picker even in password mode.
|
|
31
|
+
*/
|
|
32
|
+
password?: boolean;
|
|
33
|
+
placeholder?: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Generic input component for fields that accept either a literal value or a
|
|
37
|
+
* `{{ $env.X }}` reference. The `$env` namespace is wired through the
|
|
38
|
+
* environment-variables plugin's `flowEngine.context.defineProperty('$env', ...)`
|
|
39
|
+
* registration; this component is the single consumption point and degrades
|
|
40
|
+
* gracefully to a plain text input when no env variables are defined.
|
|
41
|
+
*/
|
|
42
|
+
export declare function EnvVariableInput(props: EnvVariableInputProps): React.JSX.Element;
|
|
@@ -0,0 +1,27 @@
|
|
|
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 from 'react';
|
|
10
|
+
export interface FileSizeInputProps {
|
|
11
|
+
value?: number;
|
|
12
|
+
onChange?: (value?: number) => void;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
/** Minimum byte size. Empty / below-min input snaps to this on blur. Defaults to 1. */
|
|
15
|
+
min?: number;
|
|
16
|
+
/** Maximum byte size. Defaults to `Number.POSITIVE_INFINITY`. */
|
|
17
|
+
max?: number;
|
|
18
|
+
/** Default byte size used to derive the initial unit shown when the field is empty. Defaults to 20 MB. */
|
|
19
|
+
defaultValue?: number;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Byte-valued size input paired with a unit selector (Byte / KB / MB / GB).
|
|
23
|
+
* The persisted value is always normalized to bytes; the displayed number is
|
|
24
|
+
* derived from the picked unit. Useful for fields like file-size limits or
|
|
25
|
+
* memory quotas where the natural input unit varies by magnitude.
|
|
26
|
+
*/
|
|
27
|
+
export declare function FileSizeInput(props: FileSizeInputProps): React.JSX.Element;
|
|
@@ -0,0 +1,33 @@
|
|
|
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
|
+
export interface FormRegistryEntry {
|
|
10
|
+
name: string;
|
|
11
|
+
}
|
|
12
|
+
export interface FormRegistry<T extends FormRegistryEntry> {
|
|
13
|
+
readonly namespace: string;
|
|
14
|
+
register(entry: T): void;
|
|
15
|
+
unregister(name: string): boolean;
|
|
16
|
+
get(name: string): T | undefined;
|
|
17
|
+
has(name: string): boolean;
|
|
18
|
+
list(): T[];
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Create an isolated, namespaced registry of form-like entries.
|
|
22
|
+
*
|
|
23
|
+
* Each call returns a fresh registry instance backed by its own closure-scoped
|
|
24
|
+
* `Map`, so plugins do not share state across namespaces. Plugins that need an
|
|
25
|
+
* extension point for form-shaped registrations (e.g. storage configuration
|
|
26
|
+
* forms, data-source connection forms) can build their own typed registry on
|
|
27
|
+
* top of this primitive instead of re-implementing the same boilerplate.
|
|
28
|
+
*
|
|
29
|
+
* Re-registering the same `name` overwrites the previous entry and emits a
|
|
30
|
+
* console warning. This is intentional so HMR / hot reload works without
|
|
31
|
+
* throwing, while still surfacing unintended duplicates during development.
|
|
32
|
+
*/
|
|
33
|
+
export declare function createFormRegistry<T extends FormRegistryEntry>(namespace: string): FormRegistry<T>;
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
export * from './createFormRegistry';
|
|
10
|
+
export * from './DrawerFormLayout';
|
|
11
|
+
export * from './EnvVariableInput';
|
|
12
|
+
export * from './FileSizeInput';
|
|
13
|
+
export * from './JsonTextArea';
|
package/es/components/index.d.ts
CHANGED
|
@@ -19,5 +19,10 @@ type Option = {
|
|
|
19
19
|
} & Record<string, any>;
|
|
20
20
|
export declare function translateOptions(options: Option[], t: (s: string) => string): Option[];
|
|
21
21
|
export declare function enumToOptions(uiEnum: UiSchemaEnumItem[] | undefined, t: (s: string) => string): Option[] | undefined;
|
|
22
|
+
export declare function normalizeSelectRenderValue(value: unknown, props?: Record<string, any>): unknown;
|
|
23
|
+
export declare function getSelectedEnumLabels(value: any, fallbackOptions?: Option[]): Array<{
|
|
24
|
+
value: any;
|
|
25
|
+
label: any;
|
|
26
|
+
}>;
|
|
22
27
|
export declare function ensureOptionsFromUiSchemaEnumIfAbsent(model: FlowModel, collectionField: CollectionField): boolean;
|
|
23
28
|
export {};
|
|
@@ -13,5 +13,10 @@ export declare const getAssociationTargetResourceSettings: (ctx: FlowModelContex
|
|
|
13
13
|
dataSourceKey: any;
|
|
14
14
|
collectionName: any;
|
|
15
15
|
};
|
|
16
|
+
export declare const getAssociationSelectorContextInputArgs: (ctx: FlowModelContext | any) => {
|
|
17
|
+
collectionField: any;
|
|
18
|
+
sourceId: any;
|
|
19
|
+
associatedRecords: any;
|
|
20
|
+
};
|
|
16
21
|
export declare const applyDisassociateAction: (ctx: FlowModelContext | any) => Promise<void>;
|
|
17
22
|
export declare const applyAssociateAction: (ctx: FlowModelContext | any, selectedRows: any[]) => Promise<void>;
|
|
@@ -20,6 +20,8 @@ export declare class FilterFormBlockModel extends FilterBlockModel<{
|
|
|
20
20
|
*/
|
|
21
21
|
autoTriggerFilter: boolean;
|
|
22
22
|
private removeTargetBlockListener?;
|
|
23
|
+
private initialDefaultsPromise?;
|
|
24
|
+
private initialRefreshHandledTargetIds;
|
|
23
25
|
get form(): any;
|
|
24
26
|
get title(): string;
|
|
25
27
|
useHooksBeforeRender(): void;
|
|
@@ -29,6 +31,8 @@ export declare class FilterFormBlockModel extends FilterBlockModel<{
|
|
|
29
31
|
onMount(): void;
|
|
30
32
|
onUnmount(): void;
|
|
31
33
|
private applyDefaultsAndInitialFilter;
|
|
34
|
+
prepareInitialFilterValues(): Promise<boolean>;
|
|
35
|
+
markInitialTargetRefreshHandled(targetId: string): void;
|
|
32
36
|
private ensureFilterItemsBeforeRender;
|
|
33
37
|
applyFormDefaultValues(options?: {
|
|
34
38
|
force?: boolean;
|
|
@@ -17,6 +17,9 @@ type FilterConfig = {
|
|
|
17
17
|
/** 筛选操作符,每个条件的操作符可以不一样 */
|
|
18
18
|
operator?: string;
|
|
19
19
|
};
|
|
20
|
+
export type RefreshTargetsByFilterOptions = {
|
|
21
|
+
excludeTargetIds?: Set<string> | string[];
|
|
22
|
+
};
|
|
20
23
|
export type ConnectFieldsConfig = {
|
|
21
24
|
targets: {
|
|
22
25
|
/** 数据区块或者图表区块的 model uid */
|
|
@@ -32,6 +35,7 @@ export declare class FilterManager {
|
|
|
32
35
|
saveFilterConfigs(): Promise<void>;
|
|
33
36
|
getFilterConfigs(): FilterConfig[];
|
|
34
37
|
getConnectFieldsConfig(filterModelUid: string): ConnectFieldsConfig | undefined;
|
|
38
|
+
prepareFiltersForTarget(targetId: string): Promise<Set<any>>;
|
|
35
39
|
saveConnectFieldsConfig(filterModelUid: string, config: ConnectFieldsConfig): Promise<void>;
|
|
36
40
|
/**
|
|
37
41
|
* 添加筛选配置
|
|
@@ -136,6 +140,6 @@ export declare class FilterManager {
|
|
|
136
140
|
* await filterManager.refreshTargetsByFilter(['filter-1', 'filter-2']);
|
|
137
141
|
* ```
|
|
138
142
|
*/
|
|
139
|
-
refreshTargetsByFilter(filterId: string | string[]): Promise<void>;
|
|
143
|
+
refreshTargetsByFilter(filterId: string | string[], options?: RefreshTargetsByFilterOptions): Promise<void>;
|
|
140
144
|
}
|
|
141
145
|
export {};
|
|
@@ -7,6 +7,14 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
import { TableBlockModel } from './TableBlockModel';
|
|
10
|
+
export declare function getAssociationSelectForeignKeyFilter(collectionField: any): {
|
|
11
|
+
[x: number]: {
|
|
12
|
+
$is: any;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export declare function getAssociationSelectAssociatedRecordsFilter(collection: any, associatedRecords?: any[]): {
|
|
16
|
+
[x: string]: any[];
|
|
17
|
+
};
|
|
10
18
|
export declare class TableSelectModel extends TableBlockModel {
|
|
11
19
|
static scene: import("../../base/BlockModel").BlockSceneType;
|
|
12
20
|
rowSelectionProps: any;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
import { CollectionField } from '@nocobase/flow-engine';
|
|
10
|
-
import { FieldModel } from '../base
|
|
10
|
+
import { FieldModel } from '../base';
|
|
11
11
|
export declare class DisplayTitleFieldModel extends FieldModel {
|
|
12
12
|
get collectionField(): CollectionField;
|
|
13
13
|
renderComponent(value: any): any;
|
|
@@ -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
|
+
export declare function hasDisplayValue(value: any): boolean;
|
|
10
|
+
export declare function normalizeDisplayValue(value: any, options?: {
|
|
11
|
+
collectionField?: any;
|
|
12
|
+
}): any;
|
|
@@ -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) => 0 | 100 | 80 | 60 | 40
|
|
9
|
+
export declare const getStrength: (val: any) => 0 | 20 | 100 | 80 | 60 | 40;
|