npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@moirei/vuetify-dynamic-form

v1.3.6

Published

Dynamically create vuetify forms and form components .

Downloads

18

Readme

vuetify-dynamic-form (Vue 2)

Defining and creating form components and their validation can be tedious and repetitive. This package allows you to dynamically define form inputs with configurable options.


:green_heart: Features

  • Dynamically create form input fields
  • Two-way binded form data. Useful when using forms in update context and the implementing component may update/provide the initial data
  • vee-validate v3 validation
  • Slots to customise field components
  • Flexible configuration for validation, auto-grouping, component props, etc.

Installation

npm i --save @moirei/vuetify-dynamic-form
# or yarn add @moirei/vuetify-dynamic-form

Usage

import Vue from 'vue'
import VDynamicForm from '@moirei/vuetify-dynamic-form'
import CustomComponent from './CustomComponent'

Vue.use(VDynamicForm)

// Or with options
Vue.use(VDynamicForm, {
  interactionMode: "aggressive",
})

new Vue({}).$mount('#app')

// then inside your vue components
export default Vue.extend({
  data: () => ({
    form: {},
    inputs: {
      first_name: {
        name: "First Name",
        rules: "required|max:24",
        type: "text",
        line: 1,
        props: {
          filled: true,
        },
      },
      last_name: {
        name: "Last Name",
        rules: "max:24",
        component: "v-text-field", // Use a compnent name
        line: 1,
        props: {
          filled: true,
        },
      },
      address: {
        name: "Address",
        component: CustomComponent, // Use a component
        props: {
          filled: true,
        },
      },
    },
  })
})

<template>
  <v-dynamic-form v-model="form" :input-fields="inputs" />
</template>

API

Props

| Name | Required? | Default | Type | Description | | ------------------------ | --------- | ------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | value | yes | | string | The v-model input prop | | hide-name | no | false | boolean | Whether to hide input name displayed above the component field | | loading | no | false | boolean | Indicates the form or its data is in loading state. All inputs are disabled if true. | | readonly | no | false | boolean | Sets all inputs to readonly | | disabled | no | false | boolean | Disables all inputs | | disable-object-rewrite | no | false | boolean | Do not clone and emit new object for form data. When enabled, field input property is updated on the form data and the input event is not fired. | | hide-actions | no | false | boolean | Hides the SUBMIT and CLEAR actions | | defaults | no | {} | object | Default form values to prepopulate the inputs with | | interaction-mode | no | | string | Set the default interaction mode for all inputs | | input-fields | yes | | object | The dynamic form fields | | nested-fields | no | false | boolean | Allow nested fields. When true, field names like "address.line1" will be saved as property line1 in object address within the form data. To use array as nested key, use the key field option. | | valid | no | | boolean | Form validation state. Use with valid.sync. |

Field options

| Field | Default | Type | Description | | ---------------------- | ----------------------------------------------------------- | --------------------- | --------------------------------------------------------------------------------------------------------------------------- | | col | | object | Props to bind to v-col with multiple fields in one line | | component | | string|Component | | | hideName/hide-name | false | boolean | Hide the input display name | | key | Field key | string | string[] | Specify the field key in the form data | | props | | object | Input component props | | rules | | string|array | Vee-validate rules | | type | Uses <input > tag if empty and component is also empty. | string | Vuetify input types. Valid values: text, select, checkbox, slider, range-slider, switch, textarea and radio | | mode | aggressive | string | Vee-validate mode | | name | Field key | string | The input display name | | vid | Field key | string | Input field validation ID |

Plugin options

| Field | Default | Type | Description | | ----------------- | -------------- | -------- | ----------------------------------------- | | interactionMode | "aggressive" | string | Configure global default interaction mode |

Events

| Name | Description | | -------------- | ------------------------------------------------- | | input | The v-model input event | | submit | Emitted when the form is validated and submitted. | | update:valid | The valid.sync prop event |

Slots

| Name | Description | Props | | -------------------------- | -------------------------------------------------------------- | ------------------------------- | | field:validation:{field} | Use to override an input at the validation-provider level. | { field } | | field:{field} | Use to override an input at the component level. | { ...field, invalid, errors } | | actions | Use to override the default SUBMIT and CLEAR actions | { submit, clear, invalid } |

Functions

| Name | Description | | ---------- | ------------------------------------------- | | submit | Validates and emits submit event if valid | | clear | Resets the form data and validation states | | reset | Reset the validation observer | | validate | Validates all inputs and child forms |

Classes

| Name | Description | | ------------------------- | --------------------------------------- | | v-dynamic-form | The components class | | v-dynamic-form--inputs | The class group for all inputs | | v-dynamic-form--actions | The class group for the default actions |

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Changelog

Please see CHANGELOG.

Credits

License

MIT