mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-27 03:06:41 +00:00
Correct glance card size (#6109)
This commit is contained in:
parent
67ac3b4ba3
commit
30442b25c0
@ -69,14 +69,24 @@ export class HuiGlanceCard extends LitElement implements LovelaceCard {
|
|||||||
return (
|
return (
|
||||||
(this._config!.title ? 1 : 0) +
|
(this._config!.title ? 1 : 0) +
|
||||||
Math.max(
|
Math.max(
|
||||||
Math.ceil(this._configEntities!.length / (this._config!.columns || 5)),
|
((this._config!.show_icon ? 1 : 0) +
|
||||||
|
(this._config!.show_name && this._config!.show_state ? 1 : 0)) *
|
||||||
|
Math.ceil(
|
||||||
|
this._configEntities!.length / (this._config!.columns || 5)
|
||||||
|
),
|
||||||
1
|
1
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public setConfig(config: GlanceCardConfig): void {
|
public setConfig(config: GlanceCardConfig): void {
|
||||||
this._config = { state_color: true, ...config };
|
this._config = {
|
||||||
|
show_name: true,
|
||||||
|
show_state: true,
|
||||||
|
show_icon: true,
|
||||||
|
state_color: true,
|
||||||
|
...config,
|
||||||
|
};
|
||||||
const entities = processConfigEntities<GlanceConfigEntity>(config.entities);
|
const entities = processConfigEntities<GlanceConfigEntity>(config.entities);
|
||||||
|
|
||||||
for (const entity of entities) {
|
for (const entity of entities) {
|
||||||
@ -234,7 +244,7 @@ export class HuiGlanceCard extends LitElement implements LovelaceCard {
|
|||||||
hasAction(entityConf.tap_action) ? "0" : undefined
|
hasAction(entityConf.tap_action) ? "0" : undefined
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
${this._config!.show_name !== false
|
${this._config!.show_name
|
||||||
? html`
|
? html`
|
||||||
<div class="name">
|
<div class="name">
|
||||||
${"name" in entityConf
|
${"name" in entityConf
|
||||||
@ -243,7 +253,7 @@ export class HuiGlanceCard extends LitElement implements LovelaceCard {
|
|||||||
</div>
|
</div>
|
||||||
`
|
`
|
||||||
: ""}
|
: ""}
|
||||||
${this._config!.show_icon !== false
|
${this._config!.show_icon
|
||||||
? html`
|
? html`
|
||||||
<state-badge
|
<state-badge
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
@ -256,7 +266,7 @@ export class HuiGlanceCard extends LitElement implements LovelaceCard {
|
|||||||
></state-badge>
|
></state-badge>
|
||||||
`
|
`
|
||||||
: ""}
|
: ""}
|
||||||
${this._config!.show_state !== false && entityConf.show_state !== false
|
${this._config!.show_state && entityConf.show_state !== false
|
||||||
? html`
|
? html`
|
||||||
<div>
|
<div>
|
||||||
${computeDomain(entityConf.entity) === "sensor" &&
|
${computeDomain(entityConf.entity) === "sensor" &&
|
||||||
|
Loading…
x
Reference in New Issue
Block a user