@nocobase/plugin-data-visualization 2.1.0-alpha.3 → 2.1.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.
Files changed (97) hide show
  1. package/LICENSE +201 -661
  2. package/README.md +79 -10
  3. package/client-v2.d.ts +2 -0
  4. package/client-v2.js +1 -0
  5. package/dist/client/102.ae672a174b9de2c5.js +47 -0
  6. package/dist/client/176.0b68fc9582cfe5a3.js +10 -0
  7. package/dist/client/214.6dda3ffed1dca904.js +10 -0
  8. package/dist/client/680.55c8681f2ccb5c51.js +10 -0
  9. package/dist/client/flow/models/ChartBlockModel.d.ts +1 -0
  10. package/dist/client/flow/models/ChartOptionsBuilder.d.ts +4 -0
  11. package/dist/client/flow/models/QueryBuilder.d.ts +1 -4
  12. package/dist/client/flow/resources/ChartResource.d.ts +1 -0
  13. package/dist/client/index.js +1 -1
  14. package/dist/client-v2/174.75072e326b5a4f8a.js +10 -0
  15. package/dist/client-v2/176.0b68fc9582cfe5a3.js +10 -0
  16. package/dist/client-v2/214.6dda3ffed1dca904.js +10 -0
  17. package/dist/client-v2/542.d15b6fa2a7d6a4e3.js +10 -0
  18. package/dist/client-v2/680.c3725300a5f4414b.js +10 -0
  19. package/dist/client-v2/chart/ChartGroup.d.ts +44 -0
  20. package/dist/client-v2/chart/configs.d.ts +290 -0
  21. package/dist/{server/query-parser → client-v2/chart}/index.d.ts +3 -3
  22. package/dist/client-v2/chart/types.d.ts +103 -0
  23. package/dist/client-v2/flow/components/CodeEditor.d.ts +22 -0
  24. package/dist/client-v2/flow/models/Chart.d.ts +18 -0
  25. package/dist/client-v2/flow/models/ChartBlockModel.d.ts +78 -0
  26. package/dist/client-v2/flow/models/ChartOptionsBuilder.d.ts +23 -0
  27. package/dist/client-v2/flow/models/ChartOptionsBuilder.service.d.ts +58 -0
  28. package/dist/{server/query-parser/mysql-query-parser.d.ts → client-v2/flow/models/ChartOptionsEditor.d.ts} +8 -7
  29. package/dist/client-v2/flow/models/ChartOptionsPanel.d.ts +11 -0
  30. package/dist/{server/query-parser/sqlite-query-parser.d.ts → client-v2/flow/models/ConfigPanel.d.ts} +2 -7
  31. package/dist/client-v2/flow/models/ECharts.d.ts +20 -0
  32. package/dist/client-v2/flow/models/EventsEditor.d.ts +11 -0
  33. package/dist/{server/query-parser/postgres-query-parser.d.ts → client-v2/flow/models/EventsPanel.d.ts} +2 -7
  34. package/dist/client-v2/flow/models/QueryBuilder.d.ts +13 -0
  35. package/dist/client-v2/flow/models/QueryBuilder.service.d.ts +20 -0
  36. package/dist/client-v2/flow/models/QueryPanel.d.ts +10 -0
  37. package/dist/client-v2/flow/models/ResultPanel.d.ts +10 -0
  38. package/dist/client-v2/flow/models/SQLEditor.d.ts +10 -0
  39. package/dist/client-v2/flow/models/config-store.d.ts +20 -0
  40. package/dist/client-v2/flow/resources/ChartResource.d.ts +37 -0
  41. package/dist/client-v2/flow/utils.d.ts +50 -0
  42. package/dist/client-v2/hooks/index.d.ts +9 -0
  43. package/dist/client-v2/hooks/useSetChartSize.d.ts +20 -0
  44. package/dist/client-v2/index.d.ts +12 -0
  45. package/dist/client-v2/index.js +10 -0
  46. package/dist/client-v2/locale.d.ts +14 -0
  47. package/dist/client-v2/plugin.d.ts +23 -0
  48. package/dist/externalVersion.js +14 -12
  49. package/dist/node_modules/koa-compose/index.js +1 -1
  50. package/dist/node_modules/koa-compose/package.json +1 -1
  51. package/dist/server/actions/query.d.ts +2 -4
  52. package/dist/server/actions/query.js +48 -183
  53. package/dist/server/plugin.js +2 -2
  54. package/dist/server/types.d.ts +3 -0
  55. package/package.json +7 -3
  56. package/dist/client/2ba6e739852f8f86.js +0 -10
  57. package/dist/client/8795975cb8946be4.js +0 -10
  58. package/dist/client/924c5f5607998e1c.js +0 -10
  59. package/dist/client/c5d5becd097bd821.js +0 -47
  60. package/dist/client/flow/components/AntdFilterSelector.d.ts +0 -35
  61. package/dist/node_modules/moment-timezone/LICENSE +0 -20
  62. package/dist/node_modules/moment-timezone/builds/moment-timezone-with-data-10-year-range.js +0 -1548
  63. package/dist/node_modules/moment-timezone/builds/moment-timezone-with-data-10-year-range.min.js +0 -1
  64. package/dist/node_modules/moment-timezone/builds/moment-timezone-with-data-1970-2030.js +0 -1548
  65. package/dist/node_modules/moment-timezone/builds/moment-timezone-with-data-1970-2030.min.js +0 -1
  66. package/dist/node_modules/moment-timezone/builds/moment-timezone-with-data-2012-2022.js +0 -1560
  67. package/dist/node_modules/moment-timezone/builds/moment-timezone-with-data-2012-2022.min.js +0 -1
  68. package/dist/node_modules/moment-timezone/builds/moment-timezone-with-data.js +0 -1548
  69. package/dist/node_modules/moment-timezone/builds/moment-timezone-with-data.min.js +0 -1
  70. package/dist/node_modules/moment-timezone/builds/moment-timezone.min.js +0 -1
  71. package/dist/node_modules/moment-timezone/composer.json +0 -43
  72. package/dist/node_modules/moment-timezone/data/meta/latest.json +0 -5889
  73. package/dist/node_modules/moment-timezone/data/packed/latest.json +0 -852
  74. package/dist/node_modules/moment-timezone/index.d.ts +0 -78
  75. package/dist/node_modules/moment-timezone/index.js +0 -15
  76. package/dist/node_modules/moment-timezone/moment-timezone-utils.d.ts +0 -70
  77. package/dist/node_modules/moment-timezone/moment-timezone-utils.js +0 -339
  78. package/dist/node_modules/moment-timezone/moment-timezone.js +0 -696
  79. package/dist/node_modules/moment-timezone/package.json +0 -1
  80. package/dist/server/formatter/formatter.d.ts +0 -27
  81. package/dist/server/formatter/formatter.js +0 -85
  82. package/dist/server/formatter/mysql-formatter.d.ts +0 -14
  83. package/dist/server/formatter/mysql-formatter.js +0 -93
  84. package/dist/server/formatter/oracle-formatter.d.ts +0 -14
  85. package/dist/server/formatter/oracle-formatter.js +0 -74
  86. package/dist/server/formatter/postgres-formatter.d.ts +0 -14
  87. package/dist/server/formatter/postgres-formatter.js +0 -74
  88. package/dist/server/formatter/sqlite-formatter.d.ts +0 -15
  89. package/dist/server/formatter/sqlite-formatter.js +0 -83
  90. package/dist/server/query-parser/index.js +0 -56
  91. package/dist/server/query-parser/mysql-query-parser.js +0 -43
  92. package/dist/server/query-parser/oracle-query-parser.d.ts +0 -18
  93. package/dist/server/query-parser/oracle-query-parser.js +0 -60
  94. package/dist/server/query-parser/postgres-query-parser.js +0 -43
  95. package/dist/server/query-parser/query-parser.d.ts +0 -31
  96. package/dist/server/query-parser/query-parser.js +0 -146
  97. package/dist/server/query-parser/sqlite-query-parser.js +0 -43
@@ -1,43 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- var __defProp = Object.defineProperty;
11
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
- var __getOwnPropNames = Object.getOwnPropertyNames;
13
- var __hasOwnProp = Object.prototype.hasOwnProperty;
14
- var __export = (target, all) => {
15
- for (var name in all)
16
- __defProp(target, name, { get: all[name], enumerable: true });
17
- };
18
- var __copyProps = (to, from, except, desc) => {
19
- if (from && typeof from === "object" || typeof from === "function") {
20
- for (let key of __getOwnPropNames(from))
21
- if (!__hasOwnProp.call(to, key) && key !== except)
22
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
- }
24
- return to;
25
- };
26
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
- var postgres_query_parser_exports = {};
28
- __export(postgres_query_parser_exports, {
29
- PostgresQueryParser: () => PostgresQueryParser
30
- });
31
- module.exports = __toCommonJS(postgres_query_parser_exports);
32
- var import_postgres_formatter = require("../formatter/postgres-formatter");
33
- var import_query_parser = require("./query-parser");
34
- class PostgresQueryParser extends import_query_parser.QueryParser {
35
- constructor(db) {
36
- super(db);
37
- this.formatter = new import_postgres_formatter.PostgresFormatter(db.sequelize);
38
- }
39
- }
40
- // Annotate the CommonJS export names for ESM import in node:
41
- 0 && (module.exports = {
42
- PostgresQueryParser
43
- });
@@ -1,31 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
- import { Context, Next } from '@nocobase/actions';
10
- import { DimensionProps, MeasureProps, OrderProps } from '../types';
11
- import { Formatter } from '../formatter/formatter';
12
- import { Database } from '@nocobase/database';
13
- export declare class QueryParser {
14
- db: Database;
15
- formatter: Formatter;
16
- constructor(db: Database);
17
- parseMeasures(ctx: Context, measures: MeasureProps[]): {
18
- attributes: any[];
19
- fieldMap: {};
20
- hasAgg: boolean;
21
- };
22
- parseDimensions(ctx: Context, dimensions: (DimensionProps & {
23
- field: string;
24
- })[], hasAgg: boolean, timezone: string): {
25
- attributes: any[];
26
- group: any[];
27
- fieldMap: {};
28
- };
29
- parseOrders(ctx: Context, orders: OrderProps[], hasAgg: boolean): any[];
30
- parse(): (ctx: Context, next: Next) => Promise<void>;
31
- }
@@ -1,146 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- var __defProp = Object.defineProperty;
11
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
- var __getOwnPropNames = Object.getOwnPropertyNames;
13
- var __hasOwnProp = Object.prototype.hasOwnProperty;
14
- var __export = (target, all) => {
15
- for (var name in all)
16
- __defProp(target, name, { get: all[name], enumerable: true });
17
- };
18
- var __copyProps = (to, from, except, desc) => {
19
- if (from && typeof from === "object" || typeof from === "function") {
20
- for (let key of __getOwnPropNames(from))
21
- if (!__hasOwnProp.call(to, key) && key !== except)
22
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
- }
24
- return to;
25
- };
26
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
- var query_parser_exports = {};
28
- __export(query_parser_exports, {
29
- QueryParser: () => QueryParser
30
- });
31
- module.exports = __toCommonJS(query_parser_exports);
32
- const AllowedAggFuncs = ["sum", "count", "avg", "min", "max"];
33
- class QueryParser {
34
- db;
35
- formatter;
36
- constructor(db) {
37
- this.db = db;
38
- this.formatter = {
39
- format: ({ field }) => db.sequelize.col(field)
40
- };
41
- }
42
- parseMeasures(ctx, measures) {
43
- let hasAgg = false;
44
- const sequelize = this.db.sequelize;
45
- const attributes = [];
46
- const fieldMap = {};
47
- measures.forEach((measure) => {
48
- const { field, aggregation, alias, distinct } = measure;
49
- const attribute = [];
50
- const col = sequelize.col(field);
51
- if (aggregation) {
52
- if (!AllowedAggFuncs.includes(aggregation)) {
53
- throw new Error(`Invalid aggregation function: ${aggregation}`);
54
- }
55
- hasAgg = true;
56
- attribute.push(sequelize.fn(aggregation, distinct ? sequelize.fn("DISTINCT", col) : col));
57
- } else {
58
- attribute.push(col);
59
- }
60
- if (alias) {
61
- attribute.push(alias);
62
- }
63
- attributes.push(attribute.length > 1 ? attribute : attribute[0]);
64
- fieldMap[alias || field] = measure;
65
- });
66
- return { attributes, fieldMap, hasAgg };
67
- }
68
- parseDimensions(ctx, dimensions, hasAgg, timezone) {
69
- const sequelize = this.db.sequelize;
70
- const attributes = [];
71
- const group = [];
72
- const fieldMap = {};
73
- dimensions.forEach((dimension) => {
74
- const { field, format, alias, type, options } = dimension;
75
- const attribute = [];
76
- const col = sequelize.col(field);
77
- if (format) {
78
- attribute.push(this.formatter.format({ type, field, format, timezone, options }));
79
- } else {
80
- attribute.push(col);
81
- }
82
- if (alias) {
83
- attribute.push(alias);
84
- }
85
- attributes.push(attribute.length > 1 ? attribute : attribute[0]);
86
- if (hasAgg) {
87
- group.push(attribute[0]);
88
- }
89
- fieldMap[alias || field] = dimension;
90
- });
91
- return { attributes, group, fieldMap };
92
- }
93
- parseOrders(ctx, orders, hasAgg) {
94
- const sequelize = this.db.sequelize;
95
- const order = [];
96
- orders.forEach((item) => {
97
- const alias = sequelize.getQueryInterface().quoteIdentifier(item.alias);
98
- const name = hasAgg ? sequelize.literal(alias) : sequelize.col(item.field);
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]);
107
- });
108
- return order;
109
- }
110
- parse() {
111
- return async (ctx, next) => {
112
- var _a;
113
- const { measures, dimensions, orders, include, where, limit, offset } = ctx.action.params.values;
114
- const { attributes: measureAttributes, fieldMap: measureFieldMap, hasAgg } = this.parseMeasures(ctx, measures);
115
- const {
116
- attributes: dimensionAttributes,
117
- group,
118
- fieldMap: dimensionFieldMap
119
- } = this.parseDimensions(ctx, dimensions, hasAgg, (_a = ctx.get) == null ? void 0 : _a.call(ctx, "x-timezone"));
120
- const order = this.parseOrders(ctx, orders, hasAgg);
121
- const queryParams = {
122
- where,
123
- attributes: [...dimensionAttributes, ...measureAttributes],
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
- }
134
- ctx.action.params.values = {
135
- ...ctx.action.params.values,
136
- queryParams,
137
- fieldMap: { ...measureFieldMap, ...dimensionFieldMap }
138
- };
139
- await next();
140
- };
141
- }
142
- }
143
- // Annotate the CommonJS export names for ESM import in node:
144
- 0 && (module.exports = {
145
- QueryParser
146
- });
@@ -1,43 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- var __defProp = Object.defineProperty;
11
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
- var __getOwnPropNames = Object.getOwnPropertyNames;
13
- var __hasOwnProp = Object.prototype.hasOwnProperty;
14
- var __export = (target, all) => {
15
- for (var name in all)
16
- __defProp(target, name, { get: all[name], enumerable: true });
17
- };
18
- var __copyProps = (to, from, except, desc) => {
19
- if (from && typeof from === "object" || typeof from === "function") {
20
- for (let key of __getOwnPropNames(from))
21
- if (!__hasOwnProp.call(to, key) && key !== except)
22
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
- }
24
- return to;
25
- };
26
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
- var sqlite_query_parser_exports = {};
28
- __export(sqlite_query_parser_exports, {
29
- SQLiteQueryParser: () => SQLiteQueryParser
30
- });
31
- module.exports = __toCommonJS(sqlite_query_parser_exports);
32
- var import_sqlite_formatter = require("../formatter/sqlite-formatter");
33
- var import_query_parser = require("./query-parser");
34
- class SQLiteQueryParser extends import_query_parser.QueryParser {
35
- constructor(db) {
36
- super(db);
37
- this.formatter = new import_sqlite_formatter.SQLiteFormatter(db.sequelize);
38
- }
39
- }
40
- // Annotate the CommonJS export names for ESM import in node:
41
- 0 && (module.exports = {
42
- SQLiteQueryParser
43
- });