mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +00:00
Add title when text in datatable doesnt fit (#20590)
This commit is contained in:
parent
8239f6dd60
commit
8ab61b5468
@ -450,6 +450,8 @@ export class HaDataTable extends LitElement {
|
|||||||
}
|
}
|
||||||
return html`
|
return html`
|
||||||
<div
|
<div
|
||||||
|
@mouseover=${this._setTitle}
|
||||||
|
@focus=${this._setTitle}
|
||||||
role=${column.main ? "rowheader" : "cell"}
|
role=${column.main ? "rowheader" : "cell"}
|
||||||
class="mdc-data-table__cell ${classMap({
|
class="mdc-data-table__cell ${classMap({
|
||||||
"mdc-data-table__cell--flex": column.type === "flex",
|
"mdc-data-table__cell--flex": column.type === "flex",
|
||||||
@ -675,6 +677,13 @@ export class HaDataTable extends LitElement {
|
|||||||
fireEvent(this, "row-click", { id: rowId }, { bubbles: false });
|
fireEvent(this, "row-click", { id: rowId }, { bubbles: false });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private _setTitle(ev: Event) {
|
||||||
|
const target = ev.currentTarget as HTMLElement;
|
||||||
|
if (target.scrollWidth > target.offsetWidth) {
|
||||||
|
target.setAttribute("title", target.innerText);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private _checkedRowsChanged() {
|
private _checkedRowsChanged() {
|
||||||
// force scroller to update, change it's items
|
// force scroller to update, change it's items
|
||||||
if (this._items.length) {
|
if (this._items.length) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user