@nocobase/flow-engine 2.1.0-beta.44 → 2.1.0-beta.45

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.
@@ -19,6 +19,7 @@ export interface BuildFieldChildrenOptions {
19
19
  fieldUseModel?: string | ((field: any) => string);
20
20
  collection?: Collection;
21
21
  associationPathName?: string;
22
+ maxAssociationFieldDepth?: number;
22
23
  /**
23
24
  * 点击这些子项后,除自身路径外,还需要联动刷新的其他菜单路径前缀
24
25
  */
@@ -231,14 +231,18 @@ function buildSubModelGroups(subModelBaseClasses = []) {
231
231
  }
232
232
  __name(buildSubModelGroups, "buildSubModelGroups");
233
233
  function buildWrapperFieldChildren(ctx, options) {
234
- var _a;
235
- const { useModel, fieldUseModel, associationPathName, refreshTargets } = options;
234
+ var _a, _b;
235
+ const { useModel, fieldUseModel, associationPathName, refreshTargets, maxAssociationFieldDepth = 2 } = options;
236
236
  const collection = options.collection || ctx.model["collection"] || ctx.collection;
237
237
  const fields = collection.getFields();
238
238
  const defaultItemKeys = ["fieldSettings", "init"];
239
239
  const children = [];
240
+ const associationDepth = associationPathName ? associationPathName.split(".").filter(Boolean).length : 0;
240
241
  for (const f of fields) {
241
242
  if (!((_a = f == null ? void 0 : f.options) == null ? void 0 : _a.interface)) continue;
243
+ if (associationDepth >= maxAssociationFieldDepth && (((_b = f.isAssociationField) == null ? void 0 : _b.call(f)) || f.target || f.targetCollection)) {
244
+ continue;
245
+ }
242
246
  const fieldPath = associationPathName ? `${associationPathName}.${f.name}` : f.name;
243
247
  const childUse = typeof fieldUseModel === "function" ? fieldUseModel(f) : fieldUseModel ?? "FieldModel";
244
248
  if (childUse) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/flow-engine",
3
- "version": "2.1.0-beta.44",
3
+ "version": "2.1.0-beta.45",
4
4
  "private": false,
5
5
  "description": "A standalone flow engine for NocoBase, managing workflows, models, and actions.",
6
6
  "main": "lib/index.js",
@@ -8,8 +8,8 @@
8
8
  "dependencies": {
9
9
  "@formily/antd-v5": "1.x",
10
10
  "@formily/reactive": "2.x",
11
- "@nocobase/sdk": "2.1.0-beta.44",
12
- "@nocobase/shared": "2.1.0-beta.44",
11
+ "@nocobase/sdk": "2.1.0-beta.45",
12
+ "@nocobase/shared": "2.1.0-beta.45",
13
13
  "ahooks": "^3.7.2",
14
14
  "axios": "^1.7.0",
15
15
  "dayjs": "^1.11.9",
@@ -37,5 +37,5 @@
37
37
  ],
38
38
  "author": "NocoBase Team",
39
39
  "license": "Apache-2.0",
40
- "gitHead": "540d4897b1696cc24c0754521b0b766978b4933c"
40
+ "gitHead": "42587115fc34c3eb01ef2b2549f1c998e5708318"
41
41
  }
@@ -232,6 +232,7 @@ export interface BuildFieldChildrenOptions {
232
232
  fieldUseModel?: string | ((field: any) => string);
233
233
  collection?: Collection;
234
234
  associationPathName?: string;
235
+ maxAssociationFieldDepth?: number;
235
236
  /**
236
237
  * 点击这些子项后,除自身路径外,还需要联动刷新的其他菜单路径前缀
237
238
  */
@@ -239,13 +240,17 @@ export interface BuildFieldChildrenOptions {
239
240
  }
240
241
 
241
242
  export function buildWrapperFieldChildren(ctx: FlowModelContext, options: BuildFieldChildrenOptions) {
242
- const { useModel, fieldUseModel, associationPathName, refreshTargets } = options;
243
+ const { useModel, fieldUseModel, associationPathName, refreshTargets, maxAssociationFieldDepth = 2 } = options;
243
244
  const collection: Collection = options.collection || ctx.model['collection'] || ctx.collection;
244
245
  const fields = collection.getFields();
245
246
  const defaultItemKeys = ['fieldSettings', 'init'];
246
247
  const children: SubModelItem[] = [];
248
+ const associationDepth = associationPathName ? associationPathName.split('.').filter(Boolean).length : 0;
247
249
  for (const f of fields) {
248
250
  if (!f?.options?.interface) continue;
251
+ if (associationDepth >= maxAssociationFieldDepth && (f.isAssociationField?.() || f.target || f.targetCollection)) {
252
+ continue;
253
+ }
249
254
  const fieldPath = associationPathName ? `${associationPathName}.${f.name}` : f.name;
250
255
 
251
256
  const childUse = typeof fieldUseModel === 'function' ? fieldUseModel(f) : fieldUseModel ?? 'FieldModel';