@nocobase/plugin-data-visualization 1.3.0-alpha.20240710141659 → 1.3.0-alpha.20240710155619

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": "1.3.0-alpha.20240710141659",
11
+ "@nocobase/client": "1.3.0-alpha.20240710155619",
12
12
  "dayjs": "1.11.10",
13
13
  "@formily/react": "2.3.0",
14
14
  "@formily/shared": "2.3.0",
15
15
  "lodash": "4.17.21",
16
- "@nocobase/cache": "1.3.0-alpha.20240710141659",
17
- "@nocobase/server": "1.3.0-alpha.20240710141659",
16
+ "@nocobase/cache": "1.3.0-alpha.20240710155619",
17
+ "@nocobase/server": "1.3.0-alpha.20240710155619",
18
18
  "react": "18.2.0",
19
19
  "@ant-design/icons": "5.2.6",
20
20
  "ahooks": "3.7.8",
@@ -22,9 +22,9 @@ module.exports = {
22
22
  "antd": "5.12.8",
23
23
  "@formily/antd-v5": "1.1.9",
24
24
  "@formily/core": "2.3.0",
25
- "@nocobase/utils": "1.3.0-alpha.20240710141659",
25
+ "@nocobase/utils": "1.3.0-alpha.20240710155619",
26
26
  "react-i18next": "11.18.6",
27
27
  "sequelize": "6.35.2",
28
- "@nocobase/actions": "1.3.0-alpha.20240710141659",
29
- "@nocobase/database": "1.3.0-alpha.20240710141659"
28
+ "@nocobase/actions": "1.3.0-alpha.20240710155619",
29
+ "@nocobase/database": "1.3.0-alpha.20240710155619"
30
30
  };
@@ -1 +1 @@
1
- {"name":"koa-compose","description":"compose Koa middleware","repository":"koajs/compose","version":"4.1.0","keywords":["koa","middleware","compose"],"files":["index.js"],"dependencies":{},"devDependencies":{"codecov":"^3.0.0","jest":"^21.0.0","matcha":"^0.7.0","standard":"^10.0.3"},"scripts":{"bench":"matcha bench/bench.js","lint":"standard --fix .","test":"jest --forceExit --coverage"},"jest":{"testEnvironment":"node"},"license":"MIT","_lastModified":"2024-07-10T14:29:34.020Z"}
1
+ {"name":"koa-compose","description":"compose Koa middleware","repository":"koajs/compose","version":"4.1.0","keywords":["koa","middleware","compose"],"files":["index.js"],"dependencies":{},"devDependencies":{"codecov":"^3.0.0","jest":"^21.0.0","matcha":"^0.7.0","standard":"^10.0.3"},"scripts":{"bench":"matcha bench/bench.js","lint":"standard --fix .","test":"jest --forceExit --coverage"},"jest":{"testEnvironment":"node"},"license":"MIT","_lastModified":"2024-07-10T16:08:13.140Z"}
@@ -166,6 +166,7 @@ const parseFieldAndAssociations = async (ctx, next) => {
166
166
  const db = getDB(ctx, dataSource) || ctx.db;
167
167
  const collection = db.getCollection(collectionName);
168
168
  const fields = collection.fields;
169
+ const associations = collection.model.associations;
169
170
  const models = {};
170
171
  const parseField = (selected) => {
171
172
  var _a, _b, _c, _d;
@@ -206,11 +207,25 @@ const parseFieldAndAssociations = async (ctx, next) => {
206
207
  const parsedMeasures = (measures == null ? void 0 : measures.map(parseField)) || [];
207
208
  const parsedDimensions = (dimensions == null ? void 0 : dimensions.map(parseField)) || [];
208
209
  const parsedOrders = (orders == null ? void 0 : orders.map(parseField)) || [];
209
- const include = Object.entries(models).map(([target, { type }]) => ({
210
- association: target,
211
- attributes: [],
212
- ...type === "belongsToMany" ? { through: { attributes: [] } } : {}
213
- }));
210
+ const include = Object.entries(models).map(([target, { type }]) => {
211
+ let options = {
212
+ association: target,
213
+ attributes: []
214
+ };
215
+ if (type === "belongsToMany") {
216
+ options["through"] = { attributes: [] };
217
+ }
218
+ if (type === "belongsToArray") {
219
+ const association = associations[target];
220
+ if (association) {
221
+ options = {
222
+ ...options,
223
+ ...association.generateInclude()
224
+ };
225
+ }
226
+ }
227
+ return options;
228
+ });
214
229
  const filterParser = new import_database.FilterParser(filter, {
215
230
  collection
216
231
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-data-visualization",
3
- "version": "1.3.0-alpha.20240710141659",
3
+ "version": "1.3.0-alpha.20240710155619",
4
4
  "displayName": "Data visualization",
5
5
  "displayName.zh-CN": "数据可视化",
6
6
  "description": "Provides data visualization feature, including chart block and chart filter block, support line charts, area charts, bar charts and more than a dozen kinds of charts, you can also extend more chart types.",
@@ -33,7 +33,7 @@
33
33
  "@nocobase/test": "1.x",
34
34
  "@nocobase/utils": "1.x"
35
35
  },
36
- "gitHead": "cb8b234443034da0dfa57dd5d6cca1f3b3db6f08",
36
+ "gitHead": "95de9b94409d2e98bc2b95161ddf2012499bb5ec",
37
37
  "keywords": [
38
38
  "Blocks"
39
39
  ]