Skip to content

Commit

Permalink
chore: export order
Browse files Browse the repository at this point in the history
  • Loading branch information
lvisei committed Nov 19, 2024
1 parent 05abde2 commit 61303fb
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 30 deletions.
5 changes: 5 additions & 0 deletions .changeset/witty-camels-stare.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@antv/gpt-vis': minor
---

lite component for GPTVis
23 changes: 5 additions & 18 deletions src/GPTVis/index.tsx
Original file line number Diff line number Diff line change
@@ -1,29 +1,16 @@
import React, { memo } from 'react';
import type { Options } from 'react-markdown';
import Markdown from 'react-markdown';
import rehypeRaw from 'rehype-raw';
import { withDefaultChartCode } from '../ChartCodeRender';
import { default as GPTVisLite, type GPTVisLiteProps } from './Lite';

export interface GPTVisProps extends Options {
/** 自定义 markdown components样式 */
components?:
| Options['components']
| {
[key: string]: (props: any) => React.ReactNode;
};
}
export interface GPTVisProps extends GPTVisLiteProps {}

const CodeBlock = withDefaultChartCode();

const GPTVis: React.FC<GPTVisProps> = ({ children, components, rehypePlugins, ...rest }) => {
const GPTVis: React.FC<GPTVisProps> = ({ children, components, ...rest }) => {
return (
<Markdown
components={{ code: CodeBlock, ...components }}
rehypePlugins={[rehypeRaw, ...(rehypePlugins ? rehypePlugins : [])]}
{...rest}
>
<GPTVisLite components={{ code: CodeBlock, ...components }} {...rest}>
{children}
</Markdown>
</GPTVisLite>
);
};

Expand Down
24 changes: 14 additions & 10 deletions src/export.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,33 @@
/********** plot chart **********/
import { default as Area, type AreaProps } from './Area';
import { default as Bar, type BarProps } from './Bar';
import { default as Column, type ColumnProps } from './Column';
import { default as DualAxes, type DualAxesProps } from './DualAxes';
import { default as FlowDiagram, type FlowDiagramProps } from './FlowDiagram';
import { default as HeatMap, type HeatMapProps } from './HeatMap';
import { default as Histogram, type HistogramProps } from './Histogram';
import { default as Line, type LineProps } from './Line';
import { default as MindMap, type MindMapProps } from './MindMap';
import { default as NetworkGraph, type NetworkGraphProps } from './NetworkGraph';
import { default as PathMap, type PathMapProps } from './PathMap';
import { default as Pie, type PieProps } from './Pie';
import { default as PinMap, type PinMapProps } from './PinMap';
import { default as Radar, type RadarProps } from './Radar';
import { default as Scatter, type ScatterProps } from './Scatter';
import { default as Treemap, type TreemapProps } from './Treemap';
import { ChartType } from './types';
import { default as WordCloud, type WordCloudProps } from './WordCloud';

export { default as ConfigProvider, type ConfigProviderProps } from './ConfigProvider';
/********** graph chart **********/
import { default as FlowDiagram, type FlowDiagramProps } from './FlowDiagram';
import { default as MindMap, type MindMapProps } from './MindMap';
import { default as NetworkGraph, type NetworkGraphProps } from './NetworkGraph';
import { default as PathMap, type PathMapProps } from './PathMap';
import { default as PinMap, type PinMapProps } from './PinMap';
import { ChartType } from './types';
export { default as IndentedTree, type IndentedTreeProps } from './IndentedTree';
export { default as Map, type MapProps } from './Map';
export { default as OrganizationChart, type OrganizationChartProps } from './OrganizationChart';

/********** map chart **********/
export { default as Map, type MapProps } from './Map';

/********** NTV **********/
export { VisText, type VisTextProps } from './Text';

export {
Area,
Bar,
Expand Down Expand Up @@ -59,8 +65,6 @@ export {
type WordCloudProps,
};

export { VisText, type VisTextProps } from './Text';

export const DEFAULT_CHART_COMPONENTS: Record<string, React.FC<any>> = {
[ChartType.Line]: Line,
[ChartType.Column]: Column,
Expand Down
9 changes: 7 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
/********** export chart **********/
export * from './export';
export { default as version } from './version';

/********** export types **********/
export * from './types';

/********** export GPTVis **********/
export { withChartCode, withDefaultChartCode } from './ChartCodeRender';
export type { CodeBlockComponent, WithChartCodeOptions } from './ChartCodeRender/type';
export { default as ConfigProvider, type ConfigProviderProps } from './ConfigProvider';
export { default as GPTVis, type GPTVisProps } from './GPTVis';
export { default as GPTVisLite, type GPTVisLiteProps } from './GPTVis/Lite';

export * from './types';
export { default as version } from './version';

0 comments on commit 61303fb

Please sign in to comment.