@progress/kendo-angular-grid
Version:
Kendo UI Grid for Angular - high performance data grid with paging, filtering, virtualization, CRUD, and more.
59 lines (58 loc) • 2.89 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 { Directive, TemplateRef, Optional, Input } from '@angular/core';
import { GridConfigurationErrorMessages } from '../../common/error-messages';
import * as i0 from "@angular/core";
/**
* Represents the detail template of the Grid ([more information and examples]({% slug detailrowtemplate_grid %})).
* To define the detail template, nest an `<ng-template>` tag with the `kendoGridDetailTemplate` directive inside a `<kendo-grid>` tag.
*
* @example
* ```html
* <kendo-grid [data]="data" selectable="true" style="height: 160px">
* <kendo-grid-column field="ProductName"></kendo-grid-column>
* <ng-template kendoGridDetailTemplate let-dataItem>
* <div *ngIf="dataItem.Category">
* <header>{{dataItem.Category?.CategoryName}}</header>
* span>{{dataItem.Category?.Description}}</span>
* </div>
* </ng-template>
* </kendo-grid>
* ```
*
*/
export class DetailTemplateDirective {
templateRef;
/**
* Defines the function that indicates if a given detail row and the associated **Expand** or **Collapse** button will be displayed.
*/
set showIf(fn) {
if (typeof fn !== 'function') {
throw new Error(GridConfigurationErrorMessages.functionType('showIf', fn));
}
this._condition = fn;
}
get showIf() {
return this._condition;
}
constructor(templateRef) {
this.templateRef = templateRef;
}
_condition = () => true;
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DetailTemplateDirective, deps: [{ token: i0.TemplateRef, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: DetailTemplateDirective, isStandalone: true, selector: "[kendoGridDetailTemplate]", inputs: { showIf: ["kendoGridDetailTemplateShowIf", "showIf"] }, ngImport: i0 });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DetailTemplateDirective, decorators: [{
type: Directive,
args: [{
selector: '[kendoGridDetailTemplate]',
standalone: true
}]
}], ctorParameters: function () { return [{ type: i0.TemplateRef, decorators: [{
type: Optional
}] }]; }, propDecorators: { showIf: [{
type: Input,
args: ["kendoGridDetailTemplateShowIf"]
}] } });