Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@ class SliderEntityRow extends LitElement {
@property() hide_state: boolean;
@query("ha-slider") _slider?;

getDirection() {
const dir =
this.ctrl.dir ??
this.hass.translationMetadata.translations[this.hass.language || "en"]
.isRTL
? "rtl"
: "ltr";
return dir;
}

setConfig(config: ControllerConfig) {
this._config = config;
if (!config.entity) throw new Error(`No entity specified.`);
Expand Down Expand Up @@ -58,6 +68,7 @@ class SliderEntityRow extends LitElement {
async connectedCallback() {
super.connectedCallback();
await this.resized();
this._slider?.setAttribute("dir", this.getDirection());
}

render() {
Expand All @@ -74,12 +85,7 @@ class SliderEntityRow extends LitElement {
</hui-warning>
`;

const dir =
c.dir ??
this.hass.translationMetadata.translations[this.hass.language || "en"]
.isRTL
? "rtl"
: "ltr";
const dir = this.getDirection();

const showSlider =
c.stateObj.state !== "unavailable" &&
Expand Down