4.0.3 • Published 2 days ago

@manojadams/metaforms-core v4.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
2 days ago

metaform-core

A framework for building react form libraries. Create your react form components and use this framework for adding form behavior using JSON-based schema.

Change logs

Introduction

This library reads the JSON-based schema and lays out beautiful forms. It acts as a base for creating a dynamic form library.

Main features

  • Layouting configuration
  • Support for multiple-page forms
  • Support for field dependencies
  • Support custom components

Core components/concepts

  • Form control (BaseFormControl)
  • Form group (BaseFormGroup)
  • Form stepper (BaseFormStepper)

Form control (BaseFormControl)

This is a class containing declarations of basic form controls as well as some other advanced form controls.

Form group (BaseFormGroup)

Contains declarations of basic form grouping controls.

Form stepper (BasicFormStepper)

This is another type of form grouping that contains declarations to implement stepper functionalities for your form.

How to use

This library contains abstract declarations and requires the user to implement his own core components.

  • BasicFormControl - for basic components
  • BasicFormGroup - for basic form grouping
  • BasicFormStepper = for stepper functionalities
  • Write your classes (typescript) and extend the above controls.
  • To know details, check the documentation.

Implement an email control

class MyFormControl extends CoreFormControl {
  /**
   * Implement email
   */
  email() {
    return (
      <div className="form-group">
        <label forName="exampleInputEmail1">Email address</label>
        <input
          type="email"
          className="form-control"
          id="exampleInputEmail1"
          aria-describedby="emailHelp"
          placeholder="Enter email"
          onChange={this.handleChange}
        >
      </div>
    )
  }
}

Implement a phone control

class MyFormControl extends CoreFormControl {
  /**
   * Implement phone
   */
  phone() {
    return (
      <div className="form-group">
        <label forName="phone">Your Phone</label>
        <input
          type="tel"
          className="form-control"
          id="phone" aria-describedby="phoneHelp"
          placeholder="Enter your phone"
          onChange={this.handleChange}
        >
      </div>
    )
  }
}

Install

npm install --save @manojadams/metaform-core

Basic usage of the library

import MetaformRenderer from "@manojadams/metaforms-core";
import React from "react";
import FormControl from "./forms/FormControl";      // your form control implementation
import FormGroup from "./forms/FormGroup";          // your form group implementation
import { FormStepper } from "./forms/FormStepper";  // your form stepper implementation

class FormRenderer extends React.Component {

  constructor(props: IFormRenderer) {
    super(props);
  }

  render() {
    return (
      <MetaformRenderer 
        {...this.props} 
        baseFormControl={FormControl}
        baseFormGroup={FormGroup}
        baseFormStepper={FormStepper}
      />
    )
  }
}

export default FormRenderer;

License

MIT © manojadams

4.0.3

2 days ago

4.0.2

30 days ago

4.0.1

1 month ago

4.0.0-rc.1

1 month ago

4.0.0-rc.0

2 months ago

3.0.44

2 months ago

3.0.43

3 months ago

3.0.41

3 months ago

3.0.42

3 months ago

3.0.40

3 months ago

3.0.39

3 months ago

3.0.38

3 months ago

3.0.36

3 months ago

3.0.37

3 months ago

3.0.35

4 months ago

3.0.34

4 months ago

3.0.12

9 months ago

3.0.4

10 months ago

3.0.13

9 months ago

3.0.3

10 months ago

3.0.10

9 months ago

3.0.2

10 months ago

3.0.11

9 months ago

3.0.1

10 months ago

3.0.16

9 months ago

3.0.8

10 months ago

3.0.7

10 months ago

3.0.14

9 months ago

3.0.6

10 months ago

3.0.15

9 months ago

3.0.5

10 months ago

3.0.0

10 months ago

3.0.23

8 months ago

3.0.24

8 months ago

3.0.21

8 months ago

3.0.22

8 months ago

3.0.27

8 months ago

3.0.28

8 months ago

3.0.25

8 months ago

3.0.26

8 months ago

3.0.20

8 months ago

3.0.18

9 months ago

3.0.19

8 months ago

3.0.9

9 months ago

3.0.32

8 months ago

3.0.33

7 months ago

3.0.30

8 months ago

3.0.31

8 months ago

2.0.17

10 months ago

3.0.29

8 months ago

2.0.15

11 months ago

2.0.16

11 months ago

2.0.13

11 months ago

2.0.14

11 months ago

2.0.5

1 year ago

2.0.4

1 year ago

2.0.11

1 year ago

2.0.7

1 year ago

2.0.12

1 year ago

2.0.6

1 year ago

2.0.9

1 year ago

2.0.10

1 year ago

2.0.8

1 year ago

2.0.3

1 year ago

2.0.2

1 year ago

2.0.1

1 year ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago