Enable two-way data binding for form fields saved in a Vuex store

Overview

vuex-map-fields

Patreon Donate Build Status Coverage Status GitHub stars

Enable two-way data binding for form fields saved in a Vuex store.

ko-fi

Install

npm install --save vuex-map-fields

Basic example

The following example component shows the most basic usage, for mapping fields to the Vuex store using two-way data binding with v-model, without directly modifying the store itself, but using getter and setter functions internally (as it is described in the official Vuex documentation: Two-way Computed Property).

Store

import Vue from 'vue';
import Vuex from 'vuex';

// Import the `getField` getter and the `updateField`
// mutation function from the `vuex-map-fields` module.
import { getField, updateField } from 'vuex-map-fields';

Vue.use(Vuex);

export default new Vuex.Store({
  state: {
    fieldA: '',
    fieldB: '',
  },
  getters: {
    // Add the `getField` getter to the
    // `getters` of your Vuex store instance.
    getField,
  },
  mutations: {
    // Add the `updateField` mutation to the
    // `mutations` of your Vuex store instance.
    updateField,
  },
});

Component

<template>
  <div id="app">
    <input v-model="fieldA">
    <input v-model="fieldB">
  </div>
</template>

<script>
import { mapFields } from 'vuex-map-fields';

export default {
  computed: {
    // The `mapFields` function takes an array of
    // field names and generates corresponding
    // computed properties with getter and setter
    // functions for accessing the Vuex store.
    ...mapFields([
      'fieldA',
      'fieldB',
    ]),
  },
};
</script>

Edit basic example

Nested properties

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.

Store

import Vue from 'vue';
import Vuex from 'vuex';

import { getField, updateField } from 'vuex-map-fields';

Vue.use(Vuex);

export default new Vuex.Store({
  state: {
    user: {
      firstName: '',
      lastName: '',
    },
    addresses: [
      {
        town: '',
      },
    ],
  },
  getters: {
    getField,
  },
  mutations: {
    updateField,
  },
});

Component

<template>
  <div id="app">
    <input v-model="firstName">
    <input v-model="lastName">
    <input v-model="town">
  </div>
</template>

<script>
import { mapFields } from 'vuex-map-fields';

export default {
  computed: {
    // When using nested data structures, the string
    // after the last dot (e.g. `firstName`) is used
    // for defining the name of the computed property.
    ...mapFields([
      'user.firstName',
      'user.lastName',
      // It's also possible to access
      // nested properties in arrays.
      'addresses[0].town',
    ]),
  },
};
</script>

Edit nested properties example

Rename properties

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.

<template>
  <div id="app">
    <input v-model="userFirstName">
    <input v-model="userLastName">
  </div>
</template>

<script>
import { mapFields } from 'vuex-map-fields';

export default {
  computed: {
    ...mapFields({
      userFirstName: 'user.firstName',
      userLastName: 'user.lastName',
    }),
  },
};
</script>

Edit rename properties example

Custom getters and mutations

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.

Store

import Vue from 'vue';
import Vuex from 'vuex';

import { getField, updateField } from 'vuex-map-fields';

Vue.use(Vuex);

export default new Vuex.Store({
  state: {
    user: {
      firstName: '',
      lastName: '',
    },
  },
  getters: {
    // By wrapping the `getField()` function we're
    // able to provide a specific property of the state.
    getUserField(state) {
      return getField(state.user);
    },
  },
  mutations: {
    // Mutating only a specific property of the state
    // can be significantly faster than mutating the
    // whole state every time a field is updated.
    updateUserField(state, field) {
      updateField(state.user, field);
    },
  },
});

Component

<template>
  <div id="app">
    <input v-model="firstName">
    <input v-model="lastName">
  </div>
</template>

<script>
import { createHelpers } from 'vuex-map-fields';

// The getter and mutation types we're providing
// here, must be the same as the function names we've
// used in the store.
const { mapFields } = createHelpers({
  getterType: 'getUserField',
  mutationType: 'updateUserField',
});

export default {
  computed: {
    // Because we're providing the `state.user` property
    // to the getter and mutation functions, we must not
    // use the `user.` prefix when mapping the fields.
    ...mapFields([
      'firstName',
      'lastName',
    ]),
  },
};
</script>

Edit custom getters and mutations example

Vuex modules

Vuex makes it possible to divide the store into modules.

Store

import Vue from 'vue';
import Vuex from 'vuex';

import { createHelpers } from 'vuex-map-fields';

// Because by default, getters and mutations in Vuex
// modules, are globally accessible and not namespaced,
// you most likely want to rename the getter and mutation
// helpers because otherwise you can't reuse them in multiple,
// non namespaced modules.
const { getFooField, updateFooField } = createHelpers({
  getterType: 'getFooField',
  mutationType: 'updateFooField',
});

Vue.use(Vuex);

export default new Vuex.Store({
  // ...
  modules: {
    fooModule: {
      state: {
        foo: '',
      },
      getters: {
        getFooField,
      },
      mutations: {
        updateFooField,
      },
    },
  },
});

Component

<template>
  <div id="app">
    <input v-model="foo">
  </div>
</template>

<script>
import { createHelpers } from 'vuex-map-fields';

// We're using the same getter and mutation types
// as we've used in the store above.
const { mapFields } = createHelpers({
  getterType: 'getFooField',
  mutationType: 'updateFooField',
});

export default {
  computed: {
    ...mapFields(['foo']),
  },
};
</script>

Edit Vuex modules example

Namespaced Vuex modules

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.

Store

import Vue from 'vue';
import Vuex from 'vuex';

import { getField, updateField } from 'vuex-map-fields';

Vue.use(Vuex);

export default new Vuex.Store({
  // ...
  modules: {
    fooModule: {
      namespaced: true,
      state: {
        foo: '',
      },
      getters: {
        getField,
      },
      mutations: {
        updateField,
      },
    },
  },
});

Component

<template>
  <div id="app">
    <input v-model="foo">
  </div>
</template>

<script>
import { createHelpers } from 'vuex-map-fields';

// `fooModule` is the name of the Vuex module.
const { mapFields } = createHelpers({
  getterType: 'fooModule/getField',
  mutationType: 'fooModule/updateField',
});

export default {
  computed: {
    ...mapFields(['foo']),
  },
};
</script>

Edit namespaced Vuex modules example

Or you can pass the module namespace string as the first argument of the mapFields() function.

<template>
  <div id="app">
    <input v-model="foo">
  </div>
</template>

<script>
import { mapFields } from 'vuex-map-fields';

export default {
  computed: {
    // `fooModule` is the name of the Vuex module.
    ...mapFields('fooModule', ['foo']),
  },
};
</script>

Edit namespaced Vuex modules example

Multi-row fields

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.

Store

import Vue from 'vue';
import Vuex from 'vuex';

import { getField, updateField } from 'vuex-map-fields';

Vue.use(Vuex);

export default new Vuex.Store({
  // ...
  state: {
    addresses: [
      {
        zip: '12345',
        town: 'Foo Town',
      },
      {
        zip: '54321',
        town: 'Bar Town',
      },
    ],
  },
  getters: {
    getField,
  },
  mutations: {
    updateField,
  },
});

Component

<template>
  <div id="app">
    <div v-for="address in addresses">
      <label>ZIP <input v-model="address.zip"></label>
      <label>Town <input v-model="address.town"></label>
    </div>
  </div>
</template>

<script>
import { mapMultiRowFields } from 'vuex-map-fields';

export default {
  computed: {
    ...mapMultiRowFields(['addresses']),
  },
};
</script>

Edit multi-row fields example

Upgrade from 0.x.x to 1.x.x

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.

import Vue from 'vue';
import Vuex from 'vuex';

// You now have to also import the `getField()` function.
import { getField, updateField } from 'vuex-map-fields';

Vue.use(Vuex);

export default new Vuex.Store({
  state: {
    fieldA: '',
    fieldB: '',
  },
  getters: {
    // Add the `getField` getter to the
    // `getters` of your Vuex store instance.
    getField,
  },
  mutations: {
    updateField,
  },
});

Patreon Sponsors

Spiffy

Become a sponsor and get your logo in this README with a link to your site.

Articles

About

Author

Markus Oberlehner
Website: https://markus.oberlehner.net
Twitter: https://twitter.com/MaOberlehner
PayPal.me: https://paypal.me/maoberlehner
Patreon: https://www.patreon.com/maoberlehner

License

MIT

Comments
  • items use mapMultiRowFields push [] to other variable

    items use mapMultiRowFields push [] to other variable

    when i use mapMultiRowFields for the list, I can't get items in list to push to other list

    please help me check this. https://codesandbox.io/s/vuex-map-fields-nested-properties-forked-gex56?fontsize=14&hidenavigation=1&theme=dark

    Originally posted by @nguyenpr9 in https://github.com/maoberlehner/vuex-map-fields/issues/115#issuecomment-688730054

    question 
    opened by nguyenpr9 16
  • Multiple getterTypes

    Multiple getterTypes

    Hi,

    I'm working Vuex modules to state my data. I store the data in multiple modules to keep my code base nice and clean.

    When using vuex-map-fields I have a situation where I'm using data from multiple modules. There seems to be no method to do this or I am doing it wrong.

    Below is my current code; My component

    <template>
        <div class="">
            <input type="text" v-model="no_panels"><br>
            <input type="text" v-model="firstName"><br>
            <router-link to="/step-2">Go to step 2</router-link>
        </div>
    </template>
    
    <script>
        import { createHelpers } from 'vuex-map-fields';
    
        const { mapFields } = createHelpers({
            getterType: [
                'getKitchenField',
                'getApplicantField',
            ],
            mutationType: 'updateKitchenField',
        });
    
        export default {
            computed: {
                ...mapFields(['no_panels', 'firstName', 'lastName'])
            },
        }
    </script>
    

    My store file

    import kitchen from './kitchen';
    import applicant from "./applicant";
    
    export default {
        modules: {
            kitchen: kitchen,
            applicant: applicant
        },
        strict: false
    }
    

    Applicant.js

    import { createHelpers } from 'vuex-map-fields';
    
    const { getApplicantField, updateApplicantField } = createHelpers({
        getterType: 'getApplicantField',
        mutationType: 'updateApplicantField',
    });
    
    export default {
        state: {
            firstName: '',
            lastName: ''
        },
        getters: {
            getApplicantField
        },
        mutations: {
            updateApplicantField
        }
    }
    

    The code above results in the following error:

    Error in render: "TypeError: this.$store.getters[getterType] is not a function"

    question 
    opened by jurgenbosch 12
  • Support deep nested structures for mapMultiRowFields

    Support deep nested structures for mapMultiRowFields

    Hi! Thank you for you library. I would like to improve a bit the current implementation of mapMultiRowFields to support deep nested fields.

    A few things to note in this PR are:

    • I've added a single small dependency (traverse) to traverse the actual state object in order to create a kind of reactive structure. Maybe I can just import the code directly from it, if you think that's the right approach.
    • I've abused a bit of closures to avoid unnecessary parsing.
    • The path created for updateField and getField uses dot-notation even for arrays, so we have a strange array.1.field, but it still plays nicely with the current implementation of those getters and setters.
    opened by mcosta91 9
  •  Example writing tests with map fields

    Example writing tests with map fields

    I am using map fields in my vuex store but running the tests gives me the following error:

    TypeError: this.$store.getters[getterType] is not a function

    Are there any examples with vue-jest tests?

    question 
    opened by abhipanda 9
  • Nested Properties not working

    Nested Properties not working

    In my store.js, I have a couple of modules, and a few nested properties in one of the module

    const moduleProjectDetails = {
      state: {
        infrastructureClass: '',
        publicServiceClass: '',
        projectUnit: {
          ton: '',
          square_cubic_meter: '',
          kilometer: '',
          mu: '',
        },
      },
      getters: {
        getField,
      },
      mutations: {
        updateField,
      },
    }
    
    export default new Vuex.Store({
      modules: {
        basicInput: moduleBasicInput,
        projectDetails: moduleProjectDetails,
      },
    })
    

    In my Component.vue, I use mapfields, and call the property with the identifier after the last .

    <md-input class="" v-model="infrastructureClass"></md-input>
    <md-input class="" v-model="publicServiceClass"></md-input>
    <md-input class="" v-model="ton"></md-input>
    <md-input class="" v-model="square_cubic_meter"></md-input>
    <md-input class="" v-model="kilometer"></md-input>
    <md-input class="" v-model="mu"></md-input>
    
    <script>
    import Vue from 'vue'
    import { mapFields } from 'vuex-map-fields'
    
    export default {
      name: 'ProjectDetails',
      computed: {
        ...mapFields([
          'infrastructureClass',
          'publicServiceClass',
          'projectUnit.ton',
          'projectUnit.square_cubic_meter',
          'projectUnit.kilometer',
          'projectUnit.mu',
        ]),
      },
    }
    </script>
    

    I see this error message:

    [Vue warn]: Error in render: "TypeError: Cannot read property 'ton' of undefined"
    
    found in
    
    ---> <ProjectDetails> at src/components/ProjectDetails.vue
           <MdTab> at src/components/MdTabs/MdTab.vue
             <MdContent> at src/components/MdContent/MdContent.vue
               <MdTabs> at src/components/MdTabs/MdTabs.vue
                 <App> at src/MainScreen.vue
                   <MdContent> at src/components/MdContent/MdContent.vue
                     <MdAppContent> at src/components/MdApp/MdAppContent.vue
                       <MdAppInternalSideDrawer> at src/components/MdApp/MdAppSideDrawer.vue
                         <App> at src/App.vue
                           <Root>
    

    I see the nested properties available in the Vue.js devtools

    image

    How can I properly access the nested properties?

    Environment

    Node: v9.11.1 Vue: 2.5.2 vuex-map-fields: 1.1.7

    question 
    opened by hanxue 7
  • String formatting of the getterType and mutationType arguments to createHelpers

    String formatting of the getterType and mutationType arguments to createHelpers

    I tried to do stuff like:

    const {mapFields} = createHelpers({getterType: `${nsName}/getField`, mutationType: `${nsName}/updateField`});
    

    But it didn't work. I pass "nsName" as props. I want to create reusable components. Do you think there's a way to achieve this kind of behavior?

    Thanks in advance!

    question 
    opened by savandriy 7
  • Integration with Nuxt.js

    Integration with Nuxt.js

    Hello - currently working on getting this excellent module to work with Nuxt.js. I'm using Nuxt in SSR mode. When I follow your example here, I get:

    module namespace not found in mapState():

    and...

    this.$store.getters[getterType] is not a function

    Pretty sure it's to do with when Nuxt inits the Vuex store.

    Any ideas?

    Thanks!

    opened by MrRossBennett 7
  • How to handle array fields in store?

    How to handle array fields in store?

    Hello there. Please help me to understand how to handle array fields with this plugin. I have members array in store. It's easy to map array itself with

    computed: {
          ...mapFields([
            'org.members'
          ])
        },
    

    adding new items to the array dynamically with needed fields, like:

        methods: {
          addMember: function(e) {
            e.preventDefault();
            this.$store.state.org.members.push(Vue.util.extend({}, {
              name: '',
              email: ''
            }))
          }
        }
    

    and dynamically showing this data in template with:

            <section
              v-for="member in members"
              :key="member.name"
            >
              <input placeholder="Name" v-model="member.name"
              ></input>
              <input placeholder="Email" v-model="member.email"
              ></input>
            </section>
    

    But it's not working, store is not updating. Thanks for help.

    question 
    opened by dab 7
  • fix for #41, reactive nested properties and dynamic properties support

    fix for #41, reactive nested properties and dynamic properties support

    store commits via updateField now creates reactive properties across the nested chain. also when dealing with dynamic properties (chains that are not known at compile time) this fix ensures the safety of the nested chain by creating store objects as needed.

    the nested properties are made reactive by default according to vue recommendations (https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties)

    opened by fusionbeam 6
  • Added function to manipulate array

    Added function to manipulate array

    I'm not good at English, so tests and PR sentences may not be good, but I want you to forgive me.

    I added a function to manipulate the array of stores that used after importing into mutation like "updateField". I want you to see how to use added test.

    opened by tnemotox 5
  • Is there any way to create a callback or something similar?

    Is there any way to create a callback or something similar?

    After changing the data in the text field, a mutation named updateField is performed. I needed to call a different mutation every time updateField is executed. Can you please tell me how can I implement this? Maybe you have the ability to rewrite the mutation with the addition of custom code to implement the callback? Or do you already have the ability to specify a callback? I didn't find anything about it in the documentation.

    question 
    opened by afuno 4
  • Bump json5 from 1.0.1 to 1.0.2

    Bump json5 from 1.0.1 to 1.0.2

    Bumps json5 from 1.0.1 to 1.0.2.

    Release notes

    Sourced from json5's releases.

    v1.0.2

    • Fix: Properties with the name __proto__ are added to objects and arrays. (#199) This also fixes a prototype pollution vulnerability reported by Jonathan Gregson! (#295). This has been backported to v1. (#298)
    Changelog

    Sourced from json5's changelog.

    Unreleased [code, diff]

    v2.2.3 [code, diff]

    v2.2.2 [code, diff]

    • Fix: Properties with the name __proto__ are added to objects and arrays. (#199) This also fixes a prototype pollution vulnerability reported by Jonathan Gregson! (#295).

    v2.2.1 [code, diff]

    • Fix: Removed dependence on minimist to patch CVE-2021-44906. (#266)

    v2.2.0 [code, diff]

    • New: Accurate and documented TypeScript declarations are now included. There is no need to install @types/json5. (#236, #244)

    v2.1.3 [code, diff]

    • Fix: An out of memory bug when parsing numbers has been fixed. (#228, #229)

    v2.1.2 [code, diff]

    ... (truncated)

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Bump qs from 6.5.2 to 6.5.3

    Bump qs from 6.5.2 to 6.5.3

    Bumps qs from 6.5.2 to 6.5.3.

    Changelog

    Sourced from qs's changelog.

    6.5.3

    • [Fix] parse: ignore __proto__ keys (#428)
    • [Fix] utils.merge: avoid a crash with a null target and a truthy non-array source
    • [Fix] correctly parse nested arrays
    • [Fix] stringify: fix a crash with strictNullHandling and a custom filter/serializeDate (#279)
    • [Fix] utils: merge: fix crash when source is a truthy primitive & no options are provided
    • [Fix] when parseArrays is false, properly handle keys ending in []
    • [Fix] fix for an impossible situation: when the formatter is called with a non-string value
    • [Fix] utils.merge: avoid a crash with a null target and an array source
    • [Refactor] utils: reduce observable [[Get]]s
    • [Refactor] use cached Array.isArray
    • [Refactor] stringify: Avoid arr = arr.concat(...), push to the existing instance (#269)
    • [Refactor] parse: only need to reassign the var once
    • [Robustness] stringify: avoid relying on a global undefined (#427)
    • [readme] remove travis badge; add github actions/codecov badges; update URLs
    • [Docs] Clean up license text so it’s properly detected as BSD-3-Clause
    • [Docs] Clarify the need for "arrayLimit" option
    • [meta] fix README.md (#399)
    • [meta] add FUNDING.yml
    • [actions] backport actions from main
    • [Tests] always use String(x) over x.toString()
    • [Tests] remove nonexistent tape option
    • [Dev Deps] backport from main
    Commits
    • 298bfa5 v6.5.3
    • ed0f5dc [Fix] parse: ignore __proto__ keys (#428)
    • 691e739 [Robustness] stringify: avoid relying on a global undefined (#427)
    • 1072d57 [readme] remove travis badge; add github actions/codecov badges; update URLs
    • 12ac1c4 [meta] fix README.md (#399)
    • 0338716 [actions] backport actions from main
    • 5639c20 Clean up license text so it’s properly detected as BSD-3-Clause
    • 51b8a0b add FUNDING.yml
    • 45f6759 [Fix] fix for an impossible situation: when the formatter is called with a no...
    • f814a7f [Dev Deps] backport from main
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Bump decode-uri-component from 0.2.0 to 0.2.2

    Bump decode-uri-component from 0.2.0 to 0.2.2

    Bumps decode-uri-component from 0.2.0 to 0.2.2.

    Release notes

    Sourced from decode-uri-component's releases.

    v0.2.2

    • Prevent overwriting previously decoded tokens 980e0bf

    https://github.com/SamVerschueren/decode-uri-component/compare/v0.2.1...v0.2.2

    v0.2.1

    • Switch to GitHub workflows 76abc93
    • Fix issue where decode throws - fixes #6 746ca5d
    • Update license (#1) 486d7e2
    • Tidelift tasks a650457
    • Meta tweaks 66e1c28

    https://github.com/SamVerschueren/decode-uri-component/compare/v0.2.0...v0.2.1

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Bump jsdom from 16.4.0 to 16.7.0

    Bump jsdom from 16.4.0 to 16.7.0

    Bumps jsdom from 16.4.0 to 16.7.0.

    Release notes

    Sourced from jsdom's releases.

    Version 16.7.0

    • Added AbortSignal.abort(). (ninevra)
    • Added dummy x and y properties to the return value of getBoundingClientRect(). (eiko)
    • Implemented wrapping for textareaEl.value if the wrap="" attribute is specified. (ninevra)
    • Changed newline normalization in <textarea>s according to recent HTML Standard updates. (ninevra)
    • Fixed some bad cascade computation in getComputedStyle(). (romain-trotard)

    Version 16.6.0

    • Added parentNode.replaceChildren(). (@​ninevra)
    • Fixed jsdom's handling of when code running inside the jsdom throws null or undefined as an exception. (@​mbest)
    • Removed the dependency on the deprecated request package, in the process fixing several issues with the XMLHttpRequest implementation around header processing. Thanks go to @​tobyhinloopen, @​andrewaylett, and especially @​vegardbb, for completing this months-long effort!

    Version 16.5.3

    • Fixed infinite recursion when using MutationObservers to observe elements inside a MutationObserver callback.

    Version 16.5.2

    • Fixed Access-Control-Allow-Headers: * to work with XMLHttpRequest. (silviot)
    • Fixed xhr.response to strip any leading BOM when xhr.responseType is "json".
    • Fixed new Text() and new Comment() constructors to properly set the resulting node's ownerDocument.
    • Fixed customElements.whenDefined() to resolve its returned promise with the custom element constructor, per recent spec updates. (ExE-Boss)
    • Fixed parsing to ensure that <svg>\<template></template></svg> does not throw an exception, but instead correctly produces a SVG-namespace \<template> element.
    • Fixed domParser.parseFromString() to treat <noscript> elements appropriately.
    • Fixed form control validity checking when the control was outside the <form> element and instead associated using the form="" attribute.
    • Fixed legendEl.form to return the correct result based on its parent <fieldset>.
    • Fixed optionEl.text to exclude <script> descendants.
    • Fixed radio buttons and checkboxes to not fire input and change events when disconnected.
    • Fixed inputEl.indeterminate to reset to its previous value when canceling a click event on a checkbox or radio button.
    • Fixed the behavior of event handler attributes (e.g. onclick="...code...") when there were global variables named element or formOwner. (ExE-Boss)
    • On Node.js v14.6.0+ where WeakRefs are available, fixed NodeIterator to no longer stop working when more than ten NodeIterator instances are created, and to use less memory due to inactive NodeIterators sticking around. (ExE-Boss)

    Version 16.5.1

    • Fixed a regression that broke customElements.get() in v16.5.0. (fdesforges)
    • Fixed window.event to have a setter which overwrites the window.event property with the given value, per the specification. This fixes an issue where after upgrading to jsdom v16.5.0 you would no longer be able to set a global variable named event in the jsdom context.

    Version 16.5.0

    • Added window.queueMicrotask().
    • Added window.event.
    • Added inputEvent.inputType. (diegohaz)
    • Removed ondragexit from Window and friends, per a spec update.
    • Fixed the URL of about:blank iframes. Previously it was getting set to the parent's URL. (SimonMueller)
    • Fixed the loading of subresources from the filesystem when they had non-ASCII filenames.
    • Fixed the hidden="" attribute to cause display: none per the user-agent stylesheet. (ph-fritsche)
    • Fixed the new File() constructor to no longer convert / to :, per a pending spec update.
    • Fixed mutation observer callbacks to be called with the MutationObserver instance as their this value.
    • Fixed <input type=checkbox> and <input type=radio> to be mutable even when disabled, per a spec update.
    • Fixed XMLHttpRequest to not fire a redundant final progress event if a progress event was previously fired with the same loaded value. This would usually occur with small files.
    • Fixed XMLHttpRequest to expose the Content-Length header on cross-origin responses.
    • Fixed xhr.response to return null for failures that occur during the middle of the download.
    • Fixed edge cases around passing callback functions or event handlers. (ExE-Boss)
    • Fixed edge cases around the properties of proxy-like objects such as localStorage or dataset. (ExE-Boss)

    ... (truncated)

    Changelog

    Sourced from jsdom's changelog.

    16.7.0

    • Added AbortSignal.abort(). (ninevra)
    • Added dummy x and y properties to the return value of getBoundingClientRect(). (eiko)
    • Implemented wrapping for textareaEl.value if the wrap="" attribute is specified. (ninevra)
    • Changed newline normalization in <textarea>s according to recent HTML Standard updates. (ninevra)
    • Fixed some bad cascade computation in getComputedStyle(). (romain-trotard)

    16.6.0

    • Added parentNode.replaceChildren(). (ninevra)
    • Fixed jsdom's handling of when code running inside the jsdom throws null or undefined as an exception. (mbest)
    • Removed the dependency on the deprecated request package, in the process fixing several issues with the XMLHttpRequest implementation around header processing. Special thanks to vegardbb for completing this months-long effort!

    16.5.3

    • Fixed infinite recursion when using MutationObservers to observe elements inside a MutationObserver callback.

    16.5.2

    • Fixed Access-Control-Allow-Headers: * to work with XMLHttpRequest. (silviot)
    • Fixed xhr.response to strip any leading BOM when xhr.responseType is "json".
    • Fixed new Text() and new Comment() constructors to properly set the resulting node's ownerDocument.
    • Fixed customElements.whenDefined() to resolve its returned promise with the custom element constructor, per recent spec updates. (ExE-Boss)
    • Fixed parsing to ensure that <svg>\<template></template></svg> does not throw an exception, but instead correctly produces a SVG-namespace \<template> element.
    • Fixed domParser.parseFromString() to treat <noscript> elements appropriately.
    • Fixed form control validity checking when the control was outside the <form> element and instead associated using the form="" attribute.
    • Fixed legendEl.form to return the correct result based on its parent <fieldset>.
    • Fixed optionEl.text to exclude <script> descendants.
    • Fixed radio buttons and checkboxes to not fire input and change events when disconnected.
    • Fixed inputEl.indeterminate to reset to its previous value when canceling a click event on a checkbox or radio button.
    • Fixed the behavior of event handler attributes (e.g. onclick="...code...") when there were global variables named element or formOwner. (ExE-Boss)
    • On Node.js v14.6.0+ where WeakRefs are available, fixed NodeIterator to no longer stop working when more than ten NodeIterator instances are created, and to use less memory due to inactive NodeIterators sticking around. (ExE-Boss)

    16.5.1

    • Fixed a regression that broke customElements.get() in v16.5.0. (fdesforges)
    • Fixed window.event to have a setter which overwrites the window.event property with the given value, per the specification. This fixes an issue where after upgrading to jsdom v16.5.0 you would no longer be able to set a global variable named event in the jsdom context.

    16.5.0

    • Added window.queueMicrotask().
    • Added window.event.
    • Added inputEvent.inputType. (diegohaz)
    • Removed ondragexit from Window and friends, per a spec update.
    • Fixed the URL of about:blank iframes. Previously it was getting set to the parent's URL. (SimonMueller)
    • Fixed the loading of subresources from the filesystem when they had non-ASCII filenames.
    • Fixed the hidden="" attribute to cause display: none per the user-agent stylesheet. (ph-fritsche)
    • Fixed the new File() constructor to no longer convert / to :, per a pending spec update.
    • Fixed mutation observer callbacks to be called with the MutationObserver instance as their this value.

    ... (truncated)

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • How to use ...mapFields in script setup and typescript?

    How to use ...mapFields in script setup and typescript?

    We are currently in the proces of migrating some component to Vue 3 script setup style. But have have found some difficulties integrating this.

    We are using a customHelper

    export const customHelper = createHelpers({
      getterType: "getField",
      mutationType: "updateField"
    });
    

    And would like to use it inside a computed like this:

    let somestate = computed(() =>customHelper.mapFields(["somestate"]);

    It compiles, until we try to change the value.

    somestate.value = "new value" <- this won't compile.

    Is there anything we can do to make this work?

    opened by ferrykranenburgcw 0
  • Bump minimist from 1.2.5 to 1.2.6

    Bump minimist from 1.2.5 to 1.2.6

    Bumps minimist from 1.2.5 to 1.2.6.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
Releases(1.4.0)
  • 1.4.0(Feb 22, 2020)

  • 1.3.6(Oct 23, 2019)

  • 1.3.5(Aug 21, 2019)

  • 1.3.4(May 6, 2019)

  • 1.3.3(Apr 20, 2019)

  • 1.3.2(Feb 5, 2019)

  • 1.3.1(Feb 5, 2019)

  • 1.3.0(Feb 5, 2019)

  • 1.2.3(Feb 5, 2019)

  • 1.2.2(May 23, 2018)

    • 50345d6979cbe8030fd6a474d7ab5943885abb7c Use Yarn instead of npm
    • abf74e4f97d6c6158865d7504bf99a3453c47917 Add namespacing tests for 100% coverage
    Source code(tar.gz)
    Source code(zip)
  • 1.2.1(May 22, 2018)

  • 1.2.0(May 22, 2018)

    • 60dee6fbddf73a66c86653ed87718c1b2ff03054 Update dependencies
    • 3122683bda09c6aa8b369a0b52b31fe82d812d32 Replace deprecated Vue test utils shallow function
    • cf0b0654ab3b2ff49842ec091f2918d029307267 Make it possible to pass namespace to mapFields()
    Source code(tar.gz)
    Source code(zip)
  • 1.1.7(Apr 24, 2018)

  • 1.1.6(Apr 9, 2018)

    • 038eefbe928c33bf401fcc56f5528c1400099cc7 Use PayPal.me instead of donation link
    • 63b14a5504b02ea4d064973a5b104944a44ab773 Add Patreon badge and link
    • 771af3a3faec584cab827288d0fd8c0d83bd9223 Reformat md files to be standard compatible
    Source code(tar.gz)
    Source code(zip)
  • 1.1.5(Apr 7, 2018)

  • 1.1.4(Mar 14, 2018)

  • 1.1.3(Mar 14, 2018)

    • f003ab00fc0b069df480d1a7fc5190cbb0087bad Use babel 7 beta
    • 162727de91cdcbc3bf1a8a8949f2a1da2e6a4434 Remove obsolete dependency
    • fa1e195d8afeec382bb97b5f22955f40f4fa59f0 Lint scripts in markdown files
    • 75f161db576a6870895dc081c95f21e2dca7769b Update dependencies
    Source code(tar.gz)
    Source code(zip)
  • 1.1.2(Feb 21, 2018)

    • 6d72e03ac20de8b311633857d64d370987046aa4 Update dependencies
    • 5eb7b9d972ee1a136088e2dec9d814cf161eff5d Create an esm build to use as pkg.module
    • c8d8e1f6e7fabc6a8581df7afbca618ddd081016 Remove obsolete mapCoverage config option
    Source code(tar.gz)
    Source code(zip)
  • 1.1.1(Jan 28, 2018)

    • e9f9cca5e3d37b092012104f3d5617182aa7b535 Use single quotes over backticks in code examples
    • eeb0cfb92f3ff16183e102336817442fcc7f9409 Update dependencies
    • 0d4c881577d44de055f589a4924a74d7b607de10 Replace deprecated vue-test-utils package
    Source code(tar.gz)
    Source code(zip)
  • 1.1.0(Jan 28, 2018)

    This release adds the possibility to dynamically map rows of fields for multi-row data types: Multi-row fields.

    • a00750f1174c19dbc6b02e287668dd037734cceb Be more specific when checking return values
    • eb7945e57bc1e2bb5b33e4671f7c238dbf4fdb90 Implement multi-row field mapping
    Source code(tar.gz)
    Source code(zip)
  • 1.0.2(Jan 7, 2018)

    • c2a21d5a9113ce59fbf255fbadd0d2c3ff2d605f Formatting (whitespace)
    • 2fc045cc6dfd4374532a3540d18f8f449f44ff1f Add tests for usage with Vuex modules
    • 56518646b16883bb8da1abd3a18556af53ec446d Add example code to demonstrate usage with modules
    Source code(tar.gz)
    Source code(zip)
  • 1.0.1(Jan 1, 2018)

    • ed1922258ec6e059b7333e75822f7b4ed4b04407 Remove .tgz file after fake publishing
    • 0b51460083e010598c5fe1363ba41dd4512a0fe2 Remove Object.assign and use param reassign
    Source code(tar.gz)
    Source code(zip)
  • 1.0.0(Jan 1, 2018)

    Removing the unchanged dependency, helps reducing the file size of the minified code from about 4.5 kb to 1.4 kb (~650 byte gziped).

    • baafef4d98e312a1edcebe32e0a0157851d44c50 Use a getter to enable more performant mutations
    • ad03354acdda515be3356d56fe6c9dc2186037d6 Add integration tests
    • 70bd825eaf2d698e876903cc3c02ee6f715a1d0d Remove unchanged dependency
    Source code(tar.gz)
    Source code(zip)
  • 0.1.3(Dec 29, 2017)

    This is the final maintenance release before some bigger changes coming with 1.0.0

    • edfc0cc56f678a781ea2bd63dc4149405074a1ba Update dependencies
    • 1c5cb017b76cd22e1e6d305eb088403cd21ad7df Fix tests to match real world scenarios
    • a133a43346318f0847245777032d4a1da2fd03b8 Optimize phrasing in the docu
    Source code(tar.gz)
    Source code(zip)
  • 0.1.2(Dec 29, 2017)

  • 0.1.1(Dec 29, 2017)

    • 72dec9cc4c882424229695a2b377f18df935a5e2 Initial commit
    • ede9f21ebadcadfdaf26d751692a92872cc7ea7c Add README and description
    • 624b6acb5dfdb305d0601e7724505e042f345c45 Remove watch mode
    • 16fdfada1f4803041f97369d1e1eed4f4a56cece Implement core functionality
    • 7e82ef46b3fc82c1e8f0cc9254f870323067d9e4 Add documentation
    • 3507aa926ddaccc2d901bf0fec1cb20ffa1774d2 Optimize docu and fix typos
    • df485f8dca2b8985facd5559f1c93583f0f1598a Use single quotes over backticks in code examples
    • aa6f7b1ccf2d734cb801bb28c78a890e2b5bd0ec Remove *.spec.js files from the npm package
    Source code(tar.gz)
    Source code(zip)
Owner
Markus Oberlehner
Markus Oberlehner
A plugin for syncing Vuex store with js-data

vuex-jsdata-plugin A simple attempt to help using jsdata alongside Vue.js: This plugin syncing Vuex store with js-data After each injection made by js

Alexandre Bonaventure Geissmann 20 Jul 30, 2020
Use a JSONAPI api with a Vuex store, with data restructuring/normalization.

jsonapi-vuex A module to access JSONAPI data from an API, using a Vuex store, restructured to make life easier. Documentation Documentation, including

Matthew Richardson 145 Dec 22, 2022
Vuex binding for client-side search with indexers and Web Workers :green_book::mag:

Vuex Search is a plugin for searching collections of objects. Search algorithms powered by js-worker-search. See working example here. Installation: n

Albert Lucianto 160 Dec 24, 2022
A Vuex plugin to persist the store. (Fully Typescript enabled)

vuex-persist A Typescript-ready Vuex plugin that enables you to save the state of your app to a persisted storage like Cookies or localStorage. Info :

Arnav Gupta 1.6k Jan 5, 2023
An opinionated Brunch skeleton for using Vue2, Vuex and VueRouter. Comes packed with axios and Store

brunch-with-vuety An opinionated Brunch skeleton for using Vue2, Vuex and VueRouter. Comes packed with axios and Store Instructions Simply download th

Rodrigo Juliani 24 Mar 20, 2020
Plugin for working with Vuex. Allows to use localeStorage to store state. It is possible to

vuex-masked-modules Plugin for working with Vuex. Allows to use localeStorage to store state. It is possible to "mask" data in the localStorage cell.

Evgenij Labuzov 2 Jun 11, 2022
Vue and Vuex plugin to persistence data with localStorage/sessionStorage

vuejs-storage Vue.js and Vuex plugin to persistence data with localStorage/sessionStorage Purpose This plugin provide a simple binding with localStora

maple 119 Dec 15, 2022
Vuex-Queries helps you write query functions in Vuex

Vuex-Queries Vuex-Queries helps you write query functions in Vuex Usage Write your queries in Vuex options: const options = { state: { events: [

Wu Haotian 12 Dec 15, 2018
[NO LONGER MAINTAINED] `vuex-dry` helps keep your vuex codes DRY.

NO LONGER MAINTAINED This repository is not actively maintained. I haven't used this package for a year. It means there has been no change. You can st

Eunjae Lee 53 Dec 28, 2022
Vue / Vuex plugin providing a unified path syntax to Vuex stores

Overview Pathify makes working with Vuex easy, with a declarative, state-based, path syntax: Paths can reference any module, property or sub-property:

Dave Stewart 1.4k Dec 14, 2022
A Vuex plugin that easily maps Rails resources to Vuex modules

VuexRailsPlugin A Vuex plugin that easily maps Rails resources to Vuex modules The idea of this plugin is to easily incorporate conventional rest endp

Richard LaFranchi 1 Dec 27, 2018
Hooks for fetching, caching and updating asynchronous data in Vue

Hooks for fetching, caching and updating asynchronous data in Vue

Damian Osipiuk 982 Jan 8, 2023
Utils normalize url, data, params for axios when using rest api request

rexios Utils normalize url, data, params for axios when using rest api request Why? Returns normalized parameters and url according to the rest-api co

Ivan Demidov 5 Mar 9, 2022
💾 Persist and rehydrate your Vuex state between page reloads.

vuex-persistedstate Persist and rehydrate your Vuex state between page reloads. Install npm install --save vuex-persistedstate The UMD build is also a

Robin van der Vleuten 5.8k Jan 5, 2023
Local state management within Vuex

vuex-local Local state management within Vuex Why? Global state management is one of the problems on huge application development. Developers address

Katashin 64 Nov 11, 2022
:hammer: Utilities for vuex to easily create and manage actions.

vuex-action Utilities for vuex to easily create and manage actions. Allow you to create untyped action Support for Promise Work with [email protected] and [email protected] I

varHarrie 27 Mar 26, 2021
A utility to simplify the use of REST APIs with Vuex

vuex-rest-api A Helper utility to simplify the usage of REST APIs with Vuex 2. Uses the popular HTTP client axios for requests. Works with websanova/v

Christian Malek 382 Dec 24, 2022
cache vuex action when dispatch

vuex-cache Cache dispatched actions and prevent repeated requests and heavy actions. Compatibility Map and Promise are required (you can use polyfills

superwf 512 Nov 6, 2022
vuex plugin

vuex-local-state inject localStorage to vuex Installation $ npm install vuex-local-state --save API new VuexLocalState(storeOptions, [conf]); conf def

imconfig 18 Jul 30, 2020