Skip to content

Commit 8d52a56

Browse files
committed
[1.4.1] Support for immediate changes handler
1 parent c8e3fad commit 8d52a56

File tree

13 files changed

+121
-31
lines changed

13 files changed

+121
-31
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
## 1.4.1
2+
3+
### Added:
4+
5+
- Support for immediate changes handler `handleModelChange`
6+
- Example for immediate changes form [`<ImmediateForm />`](https://detools.github.io/vue-form#immediate-form)
7+
8+
### Changed:
9+
10+
- Example `<AsyncValidationForm />` renamed to `<AsyncSubmitForm />`
11+
112
## 1.4.0
213

314
### Added:

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ See demo at [https://detools.github.io/vue-form](https://detools.github.io/vue-f
7979
## Changelog
8080

8181
- [1.4.0](/CHANGELOG.md#140)
82+
- [1.4.1](/CHANGELOG.md#141)
8283

8384
## Roadmap
8485

VueForm/Form.vue

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script>
2-
import { isNil, isBoolean, has, mapValues } from 'lodash'
2+
import { isNil, isBoolean, has, mapValues, noop } from 'lodash'
33
import { Form, Button } from 'element-ui'
44
import FormItem from './ConnectedFormItem'
55
import CONSTANTS from './constants'
@@ -35,9 +35,8 @@ export default {
3535
3636
handleSubmit: {
3737
type: Function,
38-
required: true,
38+
default: noop,
3939
},
40-
4140
handleModelChange: Function,
4241
handleDisabled: Function,
4342
handleReset: Function,
@@ -88,6 +87,10 @@ export default {
8887
const setValue = nextValue => {
8988
vm.$set(this.state, name, nextValue)
9089
90+
if (this.handleModelChange) {
91+
this.handleModelChange(this.state)
92+
}
93+
9194
setError(nextValue)
9295
}
9396
@@ -100,10 +103,6 @@ export default {
100103
vm.$delete(this.errors, name)
101104
}
102105
103-
if (this.handleModelChange) {
104-
this.handleModelChange({ ...this.state, [name]: value })
105-
}
106-
107106
return {
108107
cleanFormValue,
109108
setError,

docs/bundle.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/main.css

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,56 +12,74 @@
1212
}
1313

1414

15-
.buttons[data-v-3e4a268c] {
15+
.buttons[data-v-6eb5ee8e] {
1616
display: flex;
1717
flex-direction: row;
1818
flex-wrap: no-wrap;
1919
justify-content: flex-start;
2020
align-items: flex-start;
2121
}
22-
.buttons_center[data-v-3e4a268c] {
22+
.buttons_center[data-v-6eb5ee8e] {
2323
justify-content: center;
2424
}
25-
.buttons_end[data-v-3e4a268c] {
25+
.buttons_end[data-v-6eb5ee8e] {
2626
justify-content: flex-end;
2727
}
2828

2929

30-
.wrapper[data-v-3ad6904c] {
30+
.wrapper[data-v-5084746c] {
3131
display: flex;
3232
flex-direction: row;
3333
justify-content: space-between;
3434
}
35-
.form[data-v-3ad6904c],
36-
.values[data-v-3ad6904c] {
35+
.form[data-v-5084746c] {
36+
width: 750px;
37+
}
38+
.values[data-v-5084746c] {
39+
width: 200px;
40+
}
41+
42+
43+
.wrapper[data-v-2e5bf2cc] {
44+
display: flex;
45+
flex-direction: row;
46+
justify-content: space-between;
47+
}
48+
.form[data-v-2e5bf2cc],
49+
.values[data-v-2e5bf2cc] {
3750
width: 320px;
3851
}
3952

4053

41-
.wrapper[data-v-963a1766] {
54+
.wrapper[data-v-12049160] {
4255
display: flex;
4356
flex-direction: row;
4457
justify-content: space-between;
4558
}
46-
.form[data-v-963a1766],
47-
.values[data-v-963a1766] {
59+
.form[data-v-12049160],
60+
.values[data-v-12049160] {
4861
width: 320px;
4962
}
5063

5164

52-
.wrapper[data-v-5fb18062] {
65+
.wrapper[data-v-08c02437] {
5366
display: flex;
5467
flex-direction: row;
5568
justify-content: space-between;
5669
}
57-
.form[data-v-5fb18062],
58-
.values[data-v-5fb18062] {
70+
.form[data-v-08c02437],
71+
.values[data-v-08c02437] {
5972
width: 320px;
6073
}
6174

6275

63-
.forms[data-v-35c71fa7] {
64-
max-width: 800px;
76+
.forms[data-v-75cca039] {
77+
max-width: 1000px;
6578
padding: 0 20px;
6679
}
80+
.divider[data-v-75cca039] {
81+
height: 2px;
82+
background-color: #757575;
83+
margin: 50px 0;
84+
}
6785

docs/vendors~main.bundle.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/src/App.vue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<script>
22
import BasicForm from './BasicForm'
33
import InlineValidationsForm from './InlineValidationsForm'
4-
import AsyncValidationForm from './AsyncValidationForm'
4+
import AsyncSubmitForm from './AsyncSubmitForm'
5+
import ImmediateForm from './ImmediateForm'
56
67
const Divider = {
78
render() {
@@ -19,7 +20,9 @@ export default {
1920
<Divider />
2021
<InlineValidationsForm />
2122
<Divider />
22-
<AsyncValidationForm />
23+
<AsyncSubmitForm />
24+
<Divider />
25+
<ImmediateForm />
2326
</div>
2427
)
2528
},

example/src/AsyncValidationForm/AsyncValidationForm.vue renamed to example/src/AsyncSubmitForm/AsyncSubmitForm.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export default {
1616
}).then(() => {
1717
Notification.success({
1818
title: 'Yay!',
19-
message: 'Async Validation is Working',
19+
message: 'Async Submittion is working',
2020
})
2121
})
2222
},
@@ -25,7 +25,7 @@ export default {
2525
render() {
2626
return (
2727
<div>
28-
<h1>Async Validation Form</h1>
28+
<h1>Async Submit Form</h1>
2929
<div class="wrapper">
3030
<div class="form">
3131
<Form reset submit handleSubmit={this.handleSubmit}>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default from './AsyncSubmitForm'

example/src/AsyncValidationForm/index.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)