UNPKG

4.82 kBPlain TextView Raw
1import { KeyboardTypeOptions, ImageSourcePropType } from 'react-native'
2
3export declare type TextAreaEventHandle = (val?: string) => void
4
5/**
6 * 正则规则类型定义
7 */
8export interface RulePatternPropsType {
9 pattern?: RegExp
10 message?: string
11}
12
13/**
14 * 正则规则类型定义
15 */
16export interface RuleRequiredPropsType {
17 required?: boolean
18 message?: string
19}
20
21/**
22 * 正则函数类型定义
23 */
24export interface RuleValidatorPropsType {
25 pattern?: RegExp
26 validator?: boolean
27 message?: string
28}
29
30/**
31 * 正则自定义规则类型定义
32 */
33export interface RuleMessagePropsType {
34 type:
35 | 'zip'
36 | 'email'
37 | 'zh'
38 | 'zhName'
39 | 'url'
40 | 'phone'
41 | 'mobilePhone'
42 | 'telephone'
43 | 'idCard'
44 | 'money'
45 | 'date'
46 | 'number'
47 | 'integer'
48 | 'floating'
49 | 'twoTimes'
50 | 'threeTimes'
51 | 'fourTimes'
52 | 'fiveTimes'
53 message?: string
54}
55
56export declare type RulePropsType = (
57 | string
58 | RulePatternPropsType
59 | RuleRequiredPropsType
60 | RuleMessagePropsType
61 | RuleValidatorPropsType)[]
62
63/**
64 * FormItems属性的类型定义
65 */
66export interface FormItemPropsType {
67 componentName: string
68 props: FormItemOptionPropsType
69}
70
71/**
72 * FormItem 类型定义
73 */
74export interface FormItemOptionPropsType {
75 name?: string // 组件名
76 id: string // id
77 placeholder?: string // 备注
78 initialValue?: string // 初始值
79 required?: boolean // 是否必要
80 rules?: RulePropsType // 规则
81 form?: any
82}
83
84/**
85 * SsDescription组件PropsType
86 */
87export interface SsDescriptionPropsType {
88 name?: string // 组件名
89 id: string // id
90 initialValue?: string // 初始值
91 icon?: string
92}
93
94/**
95 * Input组件PropsType
96 */
97export interface SwitchPropsType extends FormItemOptionPropsType {
98 label: string // 标签
99 onChange?: (checked: boolean) => void
100 last?: boolean
101}
102
103/**
104 * Input组件PropsType
105 */
106export interface InputPropsType extends FormItemOptionPropsType {
107 icon?: ImageSourcePropType
108 label: string // 标签
109 onChange?: (value: string) => void
110 type?: 'text' | 'bankCard' | 'phone' | 'password' | 'number' | 'digit' | KeyboardTypeOptions // 类型
111 textAlign?: 'left' | 'center' | 'right'
112 extra?: React.ReactNode
113 maxLength?: number
114 last?: boolean
115 multiline?: boolean
116 height?: number
117}
118
119/**
120 * Textarea组件PropsType
121 */
122export interface TextareaPropsType extends FormItemOptionPropsType {
123 label: string // 标签
124 onChange?: TextAreaEventHandle
125 count?: number // 计数功能,兼具最大长度,默认为0,代表不开启计数功能
126 last?: boolean
127}
128
129/**
130 * SsSelect组件PropsType
131 */
132export interface SsSelectPropsType extends FormItemOptionPropsType {
133 icon?: ImageSourcePropType
134 label: string // 标签
135 onChange?: (value?: React.ReactText[]) => void
136 options: ({ label: string; value: string } | string)[] // 选项
137 cols?: number // 列数
138 last?: boolean
139}
140
141/**
142 * SsMultiSelect组件PropsType
143 */
144export interface SsMultiSelectPropsType extends FormItemOptionPropsType {
145 label: string // 标签
146 onChange?: (value?: React.ReactText[]) => void // onChange事件
147 options: ({ label: string; value: string } | string)[] // 选项
148}
149
150/**
151 * SsDropDown组件PropsType
152 */
153export interface SsDropDownPropsType extends FormItemOptionPropsType {
154 icon?: ImageSourcePropType
155 label: string // 标签
156 onChange?: (value?: React.ReactText[]) => void // onChange事件
157 options: ({ label: string; value: string } | string)[] // 选项
158 multiple: boolean
159}
160
161/**
162 * SsDate组件PropsType
163 */
164export interface SsDateProps extends FormItemOptionPropsType {
165 label: string // 标签
166 onChange?: (value: Date) => void
167 type: 'year' | 'month' | 'date' | 'datetime' | 'time'
168 minDate: Date
169 maxDate: Date
170}
171
172/**
173 * SsDateRange组件PropsType
174 */
175export interface SsDateRangeProps {
176 name?: string // 组件名
177 id: string[] // id
178 placeholder?: string[] // 备注
179 initialValue?: string[] // 初始值
180 required?: boolean // 是否必要
181 rules?: RulePropsType // 规则
182 form?: any
183 label: string[] // 标签
184 onChange?: (value: Date | Date[]) => void
185}
186
187/**
188 * SsAmount组件PropsType
189 */
190export interface SsAmountProps extends InputPropsType {
191 upper?: boolean // 是否显示大写
192}
193
194export interface RatingProps {
195 form?: any
196 id: string
197 label: string
198 rules?: RulePropsType // 规则
199 allowHalf?: boolean
200 onChange?: (value: number) => void
201 initialValue: number
202 required?: boolean
203}
204
205export interface ImagePickerProps extends FormItemOptionPropsType {
206 label: string
207 onChange?: (value: any[]) => void
208}
209
210export interface LocationProps extends FormItemOptionPropsType {
211 label: string
212 onChange?: (value: any) => void
213}
214
215export interface CalculateProps extends FormItemOptionPropsType {
216 label: string
217 formula: any[]
218 onChange?: (value: any) => void
219}