1 | import { VXEComponent, VNodeStyle, SlotVNodeType } from './component'
|
2 | import { VxeFormConstructor, VxeFormDefines, VxeFormPropTypes } from './form'
|
3 | import { VxeGridConstructor } from './grid'
|
4 | import { VxeTooltipPropTypes } from './tooltip'
|
5 | import { VxeGlobalRendererHandles } from './v-x-e-table'
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 | export const VxeFormItem: VXEComponent<VxeFormItemProps>
|
14 |
|
15 |
|
16 |
|
17 | export const FormItem: typeof VxeFormItem
|
18 |
|
19 | export interface VxeFormItemProps {
|
20 | |
21 |
|
22 |
|
23 | title?: VxeFormItemPropTypes.Title
|
24 | |
25 |
|
26 |
|
27 | field?: VxeFormItemPropTypes.Field
|
28 | |
29 |
|
30 |
|
31 | span?: VxeFormItemPropTypes.Span
|
32 | |
33 |
|
34 |
|
35 | align?: VxeFormItemPropTypes.Align
|
36 | |
37 |
|
38 |
|
39 | titleAlign?: VxeFormItemPropTypes.TitleAlign
|
40 | |
41 |
|
42 |
|
43 | titleWidth?: VxeFormItemPropTypes.TitleWidth
|
44 | |
45 |
|
46 |
|
47 | titleColon?: VxeFormItemPropTypes.TitleColon
|
48 | |
49 |
|
50 |
|
51 | titleAsterisk?: VxeFormItemPropTypes.TitleAsterisk
|
52 | |
53 |
|
54 |
|
55 | showTitle?: VxeFormItemPropTypes.ShowTitle
|
56 | |
57 |
|
58 |
|
59 | vertical?: VxeFormItemPropTypes.Vertical
|
60 | |
61 |
|
62 |
|
63 | className?: VxeFormItemPropTypes.ClassName
|
64 | |
65 |
|
66 |
|
67 | contentClassName?: VxeFormItemPropTypes.ContentClassName
|
68 | |
69 |
|
70 |
|
71 | contentStyle?: VxeFormItemPropTypes.ContentStyle
|
72 | |
73 |
|
74 |
|
75 | titleClassName?: VxeFormItemPropTypes.TitleClassName
|
76 | |
77 |
|
78 |
|
79 | titleStyle?: VxeFormItemPropTypes.TitleStyle
|
80 | |
81 |
|
82 |
|
83 | titlePrefix?: VxeFormItemPropTypes.TitlePrefix
|
84 | |
85 |
|
86 |
|
87 | titleSuffix?: VxeFormItemPropTypes.TitleSuffix
|
88 | titleOverflow?: VxeFormItemPropTypes.TitleOverflow
|
89 | |
90 |
|
91 |
|
92 | resetValue?: VxeFormItemPropTypes.ResetValue
|
93 | |
94 |
|
95 |
|
96 | visible?: VxeFormItemPropTypes.Visible
|
97 | |
98 |
|
99 |
|
100 | visibleMethod?: VxeFormItemPropTypes.VisibleMethod
|
101 | |
102 |
|
103 |
|
104 | folding?: VxeFormItemPropTypes.Folding
|
105 | |
106 |
|
107 |
|
108 | collapseNode?: VxeFormItemPropTypes.CollapseNode
|
109 | |
110 |
|
111 |
|
112 | itemRender?: FormItemRenderOptions
|
113 | rules?: VxeFormItemPropTypes.Rules
|
114 | slots?: VxeFormItemPropTypes.Slots
|
115 | children?: VxeFormItemProps[]
|
116 | }
|
117 |
|
118 | export namespace VxeFormItemPropTypes {
|
119 | export type Title = string
|
120 | export type Field = string
|
121 | export type Span = VxeFormPropTypes.Span
|
122 | export type Align = VxeFormPropTypes.Align
|
123 | export type TitleAlign = VxeFormPropTypes.TitleAlign
|
124 | export type TitleWidth = VxeFormPropTypes.TitleWidth
|
125 | export type TitleColon = VxeFormPropTypes.TitleColon
|
126 | export type TitleAsterisk = VxeFormPropTypes.TitleAsterisk
|
127 | export type ShowTitle = boolean
|
128 | export type Vertical = boolean
|
129 |
|
130 | interface ClassNameParams {
|
131 | $form: VxeFormConstructor
|
132 | data: any
|
133 | item: VxeFormDefines.ItemInfo
|
134 | field: string
|
135 | |
136 |
|
137 |
|
138 | property: string
|
139 | }
|
140 | export type ClassName = string | ((params: ClassNameParams) => string)
|
141 |
|
142 | interface ContentClassNameParams extends ClassNameParams{}
|
143 | export type ContentClassName = string | ((params: ContentClassNameParams) => string)
|
144 |
|
145 | interface ContentStyleParams extends ClassNameParams{}
|
146 | export type ContentStyle = VNodeStyle | ((params: ContentStyleParams) => VNodeStyle)
|
147 |
|
148 | interface TitleClassNameParams extends ClassNameParams{}
|
149 | export type TitleClassName = string | ((params: TitleClassNameParams) => string)
|
150 |
|
151 | interface TitleStyleParams extends ClassNameParams{}
|
152 | export type TitleStyle = VNodeStyle | ((params: TitleStyleParams) => VNodeStyle)
|
153 |
|
154 | export type Readonly = boolean
|
155 |
|
156 | interface PrefixOption {
|
157 | useHTML?: VxeTooltipPropTypes.UseHTML
|
158 | content?: VxeTooltipPropTypes.Content
|
159 | enterable?: VxeTooltipPropTypes.Enterable
|
160 | theme?: VxeTooltipPropTypes.Theme
|
161 | icon?: string
|
162 | /**
|
163 | * @deprecated 已废弃,请使用 content
|
164 | */
|
165 | message?: string
|
166 | }
|
167 | export type TitlePrefix = PrefixOption
|
168 | export type TitleSuffix = PrefixOption
|
169 | export type TitleOverflow = VxeFormPropTypes.TitleOverflow
|
170 |
|
171 | export type ResetValue = any
|
172 | export type Visible = boolean
|
173 | export type VisibleMethod = (params: FormItemVisibleParams) => boolean
|
174 | export type Folding = boolean
|
175 | export type CollapseNode = boolean
|
176 | export type ItemRender = FormItemRenderOptions
|
177 | export type Rules = VxeFormDefines.FormRule[]
|
178 | export type Slots = {
|
179 | title?: string | ((params: FormItemTitleRenderParams) => SlotVNodeType | SlotVNodeType[]) | null
|
180 | default?: string | ((params: FormItemContentRenderParams) => SlotVNodeType | SlotVNodeType[]) | null
|
181 | }
|
182 | }
|
183 |
|
184 | /**
|
185 | * 项渲染配置项
|
186 | */
|
187 | export interface FormItemRenderOptions extends VxeGlobalRendererHandles.RenderOptions {
|
188 | /**
|
189 | * 下拉选项列表(需要渲染器支持)
|
190 | */
|
191 | options?: any[]
|
192 | /**
|
193 | * 下拉选项属性参数配置(需要渲染器支持)
|
194 | */
|
195 | optionProps?: VxeGlobalRendererHandles.RenderOptionProps
|
196 | /**
|
197 | * 下拉分组选项列表(需要渲染器支持)
|
198 | */
|
199 | optionGroups?: any[]
|
200 | /**
|
201 | * 下拉分组选项属性参数配置(需要渲染器支持)
|
202 | */
|
203 | optionGroupProps?: VxeGlobalRendererHandles.RenderOptionGroupProps
|
204 | /**
|
205 | * 渲染组件的内容(需要渲染器支持)
|
206 | */
|
207 | content?: string
|
208 | autofocus?: string
|
209 | defaultValue?: ((params: { item: VxeFormItemProps }) => any) | null | undefined | string | number | RegExp | object | any[] | Date
|
210 | }
|
211 |
|
212 | /**
|
213 | * 项标题渲染参数
|
214 | */
|
215 | export interface FormItemTitleRenderParams {
|
216 | $form: VxeFormConstructor
|
217 | $grid: VxeGridConstructor | null
|
218 | data: any
|
219 | item: VxeFormDefines.ItemInfo
|
220 | field: string
|
221 | /**
|
222 | * @deprecated
|
223 | */
|
224 | property: string
|
225 | }
|
226 |
|
227 | /**
|
228 | * 项内容渲染参数
|
229 | */
|
230 | export interface FormItemContentRenderParams {
|
231 | $form: VxeFormConstructor
|
232 | $grid: VxeGridConstructor | null
|
233 | data: any
|
234 | item: VxeFormDefines.ItemInfo
|
235 | field: string
|
236 | /**
|
237 | * @deprecated
|
238 | */
|
239 | property: string
|
240 | }
|
241 |
|
242 | /**
|
243 | * 项可视方法参数
|
244 | */
|
245 | export interface FormItemVisibleParams {
|
246 | $form: VxeFormConstructor
|
247 | $grid: VxeGridConstructor | null
|
248 | data: any
|
249 | item: VxeFormDefines.ItemInfo
|
250 | field: string
|
251 | /**
|
252 | * @deprecated
|
253 | */
|
254 | property: string
|
255 | }
|
256 |
|
257 | /**
|
258 | * 项重置方法参数
|
259 | */
|
260 | export interface FormItemResetParams {
|
261 | $form: VxeFormConstructor
|
262 | $grid: VxeGridConstructor | null
|
263 | data: any
|
264 | item: VxeFormDefines.ItemInfo
|
265 | field: string
|
266 | /**
|
267 | * @deprecated
|
268 | */
|
269 | property: string
|
270 | }
|
271 |
|
272 | export interface VxeFormItemSlots {
|
273 | /**
|
274 | * 自定义内容模板
|
275 | */
|
276 | default: (params: {
|
277 | [key: string]: any
|
278 | }) => any
|
279 | |
280 |
|
281 |
|
282 | title: (params: {
|
283 | [key: string]: any
|
284 | }) => any
|
285 | }
|