@nocobase/plugin-data-visualization 1.6.0-alpha.3 → 1.6.0-alpha.31
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/77ce36306250faab.js +47 -0
- package/dist/client/filter/FilterProvider.d.ts +2 -0
- package/dist/client/hooks/filter.d.ts +166 -1
- 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 +8 -8
- package/dist/locale/en-US.json +1 -0
- package/dist/locale/it-IT.json +101 -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/query-parser/query-parser.js +23 -12
- package/dist/server/types.d.ts +2 -0
- package/package.json +2 -2
- package/dist/client/7884f8f297a098d4.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.31",
|
|
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.31",
|
|
18
|
+
"@nocobase/server": "1.6.0-alpha.31",
|
|
19
|
+
"@nocobase/test": "1.6.0-alpha.31",
|
|
20
20
|
"@emotion/css": "11.13.0",
|
|
21
|
-
"@ant-design/icons": "5.
|
|
21
|
+
"@ant-design/icons": "5.6.1",
|
|
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.31",
|
|
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.31",
|
|
29
|
+
"@nocobase/database": "1.6.0-alpha.31",
|
|
30
30
|
"sequelize": "6.35.2"
|
|
31
31
|
};
|
package/dist/locale/en-US.json
CHANGED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Edit": "Modifica",
|
|
3
|
+
"Delete": "Elimina",
|
|
4
|
+
"Cancel": "Annulla",
|
|
5
|
+
"Submit": "Invia",
|
|
6
|
+
"Actions": "Operazioni",
|
|
7
|
+
"Title": "Titolo",
|
|
8
|
+
"Enable": "Abilita",
|
|
9
|
+
"Chart": "Grafico",
|
|
10
|
+
"ChartV2": "GraficoV2",
|
|
11
|
+
"Charts": "Grafici",
|
|
12
|
+
"Configure": "Configura",
|
|
13
|
+
"Duplicate": "Duplica",
|
|
14
|
+
"Configure chart": "Configura grafico",
|
|
15
|
+
"Transform": "Trasforma",
|
|
16
|
+
"Chart type": "Tipo di grafico",
|
|
17
|
+
"JSON config": "Configurazione JSON",
|
|
18
|
+
"Query": "Query",
|
|
19
|
+
"Data": "Dati",
|
|
20
|
+
"Run query": "Esegui query",
|
|
21
|
+
"Measures": "Misure",
|
|
22
|
+
"Dimensions": "Dimensioni",
|
|
23
|
+
"Filter": "Filtro",
|
|
24
|
+
"Sort": "Ordina",
|
|
25
|
+
"Limit": "Limite",
|
|
26
|
+
"Offset": "Offset",
|
|
27
|
+
"Enable cache": "Abilita cache",
|
|
28
|
+
"TTL (second)": "TTL (secondi)",
|
|
29
|
+
"Field": "Campo",
|
|
30
|
+
"Aggregation": "Aggregazione",
|
|
31
|
+
"Alias": "Alias",
|
|
32
|
+
"Format": "Formato",
|
|
33
|
+
"The first 10 records of the query result:": "I primi 10 record del risultato della query:",
|
|
34
|
+
"Please run query to retrive data.": "Esegui la query per recuperare i dati.",
|
|
35
|
+
"Type": "Tipo",
|
|
36
|
+
"Add field": "Aggiungi campo",
|
|
37
|
+
"Add chart": "Aggiungi grafico",
|
|
38
|
+
"xField": "Campo X",
|
|
39
|
+
"yField": "Campo Y",
|
|
40
|
+
"seriesField": "Campo serie",
|
|
41
|
+
"angleField": "Campo angolo",
|
|
42
|
+
"colorField": "Campo colore",
|
|
43
|
+
"Line": "Linee",
|
|
44
|
+
"Area": "Area",
|
|
45
|
+
"Column": "Colonne",
|
|
46
|
+
"Bar": "Barra",
|
|
47
|
+
"Pie": "Torta",
|
|
48
|
+
"Dual axes": "Doppi assi",
|
|
49
|
+
"Scatter": "Dispersione",
|
|
50
|
+
"Gauge": "Indicatore",
|
|
51
|
+
"Statistic": "Statistica",
|
|
52
|
+
"Currency": "Valuta",
|
|
53
|
+
"Percent": "Percentuale",
|
|
54
|
+
"Exponential": "Esponenziale",
|
|
55
|
+
"Abbreviation": "Abbreviazione",
|
|
56
|
+
"Please configure and run query": "Configura ed esegui la query",
|
|
57
|
+
"Please configure chart": "Configura il grafico",
|
|
58
|
+
"Are you sure to cancel?": "Sei sicuro di voler annullare?",
|
|
59
|
+
"You changes are not saved. If you click OK, your changes will be lost.": "Le modifiche non sono state salvate. Se fai clic su OK, le modifiche andranno perse.",
|
|
60
|
+
"Same properties set in the form above will be overwritten by this JSON config.": "Le stesse proprietà impostate nel modulo sopra verranno sovrascritte da questa configurazione JSON.",
|
|
61
|
+
"Built-in": "Integrato",
|
|
62
|
+
"Config reference: ": "Riferimento configurazione: ",
|
|
63
|
+
"Table": "Tabella",
|
|
64
|
+
"Sum": "Somma",
|
|
65
|
+
"Avg": "Media",
|
|
66
|
+
"Count": "Conteggio",
|
|
67
|
+
"Min": "Minimo",
|
|
68
|
+
"Max": "Massimo",
|
|
69
|
+
"Please select a chart type.": "Seleziona un tipo di grafico.",
|
|
70
|
+
"Collection": "Raccolta",
|
|
71
|
+
"isStack": "èSovrapposto",
|
|
72
|
+
"isPercent": "èPercentuale",
|
|
73
|
+
"isGroup": "èGruppo",
|
|
74
|
+
"smooth": "smussato",
|
|
75
|
+
"Expand": "Espandi",
|
|
76
|
+
"Current filter": "Filtro corrente",
|
|
77
|
+
"Add custom field": "Aggiungi campo personalizzato",
|
|
78
|
+
"To filter with custom fields, use \"Current filter\" variables in the chart configuration.": "Per filtrare con campi personalizzati, utilizza le variabili \"Filtro corrente\" nella configurazione del grafico.",
|
|
79
|
+
"Input": "Input",
|
|
80
|
+
"Date range": "Intervallo date",
|
|
81
|
+
"Time range": "Intervallo tempo",
|
|
82
|
+
"Edit field properties": "Modifica proprietà del campo",
|
|
83
|
+
"Select a source field to use metadata of the field": "Seleziona un campo origine per utilizzare i metadati del campo",
|
|
84
|
+
"Original field": "Campo originale",
|
|
85
|
+
"Transformation": "Trasformazione",
|
|
86
|
+
"Add transformation": "Aggiungi trasformazione",
|
|
87
|
+
"Container": "Contenitore",
|
|
88
|
+
"Show border": "Mostra bordo",
|
|
89
|
+
"Transformation tip": "I campi consentono trasformazioni multiple, applicate in sequenza. Presta attenzione alle modifiche del tipo di dati dopo ogni trasformazione. La funzionalità di trascinamento consente di regolare l'ordine delle trasformazioni.",
|
|
90
|
+
"Type conversion": "Conversione tipo",
|
|
91
|
+
"Transformer": "Trasformatore",
|
|
92
|
+
"Size": "Dimensione",
|
|
93
|
+
"Width": "Larghezza",
|
|
94
|
+
"Height": "Altezza",
|
|
95
|
+
"Aspect ratio": "Proporzioni",
|
|
96
|
+
"Fixed height": "Altezza fissa",
|
|
97
|
+
"Show background": "Mostra sfondo",
|
|
98
|
+
"Show padding": "Mostra spaziatura interna",
|
|
99
|
+
"Distinct": "Rimuovi duplicati",
|
|
100
|
+
"Auto refresh": "Aggiornamento automatico"
|
|
101
|
+
}
|
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-03-10T17:52:12.591Z"}
|
|
@@ -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-03-10T17:52:13.245Z"}
|
|
@@ -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
|
};
|
|
@@ -96,14 +96,21 @@ class QueryParser {
|
|
|
96
96
|
orders.forEach((item) => {
|
|
97
97
|
const alias = sequelize.getQueryInterface().quoteIdentifier(item.alias);
|
|
98
98
|
const name = hasAgg ? sequelize.literal(alias) : sequelize.col(item.field);
|
|
99
|
-
|
|
99
|
+
let sort = item.order || "ASC";
|
|
100
|
+
if (item.nulls === "first") {
|
|
101
|
+
sort += " NULLS FIRST";
|
|
102
|
+
}
|
|
103
|
+
if (item.nulls === "last") {
|
|
104
|
+
sort += " NULLS LAST";
|
|
105
|
+
}
|
|
106
|
+
order.push([name, sort]);
|
|
100
107
|
});
|
|
101
108
|
return order;
|
|
102
109
|
}
|
|
103
110
|
parse() {
|
|
104
111
|
return async (ctx, next) => {
|
|
105
112
|
var _a;
|
|
106
|
-
const { measures, dimensions, orders, include, where, limit } = ctx.action.params.values;
|
|
113
|
+
const { measures, dimensions, orders, include, where, limit, offset } = ctx.action.params.values;
|
|
107
114
|
const { attributes: measureAttributes, fieldMap: measureFieldMap, hasAgg } = this.parseMeasures(ctx, measures);
|
|
108
115
|
const {
|
|
109
116
|
attributes: dimensionAttributes,
|
|
@@ -111,18 +118,22 @@ class QueryParser {
|
|
|
111
118
|
fieldMap: dimensionFieldMap
|
|
112
119
|
} = this.parseDimensions(ctx, dimensions, hasAgg, (_a = ctx.get) == null ? void 0 : _a.call(ctx, "x-timezone"));
|
|
113
120
|
const order = this.parseOrders(ctx, orders, hasAgg);
|
|
121
|
+
const queryParams = {
|
|
122
|
+
where,
|
|
123
|
+
attributes: [...measureAttributes, ...dimensionAttributes],
|
|
124
|
+
include,
|
|
125
|
+
group,
|
|
126
|
+
order,
|
|
127
|
+
subQuery: false,
|
|
128
|
+
raw: true
|
|
129
|
+
};
|
|
130
|
+
if (!hasAgg || dimensions.length) {
|
|
131
|
+
queryParams["limit"] = limit || 2e3;
|
|
132
|
+
queryParams["offset"] = offset || 0;
|
|
133
|
+
}
|
|
114
134
|
ctx.action.params.values = {
|
|
115
135
|
...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
|
-
},
|
|
136
|
+
queryParams,
|
|
126
137
|
fieldMap: { ...measureFieldMap, ...dimensionFieldMap }
|
|
127
138
|
};
|
|
128
139
|
await next();
|
package/dist/server/types.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ export type OrderProps = {
|
|
|
24
24
|
field: string | string[];
|
|
25
25
|
alias?: string;
|
|
26
26
|
order?: 'asc' | 'desc';
|
|
27
|
+
nulls?: 'default' | 'first' | 'last';
|
|
27
28
|
};
|
|
28
29
|
export type QueryParams = Partial<{
|
|
29
30
|
uid: string;
|
|
@@ -34,6 +35,7 @@ export type QueryParams = Partial<{
|
|
|
34
35
|
orders: OrderProps[];
|
|
35
36
|
filter: any;
|
|
36
37
|
limit: number;
|
|
38
|
+
offset: number;
|
|
37
39
|
sql: {
|
|
38
40
|
fields?: string;
|
|
39
41
|
clauses?: string;
|
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.31",
|
|
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": "2f118f0a0691dd51c437f208b1166258a615b6a8",
|
|
38
38
|
"keywords": [
|
|
39
39
|
"Blocks"
|
|
40
40
|
]
|