import classNames from 'classnames';
import PropTypes from '../_util/vue-types';
import {
getOptionProps,
initDefaultProps,
filterEmpty,
getComponentFromProp,
} from '../_util/props-util';
import { cloneElement } from '../_util/vnode';
import TimelineItem from './TimelineItem';
import Icon from '../icon';
import { ConfigConsumerProps } from '../config-provider';
export const TimelineProps = {
prefixCls: PropTypes.string,
/** 指定最后一个幽灵节点是否存在或内容 */
pending: PropTypes.any,
pendingDot: PropTypes.string,
reverse: PropTypes.bool,
mode: PropTypes.oneOf(['left', 'alternate', 'right']),
};
export default {
name: 'ATimeline',
props: initDefaultProps(TimelineProps, {
reverse: false,
}),
inject: {
configProvider: { default: () => ({}) },
},
render() {
const { prefixCls: customizePrefixCls, reverse, mode, ...restProps } = getOptionProps(this);
const getPrefixCls = this.configProvider.getPrefixCls || ConfigConsumerProps.getPrefixCls;
const prefixCls = getPrefixCls('timeline', customizePrefixCls);
const pendingDot = getComponentFromProp(this, 'pendingDot');
const pending = getComponentFromProp(this, 'pending');
const pendingNode = typeof pending === 'boolean' ? null : pending;
const classString = classNames(prefixCls, {
[`${prefixCls}-pending`]: !!pending,
[`${prefixCls}-reverse`]: !!reverse,
[`${prefixCls}-${mode}`]: !!mode,
});
const children = filterEmpty(this.$slots.default);
// // Remove falsy items
// const falsylessItems = filterEmpty(this.$slots.default)
// const items = falsylessItems.map((item, idx) => {
// return cloneElement(item, {
// props: {
// last: falsylessItems.length - 1 === idx,
// },
// })
// })
const pendingItem = !!pending ? (