@larva.io/webcomponents
Version:
Fentrica SmartUnits WebComponents package
59 lines (55 loc) • 3.02 kB
JavaScript
/*!
* (C) Fentrica http://fentrica.com - Seee LICENSE.md
*/
import { r as registerInstance, h } from './index-C4h1muVj.js';
import { m as map } from './map-C29-xOJP.js';
import { h as hooks } from './moment-DAuPur-P.js';
import './_hasPath-BgJxJEDp.js';
import './isArray-C_HhfJYh.js';
import './isObjectLike-CIR68wtF.js';
import './global-C56buD75.js';
import './_isIndex-DgTx77bC.js';
import './isLength-BBM_tGdM.js';
import './isObject-C7eoH3L1.js';
import './_baseMap-kP2T3hT_.js';
import './_getAllKeys-C08dM1uK.js';
import './_getTag-CFse-dEC.js';
const utilityLogCss = "slot-fb[hidden],slot[hidden]{display:initial !important}lar-list-item{background-color:var(--lar-background-color-step-100, rgb(25.5, 25.5, 25.5)) !important;color:var(--lar-text-color, #fff) !important}";
const LogEntryList = class {
constructor(hostRef) {
registerInstance(this, hostRef);
this.values = '[]';
this.measuringUnit = '';
this.webComponentValueType = '';
}
render() {
const values = JSON.parse(this.values);
const months = values && Array.isArray(values) ? values : [];
let latestMonth = months.length > 0 ? months[0] : null;
if (latestMonth && latestMonth.date !== hooks().format('MM-YYYY')) {
latestMonth = null;
}
const entries = map(months, (month, key) => {
return {
start: h("lar-translate", { t: 'date.months.' + (hooks(month.date, 'MM-YYYY').month() + 1) }),
content: '',
end: (h("div", null, h("small", null, month.abs), h("small", null, this.measuringUnit), " \u2022 ", h("small", null, "\u0394"), " ", month.rel, h("small", null, this.measuringUnit))),
group: hooks(month.date, 'MM-YYYY').format('YYYY')
};
});
const header = latestMonth ? (h("div", null, h("lar-list-item", null, h("div", { slot: "start" }, h("strong", null, h("lar-translate", { t: "utilityMeter.currentMonthReading" }))), h("div", { slot: "end" }, h("small", null, latestMonth.abs, this.measuringUnit))), h("lar-list-item", null, h("div", { slot: "start" }, h("strong", null, h("lar-translate", { t: "utilityMeter.currentMonthUsage" }))), h("div", { slot: "end" }, h("small", null, latestMonth.rel, this.measuringUnit))))) : null;
const groups = {};
return (h("lar-list", null, header, map(entries, entry => {
// tslint:disable-next-line: no-shadowed-variable
let header;
if (!groups[entry.group]) {
groups[entry.group] = entry.group;
header = (h("lar-list-header", null, entry.group));
}
return (h("div", null, header ? header : null, h("lar-list-item", null, h("div", { slot: "start" }, entry.start), h("div", null, entry.content), h("div", { slot: "end" }, entry.end))));
})));
}
};
LogEntryList.style = utilityLogCss;
export { LogEntryList as lar_utility_log };
//# sourceMappingURL=lar-utility-log.entry.js.map