UNPKG

@progress/kendo-angular-grid

Version:

Kendo UI Grid for Angular - high performance data grid with paging, filtering, virtualization, CRUD, and more.

140 lines (139 loc) 6.7 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 { filterIcon } from '@progress/kendo-svg-icons'; import { ContextService } from '../common/provider.service'; import { ColumnMenuItemBase } from './column-menu-item-base'; 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 "../common/provider.service"; /** * Represents the column-menu item for editing column filters in the Grid. [See example](slug:columnmenu_grid#toc-filter-item). * * The component can be placed inside a [ColumnMenuTemplate]({% slug api_grid_columnmenutemplatedirective %}) directive. * To register the component as a known column menu item, set the [ColumnMenuService]({% slug api_grid_columnmenuservice %}) that is passed by * the template to the service input of the `kendo-grid-columnmenu-filter` component. [See example](slug:columnmenu_grid#toc-customizing-the-content). * * @example * ```html * <kendo-grid [columnMenu]="true" ...> * <ng-template kendoGridColumnMenuTemplate let-service="service"> * <kendo-grid-columnmenu-filter [service]="service"> * </kendo-grid-columnmenu-filter> * </ng-template> * </kendo-grid> * ``` */ export class ColumnMenuFilterComponent extends ColumnMenuItemBase { ctx; hostElement; /** * Fires when the content is expanded. */ expand = new EventEmitter(); /** * Fires when the content is collapsed. */ 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(ctx, hostElement) { super(); this.ctx = ctx; 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.ContextService }, { 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-grid-columnmenu-filter", inputs: { expanded: "expanded", isLast: "isLast" }, outputs: { expand: "expand", collapse: "collapse" }, usesInheritance: true, ngImport: i0, template: ` <kendo-grid-columnmenu-item [text]="ctx.localization.get('filter')" icon="filter" [svgIcon]="filterIcon" [expanded]="expanded" (collapse)="onCollapse()" (expand)="onExpand()"> <ng-template kendoGridColumnMenuItemContentTemplate> <kendo-grid-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-grid-filter-menu-container> </ng-template> </kendo-grid-columnmenu-item> `, isInline: true, dependencies: [{ kind: "component", type: ColumnMenuItemComponent, selector: "kendo-grid-columnmenu-item", inputs: ["icon", "svgIcon", "text", "selected", "disabled", "expanded", "service"], outputs: ["itemClick", "expand", "collapse"] }, { kind: "directive", type: ColumnMenuItemContentTemplateDirective, selector: "[kendoGridColumnMenuItemContentTemplate]" }, { kind: "component", type: FilterMenuContainerComponent, selector: "kendo-grid-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-grid-columnmenu-filter', template: ` <kendo-grid-columnmenu-item [text]="ctx.localization.get('filter')" icon="filter" [svgIcon]="filterIcon" [expanded]="expanded" (collapse)="onCollapse()" (expand)="onExpand()"> <ng-template kendoGridColumnMenuItemContentTemplate> <kendo-grid-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-grid-filter-menu-container> </ng-template> </kendo-grid-columnmenu-item> `, standalone: true, imports: [ColumnMenuItemComponent, ColumnMenuItemContentTemplateDirective, FilterMenuContainerComponent] }] }], ctorParameters: function () { return [{ type: i1.ContextService }, { type: i0.ElementRef }]; }, propDecorators: { expand: [{ type: Output }], collapse: [{ type: Output }], expanded: [{ type: Input }], isLast: [{ type: Input }] } });