UNPKG

@larva.io/webcomponents

Version:

Fentrica SmartUnits WebComponents package

455 lines (454 loc) 16.2 kB
/*! * (C) Fentrica http://fentrica.com - Seee LICENSE.md */ import { h } from "@stencil/core"; export class InnerRangeDoor { constructor() { /////// LarvaNode base properties /** * Component main icon */ this.icon = 'door'; /** * The color to use from your application's color palette. * Detrouble options are: `"primary"`, `"secondary"`, `"tertiary"`, `"success"`, `"warning"`, `"danger"`, `"light"`, `"medium"`, and `"dark"`. */ this.color = 'primary'; /** * Allow node indication color automatic change based on feedback/node value. Defaults to false */ this.allowIndicationAutoColoring = false; /** * Is logging for this component enabled (lar-log subcomponent loaded) */ this.log = false; /** * Node size */ this.nodeSize = 'default'; /////// LarvaNode base properties and events - end this.alarm = false; this.loading = true; this.locked = false; } /** * Larva input message */ async input(data) { if (data && data.State) { this.locked = data.State === 'Locked'; this.loading = false; } } componentDidLoad() { const el = this.el.shadowRoot || this.el; this.node = el.querySelector('lar-node'); this.loading = true; this.output.emit(); } handleChange() { this.loading = true; return this.output.emit({ command: this.doorType === 'toggle' ? 'toggle' : this.locked ? 'unlock' : 'lock' }); } render() { const iconSmall = this.locked ? 'lock' : 'unlock'; const componentProps = { onClick: () => this.handleChange(), value: this.doorType === 'toggle' ? 'door.toggleLockUnlock' : this.locked ? 'door.unlock' : 'door.lock', icon: iconSmall, disabled: this.loading, color: this.colorInputs || this.color }; return (h("lar-node", { key: 'fc61324cf71fbbea9b8cea4340d9357732833283', value: this.locked ? 'door.locked' : 'door.unlocked', hideTitles: this.hideTitles, iconSmall: this.locked ? 'lock' : 'unlock', colorIconSmall: this.allowIndicationAutoColoring && !this.loading ? (this.locked ? 'success' : 'danger') : this.colorIconSmall, icon: this.icon, color: this.color, supTitle: this.supTitle, mainTitle: this.mainTitle, subTitle: this.subTitle, colorModal: this.colorModal, colorInputs: this.colorInputs, nodeSize: this.nodeSize, log: this.log, loading: this.loading, component: "lar-inner-range-area-door-content", componentProps: componentProps }, h("slot", { key: 'c66afc0463e413aa53c534dd0bd469b7a36c1900' }))); } static get is() { return "lar-inner-range-door"; } static get encapsulation() { return "shadow"; } static get originalStyleUrls() { return { "$": ["inner-range-door.scss"] }; } static get styleUrls() { return { "$": ["inner-range-door.css"] }; } static get properties() { return { "doorType": { "type": "string", "mutable": false, "complexType": { "original": "string", "resolved": "string", "references": {} }, "required": false, "optional": true, "docs": { "tags": [], "text": "" }, "getter": false, "setter": false, "reflect": false, "attribute": "door-type" }, "icon": { "type": "string", "mutable": true, "complexType": { "original": "string", "resolved": "string", "references": {} }, "required": false, "optional": true, "docs": { "tags": [], "text": "Component main icon" }, "getter": false, "setter": false, "reflect": false, "attribute": "icon", "defaultValue": "'door'" }, "color": { "type": "string", "mutable": true, "complexType": { "original": "Color", "resolved": "string", "references": { "Color": { "location": "import", "path": "../../interface", "id": "src/interface.d.ts::Color" } } }, "required": false, "optional": true, "docs": { "tags": [], "text": "The color to use from your application's color palette.\nDetrouble options are: `\"primary\"`, `\"secondary\"`, `\"tertiary\"`, `\"success\"`, `\"warning\"`, `\"danger\"`, `\"light\"`, `\"medium\"`, and `\"dark\"`." }, "getter": false, "setter": false, "reflect": false, "attribute": "color", "defaultValue": "'primary'" }, "colorModal": { "type": "string", "mutable": true, "complexType": { "original": "Color", "resolved": "string", "references": { "Color": { "location": "import", "path": "../../interface", "id": "src/interface.d.ts::Color" } } }, "required": false, "optional": true, "docs": { "tags": [], "text": "The color to use from your application's color palette for Components modal window." }, "getter": false, "setter": false, "reflect": false, "attribute": "color-modal" }, "colorInputs": { "type": "string", "mutable": true, "complexType": { "original": "Color", "resolved": "string", "references": { "Color": { "location": "import", "path": "../../interface", "id": "src/interface.d.ts::Color" } } }, "required": false, "optional": true, "docs": { "tags": [], "text": "The color to use from your application's color palette for inputs" }, "getter": false, "setter": false, "reflect": false, "attribute": "color-inputs" }, "colorIconSmall": { "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": "The color to use from your application's color palette for indication icon" }, "getter": false, "setter": false, "reflect": false, "attribute": "color-icon-small" }, "allowIndicationAutoColoring": { "type": "boolean", "mutable": false, "complexType": { "original": "boolean", "resolved": "boolean", "references": {} }, "required": false, "optional": false, "docs": { "tags": [], "text": "Allow node indication color automatic change based on feedback/node value. Defaults to false" }, "getter": false, "setter": false, "reflect": false, "attribute": "allow-indication-auto-coloring", "defaultValue": "false" }, "hideTitles": { "type": "boolean", "mutable": false, "complexType": { "original": "boolean", "resolved": "boolean", "references": {} }, "required": false, "optional": true, "docs": { "tags": [], "text": "Hide node titles" }, "getter": false, "setter": false, "reflect": false, "attribute": "hide-titles" }, "supTitle": { "type": "string", "mutable": false, "complexType": { "original": "string", "resolved": "string", "references": {} }, "required": false, "optional": true, "docs": { "tags": [], "text": "Component superscript title" }, "getter": false, "setter": false, "reflect": false, "attribute": "sup-title" }, "subTitle": { "type": "string", "mutable": false, "complexType": { "original": "string", "resolved": "string", "references": {} }, "required": false, "optional": true, "docs": { "tags": [], "text": "Component subtitle" }, "getter": false, "setter": false, "reflect": false, "attribute": "sub-title" }, "log": { "type": "boolean", "mutable": false, "complexType": { "original": "boolean", "resolved": "boolean", "references": {} }, "required": false, "optional": false, "docs": { "tags": [], "text": "Is logging for this component enabled (lar-log subcomponent loaded)" }, "getter": false, "setter": false, "reflect": false, "attribute": "log", "defaultValue": "false" }, "mainTitle": { "type": "string", "mutable": false, "complexType": { "original": "string", "resolved": "string", "references": {} }, "required": true, "optional": false, "docs": { "tags": [], "text": "Component main title" }, "getter": false, "setter": false, "reflect": false, "attribute": "main-title" }, "nodeSize": { "type": "string", "mutable": false, "complexType": { "original": "Size", "resolved": "\"default\" | \"small\"", "references": { "Size": { "location": "import", "path": "../../interface", "id": "src/interface.d.ts::Size" } } }, "required": false, "optional": true, "docs": { "tags": [], "text": "Node size" }, "getter": false, "setter": false, "reflect": false, "attribute": "node-size", "defaultValue": "'default'" }, "options": { "type": "any", "mutable": false, "complexType": { "original": "any", "resolved": "any", "references": {} }, "required": false, "optional": true, "docs": { "tags": [], "text": "Component specific options (see above)" }, "getter": false, "setter": false, "reflect": false, "attribute": "options" } }; } static get states() { return { "alarm": {}, "loading": {}, "locked": {} }; } static get events() { return [{ "method": "output", "name": "output", "bubbles": true, "cancelable": true, "composed": true, "docs": { "tags": [{ "name": "see", "text": "{@link ../readme.md} chapter \"Components input and output\" for further information." }], "text": "" }, "complexType": { "original": "any", "resolved": "any", "references": {} } }, { "method": "request", "name": "request", "bubbles": true, "cancelable": true, "composed": true, "docs": { "tags": [{ "name": "see", "text": "{@link ../readme.md} chapter \"Sub-Components requests and responses\" for further information." }], "text": "" }, "complexType": { "original": "any", "resolved": "any", "references": {} } }]; } static get methods() { return { "input": { "complexType": { "signature": "(data: any) => Promise<void>", "parameters": [{ "name": "data", "type": "any", "docs": "" }], "references": { "Promise": { "location": "global", "id": "global::Promise" } }, "return": "Promise<void>" }, "docs": { "text": "Larva input message", "tags": [] } } }; } static get elementRef() { return "el"; } } //# sourceMappingURL=inner-range-door.js.map