@gravity-ui/chartkit 0.12.1 → 0.12.3

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
+ ## [0.12.3](https://github.com/gravity-ui/chartkit/compare/v0.12.2...v0.12.3) (2022-12-01)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **Yagr:** added common no-data case handling ([#78](https://github.com/gravity-ui/chartkit/issues/78)) ([100efaa](https://github.com/gravity-ui/chartkit/commit/100efaaff20e03048146ca084ee91c2be2568640))
9
+
10
+ ## [0.12.2](https://github.com/gravity-ui/chartkit/compare/v0.12.1...v0.12.2) (2022-11-30)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * **ChartKit:** id not to be new on every render ([#76](https://github.com/gravity-ui/chartkit/issues/76)) ([230a992](https://github.com/gravity-ui/chartkit/commit/230a992fe99a176bbf85cbef363ccac45db7b3b4))
16
+
3
17
  ## [0.12.1](https://github.com/gravity-ui/chartkit/compare/v0.12.0...v0.12.1) (2022-11-22)
4
18
 
5
19
 
@@ -11,7 +11,9 @@ import './ChartKit.css';
11
11
  const b = block('chartkit');
12
12
  const ChartKitComponent = (props) => {
13
13
  const widgetRef = React.useRef();
14
- const { instanceRef, id = getRandomCKId(), type, data, onLoad, isMobile } = props, restProps = __rest(props, ["instanceRef", "id", "type", "data", "onLoad", "isMobile"]);
14
+ const { instanceRef, id: propsId, type, data, onLoad, isMobile } = props, restProps = __rest(props, ["instanceRef", "id", "type", "data", "onLoad", "isMobile"]);
15
+ const ckId = React.useMemo(() => getRandomCKId(), []);
16
+ const id = propsId || ckId;
15
17
  const lang = settings.get('lang');
16
18
  const plugins = settings.get('plugins');
17
19
  const plugin = plugins.find((iteratedPlugin) => iteratedPlugin.type === type);
@@ -1,10 +1,12 @@
1
1
  import React from 'react';
2
2
  import moment from 'moment';
3
3
  import debounce from 'lodash/debounce';
4
+ import isEmpty from 'lodash/isEmpty';
4
5
  import { useThemeType } from '@gravity-ui/uikit';
5
6
  import YagrComponent from 'yagr/dist/react';
6
7
  import { defaults, } from 'yagr';
7
- import { settings } from '../../../libs';
8
+ import { i18n } from '../../../i18n';
9
+ import { settings, CHARTKIT_ERROR_CODE, ChartKitError } from '../../../libs';
8
10
  import { formatTooltip } from './tooltip/tooltip';
9
11
  import { synchronizeTooltipTablesCellsWidth } from './synchronizeTooltipTablesCellsWidth';
10
12
  import './polyfills';
@@ -81,6 +83,12 @@ const YagrWidget = React.forwardRef((props, forwardedRef) => {
81
83
  const { data, libraryConfig } = props.data;
82
84
  const { id, onLoad } = props;
83
85
  const theme = useThemeType();
86
+ if (!data || isEmpty(data)) {
87
+ throw new ChartKitError({
88
+ code: CHARTKIT_ERROR_CODE.NO_DATA,
89
+ message: i18n('error', 'label_no-data'),
90
+ });
91
+ }
84
92
  const handlers = {
85
93
  mouseMove: null,
86
94
  mouseDown: null,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/chartkit",
3
- "version": "0.12.1",
3
+ "version": "0.12.3",
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",