From c98fa719888a8065c41f1fcf36243a38c9c79861 Mon Sep 17 00:00:00 2001 From: jim chen Date: Tue, 28 Nov 2017 15:06:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=94=99=E8=AF=AF=E7=9A=84?= =?UTF-8?q?=E5=9B=BE=E8=A1=A8=E6=96=87=E6=A1=A3.=20=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=87=A0=E5=A4=84=E6=BC=8F=E5=86=99=E7=9A=84=E6=96=87=E6=A1=A3?= =?UTF-8?q?=20(#308)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 增加AvatarList d.ts说明文件 * 修改 axis的链接 , g2修改了新的官网 * AvatarList 增加判断是否为必须属性 * 删除无用的空行. 优化格式 * 修改错误的图表文档. 增加几处漏写的文档 * 添加图表的 描述文件chart.d.ts * 改了个错别字! * 增加CountDown d.ts描述文件 * 增加 DescriptionList d.ts描述文件 --- src/components/Charts/Bar/index.d.ts | 14 +++++++++ src/components/Charts/ChartCard/index.d.ts | 11 +++++++ src/components/Charts/Field/index.d.ts | 7 +++++ src/components/Charts/Gauge/index.d.ts | 10 +++++++ src/components/Charts/MiniArea/index.d.ts | 29 +++++++++++++++++++ src/components/Charts/MiniBar/index.d.ts | 11 +++++++ src/components/Charts/MiniProgress/index.d.ts | 12 ++++++++ src/components/Charts/Pie/index.d.ts | 20 +++++++++++++ src/components/Charts/Radar/index.d.ts | 14 +++++++++ src/components/Charts/TagCloud/index.d.ts | 10 +++++++ .../Charts/TimelineChart/index.d.ts | 15 ++++++++++ src/components/Charts/WaterWave/index.d.ts | 9 ++++++ src/components/Charts/index.d.ts | 17 +++++++++++ src/components/Charts/index.md | 11 ++++--- src/components/CountDown/index.d.ts | 9 ++++++ src/components/CountDown/index.en-US.md | 1 + src/components/CountDown/index.zh-CN.md | 1 + src/components/DescriptionList/index.d.ts | 22 ++++++++++++++ src/components/DescriptionList/index.md | 2 +- 19 files changed, 220 insertions(+), 5 deletions(-) create mode 100644 src/components/Charts/Bar/index.d.ts create mode 100644 src/components/Charts/ChartCard/index.d.ts create mode 100644 src/components/Charts/Field/index.d.ts create mode 100644 src/components/Charts/Gauge/index.d.ts create mode 100644 src/components/Charts/MiniArea/index.d.ts create mode 100644 src/components/Charts/MiniBar/index.d.ts create mode 100644 src/components/Charts/MiniProgress/index.d.ts create mode 100644 src/components/Charts/Pie/index.d.ts create mode 100644 src/components/Charts/Radar/index.d.ts create mode 100644 src/components/Charts/TagCloud/index.d.ts create mode 100644 src/components/Charts/TimelineChart/index.d.ts create mode 100644 src/components/Charts/WaterWave/index.d.ts create mode 100644 src/components/Charts/index.d.ts create mode 100644 src/components/CountDown/index.d.ts create mode 100644 src/components/DescriptionList/index.d.ts diff --git a/src/components/Charts/Bar/index.d.ts b/src/components/Charts/Bar/index.d.ts new file mode 100644 index 00000000..b66ec437 --- /dev/null +++ b/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 {} diff --git a/src/components/Charts/ChartCard/index.d.ts b/src/components/Charts/ChartCard/index.d.ts new file mode 100644 index 00000000..bb8824b6 --- /dev/null +++ b/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 {} diff --git a/src/components/Charts/Field/index.d.ts b/src/components/Charts/Field/index.d.ts new file mode 100644 index 00000000..dfe3e9cc --- /dev/null +++ b/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 {} diff --git a/src/components/Charts/Gauge/index.d.ts b/src/components/Charts/Gauge/index.d.ts new file mode 100644 index 00000000..2729a75f --- /dev/null +++ b/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 {} diff --git a/src/components/Charts/MiniArea/index.d.ts b/src/components/Charts/MiniArea/index.d.ts new file mode 100644 index 00000000..dff1667e --- /dev/null +++ b/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 {} diff --git a/src/components/Charts/MiniBar/index.d.ts b/src/components/Charts/MiniBar/index.d.ts new file mode 100644 index 00000000..7b7394f4 --- /dev/null +++ b/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 {} diff --git a/src/components/Charts/MiniProgress/index.d.ts b/src/components/Charts/MiniProgress/index.d.ts new file mode 100644 index 00000000..d89000cc --- /dev/null +++ b/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 +> {} diff --git a/src/components/Charts/Pie/index.d.ts b/src/components/Charts/Pie/index.d.ts new file mode 100644 index 00000000..16ad6a3b --- /dev/null +++ b/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 {} diff --git a/src/components/Charts/Radar/index.d.ts b/src/components/Charts/Radar/index.d.ts new file mode 100644 index 00000000..18c056d3 --- /dev/null +++ b/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 {} diff --git a/src/components/Charts/TagCloud/index.d.ts b/src/components/Charts/TagCloud/index.d.ts new file mode 100644 index 00000000..04c2c250 --- /dev/null +++ b/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 {} diff --git a/src/components/Charts/TimelineChart/index.d.ts b/src/components/Charts/TimelineChart/index.d.ts new file mode 100644 index 00000000..d03e839c --- /dev/null +++ b/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 +> {} diff --git a/src/components/Charts/WaterWave/index.d.ts b/src/components/Charts/WaterWave/index.d.ts new file mode 100644 index 00000000..258a5670 --- /dev/null +++ b/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 {} diff --git a/src/components/Charts/index.d.ts b/src/components/Charts/index.d.ts new file mode 100644 index 00000000..e47b947f --- /dev/null +++ b/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 }; diff --git a/src/components/Charts/index.md b/src/components/Charts/index.md index d3b47e05..218f4ebf 100644 --- a/src/components/Charts/index.md +++ b/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 | - | +| data | 标题 | Array | - | | height | 高度值 | number | - | ### TimelineChart diff --git a/src/components/CountDown/index.d.ts b/src/components/CountDown/index.d.ts new file mode 100644 index 00000000..b91c812e --- /dev/null +++ b/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 {} diff --git a/src/components/CountDown/index.en-US.md b/src/components/CountDown/index.en-US.md index 8e01b4e3..7b452406 100644 --- a/src/components/CountDown/index.en-US.md +++ b/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 | -| diff --git a/src/components/CountDown/index.zh-CN.md b/src/components/CountDown/index.zh-CN.md index f9814bc6..7e00ba1d 100644 --- a/src/components/CountDown/index.zh-CN.md +++ b/src/components/CountDown/index.zh-CN.md @@ -13,3 +13,4 @@ order: 3 |----------|------------------------------------------|-------------|-------| | format | 时间格式化显示 | Function(time) | | | target | 目标时间 | Date | - | +| onEnd | 倒计时结束回调 | funtion | -| diff --git a/src/components/DescriptionList/index.d.ts b/src/components/DescriptionList/index.d.ts new file mode 100644 index 00000000..c2d75ee2 --- /dev/null +++ b/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; +} diff --git a/src/components/DescriptionList/index.md b/src/components/DescriptionList/index.md index bdadf136..bfa60cb8 100644 --- a/src/components/DescriptionList/index.md +++ b/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'} | - | #### 响应式规则 -- GitLab