@nocobase/plugin-data-visualization 1.6.0-alpha.2 → 1.6.0-alpha.21
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/22ff59db05a25d2b.js +47 -0
- package/dist/client/hooks/query.d.ts +2 -2
- package/dist/client/index.js +1 -1
- package/dist/client/renderer/ChartRendererProvider.d.ts +1 -0
- package/dist/externalVersion.js +7 -7
- package/dist/locale/en-US.json +1 -0
- package/dist/locale/ja-JP.json +2 -1
- package/dist/locale/ko-KR.json +1 -0
- package/dist/locale/zh-CN.json +1 -0
- package/dist/node_modules/koa-compose/package.json +1 -1
- package/dist/node_modules/moment-timezone/package.json +1 -1
- package/dist/server/actions/query.js +15 -9
- package/dist/server/formatter/mysql-formatter.js +14 -7
- package/dist/server/query-parser/query-parser.js +15 -11
- package/dist/server/types.d.ts +1 -0
- package/package.json +2 -2
- package/dist/client/950.index.js +0 -47
package/dist/externalVersion.js
CHANGED
|
@@ -8,24 +8,24 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
module.exports = {
|
|
11
|
-
"@nocobase/client": "1.6.0-alpha.
|
|
11
|
+
"@nocobase/client": "1.6.0-alpha.21",
|
|
12
12
|
"dayjs": "1.11.10",
|
|
13
13
|
"@formily/react": "2.3.0",
|
|
14
14
|
"@formily/shared": "2.3.2",
|
|
15
15
|
"lodash": "4.17.21",
|
|
16
16
|
"react": "18.2.0",
|
|
17
|
-
"@nocobase/cache": "1.6.0-alpha.
|
|
18
|
-
"@nocobase/server": "1.6.0-alpha.
|
|
19
|
-
"@nocobase/test": "1.6.0-alpha.
|
|
17
|
+
"@nocobase/cache": "1.6.0-alpha.21",
|
|
18
|
+
"@nocobase/server": "1.6.0-alpha.21",
|
|
19
|
+
"@nocobase/test": "1.6.0-alpha.21",
|
|
20
20
|
"@emotion/css": "11.13.0",
|
|
21
21
|
"@ant-design/icons": "5.2.6",
|
|
22
22
|
"ahooks": "3.7.8",
|
|
23
23
|
"antd": "5.12.8",
|
|
24
24
|
"@formily/antd-v5": "1.1.9",
|
|
25
25
|
"@formily/core": "2.3.0",
|
|
26
|
-
"@nocobase/utils": "1.6.0-alpha.
|
|
26
|
+
"@nocobase/utils": "1.6.0-alpha.21",
|
|
27
27
|
"react-i18next": "11.18.6",
|
|
28
|
-
"@nocobase/actions": "1.6.0-alpha.
|
|
29
|
-
"@nocobase/database": "1.6.0-alpha.
|
|
28
|
+
"@nocobase/actions": "1.6.0-alpha.21",
|
|
29
|
+
"@nocobase/database": "1.6.0-alpha.21",
|
|
30
30
|
"sequelize": "6.35.2"
|
|
31
31
|
};
|
package/dist/locale/en-US.json
CHANGED
package/dist/locale/ja-JP.json
CHANGED
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
"Filter": "フィルター",
|
|
24
24
|
"Sort": "ソート",
|
|
25
25
|
"Limit": "制限",
|
|
26
|
+
"Offset": "スキップする件数",
|
|
26
27
|
"Enable cache": "キャッシュを有効化",
|
|
27
28
|
"TTL (second)": "TTL(秒)",
|
|
28
29
|
"Field": "フィールド",
|
|
@@ -97,4 +98,4 @@
|
|
|
97
98
|
"Show padding": "パディングを表示",
|
|
98
99
|
"Distinct": "重複排除",
|
|
99
100
|
"Collapse": "折りたたみ"
|
|
100
|
-
}
|
|
101
|
+
}
|
package/dist/locale/ko-KR.json
CHANGED
package/dist/locale/zh-CN.json
CHANGED
|
@@ -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":"
|
|
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":"2025-02-07T02:41:01.028Z"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"moment-timezone","version":"0.5.43","description":"Parse and display moments in any timezone.","homepage":"http://momentjs.com/timezone/","author":"Tim Wood <washwithcare@gmail.com> (http://timwoodcreates.com/)","keywords":["moment","date","time","timezone","olson","iana","zone","tz"],"main":"./index.js","typings":"./index.d.ts","engines":{"node":"*"},"repository":{"type":"git","url":"https://github.com/moment/moment-timezone.git"},"bugs":{"url":"https://github.com/moment/moment-timezone/issues"},"license":"MIT","dependencies":{"moment":"^2.29.4"},"devDependencies":{"grunt":"^1.5.3","grunt-contrib-clean":"^2.0.1","grunt-contrib-jshint":"^3.2.0","grunt-contrib-nodeunit":"^4.0.0","grunt-contrib-uglify":"^5.2.2","grunt-exec":"^3.0.0","typescript":"^3.5.1"},"jspm":{"main":"builds/moment-timezone-with-data","shim":{"moment-timezone":{"deps":["moment"]}}},"scripts":{"test":"grunt"},"_lastModified":"
|
|
1
|
+
{"name":"moment-timezone","version":"0.5.43","description":"Parse and display moments in any timezone.","homepage":"http://momentjs.com/timezone/","author":"Tim Wood <washwithcare@gmail.com> (http://timwoodcreates.com/)","keywords":["moment","date","time","timezone","olson","iana","zone","tz"],"main":"./index.js","typings":"./index.d.ts","engines":{"node":"*"},"repository":{"type":"git","url":"https://github.com/moment/moment-timezone.git"},"bugs":{"url":"https://github.com/moment/moment-timezone/issues"},"license":"MIT","dependencies":{"moment":"^2.29.4"},"devDependencies":{"grunt":"^1.5.3","grunt-contrib-clean":"^2.0.1","grunt-contrib-jshint":"^3.2.0","grunt-contrib-nodeunit":"^4.0.0","grunt-contrib-uglify":"^5.2.2","grunt-exec":"^3.0.0","typescript":"^3.5.1"},"jspm":{"main":"builds/moment-timezone-with-data","shim":{"moment-timezone":{"deps":["moment"]}}},"scripts":{"test":"grunt"},"_lastModified":"2025-02-07T02:41:01.715Z"}
|
|
@@ -87,6 +87,7 @@ const queryData = async (ctx, next) => {
|
|
|
87
87
|
await next();
|
|
88
88
|
};
|
|
89
89
|
const parseFieldAndAssociations = async (ctx, next) => {
|
|
90
|
+
var _a;
|
|
90
91
|
const {
|
|
91
92
|
dataSource,
|
|
92
93
|
collection: collectionName,
|
|
@@ -101,7 +102,7 @@ const parseFieldAndAssociations = async (ctx, next) => {
|
|
|
101
102
|
const associations = collection.model.associations;
|
|
102
103
|
const models = {};
|
|
103
104
|
const parseField = (selected) => {
|
|
104
|
-
var
|
|
105
|
+
var _a2, _b, _c, _d, _e, _f;
|
|
105
106
|
let target;
|
|
106
107
|
let name;
|
|
107
108
|
if (!Array.isArray(selected.field)) {
|
|
@@ -112,7 +113,7 @@ const parseFieldAndAssociations = async (ctx, next) => {
|
|
|
112
113
|
[target, name] = selected.field;
|
|
113
114
|
}
|
|
114
115
|
const rawAttributes = collection.model.getAttributes();
|
|
115
|
-
let field = ((
|
|
116
|
+
let field = ((_a2 = rawAttributes[name]) == null ? void 0 : _a2.field) || name;
|
|
116
117
|
let fieldType = (_b = fields.get(name)) == null ? void 0 : _b.type;
|
|
117
118
|
let fieldOptions = (_c = fields.get(name)) == null ? void 0 : _c.options;
|
|
118
119
|
if (target) {
|
|
@@ -165,20 +166,25 @@ const parseFieldAndAssociations = async (ctx, next) => {
|
|
|
165
166
|
collection
|
|
166
167
|
});
|
|
167
168
|
const { where, include: filterInclude } = filterParser.toSequelizeParams();
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
item
|
|
169
|
+
if (filterInclude) {
|
|
170
|
+
const stack = [...filterInclude];
|
|
171
|
+
while (stack.length) {
|
|
172
|
+
const item = stack.pop();
|
|
173
|
+
if (((_a = fields.get(item.association)) == null ? void 0 : _a.type) === "belongsToMany") {
|
|
174
|
+
item.through = { attributes: [] };
|
|
175
|
+
}
|
|
176
|
+
if (item.include) {
|
|
177
|
+
stack.push(...item.include);
|
|
178
|
+
}
|
|
172
179
|
}
|
|
173
|
-
|
|
174
|
-
});
|
|
180
|
+
}
|
|
175
181
|
ctx.action.params.values = {
|
|
176
182
|
...ctx.action.params.values,
|
|
177
183
|
where,
|
|
178
184
|
measures: parsedMeasures,
|
|
179
185
|
dimensions: parsedDimensions,
|
|
180
186
|
orders: parsedOrders,
|
|
181
|
-
include: [...include, ...
|
|
187
|
+
include: [...include, ...filterInclude || []]
|
|
182
188
|
};
|
|
183
189
|
await next();
|
|
184
190
|
};
|
|
@@ -7,9 +7,11 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
+
var __create = Object.create;
|
|
10
11
|
var __defProp = Object.defineProperty;
|
|
11
12
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
13
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
14
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
13
15
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
16
|
var __export = (target, all) => {
|
|
15
17
|
for (var name in all)
|
|
@@ -23,6 +25,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
23
25
|
}
|
|
24
26
|
return to;
|
|
25
27
|
};
|
|
28
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
29
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
30
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
31
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
32
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
33
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
34
|
+
mod
|
|
35
|
+
));
|
|
26
36
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
37
|
var mysql_formatter_exports = {};
|
|
28
38
|
__export(mysql_formatter_exports, {
|
|
@@ -30,19 +40,16 @@ __export(mysql_formatter_exports, {
|
|
|
30
40
|
});
|
|
31
41
|
module.exports = __toCommonJS(mysql_formatter_exports);
|
|
32
42
|
var import_formatter = require("./formatter");
|
|
43
|
+
var import_moment_timezone = __toESM(require("moment-timezone"));
|
|
33
44
|
class MySQLFormatter extends import_formatter.Formatter {
|
|
34
45
|
convertFormat(format) {
|
|
35
46
|
return format.replace(/YYYY/g, "%Y").replace(/MM/g, "%m").replace(/DD/g, "%d").replace(/hh/g, "%H").replace(/mm/g, "%i").replace(/ss/g, "%S");
|
|
36
47
|
}
|
|
37
48
|
formatDate(field, format, timezoneOffset) {
|
|
38
|
-
const
|
|
49
|
+
const tz = import_moment_timezone.default.tz(process.env.TZ || "UTC").format("Z");
|
|
39
50
|
format = this.convertFormat(format);
|
|
40
|
-
if (
|
|
41
|
-
return this.sequelize.fn(
|
|
42
|
-
"date_format",
|
|
43
|
-
this.sequelize.fn("convert_tz", field, process.env.TZ || "UTC", timezone),
|
|
44
|
-
format
|
|
45
|
-
);
|
|
51
|
+
if (timezoneOffset && tz !== timezoneOffset) {
|
|
52
|
+
return this.sequelize.fn("date_format", this.sequelize.fn("convert_tz", field, tz, timezoneOffset), format);
|
|
46
53
|
}
|
|
47
54
|
return this.sequelize.fn("date_format", field, format);
|
|
48
55
|
}
|
|
@@ -103,7 +103,7 @@ class QueryParser {
|
|
|
103
103
|
parse() {
|
|
104
104
|
return async (ctx, next) => {
|
|
105
105
|
var _a;
|
|
106
|
-
const { measures, dimensions, orders, include, where, limit } = ctx.action.params.values;
|
|
106
|
+
const { measures, dimensions, orders, include, where, limit, offset } = ctx.action.params.values;
|
|
107
107
|
const { attributes: measureAttributes, fieldMap: measureFieldMap, hasAgg } = this.parseMeasures(ctx, measures);
|
|
108
108
|
const {
|
|
109
109
|
attributes: dimensionAttributes,
|
|
@@ -111,18 +111,22 @@ class QueryParser {
|
|
|
111
111
|
fieldMap: dimensionFieldMap
|
|
112
112
|
} = this.parseDimensions(ctx, dimensions, hasAgg, (_a = ctx.get) == null ? void 0 : _a.call(ctx, "x-timezone"));
|
|
113
113
|
const order = this.parseOrders(ctx, orders, hasAgg);
|
|
114
|
+
const queryParams = {
|
|
115
|
+
where,
|
|
116
|
+
attributes: [...measureAttributes, ...dimensionAttributes],
|
|
117
|
+
include,
|
|
118
|
+
group,
|
|
119
|
+
order,
|
|
120
|
+
subQuery: false,
|
|
121
|
+
raw: true
|
|
122
|
+
};
|
|
123
|
+
if (!hasAgg || dimensions.length) {
|
|
124
|
+
queryParams["limit"] = limit || 2e3;
|
|
125
|
+
queryParams["offset"] = offset || 0;
|
|
126
|
+
}
|
|
114
127
|
ctx.action.params.values = {
|
|
115
128
|
...ctx.action.params.values,
|
|
116
|
-
queryParams
|
|
117
|
-
where,
|
|
118
|
-
attributes: [...measureAttributes, ...dimensionAttributes],
|
|
119
|
-
include,
|
|
120
|
-
group,
|
|
121
|
-
order,
|
|
122
|
-
limit: limit || 2e3,
|
|
123
|
-
subQuery: false,
|
|
124
|
-
raw: true
|
|
125
|
-
},
|
|
129
|
+
queryParams,
|
|
126
130
|
fieldMap: { ...measureFieldMap, ...dimensionFieldMap }
|
|
127
131
|
};
|
|
128
132
|
await next();
|
package/dist/server/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/plugin-data-visualization",
|
|
3
|
-
"version": "1.6.0-alpha.
|
|
3
|
+
"version": "1.6.0-alpha.21",
|
|
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.",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@nocobase/test": "1.x",
|
|
35
35
|
"@nocobase/utils": "1.x"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "873cbaec9554e684781b8dc6cfd4386bb5cfa5b0",
|
|
38
38
|
"keywords": [
|
|
39
39
|
"Blocks"
|
|
40
40
|
]
|