'use strict';

const BaseField = require('./BaseField-f50bb8f0.js');

class NestedField extends BaseField.BaseField {
  constructor(id, field) {
    super(id, 'nested');
    this.title = field.title;
    this.nestedField = field;
  }
  getWrapperId() {
    return this.id.split('.')[0];
  }
  getWrappedId() {
    return this.id.split('.')[1];
  }
  getWrappedValue(dataWrapper) {
    let data = dataWrapper;
    this.id.split('.').forEach(key => {
      if (!data) {
        return;
      }
      data = data[key];
    });
    return data;
  }
  showPreview() {
    this.preview = true;
    return this;
  }
  getDisplayValue(value) {
    return value;
  }
}
NestedField.type = 'nested';

exports.NestedField = NestedField;
