import { NestedField } from '@dvn/core/doldurma/src/fields/nested/nested';
import { Component, h, Host, Prop } from '@stencil/core';
export class DvnFieldDisplayCell {
  constructor() {
    this.showTitle = true;
  }
  render() {
    const { field, infoTitle, showTitle, value } = this;
    let Tag = `dvn-field-display-cell-${field.type}`;
    let fieldToPass = field;
    if (field.type === NestedField.type) {
      Tag = `dvn-field-display-cell-${field.nestedField.type}`;
      fieldToPass = field.nestedField;
    }
    return (h(Host, null,
      showTitle && h("div", { class: "title" }, (infoTitle || '').toUpperCase()),
      Tag
        ? h(Tag, { field: fieldToPass, value: value, meta: this.meta })
        : h("span", null, value)));
  }
  static get is() { return "dvn-field-display-cell"; }
  static get encapsulation() { return "scoped"; }
  static get originalStyleUrls() { return {
    "$": ["dvn-field-display-cell.css"]
  }; }
  static get styleUrls() { return {
    "$": ["dvn-field-display-cell.css"]
  }; }
  static get properties() { return {
    "infoTitle": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "info-title",
      "reflect": false
    },
    "field": {
      "type": "unknown",
      "mutable": false,
      "complexType": {
        "original": "BaseField",
        "resolved": "BaseField",
        "references": {
          "BaseField": {
            "location": "import",
            "path": "@dvn/core/doldurma/src/BaseField"
          }
        }
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      }
    },
    "value": {
      "type": "any",
      "mutable": false,
      "complexType": {
        "original": "any",
        "resolved": "any",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "value",
      "reflect": false
    },
    "showTitle": {
      "type": "boolean",
      "mutable": false,
      "complexType": {
        "original": "boolean",
        "resolved": "boolean",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "show-title",
      "reflect": false,
      "defaultValue": "true"
    },
    "meta": {
      "type": "any",
      "mutable": false,
      "complexType": {
        "original": "any",
        "resolved": "any",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "meta",
      "reflect": false
    }
  }; }
}
