import { h } from './index-102043e0.js';
import { r as registerField } from './index-336ef773.js';
import { B as BaseField } from './BaseField-461b6d0c.js';

class NumberField extends BaseField {
  constructor(id, title, placeholder, description, step = 1, min = -Infinity, max = Infinity) {
    super(id, 'number');
    this.title = title;
    this.placeholder = placeholder;
    this.description = description;
    this.step = step;
    this.min = min;
    this.max = max;
  }
  showPreview() {
    this.preview = true;
    return this;
  }
  getDisplayValue(value) {
    return value;
  }
}
NumberField.type = 'number';

// component generator
const render$3 = (field, value, errors, disabled, onFieldChange, onFieldBlur) => h("dvn-field-input-number", { disabled: disabled, field: field, errors: errors, onChange: (e) => onFieldChange(field, Number(e.detail)), onBlur: () => onFieldBlur(field), value: value });
// register 'number' field for json form generations
registerField('number', render$3);

class RangeField extends BaseField {
  constructor(id, title, description, step = 1, min = 0, max = 5) {
    super(id, 'range');
    this.title = title;
    this.description = description;
    this.step = step;
    this.min = min;
    this.max = max;
  }
  showPreview() {
    this.preview = true;
    return this;
  }
  getDisplayValue(value) {
    return value;
  }
  setInputType(inputType) {
    this.inputType = inputType;
    return this;
  }
}
RangeField.type = 'range';

// component generator
const render$2 = (field, value, errors, disabled, onFieldChange, onFieldBlur) => h("dvn-field-input-range", { disabled: disabled, field: field, errors: errors, onChange: (e) => onFieldChange(field, Number(e.detail)), onBlur: () => onFieldBlur(field), value: value });
// register 'range' field for json form generations
registerField('range', render$2);

class SectionHeaderField extends BaseField {
  constructor(id, header, sectionDescription) {
    super(id, 'sectionHeader');
    this.id = id;
    this.header = header;
    this.sectionDescription = sectionDescription;
  }
}
SectionHeaderField.type = 'sectionHeader';

const render$1 = (field, 
// @ts-ignore
value, 
// @ts-ignore
errors, disabled, onFieldChange, onFieldBlur) => h("dvn-field-input-section-header", { disabled: disabled, field: field, onChange: (v) => onFieldChange(field, v), onBlur: () => onFieldBlur(field) });
// register 'sectionHeader' key for json form generations
registerField('sectionHeader', render$1);

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.value = {};
  }
}
SubFormField.type = 'subForm';

const render = (field, value, errors, disabled, onFieldChange, onFieldBlur) => h("dlm-input-sub-form", { disabled: disabled, errors: errors, field: field, onChange: (v) => onFieldChange(field, v), onBlur: () => onFieldBlur(field), value: value });
// register 'subForm' key for json form generations
registerField('subForm', render);

export { NumberField as N, RangeField as R, SubFormField as S, SectionHeaderField as a };
