New "clickable" property for <ha-data-table> (#7351)

This commit is contained in:
Philip Allgaier 2020-10-15 15:57:05 +02:00 committed by GitHub
parent ce80285f8d
commit 47f0d74812
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 22 additions and 0 deletions

View File

@ -94,6 +94,8 @@ export class HaDataTable extends LitElement {
@property({ type: Boolean }) public selectable = false;
@property({ type: Boolean }) public clickable = false;
@property({ type: Boolean }) public hasFab = false;
@property({ type: Boolean, attribute: "auto-height" })
@ -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]))
@ -886,6 +889,9 @@ export class HaDataTable extends LitElement {
.forceLTR {
direction: ltr;
}
.clickable {
cursor: pointer;
}
`;
}
}

View File

@ -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}
@ -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`

View File

@ -117,6 +117,7 @@ export class HaConfigAreasDashboard extends LitElement {
)}
id="area_id"
hasFab
clickable
>
<ha-icon-button
slot="toolbar-icon"

View File

@ -310,6 +310,7 @@ export class HaConfigDeviceDashboard extends LitElement {
this.hass.localize
)}
@row-click=${this._handleRowClicked}
clickable
>
</hass-tabs-subpage-data-table>
`;

View File

@ -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"

View File

@ -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"
)}

View File

@ -117,6 +117,7 @@ class OZWNetworkNodes extends LitElement {
.data=${this._nodes}
id="node_id"
@row-click=${this._handleRowClicked}
clickable
>
</hass-tabs-subpage-data-table>
`;

View File

@ -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

View File

@ -221,6 +221,7 @@ export class HaConfigLovelaceDashboards extends LitElement {
@row-click=${this._editDashboard}
id="url_path"
hasFab
clickable
>
<mwc-fab
slot="fab"

View File

@ -101,6 +101,7 @@ export class HaConfigLovelaceRescources extends LitElement {
)}
@row-click=${this._editResource}
hasFab
clickable
>
<mwc-fab
slot="fab"

View File

@ -96,6 +96,7 @@ export class HaConfigUsers extends LitElement {
.data=${this._users}
@row-click=${this._editUser}
hasFab
clickable
>
<mwc-fab
slot="fab"