-
Notifications
You must be signed in to change notification settings - Fork 400
feat(ConfigProvider): support global configuration #2921
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,11 @@ | ||
import React, { forwardRef } from 'react'; | ||
import type { ForwardRefExoticComponent, PropsWithoutRef, RefAttributes } from 'react'; | ||
import { ForwardRefExoticComponent, PropsWithoutRef, RefAttributes } from 'react'; | ||
import type { AreaOptions } from '../../core'; | ||
import type { CommonConfig, Chart } from '../../interface'; | ||
import { BaseChart } from '../base'; | ||
import type { Chart, CommonConfig } from '../../interface'; | ||
import { makeChartComp } from '../../util/makeChartComp'; | ||
|
||
export type AreaConfig = CommonConfig<AreaOptions>; | ||
|
||
const AreaChart: ForwardRefExoticComponent<PropsWithoutRef<AreaConfig> & RefAttributes<Chart>> = forwardRef< | ||
Chart, | ||
AreaConfig | ||
>((props, ref) => <BaseChart {...props} chartType="Area" ref={ref} />); | ||
const AreaChart: ForwardRefExoticComponent<PropsWithoutRef<AreaConfig> & RefAttributes<Chart>> = | ||
makeChartComp<AreaConfig>('Area'); | ||
|
||
export default AreaChart; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,12 @@ | ||
import React, { forwardRef } from 'react'; | ||
import type { ForwardRefExoticComponent, PropsWithoutRef, RefAttributes } from 'react'; | ||
import { BarOptions } from '../../core'; | ||
import type { CommonConfig, Chart } from '../../interface'; | ||
import { BaseChart } from '../base'; | ||
import type { Chart, CommonConfig } from '../../interface'; | ||
import { makeChartComp } from '../../util/makeChartComp'; | ||
|
||
export type BarConfig = CommonConfig<BarOptions>; | ||
|
||
const BarChart: ForwardRefExoticComponent<PropsWithoutRef<BarConfig> & RefAttributes<Chart>> = forwardRef< | ||
Chart, | ||
BarConfig | ||
>((props, ref) => <BaseChart {...props} chartType="Bar" ref={ref} />); | ||
const BarChart: ForwardRefExoticComponent<PropsWithoutRef<BarConfig> & RefAttributes<Chart>> = makeChartComp<BarConfig>( | ||
'Bar' | ||
); | ||
|
||
export default BarChart; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,11 @@ | ||
import React, { forwardRef } from 'react'; | ||
import type { ForwardRefExoticComponent, PropsWithoutRef, RefAttributes } from 'react'; | ||
import type { BidirectionalBarOptions } from '../../core'; | ||
import type { Chart, CommonConfig } from '../../interface'; | ||
import { BaseChart } from '../base'; | ||
import { makeChartComp } from '../../util/makeChartComp'; | ||
|
||
export type BidirectionalBarConfig = CommonConfig<BidirectionalBarOptions>; | ||
|
||
const BidirectionalBarChart: ForwardRefExoticComponent<PropsWithoutRef<BidirectionalBarConfig> & RefAttributes<Chart>> = | ||
forwardRef<Chart, BidirectionalBarConfig>((props, ref) => ( | ||
<BaseChart {...props} chartType="BidirectionalBar" ref={ref} /> | ||
)); | ||
makeChartComp<BidirectionalBarConfig>('BidirectionalBar'); | ||
|
||
export default BidirectionalBarChart; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,11 @@ | ||
import React, { forwardRef } from 'react'; | ||
import type { ForwardRefExoticComponent, PropsWithoutRef, RefAttributes } from 'react'; | ||
import type { BoxOptions } from '../../core'; | ||
import type { Chart, CommonConfig } from '../../interface'; | ||
import { BaseChart } from '../base'; | ||
import { makeChartComp } from '../../util/makeChartComp'; | ||
|
||
export type BoxConfig = CommonConfig<BoxOptions>; | ||
|
||
const BoxChart: ForwardRefExoticComponent<PropsWithoutRef<BoxConfig> & RefAttributes<Chart>> = forwardRef< | ||
Chart, | ||
BoxConfig | ||
>((props, ref) => <BaseChart {...props} chartType="Box" ref={ref} />); | ||
const BoxChart: ForwardRefExoticComponent<PropsWithoutRef<BoxConfig> & RefAttributes<Chart>> = | ||
makeChartComp<BoxConfig>('Box'); | ||
|
||
export default BoxChart; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,11 @@ | ||
import React, { forwardRef } from 'react'; | ||
import type { ForwardRefExoticComponent, PropsWithoutRef, RefAttributes } from 'react'; | ||
import type { BulletOptions } from '../../core'; | ||
import type { Chart, CommonConfig } from '../../interface'; | ||
import { BaseChart } from '../base'; | ||
import { makeChartComp } from '../../util/makeChartComp'; | ||
|
||
export type BulletConfig = CommonConfig<BulletOptions>; | ||
|
||
const BulletChart: ForwardRefExoticComponent<PropsWithoutRef<BulletConfig> & RefAttributes<Chart>> = forwardRef< | ||
Chart, | ||
BulletConfig | ||
>((props, ref) => <BaseChart {...props} chartType="Bullet" ref={ref} />); | ||
const BulletChart: ForwardRefExoticComponent<PropsWithoutRef<BulletConfig> & RefAttributes<Chart>> = | ||
makeChartComp<BulletConfig>('Bullet'); | ||
|
||
export default BulletChart; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,11 @@ | ||
import React, { forwardRef } from 'react'; | ||
import type { ForwardRefExoticComponent, PropsWithoutRef, RefAttributes } from 'react'; | ||
import type { CirclePackingOptions } from '../../core'; | ||
import type { Chart, CommonConfig } from '../../interface'; | ||
import { BaseChart } from '../base'; | ||
import { makeChartComp } from '../../util/makeChartComp'; | ||
|
||
export type CirclePackingConfig = CommonConfig<CirclePackingOptions>; | ||
|
||
const CirclePackingChart: ForwardRefExoticComponent<PropsWithoutRef<CirclePackingConfig> & RefAttributes<Chart>> = | ||
forwardRef<Chart, CirclePackingConfig>((props, ref) => <BaseChart {...props} chartType="CirclePacking" ref={ref} />); | ||
makeChartComp<CirclePackingConfig>('CirclePacking'); | ||
|
||
export default CirclePackingChart; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,11 @@ | ||
import React, { forwardRef } from 'react'; | ||
import type { ForwardRefExoticComponent, PropsWithoutRef, RefAttributes } from 'react'; | ||
import type { ColumnOptions } from '../../core'; | ||
import type { Chart, CommonConfig } from '../../interface'; | ||
import { BaseChart } from '../base'; | ||
import { makeChartComp } from '../../util/makeChartComp'; | ||
|
||
export type ColumnConfig = CommonConfig<ColumnOptions>; | ||
|
||
const ColumnChart: ForwardRefExoticComponent<PropsWithoutRef<ColumnConfig> & RefAttributes<Chart>> = forwardRef< | ||
Chart, | ||
ColumnConfig | ||
>((props, ref) => <BaseChart {...props} chartType="Column" ref={ref} />); | ||
const ColumnChart: ForwardRefExoticComponent<PropsWithoutRef<ColumnConfig> & RefAttributes<Chart>> = | ||
makeChartComp<ColumnConfig>('Column'); | ||
|
||
export default ColumnChart; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import React, { ReactNode } from 'react'; | ||
import { ConfigContext, ConfigValue } from '../../context'; | ||
|
||
export interface ConfigProviderProps extends ConfigValue { | ||
children?: ReactNode; | ||
} | ||
|
||
export default function ConfigProvider({ children, ...value }: ConfigProviderProps) { | ||
return <ConfigContext.Provider value={value}>{children}</ConfigContext.Provider>; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,11 @@ | ||
import React, { forwardRef } from 'react'; | ||
import type { ForwardRefExoticComponent, PropsWithoutRef, RefAttributes } from 'react'; | ||
import { DualAxesOptions } from '../../core'; | ||
import { Chart, CommonConfig } from '../../interface'; | ||
import { BaseChart } from '../base'; | ||
import { makeChartComp } from '../../util/makeChartComp'; | ||
|
||
export type DualAxesConfig = CommonConfig<DualAxesOptions>; | ||
|
||
const DualAxesChart: ForwardRefExoticComponent<PropsWithoutRef<DualAxesConfig> & RefAttributes<Chart>> = forwardRef< | ||
Chart, | ||
DualAxesConfig | ||
>((props, ref) => <BaseChart {...props} chartType="DualAxes" ref={ref} />); | ||
const DualAxesChart: ForwardRefExoticComponent<PropsWithoutRef<DualAxesConfig> & RefAttributes<Chart>> = | ||
makeChartComp<DualAxesConfig>('DualAxes'); | ||
|
||
export default DualAxesChart; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,11 @@ | ||
import React, { forwardRef } from 'react'; | ||
import type { ForwardRefExoticComponent, PropsWithoutRef, RefAttributes } from 'react'; | ||
import type { FunnelOptions } from '../../core'; | ||
import type { Chart, CommonConfig } from '../../interface'; | ||
import { BaseChart } from '../base'; | ||
import { makeChartComp } from '../../util/makeChartComp'; | ||
|
||
export type FunnelConfig = CommonConfig<FunnelOptions>; | ||
|
||
const FunnelChart: ForwardRefExoticComponent<PropsWithoutRef<FunnelConfig> & RefAttributes<Chart>> = forwardRef< | ||
Chart, | ||
FunnelConfig | ||
>((props, ref) => <BaseChart {...props} chartType="Funnel" ref={ref} />); | ||
const FunnelChart: ForwardRefExoticComponent<PropsWithoutRef<FunnelConfig> & RefAttributes<Chart>> = | ||
makeChartComp<FunnelConfig>('Funnel'); | ||
|
||
export default FunnelChart; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,11 @@ | ||
import React, { forwardRef } from 'react'; | ||
import type { ForwardRefExoticComponent, PropsWithoutRef, RefAttributes } from 'react'; | ||
import type { GaugeOptions } from '../../core'; | ||
import type { Chart, CommonConfig } from '../../interface'; | ||
import { BaseChart } from '../base'; | ||
import { makeChartComp } from '../../util/makeChartComp'; | ||
|
||
export type GaugeConfig = CommonConfig<GaugeOptions>; | ||
|
||
const GaugeChart: ForwardRefExoticComponent<PropsWithoutRef<GaugeConfig> & RefAttributes<Chart>> = forwardRef< | ||
Chart, | ||
GaugeConfig | ||
>((props: GaugeConfig, ref) => <BaseChart {...props} chartType="Gauge" ref={ref} />); | ||
const GaugeChart: ForwardRefExoticComponent<PropsWithoutRef<GaugeConfig> & RefAttributes<Chart>> = | ||
makeChartComp<GaugeConfig>('Gauge'); | ||
|
||
export default GaugeChart; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,11 @@ | ||
import React, { forwardRef } from 'react'; | ||
import type { ForwardRefExoticComponent, PropsWithoutRef, RefAttributes } from 'react'; | ||
import type { HeatmapOptions } from '../../core'; | ||
import type { Chart, CommonConfig } from '../../interface'; | ||
import { BaseChart } from '../base'; | ||
import { makeChartComp } from '../../util/makeChartComp'; | ||
|
||
export type HeatmapConfig = CommonConfig<HeatmapOptions>; | ||
|
||
const HeatmapChart: ForwardRefExoticComponent<PropsWithoutRef<HeatmapConfig> & RefAttributes<Chart>> = forwardRef< | ||
Chart, | ||
HeatmapConfig | ||
>((props, ref) => <BaseChart {...props} chartType="Heatmap" ref={ref} />); | ||
const HeatmapChart: ForwardRefExoticComponent<PropsWithoutRef<HeatmapConfig> & RefAttributes<Chart>> = | ||
makeChartComp<HeatmapConfig>('Heatmap'); | ||
|
||
export default HeatmapChart; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,11 @@ | ||
import React, { forwardRef } from 'react'; | ||
import type { ForwardRefExoticComponent, PropsWithoutRef, RefAttributes } from 'react'; | ||
import type { HistogramOptions } from '../../core'; | ||
import type { Chart, CommonConfig } from '../../interface'; | ||
import { BaseChart } from '../base'; | ||
import { makeChartComp } from '../../util/makeChartComp'; | ||
|
||
export type HistogramConfig = CommonConfig<HistogramOptions>; | ||
|
||
const HistogramChart: ForwardRefExoticComponent<PropsWithoutRef<HistogramConfig> & RefAttributes<Chart>> = forwardRef< | ||
Chart, | ||
HistogramConfig | ||
>((props, ref) => <BaseChart {...props} chartType="Histogram" ref={ref} />); | ||
const HistogramChart: ForwardRefExoticComponent<PropsWithoutRef<HistogramConfig> & RefAttributes<Chart>> = | ||
makeChartComp<HistogramConfig>('Histogram'); | ||
|
||
export default HistogramChart; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,11 @@ | ||
import React, { forwardRef } from 'react'; | ||
import type { ForwardRefExoticComponent, PropsWithoutRef, RefAttributes } from 'react'; | ||
import type { LineOptions } from '../../core'; | ||
import type { Chart, CommonConfig } from '../../interface'; | ||
import { BaseChart } from '../base'; | ||
import { makeChartComp } from '../../util/makeChartComp'; | ||
|
||
export type LineConfig = CommonConfig<LineOptions>; | ||
|
||
const LineChart: ForwardRefExoticComponent<PropsWithoutRef<LineConfig> & RefAttributes<Chart>> = forwardRef< | ||
Chart, | ||
LineConfig | ||
>((props, ref) => <BaseChart {...props} chartType="Line" ref={ref} />); | ||
const LineChart: ForwardRefExoticComponent<PropsWithoutRef<LineConfig> & RefAttributes<Chart>> = | ||
makeChartComp<LineConfig>('Line'); | ||
|
||
export default LineChart; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,10 @@ | ||
import React, { forwardRef } from 'react'; | ||
import type { ForwardRefExoticComponent, PropsWithoutRef, RefAttributes } from 'react'; | ||
import { BaseChart } from '../base'; | ||
|
||
import type { LiquidOptions } from '../../core'; | ||
import type { Chart, CommonConfig } from '../../interface'; | ||
|
||
import { makeChartComp } from '../../util/makeChartComp'; | ||
export type LiquidConfig = CommonConfig<LiquidOptions>; | ||
|
||
const LiquidChart: ForwardRefExoticComponent<PropsWithoutRef<LiquidConfig> & RefAttributes<Chart>> = forwardRef< | ||
Chart, | ||
LiquidConfig | ||
>((props, ref) => <BaseChart {...props} chartType="Liquid" ref={ref} />); | ||
const LiquidChart: ForwardRefExoticComponent<PropsWithoutRef<LiquidConfig> & RefAttributes<Chart>> = | ||
makeChartComp<LiquidConfig>('Liquid'); | ||
|
||
export default LiquidChart; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,11 @@ | ||
import React, { forwardRef } from 'react'; | ||
import type { ForwardRefExoticComponent, PropsWithoutRef, RefAttributes } from 'react'; | ||
import type { MixOptions } from '../../core'; | ||
import type { Chart, CommonConfig } from '../../interface'; | ||
import { BaseChart } from '../base'; | ||
import { makeChartComp } from '../../util/makeChartComp'; | ||
|
||
export type MixConfig = CommonConfig<MixOptions>; | ||
|
||
const MixChart: ForwardRefExoticComponent<PropsWithoutRef<MixConfig> & RefAttributes<Chart>> = forwardRef< | ||
Chart, | ||
MixConfig | ||
>((props, ref) => <BaseChart {...props} chartType="Mix" ref={ref} />); | ||
const MixChart: ForwardRefExoticComponent<PropsWithoutRef<MixConfig> & RefAttributes<Chart>> = | ||
makeChartComp<MixConfig>('Mix'); | ||
|
||
export default MixChart; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,11 @@ | ||
import React, { forwardRef } from 'react'; | ||
import type { ForwardRefExoticComponent, PropsWithoutRef, RefAttributes } from 'react'; | ||
import type { PieOptions } from '../../core'; | ||
import type { Chart, CommonConfig } from '../../interface'; | ||
import { BaseChart } from '../base'; | ||
import { makeChartComp } from '../../util/makeChartComp'; | ||
|
||
export type PieConfig = CommonConfig<PieOptions>; | ||
|
||
const PieChart: ForwardRefExoticComponent<PropsWithoutRef<PieConfig> & RefAttributes<Chart>> = forwardRef< | ||
Chart, | ||
PieConfig | ||
>((props, ref) => <BaseChart {...props} chartType="Pie" ref={ref} />); | ||
const PieChart: ForwardRefExoticComponent<PropsWithoutRef<PieConfig> & RefAttributes<Chart>> = | ||
makeChartComp<PieConfig>('Pie'); | ||
|
||
export default PieChart; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,11 @@ | ||
import React, { forwardRef } from 'react'; | ||
import type { ForwardRefExoticComponent, PropsWithoutRef, RefAttributes } from 'react'; | ||
import { BaseChart } from '../base'; | ||
|
||
import type { RadarOptions } from '../../core'; | ||
import type { Chart, CommonConfig } from '../../interface'; | ||
import { makeChartComp } from '../../util/makeChartComp'; | ||
|
||
export type RadarConfig = CommonConfig<RadarOptions>; | ||
|
||
const RadarChart: ForwardRefExoticComponent<PropsWithoutRef<RadarConfig> & RefAttributes<Chart>> = forwardRef< | ||
Chart, | ||
RadarConfig | ||
>((props, ref) => <BaseChart {...props} chartType="Radar" ref={ref} />); | ||
const RadarChart: ForwardRefExoticComponent<PropsWithoutRef<RadarConfig> & RefAttributes<Chart>> = | ||
makeChartComp<RadarConfig>('Radar'); | ||
|
||
export default RadarChart; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,11 @@ | ||
import React, { forwardRef } from 'react'; | ||
import type { ForwardRefExoticComponent, PropsWithoutRef, RefAttributes } from 'react'; | ||
import type { RadialBarOptions } from '../../core'; | ||
import type { Chart, CommonConfig } from '../../interface'; | ||
import { BaseChart } from '../base'; | ||
import { makeChartComp } from '../../util/makeChartComp'; | ||
|
||
export type RadialBarConfig = CommonConfig<RadialBarOptions>; | ||
|
||
const RadialBar: ForwardRefExoticComponent<PropsWithoutRef<RadialBarConfig> & RefAttributes<Chart>> = forwardRef< | ||
Chart, | ||
RadialBarConfig | ||
>((props, ref) => <BaseChart {...props} chartType="RadialBar" ref={ref} />); | ||
const RadialBar: ForwardRefExoticComponent<PropsWithoutRef<RadialBarConfig> & RefAttributes<Chart>> = | ||
makeChartComp<RadialBarConfig>('RadialBar'); | ||
|
||
export default RadialBar; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,11 @@ | ||
import React, { forwardRef } from 'react'; | ||
import type { ForwardRefExoticComponent, PropsWithoutRef, RefAttributes } from 'react'; | ||
import { BaseChart } from '../base'; | ||
|
||
import type { RoseOptions } from '../../core'; | ||
import type { Chart, CommonConfig } from '../../interface'; | ||
import { makeChartComp } from '../../util/makeChartComp'; | ||
|
||
export type RoseConfig = CommonConfig<RoseOptions>; | ||
|
||
const RoseChart: ForwardRefExoticComponent<PropsWithoutRef<RoseConfig> & RefAttributes<Chart>> = forwardRef< | ||
Chart, | ||
RoseConfig | ||
>((props, ref) => <BaseChart {...props} chartType="Rose" ref={ref} />); | ||
const RoseChart: ForwardRefExoticComponent<PropsWithoutRef<RoseConfig> & RefAttributes<Chart>> = | ||
makeChartComp<RoseConfig>('Rose'); | ||
|
||
export default RoseChart; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,11 @@ | ||
import React, { forwardRef } from 'react'; | ||
import type { ForwardRefExoticComponent, PropsWithoutRef, RefAttributes } from 'react'; | ||
import type { SankeyOptions } from '../../core'; | ||
import type { Chart, CommonConfig } from '../../interface'; | ||
import { BaseChart } from '../base'; | ||
import { makeChartComp } from '../../util/makeChartComp'; | ||
|
||
export type SankeyConfig = CommonConfig<SankeyOptions>; | ||
|
||
const SankeyChart: ForwardRefExoticComponent<PropsWithoutRef<SankeyConfig> & RefAttributes<Chart>> = forwardRef< | ||
Chart, | ||
SankeyConfig | ||
>((props, ref) => <BaseChart {...props} chartType="Sankey" ref={ref} />); | ||
const SankeyChart: ForwardRefExoticComponent<PropsWithoutRef<SankeyConfig> & RefAttributes<Chart>> = | ||
makeChartComp<SankeyConfig>('Sankey'); | ||
|
||
export default SankeyChart; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
加上 Memo 避免不必要的二次渲染?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
也可以合并配置之后在 makeChartComp 中实现。