Jelajahi Sumber

修改错误的图表文档. 增加几处漏写的文档 (#308)

* 增加AvatarList d.ts说明文件

* 修改 axis的链接 , g2修改了新的官网

* AvatarList 增加判断是否为必须属性

* 删除无用的空行.  优化格式

* 修改错误的图表文档. 增加几处漏写的文档

* 添加图表的 描述文件chart.d.ts

* 改了个错别字!

* 增加CountDown d.ts描述文件

* 增加 DescriptionList  d.ts描述文件
jim chen 8 tahun lalu
induk
melakukan
c98fa71988

+ 14 - 0
src/components/Charts/Bar/index.d.ts

@@ -0,0 +1,14 @@
+import React from "react";
+export interface BarProps {
+  title: string | React.ReactNode;
+  color?: string;
+  margin?: [number, number, number, number];
+  height: number;
+  data: Array<{
+    x: string;
+    y: number;
+  }>;
+  autoLabel?: boolean;
+}
+
+export default class Bar extends React.Component<BarProps, any> {}

+ 11 - 0
src/components/Charts/ChartCard/index.d.ts

@@ -0,0 +1,11 @@
+import React from "react";
+export interface ChartCardProps {
+  title: string | React.ReactNode;
+  action?: React.ReactNode;
+  total?: React.ReactNode | number;
+  footer?: React.ReactNode;
+  contentHeight: number;
+  avatar?: React.ReactNode;
+}
+
+export default class ChartCard extends React.Component<ChartCardProps, any> {}

+ 7 - 0
src/components/Charts/Field/index.d.ts

@@ -0,0 +1,7 @@
+import React from "react";
+export interface FieldProps {
+  label: string | React.ReactNode;
+  value: string | React.ReactNode;
+}
+
+export default class Field extends React.Component<FieldProps, any> {}

+ 10 - 0
src/components/Charts/Gauge/index.d.ts

@@ -0,0 +1,10 @@
+import React from "react";
+export interface GaugeProps {
+  title: string | React.ReactNode;
+  color?: string;
+  height: number;
+  bgColor?: number;
+  percent: number;
+}
+
+export default class Gauge extends React.Component<GaugeProps, any> {}

+ 29 - 0
src/components/Charts/MiniArea/index.d.ts

@@ -0,0 +1,29 @@
+import React from "react";
+
+// g2已经更新到3.0
+// 不带的写了
+
+export interface Axis {
+  title: any;
+  line: any;
+  gridAlign: any;
+  labels: any;
+  tickLine: any;
+  grid: any;
+}
+
+export interface MiniAreaProps {
+  color?: string;
+  height: number;
+  borderColor?: string;
+  line?: boolean;
+  animate?: boolean;
+  xAxis?: Axis;
+  yAxis?: Axis;
+  data: Array<{
+    x: number;
+    y: number;
+  }>;
+}
+
+export default class MiniArea extends React.Component<MiniAreaProps, any> {}

+ 11 - 0
src/components/Charts/MiniBar/index.d.ts

@@ -0,0 +1,11 @@
+import React from "react";
+export interface MiniBarProps {
+  color?: string;
+  height: number;
+  data: Array<{
+    x: number;
+    y: number;
+  }>;
+}
+
+export default class MiniBar extends React.Component<MiniBarProps, any> {}

+ 12 - 0
src/components/Charts/MiniProgress/index.d.ts

@@ -0,0 +1,12 @@
+import React from "react";
+export interface MiniProgressProps {
+  target: number;
+  color?: string;
+  strokeWidth: number;
+  percent: number;
+}
+
+export default class MiniProgress extends React.Component<
+  MiniProgressProps,
+  any
+> {}

+ 20 - 0
src/components/Charts/Pie/index.d.ts

@@ -0,0 +1,20 @@
+import React from "react";
+export interface PieProps {
+  animate?: boolean;
+  color?: string;
+  height: number;
+  hasLegend?: boolean;
+  margin?: [number, number, number, number];
+  percent?: number;
+  data?: Array<{
+    x: string;
+    y: number;
+  }>;
+  total?: string;
+  title?: string | React.ReactNode;
+  tooltip?: boolean;
+  valueFormat?: (value: string) => string;
+  subTitle?: string | React.ReactNode;
+}
+
+export default class Pie extends React.Component<PieProps, any> {}

+ 14 - 0
src/components/Charts/Radar/index.d.ts

@@ -0,0 +1,14 @@
+import React from "react";
+export interface RadarProps {
+  title?: string | React.ReactNode;
+  height: number;
+  margin?: [number, number, number, number];
+  hasLegend?: boolean;
+  data: Array<{
+    name: string;
+    label: string;
+    value: string;
+  }>;
+}
+
+export default class Radar extends React.Component<RadarProps, any> {}

+ 10 - 0
src/components/Charts/TagCloud/index.d.ts

@@ -0,0 +1,10 @@
+import React from "react";
+export interface TagCloudProps {
+  data: Array<{
+    name: string;
+    value: number;
+  }>;
+  height: number;
+}
+
+export default class TagCloud extends React.Component<TagCloudProps, any> {}

+ 15 - 0
src/components/Charts/TimelineChart/index.d.ts

@@ -0,0 +1,15 @@
+import React from "react";
+export interface TimelineChartProps {
+  data: Array<{
+    x: string;
+    y1: string;
+    y2: string;
+  }>;
+  titleMap: { y1: string; y2: string };
+  height?: number;
+}
+
+export default class TimelineChart extends React.Component<
+  TimelineChartProps,
+  any
+> {}

+ 9 - 0
src/components/Charts/WaterWave/index.d.ts

@@ -0,0 +1,9 @@
+import React from "react";
+export interface WaterWaveProps {
+  title: string | React.ReactNode;
+  color?: string;
+  height: number;
+  percent: number;
+}
+
+export default class WaterWave extends React.Component<WaterWaveProps, any> {}

+ 17 - 0
src/components/Charts/index.d.ts

@@ -0,0 +1,17 @@
+export { default as numeral } from "numeral";
+export { default as ChartCard } from "./ChartCard";
+export { default as Bar } from "./Bar";
+export { default as Pie } from "./Pie";
+export { default as Radar } from "./Radar";
+export { default as Gauge } from "./Gauge";
+export { default as MiniArea } from "./MiniArea";
+export { default as MiniBar } from "./MiniBar";
+export { default as MiniProgress } from "./MiniProgress";
+export { default as Field } from "./Field";
+export { default as WaterWave } from "./WaterWave";
+export { default as TagCloud } from "./TagCloud";
+export { default as TimelineChart } from "./TimelineChart";
+
+declare const yuan: (value: number | string) => string;
+
+export { yuan };

+ 7 - 4
src/components/Charts/index.md

@@ -22,7 +22,7 @@ Ant Design Pro 提供的业务中常用的图表类型,都是基于 [G2](https
 | total | 数据总量 | ReactNode \| number | - |
 | footer | 卡片底部 | ReactNode | - |
 | contentHeight | 内容区域高度 | number | - |
-
+| avatar | 右侧图标 | React.ReactNode | - |
 ### MiniBar
 
 | 参数      | 说明                                      | 类型         | 默认值 |
@@ -76,7 +76,9 @@ Ant Design Pro 提供的业务中常用的图表类型,都是基于 [G2](https
 | percent | 占比 | number | - |
 | tooltip | 是否显示 tooltip | boolean | true |
 | valueFormat | 显示值的格式化函数 | function | - |
-| subTitle | 图表子标题 | ReactNode\|string | - |
+| title | 图表标题 | ReactNode|string | - |
+| subTitle | 图表子标题 | ReactNode|string | - |
+| total | 图标中央的总数 | string | - |
 
 ### Radar
 
@@ -86,6 +88,7 @@ Ant Design Pro 提供的业务中常用的图表类型,都是基于 [G2](https
 | height | 图表高度 | number | - |
 | hasLegend | 是否显示 legend | boolean | `false` |
 | margin | 图表内部间距 | array | \[24, 30, 16, 30\] |
+| data | 图标数据 | array<{name,label,value}> | - |
 
 ### Gauge
 
@@ -94,7 +97,7 @@ Ant Design Pro 提供的业务中常用的图表类型,都是基于 [G2](https
 | title | 图表标题 | ReactNode\|string | - |
 | height | 图表高度 | number | - |
 | color | 图表颜色 | string | `#2F9CFF` |
-| bgColor | 图表北京颜色 | string | `#F0F2F5` |
+| bgColor | 图表背景颜色 | string | `#F0F2F5` |
 | percent | 进度比例 | number | - |
 
 ### WaterWave
@@ -110,7 +113,7 @@ Ant Design Pro 提供的业务中常用的图表类型,都是基于 [G2](https
 
 | 参数      | 说明                                      | 类型         | 默认值 |
 |----------|------------------------------------------|-------------|-------|
-| tags | 标题 | Array<name, value\> | - |
+| data | 标题 | Array<name, value\> | - |
 | height | 高度值 | number | - |
 
 ### TimelineChart

+ 9 - 0
src/components/CountDown/index.d.ts

@@ -0,0 +1,9 @@
+import React from "react";
+export interface CountDownProps {
+  format?: (time: number) => void;
+  target: Date | number;
+  onEnd?: () => void;
+  style?: React.CSSProperties;
+}
+
+export default class CountDown extends React.Component<CountDownProps, any> {}

+ 1 - 0
src/components/CountDown/index.en-US.md

@@ -12,3 +12,4 @@ Simple CountDown Component.
 |----------|------------------------------------------|-------------|-------|
 | format | Formatter of time | Function(time) |  |
 | target | Target time | Date | - |
+| onEnd |  Countdown to the end callback | funtion | -|

+ 1 - 0
src/components/CountDown/index.zh-CN.md

@@ -13,3 +13,4 @@ order: 3
 |----------|------------------------------------------|-------------|-------|
 | format | 时间格式化显示 | Function(time) |  |
 | target | 目标时间 | Date | - |
+| onEnd |  倒计时结束回调 | funtion | -|

+ 22 - 0
src/components/DescriptionList/index.d.ts

@@ -0,0 +1,22 @@
+import React from "react";
+export interface DescriptionListProps {
+  layout?: "horizontal" | "vertical";
+  col?: number;
+  title: React.ReactNode;
+  gutter?: number;
+  size?: "large" | "small";
+}
+
+declare class Description extends React.Component<
+  {
+    term: React.ReactNode;
+  },
+  any
+> {}
+
+export default class DescriptionList extends React.Component<
+  DescriptionListProps,
+  any
+> {
+  static Description: typeof Description;
+}

+ 1 - 1
src/components/DescriptionList/index.md

@@ -19,7 +19,7 @@ order: 4
 | col       | 指定信息最多分几列展示,最终一行几列由 col 配置结合[响应式规则](/components/DescriptionList#响应式规则)决定          | number(0 < col <= 4)  | 3 |
 | title     | 列表标题                                 | ReactNode  | - |
 | gutter    | 列表项间距,单位为 `px`                    | number  | 32 |
-| size     | 列表型号,可以设置为 `large` `small`        | string  | - |
+| size     | 列表型号,可以设置为 `large` `small`        | Enum{'large', 'small'}  | - |
 
 #### 响应式规则