@nocobase/client-v2 2.2.0-beta.17 → 2.2.0-beta.18
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/APIClient.d.ts +12 -0
- package/es/flow/components/placeholders/BlockPlaceholder.d.ts +1 -0
- package/es/flow/internal/utils/operatorSchemaHelper.d.ts +2 -2
- package/es/flow/models/base/CollectionBlockModel.d.ts +3 -0
- package/es/flow/models/blocks/details/DetailsBlockModel.d.ts +3 -0
- package/es/flow/models/blocks/filter-form/FilterFormGridModel.d.ts +1 -0
- package/es/flow/models/blocks/filter-form/FilterFormSubmitActionModel.d.ts +3 -1
- package/es/flow/models/blocks/form/FormBlockModel.d.ts +1 -0
- package/es/flow/models/blocks/table/TableBlockModel.d.ts +1 -0
- package/es/flow/models/blocks/table/TableColumnModel.d.ts +11 -0
- package/es/flow/models/blocks/table/utils.d.ts +1 -0
- package/es/flow/models/fields/AssociationFieldModel/RecordPickerFieldModel.d.ts +2 -1
- package/es/flow/models/fields/AssociationFieldModel/RecordSelectFieldModel.d.ts +0 -17
- package/es/flow/models/fields/AssociationFieldModel/recordSelectShared.d.ts +41 -0
- package/es/flow-compat/passwordUtils.d.ts +1 -1
- package/es/index.mjs +125 -116
- package/lib/index.js +162 -153
- package/package.json +7 -7
- package/src/APIClient.ts +92 -0
- package/src/Application.tsx +3 -1
- package/src/__tests__/APIClient.test.tsx +58 -0
- package/src/__tests__/settings-center.test.tsx +270 -6
- package/src/acl/ACLProvider.tsx +2 -0
- package/src/acl/__tests__/ACLProvider.test.tsx +92 -0
- package/src/components/form/filter/CollectionFilterItem.tsx +4 -2
- package/src/components/form/filter/__tests__/CollectionFilterItem.test.tsx +17 -0
- package/src/components/form/table/Table.tsx +81 -6
- package/src/components/form/table/__tests__/Table.columnWidth.test.tsx +433 -0
- package/src/flow/actions/__tests__/linkageRules.subFormSetFieldProps.test.ts +72 -0
- package/src/flow/actions/linkageRules.tsx +8 -3
- package/src/flow/admin-shell/admin-layout/AdminLayoutMenuUtils.tsx +78 -59
- package/src/flow/admin-shell/admin-layout/__tests__/AdminLayoutMenuModels.test.ts +228 -0
- package/src/flow/components/filter/VariableFilterItem.tsx +12 -3
- package/src/flow/components/filter/__tests__/VariableFilterItem.test.tsx +125 -0
- package/src/flow/components/placeholders/BlockPlaceholder.tsx +70 -23
- package/src/flow/components/placeholders/__tests__/BlockPlaceholder.test.tsx +57 -7
- package/src/flow/internal/utils/operatorSchemaHelper.ts +3 -2
- package/src/flow/models/base/CollectionBlockModel.tsx +23 -1
- package/src/flow/models/base/__tests__/CollectionBlockModel.initialBeforeRenderRefresh.test.ts +65 -9
- package/src/flow/models/blocks/details/DetailsBlockModel.tsx +8 -3
- package/src/flow/models/blocks/details/__tests__/DetailsBlockModel.initialPaginationChangeRefresh.test.ts +32 -1
- package/src/flow/models/blocks/filter-form/FilterFormGridModel.tsx +36 -5
- package/src/flow/models/blocks/filter-form/FilterFormItemModel.tsx +129 -14
- package/src/flow/models/blocks/filter-form/FilterFormSubmitActionModel.tsx +57 -4
- package/src/flow/models/blocks/filter-form/__tests__/FilterFormGridModel.onModelCreated.test.ts +174 -1
- package/src/flow/models/blocks/filter-form/__tests__/FilterFormItemModel.defineChildren.test.ts +359 -1
- package/src/flow/models/blocks/filter-form/__tests__/FilterFormItemModel.getFilterValue.test.ts +72 -0
- package/src/flow/models/blocks/filter-form/__tests__/FilterFormSubmitActionModel.lifecycle.test.ts +90 -0
- package/src/flow/models/blocks/filter-manager/FilterManager.ts +5 -0
- package/src/flow/models/blocks/filter-manager/__tests__/FilterManager.test.ts +40 -0
- package/src/flow/models/blocks/form/FormBlockModel.tsx +43 -0
- package/src/flow/models/blocks/form/__tests__/runJsFormSubmit.test.ts +131 -0
- package/src/flow/models/blocks/table/TableBlockModel.tsx +25 -1
- package/src/flow/models/blocks/table/TableColumnModel.tsx +18 -8
- package/src/flow/models/blocks/table/__tests__/TableBlockModel.filterReset.test.ts +78 -0
- package/src/flow/models/blocks/table/utils.ts +7 -0
- package/src/flow/models/fields/AssociationFieldModel/CascadeSelectFieldModel.tsx +33 -1
- package/src/flow/models/fields/AssociationFieldModel/RecordPickerFieldModel.tsx +24 -1
- package/src/flow/models/fields/AssociationFieldModel/RecordSelectFieldModel.tsx +9 -136
- package/src/flow/models/fields/AssociationFieldModel/__tests__/RecordPickerFieldModel.itemContext.test.ts +121 -3
- package/src/flow/models/fields/AssociationFieldModel/recordSelectShared.tsx +156 -0
- package/src/flow/models/fields/DisplayNumberFieldModel.tsx +1 -1
- package/src/flow/models/fields/NumberFieldModel.tsx +1 -1
- package/src/flow/models/fields/__tests__/DisplayNumberFieldModel.test.ts +33 -0
- package/src/flow/models/fields/__tests__/NumberFieldModel.test.tsx +47 -0
- package/src/flow/models/fields/mobile-components/MobileLazySelect.tsx +5 -0
- package/src/flow/models/fields/mobile-components/MobileSelect.tsx +27 -2
- package/src/flow/models/fields/mobile-components/__tests__/MobileSelect.test.tsx +122 -14
- package/src/settings-center/AdminSettingsLayout.tsx +23 -2
package/es/APIClient.d.ts
CHANGED
|
@@ -7,8 +7,20 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
import { APIClient as APIClientSDK } from '@nocobase/sdk';
|
|
10
|
+
import type { NotificationInstance } from 'antd/es/notification/interface';
|
|
11
|
+
interface APIClientApplication {
|
|
12
|
+
getName?: () => string | undefined;
|
|
13
|
+
context?: {
|
|
14
|
+
notification?: NotificationInstance;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
10
17
|
export declare class APIClient extends APIClientSDK {
|
|
18
|
+
app?: APIClientApplication;
|
|
19
|
+
get notification(): NotificationInstance;
|
|
11
20
|
getHostname(): string;
|
|
12
21
|
getHeaders(): {};
|
|
13
22
|
interceptors(): void;
|
|
23
|
+
handleNotificationError(error: unknown): void;
|
|
24
|
+
useNotificationMiddleware(): void;
|
|
14
25
|
}
|
|
26
|
+
export {};
|
|
@@ -15,7 +15,7 @@ type OperatorMeta = {
|
|
|
15
15
|
};
|
|
16
16
|
};
|
|
17
17
|
type ComponentRegistry = {
|
|
18
|
-
getComponent?: (name: string) => ComponentType<Record<string, unknown>> | undefined;
|
|
18
|
+
getComponent?: (name: string, isShowError?: boolean) => ComponentType<Record<string, unknown>> | undefined;
|
|
19
19
|
};
|
|
20
20
|
type OperatorComponentRenderOptions = {
|
|
21
21
|
app?: ComponentRegistry;
|
|
@@ -29,7 +29,7 @@ export declare function pickOperatorStyle(value: unknown): CSSProperties | undef
|
|
|
29
29
|
/**
|
|
30
30
|
* 根据操作符的 schema 定位组件及其 props。
|
|
31
31
|
*/
|
|
32
|
-
export declare function resolveOperatorComponent(app: ComponentRegistry | undefined, operator: string, operators?: OperatorMeta[]): {
|
|
32
|
+
export declare function resolveOperatorComponent(app: ComponentRegistry | undefined, operator: string, operators?: OperatorMeta[], isShowError?: boolean): {
|
|
33
33
|
Comp: React.ComponentType<Record<string, unknown>>;
|
|
34
34
|
props: Record<string, unknown>;
|
|
35
35
|
};
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
import { BaseRecordResource, Collection, CollectionField, DataSource, DefaultStructure, FlowModelContext, MultiRecordResource, SingleRecordResource } from '@nocobase/flow-engine';
|
|
10
|
+
import React from 'react';
|
|
10
11
|
import { DataBlockModel } from './DataBlockModel';
|
|
11
12
|
export interface ResourceSettingsInitParams {
|
|
12
13
|
dataSourceKey: string;
|
|
@@ -66,6 +67,8 @@ export declare class CollectionBlockModel<T = DefaultStructure> extends DataBloc
|
|
|
66
67
|
onInit(options: any): void;
|
|
67
68
|
createResource(ctx: any, params: any): SingleRecordResource | MultiRecordResource;
|
|
68
69
|
refresh(): Promise<void>;
|
|
70
|
+
isExternalDataSource(): boolean;
|
|
71
|
+
render(): React.JSX.Element;
|
|
69
72
|
protected defaultBlockTitle(): string;
|
|
70
73
|
addAppends(fieldPath: string, refresh?: boolean): void;
|
|
71
74
|
}
|
|
@@ -39,3 +39,6 @@ export declare class DetailsBlockModel extends CollectionBlockModel<{
|
|
|
39
39
|
renderConfigureActions(): React.JSX.Element;
|
|
40
40
|
renderComponent(): React.JSX.Element;
|
|
41
41
|
}
|
|
42
|
+
export declare const DetailsPagination: React.MemoExoticComponent<import("@formily/reactive-react").ReactFC<{
|
|
43
|
+
model: DetailsBlockModel;
|
|
44
|
+
}>>;
|
|
@@ -28,6 +28,7 @@ export declare class FilterFormGridModel extends GridModel {
|
|
|
28
28
|
readonly loading: {
|
|
29
29
|
value: boolean;
|
|
30
30
|
};
|
|
31
|
+
private isRecordSelectFilterField;
|
|
31
32
|
private getAssociationFilterTargetKey;
|
|
32
33
|
private normalizeFilterFormLayout;
|
|
33
34
|
private normalizeStoredFullLayout;
|
|
@@ -10,6 +10,8 @@ import type { ButtonProps } from 'antd/es/button';
|
|
|
10
10
|
import { FilterFormActionModel } from './FilterFormActionModel';
|
|
11
11
|
export declare class FilterFormSubmitActionModel extends FilterFormActionModel {
|
|
12
12
|
defaultProps: ButtonProps;
|
|
13
|
-
|
|
13
|
+
private getLifecycleAction;
|
|
14
|
+
private syncAutoTriggerFilter;
|
|
15
|
+
onMount(): void;
|
|
14
16
|
onUnmount(): void;
|
|
15
17
|
}
|
|
@@ -32,6 +32,7 @@ export declare class FormBlockModel<T extends DefaultCollectionBlockModelStructu
|
|
|
32
32
|
};
|
|
33
33
|
private userModifiedTopLevelFields;
|
|
34
34
|
get form(): FormInstance<any>;
|
|
35
|
+
submitFromRunJs(): void;
|
|
35
36
|
_defaultCustomModelClasses: {
|
|
36
37
|
FormActionGroupModel: string;
|
|
37
38
|
FormItemModel: string;
|
|
@@ -36,6 +36,7 @@ export declare class TableBlockModel extends CollectionBlockModel<TableBlockMode
|
|
|
36
36
|
};
|
|
37
37
|
customModelClasses: CustomTableBlockModelClassesEnum;
|
|
38
38
|
get resource(): MultiRecordResource<any>;
|
|
39
|
+
resetAfterFilterChange(): void;
|
|
39
40
|
private readonly columns;
|
|
40
41
|
private disposeAutorun;
|
|
41
42
|
onMount(): void;
|
|
@@ -7,9 +7,19 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
import { DisplayItemModel, FlowModelContext, ModelRenderMode } from '@nocobase/flow-engine';
|
|
10
|
+
import type { FlowModel } from '@nocobase/flow-engine';
|
|
10
11
|
import { TableColumnProps } from 'antd';
|
|
11
12
|
import React from 'react';
|
|
12
13
|
export declare function FieldDeletePlaceholder(props: any): React.JSX.Element;
|
|
14
|
+
type FieldPermissionPlaceholderModel = FlowModel & {
|
|
15
|
+
fieldPath?: string;
|
|
16
|
+
forbidden?: {
|
|
17
|
+
actionName?: string;
|
|
18
|
+
} | null;
|
|
19
|
+
};
|
|
20
|
+
export declare function FieldWithoutPermissionPlaceholder({ targetModel, }?: {
|
|
21
|
+
targetModel?: FieldPermissionPlaceholderModel;
|
|
22
|
+
}): React.JSX.Element;
|
|
13
23
|
export declare const TABLE_COLUMN_MIN_WIDTH = 10;
|
|
14
24
|
export declare function normalizeTableColumnWidth(width: number | null | undefined): number;
|
|
15
25
|
export declare const CustomWidth: ({ setOpen, t, handleChange, defaultValue }: {
|
|
@@ -30,3 +40,4 @@ export declare class TableColumnModel extends DisplayItemModel {
|
|
|
30
40
|
onInit(options: any): void;
|
|
31
41
|
renderItem(): any;
|
|
32
42
|
}
|
|
43
|
+
export {};
|
|
@@ -3,6 +3,7 @@ export declare function extractIndex(str: any): string;
|
|
|
3
3
|
export declare function adjustColumnOrder(columns: any): any[];
|
|
4
4
|
export declare function setNestedValue(data: any, recordIndex: any, value: any): void;
|
|
5
5
|
export declare function extractIds(data: any): any[];
|
|
6
|
+
export declare function extractRowKeys(data: Record<string, unknown>[], key: string | string[]): any;
|
|
6
7
|
/**
|
|
7
8
|
* 生成表格行唯一 key
|
|
8
9
|
* @param record 当前行数据
|
|
@@ -6,7 +6,7 @@
|
|
|
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 { CollectionField, FlowModel } from '@nocobase/flow-engine';
|
|
9
|
+
import { CollectionField, MultiRecordResource, FlowModel } from '@nocobase/flow-engine';
|
|
10
10
|
import React from 'react';
|
|
11
11
|
import { FieldModel } from '../../base/FieldModel';
|
|
12
12
|
import { type ItemChain } from './itemChain';
|
|
@@ -45,6 +45,7 @@ export declare function RecordPickerContent({ model, toOne }: {
|
|
|
45
45
|
toOne?: boolean;
|
|
46
46
|
}): React.JSX.Element;
|
|
47
47
|
export declare class RecordPickerFieldModel extends FieldModel {
|
|
48
|
+
resource: MultiRecordResource;
|
|
48
49
|
selectedRows: {
|
|
49
50
|
value: any[];
|
|
50
51
|
};
|
|
@@ -9,22 +9,6 @@
|
|
|
9
9
|
import { CollectionField, MultiRecordResource } from '@nocobase/flow-engine';
|
|
10
10
|
import React from 'react';
|
|
11
11
|
import { AssociationFieldModel } from './AssociationFieldModel';
|
|
12
|
-
import { type AssociationOption, type LazySelectProps } from './recordSelectShared';
|
|
13
|
-
type HydrateStatus = 'pending' | 'done';
|
|
14
|
-
type HydrationCandidate = {
|
|
15
|
-
item: AssociationOption;
|
|
16
|
-
tk: any;
|
|
17
|
-
tkKey: string;
|
|
18
|
-
};
|
|
19
|
-
export declare function collectAssociationHydrationCandidates(options: {
|
|
20
|
-
value: LazySelectProps['value'];
|
|
21
|
-
isMultiple: boolean;
|
|
22
|
-
valueKey: string;
|
|
23
|
-
labelKey: string;
|
|
24
|
-
statusMap: Map<string, HydrateStatus>;
|
|
25
|
-
}): HydrationCandidate[];
|
|
26
|
-
export declare function getAssociationHydrationNamePath(model: any): any;
|
|
27
|
-
export declare function getAssociationHydrationSetterContext(model: any): any;
|
|
28
12
|
export declare function CreateContent({ model, toOne }: {
|
|
29
13
|
model: any;
|
|
30
14
|
toOne?: boolean;
|
|
@@ -45,4 +29,3 @@ export declare class RecordSelectFieldModel extends AssociationFieldModel {
|
|
|
45
29
|
change(value: any): void;
|
|
46
30
|
render(): React.JSX.Element;
|
|
47
31
|
}
|
|
48
|
-
export {};
|
|
@@ -39,6 +39,46 @@ export interface LazySelectProps extends Omit<SelectProps<any>, 'mode' | 'option
|
|
|
39
39
|
allowCreate?: boolean;
|
|
40
40
|
allowEdit?: boolean;
|
|
41
41
|
}
|
|
42
|
+
type AssociationHydrationSetterOptions = {
|
|
43
|
+
source?: string;
|
|
44
|
+
markExplicit?: boolean;
|
|
45
|
+
triggerEvent?: boolean;
|
|
46
|
+
};
|
|
47
|
+
type AssociationHydrationSetterContext = {
|
|
48
|
+
setFormValue?: (namePath: unknown, value: unknown, options?: AssociationHydrationSetterOptions) => Promise<unknown> | void;
|
|
49
|
+
};
|
|
50
|
+
export type AssociationHydrationModel = {
|
|
51
|
+
resource?: {
|
|
52
|
+
get?: (tk: unknown) => Promise<unknown> | unknown;
|
|
53
|
+
};
|
|
54
|
+
context?: unknown;
|
|
55
|
+
props?: {
|
|
56
|
+
name?: unknown;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
type AssociationHydrationStatus = 'pending' | 'done';
|
|
60
|
+
type AssociationHydrationCandidate = {
|
|
61
|
+
item: AssociationOption;
|
|
62
|
+
tk: unknown;
|
|
63
|
+
tkKey: string;
|
|
64
|
+
};
|
|
65
|
+
export declare function isAssociationRecord(value: unknown): value is AssociationOption;
|
|
66
|
+
export declare function collectAssociationHydrationCandidates(options: {
|
|
67
|
+
value: LazySelectProps['value'];
|
|
68
|
+
isMultiple: boolean;
|
|
69
|
+
valueKey: string;
|
|
70
|
+
labelKey: string;
|
|
71
|
+
statusMap: Map<string, AssociationHydrationStatus>;
|
|
72
|
+
}): AssociationHydrationCandidate[];
|
|
73
|
+
export declare function getAssociationHydrationNamePath(model: AssociationHydrationModel): any;
|
|
74
|
+
export declare function getAssociationHydrationSetterContext(model: AssociationHydrationModel): AssociationHydrationSetterContext;
|
|
75
|
+
export declare function useAssociationValueHydration(options: {
|
|
76
|
+
model: AssociationHydrationModel;
|
|
77
|
+
value: LazySelectProps['value'];
|
|
78
|
+
isMultiple: boolean;
|
|
79
|
+
fieldNames: AssociationFieldNames;
|
|
80
|
+
onChange: LazySelectProps['onChange'];
|
|
81
|
+
}): void;
|
|
42
82
|
export interface LabelByFieldProps {
|
|
43
83
|
option: AssociationOption;
|
|
44
84
|
fieldNames: AssociationFieldNames;
|
|
@@ -46,3 +86,4 @@ export interface LabelByFieldProps {
|
|
|
46
86
|
export declare function LabelByField(props: Readonly<LabelByFieldProps>): React.JSX.Element;
|
|
47
87
|
export declare function toSelectValue(record: AssociationOption | AssociationOption[] | string | string[] | number | number[] | undefined, fieldNames: AssociationFieldNames, multiple?: boolean, valueMode?: 'record' | 'value', options?: AssociationOption[]): any;
|
|
48
88
|
export declare function resolveOptions(options: AssociationOption[] | undefined, value: AssociationOption | AssociationOption[] | string | string[] | number | number[] | undefined, isMultiple: boolean): AssociationOption[];
|
|
89
|
+
export {};
|
|
@@ -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) =>
|
|
9
|
+
export declare const getStrength: (val: any) => 0 | 60 | 100 | 80 | 40 | 20;
|