@progress/kendo-angular-menu
Version:
Kendo UI Angular Menu component
63 lines (62 loc) • 2.79 kB
JavaScript
/**-----------------------------------------------------------------------------------------
* Copyright © 2025 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the project root for more information
*-------------------------------------------------------------------------------------------*/
import { Directive, ElementRef, Input, HostBinding } from '@angular/core';
import { ContextMenuTargetService } from './context-menu-target.service';
import * as i0 from "@angular/core";
import * as i1 from "./context-menu-target.service";
/**
* @hidden
*/
export const TARGET_CLASS = 'k-contextmenu-target';
/**
* Represents a [target]({% slug api_menu_contextmenutargetdirective %}) for the ContextMenu
* ([see example]({% slug target_contextmenu %}#toc-directives)).
*
* @example
* ```html
* <div kendoContextMenuTarget> </div>
* ```
*/
export class ContextMenuTargetDirective {
targetService;
/**
* Specifies the data which is associated with the target.
*/
data;
/**
* Specifies the target DOM element.
*/
element;
/**
* @hidden
*/
hostClass = true;
constructor(elementRef, targetService) {
this.targetService = targetService;
if (elementRef) {
this.element = elementRef.nativeElement;
}
targetService.add(this);
}
ngOnDestroy() {
this.targetService.remove(this);
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ContextMenuTargetDirective, deps: [{ token: i0.ElementRef }, { token: i1.ContextMenuTargetService }], target: i0.ɵɵFactoryTarget.Directive });
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: ContextMenuTargetDirective, isStandalone: true, selector: "[kendoContextMenuTarget]", inputs: { data: ["kendoContextMenuTarget", "data"] }, host: { properties: { "class.k-contextmenu-target": "this.hostClass" } }, exportAs: ["kendoContextMenuTarget"], ngImport: i0 });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ContextMenuTargetDirective, decorators: [{
type: Directive,
args: [{
selector: '[kendoContextMenuTarget]',
exportAs: 'kendoContextMenuTarget',
standalone: true
}]
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1.ContextMenuTargetService }]; }, propDecorators: { data: [{
type: Input,
args: ['kendoContextMenuTarget']
}], hostClass: [{
type: HostBinding,
args: [`class.${TARGET_CLASS}`]
}] } });