@gravity-ui/chartkit 2.2.2 → 2.3.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,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.3.0](https://github.com/gravity-ui/chartkit/compare/v2.2.2...v2.3.0) (2023-04-11)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* **Indicator plugin:** add onRender ([#145](https://github.com/gravity-ui/chartkit/issues/145)) ([3a044c0](https://github.com/gravity-ui/chartkit/commit/3a044c08583cd96bd08e3fb29a89c06ca9a6be18))
|
|
9
|
+
* **Indicator plugin:** add renderTime ([3a044c0](https://github.com/gravity-ui/chartkit/commit/3a044c08583cd96bd08e3fb29a89c06ca9a6be18))
|
|
10
|
+
|
|
3
11
|
## [2.2.2](https://github.com/gravity-ui/chartkit/compare/v2.2.1...v2.2.2) (2023-03-28)
|
|
4
12
|
|
|
5
13
|
|
|
@@ -4,6 +4,7 @@ import { isEmpty } from 'lodash';
|
|
|
4
4
|
import { i18n } from '../../../i18n';
|
|
5
5
|
import { CHARTKIT_ERROR_CODE, ChartKitError } from '../../../libs';
|
|
6
6
|
import { CHARTKIT_SCROLLABLE_NODE_CLASSNAME } from '../../../constants';
|
|
7
|
+
import { getChartPerformanceDuration, getRandomCKId, markChartPerformance } from '../../../utils';
|
|
7
8
|
import { IndicatorItem } from './IndicatorItem';
|
|
8
9
|
import './IndicatorWidget.css';
|
|
9
10
|
const b = block('chartkit-indicator');
|
|
@@ -11,12 +12,16 @@ const IndicatorWidget = React.forwardRef(
|
|
|
11
12
|
// _ref needs to avoid this React warning:
|
|
12
13
|
// "forwardRef render functions accept exactly two parameters: props and ref"
|
|
13
14
|
function IndicatorWidgetInner(props, _ref) {
|
|
14
|
-
const { onLoad, formatNumber, data: { data = [], defaultColor }, } = props;
|
|
15
|
+
const { onLoad, formatNumber, data: { data = [], defaultColor }, id, onRender, } = props;
|
|
16
|
+
const generatedId = React.useMemo(() => `${id}_${getRandomCKId()}`, [data, defaultColor, formatNumber, id]);
|
|
17
|
+
markChartPerformance(generatedId);
|
|
15
18
|
React.useLayoutEffect(() => {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
if (onRender) {
|
|
20
|
+
onRender({ renderTime: getChartPerformanceDuration(generatedId) });
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
onLoad === null || onLoad === void 0 ? void 0 : onLoad({ widgetRendering: getChartPerformanceDuration(generatedId) });
|
|
24
|
+
}, [onLoad, onRender, generatedId]);
|
|
20
25
|
if (isEmpty(data)) {
|
|
21
26
|
throw new ChartKitError({
|
|
22
27
|
code: CHARTKIT_ERROR_CODE.NO_DATA,
|
package/package.json
CHANGED