Skip to content

Commit 65842ca

Browse files
committed
Merge branch 'release/1.3.1'
2 parents 9d2fcc4 + cf7c75b commit 65842ca

File tree

4 files changed

+1192
-1197
lines changed

4 files changed

+1192
-1197
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ export default {
7676
</script>
7777
```
7878

79+
[![Edit basic example](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/94l98vx0p4)
80+
7981
### Nested properties
8082

8183
Oftentimes you want to have nested properties in the Vuex store. `vuex-map-fields` supports nested data structures by utilizing the object dot string notation.
@@ -142,6 +144,8 @@ export default {
142144
</script>
143145
```
144146

147+
[![Edit nested properties example](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/38y88yvoo1)
148+
145149
### Rename properties
146150

147151
Sometimes you might want to give your computed properties different names than what you're using in the Vuex store. Renaming properties is made possible by passing an object of fields to the `mapFields` function instead of an array.
@@ -168,6 +172,8 @@ export default {
168172
</script>
169173
```
170174

175+
[![Edit rename properties example](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/7yowrm6j4x)
176+
171177
### Custom getters and mutations
172178

173179
By default `vuex-map-fields` is searching for the given properties starting from the root of your state object. Depending on the size of your application, the state object might become quite big and therefore updating the state starting from the root might become a performance issue. To circumvent such problems, it is possible to create a custom `mapFields()` function which is configured to access custom mutation and getter functions which don't start from the root of the state object but are accessing a specific point of the state.
@@ -242,6 +248,8 @@ export default {
242248
</script>
243249
```
244250

251+
[![Edit custom getters and mutations example](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/4rroy51z8x)
252+
245253
### Vuex modules
246254

247255
Vuex makes it possible to divide the store into modules.
@@ -311,6 +319,8 @@ export default {
311319
</script>
312320
```
313321

322+
[![Edit Vuex modules example](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/mo7j05j6vy)
323+
314324
### Namespaced Vuex modules
315325

316326
By default, mutations and getters inside modules are registered under the global namespace – but you can mark modules as `namespaced` which prevents naming clashes of mutations and getters between modules.
@@ -370,6 +380,8 @@ export default {
370380
</script>
371381
```
372382

383+
[![Edit namespaced Vuex modules example](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/mly87n06p)
384+
373385
Or you can pass the module namespace string as the first argument of the `mapFields()` function.
374386

375387
```html
@@ -391,6 +403,8 @@ export default {
391403
</script>
392404
```
393405

406+
[![Edit namespaced Vuex modules example](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/m51j02794p)
407+
394408
### Multi-row fields
395409

396410
If you want to build a form which allows the user to enter multiple rows of a specific data type with multiple fields (e.g. multiple addresses) you can use the multi-row field mapping function.
@@ -451,6 +465,8 @@ export default {
451465
</script>
452466
```
453467

468+
[![Edit multi-row fields example](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/yj1xxx8kn1)
469+
454470
## Upgrade from 0.x.x to 1.x.x
455471

456472
Instead of accessing the state directly, since the 1.0.0 release, in order to enable the ability to implement custom getters and mutations, `vuex-map-fields` is using a getter function to access the state. This makes it necessary to add a getter function to your Vuex store.

package.json

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vuex-map-fields",
3-
"version": "1.3.0",
3+
"version": "1.3.1",
44
"description": "Enable two-way data binding for form fields saved in a Vuex store",
55
"keywords": [
66
"vue",
@@ -28,23 +28,23 @@
2828
"prepublishOnly": "yarn run lint && yarn test && yarn run build"
2929
},
3030
"devDependencies": {
31-
"@avalanche/eslint-config": "^2.0.0",
32-
"@babel/core": "^7.0.0-beta.51",
33-
"@babel/preset-env": "^7.0.0-beta.51",
34-
"@vue/test-utils": "^1.0.0-beta.18",
31+
"@avalanche/eslint-config": "^3.0.0",
32+
"@babel/core": "^7.1.2",
33+
"@babel/preset-env": "^7.1.0",
34+
"@vue/test-utils": "1.0.0-beta.25",
3535
"babel-core": "^7.0.0-bridge.0",
36-
"babel-jest": "^23.0.1",
37-
"coveralls": "^3.0.1",
38-
"eslint": "^4.19.1",
39-
"eslint-plugin-compat": "^2.4.0",
40-
"eslint-plugin-import": "^2.12.0",
36+
"babel-jest": "^23.6.0",
37+
"coveralls": "^3.0.2",
38+
"eslint": "^5.6.1",
39+
"eslint-plugin-compat": "^2.5.1",
40+
"eslint-plugin-import": "^2.14.0",
4141
"eslint-plugin-markdown": "^1.0.0-beta.6",
42-
"jest": "^23.1.0",
43-
"rollup": "^0.60.2",
44-
"rollup-plugin-babel": "^4.0.0-beta.0",
42+
"jest": "^23.6.0",
43+
"rollup": "^0.66.2",
44+
"rollup-plugin-babel": "^4.0.3",
4545
"uglify-es": "^3.3.9",
46-
"vue": "^2.5.16",
47-
"vue-template-compiler": "^2.5.16",
46+
"vue": "^2.5.17",
47+
"vue-template-compiler": "^2.5.17",
4848
"vuex": "^3.0.1"
4949
},
5050
"main": "dist/index.js",

test/multi-row.test.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ describe(`Component initialized with multi row setup.`, () => {
6767
wrapper.find(`input`).element.value = `New Name`;
6868
wrapper.find(`input`).trigger(`input`);
6969

70+
// The following line was added because otherwise the tests are failing.
71+
// This is a pretty dirty workaround for some problem with @vue/test-utils.
72+
// eslint-disable-next-line no-unused-expressions
73+
wrapper.find(`div:nth-child(2)`);
74+
7075
wrapper.find(`div:nth-child(2) input:nth-child(2)`).element.value = `new@email.com`;
7176
wrapper.find(`div:nth-child(2) input:nth-child(2)`).trigger(`input`);
7277

0 commit comments

Comments
 (0)