UNPKG

1.55 kBTypeScriptView Raw
1/// <reference types="react" />
2
3import * as React from 'react';
4import CommonProps from '../util';
5
6interface HTMLAttributesWeak extends React.HTMLAttributes<HTMLElement> {
7 title?: any;
8}
9
10export interface ItemProps extends Omit<HTMLAttributesWeak, 'content'>, CommonProps {
11 /**
12 * 节点状态
13 */
14 state?: "done" | "process" | "error" | "success";
15
16 /**
17 * 图标
18 */
19 icon?: string;
20
21 /**
22 * 自定义时间轴节点
23 */
24 dot?: React.ReactNode;
25
26 /**
27 * 格式化后的时间
28 */
29 time?: React.ReactNode;
30
31 /**
32 * 标题
33 */
34 title?: React.ReactNode;
35
36 /**
37 * 左侧时间
38 */
39 timeLeft?: React.ReactNode;
40
41 /**
42 * 右侧内容
43 */
44 content?: React.ReactNode;
45
46 /**
47 * 动画
48 */
49 animation?: boolean;
50 mode?: 'left' | 'alternate';
51}
52
53export class Item extends React.Component<ItemProps, any> {}
54
55type foldItem = {
56 /**
57 * [startIndex, endIndex] or [startIndex] 到最后一个节点
58 */
59 foldArea?: Array<number>;
60 foldShow?: boolean;
61}
62
63export interface TimelineProps extends React.HTMLAttributes<HTMLElement>, CommonProps {
64 /**
65 * 样式的品牌前缀
66 */
67 prefix?: string;
68
69 /**
70 * 自定义折叠选项 示例`[{foldArea: [startIndex, endIndex], foldShow: boolean}]`
71 */
72 fold?: Array<foldItem>;
73
74 /**
75 * 自定义类名
76 */
77 className?: string;
78}
79
80export default class Timeline extends React.Component<TimelineProps, any> {
81 static Item: typeof Item;
82}