UNPKG

@progress/kendo-angular-grid

Version:

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

92 lines (91 loc) 4.08 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 { 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: "18.2.14", ngImport: i0, type: FilterCellComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: FilterCellComponent, isStandalone: true, selector: "[kendoGridFilterCell]", inputs: { column: "column", filter: "filter", size: "size" }, host: { properties: { "attr.role": "this.hostRole" } }, ngImport: i0, template: ` @if (isFilterable) { @switch (hasTemplate) { @case (false) { <ng-container kendoFilterCellHost [column]="column" [filter]="filter"></ng-container> } @case (true) { @if (column.filterCellTemplateRef) { <ng-template [ngTemplateOutlet]="column.filterCellTemplateRef" [ngTemplateOutletContext]="templateContext"> </ng-template> } } } } `, isInline: true, dependencies: [{ kind: "directive", type: FilterCellHostDirective, selector: "[kendoFilterCellHost]" }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: FilterCellComponent, decorators: [{ type: Component, args: [{ selector: '[kendoGridFilterCell]', template: ` @if (isFilterable) { @switch (hasTemplate) { @case (false) { <ng-container kendoFilterCellHost [column]="column" [filter]="filter"></ng-container> } @case (true) { @if (column.filterCellTemplateRef) { <ng-template [ngTemplateOutlet]="column.filterCellTemplateRef" [ngTemplateOutletContext]="templateContext"> </ng-template> } } } } `, standalone: true, imports: [FilterCellHostDirective, NgTemplateOutlet] }] }], propDecorators: { hostRole: [{ type: HostBinding, args: ['attr.role'] }], column: [{ type: Input }], filter: [{ type: Input }], size: [{ type: Input }] } });