import { h, Host } from '@stencil/core';
export class DatatableBodyRow {
    constructor() {
        this.selected = false;
    }
    watchSelected() {
        this.selectRow.emit(this.selected);
    }
    handleClick() {
        if (this.selectable) {
            this.selected = !this.selected;
        }
    }
    toggleExpendable(e) {
        e.stopPropagation();
        this.expended = !this.expended;
        this.expand.emit(this.expended);
    }
    render() {
        return h(Host, { class: {
                'dense': this.dense,
                'selectable': this.selectable,
                'selected': this.selected,
                'expended': this.expended
            }, onClick: () => this.handleClick() },
            h("div", { class: "container" },
                h("div", { class: "mdc-ripple-surface mdc-ripple-surface--primary" }),
                this.expendable &&
                    h("materials-icon-button", { dense: true, icon: this.expended ? 'arrow_drop_down' : 'arrow_right', onClick: (e) => this.toggleExpendable(e) }),
                this.selectable &&
                    h("materials-checkbox", { class: "selection-checkbox", color: "primary", onChange: () => {
                            this.selected = !this.selected;
                        }, onClick: (e) => e.stopPropagation(), checked: this.selected }),
                h("slot", null)),
            h("div", { class: "expendable-content" },
                h("slot", { name: "expendable-content" })));
    }
    static get is() { return "materials-datatable-body-row"; }
    static get encapsulation() { return "shadow"; }
    static get originalStyleUrls() { return {
        "$": ["datatable-body-row.scss"]
    }; }
    static get styleUrls() { return {
        "$": ["datatable-body-row.css"]
    }; }
    static get properties() { return {
        "selectable": {
            "type": "boolean",
            "mutable": false,
            "complexType": {
                "original": "boolean",
                "resolved": "boolean",
                "references": {}
            },
            "required": false,
            "optional": false,
            "docs": {
                "tags": [],
                "text": ""
            },
            "attribute": "selectable",
            "reflect": false
        },
        "dense": {
            "type": "boolean",
            "mutable": false,
            "complexType": {
                "original": "boolean",
                "resolved": "boolean",
                "references": {}
            },
            "required": false,
            "optional": false,
            "docs": {
                "tags": [],
                "text": ""
            },
            "attribute": "dense",
            "reflect": false
        },
        "selected": {
            "type": "boolean",
            "mutable": true,
            "complexType": {
                "original": "boolean",
                "resolved": "boolean",
                "references": {}
            },
            "required": false,
            "optional": false,
            "docs": {
                "tags": [],
                "text": ""
            },
            "attribute": "selected",
            "reflect": false,
            "defaultValue": "false"
        },
        "expendable": {
            "type": "boolean",
            "mutable": false,
            "complexType": {
                "original": "boolean",
                "resolved": "boolean",
                "references": {}
            },
            "required": false,
            "optional": false,
            "docs": {
                "tags": [],
                "text": ""
            },
            "attribute": "expendable",
            "reflect": false
        },
        "expended": {
            "type": "boolean",
            "mutable": true,
            "complexType": {
                "original": "boolean",
                "resolved": "boolean",
                "references": {}
            },
            "required": false,
            "optional": false,
            "docs": {
                "tags": [],
                "text": ""
            },
            "attribute": "expended",
            "reflect": false
        }
    }; }
    static get events() { return [{
            "method": "selectRow",
            "name": "selectRow",
            "bubbles": true,
            "cancelable": true,
            "composed": true,
            "docs": {
                "tags": [],
                "text": ""
            },
            "complexType": {
                "original": "boolean",
                "resolved": "boolean",
                "references": {}
            }
        }, {
            "method": "expand",
            "name": "expand",
            "bubbles": true,
            "cancelable": true,
            "composed": true,
            "docs": {
                "tags": [],
                "text": ""
            },
            "complexType": {
                "original": "boolean",
                "resolved": "boolean",
                "references": {}
            }
        }]; }
    static get elementRef() { return "host"; }
    static get watchers() { return [{
            "propName": "selected",
            "methodName": "watchSelected"
        }]; }
}
