import * as tslib_1 from "tslib";
import React from 'react';
import { Form, Input, Select } from 'antd';
var FormComps = {
    input: function (props) { return React.createElement(Input, tslib_1.__assign({}, props)); },
    select: function (props) { return (React.createElement(Select, tslib_1.__assign({}, props), props.options &&
        props.options.map(function (option) { return (React.createElement(Select.Option, { value: option.key, key: option.key }, option.value)); }))); },
};
var FormGroup = function (props) {
    var label = props.label, labelCol = props.labelCol, wrapperCol = props.wrapperCol, form = props.form, fields = props.fields;
    var getFieldDecorator = form.getFieldDecorator;
    return (React.createElement(Form.Item, tslib_1.__assign({}, {
        label: label,
        labelCol: labelCol,
        wrapperCol: wrapperCol,
    }, { className: props.className }),
        React.createElement(Input.Group, { compact: true }, fields.map(function (field) {
            var Comp = FormComps[field.type];
            return getFieldDecorator(field.field, {
                initialValue: field.initialValue,
                rules: field.rules,
                validateFirst: true,
                normalize: function (value) {
                    if (field.valueFilter)
                        return field.valueFilter(value);
                    return value;
                },
            })(React.createElement(Comp, tslib_1.__assign({}, field, { key: field.field })));
        }))));
};
export default FormGroup;
//# sourceMappingURL=index.js.map