@larva.io/webcomponents
Version:
Fentrica SmartUnits WebComponents package
337 lines (336 loc) • 12.3 kB
JavaScript
/*!
* (C) Fentrica http://fentrica.com - Seee LICENSE.md
*/
import { h } from "@stencil/core";
import { createModal } from "../internal/modal/modal-controller";
export class AreaContent {
constructor() {
this.armed = false;
this.zoneopened = false;
this.hastroubles = false;
this.alarm = false;
this.loading = true;
}
async showModal(title, subTitle, component) {
this.modal = await createModal({
mainTitle: title,
subTitle,
color: this.colorModal || this.color,
animation: 'bottom',
iconSmall: this.loading ? 'loading' : '',
colorHeaderInputs: this.color,
icon: this.icon,
headerSize: 'small',
onLarmodaldiddismiss: () => {
this.modal = undefined;
this.modalComponent = undefined;
},
component,
componentProps: {
zones: this.zones,
troubles: this.troubles,
onOutput: (evt) => this.output.emit(evt.detail),
color: this.color,
}
});
await this.modal.present();
this.modalComponent = await this.modal.getComponent();
}
async disconnectedCallback() {
var _a;
return (_a = this.modal) === null || _a === void 0 ? void 0 : _a.dismiss();
}
render() {
if (this.modalComponent) {
this.modalComponent.element.setAttribute('zones', this.zones);
this.modalComponent.element.setAttribute('troubles', this.troubles);
this.modalComponent.element.setAttribute('color', this.color);
}
return [
h("div", { key: 'c723ffaffe3e0f7728aad82032a7aeda1e261a10', class: "actions" }, (this.armed || this.alarm)
?
h("lar-button", { onClick: () => this.disarm.emit(), color: this.color, disabled: this.loading }, h("lar-icon", { icon: "unlock" }), " ", h("lar-translate", { t: "area.disarm" }))
:
h("lar-button-group", null, h("lar-button", { disabled: this.zoneopened || this.loading, onClick: () => this.hastroubles ? this.showModal('area.overrideAndBypass', 'area.selectZonesToBypass', 'lar-area-bypass') : this.arm.emit(), color: this.color }, h("lar-icon", { icon: "lock" }), " ", h("lar-translate", { t: "area.arm" })), h("lar-button", { disabled: this.loading, onClick: () => this.showModal('area.partialarm', 'area.selectZonesToBypass', 'lar-area-bypass'), color: this.color === 'dark' ? 'light' : 'dark' }, h("lar-icon", { icon: "halflock" }), " ", h("lar-translate", { t: "area.partialarm" })))),
h("div", { key: '5d7b55566d25b648acd76d22faaf439fc562e05f', class: "details" }, h("lar-button-group", { key: 'e5b19daa536f58ff794ebe7786acb50352afc1da' }, this.hastroubles
&&
h("lar-button", { key: 'd1e4ffae39af91381d9ac83060f5ac8473310bff', color: "warning", size: "small", expand: "block", outline: true, onClick: () => this.showModal('area.troubles', '', 'lar-area-troubles') }, h("lar-icon", { key: '3fad9ce6e0c6a02029e116d23cecf2951dc4cf96', icon: "warning" }), "\u00A0", h("lar-translate", { key: '9a825a5ef5dd8ca817c7fb191d95b79704e3b40d', t: "area.troubles" })), h("lar-button", { key: '5f4d787a4d4573bf1961252e08d43e998a8b6351', color: this.color, size: "small", expand: "block", outline: true, onClick: () => this.showModal('area.zonemonitor', '', 'lar-area-zones') }, h("lar-translate", { key: '891581ff567c1ef2f3b00ac4db6aa0357cb40cf8', t: "area.zonemonitor" }), "\u00A0", this.zoneopened
?
h("lar-icon", { icon: "unlock" })
:
h("lar-icon", { icon: "lock" }))))
];
}
static get is() { return "lar-area-content"; }
static get encapsulation() { return "shadow"; }
static get originalStyleUrls() {
return {
"$": ["area.scss"]
};
}
static get styleUrls() {
return {
"$": ["area.css"]
};
}
static get properties() {
return {
"color": {
"type": "string",
"mutable": false,
"complexType": {
"original": "Color",
"resolved": "string",
"references": {
"Color": {
"location": "import",
"path": "../../interface",
"id": "src/interface.d.ts::Color"
}
}
},
"required": false,
"optional": true,
"docs": {
"tags": [],
"text": ""
},
"getter": false,
"setter": false,
"reflect": false,
"attribute": "color"
},
"colorModal": {
"type": "string",
"mutable": false,
"complexType": {
"original": "Color",
"resolved": "string",
"references": {
"Color": {
"location": "import",
"path": "../../interface",
"id": "src/interface.d.ts::Color"
}
}
},
"required": false,
"optional": true,
"docs": {
"tags": [],
"text": ""
},
"getter": false,
"setter": false,
"reflect": false,
"attribute": "color-modal"
},
"zones": {
"type": "string",
"mutable": false,
"complexType": {
"original": "string",
"resolved": "string",
"references": {}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": ""
},
"getter": false,
"setter": false,
"reflect": false,
"attribute": "zones"
},
"troubles": {
"type": "string",
"mutable": false,
"complexType": {
"original": "string",
"resolved": "string",
"references": {}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": ""
},
"getter": false,
"setter": false,
"reflect": false,
"attribute": "troubles"
},
"armed": {
"type": "boolean",
"mutable": false,
"complexType": {
"original": "boolean",
"resolved": "boolean",
"references": {}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": ""
},
"getter": false,
"setter": false,
"reflect": false,
"attribute": "armed",
"defaultValue": "false"
},
"zoneopened": {
"type": "boolean",
"mutable": false,
"complexType": {
"original": "boolean",
"resolved": "boolean",
"references": {}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": ""
},
"getter": false,
"setter": false,
"reflect": false,
"attribute": "zoneopened",
"defaultValue": "false"
},
"hastroubles": {
"type": "boolean",
"mutable": false,
"complexType": {
"original": "boolean",
"resolved": "boolean",
"references": {}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": ""
},
"getter": false,
"setter": false,
"reflect": false,
"attribute": "hastroubles",
"defaultValue": "false"
},
"icon": {
"type": "string",
"mutable": false,
"complexType": {
"original": "string",
"resolved": "string",
"references": {}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": ""
},
"getter": false,
"setter": false,
"reflect": false,
"attribute": "icon"
},
"alarm": {
"type": "boolean",
"mutable": false,
"complexType": {
"original": "boolean",
"resolved": "boolean",
"references": {}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": ""
},
"getter": false,
"setter": false,
"reflect": false,
"attribute": "alarm",
"defaultValue": "false"
},
"loading": {
"type": "boolean",
"mutable": false,
"complexType": {
"original": "boolean",
"resolved": "boolean",
"references": {}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": ""
},
"getter": false,
"setter": false,
"reflect": false,
"attribute": "loading",
"defaultValue": "true"
}
};
}
static get events() {
return [{
"method": "arm",
"name": "arm",
"bubbles": true,
"cancelable": true,
"composed": true,
"docs": {
"tags": [],
"text": ""
},
"complexType": {
"original": "any",
"resolved": "any",
"references": {}
}
}, {
"method": "disarm",
"name": "disarm",
"bubbles": true,
"cancelable": true,
"composed": true,
"docs": {
"tags": [],
"text": ""
},
"complexType": {
"original": "any",
"resolved": "any",
"references": {}
}
}, {
"method": "output",
"name": "output",
"bubbles": true,
"cancelable": true,
"composed": true,
"docs": {
"tags": [],
"text": ""
},
"complexType": {
"original": "any",
"resolved": "any",
"references": {}
}
}];
}
}
//# sourceMappingURL=area-content.js.map