import { Component, h, Host, Prop } from '@stencil/core';
export class DvnFieldDisplayMultipleChoice {
  constructor() {
    this.value = [];
  }
  render() {
    const { meta, value } = this;
    const placeholderListElementCount = ((meta === null || meta === void 0 ? void 0 : meta.lines) || 0) - this.value.length;
    if (this.field.inputType === 'tag-cloud') {
      let itemsToShow = [...value];
      if (meta.maxItems && value.length - meta.maxItems >= 1) {
        itemsToShow = itemsToShow.slice(0, meta.maxItems - 1);
      }
      return (h(Host, { style: { height: this.fixHeight ? `${(this.field.options || []).length * 20}px` : undefined } },
        itemsToShow.map(v => (h("dvn-button", { leaned: true, scale: "small", shape: "rounded", view: "outline", tagMode: true }, this.field.getOptionOfValue(v).label))),
        value.length > itemsToShow.length &&
          h("dvn-button", { leaned: true, scale: "small", shape: "rounded", view: "outline", tagMode: true },
            "+",
            value.length - itemsToShow.length),
        this.value.length === 0 && '-'));
    }
    return (h(Host, { style: { height: this.fixHeight ? `${(this.field.options || []).length * 20}px` : undefined } },
      h("ul", null,
        this.value.map(v => (h("li", null, this.field.getOptionOfValue(v).label))),
        this.value.length === 0 && '-',
        placeholderListElementCount > 0 && new Array(placeholderListElementCount).fill(0).map(() => (h("li", null))))));
  }
  static get is() { return "dvn-field-display-multiple-choice"; }
  static get encapsulation() { return "scoped"; }
  static get originalStyleUrls() { return {
    "$": ["dvn-field-display-multiple-choice.css"]
  }; }
  static get styleUrls() { return {
    "$": ["dvn-field-display-multiple-choice.css"]
  }; }
  static get properties() { return {
    "value": {
      "type": "unknown",
      "mutable": false,
      "complexType": {
        "original": "any[]",
        "resolved": "any[]",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      },
      "defaultValue": "[]"
    },
    "field": {
      "type": "unknown",
      "mutable": false,
      "complexType": {
        "original": "MultipleChoiceField",
        "resolved": "MultipleChoiceField",
        "references": {
          "MultipleChoiceField": {
            "location": "import",
            "path": "../multiple-choice-field"
          }
        }
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      }
    },
    "fixHeight": {
      "type": "boolean",
      "mutable": false,
      "complexType": {
        "original": "boolean",
        "resolved": "boolean",
        "references": {}
      },
      "required": false,
      "optional": true,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "fix-height",
      "reflect": false
    },
    "meta": {
      "type": "any",
      "mutable": false,
      "complexType": {
        "original": "any",
        "resolved": "any",
        "references": {}
      },
      "required": false,
      "optional": true,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "meta",
      "reflect": false
    }
  }; }
}
