import { h } from './index-b7735e0d.js';
import { r as registerField } from './index-403101cb.js';
import { B as BaseField } from './BaseField-461b6d0c.js';

class SubFormField extends 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) => 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
registerField('subForm', render);

export { SubFormField as S };
