From 6d5cbc17ded3e25408c316b05a1fa5483adcbf79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BB=D0=B0=D0=B5=D0=B2=20=D0=95=D0=B2=D0=B3=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B9?= Date: Fri, 18 Nov 2022 14:56:24 +0300 Subject: [PATCH 1/4] feat(Highcharts plugin): rename ChartKitComment to HighchartsComment --- src/plugins/highcharts/renderer/helpers/graph.ts | 4 ++-- src/plugins/highcharts/types/comments.ts | 2 +- src/plugins/highcharts/types/index.ts | 2 +- src/plugins/highcharts/types/misc.ts | 8 ++++---- src/plugins/highcharts/types/widget.ts | 6 +++--- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/plugins/highcharts/renderer/helpers/graph.ts b/src/plugins/highcharts/renderer/helpers/graph.ts index 7227543a..3bddfeb5 100644 --- a/src/plugins/highcharts/renderer/helpers/graph.ts +++ b/src/plugins/highcharts/renderer/helpers/graph.ts @@ -2,7 +2,7 @@ import type {ChartKitHolidays} from '../../../../types'; import type { Highcharts, HighchartsWidgetData, - ChartKitComment, + HighchartsComment, ExtendedHChart, XAxisItem, } from '../../types'; @@ -18,7 +18,7 @@ import './graph.scss'; type GetGraphArgs = { options: ConfigOptions; data: HighchartsWidgetData['data']; - comments?: ChartKitComment[]; + comments?: HighchartsComment[]; holidays?: ChartKitHolidays; isMobile?: boolean; }; diff --git a/src/plugins/highcharts/types/comments.ts b/src/plugins/highcharts/types/comments.ts index 48a8577a..ec34d28d 100644 --- a/src/plugins/highcharts/types/comments.ts +++ b/src/plugins/highcharts/types/comments.ts @@ -52,4 +52,4 @@ interface CommentFlagX extends CommentBase { }; } -export type ChartKitComment = CommentDotXY | CommentBandX | CommentLineX | CommentFlagX; +export type HighchartsComment = CommentDotXY | CommentBandX | CommentLineX | CommentFlagX; diff --git a/src/plugins/highcharts/types/index.ts b/src/plugins/highcharts/types/index.ts index 87470c38..47f58e6e 100644 --- a/src/plugins/highcharts/types/index.ts +++ b/src/plugins/highcharts/types/index.ts @@ -1,4 +1,4 @@ export type {Highcharts} from './lib'; export type {HighchartsWidgetData} from './widget'; export type {DrillDownConfig, ExtendedHChart, StringParams, XAxisItem} from './misc'; -export type {ChartKitComment} from './comments'; +export type {HighchartsComment} from './comments'; diff --git a/src/plugins/highcharts/types/misc.ts b/src/plugins/highcharts/types/misc.ts index f55ef6ec..12fcd5d5 100644 --- a/src/plugins/highcharts/types/misc.ts +++ b/src/plugins/highcharts/types/misc.ts @@ -1,4 +1,4 @@ -import type {ChartKitComment} from './comments'; +import type {HighchartsComment} from './comments'; export type StringParams = Record; @@ -14,9 +14,9 @@ export type XAxisItem = Highcharts.Axis & { export type ExtendedHChart = Highcharts.Chart & { userOptions: Highcharts.Options & { - _internalComments: ChartKitComment[]; - _externalComments: ChartKitComment[]; - _getComments: () => ChartKitComment[]; + _internalComments: HighchartsComment[]; + _externalComments: HighchartsComment[]; + _getComments: () => HighchartsComment[]; }; xAxis: XAxisItem[]; navigator?: Highcharts.Options['navigator']; diff --git a/src/plugins/highcharts/types/widget.ts b/src/plugins/highcharts/types/widget.ts index f2544a81..511bcbed 100644 --- a/src/plugins/highcharts/types/widget.ts +++ b/src/plugins/highcharts/types/widget.ts @@ -1,5 +1,5 @@ import type {Highcharts} from './lib'; -import type {ChartKitComment} from './comments'; +import type {HighchartsComment} from './comments'; import type {DrillDownConfig, StringParams} from './misc'; type GraphWidgetSeriesOptions = Highcharts.SeriesOptionsType & { @@ -22,7 +22,7 @@ export type HighchartsWidgetData = { | { graphs: GraphWidgetSeriesOptions[]; } - ) & {comments?: ChartKitComment[]}; + ) & {comments?: HighchartsComment[]}; config: { hideComments?: boolean; hideHolidaysBands?: boolean; @@ -46,6 +46,6 @@ export type HighchartsWidgetData = { }; libraryConfig: Highcharts.Options; params?: StringParams; - comments?: ChartKitComment[]; + comments?: HighchartsComment[]; sideMarkdown?: string; }; From 67ad164148a269a35fd4e3a31b8f93cbf0736a1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BB=D0=B0=D0=B5=D0=B2=20=D0=95=D0=B2=D0=B3=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B9?= Date: Fri, 18 Nov 2022 15:00:59 +0300 Subject: [PATCH 2/4] feat(Highcharts plugin): add HighchartsComment export --- src/plugins/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/index.ts b/src/plugins/index.ts index e0ccbe7f..7285deac 100644 --- a/src/plugins/index.ts +++ b/src/plugins/index.ts @@ -3,4 +3,4 @@ export type {Yagr, YagrWidgetData} from './yagr/types'; export {IndicatorPlugin} from './indicator'; export type {IndicatorWidgetData} from './indicator/types'; export {HighchartsPlugin} from './highcharts'; -export type {Highcharts, HighchartsWidgetData} from './highcharts/types'; +export type {Highcharts, HighchartsWidgetData, HighchartsComment} from './highcharts/types'; From ac29021dd9961322b90bf5f962a74eebe68c1a48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BB=D0=B0=D0=B5=D0=B2=20=D0=95=D0=B2=D0=B3=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B9?= Date: Fri, 18 Nov 2022 15:09:19 +0300 Subject: [PATCH 3/4] feat(Highcharts plugin): rename ChartkitWidget to ChartKitWidget --- src/index.ts | 2 +- src/types/index.ts | 12 ++++++------ src/types/widget.ts | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/index.ts b/src/index.ts index df0e0855..d1ec8b74 100644 --- a/src/index.ts +++ b/src/index.ts @@ -10,7 +10,7 @@ export type { ChartKitRef, ChartKitWidgetRef, ChartkitType, - ChartkitWidget, + ChartKitWidget, } from './types'; export {settings}; diff --git a/src/types/index.ts b/src/types/index.ts index 0a1d2ca5..c5fbd76c 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -1,10 +1,10 @@ -import type {ChartkitWidget} from './widget'; +import type {ChartKitWidget} from './widget'; export type {ChartKitHolidays} from './misc'; export type ChartKitLang = 'ru' | 'en'; -export type ChartkitType = keyof ChartkitWidget; +export type ChartkitType = keyof ChartKitWidget; export type ChartKitRef = { reflow: (details?: unknown) => void; @@ -15,7 +15,7 @@ export type ChartKitWidgetRef = { }; export type ChartKitOnLoadData = { - widget?: ChartkitWidget[T]['widget']; + widget?: ChartKitWidget[T]['widget']; widgetRendering?: number; }; @@ -23,16 +23,16 @@ export type ChartKitOnError = (data: {error: any}) => void; export type ChartKitProps = { type: T; - data: ChartkitWidget[T]['data']; + data: ChartKitWidget[T]['data']; id?: string; isMobile?: boolean; onLoad?: (data?: ChartKitOnLoadData) => void; onError?: ChartKitOnError; -} & {[key in keyof Omit]: ChartkitWidget[T][key]}; +} & {[key in keyof Omit]: ChartKitWidget[T][key]}; export type ChartKitPlugin = { type: ChartkitType; renderer: React.LazyExoticComponent; }; -export type {ChartkitWidget}; +export type {ChartKitWidget}; diff --git a/src/types/widget.ts b/src/types/widget.ts index 9f6de217..74ee5eb7 100644 --- a/src/types/widget.ts +++ b/src/types/widget.ts @@ -3,7 +3,7 @@ import type {YagrWidgetData} from '../plugins/yagr/types'; import type {IndicatorWidgetData} from '../plugins/indicator/types'; import type {Highcharts, HighchartsWidgetData, StringParams} from '../plugins/highcharts/types'; -export interface ChartkitWidget { +export interface ChartKitWidget { yagr: { data: YagrWidgetData; widget: Yagr; From f28f6758b186fd0a9f50614ace323b4f2614e0ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BB=D0=B0=D0=B5=D0=B2=20=D0=95=D0=B2=D0=B3=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B9?= Date: Fri, 18 Nov 2022 15:15:05 +0300 Subject: [PATCH 4/4] feat(Highcharts plugin): rename ChartkitType to ChartKitType --- src/components/ChartKit.tsx | 10 +++++----- src/index.ts | 2 +- src/types/index.ts | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/components/ChartKit.tsx b/src/components/ChartKit.tsx index a930bfbd..8cc8a40c 100644 --- a/src/components/ChartKit.tsx +++ b/src/components/ChartKit.tsx @@ -3,7 +3,7 @@ import block from 'bem-cn-lite'; import {i18n} from '../i18n'; import {CHARTKIT_ERROR_CODE, ChartKitError, settings} from '../libs'; import {getRandomCKId, typedMemo} from '../utils'; -import type {ChartkitType, ChartKitRef, ChartKitWidgetRef, ChartKitProps} from '../types'; +import type {ChartKitType, ChartKitRef, ChartKitWidgetRef, ChartKitProps} from '../types'; import {ErrorBoundary} from './ErrorBoundary/ErrorBoundary'; import {Loader} from './Loader/Loader'; @@ -12,11 +12,11 @@ import './ChartKit.scss'; const b = block('chartkit'); -type ChartKitComponentProps = Omit, 'onError'> & { +type ChartKitComponentProps = Omit, 'onError'> & { instanceRef?: React.ForwardedRef; }; -const ChartKitComponent = (props: ChartKitComponentProps) => { +const ChartKitComponent = (props: ChartKitComponentProps) => { const widgetRef = React.useRef(); const {instanceRef, id = getRandomCKId(), type, data, onLoad, isMobile, ...restProps} = props; const lang = settings.get('lang'); @@ -62,14 +62,14 @@ const ChartKitComponent = (props: ChartKitComponentProps const ChartKitComponentWithErrorBoundary = React.forwardRef< ChartKitRef | undefined, - ChartKitProps + ChartKitProps >(function ChartKitComponentWithErrorBoundary(props, ref) { return ( ); -}) /* https://stackoverflow.com/a/58473012 */ as ( +}) /* https://stackoverflow.com/a/58473012 */ as ( props: ChartKitProps & {ref?: React.ForwardedRef}, ) => ReturnType; diff --git a/src/index.ts b/src/index.ts index d1ec8b74..9729cfd6 100644 --- a/src/index.ts +++ b/src/index.ts @@ -9,7 +9,7 @@ export type { ChartKitProps, ChartKitRef, ChartKitWidgetRef, - ChartkitType, + ChartKitType, ChartKitWidget, } from './types'; diff --git a/src/types/index.ts b/src/types/index.ts index c5fbd76c..a3ac62be 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -4,7 +4,7 @@ export type {ChartKitHolidays} from './misc'; export type ChartKitLang = 'ru' | 'en'; -export type ChartkitType = keyof ChartKitWidget; +export type ChartKitType = keyof ChartKitWidget; export type ChartKitRef = { reflow: (details?: unknown) => void; @@ -14,14 +14,14 @@ export type ChartKitWidgetRef = { reflow?: ChartKitRef['reflow']; }; -export type ChartKitOnLoadData = { +export type ChartKitOnLoadData = { widget?: ChartKitWidget[T]['widget']; widgetRendering?: number; }; export type ChartKitOnError = (data: {error: any}) => void; -export type ChartKitProps = { +export type ChartKitProps = { type: T; data: ChartKitWidget[T]['data']; id?: string; @@ -31,7 +31,7 @@ export type ChartKitProps = { } & {[key in keyof Omit]: ChartKitWidget[T][key]}; export type ChartKitPlugin = { - type: ChartkitType; + type: ChartKitType; renderer: React.LazyExoticComponent; };