npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-dynamic-form-maker

v1.0.2

Published

dynamic-form for react

Downloads

4

Readme

react-dynamic-form-maker

🌇react-dynamic-form-maker 基于 antd 高性能 Form 组件的动态表单方案

功能

  • 📦 JSON 化创建表单
  • 📱 支持所有的数据录入表单,如 Button、DatePicker 等等
  • 💪 增加 TextArea 组件自定义标题功能
  • 🧳 默认内置 sumit 和 reset 组件

📦 安装

npm i react-dynamic-form-maker

🔨 使用

import ReactFormMaker from 'react-dynamic-form-maker'
const config={...}
<ReactFormMaker {...config}/>

config 接口

interface ReactFormMakerOptions {
  form: FormProps
  fields: FormField[]
  submit: FormSubmit
  reset: FormRest
}

const config = {
  form: {
    labelCol: {
      span: 8
    },
    wrapperCol: {
      span: 12
    },
    initialValues: {
      name: 'vnues',
      reason: '这就是原因',
      amount: 3000,
      platform: ''
      // rate: 3.5,
    },
    form
  },
  fields: [
    {
      formItem: {
        name: 'name',
        // label 标签的文本	ReactNode
        label: '姓名',
        rules: [
          {
            required: true,
            message: '该项为必填项'
          }
        ]
      },
      field: {
        type: 'input',
        props: {
          placeholder: '请输入用户姓名',
          onChange: onGenderChange
        }
      }
    }
  ],
  // 提交按钮
  submit: {
    text: '提交',
    form,
    props: {
      type: 'primary'
    },
    success() {
      alert(JSON.stringify({}))
    },
    fail() {
      alert('验证失败')
    }
  },
  // 取消或者重置按钮
  reset: {
    text: '重置',
    form,
    props: {
      type: 'primary',
      style: { marginLeft: 20 }
    },
    callBack() {
      // 关闭弹框等操作
    }
  }
}

API

API文档antd保持一致,JSON数据结构为以下三种配置

  • Form
  • Form.Item
  • 组件的props

TODO

  • [ ] 增加自定义表单组件,百分百实现Form组件功能

社区