mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-08 09:56:36 +00:00
Glue percent sign (#13458)
This commit is contained in:
parent
dff3ffe935
commit
2475f6bd41
@ -75,6 +75,10 @@ const ENTITIES = [
|
|||||||
timestamp: 1641801600,
|
timestamp: 1641801600,
|
||||||
friendly_name: "Date and Time",
|
friendly_name: "Date and Time",
|
||||||
}),
|
}),
|
||||||
|
getEntity("sensor", "humidity", "23.2", {
|
||||||
|
friendly_name: "Humidity",
|
||||||
|
unit_of_measurement: "%",
|
||||||
|
}),
|
||||||
getEntity("input_select", "dropdown", "Soda", {
|
getEntity("input_select", "dropdown", "Soda", {
|
||||||
friendly_name: "Dropdown",
|
friendly_name: "Dropdown",
|
||||||
options: ["Soda", "Beer", "Wine"],
|
options: ["Soda", "Beer", "Wine"],
|
||||||
@ -142,6 +146,7 @@ const CONFIGS = [
|
|||||||
- light.non_existing
|
- light.non_existing
|
||||||
- climate.ecobee
|
- climate.ecobee
|
||||||
- input_number.number
|
- input_number.number
|
||||||
|
- sensor.humidity
|
||||||
`,
|
`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -64,9 +64,12 @@ export const computeStateDisplayFromEntityAttributes = (
|
|||||||
// fallback to default
|
// fallback to default
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return `${formatNumber(state, locale)}${
|
const unit = !attributes.unit_of_measurement
|
||||||
attributes.unit_of_measurement ? " " + attributes.unit_of_measurement : ""
|
? ""
|
||||||
}`;
|
: attributes.unit_of_measurement === "%"
|
||||||
|
? "%"
|
||||||
|
: ` ${attributes.unit_of_measurement}`;
|
||||||
|
return `${formatNumber(state, locale)}${unit}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
const domain = computeDomain(entityId);
|
const domain = computeDomain(entityId);
|
||||||
|
@ -132,7 +132,9 @@ export class Gauge extends LitElement {
|
|||||||
this._segment_label
|
this._segment_label
|
||||||
? this._segment_label
|
? this._segment_label
|
||||||
: this.valueText || formatNumber(this.value, this.locale)
|
: this.valueText || formatNumber(this.value, this.locale)
|
||||||
} ${this._segment_label ? "" : this.label}
|
}${
|
||||||
|
this._segment_label ? "" : this.label === "%" ? "%" : ` ${this.label}`
|
||||||
|
}
|
||||||
</text>
|
</text>
|
||||||
</svg>`;
|
</svg>`;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user