-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
/
Copy pathcommonProps.ts
56 lines (50 loc) · 1.85 KB
/
commonProps.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import type { Key } from '../_util/type';
import { tuple, booleanType, someType, stringType, functionType } from '../_util/type';
import PropTypes from '../_util/vue-types';
export type CollapsibleType = 'header' | 'icon' | 'disabled';
export type ActiveKeyType = Array<string | number> | string | number;
export interface PanelProps {
isActive?: boolean;
header?: any;
showArrow?: boolean;
forceRender?: boolean;
/** @deprecated Use `collapsible="disabled"` instead */
disabled?: boolean;
extra?: any;
collapsible?: CollapsibleType;
}
const collapseProps = () => ({
prefixCls: String,
activeKey: someType<ActiveKeyType>([Array, Number, String]),
defaultActiveKey: someType<ActiveKeyType>([Array, Number, String]),
accordion: booleanType(),
destroyInactivePanel: booleanType(),
bordered: booleanType(),
expandIcon: functionType<(panelProps: PanelProps) => any>(),
openAnimation: PropTypes.object,
expandIconPosition: PropTypes.oneOf(tuple('start', 'end')),
collapsible: stringType<CollapsibleType>(),
ghost: booleanType(),
onChange: functionType<(key: Key | Key[]) => void>(),
'onUpdate:activeKey': functionType<(key: Key | Key[]) => void>(),
});
const collapsePanelProps = () => ({
openAnimation: PropTypes.object,
prefixCls: String,
header: PropTypes.any,
headerClass: String,
showArrow: booleanType(),
isActive: booleanType(),
destroyInactivePanel: booleanType(),
/** @deprecated Use `collapsible="disabled"` instead */
disabled: booleanType(),
accordion: booleanType(),
forceRender: booleanType(),
expandIcon: functionType<(panelProps: PanelProps) => any>(),
extra: PropTypes.any,
panelKey: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
collapsible: stringType<CollapsibleType>(),
role: String,
onItemClick: functionType<(panelKey: Key) => void>(),
});
export { collapseProps, collapsePanelProps };