@nocobase/plugin-data-visualization 0.20.0-alpha.9 → 0.21.0-alpha.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.
- 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 +7 -7
- 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/configure/TransformerDynamicComponent.d.ts +4 -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/hooks/transformer.d.ts +14 -7
- package/dist/client/index.d.ts +3 -3
- package/dist/client/index.js +128 -110
- package/dist/client/renderer/ChartRendererProvider.d.ts +1 -0
- package/dist/client/transformers.d.ts +12 -0
- package/dist/client/utils.d.ts +2 -0
- package/dist/externalVersion.js +7 -7
- package/dist/locale/en-US.json +8 -1
- package/dist/locale/zh-CN.json +8 -1
- package/dist/node_modules/koa-compose/package.json +1 -1
- package/dist/server/actions/formatter.js +1 -0
- package/dist/server/actions/query.d.ts +1 -0
- package/dist/server/actions/query.js +23 -7
- package/dist/server/plugin.d.ts +2 -2
- package/dist/server/plugin.js +4 -4
- package/package.json +3 -3
- package/dist/client/block/transformers.d.ts +0 -7
- /package/dist/client/{block → configure}/formatters.d.ts +0 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type Transformer = (val: any, ...args: any[]) => string | number;
|
|
2
|
+
export type TransformerConfig = Transformer | {
|
|
3
|
+
label?: string;
|
|
4
|
+
schema?: any;
|
|
5
|
+
fn: Transformer;
|
|
6
|
+
};
|
|
7
|
+
declare const transformers: {
|
|
8
|
+
[key: string]: {
|
|
9
|
+
[key: string]: TransformerConfig;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export default transformers;
|
package/dist/client/utils.d.ts
CHANGED
package/dist/externalVersion.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
"@nocobase/client": "0.
|
|
2
|
+
"@nocobase/client": "0.21.0-alpha.10",
|
|
3
|
+
"dayjs": "1.11.10",
|
|
3
4
|
"@formily/react": "2.3.0",
|
|
4
5
|
"@formily/shared": "2.3.0",
|
|
5
6
|
"lodash": "4.17.21",
|
|
6
|
-
"@nocobase/cache": "0.
|
|
7
|
-
"@nocobase/server": "0.
|
|
7
|
+
"@nocobase/cache": "0.21.0-alpha.10",
|
|
8
|
+
"@nocobase/server": "0.21.0-alpha.10",
|
|
8
9
|
"react": "18.2.0",
|
|
9
10
|
"@ant-design/icons": "5.2.6",
|
|
10
11
|
"ahooks": "3.7.8",
|
|
11
|
-
"dayjs": "1.11.10",
|
|
12
12
|
"@emotion/css": "11.11.2",
|
|
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.10",
|
|
18
17
|
"react-i18next": "11.18.6",
|
|
19
|
-
"@nocobase/actions": "0.
|
|
18
|
+
"@nocobase/actions": "0.21.0-alpha.10",
|
|
19
|
+
"@nocobase/database": "0.21.0-alpha.10"
|
|
20
20
|
};
|
package/dist/locale/en-US.json
CHANGED
|
@@ -80,5 +80,12 @@
|
|
|
80
80
|
"Time range": "Time range",
|
|
81
81
|
"Edit field properties": "Edit field properties",
|
|
82
82
|
"Select a source field to use metadata of the field": "Select a source field to use metadata of the field",
|
|
83
|
-
"Original field": "Original field"
|
|
83
|
+
"Original field": "Original field",
|
|
84
|
+
"Transformation": "Transformation",
|
|
85
|
+
"Add transformation": "Add transformation",
|
|
86
|
+
"Container": "Container",
|
|
87
|
+
"Show border": "Show border",
|
|
88
|
+
"Transformation tip": "Fields allow multiple transformations, applied sequentially. Pay attention to data type changes after each transformation. Drag-and-drop functionality enables adjustment of transformation order.",
|
|
89
|
+
"Type conversion": "Type conversion",
|
|
90
|
+
"Transformer": "Transformer"
|
|
84
91
|
}
|
package/dist/locale/zh-CN.json
CHANGED
|
@@ -81,5 +81,12 @@
|
|
|
81
81
|
"Time range": "时间范围",
|
|
82
82
|
"Edit field properties": "编辑字段属性",
|
|
83
83
|
"Select a source field to use metadata of the field": "选择来源字段可以复用字段的元数据配置",
|
|
84
|
-
"Original field": "原始字段"
|
|
84
|
+
"Original field": "原始字段",
|
|
85
|
+
"Transformation": "数据转换",
|
|
86
|
+
"Add transformation": "添加数据转换",
|
|
87
|
+
"Container": "容器",
|
|
88
|
+
"Show border": "显示边框",
|
|
89
|
+
"Transformation tip": "一个字段可以应用多次转换,会按照顺序执行,请注意每次转换后的数据类型,拖动可以调整转换顺序。",
|
|
90
|
+
"Type conversion": "类型转换",
|
|
91
|
+
"Transformer": "转换方法"
|
|
85
92
|
}
|
|
@@ -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-16T16:08:33.460Z"}
|
|
@@ -5,4 +5,5 @@ export declare const parseBuilder: (ctx: Context, next: Next) => Promise<void>;
|
|
|
5
5
|
export declare const parseFieldAndAssociations: (ctx: Context, next: Next) => Promise<void>;
|
|
6
6
|
export declare const parseVariables: (ctx: Context, next: Next) => Promise<any>;
|
|
7
7
|
export declare const cacheMiddleware: (ctx: Context, next: Next) => Promise<void>;
|
|
8
|
+
export declare const checkPermission: (ctx: Context, next: Next) => Promise<any>;
|
|
8
9
|
export declare const query: (ctx: Context, next: Next) => Promise<void>;
|
|
@@ -28,6 +28,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
28
28
|
var query_exports = {};
|
|
29
29
|
__export(query_exports, {
|
|
30
30
|
cacheMiddleware: () => cacheMiddleware,
|
|
31
|
+
checkPermission: () => checkPermission,
|
|
31
32
|
parseBuilder: () => parseBuilder,
|
|
32
33
|
parseFieldAndAssociations: () => parseFieldAndAssociations,
|
|
33
34
|
parseVariables: () => parseVariables,
|
|
@@ -40,6 +41,10 @@ var import_database = require("@nocobase/database");
|
|
|
40
41
|
var import_formatter = require("./formatter");
|
|
41
42
|
var import_koa_compose = __toESM(require("koa-compose"));
|
|
42
43
|
var import_utils = require("@nocobase/utils");
|
|
44
|
+
const getDB = (ctx, dataSource) => {
|
|
45
|
+
const ds = ctx.app.dataSourceManager.dataSources.get(dataSource);
|
|
46
|
+
return ds == null ? void 0 : ds.collectionManager.db;
|
|
47
|
+
};
|
|
43
48
|
const postProcess = async (ctx, next) => {
|
|
44
49
|
const { data, fieldMap } = ctx.action.params.values;
|
|
45
50
|
ctx.body = data.map((record) => {
|
|
@@ -62,8 +67,9 @@ const postProcess = async (ctx, next) => {
|
|
|
62
67
|
await next();
|
|
63
68
|
};
|
|
64
69
|
const queryData = async (ctx, next) => {
|
|
65
|
-
const { collection, queryParams, fieldMap } = ctx.action.params.values;
|
|
66
|
-
const
|
|
70
|
+
const { dataSource, collection, queryParams, fieldMap } = ctx.action.params.values;
|
|
71
|
+
const db = getDB(ctx, dataSource) || ctx.db;
|
|
72
|
+
const model = db.getModel(collection);
|
|
67
73
|
const data = await model.findAll(queryParams);
|
|
68
74
|
ctx.action.params.values = {
|
|
69
75
|
data,
|
|
@@ -72,8 +78,9 @@ const queryData = async (ctx, next) => {
|
|
|
72
78
|
await next();
|
|
73
79
|
};
|
|
74
80
|
const parseBuilder = async (ctx, next) => {
|
|
75
|
-
const {
|
|
76
|
-
const
|
|
81
|
+
const { dataSource, measures, dimensions, orders, include, where, limit } = ctx.action.params.values;
|
|
82
|
+
const db = getDB(ctx, dataSource) || ctx.db;
|
|
83
|
+
const { sequelize } = db;
|
|
77
84
|
const attributes = [];
|
|
78
85
|
const group = [];
|
|
79
86
|
const order = [];
|
|
@@ -135,8 +142,16 @@ const parseBuilder = async (ctx, next) => {
|
|
|
135
142
|
await next();
|
|
136
143
|
};
|
|
137
144
|
const parseFieldAndAssociations = async (ctx, next) => {
|
|
138
|
-
const {
|
|
139
|
-
|
|
145
|
+
const {
|
|
146
|
+
dataSource,
|
|
147
|
+
collection: collectionName,
|
|
148
|
+
measures,
|
|
149
|
+
dimensions,
|
|
150
|
+
orders,
|
|
151
|
+
filter
|
|
152
|
+
} = ctx.action.params.values;
|
|
153
|
+
const db = getDB(ctx, dataSource) || ctx.db;
|
|
154
|
+
const collection = db.getCollection(collectionName);
|
|
140
155
|
const fields = collection.fields;
|
|
141
156
|
const models = {};
|
|
142
157
|
const parseField = (selected) => {
|
|
@@ -155,7 +170,7 @@ const parseFieldAndAssociations = async (ctx, next) => {
|
|
|
155
170
|
let fieldType = (_b = fields.get(name)) == null ? void 0 : _b.type;
|
|
156
171
|
if (target) {
|
|
157
172
|
const targetField = fields.get(target);
|
|
158
|
-
const targetCollection =
|
|
173
|
+
const targetCollection = db.getCollection(targetField.target);
|
|
159
174
|
const targetFields = targetCollection.fields;
|
|
160
175
|
fieldType = (_c = targetFields.get(name)) == null ? void 0 : _c.type;
|
|
161
176
|
field = `${target}.${field}`;
|
|
@@ -296,6 +311,7 @@ const query = async (ctx, next) => {
|
|
|
296
311
|
// Annotate the CommonJS export names for ESM import in node:
|
|
297
312
|
0 && (module.exports = {
|
|
298
313
|
cacheMiddleware,
|
|
314
|
+
checkPermission,
|
|
299
315
|
parseBuilder,
|
|
300
316
|
parseFieldAndAssociations,
|
|
301
317
|
parseVariables,
|
package/dist/server/plugin.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Cache } from '@nocobase/cache';
|
|
2
2
|
import { InstallOptions, Plugin } from '@nocobase/server';
|
|
3
|
-
export declare class
|
|
3
|
+
export declare class PluginDataVisualizationServer extends Plugin {
|
|
4
4
|
cache: Cache;
|
|
5
5
|
afterAdd(): void;
|
|
6
6
|
beforeLoad(): void;
|
|
@@ -10,4 +10,4 @@ export declare class DataVisualizationPlugin extends Plugin {
|
|
|
10
10
|
afterDisable(): Promise<void>;
|
|
11
11
|
remove(): Promise<void>;
|
|
12
12
|
}
|
|
13
|
-
export default
|
|
13
|
+
export default PluginDataVisualizationServer;
|
package/dist/server/plugin.js
CHANGED
|
@@ -17,14 +17,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
18
|
var plugin_exports = {};
|
|
19
19
|
__export(plugin_exports, {
|
|
20
|
-
|
|
20
|
+
PluginDataVisualizationServer: () => PluginDataVisualizationServer,
|
|
21
21
|
default: () => plugin_default
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(plugin_exports);
|
|
24
24
|
var import_server = require("@nocobase/server");
|
|
25
25
|
var import_query = require("./actions/query");
|
|
26
26
|
var import_path = require("path");
|
|
27
|
-
class
|
|
27
|
+
class PluginDataVisualizationServer extends import_server.Plugin {
|
|
28
28
|
cache;
|
|
29
29
|
afterAdd() {
|
|
30
30
|
}
|
|
@@ -62,8 +62,8 @@ class DataVisualizationPlugin extends import_server.Plugin {
|
|
|
62
62
|
async remove() {
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
-
var plugin_default =
|
|
65
|
+
var plugin_default = PluginDataVisualizationServer;
|
|
66
66
|
// Annotate the CommonJS export names for ESM import in node:
|
|
67
67
|
0 && (module.exports = {
|
|
68
|
-
|
|
68
|
+
PluginDataVisualizationServer
|
|
69
69
|
});
|
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.10",
|
|
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": "98adf5ec996a4f359c6ca1c4a6ac837c43b6e268",
|
|
37
37
|
"keywords": [
|
|
38
38
|
"Blocks"
|
|
39
39
|
]
|
|
File without changes
|