@nocobase/plugin-data-visualization 1.3.39-beta → 1.4.0-alpha

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 (80) hide show
  1. package/dist/client/block/ChartBlockProvider.d.ts +10 -0
  2. package/dist/client/block/GlobalAutoRefreshProvider.d.ts +19 -0
  3. package/dist/client/block/index.d.ts +2 -0
  4. package/dist/client/chart/chart.d.ts +9 -6
  5. package/dist/client/chart/configs.d.ts +212 -19
  6. package/dist/client/chart/group.d.ts +9 -4
  7. package/dist/client/configure/schemas/configure.d.ts +1 -1
  8. package/dist/client/filter/utils.d.ts +2 -1
  9. package/dist/client/hooks/chart.d.ts +20 -0
  10. package/dist/client/hooks/index.d.ts +1 -0
  11. package/dist/client/index.d.ts +1 -0
  12. package/dist/client/index.js +30 -30
  13. package/dist/client/initializers/BlockRefreshAction.d.ts +14 -0
  14. package/dist/client/initializers/RefreshAction.d.ts +14 -0
  15. package/dist/client/initializers/chartActions.d.ts +10 -0
  16. package/dist/client/initializers/chartBlockActions.d.ts +10 -0
  17. package/dist/client/renderer/ChartRendererDesigner.d.ts +10 -0
  18. package/dist/client/renderer/ChartRendererProvider.d.ts +6 -0
  19. package/dist/client/settings/AutoRefreshItem.d.ts +13 -0
  20. package/dist/client/settings/chartActionRefresh.d.ts +10 -0
  21. package/dist/client/settings/chartBlockActionRefresh.d.ts +10 -0
  22. package/dist/client/utils.d.ts +42 -0
  23. package/dist/externalVersion.js +8 -8
  24. package/dist/locale/en-US.json +15 -14
  25. package/dist/locale/zh-CN.json +10 -9
  26. package/dist/node_modules/koa-compose/package.json +1 -1
  27. package/dist/node_modules/moment-timezone/LICENSE +20 -0
  28. package/dist/node_modules/moment-timezone/builds/moment-timezone-with-data-10-year-range.js +1548 -0
  29. package/dist/node_modules/moment-timezone/builds/moment-timezone-with-data-10-year-range.min.js +1 -0
  30. package/dist/node_modules/moment-timezone/builds/moment-timezone-with-data-1970-2030.js +1548 -0
  31. package/dist/node_modules/moment-timezone/builds/moment-timezone-with-data-1970-2030.min.js +1 -0
  32. package/dist/node_modules/moment-timezone/builds/moment-timezone-with-data-2012-2022.js +1560 -0
  33. package/dist/node_modules/moment-timezone/builds/moment-timezone-with-data-2012-2022.min.js +1 -0
  34. package/dist/node_modules/moment-timezone/builds/moment-timezone-with-data.js +1548 -0
  35. package/dist/node_modules/moment-timezone/builds/moment-timezone-with-data.min.js +1 -0
  36. package/dist/node_modules/moment-timezone/builds/moment-timezone.min.js +1 -0
  37. package/dist/node_modules/moment-timezone/composer.json +43 -0
  38. package/dist/node_modules/moment-timezone/data/meta/latest.json +5889 -0
  39. package/dist/node_modules/moment-timezone/data/packed/latest.json +852 -0
  40. package/dist/node_modules/moment-timezone/index.d.ts +78 -0
  41. package/dist/node_modules/moment-timezone/index.js +15 -0
  42. package/dist/node_modules/moment-timezone/moment-timezone-utils.d.ts +70 -0
  43. package/dist/node_modules/moment-timezone/moment-timezone-utils.js +339 -0
  44. package/dist/node_modules/moment-timezone/moment-timezone.js +696 -0
  45. package/dist/node_modules/moment-timezone/package.json +1 -0
  46. package/dist/server/actions/query.d.ts +0 -1
  47. package/dist/server/actions/query.js +11 -75
  48. package/dist/server/formatter/formatter.d.ts +27 -0
  49. package/dist/server/formatter/formatter.js +85 -0
  50. package/dist/server/formatter/mysql-formatter.d.ts +14 -0
  51. package/dist/server/formatter/mysql-formatter.js +86 -0
  52. package/dist/server/formatter/oracle-formatter.d.ts +14 -0
  53. package/dist/server/formatter/oracle-formatter.js +74 -0
  54. package/dist/server/formatter/postgres-formatter.d.ts +14 -0
  55. package/dist/server/formatter/postgres-formatter.js +74 -0
  56. package/dist/server/formatter/sqlite-formatter.d.ts +15 -0
  57. package/dist/server/formatter/sqlite-formatter.js +83 -0
  58. package/dist/server/migrations/20240921214400-rename-charttype.d.ts +14 -0
  59. package/dist/server/migrations/20240921214400-rename-charttype.js +64 -0
  60. package/dist/server/plugin.js +1 -1
  61. package/dist/server/query-parser/index.d.ts +11 -0
  62. package/dist/server/query-parser/index.js +56 -0
  63. package/dist/server/query-parser/mysql-query-parser.d.ts +15 -0
  64. package/dist/server/query-parser/mysql-query-parser.js +43 -0
  65. package/dist/server/query-parser/oracle-query-parser.d.ts +18 -0
  66. package/dist/server/query-parser/oracle-query-parser.js +60 -0
  67. package/dist/server/query-parser/postgres-query-parser.d.ts +15 -0
  68. package/dist/server/query-parser/postgres-query-parser.js +43 -0
  69. package/dist/server/query-parser/query-parser.d.ts +31 -0
  70. package/dist/server/query-parser/query-parser.js +134 -0
  71. package/dist/server/query-parser/sqlite-query-parser.d.ts +15 -0
  72. package/dist/server/query-parser/sqlite-query-parser.js +43 -0
  73. package/dist/server/types.d.ts +46 -0
  74. package/dist/server/types.js +24 -0
  75. package/package.json +2 -2
  76. package/dist/client/chart/g2plot/configs.d.ts +0 -122
  77. package/dist/server/actions/formatter.d.ts +0 -12
  78. package/dist/server/actions/formatter.js +0 -101
  79. /package/dist/locale/{ja_JP.json → ja-JP.json} +0 -0
  80. /package/dist/locale/{ko_KR.json → ko-KR.json} +0 -0
@@ -0,0 +1,10 @@
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 React from 'react';
10
+ export declare const ChartBlockProvider: React.FC;
@@ -0,0 +1,19 @@
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 React from 'react';
10
+ export declare const GlobalAutoRefreshContext: React.Context<{
11
+ addChart: (uid: string, chart: {
12
+ service: any;
13
+ }) => void;
14
+ removeChart: (uid: string) => void;
15
+ autoRefresh: number | boolean;
16
+ setAutoRefresh: (autoRefresh: number | boolean) => void;
17
+ refreshCharts: () => void;
18
+ }>;
19
+ export declare const GlobalAutoRefreshProvider: React.FC;
@@ -9,3 +9,5 @@
9
9
  export * from './ChartBlock';
10
10
  export * from './ChartBlockDesigner';
11
11
  export * from './ChartBlockInitializer';
12
+ export * from './ChartBlockProvider';
13
+ export * from './GlobalAutoRefreshProvider';
@@ -10,7 +10,7 @@ import React from 'react';
10
10
  import { FieldOption } from '../hooks';
11
11
  import { DimensionProps, MeasureProps } from '../renderer';
12
12
  import { ISchema } from '@formily/react';
13
- import { AnySchemaProperties, Config, FieldConfigProps } from './configs';
13
+ import { Config, ConfigType } from './configs';
14
14
  import { Transformer } from '../transformers';
15
15
  export type RenderProps = {
16
16
  data: Record<string, any>[];
@@ -27,6 +27,7 @@ export type RenderProps = {
27
27
  export interface ChartType {
28
28
  name: string;
29
29
  title: string;
30
+ enableAdvancedConfig?: boolean;
30
31
  Component: React.FC<any>;
31
32
  schema: ISchema;
32
33
  init?: (fields: FieldOption[], query: {
@@ -45,25 +46,27 @@ export interface ChartType {
45
46
  export type ChartProps = {
46
47
  name: string;
47
48
  title: string;
49
+ enableAdvancedConfig?: boolean;
48
50
  Component: React.FC<any>;
49
51
  config?: Config[];
50
52
  };
51
53
  export declare class Chart implements ChartType {
52
54
  name: string;
53
55
  title: string;
56
+ enableAdvancedConfig: boolean;
54
57
  Component: React.FC<any>;
55
58
  config: Config[];
56
- configs: Map<string, Function>;
57
- constructor({ name, title, Component, config }: ChartProps);
59
+ configTypes: Map<string, ConfigType>;
60
+ constructor({ name, title, enableAdvancedConfig, Component, config }: ChartProps);
58
61
  get schema(): {
59
62
  type?: undefined;
60
63
  properties?: undefined;
61
64
  } | {
62
65
  type: string;
63
- properties: AnySchemaProperties;
66
+ properties: any;
64
67
  };
65
- addConfigs(configs: {
66
- [key: string]: (props: FieldConfigProps) => AnySchemaProperties;
68
+ addConfigTypes(configs: {
69
+ [key: string]: ConfigType;
67
70
  }): void;
68
71
  infer(fields: FieldOption[], { measures, dimensions, }: {
69
72
  measures?: MeasureProps[];
@@ -12,18 +12,30 @@ export type FieldConfigProps = Partial<{
12
12
  title: string;
13
13
  required: boolean;
14
14
  defaultValue: any;
15
+ description: string;
16
+ options: {
17
+ label: string;
18
+ value: any;
19
+ }[];
20
+ componentProps: Record<string, any>;
15
21
  }>;
16
22
  export type AnySchemaProperties = SchemaProperties<any, any, any, any, any, any, any, any>;
17
- export type ConfigProps = FieldConfigProps | AnySchemaProperties | (() => AnySchemaProperties);
18
- export type Config = (ConfigProps & {
19
- property?: string;
20
- }) | string;
23
+ export type ConfigType = (FieldConfigProps & {
24
+ configType?: string;
25
+ }) | ((props?: FieldConfigProps) => AnySchemaProperties) | AnySchemaProperties;
26
+ export type Config = string | ConfigType;
21
27
  declare const _default: {
22
- field: ({ name, title, required, defaultValue }: Partial<{
28
+ field: ({ name, title, required, defaultValue, description }: Partial<{
23
29
  name: string;
24
30
  title: string;
25
31
  required: boolean;
26
32
  defaultValue: any;
33
+ description: string;
34
+ options: {
35
+ label: string;
36
+ value: any;
37
+ }[];
38
+ componentProps: Record<string, any>;
27
39
  }>) => {
28
40
  [x: string]: {
29
41
  title: string;
@@ -32,65 +44,246 @@ declare const _default: {
32
44
  'x-component': string;
33
45
  'x-reactions': string;
34
46
  required: boolean;
47
+ description: string;
35
48
  default: any;
36
49
  };
37
50
  };
38
- booleanField: ({ name, title, defaultValue }: Partial<{
51
+ input: ({ name, title, required, defaultValue, description }: Partial<{
39
52
  name: string;
40
53
  title: string;
41
54
  required: boolean;
42
55
  defaultValue: any;
56
+ description: string;
57
+ options: {
58
+ label: string;
59
+ value: any;
60
+ }[];
61
+ componentProps: Record<string, any>;
43
62
  }>) => {
44
63
  [x: string]: {
45
- 'x-content': string;
64
+ title: string;
46
65
  type: string;
47
66
  'x-decorator': string;
48
67
  'x-component': string;
68
+ required: boolean;
49
69
  default: any;
70
+ description: string;
50
71
  };
51
72
  };
52
- xField: (props: FieldConfigProps) => {
73
+ boolean: ({ name, title, defaultValue, description }: Partial<{
74
+ name: string;
75
+ title: string;
76
+ required: boolean;
77
+ defaultValue: any;
78
+ description: string;
79
+ options: {
80
+ label: string;
81
+ value: any;
82
+ }[];
83
+ componentProps: Record<string, any>;
84
+ }>) => {
53
85
  [x: string]: {
54
- title: string;
86
+ 'x-content': string;
55
87
  type: string;
56
88
  'x-decorator': string;
57
89
  'x-component': string;
58
- 'x-reactions': string;
59
- required: boolean;
60
90
  default: any;
91
+ description: string;
61
92
  };
62
93
  };
63
- yField: (props: FieldConfigProps) => {
94
+ select: ({ name, title, required, defaultValue, options, description }: Partial<{
95
+ name: string;
96
+ title: string;
97
+ required: boolean;
98
+ defaultValue: any;
99
+ description: string;
100
+ options: {
101
+ label: string;
102
+ value: any;
103
+ }[];
104
+ componentProps: Record<string, any>;
105
+ }>) => {
64
106
  [x: string]: {
65
107
  title: string;
66
108
  type: string;
67
109
  'x-decorator': string;
68
110
  'x-component': string;
69
- 'x-reactions': string;
70
111
  required: boolean;
71
112
  default: any;
113
+ description: string;
114
+ enum: {
115
+ label: string;
116
+ value: any;
117
+ }[];
72
118
  };
73
119
  };
74
- seriesField: (props: FieldConfigProps) => {
120
+ radio: ({ name, title, defaultValue, options, description, componentProps }: Partial<{
121
+ name: string;
122
+ title: string;
123
+ required: boolean;
124
+ defaultValue: any;
125
+ description: string;
126
+ options: {
127
+ label: string;
128
+ value: any;
129
+ }[];
130
+ componentProps: Record<string, any>;
131
+ }>) => {
75
132
  [x: string]: {
76
133
  title: string;
77
134
  type: string;
78
135
  'x-decorator': string;
79
136
  'x-component': string;
80
- 'x-reactions': string;
81
- required: boolean;
137
+ 'x-component-props': {
138
+ [x: string]: any;
139
+ };
82
140
  default: any;
141
+ description: string;
142
+ enum: {
143
+ label: string;
144
+ value: any;
145
+ }[];
83
146
  };
84
147
  };
85
- colorField: (props: FieldConfigProps) => {
148
+ percent: ({ name, title, defaultValue, description }: Partial<{
149
+ name: string;
150
+ title: string;
151
+ required: boolean;
152
+ defaultValue: any;
153
+ description: string;
154
+ options: {
155
+ label: string;
156
+ value: any;
157
+ }[];
158
+ componentProps: Record<string, any>;
159
+ }>) => {
86
160
  [x: string]: {
87
161
  title: string;
88
162
  type: string;
89
163
  'x-decorator': string;
90
164
  'x-component': string;
91
- 'x-reactions': string;
92
- required: boolean;
93
165
  default: any;
166
+ description: string;
167
+ 'x-component-props': {
168
+ suffix: string;
169
+ };
170
+ };
171
+ };
172
+ xField: {
173
+ configType: string;
174
+ name: string;
175
+ title: string;
176
+ required: boolean;
177
+ };
178
+ yField: {
179
+ configType: string;
180
+ name: string;
181
+ title: string;
182
+ required: boolean;
183
+ };
184
+ seriesField: {
185
+ configType: string;
186
+ name: string;
187
+ title: string;
188
+ };
189
+ colorField: {
190
+ configType: string;
191
+ name: string;
192
+ title: string;
193
+ required: boolean;
194
+ };
195
+ isStack: {
196
+ configType: string;
197
+ name: string;
198
+ title: string;
199
+ };
200
+ smooth: {
201
+ configType: string;
202
+ name: string;
203
+ title: string;
204
+ };
205
+ isPercent: {
206
+ configType: string;
207
+ name: string;
208
+ title: string;
209
+ };
210
+ isGroup: {
211
+ configType: string;
212
+ name: string;
213
+ title: string;
214
+ };
215
+ size: () => {
216
+ size: {
217
+ title: string;
218
+ type: string;
219
+ 'x-decorator': string;
220
+ 'x-component': string;
221
+ properties: {
222
+ type: {
223
+ 'x-component': string;
224
+ 'x-component-props': {
225
+ allowClear: boolean;
226
+ };
227
+ default: string;
228
+ enum: {
229
+ label: string;
230
+ value: string;
231
+ }[];
232
+ };
233
+ fixed: {
234
+ type: string;
235
+ 'x-component': string;
236
+ 'x-component-props': {
237
+ min: number;
238
+ addonAfter: string;
239
+ };
240
+ 'x-reactions': {
241
+ dependencies: string[];
242
+ fulfill: {
243
+ state: {
244
+ visible: string;
245
+ };
246
+ };
247
+ }[];
248
+ };
249
+ ratio: {
250
+ type: string;
251
+ 'x-component': string;
252
+ 'x-reactions': {
253
+ dependencies: string[];
254
+ fulfill: {
255
+ state: {
256
+ visible: string;
257
+ };
258
+ };
259
+ }[];
260
+ properties: {
261
+ width: {
262
+ type: string;
263
+ 'x-component': string;
264
+ 'x-component-props': {
265
+ placeholder: string;
266
+ min: number;
267
+ };
268
+ };
269
+ colon: {
270
+ type: string;
271
+ 'x-component': string;
272
+ 'x-component-props': {
273
+ children: string;
274
+ };
275
+ };
276
+ height: {
277
+ type: string;
278
+ 'x-component': string;
279
+ 'x-component-props': {
280
+ placeholder: string;
281
+ min: number;
282
+ };
283
+ };
284
+ };
285
+ };
286
+ };
94
287
  };
95
288
  };
96
289
  };
@@ -7,14 +7,18 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
  import { ChartType } from './chart';
10
+ interface Group {
11
+ title: string;
12
+ charts: ChartType[];
13
+ sort?: number;
14
+ }
10
15
  export declare class ChartGroup {
11
16
  /**
12
17
  * @internal
13
18
  */
14
- charts: Map<string, ChartType[]>;
15
- setGroup(name: string, charts: ChartType[]): void;
16
- addGroup(name: string, charts: ChartType[]): void;
17
- add(group: string, chart: ChartType): void;
19
+ charts: Map<string, Group>;
20
+ addGroup(name: string, group: Group): void;
21
+ add(name: string, charts: ChartType | ChartType[]): void;
18
22
  /**
19
23
  * @internal
20
24
  */
@@ -62,3 +66,4 @@ export declare const useCharts: () => {
62
66
  * @internal
63
67
  */
64
68
  export declare const useChart: (type: string) => ChartType;
69
+ export {};
@@ -7,6 +7,6 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
  import { ISchema } from '@formily/react';
10
- export declare const getConfigSchema: (general: any) => ISchema;
10
+ export declare const getConfigSchema: (general: any, enableAdvancedConfig?: boolean) => ISchema;
11
11
  export declare const querySchema: ISchema;
12
12
  export declare const transformSchema: ISchema;
@@ -6,6 +6,7 @@
6
6
  * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
+ import { VariablesContextType } from '@nocobase/client';
9
10
  import { Schema } from '@formily/react';
10
11
  export declare const getOptionsSchema: () => {
11
12
  title: string;
@@ -57,7 +58,7 @@ export declare const getOptionsSchema: () => {
57
58
  };
58
59
  export declare const getPropsSchemaByComponent: (component: string) => any;
59
60
  export declare const transformValue: (value: any, props: any) => any;
60
- export declare const setDefaultValue: (field: any, variables: any) => Promise<void>;
61
+ export declare const setDefaultValue: (field: any, variablesCtx: VariablesContextType, localVariables?: any) => Promise<void>;
61
62
  export declare const FILTER_FIELD_PREFIX_SEPARATOR = "-";
62
63
  export declare const getFilterFieldPrefix: (dataSource: string, fieldName: string) => string;
63
64
  export declare const parseFilterFieldName: (name: string) => {
@@ -0,0 +1,20 @@
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
+ /// <reference types="react" />
10
+ export declare const useSetChartSize: (size: {
11
+ type: 'fixed' | 'ratio';
12
+ ratio?: {
13
+ width: number;
14
+ height: number;
15
+ };
16
+ fixed?: number;
17
+ }, fixedHeight?: number) => {
18
+ chartRef: import("react").MutableRefObject<any>;
19
+ chartHeight: number;
20
+ };
@@ -10,3 +10,4 @@ export * from './query';
10
10
  export * from './transformer';
11
11
  export * from './useVariableOptions';
12
12
  export * from './filter';
13
+ export * from './chart';
@@ -16,5 +16,6 @@ export default PluginDataVisualiztionClient;
16
16
  export { Chart } from './chart/chart';
17
17
  export type { ChartProps, ChartType, RenderProps } from './chart/chart';
18
18
  export { ChartConfigContext } from './configure';
19
+ export { useSetChartSize } from './hooks';
19
20
  export type { FieldOption } from './hooks';
20
21
  export type { QueryProps } from './renderer';