import { withHooks } from "@saasquatch/stencil-hooks";
import { Component, h, Host, Method, Prop } from "@stencil/core";
import { useRequestRerender } from "../../../tables/re-render";
/**
 * @uiName Invoice Table Data Column
 * @validParents ["sqm-invoice-table"]
 */
export class InvoiceTableDataColumn {
  constructor() {
    withHooks(this);
  }
  disconnectedCallback() { }
  async renderCell(data) {
    return (h("sqm-invoice-table-data-cell", { data: data[this.property] }));
  }
  async renderLabel() {
    return Promise.resolve(this.columnTitle);
  }
  render() {
    useRequestRerender([this.columnTitle, this.property]);
    return (h(Host, { style: { display: "none" } },
      h("slot", null)));
  }
  static get is() { return "sqm-invoice-table-data-column"; }
  static get encapsulation() { return "shadow"; }
  static get properties() { return {
    "columnTitle": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Column title",
            "name": "uiName"
          }],
        "text": ""
      },
      "attribute": "column-title",
      "reflect": false
    },
    "property": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Property name",
            "name": "uiName"
          }],
        "text": ""
      },
      "attribute": "property",
      "reflect": false
    }
  }; }
  static get methods() { return {
    "renderCell": {
      "complexType": {
        "signature": "(data: Invoice) => Promise<any>",
        "parameters": [{
            "tags": [],
            "text": ""
          }],
        "references": {
          "Promise": {
            "location": "global"
          },
          "Invoice": {
            "location": "import",
            "path": "../../../saasquatch"
          }
        },
        "return": "Promise<any>"
      },
      "docs": {
        "text": "",
        "tags": []
      }
    },
    "renderLabel": {
      "complexType": {
        "signature": "() => Promise<string>",
        "parameters": [],
        "references": {
          "Promise": {
            "location": "global"
          }
        },
        "return": "Promise<string>"
      },
      "docs": {
        "text": "",
        "tags": []
      }
    }
  }; }
}
