Git Product home page Git Product logo

vfg-field-object's Introduction

vfg-field-object

Rollup badge Jest Vue Storybook Commitizen semantic-release Npm badge Build Status

A vue-form-generator field to handle objects, with or without schemas.

Examples

Without schema

Without schema

{
  model: {
    object: {
      field1: "value1"
    }
  },
  schema: {
    fields: [
      {
        type: "object",
        label: "Object field",
        model: "object"
      }
    ]
  }
}

With schema

With schema

{
  model: {
    object: {
      field: "value1"
    }
  },
  schema: {
    fields: [
      {
        type: "object",
        label: "Object field",
        model: "object",
        schema: {
          fields: [
            {
              type: "input",
              inputType: "number",
              label: "Label",
              model: "number"
            },
            {
              type: "input",
              inputType: "text",
              label: "Field",
              model: "field"
            }
          ]
        }
      }
    ]
  }
}

Installation

npm install vfg-field-object

vfg-field-object can be used as a module in both CommonJS and ES modular environments.

When in non-modular environment, vfg-field-object will register all the components to vue by itself.

ES6

//
// You can register a component manually
//
import { FieldObject } from 'vfg-field-object';

export default {
  ...
  components: {
    'field-object': FieldObject
  },
  ...
};

//
// or register the whole module with vue
//
import ModuleLibrary from 'vfg-field-object';

// Install this library
Vue.use(ModuleLibrary);

CommonJS

//
// You can register a component manually
//
var Vue = require('vue');
var ModuleLibrary = require('vfg-field-object');

var YourComponent = Vue.extend({
  ...
  components: {
    'field-object': ModuleLibrary.FieldObject
  },
  ...
});

//
// or register the whole module with vue
//
var Vue = require('vue');
var ModuleLibrary = require('vfg-field-object');

// Install this library
Vue.use(ModuleLibrary);

Browser

<script src="path/to/vue/vue.min.js"></script>
<script src="path/to/vfg-field-object/dist/vfg-field-object.min.js"></script>
<!-- Components are registered globally -->

After that, you can use it with Vue Form Generator:

  schema: {
    fields: [
      {
        type: "object",
        label: "My object",
        model: "myObject"
      }
    ]
  }

Changelog

See the GitHub release history.

Contributing

See CONTRIBUTING.md.

Generated using vue-cli-template-library.

vfg-field-object's People

Contributors

gwenaelp avatar iurquiza avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.