@nocobase/plugin-data-visualization 0.14.0-alpha.6 → 0.14.0-alpha.7
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/DataVisualization.d.ts +2 -0
- package/dist/client/chart/chart.d.ts +9 -23
- package/dist/client/chart/configs.d.ts +3 -0
- package/dist/client/chart/group.d.ts +32 -0
- package/dist/client/index.d.ts +2 -2
- package/dist/client/index.js +37 -37
- package/dist/externalVersion.js +9 -9
- package/dist/node_modules/koa-compose/package.json +1 -1
- package/dist/server/actions/query.js +1 -1
- package/dist/server/migrations/20230926211750-rename-charttype.d.ts +4 -0
- package/dist/server/migrations/20230926211750-rename-charttype.js +50 -0
- package/dist/server/plugin.js +8 -0
- package/package.json +2 -2
- package/dist/client/Settings.d.ts +0 -2
- package/dist/client/chart/library.d.ts +0 -28
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { FieldOption } from '../hooks';
|
|
3
3
|
import { QueryProps } from '../renderer';
|
|
4
4
|
import { ISchema } from '@formily/react';
|
|
5
|
-
import { AnySchemaProperties,
|
|
5
|
+
import { AnySchemaProperties, Config } from './configs';
|
|
6
6
|
export type RenderProps = {
|
|
7
7
|
data: any[];
|
|
8
8
|
general: any;
|
|
@@ -18,15 +18,6 @@ export interface ChartType {
|
|
|
18
18
|
title: string;
|
|
19
19
|
component: React.FC<any>;
|
|
20
20
|
schema: ISchema;
|
|
21
|
-
infer: (fields: FieldOption[], { measures, dimensions, }: {
|
|
22
|
-
measures?: QueryProps['measures'];
|
|
23
|
-
dimensions?: QueryProps['dimensions'];
|
|
24
|
-
}) => {
|
|
25
|
-
xField: FieldOption;
|
|
26
|
-
yField: FieldOption;
|
|
27
|
-
seriesField: FieldOption;
|
|
28
|
-
yFields: FieldOption[];
|
|
29
|
-
};
|
|
30
21
|
init?: (fields: FieldOption[], query: {
|
|
31
22
|
measures?: QueryProps['measures'];
|
|
32
23
|
dimensions?: QueryProps['dimensions'];
|
|
@@ -34,32 +25,23 @@ export interface ChartType {
|
|
|
34
25
|
general?: any;
|
|
35
26
|
advanced?: any;
|
|
36
27
|
};
|
|
37
|
-
|
|
38
|
-
* getProps
|
|
39
|
-
* Accept the information that the chart component needs to render,
|
|
40
|
-
* process it and return the props of the chart component.
|
|
41
|
-
*/
|
|
42
|
-
getProps: (props: RenderProps) => any;
|
|
28
|
+
render: (props: RenderProps) => React.FC<any>;
|
|
43
29
|
getReference?: () => {
|
|
44
30
|
title: string;
|
|
45
31
|
link: string;
|
|
46
32
|
};
|
|
47
|
-
render: (props: RenderProps) => React.FC<any>;
|
|
48
33
|
}
|
|
49
|
-
type Config = ((ConfigProps & {
|
|
50
|
-
property?: string;
|
|
51
|
-
}) | string)[];
|
|
52
34
|
export type ChartProps = {
|
|
53
35
|
name: string;
|
|
54
36
|
title: string;
|
|
55
37
|
component: React.FC<any>;
|
|
56
|
-
config?: Config;
|
|
38
|
+
config?: Config[];
|
|
57
39
|
};
|
|
58
40
|
export declare class Chart implements ChartType {
|
|
59
41
|
name: string;
|
|
60
42
|
title: string;
|
|
61
43
|
component: React.FC<any>;
|
|
62
|
-
config: Config;
|
|
44
|
+
config: Config[];
|
|
63
45
|
configs: Map<string, Function>;
|
|
64
46
|
constructor({ name, title, component, config }: ChartProps);
|
|
65
47
|
get schema(): {
|
|
@@ -81,7 +63,11 @@ export declare class Chart implements ChartType {
|
|
|
81
63
|
seriesField: FieldOption;
|
|
82
64
|
yFields: FieldOption[];
|
|
83
65
|
};
|
|
66
|
+
/**
|
|
67
|
+
* getProps
|
|
68
|
+
* Accept the information that the chart component needs to render,
|
|
69
|
+
* process it and return the props of the chart component.
|
|
70
|
+
*/
|
|
84
71
|
getProps(props: RenderProps): RenderProps;
|
|
85
72
|
render({ data, general, advanced, fieldProps }: RenderProps): () => React.FunctionComponentElement<any>;
|
|
86
73
|
}
|
|
87
|
-
export {};
|
|
@@ -7,6 +7,9 @@ export type FieldConfigProps = Partial<{
|
|
|
7
7
|
}>;
|
|
8
8
|
export type AnySchemaProperties = SchemaProperties<any, any, any, any, any, any, any, any>;
|
|
9
9
|
export type ConfigProps = FieldConfigProps | AnySchemaProperties | (() => AnySchemaProperties);
|
|
10
|
+
export type Config = (ConfigProps & {
|
|
11
|
+
property?: string;
|
|
12
|
+
}) | string;
|
|
10
13
|
declare const _default: {
|
|
11
14
|
field: ({ name, title, required, defaultValue }: Partial<{
|
|
12
15
|
name: string;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ChartType } from './chart';
|
|
2
|
+
export declare class ChartGroup {
|
|
3
|
+
charts: Map<string, ChartType[]>;
|
|
4
|
+
setGroup(name: string, charts: ChartType[]): void;
|
|
5
|
+
addGroup(name: string, charts: ChartType[]): void;
|
|
6
|
+
add(group: string, chart: ChartType): void;
|
|
7
|
+
getChartTypes(): {
|
|
8
|
+
label: string;
|
|
9
|
+
children: {
|
|
10
|
+
key: string;
|
|
11
|
+
label: string;
|
|
12
|
+
value: string;
|
|
13
|
+
}[];
|
|
14
|
+
}[];
|
|
15
|
+
getCharts(): {
|
|
16
|
+
[key: string]: ChartType;
|
|
17
|
+
};
|
|
18
|
+
getChart(type: string): ChartType;
|
|
19
|
+
}
|
|
20
|
+
export declare const useChartTypes: () => {
|
|
21
|
+
label: string;
|
|
22
|
+
children: {
|
|
23
|
+
key: string;
|
|
24
|
+
label: string;
|
|
25
|
+
value: string;
|
|
26
|
+
}[];
|
|
27
|
+
}[];
|
|
28
|
+
export declare const useDefaultChartType: () => string;
|
|
29
|
+
export declare const useCharts: () => {
|
|
30
|
+
[key: string]: ChartType;
|
|
31
|
+
};
|
|
32
|
+
export declare const useChart: (type: string) => ChartType;
|
package/dist/client/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Plugin } from '@nocobase/client';
|
|
2
|
-
import {
|
|
2
|
+
import { ChartGroup } from './chart/group';
|
|
3
3
|
declare class DataVisualizationPlugin extends Plugin {
|
|
4
|
+
charts: ChartGroup;
|
|
4
5
|
load(): Promise<void>;
|
|
5
6
|
}
|
|
6
7
|
export default DataVisualizationPlugin;
|
|
7
|
-
export { ChartLibraryProvider };
|
|
8
8
|
export { Chart } from './chart/chart';
|
|
9
9
|
export type { ChartType } from './chart/chart';
|