import { h } from "@stencil/core";
import { Units } from "../../enums";
import i18n from "./al-graph-settings.i18n.en.json";
export class AlSettings {
    constructor() {
        this._contentStrings = i18n;
    }
    _graphEnabled(enabled) {
        this.graphEnabled = enabled;
        this.graphEnabledChange.emit(enabled);
    }
    _units(units) {
        this.units = units;
        this.unitsChange.emit(this.units);
    }
    renderGraphEnabled() {
        if (this.graphVisible) {
            return (h("div", null,
                h("ion-item", { style: {
                        display: "var(--graph-enabled-display, block)"
                    } },
                    h("span", { title: this._contentStrings.graphEnabled }, this._contentStrings.graphEnabled),
                    h("ion-toggle", { slot: "end", checked: this.graphEnabled, onIonChange: e => this._graphEnabled(e.detail.checked) })),
                h("ion-item", { style: {
                        display: "var(--units-display, block)"
                    } },
                    h("span", { title: this._contentStrings.units }, this._contentStrings.units),
                    h("select", { slot: "end", onChange: e => this._units(e.srcElement.value) },
                        h("option", { selected: this.units === Units.MILLIMETERS, value: Units.MILLIMETERS }, this._contentStrings.millimeters),
                        h("option", { selected: this.units === Units.METERS, value: Units.METERS }, this._contentStrings.meters)))));
        }
        else {
            return h("span", null, "hello world");
        }
    }
    render() {
        return (h("div", { style: {
                "max-width": "100%",
                "overflow-x": "hidden"
            } }, this.renderGraphEnabled()));
    }
    static get is() { return "al-graph-settings"; }
    static get encapsulation() { return "shadow"; }
    static get originalStyleUrls() { return {
        "$": ["al-graph-settings.css"]
    }; }
    static get styleUrls() { return {
        "$": ["al-graph-settings.css"]
    }; }
    static get properties() { return {
        "graphEnabled": {
            "type": "boolean",
            "mutable": true,
            "complexType": {
                "original": "boolean",
                "resolved": "boolean",
                "references": {}
            },
            "required": false,
            "optional": false,
            "docs": {
                "tags": [],
                "text": ""
            },
            "attribute": "graph-enabled",
            "reflect": false
        },
        "graphVisible": {
            "type": "boolean",
            "mutable": true,
            "complexType": {
                "original": "boolean",
                "resolved": "boolean",
                "references": {}
            },
            "required": false,
            "optional": false,
            "docs": {
                "tags": [],
                "text": ""
            },
            "attribute": "graph-visible",
            "reflect": false
        },
        "units": {
            "type": "string",
            "mutable": true,
            "complexType": {
                "original": "Units",
                "resolved": "Units.METERS | Units.MILLIMETERS",
                "references": {
                    "Units": {
                        "location": "import",
                        "path": "../../enums"
                    }
                }
            },
            "required": false,
            "optional": false,
            "docs": {
                "tags": [],
                "text": ""
            },
            "attribute": "units",
            "reflect": false
        }
    }; }
    static get events() { return [{
            "method": "unitsChange",
            "name": "unitsChange",
            "bubbles": true,
            "cancelable": true,
            "composed": true,
            "docs": {
                "tags": [],
                "text": ""
            },
            "complexType": {
                "original": "any",
                "resolved": "any",
                "references": {}
            }
        }, {
            "method": "graphEnabledChange",
            "name": "graphEnabledChange",
            "bubbles": true,
            "cancelable": true,
            "composed": true,
            "docs": {
                "tags": [],
                "text": ""
            },
            "complexType": {
                "original": "any",
                "resolved": "any",
                "references": {}
            }
        }]; }
}
