Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ng-vcl/jss-form

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ng-vcl/jss-form

Creates a html-form from a jsonschema

  • 0.2.8
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

vcl-jss-form

Creates a html-form from a jsonschema.

Installation

npm install @ng-vcl/jss-form --save

Usage:

import { VCLJssFormModule } from 'ng-vcl';

@NgModule({
  imports: [ VCLJssFormModule ],
  ...
})
export class AppComponent {}
<vcl-jss-form [schema]="mySchema" [(value)]="value"></vcl-jss-form>

example-schema:

{
    "title": "hero schema",
    "description": "describes a simple hero",
    "type": "object",
    "properties": {
      "name": {
        "type": "string",
        "formType": "text",
        "placeholder": "The heroe's name",
        "minLength": 4,
        "maxLength": 100,
      },
      "color": {
        "description": "color defines which team the hero belongs to",
        "label": "team",
        "formType": "select",
        "type": "string",
        "enum": ["#ff0000", "#008000", "#0000FF", "#FFFF00"],
        "items": [
          {
            "label": "Red",
            "value": "#ff0000"
          },
          {
            "label": "Green",
            "value": "#008000"
          },
          {
            "label": "Blue",
            "value": "#0000FF"
          },
          {
            "label": "Yellow",
            "value": "#FFFF00"
          }
        ]
      },
      "color2": {
        "label": "subcolor",
        "formType": "radio",
        "type": "string",
        "enum": ["red", "green", "blue", "yellow"]
      },
      "isleader": {
        "label": "leader",
        "formType": "checkbox",
        "type": "boolean"
      },
      "hp": {
        "type": "number",
        "formType": "slider"
      },
      "alive": {
        "type": "boolean",
        "formType": "switch"
      },
      "mainSkill": {
        "description": "nested object",
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "formType": "text",
            "minLength": 1
          },
          "damage": {
            "type": "number",
            "formType": "number",
            "min": 0,
            "max": 100
          }
        },
        "required": ["name", "damage"]
      }
    },
    "required": ["name", "color"]
  };

API

vcl-jss-form properties:
NameTypeDefaultDescription
schemaobjecta jsonschema to build the form from
valueobject{}An Object to begin editing with (2-way binding)
erroreventEvent-stream which emits schema-errors or null
schema properties

In addition to the generic keywords of jsonschema, vcl-jss-form is using keywords to let you define the generated form.

NameTypeDefaultDescription
labelstringa label-string. attributeName will be the default
placeholderstringdefine a placeholder which will be sued for the input-field
formTypestringdefines the input-type of the form-element. ENUM(text, number, select, switch, slider)
formTypes:
NameTypeValueType
textstringstring
selectstringstring of enum
radiostringstring of enum
checkboxstringboolean
switchstringboolean
numberstringnumber
sliderstringnumber

FAQs

Package last updated on 14 Mar 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc