@nocobase/plugin-data-visualization 0.14.0-alpha.7 → 0.14.0-alpha.8

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.
@@ -1,6 +1,7 @@
1
+ export type Transformer = (val: any, locale?: string) => string | number;
1
2
  declare const transformers: {
2
3
  [key: string]: {
3
- [key: string]: (val: any, locale?: string) => string | number;
4
+ [key: string]: Transformer;
4
5
  };
5
6
  };
6
7
  export default transformers;
@@ -1,17 +1,7 @@
1
1
  import { AntdChart } from './antd';
2
- import { FieldOption } from '../../hooks';
3
- import { QueryProps } from '../../renderer';
4
- import { RenderProps } from '../chart';
2
+ import { ChartType, RenderProps } from '../chart';
5
3
  export declare class Statistic extends AntdChart {
6
4
  constructor();
7
- init(fields: FieldOption[], { measures, dimensions, }: {
8
- measures?: QueryProps['measures'];
9
- dimensions?: QueryProps['dimensions'];
10
- }): {
11
- general: {
12
- field: string;
13
- title: string;
14
- };
15
- };
5
+ init: ChartType['init'];
16
6
  getProps({ data, fieldProps, general, advanced }: RenderProps): any;
17
7
  }
@@ -3,13 +3,15 @@ import { FieldOption } from '../hooks';
3
3
  import { QueryProps } from '../renderer';
4
4
  import { ISchema } from '@formily/react';
5
5
  import { AnySchemaProperties, Config } from './configs';
6
+ import { Transformer } from '../block/transformers';
6
7
  export type RenderProps = {
7
- data: any[];
8
+ data: Record<string, any>[];
8
9
  general: any;
9
10
  advanced: any;
10
11
  fieldProps: {
11
- [field: string]: FieldOption & {
12
- transformer: (val: any) => string;
12
+ [field: string]: {
13
+ label: string;
14
+ transformer: Transformer;
13
15
  };
14
16
  };
15
17
  };
@@ -68,6 +70,6 @@ export declare class Chart implements ChartType {
68
70
  * Accept the information that the chart component needs to render,
69
71
  * process it and return the props of the chart component.
70
72
  */
71
- getProps(props: RenderProps): RenderProps;
73
+ getProps(props: RenderProps): any;
72
74
  render({ data, general, advanced, fieldProps }: RenderProps): () => React.FunctionComponentElement<any>;
73
75
  }
@@ -41,5 +41,38 @@ declare const _default: {
41
41
  default: any;
42
42
  };
43
43
  };
44
+ xField: (props: FieldConfigProps) => {
45
+ [x: string]: {
46
+ title: string;
47
+ type: string;
48
+ 'x-decorator': string;
49
+ 'x-component': string;
50
+ 'x-reactions': string;
51
+ required: boolean;
52
+ default: any;
53
+ };
54
+ };
55
+ yField: (props: FieldConfigProps) => {
56
+ [x: string]: {
57
+ title: string;
58
+ type: string;
59
+ 'x-decorator': string;
60
+ 'x-component': string;
61
+ 'x-reactions': string;
62
+ required: boolean;
63
+ default: any;
64
+ };
65
+ };
66
+ seriesField: (props: FieldConfigProps) => {
67
+ [x: string]: {
68
+ title: string;
69
+ type: string;
70
+ 'x-decorator': string;
71
+ 'x-component': string;
72
+ 'x-reactions': string;
73
+ required: boolean;
74
+ default: any;
75
+ };
76
+ };
44
77
  };
45
78
  export default _default;
@@ -1,16 +1,6 @@
1
- import { FieldOption } from '../../hooks';
2
- import { QueryProps } from '../../renderer';
3
1
  import { G2PlotChart } from './g2plot';
2
+ import { ChartType } from '../chart';
4
3
  export declare class Bar extends G2PlotChart {
5
4
  constructor();
6
- init(fields: FieldOption[], { measures, dimensions, }: {
7
- measures?: QueryProps['measures'];
8
- dimensions?: QueryProps['dimensions'];
9
- }): {
10
- general: {
11
- xField: string;
12
- yField: string;
13
- seriesField: string;
14
- };
15
- };
5
+ init: ChartType['init'];
16
6
  }
@@ -1,38 +1,5 @@
1
1
  import { FieldConfigProps } from '../configs';
2
2
  declare const _default: {
3
- xField: (props: FieldConfigProps) => {
4
- [x: string]: {
5
- title: string;
6
- type: string;
7
- 'x-decorator': string;
8
- 'x-component': string;
9
- 'x-reactions': string;
10
- required: boolean;
11
- default: any;
12
- };
13
- };
14
- yField: (props: FieldConfigProps) => {
15
- [x: string]: {
16
- title: string;
17
- type: string;
18
- 'x-decorator': string;
19
- 'x-component': string;
20
- 'x-reactions': string;
21
- required: boolean;
22
- default: any;
23
- };
24
- };
25
- seriesField: (props: FieldConfigProps) => {
26
- [x: string]: {
27
- title: string;
28
- type: string;
29
- 'x-decorator': string;
30
- 'x-component': string;
31
- 'x-reactions': string;
32
- required: boolean;
33
- default: any;
34
- };
35
- };
36
3
  isStack: (props: FieldConfigProps) => {
37
4
  [x: string]: {
38
5
  'x-content': string;
@@ -1,18 +1,8 @@
1
1
  import { G2PlotChart } from './g2plot';
2
- import { RenderProps } from '../chart';
2
+ import { ChartType, RenderProps } from '../chart';
3
3
  import React from 'react';
4
- import { FieldOption } from '../../hooks';
5
- import { QueryProps } from '../../renderer';
6
4
  export declare class DualAxes extends G2PlotChart {
7
5
  constructor();
8
- init(fields: FieldOption[], { measures, dimensions, }: {
9
- measures?: QueryProps['measures'];
10
- dimensions?: QueryProps['dimensions'];
11
- }): {
12
- general: {
13
- xField: string;
14
- yField: string[];
15
- };
16
- };
6
+ init: ChartType['init'];
17
7
  render({ data, general, advanced, fieldProps }: RenderProps): () => React.FunctionComponentElement<any>;
18
8
  }
@@ -1,15 +1,7 @@
1
- import { Chart, ChartProps, RenderProps } from '../chart';
2
- import { FieldOption } from '../../hooks';
3
- import { QueryProps } from '../../renderer';
1
+ import { Chart, ChartProps, ChartType, RenderProps } from '../chart';
4
2
  export declare class G2PlotChart extends Chart {
5
3
  constructor({ name, title, component, config }: ChartProps);
6
- init(fields: FieldOption[], { measures, dimensions, }: {
7
- measures?: QueryProps['measures'];
8
- dimensions?: QueryProps['dimensions'];
9
- }): {
10
- general?: any;
11
- advanced?: any;
12
- };
4
+ init: ChartType['init'];
13
5
  getProps({ data, general, advanced, fieldProps }: RenderProps): any;
14
6
  getReference(): {
15
7
  title: string;
@@ -1,6 +1,3 @@
1
- import { Bar } from './bar';
2
- import { Pie } from './pie';
3
- import { DualAxes } from './dualAxes';
4
1
  import { G2PlotChart } from './g2plot';
5
- declare const _default: (G2PlotChart | Bar | Pie | DualAxes)[];
2
+ declare const _default: G2PlotChart[];
6
3
  export default _default;
@@ -1,15 +1,6 @@
1
1
  import { G2PlotChart } from './g2plot';
2
- import { FieldOption } from '../../hooks';
3
- import { QueryProps } from '../../renderer';
2
+ import { ChartType } from '../chart';
4
3
  export declare class Pie extends G2PlotChart {
5
4
  constructor();
6
- init(fields: FieldOption[], { measures, dimensions, }: {
7
- measures?: QueryProps['measures'];
8
- dimensions?: QueryProps['dimensions'];
9
- }): {
10
- general: {
11
- colorField: string;
12
- angleField: string;
13
- };
14
- };
5
+ init: ChartType['init'];
15
6
  }
@@ -6,4 +6,7 @@ declare class DataVisualizationPlugin extends Plugin {
6
6
  }
7
7
  export default DataVisualizationPlugin;
8
8
  export { Chart } from './chart/chart';
9
- export type { ChartType } from './chart/chart';
9
+ export type { ChartType, RenderProps, ChartProps } from './chart/chart';
10
+ export type { FieldOption } from './hooks';
11
+ export type { QueryProps } from './renderer';
12
+ export { ChartConfigContext } from './configure/ChartConfigure';