@nocobase/plugin-collection-tree 1.9.0-beta.5 → 1.9.0-beta.6

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.
@@ -8,11 +8,11 @@
8
8
  */
9
9
 
10
10
  module.exports = {
11
- "@nocobase/client": "1.9.0-beta.5",
12
- "@nocobase/database": "1.9.0-beta.5",
13
- "@nocobase/utils": "1.9.0-beta.5",
11
+ "@nocobase/client": "1.9.0-beta.6",
12
+ "@nocobase/database": "1.9.0-beta.6",
13
+ "@nocobase/utils": "1.9.0-beta.6",
14
14
  "lodash": "4.17.21",
15
- "@nocobase/data-source-manager": "1.9.0-beta.5",
16
- "@nocobase/server": "1.9.0-beta.5",
15
+ "@nocobase/data-source-manager": "1.9.0-beta.6",
16
+ "@nocobase/server": "1.9.0-beta.6",
17
17
  "sequelize": "6.35.2"
18
18
  };
@@ -7,4 +7,6 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
  import { Application } from '@nocobase/server';
10
+ import { Database, Model, Transaction } from '@nocobase/database';
11
+ export declare function getTreePath(db: Database, model: Model, path: string, collection: string, pathCollectionName: string, transaction?: Transaction): Promise<string>;
10
12
  export default function (app: Application): void;
@@ -36,7 +36,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
36
36
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
37
37
  var sync_path_exports = {};
38
38
  __export(sync_path_exports, {
39
- default: () => sync_path_default
39
+ default: () => sync_path_default,
40
+ getTreePath: () => getTreePath
40
41
  });
41
42
  module.exports = __toCommonJS(sync_path_exports);
42
43
  var import_lodash = __toESM(require("lodash"));
@@ -47,7 +48,6 @@ async function getTreePath(db, model, path, collection, pathCollectionName, tran
47
48
  transaction
48
49
  });
49
50
  if (parent && parent.get("parentId") !== model.get("id")) {
50
- path = `/${parent.get("id")}${path}`;
51
51
  const collectionTreePath = db.getCollection(pathCollectionName);
52
52
  const nodePkColumnName = collectionTreePath.getField("nodePk").columnName();
53
53
  const parentPathData = await db.getRepository(pathCollectionName).findOne({
@@ -56,7 +56,15 @@ async function getTreePath(db, model, path, collection, pathCollectionName, tran
56
56
  });
57
57
  const parentPath = import_lodash.default.get(parentPathData, "path", null);
58
58
  if (parentPath == null) {
59
- path = await getTreePath(db, parent, path, collection, pathCollectionName, transaction);
59
+ const parentFullPath = await getTreePath(
60
+ db,
61
+ parent,
62
+ `/${parent.get("id")}`,
63
+ collection,
64
+ pathCollectionName,
65
+ transaction
66
+ );
67
+ path = `${parentFullPath}/${model.get("id")}`;
60
68
  } else {
61
69
  path = `${parentPath}/${model.get("id")}`;
62
70
  }
@@ -114,3 +122,7 @@ function sync_path_default(app) {
114
122
  });
115
123
  });
116
124
  }
125
+ // Annotate the CommonJS export names for ESM import in node:
126
+ 0 && (module.exports = {
127
+ getTreePath
128
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-collection-tree",
3
- "version": "1.9.0-beta.5",
3
+ "version": "1.9.0-beta.6",
4
4
  "displayName": "Collection: Tree",
5
5
  "displayName.zh-CN": "数据表:树",
6
6
  "description": "Provides tree collection template",
@@ -14,5 +14,5 @@
14
14
  "@nocobase/server": "1.x",
15
15
  "@nocobase/test": "1.x"
16
16
  },
17
- "gitHead": "9a61c60dd3db5af64244e82447309b0cb17aabb6"
17
+ "gitHead": "ada5e359a91135cb9baf605c04c5c380f067a046"
18
18
  }