@larva.io/webcomponents
Version:
Fentrica SmartUnits WebComponents package
76 lines (72 loc) • 3.27 kB
JavaScript
/*!
* (C) Fentrica http://fentrica.com - Seee LICENSE.md
*/
import { r as registerInstance, c as createEvent, h, g as getElement } from './index-C4h1muVj.js';
const innerRangeDoorCss = "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;
}
/**
* 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' })));
}
get el() { return getElement(this); }
};
InnerRangeDoor.style = innerRangeDoorCss;
export { InnerRangeDoor as lar_inner_range_door };
//# sourceMappingURL=lar-inner-range-door.entry.js.map