From 0ac4b8508b96f4acf4ef473fda3d6074a83e6bee Mon Sep 17 00:00:00 2001
From: Dave T <17680170+davet2001@users.noreply.github.com>
Date: Sun, 27 Oct 2024 23:15:14 +0000
Subject: [PATCH] Adjust wrapping rules to prevent more than 2 line consumers
---
src/elec-sankey.ts | 3 +++
src/ha-elec-sankey.ts | 27 +++++++++++----------------
2 files changed, 14 insertions(+), 16 deletions(-)
diff --git a/src/elec-sankey.ts b/src/elec-sankey.ts
index 56755e7..0b29b68 100644
--- a/src/elec-sankey.ts
+++ b/src/elec-sankey.ts
@@ -1174,6 +1174,9 @@ export class ElecSankey extends LitElement {
flex-shrink: 0;
justify-content: left;
padding-left: 6px;
+ white-space: pre;
+ overflow: hidden;
+ text-overflow: ellipsis;
}
svg {
rect {
diff --git a/src/ha-elec-sankey.ts b/src/ha-elec-sankey.ts
index da7ca63..b7faebd 100644
--- a/src/ha-elec-sankey.ts
+++ b/src/ha-elec-sankey.ts
@@ -44,31 +44,26 @@ export class HaElecSankey extends ElecSankey {
class=${id ? "label label-action-clickable" : "label"}
id=${_id}
@click=${id ? this._handleMoreInfo : nothing}
- >
- ${_name || nothing}
- ${icon
- ? html`
`
- : nothing}
- ${valueB !== undefined
- ? html`
+ >${_name || nothing} ${icon
+ ? html` `
+ : nothing}${valueB !== undefined
+ ? html`
${formatNumber(valueB, this.hass.locale, {
- maximumFractionDigits: 1,
- })} ${this.unit}
${formatNumber(valueA, this.hass.locale, {
- maximumFractionDigits: 1,
- })} ${this.unit}
+ maximumFractionDigits: 0,
+ })} ${this.unit}
`
- : html`${formatNumber(valueA, this.hass.locale, {
- maximumFractionDigits: 1,
- })} ${this.unit}`}
-
- `;
+ : html`
${formatNumber(valueA, this.hass.locale, {
+ maximumFractionDigits: 0,
+ })} ${this.unit}`}`;
}
private _handleMoreInfo(e: MouseEvent) {