mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-23 09:16:38 +00:00
Fix filtering hidden columns entity table (#7786)
This commit is contained in:
parent
1d367eca69
commit
3ea5bb2a6c
@ -31,7 +31,6 @@ import "../../../common/search/search-input";
|
|||||||
import { LocalizeFunc } from "../../../common/translations/localize";
|
import { LocalizeFunc } from "../../../common/translations/localize";
|
||||||
import type {
|
import type {
|
||||||
DataTableColumnContainer,
|
DataTableColumnContainer,
|
||||||
DataTableColumnData,
|
|
||||||
RowClickedEvent,
|
RowClickedEvent,
|
||||||
SelectionChangedEvent,
|
SelectionChangedEvent,
|
||||||
} from "../../../components/data-table/ha-data-table";
|
} from "../../../components/data-table/ha-data-table";
|
||||||
@ -156,27 +155,53 @@ export class HaConfigEntities extends SubscribeMixin(LitElement) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
private _columns = memoize(
|
private _columns = memoize(
|
||||||
(narrow, _language): DataTableColumnContainer => {
|
(narrow, _language): DataTableColumnContainer => ({
|
||||||
const columns: DataTableColumnContainer = {
|
icon: {
|
||||||
icon: {
|
title: "",
|
||||||
title: "",
|
type: "icon",
|
||||||
type: "icon",
|
template: (icon) => html`
|
||||||
template: (icon) => html`
|
<ha-icon slot="item-icon" .icon=${icon}></ha-icon>
|
||||||
<ha-icon slot="item-icon" .icon=${icon}></ha-icon>
|
`,
|
||||||
`,
|
},
|
||||||
},
|
name: {
|
||||||
name: {
|
title: this.hass.localize(
|
||||||
title: this.hass.localize(
|
"ui.panel.config.entities.picker.headers.name"
|
||||||
"ui.panel.config.entities.picker.headers.name"
|
),
|
||||||
),
|
sortable: true,
|
||||||
sortable: true,
|
filterable: true,
|
||||||
filterable: true,
|
direction: "asc",
|
||||||
direction: "asc",
|
grows: true,
|
||||||
grows: true,
|
template: narrow
|
||||||
},
|
? (name, entity: any) =>
|
||||||
};
|
html`
|
||||||
|
${name}<br />
|
||||||
const statusColumn: DataTableColumnData = {
|
${entity.entity_id} |
|
||||||
|
${this.hass.localize(`component.${entity.platform}.title`) ||
|
||||||
|
entity.platform}
|
||||||
|
`
|
||||||
|
: undefined,
|
||||||
|
},
|
||||||
|
entity_id: {
|
||||||
|
title: this.hass.localize(
|
||||||
|
"ui.panel.config.entities.picker.headers.entity_id"
|
||||||
|
),
|
||||||
|
hidden: narrow,
|
||||||
|
sortable: true,
|
||||||
|
filterable: true,
|
||||||
|
width: "25%",
|
||||||
|
},
|
||||||
|
platform: {
|
||||||
|
title: this.hass.localize(
|
||||||
|
"ui.panel.config.entities.picker.headers.integration"
|
||||||
|
),
|
||||||
|
hidden: narrow,
|
||||||
|
sortable: true,
|
||||||
|
filterable: true,
|
||||||
|
width: "20%",
|
||||||
|
template: (platform) =>
|
||||||
|
this.hass.localize(`component.${platform}.title`) || platform,
|
||||||
|
},
|
||||||
|
status: {
|
||||||
title: this.hass.localize(
|
title: this.hass.localize(
|
||||||
"ui.panel.config.entities.picker.headers.status"
|
"ui.panel.config.entities.picker.headers.status"
|
||||||
),
|
),
|
||||||
@ -223,43 +248,8 @@ export class HaConfigEntities extends SubscribeMixin(LitElement) {
|
|||||||
</div>
|
</div>
|
||||||
`
|
`
|
||||||
: "",
|
: "",
|
||||||
};
|
},
|
||||||
|
})
|
||||||
if (narrow) {
|
|
||||||
columns.name.template = (name, entity: any) => {
|
|
||||||
return html`
|
|
||||||
${name}<br />
|
|
||||||
${entity.entity_id} |
|
|
||||||
${this.hass.localize(`component.${entity.platform}.title`) ||
|
|
||||||
entity.platform}
|
|
||||||
`;
|
|
||||||
};
|
|
||||||
columns.status = statusColumn;
|
|
||||||
return columns;
|
|
||||||
}
|
|
||||||
|
|
||||||
columns.entity_id = {
|
|
||||||
title: this.hass.localize(
|
|
||||||
"ui.panel.config.entities.picker.headers.entity_id"
|
|
||||||
),
|
|
||||||
sortable: true,
|
|
||||||
filterable: true,
|
|
||||||
width: "25%",
|
|
||||||
};
|
|
||||||
columns.platform = {
|
|
||||||
title: this.hass.localize(
|
|
||||||
"ui.panel.config.entities.picker.headers.integration"
|
|
||||||
),
|
|
||||||
sortable: true,
|
|
||||||
filterable: true,
|
|
||||||
width: "20%",
|
|
||||||
template: (platform) =>
|
|
||||||
this.hass.localize(`component.${platform}.title`) || platform,
|
|
||||||
};
|
|
||||||
columns.status = statusColumn;
|
|
||||||
|
|
||||||
return columns;
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
|
|
||||||
private _filteredEntities = memoize(
|
private _filteredEntities = memoize(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user