Fix yaml editor behavior of statistics graph card (#15742)

This commit is contained in:
karwosts 2023-03-06 00:49:42 -08:00 committed by GitHub
parent 40b9e62a87
commit 98e21370fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 0 deletions

View File

@ -30,6 +30,9 @@ export class HaStatisticPicker extends LitElement {
@property({ attribute: "statistic-types" })
public statisticTypes?: "mean" | "sum";
@property({ type: Boolean, attribute: "allow-custom-entity" })
public allowCustomEntity;
@property({ type: Array }) public statisticIds?: StatisticsMetaData[];
@property({ type: Boolean }) public disabled?: boolean;
@ -245,6 +248,7 @@ export class HaStatisticPicker extends LitElement {
.value=${this._value}
.renderer=${this._rowRenderer}
.disabled=${this.disabled}
.allowCustomValue=${this.allowCustomEntity}
item-value-path="id"
item-id-path="id"
item-label-path="name"

View File

@ -22,6 +22,9 @@ class HaStatisticsPicker extends LitElement {
@property({ attribute: "pick-statistic-label" })
public pickStatisticLabel?: string;
@property({ type: Boolean, attribute: "allow-custom-entity" })
public allowCustomEntity;
/**
* Show only statistics natively stored with these units of measurements.
* @attr include-statistics-unit-of-measurement
@ -88,6 +91,7 @@ class HaStatisticsPicker extends LitElement {
.statisticTypes=${includeStatisticTypesCurrent}
.statisticIds=${this.statisticIds}
.label=${this.pickedStatisticLabel}
.allowCustomEntity=${this.allowCustomEntity}
@value-changed=${this._statisticChanged}
></ha-statistic-picker>
</div>
@ -103,6 +107,7 @@ class HaStatisticsPicker extends LitElement {
.statisticTypes=${this.statisticTypes}
.statisticIds=${this.statisticIds}
.label=${this.pickStatisticLabel}
.allowCustomEntity=${this.allowCustomEntity}
@value-changed=${this._addStatistic}
></ha-statistic-picker>
</div>

View File

@ -274,6 +274,7 @@ export class HuiStatisticsGraphCardEditor
@value-changed=${this._valueChanged}
></ha-form>
<ha-statistics-picker
allow-custom-entity
.hass=${this.hass}
.pickStatisticLabel=${this.hass!.localize(
"ui.panel.lovelace.editor.card.statistics-graph.pick_statistic"