UNPKG

@progress/kendo-angular-listview

Version:

Kendo UI Angular listview component

50 lines (49 loc) 2.55 kB
/**----------------------------------------------------------------------------------------- * 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 } from '@angular/core'; import * as i0 from "@angular/core"; /** * Allows customizing the list item content. To define an item template, nest an `<ng-template>` tag * with the `kendoListViewItemTemplate` directive inside the `<kendo-listview>` tag * ([see example]({% slug templates_listview %}#toc-item-template)). * * The following values are available as context variables: * - `let-dataItem="dataItem"` (`any`)&mdashThe current data item. Also available as implicit context variable. * - `let-index="index"` (`number`)&mdashThe current item index. * - `let-isFirst="isFirst"` (`boolean`)&mdashIndicates whether the current data item renders as the first item on the list. * - `let-isLast="isLast"` (`boolean`)&mdashIndicates whether the current data item renders as the last item on the list. * * @example * ```typescript * @Component({ * template: ` * <kendo-listview [data]="items"> * <ng-template kendoListViewItemTemplate let-dataItem let-index="index"> * <div class="item-wrapper"> * <h4>{{ dataItem.name }}</h4> * <p>Item #{{ index + 1 }}: {{ dataItem.description }}</p> * </div> * </ng-template> * </kendo-listview> * ` * }) * export class AppComponent { } * ``` */ export class ItemTemplateDirective { templateRef; constructor(templateRef) { this.templateRef = templateRef; } static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ItemTemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive }); static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.14", type: ItemTemplateDirective, isStandalone: true, selector: "[kendoListViewItemTemplate]", ngImport: i0 }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ItemTemplateDirective, decorators: [{ type: Directive, args: [{ selector: '[kendoListViewItemTemplate]', standalone: true }] }], ctorParameters: () => [{ type: i0.TemplateRef }] });