1
0
mirror of synced 2025-01-24 03:11:40 +03:00
Zaytsev Kirill d39ca17e45 feat!: Added property "unregisterBehavior" to FormularioField to control value unset behavior on field component removal
Defaults to "none" which means value will not be unset and path will not be remove
2021-09-30 12:33:54 +03:00
2021-06-14 14:02:10 +03:00
2021-09-21 10:32:18 +03:00
2020-05-21 14:30:55 +03:00
2021-06-14 14:02:10 +03:00
2019-11-01 14:35:06 -04:00
2021-09-29 11:39:14 +03:00
2020-05-22 14:22:56 +03:00
2020-10-19 13:45:17 +03:00
2021-09-29 11:39:14 +03:00
2021-06-14 14:02:10 +03: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

Description
No description provided
Readme 4.2 MiB
Languages
JavaScript 58.4%
TypeScript 26.6%
Vue 14.8%
Makefile 0.2%