UNPKG

@progress/kendo-angular-treelist

Version:

Kendo UI TreeList for Angular - Display hierarchical data in an Angular tree grid view that supports sorting, filtering, paging, and much more.

142 lines (141 loc) 6.72 kB
/**----------------------------------------------------------------------------------------- * Copyright © 2025 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the project root for more information *-------------------------------------------------------------------------------------------*/ import { Component, Input, Output, EventEmitter, ElementRef } from '@angular/core'; import { LocalizationService } from "@progress/kendo-angular-l10n"; import { ColumnMenuItemBase } from './column-menu-item-base'; import { filterIcon } from '@progress/kendo-svg-icons'; import { FilterMenuContainerComponent } from '../filtering/menu/filter-menu-container.component'; import { ColumnMenuItemContentTemplateDirective } from './column-menu-item-content-template.directive'; import { ColumnMenuItemComponent } from './column-menu-item.component'; import * as i0 from "@angular/core"; import * as i1 from "@progress/kendo-angular-l10n"; /** * Represents the column-menu item for editing column filters in the TreeList. * * Render this component inside a [`ColumnMenuTemplate`]({% slug api_treelist_columnmenutemplatedirective %}) directive. * * To register the component as a known column menu item, set the [`ColumnMenuService`]({% slug api_treelist_columnmenuservice %}) * that the template passes to the `service` input of the `kendo-treelist-columnmenu-filter` component. * * @example * ```html * <kendo-treelist ...> * <kendo-treelist-column field="ProductName"> * <ng-template kendoTreeListColumnMenuTemplate> * <kendo-treelist-columnmenu-filter></kendo-treelist-columnmenu-filter> * </ng-template> * </kendo-treelist-column> * </kendo-treelist> * ``` */ export class ColumnMenuFilterComponent extends ColumnMenuItemBase { localization; hostElement; /** * Fires when the content expands. */ expand = new EventEmitter(); /** * Fires when the content collapses. */ collapse = new EventEmitter(); /** * Specifies if the content is expanded. * @default false */ expanded = false; /** * @hidden */ isLast = false; /** * @hidden */ actionsClass = 'k-actions k-actions-stretched k-actions-horizontal'; filterIcon = filterIcon; constructor(localization, hostElement) { super(); this.localization = localization; this.hostElement = hostElement; } /** * @hidden */ onCollapse() { this.expanded = false; if (this.isLast) { this.service.menuTabbingService.lastFocusable = this.hostElement.nativeElement.querySelector('.k-columnmenu-item'); } this.collapse.emit(); } /** * @hidden */ onExpand() { this.expanded = true; this.expand.emit(); } static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ColumnMenuFilterComponent, deps: [{ token: i1.LocalizationService }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: ColumnMenuFilterComponent, isStandalone: true, selector: "kendo-treelist-columnmenu-filter", inputs: { expanded: "expanded", isLast: "isLast" }, outputs: { expand: "expand", collapse: "collapse" }, usesInheritance: true, ngImport: i0, template: ` <kendo-treelist-columnmenu-item [text]="localization.get('filter')" icon="filter" [svgIcon]="filterIcon" [expanded]="expanded" (collapse)="onCollapse()" (expand)="onExpand()"> <ng-template kendoTreeListColumnMenuItemContentTemplate> <kendo-treelist-filter-menu-container [column]="service.column" [menuTabbingService]="service.menuTabbingService" [filter]="service.filter" [actionsClass]="actionsClass" [isLast]="isLast" [isExpanded]="expanded" (keydown.shift.tab)="$event.stopImmediatePropagation()" (close)="close()"> </kendo-treelist-filter-menu-container> </ng-template> </kendo-treelist-columnmenu-item> `, isInline: true, dependencies: [{ kind: "component", type: ColumnMenuItemComponent, selector: "kendo-treelist-columnmenu-item", inputs: ["icon", "svgIcon", "text", "selected", "disabled", "expanded", "service"], outputs: ["itemClick", "expand", "collapse"] }, { kind: "directive", type: ColumnMenuItemContentTemplateDirective, selector: "[kendoTreeListColumnMenuItemContentTemplate]" }, { kind: "component", type: FilterMenuContainerComponent, selector: "kendo-treelist-filter-menu-container", inputs: ["column", "isLast", "isExpanded", "menuTabbingService", "filter", "actionsClass"], outputs: ["close"] }] }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ColumnMenuFilterComponent, decorators: [{ type: Component, args: [{ selector: 'kendo-treelist-columnmenu-filter', template: ` <kendo-treelist-columnmenu-item [text]="localization.get('filter')" icon="filter" [svgIcon]="filterIcon" [expanded]="expanded" (collapse)="onCollapse()" (expand)="onExpand()"> <ng-template kendoTreeListColumnMenuItemContentTemplate> <kendo-treelist-filter-menu-container [column]="service.column" [menuTabbingService]="service.menuTabbingService" [filter]="service.filter" [actionsClass]="actionsClass" [isLast]="isLast" [isExpanded]="expanded" (keydown.shift.tab)="$event.stopImmediatePropagation()" (close)="close()"> </kendo-treelist-filter-menu-container> </ng-template> </kendo-treelist-columnmenu-item> `, standalone: true, imports: [ColumnMenuItemComponent, ColumnMenuItemContentTemplateDirective, FilterMenuContainerComponent] }] }], ctorParameters: function () { return [{ type: i1.LocalizationService }, { type: i0.ElementRef }]; }, propDecorators: { expand: [{ type: Output }], collapse: [{ type: Output }], expanded: [{ type: Input }], isLast: [{ type: Input }] } });