first create api when we have both entity type and unique

This commit is contained in:
Mads Rasmussen
2024-03-24 21:09:38 +01:00
committed by Jacob Overgaard
parent a8da4149a9
commit 987a8cf844

View File

@@ -1,4 +1,5 @@
import type { UmbEntityAction } from '@umbraco-cms/backoffice/entity-action';
import type { PropertyValueMap } from '@umbraco-cms/backoffice/external/lit';
import { html, nothing, customElement, property, state, ifDefined } from '@umbraco-cms/backoffice/external/lit';
import type { UmbSectionSidebarContext } from '@umbraco-cms/backoffice/section';
import { UMB_SECTION_SIDEBAR_CONTEXT } from '@umbraco-cms/backoffice/section';
@@ -9,18 +10,8 @@ import { createExtensionApi } from '@umbraco-cms/backoffice/extension-api';
@customElement('umb-entity-actions-bundle')
export class UmbEntityActionsBundleElement extends UmbLitElement {
private _entityType?: string;
@property({ type: String, attribute: 'entity-type' })
public get entityType() {
return this._entityType;
}
public set entityType(value: string | undefined) {
const oldValue = this._entityType;
if (oldValue === value) return;
this._entityType = value;
this.#observeEntityActions();
this.requestUpdate('entityType', oldValue);
}
entityType?: string;
@property({ type: String })
unique?: string | null;
@@ -47,6 +38,12 @@ export class UmbEntityActionsBundleElement extends UmbLitElement {
});
}
protected updated(_changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void {
if (_changedProperties.has('entityType') && _changedProperties.has('unique')) {
this.#observeEntityActions();
}
}
#observeEntityActions() {
this.observe(
umbExtensionsRegistry.byType('entityAction'),