This repository has been archived by the owner on Apr 28, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.d.ts
90 lines (81 loc) · 1.45 KB
/
types.d.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
import { Component as VueComponent } from 'vue'
export declare type Value = {
[key: string]: any
}
export declare type Props = {
[prop: string]: any
}
export declare type Options = {
value: any
label?: string
}
export declare type EnableWhen = {
[key: string]: any
}
export declare type Item = {
/**
* Value model
*/
model: string
/**
* Form item label
*/
label?: string
/**
* Render custom component, HTML element or map built-in component
*/
component?: VueComponent | HTMLElementTagNameMap | string
/**
* Form item default value
*/
value?: any
/**
* Form item props options
*/
props?: Props
/**
* Option type component's options
*
* e.g.
* `select` `radio` `checkbox` ...
*/
options?: Options[]
/**
* Form item status
*
* @default `edit`
*/
status?: 'preview' | 'edit' | 'disabled'
/**
* This function will trigger when current form item value changed
*
* @param `model`
* Current form item model
*
* @param `value`
* Current form item value
*
* ```js
* {
* atChange: (model, value) => {
* // do something right
* }
* }
* ```
*/
atChange?: (model: string, value: any) => void
/**
* Show current form item when condition established
*/
enableWhen?: EnableWhen | string
}
export interface Config {
/**
* Form props options
*/
props?: Props
/**
* To render form items
*/
items?: Item[]
}