'use strict';

const index$1 = require('./index-ce58ddc5.js');
const index = require('./index-7e3bc620.js');
const BaseField = require('./BaseField-d019ade6.js');

class SubFormField extends BaseField.BaseField {
  constructor(id, title, fields, description, 
  // TODO
  layout, showFieldOrder, language) {
    super(id, 'subForm');
    this.id = id;
    this.title = title;
    this.description = description;
    this.fields = fields;
    this.language = language;
    this.layout = layout;
    this.showFieldOrder = showFieldOrder;
    this.maxCount = 1;
    this.minCount = 1;
    this.separated = true;
    this.value = undefined;
  }
  setMaxCount(maxCount) {
    this.maxCount = maxCount;
    return this;
  }
  setMinCount(minCount) {
    this.minCount = minCount;
    return this;
  }
  setSeparated(separated) {
    this.separated = separated;
    return this;
  }
}
SubFormField.type = 'subForm';

const render = (field, value, errors, disabled, onFieldChange, onFieldBlur) => index$1.h("dvn-field-input-sub-form", { disabled: disabled, errors: errors, field: field, onChange: (e) => {
    e.stopImmediatePropagation();
    onFieldChange(field, e.detail);
  }, onBlur: () => onFieldBlur(field), value: value });
// register 'subForm' key for json form generations
index.registerField('subForm', render);

exports.SubFormField = SubFormField;
