@uform/react-schema-editor
TypeScript icon, indicating that this package has built-in type declarations

1.0.5 • Public • Published

react-schema-editor

react-schema-editor is a UI tool for build form schema.

Usage

npm install @formily/react-schema-editor -S

Demo

import React from 'react'
import { SchemaEditor } from './src'

function SchemaEditorDemo() {
  const [schema, setSchema] = React.useState({
  title: '动态表单示例',
  type: 'object',
  "properties": {
    "username": {
      "title": "用户名",
      "type": "string",
      "x-component-props": {
        "placeholder": "请输入用户名",
        "onChange": "function(value) \n{console.log('input onChange', value, this.field, this.field.getValue('note'))"
      }
    },
    "password": {
      "title": "密码",
      "type": "string",
      "x-component": "Input",
      "x-component-props": {
        "htmlType": "password",
        "placeholder": "请输入密码"
      } 
    },
    "note": {
      "title": "备注",
      "type": "string",
      "x-component": "TextArea",
      "x-component-props": {
        "placeholder": "something"
      } 
    },
    "agreement": {
      "title": "同意",
      "type": "string",
      "x-component": "Checkbox",
      "x-component-props": {
        "disabled": "{{!this.field.getValue('username')}}",
        "defaultChecked": true
      }
    }
  }
})

  return <SchemaEditor schema={schema} onChange={setSchema} />
}

ReactDOM.render(<SchemaEditorDemo />, document.getElementById('root'))

/@uform/react-schema-editor/

    Package Sidebar

    Install

    npm i @uform/react-schema-editor

    Weekly Downloads

    0

    Version

    1.0.5

    License

    MIT

    Unpacked Size

    3.9 kB

    Total Files

    8

    Last publish

    Collaborators

    • ayx19930701
    • cnt1992
    • janrywang
    • monkindey