'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

const index = require('./index-1141a245.js');

const dvnFieldDisplayCellRelationReferenceCss = ".sc-dvn-field-display-cell-relation-reference-h{display:-ms-flexbox;display:flex;overflow:auto}";

const DvnFieldDisplayCellRelationReference = class {
  constructor(hostRef) {
    index.registerInstance(this, hostRef);
  }
  render() {
    const { field } = this;
    const value = this.value || [];
    return (index.h(index.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 (index.h("abbr", { title: data[field.titleField] }, index.h("dvn-image", { bordered: true, leanedVertically: true, src: imageSrc, text: initialLetters })));
    })));
  }
};
DvnFieldDisplayCellRelationReference.style = dvnFieldDisplayCellRelationReferenceCss;

exports.dvn_field_display_cell_relation_reference = DvnFieldDisplayCellRelationReference;
