UNPKG

@progress/kendo-angular-grid

Version:

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

74 lines (73 loc) 3.52 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, Input } from '@angular/core'; import { DetailTemplateDirective } from '../details/detail-template.directive'; import { columnsToRender } from '../../columns/column-common'; import { isNullOrEmptyString, isTruthy } from '../../utils'; import { NgFor, NgIf } from '@angular/common'; import * as i0 from "@angular/core"; /** * @hidden */ export class ColGroupComponent { columns = []; groups = []; detailTemplate; sort = new Array(); get columnsToRender() { return columnsToRender(this.columns); } trackBy(index) { return index; } isSorted(column) { const state = this.sortDescriptor(column.field); return this.isSortable(column) && (state.dir === 'asc' || state.dir === 'desc'); } getColumnComponent(column) { return column; } isSortable(column) { return !isNullOrEmptyString(column.field) && isTruthy(column.sortable); } sortDescriptor(field) { return this.sort.find(item => item.field === field) || { field }; } static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ColGroupComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: ColGroupComponent, isStandalone: true, selector: "[kendoGridColGroup]", inputs: { columns: "columns", groups: "groups", detailTemplate: "detailTemplate", sort: "sort" }, ngImport: i0, template: ` <ng-container> <col [class.k-group-col]="true" *ngFor="let g of groups" /> <col [class.k-hierarchy-col]="true" *ngIf="detailTemplate?.templateRef"/> <col *ngFor="let column of columnsToRender; trackBy: trackBy;" [style.width.px]="column.width" [class.k-sorted]="isSorted(getColumnComponent(column))"/> </ng-container> `, isInline: true, dependencies: [{ kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ColGroupComponent, decorators: [{ type: Component, args: [{ selector: '[kendoGridColGroup]', template: ` <ng-container> <col [class.k-group-col]="true" *ngFor="let g of groups" /> <col [class.k-hierarchy-col]="true" *ngIf="detailTemplate?.templateRef"/> <col *ngFor="let column of columnsToRender; trackBy: trackBy;" [style.width.px]="column.width" [class.k-sorted]="isSorted(getColumnComponent(column))"/> </ng-container> `, standalone: true, imports: [NgFor, NgIf] }] }], propDecorators: { columns: [{ type: Input }], groups: [{ type: Input }], detailTemplate: [{ type: Input }], sort: [{ type: Input }] } });