forked from ant-design/ant-design-mini
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprops.ts
162 lines (156 loc) · 3.55 KB
/
props.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
import { IBaseProps } from '../_util/base';
export interface PickerData {
value: PickerValue;
label: string;
}
export declare type PickerValue =
| string
| number
| PickerData
| (string | number | PickerData)[];
/**
* @description 选择器,包括一个或多个不同值的可滚动列表,每个值可以在视图的中心以较暗的文本形式显示。当用户激活 **Picker** 后,将会从底部弹出。
*/
export interface IPickerProps extends IBaseProps {
visible?: boolean;
defaultVisible?: boolean;
/**
* @desciption 动画类型
* @default "transform"
*/
animationType: 'transform' | 'position';
/**
* @description picker 数据
*/
value: PickerValue;
/**
* @description 格式化后的 value 文本, 优先级大于 onFormat
*/
formattedValueText?: string;
/**
* @description 默认picker 数据
*/
defaultValue: PickerValue;
/**
* @description 是否禁用
*/
disabled?: boolean;
/**
* @description 标题
*/
title: string;
/**
* @description 确定按钮文案
* @default "确定"
*/
okText: string;
/**
* @description 取消文案
* @default "取消"
*/
cancelText: string;
/**
* @description 提示文案
* @default '请选择'
*/
placeholder: string;
/**
* @description 空状态提示文案
* @default '暂无数据'
*/
emptyText?: string;
/**
* @description picker 数据
*/
options: PickerValue[];
/**
* @description 点击蒙层是否可以关闭
* @default false
*/
maskClosable: boolean;
/**
* @description 弹出框类名
*/
popClassName: string;
/**
* @description 弹出框样式
*/
popStyle: string;
/**
*@description 选中框样式
* 版本要求: 支付宝小程序基础库 1.10.0 及以上
*/
indicatorStyle?: string;
/**
*@description 选中框类名
* 版本要求: 支付宝小程序基础库 1.10.0 及以上
*/
indicatorClassName?: string;
/**
* @description 蒙层的样式。
* 版本要求: 支付宝小程序基础库 1.10.0 及以上
*/
maskStyle?: string;
/**
* @description 蒙层的类名。
* 版本要求: 支付宝小程序基础库 1.10.0 及以上
*/
maskClassName?: string;
/**
* @description 点击确认回调
*/
onOk?: (
value: PickerValue,
column: PickerData,
e: Record<string, any>
) => void;
/**
* @description 点击取消回调
*/
onCancel?: (e: Record<string, any>) => void;
/**
* @description 发生滚动即触发, 与 onChange 点击 ok 后触发不同
*/
onChange?: (
value: PickerValue,
column: PickerData,
e: Record<string, any>
) => void;
/**
* @description 选中值的文本显示格式
*/
onFormat?: (value: PickerValue, column: PickerValue) => string;
/**
* @description 切换显示隐藏
*/
onVisibleChange?: (visible: boolean, e: Record<string, any>) => void;
}
export const PickerDefaultProps: Partial<IPickerProps> = {
okText: '确定',
cancelText: '取消',
disabled: false,
maskClosable: false,
options: [],
placeholder: '请选择',
defaultValue: [],
emptyText: '暂无数据'
};
export const PickerFunctionalProps: Partial<IPickerProps> = {
formattedValueText: null,
visible: null,
defaultVisible: null,
animationType: 'transform',
value: null,
defaultValue: null,
disabled: false,
title: '',
okText: '确定',
cancelText: '取消',
placeholder: '请选择',
options: [],
popClassName: '',
popStyle: '',
maskClosable: true,
onFormat: null,
emptyText: '暂无数据'
};