UNPKG

2.04 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 onClick?: any;
9}
10
11export interface ItemProps extends HTMLAttributesWeak, CommonProps {
12 /**
13 * 步骤的状态,如不传,会根据外层的 Step 的 current 属性生成,可选值为 `wait`, `process`, `finish`
14 */
15 status?: 'wait' | 'process' | 'finish';
16
17 /**
18 * 标题
19 */
20 title?: React.ReactNode;
21
22 /**
23 * 图标
24 */
25 icon?: string;
26
27 /**
28 * 内容,用于垂直状态下的内容填充
29 */
30 content?: React.ReactNode;
31
32 /**
33 * StepItem 的自定义渲染, 会覆盖父节点设置的itemRender
34 */
35 itemRender?: (index: number, status: string) => React.ReactNode;
36
37 /**
38 * 百分比
39 */
40 percent?: number;
41
42 /**
43 * 是否禁用
44 */
45 disabled?: boolean;
46
47 /**
48 * 点击步骤时的回调
49 */
50 onClick?: (index: number) => void;
51
52 /**
53 * 自定义样式
54 */
55 className?: string;
56}
57
58export class Item extends React.Component<ItemProps, any> {}
59export interface StepProps extends React.HTMLAttributes<HTMLElement>, CommonProps {
60 /**
61 * 当前步骤
62 */
63 current?: number;
64
65 /**
66 * 展示方向
67 */
68 direction?: 'hoz' | 'ver';
69 /**
70 * 宽度是否横向拉伸
71 */
72 stretch?: boolean;
73 /**
74 * 横向布局时的内容排列
75 */
76 labelPlacement?: 'hoz' | 'ver';
77
78 /**
79 * 类型
80 */
81 shape?: 'circle' | 'arrow' | 'dot';
82
83 /**
84 * 是否只读模式
85 */
86 readOnly?: boolean;
87
88 /**
89 * 是否开启动效
90 */
91 animation?: boolean;
92
93 /**
94 * 自定义样式名
95 */
96 className?: string;
97
98 /**
99 * StepItem 的自定义渲染
100 */
101 itemRender?: (index: number, status: string) => React.ReactNode;
102}
103
104export default class Step extends React.Component<StepProps, any> {
105 static Item: typeof Item;
106}