@larva.io/webcomponents
Version:
Fentrica SmartUnits WebComponents package
221 lines (216 loc) • 8.39 kB
JavaScript
/*!
* (C) Fentrica http://fentrica.com - Seee LICENSE.md
*/
import { p as proxyCustomElement, H, c as createEvent, h } from './p-AOwgnAK2.js';
import { C as CallStatus, M as MovingState } from './p-BV4-Ogt5.js';
import { d as defineCustomElement$8 } from './p-B7x5gzZv.js';
import { d as defineCustomElement$7 } from './p-C9VBtzS4.js';
import { d as defineCustomElement$6 } from './p-9A4J2Z7t.js';
import { d as defineCustomElement$5 } from './p-Dsy6MkCW.js';
import { d as defineCustomElement$4 } from './p-CNwVOfNs.js';
import { d as defineCustomElement$3 } from './p-Bk24sn12.js';
import { d as defineCustomElement$2 } from './p-B-fmI6sr.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 = /*@__PURE__*/ proxyCustomElement(class KoneElevators extends H {
constructor(registerHost) {
super();
if (registerHost !== false) {
this.__registerHost();
}
this.__attachShadow();
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 this; }
static get style() { return koneElevatorsCss; }
}, [257, "lar-kone-elevators", {
"icon": [1025],
"color": [1025],
"colorModal": [1025, "color-modal"],
"colorInputs": [1025, "color-inputs"],
"colorIconSmall": [1, "color-icon-small"],
"hideTitles": [4, "hide-titles"],
"supTitle": [1, "sup-title"],
"subTitle": [1, "sub-title"],
"log": [4],
"mainTitle": [1, "main-title"],
"disableQuickActions": [4, "disable-quick-actions"],
"allowIndicationAutoColoring": [4, "allow-indication-auto-coloring"],
"nodeSize": [1, "node-size"],
"lift": [32],
"callableAreas": [32],
"callStatus": [32],
"loading": [32],
"connection": [32],
"connectionError": [32],
"error": [64],
"input": [64]
}]);
function defineCustomElement$1() {
if (typeof customElements === "undefined") {
return;
}
const components = ["lar-kone-elevators", "lar-backdrop", "lar-icon", "lar-modal", "lar-node", "lar-node-titles", "lar-notify", "lar-translate"];
components.forEach(tagName => { switch (tagName) {
case "lar-kone-elevators":
if (!customElements.get(tagName)) {
customElements.define(tagName, KoneElevators);
}
break;
case "lar-backdrop":
if (!customElements.get(tagName)) {
defineCustomElement$8();
}
break;
case "lar-icon":
if (!customElements.get(tagName)) {
defineCustomElement$7();
}
break;
case "lar-modal":
if (!customElements.get(tagName)) {
defineCustomElement$6();
}
break;
case "lar-node":
if (!customElements.get(tagName)) {
defineCustomElement$5();
}
break;
case "lar-node-titles":
if (!customElements.get(tagName)) {
defineCustomElement$4();
}
break;
case "lar-notify":
if (!customElements.get(tagName)) {
defineCustomElement$3();
}
break;
case "lar-translate":
if (!customElements.get(tagName)) {
defineCustomElement$2();
}
break;
} });
}
defineCustomElement$1();
const LarKoneElevators = KoneElevators;
const defineCustomElement = defineCustomElement$1;
export { LarKoneElevators, defineCustomElement };
//# sourceMappingURL=lar-kone-elevators.js.map
//# sourceMappingURL=lar-kone-elevators.js.map