add type to element

This commit is contained in:
Mads Rasmussen
2023-02-27 20:36:04 +01:00
committed by Jacob Overgaard
parent a242939ad3
commit d6f54a544b
2 changed files with 4 additions and 2 deletions

View File

@@ -2,7 +2,7 @@ import { UmbControllerHostInterface } from '@umbraco-cms/controller';
import { umbExtensionsRegistry, createExtensionClass } from '@umbraco-cms/extensions-api';
import { UmbObserverController } from '@umbraco-cms/observable-api';
export interface UmbAction<RepositoryType> {
export interface UmbAction<RepositoryType = unknown> {
host: UmbControllerHostInterface;
repository: RepositoryType;
execute(): Promise<void>;

View File

@@ -4,6 +4,7 @@ import { ifDefined } from 'lit-html/directives/if-defined.js';
import { UmbExecutedEvent } from '@umbraco-cms/events';
import { UmbLitElement } from '@umbraco-cms/element';
import { ManifestEntityBulkAction } from '@umbraco-cms/extensions-registry';
import { UmbAction } from '@umbraco-cms/entity-action';
@customElement('umb-entity-bulk-action')
class UmbEntityBulkActionElement extends UmbLitElement {
@@ -40,9 +41,10 @@ class UmbEntityBulkActionElement extends UmbLitElement {
this.#api = new this._manifest.meta.api(this, this._manifest.meta.repositoryAlias, this._selection);
}
#api: any;
#api?: UmbAction;
async #onClick(event: PointerEvent) {
if (!this.#api) return;
event.stopPropagation();
await this.#api.execute();
this.dispatchEvent(new UmbExecutedEvent());