Skip to content

Commit 3bb625f

Browse files
committed
✏️ docs
1 parent 4940592 commit 3bb625f

File tree

3 files changed

+43
-36
lines changed

3 files changed

+43
-36
lines changed

docs/fields/README.md renamed to docs/fields/index.md

+17-17
Original file line numberDiff line numberDiff line change
@@ -45,24 +45,24 @@ onValidated | `Function` | Event if validation executed. `onValidated(model, e
4545
## Example
4646

4747
```js
48-
{
49-
type: "text",
50-
label: "Name",
51-
model: "name",
52-
readonly: false,
53-
featured: true,
54-
disabled: false,
55-
required: true,
56-
default: "Anonymous",
57-
validator: validators.string,
48+
{
49+
type: "text",
50+
label: "Name",
51+
model: "name",
52+
readonly: false,
53+
featured: true,
54+
disabled: false,
55+
required: true,
56+
default: "Anonymous",
57+
validator: validators.string,
5858

59-
onChanged(model, newVal, oldVal, field) {
60-
console.log(`Model's name changed from ${oldVal} to ${newVal}. Model:`, model);
61-
},
59+
onChanged(model, newVal, oldVal, field) {
60+
console.log(`Model's name changed from ${oldVal} to ${newVal}. Model:`, model);
61+
},
6262

63-
onValidated(model, errors, field) {
64-
if (errors.length > 0)
65-
console.warn("Validation error in Name field! Errors:", errors);
66-
}
63+
onValidated(model, errors, field) {
64+
if (errors.length > 0)
65+
console.warn("Validation error in Name field! Errors:", errors);
6766
}
67+
}
6868
```

docs/fields/text.md

+25-18
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,31 @@ min | `Number` | Minimum length of text (need `validators.string`)
1010
max | `Number` | Maximum length of text (need `validators.string`)
1111

1212
## Usage
13+
A featured and required name input field, where the length of name must be between 3 and 50 characters
1314

1415
```js
15-
{
16-
type: "text",
17-
label: "Name",
18-
model: "name",
19-
min: 3,
20-
max: 50,
21-
required: true,
22-
placeholder: "User's full name",
23-
24-
onChanged(model, newVal, oldVal, field) {
25-
console.log(`Model's name changed from ${oldVal} to ${newVal}. Model:`, model);
26-
},
27-
28-
onValidated(model, errors, field) {
29-
if (errors.length > 0)
30-
console.warn("Validation error in Name field! Errors:", errors);
31-
}
32-
}
16+
{
17+
type: "text",
18+
label: "Name",
19+
model: "name",
20+
featured: true,
21+
min: 3,
22+
max: 50,
23+
required: true,
24+
placeholder: "User's full name",
25+
validator: validators.string
26+
}
27+
```
28+
Test field for website address with url validators
29+
```js
30+
{
31+
type: "text",
32+
label: "Website",
33+
model: "web",
34+
max: 255,
35+
validator: [
36+
validators.string
37+
validators.url
38+
]
39+
}
3340
```

docs/schema.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ The schema contains the fields of the form
1919
}
2020
```
2121

22-
[Available field types](fields/README.md)
22+
[Available field types](fields/index.md)

0 commit comments

Comments
 (0)