@alfalab/core-components-chart 3.1.0 → 3.1.2
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/Component.js +18 -21
- package/components/Dot/index.css +8 -8
- package/components/Dot/index.js +1 -1
- package/components/Legends/index.css +8 -8
- package/components/Legends/index.d.ts +1 -1
- package/components/Legends/index.js +3 -2
- package/components/LinearGradient.d.ts +1 -1
- package/components/RectBar.js +2 -7
- package/components/Tick/index.css +4 -4
- package/components/Tick/index.js +2 -4
- package/components/TooltipContent/index.css +7 -7
- package/components/TooltipContent/index.js +1 -1
- package/cssm/Component.js +20 -23
- package/cssm/components/Legends/index.d.ts +1 -1
- package/cssm/components/Legends/index.js +2 -1
- package/cssm/components/LinearGradient.d.ts +1 -1
- package/cssm/components/RectBar.js +2 -7
- package/cssm/components/Tick/index.js +1 -3
- package/cssm/hooks/useSettings/index.d.ts +14 -11
- package/cssm/hooks/useSettings/index.js +1 -1
- package/cssm/hooks/useSettings/utils/setComposedChartsMargin.d.ts +2 -2
- package/cssm/hooks/useSettings/utils/setComposedChartsMargin.js +2 -2
- package/cssm/hooks/useSettings/utils/setDatas.d.ts +2 -3
- package/cssm/hooks/useSettings/utils/setDatas.js +2 -2
- package/cssm/hooks/useSettings/utils/setGradientCharts.js +1 -1
- package/cssm/hooks/useSettings/utils/setLegendMargin.d.ts +1 -1
- package/cssm/icons/CircleLine.d.ts +1 -1
- package/cssm/index.js +14 -14
- package/cssm/{tslib.es6-2be2aee7.d.ts → tslib.es6-0de342ae.d.ts} +8 -4
- package/{tslib.es6-e232afa5.js → cssm/tslib.es6-0de342ae.js} +1 -1
- package/cssm/types/chart.types.d.ts +1 -1
- package/cssm/types/options.types.d.ts +2 -2
- package/cssm/types/seria.types.d.ts +2 -2
- package/cssm/types/tooltip.types.d.ts +1 -1
- package/esm/Component.js +18 -21
- package/esm/components/Dot/index.css +8 -8
- package/esm/components/Dot/index.js +1 -1
- package/esm/components/Legends/index.css +8 -8
- package/esm/components/Legends/index.d.ts +1 -1
- package/esm/components/Legends/index.js +3 -2
- package/esm/components/LinearGradient.d.ts +1 -1
- package/esm/components/RectBar.js +2 -7
- package/esm/components/Tick/index.css +4 -4
- package/esm/components/Tick/index.js +2 -4
- package/esm/components/TooltipContent/index.css +7 -7
- package/esm/components/TooltipContent/index.js +1 -1
- package/esm/hooks/useSettings/index.d.ts +14 -11
- package/esm/hooks/useSettings/index.js +1 -1
- package/esm/hooks/useSettings/utils/setComposedChartsMargin.d.ts +2 -2
- package/esm/hooks/useSettings/utils/setComposedChartsMargin.js +2 -2
- package/esm/hooks/useSettings/utils/setDatas.d.ts +2 -3
- package/esm/hooks/useSettings/utils/setDatas.js +2 -2
- package/esm/hooks/useSettings/utils/setGradientCharts.js +1 -1
- package/esm/hooks/useSettings/utils/setLegendMargin.d.ts +1 -1
- package/esm/icons/CircleLine.d.ts +1 -1
- package/esm/index.css +5 -5
- package/esm/index.js +11 -11
- package/{tslib.es6-e232afa5.d.ts → esm/tslib.es6-efd85325.d.ts} +8 -4
- package/esm/{tslib.es6-f1220da2.js → tslib.es6-efd85325.js} +1 -1
- package/esm/types/chart.types.d.ts +1 -1
- package/esm/types/options.types.d.ts +2 -2
- package/esm/types/seria.types.d.ts +2 -2
- package/esm/types/tooltip.types.d.ts +1 -1
- package/hooks/useSettings/index.d.ts +14 -11
- package/hooks/useSettings/index.js +1 -1
- package/hooks/useSettings/utils/setComposedChartsMargin.d.ts +2 -2
- package/hooks/useSettings/utils/setComposedChartsMargin.js +2 -2
- package/hooks/useSettings/utils/setDatas.d.ts +2 -3
- package/hooks/useSettings/utils/setDatas.js +2 -2
- package/hooks/useSettings/utils/setGradientCharts.js +1 -1
- package/hooks/useSettings/utils/setLegendMargin.d.ts +1 -1
- package/icons/CircleLine.d.ts +1 -1
- package/index.css +5 -5
- package/index.js +11 -11
- package/modern/Component.js +31 -35
- package/modern/components/Dot/index.css +8 -8
- package/modern/components/Dot/index.js +2 -2
- package/modern/components/Legends/index.css +8 -8
- package/modern/components/Legends/index.d.ts +1 -1
- package/modern/components/Legends/index.js +1 -1
- package/modern/components/LinearGradient.d.ts +1 -1
- package/modern/components/LinearGradient.js +1 -3
- package/modern/components/RectBar.js +3 -8
- package/modern/components/Tick/index.css +4 -4
- package/modern/components/Tick/index.js +2 -4
- package/modern/components/TooltipContent/index.css +7 -7
- package/modern/components/TooltipContent/index.js +1 -1
- package/modern/hooks/useSettings/index.d.ts +14 -11
- package/modern/hooks/useSettings/utils/setComposedChartsMargin.d.ts +2 -2
- package/modern/hooks/useSettings/utils/setComposedChartsMargin.js +10 -12
- package/modern/hooks/useSettings/utils/setDatas.d.ts +2 -3
- package/modern/hooks/useSettings/utils/setDatas.js +1 -1
- package/modern/hooks/useSettings/utils/setGradientCharts.js +1 -1
- package/modern/hooks/useSettings/utils/setLegendMargin.d.ts +1 -1
- package/modern/hooks/useSettings/utils/sortByIndex.js +6 -8
- package/modern/icons/Circle.js +2 -4
- package/modern/icons/CircleLine.d.ts +1 -1
- package/modern/icons/CircleLine.js +3 -5
- package/modern/icons/FilledCircle.js +6 -8
- package/modern/icons/StrokeCircle.js +2 -4
- package/modern/index.css +5 -5
- package/modern/index.js +10 -10
- package/modern/types/chart.types.d.ts +1 -1
- package/modern/types/options.types.d.ts +2 -2
- package/modern/types/seria.types.d.ts +2 -2
- package/modern/types/tooltip.types.d.ts +1 -1
- package/package.json +2 -2
- package/send-stats.js +1 -1
- package/{esm/tslib.es6-f1220da2.d.ts → tslib.es6-806ac05c.d.ts} +8 -4
- package/{cssm/tslib.es6-2be2aee7.js → tslib.es6-806ac05c.js} +1 -1
- package/types/chart.types.d.ts +1 -1
- package/types/options.types.d.ts +2 -2
- package/types/seria.types.d.ts +2 -2
- package/types/tooltip.types.d.ts +1 -1
package/esm/index.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import './tslib.es6-
|
|
1
|
+
import './tslib.es6-efd85325.js';
|
|
2
2
|
import 'react';
|
|
3
3
|
import 'classnames';
|
|
4
4
|
import 'recharts';
|
|
5
|
-
|
|
6
|
-
import './
|
|
5
|
+
import './hooks/usePathBar/utils/getRadius.js';
|
|
6
|
+
import './hooks/usePathBar/index.js';
|
|
7
|
+
import './components/CustomizedLabel.js';
|
|
8
|
+
import './icons/Point.js';
|
|
9
|
+
import './components/Dot/index.js';
|
|
7
10
|
import '@alfalab/core-components-typography/esm';
|
|
8
11
|
import './icons/Circle.js';
|
|
9
12
|
import './icons/CircleLine.js';
|
|
10
13
|
import './icons/FilledCircle.js';
|
|
11
14
|
import './icons/StrokeCircle.js';
|
|
12
15
|
import './components/Legends/index.js';
|
|
13
|
-
import './
|
|
14
|
-
import './components/
|
|
16
|
+
import './components/LinearGradient.js';
|
|
17
|
+
import './components/RectBar.js';
|
|
18
|
+
import './components/Tick/index.js';
|
|
19
|
+
import './components/TooltipContent/index.js';
|
|
20
|
+
export { Chart } from './Component.js';
|
|
15
21
|
import './hooks/useSettings/utils/setComposedChartsMargin.js';
|
|
16
22
|
import './hooks/useSettings/utils/setDatas.js';
|
|
17
23
|
import './hooks/useSettings/utils/setGradientCharts.js';
|
|
18
24
|
import './hooks/useSettings/utils/setLegendMargin.js';
|
|
19
25
|
import './hooks/useSettings/utils/sortByIndex.js';
|
|
20
26
|
import './hooks/useSettings/index.js';
|
|
21
|
-
import './hooks/usePathBar/utils/getRadius.js';
|
|
22
|
-
import './hooks/usePathBar/index.js';
|
|
23
|
-
import './components/CustomizedLabel.js';
|
|
24
|
-
import './components/RectBar.js';
|
|
25
|
-
import './components/Tick/index.js';
|
|
26
|
-
import './components/TooltipContent/index.js';
|
|
@@ -12,9 +12,12 @@ declare function __generator(thisArg: any, body: any): {
|
|
|
12
12
|
declare function __exportStar(m: any, o: any): void;
|
|
13
13
|
declare function __values(o: any): any;
|
|
14
14
|
declare function __read(o: any, n: any): any;
|
|
15
|
+
/** @deprecated */
|
|
15
16
|
declare function __spread(...args: any[]): any[];
|
|
17
|
+
/** @deprecated */
|
|
16
18
|
declare function __spreadArrays(...args: any[]): any[];
|
|
17
|
-
declare function
|
|
19
|
+
declare function __spreadArray(to: any, from: any, pack: any, ...args: any[]): any;
|
|
20
|
+
declare function __await(v: any): __await;
|
|
18
21
|
declare class __await {
|
|
19
22
|
constructor(v: any);
|
|
20
23
|
v: any;
|
|
@@ -25,8 +28,9 @@ declare function __asyncValues(o: any): any;
|
|
|
25
28
|
declare function __makeTemplateObject(cooked: any, raw: any): any;
|
|
26
29
|
declare function __importStar(mod: any): any;
|
|
27
30
|
declare function __importDefault(mod: any): any;
|
|
28
|
-
declare function __classPrivateFieldGet(receiver: any,
|
|
29
|
-
declare function __classPrivateFieldSet(receiver: any,
|
|
31
|
+
declare function __classPrivateFieldGet(receiver: any, state: any, kind: any, f: any): any;
|
|
32
|
+
declare function __classPrivateFieldSet(receiver: any, state: any, value: any, kind: any, f: any): any;
|
|
33
|
+
declare function __classPrivateFieldIn(state: any, receiver: any): any;
|
|
30
34
|
declare function __assign(...args: any[]): any;
|
|
31
35
|
declare function __createBinding(o: any, m: any, k: any, k2: any): void;
|
|
32
|
-
export { __extends, __rest, __decorate, __param, __metadata, __awaiter, __generator, __exportStar, __values, __read, __spread, __spreadArrays, __await, __asyncGenerator, __asyncDelegator, __asyncValues, __makeTemplateObject, __importStar, __importDefault, __classPrivateFieldGet, __classPrivateFieldSet, __assign, __createBinding };
|
|
36
|
+
export { __extends, __rest, __decorate, __param, __metadata, __awaiter, __generator, __exportStar, __values, __read, __spread, __spreadArrays, __spreadArray, __await, __asyncGenerator, __asyncDelegator, __asyncValues, __makeTemplateObject, __importStar, __importDefault, __classPrivateFieldGet, __classPrivateFieldSet, __classPrivateFieldIn, __assign, __createBinding };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/******************************************************************************
|
|
2
2
|
Copyright (c) Microsoft Corporation.
|
|
3
3
|
|
|
4
4
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
2
|
import { RectangleProps } from 'recharts';
|
|
3
3
|
import { DataKey } from 'recharts/types/util/types';
|
|
4
|
-
import { DotSettingProps } from "./utils/dot.types";
|
|
5
4
|
import { DataProps } from "./utils/data.types";
|
|
5
|
+
import { DotSettingProps } from "./utils/dot.types";
|
|
6
6
|
type CurveType = 'linear' | 'monotone' | 'step';
|
|
7
7
|
type RectangleShapeType = ReactElement<SVGElement> | ((props: any) => ReactElement<SVGElement>) | RectangleProps | boolean;
|
|
8
8
|
interface ChartProps {
|
|
@@ -4,11 +4,11 @@ import { BrushProps } from "./brush.types";
|
|
|
4
4
|
import { CartesianGridProps } from "./cartesianGrid.types";
|
|
5
5
|
import { ComposedChartProps } from "./composedChart.types";
|
|
6
6
|
import { LegendProps } from "./legend.types";
|
|
7
|
+
import { ResponsiveContainerProps } from "./responsiveContainer.types";
|
|
8
|
+
import { SeriaProps } from "./seria.types";
|
|
7
9
|
import { TooltipProps } from "./tooltip.types";
|
|
8
10
|
import { XAxisProps } from "./xAxis.types";
|
|
9
11
|
import { YAxisProps } from "./yAxis.types";
|
|
10
|
-
import { SeriaProps } from "./seria.types";
|
|
11
|
-
import { ResponsiveContainerProps } from "./responsiveContainer.types";
|
|
12
12
|
interface OptionsProps {
|
|
13
13
|
/**
|
|
14
14
|
* Индефикатор графика
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ChartProps } from "./chart.types";
|
|
2
|
-
import { LabelListProps } from "./labelList.types";
|
|
3
1
|
import { DataProps } from "./utils/data.types";
|
|
4
2
|
import { GradientProps } from "./utils/gradient.types";
|
|
3
|
+
import { ChartProps } from "./chart.types";
|
|
4
|
+
import { LabelListProps } from "./labelList.types";
|
|
5
5
|
type RadiusProp = {
|
|
6
6
|
top?: number;
|
|
7
7
|
bottom?: number;
|
|
@@ -57,7 +57,7 @@ interface TooltipProps {
|
|
|
57
57
|
/**
|
|
58
58
|
* Стиль метки всплывающей подсказки по умолчанию, которая является элементом p.
|
|
59
59
|
*/
|
|
60
|
-
labelStyle?:
|
|
60
|
+
labelStyle?: Record<string, unknown>;
|
|
61
61
|
/**
|
|
62
62
|
* Значение метки, которое сейчас активно, обычно рассчитывается внутри компании.
|
|
63
63
|
*/
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import { Dispatch, SetStateAction } from 'react';
|
|
2
2
|
import { OptionsProps } from "../../types/options.types";
|
|
3
3
|
import { DataDynamicBooleanProps, DataDynamicProps } from "../../types/utils/data.types";
|
|
4
|
-
type Settings = [
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
4
|
+
type Settings = [
|
|
5
|
+
{
|
|
6
|
+
state: OptionsProps | null;
|
|
7
|
+
data: DataDynamicProps[];
|
|
8
|
+
charts: DataDynamicBooleanProps;
|
|
9
|
+
filterCount: number;
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
setState: Dispatch<SetStateAction<OptionsProps | null>>;
|
|
13
|
+
setData: Dispatch<SetStateAction<DataDynamicProps[]>>;
|
|
14
|
+
setCharts: Dispatch<SetStateAction<DataDynamicBooleanProps>>;
|
|
15
|
+
setFilterCount: Dispatch<SetStateAction<number>>;
|
|
16
|
+
}
|
|
17
|
+
];
|
|
15
18
|
declare const useSettings: (options: OptionsProps) => Settings;
|
|
16
19
|
export { useSettings };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var tslib_es6 = require('../../tslib.es6-
|
|
5
|
+
var tslib_es6 = require('../../tslib.es6-806ac05c.js');
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var hooks_useSettings_utils_setComposedChartsMargin = require('./utils/setComposedChartsMargin.js');
|
|
8
8
|
var hooks_useSettings_utils_setDatas = require('./utils/setDatas.js');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { XAxisProps } from "../../../types/xAxis.types";
|
|
2
1
|
import { BrushProps } from "../../../types/brush.types";
|
|
3
|
-
import { LegendProps } from "../../../types/legend.types";
|
|
4
2
|
import { ComposedChartProps } from "../../../types/composedChart.types";
|
|
3
|
+
import { LegendProps } from "../../../types/legend.types";
|
|
4
|
+
import { XAxisProps } from "../../../types/xAxis.types";
|
|
5
5
|
type ComposedChartsMarginResultProps = {
|
|
6
6
|
top: number;
|
|
7
7
|
bottom: number;
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var setComposedChartsMargin = function (composeChart, legend, brush, xAxis) {
|
|
6
6
|
var _a, _b, _c, _d;
|
|
7
|
-
return {
|
|
7
|
+
return ({
|
|
8
8
|
top: (((_a = composeChart === null || composeChart === void 0 ? void 0 : composeChart.initMargin) === null || _a === void 0 ? void 0 : _a.top) || 0) +
|
|
9
9
|
((legend === null || legend === void 0 ? void 0 : legend.verticalAlign) === 'top' && (legend === null || legend === void 0 ? void 0 : legend.marginTop) ? Math.abs(legend.marginTop) : 0),
|
|
10
10
|
bottom: (((_b = composeChart === null || composeChart === void 0 ? void 0 : composeChart.initMargin) === null || _b === void 0 ? void 0 : _b.bottom) || 0) +
|
|
@@ -13,7 +13,7 @@ var setComposedChartsMargin = function (composeChart, legend, brush, xAxis) {
|
|
|
13
13
|
((legend === null || legend === void 0 ? void 0 : legend.verticalAlign) !== 'top' && (legend === null || legend === void 0 ? void 0 : legend.marginTop) ? legend.marginTop : 0),
|
|
14
14
|
left: ((_c = composeChart === null || composeChart === void 0 ? void 0 : composeChart.initMargin) === null || _c === void 0 ? void 0 : _c.left) || 0,
|
|
15
15
|
right: ((_d = composeChart === null || composeChart === void 0 ? void 0 : composeChart.initMargin) === null || _d === void 0 ? void 0 : _d.right) || 0,
|
|
16
|
-
};
|
|
16
|
+
});
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
exports.setComposedChartsMargin = setComposedChartsMargin;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { DataDynamicBooleanProps, DataDynamicProps } from "../../../types/utils/data.types";
|
|
3
1
|
import { SeriaProps } from "../../../types/seria.types";
|
|
2
|
+
import { DataDynamicBooleanProps, DataDynamicProps } from "../../../types/utils/data.types";
|
|
4
3
|
type DatasResultProps = [DataDynamicProps[], DataDynamicBooleanProps, number];
|
|
5
|
-
declare const setDatas: (series: SeriaProps[], labels:
|
|
4
|
+
declare const setDatas: (series: SeriaProps[], labels: Array<string | number>) => DatasResultProps;
|
|
6
5
|
export { setDatas };
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var tslib_es6 = require('../../../tslib.es6-
|
|
5
|
+
var tslib_es6 = require('../../../tslib.es6-806ac05c.js');
|
|
6
6
|
|
|
7
7
|
var setDatas = function (series, labels) {
|
|
8
8
|
var initData = [];
|
|
9
9
|
var chartsNames = {};
|
|
10
10
|
var count = 0;
|
|
11
11
|
var _loop_1 = function (i) {
|
|
12
|
-
var _a = series[i], _b = _a.properties, _c =
|
|
12
|
+
var _a = series[i], _b = _a.properties, _c = _b === void 0 ? {} : _b, _d = _c.dataKey, dataKey = _d === void 0 ? '' : _d, _e = _a.data, seriaData = _e === void 0 ? [] : _e, hideLegend = _a.hideLegend, hide = _a.hide;
|
|
13
13
|
if (!hideLegend && !hide)
|
|
14
14
|
count += 1;
|
|
15
15
|
labels.map(function (label) {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var tslib_es6 = require('../../../tslib.es6-
|
|
5
|
+
var tslib_es6 = require('../../../tslib.es6-806ac05c.js');
|
|
6
6
|
|
|
7
7
|
var setGradientCharts = function (series) {
|
|
8
8
|
var filterSeries = series.filter(function (item) { return item.chart !== 'gradient'; });
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LegendProps } from "../../../types/legend.types";
|
|
2
1
|
import { BrushProps } from "../../../types/brush.types";
|
|
2
|
+
import { LegendProps } from "../../../types/legend.types";
|
|
3
3
|
declare const setLegendMargin: (brush: BrushProps, legend: LegendProps) => number;
|
|
4
4
|
export { setLegendMargin };
|
package/icons/CircleLine.d.ts
CHANGED
|
@@ -4,5 +4,5 @@ type Props = {
|
|
|
4
4
|
fill?: string;
|
|
5
5
|
height?: number;
|
|
6
6
|
};
|
|
7
|
-
declare const CircleLineIcon: ({ fill, height }: Props) => React.ReactElement
|
|
7
|
+
declare const CircleLineIcon: ({ fill, height }: Props) => React.ReactElement;
|
|
8
8
|
export { CircleLineIcon };
|
package/index.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 128of */
|
|
2
2
|
:root {
|
|
3
3
|
--color-light-text-primary: #0b1f35;
|
|
4
4
|
}
|
|
@@ -10,17 +10,17 @@
|
|
|
10
10
|
|
|
11
11
|
/* Hard up */
|
|
12
12
|
}
|
|
13
|
-
.
|
|
13
|
+
.chart__coreChart_tioz0 .recharts-line path {
|
|
14
14
|
transition: d 0.2s ease-out;
|
|
15
15
|
}
|
|
16
|
-
.
|
|
16
|
+
.chart__coreChart_tioz0 .recharts-text tspan {
|
|
17
17
|
fill: var(--color-light-text-primary);
|
|
18
18
|
font-size: 16px;
|
|
19
19
|
line-height: 22px;
|
|
20
20
|
}
|
|
21
|
-
.
|
|
21
|
+
.chart__bar_tioz0 {
|
|
22
22
|
transition: opacity 0.2s ease-out, d 0.2s ease-out;
|
|
23
23
|
}
|
|
24
|
-
.
|
|
24
|
+
.chart__unfocused_tioz0 {
|
|
25
25
|
opacity: 0.3;
|
|
26
26
|
}
|
package/index.js
CHANGED
|
@@ -2,32 +2,32 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
require('./tslib.es6-
|
|
5
|
+
require('./tslib.es6-806ac05c.js');
|
|
6
6
|
require('react');
|
|
7
7
|
require('classnames');
|
|
8
8
|
require('recharts');
|
|
9
|
-
|
|
10
|
-
require('./
|
|
9
|
+
require('./hooks/usePathBar/utils/getRadius.js');
|
|
10
|
+
require('./hooks/usePathBar/index.js');
|
|
11
|
+
require('./components/CustomizedLabel.js');
|
|
12
|
+
require('./icons/Point.js');
|
|
13
|
+
require('./components/Dot/index.js');
|
|
11
14
|
require('@alfalab/core-components-typography');
|
|
12
15
|
require('./icons/Circle.js');
|
|
13
16
|
require('./icons/CircleLine.js');
|
|
14
17
|
require('./icons/FilledCircle.js');
|
|
15
18
|
require('./icons/StrokeCircle.js');
|
|
16
19
|
require('./components/Legends/index.js');
|
|
17
|
-
require('./
|
|
18
|
-
require('./components/
|
|
20
|
+
require('./components/LinearGradient.js');
|
|
21
|
+
require('./components/RectBar.js');
|
|
22
|
+
require('./components/Tick/index.js');
|
|
23
|
+
require('./components/TooltipContent/index.js');
|
|
24
|
+
var Component = require('./Component.js');
|
|
19
25
|
require('./hooks/useSettings/utils/setComposedChartsMargin.js');
|
|
20
26
|
require('./hooks/useSettings/utils/setDatas.js');
|
|
21
27
|
require('./hooks/useSettings/utils/setGradientCharts.js');
|
|
22
28
|
require('./hooks/useSettings/utils/setLegendMargin.js');
|
|
23
29
|
require('./hooks/useSettings/utils/sortByIndex.js');
|
|
24
30
|
require('./hooks/useSettings/index.js');
|
|
25
|
-
require('./hooks/usePathBar/utils/getRadius.js');
|
|
26
|
-
require('./hooks/usePathBar/index.js');
|
|
27
|
-
require('./components/CustomizedLabel.js');
|
|
28
|
-
require('./components/RectBar.js');
|
|
29
|
-
require('./components/Tick/index.js');
|
|
30
|
-
require('./components/TooltipContent/index.js');
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
|
package/modern/Component.js
CHANGED
|
@@ -1,36 +1,34 @@
|
|
|
1
1
|
import React, { useState, useRef, useMemo, useCallback, useEffect } from 'react';
|
|
2
2
|
import cn from 'classnames';
|
|
3
3
|
import { Legend, CartesianGrid, XAxis, YAxis, Brush, Tooltip, Area, Line, Bar, LabelList, Cell, ResponsiveContainer, ComposedChart } from 'recharts';
|
|
4
|
-
import
|
|
4
|
+
import './hooks/usePathBar/utils/getRadius.js';
|
|
5
|
+
import './hooks/usePathBar/index.js';
|
|
6
|
+
import { CustomizedLabel } from './components/CustomizedLabel.js';
|
|
7
|
+
import './icons/Point.js';
|
|
8
|
+
import { Dot } from './components/Dot/index.js';
|
|
5
9
|
import '@alfalab/core-components-typography/modern';
|
|
6
10
|
import './icons/Circle.js';
|
|
7
11
|
import './icons/CircleLine.js';
|
|
8
12
|
import './icons/FilledCircle.js';
|
|
9
13
|
import './icons/StrokeCircle.js';
|
|
10
14
|
import { Legends } from './components/Legends/index.js';
|
|
11
|
-
import './
|
|
12
|
-
import {
|
|
15
|
+
import { LinearGradient } from './components/LinearGradient.js';
|
|
16
|
+
import { RectBar } from './components/RectBar.js';
|
|
17
|
+
import { Tick } from './components/Tick/index.js';
|
|
18
|
+
import { TooltipContent } from './components/TooltipContent/index.js';
|
|
13
19
|
import './hooks/useSettings/utils/setComposedChartsMargin.js';
|
|
14
20
|
import './hooks/useSettings/utils/setDatas.js';
|
|
15
21
|
import './hooks/useSettings/utils/setGradientCharts.js';
|
|
16
22
|
import './hooks/useSettings/utils/setLegendMargin.js';
|
|
17
23
|
import './hooks/useSettings/utils/sortByIndex.js';
|
|
18
24
|
import { useSettings } from './hooks/useSettings/index.js';
|
|
19
|
-
import './hooks/usePathBar/utils/getRadius.js';
|
|
20
|
-
import './hooks/usePathBar/index.js';
|
|
21
|
-
import { CustomizedLabel } from './components/CustomizedLabel.js';
|
|
22
|
-
import { RectBar } from './components/RectBar.js';
|
|
23
|
-
import { Tick } from './components/Tick/index.js';
|
|
24
|
-
import { TooltipContent } from './components/TooltipContent/index.js';
|
|
25
25
|
|
|
26
26
|
const CustomizedHOC = (Component, options) => {
|
|
27
|
-
const NewComponent = props => {
|
|
28
|
-
return React.createElement(Component, Object.assign({}, props, options));
|
|
29
|
-
};
|
|
27
|
+
const NewComponent = (props) => React.createElement(Component, { ...props, ...options });
|
|
30
28
|
return NewComponent;
|
|
31
29
|
};
|
|
32
30
|
|
|
33
|
-
var styles = {"coreChart":"
|
|
31
|
+
var styles = {"coreChart":"chart__coreChart_tioz0","bar":"chart__bar_tioz0","unfocused":"chart__unfocused_tioz0"};
|
|
34
32
|
require('./index.css')
|
|
35
33
|
|
|
36
34
|
const Chart = (props) => {
|
|
@@ -61,11 +59,11 @@ const Chart = (props) => {
|
|
|
61
59
|
let changed = false;
|
|
62
60
|
if (charts[`${dataKey}`] && filterCount > 1) {
|
|
63
61
|
changed = true;
|
|
64
|
-
setFilterCount(prev => prev - 1);
|
|
62
|
+
setFilterCount((prev) => prev - 1);
|
|
65
63
|
}
|
|
66
64
|
if (!charts[`${dataKey}`]) {
|
|
67
65
|
changed = true;
|
|
68
|
-
setFilterCount(prev => prev + 1);
|
|
66
|
+
setFilterCount((prev) => prev + 1);
|
|
69
67
|
}
|
|
70
68
|
if (!changed)
|
|
71
69
|
return;
|
|
@@ -91,14 +89,14 @@ const Chart = (props) => {
|
|
|
91
89
|
const translate = state?.xAxis?.tickMargin && state?.legend?.verticalAlign !== 'top'
|
|
92
90
|
? state.xAxis.tickMargin + (state?.brush?.brushMargin || 0)
|
|
93
91
|
: 0;
|
|
94
|
-
return (React.createElement(Legend,
|
|
92
|
+
return (React.createElement(Legend, { ...(state.legend || null), content: React.createElement(Legends, { legend: state.legend, series: state.series, id: state.id, toggleChart: toggleChart, ref: legendRef, charts: charts }), wrapperStyle: {
|
|
95
93
|
transform: `translateY(${translate}px)`,
|
|
96
|
-
} }))
|
|
94
|
+
} }));
|
|
97
95
|
}, [state, charts, toggleChart, legendRef]);
|
|
98
96
|
const renderCartesianGrid = useMemo(() => {
|
|
99
97
|
if (!state?.cartesianGrid)
|
|
100
98
|
return null;
|
|
101
|
-
return React.createElement(CartesianGrid,
|
|
99
|
+
return React.createElement(CartesianGrid, { ...state.cartesianGrid });
|
|
102
100
|
}, [state]);
|
|
103
101
|
const renderXAxis = useMemo(() => {
|
|
104
102
|
if (!state?.xAxis)
|
|
@@ -113,7 +111,7 @@ const Chart = (props) => {
|
|
|
113
111
|
else {
|
|
114
112
|
tick = true;
|
|
115
113
|
}
|
|
116
|
-
return React.createElement(XAxis,
|
|
114
|
+
return React.createElement(XAxis, { ...state.xAxis, tick: tick });
|
|
117
115
|
}, [state]);
|
|
118
116
|
const renderYAxis = useMemo(() => {
|
|
119
117
|
if (!state?.yAxis)
|
|
@@ -128,17 +126,17 @@ const Chart = (props) => {
|
|
|
128
126
|
else {
|
|
129
127
|
tick = true;
|
|
130
128
|
}
|
|
131
|
-
return React.createElement(YAxis,
|
|
129
|
+
return React.createElement(YAxis, { ...state.yAxis, tick: tick });
|
|
132
130
|
}, [state]);
|
|
133
131
|
const renderBrush = useMemo(() => {
|
|
134
132
|
if (!state?.brush)
|
|
135
133
|
return null;
|
|
136
|
-
return React.createElement(Brush,
|
|
134
|
+
return React.createElement(Brush, { y: typeof yBrush === 'number' ? yBrush : 0, ...state.brush });
|
|
137
135
|
}, [state, yBrush]);
|
|
138
136
|
const renderTooltip = useMemo(() => {
|
|
139
137
|
if (!state?.tooltip)
|
|
140
138
|
return null;
|
|
141
|
-
return (React.createElement(Tooltip,
|
|
139
|
+
return (React.createElement(Tooltip, { ref: tooltipRef, ...state.tooltip, content: CustomizedHOC(TooltipContent, { series: state.series, tooltipArrowSide }) }));
|
|
142
140
|
}, [state, tooltipArrowSide]);
|
|
143
141
|
const renderChartsItems = useMemo(() => {
|
|
144
142
|
if (!state || !charts)
|
|
@@ -148,8 +146,8 @@ const Chart = (props) => {
|
|
|
148
146
|
const show = charts[`${properties.dataKey}`];
|
|
149
147
|
switch (chart) {
|
|
150
148
|
case 'bar':
|
|
151
|
-
return show && !item?.hide ? (React.createElement(Bar,
|
|
152
|
-
labelList && (React.createElement(LabelList,
|
|
149
|
+
return show && !item?.hide ? (React.createElement(Bar, { key: `${state.id}-${properties.dataKey}`, ...properties, shape: React.createElement(RectBar, { radius: radius }) },
|
|
150
|
+
labelList && (React.createElement(LabelList, { dataKey: properties.dataKey.toString(), ...labelList, content: React.createElement(CustomizedLabel, { radius: radius }) })),
|
|
153
151
|
data.map((_, index) => {
|
|
154
152
|
const key = `${state.id}-${properties.dataKey}-${index}`;
|
|
155
153
|
return (React.createElement(Cell, { key: key, className: cn(styles.bar, typeof activeDotsState.active === 'number' &&
|
|
@@ -159,7 +157,7 @@ const Chart = (props) => {
|
|
|
159
157
|
}))) : null;
|
|
160
158
|
case 'area':
|
|
161
159
|
case 'line':
|
|
162
|
-
return show && !item?.hide ? (React.createElement(Line,
|
|
160
|
+
return show && !item?.hide ? (React.createElement(Line, { key: `${state.id}-${properties.dataKey}`, ...properties, dot: properties.dot && properties.dotSettings
|
|
163
161
|
? CustomizedHOC(Dot, {
|
|
164
162
|
activeDot: activeDotsState.active,
|
|
165
163
|
dotSettings: properties.dotSettings,
|
|
@@ -167,11 +165,11 @@ const Chart = (props) => {
|
|
|
167
165
|
? properties.inheritStroke
|
|
168
166
|
: false,
|
|
169
167
|
})
|
|
170
|
-
: false, activeDot: false }))
|
|
168
|
+
: false, activeDot: false })) : null;
|
|
171
169
|
case 'gradient':
|
|
172
|
-
return show && !item?.hide ? (React.createElement(Area,
|
|
170
|
+
return show && !item?.hide ? (React.createElement(Area, { ...item.properties, key: `${state.id}-${item.properties.dataKey}`, dataKey: `${item.properties.dataKey}`, stroke: 'transparent', fill: item.gradient.gid
|
|
173
171
|
? `url(#${state.id}-${item.gradient.gid})`
|
|
174
|
-
: item.properties.fill, dot: false, activeDot: false }))
|
|
172
|
+
: item.properties.fill, dot: false, activeDot: false })) : null;
|
|
175
173
|
default:
|
|
176
174
|
return null;
|
|
177
175
|
}
|
|
@@ -229,12 +227,10 @@ const Chart = (props) => {
|
|
|
229
227
|
});
|
|
230
228
|
}
|
|
231
229
|
if (typeof activeTooltipIndex === 'number' && typeof activeDotsState.prev === 'number') {
|
|
232
|
-
setActiveDotsState((prev) => {
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
};
|
|
237
|
-
});
|
|
230
|
+
setActiveDotsState((prev) => ({
|
|
231
|
+
prev: prev.active,
|
|
232
|
+
active: activeTooltipIndex,
|
|
233
|
+
}));
|
|
238
234
|
}
|
|
239
235
|
};
|
|
240
236
|
const mouseMove = (e) => {
|
|
@@ -253,7 +249,7 @@ const Chart = (props) => {
|
|
|
253
249
|
return null;
|
|
254
250
|
return (React.createElement("div", { className: styles.coreChart, ref: svgRef, id: state?.id || '', style: { width: '100%', height: '100%' } },
|
|
255
251
|
React.createElement(ResponsiveContainer, { debounce: state?.responsiveContainer?.debounce ? state.responsiveContainer.debounce : 0, width: '100%' },
|
|
256
|
-
React.createElement(ComposedChart,
|
|
252
|
+
React.createElement(ComposedChart, { ...state?.composeChart, onMouseMove: mouseMove, onMouseLeave: mouseLeave, data: data },
|
|
257
253
|
React.createElement("defs", null, renderGradient),
|
|
258
254
|
state.cartesianGrid && renderCartesianGrid,
|
|
259
255
|
state.xAxis && renderXAxis,
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
/* hash:
|
|
2
|
-
.
|
|
1
|
+
/* hash: c2x5b */
|
|
2
|
+
.chart__dotUnfocused_8wcu4 {
|
|
3
3
|
opacity: 0.3;
|
|
4
4
|
}
|
|
5
5
|
|
|
6
|
-
.
|
|
7
|
-
.
|
|
8
|
-
.
|
|
6
|
+
.chart__dot_8wcu4,
|
|
7
|
+
.chart__dotItem_8wcu4,
|
|
8
|
+
.chart__dotWrap_8wcu4 {
|
|
9
9
|
transition: all 0.2s ease;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
.
|
|
13
|
-
animation:
|
|
12
|
+
.chart__dot_8wcu4 {
|
|
13
|
+
animation: chart__showDot_8wcu4 0.5s ease;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
@keyframes
|
|
16
|
+
@keyframes chart__showDot_8wcu4 {
|
|
17
17
|
from {
|
|
18
18
|
opacity: 0;
|
|
19
19
|
}
|
|
@@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react';
|
|
|
2
2
|
import cn from 'classnames';
|
|
3
3
|
import { PointIcon } from '../../icons/Point.js';
|
|
4
4
|
|
|
5
|
-
var styles = {"dotUnfocused":"
|
|
5
|
+
var styles = {"dotUnfocused":"chart__dotUnfocused_8wcu4","dot":"chart__dot_8wcu4","dotItem":"chart__dotItem_8wcu4","dotWrap":"chart__dotWrap_8wcu4","showDot":"chart__showDot_8wcu4"};
|
|
6
6
|
require('./index.css')
|
|
7
7
|
|
|
8
8
|
const Dot = React.forwardRef(({ cx, cy, index, activeDot, dataKey, dotSettings, value, stroke }, ref) => {
|
|
@@ -12,7 +12,7 @@ const Dot = React.forwardRef(({ cx, cy, index, activeDot, dataKey, dotSettings,
|
|
|
12
12
|
const [option, setOption] = useState(null);
|
|
13
13
|
useEffect(() => {
|
|
14
14
|
let dotSetting = Array.isArray(dotSettings) && dotSettings.length > 0
|
|
15
|
-
? dotSettings.find(item => item.media && windowWidth < item.media)
|
|
15
|
+
? dotSettings.find((item) => item.media && windowWidth < item.media)
|
|
16
16
|
: dotSettings;
|
|
17
17
|
if (Array.isArray(dotSettings) && dotSettings.length > 0 && !dotSetting) {
|
|
18
18
|
dotSetting = dotSettings[dotSettings.length - 1];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: fqqa1 */
|
|
2
2
|
:root {
|
|
3
3
|
|
|
4
4
|
/* Hard */
|
|
@@ -10,31 +10,31 @@
|
|
|
10
10
|
:root {
|
|
11
11
|
--gap-2xl: 32px;
|
|
12
12
|
}
|
|
13
|
-
.
|
|
13
|
+
.chart__legendContent_msguv {
|
|
14
14
|
display: flex;
|
|
15
15
|
align-items: center;
|
|
16
16
|
flex-wrap: wrap;
|
|
17
17
|
}
|
|
18
|
-
.
|
|
18
|
+
.chart__legendWrap_msguv {
|
|
19
19
|
width: 100%;
|
|
20
20
|
margin: 0;
|
|
21
21
|
padding: 0;
|
|
22
22
|
}
|
|
23
|
-
.
|
|
23
|
+
.chart__legendItem_msguv {
|
|
24
24
|
margin-right: var(--gap-2xl);
|
|
25
25
|
cursor: pointer;
|
|
26
26
|
display: inline-block;
|
|
27
27
|
}
|
|
28
|
-
.
|
|
28
|
+
.chart__legendItem_msguv:last-child {
|
|
29
29
|
margin-right: 0;
|
|
30
30
|
}
|
|
31
|
-
.
|
|
31
|
+
.chart__legendUnactive_msguv {
|
|
32
32
|
opacity: 0.3;
|
|
33
33
|
}
|
|
34
|
-
.
|
|
34
|
+
.chart__legendIcon_msguv {
|
|
35
35
|
margin-right: 13px;
|
|
36
36
|
display: flex;
|
|
37
37
|
}
|
|
38
|
-
.
|
|
38
|
+
.chart__legendValue_msguv {
|
|
39
39
|
text-transform: capitalize;
|
|
40
40
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { DataDynamicBooleanProps } from "../../types/utils/data.types";
|
|
4
3
|
import { LegendProps } from "../../types/legend.types";
|
|
5
4
|
import { SeriaProps } from "../../types/seria.types";
|
|
5
|
+
import { DataDynamicBooleanProps } from "../../types/utils/data.types";
|
|
6
6
|
interface Props {
|
|
7
7
|
legend: LegendProps;
|
|
8
8
|
series: SeriaProps[];
|
|
@@ -6,7 +6,7 @@ import { CircleLineIcon } from '../../icons/CircleLine.js';
|
|
|
6
6
|
import { FilledCircleIcon } from '../../icons/FilledCircle.js';
|
|
7
7
|
import { StrokeCircleIcon } from '../../icons/StrokeCircle.js';
|
|
8
8
|
|
|
9
|
-
var styles = {"legendContent":"
|
|
9
|
+
var styles = {"legendContent":"chart__legendContent_msguv","legendWrap":"chart__legendWrap_msguv","legendItem":"chart__legendItem_msguv","legendUnactive":"chart__legendUnactive_msguv","legendIcon":"chart__legendIcon_msguv","legendValue":"chart__legendValue_msguv"};
|
|
10
10
|
require('./index.css')
|
|
11
11
|
|
|
12
12
|
const icons = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { LinearGradientProps } from "../types/utils/gradient.types";
|
|
4
|
-
declare const LinearGradient: ({ id, gid, points }: LinearGradientProps) => React.ReactElement
|
|
4
|
+
declare const LinearGradient: ({ id, gid, points }: LinearGradientProps) => React.ReactElement;
|
|
5
5
|
export { LinearGradient };
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
const LinearGradient = ({ id, gid, points }) => {
|
|
4
|
-
return (React.createElement("linearGradient", { key: `${id}-${gid}`, id: `${id}-${gid}`, x1: '0', y1: '0', x2: '0', y2: '1' }, points.map((point, index) => (React.createElement("stop", { key: `${id}${gid}-${index.toString()}`, offset: `${point.offset}%`, stopColor: point.stopColor, stopOpacity: point.stopOpacity })))));
|
|
5
|
-
};
|
|
3
|
+
const LinearGradient = ({ id, gid, points }) => (React.createElement("linearGradient", { key: `${id}-${gid}`, id: `${id}-${gid}`, x1: '0', y1: '0', x2: '0', y2: '1' }, points.map((point, index) => (React.createElement("stop", { key: `${id}${gid}-${index.toString()}`, offset: `${point.offset}%`, stopColor: point.stopColor, stopOpacity: point.stopOpacity })))));
|
|
6
4
|
|
|
7
5
|
export { LinearGradient };
|