UNPKG

@larva.io/webcomponents

Version:

Fentrica SmartUnits WebComponents package

91 lines (87 loc) 4.18 kB
/*! * (C) Fentrica http://fentrica.com - Seee LICENSE.md */ import { r as registerInstance, c as createEvent, h, g as getElement } from './index-C4h1muVj.js'; const innerRangeInceptionDoorCss = "slot-fb[hidden],slot[hidden]{display:initial !important}"; const InnerRangeDoor = class { constructor(hostRef) { registerInstance(this, hostRef); 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 getElement(this); } }; InnerRangeDoor.style = innerRangeInceptionDoorCss; export { InnerRangeDoor as lar_inner_range_inception_door }; //# sourceMappingURL=lar-inner-range-inception-door.entry.js.map