add action event context
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
import { UmbContextBase } from '@umbraco-cms/backoffice/class-api';
|
||||
import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
|
||||
import { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
|
||||
|
||||
export class UmbActionEventContext extends UmbContextBase<UmbActionEventContext> {
|
||||
constructor(host: UmbControllerHost) {
|
||||
super(host, UMB_ACTION_EVENT_CONTEXT);
|
||||
}
|
||||
}
|
||||
|
||||
export const UMB_ACTION_EVENT_CONTEXT = new UmbContextToken<UmbActionEventContext, UmbActionEventContext>(
|
||||
'UmbActionEventContext',
|
||||
);
|
||||
@@ -0,0 +1,27 @@
|
||||
export class UmbControllerEvent extends Event {
|
||||
public constructor(type: string) {
|
||||
super(type, { bubbles: false, composed: false, cancelable: false });
|
||||
}
|
||||
}
|
||||
|
||||
export interface UmbActionEventArgs {
|
||||
entityType: string;
|
||||
unique: string;
|
||||
}
|
||||
|
||||
export class UmbActionEvent extends UmbControllerEvent {
|
||||
#args: UmbActionEventArgs;
|
||||
|
||||
public constructor(type: string, args: UmbActionEventArgs) {
|
||||
super(type);
|
||||
this.#args = args;
|
||||
}
|
||||
|
||||
getEntityType(): string {
|
||||
return this.#args.entityType;
|
||||
}
|
||||
|
||||
getUnique(): string {
|
||||
return this.#args.unique;
|
||||
}
|
||||
}
|
||||
@@ -1,2 +1,4 @@
|
||||
export * from './repository-action.js';
|
||||
export * from './action.interface.js';
|
||||
export * from './action-event.context.js';
|
||||
export * from './action.event.js';
|
||||
|
||||
Reference in New Issue
Block a user