Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/components/data-table/ha-data-table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ export class HaDataTable extends LitElement {

@property({ type: Boolean }) public selectable = false;

@property({ type: Boolean }) public clickable = false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about the name clickable, but don't really have a good alternative either.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For me it makes sense since the event is also called @click and that is basically what the new property is logically tied to. Would be even nicer, if we could detect if that event callback is attached, but I did not find a way to do so.


@property({ type: Boolean }) public hasFab = false;

@property({ type: Boolean, attribute: "auto-height" })
Expand Down Expand Up @@ -333,6 +335,7 @@ export class HaDataTable extends LitElement {
"mdc-data-table__row--selected": this._checkedRows.includes(
String(row[this.id])
),
clickable: this.clickable,
})}"
aria-selected=${ifDefined(
this._checkedRows.includes(String(row[this.id]))
Expand Down Expand Up @@ -886,6 +889,9 @@ export class HaDataTable extends LitElement {
.forceLTR {
direction: ltr;
}
.clickable {
cursor: pointer;
}
`;
}
}
Expand Down
7 changes: 7 additions & 0 deletions src/layouts/hass-tabs-subpage-data-table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ export class HaTabsSubpageDataTable extends LitElement {
*/
@property({ type: Boolean }) public selectable = false;

/**
* Should rows be clickable.
* @type {Boolean}
*/
@property({ type: Boolean }) public clickable = false;

/**
* Do we need to add padding for a fab.
* @type {Boolean}
Expand Down Expand Up @@ -164,6 +170,7 @@ export class HaTabsSubpageDataTable extends LitElement {
.id=${this.id}
.noDataText=${this.noDataText}
.dir=${computeRTLDirection(this.hass)}
.clickable=${this.clickable}
>
${!this.narrow
? html`
Expand Down
1 change: 1 addition & 0 deletions src/panels/config/areas/ha-config-areas-dashboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ export class HaConfigAreasDashboard extends LitElement {
)}
id="area_id"
hasFab
clickable
>
<ha-icon-button
slot="toolbar-icon"
Expand Down
1 change: 1 addition & 0 deletions src/panels/config/devices/ha-config-devices-dashboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ export class HaConfigDeviceDashboard extends LitElement {
this.hass.localize
)}
@row-click=${this._handleRowClicked}
clickable
>
</hass-tabs-subpage-data-table>
`;
Expand Down
1 change: 1 addition & 0 deletions src/panels/config/entities/ha-config-entities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,7 @@ export class HaConfigEntities extends SubscribeMixin(LitElement) {
.data=${entityData}
.filter=${this._filter}
selectable
clickable
@selection-changed=${this._handleSelectionChanged}
@row-click=${this._openEditEntry}
id="entity_id"
Expand Down
1 change: 1 addition & 0 deletions src/panels/config/helpers/ha-config-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ export class HaConfigHelpers extends LitElement {
.data=${this._getItems(this._stateItems)}
@row-click=${this._openEditDialog}
hasFab
clickable
.noDataText=${this.hass.localize(
"ui.panel.config.helpers.picker.no_helpers"
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ class OZWNetworkNodes extends LitElement {
.data=${this._nodes}
id="node_id"
@row-click=${this._handleRowClicked}
clickable
>
</hass-tabs-subpage-data-table>
`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ export class ZHAGroupsDashboard extends LitElement {
.columns=${this._columns(this.narrow)}
.data=${this._formattedGroups(this._groups)}
@row-click=${this._handleRowClicked}
clickable
>
<a href="/config/zha/group-add" slot="fab">
<mwc-fab
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ export class HaConfigLovelaceDashboards extends LitElement {
@row-click=${this._editDashboard}
id="url_path"
hasFab
clickable
>
<mwc-fab
slot="fab"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ export class HaConfigLovelaceRescources extends LitElement {
)}
@row-click=${this._editResource}
hasFab
clickable
>
<mwc-fab
slot="fab"
Expand Down
1 change: 1 addition & 0 deletions src/panels/config/users/ha-config-users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ export class HaConfigUsers extends LitElement {
.data=${this._users}
@row-click=${this._editUser}
hasFab
clickable
>
<mwc-fab
slot="fab"
Expand Down