1
0
mirror of synced 2024-11-22 05:16:05 +03:00
Go to file
2020-10-23 13:24:27 +03:00
.github/ISSUE_TEMPLATE Library renamed to formulario 2020-05-22 14:22:56 +03:00
build chore: .npmignore & build config 2020-10-19 13:45:31 +03:00
dist 0.1.1 2020-10-21 10:58:40 +03:00
src refactor: Decrease of code block nesting 2020-10-23 13:24:27 +03:00
storybook chore: Added Grouping example to storybook, typehints fixes 2020-10-19 13:45:29 +03:00
test test: Removed unnecessary slots 2020-10-22 17:23:45 +03:00
.editorconfig Changed intend_size 2020-05-21 14:30:55 +03:00
.eslintignore chore: Added storybook, removed vue-i18n (was not in use) 2020-10-19 13:45:28 +03:00
.eslintrc.js chore: Added storybook, removed vue-i18n (was not in use) 2020-10-19 13:45:28 +03:00
.gitignore fix: Typehint fixes 2020-10-20 17:41:28 +03:00
.npmignore chore: .npmignore & build config 2020-10-19 13:45:31 +03:00
.travis.yml Updates build to use node 11 2019-11-01 14:35:06 -04:00
babel.config.js style: Fixed style of babel.config.js 2020-10-19 13:45:18 +03:00
docker-compose.yml chore: Docker configuration for dev 2020-10-19 13:45:17 +03:00
LICENSE.txt Library renamed to formulario 2020-05-22 14:22:56 +03:00
Makefile chore: Docker configuration for dev 2020-10-19 13:45:17 +03:00
package.json 0.1.1 2020-10-21 10:58:40 +03:00
README.md Errors now are an objects with fields message, rule and context. Fixed validation messages generation. Default validation messages generator added. 2020-05-25 13:41:38 +03:00
tsconfig.json chore: Build config fixes, modules paths correction 2020-10-19 13:45:15 +03:00
yarn.lock chore: Added Grouping example to storybook, typehints fixes 2020-10-19 13:45:29 +03:00

What is Vue Formulario?

Vue Formulario is a library, based on Vue Formulate, that handles the core logic for working with forms and gives full control on the form presentation.

Examples

Every form control have to rendered inside FormularioInput component. This component provides id and context in v-slot props. Control should use context.model as v-model and context.blurHandler as handler for blur event (it is necessary for validation when property errorBehavior is blur). Errors object list for field can be accessed through context.allErrors. Each error is an object with fields message (translated message), rule (rule name) and context.

The example below creates the authorization form from data:

    {
        "username": "",
        "password": "",
        "options": {
            "anonym": false,
            "tags": ["test"]
        },
    }
    <FormularioForm
        v-model="formData"
        name="formName"
    >
        <FormularioInput
            v-slot="vSlot"
            name="username"
            validation="required|email"
            error-behavior="live"
        >
            <input
                v-model="vSlot.context.model"
                type="text"
                @blur="vSlot.context.blurHandler"
            >
            <div v-if="vSlot.context.showValidationErrors">
                <span
                    v-for="(error, index) in vSlot.context.allErrors"
                    :key="index"
                >
                    {{ error.message }}
                </span>
            </div>
        </FormularioInput>

        <FormularioInput
            v-slot="vSlot"
            name="password"
            validation="required|min:4,length"
        >
            <input
                v-model="vSlot.context.model"
                type="password"
            >
        </FormularioInput>

        <FormularioGrouping name="options">
            <FormularioInput
                v-slot="vSlot"
                name="anonym"
            >
                <div>
                    <input
                        :id="vSlot.id"
                        v-model="vSlot.context.model"
                        type="checkbox"
                    >
                    <label :for="vSlot.id">As anonym</label>
                </div>
            </FormularioInput>
        </FormularioGrouping>

        <FormularioInput
            v-slot="vSlot"
            name="options.tags[0]"
        >
            <input
                v-model="vSlot.context.model"
                type="text"
            >
        </FormularioInput>
    </FormularioForm>

License

MIT

Copyright (c) 2020-present, RetailDriver LLC
Copyright (c) 2020-present, Braid LLC