UNPKG

@larva.io/webcomponents

Version:

Fentrica SmartUnits WebComponents package

95 lines (90 loc) 3.65 kB
/*! * (C) Fentrica http://fentrica.com - Seee LICENSE.md */ 'use strict'; var index = require('./index-B0SElCD3.js'); const innerRangeAreaCss = "slot-fb[hidden],slot[hidden]{display:initial !important}"; const InnerRangeArea = class { constructor(hostRef) { index.registerInstance(this, hostRef); this.output = index.createEvent(this, "output"); this.request = index.createEvent(this, "request"); /////// LarvaNode base properties /** * Component main icon */ this.icon = 'security'; /** * 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; /** * Allow node color automatic change based on feedback/node value. Defaults to true */ this.allowNodeAutoColoring = true; /** * 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.armed = false; this.alarm = false; this.loading = true; } /** * Larva error input */ async error(data) { if (this.node) { this.node.error(data); } this.loading = false; } /** * Larva input message */ async input(data) { if (data && data.State) { this.armed = data.State === 'Armed'; this.loading = false; } } componentDidLoad() { const el = this.el.shadowRoot || this.el; this.node = el.querySelector('lar-node'); this.loading = true; this.output.emit(); } armDisarm() { if (this.loading === false) { this.loading = true; return this.output.emit({ command: this.armed ? 'disarm' : 'arm' }); } } render() { const iconSmall = this.armed ? 'lock' : 'unlock'; const componentProps = { onClick: () => this.armDisarm(), value: this.armed ? 'area.arm' : 'area.disarm', icon: iconSmall, disabled: this.loading, color: this.colorInputs || this.color }; return [ index.h("lar-node", { key: '68c1426d8546c37dda212da711fe4525aa8e75f6', value: this.armed ? 'area.armed' : 'area.disarmed', hideTitles: this.hideTitles, iconSmall: iconSmall, icon: this.icon, colorIconSmall: this.alarm && this.allowIndicationAutoColoring === true ? 'danger' : this.colorIconSmall, color: this.alarm && this.allowNodeAutoColoring === true ? 'danger' : this.color, supTitle: this.supTitle, mainTitle: this.mainTitle, subTitle: this.subTitle, colorModal: this.alarm && this.allowNodeAutoColoring === true ? 'danger' : this.colorModal, colorInputs: this.colorInputs, log: this.log, loading: this.loading, nodeSize: this.nodeSize, component: "lar-inner-range-area-door-content", componentProps: componentProps }, index.h("slot", { key: '943acad917c59f853434db7b8aaa89dcaddc4949' })) ]; } get el() { return index.getElement(this); } }; InnerRangeArea.style = innerRangeAreaCss; exports.lar_inner_range_area = InnerRangeArea; //# sourceMappingURL=lar-inner-range-area.entry.cjs.js.map