mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-28 03:36:44 +00:00
Merge pull request #6417 from yosilevy/RTL-date-selector
RTL fix for range list
This commit is contained in:
commit
d7e1e9e284
@ -17,6 +17,7 @@ import "./ha-svg-icon";
|
||||
import "@polymer/paper-input/paper-input";
|
||||
import "@material/mwc-list/mwc-list";
|
||||
import "./date-range-picker";
|
||||
import { computeRTLDirection } from "../common/util/compute_rtl";
|
||||
|
||||
export interface DateRangePickerRanges {
|
||||
[key: string]: [Date, Date];
|
||||
@ -36,11 +37,14 @@ export class HaDateRangePicker extends LitElement {
|
||||
|
||||
@property({ type: Boolean }) private _hour24format = false;
|
||||
|
||||
@property({ type: String }) private _rtlDirection = "ltr";
|
||||
|
||||
protected updated(changedProps: PropertyValues) {
|
||||
if (changedProps.has("hass")) {
|
||||
const oldHass = changedProps.get("hass") as HomeAssistant | undefined;
|
||||
if (!oldHass || oldHass.language !== this.hass.language) {
|
||||
this._hour24format = this._compute24hourFormat();
|
||||
this._rtlDirection = computeRTLDirection(this.hass);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -76,7 +80,11 @@ export class HaDateRangePicker extends LitElement {
|
||||
></paper-input>
|
||||
</div>
|
||||
${this.ranges
|
||||
? html`<div slot="ranges" class="date-range-ranges">
|
||||
? html`<div
|
||||
slot="ranges"
|
||||
class="date-range-ranges"
|
||||
.dir=${this._rtlDirection}
|
||||
>
|
||||
<mwc-list @request-selected=${this._setDateRange}>
|
||||
${Object.entries(this.ranges).map(
|
||||
([name, dates]) => html`<mwc-list-item
|
||||
|
Loading…
x
Reference in New Issue
Block a user