conform-ts
v0.0.13
Published
Support config file for build form component of antdesign
Downloads
7
Maintainers
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}
/>