Add label to collapse button in data table groups (#25653)

This commit is contained in:
Bram Kragten 2025-05-30 16:47:54 +02:00 committed by GitHub
parent 5ed816df6d
commit 768f27b1b9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 3 deletions

View File

@ -740,6 +740,7 @@ export class HaDataTable extends LitElement {
}, {}); }, {});
const groupedItems: DataTableRowData[] = []; const groupedItems: DataTableRowData[] = [];
Object.entries(sorted).forEach(([groupName, rows]) => { Object.entries(sorted).forEach(([groupName, rows]) => {
const collapsed = collapsedGroups.includes(groupName);
groupedItems.push({ groupedItems.push({
append: true, append: true,
selectable: false, selectable: false,
@ -751,9 +752,10 @@ export class HaDataTable extends LitElement {
> >
<ha-icon-button <ha-icon-button
.path=${mdiChevronUp} .path=${mdiChevronUp}
class=${collapsedGroups.includes(groupName) .label=${this.hass.localize(
? "collapsed" `ui.components.data-table.${collapsed ? "expand" : "collapse"}`
: ""} )}
class=${collapsed ? "collapsed" : ""}
> >
</ha-icon-button> </ha-icon-button>
${groupName === UNDEFINED_GROUP_KEY ${groupName === UNDEFINED_GROUP_KEY

View File

@ -902,6 +902,8 @@
"hidden": "{number} hidden", "hidden": "{number} hidden",
"clear": "Clear", "clear": "Clear",
"ungrouped": "Ungrouped", "ungrouped": "Ungrouped",
"collapse": "Collapse",
"expand": "Expand",
"settings": { "settings": {
"header": "Customize", "header": "Customize",
"hide": "Hide column {title}", "hide": "Hide column {title}",