@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) • 3.12 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 { ToolBarButtonComponent } from '@progress/kendo-angular-toolbar';
import { ExcelService } from './excel.service';
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 "./excel.service";
import * as i2 from "@progress/kendo-angular-toolbar";
import * as i3 from "../common/provider.service";
/**
* Represents the **Export to Excel** toolbar tool of the Grid.
* Apply this directive to any `kendo-toolbar-button` element inside a ToolbarComponent used in the Grid.
* When the user clicks the button, the [`excelExport`]({% slug api_grid_gridcomponent %}#toc-excelexport) event fires ([see example]({% slug excelexport_grid %})).
*
* @example
* ```html
* <kendo-grid>
* <kendo-toolbar>
* <kendo-toolbar-button text="Excel Export" kendoGridExcelTool></kendo-toolbar-button>
* </kendo-toolbar>
* <kendo-grid-excel fileName="Grid.xlsx"></kendo-grid-excel>
* </kendo-grid>
* ```
* @remarks
* Applied to: {@link ToolBarButtonComponent}.
*/
export class ExcelCommandToolbarDirective extends ToolbarToolBase {
excelService;
constructor(excelService, host, ctx, zone, cdr) {
super(host, ToolbarToolName.excelExport, ctx, zone, cdr);
this.excelService = excelService;
}
ngOnInit() {
super.ngOnInit();
this.host.className = 'k-grid-excel';
}
/**
* @hidden
*/
onClick(e) {
e.preventDefault();
this.excelService.exportClick.emit();
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ExcelCommandToolbarDirective, deps: [{ token: i1.ExcelService }, { 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: ExcelCommandToolbarDirective, isStandalone: true, selector: "[kendoGridExcelTool]", usesInheritance: true, ngImport: i0 });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ExcelCommandToolbarDirective, decorators: [{
type: Directive,
args: [{
selector: '[kendoGridExcelTool]',
standalone: true
}]
}], ctorParameters: () => [{ type: i1.ExcelService }, { type: i2.ToolBarButtonComponent }, { type: i3.ContextService }, { type: i0.NgZone }, { type: i0.ChangeDetectorRef }] });