mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-27 19:26:36 +00:00
Add delete action in label overflow menu (#20261)
This commit is contained in:
parent
510e010f97
commit
5dd029cc05
@ -1,4 +1,4 @@
|
|||||||
import { mdiHelpCircle, mdiPlus } from "@mdi/js";
|
import { mdiDelete, mdiHelpCircle, mdiPlus } from "@mdi/js";
|
||||||
import { LitElement, PropertyValues, html, nothing } from "lit";
|
import { LitElement, PropertyValues, html, nothing } from "lit";
|
||||||
import { customElement, property, state } from "lit/decorators";
|
import { customElement, property, state } from "lit/decorators";
|
||||||
import memoizeOne from "memoize-one";
|
import memoizeOne from "memoize-one";
|
||||||
@ -11,6 +11,7 @@ import {
|
|||||||
import "../../../components/ha-fab";
|
import "../../../components/ha-fab";
|
||||||
import "../../../components/ha-icon-button";
|
import "../../../components/ha-icon-button";
|
||||||
import "../../../components/ha-relative-time";
|
import "../../../components/ha-relative-time";
|
||||||
|
import "../../../components/ha-icon-overflow-menu";
|
||||||
import {
|
import {
|
||||||
LabelRegistryEntry,
|
LabelRegistryEntry,
|
||||||
LabelRegistryEntryMutableParams,
|
LabelRegistryEntryMutableParams,
|
||||||
@ -71,6 +72,26 @@ export class HaConfigLabels extends LitElement {
|
|||||||
filterable: true,
|
filterable: true,
|
||||||
grows: true,
|
grows: true,
|
||||||
},
|
},
|
||||||
|
actions: {
|
||||||
|
title: "",
|
||||||
|
width: "64px",
|
||||||
|
type: "overflow-menu",
|
||||||
|
template: (label) => html`
|
||||||
|
<ha-icon-overflow-menu
|
||||||
|
.hass=${this.hass}
|
||||||
|
narrow
|
||||||
|
.items=${[
|
||||||
|
{
|
||||||
|
label: this.hass.localize("ui.common.delete"),
|
||||||
|
path: mdiDelete,
|
||||||
|
action: () => this._removeLabel(label),
|
||||||
|
warning: true,
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
</ha-icon-overflow-menu>
|
||||||
|
`,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
return columns;
|
return columns;
|
||||||
});
|
});
|
||||||
@ -189,6 +210,7 @@ export class HaConfigLabels extends LitElement {
|
|||||||
}),
|
}),
|
||||||
dismissText: this.hass!.localize("ui.common.cancel"),
|
dismissText: this.hass!.localize("ui.common.cancel"),
|
||||||
confirmText: this.hass!.localize("ui.common.remove"),
|
confirmText: this.hass!.localize("ui.common.remove"),
|
||||||
|
destructive: true,
|
||||||
}))
|
}))
|
||||||
) {
|
) {
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user