import _Object$assign from "@babel/runtime-corejs2/core-js/object/assign";
import _objectWithoutPropertiesLoose from "@babel/runtime-corejs2/helpers/objectWithoutPropertiesLoose";
import Intact from 'intact-angular';
import FormItem from './formItem';
var h = Intact.Vdt.miss.h;

function Wrapper(props) {
  var key = props.key,
      _context = props._context,
      model = props.model,
      rest = _objectWithoutPropertiesLoose(props, ["key", "_context", "model"]);

  if (!key && model) {
    key = "$fi." + model;
  }

  return h(FormItem, _Object$assign({
    key: key,
    model: model,
    _context: _context
  }, model ? {
    'ev-$change:value': function ev$changeValue(c, v) {
      _context.data.set(model, v, {
        async: false
      });
    },
    value: _context.data.get(model)
  } : {}, rest));
}

Wrapper.blocks = FormItem.blocks;
export default Intact.functionalWrapper ? Intact.functionalWrapper(Wrapper) : Wrapper;