1
0
mirror of synced 2024-12-18 09:38:47 +03:00
Go to file
2024-12-06 17:38:03 +04:00
.github chore: github-actions testing pipeline 2021-06-14 14:02:10 +03:00
build chore: Removed unused dependency 2023-12-28 12:48:51 +04:00
dist fix: build 2023-12-28 13:11:07 +04:00
src chore!: Old names of FormularioField & FormularioFieldGroup no longer available 2023-12-28 12:48:51 +04:00
storybook refactor: State management logic & tests 2021-06-14 14:02:10 +03:00
test refactor: merge util removed due it's no longer required 2023-12-28 12:48:51 +04:00
types feat: Components conststructors are exposed as external API, added TypeScript declarations 2023-12-28 12:48:51 +04:00
.commitlintrc.json chore: Release automation preparations 2021-06-14 14:02:10 +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 feat: Components conststructors are exposed as external API, added TypeScript declarations 2023-12-28 12:48:51 +04:00
.gitignore feat: Updated package.json manifest 2024-12-06 17:38:03 +04:00
.npmignore chore: Release automation preparations 2021-06-14 14:02:10 +03:00
.travis.yml Updates build to use node 11 2019-11-01 14:35:06 -04:00
.versionrc.json chore: Release automation preparations 2021-06-14 14:02:10 +03:00
babel.config.js style: Fixed style of babel.config.js 2020-10-19 13:45:18 +03:00
CHANGELOG.md chore(release): 0.8.2 2023-12-28 13:55:22 +04:00
docker-compose.yml chore: node version in docker-compose rised to v16 2023-12-28 12:48:51 +04:00
index.d.ts feat: Components conststructors are exposed as external API, added TypeScript declarations 2023-12-28 12:48:51 +04: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 feat: Updated package.json manifest 2024-12-06 17:38:03 +04:00
README.md docs: README.md clarification 2021-06-14 14:02:10 +03:00
tsconfig.json chore: Build config fixes, modules paths correction 2020-10-19 13:45:15 +03:00
web-types.json feat: Added web-types declaration 2023-12-28 13:55:15 +04:00
yarn.lock chore: Removed unused dependency 2023-12-28 12:48:51 +04:00

What is Vue Formulario?

Vue Formulario is a library, inspired by 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 FormularioField component. This component provides id and context in v-slot props. Control should use context.model as v-model and context.runValidation as handler for blur event (it is necessary for validation when property validationBehavior is demand). Errors list for a field can be accessed through context.allErrors.

The example below creates the authorization form from data:

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

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

    <FormularioFieldGroup name="options">
        <FormularioField
            v-slot="{ context }"
            name="anonymous"
        >
            <div>
                <input
                    id="options-anonymous"
                    v-model="context.model"
                    type="checkbox"
                >
                <label for="options-anonymous">As anonymous</label>
            </div>
        </FormularioField>
    </FormularioFieldGroup>

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

License

MIT

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