mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-21 16:26:43 +00:00
Merge pull request #5372 from dmulcahey/dm/zha-tables-clear-selections
Clear selections in ZHA data tables
This commit is contained in:
commit
0bfa8260fa
@ -6,6 +6,7 @@ import {
|
||||
css,
|
||||
CSSResult,
|
||||
PropertyValues,
|
||||
query,
|
||||
} from "lit-element";
|
||||
|
||||
import "../../../layouts/hass-subpage";
|
||||
@ -18,7 +19,7 @@ import {
|
||||
addGroup,
|
||||
ZHAGroup,
|
||||
} from "../../../data/zha";
|
||||
import "./zha-devices-data-table";
|
||||
import { ZHADevicesDataTable } from "./zha-devices-data-table";
|
||||
import { SelectionChangedEvent } from "../../../components/data-table/ha-data-table";
|
||||
import { navigate } from "../../../common/navigate";
|
||||
import { PolymerChangedEvent } from "../../../polymer-types";
|
||||
@ -34,6 +35,8 @@ export class ZHAAddGroupPage extends LitElement {
|
||||
@property() public devices: ZHADevice[] = [];
|
||||
@property() private _processingAdd: boolean = false;
|
||||
@property() private _groupName: string = "";
|
||||
@query("zha-devices-data-table")
|
||||
private _zhaDevicesDataTable!: ZHADevicesDataTable;
|
||||
|
||||
private _firstUpdatedCalled: boolean = false;
|
||||
private _selectedDevicesToAdd: string[] = [];
|
||||
@ -130,6 +133,7 @@ export class ZHAAddGroupPage extends LitElement {
|
||||
this._selectedDevicesToAdd = [];
|
||||
this._processingAdd = false;
|
||||
this._groupName = "";
|
||||
this._zhaDevicesDataTable.clearSelection();
|
||||
navigate(this, `/config/zha/group/${group.group_id}`, true);
|
||||
}
|
||||
|
||||
|
@ -9,10 +9,14 @@ import {
|
||||
TemplateResult,
|
||||
property,
|
||||
customElement,
|
||||
query,
|
||||
} from "lit-element";
|
||||
import { HomeAssistant } from "../../../types";
|
||||
// tslint:disable-next-line
|
||||
import { DataTableColumnContainer } from "../../../components/data-table/ha-data-table";
|
||||
import {
|
||||
DataTableColumnContainer,
|
||||
HaDataTable,
|
||||
} from "../../../components/data-table/ha-data-table";
|
||||
// tslint:disable-next-line
|
||||
import { Cluster } from "../../../data/zha";
|
||||
import { formatAsPaddedHex } from "./functions";
|
||||
@ -27,6 +31,7 @@ export class ZHAClustersDataTable extends LitElement {
|
||||
@property() public hass!: HomeAssistant;
|
||||
@property() public narrow = false;
|
||||
@property() public clusters: Cluster[] = [];
|
||||
@query("ha-data-table") private _dataTable!: HaDataTable;
|
||||
|
||||
private _clusters = memoizeOne((clusters: Cluster[]) => {
|
||||
let outputClusters: ClusterRowData[] = clusters;
|
||||
@ -77,6 +82,10 @@ export class ZHAClustersDataTable extends LitElement {
|
||||
}
|
||||
);
|
||||
|
||||
public clearSelection() {
|
||||
this._dataTable.clearSelection();
|
||||
}
|
||||
|
||||
protected render(): TemplateResult {
|
||||
return html`
|
||||
<ha-data-table
|
||||
|
@ -9,10 +9,14 @@ import {
|
||||
TemplateResult,
|
||||
property,
|
||||
customElement,
|
||||
query,
|
||||
} from "lit-element";
|
||||
import { HomeAssistant } from "../../../types";
|
||||
// tslint:disable-next-line
|
||||
import { DataTableColumnContainer } from "../../../components/data-table/ha-data-table";
|
||||
import {
|
||||
DataTableColumnContainer,
|
||||
HaDataTable,
|
||||
} from "../../../components/data-table/ha-data-table";
|
||||
// tslint:disable-next-line
|
||||
import { ZHADevice } from "../../../data/zha";
|
||||
import { showZHADeviceInfoDialog } from "../../../dialogs/zha-device-info-dialog/show-dialog-zha-device-info";
|
||||
@ -27,6 +31,7 @@ export class ZHADevicesDataTable extends LitElement {
|
||||
@property() public narrow = false;
|
||||
@property({ type: Boolean }) public selectable = false;
|
||||
@property() public devices: ZHADevice[] = [];
|
||||
@query("ha-data-table") private _dataTable!: HaDataTable;
|
||||
|
||||
private _devices = memoizeOne((devices: ZHADevice[]) => {
|
||||
let outputDevices: DeviceRowData[] = devices;
|
||||
@ -89,6 +94,10 @@ export class ZHADevicesDataTable extends LitElement {
|
||||
}
|
||||
);
|
||||
|
||||
public clearSelection() {
|
||||
this._dataTable.clearSelection();
|
||||
}
|
||||
|
||||
protected render(): TemplateResult {
|
||||
return html`
|
||||
<ha-data-table
|
||||
|
@ -16,6 +16,7 @@ import {
|
||||
property,
|
||||
PropertyValues,
|
||||
TemplateResult,
|
||||
query,
|
||||
} from "lit-element";
|
||||
|
||||
import {
|
||||
@ -26,7 +27,7 @@ import {
|
||||
Cluster,
|
||||
fetchClustersForZhaNode,
|
||||
} from "../../../data/zha";
|
||||
import "./zha-clusters-data-table";
|
||||
import { ZHAClustersDataTable } from "./zha-clusters-data-table";
|
||||
import { haStyle } from "../../../resources/styles";
|
||||
import { HomeAssistant } from "../../../types";
|
||||
import { ItemSelectedEvent } from "./types";
|
||||
@ -47,6 +48,8 @@ export class ZHAGroupBindingControl extends LitElement {
|
||||
@property() private _clusters: Cluster[] = [];
|
||||
private _groupToBind?: ZHAGroup;
|
||||
private _clustersToBind?: Cluster[];
|
||||
@query("zha-devices-data-table")
|
||||
private _zhaClustersDataTable!: ZHAClustersDataTable;
|
||||
|
||||
protected updated(changedProperties: PropertyValues): void {
|
||||
if (changedProperties.has("selectedDevice")) {
|
||||
@ -187,6 +190,7 @@ export class ZHAGroupBindingControl extends LitElement {
|
||||
this._groupToBind!.group_id,
|
||||
this._clustersToBind!
|
||||
);
|
||||
this._zhaClustersDataTable.clearSelection();
|
||||
}
|
||||
}
|
||||
|
||||
@ -198,6 +202,7 @@ export class ZHAGroupBindingControl extends LitElement {
|
||||
this._groupToBind!.group_id,
|
||||
this._clustersToBind!
|
||||
);
|
||||
this._zhaClustersDataTable.clearSelection();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9,10 +9,14 @@ import {
|
||||
TemplateResult,
|
||||
property,
|
||||
customElement,
|
||||
query,
|
||||
} from "lit-element";
|
||||
import { HomeAssistant } from "../../../types";
|
||||
// tslint:disable-next-line
|
||||
import { DataTableColumnContainer } from "../../../components/data-table/ha-data-table";
|
||||
import {
|
||||
DataTableColumnContainer,
|
||||
HaDataTable,
|
||||
} from "../../../components/data-table/ha-data-table";
|
||||
// tslint:disable-next-line
|
||||
import { ZHAGroup, ZHADevice } from "../../../data/zha";
|
||||
import { formatAsPaddedHex } from "./functions";
|
||||
@ -29,6 +33,7 @@ export class ZHAGroupsDataTable extends LitElement {
|
||||
@property() public narrow = false;
|
||||
@property() public groups: ZHAGroup[] = [];
|
||||
@property() public selectable = false;
|
||||
@query("ha-data-table") private _dataTable!: HaDataTable;
|
||||
|
||||
private _groups = memoizeOne((groups: ZHAGroup[]) => {
|
||||
let outputGroups: GroupRowData[] = groups;
|
||||
@ -98,6 +103,10 @@ export class ZHAGroupsDataTable extends LitElement {
|
||||
}
|
||||
);
|
||||
|
||||
public clearSelection() {
|
||||
this._dataTable.clearSelection();
|
||||
}
|
||||
|
||||
protected render(): TemplateResult {
|
||||
return html`
|
||||
<ha-data-table
|
||||
|
Loading…
x
Reference in New Issue
Block a user