@fileverse-dev/dsheet 4.1.1 → 4.1.2-overhaul-1
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/README.md +1 -1
- package/dist/{constants-CRFfbkoQ.js → constants-5ZxHFftQ.js} +1 -1
- package/dist/constants.js +1 -1
- package/dist/crypto-constants-CY-Whjwy.js +333 -0
- package/dist/{executeStringFunction-BJ00H04h.js → executeStringFunction-adhsb5GH.js} +9 -7
- package/dist/formula.js +1 -1
- package/dist/{index-CsYiH7pp.js → index-DC_Tcoo4.js} +25172 -25401
- package/dist/index.es.js +3 -3
- package/dist/style.css +1 -1
- package/dist/{use-xlsx-import-impl-OXKPbMbG.js → use-xlsx-import-impl-CcET8OCA.js} +4 -4
- package/dist/{xlsx-defined-names-Klp22jvp.js → xlsx-defined-names-u1Jyf-M6.js} +2 -2
- package/dist/{xlsx-export-impl-Y8hmWj_I.js → xlsx-export-impl-BjQj4U0N.js} +192 -188
- package/dist/{xlsx-hyperlink-inline-DNeesFv6.js → xlsx-hyperlink-inline-D2-WOlOD.js} +2 -2
- package/package.json +3 -3
- package/dist/crypto-constants-ZTlAYRUf.js +0 -1165
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { utils as F, write as it } from "xlsx-js-style";
|
|
2
2
|
import { Workbook as ct } from "exceljs";
|
|
3
3
|
import { toast as nt } from "@fileverse/ui";
|
|
4
|
-
import { J as ft, c as X, g as ut, a as pt } from "./xlsx-hyperlink-inline-
|
|
5
|
-
import { b as dt } from "./executeStringFunction-
|
|
6
|
-
import { e as ht } from "./index-
|
|
4
|
+
import { J as ft, c as X, g as ut, a as pt } from "./xlsx-hyperlink-inline-D2-WOlOD.js";
|
|
5
|
+
import { b as dt } from "./executeStringFunction-adhsb5GH.js";
|
|
6
|
+
import { e as ht } from "./index-DC_Tcoo4.js";
|
|
7
7
|
const mt = {
|
|
8
8
|
1: "thin",
|
|
9
9
|
2: "hair",
|
|
@@ -33,73 +33,73 @@ const mt = {
|
|
|
33
33
|
if (!n || !r.l && !r.r && !r.t && !r.b) return;
|
|
34
34
|
const l = F.encode_cell({ r: o, c: t }), i = {
|
|
35
35
|
...e[l] || { t: "z" }
|
|
36
|
-
},
|
|
37
|
-
r.l && (d.left = n), r.r && (d.right = n), r.t && (d.top = n), r.b && (d.bottom = n),
|
|
36
|
+
}, u = { ...i.s || {} }, d = { ...u.border || {} };
|
|
37
|
+
r.l && (d.left = n), r.r && (d.right = n), r.t && (d.top = n), r.b && (d.bottom = n), u.border = d, i.s = u, e[l] = i;
|
|
38
38
|
}, xt = (e, o) => {
|
|
39
39
|
o.forEach((t) => {
|
|
40
40
|
if (t.rangeType === "cell") {
|
|
41
41
|
if (!t.value) return;
|
|
42
42
|
const { row_index: r, col_index: n } = t.value;
|
|
43
43
|
if (r == null || n == null) return;
|
|
44
|
-
const l = t.value, i = F.encode_cell({ r, c: n }),
|
|
44
|
+
const l = t.value, i = F.encode_cell({ r, c: n }), u = {
|
|
45
45
|
...e[i] || { t: "z" }
|
|
46
|
-
}, d = { ...
|
|
47
|
-
l.l && (a.left = q(l.l.style, l.l.color)), l.r && (a.right = q(l.r.style, l.r.color)), l.t && (a.top = q(l.t.style, l.t.color)), l.b && (a.bottom = q(l.b.style, l.b.color)), d.border = a,
|
|
46
|
+
}, d = { ...u.s || {} }, a = { ...d.border || {} };
|
|
47
|
+
l.l && (a.left = q(l.l.style, l.l.color)), l.r && (a.right = q(l.r.style, l.r.color)), l.t && (a.top = q(l.t.style, l.t.color)), l.b && (a.bottom = q(l.b.style, l.b.color)), d.border = a, u.s = d, e[i] = u;
|
|
48
48
|
} else if (t.rangeType === "range") {
|
|
49
49
|
const { borderType: r, style: n, color: l, range: i } = t;
|
|
50
50
|
if (r === "border-none" || !Array.isArray(i) || !n)
|
|
51
51
|
return;
|
|
52
|
-
const
|
|
53
|
-
if (!
|
|
52
|
+
const u = q(n, l);
|
|
53
|
+
if (!u) return;
|
|
54
54
|
i.forEach((d) => {
|
|
55
55
|
const [a, T] = d.row, [w, k] = d.column;
|
|
56
56
|
for (let C = a; C <= T; C++)
|
|
57
|
-
for (let
|
|
57
|
+
for (let x = w; x <= k; x++)
|
|
58
58
|
switch (r) {
|
|
59
59
|
case "border-all":
|
|
60
60
|
I(
|
|
61
61
|
e,
|
|
62
62
|
C,
|
|
63
|
-
|
|
63
|
+
x,
|
|
64
64
|
{ l: !0, r: !0, t: !0, b: !0 },
|
|
65
|
-
|
|
65
|
+
u
|
|
66
66
|
);
|
|
67
67
|
break;
|
|
68
68
|
case "border-outside":
|
|
69
69
|
I(
|
|
70
70
|
e,
|
|
71
71
|
C,
|
|
72
|
-
|
|
73
|
-
{ l:
|
|
74
|
-
|
|
72
|
+
x,
|
|
73
|
+
{ l: x === w, r: x === k, t: C === a, b: C === T },
|
|
74
|
+
u
|
|
75
75
|
);
|
|
76
76
|
break;
|
|
77
77
|
case "border-inside":
|
|
78
78
|
I(
|
|
79
79
|
e,
|
|
80
80
|
C,
|
|
81
|
-
|
|
82
|
-
{ r:
|
|
83
|
-
|
|
81
|
+
x,
|
|
82
|
+
{ r: x < k, b: C < T },
|
|
83
|
+
u
|
|
84
84
|
);
|
|
85
85
|
break;
|
|
86
86
|
case "border-horizontal":
|
|
87
|
-
I(e, C,
|
|
87
|
+
I(e, C, x, { b: C < T }, u);
|
|
88
88
|
break;
|
|
89
89
|
case "border-vertical":
|
|
90
|
-
I(e, C,
|
|
90
|
+
I(e, C, x, { r: x < k }, u);
|
|
91
91
|
break;
|
|
92
92
|
case "border-left":
|
|
93
|
-
|
|
93
|
+
x === w && I(e, C, x, { l: !0 }, u);
|
|
94
94
|
break;
|
|
95
95
|
case "border-right":
|
|
96
|
-
|
|
96
|
+
x === k && I(e, C, x, { r: !0 }, u);
|
|
97
97
|
break;
|
|
98
98
|
case "border-top":
|
|
99
|
-
C === a && I(e, C,
|
|
99
|
+
C === a && I(e, C, x, { t: !0 }, u);
|
|
100
100
|
break;
|
|
101
101
|
case "border-bottom":
|
|
102
|
-
C === T && I(e, C,
|
|
102
|
+
C === T && I(e, C, x, { b: !0 }, u);
|
|
103
103
|
break;
|
|
104
104
|
}
|
|
105
105
|
});
|
|
@@ -136,12 +136,12 @@ function bt(e) {
|
|
|
136
136
|
}
|
|
137
137
|
function yt(e) {
|
|
138
138
|
return !Array.isArray(e) || e.length === 0 ? "" : e.map((t) => {
|
|
139
|
-
const [r, n] = t.row, [l, i] = t.column,
|
|
140
|
-
return
|
|
139
|
+
const [r, n] = t.row, [l, i] = t.column, u = F.encode_cell({ r, c: l }), d = F.encode_cell({ r: n, c: i });
|
|
140
|
+
return u === d ? u : `${u}:${d}`;
|
|
141
141
|
}).filter(Boolean).join(" ");
|
|
142
142
|
}
|
|
143
143
|
function Ct(e, o, t) {
|
|
144
|
-
const { conditionName: r, conditionValue: n = [], format: l = {} } = e, i = bt(l),
|
|
144
|
+
const { conditionName: r, conditionValue: n = [], format: l = {} } = e, i = bt(l), u = (a) => a.replace(/"/g, '""'), d = o.split(/[\s:]/)[0];
|
|
145
145
|
switch (r) {
|
|
146
146
|
case "greaterThan":
|
|
147
147
|
case "greaterThanOrEqual":
|
|
@@ -187,7 +187,7 @@ function Ct(e, o, t) {
|
|
|
187
187
|
operator: "containsText",
|
|
188
188
|
text: a,
|
|
189
189
|
formulae: [
|
|
190
|
-
`NOT(ISERROR(SEARCH("${
|
|
190
|
+
`NOT(ISERROR(SEARCH("${u(a)}",${d})))`
|
|
191
191
|
],
|
|
192
192
|
priority: t,
|
|
193
193
|
style: i
|
|
@@ -201,7 +201,7 @@ function Ct(e, o, t) {
|
|
|
201
201
|
operator: "containsText",
|
|
202
202
|
text: a,
|
|
203
203
|
formulae: [
|
|
204
|
-
`NOT(ISERROR(SEARCH("${
|
|
204
|
+
`NOT(ISERROR(SEARCH("${u(a)}",${d})))`
|
|
205
205
|
],
|
|
206
206
|
priority: t,
|
|
207
207
|
style: i
|
|
@@ -214,7 +214,7 @@ function Ct(e, o, t) {
|
|
|
214
214
|
type: "notContainsText",
|
|
215
215
|
operator: "notContainsText",
|
|
216
216
|
text: a,
|
|
217
|
-
formulae: [`ISERROR(SEARCH("${
|
|
217
|
+
formulae: [`ISERROR(SEARCH("${u(a)}",${d}))`],
|
|
218
218
|
priority: t,
|
|
219
219
|
style: i
|
|
220
220
|
};
|
|
@@ -227,7 +227,7 @@ function Ct(e, o, t) {
|
|
|
227
227
|
type: "notContainsText",
|
|
228
228
|
operator: "notContainsText",
|
|
229
229
|
text: a,
|
|
230
|
-
formulae: [`ISERROR(SEARCH("${
|
|
230
|
+
formulae: [`ISERROR(SEARCH("${u(a)}",${d}))`],
|
|
231
231
|
priority: t,
|
|
232
232
|
style: i
|
|
233
233
|
};
|
|
@@ -240,7 +240,7 @@ function Ct(e, o, t) {
|
|
|
240
240
|
operator: "beginsWith",
|
|
241
241
|
text: a,
|
|
242
242
|
formulae: [
|
|
243
|
-
`LEFT(${d},${a.length})="${
|
|
243
|
+
`LEFT(${d},${a.length})="${u(a)}"`
|
|
244
244
|
],
|
|
245
245
|
priority: t,
|
|
246
246
|
style: i
|
|
@@ -254,7 +254,7 @@ function Ct(e, o, t) {
|
|
|
254
254
|
operator: "beginsWith",
|
|
255
255
|
text: a,
|
|
256
256
|
formulae: [
|
|
257
|
-
`LEFT(${d},${a.length})="${
|
|
257
|
+
`LEFT(${d},${a.length})="${u(a)}"`
|
|
258
258
|
],
|
|
259
259
|
priority: t,
|
|
260
260
|
style: i
|
|
@@ -268,7 +268,7 @@ function Ct(e, o, t) {
|
|
|
268
268
|
operator: "endsWith",
|
|
269
269
|
text: a,
|
|
270
270
|
formulae: [
|
|
271
|
-
`RIGHT(${d},${a.length})="${
|
|
271
|
+
`RIGHT(${d},${a.length})="${u(a)}"`
|
|
272
272
|
],
|
|
273
273
|
priority: t,
|
|
274
274
|
style: i
|
|
@@ -282,7 +282,7 @@ function Ct(e, o, t) {
|
|
|
282
282
|
operator: "endsWith",
|
|
283
283
|
text: a,
|
|
284
284
|
formulae: [
|
|
285
|
-
`RIGHT(${d},${a.length})="${
|
|
285
|
+
`RIGHT(${d},${a.length})="${u(a)}"`
|
|
286
286
|
],
|
|
287
287
|
priority: t,
|
|
288
288
|
style: i
|
|
@@ -297,7 +297,7 @@ function Ct(e, o, t) {
|
|
|
297
297
|
type: "containsText",
|
|
298
298
|
operator: "equal",
|
|
299
299
|
text: a,
|
|
300
|
-
formulae: [`EXACT(${d},"${
|
|
300
|
+
formulae: [`EXACT(${d},"${u(a)}")`],
|
|
301
301
|
priority: t,
|
|
302
302
|
style: i
|
|
303
303
|
};
|
|
@@ -393,21 +393,21 @@ function Tt(e, o, t) {
|
|
|
393
393
|
if (!Array.isArray(r) || r.length === 0)
|
|
394
394
|
return { nextPriority: t, pendingDuplicateValues: n };
|
|
395
395
|
let l = t;
|
|
396
|
-
for (const
|
|
397
|
-
if (
|
|
398
|
-
const d = yt(
|
|
396
|
+
for (const u of r) {
|
|
397
|
+
if (u.type !== "default") continue;
|
|
398
|
+
const d = yt(u.cellrange);
|
|
399
399
|
if (!d) continue;
|
|
400
|
-
if (
|
|
401
|
-
const T = String(((i =
|
|
400
|
+
if (u.conditionName === "duplicateValue") {
|
|
401
|
+
const T = String(((i = u.conditionValue) == null ? void 0 : i[0]) ?? "0") === "1" ? "uniqueValues" : "duplicateValues";
|
|
402
402
|
n.push({
|
|
403
403
|
ref: d,
|
|
404
|
-
format:
|
|
404
|
+
format: u.format || {},
|
|
405
405
|
priority: l,
|
|
406
406
|
type: T
|
|
407
407
|
}), l++;
|
|
408
408
|
continue;
|
|
409
409
|
}
|
|
410
|
-
const a = Ct(
|
|
410
|
+
const a = Ct(u, d, l);
|
|
411
411
|
a && (e.addConditionalFormatting({ ref: d, rules: [a] }), l++);
|
|
412
412
|
}
|
|
413
413
|
return { nextPriority: l, pendingDuplicateValues: n };
|
|
@@ -475,9 +475,9 @@ function kt(e) {
|
|
|
475
475
|
if (/\btext=/.test(t) || /\btext=/.test(r)) return o;
|
|
476
476
|
const l = n.match(/<formula[^>]*>([\s\S]*?)<\/formula>/);
|
|
477
477
|
if (!l) return o;
|
|
478
|
-
const
|
|
479
|
-
if (!
|
|
480
|
-
const d =
|
|
478
|
+
const u = l[1].replace(/"/g, '"').replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").match(/SEARCH\s*\(\s*"([^"]*)"/i);
|
|
479
|
+
if (!u) return o;
|
|
480
|
+
const d = u[1].replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">");
|
|
481
481
|
return `<cfRule${t}type="containsText"${r} text="${d}">${n}</cfRule>`;
|
|
482
482
|
}
|
|
483
483
|
);
|
|
@@ -486,22 +486,22 @@ async function Rt(e, o) {
|
|
|
486
486
|
var i;
|
|
487
487
|
const t = await ft.loadAsync(e), r = t.file("xl/styles.xml");
|
|
488
488
|
let n = r ? await r.async("text") : "", l = !1;
|
|
489
|
-
for (const [
|
|
489
|
+
for (const [u, d] of Object.entries(t.files)) {
|
|
490
490
|
if (d.dir) continue;
|
|
491
|
-
const a =
|
|
491
|
+
const a = u.match(/^xl\/worksheets\/sheet(\d+)\.xml$/);
|
|
492
492
|
if (!a) continue;
|
|
493
493
|
const T = parseInt(a[1], 10) - 1;
|
|
494
494
|
let w = await d.async("text"), k = !1;
|
|
495
495
|
const C = kt(w);
|
|
496
496
|
C !== w && (w = C, k = !0);
|
|
497
|
-
const
|
|
498
|
-
for (const B of
|
|
499
|
-
const
|
|
497
|
+
const x = ((i = o[T]) == null ? void 0 : i.duplicateValues) ?? [];
|
|
498
|
+
for (const B of x) {
|
|
499
|
+
const V = wt(B.format), { xml: z, dxfId: Z } = Et(n, V);
|
|
500
500
|
n = z, l = !0;
|
|
501
501
|
const K = `<cfRule type="${B.type}" dxfId="${Z}" priority="${B.priority}"/>`;
|
|
502
502
|
w = At(w, B.ref, K), k = !0;
|
|
503
503
|
}
|
|
504
|
-
k && t.file(
|
|
504
|
+
k && t.file(u, w);
|
|
505
505
|
}
|
|
506
506
|
return l && r && t.file("xl/styles.xml", n), t.generateAsync({ type: "arraybuffer", compression: "DEFLATE" });
|
|
507
507
|
}
|
|
@@ -561,8 +561,8 @@ const Y = (e) => {
|
|
|
561
561
|
return ((1 << 24) + (n << 16) + (l << 8) + i).toString(16).slice(1).toUpperCase();
|
|
562
562
|
}
|
|
563
563
|
return null;
|
|
564
|
-
},
|
|
565
|
-
var n, l, i,
|
|
564
|
+
}, Pt = async (e, o, t, r) => {
|
|
565
|
+
var n, l, i, u, d, a, T;
|
|
566
566
|
if (!(!e.current || !o.current))
|
|
567
567
|
try {
|
|
568
568
|
const w = (l = (n = e.current).getWorkbookContext) == null ? void 0 : l.call(n), k = w == null ? void 0 : w.luckysheetfile;
|
|
@@ -572,65 +572,65 @@ const Y = (e) => {
|
|
|
572
572
|
showCloseButton: !0,
|
|
573
573
|
duration: 30 * 1e3
|
|
574
574
|
}), o.current.getArray(t);
|
|
575
|
-
const
|
|
576
|
-
|
|
577
|
-
const B = F.book_new(),
|
|
578
|
-
|
|
579
|
-
var J, N, U, L,
|
|
580
|
-
const R = dt(
|
|
581
|
-
Object.keys(
|
|
582
|
-
if (
|
|
583
|
-
const
|
|
584
|
-
|
|
585
|
-
}),
|
|
586
|
-
|
|
587
|
-
s: { r:
|
|
588
|
-
e: { r:
|
|
575
|
+
const x = e.current.getAllSheets();
|
|
576
|
+
x.forEach((m) => ht(m));
|
|
577
|
+
const B = F.book_new(), V = x.map(() => /* @__PURE__ */ new Map()), z = /* @__PURE__ */ new Set();
|
|
578
|
+
x.forEach((m, W) => {
|
|
579
|
+
var J, N, U, L, O;
|
|
580
|
+
const R = dt(m), g = F.aoa_to_sheet(R);
|
|
581
|
+
Object.keys(g).forEach((c) => {
|
|
582
|
+
if (c.startsWith("!")) return;
|
|
583
|
+
const h = g[c];
|
|
584
|
+
h && (h.t === "s" || h.t === void 0) && h.v !== "" && !isNaN(Number(h.v)) && (g[c] = { ...h, v: Number(h.v), t: "n" });
|
|
585
|
+
}), g["!merges"] = [], (J = m.config) != null && J.merge && Object.values(m.config.merge).forEach((c) => {
|
|
586
|
+
g["!merges"].push({
|
|
587
|
+
s: { r: c.r, c: c.c },
|
|
588
|
+
e: { r: c.r + c.rs - 1, c: c.c + c.cs - 1 }
|
|
589
589
|
});
|
|
590
590
|
});
|
|
591
591
|
{
|
|
592
|
-
const
|
|
593
|
-
|
|
594
|
-
for (let s = 0; s <
|
|
595
|
-
const
|
|
596
|
-
if (
|
|
597
|
-
const
|
|
592
|
+
const h = Math.round(3437.714285714286) / 256, f = m.column || 36;
|
|
593
|
+
g["!cols"] = [];
|
|
594
|
+
for (let s = 0; s < f; s++) {
|
|
595
|
+
const b = (U = (N = m.config) == null ? void 0 : N.columnlen) == null ? void 0 : U[s];
|
|
596
|
+
if (b !== void 0) {
|
|
597
|
+
const p = Math.max(
|
|
598
598
|
0,
|
|
599
|
-
Math.round((Number(
|
|
599
|
+
Math.round((Number(b) - 5) / 7 * 256) / 256
|
|
600
600
|
);
|
|
601
|
-
|
|
601
|
+
g["!cols"][s] = { wch: p };
|
|
602
602
|
} else
|
|
603
|
-
|
|
603
|
+
g["!cols"][s] = { wch: h };
|
|
604
604
|
}
|
|
605
605
|
}
|
|
606
606
|
{
|
|
607
|
-
const
|
|
608
|
-
|
|
609
|
-
...
|
|
610
|
-
defaultRowHeight: String(
|
|
611
|
-
}, (L =
|
|
612
|
-
const s = Math.round(Number(
|
|
613
|
-
|
|
607
|
+
const c = Math.round(60.48) / 4;
|
|
608
|
+
g.sheetFormat = {
|
|
609
|
+
...g.sheetFormat || {},
|
|
610
|
+
defaultRowHeight: String(c)
|
|
611
|
+
}, (L = m.config) != null && L.rowlen && (g["!rows"] = [], Object.entries(m.config.rowlen).forEach(([h, f]) => {
|
|
612
|
+
const s = Math.round(Number(f) * 0.72 * 4) / 4;
|
|
613
|
+
g["!rows"][Number(h)] = { hpt: s };
|
|
614
614
|
}));
|
|
615
615
|
}
|
|
616
616
|
const D = /* @__PURE__ */ new Set();
|
|
617
|
-
(
|
|
618
|
-
var A, S, $, _,
|
|
619
|
-
const
|
|
620
|
-
let
|
|
621
|
-
if (
|
|
617
|
+
(m.celldata ?? []).forEach((c) => {
|
|
618
|
+
var A, S, $, _, P;
|
|
619
|
+
const h = c.r, f = c.c, s = c.v || {}, b = F.encode_cell({ r: h, c: f });
|
|
620
|
+
let p = g[b] || {};
|
|
621
|
+
if (p = { ...p }, s.f && (p.f = s.f.replace(/^=/, "")), !s.f && ((A = s.ct) == null ? void 0 : A.t) === "inlineStr" && Array.isArray(s.ct.s) ? (p.v = X(s.ct.s), p.t = "s") : p.v = s.v ?? ((_ = ($ = (S = s == null ? void 0 : s.ct) == null ? void 0 : S.s) == null ? void 0 : $[0]) == null ? void 0 : _.v), s.m && (p.w = s.m), !s.f && ((P = s.ct) == null ? void 0 : P.t) === "inlineStr" && Array.isArray(s.ct.s)) {
|
|
622
622
|
const M = rt(s.ct.s);
|
|
623
|
-
M &&
|
|
623
|
+
M && V[W].set(b, M);
|
|
624
624
|
}
|
|
625
|
-
if (s.ct && (s.ct.fa && (
|
|
625
|
+
if (s.ct && (s.ct.fa && (p.z = s.ct.fa), s.ct.t && s.ct.t !== "inlineStr" && (p.t = s.ct.t === "d" ? "n" : s.ct.t)), typeof p.v == "number" && !p.t && (p.t = "n"), p.s = p.s || {}, s.bg) {
|
|
626
626
|
const M = Y(s.bg);
|
|
627
|
-
M && (
|
|
627
|
+
M && (p.s.fill = {
|
|
628
628
|
patternType: "solid",
|
|
629
629
|
fgColor: { rgb: M }
|
|
630
630
|
});
|
|
631
631
|
}
|
|
632
|
-
|
|
633
|
-
...
|
|
632
|
+
p.s.font = {
|
|
633
|
+
...p.s.font || {},
|
|
634
634
|
bold: s.bl === 1 || void 0,
|
|
635
635
|
italic: s.it === 1 || void 0,
|
|
636
636
|
strike: s.cl === 1 || void 0,
|
|
@@ -643,134 +643,138 @@ const Y = (e) => {
|
|
|
643
643
|
})()
|
|
644
644
|
};
|
|
645
645
|
const E = { 0: "center", 1: "left", 2: "right" }, y = { 0: "center", 1: "top", 2: "bottom" };
|
|
646
|
-
|
|
647
|
-
...
|
|
646
|
+
p.s.alignment = {
|
|
647
|
+
...p.s.alignment || {},
|
|
648
648
|
wrapText: s.tb === "1" || s.tb === "2" ? !0 : void 0,
|
|
649
649
|
textRotation: s.tr !== void 0 ? s.tr : void 0
|
|
650
|
-
},
|
|
651
|
-
}), R.forEach((
|
|
652
|
-
Array.isArray(
|
|
653
|
-
if (!
|
|
654
|
-
const
|
|
655
|
-
if (D.has(
|
|
656
|
-
const
|
|
657
|
-
if (!
|
|
658
|
-
const y = { ...
|
|
659
|
-
if (y.s = y.s || {},
|
|
660
|
-
const $ = Y(
|
|
650
|
+
}, p.s.alignment.horizontal = E[s.ht] || void 0, p.s.alignment.vertical = y[s.vt] || void 0, s.tb !== void 0 && (p.s.alignment = p.s.alignment || {}, s.tb === "1" ? p.s.alignment.wrapText = !0 : s.tb === "2" && (p.s.alignment.shrinkToFit = !0)), D.add(b), g[b] = p;
|
|
651
|
+
}), R.forEach((c, h) => {
|
|
652
|
+
Array.isArray(c) && c.forEach((f, s) => {
|
|
653
|
+
if (!f || typeof f != "object") return;
|
|
654
|
+
const b = F.encode_cell({ r: h, c: s });
|
|
655
|
+
if (D.has(b)) return;
|
|
656
|
+
const p = !!f.f, E = f.bg || f.bl || f.it || f.cl || f.un || f.fs || f.ff || f.fc || f.ht !== void 0 || f.vt !== void 0 || f.tb !== void 0 || f.tr !== void 0;
|
|
657
|
+
if (!p && !E) return;
|
|
658
|
+
const y = { ...g[b] || {} };
|
|
659
|
+
if (y.s = y.s || {}, p && (y.f = f.f.replace(/^=/, "")), f.bg) {
|
|
660
|
+
const $ = Y(f.bg);
|
|
661
661
|
$ && (y.s.fill = { patternType: "solid", fgColor: { rgb: $ } });
|
|
662
662
|
}
|
|
663
663
|
y.s.font = {
|
|
664
664
|
...y.s.font || {},
|
|
665
|
-
bold:
|
|
666
|
-
italic:
|
|
667
|
-
strike:
|
|
668
|
-
underline:
|
|
669
|
-
sz:
|
|
670
|
-
name:
|
|
665
|
+
bold: f.bl === 1 || void 0,
|
|
666
|
+
italic: f.it === 1 || void 0,
|
|
667
|
+
strike: f.cl === 1 || void 0,
|
|
668
|
+
underline: f.un === 1 || void 0,
|
|
669
|
+
sz: f.fs ?? 10,
|
|
670
|
+
name: f.ff ?? void 0,
|
|
671
671
|
color: (() => {
|
|
672
|
-
const $ = Y(
|
|
672
|
+
const $ = Y(f.fc);
|
|
673
673
|
return $ ? { rgb: $ } : void 0;
|
|
674
674
|
})()
|
|
675
675
|
};
|
|
676
676
|
const A = { 0: "center", 1: "left", 2: "right" }, S = { 0: "center", 1: "top", 2: "bottom" };
|
|
677
677
|
y.s.alignment = {
|
|
678
678
|
...y.s.alignment || {},
|
|
679
|
-
horizontal: A[
|
|
680
|
-
vertical: S[
|
|
681
|
-
textRotation:
|
|
682
|
-
},
|
|
679
|
+
horizontal: A[f.ht] || void 0,
|
|
680
|
+
vertical: S[f.vt] || void 0,
|
|
681
|
+
textRotation: f.tr !== void 0 ? f.tr : void 0
|
|
682
|
+
}, f.tb === "1" ? y.s.alignment.wrapText = !0 : f.tb === "2" && (y.s.alignment.shrinkToFit = !0), g[b] = y;
|
|
683
683
|
});
|
|
684
|
-
}), R.forEach((
|
|
685
|
-
Array.isArray(
|
|
684
|
+
}), R.forEach((c, h) => {
|
|
685
|
+
Array.isArray(c) && c.forEach((f, s) => {
|
|
686
686
|
var y;
|
|
687
|
-
if (!
|
|
688
|
-
const
|
|
689
|
-
|
|
690
|
-
...
|
|
691
|
-
v:
|
|
687
|
+
if (!f || ((y = f.ct) == null ? void 0 : y.t) !== "inlineStr" || !Array.isArray(f.ct.s)) return;
|
|
688
|
+
const b = F.encode_cell({ r: h, c: s }), p = X(f.ct.s);
|
|
689
|
+
g[b] = {
|
|
690
|
+
...g[b] || {},
|
|
691
|
+
v: p,
|
|
692
692
|
t: "s"
|
|
693
693
|
};
|
|
694
|
-
const E = rt(
|
|
695
|
-
E &&
|
|
694
|
+
const E = rt(f.ct.s);
|
|
695
|
+
E && V[W].set(b, E);
|
|
696
696
|
});
|
|
697
|
-
}), (
|
|
698
|
-
|
|
697
|
+
}), (O = m.config) != null && O.borderInfo && xt(g, m.config.borderInfo), Object.keys(g).forEach((c) => {
|
|
698
|
+
if (c.startsWith("!")) return;
|
|
699
|
+
const h = g[c];
|
|
700
|
+
h && h.s && h.t == null && h.v == null && h.f == null && (h.t = "s", h.v = "");
|
|
701
|
+
});
|
|
702
|
+
const v = m.name.length > 30 ? m.name.slice(0, 30) : m.name;
|
|
699
703
|
if (z.has(v)) {
|
|
700
|
-
const
|
|
704
|
+
const c = v !== m.name ? `"${m.name}" is too long and collides with another sheet after being shortened to "${v}"` : `Two sheets share the name "${m.name}"`;
|
|
701
705
|
throw new Error(
|
|
702
|
-
`${
|
|
706
|
+
`${c}. Sheet names must be unique. Rename one and try again.`
|
|
703
707
|
);
|
|
704
708
|
}
|
|
705
|
-
z.add(v), F.book_append_sheet(B,
|
|
709
|
+
z.add(v), F.book_append_sheet(B, g, v);
|
|
706
710
|
});
|
|
707
711
|
const Z = await (r == null ? void 0 : r(t)) || "Untitled", K = it(B, {
|
|
708
712
|
bookType: "xlsx",
|
|
709
713
|
type: "array",
|
|
710
714
|
compression: !0
|
|
711
|
-
}),
|
|
712
|
-
await
|
|
713
|
-
const H =
|
|
714
|
-
(
|
|
715
|
-
const tt =
|
|
715
|
+
}), j = new ct();
|
|
716
|
+
await j.xlsx.load(K);
|
|
717
|
+
const H = j.model;
|
|
718
|
+
(u = (i = H == null ? void 0 : H.styles) == null ? void 0 : i.fonts) != null && u[0] && (H.styles.fonts[0] = { ...H.styles.fonts[0], size: 10 });
|
|
719
|
+
const tt = x.map(() => ({
|
|
716
720
|
duplicateValues: []
|
|
717
721
|
}));
|
|
718
|
-
|
|
719
|
-
const R =
|
|
722
|
+
x.forEach((m, W) => {
|
|
723
|
+
const R = j.worksheets[W];
|
|
720
724
|
if (!R) return;
|
|
721
|
-
vt(R,
|
|
722
|
-
const
|
|
723
|
-
Object.entries(
|
|
725
|
+
vt(R, V[W]);
|
|
726
|
+
const g = m.data;
|
|
727
|
+
Object.entries(m.hyperlink || {}).forEach(([L, O]) => {
|
|
724
728
|
var A, S, $, _;
|
|
725
|
-
const
|
|
726
|
-
if (!(
|
|
727
|
-
const [
|
|
728
|
-
if (Number.isNaN(
|
|
729
|
-
const s = F.encode_cell({ r:
|
|
729
|
+
const c = ut(O);
|
|
730
|
+
if (!(c != null && c.linkAddress)) return;
|
|
731
|
+
const [h, f] = L.split("_").map(Number);
|
|
732
|
+
if (Number.isNaN(h) || Number.isNaN(f)) return;
|
|
733
|
+
const s = F.encode_cell({ r: h, c: f }), b = R.getCell(s), p = (A = g == null ? void 0 : g[h]) == null ? void 0 : A[f];
|
|
730
734
|
let E = "";
|
|
731
|
-
|
|
732
|
-
const y = E || (typeof
|
|
733
|
-
|
|
734
|
-
text: y ||
|
|
735
|
-
hyperlink:
|
|
735
|
+
p && typeof p == "object" && ((S = p.ct) == null ? void 0 : S.t) === "inlineStr" && Array.isArray(p.ct.s) && (E = X(p.ct.s));
|
|
736
|
+
const y = E || (typeof b.text == "string" && b.text.length > 0 ? b.text : (($ = b.value) == null ? void 0 : $.text) || (Array.isArray((_ = b.value) == null ? void 0 : _.richText) ? b.value.richText.map((P) => P.text || "").join("") : "") || "");
|
|
737
|
+
b.value = {
|
|
738
|
+
text: y || c.linkAddress,
|
|
739
|
+
hyperlink: c.linkAddress
|
|
736
740
|
};
|
|
737
741
|
});
|
|
738
|
-
const { nextPriority: D, pendingDuplicateValues: v } = Tt(R,
|
|
742
|
+
const { nextPriority: D, pendingDuplicateValues: v } = Tt(R, m, 1);
|
|
739
743
|
tt[W] = { duplicateValues: v };
|
|
740
744
|
let J = D;
|
|
741
|
-
if (!
|
|
745
|
+
if (!m.dataVerification) return;
|
|
742
746
|
const N = R;
|
|
743
747
|
N.dataValidations || (N.dataValidations = { model: {} }), N.dataValidations.model || (N.dataValidations.model = {});
|
|
744
748
|
const U = N.dataValidations.model;
|
|
745
|
-
Object.entries(
|
|
746
|
-
const
|
|
747
|
-
if (
|
|
748
|
-
const [
|
|
749
|
-
if (
|
|
750
|
-
const
|
|
749
|
+
Object.entries(m.dataVerification).forEach(([L, O]) => {
|
|
750
|
+
const c = O;
|
|
751
|
+
if (c.type !== "dropdown" && c.type !== "checkbox") return;
|
|
752
|
+
const [h, f] = L.split("_").map(Number), s = F.encode_cell({ r: h, c: f });
|
|
753
|
+
if (c.type === "checkbox") {
|
|
754
|
+
const p = (c.value1 || "TRUE").trim(), E = (c.value2 || "FALSE").trim(), y = [p, E].filter(Boolean);
|
|
751
755
|
U[s] = {
|
|
752
756
|
type: "list",
|
|
753
757
|
allowBlank: !0,
|
|
754
758
|
formulae: [`"${y.join(",")}"`],
|
|
755
|
-
showInputMessage: !!
|
|
756
|
-
prompt:
|
|
757
|
-
showErrorMessage: !!
|
|
759
|
+
showInputMessage: !!c.hintShow,
|
|
760
|
+
prompt: c.hintValue || "",
|
|
761
|
+
showErrorMessage: !!c.prohibitInput
|
|
758
762
|
};
|
|
759
763
|
return;
|
|
760
764
|
}
|
|
761
|
-
const
|
|
762
|
-
if (
|
|
765
|
+
const b = (c.value1 || "").split(",").map((p) => p.trim()).filter(Boolean);
|
|
766
|
+
if (b.length !== 0 && (U[s] = {
|
|
763
767
|
type: "list",
|
|
764
768
|
allowBlank: !0,
|
|
765
|
-
formulae: [`"${
|
|
766
|
-
showInputMessage: !!
|
|
767
|
-
prompt:
|
|
768
|
-
showErrorMessage: !!
|
|
769
|
-
},
|
|
770
|
-
const
|
|
771
|
-
const $ =
|
|
772
|
-
if (isNaN($) || isNaN(_) || isNaN(
|
|
773
|
-
const M = `FF${E($)}${E(_)}${E(
|
|
769
|
+
formulae: [`"${b.join(",")}"`],
|
|
770
|
+
showInputMessage: !!c.hintShow,
|
|
771
|
+
prompt: c.hintValue || "",
|
|
772
|
+
showErrorMessage: !!c.prohibitInput
|
|
773
|
+
}, c.color)) {
|
|
774
|
+
const p = c.color.split(",").map((A) => parseInt(A.trim(), 10)), E = (A) => Math.max(0, Math.min(255, A)).toString(16).padStart(2, "0").toUpperCase(), y = b.map((A, S) => {
|
|
775
|
+
const $ = p[S * 3], _ = p[S * 3 + 1], P = p[S * 3 + 2];
|
|
776
|
+
if (isNaN($) || isNaN(_) || isNaN(P)) return null;
|
|
777
|
+
const M = `FF${E($)}${E(_)}${E(P)}`;
|
|
774
778
|
return {
|
|
775
779
|
type: "cellIs",
|
|
776
780
|
operator: "equal",
|
|
@@ -791,28 +795,28 @@ const Y = (e) => {
|
|
|
791
795
|
});
|
|
792
796
|
}
|
|
793
797
|
});
|
|
794
|
-
}),
|
|
798
|
+
}), x.forEach((m, W) => {
|
|
795
799
|
var v;
|
|
796
|
-
if (!((v =
|
|
797
|
-
const R =
|
|
800
|
+
if (!((v = m.images) != null && v.length)) return;
|
|
801
|
+
const R = j.worksheets[W];
|
|
798
802
|
if (!R) return;
|
|
799
|
-
const
|
|
803
|
+
const g = Number(m.defaultColWidth) || 99, D = Number(m.defaultRowHeight) || 21;
|
|
800
804
|
pt(
|
|
801
805
|
R,
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
+
j,
|
|
807
|
+
m.images,
|
|
808
|
+
m,
|
|
809
|
+
g,
|
|
806
810
|
D
|
|
807
811
|
);
|
|
808
812
|
});
|
|
809
|
-
const { applyDefinedNamesToExcelWorkbook: ot } = await import("./xlsx-defined-names-
|
|
813
|
+
const { applyDefinedNamesToExcelWorkbook: ot } = await import("./xlsx-defined-names-u1Jyf-M6.js");
|
|
810
814
|
ot(
|
|
811
|
-
|
|
815
|
+
j,
|
|
812
816
|
(T = (a = (d = e.current).getWorkbookContext) == null ? void 0 : a.call(d)) == null ? void 0 : T.definedNames,
|
|
813
|
-
|
|
817
|
+
x
|
|
814
818
|
);
|
|
815
|
-
const at = await
|
|
819
|
+
const at = await j.xlsx.writeBuffer(), st = await Rt(at, tt), lt = new Blob([st], {
|
|
816
820
|
type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
|
817
821
|
}), et = URL.createObjectURL(lt), Q = document.createElement("a");
|
|
818
822
|
Q.href = et, Q.download = `${Z}.xlsx`, Q.click(), URL.revokeObjectURL(et);
|
|
@@ -827,5 +831,5 @@ const Y = (e) => {
|
|
|
827
831
|
}
|
|
828
832
|
};
|
|
829
833
|
export {
|
|
830
|
-
|
|
834
|
+
Pt as handleExportToXLSX
|
|
831
835
|
};
|