@gravity-ui/chartkit 2.4.0 → 2.5.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.5.0](https://github.com/gravity-ui/chartkit/compare/v2.4.1...v2.5.0) (2023-05-03)
4
+
5
+
6
+ ### Features
7
+
8
+ * **Highcharts plugin:** add config.tooltip property ([#156](https://github.com/gravity-ui/chartkit/issues/156)) ([8a8229e](https://github.com/gravity-ui/chartkit/commit/8a8229e4ee8401a8cfce4d0689a047e830d1a5e9))
9
+
10
+ ## [2.4.1](https://github.com/gravity-ui/chartkit/compare/v2.4.0...v2.4.1) (2023-04-19)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * **Highcharts plugin:** Replace deprecated event.path ([#153](https://github.com/gravity-ui/chartkit/issues/153)) ([23be4a9](https://github.com/gravity-ui/chartkit/commit/23be4a96479820a69534098100140cd9a3fad45a))
16
+
3
17
  ## [2.4.0](https://github.com/gravity-ui/chartkit/compare/v2.3.1...v2.4.0) (2023-04-13)
4
18
 
5
19
 
@@ -1 +1,3 @@
1
- export function addHolidays(chart: any, holidays: any): boolean;
1
+ import type { ChartKitHolidays } from '../../../../types';
2
+ import type { ExtendedHChart } from '../../types';
3
+ export declare function addHolidays(chart: ExtendedHChart, holidays: ChartKitHolidays): boolean;
@@ -17,7 +17,7 @@ const calculateConsistentClosestPointRange = (type, closestPointRange, series) =
17
17
  export function addHolidays(chart, holidays) {
18
18
  const { userOptions: { _config: { region: configRegion = 'TOT' } = {} }, xAxis: [xAxis], } = chart;
19
19
  const { dataMin, dataMax, closestPointRange, series } = xAxis;
20
- const isConsistentClosestPointRange = calculateConsistentClosestPointRange(xAxis.options.type, closestPointRange, series);
20
+ const isConsistentClosestPointRange = calculateConsistentClosestPointRange(xAxis.options.type || '', closestPointRange, series);
21
21
  let needRedraw = false;
22
22
  if (isConsistentClosestPointRange) {
23
23
  const region = configRegion.toLowerCase();
@@ -64,7 +64,7 @@ function getFormattedValueWithSuffixAndPrefix(item) {
64
64
  }
65
65
  function isZoomResetButtonClick(event, chartContainer) {
66
66
  let iterationIndex = 0;
67
- let element = event.path[iterationIndex];
67
+ let element = event.composedPath()[iterationIndex];
68
68
  while (element) {
69
69
  if (element === chartContainer) {
70
70
  return false;
@@ -72,7 +72,7 @@ function isZoomResetButtonClick(event, chartContainer) {
72
72
  else if (element.classList.contains('highcharts-reset-zoom')) {
73
73
  return true;
74
74
  }
75
- element = event.path[++iterationIndex];
75
+ element = event.composedPath()[++iterationIndex];
76
76
  }
77
77
  return false;
78
78
  }
@@ -898,7 +898,8 @@ export function hideFixedTooltip(tooltip, isMobile) {
898
898
  }
899
899
  }
900
900
  function fixTooltip(tooltip, options, event) {
901
- if (options.splitTooltip) {
901
+ const pinable = get(options, 'tooltip.pinable', true);
902
+ if (options.splitTooltip || !pinable) {
902
903
  return false;
903
904
  }
904
905
  if (tooltip.fixed) {
@@ -38,6 +38,7 @@ declare module 'highcharts' {
38
38
 
39
39
  // for Stock chart from https://github.com/highcharts/highcharts/blob/master/ts/Stock/Navigator/NavigatorComposition.ts#L65
40
40
  interface Series {
41
+ xData: number[];
41
42
  baseSeries?: Series;
42
43
  navigatorSeries?: Series;
43
44
  }
@@ -13,6 +13,9 @@ export declare type ExtendedHChart = Highcharts.Chart & {
13
13
  _internalComments: HighchartsComment[];
14
14
  _externalComments: HighchartsComment[];
15
15
  _getComments: () => HighchartsComment[];
16
+ _config?: {
17
+ region?: string;
18
+ };
16
19
  };
17
20
  xAxis: XAxisItem[];
18
21
  navigator?: Highcharts.Options['navigator'];
@@ -83,6 +83,12 @@ export declare type HighchartsWidgetData = {
83
83
  * Used to modify tooltip data
84
84
  */
85
85
  manageTooltipConfig?: HighchartsManageTooltipConfig;
86
+ /**
87
+ * Tooltip config
88
+ */
89
+ tooltip?: {
90
+ pinable?: boolean;
91
+ };
86
92
  };
87
93
  libraryConfig: Highcharts.Options;
88
94
  params?: StringParams;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/chartkit",
3
- "version": "2.4.0",
3
+ "version": "2.5.0",
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",