1.2.0 β€’ Published 2 years ago

imcformbuilder v1.2.0

Weekly downloads
-
License
-
Repository
-
Last release
2 years ago

npm npm bundle size npm

Make ant design base styled form with ease. It enable to use form by just adding json files of style and list. Form Builder provides editing function, such as adding, removing items, change look and feels like number of columes, vertical, horizontal title layout etc. It can edit existing form, also create new form from scratch.

DisplayForm Edit

🏠 Homepage

✨ Demo

English | ν•œκΈ€(./README - kr_KR.md)

Install

npm install formbuilder

Usage basic

While you develop, showedit={true} will show you edit button. Upon complete development, change showedit to false to hide button.

<AntFormDisplay
  showedit={true}
  formArray={formArray}
  onFinish={onFinish}
  onValuesChange={onValuesChange}
/>

EventHandler

  1. onFinish: By clicking submit button, onFinish function returns a value as object. With this you can proceed other action, such as save to server or change state. Return data is key value object for example: {collection:"abc",querystring:"123",.....}
  2. onValuesChange: returns two parameters, changedValues, allValues. First value return just changed key value object, last value returns all key value object. e.g. a. changedValues: {collection:"abc"}, b. allValues:{collection:"abc",querystring:undefined.....}
const onFinish = (val) => {
  console.log(val);
};
const onValuesChange = (changedValues, allValues) => {
  console.log(changedValues, allValues);
};

Sample data(formArray)

formArray is composed of two parts:

  1. list: items in the form
  2. setting: look and feel of the form
{
  "list": [
    {
      "label": "Collection",
      "name": "collection",
      "type": "input",
      "seq": 0,
      "placeholder": "database table",
      "rules": [
        {
          "required": false
        }
      ],
      "requiredmsg": "you must insert"
    },
    {
      "label": "QueryString",
      "name": "querystring",
      "type": "input",
      "seq": 1,
      "placeholder": "pid=xxxx or _id=yyyy",
      "msgright": "라이트 λ©”μ‹œμ§€"
    },
    {
      "label": "Submit",
      "name": "",
      "type": "button",
      "seq": 7,
      "action": "submit",
      "btnStyle": "primary",
      "btnColor": "primary",
      "align": "right"
    }
  ],
 "setting": {
    "editable": false,
    "name": "antform",
    "layout": "horizontal",
    "formColumn": 1,
    "formItemLayout": {
      "labelCol": {
        "span": 4
      },
      "wrapperCol": {
        "span": 20
      }
    },
    "tailLayout": {},
    "initial": {},
    "size": "middle",
    "onFinish": "{values => {console.log(values);};}",
    "initialValues": {}
  },
 }

Edit Form

If you provide pros as showedit={true} and click edit button, it redirect edit page.

FormEdit

Author

πŸ‘€ Youngki Nam

Show your support

Give a ⭐️ if this project helped you!


This README was generated with ❀️ by readme-md-generator

1.2.0

2 years ago

1.1.9

2 years ago

1.1.8

3 years ago

1.1.7

3 years ago

1.1.6

3 years ago

1.1.5

3 years ago

1.1.62

3 years ago

1.1.61

3 years ago

1.1.4

3 years ago

1.1.3

3 years ago

1.1.1

3 years ago

1.1.2

3 years ago

1.1.0

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.1

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

0.2.1

3 years ago

0.1.20

3 years ago

0.1.15

3 years ago

0.1.16

3 years ago

0.1.17

3 years ago

0.1.18

3 years ago

0.1.19

3 years ago

0.1.14

3 years ago

0.1.13

3 years ago

0.1.12

3 years ago

0.1.11

3 years ago

0.1.10

3 years ago

0.1.9

3 years ago

0.1.8

3 years ago

0.1.7

3 years ago

0.1.6

3 years ago

0.1.5

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago