UNPKG

@progress/kendo-angular-menu

Version:

Kendo UI Angular Menu component

71 lines (70 loc) 3.56 kB
/**----------------------------------------------------------------------------------------- * Copyright © 2025 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the project root for more information *-------------------------------------------------------------------------------------------*/ import { Input, HostBinding, isDevMode, Component } from '@angular/core'; import { ItemsService } from '../services/items.service'; import { getFontIcon, getSVGIcon } from '../utils'; import { IconWrapperComponent } from '@progress/kendo-angular-icons'; import * as i0 from "@angular/core"; import * as i1 from "../services/items.service"; /** * Represents a component that can be used in the [`linkTemplate`]({% slug api_menu_itemlinktemplatedirective %}) * of the items to render the default expand arrow. * * @example * ```html * <ng-template kendoMenuItemLinkTemplate let-item="item" let-index="index"> * <span [kendoMenuExpandArrow]="index"></span> * </ng-template> * ``` */ export class ExpandArrowComponent { itemsService; /** * Specifies the index of the Menu item. The input is mandatory. */ index; hostClasses = true; ariaHidden = 'true'; item; /** * @hidden */ fontIcon; /** * @hidden */ SVGIcon; constructor(itemsService) { this.itemsService = itemsService; } ngOnInit() { if (isDevMode() && !this.index) { throw new Error('The kendoMenuExpandArrow component requires the item index to be set.'); } this.item = this.itemsService.get(this.index) || {}; this.fontIcon = getFontIcon(this.item.horizontal, this.item.rtl); this.SVGIcon = getSVGIcon(this.item.horizontal, this.item.rtl); } static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ExpandArrowComponent, deps: [{ token: i1.ItemsService }], target: i0.ɵɵFactoryTarget.Component }); static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: ExpandArrowComponent, isStandalone: true, selector: "[kendoMenuExpandArrow]", inputs: { index: ["kendoMenuExpandArrow", "index"] }, host: { properties: { "class.k-menu-expand-arrow": "this.hostClasses", "attr.aria-hidden": "this.ariaHidden" } }, ngImport: i0, template: `<kendo-icon-wrapper [name]="fontIcon" [svgIcon]="SVGIcon"></kendo-icon-wrapper>`, isInline: true, dependencies: [{ kind: "component", type: IconWrapperComponent, selector: "kendo-icon-wrapper", inputs: ["name", "svgIcon", "innerCssClass", "customFontClass", "size"], exportAs: ["kendoIconWrapper"] }] }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ExpandArrowComponent, decorators: [{ type: Component, args: [{ selector: '[kendoMenuExpandArrow]', template: `<kendo-icon-wrapper [name]="fontIcon" [svgIcon]="SVGIcon"></kendo-icon-wrapper>`, standalone: true, imports: [IconWrapperComponent] }] }], ctorParameters: () => [{ type: i1.ItemsService }], propDecorators: { index: [{ type: Input, args: ['kendoMenuExpandArrow'] }], hostClasses: [{ type: HostBinding, args: ['class.k-menu-expand-arrow'] }], ariaHidden: [{ type: HostBinding, args: ['attr.aria-hidden'] }] } });