1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74 | 1×
1×
1×
1×
1240×
1×
9×
9×
9×
9×
9×
9×
9×
1×
9×
9×
2×
7×
9×
1×
9×
9×
9×
9×
113×
9×
113×
9×
9×
29×
29×
369×
369×
52×
52×
369×
29×
9×
9×
9×
1×
9×
9×
9×
8×
105×
108×
9×
1×
26333×
1×
975×
1×
1×
| define(["require", "exports", "@syncfusion/ej2-excel-export", "@syncfusion/ej2-base"], function (require, exports, ej2_excel_export_1, ej2_base_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var ExcelExport = (function () {
function ExcelExport(parent) {
this.parent = parent;
}
ExcelExport.prototype.initializeExcelExport = function (excelExportOptions) {
Iif (excelExportOptions === void 0) { excelExportOptions = {}; }
var exportColumns = this.getExportColumns(excelExportOptions);
var exportName = excelExportOptions.fileName || 'Schedule';
var exportType = excelExportOptions.exportType || 'xlsx';
var isIncludeOccurrences = excelExportOptions.includeOccurrences || false;
var separator;
if (!ej2_base_1.isNullOrUndefined(excelExportOptions.separator) && excelExportOptions.separator !== ',') {
separator = excelExportOptions.separator;
}
var eventCollection;
if (excelExportOptions.customData) {
eventCollection = !isIncludeOccurrences ? excelExportOptions.customData :
this.parent.eventBase.getProcessedEvents(excelExportOptions.customData);
}
else {
eventCollection = !isIncludeOccurrences ? this.parent.eventsData : this.parent.eventsProcessed;
}
this.processWorkbook(exportColumns, exportName, exportType, eventCollection, separator);
};
ExcelExport.prototype.processWorkbook = function (fields, name, type, eventCollection, separator) {
var _this = this;
var columns = [];
var rows = [];
var columnHeader = [];
fields.forEach(function (field, i) { columns.push({ index: i + 1, width: (field.name === 'Id' ? 50 : 150) }); });
var style = { fontSize: 12, borders: { color: '#E0E0E0' }, bold: true };
fields.forEach(function (field, i) { columnHeader.push({ index: i + 1, value: field.text, style: style }); });
rows.push({ index: 1, cells: columnHeader });
eventCollection.forEach(function (event, i) {
var columnData = [];
fields.forEach(function (field, n) {
var columnRule = { index: n + 1, value: event[field.name] || '' };
if (field.name === _this.parent.eventFields.startTime || field.name === _this.parent.eventFields.endTime) {
var styleRule = { fontSize: 12, numberFormat: 'm/d/yyyy h:mm a' };
columnRule = ej2_base_1.extend({}, columnRule, { style: styleRule }, true);
}
columnData.push(columnRule);
});
rows.push({ index: i + 2, cells: columnData });
});
var workSheet = [{ columns: columns, rows: rows }];
var book = new ej2_excel_export_1.Workbook({ worksheets: workSheet }, type, this.parent.locale, undefined, separator);
book.save(name + '.' + type);
};
ExcelExport.prototype.getExportColumns = function (exportOptions) {
var _this = this;
var exportColumns = exportOptions.fieldsInfo || [];
if (exportColumns.length === 0) {
var fields = exportOptions.fields || Object.keys(this.parent.eventFields).map(function (field) {
return _this.parent.eventFields["" + field];
});
fields.forEach(function (field) { exportColumns.push({ name: field, text: field }); });
}
return exportColumns;
};
ExcelExport.prototype.getModuleName = function () {
return 'excelExport';
};
ExcelExport.prototype.destroy = function () {
this.parent = null;
};
return ExcelExport;
}());
exports.ExcelExport = ExcelExport;
});
|