@reltio/components 1.4.1682 → 1.4.1684
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/cjs/components/attributes/readMode/AttributesPager/styles.js +2 -1
- package/cjs/components/charts/BarChart/getBarChartSettings.d.ts +6 -5
- package/cjs/components/charts/BarChart/getBarChartSettings.js +1 -1
- package/cjs/components/charts/BubbleChart/BubbleChart.d.ts +8 -3
- package/cjs/components/charts/BubbleChart/BubbleChart.js +5 -5
- package/cjs/components/charts/BubbleChart/helpers.d.ts +5 -4
- package/cjs/components/charts/CloudChart/CloudChart.js +4 -4
- package/cjs/components/charts/CustomLegend/CustomLegend.js +1 -1
- package/cjs/components/charts/CustomLegend/getLegendProps.d.ts +1 -1
- package/cjs/components/charts/CustomTooltip/CustomTooltip.d.ts +1 -1
- package/cjs/components/charts/CustomTooltip/CustomTooltip.js +1 -1
- package/cjs/components/charts/LineChart/LineChart.js +2 -17
- package/cjs/components/charts/LineChart/getLineChartSettings.d.ts +6 -5
- package/cjs/components/charts/LineChart/getLineChartSettings.js +1 -1
- package/cjs/components/charts/MapChart/MapChart.js +5 -5
- package/cjs/components/charts/PieChart/PieChart.d.ts +4 -4
- package/cjs/components/charts/PieChart/PieChart.js +3 -1
- package/cjs/components/charts/PieChart/styles.d.ts +1 -0
- package/cjs/components/charts/PieChart/styles.js +11 -0
- package/cjs/components/charts/TreeChart/TreeChart.js +17 -12
- package/cjs/components/charts/hooks/useTooltipState.d.ts +3 -3
- package/cjs/components/charts/types/BarChartOptions.d.ts +3 -2
- package/cjs/components/charts/types/LineChartOptions.d.ts +3 -2
- package/esm/components/attributes/readMode/AttributesPager/styles.js +2 -1
- package/esm/components/charts/BarChart/getBarChartSettings.d.ts +6 -5
- package/esm/components/charts/BarChart/getBarChartSettings.js +1 -1
- package/esm/components/charts/BubbleChart/BubbleChart.d.ts +8 -3
- package/esm/components/charts/BubbleChart/BubbleChart.js +5 -5
- package/esm/components/charts/BubbleChart/helpers.d.ts +5 -4
- package/esm/components/charts/CloudChart/CloudChart.js +4 -4
- package/esm/components/charts/CustomLegend/CustomLegend.js +1 -1
- package/esm/components/charts/CustomLegend/getLegendProps.d.ts +1 -1
- package/esm/components/charts/CustomTooltip/CustomTooltip.d.ts +1 -1
- package/esm/components/charts/CustomTooltip/CustomTooltip.js +1 -1
- package/esm/components/charts/LineChart/LineChart.js +3 -18
- package/esm/components/charts/LineChart/getLineChartSettings.d.ts +6 -5
- package/esm/components/charts/LineChart/getLineChartSettings.js +1 -1
- package/esm/components/charts/MapChart/MapChart.js +5 -5
- package/esm/components/charts/PieChart/PieChart.d.ts +4 -4
- package/esm/components/charts/PieChart/PieChart.js +3 -1
- package/esm/components/charts/PieChart/styles.d.ts +1 -0
- package/esm/components/charts/PieChart/styles.js +8 -0
- package/esm/components/charts/TreeChart/TreeChart.js +18 -13
- package/esm/components/charts/hooks/useTooltipState.d.ts +3 -3
- package/esm/components/charts/types/BarChartOptions.d.ts +3 -2
- package/esm/components/charts/types/LineChartOptions.d.ts +3 -2
- package/package.json +3 -3
|
@@ -53,7 +53,8 @@ exports.useOneLineStyles = (0, styles_1.makeStyles)(__assign({ wrapper: {
|
|
|
53
53
|
}, collaborationWrapper: {
|
|
54
54
|
display: 'flex',
|
|
55
55
|
alignItems: 'start',
|
|
56
|
-
minHeight: '18px'
|
|
56
|
+
minHeight: '18px',
|
|
57
|
+
justifyContent: 'space-between'
|
|
57
58
|
}, attribute: {
|
|
58
59
|
marginLeft: '8px',
|
|
59
60
|
paddingLeft: '4px',
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BarChart, BarProps, CartesianGridProps, TooltipProps, XAxisProps, YAxisProps } from 'recharts';
|
|
2
3
|
import { BarChartOptions } from '../types';
|
|
3
4
|
type BarChartSettings = {
|
|
4
|
-
barChart:
|
|
5
|
-
bar: BarProps
|
|
5
|
+
barChart: React.ComponentProps<typeof BarChart>;
|
|
6
|
+
bar: Omit<BarProps, 'ref'>;
|
|
6
7
|
xAxis: XAxisProps;
|
|
7
8
|
yAxis: YAxisProps;
|
|
8
|
-
cartesianGrid: CartesianGridProps
|
|
9
|
-
tooltip: TooltipProps
|
|
9
|
+
cartesianGrid: Omit<CartesianGridProps, 'ref'>;
|
|
10
|
+
tooltip: TooltipProps<number, string>;
|
|
10
11
|
};
|
|
11
12
|
declare const getBarChartSettings: ({ margin, isHorizontal, isLabelRotated }: BarChartOptions) => BarChartSettings;
|
|
12
13
|
export default getBarChartSettings;
|
|
@@ -32,7 +32,7 @@ var getBarChartSettings = function (_a) {
|
|
|
32
32
|
opacity: isHorizontal ? '0.87' : '0.54',
|
|
33
33
|
width: isHorizontal ? 150 : undefined
|
|
34
34
|
},
|
|
35
|
-
tickFormatter: mdm_sdk_1.formatNumberAsMetric,
|
|
35
|
+
tickFormatter: function (value) { return (0, mdm_sdk_1.formatNumberAsMetric)(value); },
|
|
36
36
|
stroke: '#666',
|
|
37
37
|
tickCount: 8,
|
|
38
38
|
mirror: isHorizontal
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
2
|
+
import { LegendProps } from 'recharts';
|
|
3
3
|
import { ChartProps } from '../types';
|
|
4
4
|
type Props = ChartProps & {
|
|
5
5
|
options?: {
|
|
6
6
|
showLegend?: boolean;
|
|
7
|
-
margin?:
|
|
7
|
+
margin?: LegendProps['margin'];
|
|
8
8
|
};
|
|
9
9
|
};
|
|
10
10
|
export declare const BubbleChart: ({ width, height, data, options, onItemClick }: Props) => JSX.Element;
|
|
@@ -12,7 +12,12 @@ declare const _default: {
|
|
|
12
12
|
({ data, ...otherProps }: ChartProps & {
|
|
13
13
|
options?: {
|
|
14
14
|
showLegend?: boolean;
|
|
15
|
-
margin?:
|
|
15
|
+
margin?: {
|
|
16
|
+
top?: number;
|
|
17
|
+
left?: number;
|
|
18
|
+
bottom?: number;
|
|
19
|
+
right?: number;
|
|
20
|
+
};
|
|
16
21
|
};
|
|
17
22
|
}): JSX.Element;
|
|
18
23
|
displayName: string;
|
|
@@ -39,17 +39,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
39
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
40
|
exports.BubbleChart = void 0;
|
|
41
41
|
var react_1 = __importStar(require("react"));
|
|
42
|
+
var ramda_1 = require("ramda");
|
|
43
|
+
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
42
44
|
var recharts_1 = require("recharts");
|
|
43
|
-
var useBubbles_1 = __importDefault(require("./useBubbles"));
|
|
44
45
|
var getLegendProps_1 = __importDefault(require("../CustomLegend/getLegendProps"));
|
|
46
|
+
var CustomTooltip_1 = require("../CustomTooltip/CustomTooltip");
|
|
45
47
|
var helpers_1 = require("./helpers");
|
|
46
48
|
var withPercents_1 = __importDefault(require("../HOCs/withPercents"));
|
|
47
|
-
var ramda_1 = require("ramda");
|
|
48
|
-
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
49
|
-
var CustomTooltip_1 = require("../CustomTooltip/CustomTooltip");
|
|
50
49
|
var useTooltipState_1 = __importDefault(require("../hooks/useTooltipState"));
|
|
51
|
-
var styles_1 = require("./styles");
|
|
52
50
|
var useClickableStyle_1 = require("../hooks/useClickableStyle");
|
|
51
|
+
var useBubbles_1 = __importDefault(require("./useBubbles"));
|
|
52
|
+
var styles_1 = require("./styles");
|
|
53
53
|
var BubbleChart = function (_a) {
|
|
54
54
|
var width = _a.width, height = _a.height, data = _a.data, _b = _a.options, options = _b === void 0 ? {} : _b, onItemClick = _a.onItemClick;
|
|
55
55
|
var styles = (0, styles_1.useStyles)();
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { CartesianAxisProps, LegendProps } from 'recharts';
|
|
2
|
+
type ViewBox = CartesianAxisProps['viewBox'];
|
|
3
|
+
declare const adjustRectWithLegend: (rect: ViewBox, legendProps: Omit<LegendProps, 'ref'>, legendBox: ViewBox) => {
|
|
4
|
+
rect: import("recharts/types/util/types").CartesianViewBox;
|
|
5
|
+
legendProps: Omit<LegendProps, "ref">;
|
|
5
6
|
};
|
|
6
7
|
export { adjustRectWithLegend };
|
|
@@ -39,14 +39,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
39
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
40
|
exports.CloudChart = void 0;
|
|
41
41
|
var react_1 = __importStar(require("react"));
|
|
42
|
+
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
42
43
|
var recharts_1 = require("recharts");
|
|
44
|
+
var CustomTooltip_1 = require("../CustomTooltip/CustomTooltip");
|
|
45
|
+
var useTooltipState_1 = __importDefault(require("../hooks/useTooltipState"));
|
|
46
|
+
var useClickableStyle_1 = require("../hooks/useClickableStyle");
|
|
43
47
|
var useCloud_1 = __importDefault(require("./useCloud"));
|
|
44
48
|
var withPercents_1 = __importDefault(require("../HOCs/withPercents"));
|
|
45
|
-
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
46
49
|
var styles_1 = require("./styles");
|
|
47
|
-
var useTooltipState_1 = __importDefault(require("../hooks/useTooltipState"));
|
|
48
|
-
var CustomTooltip_1 = require("../CustomTooltip/CustomTooltip");
|
|
49
|
-
var useClickableStyle_1 = require("../hooks/useClickableStyle");
|
|
50
50
|
var CloudChart = function (_a) {
|
|
51
51
|
var width = _a.width, height = _a.height, data = _a.data, _b = _a.options, options = _b === void 0 ? {} : _b, onItemClick = _a.onItemClick;
|
|
52
52
|
var _c = (0, useTooltipState_1.default)(), tooltipState = _c.tooltipState, showTooltip = _c.showTooltip, hideTooltip = _c.hideTooltip;
|
|
@@ -10,7 +10,7 @@ var CustomLegend = function (_a) {
|
|
|
10
10
|
var payload = _a.payload, alignRight = _a.alignRight;
|
|
11
11
|
var isTwoCols = payload.length > 8;
|
|
12
12
|
var styles = (0, styles_1.useStyles)();
|
|
13
|
-
return (react_1.default.createElement("div", { className: (0, classnames_1.default)(styles.wrapper, { isTwoCols: isTwoCols
|
|
13
|
+
return (react_1.default.createElement("div", { className: (0, classnames_1.default)(styles.wrapper, { isTwoCols: isTwoCols, alignRight: alignRight }) }, payload.map(function (item) { return (react_1.default.createElement("div", { key: item.id, className: styles.item },
|
|
14
14
|
react_1.default.createElement("div", { style: { background: item.color }, className: styles.itemColor }),
|
|
15
15
|
react_1.default.createElement("span", { className: styles.value }, item.value))); })));
|
|
16
16
|
};
|
|
@@ -4,9 +4,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.CustomTooltip = void 0;
|
|
7
|
-
var styles_1 = require("./styles");
|
|
8
7
|
var react_1 = __importDefault(require("react"));
|
|
9
8
|
var ramda_1 = require("ramda");
|
|
9
|
+
var styles_1 = require("./styles");
|
|
10
10
|
var CustomTooltip = function (_a) {
|
|
11
11
|
var _b;
|
|
12
12
|
var payload = _a.payload, active = _a.active;
|
|
@@ -10,17 +10,6 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
};
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
-
var t = {};
|
|
15
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
-
t[p] = s[p];
|
|
17
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
-
t[p[i]] = s[p[i]];
|
|
21
|
-
}
|
|
22
|
-
return t;
|
|
23
|
-
};
|
|
24
13
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
25
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
15
|
};
|
|
@@ -30,19 +19,15 @@ var recharts_1 = require("recharts");
|
|
|
30
19
|
var getLineChartSettings_1 = __importDefault(require("./getLineChartSettings"));
|
|
31
20
|
var CustomTooltip_1 = require("../CustomTooltip/CustomTooltip");
|
|
32
21
|
var useClickableStyle_1 = require("../hooks/useClickableStyle");
|
|
33
|
-
var CustomDot = function (_a) {
|
|
34
|
-
var payload = _a.payload, onClick = _a.onClick, otherProps = __rest(_a, ["payload", "onClick"]);
|
|
35
|
-
var clickable = (0, useClickableStyle_1.useClickableStyle)(onClick);
|
|
36
|
-
return (react_1.default.createElement(recharts_1.Dot, __assign({ className: clickable, payload: payload, onClick: onClick && (function () { return onClick(payload.group); }) }, otherProps)));
|
|
37
|
-
};
|
|
38
22
|
var LineChart = function (_a) {
|
|
39
23
|
var width = _a.width, height = _a.height, data = _a.data, _b = _a.options, options = _b === void 0 ? {} : _b, onItemClick = _a.onItemClick;
|
|
40
24
|
var _c = (0, getLineChartSettings_1.default)(options), cartesianGrid = _c.cartesianGrid, tooltip = _c.tooltip, xAxis = _c.xAxis, yAxis = _c.yAxis, lineChart = _c.lineChart, line = _c.line;
|
|
25
|
+
var clickable = (0, useClickableStyle_1.useClickableStyle)(onItemClick);
|
|
41
26
|
return (react_1.default.createElement(recharts_1.LineChart, __assign({ width: width, height: height, data: data }, lineChart),
|
|
42
27
|
react_1.default.createElement(recharts_1.CartesianGrid, __assign({}, cartesianGrid)),
|
|
43
28
|
react_1.default.createElement(recharts_1.XAxis, __assign({}, xAxis)),
|
|
44
29
|
react_1.default.createElement(recharts_1.YAxis, __assign({}, yAxis)),
|
|
45
30
|
react_1.default.createElement(recharts_1.Tooltip, __assign({ content: react_1.default.createElement(CustomTooltip_1.CustomTooltip, null) }, tooltip)),
|
|
46
|
-
react_1.default.createElement(recharts_1.Line, __assign({}, line, { activeDot:
|
|
31
|
+
react_1.default.createElement(recharts_1.Line, __assign({}, line, { activeDot: __assign(__assign({}, line.activeDot), { className: clickable, onClick: function (_, event) { return onItemClick(event.payload.group); } }) }))));
|
|
47
32
|
};
|
|
48
33
|
exports.default = LineChart;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CartesianGridProps, LineChart, LineProps, TooltipProps, XAxisProps, YAxisProps } from 'recharts';
|
|
2
3
|
import { LineChartOptions } from '../types/LineChartOptions';
|
|
3
4
|
type LineChartSettings = {
|
|
4
|
-
lineChart:
|
|
5
|
+
lineChart: React.ComponentProps<typeof LineChart>;
|
|
5
6
|
xAxis: XAxisProps;
|
|
6
7
|
yAxis: YAxisProps;
|
|
7
|
-
cartesianGrid: CartesianGridProps
|
|
8
|
-
tooltip: TooltipProps
|
|
9
|
-
line: LineProps
|
|
8
|
+
cartesianGrid: Omit<CartesianGridProps, 'ref'>;
|
|
9
|
+
tooltip: TooltipProps<number, string>;
|
|
10
|
+
line: Omit<LineProps, 'ref'>;
|
|
10
11
|
};
|
|
11
12
|
declare const getLineChartSettings: ({ margin, isLabelRotated }: LineChartOptions) => LineChartSettings;
|
|
12
13
|
export default getLineChartSettings;
|
|
@@ -27,7 +27,7 @@ var getLineChartSettings = function (_a) {
|
|
|
27
27
|
opacity: '0.54',
|
|
28
28
|
width: undefined
|
|
29
29
|
},
|
|
30
|
-
tickFormatter: mdm_sdk_1.formatNumberAsMetric,
|
|
30
|
+
tickFormatter: function (value) { return (0, mdm_sdk_1.formatNumberAsMetric)(value); },
|
|
31
31
|
stroke: '#666',
|
|
32
32
|
tickCount: 8
|
|
33
33
|
},
|
|
@@ -39,7 +39,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
39
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
40
|
exports.MapChart = exports.LEGEND_WIDTH = void 0;
|
|
41
41
|
var react_1 = __importStar(require("react"));
|
|
42
|
-
var
|
|
42
|
+
var ramda_1 = require("ramda");
|
|
43
|
+
var classnames_1 = __importDefault(require("classnames"));
|
|
44
|
+
var recharts_1 = require("recharts");
|
|
43
45
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
44
46
|
// @ts-ignore
|
|
45
47
|
var react_simple_maps_1 = require("react-simple-maps");
|
|
@@ -47,14 +49,12 @@ var d3_scale_1 = require("d3-scale");
|
|
|
47
49
|
var d3Geo = __importStar(require("d3-geo"));
|
|
48
50
|
var topojson_client_1 = require("topojson-client");
|
|
49
51
|
var useGeography_1 = __importDefault(require("./useGeography"));
|
|
50
|
-
var ramda_1 = require("ramda");
|
|
51
52
|
var Legend_1 = __importDefault(require("./Legend/Legend"));
|
|
52
53
|
var CustomTooltip_1 = require("../CustomTooltip/CustomTooltip");
|
|
53
|
-
var recharts_1 = require("recharts");
|
|
54
54
|
var useTooltipState_1 = __importDefault(require("../hooks/useTooltipState"));
|
|
55
|
-
var classnames_1 = __importDefault(require("classnames"));
|
|
56
|
-
var styles_1 = require("./styles");
|
|
57
55
|
var useClickableStyle_1 = require("../hooks/useClickableStyle");
|
|
56
|
+
var withPercents_1 = __importDefault(require("../HOCs/withPercents"));
|
|
57
|
+
var styles_1 = require("./styles");
|
|
58
58
|
var USA_MAP = 'https://s3.amazonaws.com/reltio-ui-files/map_resources/us-albers.json';
|
|
59
59
|
var MAP_COLORS = ['#CDE0FE', '#0160AD'];
|
|
60
60
|
exports.LEGEND_WIDTH = 75;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PieChart as PieChartWidget } from 'recharts';
|
|
3
3
|
import { ChartProps } from '../types';
|
|
4
4
|
type Props = ChartProps & {
|
|
5
5
|
options?: {
|
|
6
|
-
margin?:
|
|
6
|
+
margin?: React.ComponentProps<typeof PieChartWidget>['margin'];
|
|
7
7
|
showLegend?: boolean;
|
|
8
8
|
showActiveShape?: boolean;
|
|
9
9
|
};
|
|
@@ -13,7 +13,7 @@ export declare const PieChart: ({ width, height, data, options, isDonut, onItemC
|
|
|
13
13
|
declare const _default: {
|
|
14
14
|
({ data, ...otherProps }: ChartProps & {
|
|
15
15
|
options?: {
|
|
16
|
-
margin?: Margin;
|
|
16
|
+
margin?: import("recharts/types/util/types").Margin;
|
|
17
17
|
showLegend?: boolean;
|
|
18
18
|
showActiveShape?: boolean;
|
|
19
19
|
};
|
|
@@ -46,9 +46,11 @@ var getLegendProps_1 = __importDefault(require("../CustomLegend/getLegendProps")
|
|
|
46
46
|
var ActiveShape_1 = __importDefault(require("../ActiveShape/ActiveShape"));
|
|
47
47
|
var CustomTooltip_1 = require("../CustomTooltip/CustomTooltip");
|
|
48
48
|
var useClickableStyle_1 = require("../hooks/useClickableStyle");
|
|
49
|
+
var styles_1 = require("./styles");
|
|
49
50
|
var PieChart = function (_a) {
|
|
50
51
|
var width = _a.width, height = _a.height, data = _a.data, _b = _a.options, options = _b === void 0 ? {} : _b, isDonut = _a.isDonut, onItemClick = _a.onItemClick;
|
|
51
52
|
var _c = options.showLegend, showLegend = _c === void 0 ? true : _c, margin = options.margin, showActiveShape = options.showActiveShape;
|
|
53
|
+
var styles = (0, styles_1.useStyles)();
|
|
52
54
|
var _d = (0, react_1.useState)(-1), activeId = _d[0], setActiveId = _d[1];
|
|
53
55
|
var onPieEnter = function (_, index) { return setActiveId(index); };
|
|
54
56
|
var onPieLeave = function () { return setActiveId(-1); };
|
|
@@ -65,7 +67,7 @@ var PieChart = function (_a) {
|
|
|
65
67
|
color: (0, mdm_sdk_1.getChartItemColor)(item.label),
|
|
66
68
|
value: "".concat(item.label, " (").concat(item.percent, "%)")
|
|
67
69
|
}); }) }))),
|
|
68
|
-
react_1.default.createElement(recharts_1.Pie, { dataKey: "value", data: data, activeIndex: activeId, activeShape: showActiveShape ? ActiveShape_1.default : undefined, onMouseEnter: showActiveShape ? onPieEnter : undefined, onMouseLeave: showActiveShape ? onPieLeave : undefined, innerRadius: isDonut ? (showActiveShape ? '50%' : '60%') : 0, outerRadius: showActiveShape ? '70%' : '80%', onClick: onPieClick }, (data || []).map(function (entry, index) { return (react_1.default.createElement(recharts_1.Cell, { key: index, fill: (0, mdm_sdk_1.getChartItemColor)(entry.label), className: clickable })); }))));
|
|
70
|
+
react_1.default.createElement(recharts_1.Pie, { dataKey: "value", data: data, activeIndex: activeId, activeShape: showActiveShape ? ActiveShape_1.default : undefined, onMouseEnter: showActiveShape ? onPieEnter : undefined, onMouseLeave: showActiveShape ? onPieLeave : undefined, innerRadius: isDonut ? (showActiveShape ? '50%' : '60%') : 0, outerRadius: showActiveShape ? '70%' : '80%', onClick: onPieClick, className: styles.pie }, (data || []).map(function (entry, index) { return (react_1.default.createElement(recharts_1.Cell, { key: index, fill: (0, mdm_sdk_1.getChartItemColor)(entry.label), className: clickable })); }))));
|
|
69
71
|
};
|
|
70
72
|
exports.PieChart = PieChart;
|
|
71
73
|
exports.default = (0, withPercents_1.default)(exports.PieChart);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useStyles: (props?: any) => import("@mui/styles").ClassNameMap<"pie">;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useStyles = void 0;
|
|
4
|
+
var styles_1 = require("@mui/styles");
|
|
5
|
+
exports.useStyles = (0, styles_1.makeStyles)({
|
|
6
|
+
pie: {
|
|
7
|
+
'& .recharts-sector:focus': {
|
|
8
|
+
outline: 'none'
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
});
|
|
@@ -35,33 +35,38 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
35
35
|
};
|
|
36
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
37
|
var react_1 = __importStar(require("react"));
|
|
38
|
+
var nanoid_1 = require("nanoid");
|
|
38
39
|
var recharts_1 = require("recharts");
|
|
39
40
|
var CustomTooltip_1 = require("../CustomTooltip/CustomTooltip");
|
|
40
|
-
var styles_1 = require("./styles");
|
|
41
41
|
var useClickableStyle_1 = require("../hooks/useClickableStyle");
|
|
42
|
-
var
|
|
42
|
+
var styles_1 = require("./styles");
|
|
43
43
|
var CustomizedContent = function (_a) {
|
|
44
44
|
var x = _a.x, y = _a.y, width = _a.width, height = _a.height, label = _a.label, onClick = _a.onClick, group = _a.group;
|
|
45
45
|
var styles = (0, styles_1.useStyles)();
|
|
46
46
|
var clickable = (0, useClickableStyle_1.useClickableStyle)(onClick);
|
|
47
47
|
var clipPathId = (0, react_1.useRef)((0, nanoid_1.nanoid)()).current;
|
|
48
48
|
var strokeWidth = 2;
|
|
49
|
-
|
|
49
|
+
var handleClick = function () {
|
|
50
|
+
if (!onClick)
|
|
51
|
+
return;
|
|
52
|
+
onClick(group);
|
|
53
|
+
};
|
|
54
|
+
return (react_1.default.createElement("g", { className: clickable, onClick: handleClick },
|
|
50
55
|
react_1.default.createElement("clipPath", { id: clipPathId },
|
|
51
56
|
react_1.default.createElement("rect", { x: x + strokeWidth, y: y + strokeWidth, width: Math.max(width - strokeWidth * 2, 0), height: Math.max(height - strokeWidth * 2, 0) })),
|
|
52
57
|
react_1.default.createElement("rect", { x: x, y: y, width: width, height: height, strokeWidth: strokeWidth, className: styles.treeBlock }),
|
|
53
|
-
react_1.default.createElement(recharts_1.Text, { clipPath: "url(#".concat(clipPathId, ")"), textAnchor:
|
|
54
|
-
};
|
|
55
|
-
var normalizeValues = function (data) {
|
|
56
|
-
var dataTotal = data.reduce(function (acc, item) { return acc + item.value; }, 0);
|
|
57
|
-
var threshold = dataTotal / (data.length * 10);
|
|
58
|
-
return data.map(function (item) {
|
|
59
|
-
return __assign(__assign({}, item), { normalizedValue: item.value < threshold ? threshold : item.value });
|
|
60
|
-
});
|
|
58
|
+
react_1.default.createElement(recharts_1.Text, { clipPath: "url(#".concat(clipPathId, ")"), textAnchor: "middle", verticalAnchor: "middle", width: width, x: x + width / 2, y: y + height / 2, className: styles.treeLabel }, label)));
|
|
61
59
|
};
|
|
62
60
|
var TreeChart = function (_a) {
|
|
63
61
|
var data = _a.data, width = _a.width, height = _a.height, onItemClick = _a.onItemClick;
|
|
64
|
-
|
|
62
|
+
var normalizedData = (0, react_1.useMemo)(function () {
|
|
63
|
+
var dataTotal = data.reduce(function (acc, item) { return acc + item.value; }, 0);
|
|
64
|
+
var threshold = dataTotal / (data.length * 10);
|
|
65
|
+
return data.map(function (item) {
|
|
66
|
+
return __assign(__assign({}, item), { normalizedValue: item.value < threshold ? threshold : item.value });
|
|
67
|
+
});
|
|
68
|
+
}, [data]);
|
|
69
|
+
return (react_1.default.createElement(recharts_1.Treemap, { dataKey: "normalizedValue", nameKey: "label", content: react_1.default.createElement(CustomizedContent, { onClick: onItemClick }), data: normalizedData, width: width, animationDuration: 500, height: height },
|
|
65
70
|
react_1.default.createElement(recharts_1.Tooltip, { content: react_1.default.createElement(CustomTooltip_1.CustomTooltip, null) })));
|
|
66
71
|
};
|
|
67
72
|
exports.default = TreeChart;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TooltipProps } from 'recharts';
|
|
2
2
|
import { ChartData } from '../types';
|
|
3
3
|
declare const useTooltipState: () => {
|
|
4
|
-
tooltipState: TooltipProps
|
|
5
|
-
showTooltip: (data: ChartData, coordinate:
|
|
4
|
+
tooltipState: TooltipProps<number, string>;
|
|
5
|
+
showTooltip: (data: ChartData, coordinate: TooltipProps<number, string>['coordinate']) => void;
|
|
6
6
|
hideTooltip: () => void;
|
|
7
7
|
};
|
|
8
8
|
export default useTooltipState;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BarChart } from 'recharts';
|
|
2
3
|
export type BarChartOptions = {
|
|
3
|
-
margin?:
|
|
4
|
+
margin?: React.ComponentProps<typeof BarChart>['margin'];
|
|
4
5
|
isLabelRotated?: boolean;
|
|
5
6
|
isHorizontal?: boolean;
|
|
6
7
|
};
|
|
@@ -50,7 +50,8 @@ export var useOneLineStyles = makeStyles(__assign({ wrapper: {
|
|
|
50
50
|
}, collaborationWrapper: {
|
|
51
51
|
display: 'flex',
|
|
52
52
|
alignItems: 'start',
|
|
53
|
-
minHeight: '18px'
|
|
53
|
+
minHeight: '18px',
|
|
54
|
+
justifyContent: 'space-between'
|
|
54
55
|
}, attribute: {
|
|
55
56
|
marginLeft: '8px',
|
|
56
57
|
paddingLeft: '4px',
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BarChart, BarProps, CartesianGridProps, TooltipProps, XAxisProps, YAxisProps } from 'recharts';
|
|
2
3
|
import { BarChartOptions } from '../types';
|
|
3
4
|
type BarChartSettings = {
|
|
4
|
-
barChart:
|
|
5
|
-
bar: BarProps
|
|
5
|
+
barChart: React.ComponentProps<typeof BarChart>;
|
|
6
|
+
bar: Omit<BarProps, 'ref'>;
|
|
6
7
|
xAxis: XAxisProps;
|
|
7
8
|
yAxis: YAxisProps;
|
|
8
|
-
cartesianGrid: CartesianGridProps
|
|
9
|
-
tooltip: TooltipProps
|
|
9
|
+
cartesianGrid: Omit<CartesianGridProps, 'ref'>;
|
|
10
|
+
tooltip: TooltipProps<number, string>;
|
|
10
11
|
};
|
|
11
12
|
declare const getBarChartSettings: ({ margin, isHorizontal, isLabelRotated }: BarChartOptions) => BarChartSettings;
|
|
12
13
|
export default getBarChartSettings;
|
|
@@ -30,7 +30,7 @@ var getBarChartSettings = function (_a) {
|
|
|
30
30
|
opacity: isHorizontal ? '0.87' : '0.54',
|
|
31
31
|
width: isHorizontal ? 150 : undefined
|
|
32
32
|
},
|
|
33
|
-
tickFormatter: formatNumberAsMetric,
|
|
33
|
+
tickFormatter: function (value) { return formatNumberAsMetric(value); },
|
|
34
34
|
stroke: '#666',
|
|
35
35
|
tickCount: 8,
|
|
36
36
|
mirror: isHorizontal
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
2
|
+
import { LegendProps } from 'recharts';
|
|
3
3
|
import { ChartProps } from '../types';
|
|
4
4
|
type Props = ChartProps & {
|
|
5
5
|
options?: {
|
|
6
6
|
showLegend?: boolean;
|
|
7
|
-
margin?:
|
|
7
|
+
margin?: LegendProps['margin'];
|
|
8
8
|
};
|
|
9
9
|
};
|
|
10
10
|
export declare const BubbleChart: ({ width, height, data, options, onItemClick }: Props) => JSX.Element;
|
|
@@ -12,7 +12,12 @@ declare const _default: {
|
|
|
12
12
|
({ data, ...otherProps }: ChartProps & {
|
|
13
13
|
options?: {
|
|
14
14
|
showLegend?: boolean;
|
|
15
|
-
margin?:
|
|
15
|
+
margin?: {
|
|
16
|
+
top?: number;
|
|
17
|
+
left?: number;
|
|
18
|
+
bottom?: number;
|
|
19
|
+
right?: number;
|
|
20
|
+
};
|
|
16
21
|
};
|
|
17
22
|
}): JSX.Element;
|
|
18
23
|
displayName: string;
|
|
@@ -10,17 +10,17 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
12
|
import React, { useMemo, useState } from 'react';
|
|
13
|
+
import { propOr } from 'ramda';
|
|
14
|
+
import { getChartItemColor } from '@reltio/mdm-sdk';
|
|
13
15
|
import { Legend, Tooltip } from 'recharts';
|
|
14
|
-
import useBubbles from './useBubbles';
|
|
15
16
|
import getLegendProps from '../CustomLegend/getLegendProps';
|
|
17
|
+
import { CustomTooltip } from '../CustomTooltip/CustomTooltip';
|
|
16
18
|
import { adjustRectWithLegend } from './helpers';
|
|
17
19
|
import withPercents from '../HOCs/withPercents';
|
|
18
|
-
import { propOr } from 'ramda';
|
|
19
|
-
import { getChartItemColor } from '@reltio/mdm-sdk';
|
|
20
|
-
import { CustomTooltip } from '../CustomTooltip/CustomTooltip';
|
|
21
20
|
import useTooltipState from '../hooks/useTooltipState';
|
|
22
|
-
import { useStyles } from './styles';
|
|
23
21
|
import { useClickableStyle } from '../hooks/useClickableStyle';
|
|
22
|
+
import useBubbles from './useBubbles';
|
|
23
|
+
import { useStyles } from './styles';
|
|
24
24
|
export var BubbleChart = function (_a) {
|
|
25
25
|
var width = _a.width, height = _a.height, data = _a.data, _b = _a.options, options = _b === void 0 ? {} : _b, onItemClick = _a.onItemClick;
|
|
26
26
|
var styles = useStyles();
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { CartesianAxisProps, LegendProps } from 'recharts';
|
|
2
|
+
type ViewBox = CartesianAxisProps['viewBox'];
|
|
3
|
+
declare const adjustRectWithLegend: (rect: ViewBox, legendProps: Omit<LegendProps, 'ref'>, legendBox: ViewBox) => {
|
|
4
|
+
rect: import("recharts/types/util/types").CartesianViewBox;
|
|
5
|
+
legendProps: Omit<LegendProps, "ref">;
|
|
5
6
|
};
|
|
6
7
|
export { adjustRectWithLegend };
|
|
@@ -10,14 +10,14 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
12
|
import React, { useMemo } from 'react';
|
|
13
|
+
import { getChartItemColor } from '@reltio/mdm-sdk';
|
|
13
14
|
import { Tooltip } from 'recharts';
|
|
15
|
+
import { CustomTooltip } from '../CustomTooltip/CustomTooltip';
|
|
16
|
+
import useTooltipState from '../hooks/useTooltipState';
|
|
17
|
+
import { useClickableStyle } from '../hooks/useClickableStyle';
|
|
14
18
|
import useCloud from './useCloud';
|
|
15
19
|
import withPercents from '../HOCs/withPercents';
|
|
16
|
-
import { getChartItemColor } from '@reltio/mdm-sdk';
|
|
17
20
|
import { useStyles } from './styles';
|
|
18
|
-
import useTooltipState from '../hooks/useTooltipState';
|
|
19
|
-
import { CustomTooltip } from '../CustomTooltip/CustomTooltip';
|
|
20
|
-
import { useClickableStyle } from '../hooks/useClickableStyle';
|
|
21
21
|
export var CloudChart = function (_a) {
|
|
22
22
|
var width = _a.width, height = _a.height, data = _a.data, _b = _a.options, options = _b === void 0 ? {} : _b, onItemClick = _a.onItemClick;
|
|
23
23
|
var _c = useTooltipState(), tooltipState = _c.tooltipState, showTooltip = _c.showTooltip, hideTooltip = _c.hideTooltip;
|
|
@@ -5,7 +5,7 @@ var CustomLegend = function (_a) {
|
|
|
5
5
|
var payload = _a.payload, alignRight = _a.alignRight;
|
|
6
6
|
var isTwoCols = payload.length > 8;
|
|
7
7
|
var styles = useStyles();
|
|
8
|
-
return (React.createElement("div", { className: classnames(styles.wrapper, { isTwoCols: isTwoCols
|
|
8
|
+
return (React.createElement("div", { className: classnames(styles.wrapper, { isTwoCols: isTwoCols, alignRight: alignRight }) }, payload.map(function (item) { return (React.createElement("div", { key: item.id, className: styles.item },
|
|
9
9
|
React.createElement("div", { style: { background: item.color }, className: styles.itemColor }),
|
|
10
10
|
React.createElement("span", { className: styles.value }, item.value))); })));
|
|
11
11
|
};
|
|
@@ -9,35 +9,20 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
-
var t = {};
|
|
14
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
-
t[p] = s[p];
|
|
16
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
-
t[p[i]] = s[p[i]];
|
|
20
|
-
}
|
|
21
|
-
return t;
|
|
22
|
-
};
|
|
23
12
|
import React from 'react';
|
|
24
|
-
import { CartesianGrid,
|
|
13
|
+
import { CartesianGrid, Line, LineChart as LineChartWidget, Tooltip, XAxis, YAxis } from 'recharts';
|
|
25
14
|
import getLineChartSettings from './getLineChartSettings';
|
|
26
15
|
import { CustomTooltip } from '../CustomTooltip/CustomTooltip';
|
|
27
16
|
import { useClickableStyle } from '../hooks/useClickableStyle';
|
|
28
|
-
var CustomDot = function (_a) {
|
|
29
|
-
var payload = _a.payload, onClick = _a.onClick, otherProps = __rest(_a, ["payload", "onClick"]);
|
|
30
|
-
var clickable = useClickableStyle(onClick);
|
|
31
|
-
return (React.createElement(Dot, __assign({ className: clickable, payload: payload, onClick: onClick && (function () { return onClick(payload.group); }) }, otherProps)));
|
|
32
|
-
};
|
|
33
17
|
var LineChart = function (_a) {
|
|
34
18
|
var width = _a.width, height = _a.height, data = _a.data, _b = _a.options, options = _b === void 0 ? {} : _b, onItemClick = _a.onItemClick;
|
|
35
19
|
var _c = getLineChartSettings(options), cartesianGrid = _c.cartesianGrid, tooltip = _c.tooltip, xAxis = _c.xAxis, yAxis = _c.yAxis, lineChart = _c.lineChart, line = _c.line;
|
|
20
|
+
var clickable = useClickableStyle(onItemClick);
|
|
36
21
|
return (React.createElement(LineChartWidget, __assign({ width: width, height: height, data: data }, lineChart),
|
|
37
22
|
React.createElement(CartesianGrid, __assign({}, cartesianGrid)),
|
|
38
23
|
React.createElement(XAxis, __assign({}, xAxis)),
|
|
39
24
|
React.createElement(YAxis, __assign({}, yAxis)),
|
|
40
25
|
React.createElement(Tooltip, __assign({ content: React.createElement(CustomTooltip, null) }, tooltip)),
|
|
41
|
-
React.createElement(Line, __assign({}, line, { activeDot:
|
|
26
|
+
React.createElement(Line, __assign({}, line, { activeDot: __assign(__assign({}, line.activeDot), { className: clickable, onClick: function (_, event) { return onItemClick(event.payload.group); } }) }))));
|
|
42
27
|
};
|
|
43
28
|
export default LineChart;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CartesianGridProps, LineChart, LineProps, TooltipProps, XAxisProps, YAxisProps } from 'recharts';
|
|
2
3
|
import { LineChartOptions } from '../types/LineChartOptions';
|
|
3
4
|
type LineChartSettings = {
|
|
4
|
-
lineChart:
|
|
5
|
+
lineChart: React.ComponentProps<typeof LineChart>;
|
|
5
6
|
xAxis: XAxisProps;
|
|
6
7
|
yAxis: YAxisProps;
|
|
7
|
-
cartesianGrid: CartesianGridProps
|
|
8
|
-
tooltip: TooltipProps
|
|
9
|
-
line: LineProps
|
|
8
|
+
cartesianGrid: Omit<CartesianGridProps, 'ref'>;
|
|
9
|
+
tooltip: TooltipProps<number, string>;
|
|
10
|
+
line: Omit<LineProps, 'ref'>;
|
|
10
11
|
};
|
|
11
12
|
declare const getLineChartSettings: ({ margin, isLabelRotated }: LineChartOptions) => LineChartSettings;
|
|
12
13
|
export default getLineChartSettings;
|
|
@@ -10,7 +10,9 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
12
|
import React, { useMemo, useCallback } from 'react';
|
|
13
|
-
import
|
|
13
|
+
import { pluck } from 'ramda';
|
|
14
|
+
import classnames from 'classnames';
|
|
15
|
+
import { Tooltip } from 'recharts';
|
|
14
16
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
15
17
|
// @ts-ignore
|
|
16
18
|
import { Geographies, Geography, MapProvider } from 'react-simple-maps';
|
|
@@ -18,14 +20,12 @@ import { scaleLog } from 'd3-scale';
|
|
|
18
20
|
import * as d3Geo from 'd3-geo';
|
|
19
21
|
import { feature } from 'topojson-client';
|
|
20
22
|
import useGeography from './useGeography';
|
|
21
|
-
import { pluck } from 'ramda';
|
|
22
23
|
import Legend from './Legend/Legend';
|
|
23
24
|
import { CustomTooltip } from '../CustomTooltip/CustomTooltip';
|
|
24
|
-
import { Tooltip } from 'recharts';
|
|
25
25
|
import useTooltipState from '../hooks/useTooltipState';
|
|
26
|
-
import classnames from 'classnames';
|
|
27
|
-
import { useStyles } from './styles';
|
|
28
26
|
import { useClickableStyle } from '../hooks/useClickableStyle';
|
|
27
|
+
import withPercents from '../HOCs/withPercents';
|
|
28
|
+
import { useStyles } from './styles';
|
|
29
29
|
var USA_MAP = 'https://s3.amazonaws.com/reltio-ui-files/map_resources/us-albers.json';
|
|
30
30
|
var MAP_COLORS = ['#CDE0FE', '#0160AD'];
|
|
31
31
|
export var LEGEND_WIDTH = 75;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PieChart as PieChartWidget } from 'recharts';
|
|
3
3
|
import { ChartProps } from '../types';
|
|
4
4
|
type Props = ChartProps & {
|
|
5
5
|
options?: {
|
|
6
|
-
margin?:
|
|
6
|
+
margin?: React.ComponentProps<typeof PieChartWidget>['margin'];
|
|
7
7
|
showLegend?: boolean;
|
|
8
8
|
showActiveShape?: boolean;
|
|
9
9
|
};
|
|
@@ -13,7 +13,7 @@ export declare const PieChart: ({ width, height, data, options, isDonut, onItemC
|
|
|
13
13
|
declare const _default: {
|
|
14
14
|
({ data, ...otherProps }: ChartProps & {
|
|
15
15
|
options?: {
|
|
16
|
-
margin?: Margin;
|
|
16
|
+
margin?: import("recharts/types/util/types").Margin;
|
|
17
17
|
showLegend?: boolean;
|
|
18
18
|
showActiveShape?: boolean;
|
|
19
19
|
};
|
|
@@ -17,9 +17,11 @@ import getLegendProps from '../CustomLegend/getLegendProps';
|
|
|
17
17
|
import ActiveShape from '../ActiveShape/ActiveShape';
|
|
18
18
|
import { CustomTooltip } from '../CustomTooltip/CustomTooltip';
|
|
19
19
|
import { useClickableStyle } from '../hooks/useClickableStyle';
|
|
20
|
+
import { useStyles } from './styles';
|
|
20
21
|
export var PieChart = function (_a) {
|
|
21
22
|
var width = _a.width, height = _a.height, data = _a.data, _b = _a.options, options = _b === void 0 ? {} : _b, isDonut = _a.isDonut, onItemClick = _a.onItemClick;
|
|
22
23
|
var _c = options.showLegend, showLegend = _c === void 0 ? true : _c, margin = options.margin, showActiveShape = options.showActiveShape;
|
|
24
|
+
var styles = useStyles();
|
|
23
25
|
var _d = useState(-1), activeId = _d[0], setActiveId = _d[1];
|
|
24
26
|
var onPieEnter = function (_, index) { return setActiveId(index); };
|
|
25
27
|
var onPieLeave = function () { return setActiveId(-1); };
|
|
@@ -36,6 +38,6 @@ export var PieChart = function (_a) {
|
|
|
36
38
|
color: getChartItemColor(item.label),
|
|
37
39
|
value: "".concat(item.label, " (").concat(item.percent, "%)")
|
|
38
40
|
}); }) }))),
|
|
39
|
-
React.createElement(Pie, { dataKey: "value", data: data, activeIndex: activeId, activeShape: showActiveShape ? ActiveShape : undefined, onMouseEnter: showActiveShape ? onPieEnter : undefined, onMouseLeave: showActiveShape ? onPieLeave : undefined, innerRadius: isDonut ? (showActiveShape ? '50%' : '60%') : 0, outerRadius: showActiveShape ? '70%' : '80%', onClick: onPieClick }, (data || []).map(function (entry, index) { return (React.createElement(Cell, { key: index, fill: getChartItemColor(entry.label), className: clickable })); }))));
|
|
41
|
+
React.createElement(Pie, { dataKey: "value", data: data, activeIndex: activeId, activeShape: showActiveShape ? ActiveShape : undefined, onMouseEnter: showActiveShape ? onPieEnter : undefined, onMouseLeave: showActiveShape ? onPieLeave : undefined, innerRadius: isDonut ? (showActiveShape ? '50%' : '60%') : 0, outerRadius: showActiveShape ? '70%' : '80%', onClick: onPieClick, className: styles.pie }, (data || []).map(function (entry, index) { return (React.createElement(Cell, { key: index, fill: getChartItemColor(entry.label), className: clickable })); }))));
|
|
40
42
|
};
|
|
41
43
|
export default withPercents(PieChart);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useStyles: (props?: any) => import("@mui/styles").ClassNameMap<"pie">;
|
|
@@ -9,34 +9,39 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
-
import React, { useRef } from 'react';
|
|
12
|
+
import React, { useMemo, useRef } from 'react';
|
|
13
|
+
import { nanoid } from 'nanoid';
|
|
13
14
|
import { Text, Tooltip, Treemap } from 'recharts';
|
|
14
15
|
import { CustomTooltip } from '../CustomTooltip/CustomTooltip';
|
|
15
|
-
import { useStyles } from './styles';
|
|
16
16
|
import { useClickableStyle } from '../hooks/useClickableStyle';
|
|
17
|
-
import {
|
|
17
|
+
import { useStyles } from './styles';
|
|
18
18
|
var CustomizedContent = function (_a) {
|
|
19
19
|
var x = _a.x, y = _a.y, width = _a.width, height = _a.height, label = _a.label, onClick = _a.onClick, group = _a.group;
|
|
20
20
|
var styles = useStyles();
|
|
21
21
|
var clickable = useClickableStyle(onClick);
|
|
22
22
|
var clipPathId = useRef(nanoid()).current;
|
|
23
23
|
var strokeWidth = 2;
|
|
24
|
-
|
|
24
|
+
var handleClick = function () {
|
|
25
|
+
if (!onClick)
|
|
26
|
+
return;
|
|
27
|
+
onClick(group);
|
|
28
|
+
};
|
|
29
|
+
return (React.createElement("g", { className: clickable, onClick: handleClick },
|
|
25
30
|
React.createElement("clipPath", { id: clipPathId },
|
|
26
31
|
React.createElement("rect", { x: x + strokeWidth, y: y + strokeWidth, width: Math.max(width - strokeWidth * 2, 0), height: Math.max(height - strokeWidth * 2, 0) })),
|
|
27
32
|
React.createElement("rect", { x: x, y: y, width: width, height: height, strokeWidth: strokeWidth, className: styles.treeBlock }),
|
|
28
|
-
React.createElement(Text, { clipPath: "url(#".concat(clipPathId, ")"), textAnchor:
|
|
29
|
-
};
|
|
30
|
-
var normalizeValues = function (data) {
|
|
31
|
-
var dataTotal = data.reduce(function (acc, item) { return acc + item.value; }, 0);
|
|
32
|
-
var threshold = dataTotal / (data.length * 10);
|
|
33
|
-
return data.map(function (item) {
|
|
34
|
-
return __assign(__assign({}, item), { normalizedValue: item.value < threshold ? threshold : item.value });
|
|
35
|
-
});
|
|
33
|
+
React.createElement(Text, { clipPath: "url(#".concat(clipPathId, ")"), textAnchor: "middle", verticalAnchor: "middle", width: width, x: x + width / 2, y: y + height / 2, className: styles.treeLabel }, label)));
|
|
36
34
|
};
|
|
37
35
|
var TreeChart = function (_a) {
|
|
38
36
|
var data = _a.data, width = _a.width, height = _a.height, onItemClick = _a.onItemClick;
|
|
39
|
-
|
|
37
|
+
var normalizedData = useMemo(function () {
|
|
38
|
+
var dataTotal = data.reduce(function (acc, item) { return acc + item.value; }, 0);
|
|
39
|
+
var threshold = dataTotal / (data.length * 10);
|
|
40
|
+
return data.map(function (item) {
|
|
41
|
+
return __assign(__assign({}, item), { normalizedValue: item.value < threshold ? threshold : item.value });
|
|
42
|
+
});
|
|
43
|
+
}, [data]);
|
|
44
|
+
return (React.createElement(Treemap, { dataKey: "normalizedValue", nameKey: "label", content: React.createElement(CustomizedContent, { onClick: onItemClick }), data: normalizedData, width: width, animationDuration: 500, height: height },
|
|
40
45
|
React.createElement(Tooltip, { content: React.createElement(CustomTooltip, null) })));
|
|
41
46
|
};
|
|
42
47
|
export default TreeChart;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TooltipProps } from 'recharts';
|
|
2
2
|
import { ChartData } from '../types';
|
|
3
3
|
declare const useTooltipState: () => {
|
|
4
|
-
tooltipState: TooltipProps
|
|
5
|
-
showTooltip: (data: ChartData, coordinate:
|
|
4
|
+
tooltipState: TooltipProps<number, string>;
|
|
5
|
+
showTooltip: (data: ChartData, coordinate: TooltipProps<number, string>['coordinate']) => void;
|
|
6
6
|
hideTooltip: () => void;
|
|
7
7
|
};
|
|
8
8
|
export default useTooltipState;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BarChart } from 'recharts';
|
|
2
3
|
export type BarChartOptions = {
|
|
3
|
-
margin?:
|
|
4
|
+
margin?: React.ComponentProps<typeof BarChart>['margin'];
|
|
4
5
|
isLabelRotated?: boolean;
|
|
5
6
|
isHorizontal?: boolean;
|
|
6
7
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reltio/components",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.1684",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE FILE",
|
|
5
5
|
"main": "./cjs/index.js",
|
|
6
6
|
"module": "./esm/index.js",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"@date-io/moment": "^1.3.5",
|
|
9
9
|
"@fluentui/react-context-selector": "^9.1.26",
|
|
10
10
|
"@react-google-maps/api": "2.7.0",
|
|
11
|
-
"@reltio/mdm-sdk": "^1.4.
|
|
11
|
+
"@reltio/mdm-sdk": "^1.4.1684",
|
|
12
12
|
"classnames": "^2.2.5",
|
|
13
13
|
"d3-cloud": "^1.2.5",
|
|
14
14
|
"d3-geo": "^2.0.1",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"react-split-pane": "^0.1.89",
|
|
35
35
|
"react-virtualized": "^9.21.2",
|
|
36
36
|
"react-window": "^1.8.5",
|
|
37
|
-
"recharts": "^
|
|
37
|
+
"recharts": "^2.8.0",
|
|
38
38
|
"sanitize-html": "2.7.1",
|
|
39
39
|
"ui-i18n": "bitbucket:reltio-ondemand/ui-i18n#v1.4.0"
|
|
40
40
|
},
|