@nocobase/plugin-data-visualization 0.12.0-alpha.3 → 0.12.0-alpha.5
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/chart/antd/statistic.d.ts +0 -2
- package/dist/client/chart/chart.d.ts +24 -2
- package/dist/client/chart/configs.d.ts +42 -0
- package/dist/client/chart/g2plot/configs.d.ts +73 -0
- package/dist/client/chart/g2plot/dualAxes.d.ts +0 -2
- package/dist/client/chart/g2plot/g2plot.d.ts +2 -3
- package/dist/client/chart/g2plot/pie.d.ts +0 -2
- package/dist/client/index.js +264 -194
- package/dist/locale/zh-CN.d.ts +4 -0
- package/dist/locale/zh-CN.js +5 -1
- package/package.json +2 -2
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { ISchema } from '@formily/react';
|
|
2
1
|
import { AntdChart } from './antd';
|
|
3
2
|
import { FieldOption } from '../../hooks';
|
|
4
3
|
import { QueryProps } from '../../renderer';
|
|
5
4
|
import { RenderProps } from '../chart';
|
|
6
5
|
export declare class Statistic extends AntdChart {
|
|
7
|
-
schema: ISchema;
|
|
8
6
|
constructor();
|
|
9
7
|
init(fields: FieldOption[], { measures, dimensions, }: {
|
|
10
8
|
measures?: QueryProps['measures'];
|
|
@@ -2,6 +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, ConfigProps } from './configs';
|
|
5
6
|
export type RenderProps = {
|
|
6
7
|
data: any[];
|
|
7
8
|
general: any;
|
|
@@ -45,12 +46,32 @@ export interface ChartType {
|
|
|
45
46
|
};
|
|
46
47
|
render: (props: RenderProps) => React.FC<any>;
|
|
47
48
|
}
|
|
49
|
+
type Config = ((ConfigProps & {
|
|
50
|
+
property?: string;
|
|
51
|
+
}) | string)[];
|
|
52
|
+
export type ChartProps = {
|
|
53
|
+
name: string;
|
|
54
|
+
title: string;
|
|
55
|
+
component: React.FC<any>;
|
|
56
|
+
config?: Config;
|
|
57
|
+
};
|
|
48
58
|
export declare class Chart implements ChartType {
|
|
49
59
|
name: string;
|
|
50
60
|
title: string;
|
|
51
61
|
component: React.FC<any>;
|
|
52
|
-
|
|
53
|
-
|
|
62
|
+
config: Config;
|
|
63
|
+
configs: Map<string, Function>;
|
|
64
|
+
constructor({ name, title, component, config }: ChartProps);
|
|
65
|
+
get schema(): {
|
|
66
|
+
type?: undefined;
|
|
67
|
+
properties?: undefined;
|
|
68
|
+
} | {
|
|
69
|
+
type: string;
|
|
70
|
+
properties: AnySchemaProperties;
|
|
71
|
+
};
|
|
72
|
+
addConfigs(configs: {
|
|
73
|
+
[key: string]: Function;
|
|
74
|
+
}): void;
|
|
54
75
|
infer(fields: FieldOption[], { measures, dimensions, }: {
|
|
55
76
|
measures?: QueryProps['measures'];
|
|
56
77
|
dimensions?: QueryProps['dimensions'];
|
|
@@ -63,3 +84,4 @@ export declare class Chart implements ChartType {
|
|
|
63
84
|
getProps(props: RenderProps): RenderProps;
|
|
64
85
|
render({ data, general, advanced, fieldProps }: RenderProps): () => React.FunctionComponentElement<any>;
|
|
65
86
|
}
|
|
87
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { SchemaProperties } from '@formily/react';
|
|
2
|
+
export type FieldConfigProps = Partial<{
|
|
3
|
+
name: string;
|
|
4
|
+
title: string;
|
|
5
|
+
required: boolean;
|
|
6
|
+
defaultValue: any;
|
|
7
|
+
}>;
|
|
8
|
+
export type AnySchemaProperties = SchemaProperties<any, any, any, any, any, any, any, any>;
|
|
9
|
+
export type ConfigProps = FieldConfigProps | AnySchemaProperties | (() => AnySchemaProperties);
|
|
10
|
+
declare const _default: {
|
|
11
|
+
field: ({ name, title, required, defaultValue }: Partial<{
|
|
12
|
+
name: string;
|
|
13
|
+
title: string;
|
|
14
|
+
required: boolean;
|
|
15
|
+
defaultValue: any;
|
|
16
|
+
}>) => {
|
|
17
|
+
[x: string]: {
|
|
18
|
+
title: string;
|
|
19
|
+
type: string;
|
|
20
|
+
'x-decorator': string;
|
|
21
|
+
'x-component': string;
|
|
22
|
+
'x-reactions': string;
|
|
23
|
+
required: boolean;
|
|
24
|
+
default: any;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
booleanField: ({ name, title, defaultValue }: Partial<{
|
|
28
|
+
name: string;
|
|
29
|
+
title: string;
|
|
30
|
+
required: boolean;
|
|
31
|
+
defaultValue: any;
|
|
32
|
+
}>) => {
|
|
33
|
+
[x: string]: {
|
|
34
|
+
'x-content': string;
|
|
35
|
+
type: string;
|
|
36
|
+
'x-decorator': string;
|
|
37
|
+
'x-component': string;
|
|
38
|
+
default: any;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
export default _default;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { FieldConfigProps } from '../configs';
|
|
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
|
+
isStack: (props: FieldConfigProps) => {
|
|
37
|
+
[x: string]: {
|
|
38
|
+
'x-content': string;
|
|
39
|
+
type: string;
|
|
40
|
+
'x-decorator': string;
|
|
41
|
+
'x-component': string;
|
|
42
|
+
default: any;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
smooth: (props: FieldConfigProps) => {
|
|
46
|
+
[x: string]: {
|
|
47
|
+
'x-content': string;
|
|
48
|
+
type: string;
|
|
49
|
+
'x-decorator': string;
|
|
50
|
+
'x-component': string;
|
|
51
|
+
default: any;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
isPercent: (props: FieldConfigProps) => {
|
|
55
|
+
[x: string]: {
|
|
56
|
+
'x-content': string;
|
|
57
|
+
type: string;
|
|
58
|
+
'x-decorator': string;
|
|
59
|
+
'x-component': string;
|
|
60
|
+
default: any;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
isGroup: (props: FieldConfigProps) => {
|
|
64
|
+
[x: string]: {
|
|
65
|
+
'x-content': string;
|
|
66
|
+
type: string;
|
|
67
|
+
'x-decorator': string;
|
|
68
|
+
'x-component': string;
|
|
69
|
+
default: any;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
export default _default;
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { ISchema } from '@formily/react';
|
|
2
1
|
import { G2PlotChart } from './g2plot';
|
|
3
2
|
import { RenderProps } from '../chart';
|
|
4
3
|
import React from 'react';
|
|
5
4
|
import { FieldOption } from '../../hooks';
|
|
6
5
|
import { QueryProps } from '../../renderer';
|
|
7
6
|
export declare class DualAxes extends G2PlotChart {
|
|
8
|
-
schema: ISchema;
|
|
9
7
|
constructor();
|
|
10
8
|
init(fields: FieldOption[], { measures, dimensions, }: {
|
|
11
9
|
measures?: QueryProps['measures'];
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { Chart, RenderProps } from '../chart';
|
|
1
|
+
import { Chart, ChartProps, RenderProps } from '../chart';
|
|
2
2
|
import { FieldOption } from '../../hooks';
|
|
3
3
|
import { QueryProps } from '../../renderer';
|
|
4
|
-
import { ISchema } from '@formily/react';
|
|
5
4
|
export declare class G2PlotChart extends Chart {
|
|
6
|
-
|
|
5
|
+
constructor({ name, title, component, config }: ChartProps);
|
|
7
6
|
init(fields: FieldOption[], { measures, dimensions, }: {
|
|
8
7
|
measures?: QueryProps['measures'];
|
|
9
8
|
dimensions?: QueryProps['dimensions'];
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { ISchema } from '@formily/react';
|
|
2
1
|
import { G2PlotChart } from './g2plot';
|
|
3
2
|
import { FieldOption } from '../../hooks';
|
|
4
3
|
import { QueryProps } from '../../renderer';
|
|
5
4
|
export declare class Pie extends G2PlotChart {
|
|
6
|
-
schema: ISchema;
|
|
7
5
|
constructor();
|
|
8
6
|
init(fields: FieldOption[], { measures, dimensions, }: {
|
|
9
7
|
measures?: QueryProps['measures'];
|
package/dist/client/index.js
CHANGED
|
@@ -975,7 +975,7 @@ var __publicField = (obj, key, value) => {
|
|
|
975
975
|
title: t("Configure chart"),
|
|
976
976
|
open: visible,
|
|
977
977
|
onOk: () => {
|
|
978
|
-
const { query, config, transform: transform2, mode } = form.values;
|
|
978
|
+
const { query, config: config2, transform: transform2, mode } = form.values;
|
|
979
979
|
const afterSave = () => {
|
|
980
980
|
var _a2;
|
|
981
981
|
setVisible(false);
|
|
@@ -986,7 +986,7 @@ var __publicField = (obj, key, value) => {
|
|
|
986
986
|
};
|
|
987
987
|
const rendererProps = {
|
|
988
988
|
query,
|
|
989
|
-
config,
|
|
989
|
+
config: config2,
|
|
990
990
|
collection,
|
|
991
991
|
transform: transform2,
|
|
992
992
|
mode: mode || "builder"
|
|
@@ -1100,9 +1100,9 @@ var __publicField = (obj, key, value) => {
|
|
|
1100
1100
|
const { collection, data: data2 } = current || {};
|
|
1101
1101
|
const { service } = React.useContext(ChartRendererContext);
|
|
1102
1102
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(react.FormConsumer, { children: (form) => {
|
|
1103
|
-
const
|
|
1103
|
+
const config2 = lodash.cloneDeep(form.values.config);
|
|
1104
1104
|
const transform2 = lodash.cloneDeep(form.values.transform);
|
|
1105
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(ChartRendererContext.Provider, { value: { collection, config, transform: transform2, service, data: data2 }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(ChartRenderer, { ...props }) });
|
|
1105
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(ChartRendererContext.Provider, { value: { collection, config: config2, transform: transform2, service, data: data2 }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(ChartRenderer, { ...props }) });
|
|
1106
1106
|
} });
|
|
1107
1107
|
};
|
|
1108
1108
|
ChartConfigure.Query = function Query() {
|
|
@@ -1579,7 +1579,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1579
1579
|
};
|
|
1580
1580
|
const ChartRendererContext = React.createContext({});
|
|
1581
1581
|
const ChartRendererProvider = (props) => {
|
|
1582
|
-
const { query, config, collection, transform: transform2 } = props;
|
|
1582
|
+
const { query, config: config2, collection, transform: transform2 } = props;
|
|
1583
1583
|
const schema2 = react.useFieldSchema();
|
|
1584
1584
|
const api = client.useAPIClient();
|
|
1585
1585
|
const service = client.useRequest(
|
|
@@ -1628,7 +1628,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1628
1628
|
box-shadow: none;
|
|
1629
1629
|
}
|
|
1630
1630
|
`,
|
|
1631
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsx(ChartRendererContext.Provider, { value: { collection, config, transform: transform2, service, query }, children: props.children })
|
|
1631
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(ChartRendererContext.Provider, { value: { collection, config: config2, transform: transform2, service, query }, children: props.children })
|
|
1632
1632
|
}
|
|
1633
1633
|
) });
|
|
1634
1634
|
};
|
|
@@ -1636,14 +1636,14 @@ var __publicField = (obj, key, value) => {
|
|
|
1636
1636
|
const ChartRenderer = (props) => {
|
|
1637
1637
|
const { t } = useChartsTranslation();
|
|
1638
1638
|
const ctx2 = React.useContext(ChartRendererContext);
|
|
1639
|
-
const { config, transform: transform2, collection, service, data: _data } = ctx2;
|
|
1639
|
+
const { config: config2, transform: transform2, collection, service, data: _data } = ctx2;
|
|
1640
1640
|
const fields = useFieldsWithAssociation(collection);
|
|
1641
1641
|
const data2 = useData(_data, collection);
|
|
1642
|
-
const general = (
|
|
1643
|
-
const advanced = (
|
|
1642
|
+
const general = (config2 == null ? void 0 : config2.general) || {};
|
|
1643
|
+
const advanced = (config2 == null ? void 0 : config2.advanced) || {};
|
|
1644
1644
|
const api = client.useAPIClient();
|
|
1645
1645
|
const charts = useCharts();
|
|
1646
|
-
const chart = charts[
|
|
1646
|
+
const chart = charts[config2 == null ? void 0 : config2.chartType];
|
|
1647
1647
|
const locale = api.auth.getLocale();
|
|
1648
1648
|
const transformers2 = useFieldTransformer(transform2, locale);
|
|
1649
1649
|
const Component2 = chart == null ? void 0 : chart.render({
|
|
@@ -32388,9 +32388,9 @@ var __publicField = (obj, key, value) => {
|
|
|
32388
32388
|
return false;
|
|
32389
32389
|
}
|
|
32390
32390
|
var flag = true;
|
|
32391
|
-
var
|
|
32392
|
-
each$1(Object.keys(
|
|
32393
|
-
if (
|
|
32391
|
+
var config2 = this.cfg;
|
|
32392
|
+
each$1(Object.keys(config2), function(attr) {
|
|
32393
|
+
if (config2[attr] !== cfg[attr]) {
|
|
32394
32394
|
flag = false;
|
|
32395
32395
|
return false;
|
|
32396
32396
|
}
|
|
@@ -32398,13 +32398,13 @@ var __publicField = (obj, key, value) => {
|
|
|
32398
32398
|
return flag;
|
|
32399
32399
|
};
|
|
32400
32400
|
Shadow2.prototype.update = function(name, value2) {
|
|
32401
|
-
var
|
|
32402
|
-
|
|
32403
|
-
this._parseShadow(
|
|
32401
|
+
var config2 = this.cfg;
|
|
32402
|
+
config2[ATTR_MAP[name]] = value2;
|
|
32403
|
+
this._parseShadow(config2, this.el);
|
|
32404
32404
|
return this;
|
|
32405
32405
|
};
|
|
32406
|
-
Shadow2.prototype._parseShadow = function(
|
|
32407
|
-
var child = '<feDropShadow\n dx="' + (
|
|
32406
|
+
Shadow2.prototype._parseShadow = function(config2, el2) {
|
|
32407
|
+
var child = '<feDropShadow\n dx="' + (config2.dx || 0) + '"\n dy="' + (config2.dy || 0) + '"\n stdDeviation="' + (config2.blur ? config2.blur / 10 : 0) + '"\n flood-color="' + (config2.color ? config2.color : "#000") + '"\n flood-opacity="' + (config2.opacity ? config2.opacity : 1) + '"\n />';
|
|
32408
32408
|
el2.innerHTML = child;
|
|
32409
32409
|
};
|
|
32410
32410
|
return Shadow2;
|
|
@@ -37289,11 +37289,11 @@ var __publicField = (obj, key, value) => {
|
|
|
37289
37289
|
each$1(this.facets, function(facet) {
|
|
37290
37290
|
var columnValue = facet.columnValue, view = facet.view;
|
|
37291
37291
|
var formatter = get(_this.cfg.title, "formatter");
|
|
37292
|
-
var
|
|
37292
|
+
var config2 = deepMix({
|
|
37293
37293
|
position: ["50%", "0%"],
|
|
37294
37294
|
content: formatter ? formatter(columnValue) : columnValue
|
|
37295
37295
|
}, getFactTitleConfig(DIRECTION.TOP), _this.cfg.title);
|
|
37296
|
-
view.annotation().text(
|
|
37296
|
+
view.annotation().text(config2);
|
|
37297
37297
|
});
|
|
37298
37298
|
};
|
|
37299
37299
|
return Circle2;
|
|
@@ -37377,11 +37377,11 @@ var __publicField = (obj, key, value) => {
|
|
|
37377
37377
|
each$1(this.facets, function(facet) {
|
|
37378
37378
|
var columnValue = facet.columnValue, view = facet.view;
|
|
37379
37379
|
var formatter = get(_this.cfg.title, "formatter");
|
|
37380
|
-
var
|
|
37380
|
+
var config2 = deepMix({
|
|
37381
37381
|
position: ["50%", "0%"],
|
|
37382
37382
|
content: formatter ? formatter(columnValue) : columnValue
|
|
37383
37383
|
}, getFactTitleConfig(DIRECTION.TOP), _this.cfg.title);
|
|
37384
|
-
view.annotation().text(
|
|
37384
|
+
view.annotation().text(config2);
|
|
37385
37385
|
});
|
|
37386
37386
|
};
|
|
37387
37387
|
List2.prototype.getPageCount = function(total, pageSize) {
|
|
@@ -37468,19 +37468,19 @@ var __publicField = (obj, key, value) => {
|
|
|
37468
37468
|
var columnValue = facet.columnValue, rowValue = facet.rowValue, view = facet.view;
|
|
37469
37469
|
if (rowIndex === 0) {
|
|
37470
37470
|
var formatter = get(_this.cfg.columnTitle, "formatter");
|
|
37471
|
-
var
|
|
37471
|
+
var config2 = deepMix({
|
|
37472
37472
|
position: ["50%", "0%"],
|
|
37473
37473
|
content: formatter ? formatter(columnValue) : columnValue
|
|
37474
37474
|
}, getFactTitleConfig(DIRECTION.TOP), _this.cfg.columnTitle);
|
|
37475
|
-
view.annotation().text(
|
|
37475
|
+
view.annotation().text(config2);
|
|
37476
37476
|
}
|
|
37477
37477
|
if (columnIndex === columnValuesLength - 1) {
|
|
37478
37478
|
var formatter = get(_this.cfg.rowTitle, "formatter");
|
|
37479
|
-
var
|
|
37479
|
+
var config2 = deepMix({
|
|
37480
37480
|
position: ["100%", "50%"],
|
|
37481
37481
|
content: formatter ? formatter(rowValue) : rowValue
|
|
37482
37482
|
}, getFactTitleConfig(DIRECTION.RIGHT), _this.cfg.rowTitle);
|
|
37483
|
-
view.annotation().text(
|
|
37483
|
+
view.annotation().text(config2);
|
|
37484
37484
|
}
|
|
37485
37485
|
});
|
|
37486
37486
|
};
|
|
@@ -37583,17 +37583,17 @@ var __publicField = (obj, key, value) => {
|
|
|
37583
37583
|
var columnValue = facet.columnValue, rowValue = facet.rowValue, view = facet.view;
|
|
37584
37584
|
var formatter = get(_this.cfg.title, "formatter");
|
|
37585
37585
|
if (_this.cfg.transpose) {
|
|
37586
|
-
var
|
|
37586
|
+
var config2 = deepMix({
|
|
37587
37587
|
position: ["50%", "0%"],
|
|
37588
37588
|
content: formatter ? formatter(columnValue) : columnValue
|
|
37589
37589
|
}, getFactTitleConfig(DIRECTION.TOP), _this.cfg.title);
|
|
37590
|
-
view.annotation().text(
|
|
37590
|
+
view.annotation().text(config2);
|
|
37591
37591
|
} else {
|
|
37592
|
-
var
|
|
37592
|
+
var config2 = deepMix({
|
|
37593
37593
|
position: ["100%", "50%"],
|
|
37594
37594
|
content: formatter ? formatter(rowValue) : rowValue
|
|
37595
37595
|
}, getFactTitleConfig(DIRECTION.RIGHT), _this.cfg.title);
|
|
37596
|
-
view.annotation().text(
|
|
37596
|
+
view.annotation().text(config2);
|
|
37597
37597
|
}
|
|
37598
37598
|
});
|
|
37599
37599
|
};
|
|
@@ -37672,19 +37672,19 @@ var __publicField = (obj, key, value) => {
|
|
|
37672
37672
|
var columnIndex = facet.columnIndex, rowIndex = facet.rowIndex, columnValuesLength = facet.columnValuesLength, columnValue = facet.columnValue, rowValue = facet.rowValue, view = facet.view;
|
|
37673
37673
|
if (rowIndex === 0) {
|
|
37674
37674
|
var formatter = get(_this.cfg.columnTitle, "formatter");
|
|
37675
|
-
var
|
|
37675
|
+
var config2 = deepMix({
|
|
37676
37676
|
position: ["50%", "0%"],
|
|
37677
37677
|
content: formatter ? formatter(columnValue) : columnValue
|
|
37678
37678
|
}, getFactTitleConfig(DIRECTION.TOP), _this.cfg.columnTitle);
|
|
37679
|
-
view.annotation().text(
|
|
37679
|
+
view.annotation().text(config2);
|
|
37680
37680
|
}
|
|
37681
37681
|
if (columnIndex === columnValuesLength - 1) {
|
|
37682
37682
|
var formatter = get(_this.cfg.rowTitle, "formatter");
|
|
37683
|
-
var
|
|
37683
|
+
var config2 = deepMix({
|
|
37684
37684
|
position: ["100%", "50%"],
|
|
37685
37685
|
content: formatter ? formatter(rowValue) : rowValue
|
|
37686
37686
|
}, getFactTitleConfig(DIRECTION.RIGHT), _this.cfg.rowTitle);
|
|
37687
|
-
view.annotation().text(
|
|
37687
|
+
view.annotation().text(config2);
|
|
37688
37688
|
}
|
|
37689
37689
|
});
|
|
37690
37690
|
};
|
|
@@ -37897,11 +37897,11 @@ var __publicField = (obj, key, value) => {
|
|
|
37897
37897
|
each$1(this.facets, function(facet) {
|
|
37898
37898
|
var columnValue = facet.columnValue, view = facet.view;
|
|
37899
37899
|
var formatter = get(_this.cfg.title, "formatter");
|
|
37900
|
-
var
|
|
37900
|
+
var config2 = deepMix({
|
|
37901
37901
|
position: ["50%", "0%"],
|
|
37902
37902
|
content: formatter ? formatter(columnValue) : columnValue
|
|
37903
37903
|
}, getFactTitleConfig(DIRECTION.TOP), _this.cfg.title);
|
|
37904
|
-
view.annotation().text(
|
|
37904
|
+
view.annotation().text(config2);
|
|
37905
37905
|
});
|
|
37906
37906
|
};
|
|
37907
37907
|
Tree2.prototype.drawLines = function(facets) {
|
|
@@ -39781,8 +39781,8 @@ var __publicField = (obj, key, value) => {
|
|
|
39781
39781
|
};
|
|
39782
39782
|
};
|
|
39783
39783
|
Scrollbar2.prototype.updateScrollbar = function() {
|
|
39784
|
-
var
|
|
39785
|
-
var realConfig = this.trackLen ? __assign$4(__assign$4({},
|
|
39784
|
+
var config2 = this.getScrollbarComponentCfg();
|
|
39785
|
+
var realConfig = this.trackLen ? __assign$4(__assign$4({}, config2), { trackLen: this.trackLen, thumbLen: this.thumbLen, thumbOffset: (this.trackLen - this.thumbLen) * this.ratio }) : __assign$4({}, config2);
|
|
39786
39786
|
this.scrollbar.component.update(realConfig);
|
|
39787
39787
|
return this.scrollbar;
|
|
39788
39788
|
};
|
|
@@ -42472,28 +42472,28 @@ var __publicField = (obj, key, value) => {
|
|
|
42472
42472
|
return deepMix(this.buttonCfg, this.cfg);
|
|
42473
42473
|
};
|
|
42474
42474
|
ButtonAction2.prototype.drawButton = function() {
|
|
42475
|
-
var
|
|
42475
|
+
var config2 = this.getButtonCfg();
|
|
42476
42476
|
var group2 = this.context.view.foregroundGroup.addGroup({
|
|
42477
|
-
name:
|
|
42477
|
+
name: config2.name
|
|
42478
42478
|
});
|
|
42479
42479
|
var textShape = group2.addShape({
|
|
42480
42480
|
type: "text",
|
|
42481
42481
|
name: "button-text",
|
|
42482
|
-
attrs: __assign$4({ text:
|
|
42482
|
+
attrs: __assign$4({ text: config2.text }, config2.textStyle)
|
|
42483
42483
|
});
|
|
42484
42484
|
var textBBox = textShape.getBBox();
|
|
42485
|
-
var padding2 = parsePadding(
|
|
42485
|
+
var padding2 = parsePadding(config2.padding);
|
|
42486
42486
|
var buttonShape = group2.addShape({
|
|
42487
42487
|
type: "rect",
|
|
42488
42488
|
name: "button-rect",
|
|
42489
|
-
attrs: __assign$4({ x: textBBox.x - padding2[3], y: textBBox.y - padding2[0], width: textBBox.width + padding2[1] + padding2[3], height: textBBox.height + padding2[0] + padding2[2] },
|
|
42489
|
+
attrs: __assign$4({ x: textBBox.x - padding2[3], y: textBBox.y - padding2[0], width: textBBox.width + padding2[1] + padding2[3], height: textBBox.height + padding2[0] + padding2[2] }, config2.style)
|
|
42490
42490
|
});
|
|
42491
42491
|
buttonShape.toBack();
|
|
42492
42492
|
group2.on("mouseenter", function() {
|
|
42493
|
-
buttonShape.attr(
|
|
42493
|
+
buttonShape.attr(config2.activeStyle);
|
|
42494
42494
|
});
|
|
42495
42495
|
group2.on("mouseleave", function() {
|
|
42496
|
-
buttonShape.attr(
|
|
42496
|
+
buttonShape.attr(config2.style);
|
|
42497
42497
|
});
|
|
42498
42498
|
this.buttonGroup = group2;
|
|
42499
42499
|
};
|
|
@@ -45529,9 +45529,9 @@ var __publicField = (obj, key, value) => {
|
|
|
45529
45529
|
return deepAssign(this.buttonCfg, buttonCfg, this.cfg);
|
|
45530
45530
|
};
|
|
45531
45531
|
ButtonAction2.prototype.drawButton = function() {
|
|
45532
|
-
var
|
|
45532
|
+
var config2 = this.getButtonCfg();
|
|
45533
45533
|
var group2 = this.context.view.foregroundGroup.addGroup({
|
|
45534
|
-
name:
|
|
45534
|
+
name: config2.name
|
|
45535
45535
|
});
|
|
45536
45536
|
var textShape = this.drawText(group2);
|
|
45537
45537
|
this.drawBackground(group2, textShape.getBBox());
|
|
@@ -45539,30 +45539,30 @@ var __publicField = (obj, key, value) => {
|
|
|
45539
45539
|
};
|
|
45540
45540
|
ButtonAction2.prototype.drawText = function(group2) {
|
|
45541
45541
|
var _a2;
|
|
45542
|
-
var
|
|
45542
|
+
var config2 = this.getButtonCfg();
|
|
45543
45543
|
return group2.addShape({
|
|
45544
45544
|
type: "text",
|
|
45545
45545
|
name: "button-text",
|
|
45546
|
-
attrs: __assign$4({ text:
|
|
45546
|
+
attrs: __assign$4({ text: config2.text }, (_a2 = config2.textStyle) === null || _a2 === void 0 ? void 0 : _a2.default)
|
|
45547
45547
|
});
|
|
45548
45548
|
};
|
|
45549
45549
|
ButtonAction2.prototype.drawBackground = function(group2, bbox) {
|
|
45550
45550
|
var _a2;
|
|
45551
|
-
var
|
|
45552
|
-
var padding2 = normalPadding(
|
|
45551
|
+
var config2 = this.getButtonCfg();
|
|
45552
|
+
var padding2 = normalPadding(config2.padding);
|
|
45553
45553
|
var buttonShape = group2.addShape({
|
|
45554
45554
|
type: "rect",
|
|
45555
45555
|
name: "button-rect",
|
|
45556
|
-
attrs: __assign$4({ x: bbox.x - padding2[3], y: bbox.y - padding2[0], width: bbox.width + padding2[1] + padding2[3], height: bbox.height + padding2[0] + padding2[2] }, (_a2 =
|
|
45556
|
+
attrs: __assign$4({ x: bbox.x - padding2[3], y: bbox.y - padding2[0], width: bbox.width + padding2[1] + padding2[3], height: bbox.height + padding2[0] + padding2[2] }, (_a2 = config2.buttonStyle) === null || _a2 === void 0 ? void 0 : _a2.default)
|
|
45557
45557
|
});
|
|
45558
45558
|
buttonShape.toBack();
|
|
45559
45559
|
group2.on("mouseenter", function() {
|
|
45560
45560
|
var _a3;
|
|
45561
|
-
buttonShape.attr((_a3 =
|
|
45561
|
+
buttonShape.attr((_a3 = config2.buttonStyle) === null || _a3 === void 0 ? void 0 : _a3.active);
|
|
45562
45562
|
});
|
|
45563
45563
|
group2.on("mouseleave", function() {
|
|
45564
45564
|
var _a3;
|
|
45565
|
-
buttonShape.attr((_a3 =
|
|
45565
|
+
buttonShape.attr((_a3 = config2.buttonStyle) === null || _a3 === void 0 ? void 0 : _a3.default);
|
|
45566
45566
|
});
|
|
45567
45567
|
return buttonShape;
|
|
45568
45568
|
};
|
|
@@ -46051,8 +46051,8 @@ var __publicField = (obj, key, value) => {
|
|
|
46051
46051
|
return coordinate2.convertPoint(point2);
|
|
46052
46052
|
});
|
|
46053
46053
|
}
|
|
46054
|
-
function renderArrowTag(
|
|
46055
|
-
var view =
|
|
46054
|
+
function renderArrowTag(config2, elemPrev, elemNext) {
|
|
46055
|
+
var view = config2.view, geometry2 = config2.geometry, group2 = config2.group, options = config2.options, horizontal = config2.horizontal;
|
|
46056
46056
|
var offset = options.offset, size2 = options.size, arrow = options.arrow;
|
|
46057
46057
|
var coordinate2 = view.getCoordinate();
|
|
46058
46058
|
var pointPrev = parsePoints(coordinate2, elemPrev)[3];
|
|
@@ -46110,9 +46110,9 @@ var __publicField = (obj, key, value) => {
|
|
|
46110
46110
|
attrs: __assign$4(__assign$4({}, arrow.style || {}), { points: points2 })
|
|
46111
46111
|
});
|
|
46112
46112
|
}
|
|
46113
|
-
function renderTextTag(
|
|
46113
|
+
function renderTextTag(config2, elemPrev, elemNext) {
|
|
46114
46114
|
var _a2, _b, _c;
|
|
46115
|
-
var view =
|
|
46115
|
+
var view = config2.view, geometry2 = config2.geometry, group2 = config2.group, options = config2.options, field2 = config2.field, horizontal = config2.horizontal;
|
|
46116
46116
|
var offset = options.offset, size2 = options.size;
|
|
46117
46117
|
if (typeof options.text === "boolean") {
|
|
46118
46118
|
return;
|
|
@@ -46168,7 +46168,7 @@ var __publicField = (obj, key, value) => {
|
|
|
46168
46168
|
var interval2 = find$1(chart.geometries, function(geom) {
|
|
46169
46169
|
return geom.type === "interval";
|
|
46170
46170
|
});
|
|
46171
|
-
var
|
|
46171
|
+
var config2 = {
|
|
46172
46172
|
view,
|
|
46173
46173
|
geometry: interval2,
|
|
46174
46174
|
group: group2,
|
|
@@ -46179,7 +46179,7 @@ var __publicField = (obj, key, value) => {
|
|
|
46179
46179
|
var elements = interval2.elements;
|
|
46180
46180
|
each$1(elements, function(elem, idx) {
|
|
46181
46181
|
if (idx > 0) {
|
|
46182
|
-
renderTag(
|
|
46182
|
+
renderTag(config2, elements[idx - 1], elem);
|
|
46183
46183
|
}
|
|
46184
46184
|
});
|
|
46185
46185
|
}
|
|
@@ -46604,7 +46604,7 @@ var __publicField = (obj, key, value) => {
|
|
|
46604
46604
|
return params;
|
|
46605
46605
|
};
|
|
46606
46606
|
}
|
|
46607
|
-
function field$
|
|
46607
|
+
function field$5(params) {
|
|
46608
46608
|
var chart = params.chart, options = params.options;
|
|
46609
46609
|
var _a2 = options.data, data2 = _a2 === void 0 ? [] : _a2, yField = options.yField, maxSize = options.maxSize, minSize = options.minSize;
|
|
46610
46610
|
var formatData = transformData$8(data2, data2, {
|
|
@@ -46666,9 +46666,9 @@ var __publicField = (obj, key, value) => {
|
|
|
46666
46666
|
return params;
|
|
46667
46667
|
}
|
|
46668
46668
|
function basicFunnel(params) {
|
|
46669
|
-
return flow(field$
|
|
46669
|
+
return flow(field$5, geometry$s, transpose$1, conversionTag$2)(params);
|
|
46670
46670
|
}
|
|
46671
|
-
function field$
|
|
46671
|
+
function field$4(params) {
|
|
46672
46672
|
var _a2;
|
|
46673
46673
|
var chart = params.chart, options = params.options;
|
|
46674
46674
|
var _b = options.data, data2 = _b === void 0 ? [] : _b, yField = options.yField;
|
|
@@ -46775,9 +46775,9 @@ var __publicField = (obj, key, value) => {
|
|
|
46775
46775
|
return params;
|
|
46776
46776
|
}
|
|
46777
46777
|
function compareFunnel(params) {
|
|
46778
|
-
return flow(field$
|
|
46778
|
+
return flow(field$4, geometry$r, conversionTag$1)(params);
|
|
46779
46779
|
}
|
|
46780
|
-
function field$
|
|
46780
|
+
function field$3(params) {
|
|
46781
46781
|
var chart = params.chart, options = params.options;
|
|
46782
46782
|
var _a2 = options.data, data2 = _a2 === void 0 ? [] : _a2, yField = options.yField;
|
|
46783
46783
|
var sum = reduce(data2, function(total, item) {
|
|
@@ -46854,9 +46854,9 @@ var __publicField = (obj, key, value) => {
|
|
|
46854
46854
|
return params;
|
|
46855
46855
|
}
|
|
46856
46856
|
function dynamicHeightFunnel(params) {
|
|
46857
|
-
return flow(field$
|
|
46857
|
+
return flow(field$3, geometry$q, transpose, conversionTag)(params);
|
|
46858
46858
|
}
|
|
46859
|
-
function field$
|
|
46859
|
+
function field$2(params) {
|
|
46860
46860
|
var _a2;
|
|
46861
46861
|
var chart = params.chart, options = params.options;
|
|
46862
46862
|
var _b = options.data, data2 = _b === void 0 ? [] : _b, yField = options.yField;
|
|
@@ -46885,7 +46885,7 @@ var __publicField = (obj, key, value) => {
|
|
|
46885
46885
|
return params;
|
|
46886
46886
|
}
|
|
46887
46887
|
function facetFunnel(params) {
|
|
46888
|
-
return flow(field$
|
|
46888
|
+
return flow(field$2, geometry$p)(params);
|
|
46889
46889
|
}
|
|
46890
46890
|
var ConversionTagAction = (
|
|
46891
46891
|
/** @class */
|
|
@@ -48986,8 +48986,8 @@ var __publicField = (obj, key, value) => {
|
|
|
48986
48986
|
};
|
|
48987
48987
|
return defaultConfig;
|
|
48988
48988
|
}
|
|
48989
|
-
var splinePath = function(data2,
|
|
48990
|
-
var view =
|
|
48989
|
+
var splinePath = function(data2, config2) {
|
|
48990
|
+
var view = config2.view, _a2 = config2.options, xField = _a2.xField, yField = _a2.yField;
|
|
48991
48991
|
var xScaleView = view.getScaleByField(xField);
|
|
48992
48992
|
var yScaleView = view.getScaleByField(yField);
|
|
48993
48993
|
var pathData = data2.map(function(d) {
|
|
@@ -48995,8 +48995,8 @@ var __publicField = (obj, key, value) => {
|
|
|
48995
48995
|
});
|
|
48996
48996
|
return getSplinePath(pathData, false);
|
|
48997
48997
|
};
|
|
48998
|
-
var getPath = function(
|
|
48999
|
-
var options =
|
|
48998
|
+
var getPath = function(config2) {
|
|
48999
|
+
var options = config2.options;
|
|
49000
49000
|
var xField = options.xField, yField = options.yField, data2 = options.data, regressionLine2 = options.regressionLine;
|
|
49001
49001
|
var _a2 = regressionLine2.type, type = _a2 === void 0 ? "linear" : _a2, algorithm = regressionLine2.algorithm, customEquation = regressionLine2.equation;
|
|
49002
49002
|
var pathData;
|
|
@@ -49013,7 +49013,7 @@ var __publicField = (obj, key, value) => {
|
|
|
49013
49013
|
pathData = reg(data2);
|
|
49014
49014
|
equation = getRegressionEquation(type, pathData);
|
|
49015
49015
|
}
|
|
49016
|
-
return [splinePath(pathData,
|
|
49016
|
+
return [splinePath(pathData, config2), equation];
|
|
49017
49017
|
};
|
|
49018
49018
|
var getMeta = function(options) {
|
|
49019
49019
|
var _a2;
|
|
@@ -50409,7 +50409,7 @@ var __publicField = (obj, key, value) => {
|
|
|
50409
50409
|
}
|
|
50410
50410
|
return newData;
|
|
50411
50411
|
};
|
|
50412
|
-
function field(params) {
|
|
50412
|
+
function field$1(params) {
|
|
50413
50413
|
var chart = params.chart, options = params.options;
|
|
50414
50414
|
var xField = options.xField, yField = options.yField, groupField = options.groupField, color2 = options.color, tooltip2 = options.tooltip, boxStyle = options.boxStyle;
|
|
50415
50415
|
chart.data(transformData$6(options.data, yField));
|
|
@@ -50512,7 +50512,7 @@ var __publicField = (obj, key, value) => {
|
|
|
50512
50512
|
return params;
|
|
50513
50513
|
}
|
|
50514
50514
|
function adaptor$h(params) {
|
|
50515
|
-
return flow(field, outliersPoint, meta$b, axis$d, legend$9, tooltip$9, annotation$2(), interaction$8, animation$5, theme$2)(params);
|
|
50515
|
+
return flow(field$1, outliersPoint, meta$b, axis$d, legend$9, tooltip$9, annotation$2(), interaction$8, animation$5, theme$2)(params);
|
|
50516
50516
|
}
|
|
50517
50517
|
(function(_super) {
|
|
50518
50518
|
__extends$2(Box, _super);
|
|
@@ -51239,7 +51239,7 @@ var __publicField = (obj, key, value) => {
|
|
|
51239
51239
|
};
|
|
51240
51240
|
DrillDownAction2.prototype.drawBreadCrumbGroup = function() {
|
|
51241
51241
|
var _this = this;
|
|
51242
|
-
var
|
|
51242
|
+
var config2 = this.getButtonCfg();
|
|
51243
51243
|
var cache2 = this.historyCache;
|
|
51244
51244
|
if (!this.breadCrumbGroup) {
|
|
51245
51245
|
this.breadCrumbGroup = this.context.view.foregroundGroup.addGroup({
|
|
@@ -51254,7 +51254,7 @@ var __publicField = (obj, key, value) => {
|
|
|
51254
51254
|
type: "text",
|
|
51255
51255
|
id: record.id,
|
|
51256
51256
|
name: "".concat(BREAD_CRUMB_NAME, "_").concat(record.name, "_text"),
|
|
51257
|
-
attrs: __assign$4(__assign$4({ text: index2 === 0 && !isNil(
|
|
51257
|
+
attrs: __assign$4(__assign$4({ text: index2 === 0 && !isNil(config2.rootText) ? config2.rootText : record.name }, config2.textStyle), { x: left2, y: 0 })
|
|
51258
51258
|
});
|
|
51259
51259
|
var textShapeBox = textShape.getBBox();
|
|
51260
51260
|
left2 += textShapeBox.width + PADDING;
|
|
@@ -51272,19 +51272,19 @@ var __publicField = (obj, key, value) => {
|
|
|
51272
51272
|
var _a2;
|
|
51273
51273
|
var targetId = event.target.get("id");
|
|
51274
51274
|
if (targetId !== ((_a2 = last(cache2)) === null || _a2 === void 0 ? void 0 : _a2.id)) {
|
|
51275
|
-
textShape.attr(
|
|
51275
|
+
textShape.attr(config2.activeTextStyle);
|
|
51276
51276
|
} else {
|
|
51277
51277
|
textShape.attr({ cursor: "default" });
|
|
51278
51278
|
}
|
|
51279
51279
|
});
|
|
51280
51280
|
textShape.on("mouseleave", function() {
|
|
51281
|
-
textShape.attr(
|
|
51281
|
+
textShape.attr(config2.textStyle);
|
|
51282
51282
|
});
|
|
51283
51283
|
if (index2 < cache2.length - 1) {
|
|
51284
51284
|
var dividerShape = _this.breadCrumbGroup.addShape({
|
|
51285
51285
|
type: "text",
|
|
51286
|
-
name: "".concat(
|
|
51287
|
-
attrs: __assign$4(__assign$4({ text:
|
|
51286
|
+
name: "".concat(config2.name, "_").concat(record.name, "_divider"),
|
|
51287
|
+
attrs: __assign$4(__assign$4({ text: config2.dividerText }, config2.textStyle), { x: left2, y: 0 })
|
|
51288
51288
|
});
|
|
51289
51289
|
var dividerBox = dividerShape.getBBox();
|
|
51290
51290
|
left2 += dividerBox.width + PADDING;
|
|
@@ -66430,11 +66430,11 @@ var __publicField = (obj, key, value) => {
|
|
|
66430
66430
|
}
|
|
66431
66431
|
return t;
|
|
66432
66432
|
};
|
|
66433
|
-
function useInit(ChartClass,
|
|
66433
|
+
function useInit(ChartClass, config2) {
|
|
66434
66434
|
var chart = React.useRef();
|
|
66435
66435
|
var chartOptions = React.useRef();
|
|
66436
66436
|
var container = React.useRef(null);
|
|
66437
|
-
var onReady =
|
|
66437
|
+
var onReady = config2.onReady, onEvent = config2.onEvent;
|
|
66438
66438
|
var toDataURL = function(type, encoderOptions) {
|
|
66439
66439
|
var _a2;
|
|
66440
66440
|
if (type === void 0) {
|
|
@@ -66480,23 +66480,23 @@ var __publicField = (obj, key, value) => {
|
|
|
66480
66480
|
};
|
|
66481
66481
|
var processConfig = function() {
|
|
66482
66482
|
var _uuid = uuid();
|
|
66483
|
-
if (hasPath(
|
|
66484
|
-
reactDomToString(
|
|
66483
|
+
if (hasPath(config2, ["statistic", "content", "customHtml"])) {
|
|
66484
|
+
reactDomToString(config2, ["statistic", "content", "customHtml"]);
|
|
66485
66485
|
}
|
|
66486
|
-
if (hasPath(
|
|
66487
|
-
reactDomToString(
|
|
66486
|
+
if (hasPath(config2, ["statistic", "title", "customHtml"])) {
|
|
66487
|
+
reactDomToString(config2, ["statistic", "title", "customHtml"]);
|
|
66488
66488
|
}
|
|
66489
|
-
if (typeof
|
|
66490
|
-
if (hasPath(
|
|
66491
|
-
reactDomToString(
|
|
66489
|
+
if (typeof config2.tooltip === "object") {
|
|
66490
|
+
if (hasPath(config2, ["tooltip", "container"])) {
|
|
66491
|
+
reactDomToString(config2, ["tooltip", "container"], "tooltip", _uuid);
|
|
66492
66492
|
}
|
|
66493
|
-
if (hasPath(
|
|
66494
|
-
reactDomToString(
|
|
66493
|
+
if (hasPath(config2, ["tooltip", "customContent"])) {
|
|
66494
|
+
reactDomToString(config2, ["tooltip", "customContent"], "tooltip", _uuid);
|
|
66495
66495
|
}
|
|
66496
66496
|
}
|
|
66497
66497
|
};
|
|
66498
66498
|
React.useEffect(function() {
|
|
66499
|
-
if (chart.current && !isEqual$1(chartOptions.current,
|
|
66499
|
+
if (chart.current && !isEqual$1(chartOptions.current, config2)) {
|
|
66500
66500
|
var changeData = false;
|
|
66501
66501
|
if (chartOptions.current) {
|
|
66502
66502
|
var _a2 = chartOptions.current;
|
|
@@ -66504,30 +66504,30 @@ var __publicField = (obj, key, value) => {
|
|
|
66504
66504
|
_a2.value;
|
|
66505
66505
|
_a2.percent;
|
|
66506
66506
|
var currentConfig = __rest$8(_a2, ["data", "value", "percent"]);
|
|
66507
|
-
|
|
66508
|
-
|
|
66509
|
-
|
|
66510
|
-
var inputConfig = __rest$8(
|
|
66507
|
+
config2.data;
|
|
66508
|
+
config2.value;
|
|
66509
|
+
config2.percent;
|
|
66510
|
+
var inputConfig = __rest$8(config2, ["data", "value", "percent"]);
|
|
66511
66511
|
changeData = isEqual$1(currentConfig, inputConfig);
|
|
66512
66512
|
}
|
|
66513
|
-
chartOptions.current = deepClone(
|
|
66514
|
-
if (changeData && get(
|
|
66513
|
+
chartOptions.current = deepClone(config2);
|
|
66514
|
+
if (changeData && get(config2, "chartType") !== "Mix") {
|
|
66515
66515
|
var changeType_1 = "data";
|
|
66516
66516
|
var typeMaps = ["percent"];
|
|
66517
|
-
var currentKeys_1 = Object.keys(
|
|
66517
|
+
var currentKeys_1 = Object.keys(config2);
|
|
66518
66518
|
typeMaps.forEach(function(type) {
|
|
66519
66519
|
if (currentKeys_1.includes(type)) {
|
|
66520
66520
|
changeType_1 = type;
|
|
66521
66521
|
}
|
|
66522
66522
|
});
|
|
66523
|
-
chart.current.changeData((
|
|
66523
|
+
chart.current.changeData((config2 === null || config2 === void 0 ? void 0 : config2[changeType_1]) || []);
|
|
66524
66524
|
chart.current.render();
|
|
66525
66525
|
} else {
|
|
66526
66526
|
processConfig();
|
|
66527
|
-
chart.current.update(
|
|
66527
|
+
chart.current.update(config2);
|
|
66528
66528
|
}
|
|
66529
66529
|
}
|
|
66530
|
-
}, [
|
|
66530
|
+
}, [config2]);
|
|
66531
66531
|
React.useEffect(function() {
|
|
66532
66532
|
if (!container.current) {
|
|
66533
66533
|
return function() {
|
|
@@ -66535,10 +66535,10 @@ var __publicField = (obj, key, value) => {
|
|
|
66535
66535
|
};
|
|
66536
66536
|
}
|
|
66537
66537
|
if (!chartOptions.current) {
|
|
66538
|
-
chartOptions.current = deepClone(
|
|
66538
|
+
chartOptions.current = deepClone(config2);
|
|
66539
66539
|
}
|
|
66540
66540
|
processConfig();
|
|
66541
|
-
var chartInstance = new ChartClass(container.current, __assign$1({},
|
|
66541
|
+
var chartInstance = new ChartClass(container.current, __assign$1({}, config2));
|
|
66542
66542
|
chartInstance.toDataURL = function(type, encoderOptions) {
|
|
66543
66543
|
return toDataURL(type, encoderOptions);
|
|
66544
66544
|
};
|
|
@@ -67019,15 +67019,89 @@ var __publicField = (obj, key, value) => {
|
|
|
67019
67019
|
);
|
|
67020
67020
|
});
|
|
67021
67021
|
const G2DualAxes = DualAxesChart;
|
|
67022
|
+
const selectField = ({ name, title, required: required2, defaultValue }) => {
|
|
67023
|
+
return {
|
|
67024
|
+
[name]: {
|
|
67025
|
+
title: lang(title),
|
|
67026
|
+
type: "string",
|
|
67027
|
+
"x-decorator": "FormItem",
|
|
67028
|
+
"x-component": "Select",
|
|
67029
|
+
"x-reactions": "{{ useChartFields }}",
|
|
67030
|
+
required: required2,
|
|
67031
|
+
default: defaultValue
|
|
67032
|
+
}
|
|
67033
|
+
};
|
|
67034
|
+
};
|
|
67035
|
+
const booleanField$1 = ({ name, title, defaultValue = false }) => {
|
|
67036
|
+
return {
|
|
67037
|
+
[name]: {
|
|
67038
|
+
"x-content": lang(title),
|
|
67039
|
+
type: "boolean",
|
|
67040
|
+
"x-decorator": "FormItem",
|
|
67041
|
+
"x-component": "Checkbox",
|
|
67042
|
+
default: defaultValue
|
|
67043
|
+
}
|
|
67044
|
+
};
|
|
67045
|
+
};
|
|
67046
|
+
const config = {
|
|
67047
|
+
field: selectField,
|
|
67048
|
+
booleanField: booleanField$1
|
|
67049
|
+
};
|
|
67022
67050
|
class Chart {
|
|
67023
|
-
constructor(name, title, component2) {
|
|
67051
|
+
constructor({ name, title, component: component2, config: config$1 }) {
|
|
67024
67052
|
__publicField(this, "name");
|
|
67025
67053
|
__publicField(this, "title");
|
|
67026
67054
|
__publicField(this, "component");
|
|
67027
|
-
__publicField(this, "
|
|
67055
|
+
__publicField(this, "config");
|
|
67056
|
+
__publicField(this, "configs", /* @__PURE__ */ new Map());
|
|
67028
67057
|
this.name = name;
|
|
67029
67058
|
this.title = title;
|
|
67030
67059
|
this.component = component2;
|
|
67060
|
+
this.config = config$1;
|
|
67061
|
+
this.addConfigs(config);
|
|
67062
|
+
}
|
|
67063
|
+
/*
|
|
67064
|
+
* Generate config schema according to this.config
|
|
67065
|
+
* How to set up this.config:
|
|
67066
|
+
* 1. string - the config function name in config.ts
|
|
67067
|
+
* 2. object - { property: string, ...props }
|
|
67068
|
+
* - property is the config function name in config.ts, and the other props are the arguments of the function
|
|
67069
|
+
* 3. object - use the object directly as the properties of the schema
|
|
67070
|
+
* 4. function - use the custom function to return the properties of the schema
|
|
67071
|
+
*/
|
|
67072
|
+
get schema() {
|
|
67073
|
+
if (!this.config) {
|
|
67074
|
+
return {};
|
|
67075
|
+
}
|
|
67076
|
+
const properties = this.config.reduce((properties2, conf) => {
|
|
67077
|
+
let schema2 = {};
|
|
67078
|
+
if (typeof conf === "string") {
|
|
67079
|
+
const func = this.configs.get(conf);
|
|
67080
|
+
schema2 = (func == null ? void 0 : func()) || {};
|
|
67081
|
+
} else if (typeof conf === "function") {
|
|
67082
|
+
schema2 = conf();
|
|
67083
|
+
} else {
|
|
67084
|
+
if (conf.property) {
|
|
67085
|
+
const func = this.configs.get(conf.property);
|
|
67086
|
+
schema2 = (func == null ? void 0 : func(conf)) || {};
|
|
67087
|
+
} else {
|
|
67088
|
+
schema2 = conf;
|
|
67089
|
+
}
|
|
67090
|
+
}
|
|
67091
|
+
return {
|
|
67092
|
+
...properties2,
|
|
67093
|
+
...schema2
|
|
67094
|
+
};
|
|
67095
|
+
}, {});
|
|
67096
|
+
return {
|
|
67097
|
+
type: "object",
|
|
67098
|
+
properties
|
|
67099
|
+
};
|
|
67100
|
+
}
|
|
67101
|
+
addConfigs(configs2) {
|
|
67102
|
+
Object.entries(configs2).forEach(([key, func]) => {
|
|
67103
|
+
this.configs.set(key, func);
|
|
67104
|
+
});
|
|
67031
67105
|
}
|
|
67032
67106
|
infer(fields, {
|
|
67033
67107
|
measures,
|
|
@@ -67080,37 +67154,25 @@ var __publicField = (obj, key, value) => {
|
|
|
67080
67154
|
});
|
|
67081
67155
|
}
|
|
67082
67156
|
}
|
|
67157
|
+
const { field, booleanField } = config;
|
|
67158
|
+
const configs = {
|
|
67159
|
+
xField: (props) => field({ name: "xField", title: "xField", required: true, ...props }),
|
|
67160
|
+
yField: (props) => field({ name: "yField", title: "yField", required: true, ...props }),
|
|
67161
|
+
seriesField: (props) => field({ name: "seriesField", title: "seriesField", ...props }),
|
|
67162
|
+
isStack: (props) => booleanField({ name: "isStack", title: "isStack", ...props }),
|
|
67163
|
+
smooth: (props) => booleanField({ name: "smooth", title: "smooth", ...props }),
|
|
67164
|
+
isPercent: (props) => booleanField({ name: "isPercent", title: "isPercent", ...props }),
|
|
67165
|
+
isGroup: (props) => booleanField({ name: "isGroup", title: "isGroup", ...props })
|
|
67166
|
+
};
|
|
67083
67167
|
class G2PlotChart extends Chart {
|
|
67084
|
-
constructor() {
|
|
67085
|
-
super(
|
|
67086
|
-
|
|
67087
|
-
|
|
67088
|
-
|
|
67089
|
-
|
|
67090
|
-
title: '{{t("xField")}}',
|
|
67091
|
-
type: "string",
|
|
67092
|
-
"x-decorator": "FormItem",
|
|
67093
|
-
"x-component": "Select",
|
|
67094
|
-
"x-reactions": "{{ useChartFields }}",
|
|
67095
|
-
required: true
|
|
67096
|
-
},
|
|
67097
|
-
yField: {
|
|
67098
|
-
title: '{{t("yField")}}',
|
|
67099
|
-
type: "string",
|
|
67100
|
-
"x-decorator": "FormItem",
|
|
67101
|
-
"x-component": "Select",
|
|
67102
|
-
"x-reactions": "{{ useChartFields }}",
|
|
67103
|
-
required: true
|
|
67104
|
-
},
|
|
67105
|
-
seriesField: {
|
|
67106
|
-
title: '{{t("seriesField")}}',
|
|
67107
|
-
type: "string",
|
|
67108
|
-
"x-decorator": "FormItem",
|
|
67109
|
-
"x-component": "Select",
|
|
67110
|
-
"x-reactions": "{{ useChartFields }}"
|
|
67111
|
-
}
|
|
67112
|
-
}
|
|
67168
|
+
constructor({ name, title, component: component2, config: config2 }) {
|
|
67169
|
+
super({
|
|
67170
|
+
name,
|
|
67171
|
+
title,
|
|
67172
|
+
component: component2,
|
|
67173
|
+
config: ["xField", "yField", "seriesField", ...config2 || []]
|
|
67113
67174
|
});
|
|
67175
|
+
this.addConfigs(configs);
|
|
67114
67176
|
}
|
|
67115
67177
|
init(fields, {
|
|
67116
67178
|
measures,
|
|
@@ -67141,7 +67203,7 @@ var __publicField = (obj, key, value) => {
|
|
|
67141
67203
|
obj[key] = value2;
|
|
67142
67204
|
if (key.includes("Field")) {
|
|
67143
67205
|
if (Array.isArray(value2)) {
|
|
67144
|
-
obj[key] = value2.map((v2) => v2.includes(".") ? replace(v2) : v2);
|
|
67206
|
+
obj[key] = value2.map((v2) => (v2 == null ? void 0 : v2.includes(".")) ? replace(v2) : v2);
|
|
67145
67207
|
} else if (typeof value2 === "string" && value2.includes(".")) {
|
|
67146
67208
|
obj[key] = replace(value2);
|
|
67147
67209
|
}
|
|
@@ -67168,13 +67230,13 @@ var __publicField = (obj, key, value) => {
|
|
|
67168
67230
|
getReference() {
|
|
67169
67231
|
return {
|
|
67170
67232
|
title: this.title,
|
|
67171
|
-
link: `https://
|
|
67233
|
+
link: `https://charts.ant.design/api/plots/${this.name}`
|
|
67172
67234
|
};
|
|
67173
67235
|
}
|
|
67174
67236
|
}
|
|
67175
67237
|
class Bar extends G2PlotChart {
|
|
67176
67238
|
constructor() {
|
|
67177
|
-
super("bar", "Bar Chart", G2PlotBar);
|
|
67239
|
+
super({ name: "bar", title: "Bar Chart", component: G2PlotBar, config: ["isGroup", "isStack", "isPercent"] });
|
|
67178
67240
|
}
|
|
67179
67241
|
init(fields, {
|
|
67180
67242
|
measures,
|
|
@@ -67192,28 +67254,21 @@ var __publicField = (obj, key, value) => {
|
|
|
67192
67254
|
}
|
|
67193
67255
|
class Pie extends G2PlotChart {
|
|
67194
67256
|
constructor() {
|
|
67195
|
-
super("pie", "Pie Chart", G2Pie);
|
|
67196
|
-
|
|
67197
|
-
|
|
67198
|
-
|
|
67199
|
-
|
|
67200
|
-
|
|
67201
|
-
|
|
67202
|
-
|
|
67203
|
-
|
|
67204
|
-
|
|
67205
|
-
|
|
67206
|
-
|
|
67207
|
-
|
|
67208
|
-
title: '{{t("colorField")}}',
|
|
67209
|
-
type: "string",
|
|
67210
|
-
"x-decorator": "FormItem",
|
|
67211
|
-
"x-component": "Select",
|
|
67212
|
-
"x-reactions": "{{ useChartFields }}",
|
|
67213
|
-
required: true
|
|
67214
|
-
}
|
|
67257
|
+
super({ name: "pie", title: "Pie Chart", component: G2Pie });
|
|
67258
|
+
this.config = [
|
|
67259
|
+
{
|
|
67260
|
+
property: "field",
|
|
67261
|
+
name: "angleField",
|
|
67262
|
+
title: "angleField",
|
|
67263
|
+
required: true
|
|
67264
|
+
},
|
|
67265
|
+
{
|
|
67266
|
+
property: "field",
|
|
67267
|
+
name: "colorField",
|
|
67268
|
+
title: "colorField",
|
|
67269
|
+
required: true
|
|
67215
67270
|
}
|
|
67216
|
-
|
|
67271
|
+
];
|
|
67217
67272
|
}
|
|
67218
67273
|
init(fields, {
|
|
67219
67274
|
measures,
|
|
@@ -67230,18 +67285,10 @@ var __publicField = (obj, key, value) => {
|
|
|
67230
67285
|
}
|
|
67231
67286
|
class DualAxes extends G2PlotChart {
|
|
67232
67287
|
constructor() {
|
|
67233
|
-
super("dualAxes", "Dual Axes Chart", G2DualAxes);
|
|
67234
|
-
|
|
67235
|
-
|
|
67236
|
-
|
|
67237
|
-
xField: {
|
|
67238
|
-
title: '{{t("xField")}}',
|
|
67239
|
-
type: "string",
|
|
67240
|
-
"x-decorator": "FormItem",
|
|
67241
|
-
"x-component": "Select",
|
|
67242
|
-
"x-reactions": "{{ useChartFields }}",
|
|
67243
|
-
required: true
|
|
67244
|
-
},
|
|
67288
|
+
super({ name: "dualAxes", title: "Dual Axes Chart", component: G2DualAxes });
|
|
67289
|
+
this.config = [
|
|
67290
|
+
"xField",
|
|
67291
|
+
{
|
|
67245
67292
|
yField: {
|
|
67246
67293
|
title: '{{t("yField")}}',
|
|
67247
67294
|
type: "array",
|
|
@@ -67284,7 +67331,7 @@ var __publicField = (obj, key, value) => {
|
|
|
67284
67331
|
}
|
|
67285
67332
|
}
|
|
67286
67333
|
}
|
|
67287
|
-
|
|
67334
|
+
];
|
|
67288
67335
|
}
|
|
67289
67336
|
init(fields, {
|
|
67290
67337
|
measures,
|
|
@@ -67308,13 +67355,35 @@ var __publicField = (obj, key, value) => {
|
|
|
67308
67355
|
}
|
|
67309
67356
|
}
|
|
67310
67357
|
const g2plot = [
|
|
67311
|
-
new G2PlotChart(
|
|
67312
|
-
|
|
67313
|
-
|
|
67358
|
+
new G2PlotChart({
|
|
67359
|
+
name: "line",
|
|
67360
|
+
title: "Line Chart",
|
|
67361
|
+
component: Line,
|
|
67362
|
+
config: ["smooth", "isStack"]
|
|
67363
|
+
}),
|
|
67364
|
+
new G2PlotChart({
|
|
67365
|
+
name: "area",
|
|
67366
|
+
title: "Area Chart",
|
|
67367
|
+
component: Area,
|
|
67368
|
+
config: [
|
|
67369
|
+
"smooth",
|
|
67370
|
+
{
|
|
67371
|
+
property: "isStack",
|
|
67372
|
+
defaultValue: true
|
|
67373
|
+
},
|
|
67374
|
+
"isPercent"
|
|
67375
|
+
]
|
|
67376
|
+
}),
|
|
67377
|
+
new G2PlotChart({
|
|
67378
|
+
name: "column",
|
|
67379
|
+
title: "Column Chart",
|
|
67380
|
+
component: Column,
|
|
67381
|
+
config: ["isGroup", "isStack", "isPercent"]
|
|
67382
|
+
}),
|
|
67314
67383
|
new Bar(),
|
|
67315
67384
|
new Pie(),
|
|
67316
67385
|
new DualAxes(),
|
|
67317
|
-
new G2PlotChart("scatter", "Scatter Chart", Scatter)
|
|
67386
|
+
new G2PlotChart({ name: "scatter", title: "Scatter Chart", component: Scatter })
|
|
67318
67387
|
];
|
|
67319
67388
|
class AntdChart extends Chart {
|
|
67320
67389
|
getReference() {
|
|
@@ -67326,25 +67395,26 @@ var __publicField = (obj, key, value) => {
|
|
|
67326
67395
|
}
|
|
67327
67396
|
class Statistic extends AntdChart {
|
|
67328
67397
|
constructor() {
|
|
67329
|
-
super(
|
|
67330
|
-
|
|
67331
|
-
|
|
67332
|
-
|
|
67333
|
-
|
|
67334
|
-
|
|
67335
|
-
|
|
67336
|
-
|
|
67337
|
-
|
|
67338
|
-
"x-reactions": "{{ useChartFields }}",
|
|
67398
|
+
super({
|
|
67399
|
+
name: "statistic",
|
|
67400
|
+
title: "Statistic",
|
|
67401
|
+
component: antd$1.Statistic,
|
|
67402
|
+
config: [
|
|
67403
|
+
{
|
|
67404
|
+
property: "field",
|
|
67405
|
+
name: "field",
|
|
67406
|
+
title: "Field",
|
|
67339
67407
|
required: true
|
|
67340
67408
|
},
|
|
67341
|
-
|
|
67342
|
-
title:
|
|
67343
|
-
|
|
67344
|
-
|
|
67345
|
-
|
|
67409
|
+
{
|
|
67410
|
+
title: {
|
|
67411
|
+
title: lang("Title"),
|
|
67412
|
+
type: "string",
|
|
67413
|
+
"x-decorator": "FormItem",
|
|
67414
|
+
"x-component": "Input"
|
|
67415
|
+
}
|
|
67346
67416
|
}
|
|
67347
|
-
|
|
67417
|
+
]
|
|
67348
67418
|
});
|
|
67349
67419
|
}
|
|
67350
67420
|
init(fields, {
|
|
@@ -67373,7 +67443,7 @@ var __publicField = (obj, key, value) => {
|
|
|
67373
67443
|
}
|
|
67374
67444
|
class Table extends AntdChart {
|
|
67375
67445
|
constructor() {
|
|
67376
|
-
super("table", "Table", antd$1.Table);
|
|
67446
|
+
super({ name: "table", title: "Table", component: antd$1.Table });
|
|
67377
67447
|
}
|
|
67378
67448
|
getProps({ data: data2, fieldProps, general, advanced }) {
|
|
67379
67449
|
var _a2;
|
package/dist/locale/zh-CN.d.ts
CHANGED
package/dist/locale/zh-CN.js
CHANGED
|
@@ -68,7 +68,11 @@ var zh_CN_default = {
|
|
|
68
68
|
Min: "\u6700\u5C0F\u503C",
|
|
69
69
|
Max: "\u6700\u5927\u503C",
|
|
70
70
|
"Please select a chart type.": "\u8BF7\u9009\u62E9\u56FE\u8868\u7C7B\u578B",
|
|
71
|
-
Collection: "\u6570\u636E\u8868"
|
|
71
|
+
Collection: "\u6570\u636E\u8868",
|
|
72
|
+
isStack: "\u5806\u53E0",
|
|
73
|
+
isPercent: "\u663E\u793A\u4E3A\u767E\u5206\u6BD4",
|
|
74
|
+
isGroup: "\u5206\u7EC4",
|
|
75
|
+
smooth: "\u5E73\u6ED1\u66F2\u7EBF"
|
|
72
76
|
};
|
|
73
77
|
|
|
74
78
|
module.exports = zh_CN_default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/plugin-data-visualization",
|
|
3
|
-
"version": "0.12.0-alpha.
|
|
3
|
+
"version": "0.12.0-alpha.5",
|
|
4
4
|
"displayName": "Data Visualization",
|
|
5
5
|
"displayName.zh-CN": "数据可视化",
|
|
6
6
|
"description": "Provides business intelligence and data visualization features",
|
|
@@ -32,5 +32,5 @@
|
|
|
32
32
|
"@nocobase/test": "0.x",
|
|
33
33
|
"@nocobase/utils": "0.x"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "689cc16e83361c4d0b91907e0deac30bdb907692"
|
|
36
36
|
}
|