New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

form-pro

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

form-pro

Expansion Ant Desgin From Component

  • 0.1.2
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-87.5%
Maintainers
1
Weekly downloads
 
Created
Source

English | 简体中文

FormPro

  • Generate forms with configuration, No need to use import cumbersome form controls.
  • Use the React.lazy API to support loading most of the Ant Design data input components on demand.
  • Flexible design, support for custom, preset form controls.
  • Written in TypeScript with complete defined types.

Live demo

When To Use

Can completely replace Ant Design's Form component, dealing with complex forms, pop-up windows, etc.

How To Use

Installation

We recommend using npm or yarn to install.

$ npm install form-pro --save 
# or
$ yarn add form-pro --save

If you are in a bad network environment, you can try other registries and tools like cnpm.

Usage

import FormPro from 'form-pro'
import 'form-pro/lib/style'  // If the development environment supports Less
// If the development environment does not support Less, please use
// import 'form-pro/lib/style/index.css'

<FormPro
  columns={[
    {
      type: 'Input',
      name: 'name'
    },
    {
      type: 'DatePicker',
      name: 'birthday'
    }
  ]}
/>

Examples

Environment Support

  • React version is greater than 16.6.

API

FormPro

PropertyDescriptionTypeDefault
columnsColumns of tableColumnProps []-
formPropsConsistent with the Ant Design Form configurationFormProps-
onChangeTriggered when the form value changes(allValues, changedValues) => void-
onSubmitTriggered when the submit button is clicked(values) => void-
showSubmitWhether to show the submit buttonbooleantrue
submitTextSubmit button textReact.ReactNodeSubmit
footerBottom of the formReact.ReactNode-
loadingLoading when all form controls are loadedReact.ReactNode-

Column

Form control configuration data object, which is an item in columns, Column uses the same API.

PropertyDescriptionTypeDefault
typeForm control typestring-
renderCustom form controls, when used with the type field, use render first.React.ReactNode-
nameField name within the form fieldstring-
optionsConsistent with the options parameter of getFieldDecorator(id, options)object-
extraPropsAdditional custom parameters for form controls, different control parameters, corresponding to typeobject-
formItemPropsThe parameters of the form control, different control parameters, corresponding to typeobject-
loadingLoading when the current form control loadsReact.ReactNode-

FormPro.create(options)

Use the FormPro.create function to create a new FormPro component. The new FormPro component built in type will be determined by options.

PropertyDescriptionTypeDefault
typeForm control typestring-
componentThe component corresponding to the form controlany-
formItemRenderCustom rendering of FormItem(itemOptions: any, Component: any) => JSX.Element-

Create a FormPro component with a built-in Checkbox type.

const NewFormPro = create([{
    type: 'Checkbox',
    component: React.lazy(() => import('antd/lib/checkbox')),
}])  

...

<NewFormPro columns={[type: 'Checkbox', name: 'checkbox']} />

Document and examples

https://form-pro.now.sh

FAQs

Package last updated on 05 Aug 2019

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