form-awesome-antd
v0.1.4
Published
- Fast building form with file config
Downloads
4
Readme
Form-awesome
✨ Feature
- Fast building form with file config
🖥 Environment Support
- Modern browsers and Internet Explorer 9+
- Server-side Rendering
- [Electron](http://electron.atom.io/)
📦 Install
🔨 Usage
Config File
import {Input} from "antd";
import { inputFieldsType} from "../formEngine";
export const inputFields : inputFieldsType = [
{
size: 12,
key: 'name',
Element: Input,
propsElement: {},
fieldDecorator: {
rules: [
{
required: true,
message: 'Must fill this field'
}
]
}
},
{
size: 12,
key: 'userName',
Element: Input,
propsElement: {},
fieldDecorator: {}
}
];
Code
<FormEngine
formName={formName}
inputFields={inputFields}
dataSource={info}
onFieldChangeFunc={(listFieldChanged) =>
listFieldChanged.forEach((temp) => {
setInfo({
...info,
[temp.key]: temp.value
});
})}
onSubmit={(data: Object) => console.error(data)}
wrappedComponentRef={formRef}
/>