fix select and unselect events of tree item

This commit is contained in:
Niels Lyngsø
2023-05-21 21:03:36 +02:00
parent d954a01c9c
commit dbff44fd2f
2 changed files with 5 additions and 8 deletions

View File

@@ -55,12 +55,6 @@ export class UmbTreeItemBaseElement extends UmbLitElement {
});
}
connectedCallback(): void {
super.connectedCallback();
this.addEventListener('selected', this._handleSelectedItem);
this.addEventListener('unselected', this._handleDeselectedItem);
}
private _handleSelectedItem(event: Event) {
event.stopPropagation();
this.#treeItemContext?.select();
@@ -92,10 +86,13 @@ export class UmbTreeItemBaseElement extends UmbLitElement {
this.#treeItemContext?.toggleContextMenu();
}
// TODO: We should rename unselect event to deselect. But this is a breaking change of UI Library.
render() {
return html`
<uui-menu-item
@show-children=${this._onShowChildren}
@selected=${this._handleSelectedItem}
@unselected=${this._handleDeselectedItem}
?selectable=${this._isSelectable}
?selected=${this._isSelected}
.loading=${this._isLoading}

View File

@@ -11,7 +11,7 @@ import {
UmbModalContext,
UMB_MODAL_CONTEXT_TOKEN,
UMB_CONFIRM_MODAL,
UMB_DOCUMENT_PICKER_MODAL,
UMB_DOCUMENT_TYPE_PICKER_MODAL,
} from '@umbraco-cms/backoffice/modal';
import { UmbLitElement } from '@umbraco-cms/internal/lit-element';
import { DocumentTypeResponseModel, EntityTreeItemResponseModel } from '@umbraco-cms/backoffice/backend-api';
@@ -73,7 +73,7 @@ export class UmbInputDocumentTypePickerElement extends FormControlMixin(UmbLitEl
private _openPicker() {
// We send a shallow copy(good enough as its just an array of ids) of our this._selectedIds, as we don't want the modal to manipulate our data:
const modalHandler = this._modalContext?.open(UMB_DOCUMENT_PICKER_MODAL, {
const modalHandler = this._modalContext?.open(UMB_DOCUMENT_TYPE_PICKER_MODAL, {
multiple: true,
selection: [...this._selectedIds],
});