@progress/kendo-angular-scheduler
Version:
Kendo UI Scheduler Angular - Outlook or Google-style angular scheduler calendar. Full-featured and customizable embedded scheduling from the creator developers trust for professional UI components.
87 lines (86 loc) • 4.77 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 { Component, HostListener, ElementRef, Renderer2, NgZone } from '@angular/core';
import { Button } from '@progress/kendo-angular-buttons';
import { LocalizationService } from '@progress/kendo-angular-l10n';
import { PDFService } from './pdf.service';
import { filePdfIcon } from '@progress/kendo-svg-icons';
import { IconWrapperComponent } from '@progress/kendo-angular-icons';
import { NgIf, NgClass } from '@angular/common';
import * as i0 from "@angular/core";
import * as i1 from "./pdf.service";
import * as i2 from "@progress/kendo-angular-l10n";
/**
* Represents the `export-to-PDF` command of the Scheduler.
* You can apply this directive to any `button` element inside a
* [`ToolbarTemplate`]({% slug toolbar_scheduler %}).
* When the user clicks a button that is associated with the directive, the
* [`pdfExport`]({% slug api_scheduler_schedulercomponent %}#toc-pdfexport) event
* fires ([see example]({% slug pdfexport_scheduler %})).
*
* ```html
* <kendo-scheduler>
* <ng-template kendoSchedulerToolbarTemplate>
* <button kendoSchedulerPDFCommand>Export PDF</button>
* </ng-template>
* <kendo-scheduler-pdf fileName="Scheduler.pdf">
* </kendo-scheduler-pdf>
* </kendo-scheduler>
* ```
*/
export class PDFCommandDirective extends Button {
pdfService;
/**
* @hidden
*/
onClick(e) {
e.preventDefault();
this.pdfService.exportClick.emit();
}
constructor(pdfService, element, renderer, localization, ngZone) {
super(element, renderer, null, localization, ngZone);
this.pdfService = pdfService;
}
ngOnInit() {
this.icon = 'pdf';
this.svgIcon = filePdfIcon;
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PDFCommandDirective, deps: [{ token: i1.PDFService }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i2.LocalizationService }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: PDFCommandDirective, isStandalone: true, selector: "[kendoSchedulerPDFCommand]", host: { listeners: { "click": "onClick($event)" } }, usesInheritance: true, ngImport: i0, template: `
<kendo-icon-wrapper
*ngIf="icon || svgIcon"
innerCssClass="k-button-icon"
[name]="icon"
[svgIcon]="svgIcon"></kendo-icon-wrapper>
<span *ngIf="imageUrl" class="k-button-icon k-icon">
<img [src]="imageUrl" class="k-image" role="presentation" />
</span>
<span *ngIf="iconClass" class="k-button-icon" [ngClass]="iconClass"></span>
<span class="k-button-text"><ng-content></ng-content></span>
`, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: IconWrapperComponent, selector: "kendo-icon-wrapper", inputs: ["name", "svgIcon", "innerCssClass", "customFontClass", "size"], exportAs: ["kendoIconWrapper"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PDFCommandDirective, decorators: [{
type: Component,
args: [{
selector: '[kendoSchedulerPDFCommand]',
template: `
<kendo-icon-wrapper
*ngIf="icon || svgIcon"
innerCssClass="k-button-icon"
[name]="icon"
[svgIcon]="svgIcon"></kendo-icon-wrapper>
<span *ngIf="imageUrl" class="k-button-icon k-icon">
<img [src]="imageUrl" class="k-image" role="presentation" />
</span>
<span *ngIf="iconClass" class="k-button-icon" [ngClass]="iconClass"></span>
<span class="k-button-text"><ng-content></ng-content></span>
`,
standalone: true,
imports: [NgIf, IconWrapperComponent, NgClass]
}]
}], ctorParameters: function () { return [{ type: i1.PDFService }, { type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i2.LocalizationService }, { type: i0.NgZone }]; }, propDecorators: { onClick: [{
type: HostListener,
args: ['click', ['$event']]
}] } });