@progress/kendo-vue-pdf 3.6.4 → 3.7.0-dev.202210250731
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/dist/cdn/js/kendo-vue-pdf.js +1 -1
- package/dist/es/PDFExport.js +4 -5
- package/dist/es/{grid → common}/dom-queries.d.ts +0 -0
- package/dist/es/{grid → common}/dom-queries.js +1 -1
- package/dist/es/common/table-query.d.ts +22 -0
- package/dist/es/common/table-query.js +36 -0
- package/dist/es/common/utils.d.ts +20 -0
- package/dist/es/common/utils.js +74 -0
- package/dist/es/grid/GridPDFExport.js +2 -5
- package/dist/es/grid/export-element.js +2 -58
- package/dist/es/grid/grid-query.js +2 -2
- package/dist/es/grid/provideSaveGridPDF.js +2 -20
- package/dist/es/main.d.ts +2 -1
- package/dist/es/main.js +2 -1
- package/dist/es/package-metadata.js +1 -1
- package/dist/es/treelist/TreeListPDFExport.d.ts +37 -0
- package/dist/es/treelist/TreeListPDFExport.js +75 -0
- package/dist/es/treelist/export-element.d.ts +4 -0
- package/dist/es/treelist/export-element.js +31 -0
- package/dist/es/treelist/provideSaveTreeListPDF.d.ts +5 -0
- package/dist/es/treelist/provideSaveTreeListPDF.js +116 -0
- package/dist/esm/PDFExport.js +4 -5
- package/dist/esm/{grid → common}/dom-queries.d.ts +0 -0
- package/dist/esm/{grid → common}/dom-queries.js +1 -1
- package/dist/esm/common/table-query.d.ts +22 -0
- package/dist/esm/common/table-query.js +36 -0
- package/dist/esm/common/utils.d.ts +20 -0
- package/dist/esm/common/utils.js +74 -0
- package/dist/esm/grid/GridPDFExport.js +2 -5
- package/dist/esm/grid/export-element.js +2 -58
- package/dist/esm/grid/grid-query.js +2 -2
- package/dist/esm/grid/provideSaveGridPDF.js +2 -20
- package/dist/esm/main.d.ts +2 -1
- package/dist/esm/main.js +2 -1
- package/dist/esm/package-metadata.js +1 -1
- package/dist/esm/treelist/TreeListPDFExport.d.ts +37 -0
- package/dist/esm/treelist/TreeListPDFExport.js +75 -0
- package/dist/esm/treelist/export-element.d.ts +4 -0
- package/dist/esm/treelist/export-element.js +31 -0
- package/dist/esm/treelist/provideSaveTreeListPDF.d.ts +5 -0
- package/dist/esm/treelist/provideSaveTreeListPDF.js +116 -0
- package/dist/npm/PDFExport.js +7 -14
- package/dist/npm/{grid → common}/dom-queries.d.ts +0 -0
- package/dist/npm/{grid → common}/dom-queries.js +1 -1
- package/dist/npm/common/table-query.d.ts +22 -0
- package/dist/npm/common/table-query.js +39 -0
- package/dist/npm/common/utils.d.ts +20 -0
- package/dist/npm/common/utils.js +82 -0
- package/dist/npm/grid/GridPDFExport.js +4 -12
- package/dist/npm/grid/export-element.js +3 -59
- package/dist/npm/grid/grid-query.js +2 -2
- package/dist/npm/grid/provideSaveGridPDF.js +2 -25
- package/dist/npm/main.d.ts +2 -1
- package/dist/npm/main.js +4 -1
- package/dist/npm/package-metadata.js +1 -1
- package/dist/npm/treelist/TreeListPDFExport.d.ts +37 -0
- package/dist/npm/treelist/TreeListPDFExport.js +82 -0
- package/dist/npm/treelist/export-element.d.ts +4 -0
- package/dist/npm/treelist/export-element.js +35 -0
- package/dist/npm/treelist/provideSaveTreeListPDF.d.ts +5 -0
- package/dist/npm/treelist/provideSaveTreeListPDF.js +123 -0
- package/package.json +2 -2
|
@@ -3,24 +3,18 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.GridPdfExportVue2 = exports.GridPdfExport = void 0;
|
|
7
|
-
|
|
6
|
+
exports.GridPdfExportVue2 = exports.GridPdfExport = void 0;
|
|
7
|
+
// @ts-ignore
|
|
8
8
|
var Vue = require("vue");
|
|
9
|
-
|
|
10
9
|
var allVue = Vue;
|
|
11
10
|
var gh = allVue.h;
|
|
12
11
|
var isV3 = allVue.version && allVue.version[0] === '3';
|
|
13
|
-
|
|
14
12
|
var savePDF_1 = require("../savePDF");
|
|
15
|
-
|
|
16
13
|
var provideSaveGridPDF_1 = require("./provideSaveGridPDF");
|
|
17
|
-
|
|
18
14
|
var kendo_vue_common_1 = require("@progress/kendo-vue-common");
|
|
19
15
|
/**
|
|
20
16
|
* @hidden
|
|
21
17
|
*/
|
|
22
|
-
|
|
23
|
-
|
|
24
18
|
var GridPdfExportVue2 = {
|
|
25
19
|
name: 'grid-pdf-export',
|
|
26
20
|
props: {
|
|
@@ -52,12 +46,11 @@ var GridPdfExportVue2 = {
|
|
|
52
46
|
},
|
|
53
47
|
methods: {
|
|
54
48
|
save: function save(data, callback) {
|
|
55
|
-
var defaultSlot = (0, kendo_vue_common_1.getDefaultSlots)(this);
|
|
56
|
-
|
|
49
|
+
var defaultSlot = (0, kendo_vue_common_1.getDefaultSlots)(this);
|
|
50
|
+
// @ts-ignore
|
|
57
51
|
var gridSlot = defaultSlot.filter(function (child) {
|
|
58
52
|
return child && child.tag && child.tag.toLowerCase().indexOf('grid') !== -1 || child.componentOptions && child.componentOptions.tag && child.componentOptions.tag.toLowerCase().indexOf('grid') !== -1 || child.type && child.type.name && child.type.name.toLowerCase().indexOf('grid') !== -1;
|
|
59
53
|
});
|
|
60
|
-
|
|
61
54
|
if (gridSlot.length) {
|
|
62
55
|
this.gridComponent = this.v3 ? gridSlot[0] : gridSlot[0].componentInstance;
|
|
63
56
|
this.saveGridPDF(this.gridComponent, this.$props, callback, data, this.v3);
|
|
@@ -85,6 +78,5 @@ exports.GridPdfExportVue2 = GridPdfExportVue2;
|
|
|
85
78
|
/**
|
|
86
79
|
* @hidden
|
|
87
80
|
*/
|
|
88
|
-
|
|
89
81
|
var GridPdfExport = GridPdfExportVue2;
|
|
90
82
|
exports.GridPdfExport = GridPdfExport;
|
|
@@ -2,63 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.exportElement = void 0;
|
|
4
4
|
var grid_query_1 = require("./grid-query");
|
|
5
|
-
var
|
|
6
|
-
var appendNodes = function (element, nodes) {
|
|
7
|
-
var length = nodes.length;
|
|
8
|
-
for (var idx = 0; idx < length; idx++) {
|
|
9
|
-
element.appendChild(nodes[idx].cloneNode(true));
|
|
10
|
-
}
|
|
11
|
-
};
|
|
12
|
-
var wrapTable = function (table) {
|
|
13
|
-
var wrapper = document.createElement('div');
|
|
14
|
-
wrapper.className = 'k-widget k-grid';
|
|
15
|
-
wrapper.appendChild(table);
|
|
16
|
-
return wrapper;
|
|
17
|
-
};
|
|
18
|
-
var createTableElement = function (sources) {
|
|
19
|
-
var sourceCount = sources.length;
|
|
20
|
-
var element = sources[0].cloneNode(true);
|
|
21
|
-
var rowsCount = element.rows.length;
|
|
22
|
-
if (sourceCount > 1) {
|
|
23
|
-
for (var rowIdx = 0; rowIdx < rowsCount; rowIdx++) {
|
|
24
|
-
for (var sourceIdx = 1; sourceIdx < sourceCount; sourceIdx++) {
|
|
25
|
-
appendNodes(element.rows[rowIdx], sources[sourceIdx].rows[rowIdx].cells);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
return element;
|
|
30
|
-
};
|
|
31
|
-
var setFirstCellClass = function (header, headers) {
|
|
32
|
-
if (headers.length > 1 && header.rows.length > 1) {
|
|
33
|
-
for (var idx = 1; idx < header.rows.length; idx++) {
|
|
34
|
-
var firstCellIndex = headers[0].rows[idx].cells.length;
|
|
35
|
-
var cell = header.rows[idx].cells[firstCellIndex];
|
|
36
|
-
if (String(cell.className).indexOf(FIRST_CLASS) === -1) {
|
|
37
|
-
cell.className += " ".concat(FIRST_CLASS);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
var createTable = function (colGroups, headers, bodies, footers) {
|
|
43
|
-
var table = document.createElement('table');
|
|
44
|
-
var colGroup = colGroups[0].cloneNode(true);
|
|
45
|
-
for (var idx = 1; idx < colGroups.length; idx++) {
|
|
46
|
-
appendNodes(colGroup, colGroups[idx].querySelectorAll('col'));
|
|
47
|
-
}
|
|
48
|
-
var header = createTableElement(headers);
|
|
49
|
-
var body = createTableElement(bodies);
|
|
50
|
-
header.className = grid_query_1.HEADER_CLASS;
|
|
51
|
-
setFirstCellClass(header, headers);
|
|
52
|
-
table.appendChild(colGroup);
|
|
53
|
-
table.appendChild(header);
|
|
54
|
-
table.appendChild(body);
|
|
55
|
-
if (footers.length) {
|
|
56
|
-
var footer = createTableElement(footers);
|
|
57
|
-
footer.className = grid_query_1.FOOTER_CLASS;
|
|
58
|
-
table.appendChild(footer);
|
|
59
|
-
}
|
|
60
|
-
return wrapTable(table);
|
|
61
|
-
};
|
|
5
|
+
var utils_1 = require("../common/utils");
|
|
62
6
|
/**
|
|
63
7
|
* @hidden
|
|
64
8
|
*/
|
|
@@ -72,10 +16,10 @@ var exportElement = function (wrapper) {
|
|
|
72
16
|
var bodies = [content.querySelector('tbody')];
|
|
73
17
|
var footer = query.footer();
|
|
74
18
|
var footers = footer ? [footer.querySelector('tfoot')] : [];
|
|
75
|
-
result = createTable(colGroups, headers, bodies, footers);
|
|
19
|
+
result = (0, utils_1.createTable)(colGroups, headers, bodies, footers);
|
|
76
20
|
}
|
|
77
21
|
else {
|
|
78
|
-
result = wrapTable(query.table().cloneNode(true));
|
|
22
|
+
result = (0, utils_1.wrapTable)(query.table().cloneNode(true));
|
|
79
23
|
}
|
|
80
24
|
return result;
|
|
81
25
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GridQuery = exports.FOOTER_CLASS = exports.HEADER_CLASS = void 0;
|
|
4
|
-
var dom_queries_1 = require("
|
|
4
|
+
var dom_queries_1 = require("../common/dom-queries");
|
|
5
5
|
/**
|
|
6
6
|
* @hidden
|
|
7
7
|
*/
|
|
@@ -19,7 +19,7 @@ var suffix = function (locked) { return locked ? 'locked' : 'wrap'; };
|
|
|
19
19
|
var GridQuery = /** @class */ (function () {
|
|
20
20
|
function GridQuery(element) {
|
|
21
21
|
this.element = element;
|
|
22
|
-
this.list = (0, dom_queries_1.findElement)(element, (0, dom_queries_1.matchesClasses)(
|
|
22
|
+
this.list = (0, dom_queries_1.findElement)(element, (0, dom_queries_1.matchesClasses)('k-grid-container'));
|
|
23
23
|
}
|
|
24
24
|
GridQuery.prototype.content = function (locked) {
|
|
25
25
|
return (0, dom_queries_1.findElement)(this.list, (0, dom_queries_1.matchesClasses)("k-grid-content".concat(locked ? '-locked' : '')));
|
|
@@ -4,65 +4,50 @@ var __assign = undefined && undefined.__assign || function () {
|
|
|
4
4
|
__assign = Object.assign || function (t) {
|
|
5
5
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
6
6
|
s = arguments[i];
|
|
7
|
-
|
|
8
7
|
for (var p in s) {
|
|
9
8
|
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
10
9
|
}
|
|
11
10
|
}
|
|
12
|
-
|
|
13
11
|
return t;
|
|
14
12
|
};
|
|
15
|
-
|
|
16
13
|
return __assign.apply(this, arguments);
|
|
17
14
|
};
|
|
18
|
-
|
|
19
15
|
Object.defineProperty(exports, "__esModule", {
|
|
20
16
|
value: true
|
|
21
17
|
});
|
|
22
|
-
exports.provideSaveGridPDF = void 0;
|
|
23
|
-
|
|
18
|
+
exports.provideSaveGridPDF = void 0;
|
|
19
|
+
// @ts-ignore
|
|
24
20
|
var Vue = require("vue");
|
|
25
|
-
|
|
26
21
|
var kendo_vue_common_1 = require("@progress/kendo-vue-common");
|
|
27
|
-
|
|
28
22
|
var allVue = Vue;
|
|
29
23
|
var h = allVue.h;
|
|
30
24
|
var createApp = allVue.createApp;
|
|
31
|
-
|
|
32
25
|
var export_element_1 = require("./export-element");
|
|
33
26
|
/**
|
|
34
27
|
* @hidden
|
|
35
28
|
*/
|
|
36
|
-
|
|
37
|
-
|
|
38
29
|
function provideSaveGridPDF(savePDF) {
|
|
39
30
|
return function (grid, pdfExportOptions, callback, data, columns) {
|
|
40
31
|
if (pdfExportOptions === void 0) {
|
|
41
32
|
pdfExportOptions = {};
|
|
42
33
|
}
|
|
43
|
-
|
|
44
34
|
return saveGridPDF(savePDF, grid, pdfExportOptions, callback, data, columns);
|
|
45
35
|
};
|
|
46
36
|
}
|
|
47
|
-
|
|
48
37
|
exports.provideSaveGridPDF = provideSaveGridPDF;
|
|
49
|
-
|
|
50
38
|
function saveGridPDF(savePDF, grid, pdfExportOptions, callback, data, v3) {
|
|
51
39
|
if (pdfExportOptions === void 0) {
|
|
52
40
|
pdfExportOptions = {};
|
|
53
41
|
}
|
|
54
|
-
|
|
55
42
|
renderGrid();
|
|
56
43
|
var gridOuterWrapper;
|
|
57
44
|
var gridInnerWrapper;
|
|
58
45
|
var finalContainer;
|
|
59
46
|
var gridInstance;
|
|
60
|
-
|
|
61
47
|
function renderGrid() {
|
|
62
48
|
if (!kendo_vue_common_1.canUseDOM) {
|
|
63
49
|
return;
|
|
64
50
|
}
|
|
65
|
-
|
|
66
51
|
gridOuterWrapper = document.createElement('div');
|
|
67
52
|
gridOuterWrapper.setAttribute('style', 'position:absolute; left: -5000px; top: 0px;');
|
|
68
53
|
gridInnerWrapper = document.createElement('div');
|
|
@@ -74,7 +59,6 @@ function saveGridPDF(savePDF, grid, pdfExportOptions, callback, data, v3) {
|
|
|
74
59
|
pageSize: data.length,
|
|
75
60
|
skip: 0
|
|
76
61
|
};
|
|
77
|
-
|
|
78
62
|
if (v3) {
|
|
79
63
|
var gridForPdf = {
|
|
80
64
|
render: function render() {
|
|
@@ -87,7 +71,6 @@ function saveGridPDF(savePDF, grid, pdfExportOptions, callback, data, v3) {
|
|
|
87
71
|
// @ts-ignore
|
|
88
72
|
this.$el.style.width = '1000px';
|
|
89
73
|
}
|
|
90
|
-
|
|
91
74
|
onGridRendered.call(this);
|
|
92
75
|
}
|
|
93
76
|
};
|
|
@@ -102,7 +85,6 @@ function saveGridPDF(savePDF, grid, pdfExportOptions, callback, data, v3) {
|
|
|
102
85
|
if (gridInstance.$el.style) {
|
|
103
86
|
gridInstance.$el.style.width = '1000px';
|
|
104
87
|
}
|
|
105
|
-
|
|
106
88
|
onGridRendered.call(gridInstance);
|
|
107
89
|
}
|
|
108
90
|
});
|
|
@@ -111,27 +93,22 @@ function saveGridPDF(savePDF, grid, pdfExportOptions, callback, data, v3) {
|
|
|
111
93
|
gridInstance.$mount(gridInnerWrapper);
|
|
112
94
|
}
|
|
113
95
|
}
|
|
114
|
-
|
|
115
96
|
function onGridRendered() {
|
|
116
97
|
savePDF(prepareFinalElementForExport.call(this), pdfExportOptions, cleanUpAndInvokeCallback);
|
|
117
98
|
}
|
|
118
|
-
|
|
119
99
|
function cleanUpAndInvokeCallback() {
|
|
120
100
|
if (gridInstance.unmount) {
|
|
121
101
|
gridInstance.unmount();
|
|
122
102
|
} else {
|
|
123
103
|
gridInstance.$destroy();
|
|
124
104
|
}
|
|
125
|
-
|
|
126
105
|
document.body.removeChild(gridOuterWrapper);
|
|
127
106
|
document.body.removeChild(finalContainer);
|
|
128
107
|
gridOuterWrapper = finalContainer = undefined;
|
|
129
|
-
|
|
130
108
|
if (callback) {
|
|
131
109
|
callback();
|
|
132
110
|
}
|
|
133
111
|
}
|
|
134
|
-
|
|
135
112
|
function prepareFinalElementForExport() {
|
|
136
113
|
/* Ultimatelly, there is no need for double DOM-copying of the grid.
|
|
137
114
|
The one in this method is a copied Angular implementation
|
package/dist/npm/main.d.ts
CHANGED
|
@@ -3,4 +3,5 @@ import { PDFExportProps } from './PDFExportProps';
|
|
|
3
3
|
import { PageTemplateProps } from './PageTemplateProps';
|
|
4
4
|
import { savePDF } from './savePDF';
|
|
5
5
|
import { GridPdfExport, GridPdfExportVue2, GridPDFExportProps } from './grid/GridPDFExport';
|
|
6
|
-
|
|
6
|
+
import { TreeListPDFExport, TreeListPDFExportVue2, TreeListPDFExportProps } from './treelist/TreeListPDFExport';
|
|
7
|
+
export { PDFExport, PDFExportVue2, PDFExportProps, PageTemplateProps, savePDF, GridPdfExport, GridPdfExportVue2, GridPDFExportProps, TreeListPDFExport, TreeListPDFExportVue2, TreeListPDFExportProps };
|
package/dist/npm/main.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GridPdfExportVue2 = exports.GridPdfExport = exports.savePDF = exports.PDFExportVue2 = exports.PDFExport = void 0;
|
|
3
|
+
exports.TreeListPDFExportVue2 = exports.TreeListPDFExport = exports.GridPdfExportVue2 = exports.GridPdfExport = exports.savePDF = exports.PDFExportVue2 = exports.PDFExport = void 0;
|
|
4
4
|
var PDFExport_1 = require("./PDFExport");
|
|
5
5
|
Object.defineProperty(exports, "PDFExport", { enumerable: true, get: function () { return PDFExport_1.PDFExport; } });
|
|
6
6
|
Object.defineProperty(exports, "PDFExportVue2", { enumerable: true, get: function () { return PDFExport_1.PDFExportVue2; } });
|
|
@@ -9,6 +9,9 @@ Object.defineProperty(exports, "savePDF", { enumerable: true, get: function () {
|
|
|
9
9
|
var GridPDFExport_1 = require("./grid/GridPDFExport");
|
|
10
10
|
Object.defineProperty(exports, "GridPdfExport", { enumerable: true, get: function () { return GridPDFExport_1.GridPdfExport; } });
|
|
11
11
|
Object.defineProperty(exports, "GridPdfExportVue2", { enumerable: true, get: function () { return GridPDFExport_1.GridPdfExportVue2; } });
|
|
12
|
+
var TreeListPDFExport_1 = require("./treelist/TreeListPDFExport");
|
|
13
|
+
Object.defineProperty(exports, "TreeListPDFExport", { enumerable: true, get: function () { return TreeListPDFExport_1.TreeListPDFExport; } });
|
|
14
|
+
Object.defineProperty(exports, "TreeListPDFExportVue2", { enumerable: true, get: function () { return TreeListPDFExport_1.TreeListPDFExportVue2; } });
|
|
12
15
|
// Automatic installation if Vue has been added to the global scope.
|
|
13
16
|
var vue = 'Vue';
|
|
14
17
|
if (typeof window !== 'undefined' && window[vue] && window[vue].component) {
|
|
@@ -8,7 +8,7 @@ exports.packageMetadata = {
|
|
|
8
8
|
name: '@progress/kendo-vue-pdf',
|
|
9
9
|
productName: 'Kendo UI for Vue',
|
|
10
10
|
productCodes: ['KENDOUIVUE', 'KENDOUICOMPLETE'],
|
|
11
|
-
publishDate:
|
|
11
|
+
publishDate: 1666682411,
|
|
12
12
|
version: '',
|
|
13
13
|
licensingDocsUrl: 'https://www.telerik.com/kendo-vue-ui/my-license/?utm_medium=product&utm_source=kendovue&utm_campaign=kendo-ui-vue-purchase-license-keys-warning'
|
|
14
14
|
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { DefineComponent, RecordPropsDefinition, ComponentOptions, Vue2type } from '../additionalTypes';
|
|
2
|
+
declare type DefaultData<V> = object | ((this: V) => {});
|
|
3
|
+
declare type DefaultMethods<V> = {
|
|
4
|
+
[key: string]: (this: V, ...args: any[]) => any;
|
|
5
|
+
};
|
|
6
|
+
import { PDFExportProps } from '../PDFExportProps';
|
|
7
|
+
export interface TreeListPDFExportProps extends PDFExportProps {
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* @hidden
|
|
11
|
+
*/
|
|
12
|
+
export interface TreeListPDFExportMethods extends Vue2type {
|
|
13
|
+
save: (data?: any[], callback?: () => void) => void;
|
|
14
|
+
getSavePDF: () => any;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* @hidden
|
|
18
|
+
*/
|
|
19
|
+
export interface TreeListPDFExportState {
|
|
20
|
+
saveTreeListPDF: any;
|
|
21
|
+
treeListComponent: any;
|
|
22
|
+
v3: boolean;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* @hidden
|
|
26
|
+
*/
|
|
27
|
+
export interface TreeListPDFExportAll extends TreeListPDFExportMethods, TreeListPDFExportState {
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* @hidden
|
|
31
|
+
*/
|
|
32
|
+
declare let TreeListPDFExportVue2: ComponentOptions<Vue2type, DefaultData<{}>, DefaultMethods<TreeListPDFExportAll>, {}, RecordPropsDefinition<TreeListPDFExportProps>>;
|
|
33
|
+
/**
|
|
34
|
+
* @hidden
|
|
35
|
+
*/
|
|
36
|
+
declare const TreeListPDFExport: DefineComponent<TreeListPDFExportProps, any, {}, {}, TreeListPDFExportMethods, {}, {}, {}, string, TreeListPDFExportProps, TreeListPDFExportProps, {}>;
|
|
37
|
+
export { TreeListPDFExport, TreeListPDFExportVue2 };
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.TreeListPDFExportVue2 = exports.TreeListPDFExport = void 0;
|
|
7
|
+
// @ts-ignore
|
|
8
|
+
var Vue = require("vue");
|
|
9
|
+
var allVue = Vue;
|
|
10
|
+
var gh = allVue.h;
|
|
11
|
+
var isV3 = allVue.version && allVue.version[0] === '3';
|
|
12
|
+
var savePDF_1 = require("../savePDF");
|
|
13
|
+
var provideSaveTreeListPDF_1 = require("./provideSaveTreeListPDF");
|
|
14
|
+
var kendo_vue_common_1 = require("@progress/kendo-vue-common");
|
|
15
|
+
/**
|
|
16
|
+
* @hidden
|
|
17
|
+
*/
|
|
18
|
+
var TreeListPDFExportVue2 = {
|
|
19
|
+
name: 'treelist-pdf-export',
|
|
20
|
+
props: {
|
|
21
|
+
author: String,
|
|
22
|
+
avoidLinks: [Boolean, String],
|
|
23
|
+
forcePageBreak: String,
|
|
24
|
+
keepTogether: String,
|
|
25
|
+
creator: String,
|
|
26
|
+
date: Date,
|
|
27
|
+
imageResolution: Number,
|
|
28
|
+
fileName: String,
|
|
29
|
+
forceProxy: Boolean,
|
|
30
|
+
keywords: String,
|
|
31
|
+
landscape: Boolean,
|
|
32
|
+
margin: [String, Object],
|
|
33
|
+
pageTemplate: [Object, Function],
|
|
34
|
+
paperSize: [String, Object],
|
|
35
|
+
repeatHeaders: Boolean,
|
|
36
|
+
scale: Number,
|
|
37
|
+
proxyData: Object,
|
|
38
|
+
proxyURL: String,
|
|
39
|
+
proxyTarget: String,
|
|
40
|
+
producer: String,
|
|
41
|
+
subject: String,
|
|
42
|
+
title: String
|
|
43
|
+
},
|
|
44
|
+
created: function created() {
|
|
45
|
+
this.saveTreeListPDF = (0, provideSaveTreeListPDF_1.provideSaveTreeListPDF)(this.getSavePDF());
|
|
46
|
+
},
|
|
47
|
+
methods: {
|
|
48
|
+
save: function save(data, callback) {
|
|
49
|
+
var defaultSlot = (0, kendo_vue_common_1.getDefaultSlots)(this);
|
|
50
|
+
// @ts-ignore
|
|
51
|
+
var treeListSlot = defaultSlot.filter(function (child) {
|
|
52
|
+
return child && child.tag && child.tag.toLowerCase().indexOf('treelist') !== -1 || child.componentOptions && child.componentOptions.tag && child.componentOptions.tag.toLowerCase().indexOf('treelist') !== -1 || child.type && child.type.name && child.type.name.toLowerCase().indexOf('treelist') !== -1;
|
|
53
|
+
});
|
|
54
|
+
if (treeListSlot.length) {
|
|
55
|
+
this.treeListComponent = this.v3 ? treeListSlot[0] : treeListSlot[0].componentInstance;
|
|
56
|
+
this.saveTreeListPDF(this.treeListComponent, this.$props, callback, data, this.v3);
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
getSavePDF: function getSavePDF() {
|
|
60
|
+
return savePDF_1.savePDF;
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
// @ts-ignore
|
|
64
|
+
setup: !isV3 ? undefined : function () {
|
|
65
|
+
var v3 = !!isV3;
|
|
66
|
+
return {
|
|
67
|
+
v3: v3
|
|
68
|
+
};
|
|
69
|
+
},
|
|
70
|
+
// @ts-ignore
|
|
71
|
+
render: function render(createElement) {
|
|
72
|
+
var h = gh || createElement;
|
|
73
|
+
var defaultSlot = (0, kendo_vue_common_1.getDefaultSlots)(this);
|
|
74
|
+
return h("div", [defaultSlot]);
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
exports.TreeListPDFExportVue2 = TreeListPDFExportVue2;
|
|
78
|
+
/**
|
|
79
|
+
* @hidden
|
|
80
|
+
*/
|
|
81
|
+
var TreeListPDFExport = TreeListPDFExportVue2;
|
|
82
|
+
exports.TreeListPDFExport = TreeListPDFExport;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.exportElement = void 0;
|
|
4
|
+
var table_query_1 = require("../common/table-query");
|
|
5
|
+
var utils_1 = require("../common/utils");
|
|
6
|
+
/**
|
|
7
|
+
* @hidden
|
|
8
|
+
*/
|
|
9
|
+
var exportElement = function (wrapper) {
|
|
10
|
+
var query = new table_query_1.GridQuery(wrapper);
|
|
11
|
+
var content = query.content();
|
|
12
|
+
var result;
|
|
13
|
+
var headerWithoutFilter = query.header();
|
|
14
|
+
if (headerWithoutFilter.children.length > 1) {
|
|
15
|
+
headerWithoutFilter.removeChild(headerWithoutFilter.children[1]);
|
|
16
|
+
}
|
|
17
|
+
headerWithoutFilter.children[0].childNodes.forEach(function (headerCell) {
|
|
18
|
+
if (headerCell.style) {
|
|
19
|
+
return headerCell.style.top = 0;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
if (content) {
|
|
23
|
+
var colGroups = [content.querySelector('colgroup')];
|
|
24
|
+
var headers = [headerWithoutFilter];
|
|
25
|
+
var bodies = [content.querySelector('tbody')];
|
|
26
|
+
var footer = query.footer();
|
|
27
|
+
var footers = footer ? [footer.querySelector('tfoot')] : [];
|
|
28
|
+
result = (0, utils_1.createTable)(colGroups, headers, bodies, footers);
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
result = (0, utils_1.wrapTable)(query.table().cloneNode(true));
|
|
32
|
+
}
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
exports.exportElement = exportElement;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { PDFExportProps } from '../PDFExportProps';
|
|
2
|
+
/**
|
|
3
|
+
* @hidden
|
|
4
|
+
*/
|
|
5
|
+
export declare function provideSaveTreeListPDF(savePDF: (domElement: HTMLElement, options?: PDFExportProps, callback?: () => void) => void): (treeList: any, pdfExportOptions?: PDFExportProps, callback?: () => void, data?: any, columns?: any) => void;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __assign = undefined && undefined.__assign || function () {
|
|
4
|
+
__assign = Object.assign || function (t) {
|
|
5
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
6
|
+
s = arguments[i];
|
|
7
|
+
for (var p in s) {
|
|
8
|
+
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
return __assign.apply(this, arguments);
|
|
14
|
+
};
|
|
15
|
+
Object.defineProperty(exports, "__esModule", {
|
|
16
|
+
value: true
|
|
17
|
+
});
|
|
18
|
+
exports.provideSaveTreeListPDF = void 0;
|
|
19
|
+
// @ts-ignore
|
|
20
|
+
var Vue = require("vue");
|
|
21
|
+
var kendo_vue_common_1 = require("@progress/kendo-vue-common");
|
|
22
|
+
var allVue = Vue;
|
|
23
|
+
var h = allVue.h;
|
|
24
|
+
var createApp = allVue.createApp;
|
|
25
|
+
var export_element_1 = require("./export-element");
|
|
26
|
+
/**
|
|
27
|
+
* @hidden
|
|
28
|
+
*/
|
|
29
|
+
function provideSaveTreeListPDF(savePDF) {
|
|
30
|
+
return function (treeList, pdfExportOptions, callback, data, columns) {
|
|
31
|
+
if (pdfExportOptions === void 0) {
|
|
32
|
+
pdfExportOptions = {};
|
|
33
|
+
}
|
|
34
|
+
return saveTreeListPDF(savePDF, treeList, pdfExportOptions, callback, data, columns);
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
exports.provideSaveTreeListPDF = provideSaveTreeListPDF;
|
|
38
|
+
function saveTreeListPDF(savePDF, treeList, pdfExportOptions, callback, data, v3) {
|
|
39
|
+
if (pdfExportOptions === void 0) {
|
|
40
|
+
pdfExportOptions = {};
|
|
41
|
+
}
|
|
42
|
+
renderTreeList();
|
|
43
|
+
var treeListOuterWrapper;
|
|
44
|
+
var treeListInnerWrapper;
|
|
45
|
+
var finalContainer;
|
|
46
|
+
var treeListInstance;
|
|
47
|
+
function renderTreeList() {
|
|
48
|
+
if (!kendo_vue_common_1.canUseDOM) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
treeListOuterWrapper = document.createElement('div');
|
|
52
|
+
treeListOuterWrapper.setAttribute('style', 'position:absolute; left: -5000px; top: 0px;');
|
|
53
|
+
treeListInnerWrapper = document.createElement('div');
|
|
54
|
+
treeListOuterWrapper.appendChild(treeListInnerWrapper);
|
|
55
|
+
document.body.appendChild(treeListOuterWrapper);
|
|
56
|
+
var customDataProps = data && {
|
|
57
|
+
dataItems: data,
|
|
58
|
+
total: data.length,
|
|
59
|
+
pageSize: data.length,
|
|
60
|
+
skip: 0
|
|
61
|
+
};
|
|
62
|
+
if (v3) {
|
|
63
|
+
var treeListForPdf = {
|
|
64
|
+
render: function render() {
|
|
65
|
+
return h(treeList.type, __assign(__assign({}, treeList.props), customDataProps), treeList.children);
|
|
66
|
+
},
|
|
67
|
+
store: treeList.$store,
|
|
68
|
+
mounted: function mounted() {
|
|
69
|
+
// @ts-ignore
|
|
70
|
+
if (this.$el.style) {
|
|
71
|
+
// @ts-ignore
|
|
72
|
+
this.$el.style.width = '1000px';
|
|
73
|
+
}
|
|
74
|
+
onTreeListRendered.call(this);
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
treeListInstance = createApp(treeListForPdf);
|
|
78
|
+
treeListInstance.mount(treeListInnerWrapper);
|
|
79
|
+
} else {
|
|
80
|
+
var treeListConstructor = Object.getPrototypeOf(treeList).constructor;
|
|
81
|
+
treeListInstance = new treeListConstructor({
|
|
82
|
+
propsData: Object.assign({}, treeList.$props, customDataProps),
|
|
83
|
+
store: treeList.$store,
|
|
84
|
+
mounted: function mounted() {
|
|
85
|
+
if (treeListInstance.$el.style) {
|
|
86
|
+
treeListInstance.$el.style.width = '1000px';
|
|
87
|
+
}
|
|
88
|
+
onTreeListRendered.call(treeListInstance);
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
treeListInstance.$slots = treeList.$slots;
|
|
92
|
+
treeListInstance.$scopedSlots = treeList.$scopedSlots;
|
|
93
|
+
treeListInstance.$mount(treeListInnerWrapper);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
function onTreeListRendered() {
|
|
97
|
+
savePDF(prepareFinalElementForExport.call(this), pdfExportOptions, cleanUpAndInvokeCallback);
|
|
98
|
+
}
|
|
99
|
+
function cleanUpAndInvokeCallback() {
|
|
100
|
+
if (treeListInstance.unmount) {
|
|
101
|
+
treeListInstance.unmount();
|
|
102
|
+
} else {
|
|
103
|
+
treeListInstance.$destroy();
|
|
104
|
+
}
|
|
105
|
+
document.body.removeChild(treeListOuterWrapper);
|
|
106
|
+
document.body.removeChild(finalContainer);
|
|
107
|
+
treeListOuterWrapper = finalContainer = undefined;
|
|
108
|
+
if (callback) {
|
|
109
|
+
callback();
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
function prepareFinalElementForExport() {
|
|
113
|
+
/* Ultimatelly, there is no need for double DOM-copying of the treeList.
|
|
114
|
+
The one in this method is a copied Angular implementation
|
|
115
|
+
that has been plugged almost seemlessly. */
|
|
116
|
+
finalContainer = document.createElement('div');
|
|
117
|
+
finalContainer.className = 'k-treelist-pdf-export-element';
|
|
118
|
+
var result = (0, export_element_1.exportElement)(this.$el);
|
|
119
|
+
finalContainer.appendChild(result);
|
|
120
|
+
document.body.appendChild(finalContainer);
|
|
121
|
+
return result;
|
|
122
|
+
}
|
|
123
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@progress/kendo-vue-pdf",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.7.0-dev.202210250731",
|
|
4
4
|
"description": "Kendo UI for Vue PDF Processing package",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@progress/kendo-file-saver": "^1.1.0",
|
|
37
|
-
"@progress/kendo-vue-common": "3.
|
|
37
|
+
"@progress/kendo-vue-common": "3.7.0-dev.202210250731"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@progress/kendo-drawing": "^1.9.3",
|