@progress/kendo-angular-pdf-export 3.0.4 → 4.0.0-dev.202204131901
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/kendo-angular-pdf-export.umd.js +5 -0
- package/{dist/es2015/compile-template.d.ts → compile-template.d.ts} +0 -0
- package/{dist/es2015 → esm2015}/compile-template.js +0 -0
- package/{dist/es/index.js → esm2015/kendo-angular-pdf-export.js} +0 -0
- package/{dist/es → esm2015}/main.js +0 -0
- package/{dist/es2015 → esm2015}/package-metadata.js +1 -1
- package/esm2015/pdf-export-margin.component.js +43 -0
- package/esm2015/pdf-export-template.directive.js +21 -0
- package/{dist/es2015 → esm2015}/pdf-export.component.js +63 -108
- package/esm2015/pdf-export.module.js +33 -0
- package/fesm2015/kendo-angular-pdf-export.js +318 -0
- package/{dist/es2015/index.js → kendo-angular-pdf-export.d.ts} +1 -0
- package/{dist/es2015/main.d.ts → main.d.ts} +0 -0
- package/{dist/es2015/package-metadata.d.ts → package-metadata.d.ts} +0 -0
- package/package.json +33 -101
- package/{dist/es2015/pdf-export-margin.component.d.ts → pdf-export-margin.component.d.ts} +4 -1
- package/{dist/es2015/pdf-export-template.directive.d.ts → pdf-export-template.directive.d.ts} +3 -0
- package/{dist/es2015/pdf-export.component.d.ts → pdf-export.component.d.ts} +4 -1
- package/pdf-export.module.d.ts +16 -0
- package/schematics/ngAdd/index.js +5 -2
- package/schematics/ngAdd/index.js.map +1 -1
- package/dist/cdn/js/kendo-angular-pdf-export.js +0 -20
- package/dist/cdn/main.js +0 -5
- package/dist/es/compile-template.js +0 -25
- package/dist/es/package-metadata.js +0 -15
- package/dist/es/pdf-export-margin.component.js +0 -56
- package/dist/es/pdf-export-template.directive.js +0 -20
- package/dist/es/pdf-export.component.js +0 -253
- package/dist/es/pdf-export.module.js +0 -29
- package/dist/es2015/index.d.ts +0 -8
- package/dist/es2015/index.metadata.json +0 -1
- package/dist/es2015/main.js +0 -9
- package/dist/es2015/pdf-export-margin.component.js +0 -49
- package/dist/es2015/pdf-export-template.directive.js +0 -19
- package/dist/es2015/pdf-export.module.d.ts +0 -9
- package/dist/es2015/pdf-export.module.js +0 -26
- package/dist/fesm2015/index.js +0 -355
- package/dist/fesm5/index.js +0 -373
- package/dist/npm/compile-template.js +0 -27
- package/dist/npm/index.js +0 -11
- package/dist/npm/main.js +0 -16
- package/dist/npm/package-metadata.js +0 -17
- package/dist/npm/pdf-export-margin.component.js +0 -58
- package/dist/npm/pdf-export-template.directive.js +0 -22
- package/dist/npm/pdf-export.component.js +0 -255
- package/dist/npm/pdf-export.module.js +0 -31
- package/dist/systemjs/kendo-angular-pdf-export.js +0 -5
package/dist/fesm2015/index.js
DELETED
|
@@ -1,355 +0,0 @@
|
|
|
1
|
-
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
|
-
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
-
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { __decorate, __param, __metadata } from 'tslib';
|
|
6
|
-
import { Directive, Optional, TemplateRef, Input, Component, ContentChild, ElementRef, NgModule } from '@angular/core';
|
|
7
|
-
import { drawDOM, exportPDF } from '@progress/kendo-drawing';
|
|
8
|
-
import { saveAs } from '@progress/kendo-file-saver';
|
|
9
|
-
import { validatePackage } from '@progress/kendo-licensing';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* @hidden
|
|
13
|
-
*/
|
|
14
|
-
const packageMetadata = {
|
|
15
|
-
name: '@progress/kendo-angular-pdf-export',
|
|
16
|
-
productName: 'Kendo UI for Angular',
|
|
17
|
-
productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
|
|
18
|
-
publishDate: 1646219273,
|
|
19
|
-
version: '',
|
|
20
|
-
licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/?utm_medium=product&utm_source=kendoangular&utm_campaign=kendo-ui-angular-purchase-license-keys-warning'
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
let PDFExportTemplateDirective = class PDFExportTemplateDirective {
|
|
24
|
-
constructor(templateRef) {
|
|
25
|
-
this.templateRef = templateRef;
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
PDFExportTemplateDirective = __decorate([
|
|
29
|
-
Directive({
|
|
30
|
-
selector: '[kendoPDFTemplate]'
|
|
31
|
-
}),
|
|
32
|
-
__param(0, Optional()),
|
|
33
|
-
__metadata("design:paramtypes", [TemplateRef])
|
|
34
|
-
], PDFExportTemplateDirective);
|
|
35
|
-
|
|
36
|
-
const FIELDS = ['bottom', 'left', 'right', 'top'];
|
|
37
|
-
/**
|
|
38
|
-
* Represents the Kendo UI PDFMargin component for Angular.
|
|
39
|
-
*/
|
|
40
|
-
let PDFExportMarginComponent = class PDFExportMarginComponent {
|
|
41
|
-
/**
|
|
42
|
-
* @hidden
|
|
43
|
-
*/
|
|
44
|
-
get options() {
|
|
45
|
-
const options = {};
|
|
46
|
-
for (let idx = 0; idx < FIELDS.length; idx++) {
|
|
47
|
-
const field = FIELDS[idx];
|
|
48
|
-
const value = this[field];
|
|
49
|
-
if (typeof value !== 'undefined') {
|
|
50
|
-
options[field] = value;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
return options;
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
__decorate([
|
|
57
|
-
Input(),
|
|
58
|
-
__metadata("design:type", Object)
|
|
59
|
-
], PDFExportMarginComponent.prototype, "left", void 0);
|
|
60
|
-
__decorate([
|
|
61
|
-
Input(),
|
|
62
|
-
__metadata("design:type", Object)
|
|
63
|
-
], PDFExportMarginComponent.prototype, "top", void 0);
|
|
64
|
-
__decorate([
|
|
65
|
-
Input(),
|
|
66
|
-
__metadata("design:type", Object)
|
|
67
|
-
], PDFExportMarginComponent.prototype, "right", void 0);
|
|
68
|
-
__decorate([
|
|
69
|
-
Input(),
|
|
70
|
-
__metadata("design:type", Object)
|
|
71
|
-
], PDFExportMarginComponent.prototype, "bottom", void 0);
|
|
72
|
-
PDFExportMarginComponent = __decorate([
|
|
73
|
-
Component({
|
|
74
|
-
selector: 'kendo-pdf-export-margin',
|
|
75
|
-
template: ``
|
|
76
|
-
})
|
|
77
|
-
], PDFExportMarginComponent);
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* @hidden
|
|
81
|
-
*/
|
|
82
|
-
const compileTemplate = (templateRef) => {
|
|
83
|
-
const context = {};
|
|
84
|
-
let embeddedView = templateRef.createEmbeddedView(context);
|
|
85
|
-
const result = (data) => {
|
|
86
|
-
Object.assign(context, data);
|
|
87
|
-
embeddedView.detectChanges();
|
|
88
|
-
const templateWrap = document.createElement('span');
|
|
89
|
-
embeddedView.rootNodes.forEach((rootNode) => {
|
|
90
|
-
templateWrap.appendChild(rootNode.cloneNode(true));
|
|
91
|
-
});
|
|
92
|
-
return templateWrap;
|
|
93
|
-
};
|
|
94
|
-
result.destroy = () => {
|
|
95
|
-
embeddedView.destroy();
|
|
96
|
-
embeddedView = null;
|
|
97
|
-
};
|
|
98
|
-
return result;
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Represents the [Kendo UI PDF Export component for Angular]({% slug overview_pdfexport %}).
|
|
103
|
-
*
|
|
104
|
-
* @example
|
|
105
|
-
* ```ts-preview
|
|
106
|
-
* _@Component({
|
|
107
|
-
* selector: 'my-app',
|
|
108
|
-
* template: `
|
|
109
|
-
* <div class="example-config">
|
|
110
|
-
* <button kendoButton (click)="pdf.saveAs('document.pdf')">
|
|
111
|
-
* Save As PDF...
|
|
112
|
-
* </button>
|
|
113
|
-
* </div>
|
|
114
|
-
*
|
|
115
|
-
* <kendo-pdf-export #pdf paperSize="A4" margin="2cm">
|
|
116
|
-
* Content goes here
|
|
117
|
-
* </kendo-pdf-export>
|
|
118
|
-
* `
|
|
119
|
-
* })
|
|
120
|
-
* export class AppComponent {
|
|
121
|
-
* }
|
|
122
|
-
* ```
|
|
123
|
-
*/
|
|
124
|
-
let PDFExportComponent = class PDFExportComponent {
|
|
125
|
-
constructor(element) {
|
|
126
|
-
this.element = element;
|
|
127
|
-
/**
|
|
128
|
-
* The creator of the PDF document.
|
|
129
|
-
* @default "Kendo UI PDF Generator"
|
|
130
|
-
*/
|
|
131
|
-
this.creator = 'Kendo UI PDF Generator';
|
|
132
|
-
/**
|
|
133
|
-
* Specifies the name of the exported PDF file.
|
|
134
|
-
* @default "Export.pdf"
|
|
135
|
-
*/
|
|
136
|
-
this.fileName = 'export.pdf';
|
|
137
|
-
validatePackage(packageMetadata);
|
|
138
|
-
}
|
|
139
|
-
get drawMargin() {
|
|
140
|
-
const marginComponent = this.marginComponent;
|
|
141
|
-
let margin = this.margin;
|
|
142
|
-
if (marginComponent) {
|
|
143
|
-
margin = Object.assign(margin || {}, marginComponent.options);
|
|
144
|
-
}
|
|
145
|
-
return margin;
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* Saves the content as a PDF file with the specified name.
|
|
149
|
-
* @param fileName - The name of the exported file.
|
|
150
|
-
*/
|
|
151
|
-
saveAs(fileName = this.fileName) {
|
|
152
|
-
this.save(this.element.nativeElement, fileName);
|
|
153
|
-
}
|
|
154
|
-
/**
|
|
155
|
-
* Exports the content as a `Group` for further processing.
|
|
156
|
-
*
|
|
157
|
-
* @return - The root group of the exported scene.
|
|
158
|
-
*/
|
|
159
|
-
export() {
|
|
160
|
-
return this.exportElement(this.element.nativeElement);
|
|
161
|
-
}
|
|
162
|
-
save(element, fileName) {
|
|
163
|
-
this.exportElement(element)
|
|
164
|
-
.then(group => this.exportGroup(group, this.pdfOptions()))
|
|
165
|
-
.then(dataUri => this.saveDataUri(dataUri, fileName, this.saveOptions()));
|
|
166
|
-
}
|
|
167
|
-
exportElement(element) {
|
|
168
|
-
const promise = this.drawElement(element, this.drawOptions());
|
|
169
|
-
const cleanup = this.cleanup.bind(this);
|
|
170
|
-
promise.then(cleanup, cleanup);
|
|
171
|
-
return promise;
|
|
172
|
-
}
|
|
173
|
-
cleanup() {
|
|
174
|
-
if (this.pageTemplate) {
|
|
175
|
-
this.pageTemplate.destroy();
|
|
176
|
-
delete this.pageTemplate;
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
drawOptions() {
|
|
180
|
-
if (this.pageTemplateDirective) {
|
|
181
|
-
this.pageTemplate = compileTemplate(this.pageTemplateDirective.templateRef);
|
|
182
|
-
}
|
|
183
|
-
return {
|
|
184
|
-
avoidLinks: this.avoidLinks,
|
|
185
|
-
forcePageBreak: this.forcePageBreak,
|
|
186
|
-
keepTogether: this.keepTogether,
|
|
187
|
-
margin: this.drawMargin,
|
|
188
|
-
paperSize: this.paperSize,
|
|
189
|
-
landscape: this.landscape,
|
|
190
|
-
repeatHeaders: this.repeatHeaders,
|
|
191
|
-
scale: this.scale,
|
|
192
|
-
template: this.pageTemplate
|
|
193
|
-
};
|
|
194
|
-
}
|
|
195
|
-
pdfOptions() {
|
|
196
|
-
return {
|
|
197
|
-
autoPrint: this.autoPrint,
|
|
198
|
-
author: this.author,
|
|
199
|
-
creator: this.creator,
|
|
200
|
-
date: this.date,
|
|
201
|
-
imgDPI: this.imageResolution,
|
|
202
|
-
keywords: this.keywords,
|
|
203
|
-
landscape: this.landscape,
|
|
204
|
-
margin: this.drawMargin,
|
|
205
|
-
multiPage: true,
|
|
206
|
-
paperSize: this.paperSize,
|
|
207
|
-
producer: this.producer,
|
|
208
|
-
subject: this.subject,
|
|
209
|
-
title: this.title
|
|
210
|
-
};
|
|
211
|
-
}
|
|
212
|
-
saveOptions() {
|
|
213
|
-
return {
|
|
214
|
-
forceProxy: this.forceProxy,
|
|
215
|
-
proxyData: this.proxyData,
|
|
216
|
-
proxyTarget: this.proxyTarget,
|
|
217
|
-
proxyURL: this.proxyURL
|
|
218
|
-
};
|
|
219
|
-
}
|
|
220
|
-
drawElement(element, options) {
|
|
221
|
-
return drawDOM(element, options);
|
|
222
|
-
}
|
|
223
|
-
exportGroup(group, options) {
|
|
224
|
-
return exportPDF(group, options);
|
|
225
|
-
}
|
|
226
|
-
saveDataUri(dataUri, fileName, options) {
|
|
227
|
-
saveAs(dataUri, fileName, options);
|
|
228
|
-
}
|
|
229
|
-
};
|
|
230
|
-
__decorate([
|
|
231
|
-
Input(),
|
|
232
|
-
__metadata("design:type", Boolean)
|
|
233
|
-
], PDFExportComponent.prototype, "autoPrint", void 0);
|
|
234
|
-
__decorate([
|
|
235
|
-
Input(),
|
|
236
|
-
__metadata("design:type", String)
|
|
237
|
-
], PDFExportComponent.prototype, "author", void 0);
|
|
238
|
-
__decorate([
|
|
239
|
-
Input(),
|
|
240
|
-
__metadata("design:type", Object)
|
|
241
|
-
], PDFExportComponent.prototype, "avoidLinks", void 0);
|
|
242
|
-
__decorate([
|
|
243
|
-
Input(),
|
|
244
|
-
__metadata("design:type", String)
|
|
245
|
-
], PDFExportComponent.prototype, "forcePageBreak", void 0);
|
|
246
|
-
__decorate([
|
|
247
|
-
Input(),
|
|
248
|
-
__metadata("design:type", String)
|
|
249
|
-
], PDFExportComponent.prototype, "keepTogether", void 0);
|
|
250
|
-
__decorate([
|
|
251
|
-
Input(),
|
|
252
|
-
__metadata("design:type", String)
|
|
253
|
-
], PDFExportComponent.prototype, "creator", void 0);
|
|
254
|
-
__decorate([
|
|
255
|
-
Input(),
|
|
256
|
-
__metadata("design:type", Date)
|
|
257
|
-
], PDFExportComponent.prototype, "date", void 0);
|
|
258
|
-
__decorate([
|
|
259
|
-
Input(),
|
|
260
|
-
__metadata("design:type", Number)
|
|
261
|
-
], PDFExportComponent.prototype, "imageResolution", void 0);
|
|
262
|
-
__decorate([
|
|
263
|
-
Input(),
|
|
264
|
-
__metadata("design:type", String)
|
|
265
|
-
], PDFExportComponent.prototype, "fileName", void 0);
|
|
266
|
-
__decorate([
|
|
267
|
-
Input(),
|
|
268
|
-
__metadata("design:type", Boolean)
|
|
269
|
-
], PDFExportComponent.prototype, "forceProxy", void 0);
|
|
270
|
-
__decorate([
|
|
271
|
-
Input(),
|
|
272
|
-
__metadata("design:type", String)
|
|
273
|
-
], PDFExportComponent.prototype, "keywords", void 0);
|
|
274
|
-
__decorate([
|
|
275
|
-
Input(),
|
|
276
|
-
__metadata("design:type", Boolean)
|
|
277
|
-
], PDFExportComponent.prototype, "landscape", void 0);
|
|
278
|
-
__decorate([
|
|
279
|
-
Input(),
|
|
280
|
-
__metadata("design:type", Object)
|
|
281
|
-
], PDFExportComponent.prototype, "margin", void 0);
|
|
282
|
-
__decorate([
|
|
283
|
-
Input(),
|
|
284
|
-
__metadata("design:type", Object)
|
|
285
|
-
], PDFExportComponent.prototype, "paperSize", void 0);
|
|
286
|
-
__decorate([
|
|
287
|
-
Input(),
|
|
288
|
-
__metadata("design:type", Boolean)
|
|
289
|
-
], PDFExportComponent.prototype, "repeatHeaders", void 0);
|
|
290
|
-
__decorate([
|
|
291
|
-
Input(),
|
|
292
|
-
__metadata("design:type", Number)
|
|
293
|
-
], PDFExportComponent.prototype, "scale", void 0);
|
|
294
|
-
__decorate([
|
|
295
|
-
Input(),
|
|
296
|
-
__metadata("design:type", Object)
|
|
297
|
-
], PDFExportComponent.prototype, "proxyData", void 0);
|
|
298
|
-
__decorate([
|
|
299
|
-
Input(),
|
|
300
|
-
__metadata("design:type", String)
|
|
301
|
-
], PDFExportComponent.prototype, "proxyURL", void 0);
|
|
302
|
-
__decorate([
|
|
303
|
-
Input(),
|
|
304
|
-
__metadata("design:type", String)
|
|
305
|
-
], PDFExportComponent.prototype, "proxyTarget", void 0);
|
|
306
|
-
__decorate([
|
|
307
|
-
Input(),
|
|
308
|
-
__metadata("design:type", String)
|
|
309
|
-
], PDFExportComponent.prototype, "producer", void 0);
|
|
310
|
-
__decorate([
|
|
311
|
-
Input(),
|
|
312
|
-
__metadata("design:type", String)
|
|
313
|
-
], PDFExportComponent.prototype, "subject", void 0);
|
|
314
|
-
__decorate([
|
|
315
|
-
Input(),
|
|
316
|
-
__metadata("design:type", String)
|
|
317
|
-
], PDFExportComponent.prototype, "title", void 0);
|
|
318
|
-
__decorate([
|
|
319
|
-
ContentChild(PDFExportTemplateDirective, { static: false }),
|
|
320
|
-
__metadata("design:type", PDFExportTemplateDirective)
|
|
321
|
-
], PDFExportComponent.prototype, "pageTemplateDirective", void 0);
|
|
322
|
-
__decorate([
|
|
323
|
-
ContentChild(PDFExportMarginComponent, { static: false }),
|
|
324
|
-
__metadata("design:type", PDFExportMarginComponent)
|
|
325
|
-
], PDFExportComponent.prototype, "marginComponent", void 0);
|
|
326
|
-
PDFExportComponent = __decorate([
|
|
327
|
-
Component({
|
|
328
|
-
selector: 'kendo-pdf-export',
|
|
329
|
-
template: `<div><ng-content></ng-content></div>`
|
|
330
|
-
}),
|
|
331
|
-
__metadata("design:paramtypes", [ElementRef])
|
|
332
|
-
], PDFExportComponent);
|
|
333
|
-
|
|
334
|
-
const COMPONENT_DIRECTIVES = [
|
|
335
|
-
PDFExportComponent,
|
|
336
|
-
PDFExportMarginComponent,
|
|
337
|
-
PDFExportTemplateDirective
|
|
338
|
-
];
|
|
339
|
-
/**
|
|
340
|
-
* Represents the [NgModule]({{ site.data.urls.angular['ngmoduleapi'] }}) definition for the PDF Export directive.
|
|
341
|
-
*/
|
|
342
|
-
let PDFExportModule = class PDFExportModule {
|
|
343
|
-
};
|
|
344
|
-
PDFExportModule = __decorate([
|
|
345
|
-
NgModule({
|
|
346
|
-
declarations: [COMPONENT_DIRECTIVES],
|
|
347
|
-
exports: [COMPONENT_DIRECTIVES]
|
|
348
|
-
})
|
|
349
|
-
], PDFExportModule);
|
|
350
|
-
|
|
351
|
-
/**
|
|
352
|
-
* Generated bundle index. Do not edit.
|
|
353
|
-
*/
|
|
354
|
-
|
|
355
|
-
export { PDFExportComponent, PDFExportModule, PDFExportMarginComponent, PDFExportTemplateDirective, compileTemplate };
|