Skip to content
This repository has been archived by the owner on Apr 23, 2020. It is now read-only.

Commit

Permalink
feat: 修改导出方式
Browse files Browse the repository at this point in the history
  • Loading branch information
wangxingkang committed Jun 15, 2019
1 parent e115dd6 commit b793acc
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 12 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rc-charts",
"version": "0.0.1",
"version": "0.0.2",
"description": "图表组件",
"main": "dist/index.js",
"module": "dist/index.esm.js",
Expand Down
6 changes: 1 addition & 5 deletions src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
import Pie from './pie';

export default {
Pie
};
export { default as Pie } from './pie';
1 change: 1 addition & 0 deletions src/pie/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import PieChart from './pie-chart';

export { IPieProps, TPadding, IDataItem } from './pie-chart';
export default PieChart;
10 changes: 4 additions & 6 deletions src/pie/pie-chart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import './pie-chart.less';

const prefixCls = 'rc-pie-chart';

interface IDataItem {
export interface IDataItem {
x: string;
y: number;
}
Expand All @@ -24,7 +24,7 @@ export type TPadding =
| [number, number, number, number]
| [string, string];

export interface IProps {
export interface IPieProps {
className?: string;
style?: React.CSSProperties;
// 图表动画开关,默认为 true
Expand All @@ -36,7 +36,7 @@ export interface IProps {
height?: number;
// 图表内边距
padding?: TPadding;
data?: IDataItem[];
data: IDataItem[];
total?: React.ReactNode | number | (() => React.ReactNode | number);
title?: React.ReactNode;
subTitle?: React.ReactNode;
Expand All @@ -63,7 +63,7 @@ const scale = {
},
};

const PieChart: React.FC<IProps> = (props) => {
const PieChart: React.FC<IPieProps> = (props) => {
const {
className,
style,
Expand All @@ -81,7 +81,6 @@ const PieChart: React.FC<IProps> = (props) => {
lineWidth,
onGetG2Instance
} = props;
const rootRef = React.useRef(null);

const handleGetG2Instance = (chart: G2.Chart) => {
onGetG2Instance && onGetG2Instance(chart);
Expand Down Expand Up @@ -136,7 +135,6 @@ const PieChart: React.FC<IProps> = (props) => {

return (
<div
ref={rootRef}
className={classNames(className, {
[`${prefixCls}`]: true
})}
Expand Down

0 comments on commit b793acc

Please sign in to comment.