0.2.3 • Published 8 years ago

protoncms-formlib v0.2.3

Weekly downloads
53
License
Copyright Sebasti...
Repository
github
Last release
8 years ago

This registers form widgets with the component registry. Allows auto form generation and lookup of input widgets.

How to use:

var IAutoFormWidget = require('protoncms-core').interfaces.IAutoFormWidget;

var FormWidget = registry.getAdapter(context, IAutoFormWidget).ReactComponent;

var CustomInputWidget = require('protoncms-formlib').CustomInputWidget;

var context = [the object to render];

<FormWidget 
    name="context"                      // The form name
    context={context}                   // The object to render 
    onChange={this.didUpdate}           // didUpdate: funciton (name, context) -- name is the name you gave this form, context the updated value you passed
    formSchema={context._implements[0].schema} 
    
    onlyFields={['property', ...]}      // Optional, if you only want to render specific fields
    excludeFields={['property', ...]}   // Optional, if you want to exclude specific fields from rendering
    >
    
    // To customize form input fields use one CustomInputWidget for each property you want to customize
    <CustomInputWidget property="theProperty"       // Use custom widget for this property
                       widget={CustomWidget}        // This is the widget to be used
                       onChange={this.didUpdate}    // Function to call on changes
                       options={{...}} />           // Options to pass to the custom widget
    
</FormWidget>

Building the package

Just run:

$ npm install
$ npm run build 
0.2.3

8 years ago

0.2.2

8 years ago

0.2.1

8 years ago

0.2.0

8 years ago

0.1.8

8 years ago

0.1.7

8 years ago

0.1.6

9 years ago

0.1.5

9 years ago

0.1.4

9 years ago

0.1.3

9 years ago

0.1.2

9 years ago

0.1.1

9 years ago

0.1.0

9 years ago