forked from quasarframework/quasar
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvalidate.json
More file actions
71 lines (64 loc) · 2.29 KB
/
validate.json
File metadata and controls
71 lines (64 loc) · 2.29 KB
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
{
"props": {
"error": {
"type": "Boolean",
"desc": "Does field have validation errors?",
"category": "behavior"
},
"error-message": {
"type": "String",
"desc": "Validation error message (gets displayed only if 'error' is set to 'true')",
"examples": [ "Username must have at least 5 characters" ],
"category": "content"
},
"no-error-icon": {
"type": "Boolean",
"desc": "Hide error icon when there is an error",
"category": "content"
},
"rules": {
"type": "Array",
"desc": "Array of Functions/Strings; If String, then it must be a name of one of the embedded validation rules",
"examples": [
":rules=\"[ val => val.length <= 3 || 'Please use maximum 3 characters' ]\"",
":rules=\"[ 'fulltime' ]\""
],
"category": "behavior"
},
"reactive-rules": {
"type": "Boolean",
"desc": "By default a change in the rules does not trigger a new validation until the model changes; If set to true then a change in the rules will trigger a validation; Has a performance penalty, so use it only when you really need it",
"category": "behavior",
"addedIn": "v1.11.0"
},
"lazy-rules": {
"type": [ "Boolean", "String" ],
"desc": "If set to boolean true then it checks validation status against the 'rules' only after field loses focus for first time; If set to 'ondemand' then it will trigger only when component's validate() method is manually called or when the wrapper QForm submits itself",
"values": [ "(Boolean) true", "(Boolean) false", "ondemand" ],
"category": "behavior"
}
},
"methods": {
"resetValidation": {
"desc": "Reset validation status"
},
"validate": {
"desc": "Trigger a validation",
"params": {
"value": {
"type": "Any",
"desc": "Optional value to validate against",
"__exemption": [ "examples" ]
}
},
"returns": {
"type": [ "Boolean", "Promise<boolean>" ],
"desc": "True/false if no async rules, otherwise a Promise with the outcome (true -> validation was a success, false -> invalid models detected)",
"examples": [
"true",
"validate().then(outcome => { ... })"
]
}
}
}
}