From 724ce80b5e60862131c8c8e1269d583b9ae6c609 Mon Sep 17 00:00:00 2001 From: bang Date: Sat, 9 Jul 2016 10:53:40 +0800 Subject: [PATCH] update timeline --- components/index.tsx | 4 ++++ components/timeline/Timeline.tsx | 13 ++++++++++--- components/timeline/TimelineItem.tsx | 14 +++++++++++--- 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/components/index.tsx b/components/index.tsx index 161a518236..530caef027 100644 --- a/components/index.tsx +++ b/components/index.tsx @@ -26,3 +26,7 @@ export { Tag } import TimePicker from './time-picker'; export { TimePicker } + +import Timeline from './timeline'; +export { Timeline } + diff --git a/components/timeline/Timeline.tsx b/components/timeline/Timeline.tsx index c6a038b137..23c7cb4273 100644 --- a/components/timeline/Timeline.tsx +++ b/components/timeline/Timeline.tsx @@ -2,7 +2,14 @@ import * as React from 'react'; import classNames from 'classnames'; import TimelineItem from './TimelineItem'; import splitObject from '../_util/splitObject'; -export default class Timeline extends React.Component { + +export interface TimelineProps { + /** 指定最后一个幽灵节点是否存在或内容*/ + pending?: boolean | React.ReactNode, + + style?: React.CSSProperties +} +export default class Timeline extends React.Component { static defaultProps = { prefixCls: 'ant-timeline', } @@ -10,8 +17,8 @@ export default class Timeline extends React.Component { render() { const [{ prefixCls, children, pending, className - },restProps] = splitObject(this.props, - ['prefixCls', 'children', 'pending','className']); + }, restProps] = splitObject(this.props, + ['prefixCls', 'children', 'pending', 'className']); const pendingNode = typeof pending === 'boolean' ? null : pending; const classString = classNames({ [prefixCls]: true, diff --git a/components/timeline/TimelineItem.tsx b/components/timeline/TimelineItem.tsx index ef77e0c0f6..d6e16fc46f 100644 --- a/components/timeline/TimelineItem.tsx +++ b/components/timeline/TimelineItem.tsx @@ -1,7 +1,15 @@ import * as React from 'react'; import classNames from 'classnames'; import splitObject from '../_util/splitObject'; -export default class TimelineItem extends React.Component { + +// Timeline +export interface TimeLineItemProps { + /** 指定圆圈颜色。*/ + color?: string, + dot?: React.ReactNode, + style?: React.CSSProperties +} +export default class TimelineItem extends React.Component { static defaultProps = { prefixCls: 'ant-timeline', color: 'blue', @@ -12,8 +20,8 @@ export default class TimelineItem extends React.Component { render() { const [{ prefixCls, color, last, children, pending, className, dot - },restProps] = splitObject(this.props, - ['prefixCls', 'color', 'last','children','pending','className','dot']); + }, restProps] = splitObject(this.props, + ['prefixCls', 'color', 'last', 'children', 'pending', 'className', 'dot']); const itemClassName = classNames({ [`${prefixCls}-item`]: true,