@nocobase/plugin-collection-tree 2.2.0-alpha.7 → 2.2.0-beta.10

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,13 +8,13 @@
8
8
  */
9
9
 
10
10
  module.exports = {
11
- "@nocobase/client": "2.2.0-alpha.7",
12
- "@nocobase/client-v2": "2.2.0-alpha.7",
13
- "@nocobase/plugin-data-source-manager": "2.2.0-alpha.7",
14
- "@nocobase/database": "2.2.0-alpha.7",
15
- "@nocobase/utils": "2.2.0-alpha.7",
11
+ "@nocobase/client": "2.2.0-beta.10",
12
+ "@nocobase/client-v2": "2.2.0-beta.10",
13
+ "@nocobase/plugin-data-source-manager": "2.2.0-beta.10",
14
+ "@nocobase/database": "2.2.0-beta.10",
15
+ "@nocobase/utils": "2.2.0-beta.10",
16
16
  "lodash": "4.18.1",
17
- "@nocobase/data-source-manager": "2.2.0-alpha.7",
18
- "@nocobase/server": "2.2.0-alpha.7",
17
+ "@nocobase/data-source-manager": "2.2.0-beta.10",
18
+ "@nocobase/server": "2.2.0-beta.10",
19
19
  "sequelize": "6.35.2"
20
20
  };
@@ -65,17 +65,10 @@ class PluginCollectionTreeServer extends import_server.Plugin {
65
65
  if (collection.options.schema) {
66
66
  options["schema"] = collection.options.schema;
67
67
  }
68
- let nodePkType = "bigInt";
69
68
  if (eventOptions.fieldModels) {
70
- const pk = eventOptions.fieldModels.find((x) => x.options.primaryKey === true);
71
- if (pk) {
72
- nodePkType = pk.type;
73
- }
69
+ options["fieldModels"] = eventOptions.fieldModels;
74
70
  }
75
- this.defineTreePathCollection(name, {
76
- ...options,
77
- nodePkType
78
- });
71
+ this.defineTreePathCollection(name, options);
79
72
  collectionManager.db.on(`${collection.name}.afterSync`, async ({ transaction }) => {
80
73
  await this.db.getCollection(name).sync({ transaction });
81
74
  });
@@ -190,7 +183,13 @@ class PluginCollectionTreeServer extends import_server.Plugin {
190
183
  });
191
184
  }
192
185
  async defineTreePathCollection(name, options) {
193
- const { nodePkType, ...collectionOptions } = options;
186
+ let nodePkType = "bigInt";
187
+ if (options.fieldModels) {
188
+ const pk = options.fieldModels.find((x) => x.options.primaryKey === true);
189
+ if (pk) {
190
+ nodePkType = pk.type;
191
+ }
192
+ }
194
193
  this.db.collection({
195
194
  name,
196
195
  autoGenId: false,
@@ -205,7 +204,7 @@ class PluginCollectionTreeServer extends import_server.Plugin {
205
204
  fields: [{ name: "path", length: 191 }]
206
205
  }
207
206
  ],
208
- ...collectionOptions
207
+ ...options
209
208
  });
210
209
  }
211
210
  async getTreePath(model, path, collection, pathCollectionName, transaction) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-collection-tree",
3
- "version": "2.2.0-alpha.7",
3
+ "version": "2.2.0-beta.10",
4
4
  "displayName": "Collection: Tree",
5
5
  "displayName.ru-RU": "Древовидная Коллекция",
6
6
  "displayName.zh-CN": "数据表:树",
@@ -19,5 +19,5 @@
19
19
  "@nocobase/test": "2.x"
20
20
  },
21
21
  "license": "Apache-2.0",
22
- "gitHead": "34ba02960fca9ab0b6881d3db7040a8a64067bba"
22
+ "gitHead": "d572beec24de46df948f28db72b25303a63bf62d"
23
23
  }