@progress/kendo-angular-grid
Version:
Kendo UI Grid for Angular - high performance data grid with paging, filtering, virtualization, CRUD, and more.
61 lines (60 loc) • 3.13 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 { ChangeDetectorRef, Directive, NgZone } from '@angular/core';
import { PDFService } from './pdf.service';
import { ToolBarButtonComponent } from '@progress/kendo-angular-toolbar';
import { ContextService } from '../common/provider.service';
import { ToolbarToolBase } from '../common/toolbar-tool-base.directive';
import { ToolbarToolName } from '../navigation/toolbar-tool-name';
import * as i0 from "@angular/core";
import * as i1 from "./pdf.service";
import * as i2 from "@progress/kendo-angular-toolbar";
import * as i3 from "../common/provider.service";
/**
* Represents the PDF export toolbar tool of the Grid.
* Apply this directive to any `kendo-toolbar-button` element inside a ToolbarComponent in the Grid.
* When you click the toolbar button with this directive, the [`pdfExport`]({% slug api_grid_gridcomponent %}#toc-pdfexport) event fires. ([See example]({% slug pdfexport_grid %})).
*
* @example
* ```html
* <kendo-grid>
* <kendo-toolbar>
* <kendo-toolbar-button text="Export to PDF" kendoGridPDFTool></kendo-toolbar-button>
* </kendo-toolbar>
* <kendo-grid-pdf fileName="products.pdf"></kendo-grid-pdf>
* </kendo-grid>
* ```
* @remarks
* Applied to: {@link ToolBarButtonComponent}.
*/
export class PDFCommandToolbarDirective extends ToolbarToolBase {
pdfService;
host;
constructor(pdfService, host, ctx, zone, cdr) {
super(host, ToolbarToolName.pdfExport, ctx, zone, cdr);
this.pdfService = pdfService;
this.host = host;
}
ngOnInit() {
super.ngOnInit();
this.host.className = 'k-grid-pdf';
}
/**
* @hidden
*/
onClick(e) {
e.preventDefault();
this.pdfService.exportClick.emit();
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: PDFCommandToolbarDirective, deps: [{ token: i1.PDFService }, { token: i2.ToolBarButtonComponent }, { token: i3.ContextService }, { token: i0.NgZone }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.14", type: PDFCommandToolbarDirective, isStandalone: true, selector: "[kendoGridPDFTool]", usesInheritance: true, ngImport: i0 });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: PDFCommandToolbarDirective, decorators: [{
type: Directive,
args: [{
selector: '[kendoGridPDFTool]',
standalone: true
}]
}], ctorParameters: () => [{ type: i1.PDFService }, { type: i2.ToolBarButtonComponent }, { type: i3.ContextService }, { type: i0.NgZone }, { type: i0.ChangeDetectorRef }] });