mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +00:00
Use localize func in table settings dialog (#21335)
This commit is contained in:
parent
e7a749ef7d
commit
c85e29f2bb
@ -78,6 +78,8 @@ export class DialogDataTableSettings extends LitElement {
|
|||||||
return nothing;
|
return nothing;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const localize = this._params.localizeFunc || this.hass.localize;
|
||||||
|
|
||||||
const columns = this._sortedColumns(
|
const columns = this._sortedColumns(
|
||||||
this._params.columns,
|
this._params.columns,
|
||||||
this._columnOrder,
|
this._columnOrder,
|
||||||
@ -90,7 +92,7 @@ export class DialogDataTableSettings extends LitElement {
|
|||||||
@closed=${this.closeDialog}
|
@closed=${this.closeDialog}
|
||||||
.heading=${createCloseHeading(
|
.heading=${createCloseHeading(
|
||||||
this.hass,
|
this.hass,
|
||||||
this.hass.localize("ui.components.data-table.settings.header")
|
localize("ui.components.data-table.settings.header")
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<ha-sortable
|
<ha-sortable
|
||||||
@ -146,12 +148,10 @@ export class DialogDataTableSettings extends LitElement {
|
|||||||
</mwc-list>
|
</mwc-list>
|
||||||
</ha-sortable>
|
</ha-sortable>
|
||||||
<ha-button slot="secondaryAction" @click=${this._reset}
|
<ha-button slot="secondaryAction" @click=${this._reset}
|
||||||
>${this.hass.localize(
|
>${localize("ui.components.data-table.settings.restore")}</ha-button
|
||||||
"ui.components.data-table.settings.restore"
|
|
||||||
)}</ha-button
|
|
||||||
>
|
>
|
||||||
<ha-button slot="primaryAction" @click=${this.closeDialog}>
|
<ha-button slot="primaryAction" @click=${this.closeDialog}>
|
||||||
${this.hass.localize("ui.components.data-table.settings.done")}
|
${localize("ui.components.data-table.settings.done")}
|
||||||
</ha-button>
|
</ha-button>
|
||||||
</ha-dialog>
|
</ha-dialog>
|
||||||
`;
|
`;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { fireEvent } from "../../common/dom/fire_event";
|
import { fireEvent } from "../../common/dom/fire_event";
|
||||||
|
import { LocalizeFunc } from "../../common/translations/localize";
|
||||||
import { DataTableColumnContainer } from "./ha-data-table";
|
import { DataTableColumnContainer } from "./ha-data-table";
|
||||||
|
|
||||||
export interface DataTableSettingsDialogParams {
|
export interface DataTableSettingsDialogParams {
|
||||||
@ -9,6 +10,7 @@ export interface DataTableSettingsDialogParams {
|
|||||||
) => void;
|
) => void;
|
||||||
hiddenColumns?: string[];
|
hiddenColumns?: string[];
|
||||||
columnOrder?: string[];
|
columnOrder?: string[];
|
||||||
|
localizeFunc?: LocalizeFunc;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const loadDataTableSettingsDialog = () =>
|
export const loadDataTableSettingsDialog = () =>
|
||||||
|
@ -638,6 +638,7 @@ export class HaTabsSubpageDataTable extends LitElement {
|
|||||||
this.hiddenColumns = hiddenColumns;
|
this.hiddenColumns = hiddenColumns;
|
||||||
fireEvent(this, "columns-changed", { columnOrder, hiddenColumns });
|
fireEvent(this, "columns-changed", { columnOrder, hiddenColumns });
|
||||||
},
|
},
|
||||||
|
localizeFunc: this.localizeFunc,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user