UNPKG

@larva.io/webcomponents

Version:

Fentrica SmartUnits WebComponents package

69 lines (68 loc) 2.58 kB
/*! * (C) Fentrica http://fentrica.com - Seee LICENSE.md */ import { h } from "@stencil/core"; import forOwn from "lodash-es/forOwn"; import sortBy from "lodash-es/sortBy"; import groupBy from "lodash-es/groupBy"; export class AreaZones { render() { const zones = []; const sortedZones = sortBy(JSON.parse(this.zones), 'group'); const groupedZones = groupBy(sortedZones, 'group'); forOwn(groupedZones, (groupedZonesOwn, group) => { zones.push(h("lar-list-header", null, h("lar-translate", { t: group }))); sortBy(groupedZonesOwn, 'name').forEach(zone => { let color = 'success'; if (zone.state === 'open') { color = 'tertiary'; } if (zone.state === 'short_circuit') { color = 'warning'; } if (zone.state === 'open_circuit') { color = 'danger'; } zones.push(h("lar-list-item", null, h("div", { slot: "start", class: "circle" }, h("lar-icon", { icon: zone.type, color: color })), h("div", null, h("h4", null, h("lar-translate", { t: zone.name })), h("lar-badge", { color: color }, h("lar-translate", { t: 'area.zone_state.' + zone.state })), zone.overridden && h("span", null, "\u00A0", h("lar-badge", { color: "danger" }, h("lar-translate", { t: 'area.zone_state.bypassed' })))))); }); }); return h("div", { key: '42622775d0f8c8a4c589826f8a2456da463d0c91', class: "zone-list" }, zones); } static get is() { return "lar-area-zones"; } static get encapsulation() { return "shadow"; } static get originalStyleUrls() { return { "$": ["area.scss"] }; } static get styleUrls() { return { "$": ["area.css"] }; } static get properties() { return { "zones": { "type": "string", "mutable": false, "complexType": { "original": "string", "resolved": "string", "references": {} }, "required": false, "optional": false, "docs": { "tags": [], "text": "" }, "getter": false, "setter": false, "reflect": false, "attribute": "zones" } }; } } //# sourceMappingURL=area-zones.js.map