@progress/kendo-angular-pivotgrid
Version:
PivotGrid package for Angular
136 lines (135 loc) • 6.61 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 { Component, Input, Output, EventEmitter, ElementRef } from '@angular/core';
import { filterIcon } from '@progress/kendo-svg-icons';
import { PivotLocalizationService } from '../../localization/pivot-localization.service';
import { ChipMenuItemBase } from './chip-menu-item-base';
import { FilterMenuContainerComponent } from './filtering/filter-menu-container.component';
import { ChipMenuItemContentTemplateDirective } from './chip-menu-item-content-template.directive';
import { ChipMenuItemComponent } from './chip-menu-item.component';
import * as i0 from "@angular/core";
import * as i1 from "../../localization/pivot-localization.service";
/**
* @hidden
* Represents the component for setting field filters in the PivotGrid.
*/
export class ChipMenuFilterComponent extends ChipMenuItemBase {
localization;
hostElement;
/**
* Fires when the content is expanded.
*/
expand = new EventEmitter();
/**
* Fires when the content is collapsed.
*/
collapse = new EventEmitter();
/**
* Holds current field information.
*/
chip;
/**
* Specifies if the content is expanded.
*/
expanded = false;
isLast = false;
actionsClass = 'k-columnmenu-actions';
filterSVGIcon = filterIcon;
constructor(localization, hostElement) {
super();
this.localization = localization;
this.hostElement = hostElement;
}
ngAfterViewInit() {
if (this.isLast) {
this.service.menuTabbingService.lastFocusable = this.expanded ?
this.hostElement.nativeElement.querySelector('.k-button:not([disabled])') :
this.hostElement.nativeElement.querySelector('.k-columnmenu-item');
}
}
onCollapse() {
this.expanded = false;
if (this.isLast) {
this.service.menuTabbingService.lastFocusable = this.hostElement.nativeElement.querySelector('.k-columnmenu-item');
}
this.collapse.emit();
}
onExpand() {
this.expanded = true;
if (this.isLast) {
this.service.menuTabbingService.lastFocusable = this.hostElement.nativeElement.querySelector('.k-button:not([disabled])');
}
this.expand.emit();
}
/**
* Returns the localized message for a given token
*/
messageFor(localizationToken) {
return this.localization.get(localizationToken);
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ChipMenuFilterComponent, deps: [{ token: i1.PivotLocalizationService }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: ChipMenuFilterComponent, isStandalone: true, selector: "kendo-pivot-chipmenu-filter", inputs: { chip: "chip", expanded: "expanded", isLast: "isLast" }, outputs: { expand: "expand", collapse: "collapse" }, usesInheritance: true, ngImport: i0, template: `
<kendo-pivot-chipmenu-item
classs="k-widget k-expander"
[text]="messageFor('fieldMenuFilterItemLabel')"
icon="filter"
[svgIcon]="filterSVGIcon"
[expanded]="expanded"
(collapse)="onCollapse()"
(expand)="onExpand()">
<ng-template kendoPivotChipMenuItemContentTemplate>
<kendo-pivot-filter-menu-container
[chip]="chip"
[menuTabbingService]="service.menuTabbingService"
[actionsClass]="actionsClass"
[isLast]="isLast"
[isExpanded]="expanded"
(keydown.shift.tab)="$event.stopImmediatePropagation()"
(close)="close()">
</kendo-pivot-filter-menu-container>
</ng-template>
</kendo-pivot-chipmenu-item>
`, isInline: true, dependencies: [{ kind: "component", type: ChipMenuItemComponent, selector: "kendo-pivot-chipmenu-item", inputs: ["icon", "svgIcon", "text", "selected", "expanded", "disabled"], outputs: ["itemClick", "expand", "collapse"] }, { kind: "directive", type: ChipMenuItemContentTemplateDirective, selector: "[kendoPivotChipMenuItemContentTemplate]" }, { kind: "component", type: FilterMenuContainerComponent, selector: "kendo-pivot-filter-menu-container", inputs: ["chip", "isLast", "isExpanded", "menuTabbingService", "actionsClass"], outputs: ["close"] }] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ChipMenuFilterComponent, decorators: [{
type: Component,
args: [{
selector: 'kendo-pivot-chipmenu-filter',
template: `
<kendo-pivot-chipmenu-item
classs="k-widget k-expander"
[text]="messageFor('fieldMenuFilterItemLabel')"
icon="filter"
[svgIcon]="filterSVGIcon"
[expanded]="expanded"
(collapse)="onCollapse()"
(expand)="onExpand()">
<ng-template kendoPivotChipMenuItemContentTemplate>
<kendo-pivot-filter-menu-container
[chip]="chip"
[menuTabbingService]="service.menuTabbingService"
[actionsClass]="actionsClass"
[isLast]="isLast"
[isExpanded]="expanded"
(keydown.shift.tab)="$event.stopImmediatePropagation()"
(close)="close()">
</kendo-pivot-filter-menu-container>
</ng-template>
</kendo-pivot-chipmenu-item>
`,
standalone: true,
imports: [ChipMenuItemComponent, ChipMenuItemContentTemplateDirective, FilterMenuContainerComponent]
}]
}], ctorParameters: function () { return [{ type: i1.PivotLocalizationService }, { type: i0.ElementRef }]; }, propDecorators: { expand: [{
type: Output
}], collapse: [{
type: Output
}], chip: [{
type: Input
}], expanded: [{
type: Input
}], isLast: [{
type: Input
}] } });