'use strict';

const BaseField = require('./BaseField-d019ade6.js');
const index$1 = require('./index-36b3af04.js');
const index = require('./index-a8f1783c.js');
require('./date-25b104f6.js');

class ReferenceField extends BaseField.BaseField {
  constructor(id, title, titleField, imageField, otherCollection, fields, isSingle = false) {
    super(id, 'reference');
    this.title = title;
    this.titleField = titleField;
    this.imageField = imageField;
    this.otherCollection = otherCollection;
    this.fields = fields;
    this.isSingle = isSingle;
  }
  static decode(json) {
    return Object.assign(Object.create(ReferenceField.prototype), json);
  }
  showPreview() {
    this.preview = true;
    return this;
  }
  getDisplayValue(value) {
    return value;
  }
}
ReferenceField.type = 'reference';

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

exports.ReferenceField = ReferenceField;
