import { Component, h, Host, Prop } from '@stencil/core';
export class DvnFieldDisplayRelationReference {
  render() {
    const { field } = this;
    const value = this.value || [];
    return (h(Host, null, value.map(relation => {
      var _a;
      const data = relation[field.nameOfOtherCollectionInRelationCollection];
      const imageSrc = field.imageField ? data[field.imageField] : undefined;
      const initialLetters = field.titleField
        ? (_a = data[field.titleField]) === null || _a === void 0 ? void 0 : _a.split(' ').map(word => word[0]).join('')
        : undefined;
      return (h("abbr", { title: data[field.titleField] },
        h("dvn-image", { bordered: true, leanedVertically: true, src: imageSrc, text: initialLetters })));
    })));
  }
  static get is() { return "dvn-field-display-relation-reference"; }
  static get encapsulation() { return "scoped"; }
  static get originalStyleUrls() { return {
    "$": ["dvn-field-display-relation-reference.scss"]
  }; }
  static get styleUrls() { return {
    "$": ["dvn-field-display-relation-reference.css"]
  }; }
  static get properties() { return {
    "value": {
      "type": "unknown",
      "mutable": false,
      "complexType": {
        "original": "any[]",
        "resolved": "any[]",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      }
    },
    "field": {
      "type": "unknown",
      "mutable": false,
      "complexType": {
        "original": "RelationReferenceField",
        "resolved": "RelationReferenceField",
        "references": {
          "RelationReferenceField": {
            "location": "import",
            "path": "../relation-reference-field"
          }
        }
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      }
    }
  }; }
}
