Giter VIP home page Giter VIP logo

dt-form-renderer's Introduction

dt-form-renderer

  • 一个基于 React 和 Ant-Design 的表单渲染器
  • 使用 JSON 描述表单
  • 支持复杂的联动逻辑

文档


使用

组件

import React, { useRef } from 'react';
import FormRenderer from 'dt-form-renderer';
import jsonConfig from './jsonConfig';

function FormDemo () {

    const formRef = useRef();

    return (
        <FormRenderer
            ref={formRef}
            onValuesChange={(...args) => console.log(args)}
            initialValues={{}}
            jsonConfig={}
            defaultExtraData={{}}
        />
    )
}

表单配置

const jsonConfig = {
    description: '这是一份表单配置',
    fieldList: [
        {
            fieldName: 'schema',
            label: 'schema',
            widget: 'Select',
            widgetProps: {
                placeholder: '请选择schema',
                options: [],
                allowClear: true,
            },
        },
        {
            fieldName: 'tableName',
            label: '表名',
            dependencies: ['schema'],
            widget: 'Select',
            widgetProps: {
                options: [],
                placeholder: '请选择表名',
            },
            rules: [
                {
                    required: true,
                    message: '请选择表名!',
                },
            ],
        },
    ],
};

export default jsonConfig;

在线编辑

PlayGround

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.