@antv/gpt-vis 0.5.11 → 0.5.12

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,5 +1,5 @@
1
1
  import React from 'react';
2
- import type { BasePlotProps, Style, Theme } from '../types';
2
+ import type { BasePlotProps, Theme } from '../types';
3
3
  type WaterfallDataItem = {
4
4
  category: string;
5
5
  value?: number;
@@ -7,14 +7,17 @@ type WaterfallDataItem = {
7
7
  isIntermediateTotal?: boolean;
8
8
  [key: string]: string | number | boolean | undefined;
9
9
  };
10
+ type WaterfallPalette = {
11
+ positiveColor?: string;
12
+ negativeColor?: string;
13
+ totalColor?: string;
14
+ };
10
15
  type WaterfallStyle = {
11
16
  backgroundColor?: string;
12
- } & Style;
17
+ palette?: WaterfallPalette;
18
+ };
13
19
  export type WaterfallProps = BasePlotProps<WaterfallDataItem> & Theme & {
14
20
  style?: WaterfallStyle;
15
- positiveColor?: string;
16
- negativeColor?: string;
17
- totalColor?: string;
18
21
  axisXTitle?: string;
19
22
  axisYTitle?: string;
20
23
  };
@@ -80,21 +80,11 @@ function generateLinkData(data) {
80
80
  }, []);
81
81
  }
82
82
  var defaultConfig = (props) => {
83
- const {
84
- data = [],
85
- title,
86
- style = {},
87
- positiveColor: customPositiveColor,
88
- negativeColor: customNegativeColor,
89
- totalColor: customTotalColor,
90
- axisXTitle,
91
- axisYTitle,
92
- theme = "default"
93
- } = props;
94
- const { backgroundColor } = style;
95
- const positiveColor = customPositiveColor || DEFAULT_POSITIVE_COLOR;
96
- const negativeColor = customNegativeColor || DEFAULT_NEGATIVE_COLOR;
97
- const totalColor = customTotalColor || DEFAULT_TOTAL_COLOR;
83
+ const { data = [], title, style = {}, axisXTitle, axisYTitle, theme = "default" } = props;
84
+ const { backgroundColor, palette = {} } = style;
85
+ const positiveColor = palette.positiveColor || DEFAULT_POSITIVE_COLOR;
86
+ const negativeColor = palette.negativeColor || DEFAULT_NEGATIVE_COLOR;
87
+ const totalColor = palette.totalColor || DEFAULT_TOTAL_COLOR;
98
88
  const transformedData = transformWaterfallData(data);
99
89
  const linkData = generateLinkData(transformedData);
100
90
  return {
@@ -1,2 +1,2 @@
1
- declare const _default: "0.5.11";
1
+ declare const _default: "0.5.12";
2
2
  export default _default;
@@ -22,4 +22,4 @@ __export(version_exports, {
22
22
  default: () => version_default
23
23
  });
24
24
  module.exports = __toCommonJS(version_exports);
25
- var version_default = "0.5.11";
25
+ var version_default = "0.5.12";
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import type { BasePlotProps, Style, Theme } from '../types';
2
+ import type { BasePlotProps, Theme } from '../types';
3
3
  type WaterfallDataItem = {
4
4
  category: string;
5
5
  value?: number;
@@ -7,14 +7,17 @@ type WaterfallDataItem = {
7
7
  isIntermediateTotal?: boolean;
8
8
  [key: string]: string | number | boolean | undefined;
9
9
  };
10
+ type WaterfallPalette = {
11
+ positiveColor?: string;
12
+ negativeColor?: string;
13
+ totalColor?: string;
14
+ };
10
15
  type WaterfallStyle = {
11
16
  backgroundColor?: string;
12
- } & Style;
17
+ palette?: WaterfallPalette;
18
+ };
13
19
  export type WaterfallProps = BasePlotProps<WaterfallDataItem> & Theme & {
14
20
  style?: WaterfallStyle;
15
- positiveColor?: string;
16
- negativeColor?: string;
17
- totalColor?: string;
18
21
  axisXTitle?: string;
19
22
  axisYTitle?: string;
20
23
  };
@@ -71,17 +71,16 @@ var defaultConfig = function defaultConfig(props) {
71
71
  title = props.title,
72
72
  _props$style = props.style,
73
73
  style = _props$style === void 0 ? {} : _props$style,
74
- customPositiveColor = props.positiveColor,
75
- customNegativeColor = props.negativeColor,
76
- customTotalColor = props.totalColor,
77
74
  axisXTitle = props.axisXTitle,
78
75
  axisYTitle = props.axisYTitle,
79
76
  _props$theme = props.theme,
80
77
  theme = _props$theme === void 0 ? 'default' : _props$theme;
81
- var backgroundColor = style.backgroundColor;
82
- var positiveColor = customPositiveColor || DEFAULT_POSITIVE_COLOR;
83
- var negativeColor = customNegativeColor || DEFAULT_NEGATIVE_COLOR;
84
- var totalColor = customTotalColor || DEFAULT_TOTAL_COLOR;
78
+ var backgroundColor = style.backgroundColor,
79
+ _style$palette = style.palette,
80
+ palette = _style$palette === void 0 ? {} : _style$palette;
81
+ var positiveColor = palette.positiveColor || DEFAULT_POSITIVE_COLOR;
82
+ var negativeColor = palette.negativeColor || DEFAULT_NEGATIVE_COLOR;
83
+ var totalColor = palette.totalColor || DEFAULT_TOTAL_COLOR;
85
84
  var transformedData = transformWaterfallData(data);
86
85
  var linkData = generateLinkData(transformedData);
87
86
  return _objectSpread({
@@ -1,2 +1,2 @@
1
- declare const _default: "0.5.11";
1
+ declare const _default: "0.5.12";
2
2
  export default _default;
@@ -1 +1 @@
1
- export default '0.5.11';
1
+ export default '0.5.12';