From 3955d2f1995fb204c16cda53e96b4eca50c2ef0e Mon Sep 17 00:00:00 2001 From: "Mr.Dr.Professor Patrick" Date: Fri, 30 Jun 2023 13:29:39 +0200 Subject: [PATCH] feat: add renderPluginLoader property (#184) --- src/components/ChartKit.tsx | 4 ++-- src/types/index.ts | 16 +++++++--------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/components/ChartKit.tsx b/src/components/ChartKit.tsx index 9cb6c326..7303cdd9 100644 --- a/src/components/ChartKit.tsx +++ b/src/components/ChartKit.tsx @@ -17,7 +17,7 @@ type ChartKitComponentProps = Omit, 'on const ChartKitComponent = (props: ChartKitComponentProps) => { const widgetRef = React.useRef(); - const {instanceRef, id: propsId, type, isMobile, ...restProps} = props; + const {instanceRef, id: propsId, type, isMobile, renderPluginLoader, ...restProps} = props; const ckId = React.useMemo(() => getRandomCKId(), []); const id = propsId || ckId; @@ -48,7 +48,7 @@ const ChartKitComponent = (props: ChartKitComponentProps ); return ( - }> + }>
diff --git a/src/types/index.ts b/src/types/index.ts index 754197fd..9c0570da 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -38,18 +38,16 @@ export type ChartKitProps = { id?: string; isMobile?: boolean; onLoad?: (data?: ChartKitOnLoadData) => void; - /** - * called on each render - * @param data - */ + /** Fires on each chartkit plugin's component render */ onRender?: (data: ChartKitOnRenderData) => void; - /** - * called on chart mount - * @param data - */ + /** Fires on chartkit plugin's component mount */ onChartLoad?: (data: ChartKitOnChartLoad) => void; - renderError?: RenderError; + /** Fires in case of unhandled plugin's exception */ onError?: ChartKitOnError; + /** Used to render user's error component */ + renderError?: RenderError; + /** Used to render user's plugin loader component */ + renderPluginLoader?: () => React.ReactNode; } & {[key in keyof Omit]: ChartKitWidget[T][key]}; export type ChartKitPlugin = {