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

schema2form

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

schema2form

schema2form transform schema to form

  • 0.0.1
  • npm
  • Socket score

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

schema2form

快速上手

依赖于 react 和 antd 以及。

安装
使用

组件

介绍组件属性

Schema

自己定义的一套 schema 标准,用于描述 from 表单,非 json-schema 标准。 一个简单的例子如下:

{ 
    fields: [
        {
            type: "Input",
            label: "姓名",
            model: "name",
            initialValue: "",
            props: {
                type: "text"
            }
        },
        {
            type: "InputNumber",
            label: "年龄",
            model: "age",
            initialValue: 18,
            props: {
                
            }
        }
    ]
}

Fields

schema 中的一个 field 定义了一个对应于 modal 值的表单元素。 支持的 fields: 核心 fields:

  • Input
  • InputNumber
  • Select
  • Switch
  • Checkbox
  • CheckboxGroup
  • RadioGroup
  • TimePicker
  • DatePicker
  • RangePicker
  • Upload 自定义 fields:
  • UploadImg
  • BizTypeSelect
field 属性

field 的属性分为 field 通用属性和各种 field 特有属性。

field 通用属性
不同 type 的 field 的特有属性

见下文中各个 field 的文档。

对嵌套对象的支持
{ 
    fields: [
        {
            type: "Input",
            model: "user.name",
            label: "姓名",
        },
        {
            type: "InputNumber",
            model: "user.age"
            label: "年龄",
        }
    ]
}
对动态表单的支持
动态的显示和隐藏表单

dependsOn

动态地增加和删除表单 (数组的情况)

数组的动态增减

对表单初始值的支持(编辑表单的情况)
核心 fields
Input

介绍

特有属性

schema 示例

InputNumber
Select
Switch
Checkbox
CheckboxGroup
RadioGroup
TimePicker
DatePicker
RangePicker
Upload
自定义 fields
UploadImg
BizTypeSelect

Keywords

FAQs

Package last updated on 04 Jul 2017

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