update timeline

pull/2177/head
bang 9 years ago
parent 00710328b1
commit 724ce80b5e

@ -26,3 +26,7 @@ export { Tag }
import TimePicker from './time-picker'; import TimePicker from './time-picker';
export { TimePicker } export { TimePicker }
import Timeline from './timeline';
export { Timeline }

@ -2,7 +2,14 @@ import * as React from 'react';
import classNames from 'classnames'; import classNames from 'classnames';
import TimelineItem from './TimelineItem'; import TimelineItem from './TimelineItem';
import splitObject from '../_util/splitObject'; 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<TimelineProps, any> {
static defaultProps = { static defaultProps = {
prefixCls: 'ant-timeline', prefixCls: 'ant-timeline',
} }
@ -10,8 +17,8 @@ export default class Timeline extends React.Component {
render() { render() {
const [{ const [{
prefixCls, children, pending, className prefixCls, children, pending, className
},restProps] = splitObject(this.props, }, restProps] = splitObject(this.props,
['prefixCls', 'children', 'pending','className']); ['prefixCls', 'children', 'pending', 'className']);
const pendingNode = typeof pending === 'boolean' ? null : pending; const pendingNode = typeof pending === 'boolean' ? null : pending;
const classString = classNames({ const classString = classNames({
[prefixCls]: true, [prefixCls]: true,

@ -1,7 +1,15 @@
import * as React from 'react'; import * as React from 'react';
import classNames from 'classnames'; import classNames from 'classnames';
import splitObject from '../_util/splitObject'; 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<TimeLineItemProps, any> {
static defaultProps = { static defaultProps = {
prefixCls: 'ant-timeline', prefixCls: 'ant-timeline',
color: 'blue', color: 'blue',
@ -12,8 +20,8 @@ export default class TimelineItem extends React.Component {
render() { render() {
const [{ const [{
prefixCls, color, last, children, pending, className, dot prefixCls, color, last, children, pending, className, dot
},restProps] = splitObject(this.props, }, restProps] = splitObject(this.props,
['prefixCls', 'color', 'last','children','pending','className','dot']); ['prefixCls', 'color', 'last', 'children', 'pending', 'className', 'dot']);
const itemClassName = classNames({ const itemClassName = classNames({
[`${prefixCls}-item`]: true, [`${prefixCls}-item`]: true,

Loading…
Cancel
Save