Fixed comments

This commit is contained in:
Yosi Levy 2020-07-18 06:48:36 +03:00
parent 7bced28327
commit 689febda60

View File

@ -8,7 +8,6 @@ import {
TemplateResult, TemplateResult,
PropertyValues, PropertyValues,
} from "lit-element"; } from "lit-element";
import { classMap } from "lit-html/directives/class-map";
import { HomeAssistant } from "../types"; import { HomeAssistant } from "../types";
import { mdiCalendar } from "@mdi/js"; import { mdiCalendar } from "@mdi/js";
import { formatDateTime } from "../common/datetime/format_date_time"; import { formatDateTime } from "../common/datetime/format_date_time";
@ -18,7 +17,7 @@ import "./ha-svg-icon";
import "@polymer/paper-input/paper-input"; import "@polymer/paper-input/paper-input";
import "@material/mwc-list/mwc-list"; import "@material/mwc-list/mwc-list";
import "./date-range-picker"; import "./date-range-picker";
import { computeRTL } from "../common/util/compute_rtl"; import { computeRTLDirection } from "../common/util/compute_rtl";
export interface DateRangePickerRanges { export interface DateRangePickerRanges {
[key: string]: [Date, Date]; [key: string]: [Date, Date];
@ -38,7 +37,7 @@ export class HaDateRangePicker extends LitElement {
@property({ type: Boolean }) private _hour24format = false; @property({ type: Boolean }) private _hour24format = false;
@property({ type: Boolean }) private _rtl = false; @property({ type: String }) private _rtlDirection = "ltr";
protected updated(changedProps: PropertyValues) { protected updated(changedProps: PropertyValues) {
if (changedProps.has("hass")) { if (changedProps.has("hass")) {
@ -46,8 +45,11 @@ export class HaDateRangePicker extends LitElement {
if (!oldHass || oldHass.language !== this.hass.language) { if (!oldHass || oldHass.language !== this.hass.language) {
this._hour24format = this._compute24hourFormat(); this._hour24format = this._compute24hourFormat();
} }
if (!oldHass || computeRTL(oldHass) !== computeRTL(this.hass)) { if (
this._rtl = computeRTL(this.hass); !oldHass ||
computeRTLDirection(oldHass) !== computeRTLDirection(this.hass)
) {
this._rtlDirection = computeRTLDirection(this.hass);
} }
} }
} }
@ -85,7 +87,8 @@ export class HaDateRangePicker extends LitElement {
${this.ranges ${this.ranges
? html`<div ? html`<div
slot="ranges" slot="ranges"
class=${classMap({ "date-range-ranges": true, rtl: this._rtl })} class="date-range-ranges"
.dir=${this._rtlDirection}
> >
<mwc-list @click=${this._setDateRange}> <mwc-list @click=${this._setDateRange}>
${Object.entries(this.ranges).map( ${Object.entries(this.ranges).map(