import { h } from '@stencil/core';
export class DatatableHeader {
    watchSelected() {
        this.selectAll.emit(this.selected);
    }
    /**
     * Définir le checkbox du header
     */
    renderSelectBox() {
        if (this.selectable) {
            return h("materials-checkbox", { color: "primary", onChange: () => {
                    this.selected = !this.selected;
                }, onClick: (e) => e.stopPropagation(), checked: this.selected });
        }
    }
    getClasses() {
        return {
            'container': true,
            'container-background-primary': this.color === 'primary',
            'container-background-secondary': this.color === 'secondary',
        };
    }
    render() {
        return (h("div", { class: this.getClasses() },
            this.renderSelectBox(),
            h("slot", null)));
    }
    static get is() { return "materials-datatable-header"; }
    static get encapsulation() { return "shadow"; }
    static get originalStyleUrls() { return {
        "$": ["datatable-header.scss"]
    }; }
    static get styleUrls() { return {
        "$": ["datatable-header.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
        },
        "selected": {
            "type": "boolean",
            "mutable": true,
            "complexType": {
                "original": "boolean",
                "resolved": "boolean",
                "references": {}
            },
            "required": false,
            "optional": false,
            "docs": {
                "tags": [],
                "text": ""
            },
            "attribute": "selected",
            "reflect": false
        },
        "color": {
            "type": "string",
            "mutable": false,
            "complexType": {
                "original": "'primary' | 'secondary'",
                "resolved": "\"primary\" | \"secondary\"",
                "references": {}
            },
            "required": false,
            "optional": false,
            "docs": {
                "tags": [],
                "text": ""
            },
            "attribute": "color",
            "reflect": false
        }
    }; }
    static get events() { return [{
            "method": "selectAll",
            "name": "selectAll",
            "bubbles": true,
            "cancelable": true,
            "composed": true,
            "docs": {
                "tags": [],
                "text": ""
            },
            "complexType": {
                "original": "boolean",
                "resolved": "boolean",
                "references": {}
            }
        }]; }
    static get watchers() { return [{
            "propName": "selected",
            "methodName": "watchSelected"
        }]; }
}
