Skip to content

Commit

Permalink
Rename base sankey chart tag so it doesn't conflict with the custom c…
Browse files Browse the repository at this point in the history
…ard (#23600)
  • Loading branch information
MindFreeze authored Jan 6, 2025
1 parent 3d1817a commit 63c658e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ const NODE_WIDTH = 15;
const FONT_SIZE = 12;
const MIN_DISTANCE = FONT_SIZE / 2;

@customElement("sankey-chart")
export class SankeyChart extends LitElement {
@customElement("ha-sankey-chart")
export class HaSankeyChart extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;

@property({ attribute: false }) public data: SankeyChartData = {
Expand Down Expand Up @@ -539,6 +539,6 @@ export class SankeyChart extends LitElement {

declare global {
interface HTMLElementTagNameMap {
"sankey-chart": SankeyChart;
"ha-sankey-chart": HaSankeyChart;
}
}
8 changes: 4 additions & 4 deletions src/panels/lovelace/cards/energy/hui-energy-sankey-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import { SubscribeMixin } from "../../../../mixins/subscribe-mixin";
import type { HomeAssistant } from "../../../../types";
import type { LovelaceCard, LovelaceGridOptions } from "../../types";
import type { EnergySankeyCardConfig } from "../types";
import "../../../../components/chart/sankey-chart";
import type { Link, Node } from "../../../../components/chart/sankey-chart";
import "../../../../components/chart/ha-sankey-chart";
import type { Link, Node } from "../../../../components/chart/ha-sankey-chart";
import { getGraphColorByIndex } from "../../../../common/color/colors";
import { formatNumber } from "../../../../common/number/format_number";

Expand Down Expand Up @@ -399,13 +399,13 @@ class HuiEnergySankeyCard
<ha-card .header=${this._config.title}>
<div class="card-content">
${hasData
? html`<sankey-chart
? html`<ha-sankey-chart
.data=${{ nodes, links }}
.vertical=${this._config.layout === "vertical"}
.loadingText=${this.hass.localize(
"ui.panel.lovelace.cards.energy.loading"
)}
></sankey-chart>`
></ha-sankey-chart>`
: html`${this.hass.localize(
"ui.panel.lovelace.cards.energy.no_data_period"
)}`}
Expand Down

0 comments on commit 63c658e

Please sign in to comment.