UNPKG

@larva.io/webcomponents

Version:

Fentrica SmartUnits WebComponents package

135 lines (131 loc) 5.33 kB
/*! * (C) Fentrica http://fentrica.com - Seee LICENSE.md */ import { r as registerInstance, c as createEvent, h, g as getElement } from './index-C4h1muVj.js'; import { C as CallStatus, M as MovingState } from './kone-elevators-interface-BV4-Ogt5.js'; const koneElevatorsCss = "slot-fb[hidden],slot[hidden]{display:initial !important}lar-button-group{-ms-flex-pack:center;justify-content:center}h2{text-align:center}"; const KoneElevators = class { constructor(hostRef) { registerInstance(this, hostRef); this.output = createEvent(this, "output"); this.request = createEvent(this, "request"); /////// LarvaNode base properties /** * Component main icon */ this.icon = 'elevator1'; /** * 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'; /** * Is logging for this component enabled (lar-log subcomponent loaded) */ this.log = false; /** * Disable quck actions */ this.disableQuickActions = false; /** * Allow node indication color automatic change based on feedback/node value. Defaults to false */ this.allowIndicationAutoColoring = false; /** * Node size */ this.nodeSize = 'default'; this.callableAreas = []; this.loading = true; this.connection = true; } componentDidLoad() { const el = this.el.shadowRoot || this.el; this.node = el.querySelector('lar-node'); this.output.emit(); } /** * Larva error input */ async error(data) { if (this.node) { this.node.error(data); } this.loading = false; } /** * Input Larva event message (see abow) */ async input(data) { this.loading = false; if (Array.isArray(data === null || data === void 0 ? void 0 : data.callableAreas)) { this.callableAreas = data.callableAreas; } if (typeof data.connection === 'boolean') { this.connection = data.connection; } this.callStatus = data.callStatus; this.lift = data.lift; this.connectionError = data.error; } callElevator(areaId) { this.loading = true; this.output.emit({ action: 'lift-call', areaId, }); } render() { var _a, _b, _c, _d, _e, _f; const compnentProps = { callStatus: this.callStatus, callableAreas: this.callableAreas, loading: this.loading, color: this.colorInputs || this.color, onCallelevator: (ev) => this.callElevator(ev.detail), connectionError: this.connectionError, connection: this.connection }; let iconSmall; let iconSmallColor = this.colorIconSmall; if (this.connection === false) { iconSmall = 'warning'; } else if (this.callStatus) { iconSmall = 'elevator-call'; if (this.callStatus === CallStatus.SERVED) { iconSmall = 'dot-circle'; } else if (((_a = this.lift) === null || _a === void 0 ? void 0 : _a.movingState) === MovingState.DOWN) { iconSmall = 'arrow-circle-down'; } else if (((_b = this.lift) === null || _b === void 0 ? void 0 : _b.movingState) === MovingState.UP) { iconSmall = 'arrow-circle-up'; } } // if (this.allowIndicationAutoColoring && iconSmall === 'warning') { iconSmallColor = 'warning'; } let value = ' '; if (this.callStatus === CallStatus.TIMEOUT) { value = 'elevators.call_timeout_short'; } else if (this.callStatus === CallStatus.CANCELLED) { value = 'elevators.call_canceled_short'; } else if (this.callStatus === CallStatus.SERVED) { value = 'elevators.arrived_short'; } else if (this.callStatus && ((_c = this.lift) === null || _c === void 0 ? void 0 : _c.currentArea)) { value = `${(_f = (_e = (_d = this.lift) === null || _d === void 0 ? void 0 : _d.currentArea) === null || _e === void 0 ? void 0 : _e.name) !== null && _f !== void 0 ? _f : ''}`; } return [ h("lar-node", { key: '2b0926fc5a4f0de20de7c9da757e30d1885b2783', value: value, icon: this.icon, hideTitles: this.hideTitles, color: this.color, supTitle: this.supTitle, mainTitle: this.mainTitle, subTitle: this.subTitle, colorModal: this.colorModal, colorInputs: this.colorInputs, loading: this.loading, colorIconSmall: iconSmallColor, iconSmall: iconSmall, log: this.log, nodeSize: this.nodeSize, component: "lar-kone-elevators-content", componentProps: compnentProps }, h("slot", { key: '34d1ce18fcd243ee69d393094e47fa39e34a9a22' })) ]; } get el() { return getElement(this); } }; KoneElevators.style = koneElevatorsCss; export { KoneElevators as lar_kone_elevators }; //# sourceMappingURL=lar-kone-elevators.entry.js.map