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

View File

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

View File

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