UNPKG

@progress/kendo-angular-grid

Version:

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

90 lines (89 loc) 4.75 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, HostBinding, Input } from '@angular/core'; import { ColumnComponent } from '../../columns/column.component'; import { isPresent, isNullOrEmptyString } from '../../utils'; import { cloneFilters } from '../../common/filter-descriptor-differ'; import { FilterCellHostDirective } from './filter-cell-host.directive'; import { NgIf, NgSwitch, NgSwitchCase, NgTemplateOutlet } from '@angular/common'; import * as i0 from "@angular/core"; /** * @hidden */ export class FilterCellComponent { hostRole = 'gridcell'; column; get filter() { return this._filter; } set filter(value) { this._filter = cloneFilters(value); } size = 'medium'; _templateContext = {}; _filter; get templateContext() { this._templateContext.column = this.column; this._templateContext.filter = this.filter; this._templateContext['$implicit'] = this.filter; return this._templateContext; } get hasTemplate() { return isPresent(this.column.filterCellTemplateRef); } get isFilterable() { return isPresent(this.column) && !isNullOrEmptyString(this.column.field) && this.column.filterable; } static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FilterCellComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: FilterCellComponent, isStandalone: true, selector: "[kendoGridFilterCell]", inputs: { column: "column", filter: "filter", size: "size" }, host: { properties: { "attr.role": "this.hostRole" } }, ngImport: i0, template: ` <ng-container *ngIf="isFilterable"> <ng-container [ngSwitch]="hasTemplate"> <ng-container *ngSwitchCase="false"> <ng-container kendoFilterCellHost [column]="column" [filter]="filter"></ng-container> </ng-container> <ng-container *ngSwitchCase="true"> <ng-template *ngIf="column.filterCellTemplateRef" [ngTemplateOutlet]="column.filterCellTemplateRef" [ngTemplateOutletContext]="templateContext"> </ng-template> </ng-container> </ng-container> </ng-container> `, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "directive", type: FilterCellHostDirective, selector: "[kendoFilterCellHost]" }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FilterCellComponent, decorators: [{ type: Component, args: [{ selector: '[kendoGridFilterCell]', template: ` <ng-container *ngIf="isFilterable"> <ng-container [ngSwitch]="hasTemplate"> <ng-container *ngSwitchCase="false"> <ng-container kendoFilterCellHost [column]="column" [filter]="filter"></ng-container> </ng-container> <ng-container *ngSwitchCase="true"> <ng-template *ngIf="column.filterCellTemplateRef" [ngTemplateOutlet]="column.filterCellTemplateRef" [ngTemplateOutletContext]="templateContext"> </ng-template> </ng-container> </ng-container> </ng-container> `, standalone: true, imports: [NgIf, NgSwitch, NgSwitchCase, FilterCellHostDirective, NgTemplateOutlet] }] }], propDecorators: { hostRole: [{ type: HostBinding, args: ['attr.role'] }], column: [{ type: Input }], filter: [{ type: Input }], size: [{ type: Input }] } });