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

@peynman/vuetify-formjson

v0.0.9

Published

Generate Forms using JSON Schema. Based on Vuetify components.

Downloads

11

Readme

WorkInProgress

Vuetify FormJSON

CircleCI NPM version NPM downloads License

Demos:

Features

  • Create forms from a json schema
  • Grab the output as an object in your parent component (v-model)
  • Nested, grouped inputs
  • Lots of components and inputs

Dependencies

  • Vue
  • Vuetify
  • jsoneditor if you use the 'json input'
  • axios if you use the 'datatable input'
  • vuetify-image-input if you use the 'image upload input'
  • tree-model if you use 'treeview input'

Installation

  • npm i @peynman/vuetify-formjson

Usage

Template:

// wrap component inside vuetify v-app (this is a vuetify requirement)
<v-app>
    // ...
    // somewhere inside your components
    <vuetify-formjson
        v-model="output"
        :options="options"
        :fields="fields"
    >
    </vuetify-formjson>
</v-app>

Script: component usage

import Vue from 'vue'
import VuetifyFormJSON from '@peynman/vuetify-formjson'

Vue.use(VuetifyFormJSON)

export default {
    data: () =>({
        output: {},
        options: {
            // options to pass to form, see Api
            class: 'ma-2'
        },
        fields: {
            // list of [fields objects] to render on the form
            //      see Api
            username: {
                type: 'input',
                input: 'text',
                label: 'Username',
            },
            password: {
                type: 'input',
                input: 'text',
                label: 'Password',
                props: {
                    // pass props directly to v-text-field tag
                    type: 'password',
                    hint: '8 characters min'
                }
            }
        }
    })
}

Script: vuetify setup

// YOU SHOULD DO THIS IF YOU ARE USING NPM VERSION OF VUETIFY, BROWSER VERSION DOES NOT NEED THIS
// since Vuetify only includes components that are used in the project directly in the npm build,
//   and components used in FormJSON are rendererd dynamically using their name, we need to pass vuetify setup the list of components that
//   we wish to be able to use in FormJSON
//   here is a complete list of all components used in FormJSON
import Vue from 'vue';
import Vuetify from 'vuetify/lib';
import 'vuetify/dist/vuetify.min.css'

import {
    VRow,
    VCol,
    VTextField,
    VSwitch,
    VSelect,
    VSlider,
    VRadioGroup,
    VRadio,
    VCheckbox,
    VTooltip,
    VIcon,
    VBtn,
    VDivider,
    VTabs,
    VTab,
    VTabItem,
    VExpansionPanels,
    VExpansionPanel,
    VExpansionPanelHeader,
    VExpansionPanelContent,
    VSimpleCheckbox,
    VDataTable,
    VToolbar,
    VSpacer,
    VAlert,
    VDialog,
    VCard,
    VCardTitle,
    VCardText,
    VCardActions,
    VContainer,
    VMenu,
    VColorPicker,
    VAutocomplete
} from 'vuetify/lib'

Vue.use(Vuetify, {
    components: {
        VRow,
        VCol,
        VTextField,
        VSwitch,
        VSelect,
        VSlider,
        VRadioGroup,
        VRadio,
        VCheckbox,
        VTooltip,
        VIcon,
        VBtn,
        VDivider,
        VTabs,
        VTab,
        VTabItem,
        VExpansionPanels,
        VExpansionPanel,
        VExpansionPanelHeader,
        VExpansionPanelContent,
        VMenu,
        VColorPicker,
        VAutocomplete,
        VDataTable,
        VToolbar,
        VSpacer,
        VAlert,
        VDialog,
        VCard,
        VCardTitle,
        VCardText,
        VCardActions,
        VContainer,
        VSimpleCheckbox
    }
});

export default new Vuetify({
    /// vuetify options like theme...
});

API

Components VuetifyFormJSON

  • Display a form and grab the output with a json schema, the schema is defined based on the predefined structure of an input fields, and passed to this component by fields props.
  • name: 'vuetify-formjson`
  • props:
    1. v-model: the output object of the form, can also be used to set initial values in form inputs
    2. fields: an object ({key: value}) to descript the fields in the form.
      1. Each key corresponds to a definition of an input. the key is then used in output (v-model) to represent the value
      2. Each value object requires to have a type, you can set other properties of the input based on its type, currently these types are available: row, col, input, group, component
    3. options: some options to control vuetify-formjson and its components behaviour

Here is a list of all availabel components to render (inputs, groups or custom components): | Component | Type | Sample Object | | ---: | :---: | :--- | | Text field | input | { type: 'input', input: 'text', label: 'Label', class: 'extra classes', props: { ...pass to v-text-field }}| | Color | input | { type: 'input', input: 'color', label: 'Label', class: 'extra classes', props: { ...pass to v-text-field }, pickerProps: { ...pass to v-color-picker } } | | Select | input |{ type: 'input', input: 'select', label: 'Label', class: 'extra classes', objects: [ { id: 1, title: 'Option 1' }, { id: 2, title: 'Option 2' } ] props: { ...pass to v-select } } |

TODO: add all components

Developers

Project setup

npm install

Compiles and hot-reloads for development

npm run dev

Compiles and minifies for production

npm run build:prod

Lints and fixes files

npm run lint