import * as i0 from '@angular/core'; import { TemplateRef, Injector, Signal, InjectionToken } from '@angular/core'; import * as i1 from '@ngx-translate/core'; import { CdkMenu, CdkMenuItem, CdkContextMenuTrigger } from '@angular/cdk/menu'; import { DmsObject } from '@yuuvis/client-core'; import { Observable } from 'rxjs'; import { MatIconRegistry } from '@angular/material/icon'; /** * Module for the actions library. */ declare class ActionsModule { static ɵfac: i0.ɵɵFactoryDeclaration; static ɵmod: i0.ɵɵNgModuleDeclaration; static ɵinj: i0.ɵɵInjectorDeclaration; } declare const ACTION_ICON: { download: string; delete: string; copy: string; cut: string; manageFlavor: string; }; type ActionClass = { new (...args: any[]): any; }; declare class AbstractContextAction { context?: ActionContext; constructor(context?: ActionContext); } interface BaseAction { /** * Equals the selector of the actions selector (will be set by the action service) */ id: string; /** * label to be displayed inside the action menu */ label: string; /** * description to be displayed inside the action menu */ description?: string; /** * @ignore */ icon: string; /** * actions priority defining the position of the action within the whole list of actions */ priority: number; /** * group of actions the action should be part of ('common' or 'further') */ group: string; /** * number of selected items supported by the action * (SelectionRange.SINGLE_SELECT, SelectionRange.MULTI_SELECT, SelectionRange.MULTI_SELECT_ONLY ) */ range: SelectionRange; /** * Types that are supported by the action */ supports: ActionSupport; /** * Determining whether or not the action is executable for the given selection. * Controls visibility: when false, the action is hidden from the UI entirely. * @param item Current selection * @returns true if the action is executable for the current selection, false otherwise */ isExecutable: (items: DmsObject[]) => Observable; /** * Optional check whether the action should be disabled for the given selection. * Unlike isExecutable (which controls visibility), isDisabled controls whether * a visible action can be triggered. When absent, the action is never disabled. * @param items Current selection * @returns true if the action should be disabled, false otherwise */ isDisabled?: (items: DmsObject[]) => Observable; /** * Resolved disabled state for template binding. Set by ActionsService after * evaluating isDisabled(). Do not set manually on action classes. */ disabled?: boolean; } interface ActionSupport { types?: string[]; sots?: string[]; pattern?: string; } interface ActionContext { /** * As actions deal with DmsObjects the subject property is the property that * should be used to display the name of the object. This may be used for * showing the name of the object in a confirmation/error dialog or similar. */ subjectProperty?: string; /** * The appId is the id of the application that the action is executed in. */ appId?: string; } interface Action extends BaseAction { run: (items: DmsObject[]) => Observable; /** * Optional child actions. When present, this action renders as a sub-menu * trigger instead of executing `run`. Nesting can be arbitrarily deep. * An empty array is treated as "no children" (leaf action). */ children?: Action[]; } interface ActionOptions { context?: ActionContext; exclude?: string[] | RegExp; } declare enum SelectionRange { SINGLE_SELECT = 0, MULTI_SELECT = 1, MULTI_SELECT_ONLY = 2, ANY = 3 } declare const BASE_ACTION: { copy: string; cut: string; download: string; delete: string; }; interface ContextMenuAction extends Action { iconName?: string; disabled?: boolean; executeFn?: (...args: any[]) => void; } interface ContextMenuItemSelectEvent { action: ContextMenuAction; } declare class ContextmenuComponent { actions: i0.InputSignal; selection: i0.InputSignal; itemSelect: i0.OutputEmitterRef; private translate; cdkMenu: i0.Signal; menuItems: i0.Signal; sortedActions: i0.Signal; constructor(); onItemTrigger({ action }: ContextMenuItemSelectEvent): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class YuvContextMenuTriggerDirective extends CdkContextMenuTrigger { #private; menuTemplateRef: TemplateRef; triggerWhen: i0.InputSignal; constructor(); _openOnContextMenu(event: MouseEvent): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; } declare const ActionPriorityLevel: { readonly LEVEL_1: 1; readonly LEVEL_2: 2; readonly LEVEL_3: 3; readonly LEVEL_4: 4; readonly LEVEL_5: 5; readonly LEVEL_6: 6; readonly LEVEL_7: 7; readonly LEVEL_8: 8; readonly LEVEL_9: 9; readonly LEVEL_10: 10; }; /** * Service responsible for validating actions on DMS objects. * Provides checks for document lock states and related user information. */ /** @deprecated */ declare class ActionsValidationService { #private; private readonly translate; /** @deprecated */ checkDocumentLock(dmsObject: DmsObject): Observable<{ state: boolean; description?: string; }>; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } declare class ActionsService { #private; readonly injector: Injector; readonly iconRegistry: MatIconRegistry; private _registeredActions; /** * Registers actions that can be used in the application. * @param a Array of actions to register, each action must have an id and a * class that extends ActionClass */ registerActions(actions: { id: string; action: ActionClass; }[]): void; /** * Conceals actions that are no longer needed or should not be available. * This will remove the actions from the registered actions list. * @param actionIDs Array of action IDs to conceal */ concealActions(actionIDs: string[]): void; /** * Returns all actions that are executable for the given selection. * @param selection Array of DmsObjects to check for executable actions * @param options options to filter the actions * @returns Observable of actions that are executable for the given selection */ getActions(selection: DmsObject[], options?: ActionOptions): Observable; /** * Get all available actions. This includes the default actions and all registered actions but * without checking if they are executable. * @param context Context passed to the actions * @returns Array of available actions */ getAvailableActions(context?: ActionContext): Action[]; getActionsForType(objectTypeId: string, context?: ActionContext): Action[]; getActionById(id: string, context?: ActionContext): Action | undefined; getActionsById(ids: string[], context?: ActionContext): Action[]; /** * Resolves the disabled state for the given actions against the given selection. * Sets the `disabled` property on each action instance. * @param actions Array of actions to resolve * @param selection Array of DmsObjects to check against * @returns Observable emitting the same actions with `disabled` set */ resolveDisabledState(actions: Action[], selection: DmsObject[]): Observable; openContextMenu(actions: Signal, callback: (action: Action) => void, overlayOrigin: { x: number; y: number; }): void; /** * Registers a set of default actions that are commonly used in the application. * These actions include delete, download, copy and cut. This method can be called * during the initialization of the application to ensure that these actions * are available for use. */ registerDefaultActions(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } declare const ACTION_CONTEXT_TOKEN: InjectionToken; declare class DeleteAction extends AbstractContextAction implements Action { #private; id: string; label: any; description: any; priority: 8; icon: string; group: string; range: SelectionRange; supports: ActionSupport; isDisabled(items: DmsObject[]): Observable; isExecutable(items: DmsObject[]): Observable; run(items: DmsObject[]): Observable; } declare class DownloadAction extends AbstractContextAction implements Action { #private; id: string; label: any; description: any; priority: 2; icon: string; group: string; range: SelectionRange; supports: ActionSupport; isExecutable(selection: DmsObject[]): Observable; run(selection: DmsObject[]): Observable; } export { ACTION_CONTEXT_TOKEN, ACTION_ICON, AbstractContextAction, ActionPriorityLevel, ActionsModule, ActionsService, ActionsValidationService, BASE_ACTION, ContextmenuComponent, DeleteAction, DownloadAction, SelectionRange, YuvContextMenuTriggerDirective }; export type { Action, ActionClass, ActionContext, ActionOptions, ActionSupport, BaseAction, ContextMenuAction, ContextMenuItemSelectEvent };