@nocobase/plugin-collection-tree 1.9.32 → 1.9.34

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.32",
12
- "@nocobase/database": "1.9.32",
13
- "@nocobase/utils": "1.9.32",
11
+ "@nocobase/client": "1.9.34",
12
+ "@nocobase/database": "1.9.34",
13
+ "@nocobase/utils": "1.9.34",
14
14
  "lodash": "4.17.21",
15
- "@nocobase/data-source-manager": "1.9.32",
16
- "@nocobase/server": "1.9.32",
15
+ "@nocobase/data-source-manager": "1.9.34",
16
+ "@nocobase/server": "1.9.34",
17
17
  "sequelize": "6.35.2"
18
18
  };
@@ -83,6 +83,24 @@ class PluginCollectionTreeServer extends import_server.Plugin {
83
83
  transaction
84
84
  });
85
85
  });
86
+ this.db.on(`${collection.name}.afterBulkCreate`, async (instances, options2) => {
87
+ const { transaction } = options2;
88
+ const tk = collection.filterTargetKey;
89
+ const records = [];
90
+ for (const model of instances) {
91
+ let path = `/${model.get(tk)}`;
92
+ path = await this.getTreePath(model, path, collection, name, transaction);
93
+ const rootPk = path.split("/")[1] || null;
94
+ records.push({
95
+ nodePk: model.get(tk),
96
+ path,
97
+ rootPk
98
+ });
99
+ }
100
+ await this.app.db.getModel(name).bulkCreate(records, {
101
+ transaction
102
+ });
103
+ });
86
104
  this.db.on(`${collection.name}.afterUpdate`, async (model, options2) => {
87
105
  var _a;
88
106
  const tk = collection.filterTargetKey;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-collection-tree",
3
- "version": "1.9.32",
3
+ "version": "1.9.34",
4
4
  "displayName": "Collection: Tree",
5
5
  "displayName.ru-RU": "Древовидная Коллекция",
6
6
  "displayName.zh-CN": "数据表:树",
@@ -16,5 +16,5 @@
16
16
  "@nocobase/server": "1.x",
17
17
  "@nocobase/test": "1.x"
18
18
  },
19
- "gitHead": "40b6cf8117d8ae2435fead40d26d12647706f852"
19
+ "gitHead": "8779a68face5b8f159aef726f73695f319ab7659"
20
20
  }