Skip to content

一个利用Javascript语言实现的动态表单定义语言

License

Notifications You must be signed in to change notification settings

colin-han/sisyphus.hall

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

sisyphus.hall

A Dynamic Form Definition Language in Javascript

一个利用Javascript语言实现的动态表单定义语言

Usage (用法)

import { generator, types as t } from 'sisyphus.hall';
import _ from 'lodash';

const Form = generator("Form1", [
    ['properties', [
        ['text', t.text().placeholder('please input text')],
        [t.separator()],
        ['isColorful', t.toggle()],
        [t._if('isColorful')
            .then([
                ['color', t.color().defaultValue('#F00')],
            ])
        ],
    ]
]);

React.render(<Form />, document.getElementById('root'));

The code above can generate a form like the one below

可以生成一个类似于下图的表单

snapshot

About

一个利用Javascript语言实现的动态表单定义语言

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published