import { NestedField } from '@dvn/core/doldurma/src/fields/nested/nested';
import { Component, Element, h, Host, Prop } from '@stencil/core';
export class DvnFieldInputCell {
  constructor() {
    this.getTag = () => {
      const { field } = this;
      let Tag = `dvn-field-input-cell-${field.type}`;
      let fieldToPass = field;
      if (field.type === NestedField.type) {
        Tag = `dvn-field-input-cell-${field.nestedField.type}`;
        fieldToPass = field.nestedField;
      }
      return {
        Tag, fieldToPass
      };
    };
  }
  componentDidLoad() {
    var _a, _b;
    const { Tag } = this.getTag();
    (_b = (_a = this.el.querySelector(Tag)) === null || _a === void 0 ? void 0 : _a.focus) === null || _b === void 0 ? void 0 : _b.call(_a);
  }
  render() {
    const { value } = this;
    const { Tag, fieldToPass } = this.getTag();
    return (h(Host, null,
      h(Tag, { field: fieldToPass, value: value })));
  }
  static get is() { return "dvn-field-input-cell"; }
  static get originalStyleUrls() { return {
    "$": ["dvn-field-input-cell.scss"]
  }; }
  static get styleUrls() { return {
    "$": ["dvn-field-input-cell.css"]
  }; }
  static get properties() { return {
    "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
    }
  }; }
  static get elementRef() { return "el"; }
}
