UNPKG

@larva.io/webcomponents

Version:

Fentrica SmartUnits WebComponents package

176 lines (171 loc) 7.26 kB
/*! * (C) Fentrica http://fentrica.com - Seee LICENSE.md */ import { p as proxyCustomElement, H, c as createEvent, h } from './p-AOwgnAK2.js'; import { d as defineCustomElement$8 } from './p-B7x5gzZv.js'; import { d as defineCustomElement$7 } from './p-C9VBtzS4.js'; import { d as defineCustomElement$6 } from './p-9A4J2Z7t.js'; import { d as defineCustomElement$5 } from './p-Dsy6MkCW.js'; import { d as defineCustomElement$4 } from './p-CNwVOfNs.js'; import { d as defineCustomElement$3 } from './p-Bk24sn12.js'; import { d as defineCustomElement$2 } from './p-B-fmI6sr.js'; const innerRangeInceptionDoorCss = "slot-fb[hidden],slot[hidden]{display:initial !important}"; const InnerRangeDoor = /*@__PURE__*/ proxyCustomElement(class InnerRangeDoor extends H { constructor(registerHost) { super(); if (registerHost !== false) { this.__registerHost(); } this.__attachShadow(); this.output = createEvent(this, "output"); this.request = createEvent(this, "request"); /////// 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; this.timedUnlockTimeSecs = 0; this.inceptionError = false; } /** * Larva input message */ async input(data) { this.loading = false; this.locked = data && data.locked; this.doorType = data && data.mode || 'toggle'; this.timedUnlockTimeSecs = (data && data.timedUnlockTimeSecs) || 0; this.inceptionError = data && (data.connencting || data.error); } componentDidLoad() { const el = this.el.shadowRoot || this.el; this.node = el.querySelector('lar-node'); this.loading = true; this.output.emit(); } handleChange() { this.loading = true; let doorControlType = this.locked ? 'Unlock' : 'Lock'; if (this.doorType === 'toggle') { doorControlType = 'ToggleLock'; } if (this.doorType === 'toggle' && this.timedUnlockTimeSecs > 0) { doorControlType = 'TimedUnlock'; } return this.output.emit({ doorControlType, doorControlData: Object.assign({}, this.doorType === 'toggle' && this.timedUnlockTimeSecs > 0 ? { TimeSecs: this.timedUnlockTimeSecs } : {}) }); } render() { const iconSmall = this.inceptionError ? 'warning' : this.locked ? 'lock' : 'unlock'; const value = this.doorType === 'toggle' && this.timedUnlockTimeSecs > 0 ? 'door.buzzOpen' : this.doorType === 'toggle' ? 'door.toggleLockUnlock' : this.locked ? 'door.unlock' : 'door.lock'; const colorIconSmall = this.allowIndicationAutoColoring && !this.loading ? (!this.locked || !this.inceptionError ? 'danger' : 'success') : this.colorIconSmall; const componentProps = { onClick: () => this.handleChange(), value, icon: this.locked ? 'lock' : 'unlock', disabled: this.loading, color: this.colorInputs || this.color }; return (h("lar-node", { key: 'c19f190b2e95bc7dedfd6dd06604c33547d00398', value: this.inceptionError ? 'door.error' : this.locked ? 'door.locked' : 'door.unlocked', hideTitles: this.hideTitles, iconSmall: iconSmall, colorIconSmall: 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-inception-door-content", componentProps: componentProps }, h("slot", { key: 'd47bfe6caecefd78a8ab73e4db19647aae179d2d' }))); } get el() { return this; } static get style() { return innerRangeInceptionDoorCss; } }, [257, "lar-inner-range-inception-door", { "doorType": [1, "door-type"], "icon": [1025], "color": [1025], "colorModal": [1025, "color-modal"], "colorInputs": [1025, "color-inputs"], "colorIconSmall": [1, "color-icon-small"], "allowIndicationAutoColoring": [4, "allow-indication-auto-coloring"], "hideTitles": [4, "hide-titles"], "supTitle": [1, "sup-title"], "subTitle": [1, "sub-title"], "log": [4], "mainTitle": [1, "main-title"], "nodeSize": [1, "node-size"], "options": [8], "alarm": [32], "loading": [32], "locked": [32], "timedUnlockTimeSecs": [32], "inceptionError": [32], "input": [64] }]); function defineCustomElement$1() { if (typeof customElements === "undefined") { return; } const components = ["lar-inner-range-inception-door", "lar-backdrop", "lar-icon", "lar-modal", "lar-node", "lar-node-titles", "lar-notify", "lar-translate"]; components.forEach(tagName => { switch (tagName) { case "lar-inner-range-inception-door": if (!customElements.get(tagName)) { customElements.define(tagName, InnerRangeDoor); } break; case "lar-backdrop": if (!customElements.get(tagName)) { defineCustomElement$8(); } break; case "lar-icon": if (!customElements.get(tagName)) { defineCustomElement$7(); } break; case "lar-modal": if (!customElements.get(tagName)) { defineCustomElement$6(); } break; case "lar-node": if (!customElements.get(tagName)) { defineCustomElement$5(); } break; case "lar-node-titles": if (!customElements.get(tagName)) { defineCustomElement$4(); } break; case "lar-notify": if (!customElements.get(tagName)) { defineCustomElement$3(); } break; case "lar-translate": if (!customElements.get(tagName)) { defineCustomElement$2(); } break; } }); } defineCustomElement$1(); const LarInnerRangeInceptionDoor = InnerRangeDoor; const defineCustomElement = defineCustomElement$1; export { LarInnerRangeInceptionDoor, defineCustomElement }; //# sourceMappingURL=lar-inner-range-inception-door.js.map //# sourceMappingURL=lar-inner-range-inception-door.js.map