1 В избранное 0 Ответвления 0

OSCHINA-MIRROR/open-hand-choerodon-ui

Присоединиться к Gitlife
Откройте для себя и примите участие в публичных проектах с открытым исходным кодом с участием более 10 миллионов разработчиков. Приватные репозитории также полностью бесплатны :)
Присоединиться бесплатно
Клонировать/Скачать
Timeline.tsx 1.5 КБ
Копировать Редактировать Исходные данные Просмотреть построчно История
Vink Dong Отправлено 7 лет назад f03bd7d
import * as React from 'react';
import classNames from 'classnames';
import TimelineItem, { TimeLineItemProps } from './TimelineItem';
import Icon from '../icon';
export interface TimelineProps {
prefixCls?: string;
className?: string;
/** 指定最后一个幽灵节点是否存在或内容 */
pending?: React.ReactNode;
pendingDot?: React.ReactNode;
style?: React.CSSProperties;
}
export default class Timeline extends React.Component<TimelineProps, any> {
static Item = TimelineItem as React.ClassicComponentClass<TimeLineItemProps>;
static defaultProps = {
prefixCls: 'ant-timeline',
};
render() {
const { prefixCls, children, pending, pendingDot, className, ...restProps } = this.props;
const pendingNode = typeof pending === 'boolean' ? null : pending;
const classString = classNames(prefixCls, {
[`${prefixCls}-pending`]: !!pending,
}, className);
// Remove falsy items
const falsylessItems = React.Children.toArray(children).filter(item => !!item);
const items = React.Children.map(falsylessItems, (ele: React.ReactElement<any>, idx) =>
React.cloneElement(ele, {
last: idx === (React.Children.count(falsylessItems) - 1),
}),
);
const pendingItem = (!!pending) ? (
<TimelineItem
pending={!!pending}
dot={pendingDot || <Icon type="loading" />}
>
{pendingNode}
</TimelineItem>
) : null;
return (
<ul {...restProps} className={classString}>
{items}
{pendingItem}
</ul>
);
}
}

Опубликовать ( 0 )

Вы можете оставить комментарий после Вход в систему

1
https://gitlife.ru/oschina-mirror/open-hand-choerodon-ui.git
git@gitlife.ru:oschina-mirror/open-hand-choerodon-ui.git
oschina-mirror
open-hand-choerodon-ui
open-hand-choerodon-ui
release-0.2.2