fix and modernize the property-action-menu

This commit is contained in:
Jacob Overgaard
2024-02-28 11:41:25 +01:00
parent 868855bb98
commit d2c2dc10fa

View File

@@ -10,24 +10,25 @@ import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
@customElement('umb-property-action-menu')
export class UmbPropertyActionMenuElement extends UmbLitElement {
#actionsInitializer?: UmbExtensionsElementInitializer<ManifestTypes, 'propertyAction'>;
#value: unknown;
#propertyEditorUiAlias = '';
@property({ attribute: false })
public set value(value: unknown) {
this._value = value;
this.#value = value;
if (this.#actionsInitializer) {
this.#actionsInitializer.properties = { value };
}
}
public get value(): unknown {
return this._value;
return this.#value;
}
private _value?: unknown;
#propertyEditorUiAlias = '';
@property()
set propertyEditorUiAlias(alias: string) {
// If there is an existing initializer, we need to dispose it.
this.#actionsInitializer?.destroy();
this.#propertyEditorUiAlias = alias;
// TODO: Stop using string for 'propertyAction', we need to start using Const.
// TODO: Align property actions with entity actions.
@@ -47,7 +48,7 @@ export class UmbPropertyActionMenuElement extends UmbLitElement {
}
@state()
private _actions: Array<UmbExtensionElementInitializer<ManifestPropertyAction, any>> = [];
private _actions: Array<UmbExtensionElementInitializer<ManifestPropertyAction, never>> = [];
render() {
return this._actions.length > 0