UNPKG

@progress/kendo-angular-grid

Version:

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

121 lines (120 loc) 6.36 kB
/**----------------------------------------------------------------------------------------- * 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 { replaceMessagePlaceholder } from '../utils'; import { ContextService } from '../common/provider.service'; import { LogicalCellDirective } from '../navigation/logical-cell.directive'; import { FilterCellComponent } from './cell/filter-cell.component'; import { NgFor, NgIf, NgStyle, NgClass } from '@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; } static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FilterRowComponent, deps: [{ token: i1.ContextService }, { token: i2.ColumnInfoService }], target: i0.ɵɵFactoryTarget.Component }); static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", 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: ` <td class="k-table-td k-group-cell k-table-group-td" *ngFor="let g of groups" role="presentation"> </td> <td class="k-table-td k-hierarchy-cell" *ngIf="detailTemplate?.templateRef" role="presentation"> </td> <td *ngFor="let column of columns; let columnIndex = index" class="k-table-td" [class.k-grid-header-sticky]="column.sticky" [ngStyle]="addStickyStyles(column)" [ngClass]="column.filterClass" [attr.aria-label]="filterLabel($any(column))" kendoGridFilterCell [column]="$any(column)" [filter]="filter" kendoGridLogicalCell [logicalRowIndex]="logicalRowIndex" [logicalColIndex]="getLogicalColIndex(columnIndex)" ></td> `, isInline: true, dependencies: [{ kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { 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: "16.2.12", ngImport: i0, type: FilterRowComponent, decorators: [{ type: Component, args: [{ selector: '[kendoGridFilterRow]', template: ` <td class="k-table-td k-group-cell k-table-group-td" *ngFor="let g of groups" role="presentation"> </td> <td class="k-table-td k-hierarchy-cell" *ngIf="detailTemplate?.templateRef" role="presentation"> </td> <td *ngFor="let column of columns; let columnIndex = index" class="k-table-td" [class.k-grid-header-sticky]="column.sticky" [ngStyle]="addStickyStyles(column)" [ngClass]="column.filterClass" [attr.aria-label]="filterLabel($any(column))" kendoGridFilterCell [column]="$any(column)" [filter]="filter" kendoGridLogicalCell [logicalRowIndex]="logicalRowIndex" [logicalColIndex]="getLogicalColIndex(columnIndex)" ></td> `, standalone: true, imports: [NgFor, NgIf, FilterCellComponent, LogicalCellDirective, NgStyle, NgClass] }] }], ctorParameters: function () { return [{ 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'] }] } });