UNPKG

@progress/kendo-angular-treelist

Version:

Kendo UI TreeList for Angular - Display hierarchical data in an Angular tree grid view that supports sorting, filtering, paging, and much more.

69 lines (68 loc) 2.95 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 } from '@angular/core'; import { PDFService } from './pdf.service'; import { ToolBarButtonComponent } from '@progress/kendo-angular-toolbar'; import { Subscription } from 'rxjs'; import { filePdfIcon } from '@progress/kendo-svg-icons'; import * as i0 from "@angular/core"; import * as i1 from "./pdf.service"; import * as i2 from "@progress/kendo-angular-toolbar"; /** * Represents the `export-to-PDF` toolbar tool of the TreeList. * Apply this directive to any `kendo-toolbar-button` element inside a * ToolbarComponent. * * When you click the toolbar button that contains the directive, the * [`pdfExport`]({% slug api_treelist_treelistcomponent %}#toc-pdfexport) event * fires ([see example]({% slug pdfexport_treelist %})). * * @example * ```html * <kendo-treelist> * <kendo-toolbar> * <kendo-toolbar-button text="PDF Export" kendoTreeListPDFTool></kendo-toolbar-button> * </kendo-toolbar> * <kendo-treelist-pdf fileName="TreeList.pdf"> * </kendo-treelist-pdf> * </kendo-treelist> * ``` * @remarks * Applied to: {@link ToolBarButtonComponent} */ export class PDFCommandToolbarDirective { pdfService; host; clickSub = new Subscription(); constructor(pdfService, host) { this.pdfService = pdfService; this.host = host; } ngOnInit() { this.clickSub = this.host.click.subscribe(e => this.onClick(e)); this.host.className = 'k-grid-pdf'; this.host.svgIcon = filePdfIcon; this.host.icon = 'file-pdf'; } ngOnDestroy() { this.clickSub.unsubscribe(); } /** * @hidden */ onClick(e) { e.preventDefault(); this.pdfService.exportClick.emit(); } static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PDFCommandToolbarDirective, deps: [{ token: i1.PDFService }, { token: i2.ToolBarButtonComponent }], target: i0.ɵɵFactoryTarget.Directive }); static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: PDFCommandToolbarDirective, isStandalone: true, selector: "[kendoTreeListPDFTool]", ngImport: i0 }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PDFCommandToolbarDirective, decorators: [{ type: Directive, args: [{ selector: '[kendoTreeListPDFTool]', standalone: true }] }], ctorParameters: function () { return [{ type: i1.PDFService }, { type: i2.ToolBarButtonComponent }]; } });