import { h } from "@stencil/core";
import { TableClasses } from '../table.utils';
export class RenderRow {
    constructor() {
        /**
         * Renderer to use for cell content when the selected cell conditions are met
         */
        this.row = this.renderRow.bind(this);
        /**
         * Test function for when to use this renderer
         */
        this.when = () => true;
    }
    componentDidLoad() {
        this.anjRowControlDidLoad.emit();
    }
    renderRow(props) {
        if (this.template) {
            return h("tr", { class: TableClasses.row, ref: r => props.renderer.rowTemplate(this.template, r, props.row, props.rowIndex) });
        }
        else if (this.formatter) {
            return h("tr", { class: TableClasses.row, innerHTML: this.formatter(props.row) });
        }
        else {
            return h("tr", { class: TableClasses.row }, this.renderer(props.row));
        }
    }
    static get is() { return "anj-render-row"; }
    static get properties() { return {
        "formatter": {
            "type": "unknown",
            "mutable": false,
            "complexType": {
                "original": "RowFormatter",
                "resolved": "(row: RowData) => string",
                "references": {
                    "RowFormatter": {
                        "location": "import",
                        "path": "../table.types"
                    }
                }
            },
            "required": false,
            "optional": false,
            "docs": {
                "tags": [],
                "text": "Formatter for cell data"
            }
        },
        "renderer": {
            "type": "unknown",
            "mutable": false,
            "complexType": {
                "original": "RowRenderer",
                "resolved": "(row: RowData) => any",
                "references": {
                    "RowRenderer": {
                        "location": "import",
                        "path": "../table.types"
                    }
                }
            },
            "required": false,
            "optional": false,
            "docs": {
                "tags": [],
                "text": "Renderer for cell data"
            }
        },
        "template": {
            "type": "string",
            "mutable": false,
            "complexType": {
                "original": "string",
                "resolved": "string",
                "references": {}
            },
            "required": false,
            "optional": false,
            "docs": {
                "tags": [],
                "text": "Name of the template to use"
            },
            "attribute": "template",
            "reflect": false
        },
        "row": {
            "type": "unknown",
            "mutable": false,
            "complexType": {
                "original": "RowRenderFn",
                "resolved": "(props: RowProps) => any",
                "references": {
                    "RowRenderFn": {
                        "location": "import",
                        "path": "../table.types"
                    }
                }
            },
            "required": false,
            "optional": false,
            "docs": {
                "tags": [],
                "text": "Renderer to use for cell content when the selected cell conditions are met"
            },
            "defaultValue": "this.renderRow.bind(this)"
        },
        "when": {
            "type": "unknown",
            "mutable": false,
            "complexType": {
                "original": "RowRenderTest",
                "resolved": "(row: RowData) => boolean",
                "references": {
                    "RowRenderTest": {
                        "location": "import",
                        "path": "../table.types"
                    }
                }
            },
            "required": false,
            "optional": false,
            "docs": {
                "tags": [],
                "text": "Test function for when to use this renderer"
            },
            "defaultValue": "() => true"
        }
    }; }
    static get events() { return [{
            "method": "anjRowControlDidLoad",
            "name": "anjRowControlDidLoad",
            "bubbles": true,
            "cancelable": true,
            "composed": true,
            "docs": {
                "tags": [],
                "text": "Emitted when the selector has been created."
            },
            "complexType": {
                "original": "void",
                "resolved": "void",
                "references": {}
            }
        }]; }
}
