@svgrid/enterprise 1.0.1 → 1.2.0
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/LICENSE +97 -35
- package/README.md +50 -18
- package/dist/cdn/pdfmake-C6pyKjX0.js +58641 -0
- package/dist/cdn/smart.export-CfW2zpyq.js +2029 -0
- package/dist/cdn/svgrid-enterprise.svelte-external.js +1895 -0
- package/dist/cdn/vfs_fonts-BktEULEs.js +13 -0
- package/package.json +83 -71
- package/src/SvPivotDesigner.svelte +1045 -0
- package/src/ai.test.ts +1 -1
- package/src/ai.ts +6 -6
- package/src/export.ts +39 -2
- package/src/import.test.ts +1 -1
- package/src/import.ts +2 -2
- package/src/index.ts +17 -3
- package/src/install.ts +8 -8
- package/src/license.ts +9 -9
- package/src/pivot-designer.ts +101 -0
- package/src/pivot.test.ts +31 -3
- package/src/pivot.ts +42 -13
- package/src/print.ts +2 -2
- package/src/revoked.ts +3 -3
- package/src/upgrade-prompt.test.ts +1 -1
- package/src/upgrade-prompt.ts +5 -5
- package/src/watermark.test.ts +1 -1
- package/src/watermark.ts +3 -3
|
@@ -0,0 +1,2029 @@
|
|
|
1
|
+
//#region src/smart.export.js
|
|
2
|
+
(() => {
|
|
3
|
+
var e = "\r\n";
|
|
4
|
+
function t(e, t, n) {
|
|
5
|
+
if (!t && t !== "" && t !== 0) return "";
|
|
6
|
+
let r = t;
|
|
7
|
+
return typeof t == "boolean" && n && (r = n(t)), ` ${e}="${r}"`;
|
|
8
|
+
}
|
|
9
|
+
var n = class {
|
|
10
|
+
static createHeader(e = {}) {
|
|
11
|
+
let t = ["version"];
|
|
12
|
+
return e.version ||= "1.0", e.encoding && t.push("encoding"), e.standalone && t.push("standalone"), `<?xml ${t.map(((t) => `${t}="${e[t]}"`)).join(" ")} ?>`;
|
|
13
|
+
}
|
|
14
|
+
static createXml(n, r) {
|
|
15
|
+
let i = "";
|
|
16
|
+
n.properties && (n.properties.prefixedAttributes && n.properties.prefixedAttributes.forEach(((e) => {
|
|
17
|
+
Object.keys(e.map).forEach(((n) => {
|
|
18
|
+
i += t(e.prefix + n, e.map[n], r);
|
|
19
|
+
}));
|
|
20
|
+
})), n.properties.rawMap && Object.keys(n.properties.rawMap).forEach(((e) => {
|
|
21
|
+
i += t(e, n.properties.rawMap[e], r);
|
|
22
|
+
})));
|
|
23
|
+
let a = "<" + n.name + i;
|
|
24
|
+
return n.children || n.textNode != null ? n.textNode == null ? (a += ">\r\n", n.children && n.children.forEach(((e) => {
|
|
25
|
+
a += this.createXml(e, r);
|
|
26
|
+
})), a + "</" + n.name + ">" + e) : a + ">" + n.textNode + "</" + n.name + ">" + e : a + "/>" + e;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
Smart.Utilities.Assign("DataExporter", class {
|
|
30
|
+
constructor(e, t, n, r) {
|
|
31
|
+
let i = this;
|
|
32
|
+
e ||= {}, i.style = e.style, i.header = e.header, i.exportHeader = e.exportHeader === void 0 || e.exportHeader, i.hierarchical = e.hierarchical, i.expandChar = e.expandChar || "+", i.collapseChar = e.collapseChar || "-", i.pageOrientation = e.pageOrientation, i.allowNull = e.allowNull || !1, i.spreadsheets = e.spreadsheets || null, i.protectSheet = e.protectSheet || null, i._media = [], !i.hierarchical && t && t.length > 0 ? i.groupBy = t : i.mergedCells = e.mergedCells, !i.groupBy && n && Object.keys(n).length > 0 && (i.filterBy = n), r && (i.conditionalFormatting = r), i.timeBetween1900And1970 = new Date(1970, 0, 1, 0, 0, 0).getTime() - new Date(1900, 0, 1, 0, 0, 0).getTime();
|
|
33
|
+
}
|
|
34
|
+
downloadFile(e, t, n) {
|
|
35
|
+
let r;
|
|
36
|
+
if (!n) return e;
|
|
37
|
+
if (r = e instanceof Blob ? e : new Blob([e], { type: t }), window.navigator.msSaveOrOpenBlob) window.navigator.msSaveOrOpenBlob(r, n);
|
|
38
|
+
else {
|
|
39
|
+
let e = document.createElement("a"), t = URL.createObjectURL(r);
|
|
40
|
+
e.href = t, e.download = n, e.style.position = "absolute", e.style.visibility = "hidden", document.body.appendChild(e), e.click(), setTimeout((function() {
|
|
41
|
+
document.body.removeChild(e), window.URL.revokeObjectURL(t);
|
|
42
|
+
}), 100);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exportData(e, t, n, r) {
|
|
46
|
+
let i = this;
|
|
47
|
+
if (i.actualHierarchy = i.hierarchical, t = t.toLowerCase(), i.exportHeader && (i.header ? ((e = e.slice(0)).length === 0 && (i.actualHierarchy = !1), i.processComplexHeader(i.header, e, t)) : e.length === 1 && (i.actualHierarchy = !1)), e.length === 0) return void console.warn("No data to export.");
|
|
48
|
+
if (t === "xlsx") {
|
|
49
|
+
i.xlsxStartIndex = i.complexHeader ? i.complexHeader.length : +i.exportHeader;
|
|
50
|
+
let e = i.headerContent ? i.headerContent.length : 0;
|
|
51
|
+
i.xlsxStartIndex += e;
|
|
52
|
+
}
|
|
53
|
+
i.actualHierarchy && (e = i.processHierarchicalData(e, t)), i.getDatafields(e), n && n.slice(n.length - t.length - 1, n.length) !== "." + t && (n += "." + t);
|
|
54
|
+
let a = null;
|
|
55
|
+
switch (t) {
|
|
56
|
+
case "csv":
|
|
57
|
+
a = i.exportToCSVAndTSV(e, {
|
|
58
|
+
delimiter: ", ",
|
|
59
|
+
MIME: "text/csv;charset=utf-8;",
|
|
60
|
+
toRemove: 2
|
|
61
|
+
}, n);
|
|
62
|
+
break;
|
|
63
|
+
case "html":
|
|
64
|
+
a = i.exportToHTML(e, n);
|
|
65
|
+
break;
|
|
66
|
+
case "jpeg":
|
|
67
|
+
case "png":
|
|
68
|
+
i.exportToImage(e, n, t, r);
|
|
69
|
+
break;
|
|
70
|
+
case "json":
|
|
71
|
+
a = i.exportToJSON(e, n);
|
|
72
|
+
break;
|
|
73
|
+
case "pdf":
|
|
74
|
+
a = i.exportToPDF(e, n);
|
|
75
|
+
break;
|
|
76
|
+
case "tsv":
|
|
77
|
+
a = i.exportToCSVAndTSV(e, {
|
|
78
|
+
delimiter: " ",
|
|
79
|
+
MIME: "text/tab-separated-values",
|
|
80
|
+
toRemove: 1
|
|
81
|
+
}, n);
|
|
82
|
+
break;
|
|
83
|
+
case "xlsx":
|
|
84
|
+
a = i.exportToXLSX(e, n, r);
|
|
85
|
+
break;
|
|
86
|
+
case "xml":
|
|
87
|
+
a = i.exportToXML(e, n);
|
|
88
|
+
break;
|
|
89
|
+
case "md": a = i.exportToMD(e, n);
|
|
90
|
+
}
|
|
91
|
+
return r && a && r(a), delete i.complexHeader, a;
|
|
92
|
+
}
|
|
93
|
+
exportToCSVAndTSV(e, t, n) {
|
|
94
|
+
let r = this, i = r.datafields, a = "";
|
|
95
|
+
for (let n = 0; n < e.length; n++) {
|
|
96
|
+
let o = e[n], s = "";
|
|
97
|
+
for (let e = 0; e < i.length; e++) r.actualHierarchy && e === 0 ? s += ("\"\"" + t.delimiter).repeat(o._level - 1) + "\"" + o[i[e]] + "\"" + t.delimiter + ("\"\"" + t.delimiter).repeat(r.maxLevel - o._level) : s += "\"" + o[i[e]] + "\"" + t.delimiter;
|
|
98
|
+
s = s.slice(0, s.length - t.toRemove) + "\n", a += s;
|
|
99
|
+
}
|
|
100
|
+
if (!n) return a;
|
|
101
|
+
let o = "" + a;
|
|
102
|
+
return this.downloadFile(o, t.MIME, n);
|
|
103
|
+
}
|
|
104
|
+
exportToHTML(e, t) {
|
|
105
|
+
let n = this, r = n.datafields, i = n.style, a = "", o = 0, s = "";
|
|
106
|
+
e = n.processGroupingInformation(e), n.data = e, n.exportHeader && (a = n.getHTMLHeader(r, e), o = 1), arguments[2] && (s = `<script type="text/javascript" src="${Array.from(document.getElementsByTagName("script")).find(((e) => e.src.indexOf("html2canvas") !== -1)).src}"><\/script>`);
|
|
107
|
+
let c = `<!DOCTYPE html>\n<html>\n<head>\n <meta charset="UTF-8">\n <style type="text/css">\n${n.getRowStyle()}${n.getColumnStyle()}\n </style>${s}${n.toggleableFunctionality()}\n</head>\n<body>\n <table${n.getTableStyle()}>${a}\n <tbody>\n`, l = {}, u = {}, d = [];
|
|
108
|
+
n.getMergedCellsInfo(l, u);
|
|
109
|
+
e: for (let a = o; a < e.length; a++) {
|
|
110
|
+
let s = e[a], f = a - o, p = n.getAlternationIndex(f, " rowN"), m = "", h = "", g = "", _ = 0;
|
|
111
|
+
if (n.actualHierarchy) s._collapsed && (m = " collapsed"), h = ` level="${s._level}"`;
|
|
112
|
+
else if (n.groupBy) for (let e = 0; e < n.groupBy.length; e++) {
|
|
113
|
+
let t = n.groupBy[e], r = s[t], i = n.groups[t][r];
|
|
114
|
+
if (g += r, d.indexOf(g) === -1) {
|
|
115
|
+
c += ` <tr class="row">\n <td class="column group" style="padding-left: ${25 * _}px;" colspan="${n.datafields.length}">${i}</td>\n </tr>`, d.push(g), a--;
|
|
116
|
+
continue e;
|
|
117
|
+
}
|
|
118
|
+
_++;
|
|
119
|
+
}
|
|
120
|
+
let v = ` <tr class="row row${f}${p}${m}"${h}`;
|
|
121
|
+
t || (v += " style=\"page-break-inside: avoid;\""), v += ">\n";
|
|
122
|
+
for (let e = 0; e < r.length; e++) {
|
|
123
|
+
let t = e + "," + f, a = 1, o = 1;
|
|
124
|
+
if (l[t]) a = l[t].colspan, o = l[t].rowspan;
|
|
125
|
+
else if (u[t]) continue;
|
|
126
|
+
let c = r[e], d = s[c], p = "";
|
|
127
|
+
if (n.actualHierarchy && e === 0) {
|
|
128
|
+
let e = "";
|
|
129
|
+
s._expanded ? e = n.collapseChar : !1 === s._expanded && (e = n.expandChar), p = `<div class="toggle-element" style="margin-left: ${25 * (s._level - 1) + 5}px;" expanded>${e}</div>`;
|
|
130
|
+
}
|
|
131
|
+
d = n.getFormattedValue(d, c), typeof d == "string" && (d.indexOf("base64") >= 0 || d.indexOf(".png") >= 0 || d.indexOf(".jpeg") >= 0) && (d = `<img height="30" src="${d}"/>`);
|
|
132
|
+
let m = "";
|
|
133
|
+
if (i && i.columns && i.columns[c] && i.columns[c][f]) {
|
|
134
|
+
let e = i.columns[c][f];
|
|
135
|
+
m += `border-color: ${e.border}; background-color: ${e.background}; color: ${e.color};"`;
|
|
136
|
+
}
|
|
137
|
+
e === 0 && _ > 1 && (m += `padding-left: ${25 * (_ - 1)}px;"`), m &&= ` style="${m}"`, v += ` <td class="column column${c}"${m} colspan="${a}" rowspan="${o}">${p + d}</td>\n`;
|
|
138
|
+
}
|
|
139
|
+
c += v + " </tr>\n";
|
|
140
|
+
}
|
|
141
|
+
return c += " </tbody>\n </table>\n</body>\n</html>", arguments[2] ? c : this.downloadFile(c, "text/html", t);
|
|
142
|
+
}
|
|
143
|
+
exportToImage(e, t, n, r) {
|
|
144
|
+
try {
|
|
145
|
+
html2canvas;
|
|
146
|
+
} catch {
|
|
147
|
+
throw Error("smart-grid: Missing reference to 'html2canvas.min.js'.");
|
|
148
|
+
}
|
|
149
|
+
let i = null, a = this.exportToHTML(e, t, !0), o = document.createElement("iframe");
|
|
150
|
+
return o.style.position = "absolute", o.style.top = 0, o.style.left = 0, o.style.border = "none", o.style.width = "100%", o.style.height = "100%", o.style.opacity = 0, o.style.pointerEvents = "none", document.body.appendChild(o), o.contentDocument.write(a), function e() {
|
|
151
|
+
o.contentDocument.body && o.contentDocument.body.firstElementChild ? o.contentWindow.html2canvas(o.contentDocument.body.firstElementChild).then(((e) => {
|
|
152
|
+
let a = new Smart.Utilities.Draw(document.createElement("div"));
|
|
153
|
+
i = e.toDataURL("image/png"), r ? r(i) : (document.body.appendChild(e), a.exportImage(void 0, e, n, t)), o.remove(), e.remove();
|
|
154
|
+
})) : requestAnimationFrame(e);
|
|
155
|
+
}(), i;
|
|
156
|
+
}
|
|
157
|
+
getMergedCellsInfo(e, t, n) {
|
|
158
|
+
let r = this;
|
|
159
|
+
if (!r.mergedCells) return;
|
|
160
|
+
let i = n && n[r.datafields.length - 1] !== 0;
|
|
161
|
+
r.mergedCellsPDF = r.mergedCells.slice(0);
|
|
162
|
+
for (let a = 0; a < r.mergedCellsPDF.length; a++) {
|
|
163
|
+
let o = r.mergedCellsPDF[a], s = o.colspan, c = o.rowspan;
|
|
164
|
+
if (c < 2 && s < 2) continue;
|
|
165
|
+
let l = o.cell[1], u = o.cell[0];
|
|
166
|
+
if (i && s > 1) {
|
|
167
|
+
let e = n[u], t = n[u + s - 1], i = [];
|
|
168
|
+
if (t > e) {
|
|
169
|
+
let a = e, o = u, d = 0;
|
|
170
|
+
e: for (let r = e; r <= t; r++) {
|
|
171
|
+
let e = o, t = 0;
|
|
172
|
+
for (; n[o] === a;) if (o++, d++, t++, d === s) {
|
|
173
|
+
i.push({
|
|
174
|
+
start: e,
|
|
175
|
+
span: t
|
|
176
|
+
});
|
|
177
|
+
break e;
|
|
178
|
+
}
|
|
179
|
+
i.push({
|
|
180
|
+
start: e,
|
|
181
|
+
span: t
|
|
182
|
+
}), a = n[o];
|
|
183
|
+
}
|
|
184
|
+
s = i[0].span;
|
|
185
|
+
for (let e = 1; e < i.length; e++) r.mergedCellsPDF.push({
|
|
186
|
+
cell: [i[e].start, l],
|
|
187
|
+
colspan: i[e].span,
|
|
188
|
+
rowspan: c,
|
|
189
|
+
originalCell: u
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
for (let n = u; n < u + s; n++) for (let r = l; r < l + c; r++) {
|
|
194
|
+
let i = n + "," + r;
|
|
195
|
+
n !== u || r !== l ? t[i] = !0 : e[i] = {
|
|
196
|
+
colspan: s,
|
|
197
|
+
rowspan: c,
|
|
198
|
+
originalCell: o.originalCell
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
getAlternationIndex(e, t) {
|
|
204
|
+
if (!this.style) return "";
|
|
205
|
+
let n = this.style.rows;
|
|
206
|
+
return n && n.alternationCount && ((n.alternationStart === void 0 || e >= n.alternationStart) && (n.alternationEnd === void 0 || e <= n.alternationEnd) || n.alternationStart === n.alternationEnd) ? t + e % n.alternationCount : "";
|
|
207
|
+
}
|
|
208
|
+
getFormattedValue(e, t) {
|
|
209
|
+
let n = this, r = n.style;
|
|
210
|
+
if (e === null) return n.allowNull ? "null" : "";
|
|
211
|
+
if (t && r && r.columns && r.columns[t] && r.columns[t].format) {
|
|
212
|
+
if (typeof e == "number") return n.formatNumber(e, r.columns[t].format);
|
|
213
|
+
if (e instanceof Date) return n.formatDate(e, r.columns[t].format);
|
|
214
|
+
} else if (e instanceof Date) return n.formatDate(e, "d");
|
|
215
|
+
return e;
|
|
216
|
+
}
|
|
217
|
+
exportToJSON(e, t) {
|
|
218
|
+
return this.downloadFile(JSON.stringify(e, this.datafields.concat("rows")), "application/json", t);
|
|
219
|
+
}
|
|
220
|
+
exportToMD(e, t) {
|
|
221
|
+
let n = this.datafields, r = "";
|
|
222
|
+
for (let t = 0, i = e.length; t < i; t += 1) for (let i = 0, a = n.length; i < a; i += 1) {
|
|
223
|
+
let a = e[t][n[i]];
|
|
224
|
+
typeof a == "string" && (r += a);
|
|
225
|
+
}
|
|
226
|
+
return this.downloadFile(r, "application/text", t);
|
|
227
|
+
}
|
|
228
|
+
exportToPDF(e, t) {
|
|
229
|
+
try {
|
|
230
|
+
pdfMake;
|
|
231
|
+
} catch {
|
|
232
|
+
throw Error("Missing reference to 'pdfmake.min.js'.");
|
|
233
|
+
}
|
|
234
|
+
let n, r = this, i = r.datafields, a = +r.exportHeader, o = [], s = {}, c = {}, l = {}, u = a ? r.complexHeader ? r.complexHeader.length : 1 : 0, d = { pageOrientation: r.pageOrientation || "portrait" }, f = [], p = [];
|
|
235
|
+
function m() {
|
|
236
|
+
let e = [];
|
|
237
|
+
for (let t = 0; t < n.length; t++) e.push([]);
|
|
238
|
+
return e;
|
|
239
|
+
}
|
|
240
|
+
e = r.processGroupingInformation(e), r.data = e;
|
|
241
|
+
let h = [];
|
|
242
|
+
if (r.headerContent) {
|
|
243
|
+
let e = r.headerContent, t = [];
|
|
244
|
+
for (let n = 0; n < e.length; n++) {
|
|
245
|
+
let i = e[n].cells, a = {};
|
|
246
|
+
for (let e = 0; e < r.datafields.length; e++) {
|
|
247
|
+
let t = r.datafields[e];
|
|
248
|
+
i[t] ? a[t] = i[t] : a[t] = null;
|
|
249
|
+
}
|
|
250
|
+
t.push(a);
|
|
251
|
+
}
|
|
252
|
+
h = t;
|
|
253
|
+
}
|
|
254
|
+
if (r.footerContent) {
|
|
255
|
+
let t = r.footerContent, n = [];
|
|
256
|
+
for (let e = 0; e < t.length; e++) {
|
|
257
|
+
let i = t[e].cells, a = {};
|
|
258
|
+
for (let e = 0; e < r.datafields.length; e++) {
|
|
259
|
+
let t = r.datafields[e];
|
|
260
|
+
i[t] ? a[t] = i[t] : a[t] = null;
|
|
261
|
+
}
|
|
262
|
+
n.push(a);
|
|
263
|
+
}
|
|
264
|
+
e = [...e, ...n];
|
|
265
|
+
}
|
|
266
|
+
r.headerRows = u, r.getPDFStyle();
|
|
267
|
+
let g = r.styleInfo;
|
|
268
|
+
n = g ? r.wrapPDFColumns(d, l) : [{
|
|
269
|
+
body: f,
|
|
270
|
+
datafields: i
|
|
271
|
+
}], a && (f = r.getPDFHeader(i, n, l));
|
|
272
|
+
let _ = [];
|
|
273
|
+
if (h.length > 0) for (let e = 0; e < h.length; e++) {
|
|
274
|
+
let t = h[e], o = m(), u = e - a, d = r.getAlternationIndex(u, "");
|
|
275
|
+
for (let e = 0; e < i.length; e++) {
|
|
276
|
+
let n = i[e], a = { style: [
|
|
277
|
+
"row",
|
|
278
|
+
"row" + u,
|
|
279
|
+
"cell",
|
|
280
|
+
"cell" + n
|
|
281
|
+
] }, f = l[e] || 0;
|
|
282
|
+
if (d !== void 0 && a.style.splice(1, 0, "rowN" + d), r.mergedCellsPDF) {
|
|
283
|
+
let t = e + "," + u, n = s[t];
|
|
284
|
+
if (n) {
|
|
285
|
+
if (a.colSpan = n.colspan, a.rowSpan = n.rowspan, n.originalCell !== void 0) {
|
|
286
|
+
a.text = "", a.style[a.style.length - 1] = "cell" + i[n.originalCell], o[f].push(a);
|
|
287
|
+
continue;
|
|
288
|
+
}
|
|
289
|
+
} else if (c[t]) {
|
|
290
|
+
o[f].push({});
|
|
291
|
+
continue;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
let p = r.getFormattedValue(t[n], n);
|
|
295
|
+
typeof p == "string" && (p.indexOf("base64") >= 0 || p.indexOf(".png") >= 0 || p.indexOf(".jpeg") >= 0) ? (a.image = p, a.width = 100) : p && Array.isArray(p) && p[0] && p[0].indexOf("base64") >= 0 ? (a.image = p[0], a.width = 100, g && g.widths[e] && (a.width = parseInt(g.widths[e], 10) - 10)) : a.text = p.toString(), r.getUniqueStylePDF(a, n, u), r.setIndentation(a, {
|
|
296
|
+
j: e,
|
|
297
|
+
currentRecord: t,
|
|
298
|
+
value: p,
|
|
299
|
+
outlineLevel: 0
|
|
300
|
+
}), o[f].push(a);
|
|
301
|
+
}
|
|
302
|
+
for (let e = 0; e < n.length; e++) _.push(o[e]);
|
|
303
|
+
}
|
|
304
|
+
r.getMergedCellsInfo(s, c, l);
|
|
305
|
+
e: for (let t = a; t < e.length; t++) {
|
|
306
|
+
let u = e[t], d = "", f = 0;
|
|
307
|
+
if (r.groupBy) for (let e = 0; e < r.groupBy.length; e++) {
|
|
308
|
+
let i = r.groupBy[e], a = u[i], s = r.groups[i][a];
|
|
309
|
+
if (d += a, o.indexOf(d) === -1) {
|
|
310
|
+
r.createGroupHeaderRow(n, {
|
|
311
|
+
text: s,
|
|
312
|
+
style: [
|
|
313
|
+
"row",
|
|
314
|
+
"cell",
|
|
315
|
+
"group"
|
|
316
|
+
],
|
|
317
|
+
marginLeft: 7.5 * f
|
|
318
|
+
}), o.push(d), t--;
|
|
319
|
+
continue e;
|
|
320
|
+
}
|
|
321
|
+
f++;
|
|
322
|
+
}
|
|
323
|
+
let p = m(), h = t - a, _ = r.getAlternationIndex(h, "");
|
|
324
|
+
for (let e = 0; e < i.length; e++) {
|
|
325
|
+
let t = i[e], n = { style: [
|
|
326
|
+
"row",
|
|
327
|
+
"row" + h,
|
|
328
|
+
"cell",
|
|
329
|
+
"cell" + t
|
|
330
|
+
] }, a = l[e] || 0;
|
|
331
|
+
if (_ !== void 0 && n.style.splice(1, 0, "rowN" + _), r.mergedCellsPDF) {
|
|
332
|
+
let t = e + "," + h, r = s[t];
|
|
333
|
+
if (r) {
|
|
334
|
+
if (n.colSpan = r.colspan, n.rowSpan = r.rowspan, r.originalCell !== void 0) {
|
|
335
|
+
n.text = "", n.style[n.style.length - 1] = "cell" + i[r.originalCell], p[a].push(n);
|
|
336
|
+
continue;
|
|
337
|
+
}
|
|
338
|
+
} else if (c[t]) {
|
|
339
|
+
p[a].push({});
|
|
340
|
+
continue;
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
let o = r.getFormattedValue(u[t], t);
|
|
344
|
+
typeof o == "string" && (o.indexOf("base64") >= 0 || o.indexOf(".png") >= 0 || o.indexOf(".jpeg") >= 0) ? (n.image = o, n.width = 100) : o && Array.isArray(o) && o[0] && o[0].indexOf("base64") >= 0 ? (n.image = o[0], n.width = 100, g && g.widths[e] && (n.width = parseInt(g.widths[e], 10) - 10)) : n.text = o.toString(), r.getUniqueStylePDF(n, t, h), r.setIndentation(n, {
|
|
345
|
+
j: e,
|
|
346
|
+
currentRecord: u,
|
|
347
|
+
value: o,
|
|
348
|
+
outlineLevel: f
|
|
349
|
+
}), p[a].push(n);
|
|
350
|
+
}
|
|
351
|
+
for (let e = 0; e < n.length; e++) n[e].body.push(p[e]);
|
|
352
|
+
}
|
|
353
|
+
if (g) {
|
|
354
|
+
for (let e = 0; e < n.length; e++) {
|
|
355
|
+
let t = n[e].body;
|
|
356
|
+
for (let n = u - 1; n >= 0; n--) t.unshift(f[e][n]);
|
|
357
|
+
if (_.length > 0) for (let e = _.length - 1; e >= 0; e--) t.unshift(_[e]);
|
|
358
|
+
p.push({
|
|
359
|
+
table: {
|
|
360
|
+
headerRows: u,
|
|
361
|
+
widths: n[e].widths,
|
|
362
|
+
heights: function(e) {
|
|
363
|
+
return g.heights[e] ? g.heights[e] : g.defaultHeight ? g.defaultHeight : void 0;
|
|
364
|
+
},
|
|
365
|
+
body: t
|
|
366
|
+
},
|
|
367
|
+
pageBreak: "after"
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
delete p[n.length - 1].pageBreak, d.styles = g.styles;
|
|
371
|
+
} else {
|
|
372
|
+
let e = n[0].body;
|
|
373
|
+
for (let t = u - 1; t >= 0; t--) e.unshift(f[0][t]);
|
|
374
|
+
if (_.length > 0) for (let t = _.length - 1; t >= 0; t--) e.unshift(_[t]);
|
|
375
|
+
p = [{ table: {
|
|
376
|
+
headerRows: u,
|
|
377
|
+
body: e
|
|
378
|
+
} }], d.styles = {
|
|
379
|
+
header: { bold: !0 },
|
|
380
|
+
group: { bold: !0 }
|
|
381
|
+
};
|
|
382
|
+
}
|
|
383
|
+
if (d.content = p, !t) {
|
|
384
|
+
let e = pdfMake.createPdf(d);
|
|
385
|
+
return delete r.mergedCellsPDF, delete r.styleInfo, e;
|
|
386
|
+
}
|
|
387
|
+
pdfMake.createPdf(d).download(t), delete r.mergedCellsPDF, delete r.styleInfo;
|
|
388
|
+
}
|
|
389
|
+
getPDFStyle() {
|
|
390
|
+
let e = this, t = e.style;
|
|
391
|
+
if (!t) return "";
|
|
392
|
+
let n = e.data[0], r = t.header, i = t.columns, a = t.rows, o = {
|
|
393
|
+
heights: [],
|
|
394
|
+
widths: Array(e.datafields.length).fill("*"),
|
|
395
|
+
styles: {
|
|
396
|
+
header: {},
|
|
397
|
+
row: {},
|
|
398
|
+
cell: {},
|
|
399
|
+
group: {
|
|
400
|
+
fillColor: "#FFFFFF",
|
|
401
|
+
color: "#000000",
|
|
402
|
+
bold: !0
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
};
|
|
406
|
+
function s(t, r) {
|
|
407
|
+
if (t) {
|
|
408
|
+
for (let i in t) if (Object.prototype.hasOwnProperty.call(t, i)) if (n[i] === void 0) if (i === "height" && r === "header") for (let n = 0; n < e.headerRows; n++) o.heights[n] = parseInt(t[i], 10) / e.headerRows / 1.4;
|
|
409
|
+
else e.storePDFStyle({
|
|
410
|
+
prop: i,
|
|
411
|
+
value: t[i],
|
|
412
|
+
toUpdate: r
|
|
413
|
+
});
|
|
414
|
+
else for (let n in t[i]) {
|
|
415
|
+
if (!isNaN(n) || !Object.prototype.hasOwnProperty.call(t[i], n)) continue;
|
|
416
|
+
let a = t[i][n], s = e.datafields.indexOf(i);
|
|
417
|
+
n === "width" && o.widths[s] === "*" ? o.widths[s] = a : e.storePDFStyle({
|
|
418
|
+
prop: n,
|
|
419
|
+
value: a,
|
|
420
|
+
toUpdate: r + i
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
if (e.styleInfo = o, s(r, "header"), s(i, "cell"), a) {
|
|
426
|
+
for (let t in a) {
|
|
427
|
+
if (!Object.prototype.hasOwnProperty.call(a, t) || t.indexOf("alt") !== -1) continue;
|
|
428
|
+
let n = a[t];
|
|
429
|
+
if (isNaN(t)) t === "height" ? o.defaultHeight = parseFloat(n) / 1.4 : e.storePDFStyle({
|
|
430
|
+
prop: t,
|
|
431
|
+
value: n,
|
|
432
|
+
toUpdate: "row"
|
|
433
|
+
});
|
|
434
|
+
else for (let r in n) Object.prototype.hasOwnProperty.call(n, r) && (r === "height" ? o.heights[parseFloat(t) + e.headerRows] = parseFloat(n[r]) / 1.4 : e.storePDFStyle({
|
|
435
|
+
prop: r,
|
|
436
|
+
value: n[r],
|
|
437
|
+
toUpdate: "row" + t
|
|
438
|
+
}));
|
|
439
|
+
}
|
|
440
|
+
if (a.alternationCount) for (let e = 0; e < a.alternationCount; e++) {
|
|
441
|
+
let t = {};
|
|
442
|
+
a[`alternationIndex${e}Color`] && (t.color = a[`alternationIndex${e}Color`]), a[`alternationIndex${e}BackgroundColor`] && (t.fillColor = a[`alternationIndex${e}BackgroundColor`]), o.styles["rowN" + e] = t;
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
storePDFStyle(e) {
|
|
447
|
+
let t = this, n = t.styleInfo.styles[e.toUpdate];
|
|
448
|
+
n || (n = {}, t.styleInfo.styles[e.toUpdate] = n);
|
|
449
|
+
let r = e.value;
|
|
450
|
+
switch (e.prop) {
|
|
451
|
+
case "backgroundColor":
|
|
452
|
+
n.fillColor = r;
|
|
453
|
+
break;
|
|
454
|
+
case "color":
|
|
455
|
+
n.color = r;
|
|
456
|
+
break;
|
|
457
|
+
case "fontSize":
|
|
458
|
+
n.fontSize = parseFloat(r);
|
|
459
|
+
break;
|
|
460
|
+
case "fontStyle":
|
|
461
|
+
r === "italic" && (n.italics = !0);
|
|
462
|
+
break;
|
|
463
|
+
case "fontWeight":
|
|
464
|
+
r === "bold" && (n.bold = !0);
|
|
465
|
+
break;
|
|
466
|
+
case "textAlign": n.alignment = r;
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
wrapPDFColumns(e, t) {
|
|
470
|
+
let n = this, r = this.styleInfo, i = e.pageOrientation === "portrait" ? 655 : 1155, a = [], o = 0;
|
|
471
|
+
for (let e = 0; e < r.widths.length; e++) {
|
|
472
|
+
let s, c = r.widths[e];
|
|
473
|
+
if (c === "*" ? s = i / 6 : typeof c == "string" && c.indexOf("%") !== -1 ? (s = Math.min(i, Math.floor(parseFloat(c) / 100 * i)), s === i && (c = "*")) : (c = parseFloat(c), c >= i ? (s = i, c = "*") : (s = c, c /= 1.4)), a[o] === void 0) {
|
|
474
|
+
a[o] = {
|
|
475
|
+
body: [],
|
|
476
|
+
width: s,
|
|
477
|
+
widths: [c],
|
|
478
|
+
datafields: [n.datafields[e]]
|
|
479
|
+
}, t[e] = o;
|
|
480
|
+
continue;
|
|
481
|
+
}
|
|
482
|
+
let l = a[o];
|
|
483
|
+
l.width + s > i ? (o++, e--) : (t[e] = o, l.width += s, l.widths.push(c), l.datafields.push(n.datafields[e]));
|
|
484
|
+
}
|
|
485
|
+
return a;
|
|
486
|
+
}
|
|
487
|
+
getPDFHeader(e, t, n) {
|
|
488
|
+
let r = this, i = [], a = r.headerRows, o = [], s = [], c, l, u = [];
|
|
489
|
+
r.complexHeader ? (c = r.complexHeader, l = r.complexDataFieldsHeader) : (c = [Object.values(r.data[0])], l = c);
|
|
490
|
+
for (let e = 0; e < a; e++) {
|
|
491
|
+
let t = c[e], r = l[e];
|
|
492
|
+
for (let i = 0; i < t.length; i++) {
|
|
493
|
+
let a = n[i] || 0;
|
|
494
|
+
o[a] || (o[a] = [], s[a] = []), o[a][e] || (o[a][e] = [], s[a][e] = []), o[a][e].push(t[i]), s[a][e].push(r[i]);
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
function d(e, t, n, r) {
|
|
498
|
+
for (let i = 0; i < a; i++) {
|
|
499
|
+
let o = e[i], s = t[i], c = [];
|
|
500
|
+
for (let e = 0; e < o.length; e++) {
|
|
501
|
+
let n = s[e], l = 1, u = 1;
|
|
502
|
+
if (s[e - 1] && s[e - 1] === n || t[i - 1] && t[i - 1][e] === n) {
|
|
503
|
+
c.push({});
|
|
504
|
+
continue;
|
|
505
|
+
}
|
|
506
|
+
let d = e + 1;
|
|
507
|
+
for (; s[d] && s[d] === s[d - 1];) l++, d++;
|
|
508
|
+
for (d = i + 1; t[d] && t[d][e] === n;) u++, d++;
|
|
509
|
+
let f = i === a - 1 || u + i === a ? r.datafields[e] : null, p = {
|
|
510
|
+
text: o[e],
|
|
511
|
+
colSpan: l,
|
|
512
|
+
rowSpan: u
|
|
513
|
+
};
|
|
514
|
+
f ? p.style = ["header", "header" + f] : (p.alignment = "center", p.style = "header"), c.push(p);
|
|
515
|
+
}
|
|
516
|
+
n.push(c);
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
for (let e = 0; e < t.length; e++) u = [], d(o[e], s[e], u, t[e]), i.push(u);
|
|
520
|
+
return i;
|
|
521
|
+
}
|
|
522
|
+
createGroupHeaderRow(e, t) {
|
|
523
|
+
for (let n = 0; n < e.length; n++) {
|
|
524
|
+
let r = Object.assign({}, t), i = e[n].datafields.length, a = [r];
|
|
525
|
+
r.colSpan = i, a.length = i, a.fill({}, 1, i - 1), e[n].body.push(a);
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
getUniqueStylePDF(e, t, n) {
|
|
529
|
+
let r = this.style;
|
|
530
|
+
if (!r || !r.columns || !r.columns[t]) return;
|
|
531
|
+
let i = r.columns[t][n];
|
|
532
|
+
i && (e.fillColor = function(e) {
|
|
533
|
+
let t = /rgba\((\d+),(\d+),(\d+)\,(\d*.\d+|\d+)\)/gi.exec(e.replace(/\s/g, ""));
|
|
534
|
+
if (t === null) return e;
|
|
535
|
+
let n = parseFloat(t[1]).toString(16).toUpperCase(), r = parseFloat(t[2]).toString(16).toUpperCase(), i = parseFloat(t[3]).toString(16).toUpperCase();
|
|
536
|
+
return "#" + "0".repeat(2 - n.length) + n + "0".repeat(2 - r.length) + r + "0".repeat(2 - i.length) + i;
|
|
537
|
+
}(i.background), e.color = i.color.toLowerCase());
|
|
538
|
+
}
|
|
539
|
+
setIndentation(e, t) {
|
|
540
|
+
if (t.j !== 0) return;
|
|
541
|
+
let n = this;
|
|
542
|
+
if (n.actualHierarchy) {
|
|
543
|
+
let r = t.currentRecord;
|
|
544
|
+
r._expanded === void 0 ? e.marginLeft = 25 * (r._level - 1) + 6 : (e.marginLeft = 25 * (r._level - 1), e.text = n.collapseChar + " " + t.value);
|
|
545
|
+
} else t.outlineLevel > 1 && (e.marginLeft = 7.5 * (t.outlineLevel - 1));
|
|
546
|
+
}
|
|
547
|
+
addBodyImageToMap(e, t, n, r) {
|
|
548
|
+
let { row: i, column: a } = e.position || {}, o = e;
|
|
549
|
+
r && (t === null || n === null || i && a || (e.position ||= {}, e.position = Object.assign({}, e.position, {
|
|
550
|
+
row: t,
|
|
551
|
+
column: r.indexOf(n) + 1
|
|
552
|
+
})), o.totalWidth = o.width, o.totalHeight = o.height), this.buildImageMap({
|
|
553
|
+
imageToAdd: o,
|
|
554
|
+
idx: 1
|
|
555
|
+
});
|
|
556
|
+
let s = this.worksheetImageIds.get(1);
|
|
557
|
+
s || (s = /* @__PURE__ */ new Map(), this.worksheetImageIds.set(1, s));
|
|
558
|
+
let c = this.worksheetImages.get(1);
|
|
559
|
+
c ? c.push(o) : this.worksheetImages.set(1, [o]), s.get(e.id) || s.set(e.id, {
|
|
560
|
+
index: s.size,
|
|
561
|
+
type: e.imageType
|
|
562
|
+
});
|
|
563
|
+
}
|
|
564
|
+
buildImageMap(e) {
|
|
565
|
+
let { imageToAdd: t, idx: n } = e, r = this.images.get(t.id);
|
|
566
|
+
if (r) {
|
|
567
|
+
let e = r.find(((e) => e.sheetId === n));
|
|
568
|
+
e ? e.image.push(t) : r.push({
|
|
569
|
+
sheetId: n,
|
|
570
|
+
image: [t]
|
|
571
|
+
});
|
|
572
|
+
} else this.images.set(t.id, [{
|
|
573
|
+
sheetId: n,
|
|
574
|
+
image: [t]
|
|
575
|
+
}]), this.workbookImageIds.set(t.id, {
|
|
576
|
+
type: t.imageType,
|
|
577
|
+
index: this.workbookImageIds.size
|
|
578
|
+
});
|
|
579
|
+
}
|
|
580
|
+
createXmlPart(e, t) {
|
|
581
|
+
let r = n.createHeader({
|
|
582
|
+
encoding: "UTF-8",
|
|
583
|
+
standalone: "yes"
|
|
584
|
+
}), i = n.createXml(e);
|
|
585
|
+
return t ? i : `${r}${i}`;
|
|
586
|
+
}
|
|
587
|
+
generateWorksheetImages(e, t, n) {
|
|
588
|
+
let r = this;
|
|
589
|
+
this.images = /* @__PURE__ */ new Map(), this.worksheetImages = /* @__PURE__ */ new Map(), this.worksheetHeaderFooterImages = /* @__PURE__ */ new Map(), this.workbookImageIds = /* @__PURE__ */ new Map(), this.worksheetImageIds = /* @__PURE__ */ new Map();
|
|
590
|
+
let i = 0, a = 0, o = 0;
|
|
591
|
+
if (r.addImageToCell) {
|
|
592
|
+
for (let e = 1 + (r.headerContent ? r.headerContent.length : 0); e < n.length; e++) {
|
|
593
|
+
let t = n[e];
|
|
594
|
+
for (let n = 0; n < r.datafields.length; n++) {
|
|
595
|
+
let i = r.datafields[n], a = t[i];
|
|
596
|
+
if (a && Array.isArray(a)) {
|
|
597
|
+
for (let n = 0; n < a.length; n++) {
|
|
598
|
+
let s = r.addImageToCell(e + o++, i, a[n], a, t, n);
|
|
599
|
+
s && (t[i] = "", this.addBodyImageToMap(s.image, 1 + e, i, r.datafields));
|
|
600
|
+
}
|
|
601
|
+
continue;
|
|
602
|
+
}
|
|
603
|
+
let s = r.addImageToCell(e + o++, i, a, a, t, 0);
|
|
604
|
+
s && (t[i] = "", s.value && s.value !== a && (t[i] = s.value), this.addBodyImageToMap(s.image, 1 + e, i, r.datafields));
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
if (r.headerContent) for (let e = 0; e < r.headerContent.length; e++) {
|
|
608
|
+
let t = n[e];
|
|
609
|
+
for (let n = 0; n < r.datafields.length; n++) {
|
|
610
|
+
let i = r.datafields[n], a = t[i], o = r.addImageToCell(e + 1, i, a, a, t, 0);
|
|
611
|
+
o && (t[i] = "", this.addBodyImageToMap(o.image, 1 + e, i, r.datafields));
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
this.images.forEach(((t) => {
|
|
615
|
+
let { base64: n, imageType: r } = t[0].image[0], i = r === "jpg" ? "jpeg" : r, o = (e, t) => {
|
|
616
|
+
e ||= "";
|
|
617
|
+
let n = atob(e), r = Array(n.length);
|
|
618
|
+
for (let e = 0; e < n.length; e++) r[e] = n.charCodeAt(e);
|
|
619
|
+
let i = new Uint8Array(r);
|
|
620
|
+
return new Blob([i], { type: t });
|
|
621
|
+
}, s;
|
|
622
|
+
s = o(n && Array.isArray(n) ? n[0].split(",")[1] : n.split(",")[1], "image/" + i), e.file(`xl/media/image${++a}.${i}`, s, !0);
|
|
623
|
+
}));
|
|
624
|
+
}
|
|
625
|
+
let s = 0;
|
|
626
|
+
var c = (e) => Math.ceil(9525 * e), l = (e, t, n, r) => ({
|
|
627
|
+
name: "xdr:pic",
|
|
628
|
+
children: [
|
|
629
|
+
p(e, t + 1),
|
|
630
|
+
u(e, n + 1),
|
|
631
|
+
d(e, r)
|
|
632
|
+
]
|
|
633
|
+
}), u = (e, t) => {
|
|
634
|
+
let n;
|
|
635
|
+
if (e.transparency) {
|
|
636
|
+
let t = Math.min(Math.max(e.transparency, 0), 100);
|
|
637
|
+
n = [{
|
|
638
|
+
name: "a:alphaModFix",
|
|
639
|
+
properties: { rawMap: { amt: 1e5 - Math.round(1e3 * t) } }
|
|
640
|
+
}];
|
|
641
|
+
}
|
|
642
|
+
if (e.recolor) switch (n ||= [], e.recolor.toLocaleLowerCase()) {
|
|
643
|
+
case "grayscale":
|
|
644
|
+
n.push({ name: "a:grayscl" });
|
|
645
|
+
break;
|
|
646
|
+
case "sepia":
|
|
647
|
+
n.push(getDuoTone({ color: "black" }, {
|
|
648
|
+
color: "D9C3A5",
|
|
649
|
+
tint: 50,
|
|
650
|
+
saturation: 180
|
|
651
|
+
}));
|
|
652
|
+
break;
|
|
653
|
+
case "washout": n.push({
|
|
654
|
+
name: "a:lum",
|
|
655
|
+
properties: { rawMap: {
|
|
656
|
+
bright: "70000",
|
|
657
|
+
contrast: "-70000"
|
|
658
|
+
} }
|
|
659
|
+
});
|
|
660
|
+
}
|
|
661
|
+
return {
|
|
662
|
+
name: "xdr:blipFill",
|
|
663
|
+
children: [{
|
|
664
|
+
name: "a:blip",
|
|
665
|
+
properties: { rawMap: {
|
|
666
|
+
cstate: "print",
|
|
667
|
+
"r:embed": `rId${t}`,
|
|
668
|
+
"xmlns:r": "http://schemas.openxmlformats.org/officeDocument/2006/relationships"
|
|
669
|
+
} },
|
|
670
|
+
children: n
|
|
671
|
+
}, {
|
|
672
|
+
name: "a:stretch",
|
|
673
|
+
children: [{ name: "a:fillRect" }]
|
|
674
|
+
}]
|
|
675
|
+
};
|
|
676
|
+
}, d = (e, t) => {
|
|
677
|
+
let n = {
|
|
678
|
+
name: "a:xfrm",
|
|
679
|
+
children: [{
|
|
680
|
+
name: "a:off",
|
|
681
|
+
properties: { rawMap: {
|
|
682
|
+
x: 0,
|
|
683
|
+
y: 0
|
|
684
|
+
} }
|
|
685
|
+
}, {
|
|
686
|
+
name: "a:ext",
|
|
687
|
+
properties: { rawMap: {
|
|
688
|
+
cx: t.width,
|
|
689
|
+
cy: t.height
|
|
690
|
+
} }
|
|
691
|
+
}]
|
|
692
|
+
};
|
|
693
|
+
if (e.rotation) {
|
|
694
|
+
let t = e.rotation;
|
|
695
|
+
n.properties = { rawMap: { rot: 6e4 * Math.min(Math.max(t, 0), 360) } };
|
|
696
|
+
}
|
|
697
|
+
return {
|
|
698
|
+
name: "xdr:spPr",
|
|
699
|
+
children: [n, {
|
|
700
|
+
name: "a:prstGeom",
|
|
701
|
+
properties: { rawMap: { prst: "rect" } },
|
|
702
|
+
children: [{ name: "a:avLst" }]
|
|
703
|
+
}]
|
|
704
|
+
};
|
|
705
|
+
}, f = (e) => {
|
|
706
|
+
let t = [{
|
|
707
|
+
name: "a:ext",
|
|
708
|
+
properties: { rawMap: { uri: "{FF2B5EF4-FFF2-40B4-BE49-F238E27FC236}" } },
|
|
709
|
+
children: [{
|
|
710
|
+
name: "a16:creationId",
|
|
711
|
+
properties: { rawMap: {
|
|
712
|
+
id: "{822E6D20-D7BC-2841-A643-D49A6EF008A2}",
|
|
713
|
+
"xmlns:a16": "http://schemas.microsoft.com/office/drawing/2014/main"
|
|
714
|
+
} }
|
|
715
|
+
}]
|
|
716
|
+
}];
|
|
717
|
+
switch (e.recolor && e.recolor.toLowerCase()) {
|
|
718
|
+
case "grayscale":
|
|
719
|
+
case "sepia":
|
|
720
|
+
case "washout": t.push({
|
|
721
|
+
name: "a:ext",
|
|
722
|
+
properties: { rawMap: { uri: "{C183D7F6-B498-43B3-948B-1728B52AA6E4}" } },
|
|
723
|
+
children: [{
|
|
724
|
+
name: "adec:decorative",
|
|
725
|
+
properties: { rawMap: {
|
|
726
|
+
val: "0",
|
|
727
|
+
"xmlns:adec": "http://schemas.microsoft.com/office/drawing/2017/decorative"
|
|
728
|
+
} }
|
|
729
|
+
}]
|
|
730
|
+
});
|
|
731
|
+
}
|
|
732
|
+
return {
|
|
733
|
+
name: "a:extLst",
|
|
734
|
+
children: t
|
|
735
|
+
};
|
|
736
|
+
}, p = (e, t) => ({
|
|
737
|
+
name: "xdr:nvPicPr",
|
|
738
|
+
children: [{
|
|
739
|
+
name: "xdr:cNvPr",
|
|
740
|
+
properties: { rawMap: {
|
|
741
|
+
id: t,
|
|
742
|
+
name: e.id,
|
|
743
|
+
descr: e.altText == null ? void 0 : e.altText
|
|
744
|
+
} },
|
|
745
|
+
children: [f(e)]
|
|
746
|
+
}, {
|
|
747
|
+
name: "xdr:cNvPicPr",
|
|
748
|
+
properties: { rawMap: { preferRelativeResize: "0" } },
|
|
749
|
+
children: [{ name: "a:picLocks" }]
|
|
750
|
+
}]
|
|
751
|
+
}), m = (e, t) => ({
|
|
752
|
+
name: `xdr:${e}`,
|
|
753
|
+
children: [
|
|
754
|
+
{
|
|
755
|
+
name: "xdr:col",
|
|
756
|
+
textNode: t.col.toString()
|
|
757
|
+
},
|
|
758
|
+
{
|
|
759
|
+
name: "xdr:colOff",
|
|
760
|
+
textNode: t.offsetX.toString()
|
|
761
|
+
},
|
|
762
|
+
{
|
|
763
|
+
name: "xdr:row",
|
|
764
|
+
textNode: t.row.toString()
|
|
765
|
+
},
|
|
766
|
+
{
|
|
767
|
+
name: "xdr:rowOff",
|
|
768
|
+
textNode: t.offsetY.toString()
|
|
769
|
+
}
|
|
770
|
+
]
|
|
771
|
+
}), h = { getTemplate(e) {
|
|
772
|
+
let { sheetIndex: t } = e, n = r.worksheetImages.get(t), i = r.worksheetImageIds.get(t);
|
|
773
|
+
return {
|
|
774
|
+
name: "xdr:wsDr",
|
|
775
|
+
properties: { rawMap: {
|
|
776
|
+
"xmlns:xdr": "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing",
|
|
777
|
+
"xmlns:a": "http://schemas.openxmlformats.org/drawingml/2006/main"
|
|
778
|
+
} },
|
|
779
|
+
children: n.map(((e, t) => {
|
|
780
|
+
let n = ((e) => {
|
|
781
|
+
e.fitCell = !!e.fitCell || !e.width || !e.height;
|
|
782
|
+
let { position: t = {}, fitCell: n, width: r = 0, height: i = 0, totalHeight: a, totalWidth: o } = e, { offsetX: s = 0, offsetY: l = 0, row: u = 1, rowSpan: d = 1, column: f = 1, colSpan: p = 1 } = t;
|
|
783
|
+
return {
|
|
784
|
+
from: {
|
|
785
|
+
row: u - 1,
|
|
786
|
+
col: f - 1,
|
|
787
|
+
offsetX: c(s),
|
|
788
|
+
offsetY: c(l)
|
|
789
|
+
},
|
|
790
|
+
to: {
|
|
791
|
+
row: u - 1 + (n ? 1 : d - 1),
|
|
792
|
+
col: f - 1 + (n ? 1 : p - 1),
|
|
793
|
+
offsetX: c(r + s),
|
|
794
|
+
offsetY: c(i + l)
|
|
795
|
+
},
|
|
796
|
+
height: c(a || i),
|
|
797
|
+
width: c(o || r)
|
|
798
|
+
};
|
|
799
|
+
})(e);
|
|
800
|
+
return {
|
|
801
|
+
name: "xdr:twoCellAnchor",
|
|
802
|
+
properties: { rawMap: { editAs: "absolute" } },
|
|
803
|
+
children: [
|
|
804
|
+
m("from", n.from),
|
|
805
|
+
m("to", n.to),
|
|
806
|
+
l(e, t, i.get(e.id).index, n),
|
|
807
|
+
{ name: "xdr:clientData" }
|
|
808
|
+
]
|
|
809
|
+
};
|
|
810
|
+
}))
|
|
811
|
+
};
|
|
812
|
+
} };
|
|
813
|
+
let g = (e) => this.createXmlPart(h.getTemplate({ sheetIndex: e }));
|
|
814
|
+
var _ = { getTemplate(e) {
|
|
815
|
+
let { Id: t, Type: n, Target: r } = e;
|
|
816
|
+
return {
|
|
817
|
+
name: "Relationship",
|
|
818
|
+
properties: { rawMap: {
|
|
819
|
+
Id: t,
|
|
820
|
+
Type: n,
|
|
821
|
+
Target: r
|
|
822
|
+
} }
|
|
823
|
+
};
|
|
824
|
+
} }, v = { getTemplate: (e) => ({
|
|
825
|
+
name: "Relationships",
|
|
826
|
+
properties: { rawMap: { xmlns: "http://schemas.openxmlformats.org/package/2006/relationships" } },
|
|
827
|
+
children: e.map(((e) => _.getTemplate(e)))
|
|
828
|
+
}) }, y = v;
|
|
829
|
+
let b = (e) => {
|
|
830
|
+
let t = this.worksheetImageIds.get(e) || [], n = [];
|
|
831
|
+
for (let [e, r] of t) n.push({
|
|
832
|
+
Id: `rId${r.index + 1}`,
|
|
833
|
+
Type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",
|
|
834
|
+
Target: `../media/image${this.workbookImageIds.get(e).index + 1}.${r.type}`
|
|
835
|
+
});
|
|
836
|
+
return this.createXmlPart(v.getTemplate(n));
|
|
837
|
+
};
|
|
838
|
+
var x = (t, n) => {
|
|
839
|
+
let r = `xl/drawings/drawing${n + 1}.xml`, i = `xl/drawings/_rels/drawing${n + 1}.xml.rels`;
|
|
840
|
+
e.file(i, b(t)), e.file(r, g(t));
|
|
841
|
+
};
|
|
842
|
+
for (let e = 1; e < n.length; e++) this.worksheetImages.has(e) && (x(e, s), i = s, s++);
|
|
843
|
+
var S = +!!this.exportAsTable;
|
|
844
|
+
e.file("xl/worksheets/_rels/sheet1.xml.rels", (({ drawingIndex: e, tableIndex: t } = {}) => {
|
|
845
|
+
if (e === void 0 && t === void 0) return "";
|
|
846
|
+
let n = [];
|
|
847
|
+
e !== null && a > 0 && n.push({
|
|
848
|
+
Id: `rId${n.length + 1}`,
|
|
849
|
+
Type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing",
|
|
850
|
+
Target: `../drawings/drawing${e + 1}.xml`
|
|
851
|
+
}), t !== null && n.push({
|
|
852
|
+
Id: `rId${n.length + 1}`,
|
|
853
|
+
Type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/table",
|
|
854
|
+
Target: "../tables/table1.xml"
|
|
855
|
+
});
|
|
856
|
+
let r = y.getTemplate(n);
|
|
857
|
+
return this.createXmlPart(r);
|
|
858
|
+
})({
|
|
859
|
+
tableIndex: S,
|
|
860
|
+
drawingIndex: i
|
|
861
|
+
}));
|
|
862
|
+
}
|
|
863
|
+
exportToXLSX(e, t, n) {
|
|
864
|
+
try {
|
|
865
|
+
JSZip;
|
|
866
|
+
} catch {
|
|
867
|
+
throw Error("Missing reference to 'jszip.min.js'.");
|
|
868
|
+
}
|
|
869
|
+
let r = this, i = r.style;
|
|
870
|
+
if (e = r.processGroupingInformation(e, !0), r.data = e, r.getColumnsArray(), r.complexHeaderMergedCells = [], r.complexHeaderMergeInfo) {
|
|
871
|
+
for (let e in r.complexHeaderMergeInfo) if (Object.prototype.hasOwnProperty.call(r.complexHeaderMergeInfo, e)) {
|
|
872
|
+
let t = r.complexHeaderMergeInfo[e];
|
|
873
|
+
if (t.from[0] === t.to[0] && t.from[1] === t.to[1]) continue;
|
|
874
|
+
r.complexHeaderMergedCells.push({
|
|
875
|
+
from: r.columnsArray[t.from[1]] + (t.from[0] + 1),
|
|
876
|
+
to: r.columnsArray[t.to[1]] + (t.to[0] + 1)
|
|
877
|
+
});
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
r.getConditionalFormatting(), i ||= r.generateDefaultStyle(e);
|
|
881
|
+
let a = new JSZip(), o = a.folder("_rels"), s = a.folder("docProps"), c = a.folder("xl");
|
|
882
|
+
if (r.headerContent) {
|
|
883
|
+
let t = r.headerContent, n = [];
|
|
884
|
+
for (let e = 0; e < t.length; e++) {
|
|
885
|
+
let i = t[e].cells, a = {};
|
|
886
|
+
for (let e = 0; e < r.datafields.length; e++) {
|
|
887
|
+
let t = r.datafields[e];
|
|
888
|
+
i[t] ? a[t] = i[t] : a[t] = null;
|
|
889
|
+
}
|
|
890
|
+
n.push(a);
|
|
891
|
+
}
|
|
892
|
+
e = [...n, ...e];
|
|
893
|
+
}
|
|
894
|
+
if (r.footerContent) {
|
|
895
|
+
let t = r.footerContent, n = [];
|
|
896
|
+
for (let e = 0; e < t.length; e++) {
|
|
897
|
+
let i = t[e].cells, a = {};
|
|
898
|
+
for (let e = 0; e < r.datafields.length; e++) {
|
|
899
|
+
let t = r.datafields[e];
|
|
900
|
+
i[t] ? a[t] = i[t] : a[t] = null;
|
|
901
|
+
}
|
|
902
|
+
n.push(a);
|
|
903
|
+
}
|
|
904
|
+
e = [...e, ...n];
|
|
905
|
+
}
|
|
906
|
+
this.generateWorksheetImages(a, c, e);
|
|
907
|
+
let l = r.generateSharedStrings(e), u = l.collection, d = l.xml, f = r.generateStyles(i), p = r.groupBy ? r.generateSheet1WithGrouping(e, u) : r.generateSheet1(e, u, r.datafields, r.columnsArray), m = r.generateAuxiliaryFiles(), h = !1, g = this.worksheetImages.get(1);
|
|
908
|
+
g && g.length && (h = !0);
|
|
909
|
+
let _ = c.folder("_rels"), v = c.folder("theme"), y = c.folder("worksheets");
|
|
910
|
+
if (h && (c.folder("media"), c.folder("drawings"), c.folder("drawings/_rels")), o.file(".rels", m._relsRels), s.file("app.xml", m.docPropsAppXml), s.file("core.xml", m.docPropsCoreXml), _.file("workbook.xml.rels", m.xl_relsWorkbookXmlRels), v.file("theme1.xml", m.xlThemeTheme1Xml), y.file("sheet1.xml", p), c.file("sharedStrings.xml", d), c.file("styles.xml", f), c.file("workbook.xml", m.xlWorkbookXml), a.file("[Content_Types].xml", m.Content_TypesXml), this.spreadsheets) {
|
|
911
|
+
let e = 2;
|
|
912
|
+
for (let t = 0; t < this.spreadsheets.length; t++) {
|
|
913
|
+
let n = this.spreadsheets[t], i = n.dataFields, a = [...n.dataSource], o = [];
|
|
914
|
+
for (let e = 0; e < n.columns.length; e++) {
|
|
915
|
+
let t = n.columns[e];
|
|
916
|
+
typeof t == "string" ? o[t] = t : o[t.dataField] = t.label;
|
|
917
|
+
}
|
|
918
|
+
a.splice(0, 0, o);
|
|
919
|
+
let s = r.generateSheet1(a, u, i, r.getColumnsArrayFromDataFields(i), e);
|
|
920
|
+
y.file("sheet" + e++ + ".xml", s);
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
if (this.exportAsTable) {
|
|
924
|
+
let t = Object.values(r.data[0]), n = r.groupBy && r.groupBy.length ? r.groupDimensionEnd : r.columnsArray[r.columnsArray.length - 1] + (e.length - 1), i = `<table xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:xr="http://schemas.microsoft.com/office/spreadsheetml/2014/revision" xmlns:xr3="http://schemas.microsoft.com/office/spreadsheetml/2016/revision3" mc:Ignorable="xr xr3" id="1" name="Table1" displayName="Table1" ref="A${this.xlsxStartIndex}:${n}" totalsRowShown="0">\n<autoFilter ref="A${this.xlsxStartIndex}:${n}">`;
|
|
925
|
+
for (let e = 0; e < t.length; e++) i += `<filterColumn colId="${e}" hiddenButton="0"/>\n`;
|
|
926
|
+
i += "</autoFilter>";
|
|
927
|
+
let a = `\n<tableColumns count="${t.length}">`;
|
|
928
|
+
for (let e = 0; e < t.length; e++) a += `<tableColumn id="${e + 1}" name="${t[e]}" dataCellStyle="Normal"/>\n`;
|
|
929
|
+
a += "\n</tableColumns>", i += a, i += "\n <tableStyleInfo name=\"TableStyleLight1\" showFirstColumn=\"0\" showLastColumn=\"0\" showRowStripes=\"1\" showColumnStripes=\"0\"/>\n</table>", c.folder("tables").file("table1.xml", i);
|
|
930
|
+
}
|
|
931
|
+
a.generateAsync({
|
|
932
|
+
type: "blob",
|
|
933
|
+
mimeType: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
|
934
|
+
}).then((function(e) {
|
|
935
|
+
return !t && n && n(e), r.downloadFile(e, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", t);
|
|
936
|
+
})), delete r.conditionalFormattingXLSX, delete r.complexHeaderMergeInfo, delete r.defaultRowHeight, delete r.rowHeight;
|
|
937
|
+
}
|
|
938
|
+
processGroupingInformation(e, t) {
|
|
939
|
+
let n = this;
|
|
940
|
+
if (!n.groupBy) return e;
|
|
941
|
+
let r;
|
|
942
|
+
if (e = e.slice(0), n.exportHeader && (t && n.complexHeader ? (r = e.slice(0, n.complexHeader.length), e.splice(0, n.complexHeader.length)) : (r = [e[0]], e.splice(0, 1))), e.length > 1) {
|
|
943
|
+
let t = function(e, t) {
|
|
944
|
+
let n;
|
|
945
|
+
switch (t || typeof e) {
|
|
946
|
+
case "string":
|
|
947
|
+
n = new Intl.Collator().compare;
|
|
948
|
+
break;
|
|
949
|
+
case "number":
|
|
950
|
+
n = function(e, t) {
|
|
951
|
+
return e - t;
|
|
952
|
+
};
|
|
953
|
+
break;
|
|
954
|
+
case "boolean":
|
|
955
|
+
case "bool":
|
|
956
|
+
n = function(e, t) {
|
|
957
|
+
return e === t ? 0 : !1 === e ? -1 : 1;
|
|
958
|
+
};
|
|
959
|
+
break;
|
|
960
|
+
case "date":
|
|
961
|
+
case "time":
|
|
962
|
+
case "dateTime":
|
|
963
|
+
e instanceof Date ? n = function(e, t) {
|
|
964
|
+
return e.getTime() - t.getTime();
|
|
965
|
+
} : (e instanceof Smart.Utilities.DateTime || e instanceof Smart.Utilities.BigNumber) && (n = function(e, t) {
|
|
966
|
+
return e.compare(t);
|
|
967
|
+
});
|
|
968
|
+
break;
|
|
969
|
+
case "object": if (e instanceof Date) n = function(e, t) {
|
|
970
|
+
return e.getTime() - t.getTime();
|
|
971
|
+
};
|
|
972
|
+
else if (e instanceof Smart.Utilities.DateTime || e instanceof Smart.Utilities.BigNumber) n = function(e, t) {
|
|
973
|
+
return e.compare(t);
|
|
974
|
+
};
|
|
975
|
+
else if (e instanceof Smart.Utilities.Complex || window.NIComplex && e instanceof window.NIComplex) {
|
|
976
|
+
let e = new Smart.Utilities.ComplexNumericProcessor();
|
|
977
|
+
n = function(t, n) {
|
|
978
|
+
return e.compareComplexNumbers(t, n);
|
|
979
|
+
};
|
|
980
|
+
}
|
|
981
|
+
}
|
|
982
|
+
return n;
|
|
983
|
+
};
|
|
984
|
+
(function(e, n, r, i) {
|
|
985
|
+
if (!e || !Array.isArray(e) || e.length === 0 || !n || Array.isArray(n) && n.length === 0) return;
|
|
986
|
+
typeof n == "string" && (n = [n]);
|
|
987
|
+
let a = [], o = [];
|
|
988
|
+
r === void 0 && (r = []);
|
|
989
|
+
for (let i = 0; i < n.length; i++) r[i] === void 0 || r[i] === "asc" || r[i] === "ascending" ? a[i] = 1 : a[i] = -1, o[i] = t(e[0][n[i]]);
|
|
990
|
+
i ? i(e, n, r, o) : e.sort((function(e, t) {
|
|
991
|
+
for (let r = 0; r < n.length; r++) {
|
|
992
|
+
let i = o[r](e[n[r]], t[n[r]]);
|
|
993
|
+
if (i === 0) {
|
|
994
|
+
if (n[r + 1]) continue;
|
|
995
|
+
return e._index === void 0 ? 0 : (e._index - t._index) * a[r];
|
|
996
|
+
}
|
|
997
|
+
return i * a[r];
|
|
998
|
+
}
|
|
999
|
+
}));
|
|
1000
|
+
})(e, n.groupBy);
|
|
1001
|
+
}
|
|
1002
|
+
return r && (e = r.concat(e)), n.getGroupLabels(e), e;
|
|
1003
|
+
}
|
|
1004
|
+
exportToXML(e, t) {
|
|
1005
|
+
let n = this.datafields.slice(0), r = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<table>\n";
|
|
1006
|
+
return n.indexOf("rows") === -1 && n.push("rows"), r += function e(t, r) {
|
|
1007
|
+
let i = "";
|
|
1008
|
+
for (let a = 0; a < t.length; a++) {
|
|
1009
|
+
let o = t[a];
|
|
1010
|
+
i += r + "<row>\n";
|
|
1011
|
+
for (let t = 0; t < n.length; t++) {
|
|
1012
|
+
let a = n[t];
|
|
1013
|
+
if (a !== "rows") i += r + ` <${a}>${o[a]}</${a}>\n`;
|
|
1014
|
+
else {
|
|
1015
|
+
if (!o.rows) continue;
|
|
1016
|
+
i += `${r} <rows>\n${e(o.rows, r + " ")}${r} </rows>\n`;
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
1019
|
+
i += r + "</row>\n";
|
|
1020
|
+
}
|
|
1021
|
+
return i;
|
|
1022
|
+
}(e, " ") + "</table>", t ? this.downloadFile(r, "application/xml", t) : r;
|
|
1023
|
+
}
|
|
1024
|
+
formatDate(e, t) {
|
|
1025
|
+
if (!Smart.Utilities.DateTime) return e;
|
|
1026
|
+
try {
|
|
1027
|
+
return new Smart.Utilities.DateTime(e).toString(t);
|
|
1028
|
+
} catch {
|
|
1029
|
+
return e;
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
formatNumber(e, t) {
|
|
1033
|
+
if (!Smart.Utilities.NumberRenderer) return e;
|
|
1034
|
+
let n = new Smart.Utilities.NumberRenderer().formatNumber(e, t);
|
|
1035
|
+
return n === void 0 ? e : n;
|
|
1036
|
+
}
|
|
1037
|
+
generateAuxiliaryFiles() {
|
|
1038
|
+
let e = (/* @__PURE__ */ new Date()).toISOString(), t = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n<cp:coreProperties xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dcmitype="http://purl.org/dc/dcmitype/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><dc:creator>Smart HTML Elements</dc:creator><cp:lastModifiedBy>Smart HTML Elements</cp:lastModifiedBy><dcterms:created xsi:type="dcterms:W3CDTF">${e}</dcterms:created><dcterms:modified xsi:type="dcterms:W3CDTF">${e}</dcterms:modified></cp:coreProperties>`, n = "<Relationship Id=\"rId1\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet\" Target=\"worksheets/sheet1.xml\"/>", r = 1;
|
|
1039
|
+
if (this.spreadsheets) for (let e = 0; e < this.spreadsheets.length; e++) {
|
|
1040
|
+
let t = 2 + e;
|
|
1041
|
+
r++, n += `<Relationship Id="rId${t}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet${t}.xml"/>`;
|
|
1042
|
+
}
|
|
1043
|
+
let i = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">${n}<Relationship Id="rId${++r}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme" Target="theme/theme1.xml"/><Relationship Id="rId${++r}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/><Relationship Id="rId${++r}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings" Target="sharedStrings.xml"/></Relationships>`, a = "<sheet name=\"Sheet1\" sheetId=\"1\" r:id=\"rId1\"/>";
|
|
1044
|
+
if (this.spreadsheets) for (let e = 0; e < this.spreadsheets.length; e++) {
|
|
1045
|
+
let t = 2 + e;
|
|
1046
|
+
a += `<sheet name="${this.spreadsheets[e].label}" sheetId="${t}" r:id="rId${t}"/>`;
|
|
1047
|
+
}
|
|
1048
|
+
let o = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n<workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="x15 xr xr6 xr10 xr2" xmlns:x15="http://schemas.microsoft.com/office/spreadsheetml/2010/11/main" xmlns:xr="http://schemas.microsoft.com/office/spreadsheetml/2014/revision" xmlns:xr6="http://schemas.microsoft.com/office/spreadsheetml/2016/revision6" xmlns:xr10="http://schemas.microsoft.com/office/spreadsheetml/2016/revision10" xmlns:xr2="http://schemas.microsoft.com/office/spreadsheetml/2015/revision2"><fileVersion appName="xl" lastEdited="7" lowestEdited="7" rupBuild="20325"/><workbookPr defaultThemeVersion="166925"/><mc:AlternateContent xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"><mc:Choice Requires="x15"><x15ac:absPath url="C:UsersjqwidgetsDesktop" xmlns:x15ac="http://schemas.microsoft.com/office/spreadsheetml/2010/11/ac"/></mc:Choice></mc:AlternateContent><xr:revisionPtr revIDLastSave="0" documentId="13_ncr:1_{0DEDCB6D-5403-4CD8-AAA5-59B6D238A8B6}" xr6:coauthVersionLast="34" xr6:coauthVersionMax="34" xr10:uidLastSave="{00000000-0000-0000-0000-000000000000}"/><bookViews><workbookView xWindow="0" yWindow="0" windowWidth="19200" windowHeight="6950" xr2:uid="{0CB664E6-3800-4A88-B158-B46A682E7484}"/></bookViews><sheets>${a}</sheets><calcPr calcId="179021"/><extLst><ext uri="{140A7094-0E35-4892-8432-C4D2E57EDEB5}" xmlns:x15="http://schemas.microsoft.com/office/spreadsheetml/2010/11/main"><x15:workbookPr chartTrackingRefBase="1"/></ext></extLst></workbook>`, s = this.worksheetImages.get(1), c = "";
|
|
1049
|
+
s && s.length && (c = "<Override PartName=\"/xl/drawings/drawing1.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.drawing+xml\"/>");
|
|
1050
|
+
let l = "";
|
|
1051
|
+
this.exportAsTable && (l = "<Override PartName=\"/xl/tables/table1.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml\"/>");
|
|
1052
|
+
let u = "<Override PartName = \"/xl/worksheets/sheet1.xml\" ContentType = \"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml\" />";
|
|
1053
|
+
if (this.spreadsheets) for (let e = 0; e < this.spreadsheets.length; e++) u += `<Override PartName = "/xl/worksheets/sheet${e + 2}.xml" ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml" />`;
|
|
1054
|
+
return {
|
|
1055
|
+
_relsRels: "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\"><Relationship Id=\"rId3\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties\" Target=\"docProps/app.xml\"/><Relationship Id=\"rId2\" Type=\"http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties\" Target=\"docProps/core.xml\"/><Relationship Id=\"rId1\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument\" Target=\"xl/workbook.xml\"/></Relationships>",
|
|
1056
|
+
docPropsAppXml: "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<Properties xmlns=\"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties\" xmlns:vt=\"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes\"><Application>Microsoft Excel</Application><DocSecurity>0</DocSecurity><ScaleCrop>false</ScaleCrop><HeadingPairs><vt:vector size=\"2\" baseType=\"variant\"><vt:variant><vt:lpstr>Worksheets</vt:lpstr></vt:variant><vt:variant><vt:i4>1</vt:i4></vt:variant></vt:vector></HeadingPairs><TitlesOfParts><vt:vector size=\"1\" baseType=\"lpstr\"><vt:lpstr>Sheet1</vt:lpstr></vt:vector></TitlesOfParts><Company></Company><LinksUpToDate>false</LinksUpToDate><SharedDoc>false</SharedDoc><HyperlinksChanged>false</HyperlinksChanged><AppVersion>16.0300</AppVersion></Properties>",
|
|
1057
|
+
docPropsCoreXml: t,
|
|
1058
|
+
xl_relsWorkbookXmlRels: i,
|
|
1059
|
+
xlThemeTheme1Xml: "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<a:theme xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" name=\"Office Theme\"><a:themeElements><a:clrScheme name=\"Office\"><a:dk1><a:sysClr val=\"windowText\" lastClr=\"000000\"/></a:dk1><a:lt1><a:sysClr val=\"window\" lastClr=\"FFFFFF\"/></a:lt1><a:dk2><a:srgbClr val=\"44546A\"/></a:dk2><a:lt2><a:srgbClr val=\"E7E6E6\"/></a:lt2><a:accent1><a:srgbClr val=\"4472C4\"/></a:accent1><a:accent2><a:srgbClr val=\"ED7D31\"/></a:accent2><a:accent3><a:srgbClr val=\"A5A5A5\"/></a:accent3><a:accent4><a:srgbClr val=\"FFC000\"/></a:accent4><a:accent5><a:srgbClr val=\"5B9BD5\"/></a:accent5><a:accent6><a:srgbClr val=\"70AD47\"/></a:accent6><a:hlink><a:srgbClr val=\"0563C1\"/></a:hlink><a:folHlink><a:srgbClr val=\"954F72\"/></a:folHlink></a:clrScheme><a:fontScheme name=\"Office\"><a:majorFont><a:latin typeface=\"Calibri Light\" panose=\"020F0302020204030204\"/><a:ea typeface=\"\"/><a:cs typeface=\"\"/></a:majorFont><a:minorFont><a:latin typeface=\"Calibri\" panose=\"020F0502020204030204\"/><a:ea typeface=\"\"/><a:cs typeface=\"\"/></a:minorFont></a:fontScheme><a:fmtScheme name=\"Office\"><a:fillStyleLst><a:solidFill><a:schemeClr val=\"phClr\"/></a:solidFill><a:gradFill rotWithShape=\"1\"><a:gsLst><a:gs pos=\"0\"><a:schemeClr val=\"phClr\"><a:lumMod val=\"110000\"/><a:satMod val=\"105000\"/><a:tint val=\"67000\"/></a:schemeClr></a:gs><a:gs pos=\"50000\"><a:schemeClr val=\"phClr\"><a:lumMod val=\"105000\"/><a:satMod val=\"103000\"/><a:tint val=\"73000\"/></a:schemeClr></a:gs><a:gs pos=\"100000\"><a:schemeClr val=\"phClr\"><a:lumMod val=\"105000\"/><a:satMod val=\"109000\"/><a:tint val=\"81000\"/></a:schemeClr></a:gs></a:gsLst><a:lin ang=\"5400000\" scaled=\"0\"/></a:gradFill><a:gradFill rotWithShape=\"1\"><a:gsLst><a:gs pos=\"0\"><a:schemeClr val=\"phClr\"><a:satMod val=\"103000\"/><a:lumMod val=\"102000\"/><a:tint val=\"94000\"/></a:schemeClr></a:gs><a:gs pos=\"50000\"><a:schemeClr val=\"phClr\"><a:satMod val=\"110000\"/><a:lumMod val=\"100000\"/><a:shade val=\"100000\"/></a:schemeClr></a:gs><a:gs pos=\"100000\"><a:schemeClr val=\"phClr\"><a:lumMod val=\"99000\"/><a:satMod val=\"120000\"/><a:shade val=\"78000\"/></a:schemeClr></a:gs></a:gsLst><a:lin ang=\"5400000\" scaled=\"0\"/></a:gradFill></a:fillStyleLst><a:lnStyleLst><a:ln w=\"6350\" cap=\"flat\" cmpd=\"sng\" algn=\"ctr\"><a:solidFill><a:schemeClr val=\"phClr\"/></a:solidFill><a:prstDash val=\"solid\"/><a:miter lim=\"800000\"/></a:ln><a:ln w=\"12700\" cap=\"flat\" cmpd=\"sng\" algn=\"ctr\"><a:solidFill><a:schemeClr val=\"phClr\"/></a:solidFill><a:prstDash val=\"solid\"/><a:miter lim=\"800000\"/></a:ln><a:ln w=\"19050\" cap=\"flat\" cmpd=\"sng\" algn=\"ctr\"><a:solidFill><a:schemeClr val=\"phClr\"/></a:solidFill><a:prstDash val=\"solid\"/><a:miter lim=\"800000\"/></a:ln></a:lnStyleLst><a:effectStyleLst><a:effectStyle><a:effectLst/></a:effectStyle><a:effectStyle><a:effectLst/></a:effectStyle><a:effectStyle><a:effectLst><a:outerShdw blurRad=\"57150\" dist=\"19050\" dir=\"5400000\" algn=\"ctr\" rotWithShape=\"0\"><a:srgbClr val=\"000000\"><a:alpha val=\"63000\"/></a:srgbClr></a:outerShdw></a:effectLst></a:effectStyle></a:effectStyleLst><a:bgFillStyleLst><a:solidFill><a:schemeClr val=\"phClr\"/></a:solidFill><a:solidFill><a:schemeClr val=\"phClr\"><a:tint val=\"95000\"/><a:satMod val=\"170000\"/></a:schemeClr></a:solidFill><a:gradFill rotWithShape=\"1\"><a:gsLst><a:gs pos=\"0\"><a:schemeClr val=\"phClr\"><a:tint val=\"93000\"/><a:satMod val=\"150000\"/><a:shade val=\"98000\"/><a:lumMod val=\"102000\"/></a:schemeClr></a:gs><a:gs pos=\"50000\"><a:schemeClr val=\"phClr\"><a:tint val=\"98000\"/><a:satMod val=\"130000\"/><a:shade val=\"90000\"/><a:lumMod val=\"103000\"/></a:schemeClr></a:gs><a:gs pos=\"100000\"><a:schemeClr val=\"phClr\"><a:shade val=\"63000\"/><a:satMod val=\"120000\"/></a:schemeClr></a:gs></a:gsLst><a:lin ang=\"5400000\" scaled=\"0\"/></a:gradFill></a:bgFillStyleLst></a:fmtScheme></a:themeElements><a:objectDefaults/><a:extraClrSchemeLst/><a:extLst><a:ext uri=\"{05A4C25C-085E-4340-85A3-A5531E510DB2}\"><thm15:themeFamily xmlns:thm15=\"http://schemas.microsoft.com/office/thememl/2012/main\" name=\"Office Theme\" id=\"{62F939B6-93AF-4DB8-9C6B-D6C7DFDC589F}\" vid=\"{4A3C46E8-61CC-4603-A589-7422A47A8E4A}\"/></a:ext></a:extLst></a:theme>",
|
|
1060
|
+
xlWorkbookXml: o,
|
|
1061
|
+
Content_TypesXml: `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="bin" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.printerSettings"/><Default Extension="jpeg" ContentType="image/jpeg"/><Default Extension="png" ContentType="image/png"/><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/><Override PartName="/xl/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"/>${u}<Override PartName="/xl/theme/theme1.xml" ContentType="application/vnd.openxmlformats-officedocument.theme+xml"/><Override PartName="/xl/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml"/><Override PartName="/xl/sharedStrings.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml"/>${l}${c}<Override PartName="/docProps/core.xml" ContentType="application/vnd.openxmlformats-package.core-properties+xml"/><Override PartName="/docProps/app.xml" ContentType="application/vnd.openxmlformats-officedocument.extended-properties+xml"/></Types>`
|
|
1062
|
+
};
|
|
1063
|
+
}
|
|
1064
|
+
generateDefaultStyle(e) {
|
|
1065
|
+
let t = this, n = {}, r = t.datafields, i = t.complexHeader ? e[t.complexHeader.length] : e[+t.exportHeader];
|
|
1066
|
+
if (!i) return n;
|
|
1067
|
+
for (let e = 0; e < r.length; e++) i[r[e]] instanceof Date && (n.columns ||= [], n.columns[r[e]] = { format: "d" });
|
|
1068
|
+
return n;
|
|
1069
|
+
}
|
|
1070
|
+
generateGroupRow(e) {
|
|
1071
|
+
let t = e.rowNumber, n = "A" + t, r = ` <row r="${t}" outlineLevel="${e.outlineLevel}" spans="1:${e.numberOfColumns}"${this.getCustomRowHeight(t - 1)} x14ac:dyDescent="0.45">\n <c r="${n}" t="s" s="0">\n <v>${e.sharedStringIndex}</v>\n </c>\n </row>\n`;
|
|
1072
|
+
return e.mergedCells.push({
|
|
1073
|
+
from: n,
|
|
1074
|
+
to: this.columnsArray[e.numberOfColumns - 1] + t
|
|
1075
|
+
}), r;
|
|
1076
|
+
}
|
|
1077
|
+
generateSharedStrings(e) {
|
|
1078
|
+
let t = this, n = t.datafields, r = [], i = "", a = 0, o = 0;
|
|
1079
|
+
function s(e) {
|
|
1080
|
+
a++, r.indexOf(e) === -1 && (o++, r.push(e), e = (e = (e = (e = (e = e.replace(/&(?!amp;)/g, "&")).replace(/'/g, "'")).replace(/"/g, """)).replace(/>/g, ">")).replace(/</g, "<"), i += `<si><t>${e}</t></si>`);
|
|
1081
|
+
}
|
|
1082
|
+
let c = (e, n) => {
|
|
1083
|
+
for (let r = 0; r < e.length; r++) {
|
|
1084
|
+
let i = e[r];
|
|
1085
|
+
for (let e = 0; e < n.length; e++) {
|
|
1086
|
+
let r = i[n[e]];
|
|
1087
|
+
r !== null || t.allowNull || (r = ""), typeof r == "string" && s(r);
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1090
|
+
};
|
|
1091
|
+
if (c(e, n), t.spreadsheets) for (let e = 0; e < t.spreadsheets.length; e++) {
|
|
1092
|
+
let n = t.spreadsheets[e], r = n.dataFields, i = [...n.dataSource], a = [];
|
|
1093
|
+
for (let e = 0; e < n.columns.length; e++) {
|
|
1094
|
+
let t = n.columns[e];
|
|
1095
|
+
typeof t == "string" ? a[t] = t : a[t.dataField] = t.label;
|
|
1096
|
+
}
|
|
1097
|
+
i.splice(0, 0, a), c(i, r);
|
|
1098
|
+
}
|
|
1099
|
+
if (t.groupLabels) for (let e = 0; e < t.groupLabels.length; e++) s(t.groupLabels[e]);
|
|
1100
|
+
return i = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n<sst xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" count="${a}" uniqueCount="${o}">${i}</sst>`, {
|
|
1101
|
+
collection: r,
|
|
1102
|
+
xml: i
|
|
1103
|
+
};
|
|
1104
|
+
}
|
|
1105
|
+
generateSheet1(e, t, n, r, i) {
|
|
1106
|
+
let a = this, o = r.length, s = e.length, c = r[o - 1] + s, l = a.getFilters(), u = [].concat(a.complexHeaderMergedCells), d = 0, f = a.freezeHeader ? `<sheetView rightToLeft="0" workbookViewId="0">\n <pane state="frozen" topLeftCell="A${a.xlsxStartIndex + 1}" ySplit="${a.xlsxStartIndex}"/>\n </sheetView>` : "", p = a.getCustomColumnWidths(r);
|
|
1107
|
+
if (i > 1) {
|
|
1108
|
+
let e = "<cols>";
|
|
1109
|
+
for (let t = 0; t < r.length; t++) e += "<col min=\"1\" max=\"1\" width=\"25\" hidden=\"0\" bestFit=\"0\" customWidth=\"1\"/>";
|
|
1110
|
+
e += "</cols>", p = e;
|
|
1111
|
+
}
|
|
1112
|
+
let m = a.protectSheet ? "<sheetProtection sheet=\"1\"/>" : "";
|
|
1113
|
+
a.protectSheet && a.protectSheet.password && (m = `<sheetProtection sheet="1" password="${function(e) {
|
|
1114
|
+
let t = e.length;
|
|
1115
|
+
if (!t) return "";
|
|
1116
|
+
let n = Array(t + 1);
|
|
1117
|
+
n[0] = t;
|
|
1118
|
+
for (let r = 1; r <= t; r++) n[r] = 255 & e.charCodeAt(r - 1);
|
|
1119
|
+
let r = 0;
|
|
1120
|
+
for (let e = n.length - 1; e >= 0; e--) r = ((16384 & r ? 1 : 0) | r << 1 & 32767) ^ n[e];
|
|
1121
|
+
return (52811 ^ r).toString(16).toUpperCase().padStart(4, "0");
|
|
1122
|
+
}(a.protectSheet.password)}"/>`);
|
|
1123
|
+
let h = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="x14ac xr xr2 xr3" xmlns:x14ac="http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac" xmlns:xr="http://schemas.microsoft.com/office/spreadsheetml/2014/revision" xmlns:xr2="http://schemas.microsoft.com/office/spreadsheetml/2015/revision2" xmlns:xr3="http://schemas.microsoft.com/office/spreadsheetml/2016/revision3" xr:uid="{7F25248B-C640-4C64-AD47-C0EA0E5D90D0}">\n <sheetPr filterMode="${l !== ""}" />\n <dimension ref="A1:${c}" />\n <sheetViews>\n <sheetView ${i <= 1 ? "tabSelected=\"1\"" : ""} workbookViewId="0" />\n ${a.freezeColumnsCount > 0 ? `\n<sheetView rightToLeft="0" workbookViewId="0">\n<pane state="frozen" topLeftCell="B1" xSplit="${a.freezeColumnsCount}"/>\n</sheetView>\n` : ""}\n ${f}\n </sheetViews>\n <sheetFormatPr defaultRowHeight="14.5" x14ac:dyDescent="0.35" />${p}\n <sheetData>\n`;
|
|
1124
|
+
function g(e, t) {
|
|
1125
|
+
return r[e] + t;
|
|
1126
|
+
}
|
|
1127
|
+
for (let r = 0; r <= e.length; r++) {
|
|
1128
|
+
let i = e[r], s = r + 1, c = "";
|
|
1129
|
+
if (a.actualHierarchy) {
|
|
1130
|
+
let t = e[r - 1];
|
|
1131
|
+
t && t._collapsed && (!i || t._level > i._level) && (c = " collapsed=\"true\"");
|
|
1132
|
+
}
|
|
1133
|
+
if (r === e.length) {
|
|
1134
|
+
c && (h += ` <row r="${s}" outlineLevel="${Math.max(e[r - 1]._level - 2, 0)}" hidden="false" collapsed="true" />\n`);
|
|
1135
|
+
break;
|
|
1136
|
+
}
|
|
1137
|
+
let l = ` <row r="${s}"${a.getOutlineLevel(i)} hidden="${i._hidden || i._collapsed || !1}"${c} spans="1:${o}"${a.getCustomRowHeight(s - 1)} customHeight="1" x14ac:dyDescent="0.45">\n`;
|
|
1138
|
+
for (let e = 0; e < n.length; e++) {
|
|
1139
|
+
let r = a.getXLSXCellStyle(g(e, s));
|
|
1140
|
+
l += a.getActualCellData(i[n[e]], {
|
|
1141
|
+
r: g(e, s),
|
|
1142
|
+
s: r
|
|
1143
|
+
}, t, s, n[e]);
|
|
1144
|
+
}
|
|
1145
|
+
l += " </row>\n", h += l;
|
|
1146
|
+
}
|
|
1147
|
+
if (a.headerContent) for (let e = 0; e < a.headerContent.length; e++) {
|
|
1148
|
+
let t = a.headerContent[e];
|
|
1149
|
+
t.style && t.style.mergeAcross && u.push({
|
|
1150
|
+
from: "A" + (e + 1),
|
|
1151
|
+
to: r[o - 1] + (e + 1)
|
|
1152
|
+
});
|
|
1153
|
+
}
|
|
1154
|
+
if (a.footerContent) for (let t = 0; t < a.footerContent.length; t++) {
|
|
1155
|
+
let n = a.footerContent[t];
|
|
1156
|
+
n.style && n.style.mergeAcross && u.push({
|
|
1157
|
+
from: "A" + (e.length - t),
|
|
1158
|
+
to: r[o - 1] + (e.length - t)
|
|
1159
|
+
});
|
|
1160
|
+
}
|
|
1161
|
+
return h += ` </sheetData>${a.conditionalFormattingXLSX.conditions}${l}${a.getMergedCells(u)}\n ${m}\n <pageMargins left="0.7" right="0.7" top="0.75" bottom="0.75" header="0.3" footer="0.3" />\n <pageSetup paperSize="9" orientation="portrait" r:id="rId1" />\n ${((e) => {
|
|
1162
|
+
let t = "", n = this.worksheetImages.get(e);
|
|
1163
|
+
return n && n.length && (t += `<drawing r:id="rId${++d}"/>`), t;
|
|
1164
|
+
})(1)}\n ${a.exportAsTable ? `<tableParts count="1">\n <tablePart r:id="rId${++d}"/>\n </tableParts>` : ""}\n</worksheet>`, h;
|
|
1165
|
+
}
|
|
1166
|
+
generateSheet1WithGrouping(e, t) {
|
|
1167
|
+
let n = this, r = n.columnsArray.length, i = e.length, a = n.columnsArray[r - 1] + i, o = n.datafields, s = [].concat(n.complexHeaderMergedCells), c = 0, l = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="x14ac xr xr2 xr3" xmlns:x14ac="http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac" xmlns:xr="http://schemas.microsoft.com/office/spreadsheetml/2014/revision" xmlns:xr2="http://schemas.microsoft.com/office/spreadsheetml/2015/revision2" xmlns:xr3="http://schemas.microsoft.com/office/spreadsheetml/2016/revision3" xr:uid="{7F25248B-C640-4C64-AD47-C0EA0E5D90D0}">\n <dimension ref="A1:${a}" />\n <sheetViews>\n <sheetView tabSelected="1" workbookViewId="0" />\n ${n.freezeHeader ? `<sheetView rightToLeft="0" workbookViewId="0">\n <pane state="frozen" topLeftCell="A${n.xlsxStartIndex + 1}" ySplit="${n.xlsxStartIndex}"/>\n </sheetView>` : ""}\n </sheetViews>\n <sheetFormatPr defaultRowHeight="14.5" x14ac:dyDescent="0.35" />${n.getCustomColumnWidths()}\n <sheetData>\n`, u = 0, d = [];
|
|
1168
|
+
function f(e, t) {
|
|
1169
|
+
return n.columnsArray[e] + t;
|
|
1170
|
+
}
|
|
1171
|
+
e: for (let i = 0; i < e.length; i++) {
|
|
1172
|
+
let a = e[i], c = i + 1 + u, p = 0, m = "";
|
|
1173
|
+
if (!n.exportHeader || !n.complexHeader && i !== 0 || n.complexHeader && i >= n.complexHeader.length) {
|
|
1174
|
+
let e = "";
|
|
1175
|
+
for (let o = 0; o < n.groupBy.length; o++) {
|
|
1176
|
+
let f = n.groupBy[o], m = a[f], h = n.groups[f][m];
|
|
1177
|
+
if (e += m, d.indexOf(e) === -1) {
|
|
1178
|
+
let a = t.indexOf(h);
|
|
1179
|
+
l += n.generateGroupRow({
|
|
1180
|
+
rowNumber: c,
|
|
1181
|
+
outlineLevel: p,
|
|
1182
|
+
numberOfColumns: r,
|
|
1183
|
+
sharedStringIndex: a,
|
|
1184
|
+
mergedCells: s
|
|
1185
|
+
}), d.push(e), i--, u++;
|
|
1186
|
+
continue e;
|
|
1187
|
+
}
|
|
1188
|
+
p++;
|
|
1189
|
+
}
|
|
1190
|
+
m = ` outlineLevel="${p}"`;
|
|
1191
|
+
}
|
|
1192
|
+
let h = ` <row r="${c}"${m} spans="1:${r}"${n.getCustomRowHeight(c - 1)} customHeight="1" x14ac:dyDescent="0.45">\n`;
|
|
1193
|
+
for (let e = 0; e < o.length; e++) {
|
|
1194
|
+
let r = n.getXLSXCellStyle(f(e, i + 1));
|
|
1195
|
+
h += n.getActualCellData(a[o[e]], {
|
|
1196
|
+
r: f(e, c),
|
|
1197
|
+
s: r
|
|
1198
|
+
}, t, c, o[e]);
|
|
1199
|
+
}
|
|
1200
|
+
h += " </row>\n", l += h;
|
|
1201
|
+
}
|
|
1202
|
+
return l += ` </sheetData>${n.exportAsTable ? "" : n.getMergedCells(s)}\n <pageMargins left="0.7" right="0.7" top="0.75" bottom="0.75" header="0.3" footer="0.3" />\n <pageSetup paperSize="9" orientation="portrait" r:id="rId1" />\n ${((e) => {
|
|
1203
|
+
let t = "", n = this.worksheetImages.get(e);
|
|
1204
|
+
return n && n.length && (t += `<drawing r:id="rId${++c}"/>`), t;
|
|
1205
|
+
})(1)}\n ${n.exportAsTable ? `<tableParts count="1">\n <tablePart r:id="rId${++c}"/>\n </tableParts>` : ""}\n</worksheet>`, n.groupDimensionEnd = n.columnsArray[r - 1] + (i + u), n.groupRowsCount = i + u, l;
|
|
1206
|
+
}
|
|
1207
|
+
isFormula(e) {
|
|
1208
|
+
return e !== null && this.autoConvertFormulas && e.toString().startsWith("=");
|
|
1209
|
+
}
|
|
1210
|
+
getActualCellData(e, t, n) {
|
|
1211
|
+
let r = t.r, i = t.s || " s=\"0\"";
|
|
1212
|
+
return e !== null || this.allowNull || (e = ""), e && this.isFormula(e) ? ` <c r="${r}" t="s"${i}>\n <f>${e.slice(1)}</f>\n </c>\n` : typeof e == "string" ? ` <c r="${r}" t="s"${i}>\n <v>${n.indexOf(e)}</v>\n </c>\n` : typeof e == "boolean" ? ` <c r="${r}" t="b"${i}>\n <v>${+e}</v>\n </c>\n` : e instanceof Date ? ` <c r="${r}"${i}>\n <v>${2 + Math.round(this.timeBetween1900And1970 / 864e5) + (e.getTime() - 60 * e.getTimezoneOffset() * 1e3) / 864e5}</v>\n </c>\n` : ` <c r="${r}"${i}>\n <v>${e}</v>\n </c>\n`;
|
|
1213
|
+
}
|
|
1214
|
+
getColumnsArray() {
|
|
1215
|
+
let e = this.datafields.length, t = [];
|
|
1216
|
+
function n(e) {
|
|
1217
|
+
return e < 26 ? "" : String.fromCharCode(64 + Math.floor(e / 26));
|
|
1218
|
+
}
|
|
1219
|
+
for (let r = 0; r < e; r++) t.push(n(r) + String.fromCharCode(65 + (r < 26 ? r : r % 26)));
|
|
1220
|
+
this.columnsArray = t;
|
|
1221
|
+
}
|
|
1222
|
+
getColumnsArrayFromDataFields(e) {
|
|
1223
|
+
let t = e.length, n = [];
|
|
1224
|
+
function r(e) {
|
|
1225
|
+
return e < 26 ? "" : String.fromCharCode(64 + Math.floor(e / 26));
|
|
1226
|
+
}
|
|
1227
|
+
for (let e = 0; e < t; e++) n.push(r(e) + String.fromCharCode(65 + (e < 26 ? e : e % 26)));
|
|
1228
|
+
return n;
|
|
1229
|
+
}
|
|
1230
|
+
getColumnStyle() {
|
|
1231
|
+
let e = this, t = e.style;
|
|
1232
|
+
if (!t) return " .header { border: 1px solid black; padding: 5px; }\n .column { border: 1px solid black; padding: 5px; }\n .group { background-color: #FFFFFF; color: #000000; font-weight: bold; }";
|
|
1233
|
+
let n;
|
|
1234
|
+
n = t.removeDefault ? {
|
|
1235
|
+
header: "",
|
|
1236
|
+
column: "",
|
|
1237
|
+
group: ""
|
|
1238
|
+
} : {
|
|
1239
|
+
header: "border: 1px solid black; padding: 5px; ",
|
|
1240
|
+
column: "overflow: hidden; border: 1px solid black; padding: 5px; ",
|
|
1241
|
+
group: "background-color: #FFFFFF; color: #000000; font-weight: bold; "
|
|
1242
|
+
};
|
|
1243
|
+
let r = e.data[0], i = "", a = t.header || {};
|
|
1244
|
+
for (let t in a) {
|
|
1245
|
+
if (!Object.prototype.hasOwnProperty.call(a, t)) continue;
|
|
1246
|
+
let i = a[t];
|
|
1247
|
+
if (r[t]) {
|
|
1248
|
+
n["header" + t] || (n["header" + t] = "");
|
|
1249
|
+
for (let e in i) if (Object.prototype.hasOwnProperty.call(i, e)) {
|
|
1250
|
+
let r = Smart.Utilities.Core.toDash(e) + ": " + i[e] + "; ";
|
|
1251
|
+
n["header" + t] += r, e === "width" && (n["column" + t] || (n["column" + t] = ""), n["column" + t] += r);
|
|
1252
|
+
}
|
|
1253
|
+
} else t === "height" && e.complexHeader ? n.header += "height: " + parseInt(a[t], 10) / e.complexHeader.length + "px; " : n.header += Smart.Utilities.Core.toDash(t) + ": " + a[t] + "; ";
|
|
1254
|
+
}
|
|
1255
|
+
let o = t.columns || {};
|
|
1256
|
+
for (let e in o) {
|
|
1257
|
+
if (!Object.prototype.hasOwnProperty.call(o, e)) continue;
|
|
1258
|
+
let t = o[e];
|
|
1259
|
+
if (r[e]) {
|
|
1260
|
+
n["column" + e] || (n["column" + e] = "");
|
|
1261
|
+
for (let r in t) isNaN(r) && Object.prototype.hasOwnProperty.call(t, r) && r !== "format" && (n["column" + e] += Smart.Utilities.Core.toDash(r) + ": " + t[r] + "; ");
|
|
1262
|
+
} else n.column += Smart.Utilities.Core.toDash(e) + ": " + t + "; ";
|
|
1263
|
+
}
|
|
1264
|
+
for (let e in n) Object.prototype.hasOwnProperty.call(n, e) && (i += ` .${e} { ${n[e]}}\n`);
|
|
1265
|
+
return t.custom && (i += `${t.custom}\n`), i;
|
|
1266
|
+
}
|
|
1267
|
+
getCustomColumnWidths(e) {
|
|
1268
|
+
let t = this;
|
|
1269
|
+
if (e !== t.columnsArray || !t.style || !t.columnWidth || t.columnWidth.length === 0) return "";
|
|
1270
|
+
let n = "\n <cols>\n";
|
|
1271
|
+
for (let e = 0; e < t.columnWidth.length; e++) {
|
|
1272
|
+
let r = t.columnWidth[e];
|
|
1273
|
+
r !== void 0 && (r = Math.round(parseFloat(r)) / 7, n += ` <col min="${e + 1}" max="${e + 1}" width="${r}" customWidth="1" />\n`);
|
|
1274
|
+
}
|
|
1275
|
+
return n += " </cols>", n;
|
|
1276
|
+
}
|
|
1277
|
+
getCustomFilter(e, t) {
|
|
1278
|
+
let n, r = "equal";
|
|
1279
|
+
switch (e instanceof Date && (e = (e.getTime() + this.timeBetween1900And1970) / 864e5 + 2), t = t.toUpperCase()) {
|
|
1280
|
+
case "EMPTY":
|
|
1281
|
+
n = "";
|
|
1282
|
+
break;
|
|
1283
|
+
case "NOT_EMPTY":
|
|
1284
|
+
n = "", r = "notEqual";
|
|
1285
|
+
break;
|
|
1286
|
+
case "CONTAINS":
|
|
1287
|
+
case "CONTAINS_CASE_SENSITIVE":
|
|
1288
|
+
n = `*${e}*`;
|
|
1289
|
+
break;
|
|
1290
|
+
case "DOES_NOT_CONTAIN":
|
|
1291
|
+
case "DOES_NOT_CONTAIN_CASE_SENSITIVE":
|
|
1292
|
+
n = `*${e}*`, r = "notEqual";
|
|
1293
|
+
break;
|
|
1294
|
+
case "STARTS_WITH":
|
|
1295
|
+
case "STARTS_WITH_CASE_SENSITIVE":
|
|
1296
|
+
n = `${e}*`;
|
|
1297
|
+
break;
|
|
1298
|
+
case "ENDS_WITH":
|
|
1299
|
+
case "ENDS_WITH_CASE_SENSITIVE":
|
|
1300
|
+
n = `*${e}`;
|
|
1301
|
+
break;
|
|
1302
|
+
case "EQUAL":
|
|
1303
|
+
case "EQUAL_CASE_SENSITIVE":
|
|
1304
|
+
n = e;
|
|
1305
|
+
break;
|
|
1306
|
+
case "NULL":
|
|
1307
|
+
n = null;
|
|
1308
|
+
break;
|
|
1309
|
+
case "NOT_NULL":
|
|
1310
|
+
n = null, r = "notEqual";
|
|
1311
|
+
break;
|
|
1312
|
+
case "NOT_EQUAL":
|
|
1313
|
+
n = e, r = "notEqual";
|
|
1314
|
+
break;
|
|
1315
|
+
case "LESS_THAN":
|
|
1316
|
+
n = e, r = "lessThan";
|
|
1317
|
+
break;
|
|
1318
|
+
case "LESS_THAN_OR_EQUAL":
|
|
1319
|
+
n = e, r = "lessThanOrEqual";
|
|
1320
|
+
break;
|
|
1321
|
+
case "GREATER_THAN":
|
|
1322
|
+
n = e, r = "greaterThan";
|
|
1323
|
+
break;
|
|
1324
|
+
case "GREATER_THAN_OR_EQUAL": n = e, r = "greaterThanOrEqual";
|
|
1325
|
+
}
|
|
1326
|
+
return ` <customFilter val="${n}" operator="${r}"/>\n`;
|
|
1327
|
+
}
|
|
1328
|
+
getCustomRowHeight(e) {
|
|
1329
|
+
let t = this;
|
|
1330
|
+
return t.style && (t.rowHeight[e] || t.defaultRowHeight) || "";
|
|
1331
|
+
}
|
|
1332
|
+
getDatafields(e) {
|
|
1333
|
+
let t = e[0], n = [];
|
|
1334
|
+
for (let e in t) Object.prototype.hasOwnProperty.call(t, e) && e.charAt(0) !== "_" && n.push(e);
|
|
1335
|
+
this.datafields = n;
|
|
1336
|
+
}
|
|
1337
|
+
getFilters() {
|
|
1338
|
+
let e = this, t = e.filterBy;
|
|
1339
|
+
if (!t) return "";
|
|
1340
|
+
let n = "";
|
|
1341
|
+
for (let r in t) if (Object.prototype.hasOwnProperty.call(t, r)) {
|
|
1342
|
+
let i = e.datafields.indexOf(r);
|
|
1343
|
+
if (i === -1) continue;
|
|
1344
|
+
let a = t[r], o = a.filters;
|
|
1345
|
+
n += ` <filterColumn colId="${i}">\n <customFilters and="${!a.operator}">\n`;
|
|
1346
|
+
for (let t = 0; t < o.length; t++) n += e.getCustomFilter(o[t].value, o[t].condition);
|
|
1347
|
+
n += " </customFilters>\n </filterColumn>";
|
|
1348
|
+
}
|
|
1349
|
+
return n ? (n = `\n <autoFilter ref="A1:${e.columnsArray[e.columnsArray.length - 1] + e.data.length}">\n${n}\n </autoFilter>`, n) : "";
|
|
1350
|
+
}
|
|
1351
|
+
getGroupLabels(e) {
|
|
1352
|
+
let t = this, n = t.xlsxStartIndex === void 0 ? +t.exportHeader : t.xlsxStartIndex, r = {}, i = [];
|
|
1353
|
+
for (let a = n; a < e.length; a++) {
|
|
1354
|
+
let o = e[a];
|
|
1355
|
+
for (let a = 0; a < t.groupBy.length; a++) {
|
|
1356
|
+
let s = t.groupBy[a], c = o[s], l = r[s];
|
|
1357
|
+
l === void 0 && (r[s] = {}, l = r[s]), l[c] === void 0 && (l[c] = (t.exportHeader ? e[n - 1][s] : s) + ": " + c, i.push(l[c]));
|
|
1358
|
+
}
|
|
1359
|
+
}
|
|
1360
|
+
t.groups = r, t.groupLabels = i;
|
|
1361
|
+
}
|
|
1362
|
+
getHTMLHeader(e, t) {
|
|
1363
|
+
let n = this, r = "\n <thead>\n";
|
|
1364
|
+
if (!n.complexHeader) {
|
|
1365
|
+
r += " <tr>\n";
|
|
1366
|
+
for (let n = 0; n < e.length; n++) {
|
|
1367
|
+
let i = e[n];
|
|
1368
|
+
r += ` <th class="header header${i}">${t[0][i]}</th>\n`;
|
|
1369
|
+
}
|
|
1370
|
+
return r += " </tr>\n </thead>", r;
|
|
1371
|
+
}
|
|
1372
|
+
for (let t = 0; t < n.complexDataFieldsHeader.length; t++) {
|
|
1373
|
+
let i = n.complexDataFieldsHeader[t];
|
|
1374
|
+
r += " <tr>\n";
|
|
1375
|
+
for (let a = 0; a < i.length; a++) {
|
|
1376
|
+
let o = i[a], s = 1, c = 1;
|
|
1377
|
+
if (i[a - 1] && i[a - 1] === o || n.complexDataFieldsHeader[t - 1] && n.complexDataFieldsHeader[t - 1][a] === o) continue;
|
|
1378
|
+
let l = a + 1;
|
|
1379
|
+
for (; i[l] && i[l] === i[l - 1];) s++, l++;
|
|
1380
|
+
for (l = t + 1; n.complexDataFieldsHeader[l] && n.complexDataFieldsHeader[l][a] === o;) c++, l++;
|
|
1381
|
+
r += ` <th class="header${t === n.complexHeader.length - 1 || c + t === n.complexHeader.length ? " header" + e[a] : ""}" colspan="${s}" rowspan="${c}">${n.complexHeader[t][a]}</th>\n`;
|
|
1382
|
+
}
|
|
1383
|
+
r += " </tr>\n";
|
|
1384
|
+
}
|
|
1385
|
+
return r += " </thead>", r;
|
|
1386
|
+
}
|
|
1387
|
+
getConditionalFormatting() {
|
|
1388
|
+
let e = this, t = e.conditionalFormatting;
|
|
1389
|
+
if (!t) return void (e.conditionalFormattingXLSX = {
|
|
1390
|
+
conditions: "",
|
|
1391
|
+
styles: ""
|
|
1392
|
+
});
|
|
1393
|
+
let n = [], r = "", i = "";
|
|
1394
|
+
for (let a = t.length - 1; a >= 0; a--) {
|
|
1395
|
+
let o = t[a], s = e.columnsArray[e.datafields.indexOf(o.column)], c = s + (e.xlsxStartIndex + 1), l = c + ":" + s + e.data.length, u = o.background + o.color, d = e.getConditionalAttributes(o, c), f = n.indexOf(u);
|
|
1396
|
+
f === -1 && (i += ` <dxf>\n <font>\n <b val="0"/>\n <i val="0"/>\n <color rgb="${o.color === "White" ? "FFFFFFFF" : "FF000000"}"/>\n <sz val="10"/>\n </font>\n <fill>\n <patternFill>\n <bgColor rgb="${e.toARGB(o.background)}"/>\n </patternFill>\n </fill>\n </dxf>\n`, f = n.length, n.push(u)), r += ` <conditionalFormatting sqref="${l}">\n <cfRule dxfId="${f}" text="${d.text}" rank="${d.rank}" percent="${d.percent}" bottom="${d.bottom}" equalAverage="${d.equalAverage}" aboveAverage="${d.aboveAverage}"${d.operator}${d.timePeriod} priority="${a + 2}" type="${d.type}">\n${d.formula} </cfRule>\n </conditionalFormatting>\n`;
|
|
1397
|
+
}
|
|
1398
|
+
i = ` <dxfs count="${n.length}">\n${i} </dxfs>`, e.conditionalFormattingXLSX = {
|
|
1399
|
+
conditions: r,
|
|
1400
|
+
styles: i
|
|
1401
|
+
};
|
|
1402
|
+
}
|
|
1403
|
+
getConditionalAttributes(e, t) {
|
|
1404
|
+
let n = e.condition, r = e.comparator, i = "", a = 0, o = 0, s = 0, c = 0, l = "", u = "", d = "", f = "";
|
|
1405
|
+
switch (n) {
|
|
1406
|
+
case "equal":
|
|
1407
|
+
l = "equal", d = "cellIs", f = ` <formula>${r}</formula>\n`;
|
|
1408
|
+
break;
|
|
1409
|
+
case "lessThan":
|
|
1410
|
+
l = "lessThan", d = "cellIs", f = ` <formula>${r}</formula>\n`;
|
|
1411
|
+
break;
|
|
1412
|
+
case "greaterThan":
|
|
1413
|
+
l = "greaterThan", d = "cellIs", f = ` <formula>${r}</formula>\n`;
|
|
1414
|
+
break;
|
|
1415
|
+
case "notEqual":
|
|
1416
|
+
l = "notEqual", d = "cellIs", f = ` <formula>${r}</formula>\n`;
|
|
1417
|
+
break;
|
|
1418
|
+
case "between":
|
|
1419
|
+
l = "between", d = "cellIs", f = ` <formula>${e.min}</formula>\n <formula>${e.max}</formula>\n`;
|
|
1420
|
+
break;
|
|
1421
|
+
case "duplicate":
|
|
1422
|
+
d = "duplicateValues", f = " <formula>0</formula>\n";
|
|
1423
|
+
break;
|
|
1424
|
+
case "topNItems":
|
|
1425
|
+
a = r, d = "top10";
|
|
1426
|
+
break;
|
|
1427
|
+
case "bottomNItems":
|
|
1428
|
+
a = r, s = 1, d = "top10";
|
|
1429
|
+
break;
|
|
1430
|
+
case "topNPercent":
|
|
1431
|
+
a = r, o = 1, d = "top10";
|
|
1432
|
+
break;
|
|
1433
|
+
case "bottomNPercent":
|
|
1434
|
+
a = r, o = 1, s = 1, d = "top10";
|
|
1435
|
+
break;
|
|
1436
|
+
case "aboveAverage":
|
|
1437
|
+
c = 1, d = "aboveAverage", f = " <formula>0</formula>\n";
|
|
1438
|
+
break;
|
|
1439
|
+
case "belowAverage":
|
|
1440
|
+
d = "aboveAverage", f = " <formula>0</formula>\n";
|
|
1441
|
+
break;
|
|
1442
|
+
case "contains":
|
|
1443
|
+
i = r, l = "containsText", d = "containsText", f = ` <formula>NOT(ISERROR(SEARCH("${r}",${t})))</formula>\n`;
|
|
1444
|
+
break;
|
|
1445
|
+
case "doesNotContain":
|
|
1446
|
+
i = r, l = "notContains", d = "notContainsText", f = ` <formula>ISERROR(SEARCH("${r}",${t}))</formula>\n`;
|
|
1447
|
+
break;
|
|
1448
|
+
case "dateOccur": u = ` timePeriod="${r}"`, d = "timePeriod";
|
|
1449
|
+
}
|
|
1450
|
+
return l &&= ` operator="${l}" `, {
|
|
1451
|
+
text: i,
|
|
1452
|
+
rank: a,
|
|
1453
|
+
percent: o,
|
|
1454
|
+
bottom: s,
|
|
1455
|
+
equalAverage: 0,
|
|
1456
|
+
aboveAverage: c,
|
|
1457
|
+
operator: l,
|
|
1458
|
+
timePeriod: u,
|
|
1459
|
+
type: d,
|
|
1460
|
+
formula: f
|
|
1461
|
+
};
|
|
1462
|
+
}
|
|
1463
|
+
getMergedCells(e) {
|
|
1464
|
+
let t = this, n = "";
|
|
1465
|
+
for (let t = 0; t < e.length; t++) e[t].from !== e[t].to && (n += `\n <mergeCell ref="${e[t].from}:${e[t].to}" />\n`);
|
|
1466
|
+
if (t.mergedCells) for (let e = 0; e < t.mergedCells.length; e++) {
|
|
1467
|
+
let r = t.mergedCells[e];
|
|
1468
|
+
r.rowspan < 2 && r.colspan < 2 || (n += `\n <mergeCell ref="${t.columnsArray[r.cell[0]] + (r.cell[1] + t.xlsxStartIndex + 1)}:${t.columnsArray[r.cell[0] + r.colspan - 1] + (r.cell[1] + t.xlsxStartIndex + r.rowspan)}" />\n`);
|
|
1469
|
+
}
|
|
1470
|
+
return n &&= `\n <mergeCells count="${e.length}">${n} </mergeCells>`, n;
|
|
1471
|
+
}
|
|
1472
|
+
getNumFmtIndex(e, t) {
|
|
1473
|
+
let n = t.collection.indexOf(e);
|
|
1474
|
+
return n === -1 ? (n = t.collection.length + 100, t.collection.push(e), t.xml += `<numFmt numFmtId="${n}" formatCode="${e}"/>`) : n += 100, n;
|
|
1475
|
+
}
|
|
1476
|
+
getOutlineLevel(e) {
|
|
1477
|
+
return this.actualHierarchy && e._level !== 1 ? ` outlineLevel="${e._level - 1}"` : "";
|
|
1478
|
+
}
|
|
1479
|
+
getRowStyle() {
|
|
1480
|
+
let e = this.style;
|
|
1481
|
+
if (!e) return "";
|
|
1482
|
+
let t = e.rows;
|
|
1483
|
+
if (!t) return "";
|
|
1484
|
+
let n = { row: "" }, r = "";
|
|
1485
|
+
for (let e in t) {
|
|
1486
|
+
if (!Object.prototype.hasOwnProperty.call(t, e) || e === "alternationCount" || e === "alternationStart" || e === "alternationEnd") continue;
|
|
1487
|
+
let r = t[e];
|
|
1488
|
+
if (e.indexOf("alt") === -1) if (isNaN(e)) n.row += Smart.Utilities.Core.toDash(e) + ": " + t[e] + "; ";
|
|
1489
|
+
else {
|
|
1490
|
+
n["row" + e] || (n["row" + e] = "");
|
|
1491
|
+
for (let t in r) Object.prototype.hasOwnProperty.call(r, t) && (n["row" + e] += Smart.Utilities.Core.toDash(t) + ": " + r[t] + "; ");
|
|
1492
|
+
}
|
|
1493
|
+
else {
|
|
1494
|
+
let t = e.slice(16, 17), i = e.slice(17);
|
|
1495
|
+
n["rowN" + t] || (n["rowN" + t] = ""), n["rowN" + t] += i === "Color" ? "color : " + r + "; " : i === "BorderColor" ? "border-color : " + r + "; " : "background-color : " + r + "; ";
|
|
1496
|
+
}
|
|
1497
|
+
}
|
|
1498
|
+
let i = Object.keys(n);
|
|
1499
|
+
i.sort((function(e, t) {
|
|
1500
|
+
if (e === "row") return -1;
|
|
1501
|
+
if (t === "row") return 1;
|
|
1502
|
+
let n = !isNaN(e.slice(3)), r = !isNaN(t.slice(3));
|
|
1503
|
+
return n && !r ? 1 : !n && r ? -1 : +(e < t);
|
|
1504
|
+
}));
|
|
1505
|
+
for (let e = 0; e < i.length; e++) r += ` .${i[e]} { ${n[i[e]]}}\n`;
|
|
1506
|
+
return r;
|
|
1507
|
+
}
|
|
1508
|
+
getTableStyle() {
|
|
1509
|
+
let e = this.style;
|
|
1510
|
+
if (!e) return " style=\"table-layout: fixed; border: 1px solid black; border-collapse: collapse;\"";
|
|
1511
|
+
let t = "table-layout: fixed; ";
|
|
1512
|
+
for (let n in e) Object.prototype.hasOwnProperty.call(e, n) && [
|
|
1513
|
+
"header",
|
|
1514
|
+
"columns",
|
|
1515
|
+
"rows",
|
|
1516
|
+
"removeDefault",
|
|
1517
|
+
"custom"
|
|
1518
|
+
].indexOf(n) === -1 && (t += Smart.Utilities.Core.toDash(n) + ": " + e[n] + "; ");
|
|
1519
|
+
return t &&= " style=\"" + t + "\"", t;
|
|
1520
|
+
}
|
|
1521
|
+
getXLSXCellStyle(e) {
|
|
1522
|
+
let t = this;
|
|
1523
|
+
return t.cellStyleMapping[e] === void 0 ? "" : ` s="${t.cellStyleMapping[e]}"`;
|
|
1524
|
+
}
|
|
1525
|
+
getXLSXFormat(e, t) {
|
|
1526
|
+
if (typeof t == "number") {
|
|
1527
|
+
let t = "$";
|
|
1528
|
+
if (e && typeof e == "string" && e.indexOf("c") >= 0 && e.indexOf("x") >= 0 && (t = e.substring(0, e.indexOf("x")), e = e.substring(1 + e.indexOf("x"))), !/^([a-zA-Z]\d*)$/g.test(e)) return e;
|
|
1529
|
+
let n = parseFloat(e.slice(1)) || 0, r = n > 0 ? "." + "0".repeat(n) : "";
|
|
1530
|
+
switch (e = e.slice(0, 1)) {
|
|
1531
|
+
case "C":
|
|
1532
|
+
case "c": return t === "$" ? t + "#,0" + r : "#,0" + r + " " + t;
|
|
1533
|
+
case "D":
|
|
1534
|
+
case "d": return n ? "#,0" + r : "0";
|
|
1535
|
+
case "E":
|
|
1536
|
+
case "e": return "0" + r + e + "000";
|
|
1537
|
+
case "F":
|
|
1538
|
+
case "f": return "0" + r;
|
|
1539
|
+
case "N":
|
|
1540
|
+
case "n": return "#,0" + r;
|
|
1541
|
+
case "P":
|
|
1542
|
+
case "p": return "#,0" + r + " %";
|
|
1543
|
+
default: return;
|
|
1544
|
+
}
|
|
1545
|
+
} else if (t instanceof Date) {
|
|
1546
|
+
switch (e) {
|
|
1547
|
+
case "d": return "m/d/yyyy";
|
|
1548
|
+
case "D": return "nnnnmmmm dd, yyyy";
|
|
1549
|
+
case "t": return "h:m AM/PM";
|
|
1550
|
+
case "T": return "h:mm:ss AM/PM";
|
|
1551
|
+
case "f": return "nnnnmmmm dd, yyyy h:m AM/PM";
|
|
1552
|
+
case "F": return "nnnnmmmm dd, yyyy h:mm:ss AM/PM";
|
|
1553
|
+
case "M": return "mmmm d";
|
|
1554
|
+
case "Y": return "yyyy mmmm";
|
|
1555
|
+
case "FP":
|
|
1556
|
+
case "PP": return "yyyy-mm-dd hh:mm:ss";
|
|
1557
|
+
case "FT":
|
|
1558
|
+
case "PT": return "hh:mm:ss";
|
|
1559
|
+
}
|
|
1560
|
+
return e = (e = (e = (e = e.replace(/f|u|n|p|e|a|x|o/gi, "")).replace(/tt/gi, "AM/PM")).replace(/:{2,}|:\s|:$|\.$/g, "")).trim();
|
|
1561
|
+
}
|
|
1562
|
+
}
|
|
1563
|
+
processColumnStyle(e) {
|
|
1564
|
+
let t = this, n = e.header, r = e.columns, i = t.data[0], a = t.xlsxStartIndex;
|
|
1565
|
+
if (t.columnWidth = [], a && n) for (let e = 0; e < t.columnsArray.length; e++) {
|
|
1566
|
+
let r = t.columnsArray[e], o = r + a, s = n[t.datafields[e]];
|
|
1567
|
+
for (let e in n) if (Object.prototype.hasOwnProperty.call(n, e) && i[e] === void 0) if (t.complexHeader) for (let i = 0; i < t.complexHeader.length; i++) e === "height" ? t.rowHeight[i] = ` ht="${parseFloat(n.height) / t.complexHeader.length / 2}"` : t.storeCellStyle(r + (i + 1), e, n[e]);
|
|
1568
|
+
else {
|
|
1569
|
+
if (e === "height") {
|
|
1570
|
+
t.rowHeight[a - 1] = ` ht="${parseFloat(n.height) / 2}"`;
|
|
1571
|
+
continue;
|
|
1572
|
+
}
|
|
1573
|
+
t.storeCellStyle(o, e, n[e]);
|
|
1574
|
+
}
|
|
1575
|
+
if (s) {
|
|
1576
|
+
for (let n in s) if (Object.prototype.hasOwnProperty.call(s, n)) {
|
|
1577
|
+
if (n === "width") {
|
|
1578
|
+
t.columnWidth[e] = s.width;
|
|
1579
|
+
continue;
|
|
1580
|
+
}
|
|
1581
|
+
t.storeCellStyle(o, n, s[n]);
|
|
1582
|
+
}
|
|
1583
|
+
}
|
|
1584
|
+
}
|
|
1585
|
+
else if (n) for (let e = 0; e < t.columnsArray.length; e++) {
|
|
1586
|
+
let r = n[t.datafields[e]];
|
|
1587
|
+
r && r.width !== void 0 && (t.columnWidth[e] = r.width);
|
|
1588
|
+
}
|
|
1589
|
+
if (!r) return "";
|
|
1590
|
+
for (let e = a; e < t.data.length; e++) for (let n = 0; n < t.columnsArray.length; n++) {
|
|
1591
|
+
let a = t.columnsArray[n] + (e + 1), o = t.datafields[n], s = r[o];
|
|
1592
|
+
for (let e in r) Object.prototype.hasOwnProperty.call(r, e) && i[e] === void 0 && t.storeCellStyle(a, e, r[e]);
|
|
1593
|
+
if (s) {
|
|
1594
|
+
for (let n in s) isNaN(n) && Object.prototype.hasOwnProperty.call(s, n) && t.storeCellStyle(a, n, s[n], t.data[e][o]);
|
|
1595
|
+
if (s[e]) {
|
|
1596
|
+
let n = s[e];
|
|
1597
|
+
for (let r in n) isNaN(r) && Object.prototype.hasOwnProperty.call(n, r) && n[r] && t.storeCellStyle(a, r, n[r], t.data[e][o]);
|
|
1598
|
+
}
|
|
1599
|
+
}
|
|
1600
|
+
}
|
|
1601
|
+
if (t.headerContent && t.headerContent.length) for (let e = 0; e < t.headerContent.length; e++) {
|
|
1602
|
+
let n = (e, n, r) => {
|
|
1603
|
+
for (let i = 0; i < t.columnsArray.length; i++) {
|
|
1604
|
+
let a = t.columnsArray[i] + e;
|
|
1605
|
+
t.storeCellStyle(a, n, r);
|
|
1606
|
+
}
|
|
1607
|
+
}, r = e + 1;
|
|
1608
|
+
if (t.headerContent[e].style) {
|
|
1609
|
+
let i = t.headerContent[e].style, a = [
|
|
1610
|
+
"0",
|
|
1611
|
+
"1",
|
|
1612
|
+
"2",
|
|
1613
|
+
"3",
|
|
1614
|
+
"4",
|
|
1615
|
+
"5",
|
|
1616
|
+
"6",
|
|
1617
|
+
"7",
|
|
1618
|
+
"8",
|
|
1619
|
+
"9",
|
|
1620
|
+
"a",
|
|
1621
|
+
"b",
|
|
1622
|
+
"c",
|
|
1623
|
+
"d",
|
|
1624
|
+
"e",
|
|
1625
|
+
"f"
|
|
1626
|
+
], o = (e) => isNaN(e) ? "00" : a[(e - e % 16) / 16] + a[e % 16], s = (e) => e.startsWith("#") ? e.toUpperCase() : (e = e.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/)) ? "#" + o(e[1]) + o(e[2]) + o(e[3]).toUpperCase() : null;
|
|
1627
|
+
for (let e in i) {
|
|
1628
|
+
let a = i[e];
|
|
1629
|
+
e === "height" ? t.rowHeight[r - 1] = ` ht="${parseFloat(a)}"` : (e !== "color" && e !== "backgroundColor" || (a = s(a)), n(r, e, a));
|
|
1630
|
+
}
|
|
1631
|
+
}
|
|
1632
|
+
}
|
|
1633
|
+
if (t.footerContent && t.footerContent.length) for (let e = 0; e < t.footerContent.length; e++) {
|
|
1634
|
+
let n = (e, n, r) => {
|
|
1635
|
+
for (let i = 0; i < t.columnsArray.length; i++) {
|
|
1636
|
+
let a = t.columnsArray[i] + e;
|
|
1637
|
+
t.storeCellStyle(a, n, r);
|
|
1638
|
+
}
|
|
1639
|
+
}, r = t.headerContent && t.headerContent.length ? t.headerContent.length : 0, i = 1 + t.data.length + e + r;
|
|
1640
|
+
if (t.footerContent[e].style) {
|
|
1641
|
+
let r = t.footerContent[e].style, a = [
|
|
1642
|
+
"0",
|
|
1643
|
+
"1",
|
|
1644
|
+
"2",
|
|
1645
|
+
"3",
|
|
1646
|
+
"4",
|
|
1647
|
+
"5",
|
|
1648
|
+
"6",
|
|
1649
|
+
"7",
|
|
1650
|
+
"8",
|
|
1651
|
+
"9",
|
|
1652
|
+
"a",
|
|
1653
|
+
"b",
|
|
1654
|
+
"c",
|
|
1655
|
+
"d",
|
|
1656
|
+
"e",
|
|
1657
|
+
"f"
|
|
1658
|
+
], o = (e) => isNaN(e) ? "00" : a[(e - e % 16) / 16] + a[e % 16], s = (e) => e.startsWith("#") ? e.toUpperCase() : (e = e.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/)) ? "#" + o(e[1]) + o(e[2]) + o(e[3]).toUpperCase() : null;
|
|
1659
|
+
for (let e in r) {
|
|
1660
|
+
let a = r[e];
|
|
1661
|
+
e === "height" ? t.rowHeight[i - 1] = ` ht="${parseFloat(a)}"` : (e !== "color" && e !== "backgroundColor" || (a = s(a)), n(i, e, a));
|
|
1662
|
+
}
|
|
1663
|
+
}
|
|
1664
|
+
}
|
|
1665
|
+
}
|
|
1666
|
+
processComplexHeader(e, t, n) {
|
|
1667
|
+
let r = this, i = {}, a = [
|
|
1668
|
+
"html",
|
|
1669
|
+
"jpeg",
|
|
1670
|
+
"pdf",
|
|
1671
|
+
"png",
|
|
1672
|
+
"xlsx"
|
|
1673
|
+
].indexOf(n) !== -1 && e.columngroups, o = [], s = {}, c = {}, l = [], u = [], d = 0;
|
|
1674
|
+
function f(t) {
|
|
1675
|
+
for (let n = 0; n < e.columngroups.length; n++) {
|
|
1676
|
+
let r = e.columngroups[n];
|
|
1677
|
+
if (r.name === t) return r;
|
|
1678
|
+
}
|
|
1679
|
+
}
|
|
1680
|
+
function p(e, t) {
|
|
1681
|
+
let n = [];
|
|
1682
|
+
for (; e;) {
|
|
1683
|
+
if (n.unshift(e[t]), !e.parentGroup) return n;
|
|
1684
|
+
e = f(e.parentGroup);
|
|
1685
|
+
}
|
|
1686
|
+
}
|
|
1687
|
+
if (a) {
|
|
1688
|
+
for (let t = 0; t < e.columngroups.length; t++) {
|
|
1689
|
+
let n = e.columngroups[t], r = p(n, "label");
|
|
1690
|
+
s[n.name] = r, c[n.name] = p(n, "name"), d = Math.max(d, r.length);
|
|
1691
|
+
}
|
|
1692
|
+
d++;
|
|
1693
|
+
for (let e = 0; e < d; e++) l[e] = [], u[e] = [];
|
|
1694
|
+
}
|
|
1695
|
+
for (let t = 0; t < e.columns.length; t++) {
|
|
1696
|
+
let n = e.columns[t];
|
|
1697
|
+
if (i[n.dataField] = n.label, !a || (o[t] = n.dataField, l[d - 1][t] = n.label, u[d - 1][t] = n.dataField, !n.columnGroup)) continue;
|
|
1698
|
+
let r = s[n.columnGroup], f = c[n.columnGroup];
|
|
1699
|
+
if (r) for (let e = 0; e < r.length; e++) l[e][t] = r[e], u[e][t] = f[e];
|
|
1700
|
+
}
|
|
1701
|
+
if (l.length > 1) {
|
|
1702
|
+
let e = Object.keys(i).length;
|
|
1703
|
+
for (let r = 0; r < d - 1; r++) {
|
|
1704
|
+
let i = {};
|
|
1705
|
+
for (let t = 0; t < e; t++) {
|
|
1706
|
+
if (l[r][t] === void 0) {
|
|
1707
|
+
let e = r + 1;
|
|
1708
|
+
for (; l[e][t] === void 0;) e++;
|
|
1709
|
+
l[r][t] = l[e][t], u[r][t] = u[e][t];
|
|
1710
|
+
}
|
|
1711
|
+
i[o[t]] = l[r][t];
|
|
1712
|
+
}
|
|
1713
|
+
n === "xlsx" && t.splice(r, 0, i);
|
|
1714
|
+
}
|
|
1715
|
+
if (r.complexHeader = l, r.complexDataFieldsHeader = u, n !== "xlsx") t.unshift(i);
|
|
1716
|
+
else {
|
|
1717
|
+
t.splice(d - 1, 0, i);
|
|
1718
|
+
let n = {};
|
|
1719
|
+
for (let t = 0; t < d; t++) for (let r = 0; r < e; r++) {
|
|
1720
|
+
let e = u[t][r];
|
|
1721
|
+
if (n[e]) {
|
|
1722
|
+
let i = n[e].to;
|
|
1723
|
+
if (t - i[0] > 1 || r - i[1] > 1) {
|
|
1724
|
+
n[e + Math.random().toString(36)] = n[e], n[e] = {
|
|
1725
|
+
from: [t, r],
|
|
1726
|
+
to: [t, r]
|
|
1727
|
+
};
|
|
1728
|
+
continue;
|
|
1729
|
+
}
|
|
1730
|
+
n[e].to = [t, r];
|
|
1731
|
+
} else n[e] = { from: [t, r] }, n[e].to = n[e].from;
|
|
1732
|
+
}
|
|
1733
|
+
r.complexHeaderMergeInfo = n;
|
|
1734
|
+
}
|
|
1735
|
+
} else t.unshift(i);
|
|
1736
|
+
}
|
|
1737
|
+
processHierarchicalData(e, t) {
|
|
1738
|
+
let n = this, r = t === "xlsx" ? n.xlsxStartIndex : +n.exportHeader, i = {}, a = [], o = 0, s = !1;
|
|
1739
|
+
if (e[r]._keyDataField === void 0) return n.processNestedData(e, t, r);
|
|
1740
|
+
for (let t = r; t < e.length; t++) {
|
|
1741
|
+
let n = Object.assign({}, e[t]), r = n._parentDataField;
|
|
1742
|
+
r === void 0 && (r = null), i[r] === void 0 ? i[r] = [n] : i[r].push(n);
|
|
1743
|
+
}
|
|
1744
|
+
if (r) for (let n = 0; n < r; n++) a.push(Object.assign({}, e[n])), [
|
|
1745
|
+
"json",
|
|
1746
|
+
"pdf",
|
|
1747
|
+
"xml"
|
|
1748
|
+
].indexOf(t) === -1 && (a[n]._level = 1);
|
|
1749
|
+
return t !== "json" && t !== "xml" ? function e(t, n, r) {
|
|
1750
|
+
let c = i[t];
|
|
1751
|
+
if (o = Math.max(o, n), c !== void 0) for (let t = 0; t < c.length; t++) {
|
|
1752
|
+
let o = c[t], l = o._keyDataField;
|
|
1753
|
+
o._collapsed = r, o._level = n, a.push(o), i[l] && (s = !0, o._expanded = o._expanded === void 0 || o._expanded, e(l, n + 1, r || !o._expanded));
|
|
1754
|
+
}
|
|
1755
|
+
}(null, 1, !1) : function e(n, r, a) {
|
|
1756
|
+
let c = i[n];
|
|
1757
|
+
if (o = Math.max(o, r), c !== void 0) for (let n = 0; n < c.length; n++) {
|
|
1758
|
+
let o = c[n], l = o._keyDataField, u;
|
|
1759
|
+
if (t === "json") {
|
|
1760
|
+
u = {};
|
|
1761
|
+
for (let e in o) Object.prototype.hasOwnProperty.call(o, e) && e.charAt(0) !== "_" && (u[e] = o[e]);
|
|
1762
|
+
} else u = Object.assign({}, o);
|
|
1763
|
+
a.push(u), i[l] && (s = !0, u.rows = [], e(l, r + 1, u.rows));
|
|
1764
|
+
}
|
|
1765
|
+
}(null, 1, a), s || (n.actualHierarchy = !1), n.maxLevel = o, a;
|
|
1766
|
+
}
|
|
1767
|
+
processNestedData(e, t, n) {
|
|
1768
|
+
let r = this, i = [], a = 0, o = !1;
|
|
1769
|
+
if (n) for (let r = 0; r < n; r++) i.push(Object.assign({}, e[r])), [
|
|
1770
|
+
"json",
|
|
1771
|
+
"pdf",
|
|
1772
|
+
"xml"
|
|
1773
|
+
].indexOf(t) === -1 && (i[r]._level = 1);
|
|
1774
|
+
return t !== "json" && t !== "xml" ? function e(t, n, r, s) {
|
|
1775
|
+
a = Math.max(a, r);
|
|
1776
|
+
for (let a = t; a < n.length; a++) {
|
|
1777
|
+
let t = Object.assign({}, n[a]);
|
|
1778
|
+
t._collapsed = s, t._level = r, i.push(t), t.children && t.children.length > 0 && (o = !0, t._expanded = t._expanded === void 0 || t._expanded, e(0, t.children, r + 1, s || !t._expanded)), delete t.children;
|
|
1779
|
+
}
|
|
1780
|
+
}(n, e, 1, !1) : function e(t, n, r, s) {
|
|
1781
|
+
a = Math.max(a, s);
|
|
1782
|
+
for (let a = t; a < n.length; a++) {
|
|
1783
|
+
let t = Object.assign({}, n[a]);
|
|
1784
|
+
s === 1 ? i[a] = t : r[a] = t, t.children && t.children.length > 0 && (o = !0, t.rows = [], e(0, t.children, t.rows, s + 1)), delete t.children;
|
|
1785
|
+
}
|
|
1786
|
+
}(n, e, void 0, 1), o || (r.actualHierarchy = !1), r.maxLevel = a, i;
|
|
1787
|
+
}
|
|
1788
|
+
processRowStyle(e) {
|
|
1789
|
+
let t = this, n = e.rows;
|
|
1790
|
+
if (t.rowHeight = [], !n) return;
|
|
1791
|
+
let r = t.xlsxStartIndex;
|
|
1792
|
+
function i(e, n, i) {
|
|
1793
|
+
for (let a = 0; a < t.columnsArray.length; a++) {
|
|
1794
|
+
let o = t.columnsArray[a] + (e + 1 + r);
|
|
1795
|
+
t.storeCellStyle(o, n, i);
|
|
1796
|
+
}
|
|
1797
|
+
}
|
|
1798
|
+
n.height && (n.height ||= 15, t.defaultRowHeight = ` ht="${parseFloat(n.height) / 2}"`);
|
|
1799
|
+
for (let e = r; e < t.data.length; e++) {
|
|
1800
|
+
let a = e - r;
|
|
1801
|
+
for (let e in n) Object.prototype.hasOwnProperty.call(n, e) && e.indexOf("alt") === -1 && isNaN(e) && e !== "height" && i(a, e, n[e]);
|
|
1802
|
+
if (n.alternationCount && ((n.alternationStart === void 0 || a >= n.alternationStart) && (n.alternationEnd === void 0 || a <= n.alternationEnd) || n.alternationStart === n.alternationEnd)) {
|
|
1803
|
+
let e = (a - (n.alternationStart || 0)) % n.alternationCount;
|
|
1804
|
+
n[`alternationIndex${e}Color`] && i(a, "color", n[`alternationIndex${e}Color`]), n[`alternationIndex${e}BorderColor`] && i(a, "borderColor", n[`alternationIndex${e}BorderColor`]), n[`alternationIndex${e}BackgroundColor`] && i(a, "backgroundColor", n[`alternationIndex${e}BackgroundColor`]);
|
|
1805
|
+
}
|
|
1806
|
+
if (t.setRowHeight) {
|
|
1807
|
+
let n = t.setRowHeight(a);
|
|
1808
|
+
if (n) {
|
|
1809
|
+
t.rowHeight[e] = ` ht="${parseFloat(n)}"`;
|
|
1810
|
+
continue;
|
|
1811
|
+
}
|
|
1812
|
+
}
|
|
1813
|
+
if (n[a]) {
|
|
1814
|
+
for (let o in n[a]) if (Object.prototype.hasOwnProperty.call(n[a], o)) {
|
|
1815
|
+
if (o === "height") {
|
|
1816
|
+
t.rowHeight[e] = ` ht="${parseFloat(n[a].height) / 2}"`;
|
|
1817
|
+
continue;
|
|
1818
|
+
}
|
|
1819
|
+
if (t.data[e] && t.data[e][o]) {
|
|
1820
|
+
function e(e, n, i, a) {
|
|
1821
|
+
let o = t.datafields ? t.datafields.indexOf(a) : -1;
|
|
1822
|
+
if (o >= 0) {
|
|
1823
|
+
let a = t.columnsArray[o] + (e + 1 + r);
|
|
1824
|
+
t.storeCellStyle(a, n, i);
|
|
1825
|
+
}
|
|
1826
|
+
}
|
|
1827
|
+
for (let t in n[a][o]) e(a, t, n[a][o][t], o);
|
|
1828
|
+
continue;
|
|
1829
|
+
}
|
|
1830
|
+
i(a, o, n[a][o]);
|
|
1831
|
+
}
|
|
1832
|
+
}
|
|
1833
|
+
}
|
|
1834
|
+
}
|
|
1835
|
+
storeCellStyle(e, t, n) {
|
|
1836
|
+
let r = this.styleMap[e];
|
|
1837
|
+
switch (t) {
|
|
1838
|
+
case "backgroundColor":
|
|
1839
|
+
r.fills.fgColor = n;
|
|
1840
|
+
break;
|
|
1841
|
+
case "color":
|
|
1842
|
+
r.fonts.color = n;
|
|
1843
|
+
break;
|
|
1844
|
+
case "fontFamily":
|
|
1845
|
+
r.fonts.name = n.replace(/"/g, "'");
|
|
1846
|
+
break;
|
|
1847
|
+
case "fontSize":
|
|
1848
|
+
r.fonts.sz = Math.round(parseFloat(n) / (96 / 72));
|
|
1849
|
+
break;
|
|
1850
|
+
case "fontStyle":
|
|
1851
|
+
n === "italic" ? r.fonts.i = !0 : delete r.fonts.i;
|
|
1852
|
+
break;
|
|
1853
|
+
case "fontWeight":
|
|
1854
|
+
n === "bold" ? r.fonts.b = !0 : delete r.fonts.b;
|
|
1855
|
+
break;
|
|
1856
|
+
case "numFmt":
|
|
1857
|
+
r.numFmt = n;
|
|
1858
|
+
break;
|
|
1859
|
+
case "textAlign":
|
|
1860
|
+
r.alignment.horizontal = n;
|
|
1861
|
+
break;
|
|
1862
|
+
case "textDecoration":
|
|
1863
|
+
n === "underline" ? r.fonts.u = !0 : delete r.fonts.u;
|
|
1864
|
+
break;
|
|
1865
|
+
case "verticalAlign": n === "middle" && (n = "center"), r.alignment.vertical = n;
|
|
1866
|
+
}
|
|
1867
|
+
}
|
|
1868
|
+
toARGB(e) {
|
|
1869
|
+
e ||= "#FFFFFF", e = e.replace(/\s/g, "");
|
|
1870
|
+
let t = /rgb\((\d+),(\d+),(\d+)\)/gi.exec(e);
|
|
1871
|
+
if (t !== null) {
|
|
1872
|
+
let e = parseFloat(t[1]).toString(16).toUpperCase(), n = parseFloat(t[2]).toString(16).toUpperCase(), r = parseFloat(t[3]).toString(16).toUpperCase();
|
|
1873
|
+
return "FF" + "0".repeat(2 - e.length) + e + "0".repeat(2 - n.length) + n + "0".repeat(2 - r.length) + r;
|
|
1874
|
+
}
|
|
1875
|
+
let n = /rgba\((\d+),(\d+),(\d+)\,(\d*.\d+|\d+)\)/gi.exec(e);
|
|
1876
|
+
if (n !== null) {
|
|
1877
|
+
let e = Math.round(255 * parseFloat(n[4])).toString(16).toUpperCase(), t = parseFloat(n[1]).toString(16).toUpperCase(), r = parseFloat(n[2]).toString(16).toUpperCase(), i = parseFloat(n[3]).toString(16).toUpperCase();
|
|
1878
|
+
return "0".repeat(2 - e.length) + e + "0".repeat(2 - t.length) + t + "0".repeat(2 - r.length) + r + "0".repeat(2 - i.length) + i;
|
|
1879
|
+
}
|
|
1880
|
+
let r = /^#(.)(.)(.)$/gi.exec(e);
|
|
1881
|
+
if (r !== null) {
|
|
1882
|
+
let e = r[1].toUpperCase(), t = r[2].toUpperCase(), n = r[3].toUpperCase();
|
|
1883
|
+
return "FF" + e + e + t + t + n + n;
|
|
1884
|
+
}
|
|
1885
|
+
return "FF" + e.toUpperCase().slice(1);
|
|
1886
|
+
}
|
|
1887
|
+
toggleableFunctionality() {
|
|
1888
|
+
let e = this;
|
|
1889
|
+
return e.actualHierarchy ? `\n <style type="text/css">\n .toggle-element {\n width: 5px;\n height: 1px;\n padding-right: 5px;\n float: left;\n text-align: right;\n cursor: pointer;\n user-select: none;\n }\n\n .collapsed {\n display: none;\n }\n </style>\n <script type="text/javascript">\n window.onload = function () {\n var expandChar = '${e.expandChar}',\n collapseChar = '${e.collapseChar}',\n toggleElements = document.getElementsByClassName('toggle-element');\n\n function getParent(child) {\n var prevSibling = child.previousElementSibling;\n\n while (prevSibling) {\n if (child.getAttribute('level') > prevSibling.getAttribute('level')) {\n return prevSibling;\n }\n\n prevSibling = prevSibling.previousElementSibling;\n }\n\n }\n\n function getFirstCollapsedAncestor(child) {\n var parent = getParent(child);\n\n while (parent) {\n if (parent.firstElementChild.firstElementChild.innerHTML === expandChar) {\n return parent;\n }\n\n parent = getParent(parent);\n }\n }\n\n for (var i = 0; i < toggleElements.length; i++) {\n toggleElements[i].addEventListener('click', function (event) {\n var expanded = this.innerHTML === collapseChar,\n row = this.parentElement.parentElement,\n sibling = row.nextElementSibling;\n\n if (expanded) {\n this.innerHTML = expandChar;\n }\n else {\n this.innerHTML = collapseChar;\n }\n\n while (sibling && row.getAttribute('level') < sibling.getAttribute('level')) {\n if (expanded) {\n sibling.style.display = 'none';\n }\n else {\n var firstCollapsedAncestor = getFirstCollapsedAncestor(sibling);\n\n if (!firstCollapsedAncestor || firstCollapsedAncestor === row) {\n sibling.classList.remove('collapsed');\n sibling.style.display = null;\n }\n\n }\n\n sibling = sibling.nextElementSibling;\n }\n });\n }\n }\n <\/script>` : "";
|
|
1890
|
+
}
|
|
1891
|
+
generateStyles(e) {
|
|
1892
|
+
let t = this;
|
|
1893
|
+
if (t.cellStyleMapping = {}, Object.keys(e).length === 0 && !t.complexHeader) return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n<styleSheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="x14ac x16r2 xr" xmlns:x14ac="http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac" xmlns:x16r2="http://schemas.microsoft.com/office/spreadsheetml/2015/02/main" xmlns:xr="http://schemas.microsoft.com/office/spreadsheetml/2014/revision"><fonts count="1" x14ac:knownFonts="1"><font><sz val="11"/><color theme="1"/><name val="Calibri"/><family val="2"/><charset val="204"/><scheme val="minor"/></font></fonts><fills count="2"><fill><patternFill patternType="none"/></fill><fill><patternFill patternType="gray125"/></fill></fills><borders count="1"><border><left/><right/><top/><bottom/><diagonal/></border></borders><cellStyleXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0"/></cellStyleXfs><cellXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0"/></cellXfs><cellStyles count="1"><cellStyle name="Normal" xfId="0" builtinId="0"/></cellStyles>${t.conditionalFormattingXLSX.styles || "<dxfs count=\"0\"/>"}<tableStyles count="0" defaultTableStyle="TableStyleMedium2" defaultPivotStyle="PivotStyleLight16"/><extLst><ext uri="{EB79DEF2-80B8-43e5-95BD-54CBDDF9020C}" xmlns:x14="http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"><x14:slicerStyles defaultSlicerStyle="SlicerStyleLight1"/></ext><ext uri="{9260A510-F301-46a8-8635-F512D64BE5F5}" xmlns:x15="http://schemas.microsoft.com/office/spreadsheetml/2010/11/main"><x15:timelineStyles defaultTimelineStyle="TimeSlicerStyleLight1"/></ext></extLst></styleSheet>`;
|
|
1894
|
+
t.styleMap = {};
|
|
1895
|
+
let n = t.headerContent ? t.headerContent.length : 0;
|
|
1896
|
+
n += t.footerContent ? t.footerContent.length : 0;
|
|
1897
|
+
let r = t.data.length + n;
|
|
1898
|
+
t.groupBy && t.groupBy.length && (r += 50);
|
|
1899
|
+
for (let e = 0; e < r; e++) for (let n = 0; n < t.columnsArray.length; n++) t.styleMap[t.columnsArray[n] + (e + 1)] = {
|
|
1900
|
+
numFmts: {},
|
|
1901
|
+
fonts: {},
|
|
1902
|
+
fills: {},
|
|
1903
|
+
borders: {},
|
|
1904
|
+
alignment: {}
|
|
1905
|
+
};
|
|
1906
|
+
if (e && e.columns) for (let n = 0; n < t.columnsArray.length; n++) {
|
|
1907
|
+
let r = t.datafields[n];
|
|
1908
|
+
if (!e.columns[r] || !e.columns[r].format) continue;
|
|
1909
|
+
let i = t.getXLSXFormat(e.columns[r].format, t.data[1][r]), a = t.getXLSXFormat(e.columns[r].format, t.data[t.data.length - 1][r]);
|
|
1910
|
+
if (a) e.columns[r].numFmt = a;
|
|
1911
|
+
else if (i) e.columns[r].numFmt = i;
|
|
1912
|
+
else if (e.columns[r].format && (r.toLowerCase().indexOf("date") >= 0 || e.columns[r].format.indexOf("d/") >= 0)) {
|
|
1913
|
+
let t = e.columns[r].format;
|
|
1914
|
+
switch (t) {
|
|
1915
|
+
case "d":
|
|
1916
|
+
t = "m/d/yyyy";
|
|
1917
|
+
break;
|
|
1918
|
+
case "D":
|
|
1919
|
+
t = "nnnnmmmm dd, yyyy";
|
|
1920
|
+
break;
|
|
1921
|
+
case "t":
|
|
1922
|
+
t = "h:m AM/PM";
|
|
1923
|
+
break;
|
|
1924
|
+
case "T":
|
|
1925
|
+
t = "h:mm:ss AM/PM";
|
|
1926
|
+
break;
|
|
1927
|
+
case "f":
|
|
1928
|
+
t = "nnnnmmmm dd, yyyy h:m AM/PM";
|
|
1929
|
+
break;
|
|
1930
|
+
case "F":
|
|
1931
|
+
t = "nnnnmmmm dd, yyyy h:mm:ss AM/PM";
|
|
1932
|
+
break;
|
|
1933
|
+
case "M":
|
|
1934
|
+
t = "mmmm d";
|
|
1935
|
+
break;
|
|
1936
|
+
case "Y":
|
|
1937
|
+
t = "yyyy mmmm";
|
|
1938
|
+
break;
|
|
1939
|
+
case "FP":
|
|
1940
|
+
case "PP":
|
|
1941
|
+
t = "yyyy-mm-dd hh:mm:ss";
|
|
1942
|
+
break;
|
|
1943
|
+
case "FT":
|
|
1944
|
+
case "PT": t = "hh:mm:ss";
|
|
1945
|
+
}
|
|
1946
|
+
t = t.replace(/f|u|n|p|e|a|x|o/gi, ""), t = t.replace(/tt/gi, "AM/PM"), t = t.replace(/:{2,}|:\s|:$|\.$/g, ""), t = t.trim(), e.columns[r].numFmt = t;
|
|
1947
|
+
}
|
|
1948
|
+
}
|
|
1949
|
+
t.processRowStyle(e), t.processColumnStyle(e);
|
|
1950
|
+
let i = {};
|
|
1951
|
+
for (let e = 0; e < t.complexHeaderMergedCells.length; e++) {
|
|
1952
|
+
let n = t.complexHeaderMergedCells[e];
|
|
1953
|
+
parseFloat(n.to[1]) === t.complexHeader.length ? i[n.to] = n.from : (t.styleMap[n.from].alignment.horizontal = "center", t.styleMap[n.from].alignment.vertical = "center");
|
|
1954
|
+
}
|
|
1955
|
+
let a = {
|
|
1956
|
+
xml: "<font><sz val=\"11\" /><color theme=\"1\" /><name val=\"Calibri\" /><family val=\"2\" /><charset val=\"204\" /><scheme val=\"minor\" /></font>",
|
|
1957
|
+
collection: ["default"]
|
|
1958
|
+
}, o = {
|
|
1959
|
+
xml: "<fill><patternFill patternType=\"none\" /></fill><fill><patternFill patternType=\"gray125\" /></fill>",
|
|
1960
|
+
collection: ["default", "gray125"]
|
|
1961
|
+
}, s = {
|
|
1962
|
+
xml: "",
|
|
1963
|
+
collection: []
|
|
1964
|
+
}, c = {
|
|
1965
|
+
xml: "<xf fontId=\"0\" fillId=\"0\" borderId=\"1\"/>",
|
|
1966
|
+
collection: ["default"]
|
|
1967
|
+
};
|
|
1968
|
+
for (let e = 0; e < r; e++) for (let n = 0; n < t.columnsArray.length; n++) {
|
|
1969
|
+
let r = t.columnsArray[n] + (e + 1), l = t.styleMap[r], u = "", d = "", f = "", p = [], m = [], h = [], g = [];
|
|
1970
|
+
for (let e in l.fonts) if (Object.prototype.hasOwnProperty.call(l.fonts, e)) {
|
|
1971
|
+
let n = l.fonts[e];
|
|
1972
|
+
switch (e) {
|
|
1973
|
+
case "color":
|
|
1974
|
+
p[0] = n, u += n ? `<color rgb="${t.toARGB(n)}" />` : `<color rgb="${t.toARGB("#333333")}" />`;
|
|
1975
|
+
break;
|
|
1976
|
+
case "name":
|
|
1977
|
+
p[1] = n, u += `<name val="${n}" />`;
|
|
1978
|
+
break;
|
|
1979
|
+
case "sz":
|
|
1980
|
+
p[2] = n, u += `<sz val="${n}" />`;
|
|
1981
|
+
break;
|
|
1982
|
+
case "i":
|
|
1983
|
+
p[3] = n, u += "<i />";
|
|
1984
|
+
break;
|
|
1985
|
+
case "b":
|
|
1986
|
+
p[4] = n, u += "<b />";
|
|
1987
|
+
break;
|
|
1988
|
+
case "u": p[5] = n, u += "<u />";
|
|
1989
|
+
}
|
|
1990
|
+
}
|
|
1991
|
+
for (let e in l.fills) if (Object.prototype.hasOwnProperty.call(l.fills, e)) {
|
|
1992
|
+
let n = l.fills[e];
|
|
1993
|
+
switch (e) {
|
|
1994
|
+
case "fgColor": m[0] = n, d += `<fgColor rgb="${t.toARGB(n)}" />`;
|
|
1995
|
+
}
|
|
1996
|
+
}
|
|
1997
|
+
for (let e in l.alignment) if (Object.prototype.hasOwnProperty.call(l.alignment, e)) {
|
|
1998
|
+
let t = l.alignment[e];
|
|
1999
|
+
switch (e) {
|
|
2000
|
+
case "horizontal":
|
|
2001
|
+
h[0] = t, f += `horizontal="${t}" `;
|
|
2002
|
+
break;
|
|
2003
|
+
case "vertical": h[1] = t, f += `vertical="${t}" `;
|
|
2004
|
+
}
|
|
2005
|
+
}
|
|
2006
|
+
if (p = p.toString(), m = m.toString(), u !== "") {
|
|
2007
|
+
let e = a.collection.indexOf(p);
|
|
2008
|
+
e === -1 && (e = a.collection.length, a.xml += "<font>" + u + "</font>", a.collection.push(p)), g[0] = e;
|
|
2009
|
+
}
|
|
2010
|
+
if (d !== "") {
|
|
2011
|
+
let e = o.collection.indexOf(m);
|
|
2012
|
+
e === -1 && (e = o.collection.length, o.xml += "<fill><patternFill patternType=\"solid\">" + d + "</patternFill></fill>", o.collection.push(m)), g[1] = e;
|
|
2013
|
+
}
|
|
2014
|
+
h.length > 0 && (g[2] = f), l.numFmt !== void 0 && (g[3] = t.getNumFmtIndex(l.numFmt, s));
|
|
2015
|
+
let _ = g.toString();
|
|
2016
|
+
if (_ !== "") {
|
|
2017
|
+
let e = c.collection.indexOf(_);
|
|
2018
|
+
if (e === -1) {
|
|
2019
|
+
let t = "<xf ";
|
|
2020
|
+
e = c.collection.length, g[0] !== void 0 && (t += `fontId="${g[0]}" `), g[1] !== void 0 && (t += `fillId="${g[1]}" `), g[3] !== void 0 && (t += `numFmtId="${g[3]}" `), g[2] === void 0 ? t += " borderId=\"1\"/>" : t += `applyAlignment="1" borderId="1"><alignment ${f}/></xf>`, c.xml += t, c.collection.push(_);
|
|
2021
|
+
}
|
|
2022
|
+
t.cellStyleMapping[i[r] || r] = e;
|
|
2023
|
+
}
|
|
2024
|
+
}
|
|
2025
|
+
return s.collection.length && (s.xml = `<numFmts count="${s.collection.length}">${s.xml}</numFmts>`), `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n<styleSheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="x14ac x16r2 xr" xmlns:x14ac="http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac" xmlns:x16r2="http://schemas.microsoft.com/office/spreadsheetml/2015/02/main" xmlns:xr="http://schemas.microsoft.com/office/spreadsheetml/2014/revision">${s.xml}<fonts count="${a.collection.length}" x14ac:knownFonts="1">${a.xml}</fonts><fills count="${o.collection.length}">${o.xml}</fills><borders count="2"><border><left/><right/><top/><bottom/></border><border><left style="hair"/><right style="hair"/><top style="hair"/><bottom style="hair"/><diagonal/></border></borders><cellStyleXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0"/></cellStyleXfs><cellXfs count="${c.collection.length}">${c.xml}</cellXfs><cellStyles count="1"><cellStyle name="Normal" xfId="0" builtinId="0"/></cellStyles>${t.conditionalFormattingXLSX.styles}<dxfs count="0"/><tableStyles count="0" defaultTableStyle="TableStyleMedium2" defaultPivotStyle="PivotStyleLight16"/><extLst><ext uri="{EB79DEF2-80B8-43e5-95BD-54CBDDF9020C}" xmlns:x14="http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"><x14:slicerStyles defaultSlicerStyle="SlicerStyleLight1"/></ext><ext uri="{9260A510-F301-46a8-8635-F512D64BE5F5}" xmlns:x15="http://schemas.microsoft.com/office/spreadsheetml/2010/11/main"><x15:timelineStyles defaultTimelineStyle="TimeSlicerStyleLight1"/></ext></extLst></styleSheet>`;
|
|
2026
|
+
}
|
|
2027
|
+
});
|
|
2028
|
+
})();
|
|
2029
|
+
//#endregion
|