@nocobase/client 2.0.0-beta.21 → 2.0.0-beta.23
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/data-source/collection/utils.d.ts +2 -4
- package/es/flow/actions/blockHeight.d.ts +9 -0
- package/es/flow/actions/filterFormDefaultValues.d.ts +9 -0
- package/es/flow/actions/formAssignRules.d.ts +9 -0
- package/es/flow/actions/index.d.ts +3 -0
- package/es/flow/components/BlockItemCard.d.ts +1 -0
- package/es/flow/components/ConditionBuilder.d.ts +2 -0
- package/es/flow/components/FieldAssignEditor.d.ts +32 -0
- package/es/flow/components/FieldAssignRulesEditor.d.ts +43 -0
- package/es/flow/components/FieldAssignValueInput.d.ts +12 -1
- package/es/flow/components/RunJSValueEditor.d.ts +19 -0
- package/es/flow/components/fieldAssignOptions.d.ts +23 -0
- package/es/flow/components/filter/LinkageFilterItem.d.ts +4 -1
- package/es/flow/index.d.ts +1 -0
- package/es/flow/internal/utils/modelUtils.d.ts +23 -0
- package/es/flow/internal/utils/saveStepParamsWithSubModels.d.ts +11 -0
- package/es/flow/models/base/BlockModel.d.ts +2 -1
- package/es/flow/models/base/PageModel/PageModel.d.ts +8 -0
- package/es/flow/models/blocks/details/DetailsGridModel.d.ts +1 -0
- package/es/flow/models/blocks/details/utils.d.ts +16 -0
- package/es/flow/models/blocks/filter-form/FilterFormBlockModel.d.ts +6 -0
- package/es/flow/models/blocks/filter-form/FilterFormItemModel.d.ts +2 -0
- package/es/flow/models/blocks/filter-form/fields/FilterFormRecordSelectFieldModel.d.ts +12 -0
- package/es/flow/models/blocks/filter-form/fields/index.d.ts +1 -0
- package/es/flow/models/blocks/filter-form/legacyDefaultValueMigration.d.ts +13 -0
- package/es/flow/models/blocks/filter-form/valueNormalization.d.ts +17 -0
- package/es/flow/models/blocks/form/FormBlockModel.d.ts +16 -0
- package/es/flow/models/blocks/form/FormGridModel.d.ts +1 -0
- package/es/flow/models/blocks/form/assignRulesUpdateAssociationValues.d.ts +18 -0
- package/es/flow/models/blocks/form/dynamicNamePath.d.ts +19 -0
- package/es/flow/models/blocks/form/legacyDefaultValueMigration.d.ts +13 -0
- package/es/flow/models/blocks/form/submitValues.d.ts +19 -0
- package/es/flow/models/blocks/form/value-runtime/conditions.d.ts +9 -0
- package/es/flow/models/blocks/form/value-runtime/deps.d.ts +23 -0
- package/es/flow/models/blocks/form/value-runtime/form-patch.d.ts +19 -0
- package/es/flow/models/blocks/form/value-runtime/index.d.ts +11 -0
- package/es/flow/models/blocks/form/value-runtime/path.d.ts +25 -0
- package/es/flow/models/blocks/form/value-runtime/rules.d.ts +121 -0
- package/es/flow/models/blocks/form/value-runtime/runtime.d.ts +75 -0
- package/es/flow/models/blocks/form/value-runtime/types.d.ts +60 -0
- package/es/flow/models/blocks/form/value-runtime/utils.d.ts +12 -0
- package/es/flow/models/blocks/shared/legacyDefaultValueMigrationBase.d.ts +20 -0
- package/es/flow/models/blocks/table/TableSelectModel.d.ts +0 -1
- package/es/flow/models/blocks/table/dragSort/dragSortComponents.d.ts +14 -0
- package/es/flow/models/blocks/table/dragSort/dragSortHooks.d.ts +13 -0
- package/es/flow/models/blocks/table/dragSort/dragSortSettings.d.ts +39 -0
- package/es/flow/models/blocks/table/dragSort/dragSortUtils.d.ts +37 -0
- package/es/flow/models/blocks/table/dragSort/index.d.ts +12 -0
- package/es/flow/models/blocks/table/utils.d.ts +8 -8
- package/es/flow/models/fields/AssociationFieldModel/RecordPickerFieldModel.d.ts +8 -1
- package/es/flow/models/fields/AssociationFieldModel/SubTableFieldModel/SubTableColumnModel.d.ts +1 -1
- package/es/flow/models/fields/AssociationFieldModel/itemChain.d.ts +94 -0
- package/es/flow/models/fields/AssociationFieldModel/recordSelectShared.d.ts +1 -0
- package/es/index.mjs +30308 -24976
- package/es/route-switch/antd/admin-layout/index.d.ts +1 -1
- package/lib/index.js +359 -333
- package/lib/locale/de-DE.json +2 -0
- package/lib/locale/en-US.json +24 -0
- package/lib/locale/es-ES.json +2 -0
- package/lib/locale/fr-FR.json +2 -0
- package/lib/locale/hu-HU.json +2 -0
- package/lib/locale/id-ID.json +2 -0
- package/lib/locale/it-IT.json +2 -0
- package/lib/locale/ja-JP.json +2 -0
- package/lib/locale/ko-KR.json +2 -0
- package/lib/locale/nl-NL.json +2 -0
- package/lib/locale/pt-BR.json +2 -0
- package/lib/locale/ru-RU.json +2 -0
- package/lib/locale/tr-TR.json +2 -0
- package/lib/locale/uk-UA.json +2 -0
- package/lib/locale/vi-VN.json +2 -0
- package/lib/locale/zh-CN.json +33 -4
- package/lib/locale/zh-TW.json +12 -0
- package/package.json +6 -6
|
@@ -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 './types';
|
|
10
|
+
export { FormValueRuntime } from './runtime';
|
|
11
|
+
export { isEmptyValue } from './utils';
|
|
@@ -0,0 +1,25 @@
|
|
|
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 { NamePath } from './types';
|
|
10
|
+
export type PathSegment = string | number | {
|
|
11
|
+
placeholder: string;
|
|
12
|
+
};
|
|
13
|
+
export declare function parsePathString(path: string): PathSegment[];
|
|
14
|
+
/**
|
|
15
|
+
* Resolve a dynamic NamePath using the current row index context (`fieldIndex`).
|
|
16
|
+
*
|
|
17
|
+
* - Supports placeholders: `users[placeholder].name`
|
|
18
|
+
* - Auto-fills to-many index when omitted: `users.name` -> `users[ctxIndex].name`
|
|
19
|
+
*
|
|
20
|
+
* Returns `null` when a placeholder can't be resolved in current context.
|
|
21
|
+
*/
|
|
22
|
+
export declare function resolveDynamicNamePath(path: string | NamePath, fieldIndex?: unknown): NamePath | null;
|
|
23
|
+
export declare function namePathToPathKey(namePath: Array<string | number>): string;
|
|
24
|
+
export declare function pathKeyToNamePath(pathKey: string): NamePath;
|
|
25
|
+
export declare function buildAncestorKeys(namePath: NamePath): string[];
|
|
@@ -0,0 +1,121 @@
|
|
|
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 { FlowModel } from '@nocobase/flow-engine';
|
|
10
|
+
import { DepCollector } from './deps';
|
|
11
|
+
import type { FormAssignRuleItem, FormValueWriteMeta, NamePath, Patch, SetOptions, ValueSource } from './types';
|
|
12
|
+
type ObservableBinding = {
|
|
13
|
+
source: ValueSource;
|
|
14
|
+
dispose: () => void;
|
|
15
|
+
};
|
|
16
|
+
export type RuleEngineOptions = {
|
|
17
|
+
getBlockModelUid: () => string;
|
|
18
|
+
getActionName: () => string | undefined;
|
|
19
|
+
getBlockContext: () => any;
|
|
20
|
+
getEngine: () => any;
|
|
21
|
+
getEngineModel: (uid: string) => FlowModel | null;
|
|
22
|
+
isDisposed: () => boolean;
|
|
23
|
+
valuesMirror: any;
|
|
24
|
+
changeTick: {
|
|
25
|
+
value: number;
|
|
26
|
+
};
|
|
27
|
+
getWriteSeq: () => number;
|
|
28
|
+
txWriteCounts: Map<string, Map<string, number>>;
|
|
29
|
+
createTrackingFormValues: (collector: DepCollector) => any;
|
|
30
|
+
tryResolveNamePath: (callerCtx: any, path: string | NamePath) => NamePath | null;
|
|
31
|
+
getFormValueAtPath: (namePath: NamePath) => any;
|
|
32
|
+
setFormValues: (callerCtx: any, patch: Patch, options?: SetOptions) => Promise<void>;
|
|
33
|
+
findExplicitHit: (pathKey: string) => string | null;
|
|
34
|
+
lastDefaultValueByPathKey: Map<string, any>;
|
|
35
|
+
lastWriteMetaByPathKey: Map<string, FormValueWriteMeta>;
|
|
36
|
+
observableBindings: Map<string, ObservableBinding>;
|
|
37
|
+
};
|
|
38
|
+
export declare class RuleEngine {
|
|
39
|
+
private readonly options;
|
|
40
|
+
private readonly rules;
|
|
41
|
+
private readonly lastRuleWriteByTargetKey;
|
|
42
|
+
private readonly assignTemplatesByTargetPath;
|
|
43
|
+
/** 当前表单中“已配置到 UI 的字段(FormItemModel)”的 targetPath 集合,用于避免对 row grid 重复注册规则 */
|
|
44
|
+
private readonly formItemTargetPaths;
|
|
45
|
+
/** targetPath -> updateAssociation(SubForm/SubTable 等) */
|
|
46
|
+
private readonly updateAssociationByTargetPath;
|
|
47
|
+
private readonly pendingRuleIds;
|
|
48
|
+
private readonly ruleDebounceUntilById;
|
|
49
|
+
private readonly ruleDebounceTimersById;
|
|
50
|
+
private readonly defaultRuleIdsByMasterUid;
|
|
51
|
+
private readonly defaultRuleMasterDisposers;
|
|
52
|
+
private runningRules;
|
|
53
|
+
private rulesEnabled;
|
|
54
|
+
private currentRuleTxId;
|
|
55
|
+
constructor(options: RuleEngineOptions);
|
|
56
|
+
private getAssignRuleBlockId;
|
|
57
|
+
private removeAssignRuleBlockInstance;
|
|
58
|
+
private removeRowGridAssignRuleInstances;
|
|
59
|
+
private hasAnyNonBlockAssignRuleInstance;
|
|
60
|
+
private ensureBlockAssignRuleInstancesForTargetPath;
|
|
61
|
+
private getCollectionFromContext;
|
|
62
|
+
private getRootCollection;
|
|
63
|
+
private shouldCreateBlockLevelAssignRule;
|
|
64
|
+
/**
|
|
65
|
+
* 对关联字段嵌套属性(如 user.name / user.profile.name):
|
|
66
|
+
* - 依赖应包含关联对象本身(user / user.profile),否则当关联对象从 null -> {id} 时,user.name 仍为 undefined,无法触发 rule re-run。
|
|
67
|
+
* - 写入前需校验关联对象已存在,避免隐式创建关联对象。
|
|
68
|
+
*/
|
|
69
|
+
private collectAssociationPrefixPaths;
|
|
70
|
+
private shouldSkipToManyAssociationWriteWithoutIndex;
|
|
71
|
+
private shouldSkipAssociationNestedWrite;
|
|
72
|
+
private getAssociationTargetKeyFields;
|
|
73
|
+
private resolveAssociationFieldByPrefixPath;
|
|
74
|
+
private isAssociationTargetKeyWrite;
|
|
75
|
+
private collectUpdateAssociationInitPatches;
|
|
76
|
+
dispose(): void;
|
|
77
|
+
enable(): void;
|
|
78
|
+
syncAssignRules(items: FormAssignRuleItem[]): void;
|
|
79
|
+
onModelMounted(model: FlowModel): void;
|
|
80
|
+
onModelUnmounted(model: FlowModel): void;
|
|
81
|
+
private isModelInThisForm;
|
|
82
|
+
private cacheUpdateAssociationForModel;
|
|
83
|
+
private getUpdateAssociationForTargetPath;
|
|
84
|
+
private getDefaultRuleId;
|
|
85
|
+
private getModelTargetNamePath;
|
|
86
|
+
private tryRegisterDefaultRuleInstance;
|
|
87
|
+
private getModelTargetPath;
|
|
88
|
+
private getAssignRuleInstanceId;
|
|
89
|
+
private getDeepestFieldIndexKey;
|
|
90
|
+
private getDeepestToManyAssociationKey;
|
|
91
|
+
private isRowGridModel;
|
|
92
|
+
private tryRegisterAssignRuleInstancesForModel;
|
|
93
|
+
private tryUnregisterAssignRuleInstancesForModel;
|
|
94
|
+
private tryUnregisterDefaultRuleInstance;
|
|
95
|
+
private bindMasterInitialValue;
|
|
96
|
+
private removeRule;
|
|
97
|
+
private scheduleRule;
|
|
98
|
+
private flushRules;
|
|
99
|
+
private runRule;
|
|
100
|
+
private prepareRuleContext;
|
|
101
|
+
private shouldApplyDefaultRuleInCurrentState;
|
|
102
|
+
private shouldRunRule;
|
|
103
|
+
private createRuleCollectorAndContext;
|
|
104
|
+
private evaluateRuleCondition;
|
|
105
|
+
private resolveRuleValue;
|
|
106
|
+
private resolveRunJSValue;
|
|
107
|
+
private resolveTemplateValue;
|
|
108
|
+
private commitRuleDeps;
|
|
109
|
+
/**
|
|
110
|
+
* Check if default rule value can be applied.
|
|
111
|
+
* Default value can overwrite when:
|
|
112
|
+
* 1. Current value is empty
|
|
113
|
+
* 2. Current value equals the last default value (user hasn't modified it)
|
|
114
|
+
*/
|
|
115
|
+
private checkDefaultRuleCanApply;
|
|
116
|
+
private createRuleEvaluationContext;
|
|
117
|
+
private buildItemChainValue;
|
|
118
|
+
private getFieldIndexSignature;
|
|
119
|
+
private updateRuleDeps;
|
|
120
|
+
}
|
|
121
|
+
export {};
|
|
@@ -0,0 +1,75 @@
|
|
|
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 { FormInstance } from 'antd';
|
|
10
|
+
import type { FlowModel } from '@nocobase/flow-engine';
|
|
11
|
+
import type { FormAssignRuleItem, NamePath, Patch, SetOptions } from './types';
|
|
12
|
+
type FormBlockModel = FlowModel & {
|
|
13
|
+
getAclActionName?: () => string;
|
|
14
|
+
};
|
|
15
|
+
export declare class FormValueRuntime {
|
|
16
|
+
private readonly model;
|
|
17
|
+
private readonly getForm;
|
|
18
|
+
private readonly valuesMirror;
|
|
19
|
+
private readonly explicitSet;
|
|
20
|
+
private readonly lastDefaultValueByPathKey;
|
|
21
|
+
private readonly lastWriteMetaByPathKey;
|
|
22
|
+
private readonly observableBindings;
|
|
23
|
+
private readonly changeTick;
|
|
24
|
+
private readonly txWriteCounts;
|
|
25
|
+
private writeSeq;
|
|
26
|
+
private disposed;
|
|
27
|
+
private suppressFormCallbackDepth;
|
|
28
|
+
private lastObservedChangedPaths;
|
|
29
|
+
private lastObservedSource;
|
|
30
|
+
private lastObservedToken;
|
|
31
|
+
private readonly formValuesProxy;
|
|
32
|
+
private mountedListener?;
|
|
33
|
+
private unmountedListener?;
|
|
34
|
+
private readonly formPatcher;
|
|
35
|
+
private readonly ruleEngine;
|
|
36
|
+
constructor(options: {
|
|
37
|
+
model: FormBlockModel;
|
|
38
|
+
getForm: () => FormInstance;
|
|
39
|
+
});
|
|
40
|
+
/**
|
|
41
|
+
* 同步“表单赋值”配置到运行时规则引擎。
|
|
42
|
+
*
|
|
43
|
+
* - mode=default → source=default(遵循 explicit/空值覆盖语义)
|
|
44
|
+
* - mode=assign → source=system(不受 explicit 影响,依赖变化时持续生效)
|
|
45
|
+
*/
|
|
46
|
+
syncAssignRules(items: FormAssignRuleItem[]): void;
|
|
47
|
+
get formValues(): any;
|
|
48
|
+
getFormValuesSnapshot(): any;
|
|
49
|
+
private getFormValueAtPath;
|
|
50
|
+
mount(options?: {
|
|
51
|
+
sync?: boolean;
|
|
52
|
+
}): void;
|
|
53
|
+
dispose(): void;
|
|
54
|
+
isSuppressed(): boolean;
|
|
55
|
+
handleFormFieldsChange(changedFields: Array<{
|
|
56
|
+
name?: NamePath | string | number;
|
|
57
|
+
touched?: boolean;
|
|
58
|
+
}>): void;
|
|
59
|
+
handleFormValuesChange(changedValues: any, allValues: any): void;
|
|
60
|
+
private deriveExplicitPaths;
|
|
61
|
+
private collectExplicitDiffPaths;
|
|
62
|
+
private pushExplicitPath;
|
|
63
|
+
private isPlainObjectValue;
|
|
64
|
+
private isObjectCleared;
|
|
65
|
+
setFormValues(callerCtx: any, patch: Patch, options?: SetOptions): Promise<void>;
|
|
66
|
+
private applyBoundValue;
|
|
67
|
+
private resolveNamePath;
|
|
68
|
+
private tryResolveNamePath;
|
|
69
|
+
private bumpChangeTick;
|
|
70
|
+
private emitFormValuesChange;
|
|
71
|
+
private markExplicit;
|
|
72
|
+
private isExplicit;
|
|
73
|
+
private findExplicitHit;
|
|
74
|
+
}
|
|
75
|
+
export {};
|
|
@@ -0,0 +1,60 @@
|
|
|
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 type NamePath = Array<string | number>;
|
|
10
|
+
export type ValueSource = 'default' | 'linkage' | 'user' | 'system';
|
|
11
|
+
export type Patch = Record<string, any> | Array<{
|
|
12
|
+
path: string | NamePath;
|
|
13
|
+
value: any;
|
|
14
|
+
condition?: any;
|
|
15
|
+
}>;
|
|
16
|
+
export interface SetOptions {
|
|
17
|
+
source?: ValueSource;
|
|
18
|
+
triggerEvent?: boolean;
|
|
19
|
+
markExplicit?: boolean;
|
|
20
|
+
txId?: string;
|
|
21
|
+
/**
|
|
22
|
+
* linkage 规则定义所在层级,数值越大表示层级越内层。
|
|
23
|
+
* 仅在 source='linkage' 且 linkageTxId 有效时参与同事务冲突裁决。
|
|
24
|
+
*/
|
|
25
|
+
linkageScopeDepth?: number;
|
|
26
|
+
/**
|
|
27
|
+
* linkage 链路事务 id(通常来自 formValuesChange payload 的 txId)。
|
|
28
|
+
* 仅在 source='linkage' 时使用。
|
|
29
|
+
*/
|
|
30
|
+
linkageTxId?: string;
|
|
31
|
+
}
|
|
32
|
+
export interface FormValueWriteMeta {
|
|
33
|
+
source: ValueSource;
|
|
34
|
+
writeSeq: number;
|
|
35
|
+
linkageScopeDepth?: number;
|
|
36
|
+
linkageTxId?: string;
|
|
37
|
+
}
|
|
38
|
+
export interface FormValuesChangePayload {
|
|
39
|
+
source: ValueSource;
|
|
40
|
+
txId: string;
|
|
41
|
+
/**
|
|
42
|
+
* linkage 链路根事务 id。
|
|
43
|
+
* 用于跨事件继续沿用同一 linkage 冲突裁决边界。
|
|
44
|
+
*/
|
|
45
|
+
linkageTxId?: string;
|
|
46
|
+
changedPaths: NamePath[];
|
|
47
|
+
changedValues?: any;
|
|
48
|
+
allValues?: any;
|
|
49
|
+
allValuesSnapshot?: any;
|
|
50
|
+
}
|
|
51
|
+
export type AssignMode = 'default' | 'assign';
|
|
52
|
+
export type FormAssignRuleItem = {
|
|
53
|
+
key?: string;
|
|
54
|
+
enable?: boolean;
|
|
55
|
+
/** 赋值目标路径,例如 `title` / `users.nickname` / `user.name` */
|
|
56
|
+
targetPath?: string;
|
|
57
|
+
mode?: AssignMode;
|
|
58
|
+
condition?: any;
|
|
59
|
+
value?: any;
|
|
60
|
+
};
|
|
@@ -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
|
+
/** Maximum writes per path per transaction to prevent rule oscillation loops */
|
|
10
|
+
export declare const MAX_WRITES_PER_PATH_PER_TX = 20;
|
|
11
|
+
export declare function isEmptyValue(v: any): boolean;
|
|
12
|
+
export declare function createTxId(): string;
|
|
@@ -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 { FieldAssignRuleItem } from '../../../components/FieldAssignRulesEditor';
|
|
10
|
+
export interface LegacyValueExtractor {
|
|
11
|
+
(model: any): any | undefined;
|
|
12
|
+
}
|
|
13
|
+
export interface LegacyClearer {
|
|
14
|
+
(model: any): void;
|
|
15
|
+
}
|
|
16
|
+
export declare function createLegacyValueExtractor(flowKeys: string[]): LegacyValueExtractor;
|
|
17
|
+
export declare function createLegacyClearer(flowKeys: string[]): LegacyClearer;
|
|
18
|
+
export declare function collectLegacyDefaultValueRules(formModel: any, extractor: LegacyValueExtractor): FieldAssignRuleItem[];
|
|
19
|
+
export declare function mergeAssignRulesWithLegacyDefaults(existing: FieldAssignRuleItem[] | undefined, legacyDefaults: FieldAssignRuleItem[]): FieldAssignRuleItem[];
|
|
20
|
+
export declare function clearLegacyDefaultValues(formModel: any, extractor: LegacyValueExtractor, clearer: LegacyClearer): any[];
|
|
@@ -0,0 +1,14 @@
|
|
|
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 declare const SortHandle: React.FC<{
|
|
11
|
+
id: string | number;
|
|
12
|
+
style?: React.CSSProperties;
|
|
13
|
+
}>;
|
|
14
|
+
export declare const SortableRow: (props: any) => React.JSX.Element;
|
|
@@ -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
|
+
import React from 'react';
|
|
10
|
+
import type { TableBlockModel } from '../TableBlockModel';
|
|
11
|
+
export declare function useDragSortBodyWrapper(model: TableBlockModel, dataSourceRef: React.MutableRefObject<any>, getRowKeyFunc: (record: any) => string | number): (props: any) => React.JSX.Element;
|
|
12
|
+
export declare function useDragSortRowComponent(dragSort: boolean): (props: any) => React.JSX.Element;
|
|
13
|
+
export declare function initDragSortParams(model: TableBlockModel): void;
|
|
@@ -0,0 +1,39 @@
|
|
|
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 const dragSortSettings: {
|
|
10
|
+
title: string;
|
|
11
|
+
uiMode: {
|
|
12
|
+
type: "switch";
|
|
13
|
+
key: string;
|
|
14
|
+
};
|
|
15
|
+
defaultParams: {
|
|
16
|
+
dragSort: boolean;
|
|
17
|
+
};
|
|
18
|
+
handler(ctx: any, params: any): Promise<void>;
|
|
19
|
+
};
|
|
20
|
+
export declare const dragSortBySettings: {
|
|
21
|
+
title: string;
|
|
22
|
+
hideInSettings(ctx: any): boolean;
|
|
23
|
+
uiMode: (ctx: any) => {
|
|
24
|
+
type: "select";
|
|
25
|
+
key: string;
|
|
26
|
+
props: {
|
|
27
|
+
options: {
|
|
28
|
+
label: any;
|
|
29
|
+
value: any;
|
|
30
|
+
disabled: any;
|
|
31
|
+
}[];
|
|
32
|
+
placeholder: any;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
defaultParams: {
|
|
36
|
+
dragSortBy: any;
|
|
37
|
+
};
|
|
38
|
+
handler(ctx: any, params: any): void;
|
|
39
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
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 { Collection } from '@nocobase/flow-engine';
|
|
10
|
+
/**
|
|
11
|
+
* 从 collection 中获取所有 sort 类型的字段
|
|
12
|
+
* @param collection - 集合对象
|
|
13
|
+
* @returns 排序字段数组
|
|
14
|
+
*/
|
|
15
|
+
export declare function getSortFields(collection: Collection | undefined): import("@nocobase/flow-engine").CollectionField[];
|
|
16
|
+
/**
|
|
17
|
+
* 获取 collection 中第一个可用的 sort 字段
|
|
18
|
+
* @param collection - 集合对象
|
|
19
|
+
* @returns 第一个排序字段,如果没有则返回 undefined
|
|
20
|
+
*/
|
|
21
|
+
export declare function getFirstSortField(collection: Collection | undefined): import("@nocobase/flow-engine").CollectionField;
|
|
22
|
+
/**
|
|
23
|
+
* 将 sort 字段转换为选项格式
|
|
24
|
+
* @param fields - 字段数组
|
|
25
|
+
* @returns 选项数组
|
|
26
|
+
*/
|
|
27
|
+
export declare function convertFieldsToOptions(fields: any[]): {
|
|
28
|
+
label: any;
|
|
29
|
+
value: any;
|
|
30
|
+
disabled: any;
|
|
31
|
+
}[];
|
|
32
|
+
/**
|
|
33
|
+
* 检查 collection 是否支持拖拽排序
|
|
34
|
+
* @param collection - 集合对象
|
|
35
|
+
* @returns 如果 collection 有 sort 字段则返回 true
|
|
36
|
+
*/
|
|
37
|
+
export declare function supportsDragSort(collection: Collection | undefined): boolean;
|
|
@@ -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 * from './dragSortUtils';
|
|
10
|
+
export * from './dragSortComponents';
|
|
11
|
+
export * from './dragSortHooks';
|
|
12
|
+
export * from './dragSortSettings';
|
|
@@ -1,11 +1,4 @@
|
|
|
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
|
-
*/
|
|
1
|
+
/// <reference types="react" />
|
|
9
2
|
export declare function extractIndex(str: any): string;
|
|
10
3
|
export declare function adjustColumnOrder(columns: any): any[];
|
|
11
4
|
export declare function setNestedValue(data: any, recordIndex: any, value: any): void;
|
|
@@ -16,3 +9,10 @@ export declare function extractIds(data: any): any[];
|
|
|
16
9
|
* @param key string | string[] 单字段或多字段
|
|
17
10
|
*/
|
|
18
11
|
export declare function getRowKey(record: any, key: string | string[]): any;
|
|
12
|
+
type UseBlockHeightOptions = {
|
|
13
|
+
heightMode?: string;
|
|
14
|
+
tableAreaRef: React.RefObject<HTMLDivElement>;
|
|
15
|
+
deps?: React.DependencyList;
|
|
16
|
+
};
|
|
17
|
+
export declare const useBlockHeight: ({ heightMode, tableAreaRef, deps }: UseBlockHeightOptions) => number;
|
|
18
|
+
export {};
|
|
@@ -6,9 +6,16 @@
|
|
|
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 } from '@nocobase/flow-engine';
|
|
9
|
+
import { CollectionField, FlowModel } from '@nocobase/flow-engine';
|
|
10
10
|
import React from 'react';
|
|
11
11
|
import { FieldModel } from '../../base';
|
|
12
|
+
import { type ItemChain } from './itemChain';
|
|
13
|
+
export declare function buildRecordPickerParentItemContext(ctx: any): {
|
|
14
|
+
parentItem: ItemChain;
|
|
15
|
+
parentItemMeta: any;
|
|
16
|
+
parentItemResolver: ((subPath: string) => boolean) | undefined;
|
|
17
|
+
};
|
|
18
|
+
export declare function injectRecordPickerPopupContext(model: FlowModel, viewCtx: any, fieldModel?: any): void;
|
|
12
19
|
export declare function RecordPickerContent({ model, toOne }: {
|
|
13
20
|
model: any;
|
|
14
21
|
toOne?: boolean;
|
package/es/flow/models/fields/AssociationFieldModel/SubTableFieldModel/SubTableColumnModel.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ import { EditableItemModel, FlowModelContext, ModelRenderMode } from '@nocobase/
|
|
|
10
10
|
import { TableColumnProps } from 'antd';
|
|
11
11
|
import React from 'react';
|
|
12
12
|
import { SubTableFieldModel } from '.';
|
|
13
|
-
import { FieldModel } from '../../../base';
|
|
13
|
+
import { FieldModel } from '../../../base/FieldModel';
|
|
14
14
|
export declare function FieldWithoutPermissionPlaceholder({ targetModel }: {
|
|
15
15
|
targetModel: any;
|
|
16
16
|
}): React.JSX.Element;
|
|
@@ -0,0 +1,94 @@
|
|
|
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 type ItemChain = {
|
|
10
|
+
index?: number;
|
|
11
|
+
length?: number;
|
|
12
|
+
__is_new__?: boolean;
|
|
13
|
+
__is_stored__?: boolean;
|
|
14
|
+
value: any;
|
|
15
|
+
parentItem?: ItemChain;
|
|
16
|
+
};
|
|
17
|
+
export type ItemChainResolver = (subPath: string) => boolean;
|
|
18
|
+
export type ParentItemAccessors = {
|
|
19
|
+
parentPropertiesAccessor: (ctx?: any) => any;
|
|
20
|
+
parentItemMetaAccessor: () => any;
|
|
21
|
+
parentItemResolverAccessor: () => ItemChainResolver | undefined;
|
|
22
|
+
};
|
|
23
|
+
export declare function createItemChainGetter(options: {
|
|
24
|
+
valueAccessor: () => any;
|
|
25
|
+
parentItemAccessor?: () => ItemChain | undefined;
|
|
26
|
+
indexAccessor?: () => number | undefined;
|
|
27
|
+
lengthAccessor?: () => number | undefined;
|
|
28
|
+
isNewAccessor?: () => boolean | undefined;
|
|
29
|
+
isStoredAccessor?: () => boolean | undefined;
|
|
30
|
+
}): () => ItemChain;
|
|
31
|
+
export declare function createRootItemChain(formValues: any): ItemChain;
|
|
32
|
+
export declare function resolveRecordPersistenceState(record: any, filterTargetKey: string | string[] | null | undefined): {
|
|
33
|
+
record: any;
|
|
34
|
+
hasPrimaryKey: boolean;
|
|
35
|
+
isNew: boolean;
|
|
36
|
+
isStored: boolean;
|
|
37
|
+
};
|
|
38
|
+
export declare function buildCurrentItemTitle(t: (key: string) => string, collectionField?: any, fallbackName?: string): string;
|
|
39
|
+
export declare function createParentItemAccessorsFromContext(options: {
|
|
40
|
+
parentContextAccessor: () => any;
|
|
41
|
+
fallbackParentPropertiesAccessor?: (ctx?: any) => any;
|
|
42
|
+
}): ParentItemAccessors;
|
|
43
|
+
export declare function createParentItemAccessorsFromInputArgs(inputArgsAccessor: () => any): ParentItemAccessors;
|
|
44
|
+
export declare function createItemChainMetaFactory(options: {
|
|
45
|
+
t: (key: string) => string;
|
|
46
|
+
title: string;
|
|
47
|
+
showIndex?: boolean;
|
|
48
|
+
showParentIndex?: boolean;
|
|
49
|
+
collectionAccessor: () => any;
|
|
50
|
+
propertiesAccessor: (ctx: any) => any;
|
|
51
|
+
parentCollectionAccessor?: () => any;
|
|
52
|
+
parentPropertiesAccessor?: (ctx: any) => any;
|
|
53
|
+
parentItemMetaAccessor?: () => any;
|
|
54
|
+
}): any;
|
|
55
|
+
export declare function createItemChainResolver(options: {
|
|
56
|
+
collectionAccessor: () => any;
|
|
57
|
+
propertiesAccessor?: () => unknown;
|
|
58
|
+
parentCollectionAccessor?: () => any;
|
|
59
|
+
parentPropertiesAccessor?: () => unknown;
|
|
60
|
+
parentItemResolverAccessor?: () => ((subPath: string) => boolean) | undefined;
|
|
61
|
+
}): (subPath: string) => boolean;
|
|
62
|
+
export type ItemChainMetaAndResolverOptions = {
|
|
63
|
+
metaFactoryOptions: Parameters<typeof createItemChainMetaFactory>[0];
|
|
64
|
+
resolverOptions: Parameters<typeof createItemChainResolver>[0];
|
|
65
|
+
};
|
|
66
|
+
export declare function createItemChainMetaAndResolver(options: ItemChainMetaAndResolverOptions): {
|
|
67
|
+
meta: any;
|
|
68
|
+
resolveOnServer: (subPath: string) => boolean;
|
|
69
|
+
};
|
|
70
|
+
export type AssociationItemChainContextPropertyOptions = {
|
|
71
|
+
t: (key: string) => string;
|
|
72
|
+
title: string;
|
|
73
|
+
showIndex?: boolean;
|
|
74
|
+
showParentIndex?: boolean;
|
|
75
|
+
collectionAccessor: () => any;
|
|
76
|
+
propertiesAccessor: (ctx: any) => any;
|
|
77
|
+
resolverPropertiesAccessor?: () => unknown;
|
|
78
|
+
parentCollectionAccessor?: () => any;
|
|
79
|
+
parentAccessors?: Partial<ParentItemAccessors>;
|
|
80
|
+
useParentItemMeta?: boolean;
|
|
81
|
+
useParentItemResolver?: boolean;
|
|
82
|
+
};
|
|
83
|
+
export declare function createAssociationItemChainContextPropertyOptions(options: AssociationItemChainContextPropertyOptions): {
|
|
84
|
+
serverOnlyWhenContextParams: true;
|
|
85
|
+
meta: any;
|
|
86
|
+
resolveOnServer: (subPath: string) => boolean;
|
|
87
|
+
cache: false;
|
|
88
|
+
};
|
|
89
|
+
export declare function createItemChainContextPropertyOptions(options: ItemChainMetaAndResolverOptions): {
|
|
90
|
+
serverOnlyWhenContextParams: true;
|
|
91
|
+
meta: any;
|
|
92
|
+
resolveOnServer: (subPath: string) => boolean;
|
|
93
|
+
cache: false;
|
|
94
|
+
};
|
|
@@ -21,6 +21,7 @@ export interface LazySelectProps extends Omit<SelectProps<any>, 'mode' | 'option
|
|
|
21
21
|
value?: AssociationOption | AssociationOption[];
|
|
22
22
|
multiple?: boolean;
|
|
23
23
|
allowMultiple?: boolean;
|
|
24
|
+
keepDropdownOpenOnSelect?: boolean;
|
|
24
25
|
options?: AssociationOption[];
|
|
25
26
|
onChange: (option: AssociationOption | AssociationOption[]) => void;
|
|
26
27
|
onDropdownVisibleChange?: (open: boolean) => void;
|