@progress/kendo-angular-gantt
Version:
Kendo UI Angular Gantt
51 lines (50 loc) • 2.6 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, Optional, TemplateRef } from '@angular/core';
import * as i0 from "@angular/core";
/**
* Represents a template that defines the whole content of the task component.
* To define the template, nest an `<ng-template>` tag
* with the `kendoGanttTaskTemplate` directive inside the `<kendo-gantt>` tag.
*
* The template context is set to the current data item. The following additional field is passed:
* - `elementWidth`—The current task wrapper element's calculated width in pixels based on its start and end date.
* Use it as an alias for a template variable by utilizing the `let-elementWidth="elementWidth"` syntax.
* Useful for calculations related to rendering custom elements representing the task progress.
*
* @example
* ```ts-preview
* _@Component({
* selector: 'my-app',
* template: `
* <kendo-gantt [kendoGanttHierarchyBinding]="data">
* <ng-template kendoGanttTaskTemplate let-dataItem let-elementWidth="elementWidth">
* {{ dataItem.title }} - {{ dataItem.completionRatio * 100 }}% complete
* </ng-template>
* </kendo-gantt>
* `
* })
* class AppComponent {
* public data: any[] = sampleTasks;
* }
* ```
*/
export class GanttTaskTemplateDirective {
templateRef;
constructor(templateRef) {
this.templateRef = templateRef;
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: GanttTaskTemplateDirective, deps: [{ token: i0.TemplateRef, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: GanttTaskTemplateDirective, isStandalone: true, selector: "[kendoGanttTaskTemplate]", ngImport: i0 });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: GanttTaskTemplateDirective, decorators: [{
type: Directive,
args: [{
selector: '[kendoGanttTaskTemplate]',
standalone: true
}]
}], ctorParameters: function () { return [{ type: i0.TemplateRef, decorators: [{
type: Optional
}] }]; } });