@progress/kendo-angular-grid
Version:
Kendo UI Grid for Angular - high performance data grid with paging, filtering, virtualization, CRUD, and more.
132 lines (131 loc) • 6.31 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 { ColumnInfoService } from './../common/column-info.service';
import { Component, Input, HostBinding } from '@angular/core';
import { DetailTemplateDirective } from '../rendering/details/detail-template.directive';
import { ContextService } from '../common/provider.service';
import { LogicalCellDirective } from '../navigation/logical-cell.directive';
import { FilterCellComponent } from './cell/filter-cell.component';
import { NgStyle, NgClass } from '@angular/common';
import { replaceMessagePlaceholder } from '@progress/kendo-angular-common';
import * as i0 from "@angular/core";
import * as i1 from "../common/provider.service";
import * as i2 from "./../common/column-info.service";
/**
* @hidden
*/
export class FilterRowComponent {
ctx;
columnInfoService;
columns = [];
filter;
groups = [];
detailTemplate;
logicalRowIndex;
lockedColumnsCount;
filterRowClass = true;
constructor(ctx, columnInfoService) {
this.ctx = ctx;
this.columnInfoService = columnInfoService;
}
addStickyStyles(column) {
const sticky = column.sticky ? this.columnInfoService.stickyColumnsStyles(column) : null;
return { ...sticky, ...column.filterStyle };
}
filterLabel(column) {
const localizationMsg = this.ctx.localization.get('filterInputLabel') || '';
const columnName = column.title || column.field;
return replaceMessagePlaceholder(localizationMsg, 'columnName', columnName);
}
getLogicalColIndex(columnIndex) {
const colIndex = this.lockedColumnsCount + columnIndex;
return this.detailTemplate?.templateRef ? colIndex + 1 : colIndex;
}
get isStacked() {
return this.ctx.grid?.isStacked;
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: FilterRowComponent, deps: [{ token: i1.ContextService }, { token: i2.ColumnInfoService }], target: i0.ɵɵFactoryTarget.Component });
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: FilterRowComponent, isStandalone: true, selector: "[kendoGridFilterRow]", inputs: { columns: "columns", filter: "filter", groups: "groups", detailTemplate: "detailTemplate", logicalRowIndex: "logicalRowIndex", lockedColumnsCount: "lockedColumnsCount" }, host: { properties: { "class.k-filter-row": "this.filterRowClass" } }, ngImport: i0, template: `
@for (g of groups; track g) {
<td
class="k-table-td k-group-cell k-table-group-td"
role="presentation">
</td>
}
@if (detailTemplate?.templateRef && !isStacked) {
<td
class="k-table-td k-hierarchy-cell"
role="presentation">
</td>
}
@for (column of columns; track column; let columnIndex = $index) {
<td
class="k-table-td"
[]="column.sticky"
[]="addStickyStyles(column)"
[]="column.filterClass"
[]="filterLabel($any(column))"
kendoGridFilterCell
[]="$any(column)"
[]="filter"
kendoGridLogicalCell
[]="logicalRowIndex"
[]="getLogicalColIndex(columnIndex)"
></td>
}
`, isInline: true, dependencies: [{ kind: "component", type: FilterCellComponent, selector: "[kendoGridFilterCell]", inputs: ["column", "filter", "size"] }, { kind: "directive", type: LogicalCellDirective, selector: "[kendoGridLogicalCell]", inputs: ["logicalColIndex", "logicalRowIndex", "logicalSlaveCell", "colIndex", "colSpan", "rowSpan", "groupItem", "dataRowIndex", "dataItem", "detailExpandCell", "headerLabelText"] }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: FilterRowComponent, decorators: [{
type: Component,
args: [{
selector: '[kendoGridFilterRow]',
template: `
@for (g of groups; track g) {
<td
class="k-table-td k-group-cell k-table-group-td"
role="presentation">
</td>
}
@if (detailTemplate?.templateRef && !isStacked) {
<td
class="k-table-td k-hierarchy-cell"
role="presentation">
</td>
}
@for (column of columns; track column; let columnIndex = $index) {
<td
class="k-table-td"
[]="column.sticky"
[]="addStickyStyles(column)"
[]="column.filterClass"
[]="filterLabel($any(column))"
kendoGridFilterCell
[]="$any(column)"
[]="filter"
kendoGridLogicalCell
[]="logicalRowIndex"
[]="getLogicalColIndex(columnIndex)"
></td>
}
`,
standalone: true,
imports: [FilterCellComponent, LogicalCellDirective, NgStyle, NgClass]
}]
}], ctorParameters: () => [{ type: i1.ContextService }, { type: i2.ColumnInfoService }], propDecorators: { columns: [{
type: Input
}], filter: [{
type: Input
}], groups: [{
type: Input
}], detailTemplate: [{
type: Input
}], logicalRowIndex: [{
type: Input
}], lockedColumnsCount: [{
type: Input
}], filterRowClass: [{
type: HostBinding,
args: ['class.k-filter-row']
}] } });