@nocobase/client-v2 3.0.0-alpha.6 → 3.0.0-alpha.8
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/flow/actions/linkageRules.d.ts +24 -0
- package/es/flow/components/FieldAssignValueInput.d.ts +4 -30
- package/es/flow/components/field-value-variable/DateVariableEditor.d.ts +24 -0
- package/es/flow/components/field-value-variable/FieldValueVariableInput.d.ts +31 -0
- package/es/flow/components/field-value-variable/dateValue.d.ts +36 -0
- package/es/flow/components/field-value-variable/index.d.ts +11 -0
- package/es/flow/models/actions/UpdateRecordActionUtils.d.ts +8 -2
- package/es/flow/models/blocks/form/FormBlockModel.d.ts +6 -0
- package/es/flow/models/blocks/form/FormGridModel.d.ts +6 -0
- package/es/flow/models/blocks/form/value-runtime/rules.d.ts +1 -0
- package/es/flow/models/blocks/table/JSColumnModel.d.ts +2 -0
- package/es/index.mjs +106 -106
- package/lib/index.js +97 -97
- package/package.json +7 -7
- package/src/__tests__/app.test.tsx +122 -3
- package/src/__tests__/browserChecker.test.ts +37 -0
- package/src/__tests__/settings-shell.test.tsx +27 -1
- package/src/components/AppComponents.tsx +16 -7
- 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.actionStates.test.ts +33 -0
- package/src/flow/actions/linkageRules.tsx +25 -7
- package/src/flow/components/FieldAssignValueInput.tsx +38 -621
- package/src/flow/components/field-value-variable/DateVariableEditor.tsx +181 -0
- package/src/flow/components/field-value-variable/FieldValueVariableInput.tsx +326 -0
- package/src/flow/components/field-value-variable/__tests__/FieldValueVariableInput.test.tsx +380 -0
- package/src/flow/components/field-value-variable/dateValue.ts +223 -0
- package/src/flow/components/field-value-variable/index.ts +12 -0
- package/src/flow/models/actions/UpdateRecordActionModel.tsx +18 -1
- package/src/flow/models/actions/UpdateRecordActionUtils.ts +18 -6
- package/src/flow/models/actions/__tests__/UpdateRecordActionModel.test.ts +76 -4
- package/src/flow/models/blocks/assign-form/AssignFormItemModel.tsx +28 -53
- package/src/flow/models/blocks/form/FormBlockModel.tsx +4 -0
- package/src/flow/models/blocks/form/FormGridModel.tsx +4 -0
- package/src/flow/models/blocks/form/__tests__/FormBlockModel.test.tsx +8 -2
- package/src/flow/models/blocks/form/value-runtime/__tests__/runtime.test.ts +435 -0
- package/src/flow/models/blocks/form/value-runtime/rules.ts +67 -14
- package/src/flow/models/blocks/form/value-runtime/runtime.ts +43 -19
- package/src/flow/models/blocks/table/JSColumnModel.tsx +10 -1
- package/src/flow/models/blocks/table/__tests__/JSColumnModel.test.tsx +52 -5
- package/src/flow/models/fields/AssociationFieldModel/PopupSubTableFieldModel/PopupSubTableFieldModel.tsx +8 -0
- package/src/flow/models/fields/AssociationFieldModel/PopupSubTableFieldModel/__tests__/popupContext.test.ts +120 -0
- package/src/flow/models/fields/AssociationFieldModel/PopupSubTableFieldModel/actions/PopupSubTableEditActionModel.tsx +10 -2
- package/src/flow/models/fields/AssociationFieldModel/__tests__/RecordPickerFieldModel.itemContext.test.ts +46 -0
- package/src/flow/models/fields/mobile-components/MobileLazySelect.tsx +1 -0
- package/src/flow/models/fields/mobile-components/__tests__/MobileSelect.test.tsx +20 -2
- package/src/settings-app/SettingsShell.tsx +19 -4
|
@@ -9,6 +9,29 @@
|
|
|
9
9
|
import { FlowContext, FlowModel } from '@nocobase/flow-engine';
|
|
10
10
|
export declare function updateLinkageRules<T>(rules: T[], updater: (nextRules: T[]) => void): T[];
|
|
11
11
|
export declare const linkageSetBlockProps: import("@nocobase/flow-engine").ActionDefinition<FlowModel<import("@nocobase/flow-engine").DefaultStructure>, FlowContext>;
|
|
12
|
+
declare const ACTION_LINKAGE_STATE_OPTIONS: readonly [{
|
|
13
|
+
readonly label: "Visible";
|
|
14
|
+
readonly value: "visible";
|
|
15
|
+
}, {
|
|
16
|
+
readonly label: "Hidden";
|
|
17
|
+
readonly value: "hidden";
|
|
18
|
+
}, {
|
|
19
|
+
readonly label: "Hidden text";
|
|
20
|
+
readonly value: "hiddenText";
|
|
21
|
+
}, {
|
|
22
|
+
readonly label: "Enabled";
|
|
23
|
+
readonly value: "enabled";
|
|
24
|
+
}, {
|
|
25
|
+
readonly label: "Disabled";
|
|
26
|
+
readonly value: "disabled";
|
|
27
|
+
}];
|
|
28
|
+
type ActionLinkageState = (typeof ACTION_LINKAGE_STATE_OPTIONS)[number]['value'];
|
|
29
|
+
export declare function getActionLinkageStateOptions(model: {
|
|
30
|
+
supportedActionLinkageStates?: readonly ActionLinkageState[];
|
|
31
|
+
}, t: (key: string) => string): {
|
|
32
|
+
label: string;
|
|
33
|
+
value: "hidden" | "visible" | "disabled" | "enabled" | "hiddenText";
|
|
34
|
+
}[];
|
|
12
35
|
export declare const linkageSetActionProps: import("@nocobase/flow-engine").ActionDefinition<FlowModel<import("@nocobase/flow-engine").DefaultStructure>, FlowContext>;
|
|
13
36
|
export declare const linkageSetMenuItemProps: import("@nocobase/flow-engine").ActionDefinition<FlowModel<import("@nocobase/flow-engine").DefaultStructure>, FlowContext>;
|
|
14
37
|
export declare const linkageSetTabProps: import("@nocobase/flow-engine").ActionDefinition<FlowModel<import("@nocobase/flow-engine").DefaultStructure>, FlowContext>;
|
|
@@ -26,3 +49,4 @@ export declare const tabLinkageRules: import("@nocobase/flow-engine").ActionDefi
|
|
|
26
49
|
export declare const fieldLinkageRules: import("@nocobase/flow-engine").ActionDefinition<FlowModel<import("@nocobase/flow-engine").DefaultStructure>, FlowContext>;
|
|
27
50
|
export declare const subFormFieldLinkageRules: import("@nocobase/flow-engine").ActionDefinition<FlowModel<import("@nocobase/flow-engine").DefaultStructure>, FlowContext>;
|
|
28
51
|
export declare const detailsFieldLinkageRules: import("@nocobase/flow-engine").ActionDefinition<FlowModel<import("@nocobase/flow-engine").DefaultStructure>, FlowContext>;
|
|
52
|
+
export {};
|
|
@@ -7,32 +7,8 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
import React from 'react';
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
import { type ExactDatePickerMode } from './FieldAssignExactDatePicker';
|
|
13
|
-
type VariableInputConverters = {
|
|
14
|
-
renderInputComponent?: (metaTreeNode: MetaTreeNode | null) => React.ComponentType<any> | null;
|
|
15
|
-
resolvePathFromValue?: (value: any) => string[] | undefined;
|
|
16
|
-
resolveValueFromPath?: (metaTreeNode: MetaTreeNode) => any;
|
|
17
|
-
};
|
|
18
|
-
export type DateVariableExactNormalizeMode = 'none' | 'date' | 'datetimeNoTz' | 'iso';
|
|
19
|
-
export declare function toExactPickerDisplayValue(rawValue: unknown, options: {
|
|
20
|
-
format: string;
|
|
21
|
-
isRange: boolean;
|
|
22
|
-
}): dayjs.Dayjs | [dayjs.Dayjs, dayjs.Dayjs] | null;
|
|
23
|
-
export declare function normalizeDateVariableExactValue(rawValue: any, options: {
|
|
24
|
-
exactNormalizeMode: DateVariableExactNormalizeMode;
|
|
25
|
-
format: string;
|
|
26
|
-
showTime: boolean;
|
|
27
|
-
}): any;
|
|
28
|
-
type DateVariableComponentProps = {
|
|
29
|
-
picker: ExactDatePickerMode;
|
|
30
|
-
showTime: boolean;
|
|
31
|
-
timeFormat: string;
|
|
32
|
-
format: string;
|
|
33
|
-
exactNormalizeMode: DateVariableExactNormalizeMode;
|
|
34
|
-
};
|
|
35
|
-
export declare function normalizeDateVariableOutput(rawValue: any, options: DateVariableComponentProps): any;
|
|
10
|
+
import { type CollectionField, type MetaTreeNode, type VariableInputProps } from '@nocobase/flow-engine';
|
|
11
|
+
export { normalizeDateVariableExactValue, normalizeDateVariableOutput, toExactPickerDisplayValue, type DateVariableExactNormalizeMode, } from './field-value-variable';
|
|
36
12
|
interface Props {
|
|
37
13
|
/** 赋值目标路径,例如 `title` / `users.nickname` / `user.name` */
|
|
38
14
|
targetPath: string;
|
|
@@ -53,15 +29,14 @@ interface Props {
|
|
|
53
29
|
value?: string;
|
|
54
30
|
};
|
|
55
31
|
/**
|
|
56
|
-
*
|
|
57
|
-
* 默认 false,保持历史行为。
|
|
32
|
+
* @deprecated Date 已作为独立一级变量提供,此参数仅为调用兼容保留。
|
|
58
33
|
*/
|
|
59
34
|
enableDateVariableAsConstant?: boolean;
|
|
60
35
|
/** 是否允许在变量选择器中使用 RunJS。默认 true,保持历史行为。 */
|
|
61
36
|
allowRunJS?: boolean;
|
|
62
37
|
maxAssociationFieldDepth?: number;
|
|
63
38
|
disabled?: boolean;
|
|
64
|
-
variableConverters?:
|
|
39
|
+
variableConverters?: VariableInputProps['converters'];
|
|
65
40
|
}
|
|
66
41
|
export declare function mergeItemMetaTreeForAssignValue(baseTree: MetaTreeNode[], extraTree: MetaTreeNode[]): MetaTreeNode[];
|
|
67
42
|
export declare function resolveAssignValueFieldPath(itemModel: any): string | undefined;
|
|
@@ -95,4 +70,3 @@ export declare function resolveAssignValueFieldModelConfig(options: {
|
|
|
95
70
|
* - 支持变量引用,并提供 Constant / Null 两种快捷项
|
|
96
71
|
*/
|
|
97
72
|
export declare const FieldAssignValueInput: React.FC<Props>;
|
|
98
|
-
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
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 CtxDateExpressionConfig } from '@nocobase/flow-engine';
|
|
10
|
+
import React from 'react';
|
|
11
|
+
import { type ExactDatePickerValue } from '../FieldAssignExactDatePicker';
|
|
12
|
+
import { type DateVariableComponentProps } from './dateValue';
|
|
13
|
+
export declare function getDefaultDateVariableFormat(config: CtxDateExpressionConfig): string;
|
|
14
|
+
export declare function serializeExactDatePickerValue(value: ExactDatePickerValue, showTime: boolean): string | [string, string];
|
|
15
|
+
type DateVariableEditorProps = {
|
|
16
|
+
value?: CtxDateExpressionConfig;
|
|
17
|
+
onChange?: (value: CtxDateExpressionConfig) => void;
|
|
18
|
+
isDateLikeField: boolean;
|
|
19
|
+
dateComponentProps: DateVariableComponentProps;
|
|
20
|
+
style?: React.CSSProperties;
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
};
|
|
23
|
+
export declare const DateVariableEditor: React.FC<DateVariableEditorProps>;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
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, type VariableInputProps } from '@nocobase/flow-engine';
|
|
10
|
+
import React from 'react';
|
|
11
|
+
import { type DateVariableComponentProps } from './dateValue';
|
|
12
|
+
type ValueEditorComponent = React.ComponentType<{
|
|
13
|
+
value?: unknown;
|
|
14
|
+
onChange?: (value: unknown) => void;
|
|
15
|
+
style?: React.CSSProperties;
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
}>;
|
|
18
|
+
export type FieldValueVariableInputProps = Omit<VariableInputProps, 'value' | 'onChange' | 'metaTree' | 'converters'> & {
|
|
19
|
+
value?: unknown;
|
|
20
|
+
onChange: (value: unknown) => void;
|
|
21
|
+
baseMetaTree: MetaTreeNode[] | (() => MetaTreeNode[] | Promise<MetaTreeNode[]>);
|
|
22
|
+
constantComponent: ValueEditorComponent;
|
|
23
|
+
nullComponent: ValueEditorComponent;
|
|
24
|
+
runJSComponent: ValueEditorComponent;
|
|
25
|
+
isDateLikeField: boolean;
|
|
26
|
+
dateComponentProps: DateVariableComponentProps;
|
|
27
|
+
allowRunJS?: boolean;
|
|
28
|
+
converters?: VariableInputProps['converters'];
|
|
29
|
+
};
|
|
30
|
+
export declare const FieldValueVariableInput: React.FC<FieldValueVariableInputProps>;
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
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 { dayjs } from '@nocobase/utils/client';
|
|
10
|
+
import type { ExactDatePickerMode } from '../FieldAssignExactDatePicker';
|
|
11
|
+
type DateFieldLike = {
|
|
12
|
+
interface?: unknown;
|
|
13
|
+
type?: unknown;
|
|
14
|
+
getComponentProps?: () => unknown;
|
|
15
|
+
uiSchema?: Record<string, unknown>;
|
|
16
|
+
};
|
|
17
|
+
export type DateVariableExactNormalizeMode = 'none' | 'date' | 'datetimeNoTz' | 'iso';
|
|
18
|
+
export type DateVariableComponentProps = {
|
|
19
|
+
picker: ExactDatePickerMode;
|
|
20
|
+
showTime: boolean;
|
|
21
|
+
timeFormat: string;
|
|
22
|
+
format: string;
|
|
23
|
+
exactNormalizeMode: DateVariableExactNormalizeMode;
|
|
24
|
+
};
|
|
25
|
+
export declare const DEFAULT_DATE_VARIABLE_COMPONENT_PROPS: DateVariableComponentProps;
|
|
26
|
+
export declare function getFieldInterface(field: DateFieldLike | null | undefined): string;
|
|
27
|
+
export declare function isDateLikeField(field: DateFieldLike | null | undefined, fallbackFieldName?: string, fallbackFieldInterface?: string): boolean;
|
|
28
|
+
export declare function resolveDateVariableComponentProps(field: DateFieldLike | null | undefined, fieldInterface?: string): DateVariableComponentProps;
|
|
29
|
+
export declare function normalizeDateVariableExactValue(rawValue: unknown, options: Pick<DateVariableComponentProps, 'format' | 'showTime' | 'exactNormalizeMode'>): unknown;
|
|
30
|
+
export declare function toExactPickerDisplayValue(rawValue: unknown, options: {
|
|
31
|
+
format: string;
|
|
32
|
+
isRange: boolean;
|
|
33
|
+
}): dayjs.Dayjs | [dayjs.Dayjs, dayjs.Dayjs] | null;
|
|
34
|
+
/** Compatibility helper retained for existing callers and tests. */
|
|
35
|
+
export declare function normalizeDateVariableOutput(rawValue: unknown, options: DateVariableComponentProps): unknown;
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
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 './dateValue';
|
|
10
|
+
export * from './DateVariableEditor';
|
|
11
|
+
export * from './FieldValueVariableInput';
|
|
@@ -6,7 +6,13 @@
|
|
|
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 type { AxiosRequestConfig } from 'axios';
|
|
10
|
+
type UpdateRecordActionParams = {
|
|
11
|
+
assignedValues?: unknown;
|
|
12
|
+
requestConfig?: AxiosRequestConfig;
|
|
13
|
+
};
|
|
9
14
|
export declare function refreshLinkageRulesAfterUpdate(ctx: any): Promise<void>;
|
|
10
|
-
export declare function applyUpdateRecordAction(ctx: any, params:
|
|
15
|
+
export declare function applyUpdateRecordAction(ctx: any, params: UpdateRecordActionParams, options?: {
|
|
11
16
|
settingsFlowKey?: string;
|
|
12
|
-
}): Promise<
|
|
17
|
+
}): Promise<boolean>;
|
|
18
|
+
export {};
|
|
@@ -24,6 +24,12 @@ type DefaultCollectionBlockModelStructure = {
|
|
|
24
24
|
type CustomFormBlockModelClassesEnum = {};
|
|
25
25
|
export declare class FormBlockModel<T extends DefaultCollectionBlockModelStructure = DefaultCollectionBlockModelStructure> extends CollectionBlockModel<T> {
|
|
26
26
|
formValueRuntime?: FormValueRuntime;
|
|
27
|
+
serialize(): {
|
|
28
|
+
variableContractType: {
|
|
29
|
+
type: string;
|
|
30
|
+
use: string;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
27
33
|
private userModifiedTopLevelFields;
|
|
28
34
|
get form(): FormInstance<any>;
|
|
29
35
|
_defaultCustomModelClasses: {
|
|
@@ -18,6 +18,12 @@ export type DefaultFormGridStructure = {
|
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
20
|
export declare class FormGridModel<T extends DefaultFormGridStructure = DefaultFormGridStructure> extends GridModel<T> {
|
|
21
|
+
serialize(): {
|
|
22
|
+
variableContractType: {
|
|
23
|
+
type: string;
|
|
24
|
+
use: string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
21
27
|
itemFallback: React.JSX.Element;
|
|
22
28
|
itemSettingsMenuLevel: number;
|
|
23
29
|
itemFlowSettings: {
|
|
@@ -6,10 +6,12 @@
|
|
|
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 type { FlowModelOptions } from '@nocobase/flow-engine';
|
|
9
10
|
import React from 'react';
|
|
10
11
|
import { TableCustomColumnModel } from './TableCustomColumnModel';
|
|
11
12
|
export declare class JSColumnModel extends TableCustomColumnModel {
|
|
12
13
|
private _RenderComponent?;
|
|
14
|
+
onInit(options: FlowModelOptions): void;
|
|
13
15
|
renderHiddenInConfig(): React.JSX.Element;
|
|
14
16
|
getInputArgs(): {};
|
|
15
17
|
getColumnProps(): {
|