Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
// TODO: maybe move this to UI Library.
@customElement('umb-dropdown')
export class UmbDropdownElement extends UmbLitElement {
@query('#dropdown-popover')
popoverContainerElement?: UUIPopoverContainerElement;
@property({ type: Boolean, reflect: true })
open = false;

Expand All @@ -35,19 +33,16 @@ export class UmbDropdownElement extends UmbLitElement {
@property({ type: Boolean, attribute: 'hide-expand' })
hideExpand = false;

@query('#dropdown-popover')
popoverContainerElement?: UUIPopoverContainerElement;

protected override updated(_changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void {
super.updated(_changedProperties);
if (_changedProperties.has('open') && this.popoverContainerElement) {
if (this.open) {
// TODO: This ignorer is just needed for JSON SCHEMA TO WORK, As its not updated with latest TS jet.
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
this.popoverContainerElement.showPopover();
this.openDropdown();
} else {
// TODO: This ignorer is just needed for JSON SCHEMA TO WORK, As its not updated with latest TS jet.
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
this.popoverContainerElement.hidePopover();
this.closeDropdown();
}
}
}
Expand All @@ -59,6 +54,20 @@ export class UmbDropdownElement extends UmbLitElement {
this.open = event.newState === 'open';
}

openDropdown() {
// TODO: This ignorer is just needed for JSON SCHEMA TO WORK, As its not updated with latest TS jet.
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
this.popoverContainerElement?.showPopover();
}

closeDropdown() {
// TODO: This ignorer is just needed for JSON SCHEMA TO WORK, As its not updated with latest TS jet.
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
this.popoverContainerElement?.hidePopover();
}

override render() {
return html`
<uui-button
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
import { UmbEntityContext } from '../../entity/entity.context.js';
import type { UmbDropdownElement } from '../dropdown/index.js';
import type { UmbEntityAction, ManifestEntityActionDefaultKind } from '@umbraco-cms/backoffice/entity-action';
import type { PropertyValueMap } from '@umbraco-cms/backoffice/external/lit';
import { html, nothing, customElement, property, state, ifDefined, css } from '@umbraco-cms/backoffice/external/lit';
import {
html,
nothing,
customElement,
property,
state,
ifDefined,
css,
query,
} from '@umbraco-cms/backoffice/external/lit';
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
import { umbExtensionsRegistry } from '@umbraco-cms/backoffice/extension-registry';
import { UmbExtensionsManifestInitializer, createExtensionApi } from '@umbraco-cms/backoffice/extension-api';
Expand Down Expand Up @@ -29,8 +39,8 @@ export class UmbEntityActionsBundleElement extends UmbLitElement {
@state()
private _firstActionHref?: string;

@state()
_dropdownIsOpen = false;
@query('#action-modal')
private _dropdownElement?: UmbDropdownElement;

// TODO: provide the entity context on a higher level, like the root element of this entity, tree-item/workspace/... [NL]
#entityContext = new UmbEntityContext(this);
Expand Down Expand Up @@ -79,7 +89,7 @@ export class UmbEntityActionsBundleElement extends UmbLitElement {
}

#onActionExecuted() {
Comment thread
madsrasmussen marked this conversation as resolved.
this._dropdownIsOpen = false;
this._dropdownElement?.closeDropdown();
}

#onDropdownClick(event: Event) {
Expand All @@ -95,13 +105,7 @@ export class UmbEntityActionsBundleElement extends UmbLitElement {
if (this._numberOfActions === 1) return nothing;

return html`
<umb-dropdown
id="action-modal"
.open=${this._dropdownIsOpen}
@click=${this.#onDropdownClick}
.label=${this.label}
compact
hide-expand>
<umb-dropdown id="action-modal" @click=${this.#onDropdownClick} .label=${this.label} compact hide-expand>
<uui-symbol-more slot="label" .label=${this.label}></uui-symbol-more>
<uui-scroll-container>
<umb-entity-action-list
Expand Down
Loading