Skip to content

Commit 2f01171

Browse files
committed
[2.0.0] Breaking changes: validate => validators
1 parent 9e33f87 commit 2f01171

29 files changed

+109
-102
lines changed

CHANGELOG.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,29 @@
1+
## 2.0.0
2+
3+
### BREAKING CHANGES
4+
5+
- Every Form Control now accepts `validators`—Array prop instead of `validate`
6+
7+
```js
8+
// Now
9+
import { Input, validators } from '@detools/vue-form'
10+
11+
<Input
12+
validators={[validators.isRequired()]}
13+
/>
14+
15+
// Before
16+
import { Input, validations } from '@detools/vue-form'
17+
18+
<Input
19+
validate={validations.validate([validations.isRequired()])}
20+
/>
21+
```
22+
23+
### Updated
24+
25+
- `isRequired` validator now supports Arrays, Objects.
26+
127
## 1.5.0
228

329
### Added

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ See demo at [https://detools.github.io/vue-form](https://detools.github.io/vue-f
7878

7979
## Changelog
8080

81+
- [2.0.0](/CHANGELOG.md#200)
8182
- [1.5.0](/CHANGELOG.md#150)
8283
- [1.4.4](/CHANGELOG.md#144)
8384
- [1.4.3](/CHANGELOG.md#143)
@@ -91,7 +92,7 @@ See demo at [https://detools.github.io/vue-form](https://detools.github.io/vue-f
9192
- `<Upload />`
9293
- `<Rate />`
9394
- Add validation examples
94-
- [Field level sync validation](https://detools.github.io/vue-form/#inline-validations-form)
95+
- [Field level sync validation](https://detools.github.io/vue-form/#inline-validators-form)
9596
- Form level sync validation
9697
- Field level async validation
9798
- Form level async validation

VueForm/ConnectedCheckbox.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,7 @@ export default {
2424
checked: String,
2525
indeterminate: String,
2626

27-
validate: {
28-
type: Function,
29-
default: noop,
30-
},
27+
validators: Array,
3128

3229
handleFocus: {
3330
type: Function,
@@ -52,7 +49,7 @@ export default {
5249
data() {
5350
const $registerFormComponent = resolveRegisterFormComponent(this)
5451

55-
return $registerFormComponent(this.name, this.value, this.validate)
52+
return $registerFormComponent(this.name, this.value, this.validators)
5653
},
5754

5855
destroyed() {

VueForm/ConnectedCheckboxGroup.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,7 @@ export default {
4343
max: Number, // maximum number of checkbox checked
4444
border: Boolean,
4545

46-
validate: {
47-
type: Function,
48-
default: noop,
49-
},
46+
validators: Array,
5047

5148
handleFocus: {
5249
type: Function,
@@ -82,7 +79,7 @@ export default {
8279
initialValue = castArray(initialValue)
8380
}
8481

85-
return $registerFormComponent(this.name, initialValue, this.validate)
82+
return $registerFormComponent(this.name, initialValue, this.validators)
8683
},
8784

8885
destroyed() {

VueForm/ConnectedDatePicker.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,7 @@ export default {
7272
prefixIcon: String,
7373
clearIcon: String,
7474

75-
validate: {
76-
type: Function,
77-
default: noop,
78-
},
75+
validators: Array,
7976

8077
handleFocus: {
8178
type: Function,
@@ -101,7 +98,7 @@ export default {
10198
data() {
10299
const $registerFormComponent = resolveRegisterFormComponent(this)
103100

104-
return $registerFormComponent(this.name, this.value, this.validate)
101+
return $registerFormComponent(this.name, this.value, this.validators)
105102
},
106103

107104
destroyed() {

VueForm/ConnectedInput.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,7 @@ export default {
3737
form: String,
3838
tabindex: Number,
3939

40-
validate: {
41-
type: Function,
42-
default: noop,
43-
},
40+
validators: Array,
4441

4542
handleFocus: {
4643
type: Function,
@@ -67,7 +64,7 @@ export default {
6764
const $registerFormComponent = resolveRegisterFormComponent(this)
6865

6966
return {
70-
...$registerFormComponent(this.name, this.value, this.validate),
67+
...$registerFormComponent(this.name, this.value, this.validators),
7168
touched: false,
7269
}
7370
},

VueForm/ConnectedInputNumber.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,7 @@ export default {
2424
controls: Boolean,
2525
controlsPosition: String,
2626

27-
validate: {
28-
type: Function,
29-
default: noop,
30-
},
27+
validators: Array,
3128

3229
handleFocus: {
3330
type: Function,
@@ -53,7 +50,7 @@ export default {
5350
data() {
5451
const $registerFormComponent = resolveRegisterFormComponent(this)
5552

56-
return $registerFormComponent(this.name, this.value, this.validate)
53+
return $registerFormComponent(this.name, this.value, this.validators)
5754
},
5855

5956
destroyed() {

VueForm/ConnectedRadio.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,7 @@ export default {
1616
border: Boolean,
1717
size: String,
1818

19-
validate: {
20-
type: Function,
21-
default: noop,
22-
},
19+
validators: Array,
2320

2421
handleFocus: {
2522
type: Function,
@@ -44,7 +41,7 @@ export default {
4441
data() {
4542
const $registerFormComponent = resolveRegisterFormComponent(this)
4643

47-
return $registerFormComponent(this.name, this.value, this.validate)
44+
return $registerFormComponent(this.name, this.value, this.validators)
4845
},
4946

5047
destroyed() {

VueForm/ConnectedRadioGroup.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,7 @@ export default {
3737
disabled: Boolean,
3838
border: Boolean,
3939

40-
validate: {
41-
type: Function,
42-
default: noop,
43-
},
40+
validators: Array,
4441

4542
handleFocus: {
4643
type: Function,
@@ -66,7 +63,7 @@ export default {
6663
data() {
6764
const $registerFormComponent = resolveRegisterFormComponent(this)
6865

69-
return $registerFormComponent(this.name, this.value, this.validate)
66+
return $registerFormComponent(this.name, this.value, this.validators)
7067
},
7168

7269
destroyed() {

VueForm/ConnectedSelect.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,7 @@ export default {
6161
popperAppendToBody: Boolean,
6262
automaticDropdown: Boolean,
6363

64-
validate: {
65-
type: Function,
66-
default: noop,
67-
},
64+
validators: Array,
6865

6966
handleFocus: {
7067
type: Function,
@@ -101,7 +98,7 @@ export default {
10198
}
10299
}
103100

104-
return $registerFormComponent(this.name, initialValue, this.validate)
101+
return $registerFormComponent(this.name, initialValue, this.validators)
105102
},
106103

107104
destroyed() {

0 commit comments

Comments
 (0)