UNPKG

@larva.io/webcomponents

Version:

Fentrica SmartUnits WebComponents package

110 lines (105 loc) 4.57 kB
/*! * (C) Fentrica http://fentrica.com - Seee LICENSE.md */ 'use strict'; var index = require('./index-B0SElCD3.js'); const innerRangeInceptionAreaCss = "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. * 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.armReady = false; this.alarm = false; this.inceptionError = 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) { this.armed = !!(data === null || data === void 0 ? void 0 : data.armed); this.alarm = !!(data === null || data === void 0 ? void 0 : data.alarm); this.armReady = !!(data === null || data === void 0 ? void 0 : data.armReady); this.inceptionError = !data || !!(data === null || data === void 0 ? void 0 : data.connencting) || !!(data === null || data === void 0 ? void 0 : data.error); this.loading = false; } componentDidLoad() { const el = this.el.shadowRoot || this.el; this.node = el.querySelector('lar-node'); this.loading = true; this.output.emit(); } armDisarm() { this.loading = true; return this.output.emit({ areaControlType: this.armed ? 'Disarm' : 'Arm' }); } render() { const iconSmall = (this.inceptionError || this.alarm) ? 'warning' : (this.armed ? 'lock' : 'unlock'); let colorIconSmall = this.colorIconSmall; let value = this.loading ? ' ' : (this.armed ? 'area.armed' : 'area.disarmed'); if (this.inceptionError) { value = 'area.systemTroubles'; colorIconSmall = this.allowIndicationAutoColoring ? 'warning' : colorIconSmall; } if (this.alarm) { value = 'area.alarm'; colorIconSmall = this.allowIndicationAutoColoring ? 'danger' : colorIconSmall; } const componentProps = { onClick: () => this.armDisarm(), value: this.armed ? 'area.disarm' : 'area.arm', icon: this.armed ? 'unlock' : 'lock', disabled: this.loading || !this.armReady || this.inceptionError, armReady: this.armReady, color: this.colorInputs || this.color }; return [ index.h("lar-node", { key: '42a80b5d4307fcd16fe0bac466b2743735435c1d', value: value, hideTitles: this.hideTitles, iconSmall: iconSmall, icon: this.icon, colorIconSmall: 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-inception-area-content", componentProps: componentProps }, index.h("slot", { key: '6848ec08d5ca42f64bb86135cb449af55aca7902' })) ]; } get el() { return index.getElement(this); } }; InnerRangeArea.style = innerRangeInceptionAreaCss; exports.lar_inner_range_inception_area = InnerRangeArea; //# sourceMappingURL=lar-inner-range-inception-area.entry.cjs.js.map