@gravity-ui/chartkit 3.0.0-beta.1 → 3.0.0-beta.11
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.css +19 -19
- 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/mocks/complex.js +1 -1
- 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.css +1 -1
- 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 +14 -14
- package/build/plugins/highcharts/renderer/helpers/config/options.js +1 -1
- 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.css +4 -4
- 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/tooltip.css +5 -5
- 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.css +1 -1
- 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.css +1 -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/tooltip.css +14 -14
- 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 +16 -11
- package/CHANGELOG.md +0 -489
|
@@ -8,24 +8,24 @@
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
.chartkit-theme_common {
|
|
11
|
-
--highcarts-navigator-border: var(--
|
|
12
|
-
--highcarts-navigator-track: var(--
|
|
13
|
-
--highcarts-navigator-body: var(--
|
|
14
|
-
--highcharts-series-border: var(--
|
|
15
|
-
--highcharts-grid-line: var(--
|
|
16
|
-
--highcharts-axis-line: var(--
|
|
17
|
-
--highcharts-tick: var(--
|
|
18
|
-
--highcharts-title: var(--
|
|
19
|
-
--highcharts-axis-labels: var(--
|
|
20
|
-
--highcharts-data-labels: var(--
|
|
21
|
-
--highcharts-plot-line-label: var(--
|
|
22
|
-
--highcharts-legend-item: var(--
|
|
23
|
-
--highcharts-legend-item-hover: var(--
|
|
24
|
-
--highcharts-legend-item-hidden: var(--
|
|
25
|
-
--highcharts-floating-bg: var(--
|
|
26
|
-
--highcharts-tooltip-text: var(--
|
|
11
|
+
--highcarts-navigator-border: var(--g-color-line-generic);
|
|
12
|
+
--highcarts-navigator-track: var(--g-color-base-generic);
|
|
13
|
+
--highcarts-navigator-body: var(--g-color-scroll-handle);
|
|
14
|
+
--highcharts-series-border: var(--g-color-base-background);
|
|
15
|
+
--highcharts-grid-line: var(--g-color-line-generic);
|
|
16
|
+
--highcharts-axis-line: var(--g-color-line-generic);
|
|
17
|
+
--highcharts-tick: var(--g-color-line-generic);
|
|
18
|
+
--highcharts-title: var(--g-color-text-primary);
|
|
19
|
+
--highcharts-axis-labels: var(--g-color-text-secondary);
|
|
20
|
+
--highcharts-data-labels: var(--g-color-text-complementary);
|
|
21
|
+
--highcharts-plot-line-label: var(--g-color-text-complementary);
|
|
22
|
+
--highcharts-legend-item: var(--g-color-text-secondary);
|
|
23
|
+
--highcharts-legend-item-hover: var(--g-color-text-primary);
|
|
24
|
+
--highcharts-legend-item-hidden: var(--g-color-text-hint);
|
|
25
|
+
--highcharts-floating-bg: var(--g-color-infographics-tooltip-bg);
|
|
26
|
+
--highcharts-tooltip-text: var(--g-color-text-primary);
|
|
27
27
|
--highcharts-tooltip-bg: var(--highcharts-floating-bg);
|
|
28
|
-
--highcharts-tooltip-alternate-bg: var(--
|
|
29
|
-
--highcharts-tooltip-text-complementary: var(--
|
|
30
|
-
--highcharts-holiday-band: var(--
|
|
28
|
+
--highcharts-tooltip-alternate-bg: var(--g-color-base-generic);
|
|
29
|
+
--highcharts-tooltip-text-complementary: var(--g-color-text-complementary);
|
|
30
|
+
--highcharts-holiday-band: var(--g-color-base-generic);
|
|
31
31
|
}
|
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { ChartKitType, ChartKitRef, ChartKitProps } from '../types';
|
|
3
3
|
import './ChartKit.css';
|
|
4
|
-
|
|
4
|
+
type ChartKitComponentProps<T extends ChartKitType> = Omit<ChartKitProps<T>, 'onError'> & {
|
|
5
5
|
instanceRef?: React.ForwardedRef<ChartKitRef | undefined>;
|
|
6
6
|
};
|
|
7
|
-
declare const ChartKitComponent: <T extends keyof import("../types").ChartKitWidget>(props: ChartKitComponentProps<T>) => JSX.Element;
|
|
7
|
+
declare const ChartKitComponent: <T extends keyof import("../types").ChartKitWidget>(props: ChartKitComponentProps<T>) => React.JSX.Element;
|
|
8
8
|
export declare const ChartKit: <T extends keyof import("../types").ChartKitWidget>(props: {
|
|
9
9
|
type: T;
|
|
10
10
|
data: import("../types").ChartKitWidget[T]["data"];
|
|
11
|
+
pluginRef?: import("../types").ChartKitWidget[T]["pluginRef"] | undefined;
|
|
11
12
|
id?: string | undefined;
|
|
12
13
|
isMobile?: boolean | undefined;
|
|
13
14
|
onLoad?: ((data?: import("../types").ChartKitOnLoadData<T> | undefined) => void) | undefined;
|
|
14
15
|
onRender?: ((data: import("../types").ChartKitOnRenderData) => void) | undefined;
|
|
15
16
|
onChartLoad?: ((data: import("../types").ChartKitOnChartLoad<T>) => void) | undefined;
|
|
16
|
-
renderError?: import("../types").RenderError | undefined;
|
|
17
17
|
onError?: import("../types").ChartKitOnError | undefined;
|
|
18
|
-
|
|
18
|
+
renderError?: import("../types").RenderError | undefined;
|
|
19
|
+
renderPluginLoader?: (() => React.ReactNode) | undefined;
|
|
20
|
+
} & (Omit<import("../types").ChartKitWidget[T], "widget" | "data" | "pluginRef"> extends infer T_1 ? { [key in keyof T_1]: import("../types").ChartKitWidget[T][key]; } : never) & {
|
|
19
21
|
ref?: React.ForwardedRef<ChartKitRef | undefined> | undefined;
|
|
20
22
|
}) => ReturnType<typeof ChartKitComponent>;
|
|
21
23
|
export {};
|
|
@@ -10,7 +10,7 @@ import './ChartKit.css';
|
|
|
10
10
|
const b = block('chartkit');
|
|
11
11
|
const ChartKitComponent = (props) => {
|
|
12
12
|
const widgetRef = React.useRef();
|
|
13
|
-
const { instanceRef, id: propsId, type, isMobile } = props, restProps = __rest(props, ["instanceRef", "id", "type", "isMobile"]);
|
|
13
|
+
const { instanceRef, id: propsId, type, isMobile, renderPluginLoader } = props, restProps = __rest(props, ["instanceRef", "id", "type", "isMobile", "renderPluginLoader"]);
|
|
14
14
|
const ckId = React.useMemo(() => getRandomCKId(), []);
|
|
15
15
|
const id = propsId || ckId;
|
|
16
16
|
const lang = settings.get('lang');
|
|
@@ -31,7 +31,7 @@ const ChartKitComponent = (props) => {
|
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
33
|
}), []);
|
|
34
|
-
return (React.createElement(React.Suspense, { fallback: React.createElement(Loader, null) },
|
|
34
|
+
return (React.createElement(React.Suspense, { fallback: (renderPluginLoader === null || renderPluginLoader === void 0 ? void 0 : renderPluginLoader()) || React.createElement(Loader, null) },
|
|
35
35
|
React.createElement("div", { className: b({ mobile: isMobile }, 'chartkit-theme_common') },
|
|
36
36
|
React.createElement(ChartComponent, Object.assign({ ref: widgetRef, id: id, lang: lang }, restProps)))));
|
|
37
37
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { ChartKitError } from '../../libs';
|
|
3
3
|
import type { ChartKitOnError, ChartKitType, ChartKitWidget, RenderError } from '../../types';
|
|
4
|
-
|
|
4
|
+
type Props = {
|
|
5
5
|
onError?: ChartKitOnError;
|
|
6
6
|
data: ChartKitWidget[ChartKitType]['data'];
|
|
7
7
|
renderError?: RenderError;
|
|
8
8
|
};
|
|
9
|
-
|
|
9
|
+
type State = {
|
|
10
10
|
error?: ChartKitError | Error;
|
|
11
11
|
};
|
|
12
12
|
export declare class ErrorBoundary extends React.Component<Props, State> {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { LoaderProps as BaseLoaderProps } from '@gravity-ui/uikit';
|
|
3
3
|
import './Loader.css';
|
|
4
|
-
|
|
5
|
-
export declare const Loader: (props: LoaderProps) => JSX.Element;
|
|
4
|
+
type LoaderProps = BaseLoaderProps;
|
|
5
|
+
export declare const Loader: (props: LoaderProps) => React.JSX.Element;
|
|
6
6
|
export {};
|
package/build/i18n/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { I18N, I18NFn } from '@gravity-ui/i18n';
|
|
2
2
|
import en from './keysets/en.json';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
type Keysets = typeof en;
|
|
4
|
+
type TypedI18n = I18NFn<Keysets>;
|
|
5
5
|
declare const i18nFactory: I18N;
|
|
6
6
|
declare const i18n: TypedI18n;
|
|
7
7
|
export { i18nFactory, i18n };
|
|
@@ -1,13 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
const resetSettings = () => settings.set({
|
|
3
|
-
lang: 'en',
|
|
4
|
-
locale: DEFAULT_LOCALE_SPECIFICATION,
|
|
5
|
-
});
|
|
1
|
+
import { settings } from '../settings';
|
|
2
|
+
const resetSettings = () => settings.set({ lang: 'en' });
|
|
6
3
|
describe('libs/settings', () => {
|
|
7
|
-
it('Default locale should be equal DEFAULT_LOCALE_SPECIFICATION', () => {
|
|
8
|
-
const result = settings.get('locale');
|
|
9
|
-
expect(result).toStrictEqual(DEFAULT_LOCALE_SPECIFICATION);
|
|
10
|
-
});
|
|
11
4
|
it('Default lang should be equal to en', () => {
|
|
12
5
|
const result = settings.get('lang');
|
|
13
6
|
expect(result).toBe('en');
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
type EventObject<T = unknown> = {
|
|
2
|
+
id: string;
|
|
3
|
+
action: (args: T) => void;
|
|
4
|
+
};
|
|
5
|
+
export declare class EventEmitter<EventsMap = unknown> {
|
|
6
|
+
private events;
|
|
7
|
+
on<MapKey extends keyof EventsMap>(type: MapKey, event: EventObject<EventsMap[MapKey]>): void;
|
|
8
|
+
off<MapKey extends keyof EventsMap>(type: MapKey, eventId: string): void;
|
|
9
|
+
dispatch<MapKey extends keyof EventsMap>(type: MapKey, args: EventsMap[MapKey]): void;
|
|
10
|
+
}
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export class EventEmitter {
|
|
2
|
+
constructor() {
|
|
3
|
+
this.events = {};
|
|
4
|
+
}
|
|
5
|
+
on(type, event) {
|
|
6
|
+
if (this.events[type]) {
|
|
7
|
+
this.events[type].push(event);
|
|
8
|
+
}
|
|
9
|
+
else {
|
|
10
|
+
this.events[type] = [event];
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
off(type, eventId) {
|
|
14
|
+
if (this.events[type]) {
|
|
15
|
+
this.events[type] = this.events[type].filter(({ id }) => id !== eventId);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
dispatch(type, args) {
|
|
19
|
+
if (this.events[type]) {
|
|
20
|
+
this.events[type].forEach(({ action }) => {
|
|
21
|
+
action(args);
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
import moment from 'moment';
|
|
2
1
|
import type { ChartKitPlugin, ChartKitLang, ChartKitHolidays } from '../../types';
|
|
2
|
+
import { EventEmitter } from './eventEmitter';
|
|
3
3
|
interface Settings {
|
|
4
4
|
plugins: ChartKitPlugin[];
|
|
5
5
|
lang: ChartKitLang;
|
|
6
|
-
locale?: moment.LocaleSpecification;
|
|
7
6
|
extra?: {
|
|
8
7
|
holidays?: ChartKitHolidays;
|
|
9
8
|
};
|
|
10
9
|
}
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
type SettingKey = keyof Settings;
|
|
11
|
+
type SettingsEventsMap = {
|
|
12
|
+
'change-lang': ChartKitLang;
|
|
13
|
+
};
|
|
14
|
+
export declare const settingsEventEmitter: EventEmitter<SettingsEventsMap>;
|
|
13
15
|
declare class ChartKitSettings {
|
|
14
16
|
private settings;
|
|
17
|
+
constructor();
|
|
15
18
|
get<T extends SettingKey>(key: T): Settings[T];
|
|
16
19
|
set(updates: Partial<Settings>): void;
|
|
17
20
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import moment from 'moment';
|
|
2
1
|
import get from 'lodash/get';
|
|
3
2
|
import merge from 'lodash/merge';
|
|
4
3
|
import { configure } from '@gravity-ui/uikit';
|
|
5
4
|
import { i18nFactory } from '../../i18n';
|
|
6
|
-
|
|
5
|
+
import { EventEmitter } from './eventEmitter';
|
|
6
|
+
export const settingsEventEmitter = new EventEmitter();
|
|
7
7
|
const removeUndefinedValues = (data) => {
|
|
8
8
|
return Object.entries(data).reduce((acc, [key, value]) => {
|
|
9
9
|
if (typeof value !== 'undefined') {
|
|
@@ -12,12 +12,7 @@ const removeUndefinedValues = (data) => {
|
|
|
12
12
|
return acc;
|
|
13
13
|
}, {});
|
|
14
14
|
};
|
|
15
|
-
const
|
|
16
|
-
const { lang, locale } = args;
|
|
17
|
-
if (locale) {
|
|
18
|
-
moment.updateLocale(lang, locale);
|
|
19
|
-
}
|
|
20
|
-
moment.locale(lang);
|
|
15
|
+
const updateLang = (lang) => {
|
|
21
16
|
configure({ lang });
|
|
22
17
|
i18nFactory.setLang(lang);
|
|
23
18
|
};
|
|
@@ -27,19 +22,19 @@ class ChartKitSettings {
|
|
|
27
22
|
plugins: [],
|
|
28
23
|
lang: 'en',
|
|
29
24
|
};
|
|
25
|
+
updateLang(this.get('lang'));
|
|
30
26
|
}
|
|
31
27
|
get(key) {
|
|
32
28
|
return get(this.settings, key);
|
|
33
29
|
}
|
|
34
30
|
set(updates) {
|
|
35
31
|
const filteredUpdates = removeUndefinedValues(updates);
|
|
36
|
-
|
|
32
|
+
this.settings = merge(this.settings, filteredUpdates);
|
|
33
|
+
if (filteredUpdates.lang) {
|
|
37
34
|
const lang = filteredUpdates.lang || this.get('lang');
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
updateLang(lang);
|
|
36
|
+
settingsEventEmitter.dispatch('change-lang', lang);
|
|
40
37
|
}
|
|
41
|
-
this.settings = merge(this.settings, filteredUpdates);
|
|
42
38
|
}
|
|
43
39
|
}
|
|
44
40
|
export const settings = new ChartKitSettings();
|
|
45
|
-
settings.set({ locale: DEFAULT_LOCALE_SPECIFICATION });
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
declare const _default: Meta<import("@storybook/react").Args>;
|
|
1
|
+
declare const _default: import("@storybook/types").ComponentAnnotations<import("@storybook/react/dist/types-0a347bb9").R, import("@storybook/types").Args>;
|
|
3
2
|
export default _default;
|
|
4
|
-
export declare const Line:
|
|
3
|
+
export declare const Line: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0a347bb9").R, any>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
declare const _default: Meta<import("@storybook/react").Args>;
|
|
1
|
+
declare const _default: import("@storybook/types").ComponentAnnotations<import("@storybook/react/dist/types-0a347bb9").R, import("@storybook/types").Args>;
|
|
3
2
|
export default _default;
|
|
4
|
-
export declare const Pie:
|
|
3
|
+
export declare const Pie: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0a347bb9").R, any>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
declare const _default: Meta<import("@storybook/react").Args>;
|
|
1
|
+
declare const _default: import("@storybook/types").ComponentAnnotations<import("@storybook/react/dist/types-0a347bb9").R, import("@storybook/types").Args>;
|
|
3
2
|
export default _default;
|
|
4
|
-
export declare const AreaRange:
|
|
3
|
+
export declare const AreaRange: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0a347bb9").R, any>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
declare const _default: Meta<import("@storybook/react").Args>;
|
|
1
|
+
declare const _default: import("@storybook/types").ComponentAnnotations<import("@storybook/react/dist/types-0a347bb9").R, import("@storybook/types").Args>;
|
|
3
2
|
export default _default;
|
|
4
|
-
export declare const AreaStacked:
|
|
3
|
+
export declare const AreaStacked: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0a347bb9").R, any>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
declare const _default: Meta<import("@storybook/react").Args>;
|
|
1
|
+
declare const _default: import("@storybook/types").ComponentAnnotations<import("@storybook/react/dist/types-0a347bb9").R, import("@storybook/types").Args>;
|
|
3
2
|
export default _default;
|
|
4
|
-
export declare const HorizontalStacked:
|
|
3
|
+
export declare const HorizontalStacked: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0a347bb9").R, any>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
declare const _default: Meta<import("@storybook/react").Args>;
|
|
1
|
+
declare const _default: import("@storybook/types").ComponentAnnotations<import("@storybook/react/dist/types-0a347bb9").R, import("@storybook/types").Args>;
|
|
3
2
|
export default _default;
|
|
4
|
-
export declare const Vertical:
|
|
3
|
+
export declare const Vertical: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0a347bb9").R, any>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
declare const _default: Meta<import("@storybook/react").Args>;
|
|
1
|
+
declare const _default: import("@storybook/types").ComponentAnnotations<import("@storybook/react/dist/types-0a347bb9").R, import("@storybook/types").Args>;
|
|
3
2
|
export default _default;
|
|
4
|
-
export declare const VerticalStacked:
|
|
3
|
+
export declare const VerticalStacked: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0a347bb9").R, any>;
|
package/build/plugins/highcharts/__stories__/combined/ComboChartWithSameLegendValues.stories.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
declare const _default: Meta<import("@storybook/react").Args>;
|
|
1
|
+
declare const _default: import("@storybook/types").ComponentAnnotations<import("@storybook/react/dist/types-0a347bb9").R, import("@storybook/types").Args>;
|
|
3
2
|
export default _default;
|
|
4
|
-
export declare const ComboChart:
|
|
3
|
+
export declare const ComboChart: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0a347bb9").R, any>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
declare const _default: Meta<import("@storybook/react").Args>;
|
|
1
|
+
declare const _default: import("@storybook/types").ComponentAnnotations<import("@storybook/react/dist/types-0a347bb9").R, import("@storybook/types").Args>;
|
|
3
2
|
export default _default;
|
|
4
|
-
export declare const TwoAxis:
|
|
3
|
+
export declare const TwoAxis: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0a347bb9").R, import("@storybook/types").Args>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { RenderError } from '../../../../types';
|
|
3
3
|
import { HighchartsWidgetData } from '../../types';
|
|
4
|
-
export
|
|
4
|
+
export type ChartStoryProps = {
|
|
5
5
|
data: HighchartsWidgetData;
|
|
6
6
|
withoutPlugin?: boolean;
|
|
7
7
|
visible?: boolean;
|
package/build/plugins/highcharts/__stories__/custom-error-render/custom-error-render.stories.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
declare const _default: Meta<import("@storybook/react").Args>;
|
|
1
|
+
declare const _default: import("@storybook/types").ComponentAnnotations<import("@storybook/react/dist/types-0a347bb9").R, import("@storybook/types").Args>;
|
|
3
2
|
export default _default;
|
|
4
|
-
export declare const CustomErrorRender:
|
|
3
|
+
export declare const CustomErrorRender: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0a347bb9").R, import("@storybook/types").Args>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
declare const _default: Meta<import("@storybook/react").Args>;
|
|
1
|
+
declare const _default: import("@storybook/types").ComponentAnnotations<import("@storybook/react/dist/types-0a347bb9").R, import("@storybook/types").Args>;
|
|
3
2
|
export default _default;
|
|
4
|
-
export declare const NoData:
|
|
3
|
+
export declare const NoData: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0a347bb9").R, import("@storybook/types").Args>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
declare const _default: Meta<import("@storybook/react").Args>;
|
|
1
|
+
declare const _default: import("@storybook/types").ComponentAnnotations<import("@storybook/react/dist/types-0a347bb9").R, import("@storybook/types").Args>;
|
|
3
2
|
export default _default;
|
|
4
|
-
export declare const WithTotals:
|
|
3
|
+
export declare const WithTotals: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0a347bb9").R, any>;
|
|
@@ -244,7 +244,7 @@ export const data = {
|
|
|
244
244
|
.rect(rect.x, rect.y, rect.width, rect.height)
|
|
245
245
|
.addClass('highcharts-axis-grid-divider')
|
|
246
246
|
.attr({
|
|
247
|
-
fill: 'var(--
|
|
247
|
+
fill: 'var(--g-color-base-background)',
|
|
248
248
|
zIndex: 8,
|
|
249
249
|
})
|
|
250
250
|
.add();
|
|
@@ -3,13 +3,15 @@ import type { ChartKitWidgetRef } from '../../../types';
|
|
|
3
3
|
declare const HighchartsWidget: React.ForwardRefExoticComponent<{
|
|
4
4
|
type: "highcharts";
|
|
5
5
|
data: import("../types").HighchartsWidgetData;
|
|
6
|
+
pluginRef?: undefined;
|
|
6
7
|
id?: string | undefined;
|
|
7
8
|
isMobile?: boolean | undefined;
|
|
8
9
|
onLoad?: ((data?: import("../../../types").ChartKitOnLoadData<"highcharts"> | undefined) => void) | undefined;
|
|
9
10
|
onRender?: ((data: import("../../../types").ChartKitOnRenderData) => void) | undefined;
|
|
10
11
|
onChartLoad?: ((data: import("../../../types").ChartKitOnChartLoad<"highcharts">) => void) | undefined;
|
|
11
|
-
renderError?: import("../../../types").RenderError | undefined;
|
|
12
12
|
onError?: import("../../../types").ChartKitOnError | undefined;
|
|
13
|
+
renderError?: import("../../../types").RenderError | undefined;
|
|
14
|
+
renderPluginLoader?: (() => React.ReactNode) | undefined;
|
|
13
15
|
} & {
|
|
14
16
|
hoistConfigError?: boolean | undefined;
|
|
15
17
|
nonBodyScroll?: boolean | undefined;
|
|
@@ -3,8 +3,8 @@ import Highcharts, { ChartCallbackFunction, Options, Chart } from 'highcharts';
|
|
|
3
3
|
import type { ChartKitProps } from '../../../../types';
|
|
4
4
|
import type { HighchartsWidgetData, StringParams } from '../../types';
|
|
5
5
|
import './HighchartsComponent.css';
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
type Props = ChartKitProps<'highcharts'>;
|
|
7
|
+
type State = {
|
|
8
8
|
prevData: HighchartsWidgetData | null;
|
|
9
9
|
options: (Options & {
|
|
10
10
|
useHighStock: boolean;
|
|
@@ -576,7 +576,7 @@ export declare class HighchartsComponent extends React.PureComponent<Props, Stat
|
|
|
576
576
|
private chartComponent;
|
|
577
577
|
componentDidMount(): void;
|
|
578
578
|
componentDidUpdate(): void;
|
|
579
|
-
render(): JSX.Element | null;
|
|
579
|
+
render(): React.JSX.Element | null;
|
|
580
580
|
reflow: () => void;
|
|
581
581
|
extendChartInstance: (chart: Chart) => void;
|
|
582
582
|
getParams: () => StringParams;
|
|
@@ -3,12 +3,18 @@ import Highcharts from 'highcharts';
|
|
|
3
3
|
import HighchartsReact from 'highcharts-react-official';
|
|
4
4
|
import get from 'lodash/get';
|
|
5
5
|
import { settings } from '../../../../libs';
|
|
6
|
+
import { settingsEventEmitter } from '../../../../libs/settings/settings';
|
|
6
7
|
import { markChartPerformance, getChartPerformanceDuration, getRandomCKId } from '../../../../utils';
|
|
7
8
|
import { getGraph } from '../helpers/graph';
|
|
8
9
|
import { initHighchartsModules } from '../helpers/init-highcharts-modules';
|
|
10
|
+
import { initHighchartsLangOptions } from '../helpers/highcharts/highcharts';
|
|
9
11
|
import { withSplitPane } from './withSplitPane/withSplitPane';
|
|
10
12
|
import './HighchartsComponent.css';
|
|
11
13
|
const HighcharsReactWithSplitPane = withSplitPane(HighchartsReact);
|
|
14
|
+
settingsEventEmitter.on('change-lang', {
|
|
15
|
+
id: 'hc-lang-handler',
|
|
16
|
+
action: initHighchartsLangOptions,
|
|
17
|
+
});
|
|
12
18
|
initHighchartsModules();
|
|
13
19
|
export class HighchartsComponent extends React.PureComponent {
|
|
14
20
|
constructor() {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Split, SplitPaneProps } from 'react-split-pane';
|
|
3
3
|
import './StyledSplitPane.css';
|
|
4
|
-
export
|
|
5
|
-
|
|
4
|
+
export type PaneSplit = Split;
|
|
5
|
+
type Props = SplitPaneProps & {
|
|
6
6
|
paneOneRender: () => React.ReactNode;
|
|
7
7
|
paneTwoRender: () => React.ReactNode;
|
|
8
8
|
};
|
|
9
|
-
export declare const StyledSplitPane: ({ paneOneRender, paneTwoRender, ...splitPaneProps }: Props) => JSX.Element;
|
|
9
|
+
export declare const StyledSplitPane: ({ paneOneRender, paneTwoRender, ...splitPaneProps }: Props) => React.JSX.Element;
|
|
10
10
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint callback-return: 0 */
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import block from 'bem-cn-lite';
|
|
4
|
-
import {
|
|
4
|
+
import { debounce, get } from 'lodash';
|
|
5
5
|
import { getRandomCKId } from '../../../../../utils';
|
|
6
6
|
import { chartTypesWithoutCrosshair } from '../../helpers/config/config';
|
|
7
7
|
import { StyledSplitPane } from '../StyledSplitPane/StyledSplitPane';
|
|
@@ -42,10 +42,7 @@ function getPointsForInitialRefresh(chart) {
|
|
|
42
42
|
return points;
|
|
43
43
|
}
|
|
44
44
|
function forceHoverState(chart, activePoints) {
|
|
45
|
-
const chartType = get(chart, 'userOptions.chart.type');
|
|
46
|
-
if (!chartType) {
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
45
|
+
const chartType = get(chart, 'userOptions.chart.type') || '';
|
|
49
46
|
if (chartType === 'pie') {
|
|
50
47
|
chart.tooltip.refresh(activePoints);
|
|
51
48
|
chart.pointsForInitialRefresh = activePoints;
|
|
@@ -588,4 +588,3 @@ export function prepareConfig(data: any, options: any, isMobile: any, holidays:
|
|
|
588
588
|
export const chartTypesWithoutCrosshair: string[];
|
|
589
589
|
export const chartTypesWithoutYCrosshair: string[];
|
|
590
590
|
export const chartTypesWithNativeTooltip: string[];
|
|
591
|
-
import Highcharts from "highcharts";
|
|
@@ -10,13 +10,13 @@ import isNumber from 'lodash/isNumber';
|
|
|
10
10
|
import throttle from 'lodash/throttle';
|
|
11
11
|
import pick from 'lodash/pick';
|
|
12
12
|
import debounce from 'lodash/debounce';
|
|
13
|
-
import
|
|
13
|
+
import { dateTime } from '@gravity-ui/date-utils';
|
|
14
14
|
import { i18n } from '../../../../../i18n';
|
|
15
15
|
import { formatNumber } from '../../../../shared';
|
|
16
16
|
import { getCommentsOnLine, drawComments, hideComments, drawOnlyRendererComments, } from '../comments/drawing';
|
|
17
17
|
import formatTooltip, { TOOLTIP_ROW_CLASS_NAME, SERIES_NAME_DATA_ATTRIBUTE, TOOLTIP_HEADER_CLASS_NAME, TOOLTIP_LIST_CLASS_NAME, TOOLTIP_FOOTER_CLASS_NAME, TOOLTIP_CONTAINER_CLASS_NAME, TOOLTIP_ROW_NAME_CLASS_NANE, } from '../tooltip';
|
|
18
18
|
import defaultOptions from './options';
|
|
19
|
-
import { calculatePrecision, isTooltipShared, isSafari, mergeArrayWithObject, concatStrings, buildNavigatorFallback, addShowInNavigatorToSeries, setNavigatorDefaultPeriod, numberFormat, getFormatOptionsFromLine, checkTooltipPinningAvailability, } from './utils';
|
|
19
|
+
import { calculatePrecision, isTooltipShared, isSafari, mergeArrayWithObject, concatStrings, buildNavigatorFallback, addShowInNavigatorToSeries, setNavigatorDefaultPeriod, numberFormat, getFormatOptionsFromLine, checkTooltipPinningAvailability, getSortedData, } from './utils';
|
|
20
20
|
import { handleLegendItemClick } from './handleLegendItemClick';
|
|
21
21
|
import { getChartKitFormattedValue } from './utils/getChartKitFormattedValue';
|
|
22
22
|
const b = block('chartkit-tooltip');
|
|
@@ -159,12 +159,12 @@ export function buildLegend(options) {
|
|
|
159
159
|
}
|
|
160
160
|
},
|
|
161
161
|
navigation: {
|
|
162
|
-
activeColor: 'var(--
|
|
163
|
-
inactiveColor: 'var(--
|
|
164
|
-
style: { color: 'var(--
|
|
162
|
+
activeColor: 'var(--g-color-base-brand)',
|
|
163
|
+
inactiveColor: 'var(--g-color-base-generic-accent-disabled)',
|
|
164
|
+
style: { color: 'var(--g-color-text-primary)' },
|
|
165
165
|
},
|
|
166
166
|
title: {
|
|
167
|
-
style: { color: 'var(--
|
|
167
|
+
style: { color: 'var(--g-color-text-secondary)' },
|
|
168
168
|
},
|
|
169
169
|
};
|
|
170
170
|
if (options.outsideLegend) {
|
|
@@ -381,7 +381,7 @@ function validateCellManipulationConfig(tooltipOptions, property, item) {
|
|
|
381
381
|
}
|
|
382
382
|
}
|
|
383
383
|
function getTooltip(tooltip, options, comments, holidays) {
|
|
384
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j
|
|
384
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
385
385
|
const serieType = (this.series && this.series.type) || tooltip.chart.options.chart.type;
|
|
386
386
|
const chart = tooltip.chart;
|
|
387
387
|
const xAxis = chart.xAxis[0];
|
|
@@ -412,7 +412,6 @@ function getTooltip(tooltip, options, comments, holidays) {
|
|
|
412
412
|
count: 1,
|
|
413
413
|
shared: true,
|
|
414
414
|
unsafe: Boolean(options.unsafe),
|
|
415
|
-
sort: (_b = options === null || options === void 0 ? void 0 : options.tooltip) === null || _b === void 0 ? void 0 : _b.sort,
|
|
416
415
|
};
|
|
417
416
|
if (typeof options.manageTooltipConfig === 'function') {
|
|
418
417
|
json = callManageTooltipConfig(options, json, chart);
|
|
@@ -440,7 +439,7 @@ function getTooltip(tooltip, options, comments, holidays) {
|
|
|
440
439
|
let points = [];
|
|
441
440
|
let shared;
|
|
442
441
|
if (this.points) {
|
|
443
|
-
points = this.points;
|
|
442
|
+
points = getSortedData(this.points, (_b = options === null || options === void 0 ? void 0 : options.tooltip) === null || _b === void 0 ? void 0 : _b.sort);
|
|
444
443
|
shared = true;
|
|
445
444
|
}
|
|
446
445
|
else {
|
|
@@ -459,7 +458,6 @@ function getTooltip(tooltip, options, comments, holidays) {
|
|
|
459
458
|
withPercent: false,
|
|
460
459
|
tooltipHeader: null,
|
|
461
460
|
unsafe: Boolean(options.unsafe),
|
|
462
|
-
sort: (_c = options === null || options === void 0 ? void 0 : options.tooltip) === null || _c === void 0 ? void 0 : _c.sort,
|
|
463
461
|
};
|
|
464
462
|
if (isDatetimeXAxis) {
|
|
465
463
|
const items = this.points || Highcharts.splat(this);
|
|
@@ -476,9 +474,9 @@ function getTooltip(tooltip, options, comments, holidays) {
|
|
|
476
474
|
}
|
|
477
475
|
json.tooltipHeader = chart.time.dateFormat(xDateFormat, this.x);
|
|
478
476
|
}
|
|
479
|
-
else if ((
|
|
480
|
-
const customTooltipHeaderFormatter = (
|
|
481
|
-
const tooltipHeaderStringValue = String((
|
|
477
|
+
else if ((_e = (_d = (_c = extendedPoint.point) === null || _c === void 0 ? void 0 : _c.options) === null || _d === void 0 ? void 0 : _d.xFormatted) !== null && _e !== void 0 ? _e : (extendedPoint.x || extendedPoint.x === 0)) {
|
|
478
|
+
const customTooltipHeaderFormatter = (_f = options === null || options === void 0 ? void 0 : options.highcharts) === null || _f === void 0 ? void 0 : _f.tooltipHeaderFormatter;
|
|
479
|
+
const tooltipHeaderStringValue = String((_j = (_h = (_g = extendedPoint.point) === null || _g === void 0 ? void 0 : _g.options) === null || _h === void 0 ? void 0 : _h.xFormatted) !== null && _j !== void 0 ? _j : extendedPoint.x);
|
|
482
480
|
json.tooltipHeader = customTooltipHeaderFormatter
|
|
483
481
|
? customTooltipHeaderFormatter(tooltipHeaderStringValue)
|
|
484
482
|
: tooltipHeaderStringValue;
|
|
@@ -1071,7 +1069,9 @@ function drillOnClick(event, { options, chartType }) {
|
|
|
1071
1069
|
drillDownFilter =
|
|
1072
1070
|
chartType === 'scatter' ? drillDownFilter - 180 * 60 * 1000 : drillDownFilter;
|
|
1073
1071
|
}
|
|
1074
|
-
return isDateTime
|
|
1072
|
+
return isDateTime
|
|
1073
|
+
? dateTime({ input: drillDownFilter }).format('YYYY-MM-DD')
|
|
1074
|
+
: drillDownFilter;
|
|
1075
1075
|
}
|
|
1076
1076
|
return filter;
|
|
1077
1077
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type NavigatorPeriod = {
|
|
2
2
|
type: string;
|
|
3
3
|
value: string;
|
|
4
4
|
period: Period;
|
|
5
5
|
};
|
|
6
|
-
export
|
|
6
|
+
export type Period = 'month' | 'year' | 'day' | 'hour' | 'week' | 'quarter';
|