@gravity-ui/chartkit 3.0.0-beta.1 → 3.0.0-beta.10
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/build/components/ChartKit.d.ts +6 -4
- package/build/components/ChartKit.js +2 -2
- package/build/components/ErrorBoundary/ErrorBoundary.d.ts +2 -2
- package/build/components/Loader/Loader.d.ts +3 -3
- package/build/i18n/index.d.ts +2 -2
- package/build/libs/chartkit-error/chartkit-error.d.ts +1 -1
- package/build/libs/settings/__tests__/settings.test.js +2 -9
- package/build/libs/settings/eventEmitter.d.ts +11 -0
- package/build/libs/settings/eventEmitter.js +25 -0
- package/build/libs/settings/settings.d.ts +7 -4
- package/build/libs/settings/settings.js +8 -13
- package/build/plugins/highcharts/__stories__/Line.stories.d.ts +2 -3
- package/build/plugins/highcharts/__stories__/Pie.stories.d.ts +2 -3
- package/build/plugins/highcharts/__stories__/area/Range.stories.d.ts +2 -3
- package/build/plugins/highcharts/__stories__/area/Stacked.stories.d.ts +2 -3
- package/build/plugins/highcharts/__stories__/column/HorizontalStacked.stories.d.ts +2 -3
- package/build/plugins/highcharts/__stories__/column/Vertical.stories.d.ts +2 -3
- package/build/plugins/highcharts/__stories__/column/VerticalStacked.stories.d.ts +2 -3
- package/build/plugins/highcharts/__stories__/combined/ComboChartWithSameLegendValues.stories.d.ts +2 -3
- package/build/plugins/highcharts/__stories__/complex/TwoAxis.stories.d.ts +2 -3
- package/build/plugins/highcharts/__stories__/components/ChartStory.d.ts +1 -1
- package/build/plugins/highcharts/__stories__/custom-error-render/custom-error-render.stories.d.ts +2 -3
- package/build/plugins/highcharts/__stories__/no-data/no-data.stories.d.ts +2 -3
- package/build/plugins/highcharts/__stories__/pie/WithTotals.stories.d.ts +2 -3
- package/build/plugins/highcharts/renderer/HighchartsWidget.d.ts +3 -1
- package/build/plugins/highcharts/renderer/components/HighchartsComponent.d.ts +3 -3
- package/build/plugins/highcharts/renderer/components/HighchartsComponent.js +6 -0
- package/build/plugins/highcharts/renderer/components/StyledSplitPane/StyledSplitPane.d.ts +3 -3
- package/build/plugins/highcharts/renderer/components/withSplitPane/withSplitPane.js +2 -5
- package/build/plugins/highcharts/renderer/helpers/config/config.d.ts +0 -1
- package/build/plugins/highcharts/renderer/helpers/config/config.js +10 -10
- package/build/plugins/highcharts/renderer/helpers/config/types.d.ts +2 -2
- package/build/plugins/highcharts/renderer/helpers/config/utils/addShowInNavigatorToSeries.d.ts +1 -1
- package/build/plugins/highcharts/renderer/helpers/config/utils/buildNavigatorFallback.d.ts +1 -1
- package/build/plugins/highcharts/renderer/helpers/config/utils/calculatePrecision.d.ts +1 -1
- package/build/plugins/highcharts/renderer/helpers/config/utils/getFormatOptionsFromLine.d.ts +1 -1
- package/build/plugins/highcharts/renderer/helpers/config/utils/index.d.ts +33 -0
- package/build/plugins/highcharts/renderer/helpers/config/utils/index.js +8 -0
- package/build/plugins/highcharts/renderer/helpers/config/utils/isNavigatorSeries.d.ts +1 -1
- package/build/plugins/highcharts/renderer/helpers/config/utils/numberFormat.d.ts +1 -1
- package/build/plugins/highcharts/renderer/helpers/config/utils/setNavigatorDefaultPeriod.d.ts +2 -2
- package/build/plugins/highcharts/renderer/helpers/config/utils/setNavigatorDefaultPeriod.js +2 -2
- package/build/plugins/highcharts/renderer/helpers/graph.d.ts +1 -1
- package/build/plugins/highcharts/renderer/helpers/graph.js +2 -2
- package/build/plugins/highcharts/renderer/helpers/highcharts/highcharts.d.ts +1 -0
- package/build/plugins/highcharts/renderer/helpers/highcharts/highcharts.js +5 -2
- package/build/plugins/highcharts/renderer/helpers/prepare-data.js +3 -3
- package/build/plugins/highcharts/renderer/helpers/tooltip/helpers.d.ts +0 -2
- package/build/plugins/highcharts/renderer/helpers/tooltip/helpers.js +0 -9
- package/build/plugins/highcharts/renderer/helpers/tooltip/index.d.ts +1 -1
- package/build/plugins/highcharts/renderer/helpers/tooltip/index.js +4 -5
- package/build/plugins/highcharts/renderer/helpers/tooltip/render-shape-icon/types.d.ts +1 -1
- package/build/plugins/highcharts/renderer/helpers/tooltip/types.d.ts +3 -12
- package/build/plugins/highcharts/renderer/helpers/types.d.ts +2 -2
- package/build/plugins/highcharts/types/comments.d.ts +1 -1
- package/build/plugins/highcharts/types/misc.d.ts +4 -4
- package/build/plugins/highcharts/types/widget.d.ts +13 -5
- package/build/plugins/indicator/__stories__/Indicator.stories.d.ts +2 -2
- package/build/plugins/indicator/renderer/IndicatorItem.d.ts +2 -2
- package/build/plugins/indicator/renderer/IndicatorWidget.d.ts +3 -1
- package/build/plugins/indicator/types.d.ts +2 -2
- package/build/plugins/shared/format-number/i18n/i18n.d.ts +1 -1
- package/build/plugins/shared/format-number/types.d.ts +2 -2
- package/build/plugins/yagr/__stories__/Yagr.stories.d.ts +3 -4
- package/build/plugins/yagr/__stories__/Yagr.stories.js +3 -1
- package/build/plugins/yagr/renderer/YagrWidget.d.ts +4 -1
- package/build/plugins/yagr/renderer/YagrWidget.js +13 -12
- package/build/plugins/yagr/renderer/tooltip/renderTooltip.js +2 -2
- package/build/plugins/yagr/renderer/tooltip/types.d.ts +4 -4
- package/build/plugins/yagr/renderer/utils.d.ts +1 -1
- package/build/plugins/yagr/renderer/utils.js +3 -3
- package/build/plugins/yagr/types.d.ts +2 -1
- package/build/types/index.d.ts +22 -22
- package/build/types/misc.d.ts +1 -1
- package/build/types/widget.d.ts +5 -1
- package/package.json +14 -9
- package/CHANGELOG.md +0 -489
package/build/types/index.d.ts
CHANGED
|
@@ -2,56 +2,56 @@ import React from 'react';
|
|
|
2
2
|
import type { ChartKitWidget } from './widget';
|
|
3
3
|
import { ChartKitError } from '../libs';
|
|
4
4
|
export type { ChartKitHolidays } from './misc';
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
5
|
+
export type ChartKitLang = 'ru' | 'en';
|
|
6
|
+
export type ChartKitType = keyof ChartKitWidget;
|
|
7
|
+
export type ChartKitRef = {
|
|
8
8
|
reflow: (details?: unknown) => void;
|
|
9
9
|
};
|
|
10
|
-
export
|
|
10
|
+
export type ChartKitWidgetRef = {
|
|
11
11
|
reflow?: ChartKitRef['reflow'];
|
|
12
12
|
};
|
|
13
|
-
export
|
|
13
|
+
export type ChartKitOnLoadData<T extends ChartKitType> = {
|
|
14
14
|
widget?: ChartKitWidget[T]['widget'];
|
|
15
15
|
widgetRendering?: number;
|
|
16
16
|
};
|
|
17
|
-
export
|
|
17
|
+
export type ChartKitOnRenderData = {
|
|
18
18
|
renderTime?: number;
|
|
19
19
|
};
|
|
20
|
-
export
|
|
20
|
+
export type ChartKitOnChartLoad<T extends ChartKitType> = {
|
|
21
21
|
widget?: ChartKitWidget[T]['widget'] | null;
|
|
22
22
|
};
|
|
23
|
-
export
|
|
23
|
+
export type ChartKitOnError = (data: {
|
|
24
24
|
error: any;
|
|
25
25
|
}) => void;
|
|
26
|
-
export
|
|
26
|
+
export type ChartKitProps<T extends ChartKitType> = {
|
|
27
27
|
type: T;
|
|
28
28
|
data: ChartKitWidget[T]['data'];
|
|
29
|
+
/** Plugin component's react ref */
|
|
30
|
+
pluginRef?: ChartKitWidget[T]['pluginRef'];
|
|
29
31
|
id?: string;
|
|
30
32
|
isMobile?: boolean;
|
|
31
33
|
onLoad?: (data?: ChartKitOnLoadData<T>) => void;
|
|
32
|
-
/**
|
|
33
|
-
* called on each render
|
|
34
|
-
* @param data
|
|
35
|
-
*/
|
|
34
|
+
/** Fires on each chartkit plugin's component render */
|
|
36
35
|
onRender?: (data: ChartKitOnRenderData) => void;
|
|
37
|
-
/**
|
|
38
|
-
* called on chart mount
|
|
39
|
-
* @param data
|
|
40
|
-
*/
|
|
36
|
+
/** Fires on chartkit plugin's component mount */
|
|
41
37
|
onChartLoad?: (data: ChartKitOnChartLoad<T>) => void;
|
|
42
|
-
|
|
38
|
+
/** Fires in case of unhandled plugin's exception */
|
|
43
39
|
onError?: ChartKitOnError;
|
|
40
|
+
/** Used to render user's error component */
|
|
41
|
+
renderError?: RenderError;
|
|
42
|
+
/** Used to render user's plugin loader component */
|
|
43
|
+
renderPluginLoader?: () => React.ReactNode;
|
|
44
44
|
} & {
|
|
45
|
-
[key in keyof Omit<ChartKitWidget[T], 'data' | 'widget'>]: ChartKitWidget[T][key];
|
|
45
|
+
[key in keyof Omit<ChartKitWidget[T], 'data' | 'widget' | 'pluginRef'>]: ChartKitWidget[T][key];
|
|
46
46
|
};
|
|
47
|
-
export
|
|
47
|
+
export type ChartKitPlugin = {
|
|
48
48
|
type: ChartKitType;
|
|
49
49
|
renderer: React.LazyExoticComponent<any>;
|
|
50
50
|
};
|
|
51
|
-
export
|
|
51
|
+
export type RenderErrorOpts = {
|
|
52
52
|
message: string;
|
|
53
53
|
error: ChartKitError | Error;
|
|
54
54
|
resetError: () => void;
|
|
55
55
|
};
|
|
56
|
-
export
|
|
56
|
+
export type RenderError = (opts: RenderErrorOpts) => React.ReactNode;
|
|
57
57
|
export type { ChartKitWidget };
|
package/build/types/misc.d.ts
CHANGED
package/build/types/widget.d.ts
CHANGED
|
@@ -1,19 +1,23 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { Yagr, YagrReactRef, YagrWidgetData } from '../plugins/yagr/types';
|
|
2
3
|
import type { IndicatorWidgetData } from '../plugins/indicator/types';
|
|
3
4
|
import type { Highcharts, HighchartsWidgetData, StringParams } from '../plugins/highcharts/types';
|
|
4
5
|
export interface ChartKitWidget {
|
|
5
6
|
yagr: {
|
|
6
7
|
data: YagrWidgetData;
|
|
7
8
|
widget: Yagr;
|
|
9
|
+
pluginRef: React.MutableRefObject<YagrReactRef | null>;
|
|
8
10
|
};
|
|
9
11
|
indicator: {
|
|
10
12
|
data: IndicatorWidgetData;
|
|
11
13
|
widget: never;
|
|
14
|
+
pluginRef: never;
|
|
12
15
|
formatNumber?: <T = any>(value: number, options?: T) => string;
|
|
13
16
|
};
|
|
14
17
|
highcharts: {
|
|
15
18
|
data: HighchartsWidgetData;
|
|
16
19
|
widget: Highcharts.Chart | null;
|
|
20
|
+
pluginRef: never;
|
|
17
21
|
hoistConfigError?: boolean;
|
|
18
22
|
nonBodyScroll?: boolean;
|
|
19
23
|
splitTooltip?: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gravity-ui/chartkit",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.10",
|
|
4
4
|
"description": "React component used to render charts based on any sources you need",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "git@github.com:gravity-ui/ChartKit.git",
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
"access": "public"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@gravity-ui/
|
|
16
|
+
"@gravity-ui/date-utils": "^1.4.1",
|
|
17
|
+
"@gravity-ui/yagr": "^3.4.0",
|
|
17
18
|
"bem-cn-lite": "^4.1.0",
|
|
18
19
|
"highcharts": "^8.2.2",
|
|
19
20
|
"highcharts-react-official": "^3.0.0",
|
|
@@ -21,16 +22,21 @@
|
|
|
21
22
|
"react-split-pane": "^0.1.92"
|
|
22
23
|
},
|
|
23
24
|
"devDependencies": {
|
|
25
|
+
"@babel/preset-env": "^7.22.6",
|
|
26
|
+
"@babel/preset-react": "^7.22.5",
|
|
27
|
+
"@babel/preset-typescript": "^7.22.5",
|
|
24
28
|
"@gravity-ui/eslint-config": "^1.0.2",
|
|
25
29
|
"@gravity-ui/i18n": "^1.0.0",
|
|
26
30
|
"@gravity-ui/prettier-config": "^1.0.1",
|
|
27
31
|
"@gravity-ui/stylelint-config": "^1.0.1",
|
|
28
32
|
"@gravity-ui/tsconfig": "^1.0.0",
|
|
29
33
|
"@gravity-ui/uikit": "^4.2.0",
|
|
30
|
-
"@storybook/addon-essentials": "^
|
|
31
|
-
"@storybook/addon-knobs": "^
|
|
34
|
+
"@storybook/addon-essentials": "^7.0.26",
|
|
35
|
+
"@storybook/addon-knobs": "^7.0.2",
|
|
36
|
+
"@storybook/cli": "^7.0.26",
|
|
32
37
|
"@storybook/preset-scss": "^1.0.3",
|
|
33
|
-
"@storybook/react": "^
|
|
38
|
+
"@storybook/react": "^7.0.26",
|
|
39
|
+
"@storybook/react-webpack5": "^7.0.26",
|
|
34
40
|
"@types/jest": "^28.1.3",
|
|
35
41
|
"@types/lodash": "^4.14.177",
|
|
36
42
|
"@types/node": "^18.0.0",
|
|
@@ -49,7 +55,6 @@
|
|
|
49
55
|
"jest": "^28.1.3",
|
|
50
56
|
"jest-environment-jsdom": "^28.1.2",
|
|
51
57
|
"lint-staged": "^10.2.7",
|
|
52
|
-
"moment": "^2.29.4",
|
|
53
58
|
"npm-run-all": "^4.1.5",
|
|
54
59
|
"prettier": "^2.6.0",
|
|
55
60
|
"react": "^17.0.2",
|
|
@@ -58,22 +63,22 @@
|
|
|
58
63
|
"rimraf": "^3.0.2",
|
|
59
64
|
"sass": "^1.56.2",
|
|
60
65
|
"sass-loader": "^10.2.1",
|
|
66
|
+
"storybook": "^7.0.26",
|
|
61
67
|
"style-loader": "^2.0.0",
|
|
62
68
|
"stylelint": "^14.6.0",
|
|
63
69
|
"ts-jest": "^28.0.5",
|
|
64
70
|
"ts-node": "^10.2.1",
|
|
65
|
-
"typescript": "^4.
|
|
71
|
+
"typescript": "^4.9.5"
|
|
66
72
|
},
|
|
67
73
|
"peerDependencies": {
|
|
68
74
|
"@gravity-ui/uikit": "^4.0.0",
|
|
69
|
-
"moment": "^2.19.3",
|
|
70
75
|
"react": "^16.0.0 || ^17.0.0 || ^18.0.0"
|
|
71
76
|
},
|
|
72
77
|
"scripts": {
|
|
73
78
|
"test": "jest",
|
|
74
79
|
"test:watch": "jest --watchAll",
|
|
75
80
|
"clean": "gulp clean",
|
|
76
|
-
"start": "
|
|
81
|
+
"start": "storybook dev -p 7007",
|
|
77
82
|
"build": "gulp",
|
|
78
83
|
"lint:js": "eslint --quiet --ext .js,.jsx,.ts,.tsx .",
|
|
79
84
|
"lint:styles": "stylelint '{styles,src}/**/*.scss' --quiet",
|