close property actions menu from item

This commit is contained in:
Mads Rasmussen
2022-06-21 11:54:31 +02:00
parent 3693e91b7d
commit dea215bd27
3 changed files with 10 additions and 1 deletions

View File

@@ -62,6 +62,11 @@ export class UmbNodePropertyActions extends UmbContextConsumerMixin(LitElement)
this._open = !this._open;
}
private _handleClose (event: CustomEvent) {
this._open = false;
event.stopPropagation();
};
disconnectedCallback () {
super.disconnectedCallback();
this._subscription?.unsubscribe();
@@ -73,7 +78,7 @@ export class UmbNodePropertyActions extends UmbContextConsumerMixin(LitElement)
<uui-popover
.open=${this._open}
placement="bottom-start"
@close="${() => this._open = false}">
@close="${this._handleClose}">
<uui-button
slot="trigger"
look="secondary"

View File

@@ -30,6 +30,8 @@ export default class UmbPropertyActionClear extends UmbContextConsumerMixin(LitE
private _handleLabelClick () {
this._notificationService?.peek('Clear value');
// TODO: how do we want to close the menu? Testing an event based approach
this.dispatchEvent(new CustomEvent('close', { bubbles: true, composed: true }));
}
render() {

View File

@@ -30,6 +30,8 @@ export default class UmbPropertyActionCopy extends UmbContextConsumerMixin(LitEl
private _handleLabelClick () {
this._notificationService?.peek('Copied to clipboard');
// TODO: how do we want to close the menu? Testing an event based approach
this.dispatchEvent(new CustomEvent('close', { bubbles: true, composed: true }));
}
render() {