@nocobase/plugin-data-visualization 0.20.0-alpha.9 → 0.21.0-alpha.2
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.
- package/dist/client/block/ChartBlockInitializer.d.ts +7 -2
- package/dist/client/block/ChartDataProvider.d.ts +1 -0
- package/dist/client/chart/chart.d.ts +6 -6
- package/dist/client/chart/configs.d.ts +11 -0
- package/dist/client/chart/g2plot/AntChart.d.ts +2 -0
- package/dist/client/chart/g2plot/dualAxes.d.ts +3 -2
- package/dist/client/chart/g2plot/g2plot.d.ts +1 -1
- package/dist/client/chart/g2plot/pie.d.ts +2 -1
- package/dist/client/chart/group.d.ts +24 -0
- package/dist/client/filter/CollectionFieldInitializer.d.ts +2 -0
- package/dist/client/filter/FilterActionInitializers.d.ts +7 -2
- package/dist/client/filter/FilterItemInitializers.d.ts +7 -2
- package/dist/client/filter/FilterProvider.d.ts +10 -11
- package/dist/client/filter/utils.d.ts +8 -0
- package/dist/client/hooks/filter.d.ts +24 -6
- package/dist/client/hooks/query.d.ts +13 -118
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.js +120 -109
- package/dist/externalVersion.js +6 -6
- package/dist/node_modules/koa-compose/package.json +1 -1
- package/dist/server/actions/query.js +21 -7
- package/package.json +3 -3
package/dist/externalVersion.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
"@nocobase/client": "0.
|
|
2
|
+
"@nocobase/client": "0.21.0-alpha.2",
|
|
3
3
|
"@formily/react": "2.3.0",
|
|
4
4
|
"@formily/shared": "2.3.0",
|
|
5
5
|
"lodash": "4.17.21",
|
|
6
|
-
"@nocobase/cache": "0.
|
|
7
|
-
"@nocobase/server": "0.
|
|
6
|
+
"@nocobase/cache": "0.21.0-alpha.2",
|
|
7
|
+
"@nocobase/server": "0.21.0-alpha.2",
|
|
8
8
|
"react": "18.2.0",
|
|
9
9
|
"@ant-design/icons": "5.2.6",
|
|
10
10
|
"ahooks": "3.7.8",
|
|
@@ -13,8 +13,8 @@ module.exports = {
|
|
|
13
13
|
"antd": "5.12.8",
|
|
14
14
|
"@formily/antd-v5": "1.1.9",
|
|
15
15
|
"@formily/core": "2.3.0",
|
|
16
|
-
"@nocobase/utils": "0.
|
|
17
|
-
"@nocobase/database": "0.20.0-alpha.9",
|
|
16
|
+
"@nocobase/utils": "0.21.0-alpha.2",
|
|
18
17
|
"react-i18next": "11.18.6",
|
|
19
|
-
"@nocobase/actions": "0.
|
|
18
|
+
"@nocobase/actions": "0.21.0-alpha.2",
|
|
19
|
+
"@nocobase/database": "0.21.0-alpha.2"
|
|
20
20
|
};
|
|
@@ -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-
|
|
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-04-03T15:40:14.050Z"}
|
|
@@ -40,6 +40,10 @@ var import_database = require("@nocobase/database");
|
|
|
40
40
|
var import_formatter = require("./formatter");
|
|
41
41
|
var import_koa_compose = __toESM(require("koa-compose"));
|
|
42
42
|
var import_utils = require("@nocobase/utils");
|
|
43
|
+
const getDB = (ctx, dataSource) => {
|
|
44
|
+
const ds = ctx.app.dataSourceManager.dataSources.get(dataSource);
|
|
45
|
+
return ds == null ? void 0 : ds.collectionManager.db;
|
|
46
|
+
};
|
|
43
47
|
const postProcess = async (ctx, next) => {
|
|
44
48
|
const { data, fieldMap } = ctx.action.params.values;
|
|
45
49
|
ctx.body = data.map((record) => {
|
|
@@ -62,8 +66,9 @@ const postProcess = async (ctx, next) => {
|
|
|
62
66
|
await next();
|
|
63
67
|
};
|
|
64
68
|
const queryData = async (ctx, next) => {
|
|
65
|
-
const { collection, queryParams, fieldMap } = ctx.action.params.values;
|
|
66
|
-
const
|
|
69
|
+
const { dataSource, collection, queryParams, fieldMap } = ctx.action.params.values;
|
|
70
|
+
const db = getDB(ctx, dataSource) || ctx.db;
|
|
71
|
+
const model = db.getModel(collection);
|
|
67
72
|
const data = await model.findAll(queryParams);
|
|
68
73
|
ctx.action.params.values = {
|
|
69
74
|
data,
|
|
@@ -72,8 +77,9 @@ const queryData = async (ctx, next) => {
|
|
|
72
77
|
await next();
|
|
73
78
|
};
|
|
74
79
|
const parseBuilder = async (ctx, next) => {
|
|
75
|
-
const {
|
|
76
|
-
const
|
|
80
|
+
const { dataSource, measures, dimensions, orders, include, where, limit } = ctx.action.params.values;
|
|
81
|
+
const db = getDB(ctx, dataSource) || ctx.db;
|
|
82
|
+
const { sequelize } = db;
|
|
77
83
|
const attributes = [];
|
|
78
84
|
const group = [];
|
|
79
85
|
const order = [];
|
|
@@ -135,8 +141,16 @@ const parseBuilder = async (ctx, next) => {
|
|
|
135
141
|
await next();
|
|
136
142
|
};
|
|
137
143
|
const parseFieldAndAssociations = async (ctx, next) => {
|
|
138
|
-
const {
|
|
139
|
-
|
|
144
|
+
const {
|
|
145
|
+
dataSource,
|
|
146
|
+
collection: collectionName,
|
|
147
|
+
measures,
|
|
148
|
+
dimensions,
|
|
149
|
+
orders,
|
|
150
|
+
filter
|
|
151
|
+
} = ctx.action.params.values;
|
|
152
|
+
const db = getDB(ctx, dataSource) || ctx.db;
|
|
153
|
+
const collection = db.getCollection(collectionName);
|
|
140
154
|
const fields = collection.fields;
|
|
141
155
|
const models = {};
|
|
142
156
|
const parseField = (selected) => {
|
|
@@ -155,7 +169,7 @@ const parseFieldAndAssociations = async (ctx, next) => {
|
|
|
155
169
|
let fieldType = (_b = fields.get(name)) == null ? void 0 : _b.type;
|
|
156
170
|
if (target) {
|
|
157
171
|
const targetField = fields.get(target);
|
|
158
|
-
const targetCollection =
|
|
172
|
+
const targetCollection = db.getCollection(targetField.target);
|
|
159
173
|
const targetFields = targetCollection.fields;
|
|
160
174
|
fieldType = (_c = targetFields.get(name)) == null ? void 0 : _c.type;
|
|
161
175
|
field = `${target}.${field}`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/plugin-data-visualization",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.0-alpha.2",
|
|
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.",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/data-visualization",
|
|
11
11
|
"devDependencies": {
|
|
12
12
|
"@ant-design/icons": "5.x",
|
|
13
|
-
"@ant-design/plots": "^1.
|
|
13
|
+
"@ant-design/plots": "^2.1.4",
|
|
14
14
|
"@emotion/css": "^11.7.1",
|
|
15
15
|
"@formily/antd-v5": "1.x",
|
|
16
16
|
"@formily/core": "2.x",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"@nocobase/test": "0.x",
|
|
34
34
|
"@nocobase/utils": "0.x"
|
|
35
35
|
},
|
|
36
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "90628f2e2da846208fb2d7966ddb4e467d187ffb",
|
|
37
37
|
"keywords": [
|
|
38
38
|
"Blocks"
|
|
39
39
|
]
|